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
|
@@ -6,24 +6,51 @@
|
|
|
6
6
|
* permission asks by the run's level, records the stream, and validates the report with one
|
|
7
7
|
* in-session retry. No model call happens here.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
import { appendFileSync, copyFileSync, mkdirSync, readFileSync } from "node:fs";
|
|
10
11
|
import { join } from "node:path";
|
|
12
|
+
import { pathToFileURL } from "node:url";
|
|
11
13
|
import { AGENT_REGISTRY, planLaunch, writeLaunchFiles, } from "@prismalens/agent-host";
|
|
12
14
|
import { DEFAULT_ACCESS_LEVEL, HARNESS_REGISTRY, levelOfAgentMode, modeFidelity, NO_MODE_KEY, resolveAccess, } from "@prismalens/config/harness";
|
|
13
15
|
import { harnessLaunch, resolveOnPath, } from "@prismalens/config/harness-selection";
|
|
14
|
-
import { ASK_TIMEOUT_MS, } from "@prismalens/contracts/schemas";
|
|
15
|
-
import { AcpAdapter, mapStopReason, } from "../adapter/acp-adapter.js";
|
|
16
|
+
import { AgentCommandsSchema, ASK_TIMEOUT_MS, ATTACHMENT_IMAGE_MAX_BYTES, ATTACHMENT_TEXT_MAX_BYTES, attachmentKind, QUESTION_ASK_TIMEOUT_MS, } from "@prismalens/contracts/schemas";
|
|
17
|
+
import { AcpAdapter, mapStopReason, parentToolUseOf, toolOutputText, } from "../adapter/acp-adapter.js";
|
|
16
18
|
import { prismalensLaunchPolicy } from "../launch/policy.js";
|
|
17
19
|
import { AcpSession, } from "../runner/acp-client.js";
|
|
18
20
|
import { ATTACHED_IMAGE_GUARD, renderAttachment } from "./fence.js";
|
|
21
|
+
import { withFindings } from "./findings.js";
|
|
19
22
|
import { gatewayOffer } from "./gateway.js";
|
|
20
23
|
import { RESTART_NOTE } from "./handoff.js";
|
|
21
24
|
import { opencodeUserConfig } from "./local-default.js";
|
|
22
|
-
import { askWindow, denyAllPolicy, levelPolicy, newAskId, } from "./permission.js";
|
|
25
|
+
import { abortOutcome, askWindow, denyAllPolicy, levelPolicy, newAskId, } from "./permission.js";
|
|
23
26
|
import { buildChatPrompt, buildInvestigationPrompt, investigationPromptParts, newerRunNote, } from "./prompt.js";
|
|
27
|
+
import { injectedSecrets, redactEvent, requestedSecrets, scrub, } from "./redact.js";
|
|
24
28
|
import { parseReport, retryBudgetKey, retryPrompt, stampReport, } from "./report.js";
|
|
25
29
|
import { checkSandbox } from "./sandbox-check.js";
|
|
26
30
|
import { parseUsageUpdate } from "./usage.js";
|
|
31
|
+
/** A message's text as the agent receives it: the quotes and references it carries after it. */
|
|
32
|
+
export function withAddendum(text, context) {
|
|
33
|
+
return context?.addendum ? `${text}\n\n${context.addendum}` : text;
|
|
34
|
+
}
|
|
35
|
+
/** The agent's `available_commands_update`, validated; null when it does not fit (#1024). */
|
|
36
|
+
export function parseAgentCommands(update) {
|
|
37
|
+
const list = update?.availableCommands;
|
|
38
|
+
if (!Array.isArray(list))
|
|
39
|
+
return null;
|
|
40
|
+
const mapped = list.slice(0, 200).map((c) => {
|
|
41
|
+
const o = (c ?? {});
|
|
42
|
+
const hint = o.input?.hint;
|
|
43
|
+
return {
|
|
44
|
+
name: typeof o.name === "string" ? o.name : "",
|
|
45
|
+
description: typeof o.description === "string" ? o.description.slice(0, 200) : "",
|
|
46
|
+
...(typeof hint === "string" && hint
|
|
47
|
+
? { inputHint: hint.slice(0, 200) }
|
|
48
|
+
: {}),
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
const parsed = AgentCommandsSchema.safeParse(mapped.filter((c) => c.name && c.name.length <= 64));
|
|
52
|
+
return parsed.success ? parsed.data : null;
|
|
53
|
+
}
|
|
27
54
|
/**
|
|
28
55
|
* The host side of a {@link SteerPort}: `send` answers null once the run has
|
|
29
56
|
* stopped listening, so the caller can refuse instead of dropping the text.
|
|
@@ -31,6 +58,7 @@ import { parseUsageUpdate } from "./usage.js";
|
|
|
31
58
|
export function createSteerChannel() {
|
|
32
59
|
const queue = [];
|
|
33
60
|
const unrecorded = new Set();
|
|
61
|
+
const changed = [];
|
|
34
62
|
let deliverNow = null;
|
|
35
63
|
let onQueued = null;
|
|
36
64
|
let open = true;
|
|
@@ -60,14 +88,36 @@ export function createSteerChannel() {
|
|
|
60
88
|
onQueued = null;
|
|
61
89
|
};
|
|
62
90
|
},
|
|
91
|
+
changes: () => changed.splice(0),
|
|
92
|
+
},
|
|
93
|
+
change(id, text) {
|
|
94
|
+
const at = queue.findIndex((l) => l.id === id);
|
|
95
|
+
if (!open || at < 0)
|
|
96
|
+
return null;
|
|
97
|
+
const line = queue[at];
|
|
98
|
+
if (text === null)
|
|
99
|
+
queue.splice(at, 1);
|
|
100
|
+
else
|
|
101
|
+
line.text = text;
|
|
102
|
+
// A line not yet recorded as queued is recorded as it now stands, or not at all.
|
|
103
|
+
if (unrecorded.has(line)) {
|
|
104
|
+
if (text === null)
|
|
105
|
+
unrecorded.delete(line);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
changed.push({ id, text });
|
|
109
|
+
onQueued?.();
|
|
110
|
+
}
|
|
111
|
+
return text === null ? "withdrawn" : "edited";
|
|
63
112
|
},
|
|
64
|
-
send(text, mode, attachments, id) {
|
|
113
|
+
send(text, mode, attachments, id, context) {
|
|
65
114
|
if (!open)
|
|
66
115
|
return null;
|
|
67
116
|
const line = {
|
|
68
117
|
text,
|
|
69
118
|
...(attachments?.length ? { attachments } : {}),
|
|
70
119
|
...(id ? { id } : {}),
|
|
120
|
+
...(context ? { context } : {}),
|
|
71
121
|
};
|
|
72
122
|
if (mode === "now" && deliverNow) {
|
|
73
123
|
deliverNow(line);
|
|
@@ -99,10 +149,15 @@ function refsOf(attachments) {
|
|
|
99
149
|
* A message as ACP content (R4.3): text files fenced as data inside the text,
|
|
100
150
|
* images as `image` blocks after it. Files are read here, never carried as bytes.
|
|
101
151
|
*/
|
|
102
|
-
export function promptParts(text, attachments = []) {
|
|
152
|
+
export function promptParts(text, attachments = [], link = { dir: null }) {
|
|
103
153
|
const fenced = [];
|
|
104
154
|
const images = [];
|
|
155
|
+
const links = [];
|
|
105
156
|
for (const a of attachments) {
|
|
157
|
+
if (!inlines(a)) {
|
|
158
|
+
links.push(attachmentLink(a, link.dir));
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
106
161
|
const bytes = readFileSync(a.path);
|
|
107
162
|
if (a.mimeType.startsWith("image/"))
|
|
108
163
|
images.push({
|
|
@@ -115,8 +170,35 @@ export function promptParts(text, attachments = []) {
|
|
|
115
170
|
}
|
|
116
171
|
if (images.length)
|
|
117
172
|
fenced.push(ATTACHED_IMAGE_GUARD);
|
|
173
|
+
if (links.length)
|
|
174
|
+
fenced.push(LINKED_FILES_NOTE);
|
|
118
175
|
const body = [text, ...fenced].filter(Boolean).join("\n\n");
|
|
119
|
-
return [{ type: "text", text: body }, ...images];
|
|
176
|
+
return [{ type: "text", text: body }, ...images, ...links];
|
|
177
|
+
}
|
|
178
|
+
const LINKED_FILES_NOTE = "Some attached files are linked below instead of inlined. A file:// link is in a folder you may read; a prismalens://attachment/<id> link is read with the attachment_read tool, in chunks.";
|
|
179
|
+
/** An image to 4 MB or a text file to 256 KB goes inline; anything else is linked (#1024). */
|
|
180
|
+
function inlines(a) {
|
|
181
|
+
const kind = attachmentKind({ name: a.name, type: a.mimeType });
|
|
182
|
+
if (kind === "image")
|
|
183
|
+
return a.size <= ATTACHMENT_IMAGE_MAX_BYTES;
|
|
184
|
+
if (kind === "text")
|
|
185
|
+
return a.size <= ATTACHMENT_TEXT_MAX_BYTES;
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
/** The run-scoped folder's copy when the agent reads extra directories, else the tool's URI. */
|
|
189
|
+
function attachmentLink(a, dir) {
|
|
190
|
+
const head = { name: a.name, mimeType: a.mimeType, size: a.size };
|
|
191
|
+
if (!dir) {
|
|
192
|
+
return {
|
|
193
|
+
type: "resource_link",
|
|
194
|
+
uri: `prismalens://attachment/${a.id}`,
|
|
195
|
+
...head,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
mkdirSync(dir, { recursive: true });
|
|
199
|
+
const target = join(dir, `${a.id}-${a.name.replace(/[^\w.-]+/g, "_")}`);
|
|
200
|
+
copyFileSync(a.path, target);
|
|
201
|
+
return { type: "resource_link", uri: pathToFileURL(target).href, ...head };
|
|
120
202
|
}
|
|
121
203
|
/** `mode` is the id the agent reported as current, else the one asked for (#673 w21); `cooperative` until its sandbox is checked. */
|
|
122
204
|
export function buildRunFidelity(harness, model, mode, mechanism = "agent", runtime) {
|
|
@@ -194,6 +276,7 @@ export function prepareRunEnv(opts) {
|
|
|
194
276
|
},
|
|
195
277
|
}
|
|
196
278
|
: {}),
|
|
279
|
+
...(opts.subagentLimits ? { subagents: opts.subagentLimits } : {}),
|
|
197
280
|
descriptor: { ...AGENT_REGISTRY[opts.harness], ...descriptor },
|
|
198
281
|
});
|
|
199
282
|
writeLaunchFiles(plan);
|
|
@@ -202,6 +285,21 @@ export function prepareRunEnv(opts) {
|
|
|
202
285
|
/** How long a run waits after `session/new` for the agent's first gateway request. */
|
|
203
286
|
const GATEWAY_CONFIRM_MS = 5_000;
|
|
204
287
|
export async function* runInvestigation(opts) {
|
|
288
|
+
const secrets = requestedSecrets(opts.secrets);
|
|
289
|
+
if (!secrets.length) {
|
|
290
|
+
yield* runSession(opts);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
// A requested secret never reaches an event, even when the agent echoes it (#1024 spec B).
|
|
294
|
+
const stderr = opts.onHarnessStderr;
|
|
295
|
+
const scrubbed = {
|
|
296
|
+
...opts,
|
|
297
|
+
...(stderr ? { onHarnessStderr: (c) => stderr(scrub(c, secrets)) } : {}),
|
|
298
|
+
};
|
|
299
|
+
for await (const ev of runSession(scrubbed))
|
|
300
|
+
yield redactEvent(ev, secrets);
|
|
301
|
+
}
|
|
302
|
+
async function* runSession(opts) {
|
|
205
303
|
const descriptor = opts.descriptor ?? HARNESS_REGISTRY[opts.harness];
|
|
206
304
|
const adapter = new AcpAdapter({
|
|
207
305
|
runId: opts.runId,
|
|
@@ -209,7 +307,7 @@ export async function* runInvestigation(opts) {
|
|
|
209
307
|
...(opts.seqStart !== undefined ? { seqStart: opts.seqStart } : {}),
|
|
210
308
|
});
|
|
211
309
|
// A follow-up on a run from before permission levels keeps the session's mode and shows every ask (#673 w21).
|
|
212
|
-
|
|
310
|
+
let keepMode = !!opts.resume?.sessionId && !opts.accessLevel;
|
|
213
311
|
const level = opts.accessLevel ?? DEFAULT_ACCESS_LEVEL;
|
|
214
312
|
const access = resolveAccess(opts.harness, level);
|
|
215
313
|
const askedMode = access.mode ?? null;
|
|
@@ -220,9 +318,15 @@ export async function* runInvestigation(opts) {
|
|
|
220
318
|
});
|
|
221
319
|
const transcript = join(opts.runDir, "transcript.jsonl");
|
|
222
320
|
// session/new carries the gateway bearer; the transcript never stores it (#848).
|
|
223
|
-
|
|
321
|
+
// Nor the GitHub token values the agent's env holds (#1020).
|
|
322
|
+
const hidden = [
|
|
323
|
+
...injectedSecrets(env, [opts.gateway?.token]),
|
|
324
|
+
...requestedSecrets(opts.secrets),
|
|
325
|
+
];
|
|
224
326
|
const wire = (direction, line) => {
|
|
225
|
-
|
|
327
|
+
let m = line;
|
|
328
|
+
for (const s of hidden)
|
|
329
|
+
m = m.replaceAll(s, "[redacted]");
|
|
226
330
|
try {
|
|
227
331
|
appendFileSync(transcript, `${JSON.stringify({ t: Date.now(), d: direction, m })}\n`);
|
|
228
332
|
}
|
|
@@ -236,24 +340,53 @@ export async function* runInvestigation(opts) {
|
|
|
236
340
|
// The brief rides the session, new and load alike, so the first prompt carries only the turn (#817).
|
|
237
341
|
const brief = descriptor.systemPromptVia === "claude-meta" &&
|
|
238
342
|
opts.kind !== "chat" &&
|
|
239
|
-
opts.context.alerts.length > 0
|
|
343
|
+
(opts.context.alerts.length > 0 || opts.context.mode === "service-check")
|
|
240
344
|
? investigationPromptParts(opts.context, { level }).brief
|
|
241
345
|
: null;
|
|
242
346
|
const investigationPrompt = (o) => brief
|
|
243
347
|
? investigationPromptParts(opts.context, o).turn
|
|
244
348
|
: buildInvestigationPrompt(opts.context, o);
|
|
349
|
+
// The run's ask policy decides: an unattended run declines at once (#1024).
|
|
350
|
+
const elicit = (ask, ctx) => {
|
|
351
|
+
if ((opts.unattended && !opts.waitForAsks) || !opts.elicit)
|
|
352
|
+
return { outcome: "unattended" };
|
|
353
|
+
const timeoutMs = askWindow(opts.questionTimeoutMs ?? QUESTION_ASK_TIMEOUT_MS, opts.limits?.wallClockMs, Date.now() - spawnedAt).timeoutMs;
|
|
354
|
+
return {
|
|
355
|
+
timeoutMs,
|
|
356
|
+
outcome: opts.elicit(ctx.askId, ask, { signal: ctx.signal, timeoutMs }),
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
const linkOpts = () => ({
|
|
360
|
+
dir: opts.attachmentsDir && session.takesDirectories
|
|
361
|
+
? opts.attachmentsDir
|
|
362
|
+
: null,
|
|
363
|
+
});
|
|
245
364
|
// The launcher's wall clock starts at spawn, in open().
|
|
246
365
|
let spawnedAt = Date.now();
|
|
247
366
|
const session = new AcpSession({
|
|
248
367
|
command: launch.command,
|
|
249
368
|
args,
|
|
250
369
|
cwd: opts.cwd,
|
|
251
|
-
...(opts.roots
|
|
370
|
+
...(opts.roots || opts.attachmentsDir
|
|
371
|
+
? {
|
|
372
|
+
roots: {
|
|
373
|
+
cwd: opts.roots?.cwd ?? opts.cwd,
|
|
374
|
+
additional: [
|
|
375
|
+
...(opts.roots?.additional ?? []),
|
|
376
|
+
...(opts.attachmentsDir ? [opts.attachmentsDir] : []),
|
|
377
|
+
],
|
|
378
|
+
},
|
|
379
|
+
}
|
|
380
|
+
: {}),
|
|
381
|
+
...(opts.elicit ? { elicit } : {}),
|
|
252
382
|
env,
|
|
253
383
|
limits: opts.limits,
|
|
384
|
+
...(opts.onSpawn ? { onSpawn: opts.onSpawn } : {}),
|
|
254
385
|
permission: levelPolicy(keepMode ? "supervised" : level, { policy: opts.permission ?? denyAllPolicy }, {
|
|
255
386
|
unattended: !!opts.unattended,
|
|
387
|
+
...(opts.waitForAsks ? { waitForAsks: true } : {}),
|
|
256
388
|
...(opts.gateway ? { gateway: opts.gateway } : {}),
|
|
389
|
+
...(opts.alwaysAllow?.length ? { remembered: opts.alwaysAllow } : {}),
|
|
257
390
|
}),
|
|
258
391
|
// An ask never outlives the launcher's kill: its window ends a minute before (#673 w21).
|
|
259
392
|
askWindow: () => askWindow(opts.askTimeoutMs ?? ASK_TIMEOUT_MS, opts.limits?.wallClockMs, Date.now() - spawnedAt),
|
|
@@ -265,7 +398,13 @@ export async function* runInvestigation(opts) {
|
|
|
265
398
|
onWire: wire,
|
|
266
399
|
onStderr: opts.onHarnessStderr,
|
|
267
400
|
...(opts.resume?.sessionId
|
|
268
|
-
? {
|
|
401
|
+
? {
|
|
402
|
+
resume: {
|
|
403
|
+
sessionId: opts.resume.sessionId,
|
|
404
|
+
...(opts.resume.known ? { known: opts.resume.known } : {}),
|
|
405
|
+
fresh: !!opts.resume.fresh,
|
|
406
|
+
},
|
|
407
|
+
}
|
|
269
408
|
: {}),
|
|
270
409
|
...(offer ? { mcpServers: offer.pick } : {}),
|
|
271
410
|
onDrift: (drift) => {
|
|
@@ -275,6 +414,11 @@ export async function* runInvestigation(opts) {
|
|
|
275
414
|
});
|
|
276
415
|
let text = "";
|
|
277
416
|
let sawEvidence = false;
|
|
417
|
+
const ownCalls = new Set();
|
|
418
|
+
/** The context the agent last reported, and whether PrismaLens's own compact turn runs (#1024). */
|
|
419
|
+
let lastUsed = opts.resume?.compact?.before;
|
|
420
|
+
let compacting = false;
|
|
421
|
+
let autoCompactFrom;
|
|
278
422
|
/** The run's mode once set; the agent may not leave it (#673 w7-4). */
|
|
279
423
|
let heldMode = null;
|
|
280
424
|
let lastCall = null;
|
|
@@ -283,8 +427,7 @@ export async function* runInvestigation(opts) {
|
|
|
283
427
|
/** Asks the agent back into the run's mode and shows the refusal; the run goes on either way. */
|
|
284
428
|
const holdMode = async function* (held) {
|
|
285
429
|
const left = session.currentMode;
|
|
286
|
-
const flushed
|
|
287
|
-
if (flushed)
|
|
430
|
+
for (const flushed of adapter.flush())
|
|
288
431
|
yield flushed;
|
|
289
432
|
const back = (await session.setMode(held)) && session.currentMode === held;
|
|
290
433
|
stuckIn = back ? null : left;
|
|
@@ -298,30 +441,77 @@ export async function* runInvestigation(opts) {
|
|
|
298
441
|
const consume = async function* (items) {
|
|
299
442
|
for await (const item of items) {
|
|
300
443
|
if (opts.signal?.aborted)
|
|
301
|
-
session.cancel();
|
|
444
|
+
session.cancel(opts.signal.reason);
|
|
302
445
|
if (item.kind === "update") {
|
|
303
446
|
const u = item.update;
|
|
304
|
-
|
|
447
|
+
// A sub-agent's words and state are its own: never the report's text, the run's usage or mode (#1025).
|
|
448
|
+
const main = !item.sessionId && !parentToolUseOf(u._meta);
|
|
449
|
+
if (main && u.sessionUpdate === "agent_message_chunk") {
|
|
305
450
|
const chunk = u.content;
|
|
306
451
|
text +=
|
|
307
452
|
typeof chunk === "string"
|
|
308
453
|
? chunk
|
|
309
454
|
: (chunk?.text ?? "");
|
|
310
455
|
}
|
|
311
|
-
if (u.sessionUpdate === "usage_update") {
|
|
456
|
+
if (main && u.sessionUpdate === "usage_update") {
|
|
312
457
|
const usage = parseUsageUpdate(u);
|
|
313
|
-
if (usage)
|
|
458
|
+
if (usage) {
|
|
459
|
+
lastUsed = usage.used;
|
|
314
460
|
opts.onUsage?.(usage);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
// The agent compacted on its own; PrismaLens's own compact turn records itself.
|
|
464
|
+
if (u.sessionUpdate === "compaction_update" && !compacting) {
|
|
465
|
+
const status = u.status;
|
|
466
|
+
const flushed = adapter.flushText();
|
|
467
|
+
if (flushed)
|
|
468
|
+
yield flushed;
|
|
469
|
+
if (status === "in_progress") {
|
|
470
|
+
autoCompactFrom = lastUsed;
|
|
471
|
+
yield adapter.compaction("started", "agent_auto", {
|
|
472
|
+
...(lastUsed !== undefined ? { before: lastUsed } : {}),
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
else if (status === "completed" || status === "failed") {
|
|
476
|
+
yield adapter.compaction(status === "completed" ? "completed" : "failed", "agent_auto", {
|
|
477
|
+
...(autoCompactFrom !== undefined
|
|
478
|
+
? { before: autoCompactFrom }
|
|
479
|
+
: {}),
|
|
480
|
+
...(lastUsed !== undefined && lastUsed !== autoCompactFrom
|
|
481
|
+
? { after: lastUsed }
|
|
482
|
+
: {}),
|
|
483
|
+
});
|
|
484
|
+
autoCompactFrom = undefined;
|
|
485
|
+
}
|
|
315
486
|
}
|
|
316
487
|
if (u.sessionUpdate === "tool_call")
|
|
317
488
|
lastCall = { title: u.title, toolCallId: u.toolCallId };
|
|
318
|
-
|
|
489
|
+
if (u.toolCallId && opts.gateway?.sawOutput) {
|
|
490
|
+
// A call to PrismaLens's own tools carries the quote it records, so it never anchors one (#930).
|
|
491
|
+
if (namesServer(u, opts.gateway.serverName))
|
|
492
|
+
ownCalls.add(u.toolCallId);
|
|
493
|
+
const done = u.sessionUpdate === "tool_call_update" ||
|
|
494
|
+
u.status === "completed" ||
|
|
495
|
+
u.status === "failed";
|
|
496
|
+
const out = done ? toolOutputText(u) : "";
|
|
497
|
+
if (out && !ownCalls.has(u.toolCallId))
|
|
498
|
+
opts.gateway.sawOutput(u.toolCallId, out);
|
|
499
|
+
}
|
|
500
|
+
if (main &&
|
|
501
|
+
u.sessionUpdate === "available_commands_update" &&
|
|
502
|
+
opts.onCommands) {
|
|
503
|
+
const commands = parseAgentCommands(u);
|
|
504
|
+
if (commands)
|
|
505
|
+
opts.onCommands(commands);
|
|
506
|
+
}
|
|
507
|
+
for (const ev of adapter.events(u, item.sessionId)) {
|
|
319
508
|
if (ev.kind === "tool_result")
|
|
320
509
|
sawEvidence = true;
|
|
321
510
|
yield ev;
|
|
322
511
|
}
|
|
323
512
|
// An agent can switch with no ask, so the mode update is the only sign (#673 w7-4).
|
|
324
513
|
if (heldMode &&
|
|
514
|
+
!item.sessionId &&
|
|
325
515
|
(u.sessionUpdate === "current_mode_update" ||
|
|
326
516
|
u.sessionUpdate === "config_option_update") &&
|
|
327
517
|
session.currentMode !== heldMode &&
|
|
@@ -330,14 +520,13 @@ export async function* runInvestigation(opts) {
|
|
|
330
520
|
}
|
|
331
521
|
else if (item.kind === "permission_asked") {
|
|
332
522
|
openAsks.add(item.askId);
|
|
333
|
-
const flushed
|
|
334
|
-
if (flushed)
|
|
523
|
+
for (const flushed of adapter.flush())
|
|
335
524
|
yield flushed;
|
|
336
525
|
const window = item.window ?? {
|
|
337
526
|
timeoutMs: opts.askTimeoutMs ?? ASK_TIMEOUT_MS,
|
|
338
527
|
clamped: false,
|
|
339
528
|
};
|
|
340
|
-
yield adapter.permissionAsk(item.askId, item.request.toolCall, new Date(Date.now() + window.timeoutMs), window.clamped);
|
|
529
|
+
yield adapter.permissionAsk(item.askId, item.request.toolCall, new Date(Date.now() + window.timeoutMs), window.clamped, item.request.sessionId);
|
|
341
530
|
}
|
|
342
531
|
else if (item.kind === "permission") {
|
|
343
532
|
wire("in", JSON.stringify({
|
|
@@ -351,29 +540,45 @@ export async function* runInvestigation(opts) {
|
|
|
351
540
|
if (item.warn)
|
|
352
541
|
opts.onPolicyWarning?.(item.warn);
|
|
353
542
|
if (item.sync) {
|
|
354
|
-
const flushed
|
|
355
|
-
if (flushed)
|
|
543
|
+
for (const flushed of adapter.flush())
|
|
356
544
|
yield flushed;
|
|
357
545
|
}
|
|
358
546
|
openAsks.delete(item.askId);
|
|
359
547
|
yield adapter.permissionAnswer(item.askId, item.outcome, item.sync ? item.request.toolCall : undefined);
|
|
360
548
|
}
|
|
549
|
+
else if (item.kind === "elicit_asked") {
|
|
550
|
+
const flushed = adapter.flushText();
|
|
551
|
+
if (flushed)
|
|
552
|
+
yield flushed;
|
|
553
|
+
yield adapter.askOpened(elicitedAsk(item));
|
|
554
|
+
}
|
|
555
|
+
else if (item.kind === "elicit_closed") {
|
|
556
|
+
yield adapter.askClosed(item.askId, item.closed.outcome, "answer" in item.closed ? item.closed.answer : undefined);
|
|
557
|
+
}
|
|
361
558
|
else if (item.kind === "nudge") {
|
|
362
559
|
yield* recordQueued();
|
|
363
560
|
}
|
|
364
561
|
else if (item.kind === "harness_tool_call") {
|
|
365
|
-
if (opts.gateway)
|
|
366
|
-
yield adapter.harnessToolCall(opts.gateway.serverName, item.
|
|
562
|
+
if (opts.gateway && shown(`call:${item.call.callId ?? item.call.at}`))
|
|
563
|
+
yield adapter.harnessToolCall(opts.gateway.serverName, item.call, toolsTurn);
|
|
564
|
+
}
|
|
565
|
+
else if (item.kind === "harness_finding") {
|
|
566
|
+
if (shown(findingKey(item.finding)))
|
|
567
|
+
yield adapter.findingRecorded(item.finding);
|
|
568
|
+
}
|
|
569
|
+
else if (item.kind === "harness_artifact") {
|
|
570
|
+
if (!shownPages.has(item.artifact.id)) {
|
|
571
|
+
shownPages.add(item.artifact.id);
|
|
572
|
+
yield adapter.artifactPublished(item.artifact);
|
|
573
|
+
}
|
|
367
574
|
}
|
|
368
575
|
else if (item.kind === "done") {
|
|
369
|
-
const flushed
|
|
370
|
-
if (flushed)
|
|
576
|
+
for (const flushed of adapter.flush())
|
|
371
577
|
yield flushed;
|
|
372
578
|
return { stop: item.stopReason };
|
|
373
579
|
}
|
|
374
580
|
else {
|
|
375
|
-
const flushed
|
|
376
|
-
if (flushed)
|
|
581
|
+
for (const flushed of adapter.flush())
|
|
377
582
|
yield flushed;
|
|
378
583
|
return { error: item.message };
|
|
379
584
|
}
|
|
@@ -385,14 +590,61 @@ export async function* runInvestigation(opts) {
|
|
|
385
590
|
const recordQueued = function* () {
|
|
386
591
|
for (const line of opts.steer?.queued?.() ?? [])
|
|
387
592
|
if (line.id)
|
|
388
|
-
yield adapter.messageQueued(line.id, line.text, refsOf(line.attachments));
|
|
593
|
+
yield adapter.messageQueued(line.id, line.text, refsOf(line.attachments), line.context);
|
|
594
|
+
for (const c of opts.steer?.changes?.() ?? [])
|
|
595
|
+
yield adapter.messageChanged(c.id, c.text);
|
|
389
596
|
};
|
|
597
|
+
const elicitedAsk = (item) => ({
|
|
598
|
+
askId: item.askId,
|
|
599
|
+
threadId: opts.runId,
|
|
600
|
+
kind: item.ask.kind,
|
|
601
|
+
requiresHost: false,
|
|
602
|
+
source: adapter.askSource(item.sessionId),
|
|
603
|
+
title: item.ask.title,
|
|
604
|
+
openedAt: new Date().toISOString(),
|
|
605
|
+
...(item.expiresAt ? { expiresAt: item.expiresAt.toISOString() } : {}),
|
|
606
|
+
...(item.ask.kind === "question"
|
|
607
|
+
? { questions: item.ask.questions }
|
|
608
|
+
: { input: { schema: item.ask.schema } }),
|
|
609
|
+
});
|
|
390
610
|
/**
|
|
391
611
|
* What the run leaves behind on any end (#820): an ask it never heard back on
|
|
392
612
|
* reads stopped, and a message it never read, not delivered.
|
|
393
613
|
*/
|
|
614
|
+
const shownPages = new Set();
|
|
615
|
+
const seen = new Set();
|
|
616
|
+
/** True the first time `key` is seen this run. */
|
|
617
|
+
const shown = (key) => !seen.has(key) && !!seen.add(key);
|
|
618
|
+
// The anchor is in the key so evidence that anchors after its first emission shows again.
|
|
619
|
+
const findingKey = (f) => `finding:${f.type}:${f.id}:${f.at}:${JSON.stringify(f.type === "evidence" ? (f.anchor ?? null) : null)}`;
|
|
394
620
|
const toolsSummary = function* () {
|
|
395
621
|
unCalled?.();
|
|
622
|
+
unFound?.();
|
|
623
|
+
unPublished?.();
|
|
624
|
+
opts.gateway?.closeRecording?.();
|
|
625
|
+
// What was acknowledged after the turn's last item was read is still recorded, once.
|
|
626
|
+
const gw = opts.gateway;
|
|
627
|
+
for (const call of gw?.callLog?.() ?? [])
|
|
628
|
+
if (gw && call.callId && shown(`call:${call.callId}`))
|
|
629
|
+
yield adapter.harnessToolCall(gw.serverName, call, toolsTurn);
|
|
630
|
+
const found = gw?.findings?.();
|
|
631
|
+
for (const f of [
|
|
632
|
+
...(found?.evidence ?? []).map((e) => ({
|
|
633
|
+
type: "evidence",
|
|
634
|
+
...e,
|
|
635
|
+
})),
|
|
636
|
+
...(found?.hypotheses ?? []).map((h) => ({
|
|
637
|
+
type: "hypothesis",
|
|
638
|
+
...h,
|
|
639
|
+
})),
|
|
640
|
+
])
|
|
641
|
+
if (shown(findingKey(f)))
|
|
642
|
+
yield adapter.findingRecorded(f);
|
|
643
|
+
for (const page of gw?.artifacts?.() ?? [])
|
|
644
|
+
if (!shownPages.has(page.id)) {
|
|
645
|
+
shownPages.add(page.id);
|
|
646
|
+
yield adapter.artifactPublished(page);
|
|
647
|
+
}
|
|
396
648
|
if (offer && opts.gateway && !summarized) {
|
|
397
649
|
summarized = true;
|
|
398
650
|
yield adapter.harnessTools(opts.gateway.serverName, toolsTurn, opts.gateway.connected(), opts.gateway.calls());
|
|
@@ -400,24 +652,29 @@ export async function* runInvestigation(opts) {
|
|
|
400
652
|
};
|
|
401
653
|
const leftovers = function* (tools = true) {
|
|
402
654
|
for (const askId of openAsks)
|
|
403
|
-
yield adapter.permissionAnswer(askId,
|
|
655
|
+
yield adapter.permissionAnswer(askId, abortOutcome(opts.signal));
|
|
404
656
|
openAsks.clear();
|
|
405
657
|
unsubscribe?.();
|
|
406
658
|
unQueued?.();
|
|
659
|
+
unCancel?.();
|
|
660
|
+
yield* adapter.endSubagents(!!opts.signal?.aborted);
|
|
407
661
|
if (tools)
|
|
408
662
|
yield* toolsSummary();
|
|
409
663
|
for (const line of [...sendNow.splice(0), ...drain(opts.steer)])
|
|
410
|
-
yield adapter.operatorMessage(line.text, "queue", false, undefined, refsOf(line.attachments), undefined, line.id);
|
|
664
|
+
yield adapter.operatorMessage(line.text, "queue", false, undefined, refsOf(line.attachments), undefined, line.id, undefined, line.context);
|
|
411
665
|
};
|
|
412
666
|
const unsubscribe = opts.steer?.onNow((line) => {
|
|
413
667
|
sendNow.push(line);
|
|
414
668
|
session.cancel();
|
|
415
669
|
});
|
|
416
670
|
const unQueued = opts.steer?.onQueued?.(() => session.nudge());
|
|
671
|
+
const unCancel = opts.subagents?.onCancel((sessionId) => session.cancelSubagent(sessionId));
|
|
417
672
|
const toolsTurn = opts.resume ? "follow-up" : "first";
|
|
418
673
|
let summarized = false;
|
|
419
|
-
const unCalled = opts.gateway?.onCall((c) => session.inject({ kind: "harness_tool_call",
|
|
420
|
-
const
|
|
674
|
+
const unCalled = opts.gateway?.onCall((c) => session.inject({ kind: "harness_tool_call", call: c }));
|
|
675
|
+
const unFound = opts.gateway?.onFinding?.((finding) => session.inject({ kind: "harness_finding", finding }));
|
|
676
|
+
const unPublished = opts.gateway?.onArtifact?.((artifact) => session.inject({ kind: "harness_artifact", artifact }));
|
|
677
|
+
const onAbort = () => session.cancel(opts.signal?.reason);
|
|
421
678
|
opts.signal?.addEventListener("abort", onAbort, { once: true });
|
|
422
679
|
const label = HARNESS_REGISTRY[opts.harness]?.label ?? descriptor.binary;
|
|
423
680
|
const modelVia = descriptor.modelVia ?? HARNESS_REGISTRY[opts.harness]?.modelVia;
|
|
@@ -430,8 +687,12 @@ export async function* runInvestigation(opts) {
|
|
|
430
687
|
loadSession: session.loadSession,
|
|
431
688
|
});
|
|
432
689
|
}
|
|
433
|
-
|
|
434
|
-
|
|
690
|
+
const fresh = session.reopen === "fresh" && opts.resume?.fresh
|
|
691
|
+
? await opts.resume.fresh()
|
|
692
|
+
: null;
|
|
693
|
+
// A fresh session has no mode to keep: it takes the run's level, supervised when it named none.
|
|
694
|
+
if (session.reopen === "fresh")
|
|
695
|
+
keepMode = false;
|
|
435
696
|
// Only a request with the run's token proves the agent loaded our server (OBJ-011).
|
|
436
697
|
const connected = opts.gateway && offer?.offered()
|
|
437
698
|
? await opts.gateway.waitConnected(GATEWAY_CONFIRM_MS)
|
|
@@ -523,30 +784,103 @@ export async function* runInvestigation(opts) {
|
|
|
523
784
|
opts.onPolicyWarning?.(`${label} did not keep ${opts.effort} effort`);
|
|
524
785
|
return yield* consume(session.prompt(parts));
|
|
525
786
|
};
|
|
787
|
+
/** The agent's own compact command as a turn, between two boundary events (#1024). */
|
|
788
|
+
const compactTurn = async function* (c) {
|
|
789
|
+
const before = lastUsed;
|
|
790
|
+
const instructions = c.instructions?.trim();
|
|
791
|
+
yield adapter.compaction("started", "agent_command", {
|
|
792
|
+
...(before !== undefined ? { before } : {}),
|
|
793
|
+
...(instructions ? { instructions } : {}),
|
|
794
|
+
});
|
|
795
|
+
compacting = true;
|
|
796
|
+
let r;
|
|
797
|
+
try {
|
|
798
|
+
r = yield* turn([
|
|
799
|
+
{
|
|
800
|
+
type: "text",
|
|
801
|
+
text: `/${c.command}${instructions ? ` ${instructions}` : ""}`,
|
|
802
|
+
},
|
|
803
|
+
]);
|
|
804
|
+
}
|
|
805
|
+
finally {
|
|
806
|
+
compacting = false;
|
|
807
|
+
}
|
|
808
|
+
const flushed = adapter.flushText();
|
|
809
|
+
if (flushed)
|
|
810
|
+
yield flushed;
|
|
811
|
+
text = "";
|
|
812
|
+
const ok = "stop" in r && r.stop !== "cancelled";
|
|
813
|
+
yield adapter.compaction(ok ? "completed" : "failed", "agent_command", {
|
|
814
|
+
...(before !== undefined ? { before } : {}),
|
|
815
|
+
...(ok && lastUsed !== undefined && lastUsed !== before
|
|
816
|
+
? { after: lastUsed }
|
|
817
|
+
: {}),
|
|
818
|
+
});
|
|
819
|
+
return r;
|
|
820
|
+
};
|
|
526
821
|
let outcome;
|
|
527
|
-
|
|
822
|
+
// A compaction can fail on a usage limit: the line waits as queued, so a later resume still sends it.
|
|
823
|
+
const lineId = opts.resume?.messageId ??
|
|
824
|
+
(opts.resume?.compact && !opts.resume.compact.only
|
|
825
|
+
? randomUUID()
|
|
826
|
+
: undefined);
|
|
827
|
+
if (opts.resume?.compact && !opts.resume.compact.only && lineId)
|
|
828
|
+
yield adapter.messageQueued(lineId, opts.resume.text, refsOf(opts.resume.attachments), opts.resume.context, opts.resume.delivers);
|
|
829
|
+
const compacted = opts.resume?.compact
|
|
830
|
+
? yield* compactTurn(opts.resume.compact)
|
|
831
|
+
: null;
|
|
832
|
+
if (compacted && ("error" in compacted || opts.resume?.compact?.only)) {
|
|
833
|
+
outcome = compacted;
|
|
834
|
+
}
|
|
835
|
+
else if (opts.resume) {
|
|
528
836
|
const { text: line, mode, heads, attachments, kind, newer } = opts.resume;
|
|
529
|
-
|
|
837
|
+
const handoff = fresh?.text ?? opts.resume.handoff;
|
|
838
|
+
const via = opts.resume.via;
|
|
839
|
+
yield adapter.operatorMessage(line, mode, true, heads, refsOf(attachments), kind ?? "chat", lineId, fresh && via
|
|
840
|
+
? {
|
|
841
|
+
...via,
|
|
842
|
+
handoff: {
|
|
843
|
+
from: fresh.from,
|
|
844
|
+
carried: fresh.carried,
|
|
845
|
+
omitted: fresh.omitted,
|
|
846
|
+
},
|
|
847
|
+
}
|
|
848
|
+
: via, opts.resume.context, opts.resume.delivers);
|
|
530
849
|
const said = [
|
|
531
|
-
...(opts.resume.afterRestart && !
|
|
532
|
-
|
|
533
|
-
: []),
|
|
534
|
-
line,
|
|
850
|
+
...(opts.resume.afterRestart && !handoff ? [RESTART_NOTE] : []),
|
|
851
|
+
withAddendum(line, opts.resume.context),
|
|
535
852
|
...(newer ? [newerRunNote(newer)] : []),
|
|
536
853
|
].join("\n\n");
|
|
537
|
-
const seeded =
|
|
854
|
+
const seeded = handoff
|
|
538
855
|
? kind === "continue"
|
|
539
|
-
? `${investigationPrompt({ modeName, noNetwork, level })}\n\n${
|
|
540
|
-
: buildChatPrompt(opts.context, `${
|
|
856
|
+
? `${investigationPrompt({ modeName, noNetwork, level })}\n\n${handoff}\n\n${said}`
|
|
857
|
+
: buildChatPrompt(opts.context, `${handoff}\n\n${said}`, {
|
|
541
858
|
noNetwork,
|
|
859
|
+
level,
|
|
860
|
+
modeName,
|
|
542
861
|
})
|
|
543
862
|
: said;
|
|
544
|
-
outcome = yield* turn(promptParts(seeded, attachments));
|
|
863
|
+
outcome = yield* turn(promptParts(seeded, attachments, linkOpts()));
|
|
864
|
+
// After the turn, so history an agent streams late is counted too.
|
|
865
|
+
if (session.reopen) {
|
|
866
|
+
const reopen = {
|
|
867
|
+
path: session.reopen,
|
|
868
|
+
replayed: session.replayed,
|
|
869
|
+
ms: session.reopenMs,
|
|
870
|
+
};
|
|
871
|
+
wire("in", JSON.stringify({ reopen }));
|
|
872
|
+
opts.onReopen?.(reopen);
|
|
873
|
+
}
|
|
545
874
|
}
|
|
546
875
|
else if (opts.kind === "chat") {
|
|
547
876
|
const message = opts.brief?.trim() ?? "";
|
|
548
|
-
yield adapter.operatorMessage(message, "queue", true, undefined, refsOf(opts.attachments));
|
|
549
|
-
outcome = yield* turn(promptParts(buildChatPrompt(opts.context, message,
|
|
877
|
+
yield adapter.operatorMessage(message, "queue", true, undefined, refsOf(opts.attachments), undefined, undefined, undefined, opts.messageContext);
|
|
878
|
+
outcome = yield* turn(promptParts(buildChatPrompt(opts.context, withAddendum(message, opts.messageContext), {
|
|
879
|
+
noNetwork,
|
|
880
|
+
level,
|
|
881
|
+
modeName,
|
|
882
|
+
tools: toolsLine,
|
|
883
|
+
}), opts.attachments, linkOpts()));
|
|
550
884
|
}
|
|
551
885
|
else {
|
|
552
886
|
const brief = opts.brief?.trim();
|
|
@@ -558,8 +892,11 @@ export async function* runInvestigation(opts) {
|
|
|
558
892
|
level,
|
|
559
893
|
}) +
|
|
560
894
|
toolsLine +
|
|
561
|
-
|
|
562
|
-
(
|
|
895
|
+
// A service check's prompt already holds the brief (#979).
|
|
896
|
+
(brief && opts.context.mode !== "service-check"
|
|
897
|
+
? `\n\n${brief}`
|
|
898
|
+
: "") +
|
|
899
|
+
(opts.promptSuffix ? `\n\n${opts.promptSuffix}` : ""), opts.attachments, linkOpts()));
|
|
563
900
|
}
|
|
564
901
|
while ("stop" in outcome && !opts.signal?.aborted) {
|
|
565
902
|
const now = sendNow.shift();
|
|
@@ -569,10 +906,10 @@ export async function* runInvestigation(opts) {
|
|
|
569
906
|
if (lines.length === 0)
|
|
570
907
|
break;
|
|
571
908
|
for (const line of lines) {
|
|
572
|
-
yield adapter.operatorMessage(line.text, line === now ? "now" : "queue", true, undefined, refsOf(line.attachments), undefined, line.id);
|
|
909
|
+
yield adapter.operatorMessage(line.text, line === now ? "now" : "queue", true, undefined, refsOf(line.attachments), undefined, line.id, undefined, line.context);
|
|
573
910
|
}
|
|
574
911
|
text = "";
|
|
575
|
-
outcome = yield* turn(promptParts(lines.map((l) => l.text).join("\n\n"), lines.flatMap((l) => l.attachments ?? [])));
|
|
912
|
+
outcome = yield* turn(promptParts(lines.map((l) => withAddendum(l.text, l.context)).join("\n\n"), lines.flatMap((l) => l.attachments ?? []), linkOpts()));
|
|
576
913
|
}
|
|
577
914
|
// Report repair turns still reach the tools, so their calls count until the end (#848).
|
|
578
915
|
yield* leftovers(false);
|
|
@@ -633,9 +970,9 @@ export async function* runInvestigation(opts) {
|
|
|
633
970
|
}
|
|
634
971
|
yield* toolsSummary();
|
|
635
972
|
yield adapter.branchDone(mapStopReason(outcome.stop));
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
|
|
973
|
+
const found = opts.gateway?.findings?.();
|
|
974
|
+
const answered = found ? withFindings(parsed.report, found) : parsed.report;
|
|
975
|
+
const gapped = noNetwork ? withSandboxGap(answered, label) : answered;
|
|
639
976
|
yield adapter.report(stampReport(withPreRunCoverage(gapped, opts.context), fidelity));
|
|
640
977
|
}
|
|
641
978
|
catch (err) {
|
|
@@ -645,6 +982,7 @@ export async function* runInvestigation(opts) {
|
|
|
645
982
|
finally {
|
|
646
983
|
unsubscribe?.();
|
|
647
984
|
unQueued?.();
|
|
985
|
+
unCancel?.();
|
|
648
986
|
opts.signal?.removeEventListener("abort", onAbort);
|
|
649
987
|
await session.close();
|
|
650
988
|
}
|
|
@@ -662,6 +1000,14 @@ async function applyMode(session, run) {
|
|
|
662
1000
|
? null
|
|
663
1001
|
: `${run.label} did not offer mode "${run.target}"; run a check in Settings, Agent`;
|
|
664
1002
|
}
|
|
1003
|
+
/** A call to the run's own MCP server, by its title, Claude Code's `_meta`, or its input's `server`. */
|
|
1004
|
+
function namesServer(u, server) {
|
|
1005
|
+
const meta = u._meta;
|
|
1006
|
+
const raw = u.rawInput;
|
|
1007
|
+
return ((typeof u.title === "string" && u.title.includes(server)) ||
|
|
1008
|
+
meta?.claudeCode?.mcpServer?.name === server ||
|
|
1009
|
+
raw?.server === server);
|
|
1010
|
+
}
|
|
665
1011
|
/** An agent sandbox with no network is named under What we could not check (#778). */
|
|
666
1012
|
function withSandboxGap(report, label) {
|
|
667
1013
|
const gap = `${label}'s sandbox allows no network`;
|