@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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,43 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@selesai/code` will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.13.18] - 2026-09-07
|
|
6
|
+
|
|
7
|
+
### Removed
|
|
8
|
+
- **Unused bundled skills.** Removed `imagegen-frontend-mobile`, `imagegen-frontend-web`, `implanger`, `output`, `planger`, and `workflow`.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Herdr pane launch command.** Pass the Selesai binary directly to `herdr pane run` instead of adding shell quotes that become part of the command.
|
|
12
|
+
|
|
13
|
+
## [0.13.17] - 2026-09-07
|
|
14
|
+
|
|
15
|
+
### Upstream sync: Pi v0.85.1
|
|
16
|
+
|
|
17
|
+
- Ported the coding-agent source from Pi v0.84.4 to v0.85.1 per file (134 upstream commits):
|
|
18
|
+
tool `ctx.cwd` handling, proxy/CONNECT tunneling, skills with Bash-only tools, session
|
|
19
|
+
import/fork/share fixes, EXIF orientation, musl fd/ripgrep downloads, model catalog updates
|
|
20
|
+
(GPT-6 Astra added, Grok Build 0.1 removed, Qwen3.8 Flash), per-turn thinking effort,
|
|
21
|
+
prompt-cache TTL, Baseten GLM-5.2 text-only, NO_PROXY matching, compaction abort, signal
|
|
22
|
+
exit codes, branch summary cap, write-tool byte counts, fullscreen transcript controls,
|
|
23
|
+
Alt-wheel scroll speed, embedded working indicator, linear transcript search, hover
|
|
24
|
+
selection, configurable save keybindings, seccomp SIGWINCH, Zed image capability, SDK
|
|
25
|
+
packaging fix.
|
|
26
|
+
- Bumped `@earendil-works/pi-ai`, `pi-agent-core`, `pi-tui` to 0.85.1.
|
|
27
|
+
- Upgraded bundled extensions: pi-subagents v0.64.0→v0.66.0 (child-session runner, workflow
|
|
28
|
+
resources, native supervisor/intercom), pi-intercom v0.12.1→v0.13.0 (`/alias`, Windows
|
|
29
|
+
UTF-16LE launcher), pi-zentui v0.22.3→v0.23.0 (component presets, working-line extension
|
|
30
|
+
segments, hyperlink preservation), pi-hermes-memory v0.9.7→v0.9.8 (review fallback,
|
|
31
|
+
BM25 search, retention pruning, recovery snapshots).
|
|
32
|
+
- Re-applied all Selesai deltas: vision caption relay, capability gateway, tokenin catalog,
|
|
33
|
+
terminal capability settings, `.selesai`/`SELESAI_*` branding, subagents fork APIs.
|
|
34
|
+
|
|
35
|
+
## [0.13.16] - 2026-09-06
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
- **Capability gateway inline-skill routing.** `$skill` references expanded by inline skills are no longer re-recommended through `capability_skill_show`; embedded `<skill>` blocks are excluded from prompt routing.
|
|
39
|
+
- **TokenIn search backend URL.** A custom `baseUrl` ending in `/v1` no longer produces a doubled `/v1/v1/search/…` path, and accounts with a blank `apiKey` are now treated as unconfigured instead of triggering doomed requests.
|
|
40
|
+
- **TokenIn search fallback typing.** Search fallback metadata can now reference any provider, matching actual failover behavior.
|
|
41
|
+
|
|
5
42
|
## [0.13.15] - 2026-09-06
|
|
6
43
|
|
|
7
44
|
### Added
|
package/README.md
CHANGED
|
@@ -13,13 +13,13 @@
|
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
16
|
-
Selesai is a terminal-first **AI coding agent** that takes software tasks from prompt to verified result. It is a maintained, extension-first fork of the [Pi coding agent](https://github.com/earendil-works/pi), with subagents, adaptive workflows, live research, recovery tools, a richer TUI, and **
|
|
16
|
+
Selesai is a terminal-first **AI coding agent** that takes software tasks from prompt to verified result. It is a maintained, extension-first fork of the [Pi coding agent](https://github.com/earendil-works/pi), with subagents, adaptive workflows, live research, recovery tools, a richer TUI, and **28 built-in skills** shipped together in one install.
|
|
17
17
|
|
|
18
18
|
Use your preferred model provider, connect a local or OpenAI-compatible endpoint, or get a ready-to-use token from **[token.in](https://token.selesai.in)**. Selesai keeps Pi's small, hackable core while reducing the setup and extension work needed before an agent can be productive.
|
|
19
19
|
|
|
20
20
|
| | |
|
|
21
21
|
| --- | --- |
|
|
22
|
-
| **Ready out of the box** | One package bundles coordinated extensions, tools, themes, and
|
|
22
|
+
| **Ready out of the box** | One package bundles coordinated extensions, tools, themes, and 28 skills across 9 meaningful categories. |
|
|
23
23
|
| **Delegates and parallelizes** | Focused subagents can research, review, build, or run independent workstreams with foreground, background, parallel, and chained execution. |
|
|
24
24
|
| **Adapts to the task** | The workflow chooses the smallest useful path—from a direct edit to reconnaissance, implementation, review, fixes, and validation. |
|
|
25
25
|
| **Researches with current sources** | Built-in web research, public GitHub code search, and interactive questions help the agent resolve uncertainty before it acts. |
|
|
@@ -109,15 +109,10 @@ Skills ship inside `@selesai/code` and are discovered when Selesai starts. Invok
|
|
|
109
109
|
### 🖼️ Image generation & visual direction
|
|
110
110
|
|
|
111
111
|
- `brandkit` — brand identity boards, logo systems, and visual worlds.
|
|
112
|
-
- `imagegen-frontend-web` — section-by-section website reference images.
|
|
113
|
-
- `imagegen-frontend-mobile` — mobile app screen concepts.
|
|
114
112
|
- `image-to-code` — generate a design direction and implement it as code.
|
|
115
113
|
|
|
116
114
|
### 📋 Planning & orchestration
|
|
117
115
|
|
|
118
|
-
- `planger` — decompose work into subagent-ready plans.
|
|
119
|
-
- `implanger` — execute planger-style plans.
|
|
120
|
-
- `workflow` — adaptive multi-stage implementation orchestration.
|
|
121
116
|
- `pi-subagents` — delegation patterns for parallel, asynchronous, and chained work.
|
|
122
117
|
|
|
123
118
|
### 🧹 Code simplicity — the ponytail family
|
|
@@ -136,7 +131,6 @@ Skills ship inside `@selesai/code` and are discovered when Selesai starts. Invok
|
|
|
136
131
|
### ✅ Completion & output discipline
|
|
137
132
|
|
|
138
133
|
- `unlazy` — acceptance gates, depth trees, and finish-the-job enforcement.
|
|
139
|
-
- `full-output-enforcement` — prevent truncation and placeholder output in generated code.
|
|
140
134
|
|
|
141
135
|
### 📤 Handoff & context transfer
|
|
142
136
|
|
|
@@ -168,12 +162,6 @@ Run parallel commentator agents for correctness, tests, and unnecessary complexi
|
|
|
168
162
|
Have the builder implement this plan, then review the result.
|
|
169
163
|
```
|
|
170
164
|
|
|
171
|
-
### Adaptive implementation workflow
|
|
172
|
-
|
|
173
|
-
The bundled `workflow` skill is a task-sensitive implementation policy, not a rigid slash-command pipeline. A small change can stay direct. A riskier change can add reconnaissance, research, a single writer, targeted review, fixes, and validation without turning every task into a ceremony.
|
|
174
|
-
|
|
175
|
-
Invoke it with `$workflow`, or ask Selesai to orchestrate the implementation in plain language.
|
|
176
|
-
|
|
177
165
|
### Research and interactive decisions
|
|
178
166
|
|
|
179
167
|
- **Web agent** — current web research with search, readable extraction, source ranking, and targeted browser escalation.
|
package/dist/bun/cli.d.ts
CHANGED
package/dist/bun/cli.js
CHANGED
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
process.emitWarning = (() => { });
|
|
6
|
-
registerBunOAuthFlows();
|
|
7
|
-
import { restoreSandboxEnv } from "./restore-sandbox-env.js";
|
|
8
|
-
restoreSandboxEnv();
|
|
9
|
-
await import("./register-bedrock.js");
|
|
10
|
-
await import("../cli.js");
|
|
2
|
+
import "./sandbox-env-setup.js";
|
|
3
|
+
import "./runtime-setup.js";
|
|
4
|
+
import "../cli.js";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import { bedrockProviderModule } from "@earendil-works/pi-ai/bedrock-provider";
|
|
2
|
+
import { registerBunOAuthFlows } from "@earendil-works/pi-ai/bun-oauth";
|
|
2
3
|
import { setBedrockProviderModule } from "@earendil-works/pi-ai/compat";
|
|
4
|
+
import { APP_NAME } from "../config.js";
|
|
5
|
+
process.title = APP_NAME;
|
|
6
|
+
process.emitWarning = (() => { });
|
|
7
|
+
registerBunOAuthFlows();
|
|
3
8
|
setBedrockProviderModule(bedrockProviderModule);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AuthResult } from "@earendil-works/pi-ai";
|
|
2
|
+
import type { Args } from "./args.ts";
|
|
3
|
+
export type AuthCommandKind = "check" | "api_key" | "bearer_token";
|
|
4
|
+
export interface AuthCommand {
|
|
5
|
+
kind: AuthCommandKind;
|
|
6
|
+
args: string[];
|
|
7
|
+
json: boolean;
|
|
8
|
+
credentials: boolean;
|
|
9
|
+
noRefresh: boolean;
|
|
10
|
+
minExpiryMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class AuthCommandError extends Error {
|
|
13
|
+
}
|
|
14
|
+
export declare function getAuthCommandName(kind: AuthCommandKind): string;
|
|
15
|
+
export declare function getAuthCommandUsage(kind: AuthCommandKind): string;
|
|
16
|
+
export declare function isAuthCommandHelp(args: string[]): boolean;
|
|
17
|
+
export declare function printAuthCommandHelp(): void;
|
|
18
|
+
export declare function parseAuthCommand(args: string[]): AuthCommand | undefined;
|
|
19
|
+
export declare function validateAuthCommandArgs(args: Args, kind: AuthCommandKind): {
|
|
20
|
+
provider?: string;
|
|
21
|
+
model?: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function getAuthCredential(auth: AuthResult | undefined): string | undefined;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { APP_NAME } from "../config.js";
|
|
2
|
+
export class AuthCommandError extends Error {
|
|
3
|
+
}
|
|
4
|
+
const AUTH_COMMAND_USAGE = {
|
|
5
|
+
check: `${APP_NAME} auth check --provider <provider> [--json] [--credentials] [--no-refresh]`,
|
|
6
|
+
api_key: `${APP_NAME} auth print-api-key --provider <provider> [--model <model>]`,
|
|
7
|
+
bearer_token: `${APP_NAME} auth print-bearer-token --provider <provider> [--model <model>] [--min-expiry <duration>]`,
|
|
8
|
+
};
|
|
9
|
+
export function getAuthCommandName(kind) {
|
|
10
|
+
return kind === "check" ? "auth check" : kind === "api_key" ? "auth print-api-key" : "auth print-bearer-token";
|
|
11
|
+
}
|
|
12
|
+
export function getAuthCommandUsage(kind) {
|
|
13
|
+
return AUTH_COMMAND_USAGE[kind];
|
|
14
|
+
}
|
|
15
|
+
export function isAuthCommandHelp(args) {
|
|
16
|
+
return (args[0] === "auth" &&
|
|
17
|
+
(args[1] === undefined || args[1] === "help" || args.includes("--help") || args.includes("-h")));
|
|
18
|
+
}
|
|
19
|
+
export function printAuthCommandHelp() {
|
|
20
|
+
console.log(`Usage:
|
|
21
|
+
pi auth print-api-key [--provider <provider>] [--model <model>]
|
|
22
|
+
pi auth print-bearer-token [--provider <provider>] [--model <model>] [--min-expiry <duration>]
|
|
23
|
+
pi auth check [--provider <provider>] [--model <model>] [--json] [--credentials] [--no-refresh]
|
|
24
|
+
|
|
25
|
+
Auth commands require at least one of --provider or --model. Checks refresh expired OAuth credentials by default; --no-refresh prevents this. --credentials emits the credential, or includes it in JSON output.`);
|
|
26
|
+
}
|
|
27
|
+
export function parseAuthCommand(args) {
|
|
28
|
+
if (args[0] !== "auth")
|
|
29
|
+
return undefined;
|
|
30
|
+
const kind = args[1] === "check"
|
|
31
|
+
? "check"
|
|
32
|
+
: args[1] === "print-api-key"
|
|
33
|
+
? "api_key"
|
|
34
|
+
: args[1] === "print-bearer-token"
|
|
35
|
+
? "bearer_token"
|
|
36
|
+
: undefined;
|
|
37
|
+
if (!kind) {
|
|
38
|
+
throw new AuthCommandError(`Unknown auth command "${args[1] ?? ""}". Use "${APP_NAME} auth print-api-key", "${APP_NAME} auth print-bearer-token", or "${APP_NAME} auth check".`);
|
|
39
|
+
}
|
|
40
|
+
const commandArgs = [];
|
|
41
|
+
let json = false;
|
|
42
|
+
let credentials = false;
|
|
43
|
+
let noRefresh = false;
|
|
44
|
+
let minExpiryMs;
|
|
45
|
+
for (let index = 2; index < args.length; index++) {
|
|
46
|
+
const arg = args[index];
|
|
47
|
+
if (arg === "--min-expiry") {
|
|
48
|
+
if (kind !== "bearer_token")
|
|
49
|
+
throw new AuthCommandError("--min-expiry is only supported by print-bearer-token");
|
|
50
|
+
const value = args[++index];
|
|
51
|
+
const match = value ? /^(\d+)(ms|s|m|h)$/iu.exec(value) : undefined;
|
|
52
|
+
if (!match)
|
|
53
|
+
throw new AuthCommandError("--min-expiry must use a duration such as 30m or 1h");
|
|
54
|
+
const amount = Number(match[1]);
|
|
55
|
+
const unit = match[2];
|
|
56
|
+
minExpiryMs = amount * (unit === "ms" ? 1 : unit === "s" ? 1_000 : unit === "m" ? 60_000 : 3_600_000);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (arg === "--json" || arg === "--credentials" || arg === "--no-refresh") {
|
|
60
|
+
if (kind !== "check")
|
|
61
|
+
throw new AuthCommandError(`${arg} is only supported by auth check`);
|
|
62
|
+
if (arg === "--json")
|
|
63
|
+
json = true;
|
|
64
|
+
else if (arg === "--credentials")
|
|
65
|
+
credentials = true;
|
|
66
|
+
else
|
|
67
|
+
noRefresh = true;
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
commandArgs.push(arg);
|
|
71
|
+
}
|
|
72
|
+
return minExpiryMs === undefined
|
|
73
|
+
? { kind, args: commandArgs, json, credentials, noRefresh }
|
|
74
|
+
: { kind, args: commandArgs, json, credentials, noRefresh, minExpiryMs };
|
|
75
|
+
}
|
|
76
|
+
export function validateAuthCommandArgs(args, kind) {
|
|
77
|
+
const provider = args.provider?.trim() || undefined;
|
|
78
|
+
const model = args.model?.trim() || undefined;
|
|
79
|
+
if (args.unknownFlags.size > 0) {
|
|
80
|
+
const option = args.unknownFlags.keys().next().value;
|
|
81
|
+
throw new AuthCommandError(`Unknown option --${option} for "${getAuthCommandName(kind)}".`);
|
|
82
|
+
}
|
|
83
|
+
if (args.apiKey !== undefined || args.messages.length > 0 || args.fileArgs.length > 0) {
|
|
84
|
+
throw new AuthCommandError("Auth commands only accept --provider and --model");
|
|
85
|
+
}
|
|
86
|
+
if (kind === "check") {
|
|
87
|
+
if (!provider && !model) {
|
|
88
|
+
throw new AuthCommandError("Auth checks require --provider <provider> or --model <model>");
|
|
89
|
+
}
|
|
90
|
+
return { provider, model };
|
|
91
|
+
}
|
|
92
|
+
if (!provider && !model) {
|
|
93
|
+
throw new AuthCommandError("Credential printing requires --provider <provider> or --model <model>");
|
|
94
|
+
}
|
|
95
|
+
return { provider, model };
|
|
96
|
+
}
|
|
97
|
+
export function getAuthCredential(auth) {
|
|
98
|
+
if (auth?.auth.apiKey)
|
|
99
|
+
return auth.auth.apiKey;
|
|
100
|
+
const authorization = Object.entries(auth?.auth.headers ?? {}).find(([name]) => name.toLowerCase() === "authorization")?.[1];
|
|
101
|
+
return typeof authorization === "string" ? /^Bearer\s+(.+)$/iu.exec(authorization)?.[1] : undefined;
|
|
102
|
+
}
|
|
@@ -9,7 +9,8 @@ export async function selectConfig(options) {
|
|
|
9
9
|
// Initialize theme before showing TUI
|
|
10
10
|
initTheme(options.settingsManager.getTheme(), true);
|
|
11
11
|
return new Promise((resolve) => {
|
|
12
|
-
const ui = new TuiMainScreen(new ProcessTerminal(),
|
|
12
|
+
const ui = new TuiMainScreen(new ProcessTerminal(), options.settingsManager.getShowHardwareCursor(), options.agentDir);
|
|
13
|
+
ui.setClearOnShrink(options.settingsManager.getClearOnShrink());
|
|
13
14
|
let resolved = false;
|
|
14
15
|
const selector = new ConfigSelectorComponent(options.resolvedPaths, options.settingsManager, options.cwd, options.agentDir, () => {
|
|
15
16
|
if (!resolved) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function setupCli(): void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { APP_NAME } from "../config.js";
|
|
2
|
+
import { configureHttpDispatcher } from "../core/http-dispatcher.js";
|
|
3
|
+
export function setupCli() {
|
|
4
|
+
process.title = APP_NAME;
|
|
5
|
+
process.env.PI_CODING_AGENT = "true";
|
|
6
|
+
process.env.AI_AGENT = "pi";
|
|
7
|
+
process.emitWarning = (() => { });
|
|
8
|
+
// Configure undici before provider SDKs issue requests. Settings are applied
|
|
9
|
+
// once SettingsManager has loaded global/project configuration.
|
|
10
|
+
configureHttpDispatcher();
|
|
11
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
* CLI entry point for the refactored coding agent.
|
|
4
|
-
* Uses main.ts with AgentSession and new mode modules.
|
|
5
|
-
*
|
|
6
|
-
* Test with: npx tsx src/cli-new.ts [args...]
|
|
7
|
-
*/
|
|
8
|
-
import { APP_NAME } from "./config.js";
|
|
9
|
-
import { configureHttpDispatcher } from "./core/http-dispatcher.js";
|
|
2
|
+
import { setupCli } from "./cli/setup.js";
|
|
10
3
|
import { main } from "./main.js";
|
|
11
|
-
|
|
12
|
-
process.env.PI_CODING_AGENT = "true";
|
|
13
|
-
process.emitWarning = (() => { });
|
|
14
|
-
// Configure undici's global dispatcher before provider SDKs issue requests.
|
|
15
|
-
// Runtime settings are applied once SettingsManager has loaded global/project settings.
|
|
16
|
-
configureHttpDispatcher();
|
|
4
|
+
setupCli();
|
|
17
5
|
main(process.argv.slice(2));
|
package/dist/config.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
export declare const isBunBinary: boolean;
|
|
6
6
|
/** Detect if Bun is the runtime (compiled binary or bun run) */
|
|
7
7
|
export declare const isBunRuntime: boolean;
|
|
8
|
+
export declare const isBundledNode: boolean;
|
|
8
9
|
export type InstallMethod = "bun-binary" | "source" | "npm" | "pnpm" | "yarn" | "bun" | "unknown";
|
|
9
10
|
interface SelfUpdateCommandStep {
|
|
10
11
|
command: string;
|
|
@@ -157,8 +158,8 @@ export declare function seedDefaultExtensions(agentDir: string, bundledExtension
|
|
|
157
158
|
/**
|
|
158
159
|
* Seed bundled built-in skills into the user's agent dir/skills.
|
|
159
160
|
* The bundled copy is authoritative: existing user copies are overwritten so a
|
|
160
|
-
* stale installed copy never shadows the shipped skill.
|
|
161
|
-
*
|
|
161
|
+
* stale installed copy never shadows the shipped skill. Retired bundled skills
|
|
162
|
+
* are removed; other user-only skills are left untouched. Returns the list of
|
|
162
163
|
* destination paths that were written.
|
|
163
164
|
*/
|
|
164
165
|
export declare function seedDefaultSkills(agentDir: string, bundledSkillsDir?: string): string[];
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { accessSync, chmodSync, constants, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, unlinkSync, writeFileSync, } from "fs";
|
|
1
|
+
import { accessSync, chmodSync, constants, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, rmSync, unlinkSync, writeFileSync, } from "fs";
|
|
2
2
|
import { homedir } from "os";
|
|
3
3
|
import { basename, dirname, join, resolve, sep, win32 } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
@@ -16,6 +16,7 @@ const __dirname = dirname(__filename);
|
|
|
16
16
|
export const isBunBinary = import.meta.url.includes("$bunfs") || import.meta.url.includes("~BUN") || import.meta.url.includes("%7EBUN");
|
|
17
17
|
/** Detect if Bun is the runtime (compiled binary or bun run) */
|
|
18
18
|
export const isBunRuntime = !!process.versions.bun;
|
|
19
|
+
export const isBundledNode = typeof PI_BUNDLED_NODE !== "undefined" && PI_BUNDLED_NODE;
|
|
19
20
|
function normalizeSelfUpdatePackageTarget(target) {
|
|
20
21
|
if (typeof target === "string") {
|
|
21
22
|
return { packageName: target, installSpec: target };
|
|
@@ -753,12 +754,16 @@ export function seedDefaultExtensions(agentDir, bundledExtensionsDir = getBundle
|
|
|
753
754
|
/**
|
|
754
755
|
* Seed bundled built-in skills into the user's agent dir/skills.
|
|
755
756
|
* The bundled copy is authoritative: existing user copies are overwritten so a
|
|
756
|
-
* stale installed copy never shadows the shipped skill.
|
|
757
|
-
*
|
|
757
|
+
* stale installed copy never shadows the shipped skill. Retired bundled skills
|
|
758
|
+
* are removed; other user-only skills are left untouched. Returns the list of
|
|
758
759
|
* destination paths that were written.
|
|
759
760
|
*/
|
|
760
761
|
export function seedDefaultSkills(agentDir, bundledSkillsDir = getBundledSkillsDir()) {
|
|
761
|
-
|
|
762
|
+
const skillsDir = join(agentDir, "skills");
|
|
763
|
+
for (const name of ["imagegen-frontend-mobile", "imagegen-frontend-web", "implanger", "output", "planger", "workflow"]) {
|
|
764
|
+
rmSync(join(skillsDir, name), { recursive: true, force: true });
|
|
765
|
+
}
|
|
766
|
+
return seedBundledDir(skillsDir, bundledSkillsDir);
|
|
762
767
|
}
|
|
763
768
|
/**
|
|
764
769
|
* Bundled themes load directly from the installed package via
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
-
import { basename, join, resolve } from "node:path";
|
|
1
|
+
import { constants, copyFileSync, existsSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { basename, join, parse, resolve } from "node:path";
|
|
3
3
|
import { resolvePath } from "../utils/paths.js";
|
|
4
4
|
import { emitSessionShutdownEvent } from "./extensions/runner.js";
|
|
5
5
|
import { assertSessionCwdExists } from "./session-cwd.js";
|
|
@@ -229,13 +229,13 @@ export class AgentSessionRuntime {
|
|
|
229
229
|
return { cancelled: false, selectedText };
|
|
230
230
|
}
|
|
231
231
|
const sessionManager = this.session.sessionManager;
|
|
232
|
+
await this.teardownCurrent("fork", sessionManager.getSessionFile());
|
|
232
233
|
if (!targetLeafId) {
|
|
233
|
-
sessionManager.newSession({ parentSession:
|
|
234
|
+
sessionManager.newSession({ parentSession: previousSessionFile });
|
|
234
235
|
}
|
|
235
236
|
else {
|
|
236
237
|
sessionManager.createBranchedSession(targetLeafId);
|
|
237
238
|
}
|
|
238
|
-
await this.teardownCurrent("fork", sessionManager.getSessionFile());
|
|
239
239
|
this.apply(await this.createRuntime({
|
|
240
240
|
cwd: this.cwd,
|
|
241
241
|
agentDir: this.services.agentDir,
|
|
@@ -261,14 +261,22 @@ export class AgentSessionRuntime {
|
|
|
261
261
|
if (!existsSync(sessionDir)) {
|
|
262
262
|
mkdirSync(sessionDir, { recursive: true });
|
|
263
263
|
}
|
|
264
|
-
|
|
264
|
+
let destinationPath = join(sessionDir, basename(resolvedPath));
|
|
265
|
+
const sourceAlreadyStored = resolve(destinationPath) === resolvedPath;
|
|
266
|
+
if (!sourceAlreadyStored) {
|
|
267
|
+
const { name, ext } = parse(destinationPath);
|
|
268
|
+
let suffix = 1;
|
|
269
|
+
while (existsSync(destinationPath)) {
|
|
270
|
+
destinationPath = join(sessionDir, `${name}-${suffix++}${ext}`);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
265
273
|
const beforeResult = await this.emitBeforeSwitch("resume", destinationPath);
|
|
266
274
|
if (beforeResult.cancelled) {
|
|
267
275
|
return beforeResult;
|
|
268
276
|
}
|
|
269
277
|
const previousSessionFile = this.session.sessionFile;
|
|
270
|
-
if (
|
|
271
|
-
copyFileSync(resolvedPath, destinationPath);
|
|
278
|
+
if (!sourceAlreadyStored) {
|
|
279
|
+
copyFileSync(resolvedPath, destinationPath, constants.COPYFILE_EXCL);
|
|
272
280
|
}
|
|
273
281
|
const sessionManager = SessionManager.open(destinationPath, sessionDir, cwdOverride);
|
|
274
282
|
assertSessionCwdExists(sessionManager, this.cwd);
|
|
@@ -97,11 +97,6 @@ export type AgentSessionEvent = Exclude<AgentEvent, {
|
|
|
97
97
|
reason: "manual" | "threshold" | "overflow";
|
|
98
98
|
} | {
|
|
99
99
|
type: "summarization_retry_finished";
|
|
100
|
-
} | {
|
|
101
|
-
type: "auto_retry_end";
|
|
102
|
-
success: boolean;
|
|
103
|
-
attempt: number;
|
|
104
|
-
finalError?: string;
|
|
105
100
|
} | {
|
|
106
101
|
type: "bash_execution_update";
|
|
107
102
|
id?: string;
|
|
@@ -325,7 +320,7 @@ export declare class AgentSession {
|
|
|
325
320
|
get thinkingLevel(): ThinkingLevel;
|
|
326
321
|
/** Whether the session is currently processing an agent run or post-run continuation. */
|
|
327
322
|
get isStreaming(): boolean;
|
|
328
|
-
/** Whether the session has no active agent run,
|
|
323
|
+
/** Whether the session has no active agent run, compaction, branch summary, retry, or queued continuation. */
|
|
329
324
|
get isIdle(): boolean;
|
|
330
325
|
/** Current effective system prompt (includes any per-turn extension modifications) */
|
|
331
326
|
get systemPrompt(): string;
|
|
@@ -545,6 +540,7 @@ export declare class AgentSession {
|
|
|
545
540
|
* Saves to settings.
|
|
546
541
|
*/
|
|
547
542
|
setFollowUpMode(mode: "all" | "one-at-a-time"): void;
|
|
543
|
+
private _clearManualCompactionState;
|
|
548
544
|
/**
|
|
549
545
|
* Manually compact the session context.
|
|
550
546
|
* Aborts current agent operation first.
|
|
@@ -342,7 +342,7 @@ export class AgentSession {
|
|
|
342
342
|
return this._idleWaitPromise;
|
|
343
343
|
}
|
|
344
344
|
_resolveIdleWaitIfIdle() {
|
|
345
|
-
if (this.
|
|
345
|
+
if (!this.isIdle || !this._resolveIdleWait) {
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
348
348
|
const resolve = this._resolveIdleWait;
|
|
@@ -683,9 +683,9 @@ export class AgentSession {
|
|
|
683
683
|
get isStreaming() {
|
|
684
684
|
return this._isAgentRunActive;
|
|
685
685
|
}
|
|
686
|
-
/** Whether the session has no active agent run,
|
|
686
|
+
/** Whether the session has no active agent run, compaction, branch summary, retry, or queued continuation. */
|
|
687
687
|
get isIdle() {
|
|
688
|
-
return !this._isAgentRunActive;
|
|
688
|
+
return !this._isAgentRunActive && !this.isCompacting;
|
|
689
689
|
}
|
|
690
690
|
/** Current effective system prompt (includes any per-turn extension modifications) */
|
|
691
691
|
get systemPrompt() {
|
|
@@ -1486,6 +1486,8 @@ export class AgentSession {
|
|
|
1486
1486
|
*/
|
|
1487
1487
|
async abort() {
|
|
1488
1488
|
this.abortRetry();
|
|
1489
|
+
this.abortCompaction();
|
|
1490
|
+
this.abortBranchSummary();
|
|
1489
1491
|
this.agent.abort();
|
|
1490
1492
|
await this.waitForIdle();
|
|
1491
1493
|
}
|
|
@@ -1705,6 +1707,10 @@ export class AgentSession {
|
|
|
1705
1707
|
// =========================================================================
|
|
1706
1708
|
// Compaction
|
|
1707
1709
|
// =========================================================================
|
|
1710
|
+
_clearManualCompactionState() {
|
|
1711
|
+
this._compactionAbortController = undefined;
|
|
1712
|
+
this._resolveIdleWaitIfIdle();
|
|
1713
|
+
}
|
|
1708
1714
|
/**
|
|
1709
1715
|
* Manually compact the session context.
|
|
1710
1716
|
* Aborts current agent operation first.
|
|
@@ -1800,6 +1806,8 @@ export class AgentSession {
|
|
|
1800
1806
|
usage,
|
|
1801
1807
|
details,
|
|
1802
1808
|
};
|
|
1809
|
+
// compaction_end listeners may submit queued prompts, so expose idle state before notifying them.
|
|
1810
|
+
this._clearManualCompactionState();
|
|
1803
1811
|
this._emit({
|
|
1804
1812
|
type: "compaction_end",
|
|
1805
1813
|
reason: "manual",
|
|
@@ -1813,6 +1821,7 @@ export class AgentSession {
|
|
|
1813
1821
|
const message = error instanceof Error ? error.message : String(error);
|
|
1814
1822
|
const aborted = message === "Compaction cancelled" || (error instanceof Error && error.name === "AbortError");
|
|
1815
1823
|
const errorMessage = aborted ? undefined : `Compaction failed: ${message}`;
|
|
1824
|
+
this._clearManualCompactionState();
|
|
1816
1825
|
this._emit({
|
|
1817
1826
|
type: "compaction_end",
|
|
1818
1827
|
reason: "manual",
|
|
@@ -1831,7 +1840,7 @@ export class AgentSession {
|
|
|
1831
1840
|
throw error;
|
|
1832
1841
|
}
|
|
1833
1842
|
finally {
|
|
1834
|
-
this.
|
|
1843
|
+
this._clearManualCompactionState();
|
|
1835
1844
|
this._reconnectToAgent();
|
|
1836
1845
|
}
|
|
1837
1846
|
}
|
|
@@ -2090,6 +2099,7 @@ export class AgentSession {
|
|
|
2090
2099
|
}
|
|
2091
2100
|
finally {
|
|
2092
2101
|
this._autoCompactionAbortController = undefined;
|
|
2102
|
+
this._resolveIdleWaitIfIdle();
|
|
2093
2103
|
}
|
|
2094
2104
|
}
|
|
2095
2105
|
/**
|
|
@@ -2848,6 +2858,7 @@ export class AgentSession {
|
|
|
2848
2858
|
}
|
|
2849
2859
|
finally {
|
|
2850
2860
|
this._branchSummaryAbortController = undefined;
|
|
2861
|
+
this._resolveIdleWaitIfIdle();
|
|
2851
2862
|
}
|
|
2852
2863
|
}
|
|
2853
2864
|
/**
|
|
@@ -52,7 +52,7 @@ export interface GenerateBranchSummaryOptions {
|
|
|
52
52
|
customInstructions?: string;
|
|
53
53
|
/** If true, customInstructions replaces the default prompt instead of being appended */
|
|
54
54
|
replaceInstructions?: boolean;
|
|
55
|
-
/** Tokens reserved
|
|
55
|
+
/** Tokens reserved when selecting branch history (default 16384) */
|
|
56
56
|
reserveTokens?: number;
|
|
57
57
|
/** Optional session stream function. Used to preserve SDK request behavior without mutating agent state. */
|
|
58
58
|
streamFn?: StreamFn;
|
|
@@ -216,12 +216,13 @@ export async function generateBranchSummary(entries, options) {
|
|
|
216
216
|
timestamp: Date.now(),
|
|
217
217
|
},
|
|
218
218
|
];
|
|
219
|
+
const maxTokens = Math.min(4096, model.maxTokens > 0 ? model.maxTokens : Number.POSITIVE_INFINITY);
|
|
219
220
|
// Call LLM for summarization. Prefer the session stream function so SDK
|
|
220
221
|
// request behavior (timeouts, retries, attribution headers) stays consistent
|
|
221
222
|
// without running through agent state/events. Retried via completeSummarization
|
|
222
223
|
// so transient stream drops reuse the configured retry policy.
|
|
223
224
|
const context = { systemPrompt: SUMMARIZATION_SYSTEM_PROMPT, messages: summarizationMessages };
|
|
224
|
-
const requestOptions = { apiKey, headers, env, signal, maxTokens
|
|
225
|
+
const requestOptions = { apiKey, headers, env, signal, maxTokens };
|
|
225
226
|
const response = await completeSummarization(model, context, requestOptions, streamFn, retry, callbacks);
|
|
226
227
|
// Check if aborted or errored
|
|
227
228
|
if (response.stopReason === "aborted") {
|
|
@@ -55,6 +55,9 @@ const VIRTUAL_MODULES = {
|
|
|
55
55
|
"@mariozechner/pi-coding-agent": _bundledPiCodingAgent,
|
|
56
56
|
};
|
|
57
57
|
const require = createRequire(import.meta.url);
|
|
58
|
+
const isNodeSeaBinary = ("sea" in process.features && process.features.sea === true) ||
|
|
59
|
+
process.getBuiltinModule("node:sea")?.isSea() === true;
|
|
60
|
+
const isTypeScriptSourceRuntime = !isBunBinary && path.extname(fileURLToPath(import.meta.url)) === ".ts";
|
|
58
61
|
/**
|
|
59
62
|
* Get aliases for jiti (used in Node.js/development mode).
|
|
60
63
|
* In Bun binary mode, virtualModules is used instead.
|
|
@@ -882,6 +882,12 @@ export interface MessageRenderOptions {
|
|
|
882
882
|
/** Horizontal padding configured by the outputPad setting. */
|
|
883
883
|
outputPad: number;
|
|
884
884
|
}
|
|
885
|
+
export interface MarkdownTransformContext {
|
|
886
|
+
messageType: "user" | "assistant" | "assistant-thinking";
|
|
887
|
+
isStreaming: boolean;
|
|
888
|
+
availableWidth: number;
|
|
889
|
+
}
|
|
890
|
+
export type MarkdownTransformer = (markdown: string, context: MarkdownTransformContext) => string;
|
|
885
891
|
export interface EntryRenderOptions {
|
|
886
892
|
expanded: boolean;
|
|
887
893
|
}
|
|
@@ -957,6 +963,8 @@ export interface ExtensionAPI {
|
|
|
957
963
|
}): void;
|
|
958
964
|
/** Get the value of a registered CLI flag. */
|
|
959
965
|
getFlag(name: string): boolean | string | undefined;
|
|
966
|
+
/** Register a markdown transformer for assistant/user/thinking text rendering. */
|
|
967
|
+
registerMarkdownTransformer(transformer: MarkdownTransformer): void;
|
|
960
968
|
/** Register a custom renderer for CustomMessageEntry. */
|
|
961
969
|
registerMessageRenderer<T = unknown>(customType: string, renderer: MessageRenderer<T>): void;
|
|
962
970
|
/** Register a custom renderer for CustomEntry. Custom entries do not participate in LLM context. */
|
|
@@ -1007,11 +1015,17 @@ export interface ExtensionAPI {
|
|
|
1007
1015
|
setActiveTools(toolNames: string[]): void;
|
|
1008
1016
|
/** Get available slash commands in the current session. */
|
|
1009
1017
|
getCommands(): SlashCommandInfo[];
|
|
1010
|
-
/**
|
|
1018
|
+
/**
|
|
1019
|
+
* Set the model for the current session without changing the configured default for new sessions.
|
|
1020
|
+
* Returns false if authentication is not configured for the model's provider.
|
|
1021
|
+
*/
|
|
1011
1022
|
setModel(model: Model<any>): Promise<boolean>;
|
|
1012
1023
|
/** Get current thinking level. */
|
|
1013
1024
|
getThinkingLevel(): ThinkingLevel;
|
|
1014
|
-
/**
|
|
1025
|
+
/**
|
|
1026
|
+
* Set the thinking level (clamped to model capabilities) for the current session without changing the configured default
|
|
1027
|
+
* for new sessions.
|
|
1028
|
+
*/
|
|
1015
1029
|
setThinkingLevel(level: ThinkingLevel): void;
|
|
1016
1030
|
/**
|
|
1017
1031
|
* Register or override a model provider.
|
|
@@ -70,6 +70,8 @@ export function configureHttpDispatcher(timeoutMs = DEFAULT_HTTP_IDLE_TIMEOUT_MS
|
|
|
70
70
|
}
|
|
71
71
|
const dispatcher = withUndiciErrorListener(new undici.EnvHttpProxyAgent({
|
|
72
72
|
allowH2: false,
|
|
73
|
+
// Keep HTTP origins on CONNECT tunnels as they were before Undici 8.7.
|
|
74
|
+
proxyTunnel: true,
|
|
73
75
|
bodyTimeout: normalizedTimeoutMs,
|
|
74
76
|
headersTimeout: normalizedTimeoutMs,
|
|
75
77
|
clientFactory: createUndiciClient,
|
|
@@ -5,6 +5,7 @@ export interface AppKeybindings {
|
|
|
5
5
|
"app.exit": true;
|
|
6
6
|
"app.suspend": true;
|
|
7
7
|
"app.thinking.cycle": true;
|
|
8
|
+
"app.thinking.save": true;
|
|
8
9
|
"app.model.cycleForward": true;
|
|
9
10
|
"app.model.cycleBackward": true;
|
|
10
11
|
"app.model.select": true;
|
|
@@ -257,6 +258,10 @@ export declare const KEYBINDINGS: {
|
|
|
257
258
|
readonly defaultKeys: "shift+tab";
|
|
258
259
|
readonly description: "Cycle thinking level";
|
|
259
260
|
};
|
|
261
|
+
readonly "app.thinking.save": {
|
|
262
|
+
readonly defaultKeys: "ctrl+s";
|
|
263
|
+
readonly description: "Save thinking level";
|
|
264
|
+
};
|
|
260
265
|
readonly "app.model.cycleForward": {
|
|
261
266
|
readonly defaultKeys: "ctrl+p";
|
|
262
267
|
readonly description: "Cycle to next model";
|
package/dist/core/keybindings.js
CHANGED
|
@@ -15,6 +15,10 @@ export const KEYBINDINGS = {
|
|
|
15
15
|
defaultKeys: "shift+tab",
|
|
16
16
|
description: "Cycle thinking level",
|
|
17
17
|
},
|
|
18
|
+
"app.thinking.save": {
|
|
19
|
+
defaultKeys: "ctrl+s",
|
|
20
|
+
description: "Save thinking level",
|
|
21
|
+
},
|
|
18
22
|
"app.model.cycleForward": {
|
|
19
23
|
defaultKeys: "ctrl+p",
|
|
20
24
|
description: "Cycle to next model",
|