@selesai/code 0.13.15 → 0.13.18
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 +37 -0
- package/README.md +2 -14
- package/dist/bun/cli.d.ts +3 -1
- package/dist/bun/cli.js +3 -9
- package/dist/bun/{register-bedrock.js → runtime-setup.js} +5 -0
- package/dist/bun/sandbox-env-setup.d.ts +1 -0
- package/dist/bun/sandbox-env-setup.js +3 -0
- package/dist/cli/auth-command.d.ts +23 -0
- package/dist/cli/auth-command.js +102 -0
- package/dist/cli/config-selector.js +2 -1
- package/dist/cli/setup.d.ts +1 -0
- package/dist/cli/setup.js +11 -0
- package/dist/cli.js +2 -14
- package/dist/config.d.ts +3 -2
- package/dist/config.js +9 -4
- package/dist/core/agent-session-runtime.js +15 -7
- package/dist/core/agent-session.d.ts +2 -6
- package/dist/core/agent-session.js +15 -4
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.js +2 -1
- package/dist/core/extensions/loader.js +3 -0
- package/dist/core/extensions/types.d.ts +16 -2
- package/dist/core/http-dispatcher.js +2 -0
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.js +4 -0
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-runtime.d.ts +1 -0
- package/dist/core/model-runtime.js +5 -2
- package/dist/core/provider-composer.js +8 -2
- package/dist/core/session-export.d.ts +3 -0
- package/dist/core/session-export.js +31 -0
- package/dist/core/session-manager.d.ts +3 -2
- package/dist/core/session-manager.js +40 -13
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/system-prompt.js +10 -10
- package/dist/core/tools/bash.js +3 -117
- package/dist/core/tools/edit.d.ts +1 -12
- package/dist/core/tools/edit.js +5 -163
- package/dist/core/tools/find.js +4 -55
- package/dist/core/tools/grep.js +4 -60
- package/dist/core/tools/ls.js +4 -49
- package/dist/core/tools/read.d.ts +4 -0
- package/dist/core/tools/read.js +10 -122
- package/dist/core/tools/renderers/bash.d.ts +11 -0
- package/dist/core/tools/renderers/bash.js +129 -0
- package/dist/core/tools/renderers/edit.d.ts +22 -0
- package/dist/core/tools/renderers/edit.js +166 -0
- package/dist/core/tools/renderers/find.d.ts +9 -0
- package/dist/core/tools/renderers/find.js +63 -0
- package/dist/core/tools/renderers/grep.d.ts +9 -0
- package/dist/core/tools/renderers/grep.js +68 -0
- package/dist/core/tools/renderers/index.d.ts +27 -0
- package/dist/core/tools/renderers/index.js +46 -0
- package/dist/core/tools/renderers/ls.d.ts +9 -0
- package/dist/core/tools/renderers/ls.js +57 -0
- package/dist/core/tools/renderers/read.d.ts +10 -0
- package/dist/core/tools/renderers/read.js +128 -0
- package/dist/core/tools/renderers/write.d.ts +9 -0
- package/dist/core/tools/renderers/write.js +152 -0
- package/dist/core/tools/write.js +5 -146
- package/dist/extensions/capability-gateway/index.ts +12 -1
- package/dist/extensions/capability-gateway/integration.test.ts +23 -0
- package/dist/extensions/pi-hermes-memory/CHANGELOG.md +18 -0
- package/dist/extensions/pi-hermes-memory/README.md +16 -12
- package/dist/extensions/pi-hermes-memory/docs/ROADMAP.md +1 -1
- package/dist/extensions/pi-hermes-memory/package-lock.json +587 -62
- package/dist/extensions/pi-hermes-memory/package.json +4 -4
- package/dist/extensions/pi-hermes-memory/src/config.ts +32 -0
- package/dist/extensions/pi-hermes-memory/src/constants.ts +12 -2
- package/dist/extensions/pi-hermes-memory/src/handlers/background-review.ts +109 -51
- package/dist/extensions/pi-hermes-memory/src/handlers/index-sessions.ts +9 -3
- package/dist/extensions/pi-hermes-memory/src/handlers/review-memory-ops.ts +257 -98
- package/dist/extensions/pi-hermes-memory/src/handlers/session-backfill.ts +9 -2
- package/dist/extensions/pi-hermes-memory/src/handlers/sync-markdown-memories.ts +5 -0
- package/dist/extensions/pi-hermes-memory/src/index.ts +22 -2
- package/dist/extensions/pi-hermes-memory/src/paths.ts +1 -1
- package/dist/extensions/pi-hermes-memory/src/store/db.ts +6 -0
- package/dist/extensions/pi-hermes-memory/src/store/fts-query.ts +58 -1
- package/dist/extensions/pi-hermes-memory/src/store/memory-store.ts +60 -8
- package/dist/extensions/pi-hermes-memory/src/store/session-indexer.ts +169 -7
- package/dist/extensions/pi-hermes-memory/src/store/session-search.ts +7 -21
- package/dist/extensions/pi-hermes-memory/src/store/sqlite-memory-store.ts +134 -15
- package/dist/extensions/pi-hermes-memory/src/tools/memory-search-tool.ts +4 -2
- package/dist/extensions/pi-hermes-memory/src/tools/memory-tool.ts +24 -9
- package/dist/extensions/pi-hermes-memory/src/types.ts +11 -0
- package/dist/extensions/pi-hermes-memory/tests/config.test.ts +42 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/background-review.test.ts +159 -3
- package/dist/extensions/pi-hermes-memory/tests/handlers/review-memory-ops.test.ts +452 -0
- package/dist/extensions/pi-hermes-memory/tests/handlers/session-backfill.test.ts +39 -0
- package/dist/extensions/pi-hermes-memory/tests/integration/corruption-recovery-integration.test.ts +91 -0
- package/dist/extensions/pi-hermes-memory/tests/store/db.test.ts +29 -0
- package/dist/extensions/pi-hermes-memory/tests/store/fts-query.test.ts +116 -0
- package/dist/extensions/pi-hermes-memory/tests/store/memory-store.test.ts +163 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-indexer.test.ts +233 -0
- package/dist/extensions/pi-hermes-memory/tests/store/session-search.test.ts +12 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-memory-store.test.ts +175 -0
- package/dist/extensions/pi-hermes-memory/tests/store/sqlite-native.test.ts +2 -2
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-search-tool.test.ts +22 -0
- package/dist/extensions/pi-hermes-memory/tests/tools/memory-tool.test.ts +37 -1
- package/dist/extensions/pi-intercom/CHANGELOG.md +13 -0
- package/dist/extensions/pi-intercom/README.md +16 -2
- package/dist/extensions/pi-intercom/broker/spawn.test.ts +19 -2
- package/dist/extensions/pi-intercom/broker/spawn.ts +4 -4
- package/dist/extensions/pi-intercom/index.ts +1 -1
- package/dist/extensions/pi-intercom/intercom.integration.test.ts +121 -2
- package/dist/extensions/pi-intercom/package.json +1 -1
- package/dist/extensions/pi-intercom/project-agent.test.ts +1 -1
- package/dist/extensions/pi-intercom/project-agent.ts +1 -6
- package/dist/extensions/pi-intercom/skills/pi-intercom/SKILL.md +7 -6
- package/dist/extensions/pi-rewind-hook/index.test.ts +7 -0
- package/dist/extensions/pi-subagents/.github/workflows/test.yml +36 -4
- package/dist/extensions/pi-subagents/CHANGELOG.md +120 -0
- package/dist/extensions/pi-subagents/README.md +3 -3
- package/dist/extensions/pi-subagents/agents/researcher.md +23 -13
- package/dist/extensions/pi-subagents/agents/reviewer.md +1 -1
- package/dist/extensions/pi-subagents/agents/scout.md +1 -1
- package/dist/extensions/pi-subagents/docs/agents.md +32 -16
- package/dist/extensions/pi-subagents/docs/configuration.md +41 -15
- package/dist/extensions/pi-subagents/docs/extension-api.md +109 -6
- package/dist/extensions/pi-subagents/docs/missions.md +2 -0
- package/dist/extensions/pi-subagents/docs/models.md +58 -1
- package/dist/extensions/pi-subagents/docs/observability.md +50 -12
- package/dist/extensions/pi-subagents/docs/tool-reference.md +17 -10
- package/dist/extensions/pi-subagents/docs/watchdog.md +1 -1
- package/dist/extensions/pi-subagents/docs/workflows.md +26 -9
- package/dist/extensions/pi-subagents/package-lock.json +747 -177
- package/dist/extensions/pi-subagents/package.json +6 -4
- package/dist/extensions/pi-subagents/runner-server-preload.mjs +13 -0
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +2 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/execution-controls.md +21 -4
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +2 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +2 -0
- package/dist/extensions/pi-subagents/src/agents/advertised-agent-prompt.ts +63 -0
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +61 -16
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +2 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +8 -0
- package/dist/extensions/pi-subagents/src/api/capability-ceiling.ts +0 -1
- package/dist/extensions/pi-subagents/src/api/{pi-args.ts → child-tool-plan.ts} +1 -1
- package/dist/extensions/pi-subagents/src/api/preflight.ts +7 -4
- package/dist/extensions/pi-subagents/src/api/shared-types.ts +2 -2
- package/dist/extensions/pi-subagents/src/api/workflow-resources.ts +6 -0
- package/dist/extensions/pi-subagents/src/extension/config.ts +4 -2
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +2 -10
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +9 -11
- package/dist/extensions/pi-subagents/src/extension/index.ts +99 -10
- package/dist/extensions/pi-subagents/src/extension/public-execution.ts +13 -0
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +7 -23
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +11 -8
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +25 -7
- package/dist/extensions/pi-subagents/src/integrations/pi-web-session-liveness.ts +73 -0
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +228 -136
- package/dist/extensions/pi-subagents/src/intercom/supervisor-ui.ts +244 -0
- package/dist/extensions/pi-subagents/src/missions/workflow-state.ts +37 -16
- package/dist/extensions/pi-subagents/src/runs/background/active-async-capacity.ts +18 -18
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +51 -25
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +46 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-resume.ts +14 -3
- package/dist/extensions/pi-subagents/src/runs/background/async-retention.ts +9 -0
- package/dist/extensions/pi-subagents/src/runs/background/async-status-snapshot.ts +10 -12
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +18 -15
- package/dist/extensions/pi-subagents/src/runs/background/auto-drain.ts +40 -29
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +8 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +79 -247
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +88 -12
- package/dist/extensions/pi-subagents/src/runs/background/owned-process-tree.ts +6 -6
- package/dist/extensions/pi-subagents/src/runs/background/process-terminal.ts +24 -24
- package/dist/extensions/pi-subagents/src/runs/background/retained-nested-route-tracker.ts +96 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-child-session.ts +642 -0
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +75 -6
- package/dist/extensions/pi-subagents/src/runs/background/runner-aliases.ts +163 -0
- package/dist/extensions/pi-subagents/src/runs/background/runner-child-launch.ts +86 -0
- package/dist/extensions/pi-subagents/src/runs/background/runner-child-sessions.ts +31 -0
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +18 -4
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +597 -1092
- package/dist/extensions/pi-subagents/src/runs/background/subagent-wait.ts +3 -0
- package/dist/extensions/pi-subagents/src/runs/background/wait-completions.ts +4 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/async-steering-action.ts +20 -17
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +296 -394
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-control.ts +4 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/foreground-history.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/foreground/prompt-audit.ts +9 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +630 -283
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +8 -5
- package/dist/extensions/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +78 -98
- package/dist/extensions/pi-subagents/src/runs/shared/abort-recovery.ts +3 -3
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +16 -3
- package/dist/extensions/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/async-status-projection.ts +47 -47
- package/dist/extensions/pi-subagents/src/runs/shared/capability-ceiling.ts +1 -2
- package/dist/extensions/pi-subagents/src/runs/shared/child-hooks.ts +174 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-identity.ts +14 -3
- package/dist/extensions/pi-subagents/src/runs/shared/child-launch.ts +319 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-lifecycle.ts +25 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-runtime-config.ts +126 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-session.ts +373 -0
- package/dist/extensions/pi-subagents/src/runs/shared/child-tool-plan.ts +530 -0
- package/dist/extensions/pi-subagents/src/runs/shared/completion-evidence.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +2 -1
- package/dist/extensions/pi-subagents/src/runs/shared/external-cli-preflight.ts +16 -0
- package/dist/extensions/pi-subagents/src/runs/shared/host-step-status.ts +11 -11
- package/dist/extensions/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +30 -20
- package/dist/extensions/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +5 -4
- package/dist/extensions/pi-subagents/src/runs/shared/model-exclusions.ts +84 -15
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +88 -12
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +37 -53
- package/dist/extensions/pi-subagents/src/runs/shared/nested-path.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/shared/orca-progress-tabs.ts +18 -7
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-handoff.ts +57 -12
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +3 -4
- package/dist/extensions/pi-subagents/src/runs/shared/permissions.ts +0 -11
- package/dist/extensions/pi-subagents/src/runs/shared/process-signal.ts +4 -1
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-drain-observation.ts +42 -0
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-model-continuation.ts +69 -0
- package/dist/extensions/pi-subagents/src/runs/shared/readonly-session-evidence.ts +307 -0
- package/dist/extensions/pi-subagents/src/runs/shared/run-fanout-budget.ts +8 -21
- package/dist/extensions/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.ts +3 -30
- package/dist/extensions/pi-subagents/src/runs/shared/structured-output.ts +17 -4
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-control.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +99 -386
- package/dist/extensions/pi-subagents/src/runs/shared/tool-availability.ts +18 -62
- package/dist/extensions/pi-subagents/src/runs/shared/tool-budget.ts +0 -14
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +31 -9
- package/dist/extensions/pi-subagents/src/runs/shared/worktree-setup-command.ts +190 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +506 -226
- package/dist/extensions/pi-subagents/src/shared/child-session-name.ts +1 -1
- package/dist/extensions/pi-subagents/src/shared/jsonl-writer.ts +11 -0
- package/dist/extensions/pi-subagents/src/shared/model-response-aliases.ts +13 -0
- package/dist/extensions/pi-subagents/src/shared/thinking-ceiling.ts +0 -6
- package/dist/extensions/pi-subagents/src/shared/types.ts +145 -89
- package/dist/extensions/pi-subagents/src/shared/utils.ts +13 -6
- package/dist/extensions/pi-subagents/src/shared/watch-strategy.ts +2 -0
- package/dist/extensions/pi-subagents/src/shared/workflow-child-permit.ts +18 -13
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +0 -6
- package/dist/extensions/pi-subagents/src/tui/fleet-status.ts +1 -1
- package/dist/extensions/pi-subagents/src/tui/fleet.ts +11 -6
- package/dist/extensions/pi-subagents/src/tui/render.ts +277 -46
- package/dist/extensions/pi-subagents/src/watchdog/child-status.ts +0 -1
- package/dist/extensions/pi-subagents/src/watchdog/register-child.ts +12 -12
- package/dist/extensions/pi-subagents/src/workflows/chat-progress.ts +3 -3
- package/dist/extensions/pi-subagents/src/workflows/scripted-workflow.ts +116 -15
- package/dist/extensions/pi-subagents/src/workflows/workflow-checklist.ts +15 -18
- package/dist/extensions/pi-subagents/src/workflows/workflow-child-summary.ts +57 -8
- package/dist/extensions/pi-subagents/src/workflows/workflow-preflight.ts +19 -19
- package/dist/extensions/pi-subagents/src/workflows/workflow-receipt.ts +3 -3
- package/dist/extensions/pi-subagents/src/workflows/workflow-resources.ts +97 -22
- package/dist/extensions/pi-subagents/src/workflows/workflow-settlement.ts +3 -0
- package/dist/extensions/pi-subagents/test/integration/acceptance-file-report.test.ts +336 -21
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-1.test.ts +1181 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-2.test.ts +2240 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-3.test.ts +2268 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.part-4.test.ts +1512 -0
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +231 -16
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +4 -18
- package/dist/extensions/pi-subagents/test/integration/foreign-workflow-steering.test.ts +95 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +9 -15
- package/dist/extensions/pi-subagents/test/integration/in-process-child.test.ts +374 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +20 -10
- package/dist/extensions/pi-subagents/test/integration/orca-progress-tabs.test.ts +18 -6
- package/dist/extensions/pi-subagents/test/integration/recovered-assistant-error.test.ts +151 -0
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +42 -1
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +150 -25
- package/dist/extensions/pi-subagents/test/integration/result-publication.test.ts +354 -0
- package/dist/extensions/pi-subagents/test/integration/shared-cwd-terminal-evidence.test.ts +117 -0
- package/dist/extensions/pi-subagents/test/integration/single-execution.part-1.test.ts +3678 -0
- package/dist/extensions/pi-subagents/test/integration/{single-execution.test.ts → single-execution.part-2.test.ts} +500 -4207
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +1 -2
- package/dist/extensions/pi-subagents/test/integration/workflow-result-publication.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/integration/workflow-steer-inbox.test.ts +365 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-child.ts +31 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-clean-install.mjs +74 -0
- package/dist/extensions/pi-subagents/test/smoke/pi085-extension.ts +16 -0
- package/dist/extensions/pi-subagents/test/support/async-execution-fixture.ts +699 -0
- package/dist/extensions/pi-subagents/test/support/fake-child-session.ts +418 -0
- package/dist/extensions/pi-subagents/test/support/foreign-workflow-steer-host.mjs +13 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +30 -76
- package/dist/extensions/pi-subagents/test/support/notify-diagnostics-fixture.ts +84 -0
- package/dist/extensions/pi-subagents/test/support/result-publication-capacity-preload.mjs +70 -0
- package/dist/extensions/pi-subagents/test/support/runner-child-session-factory.ts +17 -0
- package/dist/extensions/pi-subagents/test/support/single-execution-fixture.ts +390 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance-compaction.test.ts +120 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +24 -3
- package/dist/extensions/pi-subagents/test/unit/advertised-agent-prompt.test.ts +87 -0
- package/dist/extensions/pi-subagents/test/unit/advertised-agent-refresh.test.ts +163 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +70 -31
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +78 -3
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +2 -8
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +1 -1
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +73 -66
- package/dist/extensions/pi-subagents/test/unit/async-recovery-descriptor.test.ts +51 -1
- package/dist/extensions/pi-subagents/test/unit/async-retention.test.ts +49 -1
- package/dist/extensions/pi-subagents/test/unit/async-spawn-preload.test.ts +103 -0
- package/dist/extensions/pi-subagents/test/unit/async-status-projection.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-agent-allowlist.test.ts +9 -8
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling.test.ts +10 -7
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +48 -6
- package/dist/extensions/pi-subagents/test/unit/child-runtime-config.test.ts +90 -0
- package/dist/extensions/pi-subagents/test/unit/{pi-args-permission-system.test.ts → child-tool-plan-permission-system.test.ts} +48 -86
- package/dist/extensions/pi-subagents/test/unit/child-tool-plan.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/compaction-resume.test.ts +18 -18
- package/dist/extensions/pi-subagents/test/unit/completion-evidence.test.ts +9 -9
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +8 -7
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +225 -65
- package/dist/extensions/pi-subagents/test/unit/extension-bindings.test.ts +17 -22
- package/dist/extensions/pi-subagents/test/unit/fleet-status.test.ts +11 -1
- package/dist/extensions/pi-subagents/test/unit/fleet.test.ts +47 -3
- package/dist/extensions/pi-subagents/test/unit/foreign-workflow-steering.test.ts +74 -0
- package/dist/extensions/pi-subagents/test/unit/fork-cache-key.test.ts +23 -29
- package/dist/extensions/pi-subagents/test/unit/host-peer-runtime-imports.test.ts +96 -4
- package/dist/extensions/pi-subagents/test/unit/host-step-status.test.ts +4 -4
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +116 -55
- package/dist/extensions/pi-subagents/test/unit/index-segment.test.ts +58 -1
- package/dist/extensions/pi-subagents/test/unit/llm-intent-arbiter.test.ts +104 -3
- package/dist/extensions/pi-subagents/test/unit/mission-lifecycle.test.ts +10 -1
- package/dist/extensions/pi-subagents/test/unit/mission-store.test.ts +31 -1
- package/dist/extensions/pi-subagents/test/unit/model-exclusions.test.ts +102 -51
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +196 -6
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +181 -38
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +62 -70
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +58 -53
- package/dist/extensions/pi-subagents/test/unit/notify-diagnostics.test.ts +42 -0
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +84 -0
- package/dist/extensions/pi-subagents/test/unit/orca-progress-tabs.test.ts +13 -5
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +21 -5
- package/dist/extensions/pi-subagents/test/unit/parallel-handoff.test.ts +5 -4
- package/dist/extensions/pi-subagents/test/unit/permissions.test.ts +2 -6
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +28 -2
- package/dist/extensions/pi-subagents/test/unit/pi-web-session-liveness.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/preflight.test.ts +38 -1
- package/dist/extensions/pi-subagents/test/unit/prompt-audit-optional-peers.test.ts +43 -0
- package/dist/extensions/pi-subagents/test/unit/public-execution.test.ts +24 -2
- package/dist/extensions/pi-subagents/test/unit/readonly-drain-observation.test.ts +174 -0
- package/dist/extensions/pi-subagents/test/unit/readonly-model-continuation.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/readonly-session-evidence.test.ts +1329 -0
- package/dist/extensions/pi-subagents/test/unit/recursion-guard.test.ts +29 -80
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +11 -8
- package/dist/extensions/pi-subagents/test/unit/result-files.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/retained-nested-route-tracker.test.ts +175 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +38 -12
- package/dist/extensions/pi-subagents/test/unit/run-fanout-budget.test.ts +2 -5
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +89 -1
- package/dist/extensions/pi-subagents/test/unit/runtime-acknowledged-extensions.test.ts +2 -16
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +27 -3
- package/dist/extensions/pi-subagents/test/unit/scheduled-supervisor-demand.test.ts +215 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +15 -11
- package/dist/extensions/pi-subagents/test/unit/scripted-workflow.test.ts +237 -1
- package/dist/extensions/pi-subagents/test/unit/steering-action.test.ts +2 -5
- package/dist/extensions/pi-subagents/test/unit/streamed-progress-bounds.test.ts +2 -2
- package/dist/extensions/pi-subagents/test/unit/subagent-guide.test.ts +14 -1
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +130 -739
- package/dist/extensions/pi-subagents/test/unit/supervisor-ask-registration.test.ts +682 -0
- package/dist/extensions/pi-subagents/test/unit/supervisor-ui.test.ts +137 -0
- package/dist/extensions/pi-subagents/test/unit/tool-budget.test.ts +1 -11
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +23 -3
- package/dist/extensions/pi-subagents/test/unit/wait-completions.test.ts +8 -1
- package/dist/extensions/pi-subagents/test/unit/watchdog-tool-actions.test.ts +19 -1
- package/dist/extensions/pi-subagents/test/unit/workflow-chat-progress.test.ts +72 -4
- package/dist/extensions/pi-subagents/test/unit/workflow-checklist.test.ts +17 -3
- package/dist/extensions/pi-subagents/test/unit/workflow-child-summary.test.ts +34 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-detach-reconcile.test.ts +12 -2
- package/dist/extensions/pi-subagents/test/unit/workflow-launch-params.test.ts +46 -6
- package/dist/extensions/pi-subagents/test/unit/workflow-receipt.test.ts +3 -3
- package/dist/extensions/pi-subagents/test/unit/workflow-resources.test.ts +133 -1
- package/dist/extensions/pi-subagents/test/unit/workflow-resume-hint.test.ts +53 -2
- package/dist/extensions/pi-subagents/test/unit/worktree-cleanup-plan.test.ts +222 -14
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +526 -85
- package/dist/extensions/pi-web-agent/src/backends/config.ts +1 -0
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +5 -3
- package/dist/extensions/pi-web-agent/src/search/tokenin.ts +7 -3
- package/dist/extensions/pi-web-agent/src/types.ts +1 -1
- package/dist/extensions/pi-zentui/README.md +17 -0
- package/dist/extensions/pi-zentui/assets/screenshots/footer-status-hyperlink.png +0 -0
- package/dist/extensions/pi-zentui/docs/configuration.md +71 -2
- package/dist/extensions/pi-zentui/extensions/zentui/config.ts +11 -0
- package/dist/extensions/pi-zentui/extensions/zentui/editor-transfer.ts +14 -0
- package/dist/extensions/pi-zentui/extensions/zentui/extension-status.ts +29 -13
- package/dist/extensions/pi-zentui/extensions/zentui/footer-layout.ts +5 -4
- package/dist/extensions/pi-zentui/extensions/zentui/footer-text.ts +11 -0
- package/dist/extensions/pi-zentui/extensions/zentui/footer.ts +11 -10
- package/dist/extensions/pi-zentui/extensions/zentui/index.ts +77 -3
- package/dist/extensions/pi-zentui/extensions/zentui/presets.ts +77 -0
- package/dist/extensions/pi-zentui/extensions/zentui/settings-command.ts +103 -2
- package/dist/extensions/pi-zentui/extensions/zentui/working-line-extension-segments.ts +115 -0
- package/dist/extensions/pi-zentui/extensions/zentui/working-line.ts +87 -5
- package/dist/extensions/pi-zentui/package-lock.json +277 -517
- package/dist/extensions/pi-zentui/package.json +7 -4
- package/dist/extensions/pi-zentui/test/config-presets.test.ts +238 -0
- package/dist/extensions/pi-zentui/test/editor-transfer.test.ts +24 -1
- package/dist/extensions/pi-zentui/test/extension-compliance.test.ts +570 -2
- package/dist/extensions/pi-zentui/test/extension-status.test.ts +90 -0
- package/dist/extensions/pi-zentui/test/footer-hyperlink.test.ts +243 -0
- package/dist/extensions/pi-zentui/test/package-contents.mjs +1 -0
- package/dist/extensions/pi-zentui/test/presets.test.ts +121 -0
- package/dist/extensions/pi-zentui/test/settings-command.test.ts +205 -1
- package/dist/extensions/pi-zentui/test/working-line-extension-segments.test.ts +139 -0
- package/dist/extensions/pi-zentui/test/working-line-lifecycle.integration.test.ts +237 -3
- package/dist/extensions/pi-zentui/test/working-line.test.ts +94 -2
- package/dist/index.d.ts +1 -1
- package/dist/main.js +4 -1
- package/dist/modes/interactive/chat-viewport.d.ts +19 -0
- package/dist/modes/interactive/chat-viewport.js +27 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
- package/dist/modes/interactive/components/assistant-message.js +30 -13
- package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
- package/dist/modes/interactive/components/custom-editor.js +39 -1
- package/dist/modes/interactive/components/first-time-setup.js +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts +2 -0
- package/dist/modes/interactive/components/markdown-transform.js +18 -0
- package/dist/modes/interactive/components/model-selector.js +19 -17
- package/dist/modes/interactive/components/scoped-models-selector.js +21 -23
- package/dist/modes/interactive/components/settings-selector.d.ts +7 -1
- package/dist/modes/interactive/components/settings-selector.js +128 -20
- package/dist/modes/interactive/components/settings-submenu.d.ts +71 -0
- package/dist/modes/interactive/components/settings-submenu.js +164 -0
- package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
- package/dist/modes/interactive/components/status-indicator.js +10 -3
- package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
- package/dist/modes/interactive/components/thinking-selector.js +75 -18
- package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
- package/dist/modes/interactive/components/tool-execution.js +35 -33
- package/dist/modes/interactive/components/trust-selector.js +2 -2
- package/dist/modes/interactive/interactive-mode.d.ts +13 -15
- package/dist/modes/interactive/interactive-mode.js +144 -80
- package/dist/modes/interactive/session-share.d.ts +15 -0
- package/dist/modes/interactive/session-share.js +183 -0
- package/dist/modes/interactive/theme/dark.json +2 -1
- package/dist/modes/interactive/theme/light.json +2 -1
- package/dist/modes/interactive/theme/theme-controller.d.ts +1 -0
- package/dist/modes/interactive/theme/theme-controller.js +5 -0
- package/dist/modes/interactive/theme/theme-json.d.ts +83 -0
- package/dist/modes/interactive/theme/theme-json.js +129 -0
- package/dist/modes/interactive/theme/theme-schema.json +9 -1
- package/dist/modes/interactive/theme/theme.d.ts +14 -5
- package/dist/modes/interactive/theme/theme.js +18 -119
- package/dist/modes/interactive/tui-renderer.d.ts +20 -0
- package/dist/modes/interactive/tui-renderer.js +65 -0
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/management-http.d.ts +24 -0
- package/dist/utils/management-http.js +53 -0
- package/dist/utils/text.d.ts +7 -0
- package/dist/utils/text.js +8 -0
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.js +43 -21
- package/docs/docs.json +0 -4
- package/package.json +4 -4
- package/dist/extensions/pi-subagents/src/runs/shared/child-protocol.ts +0 -415
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +0 -1059
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-startup-retry.ts +0 -116
- package/dist/extensions/pi-subagents/src/shared/post-exit-stdio-guard.ts +0 -85
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +0 -224
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +0 -6986
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +0 -447
- package/dist/extensions/pi-subagents/test/support/real-session-child-cli.mjs +0 -185
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +0 -311
- package/dist/extensions/pi-subagents/test/unit/capability-ceiling-pi-args.test.ts +0 -84
- package/dist/extensions/pi-subagents/test/unit/child-protocol.test.ts +0 -202
- package/dist/extensions/pi-subagents/test/unit/close-grace-timer.test.ts +0 -101
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +0 -2347
- package/dist/extensions/pi-subagents/test/unit/subagent-startup-retry.test.ts +0 -104
- package/dist/extensions/pi-subagents/test/unit/windows-hide-spawn.test.ts +0 -49
- package/dist/skills/imagegen-frontend-mobile/SKILL.md +0 -1465
- package/dist/skills/imagegen-frontend-web/SKILL.md +0 -987
- package/dist/skills/implanger/SKILL.md +0 -70
- package/dist/skills/output/SKILL.md +0 -49
- package/dist/skills/planger/SKILL.md +0 -167
- package/dist/skills/workflow/SKILL.md +0 -95
- package/docs/workflows.md +0 -18
- /package/dist/bun/{register-bedrock.d.ts → runtime-setup.d.ts} +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type ManagedTool = "fd" | "rg" | "rtk";
|
|
2
2
|
export declare function getToolPath(tool: ManagedTool): string | null;
|
|
3
|
+
export declare function getLatestVersion(repo: string): Promise<string>;
|
|
3
4
|
export interface ToolStatus {
|
|
4
5
|
type: "info" | "warning";
|
|
5
6
|
message: string;
|
|
@@ -6,6 +6,7 @@ import { join } from "path";
|
|
|
6
6
|
import { Readable } from "stream";
|
|
7
7
|
import { pipeline } from "stream/promises";
|
|
8
8
|
import { APP_NAME, getBinDir } from "../config.js";
|
|
9
|
+
import { fetchWithRetry } from "./management-http.js";
|
|
9
10
|
const TOOLS_DIR = getBinDir();
|
|
10
11
|
const NETWORK_TIMEOUT_MS = 10_000;
|
|
11
12
|
const DOWNLOAD_TIMEOUT_MS = 120_000;
|
|
@@ -29,7 +30,7 @@ const TOOLS = {
|
|
|
29
30
|
}
|
|
30
31
|
else if (plat === "linux") {
|
|
31
32
|
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
32
|
-
return `fd-v${version}-${archStr}-unknown-linux-
|
|
33
|
+
return `fd-v${version}-${archStr}-unknown-linux-musl.tar.gz`;
|
|
33
34
|
}
|
|
34
35
|
else if (plat === "win32") {
|
|
35
36
|
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
@@ -49,10 +50,8 @@ const TOOLS = {
|
|
|
49
50
|
return `ripgrep-${version}-${archStr}-apple-darwin.tar.gz`;
|
|
50
51
|
}
|
|
51
52
|
else if (plat === "linux") {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
return `ripgrep-${version}-x86_64-unknown-linux-musl.tar.gz`;
|
|
53
|
+
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
54
|
+
return `ripgrep-${version}-${archStr}-unknown-linux-musl.tar.gz`;
|
|
56
55
|
}
|
|
57
56
|
else if (plat === "win32") {
|
|
58
57
|
const archStr = architecture === "arm64" ? "aarch64" : "x86_64";
|
|
@@ -134,17 +133,34 @@ export function getToolPath(tool) {
|
|
|
134
133
|
}
|
|
135
134
|
return null;
|
|
136
135
|
}
|
|
137
|
-
//
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
// Resolve the latest release version from the release page redirect.
|
|
137
|
+
// The api.github.com releases endpoint counts against the anonymous API
|
|
138
|
+
// quota (60 requests/hour per IP), which is permanently exhausted behind
|
|
139
|
+
// shared egress IPs such as corporate proxies and CI runners. The web
|
|
140
|
+
// endpoint answers with a redirect to the tagged release at no quota cost
|
|
141
|
+
// and lives on the same origin as the binary download itself.
|
|
142
|
+
export async function getLatestVersion(repo) {
|
|
143
|
+
const response = await fetchWithRetry(`https://github.com/${repo}/releases/latest`, {
|
|
140
144
|
headers: { "User-Agent": `${APP_NAME}-coding-agent` },
|
|
141
|
-
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
redirect: "manual",
|
|
146
|
+
}, { timeoutMs: NETWORK_TIMEOUT_MS });
|
|
147
|
+
// Only the status and headers matter here. Discard the body so the
|
|
148
|
+
// connection can be reused.
|
|
149
|
+
try {
|
|
150
|
+
await response.body?.cancel();
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
// Discarding the body is best-effort.
|
|
145
154
|
}
|
|
146
|
-
const
|
|
147
|
-
|
|
155
|
+
const location = response.status >= 300 && response.status < 400 ? response.headers.get("location") : null;
|
|
156
|
+
if (!location) {
|
|
157
|
+
throw new Error(`Failed to resolve latest ${repo} release: HTTP ${response.status} without redirect`);
|
|
158
|
+
}
|
|
159
|
+
const tag = new URL(location, "https://github.com").pathname.split("/").pop();
|
|
160
|
+
if (!tag || !location.includes("/releases/tag/")) {
|
|
161
|
+
throw new Error(`Failed to resolve latest ${repo} release: unexpected redirect to ${location}`);
|
|
162
|
+
}
|
|
163
|
+
return decodeURIComponent(tag).replace(/^v/, "");
|
|
148
164
|
}
|
|
149
165
|
// Download a file from URL
|
|
150
166
|
async function downloadFile(url, dest) {
|
|
@@ -152,7 +168,7 @@ async function downloadFile(url, dest) {
|
|
|
152
168
|
signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS),
|
|
153
169
|
});
|
|
154
170
|
if (!response.ok) {
|
|
155
|
-
throw new Error(`
|
|
171
|
+
throw new Error(`Download failed with HTTP ${response.status}: ${url}`);
|
|
156
172
|
}
|
|
157
173
|
if (!response.body) {
|
|
158
174
|
throw new Error("No response body");
|
|
@@ -284,11 +300,8 @@ async function downloadTool(tool) {
|
|
|
284
300
|
throw new Error(`Unknown tool: ${tool}`);
|
|
285
301
|
const plat = platform();
|
|
286
302
|
const architecture = arch();
|
|
287
|
-
//
|
|
288
|
-
|
|
289
|
-
if (tool === "fd" && plat === "darwin" && architecture === "x64") {
|
|
290
|
-
version = "10.3.0";
|
|
291
|
-
}
|
|
303
|
+
// fd is pinned on darwin/x64, so skip the version lookup there.
|
|
304
|
+
const version = tool === "fd" && plat === "darwin" && architecture === "x64" ? "10.3.0" : await getLatestVersion(config.repo);
|
|
292
305
|
// Get asset name for this platform
|
|
293
306
|
const assetName = config.getAssetName(version, plat, architecture);
|
|
294
307
|
if (!assetName) {
|
|
@@ -393,9 +406,18 @@ export async function ensureTool(tool, onStatus) {
|
|
|
393
406
|
return path;
|
|
394
407
|
}
|
|
395
408
|
catch (e) {
|
|
409
|
+
// Include the error cause chain: fetch failures surface as a bare
|
|
410
|
+
// "fetch failed" TypeError with the actionable detail (DNS, TLS,
|
|
411
|
+
// timeout) hidden in the cause. Depth-capped to guard against
|
|
412
|
+
// circular cause chains.
|
|
413
|
+
const messages = [];
|
|
414
|
+
for (let current = e, depth = 0; current instanceof Error && depth < 5; current = current.cause, depth++) {
|
|
415
|
+
if (!messages.includes(current.message))
|
|
416
|
+
messages.push(current.message);
|
|
417
|
+
}
|
|
396
418
|
onStatus?.({
|
|
397
419
|
type: "warning",
|
|
398
|
-
message: `Failed to download ${config.name}: ${
|
|
420
|
+
message: `Failed to download ${config.name}: ${messages.length > 0 ? messages.join(": ") : String(e)}`,
|
|
399
421
|
});
|
|
400
422
|
return undefined;
|
|
401
423
|
}
|
package/docs/docs.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selesai/code",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.18",
|
|
4
4
|
"description": "Maintained, extension-first Pi coding agent with built-in workflows, subagents, web research, questions, skills, and an enhanced terminal UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -60,9 +60,9 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@ast-grep/cli": "0.45.0",
|
|
63
|
-
"@earendil-works/pi-agent-core": "0.
|
|
64
|
-
"@earendil-works/pi-ai": "0.
|
|
65
|
-
"@earendil-works/pi-tui": "0.
|
|
63
|
+
"@earendil-works/pi-agent-core": "0.85.1",
|
|
64
|
+
"@earendil-works/pi-ai": "0.85.1",
|
|
65
|
+
"@earendil-works/pi-tui": "0.85.1",
|
|
66
66
|
"@mozilla/readability": "^0.6.0",
|
|
67
67
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
68
68
|
"acorn": "8.18.0",
|
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
import { Buffer } from "node:buffer";
|
|
2
|
-
import type { ProtocolOutputLimit } from "../../shared/types.ts";
|
|
3
|
-
|
|
4
|
-
export type { ProtocolOutputLimit } from "../../shared/types.ts";
|
|
5
|
-
|
|
6
|
-
export const MAX_CHILD_PENDING_LINE_BYTES = 16 * 1024 * 1024;
|
|
7
|
-
export const MAX_CHILD_STDERR_BYTES = 128 * 1024;
|
|
8
|
-
const MAX_PROTOCOL_DIAGNOSTIC_BYTES = 4096;
|
|
9
|
-
const MAX_PROJECTED_JSON_DEPTH = 256;
|
|
10
|
-
|
|
11
|
-
export interface OversizedLineProjection {
|
|
12
|
-
push(chunk: Buffer): boolean;
|
|
13
|
-
finish(): string | undefined;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface OversizedLineProjector {
|
|
17
|
-
accepts(prefix: string): boolean;
|
|
18
|
-
create(): OversizedLineProjection;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
type JsonContainer =
|
|
22
|
-
| { type: "array"; state: "value-or-end" | "value" | "comma-or-end" }
|
|
23
|
-
| { type: "object"; state: "key-or-end" | "key" | "colon" | "value" | "comma-or-end"; key?: string };
|
|
24
|
-
|
|
25
|
-
type JsonToken =
|
|
26
|
-
| { type: "string"; role: "key" | "value"; value: string; capture: boolean; escape: boolean; unicodeDigits: number; unicodeValue: string }
|
|
27
|
-
| { type: "literal"; expected: string; index: number; value: boolean | null }
|
|
28
|
-
| { type: "number"; phase: "minus" | "zero" | "int" | "dot" | "frac" | "exp" | "exp-sign" | "exp-digits" };
|
|
29
|
-
|
|
30
|
-
function createPiAggregateProjection(): OversizedLineProjection {
|
|
31
|
-
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
32
|
-
const stack: JsonContainer[] = [];
|
|
33
|
-
let rootState: "value" | "end" = "value";
|
|
34
|
-
let token: JsonToken | undefined;
|
|
35
|
-
let valid = true;
|
|
36
|
-
let eventType: string | undefined;
|
|
37
|
-
let willRetry: boolean | undefined;
|
|
38
|
-
|
|
39
|
-
const parent = (): JsonContainer | undefined => stack.at(-1);
|
|
40
|
-
const isTopLevelField = (key: string | undefined): boolean => stack.length === 1 && parent()?.type === "object" && (key === "type" || key === "willRetry");
|
|
41
|
-
|
|
42
|
-
const completeValue = (value?: string | boolean | null): void => {
|
|
43
|
-
const container = parent();
|
|
44
|
-
if (!container) {
|
|
45
|
-
rootState = "end";
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (container.type === "object") {
|
|
49
|
-
if (stack.length === 1 && container.key === "type" && typeof value === "string") eventType = value;
|
|
50
|
-
if (stack.length === 1 && container.key === "willRetry" && typeof value === "boolean") willRetry = value;
|
|
51
|
-
container.key = undefined;
|
|
52
|
-
container.state = "comma-or-end";
|
|
53
|
-
} else container.state = "comma-or-end";
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
const startValue = (char: string): boolean => {
|
|
57
|
-
const container = parent();
|
|
58
|
-
const key = container?.type === "object" ? container.key : undefined;
|
|
59
|
-
if (isTopLevelField(key)) {
|
|
60
|
-
if (key === "type") eventType = undefined;
|
|
61
|
-
else willRetry = undefined;
|
|
62
|
-
}
|
|
63
|
-
if (char === "{" || char === "[") {
|
|
64
|
-
if (stack.length >= MAX_PROJECTED_JSON_DEPTH) return false;
|
|
65
|
-
stack.push(char === "{" ? { type: "object", state: "key-or-end" } : { type: "array", state: "value-or-end" });
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
if (char === '"') {
|
|
69
|
-
token = { type: "string", role: "value", value: "", capture: key === "type" && stack.length === 1, escape: false, unicodeDigits: 0, unicodeValue: "" };
|
|
70
|
-
return true;
|
|
71
|
-
}
|
|
72
|
-
if (char === "t") token = { type: "literal", expected: "true", index: 1, value: true };
|
|
73
|
-
else if (char === "f") token = { type: "literal", expected: "false", index: 1, value: false };
|
|
74
|
-
else if (char === "n") token = { type: "literal", expected: "null", index: 1, value: null };
|
|
75
|
-
else if (char === "-") token = { type: "number", phase: "minus" };
|
|
76
|
-
else if (char === "0") token = { type: "number", phase: "zero" };
|
|
77
|
-
else if (char >= "1" && char <= "9") token = { type: "number", phase: "int" };
|
|
78
|
-
else return false;
|
|
79
|
-
return true;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const closeContainer = (): true => {
|
|
83
|
-
stack.pop();
|
|
84
|
-
completeValue();
|
|
85
|
-
return true;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const processChar = (char: string): boolean => {
|
|
89
|
-
if (token?.type === "string") {
|
|
90
|
-
if (token.unicodeDigits > 0) {
|
|
91
|
-
if (!/[0-9a-fA-F]/.test(char)) return false;
|
|
92
|
-
token.unicodeValue += char;
|
|
93
|
-
token.unicodeDigits--;
|
|
94
|
-
if (token.unicodeDigits === 0 && token.capture) {
|
|
95
|
-
if (token.value.length >= 64) return false;
|
|
96
|
-
token.value += String.fromCharCode(Number.parseInt(token.unicodeValue, 16));
|
|
97
|
-
}
|
|
98
|
-
return true;
|
|
99
|
-
}
|
|
100
|
-
if (token.escape) {
|
|
101
|
-
token.escape = false;
|
|
102
|
-
if (char === "u") { token.unicodeDigits = 4; token.unicodeValue = ""; return true; }
|
|
103
|
-
if (!'"\\/bfnrt'.includes(char)) return false;
|
|
104
|
-
if (token.capture) {
|
|
105
|
-
if (token.value.length >= 64) return false;
|
|
106
|
-
token.value += ({ b: "\b", f: "\f", n: "\n", r: "\r", t: "\t" } as Record<string, string>)[char] ?? char;
|
|
107
|
-
}
|
|
108
|
-
return true;
|
|
109
|
-
}
|
|
110
|
-
if (char === "\\") { token.escape = true; return true; }
|
|
111
|
-
if (char === '"') {
|
|
112
|
-
const finished = token;
|
|
113
|
-
token = undefined;
|
|
114
|
-
if (finished.role === "key") {
|
|
115
|
-
const container = parent();
|
|
116
|
-
if (!container || container.type !== "object") return false;
|
|
117
|
-
container.key = finished.value;
|
|
118
|
-
container.state = "colon";
|
|
119
|
-
} else completeValue(finished.capture ? finished.value : undefined);
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
if (char.charCodeAt(0) < 0x20) return false;
|
|
123
|
-
if (token.capture) {
|
|
124
|
-
if (token.value.length >= 64) return false;
|
|
125
|
-
token.value += char;
|
|
126
|
-
}
|
|
127
|
-
return true;
|
|
128
|
-
}
|
|
129
|
-
if (token?.type === "literal") {
|
|
130
|
-
if (char !== token.expected[token.index]) return false;
|
|
131
|
-
token.index++;
|
|
132
|
-
if (token.index === token.expected.length) {
|
|
133
|
-
const value = token.value;
|
|
134
|
-
token = undefined;
|
|
135
|
-
completeValue(value);
|
|
136
|
-
}
|
|
137
|
-
return true;
|
|
138
|
-
}
|
|
139
|
-
if (token?.type === "number") {
|
|
140
|
-
const phase = token.phase;
|
|
141
|
-
if (phase === "minus") {
|
|
142
|
-
if (char === "0") token.phase = "zero";
|
|
143
|
-
else if (char >= "1" && char <= "9") token.phase = "int";
|
|
144
|
-
else return false;
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
if (phase === "zero" || phase === "int") {
|
|
148
|
-
if (char >= "0" && char <= "9") { if (phase === "zero") return false; return true; }
|
|
149
|
-
if (char === ".") { token.phase = "dot"; return true; }
|
|
150
|
-
if (char === "e" || char === "E") { token.phase = "exp"; return true; }
|
|
151
|
-
} else if (phase === "dot") {
|
|
152
|
-
if (char >= "0" && char <= "9") { token.phase = "frac"; return true; }
|
|
153
|
-
return false;
|
|
154
|
-
} else if (phase === "frac") {
|
|
155
|
-
if (char >= "0" && char <= "9") return true;
|
|
156
|
-
if (char === "e" || char === "E") { token.phase = "exp"; return true; }
|
|
157
|
-
} else if (phase === "exp") {
|
|
158
|
-
if (char === "+" || char === "-") { token.phase = "exp-sign"; return true; }
|
|
159
|
-
if (char >= "0" && char <= "9") { token.phase = "exp-digits"; return true; }
|
|
160
|
-
return false;
|
|
161
|
-
} else if (phase === "exp-sign") {
|
|
162
|
-
if (char >= "0" && char <= "9") { token.phase = "exp-digits"; return true; }
|
|
163
|
-
return false;
|
|
164
|
-
} else if (phase === "exp-digits" && char >= "0" && char <= "9") return true;
|
|
165
|
-
if (!["zero", "int", "frac", "exp-digits"].includes(phase)) return false;
|
|
166
|
-
token = undefined;
|
|
167
|
-
completeValue();
|
|
168
|
-
return processChar(char);
|
|
169
|
-
}
|
|
170
|
-
if (char === " " || char === "\t" || char === "\r" || char === "\n") return true;
|
|
171
|
-
const container = parent();
|
|
172
|
-
if (!container) return rootState === "value" ? startValue(char) : false;
|
|
173
|
-
if (container.type === "object") {
|
|
174
|
-
if (container.state === "key-or-end" || container.state === "key") {
|
|
175
|
-
if (char === "}" && container.state === "key-or-end") return closeContainer();
|
|
176
|
-
if (char !== '"') return false;
|
|
177
|
-
token = { type: "string", role: "key", value: "", capture: stack.length === 1, escape: false, unicodeDigits: 0, unicodeValue: "" };
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
if (container.state === "colon") {
|
|
181
|
-
if (char !== ":") return false;
|
|
182
|
-
container.state = "value";
|
|
183
|
-
return true;
|
|
184
|
-
}
|
|
185
|
-
if (container.state === "value") return startValue(char);
|
|
186
|
-
if (char === ",") { container.state = "key"; return true; }
|
|
187
|
-
if (char === "}") return closeContainer();
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
if (container.state === "value-or-end" || container.state === "value") {
|
|
191
|
-
if (char === "]" && container.state === "value-or-end") return closeContainer();
|
|
192
|
-
return startValue(char);
|
|
193
|
-
}
|
|
194
|
-
if (char === ",") { container.state = "value"; return true; }
|
|
195
|
-
if (char === "]") return closeContainer();
|
|
196
|
-
return false;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const processText = (text: string): boolean => {
|
|
200
|
-
for (const char of text) if (!processChar(char)) return false;
|
|
201
|
-
return true;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
return {
|
|
205
|
-
push(chunk) {
|
|
206
|
-
if (!valid) return false;
|
|
207
|
-
try { valid = processText(decoder.decode(chunk, { stream: true })); }
|
|
208
|
-
catch { valid = false; }
|
|
209
|
-
return valid;
|
|
210
|
-
},
|
|
211
|
-
finish() {
|
|
212
|
-
try { valid = valid && processText(decoder.decode()); }
|
|
213
|
-
catch { valid = false; }
|
|
214
|
-
if (token?.type === "number" && ["zero", "int", "frac", "exp-digits"].includes(token.phase)) {
|
|
215
|
-
token = undefined;
|
|
216
|
-
completeValue();
|
|
217
|
-
}
|
|
218
|
-
if (!valid || token || stack.length !== 0 || rootState !== "end") return undefined;
|
|
219
|
-
if (eventType === "turn_end") return '{"type":"turn_end"}';
|
|
220
|
-
if (eventType === "agent_end" && typeof willRetry === "boolean") return JSON.stringify({ type: "agent_end", willRetry });
|
|
221
|
-
if (eventType === "compaction_end" && typeof willRetry === "boolean") return JSON.stringify({ type: "compaction_end", willRetry });
|
|
222
|
-
return undefined;
|
|
223
|
-
},
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Pi JSON mode emits granular message/tool events followed by aggregate
|
|
229
|
-
* `turn_end`, `agent_end`, and `compaction_end` events that can duplicate
|
|
230
|
-
* large payloads. Parallel image reads can make one aggregate record exceed
|
|
231
|
-
* the child line limit even though every granular event was valid. Replace
|
|
232
|
-
* only syntactically valid, redundant records with the lifecycle fields the
|
|
233
|
-
* runners consume.
|
|
234
|
-
*/
|
|
235
|
-
export const PI_AGGREGATE_EVENT_PROJECTOR: OversizedLineProjector = {
|
|
236
|
-
accepts(prefix) {
|
|
237
|
-
return prefix.startsWith('{"type":"turn_end"') || prefix.startsWith('{"type":"agent_end"') || prefix.startsWith('{"type":"compaction_end"');
|
|
238
|
-
},
|
|
239
|
-
create: createPiAggregateProjection,
|
|
240
|
-
};
|
|
241
|
-
|
|
242
|
-
export function formatProtocolOutputLimit(limit: ProtocolOutputLimit): string {
|
|
243
|
-
return `${limit.code}: child ${limit.stream} line exceeded ${limit.limitBytes} bytes (observed at least ${limit.observedBytes} bytes without a newline).`;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export function createBoundedLineReader(options: {
|
|
247
|
-
stream?: "stdout" | "stderr";
|
|
248
|
-
maxPendingLineBytes?: number;
|
|
249
|
-
oversizedLineProjector?: OversizedLineProjector;
|
|
250
|
-
onLine: (line: string) => void;
|
|
251
|
-
onLimit: (limit: ProtocolOutputLimit) => void;
|
|
252
|
-
}): {
|
|
253
|
-
push(chunk: Buffer | string): void;
|
|
254
|
-
end(): void;
|
|
255
|
-
exceeded(): boolean;
|
|
256
|
-
} {
|
|
257
|
-
const maxPendingLineBytes = options.maxPendingLineBytes ?? MAX_CHILD_PENDING_LINE_BYTES;
|
|
258
|
-
if (!Number.isInteger(maxPendingLineBytes) || maxPendingLineBytes < 1) {
|
|
259
|
-
throw new Error("maxPendingLineBytes must be a positive integer.");
|
|
260
|
-
}
|
|
261
|
-
let pending: Buffer[] = [];
|
|
262
|
-
let pendingBytes = 0;
|
|
263
|
-
let projectedPrefix: Buffer<ArrayBufferLike> = Buffer.alloc(0);
|
|
264
|
-
let projectedTail: Buffer<ArrayBufferLike> = Buffer.alloc(0);
|
|
265
|
-
let projectedBytes = 0;
|
|
266
|
-
let projection: OversizedLineProjection | undefined;
|
|
267
|
-
let projectingOversizedLine = false;
|
|
268
|
-
let limitExceeded = false;
|
|
269
|
-
|
|
270
|
-
const diagnosticTail = (prior: Buffer, segment: Buffer): Buffer => {
|
|
271
|
-
const tailFromSegment = segment.subarray(Math.max(0, segment.length - MAX_PROTOCOL_DIAGNOSTIC_BYTES));
|
|
272
|
-
return tailFromSegment.length === MAX_PROTOCOL_DIAGNOSTIC_BYTES
|
|
273
|
-
? tailFromSegment
|
|
274
|
-
: Buffer.concat([prior.subarray(Math.max(0, prior.length - (MAX_PROTOCOL_DIAGNOSTIC_BYTES - tailFromSegment.length))), tailFromSegment]);
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const failLimit = (observedBytes: number, prefix: Buffer, tail: Buffer): false => {
|
|
278
|
-
limitExceeded = true;
|
|
279
|
-
pending = [];
|
|
280
|
-
pendingBytes = 0;
|
|
281
|
-
projectingOversizedLine = false;
|
|
282
|
-
projection = undefined;
|
|
283
|
-
projectedPrefix = Buffer.alloc(0);
|
|
284
|
-
projectedTail = Buffer.alloc(0);
|
|
285
|
-
projectedBytes = 0;
|
|
286
|
-
options.onLimit({
|
|
287
|
-
code: "protocol_output_limit",
|
|
288
|
-
stream: options.stream ?? "stdout",
|
|
289
|
-
limitBytes: maxPendingLineBytes,
|
|
290
|
-
observedBytes,
|
|
291
|
-
diagnosticPrefix: prefix.toString("utf8"),
|
|
292
|
-
diagnosticTail: tail.toString("utf8"),
|
|
293
|
-
});
|
|
294
|
-
return false;
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
const finishLine = (): void => {
|
|
298
|
-
if (projectingOversizedLine) {
|
|
299
|
-
const projected = projection?.finish();
|
|
300
|
-
if (projected === undefined) {
|
|
301
|
-
failLimit(projectedBytes, projectedPrefix, projectedTail);
|
|
302
|
-
} else {
|
|
303
|
-
options.onLine(projected);
|
|
304
|
-
}
|
|
305
|
-
} else if (pendingBytes > 0) {
|
|
306
|
-
options.onLine(Buffer.concat(pending, pendingBytes).toString("utf8"));
|
|
307
|
-
}
|
|
308
|
-
pending = [];
|
|
309
|
-
pendingBytes = 0;
|
|
310
|
-
projectingOversizedLine = false;
|
|
311
|
-
projection = undefined;
|
|
312
|
-
projectedPrefix = Buffer.alloc(0);
|
|
313
|
-
projectedTail = Buffer.alloc(0);
|
|
314
|
-
projectedBytes = 0;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
const append = (segment: Buffer): boolean => {
|
|
318
|
-
if (segment.length === 0) return true;
|
|
319
|
-
if (projectingOversizedLine) {
|
|
320
|
-
projectedBytes += segment.length;
|
|
321
|
-
projectedTail = diagnosticTail(projectedTail, segment);
|
|
322
|
-
return projection?.push(segment) === true || failLimit(projectedBytes, projectedPrefix, projectedTail);
|
|
323
|
-
}
|
|
324
|
-
const observedBytes = pendingBytes + segment.length;
|
|
325
|
-
if (observedBytes > maxPendingLineBytes) {
|
|
326
|
-
const prior = pendingBytes > 0 ? Buffer.concat(pending, pendingBytes) : Buffer.alloc(0);
|
|
327
|
-
const prefixFromPrior = prior.subarray(0, MAX_PROTOCOL_DIAGNOSTIC_BYTES);
|
|
328
|
-
const prefix = prefixFromPrior.length === MAX_PROTOCOL_DIAGNOSTIC_BYTES
|
|
329
|
-
? prefixFromPrior
|
|
330
|
-
: Buffer.concat([prefixFromPrior, segment.subarray(0, MAX_PROTOCOL_DIAGNOSTIC_BYTES - prefixFromPrior.length)]);
|
|
331
|
-
const tail = diagnosticTail(prior, segment);
|
|
332
|
-
if (options.oversizedLineProjector?.accepts(prefix.toString("utf8"))) {
|
|
333
|
-
const candidate = options.oversizedLineProjector.create();
|
|
334
|
-
if (!candidate.push(prior) || !candidate.push(segment)) return failLimit(observedBytes, prefix, tail);
|
|
335
|
-
pending = [];
|
|
336
|
-
pendingBytes = 0;
|
|
337
|
-
projectingOversizedLine = true;
|
|
338
|
-
projection = candidate;
|
|
339
|
-
projectedPrefix = prefix;
|
|
340
|
-
projectedTail = tail;
|
|
341
|
-
projectedBytes = observedBytes;
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
return failLimit(observedBytes, prefix, tail);
|
|
345
|
-
}
|
|
346
|
-
pending.push(segment);
|
|
347
|
-
pendingBytes = observedBytes;
|
|
348
|
-
return true;
|
|
349
|
-
};
|
|
350
|
-
|
|
351
|
-
return {
|
|
352
|
-
push(chunk) {
|
|
353
|
-
if (limitExceeded) return;
|
|
354
|
-
const bytes = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
|
|
355
|
-
let start = 0;
|
|
356
|
-
for (let index = 0; index < bytes.length; index++) {
|
|
357
|
-
if (bytes[index] !== 0x0a) continue;
|
|
358
|
-
if (!append(bytes.subarray(start, index))) return;
|
|
359
|
-
finishLine();
|
|
360
|
-
if (limitExceeded) return;
|
|
361
|
-
start = index + 1;
|
|
362
|
-
}
|
|
363
|
-
append(bytes.subarray(start));
|
|
364
|
-
},
|
|
365
|
-
end() {
|
|
366
|
-
if (!limitExceeded) finishLine();
|
|
367
|
-
},
|
|
368
|
-
exceeded: () => limitExceeded,
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function trimToUtf8Boundary(buffer: Buffer, maxBytes: number): Buffer {
|
|
373
|
-
if (buffer.length <= maxBytes) return buffer;
|
|
374
|
-
let start = buffer.length - maxBytes;
|
|
375
|
-
while (start < buffer.length && (buffer[start]! & 0xc0) === 0x80) start++;
|
|
376
|
-
return buffer.subarray(start);
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
export function createBoundedByteTail(maxBytes = MAX_CHILD_STDERR_BYTES): {
|
|
380
|
-
push(chunk: Buffer | string): void;
|
|
381
|
-
text(): string;
|
|
382
|
-
byteLength(): number;
|
|
383
|
-
} {
|
|
384
|
-
if (!Number.isInteger(maxBytes) || maxBytes < 1) throw new Error("maxBytes must be a positive integer.");
|
|
385
|
-
let tail: Buffer<ArrayBufferLike> = Buffer.alloc(0);
|
|
386
|
-
return {
|
|
387
|
-
push(chunk) {
|
|
388
|
-
const bytes = typeof chunk === "string" ? Buffer.from(chunk) : chunk;
|
|
389
|
-
tail = trimToUtf8Boundary(Buffer.concat([tail, bytes]), maxBytes);
|
|
390
|
-
},
|
|
391
|
-
text: () => tail.toString("utf8"),
|
|
392
|
-
byteLength: () => tail.length,
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
export type ChildLifecycleAction = "start-drain" | "cancel-drain" | "none";
|
|
397
|
-
|
|
398
|
-
export interface ChildLifecycleState {
|
|
399
|
-
compactionRetryActive: boolean;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
export function projectChildLifecycle(event: { type?: string; willRetry?: unknown }, terminalAssistantStop = false, state?: ChildLifecycleState): ChildLifecycleAction {
|
|
403
|
-
if (event.type === "compaction_end") {
|
|
404
|
-
if (state) state.compactionRetryActive = event.willRetry === true;
|
|
405
|
-
return event.willRetry === true ? "cancel-drain" : "none";
|
|
406
|
-
}
|
|
407
|
-
if (event.type === "agent_start" || event.type === "auto_retry_start") {
|
|
408
|
-
if (state) state.compactionRetryActive = false;
|
|
409
|
-
}
|
|
410
|
-
if (event.type === "agent_end" && event.willRetry === true) return "cancel-drain";
|
|
411
|
-
if (event.type === "agent_end" && state) state.compactionRetryActive = false;
|
|
412
|
-
if (event.type === "agent_settled") return state?.compactionRetryActive ? "none" : "start-drain";
|
|
413
|
-
if (terminalAssistantStop) return "start-drain";
|
|
414
|
-
return "none";
|
|
415
|
-
}
|