@intutic/cli 1.10.0 → 2.0.0
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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsSdkGatedAdapter.d.ts","sourceRoot":"","sources":["../../src/harness/jsSdkGatedAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,uBAAuB,CAAA;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAMjD;;;;;;;sCAOsC;AACtC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC,8DAA8D;IAC9D,IAAI,EAAE,WAAW,CAAA;IACjB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAA;IACzC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;;;OASG;IACH,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACrC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;IAClB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC/B,sEAAsE;IACtE,UAAU,EAAE,MAAM,CAAA;IAClB,oFAAoF;IACpF,YAAY,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAA;CACjB;AAMD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhE;AAYD,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,uBAAuB,GAAG,eAAe,CAkFpF"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jsSdkGatedAdapter.ts — shared builder for harness adapters whose blocking
|
|
3
|
+
* gate ships SDK-side in `@intutic/gate` (packages/gate-js), with no on-disk
|
|
4
|
+
* hook/config file to write a tool-call gate into.
|
|
5
|
+
*
|
|
6
|
+
* The JS/TS-native counterpart of `sdkGatedAdapter.ts` (Wave 1's Python
|
|
7
|
+
* builder — see its module doc for why a shared factory exists instead of
|
|
8
|
+
* hand-copying one adapter per framework: the same defect-generator argument
|
|
9
|
+
* applies here). Two differences from the Python version drive most of this
|
|
10
|
+
* file's shape:
|
|
11
|
+
*
|
|
12
|
+
* 1. **Manifest format.** Python's manifests (`pyproject.toml`,
|
|
13
|
+
* `requirements.txt`, `uv.lock`) are scanned as raw text for a
|
|
14
|
+
* case-insensitive substring/regex match. `package.json` is scanned as
|
|
15
|
+
* structured JSON — `dependencies`/`devDependencies`/`peerDependencies`
|
|
16
|
+
* — because a JS/TS framework detection needs a VERSION check (the
|
|
17
|
+
* Vercel AI SDK's `toolApproval` veto point is a v6+ API; the same
|
|
18
|
+
* package name existed at lower majors with a materially different
|
|
19
|
+
* surface), which a plain substring test cannot express.
|
|
20
|
+
* 2. **The pointer comment.** Python frameworks point at
|
|
21
|
+
* `pip install intutic-clawde[...]` and a `from intutic_clawde...`
|
|
22
|
+
* import. These point at `npm install @intutic/gate` and an
|
|
23
|
+
* `import { ... } from '@intutic/gate/<subpath>'` line instead — the
|
|
24
|
+
* env file's prose says "your own Node.js process", not "your own
|
|
25
|
+
* Python process".
|
|
26
|
+
*
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
import { join, dirname } from 'node:path';
|
|
30
|
+
import { readFile, writeFile, rename, mkdir } from 'node:fs/promises';
|
|
31
|
+
import { hashFile } from '../lib/hash.js';
|
|
32
|
+
import { newIso } from '@intutic/id';
|
|
33
|
+
const CONFIG_FILE = '.env.intutic';
|
|
34
|
+
function isDigit(c) {
|
|
35
|
+
return c >= '0' && c <= '9';
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Leading major version from a semver range string, without regex — plain
|
|
39
|
+
* linear scans over the (short, locally-authored) range string, matching
|
|
40
|
+
* `gate.ts`'s `trimTrailingSlashes`/`trimLeadingSlashes` style rather than
|
|
41
|
+
* an unbounded-quantifier regex. Handles the common range prefixes
|
|
42
|
+
* (`^`, `~`, `>=`, `<=`, `>`, `<`, `=`, a leading `v`, whitespace) by simply
|
|
43
|
+
* skipping every non-digit character before the first digit run. Returns
|
|
44
|
+
* `null` when no leading digit run exists at all (`"workspace:*"`,
|
|
45
|
+
* `"latest"`, `"*"`, a git/URL range).
|
|
46
|
+
*/
|
|
47
|
+
export function leadingMajorVersion(range) {
|
|
48
|
+
let i = 0;
|
|
49
|
+
while (i < range.length && !isDigit(range[i]))
|
|
50
|
+
i++;
|
|
51
|
+
let j = i;
|
|
52
|
+
while (j < range.length && isDigit(range[j]))
|
|
53
|
+
j++;
|
|
54
|
+
if (j === i)
|
|
55
|
+
return null;
|
|
56
|
+
return parseInt(range.slice(i, j), 10);
|
|
57
|
+
}
|
|
58
|
+
function allDeps(manifest) {
|
|
59
|
+
return { ...manifest.peerDependencies, ...manifest.devDependencies, ...manifest.dependencies };
|
|
60
|
+
}
|
|
61
|
+
/** Builds an `IHarnessAdapter` for one JS/TS SDK-gated framework from its spec. */
|
|
62
|
+
export function makeJsSdkGatedAdapter(spec) {
|
|
63
|
+
return {
|
|
64
|
+
type: spec.type,
|
|
65
|
+
configFileName: CONFIG_FILE,
|
|
66
|
+
async detect(workspaceRoot) {
|
|
67
|
+
let manifest;
|
|
68
|
+
try {
|
|
69
|
+
const raw = await readFile(join(workspaceRoot, 'package.json'), 'utf-8');
|
|
70
|
+
manifest = JSON.parse(raw);
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
return false; // no package.json, or unparseable — not a JS/TS workspace we can read
|
|
74
|
+
}
|
|
75
|
+
const deps = allDeps(manifest);
|
|
76
|
+
for (const req of spec.requires) {
|
|
77
|
+
const range = deps[req.name];
|
|
78
|
+
if (range === undefined)
|
|
79
|
+
return false;
|
|
80
|
+
if (req.minMajor !== undefined) {
|
|
81
|
+
const major = leadingMajorVersion(range);
|
|
82
|
+
if (major === null || major < req.minMajor)
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (spec.requiresPrefix !== undefined) {
|
|
87
|
+
const hasPrefixed = Object.keys(deps).some((name) => name.startsWith(spec.requiresPrefix));
|
|
88
|
+
if (!hasPrefixed)
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (spec.requiresAnyPrefix !== undefined) {
|
|
92
|
+
const hasAny = Object.keys(deps).some((name) => spec.requiresAnyPrefix.some((prefix) => name.startsWith(prefix)));
|
|
93
|
+
if (!hasAny)
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
},
|
|
98
|
+
async writeConfig(workspaceRoot, sops, proxyUrl) {
|
|
99
|
+
const filePath = join(workspaceRoot, CONFIG_FILE);
|
|
100
|
+
const preamble = spec.envPreamble ?? [
|
|
101
|
+
`These env vars govern LLM egress only. ${spec.label} tools run in your own`,
|
|
102
|
+
'Node.js process, where no config or hook file can gate them — the',
|
|
103
|
+
'blocking tool gate ships SDK-side:',
|
|
104
|
+
];
|
|
105
|
+
const envContent = [
|
|
106
|
+
'# Intutic Governance Rules (auto-generated)',
|
|
107
|
+
'# DO NOT EDIT — managed by intutic sync daemon',
|
|
108
|
+
`# Last sync: ${newIso()}`,
|
|
109
|
+
'# Source this file: source .env.intutic',
|
|
110
|
+
'',
|
|
111
|
+
`export ANTHROPIC_BASE_URL="${proxyUrl}"`,
|
|
112
|
+
`export OPENAI_BASE_URL="${proxyUrl}"`,
|
|
113
|
+
`export INTUTIC_PROXY_URL="${proxyUrl}"`,
|
|
114
|
+
`export INTUTIC_SOP_COUNT=${sops.length}`,
|
|
115
|
+
'',
|
|
116
|
+
...preamble.map((line) => `# ${line}`),
|
|
117
|
+
`# npm install ${spec.npmInstall}`,
|
|
118
|
+
`# ${spec.importLine}`,
|
|
119
|
+
`# ${spec.usageSummary}`,
|
|
120
|
+
`# See https://docs.intutic.ai/integrations/${spec.docsSlug}`,
|
|
121
|
+
'',
|
|
122
|
+
].join('\n');
|
|
123
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
124
|
+
const tmpEnv = filePath + '.intutic-tmp';
|
|
125
|
+
await writeFile(tmpEnv, envContent, 'utf-8');
|
|
126
|
+
await rename(tmpEnv, filePath);
|
|
127
|
+
return filePath;
|
|
128
|
+
},
|
|
129
|
+
async readCurrentHash(workspaceRoot) {
|
|
130
|
+
try {
|
|
131
|
+
return await hashFile(join(workspaceRoot, CONFIG_FILE));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=jsSdkGatedAdapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsSdkGatedAdapter.js","sourceRoot":"","sources":["../../src/harness/jsSdkGatedAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AAGrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gB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,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;YACzD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,IAAI,CAAA;YACb,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* langchain.ts — LangChain adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Same shape as langgraph.ts (see sdkGatedAdapter.ts): writes .env.intutic
|
|
5
|
+
* with proxy base-URL env vars, plus a comment pointing at the SDK-side tool
|
|
6
|
+
* gate — LangChain has no on-disk hook/config file either, since its tools
|
|
7
|
+
* run as plain Python callables/objects in the agent's own process.
|
|
8
|
+
*
|
|
9
|
+
* Detection is Python-only on purpose. LangChain ships in both the Python
|
|
10
|
+
* (`langchain`/`langchain-core`) and JS/TS (`langchain` npm package)
|
|
11
|
+
* ecosystems, and the HarnessType.LANGCHAIN enum member covers both for
|
|
12
|
+
* *detection* purposes (see its doc comment in shared-types/enums.ts) — but
|
|
13
|
+
* this env-adapter only writes Python env vars, matching the
|
|
14
|
+
* `intutic_clawde.gate.adapters.langchain` gate it points at. A JS/TS
|
|
15
|
+
* tool-call gate for LangChain.js is a `@intutic/gate` TypeScript package
|
|
16
|
+
* concern for a later phase, not this adapter.
|
|
17
|
+
*
|
|
18
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
export declare const langchainAdapter: import("./types.js").IHarnessAdapter;
|
|
22
|
+
//# sourceMappingURL=langchain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.d.ts","sourceRoot":"","sources":["../../src/harness/langchain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAKH,eAAO,MAAM,gBAAgB,sCAU3B,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* langchain.ts — LangChain adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Same shape as langgraph.ts (see sdkGatedAdapter.ts): writes .env.intutic
|
|
5
|
+
* with proxy base-URL env vars, plus a comment pointing at the SDK-side tool
|
|
6
|
+
* gate — LangChain has no on-disk hook/config file either, since its tools
|
|
7
|
+
* run as plain Python callables/objects in the agent's own process.
|
|
8
|
+
*
|
|
9
|
+
* Detection is Python-only on purpose. LangChain ships in both the Python
|
|
10
|
+
* (`langchain`/`langchain-core`) and JS/TS (`langchain` npm package)
|
|
11
|
+
* ecosystems, and the HarnessType.LANGCHAIN enum member covers both for
|
|
12
|
+
* *detection* purposes (see its doc comment in shared-types/enums.ts) — but
|
|
13
|
+
* this env-adapter only writes Python env vars, matching the
|
|
14
|
+
* `intutic_clawde.gate.adapters.langchain` gate it points at. A JS/TS
|
|
15
|
+
* tool-call gate for LangChain.js is a `@intutic/gate` TypeScript package
|
|
16
|
+
* concern for a later phase, not this adapter.
|
|
17
|
+
*
|
|
18
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
import { HarnessType } from '@intutic/shared-types';
|
|
22
|
+
import { makeSdkGatedAdapter } from './sdkGatedAdapter.js';
|
|
23
|
+
export const langchainAdapter = makeSdkGatedAdapter({
|
|
24
|
+
type: HarnessType.LANGCHAIN,
|
|
25
|
+
label: 'LangChain',
|
|
26
|
+
keywords: ['langchain'], // matches "langchain" and "langchain-core"
|
|
27
|
+
pipInstall: 'intutic-clawde[langchain]',
|
|
28
|
+
importLine: 'from intutic_clawde.gate.adapters.langchain import IntuticMiddleware',
|
|
29
|
+
usageSummary: 'IntuticMiddleware.wrap_tool_call (LangChain v1.x AgentMiddleware) — or guard_tools ' +
|
|
30
|
+
'for pre-1.0 LangChain — refuses denied calls before the tool body runs.',
|
|
31
|
+
docsSlug: 'langchain',
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=langchain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langchain.js","sourceRoot":"","sources":["../../src/harness/langchain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;IAClD,IAAI,EAAE,WAAW,CAAC,SAAS;IAC3B,KAAK,EAAE,WAAW;IAClB,QAAQ,EAAE,CAAC,WAAW,CAAC,EAAE,2CAA2C;IACpE,UAAU,EAAE,2BAA2B;IACvC,UAAU,EAAE,sEAAsE;IAClF,YAAY,EACV,qFAAqF;QACrF,yEAAyE;IAC3E,QAAQ,EAAE,WAAW;CACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* langgraph.ts — LangGraph adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Writes the workspace .env.intutic file with proxy base-URL env vars so
|
|
5
|
+
* LangGraph's ChatOpenAI/ChatAnthropic clients route LLM calls through the
|
|
6
|
+
* Intutic proxy. Trace attribution comes from the `x-intutic-harness:
|
|
7
|
+
* langgraph` header the SDK sends (honoured by the proxy since 0583ef74).
|
|
8
|
+
*
|
|
9
|
+
* Unlike hook-based harnesses, LangGraph has NO on-disk config or hook file
|
|
10
|
+
* the sync daemon can write a tool-call gate into: tools are plain Python
|
|
11
|
+
* callables inside the agent's own process. The blocking gate ships SDK-side
|
|
12
|
+
* in `intutic-clawde` (`intutic_clawde.gate`, python-raise contract), which
|
|
13
|
+
* evaluates the policy snapshot + A3 SOP argPattern rules in-process before
|
|
14
|
+
* the tool body runs — so the env file this adapter writes also carries a
|
|
15
|
+
* comment block pointing developers at that gate.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { IHarnessAdapter } from './types.js';
|
|
21
|
+
export declare const langgraphAdapter: IHarnessAdapter;
|
|
22
|
+
//# sourceMappingURL=langgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langgraph.d.ts","sourceRoot":"","sources":["../../src/harness/langgraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AASjD,eAAO,MAAM,gBAAgB,EAAE,eAqD9B,CAAA"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* langgraph.ts — LangGraph adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Writes the workspace .env.intutic file with proxy base-URL env vars so
|
|
5
|
+
* LangGraph's ChatOpenAI/ChatAnthropic clients route LLM calls through the
|
|
6
|
+
* Intutic proxy. Trace attribution comes from the `x-intutic-harness:
|
|
7
|
+
* langgraph` header the SDK sends (honoured by the proxy since 0583ef74).
|
|
8
|
+
*
|
|
9
|
+
* Unlike hook-based harnesses, LangGraph has NO on-disk config or hook file
|
|
10
|
+
* the sync daemon can write a tool-call gate into: tools are plain Python
|
|
11
|
+
* callables inside the agent's own process. The blocking gate ships SDK-side
|
|
12
|
+
* in `intutic-clawde` (`intutic_clawde.gate`, python-raise contract), which
|
|
13
|
+
* evaluates the policy snapshot + A3 SOP argPattern rules in-process before
|
|
14
|
+
* the tool body runs — so the env file this adapter writes also carries a
|
|
15
|
+
* comment block pointing developers at that gate.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { join, dirname } from 'node:path';
|
|
21
|
+
import { readFile, writeFile, rename, mkdir } from 'node:fs/promises';
|
|
22
|
+
import { HarnessType } from '@intutic/shared-types';
|
|
23
|
+
import { hashFile } from '../lib/hash.js';
|
|
24
|
+
import { newIso } from '@intutic/id';
|
|
25
|
+
const CONFIG_FILE = '.env.intutic';
|
|
26
|
+
/** Dependency manifests scanned for a langgraph/langchain dependency. */
|
|
27
|
+
const MANIFEST_FILES = ['pyproject.toml', 'requirements.txt', 'uv.lock'];
|
|
28
|
+
export const langgraphAdapter = {
|
|
29
|
+
type: HarnessType.LANGGRAPH,
|
|
30
|
+
configFileName: CONFIG_FILE,
|
|
31
|
+
async detect(workspaceRoot) {
|
|
32
|
+
for (const manifest of MANIFEST_FILES) {
|
|
33
|
+
try {
|
|
34
|
+
const content = await readFile(join(workspaceRoot, manifest), 'utf-8');
|
|
35
|
+
const lower = content.toLowerCase();
|
|
36
|
+
if (lower.includes('langgraph') || lower.includes('langchain'))
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch { /* manifest not present */ }
|
|
40
|
+
}
|
|
41
|
+
return false;
|
|
42
|
+
},
|
|
43
|
+
async writeConfig(workspaceRoot, sops, proxyUrl) {
|
|
44
|
+
const filePath = join(workspaceRoot, CONFIG_FILE);
|
|
45
|
+
const envContent = [
|
|
46
|
+
'# Intutic Governance Rules (auto-generated)',
|
|
47
|
+
'# DO NOT EDIT — managed by intutic sync daemon',
|
|
48
|
+
`# Last sync: ${newIso()}`,
|
|
49
|
+
'# Source this file: source .env.intutic',
|
|
50
|
+
'',
|
|
51
|
+
`export ANTHROPIC_BASE_URL="${proxyUrl}"`,
|
|
52
|
+
`export OPENAI_BASE_URL="${proxyUrl}"`,
|
|
53
|
+
`export INTUTIC_PROXY_URL="${proxyUrl}"`,
|
|
54
|
+
`export INTUTIC_SOP_COUNT=${sops.length}`,
|
|
55
|
+
'',
|
|
56
|
+
'# These env vars govern LLM egress only. LangGraph tools run in your own',
|
|
57
|
+
'# Python process, where no config or hook file can gate them — the',
|
|
58
|
+
'# blocking tool gate ships SDK-side:',
|
|
59
|
+
'# pip install intutic-clawde',
|
|
60
|
+
'# from intutic_clawde.gate import guard_tools',
|
|
61
|
+
'# guard_tools(tools) refuses denied calls by raising, before the tool',
|
|
62
|
+
'# body runs. See https://docs.intutic.ai/integrations/langgraph',
|
|
63
|
+
'',
|
|
64
|
+
].join('\n');
|
|
65
|
+
await mkdir(dirname(filePath), { recursive: true });
|
|
66
|
+
const tmpEnv = filePath + '.intutic-tmp';
|
|
67
|
+
await writeFile(tmpEnv, envContent, 'utf-8');
|
|
68
|
+
await rename(tmpEnv, filePath);
|
|
69
|
+
return filePath;
|
|
70
|
+
},
|
|
71
|
+
async readCurrentHash(workspaceRoot) {
|
|
72
|
+
try {
|
|
73
|
+
return await hashFile(join(workspaceRoot, CONFIG_FILE));
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=langgraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"langgraph.js","sourceRoot":"","sources":["../../src/harness/langgraph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAGnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AAEpC,MAAM,WAAW,GAAG,cAAc,CAAA;AAElC,yEAAyE;AACzE,MAAM,cAAc,GAAG,CAAC,gBAAgB,EAAE,kBAAkB,EAAE,SAAS,CAAC,CAAA;AAExE,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,IAAI,EAAE,WAAW,CAAC,SAAS;IAC3B,cAAc,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O,CAAC,CAAA;QAC5C,MAAM,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QAE9B,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,aAAqB;QACzC,IAAI,CAAC;YACH,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAA;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mastra.ts — Mastra adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Same shape as langgraph.ts's Python-side siblings (see
|
|
5
|
+
* jsSdkGatedAdapter.ts), but JS/TS-native: detected via `@mastra/core` in
|
|
6
|
+
* `package.json` (any version — the `beforeToolCall` hook this points at
|
|
7
|
+
* has been present since early 1.x), and points at
|
|
8
|
+
* `@intutic/gate/mastra`'s `intuticHooks()` rather than an `intutic-clawde`
|
|
9
|
+
* import.
|
|
10
|
+
*
|
|
11
|
+
* TAMPER NOTE: Mastra's per-call `hooks` option (passed to `.generate()`/
|
|
12
|
+
* `.stream()`) OVERRIDES agent-level hooks entirely rather than merging with
|
|
13
|
+
* them — a caller who passes their own `hooks` at call time silently
|
|
14
|
+
* disables this gate. See `@intutic/gate/mastra`'s module doc and
|
|
15
|
+
* `gateRegistry.ts`'s `mastra` NO_GATE row for the full, confirmed record.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export declare const mastraAdapter: import("./types.js").IHarnessAdapter;
|
|
21
|
+
//# sourceMappingURL=mastra.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastra.d.ts","sourceRoot":"","sources":["../../src/harness/mastra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,eAAO,MAAM,aAAa,sCAWxB,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mastra.ts — Mastra adapter (env-file config, SDK-side gate).
|
|
3
|
+
*
|
|
4
|
+
* Same shape as langgraph.ts's Python-side siblings (see
|
|
5
|
+
* jsSdkGatedAdapter.ts), but JS/TS-native: detected via `@mastra/core` in
|
|
6
|
+
* `package.json` (any version — the `beforeToolCall` hook this points at
|
|
7
|
+
* has been present since early 1.x), and points at
|
|
8
|
+
* `@intutic/gate/mastra`'s `intuticHooks()` rather than an `intutic-clawde`
|
|
9
|
+
* import.
|
|
10
|
+
*
|
|
11
|
+
* TAMPER NOTE: Mastra's per-call `hooks` option (passed to `.generate()`/
|
|
12
|
+
* `.stream()`) OVERRIDES agent-level hooks entirely rather than merging with
|
|
13
|
+
* them — a caller who passes their own `hooks` at call time silently
|
|
14
|
+
* disables this gate. See `@intutic/gate/mastra`'s module doc and
|
|
15
|
+
* `gateRegistry.ts`'s `mastra` NO_GATE row for the full, confirmed record.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { HarnessType } from '@intutic/shared-types';
|
|
21
|
+
import { makeJsSdkGatedAdapter } from './jsSdkGatedAdapter.js';
|
|
22
|
+
export const mastraAdapter = makeJsSdkGatedAdapter({
|
|
23
|
+
type: HarnessType.MASTRA,
|
|
24
|
+
label: 'Mastra',
|
|
25
|
+
requires: [{ name: '@mastra/core' }],
|
|
26
|
+
npmInstall: '@intutic/gate',
|
|
27
|
+
importLine: "import { intuticHooks } from '@intutic/gate/mastra'",
|
|
28
|
+
usageSummary: "new Agent({ ..., hooks: intuticHooks() }) — Mastra's beforeToolCall veto point, run for " +
|
|
29
|
+
'every tool in the assembled tool dictionary (MCP-sourced tools included). NOTE: per-call ' +
|
|
30
|
+
'`hooks` on .generate()/.stream() OVERRIDE this, not merge with it — see the module doc.',
|
|
31
|
+
docsSlug: 'mastra',
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=mastra.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastra.js","sourceRoot":"","sources":["../../src/harness/mastra.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAA;AAE9D,MAAM,CAAC,MAAM,aAAa,GAAG,qBAAqB,CAAC;IACjD,IAAI,EAAE,WAAW,CAAC,MAAM;IACxB,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IACpC,UAAU,EAAE,eAAe;IAC3B,UAAU,EAAE,qDAAqD;IACjE,YAAY,EACV,0FAA0F;QAC1F,2FAA2F;QAC3F,yFAAyF;IAC3F,QAAQ,EAAE,QAAQ;CACnB,CAAC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* muse.ts — Meta "Muse Code" adapter (binary `muse`, model Muse Spark).
|
|
3
|
+
*
|
|
4
|
+
* Muse Code is a CLI harness, beta since 2026-08-05. Its rules/instructions
|
|
5
|
+
* file is `AGENTS.md` (it falls back to `CLAUDE.md` when that is absent) —
|
|
6
|
+
* this codebase has no dedicated "AGENTS.md content builder" of its own to
|
|
7
|
+
* reuse; the shared markdown content path every text-rules harness already
|
|
8
|
+
* uses (`buildMarkdownContent`, the same function Claude Code's `CLAUDE.md`
|
|
9
|
+
* adapter calls) is what gets reused here, so Muse does not grow a second
|
|
10
|
+
* rules format.
|
|
11
|
+
*
|
|
12
|
+
* The governance-critical half — the PreToolUse/PermissionRequest hook
|
|
13
|
+
* registration and the MCP `mcp_servers` proxy-wrap — is delegated to
|
|
14
|
+
* `@intutic/sync-daemon`'s `museHooks.ts`, the same split Goose's adapter
|
|
15
|
+
* uses for its plugin installation.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import type { IHarnessAdapter } from './types.js';
|
|
21
|
+
export declare const museAdapter: IHarnessAdapter;
|
|
22
|
+
//# sourceMappingURL=muse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muse.d.ts","sourceRoot":"","sources":["../../src/harness/muse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAYjD,eAAO,MAAM,WAAW,EAAE,eA2DzB,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* muse.ts — Meta "Muse Code" adapter (binary `muse`, model Muse Spark).
|
|
3
|
+
*
|
|
4
|
+
* Muse Code is a CLI harness, beta since 2026-08-05. Its rules/instructions
|
|
5
|
+
* file is `AGENTS.md` (it falls back to `CLAUDE.md` when that is absent) —
|
|
6
|
+
* this codebase has no dedicated "AGENTS.md content builder" of its own to
|
|
7
|
+
* reuse; the shared markdown content path every text-rules harness already
|
|
8
|
+
* uses (`buildMarkdownContent`, the same function Claude Code's `CLAUDE.md`
|
|
9
|
+
* adapter calls) is what gets reused here, so Muse does not grow a second
|
|
10
|
+
* rules format.
|
|
11
|
+
*
|
|
12
|
+
* The governance-critical half — the PreToolUse/PermissionRequest hook
|
|
13
|
+
* registration and the MCP `mcp_servers` proxy-wrap — is delegated to
|
|
14
|
+
* `@intutic/sync-daemon`'s `museHooks.ts`, the same split Goose's adapter
|
|
15
|
+
* uses for its plugin installation.
|
|
16
|
+
*
|
|
17
|
+
* HLD §3.14 — Harness Onboarding Matrix
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import { join, dirname } from 'node:path';
|
|
21
|
+
import { access, writeFile, rename, mkdir } from 'node:fs/promises';
|
|
22
|
+
import { homedir } from 'node:os';
|
|
23
|
+
import { HarnessType } from '@intutic/shared-types';
|
|
24
|
+
import { hashFile } from '../lib/hash.js';
|
|
25
|
+
import { buildMarkdownContent } from './base.js';
|
|
26
|
+
import { writeMuseHooks } from '@intutic/sync-daemon/harness/museHooks';
|
|
27
|
+
/** Workspace-relative rules file. Muse reads this, falling back to CLAUDE.md. */
|
|
28
|
+
const CONFIG_FILE = 'AGENTS.md';
|
|
29
|
+
/** `~/.config/muse/settings.json` — carries `schema_version`, `mcp_servers`,
|
|
30
|
+
* and (once `museHooks.ts` has run) `managed_hooks_path`. */
|
|
31
|
+
const MUSE_SETTINGS = join(homedir(), '.config', 'muse', 'settings.json');
|
|
32
|
+
export const museAdapter = {
|
|
33
|
+
type: HarnessType.MUSE_CODE,
|
|
34
|
+
configFileName: CONFIG_FILE,
|
|
35
|
+
async detect(workspaceRoot) {
|
|
36
|
+
// 1. Project-local `.muse/` directory.
|
|
37
|
+
try {
|
|
38
|
+
await access(join(workspaceRoot, '.muse'));
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
catch { /* not here */ }
|
|
42
|
+
// 2. User-level settings.json — installed but never run in this workspace.
|
|
43
|
+
try {
|
|
44
|
+
await access(MUSE_SETTINGS);
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
catch { /* not here */ }
|
|
48
|
+
// 3. `muse` binary on PATH.
|
|
49
|
+
const pathDirs = (process.env.PATH ?? '').split(process.platform === 'win32' ? ';' : ':');
|
|
50
|
+
try {
|
|
51
|
+
const { accessSync } = await import('node:fs');
|
|
52
|
+
for (const dir of pathDirs) {
|
|
53
|
+
try {
|
|
54
|
+
accessSync(join(dir, 'muse'));
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
catch { /* not here */ }
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch { /* ignore */ }
|
|
61
|
+
return false;
|
|
62
|
+
},
|
|
63
|
+
async writeConfig(workspaceRoot, sops, proxyUrl) {
|
|
64
|
+
const agentsPath = join(workspaceRoot, CONFIG_FILE);
|
|
65
|
+
// 1. AGENTS.md rules file — same "skip when there is nothing to write"
|
|
66
|
+
// convention `createMarkdownAdapter` uses; unlike Goose, Muse DOES
|
|
67
|
+
// have a rules file, so sops are not ignored here.
|
|
68
|
+
if (sops.length > 0) {
|
|
69
|
+
const content = buildMarkdownContent(sops, proxyUrl);
|
|
70
|
+
await mkdir(dirname(agentsPath), { recursive: true });
|
|
71
|
+
const tmp = agentsPath + '.intutic-tmp';
|
|
72
|
+
await writeFile(tmp, content, 'utf-8');
|
|
73
|
+
await rename(tmp, agentsPath);
|
|
74
|
+
}
|
|
75
|
+
// 2. PreToolUse/PermissionRequest hooks (project .muse/hooks.json +
|
|
76
|
+
// managed_hooks_path merge into ~/.config/muse/settings.json).
|
|
77
|
+
// `intutic connect` has no workspace id in scope — same limitation
|
|
78
|
+
// `gooseAdapter` has — the sync daemon re-runs this with a real one
|
|
79
|
+
// on the next cycle.
|
|
80
|
+
await writeMuseHooks(workspaceRoot, proxyUrl, '');
|
|
81
|
+
return agentsPath;
|
|
82
|
+
},
|
|
83
|
+
async readCurrentHash(workspaceRoot) {
|
|
84
|
+
try {
|
|
85
|
+
return await hashFile(join(workspaceRoot, CONFIG_FILE));
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=muse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"muse.js","sourceRoot":"","sources":["../../src/harness/muse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EA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CAAA;QACb,CAAC;IACH,CAAC;CACF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n.d.ts","sourceRoot":"","sources":["../../src/harness/n8n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"n8n.d.ts","sourceRoot":"","sources":["../../src/harness/n8n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAwEjD,eAAO,MAAM,UAAU,EAAE,eAoIxB,CAAA"}
|
package/dist/harness/n8n.js
CHANGED
|
@@ -60,6 +60,7 @@ export const n8nAdapter = {
|
|
|
60
60
|
return 'n8n:no_workflows';
|
|
61
61
|
}
|
|
62
62
|
// 2. Inject parameters into variables of each workflow
|
|
63
|
+
let updated = 0;
|
|
63
64
|
for (const w of workflows) {
|
|
64
65
|
const detailRes = await fetch(`${n8nUrl}/api/v1/workflows/${w.id}`, {
|
|
65
66
|
headers: getHeaders(),
|
|
@@ -68,22 +69,46 @@ export const n8nAdapter = {
|
|
|
68
69
|
if (!detailRes.ok)
|
|
69
70
|
continue;
|
|
70
71
|
const detail = (await detailRes.json());
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
72
|
+
// Inject Intutic values, preserving the workflow's own settings and
|
|
73
|
+
// any variables it already had.
|
|
74
|
+
const settings = {
|
|
75
|
+
...detail.settings,
|
|
76
|
+
variables: {
|
|
77
|
+
...detail.settings?.variables,
|
|
78
|
+
intutic_proxy_url: proxyUrl,
|
|
79
|
+
intutic_governance_rules: sopsMarkdown,
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
// Only the writable fields — see N8nWorkflowUpdateBody. Echoing the
|
|
83
|
+
// whole GET payload back (which is what this used to do) is rejected
|
|
84
|
+
// by the API's additionalProperties check.
|
|
85
|
+
const body = {
|
|
86
|
+
name: detail.name ?? w.name ?? 'Untitled',
|
|
87
|
+
nodes: detail.nodes ?? [],
|
|
88
|
+
connections: detail.connections ?? {},
|
|
89
|
+
settings,
|
|
90
|
+
};
|
|
91
|
+
if (detail.staticData !== undefined) {
|
|
92
|
+
body.staticData = detail.staticData;
|
|
93
|
+
}
|
|
78
94
|
// Save updated workflow
|
|
79
|
-
await fetch(`${n8nUrl}/api/v1/workflows/${w.id}`, {
|
|
95
|
+
const updateRes = await fetch(`${n8nUrl}/api/v1/workflows/${w.id}`, {
|
|
80
96
|
method: 'PUT',
|
|
81
97
|
headers: getHeaders(),
|
|
82
|
-
body: JSON.stringify(
|
|
98
|
+
body: JSON.stringify(body),
|
|
83
99
|
signal: AbortSignal.timeout(5000),
|
|
84
100
|
});
|
|
101
|
+
if (!updateRes.ok) {
|
|
102
|
+
console.warn(`[n8n-adapter] workflow ${w.id} was not updated: HTTP ${updateRes.status} ${updateRes.statusText}`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
updated++;
|
|
85
106
|
}
|
|
86
|
-
|
|
107
|
+
// Reporting a write that every workflow rejected as a success left the
|
|
108
|
+
// sync daemon recording a config version it had never applied.
|
|
109
|
+
if (updated === 0)
|
|
110
|
+
return null;
|
|
111
|
+
return `n8n:${updated}_workflows`;
|
|
87
112
|
}
|
|
88
113
|
catch (err) {
|
|
89
114
|
console.warn(`[n8n-adapter] failed to sync parameters:`, err);
|
|
@@ -112,7 +137,7 @@ export const n8nAdapter = {
|
|
|
112
137
|
if (!detailRes.ok)
|
|
113
138
|
return null;
|
|
114
139
|
const detail = (await detailRes.json());
|
|
115
|
-
const rules = detail.settings?.variables?.intutic_governance_rules
|
|
140
|
+
const rules = detail.settings?.variables?.intutic_governance_rules ?? '';
|
|
116
141
|
if (!rules)
|
|
117
142
|
return null;
|
|
118
143
|
return createHash('sha256').update(rules, 'utf-8').digest('hex');
|
package/dist/harness/n8n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"n8n.js","sourceRoot":"","sources":["../../src/harness/n8n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"n8n.js","sourceRoot":"","sources":["../../src/harness/n8n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AA0DnD,iCAAiC;AACjC,SAAS,iBAAiB,CAAC,IAAoB;IAC7C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IAChC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,KAAK,OAAO,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,IAAI,CAAA;AAC1F,CAAC;AAED,SAAS,UAAU;IACjB,MAAM,OAAO,GAA2B;QACtC,cAAc,EAAE,kBAAkB;KACnC,CAAA;IACD,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC;QAC9B,OAAO,CAAC,eAAe,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAA;IACtD,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAoB;IACzC,IAAI,EAAE,WAAW,CAAC,GAAG;IACrB,cAAc,EAAE,EAAE;IAElB,KAAK,CAAC,MAAM,CAAC,cAAsB;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,uBAAuB,CAAA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