@code-yeongyu/senpi 2026.9.4 → 2026.9.5
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 +116 -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 +17 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +86 -3
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +31 -41
- package/dist/core/auth-storage.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/credential-pool/state-store.d.ts +1 -0
- package/dist/core/credential-pool/state-store.d.ts.map +1 -1
- package/dist/core/credential-pool/state-store.js +22 -2
- package/dist/core/credential-pool/state-store.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/index.js +1 -5
- package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +0 -2
- package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
- package/dist/core/extensions/builtin/bash-timeout/timeout.js +3 -4
- package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts +5 -0
- package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/model-usability-budget.js +11 -4
- package/dist/core/extensions/builtin/compaction/model-usability-budget.js.map +1 -1
- 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/store.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/store.js +8 -20
- package/dist/core/extensions/builtin/goal/store.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/hooks/trust-storage.d.ts.map +1 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js +3 -1
- package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
- package/dist/core/extensions/builtin/imagegen/auth.d.ts.map +1 -1
- package/dist/core/extensions/builtin/imagegen/auth.js +10 -2
- package/dist/core/extensions/builtin/imagegen/auth.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/store.d.ts +8 -6
- package/dist/core/extensions/builtin/loop/store.d.ts.map +1 -1
- package/dist/core/extensions/builtin/loop/store.js +54 -88
- package/dist/core/extensions/builtin/loop/store.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/monitor-state-event.d.ts +2 -0
- package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
- package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +9 -5
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +20 -11
- package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/recommended-models/index.js +1 -0
- package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +12 -4
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/durable-command.d.ts +31 -0
- package/dist/core/extensions/builtin/terminal/durable-command.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/durable-command.js +96 -0
- package/dist/core/extensions/builtin/terminal/durable-command.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/durable-file.d.ts +42 -0
- package/dist/core/extensions/builtin/terminal/durable-file.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/durable-file.js +102 -0
- package/dist/core/extensions/builtin/terminal/durable-file.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +226 -3
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.d.ts +10 -0
- package/dist/core/extensions/builtin/terminal/manager.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.js +21 -0
- package/dist/core/extensions/builtin/terminal/manager.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts +24 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.js +105 -0
- package/dist/core/extensions/builtin/terminal/manifest-lease.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-notify.js +5 -1
- package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +42 -2
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +73 -2
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-status.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-status.js +21 -1
- package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/prompt.js +9 -5
- package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/restore.d.ts +56 -0
- package/dist/core/extensions/builtin/terminal/restore.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/restore.js +177 -0
- package/dist/core/extensions/builtin/terminal/restore.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/shared.d.ts +25 -0
- package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/shared.js +25 -0
- package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts +91 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js +14 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts +62 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.js +204 -0
- package/dist/core/extensions/builtin/terminal/terminal-manifest.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/tools/bash-input.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-input.js +3 -2
- package/dist/core/extensions/builtin/terminal/tools/bash-input.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js +5 -4
- package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.js +3 -2
- package/dist/core/extensions/builtin/terminal/tools/bash-resize.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts +8 -0
- package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/context.js +10 -0
- package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.js +5 -4
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +4 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.js +114 -22
- package/dist/core/extensions/builtin/terminal/tools/monitor.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/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/index.js +1 -1
- package/dist/core/extensions/builtin/tool-search/index.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts +9 -4
- package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-search.js +11 -6
- package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
- package/dist/core/extensions/builtin/tool-search/native-support.d.ts +13 -0
- package/dist/core/extensions/builtin/tool-search/native-support.d.ts.map +1 -0
- package/dist/core/extensions/builtin/tool-search/native-support.js +45 -0
- package/dist/core/extensions/builtin/tool-search/native-support.js.map +1 -0
- 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/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +18 -1
- package/dist/core/footer-data-provider.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/lockfile-policy.d.ts +11 -0
- package/dist/core/lockfile-policy.d.ts.map +1 -1
- package/dist/core/lockfile-policy.js +19 -0
- package/dist/core/lockfile-policy.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/retry-fallback/chains.d.ts +1 -13
- package/dist/core/retry-fallback/chains.d.ts.map +1 -1
- package/dist/core/retry-fallback/chains.js +3 -49
- package/dist/core/retry-fallback/chains.js.map +1 -1
- package/dist/core/retry-fallback/controller.d.ts.map +1 -1
- package/dist/core/retry-fallback/controller.js +4 -9
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/expansion.js +1 -1
- package/dist/core/retry-fallback/expansion.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts +2 -4
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +7 -36
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +1 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +10 -3
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-sidecar-store.d.ts +62 -0
- package/dist/core/session-sidecar-store.d.ts.map +1 -0
- package/dist/core/session-sidecar-store.js +149 -0
- package/dist/core/session-sidecar-store.js.map +1 -0
- package/dist/core/settings-manager.d.ts +5 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +45 -15
- 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/app-server/daemon/process.d.ts +33 -3
- package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
- package/dist/modes/app-server/daemon/process.js +57 -6
- package/dist/modes/app-server/daemon/process.js.map +1 -1
- package/dist/modes/app-server/daemon.js +9 -1
- package/dist/modes/app-server/daemon.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 +83 -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/rpc/host-ensure.d.ts +2 -0
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +77 -18
- package/dist/modes/rpc/host-ensure.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 +1 -1
- package/docs/settings.md +13 -5
- package/docs/terminal-setup.md +27 -0
- package/docs/terminal-tools.md +35 -4
- package/docs/usage.md +5 -3
- 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 +45 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +4 -2
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +29 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +8 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +3 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/display-image.js +162 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +29 -60
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +66 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +28 -94
- 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 +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +14 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +12 -7
- 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/cursor-agent.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- 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-codex-responses.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +3 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.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 +30 -10
- 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-shared.d.ts +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +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 +8 -5
- 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/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/image-models.generated.d.ts +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +30 -0
- package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.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 +3 -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 +27 -3
- 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/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/opencode.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/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/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.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 +8 -8
|
@@ -1,60 +1,79 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Atomic, versioned, per-session sidecar store for `/loop` state.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Persistence (temp file + rename, per-file mutation serialization, envelope
|
|
5
|
+
* version/session checks) lives in the shared session sidecar primitive. This
|
|
6
|
+
* module supplies the loop domain parser and keeps the historical exported
|
|
7
|
+
* surface so callers continue to catch {@link InvalidLoopStoreError} /
|
|
8
|
+
* {@link UnsupportedLoopStoreVersionError} by name.
|
|
8
9
|
*
|
|
9
10
|
* Session custom entries are deliberately NOT the authoritative store: they are branch
|
|
10
11
|
* nodes, so a globally scanned "latest" entry can come from an abandoned branch, while
|
|
11
12
|
* loop schedules are session-scoped.
|
|
12
13
|
*/
|
|
13
|
-
import {
|
|
14
|
-
import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
15
|
-
import { dirname, join } from "node:path";
|
|
14
|
+
import { createSidecarStore, encodedSessionId as encodeSidecarSessionId, InvalidSidecarStoreError, sidecarFilePath, UnsupportedSidecarStoreVersionError, } from "../../../session-sidecar-store.js";
|
|
16
15
|
import { EFFECTIVE_INTERVAL_UNITS, isRecord, LOOP_END_REASONS, LOOP_PHASES, LOOP_SENTINELS, LOOP_STATE_VERSION, LOOP_WAKE_SOURCE_KINDS, REQUESTED_INTERVAL_UNITS, } from "./types.js";
|
|
17
|
-
export class InvalidLoopStoreError extends
|
|
16
|
+
export class InvalidLoopStoreError extends InvalidSidecarStoreError {
|
|
18
17
|
constructor(message, options) {
|
|
19
18
|
super(message, options);
|
|
20
19
|
this.name = "InvalidLoopStoreError";
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
export class UnsupportedLoopStoreVersionError extends
|
|
22
|
+
export class UnsupportedLoopStoreVersionError extends UnsupportedSidecarStoreVersionError {
|
|
24
23
|
constructor(message) {
|
|
25
24
|
super(message);
|
|
26
25
|
this.name = "UnsupportedLoopStoreVersionError";
|
|
27
26
|
}
|
|
28
27
|
}
|
|
29
|
-
const
|
|
30
|
-
const snapshots = new Map();
|
|
28
|
+
const stores = new Map();
|
|
31
29
|
export function encodedSessionId(ref) {
|
|
32
|
-
return
|
|
30
|
+
return encodeSidecarSessionId(ref.sessionId);
|
|
33
31
|
}
|
|
34
32
|
export function loopStateFilePath(ref) {
|
|
35
|
-
return
|
|
33
|
+
return sidecarFilePath(ref);
|
|
36
34
|
}
|
|
37
35
|
export function emptyLoopState(sessionId) {
|
|
38
36
|
return { version: LOOP_STATE_VERSION, sessionId, entries: {}, activeDynamicId: null, updatedAt: 0 };
|
|
39
37
|
}
|
|
38
|
+
function storeFor(ref) {
|
|
39
|
+
const filePath = loopStateFilePath(ref);
|
|
40
|
+
const existing = stores.get(filePath);
|
|
41
|
+
if (existing !== undefined)
|
|
42
|
+
return existing;
|
|
43
|
+
const store = createSidecarStore({
|
|
44
|
+
baseDir: ref.baseDir,
|
|
45
|
+
sessionId: ref.sessionId,
|
|
46
|
+
version: LOOP_STATE_VERSION,
|
|
47
|
+
tempPrefix: "loop",
|
|
48
|
+
parse: parseLoopPayload,
|
|
49
|
+
});
|
|
50
|
+
stores.set(filePath, store);
|
|
51
|
+
return store;
|
|
52
|
+
}
|
|
53
|
+
function remapLoopStoreError(error) {
|
|
54
|
+
if (error instanceof InvalidLoopStoreError || error instanceof UnsupportedLoopStoreVersionError) {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
if (error instanceof UnsupportedSidecarStoreVersionError) {
|
|
58
|
+
throw new UnsupportedLoopStoreVersionError(error.message.replaceAll("sidecar store", "loop store"));
|
|
59
|
+
}
|
|
60
|
+
if (error instanceof InvalidSidecarStoreError) {
|
|
61
|
+
throw new InvalidLoopStoreError(error.message.replaceAll("sidecar store", "loop store"), { cause: error });
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
40
65
|
/**
|
|
41
66
|
* Reads persisted state, or null when this session has never persisted any loop.
|
|
42
67
|
* Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on
|
|
43
68
|
* unusable state so callers fail closed rather than resetting a user's schedule.
|
|
44
69
|
*/
|
|
45
70
|
export async function readLoopState(ref) {
|
|
46
|
-
let raw;
|
|
47
71
|
try {
|
|
48
|
-
|
|
72
|
+
return await storeFor(ref).read();
|
|
49
73
|
}
|
|
50
74
|
catch (error) {
|
|
51
|
-
|
|
52
|
-
return null;
|
|
53
|
-
throw error;
|
|
75
|
+
remapLoopStoreError(error);
|
|
54
76
|
}
|
|
55
|
-
const state = parseLoopState(raw, ref);
|
|
56
|
-
snapshots.set(loopStateFilePath(ref), state);
|
|
57
|
-
return state;
|
|
58
77
|
}
|
|
59
78
|
/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */
|
|
60
79
|
export async function loadLoopState(ref) {
|
|
@@ -65,88 +84,38 @@ export async function loadLoopState(ref) {
|
|
|
65
84
|
* (status line, tick attribution). Undefined until the store has been touched.
|
|
66
85
|
*/
|
|
67
86
|
export function snapshotLoopState(ref) {
|
|
68
|
-
return
|
|
87
|
+
return storeFor(ref).snapshot();
|
|
69
88
|
}
|
|
70
89
|
/**
|
|
71
90
|
* Serializes read-modify-write cycles through a per-file promise tail so command,
|
|
72
91
|
* timer, tool, and lifecycle writes cannot interleave and lose an update.
|
|
73
92
|
*/
|
|
74
93
|
export function mutateLoopState(ref, mutation) {
|
|
75
|
-
return
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
await writeLoopState(ref, next);
|
|
79
|
-
return next;
|
|
80
|
-
});
|
|
94
|
+
return storeFor(ref)
|
|
95
|
+
.mutate((current) => mutation(current ?? emptyLoopState(ref.sessionId)))
|
|
96
|
+
.catch((error) => remapLoopStoreError(error));
|
|
81
97
|
}
|
|
82
98
|
/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */
|
|
83
99
|
export async function writeLoopState(ref, state) {
|
|
84
|
-
|
|
85
|
-
await mkdir(dirname(filePath), { recursive: true });
|
|
86
|
-
await writeAtomic(filePath, `${JSON.stringify(state, null, 2)}\n`);
|
|
87
|
-
snapshots.set(filePath, state);
|
|
100
|
+
await storeFor(ref).write(state);
|
|
88
101
|
}
|
|
89
102
|
/** Drops cached snapshots; used when a session ends or tests reset global state. */
|
|
90
103
|
export function clearLoopStateSnapshot(ref) {
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
function enqueue(ref, operation) {
|
|
94
|
-
const key = loopStateFilePath(ref);
|
|
95
|
-
const previous = mutationTails.get(key) ?? Promise.resolve();
|
|
96
|
-
const run = previous.then(operation);
|
|
97
|
-
const tail = run.then(() => undefined, () => undefined);
|
|
98
|
-
mutationTails.set(key, tail);
|
|
99
|
-
void tail.then(() => {
|
|
100
|
-
if (mutationTails.get(key) === tail)
|
|
101
|
-
mutationTails.delete(key);
|
|
102
|
-
});
|
|
103
|
-
return run;
|
|
104
|
+
storeFor(ref).clear();
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
try {
|
|
108
|
-
await writeFile(tempPath, contents, { encoding: "utf8", mode: 0o600 });
|
|
109
|
-
await rename(tempPath, filePath);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
try {
|
|
113
|
-
await rm(tempPath, { force: true });
|
|
114
|
-
}
|
|
115
|
-
catch (cleanupError) {
|
|
116
|
-
throw new AggregateError([error, cleanupError], "loop store write failed and its temporary file could not be removed");
|
|
117
|
-
}
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
function parseLoopState(raw, ref) {
|
|
122
|
-
let parsed;
|
|
123
|
-
try {
|
|
124
|
-
parsed = JSON.parse(raw);
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
throw new InvalidLoopStoreError("loop store contains unparseable JSON", { cause: error });
|
|
128
|
-
}
|
|
129
|
-
if (!isRecord(parsed))
|
|
106
|
+
function parseLoopPayload(raw, ref) {
|
|
107
|
+
if (!isRecord(raw))
|
|
130
108
|
throw new InvalidLoopStoreError("loop store must be a JSON object");
|
|
131
|
-
if (
|
|
132
|
-
throw new UnsupportedLoopStoreVersionError(`unsupported loop store version: ${JSON.stringify(parsed.version)} (expected ${LOOP_STATE_VERSION})`);
|
|
133
|
-
}
|
|
134
|
-
if (typeof parsed.sessionId !== "string" || parsed.sessionId.length === 0) {
|
|
135
|
-
throw new InvalidLoopStoreError("loop store is missing a sessionId");
|
|
136
|
-
}
|
|
137
|
-
if (parsed.sessionId !== ref.sessionId) {
|
|
138
|
-
throw new InvalidLoopStoreError(`loop store sessionId ${parsed.sessionId} does not match the session it was loaded for`);
|
|
139
|
-
}
|
|
140
|
-
if (!isEpochMs(parsed.updatedAt))
|
|
109
|
+
if (!isEpochMs(raw.updatedAt))
|
|
141
110
|
throw new InvalidLoopStoreError("loop store has an invalid updatedAt");
|
|
142
|
-
if (!isRecord(
|
|
111
|
+
if (!isRecord(raw.entries))
|
|
143
112
|
throw new InvalidLoopStoreError("loop store entries must be an object");
|
|
144
113
|
const entries = {};
|
|
145
|
-
for (const [id, value] of Object.entries(
|
|
114
|
+
for (const [id, value] of Object.entries(raw.entries)) {
|
|
146
115
|
const entry = parseEntry(id, value);
|
|
147
116
|
entries[id] = entry;
|
|
148
117
|
}
|
|
149
|
-
const activeDynamicId =
|
|
118
|
+
const activeDynamicId = raw.activeDynamicId;
|
|
150
119
|
if (activeDynamicId !== null) {
|
|
151
120
|
if (typeof activeDynamicId !== "string") {
|
|
152
121
|
throw new InvalidLoopStoreError("loop store activeDynamicId must be a string or null");
|
|
@@ -158,10 +127,10 @@ function parseLoopState(raw, ref) {
|
|
|
158
127
|
}
|
|
159
128
|
return {
|
|
160
129
|
version: LOOP_STATE_VERSION,
|
|
161
|
-
sessionId:
|
|
130
|
+
sessionId: ref.sessionId,
|
|
162
131
|
entries,
|
|
163
132
|
activeDynamicId,
|
|
164
|
-
updatedAt:
|
|
133
|
+
updatedAt: raw.updatedAt,
|
|
165
134
|
};
|
|
166
135
|
}
|
|
167
136
|
function parseEntry(id, value) {
|
|
@@ -418,7 +387,4 @@ function isRequestedIntervalUnit(value) {
|
|
|
418
387
|
function isEffectiveIntervalUnit(value) {
|
|
419
388
|
return EFFECTIVE_INTERVAL_UNITS.includes(value);
|
|
420
389
|
}
|
|
421
|
-
function isFileSystemError(error, code) {
|
|
422
|
-
return error instanceof Error && "code" in error && error.code === code;
|
|
423
|
-
}
|
|
424
390
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,S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C,IAAI,KAAK,IAAI,CAAC;AACzE,CAAC","sourcesContent":["/**\n * Atomic, versioned, per-session sidecar store for `/loop` state.\n *\n * Mirrors the goal store's persistence discipline (temp file + rename, per-file mutation\n * serialization, strict versioned parsing) because scheduler state must never be half\n * written or silently reset: a corrupt file arms nothing and surfaces a typed error so\n * the extension can end affected loops with `error` instead of guessing.\n *\n * Session custom entries are deliberately NOT the authoritative store: they are branch\n * nodes, so a globally scanned \"latest\" entry can come from an abandoned branch, while\n * loop schedules are session-scoped.\n */\n\nimport { randomUUID } from \"node:crypto\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport {\n\ttype CronEntry,\n\ttype DynamicCronEntry,\n\tEFFECTIVE_INTERVAL_UNITS,\n\ttype EffectiveInterval,\n\ttype EffectiveIntervalUnit,\n\ttype EpochMs,\n\ttype FixedCronEntry,\n\tisRecord,\n\tLOOP_END_REASONS,\n\tLOOP_PHASES,\n\tLOOP_SENTINELS,\n\tLOOP_STATE_VERSION,\n\tLOOP_WAKE_SOURCE_KINDS,\n\ttype LoopEndReason,\n\ttype LoopEntryFields,\n\ttype LoopFileFingerprint,\n\ttype LoopLifecycle,\n\ttype LoopPayload,\n\ttype LoopPhase,\n\ttype LoopSentinel,\n\ttype LoopState,\n\ttype LoopStoreRef,\n\ttype LoopWakeSource,\n\ttype LoopWakeSourceKind,\n\ttype PendingWakeup,\n\tREQUESTED_INTERVAL_UNITS,\n\ttype RequestedInterval,\n\ttype RequestedIntervalUnit,\n\ttype SentinelDeliveryState,\n} from \"./types.ts\";\n\nexport class InvalidLoopStoreError extends Error {\n\tconstructor(message: string, options?: { cause?: unknown }) {\n\t\tsuper(message, options);\n\t\tthis.name = \"InvalidLoopStoreError\";\n\t}\n}\n\nexport class UnsupportedLoopStoreVersionError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"UnsupportedLoopStoreVersionError\";\n\t}\n}\n\n/** Mutation callback. May be async; its result becomes the next persisted state. */\nexport type LoopStateMutation = (current: LoopState) => LoopState | Promise<LoopState>;\n\nconst mutationTails = new Map<string, Promise<void>>();\nconst snapshots = new Map<string, LoopState>();\n\nexport function encodedSessionId(ref: LoopStoreRef): string {\n\treturn encodeURIComponent(ref.sessionId);\n}\n\nexport function loopStateFilePath(ref: LoopStoreRef): string {\n\treturn join(ref.baseDir, `${encodedSessionId(ref)}.json`);\n}\n\nexport function emptyLoopState(sessionId: string): LoopState {\n\treturn { version: LOOP_STATE_VERSION, sessionId, entries: {}, activeDynamicId: null, updatedAt: 0 };\n}\n\n/**\n * Reads persisted state, or null when this session has never persisted any loop.\n * Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on\n * unusable state so callers fail closed rather than resetting a user's schedule.\n */\nexport async function readLoopState(ref: LoopStoreRef): Promise<LoopState | null> {\n\tlet raw: string;\n\ttry {\n\t\traw = await readFile(loopStateFilePath(ref), \"utf8\");\n\t} catch (error) {\n\t\tif (isFileSystemError(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tconst state = parseLoopState(raw, ref);\n\tsnapshots.set(loopStateFilePath(ref), state);\n\treturn state;\n}\n\n/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */\nexport async function loadLoopState(ref: LoopStoreRef): Promise<LoopState> {\n\treturn (await readLoopState(ref)) ?? emptyLoopState(ref.sessionId);\n}\n\n/**\n * Last successfully loaded or written state for this ref, for synchronous consumers\n * (status line, tick attribution). Undefined until the store has been touched.\n */\nexport function snapshotLoopState(ref: LoopStoreRef): LoopState | undefined {\n\treturn snapshots.get(loopStateFilePath(ref));\n}\n\n/**\n * Serializes read-modify-write cycles through a per-file promise tail so command,\n * timer, tool, and lifecycle writes cannot interleave and lose an update.\n */\nexport function mutateLoopState(ref: LoopStoreRef, mutation: LoopStateMutation): Promise<LoopState> {\n\treturn enqueue(ref, async () => {\n\t\tconst current = await loadLoopState(ref);\n\t\tconst next = await mutation(current);\n\t\tawait writeLoopState(ref, next);\n\t\treturn next;\n\t});\n}\n\n/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */\nexport async function writeLoopState(ref: LoopStoreRef, state: LoopState): Promise<void> {\n\tconst filePath = loopStateFilePath(ref);\n\tawait mkdir(dirname(filePath), { recursive: true });\n\tawait writeAtomic(filePath, `${JSON.stringify(state, null, 2)}\\n`);\n\tsnapshots.set(filePath, state);\n}\n\n/** Drops cached snapshots; used when a session ends or tests reset global state. */\nexport function clearLoopStateSnapshot(ref: LoopStoreRef): void {\n\tsnapshots.delete(loopStateFilePath(ref));\n}\n\nfunction enqueue<T>(ref: LoopStoreRef, operation: () => Promise<T>): Promise<T> {\n\tconst key = loopStateFilePath(ref);\n\tconst previous = mutationTails.get(key) ?? Promise.resolve();\n\tconst run = previous.then(operation);\n\tconst tail = run.then(\n\t\t() => undefined,\n\t\t() => undefined,\n\t);\n\tmutationTails.set(key, tail);\n\tvoid tail.then(() => {\n\t\tif (mutationTails.get(key) === tail) mutationTails.delete(key);\n\t});\n\treturn run;\n}\n\nasync function writeAtomic(filePath: string, contents: string): Promise<void> {\n\tconst tempPath = join(dirname(filePath), `.loop-${randomUUID()}.tmp`);\n\ttry {\n\t\tawait writeFile(tempPath, contents, { encoding: \"utf8\", mode: 0o600 });\n\t\tawait rename(tempPath, filePath);\n\t} catch (error) {\n\t\ttry {\n\t\t\tawait rm(tempPath, { force: true });\n\t\t} catch (cleanupError) {\n\t\t\tthrow new AggregateError(\n\t\t\t\t[error, cleanupError],\n\t\t\t\t\"loop store write failed and its temporary file could not be removed\",\n\t\t\t);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nfunction parseLoopState(raw: string, ref: LoopStoreRef): LoopState {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (error) {\n\t\tthrow new InvalidLoopStoreError(\"loop store contains unparseable JSON\", { cause: error });\n\t}\n\tif (!isRecord(parsed)) throw new InvalidLoopStoreError(\"loop store must be a JSON object\");\n\tif (parsed.version !== LOOP_STATE_VERSION) {\n\t\tthrow new UnsupportedLoopStoreVersionError(\n\t\t\t`unsupported loop store version: ${JSON.stringify(parsed.version)} (expected ${LOOP_STATE_VERSION})`,\n\t\t);\n\t}\n\tif (typeof parsed.sessionId !== \"string\" || parsed.sessionId.length === 0) {\n\t\tthrow new InvalidLoopStoreError(\"loop store is missing a sessionId\");\n\t}\n\tif (parsed.sessionId !== ref.sessionId) {\n\t\tthrow new InvalidLoopStoreError(\n\t\t\t`loop store sessionId ${parsed.sessionId} does not match the session it was loaded for`,\n\t\t);\n\t}\n\tif (!isEpochMs(parsed.updatedAt)) throw new InvalidLoopStoreError(\"loop store has an invalid updatedAt\");\n\tif (!isRecord(parsed.entries)) throw new InvalidLoopStoreError(\"loop store entries must be an object\");\n\n\tconst entries: Record<string, CronEntry> = {};\n\tfor (const [id, value] of Object.entries(parsed.entries)) {\n\t\tconst entry = parseEntry(id, value);\n\t\tentries[id] = entry;\n\t}\n\n\tconst activeDynamicId = parsed.activeDynamicId;\n\tif (activeDynamicId !== null) {\n\t\tif (typeof activeDynamicId !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(\"loop store activeDynamicId must be a string or null\");\n\t\t}\n\t\tconst active = entries[activeDynamicId];\n\t\tif (active === undefined || active.kind !== \"dynamic\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop store activeDynamicId ${activeDynamicId} does not name a dynamic loop`);\n\t\t}\n\t}\n\n\treturn {\n\t\tversion: LOOP_STATE_VERSION,\n\t\tsessionId: parsed.sessionId,\n\t\tentries,\n\t\tactiveDynamicId,\n\t\tupdatedAt: parsed.updatedAt,\n\t};\n}\n\nfunction parseEntry(id: string, value: unknown): CronEntry {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} is not an object`);\n\tif (value.id !== id) throw new InvalidLoopStoreError(`loop entry ${id} carries a mismatched id`);\n\tconst kind = value.kind;\n\tif (kind !== \"fixed\" && kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an unknown kind`);\n\n\tconst base = parseEntryFields(id, value);\n\tif (kind === \"fixed\") {\n\t\tconst fixed: FixedCronEntry = {\n\t\t\t...base,\n\t\t\tkind: \"fixed\",\n\t\t\trequestedInterval: parseRequestedInterval(id, value.requestedInterval),\n\t\t\teffectiveInterval: parseEffectiveInterval(id, value.effectiveInterval),\n\t\t\tcronExpression: requireString(id, \"cronExpression\", value.cronExpression),\n\t\t\tnextFireAt: requireEpochMs(id, \"nextFireAt\", value.nextFireAt),\n\t\t\tintervalMs: requirePositiveInteger(id, \"intervalMs\", value.intervalMs),\n\t\t};\n\t\treturn fixed;\n\t}\n\n\tconst keepaliveCredit = value.keepaliveCredit;\n\tif (keepaliveCredit !== 0 && keepaliveCredit !== 1) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid keepaliveCredit`);\n\t}\n\tconst dynamic: DynamicCronEntry = {\n\t\t...base,\n\t\tkind: \"dynamic\",\n\t\tpendingWakeup: parsePendingWakeup(id, value.pendingWakeup),\n\t\tkeepaliveCredit,\n\t};\n\treturn dynamic;\n}\n\nfunction parseEntryFields(id: string, value: Record<string, unknown>): LoopEntryFields & LoopLifecycle {\n\tconst fields = {\n\t\tid,\n\t\toriginalArgs: requireString(id, \"originalArgs\", value.originalArgs, { allowEmpty: true }),\n\t\treentryPrompt: requireString(id, \"reentryPrompt\", value.reentryPrompt),\n\t\tpayload: parsePayload(id, value.payload),\n\t\tcreatedAt: requireEpochMs(id, \"createdAt\", value.createdAt),\n\t\tlastFiredAt: parseNullableEpochMs(id, \"lastFiredAt\", value.lastFiredAt),\n\t\texpiresAt: requireEpochMs(id, \"expiresAt\", value.expiresAt),\n\t\tlastScheduledForAt: parseNullableEpochMs(id, \"lastScheduledForAt\", value.lastScheduledForAt),\n\t\tcoalescedFirePending: requireBoolean(id, \"coalescedFirePending\", value.coalescedFirePending),\n\t\tqueuedForAt: parseNullableEpochMs(id, \"queuedForAt\", value.queuedForAt),\n\t\tnoopStreak: requireNonNegativeInteger(id, \"noopStreak\", value.noopStreak),\n\t\ttickCount: requireNonNegativeInteger(id, \"tickCount\", value.tickCount),\n\t\tsentinelDelivery: parseSentinelDelivery(id, value.sentinelDelivery),\n\t\twakeSources: parseWakeSources(id, value.wakeSources),\n\t};\n\treturn { ...fields, ...parseLifecycle(id, value) };\n}\n\ntype ParsedLifecycle =\n\t| { phase: Exclude<LoopPhase, \"ended\"> }\n\t| { phase: \"ended\"; endedAt: EpochMs; endReason: LoopEndReason; endDetail?: string };\n\nfunction parseLifecycle(id: string, value: Record<string, unknown>): ParsedLifecycle {\n\tconst phase = value.phase;\n\tif (typeof phase !== \"string\" || !isLoopPhase(phase)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid phase`);\n\t}\n\tif (phase !== \"ended\") {\n\t\tif (value.endedAt !== undefined || value.endReason !== undefined || value.endDetail !== undefined) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} carries terminal fields while not ended`);\n\t\t}\n\t\treturn { phase };\n\t}\n\tconst endReason = value.endReason;\n\tif (typeof endReason !== \"string\" || !isLoopEndReason(endReason)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endReason`);\n\t}\n\tconst endDetail = value.endDetail;\n\tif (endDetail !== undefined && typeof endDetail !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endDetail`);\n\t}\n\treturn {\n\t\tphase: \"ended\",\n\t\tendedAt: requireEpochMs(id, \"endedAt\", value.endedAt),\n\t\tendReason,\n\t\t...(endDetail === undefined ? {} : { endDetail }),\n\t};\n}\n\nfunction parsePayload(id: string, value: unknown): LoopPayload {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid payload`);\n\tif (value.type === \"prompt\") {\n\t\treturn { type: \"prompt\", prompt: requireString(id, \"payload.prompt\", value.prompt) };\n\t}\n\tif (value.type === \"sentinel\") {\n\t\tconst sentinel = value.sentinel;\n\t\tif (typeof sentinel !== \"string\" || !isLoopSentinel(sentinel)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload sentinel`);\n\t\t}\n\t\treturn { type: \"sentinel\", sentinel };\n\t}\n\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload type`);\n}\n\nfunction parseSentinelDelivery(id: string, value: unknown): SentinelDeliveryState {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid sentinelDelivery`);\n\treturn {\n\t\tautonomousPreambleDelivered: requireBoolean(\n\t\t\tid,\n\t\t\t\"sentinelDelivery.autonomousPreambleDelivered\",\n\t\t\tvalue.autonomousPreambleDelivered,\n\t\t),\n\t\tlastLoopFileDelivered: parseFingerprint(id, value.lastLoopFileDelivered),\n\t\tforceFullDelivery: requireBoolean(id, \"sentinelDelivery.forceFullDelivery\", value.forceFullDelivery),\n\t};\n}\n\nfunction parseFingerprint(id: string, value: unknown): LoopFileFingerprint | null {\n\tif (value === null) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid loop-file fingerprint`);\n\treturn {\n\t\tpath: requireString(id, \"fingerprint.path\", value.path),\n\t\tmtimeMs: requireFiniteNumber(id, \"fingerprint.mtimeMs\", value.mtimeMs),\n\t\tsize: requireNonNegativeInteger(id, \"fingerprint.size\", value.size),\n\t\tcontentHash: requireString(id, \"fingerprint.contentHash\", value.contentHash),\n\t\tanchorDeliveryId: requireString(id, \"fingerprint.anchorDeliveryId\", value.anchorDeliveryId),\n\t};\n}\n\nfunction parseWakeSources(id: string, value: unknown): readonly LoopWakeSource[] {\n\tif (!Array.isArray(value)) throw new InvalidLoopStoreError(`loop entry ${id} has invalid wakeSources`);\n\treturn value.map((candidate): LoopWakeSource => {\n\t\tif (!isRecord(candidate)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source`);\n\t\tconst source = candidate.source;\n\t\tif (typeof source !== \"string\" || !isWakeSourceKind(source)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown wake source kind`);\n\t\t}\n\t\tconst description = candidate.description;\n\t\tif (description !== undefined && typeof description !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source description`);\n\t\t}\n\t\treturn {\n\t\t\tsource,\n\t\t\tid: requireString(id, \"wakeSource.id\", candidate.id),\n\t\t\tcreatedAt: requireEpochMs(id, \"wakeSource.createdAt\", candidate.createdAt),\n\t\t\t...(description === undefined ? {} : { description }),\n\t\t};\n\t});\n}\n\nfunction parsePendingWakeup(id: string, value: unknown): PendingWakeup | null {\n\tif (value === null || value === undefined) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup`);\n\tconst source = value.source;\n\tif (source !== \"model\" && source !== \"keepalive\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup source`);\n\t}\n\tif (value.kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup kind`);\n\treturn {\n\t\tid: requireString(id, \"pendingWakeup.id\", value.id),\n\t\tloopId: requireString(id, \"pendingWakeup.loopId\", value.loopId),\n\t\tkind: \"dynamic\",\n\t\tsource,\n\t\trequestedDelaySeconds: requireFiniteNumber(\n\t\t\tid,\n\t\t\t\"pendingWakeup.requestedDelaySeconds\",\n\t\t\tvalue.requestedDelaySeconds,\n\t\t),\n\t\tdelaySeconds: requirePositiveInteger(id, \"pendingWakeup.delaySeconds\", value.delaySeconds),\n\t\tdueAt: requireEpochMs(id, \"pendingWakeup.dueAt\", value.dueAt),\n\t\treason: requireString(id, \"pendingWakeup.reason\", value.reason),\n\t\tprompt: requireString(id, \"pendingWakeup.prompt\", value.prompt),\n\t\tnoop: requireBoolean(id, \"pendingWakeup.noop\", value.noop),\n\t\tcreatedAt: requireEpochMs(id, \"pendingWakeup.createdAt\", value.createdAt),\n\t};\n}\n\nfunction parseRequestedInterval(id: string, value: unknown): RequestedInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isRequestedIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval unit`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"requestedInterval.value\", value.value),\n\t\tunit,\n\t\traw: requireString(id, \"requestedInterval.raw\", value.raw),\n\t};\n}\n\nfunction parseEffectiveInterval(id: string, value: unknown): EffectiveInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isEffectiveIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval unit`);\n\t}\n\tconst roundingNotice = value.roundingNotice;\n\tif (roundingNotice !== undefined && typeof roundingNotice !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval roundingNotice`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"effectiveInterval.value\", value.value),\n\t\tunit,\n\t\thuman: requireString(id, \"effectiveInterval.human\", value.human),\n\t\trounded: requireBoolean(id, \"effectiveInterval.rounded\", value.rounded),\n\t\t...(roundingNotice === undefined ? {} : { roundingNotice }),\n\t};\n}\n\nfunction requireString(id: string, field: string, value: unknown, options?: { allowEmpty?: boolean }): string {\n\tif (typeof value !== \"string\" || (options?.allowEmpty !== true && value.length === 0)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireBoolean(id: string, field: string, value: unknown): boolean {\n\tif (typeof value !== \"boolean\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction requireFiniteNumber(id: string, field: string, value: unknown): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireNonNegativeInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) < 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requirePositiveInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requireEpochMs(id: string, field: string, value: unknown): EpochMs {\n\tif (!isEpochMs(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction parseNullableEpochMs(id: string, field: string, value: unknown): EpochMs | null {\n\tif (value === null || value === undefined) return null;\n\treturn requireEpochMs(id, field, value);\n}\n\nfunction isEpochMs(value: unknown): value is EpochMs {\n\treturn Number.isSafeInteger(value) && (value as number) >= 0;\n}\n\nfunction isLoopPhase(value: string): value is LoopPhase {\n\treturn (LOOP_PHASES as readonly string[]).includes(value);\n}\n\nfunction isLoopEndReason(value: string): value is LoopEndReason {\n\treturn (LOOP_END_REASONS as readonly string[]).includes(value);\n}\n\nfunction isLoopSentinel(value: string): value is LoopSentinel {\n\treturn (LOOP_SENTINELS as readonly string[]).includes(value);\n}\n\nfunction isWakeSourceKind(value: string): value is LoopWakeSourceKind {\n\treturn (LOOP_WAKE_SOURCE_KINDS as readonly string[]).includes(value);\n}\n\nfunction isRequestedIntervalUnit(value: string): value is RequestedIntervalUnit {\n\treturn (REQUESTED_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isEffectiveIntervalUnit(value: string): value is EffectiveIntervalUnit {\n\treturn (EFFECTIVE_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isFileSystemError(error: unknown, code: string): boolean {\n\treturn error instanceof Error && \"code\" in error && error.code === code;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,IAAI,sBAAsB,EAC1C,wBAAwB,EAGxB,eAAe,EACf,mCAAmC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAGN,wBAAwB,EAKxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EAatB,wBAAwB,GAIxB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,qBAAsB,SAAQ,wBAAwB;IAClE,YAAY,OAAe,EAAE,OAA6B;QACzD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED,MAAM,OAAO,gCAAiC,SAAQ,mCAAmC;IACxF,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IAChD,CAAC;CACD;AAKD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmC,CAAC;AAE1D,MAAM,UAAU,gBAAgB,CAAC,GAAiB;IACjD,OAAO,sBAAsB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAiB;IAClD,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC/C,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;AACrG,CAAC;AAED,SAAS,QAAQ,C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,OAAO,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,SAAS,CAAC,KAAc;IAChC,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAK,KAAgB,IAAI,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IACjC,OAAQ,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACrC,OAAQ,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACpC,OAAQ,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACtC,OAAQ,sBAA4C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC7C,OAAQ,wBAA8C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC7C,OAAQ,wBAA8C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC","sourcesContent":["/**\n * Atomic, versioned, per-session sidecar store for `/loop` state.\n *\n * Persistence (temp file + rename, per-file mutation serialization, envelope\n * version/session checks) lives in the shared session sidecar primitive. This\n * module supplies the loop domain parser and keeps the historical exported\n * surface so callers continue to catch {@link InvalidLoopStoreError} /\n * {@link UnsupportedLoopStoreVersionError} by name.\n *\n * Session custom entries are deliberately NOT the authoritative store: they are branch\n * nodes, so a globally scanned \"latest\" entry can come from an abandoned branch, while\n * loop schedules are session-scoped.\n */\n\nimport {\n\tcreateSidecarStore,\n\tencodedSessionId as encodeSidecarSessionId,\n\tInvalidSidecarStoreError,\n\ttype SidecarStore,\n\ttype SidecarStoreRef,\n\tsidecarFilePath,\n\tUnsupportedSidecarStoreVersionError,\n} from \"../../../session-sidecar-store.ts\";\nimport {\n\ttype CronEntry,\n\ttype DynamicCronEntry,\n\tEFFECTIVE_INTERVAL_UNITS,\n\ttype EffectiveInterval,\n\ttype EffectiveIntervalUnit,\n\ttype EpochMs,\n\ttype FixedCronEntry,\n\tisRecord,\n\tLOOP_END_REASONS,\n\tLOOP_PHASES,\n\tLOOP_SENTINELS,\n\tLOOP_STATE_VERSION,\n\tLOOP_WAKE_SOURCE_KINDS,\n\ttype LoopEndReason,\n\ttype LoopEntryFields,\n\ttype LoopFileFingerprint,\n\ttype LoopLifecycle,\n\ttype LoopPayload,\n\ttype LoopPhase,\n\ttype LoopSentinel,\n\ttype LoopState,\n\ttype LoopStoreRef,\n\ttype LoopWakeSource,\n\ttype LoopWakeSourceKind,\n\ttype PendingWakeup,\n\tREQUESTED_INTERVAL_UNITS,\n\ttype RequestedInterval,\n\ttype RequestedIntervalUnit,\n\ttype SentinelDeliveryState,\n} from \"./types.ts\";\n\nexport class InvalidLoopStoreError extends InvalidSidecarStoreError {\n\tconstructor(message: string, options?: { cause?: unknown }) {\n\t\tsuper(message, options);\n\t\tthis.name = \"InvalidLoopStoreError\";\n\t}\n}\n\nexport class UnsupportedLoopStoreVersionError extends UnsupportedSidecarStoreVersionError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"UnsupportedLoopStoreVersionError\";\n\t}\n}\n\n/** Mutation callback. May be async; its result becomes the next persisted state. */\nexport type LoopStateMutation = (current: LoopState) => LoopState | Promise<LoopState>;\n\nconst stores = new Map<string, SidecarStore<LoopState>>();\n\nexport function encodedSessionId(ref: LoopStoreRef): string {\n\treturn encodeSidecarSessionId(ref.sessionId);\n}\n\nexport function loopStateFilePath(ref: LoopStoreRef): string {\n\treturn sidecarFilePath(ref);\n}\n\nexport function emptyLoopState(sessionId: string): LoopState {\n\treturn { version: LOOP_STATE_VERSION, sessionId, entries: {}, activeDynamicId: null, updatedAt: 0 };\n}\n\nfunction storeFor(ref: LoopStoreRef): SidecarStore<LoopState> {\n\tconst filePath = loopStateFilePath(ref);\n\tconst existing = stores.get(filePath);\n\tif (existing !== undefined) return existing;\n\tconst store = createSidecarStore<LoopState>({\n\t\tbaseDir: ref.baseDir,\n\t\tsessionId: ref.sessionId,\n\t\tversion: LOOP_STATE_VERSION,\n\t\ttempPrefix: \"loop\",\n\t\tparse: parseLoopPayload,\n\t});\n\tstores.set(filePath, store);\n\treturn store;\n}\n\nfunction remapLoopStoreError(error: unknown): never {\n\tif (error instanceof InvalidLoopStoreError || error instanceof UnsupportedLoopStoreVersionError) {\n\t\tthrow error;\n\t}\n\tif (error instanceof UnsupportedSidecarStoreVersionError) {\n\t\tthrow new UnsupportedLoopStoreVersionError(error.message.replaceAll(\"sidecar store\", \"loop store\"));\n\t}\n\tif (error instanceof InvalidSidecarStoreError) {\n\t\tthrow new InvalidLoopStoreError(error.message.replaceAll(\"sidecar store\", \"loop store\"), { cause: error });\n\t}\n\tthrow error;\n}\n\n/**\n * Reads persisted state, or null when this session has never persisted any loop.\n * Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on\n * unusable state so callers fail closed rather than resetting a user's schedule.\n */\nexport async function readLoopState(ref: LoopStoreRef): Promise<LoopState | null> {\n\ttry {\n\t\treturn await storeFor(ref).read();\n\t} catch (error) {\n\t\tremapLoopStoreError(error);\n\t}\n}\n\n/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */\nexport async function loadLoopState(ref: LoopStoreRef): Promise<LoopState> {\n\treturn (await readLoopState(ref)) ?? emptyLoopState(ref.sessionId);\n}\n\n/**\n * Last successfully loaded or written state for this ref, for synchronous consumers\n * (status line, tick attribution). Undefined until the store has been touched.\n */\nexport function snapshotLoopState(ref: LoopStoreRef): LoopState | undefined {\n\treturn storeFor(ref).snapshot();\n}\n\n/**\n * Serializes read-modify-write cycles through a per-file promise tail so command,\n * timer, tool, and lifecycle writes cannot interleave and lose an update.\n */\nexport function mutateLoopState(ref: LoopStoreRef, mutation: LoopStateMutation): Promise<LoopState> {\n\treturn storeFor(ref)\n\t\t.mutate((current) => mutation(current ?? emptyLoopState(ref.sessionId)))\n\t\t.catch((error: unknown) => remapLoopStoreError(error));\n}\n\n/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */\nexport async function writeLoopState(ref: LoopStoreRef, state: LoopState): Promise<void> {\n\tawait storeFor(ref).write(state);\n}\n\n/** Drops cached snapshots; used when a session ends or tests reset global state. */\nexport function clearLoopStateSnapshot(ref: LoopStoreRef): void {\n\tstoreFor(ref).clear();\n}\n\nfunction parseLoopPayload(raw: unknown, ref: SidecarStoreRef): LoopState {\n\tif (!isRecord(raw)) throw new InvalidLoopStoreError(\"loop store must be a JSON object\");\n\tif (!isEpochMs(raw.updatedAt)) throw new InvalidLoopStoreError(\"loop store has an invalid updatedAt\");\n\tif (!isRecord(raw.entries)) throw new InvalidLoopStoreError(\"loop store entries must be an object\");\n\n\tconst entries: Record<string, CronEntry> = {};\n\tfor (const [id, value] of Object.entries(raw.entries)) {\n\t\tconst entry = parseEntry(id, value);\n\t\tentries[id] = entry;\n\t}\n\n\tconst activeDynamicId = raw.activeDynamicId;\n\tif (activeDynamicId !== null) {\n\t\tif (typeof activeDynamicId !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(\"loop store activeDynamicId must be a string or null\");\n\t\t}\n\t\tconst active = entries[activeDynamicId];\n\t\tif (active === undefined || active.kind !== \"dynamic\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop store activeDynamicId ${activeDynamicId} does not name a dynamic loop`);\n\t\t}\n\t}\n\n\treturn {\n\t\tversion: LOOP_STATE_VERSION,\n\t\tsessionId: ref.sessionId,\n\t\tentries,\n\t\tactiveDynamicId,\n\t\tupdatedAt: raw.updatedAt,\n\t};\n}\n\nfunction parseEntry(id: string, value: unknown): CronEntry {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} is not an object`);\n\tif (value.id !== id) throw new InvalidLoopStoreError(`loop entry ${id} carries a mismatched id`);\n\tconst kind = value.kind;\n\tif (kind !== \"fixed\" && kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an unknown kind`);\n\n\tconst base = parseEntryFields(id, value);\n\tif (kind === \"fixed\") {\n\t\tconst fixed: FixedCronEntry = {\n\t\t\t...base,\n\t\t\tkind: \"fixed\",\n\t\t\trequestedInterval: parseRequestedInterval(id, value.requestedInterval),\n\t\t\teffectiveInterval: parseEffectiveInterval(id, value.effectiveInterval),\n\t\t\tcronExpression: requireString(id, \"cronExpression\", value.cronExpression),\n\t\t\tnextFireAt: requireEpochMs(id, \"nextFireAt\", value.nextFireAt),\n\t\t\tintervalMs: requirePositiveInteger(id, \"intervalMs\", value.intervalMs),\n\t\t};\n\t\treturn fixed;\n\t}\n\n\tconst keepaliveCredit = value.keepaliveCredit;\n\tif (keepaliveCredit !== 0 && keepaliveCredit !== 1) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid keepaliveCredit`);\n\t}\n\tconst dynamic: DynamicCronEntry = {\n\t\t...base,\n\t\tkind: \"dynamic\",\n\t\tpendingWakeup: parsePendingWakeup(id, value.pendingWakeup),\n\t\tkeepaliveCredit,\n\t};\n\treturn dynamic;\n}\n\nfunction parseEntryFields(id: string, value: Record<string, unknown>): LoopEntryFields & LoopLifecycle {\n\tconst fields = {\n\t\tid,\n\t\toriginalArgs: requireString(id, \"originalArgs\", value.originalArgs, { allowEmpty: true }),\n\t\treentryPrompt: requireString(id, \"reentryPrompt\", value.reentryPrompt),\n\t\tpayload: parsePayload(id, value.payload),\n\t\tcreatedAt: requireEpochMs(id, \"createdAt\", value.createdAt),\n\t\tlastFiredAt: parseNullableEpochMs(id, \"lastFiredAt\", value.lastFiredAt),\n\t\texpiresAt: requireEpochMs(id, \"expiresAt\", value.expiresAt),\n\t\tlastScheduledForAt: parseNullableEpochMs(id, \"lastScheduledForAt\", value.lastScheduledForAt),\n\t\tcoalescedFirePending: requireBoolean(id, \"coalescedFirePending\", value.coalescedFirePending),\n\t\tqueuedForAt: parseNullableEpochMs(id, \"queuedForAt\", value.queuedForAt),\n\t\tnoopStreak: requireNonNegativeInteger(id, \"noopStreak\", value.noopStreak),\n\t\ttickCount: requireNonNegativeInteger(id, \"tickCount\", value.tickCount),\n\t\tsentinelDelivery: parseSentinelDelivery(id, value.sentinelDelivery),\n\t\twakeSources: parseWakeSources(id, value.wakeSources),\n\t};\n\treturn { ...fields, ...parseLifecycle(id, value) };\n}\n\ntype ParsedLifecycle =\n\t| { phase: Exclude<LoopPhase, \"ended\"> }\n\t| { phase: \"ended\"; endedAt: EpochMs; endReason: LoopEndReason; endDetail?: string };\n\nfunction parseLifecycle(id: string, value: Record<string, unknown>): ParsedLifecycle {\n\tconst phase = value.phase;\n\tif (typeof phase !== \"string\" || !isLoopPhase(phase)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid phase`);\n\t}\n\tif (phase !== \"ended\") {\n\t\tif (value.endedAt !== undefined || value.endReason !== undefined || value.endDetail !== undefined) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} carries terminal fields while not ended`);\n\t\t}\n\t\treturn { phase };\n\t}\n\tconst endReason = value.endReason;\n\tif (typeof endReason !== \"string\" || !isLoopEndReason(endReason)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endReason`);\n\t}\n\tconst endDetail = value.endDetail;\n\tif (endDetail !== undefined && typeof endDetail !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endDetail`);\n\t}\n\treturn {\n\t\tphase: \"ended\",\n\t\tendedAt: requireEpochMs(id, \"endedAt\", value.endedAt),\n\t\tendReason,\n\t\t...(endDetail === undefined ? {} : { endDetail }),\n\t};\n}\n\nfunction parsePayload(id: string, value: unknown): LoopPayload {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid payload`);\n\tif (value.type === \"prompt\") {\n\t\treturn { type: \"prompt\", prompt: requireString(id, \"payload.prompt\", value.prompt) };\n\t}\n\tif (value.type === \"sentinel\") {\n\t\tconst sentinel = value.sentinel;\n\t\tif (typeof sentinel !== \"string\" || !isLoopSentinel(sentinel)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload sentinel`);\n\t\t}\n\t\treturn { type: \"sentinel\", sentinel };\n\t}\n\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload type`);\n}\n\nfunction parseSentinelDelivery(id: string, value: unknown): SentinelDeliveryState {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid sentinelDelivery`);\n\treturn {\n\t\tautonomousPreambleDelivered: requireBoolean(\n\t\t\tid,\n\t\t\t\"sentinelDelivery.autonomousPreambleDelivered\",\n\t\t\tvalue.autonomousPreambleDelivered,\n\t\t),\n\t\tlastLoopFileDelivered: parseFingerprint(id, value.lastLoopFileDelivered),\n\t\tforceFullDelivery: requireBoolean(id, \"sentinelDelivery.forceFullDelivery\", value.forceFullDelivery),\n\t};\n}\n\nfunction parseFingerprint(id: string, value: unknown): LoopFileFingerprint | null {\n\tif (value === null) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid loop-file fingerprint`);\n\treturn {\n\t\tpath: requireString(id, \"fingerprint.path\", value.path),\n\t\tmtimeMs: requireFiniteNumber(id, \"fingerprint.mtimeMs\", value.mtimeMs),\n\t\tsize: requireNonNegativeInteger(id, \"fingerprint.size\", value.size),\n\t\tcontentHash: requireString(id, \"fingerprint.contentHash\", value.contentHash),\n\t\tanchorDeliveryId: requireString(id, \"fingerprint.anchorDeliveryId\", value.anchorDeliveryId),\n\t};\n}\n\nfunction parseWakeSources(id: string, value: unknown): readonly LoopWakeSource[] {\n\tif (!Array.isArray(value)) throw new InvalidLoopStoreError(`loop entry ${id} has invalid wakeSources`);\n\treturn value.map((candidate): LoopWakeSource => {\n\t\tif (!isRecord(candidate)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source`);\n\t\tconst source = candidate.source;\n\t\tif (typeof source !== \"string\" || !isWakeSourceKind(source)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown wake source kind`);\n\t\t}\n\t\tconst description = candidate.description;\n\t\tif (description !== undefined && typeof description !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source description`);\n\t\t}\n\t\treturn {\n\t\t\tsource,\n\t\t\tid: requireString(id, \"wakeSource.id\", candidate.id),\n\t\t\tcreatedAt: requireEpochMs(id, \"wakeSource.createdAt\", candidate.createdAt),\n\t\t\t...(description === undefined ? {} : { description }),\n\t\t};\n\t});\n}\n\nfunction parsePendingWakeup(id: string, value: unknown): PendingWakeup | null {\n\tif (value === null || value === undefined) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup`);\n\tconst source = value.source;\n\tif (source !== \"model\" && source !== \"keepalive\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup source`);\n\t}\n\tif (value.kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup kind`);\n\treturn {\n\t\tid: requireString(id, \"pendingWakeup.id\", value.id),\n\t\tloopId: requireString(id, \"pendingWakeup.loopId\", value.loopId),\n\t\tkind: \"dynamic\",\n\t\tsource,\n\t\trequestedDelaySeconds: requireFiniteNumber(\n\t\t\tid,\n\t\t\t\"pendingWakeup.requestedDelaySeconds\",\n\t\t\tvalue.requestedDelaySeconds,\n\t\t),\n\t\tdelaySeconds: requirePositiveInteger(id, \"pendingWakeup.delaySeconds\", value.delaySeconds),\n\t\tdueAt: requireEpochMs(id, \"pendingWakeup.dueAt\", value.dueAt),\n\t\treason: requireString(id, \"pendingWakeup.reason\", value.reason),\n\t\tprompt: requireString(id, \"pendingWakeup.prompt\", value.prompt),\n\t\tnoop: requireBoolean(id, \"pendingWakeup.noop\", value.noop),\n\t\tcreatedAt: requireEpochMs(id, \"pendingWakeup.createdAt\", value.createdAt),\n\t};\n}\n\nfunction parseRequestedInterval(id: string, value: unknown): RequestedInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isRequestedIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval unit`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"requestedInterval.value\", value.value),\n\t\tunit,\n\t\traw: requireString(id, \"requestedInterval.raw\", value.raw),\n\t};\n}\n\nfunction parseEffectiveInterval(id: string, value: unknown): EffectiveInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isEffectiveIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval unit`);\n\t}\n\tconst roundingNotice = value.roundingNotice;\n\tif (roundingNotice !== undefined && typeof roundingNotice !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval roundingNotice`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"effectiveInterval.value\", value.value),\n\t\tunit,\n\t\thuman: requireString(id, \"effectiveInterval.human\", value.human),\n\t\trounded: requireBoolean(id, \"effectiveInterval.rounded\", value.rounded),\n\t\t...(roundingNotice === undefined ? {} : { roundingNotice }),\n\t};\n}\n\nfunction requireString(id: string, field: string, value: unknown, options?: { allowEmpty?: boolean }): string {\n\tif (typeof value !== \"string\" || (options?.allowEmpty !== true && value.length === 0)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireBoolean(id: string, field: string, value: unknown): boolean {\n\tif (typeof value !== \"boolean\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction requireFiniteNumber(id: string, field: string, value: unknown): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireNonNegativeInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) < 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requirePositiveInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requireEpochMs(id: string, field: string, value: unknown): EpochMs {\n\tif (!isEpochMs(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction parseNullableEpochMs(id: string, field: string, value: unknown): EpochMs | null {\n\tif (value === null || value === undefined) return null;\n\treturn requireEpochMs(id, field, value);\n}\n\nfunction isEpochMs(value: unknown): value is EpochMs {\n\treturn Number.isSafeInteger(value) && (value as number) >= 0;\n}\n\nfunction isLoopPhase(value: string): value is LoopPhase {\n\treturn (LOOP_PHASES as readonly string[]).includes(value);\n}\n\nfunction isLoopEndReason(value: string): value is LoopEndReason {\n\treturn (LOOP_END_REASONS as readonly string[]).includes(value);\n}\n\nfunction isLoopSentinel(value: string): value is LoopSentinel {\n\treturn (LOOP_SENTINELS as readonly string[]).includes(value);\n}\n\nfunction isWakeSourceKind(value: string): value is LoopWakeSourceKind {\n\treturn (LOOP_WAKE_SOURCE_KINDS as readonly string[]).includes(value);\n}\n\nfunction isRequestedIntervalUnit(value: string): value is RequestedIntervalUnit {\n\treturn (REQUESTED_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isEffectiveIntervalUnit(value: string): value is EffectiveIntervalUnit {\n\treturn (EFFECTIVE_INTERVAL_UNITS as readonly string[]).includes(value);\n}\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,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,gEAAgE;AAChE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAE7C,eAAO,MAAM,2BAA2B,q7BAI0W,CAAC;AAEnZ,eAAO,MAAM,oBAAoB;;;;;;EA8BhC,CAAC;AAEF,sFAAsF;AACtF,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;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AAM,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":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,+BAA+B;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,2BAA2B,GAAG;;iCAEV,wBAAwB,IAAI,wBAAwB;;kZAE6T,CAAC;AAEnZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAC9C;IACC,YAAY,EAAE,IAAI,CAAC,QAAQ,CAC1B,IAAI,CAAC,OAAO,CAAC;QACZ,WAAW,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B,qBAAqB,kCAAkC,wBAAwB,IAAI,wBAAwB,UAAU;QAClL,CAAC,CAAC,kBAAkB,MAAM,OAAO,YAAY,IAAI,CAAC;IAEnD,OAAO;QACN,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;QAC1C,OAAO,EAAE;YACR,EAAE,EAAE,IAAI;YACR,MAAM,EAAE,WAAW;YACnB,MAAM;YACN,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,GAAG,CAAC,OAAO,CAAC,gBAAgB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACjG,qBAAqB;YACrB,YAAY;YACZ,OAAO;YACP,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM;YACN,MAAM;YACN,IAAI;YACJ,UAAU,EAAE,OAAO,CAAC,UAAU;SAC9B;KACD,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB,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,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
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,+BAA+B;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAEtD,gEAAgE;AAChE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;AAE7C,MAAM,CAAC,MAAM,2BAA2B,GAAG;;iCAEV,wBAAwB,IAAI,wBAAwB;;kZAE6T,CAAC;AAEnZ,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC,MAAM,CAC9C;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AAC,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"]}
|
|
@@ -24,6 +24,8 @@ export declare function isContinuationHoldStateEvent(data: unknown): data is Con
|
|
|
24
24
|
/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */
|
|
25
25
|
export interface TerminalMonitorStateMonitorEntry {
|
|
26
26
|
readonly id: string;
|
|
27
|
+
/** Stable "mon_" identity surviving runtime id churn; absent in pre-enrichment payloads. */
|
|
28
|
+
readonly monitorId?: string;
|
|
27
29
|
readonly description: string;
|
|
28
30
|
readonly paused: boolean;
|
|
29
31
|
/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monitor-state-event.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AACrE,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAWlF;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,0BAA0B,CAU9F;AAED,4FAA4F;AAC5F,MAAM,WAAW,gCAAgC;IAChD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAA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G,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;
|
|
1
|
+
{"version":3,"file":"monitor-state-event.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAmBvE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAa;IACnD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAa;IACzD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;AAmBD,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACxD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,WAAW,IAAI,CAAC,CACrB,CAAC;AACH,CAAC","sourcesContent":["export const TERMINAL_MONITOR_STATE_EVENT = \"terminal_monitor_state\";\nexport const WAKE_SOURCE_STATE_EVENT = \"wake_source_state\";\nexport const CONTINUATION_HOLD_STATE_EVENT = \"continuation_hold_state\";\n\nexport interface WakeSourceStateItem {\n\treadonly id: string;\n\treadonly description?: string;\n\treadonly startedAtMs?: number;\n}\n\nexport interface WakeSourceStateEvent {\n\treadonly source: string;\n\treadonly activeCount: number;\n\treadonly items?: readonly WakeSourceStateItem[];\n}\n\nexport interface ContinuationHoldStateEvent {\n\treadonly source: string;\n\treadonly active: boolean;\n}\n\n/**\n * Deliberately validates only the shared cross-package fields. Emitters may add\n * source-specific details such as `channels` or `monitors`.\n */\nexport function isWakeSourceStateEvent(data: unknown): data is WakeSourceStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isFinite(data.activeCount)\n\t);\n}\n\nexport function isContinuationHoldStateEvent(data: unknown): data is ContinuationHoldStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"active\" in data &&\n\t\ttypeof data.active === \"boolean\"\n\t);\n}\n\n/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */\nexport interface TerminalMonitorStateMonitorEntry {\n\treadonly id: string;\n\t/** Stable \"mon_\" identity surviving runtime id churn; absent in pre-enrichment payloads. */\n\treadonly monitorId?: string;\n\treadonly description: string;\n\treadonly paused: boolean;\n\t/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */\n\treadonly startedAtMs: number;\n}\n\nexport interface TerminalMonitorStateEvent {\n\treadonly activeCount: number;\n\t/** Per-watch detail for consumers that need more than the count; absent in pre-enrichment payloads. */\n\treadonly monitors?: readonly TerminalMonitorStateMonitorEntry[];\n}\n\nexport function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isInteger(data.activeCount) &&\n\t\tdata.activeCount >= 0\n\t);\n}\n"]}
|