@alan-ai-hq/agent-manager 0.1.113 → 0.1.115
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 +88 -0
- package/dist/__tests__/binding-switch-git.test.d.ts +2 -0
- package/dist/__tests__/binding-switch-git.test.d.ts.map +1 -0
- package/dist/__tests__/binding-switch-git.test.js +555 -0
- package/dist/__tests__/binding-switch-git.test.js.map +1 -0
- package/dist/__tests__/cli-ensure-install.test.d.ts +2 -0
- package/dist/__tests__/cli-ensure-install.test.d.ts.map +1 -0
- package/dist/__tests__/cli-ensure-install.test.js +177 -0
- package/dist/__tests__/cli-ensure-install.test.js.map +1 -0
- package/dist/__tests__/cli-executable.test.d.ts +2 -0
- package/dist/__tests__/cli-executable.test.d.ts.map +1 -0
- package/dist/__tests__/cli-executable.test.js +155 -0
- package/dist/__tests__/cli-executable.test.js.map +1 -0
- package/dist/__tests__/cli-executable.windows.test.d.ts +2 -0
- package/dist/__tests__/cli-executable.windows.test.d.ts.map +1 -0
- package/dist/__tests__/cli-executable.windows.test.js +123 -0
- package/dist/__tests__/cli-executable.windows.test.js.map +1 -0
- package/dist/__tests__/cli-help.test.d.ts +2 -0
- package/dist/__tests__/cli-help.test.d.ts.map +1 -0
- package/dist/__tests__/cli-help.test.js +47 -0
- package/dist/__tests__/cli-help.test.js.map +1 -0
- package/dist/__tests__/computer-readiness.test.d.ts +2 -0
- package/dist/__tests__/computer-readiness.test.d.ts.map +1 -0
- package/dist/__tests__/computer-readiness.test.js +63 -0
- package/dist/__tests__/computer-readiness.test.js.map +1 -0
- package/dist/__tests__/core-agent-provider-auth-env.test.d.ts +2 -0
- package/dist/__tests__/core-agent-provider-auth-env.test.d.ts.map +1 -0
- package/dist/__tests__/core-agent-provider-auth-env.test.js +93 -0
- package/dist/__tests__/core-agent-provider-auth-env.test.js.map +1 -0
- package/dist/__tests__/core-agent-workflow-context.test.d.ts +2 -0
- package/dist/__tests__/core-agent-workflow-context.test.d.ts.map +1 -0
- package/dist/__tests__/core-agent-workflow-context.test.js +139 -0
- package/dist/__tests__/core-agent-workflow-context.test.js.map +1 -0
- package/dist/__tests__/daemon-native-hooks.test.d.ts +2 -0
- package/dist/__tests__/daemon-native-hooks.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-native-hooks.test.js +94 -0
- package/dist/__tests__/daemon-native-hooks.test.js.map +1 -0
- package/dist/__tests__/daemon-reconcile-ask.test.d.ts +2 -0
- package/dist/__tests__/daemon-reconcile-ask.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-reconcile-ask.test.js +100 -0
- package/dist/__tests__/daemon-reconcile-ask.test.js.map +1 -0
- package/dist/__tests__/daemon-runner-status.test.d.ts +2 -0
- package/dist/__tests__/daemon-runner-status.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-runner-status.test.js +102 -0
- package/dist/__tests__/daemon-runner-status.test.js.map +1 -0
- package/dist/__tests__/daemon-socket.integration.test.d.ts +2 -0
- package/dist/__tests__/daemon-socket.integration.test.d.ts.map +1 -0
- package/dist/__tests__/daemon-socket.integration.test.js +435 -0
- package/dist/__tests__/daemon-socket.integration.test.js.map +1 -0
- package/dist/__tests__/daemon.test.d.ts +2 -0
- package/dist/__tests__/daemon.test.d.ts.map +1 -0
- package/dist/__tests__/daemon.test.js +4884 -0
- package/dist/__tests__/daemon.test.js.map +1 -0
- package/dist/__tests__/ensure-shared-checkout-branch.test.d.ts +2 -0
- package/dist/__tests__/ensure-shared-checkout-branch.test.d.ts.map +1 -0
- package/dist/__tests__/ensure-shared-checkout-branch.test.js +129 -0
- package/dist/__tests__/ensure-shared-checkout-branch.test.js.map +1 -0
- package/dist/__tests__/event-journal-stress.test.d.ts +2 -0
- package/dist/__tests__/event-journal-stress.test.d.ts.map +1 -0
- package/dist/__tests__/event-journal-stress.test.js +124 -0
- package/dist/__tests__/event-journal-stress.test.js.map +1 -0
- package/dist/__tests__/event-journal.test.d.ts +2 -0
- package/dist/__tests__/event-journal.test.d.ts.map +1 -0
- package/dist/__tests__/event-journal.test.js +264 -0
- package/dist/__tests__/event-journal.test.js.map +1 -0
- package/dist/__tests__/event-outbox-persist-failure.test.d.ts +2 -0
- package/dist/__tests__/event-outbox-persist-failure.test.d.ts.map +1 -0
- package/dist/__tests__/event-outbox-persist-failure.test.js +143 -0
- package/dist/__tests__/event-outbox-persist-failure.test.js.map +1 -0
- package/dist/__tests__/event-outbox.test.d.ts +2 -0
- package/dist/__tests__/event-outbox.test.d.ts.map +1 -0
- package/dist/__tests__/event-outbox.test.js +602 -0
- package/dist/__tests__/event-outbox.test.js.map +1 -0
- package/dist/__tests__/execution-activity-tracker.test.d.ts +2 -0
- package/dist/__tests__/execution-activity-tracker.test.d.ts.map +1 -0
- package/dist/__tests__/execution-activity-tracker.test.js +64 -0
- package/dist/__tests__/execution-activity-tracker.test.js.map +1 -0
- package/dist/__tests__/execution-lease-client.test.d.ts +2 -0
- package/dist/__tests__/execution-lease-client.test.d.ts.map +1 -0
- package/dist/__tests__/execution-lease-client.test.js +274 -0
- package/dist/__tests__/execution-lease-client.test.js.map +1 -0
- package/dist/__tests__/fake-provider-cli.test.d.ts +2 -0
- package/dist/__tests__/fake-provider-cli.test.d.ts.map +1 -0
- package/dist/__tests__/fake-provider-cli.test.js +46 -0
- package/dist/__tests__/fake-provider-cli.test.js.map +1 -0
- package/dist/__tests__/generated-images.test.d.ts +2 -0
- package/dist/__tests__/generated-images.test.d.ts.map +1 -0
- package/dist/__tests__/generated-images.test.js +132 -0
- package/dist/__tests__/generated-images.test.js.map +1 -0
- package/dist/__tests__/helpers/sandbox-outbox.d.ts +3 -0
- package/dist/__tests__/helpers/sandbox-outbox.d.ts.map +1 -0
- package/dist/__tests__/helpers/sandbox-outbox.js +23 -0
- package/dist/__tests__/helpers/sandbox-outbox.js.map +1 -0
- package/dist/__tests__/install-command.test.d.ts +2 -0
- package/dist/__tests__/install-command.test.d.ts.map +1 -0
- package/dist/__tests__/install-command.test.js +185 -0
- package/dist/__tests__/install-command.test.js.map +1 -0
- package/dist/__tests__/integration-cli.test.d.ts +2 -0
- package/dist/__tests__/integration-cli.test.d.ts.map +1 -0
- package/dist/__tests__/integration-cli.test.js +150 -0
- package/dist/__tests__/integration-cli.test.js.map +1 -0
- package/dist/__tests__/lifecycle-contracts.test.d.ts +2 -0
- package/dist/__tests__/lifecycle-contracts.test.d.ts.map +1 -0
- package/dist/__tests__/lifecycle-contracts.test.js +66 -0
- package/dist/__tests__/lifecycle-contracts.test.js.map +1 -0
- package/dist/__tests__/lifecycle-logger.test.d.ts +2 -0
- package/dist/__tests__/lifecycle-logger.test.d.ts.map +1 -0
- package/dist/__tests__/lifecycle-logger.test.js +49 -0
- package/dist/__tests__/lifecycle-logger.test.js.map +1 -0
- package/dist/__tests__/local-daemon-lifecycle.test.d.ts +2 -0
- package/dist/__tests__/local-daemon-lifecycle.test.d.ts.map +1 -0
- package/dist/__tests__/local-daemon-lifecycle.test.js +594 -0
- package/dist/__tests__/local-daemon-lifecycle.test.js.map +1 -0
- package/dist/__tests__/local-git-status.test.d.ts +2 -0
- package/dist/__tests__/local-git-status.test.d.ts.map +1 -0
- package/dist/__tests__/local-git-status.test.js +31 -0
- package/dist/__tests__/local-git-status.test.js.map +1 -0
- package/dist/__tests__/mcp-config-adapters-files.test.d.ts +2 -0
- package/dist/__tests__/mcp-config-adapters-files.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-config-adapters-files.test.js +486 -0
- package/dist/__tests__/mcp-config-adapters-files.test.js.map +1 -0
- package/dist/__tests__/mcp-config-adapters.test.d.ts +2 -0
- package/dist/__tests__/mcp-config-adapters.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-config-adapters.test.js +492 -0
- package/dist/__tests__/mcp-config-adapters.test.js.map +1 -0
- package/dist/__tests__/mcp-sync.test.d.ts +2 -0
- package/dist/__tests__/mcp-sync.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-sync.test.js +21 -0
- package/dist/__tests__/mcp-sync.test.js.map +1 -0
- package/dist/__tests__/model-scan-runner.test.d.ts +2 -0
- package/dist/__tests__/model-scan-runner.test.d.ts.map +1 -0
- package/dist/__tests__/model-scan-runner.test.js +80 -0
- package/dist/__tests__/model-scan-runner.test.js.map +1 -0
- package/dist/__tests__/native-hook-command.test.d.ts +2 -0
- package/dist/__tests__/native-hook-command.test.d.ts.map +1 -0
- package/dist/__tests__/native-hook-command.test.js +386 -0
- package/dist/__tests__/native-hook-command.test.js.map +1 -0
- package/dist/__tests__/native-hook-config.test.d.ts +2 -0
- package/dist/__tests__/native-hook-config.test.d.ts.map +1 -0
- package/dist/__tests__/native-hook-config.test.js +374 -0
- package/dist/__tests__/native-hook-config.test.js.map +1 -0
- package/dist/__tests__/native-hook-drain.test.d.ts +2 -0
- package/dist/__tests__/native-hook-drain.test.d.ts.map +1 -0
- package/dist/__tests__/native-hook-drain.test.js +197 -0
- package/dist/__tests__/native-hook-drain.test.js.map +1 -0
- package/dist/__tests__/native-hook-inbox.test.d.ts +2 -0
- package/dist/__tests__/native-hook-inbox.test.d.ts.map +1 -0
- package/dist/__tests__/native-hook-inbox.test.js +139 -0
- package/dist/__tests__/native-hook-inbox.test.js.map +1 -0
- package/dist/__tests__/native-session.test.d.ts +2 -0
- package/dist/__tests__/native-session.test.d.ts.map +1 -0
- package/dist/__tests__/native-session.test.js +41 -0
- package/dist/__tests__/native-session.test.js.map +1 -0
- package/dist/__tests__/native-stream-outbox.test.d.ts +2 -0
- package/dist/__tests__/native-stream-outbox.test.d.ts.map +1 -0
- package/dist/__tests__/native-stream-outbox.test.js +231 -0
- package/dist/__tests__/native-stream-outbox.test.js.map +1 -0
- package/dist/__tests__/native-stream-platform.test.d.ts +2 -0
- package/dist/__tests__/native-stream-platform.test.d.ts.map +1 -0
- package/dist/__tests__/native-stream-platform.test.js +20 -0
- package/dist/__tests__/native-stream-platform.test.js.map +1 -0
- package/dist/__tests__/native-transcript-cursor.test.d.ts +2 -0
- package/dist/__tests__/native-transcript-cursor.test.d.ts.map +1 -0
- package/dist/__tests__/native-transcript-cursor.test.js +60 -0
- package/dist/__tests__/native-transcript-cursor.test.js.map +1 -0
- package/dist/__tests__/native-transcript-stream.test.d.ts +2 -0
- package/dist/__tests__/native-transcript-stream.test.d.ts.map +1 -0
- package/dist/__tests__/native-transcript-stream.test.js +378 -0
- package/dist/__tests__/native-transcript-stream.test.js.map +1 -0
- package/dist/__tests__/network-diagnostics.test.d.ts +2 -0
- package/dist/__tests__/network-diagnostics.test.d.ts.map +1 -0
- package/dist/__tests__/network-diagnostics.test.js +26 -0
- package/dist/__tests__/network-diagnostics.test.js.map +1 -0
- package/dist/__tests__/observable-map.test.d.ts +2 -0
- package/dist/__tests__/observable-map.test.d.ts.map +1 -0
- package/dist/__tests__/observable-map.test.js +54 -0
- package/dist/__tests__/observable-map.test.js.map +1 -0
- package/dist/__tests__/outbox-baseline.bench.test.d.ts +2 -0
- package/dist/__tests__/outbox-baseline.bench.test.d.ts.map +1 -0
- package/dist/__tests__/outbox-baseline.bench.test.js +108 -0
- package/dist/__tests__/outbox-baseline.bench.test.js.map +1 -0
- package/dist/__tests__/provider-auth-preflight.test.d.ts +2 -0
- package/dist/__tests__/provider-auth-preflight.test.d.ts.map +1 -0
- package/dist/__tests__/provider-auth-preflight.test.js +123 -0
- package/dist/__tests__/provider-auth-preflight.test.js.map +1 -0
- package/dist/__tests__/provider-model-discovery.test.d.ts +2 -0
- package/dist/__tests__/provider-model-discovery.test.d.ts.map +1 -0
- package/dist/__tests__/provider-model-discovery.test.js +1071 -0
- package/dist/__tests__/provider-model-discovery.test.js.map +1 -0
- package/dist/__tests__/resource-diagnostics.test.d.ts +2 -0
- package/dist/__tests__/resource-diagnostics.test.d.ts.map +1 -0
- package/dist/__tests__/resource-diagnostics.test.js +138 -0
- package/dist/__tests__/resource-diagnostics.test.js.map +1 -0
- package/dist/__tests__/resume-fallback-env.test.d.ts +2 -0
- package/dist/__tests__/resume-fallback-env.test.d.ts.map +1 -0
- package/dist/__tests__/resume-fallback-env.test.js +28 -0
- package/dist/__tests__/resume-fallback-env.test.js.map +1 -0
- package/dist/__tests__/run-journal.test.d.ts +2 -0
- package/dist/__tests__/run-journal.test.d.ts.map +1 -0
- package/dist/__tests__/run-journal.test.js +121 -0
- package/dist/__tests__/run-journal.test.js.map +1 -0
- package/dist/__tests__/run-start-gate.test.d.ts +2 -0
- package/dist/__tests__/run-start-gate.test.d.ts.map +1 -0
- package/dist/__tests__/run-start-gate.test.js +18 -0
- package/dist/__tests__/run-start-gate.test.js.map +1 -0
- package/dist/__tests__/runtime-capabilities-sync.test.d.ts +2 -0
- package/dist/__tests__/runtime-capabilities-sync.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-capabilities-sync.test.js +66 -0
- package/dist/__tests__/runtime-capabilities-sync.test.js.map +1 -0
- package/dist/__tests__/runtime-config.test.d.ts +2 -0
- package/dist/__tests__/runtime-config.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-config.test.js +137 -0
- package/dist/__tests__/runtime-config.test.js.map +1 -0
- package/dist/__tests__/runtime-presenter-heartbeat.test.d.ts +2 -0
- package/dist/__tests__/runtime-presenter-heartbeat.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-presenter-heartbeat.test.js +253 -0
- package/dist/__tests__/runtime-presenter-heartbeat.test.js.map +1 -0
- package/dist/__tests__/runtime-registration.test.d.ts +2 -0
- package/dist/__tests__/runtime-registration.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-registration.test.js +109 -0
- package/dist/__tests__/runtime-registration.test.js.map +1 -0
- package/dist/__tests__/sandbox-outbox-storage.test.d.ts +2 -0
- package/dist/__tests__/sandbox-outbox-storage.test.d.ts.map +1 -0
- package/dist/__tests__/sandbox-outbox-storage.test.js +81 -0
- package/dist/__tests__/sandbox-outbox-storage.test.js.map +1 -0
- package/dist/__tests__/sandbox-outbox.test.d.ts +2 -0
- package/dist/__tests__/sandbox-outbox.test.d.ts.map +1 -0
- package/dist/__tests__/sandbox-outbox.test.js +300 -0
- package/dist/__tests__/sandbox-outbox.test.js.map +1 -0
- package/dist/__tests__/sandbox-workflow-context.test.d.ts +2 -0
- package/dist/__tests__/sandbox-workflow-context.test.d.ts.map +1 -0
- package/dist/__tests__/sandbox-workflow-context.test.js +600 -0
- package/dist/__tests__/sandbox-workflow-context.test.js.map +1 -0
- package/dist/__tests__/service-manager-deadline.test.d.ts +2 -0
- package/dist/__tests__/service-manager-deadline.test.d.ts.map +1 -0
- package/dist/__tests__/service-manager-deadline.test.js +36 -0
- package/dist/__tests__/service-manager-deadline.test.js.map +1 -0
- package/dist/__tests__/service-manager.test.d.ts +2 -0
- package/dist/__tests__/service-manager.test.d.ts.map +1 -0
- package/dist/__tests__/service-manager.test.js +769 -0
- package/dist/__tests__/service-manager.test.js.map +1 -0
- package/dist/__tests__/service-stop-ownership.test.d.ts +2 -0
- package/dist/__tests__/service-stop-ownership.test.d.ts.map +1 -0
- package/dist/__tests__/service-stop-ownership.test.js +89 -0
- package/dist/__tests__/service-stop-ownership.test.js.map +1 -0
- package/dist/__tests__/skill-invocation.test.d.ts +2 -0
- package/dist/__tests__/skill-invocation.test.d.ts.map +1 -0
- package/dist/__tests__/skill-invocation.test.js +40 -0
- package/dist/__tests__/skill-invocation.test.js.map +1 -0
- package/dist/__tests__/sleep-inhibitor-real.test.d.ts +2 -0
- package/dist/__tests__/sleep-inhibitor-real.test.d.ts.map +1 -0
- package/dist/__tests__/sleep-inhibitor-real.test.js +68 -0
- package/dist/__tests__/sleep-inhibitor-real.test.js.map +1 -0
- package/dist/__tests__/sleep-inhibitor.test.d.ts +2 -0
- package/dist/__tests__/sleep-inhibitor.test.d.ts.map +1 -0
- package/dist/__tests__/sleep-inhibitor.test.js +236 -0
- package/dist/__tests__/sleep-inhibitor.test.js.map +1 -0
- package/dist/__tests__/status-local-workspace.test.d.ts +2 -0
- package/dist/__tests__/status-local-workspace.test.d.ts.map +1 -0
- package/dist/__tests__/status-local-workspace.test.js +121 -0
- package/dist/__tests__/status-local-workspace.test.js.map +1 -0
- package/dist/__tests__/suspension-detector.test.d.ts +2 -0
- package/dist/__tests__/suspension-detector.test.d.ts.map +1 -0
- package/dist/__tests__/suspension-detector.test.js +112 -0
- package/dist/__tests__/suspension-detector.test.js.map +1 -0
- package/dist/__tests__/web-presenter-parent-events.test.d.ts +2 -0
- package/dist/__tests__/web-presenter-parent-events.test.d.ts.map +1 -0
- package/dist/__tests__/web-presenter-parent-events.test.js +168 -0
- package/dist/__tests__/web-presenter-parent-events.test.js.map +1 -0
- package/dist/__tests__/workspace-probe-concurrency.test.d.ts +2 -0
- package/dist/__tests__/workspace-probe-concurrency.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-probe-concurrency.test.js +54 -0
- package/dist/__tests__/workspace-probe-concurrency.test.js.map +1 -0
- package/dist/__tests__/workspace-relocation.test.d.ts +2 -0
- package/dist/__tests__/workspace-relocation.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-relocation.test.js +66 -0
- package/dist/__tests__/workspace-relocation.test.js.map +1 -0
- package/dist/__tests__/workspace-rpc.test.d.ts +2 -0
- package/dist/__tests__/workspace-rpc.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-rpc.test.js +90 -0
- package/dist/__tests__/workspace-rpc.test.js.map +1 -0
- package/dist/__tests__/workspace-run-lease.test.d.ts +2 -0
- package/dist/__tests__/workspace-run-lease.test.d.ts.map +1 -0
- package/dist/__tests__/workspace-run-lease.test.js +331 -0
- package/dist/__tests__/workspace-run-lease.test.js.map +1 -0
- package/dist/__tests__/ws-client-connection.test.d.ts +2 -0
- package/dist/__tests__/ws-client-connection.test.d.ts.map +1 -0
- package/dist/__tests__/ws-client-connection.test.js +295 -0
- package/dist/__tests__/ws-client-connection.test.js.map +1 -0
- package/dist/__tests__/ws-client-heartbeat-volatile.test.d.ts +2 -0
- package/dist/__tests__/ws-client-heartbeat-volatile.test.d.ts.map +1 -0
- package/dist/__tests__/ws-client-heartbeat-volatile.test.js +63 -0
- package/dist/__tests__/ws-client-heartbeat-volatile.test.js.map +1 -0
- package/dist/__tests__/ws-client-heartbeat.integration.test.d.ts +2 -0
- package/dist/__tests__/ws-client-heartbeat.integration.test.d.ts.map +1 -0
- package/dist/__tests__/ws-client-heartbeat.integration.test.js +236 -0
- package/dist/__tests__/ws-client-heartbeat.integration.test.js.map +1 -0
- package/dist/__tests__/ws-client-user-message-ack.integration.test.d.ts +2 -0
- package/dist/__tests__/ws-client-user-message-ack.integration.test.d.ts.map +1 -0
- package/dist/__tests__/ws-client-user-message-ack.integration.test.js +211 -0
- package/dist/__tests__/ws-client-user-message-ack.integration.test.js.map +1 -0
- package/dist/antigravity-api-key-config.d.ts +2 -0
- package/dist/antigravity-api-key-config.d.ts.map +1 -0
- package/dist/antigravity-api-key-config.js +79 -0
- package/dist/antigravity-api-key-config.js.map +1 -0
- package/dist/binding-switch-git.d.ts +26 -0
- package/dist/binding-switch-git.d.ts.map +1 -0
- package/dist/binding-switch-git.js +871 -0
- package/dist/binding-switch-git.js.map +1 -0
- package/dist/cli-ensure-install.d.ts +34 -0
- package/dist/cli-ensure-install.d.ts.map +1 -0
- package/dist/cli-ensure-install.js +154 -0
- package/dist/cli-ensure-install.js.map +1 -0
- package/dist/cli-executable.d.ts +44 -0
- package/dist/cli-executable.d.ts.map +1 -0
- package/dist/cli-executable.js +435 -0
- package/dist/cli-executable.js.map +1 -0
- package/dist/cli-help.d.ts +11 -0
- package/dist/cli-help.d.ts.map +1 -0
- package/dist/cli-help.js +65 -0
- package/dist/cli-help.js.map +1 -0
- package/dist/computer-readiness.d.ts +41 -0
- package/dist/computer-readiness.d.ts.map +1 -0
- package/dist/computer-readiness.js +191 -0
- package/dist/computer-readiness.js.map +1 -0
- package/dist/core-agent.d.ts +32 -0
- package/dist/core-agent.d.ts.map +1 -0
- package/dist/core-agent.js +331 -0
- package/dist/core-agent.js.map +1 -0
- package/dist/daemon-execute.d.ts +42 -0
- package/dist/daemon-execute.d.ts.map +1 -0
- package/dist/daemon-execute.js +666 -0
- package/dist/daemon-execute.js.map +1 -0
- package/dist/daemon-helpers.d.ts +150 -0
- package/dist/daemon-helpers.d.ts.map +1 -0
- package/dist/daemon-helpers.js +157 -0
- package/dist/daemon-helpers.js.map +1 -0
- package/dist/daemon-local-control.d.ts +208 -0
- package/dist/daemon-local-control.d.ts.map +1 -0
- package/dist/daemon-local-control.js +826 -0
- package/dist/daemon-local-control.js.map +1 -0
- package/dist/daemon-local-http.d.ts +57 -0
- package/dist/daemon-local-http.d.ts.map +1 -0
- package/dist/daemon-local-http.js +375 -0
- package/dist/daemon-local-http.js.map +1 -0
- package/dist/daemon-native-hooks.d.ts +17 -0
- package/dist/daemon-native-hooks.d.ts.map +1 -0
- package/dist/daemon-native-hooks.js +54 -0
- package/dist/daemon-native-hooks.js.map +1 -0
- package/dist/daemon-provider-scan.d.ts +33 -0
- package/dist/daemon-provider-scan.d.ts.map +1 -0
- package/dist/daemon-provider-scan.js +187 -0
- package/dist/daemon-provider-scan.js.map +1 -0
- package/dist/daemon-runner-status.d.ts +164 -0
- package/dist/daemon-runner-status.d.ts.map +1 -0
- package/dist/daemon-runner-status.js +424 -0
- package/dist/daemon-runner-status.js.map +1 -0
- package/dist/daemon-start.d.ts +5 -0
- package/dist/daemon-start.d.ts.map +1 -0
- package/dist/daemon-start.js +1313 -0
- package/dist/daemon-start.js.map +1 -0
- package/dist/daemon-workspace.d.ts +36 -0
- package/dist/daemon-workspace.d.ts.map +1 -0
- package/dist/daemon-workspace.js +154 -0
- package/dist/daemon-workspace.js.map +1 -0
- package/dist/daemon.d.ts +59 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +681 -0
- package/dist/daemon.js.map +1 -0
- package/dist/event-journal-crypto.d.ts +14 -0
- package/dist/event-journal-crypto.d.ts.map +1 -0
- package/dist/event-journal-crypto.js +89 -0
- package/dist/event-journal-crypto.js.map +1 -0
- package/dist/event-journal-paths.d.ts +10 -0
- package/dist/event-journal-paths.d.ts.map +1 -0
- package/dist/event-journal-paths.js +29 -0
- package/dist/event-journal-paths.js.map +1 -0
- package/dist/event-journal-recovery.d.ts +83 -0
- package/dist/event-journal-recovery.d.ts.map +1 -0
- package/dist/event-journal-recovery.js +333 -0
- package/dist/event-journal-recovery.js.map +1 -0
- package/dist/event-journal-types.d.ts +54 -0
- package/dist/event-journal-types.d.ts.map +1 -0
- package/dist/event-journal-types.js +10 -0
- package/dist/event-journal-types.js.map +1 -0
- package/dist/event-journal-writer.d.ts +44 -0
- package/dist/event-journal-writer.d.ts.map +1 -0
- package/dist/event-journal-writer.js +182 -0
- package/dist/event-journal-writer.js.map +1 -0
- package/dist/event-outbox.d.ts +113 -0
- package/dist/event-outbox.d.ts.map +1 -0
- package/dist/event-outbox.js +707 -0
- package/dist/event-outbox.js.map +1 -0
- package/dist/execution-activity-tracker.d.ts +43 -0
- package/dist/execution-activity-tracker.d.ts.map +1 -0
- package/dist/execution-activity-tracker.js +116 -0
- package/dist/execution-activity-tracker.js.map +1 -0
- package/dist/execution-lease-client.d.ts +62 -0
- package/dist/execution-lease-client.d.ts.map +1 -0
- package/dist/execution-lease-client.js +271 -0
- package/dist/execution-lease-client.js.map +1 -0
- package/dist/fake-provider-cli.d.ts +13 -0
- package/dist/fake-provider-cli.d.ts.map +1 -0
- package/dist/fake-provider-cli.js +53 -0
- package/dist/fake-provider-cli.js.map +1 -0
- package/dist/generated-images.d.ts +2 -0
- package/dist/generated-images.d.ts.map +1 -0
- package/dist/generated-images.js +2 -0
- package/dist/generated-images.js.map +1 -0
- package/dist/index.cjs +47033 -45514
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +224 -0
- package/dist/index.js.map +1 -0
- package/dist/install-command.d.ts +2 -0
- package/dist/install-command.d.ts.map +1 -0
- package/dist/install-command.js +96 -0
- package/dist/install-command.js.map +1 -0
- package/dist/integration-cli.d.ts +14 -0
- package/dist/integration-cli.d.ts.map +1 -0
- package/dist/integration-cli.js +80 -0
- package/dist/integration-cli.js.map +1 -0
- package/dist/lifecycle-logger.d.ts +25 -0
- package/dist/lifecycle-logger.d.ts.map +1 -0
- package/dist/lifecycle-logger.js +73 -0
- package/dist/lifecycle-logger.js.map +1 -0
- package/dist/local-daemon-lifecycle.d.ts +112 -0
- package/dist/local-daemon-lifecycle.d.ts.map +1 -0
- package/dist/local-daemon-lifecycle.js +433 -0
- package/dist/local-daemon-lifecycle.js.map +1 -0
- package/dist/local-git-status.d.ts +14 -0
- package/dist/local-git-status.d.ts.map +1 -0
- package/dist/local-git-status.js +43 -0
- package/dist/local-git-status.js.map +1 -0
- package/dist/managed-mcp.d.ts +7 -0
- package/dist/managed-mcp.d.ts.map +1 -0
- package/dist/managed-mcp.js +16 -0
- package/dist/managed-mcp.js.map +1 -0
- package/dist/mcp-config-adapters.d.ts +57 -0
- package/dist/mcp-config-adapters.d.ts.map +1 -0
- package/dist/mcp-config-adapters.js +929 -0
- package/dist/mcp-config-adapters.js.map +1 -0
- package/dist/mcp-sync.d.ts +44 -0
- package/dist/mcp-sync.d.ts.map +1 -0
- package/dist/mcp-sync.js +68 -0
- package/dist/mcp-sync.js.map +1 -0
- package/dist/model-scan-runner.d.ts +15 -0
- package/dist/model-scan-runner.d.ts.map +1 -0
- package/dist/model-scan-runner.js +56 -0
- package/dist/model-scan-runner.js.map +1 -0
- package/dist/native-hook-command.d.ts +31 -0
- package/dist/native-hook-command.d.ts.map +1 -0
- package/dist/native-hook-command.js +289 -0
- package/dist/native-hook-command.js.map +1 -0
- package/dist/native-hook-config.d.ts +43 -0
- package/dist/native-hook-config.d.ts.map +1 -0
- package/dist/native-hook-config.js +601 -0
- package/dist/native-hook-config.js.map +1 -0
- package/dist/native-hook-drain.d.ts +34 -0
- package/dist/native-hook-drain.d.ts.map +1 -0
- package/dist/native-hook-drain.js +83 -0
- package/dist/native-hook-drain.js.map +1 -0
- package/dist/native-hook-inbox.d.ts +40 -0
- package/dist/native-hook-inbox.d.ts.map +1 -0
- package/dist/native-hook-inbox.js +217 -0
- package/dist/native-hook-inbox.js.map +1 -0
- package/dist/native-project-config.d.ts +11 -0
- package/dist/native-project-config.d.ts.map +1 -0
- package/dist/native-project-config.js +49 -0
- package/dist/native-project-config.js.map +1 -0
- package/dist/native-session.d.ts +20 -0
- package/dist/native-session.d.ts.map +1 -0
- package/dist/native-session.js +213 -0
- package/dist/native-session.js.map +1 -0
- package/dist/native-stream-journal.d.ts +22 -0
- package/dist/native-stream-journal.d.ts.map +1 -0
- package/dist/native-stream-journal.js +98 -0
- package/dist/native-stream-journal.js.map +1 -0
- package/dist/native-stream-outbox.d.ts +40 -0
- package/dist/native-stream-outbox.d.ts.map +1 -0
- package/dist/native-stream-outbox.js +358 -0
- package/dist/native-stream-outbox.js.map +1 -0
- package/dist/native-stream-platform.d.ts +4 -0
- package/dist/native-stream-platform.d.ts.map +1 -0
- package/dist/native-stream-platform.js +11 -0
- package/dist/native-stream-platform.js.map +1 -0
- package/dist/native-transcript-cursor.d.ts +33 -0
- package/dist/native-transcript-cursor.d.ts.map +1 -0
- package/dist/native-transcript-cursor.js +108 -0
- package/dist/native-transcript-cursor.js.map +1 -0
- package/dist/native-transcript-stream.d.ts +20 -0
- package/dist/native-transcript-stream.d.ts.map +1 -0
- package/dist/native-transcript-stream.js +438 -0
- package/dist/native-transcript-stream.js.map +1 -0
- package/dist/network-diagnostics.d.ts +8 -0
- package/dist/network-diagnostics.d.ts.map +1 -0
- package/dist/network-diagnostics.js +56 -0
- package/dist/network-diagnostics.js.map +1 -0
- package/dist/observable-map.d.ts +13 -0
- package/dist/observable-map.d.ts.map +1 -0
- package/dist/observable-map.js +30 -0
- package/dist/observable-map.js.map +1 -0
- package/dist/provider-auth-preflight.d.ts +19 -0
- package/dist/provider-auth-preflight.d.ts.map +1 -0
- package/dist/provider-auth-preflight.js +107 -0
- package/dist/provider-auth-preflight.js.map +1 -0
- package/dist/provider-model-discovery.d.ts +33 -0
- package/dist/provider-model-discovery.d.ts.map +1 -0
- package/dist/provider-model-discovery.js +731 -0
- package/dist/provider-model-discovery.js.map +1 -0
- package/dist/resource-diagnostics.d.ts +21 -0
- package/dist/resource-diagnostics.d.ts.map +1 -0
- package/dist/resource-diagnostics.js +161 -0
- package/dist/resource-diagnostics.js.map +1 -0
- package/dist/resume-fallback-env.d.ts +3 -0
- package/dist/resume-fallback-env.d.ts.map +1 -0
- package/dist/resume-fallback-env.js +14 -0
- package/dist/resume-fallback-env.js.map +1 -0
- package/dist/run-journal.d.ts +51 -0
- package/dist/run-journal.d.ts.map +1 -0
- package/dist/run-journal.js +193 -0
- package/dist/run-journal.js.map +1 -0
- package/dist/runtime-backends.d.ts +2 -0
- package/dist/runtime-backends.d.ts.map +1 -0
- package/dist/runtime-backends.js +2 -0
- package/dist/runtime-backends.js.map +1 -0
- package/dist/runtime-capabilities-sync.d.ts +40 -0
- package/dist/runtime-capabilities-sync.d.ts.map +1 -0
- package/dist/runtime-capabilities-sync.js +56 -0
- package/dist/runtime-capabilities-sync.js.map +1 -0
- package/dist/runtime-config.d.ts +26 -0
- package/dist/runtime-config.d.ts.map +1 -0
- package/dist/runtime-config.js +170 -0
- package/dist/runtime-config.js.map +1 -0
- package/dist/runtime-presenter.d.ts +81 -0
- package/dist/runtime-presenter.d.ts.map +1 -0
- package/dist/runtime-presenter.js +422 -0
- package/dist/runtime-presenter.js.map +1 -0
- package/dist/runtime-registration.d.ts +40 -0
- package/dist/runtime-registration.d.ts.map +1 -0
- package/dist/runtime-registration.js +143 -0
- package/dist/runtime-registration.js.map +1 -0
- package/dist/sandbox-outbox-storage.d.ts +13 -0
- package/dist/sandbox-outbox-storage.d.ts.map +1 -0
- package/dist/sandbox-outbox-storage.js +98 -0
- package/dist/sandbox-outbox-storage.js.map +1 -0
- package/dist/sandbox-outbox.d.ts +115 -0
- package/dist/sandbox-outbox.d.ts.map +1 -0
- package/dist/sandbox-outbox.js +213 -0
- package/dist/sandbox-outbox.js.map +1 -0
- package/dist/sandbox.d.ts +34 -0
- package/dist/sandbox.d.ts.map +1 -0
- package/dist/sandbox.js +469 -0
- package/dist/sandbox.js.map +1 -0
- package/dist/service-manager.d.ts +113 -0
- package/dist/service-manager.d.ts.map +1 -0
- package/dist/service-manager.js +1065 -0
- package/dist/service-manager.js.map +1 -0
- package/dist/skills/__tests__/local-skill-source.test.d.ts +2 -0
- package/dist/skills/__tests__/local-skill-source.test.d.ts.map +1 -0
- package/dist/skills/__tests__/local-skill-source.test.js +373 -0
- package/dist/skills/__tests__/local-skill-source.test.js.map +1 -0
- package/dist/skills/__tests__/managed-skill-store.test.d.ts +2 -0
- package/dist/skills/__tests__/managed-skill-store.test.d.ts.map +1 -0
- package/dist/skills/__tests__/managed-skill-store.test.js +114 -0
- package/dist/skills/__tests__/managed-skill-store.test.js.map +1 -0
- package/dist/skills/__tests__/runtime-skill-coordinator.test.d.ts +2 -0
- package/dist/skills/__tests__/runtime-skill-coordinator.test.d.ts.map +1 -0
- package/dist/skills/__tests__/runtime-skill-coordinator.test.js +251 -0
- package/dist/skills/__tests__/runtime-skill-coordinator.test.js.map +1 -0
- package/dist/skills/__tests__/runtime-skill-manager.test.d.ts +2 -0
- package/dist/skills/__tests__/runtime-skill-manager.test.d.ts.map +1 -0
- package/dist/skills/__tests__/runtime-skill-manager.test.js +664 -0
- package/dist/skills/__tests__/runtime-skill-manager.test.js.map +1 -0
- package/dist/skills/__tests__/skill-bundle.test.d.ts +2 -0
- package/dist/skills/__tests__/skill-bundle.test.d.ts.map +1 -0
- package/dist/skills/__tests__/skill-bundle.test.js +42 -0
- package/dist/skills/__tests__/skill-bundle.test.js.map +1 -0
- package/dist/skills/__tests__/skill-control-client.test.d.ts +2 -0
- package/dist/skills/__tests__/skill-control-client.test.d.ts.map +1 -0
- package/dist/skills/__tests__/skill-control-client.test.js +49 -0
- package/dist/skills/__tests__/skill-control-client.test.js.map +1 -0
- package/dist/skills/__tests__/skill-source-config.test.d.ts +2 -0
- package/dist/skills/__tests__/skill-source-config.test.d.ts.map +1 -0
- package/dist/skills/__tests__/skill-source-config.test.js +295 -0
- package/dist/skills/__tests__/skill-source-config.test.js.map +1 -0
- package/dist/skills/local-skill-source.d.ts +77 -0
- package/dist/skills/local-skill-source.d.ts.map +1 -0
- package/dist/skills/local-skill-source.js +660 -0
- package/dist/skills/local-skill-source.js.map +1 -0
- package/dist/skills/managed-skill-store.d.ts +44 -0
- package/dist/skills/managed-skill-store.d.ts.map +1 -0
- package/dist/skills/managed-skill-store.js +160 -0
- package/dist/skills/managed-skill-store.js.map +1 -0
- package/dist/skills/runtime-skill-coordinator.d.ts +35 -0
- package/dist/skills/runtime-skill-coordinator.d.ts.map +1 -0
- package/dist/skills/runtime-skill-coordinator.js +166 -0
- package/dist/skills/runtime-skill-coordinator.js.map +1 -0
- package/dist/skills/runtime-skill-manager.d.ts +89 -0
- package/dist/skills/runtime-skill-manager.d.ts.map +1 -0
- package/dist/skills/runtime-skill-manager.js +934 -0
- package/dist/skills/runtime-skill-manager.js.map +1 -0
- package/dist/skills/skill-bundle.d.ts +2 -0
- package/dist/skills/skill-bundle.d.ts.map +1 -0
- package/dist/skills/skill-bundle.js +2 -0
- package/dist/skills/skill-bundle.js.map +1 -0
- package/dist/skills/skill-cli.d.ts +2 -0
- package/dist/skills/skill-cli.d.ts.map +1 -0
- package/dist/skills/skill-cli.js +81 -0
- package/dist/skills/skill-cli.js.map +1 -0
- package/dist/skills/skill-control-client.d.ts +20 -0
- package/dist/skills/skill-control-client.d.ts.map +1 -0
- package/dist/skills/skill-control-client.js +56 -0
- package/dist/skills/skill-control-client.js.map +1 -0
- package/dist/skills/skill-invocation.d.ts +10 -0
- package/dist/skills/skill-invocation.d.ts.map +1 -0
- package/dist/skills/skill-invocation.js +24 -0
- package/dist/skills/skill-invocation.js.map +1 -0
- package/dist/sleep-inhibitor.d.ts +32 -0
- package/dist/sleep-inhibitor.d.ts.map +1 -0
- package/dist/sleep-inhibitor.js +297 -0
- package/dist/sleep-inhibitor.js.map +1 -0
- package/dist/suspension-detector.d.ts +24 -0
- package/dist/suspension-detector.d.ts.map +1 -0
- package/dist/suspension-detector.js +59 -0
- package/dist/suspension-detector.js.map +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +2 -0
- package/dist/version.js.map +1 -0
- package/dist/web-presenter.d.ts +52 -0
- package/dist/web-presenter.d.ts.map +1 -0
- package/dist/web-presenter.js +264 -0
- package/dist/web-presenter.js.map +1 -0
- package/dist/workspace-relocation.d.ts +22 -0
- package/dist/workspace-relocation.d.ts.map +1 -0
- package/dist/workspace-relocation.js +90 -0
- package/dist/workspace-relocation.js.map +1 -0
- package/dist/workspace-rpc.d.ts +2 -0
- package/dist/workspace-rpc.d.ts.map +1 -0
- package/dist/workspace-rpc.js +15 -0
- package/dist/workspace-rpc.js.map +1 -0
- package/dist/workspace-run-lease.d.ts +116 -0
- package/dist/workspace-run-lease.d.ts.map +1 -0
- package/dist/workspace-run-lease.js +320 -0
- package/dist/workspace-run-lease.js.map +1 -0
- package/dist/ws-client.d.ts +168 -0
- package/dist/ws-client.d.ts.map +1 -0
- package/dist/ws-client.js +440 -0
- package/dist/ws-client.js.map +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { NativeSessionProviderKind } from "./native-session.js";
|
|
2
|
+
export interface NativeHookRuntime {
|
|
3
|
+
configPath?: string;
|
|
4
|
+
homeDir?: string;
|
|
5
|
+
nodeExecutable?: string;
|
|
6
|
+
cliEntry?: string;
|
|
7
|
+
environment?: Record<string, string>;
|
|
8
|
+
platform?: NodeJS.Platform;
|
|
9
|
+
}
|
|
10
|
+
export interface ClaudeNativeCommandHook {
|
|
11
|
+
type: "command";
|
|
12
|
+
command: string;
|
|
13
|
+
args?: string[];
|
|
14
|
+
shell?: "bash" | "powershell";
|
|
15
|
+
timeout: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function nativeHookCommand(input: {
|
|
18
|
+
configPath: string;
|
|
19
|
+
nodeExecutable: string;
|
|
20
|
+
cliEntry: string;
|
|
21
|
+
environment?: Record<string, string>;
|
|
22
|
+
platform?: NodeJS.Platform;
|
|
23
|
+
provider: string;
|
|
24
|
+
event: string;
|
|
25
|
+
}): ClaudeNativeCommandHook;
|
|
26
|
+
export declare function reconcileClaudeNativeHooks(input?: NativeHookRuntime): boolean;
|
|
27
|
+
export declare function removeClaudeNativeHooks(homeDir?: string): boolean;
|
|
28
|
+
export declare function reconcileCodexNativeHooks(input?: NativeHookRuntime): boolean;
|
|
29
|
+
export declare function removeCodexNativeHooks(homeDir?: string): boolean;
|
|
30
|
+
export declare function reconcileCopilotNativeHooks(input?: NativeHookRuntime): boolean;
|
|
31
|
+
export declare function removeCopilotNativeHooks(homeDir?: string): boolean;
|
|
32
|
+
export declare function reconcileCursorNativeHooks(input?: NativeHookRuntime): boolean;
|
|
33
|
+
export declare function removeCursorNativeHooks(homeDir?: string): boolean;
|
|
34
|
+
export declare function reconcileKimiNativeHooks(input?: NativeHookRuntime): boolean;
|
|
35
|
+
export declare function removeKimiNativeHooks(homeDir?: string): boolean;
|
|
36
|
+
export declare function reconcileGrokNativeHooks(input?: NativeHookRuntime): boolean;
|
|
37
|
+
export declare function removeGrokNativeHooks(homeDir?: string): boolean;
|
|
38
|
+
export declare function reconcileOpencodeNativePlugin(input?: NativeHookRuntime): boolean;
|
|
39
|
+
export declare function removeOpencodeNativePlugin(homeDir?: string): boolean;
|
|
40
|
+
export declare function inspectNativeHooksConfigured(providerKind: NativeSessionProviderKind, homeDir?: string, expectedConfigPath?: string): boolean;
|
|
41
|
+
export declare function extractNativeHookConfigPath(text: string): string | null;
|
|
42
|
+
export declare function readInstalledNativeHookConfigPath(homeDir?: string): string | null;
|
|
43
|
+
//# sourceMappingURL=native-hook-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-hook-config.d.ts","sourceRoot":"","sources":["../src/native-hook-config.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAqErE,MAAM,WAAW,iBAAiB;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;CAC5B;AAWD,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB;AAuCD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,uBAAuB,CA8B1B;AAkID,wBAAgB,0BAA0B,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAcjF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,SAAY,GAAG,OAAO,CAEpE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAahF;AAED,wBAAgB,sBAAsB,CAAC,OAAO,SAAY,GAAG,OAAO,CAEnE;AAED,wBAAgB,2BAA2B,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAoBlF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,SAAY,GAAG,OAAO,CAMrE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAoBjF;AAED,wBAAgB,uBAAuB,CAAC,OAAO,SAAY,GAAG,OAAO,CAepE;AAcD,wBAAgB,wBAAwB,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAO/E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,SAAY,GAAG,OAAO,CAOlE;AAED,wBAAgB,wBAAwB,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAgB/E;AAED,wBAAgB,qBAAqB,CAAC,OAAO,SAAY,GAAG,OAAO,CAMlE;AAsFD,wBAAgB,6BAA6B,CAAC,KAAK,GAAE,iBAAsB,GAAG,OAAO,CAapF;AAED,wBAAgB,0BAA0B,CAAC,OAAO,SAAY,GAAG,OAAO,CAMvE;AAWD,wBAAgB,4BAA4B,CAC1C,YAAY,EAAE,yBAAyB,EACvC,OAAO,SAAY,EACnB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAwCT;AA0BD,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBvE;AAED,wBAAgB,iCAAiC,CAAC,OAAO,SAAY,GAAG,MAAM,GAAG,IAAI,CAoBpF"}
|
|
@@ -0,0 +1,601 @@
|
|
|
1
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
2
|
+
import { homedir, platform as hostPlatform } from "node:os";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
const ALAN_HOOK_MARKER = "# alan-native-session-hook";
|
|
5
|
+
const ALAN_KIMI_HOOKS_START = "# alan-native-session-hooks:start";
|
|
6
|
+
const ALAN_KIMI_HOOKS_END = "# alan-native-session-hooks:end";
|
|
7
|
+
const ALAN_OPENCODE_PLUGIN_MARKER = "// alan-native-session-plugin";
|
|
8
|
+
const CLAUDE_HOOK_EVENTS = [
|
|
9
|
+
"SessionStart",
|
|
10
|
+
"UserPromptSubmit",
|
|
11
|
+
"PostToolUse",
|
|
12
|
+
"Stop",
|
|
13
|
+
"SubagentStart",
|
|
14
|
+
"SubagentStop",
|
|
15
|
+
"SessionEnd",
|
|
16
|
+
];
|
|
17
|
+
const CODEX_HOOK_EVENTS = [
|
|
18
|
+
"SessionStart",
|
|
19
|
+
"UserPromptSubmit",
|
|
20
|
+
"PostToolUse",
|
|
21
|
+
"Stop",
|
|
22
|
+
"SubagentStart",
|
|
23
|
+
"SubagentStop",
|
|
24
|
+
"SessionEnd",
|
|
25
|
+
];
|
|
26
|
+
const COPILOT_HOOK_EVENTS = [
|
|
27
|
+
"SessionStart",
|
|
28
|
+
"UserPromptSubmit",
|
|
29
|
+
"PostToolUse",
|
|
30
|
+
"Stop",
|
|
31
|
+
"SubagentStop",
|
|
32
|
+
"SessionEnd",
|
|
33
|
+
];
|
|
34
|
+
const CURSOR_HOOK_EVENTS = [
|
|
35
|
+
"sessionStart",
|
|
36
|
+
"beforeSubmitPrompt",
|
|
37
|
+
"afterAgentResponse",
|
|
38
|
+
"stop",
|
|
39
|
+
"sessionEnd",
|
|
40
|
+
];
|
|
41
|
+
const KIMI_HOOK_EVENTS = [
|
|
42
|
+
"SessionStart",
|
|
43
|
+
"UserPromptSubmit",
|
|
44
|
+
"PostToolUse",
|
|
45
|
+
"Stop",
|
|
46
|
+
"Interrupt",
|
|
47
|
+
"SubagentStart",
|
|
48
|
+
"SubagentStop",
|
|
49
|
+
"SessionEnd",
|
|
50
|
+
];
|
|
51
|
+
const GROK_HOOK_EVENTS = [
|
|
52
|
+
"SessionStart",
|
|
53
|
+
"UserPromptSubmit",
|
|
54
|
+
"PostToolUse",
|
|
55
|
+
"Stop",
|
|
56
|
+
"StopFailure",
|
|
57
|
+
"StopCancelled",
|
|
58
|
+
"SubagentStart",
|
|
59
|
+
"SubagentStop",
|
|
60
|
+
"SessionEnd",
|
|
61
|
+
];
|
|
62
|
+
function shellQuote(value) {
|
|
63
|
+
return `'${value.replaceAll("'", `'\\''`)}'`;
|
|
64
|
+
}
|
|
65
|
+
function powershellQuote(value) {
|
|
66
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
67
|
+
}
|
|
68
|
+
function hookArgs(input) {
|
|
69
|
+
return [
|
|
70
|
+
input.cliEntry,
|
|
71
|
+
"hook",
|
|
72
|
+
"--config-path",
|
|
73
|
+
input.configPath,
|
|
74
|
+
"--provider",
|
|
75
|
+
input.provider,
|
|
76
|
+
"--event",
|
|
77
|
+
input.event,
|
|
78
|
+
ALAN_HOOK_MARKER,
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
function checkedEnvironment(environment) {
|
|
82
|
+
const entries = Object.entries(environment ?? {});
|
|
83
|
+
for (const [key] of entries) {
|
|
84
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(key)) {
|
|
85
|
+
throw new Error(`Invalid native hook environment variable: ${key}`);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return entries;
|
|
89
|
+
}
|
|
90
|
+
export function nativeHookCommand(input) {
|
|
91
|
+
const args = hookArgs(input);
|
|
92
|
+
const environment = checkedEnvironment(input.environment);
|
|
93
|
+
if (environment.length === 0) {
|
|
94
|
+
return { type: "command", command: input.nodeExecutable, args, timeout: 5 };
|
|
95
|
+
}
|
|
96
|
+
if ((input.platform ?? hostPlatform()) === "win32") {
|
|
97
|
+
const environmentPrefix = environment
|
|
98
|
+
.map(([key, value]) => `$env:${key}=${powershellQuote(value)}`)
|
|
99
|
+
.join("; ");
|
|
100
|
+
const command = [input.nodeExecutable, ...args].map(powershellQuote).join(" ");
|
|
101
|
+
return {
|
|
102
|
+
type: "command",
|
|
103
|
+
shell: "powershell",
|
|
104
|
+
command: `${environmentPrefix}; & ${command}`,
|
|
105
|
+
timeout: 5,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const environmentPrefix = environment
|
|
109
|
+
.map(([key, value]) => `${key}=${shellQuote(value)}`)
|
|
110
|
+
.join(" ");
|
|
111
|
+
const command = [input.nodeExecutable, ...args].map(shellQuote).join(" ");
|
|
112
|
+
return {
|
|
113
|
+
type: "command",
|
|
114
|
+
shell: "bash",
|
|
115
|
+
command: `${environmentPrefix} ${command}`,
|
|
116
|
+
timeout: 5,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
function nativeShellCommand(runtime, provider, event, platform = runtime.platform) {
|
|
120
|
+
const args = hookArgs({
|
|
121
|
+
configPath: runtime.configPath,
|
|
122
|
+
cliEntry: runtime.cliEntry,
|
|
123
|
+
provider,
|
|
124
|
+
event,
|
|
125
|
+
});
|
|
126
|
+
const environment = checkedEnvironment(runtime.environment);
|
|
127
|
+
if (platform === "win32") {
|
|
128
|
+
const prefix = environment
|
|
129
|
+
.map(([key, value]) => `$env:${key}=${powershellQuote(value)}`)
|
|
130
|
+
.join("; ");
|
|
131
|
+
const command = `& ${[runtime.nodeExecutable, ...args].map(powershellQuote).join(" ")}`;
|
|
132
|
+
return prefix ? `${prefix}; ${command}` : command;
|
|
133
|
+
}
|
|
134
|
+
const prefix = environment.map(([key, value]) => `${key}=${shellQuote(value)}`).join(" ");
|
|
135
|
+
const command = [runtime.nodeExecutable, ...args].map(shellQuote).join(" ");
|
|
136
|
+
return prefix ? `${prefix} ${command}` : command;
|
|
137
|
+
}
|
|
138
|
+
function resolveRuntime(input = {}) {
|
|
139
|
+
const cliEntry = input.cliEntry ?? process.argv[1];
|
|
140
|
+
const configPath = input.configPath ?? process.env.ALAN_AGENT_CONFIG_PATH;
|
|
141
|
+
if (!cliEntry)
|
|
142
|
+
throw new Error("Cannot resolve the alan-agent CLI entrypoint");
|
|
143
|
+
if (!configPath?.trim()) {
|
|
144
|
+
throw new Error("Cannot install native hooks without an exact Alan agent config path");
|
|
145
|
+
}
|
|
146
|
+
return {
|
|
147
|
+
configPath,
|
|
148
|
+
homeDir: input.homeDir ?? homedir(),
|
|
149
|
+
nodeExecutable: input.nodeExecutable ?? process.execPath,
|
|
150
|
+
cliEntry,
|
|
151
|
+
environment: input.environment,
|
|
152
|
+
platform: input.platform ?? hostPlatform(),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function readSettings(path, providerLabel) {
|
|
156
|
+
if (!existsSync(path))
|
|
157
|
+
return {};
|
|
158
|
+
try {
|
|
159
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
160
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
161
|
+
throw new Error("settings root must be an object");
|
|
162
|
+
}
|
|
163
|
+
return value;
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
const backup = `${path}.malformed-${Date.now()}.bak`;
|
|
167
|
+
copyFileSync(path, backup);
|
|
168
|
+
throw new Error(`${providerLabel} settings were malformed and copied to ${backup}: ${error instanceof Error ? error.message : String(error)}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function withoutAlanEntries(value) {
|
|
172
|
+
if (!Array.isArray(value))
|
|
173
|
+
return [];
|
|
174
|
+
return value.filter((entry) => !JSON.stringify(entry).includes(ALAN_HOOK_MARKER));
|
|
175
|
+
}
|
|
176
|
+
function writeSettings(path, settings) {
|
|
177
|
+
const serialized = `${JSON.stringify(settings, null, 2)}\n`;
|
|
178
|
+
if (existsSync(path) && readFileSync(path, "utf8") === serialized)
|
|
179
|
+
return false;
|
|
180
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
181
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
182
|
+
writeFileSync(temporary, serialized, { mode: 0o600 });
|
|
183
|
+
renameSync(temporary, path);
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
function writeTextFile(path, content) {
|
|
187
|
+
if (existsSync(path) && readFileSync(path, "utf8") === content)
|
|
188
|
+
return false;
|
|
189
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
190
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
191
|
+
writeFileSync(temporary, content, { mode: 0o600 });
|
|
192
|
+
renameSync(temporary, path);
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
function withoutMarkedSection(content, start, end) {
|
|
196
|
+
const startIndex = content.indexOf(start);
|
|
197
|
+
const endIndex = content.indexOf(end);
|
|
198
|
+
if (startIndex < 0 && endIndex < 0)
|
|
199
|
+
return content;
|
|
200
|
+
if (startIndex < 0 || endIndex < startIndex) {
|
|
201
|
+
throw new Error(`Malformed Alan-owned configuration section: ${start}`);
|
|
202
|
+
}
|
|
203
|
+
const afterEnd = endIndex + end.length;
|
|
204
|
+
return `${content.slice(0, startIndex).trimEnd()}\n${content.slice(afterEnd).trimStart()}`.trim();
|
|
205
|
+
}
|
|
206
|
+
function reconcileNestedCommandHooks(input) {
|
|
207
|
+
const settings = readSettings(input.path, input.providerLabel);
|
|
208
|
+
const currentHooks = settings.hooks && typeof settings.hooks === "object" && !Array.isArray(settings.hooks)
|
|
209
|
+
? settings.hooks
|
|
210
|
+
: {};
|
|
211
|
+
const hooks = { ...currentHooks };
|
|
212
|
+
for (const event of input.events) {
|
|
213
|
+
hooks[event] = [...withoutAlanEntries(currentHooks[event]), { hooks: [input.command(event)] }];
|
|
214
|
+
}
|
|
215
|
+
return writeSettings(input.path, { ...settings, hooks });
|
|
216
|
+
}
|
|
217
|
+
function removeNestedCommandHooks(path, providerLabel) {
|
|
218
|
+
if (!existsSync(path))
|
|
219
|
+
return false;
|
|
220
|
+
const settings = readSettings(path, providerLabel);
|
|
221
|
+
if (!settings.hooks || typeof settings.hooks !== "object" || Array.isArray(settings.hooks)) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
const hooks = {};
|
|
225
|
+
let removed = false;
|
|
226
|
+
for (const [event, groups] of Object.entries(settings.hooks)) {
|
|
227
|
+
const retained = withoutAlanEntries(groups);
|
|
228
|
+
if (Array.isArray(groups) && retained.length !== groups.length)
|
|
229
|
+
removed = true;
|
|
230
|
+
if (retained.length > 0)
|
|
231
|
+
hooks[event] = retained;
|
|
232
|
+
}
|
|
233
|
+
return removed ? writeSettings(path, { ...settings, hooks }) : false;
|
|
234
|
+
}
|
|
235
|
+
export function reconcileClaudeNativeHooks(input = {}) {
|
|
236
|
+
const runtime = resolveRuntime(input);
|
|
237
|
+
return reconcileNestedCommandHooks({
|
|
238
|
+
path: join(runtime.homeDir, ".claude", "settings.json"),
|
|
239
|
+
providerLabel: "Claude",
|
|
240
|
+
events: CLAUDE_HOOK_EVENTS,
|
|
241
|
+
command: (event) => ({
|
|
242
|
+
...nativeHookCommand({
|
|
243
|
+
...runtime,
|
|
244
|
+
provider: "claude_cli",
|
|
245
|
+
event,
|
|
246
|
+
}),
|
|
247
|
+
}),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
export function removeClaudeNativeHooks(homeDir = homedir()) {
|
|
251
|
+
return removeNestedCommandHooks(join(homeDir, ".claude", "settings.json"), "Claude");
|
|
252
|
+
}
|
|
253
|
+
export function reconcileCodexNativeHooks(input = {}) {
|
|
254
|
+
const runtime = resolveRuntime(input);
|
|
255
|
+
return reconcileNestedCommandHooks({
|
|
256
|
+
path: join(runtime.homeDir, ".codex", "hooks.json"),
|
|
257
|
+
providerLabel: "Codex",
|
|
258
|
+
events: CODEX_HOOK_EVENTS,
|
|
259
|
+
command: (event) => ({
|
|
260
|
+
type: "command",
|
|
261
|
+
command: nativeShellCommand(runtime, "codex_app_server", event, "darwin"),
|
|
262
|
+
commandWindows: nativeShellCommand(runtime, "codex_app_server", event, "win32"),
|
|
263
|
+
timeout: event === "SessionEnd" ? 3 : 5,
|
|
264
|
+
}),
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
export function removeCodexNativeHooks(homeDir = homedir()) {
|
|
268
|
+
return removeNestedCommandHooks(join(homeDir, ".codex", "hooks.json"), "Codex");
|
|
269
|
+
}
|
|
270
|
+
export function reconcileCopilotNativeHooks(input = {}) {
|
|
271
|
+
const runtime = resolveRuntime(input);
|
|
272
|
+
const path = join(runtime.homeDir, ".copilot", "hooks", "alan-native-session.json");
|
|
273
|
+
if (existsSync(path) && !readFileSync(path, "utf8").includes(ALAN_HOOK_MARKER)) {
|
|
274
|
+
throw new Error(`Refusing to overwrite non-Alan Copilot hook configuration at ${path}`);
|
|
275
|
+
}
|
|
276
|
+
const hooks = Object.fromEntries(COPILOT_HOOK_EVENTS.map((event) => [
|
|
277
|
+
event,
|
|
278
|
+
[
|
|
279
|
+
{
|
|
280
|
+
type: "command",
|
|
281
|
+
bash: nativeShellCommand(runtime, "copilot_cli", event, "darwin"),
|
|
282
|
+
powershell: nativeShellCommand(runtime, "copilot_cli", event, "win32"),
|
|
283
|
+
timeoutSec: event === "SessionEnd" ? 3 : 5,
|
|
284
|
+
},
|
|
285
|
+
],
|
|
286
|
+
]));
|
|
287
|
+
return writeSettings(path, { version: 1, hooks });
|
|
288
|
+
}
|
|
289
|
+
export function removeCopilotNativeHooks(homeDir = homedir()) {
|
|
290
|
+
const path = join(homeDir, ".copilot", "hooks", "alan-native-session.json");
|
|
291
|
+
if (!existsSync(path))
|
|
292
|
+
return false;
|
|
293
|
+
if (!readFileSync(path, "utf8").includes(ALAN_HOOK_MARKER))
|
|
294
|
+
return false;
|
|
295
|
+
rmSync(path);
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
export function reconcileCursorNativeHooks(input = {}) {
|
|
299
|
+
const runtime = resolveRuntime(input);
|
|
300
|
+
const path = join(runtime.homeDir, ".cursor", "hooks.json");
|
|
301
|
+
const settings = readSettings(path, "Cursor");
|
|
302
|
+
const currentHooks = settings.hooks && typeof settings.hooks === "object" && !Array.isArray(settings.hooks)
|
|
303
|
+
? settings.hooks
|
|
304
|
+
: {};
|
|
305
|
+
const hooks = { ...currentHooks };
|
|
306
|
+
for (const event of CURSOR_HOOK_EVENTS) {
|
|
307
|
+
hooks[event] = [
|
|
308
|
+
...withoutAlanEntries(currentHooks[event]),
|
|
309
|
+
{
|
|
310
|
+
type: "command",
|
|
311
|
+
command: nativeShellCommand(runtime, "cursor_agent_cli", event),
|
|
312
|
+
timeout: 5,
|
|
313
|
+
},
|
|
314
|
+
];
|
|
315
|
+
}
|
|
316
|
+
return writeSettings(path, { ...settings, version: settings.version ?? 1, hooks });
|
|
317
|
+
}
|
|
318
|
+
export function removeCursorNativeHooks(homeDir = homedir()) {
|
|
319
|
+
const path = join(homeDir, ".cursor", "hooks.json");
|
|
320
|
+
if (!existsSync(path))
|
|
321
|
+
return false;
|
|
322
|
+
const settings = readSettings(path, "Cursor");
|
|
323
|
+
if (!settings.hooks || typeof settings.hooks !== "object" || Array.isArray(settings.hooks)) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
const hooks = {};
|
|
327
|
+
let removed = false;
|
|
328
|
+
for (const [event, entries] of Object.entries(settings.hooks)) {
|
|
329
|
+
const retained = withoutAlanEntries(entries);
|
|
330
|
+
if (Array.isArray(entries) && retained.length !== entries.length)
|
|
331
|
+
removed = true;
|
|
332
|
+
if (retained.length > 0)
|
|
333
|
+
hooks[event] = retained;
|
|
334
|
+
}
|
|
335
|
+
return removed ? writeSettings(path, { ...settings, hooks }) : false;
|
|
336
|
+
}
|
|
337
|
+
function kimiHookSection(runtime) {
|
|
338
|
+
const hooks = KIMI_HOOK_EVENTS.map((event) => [
|
|
339
|
+
"[[hooks]]",
|
|
340
|
+
`event = ${JSON.stringify(event)}`,
|
|
341
|
+
`command = ${JSON.stringify(nativeShellCommand(runtime, "kimi_cli", event))}`,
|
|
342
|
+
`timeout = ${event === "SessionEnd" ? 3 : 5}`,
|
|
343
|
+
].join("\n")).join("\n\n");
|
|
344
|
+
return `${ALAN_KIMI_HOOKS_START}\n${hooks}\n${ALAN_KIMI_HOOKS_END}`;
|
|
345
|
+
}
|
|
346
|
+
export function reconcileKimiNativeHooks(input = {}) {
|
|
347
|
+
const runtime = resolveRuntime(input);
|
|
348
|
+
const path = join(runtime.homeDir, ".kimi-code", "config.toml");
|
|
349
|
+
const current = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
350
|
+
const userContent = withoutMarkedSection(current, ALAN_KIMI_HOOKS_START, ALAN_KIMI_HOOKS_END);
|
|
351
|
+
const content = `${userContent.trimEnd()}${userContent.trim() ? "\n\n" : ""}${kimiHookSection(runtime)}\n`;
|
|
352
|
+
return writeTextFile(path, content);
|
|
353
|
+
}
|
|
354
|
+
export function removeKimiNativeHooks(homeDir = homedir()) {
|
|
355
|
+
const path = join(homeDir, ".kimi-code", "config.toml");
|
|
356
|
+
if (!existsSync(path))
|
|
357
|
+
return false;
|
|
358
|
+
const current = readFileSync(path, "utf8");
|
|
359
|
+
const content = withoutMarkedSection(current, ALAN_KIMI_HOOKS_START, ALAN_KIMI_HOOKS_END);
|
|
360
|
+
if (content === current)
|
|
361
|
+
return false;
|
|
362
|
+
return writeTextFile(path, content ? `${content.trimEnd()}\n` : "");
|
|
363
|
+
}
|
|
364
|
+
export function reconcileGrokNativeHooks(input = {}) {
|
|
365
|
+
const runtime = resolveRuntime(input);
|
|
366
|
+
const path = join(runtime.homeDir, ".grok", "hooks", "alan-native-session.json");
|
|
367
|
+
if (existsSync(path) && !readFileSync(path, "utf8").includes(ALAN_HOOK_MARKER)) {
|
|
368
|
+
throw new Error(`Refusing to overwrite non-Alan Grok hook configuration at ${path}`);
|
|
369
|
+
}
|
|
370
|
+
return reconcileNestedCommandHooks({
|
|
371
|
+
path,
|
|
372
|
+
providerLabel: "Grok",
|
|
373
|
+
events: GROK_HOOK_EVENTS,
|
|
374
|
+
command: (event) => ({
|
|
375
|
+
type: "command",
|
|
376
|
+
command: nativeShellCommand(runtime, "grok_cli", event),
|
|
377
|
+
timeout: event === "SessionEnd" ? 3 : 5,
|
|
378
|
+
}),
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
export function removeGrokNativeHooks(homeDir = homedir()) {
|
|
382
|
+
const path = join(homeDir, ".grok", "hooks", "alan-native-session.json");
|
|
383
|
+
if (!existsSync(path))
|
|
384
|
+
return false;
|
|
385
|
+
if (!readFileSync(path, "utf8").includes(ALAN_HOOK_MARKER))
|
|
386
|
+
return false;
|
|
387
|
+
rmSync(path);
|
|
388
|
+
return true;
|
|
389
|
+
}
|
|
390
|
+
function opencodePluginSource(runtime) {
|
|
391
|
+
const command = [
|
|
392
|
+
runtime.nodeExecutable,
|
|
393
|
+
runtime.cliEntry,
|
|
394
|
+
"hook",
|
|
395
|
+
"--config-path",
|
|
396
|
+
runtime.configPath,
|
|
397
|
+
"--provider",
|
|
398
|
+
"opencode_cli",
|
|
399
|
+
];
|
|
400
|
+
const environment = runtime.environment ?? {};
|
|
401
|
+
return `${ALAN_OPENCODE_PLUGIN_MARKER}
|
|
402
|
+
const command = ${JSON.stringify(command)}
|
|
403
|
+
const environment = ${JSON.stringify(environment)}
|
|
404
|
+
|
|
405
|
+
export const AlanNativeSessionPlugin = async ({ directory }) => {
|
|
406
|
+
const textByPart = new Map()
|
|
407
|
+
const userPartIdsBySession = new Map()
|
|
408
|
+
const send = async (event, payload) => {
|
|
409
|
+
const proc = Bun.spawn({
|
|
410
|
+
cmd: [...command, "--event", event, ${JSON.stringify(ALAN_HOOK_MARKER)}],
|
|
411
|
+
env: { ...process.env, ...environment },
|
|
412
|
+
stdin: "pipe",
|
|
413
|
+
stdout: "ignore",
|
|
414
|
+
stderr: "ignore",
|
|
415
|
+
})
|
|
416
|
+
proc.stdin.write(JSON.stringify({ ...payload, cwd: payload.cwd ?? directory }))
|
|
417
|
+
proc.stdin.end()
|
|
418
|
+
await proc.exited
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return {
|
|
422
|
+
"chat.message": async (input, output) => {
|
|
423
|
+
userPartIdsBySession.set(
|
|
424
|
+
input.sessionID,
|
|
425
|
+
new Set(output.parts.map((part) => part.id).filter(Boolean)),
|
|
426
|
+
)
|
|
427
|
+
const prompt = output.parts
|
|
428
|
+
.filter((part) => part.type === "text")
|
|
429
|
+
.map((part) => part.text)
|
|
430
|
+
.join("\\n")
|
|
431
|
+
await send("user_prompt", { session_id: input.sessionID, prompt })
|
|
432
|
+
},
|
|
433
|
+
event: async ({ event }) => {
|
|
434
|
+
if (event.type === "session.created") {
|
|
435
|
+
await send("session_start", { session_id: event.properties.info.id })
|
|
436
|
+
return
|
|
437
|
+
}
|
|
438
|
+
if (event.type === "session.idle") {
|
|
439
|
+
await send("stop", { session_id: event.properties.sessionID })
|
|
440
|
+
return
|
|
441
|
+
}
|
|
442
|
+
if (event.type === "session.deleted") {
|
|
443
|
+
userPartIdsBySession.delete(event.properties.info.id)
|
|
444
|
+
await send("session_end", { session_id: event.properties.info.id })
|
|
445
|
+
return
|
|
446
|
+
}
|
|
447
|
+
if (event.type === "session.error" && event.properties.sessionID) {
|
|
448
|
+
await send("stop", {
|
|
449
|
+
session_id: event.properties.sessionID,
|
|
450
|
+
error: event.properties.error,
|
|
451
|
+
})
|
|
452
|
+
return
|
|
453
|
+
}
|
|
454
|
+
if (event.type !== "message.part.updated") return
|
|
455
|
+
const part = event.properties.part
|
|
456
|
+
if (part.type !== "text" && part.type !== "reasoning") return
|
|
457
|
+
if (userPartIdsBySession.get(part.sessionID)?.has(part.id)) return
|
|
458
|
+
const previous = textByPart.get(part.id) ?? ""
|
|
459
|
+
const complete = typeof part.text === "string" ? part.text : ""
|
|
460
|
+
const text = event.properties.delta ?? (complete.startsWith(previous) ? complete.slice(previous.length) : complete)
|
|
461
|
+
textByPart.set(part.id, complete)
|
|
462
|
+
if (!text) return
|
|
463
|
+
await send("transcript_update", {
|
|
464
|
+
session_id: part.sessionID,
|
|
465
|
+
source_cursor: part.id + ":" + complete.length,
|
|
466
|
+
...(part.type === "reasoning" ? { thinking: text } : { transcript_delta: text }),
|
|
467
|
+
})
|
|
468
|
+
},
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
`;
|
|
472
|
+
}
|
|
473
|
+
export function reconcileOpencodeNativePlugin(input = {}) {
|
|
474
|
+
const runtime = resolveRuntime(input);
|
|
475
|
+
const path = join(runtime.homeDir, ".config", "opencode", "plugins", "alan-native-session.js");
|
|
476
|
+
if (existsSync(path) && !readFileSync(path, "utf8").includes(ALAN_OPENCODE_PLUGIN_MARKER)) {
|
|
477
|
+
throw new Error(`Refusing to overwrite non-Alan OpenCode plugin at ${path}`);
|
|
478
|
+
}
|
|
479
|
+
const source = opencodePluginSource(runtime);
|
|
480
|
+
if (existsSync(path) && readFileSync(path, "utf8") === source)
|
|
481
|
+
return false;
|
|
482
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
483
|
+
const temporary = `${path}.${process.pid}.tmp`;
|
|
484
|
+
writeFileSync(temporary, source, { mode: 0o600 });
|
|
485
|
+
renameSync(temporary, path);
|
|
486
|
+
return true;
|
|
487
|
+
}
|
|
488
|
+
export function removeOpencodeNativePlugin(homeDir = homedir()) {
|
|
489
|
+
const path = join(homeDir, ".config", "opencode", "plugins", "alan-native-session.js");
|
|
490
|
+
if (!existsSync(path))
|
|
491
|
+
return false;
|
|
492
|
+
if (!readFileSync(path, "utf8").includes(ALAN_OPENCODE_PLUGIN_MARKER))
|
|
493
|
+
return false;
|
|
494
|
+
rmSync(path);
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
function configFileContainsMarker(path, marker) {
|
|
498
|
+
if (!existsSync(path))
|
|
499
|
+
return false;
|
|
500
|
+
try {
|
|
501
|
+
return readFileSync(path, "utf8").includes(marker);
|
|
502
|
+
}
|
|
503
|
+
catch {
|
|
504
|
+
return false;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
export function inspectNativeHooksConfigured(providerKind, homeDir = homedir(), expectedConfigPath) {
|
|
508
|
+
const matchesActiveProfile = (path, marker) => {
|
|
509
|
+
if (!configFileContainsMarker(path, marker))
|
|
510
|
+
return false;
|
|
511
|
+
if (!expectedConfigPath)
|
|
512
|
+
return true;
|
|
513
|
+
try {
|
|
514
|
+
return extractNativeHookConfigPath(readFileSync(path, "utf8")) === expectedConfigPath;
|
|
515
|
+
}
|
|
516
|
+
catch {
|
|
517
|
+
return false;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
switch (providerKind) {
|
|
521
|
+
case "claude_cli":
|
|
522
|
+
return matchesActiveProfile(join(homeDir, ".claude", "settings.json"), ALAN_HOOK_MARKER);
|
|
523
|
+
case "codex_app_server":
|
|
524
|
+
return matchesActiveProfile(join(homeDir, ".codex", "hooks.json"), ALAN_HOOK_MARKER);
|
|
525
|
+
case "copilot_cli":
|
|
526
|
+
return matchesActiveProfile(join(homeDir, ".copilot", "hooks", "alan-native-session.json"), ALAN_HOOK_MARKER);
|
|
527
|
+
case "cursor_agent_cli":
|
|
528
|
+
return matchesActiveProfile(join(homeDir, ".cursor", "hooks.json"), ALAN_HOOK_MARKER);
|
|
529
|
+
case "kimi_cli":
|
|
530
|
+
return matchesActiveProfile(join(homeDir, ".kimi-code", "config.toml"), ALAN_KIMI_HOOKS_START);
|
|
531
|
+
case "grok_cli":
|
|
532
|
+
return matchesActiveProfile(join(homeDir, ".grok", "hooks", "alan-native-session.json"), ALAN_HOOK_MARKER);
|
|
533
|
+
case "opencode_cli":
|
|
534
|
+
return matchesActiveProfile(join(homeDir, ".config", "opencode", "plugins", "alan-native-session.js"), ALAN_OPENCODE_PLUGIN_MARKER);
|
|
535
|
+
default:
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
function nativeHookConfigFilePath(providerKind, homeDir) {
|
|
540
|
+
switch (providerKind) {
|
|
541
|
+
case "claude_cli":
|
|
542
|
+
return join(homeDir, ".claude", "settings.json");
|
|
543
|
+
case "codex_app_server":
|
|
544
|
+
return join(homeDir, ".codex", "hooks.json");
|
|
545
|
+
case "copilot_cli":
|
|
546
|
+
return join(homeDir, ".copilot", "hooks", "alan-native-session.json");
|
|
547
|
+
case "cursor_agent_cli":
|
|
548
|
+
return join(homeDir, ".cursor", "hooks.json");
|
|
549
|
+
case "kimi_cli":
|
|
550
|
+
return join(homeDir, ".kimi-code", "config.toml");
|
|
551
|
+
case "grok_cli":
|
|
552
|
+
return join(homeDir, ".grok", "hooks", "alan-native-session.json");
|
|
553
|
+
case "opencode_cli":
|
|
554
|
+
return join(homeDir, ".config", "opencode", "plugins", "alan-native-session.js");
|
|
555
|
+
default:
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
export function extractNativeHookConfigPath(text) {
|
|
560
|
+
const jsonMatch = text.match(/"--config-path"\s*,\s*"((?:\\"|[^"])*)"/);
|
|
561
|
+
if (jsonMatch?.[1]) {
|
|
562
|
+
try {
|
|
563
|
+
return JSON.parse(`"${jsonMatch[1]}"`);
|
|
564
|
+
}
|
|
565
|
+
catch { }
|
|
566
|
+
}
|
|
567
|
+
const match = text.match(/(?:['"])?--config-path(?:['"])?(?:=|\s+)('(?:\\'|[^'])*'|"(?:\\"|[^"])*"|[^\s#]+)/);
|
|
568
|
+
if (!match?.[1])
|
|
569
|
+
return null;
|
|
570
|
+
const raw = match[1];
|
|
571
|
+
if (raw.startsWith("'") || raw.startsWith('"')) {
|
|
572
|
+
return raw.slice(1, -1).replaceAll(String.raw `\'`, "'").replaceAll(String.raw `\"`, '"');
|
|
573
|
+
}
|
|
574
|
+
return raw;
|
|
575
|
+
}
|
|
576
|
+
export function readInstalledNativeHookConfigPath(homeDir = homedir()) {
|
|
577
|
+
const providerKinds = [
|
|
578
|
+
"claude_cli",
|
|
579
|
+
"cursor_agent_cli",
|
|
580
|
+
"codex_app_server",
|
|
581
|
+
"copilot_cli",
|
|
582
|
+
"kimi_cli",
|
|
583
|
+
"grok_cli",
|
|
584
|
+
"opencode_cli",
|
|
585
|
+
];
|
|
586
|
+
for (const providerKind of providerKinds) {
|
|
587
|
+
if (!inspectNativeHooksConfigured(providerKind, homeDir))
|
|
588
|
+
continue;
|
|
589
|
+
const path = nativeHookConfigFilePath(providerKind, homeDir);
|
|
590
|
+
if (!path || !existsSync(path))
|
|
591
|
+
continue;
|
|
592
|
+
try {
|
|
593
|
+
const configPath = extractNativeHookConfigPath(readFileSync(path, "utf8"));
|
|
594
|
+
if (configPath)
|
|
595
|
+
return configPath;
|
|
596
|
+
}
|
|
597
|
+
catch { }
|
|
598
|
+
}
|
|
599
|
+
return null;
|
|
600
|
+
}
|
|
601
|
+
//# sourceMappingURL=native-hook-config.js.map
|