thumbgate 1.37.3 → 1.39.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 (134) hide show
  1. package/.agents/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  2. package/.agents/skills/bolt-forge-opt-in-not-clone/SKILL.md +72 -0
  3. package/.agents/skills/decisive-step-evaluator/SKILL.md +47 -0
  4. package/.agents/skills/fiddler-control-plane-honesty/SKILL.md +61 -0
  5. package/.agents/skills/halo-trace-optimize-not-clone/SKILL.md +60 -0
  6. package/.agents/skills/harness-evolution-ceiling/SKILL.md +52 -0
  7. package/.agents/skills/infoq-architect-honesty-not-clone/SKILL.md +37 -0
  8. package/.agents/skills/meko-datapack-honesty-not-clone/SKILL.md +45 -0
  9. package/.agents/skills/mintlify-knowledge-honesty-not-clone/SKILL.md +49 -0
  10. package/.agents/skills/model-distress-governance/SKILL.md +56 -0
  11. package/.agents/skills/omp-coordination-honesty-not-clone/SKILL.md +94 -0
  12. package/.agents/skills/saas-moat-honesty-not-clone/SKILL.md +22 -0
  13. package/.agents/skills/salt-code-policy-honesty-not-clone/SKILL.md +76 -0
  14. package/.agents/skills/siren-mcp-governance/SKILL.md +50 -0
  15. package/.agents/skills/vs-coverage-gap-not-clone/SKILL.md +69 -0
  16. package/.agents/skills/wisdom-context-artifact-not-clone/SKILL.md +67 -0
  17. package/.claude-plugin/plugin.json +1 -1
  18. package/.well-known/mcp/server-card.json +1 -1
  19. package/adapters/claude/.mcp.json +2 -2
  20. package/adapters/forge/forge.yaml +3 -3
  21. package/adapters/future-agi/.mcp.json +1 -1
  22. package/adapters/future-agi/config.toml +1 -1
  23. package/adapters/future-agi/opencode.json +1 -1
  24. package/adapters/herdr/herdr-plugin.toml +2 -2
  25. package/adapters/hotdata/hotdata-vector-store.js +575 -0
  26. package/adapters/mcp/server-stdio.js +1 -1
  27. package/adapters/opencode/opencode.json +1 -1
  28. package/adapters/strands/STRANDS.md +107 -0
  29. package/adapters/strands/strands-box-diode.js +344 -0
  30. package/adapters/strands/strands-decider-adapter.js +445 -0
  31. package/adapters/strands/strands-middleware.js +192 -0
  32. package/adapters/tailscale/.mcp.json +15 -0
  33. package/adapters/tailscale/TAILSCALE.md +117 -0
  34. package/adapters/tailscale/config.toml +16 -0
  35. package/bin/cli.js +602 -21
  36. package/config/gate-templates.json +109 -0
  37. package/config/gates/default.json +13 -0
  38. package/config/schemas/task-outcome-receipt.schema.json +12 -0
  39. package/package.json +150 -21
  40. package/public/blog/2026-09-28-pretool-secret-deny.html +83 -0
  41. package/public/blog/2026-10-01-aws-strands-harness-token-firewall.html +77 -0
  42. package/public/blog/2026-10-01-model-distress-relief-seeking-firewall.html +71 -0
  43. package/public/blog/2026-10-02-salt-code-honest-steal-40-guardrails.html +106 -0
  44. package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +119 -0
  45. package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +141 -0
  46. package/public/connectors.html +329 -0
  47. package/public/enterprise-governance.html +311 -0
  48. package/public/gaming-playbook.html +732 -0
  49. package/public/index.html +77 -51
  50. package/public/install.html +7 -7
  51. package/public/learn.html +14 -0
  52. package/public/numbers.html +2 -2
  53. package/public/onboarding.html +794 -0
  54. package/public/operator-framework.html +385 -0
  55. package/public/pricing.html +14 -10
  56. package/scripts/activesaddler-curriculum-doctor.js +357 -0
  57. package/scripts/agent-context-artifact.js +325 -0
  58. package/scripts/agent-egress-policy.js +2 -2
  59. package/scripts/agent-operations-planner.js +1 -1
  60. package/scripts/agent-outcome-eval.js +1 -1
  61. package/scripts/agent-reliability-client.js +148 -0
  62. package/scripts/apple-minions-idle-compute-steal.js +428 -0
  63. package/scripts/autoresearch-runner.js +20 -1
  64. package/scripts/billing.js +0 -1
  65. package/scripts/cli-demo.js +505 -1
  66. package/scripts/cli-schema.js +36 -0
  67. package/scripts/colab-compute-honesty.js +93 -0
  68. package/scripts/corporate-email-isolation-diode.js +299 -0
  69. package/scripts/coverage-gap.js +396 -0
  70. package/scripts/dashboard-chat.js +3 -3
  71. package/scripts/dashboard.js +2 -2
  72. package/scripts/decisive-step-doctor.js +256 -0
  73. package/scripts/decisive-step-evaluator.js +390 -0
  74. package/scripts/entitlement.js +18 -7
  75. package/scripts/experiment-tracker.js +5 -3
  76. package/scripts/feedback-loop.js +26 -3
  77. package/scripts/fiddler-control-plane-honesty.js +303 -0
  78. package/scripts/financial-control-plane.js +10 -2
  79. package/scripts/gates-engine.js +3 -1
  80. package/scripts/github-license-compliance-diode.js +378 -0
  81. package/scripts/halo-trace-optimizer.js +631 -0
  82. package/scripts/harness-ceiling-doctor.js +326 -0
  83. package/scripts/hf-papers.js +1 -1
  84. package/scripts/human-escalation.js +7 -1
  85. package/scripts/hybrid-feedback-context.js +53 -7
  86. package/scripts/infoq-architect-honesty.js +362 -0
  87. package/scripts/lesson-graph.js +785 -0
  88. package/scripts/lesson-inference.js +1 -1
  89. package/scripts/lesson-retrieval.js +26 -18
  90. package/scripts/license.js +122 -21
  91. package/scripts/llm-behavior-monitor.js +1 -1
  92. package/scripts/llm-obs-honesty.js +52 -0
  93. package/scripts/local-model-profile.js +11 -7
  94. package/scripts/mailer/resend-mailer.js +6 -3
  95. package/scripts/mcp-transport-strategy.js +1 -1
  96. package/scripts/meko-datapack-honesty.js +414 -0
  97. package/scripts/migrate-lesson-graph.js +442 -0
  98. package/scripts/mintlify-knowledge-honesty.js +647 -0
  99. package/scripts/model-distress-detector.js +207 -0
  100. package/scripts/model-distress-doctor.js +368 -0
  101. package/scripts/multi-harness-invariants.js +305 -0
  102. package/scripts/omp-coordination-honesty.js +488 -0
  103. package/scripts/pro-local-dashboard.js +20 -3
  104. package/scripts/prompt-eval.js +1 -1
  105. package/scripts/prove-herdr-adapter.js +367 -3
  106. package/scripts/rag-embedding-identity.js +1 -1
  107. package/scripts/rrsi-regularizer.js +531 -0
  108. package/scripts/saas-moat-honesty.js +443 -0
  109. package/scripts/salt-code-policy-honesty.js +1204 -0
  110. package/scripts/secret-redaction.js +58 -0
  111. package/scripts/session-export-gate.js +368 -0
  112. package/scripts/siren-mcp-governance.js +539 -0
  113. package/scripts/strands-box-doctor.js +130 -0
  114. package/scripts/strands-harness-doctor.js +390 -0
  115. package/scripts/stripe-revenue-catalog-audit.js +12 -0
  116. package/scripts/stripe-revenue-catalog.js +40 -0
  117. package/scripts/switchyard-router.js +153 -0
  118. package/scripts/tailscale-p2p-doctor.js +252 -0
  119. package/scripts/task-outcomes.js +148 -3
  120. package/scripts/thumbgate-board-loop.js +4 -2
  121. package/scripts/thumbgate-daily-discoveries-publish.js +86 -38
  122. package/scripts/triage-savings-calculator.js +181 -0
  123. package/scripts/vector-store.js +41 -2
  124. package/scripts/vulnerability-pre-action-diode.js +319 -0
  125. package/scripts/windbg-evidence-diagnostics.js +241 -0
  126. package/scripts/workflow-intake-queue.js +1 -1
  127. package/scripts/workspace-agent-routines.js +534 -6
  128. package/scripts/workspace-evolver.js +143 -13
  129. package/server.json +2 -2
  130. package/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
  131. package/skills/siren-mcp-governance/SKILL.md +50 -0
  132. package/src/api/server.js +191 -5
  133. package/src/mcp-writeguard.js +1 -1
  134. package/src/session-interactivity.js +284 -0
