@code-yeongyu/senpi 2026.9.3 → 2026.9.4-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 +141 -0
- package/README.md +5 -4
- package/dist/cli/startup-ui.d.ts.map +1 -1
- package/dist/cli/startup-ui.js +2 -1
- package/dist/cli/startup-ui.js.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +56 -30
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +16 -7
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/dynamic-prompt/style.js +1 -1
- package/dist/core/dynamic-prompt/style.js.map +1 -1
- package/dist/core/dynamic-prompt/working-task.js +1 -1
- package/dist/core/dynamic-prompt/working-task.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js +3 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +9 -7
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +4 -9
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js +15 -18
- package/dist/core/extensions/builtin/claude-sdk-oauth/auth-lane.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts +3 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js +80 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/content-blocks.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts +18 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js +57 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/errors.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js +13 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/oauth-login.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js +2 -23
- package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts +2 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +30 -24
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js +15 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-continuity.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts +6 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js +19 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-pump.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js +31 -13
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry-wiring.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-registry.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js +8 -14
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-sync.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js +23 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js +4 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-guidance.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream-protocol.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js +13 -6
- package/dist/core/extensions/builtin/claude-sdk-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts +11 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js +12 -3
- package/dist/core/extensions/builtin/claude-sdk-oauth/tools.js.map +1 -1
- package/dist/core/extensions/builtin/eval-only-routing.d.ts +10 -0
- package/dist/core/extensions/builtin/eval-only-routing.d.ts.map +1 -0
- package/dist/core/extensions/builtin/eval-only-routing.js +16 -0
- package/dist/core/extensions/builtin/eval-only-routing.js.map +1 -0
- package/dist/core/extensions/builtin/goal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/prompt.js +1 -3
- package/dist/core/extensions/builtin/goal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js +1 -1
- package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-account.d.ts +3 -0
- package/dist/core/extensions/builtin/gpt-account.d.ts.map +1 -0
- package/dist/core/extensions/builtin/gpt-account.js +115 -0
- package/dist/core/extensions/builtin/gpt-account.js.map +1 -0
- package/dist/core/extensions/builtin/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/index.js +2 -0
- package/dist/core/extensions/builtin/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/index.js +20 -1
- package/dist/core/extensions/builtin/loop/index.js.map +1 -1
- package/dist/core/extensions/builtin/loop/tools.d.ts +6 -1
- package/dist/core/extensions/builtin/loop/tools.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/tools.js +8 -1
- package/dist/core/extensions/builtin/loop/tools.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js +1 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js +1 -11
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js +2 -2
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-7.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js +3 -3
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-4-8.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js +56 -43
- package/dist/core/extensions/builtin/prompt-preset/claude-opus-5.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts +4 -15
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js +12 -21
- package/dist/core/extensions/builtin/prompt-preset/execution-tooling.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-2.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js +2 -11
- package/dist/core/extensions/builtin/prompt-preset/glm-5-3.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts +4 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js +16 -0
- package/dist/core/extensions/builtin/prompt-preset/glm-5.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts +1 -5
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js +1 -6
- package/dist/core/extensions/builtin/prompt-preset/gpt-5.6.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +123 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +202 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.js +1 -2
- package/dist/core/extensions/builtin/prompt-preset/gpt-eval-routing.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js +60 -76
- package/dist/core/extensions/builtin/prompt-preset/kimi-k3.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +17 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +5 -2
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts +13 -2
- package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.js +18 -7
- package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -2
- package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/todotools/prompt.js +3 -6
- package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts +34 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.d.ts.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js +121 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse-paragraphs.js.map +1 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts +2 -0
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.js +6 -2
- package/dist/core/extensions/builtin/ttsr/detectors/collapse.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +44 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +26 -3
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/manual-continue.d.ts +13 -0
- package/dist/core/manual-continue.d.ts.map +1 -0
- package/dist/core/manual-continue.js +19 -0
- package/dist/core/manual-continue.js.map +1 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +8 -2
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/provider-composer.d.ts.map +1 -1
- package/dist/core/provider-composer.js +13 -2
- package/dist/core/provider-composer.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +28 -4
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +5 -5
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +34 -6
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +19 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/terminal-settings.d.ts +3 -0
- package/dist/core/terminal-settings.d.ts.map +1 -1
- package/dist/core/terminal-settings.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -1
- 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 -2
- 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 +2 -2
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +2 -2
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +2 -2
- 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 +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +3 -3
- package/dist/core/tools/write.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +5 -11
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +21 -8
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +2 -2
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/components/trust-selector.js.map +1 -1
- package/dist/modes/interactive/grok/welcome-card.d.ts.map +1 -1
- package/dist/modes/interactive/grok/welcome-card.js +5 -2
- package/dist/modes/interactive/grok/welcome-card.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +74 -14
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/version-label.d.ts +7 -0
- package/dist/modes/interactive/version-label.d.ts.map +1 -0
- package/dist/modes/interactive/version-label.js +9 -0
- package/dist/modes/interactive/version-label.js.map +1 -0
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +9 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +2 -0
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +71 -12
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +5 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +5 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/login-prompts.d.ts +24 -0
- package/dist/modes/rpc/login-prompts.d.ts.map +1 -0
- package/dist/modes/rpc/login-prompts.js +44 -0
- package/dist/modes/rpc/login-prompts.js.map +1 -0
- package/dist/modes/rpc/media-placeholders.d.ts +49 -0
- package/dist/modes/rpc/media-placeholders.d.ts.map +1 -0
- package/dist/modes/rpc/media-placeholders.js +151 -0
- package/dist/modes/rpc/media-placeholders.js.map +1 -0
- package/dist/modes/rpc/multi-session-host.js +3 -0
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +8 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +11 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +23 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +1 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +2 -1
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-fanout.d.ts +13 -2
- package/dist/modes/rpc/session-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-fanout.js +36 -12
- package/dist/modes/rpc/session-event-fanout.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +3 -1
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +23 -13
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts +8 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.js +32 -9
- package/dist/modes/rpc/socket-event-fanout.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js +3 -4
- package/dist/utils/version-check.js.map +1 -1
- package/docs/compaction.md +2 -0
- package/docs/environment-variables.md +5 -0
- package/docs/extensions.md +22 -2
- package/docs/keybindings.md +1 -1
- package/docs/models.md +3 -0
- package/docs/quickstart.md +1 -1
- package/docs/rpc.md +105 -1
- package/docs/settings.md +17 -32
- package/docs/terminal-setup.md +27 -0
- package/docs/usage.md +5 -3
- package/docs/windows.md +1 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.d.ts +18 -1
- package/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +155 -106
- package/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +144 -83
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +21 -32
- package/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +25 -36
- package/node_modules/@anthropic-ai/claude-agent-sdk/package.json +2 -2
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +93 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +473 -31
- package/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +140 -93
- package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +96 -0
- package/node_modules/@anthropic-ai/sdk/README.md +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.js +5 -7
- package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +5 -7
- package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.js +4 -4
- package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +4 -4
- package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts +45 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts +45 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js +58 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs +54 -0
- package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.js +3 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.mjs +3 -1
- package/node_modules/@anthropic-ai/sdk/internal/errors.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js +23 -25
- package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +5 -6
- package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts +9 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts +9 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.js +22 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs +19 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.mts +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.js +24 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.mjs +14 -0
- package/node_modules/@anthropic-ai/sdk/internal/node.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/internal/parse.js +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.js +10 -6
- package/node_modules/@anthropic-ai/sdk/internal/uploads.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs +10 -6
- package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.js +7 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs +6 -0
- package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +6 -4
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +4 -2
- package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +3 -4
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +1 -2
- package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +2 -3
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +2 -3
- package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js +30 -7
- package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +30 -7
- package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +3 -2
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +3 -46
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +3 -46
- package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts +131 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts +131 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js +45 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs +41 -0
- package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +35 -6
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +35 -6
- package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/package.json +4 -11
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +13 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +13 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +28 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +28 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +8 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +8 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +25 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +25 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +6 -6
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +7 -7
- package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +5 -4
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +11 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +12 -9
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +8 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +8 -5
- package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +198 -29
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +198 -29
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts +177 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts +177 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js +56 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs +52 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts +74 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts +74 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js +52 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs +48 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts +272 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts +272 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js +119 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs +115 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts +14 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js +21 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs +16 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts +353 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts +353 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js +169 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs +165 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts +468 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts +468 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js +198 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs +193 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js +114 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs +110 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts +11 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js +25 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs +12 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts +162 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts +162 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js +76 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs +72 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts +73 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts +73 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js +62 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs +57 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts +77 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts +77 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js +31 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs +27 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js +9 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs +4 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts +258 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts +258 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js +174 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs +169 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts +141 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts +141 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js +125 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs +121 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts +124 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js +67 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs +63 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts +5 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js +13 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts +135 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts +135 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js +102 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs +98 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts +83 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts +83 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js +34 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs +30 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts +210 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts +210 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js +189 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs +185 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts +303 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts +303 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js +112 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs +107 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts +2 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js +6 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs +3 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs.map +1 -0
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +10 -10
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +2 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +2 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +2 -2
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +48 -120
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +48 -120
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +12 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +12 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +35 -138
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +35 -138
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +18 -18
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +18 -18
- package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +21 -25
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +21 -25
- package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +16 -17
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +16 -17
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +21 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +21 -8
- package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1 -3
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1 -3
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +5 -7
- package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +4 -3
- package/node_modules/@anthropic-ai/sdk/src/helpers/beta/standard-schema.ts +99 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/errors.ts +3 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +11 -10
- package/node_modules/@anthropic-ai/sdk/src/internal/node.browser.ts +22 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/node.ts +14 -0
- package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/internal/uploads.ts +10 -7
- package/node_modules/@anthropic-ai/sdk/src/internal/utils/values.ts +7 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +5 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +1 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +2 -3
- package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +33 -9
- package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +7 -49
- package/node_modules/@anthropic-ai/sdk/src/lib/standard-schema.ts +209 -0
- package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +38 -6
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +1 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +45 -15
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +6 -6
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +3 -2
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +42 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +8 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +34 -11
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +13 -7
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +12 -9
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +8 -5
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +5 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +221 -38
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/api-keys.ts +231 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/compliance-settings.ts +96 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/external-keys.ts +365 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/federation.ts +71 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/index.ts +31 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/issuers.ts +486 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/index.ts +23 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/rules.ts +624 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/workspaces.ts +196 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/index.ts +92 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/invites.ts +207 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/organization.ts +269 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/rate-limits.ts +104 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/index.ts +21 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/service-accounts.ts +389 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/workspaces.ts +217 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/users.ts +163 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/index.ts +43 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/members.ts +209 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/rate-limits.ts +113 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/service-accounts.ts +325 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/workspaces.ts +450 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization.ts +3 -0
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +10 -10
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +2 -1
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +7 -10
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +60 -150
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +43 -166
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +24 -27
- package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +25 -29
- package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2 -8
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +6 -5
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +5 -3
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +1 -5
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +122 -17
- package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +10 -43
- package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +13 -15
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +3 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +6 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +5 -3
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +1 -2
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +1 -2
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +0 -4
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +0 -3
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +11 -9
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +11 -9
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +96 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +96 -7
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +0 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +0 -8
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +20 -46
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -1
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +9 -33
- package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
- package/node_modules/@anthropic-ai/sdk/version.js +1 -1
- package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +57 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +29 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +20 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.d.ts +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-shell-capture.js +126 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +33 -91
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +7 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +8 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +15 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +10 -5
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +58 -64
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +16 -6
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +6 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +40 -10
- package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +130 -15
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js +40 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/context-room.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +16 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts +1 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +2 -16
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +16 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +40 -6
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat/extension-oauth-types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +14 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts +23 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js +58 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +53 -12
- package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +3 -3
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/README.md +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +36 -3
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +106 -6
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +6 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +17 -4
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +11 -0
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +57 -15
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +22 -7
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +17 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","s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,CAAC,0BAA0B,CAAC,MAAM,CAAC,CAAC;gBAC5D,MAAM,OAAO,EAAE,CAAC;gBAChB,aAAa,EAAE,CAAC;gBAChB,IAAI,SAAS,CAAC,MAAM,KAAK,OAAO,EAAE,CAAC;oBAClC,GAAG,EAAE,EAAE,CAAC,MAAM,CACb,SAAS,CAAC,SAAS,KAAK,qBAAqB;wBAC5C,CAAC,CAAC,mDAAmD;wBACrD,CAAC,CAAC,mDAAmD,EACtD,MAAM,CACN,CAAC;gBACH,CAAC;gBACD,OAAO;YACR,CAAC;YAED,IAAI,OAAO,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;gBACpC,gFAAgF;gBAChF,MAAM,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAClC,CAAC;iBAAM,IAAI,OAAO,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;gBACxC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,eAAe,OAAO,CAAC,SAAS,GAAG,EAAE,MAAM,CAAC,CAAC;YAC7D,CAAC;YACD,aAAa,EAAE,CAAC;QACjB,CAAC;IACF,CAAC,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,SAAS,mBAAmB,CAAC,KAA4B;IACxD,OAAO,KAAK,CAAC,2BAA2B,IAAI,KAAK,CAAC,qBAAqB,KAAK,IAAI,CAAC;AAClF,CAAC;AAED,eAAe,mBAAmB,EAAE,CAAC","sourcesContent":["/**\n * `/loop` extension factory and lifecycle wiring.\n *\n * This module owns the only impure parts of the feature: real timers, the session store,\n * the extension event wiring, and message dispatch. Every decision it makes is delegated\n * to the pure modules beside it (`scheduler.ts`, `tick-prompt.ts`, `cron-planner.ts`,\n * `loopfile.ts`, `status.ts`), so the runtime here is a thin, testable adapter.\n *\n * Load-bearing rules implemented here:\n * - A tick NEVER steers. Idle dispatch goes through `sendUserMessage(..., {\n * expandPromptTemplates: true })` so a slash payload reaches the real command path;\n * a busy session receives the tick as a follow-up instead.\n * - Shutdown SUSPENDS: timers are cancelled, the ticker disposed, and the snapshot is\n * persisted without a terminal reason (every senpi shutdown reason is resumable).\n * - Keepalive is applied only to an attributed dynamic iteration, never after an ordinary\n * user turn, and never after a user abort (an abort PAUSES the loop instead).\n * - A store failure is not swallowed: the affected loops end with `error` and the user is\n * told, because a schedule that cannot be persisted must not keep running.\n */\n\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../../../../config.ts\";\nimport type { SessionEntry } from \"../../../session-manager.ts\";\nimport { noticeEntryRenderer } from \"../../notice/index.ts\";\nimport type { EntryRenderer, ExtensionAPI, ExtensionContext, ExtensionFactory } from \"../../types.ts\";\nimport { registerLoopCommand } from \"./command-registration.ts\";\nimport { describeCron, normalizeInterval } from \"./cron-planner.ts\";\nimport { type LoopFileResult, nodeFs, resolveLoopFile as resolveLoopFileDefault } from \"./loopfile.ts\";\nimport {\n\tcreateLoopScheduler,\n\ttype LoopClock,\n\ttype LoopIdFactory,\n\ttype LoopScheduler,\n\ttype LoopTick,\n\ttype LoopTimerPort,\n} from \"./scheduler.ts\";\nimport { formatLoopStatus, formatNoopFold, LoopStatusTicker } from \"./status.ts\";\nimport { readLoopState, writeLoopState } from \"./store.ts\";\nimport { buildTickMessage, type LoopFileSnapshot, type LoopMode, type TickDelivery } from \"./tick-prompt.ts\";\nimport { registerLoopTools, type ScheduleWakeupTarget } from \"./tools.ts\";\nimport type {\n\tCronEntry,\n\tDeliveryId,\n\tEpochMs,\n\tLoopEndReason,\n\tLoopId,\n\tLoopPayload,\n\tLoopSentinel,\n\tLoopState,\n\tLoopStoreRef,\n\tRequestedInterval,\n\tSentinelDeliveryState,\n} from \"./types.ts\";\n\n/** Custom entry type carrying one dispatched tick, used for attribution and folding. */\nexport const LOOP_TICK_ENTRY_TYPE = \"loop-tick\";\n\nexport interface LoopTickEntryData {\n\treadonly loopId: LoopId;\n\treadonly deliveryId: DeliveryId;\n\treadonly scheduledForAt: EpochMs;\n\treadonly mode: LoopMode;\n\treadonly delivery: TickDelivery;\n\treadonly sentinel?: LoopSentinel;\n\t/** Consecutive quiet dynamic iterations at the moment this tick was dispatched. */\n\treadonly noopStreak: number;\n\t/** True when this tick continues a quiet streak and should render folded. */\n\treadonly folded: boolean;\n}\n\nexport interface LoopCreateOk {\n\treadonly ok: true;\n\treadonly loopId: LoopId;\n\t/** Present when a new dynamic loop replaced a previous one. */\n\treadonly supersededLoopId?: LoopId;\n\t/** Human-readable rounding notice when the requested cadence was normalized. */\n\treadonly roundingNotice?: string;\n\treadonly cronExpression?: string;\n\treadonly effectiveCadence?: string;\n\treadonly expiresAt?: EpochMs;\n}\n\nexport interface LoopCreateRejected {\n\treadonly ok: false;\n\treadonly message: string;\n}\n\nexport type LoopCreateOutcome = LoopCreateOk | LoopCreateRejected;\n\nexport interface LoopStoreFailure {\n\treadonly endReason: LoopEndReason;\n\treadonly message: string;\n\treadonly loopIds: readonly LoopId[];\n}\n\nexport interface StartFixedRequest {\n\treadonly originalArgs: string;\n\treadonly prompt: string;\n\treadonly requestedInterval: RequestedInterval;\n}\n\nexport interface StartDynamicRequest {\n\treadonly originalArgs: string;\n\treadonly prompt: string;\n}\n\nexport interface StartBareRequest {\n\treadonly originalArgs: string;\n\treadonly interval?: RequestedInterval;\n}\n\nexport interface ControllerScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\n/**\n * Runtime surface of a live loop extension. The `/loop` command module drives the\n * extension exclusively through this interface, so command parsing never reaches into\n * scheduler or store internals.\n */\nexport interface LoopController {\n\tstartFixed(request: StartFixedRequest): Promise<LoopCreateOutcome>;\n\tstartDynamic(request: StartDynamicRequest): Promise<LoopCreateOutcome>;\n\tstartBare(request: StartBareRequest): Promise<LoopCreateOutcome>;\n\t/** Runs the due decision for a loop at the current clock reading and dispatches it. */\n\tfireDue(loopId: LoopId): Promise<void>;\n\tscheduleWakeup(request: ControllerScheduleWakeupRequest): Promise<void>;\n\tstop(target: LoopId | \"all\", detail: string): Promise<readonly LoopId[]>;\n\tpause(target: LoopId | \"all\"): Promise<readonly LoopId[]>;\n\tresume(target: LoopId | \"all\"): Promise<readonly LoopId[]>;\n\tgetState(): LoopState;\n\tstatusLine(): string | undefined;\n\t/** Set when a store read/write failed and the affected loops were ended with `error`. */\n\tlastStoreFailure(): LoopStoreFailure | undefined;\n\t/** True when this loop was retired because its state could not be read or written. */\n\tisEndedWithError(loopId: LoopId): boolean;\n}\n\nexport interface LoopExtensionDeps {\n\treadonly clock?: LoopClock;\n\t/** Factory so each session gets its own timer port; defaults to real timeouts. */\n\treadonly timers?: () => LoopTimerPort;\n\treadonly ids?: LoopIdFactory;\n\treadonly storeRef?: (ctx: ExtensionContext) => LoopStoreRef;\n\treadonly resolveLoopFile?: (options: { cwd: string; homeDir: string }) => Promise<LoopFileResult>;\n\treadonly readState?: (ref: LoopStoreRef) => Promise<LoopState | null>;\n\treadonly writeState?: (ref: LoopStoreRef, state: LoopState) => Promise<void>;\n\t/**\n\t * Published at factory time so a command module (or a test) can drive this instance.\n\t * The controller is bound to the extension's own session state, so it stays valid across\n\t * session starts within one extension generation.\n\t */\n\treadonly onControllerReady?: (controller: LoopController) => void;\n}\n\nexport const renderLoopTickEntry: EntryRenderer<LoopTickEntryData> = noticeEntryRenderer((entry) => {\n\tconst data = entry.data;\n\tif (data === undefined) return undefined;\n\tconst folded = data.folded ? formatNoopFold(data.noopStreak) : \"\";\n\tif (folded.length > 0) {\n\t\treturn {\n\t\t\ttitle: folded,\n\t\t\twhy: \"Consecutive loop ticks reported no actionable change.\",\n\t\t};\n\t}\n\treturn {\n\t\ttitle: `↻ loop tick (${data.mode}) · ${data.delivery}`,\n\t\twhy: \"A /loop schedule dispatched this tick.\",\n\t};\n});\n\n/**\n * Real timer port: exactly one live timeout per key, replaced on re-arm.\n *\n * Follows the generation-counter discipline of `cache-keepalive/index.ts`: cancelling or\n * re-arming a key bumps its generation, so a callback whose generation is stale returns\n * without firing even if it was already scheduled on the event loop.\n */\nexport function createNodeTimerPort(): LoopTimerPort {\n\tconst handles = new Map<string, ReturnType<typeof setTimeout>>();\n\tconst generations = new Map<string, number>();\n\n\tfunction cancel(key: string): void {\n\t\tconst handle = handles.get(key);\n\t\tif (handle !== undefined) clearTimeout(handle);\n\t\thandles.delete(key);\n\t\tgenerations.set(key, (generations.get(key) ?? 0) + 1);\n\t}\n\n\treturn {\n\t\tarm(key, dueAt, callback) {\n\t\t\tcancel(key);\n\t\t\tconst generation = generations.get(key) ?? 0;\n\t\t\tconst delayMs = Math.max(0, dueAt - Date.now());\n\t\t\tconst handle = setTimeout(() => {\n\t\t\t\thandles.delete(key);\n\t\t\t\tif (generations.get(key) !== generation) return;\n\t\t\t\tcallback();\n\t\t\t}, delayMs);\n\t\t\thandle.unref?.();\n\t\t\thandles.set(key, handle);\n\t\t},\n\t\tcancel,\n\t\tcancelAll() {\n\t\t\tfor (const key of [...handles.keys()]) cancel(key);\n\t\t},\n\t};\n}\n\nfunction defaultIds(): LoopIdFactory {\n\tlet sequence = 0;\n\tconst mint = (prefix: string): string => {\n\t\tsequence += 1;\n\t\treturn `${prefix}-${Date.now().toString(36)}-${sequence.toString(36)}`;\n\t};\n\treturn {\n\t\tloopId: () => mint(\"loop\"),\n\t\twakeupId: () => mint(\"wakeup\"),\n\t\tdeliveryId: () => mint(\"delivery\"),\n\t};\n}\n\nfunction defaultStoreRef(ctx: ExtensionContext): LoopStoreRef {\n\tconst sessionFile = ctx.sessionManager.getSessionFile();\n\tconst baseDir =\n\t\tsessionFile === undefined\n\t\t\t? join(getAgentDir(), \"extensions\", \"loop\", \"no-session\")\n\t\t\t: join(ctx.sessionManager.getSessionDir(), \"extensions\", \"loop\");\n\treturn { baseDir, sessionId: ctx.sessionManager.getSessionId() };\n}\n\nfunction emptyDeliveryState(): SentinelDeliveryState {\n\treturn { autonomousPreambleDelivered: false, lastLoopFileDelivered: null, forceFullDelivery: false };\n}\n\nfunction loopFileSnapshot(result: LoopFileResult): LoopFileSnapshot {\n\tif (!result.found) return { present: false };\n\treturn {\n\t\tpresent: true,\n\t\tpath: result.path,\n\t\tcontent: result.content,\n\t\tmtimeMs: result.fingerprint.mtimeMs,\n\t\tsize: result.fingerprint.size,\n\t\tcontentHash: result.fingerprint.contentHash,\n\t};\n}\n\nfunction sentinelFor(mode: LoopMode, loopFilePresent: boolean): LoopSentinel {\n\tif (loopFilePresent) return mode === \"fixed\" ? \"<<loop.md>>\" : \"<<loop.md-dynamic>>\";\n\treturn mode === \"fixed\" ? \"<<autonomous-loop>>\" : \"<<autonomous-loop-dynamic>>\";\n}\n\nfunction modeOf(entry: CronEntry): LoopMode {\n\treturn entry.kind === \"fixed\" ? \"fixed\" : \"dynamic\";\n}\n\ninterface AnchorPayload {\n\treadonly loopId?: string;\n\treadonly deliveryId?: string;\n}\n\n/** Reads the tick payload of a `loop-tick` entry, whichever entry kind carries it. */\nfunction anchorPayloadOf(entry: SessionEntry): AnchorPayload | undefined {\n\tif (entry.type === \"custom\") {\n\t\treturn entry.customType === LOOP_TICK_ENTRY_TYPE ? (entry.data as AnchorPayload | undefined) : undefined;\n\t}\n\tif (entry.type === \"custom_message\") {\n\t\treturn entry.customType === LOOP_TICK_ENTRY_TYPE ? (entry.details as AnchorPayload | undefined) : undefined;\n\t}\n\treturn undefined;\n}\n\n/**\n * True when the compaction-aware context still contains the delivery that anchored a full\n * sentinel block. Compaction can drop it, and a reminder's \"established earlier in this\n * conversation\" phrasing must never dangle, so a missing anchor forces the next tick back\n * to full. When no specific anchor id was recorded (the autonomous preamble carries none),\n * any surviving tick delivery for that loop counts as the anchor.\n */\nfunction anchorPresent(ctx: ExtensionContext, loopId: LoopId, deliveryId: DeliveryId | undefined): boolean {\n\treturn ctx.sessionManager.buildContextEntries().some((entry) => {\n\t\tconst payload = anchorPayloadOf(entry);\n\t\tif (payload === undefined) return false;\n\t\tif (payload.loopId !== undefined && payload.loopId !== loopId) return false;\n\t\treturn deliveryId === undefined ? true : payload.deliveryId === deliveryId;\n\t});\n}\n\nexport function createLoopExtension(deps: LoopExtensionDeps = {}): ExtensionFactory {\n\tconst clock: LoopClock = deps.clock ?? { now: () => Date.now() };\n\tconst makeTimers = deps.timers ?? createNodeTimerPort;\n\tconst ids = deps.ids ?? defaultIds();\n\tconst storeRefOf = deps.storeRef ?? defaultStoreRef;\n\tconst resolveLoopFile =\n\t\tdeps.resolveLoopFile ??\n\t\t((options: { cwd: string; homeDir: string }) =>\n\t\t\tresolveLoopFileDefault({ cwd: options.cwd, homeDir: options.homeDir, fs: nodeFs, path: { join } }));\n\tconst readState = deps.readState ?? readLoopState;\n\tconst writeState = deps.writeState ?? writeLoopState;\n\n\treturn (pi: ExtensionAPI) => {\n\t\tlet ctx: ExtensionContext | undefined;\n\t\tlet scheduler: LoopScheduler | undefined;\n\t\tlet storeRef: LoopStoreRef | undefined;\n\t\tlet timers: LoopTimerPort = makeTimers();\n\t\tlet storeFailure: LoopStoreFailure | undefined;\n\t\tlet sessionNamed = false;\n\t\t/** Loop the currently running iteration is attributed to, for keepalive + tools. */\n\t\tlet attributedLoopId: LoopId | undefined;\n\t\t/** Delivery id of the tick that started the attributed iteration. */\n\t\tlet attributedDeliveryId: DeliveryId | undefined;\n\t\t/** True once the attributed iteration rescheduled or stopped itself. */\n\t\tlet attributionResolved = false;\n\t\t/** Ticks held back because their slash payload cannot be queued while streaming. */\n\t\tconst deferredDispatches: LoopTick[] = [];\n\t\tconst deliveryStates = new Map<LoopId, SentinelDeliveryState>();\n\t\t/** Loops retired with `error` because their state could not be read or written. */\n\t\tconst endedWithError = new Set<LoopId>();\n\t\t/** True once this session has state worth persisting (loaded or created). */\n\t\tlet storeTouched = false;\n\t\tlet persistTail: Promise<void> = Promise.resolve();\n\n\t\tconst ticker = new LoopStatusTicker({\n\t\t\trender: (key, text) => {\n\t\t\t\ttry {\n\t\t\t\t\tctx?.ui.setStatus(key, text);\n\t\t\t\t} catch {\n\t\t\t\t\t// A stale context after session replacement must not break the loop runtime.\n\t\t\t\t}\n\t\t\t},\n\t\t\tnow: () => clock.now(),\n\t\t});\n\n\t\tpi.registerEntryRenderer(LOOP_TICK_ENTRY_TYPE, renderLoopTickEntry);\n\t\tregisterLoopTools(pi, {\n\t\t\tscheduler: {\n\t\t\t\tgetWakeupTarget: (): ScheduleWakeupTarget => {\n\t\t\t\t\tif (scheduler === undefined || attributedLoopId === undefined) return null;\n\t\t\t\t\tconst entry = scheduler.getState().entries[attributedLoopId];\n\t\t\t\t\tif (entry === undefined || entry.phase === \"ended\") return null;\n\t\t\t\t\treturn { kind: entry.kind, loopId: entry.id };\n\t\t\t\t},\n\t\t\t\tscheduleWakeup: async (request) => {\n\t\t\t\t\tconst active = requireScheduler();\n\t\t\t\t\tconst result = active.onScheduleWakeup(request);\n\t\t\t\t\tif (!result.ok) throw new Error(`schedule_wakeup rejected: ${result.reason}`);\n\t\t\t\t\tattributionResolved = true;\n\t\t\t\t\tawait persist();\n\t\t\t\t\trefreshStatus();\n\t\t\t\t\treturn {\n\t\t\t\t\t\twakeupId: result.wakeupId,\n\t\t\t\t\t\t...(result.replacedWakeupId === undefined ? {} : { replacedWakeupId: result.replacedWakeupId }),\n\t\t\t\t\t\tdueAt: result.dueAt,\n\t\t\t\t\t\tnoopStreak: result.noopStreak,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\tstopDynamicLoop: async (request) => {\n\t\t\t\t\tconst active = requireScheduler();\n\t\t\t\t\tactive.stop(request.loopId, \"model-stop\");\n\t\t\t\t\tattributionResolved = true;\n\t\t\t\t\tawait persist();\n\t\t\t\t\trefreshStatus();\n\t\t\t\t\treturn { endedAt: clock.now() };\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tfunction requireScheduler(): LoopScheduler {\n\t\t\tif (scheduler === undefined) throw new Error(\"loop extension has no active session\");\n\t\t\treturn scheduler;\n\t\t}\n\n\t\t/** Merges extension-owned sentinel delivery state into the scheduler's snapshot. */\n\t\tfunction withDeliveryOverlay(state: LoopState): LoopState {\n\t\t\tconst entries: Record<LoopId, CronEntry> = {};\n\t\t\tfor (const [id, entry] of Object.entries(state.entries)) {\n\t\t\t\tconst delivery = deliveryStates.get(id);\n\t\t\t\tentries[id] = delivery === undefined ? entry : { ...entry, sentinelDelivery: delivery };\n\t\t\t}\n\t\t\treturn { ...state, entries };\n\t\t}\n\n\t\t/** Serializes persistence so a timer, tool, and command write cannot interleave. */\n\t\tfunction persist(): Promise<void> {\n\t\t\tconst ref = storeRef;\n\t\t\tconst active = scheduler;\n\t\t\tif (ref === undefined || active === undefined) return Promise.resolve();\n\t\t\tconst snapshot = withDeliveryOverlay(active.getState());\n\t\t\t// The extension is registered for every session, so a session that never ran a loop\n\t\t\t// must not leave a sidecar behind.\n\t\t\tif (!storeTouched && Object.keys(snapshot.entries).length === 0) return Promise.resolve();\n\t\t\tstoreTouched = true;\n\t\t\tpersistTail = persistTail.then(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait writeState(ref, snapshot);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailStore(error, Object.keys(snapshot.entries));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn persistTail;\n\t\t}\n\n\t\t/**\n\t\t * A schedule that cannot be read or written must not keep running: end the affected\n\t\t * loops with `error` and tell the user, rather than silently losing the schedule. The\n\t\t * terminal record is kept in memory because the store that would hold it is exactly the\n\t\t * thing that just failed; what matters is that nothing stays armed and the user knows.\n\t\t */\n\t\tfunction failStore(error: unknown, loopIds: readonly LoopId[]): void {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\ttimers.cancelAll();\n\t\t\tfor (const loopId of loopIds) endedWithError.add(loopId);\n\t\t\tstoreFailure = {\n\t\t\t\tendReason: \"error\",\n\t\t\t\tmessage,\n\t\t\t\tloopIds,\n\t\t\t};\n\t\t\tticker.dispose();\n\t\t\tctx?.ui.notify(`/loop state could not be used and the affected loops were ended: ${message}`, \"error\");\n\t\t}\n\n\t\tfunction refreshStatus(): void {\n\t\t\tif (scheduler === undefined) return;\n\t\t\tconst state = scheduler.getState();\n\t\t\t// The ticker owns a repeating render timer, so it only runs while a loop is armed;\n\t\t\t// a session that never used /loop must not carry one.\n\t\t\tif (Object.values(state.entries).every((entry) => entry.phase === \"ended\")) {\n\t\t\t\tif (ticker.running) ticker.dispose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tticker.sync(state);\n\t\t}\n\n\t\tfunction deliveryStateOf(loopId: LoopId): SentinelDeliveryState {\n\t\t\treturn deliveryStates.get(loopId) ?? emptyDeliveryState();\n\t\t}\n\n\t\tfunction markForceFullDelivery(): void {\n\t\t\tfor (const [id, state] of deliveryStates) {\n\t\t\t\tdeliveryStates.set(id, { ...state, forceFullDelivery: true });\n\t\t\t}\n\t\t\tconst active = scheduler;\n\t\t\tif (active === undefined) return;\n\t\t\tfor (const entry of Object.values(active.getState().entries)) {\n\t\t\t\tif (entry.phase === \"ended\") continue;\n\t\t\t\tif (deliveryStates.has(entry.id)) continue;\n\t\t\t\tdeliveryStates.set(entry.id, { ...entry.sentinelDelivery, forceFullDelivery: true });\n\t\t\t}\n\t\t}\n\n\t\tfunction isExtensionCommandPayload(text: string): boolean {\n\t\t\tif (!text.startsWith(\"/\")) return false;\n\t\t\tconst name = text.slice(1).split(/\\s+/)[0];\n\t\t\treturn pi.getCommands().some((command) => command.name === name);\n\t\t}\n\n\t\t/**\n\t\t * Delivers one tick. Idle dispatch expands prompt templates so a slash payload\n\t\t * reaches its real command handler; a busy session gets a follow-up instead of\n\t\t * steering. A slash payload cannot be queued at all, so it waits for the turn to\n\t\t * settle rather than being rewritten into plain text.\n\t\t */\n\t\tasync function dispatchTick(tick: LoopTick): Promise<void> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst entry = active.getState().entries[tick.loopId];\n\t\t\tif (entry === undefined || entry.phase === \"ended\") return;\n\t\t\tif (endedWithError.has(tick.loopId)) return;\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (currentCtx === undefined) return;\n\n\t\t\tconst mode = modeOf(entry);\n\t\t\tconst loopFile =\n\t\t\t\tentry.payload.type === \"sentinel\" ? await resolveLoopFileSafely(currentCtx) : { found: false as const };\n\t\t\tconst built = buildTickMessage({\n\t\t\t\tloopId: entry.id,\n\t\t\t\tdeliveryId: tick.deliveryId,\n\t\t\t\tmode,\n\t\t\t\tpayload: entry.payload,\n\t\t\t\treentryPrompt: entry.reentryPrompt,\n\t\t\t\tdeliveryState: deliveryStateOf(entry.id),\n\t\t\t\tloopFile: loopFileSnapshot(loopFile),\n\t\t\t});\n\t\t\tdeliveryStates.set(entry.id, built.deliveryState);\n\n\t\t\tconst busy = !currentCtx.isIdle() || currentCtx.hasPendingMessages();\n\t\t\tif (busy && isExtensionCommandPayload(built.text)) {\n\t\t\t\t// Extension commands cannot be queued; hold this delivery until the turn settles.\n\t\t\t\tdeferredDispatches.push(tick);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst noopStreak = entry.noopStreak;\n\t\t\tpi.appendEntry<LoopTickEntryData>(LOOP_TICK_ENTRY_TYPE, {\n\t\t\t\tloopId: entry.id,\n\t\t\t\tdeliveryId: tick.deliveryId,\n\t\t\t\tscheduledForAt: tick.scheduledForAt,\n\t\t\t\tmode,\n\t\t\t\tdelivery: built.delivery,\n\t\t\t\t...(built.details.sentinel === undefined ? {} : { sentinel: built.details.sentinel }),\n\t\t\t\tnoopStreak,\n\t\t\t\tfolded: noopStreak >= 2,\n\t\t\t});\n\n\t\t\tattributedLoopId = entry.id;\n\t\t\tattributedDeliveryId = tick.deliveryId;\n\t\t\tattributionResolved = false;\n\t\t\tpi.sendUserMessage(built.text, {\n\t\t\t\texpandPromptTemplates: true,\n\t\t\t\t...(busy ? { deliverAs: \"followUp\" as const } : {}),\n\t\t\t});\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t}\n\n\t\tasync function resolveLoopFileSafely(currentCtx: ExtensionContext): Promise<LoopFileResult> {\n\t\t\ttry {\n\t\t\t\treturn await resolveLoopFile({ cwd: currentCtx.cwd, homeDir: homedir() });\n\t\t\t} catch {\n\t\t\t\t// A loop file that cannot be read is treated as absent for this tick; the loop\n\t\t\t\t// stays alive and picks the file up again once it is readable.\n\t\t\t\treturn { found: false };\n\t\t\t}\n\t\t}\n\n\t\tasync function drainDeferred(): Promise<void> {\n\t\t\tif (deferredDispatches.length === 0) return;\n\t\t\tconst pending = deferredDispatches.splice(0, deferredDispatches.length);\n\t\t\tfor (const tick of pending) await dispatchTick(tick);\n\t\t}\n\n\t\tasync function fireDue(loopId: LoopId): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (active === undefined || currentCtx === undefined) return;\n\t\t\tconst busy = !currentCtx.isIdle() || currentCtx.hasPendingMessages();\n\t\t\tconst decision = active.onDue(loopId, clock.now(), busy);\n\t\t\tawait persist();\n\t\t\tif (decision.action === \"dispatch\") {\n\t\t\t\tawait dispatchTick(decision.tick);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (decision.action === \"expire\") {\n\t\t\t\tctx?.ui.notify(\"Loop expired after 7 days and is no longer armed.\", \"info\");\n\t\t\t}\n\t\t\trefreshStatus();\n\t\t}\n\n\t\t/**\n\t\t * Timer callbacks are synchronous, so the async due step is scheduled and its failure is\n\t\t * contained: a rejected dispatch must never take down the timer that owns the loop.\n\t\t */\n\t\tfunction handleTimerFire(loopId: LoopId): void {\n\t\t\tvoid fireDue(loopId).catch((error) => {\n\t\t\t\tctx?.ui.notify(`Loop tick failed: ${error instanceof Error ? error.message : String(error)}`, \"error\");\n\t\t\t});\n\t\t}\n\n\t\tfunction payloadForPrompt(prompt: string): LoopPayload {\n\t\t\treturn { type: \"prompt\", prompt };\n\t\t}\n\n\t\tasync function startFixed(request: StartFixedRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst effective = normalizeInterval(request.requestedInterval);\n\t\t\tconst created = active.createFixed({\n\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\treentryPrompt: `/loop ${request.originalArgs}`.trimEnd(),\n\t\t\t\tpayload: payloadForPrompt(request.prompt),\n\t\t\t\trequestedInterval: request.requestedInterval,\n\t\t\t\teffectiveInterval: effective,\n\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\tintervalMs: effective.intervalMs,\n\t\t\t});\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(request.prompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\t...(effective.roundingNotice === undefined ? {} : { roundingNotice: effective.roundingNotice }),\n\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\teffectiveCadence: effective.human,\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tasync function startDynamic(request: StartDynamicRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst created = active.createDynamic({\n\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\treentryPrompt: `/loop ${request.originalArgs}`.trimEnd(),\n\t\t\t\tpayload: payloadForPrompt(request.prompt),\n\t\t\t});\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(request.prompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\t...(created.supersededLoopId === undefined ? {} : { supersededLoopId: created.supersededLoopId }),\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tasync function startBare(request: StartBareRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (currentCtx === undefined) return { ok: false, message: \"loop extension has no active session\" };\n\t\t\tconst loopFile = await resolveLoopFileSafely(currentCtx);\n\t\t\tconst mode: LoopMode = request.interval === undefined ? \"dynamic\" : \"fixed\";\n\t\t\tconst payload: LoopPayload = { type: \"sentinel\", sentinel: sentinelFor(mode, loopFile.found) };\n\t\t\tconst reentryPrompt = request.originalArgs.trim() === \"\" ? \"/loop\" : `/loop ${request.originalArgs.trim()}`;\n\n\t\t\tconst created =\n\t\t\t\trequest.interval === undefined\n\t\t\t\t\t? active.createDynamic({ originalArgs: request.originalArgs, reentryPrompt, payload })\n\t\t\t\t\t: (() => {\n\t\t\t\t\t\t\tconst effective = normalizeInterval(request.interval);\n\t\t\t\t\t\t\treturn active.createFixed({\n\t\t\t\t\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\t\t\t\t\treentryPrompt,\n\t\t\t\t\t\t\t\tpayload,\n\t\t\t\t\t\t\t\trequestedInterval: request.interval,\n\t\t\t\t\t\t\t\teffectiveInterval: effective,\n\t\t\t\t\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\t\t\t\t\tintervalMs: effective.intervalMs,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})();\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(reentryPrompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tfunction nameSessionAfterLoop(prompt: string): void {\n\t\t\tif (sessionNamed) return;\n\t\t\tsessionNamed = true;\n\t\t\tif (pi.getSessionName() !== undefined) return;\n\t\t\tpi.setSessionName(`loop: ${prompt}`.trim());\n\t\t}\n\n\t\tconst controller: LoopController = {\n\t\t\tstartFixed,\n\t\t\tstartDynamic,\n\t\t\tstartBare,\n\t\t\tfireDue,\n\t\t\tscheduleWakeup: async (request) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.onScheduleWakeup(request);\n\t\t\t\tif (result.ok) attributionResolved = true;\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t},\n\t\t\tstop: async (target, detail) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.stop(target, detail);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tpause: async (target) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.pause(target);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tresume: async (target) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.resume(target);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tgetState: () => requireScheduler().getState(),\n\t\t\tstatusLine: () => formatLoopStatus(requireScheduler().getState(), clock.now()),\n\t\t\tlastStoreFailure: () => storeFailure,\n\t\t\tisEndedWithError: (loopId) => endedWithError.has(loopId),\n\t\t};\n\n\t\tdeps.onControllerReady?.(controller);\n\t\tregisterLoopCommand(pi, { controller });\n\n\t\tpi.on(\"session_start\", async (_event, nextCtx) => {\n\t\t\tctx = nextCtx;\n\t\t\ttimers.cancelAll();\n\t\t\ttimers = makeTimers();\n\t\t\tstoreFailure = undefined;\n\t\t\tendedWithError.clear();\n\t\t\tstoreTouched = false;\n\t\t\tsessionNamed = false;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tdeferredDispatches.length = 0;\n\t\t\tdeliveryStates.clear();\n\t\t\tstoreRef = storeRefOf(nextCtx);\n\n\t\t\tlet initialState: LoopState | undefined;\n\t\t\ttry {\n\t\t\t\tinitialState = (await readState(storeRef)) ?? undefined;\n\t\t\t} catch (error) {\n\t\t\t\t// Fail closed: arm nothing, end nothing silently, and tell the user.\n\t\t\t\tfailStore(error, []);\n\t\t\t\tscheduler = createLoopScheduler({\n\t\t\t\t\tsessionId: nextCtx.sessionManager.getSessionId(),\n\t\t\t\t\tclock,\n\t\t\t\t\ttimers,\n\t\t\t\t\tids,\n\t\t\t\t\tonFire: handleTimerFire,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tscheduler = createLoopScheduler({\n\t\t\t\tsessionId: nextCtx.sessionManager.getSessionId(),\n\t\t\t\tclock,\n\t\t\t\ttimers,\n\t\t\t\tids,\n\t\t\t\tonFire: handleTimerFire,\n\t\t\t\t...(initialState === undefined ? {} : { initialState }),\n\t\t\t});\n\t\t\tstoreTouched = initialState !== undefined;\n\n\t\t\tfor (const entry of Object.values(scheduler.getState().entries)) {\n\t\t\t\tconst anchorDeliveryId = entry.sentinelDelivery.lastLoopFileDelivered?.anchorDeliveryId;\n\t\t\t\tconst anchored = anchorPresent(nextCtx, entry.id, anchorDeliveryId);\n\t\t\t\tconst needsFull = !anchored && hasAnchoredDelivery(entry.sentinelDelivery);\n\t\t\t\tdeliveryStates.set(entry.id, {\n\t\t\t\t\t...entry.sentinelDelivery,\n\t\t\t\t\tforceFullDelivery: entry.sentinelDelivery.forceFullDelivery || needsFull,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst restored = scheduler.restore(clock.now());\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t\tfor (const tick of restored.recoveryTicks) await dispatchTick(tick);\n\t\t\tif (restored.expiredLoopIds.length > 0) {\n\t\t\t\tnextCtx.ui.notify(`Loop expired after 7 days: ${restored.expiredLoopIds.join(\", \")}`, \"info\");\n\t\t\t}\n\t\t});\n\n\t\tpi.on(\"session_compact\", async (event) => {\n\t\t\t// Accepted compaction may have dropped the anchor the reminders point at, so the\n\t\t\t// next sentinel tick must carry the full instructions again. Timers and phase are\n\t\t\t// deliberately untouched.\n\t\t\tif (event.accepted !== true) return;\n\t\t\tmarkForceFullDelivery();\n\t\t\tawait persist();\n\t\t});\n\n\t\tpi.on(\"input\", async (event) => {\n\t\t\t// A user turn is never an attributed loop iteration, so keepalive must not see it.\n\t\t\t// A tick dispatched by this extension arrives with source \"extension\" and MUST keep\n\t\t\t// its attribution, or no dynamic iteration would ever be judged.\n\t\t\tif (event.source === \"extension\") return;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t});\n\n\t\tpi.on(\"agent_end\", async (event) => {\n\t\t\t// A retrying turn is still in progress: neither settle it nor judge its liveness.\n\t\t\tif (event.willRetry === true) return;\n\t\t\tif (event.aborted === true && event.abortSource === \"user\") {\n\t\t\t\tawait pauseAttributedLoop();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait settleAttributedTick(event.aborted === true ? \"error\" : \"completed\");\n\t\t});\n\n\t\tpi.on(\"agent_settled\", async () => {\n\t\t\tawait settleAttributedTick(\"completed\");\n\t\t\tawait drainDeferred();\n\t\t\trefreshStatus();\n\t\t});\n\n\t\tpi.on(\"session_abort\", async () => {\n\t\t\tawait pauseAttributedLoop();\n\t\t});\n\n\t\tpi.on(\"session_shutdown\", async () => {\n\t\t\tconst active = scheduler;\n\t\t\tif (active !== undefined) {\n\t\t\t\t// Shutdown SUSPENDS: every senpi shutdown reason leaves the session resumable,\n\t\t\t\t// so the snapshot must carry no terminal reason.\n\t\t\t\tactive.onShutdown();\n\t\t\t\tawait persist();\n\t\t\t}\n\t\t\ttimers.cancelAll();\n\t\t\tdeferredDispatches.length = 0;\n\t\t\tticker.dispose();\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tctx = undefined;\n\t\t});\n\n\t\tasync function pauseAttributedLoop(): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tif (active === undefined) return;\n\t\t\tconst targets =\n\t\t\t\tattributedLoopId === undefined\n\t\t\t\t\t? Object.values(active.getState().entries)\n\t\t\t\t\t\t\t.filter((entry) => entry.phase !== \"ended\")\n\t\t\t\t\t\t\t.map((entry) => entry.id)\n\t\t\t\t\t: [attributedLoopId];\n\t\t\tconst paused: LoopId[] = [];\n\t\t\tfor (const loopId of targets) {\n\t\t\t\tif (active.onUserAbort(loopId).action === \"paused\") paused.push(loopId);\n\t\t\t}\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tif (paused.length === 0) return;\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t\tctx?.ui.notify(\"loop paused - /loop resume or /loop stop\", \"info\");\n\t\t}\n\n\t\t/**\n\t\t * Settles the tick this turn was attributed to, drains a coalesced occurrence, and\n\t\t * applies the two-strike keepalive to a dynamic iteration that ended without calling\n\t\t * `schedule_wakeup`. An ordinary user turn clears the attribution first, so keepalive\n\t\t * can never be charged to it, and a user abort takes the pause path instead.\n\t\t */\n\t\tasync function settleAttributedTick(outcome: \"completed\" | \"error\"): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tconst loopId = attributedLoopId;\n\t\t\tconst deliveryId = attributedDeliveryId;\n\t\t\tif (active === undefined || loopId === undefined) return;\n\t\t\tconst entry = active.getState().entries[loopId];\n\t\t\tif (entry === undefined) return;\n\t\t\tconst resolved = attributionResolved;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\n\t\t\tconst settled = deliveryId === undefined ? undefined : active.onTickSettled({ loopId, deliveryId, outcome });\n\t\t\tawait persist();\n\n\t\t\tif (!resolved && entry.kind === \"dynamic\") {\n\t\t\t\tconst keepalive = active.onTurnEndedWithoutSchedule(loopId);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\tif (keepalive.action === \"ended\") {\n\t\t\t\t\tctx?.ui.notify(\n\t\t\t\t\t\tkeepalive.endReason === \"keepalive_exhausted\"\n\t\t\t\t\t\t\t? \"Loop ended: the model stopped scheduling wakeups.\"\n\t\t\t\t\t\t\t: \"Loop expired after 7 days and is no longer armed.\",\n\t\t\t\t\t\t\"info\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (settled?.action === \"dispatch\") {\n\t\t\t\t// Exactly one delivery drains a coalesced occurrence, however many were missed.\n\t\t\t\tawait dispatchTick(settled.tick);\n\t\t\t} else if (settled?.action === \"ended\") {\n\t\t\t\tctx?.ui.notify(`Loop ended: ${settled.endReason}.`, \"info\");\n\t\t\t}\n\t\t\trefreshStatus();\n\t\t}\n\t};\n}\n\n/** True when a reminder would refer back to a full delivery that must still exist. */\nfunction hasAnchoredDelivery(state: SentinelDeliveryState): boolean {\n\treturn state.autonomousPreambleDelivered || state.lastLoopFileDelivered !== null;\n}\n\nexport default createLoopExtension();\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAuB,MAAM,EAAE,eAAe,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AC","sourcesContent":["/**\n * `/loop` extension factory and lifecycle wiring.\n *\n * This module owns the only impure parts of the feature: real timers, the session store,\n * the extension event wiring, and message dispatch. Every decision it makes is delegated\n * to the pure modules beside it (`scheduler.ts`, `tick-prompt.ts`, `cron-planner.ts`,\n * `loopfile.ts`, `status.ts`), so the runtime here is a thin, testable adapter.\n *\n * Load-bearing rules implemented here:\n * - A tick NEVER steers. Idle dispatch goes through `sendUserMessage(..., {\n * expandPromptTemplates: true })` so a slash payload reaches the real command path;\n * a busy session receives the tick as a follow-up instead.\n * - Shutdown SUSPENDS: timers are cancelled, the ticker disposed, and the snapshot is\n * persisted without a terminal reason (every senpi shutdown reason is resumable).\n * - Keepalive is applied only to an attributed dynamic iteration, never after an ordinary\n * user turn, and never after a user abort (an abort PAUSES the loop instead).\n * - A store failure is not swallowed: the affected loops end with `error` and the user is\n * told, because a schedule that cannot be persisted must not keep running.\n */\n\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { getAgentDir } from \"../../../../config.ts\";\nimport type { SessionEntry } from \"../../../session-manager.ts\";\nimport { noticeEntryRenderer } from \"../../notice/index.ts\";\nimport type { EntryRenderer, ExtensionAPI, ExtensionContext, ExtensionFactory } from \"../../types.ts\";\nimport { registerLoopCommand } from \"./command-registration.ts\";\nimport { describeCron, normalizeInterval } from \"./cron-planner.ts\";\nimport { type LoopFileResult, nodeFs, resolveLoopFile as resolveLoopFileDefault } from \"./loopfile.ts\";\nimport {\n\tcreateLoopScheduler,\n\ttype LoopClock,\n\ttype LoopIdFactory,\n\ttype LoopScheduler,\n\ttype LoopTick,\n\ttype LoopTimerPort,\n} from \"./scheduler.ts\";\nimport { formatLoopStatus, formatNoopFold, LoopStatusTicker } from \"./status.ts\";\nimport { readLoopState, writeLoopState } from \"./store.ts\";\nimport { buildTickMessage, type LoopFileSnapshot, type LoopMode, type TickDelivery } from \"./tick-prompt.ts\";\nimport { registerLoopTools, SCHEDULE_WAKEUP_TOOL, type ScheduleWakeupTarget } from \"./tools.ts\";\nimport type {\n\tCronEntry,\n\tDeliveryId,\n\tEpochMs,\n\tLoopEndReason,\n\tLoopId,\n\tLoopPayload,\n\tLoopSentinel,\n\tLoopState,\n\tLoopStoreRef,\n\tRequestedInterval,\n\tSentinelDeliveryState,\n} from \"./types.ts\";\n\n/** Custom entry type carrying one dispatched tick, used for attribution and folding. */\nexport const LOOP_TICK_ENTRY_TYPE = \"loop-tick\";\n\nexport interface LoopTickEntryData {\n\treadonly loopId: LoopId;\n\treadonly deliveryId: DeliveryId;\n\treadonly scheduledForAt: EpochMs;\n\treadonly mode: LoopMode;\n\treadonly delivery: TickDelivery;\n\treadonly sentinel?: LoopSentinel;\n\t/** Consecutive quiet dynamic iterations at the moment this tick was dispatched. */\n\treadonly noopStreak: number;\n\t/** True when this tick continues a quiet streak and should render folded. */\n\treadonly folded: boolean;\n}\n\nexport interface LoopCreateOk {\n\treadonly ok: true;\n\treadonly loopId: LoopId;\n\t/** Present when a new dynamic loop replaced a previous one. */\n\treadonly supersededLoopId?: LoopId;\n\t/** Human-readable rounding notice when the requested cadence was normalized. */\n\treadonly roundingNotice?: string;\n\treadonly cronExpression?: string;\n\treadonly effectiveCadence?: string;\n\treadonly expiresAt?: EpochMs;\n}\n\nexport interface LoopCreateRejected {\n\treadonly ok: false;\n\treadonly message: string;\n}\n\nexport type LoopCreateOutcome = LoopCreateOk | LoopCreateRejected;\n\nexport interface LoopStoreFailure {\n\treadonly endReason: LoopEndReason;\n\treadonly message: string;\n\treadonly loopIds: readonly LoopId[];\n}\n\nexport interface StartFixedRequest {\n\treadonly originalArgs: string;\n\treadonly prompt: string;\n\treadonly requestedInterval: RequestedInterval;\n}\n\nexport interface StartDynamicRequest {\n\treadonly originalArgs: string;\n\treadonly prompt: string;\n}\n\nexport interface StartBareRequest {\n\treadonly originalArgs: string;\n\treadonly interval?: RequestedInterval;\n}\n\nexport interface ControllerScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\n/**\n * Runtime surface of a live loop extension. The `/loop` command module drives the\n * extension exclusively through this interface, so command parsing never reaches into\n * scheduler or store internals.\n */\nexport interface LoopController {\n\tstartFixed(request: StartFixedRequest): Promise<LoopCreateOutcome>;\n\tstartDynamic(request: StartDynamicRequest): Promise<LoopCreateOutcome>;\n\tstartBare(request: StartBareRequest): Promise<LoopCreateOutcome>;\n\t/** Runs the due decision for a loop at the current clock reading and dispatches it. */\n\tfireDue(loopId: LoopId): Promise<void>;\n\tscheduleWakeup(request: ControllerScheduleWakeupRequest): Promise<void>;\n\tstop(target: LoopId | \"all\", detail: string): Promise<readonly LoopId[]>;\n\tpause(target: LoopId | \"all\"): Promise<readonly LoopId[]>;\n\tresume(target: LoopId | \"all\"): Promise<readonly LoopId[]>;\n\tgetState(): LoopState;\n\tstatusLine(): string | undefined;\n\t/** Set when a store read/write failed and the affected loops were ended with `error`. */\n\tlastStoreFailure(): LoopStoreFailure | undefined;\n\t/** True when this loop was retired because its state could not be read or written. */\n\tisEndedWithError(loopId: LoopId): boolean;\n}\n\nexport interface LoopExtensionDeps {\n\treadonly clock?: LoopClock;\n\t/** Factory so each session gets its own timer port; defaults to real timeouts. */\n\treadonly timers?: () => LoopTimerPort;\n\treadonly ids?: LoopIdFactory;\n\treadonly storeRef?: (ctx: ExtensionContext) => LoopStoreRef;\n\treadonly resolveLoopFile?: (options: { cwd: string; homeDir: string }) => Promise<LoopFileResult>;\n\treadonly readState?: (ref: LoopStoreRef) => Promise<LoopState | null>;\n\treadonly writeState?: (ref: LoopStoreRef, state: LoopState) => Promise<void>;\n\t/**\n\t * Published at factory time so a command module (or a test) can drive this instance.\n\t * The controller is bound to the extension's own session state, so it stays valid across\n\t * session starts within one extension generation.\n\t */\n\treadonly onControllerReady?: (controller: LoopController) => void;\n}\n\nexport const renderLoopTickEntry: EntryRenderer<LoopTickEntryData> = noticeEntryRenderer((entry) => {\n\tconst data = entry.data;\n\tif (data === undefined) return undefined;\n\tconst folded = data.folded ? formatNoopFold(data.noopStreak) : \"\";\n\tif (folded.length > 0) {\n\t\treturn {\n\t\t\ttitle: folded,\n\t\t\twhy: \"Consecutive loop ticks reported no actionable change.\",\n\t\t};\n\t}\n\treturn {\n\t\ttitle: `↻ loop tick (${data.mode}) · ${data.delivery}`,\n\t\twhy: \"A /loop schedule dispatched this tick.\",\n\t};\n});\n\n/**\n * Real timer port: exactly one live timeout per key, replaced on re-arm.\n *\n * Follows the generation-counter discipline of `cache-keepalive/index.ts`: cancelling or\n * re-arming a key bumps its generation, so a callback whose generation is stale returns\n * without firing even if it was already scheduled on the event loop.\n */\nexport function createNodeTimerPort(): LoopTimerPort {\n\tconst handles = new Map<string, ReturnType<typeof setTimeout>>();\n\tconst generations = new Map<string, number>();\n\n\tfunction cancel(key: string): void {\n\t\tconst handle = handles.get(key);\n\t\tif (handle !== undefined) clearTimeout(handle);\n\t\thandles.delete(key);\n\t\tgenerations.set(key, (generations.get(key) ?? 0) + 1);\n\t}\n\n\treturn {\n\t\tarm(key, dueAt, callback) {\n\t\t\tcancel(key);\n\t\t\tconst generation = generations.get(key) ?? 0;\n\t\t\tconst delayMs = Math.max(0, dueAt - Date.now());\n\t\t\tconst handle = setTimeout(() => {\n\t\t\t\thandles.delete(key);\n\t\t\t\tif (generations.get(key) !== generation) return;\n\t\t\t\tcallback();\n\t\t\t}, delayMs);\n\t\t\thandle.unref?.();\n\t\t\thandles.set(key, handle);\n\t\t},\n\t\tcancel,\n\t\tcancelAll() {\n\t\t\tfor (const key of [...handles.keys()]) cancel(key);\n\t\t},\n\t};\n}\n\nfunction defaultIds(): LoopIdFactory {\n\tlet sequence = 0;\n\tconst mint = (prefix: string): string => {\n\t\tsequence += 1;\n\t\treturn `${prefix}-${Date.now().toString(36)}-${sequence.toString(36)}`;\n\t};\n\treturn {\n\t\tloopId: () => mint(\"loop\"),\n\t\twakeupId: () => mint(\"wakeup\"),\n\t\tdeliveryId: () => mint(\"delivery\"),\n\t};\n}\n\nfunction defaultStoreRef(ctx: ExtensionContext): LoopStoreRef {\n\tconst sessionFile = ctx.sessionManager.getSessionFile();\n\tconst baseDir =\n\t\tsessionFile === undefined\n\t\t\t? join(getAgentDir(), \"extensions\", \"loop\", \"no-session\")\n\t\t\t: join(ctx.sessionManager.getSessionDir(), \"extensions\", \"loop\");\n\treturn { baseDir, sessionId: ctx.sessionManager.getSessionId() };\n}\n\nfunction emptyDeliveryState(): SentinelDeliveryState {\n\treturn { autonomousPreambleDelivered: false, lastLoopFileDelivered: null, forceFullDelivery: false };\n}\n\nfunction loopFileSnapshot(result: LoopFileResult): LoopFileSnapshot {\n\tif (!result.found) return { present: false };\n\treturn {\n\t\tpresent: true,\n\t\tpath: result.path,\n\t\tcontent: result.content,\n\t\tmtimeMs: result.fingerprint.mtimeMs,\n\t\tsize: result.fingerprint.size,\n\t\tcontentHash: result.fingerprint.contentHash,\n\t};\n}\n\nfunction sentinelFor(mode: LoopMode, loopFilePresent: boolean): LoopSentinel {\n\tif (loopFilePresent) return mode === \"fixed\" ? \"<<loop.md>>\" : \"<<loop.md-dynamic>>\";\n\treturn mode === \"fixed\" ? \"<<autonomous-loop>>\" : \"<<autonomous-loop-dynamic>>\";\n}\n\nfunction modeOf(entry: CronEntry): LoopMode {\n\treturn entry.kind === \"fixed\" ? \"fixed\" : \"dynamic\";\n}\n\ninterface AnchorPayload {\n\treadonly loopId?: string;\n\treadonly deliveryId?: string;\n}\n\n/** Reads the tick payload of a `loop-tick` entry, whichever entry kind carries it. */\nfunction anchorPayloadOf(entry: SessionEntry): AnchorPayload | undefined {\n\tif (entry.type === \"custom\") {\n\t\treturn entry.customType === LOOP_TICK_ENTRY_TYPE ? (entry.data as AnchorPayload | undefined) : undefined;\n\t}\n\tif (entry.type === \"custom_message\") {\n\t\treturn entry.customType === LOOP_TICK_ENTRY_TYPE ? (entry.details as AnchorPayload | undefined) : undefined;\n\t}\n\treturn undefined;\n}\n\n/**\n * True when the compaction-aware context still contains the delivery that anchored a full\n * sentinel block. Compaction can drop it, and a reminder's \"established earlier in this\n * conversation\" phrasing must never dangle, so a missing anchor forces the next tick back\n * to full. When no specific anchor id was recorded (the autonomous preamble carries none),\n * any surviving tick delivery for that loop counts as the anchor.\n */\nfunction anchorPresent(ctx: ExtensionContext, loopId: LoopId, deliveryId: DeliveryId | undefined): boolean {\n\treturn ctx.sessionManager.buildContextEntries().some((entry) => {\n\t\tconst payload = anchorPayloadOf(entry);\n\t\tif (payload === undefined) return false;\n\t\tif (payload.loopId !== undefined && payload.loopId !== loopId) return false;\n\t\treturn deliveryId === undefined ? true : payload.deliveryId === deliveryId;\n\t});\n}\n\nexport function createLoopExtension(deps: LoopExtensionDeps = {}): ExtensionFactory {\n\tconst clock: LoopClock = deps.clock ?? { now: () => Date.now() };\n\tconst makeTimers = deps.timers ?? createNodeTimerPort;\n\tconst ids = deps.ids ?? defaultIds();\n\tconst storeRefOf = deps.storeRef ?? defaultStoreRef;\n\tconst resolveLoopFile =\n\t\tdeps.resolveLoopFile ??\n\t\t((options: { cwd: string; homeDir: string }) =>\n\t\t\tresolveLoopFileDefault({ cwd: options.cwd, homeDir: options.homeDir, fs: nodeFs, path: { join } }));\n\tconst readState = deps.readState ?? readLoopState;\n\tconst writeState = deps.writeState ?? writeLoopState;\n\n\treturn (pi: ExtensionAPI) => {\n\t\tlet ctx: ExtensionContext | undefined;\n\t\tlet scheduler: LoopScheduler | undefined;\n\t\tlet storeRef: LoopStoreRef | undefined;\n\t\tlet timers: LoopTimerPort = makeTimers();\n\t\tlet storeFailure: LoopStoreFailure | undefined;\n\t\tlet sessionNamed = false;\n\t\t/** Loop the currently running iteration is attributed to, for keepalive + tools. */\n\t\tlet attributedLoopId: LoopId | undefined;\n\t\t/** Delivery id of the tick that started the attributed iteration. */\n\t\tlet attributedDeliveryId: DeliveryId | undefined;\n\t\t/** True once the attributed iteration rescheduled or stopped itself. */\n\t\tlet attributionResolved = false;\n\t\t/** Ticks held back because their slash payload cannot be queued while streaming. */\n\t\tconst deferredDispatches: LoopTick[] = [];\n\t\tconst deliveryStates = new Map<LoopId, SentinelDeliveryState>();\n\t\t/** Loops retired with `error` because their state could not be read or written. */\n\t\tconst endedWithError = new Set<LoopId>();\n\t\t/** True once this session has state worth persisting (loaded or created). */\n\t\tlet storeTouched = false;\n\t\tlet persistTail: Promise<void> = Promise.resolve();\n\n\t\tconst ticker = new LoopStatusTicker({\n\t\t\trender: (key, text) => {\n\t\t\t\ttry {\n\t\t\t\t\tctx?.ui.setStatus(key, text);\n\t\t\t\t} catch {\n\t\t\t\t\t// A stale context after session replacement must not break the loop runtime.\n\t\t\t\t}\n\t\t\t},\n\t\t\tnow: () => clock.now(),\n\t\t});\n\n\t\tpi.registerEntryRenderer(LOOP_TICK_ENTRY_TYPE, renderLoopTickEntry);\n\t\tregisterLoopTools(pi, {\n\t\t\tscheduler: {\n\t\t\t\tgetWakeupTarget: (): ScheduleWakeupTarget => {\n\t\t\t\t\tif (scheduler === undefined || attributedLoopId === undefined) return null;\n\t\t\t\t\tconst entry = scheduler.getState().entries[attributedLoopId];\n\t\t\t\t\tif (entry === undefined || entry.phase === \"ended\") return null;\n\t\t\t\t\treturn { kind: entry.kind, loopId: entry.id };\n\t\t\t\t},\n\t\t\t\tscheduleWakeup: async (request) => {\n\t\t\t\t\tconst active = requireScheduler();\n\t\t\t\t\tconst result = active.onScheduleWakeup(request);\n\t\t\t\t\tif (!result.ok) throw new Error(`schedule_wakeup rejected: ${result.reason}`);\n\t\t\t\t\tattributionResolved = true;\n\t\t\t\t\tawait persist();\n\t\t\t\t\trefreshStatus();\n\t\t\t\t\treturn {\n\t\t\t\t\t\twakeupId: result.wakeupId,\n\t\t\t\t\t\t...(result.replacedWakeupId === undefined ? {} : { replacedWakeupId: result.replacedWakeupId }),\n\t\t\t\t\t\tdueAt: result.dueAt,\n\t\t\t\t\t\tnoopStreak: result.noopStreak,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t\tstopDynamicLoop: async (request) => {\n\t\t\t\t\tconst active = requireScheduler();\n\t\t\t\t\tactive.stop(request.loopId, \"model-stop\");\n\t\t\t\t\tattributionResolved = true;\n\t\t\t\t\tawait persist();\n\t\t\t\t\trefreshStatus();\n\t\t\t\t\treturn { endedAt: clock.now() };\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tfunction requireScheduler(): LoopScheduler {\n\t\t\tif (scheduler === undefined) throw new Error(\"loop extension has no active session\");\n\t\t\treturn scheduler;\n\t\t}\n\n\t\t/** Merges extension-owned sentinel delivery state into the scheduler's snapshot. */\n\t\tfunction withDeliveryOverlay(state: LoopState): LoopState {\n\t\t\tconst entries: Record<LoopId, CronEntry> = {};\n\t\t\tfor (const [id, entry] of Object.entries(state.entries)) {\n\t\t\t\tconst delivery = deliveryStates.get(id);\n\t\t\t\tentries[id] = delivery === undefined ? entry : { ...entry, sentinelDelivery: delivery };\n\t\t\t}\n\t\t\treturn { ...state, entries };\n\t\t}\n\n\t\t/** Serializes persistence so a timer, tool, and command write cannot interleave. */\n\t\tfunction persist(): Promise<void> {\n\t\t\tconst ref = storeRef;\n\t\t\tconst active = scheduler;\n\t\t\tif (ref === undefined || active === undefined) return Promise.resolve();\n\t\t\tconst snapshot = withDeliveryOverlay(active.getState());\n\t\t\t// The extension is registered for every session, so a session that never ran a loop\n\t\t\t// must not leave a sidecar behind.\n\t\t\tif (!storeTouched && Object.keys(snapshot.entries).length === 0) return Promise.resolve();\n\t\t\tstoreTouched = true;\n\t\t\tpersistTail = persistTail.then(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait writeState(ref, snapshot);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tfailStore(error, Object.keys(snapshot.entries));\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn persistTail;\n\t\t}\n\n\t\t/**\n\t\t * A schedule that cannot be read or written must not keep running: end the affected\n\t\t * loops with `error` and tell the user, rather than silently losing the schedule. The\n\t\t * terminal record is kept in memory because the store that would hold it is exactly the\n\t\t * thing that just failed; what matters is that nothing stays armed and the user knows.\n\t\t */\n\t\tfunction failStore(error: unknown, loopIds: readonly LoopId[]): void {\n\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\ttimers.cancelAll();\n\t\t\tfor (const loopId of loopIds) endedWithError.add(loopId);\n\t\t\tstoreFailure = {\n\t\t\t\tendReason: \"error\",\n\t\t\t\tmessage,\n\t\t\t\tloopIds,\n\t\t\t};\n\t\t\tticker.dispose();\n\t\t\tctx?.ui.notify(`/loop state could not be used and the affected loops were ended: ${message}`, \"error\");\n\t\t}\n\n\t\t/**\n\t\t * `schedule_wakeup` is search-exposed, so it is callable only while this extension keeps it\n\t\t * active: exactly when a dynamic loop is live (not ended, not suspended). Idempotent, so\n\t\t * every state transition can call it without churning the active tool list.\n\t\t */\n\t\tfunction syncScheduleWakeupActivation(): void {\n\t\t\tif (scheduler === undefined) return;\n\t\t\tconst wanted = Object.values(scheduler.getState().entries).some(\n\t\t\t\t(entry) => entry.kind === \"dynamic\" && entry.phase !== \"ended\" && entry.phase !== \"suspended\",\n\t\t\t);\n\t\t\tconst active = pi.getActiveTools();\n\t\t\tconst present = active.includes(SCHEDULE_WAKEUP_TOOL);\n\t\t\tif (wanted === present) return;\n\t\t\tpi.setActiveTools(\n\t\t\t\twanted ? [...active, SCHEDULE_WAKEUP_TOOL] : active.filter((name) => name !== SCHEDULE_WAKEUP_TOOL),\n\t\t\t);\n\t\t}\n\n\t\tfunction refreshStatus(): void {\n\t\t\tsyncScheduleWakeupActivation();\n\t\t\tif (scheduler === undefined) return;\n\t\t\tconst state = scheduler.getState();\n\t\t\t// The ticker owns a repeating render timer, so it only runs while a loop is armed;\n\t\t\t// a session that never used /loop must not carry one.\n\t\t\tif (Object.values(state.entries).every((entry) => entry.phase === \"ended\")) {\n\t\t\t\tif (ticker.running) ticker.dispose();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tticker.sync(state);\n\t\t}\n\n\t\tfunction deliveryStateOf(loopId: LoopId): SentinelDeliveryState {\n\t\t\treturn deliveryStates.get(loopId) ?? emptyDeliveryState();\n\t\t}\n\n\t\tfunction markForceFullDelivery(): void {\n\t\t\tfor (const [id, state] of deliveryStates) {\n\t\t\t\tdeliveryStates.set(id, { ...state, forceFullDelivery: true });\n\t\t\t}\n\t\t\tconst active = scheduler;\n\t\t\tif (active === undefined) return;\n\t\t\tfor (const entry of Object.values(active.getState().entries)) {\n\t\t\t\tif (entry.phase === \"ended\") continue;\n\t\t\t\tif (deliveryStates.has(entry.id)) continue;\n\t\t\t\tdeliveryStates.set(entry.id, { ...entry.sentinelDelivery, forceFullDelivery: true });\n\t\t\t}\n\t\t}\n\n\t\tfunction isExtensionCommandPayload(text: string): boolean {\n\t\t\tif (!text.startsWith(\"/\")) return false;\n\t\t\tconst name = text.slice(1).split(/\\s+/)[0];\n\t\t\treturn pi.getCommands().some((command) => command.name === name);\n\t\t}\n\n\t\t/**\n\t\t * Delivers one tick. Idle dispatch expands prompt templates so a slash payload\n\t\t * reaches its real command handler; a busy session gets a follow-up instead of\n\t\t * steering. A slash payload cannot be queued at all, so it waits for the turn to\n\t\t * settle rather than being rewritten into plain text.\n\t\t */\n\t\tasync function dispatchTick(tick: LoopTick): Promise<void> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst entry = active.getState().entries[tick.loopId];\n\t\t\tif (entry === undefined || entry.phase === \"ended\") return;\n\t\t\tif (endedWithError.has(tick.loopId)) return;\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (currentCtx === undefined) return;\n\n\t\t\tconst mode = modeOf(entry);\n\t\t\tconst loopFile =\n\t\t\t\tentry.payload.type === \"sentinel\" ? await resolveLoopFileSafely(currentCtx) : { found: false as const };\n\t\t\tconst built = buildTickMessage({\n\t\t\t\tloopId: entry.id,\n\t\t\t\tdeliveryId: tick.deliveryId,\n\t\t\t\tmode,\n\t\t\t\tpayload: entry.payload,\n\t\t\t\treentryPrompt: entry.reentryPrompt,\n\t\t\t\tdeliveryState: deliveryStateOf(entry.id),\n\t\t\t\tloopFile: loopFileSnapshot(loopFile),\n\t\t\t});\n\t\t\tdeliveryStates.set(entry.id, built.deliveryState);\n\n\t\t\tconst busy = !currentCtx.isIdle() || currentCtx.hasPendingMessages();\n\t\t\tif (busy && isExtensionCommandPayload(built.text)) {\n\t\t\t\t// Extension commands cannot be queued; hold this delivery until the turn settles.\n\t\t\t\tdeferredDispatches.push(tick);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst noopStreak = entry.noopStreak;\n\t\t\tpi.appendEntry<LoopTickEntryData>(LOOP_TICK_ENTRY_TYPE, {\n\t\t\t\tloopId: entry.id,\n\t\t\t\tdeliveryId: tick.deliveryId,\n\t\t\t\tscheduledForAt: tick.scheduledForAt,\n\t\t\t\tmode,\n\t\t\t\tdelivery: built.delivery,\n\t\t\t\t...(built.details.sentinel === undefined ? {} : { sentinel: built.details.sentinel }),\n\t\t\t\tnoopStreak,\n\t\t\t\tfolded: noopStreak >= 2,\n\t\t\t});\n\n\t\t\tattributedLoopId = entry.id;\n\t\t\tattributedDeliveryId = tick.deliveryId;\n\t\t\tattributionResolved = false;\n\t\t\t// The tick prompt tells the model to call schedule_wakeup, so the tool must be active\n\t\t\t// before the tick is queued, not after the turn has already read its tool list.\n\t\t\tsyncScheduleWakeupActivation();\n\t\t\tpi.sendUserMessage(built.text, {\n\t\t\t\texpandPromptTemplates: true,\n\t\t\t\t...(busy ? { deliverAs: \"followUp\" as const } : {}),\n\t\t\t});\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t}\n\n\t\tasync function resolveLoopFileSafely(currentCtx: ExtensionContext): Promise<LoopFileResult> {\n\t\t\ttry {\n\t\t\t\treturn await resolveLoopFile({ cwd: currentCtx.cwd, homeDir: homedir() });\n\t\t\t} catch {\n\t\t\t\t// A loop file that cannot be read is treated as absent for this tick; the loop\n\t\t\t\t// stays alive and picks the file up again once it is readable.\n\t\t\t\treturn { found: false };\n\t\t\t}\n\t\t}\n\n\t\tasync function drainDeferred(): Promise<void> {\n\t\t\tif (deferredDispatches.length === 0) return;\n\t\t\tconst pending = deferredDispatches.splice(0, deferredDispatches.length);\n\t\t\tfor (const tick of pending) await dispatchTick(tick);\n\t\t}\n\n\t\tasync function fireDue(loopId: LoopId): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (active === undefined || currentCtx === undefined) return;\n\t\t\tconst busy = !currentCtx.isIdle() || currentCtx.hasPendingMessages();\n\t\t\tconst decision = active.onDue(loopId, clock.now(), busy);\n\t\t\tawait persist();\n\t\t\tif (decision.action === \"dispatch\") {\n\t\t\t\tawait dispatchTick(decision.tick);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (decision.action === \"expire\") {\n\t\t\t\tctx?.ui.notify(\"Loop expired after 7 days and is no longer armed.\", \"info\");\n\t\t\t}\n\t\t\trefreshStatus();\n\t\t}\n\n\t\t/**\n\t\t * Timer callbacks are synchronous, so the async due step is scheduled and its failure is\n\t\t * contained: a rejected dispatch must never take down the timer that owns the loop.\n\t\t */\n\t\tfunction handleTimerFire(loopId: LoopId): void {\n\t\t\tvoid fireDue(loopId).catch((error) => {\n\t\t\t\tctx?.ui.notify(`Loop tick failed: ${error instanceof Error ? error.message : String(error)}`, \"error\");\n\t\t\t});\n\t\t}\n\n\t\tfunction payloadForPrompt(prompt: string): LoopPayload {\n\t\t\treturn { type: \"prompt\", prompt };\n\t\t}\n\n\t\tasync function startFixed(request: StartFixedRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst effective = normalizeInterval(request.requestedInterval);\n\t\t\tconst created = active.createFixed({\n\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\treentryPrompt: `/loop ${request.originalArgs}`.trimEnd(),\n\t\t\t\tpayload: payloadForPrompt(request.prompt),\n\t\t\t\trequestedInterval: request.requestedInterval,\n\t\t\t\teffectiveInterval: effective,\n\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\tintervalMs: effective.intervalMs,\n\t\t\t});\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(request.prompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\t...(effective.roundingNotice === undefined ? {} : { roundingNotice: effective.roundingNotice }),\n\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\teffectiveCadence: effective.human,\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tasync function startDynamic(request: StartDynamicRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst created = active.createDynamic({\n\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\treentryPrompt: `/loop ${request.originalArgs}`.trimEnd(),\n\t\t\t\tpayload: payloadForPrompt(request.prompt),\n\t\t\t});\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(request.prompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\t...(created.supersededLoopId === undefined ? {} : { supersededLoopId: created.supersededLoopId }),\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tasync function startBare(request: StartBareRequest): Promise<LoopCreateOutcome> {\n\t\t\tconst active = requireScheduler();\n\t\t\tconst currentCtx = ctx;\n\t\t\tif (currentCtx === undefined) return { ok: false, message: \"loop extension has no active session\" };\n\t\t\tconst loopFile = await resolveLoopFileSafely(currentCtx);\n\t\t\tconst mode: LoopMode = request.interval === undefined ? \"dynamic\" : \"fixed\";\n\t\t\tconst payload: LoopPayload = { type: \"sentinel\", sentinel: sentinelFor(mode, loopFile.found) };\n\t\t\tconst reentryPrompt = request.originalArgs.trim() === \"\" ? \"/loop\" : `/loop ${request.originalArgs.trim()}`;\n\n\t\t\tconst created =\n\t\t\t\trequest.interval === undefined\n\t\t\t\t\t? active.createDynamic({ originalArgs: request.originalArgs, reentryPrompt, payload })\n\t\t\t\t\t: (() => {\n\t\t\t\t\t\t\tconst effective = normalizeInterval(request.interval);\n\t\t\t\t\t\t\treturn active.createFixed({\n\t\t\t\t\t\t\t\toriginalArgs: request.originalArgs,\n\t\t\t\t\t\t\t\treentryPrompt,\n\t\t\t\t\t\t\t\tpayload,\n\t\t\t\t\t\t\t\trequestedInterval: request.interval,\n\t\t\t\t\t\t\t\teffectiveInterval: effective,\n\t\t\t\t\t\t\t\tcronExpression: describeCron(effective),\n\t\t\t\t\t\t\t\tintervalMs: effective.intervalMs,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t})();\n\t\t\tif (!created.ok) return { ok: false, message: created.message };\n\t\t\tdeliveryStates.set(created.loopId, emptyDeliveryState());\n\t\t\tawait persist();\n\t\t\tnameSessionAfterLoop(reentryPrompt);\n\t\t\tawait fireDue(created.loopId);\n\t\t\trefreshStatus();\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tloopId: created.loopId,\n\t\t\t\texpiresAt: active.getState().entries[created.loopId]?.expiresAt,\n\t\t\t};\n\t\t}\n\n\t\tfunction nameSessionAfterLoop(prompt: string): void {\n\t\t\tif (sessionNamed) return;\n\t\t\tsessionNamed = true;\n\t\t\tif (pi.getSessionName() !== undefined) return;\n\t\t\tpi.setSessionName(`loop: ${prompt}`.trim());\n\t\t}\n\n\t\tconst controller: LoopController = {\n\t\t\tstartFixed,\n\t\t\tstartDynamic,\n\t\t\tstartBare,\n\t\t\tfireDue,\n\t\t\tscheduleWakeup: async (request) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.onScheduleWakeup(request);\n\t\t\t\tif (result.ok) attributionResolved = true;\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t},\n\t\t\tstop: async (target, detail) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.stop(target, detail);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tpause: async (target) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.pause(target);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tresume: async (target) => {\n\t\t\t\tconst active = requireScheduler();\n\t\t\t\tconst result = active.resume(target);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\treturn result.affectedLoopIds;\n\t\t\t},\n\t\t\tgetState: () => requireScheduler().getState(),\n\t\t\tstatusLine: () => formatLoopStatus(requireScheduler().getState(), clock.now()),\n\t\t\tlastStoreFailure: () => storeFailure,\n\t\t\tisEndedWithError: (loopId) => endedWithError.has(loopId),\n\t\t};\n\n\t\tdeps.onControllerReady?.(controller);\n\t\tregisterLoopCommand(pi, { controller });\n\n\t\tpi.on(\"session_start\", async (_event, nextCtx) => {\n\t\t\tctx = nextCtx;\n\t\t\ttimers.cancelAll();\n\t\t\ttimers = makeTimers();\n\t\t\tstoreFailure = undefined;\n\t\t\tendedWithError.clear();\n\t\t\tstoreTouched = false;\n\t\t\tsessionNamed = false;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tdeferredDispatches.length = 0;\n\t\t\tdeliveryStates.clear();\n\t\t\tstoreRef = storeRefOf(nextCtx);\n\n\t\t\tlet initialState: LoopState | undefined;\n\t\t\ttry {\n\t\t\t\tinitialState = (await readState(storeRef)) ?? undefined;\n\t\t\t} catch (error) {\n\t\t\t\t// Fail closed: arm nothing, end nothing silently, and tell the user.\n\t\t\t\tfailStore(error, []);\n\t\t\t\tscheduler = createLoopScheduler({\n\t\t\t\t\tsessionId: nextCtx.sessionManager.getSessionId(),\n\t\t\t\t\tclock,\n\t\t\t\t\ttimers,\n\t\t\t\t\tids,\n\t\t\t\t\tonFire: handleTimerFire,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tscheduler = createLoopScheduler({\n\t\t\t\tsessionId: nextCtx.sessionManager.getSessionId(),\n\t\t\t\tclock,\n\t\t\t\ttimers,\n\t\t\t\tids,\n\t\t\t\tonFire: handleTimerFire,\n\t\t\t\t...(initialState === undefined ? {} : { initialState }),\n\t\t\t});\n\t\t\tstoreTouched = initialState !== undefined;\n\n\t\t\tfor (const entry of Object.values(scheduler.getState().entries)) {\n\t\t\t\tconst anchorDeliveryId = entry.sentinelDelivery.lastLoopFileDelivered?.anchorDeliveryId;\n\t\t\t\tconst anchored = anchorPresent(nextCtx, entry.id, anchorDeliveryId);\n\t\t\t\tconst needsFull = !anchored && hasAnchoredDelivery(entry.sentinelDelivery);\n\t\t\t\tdeliveryStates.set(entry.id, {\n\t\t\t\t\t...entry.sentinelDelivery,\n\t\t\t\t\tforceFullDelivery: entry.sentinelDelivery.forceFullDelivery || needsFull,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst restored = scheduler.restore(clock.now());\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t\tfor (const tick of restored.recoveryTicks) await dispatchTick(tick);\n\t\t\tif (restored.expiredLoopIds.length > 0) {\n\t\t\t\tnextCtx.ui.notify(`Loop expired after 7 days: ${restored.expiredLoopIds.join(\", \")}`, \"info\");\n\t\t\t}\n\t\t});\n\n\t\tpi.on(\"session_compact\", async (event) => {\n\t\t\t// Accepted compaction may have dropped the anchor the reminders point at, so the\n\t\t\t// next sentinel tick must carry the full instructions again. Timers and phase are\n\t\t\t// deliberately untouched.\n\t\t\tif (event.accepted !== true) return;\n\t\t\tmarkForceFullDelivery();\n\t\t\tawait persist();\n\t\t});\n\n\t\tpi.on(\"input\", async (event) => {\n\t\t\t// A user turn is never an attributed loop iteration, so keepalive must not see it.\n\t\t\t// A tick dispatched by this extension arrives with source \"extension\" and MUST keep\n\t\t\t// its attribution, or no dynamic iteration would ever be judged.\n\t\t\tif (event.source === \"extension\") return;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t});\n\n\t\tpi.on(\"agent_end\", async (event) => {\n\t\t\t// A retrying turn is still in progress: neither settle it nor judge its liveness.\n\t\t\tif (event.willRetry === true) return;\n\t\t\tif (event.aborted === true && event.abortSource === \"user\") {\n\t\t\t\tawait pauseAttributedLoop();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tawait settleAttributedTick(event.aborted === true ? \"error\" : \"completed\");\n\t\t});\n\n\t\tpi.on(\"agent_settled\", async () => {\n\t\t\tawait settleAttributedTick(\"completed\");\n\t\t\tawait drainDeferred();\n\t\t\trefreshStatus();\n\t\t});\n\n\t\tpi.on(\"session_abort\", async () => {\n\t\t\tawait pauseAttributedLoop();\n\t\t});\n\n\t\tpi.on(\"session_shutdown\", async () => {\n\t\t\tconst active = scheduler;\n\t\t\tif (active !== undefined) {\n\t\t\t\t// Shutdown SUSPENDS: every senpi shutdown reason leaves the session resumable,\n\t\t\t\t// so the snapshot must carry no terminal reason.\n\t\t\t\tactive.onShutdown();\n\t\t\t\tawait persist();\n\t\t\t}\n\t\t\ttimers.cancelAll();\n\t\t\tdeferredDispatches.length = 0;\n\t\t\tticker.dispose();\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tctx = undefined;\n\t\t});\n\n\t\tasync function pauseAttributedLoop(): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tif (active === undefined) return;\n\t\t\tconst targets =\n\t\t\t\tattributedLoopId === undefined\n\t\t\t\t\t? Object.values(active.getState().entries)\n\t\t\t\t\t\t\t.filter((entry) => entry.phase !== \"ended\")\n\t\t\t\t\t\t\t.map((entry) => entry.id)\n\t\t\t\t\t: [attributedLoopId];\n\t\t\tconst paused: LoopId[] = [];\n\t\t\tfor (const loopId of targets) {\n\t\t\t\tif (active.onUserAbort(loopId).action === \"paused\") paused.push(loopId);\n\t\t\t}\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\t\t\tif (paused.length === 0) return;\n\t\t\tawait persist();\n\t\t\trefreshStatus();\n\t\t\tctx?.ui.notify(\"loop paused - /loop resume or /loop stop\", \"info\");\n\t\t}\n\n\t\t/**\n\t\t * Settles the tick this turn was attributed to, drains a coalesced occurrence, and\n\t\t * applies the two-strike keepalive to a dynamic iteration that ended without calling\n\t\t * `schedule_wakeup`. An ordinary user turn clears the attribution first, so keepalive\n\t\t * can never be charged to it, and a user abort takes the pause path instead.\n\t\t */\n\t\tasync function settleAttributedTick(outcome: \"completed\" | \"error\"): Promise<void> {\n\t\t\tconst active = scheduler;\n\t\t\tconst loopId = attributedLoopId;\n\t\t\tconst deliveryId = attributedDeliveryId;\n\t\t\tif (active === undefined || loopId === undefined) return;\n\t\t\tconst entry = active.getState().entries[loopId];\n\t\t\tif (entry === undefined) return;\n\t\t\tconst resolved = attributionResolved;\n\t\t\tattributedLoopId = undefined;\n\t\t\tattributedDeliveryId = undefined;\n\t\t\tattributionResolved = false;\n\n\t\t\tconst settled = deliveryId === undefined ? undefined : active.onTickSettled({ loopId, deliveryId, outcome });\n\t\t\tawait persist();\n\n\t\t\tif (!resolved && entry.kind === \"dynamic\") {\n\t\t\t\tconst keepalive = active.onTurnEndedWithoutSchedule(loopId);\n\t\t\t\tawait persist();\n\t\t\t\trefreshStatus();\n\t\t\t\tif (keepalive.action === \"ended\") {\n\t\t\t\t\tctx?.ui.notify(\n\t\t\t\t\t\tkeepalive.endReason === \"keepalive_exhausted\"\n\t\t\t\t\t\t\t? \"Loop ended: the model stopped scheduling wakeups.\"\n\t\t\t\t\t\t\t: \"Loop expired after 7 days and is no longer armed.\",\n\t\t\t\t\t\t\"info\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (settled?.action === \"dispatch\") {\n\t\t\t\t// Exactly one delivery drains a coalesced occurrence, however many were missed.\n\t\t\t\tawait dispatchTick(settled.tick);\n\t\t\t} else if (settled?.action === \"ended\") {\n\t\t\t\tctx?.ui.notify(`Loop ended: ${settled.endReason}.`, \"info\");\n\t\t\t}\n\t\t\trefreshStatus();\n\t\t}\n\t};\n}\n\n/** True when a reminder would refer back to a full delivery that must still exist. */\nfunction hasAnchoredDelivery(state: SentinelDeliveryState): boolean {\n\treturn state.autonomousPreambleDelivered || state.lastLoopFileDelivered !== null;\n}\n\nexport default createLoopExtension();\n"]}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`
|
|
3
3
|
* extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.
|
|
4
4
|
*
|
|
5
|
+
* Exposure: the tool is registered `exposure: "search"` with lazy activation disabled, so it is
|
|
6
|
+
* absent from the resident tool list (and from `tool_search`) until the loop extension activates it
|
|
7
|
+
* for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is
|
|
8
|
+
* an error, so a resident registration only cost prompt tokens.
|
|
9
|
+
*
|
|
5
10
|
* Two deliberate shape decisions:
|
|
6
11
|
* - The TypeBox schema is a FLAT object with no root union. Several provider payload
|
|
7
12
|
* conversions rebuild tool schemas from top-level `properties` only, so a root
|
|
@@ -22,7 +27,7 @@ export declare const SCHEDULE_WAKEUP_TOOL = "schedule_wakeup";
|
|
|
22
27
|
/** Inclusive bounds the executor clamps `delaySeconds` into. */
|
|
23
28
|
export declare const MIN_WAKEUP_DELAY_SECONDS = 60;
|
|
24
29
|
export declare const MAX_WAKEUP_DELAY_SECONDS = 3600;
|
|
25
|
-
export declare const SCHEDULE_WAKEUP_DESCRIPTION = "Schedule when to resume work in /loop dynamic mode. Always pass the `prompt` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with `stop: true` to end the active dynamic loop immediately.\n\n`delaySeconds` is clamped to 60-3600 seconds
|
|
30
|
+
export declare const SCHEDULE_WAKEUP_DESCRIPTION = "Schedule when to resume work in /loop dynamic mode. Always pass the `prompt` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with `stop: true` to end the active dynamic loop immediately.\n\n`delaySeconds` is clamped to 60-3600 seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set `prompt` to the complete original command, for example `/loop check the deploy`, preserving the user's text verbatim. Set `noop: true` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit `noop` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.";
|
|
26
31
|
export declare const scheduleWakeupSchema: Type.TObject<{
|
|
27
32
|
delaySeconds: Type.TOptional<Type.TInteger>;
|
|
28
33
|
reason: Type.TString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5D,+BAA+B;AAC/B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AC;CACxB;AAED,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC3C,qEAAqE;IACrE,eAAe,IAAI,oBAAoB,CAAC;IACxC,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/E,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAClF;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;CAChD;AAED,eAAO,MAAM,4BAA4B,sEAA8E,CAAC;AACxH,eAAO,MAAM,gBAAgB,2GAAmH,CAAC;AACjJ,eAAO,MAAM,oBAAoB,kEAAkE,CAAC;AACpG,eAAO,MAAM,mBAAmB,kDAAkD,CAAC;AACnF,eAAO,MAAM,uBAAuB,6DAA6D,CAAC;AAClG,eAAO,MAAM,kBAAkB,8CAA8C,CAAC;AAC9E,eAAO,MAAM,oBAAoB,4CAA4C,CAAC;AAkG9E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,wBAAwB,GAAG,IAAI,CAcxF"}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`
|
|
3
3
|
* extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.
|
|
4
4
|
*
|
|
5
|
+
* Exposure: the tool is registered `exposure: "search"` with lazy activation disabled, so it is
|
|
6
|
+
* absent from the resident tool list (and from `tool_search`) until the loop extension activates it
|
|
7
|
+
* for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is
|
|
8
|
+
* an error, so a resident registration only cost prompt tokens.
|
|
9
|
+
*
|
|
5
10
|
* Two deliberate shape decisions:
|
|
6
11
|
* - The TypeBox schema is a FLAT object with no root union. Several provider payload
|
|
7
12
|
* conversions rebuild tool schemas from top-level `properties` only, so a root
|
|
@@ -22,7 +27,7 @@ export const MIN_WAKEUP_DELAY_SECONDS = 60;
|
|
|
22
27
|
export const MAX_WAKEUP_DELAY_SECONDS = 3600;
|
|
23
28
|
export const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \`prompt\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \`stop: true\` to end the active dynamic loop immediately.
|
|
24
29
|
|
|
25
|
-
\`delaySeconds\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds
|
|
30
|
+
\`delaySeconds\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.
|
|
26
31
|
|
|
27
32
|
For normal dynamic re-entry, set \`prompt\` to the complete original command, for example \`/loop check the deploy\`, preserving the user's text verbatim. Set \`noop: true\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \`noop\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;
|
|
28
33
|
export const scheduleWakeupSchema = Type.Object({
|
|
@@ -145,6 +150,8 @@ export function registerLoopTools(pi, deps) {
|
|
|
145
150
|
label: "Schedule Wakeup",
|
|
146
151
|
description: SCHEDULE_WAKEUP_DESCRIPTION,
|
|
147
152
|
parameters: scheduleWakeupSchema,
|
|
153
|
+
exposure: "search",
|
|
154
|
+
allowLazyActivation: false,
|
|
148
155
|
// Sequential so two concurrent model tool calls cannot race scheduler state.
|
|
149
156
|
executionMode: "sequential",
|
|
150
157
|
async execute(_toolCallId, params) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[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B;QAC1B,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,2BAA2B;QACxC,UAAU,EAAE,oBAAoB;QAChC,6EAA6E;QAC7E,aAAa,EAAE,YAAY;QAC3B,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`\n * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.\n *\n * Two deliberate shape decisions:\n * - The TypeBox schema is a FLAT object with no root union. Several provider payload\n * conversions rebuild tool schemas from top-level `properties` only, so a root\n * `anyOf` would reach the model as an empty schema (same reasoning as\n * `terminal/tools/monitor.ts`). Branch requirements are enforced in `execute`.\n * - `delaySeconds` carries NO schema `minimum`/`maximum`. The contract clamps\n * out-of-range integers instead of rejecting them, and schema bounds would make the\n * clamp unreachable.\n *\n * Scheduler state is never mutated here: every effect goes through the injected\n * `ScheduleWakeupSchedulerPort`.\n */\n\nimport { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI } from \"../../types.ts\";\nimport type { EpochMs, LoopId, WakeupId } from \"./types.ts\";\n\n/** Model-visible tool name. */\nexport const SCHEDULE_WAKEUP_TOOL = \"schedule_wakeup\";\n\n/** Inclusive bounds the executor clamps `delaySeconds` into. */\nexport const MIN_WAKEUP_DELAY_SECONDS = 60;\nexport const MAX_WAKEUP_DELAY_SECONDS = 3600;\n\nexport const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \\`prompt\\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \\`stop: true\\` to end the active dynamic loop immediately.\n\n\\`delaySeconds\\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds. For idle polling, normally use 1200-1800 seconds. Avoid choosing 300 seconds merely to poll: short polling repeatedly loses prompt-cache value on many API paths. When work is gated on observable terminal state, use \\`monitor\\` instead of sleeping or polling; inspect it with \\`bash_output\\` and stop the watcher with \\`kill_bash\\`. For delegated work, use the available \\`task\\` output and control tools and let task completion notifications wake the session. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set \\`prompt\\` to the complete original command, for example \\`/loop check the deploy\\`, preserving the user's text verbatim. Set \\`noop: true\\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \\`noop\\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;\n\nexport const scheduleWakeupSchema = Type.Object(\n\t{\n\t\tdelaySeconds: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: `Dynamic loop delay in seconds. Values are clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}.`,\n\t\t\t}),\n\t\t),\n\t\treason: Type.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Why this wakeup or stop is appropriate. Must not be blank.\",\n\t\t}),\n\t\tprompt: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Prompt to dispatch when the wakeup fires. Required unless stop is true; preserve the original /loop command verbatim for normal dynamic re-entry.\",\n\t\t\t}),\n\t\t),\n\t\tstop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"End the active dynamic loop immediately instead of scheduling another wakeup.\",\n\t\t\t}),\n\t\t),\n\t\tnoop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"True when this iteration observed no actionable change. Consecutive noop iterations are folded in the terminal view. Omit when stopping.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** Runtime-validated parameter shape; the schema itself stays flat and permissive. */\nexport interface ScheduleWakeupParams {\n\treadonly delaySeconds?: number;\n\treadonly reason: string;\n\treadonly prompt?: string;\n\treadonly stop?: boolean;\n\treadonly noop?: boolean;\n}\n\nexport interface ScheduleWakeupScheduledDetails {\n\treadonly ok: true;\n\treadonly action: \"scheduled\";\n\treadonly loopId: LoopId;\n\treadonly wakeupId: WakeupId;\n\treadonly replacedWakeupId?: WakeupId;\n\n\t/** Integer the model asked for, before the clamp. */\n\treadonly requestedDelaySeconds: number;\n\t/** Effective delay after clamping to `[60, 3600]`. */\n\treadonly delaySeconds: number;\n\treadonly clamped: boolean;\n\treadonly dueAt: EpochMs;\n\n\treadonly reason: string;\n\t/** Preserved verbatim after the non-blank check. */\n\treadonly prompt: string;\n\treadonly noop: boolean;\n\treadonly noopStreak: number;\n}\n\nexport interface ScheduleWakeupStoppedDetails {\n\treadonly ok: true;\n\treadonly action: \"stopped\";\n\treadonly loopId: LoopId;\n\treadonly terminalReason: \"stopped\";\n\treadonly reason: string;\n\treadonly endedAt: EpochMs;\n\t/** Fields accepted for model compatibility but not applied. */\n\treadonly ignoredFields: readonly ScheduleWakeupIgnorableField[];\n}\n\nexport type ScheduleWakeupIgnorableField = \"delaySeconds\" | \"prompt\";\n\nexport type ScheduleWakeupDetails = ScheduleWakeupScheduledDetails | ScheduleWakeupStoppedDetails;\n\n/**\n * Which loop, if any, this tool call belongs to. `null` means no loop context at all;\n * a `fixed` target means the call came from a fixed tick, whose schedule re-arms itself.\n */\nexport type ScheduleWakeupTarget = { readonly kind: \"dynamic\" | \"fixed\"; readonly loopId: LoopId } | null;\n\nexport interface ScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\nexport interface ScheduleWakeupOutcome {\n\treadonly wakeupId: WakeupId;\n\t/** Set when this schedule replaced a still-pending wakeup for the same loop. */\n\treadonly replacedWakeupId?: WakeupId;\n\treadonly dueAt: EpochMs;\n\treadonly noopStreak: number;\n}\n\nexport interface StopDynamicLoopRequest {\n\treadonly loopId: LoopId;\n\treadonly reason: string;\n}\n\nexport interface StopDynamicLoopOutcome {\n\treadonly endedAt: EpochMs;\n}\n\n/**\n * Minimal scheduler surface this tool needs. Declared locally so the tool module stays\n * independent of the scheduler implementation and testable with a fake.\n */\nexport interface ScheduleWakeupSchedulerPort {\n\t/** Loop the current turn is attributed to, resolved at call time. */\n\tgetWakeupTarget(): ScheduleWakeupTarget;\n\tscheduleWakeup(request: ScheduleWakeupRequest): Promise<ScheduleWakeupOutcome>;\n\tstopDynamicLoop(request: StopDynamicLoopRequest): Promise<StopDynamicLoopOutcome>;\n}\n\nexport interface LoopToolRegistrationDeps {\n\treadonly scheduler: ScheduleWakeupSchedulerPort;\n}\n\nexport const NO_ACTIVE_DYNAMIC_LOOP_ERROR = `${SCHEDULE_WAKEUP_TOOL} can only be used while a dynamic /loop is active.`;\nexport const FIXED_TICK_ERROR = `This is a fixed /loop tick; the recurring schedule re-arms automatically. Do not call ${SCHEDULE_WAKEUP_TOOL}.`;\nexport const MISSING_PROMPT_ERROR = \"prompt is required and must be non-empty unless stop is true.\";\nexport const MISSING_DELAY_ERROR = \"delaySeconds is required unless stop is true.\";\nexport const NON_INTEGER_DELAY_ERROR = \"delaySeconds must be a finite integer number of seconds.\";\nexport const BLANK_REASON_ERROR = \"reason is required and must be non-empty.\";\nexport const NOOP_WITH_STOP_ERROR = \"noop must be omitted when stop is true.\";\n\nfunction clampDelaySeconds(requested: number): number {\n\treturn Math.min(MAX_WAKEUP_DELAY_SECONDS, Math.max(MIN_WAKEUP_DELAY_SECONDS, requested));\n}\n\nfunction resolveDynamicLoopId(scheduler: ScheduleWakeupSchedulerPort): LoopId {\n\tconst target = scheduler.getWakeupTarget();\n\tif (target === null) throw new Error(NO_ACTIVE_DYNAMIC_LOOP_ERROR);\n\tif (target.kind === \"fixed\") throw new Error(FIXED_TICK_ERROR);\n\treturn target.loopId;\n}\n\nfunction requireReason(reason: string): string {\n\tconst trimmed = typeof reason === \"string\" ? reason.trim() : \"\";\n\tif (trimmed.length === 0) throw new Error(BLANK_REASON_ERROR);\n\treturn trimmed;\n}\n\nfunction collectIgnoredFields(params: ScheduleWakeupParams): ScheduleWakeupIgnorableField[] {\n\tconst ignored: ScheduleWakeupIgnorableField[] = [];\n\tif (params.delaySeconds !== undefined) ignored.push(\"delaySeconds\");\n\tif (params.prompt !== undefined) ignored.push(\"prompt\");\n\treturn ignored;\n}\n\nasync function executeStop(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tif (params.noop !== undefined) throw new Error(NOOP_WITH_STOP_ERROR);\n\tconst reason = requireReason(params.reason);\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst ignoredFields = collectIgnoredFields(params);\n\tconst { endedAt } = await scheduler.stopDynamicLoop({ loopId, reason });\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `Stopped dynamic loop ${loopId}.` }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"stopped\",\n\t\t\tloopId,\n\t\t\tterminalReason: \"stopped\",\n\t\t\treason,\n\t\t\tendedAt,\n\t\t\tignoredFields,\n\t\t},\n\t};\n}\n\nasync function executeSchedule(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tconst reason = requireReason(params.reason);\n\tconst requestedDelaySeconds = params.delaySeconds;\n\tif (requestedDelaySeconds === undefined) throw new Error(MISSING_DELAY_ERROR);\n\tif (!Number.isInteger(requestedDelaySeconds)) throw new Error(NON_INTEGER_DELAY_ERROR);\n\tconst prompt = params.prompt;\n\tif (prompt === undefined || prompt.trim().length === 0) throw new Error(MISSING_PROMPT_ERROR);\n\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst delaySeconds = clampDelaySeconds(requestedDelaySeconds);\n\tconst clamped = delaySeconds !== requestedDelaySeconds;\n\tconst noop = params.noop === true;\n\n\tconst outcome = await scheduler.scheduleWakeup({\n\t\tloopId,\n\t\trequestedDelaySeconds,\n\t\tdelaySeconds,\n\t\treason,\n\t\tprompt,\n\t\tnoop,\n\t});\n\n\tconst text = clamped\n\t\t? `Scheduled loop ${loopId} in ${delaySeconds}s; requested ${requestedDelaySeconds}s was clamped to the supported ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}s range.`\n\t\t: `Scheduled loop ${loopId} in ${delaySeconds}s.`;\n\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"scheduled\",\n\t\t\tloopId,\n\t\t\twakeupId: outcome.wakeupId,\n\t\t\t...(outcome.replacedWakeupId === undefined ? {} : { replacedWakeupId: outcome.replacedWakeupId }),\n\t\t\trequestedDelaySeconds,\n\t\t\tdelaySeconds,\n\t\t\tclamped,\n\t\t\tdueAt: outcome.dueAt,\n\t\t\treason,\n\t\t\tprompt,\n\t\t\tnoop,\n\t\t\tnoopStreak: outcome.noopStreak,\n\t\t},\n\t};\n}\n\nexport function registerLoopTools(pi: ExtensionAPI, deps: LoopToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: SCHEDULE_WAKEUP_TOOL,\n\t\tlabel: \"Schedule Wakeup\",\n\t\tdescription: SCHEDULE_WAKEUP_DESCRIPTION,\n\t\tparameters: scheduleWakeupSchema,\n\t\t// Sequential so two concurrent model tool calls cannot race scheduler state.\n\t\texecutionMode: \"sequential\",\n\t\tasync execute(_toolCallId, params): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\t\t\treturn params.stop === true ? executeStop(deps.scheduler, params) : executeSchedule(deps.scheduler, params);\n\t\t},\n\t});\n}\n"]}
|
|
1
|
+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CAAC,EAAgB,EAAE,IAA8B;IACjF,EAAE,CAAC,YAAY,CAAC;QACf,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,2BAA2B;QACxC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,QAAQ;QAClB,mBAAmB,EAAE,KAAK;QAC1B,6EAA6E;QAC7E,aAAa,EAAE,YAAY;QAC3B,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`\n * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.\n *\n * Exposure: the tool is registered `exposure: \"search\"` with lazy activation disabled, so it is\n * absent from the resident tool list (and from `tool_search`) until the loop extension activates it\n * for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is\n * an error, so a resident registration only cost prompt tokens.\n *\n * Two deliberate shape decisions:\n * - The TypeBox schema is a FLAT object with no root union. Several provider payload\n * conversions rebuild tool schemas from top-level `properties` only, so a root\n * `anyOf` would reach the model as an empty schema (same reasoning as\n * `terminal/tools/monitor.ts`). Branch requirements are enforced in `execute`.\n * - `delaySeconds` carries NO schema `minimum`/`maximum`. The contract clamps\n * out-of-range integers instead of rejecting them, and schema bounds would make the\n * clamp unreachable.\n *\n * Scheduler state is never mutated here: every effect goes through the injected\n * `ScheduleWakeupSchedulerPort`.\n */\n\nimport { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI } from \"../../types.ts\";\nimport type { EpochMs, LoopId, WakeupId } from \"./types.ts\";\n\n/** Model-visible tool name. */\nexport const SCHEDULE_WAKEUP_TOOL = \"schedule_wakeup\";\n\n/** Inclusive bounds the executor clamps `delaySeconds` into. */\nexport const MIN_WAKEUP_DELAY_SECONDS = 60;\nexport const MAX_WAKEUP_DELAY_SECONDS = 3600;\n\nexport const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \\`prompt\\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \\`stop: true\\` to end the active dynamic loop immediately.\n\n\\`delaySeconds\\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set \\`prompt\\` to the complete original command, for example \\`/loop check the deploy\\`, preserving the user's text verbatim. Set \\`noop: true\\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \\`noop\\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;\n\nexport const scheduleWakeupSchema = Type.Object(\n\t{\n\t\tdelaySeconds: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: `Dynamic loop delay in seconds. Values are clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}.`,\n\t\t\t}),\n\t\t),\n\t\treason: Type.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Why this wakeup or stop is appropriate. Must not be blank.\",\n\t\t}),\n\t\tprompt: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Prompt to dispatch when the wakeup fires. Required unless stop is true; preserve the original /loop command verbatim for normal dynamic re-entry.\",\n\t\t\t}),\n\t\t),\n\t\tstop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"End the active dynamic loop immediately instead of scheduling another wakeup.\",\n\t\t\t}),\n\t\t),\n\t\tnoop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"True when this iteration observed no actionable change. Consecutive noop iterations are folded in the terminal view. Omit when stopping.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** Runtime-validated parameter shape; the schema itself stays flat and permissive. */\nexport interface ScheduleWakeupParams {\n\treadonly delaySeconds?: number;\n\treadonly reason: string;\n\treadonly prompt?: string;\n\treadonly stop?: boolean;\n\treadonly noop?: boolean;\n}\n\nexport interface ScheduleWakeupScheduledDetails {\n\treadonly ok: true;\n\treadonly action: \"scheduled\";\n\treadonly loopId: LoopId;\n\treadonly wakeupId: WakeupId;\n\treadonly replacedWakeupId?: WakeupId;\n\n\t/** Integer the model asked for, before the clamp. */\n\treadonly requestedDelaySeconds: number;\n\t/** Effective delay after clamping to `[60, 3600]`. */\n\treadonly delaySeconds: number;\n\treadonly clamped: boolean;\n\treadonly dueAt: EpochMs;\n\n\treadonly reason: string;\n\t/** Preserved verbatim after the non-blank check. */\n\treadonly prompt: string;\n\treadonly noop: boolean;\n\treadonly noopStreak: number;\n}\n\nexport interface ScheduleWakeupStoppedDetails {\n\treadonly ok: true;\n\treadonly action: \"stopped\";\n\treadonly loopId: LoopId;\n\treadonly terminalReason: \"stopped\";\n\treadonly reason: string;\n\treadonly endedAt: EpochMs;\n\t/** Fields accepted for model compatibility but not applied. */\n\treadonly ignoredFields: readonly ScheduleWakeupIgnorableField[];\n}\n\nexport type ScheduleWakeupIgnorableField = \"delaySeconds\" | \"prompt\";\n\nexport type ScheduleWakeupDetails = ScheduleWakeupScheduledDetails | ScheduleWakeupStoppedDetails;\n\n/**\n * Which loop, if any, this tool call belongs to. `null` means no loop context at all;\n * a `fixed` target means the call came from a fixed tick, whose schedule re-arms itself.\n */\nexport type ScheduleWakeupTarget = { readonly kind: \"dynamic\" | \"fixed\"; readonly loopId: LoopId } | null;\n\nexport interface ScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\nexport interface ScheduleWakeupOutcome {\n\treadonly wakeupId: WakeupId;\n\t/** Set when this schedule replaced a still-pending wakeup for the same loop. */\n\treadonly replacedWakeupId?: WakeupId;\n\treadonly dueAt: EpochMs;\n\treadonly noopStreak: number;\n}\n\nexport interface StopDynamicLoopRequest {\n\treadonly loopId: LoopId;\n\treadonly reason: string;\n}\n\nexport interface StopDynamicLoopOutcome {\n\treadonly endedAt: EpochMs;\n}\n\n/**\n * Minimal scheduler surface this tool needs. Declared locally so the tool module stays\n * independent of the scheduler implementation and testable with a fake.\n */\nexport interface ScheduleWakeupSchedulerPort {\n\t/** Loop the current turn is attributed to, resolved at call time. */\n\tgetWakeupTarget(): ScheduleWakeupTarget;\n\tscheduleWakeup(request: ScheduleWakeupRequest): Promise<ScheduleWakeupOutcome>;\n\tstopDynamicLoop(request: StopDynamicLoopRequest): Promise<StopDynamicLoopOutcome>;\n}\n\nexport interface LoopToolRegistrationDeps {\n\treadonly scheduler: ScheduleWakeupSchedulerPort;\n}\n\nexport const NO_ACTIVE_DYNAMIC_LOOP_ERROR = `${SCHEDULE_WAKEUP_TOOL} can only be used while a dynamic /loop is active.`;\nexport const FIXED_TICK_ERROR = `This is a fixed /loop tick; the recurring schedule re-arms automatically. Do not call ${SCHEDULE_WAKEUP_TOOL}.`;\nexport const MISSING_PROMPT_ERROR = \"prompt is required and must be non-empty unless stop is true.\";\nexport const MISSING_DELAY_ERROR = \"delaySeconds is required unless stop is true.\";\nexport const NON_INTEGER_DELAY_ERROR = \"delaySeconds must be a finite integer number of seconds.\";\nexport const BLANK_REASON_ERROR = \"reason is required and must be non-empty.\";\nexport const NOOP_WITH_STOP_ERROR = \"noop must be omitted when stop is true.\";\n\nfunction clampDelaySeconds(requested: number): number {\n\treturn Math.min(MAX_WAKEUP_DELAY_SECONDS, Math.max(MIN_WAKEUP_DELAY_SECONDS, requested));\n}\n\nfunction resolveDynamicLoopId(scheduler: ScheduleWakeupSchedulerPort): LoopId {\n\tconst target = scheduler.getWakeupTarget();\n\tif (target === null) throw new Error(NO_ACTIVE_DYNAMIC_LOOP_ERROR);\n\tif (target.kind === \"fixed\") throw new Error(FIXED_TICK_ERROR);\n\treturn target.loopId;\n}\n\nfunction requireReason(reason: string): string {\n\tconst trimmed = typeof reason === \"string\" ? reason.trim() : \"\";\n\tif (trimmed.length === 0) throw new Error(BLANK_REASON_ERROR);\n\treturn trimmed;\n}\n\nfunction collectIgnoredFields(params: ScheduleWakeupParams): ScheduleWakeupIgnorableField[] {\n\tconst ignored: ScheduleWakeupIgnorableField[] = [];\n\tif (params.delaySeconds !== undefined) ignored.push(\"delaySeconds\");\n\tif (params.prompt !== undefined) ignored.push(\"prompt\");\n\treturn ignored;\n}\n\nasync function executeStop(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tif (params.noop !== undefined) throw new Error(NOOP_WITH_STOP_ERROR);\n\tconst reason = requireReason(params.reason);\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst ignoredFields = collectIgnoredFields(params);\n\tconst { endedAt } = await scheduler.stopDynamicLoop({ loopId, reason });\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `Stopped dynamic loop ${loopId}.` }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"stopped\",\n\t\t\tloopId,\n\t\t\tterminalReason: \"stopped\",\n\t\t\treason,\n\t\t\tendedAt,\n\t\t\tignoredFields,\n\t\t},\n\t};\n}\n\nasync function executeSchedule(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tconst reason = requireReason(params.reason);\n\tconst requestedDelaySeconds = params.delaySeconds;\n\tif (requestedDelaySeconds === undefined) throw new Error(MISSING_DELAY_ERROR);\n\tif (!Number.isInteger(requestedDelaySeconds)) throw new Error(NON_INTEGER_DELAY_ERROR);\n\tconst prompt = params.prompt;\n\tif (prompt === undefined || prompt.trim().length === 0) throw new Error(MISSING_PROMPT_ERROR);\n\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst delaySeconds = clampDelaySeconds(requestedDelaySeconds);\n\tconst clamped = delaySeconds !== requestedDelaySeconds;\n\tconst noop = params.noop === true;\n\n\tconst outcome = await scheduler.scheduleWakeup({\n\t\tloopId,\n\t\trequestedDelaySeconds,\n\t\tdelaySeconds,\n\t\treason,\n\t\tprompt,\n\t\tnoop,\n\t});\n\n\tconst text = clamped\n\t\t? `Scheduled loop ${loopId} in ${delaySeconds}s; requested ${requestedDelaySeconds}s was clamped to the supported ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}s range.`\n\t\t: `Scheduled loop ${loopId} in ${delaySeconds}s.`;\n\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"scheduled\",\n\t\t\tloopId,\n\t\t\twakeupId: outcome.wakeupId,\n\t\t\t...(outcome.replacedWakeupId === undefined ? {} : { replacedWakeupId: outcome.replacedWakeupId }),\n\t\t\trequestedDelaySeconds,\n\t\t\tdelaySeconds,\n\t\t\tclamped,\n\t\t\tdueAt: outcome.dueAt,\n\t\t\treason,\n\t\t\tprompt,\n\t\t\tnoop,\n\t\t\tnoopStreak: outcome.noopStreak,\n\t\t},\n\t};\n}\n\nexport function registerLoopTools(pi: ExtensionAPI, deps: LoopToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: SCHEDULE_WAKEUP_TOOL,\n\t\tlabel: \"Schedule Wakeup\",\n\t\tdescription: SCHEDULE_WAKEUP_DESCRIPTION,\n\t\tparameters: scheduleWakeupSchema,\n\t\texposure: \"search\",\n\t\tallowLazyActivation: false,\n\t\t// Sequential so two concurrent model tool calls cannot race scheduler state.\n\t\texecutionMode: \"sequential\",\n\t\tasync execute(_toolCallId, params): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\t\t\treturn params.stop === true ? executeStop(deps.scheduler, params) : executeSchedule(deps.scheduler, params);\n\t\t},\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-opus-4-5.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAOlH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAWxF"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
|
|
2
2
|
import { buildExecutionToolingSection } from "./execution-tooling.js";
|
|
3
3
|
function buildClaudeOpus45Tuning() {
|
|
4
|
-
return `Break complex tasks into ordered steps with clear dependencies before executing. When a request covers a set of items, apply it to every item rather than only the first, and state the scope you applied
|
|
5
|
-
|
|
6
|
-
Do not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until the task is complete.`;
|
|
4
|
+
return `Break complex tasks into ordered steps with clear dependencies before executing. When a request covers a set of items, apply it to every item rather than only the first, and state the scope you applied.`;
|
|
7
5
|
}
|
|
8
6
|
export function buildClaudeOpus45Prompt(options) {
|
|
9
7
|
return buildDynamicSystemPrompt({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO
|
|
1
|
+
{"version":3,"file":"claude-opus-4-5.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-5.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO,4MAA4M,CAAC;AACrN,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,aAAa,EAAE;YACd,4BAA4B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YACrF,uBAAuB,EAAE;SACzB;aACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;aACvC,IAAI,CAAC,MAAM,CAAC;QACd,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildExecutionToolingSection } from \"./execution-tooling.ts\";\n\nfunction buildClaudeOpus45Tuning(): string {\n\treturn `Break complex tasks into ordered steps with clear dependencies before executing. When a request covers a set of items, apply it to every item rather than only the first, and state the scope you applied.`;\n}\n\nexport function buildClaudeOpus45Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\ttuningSection: [\n\t\t\tbuildExecutionToolingSection({ toolNames: options.selectedTools, dialect: \"claude\" }),\n\t\t\tbuildClaudeOpus45Tuning(),\n\t\t]\n\t\t\t.filter((section) => section.length > 0)\n\t\t\t.join(\"\\n\\n\"),\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-6.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"claude-opus-4-6.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAGlH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAMxF"}
|
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { buildDynamicSystemPrompt } from "../../../dynamic-prompt/build.js";
|
|
2
2
|
import { buildExecutionToolingSection } from "./execution-tooling.js";
|
|
3
|
-
function buildClaudeOpus46Tuning() {
|
|
4
|
-
return `Choose an approach and commit to it; revisit only when new information directly contradicts your reasoning. When a request covers a set of items, apply it to every item and state the scope you applied.
|
|
5
|
-
|
|
6
|
-
Do not wrap up early because the context window is running low; the harness auto-compacts context. Keep working until the task is complete.`;
|
|
7
|
-
}
|
|
8
3
|
export function buildClaudeOpus46Prompt(options) {
|
|
9
4
|
return buildDynamicSystemPrompt({
|
|
10
5
|
...options,
|
|
11
|
-
tuningSection:
|
|
12
|
-
buildExecutionToolingSection({ toolNames: options.selectedTools, dialect: "claude" }),
|
|
13
|
-
buildClaudeOpus46Tuning(),
|
|
14
|
-
]
|
|
15
|
-
.filter((section) => section.length > 0)
|
|
16
|
-
.join("\n\n"),
|
|
6
|
+
tuningSection: buildExecutionToolingSection({ toolNames: options.selectedTools, dialect: "claude" }),
|
|
17
7
|
workstationDialect: "claude",
|
|
18
8
|
});
|
|
19
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,
|
|
1
|
+
{"version":3,"file":"claude-opus-4-6.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,aAAa,EAAE,4BAA4B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;QACpG,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildExecutionToolingSection } from \"./execution-tooling.ts\";\n\nexport function buildClaudeOpus46Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\ttuningSection: buildExecutionToolingSection({ toolNames: options.selectedTools, dialect: \"claude\" }),\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
|
|
@@ -5,9 +5,9 @@ function buildClaudeOpus47Tuning() {
|
|
|
5
5
|
|
|
6
6
|
Prefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Spawn the subagents for a fan-out across items or files in the same turn, not one at a time.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
For frontend design with no specified visual direction, derive one from the project's context or propose distinct options before building; do not fall back to your default cream/serif/terracotta house style or generic AI aesthetics.`;
|
|
11
11
|
}
|
|
12
12
|
export function buildClaudeOpus47Prompt(options) {
|
|
13
13
|
return buildDynamicSystemPrompt({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-7.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-7.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO;;;;;;
|
|
1
|
+
{"version":3,"file":"claude-opus-4-7.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-7.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO;;;;;;yOAMiO,CAAC;AAC1O,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,aAAa,EAAE;YACd,4BAA4B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YACrF,uBAAuB,EAAE;SACzB;aACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;aACvC,IAAI,CAAC,MAAM,CAAC;QACd,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildExecutionToolingSection } from \"./execution-tooling.ts\";\n\nfunction buildClaudeOpus47Tuning(): string {\n\treturn `Apply instructions at the scope the user evidently intends: \"every\", \"all\", and \"each\" mean the full set rather than the first item, and a fix that plainly recurs covers every occurrence. State the scope you applied.\n\nPrefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up.\n\nSpawn the subagents for a fan-out across items or files in the same turn, not one at a time.\n\nFor frontend design with no specified visual direction, derive one from the project's context or propose distinct options before building; do not fall back to your default cream/serif/terracotta house style or generic AI aesthetics.`;\n}\n\nexport function buildClaudeOpus47Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\ttuningSection: [\n\t\t\tbuildExecutionToolingSection({ toolNames: options.selectedTools, dialect: \"claude\" }),\n\t\t\tbuildClaudeOpus47Tuning(),\n\t\t]\n\t\t\t.filter((section) => section.length > 0)\n\t\t\t.join(\"\\n\\n\"),\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
|
|
@@ -3,11 +3,11 @@ import { buildExecutionToolingSection } from "./execution-tooling.js";
|
|
|
3
3
|
function buildClaudeOpus48Tuning() {
|
|
4
4
|
return `Apply instructions at the scope the user evidently intends: "every", "all", and "each" mean the full set rather than the first item, and a fix that plainly recurs covers every occurrence. State the scope you applied.
|
|
5
5
|
|
|
6
|
-
Prefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up. After a user turn, reason over what changed
|
|
6
|
+
Prefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up. After a user turn, reason over what changed rather than over the whole conversation.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Spawn the subagents for a fan-out across items or files in the same turn, not one at a time.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
For frontend design with no specified visual direction, derive one from the project's context or propose distinct options before building; do not fall back to your default cream/serif/terracotta house style or generic AI aesthetics.`;
|
|
11
11
|
}
|
|
12
12
|
export function buildClaudeOpus48Prompt(options) {
|
|
13
13
|
return buildDynamicSystemPrompt({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claude-opus-4-8.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO;;;;;;
|
|
1
|
+
{"version":3,"file":"claude-opus-4-8.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/claude-opus-4-8.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,SAAS,uBAAuB;IAC/B,OAAO;;;;;;yOAMiO,CAAC;AAC1O,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAwC;IAC/E,OAAO,wBAAwB,CAAC;QAC/B,GAAG,OAAO;QACV,aAAa,EAAE;YACd,4BAA4B,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;YACrF,uBAAuB,EAAE;SACzB;aACC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;aACvC,IAAI,CAAC,MAAM,CAAC;QACd,kBAAkB,EAAE,QAAQ;KAC5B,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { type BuildDynamicSystemPromptOptions, buildDynamicSystemPrompt } from \"../../../dynamic-prompt/build.ts\";\nimport { buildExecutionToolingSection } from \"./execution-tooling.ts\";\n\nfunction buildClaudeOpus48Tuning(): string {\n\treturn `Apply instructions at the scope the user evidently intends: \"every\", \"all\", and \"each\" mean the full set rather than the first item, and a fix that plainly recurs covers every occurrence. State the scope you applied.\n\nPrefer tool calls over reasoning when a tool can resolve the question directly; do not reason past a fact you can look up. After a user turn, reason over what changed rather than over the whole conversation.\n\nSpawn the subagents for a fan-out across items or files in the same turn, not one at a time.\n\nFor frontend design with no specified visual direction, derive one from the project's context or propose distinct options before building; do not fall back to your default cream/serif/terracotta house style or generic AI aesthetics.`;\n}\n\nexport function buildClaudeOpus48Prompt(options: BuildDynamicSystemPromptOptions): string {\n\treturn buildDynamicSystemPrompt({\n\t\t...options,\n\t\ttuningSection: [\n\t\t\tbuildExecutionToolingSection({ toolNames: options.selectedTools, dialect: \"claude\" }),\n\t\t\tbuildClaudeOpus48Tuning(),\n\t\t]\n\t\t\t.filter((section) => section.length > 0)\n\t\t\t.join(\"\\n\\n\"),\n\t\tworkstationDialect: \"claude\",\n\t});\n}\n"]}
|