@intutic/sync-daemon 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.
Files changed (200) hide show
  1. package/README.md +2 -2
  2. package/dist/agentReporter.d.ts +205 -0
  3. package/dist/agentReporter.d.ts.map +1 -0
  4. package/dist/agentReporter.js +394 -0
  5. package/dist/agentReporter.js.map +1 -0
  6. package/dist/configReader.d.ts +39 -2
  7. package/dist/configReader.d.ts.map +1 -1
  8. package/dist/configReader.js +56 -2
  9. package/dist/configReader.js.map +1 -1
  10. package/dist/configWriter.d.ts +51 -1
  11. package/dist/configWriter.d.ts.map +1 -1
  12. package/dist/configWriter.js +490 -63
  13. package/dist/configWriter.js.map +1 -1
  14. package/dist/harness/antigravityHooks.d.ts.map +1 -1
  15. package/dist/harness/antigravityHooks.js +33 -55
  16. package/dist/harness/antigravityHooks.js.map +1 -1
  17. package/dist/harness/claudeCodeHooks.d.ts +47 -13
  18. package/dist/harness/claudeCodeHooks.d.ts.map +1 -1
  19. package/dist/harness/claudeCodeHooks.js +316 -54
  20. package/dist/harness/claudeCodeHooks.js.map +1 -1
  21. package/dist/harness/claudeDesktopHooks.d.ts.map +1 -1
  22. package/dist/harness/claudeDesktopHooks.js +35 -48
  23. package/dist/harness/claudeDesktopHooks.js.map +1 -1
  24. package/dist/harness/clineHooks.d.ts.map +1 -1
  25. package/dist/harness/clineHooks.js +42 -34
  26. package/dist/harness/clineHooks.js.map +1 -1
  27. package/dist/harness/codexHooks.d.ts +36 -0
  28. package/dist/harness/codexHooks.d.ts.map +1 -0
  29. package/dist/harness/codexHooks.js +227 -0
  30. package/dist/harness/codexHooks.js.map +1 -0
  31. package/dist/harness/continueHooks.d.ts +45 -5
  32. package/dist/harness/continueHooks.d.ts.map +1 -1
  33. package/dist/harness/continueHooks.js +225 -5
  34. package/dist/harness/continueHooks.js.map +1 -1
  35. package/dist/harness/cursorHooks.d.ts +31 -0
  36. package/dist/harness/cursorHooks.d.ts.map +1 -1
  37. package/dist/harness/cursorHooks.js +78 -49
  38. package/dist/harness/cursorHooks.js.map +1 -1
  39. package/dist/harness/dshHooks.d.ts +198 -0
  40. package/dist/harness/dshHooks.d.ts.map +1 -0
  41. package/dist/harness/dshHooks.js +569 -0
  42. package/dist/harness/dshHooks.js.map +1 -0
  43. package/dist/harness/gateBody.d.ts +422 -0
  44. package/dist/harness/gateBody.d.ts.map +1 -0
  45. package/dist/harness/gateBody.js +1816 -0
  46. package/dist/harness/gateBody.js.map +1 -0
  47. package/dist/harness/gateKind.d.ts +164 -0
  48. package/dist/harness/gateKind.d.ts.map +1 -0
  49. package/dist/harness/gateKind.js +143 -0
  50. package/dist/harness/gateKind.js.map +1 -0
  51. package/dist/harness/githubCopilotHooks.d.ts +54 -0
  52. package/dist/harness/githubCopilotHooks.d.ts.map +1 -0
  53. package/dist/harness/githubCopilotHooks.js +218 -0
  54. package/dist/harness/githubCopilotHooks.js.map +1 -0
  55. package/dist/harness/gooseHooks.d.ts.map +1 -1
  56. package/dist/harness/gooseHooks.js +67 -37
  57. package/dist/harness/gooseHooks.js.map +1 -1
  58. package/dist/harness/grokHooks.d.ts +77 -0
  59. package/dist/harness/grokHooks.d.ts.map +1 -0
  60. package/dist/harness/grokHooks.js +350 -0
  61. package/dist/harness/grokHooks.js.map +1 -0
  62. package/dist/harness/hermesHooks.d.ts.map +1 -1
  63. package/dist/harness/hermesHooks.js +26 -55
  64. package/dist/harness/hermesHooks.js.map +1 -1
  65. package/dist/harness/holdRedaction.d.ts +69 -0
  66. package/dist/harness/holdRedaction.d.ts.map +1 -0
  67. package/dist/harness/holdRedaction.js +211 -0
  68. package/dist/harness/holdRedaction.js.map +1 -0
  69. package/dist/harness/jetbrainsXmlConfig.d.ts +51 -0
  70. package/dist/harness/jetbrainsXmlConfig.d.ts.map +1 -0
  71. package/dist/harness/jetbrainsXmlConfig.js +151 -0
  72. package/dist/harness/jetbrainsXmlConfig.js.map +1 -0
  73. package/dist/harness/mcpAutoWrite.d.ts +100 -3
  74. package/dist/harness/mcpAutoWrite.d.ts.map +1 -1
  75. package/dist/harness/mcpAutoWrite.js +712 -90
  76. package/dist/harness/mcpAutoWrite.js.map +1 -1
  77. package/dist/harness/museHooks.d.ts +53 -0
  78. package/dist/harness/museHooks.d.ts.map +1 -0
  79. package/dist/harness/museHooks.js +273 -0
  80. package/dist/harness/museHooks.js.map +1 -0
  81. package/dist/harness/n8nHooks.d.ts +25 -9
  82. package/dist/harness/n8nHooks.d.ts.map +1 -1
  83. package/dist/harness/n8nHooks.js +174 -9
  84. package/dist/harness/n8nHooks.js.map +1 -1
  85. package/dist/harness/openCodeHooks.d.ts +93 -0
  86. package/dist/harness/openCodeHooks.d.ts.map +1 -0
  87. package/dist/harness/openCodeHooks.js +248 -0
  88. package/dist/harness/openCodeHooks.js.map +1 -0
  89. package/dist/harness/openWebuiHooks.d.ts.map +1 -1
  90. package/dist/harness/openWebuiHooks.js +56 -11
  91. package/dist/harness/openWebuiHooks.js.map +1 -1
  92. package/dist/harness/openclawHooks.d.ts.map +1 -1
  93. package/dist/harness/openclawHooks.js +30 -54
  94. package/dist/harness/openclawHooks.js.map +1 -1
  95. package/dist/harness/openhandsHooks.d.ts.map +1 -1
  96. package/dist/harness/openhandsHooks.js +35 -41
  97. package/dist/harness/openhandsHooks.js.map +1 -1
  98. package/dist/harness/piHooks.d.ts.map +1 -1
  99. package/dist/harness/piHooks.js +31 -58
  100. package/dist/harness/piHooks.js.map +1 -1
  101. package/dist/harness/protectedPaths.d.ts +353 -0
  102. package/dist/harness/protectedPaths.d.ts.map +1 -0
  103. package/dist/harness/protectedPaths.js +805 -0
  104. package/dist/harness/protectedPaths.js.map +1 -0
  105. package/dist/harness/rooCodeHooks.d.ts.map +1 -1
  106. package/dist/harness/rooCodeHooks.js +34 -48
  107. package/dist/harness/rooCodeHooks.js.map +1 -1
  108. package/dist/harness/windsurfHooks.d.ts +72 -0
  109. package/dist/harness/windsurfHooks.d.ts.map +1 -1
  110. package/dist/harness/windsurfHooks.js +172 -58
  111. package/dist/harness/windsurfHooks.js.map +1 -1
  112. package/dist/harness/windsurfJetBrainsProxy.d.ts +78 -0
  113. package/dist/harness/windsurfJetBrainsProxy.d.ts.map +1 -0
  114. package/dist/harness/windsurfJetBrainsProxy.js +159 -0
  115. package/dist/harness/windsurfJetBrainsProxy.js.map +1 -0
  116. package/dist/hashReporter.js +1 -1
  117. package/dist/hashReporter.js.map +1 -1
  118. package/dist/index.d.ts +12 -6
  119. package/dist/index.d.ts.map +1 -1
  120. package/dist/index.js +14 -6
  121. package/dist/index.js.map +1 -1
  122. package/dist/integrityStore.d.ts +0 -8
  123. package/dist/integrityStore.d.ts.map +1 -1
  124. package/dist/integrityStore.js +6 -29
  125. package/dist/integrityStore.js.map +1 -1
  126. package/dist/lib/approvedBypasses.d.ts +76 -0
  127. package/dist/lib/approvedBypasses.d.ts.map +1 -0
  128. package/dist/lib/approvedBypasses.js +140 -0
  129. package/dist/lib/approvedBypasses.js.map +1 -0
  130. package/dist/lib/complianceProbes.d.ts.map +1 -1
  131. package/dist/lib/complianceProbes.js +5 -0
  132. package/dist/lib/complianceProbes.js.map +1 -1
  133. package/dist/lib/decisionsDigest.d.ts +99 -0
  134. package/dist/lib/decisionsDigest.d.ts.map +1 -0
  135. package/dist/lib/decisionsDigest.js +199 -0
  136. package/dist/lib/decisionsDigest.js.map +1 -0
  137. package/dist/lib/egressPolicy.d.ts +69 -0
  138. package/dist/lib/egressPolicy.d.ts.map +1 -0
  139. package/dist/lib/egressPolicy.js +126 -0
  140. package/dist/lib/egressPolicy.js.map +1 -0
  141. package/dist/lib/gitWorktrees.d.ts +140 -0
  142. package/dist/lib/gitWorktrees.d.ts.map +1 -0
  143. package/dist/lib/gitWorktrees.js +191 -0
  144. package/dist/lib/gitWorktrees.js.map +1 -0
  145. package/dist/lib/policySnapshot.d.ts +224 -0
  146. package/dist/lib/policySnapshot.d.ts.map +1 -0
  147. package/dist/lib/policySnapshot.js +637 -0
  148. package/dist/lib/policySnapshot.js.map +1 -0
  149. package/dist/lib/processPoller.d.ts +44 -0
  150. package/dist/lib/processPoller.d.ts.map +1 -1
  151. package/dist/lib/processPoller.js +176 -1
  152. package/dist/lib/processPoller.js.map +1 -1
  153. package/dist/lib/runtimeEnv.d.ts +8 -0
  154. package/dist/lib/runtimeEnv.d.ts.map +1 -1
  155. package/dist/lib/runtimeEnv.js +3 -0
  156. package/dist/lib/runtimeEnv.js.map +1 -1
  157. package/dist/localTrajectoryHeuristics.d.ts +51 -0
  158. package/dist/localTrajectoryHeuristics.d.ts.map +1 -0
  159. package/dist/localTrajectoryHeuristics.js +90 -0
  160. package/dist/localTrajectoryHeuristics.js.map +1 -0
  161. package/dist/sessionReporter.d.ts +70 -0
  162. package/dist/sessionReporter.d.ts.map +1 -0
  163. package/dist/sessionReporter.js +140 -0
  164. package/dist/sessionReporter.js.map +1 -0
  165. package/dist/skillWriter.d.ts +1 -1
  166. package/dist/skillWriter.d.ts.map +1 -1
  167. package/dist/skillWriter.js +5 -2
  168. package/dist/skillWriter.js.map +1 -1
  169. package/dist/syncLoop.d.ts +105 -3
  170. package/dist/syncLoop.d.ts.map +1 -1
  171. package/dist/syncLoop.js +397 -65
  172. package/dist/syncLoop.js.map +1 -1
  173. package/dist/trajectoryMonitor.d.ts +2 -0
  174. package/dist/trajectoryMonitor.d.ts.map +1 -1
  175. package/dist/trajectoryMonitor.js +57 -0
  176. package/dist/trajectoryMonitor.js.map +1 -1
  177. package/dist/watcher/driftWatcher.d.ts.map +1 -1
  178. package/dist/watcher/driftWatcher.js +12 -3
  179. package/dist/watcher/driftWatcher.js.map +1 -1
  180. package/dist/watcher/settingsGuard.d.ts +23 -0
  181. package/dist/watcher/settingsGuard.d.ts.map +1 -1
  182. package/dist/watcher/settingsGuard.js +202 -17
  183. package/dist/watcher/settingsGuard.js.map +1 -1
  184. package/package.json +37 -6
  185. package/dist/brainIndexer.d.ts +0 -51
  186. package/dist/brainIndexer.d.ts.map +0 -1
  187. package/dist/brainIndexer.js +0 -148
  188. package/dist/brainIndexer.js.map +0 -1
  189. package/dist/harness/cursorHooksJson.d.ts +0 -29
  190. package/dist/harness/cursorHooksJson.d.ts.map +0 -1
  191. package/dist/harness/cursorHooksJson.js +0 -130
  192. package/dist/harness/cursorHooksJson.js.map +0 -1
  193. package/dist/harness/gooseHooksWriter.d.ts +0 -27
  194. package/dist/harness/gooseHooksWriter.d.ts.map +0 -1
  195. package/dist/harness/gooseHooksWriter.js +0 -147
  196. package/dist/harness/gooseHooksWriter.js.map +0 -1
  197. package/dist/harness/openhandsHooksWriter.d.ts +0 -23
  198. package/dist/harness/openhandsHooksWriter.d.ts.map +0 -1
  199. package/dist/harness/openhandsHooksWriter.js +0 -146
  200. package/dist/harness/openhandsHooksWriter.js.map +0 -1
