@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
|
@@ -7,6 +7,11 @@
|
|
|
7
7
|
* every subsequent run, this script handles insert/remove deterministically
|
|
8
8
|
* with zero LLM involvement.
|
|
9
9
|
*
|
|
10
|
+
* Framework knowledge lives in `live/frameworks/` — detection order, adapters,
|
|
11
|
+
* the generic tag strategy, and the per-extension authoring traits live-wrap
|
|
12
|
+
* reads. This file is the CLI around it: resolve config, resolve the
|
|
13
|
+
* framework, heal orphaned artifacts, apply or remove, record the journal.
|
|
14
|
+
*
|
|
10
15
|
* Usage:
|
|
11
16
|
* node live-inject.mjs --port PORT [--token TOKEN] # Insert the live script tag
|
|
12
17
|
* node live-inject.mjs --remove # Remove the live script tag
|
|
@@ -23,22 +28,37 @@ import path from 'node:path';
|
|
|
23
28
|
import { fileURLToPath } from 'node:url';
|
|
24
29
|
import { resolveLiveConfigPath } from './lib/impeccable-paths.mjs';
|
|
25
30
|
import {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
describeInjectArtifacts,
|
|
32
|
+
frameworkIgnorePatterns,
|
|
33
|
+
resolveFramework,
|
|
34
|
+
resolveSourceTraits,
|
|
35
|
+
} from './live/frameworks/index.mjs';
|
|
36
|
+
import {
|
|
37
|
+
clearInjectJournal,
|
|
38
|
+
healInjectJournal,
|
|
39
|
+
recordInjection,
|
|
40
|
+
} from './live/frameworks/journal.mjs';
|
|
30
41
|
import {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
42
|
+
buildTagBlock,
|
|
43
|
+
insertTag,
|
|
44
|
+
patchCspMeta,
|
|
45
|
+
removeTag,
|
|
46
|
+
revertCspMeta,
|
|
47
|
+
} from './live/frameworks/tag-strategy.mjs';
|
|
48
|
+
import { buildLiveScriptSrc } from './live/frameworks/script-src.mjs';
|
|
49
|
+
import { assertSafeProjectRelative, resolveProjectPath, writeProjectFileAtomic } from './live/frameworks/detect-utils.mjs';
|
|
50
|
+
import { enterLiveRoot, validateRootsManifest } from './live/roots.mjs';
|
|
35
51
|
|
|
36
52
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
53
|
+
// Resolved lazily so the enterLiveRoot() chdir in the CLI guard below takes
|
|
54
|
+
// effect first; module scope runs before the guard.
|
|
55
|
+
let CONFIG_PATH_CACHED = null;
|
|
56
|
+
function CONFIG_PATH_GET() {
|
|
57
|
+
if (!CONFIG_PATH_CACHED) {
|
|
58
|
+
CONFIG_PATH_CACHED = resolveLiveConfigPath({ cwd: process.cwd(), scriptsDir: __dirname });
|
|
59
|
+
}
|
|
60
|
+
return CONFIG_PATH_CACHED;
|
|
61
|
+
}
|
|
42
62
|
const IGNORE_MARKER_OPEN = '# impeccable-live-ignore-start';
|
|
43
63
|
const IGNORE_MARKER_CLOSE = '# impeccable-live-ignore-end';
|
|
44
64
|
|
|
@@ -46,6 +66,9 @@ export const LIVE_IGNORE_PATTERNS = Object.freeze([
|
|
|
46
66
|
'.impeccable/hook.cache.json',
|
|
47
67
|
'.impeccable/config.local.json',
|
|
48
68
|
'.impeccable/live/server.json',
|
|
69
|
+
'.impeccable/live/roots.json',
|
|
70
|
+
'.impeccable/live/app-root.json',
|
|
71
|
+
'.impeccable/live/inject-journal.json',
|
|
49
72
|
'.impeccable/live/sessions/',
|
|
50
73
|
'.impeccable/live/previews/',
|
|
51
74
|
'.impeccable/live/annotations/',
|
|
@@ -101,133 +124,162 @@ Output (JSON):
|
|
|
101
124
|
}
|
|
102
125
|
|
|
103
126
|
if (args.includes('--check')) {
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
// Deliberately read-only: --check runs from status paths and must never
|
|
128
|
+
// mutate the tree. Journal reconciliation happens on the inject run.
|
|
129
|
+
if (!fs.existsSync(CONFIG_PATH_GET())) {
|
|
130
|
+
console.log(JSON.stringify({ ok: false, error: 'config_missing', path: CONFIG_PATH_GET() }));
|
|
106
131
|
process.exit(0);
|
|
107
132
|
}
|
|
108
133
|
let cfg;
|
|
109
134
|
try {
|
|
110
|
-
cfg = JSON.parse(fs.readFileSync(
|
|
135
|
+
cfg = JSON.parse(fs.readFileSync(CONFIG_PATH_GET(), 'utf-8'));
|
|
111
136
|
} catch (err) {
|
|
112
|
-
console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path:
|
|
137
|
+
console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path: CONFIG_PATH_GET() }));
|
|
113
138
|
return;
|
|
114
139
|
}
|
|
115
140
|
try {
|
|
116
141
|
validateConfig(cfg);
|
|
117
142
|
} catch (err) {
|
|
118
|
-
console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path:
|
|
143
|
+
console.log(JSON.stringify({ ok: false, error: 'config_invalid', message: err.message, path: CONFIG_PATH_GET() }));
|
|
119
144
|
return;
|
|
120
145
|
}
|
|
121
|
-
console.log(JSON.stringify({ ok: true, config: cfg, path:
|
|
146
|
+
console.log(JSON.stringify({ ok: true, config: cfg, path: CONFIG_PATH_GET() }));
|
|
122
147
|
return;
|
|
123
148
|
}
|
|
124
149
|
|
|
125
150
|
// Load config
|
|
126
|
-
if (!fs.existsSync(
|
|
127
|
-
console.error(JSON.stringify({ ok: false, error: 'config_missing', path:
|
|
151
|
+
if (!fs.existsSync(CONFIG_PATH_GET())) {
|
|
152
|
+
console.error(JSON.stringify({ ok: false, error: 'config_missing', path: CONFIG_PATH_GET() }));
|
|
128
153
|
process.exit(1);
|
|
129
154
|
}
|
|
130
|
-
const config = JSON.parse(fs.readFileSync(
|
|
155
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_PATH_GET(), 'utf-8'));
|
|
131
156
|
validateConfig(config);
|
|
132
157
|
|
|
133
|
-
const
|
|
134
|
-
const
|
|
135
|
-
const
|
|
136
|
-
const
|
|
158
|
+
const cwd = process.cwd();
|
|
159
|
+
const resolvedFiles = resolveFiles(cwd, config);
|
|
160
|
+
const resolved = resolveFramework(cwd, config);
|
|
161
|
+
const isAdapter = resolved?.framework.inject.kind === 'adapter';
|
|
137
162
|
|
|
138
163
|
if (args.includes('--remove')) {
|
|
139
|
-
if (
|
|
140
|
-
const adapterResult =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
console.log(JSON.stringify({
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
if (adapterResult.error) process.exitCode = 1;
|
|
164
|
+
if (isAdapter) {
|
|
165
|
+
const adapterResult = resolved.framework.inject.remove({ cwd, config, project: resolved.project });
|
|
166
|
+
const ok = !(adapterResult && adapterResult.error);
|
|
167
|
+
// Anything the adapter could not reach (its detection may have shifted
|
|
168
|
+
// since the session started) is still on the journal.
|
|
169
|
+
const { healed } = healInjectJournal(cwd);
|
|
170
|
+
clearInjectJournal(cwd);
|
|
171
|
+
console.log(JSON.stringify({
|
|
172
|
+
ok,
|
|
173
|
+
adapter: resolved.framework.name,
|
|
174
|
+
results: [adapterResult],
|
|
175
|
+
healed: healed.length ? healed : undefined,
|
|
176
|
+
}));
|
|
177
|
+
if (!ok) process.exitCode = 1;
|
|
154
178
|
return;
|
|
155
179
|
}
|
|
156
180
|
const results = resolvedFiles.map((relFile) => {
|
|
157
|
-
|
|
158
|
-
|
|
181
|
+
let absFile;
|
|
182
|
+
try {
|
|
183
|
+
absFile = resolveProjectPath(cwd, relFile, { mustExist: true, kind: 'file' });
|
|
184
|
+
} catch (error) {
|
|
185
|
+
return { file: relFile, error: 'unsafe_file_path', message: error.message };
|
|
186
|
+
}
|
|
159
187
|
const content = fs.readFileSync(absFile, 'utf-8');
|
|
160
188
|
const detagged = removeTag(content, config.commentSyntax);
|
|
161
189
|
const updated = revertCspMeta(detagged);
|
|
162
190
|
if (updated === content) return { file: relFile, removed: false, note: 'no tag present' };
|
|
163
|
-
|
|
191
|
+
writeProjectFileAtomic(cwd, relFile, updated);
|
|
164
192
|
return {
|
|
165
193
|
file: relFile,
|
|
166
194
|
removed: detagged !== content,
|
|
167
195
|
cspReverted: updated !== detagged,
|
|
168
196
|
};
|
|
169
197
|
});
|
|
170
|
-
|
|
198
|
+
const { healed } = healInjectJournal(cwd);
|
|
199
|
+
clearInjectJournal(cwd);
|
|
200
|
+
console.log(JSON.stringify({ ok: true, results, healed: healed.length ? healed : undefined }));
|
|
171
201
|
return;
|
|
172
202
|
}
|
|
173
203
|
|
|
174
204
|
// Insert mode — need --port
|
|
175
205
|
const portIdx = args.indexOf('--port');
|
|
176
|
-
const port = portIdx !== -1 ?
|
|
177
|
-
if (!Number.
|
|
178
|
-
console.error(JSON.stringify({ ok: false, error: '
|
|
206
|
+
const port = portIdx !== -1 ? Number(args[portIdx + 1]) : NaN;
|
|
207
|
+
if (!Number.isInteger(port) || port < 1 || port > 65_535) {
|
|
208
|
+
console.error(JSON.stringify({ ok: false, error: 'missing_or_invalid_port' }));
|
|
179
209
|
process.exit(1);
|
|
180
210
|
}
|
|
181
211
|
// Optional server token: appended to the /live.js src so the token-gated
|
|
182
|
-
// /live.js handler authorizes the browser fetch. `live.mjs` always passes
|
|
212
|
+
// /live.js handler authorizes the browser fetch. `live.mjs` always passes
|
|
213
|
+
// it; a manual `--port`-only invocation reads the running helper's token
|
|
214
|
+
// from server.json instead of writing an unauthenticated URL that 401s.
|
|
183
215
|
const tokenIdx = args.indexOf('--token');
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
console.log(JSON.stringify({ ok: true, port, adapter: 'sveltekit', gitIgnore, results: [adapterResult] }));
|
|
193
|
-
return;
|
|
216
|
+
let token = tokenIdx !== -1 ? args[tokenIdx + 1] : undefined;
|
|
217
|
+
if (!token) {
|
|
218
|
+
try {
|
|
219
|
+
const info = JSON.parse(fs.readFileSync(path.join(cwd, '.impeccable', 'live', 'server.json'), 'utf-8'));
|
|
220
|
+
// A record for a DIFFERENT port is a stale or foreign helper; its token
|
|
221
|
+
// would 401 just the same, so only adopt a matching one.
|
|
222
|
+
if (info?.token && Number(info.port) === port) token = info.token;
|
|
223
|
+
} catch { /* no running helper recorded; keep legacy tokenless behavior */ }
|
|
194
224
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
225
|
+
|
|
226
|
+
// Reconcile before writing anything. Artifacts this run is about to own are
|
|
227
|
+
// kept (so a repeat inject stays byte-idempotent); artifacts left behind by
|
|
228
|
+
// a session that never got to stop are healed.
|
|
229
|
+
const plannedArtifacts = describeInjectArtifacts(resolved, { cwd, files: resolvedFiles });
|
|
230
|
+
const { healed } = healInjectJournal(cwd, { keep: plannedArtifacts.map((a) => a.path) });
|
|
231
|
+
|
|
232
|
+
const gitIgnore = ensureLiveGitIgnores(cwd, frameworkIgnorePatterns(resolved));
|
|
233
|
+
// In a nested-app repo the roots pointer lives at the REPO root, outside the
|
|
234
|
+
// reach of the appRoot-relative ignore block above; give that directory its
|
|
235
|
+
// own local excludes so the pointer (absolute host paths) never gets staged.
|
|
236
|
+
try {
|
|
237
|
+
const rootsManifest = validateRootsManifest(JSON.parse(fs.readFileSync(path.join(cwd, '.impeccable', 'live', 'roots.json'), 'utf-8')));
|
|
238
|
+
if (path.resolve(rootsManifest.repoRoot) !== path.resolve(cwd)) {
|
|
239
|
+
ensureLiveGitIgnores(rootsManifest.repoRoot);
|
|
240
|
+
}
|
|
241
|
+
} catch { /* no valid manifest: single-root project */ }
|
|
242
|
+
|
|
243
|
+
if (isAdapter) {
|
|
244
|
+
const adapterResult = resolved.framework.inject.apply({
|
|
245
|
+
cwd,
|
|
199
246
|
port,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
if (nuxt) {
|
|
208
|
-
const adapterResult = applyNuxtLiveAdapter({ cwd: process.cwd(), port, token, project: nuxt });
|
|
247
|
+
token,
|
|
248
|
+
config,
|
|
249
|
+
project: resolved.project,
|
|
250
|
+
});
|
|
251
|
+
const ok = !(adapterResult && adapterResult.error);
|
|
252
|
+
if (ok) recordInjection(cwd, { framework: resolved.framework.name, port, artifacts: plannedArtifacts });
|
|
209
253
|
console.log(JSON.stringify({
|
|
210
|
-
ok
|
|
254
|
+
ok,
|
|
211
255
|
port,
|
|
212
|
-
adapter:
|
|
256
|
+
adapter: resolved.framework.name,
|
|
213
257
|
gitIgnore,
|
|
214
258
|
results: [adapterResult],
|
|
259
|
+
healed: healed.length ? healed : undefined,
|
|
215
260
|
}));
|
|
216
|
-
if (
|
|
261
|
+
if (!ok) process.exitCode = 1;
|
|
217
262
|
return;
|
|
218
263
|
}
|
|
219
264
|
|
|
220
265
|
const results = resolvedFiles.map((relFile) => {
|
|
221
|
-
|
|
222
|
-
|
|
266
|
+
let absFile;
|
|
267
|
+
try {
|
|
268
|
+
absFile = resolveProjectPath(cwd, relFile, { mustExist: true, kind: 'file' });
|
|
269
|
+
} catch (error) {
|
|
270
|
+
return { file: relFile, error: 'unsafe_file_path', message: error.message };
|
|
271
|
+
}
|
|
223
272
|
const content = fs.readFileSync(absFile, 'utf-8');
|
|
224
273
|
const withoutOld = revertCspMeta(removeTag(content, config.commentSyntax));
|
|
225
|
-
|
|
274
|
+
// Per-file, not per-project: a Vite app can hold an .astro partial, and a
|
|
275
|
+
// framework project's entry template is often plain HTML.
|
|
276
|
+
const scriptAttrs = resolveSourceTraits(relFile).injectScriptAttrs;
|
|
277
|
+
const withTag = insertTag(withoutOld, config, port, token, scriptAttrs);
|
|
226
278
|
if (withTag === withoutOld) {
|
|
227
279
|
return { file: relFile, error: 'insertion_point_not_found', anchor: config.insertBefore || config.insertAfter };
|
|
228
280
|
}
|
|
229
281
|
const updated = patchCspMeta(withTag, port);
|
|
230
|
-
|
|
282
|
+
writeProjectFileAtomic(cwd, relFile, updated);
|
|
231
283
|
return {
|
|
232
284
|
file: relFile,
|
|
233
285
|
inserted: true,
|
|
@@ -235,7 +287,19 @@ Output (JSON):
|
|
|
235
287
|
};
|
|
236
288
|
});
|
|
237
289
|
const anyInserted = results.some((r) => r.inserted);
|
|
238
|
-
|
|
290
|
+
const writtenFiles = new Set(results.filter((r) => r.inserted).map((r) => r.file));
|
|
291
|
+
recordInjection(cwd, {
|
|
292
|
+
framework: resolved?.framework.name,
|
|
293
|
+
port,
|
|
294
|
+
artifacts: plannedArtifacts.filter((a) => writtenFiles.has(a.path)),
|
|
295
|
+
});
|
|
296
|
+
console.log(JSON.stringify({
|
|
297
|
+
ok: anyInserted,
|
|
298
|
+
port,
|
|
299
|
+
gitIgnore,
|
|
300
|
+
results,
|
|
301
|
+
healed: healed.length ? healed : undefined,
|
|
302
|
+
}));
|
|
239
303
|
if (!anyInserted) process.exit(1);
|
|
240
304
|
}
|
|
241
305
|
|
|
@@ -270,115 +334,6 @@ export function ensureLiveGitIgnores(cwd = process.cwd(), extraPatterns = []) {
|
|
|
270
334
|
};
|
|
271
335
|
}
|
|
272
336
|
|
|
273
|
-
// ---------------------------------------------------------------------------
|
|
274
|
-
// Nuxt adapter
|
|
275
|
-
//
|
|
276
|
-
// A script element placed in app.vue is compiled as Vue-rendered DOM and is
|
|
277
|
-
// not executed. Nuxt instead auto-discovers client plugins. Keep the adapter
|
|
278
|
-
// generated, dev-only, and outside user-authored source: Live creates one
|
|
279
|
-
// marked .client.ts plugin on start and removes it on stop.
|
|
280
|
-
// ---------------------------------------------------------------------------
|
|
281
|
-
|
|
282
|
-
export function detectNuxtProject(cwd = process.cwd()) {
|
|
283
|
-
const configFile = fs.readdirSync(cwd, { withFileTypes: true })
|
|
284
|
-
.find((entry) => entry.isFile() && /^nuxt\.config\.(?:js|mjs|cjs|ts|mts|cts)$/.test(entry.name))
|
|
285
|
-
?.name;
|
|
286
|
-
if (!configFile) return null;
|
|
287
|
-
|
|
288
|
-
const config = fs.readFileSync(path.join(cwd, configFile), 'utf-8');
|
|
289
|
-
const literalSrcDir = config.match(/\bsrcDir\s*:\s*(['"])([^'"]+)\1/);
|
|
290
|
-
let appDir = '';
|
|
291
|
-
if (literalSrcDir) {
|
|
292
|
-
const candidate = literalSrcDir[2]
|
|
293
|
-
.replace(/\\/g, '/')
|
|
294
|
-
.replace(/^\.\//, '')
|
|
295
|
-
.replace(/\/+$/, '');
|
|
296
|
-
const normalized = path.posix.normalize(candidate);
|
|
297
|
-
if (normalized !== '..' && !normalized.startsWith('../') && !path.isAbsolute(normalized)) {
|
|
298
|
-
appDir = normalized === '.' ? '' : normalized;
|
|
299
|
-
}
|
|
300
|
-
} else if (
|
|
301
|
-
fs.existsSync(path.join(cwd, 'app', 'app.vue'))
|
|
302
|
-
|| fs.existsSync(path.join(cwd, 'app', 'pages'))
|
|
303
|
-
) {
|
|
304
|
-
appDir = 'app';
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
const pluginFile = [appDir, 'plugins', NUXT_PLUGIN_NAME].filter(Boolean).join('/');
|
|
308
|
-
return { configFile, appDir, pluginFile };
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
export function buildNuxtPlugin(port, token) {
|
|
312
|
-
return `/* ${NUXT_PLUGIN_MARKER} */
|
|
313
|
-
const liveSrc = '${buildLiveScriptSrc(port, token)}';
|
|
314
|
-
const liveSelector = 'script[data-impeccable-live-nuxt]';
|
|
315
|
-
|
|
316
|
-
export default defineNuxtPlugin(() => {
|
|
317
|
-
if (!import.meta.dev || typeof document === 'undefined') return;
|
|
318
|
-
|
|
319
|
-
const expectedSrc = new URL(liveSrc, window.location.href).href;
|
|
320
|
-
let script = document.querySelector(liveSelector);
|
|
321
|
-
if (script?.src === expectedSrc) return;
|
|
322
|
-
script?.remove();
|
|
323
|
-
|
|
324
|
-
script = document.createElement('script');
|
|
325
|
-
script.src = liveSrc;
|
|
326
|
-
script.async = true;
|
|
327
|
-
script.dataset.impeccableLiveNuxt = '';
|
|
328
|
-
document.head.appendChild(script);
|
|
329
|
-
|
|
330
|
-
import.meta.hot?.dispose(() => {
|
|
331
|
-
if (script?.isConnected) script.remove();
|
|
332
|
-
});
|
|
333
|
-
});
|
|
334
|
-
/* /${NUXT_PLUGIN_MARKER} */
|
|
335
|
-
`;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export function applyNuxtLiveAdapter({ cwd = process.cwd(), port, token, project = detectNuxtProject(cwd) }) {
|
|
339
|
-
if (!project) return { error: 'nuxt_not_detected' };
|
|
340
|
-
const absFile = path.join(cwd, project.pluginFile);
|
|
341
|
-
const existing = fs.existsSync(absFile) ? fs.readFileSync(absFile, 'utf-8') : null;
|
|
342
|
-
if (existing !== null && !existing.includes(NUXT_PLUGIN_MARKER)) {
|
|
343
|
-
return {
|
|
344
|
-
file: project.pluginFile,
|
|
345
|
-
error: 'nuxt_plugin_conflict',
|
|
346
|
-
hint: `${project.pluginFile} already exists and is not managed by Impeccable Live`,
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const content = buildNuxtPlugin(port, token);
|
|
351
|
-
fs.mkdirSync(path.dirname(absFile), { recursive: true });
|
|
352
|
-
if (content !== existing) fs.writeFileSync(absFile, content, 'utf-8');
|
|
353
|
-
return {
|
|
354
|
-
file: project.pluginFile,
|
|
355
|
-
inserted: true,
|
|
356
|
-
changed: content !== existing,
|
|
357
|
-
devOnly: true,
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
export function removeNuxtLiveAdapter({ cwd = process.cwd(), project = detectNuxtProject(cwd) }) {
|
|
362
|
-
if (!project) return { error: 'nuxt_not_detected' };
|
|
363
|
-
const absFile = path.join(cwd, project.pluginFile);
|
|
364
|
-
if (!fs.existsSync(absFile)) {
|
|
365
|
-
return { file: project.pluginFile, removed: false, note: 'no adapter present' };
|
|
366
|
-
}
|
|
367
|
-
const content = fs.readFileSync(absFile, 'utf-8');
|
|
368
|
-
if (!content.includes(NUXT_PLUGIN_MARKER)) {
|
|
369
|
-
return {
|
|
370
|
-
file: project.pluginFile,
|
|
371
|
-
removed: false,
|
|
372
|
-
error: 'nuxt_plugin_conflict',
|
|
373
|
-
hint: `${project.pluginFile} is not managed by Impeccable Live`,
|
|
374
|
-
};
|
|
375
|
-
}
|
|
376
|
-
fs.unlinkSync(absFile);
|
|
377
|
-
const pluginDir = path.dirname(absFile);
|
|
378
|
-
if (fs.readdirSync(pluginDir).length === 0) fs.rmdirSync(pluginDir);
|
|
379
|
-
return { file: project.pluginFile, removed: true };
|
|
380
|
-
}
|
|
381
|
-
|
|
382
337
|
function resolveIgnoreTarget(cwd) {
|
|
383
338
|
const gitExcludePath = resolveGitInfoExcludePath(cwd);
|
|
384
339
|
if (gitExcludePath) {
|
|
@@ -425,26 +380,28 @@ export function resolveFiles(rootDir, config) {
|
|
|
425
380
|
const seen = new Set();
|
|
426
381
|
const out = [];
|
|
427
382
|
for (const pat of patterns) {
|
|
428
|
-
|
|
383
|
+
const normalizedPattern = assertSafeProjectRelative(pat, 'config.files entry', { allowGlob: true });
|
|
384
|
+
if (!isGlob(normalizedPattern)) {
|
|
429
385
|
// Literal path — include even if it doesn't exist yet; the caller
|
|
430
386
|
// reports file_not_found per-entry. Exclude list doesn't apply to
|
|
431
387
|
// explicit literal entries (user named it on purpose).
|
|
432
|
-
if (!seen.has(
|
|
433
|
-
seen.add(
|
|
434
|
-
out.push(
|
|
388
|
+
if (!seen.has(normalizedPattern)) {
|
|
389
|
+
seen.add(normalizedPattern);
|
|
390
|
+
out.push(normalizedPattern);
|
|
435
391
|
}
|
|
436
392
|
continue;
|
|
437
393
|
}
|
|
438
394
|
let matches;
|
|
439
395
|
try {
|
|
440
|
-
matches = fs.globSync(
|
|
396
|
+
matches = fs.globSync(normalizedPattern, { cwd: rootDir, withFileTypes: true });
|
|
441
397
|
} catch {
|
|
442
398
|
continue;
|
|
443
399
|
}
|
|
444
400
|
for (const ent of matches) {
|
|
445
401
|
if (!ent.isFile || !ent.isFile()) continue;
|
|
446
402
|
const abs = path.join(ent.parentPath || ent.path || rootDir, ent.name);
|
|
447
|
-
const rel = path.relative(rootDir, abs).split(path.sep).join('/');
|
|
403
|
+
const rel = assertSafeProjectRelative(path.relative(rootDir, abs).split(path.sep).join('/'));
|
|
404
|
+
try { resolveProjectPath(rootDir, rel, { mustExist: true, kind: 'file' }); } catch { continue; }
|
|
448
405
|
if (isExcluded(rel)) continue;
|
|
449
406
|
if (seen.has(rel)) continue;
|
|
450
407
|
seen.add(rel);
|
|
@@ -507,6 +464,7 @@ function validateConfig(cfg) {
|
|
|
507
464
|
if (!cfg.files.every((f) => typeof f === 'string' && f.length > 0)) {
|
|
508
465
|
throw new Error('config.files must contain only non-empty strings');
|
|
509
466
|
}
|
|
467
|
+
for (const file of cfg.files) assertSafeProjectRelative(file, 'config.files entry', { allowGlob: true });
|
|
510
468
|
if (cfg.exclude !== undefined) {
|
|
511
469
|
if (!Array.isArray(cfg.exclude)) {
|
|
512
470
|
throw new Error('config.exclude, if present, must be a string array');
|
|
@@ -514,6 +472,7 @@ function validateConfig(cfg) {
|
|
|
514
472
|
if (!cfg.exclude.every((f) => typeof f === 'string' && f.length > 0)) {
|
|
515
473
|
throw new Error('config.exclude must contain only non-empty strings');
|
|
516
474
|
}
|
|
475
|
+
for (const file of cfg.exclude) assertSafeProjectRelative(file, 'config.exclude entry', { allowGlob: true });
|
|
517
476
|
}
|
|
518
477
|
if (typeof cfg.insertBefore !== 'string' && typeof cfg.insertAfter !== 'string') {
|
|
519
478
|
throw new Error('config.insertBefore or config.insertAfter (string) required');
|
|
@@ -526,242 +485,31 @@ function validateConfig(cfg) {
|
|
|
526
485
|
}
|
|
527
486
|
}
|
|
528
487
|
|
|
529
|
-
function commentOpen(syntax) { return syntax === 'jsx' ? '{/*' : '<!--'; }
|
|
530
|
-
function commentClose(syntax) { return syntax === 'jsx' ? '*/}' : '-->'; }
|
|
531
|
-
|
|
532
|
-
/**
|
|
533
|
-
* Build the /live.js src the browser loads. When a token is supplied it rides
|
|
534
|
-
* as a `?token=...` query param so the server's token-gated /live.js handler
|
|
535
|
-
* authorizes the fetch. Shared by every injection path (HTML/JSX script tag,
|
|
536
|
-
* the Nuxt plugin, the SvelteKit root component) so they stay in sync.
|
|
537
|
-
*/
|
|
538
|
-
export function buildLiveScriptSrc(port, token) {
|
|
539
|
-
const base = 'http://localhost:' + port + '/live.js';
|
|
540
|
-
return token ? base + '?token=' + encodeURIComponent(token) : base;
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
function buildTagBlock(syntax, port, filePath, token) {
|
|
544
|
-
const open = commentOpen(syntax);
|
|
545
|
-
const close = commentClose(syntax);
|
|
546
|
-
// Astro processes <script> tags by default and rewrites src to its own
|
|
547
|
-
// bundled URL. is:inline opts out so the literal external src survives.
|
|
548
|
-
const isAstro = typeof filePath === 'string' && filePath.endsWith('.astro');
|
|
549
|
-
const scriptAttrs = isAstro ? 'is:inline ' : '';
|
|
550
|
-
return (
|
|
551
|
-
open + ' ' + MARKER_OPEN_TEXT + ' ' + close + '\n' +
|
|
552
|
-
'<script ' + scriptAttrs + 'src="' + buildLiveScriptSrc(port, token) + '"></script>\n' +
|
|
553
|
-
open + ' ' + MARKER_CLOSE_TEXT + ' ' + close + '\n'
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
function detectLineEnding(content) {
|
|
558
|
-
if (content.includes('\r\n')) return '\r\n';
|
|
559
|
-
if (content.includes('\r')) return '\r';
|
|
560
|
-
return '\n';
|
|
561
|
-
}
|
|
562
|
-
|
|
563
|
-
function normalizeLineEndings(content, lineEnding) {
|
|
564
|
-
return lineEnding === '\n' ? content : content.replace(/\n/g, lineEnding);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
function readLineEndingAt(content, index) {
|
|
568
|
-
if (content[index] === '\r' && content[index + 1] === '\n') return '\r\n';
|
|
569
|
-
if (content[index] === '\n') return '\n';
|
|
570
|
-
if (content[index] === '\r') return '\r';
|
|
571
|
-
return '';
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
function insertTag(content, config, port, filePath, token) {
|
|
575
|
-
const lineEnding = detectLineEnding(content);
|
|
576
|
-
const block = normalizeLineEndings(buildTagBlock(config.commentSyntax, port, filePath, token), lineEnding);
|
|
577
|
-
// insertBefore: match the LAST occurrence. Anchors like `</body>` naturally
|
|
578
|
-
// belong at the end, and the same literal can appear earlier in code blocks
|
|
579
|
-
// within rendered documentation pages.
|
|
580
|
-
if (config.insertBefore) {
|
|
581
|
-
const idx = content.lastIndexOf(config.insertBefore);
|
|
582
|
-
if (idx === -1) return content;
|
|
583
|
-
return content.slice(0, idx) + block + content.slice(idx);
|
|
584
|
-
}
|
|
585
|
-
// insertAfter: match the FIRST occurrence — typical anchors like `<head>` or
|
|
586
|
-
// `<body>` open near the top of the document.
|
|
587
|
-
const idx = content.indexOf(config.insertAfter);
|
|
588
|
-
if (idx === -1) return content;
|
|
589
|
-
const after = idx + config.insertAfter.length;
|
|
590
|
-
// Preserve an existing trailing newline if the anchor already has one.
|
|
591
|
-
// Slice the remainder from the original anchor offset, not prefix.length:
|
|
592
|
-
// in the no-newline case prefix is one char longer than the anchor (the
|
|
593
|
-
// appended '\n'), so slicing by prefix.length would drop the first real
|
|
594
|
-
// character after the anchor (#227).
|
|
595
|
-
const existingNewline = readLineEndingAt(content, after);
|
|
596
|
-
const prefix = content.slice(0, after) + (existingNewline || lineEnding);
|
|
597
|
-
const rest = content.slice(after + existingNewline.length);
|
|
598
|
-
return prefix + block + rest;
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
/**
|
|
602
|
-
* Remove the live script block. Matches either HTML or JSX comment markers
|
|
603
|
-
* regardless of config (so stale tags from a wrong config can still be cleaned).
|
|
604
|
-
*
|
|
605
|
-
* Indent-preserving: captures any whitespace immediately preceding the opener
|
|
606
|
-
* marker and re-emits it in place of the removed block. `insertTag` inserted
|
|
607
|
-
* the block *after* the original line's indent and *before* the anchor (e.g.
|
|
608
|
-
* `</body>`), which moved the indent onto the opener line and left the anchor
|
|
609
|
-
* unindented. Replacing the whole block (plus its trailing newline) with just
|
|
610
|
-
* the captured indent hands the indent back to the anchor that follows.
|
|
611
|
-
*/
|
|
612
|
-
function removeTag(content, _syntax) {
|
|
613
|
-
const patterns = [
|
|
614
|
-
/([ \t]*)<!--\s*impeccable-live-start\s*-->[\s\S]*?<!--\s*impeccable-live-end\s*-->([ \t]*(?:\r\n|\n|\r|$)?)/,
|
|
615
|
-
/([ \t]*)\{\/\*\s*impeccable-live-start\s*\*\/\}[\s\S]*?\{\/\*\s*impeccable-live-end\s*\*\/\}([ \t]*(?:\r\n|\n|\r|$)?)/,
|
|
616
|
-
];
|
|
617
|
-
for (const pat of patterns) {
|
|
618
|
-
let changed = false;
|
|
619
|
-
let next = content;
|
|
620
|
-
do {
|
|
621
|
-
content = next;
|
|
622
|
-
next = content.replace(pat, (_match, leadingIndent, trailing = '') => {
|
|
623
|
-
if (/[\r\n]/.test(trailing)) return leadingIndent;
|
|
624
|
-
return leadingIndent || trailing || '';
|
|
625
|
-
});
|
|
626
|
-
if (next !== content) changed = true;
|
|
627
|
-
} while (next !== content);
|
|
628
|
-
if (changed) return next;
|
|
629
|
-
}
|
|
630
|
-
return content;
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
// ---------------------------------------------------------------------------
|
|
634
|
-
// Content-Security-Policy meta-tag patcher
|
|
635
|
-
//
|
|
636
|
-
// When the user's HTML carries `<meta http-equiv="Content-Security-Policy">`,
|
|
637
|
-
// the cross-origin load of /live.js (and the SSE/POST connection back to
|
|
638
|
-
// localhost:PORT) is blocked unless the CSP explicitly allows that origin.
|
|
639
|
-
//
|
|
640
|
-
// On insert: append `http://localhost:PORT` to `script-src` and `connect-src`,
|
|
641
|
-
// and stash the original `content` value in a `data-impeccable-csp-original`
|
|
642
|
-
// attribute (base64) so revert is exact.
|
|
643
|
-
//
|
|
644
|
-
// On remove: detect the marker attribute, decode it, restore the original
|
|
645
|
-
// content value verbatim, drop the marker.
|
|
646
|
-
//
|
|
647
|
-
// Header-based CSP (Next.js headers, Nuxt routeRules, SvelteKit kit.csp,
|
|
648
|
-
// shared helpers) is NOT patched here — those need framework-specific config
|
|
649
|
-
// edits and are handled via the existing detect-csp.mjs reference output.
|
|
650
|
-
// Only the in-source meta-tag form gets the auto-patch.
|
|
651
|
-
// ---------------------------------------------------------------------------
|
|
652
|
-
|
|
653
|
-
const CSP_MARKER_ATTR = 'data-impeccable-csp-original';
|
|
654
|
-
|
|
655
|
-
function findCspMetaTags(content) {
|
|
656
|
-
const out = [];
|
|
657
|
-
const tagRe = /<meta\s+([^>]*?)\/?>/gis;
|
|
658
|
-
let m;
|
|
659
|
-
while ((m = tagRe.exec(content)) !== null) {
|
|
660
|
-
const attrs = m[1];
|
|
661
|
-
if (!/(http-equiv|httpEquiv)\s*=\s*(['"])Content-Security-Policy\2/i.test(attrs)) continue;
|
|
662
|
-
out.push({ start: m.index, end: m.index + m[0].length, full: m[0], attrs });
|
|
663
|
-
}
|
|
664
|
-
return out;
|
|
665
|
-
}
|
|
666
|
-
|
|
667
|
-
function getAttr(attrs, name) {
|
|
668
|
-
const re = new RegExp(`\\b${name}\\s*=\\s*(['"])([\\s\\S]*?)\\1`, 'i');
|
|
669
|
-
const m = attrs.match(re);
|
|
670
|
-
return m ? { quote: m[1], value: m[2], full: m[0] } : null;
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
function appendOriginToDirective(csp, directive, origin) {
|
|
674
|
-
const re = new RegExp(`(^|;)(\\s*)(${directive})\\s+([^;]*)`, 'i');
|
|
675
|
-
const m = csp.match(re);
|
|
676
|
-
if (m) {
|
|
677
|
-
const tokens = m[4].trim().split(/\s+/);
|
|
678
|
-
if (tokens.includes(origin)) return csp;
|
|
679
|
-
return csp.replace(re, `${m[1]}${m[2]}${m[3]} ${[...tokens, origin].join(' ')}`);
|
|
680
|
-
}
|
|
681
|
-
// Directive missing — add it. Use 'self' + origin so we don't inadvertently
|
|
682
|
-
// narrow the policy compared to the default-src fallback (most users with
|
|
683
|
-
// an explicit CSP have 'self' there).
|
|
684
|
-
return csp.trim().replace(/;?\s*$/, '') + `; ${directive} 'self' ${origin}`;
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
export function patchCspMeta(content, port) {
|
|
688
|
-
const tags = findCspMetaTags(content);
|
|
689
|
-
if (tags.length === 0) return content;
|
|
690
|
-
const origin = `http://localhost:${port}`;
|
|
691
|
-
|
|
692
|
-
// Walk last-to-first so prior splices don't invalidate later indices.
|
|
693
|
-
let result = content;
|
|
694
|
-
for (let i = tags.length - 1; i >= 0; i--) {
|
|
695
|
-
const tag = tags[i];
|
|
696
|
-
const attrs = tag.attrs;
|
|
697
|
-
if (getAttr(attrs, CSP_MARKER_ATTR)) continue; // already patched
|
|
698
|
-
const contentAttr = getAttr(attrs, 'content');
|
|
699
|
-
if (!contentAttr) continue;
|
|
700
|
-
|
|
701
|
-
const original = contentAttr.value;
|
|
702
|
-
let patched = original;
|
|
703
|
-
patched = appendOriginToDirective(patched, 'script-src', origin);
|
|
704
|
-
patched = appendOriginToDirective(patched, 'connect-src', origin);
|
|
705
|
-
// The shader overlay during 'generating' creates a screenshot via
|
|
706
|
-
// URL.createObjectURL, producing a `blob:` URL — img-src 'self' rejects
|
|
707
|
-
// those. Add `blob:` so the overlay doesn't throw a CSP violation.
|
|
708
|
-
patched = appendOriginToDirective(patched, 'img-src', 'blob:');
|
|
709
|
-
if (patched === original) continue;
|
|
710
|
-
|
|
711
|
-
const newContentAttr = `content=${contentAttr.quote}${patched}${contentAttr.quote}`;
|
|
712
|
-
const marker = `${CSP_MARKER_ATTR}="${Buffer.from(original, 'utf-8').toString('base64')}"`;
|
|
713
|
-
// The tagRe captures any whitespace between the last attribute and the
|
|
714
|
-
// closing `/>` as part of `attrs`. Naively appending ` ${marker}` after
|
|
715
|
-
// a replace would land it BEFORE that trailing space, leaving a double
|
|
716
|
-
// space inside attrs and clobbering the space before `/>`. Split off
|
|
717
|
-
// the trailing whitespace, splice the marker into the attribute body,
|
|
718
|
-
// and re-append the original trailing whitespace so a self-closing
|
|
719
|
-
// `<meta … />` round-trips byte-for-byte.
|
|
720
|
-
const trailingWs = (attrs.match(/[ \t]*$/) || [''])[0];
|
|
721
|
-
const attrsBody = attrs.slice(0, attrs.length - trailingWs.length);
|
|
722
|
-
const newAttrs = attrsBody.replace(contentAttr.full, newContentAttr) + ' ' + marker + trailingWs;
|
|
723
|
-
const newTag = tag.full.replace(attrs, newAttrs);
|
|
724
|
-
|
|
725
|
-
result = result.slice(0, tag.start) + newTag + result.slice(tag.end);
|
|
726
|
-
}
|
|
727
|
-
return result;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
export function revertCspMeta(content) {
|
|
731
|
-
const tags = findCspMetaTags(content);
|
|
732
|
-
if (tags.length === 0) return content;
|
|
733
|
-
|
|
734
|
-
let result = content;
|
|
735
|
-
for (let i = tags.length - 1; i >= 0; i--) {
|
|
736
|
-
const tag = tags[i];
|
|
737
|
-
const origAttr = getAttr(tag.attrs, CSP_MARKER_ATTR);
|
|
738
|
-
if (!origAttr) continue;
|
|
739
|
-
const contentAttr = getAttr(tag.attrs, 'content');
|
|
740
|
-
if (!contentAttr) continue;
|
|
741
|
-
|
|
742
|
-
let originalValue;
|
|
743
|
-
try { originalValue = Buffer.from(origAttr.value, 'base64').toString('utf-8'); }
|
|
744
|
-
catch { continue; }
|
|
745
|
-
|
|
746
|
-
const newContentAttr = `content=${contentAttr.quote}${originalValue}${contentAttr.quote}`;
|
|
747
|
-
let newAttrs = tag.attrs.replace(contentAttr.full, newContentAttr);
|
|
748
|
-
// Drop the marker attribute and any single space immediately preceding it.
|
|
749
|
-
newAttrs = newAttrs.replace(new RegExp(`\\s*${origAttr.full}`), '');
|
|
750
|
-
const newTag = tag.full.replace(tag.attrs, newAttrs);
|
|
751
|
-
|
|
752
|
-
result = result.slice(0, tag.start) + newTag + result.slice(tag.end);
|
|
753
|
-
}
|
|
754
|
-
return result;
|
|
755
|
-
}
|
|
756
|
-
|
|
757
488
|
// ---------------------------------------------------------------------------
|
|
758
489
|
// Auto-execute
|
|
759
490
|
// ---------------------------------------------------------------------------
|
|
760
491
|
|
|
761
492
|
const _running = process.argv[1];
|
|
762
493
|
if (_running?.endsWith('live-inject.mjs') || _running?.endsWith('live-inject.mjs/')) {
|
|
494
|
+
enterLiveRoot();
|
|
763
495
|
injectCli();
|
|
764
496
|
}
|
|
765
497
|
|
|
766
|
-
|
|
767
|
-
//
|
|
498
|
+
// Re-exported so long-standing importers (live.mjs, the adapter modules, the
|
|
499
|
+
// test suites) keep their entry points while the implementations live in
|
|
500
|
+
// live/frameworks/.
|
|
501
|
+
export {
|
|
502
|
+
buildLiveScriptSrc,
|
|
503
|
+
buildTagBlock,
|
|
504
|
+
insertTag,
|
|
505
|
+
patchCspMeta,
|
|
506
|
+
removeTag,
|
|
507
|
+
revertCspMeta,
|
|
508
|
+
validateConfig,
|
|
509
|
+
};
|
|
510
|
+
export {
|
|
511
|
+
applyNuxtLiveAdapter,
|
|
512
|
+
buildNuxtPlugin,
|
|
513
|
+
detectNuxtProject,
|
|
514
|
+
removeNuxtLiveAdapter,
|
|
515
|
+
} from './live/frameworks/nuxt.mjs';
|