@intutic/sync-daemon 1.9.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 +2 -2
- package/dist/agentReporter.d.ts +205 -0
- package/dist/agentReporter.d.ts.map +1 -0
- package/dist/agentReporter.js +394 -0
- package/dist/agentReporter.js.map +1 -0
- package/dist/configReader.d.ts +39 -2
- package/dist/configReader.d.ts.map +1 -1
- package/dist/configReader.js +56 -2
- package/dist/configReader.js.map +1 -1
- package/dist/configWriter.d.ts +51 -1
- package/dist/configWriter.d.ts.map +1 -1
- package/dist/configWriter.js +490 -63
- package/dist/configWriter.js.map +1 -1
- package/dist/harness/antigravityHooks.d.ts.map +1 -1
- package/dist/harness/antigravityHooks.js +33 -55
- package/dist/harness/antigravityHooks.js.map +1 -1
- package/dist/harness/claudeCodeHooks.d.ts +47 -13
- package/dist/harness/claudeCodeHooks.d.ts.map +1 -1
- package/dist/harness/claudeCodeHooks.js +323 -55
- package/dist/harness/claudeCodeHooks.js.map +1 -1
- package/dist/harness/claudeDesktopHooks.d.ts.map +1 -1
- package/dist/harness/claudeDesktopHooks.js +35 -48
- package/dist/harness/claudeDesktopHooks.js.map +1 -1
- package/dist/harness/clineHooks.d.ts.map +1 -1
- package/dist/harness/clineHooks.js +42 -34
- package/dist/harness/clineHooks.js.map +1 -1
- package/dist/harness/codexHooks.d.ts +36 -0
- package/dist/harness/codexHooks.d.ts.map +1 -0
- package/dist/harness/codexHooks.js +227 -0
- package/dist/harness/codexHooks.js.map +1 -0
- package/dist/harness/continueHooks.d.ts +45 -5
- package/dist/harness/continueHooks.d.ts.map +1 -1
- package/dist/harness/continueHooks.js +225 -5
- package/dist/harness/continueHooks.js.map +1 -1
- package/dist/harness/cursorHooks.d.ts +31 -0
- package/dist/harness/cursorHooks.d.ts.map +1 -1
- package/dist/harness/cursorHooks.js +78 -49
- package/dist/harness/cursorHooks.js.map +1 -1
- package/dist/harness/dshHooks.d.ts +198 -0
- package/dist/harness/dshHooks.d.ts.map +1 -0
- package/dist/harness/dshHooks.js +569 -0
- package/dist/harness/dshHooks.js.map +1 -0
- package/dist/harness/gateBody.d.ts +422 -0
- package/dist/harness/gateBody.d.ts.map +1 -0
- package/dist/harness/gateBody.js +1816 -0
- package/dist/harness/gateBody.js.map +1 -0
- package/dist/harness/gateKind.d.ts +164 -0
- package/dist/harness/gateKind.d.ts.map +1 -0
- package/dist/harness/gateKind.js +143 -0
- package/dist/harness/gateKind.js.map +1 -0
- package/dist/harness/githubCopilotHooks.d.ts +54 -0
- package/dist/harness/githubCopilotHooks.d.ts.map +1 -0
- package/dist/harness/githubCopilotHooks.js +218 -0
- package/dist/harness/githubCopilotHooks.js.map +1 -0
- package/dist/harness/gooseHooks.d.ts.map +1 -1
- package/dist/harness/gooseHooks.js +67 -37
- package/dist/harness/gooseHooks.js.map +1 -1
- package/dist/harness/grokHooks.d.ts +77 -0
- package/dist/harness/grokHooks.d.ts.map +1 -0
- package/dist/harness/grokHooks.js +350 -0
- package/dist/harness/grokHooks.js.map +1 -0
- package/dist/harness/hermesHooks.d.ts.map +1 -1
- package/dist/harness/hermesHooks.js +26 -55
- package/dist/harness/hermesHooks.js.map +1 -1
- package/dist/harness/holdRedaction.d.ts +69 -0
- package/dist/harness/holdRedaction.d.ts.map +1 -0
- package/dist/harness/holdRedaction.js +211 -0
- package/dist/harness/holdRedaction.js.map +1 -0
- package/dist/harness/jetbrainsXmlConfig.d.ts +51 -0
- package/dist/harness/jetbrainsXmlConfig.d.ts.map +1 -0
- package/dist/harness/jetbrainsXmlConfig.js +151 -0
- package/dist/harness/jetbrainsXmlConfig.js.map +1 -0
- package/dist/harness/mcpAutoWrite.d.ts +100 -3
- package/dist/harness/mcpAutoWrite.d.ts.map +1 -1
- package/dist/harness/mcpAutoWrite.js +712 -90
- package/dist/harness/mcpAutoWrite.js.map +1 -1
- package/dist/harness/museHooks.d.ts +53 -0
- package/dist/harness/museHooks.d.ts.map +1 -0
- package/dist/harness/museHooks.js +273 -0
- package/dist/harness/museHooks.js.map +1 -0
- package/dist/harness/n8nHooks.d.ts +25 -9
- package/dist/harness/n8nHooks.d.ts.map +1 -1
- package/dist/harness/n8nHooks.js +174 -9
- package/dist/harness/n8nHooks.js.map +1 -1
- package/dist/harness/openCodeHooks.d.ts +93 -0
- package/dist/harness/openCodeHooks.d.ts.map +1 -0
- package/dist/harness/openCodeHooks.js +248 -0
- package/dist/harness/openCodeHooks.js.map +1 -0
- package/dist/harness/openWebuiHooks.d.ts.map +1 -1
- package/dist/harness/openWebuiHooks.js +56 -11
- package/dist/harness/openWebuiHooks.js.map +1 -1
- package/dist/harness/openclawHooks.d.ts.map +1 -1
- package/dist/harness/openclawHooks.js +30 -54
- package/dist/harness/openclawHooks.js.map +1 -1
- package/dist/harness/openhandsHooks.d.ts.map +1 -1
- package/dist/harness/openhandsHooks.js +35 -41
- package/dist/harness/openhandsHooks.js.map +1 -1
- package/dist/harness/piHooks.d.ts.map +1 -1
- package/dist/harness/piHooks.js +31 -58
- package/dist/harness/piHooks.js.map +1 -1
- package/dist/harness/protectedPaths.d.ts +353 -0
- package/dist/harness/protectedPaths.d.ts.map +1 -0
- package/dist/harness/protectedPaths.js +805 -0
- package/dist/harness/protectedPaths.js.map +1 -0
- package/dist/harness/rooCodeHooks.d.ts.map +1 -1
- package/dist/harness/rooCodeHooks.js +34 -48
- package/dist/harness/rooCodeHooks.js.map +1 -1
- package/dist/harness/windsurfHooks.d.ts +72 -0
- package/dist/harness/windsurfHooks.d.ts.map +1 -1
- package/dist/harness/windsurfHooks.js +172 -58
- package/dist/harness/windsurfHooks.js.map +1 -1
- package/dist/harness/windsurfJetBrainsProxy.d.ts +78 -0
- package/dist/harness/windsurfJetBrainsProxy.d.ts.map +1 -0
- package/dist/harness/windsurfJetBrainsProxy.js +159 -0
- package/dist/harness/windsurfJetBrainsProxy.js.map +1 -0
- package/dist/hashReporter.js +1 -1
- package/dist/hashReporter.js.map +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -6
- package/dist/index.js.map +1 -1
- package/dist/integrityStore.d.ts +0 -8
- package/dist/integrityStore.d.ts.map +1 -1
- package/dist/integrityStore.js +6 -29
- package/dist/integrityStore.js.map +1 -1
- package/dist/lib/approvedBypasses.d.ts +76 -0
- package/dist/lib/approvedBypasses.d.ts.map +1 -0
- package/dist/lib/approvedBypasses.js +140 -0
- package/dist/lib/approvedBypasses.js.map +1 -0
- package/dist/lib/complianceProbes.d.ts.map +1 -1
- package/dist/lib/complianceProbes.js +5 -0
- package/dist/lib/complianceProbes.js.map +1 -1
- package/dist/lib/decisionsDigest.d.ts +99 -0
- package/dist/lib/decisionsDigest.d.ts.map +1 -0
- package/dist/lib/decisionsDigest.js +199 -0
- package/dist/lib/decisionsDigest.js.map +1 -0
- package/dist/lib/egressPolicy.d.ts +69 -0
- package/dist/lib/egressPolicy.d.ts.map +1 -0
- package/dist/lib/egressPolicy.js +126 -0
- package/dist/lib/egressPolicy.js.map +1 -0
- package/dist/lib/gitWorktrees.d.ts +140 -0
- package/dist/lib/gitWorktrees.d.ts.map +1 -0
- package/dist/lib/gitWorktrees.js +191 -0
- package/dist/lib/gitWorktrees.js.map +1 -0
- package/dist/lib/policySnapshot.d.ts +224 -0
- package/dist/lib/policySnapshot.d.ts.map +1 -0
- package/dist/lib/policySnapshot.js +637 -0
- package/dist/lib/policySnapshot.js.map +1 -0
- package/dist/lib/processPoller.d.ts +44 -0
- package/dist/lib/processPoller.d.ts.map +1 -1
- package/dist/lib/processPoller.js +176 -1
- package/dist/lib/processPoller.js.map +1 -1
- package/dist/lib/runtimeEnv.d.ts +8 -0
- package/dist/lib/runtimeEnv.d.ts.map +1 -1
- package/dist/lib/runtimeEnv.js +3 -0
- package/dist/lib/runtimeEnv.js.map +1 -1
- package/dist/localTrajectoryHeuristics.d.ts +51 -0
- package/dist/localTrajectoryHeuristics.d.ts.map +1 -0
- package/dist/localTrajectoryHeuristics.js +90 -0
- package/dist/localTrajectoryHeuristics.js.map +1 -0
- package/dist/sessionReporter.d.ts +70 -0
- package/dist/sessionReporter.d.ts.map +1 -0
- package/dist/sessionReporter.js +140 -0
- package/dist/sessionReporter.js.map +1 -0
- package/dist/skillWriter.d.ts +1 -1
- package/dist/skillWriter.d.ts.map +1 -1
- package/dist/skillWriter.js +6 -3
- package/dist/skillWriter.js.map +1 -1
- package/dist/syncLoop.d.ts +105 -3
- package/dist/syncLoop.d.ts.map +1 -1
- package/dist/syncLoop.js +397 -65
- package/dist/syncLoop.js.map +1 -1
- package/dist/trajectoryMonitor.d.ts +2 -0
- package/dist/trajectoryMonitor.d.ts.map +1 -1
- package/dist/trajectoryMonitor.js +57 -0
- package/dist/trajectoryMonitor.js.map +1 -1
- package/dist/watcher/driftWatcher.d.ts.map +1 -1
- package/dist/watcher/driftWatcher.js +12 -3
- package/dist/watcher/driftWatcher.js.map +1 -1
- package/dist/watcher/settingsGuard.d.ts +23 -0
- package/dist/watcher/settingsGuard.d.ts.map +1 -1
- package/dist/watcher/settingsGuard.js +202 -17
- package/dist/watcher/settingsGuard.js.map +1 -1
- package/package.json +37 -6
- package/dist/brainIndexer.d.ts +0 -51
- package/dist/brainIndexer.d.ts.map +0 -1
- package/dist/brainIndexer.js +0 -148
- package/dist/brainIndexer.js.map +0 -1
- package/dist/harness/cursorHooksJson.d.ts +0 -29
- package/dist/harness/cursorHooksJson.d.ts.map +0 -1
- package/dist/harness/cursorHooksJson.js +0 -130
- package/dist/harness/cursorHooksJson.js.map +0 -1
- package/dist/harness/gooseHooksWriter.d.ts +0 -27
- package/dist/harness/gooseHooksWriter.d.ts.map +0 -1
- package/dist/harness/gooseHooksWriter.js +0 -147
- package/dist/harness/gooseHooksWriter.js.map +0 -1
- package/dist/harness/openhandsHooksWriter.d.ts +0 -23
- package/dist/harness/openhandsHooksWriter.d.ts.map +0 -1
- package/dist/harness/openhandsHooksWriter.js +0 -146
- package/dist/harness/openhandsHooksWriter.js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;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,KAAK,GAAG,mBAAmB,EAAE,CAAA;IACnC,OAAO;2BACkB,YAAY;;;;;;;EAOrC,YAAY,CAAC,eAAe,EAAE,KAAK,CAAC;;;;EAIpC,kBAAkB,CAAC,QAAQ;;EAE3B,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsInB,CAAA;AACD,CAAC;AAED;mEACmE;AACnE,OAAO,EAAE,4BAA4B,EAAE,CAAA"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gateKind.ts — classifies each harness by HOW its tool calls get governed,
|
|
3
|
+
* for `agentReporter.ts`'s `guardrails` facet.
|
|
4
|
+
*
|
|
5
|
+
* # Why this exists
|
|
6
|
+
*
|
|
7
|
+
* `collectAgentReport` used to report `hook_gate: true` unconditionally for
|
|
8
|
+
* every harness, with the comment "the daemon writes the hook gate for every
|
|
9
|
+
* harness it supports." That was already false for `langgraph` — which has
|
|
10
|
+
* no on-disk hook, only the SDK-side `intutic_clawde.gate` — and for `aider`,
|
|
11
|
+
* whose only NO_GATE-registered mechanism is a post-edit, /run-blind
|
|
12
|
+
* pre-commit hook (see `aiderConfigMerger.ts`'s NO_GATE row in
|
|
13
|
+
* `__tests__/harness/gateRegistry.ts`). Wave 1 adds eight more SDK-gated
|
|
14
|
+
* harnesses, which would have made the lie eight times larger without this
|
|
15
|
+
* fix.
|
|
16
|
+
*
|
|
17
|
+
* # What this does NOT do
|
|
18
|
+
*
|
|
19
|
+
* This does not verify that a user actually pip-installed `intutic-clawde`
|
|
20
|
+
* and wired `guard_tools`/`IntuticMiddleware`/etc. into their process — the
|
|
21
|
+
* daemon cannot observe another process's imports, the same way it cannot
|
|
22
|
+
* observe whether a written hook file was left executable. It only reports
|
|
23
|
+
* which MECHANISM this harness's governance model uses (a file the daemon
|
|
24
|
+
* itself writes and can verify existence of, vs. an SDK the harness's own
|
|
25
|
+
* process must import), matching the trust level `hook_gate: true` already
|
|
26
|
+
* carried for file-based harnesses before this fix.
|
|
27
|
+
*
|
|
28
|
+
* # Keeping this in sync with the gate registry
|
|
29
|
+
*
|
|
30
|
+
* `services/sync-daemon/__tests__/harness/gateRegistry.ts` (the GATES/NO_GATE
|
|
31
|
+
* completeness registry exercised by `generatedGateBehaviour.test.ts`) is the
|
|
32
|
+
* authoritative decision per harness, but it is a test-only module (it
|
|
33
|
+
* dynamically imports every writer's compiled `.js` from a temp build dir)
|
|
34
|
+
* and must not be imported from daemon runtime code. `gateKind.test.ts`
|
|
35
|
+
* cross-checks the two lists so this file cannot silently drift from that
|
|
36
|
+
* registry's own NO_GATE rows: `file: null` harnesses split between 'sdk'
|
|
37
|
+
* (LangGraph + the Python frameworks — the gate ships in intutic-clawde),
|
|
38
|
+
* 'delegated' (xirp — the gate is whichever wrapped harness's own gate is
|
|
39
|
+
* running), and 'bridge' (trueforge-server — the gate runs in a separate
|
|
40
|
+
* Intutic-operated service, not in any process this repo's writers touch);
|
|
41
|
+
* the one non-null row (aiderConfigMerger.ts, "no ... exists") is 'none'.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
import { type HarnessType as HarnessTypeT } from '@intutic/shared-types';
|
|
46
|
+
/**
|
|
47
|
+
* `'hook'` — the daemon writes an on-disk hook/config file this harness
|
|
48
|
+
* reads before running a tool call (the 19-harness majority).
|
|
49
|
+
* `'sdk'` — the blocking gate ships in `intutic-clawde`, imported into
|
|
50
|
+
* the harness's own Python process; no file for the daemon
|
|
51
|
+
* to write or verify (LangGraph + the eight Wave/Wave-2
|
|
52
|
+
* frameworks).
|
|
53
|
+
* `'none'` — no enforcement point exists today at all (aider: its only
|
|
54
|
+
* native hook is post-edit and /run-blind).
|
|
55
|
+
* `'delegated'` — this harness has no gate mechanism of its own because it
|
|
56
|
+
* does not run tools itself: it wraps OTHER harnesses that
|
|
57
|
+
* are already `'hook'`- or `'sdk'`-gated, and a tool call
|
|
58
|
+
* made inside it is governed by whichever wrapped harness's
|
|
59
|
+
* own gate is running (Xirp, Agentic Orchestrator, and — a
|
|
60
|
+
* different shape of the same idea — AgentCore Runtime,
|
|
61
|
+
* which HOSTS a customer's already-gated framework code
|
|
62
|
+
* rather than spawning it as a subprocess; see
|
|
63
|
+
* gateRegistry.ts's NO_GATE rows for the reasoning this
|
|
64
|
+
* precedent sets for future orchestrator/host-shaped
|
|
65
|
+
* harnesses).
|
|
66
|
+
* Every wrapped backend of the two orchestrators has a gate of
|
|
67
|
+
* its own (Agentic Orchestrator's `opencode` backend since
|
|
68
|
+
* TD-397 closed with `openCodeHooks.ts`), so `'delegated'`
|
|
69
|
+
* claims exactly what happens. Distinct from
|
|
70
|
+
* `'none'`: `'none'` means no enforcement point exists
|
|
71
|
+
* ANYWHERE for this harness's tool calls; `'delegated'`
|
|
72
|
+
* means one exists, just not one this harness's own row
|
|
73
|
+
* owns or can be credited for independently — reporting it
|
|
74
|
+
* as `'none'` would undercount real coverage, and reporting
|
|
75
|
+
* it as `'hook'` would overclaim a file this daemon never
|
|
76
|
+
* writes for the wrapping harness itself.
|
|
77
|
+
* `'bridge'` — the gate runs OUT OF PROCESS, in an Intutic-operated
|
|
78
|
+
* service reacting to the harness's own async
|
|
79
|
+
* approval/event API, rather than a file this daemon writes
|
|
80
|
+
* (`'hook'`), an SDK imported into the harness's own process
|
|
81
|
+
* (`'sdk'`), no enforcement point at all (`'none'`), or
|
|
82
|
+
* governance credited to a wrapped harness's own gate
|
|
83
|
+
* (`'delegated'`) — a fifth, genuinely different shape.
|
|
84
|
+
* TRUEFORGE_SERVER is the first and so far only member: a
|
|
85
|
+
* TrueForge standalone/hosted server is a separate process
|
|
86
|
+
* nobody embeds an Intutic gate into (unlike TRUEFORGE,
|
|
87
|
+
* embedded mode, which IS `'sdk'`-gated — see that row's own
|
|
88
|
+
* doc), so `services/trueforge-bridge` watches its turn/event
|
|
89
|
+
* stream externally and answers pending approvals over HTTP.
|
|
90
|
+
* Distinct from `'delegated'`: a delegated harness's tool
|
|
91
|
+
* calls are governed by ANOTHER HARNESS's own gate running
|
|
92
|
+
* in that other harness's process; a bridge-gated harness's
|
|
93
|
+
* tool calls are governed by a service this repo ships and
|
|
94
|
+
* operates, running in neither the harness's process nor any
|
|
95
|
+
* other harness's. Distinct from `'sdk'`: no code from this
|
|
96
|
+
* repo ever runs inside the governed harness's own process
|
|
97
|
+
* at all — the harness's only obligation is to expose the
|
|
98
|
+
* async approval API the bridge polls/subscribes to.
|
|
99
|
+
*/
|
|
100
|
+
export type GateKind = 'hook' | 'sdk' | 'none' | 'delegated' | 'bridge';
|
|
101
|
+
/**
|
|
102
|
+
* Harnesses whose blocking gate ships SDK-side, in the harness's own
|
|
103
|
+
* process — no on-disk hook/config file exists to point a gate at. Mirrors
|
|
104
|
+
* the `file: null` NO_GATE rows in `gateRegistry.ts`.
|
|
105
|
+
*
|
|
106
|
+
* MASTRA, VERCEL_AI_SDK (T2), EVE (A2), and TRUEFORGE (embedded-library mode
|
|
107
|
+
* only — see its own HarnessType doc) are the JS/TS-native members of this
|
|
108
|
+
* family: their blocking gate ships in `@intutic/gate/mastra`/
|
|
109
|
+
* `@intutic/gate/vercel`/`@intutic/gate/eve`/`@intutic/gate/trueforge`
|
|
110
|
+
* (packages/gate-js) rather than `intutic-clawde`, but the shape is
|
|
111
|
+
* identical — no on-disk hook/config file, tools run as plain callables in
|
|
112
|
+
* the harness's own process (for eve, as per-tool/per-connection `approval`
|
|
113
|
+
* policies attached in the agent directory's own TypeScript; for TrueForge,
|
|
114
|
+
* as `intuticApprovalResponder()` answering `tool.approval_required`
|
|
115
|
+
* pauses — see `@intutic/gate/trueforge`'s module doc for why that shape
|
|
116
|
+
* differs from mastra/vercel's single-callback pattern).
|
|
117
|
+
*
|
|
118
|
+
* AI_SDK_HARNESS and AI_SDK_WORKFLOW (A3) are the same `@intutic/gate`
|
|
119
|
+
* family with one nuance worth naming: the VETO still runs SDK-side in the
|
|
120
|
+
* caller's own Node.js process (an approval responder / a `needsApproval`
|
|
121
|
+
* function), which is what `'sdk'` classifies — but for AI_SDK_HARNESS the
|
|
122
|
+
* tool EXECUTION it vetoes happens server-side in a Vercel Sandbox microVM,
|
|
123
|
+
* and its built-in sandbox tools have no veto surface at all beyond
|
|
124
|
+
* `permissionMode` (defaults to 'allow-all'). `'sdk'` describes where the
|
|
125
|
+
* gate mechanism lives, not a claim that every tool the harness can run
|
|
126
|
+
* passes through it — see gateRegistry.ts's NO_GATE rows for the honest
|
|
127
|
+
* scope statement per harness.
|
|
128
|
+
*/
|
|
129
|
+
export declare const SDK_GATED_HARNESSES: ReadonlySet<HarnessTypeT>;
|
|
130
|
+
/**
|
|
131
|
+
* Harnesses with no enforcement point at all today. Mirrors the
|
|
132
|
+
* `aiderConfigMerger.ts` NO_GATE row: aider's only native hook
|
|
133
|
+
* (`--git-commit-verify`) is opt-in, post-edit, and blind to `/run`.
|
|
134
|
+
*/
|
|
135
|
+
export declare const NO_GATE_HARNESSES: ReadonlySet<HarnessTypeT>;
|
|
136
|
+
/**
|
|
137
|
+
* Harnesses that wrap OTHER already-gated harnesses instead of running tools
|
|
138
|
+
* themselves — no gate of their own, but not ungoverned either. Mirrors the
|
|
139
|
+
* `file: null` NO_GATE rows for `xirp` and `agentic-orchestrator` in
|
|
140
|
+
* `gateRegistry.ts`. Xirp was the first entry of this shape; Agentic
|
|
141
|
+
* Orchestrator (O3) is the second. O2 (QM) is expected to add a third, same
|
|
142
|
+
* "wraps other harnesses" shape, in a concurrent phase not yet merged as of
|
|
143
|
+
* this one.
|
|
144
|
+
*/
|
|
145
|
+
export declare const DELEGATED_GATE_HARNESSES: ReadonlySet<HarnessTypeT>;
|
|
146
|
+
/**
|
|
147
|
+
* Harnesses whose blocking gate runs OUT OF PROCESS, in an Intutic-operated
|
|
148
|
+
* service reacting to the harness's own async approval/event API — not a
|
|
149
|
+
* file this daemon writes, and not an SDK imported into the harness's own
|
|
150
|
+
* process (no process of ours runs inside the harness at all). Mirrors the
|
|
151
|
+
* `file: null` NO_GATE row for `trueforge-server` in `gateRegistry.ts`.
|
|
152
|
+
*
|
|
153
|
+
* TRUEFORGE_SERVER (B3) is the first member: a TrueForge standalone/hosted
|
|
154
|
+
* server has no in-process host to hang an SDK gate off of (contrast
|
|
155
|
+
* TRUEFORGE, embedded mode, in `SDK_GATED_HARNESSES` above) — instead
|
|
156
|
+
* `services/trueforge-bridge` watches its turn/event stream externally and
|
|
157
|
+
* answers pending `tool.approval_required` pauses over HTTP. See the
|
|
158
|
+
* `'bridge'` `GateKind` doc above for the full distinction from `'sdk'` and
|
|
159
|
+
* `'delegated'`.
|
|
160
|
+
*/
|
|
161
|
+
export declare const BRIDGE_GATED_HARNESSES: ReadonlySet<HarnessTypeT>;
|
|
162
|
+
/** How this harness's tool calls get gated. Defaults to `'hook'`. */
|
|
163
|
+
export declare function gateKindForHarness(type: HarnessTypeT): GateKind;
|
|
164
|
+
//# sourceMappingURL=gateKind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateKind.d.ts","sourceRoot":"","sources":["../../src/harness/gateKind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAe,KAAK,WAAW,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,YAAY,CAiBxD,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,YAAY,CAAgC,CAAA;AAExF;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,YAAY,CAO7D,CAAA;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,YAAY,CAA2C,CAAA;AAExG,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,GAAG,QAAQ,CAM/D"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* gateKind.ts — classifies each harness by HOW its tool calls get governed,
|
|
3
|
+
* for `agentReporter.ts`'s `guardrails` facet.
|
|
4
|
+
*
|
|
5
|
+
* # Why this exists
|
|
6
|
+
*
|
|
7
|
+
* `collectAgentReport` used to report `hook_gate: true` unconditionally for
|
|
8
|
+
* every harness, with the comment "the daemon writes the hook gate for every
|
|
9
|
+
* harness it supports." That was already false for `langgraph` — which has
|
|
10
|
+
* no on-disk hook, only the SDK-side `intutic_clawde.gate` — and for `aider`,
|
|
11
|
+
* whose only NO_GATE-registered mechanism is a post-edit, /run-blind
|
|
12
|
+
* pre-commit hook (see `aiderConfigMerger.ts`'s NO_GATE row in
|
|
13
|
+
* `__tests__/harness/gateRegistry.ts`). Wave 1 adds eight more SDK-gated
|
|
14
|
+
* harnesses, which would have made the lie eight times larger without this
|
|
15
|
+
* fix.
|
|
16
|
+
*
|
|
17
|
+
* # What this does NOT do
|
|
18
|
+
*
|
|
19
|
+
* This does not verify that a user actually pip-installed `intutic-clawde`
|
|
20
|
+
* and wired `guard_tools`/`IntuticMiddleware`/etc. into their process — the
|
|
21
|
+
* daemon cannot observe another process's imports, the same way it cannot
|
|
22
|
+
* observe whether a written hook file was left executable. It only reports
|
|
23
|
+
* which MECHANISM this harness's governance model uses (a file the daemon
|
|
24
|
+
* itself writes and can verify existence of, vs. an SDK the harness's own
|
|
25
|
+
* process must import), matching the trust level `hook_gate: true` already
|
|
26
|
+
* carried for file-based harnesses before this fix.
|
|
27
|
+
*
|
|
28
|
+
* # Keeping this in sync with the gate registry
|
|
29
|
+
*
|
|
30
|
+
* `services/sync-daemon/__tests__/harness/gateRegistry.ts` (the GATES/NO_GATE
|
|
31
|
+
* completeness registry exercised by `generatedGateBehaviour.test.ts`) is the
|
|
32
|
+
* authoritative decision per harness, but it is a test-only module (it
|
|
33
|
+
* dynamically imports every writer's compiled `.js` from a temp build dir)
|
|
34
|
+
* and must not be imported from daemon runtime code. `gateKind.test.ts`
|
|
35
|
+
* cross-checks the two lists so this file cannot silently drift from that
|
|
36
|
+
* registry's own NO_GATE rows: `file: null` harnesses split between 'sdk'
|
|
37
|
+
* (LangGraph + the Python frameworks — the gate ships in intutic-clawde),
|
|
38
|
+
* 'delegated' (xirp — the gate is whichever wrapped harness's own gate is
|
|
39
|
+
* running), and 'bridge' (trueforge-server — the gate runs in a separate
|
|
40
|
+
* Intutic-operated service, not in any process this repo's writers touch);
|
|
41
|
+
* the one non-null row (aiderConfigMerger.ts, "no ... exists") is 'none'.
|
|
42
|
+
*
|
|
43
|
+
* @module
|
|
44
|
+
*/
|
|
45
|
+
import { HarnessType } from '@intutic/shared-types';
|
|
46
|
+
/**
|
|
47
|
+
* Harnesses whose blocking gate ships SDK-side, in the harness's own
|
|
48
|
+
* process — no on-disk hook/config file exists to point a gate at. Mirrors
|
|
49
|
+
* the `file: null` NO_GATE rows in `gateRegistry.ts`.
|
|
50
|
+
*
|
|
51
|
+
* MASTRA, VERCEL_AI_SDK (T2), EVE (A2), and TRUEFORGE (embedded-library mode
|
|
52
|
+
* only — see its own HarnessType doc) are the JS/TS-native members of this
|
|
53
|
+
* family: their blocking gate ships in `@intutic/gate/mastra`/
|
|
54
|
+
* `@intutic/gate/vercel`/`@intutic/gate/eve`/`@intutic/gate/trueforge`
|
|
55
|
+
* (packages/gate-js) rather than `intutic-clawde`, but the shape is
|
|
56
|
+
* identical — no on-disk hook/config file, tools run as plain callables in
|
|
57
|
+
* the harness's own process (for eve, as per-tool/per-connection `approval`
|
|
58
|
+
* policies attached in the agent directory's own TypeScript; for TrueForge,
|
|
59
|
+
* as `intuticApprovalResponder()` answering `tool.approval_required`
|
|
60
|
+
* pauses — see `@intutic/gate/trueforge`'s module doc for why that shape
|
|
61
|
+
* differs from mastra/vercel's single-callback pattern).
|
|
62
|
+
*
|
|
63
|
+
* AI_SDK_HARNESS and AI_SDK_WORKFLOW (A3) are the same `@intutic/gate`
|
|
64
|
+
* family with one nuance worth naming: the VETO still runs SDK-side in the
|
|
65
|
+
* caller's own Node.js process (an approval responder / a `needsApproval`
|
|
66
|
+
* function), which is what `'sdk'` classifies — but for AI_SDK_HARNESS the
|
|
67
|
+
* tool EXECUTION it vetoes happens server-side in a Vercel Sandbox microVM,
|
|
68
|
+
* and its built-in sandbox tools have no veto surface at all beyond
|
|
69
|
+
* `permissionMode` (defaults to 'allow-all'). `'sdk'` describes where the
|
|
70
|
+
* gate mechanism lives, not a claim that every tool the harness can run
|
|
71
|
+
* passes through it — see gateRegistry.ts's NO_GATE rows for the honest
|
|
72
|
+
* scope statement per harness.
|
|
73
|
+
*/
|
|
74
|
+
export const SDK_GATED_HARNESSES = new Set([
|
|
75
|
+
HarnessType.LANGGRAPH,
|
|
76
|
+
HarnessType.LANGCHAIN,
|
|
77
|
+
HarnessType.CREWAI,
|
|
78
|
+
HarnessType.AUTOGEN,
|
|
79
|
+
HarnessType.AG2,
|
|
80
|
+
HarnessType.GOOGLE_ADK,
|
|
81
|
+
HarnessType.OPENAI_AGENTS,
|
|
82
|
+
HarnessType.PYDANTIC_AI,
|
|
83
|
+
HarnessType.SMOLAGENTS,
|
|
84
|
+
HarnessType.STRANDS,
|
|
85
|
+
HarnessType.MASTRA,
|
|
86
|
+
HarnessType.VERCEL_AI_SDK,
|
|
87
|
+
HarnessType.EVE,
|
|
88
|
+
HarnessType.TRUEFORGE,
|
|
89
|
+
HarnessType.AI_SDK_HARNESS,
|
|
90
|
+
HarnessType.AI_SDK_WORKFLOW,
|
|
91
|
+
]);
|
|
92
|
+
/**
|
|
93
|
+
* Harnesses with no enforcement point at all today. Mirrors the
|
|
94
|
+
* `aiderConfigMerger.ts` NO_GATE row: aider's only native hook
|
|
95
|
+
* (`--git-commit-verify`) is opt-in, post-edit, and blind to `/run`.
|
|
96
|
+
*/
|
|
97
|
+
export const NO_GATE_HARNESSES = new Set([HarnessType.AIDER]);
|
|
98
|
+
/**
|
|
99
|
+
* Harnesses that wrap OTHER already-gated harnesses instead of running tools
|
|
100
|
+
* themselves — no gate of their own, but not ungoverned either. Mirrors the
|
|
101
|
+
* `file: null` NO_GATE rows for `xirp` and `agentic-orchestrator` in
|
|
102
|
+
* `gateRegistry.ts`. Xirp was the first entry of this shape; Agentic
|
|
103
|
+
* Orchestrator (O3) is the second. O2 (QM) is expected to add a third, same
|
|
104
|
+
* "wraps other harnesses" shape, in a concurrent phase not yet merged as of
|
|
105
|
+
* this one.
|
|
106
|
+
*/
|
|
107
|
+
export const DELEGATED_GATE_HARNESSES = new Set([
|
|
108
|
+
HarnessType.XIRP,
|
|
109
|
+
HarnessType.AGENTIC_ORCHESTRATOR,
|
|
110
|
+
// B2: AWS Bedrock AgentCore Runtime — hosts a customer's own framework
|
|
111
|
+
// code unchanged; governed by whichever already-supported framework
|
|
112
|
+
// adapter that code uses. See tools/cli/src/harness/agentcore.ts.
|
|
113
|
+
HarnessType.AGENTCORE_RUNTIME,
|
|
114
|
+
]);
|
|
115
|
+
/**
|
|
116
|
+
* Harnesses whose blocking gate runs OUT OF PROCESS, in an Intutic-operated
|
|
117
|
+
* service reacting to the harness's own async approval/event API — not a
|
|
118
|
+
* file this daemon writes, and not an SDK imported into the harness's own
|
|
119
|
+
* process (no process of ours runs inside the harness at all). Mirrors the
|
|
120
|
+
* `file: null` NO_GATE row for `trueforge-server` in `gateRegistry.ts`.
|
|
121
|
+
*
|
|
122
|
+
* TRUEFORGE_SERVER (B3) is the first member: a TrueForge standalone/hosted
|
|
123
|
+
* server has no in-process host to hang an SDK gate off of (contrast
|
|
124
|
+
* TRUEFORGE, embedded mode, in `SDK_GATED_HARNESSES` above) — instead
|
|
125
|
+
* `services/trueforge-bridge` watches its turn/event stream externally and
|
|
126
|
+
* answers pending `tool.approval_required` pauses over HTTP. See the
|
|
127
|
+
* `'bridge'` `GateKind` doc above for the full distinction from `'sdk'` and
|
|
128
|
+
* `'delegated'`.
|
|
129
|
+
*/
|
|
130
|
+
export const BRIDGE_GATED_HARNESSES = new Set([HarnessType.TRUEFORGE_SERVER]);
|
|
131
|
+
/** How this harness's tool calls get gated. Defaults to `'hook'`. */
|
|
132
|
+
export function gateKindForHarness(type) {
|
|
133
|
+
if (SDK_GATED_HARNESSES.has(type))
|
|
134
|
+
return 'sdk';
|
|
135
|
+
if (NO_GATE_HARNESSES.has(type))
|
|
136
|
+
return 'none';
|
|
137
|
+
if (DELEGATED_GATE_HARNESSES.has(type))
|
|
138
|
+
return 'delegated';
|
|
139
|
+
if (BRIDGE_GATED_HARNESSES.has(type))
|
|
140
|
+
return 'bridge';
|
|
141
|
+
return 'hook';
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=gateKind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateKind.js","sourceRoot":"","sources":["../../src/harness/gateKind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,WAAW,EAAoC,MAAM,uBAAuB,CAAA;AA0DrF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAA8B,IAAI,GAAG,CAAC;IACpE,WAAW,CAAC,SAAS;IACrB,WAAW,CAAC,SAAS;IACrB,WAAW,CAAC,MAAM;IAClB,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,GAAG;IACf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se hooks.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ **PREVIEW MECHANISM.** VS Code agent hooks are a Preview feature: Copilot
|
|
5
|
+
* reads hook definitions from `.github/hooks/*.json` in the workspace (and
|
|
6
|
+
* from `~/.copilot/hooks` at user level), fires PreToolUse before each tool
|
|
7
|
+
* call with stdin JSON {session_id, cwd, hook_event_name, tool_name,
|
|
8
|
+
* tool_input, tool_use_id}, and refuses on **exit code 2** or a stdout
|
|
9
|
+
* `{"permissionDecision":"deny"}` (deny wins across hooks). The format may
|
|
10
|
+
* change between releases; everything below is written to fail SAFE if it
|
|
11
|
+
* does.
|
|
12
|
+
*
|
|
13
|
+
* CONTRACT LAST RE-VERIFIED 2026-08-10 against the live docs
|
|
14
|
+
* (code.visualstudio.com/docs/agent-customization/hooks and
|
|
15
|
+
* /docs/agents/reference/hooks-reference): envelope fields, exit-2 blocking,
|
|
16
|
+
* both file locations, the `chat.hookFilesLocations` setting (whose defaults
|
|
17
|
+
* also read `.claude/settings.json`-format hooks), and the explicit Preview
|
|
18
|
+
* marking ("configuration format and behavior might change") all confirmed
|
|
19
|
+
* as described above. What is NOT verified: an end-to-end block inside a
|
|
20
|
+
* live Copilot-subscribed VS Code agent session — that requires an
|
|
21
|
+
* interactive editor with a Copilot entitlement and cannot run headlessly;
|
|
22
|
+
* until someone performs it, this gate's live status is "contract-verified,
|
|
23
|
+
* session-unverified" and the security matrix says so.
|
|
24
|
+
*
|
|
25
|
+
* Fail-safe analysis, stated rather than assumed: the shared JS gate
|
|
26
|
+
* (`intuticGate`) extracts the target path and command from `tool_input` by
|
|
27
|
+
* known field names, and an input whose fields it does not recognise extracts
|
|
28
|
+
* to EMPTY strings — which match no rule, i.e. the gate degrades to ALLOW.
|
|
29
|
+
* That is fine for a stable harness and wrong for a Preview one, so this
|
|
30
|
+
* writer's stdin handler refuses (exit 2) any payload that carries neither
|
|
31
|
+
* `tool_name` nor `tool_input`: if Copilot renames the envelope, the gate
|
|
32
|
+
* fails closed and loudly instead of silently approving everything. A JSON
|
|
33
|
+
* parse failure fails closed the same way.
|
|
34
|
+
*
|
|
35
|
+
* Historically github-copilot had an instructions file only
|
|
36
|
+
* (`.github/copilot-instructions.md`) — advisory text, not enforcement. This
|
|
37
|
+
* closes that gap for agent mode.
|
|
38
|
+
*
|
|
39
|
+
* @module
|
|
40
|
+
*/
|
|
41
|
+
/**
|
|
42
|
+
* Write the Copilot gate script and its hook definition at workspace and user
|
|
43
|
+
* level.
|
|
44
|
+
*
|
|
45
|
+
* Safe to call repeatedly — uses atomic rename (`.intutic-tmp` → final path);
|
|
46
|
+
* both hook definition files are wholly Intutic-owned, so rewriting them is
|
|
47
|
+
* idempotent by construction.
|
|
48
|
+
*
|
|
49
|
+
* @param workspaceRoot - Absolute workspace root path.
|
|
50
|
+
* @param proxyUrl - Intutic proxy URL written into the gate header.
|
|
51
|
+
* @param workspaceId - Workspace ID embedded in every hook event payload.
|
|
52
|
+
*/
|
|
53
|
+
export declare function writeGithubCopilotHooks(workspaceRoot: string, proxyUrl: string, workspaceId?: string): Promise<void>;
|
|
54
|
+
//# sourceMappingURL=githubCopilotHooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubCopilotHooks.d.ts","sourceRoot":"","sources":["../../src/harness/githubCopilotHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAkJH;;;;;;;;;;;GAWG;AACH,wBAAsB,uBAAuB,CAC3C,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,WAAW,SAAK,GACf,OAAO,CAAC,IAAI,CAAC,CA8Bf"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* githubCopilotHooks.ts — GitHub Copilot (VS Code agent mode) PreToolUse hooks.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ **PREVIEW MECHANISM.** VS Code agent hooks are a Preview feature: Copilot
|
|
5
|
+
* reads hook definitions from `.github/hooks/*.json` in the workspace (and
|
|
6
|
+
* from `~/.copilot/hooks` at user level), fires PreToolUse before each tool
|
|
7
|
+
* call with stdin JSON {session_id, cwd, hook_event_name, tool_name,
|
|
8
|
+
* tool_input, tool_use_id}, and refuses on **exit code 2** or a stdout
|
|
9
|
+
* `{"permissionDecision":"deny"}` (deny wins across hooks). The format may
|
|
10
|
+
* change between releases; everything below is written to fail SAFE if it
|
|
11
|
+
* does.
|
|
12
|
+
*
|
|
13
|
+
* CONTRACT LAST RE-VERIFIED 2026-08-10 against the live docs
|
|
14
|
+
* (code.visualstudio.com/docs/agent-customization/hooks and
|
|
15
|
+
* /docs/agents/reference/hooks-reference): envelope fields, exit-2 blocking,
|
|
16
|
+
* both file locations, the `chat.hookFilesLocations` setting (whose defaults
|
|
17
|
+
* also read `.claude/settings.json`-format hooks), and the explicit Preview
|
|
18
|
+
* marking ("configuration format and behavior might change") all confirmed
|
|
19
|
+
* as described above. What is NOT verified: an end-to-end block inside a
|
|
20
|
+
* live Copilot-subscribed VS Code agent session — that requires an
|
|
21
|
+
* interactive editor with a Copilot entitlement and cannot run headlessly;
|
|
22
|
+
* until someone performs it, this gate's live status is "contract-verified,
|
|
23
|
+
* session-unverified" and the security matrix says so.
|
|
24
|
+
*
|
|
25
|
+
* Fail-safe analysis, stated rather than assumed: the shared JS gate
|
|
26
|
+
* (`intuticGate`) extracts the target path and command from `tool_input` by
|
|
27
|
+
* known field names, and an input whose fields it does not recognise extracts
|
|
28
|
+
* to EMPTY strings — which match no rule, i.e. the gate degrades to ALLOW.
|
|
29
|
+
* That is fine for a stable harness and wrong for a Preview one, so this
|
|
30
|
+
* writer's stdin handler refuses (exit 2) any payload that carries neither
|
|
31
|
+
* `tool_name` nor `tool_input`: if Copilot renames the envelope, the gate
|
|
32
|
+
* fails closed and loudly instead of silently approving everything. A JSON
|
|
33
|
+
* parse failure fails closed the same way.
|
|
34
|
+
*
|
|
35
|
+
* Historically github-copilot had an instructions file only
|
|
36
|
+
* (`.github/copilot-instructions.md`) — advisory text, not enforcement. This
|
|
37
|
+
* closes that gap for agent mode.
|
|
38
|
+
*
|
|
39
|
+
* @module
|
|
40
|
+
*/
|
|
41
|
+
import * as fs from 'node:fs/promises';
|
|
42
|
+
import * as path from 'node:path';
|
|
43
|
+
import * as os from 'node:os';
|
|
44
|
+
import { createLogger } from '@intutic/logger';
|
|
45
|
+
import { newIso } from '@intutic/id';
|
|
46
|
+
import { emitJsGate, emitJsFailClosedPrelude } from './gateBody.js';
|
|
47
|
+
const log = createLogger('sync-github-copilot-hooks');
|
|
48
|
+
/**
|
|
49
|
+
* The pre-tool gate script — receives Copilot's PreToolUse JSON on stdin,
|
|
50
|
+
* exits 0 to allow or 2 to block.
|
|
51
|
+
*/
|
|
52
|
+
function buildHookScript(proxyUrl, workspaceRoot, workspaceId) {
|
|
53
|
+
const hookEventsLog = path.join(workspaceRoot, '.intutic', 'events', 'hook-events.jsonl');
|
|
54
|
+
return `#!/usr/bin/env node
|
|
55
|
+
/**
|
|
56
|
+
* Intutic GitHub Copilot (agent mode) governance gate.
|
|
57
|
+
* Auto-generated by intutic sync-daemon. DO NOT EDIT.
|
|
58
|
+
*
|
|
59
|
+
* PREVIEW: VS Code agent hooks are a Preview feature and the stdin shape may
|
|
60
|
+
* change. This gate refuses (exit 2) any payload it does not recognise —
|
|
61
|
+
* fail closed, never silently allow.
|
|
62
|
+
*
|
|
63
|
+
* Proxy: ${proxyUrl}
|
|
64
|
+
* Generated: ${newIso()}
|
|
65
|
+
*/
|
|
66
|
+
${emitJsFailClosedPrelude({ harness: 'github-copilot', contract: 'exit2' })}
|
|
67
|
+
const path = require('path');
|
|
68
|
+
const os = require('os');
|
|
69
|
+
const fs = require('fs');
|
|
70
|
+
const crypto = require('crypto');
|
|
71
|
+
const https = require('https');
|
|
72
|
+
|
|
73
|
+
// Runtime credentials
|
|
74
|
+
const _runtimeEnvPath = path.join(os.homedir(), '.intutic', 'env', 'runtime.env');
|
|
75
|
+
let _intuticHost = 'https://api.intutic.ai', _intuticKey = '', _intuticWsId = ${JSON.stringify(workspaceId)};
|
|
76
|
+
try {
|
|
77
|
+
fs.readFileSync(_runtimeEnvPath, 'utf-8').split('\\n').forEach(line => {
|
|
78
|
+
const eq = line.indexOf('='); if (eq < 0) return;
|
|
79
|
+
const k = line.slice(0, eq).trim(), v = line.slice(eq + 1).trim();
|
|
80
|
+
if (k === 'INTUTIC_HOST' && v) _intuticHost = v;
|
|
81
|
+
if (k === 'INTUTIC_API_KEY' && v) _intuticKey = v;
|
|
82
|
+
if (k === 'INTUTIC_WORKSPACE_ID' && v) _intuticWsId = v;
|
|
83
|
+
});
|
|
84
|
+
} catch {}
|
|
85
|
+
|
|
86
|
+
${emitJsGate({ harness: 'github-copilot', contract: 'exit2' })}
|
|
87
|
+
|
|
88
|
+
let _intuticSessionId = '';
|
|
89
|
+
function logEvent(verdict, toolName, reason) {
|
|
90
|
+
try {
|
|
91
|
+
const ts = new Date().toISOString();
|
|
92
|
+
const incidentId = crypto.createHash('sha1').update(ts + toolName + _intuticWsId).digest('hex').slice(0, 16);
|
|
93
|
+
const entry = JSON.stringify({
|
|
94
|
+
// Passed through, not collapsed to two values: the advisory tier emits
|
|
95
|
+
// 'tool_flagged', and a ternary here silently recorded it as an allow.
|
|
96
|
+
event: verdict,
|
|
97
|
+
toolName, reason: reason || '',
|
|
98
|
+
workspaceId: _intuticWsId,
|
|
99
|
+
harnessType: 'github-copilot',
|
|
100
|
+
timestamp: ts,
|
|
101
|
+
incidentId,
|
|
102
|
+
...(_intuticSessionId ? { sessionId: _intuticSessionId } : {}),
|
|
103
|
+
}) + '\\n';
|
|
104
|
+
fs.appendFileSync(${JSON.stringify(hookEventsLog)}, entry, { flag: 'a' });
|
|
105
|
+
if (_intuticKey) {
|
|
106
|
+
try {
|
|
107
|
+
const body = JSON.stringify({ events: [JSON.parse(entry)] });
|
|
108
|
+
const urlObj = new URL('/api/v1/hook-events', _intuticHost);
|
|
109
|
+
const mod = urlObj.protocol === 'https:' ? https : require('http');
|
|
110
|
+
const req = mod.request({ hostname: urlObj.hostname, port: urlObj.port || 443, path: urlObj.pathname, method: 'POST', headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body), 'Authorization': 'Bearer ' + _intuticKey } });
|
|
111
|
+
req.on('error', () => { /* fire-and-forget */ });
|
|
112
|
+
req.write(body); req.end();
|
|
113
|
+
} catch { /* never crash the hook */ }
|
|
114
|
+
}
|
|
115
|
+
} catch { /* never crash the hook */ }
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let raw = '';
|
|
119
|
+
process.stdin.on('data', (c) => { raw += c; });
|
|
120
|
+
process.stdin.on('end', () => {
|
|
121
|
+
try {
|
|
122
|
+
const ctx = JSON.parse(raw);
|
|
123
|
+
_intuticSessionId = ctx.session_id || ctx.sessionId || '';
|
|
124
|
+
|
|
125
|
+
// The Preview guard — the precedent the whole family now follows. The
|
|
126
|
+
// shared gate extracts by known field names, and an envelope it does not
|
|
127
|
+
// recognise extracts to empty strings — which match no rule and would
|
|
128
|
+
// ALLOW. On a Preview harness whose format may shift, that is a silent
|
|
129
|
+
// hole. The hand-rolled check that lived here became the shared
|
|
130
|
+
// intuticGuardEnvelope in gateBody.ts (v5), so every JS writer refuses the
|
|
131
|
+
// same envelopes with the same event; if Copilot renames the fields,
|
|
132
|
+
// re-run intutic sync after upgrading.
|
|
133
|
+
intuticGuardEnvelope(ctx, ['tool_name', 'toolName', 'tool_input', 'toolInput'], logEvent);
|
|
134
|
+
|
|
135
|
+
const input = ctx.tool_input || ctx.toolInput || {};
|
|
136
|
+
const toolName = ctx.tool_name || ctx.toolName || 'tool';
|
|
137
|
+
|
|
138
|
+
// Every spelling any harness uses, matching the bash extractor. A field
|
|
139
|
+
// name this list misses is a path guard that silently does not run — and
|
|
140
|
+
// the caller controls which spelling it sends.
|
|
141
|
+
const targetPath = input.path || input.file_path || input.filePath || input.file ||
|
|
142
|
+
input.target || input.notebook_path || '';
|
|
143
|
+
const command = input.command || input.cmd || input.script || '';
|
|
144
|
+
|
|
145
|
+
intuticGate(toolName, targetPath, command, logEvent, _intuticWsId, input);
|
|
146
|
+
|
|
147
|
+
// Allow
|
|
148
|
+
logEvent('tool_allowed', toolName, '');
|
|
149
|
+
process.exit(0);
|
|
150
|
+
} catch (err) {
|
|
151
|
+
// Fail CLOSED
|
|
152
|
+
const errMsg = String(err);
|
|
153
|
+
process.stderr.write('[Intutic Governance] Hook error (fail-closed): ' + errMsg + '\\n');
|
|
154
|
+
logEvent('tool_blocked', 'unknown', errMsg);
|
|
155
|
+
process.exit(2);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
/** The hook definition Copilot loads. One file wholly owned by Intutic — the
|
|
161
|
+
* `.github/hooks/` directory is per-file, so no merge is needed and user hook
|
|
162
|
+
* files are never touched. */
|
|
163
|
+
function buildHookConfig(hookScriptPath) {
|
|
164
|
+
return {
|
|
165
|
+
_comment: 'Intutic governance hook — auto-generated. DO NOT EDIT. ' +
|
|
166
|
+
'PREVIEW: VS Code agent hooks are a Preview feature; the gate fails closed if the format changes.',
|
|
167
|
+
_lastSync: newIso(),
|
|
168
|
+
hooks: {
|
|
169
|
+
PreToolUse: [
|
|
170
|
+
{
|
|
171
|
+
// Catch-all: the gate decides from the arguments, so a tool name
|
|
172
|
+
// nobody anticipated is still evaluated.
|
|
173
|
+
matcher: '.*',
|
|
174
|
+
hooks: [{ type: 'command', command: `node "${hookScriptPath}"` }],
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Write the Copilot gate script and its hook definition at workspace and user
|
|
182
|
+
* level.
|
|
183
|
+
*
|
|
184
|
+
* Safe to call repeatedly — uses atomic rename (`.intutic-tmp` → final path);
|
|
185
|
+
* both hook definition files are wholly Intutic-owned, so rewriting them is
|
|
186
|
+
* idempotent by construction.
|
|
187
|
+
*
|
|
188
|
+
* @param workspaceRoot - Absolute workspace root path.
|
|
189
|
+
* @param proxyUrl - Intutic proxy URL written into the gate header.
|
|
190
|
+
* @param workspaceId - Workspace ID embedded in every hook event payload.
|
|
191
|
+
*/
|
|
192
|
+
export async function writeGithubCopilotHooks(workspaceRoot, proxyUrl, workspaceId = '') {
|
|
193
|
+
const hookScriptDir = path.join(workspaceRoot, '.intutic', 'hooks');
|
|
194
|
+
await fs.mkdir(hookScriptDir, { recursive: true });
|
|
195
|
+
await fs.mkdir(path.join(workspaceRoot, '.intutic', 'events'), { recursive: true });
|
|
196
|
+
const hookScriptPath = path.join(hookScriptDir, 'github-copilot-check.js');
|
|
197
|
+
const tmpScript = hookScriptPath + '.intutic-tmp';
|
|
198
|
+
await fs.writeFile(tmpScript, buildHookScript(proxyUrl, workspaceRoot, workspaceId), 'utf-8');
|
|
199
|
+
await fs.rename(tmpScript, hookScriptPath);
|
|
200
|
+
await fs.chmod(hookScriptPath, 0o755);
|
|
201
|
+
const config = buildHookConfig(hookScriptPath);
|
|
202
|
+
// 1. Workspace-level: .github/hooks/intutic-governance.json
|
|
203
|
+
const projectHooksDir = path.join(workspaceRoot, '.github', 'hooks');
|
|
204
|
+
await fs.mkdir(projectHooksDir, { recursive: true });
|
|
205
|
+
await atomicWriteJson(path.join(projectHooksDir, 'intutic-governance.json'), config);
|
|
206
|
+
log.info({ action: 'github_copilot_hooks_written', level: 'workspace', path: projectHooksDir }, 'GitHub Copilot workspace-level hook written (Preview mechanism)');
|
|
207
|
+
// 2. User-level: ~/.copilot/hooks/intutic-governance.json
|
|
208
|
+
const userHooksDir = path.join(os.homedir(), '.copilot', 'hooks');
|
|
209
|
+
await fs.mkdir(userHooksDir, { recursive: true });
|
|
210
|
+
await atomicWriteJson(path.join(userHooksDir, 'intutic-governance.json'), config);
|
|
211
|
+
log.info({ action: 'github_copilot_hooks_written', level: 'user', path: userHooksDir }, 'GitHub Copilot user-level hook written (Preview mechanism)');
|
|
212
|
+
}
|
|
213
|
+
async function atomicWriteJson(filePath, data) {
|
|
214
|
+
const tmp = filePath + '.intutic-tmp';
|
|
215
|
+
await fs.writeFile(tmp, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
|
216
|
+
await fs.rename(tmp, filePath);
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=githubCopilotHooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubCopilotHooks.js","sourceRoot":"","sources":["../../src/harness/githubCopilotHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAA;AACtC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAEnE,MAAM,GAAG,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAA;AAErD;;;GAGG;AACH,SAAS,eAAe,CAAC,QAAgB,EAAE,aAAqB,EAAE,WAAmB;IACnF,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,mBAAmB,CAAC,CAAA;IACzF,OAAO;;;;;;;;;YASG,QAAQ;gBACJ,MAAM,EAAE;;EAEtB,uBAAuB,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;;;;;;;;;gFASK,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC;;;;;;;;;;;EAWzG,UAAU,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;;;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EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAA;IACtE,MAAM,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gooseHooks.d.ts","sourceRoot":"","sources":["../../src/harness/gooseHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"gooseHooks.d.ts","sourceRoot":"","sources":["../../src/harness/gooseHooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAeH;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,SAAe,EAAE,WAAW,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CA0HrH"}
|