@bastani/atomic 0.9.11-alpha.6 → 0.9.11-alpha.8
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 +38 -0
- package/README.md +3 -5
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/mcp/sampling-handler.ts +1 -5
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +1 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +33 -129
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +11 -3
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +26 -0
- package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +35 -0
- package/dist/builtin/workflows/skills/impeccable/reference/android.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/animate.md +72 -189
- package/dist/builtin/workflows/skills/impeccable/reference/audit.md +10 -9
- package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +19 -108
- package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +59 -253
- package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +51 -222
- package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +45 -0
- package/dist/builtin/workflows/skills/impeccable/reference/craft.md +3 -121
- package/dist/builtin/workflows/skills/impeccable/reference/critique.md +28 -20
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +97 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +23 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +32 -0
- package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/dist/builtin/workflows/skills/impeccable/reference/delight.md +47 -279
- package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +53 -0
- package/dist/builtin/workflows/skills/impeccable/reference/document.md +60 -73
- package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -12
- package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +17 -4
- package/dist/builtin/workflows/skills/impeccable/reference/init.md +64 -163
- package/dist/builtin/workflows/skills/impeccable/reference/ios.md +1 -1
- package/dist/builtin/workflows/skills/impeccable/reference/layout.md +52 -153
- package/dist/builtin/workflows/skills/impeccable/reference/live.md +44 -32
- package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +105 -0
- package/dist/builtin/workflows/skills/impeccable/reference/{product.md → operate.md} +6 -5
- package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +4 -4
- package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -4
- package/dist/builtin/workflows/skills/impeccable/reference/polish.md +68 -212
- package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/reference/routing.md +18 -0
- package/dist/builtin/workflows/skills/impeccable/reference/shape.md +38 -144
- package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +48 -269
- package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +38 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/command-metadata.json +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +584 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +117 -9
- package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +486 -59
- package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +16 -45
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +96 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +143 -26
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +181 -12
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +3187 -182
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +102 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +282 -70
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +183 -15
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +22 -7
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +7 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +16 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +155 -42
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +2988 -155
- package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +11 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +336 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +232 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +90 -10
- package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +410 -78
- package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +25 -8
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +93 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +165 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +329 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +20 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +16 -8
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +1 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +455 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +169 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +457 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +151 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +33 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +146 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +10 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +15 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +149 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +14 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +109 -32
- package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +105 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +105 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +8 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +280 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +208 -68
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +563 -112
- package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +3 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +198 -13
- package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +24 -6
- package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +6 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +44 -14
- package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +398 -33
- package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +9 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +81 -67
- package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +7 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +76 -81
- package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +2 -2
- package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +890 -0
- package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +74 -0
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +1 -24
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +232 -50
- package/dist/builtin/workflows/src/extension/workflow-model-catalog.ts +26 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -2
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-control.ts +23 -9
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-replay.ts +1 -0
- package/dist/builtin/workflows/src/runs/foreground/postmortem-stage-chat.ts +20 -5
- package/dist/builtin/workflows/src/runs/foreground/stage-control-registry.ts +10 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-delivery-activity.ts +86 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-context.ts +6 -2
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +24 -18
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-send-user-message.ts +8 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +3 -3
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +2 -2
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-types.ts +16 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-delivery-activity.ts +121 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-live-events.ts +42 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-state.ts +16 -0
- package/dist/builtin/workflows/src/tui/stage-chat-view-types.ts +4 -0
- package/dist/cli/list-models.d.ts +2 -2
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +5 -5
- package/dist/cli/list-models.js.map +1 -1
- package/dist/core/agent-session-accessors.js +1 -1
- package/dist/core/agent-session-accessors.js.map +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +2 -5
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.js +1 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +5 -5
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +4 -4
- 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-models.d.ts +1 -1
- package/dist/core/agent-session-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +18 -14
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-post-tool-compaction.js +2 -4
- package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +3 -7
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-retry.js +1 -1
- package/dist/core/agent-session-retry.js.map +1 -1
- package/dist/core/agent-session-runtime-auth.d.ts +3 -3
- package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
- package/dist/core/agent-session-runtime-auth.js +4 -14
- package/dist/core/agent-session-runtime-auth.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +3 -3
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +3 -8
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +16 -23
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
- package/dist/core/agent-session-tool-registry.js +2 -1
- package/dist/core/agent-session-tool-registry.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -2
- 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 +2 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +1 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts +1 -0
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +18 -4
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/auth-storage.d.ts +12 -139
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +68 -374
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/copilot-env-routing.d.ts +36 -0
- package/dist/core/copilot-env-routing.d.ts.map +1 -0
- package/dist/core/copilot-env-routing.js +94 -0
- package/dist/core/copilot-env-routing.js.map +1 -0
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +10 -2
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/provider-types.d.ts +0 -40
- package/dist/core/extensions/provider-types.d.ts.map +1 -1
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/fallback-models.d.ts +4 -4
- package/dist/core/fallback-models.d.ts.map +1 -1
- package/dist/core/fallback-models.js +3 -3
- package/dist/core/fallback-models.js.map +1 -1
- package/dist/core/model-config.d.ts +542 -0
- package/dist/core/model-config.d.ts.map +1 -0
- package/dist/core/{model-registry-schemas.js → model-config.js} +85 -34
- package/dist/core/model-config.js.map +1 -0
- package/dist/core/model-registry.d.ts +25 -85
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +65 -388
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver-cli.d.ts +2 -2
- package/dist/core/model-resolver-cli.d.ts.map +1 -1
- package/dist/core/model-resolver-cli.js +2 -2
- package/dist/core/model-resolver-cli.js.map +1 -1
- package/dist/core/model-resolver-initial.d.ts +4 -4
- package/dist/core/model-resolver-initial.d.ts.map +1 -1
- package/dist/core/model-resolver-initial.js +17 -17
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-resolver-scope.d.ts +3 -3
- package/dist/core/model-resolver-scope.d.ts.map +1 -1
- package/dist/core/model-resolver-scope.js +4 -4
- package/dist/core/model-resolver-scope.js.map +1 -1
- package/dist/core/model-runtime-auth.d.ts +7 -0
- package/dist/core/model-runtime-auth.d.ts.map +1 -0
- package/dist/core/model-runtime-auth.js +14 -0
- package/dist/core/model-runtime-auth.js.map +1 -0
- package/dist/core/model-runtime-providers.d.ts +6 -0
- package/dist/core/model-runtime-providers.d.ts.map +1 -0
- package/dist/core/model-runtime-providers.js +22 -0
- package/dist/core/model-runtime-providers.js.map +1 -0
- package/dist/core/model-runtime-restoration.d.ts +6 -0
- package/dist/core/model-runtime-restoration.d.ts.map +1 -0
- package/dist/core/model-runtime-restoration.js +21 -0
- package/dist/core/model-runtime-restoration.js.map +1 -0
- package/dist/core/model-runtime-snapshot.d.ts +16 -0
- package/dist/core/model-runtime-snapshot.d.ts.map +1 -0
- package/dist/core/model-runtime-snapshot.js +52 -0
- package/dist/core/model-runtime-snapshot.js.map +1 -0
- package/dist/core/model-runtime-streaming.d.ts +17 -0
- package/dist/core/model-runtime-streaming.d.ts.map +1 -0
- package/dist/core/model-runtime-streaming.js +66 -0
- package/dist/core/model-runtime-streaming.js.map +1 -0
- package/dist/core/model-runtime-types.d.ts +21 -0
- package/dist/core/model-runtime-types.d.ts.map +1 -0
- package/dist/core/model-runtime-types.js +2 -0
- package/dist/core/model-runtime-types.js.map +1 -0
- package/dist/core/model-runtime.d.ts +50 -29
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +330 -90
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/models-store.d.ts +2 -10
- package/dist/core/models-store.d.ts.map +1 -1
- package/dist/core/models-store.js +2 -29
- package/dist/core/models-store.js.map +1 -1
- package/dist/core/oauth-login.d.ts +24 -0
- package/dist/core/oauth-login.d.ts.map +1 -0
- package/dist/core/oauth-login.js +87 -0
- package/dist/core/oauth-login.js.map +1 -0
- package/dist/core/oauth-provider-metadata.d.ts +5 -0
- package/dist/core/oauth-provider-metadata.d.ts.map +1 -0
- package/dist/core/oauth-provider-metadata.js +19 -0
- package/dist/core/oauth-provider-metadata.js.map +1 -0
- package/dist/core/provider-composer-internal.d.ts +53 -0
- package/dist/core/provider-composer-internal.d.ts.map +1 -0
- package/dist/core/provider-composer-internal.js +273 -0
- package/dist/core/provider-composer-internal.js.map +1 -0
- package/dist/core/provider-composer.d.ts +16 -0
- package/dist/core/provider-composer.d.ts.map +1 -0
- package/dist/core/provider-composer.js +108 -0
- package/dist/core/provider-composer.js.map +1 -0
- package/dist/core/remote-catalog-provider.d.ts.map +1 -1
- package/dist/core/remote-catalog-provider.js +74 -122
- package/dist/core/remote-catalog-provider.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +8 -7
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +26 -23
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/runtime-credentials.d.ts +16 -0
- package/dist/core/runtime-credentials.d.ts.map +1 -0
- package/dist/core/runtime-credentials.js +42 -0
- package/dist/core/runtime-credentials.js.map +1 -0
- package/dist/core/sdk-types.d.ts +1 -7
- 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 +27 -28
- package/dist/core/sdk.js.map +1 -1
- package/dist/extensions/llama/index.js +1 -1
- package/dist/extensions/llama/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts +2 -4
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +25 -17
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/main-runtime-api-key.d.ts +6 -0
- package/dist/main-runtime-api-key.d.ts.map +1 -0
- package/dist/main-runtime-api-key.js +6 -0
- package/dist/main-runtime-api-key.js.map +1 -0
- package/dist/main-session-options.d.ts +2 -2
- package/dist/main-session-options.d.ts.map +1 -1
- package/dist/main-session-options.js +3 -3
- package/dist/main-session-options.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +9 -11
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +2 -14
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +9 -0
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts +25 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-runtime.js +53 -0
- package/dist/modes/interactive/components/chat-session-host-runtime.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +13 -0
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +22 -1
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/footer.js +1 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +1 -3
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +4 -3
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +56 -73
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts +4 -3
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +15 -24
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +10 -4
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-login.js +20 -31
- package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.d.ts +1 -1
- package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-auth-routing.js +21 -47
- package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +3 -3
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +8 -8
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +2 -1
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-model-catalog-startup.js +2 -2
- package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-model-routing.js +11 -11
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +1 -1
- package/dist/modes/interactive/interactive-render-chat.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.js +1 -1
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.d.ts +2 -2
- package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-auth.js +4 -3
- package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +4 -3
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +0 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.js +11 -50
- package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
- package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-api.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +26 -19
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-oauth-client.d.ts +1 -1
- package/dist/modes/rpc/rpc-oauth-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-oauth-client.js +1 -1
- package/dist/modes/rpc/rpc-oauth-client.js.map +1 -1
- package/dist/modes/rpc/rpc-oauth-interaction.d.ts +1 -1
- package/dist/modes/rpc/rpc-oauth-interaction.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-oauth-interaction.js +1 -1
- package/dist/modes/rpc/rpc-oauth-interaction.js.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.d.ts +4 -5
- package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-provider-auth.js +19 -66
- package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
- package/dist/modes/rpc/rpc-session-binding.js +1 -1
- package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +7 -4
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +5 -7
- package/dist/package-manager-cli.js.map +1 -1
- package/docs/changelog.mdx +1 -1
- package/docs/custom-provider.md +1 -1
- package/docs/models.md +4 -6
- package/docs/providers.md +13 -0
- package/docs/quickstart.md +2 -1
- package/docs/sdk.md +32 -49
- package/docs/tui.md +7 -2
- package/docs/workflows.md +4 -4
- package/examples/sdk/02-custom-model.ts +8 -10
- package/examples/sdk/09-api-keys-and-oauth.ts +17 -23
- package/examples/sdk/12-full-control.ts +9 -11
- package/examples/sdk/README.md +17 -21
- package/npm-shrinkwrap.json +23 -23
- package/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/reference/brand.md +0 -108
- package/dist/builtin/workflows/skills/impeccable/reference/codex.md +0 -105
- package/dist/builtin/workflows/skills/impeccable/reference/interaction-design.md +0 -189
- package/dist/core/model-registry-auth.d.ts +0 -10
- package/dist/core/model-registry-auth.d.ts.map +0 -1
- package/dist/core/model-registry-auth.js +0 -98
- package/dist/core/model-registry-auth.js.map +0 -1
- package/dist/core/model-registry-builtins.d.ts +0 -8
- package/dist/core/model-registry-builtins.d.ts.map +0 -1
- package/dist/core/model-registry-builtins.js +0 -104
- package/dist/core/model-registry-builtins.js.map +0 -1
- package/dist/core/model-registry-custom-loader.d.ts +0 -3
- package/dist/core/model-registry-custom-loader.d.ts.map +0 -1
- package/dist/core/model-registry-custom-loader.js +0 -255
- package/dist/core/model-registry-custom-loader.js.map +0 -1
- package/dist/core/model-registry-dynamic.d.ts +0 -7
- package/dist/core/model-registry-dynamic.d.ts.map +0 -1
- package/dist/core/model-registry-dynamic.js +0 -189
- package/dist/core/model-registry-dynamic.js.map +0 -1
- package/dist/core/model-registry-extension-refresh.d.ts +0 -23
- package/dist/core/model-registry-extension-refresh.d.ts.map +0 -1
- package/dist/core/model-registry-extension-refresh.js +0 -32
- package/dist/core/model-registry-extension-refresh.js.map +0 -1
- package/dist/core/model-registry-loader.d.ts +0 -5
- package/dist/core/model-registry-loader.d.ts.map +0 -1
- package/dist/core/model-registry-loader.js +0 -29
- package/dist/core/model-registry-loader.js.map +0 -1
- package/dist/core/model-registry-schemas.d.ts +0 -1399
- package/dist/core/model-registry-schemas.d.ts.map +0 -1
- package/dist/core/model-registry-schemas.js.map +0 -1
- package/dist/core/model-registry-types.d.ts +0 -91
- package/dist/core/model-registry-types.d.ts.map +0 -1
- package/dist/core/model-registry-types.js +0 -2
- package/dist/core/model-registry-types.js.map +0 -1
- package/dist/core/model-registry-validation.d.ts +0 -7
- package/dist/core/model-registry-validation.d.ts.map +0 -1
- package/dist/core/model-registry-validation.js +0 -12
- package/dist/core/model-registry-validation.js.map +0 -1
- package/dist/core/oauth-compat.d.ts +0 -17
- package/dist/core/oauth-compat.d.ts.map +0 -1
- package/dist/core/oauth-compat.js +0 -2
- package/dist/core/oauth-compat.js.map +0 -1
- package/dist/core/oauth-provider-bridge.d.ts +0 -63
- package/dist/core/oauth-provider-bridge.d.ts.map +0 -1
- package/dist/core/oauth-provider-bridge.js +0 -232
- package/dist/core/oauth-provider-bridge.js.map +0 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CreateAgentSessionOptions } from "@bastani/atomic";
|
|
2
|
+
import type { WorkflowModelCatalogPort, WorkflowModelInfo } from "../shared/types.js";
|
|
3
|
+
import type { PiModelContext } from "./public-types.js";
|
|
4
|
+
|
|
5
|
+
export function workflowModelCatalogFromContext(
|
|
6
|
+
ctx?: PiModelContext,
|
|
7
|
+
): WorkflowModelCatalogPort | undefined {
|
|
8
|
+
if (ctx?.modelRegistry === undefined && ctx?.model === undefined) return undefined;
|
|
9
|
+
return {
|
|
10
|
+
listModels: async (): Promise<readonly WorkflowModelInfo[]> => {
|
|
11
|
+
const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
|
|
12
|
+
return available.map((model) => ({
|
|
13
|
+
provider: String(model.provider),
|
|
14
|
+
id: model.id,
|
|
15
|
+
fullId: `${String(model.provider)}/${model.id}`,
|
|
16
|
+
model: model as NonNullable<CreateAgentSessionOptions["model"]>,
|
|
17
|
+
}));
|
|
18
|
+
},
|
|
19
|
+
...(ctx.model !== undefined
|
|
20
|
+
? {
|
|
21
|
+
currentModel: ctx.model as NonNullable<CreateAgentSessionOptions["model"]>,
|
|
22
|
+
preferredProvider: String(ctx.model.provider),
|
|
23
|
+
}
|
|
24
|
+
: {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const WORKFLOW_TOOL_DESCRIPTION =
|
|
2
2
|
"Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " +
|
|
3
|
-
"when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; " +
|
|
3
|
+
"when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " +
|
|
4
4
|
"discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " +
|
|
5
5
|
"send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " +
|
|
6
6
|
"For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " +
|
|
@@ -44,6 +44,7 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
|
|
|
44
44
|
- For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
|
|
45
45
|
`**Workflow authoring and handoffs**:
|
|
46
46
|
- When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
|
|
47
|
+
- After creating and reloading a newly authored custom workflow, close the loop by stating the folder containing the workflow file just written, for example \`.atomic/workflows/\`, in this shape: \`Custom workflow created. You can inspect its code at: <workflow-folder-path>\`. Do this only for newly created custom workflows, never builtin or pre-existing workflows.
|
|
47
48
|
- When creating or editing a workflow that pins an explicit stage \`model\` or \`fallbackModels\`, consult \`packages/coding-agent/docs/models/model-selection.md\` for role-based recommendations, then call \`workflow({ action: "models" })\` to see the models actually present in the user's configured catalog. Use only the catalog's returned \`fullId\` values as model strings, and append a thinking suffix only when that exact level appears in the entry's \`availableThinkingLevels\`; treat an absent or empty \`availableThinkingLevels\` as no suffix support rather than inferring one. If a guide-recommended model for the role is unavailable, try another guide-recommended model that is present in the catalog. If no recommendation intersects with the catalog, leave the stage unpinned rather than inventing a substitute, and mention the limitation, asking the user only if the workflow requires an explicit model choice. If the catalog is empty, continue with unpinned stages, state that no configured models were returned, and do not fabricate model IDs. Do not inspect or infer credentials, environment variables, auth files, token validity, entitlements, or the reason a model is absent; \`isCurrent\` marks the active selection, not a quality recommendation.
|
|
48
49
|
- Consult docs/workflows.md and its starter patterns (Classify-and-act, Fan-out-and-synthesize, Adversarial verification, Generate-and-filter, Tournament, and Loop until done) when designing a stage graph.
|
|
49
50
|
- Treat workflow composition as a first-class authoring option. Before duplicating stages, inspect reusable workflow modules and builtin exports; import their definitions and invoke them with \`ctx.workflow(...)\`, mapping typed inputs and consuming only declared outputs. Nested workflows can themselves import children, so combine small reusable graphs into a richer parent while respecting \`maxDepth\`.
|
|
@@ -56,4 +57,4 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
|
|
|
56
57
|
- Pass large stage context through files/artifacts and \`reads\` with an explicit \`Read the file at <path>...\` prompt rather than large \`previous\` payloads or injected session history.
|
|
57
58
|
- Separate implementation/review acceptance from explicitly authorized final actions such as PR/MR/review creation, release tagging, deployment, or publication. Stop implementation loops once acceptance is proven and carry a remaining final action separately.
|
|
58
59
|
- A model stage sees its local prompt, artifacts, tools, and reads, not the graph name or surrounding implementation. State the concrete action, evidence, and success criteria directly.`,
|
|
59
|
-
];
|
|
60
|
+
];
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import type { StageControlHandle, AgentSessionEventListener } from "./stage-control-registry.js";
|
|
2
2
|
import type { LiveStageRuntime } from "./executor-stage-types.js";
|
|
3
|
-
import type { StageUserMessageDeliveryAction } from "./stage-runner-types.js";
|
|
3
|
+
import type { StageUserMessageDeliveryAction, StageUserMessagePreparation } from "./stage-runner-types.js";
|
|
4
4
|
import { isTerminalStage } from "./executor-scheduler.js";
|
|
5
5
|
import { StageToolExecutionBuffer } from "./stage-tool-execution-buffer.js";
|
|
6
6
|
|
|
7
7
|
export function createStageControlHandle(runtime: LiveStageRuntime): StageControlHandle {
|
|
8
|
-
const
|
|
8
|
+
const messagePreparation = (): StageUserMessagePreparation => {
|
|
9
9
|
const meta = runtime.innerCtx.__sessionMeta();
|
|
10
|
-
if (meta.sessionId !== undefined || meta.sessionFile !== undefined)
|
|
10
|
+
if (meta.sessionId !== undefined || meta.sessionFile !== undefined) {
|
|
11
|
+
return { beforePreparation: runtime.throwIfStageMutationBlocked };
|
|
12
|
+
}
|
|
11
13
|
if (runtime.stageSnapshot.sessionFile !== undefined) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
return {
|
|
15
|
+
sessionFile: runtime.stageSnapshot.sessionFile,
|
|
16
|
+
beforePreparation: runtime.throwIfStageMutationBlocked,
|
|
17
|
+
};
|
|
15
18
|
}
|
|
16
19
|
if (isTerminalStage(runtime.stageSnapshot)) {
|
|
17
20
|
throw new Error(`atomic-workflows: cannot message stage "${runtime.name}" because no retained session metadata is available.`);
|
|
18
21
|
}
|
|
22
|
+
return { beforePreparation: runtime.throwIfStageMutationBlocked };
|
|
23
|
+
};
|
|
24
|
+
const ensureMessagingSession = async (): Promise<void> => {
|
|
25
|
+
const sessionFile = messagePreparation().sessionFile;
|
|
26
|
+
if (sessionFile === undefined) return;
|
|
27
|
+
await runtime.innerCtx.__ensureSessionFromFile(sessionFile);
|
|
28
|
+
runtime.captureStageSessionMeta();
|
|
19
29
|
};
|
|
20
30
|
const toolExecutions = new StageToolExecutionBuffer();
|
|
21
31
|
const unsubscribeToolExecutions = runtime.innerCtx.subscribe((event) => toolExecutions.record(event));
|
|
@@ -57,8 +67,7 @@ export function createStageControlHandle(runtime: LiveStageRuntime): StageContro
|
|
|
57
67
|
},
|
|
58
68
|
async sendUserMessage(text, options, beforeDelivery) {
|
|
59
69
|
runtime.throwIfStageMutationBlocked();
|
|
60
|
-
|
|
61
|
-
runtime.throwIfStageMutationBlocked();
|
|
70
|
+
const preparation = messagePreparation();
|
|
62
71
|
const admitDelivery = (): void => {
|
|
63
72
|
runtime.throwIfStageMutationBlocked();
|
|
64
73
|
beforeDelivery?.();
|
|
@@ -68,6 +77,7 @@ export function createStageControlHandle(runtime: LiveStageRuntime): StageContro
|
|
|
68
77
|
text,
|
|
69
78
|
options,
|
|
70
79
|
admitDelivery,
|
|
80
|
+
preparation,
|
|
71
81
|
);
|
|
72
82
|
if (action === "steer" || action === "followUp") {
|
|
73
83
|
runtime.state.resumeContinuationPending = "queued-user-message";
|
|
@@ -79,13 +89,14 @@ export function createStageControlHandle(runtime: LiveStageRuntime): StageContro
|
|
|
79
89
|
},
|
|
80
90
|
async prompt(text: string) {
|
|
81
91
|
runtime.throwIfStageMutationBlocked();
|
|
82
|
-
|
|
92
|
+
const preparation = messagePreparation();
|
|
83
93
|
let action: StageUserMessageDeliveryAction | undefined;
|
|
84
94
|
try {
|
|
85
95
|
action = await runtime.innerCtx.__sendUserMessage(
|
|
86
96
|
text,
|
|
87
97
|
undefined,
|
|
88
98
|
runtime.throwIfStageMutationBlocked,
|
|
99
|
+
preparation,
|
|
89
100
|
);
|
|
90
101
|
} finally {
|
|
91
102
|
runtime.captureStageSessionMeta();
|
|
@@ -197,6 +208,9 @@ export function createStageControlHandle(runtime: LiveStageRuntime): StageContro
|
|
|
197
208
|
subscribe(listener: AgentSessionEventListener) {
|
|
198
209
|
return runtime.innerCtx.subscribe(listener);
|
|
199
210
|
},
|
|
211
|
+
subscribeDeliveryActivity(listener) {
|
|
212
|
+
return runtime.innerCtx.__subscribeDeliveryActivity(listener);
|
|
213
|
+
},
|
|
200
214
|
async dispose() {
|
|
201
215
|
unsubscribeToolExecutions();
|
|
202
216
|
toolExecutions.clear();
|
|
@@ -100,6 +100,7 @@ export function createReplayStageContext(input: {
|
|
|
100
100
|
steer: async () => rejectReplayMutation("steer"),
|
|
101
101
|
followUp: async () => rejectReplayMutation("follow up"),
|
|
102
102
|
subscribe: () => () => {},
|
|
103
|
+
__subscribeDeliveryActivity: () => () => {},
|
|
103
104
|
get sessionFile() { return replaySource.sessionFile; },
|
|
104
105
|
get sessionId() { return replaySource.sessionId ?? ""; },
|
|
105
106
|
setModel: async () => rejectReplayMutation("set model"),
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
type StageControlHandle,
|
|
35
35
|
type StageControlRegistry,
|
|
36
36
|
} from "./stage-control-registry.js";
|
|
37
|
+
import type { StageUserMessagePreparation } from "./stage-runner-types.js";
|
|
37
38
|
|
|
38
39
|
/** Why a terminal stage could not be revived as an interactive post-mortem chat. */
|
|
39
40
|
export type PostMortemUnavailableReason =
|
|
@@ -153,10 +154,18 @@ export function createPostMortemStageHandle(
|
|
|
153
154
|
...(defaultSessionDir !== undefined ? { defaultSessionDir } : {}),
|
|
154
155
|
});
|
|
155
156
|
let disposed = false;
|
|
156
|
-
const
|
|
157
|
+
const throwIfClosed = (): void => {
|
|
157
158
|
if (disposed) throw new Error(`Post-mortem stage chat "${stage.name}" is closed.`);
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
};
|
|
160
|
+
const messagePreparation = (): StageUserMessagePreparation => ({
|
|
161
|
+
...(context.__sessionMeta().sessionFile === undefined ? { sessionFile } : {}),
|
|
162
|
+
beforePreparation: throwIfClosed,
|
|
163
|
+
});
|
|
164
|
+
const ensureAttached = async (): Promise<void> => {
|
|
165
|
+
throwIfClosed();
|
|
166
|
+
const sessionFileToRestore = messagePreparation().sessionFile;
|
|
167
|
+
if (sessionFileToRestore !== undefined) {
|
|
168
|
+
await context.__ensureSessionFromFile(sessionFileToRestore);
|
|
160
169
|
}
|
|
161
170
|
};
|
|
162
171
|
return {
|
|
@@ -172,8 +181,13 @@ export function createPostMortemStageHandle(
|
|
|
172
181
|
get agentSession() { return context.__agentSession(); },
|
|
173
182
|
async ensureAttached() { await ensureAttached(); },
|
|
174
183
|
async sendUserMessage(text, options, beforeDelivery) {
|
|
175
|
-
|
|
176
|
-
|
|
184
|
+
throwIfClosed();
|
|
185
|
+
const preparation = messagePreparation();
|
|
186
|
+
const admitDelivery = (): void => {
|
|
187
|
+
throwIfClosed();
|
|
188
|
+
beforeDelivery?.();
|
|
189
|
+
};
|
|
190
|
+
return context.__sendUserMessage(text, options, admitDelivery, preparation);
|
|
177
191
|
},
|
|
178
192
|
async prompt(text: string) {
|
|
179
193
|
await ensureAttached();
|
|
@@ -194,6 +208,7 @@ export function createPostMortemStageHandle(
|
|
|
194
208
|
throw new Error("Post-mortem stage chat cannot pause or resume workflow execution.");
|
|
195
209
|
},
|
|
196
210
|
subscribe(listener: AgentSessionEventListener) { return context.subscribe(listener); },
|
|
211
|
+
subscribeDeliveryActivity(listener) { return context.__subscribeDeliveryActivity(listener); },
|
|
197
212
|
async dispose() {
|
|
198
213
|
if (disposed) return;
|
|
199
214
|
disposed = true;
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import type { AgentSession, AgentSessionEvent } from "@bastani/atomic";
|
|
29
|
+
import type { StageDeliveryActivityEvent } from "./stage-delivery-activity.js";
|
|
29
30
|
import type { StageUserMessageDeliveryAction } from "./stage-runner-types.js";
|
|
30
31
|
|
|
31
32
|
export type StageControlStatus =
|
|
@@ -98,6 +99,15 @@ export interface StageControlHandle {
|
|
|
98
99
|
* before the session exists are buffered and bound on first attach.
|
|
99
100
|
*/
|
|
100
101
|
subscribe(listener: AgentSessionEventListener): () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Subscribe to workflow-owned delivery lifecycle facts. Present only for
|
|
104
|
+
* handles backed by a live stage runner. An accepted idle delivery reports
|
|
105
|
+
* `delivery_start` before the public `agent_start` is published, letting an
|
|
106
|
+
* attached chat show Working for the whole turn.
|
|
107
|
+
*/
|
|
108
|
+
subscribeDeliveryActivity?(
|
|
109
|
+
listener: (event: StageDeliveryActivityEvent) => void,
|
|
110
|
+
): () => void;
|
|
101
111
|
/** Release the underlying SDK session and unregister this direct chat handle. */
|
|
102
112
|
dispose?(): void | Promise<void>;
|
|
103
113
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal stage delivery-activity channel.
|
|
3
|
+
*
|
|
4
|
+
* An accepted *idle* stage delivery starts a real backend turn long before the
|
|
5
|
+
* public `agent_start` clears the session's ordered extension event queue. The
|
|
6
|
+
* attached stage chat therefore had no signal to paint `Working` with, and the
|
|
7
|
+
* pane looked idle while the model was already running.
|
|
8
|
+
*
|
|
9
|
+
* This channel carries only that fact — "an idle delivery was admitted and is
|
|
10
|
+
* now starting a turn" — as a workflow-internal event, so the chat can start
|
|
11
|
+
* its existing Working lifecycle without fabricating SDK lifecycle events or
|
|
12
|
+
* reordering the public event stream.
|
|
13
|
+
*
|
|
14
|
+
* Streaming deliveries (`steer` / `followUp`) never emit here: they join an
|
|
15
|
+
* in-flight turn that already owns the indicator.
|
|
16
|
+
*
|
|
17
|
+
* cross-ref:
|
|
18
|
+
* - src/runs/foreground/stage-runner-send-user-message.ts (emitter)
|
|
19
|
+
* - src/tui/stage-chat-view-delivery-activity.ts (consumer)
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export type StageDeliveryActivityEvent =
|
|
23
|
+
| { readonly type: "delivery_start"; readonly deliveryId: number }
|
|
24
|
+
| { readonly type: "delivery_settled"; readonly deliveryId: number };
|
|
25
|
+
|
|
26
|
+
export type StageDeliveryActivityListener = (event: StageDeliveryActivityEvent) => void;
|
|
27
|
+
|
|
28
|
+
export class StageDeliveryActivity {
|
|
29
|
+
private readonly listeners = new Set<StageDeliveryActivityListener>();
|
|
30
|
+
private readonly active = new Set<number>();
|
|
31
|
+
private nextDeliveryId = 0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Register `listener`, then synchronously replay every currently-active
|
|
35
|
+
* delivery as `delivery_start`.
|
|
36
|
+
*
|
|
37
|
+
* A stage chat can attach after a delivery was admitted — a late `/workflow
|
|
38
|
+
* attach`, or a remount — and would otherwise see nothing until the public
|
|
39
|
+
* `agent_start` finally arrives. Registering before replaying matters:
|
|
40
|
+
* snapshotting first would drop a start or settlement that lands in between.
|
|
41
|
+
*/
|
|
42
|
+
subscribe(listener: StageDeliveryActivityListener): () => void {
|
|
43
|
+
this.listeners.add(listener);
|
|
44
|
+
for (const deliveryId of [...this.active]) {
|
|
45
|
+
if (!this.listeners.has(listener)) break;
|
|
46
|
+
listener({ type: "delivery_start", deliveryId });
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
this.listeners.delete(listener);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Report an admitted idle delivery that is about to start a turn. */
|
|
54
|
+
start(): number {
|
|
55
|
+
const deliveryId = ++this.nextDeliveryId;
|
|
56
|
+
this.active.add(deliveryId);
|
|
57
|
+
this.emit({ type: "delivery_start", deliveryId });
|
|
58
|
+
return deliveryId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Keep one correlated delivery active for the full asynchronous operation. */
|
|
62
|
+
async runWithLease<T>(operation: () => Promise<T>): Promise<T> {
|
|
63
|
+
const deliveryId = this.start();
|
|
64
|
+
try {
|
|
65
|
+
return await operation();
|
|
66
|
+
} finally {
|
|
67
|
+
this.settle(deliveryId);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Report that a delivery finished, failed, or started no turn at all. */
|
|
72
|
+
settle(deliveryId: number | undefined): void {
|
|
73
|
+
if (deliveryId === undefined || !this.active.delete(deliveryId)) return;
|
|
74
|
+
this.emit({ type: "delivery_settled", deliveryId });
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Settle every outstanding delivery, then drop listeners. */
|
|
78
|
+
dispose(): void {
|
|
79
|
+
for (const deliveryId of [...this.active]) this.settle(deliveryId);
|
|
80
|
+
this.listeners.clear();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private emit(event: StageDeliveryActivityEvent): void {
|
|
84
|
+
for (const listener of [...this.listeners]) listener(event);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -110,8 +110,8 @@ export function createStageContext(opts: StageRunnerOpts): InternalStageContext
|
|
|
110
110
|
await controller.sendUserMessage(text, options);
|
|
111
111
|
},
|
|
112
112
|
|
|
113
|
-
async __sendUserMessage(text, options, beforeDelivery) {
|
|
114
|
-
return controller.sendUserMessage(text, options, beforeDelivery);
|
|
113
|
+
async __sendUserMessage(text, options, beforeDelivery, preparation) {
|
|
114
|
+
return controller.sendUserMessage(text, options, beforeDelivery, preparation);
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
async steer(text) {
|
|
@@ -126,6 +126,10 @@ export function createStageContext(opts: StageRunnerOpts): InternalStageContext
|
|
|
126
126
|
return controller.subscribe(listener);
|
|
127
127
|
},
|
|
128
128
|
|
|
129
|
+
__subscribeDeliveryActivity(listener) {
|
|
130
|
+
return controller.subscribeDeliveryActivity(listener);
|
|
131
|
+
},
|
|
132
|
+
|
|
129
133
|
get sessionFile() {
|
|
130
134
|
return controller.currentSession?.sessionFile;
|
|
131
135
|
},
|
|
@@ -9,8 +9,9 @@ import { structuredOutputToolErrorFromEvent } from "./stage-runner-structured-ou
|
|
|
9
9
|
import { buildStageSessionOptions } from "./stage-runner-session-options.js";
|
|
10
10
|
import { sendStageUserMessage } from "./stage-runner-send-user-message.js";
|
|
11
11
|
import { StageMessageAdmission } from "./stage-runner-message-admission.js";
|
|
12
|
+
import { StageDeliveryActivity, type StageDeliveryActivityListener } from "./stage-delivery-activity.js";
|
|
12
13
|
import { nextResumedContextOverflowFallbackIndex, terminatingToolCallId, unresolvedContextOverflowFailure, unresolvedContextOverflowMessage } from "./stage-runner-unresolved-overflow.js";
|
|
13
|
-
import type { AgentSessionConsumer, StageModelFallbackMeta, StageRunnerOpts, StageSessionCreateOptions, StageSessionCreateResult, StageSessionEvent, StageSessionRuntime, WorkflowFastModeSettingsManager } from "./stage-runner-types.js";
|
|
14
|
+
import type { AgentSessionConsumer, StageModelFallbackMeta, StageRunnerOpts, StageSessionCreateOptions, StageSessionCreateResult, StageSessionEvent, StageSessionRuntime, StageUserMessagePreparation, WorkflowFastModeSettingsManager } from "./stage-runner-types.js";
|
|
14
15
|
import { StageSessionReplacement } from "./stage-runner-replacement.js";
|
|
15
16
|
import { StageSessionPause, type StageSessionPauseResumeResult } from "./stage-runner-pause.js";
|
|
16
17
|
|
|
@@ -34,7 +35,7 @@ export class StageSessionController {
|
|
|
34
35
|
private candidatesPromise: Promise<WorkflowResolvedModelCandidate[]> | undefined;
|
|
35
36
|
private activeCandidateIndex: number | undefined;
|
|
36
37
|
private selectedModel: string | undefined;
|
|
37
|
-
private
|
|
38
|
+
private sharedModelRuntime: CreateAgentSessionOptions["modelRuntime"];
|
|
38
39
|
private sharedOrchestrationContext: CreateAgentSessionOptions["orchestrationContext"];
|
|
39
40
|
private resumeCurrentSession = false;
|
|
40
41
|
private readonly modelAttempts: WorkflowModelAttempt[] = [];
|
|
@@ -44,6 +45,7 @@ export class StageSessionController {
|
|
|
44
45
|
private sessionSettingsManager: WorkflowFastModeSettingsManager | undefined;
|
|
45
46
|
private readonly replacement = new StageSessionReplacement();
|
|
46
47
|
private readonly messageAdmission = new StageMessageAdmission();
|
|
48
|
+
private readonly deliveryActivity = new StageDeliveryActivity();
|
|
47
49
|
|
|
48
50
|
constructor(
|
|
49
51
|
private readonly opts: StageRunnerOpts,
|
|
@@ -106,21 +108,25 @@ export class StageSessionController {
|
|
|
106
108
|
return session;
|
|
107
109
|
}
|
|
108
110
|
|
|
109
|
-
async sendUserMessage(content: StageUserMessageContent, options?: StageSendUserMessageOptions,
|
|
110
|
-
Promise<Awaited<ReturnType<typeof sendStageUserMessage>>> {
|
|
111
|
+
async sendUserMessage(content: StageUserMessageContent, options?: StageSendUserMessageOptions,
|
|
112
|
+
beforeDelivery?: () => void, preparation?: StageUserMessagePreparation): Promise<Awaited<ReturnType<typeof sendStageUserMessage>>> {
|
|
111
113
|
return this.messageAdmission.run(async (release) => {
|
|
112
|
-
const pausedDelivery = this.pauseControl.deferRunnerOwnedDelivery(
|
|
113
|
-
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
const pausedDelivery = this.pauseControl.deferRunnerOwnedDelivery(() =>
|
|
115
|
+
this.sendUserMessage(content, options, beforeDelivery, preparation));
|
|
116
|
+
if (pausedDelivery !== undefined) { release(); return pausedDelivery; }
|
|
117
|
+
preparation?.beforePreparation?.();
|
|
118
|
+
const sessionFile = preparation?.sessionFile;
|
|
119
|
+
const deliver = async (activity?: StageDeliveryActivity) => sendStageUserMessage(
|
|
120
|
+
sessionFile === undefined ? await this.ensureSession("prompt")
|
|
121
|
+
: await this.ensureSessionFromFile(sessionFile, "prompt"),
|
|
122
|
+
content, options, beforeDelivery, release, this.messageAdmission, activity,
|
|
121
123
|
);
|
|
124
|
+
if (this.session === undefined || sessionFile !== undefined) return this.deliveryActivity.runWithLease(() => deliver());
|
|
125
|
+
return deliver(this.deliveryActivity);
|
|
122
126
|
});
|
|
123
127
|
}
|
|
128
|
+
/** Internal pre-stream delivery lifecycle consumed by an attached stage chat. */
|
|
129
|
+
subscribeDeliveryActivity(listener: StageDeliveryActivityListener): () => void { return this.deliveryActivity.subscribe(listener); }
|
|
124
130
|
|
|
125
131
|
sealGeneration(): void {
|
|
126
132
|
this.generationSealed = true;
|
|
@@ -201,7 +207,7 @@ export class StageSessionController {
|
|
|
201
207
|
this.pendingListeners.clear();
|
|
202
208
|
this.unsubscribeTerminateWatcher?.();
|
|
203
209
|
this.unsubscribeTerminateWatcher = undefined;
|
|
204
|
-
this.terminatingToolCallIds.clear(); this.messageAdmission.dispose();
|
|
210
|
+
this.terminatingToolCallIds.clear(); this.messageAdmission.dispose(); this.deliveryActivity.dispose();
|
|
205
211
|
await this.replacement.dispose();
|
|
206
212
|
await disposeStageSession(this.session);
|
|
207
213
|
}
|
|
@@ -293,7 +299,7 @@ export class StageSessionController {
|
|
|
293
299
|
candidate,
|
|
294
300
|
restoreSavedModel: resumeOptions?.restoreSavedModel,
|
|
295
301
|
reattachSessionFile: this.reattachSessionFile,
|
|
296
|
-
|
|
302
|
+
sharedModelRuntime: this.sharedModelRuntime,
|
|
297
303
|
});
|
|
298
304
|
const created = this.opts.adapters.agentSession
|
|
299
305
|
? await this.opts.adapters.agentSession.create(
|
|
@@ -319,9 +325,9 @@ export class StageSessionController {
|
|
|
319
325
|
if (this.generationSealed) result.session.sealWorkflowStageGeneration?.();
|
|
320
326
|
this.replacement.adopt(result.session);
|
|
321
327
|
this.session = result.session;
|
|
322
|
-
if (this.
|
|
323
|
-
const withRegistry = result.session as Partial<Pick<AgentSession, "
|
|
324
|
-
if (withRegistry.
|
|
328
|
+
if (this.sharedModelRuntime === undefined) {
|
|
329
|
+
const withRegistry = result.session as Partial<Pick<AgentSession, "modelRuntime">>;
|
|
330
|
+
if (withRegistry.modelRuntime !== undefined) this.sharedModelRuntime = withRegistry.modelRuntime;
|
|
325
331
|
}
|
|
326
332
|
this.sessionSettingsManager = result.settingsManager ?? result.session.settingsManager;
|
|
327
333
|
if (this.pendingThinkingLevel !== undefined) result.session.setThinkingLevel(this.pendingThinkingLevel);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StageSendUserMessageOptions, StageUserMessageContent } from "../../shared/types.js";
|
|
2
|
+
import type { StageDeliveryActivity } from "./stage-delivery-activity.js";
|
|
2
3
|
import type { StageMessageAdmission, StageMessageTurn } from "./stage-runner-message-admission.js";
|
|
3
4
|
import type { StageSessionRuntime, StageUserMessageDeliveryAction } from "./stage-runner-types.js";
|
|
4
5
|
|
|
@@ -59,6 +60,7 @@ export async function sendStageUserMessage(
|
|
|
59
60
|
beforeDelivery?: () => void,
|
|
60
61
|
promptStarted?: () => void,
|
|
61
62
|
admission?: StageMessageAdmission,
|
|
63
|
+
activity?: StageDeliveryActivity,
|
|
62
64
|
): Promise<StageUserMessageDeliveryAction> {
|
|
63
65
|
const streaming = activeSession.isStreaming || admission?.isOwned(activeSession) === true;
|
|
64
66
|
const deliverAs = streaming ? options?.deliverAs ?? "followUp" : options?.deliverAs;
|
|
@@ -71,6 +73,9 @@ export async function sendStageUserMessage(
|
|
|
71
73
|
? createLocalPromptOwnershipObserver(activeSession, promptStarted)
|
|
72
74
|
: coordinatedPromptOwnershipObserver(admission.startTurn(activeSession, promptStarted ?? (() => {})));
|
|
73
75
|
ownership?.arm();
|
|
76
|
+
// An admitted idle delivery owns the visible Working period from here until
|
|
77
|
+
// it settles; a streaming delivery joins a turn that already owns it.
|
|
78
|
+
const deliveryId = streaming ? undefined : activity?.start();
|
|
74
79
|
try {
|
|
75
80
|
const delivery = activeSession.sendUserMessage(content, {
|
|
76
81
|
...(deliverAs === undefined ? {} : { deliverAs }),
|
|
@@ -89,6 +94,7 @@ export async function sendStageUserMessage(
|
|
|
89
94
|
throw error;
|
|
90
95
|
} finally {
|
|
91
96
|
ownership?.dispose();
|
|
97
|
+
activity?.settle(deliveryId);
|
|
92
98
|
}
|
|
93
99
|
}
|
|
94
100
|
if (typeof content !== "string") throw unsupportedContentError();
|
|
@@ -102,6 +108,7 @@ export async function sendStageUserMessage(
|
|
|
102
108
|
? createLocalPromptOwnershipObserver(activeSession, promptStarted)
|
|
103
109
|
: coordinatedPromptOwnershipObserver(admission.startTurn(activeSession, promptStarted ?? (() => {})));
|
|
104
110
|
ownership.arm();
|
|
111
|
+
const deliveryId = activity?.start();
|
|
105
112
|
try {
|
|
106
113
|
const turn = activeSession.prompt(content);
|
|
107
114
|
ownership.observeStreaming();
|
|
@@ -113,5 +120,6 @@ export async function sendStageUserMessage(
|
|
|
113
120
|
throw error;
|
|
114
121
|
} finally {
|
|
115
122
|
ownership.dispose();
|
|
123
|
+
activity?.settle(deliveryId);
|
|
116
124
|
}
|
|
117
125
|
}
|
|
@@ -10,7 +10,7 @@ interface StageSessionOptionsInput {
|
|
|
10
10
|
readonly candidate: WorkflowResolvedModelCandidate | undefined;
|
|
11
11
|
readonly restoreSavedModel?: boolean;
|
|
12
12
|
readonly reattachSessionFile: string | undefined;
|
|
13
|
-
readonly
|
|
13
|
+
readonly sharedModelRuntime: CreateAgentSessionOptions["modelRuntime"];
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export function buildStageSessionOptions(input: StageSessionOptionsInput): StageOptions | undefined {
|
|
@@ -31,8 +31,8 @@ export function buildStageSessionOptions(input: StageSessionOptionsInput): Stage
|
|
|
31
31
|
options.context = undefined;
|
|
32
32
|
options.forkFromSessionFile = undefined;
|
|
33
33
|
}
|
|
34
|
-
if (input.
|
|
35
|
-
options.
|
|
34
|
+
if (input.sharedModelRuntime !== undefined && options.modelRuntime === undefined) {
|
|
35
|
+
options.modelRuntime = input.sharedModelRuntime;
|
|
36
36
|
}
|
|
37
37
|
return Object.keys(options).length === 0 ? undefined : options;
|
|
38
38
|
}
|
|
@@ -35,11 +35,11 @@ export async function disposeStageSession(current: StageSessionRuntime | undefin
|
|
|
35
35
|
|
|
36
36
|
export function asAgentSession(activeSession: StageSessionRuntime | undefined): AgentSession | undefined {
|
|
37
37
|
if (!activeSession) return undefined;
|
|
38
|
-
const candidate = activeSession as StageSessionRuntime & Partial<Pick<AgentSession, "state" | "sessionManager" | "
|
|
38
|
+
const candidate = activeSession as StageSessionRuntime & Partial<Pick<AgentSession, "state" | "sessionManager" | "modelRuntime" | "getContextUsage">>;
|
|
39
39
|
if (
|
|
40
40
|
candidate.state !== undefined &&
|
|
41
41
|
candidate.sessionManager !== undefined &&
|
|
42
|
-
candidate.
|
|
42
|
+
candidate.modelRuntime !== undefined &&
|
|
43
43
|
typeof candidate.getContextUsage === "function"
|
|
44
44
|
) {
|
|
45
45
|
return candidate as AgentSession;
|
|
@@ -29,6 +29,12 @@ export type WorkflowFastModeSettingsManager = {
|
|
|
29
29
|
|
|
30
30
|
export type StageUserMessageDeliveryAction = "prompt" | "steer" | "followUp" | "handled";
|
|
31
31
|
|
|
32
|
+
/** Internal session preparation and side-effect-free eligibility boundary. */
|
|
33
|
+
export interface StageUserMessagePreparation {
|
|
34
|
+
readonly sessionFile?: string;
|
|
35
|
+
readonly beforePreparation?: () => void;
|
|
36
|
+
}
|
|
37
|
+
|
|
32
38
|
export interface StageUserMessageDeliveryHooks {
|
|
33
39
|
readonly beforeDelivery?: () => void;
|
|
34
40
|
/** Releases serialized admission once an idle prompt synchronously owns the turn. */
|
|
@@ -152,7 +158,17 @@ export interface InternalStageContext extends StageContext {
|
|
|
152
158
|
content: StageUserMessageContent,
|
|
153
159
|
options?: StageSendUserMessageOptions,
|
|
154
160
|
beforeDelivery?: () => void,
|
|
161
|
+
preparation?: StageUserMessagePreparation,
|
|
155
162
|
): Promise<StageUserMessageDeliveryAction>;
|
|
163
|
+
/**
|
|
164
|
+
* Internal: subscribe to workflow-owned delivery lifecycle facts for this
|
|
165
|
+
* stage. An accepted idle delivery reports `delivery_start` before the public
|
|
166
|
+
* `agent_start` reaches subscribers, so an attached chat can paint Working
|
|
167
|
+
* for the whole turn rather than only after the SDK event queue drains.
|
|
168
|
+
*/
|
|
169
|
+
__subscribeDeliveryActivity(
|
|
170
|
+
listener: (event: import("./stage-delivery-activity.js").StageDeliveryActivityEvent) => void,
|
|
171
|
+
): () => void;
|
|
156
172
|
/** Internal: synchronously reject new detached traffic without waiting for active work. */
|
|
157
173
|
__sealGeneration(): void;
|
|
158
174
|
/** Internal: atomically stop detached traffic admission and drain admitted work. */
|