prismalens 0.5.3 → 0.5.4
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/README.md +7 -5
- package/THIRD_PARTY_NOTICES.txt +381 -3
- package/dist/{chunk-2BLEMVIB.js → chunk-7JTFOLGT.js} +9 -4
- package/dist/{chunk-32MOXOOZ.js → chunk-IEPD6EMA.js} +15 -7
- package/dist/{chunk-2SF6M3PV.js → chunk-IJ2EB73U.js} +10 -0
- package/dist/{chunk-B34NMVBM.js → chunk-JK7AMZSE.js} +34 -1
- package/dist/{chunk-7JF4AL64.js → chunk-NXTEM2HN.js} +3 -2
- package/dist/src/cli/doctor.js +53 -184
- package/dist/src/cli/pair.js +8 -3
- package/dist/src/cli/service-unit.js +1 -1
- package/dist/src/cli/service.js +4 -4
- package/dist/src/cli/tailscale.js +3 -1
- package/dist/src/cli/up-console.js +7 -3
- package/dist/src/cli/up.js +23 -4
- package/dist/src/cli/upgrade-trial.js +1 -1
- package/dist/src/cli/upgrade.js +4 -4
- package/node_modules/@prismalens/agent-adapters/THIRD_PARTY_LICENSES/@agentclientprotocol/sdk/2.1.0/LICENSE +191 -0
- package/node_modules/@prismalens/agent-adapters/THIRD_PARTY_LICENSES/@anthropic-ai/claude-agent-sdk/README.md +2 -2
- package/node_modules/@prismalens/agent-adapters/dist/adapters/bundled.json +6 -6
- package/node_modules/@prismalens/agent-adapters/dist/adapters/claude-agent-acp.mjs +3840 -1504
- package/node_modules/@prismalens/agent-adapters/dist/adapters/codex-acp.mjs +3247 -1158
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/README.md +2 -2
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/bridge.mjs +81 -86
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/browser-sdk.js +76 -83
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-07pvccxf.mjs +43 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-0rjxgk9e.mjs +18 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-fpeb751h.mjs +33 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-jf0rbr11.mjs +17 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core.d.ts +1 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core.mjs +12 -21
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/manifest.json +19 -24
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/manifest.zst.json +23 -28
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/package.json +7 -7
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/sdk-tools.d.ts +11 -0
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/sdk.d.ts +139 -36
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs +68 -73
- package/node_modules/@prismalens/agent-adapters/package.json +1 -1
- package/node_modules/@prismalens/agent-host/dist/launch.js +81 -12
- package/node_modules/@prismalens/agent-host/dist/probe.js +76 -24
- package/node_modules/@prismalens/agent-host/dist/registry/agents.js +17 -1
- package/node_modules/@prismalens/agent-host/dist/workspace/git.js +20 -5
- package/node_modules/@prismalens/agent-host/dist/workspace/index.js +26 -4
- package/node_modules/@prismalens/api/dist/src/app.module.js +14 -0
- package/node_modules/@prismalens/api/dist/src/core/auth/auth.guard.js +7 -3
- package/node_modules/@prismalens/api/dist/src/core/auth/instance-identity.js +12 -0
- package/node_modules/@prismalens/api/dist/src/core/auth/operator.controller.js +1 -1
- package/node_modules/@prismalens/api/dist/src/core/auth/owner.js +18 -0
- package/node_modules/@prismalens/api/dist/src/core/auth/pairing.controller.js +11 -7
- package/node_modules/@prismalens/api/dist/src/core/harness/git-credential.js +18 -0
- package/node_modules/@prismalens/api/dist/src/core/harness/git-env.js +3 -20
- package/node_modules/@prismalens/api/dist/src/core/harness/git-spawn.js +22 -4
- package/node_modules/@prismalens/api/dist/src/core/harness/harness.service.js +81 -1
- package/node_modules/@prismalens/api/dist/src/core/harness/ready-harness.js +26 -0
- package/node_modules/@prismalens/api/dist/src/core/harness/repo-source.service.js +46 -9
- package/node_modules/@prismalens/api/dist/src/core/harness/run-worktree.js +22 -5
- package/node_modules/@prismalens/api/dist/src/core/lifecycle/admission.service.js +35 -0
- package/node_modules/@prismalens/api/dist/src/core/lifecycle/restart-exit.js +8 -0
- package/node_modules/@prismalens/api/dist/src/core/lifecycle/runtime-lifecycle.module.js +28 -0
- package/node_modules/@prismalens/api/dist/src/core/lifecycle/runtime-lifecycle.service.js +186 -0
- package/node_modules/@prismalens/api/dist/src/core/lifecycle/workspace-lock-shutdown.service.js +4 -0
- package/node_modules/@prismalens/api/dist/src/core/live/live-changes.js +25 -12
- package/node_modules/@prismalens/api/dist/src/core/prisma/prisma.service.js +54 -0
- package/node_modules/@prismalens/api/dist/src/core/settings/about.service.js +17 -3
- package/node_modules/@prismalens/api/dist/src/core/settings/diagnostics.service.js +61 -0
- package/node_modules/@prismalens/api/dist/src/core/settings/settings.controller.js +52 -15
- package/node_modules/@prismalens/api/dist/src/core/settings/settings.module.js +3 -1
- package/node_modules/@prismalens/api/dist/src/core/settings/settings.service.js +0 -4
- package/node_modules/@prismalens/api/dist/src/core/settings/update-handoff.js +201 -0
- package/node_modules/@prismalens/api/dist/src/core/settings/update.service.js +373 -0
- package/node_modules/@prismalens/api/dist/src/core/telemetry/telemetry.service.js +16 -7
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/checkout-lease.js +203 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/checkout-status.js +125 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/dispatch.service.js +962 -81
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/dispatcher.js +66 -22
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/event-bus.js +6 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/folder-lock.js +140 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/harness-receipt.js +312 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/in-process-runner.js +27 -5
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/investigation-run.js +683 -60
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/job-store.js +72 -9
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/pre-run-context.js +7 -1
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/restart-recovery.js +112 -0
- package/node_modules/@prismalens/api/dist/src/infrastructure/dispatch/run-abort.js +2 -0
- package/node_modules/@prismalens/api/dist/src/main.js +16 -3
- package/node_modules/@prismalens/api/dist/src/middlewares/cross-site.middleware.js +79 -0
- package/node_modules/@prismalens/api/dist/src/middlewares/host-allowlist.middleware.js +18 -3
- package/node_modules/@prismalens/api/dist/src/modules/alerts/alert-pull.service.js +20 -8
- package/node_modules/@prismalens/api/dist/src/modules/alerts/alerts.service.js +12 -3
- package/node_modules/@prismalens/api/dist/src/modules/asks/asks.contract.js +6 -0
- package/node_modules/@prismalens/api/dist/src/modules/asks/asks.service.js +303 -0
- package/node_modules/@prismalens/api/dist/src/modules/composer/composer.controller.js +64 -0
- package/node_modules/@prismalens/api/dist/src/modules/composer/composer.module.js +54 -0
- package/node_modules/@prismalens/api/dist/src/modules/composer/drafts.service.js +169 -0
- package/node_modules/@prismalens/api/dist/src/modules/delivery/report-delivery.controller.js +5 -1
- package/node_modules/@prismalens/api/dist/src/modules/events/events.service.js +27 -1
- package/node_modules/@prismalens/api/dist/src/modules/fixes/fixes.service.js +12 -4
- package/node_modules/@prismalens/api/dist/src/modules/gateway/gateway.service.js +1034 -80
- package/node_modules/@prismalens/api/dist/src/modules/gateway/runbooks.js +2 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/artifacts.js +30 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/asks.js +94 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/attachments.js +128 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/history.js +42 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/incident.js +74 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/index.js +32 -4
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/knowledge.js +18 -10
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/propose.js +36 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/record.js +80 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/report.js +41 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/rules.js +3 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/run.js +24 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/runbooks.js +18 -12
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/serves.js +11 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/services.js +24 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/thread-tree.js +99 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/threads.js +85 -0
- package/node_modules/@prismalens/api/dist/src/modules/gateway/tools/watches.js +75 -0
- package/node_modules/@prismalens/api/dist/src/modules/images/image-fetch.js +100 -0
- package/node_modules/@prismalens/api/dist/src/modules/images/images.controller.js +50 -0
- package/node_modules/@prismalens/api/dist/src/modules/images/images.module.js +22 -0
- package/node_modules/@prismalens/api/dist/src/modules/images/images.service.js +211 -0
- package/node_modules/@prismalens/api/dist/src/modules/incidents/incidents.controller.js +75 -34
- package/node_modules/@prismalens/api/dist/src/modules/incidents/incidents.module.js +2 -0
- package/node_modules/@prismalens/api/dist/src/modules/incidents/incidents.service.js +89 -46
- package/node_modules/@prismalens/api/dist/src/modules/integrations/host-repositories.service.js +76 -0
- package/node_modules/@prismalens/api/dist/src/modules/integrations/integrations.controller.js +67 -7
- package/node_modules/@prismalens/api/dist/src/modules/integrations/integrations.module.js +4 -1
- package/node_modules/@prismalens/api/dist/src/modules/integrations/telemetry-snapshot.service.js +11 -1
- package/node_modules/@prismalens/api/dist/src/modules/investigations/attachments.service.js +157 -49
- package/node_modules/@prismalens/api/dist/src/modules/investigations/context-pack.service.js +39 -7
- package/node_modules/@prismalens/api/dist/src/modules/investigations/dto/investigation-result.dto.js +3 -3
- package/node_modules/@prismalens/api/dist/src/modules/investigations/investigation-trigger.service.js +4 -1
- package/node_modules/@prismalens/api/dist/src/modules/investigations/investigations.controller.js +301 -21
- package/node_modules/@prismalens/api/dist/src/modules/investigations/investigations.module.js +17 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/investigations.service.js +165 -30
- package/node_modules/@prismalens/api/dist/src/modules/investigations/promotion.js +5 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/run-scope.js +31 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/run-views.js +333 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/subagent-sessions.js +28 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/tool-asks.service.js +193 -0
- package/node_modules/@prismalens/api/dist/src/modules/investigations/worktree-changes.js +324 -0
- package/node_modules/@prismalens/api/dist/src/modules/openapi/build-spec.js +42 -0
- package/node_modules/@prismalens/api/dist/src/modules/openapi/openapi.controller.js +8 -87
- package/node_modules/@prismalens/api/dist/src/modules/overlay/overlay.service.js +36 -24
- package/node_modules/@prismalens/api/dist/src/modules/push/ask-state.js +6 -3
- package/node_modules/@prismalens/api/dist/src/modules/push/push-outbox.js +4 -1
- package/node_modules/@prismalens/api/dist/src/modules/push/push.service.js +13 -3
- package/node_modules/@prismalens/api/dist/src/modules/references/file-list.js +135 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/monitoring.provider.js +200 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/ranking.js +42 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/records.provider.js +463 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/reference-provider.js +9 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/references.service.js +341 -0
- package/node_modules/@prismalens/api/dist/src/modules/references/work-items.provider.js +83 -0
- package/node_modules/@prismalens/api/dist/src/modules/repositories/folder-browser.js +150 -0
- package/node_modules/@prismalens/api/dist/src/modules/repositories/project-scripts.js +100 -0
- package/node_modules/@prismalens/api/dist/src/modules/repositories/repo-icon-scan.js +180 -0
- package/node_modules/@prismalens/api/dist/src/modules/repositories/repositories.controller.js +51 -4
- package/node_modules/@prismalens/api/dist/src/modules/repositories/repositories.module.js +5 -3
- package/node_modules/@prismalens/api/dist/src/modules/repositories/repositories.service.js +91 -15
- package/node_modules/@prismalens/api/dist/src/modules/repositories/repository-icon.service.js +271 -0
- package/node_modules/@prismalens/api/dist/src/modules/repositories/serialize-repository.js +5 -3
- package/node_modules/@prismalens/api/dist/src/modules/repositories/start-git.js +204 -0
- package/node_modules/@prismalens/api/dist/src/modules/run-workspaces/editors.js +122 -0
- package/node_modules/@prismalens/api/dist/src/modules/run-workspaces/run-workspaces.controller.js +15 -16
- package/node_modules/@prismalens/api/dist/src/modules/run-workspaces/run-workspaces.service.js +29 -1
- package/node_modules/@prismalens/api/dist/src/modules/schedules/allowed-asks.js +17 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/decide.js +54 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/recurrence.js +85 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/schedule-text.js +111 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/schedules.controller.js +83 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/schedules.module.js +23 -0
- package/node_modules/@prismalens/api/dist/src/modules/schedules/schedules.service.js +898 -0
- package/node_modules/@prismalens/api/dist/src/modules/services/services.controller.js +24 -5
- package/node_modules/@prismalens/api/dist/src/modules/services/services.module.js +2 -1
- package/node_modules/@prismalens/api/dist/src/modules/services/services.service.js +11 -6
- package/node_modules/@prismalens/api/dist/src/modules/terminal/local-request.js +61 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/pty.js +75 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal-gate.js +57 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal-key-issue.js +22 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal-socket.js +162 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal.controller.js +94 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal.module.js +20 -0
- package/node_modules/@prismalens/api/dist/src/modules/terminal/terminal.service.js +54 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/pending-actions.service.js +465 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/proposals.service.js +234 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/put-off.js +19 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/thread-tree.controller.js +68 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/thread-tree.module.js +46 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/thread-tree.service.js +972 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/tree-gateway.service.js +85 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/tree-io.service.js +98 -0
- package/node_modules/@prismalens/api/dist/src/modules/thread-tree/tree-settings.service.js +49 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/links.service.js +258 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/pr-hosts.js +359 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/pr-url.js +74 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/pull-requests.service.js +471 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-context-settings.controller.js +58 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-context-settings.js +28 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-context.service.js +250 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-sections.js +82 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-titles.js +56 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/thread-watches.service.js +329 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/threads.controller.js +81 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/threads.module.js +53 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/threads.service.js +623 -0
- package/node_modules/@prismalens/api/dist/src/modules/threads/work-items.js +171 -0
- package/node_modules/@prismalens/api/dist/src/modules/timeline/timeline.service.js +2 -0
- package/node_modules/@prismalens/api/dist/src/modules/wakes/agent-wakes.js +17 -0
- package/node_modules/@prismalens/api/dist/src/modules/wakes/session-lifecycle.service.js +376 -0
- package/node_modules/@prismalens/api/dist/src/modules/wakes/session.js +124 -0
- package/node_modules/@prismalens/api/dist/src/modules/wakes/wakes.module.js +28 -0
- package/node_modules/@prismalens/api/dist/src/modules/wakes/wakes.service.js +129 -0
- package/node_modules/@prismalens/api/dist/src/modules/webhooks/dto/generic-webhook.dto.js +12 -0
- package/node_modules/@prismalens/api/dist/src/modules/webhooks/webhooks.controller.js +7 -1
- package/node_modules/@prismalens/api/dist/src/modules/webhooks/webhooks.module.js +2 -0
- package/node_modules/@prismalens/api/dist/src/modules/webhooks/webhooks.service.js +103 -41
- package/node_modules/@prismalens/api/dist/src/shared/utils/literal-like.js +5 -0
- package/node_modules/@prismalens/api/public/THIRD_PARTY_NOTICES.txt +381 -3
- package/node_modules/@prismalens/api/public/assets/AddProjectDialog-BEBKziDJ.js +1 -0
- package/node_modules/@prismalens/api/public/assets/AgentDetail-DNNZ2RSQ.js +6 -0
- package/node_modules/@prismalens/api/public/assets/AlertsBlank-M7HkWlgo.js +1 -0
- package/node_modules/@prismalens/api/public/assets/Composer-MAXlRLhF.js +1 -0
- package/node_modules/@prismalens/api/public/assets/CopyButton-DKP5JHET.js +1 -0
- package/node_modules/@prismalens/api/public/assets/HelperThread-BmGnmkL5.js +1 -0
- package/node_modules/@prismalens/api/public/assets/Hint-BCpVhAvV.js +1 -0
- package/node_modules/@prismalens/api/public/assets/HomeComposer-BI6Vhge8.js +1 -0
- package/node_modules/@prismalens/api/public/assets/HypothesesCard-HKxfxVbG.js +1 -0
- package/node_modules/@prismalens/api/public/assets/IncidentHeader-BIYafwD0.js +2 -0
- package/node_modules/@prismalens/api/public/assets/KeptWorkspaces-ozJb7lRG.js +1 -0
- package/node_modules/@prismalens/api/public/assets/MergeDialog-DRjChRQQ.js +1 -0
- package/node_modules/@prismalens/api/public/assets/NewThread-HisGwIRc.js +2 -0
- package/node_modules/@prismalens/api/public/assets/PageHeader-CL1AN9BA.js +1 -0
- package/node_modules/@prismalens/api/public/assets/PanelShell-BHpdPx3P.js +1 -0
- package/node_modules/@prismalens/api/public/assets/ProjectList-lAMigyat.js +1 -0
- package/node_modules/@prismalens/api/public/assets/ResolveDialog-DbMNHrwo.js +1 -0
- package/node_modules/@prismalens/api/public/assets/RingTick-DkMvLoUV.js +1 -0
- package/node_modules/@prismalens/api/public/assets/Row-B3HLhwlw.js +1 -0
- package/node_modules/@prismalens/api/public/assets/RunStrip-CLaYEj2D.js +1 -0
- package/node_modules/@prismalens/api/public/assets/RunsMenu-CD4Yy4jT.js +1 -0
- package/node_modules/@prismalens/api/public/assets/ScheduleDialog-DPYtmK0g.js +2 -0
- package/node_modules/@prismalens/api/public/assets/ServiceFormDialog-9-qDnObk.js +1 -0
- package/node_modules/@prismalens/api/public/assets/SettingsFrame-D4eE2n4w.js +1 -0
- package/node_modules/@prismalens/api/public/assets/State-CCKzehkH.js +1 -0
- package/node_modules/@prismalens/api/public/assets/SubagentPane-exGNOprU.js +1574 -0
- package/node_modules/@prismalens/api/public/assets/TickDot-m_aEzdkj.js +1 -0
- package/node_modules/@prismalens/api/public/assets/Transcript-2ke3pjya.js +159 -0
- package/node_modules/@prismalens/api/public/assets/TriggerCard-BIAznpA9.js +1 -0
- package/node_modules/@prismalens/api/public/assets/WebhookCopy-C8w9xwD6.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{WorkspaceFields-CiyyjkGf.js → WorkspaceFields-DCSJCThm.js} +6 -6
- package/node_modules/@prismalens/api/public/assets/___design-8brlEBqd.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_authenticated-BETuqAeS.js +22 -0
- package/node_modules/@prismalens/api/public/assets/_authenticated-BVT266zx.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_authenticated-BrP-ENHg.css +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-B8v8uWe_.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-BeO8QWfB.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-Cnh_sXTf.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-Crvjv3cl.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-DiQnst4D.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-VgE-Xeq5.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id-y5y3CxjT.js +1 -0
- package/node_modules/@prismalens/api/public/assets/_id_.runs._runId-U4P5LH-M.js +1 -0
- package/node_modules/@prismalens/api/public/assets/alerts-BI1l8Cxn.js +1 -0
- package/node_modules/@prismalens/api/public/assets/app-DmCziBS9.css +2 -0
- package/node_modules/@prismalens/api/public/assets/automation-FhFtuS5_.js +1 -0
- package/node_modules/@prismalens/api/public/assets/boxes-Dh2QZfJa.js +1 -0
- package/node_modules/@prismalens/api/public/assets/button-DmIfWVZ8.js +1 -0
- package/node_modules/@prismalens/api/public/assets/check-DfKru7HJ.js +1 -0
- package/node_modules/@prismalens/api/public/assets/chevron-left-DWLaEwl8.js +1 -0
- package/node_modules/@prismalens/api/public/assets/chevron-right-tPbGnTHi.js +1 -0
- package/node_modules/@prismalens/api/public/assets/circle-BqIhGHXt.js +1 -0
- package/node_modules/@prismalens/api/public/assets/command-chip-5Lf0FARB.js +1 -0
- package/node_modules/@prismalens/api/public/assets/conversation-CXkaesO_.js +1 -0
- package/node_modules/@prismalens/api/public/assets/copy-BUnkkIK-.js +1 -0
- package/node_modules/@prismalens/api/public/assets/desktop-Bqso9PNq.js +9 -0
- package/node_modules/@prismalens/api/public/assets/{device-name-uZQ3wSgk.js → device-name-CZPntaj6.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/dist-CQz4Osl1.js +1 -0
- package/node_modules/@prismalens/api/public/assets/dist-CYLssYEL.js +1 -0
- package/node_modules/@prismalens/api/public/assets/dropdown-menu-Db9u3UIb.js +1 -0
- package/node_modules/@prismalens/api/public/assets/ellipsis-d1vABf4v.js +1 -0
- package/node_modules/@prismalens/api/public/assets/evidence-files-C9UcJR1J.js +1 -0
- package/node_modules/@prismalens/api/public/assets/fixes-CgjsPkfr.js +1 -0
- package/node_modules/@prismalens/api/public/assets/folder-git-2-DRsiaeAx.js +1 -0
- package/node_modules/@prismalens/api/public/assets/globe-D2S-zGel.js +1 -0
- package/node_modules/@prismalens/api/public/assets/harness-CokJrRXZ.js +55 -0
- package/node_modules/@prismalens/api/public/assets/highlighted-body-JLMTFACH-B_v9yJZa.js +1 -0
- package/node_modules/@prismalens/api/public/assets/incidents-B0KnIveX.js +1 -0
- package/node_modules/@prismalens/api/public/assets/index-DZMj9YK4.js +23 -0
- package/node_modules/@prismalens/api/public/assets/input-CXxt1dAV.js +1 -0
- package/node_modules/@prismalens/api/public/assets/key-CjFGD02m.js +1 -0
- package/node_modules/@prismalens/api/public/assets/lazyRouteComponent-DkcTE9Kh.js +1 -0
- package/node_modules/@prismalens/api/public/assets/live-refresh-C5Jfxdxb.js +1 -0
- package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-CqliGVff.js +1 -0
- package/node_modules/@prismalens/api/public/assets/needs-find-DPugLWCN.js +1 -0
- package/node_modules/@prismalens/api/public/assets/new-Ci475pgf.js +1 -0
- package/node_modules/@prismalens/api/public/assets/pair-CobM73_c.js +1 -0
- package/node_modules/@prismalens/api/public/assets/pencil-BwNhunJy.js +1 -0
- package/node_modules/@prismalens/api/public/assets/plus-DWSahnrj.js +1 -0
- package/node_modules/@prismalens/api/public/assets/preload-helper-BLdHbfdN.js +1 -0
- package/node_modules/@prismalens/api/public/assets/projects-CIckRlw8.js +1 -0
- package/node_modules/@prismalens/api/public/assets/record-context-CoIOStXx.js +1 -0
- package/node_modules/@prismalens/api/public/assets/restart-40l7XMmi.js +1 -0
- package/node_modules/@prismalens/api/public/assets/route-Bg17GbpR.js +1 -0
- package/node_modules/@prismalens/api/public/assets/route-DX3TI7JD.js +1 -0
- package/node_modules/@prismalens/api/public/assets/route-Dvao2bBW.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{route-CCkTDfa6.js → route-ah1SnYbH.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/run-details-DTzMO1X0.js +1 -0
- package/node_modules/@prismalens/api/public/assets/run-labels-ubQZmnqd.js +2 -0
- package/node_modules/@prismalens/api/public/assets/select-98_n4DVz.js +1 -0
- package/node_modules/@prismalens/api/public/assets/service-detail.utils-ulWHS1Ao.js +1 -0
- package/node_modules/@prismalens/api/public/assets/service-lanes-BfHIrySn.js +1 -0
- package/node_modules/@prismalens/api/public/assets/services-CZQMzqYj.js +1 -0
- package/node_modules/@prismalens/api/public/assets/settings-QPxeIS82.js +1 -0
- package/node_modules/@prismalens/api/public/assets/source-words-B5oOdiQU.js +4 -0
- package/node_modules/@prismalens/api/public/assets/state-tone-DEsvSFn6.js +1 -0
- package/node_modules/@prismalens/api/public/assets/strip-inline-markdown-d6Movgzo.js +1 -0
- package/node_modules/@prismalens/api/public/assets/switch-DpPkkZxw.js +1 -0
- package/node_modules/@prismalens/api/public/assets/theme-provider-C9jvt7JX.js +1 -0
- package/node_modules/@prismalens/api/public/assets/threads-BqAHgCGd.js +1 -0
- package/node_modules/@prismalens/api/public/assets/tick-copy-B7dbIrfQ.js +1 -0
- package/node_modules/@prismalens/api/public/assets/trigger-DVo1oKMX.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{use-back-VWIQYM2j.js → use-back-R0oWqfab.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/use-operator-BH6GxjAY.js +1 -0
- package/node_modules/@prismalens/api/public/assets/use-repositories-orpc-c6hPOKjE.js +41 -0
- package/node_modules/@prismalens/api/public/assets/use-threads-orpc-rBrvQXJf.js +1 -0
- package/node_modules/@prismalens/api/public/assets/useInvestigationRun-xdB0R08B.js +1 -0
- package/node_modules/@prismalens/api/public/assets/useLocation-CXMqJKgu.js +1 -0
- package/node_modules/@prismalens/api/public/assets/{useSearch-Bq5sxYI3.js → useMatch-B0f9tdXB.js} +1 -1
- package/node_modules/@prismalens/api/public/assets/useQueries-CGpidxif.js +1 -0
- package/node_modules/@prismalens/api/public/assets/useSearch-BBl0vmEJ.js +1 -0
- package/node_modules/@prismalens/api/public/index.html +5 -3
- package/node_modules/@prismalens/auth/dist/index.js +2 -1
- package/node_modules/@prismalens/auth/dist/pairing.js +31 -6
- package/node_modules/@prismalens/auth/dist/terminal-key.js +25 -0
- package/node_modules/@prismalens/config/dist/acp-registry.json +151 -103
- package/node_modules/@prismalens/config/dist/index.js +3 -0
- package/node_modules/@prismalens/config/dist/providers/harness.js +61 -6
- package/node_modules/@prismalens/config/dist/utils/app-data.js +14 -13
- package/node_modules/@prismalens/config/dist/utils/background-service.js +9 -4
- package/node_modules/@prismalens/config/dist/utils/diagnostics.js +247 -0
- package/node_modules/@prismalens/config/dist/utils/node-version.js +29 -0
- package/node_modules/@prismalens/config/dist/utils/update-install.js +160 -0
- package/node_modules/@prismalens/contracts/dist/contracts/composer.js +70 -0
- package/node_modules/@prismalens/contracts/dist/contracts/incidents.js +3 -2
- package/node_modules/@prismalens/contracts/dist/contracts/index.js +16 -0
- package/node_modules/@prismalens/contracts/dist/contracts/investigations.js +184 -2
- package/node_modules/@prismalens/contracts/dist/contracts/live.js +8 -1
- package/node_modules/@prismalens/contracts/dist/contracts/pairing.js +6 -0
- package/node_modules/@prismalens/contracts/dist/contracts/push.js +1 -1
- package/node_modules/@prismalens/contracts/dist/contracts/repositories.js +41 -1
- package/node_modules/@prismalens/contracts/dist/contracts/run-workspaces.js +11 -0
- package/node_modules/@prismalens/contracts/dist/contracts/schedules.js +84 -0
- package/node_modules/@prismalens/contracts/dist/contracts/settings.js +99 -1
- package/node_modules/@prismalens/contracts/dist/contracts/sources.js +19 -19
- package/node_modules/@prismalens/contracts/dist/contracts/terminal.js +43 -0
- package/node_modules/@prismalens/contracts/dist/contracts/thread-tree.js +87 -0
- package/node_modules/@prismalens/contracts/dist/contracts/threads.js +239 -0
- package/node_modules/@prismalens/contracts/dist/schemas/ask-projection.js +107 -0
- package/node_modules/@prismalens/contracts/dist/schemas/asks.js +211 -0
- package/node_modules/@prismalens/contracts/dist/schemas/composer.js +139 -0
- package/node_modules/@prismalens/contracts/dist/schemas/context-pack.js +6 -2
- package/node_modules/@prismalens/contracts/dist/schemas/impact.js +2 -0
- package/node_modules/@prismalens/contracts/dist/schemas/incident.js +29 -2
- package/node_modules/@prismalens/contracts/dist/schemas/index.js +12 -0
- package/node_modules/@prismalens/contracts/dist/schemas/investigation.js +642 -39
- package/node_modules/@prismalens/contracts/dist/schemas/pull-request.js +176 -0
- package/node_modules/@prismalens/contracts/dist/schemas/recommendation.js +2 -1
- package/node_modules/@prismalens/contracts/dist/schemas/references.js +104 -0
- package/node_modules/@prismalens/contracts/dist/schemas/repository.js +69 -2
- package/node_modules/@prismalens/contracts/dist/schemas/run-views.js +168 -0
- package/node_modules/@prismalens/contracts/dist/schemas/schedule.js +172 -0
- package/node_modules/@prismalens/contracts/dist/schemas/service.js +4 -1
- package/node_modules/@prismalens/contracts/dist/schemas/settings.js +101 -1
- package/node_modules/@prismalens/contracts/dist/schemas/source-type.js +25 -1
- package/node_modules/@prismalens/contracts/dist/schemas/subagents.js +31 -0
- package/node_modules/@prismalens/contracts/dist/schemas/terminal.js +78 -0
- package/node_modules/@prismalens/contracts/dist/schemas/thread-context.js +222 -0
- package/node_modules/@prismalens/contracts/dist/schemas/thread-tree.js +172 -0
- package/node_modules/@prismalens/contracts/dist/schemas/thread.js +159 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/internal/class.js +4 -4
- package/node_modules/@prismalens/database/dist/prisma/generated/internal/prismaNamespace.js +231 -1
- package/node_modules/@prismalens/database/dist/prisma/generated/models/CheckoutLease.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ComposerDraft.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/PendingAction.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/PrWatch.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/Proposal.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/PullRequest.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ReferenceUse.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/Schedule.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ScheduleEvent.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ScheduleTick.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/SecretRequested.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/SubagentSession.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ThreadMessage.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ThreadWait.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ThreadWake.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/ToolAsk.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/generated/models/TreeAllowance.js +2 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261028083515_scheduled_tasks/migration.sql +148 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261102044114_investigation_service_set_null/migration.sql +57 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261102202000_thread_subjects/migration.sql +78 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261103010000_thread_list/migration.sql +3 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261103090000_thread_titles/migration.sql +2 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261103200000_helper_place/migration.sql +2 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261104010000_project_kinds/migration.sql +3 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261104200000_schedule_subjects/migration.sql +41 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261107100000_composer/migration.sql +40 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261107110000_session_wake/migration.sql +26 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261107120000_thread_context/migration.sql +32 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261107130000_app_sources/migration.sql +4 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261107140000_thread_tree/migration.sql +166 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261108100000_subagents/migration.sql +51 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/20261108110000_in_place/migration.sql +15 -0
- package/node_modules/@prismalens/database/dist/prisma/sqlite/schema/app.prisma +391 -7
- package/node_modules/@prismalens/engine/dist/adapter/acp-adapter.js +380 -31
- package/node_modules/@prismalens/engine/dist/index.js +2 -0
- package/node_modules/@prismalens/engine/dist/launch/policy.js +29 -9
- package/node_modules/@prismalens/engine/dist/run/conductor.js +5 -1
- package/node_modules/@prismalens/engine/dist/run/elicitation.js +244 -0
- package/node_modules/@prismalens/engine/dist/run/fence.js +23 -5
- package/node_modules/@prismalens/engine/dist/run/findings.js +203 -0
- package/node_modules/@prismalens/engine/dist/run/handoff.js +86 -2
- package/node_modules/@prismalens/engine/dist/run/harness-doctor.js +46 -6
- package/node_modules/@prismalens/engine/dist/run/investigate.js +403 -57
- package/node_modules/@prismalens/engine/dist/run/local-default.js +13 -4
- package/node_modules/@prismalens/engine/dist/run/permission.js +192 -14
- package/node_modules/@prismalens/engine/dist/run/prompt.js +126 -12
- package/node_modules/@prismalens/engine/dist/run/redact.js +52 -0
- package/node_modules/@prismalens/engine/dist/run/usage-limit.js +91 -9
- package/node_modules/@prismalens/engine/dist/runner/acp-client.js +238 -16
- package/node_modules/@prismalens/integrations/dist/engine/oauth2-flow.js +12 -0
- package/node_modules/@prismalens/integrations/dist/harness/index.js +8 -0
- package/node_modules/@prismalens/integrations/dist/harness/mcp-server.js +60 -0
- package/node_modules/@prismalens/integrations/dist/harness/registry.js +127 -0
- package/node_modules/@prismalens/integrations/dist/harness/replay.js +67 -0
- package/node_modules/@prismalens/integrations/dist/harness/search.js +113 -0
- package/node_modules/@prismalens/integrations/dist/harness/tool.js +64 -0
- package/node_modules/@prismalens/integrations/dist/index.js +2 -0
- package/node_modules/@prismalens/integrations/dist/providers/host-repositories.js +193 -0
- package/node_modules/@prismalens/integrations/package.json +4 -0
- package/package.json +12 -5
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-4pv47a2z.mjs +0 -27
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-bz5kkzv0.mjs +0 -40
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-c86d180z.mjs +0 -52
- package/node_modules/@prismalens/agent-adapters/node_modules/@anthropic-ai/claude-agent-sdk/core-pzfwbvz7.mjs +0 -26
- package/node_modules/@prismalens/api/dist/src/modules/gateway/mcp-delivery.js +0 -39
- package/node_modules/@prismalens/api/public/assets/Field-BQic-QnX.js +0 -1
- package/node_modules/@prismalens/api/public/assets/Hint-B9ocVmjH.js +0 -41
- package/node_modules/@prismalens/api/public/assets/KeptWorkspaces-mrbq8M-h.js +0 -1
- package/node_modules/@prismalens/api/public/assets/MergeDialog-BO_TSjSe.js +0 -1
- package/node_modules/@prismalens/api/public/assets/NewIncident-DWw1jRp3.js +0 -1
- package/node_modules/@prismalens/api/public/assets/PageHeader-DmwtlO5o.js +0 -1
- package/node_modules/@prismalens/api/public/assets/ResolveDialog-nVfxRJOp.js +0 -1
- package/node_modules/@prismalens/api/public/assets/RunsMenu-DrVYxtD6.js +0 -3
- package/node_modules/@prismalens/api/public/assets/ServiceFormDialog-CM8ibEPP.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_authenticated-BIX9FmcY.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_authenticated-g2XLlfqP.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_id-Bs75xuEI.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_id-CbGZLynL.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_id-D7TdCttn.js +0 -1
- package/node_modules/@prismalens/api/public/assets/_id-asM5UbQq.js +0 -1
- package/node_modules/@prismalens/api/public/assets/alerts-C2Ii6YGg.js +0 -1
- package/node_modules/@prismalens/api/public/assets/app-DpX-DlR8.css +0 -2
- package/node_modules/@prismalens/api/public/assets/button-BX6aOWvu.js +0 -1
- package/node_modules/@prismalens/api/public/assets/conversation-MWIw1Mcu.js +0 -461
- package/node_modules/@prismalens/api/public/assets/desktop-CcO1sAJv.js +0 -63
- package/node_modules/@prismalens/api/public/assets/dist-NPKXzqzH.js +0 -1
- package/node_modules/@prismalens/api/public/assets/dropdown-menu-C2eZATbR.js +0 -1
- package/node_modules/@prismalens/api/public/assets/fixes-qbD9HTI7.js +0 -1
- package/node_modules/@prismalens/api/public/assets/format-time-CGRUxfR2.js +0 -1
- package/node_modules/@prismalens/api/public/assets/get-error-message-XWlcOfOx.js +0 -1
- package/node_modules/@prismalens/api/public/assets/highlighted-body-JLMTFACH-DrFHe1nT.js +0 -1
- package/node_modules/@prismalens/api/public/assets/incident-attention-DvrvH6ZE.js +0 -1
- package/node_modules/@prismalens/api/public/assets/incidents-tNIOIUJ9.js +0 -1
- package/node_modules/@prismalens/api/public/assets/index-Bkua5FuI.js +0 -26
- package/node_modules/@prismalens/api/public/assets/loader-circle-BxgKP4dD.js +0 -1
- package/node_modules/@prismalens/api/public/assets/mermaid-WFAXDIZX-BJN6kGuM.js +0 -1
- package/node_modules/@prismalens/api/public/assets/pair-CyzQzNhd.js +0 -1
- package/node_modules/@prismalens/api/public/assets/plus-C-sWiVlr.js +0 -1
- package/node_modules/@prismalens/api/public/assets/route-9A2eeVtZ.js +0 -1
- package/node_modules/@prismalens/api/public/assets/route-BpObCIuc.js +0 -1
- package/node_modules/@prismalens/api/public/assets/route-CAqkvl37.js +0 -1
- package/node_modules/@prismalens/api/public/assets/services-B9GdE4hP.js +0 -1
- package/node_modules/@prismalens/api/public/assets/settings-DsCNpTCk.js +0 -1
- package/node_modules/@prismalens/api/public/assets/state-tone-B3RGc3XM.js +0 -1
- package/node_modules/@prismalens/api/public/assets/switch-UJRRev_z.js +0 -3
- package/node_modules/@prismalens/api/public/assets/use-first-open-rsFZV7FY.js +0 -1
- package/node_modules/@prismalens/api/public/assets/useInvestigationRun-7torOSoz.js +0 -1
- package/node_modules/@prismalens/api/public/assets/useLocation-D-akr70j.js +0 -1
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2026 Sumit Patel
|
|
3
3
|
/**
|
|
4
4
|
* How a usage-limit error opens. Claude's: claude-agent-sdk 0.3.304
|
|
5
|
-
* `USAGE_LIMIT_ERROR_PREFIXES`; Codex's: the text of its `usageLimitExceeded` error
|
|
5
|
+
* `USAGE_LIMIT_ERROR_PREFIXES`; Codex's: the text of its `usageLimitExceeded` error;
|
|
6
|
+
* Gemini CLI's: its terminal quota errors (`googleQuotaErrors.ts`).
|
|
6
7
|
*/
|
|
7
8
|
const LIMIT_OPENINGS = [
|
|
8
9
|
"you've hit your",
|
|
@@ -16,22 +17,34 @@ const LIMIT_OPENINGS = [
|
|
|
16
17
|
"your group's usage limit is set to $0",
|
|
17
18
|
"requires usage credits",
|
|
18
19
|
"usage limit reached",
|
|
20
|
+
"quota_exhausted",
|
|
21
|
+
"exhausted your daily quota",
|
|
22
|
+
"exhausted your quota",
|
|
19
23
|
];
|
|
24
|
+
/** A retry the agent makes itself; shorter than this is a rate error, not a limit (#1024). */
|
|
25
|
+
export const SHORT_RETRY_MS = 5 * 60 * 1000;
|
|
26
|
+
function plain(text) {
|
|
27
|
+
return text.replace(/[‘’]/g, "'").toLowerCase();
|
|
28
|
+
}
|
|
20
29
|
/** The agent stopped because its account ran out of usage, not because the run went wrong. */
|
|
21
30
|
export function isUsageLimitError(text) {
|
|
22
31
|
if (!text)
|
|
23
32
|
return false;
|
|
24
|
-
const said = text
|
|
25
|
-
|
|
33
|
+
const said = plain(text);
|
|
34
|
+
if (LIMIT_OPENINGS.some((opening) => said.includes(opening)))
|
|
35
|
+
return true;
|
|
36
|
+
// Gemini's "Please retry in Xs": only a wait of five minutes or more is a limit.
|
|
37
|
+
const wait = retryInMs(text);
|
|
38
|
+
return wait !== null && wait >= SHORT_RETRY_MS && /quota|limit/.test(said);
|
|
26
39
|
}
|
|
27
40
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
41
|
+
* The limit text an agent's JSON-RPC error carries: its message, or a message
|
|
42
|
+
* nested in its `data` (Codex sends one under a generic "Internal error").
|
|
30
43
|
*/
|
|
31
44
|
export function usageLimitText(message, data) {
|
|
32
45
|
if (isUsageLimitError(message))
|
|
33
46
|
return message;
|
|
34
|
-
if (!data
|
|
47
|
+
if (!data)
|
|
35
48
|
return null;
|
|
36
49
|
const quoted = /"message":("(?:[^"\\]|\\.)*")/.exec(data)?.[1];
|
|
37
50
|
let said = null;
|
|
@@ -41,8 +54,77 @@ export function usageLimitText(message, data) {
|
|
|
41
54
|
catch {
|
|
42
55
|
said = null;
|
|
43
56
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
57
|
+
if (said && isUsageLimitError(said))
|
|
58
|
+
return said;
|
|
59
|
+
return data.includes("usageLimitExceeded")
|
|
60
|
+
? `Usage limit reached: ${message}`
|
|
61
|
+
: null;
|
|
62
|
+
}
|
|
63
|
+
/** Gemini CLI's "Please retry in 23.5s" (also ms and m), in milliseconds. */
|
|
64
|
+
function retryInMs(text) {
|
|
65
|
+
const m = /retry in\s+([\d.]+)\s*(ms|s|m|min|minutes?|seconds?)\b/i.exec(text);
|
|
66
|
+
if (!m)
|
|
67
|
+
return null;
|
|
68
|
+
const n = Number(m[1]);
|
|
69
|
+
if (!Number.isFinite(n))
|
|
70
|
+
return null;
|
|
71
|
+
const unit = m[2].toLowerCase();
|
|
72
|
+
return unit === "ms" ? n : unit.startsWith("m") ? n * 60_000 : n * 1000;
|
|
73
|
+
}
|
|
74
|
+
const MONTHS = [
|
|
75
|
+
"jan",
|
|
76
|
+
"feb",
|
|
77
|
+
"mar",
|
|
78
|
+
"apr",
|
|
79
|
+
"may",
|
|
80
|
+
"jun",
|
|
81
|
+
"jul",
|
|
82
|
+
"aug",
|
|
83
|
+
"sep",
|
|
84
|
+
"oct",
|
|
85
|
+
"nov",
|
|
86
|
+
"dec",
|
|
87
|
+
];
|
|
88
|
+
function clock(h, min, ampm) {
|
|
89
|
+
let hour = Number(h);
|
|
90
|
+
const minute = Number(min);
|
|
91
|
+
if (hour < 1 || hour > 12 || minute > 59)
|
|
92
|
+
return null;
|
|
93
|
+
if (ampm.toLowerCase() === "pm" && hour !== 12)
|
|
94
|
+
hour += 12;
|
|
95
|
+
if (ampm.toLowerCase() === "am" && hour === 12)
|
|
96
|
+
hour = 0;
|
|
97
|
+
return [hour, minute];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* When the agent says its limit resets, in local time; null when it names no time.
|
|
101
|
+
* Codex: "try again at 3:45 PM" (the next such time) or "Nov 7th, 2026 3:45 PM"
|
|
102
|
+
* (codex-rs protocol error.rs); Gemini CLI: "Please retry in Xs", five minutes or more.
|
|
103
|
+
* Claude's reset wording is uncaptured, so its limits take the no-time path (#1024).
|
|
104
|
+
*/
|
|
105
|
+
export function parseReset(text, now, _agent) {
|
|
106
|
+
const dated = /try again at\s+([a-z]{3})[a-z]*\.?\s+(\d{1,2})(?:st|nd|rd|th)?,?\s+(\d{4}),?\s+(\d{1,2}):(\d{2})\s*([ap]m)/i.exec(text);
|
|
107
|
+
if (dated) {
|
|
108
|
+
const month = MONTHS.indexOf(dated[1].toLowerCase());
|
|
109
|
+
const at = clock(dated[4], dated[5], dated[6]);
|
|
110
|
+
if (month < 0 || !at)
|
|
111
|
+
return null;
|
|
112
|
+
return new Date(Number(dated[3]), month, Number(dated[2]), at[0], at[1], 0, 0);
|
|
113
|
+
}
|
|
114
|
+
const timed = /try again at\s+(\d{1,2}):(\d{2})\s*([ap]m)/i.exec(text);
|
|
115
|
+
if (timed) {
|
|
116
|
+
const at = clock(timed[1], timed[2], timed[3]);
|
|
117
|
+
if (!at)
|
|
118
|
+
return null;
|
|
119
|
+
const d = new Date(now);
|
|
120
|
+
d.setHours(at[0], at[1], 0, 0);
|
|
121
|
+
if (d.getTime() <= now.getTime())
|
|
122
|
+
d.setDate(d.getDate() + 1);
|
|
123
|
+
return d;
|
|
124
|
+
}
|
|
125
|
+
const wait = retryInMs(text);
|
|
126
|
+
if (wait !== null && wait >= SHORT_RETRY_MS)
|
|
127
|
+
return new Date(now.getTime() + Math.ceil(wait));
|
|
128
|
+
return null;
|
|
47
129
|
}
|
|
48
130
|
//# sourceMappingURL=usage-limit.js.map
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { createInterface } from "node:readline";
|
|
12
12
|
import { PROTOCOL_VERSION } from "@agentclientprotocol/sdk/unstable";
|
|
13
13
|
import { createProcessLauncher } from "../launch/process.js";
|
|
14
|
+
import { elicitationAsk, elicitationContent, } from "../run/elicitation.js";
|
|
14
15
|
import { newAskId, } from "../run/permission.js";
|
|
15
16
|
import { usageLimitText } from "../run/usage-limit.js";
|
|
16
17
|
/**
|
|
@@ -80,8 +81,43 @@ const LEVEL_OUTCOMES = new Set([
|
|
|
80
81
|
"mode_kept",
|
|
81
82
|
"unattended",
|
|
82
83
|
]);
|
|
83
|
-
// ACP v2 folds load into session/resume; one constant to move (#747).
|
|
84
84
|
const SESSION_LOAD = "session/load";
|
|
85
|
+
const SESSION_RESUME = "session/resume";
|
|
86
|
+
/** Agents whose `session/load` answers before its replay, so no update after it can be trusted as live. */
|
|
87
|
+
const BROKEN_LOAD = {
|
|
88
|
+
"gemini-cli": "google-gemini/gemini-cli#29707",
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* The fastest exact path the agent's `initialize` offers; null when it can
|
|
92
|
+
* reopen nothing. `fresh` only when the caller can seed a new session.
|
|
93
|
+
*/
|
|
94
|
+
export function reopenPath(agent, capabilities, canStartFresh) {
|
|
95
|
+
const session = capabilities?.sessionCapabilities;
|
|
96
|
+
if (session?.resume != null)
|
|
97
|
+
return "resume";
|
|
98
|
+
if (agent.name && BROKEN_LOAD[agent.name])
|
|
99
|
+
return canStartFresh ? "fresh" : null;
|
|
100
|
+
if (capabilities?.loadSession !== true)
|
|
101
|
+
return null;
|
|
102
|
+
return session?.replayComplete != null ? "load-marker" : "load-dedupe";
|
|
103
|
+
}
|
|
104
|
+
/** Updates that are conversation, so a replay of them is history; state updates are not. */
|
|
105
|
+
const CONVERSATION = new Set([
|
|
106
|
+
"user_message_chunk",
|
|
107
|
+
"agent_message_chunk",
|
|
108
|
+
"agent_thought_chunk",
|
|
109
|
+
"tool_call",
|
|
110
|
+
"tool_call_update",
|
|
111
|
+
"plan",
|
|
112
|
+
]);
|
|
113
|
+
/** ACP's `replay_complete` (RFD agent-client-protocol#2407), or claude-agent-acp's AIR `loadReplayEnd`. */
|
|
114
|
+
function endsReplay(u) {
|
|
115
|
+
if (u.sessionUpdate === "replay_complete")
|
|
116
|
+
return true;
|
|
117
|
+
const air = u._meta
|
|
118
|
+
?.jetbrains?.air;
|
|
119
|
+
return (u.sessionUpdate === "session_info_update" && air?.loadReplayEnd === true);
|
|
120
|
+
}
|
|
85
121
|
/** claude-agent-acp's push-only sign-in extension (0.81.1 `dist/auth-status.js`). */
|
|
86
122
|
const AUTH_STATUS_UPDATE = "_auth/status_update";
|
|
87
123
|
const DEFAULT_INIT_TIMEOUT_MS = 120_000;
|
|
@@ -274,6 +310,10 @@ export class AcpSession {
|
|
|
274
310
|
driftSeen = new Set();
|
|
275
311
|
/** Asks the policy has not answered; a cancel or close aborts them. */
|
|
276
312
|
asks = new Set();
|
|
313
|
+
/** The sub-agent session each open ask came from, so cancelling one child aborts only its asks (#1025). */
|
|
314
|
+
askSessions = new Map();
|
|
315
|
+
/** Sub-agent sessions the agent announced, and whether it lets the client cancel each (#1025). */
|
|
316
|
+
subagents = new Map();
|
|
277
317
|
/** This turn's `tool_call` announcements by id, for an ask that carries only the id (#848, OBJ-011). */
|
|
278
318
|
toolCalls = new Map();
|
|
279
319
|
agent = {};
|
|
@@ -288,7 +328,9 @@ export class AcpSession {
|
|
|
288
328
|
modelOptionId = null;
|
|
289
329
|
/** `initialize` advertised `promptCapabilities.image` (R4.3). */
|
|
290
330
|
takesImages = false;
|
|
291
|
-
/**
|
|
331
|
+
/** `initialize` advertised `sessionCapabilities.additionalDirectories` (#918, #1024). */
|
|
332
|
+
takesDirectories = false;
|
|
333
|
+
/** The harness advertised `loadSession` or `session/resume` at `initialize`, so a follow-up can reopen it. */
|
|
292
334
|
loadSession = false;
|
|
293
335
|
/** The modes `session/new` (or `session/load`) offered. */
|
|
294
336
|
modes = { configId: null, modes: [], current: null };
|
|
@@ -296,8 +338,16 @@ export class AcpSession {
|
|
|
296
338
|
options = [];
|
|
297
339
|
/** Counts mode reports from the agent, so `setMode` can tell whether one answered it. */
|
|
298
340
|
modeReports = 0;
|
|
299
|
-
/** History updates
|
|
341
|
+
/** History updates the reopen replayed; dropped, never yielded. */
|
|
300
342
|
replayed = 0;
|
|
343
|
+
/** How `open` reopened the stored session; null when it started a new one unasked. */
|
|
344
|
+
reopen = null;
|
|
345
|
+
/** Milliseconds the reopen request took, `initialize` excluded. */
|
|
346
|
+
reopenMs = 0;
|
|
347
|
+
/** `tool:` and `message:` ids of the history; a later update carrying one is replay too. */
|
|
348
|
+
history = new Set();
|
|
349
|
+
/** A `session/prompt` went out, so the agent may speak live. */
|
|
350
|
+
prompted = false;
|
|
301
351
|
/** `initialize` advertised `_meta.authStatus`: the agent pushes its sign-in on `_auth/status_update`. */
|
|
302
352
|
pushesAuthStatus = false;
|
|
303
353
|
/** The `kind` of the last `_auth/status_update` (`"none"` is signed out); null before any. */
|
|
@@ -316,6 +366,7 @@ export class AcpSession {
|
|
|
316
366
|
...(config.limits ? { limits: config.limits } : {}),
|
|
317
367
|
});
|
|
318
368
|
this.child = child;
|
|
369
|
+
config.onSpawn?.(child.pid);
|
|
319
370
|
// setEncoding keeps a multibyte character split across two chunks intact.
|
|
320
371
|
child.stderr.setEncoding("utf8");
|
|
321
372
|
child.stderr.on("data", (chunk) => {
|
|
@@ -381,19 +432,30 @@ export class AcpSession {
|
|
|
381
432
|
protocolVersion: PROTOCOL_VERSION,
|
|
382
433
|
clientCapabilities: {
|
|
383
434
|
fs: { readTextFile: false, writeTextFile: false },
|
|
435
|
+
// ACP RFD "Session Compaction": the agent reports its compactions as `compaction_update` (#1024).
|
|
436
|
+
session: { replayComplete: {}, compaction: {} },
|
|
437
|
+
// ACP's unstable Subagent Sessions RFD; claude-agent-acp strips a child's words without the meta (#1025).
|
|
438
|
+
subagents: {},
|
|
439
|
+
_meta: { "subagent-transcript": true },
|
|
440
|
+
// Form mode only: an agent-supplied URL needs its own trust ruling (#1024).
|
|
441
|
+
...(config.elicit ? { elicitation: { form: {} } } : {}),
|
|
384
442
|
},
|
|
385
443
|
}, config.initTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS));
|
|
386
444
|
this.agent = (init?.agentInfo ?? {});
|
|
387
445
|
this.authMethods = Array.isArray(init?.authMethods)
|
|
388
446
|
? init.authMethods
|
|
389
447
|
: [];
|
|
390
|
-
this.loadSession =
|
|
448
|
+
this.loadSession =
|
|
449
|
+
init?.agentCapabilities?.loadSession === true ||
|
|
450
|
+
init?.agentCapabilities?.sessionCapabilities?.resume != null;
|
|
391
451
|
this.takesImages =
|
|
392
452
|
init?.agentCapabilities?.promptCapabilities?.image === true;
|
|
393
453
|
this.pushesAuthStatus =
|
|
394
454
|
init?.agentCapabilities?._meta?.authStatus !== undefined;
|
|
395
|
-
|
|
396
|
-
|
|
455
|
+
this.takesDirectories =
|
|
456
|
+
init?.agentCapabilities?.sessionCapabilities?.additionalDirectories !=
|
|
457
|
+
null;
|
|
458
|
+
const roots = this.takesDirectories && config.roots;
|
|
397
459
|
const params = {
|
|
398
460
|
...(roots
|
|
399
461
|
? { cwd: roots.cwd, additionalDirectories: roots.additional }
|
|
@@ -401,14 +463,27 @@ export class AcpSession {
|
|
|
401
463
|
mcpServers: config.mcpServers?.(init?.agentCapabilities?.mcpCapabilities) ?? [],
|
|
402
464
|
...(config.sessionMeta ? { _meta: config.sessionMeta } : {}),
|
|
403
465
|
};
|
|
466
|
+
const started = Date.now();
|
|
404
467
|
if (config.resume) {
|
|
405
|
-
|
|
406
|
-
|
|
468
|
+
const path = reopenPath(this.agent, init?.agentCapabilities, !!config.resume.fresh);
|
|
469
|
+
const name = `${this.agent.name ?? config.command} ${this.agent.version ?? ""}`;
|
|
470
|
+
if (!path) {
|
|
471
|
+
const broken = this.agent.name && BROKEN_LOAD[this.agent.name];
|
|
472
|
+
throw new Error(broken
|
|
473
|
+
? `${name} cannot reopen a session: its session/load answers before the history (${broken})`
|
|
474
|
+
: `${name} does not support session/load or session/resume`);
|
|
475
|
+
}
|
|
476
|
+
this.reopen = path;
|
|
477
|
+
}
|
|
478
|
+
if (config.resume && this.reopen !== "fresh") {
|
|
479
|
+
for (const id of (await config.resume.known?.()) ?? [])
|
|
480
|
+
this.history.add(`tool:${id}`);
|
|
407
481
|
this.loading = true;
|
|
408
482
|
this.loadRequestId = this.nextId;
|
|
409
483
|
this.currentSessionId = config.resume.sessionId;
|
|
410
|
-
const loaded = (await this.request(SESSION_LOAD, { sessionId: config.resume.sessionId, ...params }, config.initTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS).finally(() => {
|
|
484
|
+
const loaded = (await this.request(this.reopen === "resume" ? SESSION_RESUME : SESSION_LOAD, { sessionId: config.resume.sessionId, ...params }, config.initTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS).finally(() => {
|
|
411
485
|
this.loading = false;
|
|
486
|
+
this.reopenMs = Date.now() - started;
|
|
412
487
|
}));
|
|
413
488
|
this.takeOptions(loaded?.configOptions);
|
|
414
489
|
this.modes = offeredModes(loaded);
|
|
@@ -417,6 +492,8 @@ export class AcpSession {
|
|
|
417
492
|
const session = (await this.request("session/new", params, config.initTimeoutMs ?? DEFAULT_INIT_TIMEOUT_MS));
|
|
418
493
|
if (!session?.sessionId)
|
|
419
494
|
throw new Error("ACP session/new returned no sessionId");
|
|
495
|
+
if (this.reopen === "fresh")
|
|
496
|
+
this.reopenMs = Date.now() - started;
|
|
420
497
|
this.currentSessionId = session.sessionId;
|
|
421
498
|
this.takeOptions(session.configOptions);
|
|
422
499
|
this.modes = offeredModes(session);
|
|
@@ -521,6 +598,7 @@ export class AcpSession {
|
|
|
521
598
|
return;
|
|
522
599
|
}
|
|
523
600
|
let turnDone = false;
|
|
601
|
+
this.prompted = true;
|
|
524
602
|
this.request("session/prompt", { sessionId: this.currentSessionId, prompt }, this.config.promptTimeoutMs ?? DEFAULT_PROMPT_TIMEOUT_MS)
|
|
525
603
|
.then((res) => {
|
|
526
604
|
const stopReason = res?.stopReason;
|
|
@@ -552,18 +630,57 @@ export class AcpSession {
|
|
|
552
630
|
}
|
|
553
631
|
}
|
|
554
632
|
/** Cancel the in-flight turn; the harness answers with a done carrying stopReason "cancelled". */
|
|
555
|
-
cancel() {
|
|
633
|
+
cancel(reason) {
|
|
556
634
|
if (!this.currentSessionId)
|
|
557
635
|
return;
|
|
558
|
-
// ACP: a cancelled turn's waiting asks are answered `cancelled
|
|
636
|
+
// ACP: a cancelled turn's waiting asks are answered `cancelled`; the reason says why (#981).
|
|
559
637
|
for (const ask of this.asks)
|
|
560
|
-
ask.abort();
|
|
638
|
+
ask.abort(reason);
|
|
561
639
|
this.send({
|
|
562
640
|
jsonrpc: "2.0",
|
|
563
641
|
method: "session/cancel",
|
|
564
642
|
params: { sessionId: this.currentSessionId },
|
|
565
643
|
});
|
|
566
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* `session/cancel` for one sub-agent (#1025): false when the agent never announced
|
|
647
|
+
* it or did not grant its cancel. Its asks are answered cancelled; the parent's stay.
|
|
648
|
+
*/
|
|
649
|
+
cancelSubagent(sessionId) {
|
|
650
|
+
if (!this.subagents.get(sessionId)?.cancel || this.closed)
|
|
651
|
+
return false;
|
|
652
|
+
for (const [ask, owner] of this.askSessions)
|
|
653
|
+
if (owner === sessionId)
|
|
654
|
+
ask.abort();
|
|
655
|
+
this.send({
|
|
656
|
+
jsonrpc: "2.0",
|
|
657
|
+
method: "session/cancel",
|
|
658
|
+
params: { sessionId },
|
|
659
|
+
});
|
|
660
|
+
return true;
|
|
661
|
+
}
|
|
662
|
+
/** A `subagent_update` patches its child's record: `capabilities: null` revokes cancel. */
|
|
663
|
+
noteSubagent(u) {
|
|
664
|
+
const id = u.sessionId;
|
|
665
|
+
if (typeof id !== "string" || !id)
|
|
666
|
+
return;
|
|
667
|
+
const known = this.subagents.get(id) ?? { cancel: false };
|
|
668
|
+
if ("capabilities" in u) {
|
|
669
|
+
const caps = u.capabilities;
|
|
670
|
+
known.cancel = caps?.cancel != null;
|
|
671
|
+
}
|
|
672
|
+
this.subagents.set(id, known);
|
|
673
|
+
}
|
|
674
|
+
/** The child session a message names, or undefined for the main one. */
|
|
675
|
+
childOf(params) {
|
|
676
|
+
const id = params?.sessionId;
|
|
677
|
+
return typeof id === "string" &&
|
|
678
|
+
id &&
|
|
679
|
+
this.currentSessionId &&
|
|
680
|
+
id !== this.currentSessionId
|
|
681
|
+
? id
|
|
682
|
+
: undefined;
|
|
683
|
+
}
|
|
567
684
|
async close() {
|
|
568
685
|
if (this.closed)
|
|
569
686
|
return;
|
|
@@ -659,7 +776,7 @@ export class AcpSession {
|
|
|
659
776
|
this.onServerRequest(msg);
|
|
660
777
|
}
|
|
661
778
|
else if (msg.id !== undefined) {
|
|
662
|
-
// Updates after the load answer are live, even in the same stdout chunk.
|
|
779
|
+
// Updates after the load answer are live unless their id is history, even in the same stdout chunk.
|
|
663
780
|
if (msg.id === this.loadRequestId)
|
|
664
781
|
this.loading = false;
|
|
665
782
|
const p = this.pending.get(msg.id);
|
|
@@ -673,7 +790,32 @@ export class AcpSession {
|
|
|
673
790
|
}
|
|
674
791
|
else if (msg.method === "session/update") {
|
|
675
792
|
const update = msg.params?.update;
|
|
793
|
+
const fields = update && typeof update === "object"
|
|
794
|
+
? update
|
|
795
|
+
: null;
|
|
796
|
+
const ids = [
|
|
797
|
+
typeof fields?.toolCallId === "string" && fields.toolCallId
|
|
798
|
+
? `tool:${fields.toolCallId}`
|
|
799
|
+
: "",
|
|
800
|
+
typeof fields?.messageId === "string" && fields.messageId
|
|
801
|
+
? `message:${fields.messageId}`
|
|
802
|
+
: "",
|
|
803
|
+
].filter(Boolean);
|
|
804
|
+
if (this.reopen && fields && endsReplay(fields)) {
|
|
805
|
+
this.loading = false;
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
const said = CONVERSATION.has(fields?.sessionUpdate);
|
|
676
809
|
if (this.loading) {
|
|
810
|
+
if (said)
|
|
811
|
+
this.replayed += 1;
|
|
812
|
+
for (const id of ids)
|
|
813
|
+
this.history.add(id);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
// Nothing is said before the first prompt, and history after the answer still carries its ids (#942).
|
|
817
|
+
if ((said && this.reopen && !this.prompted) ||
|
|
818
|
+
ids.some((id) => this.history.has(id))) {
|
|
677
819
|
this.replayed += 1;
|
|
678
820
|
return;
|
|
679
821
|
}
|
|
@@ -686,8 +828,17 @@ export class AcpSession {
|
|
|
686
828
|
this.drift("session/update", "status", u.status);
|
|
687
829
|
this.noteToolCall(u);
|
|
688
830
|
}
|
|
689
|
-
this.
|
|
690
|
-
|
|
831
|
+
const child = this.childOf(msg.params);
|
|
832
|
+
// A child's mode is its own; only the main session's is the run's (#1025).
|
|
833
|
+
if (!child)
|
|
834
|
+
this.trackMode(u);
|
|
835
|
+
if (u.sessionUpdate === "subagent_update")
|
|
836
|
+
this.noteSubagent(u);
|
|
837
|
+
this.push({
|
|
838
|
+
kind: "update",
|
|
839
|
+
update: update,
|
|
840
|
+
...(child ? { sessionId: child } : {}),
|
|
841
|
+
});
|
|
691
842
|
}
|
|
692
843
|
}
|
|
693
844
|
else if (msg.method === AUTH_STATUS_UPDATE) {
|
|
@@ -745,13 +896,75 @@ export class AcpSession {
|
|
|
745
896
|
const given = Object.entries(asked).filter(([, v]) => v != null);
|
|
746
897
|
return { ...known, ...Object.fromEntries(given) };
|
|
747
898
|
}
|
|
899
|
+
/** `elicitation/create` (#1024): a question or input ask, declined when nobody may answer. */
|
|
900
|
+
onElicitation(msg) {
|
|
901
|
+
const params = (msg.params ?? {});
|
|
902
|
+
const reply = (result) => {
|
|
903
|
+
if (!this.closed)
|
|
904
|
+
this.send({ jsonrpc: "2.0", id: msg.id, result });
|
|
905
|
+
};
|
|
906
|
+
let ask = null;
|
|
907
|
+
try {
|
|
908
|
+
ask = this.config.elicit ? elicitationAsk(params) : null;
|
|
909
|
+
}
|
|
910
|
+
catch {
|
|
911
|
+
// A form this code cannot read is declined, never thrown out of the listener.
|
|
912
|
+
ask = null;
|
|
913
|
+
}
|
|
914
|
+
if (!ask || !this.config.elicit) {
|
|
915
|
+
reply({ action: "decline" });
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
const askId = newAskId();
|
|
919
|
+
const controller = new AbortController();
|
|
920
|
+
const child = this.childOf(msg.params);
|
|
921
|
+
this.asks.add(controller);
|
|
922
|
+
if (child)
|
|
923
|
+
this.askSessions.set(controller, child);
|
|
924
|
+
const finish = (closed) => {
|
|
925
|
+
this.asks.delete(controller);
|
|
926
|
+
this.askSessions.delete(controller);
|
|
927
|
+
const content = "answer" in closed && closed.outcome === "answered"
|
|
928
|
+
? elicitationContent(ask, closed.answer)
|
|
929
|
+
: null;
|
|
930
|
+
reply(content
|
|
931
|
+
? { action: "accept", content }
|
|
932
|
+
: closed.outcome === "stopped" || closed.outcome === "restarted"
|
|
933
|
+
? { action: "cancel" }
|
|
934
|
+
: { action: "decline" });
|
|
935
|
+
this.push({ kind: "elicit_closed", askId, closed });
|
|
936
|
+
};
|
|
937
|
+
let held;
|
|
938
|
+
try {
|
|
939
|
+
held = this.config.elicit(ask, { askId, signal: controller.signal });
|
|
940
|
+
}
|
|
941
|
+
catch {
|
|
942
|
+
// A policy that throws must still answer, or the agent waits out its turn.
|
|
943
|
+
held = { outcome: "unattended" };
|
|
944
|
+
}
|
|
945
|
+
if (!("timeoutMs" in held)) {
|
|
946
|
+
finish(held);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
this.push({
|
|
950
|
+
kind: "elicit_asked",
|
|
951
|
+
askId,
|
|
952
|
+
ask,
|
|
953
|
+
expiresAt: held.timeoutMs > 0 ? new Date(Date.now() + held.timeoutMs) : null,
|
|
954
|
+
...(params.toolCallId ? { toolCallId: params.toolCallId } : {}),
|
|
955
|
+
...(child ? { sessionId: child } : {}),
|
|
956
|
+
});
|
|
957
|
+
held.outcome.then(finish, () => finish({ outcome: "stopped" }));
|
|
958
|
+
}
|
|
748
959
|
onServerRequest(msg) {
|
|
749
960
|
const method = msg.method ?? "";
|
|
750
961
|
if (method === "session/request_permission") {
|
|
751
962
|
const params = msg.params ?? {};
|
|
963
|
+
const child = this.childOf(params);
|
|
752
964
|
const request = {
|
|
753
965
|
options: params.options ?? [],
|
|
754
966
|
toolCall: this.withAnnounced(params.toolCall),
|
|
967
|
+
...(child ? { sessionId: child } : {}),
|
|
755
968
|
};
|
|
756
969
|
const askId = newAskId();
|
|
757
970
|
const controller = new AbortController();
|
|
@@ -763,9 +976,12 @@ export class AcpSession {
|
|
|
763
976
|
});
|
|
764
977
|
const answer = (decision, sync) => {
|
|
765
978
|
this.asks.delete(controller);
|
|
979
|
+
this.askSessions.delete(controller);
|
|
766
980
|
if (this.closed)
|
|
767
981
|
return;
|
|
768
|
-
const optionId = decision.outcome === "stopped"
|
|
982
|
+
const optionId = decision.outcome === "stopped" || decision.outcome === "restarted"
|
|
983
|
+
? undefined
|
|
984
|
+
: decision.optionId;
|
|
769
985
|
this.send({
|
|
770
986
|
jsonrpc: "2.0",
|
|
771
987
|
id: msg.id,
|
|
@@ -789,6 +1005,8 @@ export class AcpSession {
|
|
|
789
1005
|
};
|
|
790
1006
|
let verdict;
|
|
791
1007
|
this.asks.add(controller);
|
|
1008
|
+
if (child)
|
|
1009
|
+
this.askSessions.set(controller, child);
|
|
792
1010
|
try {
|
|
793
1011
|
verdict = this.config.permission(request, {
|
|
794
1012
|
askId,
|
|
@@ -818,6 +1036,10 @@ export class AcpSession {
|
|
|
818
1036
|
.then((decision) => answer(decision, false));
|
|
819
1037
|
return;
|
|
820
1038
|
}
|
|
1039
|
+
if (method === "elicitation/create") {
|
|
1040
|
+
this.onElicitation(msg);
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
821
1043
|
if (method.startsWith("fs/")) {
|
|
822
1044
|
this.send({
|
|
823
1045
|
jsonrpc: "2.0",
|
|
@@ -34,6 +34,8 @@ function safeOAuthErrorCode(value) {
|
|
|
34
34
|
? value
|
|
35
35
|
: "unrecognized_error_code";
|
|
36
36
|
}
|
|
37
|
+
/** A token endpoint that never answers must not hold the OAuth callback open. */
|
|
38
|
+
export const TOKEN_EXCHANGE_TIMEOUT_MS = 15_000;
|
|
37
39
|
/** A value that cannot change a URL's host, port, path, query or fragment. */
|
|
38
40
|
const HOST_SAFE = /^[A-Za-z0-9._-]+$/;
|
|
39
41
|
function hostSafeContext(context, templateId) {
|
|
@@ -141,10 +143,18 @@ export class OAuth2Flow {
|
|
|
141
143
|
// `tenant.attacker.test#` would move the HOST of the token endpoint out of
|
|
142
144
|
// the template's own domain. Only host-safe labels may reach it.
|
|
143
145
|
const tokenUrl = interpolate(template.oauth2.tokenUrl, hostSafeContext(tokenContext, template.id));
|
|
146
|
+
// One clock for the headers and the body: a provider can answer 200 and then stall.
|
|
147
|
+
const deadline = AbortSignal.timeout(TOKEN_EXCHANGE_TIMEOUT_MS);
|
|
148
|
+
const timedOut = () => new Error(`OAuth token exchange with ${template.id} timed out after ${TOKEN_EXCHANGE_TIMEOUT_MS / 1000} s. Try connecting again.`);
|
|
144
149
|
const response = await fetch(tokenUrl, {
|
|
145
150
|
method: "POST",
|
|
146
151
|
headers: tokenHeaders,
|
|
147
152
|
body: new URLSearchParams(tokenBody),
|
|
153
|
+
signal: deadline,
|
|
154
|
+
}).catch((error) => {
|
|
155
|
+
if (error?.name === "TimeoutError")
|
|
156
|
+
throw timedOut();
|
|
157
|
+
throw error;
|
|
148
158
|
});
|
|
149
159
|
if (!response.ok) {
|
|
150
160
|
// The body is deliberately not read: a token-endpoint error body can
|
|
@@ -164,6 +174,8 @@ export class OAuth2Flow {
|
|
|
164
174
|
data = (await response.json());
|
|
165
175
|
}
|
|
166
176
|
catch {
|
|
177
|
+
if (deadline.aborted)
|
|
178
|
+
throw timedOut();
|
|
167
179
|
throw providerJsonParseError({
|
|
168
180
|
operation: "OAuth token exchange",
|
|
169
181
|
provider: template.id,
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright 2026 Sumit Patel
|
|
3
|
+
import { ProtocolError, ProtocolErrorCode, Server, } from "@modelcontextprotocol/server";
|
|
4
|
+
import { executeTool } from "./registry.js";
|
|
5
|
+
import { resolveCall } from "./search.js";
|
|
6
|
+
import { annotationsFor, inputSchemaOf } from "./tool.js";
|
|
7
|
+
/** One run's MCP surface (#848): its view of PrismaLens's harness tools, nothing else. */
|
|
8
|
+
export function harnessMcpServer(o) {
|
|
9
|
+
const server = new Server({ name: "prismalens", version: o.version }, { capabilities: { tools: {} } });
|
|
10
|
+
server.setRequestHandler("tools/list", () => ({
|
|
11
|
+
tools: o.view.direct.map((t) => ({
|
|
12
|
+
name: t.name,
|
|
13
|
+
title: t.title,
|
|
14
|
+
description: t.description,
|
|
15
|
+
inputSchema: inputSchemaOf(t),
|
|
16
|
+
annotations: annotationsFor(t.effect),
|
|
17
|
+
})),
|
|
18
|
+
}));
|
|
19
|
+
server.setRequestHandler("tools/call", async (req, ctx) => {
|
|
20
|
+
const { name, arguments: args } = req.params;
|
|
21
|
+
const target = resolveCall(o.view, name, args);
|
|
22
|
+
if (!target)
|
|
23
|
+
throw new ProtocolError(ProtocolErrorCode.InvalidParams, `Unknown tool: ${name}`);
|
|
24
|
+
const call = await executeTool(target.tool, target.args, {
|
|
25
|
+
runId: o.runId,
|
|
26
|
+
signal: ctx.mcpReq.signal,
|
|
27
|
+
...(o.secrets ? { secrets: o.secrets } : {}),
|
|
28
|
+
});
|
|
29
|
+
const recorded = target.tool.name === name
|
|
30
|
+
? call
|
|
31
|
+
: { ...call, via: "tools_call" };
|
|
32
|
+
o.onCall?.(recorded);
|
|
33
|
+
return {
|
|
34
|
+
content: [{ type: "text", text: call.output }],
|
|
35
|
+
...(call.isError ? { isError: true } : {}),
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
return server;
|
|
39
|
+
}
|
|
40
|
+
/** The prompt's tools paragraph (#848): the run's listed tools, and that data access is the agent's own. */
|
|
41
|
+
export function harnessPromptLine(view, serverName) {
|
|
42
|
+
const names = view.direct.map((t) => `\`${t.name}\``).join(", ");
|
|
43
|
+
const records = view.direct.some((t) => t.name === "evidence_record");
|
|
44
|
+
const titles = view.direct.some((t) => t.name === "thread_title");
|
|
45
|
+
return [
|
|
46
|
+
`PrismaLens tools (MCP server \`${serverName}\`): ${names}.${view.deferred.length ? " Find more PrismaLens tools with `tools_search`." : ""}`,
|
|
47
|
+
...(records
|
|
48
|
+
? [
|
|
49
|
+
"As you work, record each piece of evidence with `evidence_record`, quoting the output exactly, and each hypothesis with `hypothesis_record`; the operator watches them form. Your final report is still required: give each hypothesis you recorded the same `id` there.",
|
|
50
|
+
]
|
|
51
|
+
: []),
|
|
52
|
+
...(titles
|
|
53
|
+
? [
|
|
54
|
+
"Name this thread with `thread_title` in 3 to 7 words once the user has named a task; a greeting keeps the title it has.",
|
|
55
|
+
]
|
|
56
|
+
: []),
|
|
57
|
+
"For metrics, logs and other live data, use the tools your own setup gives you.",
|
|
58
|
+
].join("\n");
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=mcp-server.js.map
|