@code-yeongyu/senpi 2026.8.28 → 2026.8.30-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +196 -0
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +4 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +50 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +330 -29
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +1 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -0
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +155 -37
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/compaction-execution.d.ts +14 -0
- package/dist/core/compaction/compaction-execution.d.ts.map +1 -0
- package/dist/core/compaction/compaction-execution.js +121 -0
- package/dist/core/compaction/compaction-execution.js.map +1 -0
- package/dist/core/compaction/compaction-settings.d.ts +17 -0
- package/dist/core/compaction/compaction-settings.d.ts.map +1 -0
- package/dist/core/compaction/compaction-settings.js +17 -0
- package/dist/core/compaction/compaction-settings.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +13 -26
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +7 -136
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/ideal-compaction-settings.d.ts +9 -0
- package/dist/core/compaction/ideal-compaction-settings.d.ts.map +1 -0
- package/dist/core/compaction/ideal-compaction-settings.js +7 -0
- package/dist/core/compaction/ideal-compaction-settings.js.map +1 -0
- package/dist/core/compaction-settings-access.d.ts +19 -0
- package/dist/core/compaction-settings-access.d.ts.map +1 -0
- package/dist/core/compaction-settings-access.js +10 -0
- package/dist/core/compaction-settings-access.js.map +1 -0
- package/dist/core/compaction-settings-resolver.d.ts +22 -0
- package/dist/core/compaction-settings-resolver.d.ts.map +1 -0
- package/dist/core/compaction-settings-resolver.js +46 -0
- package/dist/core/compaction-settings-resolver.js.map +1 -0
- package/dist/core/credential-accounts.d.ts.map +1 -1
- package/dist/core/credential-accounts.js +45 -21
- package/dist/core/credential-accounts.js.map +1 -1
- package/dist/core/credential-pool/classify.d.ts +6 -1
- package/dist/core/credential-pool/classify.d.ts.map +1 -1
- package/dist/core/credential-pool/classify.js +22 -5
- package/dist/core/credential-pool/classify.js.map +1 -1
- package/dist/core/credential-pool/env-slots.d.ts.map +1 -1
- package/dist/core/credential-pool/env-slots.js +2 -0
- package/dist/core/credential-pool/env-slots.js.map +1 -1
- package/dist/core/credential-pool/failover.d.ts +8 -0
- package/dist/core/credential-pool/failover.d.ts.map +1 -1
- package/dist/core/credential-pool/failover.js +24 -6
- package/dist/core/credential-pool/failover.js.map +1 -1
- package/dist/core/credential-pool/rotation-stream.d.ts +13 -2
- package/dist/core/credential-pool/rotation-stream.d.ts.map +1 -1
- package/dist/core/credential-pool/rotation-stream.js +97 -10
- package/dist/core/credential-pool/rotation-stream.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts +17 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.js +28 -0
- package/dist/core/extensions/builtin/compaction/context-pipeline.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +8 -2
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +163 -48
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts +17 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.js +64 -0
- package/dist/core/extensions/builtin/compaction/emergency-prune.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts +27 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.js +84 -0
- package/dist/core/extensions/builtin/compaction/extension-wiring.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/idle.d.ts +1 -0
- package/dist/core/extensions/builtin/compaction/idle.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/idle.js +13 -2
- package/dist/core/extensions/builtin/compaction/idle.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/index.js +121 -147
- package/dist/core/extensions/builtin/compaction/index.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts +1 -1
- package/dist/core/extensions/builtin/compaction/log.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/log.js +2 -0
- package/dist/core/extensions/builtin/compaction/log.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/model-selection.d.ts +14 -0
- package/dist/core/extensions/builtin/compaction/model-selection.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/model-selection.js +37 -0
- package/dist/core/extensions/builtin/compaction/model-selection.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts +9 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js +2 -0
- package/dist/core/extensions/builtin/compaction/openai-remote-dependencies.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts +3 -6
- package/dist/core/extensions/builtin/compaction/openai-remote.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/openai-remote.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/orchestration.d.ts +56 -0
- package/dist/core/extensions/builtin/compaction/orchestration.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/orchestration.js +136 -0
- package/dist/core/extensions/builtin/compaction/orchestration.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/policy.d.ts +5 -2
- package/dist/core/extensions/builtin/compaction/policy.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/policy.js +43 -26
- package/dist/core/extensions/builtin/compaction/policy.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/retained-message-safety.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/retained-message-safety.js +31 -8
- package/dist/core/extensions/builtin/compaction/retained-message-safety.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts +8 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.js +17 -0
- package/dist/core/extensions/builtin/compaction/speculation-lead.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.d.ts +22 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.js +16 -0
- package/dist/core/extensions/builtin/compaction/speculative-job.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts +22 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.js +131 -0
- package/dist/core/extensions/builtin/compaction/speculative-summary.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/speculative.d.ts +8 -13
- package/dist/core/extensions/builtin/compaction/speculative.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/speculative.js +7 -196
- package/dist/core/extensions/builtin/compaction/speculative.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts +18 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.js +18 -0
- package/dist/core/extensions/builtin/compaction/token-budget-reminder.js.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.d.ts +36 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.d.ts.map +1 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.js +92 -0
- package/dist/core/extensions/builtin/compaction/tool-admission.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js +8 -28
- package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js.map +1 -1
- package/dist/core/extensions/builtin/goal/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/goal/index.js +7 -0
- package/dist/core/extensions/builtin/goal/index.js.map +1 -1
- package/dist/core/extensions/builtin/permission-system/external-dir.d.ts.map +1 -1
- package/dist/core/extensions/builtin/permission-system/external-dir.js +15 -5
- package/dist/core/extensions/builtin/permission-system/external-dir.js.map +1 -1
- package/dist/core/extensions/builtin/permission-system/parsers.d.ts.map +1 -1
- package/dist/core/extensions/builtin/permission-system/parsers.js +16 -1
- package/dist/core/extensions/builtin/permission-system/parsers.js.map +1 -1
- package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
- package/dist/core/extensions/builtin/service-tier.js +13 -0
- package/dist/core/extensions/builtin/service-tier.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/extension.js +4 -2
- package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.d.ts +5 -0
- package/dist/core/extensions/builtin/terminal/manager.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/manager.js +31 -3
- package/dist/core/extensions/builtin/terminal/manager.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-permission.d.ts +8 -0
- package/dist/core/extensions/builtin/terminal/monitor-permission.d.ts.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-permission.js +16 -0
- package/dist/core/extensions/builtin/terminal/monitor-permission.js.map +1 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +13 -0
- package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/monitor-registry.js +403 -3
- package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/session-bundle.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/session-bundle.js +1 -0
- package/dist/core/extensions/builtin/terminal/session-bundle.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 -2
- package/dist/core/extensions/builtin/terminal/tools/kill-bash.js.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +4 -0
- package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
- package/dist/core/extensions/builtin/terminal/tools/monitor.js +40 -2
- package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
- package/dist/core/model-config-schema.d.ts +4 -4
- package/dist/core/model-resolver.js +2 -2
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +2 -0
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +74 -37
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/retry-fallback/chains.d.ts +23 -1
- package/dist/core/retry-fallback/chains.d.ts.map +1 -1
- package/dist/core/retry-fallback/chains.js +59 -3
- 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 +9 -2
- package/dist/core/retry-fallback/controller.js.map +1 -1
- package/dist/core/retry-fallback/settings.d.ts.map +1 -1
- package/dist/core/retry-fallback/settings.js +9 -0
- package/dist/core/retry-fallback/settings.js.map +1 -1
- package/dist/core/retry-fallback/validate.js +1 -1
- package/dist/core/retry-fallback/validate.js.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 +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +40 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +15 -85
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +15 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-public-types.d.ts +11 -0
- package/dist/core/settings-public-types.d.ts.map +1 -0
- package/dist/core/settings-public-types.js +2 -0
- package/dist/core/settings-public-types.js.map +1 -0
- package/dist/core/settings-shapes.d.ts +36 -0
- package/dist/core/settings-shapes.d.ts.map +1 -0
- package/dist/core/settings-shapes.js +2 -0
- package/dist/core/settings-shapes.js.map +1 -0
- package/dist/core/shared-host-policy.d.ts +6 -0
- package/dist/core/shared-host-policy.d.ts.map +1 -0
- package/dist/core/shared-host-policy.js +7 -0
- package/dist/core/shared-host-policy.js.map +1 -0
- package/dist/core/terminal-settings.d.ts +22 -0
- package/dist/core/terminal-settings.d.ts.map +1 -0
- package/dist/core/terminal-settings.js +2 -0
- package/dist/core/terminal-settings.js.map +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +97 -15
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +8 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +76 -34
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/main.d.ts +7 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +27 -6
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/favorite-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/favorite-models-selector.js +2 -2
- package/dist/modes/interactive/components/favorite-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +7 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +34 -8
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/grok/chrome.d.ts +2 -0
- package/dist/modes/interactive/grok/chrome.d.ts.map +1 -1
- package/dist/modes/interactive/grok/chrome.js.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts +121 -1
- package/dist/modes/interactive/interactive-host-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-host-runtime.js +606 -45
- package/dist/modes/interactive/interactive-host-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +7 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +390 -239
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/connection-handler.d.ts +8 -1
- package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
- package/dist/modes/rpc/connection-handler.js +268 -63
- package/dist/modes/rpc/connection-handler.js.map +1 -1
- package/dist/modes/rpc/host-ensure.d.ts +19 -0
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +79 -15
- package/dist/modes/rpc/host-ensure.js.map +1 -1
- package/dist/modes/rpc/host-lifecycle.d.ts +29 -0
- package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
- package/dist/modes/rpc/host-lifecycle.js +96 -25
- package/dist/modes/rpc/host-lifecycle.js.map +1 -1
- package/dist/modes/rpc/host-watchdog.d.ts +2 -0
- package/dist/modes/rpc/host-watchdog.d.ts.map +1 -1
- package/dist/modes/rpc/host-watchdog.js +23 -12
- package/dist/modes/rpc/host-watchdog.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +20 -8
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +91 -16
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +131 -37
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-input-validation.d.ts +1 -0
- package/dist/modes/rpc/rpc-input-validation.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-input-validation.js +66 -0
- package/dist/modes/rpc/rpc-input-validation.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts +3 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +3 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +248 -3
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-binding.d.ts +1 -0
- package/dist/modes/rpc/session-binding.d.ts.map +1 -1
- package/dist/modes/rpc/session-binding.js +21 -1
- package/dist/modes/rpc/session-binding.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts +22 -0
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +148 -16
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +4 -0
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +58 -7
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/session-extension-ui-requests.d.ts +1 -0
- package/dist/modes/rpc/session-extension-ui-requests.d.ts.map +1 -1
- package/dist/modes/rpc/session-extension-ui-requests.js +5 -0
- package/dist/modes/rpc/session-extension-ui-requests.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +17 -2
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js +67 -4
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/socket-event-fanout.d.ts +22 -0
- package/dist/modes/rpc/socket-event-fanout.d.ts.map +1 -0
- package/dist/modes/rpc/socket-event-fanout.js +84 -0
- package/dist/modes/rpc/socket-event-fanout.js.map +1 -0
- package/docs/rpc.md +55 -2
- package/docs/settings.md +34 -0
- package/docs/windows.md +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +74 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-indirect-eval.js +139 -90
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +4 -4
- 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 +6 -3
- 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/env/nodejs.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +40 -20
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +3 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.js +28 -9
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/shell-output.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.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +67 -38
- 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/measure.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js +443 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.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/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.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/cloudflare-workers-ai.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/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/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/together.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/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- 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/dist/components/editor.d.ts +7 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +5 -0
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/mux.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/mux.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/mux.js +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/mux.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +1 -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 +19 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
package/docs/rpc.md
CHANGED
|
@@ -57,15 +57,42 @@ every open session, each tagged with its routing `sessionId`. Correlated respons
|
|
|
57
57
|
only to the connection that issued the command. This lets a non-owner observe a foreign turn without requiring a
|
|
58
58
|
separate subscription protocol.
|
|
59
59
|
|
|
60
|
+
### Session auto-titling
|
|
61
|
+
|
|
62
|
+
Auto-generated session titles are on by default only for interactive launches. RPC hosts opt in with
|
|
63
|
+
`--auto-title-sessions`:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
senpi --mode rpc --multi-session --auto-title-sessions
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
With the flag, every session the host opens (classic or multi-session) generates a title from its first user prompt and
|
|
70
|
+
publishes it to clients through the existing `session_info_changed` event; no new command or event is involved. Sessions
|
|
71
|
+
resumed with existing context messages are never retitled, with or without the flag.
|
|
72
|
+
|
|
60
73
|
Startup: `senpi --mode rpc --multi-session` → NO default session is constructed (no default `AgentSessionRuntime`, no default extension/watcher load). Classic `senpi --mode rpc` is byte-identical to today. Mode is fixed at process start; there is no runtime transition.
|
|
61
74
|
|
|
62
75
|
### Interactive sessions and shared-host opt-out
|
|
63
76
|
|
|
64
77
|
Interactive launches use the shared RPC host by default when a persisted session is available. A cold start takes approximately 1.3 seconds on the first launch; warm attachment to an existing compatible host is fast. To use the local runtime directly for a launch, set `SENPI_DISABLE_SHARED_HOST=1`. This uses the same local fallback runtime and does not change RPC socket behavior for other clients.
|
|
65
78
|
|
|
79
|
+
### Session replacement
|
|
80
|
+
|
|
81
|
+
A replacement (`new_session`, `switch_session`, `fork`) responds as soon as the swap is committed; the derived-surface refresh that rebinds extensions continues afterwards. That refresh does not disturb work the client starts against the committed session: tool activation performed while extensions are still binding no longer cancels an in-flight compaction or invalidates its context. `loaded_surfaces_changed` is emitted only when the surface digest actually changes, so it is NOT a settle barrier clients can wait on.
|
|
82
|
+
|
|
83
|
+
#### Replacement identity event
|
|
84
|
+
|
|
85
|
+
When `new_session`, `switch_session`, or `fork` swaps the live session - including replacements an extension drives, which a client never issued - every attached connection receives:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{ "type": "session_replaced", "durableSessionId": "…", "sessionFile": "…", "cwd": "…", "sessionName": "…" }
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The command response reports only `{ cancelled }`, so this event is the only push channel carrying the new identity. The identity is `durableSessionId`, never `sessionId`: top-level `sessionId` is reserved for the per-connection routing handle that multi-session hosts tag every record with, and that tag is applied last, so reusing the key would overwrite the identity the event exists to deliver. Classic mode emits the event untagged.
|
|
92
|
+
|
|
66
93
|
### Shared host lifecycle (cold start + idle exit)
|
|
67
94
|
|
|
68
|
-
The lifecycle supervisor is also available to bundled/rebranded runtimes through the hidden internal launch route `--internal-rpc-host-supervisor`. This route is wire-invisible and intended only for desktop launchers: it receives the public socket, ownership directory, and the runtime command/arguments to wrap, then runs the same `host-lifecycle.ts` implementation used by `ensureHost()`. Normal CLI modes do not use or advertise this route.
|
|
95
|
+
The lifecycle supervisor is also available to bundled/rebranded runtimes through the hidden internal launch route `--internal-rpc-host-supervisor`. This route is wire-invisible and intended only for desktop launchers: it receives the public socket, ownership directory, and the runtime command/arguments to wrap, then runs the same `host-lifecycle.ts` implementation used by `ensureHost()`. Normal CLI modes do not use or advertise this route. Compiled standalone binaries also re-enter themselves through this route automatically: a bun executable always boots its embedded entrypoint, so the script-path re-entry used under a JS runtime would be parsed as CLI arguments (`Unknown option: --socket`) and the host could never start.
|
|
69
96
|
|
|
70
97
|
Hosts started through `ensureHost()` are wrapped by a lifecycle supervisor that owns the public socket and spawns the
|
|
71
98
|
real RPC host on a private internal hop. The policy lives in `<agentDir>/rpc-host-daemon/settings.json`:
|
|
@@ -831,9 +858,11 @@ Response:
|
|
|
831
858
|
Load a different session file. Can be cancelled by a `session_before_switch` extension event handler.
|
|
832
859
|
|
|
833
860
|
```json
|
|
834
|
-
{"type": "switch_session", "sessionPath": "/path/to/session.jsonl"}
|
|
861
|
+
{"type": "switch_session", "sessionPath": "/path/to/session.jsonl", "cwdOverride": "/path/to/project"}
|
|
835
862
|
```
|
|
836
863
|
|
|
864
|
+
`cwdOverride` is optional. When supplied, the replacement session and its cwd-bound settings and runtime state are rebuilt for that directory instead of using the session file's stored cwd. The host also resolves `projectTrusted` from its saved project trust store for the replacement cwd; an absent or false decision keeps project-scoped settings and resources disabled.
|
|
865
|
+
|
|
837
866
|
Response:
|
|
838
867
|
```json
|
|
839
868
|
{"type": "response", "command": "switch_session", "success": true, "data": {"cancelled": false}}
|
|
@@ -1237,6 +1266,30 @@ Emitted when an extension calls `pi.rpc.emit(name, data)` and the client adverti
|
|
|
1237
1266
|
the specific event name before applying it. In multi-session mode the record also includes the
|
|
1238
1267
|
routing `sessionId`; delivery preserves the owning session and per-session event order.
|
|
1239
1268
|
|
|
1269
|
+
The terminal builtin emits `terminal_monitor_state` on this path whenever the active monitor set
|
|
1270
|
+
changes. `data` is `{ activeCount, monitors }`, where each monitor entry has `id`, `description`,
|
|
1271
|
+
`paused`, and `startedAtMs`. The matching in-process `pi.events` channel is unchanged and is not
|
|
1272
|
+
forwarded. Clients receive the wire record only when they advertise the `extension_events`
|
|
1273
|
+
capability:
|
|
1274
|
+
|
|
1275
|
+
```json
|
|
1276
|
+
{
|
|
1277
|
+
"type": "extension_event",
|
|
1278
|
+
"name": "terminal_monitor_state",
|
|
1279
|
+
"data": {
|
|
1280
|
+
"activeCount": 1,
|
|
1281
|
+
"monitors": [
|
|
1282
|
+
{
|
|
1283
|
+
"id": "bash_1",
|
|
1284
|
+
"description": "watch checks",
|
|
1285
|
+
"paused": false,
|
|
1286
|
+
"startedAtMs": 1710000000000
|
|
1287
|
+
}
|
|
1288
|
+
]
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
```
|
|
1292
|
+
|
|
1240
1293
|
### agent_start
|
|
1241
1294
|
|
|
1242
1295
|
Emitted when the agent begins processing a prompt.
|
package/docs/settings.md
CHANGED
|
@@ -399,6 +399,8 @@ Windows paths in JSON must use forward slashes or escaped backslashes:
|
|
|
399
399
|
| Setting | Type | Default | Description |
|
|
400
400
|
|---------|------|---------|-------------|
|
|
401
401
|
| `defaultTools` | string[] | - | Built-in tools enabled initially. When omitted, Pi uses its standard defaults |
|
|
402
|
+
| `experimental.bashEvalOnly` | boolean | `false` | Route `bash` and `powershell` through eval cells only; the tools leave the model's direct tool list |
|
|
403
|
+
| `experimental.workflowEvalOnly` | boolean | `false` | Route the workflow (dag) tool through eval cells only; the tool leaves the model direct tool list |
|
|
402
404
|
|
|
403
405
|
`defaultTools` selects the built-in tools enabled at startup. Extension and SDK custom tools remain enabled. Available built-ins are `read`, `bash`, `powershell`, `edit`, `write`, `grep`, `find`, and `ls`:
|
|
404
406
|
|
|
@@ -418,6 +420,38 @@ On Windows, select `powershell` instead of `bash`, or include both:
|
|
|
418
420
|
|
|
419
421
|
An empty array starts with no built-in tools while preserving extension and SDK custom tools. `--tools` replaces this behavior with a strict allowlist for all tools, `--no-tools` disables all tools, and `--no-builtin-tools` disables the built-in defaults. `--exclude-tools` filters the resulting list. A project `defaultTools` array replaces the global array.
|
|
420
422
|
|
|
423
|
+
With `experimental.bashEvalOnly` enabled, the `bash` and `powershell` tools disappear from the model's direct tool list and run only inside eval cells:
|
|
424
|
+
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"experimental": {
|
|
428
|
+
"bashEvalOnly": true
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
```js
|
|
434
|
+
const { output } = await tool.bash({ command: "ls -la" });
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
Hooks and permission checks apply unchanged to shell commands run this way. If the model hallucinates a direct `bash` or `powershell` call anyway, the call returns a hint redirecting it to an eval cell. When the `eval` tool is unavailable (codemode not loaded), the policy auto-disables and both tools stay on the direct tool list, so shell access is never lost.
|
|
438
|
+
|
|
439
|
+
With `experimental.workflowEvalOnly` enabled, the `workflow` (dag) tool disappears from the model's direct tool list and runs only inside eval cells:
|
|
440
|
+
|
|
441
|
+
```json
|
|
442
|
+
{
|
|
443
|
+
"experimental": {
|
|
444
|
+
"workflowEvalOnly": true
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
```js
|
|
450
|
+
const snapshot = await tool.workflow({ action: "snapshot", run_id });
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
Hooks and permission checks apply unchanged to workflow operations run this way. When the `eval` tool is unavailable (codemode not loaded), the policy auto-disables and the workflow tool stays on the direct tool list, so workflow access is never lost.
|
|
454
|
+
|
|
421
455
|
### Sessions
|
|
422
456
|
|
|
423
457
|
| Setting | Type | Default | Description |
|
package/docs/windows.md
CHANGED
|
@@ -30,6 +30,8 @@ Or enable both while comparing behavior:
|
|
|
30
30
|
|
|
31
31
|
The `!` and `!!` editor commands still use Bash.
|
|
32
32
|
|
|
33
|
+
With `experimental.bashEvalOnly` enabled, both `bash` and `powershell` run only inside eval cells; see [Settings](settings.md#tools).
|
|
34
|
+
|
|
33
35
|
## Custom Bash Path
|
|
34
36
|
|
|
35
37
|
```json
|
|
@@ -12,6 +12,80 @@
|
|
|
12
12
|
|
|
13
13
|
### Removed
|
|
14
14
|
|
|
15
|
+
## [2026.8.30-2] - 2026-08-30
|
|
16
|
+
|
|
17
|
+
### Breaking Changes
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
## [2026.8.30] - 2026-08-30
|
|
28
|
+
|
|
29
|
+
### Breaking Changes
|
|
30
|
+
|
|
31
|
+
### Added
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- The eval prompt's dependency-graph section is now `<workflow>` and states its contract directly:
|
|
36
|
+
define the workflow spec in code, one node per logically distinct step, rather than hand-authoring
|
|
37
|
+
the graph as a single opaque call.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- The JavaScript kernel persistence transform no longer truncates declarations whose multi-line
|
|
42
|
+
initializers contain interior `//` comments (previously emitted unparseable code such as
|
|
43
|
+
`globalThis["jobs"] = {;`, failing cells with `Unexpected token ';'. Expected a property name.`),
|
|
44
|
+
and no longer re-evaluates comment-bearing initializers when persisting bindings — such
|
|
45
|
+
declarations are kept verbatim and their bindings persisted by reference.
|
|
46
|
+
- Last-expression capture no longer inserts `return` before continuation lines (`else`/`catch`/`finally`
|
|
47
|
+
clauses and leading-`.`/operator method-chain lines), and now scans template literals (including
|
|
48
|
+
nested templates in interpolations), regexes, and comments with the same literal-aware scanner as
|
|
49
|
+
the persistence transform — fixing `return else …`, `return .replace(…)`, and mid-argument
|
|
50
|
+
`return )` corruption of valid cells.
|
|
51
|
+
- Last-expression capture now follows real ASI statement semantics: a parenthesized/bracketed/template
|
|
52
|
+
line after a closed block starts a new statement (echo restored), expressions split after a trailing
|
|
53
|
+
operator or `await` stay one statement, tagged templates split across lines invoke the tag, regexes
|
|
54
|
+
directly after a control-structure condition no longer desync the scanner, and labeled final
|
|
55
|
+
statements are left uncaptured instead of emitting invalid `return label: …`.
|
|
56
|
+
- Destructuring patterns carrying interior line comments now persist their bindings, and declarations
|
|
57
|
+
with a dangling trailing comma are left untransformed so the original syntax error surfaces instead
|
|
58
|
+
of being silently "repaired".
|
|
59
|
+
- Rewritten destructuring assignments are emitted with a leading defensive semicolon so they can no
|
|
60
|
+
longer ASI-merge into a preceding unterminated expression statement as a bogus call
|
|
61
|
+
(`foo()\n({…} = …)` previously became `foo()({…} = …)`).
|
|
62
|
+
|
|
63
|
+
### Removed
|
|
64
|
+
|
|
65
|
+
## [2026.8.29] - 2026-08-29
|
|
66
|
+
|
|
67
|
+
### Breaking Changes
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
### Fixed
|
|
74
|
+
|
|
75
|
+
### Removed
|
|
76
|
+
|
|
77
|
+
## [2026.8.28-2] - 2026-08-28
|
|
78
|
+
|
|
79
|
+
### Breaking Changes
|
|
80
|
+
|
|
81
|
+
### Added
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
|
|
87
|
+
### Removed
|
|
88
|
+
|
|
15
89
|
## [2026.8.28] - 2026-08-28
|
|
16
90
|
|
|
17
91
|
### Breaking Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-yeongyu/senpi-codemode",
|
|
3
|
-
"version": "2026.8.
|
|
3
|
+
"version": "2026.8.30-2",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Source-only senpi extension package for codemode evaluation tools",
|
|
6
6
|
"type": "module",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/parser": "8.0.4",
|
|
34
|
-
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.
|
|
34
|
+
"@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.30-2",
|
|
35
35
|
"typebox": "1.3.18"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
38
|
+
"@code-yeongyu/senpi": "2026.8.30-2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@code-yeongyu/senpi": "2026.8.
|
|
41
|
+
"@code-yeongyu/senpi": "2026.8.30-2"
|
|
42
42
|
},
|
|
43
43
|
"keywords": [
|
|
44
44
|
"senpi",
|
|
@@ -258,20 +258,22 @@ function rewriteDeclaration(code, declarationStart, start, end, keyword) {
|
|
|
258
258
|
const preserveDeclaration = source.includes("//") || source.includes("/*");
|
|
259
259
|
for (const [segmentStart, segmentEnd] of splitDeclarators(code, start, end)) {
|
|
260
260
|
const segment = code.slice(segmentStart, segmentEnd);
|
|
261
|
-
if (!segment.trim())
|
|
261
|
+
if (!segment.trim()) return undefined;
|
|
262
262
|
const initializerStart = findTopLevelEquals(segment);
|
|
263
263
|
if (initializerStart < 0 && keyword === "const") return undefined;
|
|
264
264
|
const pattern = trimPattern(initializerStart < 0 ? segment : segment.slice(0, initializerStart));
|
|
265
265
|
const bindings = [];
|
|
266
266
|
collectPatternNames(pattern, bindings);
|
|
267
267
|
if (bindings.length === 0) return undefined;
|
|
268
|
+
if (preserveDeclaration) {
|
|
269
|
+
for (const name of bindings) assignments.push(`globalThis[${JSON.stringify(name)}] = ${name};`);
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
268
272
|
const target = rewriteBindingPattern(pattern);
|
|
269
273
|
if (target === undefined) return undefined;
|
|
270
274
|
const initializer = initializerStart < 0 ? "undefined" : segment.slice(initializerStart + 1).trim();
|
|
271
|
-
const [assignmentInitializer, comment] = splitTrailingLineComment(initializer);
|
|
272
|
-
const assignmentComment = preserveDeclaration ? "" : comment;
|
|
273
275
|
assignments.push(
|
|
274
|
-
`${target.startsWith("{") || target.startsWith("[") ?
|
|
276
|
+
`${target.startsWith("{") || target.startsWith("[") ? `;(${target} = ${initializer})` : `${target} = ${initializer}`};`,
|
|
275
277
|
);
|
|
276
278
|
}
|
|
277
279
|
if (assignments.length === 0) return undefined;
|
|
@@ -408,6 +410,7 @@ function splitDeclarators(code, start, end) {
|
|
|
408
410
|
if (!/\s/u.test(char)) canStartRegex = isExpressionOperator(char) || char === "(" || char === "[" || char === "{";
|
|
409
411
|
}
|
|
410
412
|
if (segmentStart < end && code.slice(segmentStart, end).trim() !== ";") ranges.push([segmentStart, end - (code[end - 1] === ";" ? 1 : 0)]);
|
|
413
|
+
else if (ranges.length > 0 && code.slice(segmentStart, end).trim() !== ";") ranges.push([end, end]);
|
|
411
414
|
return ranges;
|
|
412
415
|
}
|
|
413
416
|
|
|
@@ -501,51 +504,9 @@ function applyTextEdits(code, edits) {
|
|
|
501
504
|
return output;
|
|
502
505
|
}
|
|
503
506
|
|
|
504
|
-
function splitTrailingLineComment(source) {
|
|
505
|
-
let canStartRegex = true;
|
|
506
|
-
for (let index = 0; index < source.length; index += 1) {
|
|
507
|
-
const char = source[index];
|
|
508
|
-
const next = source[index + 1];
|
|
509
|
-
if (char === "/" && next === "/") return [source.slice(0, index).trimEnd(), source.slice(index)];
|
|
510
|
-
if (char === "/" && next === "*") {
|
|
511
|
-
index = skipBlockComment(source, index) - 1;
|
|
512
|
-
continue;
|
|
513
|
-
}
|
|
514
|
-
if (char === "'" || char === '"') {
|
|
515
|
-
index = skipQuotedLiteral(source, index) - 1;
|
|
516
|
-
canStartRegex = false;
|
|
517
|
-
continue;
|
|
518
|
-
}
|
|
519
|
-
if (char === "`") {
|
|
520
|
-
index = skipTemplateLiteral(source, index) - 1;
|
|
521
|
-
canStartRegex = false;
|
|
522
|
-
continue;
|
|
523
|
-
}
|
|
524
|
-
if (char === "/" && canStartRegex) {
|
|
525
|
-
index = skipRegexLiteral(source, index) - 1;
|
|
526
|
-
canStartRegex = false;
|
|
527
|
-
continue;
|
|
528
|
-
}
|
|
529
|
-
if (isIdentifierStart(char)) {
|
|
530
|
-
const end = readIdentifier(source, index);
|
|
531
|
-
canStartRegex = REGEX_PREFIX_KEYWORDS.has(source.slice(index, end));
|
|
532
|
-
index = end - 1;
|
|
533
|
-
continue;
|
|
534
|
-
}
|
|
535
|
-
if (isDecimalDigit(char)) {
|
|
536
|
-
index = skipNumberLiteral(source, index) - 1;
|
|
537
|
-
canStartRegex = false;
|
|
538
|
-
continue;
|
|
539
|
-
}
|
|
540
|
-
if (!/\s/u.test(char)) canStartRegex = isExpressionOperator(char) || char === "(" || char === "[" || char === "{";
|
|
541
|
-
}
|
|
542
|
-
return [source, ""];
|
|
543
|
-
}
|
|
544
|
-
|
|
545
507
|
function trimPattern(source) {
|
|
546
508
|
let start = 0;
|
|
547
|
-
|
|
548
|
-
while (start < end) {
|
|
509
|
+
while (start < source.length) {
|
|
549
510
|
if (/\s/u.test(source[start])) {
|
|
550
511
|
start += 1;
|
|
551
512
|
continue;
|
|
@@ -560,12 +521,30 @@ function trimPattern(source) {
|
|
|
560
521
|
}
|
|
561
522
|
break;
|
|
562
523
|
}
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
const
|
|
567
|
-
if (
|
|
568
|
-
|
|
524
|
+
let end = start;
|
|
525
|
+
for (let index = start; index < source.length; index += 1) {
|
|
526
|
+
const char = source[index];
|
|
527
|
+
const next = source[index + 1];
|
|
528
|
+
if (/\s/u.test(char)) continue;
|
|
529
|
+
if (char === "/" && next === "/") {
|
|
530
|
+
index = skipLineComment(source, index) - 1;
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
if (char === "/" && next === "*") {
|
|
534
|
+
index = skipBlockComment(source, index) - 1;
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
if (char === "'" || char === '"') {
|
|
538
|
+
index = skipQuotedLiteral(source, index) - 1;
|
|
539
|
+
end = index + 1;
|
|
540
|
+
continue;
|
|
541
|
+
}
|
|
542
|
+
if (char === "`") {
|
|
543
|
+
index = skipTemplateLiteral(source, index) - 1;
|
|
544
|
+
end = index + 1;
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
end = index + 1;
|
|
569
548
|
}
|
|
570
549
|
return source.slice(start, end);
|
|
571
550
|
}
|
|
@@ -733,66 +712,136 @@ function captureLastExpression(code) {
|
|
|
733
712
|
return `${head}return ${tail.replace(/;+$/u, "")};`;
|
|
734
713
|
}
|
|
735
714
|
|
|
715
|
+
const LABEL_PREFIX_RE = /^[\p{ID_Start}$_][\p{ID_Continue}\u200c\u200d$]*\s*:/u;
|
|
716
|
+
|
|
736
717
|
function isStatementOnly(source) {
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
718
|
+
if (
|
|
719
|
+
/^(?:const|let|var|if|for|while|switch|try|catch|finally|class|function|import|export|throw|return|do|break|continue|debugger)\b/u.test(
|
|
720
|
+
source,
|
|
721
|
+
)
|
|
722
|
+
)
|
|
723
|
+
return true;
|
|
724
|
+
return LABEL_PREFIX_RE.test(source);
|
|
740
725
|
}
|
|
741
726
|
|
|
727
|
+
const CONTROL_PAREN_KEYWORDS = new Set(["catch", "for", "if", "switch", "while", "with"]);
|
|
728
|
+
|
|
742
729
|
function findLastTopLevelStatementStart(code) {
|
|
743
730
|
let start = 0;
|
|
744
731
|
let round = 0;
|
|
745
732
|
let square = 0;
|
|
746
733
|
let curly = 0;
|
|
747
|
-
let
|
|
748
|
-
let
|
|
749
|
-
let
|
|
750
|
-
|
|
734
|
+
let canStartRegex = true;
|
|
735
|
+
let lastSignificant = "";
|
|
736
|
+
let pendingControlParen = false;
|
|
737
|
+
const controlParens = [];
|
|
751
738
|
for (let index = 0; index < code.length; index += 1) {
|
|
752
739
|
const char = code[index];
|
|
753
740
|
const next = code[index + 1];
|
|
754
|
-
if (
|
|
755
|
-
|
|
741
|
+
if (char === "/" && next === "/") {
|
|
742
|
+
index = skipLineComment(code, index) - 1;
|
|
756
743
|
continue;
|
|
757
744
|
}
|
|
758
|
-
if (
|
|
759
|
-
|
|
760
|
-
blockComment = false;
|
|
761
|
-
index += 1;
|
|
762
|
-
}
|
|
745
|
+
if (char === "/" && next === "*") {
|
|
746
|
+
index = skipBlockComment(code, index) - 1;
|
|
763
747
|
continue;
|
|
764
748
|
}
|
|
765
|
-
if (
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
} else if (char === quote) {
|
|
771
|
-
quote = "";
|
|
772
|
-
}
|
|
749
|
+
if (char === "'" || char === '"' || char === "`") {
|
|
750
|
+
index = (char === "`" ? skipTemplateLiteral(code, index) : skipQuotedLiteral(code, index)) - 1;
|
|
751
|
+
canStartRegex = false;
|
|
752
|
+
lastSignificant = char;
|
|
753
|
+
pendingControlParen = false;
|
|
773
754
|
continue;
|
|
774
755
|
}
|
|
775
|
-
if (char === "/" &&
|
|
776
|
-
|
|
777
|
-
|
|
756
|
+
if (char === "/" && canStartRegex) {
|
|
757
|
+
index = skipRegexLiteral(code, index) - 1;
|
|
758
|
+
canStartRegex = false;
|
|
759
|
+
lastSignificant = char;
|
|
760
|
+
pendingControlParen = false;
|
|
778
761
|
continue;
|
|
779
762
|
}
|
|
780
|
-
if (char
|
|
781
|
-
|
|
782
|
-
index
|
|
763
|
+
if (isIdentifierStart(char)) {
|
|
764
|
+
const end = readIdentifier(code, index);
|
|
765
|
+
const token = code.slice(index, end);
|
|
766
|
+
canStartRegex = REGEX_PREFIX_KEYWORDS.has(token);
|
|
767
|
+
pendingControlParen = CONTROL_PAREN_KEYWORDS.has(token);
|
|
768
|
+
lastSignificant = code[end - 1];
|
|
769
|
+
index = end - 1;
|
|
783
770
|
continue;
|
|
784
771
|
}
|
|
785
|
-
if (char
|
|
786
|
-
|
|
772
|
+
if (isDecimalDigit(char)) {
|
|
773
|
+
index = skipNumberLiteral(code, index) - 1;
|
|
774
|
+
canStartRegex = false;
|
|
775
|
+
lastSignificant = char;
|
|
776
|
+
pendingControlParen = false;
|
|
787
777
|
continue;
|
|
788
778
|
}
|
|
789
|
-
if (char === "(")
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
779
|
+
if (char === "(") {
|
|
780
|
+
round += 1;
|
|
781
|
+
controlParens.push(pendingControlParen);
|
|
782
|
+
pendingControlParen = false;
|
|
783
|
+
canStartRegex = true;
|
|
784
|
+
lastSignificant = char;
|
|
785
|
+
continue;
|
|
786
|
+
}
|
|
787
|
+
if (char === ")") {
|
|
788
|
+
round = Math.max(0, round - 1);
|
|
789
|
+
canStartRegex = controlParens.pop() === true;
|
|
790
|
+
lastSignificant = char;
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
if (char === "[" || char === "{") {
|
|
794
|
+
if (char === "[") square += 1;
|
|
795
|
+
else curly += 1;
|
|
796
|
+
canStartRegex = true;
|
|
797
|
+
lastSignificant = char;
|
|
798
|
+
pendingControlParen = false;
|
|
799
|
+
continue;
|
|
800
|
+
}
|
|
801
|
+
if (char === "]" || char === "}") {
|
|
802
|
+
if (char === "]") square = Math.max(0, square - 1);
|
|
803
|
+
else curly = Math.max(0, curly - 1);
|
|
804
|
+
canStartRegex = false;
|
|
805
|
+
lastSignificant = char;
|
|
806
|
+
pendingControlParen = false;
|
|
807
|
+
continue;
|
|
808
|
+
}
|
|
809
|
+
if (char === ";" && round === 0 && square === 0 && curly === 0) {
|
|
810
|
+
const nextIndex = nextSignificantIndex(code, index + 1);
|
|
811
|
+
if (nextIndex < code.length && !isContinuationKeyword(code, nextIndex)) start = nextIndex;
|
|
812
|
+
canStartRegex = true;
|
|
813
|
+
lastSignificant = char;
|
|
814
|
+
pendingControlParen = false;
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
if (isLineTerminator(char) && round === 0 && square === 0 && curly === 0) {
|
|
818
|
+
if (!canStartRegex) {
|
|
819
|
+
const nextIndex = nextSignificantIndex(code, index + 1);
|
|
820
|
+
if (nextIndex < code.length && !isStatementContinuation(code, nextIndex, lastSignificant)) start = nextIndex;
|
|
821
|
+
}
|
|
822
|
+
canStartRegex = true;
|
|
823
|
+
continue;
|
|
824
|
+
}
|
|
825
|
+
if (!/\s/u.test(char)) {
|
|
826
|
+
canStartRegex = isExpressionOperator(char) || char === ",";
|
|
827
|
+
lastSignificant = char;
|
|
828
|
+
pendingControlParen = false;
|
|
829
|
+
}
|
|
796
830
|
}
|
|
797
831
|
return start;
|
|
798
832
|
}
|
|
833
|
+
|
|
834
|
+
const STATEMENT_CONTINUATION_KEYWORDS = new Set(["catch", "else", "finally"]);
|
|
835
|
+
|
|
836
|
+
function isContinuationKeyword(code, index) {
|
|
837
|
+
if (!isIdentifierStart(code[index])) return false;
|
|
838
|
+
return STATEMENT_CONTINUATION_KEYWORDS.has(code.slice(index, readIdentifier(code, index)));
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
function isStatementContinuation(code, index, previousChar) {
|
|
842
|
+
const char = code[index];
|
|
843
|
+
if (char === "(" || char === "[" || char === "`") return previousChar !== "}" && previousChar !== "";
|
|
844
|
+
if (char === "!" || char === "~") return false;
|
|
845
|
+
if (char !== undefined && isDeclarationContinuation(char)) return true;
|
|
846
|
+
return isContinuationKeyword(code, index);
|
|
847
|
+
}
|
|
@@ -163,7 +163,7 @@ tool_schema(name?) → dict
|
|
|
163
163
|
completion(prompt, model?="default", system?=None, schema?=None) → str | dict
|
|
164
164
|
Oneshot, stateless (no history/tools). \`model\`: \`"smol"\` fast | \`"default"\` session | \`"slow"\` most capable. \`schema\` (JSON-Schema) → structured output, parsed object.
|
|
165
165
|
{{#if spawns}}agent(prompt, agent?="{{spawnDefaultAgent}}", model?=None, label?=None, schema?=None, handle?=False) → str | dict
|
|
166
|
-
Run a subagent → final output. \`agent\` picks another discovered agent; omit it to use \`{{spawnDefaultAgent}}\`. \`schema\` as in completion(). Background via \`local://\` files named in the prompt. \`handle\` →
|
|
166
|
+
Run a subagent → final output. \`agent\` picks another discovered agent; omit it to use \`{{spawnDefaultAgent}}\`. \`schema\` as in completion(). Background via \`local://\` files named in the prompt. \`handle\` → workflow node dict { text, output, handle: \`agent://<id>\`, id, agent } (parsed under \`data\` when \`schema\` set).
|
|
167
167
|
{{#if js}} JS: options are ONE trailing object — agent(prompt, { agent, schema, handle }).
|
|
168
168
|
{{/if}}{{/if}}parallel(thunks) → list
|
|
169
169
|
Thunks through a bounded pool (wide as a \`task\` batch — don't pre-shrink), input order kept; returns when all finish, a throwing thunk propagates.
|
|
@@ -176,14 +176,14 @@ phase(title) → None
|
|
|
176
176
|
\`\`\`
|
|
177
177
|
</prelude>
|
|
178
178
|
{{#if spawns}}
|
|
179
|
-
<
|
|
180
|
-
|
|
179
|
+
<workflow>
|
|
180
|
+
Define the workflow spec IN CODE: partition the work into logically distinct steps, one node per step, then wire them as acyclic waves — never hand-author the graph as a single opaque call.
|
|
181
181
|
- **Name nodes.** Capture each \`agent(…, {{#if py}}handle=True{{/if}}{{#if js}}{ handle: true }{{/if}}{{#if jl}}handle=true{{/if}})\` result; carries \`handle\` (\`agent://<id>\`) + \`output\`.
|
|
182
182
|
- **Wire edges by reference.** Put an upstream node's \`handle\`/\`output\` in the dependent stage's prompt — large transcript never re-inlined. Bulk: \`write("local://<name>.md", …)\`, pass the URI.
|
|
183
183
|
- **\`pipeline(items, *stages)\` = staged waves**, barrier between stages (every item clears stage N before any enters N+1). **\`parallel(thunks)\` = one wave** of independent nodes.
|
|
184
184
|
- **Isolate failure.** A raising node re-raises the lowest-index error, aborts its wave; wrap risky nodes in try/except so a failure degrades only its dependent subtree, independent branches finish.
|
|
185
185
|
- **Acyclic only.** A node never waits on its own descendant.
|
|
186
|
-
</
|
|
186
|
+
</workflow>
|
|
187
187
|
{{/if}}
|
|
188
188
|
|
|
189
189
|
<critical>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../src/agent-loop.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,KAAK,OAAO,EAEZ,WAAW,EAIX,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EACX,YAAY,EACZ,UAAU,EACV,eAAe,EAEf,YAAY,EACZ,SAAS,EACT,aAAa,EAEb,QAAQ,EACR,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,WAAW,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,CAiBzC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,WAAW,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,CAwBzC;AAED,wBAAsB,YAAY,CACjC,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,YAAY,EAAE,CAAC,CAgBzB;AAED,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzB;AA6QD,uGAAuG;AACvG,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,cAAc,GAAG,kBAAkB,CAAC,EAClE,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,CAAC,CAgBlB;
|
|
1
|
+
{"version":3,"file":"agent-loop.d.ts","sourceRoot":"","sources":["../src/agent-loop.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,KAAK,OAAO,EAEZ,WAAW,EAIX,MAAM,uBAAuB,CAAC;AAU/B,OAAO,KAAK,EACX,YAAY,EACZ,UAAU,EACV,eAAe,EAEf,YAAY,EACZ,SAAS,EACT,aAAa,EAEb,QAAQ,EACR,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAEzE;;;GAGG;AACH,wBAAgB,SAAS,CACxB,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,WAAW,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,CAiBzC;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAChC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,WAAW,CAAC,UAAU,EAAE,YAAY,EAAE,CAAC,CAwBzC;AAED,wBAAsB,YAAY,CACjC,OAAO,EAAE,YAAY,EAAE,EACvB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,YAAY,EAAE,CAAC,CAgBzB;AAED,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,QAAQ,EAAE,QAAQ,GAChB,OAAO,CAAC,YAAY,EAAE,CAAC,CAiBzB;AA6QD,uGAAuG;AACvG,wBAAsB,oBAAoB,CACzC,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,cAAc,GAAG,kBAAkB,CAAC,EAClE,MAAM,CAAC,EAAE,WAAW,GAClB,OAAO,CAAC,OAAO,CAAC,CAgBlB;AA+lBD,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,OAAO,CAAC;CACd;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,aAAa,CAYrG;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,qBAAqB,CAOpG"}
|
|
@@ -517,6 +517,9 @@ const ABORTED = Symbol("aborted");
|
|
|
517
517
|
function abortError(reason) {
|
|
518
518
|
return reason instanceof Error ? reason : new Error("Request was aborted");
|
|
519
519
|
}
|
|
520
|
+
function closeAssistantIterator(iterator) {
|
|
521
|
+
void Promise.resolve(iterator.return?.()).catch(() => undefined);
|
|
522
|
+
}
|
|
520
523
|
function normalizeTimeoutMs(timeoutMs) {
|
|
521
524
|
return typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0 ? timeoutMs : undefined;
|
|
522
525
|
}
|
|
@@ -541,7 +544,7 @@ function createAssistantEventReader(iterator, timeoutMs, signal, onIdleTimeout,
|
|
|
541
544
|
return {
|
|
542
545
|
next: async () => {
|
|
543
546
|
if (signal?.aborted) {
|
|
544
|
-
|
|
547
|
+
closeAssistantIterator(iterator);
|
|
545
548
|
return Promise.reject(abortError(signal.reason));
|
|
546
549
|
}
|
|
547
550
|
// The start bound applies only until the provider proves the request is
|
|
@@ -586,7 +589,7 @@ async function readNextAssistantEvent(iterator, idleTimeoutMs, makeTimeoutError,
|
|
|
586
589
|
return;
|
|
587
590
|
}
|
|
588
591
|
const error = makeTimeoutError(idleTimeoutMs);
|
|
589
|
-
|
|
592
|
+
closeAssistantIterator(iterator);
|
|
590
593
|
settle(() => reject(error));
|
|
591
594
|
// Abort after settling so the failure surfaces as an idle timeout,
|
|
592
595
|
// not as a generic abort, while the dead request still gets torn down.
|
|
@@ -597,7 +600,7 @@ async function readNextAssistantEvent(iterator, idleTimeoutMs, makeTimeoutError,
|
|
|
597
600
|
const next = abortPromise ? Promise.race([iterator.next(), abortPromise]) : iterator.next();
|
|
598
601
|
void next.then((result) => {
|
|
599
602
|
if (result === ABORTED) {
|
|
600
|
-
|
|
603
|
+
closeAssistantIterator(iterator);
|
|
601
604
|
settle(() => reject(abortError(signal?.reason)));
|
|
602
605
|
return;
|
|
603
606
|
}
|