@@ -1,2 +1,46 @@
1
+ /** One row of `ps -ax -o pid,ppid,comm` output. */
2
+ export interface ProcessTreeEntry {
3
+ pid: number;
4
+ ppid: number;
5
+ /** Short executable name (not the full command line). */
6
+ comm: string;
7
+ }
8
+ /**
9
+ * Parses `ps -ax -o pid,ppid,comm` output into structured rows. A pure
10
+ * function — no process spawning — so it can be exercised directly with a
11
+ * captured fixture rather than mocking `execSync`.
12
+ *
13
+ * Format per line: `<PID> <PPID> <COMM>`, where `comm` may itself contain no
14
+ * spaces (it is the short executable name column, unlike `args`).
15
+ */
16
+ export declare function parseProcessTreeOutput(output: string): ProcessTreeEntry[];
17
+ /**
18
+ * Best-effort, PROBABILISTIC signal that one or more of Claude Code/Codex/
19
+ * Gemini CLI is running as a descendant of a `tmux` server process — i.e.
20
+ * something is orchestrating multiple CLI agents via tmux, the exact shape
21
+ * Xirp uses (tmux session + git worktree, per its own FAQ). This is NOT a
22
+ * confirmation that Xirp specifically is the orchestrator: any hand-rolled
23
+ * tmux-based multi-agent workflow (a personal dotfiles script, a different
24
+ * tool) trips the identical signal, and this function cannot and does not
25
+ * distinguish them. Treat it as corroborating evidence to combine with
26
+ * `xirp.ts`'s own `~/.xirp`/`$XIRP_HOME`/`Xirp.app` detection — never as a
27
+ * standalone "Xirp is running" claim.
28
+ *
29
+ * A pure function over an already-parsed process tree (see
30
+ * `parseProcessTreeOutput`) so the ancestry-walk logic itself is testable
31
+ * without mocking `execSync` or depending on the test machine's real
32
+ * process table.
33
+ */
34
+ export declare function hasTmuxParentedAgent(tree: readonly ProcessTreeEntry[]): boolean;
35
+ /**
36
+ * Runs `ps -ax -o pid,ppid,comm` and checks for a tmux-parented agent. Wraps
37
+ * `hasTmuxParentedAgent` with the real process table; see that function's
38
+ * doc for what this signal does and does not confirm. Defaults to `false`
39
+ * (a plain "no signal found", not "unknown") on any error — same
40
+ * fail-to-empty posture `getActiveAgentProcesses` uses, since this is
41
+ * best-effort telemetry, not a governance decision that needs to fail
42
+ * closed.
43
+ */
44
+ export declare function detectTmuxParentedAgents(): boolean;
1
45
  export declare function getActiveAgentProcesses(): string[];
