opencode-swarm 7.136.4 → 7.137.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/dist/agents/agent-output-schema.d.ts +2 -2
- package/dist/cli/{config-doctor-qwp5y9dk.js → config-doctor-vyx82nx2.js} +2 -2
- package/dist/cli/{core-jpjk2qvt.js → core-6w5sd5bc.js} +1 -1
- package/dist/cli/{curation-policy-8tsbaa4q.js → curation-policy-8tvs4pa0.js} +7 -6
- package/dist/cli/{curator-763smew7.js → curator-43xqs75k.js} +25 -25
- package/dist/cli/{curator-llm-factory-dg8mmzy7.js → curator-llm-factory-8nywfdsh.js} +25 -25
- package/dist/cli/{evidence-summary-service-nse06dqr.js → evidence-summary-service-85gw9p2m.js} +7 -7
- package/dist/cli/{gate-evidence-kdygjr56.js → gate-evidence-s2kytsrj.js} +4 -4
- package/dist/cli/{guardrail-explain-6jc012g3.js → guardrail-explain-8kkqz8tx.js} +26 -26
- package/dist/cli/{guardrail-log-86aw7fne.js → guardrail-log-e2v9qw71.js} +3 -3
- package/dist/cli/{hive-promoter-en786ja4.js → hive-promoter-jt9ky0hn.js} +25 -25
- package/dist/cli/{index-45y0y3xh.js → index-1zrb3vt2.js} +7 -7
- package/dist/cli/{index-d2sf9an1.js → index-5r6kkhd7.js} +4 -4
- package/dist/cli/{index-ne28wyyc.js → index-5wjw05dy.js} +2 -2
- package/dist/cli/{index-06htxvzq.js → index-72wzb81c.js} +3 -3
- package/dist/cli/{index-7t3vjw5e.js → index-877ah4kx.js} +1 -1
- package/dist/cli/{index-tncy55bp.js → index-8ehyt3rx.js} +1 -1
- package/dist/cli/{index-gjs5g97v.js → index-91kk2e9j.js} +1 -1
- package/dist/cli/{index-t1s4b5ha.js → index-92v63zzr.js} +688 -637
- package/dist/cli/{index-rkp6jvc3.js → index-aze9n64z.js} +2 -2
- package/dist/cli/{index-wy2f83j5.js → index-d00q9kpq.js} +5 -5
- package/dist/cli/{index-qv1xc6rd.js → index-d0nhz96c.js} +2 -2
- package/dist/cli/{index-hh34tyv7.js → index-dxatvs3f.js} +1 -1
- package/dist/cli/{index-4cv991ra.js → index-f24r6yqk.js} +3 -3
- package/dist/cli/{index-bb3ks0v3.js → index-fgkhpdc6.js} +6 -6
- package/dist/cli/{index-w6j1n5az.js → index-gv00q5gc.js} +1 -1
- package/dist/cli/index-h5sbn1zr.js +1670 -0
- package/dist/cli/{index-et8b70c8.js → index-j2ghsdzz.js} +27 -27
- package/dist/cli/{index-89fpahtg.js → index-j6ewv2pe.js} +6 -1
- package/dist/cli/{index-nfm9f10v.js → index-k3mezk96.js} +1 -1
- package/dist/cli/{index-94pvh7hc.js → index-mg26zd8x.js} +2 -2
- package/dist/cli/{index-pq8ge6fe.js → index-mwdzkr6k.js} +3 -2
- package/dist/cli/{index-b3jfcptk.js → index-n3h6rmbe.js} +1 -1
- package/dist/cli/{index-fkdxfdbx.js → index-p124rnwb.js} +4 -4
- package/dist/cli/{index-1hef020t.js → index-pcwjz5de.js} +1 -1
- package/dist/cli/{index-kym0cctr.js → index-qy3rgmkc.js} +1 -1
- package/dist/cli/{index-d61h3f3h.js → index-s3j9fsab.js} +2 -2
- package/dist/cli/{index-zzhyws9g.js → index-vft1pg34.js} +1 -1
- package/dist/cli/{index-fhnbzz75.js → index-wg98bsxz.js} +2 -2
- package/dist/cli/{index-g0sdhyqk.js → index-y25nsyaq.js} +1 -1
- package/dist/cli/index.js +25 -25
- package/dist/cli/{knowledge-escalator-e815bveb.js → knowledge-escalator-9k0kbx6b.js} +8 -7
- package/dist/cli/{knowledge-events-dz2tyhpw.js → knowledge-events-8nz3sa2d.js} +6 -5
- package/dist/cli/{knowledge-link-zr40rnwr.js → knowledge-link-t94b79qe.js} +5 -4
- package/dist/cli/{knowledge-store-97qr7m9k.js → knowledge-store-esghe3f9.js} +6 -5
- package/dist/cli/{knowledge-validator-xsetvy4v.js → knowledge-validator-bjxag1jp.js} +9 -8
- package/dist/cli/{pending-delegations-0h5b18p7.js → pending-delegations-kshh66s2.js} +3 -3
- package/dist/cli/{pr-subscriptions-jn0h047q.js → pr-subscriptions-5fpzz4f3.js} +3 -3
- package/dist/cli/{runner-deeswadt.js → runner-d820ws7y.js} +5 -5
- package/dist/cli/{scan-cursor-129fwf7e.js → scan-cursor-t212v00f.js} +7 -6
- package/dist/cli/{schema-3xdza5gg.js → schema-11gyrec3.js} +1 -1
- package/dist/cli/{scope-persistence-5xc9ntdh.js → scope-persistence-sjz200dt.js} +4 -4
- package/dist/cli/{skill-generator-8zhprasg.js → skill-generator-a07hpmw6.js} +10 -9
- package/dist/cli/{telemetry-6678gya0.js → telemetry-h7h7f0ez.js} +2 -1
- package/dist/cli/{worktree-collision-ownership-wt7cc850.js → worktree-collision-ownership-xzwab4xt.js} +3 -3
- package/dist/config/constants.d.ts +1 -1
- package/dist/config/evidence-schema.d.ts +103 -103
- package/dist/config/plan-schema.d.ts +10 -10
- package/dist/config/schema.d.ts +8 -8
- package/dist/consensus/contracts.d.ts +3 -3
- package/dist/hooks/guardrails/file-authority.d.ts +20 -1
- package/dist/hooks/hive-promoter.d.ts +1 -1
- package/dist/index.js +320 -321
- package/dist/memory/index.d.ts +1 -1
- package/dist/memory/local-jsonl-provider.d.ts +4 -1
- package/dist/memory/redaction.d.ts +91 -0
- package/dist/memory/sqlite-provider.d.ts +5 -1
- package/dist/observability/catalog.d.ts +84 -0
- package/dist/observability/envelope.d.ts +401 -0
- package/dist/observability/ids.d.ts +97 -0
- package/dist/observability/index.d.ts +58 -0
- package/dist/observability/legacy.d.ts +68 -0
- package/dist/observability/observe.d.ts +112 -0
- package/dist/observability/otel-mapping.d.ts +48 -0
- package/dist/observability/relationships.d.ts +44 -0
- package/dist/observability/sampling.d.ts +77 -0
- package/dist/summaries/schema.d.ts +2 -2
- package/dist/telemetry.d.ts +4 -1
- package/dist/utils/arg-hash.d.ts +113 -0
- package/dist/utils/stable-stringify.d.ts +47 -2
- package/package.json +3 -2
- package/dist/cli/index-cze4bq1x.js +0 -358
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
* Originally introduced for the adversarial-detector spiral hash
|
|
26
26
|
* (issue #2060) and shared with `file-authority.hashArgs` so both code paths
|
|
27
27
|
* use one correct implementation.
|
|
28
|
+
*
|
|
29
|
+
* This is a canonicalizer for HASH INPUT, not a drop-in `JSON.stringify`
|
|
30
|
+
* replacement — see the "Serialization limits" section on
|
|
31
|
+
* `stableCanonicalStringify` before using it anywhere the output is parsed or
|
|
32
|
+
* shown to a user.
|
|
28
33
|
*/
|
|
29
34
|
/**
|
|
30
35
|
* Recursively produces a canonical JSON string with object keys sorted at
|
|
@@ -39,8 +44,48 @@
|
|
|
39
44
|
* function exists to eliminate. Sorting must be done by rebuilding each object
|
|
40
45
|
* with sorted keys before serialization.
|
|
41
46
|
*
|
|
47
|
+
* ## Serialization limits (#2062 F-008 — deliberate, verified, do not "fix"
|
|
48
|
+
* without re-reading this)
|
|
49
|
+
*
|
|
50
|
+
* - **No `toJSON` support.** `toJSON` is never consulted. A `Date` therefore
|
|
51
|
+
* collapses to `{}` (it has no own enumerable keys) — a genuine divergence
|
|
52
|
+
* from `JSON.stringify`, which emits the ISO string.
|
|
53
|
+
* - **`Map`/`Set` collapse to `{}`.** This MATCHES `JSON.stringify` (neither
|
|
54
|
+
* exposes own enumerable string keys), so it is lossy for both rather than a
|
|
55
|
+
* divergence between them.
|
|
56
|
+
* - **`undefined` serializes as `null`** in object-property AND array-element
|
|
57
|
+
* position, so no bare `undefined` token or sparse-array hole is emitted for
|
|
58
|
+
* it. `JSON.stringify` instead omits an `undefined`-valued property; keeping
|
|
59
|
+
* the key here is deliberate — two objects differing only by a
|
|
60
|
+
* present-but-undefined key must not hash equal. True sparse array *holes*
|
|
61
|
+
* (`[1,,3]`) are NOT covered: `Array.prototype.map` skips holes, so they
|
|
62
|
+
* still render as `[1,,3]`.
|
|
63
|
+
* - **Function and symbol values still emit a bare `undefined` token**, which
|
|
64
|
+
* is not valid JSON. It is deterministic, so it is safe as hash input, but
|
|
65
|
+
* the result is not always `JSON.parse`-able.
|
|
66
|
+
*
|
|
67
|
+
* These limits are safe at every current call site: the cohort fingerprint
|
|
68
|
+
* input is a flat all-primitive struct, and the hook call sites hash tool-call
|
|
69
|
+
* arguments that have already round-tripped through JSON transport, so
|
|
70
|
+
* `Date`/`Map`/`Set`/function values cannot reach them.
|
|
71
|
+
*
|
|
72
|
+
* ## Throwing, and how callers must (and must not) handle it
|
|
73
|
+
*
|
|
42
74
|
* Throws on cyclic structures (infinite recursion) and on values that
|
|
43
|
-
* `JSON.stringify` cannot represent (BigInt)
|
|
44
|
-
*
|
|
75
|
+
* `JSON.stringify` cannot represent (BigInt). Correct caller handling depends
|
|
76
|
+
* on what the hash is FOR:
|
|
77
|
+
*
|
|
78
|
+
* - **Repetition / spiral-detection callers** (`hashArgsForSpiral` in
|
|
79
|
+
* `hooks/adversarial-detector.ts`, `hashArgs` in
|
|
80
|
+
* `hooks/guardrails/file-authority.ts`) SHOULD wrap in try/catch and fall
|
|
81
|
+
* back to a stable coarse hash. There, a fallback only degrades detection
|
|
82
|
+
* sensitivity for the one call that failed.
|
|
83
|
+
* - **Identity / fail-closed comparison callers** (e.g.
|
|
84
|
+
* `computeMemoryCohortFingerprint` in `memory/redaction.ts`) MUST NOT do
|
|
85
|
+
* that. A constant fallback would collapse every failing input to the same
|
|
86
|
+
* fingerprint, so two genuinely incompatible cohort members would compare
|
|
87
|
+
* equal and the fail-closed coherence check would be silently defeated. Let
|
|
88
|
+
* the throw propagate, or rethrow with added context — never return a
|
|
89
|
+
* constant.
|
|
45
90
|
*/
|
|
46
91
|
export declare function stableCanonicalStringify(value: unknown): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-swarm",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.137.0",
|
|
4
4
|
"description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -104,7 +104,8 @@
|
|
|
104
104
|
"prepare": "bun run build",
|
|
105
105
|
"repro:704": "node scripts/repro-704.mjs",
|
|
106
106
|
"repro:1144": "bun scripts/repro-1144.mjs",
|
|
107
|
-
"repro:1873": "bun build scripts/repro-1873-entry.ts --outdir dist-build-test/repro-1873 --target node --format esm && node scripts/repro-1873.mjs"
|
|
107
|
+
"repro:1873": "bun build scripts/repro-1873-entry.ts --outdir dist-build-test/repro-1873 --target node --format esm && node scripts/repro-1873.mjs",
|
|
108
|
+
"check:events": "bun run scripts/check-event-contract.ts"
|
|
108
109
|
},
|
|
109
110
|
"dependencies": {
|
|
110
111
|
"@opencode-ai/plugin": "^1.18.3",
|
|
@@ -1,358 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
// src/telemetry.ts
|
|
3
|
-
import * as fs from "fs";
|
|
4
|
-
import { createWriteStream } from "fs";
|
|
5
|
-
import * as os from "os";
|
|
6
|
-
import * as path from "path";
|
|
7
|
-
var _writeStream = null;
|
|
8
|
-
var _projectDirectory = null;
|
|
9
|
-
var _listeners = [];
|
|
10
|
-
var _disabled = false;
|
|
11
|
-
var _heartbeatTrackingActive = false;
|
|
12
|
-
var _heartbeatListener = null;
|
|
13
|
-
var heartbeatTimestamps = new Map;
|
|
14
|
-
function capHeartbeatMap() {
|
|
15
|
-
while (heartbeatTimestamps.size >= 500) {
|
|
16
|
-
const oldestKey = heartbeatTimestamps.keys().next().value;
|
|
17
|
-
if (oldestKey === undefined)
|
|
18
|
-
break;
|
|
19
|
-
heartbeatTimestamps.delete(oldestKey);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function startHeartbeatTracking() {
|
|
23
|
-
if (_heartbeatTrackingActive)
|
|
24
|
-
return;
|
|
25
|
-
_heartbeatTrackingActive = true;
|
|
26
|
-
const listener = (event, data) => {
|
|
27
|
-
if (event !== "heartbeat")
|
|
28
|
-
return;
|
|
29
|
-
const payload = data;
|
|
30
|
-
if (!payload?.sessionId)
|
|
31
|
-
return;
|
|
32
|
-
heartbeatTimestamps.set(payload.sessionId, Date.now());
|
|
33
|
-
capHeartbeatMap();
|
|
34
|
-
};
|
|
35
|
-
_heartbeatListener = listener;
|
|
36
|
-
addTelemetryListener(listener);
|
|
37
|
-
}
|
|
38
|
-
function getLastHeartbeat(sessionId) {
|
|
39
|
-
return heartbeatTimestamps.get(sessionId);
|
|
40
|
-
}
|
|
41
|
-
function stopHeartbeatTracking() {
|
|
42
|
-
_heartbeatTrackingActive = false;
|
|
43
|
-
if (_heartbeatListener !== null) {
|
|
44
|
-
const idx = _listeners.indexOf(_heartbeatListener);
|
|
45
|
-
if (idx >= 0)
|
|
46
|
-
_listeners.splice(idx, 1);
|
|
47
|
-
_heartbeatListener = null;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
function resetHeartbeatTrackingForTesting() {
|
|
51
|
-
_heartbeatTrackingActive = false;
|
|
52
|
-
heartbeatTimestamps.clear();
|
|
53
|
-
if (_heartbeatListener !== null) {
|
|
54
|
-
const idx = _listeners.indexOf(_heartbeatListener);
|
|
55
|
-
if (idx >= 0)
|
|
56
|
-
_listeners.splice(idx, 1);
|
|
57
|
-
_heartbeatListener = null;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
var _emitCount = 0;
|
|
61
|
-
var ROTATION_CHECK_INTERVAL = 50;
|
|
62
|
-
function resetTelemetryForTesting() {
|
|
63
|
-
_disabled = false;
|
|
64
|
-
_projectDirectory = null;
|
|
65
|
-
_listeners.length = 0;
|
|
66
|
-
_emitCount = 0;
|
|
67
|
-
resetHeartbeatTrackingForTesting();
|
|
68
|
-
if (_writeStream !== null) {
|
|
69
|
-
_writeStream.end();
|
|
70
|
-
_writeStream = null;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function initTelemetry(projectDirectory) {
|
|
74
|
-
if (_writeStream !== null || _disabled) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
try {
|
|
78
|
-
_projectDirectory = projectDirectory;
|
|
79
|
-
const swarmDir = path.join(projectDirectory, ".swarm");
|
|
80
|
-
if (!fs.existsSync(swarmDir)) {
|
|
81
|
-
fs.mkdirSync(swarmDir, { recursive: true });
|
|
82
|
-
}
|
|
83
|
-
const telemetryPath = path.join(swarmDir, "telemetry.jsonl");
|
|
84
|
-
const stream = createWriteStream(telemetryPath, { flags: "a" });
|
|
85
|
-
stream.on("error", () => {
|
|
86
|
-
if (_writeStream === stream) {
|
|
87
|
-
_disabled = true;
|
|
88
|
-
_writeStream = null;
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
_writeStream = stream;
|
|
92
|
-
} catch {
|
|
93
|
-
_disabled = true;
|
|
94
|
-
_writeStream = null;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function emit(event, data) {
|
|
98
|
-
try {
|
|
99
|
-
if (_disabled || _writeStream === null) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
const line = JSON.stringify({
|
|
103
|
-
timestamp: new Date().toISOString(),
|
|
104
|
-
event,
|
|
105
|
-
...data
|
|
106
|
-
}) + os.EOL;
|
|
107
|
-
const stream = _writeStream;
|
|
108
|
-
stream.write(line, (err) => {
|
|
109
|
-
if (err && _writeStream === stream) {
|
|
110
|
-
_disabled = true;
|
|
111
|
-
_writeStream = null;
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
for (const listener of _listeners) {
|
|
115
|
-
try {
|
|
116
|
-
listener(event, data);
|
|
117
|
-
} catch {}
|
|
118
|
-
}
|
|
119
|
-
_emitCount++;
|
|
120
|
-
if (_emitCount >= ROTATION_CHECK_INTERVAL) {
|
|
121
|
-
_emitCount = 0;
|
|
122
|
-
_internals.rotateTelemetryIfNeeded();
|
|
123
|
-
}
|
|
124
|
-
} catch {}
|
|
125
|
-
}
|
|
126
|
-
function addTelemetryListener(callback) {
|
|
127
|
-
_listeners.push(callback);
|
|
128
|
-
}
|
|
129
|
-
function rotateTelemetryIfNeeded(maxBytes = 10 * 1024 * 1024) {
|
|
130
|
-
try {
|
|
131
|
-
if (_projectDirectory === null) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
const telemetryPath = path.join(_projectDirectory, ".swarm", "telemetry.jsonl");
|
|
135
|
-
if (!fs.existsSync(telemetryPath)) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
const stats = fs.statSync(telemetryPath);
|
|
139
|
-
if (stats.size < maxBytes) {
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
const rotatedPath = path.join(_projectDirectory, ".swarm", "telemetry.jsonl.1");
|
|
143
|
-
fs.renameSync(telemetryPath, rotatedPath);
|
|
144
|
-
if (_writeStream !== null) {
|
|
145
|
-
_writeStream.end();
|
|
146
|
-
const stream = createWriteStream(telemetryPath, { flags: "a" });
|
|
147
|
-
stream.on("error", () => {
|
|
148
|
-
if (_writeStream === stream) {
|
|
149
|
-
_disabled = true;
|
|
150
|
-
_writeStream = null;
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
_writeStream = stream;
|
|
154
|
-
}
|
|
155
|
-
} catch {}
|
|
156
|
-
}
|
|
157
|
-
var telemetry = {
|
|
158
|
-
sessionStarted(sessionId, agentName) {
|
|
159
|
-
_internals.emit("session_started", { sessionId, agentName });
|
|
160
|
-
},
|
|
161
|
-
sessionEnded(sessionId, reason) {
|
|
162
|
-
_internals.emit("session_ended", { sessionId, reason });
|
|
163
|
-
},
|
|
164
|
-
agentActivated(sessionId, agentName, oldName) {
|
|
165
|
-
_internals.emit("agent_activated", { sessionId, agentName, oldName });
|
|
166
|
-
},
|
|
167
|
-
delegationBegin(sessionId, agentName, taskId) {
|
|
168
|
-
_internals.emit("delegation_begin", { sessionId, agentName, taskId });
|
|
169
|
-
},
|
|
170
|
-
delegationEnd(sessionId, agentName, taskId, result, costFields) {
|
|
171
|
-
_internals.emit("delegation_end", {
|
|
172
|
-
sessionId,
|
|
173
|
-
agentName,
|
|
174
|
-
taskId,
|
|
175
|
-
result,
|
|
176
|
-
tokens_input: costFields?.tokens_input ?? 0,
|
|
177
|
-
tokens_output: costFields?.tokens_output ?? 0,
|
|
178
|
-
tokens_reasoning: costFields?.tokens_reasoning ?? 0,
|
|
179
|
-
tokens_cache: costFields?.tokens_cache ?? 0,
|
|
180
|
-
cost_usd: costFields?.cost_usd ?? null,
|
|
181
|
-
cost_source: costFields?.cost_source ?? "unavailable",
|
|
182
|
-
model: costFields?.model,
|
|
183
|
-
gate: costFields?.gate,
|
|
184
|
-
retry_index: costFields?.retry_index
|
|
185
|
-
});
|
|
186
|
-
},
|
|
187
|
-
taskStateChanged(sessionId, taskId, newState, oldState) {
|
|
188
|
-
_internals.emit("task_state_changed", {
|
|
189
|
-
sessionId,
|
|
190
|
-
taskId,
|
|
191
|
-
newState,
|
|
192
|
-
oldState
|
|
193
|
-
});
|
|
194
|
-
},
|
|
195
|
-
gatePassed(sessionId, gate, taskId) {
|
|
196
|
-
_internals.emit("gate_passed", { sessionId, gate, taskId });
|
|
197
|
-
},
|
|
198
|
-
gateParseError(taskId, error) {
|
|
199
|
-
_internals.emit("gate_parse_error", {
|
|
200
|
-
taskId,
|
|
201
|
-
errorName: error.name,
|
|
202
|
-
errorMessage: error.message.slice(0, 200)
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
gateFailed(sessionId, gate, taskId, reason) {
|
|
206
|
-
_internals.emit("gate_failed", { sessionId, gate, taskId, reason });
|
|
207
|
-
},
|
|
208
|
-
reviewerGateDecision(sessionId, taskId, blocked, reasonCode, evidenceKind) {
|
|
209
|
-
_internals.emit("reviewer_gate_decision", {
|
|
210
|
-
sessionId,
|
|
211
|
-
gate: "qa_gate",
|
|
212
|
-
taskId,
|
|
213
|
-
blocked,
|
|
214
|
-
allowed: !blocked,
|
|
215
|
-
reasonCode,
|
|
216
|
-
evidenceKind
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
phaseChanged(sessionId, oldPhase, newPhase) {
|
|
220
|
-
_internals.emit("phase_changed", { sessionId, oldPhase, newPhase });
|
|
221
|
-
},
|
|
222
|
-
budgetUpdated(sessionId, budgetPct, agentName) {
|
|
223
|
-
_internals.emit("budget_updated", { sessionId, budgetPct, agentName });
|
|
224
|
-
},
|
|
225
|
-
modelFallback(sessionId, agentName, fromModel, toModel, reason) {
|
|
226
|
-
_internals.emit("model_fallback", {
|
|
227
|
-
sessionId,
|
|
228
|
-
agentName,
|
|
229
|
-
fromModel,
|
|
230
|
-
toModel,
|
|
231
|
-
reason
|
|
232
|
-
});
|
|
233
|
-
},
|
|
234
|
-
hardLimitHit(sessionId, agentName, limitType, value) {
|
|
235
|
-
_internals.emit("hard_limit_hit", {
|
|
236
|
-
sessionId,
|
|
237
|
-
agentName,
|
|
238
|
-
limitType,
|
|
239
|
-
value
|
|
240
|
-
});
|
|
241
|
-
},
|
|
242
|
-
revisionLimitHit(sessionId, agentName) {
|
|
243
|
-
_internals.emit("revision_limit_hit", { sessionId, agentName });
|
|
244
|
-
},
|
|
245
|
-
loopDetected(sessionId, agentName, loopType) {
|
|
246
|
-
_internals.emit("loop_detected", { sessionId, agentName, loopType });
|
|
247
|
-
},
|
|
248
|
-
noOpStrongWarning(sessionId, agentName, count, threshold) {
|
|
249
|
-
_internals.emit("no_op_strong_warning", {
|
|
250
|
-
sessionId,
|
|
251
|
-
agentName,
|
|
252
|
-
count,
|
|
253
|
-
threshold
|
|
254
|
-
});
|
|
255
|
-
},
|
|
256
|
-
gateDenialLoop(sessionId, tool, code, count) {
|
|
257
|
-
_internals.emit("gate_denial_loop", { sessionId, tool, code, count });
|
|
258
|
-
},
|
|
259
|
-
executionStallWarning(sessionId, count, threshold) {
|
|
260
|
-
_internals.emit("execution_stall_warning", {
|
|
261
|
-
sessionId,
|
|
262
|
-
count,
|
|
263
|
-
threshold
|
|
264
|
-
});
|
|
265
|
-
},
|
|
266
|
-
executionStallDenied(sessionId, tool, count, threshold) {
|
|
267
|
-
_internals.emit("execution_stall_denied", {
|
|
268
|
-
sessionId,
|
|
269
|
-
tool,
|
|
270
|
-
count,
|
|
271
|
-
threshold
|
|
272
|
-
});
|
|
273
|
-
},
|
|
274
|
-
swarmInternalsReadDenied(sessionId, tool, target) {
|
|
275
|
-
_internals.emit("swarm_internals_read_denied", {
|
|
276
|
-
sessionId,
|
|
277
|
-
tool,
|
|
278
|
-
target
|
|
279
|
-
});
|
|
280
|
-
},
|
|
281
|
-
scopeViolation(sessionId, agentName, file, reason) {
|
|
282
|
-
_internals.emit("scope_violation", { sessionId, agentName, file, reason });
|
|
283
|
-
},
|
|
284
|
-
qaSkipViolation(sessionId, agentName, skipCount) {
|
|
285
|
-
_internals.emit("qa_skip_violation", { sessionId, agentName, skipCount });
|
|
286
|
-
},
|
|
287
|
-
heartbeat(sessionId) {
|
|
288
|
-
_internals.emit("heartbeat", { sessionId });
|
|
289
|
-
},
|
|
290
|
-
turboModeChanged(sessionId, enabled, agentName) {
|
|
291
|
-
_internals.emit("turbo_mode_changed", { sessionId, enabled, agentName });
|
|
292
|
-
},
|
|
293
|
-
autoOversightEscalation(sessionId, reason, interactionCount, deadlockCount, phase) {
|
|
294
|
-
_internals.emit("auto_oversight_escalation", {
|
|
295
|
-
sessionId,
|
|
296
|
-
reason,
|
|
297
|
-
interactionCount,
|
|
298
|
-
deadlockCount,
|
|
299
|
-
phase
|
|
300
|
-
});
|
|
301
|
-
},
|
|
302
|
-
environmentDetected(sessionId, hostOS, shellFamily, executionMode) {
|
|
303
|
-
_internals.emit("environment_detected", {
|
|
304
|
-
sessionId,
|
|
305
|
-
hostOS,
|
|
306
|
-
shellFamily,
|
|
307
|
-
executionMode
|
|
308
|
-
});
|
|
309
|
-
},
|
|
310
|
-
prmPatternDetected(sessionId, pattern, severity, category, stepRange) {
|
|
311
|
-
_internals.emit("prm_pattern_detected", {
|
|
312
|
-
sessionId,
|
|
313
|
-
pattern,
|
|
314
|
-
severity,
|
|
315
|
-
category,
|
|
316
|
-
stepRange
|
|
317
|
-
});
|
|
318
|
-
},
|
|
319
|
-
prmCourseCorrectionInjected(sessionId, pattern, level) {
|
|
320
|
-
_internals.emit("prm_course_correction_injected", {
|
|
321
|
-
sessionId,
|
|
322
|
-
pattern,
|
|
323
|
-
level
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
prmEscalationTriggered(sessionId, pattern, level, occurrenceCount) {
|
|
327
|
-
_internals.emit("prm_escalation_triggered", {
|
|
328
|
-
sessionId,
|
|
329
|
-
pattern,
|
|
330
|
-
level,
|
|
331
|
-
occurrenceCount
|
|
332
|
-
});
|
|
333
|
-
},
|
|
334
|
-
prmHardStop(sessionId, pattern, level, occurrenceCount) {
|
|
335
|
-
_internals.emit("prm_hard_stop", {
|
|
336
|
-
sessionId,
|
|
337
|
-
pattern,
|
|
338
|
-
level,
|
|
339
|
-
occurrenceCount
|
|
340
|
-
});
|
|
341
|
-
},
|
|
342
|
-
prmHardStopDelivered(sessionId, pattern, level, occurrenceCount) {
|
|
343
|
-
_internals.emit("prm_hard_stop_delivered", {
|
|
344
|
-
sessionId,
|
|
345
|
-
pattern,
|
|
346
|
-
level,
|
|
347
|
-
occurrenceCount
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
var _internals = {
|
|
352
|
-
telemetry,
|
|
353
|
-
emit,
|
|
354
|
-
rotateTelemetryIfNeeded,
|
|
355
|
-
heartbeatListenerCount: () => _heartbeatListener !== null ? 1 : 0
|
|
356
|
-
};
|
|
357
|
-
|
|
358
|
-
export { startHeartbeatTracking, getLastHeartbeat, stopHeartbeatTracking, resetHeartbeatTrackingForTesting, ROTATION_CHECK_INTERVAL, resetTelemetryForTesting, initTelemetry, emit, addTelemetryListener, rotateTelemetryIfNeeded, telemetry, _internals };
|