@intutic/cli 1.10.0 → 1.10.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/README.md +1 -0
- package/dist/cli.js +868 -30
- package/dist/cli.js.map +1 -1
- package/dist/commands/attenuate.d.ts +39 -0
- package/dist/commands/attenuate.d.ts.map +1 -0
- package/dist/commands/attenuate.js +98 -0
- package/dist/commands/attenuate.js.map +1 -0
- package/dist/commands/budget.d.ts +80 -0
- package/dist/commands/budget.d.ts.map +1 -1
- package/dist/commands/budget.js +119 -3
- package/dist/commands/budget.js.map +1 -1
- package/dist/commands/connect.d.ts +10 -0
- package/dist/commands/connect.d.ts.map +1 -1
- package/dist/commands/connect.js +358 -48
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/credentials.d.ts +31 -0
- package/dist/commands/credentials.d.ts.map +1 -0
- package/dist/commands/credentials.js +134 -0
- package/dist/commands/credentials.js.map +1 -0
- package/dist/commands/decision.d.ts +37 -0
- package/dist/commands/decision.d.ts.map +1 -0
- package/dist/commands/decision.js +56 -0
- package/dist/commands/decision.js.map +1 -0
- package/dist/commands/doctor.d.ts +38 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +228 -18
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/enforce.d.ts +33 -0
- package/dist/commands/enforce.d.ts.map +1 -0
- package/dist/commands/enforce.js +150 -0
- package/dist/commands/enforce.js.map +1 -0
- package/dist/commands/enterprise.d.ts +29 -0
- package/dist/commands/enterprise.d.ts.map +1 -0
- package/dist/commands/enterprise.js +141 -0
- package/dist/commands/enterprise.js.map +1 -0
- package/dist/commands/env.d.ts +7 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +55 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/exec.d.ts +38 -2
- package/dist/commands/exec.d.ts.map +1 -1
- package/dist/commands/exec.js +247 -10
- package/dist/commands/exec.js.map +1 -1
- package/dist/commands/findings.d.ts +84 -0
- package/dist/commands/findings.d.ts.map +1 -0
- package/dist/commands/findings.js +329 -0
- package/dist/commands/findings.js.map +1 -0
- package/dist/commands/gateway.d.ts +62 -0
- package/dist/commands/gateway.d.ts.map +1 -0
- package/dist/commands/gateway.js +298 -0
- package/dist/commands/gateway.js.map +1 -0
- package/dist/commands/guardrails.d.ts +81 -0
- package/dist/commands/guardrails.d.ts.map +1 -0
- package/dist/commands/guardrails.js +735 -0
- package/dist/commands/guardrails.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +14 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/install-daemon.d.ts +70 -3
- package/dist/commands/install-daemon.d.ts.map +1 -1
- package/dist/commands/install-daemon.js +482 -47
- package/dist/commands/install-daemon.js.map +1 -1
- package/dist/commands/integrity.d.ts +205 -0
- package/dist/commands/integrity.d.ts.map +1 -0
- package/dist/commands/integrity.js +620 -0
- package/dist/commands/integrity.js.map +1 -0
- package/dist/commands/judge.d.ts +31 -0
- package/dist/commands/judge.d.ts.map +1 -0
- package/dist/commands/judge.js +118 -0
- package/dist/commands/judge.js.map +1 -0
- package/dist/commands/org.d.ts +31 -0
- package/dist/commands/org.d.ts.map +1 -0
- package/dist/commands/org.js +159 -0
- package/dist/commands/org.js.map +1 -0
- package/dist/commands/policy.d.ts +138 -4
- package/dist/commands/policy.d.ts.map +1 -1
- package/dist/commands/policy.js +538 -97
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/predict-cost.d.ts +45 -0
- package/dist/commands/predict-cost.d.ts.map +1 -0
- package/dist/commands/predict-cost.js +123 -0
- package/dist/commands/predict-cost.js.map +1 -0
- package/dist/commands/rollback.d.ts +5 -0
- package/dist/commands/rollback.d.ts.map +1 -0
- package/dist/commands/rollback.js +142 -0
- package/dist/commands/rollback.js.map +1 -0
- package/dist/commands/routing.d.ts +62 -0
- package/dist/commands/routing.d.ts.map +1 -0
- package/dist/commands/routing.js +121 -0
- package/dist/commands/routing.js.map +1 -0
- package/dist/commands/setup.d.ts +62 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +238 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/skill.d.ts +268 -1
- package/dist/commands/skill.d.ts.map +1 -1
- package/dist/commands/skill.js +744 -39
- package/dist/commands/skill.js.map +1 -1
- package/dist/commands/sops.d.ts +95 -0
- package/dist/commands/sops.d.ts.map +1 -1
- package/dist/commands/sops.js +334 -34
- package/dist/commands/sops.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +1 -18
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +44 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/team.d.ts +38 -0
- package/dist/commands/team.d.ts.map +1 -0
- package/dist/commands/team.js +140 -0
- package/dist/commands/team.js.map +1 -0
- package/dist/commands/traces.d.ts +8 -1
- package/dist/commands/traces.d.ts.map +1 -1
- package/dist/commands/traces.js +114 -15
- package/dist/commands/traces.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +2 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/config/keychain.d.ts +10 -2
- package/dist/config/keychain.d.ts.map +1 -1
- package/dist/config/keychain.js +83 -14
- package/dist/config/keychain.js.map +1 -1
- package/dist/config/paths.d.ts +27 -0
- package/dist/config/paths.d.ts.map +1 -1
- package/dist/config/paths.js +37 -6
- package/dist/config/paths.js.map +1 -1
- package/dist/config/store.d.ts.map +1 -1
- package/dist/config/store.js +19 -3
- package/dist/config/store.js.map +1 -1
- package/dist/harness/ag2.d.ts +22 -0
- package/dist/harness/ag2.d.ts.map +1 -0
- package/dist/harness/ag2.js +34 -0
- package/dist/harness/ag2.js.map +1 -0
- package/dist/harness/agentcore.d.ts +55 -0
- package/dist/harness/agentcore.d.ts.map +1 -0
- package/dist/harness/agentcore.js +119 -0
- package/dist/harness/agentcore.js.map +1 -0
- package/dist/harness/agenticOrchestrator.d.ts +52 -0
- package/dist/harness/agenticOrchestrator.d.ts.map +1 -0
- package/dist/harness/agenticOrchestrator.js +115 -0
- package/dist/harness/agenticOrchestrator.js.map +1 -0
- package/dist/harness/aiSdkHarness.d.ts +30 -0
- package/dist/harness/aiSdkHarness.d.ts.map +1 -0
- package/dist/harness/aiSdkHarness.js +51 -0
- package/dist/harness/aiSdkHarness.js.map +1 -0
- package/dist/harness/aiSdkWorkflow.d.ts +26 -0
- package/dist/harness/aiSdkWorkflow.d.ts.map +1 -0
- package/dist/harness/aiSdkWorkflow.js +39 -0
- package/dist/harness/aiSdkWorkflow.js.map +1 -0
- package/dist/harness/autogen.d.ts +24 -0
- package/dist/harness/autogen.d.ts.map +1 -0
- package/dist/harness/autogen.js +36 -0
- package/dist/harness/autogen.js.map +1 -0
- package/dist/harness/base.js.map +1 -1
- package/dist/harness/continue.d.ts.map +1 -1
- package/dist/harness/continue.js +2 -1
- package/dist/harness/continue.js.map +1 -1
- package/dist/harness/crewai.d.ts +15 -0
- package/dist/harness/crewai.d.ts.map +1 -0
- package/dist/harness/crewai.js +26 -0
- package/dist/harness/crewai.js.map +1 -0
- package/dist/harness/detector.d.ts +1 -1
- package/dist/harness/detector.d.ts.map +1 -1
- package/dist/harness/detector.js +47 -1
- package/dist/harness/detector.js.map +1 -1
- package/dist/harness/dsh.d.ts +19 -0
- package/dist/harness/dsh.d.ts.map +1 -0
- package/dist/harness/dsh.js +93 -0
- package/dist/harness/dsh.js.map +1 -0
- package/dist/harness/eve.d.ts +40 -0
- package/dist/harness/eve.d.ts.map +1 -0
- package/dist/harness/eve.js +67 -0
- package/dist/harness/eve.js.map +1 -0
- package/dist/harness/googleAdk.d.ts +18 -0
- package/dist/harness/googleAdk.d.ts.map +1 -0
- package/dist/harness/googleAdk.js +29 -0
- package/dist/harness/googleAdk.js.map +1 -0
- package/dist/harness/goose.d.ts.map +1 -1
- package/dist/harness/goose.js +5 -1
- package/dist/harness/goose.js.map +1 -1
- package/dist/harness/grok.d.ts +16 -0
- package/dist/harness/grok.d.ts.map +1 -0
- package/dist/harness/grok.js +78 -0
- package/dist/harness/grok.js.map +1 -0
- package/dist/harness/jsSdkGatedAdapter.d.ts +102 -0
- package/dist/harness/jsSdkGatedAdapter.d.ts.map +1 -0
- package/dist/harness/jsSdkGatedAdapter.js +139 -0
- package/dist/harness/jsSdkGatedAdapter.js.map +1 -0
- package/dist/harness/langchain.d.ts +22 -0
- package/dist/harness/langchain.d.ts.map +1 -0
- package/dist/harness/langchain.js +33 -0
- package/dist/harness/langchain.js.map +1 -0
- package/dist/harness/langgraph.d.ts +22 -0
- package/dist/harness/langgraph.d.ts.map +1 -0
- package/dist/harness/langgraph.js +80 -0
- package/dist/harness/langgraph.js.map +1 -0
- package/dist/harness/mastra.d.ts +21 -0
- package/dist/harness/mastra.d.ts.map +1 -0
- package/dist/harness/mastra.js +33 -0
- package/dist/harness/mastra.js.map +1 -0
- package/dist/harness/muse.d.ts +22 -0
- package/dist/harness/muse.d.ts.map +1 -0
- package/dist/harness/muse.js +92 -0
- package/dist/harness/muse.js.map +1 -0
- package/dist/harness/n8n.d.ts.map +1 -1
- package/dist/harness/n8n.js +36 -11
- package/dist/harness/n8n.js.map +1 -1
- package/dist/harness/openaiAgents.d.ts +40 -0
- package/dist/harness/openaiAgents.d.ts.map +1 -0
- package/dist/harness/openaiAgents.js +107 -0
- package/dist/harness/openaiAgents.js.map +1 -0
- package/dist/harness/opencode.d.ts +24 -0
- package/dist/harness/opencode.d.ts.map +1 -0
- package/dist/harness/opencode.js +97 -0
- package/dist/harness/opencode.js.map +1 -0
- package/dist/harness/pydanticAi.d.ts +19 -0
- package/dist/harness/pydanticAi.d.ts.map +1 -0
- package/dist/harness/pydanticAi.js +30 -0
- package/dist/harness/pydanticAi.js.map +1 -0
- package/dist/harness/sdkGatedAdapter.d.ts +55 -0
- package/dist/harness/sdkGatedAdapter.d.ts.map +1 -0
- package/dist/harness/sdkGatedAdapter.js +85 -0
- package/dist/harness/sdkGatedAdapter.js.map +1 -0
- package/dist/harness/smolagents.d.ts +22 -0
- package/dist/harness/smolagents.d.ts.map +1 -0
- package/dist/harness/smolagents.js +33 -0
- package/dist/harness/smolagents.js.map +1 -0
- package/dist/harness/strands.d.ts +22 -0
- package/dist/harness/strands.d.ts.map +1 -0
- package/dist/harness/strands.js +35 -0
- package/dist/harness/strands.js.map +1 -0
- package/dist/harness/trueforge.d.ts +25 -0
- package/dist/harness/trueforge.d.ts.map +1 -0
- package/dist/harness/trueforge.js +40 -0
- package/dist/harness/trueforge.js.map +1 -0
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js +70 -0
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/vercelAiSdk.d.ts +31 -0
- package/dist/harness/vercelAiSdk.d.ts.map +1 -0
- package/dist/harness/vercelAiSdk.js +44 -0
- package/dist/harness/vercelAiSdk.js.map +1 -0
- package/dist/harness/xirp.d.ts +43 -0
- package/dist/harness/xirp.d.ts.map +1 -0
- package/dist/harness/xirp.js +95 -0
- package/dist/harness/xirp.js.map +1 -0
- package/dist/lib/api.d.ts +68 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +108 -67
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/authMessages.d.ts +19 -0
- package/dist/lib/authMessages.d.ts.map +1 -0
- package/dist/lib/authMessages.js +20 -0
- package/dist/lib/authMessages.js.map +1 -0
- package/dist/lib/binaryChecksum.d.ts +12 -0
- package/dist/lib/binaryChecksum.d.ts.map +1 -0
- package/dist/lib/binaryChecksum.js +45 -0
- package/dist/lib/binaryChecksum.js.map +1 -0
- package/dist/lib/binaryOnPath.d.ts +24 -0
- package/dist/lib/binaryOnPath.d.ts.map +1 -0
- package/dist/lib/binaryOnPath.js +31 -0
- package/dist/lib/binaryOnPath.js.map +1 -0
- package/dist/lib/caTrust.d.ts +69 -0
- package/dist/lib/caTrust.d.ts.map +1 -0
- package/dist/lib/caTrust.js +169 -0
- package/dist/lib/caTrust.js.map +1 -0
- package/dist/lib/ciscoScanner.d.ts +178 -0
- package/dist/lib/ciscoScanner.d.ts.map +1 -0
- package/dist/lib/ciscoScanner.js +292 -0
- package/dist/lib/ciscoScanner.js.map +1 -0
- package/dist/lib/decisionsLogRefresh.d.ts +28 -0
- package/dist/lib/decisionsLogRefresh.d.ts.map +1 -0
- package/dist/lib/decisionsLogRefresh.js +54 -0
- package/dist/lib/decisionsLogRefresh.js.map +1 -0
- package/dist/lib/deviceReport.d.ts +26 -0
- package/dist/lib/deviceReport.d.ts.map +1 -0
- package/dist/lib/deviceReport.js +55 -0
- package/dist/lib/deviceReport.js.map +1 -0
- package/dist/lib/elevation.d.ts +58 -0
- package/dist/lib/elevation.d.ts.map +1 -0
- package/dist/lib/elevation.js +83 -0
- package/dist/lib/elevation.js.map +1 -0
- package/dist/lib/enforcementState.d.ts +69 -0
- package/dist/lib/enforcementState.d.ts.map +1 -0
- package/dist/lib/enforcementState.js +113 -0
- package/dist/lib/enforcementState.js.map +1 -0
- package/dist/lib/ensureValkey.d.ts.map +1 -1
- package/dist/lib/ensureValkey.js +2 -2
- package/dist/lib/ensureValkey.js.map +1 -1
- package/dist/lib/envInjector.d.ts.map +1 -1
- package/dist/lib/envInjector.js +22 -4
- package/dist/lib/envInjector.js.map +1 -1
- package/dist/lib/gitHooks.d.ts +7 -2
- package/dist/lib/gitHooks.d.ts.map +1 -1
- package/dist/lib/gitHooks.js +180 -13
- package/dist/lib/gitHooks.js.map +1 -1
- package/dist/lib/gracefulShutdown.d.ts +37 -0
- package/dist/lib/gracefulShutdown.d.ts.map +1 -0
- package/dist/lib/gracefulShutdown.js +57 -0
- package/dist/lib/gracefulShutdown.js.map +1 -0
- package/dist/lib/graphIdentity.d.ts +80 -0
- package/dist/lib/graphIdentity.d.ts.map +1 -0
- package/dist/lib/graphIdentity.js +120 -0
- package/dist/lib/graphIdentity.js.map +1 -0
- package/dist/lib/localTraces.d.ts +61 -0
- package/dist/lib/localTraces.d.ts.map +1 -0
- package/dist/lib/localTraces.js +173 -0
- package/dist/lib/localTraces.js.map +1 -0
- package/dist/lib/mdmManifest.d.ts +73 -0
- package/dist/lib/mdmManifest.d.ts.map +1 -0
- package/dist/lib/mdmManifest.js +190 -0
- package/dist/lib/mdmManifest.js.map +1 -0
- package/dist/lib/onboarding.d.ts.map +1 -1
- package/dist/lib/onboarding.js +60 -1
- package/dist/lib/onboarding.js.map +1 -1
- package/dist/lib/otelPropagation.d.ts +26 -0
- package/dist/lib/otelPropagation.d.ts.map +1 -0
- package/dist/lib/otelPropagation.js +40 -0
- package/dist/lib/otelPropagation.js.map +1 -0
- package/dist/lib/policySnapshot.d.ts +92 -0
- package/dist/lib/policySnapshot.d.ts.map +1 -0
- package/dist/lib/policySnapshot.js +173 -0
- package/dist/lib/policySnapshot.js.map +1 -0
- package/dist/lib/process.d.ts.map +1 -1
- package/dist/lib/process.js +60 -0
- package/dist/lib/process.js.map +1 -1
- package/dist/lib/providerProbe.d.ts +28 -0
- package/dist/lib/providerProbe.d.ts.map +1 -0
- package/dist/lib/providerProbe.js +57 -0
- package/dist/lib/providerProbe.js.map +1 -0
- package/dist/lib/proxyBinary.d.ts +19 -0
- package/dist/lib/proxyBinary.d.ts.map +1 -0
- package/dist/lib/proxyBinary.js +30 -0
- package/dist/lib/proxyBinary.js.map +1 -0
- package/dist/lib/sandbox/firecracker.d.ts +89 -0
- package/dist/lib/sandbox/firecracker.d.ts.map +1 -0
- package/dist/lib/sandbox/firecracker.js +135 -0
- package/dist/lib/sandbox/firecracker.js.map +1 -0
- package/dist/lib/sandbox/index.d.ts +34 -0
- package/dist/lib/sandbox/index.d.ts.map +1 -0
- package/dist/lib/sandbox/index.js +54 -0
- package/dist/lib/sandbox/index.js.map +1 -0
- package/dist/lib/sandbox/oci.d.ts +38 -0
- package/dist/lib/sandbox/oci.d.ts.map +1 -0
- package/dist/lib/sandbox/oci.js +108 -0
- package/dist/lib/sandbox/oci.js.map +1 -0
- package/dist/lib/sandbox/types.d.ts +48 -0
- package/dist/lib/sandbox/types.d.ts.map +1 -0
- package/dist/lib/sandbox/types.js +12 -0
- package/dist/lib/sandbox/types.js.map +1 -0
- package/dist/lib/sopFrontMatter.d.ts +50 -0
- package/dist/lib/sopFrontMatter.d.ts.map +1 -0
- package/dist/lib/sopFrontMatter.js +129 -0
- package/dist/lib/sopFrontMatter.js.map +1 -0
- package/package.json +11 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envInjector.js","sourceRoot":"","sources":["../../src/lib/envInjector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAQ,SAAS,CAAA;AAC1B,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAE,MAAQ,SAAS,CAAA;AAC1B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAE9C,MAAM,MAAM,GAAG,YAAY,CAAC,aAAa,CAAC,CAAA;AAE1C,MAAM,QAAQ,GAAG,CAAC,oBAAoB,EAAE,iBAAiB,CAAU,CAAA;AASnE,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,QAAgB;QAC1B,KAAK,CAAC,6CAA6C,QAAQ,EAAE,CAAC,CAAA;QAC9D,IAAI,CAAC,IAAI,GAAG,2BAA2B,CAAA;IACzC,CAAC;CACF;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC/C,YAAY,IAAY;QACtB,KAAK,CAAC,8CAA8C,IAAI,+BAA+B,CAAC,CAAA;QACxF,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAA;IACtC,CAAC;CACF;AAED,SAAS,kBAAkB,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,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;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,MAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE,0BAA0B,CAAC,CAAA;IAErD,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,KAAK,MAAM,GAAG,IAAI,QAAQ;YAAE,WAAW,CAAC,GAAG,CAAC,CAAA;QAC5C,OAAM;IACR,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,KAAK,MAAM,GAAG,IAAI,QAAQ;YAAE,eAAe,CAAC,GAAG,CAAC,CAAA;QAChD,OAAM;IACR,CAAC;IACD,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,KAAK,MAAM,GAAG,IAAI,QAAQ;YAAE,aAAa,CAAC,GAAG,CAAC,CAAA;QAC9C,OAAM;IACR,CAAC;IACD,MAAM,IAAI,yBAAyB,CAAC,QAAQ,CAAC,CAAA;AAC/C,CAAC"}
|
package/dist/lib/gitHooks.d.ts
CHANGED
|
@@ -10,10 +10,15 @@
|
|
|
10
10
|
* @module
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
-
* Installs post-commit and post-
|
|
13
|
+
* Installs post-commit, post-checkout, pre-commit, and post-merge hooks into
|
|
14
|
+
* `.git/hooks/`.
|
|
14
15
|
*
|
|
15
16
|
* @param workspaceRoot - Workspace root directory.
|
|
16
|
-
* @returns Promise<boolean> - True if
|
|
17
|
+
* @returns Promise<boolean> - True if installation ran without error, even
|
|
18
|
+
* when one or more individual hooks were left untouched because a foreign
|
|
19
|
+
* hook already occupied that path (see `writeHookIfOursOrAbsent`) — that is
|
|
20
|
+
* correct, deliberate behavior, not a failure. `false` only when this is
|
|
21
|
+
* not a Git repository or a filesystem error prevented writing.
|
|
17
22
|
*/
|
|
18
23
|
export declare function installGitHooks(workspaceRoot: string): Promise<boolean>;
|
|
19
24
|
//# sourceMappingURL=gitHooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitHooks.d.ts","sourceRoot":"","sources":["../../src/lib/gitHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"gitHooks.d.ts","sourceRoot":"","sources":["../../src/lib/gitHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA8IH;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkG7E"}
|
package/dist/lib/gitHooks.js
CHANGED
|
@@ -11,19 +11,141 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import * as node_fs from 'node:fs/promises';
|
|
13
13
|
import * as node_path from 'node:path';
|
|
14
|
+
import { secretPatternAlternation } from '@intutic/shared-types';
|
|
14
15
|
import { log } from './logger.js';
|
|
15
|
-
|
|
16
|
+
/** Marker line identifying a post-commit/post-checkout hook as ours — the overwrite guard. */
|
|
17
|
+
const GIT_CONTEXT_MARKER = '# Intutic Git Context Sync Hook';
|
|
18
|
+
/** Marker line identifying a pre-commit hook as ours — the overwrite guard. */
|
|
19
|
+
const PRE_COMMIT_MARKER = '# Intutic Pre-Commit Secret Scan';
|
|
20
|
+
/** Marker line identifying a post-merge hook as ours — same overwrite guard as pre-commit. */
|
|
21
|
+
const POST_MERGE_MARKER = '# Intutic Post-Merge Decisions Log Refresh';
|
|
22
|
+
/**
|
|
23
|
+
* Git-context tracking hook content, shared by post-commit and post-checkout
|
|
24
|
+
* (TD-351): both fire the same best-effort branch/commit sync, backgrounded
|
|
25
|
+
* and output-suppressed so it never adds latency to the Git command that
|
|
26
|
+
* triggered it.
|
|
27
|
+
*/
|
|
28
|
+
function gitContextSyncContent() {
|
|
29
|
+
return `
|
|
16
30
|
#!/bin/sh
|
|
17
|
-
|
|
31
|
+
${GIT_CONTEXT_MARKER}
|
|
18
32
|
if command -v intutic >/dev/null 2>&1; then
|
|
19
33
|
intutic sync-context --git --branch "$(git branch --show-current)" --commit "$(git rev-parse HEAD)" >/dev/null 2>&1 &
|
|
20
34
|
fi
|
|
21
|
-
`.trim();
|
|
35
|
+
`.trim() + '\n';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Optional post-merge hook: refreshes the governed decisions log
|
|
39
|
+
* (`.intutic/DECISIONS.md` + the bounded section in the `claude-code`
|
|
40
|
+
* harness config) right after a merge, rather than leaving a developer
|
|
41
|
+
* waiting for the daemon's next ~30s poll. `decisions-log-refresh` itself
|
|
42
|
+
* no-ops (and never errors the shell) when `decisionsLogEnabled` is off or
|
|
43
|
+
* the developer isn't authenticated — see `decisionsLogRefresh.ts`.
|
|
44
|
+
*
|
|
45
|
+
* Backgrounded and output-suppressed, same shape as `gitContextSyncContent`
|
|
46
|
+
* above — a governance context refresh must never add latency to `git merge`.
|
|
47
|
+
*/
|
|
48
|
+
function postMergeContent() {
|
|
49
|
+
return `
|
|
50
|
+
#!/bin/sh
|
|
51
|
+
${POST_MERGE_MARKER}
|
|
52
|
+
if command -v intutic >/dev/null 2>&1; then
|
|
53
|
+
intutic decisions-log-refresh >/dev/null 2>&1 &
|
|
54
|
+
fi
|
|
55
|
+
`.trim() + '\n';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The last line before a secret enters git history.
|
|
59
|
+
*
|
|
60
|
+
* The hook gate refuses a Write whose content carries a credential value, and
|
|
61
|
+
* the proxy's DLP covers the LLM traffic — but a secret can reach the working
|
|
62
|
+
* tree by other roads (a human paste, an unproxied tool, a generator script).
|
|
63
|
+
* Until now the repo's history had no gate at all: the CLI installed
|
|
64
|
+
* post-commit and post-checkout tracking hooks only, so the commit — the step
|
|
65
|
+
* GitGuardian's 28M-leaked-secrets figure is measured at — was uninspected.
|
|
66
|
+
*
|
|
67
|
+
* Scans only ADDED lines of the staged diff, with the same
|
|
68
|
+
* `SECRET_VALUE_PATTERNS` the hook gate enforces (one source, in
|
|
69
|
+
* shared-types — two hand-kept copies of "what is a credential" is how the
|
|
70
|
+
* gate and the hook would drift). Refuses with the offending file:line and
|
|
71
|
+
* names the escape hatch: `git commit --no-verify` is deliberate, auditable
|
|
72
|
+
* in shell history, and better than teaching people to delete the hook.
|
|
73
|
+
*/
|
|
74
|
+
function preCommitContent() {
|
|
75
|
+
return `
|
|
76
|
+
#!/bin/sh
|
|
77
|
+
${PRE_COMMIT_MARKER}
|
|
78
|
+
# Refuses a commit whose STAGED ADDITIONS carry a credential-shaped value.
|
|
79
|
+
# Same patterns the Intutic hook gate enforces (see @intutic/shared-types
|
|
80
|
+
# secretPatterns.ts — the single source both consumers compile).
|
|
81
|
+
findings="$(git diff --cached -U0 --no-color | grep -E '^\\+' | grep -vE '^\\+\\+\\+' | grep -nE '${secretPatternAlternation()}' || true)"
|
|
82
|
+
if [ -n "$findings" ]; then
|
|
83
|
+
echo "[Intutic] Commit refused: staged changes add credential-shaped content:" >&2
|
|
84
|
+
echo "$findings" | head -10 >&2
|
|
85
|
+
echo "" >&2
|
|
86
|
+
echo "Remove the secret and reference it from the environment instead." >&2
|
|
87
|
+
echo "If this is a false positive, commit with: git commit --no-verify" >&2
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
# TD-358: warn-only skill-content scan of staged skill-surface additions
|
|
92
|
+
# (.agents/skills/**, .claude/skills/**). Advisory only — this NEVER
|
|
93
|
+
# refuses the commit, unlike the secret scan above. See skillScan.ts's
|
|
94
|
+
# module doc comment for why: the pattern table's false-positive rate
|
|
95
|
+
# against real, benign skill markdown has not been measured yet, so nothing
|
|
96
|
+
# here may borrow the secret scan's refusal authority until it has earned
|
|
97
|
+
# it the same way. If the secret scan above already refused, this line is
|
|
98
|
+
# never reached — that check's exit 1 is untouched.
|
|
99
|
+
if command -v intutic >/dev/null 2>&1; then
|
|
100
|
+
intutic skill scan-staged || true
|
|
101
|
+
fi
|
|
102
|
+
exit 0
|
|
103
|
+
`.trimStart();
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Writes one hook file at `<hooksDir>/<name>` unless a foreign (non-Intutic)
|
|
107
|
+
* hook already occupies that path — the shared never-clobber-a-foreign-hook,
|
|
108
|
+
* marker-based-idempotent-rerun behavior every hook `installGitHooks` manages
|
|
109
|
+
* now follows (TD-351; previously only pre-commit and post-merge had it).
|
|
110
|
+
*
|
|
111
|
+
* Reads the existing file first: absent, or already carrying `marker` (a
|
|
112
|
+
* previous install of this same hook, safe to overwrite with the current
|
|
113
|
+
* content — this is what makes a re-run idempotent), writes `content` and
|
|
114
|
+
* marks it executable. Anything else is a hook this codebase did not write —
|
|
115
|
+
* left standing untouched, with `warnMessage` logged so the operator knows
|
|
116
|
+
* why the hook they expected is missing.
|
|
117
|
+
*
|
|
118
|
+
* @returns `true` if the hook was (re-)written, `false` if a foreign hook was
|
|
119
|
+
* left in place. Both are legitimate outcomes, not failures — the caller
|
|
120
|
+
* decides what "success" means for its own summary log line.
|
|
121
|
+
*/
|
|
122
|
+
async function writeHookIfOursOrAbsent(hooksDir, name, content, marker, warnMessage) {
|
|
123
|
+
const hookPath = node_path.join(hooksDir, name);
|
|
124
|
+
let existing;
|
|
125
|
+
try {
|
|
126
|
+
existing = await node_fs.readFile(hookPath, 'utf-8');
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
existing = null;
|
|
130
|
+
}
|
|
131
|
+
if (existing === null || existing.includes(marker)) {
|
|
132
|
+
await node_fs.writeFile(hookPath, content, { encoding: 'utf-8', mode: 0o755 });
|
|
133
|
+
await node_fs.chmod(hookPath, 0o755);
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
log.warn(warnMessage);
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
22
139
|
/**
|
|
23
|
-
* Installs post-commit and post-
|
|
140
|
+
* Installs post-commit, post-checkout, pre-commit, and post-merge hooks into
|
|
141
|
+
* `.git/hooks/`.
|
|
24
142
|
*
|
|
25
143
|
* @param workspaceRoot - Workspace root directory.
|
|
26
|
-
* @returns Promise<boolean> - True if
|
|
144
|
+
* @returns Promise<boolean> - True if installation ran without error, even
|
|
145
|
+
* when one or more individual hooks were left untouched because a foreign
|
|
146
|
+
* hook already occupied that path (see `writeHookIfOursOrAbsent`) — that is
|
|
147
|
+
* correct, deliberate behavior, not a failure. `false` only when this is
|
|
148
|
+
* not a Git repository or a filesystem error prevented writing.
|
|
27
149
|
*/
|
|
28
150
|
export async function installGitHooks(workspaceRoot) {
|
|
29
151
|
const gitDir = node_path.join(workspaceRoot, '.git');
|
|
@@ -40,14 +162,59 @@ export async function installGitHooks(workspaceRoot) {
|
|
|
40
162
|
const hooksDir = node_path.join(gitDir, 'hooks');
|
|
41
163
|
try {
|
|
42
164
|
await node_fs.mkdir(hooksDir, { recursive: true });
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
165
|
+
// Git-context tracking hooks (post-commit, post-checkout). Marker-
|
|
166
|
+
// disciplined the same way pre-commit and post-merge are below (TD-351):
|
|
167
|
+
// never clobber a hook that isn't ours. Until this fix these two
|
|
168
|
+
// overwrote whatever was already at their paths unconditionally — a
|
|
169
|
+
// team's own post-commit/post-checkout script (a notification hook, a
|
|
170
|
+
// submodule sync script) was silently replaced on install. Now a foreign
|
|
171
|
+
// hook is left standing, and the operator is told so.
|
|
172
|
+
const postCommitInstalled = await writeHookIfOursOrAbsent(hooksDir, 'post-commit', gitContextSyncContent(), GIT_CONTEXT_MARKER, "A post-commit hook already exists and is not Intutic's — left untouched. " +
|
|
173
|
+
'Branch/commit context will not sync automatically on commit; run ' +
|
|
174
|
+
'`intutic sync-context` manually as a workaround, or add Intutic\'s sync call to your own hook.');
|
|
175
|
+
const postCheckoutInstalled = await writeHookIfOursOrAbsent(hooksDir, 'post-checkout', gitContextSyncContent(), GIT_CONTEXT_MARKER, "A post-checkout hook already exists and is not Intutic's — left untouched. " +
|
|
176
|
+
'Branch/commit context will not sync automatically on checkout; run ' +
|
|
177
|
+
'`intutic sync-context` manually as a workaround, or add Intutic\'s sync call to your own hook.');
|
|
178
|
+
// Pre-commit secret scan. Unlike the two tracking hooks above, this one
|
|
179
|
+
// must NOT clobber blindly: pre-commit is where husky/lint-staged and
|
|
180
|
+
// hand-written hooks live, and silently replacing a team's hook to
|
|
181
|
+
// install ours is the exact overreach that gets governance tooling
|
|
182
|
+
// uninstalled. Ours is only written over an absent hook or a prior copy
|
|
183
|
+
// of itself (identified by marker); anything else is left standing and
|
|
184
|
+
// said so.
|
|
185
|
+
const preCommitInstalled = await writeHookIfOursOrAbsent(hooksDir, 'pre-commit', preCommitContent(), PRE_COMMIT_MARKER, "A pre-commit hook already exists and is not Intutic's — left untouched. " +
|
|
186
|
+
'The staged-diff secret scan is NOT installed; add it to your existing hook ' +
|
|
187
|
+
'if you want commit-time scanning.');
|
|
188
|
+
// Optional post-merge hook (governed decisions log refresh). Marker-
|
|
189
|
+
// disciplined the same way pre-commit is above — never clobber a
|
|
190
|
+
// post-merge hook that isn't ours. Post-commit/post-checkout above now
|
|
191
|
+
// follow this exact same pattern too (TD-351 — previously they did not:
|
|
192
|
+
// they unconditionally overwrote whatever was already at those paths,
|
|
193
|
+
// noted as a latent overreach rather than fixed alongside this hook's
|
|
194
|
+
// original addition, since changing existing-install behavior needed its
|
|
195
|
+
// own review).
|
|
196
|
+
const postMergeInstalled = await writeHookIfOursOrAbsent(hooksDir, 'post-merge', postMergeContent(), POST_MERGE_MARKER, "A post-merge hook already exists and is not Intutic's — left untouched. " +
|
|
197
|
+
'The governed decisions log will still refresh on the daemon\'s normal poll cycle; run ' +
|
|
198
|
+
'`intutic sync-context` manually as a workaround if you need it sooner.');
|
|
199
|
+
// Summary log line, kept honest: only name a hook as installed if it
|
|
200
|
+
// actually was. A hook skipped because a foreign hook already exists at
|
|
201
|
+
// that path already got its own `log.warn` above — this line must never
|
|
202
|
+
// paper over that with a blanket "success".
|
|
203
|
+
const installed = [];
|
|
204
|
+
if (postCommitInstalled)
|
|
205
|
+
installed.push('post-commit');
|
|
206
|
+
if (postCheckoutInstalled)
|
|
207
|
+
installed.push('post-checkout');
|
|
208
|
+
if (preCommitInstalled)
|
|
209
|
+
installed.push('pre-commit secret scan');
|
|
210
|
+
if (postMergeInstalled)
|
|
211
|
+
installed.push('post-merge decisions log refresh');
|
|
212
|
+
if (installed.length > 0) {
|
|
213
|
+
log.info(`Successfully installed Git hooks (${installed.join(', ')})`);
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
log.info('No Git hooks installed — every target hook already exists and is not Intutic\'s');
|
|
217
|
+
}
|
|
51
218
|
return true;
|
|
52
219
|
}
|
|
53
220
|
catch (err) {
|
package/dist/lib/gitHooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitHooks.js","sourceRoot":"","sources":["../../src/lib/gitHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,MAAM,
|
|
1
|
+
{"version":3,"file":"gitHooks.js","sourceRoot":"","sources":["../../src/lib/gitHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAA;AAC3C,OAAO,KAAK,SAAS,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAEjC,8FAA8F;AAC9F,MAAM,kBAAkB,GAAG,iCAAiC,CAAA;AAE5D,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,kCAAkC,CAAA;AAE5D,8FAA8F;AAC9F,MAA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+
* Shutdown that actually ends the process (TD-484).
|
|
3
|
+
*
|
|
4
|
+
* `intutic connect` trapped SIGTERM, logged "Shutting down", aborted its poll
|
|
5
|
+
* loop, and then stayed alive: a daemon asked to stop kept polling its control
|
|
6
|
+
* plane for four and a half hours, through two stops. Aborting a loop is a
|
|
7
|
+
* request; nothing enforced it. An await that never settles, or a child whose
|
|
8
|
+
* pipes stay open, is enough to keep the event loop — and the process — alive.
|
|
9
|
+
*
|
|
10
|
+
* Two rules, both enforced by timers that are `unref`'d so they never keep a
|
|
11
|
+
* process alive themselves, only end one that something else is holding open:
|
|
12
|
+
*
|
|
13
|
+
* 1. a child told to stop is killed if it has not exited after a grace period;
|
|
14
|
+
* 2. the process exits after a deadline whether or not cleanup finished, and
|
|
15
|
+
* at once on a second signal.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
import type { ChildProcess } from 'node:child_process';
|
|
20
|
+
export declare const CHILD_GRACE_MS = 3000;
|
|
21
|
+
export declare const EXIT_DEADLINE_MS = 8000;
|
|
22
|
+
/** SIGTERM now, SIGKILL after `graceMs` if the child is still running. */
|
|
23
|
+
export declare function terminateChild(child: ChildProcess, graceMs?: number): void;
|
|
24
|
+
export interface ShutdownHandlerOptions {
|
|
25
|
+
/** Starts the graceful path: abort loops, stop children. Runs once. */
|
|
26
|
+
onShutdown: () => void;
|
|
27
|
+
deadlineMs?: number;
|
|
28
|
+
/** Injectable for tests. */
|
|
29
|
+
exit?: (code: number) => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns a signal handler. First call: run `onShutdown` and arm the exit
|
|
33
|
+
* deadline. Any later call: exit immediately — a second Ctrl-C or a second
|
|
34
|
+
* `kill` means "now", and the first one evidently was not enough.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createShutdownHandler(opts: ShutdownHandlerOptions): () => void;
|
|
37
|
+
//# sourceMappingURL=gracefulShutdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gracefulShutdown.d.ts","sourceRoot":"","sources":["../../src/lib/gracefulShutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,eAAO,MAAM,cAAc,OAAQ,CAAA;AACnC,eAAO,MAAM,gBAAgB,OAAQ,CAAA;AAErC,0EAA0E;AAC1E,wBAAgB,cAAc,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,SAAiB,GAAG,IAAI,CAQlF;AAED,MAAM,WAAW,sBAAsB;IACrC,uEAAuE;IACvE,UAAU,EAAE,MAAM,IAAI,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,IAAI,CAiB9E"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shutdown that actually ends the process (TD-484).
|
|
3
|
+
*
|
|
4
|
+
* `intutic connect` trapped SIGTERM, logged "Shutting down", aborted its poll
|
|
5
|
+
* loop, and then stayed alive: a daemon asked to stop kept polling its control
|
|
6
|
+
* plane for four and a half hours, through two stops. Aborting a loop is a
|
|
7
|
+
* request; nothing enforced it. An await that never settles, or a child whose
|
|
8
|
+
* pipes stay open, is enough to keep the event loop — and the process — alive.
|
|
9
|
+
*
|
|
10
|
+
* Two rules, both enforced by timers that are `unref`'d so they never keep a
|
|
11
|
+
* process alive themselves, only end one that something else is holding open:
|
|
12
|
+
*
|
|
13
|
+
* 1. a child told to stop is killed if it has not exited after a grace period;
|
|
14
|
+
* 2. the process exits after a deadline whether or not cleanup finished, and
|
|
15
|
+
* at once on a second signal.
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export const CHILD_GRACE_MS = 3_000;
|
|
20
|
+
export const EXIT_DEADLINE_MS = 8_000;
|
|
21
|
+
/** SIGTERM now, SIGKILL after `graceMs` if the child is still running. */
|
|
22
|
+
export function terminateChild(child, graceMs = CHILD_GRACE_MS) {
|
|
23
|
+
if (child.exitCode !== null || child.signalCode !== null)
|
|
24
|
+
return;
|
|
25
|
+
child.kill('SIGTERM');
|
|
26
|
+
const timer = setTimeout(() => {
|
|
27
|
+
if (child.exitCode === null && child.signalCode === null)
|
|
28
|
+
child.kill('SIGKILL');
|
|
29
|
+
}, graceMs);
|
|
30
|
+
timer.unref();
|
|
31
|
+
child.once('exit', () => clearTimeout(timer));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Returns a signal handler. First call: run `onShutdown` and arm the exit
|
|
35
|
+
* deadline. Any later call: exit immediately — a second Ctrl-C or a second
|
|
36
|
+
* `kill` means "now", and the first one evidently was not enough.
|
|
37
|
+
*/
|
|
38
|
+
export function createShutdownHandler(opts) {
|
|
39
|
+
const exit = opts.exit ?? ((code) => process.exit(code));
|
|
40
|
+
let started = false;
|
|
41
|
+
return () => {
|
|
42
|
+
if (started) {
|
|
43
|
+
exit(1);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
started = true;
|
|
47
|
+
const timer = setTimeout(() => exit(0), opts.deadlineMs ?? EXIT_DEADLINE_MS);
|
|
48
|
+
timer.unref();
|
|
49
|
+
try {
|
|
50
|
+
opts.onShutdown();
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
exit(1);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=gracefulShutdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gracefulShutdown.js","sourceRoot":"","sources":["../../src/lib/gracefulShutdown.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,MAAM,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,CAAA;QACnB,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,CAAC,CAAC,CAAA;QACT,CAAC;IACH,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph identity for spawned agents.
|
|
3
|
+
*
|
|
4
|
+
* A multi-agent run is a graph: a lead agent spawns workers, workers spawn their
|
|
5
|
+
* own. The proxy can only reason about that shape — fan-out, recursion depth,
|
|
6
|
+
* orphaned children, fleet spend — if each request says which node it came from.
|
|
7
|
+
* Nothing set that. `identity_from_headers` read W3C `baggage` and `x-intutic-*`
|
|
8
|
+
* headers that only its own tests ever wrote, so `graph_id` always fell back to
|
|
9
|
+
* `session_id`, and the gate at `proxy.rs` (`node.graph_id == session_id` → "a
|
|
10
|
+
* graph of one") made the whole membership and spend block unreachable.
|
|
11
|
+
*
|
|
12
|
+
* # Why environment variables, and why a path prefix
|
|
13
|
+
*
|
|
14
|
+
* A spawned agent is a child *process*, and the one thing a child process
|
|
15
|
+
* inherits for free is the environment. So identity lives in env vars, and each
|
|
16
|
+
* `intutic exec` derives its own position from what it inherited: same graph, new
|
|
17
|
+
* node, parent = whoever spawned me, depth + 1. Nesting `intutic exec` inside an
|
|
18
|
+
* agent is precisely the "an agent spawned an agent" event, so no harness needs
|
|
19
|
+
* to cooperate for the shape to be recorded.
|
|
20
|
+
*
|
|
21
|
+
* Getting that identity onto the wire is the harder half. Env vars are not HTTP
|
|
22
|
+
* headers, and almost no harness lets you add headers — Claude Code has
|
|
23
|
+
* `ANTHROPIC_CUSTOM_HEADERS` and the rest of the ecosystem has nothing. What they
|
|
24
|
+
* all accept is a base URL, which they append their own path to. So identity
|
|
25
|
+
* rides in the base URL as `/_i/{graph}/{node}/{parent}/{depth}`, which the proxy
|
|
26
|
+
* strips before anything else looks at the path.
|
|
27
|
+
*
|
|
28
|
+
* # Trust
|
|
29
|
+
*
|
|
30
|
+
* Client-supplied and unverifiable, exactly like the headers it complements. It
|
|
31
|
+
* describes shape for observability and self-consistency, and is never an input
|
|
32
|
+
* to authorisation. The proxy clamps depth so a caller cannot fake a recursion
|
|
33
|
+
* breach.
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
/** Set on every process under a governed run; absent means this is the root. */
|
|
38
|
+
export declare const ENV_GRAPH_ID = "INTUTIC_GRAPH_ID";
|
|
39
|
+
export declare const ENV_NODE_ID = "INTUTIC_NODE_ID";
|
|
40
|
+
export declare const ENV_PARENT_ID = "INTUTIC_PARENT_ID";
|
|
41
|
+
export declare const ENV_DEPTH = "INTUTIC_DEPTH";
|
|
42
|
+
export interface GraphIdentity {
|
|
43
|
+
graphId: string;
|
|
44
|
+
nodeId: string;
|
|
45
|
+
/** Empty for a root node. */
|
|
46
|
+
parentId: string;
|
|
47
|
+
depth: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Work out this process's position from the environment it inherited.
|
|
51
|
+
*
|
|
52
|
+
* With no inherited identity this process is a root: it starts a new graph and is
|
|
53
|
+
* its own first node. With one, it is a child of whatever spawned it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function deriveIdentity(env?: NodeJS.ProcessEnv): GraphIdentity;
|
|
56
|
+
/**
|
|
57
|
+
* The env a child process should inherit.
|
|
58
|
+
*
|
|
59
|
+
* Merged into the child's environment so that if it in turn runs `intutic exec`,
|
|
60
|
+
* `deriveIdentity` sees this node as its parent and the chain continues without
|
|
61
|
+
* anyone tracking it centrally.
|
|
62
|
+
*/
|
|
63
|
+
export declare function identityEnv(identity: GraphIdentity): Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* The base-URL prefix carrying this identity.
|
|
66
|
+
*
|
|
67
|
+
* Appended to the proxy host so every harness sends it without knowing it exists:
|
|
68
|
+
* they concatenate their own path onto the base URL, and the proxy strips the
|
|
69
|
+
* prefix back off before routing.
|
|
70
|
+
*/
|
|
71
|
+
export declare function identityPathPrefix(identity: GraphIdentity): string;
|
|
72
|
+
/**
|
|
73
|
+
* Headers for harnesses that can send them.
|
|
74
|
+
*
|
|
75
|
+
* Redundant with the path prefix and deliberately so — the proxy prefers headers,
|
|
76
|
+
* and a harness with real OpenTelemetry instrumentation will already be emitting
|
|
77
|
+
* `baggage` that supersedes both.
|
|
78
|
+
*/
|
|
79
|
+
export declare function identityHeaders(identity: GraphIdentity): Record<string, string>;
|
|
80
|
+
//# sourceMappingURL=graphIdentity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphIdentity.d.ts","sourceRoot":"","sources":["../../src/lib/graphIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAIH,gFAAgF;AAChF,eAAO,MAAM,YAAY,qBAAqB,CAAA;AAC9C,eAAO,MAAM,WAAW,oBAAoB,CAAA;AAC5C,eAAO,MAAM,aAAa,sBAAsB,CAAA;AAChD,eAAO,MAAM,SAAS,kBAAkB,CAAA;AAaxC,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;IACd,6BAA6B;IAC7B,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAOD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,aAAa,CAmBlF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO3E;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAGlE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAO/E"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph identity for spawned agents.
|
|
3
|
+
*
|
|
4
|
+
* A multi-agent run is a graph: a lead agent spawns workers, workers spawn their
|
|
5
|
+
* own. The proxy can only reason about that shape — fan-out, recursion depth,
|
|
6
|
+
* orphaned children, fleet spend — if each request says which node it came from.
|
|
7
|
+
* Nothing set that. `identity_from_headers` read W3C `baggage` and `x-intutic-*`
|
|
8
|
+
* headers that only its own tests ever wrote, so `graph_id` always fell back to
|
|
9
|
+
* `session_id`, and the gate at `proxy.rs` (`node.graph_id == session_id` → "a
|
|
10
|
+
* graph of one") made the whole membership and spend block unreachable.
|
|
11
|
+
*
|
|
12
|
+
* # Why environment variables, and why a path prefix
|
|
13
|
+
*
|
|
14
|
+
* A spawned agent is a child *process*, and the one thing a child process
|
|
15
|
+
* inherits for free is the environment. So identity lives in env vars, and each
|
|
16
|
+
* `intutic exec` derives its own position from what it inherited: same graph, new
|
|
17
|
+
* node, parent = whoever spawned me, depth + 1. Nesting `intutic exec` inside an
|
|
18
|
+
* agent is precisely the "an agent spawned an agent" event, so no harness needs
|
|
19
|
+
* to cooperate for the shape to be recorded.
|
|
20
|
+
*
|
|
21
|
+
* Getting that identity onto the wire is the harder half. Env vars are not HTTP
|
|
22
|
+
* headers, and almost no harness lets you add headers — Claude Code has
|
|
23
|
+
* `ANTHROPIC_CUSTOM_HEADERS` and the rest of the ecosystem has nothing. What they
|
|
24
|
+
* all accept is a base URL, which they append their own path to. So identity
|
|
25
|
+
* rides in the base URL as `/_i/{graph}/{node}/{parent}/{depth}`, which the proxy
|
|
26
|
+
* strips before anything else looks at the path.
|
|
27
|
+
*
|
|
28
|
+
* # Trust
|
|
29
|
+
*
|
|
30
|
+
* Client-supplied and unverifiable, exactly like the headers it complements. It
|
|
31
|
+
* describes shape for observability and self-consistency, and is never an input
|
|
32
|
+
* to authorisation. The proxy clamps depth so a caller cannot fake a recursion
|
|
33
|
+
* breach.
|
|
34
|
+
*
|
|
35
|
+
* @module
|
|
36
|
+
*/
|
|
37
|
+
import { randomBytes } from 'node:crypto';
|
|
38
|
+
/** Set on every process under a governed run; absent means this is the root. */
|
|
39
|
+
export const ENV_GRAPH_ID = 'INTUTIC_GRAPH_ID';
|
|
40
|
+
export const ENV_NODE_ID = 'INTUTIC_NODE_ID';
|
|
41
|
+
export const ENV_PARENT_ID = 'INTUTIC_PARENT_ID';
|
|
42
|
+
export const ENV_DEPTH = 'INTUTIC_DEPTH';
|
|
43
|
+
/** Stands in for "no parent" — an empty path segment would collapse. */
|
|
44
|
+
const EMPTY_SEGMENT = '-';
|
|
45
|
+
/**
|
|
46
|
+
* Depth beyond which we stop counting.
|
|
47
|
+
*
|
|
48
|
+
* Matches the proxy's clamp. A graph this deep is a runaway, which is a thing to
|
|
49
|
+
* detect rather than a number to keep incrementing.
|
|
50
|
+
*/
|
|
51
|
+
const MAX_DEPTH = 1024;
|
|
52
|
+
/** Short, URL-safe, and readable in a log line. */
|
|
53
|
+
function newIdentifier(prefix) {
|
|
54
|
+
return `${prefix}${randomBytes(8).toString('hex')}`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Work out this process's position from the environment it inherited.
|
|
58
|
+
*
|
|
59
|
+
* With no inherited identity this process is a root: it starts a new graph and is
|
|
60
|
+
* its own first node. With one, it is a child of whatever spawned it.
|
|
61
|
+
*/
|
|
62
|
+
export function deriveIdentity(env = process.env) {
|
|
63
|
+
const inheritedGraph = env[ENV_GRAPH_ID];
|
|
64
|
+
const inheritedNode = env[ENV_NODE_ID];
|
|
65
|
+
if (!inheritedGraph || !inheritedNode) {
|
|
66
|
+
const graphId = newIdentifier('g_');
|
|
67
|
+
return { graphId, nodeId: newIdentifier('n_'), parentId: '', depth: 0 };
|
|
68
|
+
}
|
|
69
|
+
const inheritedDepth = Number.parseInt(env[ENV_DEPTH] ?? '0', 10);
|
|
70
|
+
const depth = Number.isFinite(inheritedDepth) ? Math.max(0, inheritedDepth) : 0;
|
|
71
|
+
return {
|
|
72
|
+
graphId: inheritedGraph,
|
|
73
|
+
nodeId: newIdentifier('n_'),
|
|
74
|
+
// The process that spawned us is our parent, by definition.
|
|
75
|
+
parentId: inheritedNode,
|
|
76
|
+
depth: Math.min(depth + 1, MAX_DEPTH),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The env a child process should inherit.
|
|
81
|
+
*
|
|
82
|
+
* Merged into the child's environment so that if it in turn runs `intutic exec`,
|
|
83
|
+
* `deriveIdentity` sees this node as its parent and the chain continues without
|
|
84
|
+
* anyone tracking it centrally.
|
|
85
|
+
*/
|
|
86
|
+
export function identityEnv(identity) {
|
|
87
|
+
return {
|
|
88
|
+
[ENV_GRAPH_ID]: identity.graphId,
|
|
89
|
+
[ENV_NODE_ID]: identity.nodeId,
|
|
90
|
+
[ENV_PARENT_ID]: identity.parentId,
|
|
91
|
+
[ENV_DEPTH]: String(identity.depth),
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The base-URL prefix carrying this identity.
|
|
96
|
+
*
|
|
97
|
+
* Appended to the proxy host so every harness sends it without knowing it exists:
|
|
98
|
+
* they concatenate their own path onto the base URL, and the proxy strips the
|
|
99
|
+
* prefix back off before routing.
|
|
100
|
+
*/
|
|
101
|
+
export function identityPathPrefix(identity) {
|
|
102
|
+
const seg = (value) => (value === '' ? EMPTY_SEGMENT : encodeURIComponent(value));
|
|
103
|
+
return `/_i/${seg(identity.graphId)}/${seg(identity.nodeId)}/${seg(identity.parentId)}/${identity.depth}`;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Headers for harnesses that can send them.
|
|
107
|
+
*
|
|
108
|
+
* Redundant with the path prefix and deliberately so — the proxy prefers headers,
|
|
109
|
+
* and a harness with real OpenTelemetry instrumentation will already be emitting
|
|
110
|
+
* `baggage` that supersedes both.
|
|
111
|
+
*/
|
|
112
|
+
export function identityHeaders(identity) {
|
|
113
|
+
return {
|
|
114
|
+
'X-Intutic-Graph-Id': identity.graphId,
|
|
115
|
+
'X-Intutic-Node-Id': identity.nodeId,
|
|
116
|
+
'X-Intutic-Parent-Session': identity.parentId,
|
|
117
|
+
'X-Intutic-Depth': String(identity.depth),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=graphIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphIdentity.js","sourceRoot":"","sources":["../../src/lib/graphIdentity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,gFAAgF;AAChF,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAA;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,iBAAiB,CAAA;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAA;AAChD,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAA;AAExC,wEAAwE;AACxE,MAAM,aAAa,GAAG,GAAG,CAAA;AAEzB;;;;;GAKG;AACH,MAAM,SAAS,GAAG,IAAI,CAAA;AAUtB,mDAAmD;AACnD,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO,GAAG,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAA;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAyB,OAAO,CAAC,GAAG;IACjE,MAAM,cAAc,GAAG,GAAG,CAAC,YAAY,CAAC,CAAA;IACxC,MAAM,aAAa,GAAG,GAAG,CAAC,WAAW,CAAC,CAAA;IAEtC,IAAI,CAAC,cAAc,IAAI,CAAC,aAAa,EAAE,CAAC;QACtC,MAAM,OAAO,GAAG,aAAa,CAAC,IAAI,CAAC,CAAA;QACnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,IAAI,C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