2
46
  //# sourceMappingURL=processPoller.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"processPoller.d.ts","sourceRoot":"","sources":["../../src/lib/processPoller.ts"],"names":[],"mappings":"AAgEA,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CA4BlD"}
1
+ {"version":3,"file":"processPoller.d.ts","sourceRoot":"","sources":["../../src/lib/processPoller.ts"],"names":[],"mappings":"AAmJA,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAczE;AAQD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,SAAS,gBAAgB,EAAE,GAAG,OAAO,CAmB/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAQlD;AAED,wBAAgB,uBAAuB,IAAI,MAAM,EAAE,CA+BlD"}
@@ -56,16 +56,191 @@ const PROCESS_SIGNATURES = [
56
56
  name: 'Antigravity',
57
57
  patterns: [/\bantigravity\b/i],
58
58
  },
59
+ {
60
+ name: 'Muse Code',
61
+ patterns: [/\bmuse\b/],
62
+ },
63
+ {
64
+ name: 'Grok Build',
65
+ // `grok` is a short, common English word (and xAI's product name shows
66
+ // up in unrelated contexts too — chat clients, browser tab titles), so
67
+ // — the same false-positive concern `goose` required a qualifier for —
68
+ // a bare `\bgrok\b` would trip on a ps line that merely mentions the
69
+ // word. Anchored on "grok" appearing as an invoked COMMAND NAME: either
70
+ // the whole line (interactive `grok`), the leading word of the line, or
71
+ // right after a path separator (`/usr/local/bin/grok`), followed by
72
+ // whitespace/end-of-string/an argument dash — never merely appearing as
73
+ // a word inside a longer argument or unrelated sentence. Deliberately
74
+ // NOT keyed on a specific subcommand the way `goose`'s
75
+ // `.*\b(run|session)\b` is: Grok Build's subcommand vocabulary was not
76
+ // confirmed (the binary was not installable in this environment), so a
77
+ // keyword guess risked a false NEGATIVE on plain interactive `grok`
78
+ // instead.
79
+ patterns: [/(^|[/\\\s])grok(\s|$)/],
80
+ },
81
+ {
82
+ name: 'OpenCode',
83
+ // Anchored like `grok`: `opencode` is a plain word that can appear in
84
+ // arguments and paths, so only an invoked command name counts. `opencode2`
85
+ // is the 2.x line's alternate binary name.
86
+ patterns: [/(^|[/\\\s])opencode2?(\s|$)/],
87
+ },
88
+ {
89
+ name: 'dsh',
90
+ // `dsh` is a two-letter... no, three-letter token — shorter and more
91
+ // collision-prone than `grok` (which at least required a qualifier for
92
+ // being a common English word). A bare `\bdsh\b` would trip on a `ps`
93
+ // line mentioning it as an argument, a directory component, or a
94
+ // coincidental fragment. Anchored the same way `grok`'s entry is: only
95
+ // when `dsh` appears as an invoked COMMAND NAME — the whole line, the
96
+ // leading word, or right after a path separator — followed by
97
+ // whitespace/end-of-string/an argument dash, never merely present
98
+ // inside a longer token. Also matches the npm package name directly
99
+ // (`@deepseek-ai/dsh`), which `npx`/a locally-run bin often surfaces
100
+ // verbatim in `ps` output before the resolved binary name does.
101
+ patterns: [/(^|[/\\\s])dsh(\s|$)/, /@deepseek-ai\/dsh\b/],
102
+ },
103
+ {
104
+ name: 'Xirp',
105
+ // Xirp is a macOS `.app`, not a CLI binary invoked by name the way
106
+ // `grok`/`muse` are — its `ps -ax -o args` entries are dominated by the
107
+ // app bundle path, so that path fragment is the primary, most reliable
108
+ // signal (mirrors `Cursor.app`/`Claude.app`/`Windsurf.app` above, not
109
+ // the bare-word CLI pattern grok/muse needed). NOT independently
110
+ // verified against a real Xirp install — see xirp.ts's module doc and
111
+ // TD-390. The tmux-ancestry heuristic below is a separate, weaker
112
+ // signal this single-line regex scan cannot produce on its own (it has
113
+ // no parent-PID data).
114
+ patterns: [/\/Xirp\.app\//i],
115
+ },
116
+ {
117
+ name: 'Agentic Orchestrator',
118
+ // Unlike Xirp, `agentico` IS a CLI binary invoked by name (confirmed:
119
+ // the real released binary was run directly during this integration's
120
+ // research — `agentico`, `agentico server`, etc.) — so this follows the
121
+ // grok/dsh anchoring style, not Xirp's `.app`-path style. `agentico` is
122
+ // a coined, low-collision word (unlike `grok`/`dsh`'s common-word/
123
+ // short-token risk), but the same anchoring discipline applies
124
+ // regardless: only when it appears as an invoked COMMAND NAME — the
125
+ // whole line, the leading word, or right after a path separator —
126
+ // followed by whitespace/end-of-string/an argument dash, never merely
127
+ // present inside a longer token or unrelated argument.
128
+ patterns: [/(^|[/\\\s])agentico(\s|$)/],
129
+ },
59
130
  ];