@@ -0,0 +1,488 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ /**
5
+ * omp.sh coordination FORMAT on the ThumbGate checkout lease.
6
+ *
7
+ * Sources:
8
+ * https://omp.sh/docs/sessions
9
+ * https://omp.sh/docs/subagents
10
+ * https://omp.sh/docs/collab
11
+ *
12
+ * Transfers:
13
+ * 1. /new keeps the previous saved session. /clear only resets context.
14
+ * 2. A handoff is current state and the next step, not a live shared prompt.
15
+ * 3. A child does not inherit the parent transcript and writes disjoint files.
16
+ * 4. Observation defaults to view-only. A full-control link can drive the host.
17
+ * 5. Crash recovery must not invent a result for an interrupted tool call.
18
+ * 6. The model is a named id. Auto and Fast are refused. One agent. No install.
19
+ *
20
+ * Does not run the omp installer. Does not install @oh-my-pi/pi-coding-agent.
21
+ * Does not open wss://my.omp.sh. Orchestra OMP is a different system.
22
+ */
23
+
24
+ const fs = require('node:fs');
25
+ const path = require('node:path');
26
+
27
+ const SOURCE_URL = 'https://omp.sh/docs/sessions';
28
+ const GATE_ID = 'refuse-omp-install-collab';
29
+
30
+ const INSTALL_RE = /curl\s+https:\/\/omp\.sh\/install|https:\/\/omp\.sh\/install|@oh-my-pi|pi-coding-agent/i;
31
+ const WRITE_LINK_RE = /wss:\/\/my\.omp\.sh|bearer write token|full-control collab|full-control link|share\s*[:=]\s*full-control/i;
32
+ const UNNAMED_RE = /^(auto|fast|default|balanced)$/i;
33
+ const NAMED_RE = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,80}(?:\/[A-Za-z0-9][A-Za-z0-9._:-]{0,80})?$/;
34
+
35
+ const RAIL_MAP = Object.freeze([
36
+ { omp: '/new keeps the old saved session; /clear resets context in place', thumbgate: 'A handoff session is new. clear fails closed.' },
37
+ { omp: 'Handoff is current state and next steps (JSONL editable, HTML read-only)', thumbgate: 'Saved state-and-next file on the checkout lease.' },
38
+ { omp: 'Children do not inherit the parent conversation; writes are file-disjoint', thumbgate: 'The parent integrates. Overlapping owner paths fail.' },
39
+ { omp: 'Collab host stays authoritative; default share is view-only', thumbgate: 'Observation is view-only. Host stays local.' },
40
+ { omp: 'Crash recovery continues completed entries and does not invent an interrupted result', thumbgate: 'An interrupted tool entry that also carries a result fails.' },
41
+ { omp: 'Named provider/model-id; Auto and Fast are not a route', thumbgate: 'Named model. Fast off. Agents one. Install none.' },
42
+ { omp: 'Diagnose failure composition before prompt bloat; named-model escalation at ceiling (arXiv:2610.11655)', thumbgate: 'When content failures dominate (>=80%) and process failures are low, escalate named model tier instead of bloating AGENTS.md/prompts.' },
43
+ ]);
44
+
45
+ function normalizeBoolean(value) {
46
+ if (value === true || value === 1) return true;
47
+ if (value === false || value === 0 || value == null) return false;
48
+ return /^(1|true|yes|on)$/i.test(String(value).trim());
49
+ }
50
+
51
+ function asArray(value) {
52
+ if (value == null || value === '') return [];
53
+ return Array.isArray(value) ? value : [value];
54
+ }
55
+
56
+ function finding(id, message) {
57
+ return { id, severity: 'fail', gateId: GATE_ID, message };
58
+ }
59
+
60
+ function dedupe(findings) {
61
+ const seen = new Set();
62
+ const out = [];
63
+ for (const item of findings) {
64
+ if (seen.has(item.id)) continue;
65
+ seen.add(item.id);
66
+ out.push(item);
67
+ }
68
+ return out;
69
+ }
70
+
71
+ function isNamedModel(value) {
72
+ const text = String(value || '').trim();
73
+ if (!text || UNNAMED_RE.test(text)) return false;
74
+ return NAMED_RE.test(text);
75
+ }
76
+
77
+ function agentsAllowed(value) {
78
+ if (value === 1) return true;
79
+ const text = String(value == null ? '' : value).trim().toLowerCase();
80
+ return text === '1' || text === 'one';
81
+ }
82
+
83
+ function normPath(value, root) {
84
+ const raw = String(value || '').trim();
85
+ if (!raw) return '';
86
+ const rootDir = (typeof root === 'string' && root) ? root : process.cwd();
87
+ const resolved = path.isAbsolute(raw) ? path.resolve(raw) : path.resolve(rootDir, raw);
88
+ const rel = path.relative(rootDir, resolved);
89
+ const target = (rel && !rel.startsWith('..') && !path.isAbsolute(rel)) ? rel : resolved;
90
+ let text = target.replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+/g, '/');
91
+ if (text.length > 1) text = text.replace(/\/$/, '');
92
+ return text;
93
+ }
94
+
95
+ function pathsOverlap(left, right) {
96
+ if (!left || !right) return false;
97
+ if (left === right) return true;
98
+ return `${right}/`.startsWith(`${left}/`) || `${left}/`.startsWith(`${right}/`);
99
+ }
100
+
101
+ function collectOwners(writes) {
102
+ const owners = [];
103
+ for (const row of asArray(writes)) {
104
+ if (typeof row === 'string') {
105
+ const one = normPath(row);
106
+ if (one) owners.push({ owner: 'unknown', paths: [one] });
107
+ continue;
108
+ }
109
+ if (!row || typeof row !== 'object') continue;
110
+ const paths = asArray(row.paths || row.path || row.files).map((p) => normPath(p)).filter(Boolean);
111
+ owners.push({ owner: String(row.owner || row.agent || 'unknown'), paths });
112
+ }
113
+ return owners;
114
+ }
115
+
116
+ function firstOverlap(writes) {
117
+ const owners = collectOwners(writes);
118
+ for (let i = 0; i < owners.length; i += 1) {
119
+ for (let j = i + 1; j < owners.length; j += 1) {
120
+ if (owners[i].owner === owners[j].owner) continue;
121
+ for (const left of owners[i].paths) {
122
+ for (const right of owners[j].paths) {
123
+ if (pathsOverlap(left, right)) {
124
+ return { left: owners[i].owner, right: owners[j].owner, path: left === right ? left : `${left} ~ ${right}` };
125
+ }
126
+ }
127
+ }
128
+ }
129
+ }
130
+ return null;
131
+ }
132
+
133
+ function isInterrupted(entry) {
134
+ if (!entry || typeof entry !== 'object') return false;
135
+ if (entry.interrupted === true) return true;
136
+ const status = String(entry.status || entry.state || entry.phase || '').toLowerCase();
137
+ return /interrupt|incomplete|crash|cancel|abort/.test(status);
138
+ }
139
+
140
+ function hasInventedResult(entry) {
141
+ if (entry.invented === true) return true;
142
+ const hasResult = Object.prototype.hasOwnProperty.call(entry, 'result') || entry.output != null;
143
+ if (!hasResult) return false;
144
+ const result = Object.prototype.hasOwnProperty.call(entry, 'result') ? entry.result : entry.output;
145
+ return result != null && result !== '';
146
+ }
147
+
148
+ function parseMarkdownHandoff(text) {
149
+ const doc = {};
150
+ const keys = {
151
+ model: 'model',
152
+ route: 'route',
153
+ fast: 'fast',
154
+ session: 'session',
155
+ think: 'think',
156
+ agents: 'agents',
157
+ install: 'install',
158
+ host: 'host',
159
+ share: 'share',
160
+ state: 'state',
161
+ next: 'next',
162
+ };
163
+ const writes = [];
164
+ let inWrites = false;
165
+ for (const line of String(text).split(/\r?\n/)) {
166
+ if (/^writes:\s*$/i.test(line.trim())) {
167
+ inWrites = true;
168
+ continue;
169
+ }
170
+ if (inWrites) {
171
+ if (!line.trim()) {
172
+ if (writes.length) inWrites = false;
173
+ continue;
174
+ }
175
+ if (!/^\s*[-*]/.test(line)) {
176
+ inWrites = false;
177
+ } else {
178
+ const item = line.replace(/^\s*[-*]\s*/, '');
179
+ const match = /^([^:]+):\s*(.+)$/.exec(item);
180
+ if (match) {
181
+ writes.push({
182
+ owner: match[1].trim(),
183
+ paths: match[2].split(',').map((part) => part.trim()).filter(Boolean),
184
+ });
185
+ }
186
+ continue;
187
+ }
188
+ }
189
+ const match = /^([A-Za-z][A-Za-z ]{0,40}):\s*(.*)$/.exec(line.trim());
190
+ if (!match) continue;
191
+ const key = match[1].toLowerCase().replace(/\s+/g, '');
192
+ if (keys[key]) doc[keys[key]] = match[2].trim();
193
+ }
194
+ if (writes.length) doc.writes = writes;
195
+ return doc;
196
+ }
197
+
198
+ function loadHandoff(value) {
199
+ if (value == null || value === '' || value === true) return null;
200
+ if (typeof value === 'object') return value;
201
+ const text = String(value).trim();
202
+ if (!text) return null;
203
+ if (text.startsWith('{') || text.startsWith('[')) {
204
+ try {
205
+ const parsed = JSON.parse(text);
206
+ return Array.isArray(parsed) ? { crash: parsed } : parsed;
207
+ } catch {
208
+ return { parseError: true };
209
+ }
210
+ }
211
+ if (!fs.existsSync(text)) return { missing: true };
212
+ let body = '';
213
+ try {
214
+ body = fs.readFileSync(text, 'utf8');
215
+ } catch {
216
+ return { missing: true };
217
+ }
218
+ const trimmed = body.trim();
219
+ if (trimmed.startsWith('{') || trimmed.startsWith('[')) {
220
+ try {
221
+ const parsed = JSON.parse(trimmed);
222
+ return Array.isArray(parsed) ? { crash: parsed, raw: body } : { ...parsed, raw: body };
223
+ } catch {
224
+ return { parseError: true, raw: body };
225
+ }
226
+ }
227
+ return { ...parseMarkdownHandoff(body), raw: body };
228
+ }
229
+
230
+ function looksLikeHandoff(text) {
231
+ return /(?:^|\n)\s*model\s*:/i.test(String(text || '')) && /(?:^|\n)\s*session\s*:/i.test(String(text || ''));
232
+ }
233
+
234
+ function scanText(text, findings) {
235
+ const body = String(text || '');
236
+ if (!body.trim()) return;
237
+ if (INSTALL_RE.test(body)) {
238
+ findings.push(finding('omp_install', 'Refused the omp installer, @oh-my-pi, and pi-coding-agent. Install stays none.'));
239
+ }
240
+ if (WRITE_LINK_RE.test(body)) {
241
+ findings.push(finding('host_write_link', 'Refused a full-control collab link and wss://my.omp.sh. Share stays view-only on the local host.'));
242
+ }
243
+ if (/\b(?:model|route)\s*[:=]\s*(auto|fast|default|balanced)\b/i.test(body)) {
244
+ findings.push(finding('unnamed_model', 'Model must be a named id such as grok-4.7 or provider/model-id. Auto, Fast, default, and balanced are refused.'));
245
+ }
246
+ if (/\bfast\s*[:=]\s*(on|true|yes|1)\b/i.test(body)) {
247
+ findings.push(finding('fast_default', 'Fast stays off.'));
248
+ }
249
+ if (/(?:^|\s)\/clear\b|\bsession\s*[:=]\s*\/?clear\b/i.test(body)) {
250
+ findings.push(finding('clear_discards_saved_session', 'A new session keeps the previous saved session. /clear only resets context and is refused on a handoff.'));
251
+ }
252
+ const agentsMatch = body.match(/\bagents\s*[:=]\s*([^\s,]+)/i);
253
+ if (agentsMatch) {
254
+ const token = agentsMatch[1].toLowerCase().replace(/[^a-z0-9-]/g, '');
255
+ if (token !== 'one' && token !== '1') {
256
+ findings.push(finding('agent_fanout', 'Agents stays one. omp maxConcurrency 32 is refused.'));
257
+ }
258
+ }
259
+ const concurrency = body.match(/\bmaxConcurrency\s*[:=]?\s*(\d+)/i);
260
+ if (concurrency && Number(concurrency[1]) > 1) {
261
+ findings.push(finding('agent_fanout', 'Agents stays one. omp maxConcurrency 32 is refused.'));
262
+ }
263
+ if (/\b(?:auto[- ]?rule|prompt[- ]?rule|add[- ]?rule)\b/i.test(body) && /\b(?:content[- ]?failure|reasoning[- ]?failure|harness[- ]?ceiling)\b/i.test(body) && !/model|weight|lora|distill/i.test(body)) {
264
+ findings.push(finding('harness_ceiling_prompt_bloat', 'Harness ceiling reached: content/reasoning failures cannot be resolved with prompt rules. Escalate named model route or train weights (arXiv:2610.11655).'));
265
+ }
266
+ }
267
+
268
+ function validateHandoff(doc, findings) {
269
+ if (!isNamedModel(doc.model)) {
270
+ findings.push(finding('unnamed_model', 'Handoff model must be a named id such as grok-4.7 or provider/model-id.'));
271
+ }
272
+ if (doc.route != null && String(doc.route).trim().toLowerCase() !== 'named') {
273
+ findings.push(finding('unnamed_model', 'Route stays named.'));
274
+ }
275
+ if (normalizeBoolean(doc.fast)) {
276
+ findings.push(finding('fast_default', 'Fast stays off.'));
277
+ }
278
+ const session = String(doc.session || '').trim().toLowerCase();
279
+ if (session !== 'new') {
280
+ findings.push(finding('clear_discards_saved_session', 'Handoff session must be new so the previous saved session stays intact.'));
281
+ }
282
+ const think = doc.think == null || doc.think === '' ? 'off' : String(doc.think).trim().toLowerCase();
283
+ if (think !== 'off' && think !== 'one-turn') {
284
+ findings.push(finding('think_not_bounded', 'Think is off, or one-turn when a single expensive pass is required.'));
285
+ }
286
+ if (!agentsAllowed(doc.agents)) {
287
+ findings.push(finding('agent_fanout', 'Agents stays one. A handoff that fans out above one agent fails closed.'));
288
+ }
289
+ if (String(doc.install == null ? '' : doc.install).trim().toLowerCase() !== 'none') {
290
+ findings.push(finding('omp_install', 'Install must be none. The omp binary stays uninstalled.'));
291
+ }
292
+ const host = String(doc.host == null ? '' : doc.host).trim().toLowerCase();
293
+ if (host !== 'local' || /my\.omp\.sh|relay/.test(host)) {
294
+ findings.push(finding('relay_host', 'Host stays local. A relay or my.omp.sh room is refused.'));
295
+ }
296
+ const share = doc.share == null || doc.share === '' ? 'view-only' : String(doc.share).trim().toLowerCase();
297
+ if (share !== 'view-only') {
298
+ findings.push(finding('host_write_link', 'Share stays view-only. Full control would let a link drive the host.'));
299
+ }
300
+ if (!String(doc.state || '').trim() || !String(doc.next || '').trim()) {
301
+ findings.push(finding('handoff_incomplete', 'Handoff needs state and next. It is a saved artifact, not a live channel.'));
302
+ }
303
+ const overlap = firstOverlap(doc.writes);
304
+ if (overlap) {
305
+ findings.push(finding('overlapping_writers', `Write paths overlap between ${overlap.left} and ${overlap.right} (${overlap.path}). The parent integrates disjoint files.`));
306
+ }
307
+ for (const entry of asArray(doc.crash)) {
308
+ if (isInterrupted(entry) && hasInventedResult(entry)) {
309
+ findings.push(finding('invented_interrupted_result', 'An interrupted tool call must not carry an invented result. Continue completed entries only.'));
310
+ break;
311
+ }
312
+ }
313
+ if (doc.failureComposition && typeof doc.failureComposition === 'object') {
314
+ const p = Number(doc.failureComposition.processFailureRate || 0);
315
+ const c = Number(doc.failureComposition.contentFailureRate || 0);
316
+ if (c >= 0.8 && p <= 0.2 && doc.action === 'add_prompt_rule') {
317
+ findings.push(finding('harness_ceiling_prompt_bloat', 'Content failures dominate (>=80%). Do not add prompt rules; escalate named model route or train weights (arXiv:2610.11655).'));
318
+ }
319
+ }
320
+ }
321
+
322
+ function buildOmpCoordinationHonestyReport(rawOptions = {}) {
323
+ const options = rawOptions || {};
324
+ const mapOnly = normalizeBoolean(options['map-only'] || options.mapOnly);
325
+ const claim = options.claim == null ? '' : String(options.claim);
326
+ const handoffValue = options.handoff == null ? options['handoff-json'] : options.handoff;
327
+ const findings = [];
328
+ let handoff = null;
329
+
330
+ if (handoffValue != null && handoffValue !== '' && handoffValue !== false) {
331
+ handoff = loadHandoff(handoffValue);
332
+ if (!handoff || handoff.parseError || handoff.missing) {
333
+ findings.push(finding('handoff_unreadable', 'Handoff did not parse. Pass a JSON object, a markdown header, or a readable file path.'));
334
+ handoff = null;
335
+ }
336
+ } else if (looksLikeHandoff(claim)) {
337
+ handoff = parseMarkdownHandoff(claim);
338
+ }
339
+
340
+ if (handoff) {
341
+ validateHandoff(handoff, findings);
342
+ scanText(handoff.raw || '', findings);
343
+ scanText(JSON.stringify(handoff), findings);
344
+ }
345
+ if (!handoff || claim !== (handoff && handoff.raw)) {
346
+ scanText(claim, findings);
347
+ }
348
+
349
+ const deduped = dedupe(findings);
350
+ const failCount = deduped.filter((item) => item.severity === 'fail').length;
351
+ const status = failCount > 0 ? 'fail' : 'ready';
352
+ return {
353
+ name: 'thumbgate-omp-coordination-honesty',
354
+ source: SOURCE_URL,
355
+ sourceDocs: [
356
+ 'https://omp.sh/docs/sessions',
357
+ 'https://omp.sh/docs/subagents',
358
+ 'https://omp.sh/docs/collab',
359
+ ],
360
+ status,
361
+ ok: status === 'ready',
362
+ mapOnly,
363
+ model: handoff && handoff.model ? handoff.model : null,
364
+ session: handoff && handoff.session ? handoff.session : null,
365
+ map: RAIL_MAP,
366
+ findings: deduped,
367
+ summary: { failCount, findingCount: deduped.length },
368
+ recommendedGates: deduped.length ? [GATE_ID] : [],
369
+ nextActions: [
370
+ 'Keep the checkout lease. A new session leaves the previous saved session in place.',
371
+ 'Write a handoff with state, next, a named model, agents one, install none, and host local.',
372
+ 'Give each child disjoint files. The parent integrates. Children do not receive the parent transcript.',
373
+ 'Share observation as view-only. Do not open a link that can prompt or interrupt the host.',
374
+ 'Do not install omp. Orchestra OMP is a different system and stays refused.',
375
+ ],
376
+ exampleCommand: 'npx thumbgate omp-coordination-honesty --json --map-only',
377
+ disclaimer: 'omp.sh coordination FORMAT on the ThumbGate checkout lease. Does not install omp. Not an oh-my-pi runtime.',
378
+ };
379
+ }
380
+
381
+ function formatOmpCoordinationHonestyReport(report) {
382
+ const lines = [
383
+ '',
384
+ 'ThumbGate omp Coordination-Honesty Doctor',
385
+ '-'.repeat(48),
386
+ `Status : ${report.status}`,
387
+ `Model : ${report.model || '(map only)'}`,
388
+ `Session: ${report.session || '(none)'}`,
389
+ `Source : ${report.source}`,
390
+ `Findings: ${report.summary.findingCount} (fail=${report.summary.failCount})`,
391
+ '',
392
+ 'Rail map:',
393
+ ];
394
+ for (const row of report.map) lines.push(` - ${row.omp} → ${row.thumbgate}`);
395
+ if (report.findings.length) {
396
+ lines.push('', 'Findings:');
397
+ for (const item of report.findings) {
398
+ lines.push(` - [${item.severity}] ${item.id} [${item.gateId}]`);
399
+ lines.push(` ${item.message}`);
400
+ }
401
+ }
402
+ lines.push('', 'Next actions:');
403
+ for (const action of report.nextActions) lines.push(` - ${action}`);
404
+ lines.push('', `Example: ${report.exampleCommand}`);
405
+ lines.push(`Note: ${report.disclaimer}`, '');
406
+ return `${lines.join('\n')}\n`;
407
+ }
408
+
409
+ function parseCliArgs(argv) {
410
+ const options = {};
411
+ for (const arg of argv) {
412
+ if (arg === '--json') { options.json = true; continue; }
413
+ if (arg === '--strict') { options.strict = true; continue; }
414
+ if (arg === '--map-only') { options['map-only'] = true; continue; }
415
+ if (arg === '--help' || arg === '-h') { options.help = true; continue; }
416
+ const match = /^--([^=]+)(?:=(.*))?$/.exec(arg);
417
+ if (!match) continue;
418
+ options[match[1]] = match[2] === undefined ? true : match[2];
419
+ }
420
+ return options;
421
+ }
422
+
423
+ function printHelp() {
424
+ process.stdout.write(`Usage: node scripts/omp-coordination-honesty.js [flags]
425
+
426
+ Flags:
427
+ --claim=TEXT Claim or markdown header to audit
428
+ --handoff=PATH JSON or markdown handoff file
429
+ --map-only Print the omp → ThumbGate rail map
430
+ --json --strict
431
+
432
+ Source: ${SOURCE_URL}
433
+ Does not install omp.
434
+ `);
435
+ }
436
+
437
+ function runCli(argv = process.argv.slice(2)) {
438
+ const args = parseCliArgs(argv);
439
+ if (args.help) {
440
+ printHelp();
441
+ return 0;
442
+ }
443
+ const report = buildOmpCoordinationHonestyReport(args);
444
+ if (args.json) process.stdout.write(`${JSON.stringify(report, null, 2)}\n`);
445
+ else process.stdout.write(formatOmpCoordinationHonestyReport(report));
446
+ if (args.strict && report.status !== 'ready') return 1;
447
+ if (report.status === 'fail') return 1;
448
+ return 0;
449
+ }
450
+ function diagnoseFailureIntervention({ processFailures = 0, contentFailures = 0, totalFailures = 0 } = {}) {
451
+ const total = totalFailures || (processFailures + contentFailures);
452
+ if (total === 0) return { ceilingHit: false, intervention: 'none', rationale: 'No failures recorded.' };
453
+ const pRate = processFailures / total;
454
+ const cRate = contentFailures / total;
455
+ if (total >= 3 && cRate >= 0.8 && pRate <= 0.2) {
456
+ return {
457
+ ceilingHit: true,
458
+ intervention: 'model_tier_escalation_or_weight_training',
459
+ rationale: `Content failures dominate (${(cRate * 100).toFixed(1)}%). Harness evolution ceiling hit per arXiv:2610.11655. Escalate named model or train weights instead of adding prompt rules.`,
460
+ };
461
+ }
462
+ if (pRate >= 0.2) {
463
+ return {
464
+ ceilingHit: false,
465
+ intervention: 'harness_evolution',
466
+ rationale: `Process failures present (${(pRate * 100).toFixed(1)}%). Harness evolution has high ROI.`,
467
+ };
468
+ }
469
+ return {
470
+ ceilingHit: false,
471
+ intervention: 'monitor',
472
+ rationale: 'Failure distribution inconclusive.',
473
+ };
474
+ }
475
+
476
+ module.exports = {
477
+ SOURCE_URL,
478
+ GATE_ID,
479
+ RAIL_MAP,
480
+ buildOmpCoordinationHonestyReport,
481
+ formatOmpCoordinationHonestyReport,
482
+ diagnoseFailureIntervention,
483
+ runCli,
484
+ };
485
+
486
+ if (path.resolve(process.argv[1] || '') === path.resolve(__filename)) {
487
+ process.exitCode = runCli();
488
+ }
@@ -4,7 +4,8 @@ const fs = require('fs');
4
4
  const crypto = require('crypto');
