blun-king-cli 9.1.563 → 9.1.565
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/agent-spine-plugin/.claude-plugin/marketplace.json +20 -20
- package/agent-spine-plugin/.claude-plugin/plugin.json +14 -14
- package/agent-spine-plugin/.codex-plugin/plugin.json +34 -34
- package/agent-spine-plugin/.mcp.json +8 -8
- package/agent-spine-plugin/CONTRIBUTING.md +52 -0
- package/agent-spine-plugin/LICENSE +186 -186
- package/agent-spine-plugin/README.md +394 -0
- package/agent-spine-plugin/SECURITY.md +47 -0
- package/agent-spine-plugin/assets/agentspine-banner.svg +32 -32
- package/agent-spine-plugin/bin/agentspine-mcp.js +4 -4
- package/agent-spine-plugin/bin/agentspine.js +7 -7
- package/agent-spine-plugin/blun.plugin.json +33 -33
- package/agent-spine-plugin/hooks/codex.json +47 -47
- package/agent-spine-plugin/hooks/hooks.json +106 -106
- package/agent-spine-plugin/hooks/version.json +5 -5
- package/agent-spine-plugin/package.json +69 -69
- package/agent-spine-plugin/scripts/check-hosts.js +199 -199
- package/agent-spine-plugin/skill/SKILL.md +76 -76
- package/agent-spine-plugin/skills/agent-spine/SKILL.md +85 -85
- package/agent-spine-plugin/src/cli.js +1488 -1442
- package/agent-spine-plugin/src/hook.js +886 -812
- package/agent-spine-plugin/src/index.js +93 -93
- package/agent-spine-plugin/src/lib/acceptance.js +333 -333
- package/agent-spine-plugin/src/lib/attention.js +755 -755
- package/agent-spine-plugin/src/lib/audit.js +351 -342
- package/agent-spine-plugin/src/lib/authentication.js +515 -515
- package/agent-spine-plugin/src/lib/briefing.js +317 -317
- package/agent-spine-plugin/src/lib/catalog.js +167 -167
- package/agent-spine-plugin/src/lib/channel-runtime.js +665 -665
- package/agent-spine-plugin/src/lib/context.js +154 -154
- package/agent-spine-plugin/src/lib/continuity.js +338 -338
- package/agent-spine-plugin/src/lib/coordination.js +577 -577
- package/agent-spine-plugin/src/lib/documents.js +217 -217
- package/agent-spine-plugin/src/lib/feed-transport.js +499 -499
- package/agent-spine-plugin/src/lib/filesystem-retry.js +32 -32
- package/agent-spine-plugin/src/lib/gateway-runtime.js +1119 -760
- package/agent-spine-plugin/src/lib/graph.js +337 -337
- package/agent-spine-plugin/src/lib/hook-audit.js +29 -0
- package/agent-spine-plugin/src/lib/https-transport.js +392 -392
- package/agent-spine-plugin/src/lib/indexed-memory-offline.js +40 -40
- package/agent-spine-plugin/src/lib/indexed-memory.js +281 -281
- package/agent-spine-plugin/src/lib/learning.js +6923 -6466
- package/agent-spine-plugin/src/lib/object-transport.js +206 -206
- package/agent-spine-plugin/src/lib/owned-file-lock.js +143 -143
- package/agent-spine-plugin/src/lib/paths.js +109 -109
- package/agent-spine-plugin/src/lib/peer-transport.js +283 -283
- package/agent-spine-plugin/src/lib/persona-runtime.js +581 -581
- package/agent-spine-plugin/src/lib/preflight.js +702 -702
- package/agent-spine-plugin/src/lib/runtime.js +13 -13
- package/agent-spine-plugin/src/lib/selfstarter.js +892 -819
- package/agent-spine-plugin/src/lib/sharing.js +969 -969
- package/agent-spine-plugin/src/lib/source-roots.js +529 -482
- package/agent-spine-plugin/src/lib/sqlite-transport.js +501 -501
- package/agent-spine-plugin/src/lib/telegram-adapter.js +119 -119
- package/agent-spine-plugin/src/lib/voice-runtime.js +39 -39
- package/agent-spine-plugin/src/mcp.js +597 -572
- package/agent-spine-plugin/src/version.js +1 -1
- package/agent-spine-plugin/src/worker.js +202 -195
- package/bin/active-steer-priority-policy.cjs +24 -0
- package/bin/launcher-runtime.js +8 -1
- package/bin/mnemo-tool-agent-policy.cjs +22 -0
- package/bin/thinking-activity-status-policy.cjs +132 -0
- package/bin/thinking-only-guard.cjs +75 -0
- package/bin/tool-call-loop-policy.cjs +53 -0
- package/bin/turn-thinking-policy.cjs +25 -1
- package/blun.mjs +554 -64
- package/package.json +4 -1
- package/standard-skills/translate-native/LICENSE +21 -21
- package/standard-skills/translate-native/references/evaluation-protocol.md +95 -95
- package/standard-skills/translate-native/references/native-orthography.md +79 -79
- package/standard-skills/translate-native/references/native-translation-standard.md +94 -94
- package/standard-skills/translate-native/references/structured-content.md +72 -72
- package/standard-skills/translate-native/references/translationese-review.md +77 -77
- package/standard-skills/translate-native/scripts/blun_language_guard.py +697 -697
- package/standard-skills/translate-native/scripts/check_diacritics.py +353 -353
- package/standard-skills/translate-native/scripts/guard_service_client.py +264 -264
- package/standard-skills/translate-native/scripts/language_gateway.py +62 -62
- package/standard-skills/translate-native/scripts/language_quality.py +377 -377
- package/standard-skills/translate-native/scripts/pre_output_guard.py +64 -64
- package/standard-skills/translate-native/scripts/translation_guard.py +916 -916
- package/standard-tools/language-guard/blun_language_guard.py +697 -697
- package/standard-tools/language-guard/check_diacritics.py +353 -353
- package/standard-tools/language-guard/guard_service_client.py +264 -264
- package/standard-tools/language-guard/language_quality.py +377 -377
- package/standard-tools/language-guard/translation_guard.py +916 -916
|
@@ -1,342 +1,351 @@
|
|
|
1
|
-
import { canonicalPath, statePathIsScanExcluded } from "./paths.js";
|
|
2
|
-
import { buildCatalog, saveCatalog, verifyCatalog } from "./catalog.js";
|
|
3
|
-
import { loadGraph } from "./graph.js";
|
|
4
|
-
import { attentionFindings, inspectAttention } from "./attention.js";
|
|
5
|
-
import { inspectLearning, learningFindings } from "./learning.js";
|
|
6
|
-
import { coordinationFindings, delegationPolicyFindings, inspectCoordination } from "./coordination.js";
|
|
7
|
-
import { inspectSharing, sharingAuthenticationFindings, sharingFindings } from "./sharing.js";
|
|
8
|
-
import { inspectSignerRegistry, inspectTrust, trustFindings } from "./authentication.js";
|
|
9
|
-
import { resolveContext } from "./context.js";
|
|
10
|
-
import { sessionBriefing } from "./briefing.js";
|
|
11
|
-
import { inspectHttpsFeedState } from "./feed-transport.js";
|
|
12
|
-
import { continuityFindings, inspectContinuity } from "./continuity.js";
|
|
13
|
-
import {
|
|
14
|
-
executionPolicyFindings, inspectSelfstarter, selfstarterFindings
|
|
15
|
-
} from "./selfstarter.js";
|
|
16
|
-
import {
|
|
17
|
-
channelPolicyFindings, channelRuntimeFindings, inspectChannelRuntime
|
|
18
|
-
} from "./channel-runtime.js";
|
|
19
|
-
import { inspectPersonaRuntime, personaRuntimeFindings } from "./persona-runtime.js";
|
|
20
|
-
import { gatewayHealthFindings, gatewayRuntimeFindings, inspectGatewayRuntime } from "./gateway-runtime.js";
|
|
21
|
-
import { fileURLToPath } from "node:url";
|
|
22
|
-
import { checkHosts } from "../../scripts/check-hosts.js";
|
|
23
|
-
import { resolveHostSourceCatalog } from "./source-roots.js";
|
|
24
|
-
import { preflightStatus } from "./preflight.js";
|
|
25
|
-
|
|
26
|
-
function gate(id, name, ok, detail, severity = "error") {
|
|
27
|
-
return { id, name, ok, severity, detail };
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function authorityViolations(graph, attention, learning, continuity, coordination, sharing, trust, registry, feedState) {
|
|
31
|
-
const records = [
|
|
32
|
-
...graph.edges,
|
|
33
|
-
...graph.annotations,
|
|
34
|
-
...graph.entities,
|
|
35
|
-
...graph.entityEdges,
|
|
36
|
-
...graph.history,
|
|
37
|
-
...graph.history.map((entry) => entry.value).filter(Boolean),
|
|
38
|
-
...attention.signals,
|
|
39
|
-
...attention.activities,
|
|
40
|
-
...attention.events,
|
|
41
|
-
...attention.receipts,
|
|
42
|
-
...attention.history,
|
|
43
|
-
...attention.history.map((entry) => entry.value).filter(Boolean),
|
|
44
|
-
...learning.candidates,
|
|
45
|
-
...learning.candidates.flatMap((candidate) => [
|
|
46
|
-
...(candidate.evidence || []), candidate.review, candidate.rollback
|
|
47
|
-
]).filter(Boolean),
|
|
48
|
-
...(learning.outcomes || []),
|
|
49
|
-
...(learning.outcomes || []).map((outcome) => outcome.measurement).filter(Boolean),
|
|
50
|
-
...(learning.measurements || []),
|
|
51
|
-
...(learning.measurements || []).map((measurement) => measurement.measurement).filter(Boolean),
|
|
52
|
-
...(learning.measurementLineage || []),
|
|
53
|
-
...(learning.
|
|
54
|
-
...(learning.
|
|
55
|
-
...(learning.
|
|
56
|
-
...(learning.
|
|
57
|
-
...(learning.
|
|
58
|
-
...(learning.
|
|
59
|
-
...(learning.
|
|
60
|
-
...(learning.
|
|
61
|
-
...(learning.
|
|
62
|
-
...(learning.
|
|
63
|
-
...(learning.
|
|
64
|
-
...(learning.
|
|
65
|
-
...(learning.
|
|
66
|
-
...(learning.
|
|
67
|
-
...(learning.
|
|
68
|
-
...learning.
|
|
69
|
-
...learning.
|
|
70
|
-
...
|
|
71
|
-
...
|
|
72
|
-
...
|
|
73
|
-
...
|
|
74
|
-
...coordination.
|
|
75
|
-
...
|
|
76
|
-
...
|
|
77
|
-
...sharing.
|
|
78
|
-
...
|
|
79
|
-
...
|
|
80
|
-
...
|
|
81
|
-
...
|
|
82
|
-
...
|
|
83
|
-
...
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
let
|
|
101
|
-
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const {
|
|
129
|
-
const {
|
|
130
|
-
const {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
const {
|
|
152
|
-
const {
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const
|
|
176
|
-
const
|
|
177
|
-
const
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
...graph.
|
|
182
|
-
...graph.
|
|
183
|
-
...
|
|
184
|
-
...
|
|
185
|
-
...attention.
|
|
186
|
-
...attention.
|
|
187
|
-
...attention.
|
|
188
|
-
...
|
|
189
|
-
...
|
|
190
|
-
...learning.
|
|
191
|
-
...
|
|
192
|
-
...
|
|
193
|
-
...coordination.
|
|
194
|
-
...
|
|
195
|
-
...
|
|
196
|
-
...sharing.
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
...attention.
|
|
210
|
-
...attention.
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
&& Number.
|
|
216
|
-
&& Number.
|
|
217
|
-
&& (attention.config.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
&& attention.config.quietHours.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
if (
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
const
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
if (
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
281
|
-
const
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
gate(
|
|
304
|
-
gate(
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
? `${loadedBytes}/${context.budget.maxBytes} source bytes; briefing failed closed: ${briefingError}`
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
gates,
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
1
|
+
import { canonicalPath, statePathIsScanExcluded } from "./paths.js";
|
|
2
|
+
import { buildCatalog, saveCatalog, verifyCatalog } from "./catalog.js";
|
|
3
|
+
import { loadGraph } from "./graph.js";
|
|
4
|
+
import { attentionFindings, inspectAttention } from "./attention.js";
|
|
5
|
+
import { inspectLearning, learningFindings } from "./learning.js";
|
|
6
|
+
import { coordinationFindings, delegationPolicyFindings, inspectCoordination } from "./coordination.js";
|
|
7
|
+
import { inspectSharing, sharingAuthenticationFindings, sharingFindings } from "./sharing.js";
|
|
8
|
+
import { inspectSignerRegistry, inspectTrust, trustFindings } from "./authentication.js";
|
|
9
|
+
import { resolveContext } from "./context.js";
|
|
10
|
+
import { sessionBriefing } from "./briefing.js";
|
|
11
|
+
import { inspectHttpsFeedState } from "./feed-transport.js";
|
|
12
|
+
import { continuityFindings, inspectContinuity } from "./continuity.js";
|
|
13
|
+
import {
|
|
14
|
+
executionPolicyFindings, inspectSelfstarter, selfstarterFindings
|
|
15
|
+
} from "./selfstarter.js";
|
|
16
|
+
import {
|
|
17
|
+
channelPolicyFindings, channelRuntimeFindings, inspectChannelRuntime
|
|
18
|
+
} from "./channel-runtime.js";
|
|
19
|
+
import { inspectPersonaRuntime, personaRuntimeFindings } from "./persona-runtime.js";
|
|
20
|
+
import { gatewayHealthFindings, gatewayRuntimeFindings, inspectGatewayRuntime } from "./gateway-runtime.js";
|
|
21
|
+
import { fileURLToPath } from "node:url";
|
|
22
|
+
import { checkHosts } from "../../scripts/check-hosts.js";
|
|
23
|
+
import { resolveHostSourceCatalog } from "./source-roots.js";
|
|
24
|
+
import { preflightStatus } from "./preflight.js";
|
|
25
|
+
|
|
26
|
+
function gate(id, name, ok, detail, severity = "error") {
|
|
27
|
+
return { id, name, ok, severity, detail };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function authorityViolations(graph, attention, learning, continuity, coordination, sharing, trust, registry, feedState) {
|
|
31
|
+
const records = [
|
|
32
|
+
...graph.edges,
|
|
33
|
+
...graph.annotations,
|
|
34
|
+
...graph.entities,
|
|
35
|
+
...graph.entityEdges,
|
|
36
|
+
...graph.history,
|
|
37
|
+
...graph.history.map((entry) => entry.value).filter(Boolean),
|
|
38
|
+
...attention.signals,
|
|
39
|
+
...attention.activities,
|
|
40
|
+
...attention.events,
|
|
41
|
+
...attention.receipts,
|
|
42
|
+
...attention.history,
|
|
43
|
+
...attention.history.map((entry) => entry.value).filter(Boolean),
|
|
44
|
+
...learning.candidates,
|
|
45
|
+
...learning.candidates.flatMap((candidate) => [
|
|
46
|
+
...(candidate.evidence || []), candidate.review, candidate.rollback
|
|
47
|
+
]).filter(Boolean),
|
|
48
|
+
...(learning.outcomes || []),
|
|
49
|
+
...(learning.outcomes || []).map((outcome) => outcome.measurement).filter(Boolean),
|
|
50
|
+
...(learning.measurements || []),
|
|
51
|
+
...(learning.measurements || []).map((measurement) => measurement.measurement).filter(Boolean),
|
|
52
|
+
...(learning.measurementLineage || []),
|
|
53
|
+
...(learning.candidateEvidenceLineage || []),
|
|
54
|
+
...(learning.applications || []),
|
|
55
|
+
...(learning.evaluations || []),
|
|
56
|
+
...(learning.evaluatorRegistry || []),
|
|
57
|
+
...(learning.evaluationBindings || []),
|
|
58
|
+
...(learning.validationLeases || []),
|
|
59
|
+
...(learning.trialFailures || []),
|
|
60
|
+
...(learning.trialFailureRevocations || []),
|
|
61
|
+
...(learning.trialRetryExhaustions || []),
|
|
62
|
+
...(learning.evaluationRevocations || []),
|
|
63
|
+
...(learning.evidenceSourceAttestationRevocations || []),
|
|
64
|
+
...(learning.validationRevocations || []),
|
|
65
|
+
...(learning.evidenceRevocations || []),
|
|
66
|
+
...(learning.measurementRevocations || []),
|
|
67
|
+
...(learning.applicationRevocations || []),
|
|
68
|
+
...(learning.deliveryRevocations || []),
|
|
69
|
+
...(learning.outcomeRevocations || []),
|
|
70
|
+
...learning.history,
|
|
71
|
+
...learning.history.map((entry) => entry.value).filter(Boolean),
|
|
72
|
+
...continuity.signals,
|
|
73
|
+
...continuity.history,
|
|
74
|
+
...coordination.tasks,
|
|
75
|
+
...coordination.history,
|
|
76
|
+
...coordination.history.map((entry) => entry.value).filter(Boolean),
|
|
77
|
+
...sharing.records.flatMap((record) => [record, record.event, record.review, record.rollback]).filter(Boolean),
|
|
78
|
+
...sharing.history,
|
|
79
|
+
...sharing.history.flatMap((entry) => [entry.value, entry.value?.event, entry.value?.review, entry.value?.rollback]).filter(Boolean),
|
|
80
|
+
...trust.records.flatMap((record) => [record, record.publicIdentity]).filter(Boolean),
|
|
81
|
+
...trust.history.flatMap((entry) => [entry, entry.value, entry.value?.publicIdentity]).filter(Boolean),
|
|
82
|
+
...registry.signers.flatMap((record) => [record, record.publicIdentity]).filter(Boolean),
|
|
83
|
+
...registry.history.flatMap((entry) => [entry, entry.value]).filter(Boolean),
|
|
84
|
+
...feedState.feeds,
|
|
85
|
+
...feedState.history
|
|
86
|
+
];
|
|
87
|
+
return records.filter((record) => record.authority !== "context-only");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function forbiddenEntityKeys(graph) {
|
|
91
|
+
const forbidden = /"(?:permissions?|rights?|authorization|credentials?|secrets?|tokens?|api[-_]?keys?)"\s*:/i;
|
|
92
|
+
const historicalEntities = graph.history
|
|
93
|
+
.filter((entry) => entry.kind === "entity")
|
|
94
|
+
.map((entry) => entry.value);
|
|
95
|
+
return [...graph.entities, ...historicalEntities].filter((entity) => forbidden.test(JSON.stringify(entity?.attributes || {})));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function runAudit(root = process.cwd(), { host = null } = {}) {
|
|
99
|
+
let preflight = null;
|
|
100
|
+
let preflightError = null;
|
|
101
|
+
try { preflight = await preflightStatus(); } catch (error) { preflightError = error.message; }
|
|
102
|
+
let sourceResolution = null;
|
|
103
|
+
let sourceResolutionError = null;
|
|
104
|
+
let resolvedHostSources = null;
|
|
105
|
+
if (["claude", "codex"].includes(host)) {
|
|
106
|
+
try {
|
|
107
|
+
resolvedHostSources = await resolveHostSourceCatalog({ host, cwd: root });
|
|
108
|
+
sourceResolution = resolvedHostSources.diagnostics;
|
|
109
|
+
}
|
|
110
|
+
catch (error) { sourceResolutionError = error.message; }
|
|
111
|
+
}
|
|
112
|
+
let hostIntegration = null;
|
|
113
|
+
let hostIntegrationError = null;
|
|
114
|
+
try {
|
|
115
|
+
hostIntegration = await checkHosts(fileURLToPath(new URL("../..", import.meta.url)));
|
|
116
|
+
} catch (error) {
|
|
117
|
+
hostIntegrationError = error.message;
|
|
118
|
+
}
|
|
119
|
+
const before = resolvedHostSources?.catalog || (sourceResolutionError
|
|
120
|
+
? {
|
|
121
|
+
schema: "agentspine.catalog/v1", generatedAt: new Date().toISOString(), root: await canonicalPath(root),
|
|
122
|
+
preservation: "source-files-are-read-only", documents: [], conflicts: [],
|
|
123
|
+
summary: { total: 0, protected: 0, conflicts: 0, byLayer: {} }
|
|
124
|
+
}
|
|
125
|
+
: await buildCatalog(root));
|
|
126
|
+
const catalog = before;
|
|
127
|
+
const catalogPath = await saveCatalog(catalog);
|
|
128
|
+
const { graph, graphPath } = await loadGraph(before.root, catalog);
|
|
129
|
+
const { attention, attentionPath, error: attentionLoadError } = await inspectAttention(before.root, catalog);
|
|
130
|
+
const { learning, learningPath, error: learningLoadError } = await inspectLearning(before.root, catalog);
|
|
131
|
+
const { continuity, continuityPath, error: continuityLoadError } = await inspectContinuity(before.root, catalog);
|
|
132
|
+
const {
|
|
133
|
+
policy, coordination, policyPath, coordinationPath, errors: coordinationLoadErrors
|
|
134
|
+
} = await inspectCoordination(before.root, catalog);
|
|
135
|
+
const {
|
|
136
|
+
policy: executionPolicy, state: selfstarter, executionPolicyPath, selfstarterPath,
|
|
137
|
+
errors: selfstarterLoadErrors
|
|
138
|
+
} = await inspectSelfstarter(before.root, catalog);
|
|
139
|
+
const {
|
|
140
|
+
policy: channelPolicy, runtime: channelRuntime, channelPolicyPath, channelRuntimePath,
|
|
141
|
+
errors: channelLoadErrors
|
|
142
|
+
} = await inspectChannelRuntime(before.root, catalog);
|
|
143
|
+
const {
|
|
144
|
+
policy: personaPolicy, runtime: personaRuntime, personaPolicyPath, personaRuntimePath,
|
|
145
|
+
errors: personaLoadErrors
|
|
146
|
+
} = await inspectPersonaRuntime(before.root, catalog);
|
|
147
|
+
const {
|
|
148
|
+
policy: gatewayPolicy, runtime: gatewayRuntime, gatewayPolicyPath, gatewayRuntimePath,
|
|
149
|
+
errors: gatewayLoadErrors
|
|
150
|
+
} = await inspectGatewayRuntime(before.root, catalog);
|
|
151
|
+
const { sharing, sharingPath, error: sharingLoadError } = await inspectSharing(before.root, catalog);
|
|
152
|
+
const { trust, trustPath, error: trustLoadError } = await inspectTrust(before.root, catalog);
|
|
153
|
+
const { registry, registryPath, signerDirectory, errors: signerErrors } = await inspectSignerRegistry(before.root, catalog);
|
|
154
|
+
const { state: feedState, statePath: feedStatePath, error: feedStateError } = await inspectHttpsFeedState(before.root);
|
|
155
|
+
const context = await resolveContext({ root: before.root, cwd: before.root, host: "generic", maxBytes: 16384, includeContent: true, catalog });
|
|
156
|
+
let briefing = null;
|
|
157
|
+
let briefingError = null;
|
|
158
|
+
try {
|
|
159
|
+
briefing = await sessionBriefing({
|
|
160
|
+
root: before.root, cwd: before.root, host: host || "generic", maxBytes: 16384,
|
|
161
|
+
includePrivate: false, focusActive: true, includeSourceContent: true,
|
|
162
|
+
catalog: resolvedHostSources?.catalog || null, sourceDiagnostics: sourceResolution
|
|
163
|
+
});
|
|
164
|
+
} catch (error) {
|
|
165
|
+
briefingError = error.message;
|
|
166
|
+
}
|
|
167
|
+
const verification = ["claude", "codex"].includes(host)
|
|
168
|
+
? { ok: !sourceResolutionError, reason: sourceResolutionError ? "host-native-resolution-failed" : "host-native-rescan" }
|
|
169
|
+
: await verifyCatalog(before.root);
|
|
170
|
+
const after = resolvedHostSources
|
|
171
|
+
? (await resolveHostSourceCatalog({ host, cwd: root })).catalog
|
|
172
|
+
: sourceResolutionError ? before : await buildCatalog(before.root);
|
|
173
|
+
const beforeHashes = new Map(before.documents.map((document) => [document.relativePath, document.sha256]));
|
|
174
|
+
const byteStable = after.documents.length === before.documents.length && after.documents.every((document) => beforeHashes.get(document.relativePath) === document.sha256);
|
|
175
|
+
const brokenLinks = catalog.conflicts.filter((conflict) => conflict.type === "broken-link");
|
|
176
|
+
const reviewConflicts = catalog.conflicts.filter((conflict) => conflict.type !== "broken-link");
|
|
177
|
+
const authority = authorityViolations(graph, attention, learning, continuity, coordination, sharing, trust, registry, feedState);
|
|
178
|
+
const forbidden = forbiddenEntityKeys(graph);
|
|
179
|
+
const privacyValues = new Set(["private", "shared", "group"]);
|
|
180
|
+
const privateRecords = [
|
|
181
|
+
...graph.entities,
|
|
182
|
+
...graph.entityEdges,
|
|
183
|
+
...graph.history,
|
|
184
|
+
...graph.history.map((entry) => entry.value).filter((value) => value && "privacy" in value),
|
|
185
|
+
...attention.signals,
|
|
186
|
+
...attention.activities,
|
|
187
|
+
...attention.events,
|
|
188
|
+
...attention.history,
|
|
189
|
+
...attention.history.map((entry) => entry.value).filter((value) => value && "privacy" in value),
|
|
190
|
+
...learning.candidates,
|
|
191
|
+
...learning.history,
|
|
192
|
+
...learning.history.map((entry) => entry.value).filter((value) => value && "privacy" in value),
|
|
193
|
+
...coordination.tasks,
|
|
194
|
+
...coordination.history,
|
|
195
|
+
...coordination.history.map((entry) => entry.value).filter((value) => value && "privacy" in value),
|
|
196
|
+
...sharing.records.map((record) => ({ ...record, privacy: record.event?.privacy })),
|
|
197
|
+
...sharing.history,
|
|
198
|
+
...sharing.history.map((entry) => entry.value).filter(Boolean).map((record) => ({ ...record, privacy: record.event?.privacy }))
|
|
199
|
+
];
|
|
200
|
+
const privacyInvalid = privateRecords.filter((record) => !privacyValues.has(record.privacy));
|
|
201
|
+
const knownGroups = new Set(graph.entities.filter((entity) => entity.kind === "group").map((entity) => entity.id));
|
|
202
|
+
const isKnownGroupMember = (record) => !record.entityId || record.entityId === record.groupId || graph.entityEdges.some((edge) => (
|
|
203
|
+
edge.relation === "member-of" && edge.privacy !== "private" && (
|
|
204
|
+
(edge.from === record.entityId && edge.to === record.groupId)
|
|
205
|
+
|| (edge.to === record.entityId && edge.from === record.groupId)
|
|
206
|
+
)
|
|
207
|
+
));
|
|
208
|
+
const attentionGroupInvalid = [
|
|
209
|
+
...attention.signals,
|
|
210
|
+
...attention.activities,
|
|
211
|
+
...attention.events,
|
|
212
|
+
...attention.history.map((entry) => entry.value).filter(Boolean)
|
|
213
|
+
].filter((record) => record.privacy === "group" && (!knownGroups.has(record.groupId) || !isKnownGroupMember(record)));
|
|
214
|
+
const attentionConfigValid = typeof attention.config.enabled === "boolean"
|
|
215
|
+
&& Number.isFinite(attention.config.minIntervalHours) && attention.config.minIntervalHours >= 1 && attention.config.minIntervalHours <= 720
|
|
216
|
+
&& Number.isFinite(attention.config.entitySilenceDays) && attention.config.entitySilenceDays >= 1 && attention.config.entitySilenceDays <= 3650
|
|
217
|
+
&& Number.isInteger(attention.config.heartbeatStaleMinutes) && attention.config.heartbeatStaleMinutes >= 1 && attention.config.heartbeatStaleMinutes <= 10080
|
|
218
|
+
&& Number.isInteger(attention.config.maxItems) && attention.config.maxItems >= 1 && attention.config.maxItems <= 20
|
|
219
|
+
&& (attention.config.quietHours === null || (
|
|
220
|
+
Number.isInteger(attention.config.quietHours?.start) && attention.config.quietHours.start >= 0 && attention.config.quietHours.start <= 23
|
|
221
|
+
&& Number.isInteger(attention.config.quietHours?.end) && attention.config.quietHours.end >= 0 && attention.config.quietHours.end <= 23
|
|
222
|
+
&& Number.isFinite(attention.config.quietHours?.utcOffsetMinutes)
|
|
223
|
+
&& attention.config.quietHours.utcOffsetMinutes >= -720 && attention.config.quietHours.utcOffsetMinutes <= 840
|
|
224
|
+
));
|
|
225
|
+
const learningIssues = learningFindings(learning, graph);
|
|
226
|
+
const attentionIssues = attentionFindings(attention);
|
|
227
|
+
if (attentionLoadError) attentionIssues.push(`unreadable-state:${attentionLoadError}`);
|
|
228
|
+
if (learningLoadError) learningIssues.push(`unreadable-state:${learningLoadError}`);
|
|
229
|
+
const continuityIssues = continuityFindings(continuity);
|
|
230
|
+
if (continuityLoadError) continuityIssues.push(`unreadable-state:${continuityLoadError}`);
|
|
231
|
+
const policyIssues = delegationPolicyFindings(policy, graph);
|
|
232
|
+
const coordinationIssues = coordinationFindings(coordination, policy, graph);
|
|
233
|
+
for (const error of coordinationLoadErrors) {
|
|
234
|
+
if (error.startsWith("policy:")) policyIssues.push(`unreadable-state:${error}`);
|
|
235
|
+
else coordinationIssues.push(`unreadable-state:${error}`);
|
|
236
|
+
}
|
|
237
|
+
const coordinationAuthorityIssues = coordinationIssues.filter((issue) => /assignment|policy-snapshot/.test(issue));
|
|
238
|
+
const coordinationContextIssues = coordinationIssues.filter((issue) => !coordinationAuthorityIssues.includes(issue));
|
|
239
|
+
const executionPolicyIssues = executionPolicyFindings(executionPolicy, graph, coordination);
|
|
240
|
+
const selfstarterIssues = selfstarterFindings(selfstarter, executionPolicy, graph, coordination);
|
|
241
|
+
for (const error of selfstarterLoadErrors) {
|
|
242
|
+
if (error.startsWith("policy:")) executionPolicyIssues.push(`unreadable-state:${error}`);
|
|
243
|
+
else selfstarterIssues.push(`unreadable-state:${error}`);
|
|
244
|
+
}
|
|
245
|
+
const selfstarterAuthorityIssues = selfstarterIssues.filter((issue) => /grant|policy|task-mismatch/.test(issue));
|
|
246
|
+
const selfstarterStateIssues = selfstarterIssues.filter((issue) => !selfstarterAuthorityIssues.includes(issue));
|
|
247
|
+
const channelPolicyIssues = channelPolicyFindings(channelPolicy, graph);
|
|
248
|
+
const channelRuntimeIssues = channelRuntimeFindings(channelRuntime, channelPolicy, graph)
|
|
249
|
+
.filter((issue) => !channelPolicyIssues.includes(issue));
|
|
250
|
+
for (const error of channelLoadErrors) {
|
|
251
|
+
if (error.startsWith("policy:")) channelPolicyIssues.push(`unreadable-state:${error}`);
|
|
252
|
+
else channelRuntimeIssues.push(`unreadable-state:${error}`);
|
|
253
|
+
}
|
|
254
|
+
const personaIssues = personaRuntimeFindings(personaPolicy, personaRuntime, graph);
|
|
255
|
+
const personaPolicyIssues = personaIssues.filter((issue) => /binding/.test(issue));
|
|
256
|
+
const personaStateIssues = personaIssues.filter((issue) => !personaPolicyIssues.includes(issue));
|
|
257
|
+
for (const error of personaLoadErrors) {
|
|
258
|
+
if (error.startsWith("policy:")) personaPolicyIssues.push(`unreadable-state:${error}`);
|
|
259
|
+
else personaStateIssues.push(`unreadable-state:${error}`);
|
|
260
|
+
}
|
|
261
|
+
const gatewayIssues = [...gatewayRuntimeFindings(gatewayPolicy, gatewayRuntime),
|
|
262
|
+
...gatewayHealthFindings(gatewayPolicy, gatewayRuntime)];
|
|
263
|
+
const gatewayPolicyIssues = gatewayIssues.filter((issue) => /goal/.test(issue));
|
|
264
|
+
const gatewayStateIssues = gatewayIssues.filter((issue) => !gatewayPolicyIssues.includes(issue));
|
|
265
|
+
for (const error of gatewayLoadErrors) {
|
|
266
|
+
if (error.startsWith("policy:")) gatewayPolicyIssues.push(`unreadable-state:${error}`);
|
|
267
|
+
else gatewayStateIssues.push(`unreadable-state:${error}`);
|
|
268
|
+
}
|
|
269
|
+
const sharingIssues = sharingFindings(sharing, graph);
|
|
270
|
+
if (sharingLoadError) sharingIssues.push(`unreadable-state:${sharingLoadError}`);
|
|
271
|
+
const authenticationIssues = [
|
|
272
|
+
...trustFindings(trust),
|
|
273
|
+
...sharingAuthenticationFindings(sharing, trust)
|
|
274
|
+
];
|
|
275
|
+
if (trustLoadError) authenticationIssues.push(`unreadable-trust:${trustLoadError}`);
|
|
276
|
+
authenticationIssues.push(...signerErrors);
|
|
277
|
+
if (feedStateError) authenticationIssues.push(`unreadable-feed-state:${feedStateError}`);
|
|
278
|
+
const sharingAuthorityIssues = sharingIssues.filter((issue) => /authority|unsafe/.test(issue));
|
|
279
|
+
const sharingContextIssues = sharingIssues.filter((issue) => !sharingAuthorityIssues.includes(issue));
|
|
280
|
+
const nativeMapped = catalog.documents.filter((document) => document.hosts.some((host) => host !== "generic"));
|
|
281
|
+
const loadedBytes = context.documents.filter((document) => document.loaded).reduce((sum, document) => sum + document.bytes, 0);
|
|
282
|
+
const briefingBytes = briefing ? Buffer.byteLength(JSON.stringify(briefing)) : null;
|
|
283
|
+
const briefingBudgetValid = briefing !== null && briefingBytes === briefing.budget.usedBytes
|
|
284
|
+
&& briefingBytes <= briefing.budget.maxBytes;
|
|
285
|
+
|
|
286
|
+
const gates = [
|
|
287
|
+
gate(1, "Runtime", Number(process.versions.node.split(".")[0]) >= 20 && hostIntegration?.ok === true, hostIntegrationError
|
|
288
|
+
? `Node ${process.versions.node}; host integration failed closed: ${hostIntegrationError}`
|
|
289
|
+
: `Node ${process.versions.node}; one versioned MCP server and lifecycle hook set per host`),
|
|
290
|
+
gate(2, "Discovery", catalog.schema === "agentspine.catalog/v1"
|
|
291
|
+
&& (!host || (sourceResolution?.status === "loaded" && !sourceResolutionError)), sourceResolutionError
|
|
292
|
+
? `${catalog.documents.length} project documents; host-native source resolution failed closed: ${sourceResolutionError}`
|
|
293
|
+
: sourceResolution ? `${sourceResolution.scopes.user} user, ${sourceResolution.scopes.project} project, and ${sourceResolution.scopes["project-memory"]} memory sources; broad home scan disabled`
|
|
294
|
+
: `${catalog.documents.length} Markdown documents indexed`),
|
|
295
|
+
gate(3, "State isolation", [catalogPath, graphPath, attentionPath, learningPath, continuityPath,
|
|
296
|
+
policyPath, coordinationPath, executionPolicyPath, selfstarterPath, channelPolicyPath,
|
|
297
|
+
channelRuntimePath, personaPolicyPath, personaRuntimePath, gatewayPolicyPath, gatewayRuntimePath,
|
|
298
|
+
sharingPath, trustPath, registryPath, signerDirectory, feedStatePath]
|
|
299
|
+
.every((path) => statePathIsScanExcluded(catalog, path)),
|
|
300
|
+
catalog.scanPolicy?.stateRoot === "excluded"
|
|
301
|
+
? `Authenticated state is excluded from the home-root source scan for ${catalog.root}`
|
|
302
|
+
: `State remains outside ${catalog.root}`),
|
|
303
|
+
gate(4, "Native hierarchy", nativeMapped.every((document) => document.hosts.length > 0), `${nativeMapped.length} host-native documents mapped`),
|
|
304
|
+
gate(5, "Link integrity", brokenLinks.length === 0, brokenLinks.length ? `${brokenLinks.length} broken Markdown links` : "All indexed Markdown links resolve"),
|
|
305
|
+
gate(6, "Conflict visibility", Array.isArray(catalog.conflicts), `${reviewConflicts.length} precedence or classification findings exposed`, "warning"),
|
|
306
|
+
gate(7, "Authority boundary", authority.length === 0 && forbidden.length === 0 && policyIssues.length === 0 && coordinationAuthorityIssues.length === 0 && executionPolicyIssues.length === 0 && selfstarterAuthorityIssues.length === 0 && channelPolicyIssues.length === 0 && personaPolicyIssues.length === 0 && gatewayPolicyIssues.length === 0 && sharingAuthorityIssues.length === 0 && !preflightError, preflightError
|
|
307
|
+
? `preflight policy or receipt state failed closed: ${preflightError}`
|
|
308
|
+
: `${authority.length} context authority violations; ${forbidden.length} forbidden entity records; ${policyIssues.length} delegation policy findings; ${coordinationAuthorityIssues.length} assignment findings; ${executionPolicyIssues.length} execution policy findings; ${selfstarterAuthorityIssues.length} self-starter authority findings; ${channelPolicyIssues.length} channel policy findings; ${personaPolicyIssues.length} persona policy findings; ${gatewayPolicyIssues.length} gateway policy findings; ${sharingAuthorityIssues.length} shared authority findings; preflight ${preflight.status}`),
|
|
309
|
+
gate(8, "Context privacy", privacyInvalid.length === 0 && attentionGroupInvalid.length === 0 && attentionConfigValid && attentionIssues.length === 0 && learningIssues.length === 0 && continuityIssues.length === 0 && coordinationContextIssues.length === 0 && selfstarterStateIssues.length === 0 && channelRuntimeIssues.length === 0 && personaStateIssues.length === 0 && gatewayStateIssues.length === 0 && sharingContextIssues.length === 0 && authenticationIssues.length === 0, `${graph.entities.length} entities, ${graph.entityEdges.length} relationships, ${attention.signals.length} attention cues, ${attention.events.length} lifecycle events, ${learning.candidates.length} learning records, ${(learning.candidateEvidenceLineage || []).length} candidate-evidence lineage receipts, ${(learning.evaluations || []).length} immutable evaluation contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v9", "agentspine.learning-evaluation/v10", "agentspine.learning-evaluation/v11", "agentspine.learning-evaluation/v12", "agentspine.learning-evaluation/v13", "agentspine.learning-evaluation/v14", "agentspine.learning-evaluation/v15", "agentspine.learning-evaluation/v16", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} exact-target contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v8", "agentspine.learning-evaluation/v9", "agentspine.learning-evaluation/v10", "agentspine.learning-evaluation/v11", "agentspine.learning-evaluation/v12", "agentspine.learning-evaluation/v13", "agentspine.learning-evaluation/v14", "agentspine.learning-evaluation/v15", "agentspine.learning-evaluation/v16", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} precommitted initial-trial contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v10", "agentspine.learning-evaluation/v11", "agentspine.learning-evaluation/v12", "agentspine.learning-evaluation/v13", "agentspine.learning-evaluation/v14", "agentspine.learning-evaluation/v15", "agentspine.learning-evaluation/v16", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} deadline-bound contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v14", "agentspine.learning-evaluation/v15", "agentspine.learning-evaluation/v16", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} staleness-bound contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v16", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} promotion-bound contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v18", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} candidate-admission contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v20", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} candidate-evidence-cohort contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v22", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} blocking-defect-bound contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v24", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} evidence-source-bound contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v26", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v28", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} evidence-source-attested contracts, ${(learning.evaluations || []).filter((item) => ["agentspine.learning-evaluation/v13", "agentspine.learning-evaluation/v15", "agentspine.learning-evaluation/v17", "agentspine.learning-evaluation/v19", "agentspine.learning-evaluation/v21", "agentspine.learning-evaluation/v23", "agentspine.learning-evaluation/v25", "agentspine.learning-evaluation/v27", "agentspine.learning-evaluation/v29"].includes(item.schema)).length} bounded retry contracts, ${(learning.trialRetryExhaustions || []).length} terminal retry-exhaustion receipts, ${(learning.applications || []).filter((item) => ["agentspine.learning-application/v5", "agentspine.learning-application/v6", "agentspine.learning-application/v7"].includes(item.schema)).length} immutable initial-trial admissions, ${(learning.applications || []).filter((item) => ["agentspine.learning-application/v6", "agentspine.learning-application/v7"].includes(item.schema)).length} exact-target admissions, ${(learning.applications || []).filter((item) => item.schema === "agentspine.learning-application/v7").length} deadline-bound admissions, ${(learning.trialFailures || []).length} blocking trial-failure receipts, ${(learning.evaluatorRegistry || []).length} locally confirmed evaluator roots, ${(learning.evaluationBindings || []).length} evaluator-registry bindings, ${(learning.validationLeases || []).length} immutable validation leases, ${(learning.measurements || []).length} immutable measurement runs, ${(learning.applications || []).length} turn-bound projections, ${(learning.deliveries || []).length} completed model-turn deliveries, ${(learning.evaluationRevocations || []).length} evaluation revocations, ${(learning.evidenceRevocations || []).length} evidence revocations, ${(learning.measurementRevocations || []).length} measurement revocations, ${(learning.applicationRevocations || []).length} application revocations, ${(learning.deliveryRevocations || []).length} delivery revocations, ${(learning.outcomeRevocations || []).length} outcome revocations, ${(learning.outcomes || []).length} outcome receipts, ${(learning.outcomes || []).filter((item) => ["agentspine.learning-outcome/v5", "agentspine.learning-outcome/v6", "agentspine.learning-outcome/v7", "agentspine.learning-outcome/v8", "agentspine.learning-outcome/v9"].includes(item.schema)).length} case-coverage receipts, ${(learning.outcomes || []).filter((item) => ["agentspine.learning-outcome/v6", "agentspine.learning-outcome/v7", "agentspine.learning-outcome/v8", "agentspine.learning-outcome/v9"].includes(item.schema)).length} provenance-bound receipts, ${(learning.outcomes || []).filter((item) => ["agentspine.learning-outcome/v7", "agentspine.learning-outcome/v8", "agentspine.learning-outcome/v9"].includes(item.schema)).length} lineage-bound receipts, ${(learning.outcomes || []).filter((item) => ["agentspine.learning-outcome/v8", "agentspine.learning-outcome/v9"].includes(item.schema)).length} paired-evaluator receipts and ${(learning.outcomes || []).filter((item) => item.schema === "agentspine.learning-outcome/v9").length} evaluator-root-bound receipts, ${continuity.signals.length} continuity signals, ${coordination.tasks.length} coordination items, ${selfstarter.jobs.length} self-starter jobs, ${channelRuntime.events.length} channel events, ${personaRuntime.personas.length} authenticated personas, ${gatewayRuntime.queue.length} gateway queue items, ${gatewayRuntime.outbox.length} delivery records, ${sharing.records.length} shared records, ${trust.records.length} trusted keys, ${registry.signers.length} local signers, and ${feedState.feeds.length} feed receipts checked`),
|
|
310
|
+
gate(9, "Context budget", loadedBytes <= context.budget.maxBytes && briefingBudgetValid, briefingError
|
|
311
|
+
? `${loadedBytes}/${context.budget.maxBytes} source bytes; briefing failed closed: ${briefingError}`
|
|
312
|
+
: `${loadedBytes}/${context.budget.maxBytes} source bytes; ${briefingBytes}/${briefing.budget.maxBytes} briefing bytes`),
|
|
313
|
+
gate(10, "Byte preservation", byteStable && verification.ok, verification.ok ? "Sources remained byte-for-byte unchanged" : "Source drift detected")
|
|
314
|
+
];
|
|
315
|
+
return {
|
|
316
|
+
schema: "agentspine.audit/v1",
|
|
317
|
+
root: catalog.root,
|
|
318
|
+
ok: gates.every((item) => item.ok || item.severity === "warning"),
|
|
319
|
+
passed: gates.filter((item) => item.ok).length,
|
|
320
|
+
total: gates.length,
|
|
321
|
+
gates,
|
|
322
|
+
catalogPath,
|
|
323
|
+
graphPath,
|
|
324
|
+
attentionPath,
|
|
325
|
+
learningPath,
|
|
326
|
+
continuityPath,
|
|
327
|
+
policyPath,
|
|
328
|
+
coordinationPath,
|
|
329
|
+
executionPolicyPath,
|
|
330
|
+
selfstarterPath,
|
|
331
|
+
channelPolicyPath,
|
|
332
|
+
channelRuntimePath,
|
|
333
|
+
personaPolicyPath,
|
|
334
|
+
personaRuntimePath,
|
|
335
|
+
gatewayPolicyPath,
|
|
336
|
+
gatewayRuntimePath,
|
|
337
|
+
sharingPath,
|
|
338
|
+
trustPath,
|
|
339
|
+
registryPath,
|
|
340
|
+
feedStatePath,
|
|
341
|
+
learningDiagnostics: {
|
|
342
|
+
candidateEvidenceLineageReceipts:
|
|
343
|
+
(learning.candidateEvidenceLineage || []).length,
|
|
344
|
+
evidenceSourceAttestationRevocations:
|
|
345
|
+
(learning.evidenceSourceAttestationRevocations || []).length,
|
|
346
|
+
authority: "context-only"
|
|
347
|
+
},
|
|
348
|
+
sourceResolution,
|
|
349
|
+
preflight
|
|
350
|
+
};
|
|
351
|
+
}
|