131
+ /**
132
+ * Command-name patterns for the CLI harnesses Xirp is known to spawn inside
133
+ * its own tmux sessions (per its own FAQ): Claude Code, Codex, and Gemini
134
+ * CLI. Deliberately a SEPARATE, narrower list from `PROCESS_SIGNATURES`
135
+ * above — this exists only to recognise "one of the three agents Xirp
136
+ * wraps" for `detectTmuxParentedAgents` below, not as a general-purpose
137
+ * harness detector, and is matched against a short `comm` value (not a full
138
+ * command line), so it does not need `grok`'s word-boundary-in-a-sentence
139
+ * defenses — `comm` is already just the executable name.
140
+ */
141
+ const XIRP_WRAPPED_AGENT_COMM_PATTERNS = [/^claude$/, /^codex$/, /^gemini$/];
142
+ /**
143
+ * Parses `ps -ax -o pid,ppid,comm` output into structured rows. A pure
144
+ * function — no process spawning — so it can be exercised directly with a
145
+ * captured fixture rather than mocking `execSync`.
146
+ *
147
+ * Format per line: `<PID> <PPID> <COMM>`, where `comm` may itself contain no
148
+ * spaces (it is the short executable name column, unlike `args`).
149
+ */
150
+ export function parseProcessTreeOutput(output) {
151
+ const rows = [];
152
+ for (const line of output.split('\n')) {
153
+ const trimmed = line.trim();
154
+ if (!trimmed)
155
+ continue;
156
+ const parts = trimmed.split(/\s+/);
157
+ if (parts.length < 3)
158
+ continue;
159
+ const pid = Number.parseInt(parts[0], 10);
160
+ const ppid = Number.parseInt(parts[1], 10);
161
+ const comm = parts[2];
162
+ if (Number.isNaN(pid) || Number.isNaN(ppid))
163
+ continue;
164
+ rows.push({ pid, ppid, comm });
165
+ }
166
+ return rows;
167
+ }
168
+ /** Ancestor-chain walk depth cap — a real process tree is a handful of
169
+ * levels deep; bounding this avoids a pathological loop if `ps` ever
170
+ * returns a cyclic or self-referential PPID (has happened on some
171
+ * container/namespace setups). */
172
+ const MAX_ANCESTRY_DEPTH = 32;
173
+ /**
174
+ * Best-effort, PROBABILISTIC signal that one or more of Claude Code/Codex/
175
+ * Gemini CLI is running as a descendant of a `tmux` server process — i.e.
176
+ * something is orchestrating multiple CLI agents via tmux, the exact shape
177
+ * Xirp uses (tmux session + git worktree, per its own FAQ). This is NOT a
178
+ * confirmation that Xirp specifically is the orchestrator: any hand-rolled
179
+ * tmux-based multi-agent workflow (a personal dotfiles script, a different
180
+ * tool) trips the identical signal, and this function cannot and does not
181
+ * distinguish them. Treat it as corroborating evidence to combine with
182
+ * `xirp.ts`'s own `~/.xirp`/`$XIRP_HOME`/`Xirp.app` detection — never as a
183
+ * standalone "Xirp is running" claim.
184
+ *
185
+ * A pure function over an already-parsed process tree (see
186
+ * `parseProcessTreeOutput`) so the ancestry-walk logic itself is testable
187
+ * without mocking `execSync` or depending on the test machine's real
188
+ * process table.
189
+ */
190
+ export function hasTmuxParentedAgent(tree) {
191
+ const byPid = new Map(tree.map((p) => [p.pid, p]));
192
+ const isTmux = (comm) => comm === 'tmux' || comm.startsWith('tmux:');
193
+ for (const proc of tree) {
194
+ if (!XIRP_WRAPPED_AGENT_COMM_PATTERNS.some((p) => p.test(proc.comm)))
195
+ continue;
196
+ let current = proc;
197
+ const seen = new Set();
198
+ for (let depth = 0; current && depth < MAX_ANCESTRY_DEPTH; depth++) {
199
+ if (seen.has(current.pid))
200
+ break; // cyclic PPID chain — stop, not infinite-loop
201
+ seen.add(current.pid);
202
+ const parent = byPid.get(current.ppid);
203
+ if (!parent)
204
+ break;
205
+ if (isTmux(parent.comm))
206
+ return true;
207
+ current = parent;
208
+ }
209
+ }
210
+ return false;
211
+ }
212
+ /**
213
+ * Runs `ps -ax -o pid,ppid,comm` and checks for a tmux-parented agent. Wraps
214
+ * `hasTmuxParentedAgent` with the real process table; see that function's
215
+ * doc for what this signal does and does not confirm. Defaults to `false`
216
+ * (a plain "no signal found", not "unknown") on any error — same
217
+ * fail-to-empty posture `getActiveAgentProcesses` uses, since this is
218
+ * best-effort telemetry, not a governance decision that needs to fail
219
+ * closed.
220
+ */
221
+ export function detectTmuxParentedAgents() {
222
+ if (process.platform === 'win32')
223
+ return false; // tmux does not exist on Windows
224
+ try {
225
+ const rawOutput = execSync('ps -ax -o pid,ppid,comm', { encoding: 'utf-8', timeout: 3000 });
226
+ return hasTmuxParentedAgent(parseProcessTreeOutput(rawOutput));
227
+ }
228
+ catch {
229
+ return false;
230
+ }
231
+ }
60
232
  export function getActiveAgentProcesses() {
61
233
  const isWindows = process.platform === 'win32';
62
- let rawOutput = '';
234
+ let rawOutput;
63
235
  try {
64
236
  rawOutput = isWindows
65
237
  ? execSync('tasklist /FO CSV /NH', { encoding: 'utf-8', timeout: 3000 })
66
238
  : execSync('ps -ax -o args', { encoding: 'utf-8', timeout: 3000 });
67
239
  }
68
240
  catch {
241
+ // Deliberate fail-open: the process table is best-effort telemetry, so a
242
+ // missing/blocked `ps`/`tasklist` (or the 3 s timeout) reports "no agents"
243
+ // rather than failing the poll. Nothing after this point can run without it.
69
244
  return [];
70
245
  }
71
246
  const lines = rawOutput.split('\n').filter((line) => line.trim().length > 0);
@@ -1 +1 @@
1
- {"version":3,"file":"processPoller.js","sourceRoot":"","sources":["../../src/lib/processPoller.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,kBAAkB,GAGnB;IACH;QACE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,kBAAkB,EAAE,oCAAoC,CAAC;KACrE;IACD;QACE,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE,CAAC,8BAA8B,EAAE,6BAA6B,CAAC;KAC1E;IACD;QACE,IAAI,EAAE,aAAa;QACnB,QAAQ,EAAE,CAAC,6BAA6B,CAAC;KAC1C;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,QAAQ,EAAE,CAAC,kBAAkB,EAAE,YAAY,CAAC;KAC7C;IACD;QACE,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;IACD;QACE,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC,WAAW,CAAC;KACxB;IACD;QACE,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,CAAC,8BAA8B,CAAC;KAC3C;IACD;QACE,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD;QACE,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,CAAC,iBAAiB,EAAE,gBAAgB,CAAC;KAChD;IACD;QACE,IAAI,EAAE,eAAe;QACrB,QAAQ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AAC;gBACnC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;oBACvB,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;oBACpB,MAAK;gBACP,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,MAAM,CAAC,CAAA;AACpB,CAAC"}
@@ -14,6 +14,7 @@
14
14
  * INTUTIC_HOST=https://api.intutic.ai
15
15
  * INTUTIC_API_KEY=sk-live-...
16
16
  * INTUTIC_WORKSPACE_ID=ws_...
17
+ * INTUTIC_VALKEY_URL=redis://127.0.0.1:6379 (only when a local Valkey is running)
17
18
  *
18
19
  * LLD #14 — Dual-path hook telemetry (WS-A1)
19
20
  *
@@ -36,6 +37,13 @@ export interface RuntimeEnvOptions {
36
37
  mcpProxyMode?: string;
37
38
  /** WS-5 Q3: 'rewrite' | 'immutable' | 'alert-only' (default: 'rewrite') */
38
39
  bypassEnforcementTier?: string;
40
+ /**
41
+ * The local Valkey the MCP governance proxies share their anomaly session
42
+ * window through (Wave 5.3, TD-437). Written as `INTUTIC_VALKEY_URL` only
43
+ * when the caller has one running; omitted otherwise, so a proxy never
44
+ * probes a Valkey nobody started.
45
+ */
46
+ valkeyUrl?: string;
39
47
  }
40
48
  /**
41
49
  * Write runtime credentials to `~/.intutic/env/runtime.env`.
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeEnv.d.ts","sourceRoot":"","sources":["../../src/lib/runtimeEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AASH,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,QAA4D,CAAA;AAEjG,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,eAAe,EAAE,MAAM,CAAA;IACvB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqC5E"}
1
+ {"version":3,"file":"runtimeEnv.d.ts","sourceRoot":"","sources":["../../src/lib/runtimeEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH,kFAAkF;AAClF,eAAO,MAAM,wBAAwB,QAA4D,CAAA;AAEjG,MAAM,WAAW,iBAAiB;IAChC,+DAA+D;IAC/D,eAAe,EAAE,MAAM,CAAA;IACvB,yBAAyB;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mDAAmD;IACnD,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,iEAAiE;IACjE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2EAA2E;IAC3E,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC5E"}
@@ -14,6 +14,7 @@
14
14
  * INTUTIC_HOST=https://api.intutic.ai
15
15
  * INTUTIC_API_KEY=sk-live-...
16
16
  * INTUTIC_WORKSPACE_ID=ws_...
17
+ * INTUTIC_VALKEY_URL=redis://127.0.0.1:6379 (only when a local Valkey is running)
17
18
  *
18
19
  * LLD #14 — Dual-path hook telemetry (WS-A1)
19
20
  *
@@ -42,6 +43,7 @@ export async function writeRuntimeEnv(opts) {
42
43
  const host = (opts.controlPlaneUrl ?? '').replace(/[\r\n]/g, '');
43
44
  const key = (opts.apiKey ?? '').replace(/[\r\n]/g, '');
44
45
  const wsId = (opts.workspaceId ?? '').replace(/[\r\n]/g, '');
46
+ const valkeyUrl = (opts.valkeyUrl ?? '').replace(/[\r\n]/g, '');
45
47
  const content = [
46
48
  `# Intutic hook runtime credentials — auto-generated. DO NOT EDIT.`,
47
49
  `# Sourced by ~/.intutic/hooks/*.sh and parsed by ~/.intutic/hooks/*.js at invocation time.`,
@@ -53,6 +55,7 @@ export async function writeRuntimeEnv(opts) {
53
55
  `INTUTIC_MCP_FAIL_OPEN=${(opts.mcpProxyFailBehavior ?? 'open') !== 'closed' ? 'true' : 'false'}`,
54
56
  `INTUTIC_MCP_PROXY_MODE=${opts.mcpProxyMode ?? 'per-session'}`,
55
57
  `INTUTIC_BYPASS_TIER=${opts.bypassEnforcementTier ?? 'rewrite'}`,
58
+ ...(valkeyUrl ? [`INTUTIC_VALKEY_URL=${valkeyUrl}`] : []),
56
59
  ``,
57
60
  `# LLM proxy routing (uncomment when Intutic Rust proxy is running on port 8080)`,
58
61
  `# GOOSE_BASE_URL=http://127.0.0.1:8080`,
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeEnv.js","sourceRoot":"","sources":["../../src/lib/runtimeEnv.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;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;AAE9C,MAAM,GAAG,GAAG,YAAY,CAAC,kBAAkB,CAAC,CAAA;AAE5C,kFAAkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE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Q,EAAE,OAAO,EAAE,CAAC,CAAA;IAC3D,MAAM,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC9B,MAAM,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAEjC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,4BAA4B,CAAC,CAAA;AAC3F,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Local trajectory heuristics (Wave 7, audit-remediation).
3
+ *
4
+ * Ports 4 of the 5 deterministic pre-screen rules from the enterprise
5
+ * control plane's `trajectoryAnalysisService.ts` (`HEURISTIC_RULES`) so an
6
+ * open-core or standalone daemon — no control plane connection required —
7
+ * still gets a trajectory guardrail, matching this codebase's tier boundary:
8
+ * free = local/deterministic, paid = judge/team/auto-learning.
9
+ *
10
+ * `BUDGET_EXCEEDED` does NOT port. It reads `budgetUtilization`,
11
+ * workspace-scoped spend-vs-cap state that only the control plane resolves
12
+ * today — `trajectoryMonitor.ts`'s `submitSummary` calls
13
+ * `buffer.toSummary([], 0)` with the comment "SOPs and budget filled by CP",
14
+ * meaning the daemon has no real value for this field at all, only a
15
+ * placeholder `0`. The proxy's own `local_spend.rs` tracks a DIFFERENT
16
+ * thing — a per-machine daily dollar cap, not this workspace-scoped budget
17
+ * percentage — so porting a rule under the same name against that source
18
+ * would silently change what the rule means, not just where it runs.
19
+ *
20
+ * Deterministic only, matching this package's own standing doctrine
21
+ * (`trajectoryMonitor.ts`'s module doc: "No LLM calls on developer
22
+ * machine — all judgment is server-side"). This module makes the same true
23
+ * of a fourth thing: a local guardrail that needs no server round trip at
24
+ * all, judgment or otherwise.
25
+ *
26
+ * @module
27
+ */
28
+ export type LocalHeuristicRule = 'RUNAWAY_VELOCITY' | 'LOOP_DETECTED' | 'ERROR_STORM' | 'TOOL_ABUSE';
29
+ export type LocalHeuristicSeverity = 'HIGH' | 'MEDIUM';
30
+ export interface LocalHeuristicResult {
31
+ triggered: true;
32
+ rule: LocalHeuristicRule;
33
+ severity: LocalHeuristicSeverity;
34
+ message: string;
35
+ }
36
+ /** The subset of `TrajectorySummaryPayload` these four rules need — every
37
+ * one of these fields is computed locally in `TrajectoryBuffer.toSummary`,
38
+ * unlike `budgetUtilization`. */
39
+ export interface LocalHeuristicInput {
40
+ tokenVelocity: number;
41
+ toolCallVelocity: number;
42
+ maxConsecutiveIdenticalCalls: number;
43
+ errorCount: number;
44
+ }
45
+ /**
46
+ * Runs the four portable heuristics against a locally-computed trajectory
47
+ * summary. Pure and synchronous — no I/O, no network, safe to call on every
48
+ * window regardless of control-plane reachability.
49
+ */
50
+ export declare function runLocalTrajectoryHeuristics(summary: LocalHeuristicInput): LocalHeuristicResult[];
51
+ //# sourceMappingURL=localTrajectoryHeuristics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localTrajectoryHeuristics.d.ts","sourceRoot":"","sources":["../src/localTrajectoryHeuristics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG,eAAe,GAAG,aAAa,GAAG,YAAY,CAAA;AACpG,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEtD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,IAAI,CAAA;IACf,IAAI,EAAE,kBAAkB,CAAA;IACxB,QAAQ,EAAE,sBAAsB,CAAA;IAChC,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;kCAEkC;AAClC,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,4BAA4B,EAAE,MAAM,CAAA;IACpC,UAAU,EAAE,MAAM,CAAA;CACnB;AA0DD;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mBAAmB,GAAG,oBAAoB,EAAE,CAOjG"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Local trajectory heuristics (Wave 7, audit-remediation).
3
+ *
4
+ * Ports 4 of the 5 deterministic pre-screen rules from the enterprise
5
+ * control plane's `trajectoryAnalysisService.ts` (`HEURISTIC_RULES`) so an
6
+ * open-core or standalone daemon — no control plane connection required —
7
+ * still gets a trajectory guardrail, matching this codebase's tier boundary:
8
+ * free = local/deterministic, paid = judge/team/auto-learning.
9
+ *
10
+ * `BUDGET_EXCEEDED` does NOT port. It reads `budgetUtilization`,
11
+ * workspace-scoped spend-vs-cap state that only the control plane resolves
12
+ * today — `trajectoryMonitor.ts`'s `submitSummary` calls
13
+ * `buffer.toSummary([], 0)` with the comment "SOPs and budget filled by CP",
14
+ * meaning the daemon has no real value for this field at all, only a
15
+ * placeholder `0`. The proxy's own `local_spend.rs` tracks a DIFFERENT
16
+ * thing — a per-machine daily dollar cap, not this workspace-scoped budget
17
+ * percentage — so porting a rule under the same name against that source
18
+ * would silently change what the rule means, not just where it runs.
19
+ *
20
+ * Deterministic only, matching this package's own standing doctrine
21
+ * (`trajectoryMonitor.ts`'s module doc: "No LLM calls on developer
22
+ * machine — all judgment is server-side"). This module makes the same true
23
+ * of a fourth thing: a local guardrail that needs no server round trip at
24
+ * all, judgment or otherwise.
25
+ *
26
+ * @module
27
+ */
28
+ /** Thresholds and severities mirror `HEURISTIC_RULES` in the enterprise
29
+ * `trajectoryAnalysisService.ts` exactly — this is a port, not a redesign. */
30
+ const LOCAL_HEURISTIC_RULES = [
31
+ {
32
+ rule: 'RUNAWAY_VELOCITY',
33
+ check: (s) => s.tokenVelocity > 50_000
34
+ ? {
35
+ triggered: true,
36
+ rule: 'RUNAWAY_VELOCITY',
37
+ severity: 'HIGH',
38
+ message: `Token velocity: ${s.tokenVelocity.toFixed(0)} tokens/min (threshold: 50,000)`,
39
+ }
40
+ : null,
41
+ },
42
+ {
43
+ rule: 'LOOP_DETECTED',
44
+ check: (s) => s.maxConsecutiveIdenticalCalls >= 5
45
+ ? {
46
+ triggered: true,
47
+ rule: 'LOOP_DETECTED',
48
+ severity: 'HIGH',
49
+ message: `${s.maxConsecutiveIdenticalCalls} consecutive identical tool calls detected`,
50
+ }
51
+ : null,
52
+ },
53
+ {
54
+ rule: 'ERROR_STORM',
55
+ check: (s) => s.errorCount > 10
56
+ ? {
57
+ triggered: true,
58
+ rule: 'ERROR_STORM',
59
+ severity: 'MEDIUM',
60
+ message: `${s.errorCount} errors in current window`,
61
+ }
62
+ : null,
63
+ },
64
+ {
65
+ rule: 'TOOL_ABUSE',
66
+ check: (s) => s.toolCallVelocity > 30
67
+ ? {
68
+ triggered: true,
69
+ rule: 'TOOL_ABUSE',
70
+ severity: 'MEDIUM',
71
+ message: `Tool call velocity: ${s.toolCallVelocity.toFixed(1)} calls/min (threshold: 30)`,
72
+ }
73
+ : null,
74
+ },
75
+ ];
76
+ /**
77
+ * Runs the four portable heuristics against a locally-computed trajectory
78
+ * summary. Pure and synchronous — no I/O, no network, safe to call on every
79
+ * window regardless of control-plane reachability.
80
+ */
81
+ export function runLocalTrajectoryHeuristics(summary) {
82
+ const results = [];
83
+ for (const { check } of LOCAL_HEURISTIC_RULES) {
84
+ const result = check(summary);
85
+ if (result)
86
+ results.push(result);
87
+ }
88
+ return results;
89
+ }
90
+ //# sourceMappingURL=localTrajectoryHeuristics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localTrajectoryHeuristics.js","sourceRoot":"","sources":["../src/localTrajectoryHeuristics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAsBH;+EAC+E;AAC/E,MAAM,qBAAqB,GAGtB;IACH;QACE,IAAI,EAAE,kBAAkB;QACxB,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CACX,CAAC,CAAC,aAAa,GAAG,MAAM;YACtB,CAAC,CAAC;gBACE,SAAS,EAAE,IAAI;gBACf,IAAI,EAAE,kBAAkB;gBACx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C,OAAO,CAAC,CAAA;QAC7B,IAAI,MAAM;YAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAClC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * sessionReporter.ts — turn harness detection into real control-plane
3
+ * sessions.
4
+ *
5
+ * The full-fidelity session path (POST /api/v1/sessions — branch/commit
6
+ * capture and the Jira/Linear/GitHub task-context cascade) had no production
7
+ * caller: sessions only ever existed as synthetic `ssp_` rows minted
8
+ * server-side. The daemon knows everything the route wants — workspace root,
9
+ * harness, git branch and commit — so it reports them once per harness per
10
+ * daemon run when the harness is first detected.
11
+ *
12
+ * WHICH row it reports them onto (TD-231, Wave 5.6): when a local proxy is
13
+ * reachable, the caller passes that process's `proxyInstanceId` and the
14
+ * control plane puts the context on the proxy's OWN row — the
15
+ * `ssp_<ws>_<harness>_<instance>` session it derives for that process's
16
+ * traces, so the branch, the task and the cost sit on one row (AI intensity
17
+ * reads them together) and the hook gate's blocks resolve to the same row.
18
+ * That row's lifecycle stays the control plane's 30-minute idle rule; the
19
+ * daemon never ends it, because an externally started proxy keeps serving
20
+ * after the daemon stops and an ended row would vanish from Active Sessions
21
+ * and from the hook gate's resolver while traces still attach to it. A
22
+ * respawned proxy has a new instance id, so it gets a new row on the next
23
+ * iteration. Without an instance id (no local proxy, or a shared gateway —
24
+ * `fetchLocalProxyInstanceId` refuses a `gw_` id) the daemon opens a `ses_`
25
+ * STANDARD row as before and ends it on shutdown
26
+ * (PATCH /api/v1/sessions/:id/end).
27
+ *
28
+ * Dedupe lives here (module state keyed workspace+harness+instance), so
29
+ * callers — `startSyncLoop`'s iteration as well as the CLI's inline connect
30
+ * loop — can call `startHarnessSession` every iteration and only the first
31
+ * one POSTs. Git context is captured once per key, not on a branch switch.
32
+ * Everything is best-effort: a dead control plane costs a warning, never the
33
+ * sync loop.
34
+ *
35
+ * @module
36
+ */
37
+ import type { HarnessType } from '@intutic/shared-types';
38
+ export interface GitInfo {
39
+ branchName?: string;
40
+ commitHash?: string;
41
+ commitMessage?: string;
42
+ }
43
+ /** Best-effort git context from the workspace root. */
44
+ export declare function readGitInfo(workspaceRoot: string): Promise<GitInfo>;
45
+ /**
46
+ * Report a harness session once per run — onto the local proxy's own row when
47
+ * `proxyInstanceId` is given (see the module doc), else as a new `ses_` row.
48
+ * Returns the sessionId when one is known (new or previously created).
49
+ */
50
+ export declare function startHarnessSession(opts: {
51
+ controlPlaneUrl: string;
52
+ apiKey: string;
53
+ workspaceId: string;
54
+ harnessType: HarnessType;
55
+ workspaceRoot: string;
56
+ agentRole?: string;
57
+ /**
58
+ * The local proxy process's instance id (`fetchLocalProxyInstanceId`).
59
+ * Present: the context is registered onto that process's proxy row, which
60
+ * this module never ends. Absent: a `ses_` row, ended on shutdown.
61
+ */
62
+ proxyInstanceId?: string;
63
+ }): Promise<string | null>;
64
+ /**
65
+ * End every `ses_` session this run opened. Called from shutdown paths. Proxy
66
+ * rows registered through `proxyInstanceId` are forgotten, not ended — the
67
+ * module doc says why.
68
+ */
69
+ export declare function endAllOpenSessions(controlPlaneUrl: string, apiKey: string): Promise<void>;
70
+ //# sourceMappingURL=sessionReporter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessionReporter.d.ts","sourceRoot":"","sources":["../src/sessionReporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAiBxD,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB;AAED,uDAAuD;AACvD,wBAAsB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBzE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE;IAC9C,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,WAAW,EAAE,WAAW,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;OAIG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCzB;AAED;;;;GAIG;AACH,wBAAsB,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkB/F"}