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
package/node_modules/@prismalens/api/dist/src/modules/investigations/investigations.service.js
CHANGED
|
@@ -12,16 +12,22 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
};
|
|
13
13
|
var InvestigationsService_1;
|
|
14
14
|
import { forwardRef, Inject, Injectable, Logger } from "@nestjs/common";
|
|
15
|
-
import { CanonicalEventSchema, effectiveLiveTurn, INVESTIGATION_REPORT_BRANCH, isWorkflowTerminal, LIVE_TURN_LABEL, LIVE_WORKFLOW_STATUSES, } from "@prismalens/contracts";
|
|
15
|
+
import { AllowedAskSchema, CanonicalEventSchema, effectiveLiveTurn, INVESTIGATION_REPORT_BRANCH, isWorkflowTerminal, LIVE_TURN_LABEL, LIVE_WORKFLOW_STATUSES, } from "@prismalens/contracts";
|
|
16
16
|
import { PreRunDetailSchema, PreRunSnapshotSchema, } from "@prismalens/contracts/schemas";
|
|
17
17
|
import { Prisma, } from "@prismalens/database";
|
|
18
18
|
import { PrismaService } from "../../core/prisma/prisma.service.js";
|
|
19
19
|
import { ResetInProgressError, SettingsService, } from "../../core/settings/settings.service.js";
|
|
20
20
|
import { TimelineEntryType, TimelineSource } from "../../shared/enums/index.js";
|
|
21
21
|
import { safeParseJsonObject } from "../../shared/utils/json-utils.js";
|
|
22
|
+
import { IncidentsService } from "../incidents/incidents.service.js";
|
|
22
23
|
import { OverlayService } from "../overlay/overlay.service.js";
|
|
23
24
|
import { owePush, pushOwedBy } from "../push/push-outbox.js";
|
|
25
|
+
import { withAsk } from "../schedules/allowed-asks.js";
|
|
24
26
|
import { TimelineService } from "../timeline/timeline.service.js";
|
|
27
|
+
import { endAgentWakes } from "../wakes/agent-wakes.js";
|
|
28
|
+
import { meetsPromotionRule } from "./promotion.js";
|
|
29
|
+
import { runScope, sharesAdmission } from "./run-scope.js";
|
|
30
|
+
import { recordSubagent } from "./subagent-sessions.js";
|
|
25
31
|
export function preRunDetailOf(raw) {
|
|
26
32
|
if (!raw)
|
|
27
33
|
return null;
|
|
@@ -63,12 +69,14 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
63
69
|
timelineService;
|
|
64
70
|
overlayService;
|
|
65
71
|
settingsService;
|
|
72
|
+
incidentsService;
|
|
66
73
|
logger = new Logger(InvestigationsService_1.name);
|
|
67
|
-
constructor(prisma, timelineService, overlayService, settingsService) {
|
|
74
|
+
constructor(prisma, timelineService, overlayService, settingsService, incidentsService) {
|
|
68
75
|
this.prisma = prisma;
|
|
69
76
|
this.timelineService = timelineService;
|
|
70
77
|
this.overlayService = overlayService;
|
|
71
78
|
this.settingsService = settingsService;
|
|
79
|
+
this.incidentsService = incidentsService;
|
|
72
80
|
}
|
|
73
81
|
async startOrGet(dto) {
|
|
74
82
|
if (this.settingsService.isResetting())
|
|
@@ -77,18 +85,24 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
77
85
|
let result;
|
|
78
86
|
try {
|
|
79
87
|
result = await this.prisma.$transaction(async (tx) => {
|
|
80
|
-
const running =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
88
|
+
const running = sharesAdmission(dto)
|
|
89
|
+
? await tx.investigation.findFirst({
|
|
90
|
+
where: {
|
|
91
|
+
...runScope(dto),
|
|
92
|
+
status: { in: [...LIVE_WORKFLOW_STATUSES] },
|
|
93
|
+
},
|
|
94
|
+
orderBy: { createdAt: "desc" },
|
|
95
|
+
})
|
|
96
|
+
: null;
|
|
87
97
|
if (running)
|
|
88
98
|
return { investigation: running, created: false };
|
|
89
99
|
const investigation = await tx.investigation.create({
|
|
90
100
|
data: {
|
|
91
101
|
incidentId: dto.incidentId,
|
|
102
|
+
...(dto.scheduleId ? { scheduleId: dto.scheduleId } : {}),
|
|
103
|
+
...(dto.serviceId ? { serviceId: dto.serviceId } : {}),
|
|
104
|
+
...(dto.repositoryId ? { repositoryId: dto.repositoryId } : {}),
|
|
105
|
+
...(dto.helperPlace ? { helperPlace: dto.helperPlace } : {}),
|
|
92
106
|
status: "pending",
|
|
93
107
|
...(dto.triggerType ? { triggerType: dto.triggerType } : {}),
|
|
94
108
|
...(dto.triggerReason ? { triggerReason: dto.triggerReason } : {}),
|
|
@@ -98,6 +112,7 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
98
112
|
...(dto.accessLevel ? { accessLevel: dto.accessLevel } : {}),
|
|
99
113
|
},
|
|
100
114
|
});
|
|
115
|
+
await dto.onCreate?.(tx, investigation.id);
|
|
101
116
|
return { investigation, created: true };
|
|
102
117
|
});
|
|
103
118
|
}
|
|
@@ -157,7 +172,10 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
157
172
|
});
|
|
158
173
|
return {
|
|
159
174
|
...investigation,
|
|
160
|
-
incident:
|
|
175
|
+
incident: investigation.incident && {
|
|
176
|
+
...investigation.incident,
|
|
177
|
+
mergedInto,
|
|
178
|
+
},
|
|
161
179
|
};
|
|
162
180
|
}
|
|
163
181
|
async findByIncidentId(incidentId) {
|
|
@@ -300,7 +318,7 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
300
318
|
}
|
|
301
319
|
async runNumber(inv) {
|
|
302
320
|
return this.prisma.investigation.count({
|
|
303
|
-
where: {
|
|
321
|
+
where: { ...runScope(inv), createdAt: { lte: inv.createdAt } },
|
|
304
322
|
});
|
|
305
323
|
}
|
|
306
324
|
async liveKindRefusal(inv, kind) {
|
|
@@ -359,7 +377,13 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
359
377
|
try {
|
|
360
378
|
const investigation = await this.prisma.investigation.findUnique({
|
|
361
379
|
where: { id },
|
|
362
|
-
select: {
|
|
380
|
+
select: {
|
|
381
|
+
incidentId: true,
|
|
382
|
+
serviceId: true,
|
|
383
|
+
title: true,
|
|
384
|
+
status: true,
|
|
385
|
+
kind: true,
|
|
386
|
+
},
|
|
363
387
|
});
|
|
364
388
|
if (!investigation)
|
|
365
389
|
return null;
|
|
@@ -395,6 +419,19 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
395
419
|
kind: dto.status === "failed" ? "run_failed" : "finding_ready",
|
|
396
420
|
investigationId: id,
|
|
397
421
|
});
|
|
422
|
+
const linked = !investigation.incidentId &&
|
|
423
|
+
investigation.serviceId &&
|
|
424
|
+
!chat &&
|
|
425
|
+
dto.status === "completed" &&
|
|
426
|
+
meetsPromotionRule(dto.report)
|
|
427
|
+
? await this.linkFinding(tx, {
|
|
428
|
+
id,
|
|
429
|
+
serviceId: investigation.serviceId,
|
|
430
|
+
title: investigation.title,
|
|
431
|
+
summary: dto.summary ?? dto.report?.summary ?? "",
|
|
432
|
+
})
|
|
433
|
+
: null;
|
|
434
|
+
const incidentId = linked ?? investigation.incidentId;
|
|
398
435
|
if (dto.recommendations && dto.recommendations.length > 0) {
|
|
399
436
|
await tx.recommendation.createMany({
|
|
400
437
|
data: dto.recommendations.map((rec) => ({
|
|
@@ -425,23 +462,24 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
425
462
|
: dto.rootCause
|
|
426
463
|
? `Root cause identified: ${dto.rootCause}`
|
|
427
464
|
: "Investigation completed";
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
465
|
+
if (incidentId)
|
|
466
|
+
await tx.timelineEntry.create({
|
|
467
|
+
data: {
|
|
468
|
+
incidentId,
|
|
469
|
+
type: dto.status === "failed"
|
|
470
|
+
? "investigation_failed"
|
|
471
|
+
: "investigation_completed",
|
|
472
|
+
title: timelineTitle,
|
|
473
|
+
description: timelineDescription,
|
|
474
|
+
source: "ai_worker",
|
|
475
|
+
metadata: JSON.stringify({
|
|
476
|
+
investigationId: id,
|
|
477
|
+
rootCause: dto.rootCause,
|
|
478
|
+
rootCauseCategory: dto.rootCauseCategory,
|
|
479
|
+
recommendationCount: dto.recommendations?.length ?? 0,
|
|
480
|
+
}),
|
|
481
|
+
},
|
|
482
|
+
});
|
|
445
483
|
return true;
|
|
446
484
|
});
|
|
447
485
|
if (!applied) {
|
|
@@ -461,7 +499,52 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
461
499
|
return null;
|
|
462
500
|
}
|
|
463
501
|
}
|
|
502
|
+
async linkFinding(tx, run) {
|
|
503
|
+
const open = await tx.incident.findFirst({
|
|
504
|
+
where: {
|
|
505
|
+
serviceId: run.serviceId,
|
|
506
|
+
status: { notIn: ["resolved", "closed"] },
|
|
507
|
+
},
|
|
508
|
+
orderBy: { createdAt: "desc" },
|
|
509
|
+
select: { id: true },
|
|
510
|
+
});
|
|
511
|
+
const incidentId = open?.id ??
|
|
512
|
+
(await (async () => {
|
|
513
|
+
const service = run.title
|
|
514
|
+
? null
|
|
515
|
+
: await tx.service.findUnique({
|
|
516
|
+
where: { id: run.serviceId },
|
|
517
|
+
select: { name: true },
|
|
518
|
+
});
|
|
519
|
+
return (await this.incidentsService.createInTx(tx, {
|
|
520
|
+
title: `Scheduled check: ${run.title ?? service?.name ?? "service"}`,
|
|
521
|
+
severity: "medium",
|
|
522
|
+
serviceId: run.serviceId,
|
|
523
|
+
})).id;
|
|
524
|
+
})());
|
|
525
|
+
const { count } = await tx.investigation.updateMany({
|
|
526
|
+
where: { id: run.id, incidentId: null },
|
|
527
|
+
data: { incidentId },
|
|
528
|
+
});
|
|
529
|
+
if (count === 0)
|
|
530
|
+
return null;
|
|
531
|
+
await tx.timelineEntry.create({
|
|
532
|
+
data: {
|
|
533
|
+
incidentId,
|
|
534
|
+
type: TimelineEntryType.custom,
|
|
535
|
+
title: `Scheduled check found: ${run.summary}`,
|
|
536
|
+
source: TimelineSource.ai_worker,
|
|
537
|
+
metadata: JSON.stringify({ investigationId: run.id }),
|
|
538
|
+
},
|
|
539
|
+
});
|
|
540
|
+
return incidentId;
|
|
541
|
+
}
|
|
542
|
+
appended = [];
|
|
543
|
+
onEventsAppended(fn) {
|
|
544
|
+
this.appended.push(fn);
|
|
545
|
+
}
|
|
464
546
|
async appendEvents(investigationId, events) {
|
|
547
|
+
const stored = [];
|
|
465
548
|
let inserted = 0;
|
|
466
549
|
let duplicates = 0;
|
|
467
550
|
for (const event of events) {
|
|
@@ -482,6 +565,9 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
482
565
|
else
|
|
483
566
|
await this.prisma.investigationEvent.create({ data });
|
|
484
567
|
inserted++;
|
|
568
|
+
stored.push(event);
|
|
569
|
+
if (event.kind === "subagent")
|
|
570
|
+
await recordSubagent(this.prisma, investigationId, event);
|
|
485
571
|
}
|
|
486
572
|
catch (error) {
|
|
487
573
|
if (error instanceof Prisma.PrismaClientKnownRequestError &&
|
|
@@ -492,8 +578,24 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
492
578
|
throw error;
|
|
493
579
|
}
|
|
494
580
|
}
|
|
581
|
+
if (inserted > 0)
|
|
582
|
+
await this.prisma.investigation.updateMany({
|
|
583
|
+
where: { id: investigationId },
|
|
584
|
+
data: { lastActivityAt: new Date() },
|
|
585
|
+
});
|
|
586
|
+
if (stored.length)
|
|
587
|
+
for (const fn of this.appended)
|
|
588
|
+
await fn(investigationId, stored).catch((e) => this.logger.warn(`Reading stored events of ${investigationId} failed: ${e instanceof Error ? e.message : String(e)}`));
|
|
495
589
|
return { inserted, duplicates };
|
|
496
590
|
}
|
|
591
|
+
endAgentWakes(id) {
|
|
592
|
+
return endAgentWakes(this.prisma, [id]);
|
|
593
|
+
}
|
|
594
|
+
subagent(investigationId, sessionId) {
|
|
595
|
+
return this.prisma.subagentSession.findUnique({
|
|
596
|
+
where: { investigationId_sessionId: { investigationId, sessionId } },
|
|
597
|
+
});
|
|
598
|
+
}
|
|
497
599
|
async lastEventSeq(investigationId) {
|
|
498
600
|
const { _max } = await this.prisma.investigationEvent.aggregate({
|
|
499
601
|
where: { investigationId },
|
|
@@ -510,6 +612,37 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
510
612
|
}
|
|
511
613
|
return count;
|
|
512
614
|
}
|
|
615
|
+
async rememberAsk(investigationId, askId) {
|
|
616
|
+
const run = await this.prisma.investigation.findUnique({
|
|
617
|
+
where: { id: investigationId },
|
|
618
|
+
select: { scheduleId: true },
|
|
619
|
+
});
|
|
620
|
+
const scheduleId = run?.scheduleId;
|
|
621
|
+
if (!scheduleId)
|
|
622
|
+
return "unknown";
|
|
623
|
+
const ask = (await this.allEvents(investigationId)).find((e) => e.kind === "permission_ask" && e.askId === askId);
|
|
624
|
+
if (ask?.kind !== "permission_ask" || !ask.identity)
|
|
625
|
+
return "unknown";
|
|
626
|
+
const parsed = AllowedAskSchema.safeParse({
|
|
627
|
+
kind: ask.toolKind?.slice(0, 64) ?? null,
|
|
628
|
+
identity: ask.identity,
|
|
629
|
+
});
|
|
630
|
+
if (!parsed.success)
|
|
631
|
+
return "unknown";
|
|
632
|
+
const remembered = parsed.data;
|
|
633
|
+
await this.prisma.$transaction(async (tx) => {
|
|
634
|
+
const s = await tx.schedule.findUnique({
|
|
635
|
+
where: { id: scheduleId },
|
|
636
|
+
select: { alwaysAllow: true },
|
|
637
|
+
});
|
|
638
|
+
if (s)
|
|
639
|
+
await tx.schedule.update({
|
|
640
|
+
where: { id: scheduleId },
|
|
641
|
+
data: { alwaysAllow: withAsk(s.alwaysAllow, remembered) },
|
|
642
|
+
});
|
|
643
|
+
});
|
|
644
|
+
return "remembered";
|
|
645
|
+
}
|
|
513
646
|
async allEvents(investigationId) {
|
|
514
647
|
const all = [];
|
|
515
648
|
let cursor;
|
|
@@ -577,10 +710,12 @@ let InvestigationsService = InvestigationsService_1 = class InvestigationsServic
|
|
|
577
710
|
InvestigationsService = InvestigationsService_1 = __decorate([
|
|
578
711
|
Injectable(),
|
|
579
712
|
__param(1, Inject(forwardRef(() => TimelineService))),
|
|
713
|
+
__param(4, Inject(forwardRef(() => IncidentsService))),
|
|
580
714
|
__metadata("design:paramtypes", [PrismaService,
|
|
581
715
|
TimelineService,
|
|
582
716
|
OverlayService,
|
|
583
|
-
SettingsService
|
|
717
|
+
SettingsService,
|
|
718
|
+
IncidentsService])
|
|
584
719
|
], InvestigationsService);
|
|
585
720
|
export { InvestigationsService };
|
|
586
721
|
//# sourceMappingURL=investigations.service.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function meetsPromotionRule(report) {
|
|
2
|
+
return (report?.hypotheses ?? []).some((h) => (h.status === "confirmed" || h.status === "supported") &&
|
|
3
|
+
h.evidence.some((e) => e.status === "verified" && e.direction === "supports"));
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=promotion.js.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export function threadSubject(run) {
|
|
2
|
+
if (run.incidentId)
|
|
3
|
+
return "incident";
|
|
4
|
+
if (run.scheduleId)
|
|
5
|
+
return "schedule";
|
|
6
|
+
if (run.repositoryId)
|
|
7
|
+
return "project";
|
|
8
|
+
if (run.serviceId)
|
|
9
|
+
return "service";
|
|
10
|
+
return "none";
|
|
11
|
+
}
|
|
12
|
+
export function runScope(run) {
|
|
13
|
+
if (run.incidentId)
|
|
14
|
+
return { incidentId: run.incidentId };
|
|
15
|
+
if (run.scheduleId)
|
|
16
|
+
return { scheduleId: run.scheduleId };
|
|
17
|
+
if (run.id)
|
|
18
|
+
return { id: run.id };
|
|
19
|
+
throw new Error("A run with no incident or schedule is scoped by its own id");
|
|
20
|
+
}
|
|
21
|
+
export function sharesAdmission(run) {
|
|
22
|
+
return !!run.incidentId || !!run.scheduleId;
|
|
23
|
+
}
|
|
24
|
+
export function runScopeKey(run) {
|
|
25
|
+
if (run.incidentId)
|
|
26
|
+
return run.incidentId;
|
|
27
|
+
if (run.scheduleId)
|
|
28
|
+
return `schedule:${run.scheduleId}`;
|
|
29
|
+
return `run:${run.id ?? ""}`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=run-scope.js.map
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { CommitShaSchema, isSafeRepoPath, RUN_DIFF_MAX_BYTES, RUN_TREE_MAX_ENTRIES, RUN_TREE_MAX_FILES, } from "@prismalens/contracts";
|
|
2
|
+
import { gitEnv } from "../../core/harness/git-env.js";
|
|
3
|
+
import { GIT_PROBE_TIMEOUT_MS, spawnGit, } from "../../core/harness/git-spawn.js";
|
|
4
|
+
import { EvidenceRequestRefused, objectDirFor } from "./evidence-blob.js";
|
|
5
|
+
const READ_TIMEOUT_MS = 30_000;
|
|
6
|
+
const NULL_FILE = "/dev/null";
|
|
7
|
+
const LOCKED = [
|
|
8
|
+
"-c",
|
|
9
|
+
"diff.external=",
|
|
10
|
+
"-c",
|
|
11
|
+
"diff.submodule=short",
|
|
12
|
+
"-c",
|
|
13
|
+
`core.attributesFile=${NULL_FILE}`,
|
|
14
|
+
"-c",
|
|
15
|
+
"core.quotePath=false",
|
|
16
|
+
"--no-replace-objects",
|
|
17
|
+
];
|
|
18
|
+
function gitIn(args, cwd, timeoutMs = READ_TIMEOUT_MS, signal) {
|
|
19
|
+
return spawnGit([...LOCKED, ...args], {
|
|
20
|
+
cwd,
|
|
21
|
+
timeoutMs,
|
|
22
|
+
...(signal ? { signal } : {}),
|
|
23
|
+
env: {
|
|
24
|
+
...gitEnv({ source: "none" }),
|
|
25
|
+
GIT_CONFIG_NOSYSTEM: "1",
|
|
26
|
+
GIT_CONFIG_GLOBAL: NULL_FILE,
|
|
27
|
+
GIT_LITERAL_PATHSPECS: "1",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
const git = (args, cwd, timeoutMs = READ_TIMEOUT_MS) => gitIn(args, cwd, timeoutMs);
|
|
32
|
+
async function usable(dir) {
|
|
33
|
+
if (!dir)
|
|
34
|
+
return null;
|
|
35
|
+
try {
|
|
36
|
+
await git(["rev-parse", "--git-dir"], dir, GIT_PROBE_TIMEOUT_MS);
|
|
37
|
+
return dir;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function hasCommit(dir, sha) {
|
|
44
|
+
try {
|
|
45
|
+
await git(["cat-file", "-e", `${sha}^{commit}`], dir);
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const TYPE = {
|
|
53
|
+
tree: "dir",
|
|
54
|
+
commit: "submodule",
|
|
55
|
+
};
|
|
56
|
+
export async function readRunTree(workspace, sha, prefix, opts = {}) {
|
|
57
|
+
if (!CommitShaSchema.safeParse(sha).success ||
|
|
58
|
+
(prefix !== undefined && !isSafeRepoPath(prefix)))
|
|
59
|
+
throw new EvidenceRequestRefused("Not a commit and path this run can read");
|
|
60
|
+
const repo = workspace?.repos.find((r) => r.head === sha);
|
|
61
|
+
if (!repo)
|
|
62
|
+
throw new EvidenceRequestRefused("This run did not record that commit");
|
|
63
|
+
const at = { repo: repo.name, sha, prefix: prefix ?? null };
|
|
64
|
+
const dir = await usable(objectDirFor(repo, opts.mirrorRoot));
|
|
65
|
+
if (!dir)
|
|
66
|
+
return { state: "unavailable", ...at, reason: "source-removed" };
|
|
67
|
+
if (!(await hasCommit(dir, sha)))
|
|
68
|
+
return { state: "unavailable", ...at, reason: "commit-gone" };
|
|
69
|
+
if (prefix !== undefined) {
|
|
70
|
+
const { stdout } = await git(["ls-tree", "-z", "--full-tree", sha, "--", prefix], dir);
|
|
71
|
+
const self = stdout
|
|
72
|
+
.split("\0")
|
|
73
|
+
.map((l) => /^\d{6} (\w+) [0-9a-f]+\t([\s\S]*)$/.exec(l))
|
|
74
|
+
.find((m) => m?.[2] === prefix);
|
|
75
|
+
if (self?.[1] !== "tree")
|
|
76
|
+
return { state: "unavailable", ...at, reason: "not-a-dir" };
|
|
77
|
+
}
|
|
78
|
+
if (!opts.recursive) {
|
|
79
|
+
const entries = await listLevel(dir, sha, prefix, false);
|
|
80
|
+
const sorted = [
|
|
81
|
+
...entries.filter((e) => e.type === "dir"),
|
|
82
|
+
...entries.filter((e) => e.type !== "dir"),
|
|
83
|
+
];
|
|
84
|
+
return {
|
|
85
|
+
state: "ok",
|
|
86
|
+
...at,
|
|
87
|
+
entries: sorted.slice(0, RUN_TREE_MAX_ENTRIES),
|
|
88
|
+
truncated: sorted.length > RUN_TREE_MAX_ENTRIES,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const files = [];
|
|
92
|
+
let truncated = false;
|
|
93
|
+
for (const e of await listLevel(dir, sha, prefix, false)) {
|
|
94
|
+
if (files.length >= RUN_TREE_MAX_FILES) {
|
|
95
|
+
truncated = true;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (e.type !== "dir") {
|
|
99
|
+
files.push(e);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
files.push(...(await listLevel(dir, sha, e.path, true)));
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
truncated = true;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
state: "ok",
|
|
112
|
+
...at,
|
|
113
|
+
entries: files.slice(0, RUN_TREE_MAX_FILES),
|
|
114
|
+
truncated: truncated || files.length > RUN_TREE_MAX_FILES,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
async function listLevel(dir, sha, prefix, recursive) {
|
|
118
|
+
const { stdout } = await git([
|
|
119
|
+
"ls-tree",
|
|
120
|
+
"-z",
|
|
121
|
+
"--full-tree",
|
|
122
|
+
...(recursive ? ["-r"] : []),
|
|
123
|
+
sha,
|
|
124
|
+
"--",
|
|
125
|
+
...(prefix ? [`${prefix}/`] : []),
|
|
126
|
+
], dir);
|
|
127
|
+
const entries = [];
|
|
128
|
+
for (const line of stdout.split("\0")) {
|
|
129
|
+
const m = /^(\d{6}) (\w+) [0-9a-f]+\t([\s\S]*)$/.exec(line);
|
|
130
|
+
if (!m)
|
|
131
|
+
continue;
|
|
132
|
+
const [, mode, type, path] = m;
|
|
133
|
+
entries.push({
|
|
134
|
+
name: path.slice(path.lastIndexOf("/") + 1),
|
|
135
|
+
path,
|
|
136
|
+
type: TYPE[type] ?? (mode === "120000" ? "symlink" : "file"),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return entries;
|
|
140
|
+
}
|
|
141
|
+
async function isAncestor(git, a, b) {
|
|
142
|
+
try {
|
|
143
|
+
await git(["merge-base", "--is-ancestor", a, b]);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
async function fullCommitId(git, recorded) {
|
|
151
|
+
if (!/^[0-9a-f]{4,64}$/i.test(recorded))
|
|
152
|
+
return null;
|
|
153
|
+
try {
|
|
154
|
+
const { stdout } = await git([
|
|
155
|
+
"rev-parse",
|
|
156
|
+
"--verify",
|
|
157
|
+
"--quiet",
|
|
158
|
+
`${recorded.toLowerCase()}^{commit}`,
|
|
159
|
+
]);
|
|
160
|
+
const sha = stdout.trim();
|
|
161
|
+
return CommitShaSchema.safeParse(sha).success ? sha : null;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async function tagAt(git, sha) {
|
|
168
|
+
const { stdout } = await git([
|
|
169
|
+
"tag",
|
|
170
|
+
"--points-at",
|
|
171
|
+
sha,
|
|
172
|
+
"--sort=-creatordate",
|
|
173
|
+
]);
|
|
174
|
+
return stdout.split("\n").find(Boolean) ?? null;
|
|
175
|
+
}
|
|
176
|
+
async function kindOf(git, sha) {
|
|
177
|
+
const { stdout } = await git(["rev-list", "--parents", "-n", "1", sha]);
|
|
178
|
+
return stdout.trim().split(" ").length > 2 ? "merge" : "commit";
|
|
179
|
+
}
|
|
180
|
+
export async function compareFor(dir, repo, head, deployments, signal) {
|
|
181
|
+
try {
|
|
182
|
+
return await pairFor(dir, repo, head, deployments, signal);
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
if (signal?.aborted)
|
|
186
|
+
return null;
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async function pairFor(dir, repo, head, deployments, signal) {
|
|
191
|
+
signal?.throwIfAborted();
|
|
192
|
+
const git = (args) => gitIn(args, dir, READ_TIMEOUT_MS, signal);
|
|
193
|
+
const between = async (base, tip) => Number((await git(["rev-list", "--count", `${base}..${tip}`])).stdout.trim());
|
|
194
|
+
const known = [];
|
|
195
|
+
for (const recorded of deployments) {
|
|
196
|
+
const sha = await fullCommitId(git, recorded.sha);
|
|
197
|
+
if (!sha || known.some((k) => k.sha === sha))
|
|
198
|
+
continue;
|
|
199
|
+
if (await isAncestor(git, sha, known[0]?.sha ?? head))
|
|
200
|
+
known.push({ sha, name: recorded.name });
|
|
201
|
+
if (known.length === 2)
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
const [tip, prev] = known;
|
|
205
|
+
if (tip && prev && tip.sha !== prev.sha)
|
|
206
|
+
return {
|
|
207
|
+
repo,
|
|
208
|
+
head: tip.sha,
|
|
209
|
+
headKind: "deployment",
|
|
210
|
+
headName: tip.name,
|
|
211
|
+
base: prev.sha,
|
|
212
|
+
baseKind: "deployment",
|
|
213
|
+
baseName: prev.name,
|
|
214
|
+
between: await between(prev.sha, tip.sha),
|
|
215
|
+
};
|
|
216
|
+
const tag = await tagAt(git, head);
|
|
217
|
+
if (tag) {
|
|
218
|
+
try {
|
|
219
|
+
const { stdout } = await git([
|
|
220
|
+
"describe",
|
|
221
|
+
"--tags",
|
|
222
|
+
"--abbrev=0",
|
|
223
|
+
`${head}^`,
|
|
224
|
+
]);
|
|
225
|
+
const prevTag = stdout.trim();
|
|
226
|
+
const base = (await git(["rev-list", "-n", "1", `refs/tags/${prevTag}`])).stdout.trim();
|
|
227
|
+
if (CommitShaSchema.safeParse(base).success)
|
|
228
|
+
return {
|
|
229
|
+
repo,
|
|
230
|
+
head,
|
|
231
|
+
headKind: "tag",
|
|
232
|
+
headName: tag,
|
|
233
|
+
base,
|
|
234
|
+
baseKind: "tag",
|
|
235
|
+
baseName: prevTag,
|
|
236
|
+
between: await between(base, head),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
let parent;
|
|
243
|
+
try {
|
|
244
|
+
parent = (await git(["rev-parse", "--verify", `${head}^1`])).stdout.trim();
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return null;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
repo,
|
|
251
|
+
head,
|
|
252
|
+
headKind: tag ? "tag" : await kindOf(git, head),
|
|
253
|
+
headName: tag,
|
|
254
|
+
base: parent,
|
|
255
|
+
baseKind: await kindOf(git, parent),
|
|
256
|
+
baseName: null,
|
|
257
|
+
between: 1,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
function numstat(out) {
|
|
261
|
+
const parts = out.split("\0");
|
|
262
|
+
const files = [];
|
|
263
|
+
for (let i = 0; i < parts.length; i++) {
|
|
264
|
+
const m = /^(\d+|-)\t(\d+|-)\t([\s\S]*)$/.exec(parts[i] ?? "");
|
|
265
|
+
if (!m)
|
|
266
|
+
continue;
|
|
267
|
+
const [, a, d, path] = m;
|
|
268
|
+
const counts = {
|
|
269
|
+
additions: a === "-" ? null : Number(a),
|
|
270
|
+
deletions: d === "-" ? null : Number(d),
|
|
271
|
+
};
|
|
272
|
+
if (path === "") {
|
|
273
|
+
const oldPath = parts[++i] ?? "";
|
|
274
|
+
const newPath = parts[++i] ?? "";
|
|
275
|
+
files.push({ path: newPath, oldPath, ...counts });
|
|
276
|
+
}
|
|
277
|
+
else
|
|
278
|
+
files.push({ path, oldPath: null, ...counts });
|
|
279
|
+
}
|
|
280
|
+
return files;
|
|
281
|
+
}
|
|
282
|
+
export async function readRunDiff(workspace, pair, path, opts = {}) {
|
|
283
|
+
if (path !== undefined && !isSafeRepoPath(path))
|
|
284
|
+
throw new EvidenceRequestRefused("Not a path this run can read");
|
|
285
|
+
const comparison = workspace?.compare?.[pair];
|
|
286
|
+
const repo = comparison
|
|
287
|
+
? workspace?.repos.find((r) => r.name === comparison.repo)
|
|
288
|
+
: undefined;
|
|
289
|
+
if (!comparison || !repo)
|
|
290
|
+
throw new EvidenceRequestRefused("This run recorded no such comparison");
|
|
291
|
+
const dir = await usable(objectDirFor(repo, opts.mirrorRoot));
|
|
292
|
+
if (!dir)
|
|
293
|
+
return { state: "unavailable", comparison, reason: "source-removed" };
|
|
294
|
+
if (!(await hasCommit(dir, comparison.base)) ||
|
|
295
|
+
!(await hasCommit(dir, comparison.head)))
|
|
296
|
+
return { state: "unavailable", comparison, reason: "commit-gone" };
|
|
297
|
+
const range = [
|
|
298
|
+
"--src-prefix=a/",
|
|
299
|
+
"--dst-prefix=b/",
|
|
300
|
+
"--no-ext-diff",
|
|
301
|
+
"--no-textconv",
|
|
302
|
+
"--submodule=short",
|
|
303
|
+
"--no-color",
|
|
304
|
+
"-M",
|
|
305
|
+
comparison.base,
|
|
306
|
+
comparison.head,
|
|
307
|
+
"--",
|
|
308
|
+
...(path ? [path] : []),
|
|
309
|
+
];
|
|
310
|
+
const files = numstat((await git(["diff", "--numstat", "-z", ...range], dir)).stdout);
|
|
311
|
+
try {
|
|
312
|
+
const { stdout } = await git(["diff", ...range], dir);
|
|
313
|
+
if (Buffer.byteLength(stdout) > RUN_DIFF_MAX_BYTES)
|
|
314
|
+
return {
|
|
315
|
+
state: "ok",
|
|
316
|
+
comparison,
|
|
317
|
+
files,
|
|
318
|
+
patch: null,
|
|
319
|
+
omitted: "too-large",
|
|
320
|
+
};
|
|
321
|
+
return { state: "ok", comparison, files, patch: stdout, omitted: null };
|
|
322
|
+
}
|
|
323
|
+
catch {
|
|
324
|
+
return {
|
|
325
|
+
state: "ok",
|
|
326
|
+
comparison,
|
|
327
|
+
files,
|
|
328
|
+
patch: null,
|
|
329
|
+
omitted: "too-large",
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
//# sourceMappingURL=run-views.js.map
|