@bastani/atomic 0.9.13 → 0.9.14-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +58 -0
- package/README.md +3 -3
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +14 -0
- package/dist/builtin/subagents/README.md +6 -4
- package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +1 -1
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +1 -1
- package/dist/builtin/subagents/agents/worker.md +1 -1
- package/dist/builtin/subagents/package.json +6 -5
- package/dist/builtin/subagents/src/agents/agent-discovery.ts +17 -11
- package/dist/builtin/subagents/src/agents/agent-loaders.ts +115 -43
- package/dist/builtin/subagents/src/agents/agent-management-helpers.ts +10 -8
- package/dist/builtin/subagents/src/agents/agent-management.ts +8 -7
- package/dist/builtin/subagents/src/agents/agent-overrides.ts +2 -2
- package/dist/builtin/subagents/src/agents/agent-scope.ts +1 -1
- package/dist/builtin/subagents/src/agents/agent-selection.ts +1 -1
- package/dist/builtin/subagents/src/agents/agent-serializer.ts +24 -3
- package/dist/builtin/subagents/src/agents/agent-types.ts +3 -1
- package/dist/builtin/subagents/src/agents/agents.ts +7 -5
- package/dist/builtin/subagents/src/agents/frontmatter.ts +67 -22
- package/dist/builtin/subagents/src/agents/identity.ts +1 -1
- package/dist/builtin/subagents/src/agents/skills-paths.ts +1 -1
- package/dist/builtin/subagents/src/agents/skills.ts +64 -6
- package/dist/builtin/subagents/src/extension/config.ts +1 -1
- package/dist/builtin/subagents/src/extension/control-notices.ts +2 -2
- package/dist/builtin/subagents/src/extension/doctor.ts +15 -5
- package/dist/builtin/subagents/src/extension/fanout-child.ts +12 -12
- package/dist/builtin/subagents/src/extension/index.ts +23 -23
- package/dist/builtin/subagents/src/extension/notification-content.ts +1 -1
- package/dist/builtin/subagents/src/extension/schemas.ts +1 -1
- package/dist/builtin/subagents/src/extension/startup-maintenance.ts +3 -3
- package/dist/builtin/subagents/src/intercom/intercom-bridge.ts +3 -3
- package/dist/builtin/subagents/src/intercom/result-intercom.ts +1 -1
- package/dist/builtin/subagents/src/intercom/supervisor-authorization.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/completion-notification.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/execution-detach-reservations.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/execution-intercom-detach.ts +3 -3
- package/dist/builtin/subagents/src/runs/foreground/execution-run-sync.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/execution-updates.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/execution-utils.ts +1 -1
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts +27 -11
- package/dist/builtin/subagents/src/runs/foreground/notify.ts +3 -3
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-context.ts +11 -11
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-input.ts +3 -3
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +15 -14
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel.ts +19 -19
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-runtime.ts +2 -2
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +14 -13
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-status.ts +9 -9
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-types.ts +7 -7
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-worktree.ts +6 -6
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor.ts +24 -23
- package/dist/builtin/subagents/src/runs/inprocess/control-registry.ts +1 -1
- package/dist/builtin/subagents/src/runs/inprocess/control-status.ts +3 -3
- package/dist/builtin/subagents/src/runs/inprocess/index.ts +3 -3
- package/dist/builtin/subagents/src/runs/inprocess/prompt-behavior.ts +17 -8
- package/dist/builtin/subagents/src/runs/inprocess/runner.ts +60 -12
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-api.ts +8 -8
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-control.ts +3 -3
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-core.ts +4 -4
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-projection.ts +4 -4
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-registry.ts +5 -5
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-rendering.ts +3 -3
- package/dist/builtin/subagents/src/runs/inprocess/runtime-support/nested-sanitize.ts +3 -3
- package/dist/builtin/subagents/src/runs/inprocess.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/long-running-guard.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/model-candidate-filter.ts +3 -3
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +2 -2
- package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/single-output.ts +1 -1
- package/dist/builtin/subagents/src/runs/shared/subagent-control.ts +1 -1
- package/dist/builtin/subagents/src/shared/artifacts.ts +2 -2
- package/dist/builtin/subagents/src/shared/event-jsonl-writer.ts +1 -1
- package/dist/builtin/subagents/src/shared/fast-mode.ts +1 -1
- package/dist/builtin/subagents/src/shared/formatters.ts +2 -2
- package/dist/builtin/subagents/src/shared/jsonl-writer.ts +1 -1
- package/dist/builtin/subagents/src/shared/model-resolution.ts +1 -1
- package/dist/builtin/subagents/src/shared/session-tokens.ts +1 -1
- package/dist/builtin/subagents/src/shared/settings.ts +4 -4
- package/dist/builtin/subagents/src/shared/status-format.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-config.ts +16 -4
- package/dist/builtin/subagents/src/shared/types-depth.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-nested.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-output.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-results.ts +1 -1
- package/dist/builtin/subagents/src/shared/types-runtime.ts +1 -1
- package/dist/builtin/subagents/src/shared/types.ts +6 -6
- package/dist/builtin/subagents/src/shared/utils.ts +3 -3
- package/dist/builtin/subagents/src/slash/prompt-template-bridge.ts +1 -1
- package/dist/builtin/subagents/src/slash/slash-bridge.ts +3 -3
- package/dist/builtin/subagents/src/slash/slash-commands.ts +6 -6
- package/dist/builtin/subagents/src/slash/slash-live-state.ts +3 -3
- package/dist/builtin/subagents/src/tui/render-event-formatting.ts +2 -2
- package/dist/builtin/subagents/src/tui/render-layout.ts +1 -1
- package/dist/builtin/subagents/src/tui/render-progress.ts +2 -2
- package/dist/builtin/subagents/src/tui/render-result-compact.ts +7 -7
- package/dist/builtin/subagents/src/tui/render-result.ts +10 -10
- package/dist/builtin/subagents/src/tui/render-stable-output.ts +1 -1
- package/dist/builtin/subagents/src/tui/render-status-progress.ts +5 -5
- package/dist/builtin/subagents/src/tui/render.ts +4 -4
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +57 -0
- package/dist/builtin/workflows/README.md +39 -8
- package/dist/builtin/workflows/builtin/adversarial-verification-runner.ts +16 -5
- package/dist/builtin/workflows/builtin/adversarial-verification.ts +4 -0
- package/dist/builtin/workflows/builtin/classify-and-act.ts +4 -0
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.ts +4 -0
- package/dist/builtin/workflows/builtin/generate-and-filter-runner.ts +12 -4
- package/dist/builtin/workflows/builtin/generate-and-filter.ts +4 -0
- package/dist/builtin/workflows/builtin/goal-models.ts +8 -10
- package/dist/builtin/workflows/builtin/goal.ts +4 -0
- package/dist/builtin/workflows/builtin/index.d.ts +0 -4
- package/dist/builtin/workflows/builtin/loop-until-done-runner.ts +4 -2
- package/dist/builtin/workflows/builtin/loop-until-done.ts +4 -0
- package/dist/builtin/workflows/builtin/open-claude-design-live-protocol.ts +305 -0
- package/dist/builtin/workflows/builtin/open-claude-design-phases.ts +115 -171
- package/dist/builtin/workflows/builtin/open-claude-design-runner.ts +9 -25
- package/dist/builtin/workflows/builtin/open-claude-design-setup.ts +19 -86
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +0 -6
- package/dist/builtin/workflows/builtin/open-claude-design.d.ts +0 -5
- package/dist/builtin/workflows/builtin/open-claude-design.ts +11 -15
- package/dist/builtin/workflows/builtin/ralph-models.ts +24 -29
- package/dist/builtin/workflows/builtin/ralph.ts +4 -0
- package/dist/builtin/workflows/builtin/tournament-runner.ts +6 -3
- package/dist/builtin/workflows/builtin/tournament.ts +4 -0
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +25 -31
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +1 -0
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +16 -10
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +6 -0
- package/dist/builtin/workflows/skills/impeccable/reference/animate.md +3 -0
- package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +3 -1
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +6 -1
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +18 -2
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +24 -30
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +1 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +16 -10
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +1 -0
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +12 -6
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +12 -3
- package/dist/builtin/workflows/skills/impeccable/reference/ios.md +6 -0
- package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +102 -0
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +113 -521
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +39 -26
- package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/polish.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +25 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +332 -221
- package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +10 -19
- package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +91 -38
- package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +19 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +56 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +10 -16
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +140 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +1174 -694
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +1 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +5 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +431 -45
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +10 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +47 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +23 -22
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +384 -384
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +466 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +2 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +270 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +51 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +70 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +336 -90
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +38 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +77 -11
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +102 -19
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +44 -59
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +3 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +57 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +369 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +31 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +73 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +617 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +71 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +29 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +54 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +47 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +157 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +143 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +205 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +49 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +170 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +26 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +26 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +71 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +247 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +70 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +42 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +169 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +670 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +232 -35
- package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +969 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +621 -74
- package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +66 -28
- package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +12 -12
- package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +75 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +135 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +23 -37
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +945 -115
- package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +33 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +132 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +173 -425
- package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +2 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +16 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +39 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +194 -27
- package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +10 -4
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +50 -31
- package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +91 -28
- package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +8 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +759 -109
- package/dist/builtin/workflows/src/authoring/workflow.ts +9 -0
- package/dist/builtin/workflows/src/authoring.d.ts +3 -0
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +23 -2
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +30 -17
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +14 -0
- package/dist/builtin/workflows/src/durable/dbos-lifecycle.ts +60 -57
- package/dist/builtin/workflows/src/durable/dbos-process-owner.ts +87 -0
- package/dist/builtin/workflows/src/durable/dbos-registration-diagnostics.ts +113 -0
- package/dist/builtin/workflows/src/durable/factory.ts +11 -8
- package/dist/builtin/workflows/src/durable/tool-failure-checkpoint.ts +5 -0
- package/dist/builtin/workflows/src/durable/tool-primitive.ts +186 -20
- package/dist/builtin/workflows/src/durable/types.ts +4 -0
- package/dist/builtin/workflows/src/durable/workflow-heartbeat-anchor.ts +153 -0
- package/dist/builtin/workflows/src/engine/run-durable-stage-session.ts +28 -0
- package/dist/builtin/workflows/src/engine/run-tool-control-registry.ts +9 -1
- package/dist/builtin/workflows/src/engine/run.ts +1 -0
- package/dist/builtin/workflows/src/extension/adopt-session-run-state.ts +20 -0
- package/dist/builtin/workflows/src/extension/background-ui-adapter.ts +9 -30
- package/dist/builtin/workflows/src/extension/extension-factory.ts +3 -0
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +28 -10
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +138 -0
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +3365 -1341
- package/dist/builtin/workflows/src/extension/workflow-heartbeat-delivery.ts +197 -0
- package/dist/builtin/workflows/src/extension/workflow-heartbeat-notice.ts +115 -0
- package/dist/builtin/workflows/src/extension/workflow-heartbeat-scheduler.ts +962 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +4 -1
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +29 -5
- package/dist/builtin/workflows/src/extension/workflow-tool-send.ts +32 -1
- package/dist/builtin/workflows/src/runs/background/cancellation-registry.ts +10 -1
- package/dist/builtin/workflows/src/runs/background/job-tracker.ts +10 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-prompt-nodes.ts +16 -11
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +31 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +41 -10
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-messages.ts +48 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-output.ts +4 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-structured-output.ts +45 -12
- package/dist/builtin/workflows/src/sdk-surface.ts +9 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +10 -0
- package/dist/builtin/workflows/src/shared/authoring-contract-ui.ts +10 -0
- package/dist/builtin/workflows/src/shared/graph-store-snapshot.ts +14 -2
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +12 -0
- package/dist/builtin/workflows/src/shared/prompt-answer.ts +130 -0
- package/dist/builtin/workflows/src/shared/session-scoped-singleton.ts +98 -0
- package/dist/builtin/workflows/src/shared/stage-ui-broker.ts +9 -1
- package/dist/builtin/workflows/src/shared/store-factory.ts +9 -1
- package/dist/builtin/workflows/src/shared/store-public-types.ts +2 -1
- package/dist/builtin/workflows/src/shared/store-tool-node-methods.ts +7 -0
- package/dist/builtin/workflows/src/shared/store-types.ts +18 -1
- package/dist/builtin/workflows/src/shared/tool-payload-bounds.ts +576 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.d.ts +1 -0
- package/dist/builtin/workflows/src/shared/workflow-authoring-types.ts +1 -0
- package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.d.ts +21 -0
- package/dist/builtin/workflows/src/shared/workflow-heartbeat-contract.ts +25 -0
- package/dist/builtin/workflows/src/tui/graph-theme.ts +8 -1
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +11 -0
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +100 -5
- package/dist/builtin/workflows/src/tui/graph-view-layout.ts +42 -11
- package/dist/builtin/workflows/src/tui/graph-view-render-helpers.ts +55 -6
- package/dist/builtin/workflows/src/tui/graph-view-render.ts +71 -6
- package/dist/builtin/workflows/src/tui/graph-view-state.ts +43 -0
- package/dist/builtin/workflows/src/tui/keybindings-adapter.ts +2 -0
- package/dist/builtin/workflows/src/tui/node-card.ts +5 -1
- package/dist/builtin/workflows/src/tui/stage-chat-view-archive-history.ts +11 -2
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +36 -10
- package/dist/builtin/workflows/src/tui/switcher.ts +11 -4
- package/dist/builtin/workflows/src/tui/tool-detail.ts +348 -0
- package/dist/builtin/workflows/src/tui/workflow-status.ts +5 -2
- package/dist/cli/args.d.ts +1 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +11 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/auth-check.d.ts +1 -1
- package/dist/cli/auth-check.js.map +1 -1
- package/dist/cli/credential-print.d.ts +1 -1
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/cli/list-models.d.ts +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/startup-ui.d.ts +9 -0
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +7 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +2 -2
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-export.d.ts +6 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +6 -3
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +6 -4
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +5 -2
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts +12 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +31 -10
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-skill-block.d.ts +1 -0
- package/dist/core/agent-session-skill-block.d.ts.map +1 -1
- package/dist/core/agent-session-skill-block.js +18 -2
- package/dist/core/agent-session-skill-block.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +2 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -1
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.js +2 -2
- package/dist/core/atomic-guide-command.js.map +1 -1
- package/dist/core/builtin-packages.d.ts.map +1 -1
- package/dist/core/builtin-packages.js +0 -6
- package/dist/core/builtin-packages.js.map +1 -1
- package/dist/core/cloudflare-gateway-binding.d.ts +11 -0
- package/dist/core/cloudflare-gateway-binding.d.ts.map +1 -0
- package/dist/core/cloudflare-gateway-binding.js +11 -0
- package/dist/core/cloudflare-gateway-binding.js.map +1 -0
- package/dist/core/codex-fast-mode-transport.d.ts +12 -0
- package/dist/core/codex-fast-mode-transport.d.ts.map +1 -0
- package/dist/core/codex-fast-mode-transport.js +130 -0
- package/dist/core/codex-fast-mode-transport.js.map +1 -0
- package/dist/core/codex-fast-mode.d.ts +20 -6
- package/dist/core/codex-fast-mode.d.ts.map +1 -1
- package/dist/core/codex-fast-mode.js +111 -3
- package/dist/core/codex-fast-mode.js.map +1 -1
- package/dist/core/diagnostics.d.ts +4 -0
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/event-bus.d.ts +12 -0
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js +22 -0
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/experimental.d.ts +25 -0
- package/dist/core/experimental.d.ts.map +1 -1
- package/dist/core/experimental.js +24 -0
- package/dist/core/experimental.js.map +1 -1
- package/dist/core/export-html/template-js/tree-filter-render.js +4 -3
- package/dist/core/export-html/template.js +4 -3
- package/dist/core/extension-session-state.d.ts +28 -0
- package/dist/core/extension-session-state.d.ts.map +1 -0
- package/dist/core/extension-session-state.js +55 -0
- package/dist/core/extension-session-state.js.map +1 -0
- package/dist/core/extensions/api-types.d.ts +6 -0
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +4 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -0
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -0
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader-api.d.ts +1 -1
- package/dist/core/extensions/loader-api.d.ts.map +1 -1
- package/dist/core/extensions/loader-api.js +16 -10
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +12 -1
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +2 -0
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +8 -0
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +3 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/runtime-types.d.ts +3 -0
- package/dist/core/extensions/runtime-types.d.ts.map +1 -1
- package/dist/core/extensions/runtime-types.js.map +1 -1
- package/dist/core/extensions/ui-types.d.ts +26 -0
- package/dist/core/extensions/ui-types.d.ts.map +1 -1
- package/dist/core/extensions/ui-types.js +17 -1
- package/dist/core/extensions/ui-types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +5 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +24 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +6 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-config.d.ts +5 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +1 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-registry.d.ts +1 -1
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts +1 -1
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +3 -3
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts +1 -1
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +1 -1
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-runtime.d.ts +54 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +96 -13
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/oauth-login.js.map +1 -1
- package/dist/core/project-trust.d.ts +10 -0
- package/dist/core/project-trust.d.ts.map +1 -1
- package/dist/core/project-trust.js +12 -0
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/resource-loader-assets.d.ts.map +1 -1
- package/dist/core/resource-loader-assets.js +14 -5
- package/dist/core/resource-loader-assets.js.map +1 -1
- package/dist/core/resource-loader-core.d.ts +3 -0
- package/dist/core/resource-loader-core.d.ts.map +1 -1
- package/dist/core/resource-loader-core.js +5 -0
- package/dist/core/resource-loader-core.js.map +1 -1
- package/dist/core/resource-loader-internals.d.ts +2 -0
- package/dist/core/resource-loader-internals.d.ts.map +1 -1
- package/dist/core/resource-loader-internals.js.map +1 -1
- package/dist/core/resource-loader-reload.d.ts.map +1 -1
- package/dist/core/resource-loader-reload.js +2 -0
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +2 -0
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/resource-loader.d.ts +2 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +1 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk-types.d.ts +7 -6
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +17 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +7 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +11 -2
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +2 -2
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +6 -4
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +5 -1
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +25 -2
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager-basic-accessors.d.ts +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +8 -0
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +3 -1
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +9 -0
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +4 -0
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skill-catalog.d.ts +35 -0
- package/dist/core/skill-catalog.d.ts.map +1 -0
- package/dist/core/skill-catalog.js +264 -0
- package/dist/core/skill-catalog.js.map +1 -0
- package/dist/core/skills-async.d.ts.map +1 -1
- package/dist/core/skills-async.js +12 -6
- package/dist/core/skills-async.js.map +1 -1
- package/dist/core/skills.d.ts +2 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +8 -5
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -5
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.js +2 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts +25 -2
- package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/ask-user-question.js +47 -18
- package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.js +5 -2
- package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.js +3 -1
- package/dist/core/tools/ask-user-question/view/components/submit-picker.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +8 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -0
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +2 -0
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +3 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/hashline-engine/format.d.ts +2 -0
- package/dist/core/tools/hashline-engine/format.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/format.js +4 -2
- package/dist/core/tools/hashline-engine/format.js.map +1 -1
- package/dist/core/tools/hashline-engine/messages.d.ts +2 -0
- package/dist/core/tools/hashline-engine/messages.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/messages.js +4 -2
- package/dist/core/tools/hashline-engine/messages.js.map +1 -1
- package/dist/core/tools/hashline-engine/parser.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/parser.js +16 -4
- package/dist/core/tools/hashline-engine/parser.js.map +1 -1
- package/dist/core/tools/hashline-engine/tokenizer.d.ts.map +1 -1
- package/dist/core/tools/hashline-engine/tokenizer.js +37 -27
- package/dist/core/tools/hashline-engine/tokenizer.js.map +1 -1
- package/dist/core/tools/hashline.d.ts.map +1 -1
- package/dist/core/tools/hashline.js +8 -2
- package/dist/core/tools/hashline.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -0
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +8 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/search.d.ts.map +1 -1
- package/dist/core/tools/search.js +2 -0
- package/dist/core/tools/search.js.map +1 -1
- package/dist/core/tools/todos.d.ts +3 -12
- package/dist/core/tools/todos.d.ts.map +1 -1
- package/dist/core/tools/todos.js +19 -4
- package/dist/core/tools/todos.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +2 -0
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +8 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/main-runtime-api-key.d.ts +1 -1
- package/dist/main-runtime-api-key.js.map +1 -1
- package/dist/main-session-options.d.ts +1 -1
- package/dist/main-session-options.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +10 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +8 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +8 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +26 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +38 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts +37 -0
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +54 -1
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +1 -1
- package/dist/modes/interactive/components/fast-mode-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +2 -1
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +1 -1
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts +95 -0
- package/dist/modes/interactive/components/reserved-bottom-overlay.d.ts.map +1 -0
- package/dist/modes/interactive/components/reserved-bottom-overlay.js +234 -0
- package/dist/modes/interactive/components/reserved-bottom-overlay.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +4 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +4 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-handlers.js +3 -0
- package/dist/modes/interactive/components/settings-selector-handlers.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +7 -0
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +5 -4
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +2 -2
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +94 -6
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +41 -3
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +80 -11
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +9 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
- package/dist/modes/interactive/interactive-model-catalog-startup.d.ts +8 -1
- package/dist/modes/interactive/interactive-model-catalog-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-model-catalog-startup.js +13 -3
- package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +3 -4
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +6 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +2 -2
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +7 -3
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +7 -1
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +2 -2
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +34 -9
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts +21 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +140 -38
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive/model-catalog-refresh.d.ts +17 -0
- package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
- package/dist/modes/interactive/model-catalog-refresh.js +84 -0
- package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +2 -0
- package/dist/modes/interactive/theme/light.json +2 -0
- package/dist/modes/interactive/theme/theme-class.d.ts +12 -3
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +6 -1
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +10 -2
- package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-controller.js +23 -10
- package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-loading.js +1 -0
- package/dist/modes/interactive/theme/theme-loading.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.d.ts +8 -0
- package/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.js +3 -1
- package/dist/modes/interactive/theme/theme-schema.js.map +1 -1
- package/dist/modes/interactive/theme/theme-schema.json +9 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +1 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +1 -0
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +3 -1
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +3 -2
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/json-event.d.ts +6 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js +17 -2
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +5 -4
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-responses.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/server/create-harness.d.ts.map +1 -1
- package/dist/server/create-harness.js +11 -0
- package/dist/server/create-harness.js.map +1 -1
- package/dist/utils/abort.d.ts +9 -0
- package/dist/utils/abort.d.ts.map +1 -0
- package/dist/utils/abort.js +19 -0
- package/dist/utils/abort.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +16 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +19 -19
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/custom-provider.md +9 -8
- package/docs/development.md +0 -1
- package/docs/docs.json +0 -1
- package/docs/environment-variables.md +3 -0
- package/docs/extensions.md +100 -2
- package/docs/json.md +3 -1
- package/docs/keybindings.md +8 -3
- package/docs/models/artificial-analysis-index.md +2 -2
- package/docs/models/model-selection.md +32 -23
- package/docs/models/pareto-efficiency.md +25 -24
- package/docs/providers.md +95 -2
- package/docs/quickstart.md +4 -2
- package/docs/rpc.md +21 -7
- package/docs/sdk.md +26 -1
- package/docs/session-format.md +5 -2
- package/docs/settings.md +34 -3
- package/docs/skills.md +16 -1
- package/docs/terminal-setup.md +15 -2
- package/docs/themes.md +22 -4
- package/docs/tools.md +3 -1
- package/docs/tui.md +2 -0
- package/docs/usage.md +5 -4
- package/docs/workflows.md +96 -19
- package/npm-shrinkwrap.json +211 -232
- package/package.json +8 -8
- package/dist/builtin/i-have-adhd/CHANGELOG.md +0 -30
- package/dist/builtin/i-have-adhd/LICENSE +0 -21
- package/dist/builtin/i-have-adhd/README.md +0 -18
- package/dist/builtin/i-have-adhd/index.ts +0 -238
- package/dist/builtin/i-have-adhd/package.json +0 -56
- package/dist/builtin/i-have-adhd/skills/i-have-adhd/SKILL.md +0 -140
- package/dist/builtin/workflows/builtin/open-claude-design-feedback.ts +0 -359
- package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-core.mjs +0 -180
- package/docs/i-have-adhd.md +0 -36
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accept-time CSS reconciliation for live mode.
|
|
3
|
+
*
|
|
4
|
+
* The old accept path appended the chosen variant's whole <style> body in
|
|
5
|
+
* front of the component's existing rules, which preserved every superseded
|
|
6
|
+
* declaration (the "old divider borders survive the accept" bug) and left
|
|
7
|
+
* dead parameter branches in source. This module makes acceptance a merge:
|
|
8
|
+
*
|
|
9
|
+
* reconcileCss replace rules whose selectors match, append new ones
|
|
10
|
+
* bakeParamValues collapse --p-* vars and [data-p-*] branches to the
|
|
11
|
+
* user's chosen values, driven by the declared param
|
|
12
|
+
* kinds from params.json (not regex sniffing)
|
|
13
|
+
* pruneUnusedSelectors use the framework compiler's own unused-selector
|
|
14
|
+
* warnings to delete rules the accepted markup no longer
|
|
15
|
+
* references
|
|
16
|
+
*
|
|
17
|
+
* The parser is hand-rolled on purpose: skill scripts run standalone inside
|
|
18
|
+
* user projects and cannot rely on this repo's node_modules. It is a small
|
|
19
|
+
* recursive block parser (comment- and string-aware), not a spec-complete
|
|
20
|
+
* CSS parser; everything it emits round-trips byte-for-byte through raw
|
|
21
|
+
* slices except the rules deliberately changed.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Parsing
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Parse a stylesheet into a flat tree.
|
|
30
|
+
* Node shapes:
|
|
31
|
+
* { type: 'rule', prelude, body, start, end, preludeStart }
|
|
32
|
+
* { type: 'at', name, prelude, children|body, start, end } (children when
|
|
33
|
+
* the block contains rules: media/supports/layer/container/scope)
|
|
34
|
+
* { type: 'comment', text, start, end }
|
|
35
|
+
*/
|
|
36
|
+
export function parseStylesheet(css, offset = 0) {
|
|
37
|
+
const text = String(css || '');
|
|
38
|
+
const nodes = [];
|
|
39
|
+
let i = 0;
|
|
40
|
+
|
|
41
|
+
const skipWs = () => { while (i < text.length && /\s/.test(text[i])) i++; };
|
|
42
|
+
|
|
43
|
+
while (i < text.length) {
|
|
44
|
+
skipWs();
|
|
45
|
+
if (i >= text.length) break;
|
|
46
|
+
|
|
47
|
+
if (text[i] === '/' && text[i + 1] === '*') {
|
|
48
|
+
const start = i;
|
|
49
|
+
const close = text.indexOf('*/', i + 2);
|
|
50
|
+
i = close === -1 ? text.length : close + 2;
|
|
51
|
+
nodes.push({ type: 'comment', text: text.slice(start, i), start: offset + start, end: offset + i });
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const preludeStart = i;
|
|
56
|
+
const boundary = scanToBlockOrStatementEnd(text, i);
|
|
57
|
+
if (boundary.kind === 'none') break; // trailing garbage / declarations at top level
|
|
58
|
+
if (boundary.kind === 'statement') {
|
|
59
|
+
// Block-less at-statement (@import, @charset, @layer names;). Emitted
|
|
60
|
+
// as its own node so the FOLLOWING rule still indexes for
|
|
61
|
+
// reconciliation instead of being folded into this prelude.
|
|
62
|
+
const raw = text.slice(preludeStart, boundary.index + 1).trim();
|
|
63
|
+
if (raw) {
|
|
64
|
+
nodes.push({
|
|
65
|
+
type: 'at',
|
|
66
|
+
name: (raw.match(/^@([A-Za-z-]+)/) || [])[1] || '',
|
|
67
|
+
prelude: raw.replace(/;$/, ''),
|
|
68
|
+
statement: true,
|
|
69
|
+
start: offset + preludeStart,
|
|
70
|
+
end: offset + boundary.index + 1,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
i = boundary.index + 1;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const braceIdx = boundary.index;
|
|
77
|
+
const prelude = text.slice(preludeStart, braceIdx).trim();
|
|
78
|
+
const bodyStart = braceIdx + 1;
|
|
79
|
+
const bodyEnd = scanBlockEnd(text, bodyStart);
|
|
80
|
+
const body = text.slice(bodyStart, bodyEnd);
|
|
81
|
+
const nodeEnd = Math.min(text.length, bodyEnd + 1);
|
|
82
|
+
|
|
83
|
+
if (prelude.startsWith('@')) {
|
|
84
|
+
const name = (prelude.match(/^@([A-Za-z-]+)/) || [])[1] || '';
|
|
85
|
+
if (['media', 'supports', 'layer', 'container', 'scope'].includes(name)) {
|
|
86
|
+
nodes.push({
|
|
87
|
+
type: 'at',
|
|
88
|
+
name,
|
|
89
|
+
prelude,
|
|
90
|
+
children: parseStylesheet(body, offset + bodyStart),
|
|
91
|
+
start: offset + preludeStart,
|
|
92
|
+
end: offset + nodeEnd,
|
|
93
|
+
});
|
|
94
|
+
} else {
|
|
95
|
+
nodes.push({
|
|
96
|
+
type: 'at',
|
|
97
|
+
name,
|
|
98
|
+
prelude,
|
|
99
|
+
body,
|
|
100
|
+
start: offset + preludeStart,
|
|
101
|
+
end: offset + nodeEnd,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
} else if (prelude) {
|
|
105
|
+
nodes.push({
|
|
106
|
+
type: 'rule',
|
|
107
|
+
prelude,
|
|
108
|
+
body,
|
|
109
|
+
start: offset + preludeStart,
|
|
110
|
+
end: offset + nodeEnd,
|
|
111
|
+
preludeStart: offset + preludeStart,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
i = nodeEnd;
|
|
115
|
+
}
|
|
116
|
+
return nodes;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Scan for the next structural boundary: the `{` opening a block, or the `;`
|
|
121
|
+
* ending a block-less at-statement, whichever comes first (string- and
|
|
122
|
+
* comment-aware). Returns { kind: 'block' | 'statement' | 'none', index }.
|
|
123
|
+
*/
|
|
124
|
+
function scanToBlockOrStatementEnd(text, from) {
|
|
125
|
+
let i = from;
|
|
126
|
+
let quote = null;
|
|
127
|
+
while (i < text.length) {
|
|
128
|
+
const ch = text[i];
|
|
129
|
+
if (quote) {
|
|
130
|
+
if (ch === '\\') i++;
|
|
131
|
+
else if (ch === quote) quote = null;
|
|
132
|
+
} else if (ch === '"' || ch === "'") {
|
|
133
|
+
quote = ch;
|
|
134
|
+
} else if (ch === '/' && text[i + 1] === '*') {
|
|
135
|
+
const close = text.indexOf('*/', i + 2);
|
|
136
|
+
i = close === -1 ? text.length : close + 1;
|
|
137
|
+
} else if (ch === '{') {
|
|
138
|
+
return { kind: 'block', index: i };
|
|
139
|
+
} else if (ch === ';') {
|
|
140
|
+
return { kind: 'statement', index: i };
|
|
141
|
+
}
|
|
142
|
+
i++;
|
|
143
|
+
}
|
|
144
|
+
return { kind: 'none', index: -1 };
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function scanBlockEnd(text, from) {
|
|
148
|
+
let i = from;
|
|
149
|
+
let depth = 1;
|
|
150
|
+
let quote = null;
|
|
151
|
+
while (i < text.length) {
|
|
152
|
+
const ch = text[i];
|
|
153
|
+
if (quote) {
|
|
154
|
+
if (ch === '\\') i++;
|
|
155
|
+
else if (ch === quote) quote = null;
|
|
156
|
+
} else if (ch === '"' || ch === "'") {
|
|
157
|
+
quote = ch;
|
|
158
|
+
} else if (ch === '/' && text[i + 1] === '*') {
|
|
159
|
+
const close = text.indexOf('*/', i + 2);
|
|
160
|
+
i = close === -1 ? text.length : close + 1;
|
|
161
|
+
} else if (ch === '{') {
|
|
162
|
+
depth++;
|
|
163
|
+
} else if (ch === '}') {
|
|
164
|
+
depth--;
|
|
165
|
+
if (depth === 0) return i;
|
|
166
|
+
}
|
|
167
|
+
i++;
|
|
168
|
+
}
|
|
169
|
+
return text.length;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function serializeNodes(nodes, indent = '') {
|
|
173
|
+
const out = [];
|
|
174
|
+
for (const node of nodes) {
|
|
175
|
+
if (node.type === 'comment') {
|
|
176
|
+
out.push(indent + node.text);
|
|
177
|
+
} else if (node.type === 'rule') {
|
|
178
|
+
out.push(`${indent}${node.prelude} {${formatBody(node.body, indent)}}`);
|
|
179
|
+
} else if (node.type === 'at' && node.children) {
|
|
180
|
+
out.push(`${indent}${node.prelude} {`);
|
|
181
|
+
out.push(serializeNodes(node.children, indent + ' '));
|
|
182
|
+
out.push(`${indent}}`);
|
|
183
|
+
} else if (node.type === 'at' && node.statement) {
|
|
184
|
+
out.push(`${indent}${node.prelude};`);
|
|
185
|
+
} else if (node.type === 'at') {
|
|
186
|
+
out.push(`${indent}${node.prelude} {${formatBody(node.body, indent)}}`);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return out.join('\n');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function formatBody(body, indent) {
|
|
193
|
+
const trimmed = String(body || '').trim();
|
|
194
|
+
if (!trimmed) return ' ';
|
|
195
|
+
const lines = trimmed.split('\n').map((l) => l.trim()).filter(Boolean);
|
|
196
|
+
if (lines.length === 1 && lines[0].length < 60) return ` ${lines[0]} `;
|
|
197
|
+
return '\n' + lines.map((l) => `${indent} ${l}`).join('\n') + `\n${indent}`;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export function normalizeSelector(prelude) {
|
|
201
|
+
return String(prelude || '')
|
|
202
|
+
.replace(/\s+/g, ' ')
|
|
203
|
+
.replace(/\s*([>+~,])\s*/g, '$1')
|
|
204
|
+
.trim();
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// ---------------------------------------------------------------------------
|
|
208
|
+
// Reconciliation
|
|
209
|
+
// ---------------------------------------------------------------------------
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Merge variant CSS into existing CSS. Rules whose (at-context, normalized
|
|
213
|
+
* selector) match an existing rule REPLACE that rule's body in place; new
|
|
214
|
+
* rules append at the end under their at-context. Returns { css, replaced,
|
|
215
|
+
* appended }.
|
|
216
|
+
*/
|
|
217
|
+
export function reconcileCss(existingCss, variantCss) {
|
|
218
|
+
const existing = parseStylesheet(existingCss);
|
|
219
|
+
const incoming = parseStylesheet(variantCss);
|
|
220
|
+
let replaced = 0;
|
|
221
|
+
let appended = 0;
|
|
222
|
+
|
|
223
|
+
const mergeLevel = (existingNodes, incomingNodes) => {
|
|
224
|
+
const index = new Map();
|
|
225
|
+
for (const node of existingNodes) {
|
|
226
|
+
if (node.type === 'rule') index.set(normalizeSelector(node.prelude), node);
|
|
227
|
+
}
|
|
228
|
+
const atIndex = new Map();
|
|
229
|
+
for (const node of existingNodes) {
|
|
230
|
+
if (node.type === 'at' && node.children) atIndex.set(normalizeSelector(node.prelude), node);
|
|
231
|
+
}
|
|
232
|
+
// Baking can leave several incoming rules with the same selector (e.g. a
|
|
233
|
+
// base rule plus a stripped param branch). The first one REPLACES the
|
|
234
|
+
// existing body; later same-selector rules extend it, never clobber it.
|
|
235
|
+
const touched = new Set();
|
|
236
|
+
for (const node of incomingNodes) {
|
|
237
|
+
if (node.type === 'comment') continue;
|
|
238
|
+
if (node.type === 'rule') {
|
|
239
|
+
const key = normalizeSelector(node.prelude);
|
|
240
|
+
const match = index.get(key);
|
|
241
|
+
if (match) {
|
|
242
|
+
if (touched.has(key)) {
|
|
243
|
+
match.body = `${match.body.trim()}\n${node.body.trim()}`;
|
|
244
|
+
} else if (match.body.trim() !== node.body.trim()) {
|
|
245
|
+
match.body = node.body;
|
|
246
|
+
replaced++;
|
|
247
|
+
}
|
|
248
|
+
touched.add(key);
|
|
249
|
+
} else {
|
|
250
|
+
// New base rules go BEFORE the existing top-level media blocks:
|
|
251
|
+
// appended after them, an equal-specificity base rule wins the
|
|
252
|
+
// cascade over the stylesheet's earlier responsive overrides and
|
|
253
|
+
// silently weakens the mobile styles for any still-shared class.
|
|
254
|
+
const appendedNode = { ...node };
|
|
255
|
+
const firstAt = existingNodes.findIndex((n) => n.type === 'at' && n.children);
|
|
256
|
+
if (firstAt === -1) existingNodes.push(appendedNode);
|
|
257
|
+
else existingNodes.splice(firstAt, 0, appendedNode);
|
|
258
|
+
index.set(key, appendedNode);
|
|
259
|
+
touched.add(key);
|
|
260
|
+
appended++;
|
|
261
|
+
}
|
|
262
|
+
} else if (node.type === 'at' && node.children) {
|
|
263
|
+
const key = normalizeSelector(node.prelude);
|
|
264
|
+
const match = atIndex.get(key);
|
|
265
|
+
if (match) {
|
|
266
|
+
mergeLevel(match.children, node.children);
|
|
267
|
+
} else {
|
|
268
|
+
existingNodes.push({ ...node });
|
|
269
|
+
atIndex.set(key, existingNodes[existingNodes.length - 1]);
|
|
270
|
+
appended++;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
existingNodes.push({ ...node });
|
|
274
|
+
appended++;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
mergeLevel(existing, incoming);
|
|
280
|
+
return { css: serializeNodes(existing), replaced, appended };
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// ---------------------------------------------------------------------------
|
|
284
|
+
// Parameter baking
|
|
285
|
+
// ---------------------------------------------------------------------------
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Replace every `var(--p-<id>, fallback)` / `var(--p-<id>)` occurrence with a
|
|
289
|
+
* literal value. Paren-aware: fallbacks containing calc()/nested vars are
|
|
290
|
+
* handled, unlike the old `[^)]+` regex.
|
|
291
|
+
*/
|
|
292
|
+
export function substituteParamVar(css, id, value) {
|
|
293
|
+
const text = String(css || '');
|
|
294
|
+
const needle = `var(--p-${id}`;
|
|
295
|
+
let out = '';
|
|
296
|
+
let i = 0;
|
|
297
|
+
while (i < text.length) {
|
|
298
|
+
const idx = text.indexOf(needle, i);
|
|
299
|
+
if (idx === -1) { out += text.slice(i); break; }
|
|
300
|
+
const after = idx + needle.length;
|
|
301
|
+
// Must be end of the var name: `)` or `,`.
|
|
302
|
+
if (after < text.length && text[after] !== ')' && text[after] !== ',') {
|
|
303
|
+
out += text.slice(i, after);
|
|
304
|
+
i = after;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
let j = after;
|
|
308
|
+
let depth = 1; // we are inside var(
|
|
309
|
+
while (j < text.length && depth > 0) {
|
|
310
|
+
if (text[j] === '(') depth++;
|
|
311
|
+
else if (text[j] === ')') depth--;
|
|
312
|
+
j++;
|
|
313
|
+
}
|
|
314
|
+
out += text.slice(i, idx) + String(value);
|
|
315
|
+
i = j;
|
|
316
|
+
}
|
|
317
|
+
return out;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function normalizeToggleForVar(value) {
|
|
321
|
+
return value === true || value === 'true' || value === 1 || value === '1' || value === 'on' ? '1' : '0';
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function isToggleOn(value) {
|
|
325
|
+
return normalizeToggleForVar(value) === '1';
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Strip `[data-p-<id>="value"]` / `[data-p-<id>]` attribute selectors from a
|
|
330
|
+
* selector, deciding survival by the chosen value:
|
|
331
|
+
* returns null when the selector targets a non-chosen branch (drop it),
|
|
332
|
+
* otherwise the selector with the attribute test removed and any emptied
|
|
333
|
+
* :global() wrappers cleaned up.
|
|
334
|
+
*/
|
|
335
|
+
export function stripParamSelector(selector, id, kind, chosenValue) {
|
|
336
|
+
const attrRe = new RegExp(`\\[data-p-${escapeRegExp(id)}(?:=(["'])(.*?)\\1)?\\]`, 'g');
|
|
337
|
+
let drop = false;
|
|
338
|
+
let out = String(selector).replace(attrRe, (_m, _q, expected) => {
|
|
339
|
+
if (kind === 'steps') {
|
|
340
|
+
if (expected == null || String(expected) === String(chosenValue)) return '';
|
|
341
|
+
drop = true;
|
|
342
|
+
return '';
|
|
343
|
+
}
|
|
344
|
+
// toggle: the runtime sets data-p-<id>="on" when on and removes the
|
|
345
|
+
// attribute when off. A branch survives baking only if it actually
|
|
346
|
+
// matched at preview time with the chosen state: the presence form and
|
|
347
|
+
// the literal "on" form match while on; every other valued form
|
|
348
|
+
// (["false"], ["0"], ...) never matched and is dead regardless of state.
|
|
349
|
+
if (expected != null && expected !== 'on') {
|
|
350
|
+
drop = true;
|
|
351
|
+
return '';
|
|
352
|
+
}
|
|
353
|
+
if (!isToggleOn(chosenValue)) {
|
|
354
|
+
drop = true;
|
|
355
|
+
return '';
|
|
356
|
+
}
|
|
357
|
+
return '';
|
|
358
|
+
});
|
|
359
|
+
if (drop) return null;
|
|
360
|
+
out = out
|
|
361
|
+
.replace(/:global\(\s*\)/g, '')
|
|
362
|
+
.replace(/\s+/g, ' ')
|
|
363
|
+
.replace(/^\s*[>+~]\s*/, '')
|
|
364
|
+
.trim();
|
|
365
|
+
return out || null;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Bake chosen parameter values into CSS. `params` is the declared parameter
|
|
370
|
+
* list for the accepted variant (from params.json); `values` maps id ->
|
|
371
|
+
* chosen value (falling back to each param's declared default).
|
|
372
|
+
*/
|
|
373
|
+
export function bakeParamValues(css, params = [], values = {}) {
|
|
374
|
+
let nodes = parseStylesheet(css);
|
|
375
|
+
|
|
376
|
+
const chosen = new Map();
|
|
377
|
+
for (const param of params || []) {
|
|
378
|
+
if (!param || !param.id) continue;
|
|
379
|
+
const has = values && Object.prototype.hasOwnProperty.call(values, param.id);
|
|
380
|
+
chosen.set(param.id, { kind: param.kind, value: has ? values[param.id] : param.default });
|
|
381
|
+
}
|
|
382
|
+
// Values sent for params that were never declared still bake as ranges,
|
|
383
|
+
// so an out-of-sync manifest degrades to the old behavior, not to silence.
|
|
384
|
+
for (const [id, value] of Object.entries(values || {})) {
|
|
385
|
+
if (!chosen.has(id)) chosen.set(id, { kind: 'range', value });
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const bakeBody = (body) => {
|
|
389
|
+
let out = String(body || '');
|
|
390
|
+
for (const [id, { kind, value }] of chosen) {
|
|
391
|
+
const literal = kind === 'toggle' ? normalizeToggleForVar(value) : String(value);
|
|
392
|
+
out = substituteParamVar(out, id, literal);
|
|
393
|
+
}
|
|
394
|
+
// Strip the readiness sentinel as a DECLARATION, not a line: a one-line
|
|
395
|
+
// rule carrying the sentinel plus real declarations must keep the rest.
|
|
396
|
+
return out
|
|
397
|
+
.replace(/(^|;)\s*--impeccable-variant-ready\s*:[^;{}]*/g, '$1')
|
|
398
|
+
.replace(/;\s*;/g, ';')
|
|
399
|
+
.replace(/^\s*;\s*/, '');
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
const transform = (list) => {
|
|
403
|
+
const result = [];
|
|
404
|
+
for (const node of list) {
|
|
405
|
+
if (node.type === 'at' && node.children) {
|
|
406
|
+
const children = transform(node.children);
|
|
407
|
+
if (children.length > 0) result.push({ ...node, children });
|
|
408
|
+
continue;
|
|
409
|
+
}
|
|
410
|
+
if (node.type !== 'rule') {
|
|
411
|
+
if (node.type === 'at') result.push({ ...node, body: bakeBody(node.body) });
|
|
412
|
+
else result.push(node);
|
|
413
|
+
continue;
|
|
414
|
+
}
|
|
415
|
+
const selectors = splitSelectorList(node.prelude);
|
|
416
|
+
const kept = [];
|
|
417
|
+
for (let selector of selectors) {
|
|
418
|
+
let alive = true;
|
|
419
|
+
for (const [id, { kind, value }] of chosen) {
|
|
420
|
+
if (kind !== 'steps' && kind !== 'toggle') continue;
|
|
421
|
+
if (!selector.includes(`data-p-${id}`)) continue;
|
|
422
|
+
const next = stripParamSelector(selector, id, kind, value);
|
|
423
|
+
if (next == null) { alive = false; break; }
|
|
424
|
+
selector = next;
|
|
425
|
+
}
|
|
426
|
+
if (alive && selector.trim()) kept.push(selector.trim());
|
|
427
|
+
}
|
|
428
|
+
if (kept.length === 0) continue;
|
|
429
|
+
const body = bakeBody(node.body);
|
|
430
|
+
if (!body.trim()) continue;
|
|
431
|
+
result.push({ ...node, prelude: kept.join(', '), body });
|
|
432
|
+
}
|
|
433
|
+
return result;
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
nodes = transform(nodes);
|
|
437
|
+
return serializeNodes(nodes);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export function splitSelectorList(prelude) {
|
|
441
|
+
const selectors = [];
|
|
442
|
+
let start = 0;
|
|
443
|
+
let bracket = 0;
|
|
444
|
+
let paren = 0;
|
|
445
|
+
let quote = null;
|
|
446
|
+
const text = String(prelude || '');
|
|
447
|
+
for (let i = 0; i < text.length; i++) {
|
|
448
|
+
const ch = text[i];
|
|
449
|
+
if (quote) {
|
|
450
|
+
if (ch === '\\') i++;
|
|
451
|
+
else if (ch === quote) quote = null;
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
454
|
+
if (ch === '"' || ch === "'") quote = ch;
|
|
455
|
+
else if (ch === '[') bracket++;
|
|
456
|
+
else if (ch === ']') bracket = Math.max(0, bracket - 1);
|
|
457
|
+
else if (ch === '(') paren++;
|
|
458
|
+
else if (ch === ')') paren = Math.max(0, paren - 1);
|
|
459
|
+
else if (ch === ',' && bracket === 0 && paren === 0) {
|
|
460
|
+
selectors.push(text.slice(start, i));
|
|
461
|
+
start = i + 1;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
selectors.push(text.slice(start));
|
|
465
|
+
return selectors.map((s) => s.trim()).filter(Boolean);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// ---------------------------------------------------------------------------
|
|
469
|
+
// Compiler-driven pruning
|
|
470
|
+
// ---------------------------------------------------------------------------
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Remove selectors the framework compiler reports as unused from a full
|
|
474
|
+
* component source. `compileFn` is the app's svelte compile; warnings with
|
|
475
|
+
* code `css_unused_selector` carry character offsets into the source.
|
|
476
|
+
* `skipSelectors` protects selectors that were already unused before the
|
|
477
|
+
* accept: pre-existing dead rules are the user's code, not live-mode debris.
|
|
478
|
+
* Returns { source, removed } where removed lists the pruned selector texts.
|
|
479
|
+
*/
|
|
480
|
+
export function collectUnusedSelectors(componentSource, compileFn) {
|
|
481
|
+
try {
|
|
482
|
+
const { warnings } = compileFn(String(componentSource || ''), { generate: false });
|
|
483
|
+
return new Set((warnings || [])
|
|
484
|
+
.filter((w) => w.code === 'css_unused_selector'
|
|
485
|
+
&& Number.isInteger(w.start?.character)
|
|
486
|
+
&& Number.isInteger(w.end?.character))
|
|
487
|
+
.map((w) => String(componentSource).slice(w.start.character, w.end.character).trim()));
|
|
488
|
+
} catch {
|
|
489
|
+
return new Set();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export function pruneUnusedSelectors(componentSource, compileFn, { skipSelectors } = {}) {
|
|
494
|
+
let source = String(componentSource || '');
|
|
495
|
+
const removed = [];
|
|
496
|
+
const skip = skipSelectors instanceof Set ? skipSelectors : new Set(skipSelectors || []);
|
|
497
|
+
for (let pass = 0; pass < 3; pass++) {
|
|
498
|
+
let warnings;
|
|
499
|
+
try {
|
|
500
|
+
({ warnings } = compileFn(source, { generate: false }));
|
|
501
|
+
} catch {
|
|
502
|
+
return { source, removed }; // never let pruning break an accept
|
|
503
|
+
}
|
|
504
|
+
const unused = (warnings || [])
|
|
505
|
+
.filter((w) => w.code === 'css_unused_selector'
|
|
506
|
+
&& Number.isInteger(w.start?.character)
|
|
507
|
+
&& Number.isInteger(w.end?.character))
|
|
508
|
+
.filter((w) => !skip.has(source.slice(w.start.character, w.end.character).trim()))
|
|
509
|
+
.sort((a, b) => b.start.character - a.start.character);
|
|
510
|
+
if (unused.length === 0) break;
|
|
511
|
+
|
|
512
|
+
let next = source;
|
|
513
|
+
for (const warning of unused) {
|
|
514
|
+
const result = removeSelectorAt(next, warning.start.character, warning.end.character);
|
|
515
|
+
if (result.changed) {
|
|
516
|
+
removed.push(result.selector);
|
|
517
|
+
next = result.source;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (next === source) break;
|
|
521
|
+
source = next;
|
|
522
|
+
}
|
|
523
|
+
return { source, removed };
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Remove the selector at [start, end) from its rule. When it is the rule's
|
|
528
|
+
* only selector, remove the whole rule (prelude through closing brace).
|
|
529
|
+
*/
|
|
530
|
+
function removeSelectorAt(source, start, end) {
|
|
531
|
+
const selector = source.slice(start, end);
|
|
532
|
+
|
|
533
|
+
// Find the rule boundaries around the selector.
|
|
534
|
+
const braceIdx = source.indexOf('{', end);
|
|
535
|
+
if (braceIdx === -1) return { changed: false, selector, source };
|
|
536
|
+
const bodyEnd = scanBlockEnd(source, braceIdx + 1);
|
|
537
|
+
|
|
538
|
+
// Prelude spans backward from the brace to the previous } ; { or the end
|
|
539
|
+
// of the <style> open tag. A bare `>` is NOT a boundary: it is the child
|
|
540
|
+
// combinator, and cutting there truncates a selector list like
|
|
541
|
+
// `.a > .b, .c` mid-prelude. Only a `>` that closes a `<style ...>` tag
|
|
542
|
+
// bounds the walk.
|
|
543
|
+
let preludeStart = start;
|
|
544
|
+
for (let i = start - 1; i >= 0; i--) {
|
|
545
|
+
const ch = source[i];
|
|
546
|
+
if (ch === '}' || ch === '{' || ch === ';') { preludeStart = i + 1; break; }
|
|
547
|
+
if (ch === '>') {
|
|
548
|
+
const styleOpen = source.lastIndexOf('<style', i);
|
|
549
|
+
if (styleOpen !== -1 && source.indexOf('>', styleOpen) === i) { preludeStart = i + 1; break; }
|
|
550
|
+
continue; // child combinator inside the prelude
|
|
551
|
+
}
|
|
552
|
+
if (i === 0) preludeStart = 0;
|
|
553
|
+
}
|
|
554
|
+
const prelude = source.slice(preludeStart, braceIdx);
|
|
555
|
+
const selectors = splitSelectorList(prelude);
|
|
556
|
+
const target = selector.trim();
|
|
557
|
+
const kept = selectors.filter((s) => s !== target);
|
|
558
|
+
|
|
559
|
+
if (kept.length === selectors.length) {
|
|
560
|
+
// Offsets did not line up with a full selector in the list; be safe.
|
|
561
|
+
return { changed: false, selector, source };
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
if (kept.length === 0) {
|
|
565
|
+
// Remove the entire rule including trailing newline.
|
|
566
|
+
let ruleEnd = Math.min(source.length, bodyEnd + 1);
|
|
567
|
+
while (ruleEnd < source.length && source[ruleEnd] === '\n') ruleEnd++;
|
|
568
|
+
let ruleStart = preludeStart;
|
|
569
|
+
while (ruleStart > 0 && (source[ruleStart - 1] === ' ' || source[ruleStart - 1] === '\t')) ruleStart--;
|
|
570
|
+
return { changed: true, selector: target, source: source.slice(0, ruleStart) + source.slice(ruleEnd) };
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
const indent = (prelude.match(/^\s*/) || [''])[0];
|
|
574
|
+
return {
|
|
575
|
+
changed: true,
|
|
576
|
+
selector: target,
|
|
577
|
+
source: source.slice(0, preludeStart) + indent + kept.join(', ') + ' ' + source.slice(braceIdx, source.length),
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
function escapeRegExp(value) {
|
|
582
|
+
return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Collect every normalized selector in a CSS text, including inside nested
|
|
587
|
+
* at-blocks. Used by the accept postcondition: a selector present before the
|
|
588
|
+
* accept may only disappear if the compiler reported it unused; anything
|
|
589
|
+
* else means the parser or reconciler damaged the user's file, and the write
|
|
590
|
+
* must be refused rather than silently committed.
|
|
591
|
+
*/
|
|
592
|
+
export function collectAllSelectors(css, out = new Set()) {
|
|
593
|
+
for (const node of parseStylesheet(css)) {
|
|
594
|
+
if (node.type === 'rule') {
|
|
595
|
+
for (const selector of splitSelectorList(node.prelude)) out.add(normalizeSelector(selector));
|
|
596
|
+
} else if (node.type === 'at' && node.children) {
|
|
597
|
+
for (const child of node.children) {
|
|
598
|
+
if (child.type === 'rule') {
|
|
599
|
+
for (const selector of splitSelectorList(child.prelude)) out.add(normalizeSelector(selector));
|
|
600
|
+
} else if (child.type === 'at' && child.children) {
|
|
601
|
+
collectSelectorsFromNodes(child.children, out);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return out;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function collectSelectorsFromNodes(nodes, out) {
|
|
610
|
+
for (const node of nodes) {
|
|
611
|
+
if (node.type === 'rule') {
|
|
612
|
+
for (const selector of splitSelectorList(node.prelude)) out.add(normalizeSelector(selector));
|
|
613
|
+
} else if (node.type === 'at' && node.children) {
|
|
614
|
+
collectSelectorsFromNodes(node.children, out);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Postcondition scanner for accepted/carbonized source. The carbonize
|
|
3
|
+
* contract used to exist only as prose in reference/live.md; nothing checked
|
|
4
|
+
* that an accept actually left the file clean, so dead param branches,
|
|
5
|
+
* preview attributes, and marker comments accumulated across sessions. This
|
|
6
|
+
* scanner is the mechanical form of that contract. live-complete refuses to
|
|
7
|
+
* mark a carbonize session complete while the file is dirty, and the
|
|
8
|
+
* mechanical Svelte accept runs it on its own output as a self-check.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// Param patterns are anchored to the exact shapes live mode writes
|
|
12
|
+
// (attribute-with-value / selector forms, var() references), not bare
|
|
13
|
+
// substrings, so user tokens that merely share the prefix cannot trip the
|
|
14
|
+
// completion gate.
|
|
15
|
+
const FORBIDDEN = [
|
|
16
|
+
{ marker: 'impeccable-variants-start', why: 'variant wrapper comment left in source' },
|
|
17
|
+
{ marker: 'impeccable-variants-end', why: 'variant wrapper comment left in source' },
|
|
18
|
+
{ marker: 'impeccable-carbonize-start', why: 'carbonize block not rewritten into permanent form' },
|
|
19
|
+
{ marker: 'impeccable-carbonize-end', why: 'carbonize block not rewritten into permanent form' },
|
|
20
|
+
{ marker: 'impeccable-param-values', why: 'param-values comment not baked and removed' },
|
|
21
|
+
{ marker: 'data-impeccable-', why: 'live-mode plumbing attribute left on markup' },
|
|
22
|
+
{ marker: /\bdata-p-[A-Za-z0-9_-]+\s*(?:=|\])/, label: 'data-p-*', why: 'preview parameter attribute left on markup' },
|
|
23
|
+
{ marker: /var\(\s*--p-[A-Za-z0-9_-]+\s*[,)]/, label: 'var(--p-*)', why: 'preview parameter variable not baked to a literal' },
|
|
24
|
+
{ marker: '--impeccable-variant-ready', why: 'preview readiness sentinel left in CSS' },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Scan file text for live-mode leftovers. Returns { clean, findings } where
|
|
29
|
+
* each finding is { marker, line, excerpt, why }.
|
|
30
|
+
*/
|
|
31
|
+
export function verifyAcceptedSource(text) {
|
|
32
|
+
const findings = [];
|
|
33
|
+
const lines = String(text || '').split('\n');
|
|
34
|
+
for (let i = 0; i < lines.length; i++) {
|
|
35
|
+
const line = lines[i];
|
|
36
|
+
for (const { marker, label, why } of FORBIDDEN) {
|
|
37
|
+
const hit = marker instanceof RegExp ? marker.test(line) : line.includes(marker);
|
|
38
|
+
if (hit) {
|
|
39
|
+
findings.push({
|
|
40
|
+
marker: label || String(marker),
|
|
41
|
+
line: i + 1,
|
|
42
|
+
excerpt: line.trim().slice(0, 120),
|
|
43
|
+
why,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return { clean: findings.length === 0, findings };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Convenience wrapper for CLI callers: read + scan. Only a missing path is clean. */
|
|
52
|
+
export function verifyAcceptedFile(fs, filePath) {
|
|
53
|
+
let text;
|
|
54
|
+
try {
|
|
55
|
+
text = fs.readFileSync(filePath, 'utf-8');
|
|
56
|
+
} catch (error) {
|
|
57
|
+
if (error?.code === 'ENOENT') return { clean: true, findings: [], missing: true };
|
|
58
|
+
const code = typeof error?.code === 'string' ? ` (${error.code})` : '';
|
|
59
|
+
return {
|
|
60
|
+
clean: false,
|
|
61
|
+
missing: false,
|
|
62
|
+
findings: [{
|
|
63
|
+
marker: 'file-read-error',
|
|
64
|
+
line: 0,
|
|
65
|
+
excerpt: '',
|
|
66
|
+
why: `could not read accepted source${code}`,
|
|
67
|
+
}],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return { ...verifyAcceptedSource(text), missing: false };
|
|
71
|
+
}
|