Skip to content

Feature/unify config json - #2

Merged
ShotaroKataoka merged 6 commits into
mainfrom
feature/unify-config-json
Apr 6, 2026
Merged

ShotaroKataoka merged 6 commits into
mainfrom
feature/unify-config-json

Conversation

@ShotaroKataoka

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…put_dir setting

SPEC: 20260406-0900_unify-config-json

- Create skill/sdpm/config.py as single config loader
- Add skill/assets/config.example.json (git-managed reference)
- Add skill/assets/config.json to .gitignore
- Refactor assets/__init__.py and preview/backend.py to use shared loader
- Replace hardcoded ~/Documents/sdpm with configurable output_dir
- Default output: ~/Documents/SDPM-Presentations
- Update docs (ja/en) with new config schema
…resentation-maker

SPEC: 20260406-0900_unify-config-json

- Remove all 33 occurrences of 'pptx-maker' across 15 files
- User-facing names: spec-driven-presentation-maker (full name)
- Internal/technical names: sdpm (short name)
- Output dir paths: ~/Documents/SDPM-Presentations (via config)
- Temp dir paths: /tmp/sdpm/
- Delete obsolete skill/scripts/package_zip.sh
Removed during config.py extraction but still used by manifest loading functions.
…ons with {project_dir}

Output paths should follow the directory created by init, not a hardcoded location.
This allows config.py's output_dir to control the base path.
- edit-existing, translate-pptx, create-style: ~/Documents/SDPM-Presentations/{name} → {project_dir}
- create-new-3-review: add explicit -o {project_dir}/output.pptx to generate command
- Ensures output follows init directory, not hardcoded location
Agent self-checks file access capability before init to determine
whether to use default output path or specify -o for workspace-local output.
@ShotaroKataoka
ShotaroKataoka merged commit 4dfda58 into main Apr 6, 2026
5 checks passed
ShotaroKataoka added a commit that referenced this pull request Oct 31, 2026
…E items (#467)

* 🐛 fix(html-output-mode): stop every build on an invalid deck.json outputFormat

An explicit invalid outputFormat (e.g. "htlm") no longer falls through to a PPTX
build: the CLI exits 1, sdpm.tools.generate_pptx raises, local and remote run_python
report errors.outputFormat and build nothing, remote generate_pptx / get_preview
return the error. Absent/null still means PPTX; unreadable deck.json keeps the PPTX path.

Verified: uv run pytest tests/test_cli_contract.py tests/test_run_python_semantics.py tests/test_remote_html.py tests/test_entry_tools.py -q (129 passed)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 1 (review #2) done
Next: FEAT-001 item 2 (scroll overflow of free-positioned blocks)

* 🐛 fix(html-output-mode): report scroll overflow of free-positioned blocks

Free-positioned top-level blocks now get the content-larger-than-box overflow finding
that placeholders, regions and region children already got.

Verified: uv run pytest tests/test_html_layout_judge.py tests/test_html_browser_check.py -q (24 passed, 8 real-browser skipped)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 2 (review #6) done
Next: FEAT-001 item 3 (decoration availability by the layouts that need a render)

* 🐛 fix(html-output-mode): judge decoration availability by the layouts that need a render

template_html_view counted SVGs against every layout, so a template whose layouts draw
only placeholders (blank-light) or a complete cache with such layouts reported
decorations as unavailable without LibreOffice. It now uses the converter's predicate,
template.decorations_complete (renamed from _svgs_complete, now public).

Verified: uv run pytest tests/test_entry_tools.py tests/test_html_template.py -q (57 passed; both new tests fail on the old code)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 3 (review #8) done
Next: FEAT-001 item 4 (failed-render memo with a TTL)

* 🐛 fix(html-output-mode): retry a failed decoration render after ten minutes

The failed-render memo held for the whole process, so a transient LibreOffice failure
in a long-lived server disabled decorations until restart. The memo now stores the
failure time and is reused only within FAILED_RENDER_RETRY_S (600 s).

Verified: uv run pytest tests/test_html_template.py -q (16 passed)

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-001 item 4 (review #9) done; FEAT-001 complete
Next: FEAT-002 (browser-check egress, real-browser tests, CI)

* 🔒 fix(html-output-mode): disable WebRTC in the browser check before slide code runs

The browser check blocked http(s)/ws(s) through Fetch, but WebRTC (STUN/TURN)
bypasses Fetch and the deck CSP. An egress guard installed with
Page.addScriptToEvaluateOnNewDocument (page and auto-attached iframe targets)
removes the RTC constructors and WebTransport and makes window.open return
null; a probe after the load (top, window[n] of a fresh iframe, contentWindow,
srcdoc iframe, window.open) fails the check closed before any slide runs.
network_blocked is now set only after the probe. script-external flags
RTCPeerConnection and stun:/turn: URLs and carries per-diag kinds.

Verified: ruff clean; pytest tests/test_html_check.py tests/test_html_browser_check.py
tests/test_remote_html.py: 146 passed, 8 skipped; real-browser suite 8 passed
(Chrome); guard removed -> probe fails closed (manual run).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 5 (review #3) done
Next: real-browser tests for network block, popups, WebRTC, speaker view

* ✅ test(html-output-mode): real-browser tests for network block, popups, WebRTC and the speaker view

New opt-in tests: network requests stopped by the deck CSP and, with the CSP
removed, failed by the Fetch block (blocked_requests >= 2); window.open does
not stop the check; RTCPeerConnection unreachable from top, window[n],
contentWindow and srcdoc frames; overflow of a free-positioned block; the
speaker view's hashed script runs under the deck CSP. The real_browser marker
now skips only without SDPM_TEST_BROWSER=1, and use_browser fails when no
browser is found.

Verified: SDPM_TEST_BROWSER=1 pytest -k real_browser: 13 passed (Chrome, macOS);
without the variable: 14 passed, 13 skipped; ruff clean.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 6 (review #5, #11) done
Next: CI browser job

* 👷 ci(html-output-mode): run the real-browser tests on ubuntu with Chrome

New `browser` job: ubuntu-latest with the runner's google-chrome, the AppArmor
user-namespace restriction lifted for Chrome's sandbox, SDPM_TEST_BROWSER=1,
`pytest tests/test_html_browser_check.py -k real_browser -v -rs`. The
use_browser fixture fails when Chrome is missing, so the job cannot go green
by skipping.

Verified: ci.yml parses (yaml.safe_load), jobs include browser.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 7 (review #5) done
Next: AgentCore Browser egress canary

* ✅ test(html-output-mode): AgentCore Browser egress canary

scripts/verify_agentcore_browser_egress.py runs the remote server's browser
check (AgentCore Browser source + api.refresh_html) on a canary deck that
looks for WebRTC in every reachable window, starts ICE gathering against a
public STUN server, fetches/loads https://example.com and, with
--dns-domain, emits dns-prefetch / preconnect hints to a one-off host.
Exit 0 only when network_blocked is true, the rtc slide reported and no
WebRTC / srflx was found.

Verified (dev account, ap-northeast-1): status issues (CSP
refusals of the net slide), network_blocked true, blocked_requests 0,
"rtc: probed 5" with no "available"/"srflx", DNS egress not verified, PASS,
exit 0.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-002 item 8 (review #3) done
Next: FEAT-002 full verification

* 🐛 fix(html-output-mode): publish an HTML refresh's previews and PNGs as one revision

Each build's preview/PNG epoch is now a millisecond revision strictly above every
listed epoch, so two builds in the same second no longer share or lose keys. A
refresh that does not commit (failed preview upload or record update) deletes its
own previews and PNGs, as finalize already did.

Verified: uv run pytest tests/test_remote_html.py tests/test_html_artifacts.py tests/test_api_html_routes.py -q (66 passed); ruff clean.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-003 item 9 (review #1) done
Next: FEAT-003 item 10 (clear template-resolution error)

* 🐛 fix(html-output-mode): say how to fix an HTML deck whose template does not resolve

prepare_html_workspace re-raises a template resolution ValueError naming the
deck.json template and pointing at apply_style(deck_id, style, template);
refresh_html_deck logs that case at info level without a traceback.

Verified: uv run ruff check sdpm/ servers/ shared/ api/ agent/ (clean); uv run pytest tests/ -q (1681 passed, 39 skipped).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-003 items 9-10 done
Next: FEAT-004 (exfiltration warning surfaced, Web UI fixes)

* ✨ feat(html-output-mode): warn next to Present / Download when slide scripts reach outside

The static check's script-external findings ({slug, kinds}) are returned by
generate_html / refresh_html as script_external, written to the deck record
as htmlScriptExternal at refresh and finalize (a clean build removes it),
validated and exposed by GET /decks/{id} as scriptWarnings, and shown as an
"External access" badge before Present / PDF / HTML in the cloud Web UI.
The agent-facing run_python result (local and remote) leaves the key out;
the warnings already name these slides.

Verified: uv run ruff check (clean); uv run pytest tests/test_html_api.py
tests/test_remote_html.py tests/test_api_html_routes.py -q (79 passed);
npx vitest run src/components/deck/SlideCarousel.test.tsx (4 passed);
npx tsc --noEmit (clean).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 item 11 (review #4) done
Next: FEAT-004 item 12 (finalize label, compose lanes)

* 🐛 fix(html-output-mode): label the HTML finalize step, settle compose lanes when the tool completes

A DeckFormatContext carries the open deck's outputFormat to the chat; the
generate_pptx row (full and compact) reads "Finalizing HTML deck" when the
deck or the tool result is HTML. ComposeCard treats tool success as the
end of every lane still starting/working, so no lane stays "Queued" and
each shows its created count.

Verified: npx vitest run src/components/chat (11 files, 79 passed; the new
lane test fails without the ComposeCard change); npx tsc --noEmit (clean).

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 item 12 (E2E c, d) done
Next: FEAT-004 item 13 (local preview route test)

* ✅ test(html-output-mode): sandbox headers of the local preview route

Node-environment vitest for /api/preview/[...path] against a temp
SDPM_DECK_ROOT: output.html gets "sandbox allow-scripts allow-popups
allow-popups-to-escape-sandbox", preview/<slug>.html gets "sandbox", both
with nosniff and text/html; other .html paths are 404, paths outside the
deck 403, a PNG is image/png.

Verified: uv run ruff check (clean); uv run pytest tests/ -q (1686 passed,
39 skipped); cd web-ui && npx eslint src/ --quiet && npx tsc --noEmit &&
npm test (50 files, 406 passed) && npm run build:cloud (ok); i18n parity OK.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-004 items 11-13 done
Next: FEAT-005 (guidance, vendor manifest, docs, changelog)

* 📚 docs(html-output-mode): restore the PPTX orchestrator instructions

Restore "Do not transcribe the material:", "do not substitute — say so
and ask", "and the material, not the style" and "Name the form, not the
style's pattern or class (...)" with their original wording; the rest
stays format-neutral.

Verified: uv run pytest tests/test_entry_tools.py tests/test_agent_modes.py -q -> 66 passed

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 14 (review #7) done
Next: HTML guidance (template choice, operating steps in notes, icon contrast)

* 📚 docs(html-output-mode): HTML decks choose a template; operating steps go in the notes

html-deck.md: a Template bullet (choose one and pass it to apply_style;
deck.json keeps it); visual names the control and its effect, the
operating steps go in the speaker notes. composer-html.md: the slide shows
the controls, the steps go in <aside class="notes">; the layout pass's
frame, regions and deck.css are for what the audience reads.
slide-html-spec.md: pick the icon variant (theme_filter) that contrasts
with its background.

Verified: uv run pytest tests/test_entry_tools.py tests/test_remote_html.py -q -> 85 passed

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 15 (E2E a, b, icon contrast) done
Next: sdpm/vendor checksum manifest checked in CI

* 🔒 chore(html-output-mode): checksum manifest for sdpm/vendor, checked in CI

sdpm/vendor/SHA256SUMS (sha256sum format, ./ paths) lists every vendored
file; tests/test_vendor_checksums.py checks the listed set equals the files
on disk and each digest matches; the CI python job runs
`sha256sum -c SHA256SUMS`; sdpm/vendor/README.md documents regeneration.

Verified: uv run pytest tests/test_vendor_checksums.py -q -> 2 passed;
cd sdpm/vendor && shasum -a 256 -c SHA256SUMS -> 14 OK; ci.yml parses.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 16 (review #12) done
Next: HTML Deck Security docs (accepted risks, browser-check egress)

* 📚 docs(html-output-mode): accepted risks and browser-check egress in HTML Deck Security

docs/en/architecture.md: the browser check's WebRTC / WebTransport guard
and probe, what network_blocked means, the AgentCore canary result (DNS
hints not proven blocked); script-external findings kept on the deck
record and shown next to Present / Download, shared decks included;
Accepted risks: the 4-hour Present bearer URL outliving unsharing and the
single bucket origin with the controls that bound it.

Verified: proofread against browser_check.py, api/index.py and FEAT-002's
canary output; docs only, no code change.

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 17 (review #3, #4, #14, #15) done
Next: correct stale comments (#16)

* 💡 docs(html-output-mode): correct comments left from earlier phases

agentcore_browser.py: the runtime role has three browser actions;
composer.py: compose_slides writes .json or .html slide files, and the
finalize step is generate_pptx (PPTX or output.html); decks route: HTML
decks keep browser-check PNGs under preview/png/, so the thumbnail is the
static HTML preview.

Verified: uv run pytest tests/test_agent_modes.py -q -> 25 passed;
cd web-ui && npx tsc --noEmit -> clean

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 18 (review #16) done
Next: collapse the [Unreleased] HTML entries in CHANGELOG.md

* 📚 docs(html-output-mode): collapse the [Unreleased] HTML entries into the net change

One "HTML output mode" Added entry describes what ships (local + cloud,
Web UI player / Present / PDF / HTML, CSP, scripts with ECharts / D3,
browser_check with WebRTC disabled, PNG previews, external links in new
tabs, script-external warning on the deck page, invalid outputFormat stops
builds, tool count 20, PPTX unchanged, deploy list). The phase entries, the
guidance and js_check Changed entries, the SDPM_JS_CHECK Removed entry and
the HTML Fixed entries are gone; runtime role, Python 3.10, Haiku 5.5 and
Security entries are kept.

Verified: no SDPM_JS_CHECK / js_check in [Unreleased].

SPEC: 20261029-1619_html-output-mode
Progress: FEAT-005 item 19 (review #13) done
Next: whole-branch verification (item 20)

* 🐛 fix(html-output-mode): finalize removes its previews when the record update fails

refresh deletes an uncommitted run's previews and PNGs (1e3f5186), but
finalize_html_deck only did so for a failed preview upload: a failed record
update left the new-revision previews winning the key map over the record's
older output.html. finalize now deletes this run's previews before re-raising.

Verified: uv run ruff check sdpm/ servers/ shared/ api/ agent/ -> clean;
uv run pytest tests/ -q -> 1689 passed, 39 skipped (new
test_generate_pptx_record_failure_removes_this_runs_previews fails without the fix).

SPEC: 20261029-1619_html-output-mode
Progress: integration of FEAT-001..005; finalize matches refresh on uncommitted builds
Next: integration review verdict

* 📚 docs(html-output-mode): every visible text names the content; operating steps only in the notes

Composers still drew operating instructions as captions, hint lines and the
starting text of fields a control fills (E2E iteration 1: 4 of 10 scripted
slides in fceb8dfc / b861428b). composer-html.md and slide-html-spec.md now
say that every visible text, captions, labels and a field's starting text
included, names the content, and that how to operate the slide is written
only in <aside class="notes">. html-deck.md's review step sends such a slide
back to its composer.

Ran: uv run pytest -q tests/test_entry_tools.py tests/test_run_python_semantics.py (pass)

SPEC: 20261029-1619_html-output-mode
Progress: operating-instruction guidance tightened for composer and orchestrator review
Next: redeploy to dev and re-run the final E2E

* 📚 docs(html-output-mode): composer checks each icon against its background in the PNG

E2E iteration 1 (9c52ea4c concept) again drew black icons on the dark
aws-dark background. The composer's PNG check now names icon contrast and
points to search_assets theme_filter for the other variant.

Ran: make lint (pass); make test (1687 passed, 39 skipped)

SPEC: 20261029-1619_html-output-mode
Progress: icon-contrast guidance added to the composer's check step
Next: redeploy to dev and re-run the final E2E

* 🔒 chore(html-output-mode): suppress semgrep path-join finding in the preview route test fixture

The CI ASH scan (semgrep, HIGH) flagged path.join(root, rel) in the
test's write() helper. root is a mkdtemp directory and rel is a literal
fixture path, so annotate it with the same nosemgrep comment the other
tmpdir fixtures use. Test-only change; no runtime behaviour changes.

Verified: npx vitest run src/app/api/preview -> 5 passed;
ash --mode local --fail-on-findings -> exit 0 (semgrep/bandit/checkov/
detect-secrets PASSED).

SPEC: 20261029-1619_html-output-mode
Progress: CI scan job failure on PR #467 fixed
Next: watch PR #467 checks until all green

* 🐛 fix(html-output-mode): last low review items before merge

- Icon guidance: theme_filter picks a light/dark variant; SVG icons without variants
  (Material) are recoloured with CSS fill
- Remote _deck_format and tools._is_html_deck treat a non-object deck.json as PPTX
- orchestrator.md: restore main's PPTX wording ("only when", visual definition)
- .gitattributes: sdpm/vendor/** -text so vendor checksums hold on CRLF checkouts
- architecture.md: unproven DNS hints in the cloud browser check as an accepted risk
- template.py: fix the garbled comment above FAILED_RENDER_RETRY_S

SPEC: 20261029-1619_html-output-mode
Progress: PR #467 review low items closed
Next: merge #467, then dev/html-output -> main
ShotaroKataoka added a commit that referenced this pull request Nov 9, 2026
…pening; message_composer bounds (#563)

* fix(local-webui): replay a period until its chat is saved; no doubled replies; message_composer bounds

The non-blocking findings of the web-1 review (1-3) and the web-2 review (1-2), R5 of the
pre-0.14 polish.

web-1 #1, a replay without its opening turn duplicated the reply:
- chat.ts buffers consecutive text deltas as one event under the last one's id (kiro-cli
  sends one per chunk), so MAX_BUFFERED_EVENTS (2000) drops a period's beginning much later.
  `bufferedAfter` gives a Last-Event-ID inside a merged run only the text after it.
- useChatStream: a replay whose first message or output comes before any prompt turn cuts
  the history with `cutHistory(null)`; cutLocalAtPrompt(null) keeps the messages through the
  last user message. Cloud's cut returns undefined for null (unchanged behaviour).

web-1 #2, delivered before saved:
- The stream's end only records `endWritten`; the period is delivered (`markDelivered`) when
  the page's save after the stream's end reaches /api/agent/chat with `delivered: <session>`
  and `.chat.json` was written (saveChatToDeck now returns whether it wrote). Until then
  /api/agent/stream replays it. onSendComplete passes the session id the run streamed.

web-1 #3, a failed /stream settled running tasks:
- resumeLocalAgent rejects unless the answer is SSE or a JSON `{running: false}`; resumeLocal
  maps a failure to undefined, so settleStaleTasks runs only on the server's "nothing runs".

web-2 #1, message_composer relayed past the tool's checks:
- compose-run routes only input within the tool's bounds (group >= 1, text 1..10 000 code
  points); out-of-bounds input sends nothing, shows the tool's own refusal as an error and
  sends no <message_composer_error>.

web-2 #2, finish() read isDropped before dropped() set it:
- finish({dropped: true}): a drop ends the task cancelled, also after the 60-minute timeout.

CHANGELOG [Unreleased] / Fixed: two entries.

Checks run (worktree, this commit's tree):
- web-ui: npx eslint src/ e2e/ --quiet: ok; npx tsc --noEmit: ok; npm test: 111 files /
  1350 tests passed; npm run build:cloud: ok; npx playwright test: 28 passed;
  en/ja key parity: OK; package-lock.json unchanged
- make lint: ok
- make test: 2813 passed, 18 skipped, 1 failed: tests/test_html_assemble.py::
  test_svg_icon_is_inlined_with_prefixed_ids ("asset not found: assets:aws/
  Arch_AWS-Lambda_48"), from this machine's installed asset catalog; this commit changes no
  Python, test or asset file
- ash scan --mode local --fail-on-findings: exit 0
- New tests fail on the old code (compose-run bounds and drop-after-timeout checked by
  stashing compose-run.ts)

* fix(local-webui): keep a period's opening in the replay buffer; route coerced message_composer input as not delivered

Review of 66e51de2 (review.json, CHANGES_REQUESTED), findings 1-4.

1. message_composer input the tool accepts but toolUse does not route (blocker):
   messageEnded shows the tool's own result as an error only when the tool refused
   (end.status "error" or result.status "error"). Other out-of-bounds input, such as a
   numeric-string group the tool coerces and answers "Sent", goes down the not-delivered
   path again: an error card and a <message_composer_error>, as on main.
2. A prompt-less replay dropped the saved head of a reply or still duplicated it. Chosen
   outcome: chat.ts never drops a period's opening (its events through the first turn,
   Period.opening). Past MAX_BUFFERED_EVENTS the oldest event after the opening goes, so a
   Local replay always starts with its prompt and the page cuts its history there. A saved
   reply or steer is never shown twice. What the buffer dropped is not replayed, so the
   reopened chat shows that reply from the oldest part kept. The cutHistory(null) path
   (HistoryCut, cutWithoutPrompt, cutLocalAtPrompt(null)) is removed because nothing reaches
   it now.
3. Style chat periods were never delivered: a stream that writes the end of a period of a
   chat no deck holds (savedDecks empty) delivers it at once, since no page can reopen it.
4. CHANGELOG: names only the empty and over-long text cases as delivered; describes the
   buffer outcome.

Tests: compose-run case {group: "1", text: "x"} with a success result asserts the
<message_composer_error>; chat.test pins the opening past the cap; useChatStream test pins
a truncated replay against a saved full reply and a saved steer (no copy, head gone);
acp-process case for a deck-less chat's delivery; the replay-until-saved cases bind a deck.
The three new server-side tests fail on 66e51de2's code.

Checks run (worktree, this commit's tree):
- web-ui: npx eslint src/ e2e/ --quiet: ok; npx tsc --noEmit: ok; npm test: 111 files /
  1351 tests passed; npm run build:cloud: ok (after removing a stale gitignored build/dev
  from an earlier dev server); npx playwright test: 28 passed; en/ja key parity: OK;
  package-lock.json unchanged
- make lint: ok
- make test: 2813 passed, 18 skipped, 1 failed: tests/test_html_assemble.py::
  test_svg_icon_is_inlined_with_prefixed_ids ("asset not found: assets:aws/
  Arch_AWS-Lambda_48"), from this machine's asset catalog; no Python, test or asset file changed
- ash scan --mode local --fail-on-findings: exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant