@vigil-guard/vge-cc-guard 0.9.0-beta.1
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/LICENSE.md +37 -0
- package/README.md +441 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +61 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/_lib/install-paths.d.ts +16 -0
- package/dist/commands/_lib/install-paths.d.ts.map +1 -0
- package/dist/commands/_lib/install-paths.js +46 -0
- package/dist/commands/_lib/install-paths.js.map +1 -0
- package/dist/commands/_lib/parse-install-flags.d.ts +8 -0
- package/dist/commands/_lib/parse-install-flags.d.ts.map +1 -0
- package/dist/commands/_lib/parse-install-flags.js +15 -0
- package/dist/commands/_lib/parse-install-flags.js.map +1 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +41 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/daemon.d.ts +2 -0
- package/dist/commands/daemon.d.ts.map +1 -0
- package/dist/commands/daemon.js +116 -0
- package/dist/commands/daemon.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +53 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/install-wizard.d.ts +2 -0
- package/dist/commands/install-wizard.d.ts.map +1 -0
- package/dist/commands/install-wizard.js +85 -0
- package/dist/commands/install-wizard.js.map +1 -0
- package/dist/commands/install.d.ts +15 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +136 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/reset-session.d.ts +2 -0
- package/dist/commands/reset-session.d.ts.map +1 -0
- package/dist/commands/reset-session.js +113 -0
- package/dist/commands/reset-session.js.map +1 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.d.ts.map +1 -0
- package/dist/commands/uninstall.js +277 -0
- package/dist/commands/uninstall.js.map +1 -0
- package/dist/daemon/active-conversation-decisions.d.ts +9 -0
- package/dist/daemon/active-conversation-decisions.d.ts.map +1 -0
- package/dist/daemon/active-conversation-decisions.js +58 -0
- package/dist/daemon/active-conversation-decisions.js.map +1 -0
- package/dist/daemon/allowlist.d.ts +2 -0
- package/dist/daemon/allowlist.d.ts.map +1 -0
- package/dist/daemon/allowlist.js +118 -0
- package/dist/daemon/allowlist.js.map +1 -0
- package/dist/daemon/analysis-source.d.ts +17 -0
- package/dist/daemon/analysis-source.d.ts.map +1 -0
- package/dist/daemon/analysis-source.js +114 -0
- package/dist/daemon/analysis-source.js.map +1 -0
- package/dist/daemon/ask-dialog.d.ts +23 -0
- package/dist/daemon/ask-dialog.d.ts.map +1 -0
- package/dist/daemon/ask-dialog.js +114 -0
- package/dist/daemon/ask-dialog.js.map +1 -0
- package/dist/daemon/attachment-decision-escrow.d.ts +27 -0
- package/dist/daemon/attachment-decision-escrow.d.ts.map +1 -0
- package/dist/daemon/attachment-decision-escrow.js +34 -0
- package/dist/daemon/attachment-decision-escrow.js.map +1 -0
- package/dist/daemon/attachment-input-enforcement.d.ts +11 -0
- package/dist/daemon/attachment-input-enforcement.d.ts.map +1 -0
- package/dist/daemon/attachment-input-enforcement.js +434 -0
- package/dist/daemon/attachment-input-enforcement.js.map +1 -0
- package/dist/daemon/audit-decisions.d.ts +51 -0
- package/dist/daemon/audit-decisions.d.ts.map +1 -0
- package/dist/daemon/audit-decisions.js +178 -0
- package/dist/daemon/audit-decisions.js.map +1 -0
- package/dist/daemon/audit-logger.d.ts +6 -0
- package/dist/daemon/audit-logger.d.ts.map +1 -0
- package/dist/daemon/audit-logger.js +6 -0
- package/dist/daemon/audit-logger.js.map +1 -0
- package/dist/daemon/audit-posttool.d.ts +123 -0
- package/dist/daemon/audit-posttool.d.ts.map +1 -0
- package/dist/daemon/audit-posttool.js +173 -0
- package/dist/daemon/audit-posttool.js.map +1 -0
- package/dist/daemon/audit-pretool.d.ts +56 -0
- package/dist/daemon/audit-pretool.d.ts.map +1 -0
- package/dist/daemon/audit-pretool.js +77 -0
- package/dist/daemon/audit-pretool.js.map +1 -0
- package/dist/daemon/audit-userprompt.d.ts +113 -0
- package/dist/daemon/audit-userprompt.d.ts.map +1 -0
- package/dist/daemon/audit-userprompt.js +162 -0
- package/dist/daemon/audit-userprompt.js.map +1 -0
- package/dist/daemon/blocking-decision-triggers.d.ts +5 -0
- package/dist/daemon/blocking-decision-triggers.d.ts.map +1 -0
- package/dist/daemon/blocking-decision-triggers.js +40 -0
- package/dist/daemon/blocking-decision-triggers.js.map +1 -0
- package/dist/daemon/cc-contract-auto-probe.d.ts +40 -0
- package/dist/daemon/cc-contract-auto-probe.d.ts.map +1 -0
- package/dist/daemon/cc-contract-auto-probe.js +101 -0
- package/dist/daemon/cc-contract-auto-probe.js.map +1 -0
- package/dist/daemon/cc-contract-probe.d.ts +46 -0
- package/dist/daemon/cc-contract-probe.d.ts.map +1 -0
- package/dist/daemon/cc-contract-probe.js +138 -0
- package/dist/daemon/cc-contract-probe.js.map +1 -0
- package/dist/daemon/cc-contract-runtime.d.ts +8 -0
- package/dist/daemon/cc-contract-runtime.d.ts.map +1 -0
- package/dist/daemon/cc-contract-runtime.js +42 -0
- package/dist/daemon/cc-contract-runtime.js.map +1 -0
- package/dist/daemon/cc-contract-status.d.ts +40 -0
- package/dist/daemon/cc-contract-status.d.ts.map +1 -0
- package/dist/daemon/cc-contract-status.js +242 -0
- package/dist/daemon/cc-contract-status.js.map +1 -0
- package/dist/daemon/confidence-router.d.ts +3 -0
- package/dist/daemon/confidence-router.d.ts.map +1 -0
- package/dist/daemon/confidence-router.js +34 -0
- package/dist/daemon/confidence-router.js.map +1 -0
- package/dist/daemon/conversation-context.d.ts +28 -0
- package/dist/daemon/conversation-context.d.ts.map +1 -0
- package/dist/daemon/conversation-context.js +271 -0
- package/dist/daemon/conversation-context.js.map +1 -0
- package/dist/daemon/conversation-decision-cleanup.d.ts +2 -0
- package/dist/daemon/conversation-decision-cleanup.d.ts.map +1 -0
- package/dist/daemon/conversation-decision-cleanup.js +22 -0
- package/dist/daemon/conversation-decision-cleanup.js.map +1 -0
- package/dist/daemon/conversation-decision-escrow.d.ts +20 -0
- package/dist/daemon/conversation-decision-escrow.d.ts.map +1 -0
- package/dist/daemon/conversation-decision-escrow.js +78 -0
- package/dist/daemon/conversation-decision-escrow.js.map +1 -0
- package/dist/daemon/conversation-decision-prompt.d.ts +30 -0
- package/dist/daemon/conversation-decision-prompt.d.ts.map +1 -0
- package/dist/daemon/conversation-decision-prompt.js +250 -0
- package/dist/daemon/conversation-decision-prompt.js.map +1 -0
- package/dist/daemon/daemon-instance.d.ts +27 -0
- package/dist/daemon/daemon-instance.d.ts.map +1 -0
- package/dist/daemon/daemon-instance.js +41 -0
- package/dist/daemon/daemon-instance.js.map +1 -0
- package/dist/daemon/daemon-ipc.d.ts +29 -0
- package/dist/daemon/daemon-ipc.d.ts.map +1 -0
- package/dist/daemon/daemon-ipc.js +82 -0
- package/dist/daemon/daemon-ipc.js.map +1 -0
- package/dist/daemon/daemon-supersede.d.ts +3 -0
- package/dist/daemon/daemon-supersede.d.ts.map +1 -0
- package/dist/daemon/daemon-supersede.js +126 -0
- package/dist/daemon/daemon-supersede.js.map +1 -0
- package/dist/daemon/debug-logger.d.ts +5 -0
- package/dist/daemon/debug-logger.d.ts.map +1 -0
- package/dist/daemon/debug-logger.js +247 -0
- package/dist/daemon/debug-logger.js.map +1 -0
- package/dist/daemon/decision-broker.d.ts +58 -0
- package/dist/daemon/decision-broker.d.ts.map +1 -0
- package/dist/daemon/decision-broker.js +340 -0
- package/dist/daemon/decision-broker.js.map +1 -0
- package/dist/daemon/decision-metrics.d.ts +40 -0
- package/dist/daemon/decision-metrics.d.ts.map +1 -0
- package/dist/daemon/decision-metrics.js +116 -0
- package/dist/daemon/decision-metrics.js.map +1 -0
- package/dist/daemon/decision-owner.d.ts +10 -0
- package/dist/daemon/decision-owner.d.ts.map +1 -0
- package/dist/daemon/decision-owner.js +30 -0
- package/dist/daemon/decision-owner.js.map +1 -0
- package/dist/daemon/decision-routes.d.ts +7 -0
- package/dist/daemon/decision-routes.d.ts.map +1 -0
- package/dist/daemon/decision-routes.js +104 -0
- package/dist/daemon/decision-routes.js.map +1 -0
- package/dist/daemon/decision-timeout.d.ts +3 -0
- package/dist/daemon/decision-timeout.d.ts.map +1 -0
- package/dist/daemon/decision-timeout.js +5 -0
- package/dist/daemon/decision-timeout.js.map +1 -0
- package/dist/daemon/decision-transition.d.ts +12 -0
- package/dist/daemon/decision-transition.d.ts.map +1 -0
- package/dist/daemon/decision-transition.js +8 -0
- package/dist/daemon/decision-transition.js.map +1 -0
- package/dist/daemon/http-server.d.ts +4 -0
- package/dist/daemon/http-server.d.ts.map +1 -0
- package/dist/daemon/http-server.js +535 -0
- package/dist/daemon/http-server.js.map +1 -0
- package/dist/daemon/id-validation.d.ts +2 -0
- package/dist/daemon/id-validation.d.ts.map +1 -0
- package/dist/daemon/id-validation.js +5 -0
- package/dist/daemon/id-validation.js.map +1 -0
- package/dist/daemon/path-deny.d.ts +14 -0
- package/dist/daemon/path-deny.d.ts.map +1 -0
- package/dist/daemon/path-deny.js +88 -0
- package/dist/daemon/path-deny.js.map +1 -0
- package/dist/daemon/posttool-decision-escrow.d.ts +42 -0
- package/dist/daemon/posttool-decision-escrow.d.ts.map +1 -0
- package/dist/daemon/posttool-decision-escrow.js +349 -0
- package/dist/daemon/posttool-decision-escrow.js.map +1 -0
- package/dist/daemon/posttool-decision-state.d.ts +65 -0
- package/dist/daemon/posttool-decision-state.d.ts.map +1 -0
- package/dist/daemon/posttool-decision-state.js +223 -0
- package/dist/daemon/posttool-decision-state.js.map +1 -0
- package/dist/daemon/posttool-enforcement.d.ts +7 -0
- package/dist/daemon/posttool-enforcement.d.ts.map +1 -0
- package/dist/daemon/posttool-enforcement.js +511 -0
- package/dist/daemon/posttool-enforcement.js.map +1 -0
- package/dist/daemon/posttool-render.d.ts +48 -0
- package/dist/daemon/posttool-render.d.ts.map +1 -0
- package/dist/daemon/posttool-render.js +335 -0
- package/dist/daemon/posttool-render.js.map +1 -0
- package/dist/daemon/pretool-decision-escrow.d.ts +51 -0
- package/dist/daemon/pretool-decision-escrow.d.ts.map +1 -0
- package/dist/daemon/pretool-decision-escrow.js +295 -0
- package/dist/daemon/pretool-decision-escrow.js.map +1 -0
- package/dist/daemon/pretool-url-gate.d.ts +17 -0
- package/dist/daemon/pretool-url-gate.d.ts.map +1 -0
- package/dist/daemon/pretool-url-gate.js +60 -0
- package/dist/daemon/pretool-url-gate.js.map +1 -0
- package/dist/daemon/prompt-input-enforcement.d.ts +18 -0
- package/dist/daemon/prompt-input-enforcement.d.ts.map +1 -0
- package/dist/daemon/prompt-input-enforcement.js +248 -0
- package/dist/daemon/prompt-input-enforcement.js.map +1 -0
- package/dist/daemon/reply-parser.d.ts +10 -0
- package/dist/daemon/reply-parser.d.ts.map +1 -0
- package/dist/daemon/reply-parser.js +81 -0
- package/dist/daemon/reply-parser.js.map +1 -0
- package/dist/daemon/resolve-escalation-route.d.ts +5 -0
- package/dist/daemon/resolve-escalation-route.d.ts.map +1 -0
- package/dist/daemon/resolve-escalation-route.js +85 -0
- package/dist/daemon/resolve-escalation-route.js.map +1 -0
- package/dist/daemon/response-cache.d.ts +14 -0
- package/dist/daemon/response-cache.d.ts.map +1 -0
- package/dist/daemon/response-cache.js +38 -0
- package/dist/daemon/response-cache.js.map +1 -0
- package/dist/daemon/security-frame.d.ts +14 -0
- package/dist/daemon/security-frame.d.ts.map +1 -0
- package/dist/daemon/security-frame.js +96 -0
- package/dist/daemon/security-frame.js.map +1 -0
- package/dist/daemon/session-hook-routes.d.ts +3 -0
- package/dist/daemon/session-hook-routes.d.ts.map +1 -0
- package/dist/daemon/session-hook-routes.js +66 -0
- package/dist/daemon/session-hook-routes.js.map +1 -0
- package/dist/daemon/session-state.d.ts +52 -0
- package/dist/daemon/session-state.d.ts.map +1 -0
- package/dist/daemon/session-state.js +495 -0
- package/dist/daemon/session-state.js.map +1 -0
- package/dist/daemon/subagent-lifecycle.d.ts +8 -0
- package/dist/daemon/subagent-lifecycle.d.ts.map +1 -0
- package/dist/daemon/subagent-lifecycle.js +56 -0
- package/dist/daemon/subagent-lifecycle.js.map +1 -0
- package/dist/daemon/tool-output-redactor.d.ts +13 -0
- package/dist/daemon/tool-output-redactor.d.ts.map +1 -0
- package/dist/daemon/tool-output-redactor.js +82 -0
- package/dist/daemon/tool-output-redactor.js.map +1 -0
- package/dist/daemon/tool-policy.d.ts +16 -0
- package/dist/daemon/tool-policy.d.ts.map +1 -0
- package/dist/daemon/tool-policy.js +60 -0
- package/dist/daemon/tool-policy.js.map +1 -0
- package/dist/daemon/tool-response-normalizer.d.ts +11 -0
- package/dist/daemon/tool-response-normalizer.d.ts.map +1 -0
- package/dist/daemon/tool-response-normalizer.js +67 -0
- package/dist/daemon/tool-response-normalizer.js.map +1 -0
- package/dist/daemon/truncate.d.ts +3 -0
- package/dist/daemon/truncate.d.ts.map +1 -0
- package/dist/daemon/truncate.js +22 -0
- package/dist/daemon/truncate.js.map +1 -0
- package/dist/daemon/url-access-baseline.d.ts +46 -0
- package/dist/daemon/url-access-baseline.d.ts.map +1 -0
- package/dist/daemon/url-access-baseline.js +154 -0
- package/dist/daemon/url-access-baseline.js.map +1 -0
- package/dist/daemon/url-block-decisions.d.ts +27 -0
- package/dist/daemon/url-block-decisions.d.ts.map +1 -0
- package/dist/daemon/url-block-decisions.js +100 -0
- package/dist/daemon/url-block-decisions.js.map +1 -0
- package/dist/daemon/url-extractor.d.ts +7 -0
- package/dist/daemon/url-extractor.d.ts.map +1 -0
- package/dist/daemon/url-extractor.js +101 -0
- package/dist/daemon/url-extractor.js.map +1 -0
- package/dist/daemon/userprompt-decision-escrow.d.ts +45 -0
- package/dist/daemon/userprompt-decision-escrow.d.ts.map +1 -0
- package/dist/daemon/userprompt-decision-escrow.js +248 -0
- package/dist/daemon/userprompt-decision-escrow.js.map +1 -0
- package/dist/daemon/vge-client.d.ts +64 -0
- package/dist/daemon/vge-client.d.ts.map +1 -0
- package/dist/daemon/vge-client.js +453 -0
- package/dist/daemon/vge-client.js.map +1 -0
- package/dist/daemon/vge-connectivity.d.ts +27 -0
- package/dist/daemon/vge-connectivity.d.ts.map +1 -0
- package/dist/daemon/vge-connectivity.js +214 -0
- package/dist/daemon/vge-connectivity.js.map +1 -0
- package/dist/daemon/vge-health-route.d.ts +4 -0
- package/dist/daemon/vge-health-route.d.ts.map +1 -0
- package/dist/daemon/vge-health-route.js +107 -0
- package/dist/daemon/vge-health-route.js.map +1 -0
- package/dist/daemon/vge-overload-backpressure.d.ts +51 -0
- package/dist/daemon/vge-overload-backpressure.d.ts.map +1 -0
- package/dist/daemon/vge-overload-backpressure.js +79 -0
- package/dist/daemon/vge-overload-backpressure.js.map +1 -0
- package/dist/daemon/vge-scan-failure-policy.d.ts +8 -0
- package/dist/daemon/vge-scan-failure-policy.d.ts.map +1 -0
- package/dist/daemon/vge-scan-failure-policy.js +12 -0
- package/dist/daemon/vge-scan-failure-policy.js.map +1 -0
- package/dist/shared/audit-writer.d.ts +9 -0
- package/dist/shared/audit-writer.d.ts.map +1 -0
- package/dist/shared/audit-writer.js +72 -0
- package/dist/shared/audit-writer.js.map +1 -0
- package/dist/shared/blocking-decision-choices.d.ts +13 -0
- package/dist/shared/blocking-decision-choices.d.ts.map +1 -0
- package/dist/shared/blocking-decision-choices.js +40 -0
- package/dist/shared/blocking-decision-choices.js.map +1 -0
- package/dist/shared/blocking-decision-reply.d.ts +13 -0
- package/dist/shared/blocking-decision-reply.d.ts.map +1 -0
- package/dist/shared/blocking-decision-reply.js +78 -0
- package/dist/shared/blocking-decision-reply.js.map +1 -0
- package/dist/shared/build-stamp.d.ts +7 -0
- package/dist/shared/build-stamp.d.ts.map +1 -0
- package/dist/shared/build-stamp.js +23 -0
- package/dist/shared/build-stamp.js.map +1 -0
- package/dist/shared/config-io.d.ts +41 -0
- package/dist/shared/config-io.d.ts.map +1 -0
- package/dist/shared/config-io.js +105 -0
- package/dist/shared/config-io.js.map +1 -0
- package/dist/shared/config-schema.d.ts +467 -0
- package/dist/shared/config-schema.d.ts.map +1 -0
- package/dist/shared/config-schema.js +281 -0
- package/dist/shared/config-schema.js.map +1 -0
- package/dist/shared/daemon-token.d.ts +7 -0
- package/dist/shared/daemon-token.d.ts.map +1 -0
- package/dist/shared/daemon-token.js +45 -0
- package/dist/shared/daemon-token.js.map +1 -0
- package/dist/shared/detect-os-user.d.ts +8 -0
- package/dist/shared/detect-os-user.d.ts.map +1 -0
- package/dist/shared/detect-os-user.js +34 -0
- package/dist/shared/detect-os-user.js.map +1 -0
- package/dist/shared/effective-client-id.d.ts +6 -0
- package/dist/shared/effective-client-id.d.ts.map +1 -0
- package/dist/shared/effective-client-id.js +22 -0
- package/dist/shared/effective-client-id.js.map +1 -0
- package/dist/shared/ipc-address.d.ts +10 -0
- package/dist/shared/ipc-address.d.ts.map +1 -0
- package/dist/shared/ipc-address.js +33 -0
- package/dist/shared/ipc-address.js.map +1 -0
- package/dist/shared/ipc-protocol.d.ts +60 -0
- package/dist/shared/ipc-protocol.d.ts.map +1 -0
- package/dist/shared/ipc-protocol.js +2 -0
- package/dist/shared/ipc-protocol.js.map +1 -0
- package/dist/shared/path-match.d.ts +4 -0
- package/dist/shared/path-match.d.ts.map +1 -0
- package/dist/shared/path-match.js +15 -0
- package/dist/shared/path-match.js.map +1 -0
- package/dist/shared/private-file.d.ts +17 -0
- package/dist/shared/private-file.d.ts.map +1 -0
- package/dist/shared/private-file.js +144 -0
- package/dist/shared/private-file.js.map +1 -0
- package/dist/shared/runtime-lock.d.ts +30 -0
- package/dist/shared/runtime-lock.d.ts.map +1 -0
- package/dist/shared/runtime-lock.js +142 -0
- package/dist/shared/runtime-lock.js.map +1 -0
- package/dist/shared/system-ca.d.ts +2 -0
- package/dist/shared/system-ca.d.ts.map +1 -0
- package/dist/shared/system-ca.js +31 -0
- package/dist/shared/system-ca.js.map +1 -0
- package/dist/shared/types.d.ts +172 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +2 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/shared/url-allowlist.d.ts +4 -0
- package/dist/shared/url-allowlist.d.ts.map +1 -0
- package/dist/shared/url-allowlist.js +33 -0
- package/dist/shared/url-allowlist.js.map +1 -0
- package/dist/shared/url-patterns.d.ts +12 -0
- package/dist/shared/url-patterns.d.ts.map +1 -0
- package/dist/shared/url-patterns.js +165 -0
- package/dist/shared/url-patterns.js.map +1 -0
- package/dist/shared/vge-url.d.ts +16 -0
- package/dist/shared/vge-url.d.ts.map +1 -0
- package/dist/shared/vge-url.js +75 -0
- package/dist/shared/vge-url.js.map +1 -0
- package/dist/shared/vge-verification.d.ts +18 -0
- package/dist/shared/vge-verification.d.ts.map +1 -0
- package/dist/shared/vge-verification.js +24 -0
- package/dist/shared/vge-verification.js.map +1 -0
- package/dist/shim/daemon-start-lock.d.ts +13 -0
- package/dist/shim/daemon-start-lock.d.ts.map +1 -0
- package/dist/shim/daemon-start-lock.js +26 -0
- package/dist/shim/daemon-start-lock.js.map +1 -0
- package/dist/shim/index.d.ts +17 -0
- package/dist/shim/index.d.ts.map +1 -0
- package/dist/shim/index.js +180 -0
- package/dist/shim/index.js.map +1 -0
- package/dist/shim/inline-resolver-terminal.d.ts +12 -0
- package/dist/shim/inline-resolver-terminal.d.ts.map +1 -0
- package/dist/shim/inline-resolver-terminal.js +201 -0
- package/dist/shim/inline-resolver-terminal.js.map +1 -0
- package/dist/shim/inline-resolver-transport.d.ts +15 -0
- package/dist/shim/inline-resolver-transport.d.ts.map +1 -0
- package/dist/shim/inline-resolver-transport.js +68 -0
- package/dist/shim/inline-resolver-transport.js.map +1 -0
- package/dist/shim/inline-resolver.d.ts +18 -0
- package/dist/shim/inline-resolver.d.ts.map +1 -0
- package/dist/shim/inline-resolver.js +152 -0
- package/dist/shim/inline-resolver.js.map +1 -0
- package/dist/shim/lazy-start.d.ts +2 -0
- package/dist/shim/lazy-start.d.ts.map +1 -0
- package/dist/shim/lazy-start.js +68 -0
- package/dist/shim/lazy-start.js.map +1 -0
- package/dist/tui/App.d.ts +7 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +62 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/components/Banner.d.ts +9 -0
- package/dist/tui/components/Banner.d.ts.map +1 -0
- package/dist/tui/components/Banner.js +29 -0
- package/dist/tui/components/Banner.js.map +1 -0
- package/dist/tui/components/BlockingDecisionModal.d.ts +11 -0
- package/dist/tui/components/BlockingDecisionModal.d.ts.map +1 -0
- package/dist/tui/components/BlockingDecisionModal.js +34 -0
- package/dist/tui/components/BlockingDecisionModal.js.map +1 -0
- package/dist/tui/components/ScreenChrome.d.ts +20 -0
- package/dist/tui/components/ScreenChrome.d.ts.map +1 -0
- package/dist/tui/components/ScreenChrome.js +30 -0
- package/dist/tui/components/ScreenChrome.js.map +1 -0
- package/dist/tui/components/SelectList.d.ts +14 -0
- package/dist/tui/components/SelectList.d.ts.map +1 -0
- package/dist/tui/components/SelectList.js +22 -0
- package/dist/tui/components/SelectList.js.map +1 -0
- package/dist/tui/components/TextField.d.ts +11 -0
- package/dist/tui/components/TextField.d.ts.map +1 -0
- package/dist/tui/components/TextField.js +34 -0
- package/dist/tui/components/TextField.js.map +1 -0
- package/dist/tui/lib/audit-log.d.ts +19 -0
- package/dist/tui/lib/audit-log.d.ts.map +1 -0
- package/dist/tui/lib/audit-log.js +49 -0
- package/dist/tui/lib/audit-log.js.map +1 -0
- package/dist/tui/lib/cc-permissions-audit.d.ts +24 -0
- package/dist/tui/lib/cc-permissions-audit.d.ts.map +1 -0
- package/dist/tui/lib/cc-permissions-audit.js +40 -0
- package/dist/tui/lib/cc-permissions-audit.js.map +1 -0
- package/dist/tui/lib/cc-permissions-defaults.d.ts +32 -0
- package/dist/tui/lib/cc-permissions-defaults.d.ts.map +1 -0
- package/dist/tui/lib/cc-permissions-defaults.js +171 -0
- package/dist/tui/lib/cc-permissions-defaults.js.map +1 -0
- package/dist/tui/lib/cc-permissions-io.d.ts +33 -0
- package/dist/tui/lib/cc-permissions-io.d.ts.map +1 -0
- package/dist/tui/lib/cc-permissions-io.js +165 -0
- package/dist/tui/lib/cc-permissions-io.js.map +1 -0
- package/dist/tui/lib/cc-permissions-ops.d.ts +19 -0
- package/dist/tui/lib/cc-permissions-ops.d.ts.map +1 -0
- package/dist/tui/lib/cc-permissions-ops.js +75 -0
- package/dist/tui/lib/cc-permissions-ops.js.map +1 -0
- package/dist/tui/lib/cc-permissions-scope.d.ts +15 -0
- package/dist/tui/lib/cc-permissions-scope.d.ts.map +1 -0
- package/dist/tui/lib/cc-permissions-scope.js +97 -0
- package/dist/tui/lib/cc-permissions-scope.js.map +1 -0
- package/dist/tui/lib/config-save.d.ts +14 -0
- package/dist/tui/lib/config-save.d.ts.map +1 -0
- package/dist/tui/lib/config-save.js +39 -0
- package/dist/tui/lib/config-save.js.map +1 -0
- package/dist/tui/lib/daemon-client.d.ts +67 -0
- package/dist/tui/lib/daemon-client.d.ts.map +1 -0
- package/dist/tui/lib/daemon-client.js +213 -0
- package/dist/tui/lib/daemon-client.js.map +1 -0
- package/dist/tui/lib/decision-stream.d.ts +29 -0
- package/dist/tui/lib/decision-stream.d.ts.map +1 -0
- package/dist/tui/lib/decision-stream.js +77 -0
- package/dist/tui/lib/decision-stream.js.map +1 -0
- package/dist/tui/lib/number-validate.d.ts +9 -0
- package/dist/tui/lib/number-validate.d.ts.map +1 -0
- package/dist/tui/lib/number-validate.js +12 -0
- package/dist/tui/lib/number-validate.js.map +1 -0
- package/dist/tui/lib/session-files.d.ts +9 -0
- package/dist/tui/lib/session-files.d.ts.map +1 -0
- package/dist/tui/lib/session-files.js +39 -0
- package/dist/tui/lib/session-files.js.map +1 -0
- package/dist/tui/lib/stats.d.ts +19 -0
- package/dist/tui/lib/stats.d.ts.map +1 -0
- package/dist/tui/lib/stats.js +72 -0
- package/dist/tui/lib/stats.js.map +1 -0
- package/dist/tui/lib/test-connection.d.ts +12 -0
- package/dist/tui/lib/test-connection.d.ts.map +1 -0
- package/dist/tui/lib/test-connection.js +59 -0
- package/dist/tui/lib/test-connection.js.map +1 -0
- package/dist/tui/lib/tools-policy-ops.d.ts +9 -0
- package/dist/tui/lib/tools-policy-ops.d.ts.map +1 -0
- package/dist/tui/lib/tools-policy-ops.js +30 -0
- package/dist/tui/lib/tools-policy-ops.js.map +1 -0
- package/dist/tui/lib/verified-at.d.ts +37 -0
- package/dist/tui/lib/verified-at.d.ts.map +1 -0
- package/dist/tui/lib/verified-at.js +47 -0
- package/dist/tui/lib/verified-at.js.map +1 -0
- package/dist/tui/screens/ApiKeys.d.ts +8 -0
- package/dist/tui/screens/ApiKeys.d.ts.map +1 -0
- package/dist/tui/screens/ApiKeys.js +250 -0
- package/dist/tui/screens/ApiKeys.js.map +1 -0
- package/dist/tui/screens/AuditViewer.d.ts +8 -0
- package/dist/tui/screens/AuditViewer.d.ts.map +1 -0
- package/dist/tui/screens/AuditViewer.js +56 -0
- package/dist/tui/screens/AuditViewer.js.map +1 -0
- package/dist/tui/screens/ContextIngressPolicy.d.ts +7 -0
- package/dist/tui/screens/ContextIngressPolicy.d.ts.map +1 -0
- package/dist/tui/screens/ContextIngressPolicy.js +145 -0
- package/dist/tui/screens/ContextIngressPolicy.js.map +1 -0
- package/dist/tui/screens/LiveEvents.d.ts +7 -0
- package/dist/tui/screens/LiveEvents.d.ts.map +1 -0
- package/dist/tui/screens/LiveEvents.js +72 -0
- package/dist/tui/screens/LiveEvents.js.map +1 -0
- package/dist/tui/screens/MainMenu.d.ts +11 -0
- package/dist/tui/screens/MainMenu.d.ts.map +1 -0
- package/dist/tui/screens/MainMenu.js +35 -0
- package/dist/tui/screens/MainMenu.js.map +1 -0
- package/dist/tui/screens/NativeCcPermissions.d.ts +7 -0
- package/dist/tui/screens/NativeCcPermissions.d.ts.map +1 -0
- package/dist/tui/screens/NativeCcPermissions.js +249 -0
- package/dist/tui/screens/NativeCcPermissions.js.map +1 -0
- package/dist/tui/screens/PendingEscalations.d.ts +7 -0
- package/dist/tui/screens/PendingEscalations.d.ts.map +1 -0
- package/dist/tui/screens/PendingEscalations.js +83 -0
- package/dist/tui/screens/PendingEscalations.js.map +1 -0
- package/dist/tui/screens/SecurityBaseline.d.ts +7 -0
- package/dist/tui/screens/SecurityBaseline.d.ts.map +1 -0
- package/dist/tui/screens/SecurityBaseline.js +272 -0
- package/dist/tui/screens/SecurityBaseline.js.map +1 -0
- package/dist/tui/screens/Stats.d.ts +7 -0
- package/dist/tui/screens/Stats.d.ts.map +1 -0
- package/dist/tui/screens/Stats.js +36 -0
- package/dist/tui/screens/Stats.js.map +1 -0
- package/dist/tui/screens/ToolsPolicy.d.ts +7 -0
- package/dist/tui/screens/ToolsPolicy.d.ts.map +1 -0
- package/dist/tui/screens/ToolsPolicy.js +87 -0
- package/dist/tui/screens/ToolsPolicy.js.map +1 -0
- package/dist/tui/screens/ViewConfig.d.ts +9 -0
- package/dist/tui/screens/ViewConfig.d.ts.map +1 -0
- package/dist/tui/screens/ViewConfig.js +117 -0
- package/dist/tui/screens/ViewConfig.js.map +1 -0
- package/dist/tui/strings.d.ts +97 -0
- package/dist/tui/strings.d.ts.map +1 -0
- package/dist/tui/strings.js +104 -0
- package/dist/tui/strings.js.map +1 -0
- package/dist/tui/types.d.ts +5 -0
- package/dist/tui/types.d.ts.map +1 -0
- package/dist/tui/types.js +2 -0
- package/dist/tui/types.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as crypto from 'crypto';
|
|
3
|
+
const TRANSCRIPT_TAIL_BYTES = 512 * 1024;
|
|
4
|
+
const MAX_MESSAGES = 10;
|
|
5
|
+
const MAX_CONVERSATION_BYTES = 256 * 1024;
|
|
6
|
+
const MAX_MESSAGE_CHARS = 100_000;
|
|
7
|
+
const ALLOWED_ROLES = new Set([
|
|
8
|
+
'system',
|
|
9
|
+
'user',
|
|
10
|
+
'assistant',
|
|
11
|
+
'tool',
|
|
12
|
+
]);
|
|
13
|
+
function contentToText(content) {
|
|
14
|
+
if (typeof content === 'string')
|
|
15
|
+
return content;
|
|
16
|
+
if (Array.isArray(content)) {
|
|
17
|
+
return content
|
|
18
|
+
.map((part) => {
|
|
19
|
+
if (typeof part === 'string')
|
|
20
|
+
return part;
|
|
21
|
+
if (typeof part === 'object' &&
|
|
22
|
+
part !== null &&
|
|
23
|
+
part.type === 'text' &&
|
|
24
|
+
typeof part.text === 'string') {
|
|
25
|
+
return part.text;
|
|
26
|
+
}
|
|
27
|
+
if (typeof part === 'object' &&
|
|
28
|
+
part !== null &&
|
|
29
|
+
part.type === 'tool_result' &&
|
|
30
|
+
typeof part.content === 'string') {
|
|
31
|
+
return part.content;
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
})
|
|
35
|
+
.filter(Boolean)
|
|
36
|
+
.join('\n');
|
|
37
|
+
}
|
|
38
|
+
if (content == null)
|
|
39
|
+
return '';
|
|
40
|
+
return String(content);
|
|
41
|
+
}
|
|
42
|
+
function parseTranscriptLine(line) {
|
|
43
|
+
let raw;
|
|
44
|
+
try {
|
|
45
|
+
raw = JSON.parse(line);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (typeof raw !== 'object' || raw === null)
|
|
51
|
+
return null;
|
|
52
|
+
const record = raw;
|
|
53
|
+
const message = typeof record['message'] === 'object' && record['message'] !== null
|
|
54
|
+
? record['message']
|
|
55
|
+
: null;
|
|
56
|
+
const roleCandidate = record['type'] ?? message?.['role'];
|
|
57
|
+
const role = typeof roleCandidate === 'string' &&
|
|
58
|
+
ALLOWED_ROLES.has(roleCandidate)
|
|
59
|
+
? roleCandidate
|
|
60
|
+
: null;
|
|
61
|
+
if (!role)
|
|
62
|
+
return null;
|
|
63
|
+
const content = contentToText(message?.['content'] ?? record['content']);
|
|
64
|
+
if (!content.trim())
|
|
65
|
+
return null;
|
|
66
|
+
const toolName = record['toolName'] ?? record['tool_name'];
|
|
67
|
+
const toolId = record['toolId'] ?? record['tool_id'] ?? record['tool_use_id'];
|
|
68
|
+
return {
|
|
69
|
+
role,
|
|
70
|
+
content,
|
|
71
|
+
...(typeof toolName === 'string' && toolName.trim() !== '' ? { toolName } : {}),
|
|
72
|
+
...(typeof toolId === 'string' && toolId.trim() !== '' ? { toolId } : {}),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function readTranscriptTail(transcriptPath) {
|
|
76
|
+
const stat = fs.statSync(transcriptPath);
|
|
77
|
+
const start = Math.max(0, stat.size - TRANSCRIPT_TAIL_BYTES);
|
|
78
|
+
const fd = fs.openSync(transcriptPath, 'r');
|
|
79
|
+
try {
|
|
80
|
+
const len = stat.size - start;
|
|
81
|
+
const buffer = Buffer.alloc(len);
|
|
82
|
+
fs.readSync(fd, buffer, 0, len, start);
|
|
83
|
+
return buffer.toString('utf8');
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
fs.closeSync(fd);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
function sha256(value) {
|
|
90
|
+
return crypto.createHash('sha256').update(value).digest('hex');
|
|
91
|
+
}
|
|
92
|
+
function attachmentText(record) {
|
|
93
|
+
const attachment = typeof record['attachment'] === 'object' && record['attachment'] !== null
|
|
94
|
+
? record['attachment']
|
|
95
|
+
: null;
|
|
96
|
+
if (!attachment || attachment['type'] !== 'file')
|
|
97
|
+
return null;
|
|
98
|
+
const content = attachment['content'];
|
|
99
|
+
if (typeof content !== 'object' || content === null)
|
|
100
|
+
return null;
|
|
101
|
+
const contentRecord = content;
|
|
102
|
+
if (contentRecord['type'] !== 'text')
|
|
103
|
+
return null;
|
|
104
|
+
const file = typeof contentRecord['file'] === 'object' && contentRecord['file'] !== null
|
|
105
|
+
? contentRecord['file']
|
|
106
|
+
: null;
|
|
107
|
+
if (!file || typeof file['content'] !== 'string')
|
|
108
|
+
return null;
|
|
109
|
+
const displayPath = typeof attachment['displayPath'] === 'string' && attachment['displayPath'].trim() !== ''
|
|
110
|
+
? attachment['displayPath']
|
|
111
|
+
: typeof attachment['filename'] === 'string' && attachment['filename'].trim() !== ''
|
|
112
|
+
? attachment['filename']
|
|
113
|
+
: typeof file['filePath'] === 'string' && file['filePath'].trim() !== ''
|
|
114
|
+
? file['filePath']
|
|
115
|
+
: null;
|
|
116
|
+
if (!displayPath)
|
|
117
|
+
return null;
|
|
118
|
+
const filePath = typeof file['filePath'] === 'string' && file['filePath'].trim() !== ''
|
|
119
|
+
? file['filePath']
|
|
120
|
+
: displayPath;
|
|
121
|
+
return {
|
|
122
|
+
content: file['content'],
|
|
123
|
+
displayPath,
|
|
124
|
+
filePath,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function parseAttachmentLine(params) {
|
|
128
|
+
let raw;
|
|
129
|
+
try {
|
|
130
|
+
raw = JSON.parse(params.line);
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
if (typeof raw !== 'object' || raw === null)
|
|
136
|
+
return null;
|
|
137
|
+
const record = raw;
|
|
138
|
+
if (record['type'] !== 'attachment')
|
|
139
|
+
return null;
|
|
140
|
+
if (typeof record['sessionId'] === 'string' && record['sessionId'] !== params.sessionId) {
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
const parsed = attachmentText(record);
|
|
144
|
+
if (!parsed)
|
|
145
|
+
return null;
|
|
146
|
+
const contentHash = sha256(parsed.content);
|
|
147
|
+
const recordFingerprint = sha256(`${params.sessionId}\n${params.transcriptPath}\n${params.offset}\n${parsed.displayPath}\n${contentHash}`);
|
|
148
|
+
if (params.seenFingerprints.has(recordFingerprint))
|
|
149
|
+
return null;
|
|
150
|
+
const resourceId = `attachment:${sha256(`${params.sessionId}\n${parsed.displayPath}\n${contentHash}`)}`;
|
|
151
|
+
return {
|
|
152
|
+
content: parsed.content,
|
|
153
|
+
contentBytes: Buffer.byteLength(parsed.content, 'utf8'),
|
|
154
|
+
contentChars: parsed.content.length,
|
|
155
|
+
contentHash,
|
|
156
|
+
displayPath: parsed.displayPath,
|
|
157
|
+
endOffset: params.lineEndOffset,
|
|
158
|
+
filePath: parsed.filePath,
|
|
159
|
+
offset: params.offset,
|
|
160
|
+
recordFingerprint,
|
|
161
|
+
resourceId,
|
|
162
|
+
transcriptPath: params.transcriptPath,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
export function normalizeConversation(messages) {
|
|
166
|
+
const out = [];
|
|
167
|
+
let bytes = 2; // JSON array brackets
|
|
168
|
+
for (let i = messages.length - 1; i >= 0; i--) {
|
|
169
|
+
const message = messages[i];
|
|
170
|
+
if (!message)
|
|
171
|
+
continue;
|
|
172
|
+
const normalizedMessage = {
|
|
173
|
+
role: message.role,
|
|
174
|
+
content: message.content.slice(0, MAX_MESSAGE_CHARS),
|
|
175
|
+
...(message.toolName ? { toolName: message.toolName } : {}),
|
|
176
|
+
...(message.toolId ? { toolId: message.toolId } : {}),
|
|
177
|
+
};
|
|
178
|
+
if (!normalizedMessage.content.trim())
|
|
179
|
+
continue;
|
|
180
|
+
const messageBytes = Buffer.byteLength(JSON.stringify(normalizedMessage), 'utf8') + (out.length > 0 ? 1 : 0);
|
|
181
|
+
if (bytes + messageBytes > MAX_CONVERSATION_BYTES)
|
|
182
|
+
break;
|
|
183
|
+
out.unshift(normalizedMessage);
|
|
184
|
+
bytes += messageBytes;
|
|
185
|
+
if (out.length >= MAX_MESSAGES)
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
export function buildConversationFromTranscript(transcriptPath) {
|
|
191
|
+
if (typeof transcriptPath !== 'string' || transcriptPath.trim() === '')
|
|
192
|
+
return [];
|
|
193
|
+
try {
|
|
194
|
+
const text = readTranscriptTail(transcriptPath);
|
|
195
|
+
const messages = text
|
|
196
|
+
.split(/\r?\n/)
|
|
197
|
+
.map((line) => line.trim())
|
|
198
|
+
.filter(Boolean)
|
|
199
|
+
.map(parseTranscriptLine)
|
|
200
|
+
.filter((message) => message !== null);
|
|
201
|
+
return normalizeConversation(messages);
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
return [];
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
export function extractFreshAttachments(params) {
|
|
208
|
+
if (typeof params.transcriptPath !== 'string' || params.transcriptPath.trim() === '') {
|
|
209
|
+
return { attachments: [], cursorReset: false, nextOffset: 0 };
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
const fd = fs.openSync(params.transcriptPath, 'r');
|
|
213
|
+
try {
|
|
214
|
+
const stat = fs.fstatSync(fd);
|
|
215
|
+
const cursorReset = params.cursorOffset > stat.size;
|
|
216
|
+
const start = cursorReset ? 0 : Math.max(0, params.cursorOffset);
|
|
217
|
+
const len = stat.size - start;
|
|
218
|
+
const buffer = Buffer.alloc(len);
|
|
219
|
+
let bytesRead = 0;
|
|
220
|
+
while (bytesRead < len) {
|
|
221
|
+
const read = fs.readSync(fd, buffer, bytesRead, len - bytesRead, start + bytesRead);
|
|
222
|
+
if (read === 0)
|
|
223
|
+
break;
|
|
224
|
+
bytesRead += read;
|
|
225
|
+
}
|
|
226
|
+
const text = buffer.subarray(0, bytesRead).toString('utf8');
|
|
227
|
+
const attachments = [];
|
|
228
|
+
let offset = start;
|
|
229
|
+
let committedOffset = start;
|
|
230
|
+
for (const lineWithEnding of text.match(/[^\n]*(?:\n|$)/g) ?? []) {
|
|
231
|
+
if (lineWithEnding === '')
|
|
232
|
+
continue;
|
|
233
|
+
const hasLineEnding = lineWithEnding.endsWith('\n');
|
|
234
|
+
const line = lineWithEnding.replace(/\r?\n$/, '');
|
|
235
|
+
const lineOffset = offset;
|
|
236
|
+
offset += Buffer.byteLength(lineWithEnding, 'utf8');
|
|
237
|
+
if (!line.trim()) {
|
|
238
|
+
committedOffset = offset;
|
|
239
|
+
continue;
|
|
240
|
+
}
|
|
241
|
+
if (!hasLineEnding) {
|
|
242
|
+
try {
|
|
243
|
+
JSON.parse(line);
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
break;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
const attachment = parseAttachmentLine({
|
|
250
|
+
line,
|
|
251
|
+
lineEndOffset: offset,
|
|
252
|
+
offset: lineOffset,
|
|
253
|
+
seenFingerprints: params.seenFingerprints,
|
|
254
|
+
sessionId: params.sessionId,
|
|
255
|
+
transcriptPath: params.transcriptPath,
|
|
256
|
+
});
|
|
257
|
+
if (attachment)
|
|
258
|
+
attachments.push(attachment);
|
|
259
|
+
committedOffset = offset;
|
|
260
|
+
}
|
|
261
|
+
return { attachments, cursorReset, nextOffset: committedOffset };
|
|
262
|
+
}
|
|
263
|
+
finally {
|
|
264
|
+
fs.closeSync(fd);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
return { attachments: [], cursorReset: false, nextOffset: 0 };
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
//# sourceMappingURL=conversation-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-context.js","sourceRoot":"","sources":["../../src/daemon/conversation-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AAGjC,MAAM,qBAAqB,GAAG,GAAG,GAAG,IAAI,CAAC;AACzC,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,sBAAsB,GAAG,GAAG,GAAG,IAAI,CAAC;AAC1C,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAClC,MAAM,aAAa,GAAG,IAAI,GAAG,CAA8B;IACzD,QAAQ;IACR,MAAM;IACN,WAAW;IACX,MAAM;CACP,CAAC,CAAC;AAsB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1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-decision-cleanup.d.ts","sourceRoot":"","sources":["../../src/daemon/conversation-decision-cleanup.ts"],"names":[],"mappings":"AAuBA,wBAAgB,2CAA2C,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAWnF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { activeAttachmentEscrowCountForSession, clearAttachmentDecisionEscrowForSession, } from './attachment-decision-escrow.js';
|
|
2
|
+
import { activePostToolEscrowCountForSession, clearPostToolDecisionEscrowForSession, } from './posttool-decision-escrow.js';
|
|
3
|
+
import { clearPostToolDecisionStateForSession } from './posttool-decision-state.js';
|
|
4
|
+
import { activePreToolEscrowCountForSession, clearPreToolDecisionEscrowForSession, } from './pretool-decision-escrow.js';
|
|
5
|
+
import { activeUserPromptEscrowCountForSession, clearUserPromptDecisionEscrowForSession, } from './userprompt-decision-escrow.js';
|
|
6
|
+
import { recordSessionCleanupDrop } from './decision-metrics.js';
|
|
7
|
+
function recordCleanupDrops(stage, count) {
|
|
8
|
+
for (let index = 0; index < count; index++)
|
|
9
|
+
recordSessionCleanupDrop(stage);
|
|
10
|
+
}
|
|
11
|
+
export function clearAllConversationDecisionStateForSession(sessionId) {
|
|
12
|
+
recordCleanupDrops('posttool', activePostToolEscrowCountForSession(sessionId));
|
|
13
|
+
recordCleanupDrops('pretool', activePreToolEscrowCountForSession(sessionId));
|
|
14
|
+
recordCleanupDrops('attachment', activeAttachmentEscrowCountForSession(sessionId));
|
|
15
|
+
recordCleanupDrops('prompt', activeUserPromptEscrowCountForSession(sessionId, 'prompt_input'));
|
|
16
|
+
clearPostToolDecisionStateForSession(sessionId);
|
|
17
|
+
clearPostToolDecisionEscrowForSession(sessionId);
|
|
18
|
+
clearPreToolDecisionEscrowForSession(sessionId);
|
|
19
|
+
clearAttachmentDecisionEscrowForSession(sessionId);
|
|
20
|
+
clearUserPromptDecisionEscrowForSession(sessionId, 'prompt_input');
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=conversation-decision-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-decision-cleanup.js","sourceRoot":"","sources":["../../src/daemon/conversation-decision-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,mCAAmC,EACnC,qCAAqC,GACtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oCAAoC,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,EACL,kCAAkC,EAClC,oCAAoC,GACrC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qCAAqC,EACrC,uCAAuC,GACxC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,SAAS,kBAAkB,CAAC,KAAa,EAAE,KAAa;IACtD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,EAAE,KAAK,EAAE;QAAE,wBAAwB,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,2CAA2C,CAAC,SAAiB;IAC3E,kBAAkB,CAAC,UAAU,EAAE,mCAAmC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC/E,kBAAkB,CAAC,SAAS,EAAE,kCAAkC,CAAC,SAAS,CAAC,CAAC,CAAC;IAC7E,kBAAkB,CAAC,YAAY,EAAE,qCAAqC,CAAC,SAAS,CAAC,CAAC,CAAC;IACnF,kBAAkB,CAAC,QAAQ,EAAE,qCAAqC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAC;IAE/F,oCAAoC,CAAC,SAAS,CAAC,CAAC;IAChD,qCAAqC,CAAC,SAAS,CAAC,CAAC;IACjD,oCAAoC,CAAC,SAAS,CAAC,CAAC;IAChD,uCAAuC,CAAC,SAAS,CAAC,CAAC;IACnD,uCAAuC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BlockingDecisionKind } from '../shared/types.js';
|
|
2
|
+
export type EscrowPromptDecision = {
|
|
3
|
+
matched: false;
|
|
4
|
+
} | {
|
|
5
|
+
matched: true;
|
|
6
|
+
ccOutput: {
|
|
7
|
+
decision?: 'block';
|
|
8
|
+
reason?: string;
|
|
9
|
+
continue?: false;
|
|
10
|
+
stopReason?: string;
|
|
11
|
+
hookSpecificOutput?: {
|
|
12
|
+
hookEventName: 'UserPromptSubmit';
|
|
13
|
+
additionalContext?: string;
|
|
14
|
+
};
|
|
15
|
+
} | null;
|
|
16
|
+
};
|
|
17
|
+
export declare function getActiveConversationDecisionKind(sessionId: string): BlockingDecisionKind | null;
|
|
18
|
+
export declare function hasActiveConversationDecision(sessionId: string): boolean;
|
|
19
|
+
export declare function resolveConversationDecisionFromPrompt(sessionId: string, prompt: string): EscrowPromptDecision;
|
|
20
|
+
//# sourceMappingURL=conversation-decision-escrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-decision-escrow.d.ts","sourceRoot":"","sources":["../../src/daemon/conversation-decision-escrow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AA+B/D,MAAM,MAAM,oBAAoB,GAC5B;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,GAClB;IACE,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE;QACR,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,kBAAkB,CAAC,EAAE;YACnB,aAAa,EAAE,kBAAkB,CAAC;YAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;SAC5B,CAAC;KACH,GAAG,IAAI,CAAC;CACV,CAAC;AASN,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAIhG;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAExE;AAED,wBAAgB,qCAAqC,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,oBAAoB,CA2D7G"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { activeConversationDecisionsForSession, renderActiveConversationDecisionDisambiguation, } from './active-conversation-decisions.js';
|
|
2
|
+
import { activePostToolEscrowCountForSession, hasPostToolEscrowDecision, renderActivePostToolDecisionReask, resolvePostToolEscrowCommand, } from './posttool-decision-escrow.js';
|
|
3
|
+
import { activePreToolEscrowCountForSession, hasPreToolEscrowDecision, renderActivePreToolDecisionReask, resolvePreToolEscrowCommand, } from './pretool-decision-escrow.js';
|
|
4
|
+
import { activeAttachmentEscrowCountForSession, hasAttachmentEscrowDecision, renderActiveAttachmentDecisionReask, resolveAttachmentEscrowCommand, } from './attachment-decision-escrow.js';
|
|
5
|
+
import { activeUserPromptEscrowCountForSession, hasUserPromptEscrowDecision, renderActiveUserPromptDecisionReask, resolveUserPromptEscrowCommand, } from './userprompt-decision-escrow.js';
|
|
6
|
+
import { blockUserPromptWithReason, parseConversationDecisionReply } from './conversation-decision-prompt.js';
|
|
7
|
+
function block(reason) {
|
|
8
|
+
return {
|
|
9
|
+
matched: true,
|
|
10
|
+
ccOutput: blockUserPromptWithReason(reason),
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function getActiveConversationDecisionKind(sessionId) {
|
|
14
|
+
const active = activeConversationDecisionsForSession(sessionId);
|
|
15
|
+
if (active.length !== 1)
|
|
16
|
+
return null;
|
|
17
|
+
return active[0].decision.kind;
|
|
18
|
+
}
|
|
19
|
+
export function hasActiveConversationDecision(sessionId) {
|
|
20
|
+
return activeConversationDecisionsForSession(sessionId).length > 0;
|
|
21
|
+
}
|
|
22
|
+
export function resolveConversationDecisionFromPrompt(sessionId, prompt) {
|
|
23
|
+
const parsed = parseConversationDecisionReply(prompt);
|
|
24
|
+
if (parsed.matched && parsed.exact && parsed.decisionId) {
|
|
25
|
+
if (hasPreToolEscrowDecision(parsed.decisionId)) {
|
|
26
|
+
return resolvePreToolEscrowCommand(sessionId, parsed);
|
|
27
|
+
}
|
|
28
|
+
if (hasPostToolEscrowDecision(parsed.decisionId)) {
|
|
29
|
+
return resolvePostToolEscrowCommand(sessionId, parsed);
|
|
30
|
+
}
|
|
31
|
+
if (hasAttachmentEscrowDecision(parsed.decisionId)) {
|
|
32
|
+
return resolveAttachmentEscrowCommand(sessionId, parsed);
|
|
33
|
+
}
|
|
34
|
+
if (hasUserPromptEscrowDecision(parsed.decisionId, 'prompt_input')) {
|
|
35
|
+
return resolveUserPromptEscrowCommand(sessionId, parsed, 'prompt_input');
|
|
36
|
+
}
|
|
37
|
+
return block(`VGE Agent Guard: decision ${parsed.decisionId} is no longer available. Re-run the tool if you still need it.`);
|
|
38
|
+
}
|
|
39
|
+
const pretoolCount = activePreToolEscrowCountForSession(sessionId);
|
|
40
|
+
const posttoolCount = activePostToolEscrowCountForSession(sessionId);
|
|
41
|
+
const attachmentCount = activeAttachmentEscrowCountForSession(sessionId);
|
|
42
|
+
const promptCount = activeUserPromptEscrowCountForSession(sessionId, 'prompt_input');
|
|
43
|
+
const posttoolResolvableCount = posttoolCount > 0 ? 1 : 0;
|
|
44
|
+
const activeCount = pretoolCount + posttoolResolvableCount + attachmentCount + promptCount;
|
|
45
|
+
if (activeCount === 0) {
|
|
46
|
+
return parsed.matched || parsed.looksLikeDecision
|
|
47
|
+
? block('VGE Agent Guard: there is no active conversation decision to resolve.')
|
|
48
|
+
: { matched: false };
|
|
49
|
+
}
|
|
50
|
+
if (activeCount > 1) {
|
|
51
|
+
return block(renderActiveConversationDecisionDisambiguation(sessionId));
|
|
52
|
+
}
|
|
53
|
+
if (!parsed.matched) {
|
|
54
|
+
let reason = null;
|
|
55
|
+
if (pretoolCount === 1) {
|
|
56
|
+
reason = renderActivePreToolDecisionReask(sessionId);
|
|
57
|
+
}
|
|
58
|
+
else if (posttoolResolvableCount === 1) {
|
|
59
|
+
reason = renderActivePostToolDecisionReask(sessionId);
|
|
60
|
+
}
|
|
61
|
+
else if (attachmentCount === 1) {
|
|
62
|
+
reason = renderActiveAttachmentDecisionReask(sessionId);
|
|
63
|
+
}
|
|
64
|
+
else if (promptCount === 1) {
|
|
65
|
+
reason = renderActiveUserPromptDecisionReask(sessionId, 'prompt_input');
|
|
66
|
+
}
|
|
67
|
+
return block(reason ?? 'VGE Agent Guard requires a valid VGE decision before continuing.');
|
|
68
|
+
}
|
|
69
|
+
const command = { choice: parsed.choice, decisionId: null, residual: parsed.residual };
|
|
70
|
+
return pretoolCount === 1
|
|
71
|
+
? resolvePreToolEscrowCommand(sessionId, command)
|
|
72
|
+
: posttoolResolvableCount === 1
|
|
73
|
+
? resolvePostToolEscrowCommand(sessionId, command)
|
|
74
|
+
: attachmentCount === 1
|
|
75
|
+
? resolveAttachmentEscrowCommand(sessionId, command)
|
|
76
|
+
: resolveUserPromptEscrowCommand(sessionId, command, 'prompt_input');
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=conversation-decision-escrow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-decision-escrow.js","sourceRoot":"","sources":["../../src/daemon/conversation-decision-escrow.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qCAAqC,EACrC,8CAA8C,GAC/C,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,mCAAmC,EACnC,yBAAyB,EACzB,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,gCAAgC,EAChC,2BAA2B,GAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,qCAAqC,EACrC,2BAA2B,EAC3B,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D,CAAC;aAAM,IAAI,uBAAuB,KAAK,CAAC,EAAE,CAAC;YACzC,MAAM,GAAG,iCAAiC,CAAC,SAAS,CAAC,CAAC;QACxD,CAAC;aAAM,IAAI,eAAe,KAAK,CAAC,EAAE,CAAC;YACjC,MAAM,GAAG,mCAAmC,CAAC,SAAS,CAAC,CAAC;QAC1D,CAAC;aAAM,IAAI,WAAW,KAAK,CAAC,EAAE,CAAC;YAC7B,MAAM,GAAG,mCAAmC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAC1E,CAAC;QACD,OAAO,KAAK,CAAC,MAAM,IAAI,kEAAkE,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;IAEvF,OAAO,YAAY,KAAK,CAAC;QACvB,CAAC,CAAC,2BAA2B,CAAC,SAAS,EAAE,OAAO,CAAC;QACjD,CAAC,CAAC,uBAAuB,KAAK,CAAC;YAC7B,CAAC,CAAC,4BAA4B,CAAC,SAAS,EAAE,OAAO,CAAC;YAClD,CAAC,CAAC,eAAe,KAAK,CAAC;gBACrB,CAAC,CAAC,8BAA8B,CAAC,SAAS,EAAE,OAAO,CAAC;gBACpD,CAAC,CAAC,8BAA8B,CAAC,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAC7E,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BlockingDecision, BlockingDecisionChoice, GuardResponseSubset } from '../shared/types.js';
|
|
2
|
+
import { type ParsedBlockingDecisionReply } from '../shared/blocking-decision-reply.js';
|
|
3
|
+
export type ParsedConversationDecisionReply = ParsedBlockingDecisionReply;
|
|
4
|
+
export interface UserPromptBlockOutput {
|
|
5
|
+
decision: 'block';
|
|
6
|
+
reason: string;
|
|
7
|
+
continue: false;
|
|
8
|
+
stopReason: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function blockUserPromptWithReason(reason: string): UserPromptBlockOutput;
|
|
11
|
+
export declare function branchScores(vgeResult: GuardResponseSubset): {
|
|
12
|
+
heuristics: number;
|
|
13
|
+
semantic: number;
|
|
14
|
+
llmGuard: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function sanitizeUrlLabel(url: string): string;
|
|
17
|
+
export declare function sanitizeDecisionResourceLabel(label: string): string;
|
|
18
|
+
export declare function parseConversationDecisionReply(prompt: string): ParsedConversationDecisionReply;
|
|
19
|
+
export declare function renderConversationDecisionPrompt(decision: BlockingDecision): string;
|
|
20
|
+
export declare function renderConversationDecisionReask(decision: BlockingDecision): string;
|
|
21
|
+
export declare function renderConversationApprovalContext(params: {
|
|
22
|
+
choice: Exclude<BlockingDecisionChoice, 'block'>;
|
|
23
|
+
contentHash?: string;
|
|
24
|
+
contentSizeBytes?: number;
|
|
25
|
+
decision: BlockingDecision;
|
|
26
|
+
originalPrompt?: string;
|
|
27
|
+
residual: string;
|
|
28
|
+
routerOutcome?: string;
|
|
29
|
+
}): string;
|
|
30
|
+
//# sourceMappingURL=conversation-decision-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversation-decision-prompt.d.ts","sourceRoot":"","sources":["../../src/daemon/conversation-decision-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAwB,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9H,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,sCAAsC,CAAC;AAG9C,MAAM,MAAM,+BAA+B,GAAG,2BAA2B,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,M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