5
5
  const os = require('os');
6
6
  const path = require('path');
7
-
7
+ const { isValidKey } = require('./license');
8
+ const { isEnforced } = require('./entitlement');
8
9
  const DEFAULT_PRO_API = 'https://thumbgate-production.up.railway.app';
9
10
  const DEFAULT_PRO_ACTIVATION_ALERT_EMAIL = 'igor.ganapolsky@gmail.com';
10
11
  const CREATOR_BYPASS_VALUE = process.env.THUMBGATE_DEV_SECRET || '';
@@ -279,7 +280,7 @@ function resolveProKey({ env = process.env, homeDir } = {}) {
279
280
  };
280
281
  }
281
282
 
282
- const envKey = String(env.THUMBGATE_API_KEY || '').trim();
283
+ const envKey = String(env.THUMBGATE_API_KEY || env.THUMBGATE_LICENSE || '').trim();
283
284
  if (envKey) {
284
285
  return {
285
286
  key: envKey,
@@ -297,6 +298,16 @@ function resolveProKey({ env = process.env, homeDir } = {}) {
297
298
  };
298
299
  }
299
300
 
301
+ const { resolveLicenseToken } = require('./entitlement');
302
+ const configToken = resolveLicenseToken({}, { homeDir });
303
+ if (configToken) {
304
+ return {
305
+ key: configToken,
306
+ source: 'config-license',
307
+ licensePath: path.join(homeDir || os.homedir(), '.config', 'thumbgate', 'license.json'),
308
+ };
309
+ }
310
+
300
311
  return null;
301
312
  }
302
313
 
@@ -332,7 +343,13 @@ async function startLocalProDashboard({
332
343
  if (!normalizedKey && !isCreatorDev({ env, homeDir })) {
333
344
  throw new Error('Pro license key required.');
334
345
  }
335
-
346
+ if (
347
+ isEnforced(env)
348
+ && !isCreatorDev({ env, homeDir })
349
+ && !isValidKey(normalizedKey, { env })
350
+ ) {
351
+ throw new Error('Signed Ed25519 entitlement token required when THUMBGATE_ENFORCE_ENTITLEMENTS=1.');
352
+ }
336
353
  env.THUMBGATE_PRO_MODE = '1';
337
354
  env.THUMBGATE_API_KEY = normalizedKey;
338
355
 
@@ -787,7 +787,7 @@ function logSafeReport(report, suite, fromFeedback) {
787
787
  feedbackDerived: report.feedbackDerived === true,
788
788
  syntheticCount: Number(report.syntheticCount || 0),
789
789
  comparison,
790
- results: (report.results || []).map(logSafeResult),
790
+ results: (report.results || []).map((x) => logSafeResult(x)),
791
791
  suiteDefinition: fromFeedback
792
792
  ? {
793
793
  version: Number(suite?.version || 0),