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.
- package/.agents/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
- package/.agents/skills/bolt-forge-opt-in-not-clone/SKILL.md +72 -0
- package/.agents/skills/decisive-step-evaluator/SKILL.md +47 -0
- package/.agents/skills/fiddler-control-plane-honesty/SKILL.md +61 -0
- package/.agents/skills/halo-trace-optimize-not-clone/SKILL.md +60 -0
- package/.agents/skills/harness-evolution-ceiling/SKILL.md +52 -0
- package/.agents/skills/infoq-architect-honesty-not-clone/SKILL.md +37 -0
- package/.agents/skills/meko-datapack-honesty-not-clone/SKILL.md +45 -0
- package/.agents/skills/mintlify-knowledge-honesty-not-clone/SKILL.md +49 -0
- package/.agents/skills/model-distress-governance/SKILL.md +56 -0
- package/.agents/skills/omp-coordination-honesty-not-clone/SKILL.md +94 -0
- package/.agents/skills/saas-moat-honesty-not-clone/SKILL.md +22 -0
- package/.agents/skills/salt-code-policy-honesty-not-clone/SKILL.md +76 -0
- package/.agents/skills/siren-mcp-governance/SKILL.md +50 -0
- package/.agents/skills/vs-coverage-gap-not-clone/SKILL.md +69 -0
- package/.agents/skills/wisdom-context-artifact-not-clone/SKILL.md +67 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/forge/forge.yaml +3 -3
- package/adapters/future-agi/.mcp.json +1 -1
- package/adapters/future-agi/config.toml +1 -1
- package/adapters/future-agi/opencode.json +1 -1
- package/adapters/herdr/herdr-plugin.toml +2 -2
- package/adapters/hotdata/hotdata-vector-store.js +575 -0
- package/adapters/mcp/server-stdio.js +1 -1
- package/adapters/opencode/opencode.json +1 -1
- package/adapters/strands/STRANDS.md +107 -0
- package/adapters/strands/strands-box-diode.js +344 -0
- package/adapters/strands/strands-decider-adapter.js +445 -0
- package/adapters/strands/strands-middleware.js +192 -0
- package/adapters/tailscale/.mcp.json +15 -0
- package/adapters/tailscale/TAILSCALE.md +117 -0
- package/adapters/tailscale/config.toml +16 -0
- package/bin/cli.js +602 -21
- package/config/gate-templates.json +109 -0
- package/config/gates/default.json +13 -0
- package/config/schemas/task-outcome-receipt.schema.json +12 -0
- package/package.json +150 -21
- package/public/blog/2026-09-28-pretool-secret-deny.html +83 -0
- package/public/blog/2026-10-01-aws-strands-harness-token-firewall.html +77 -0
- package/public/blog/2026-10-01-model-distress-relief-seeking-firewall.html +71 -0
- package/public/blog/2026-10-02-salt-code-honest-steal-40-guardrails.html +106 -0
- package/public/blog/2026-10-05-why-3-days-of-triage-wont-save-ai-speed-code.html +119 -0
- package/public/blog/2026-10-09-your-code-got-a-third-author-governance.html +141 -0
- package/public/connectors.html +329 -0
- package/public/enterprise-governance.html +311 -0
- package/public/gaming-playbook.html +732 -0
- package/public/index.html +77 -51
- package/public/install.html +7 -7
- package/public/learn.html +14 -0
- package/public/numbers.html +2 -2
- package/public/onboarding.html +794 -0
- package/public/operator-framework.html +385 -0
- package/public/pricing.html +14 -10
- package/scripts/activesaddler-curriculum-doctor.js +357 -0
- package/scripts/agent-context-artifact.js +325 -0
- package/scripts/agent-egress-policy.js +2 -2
- package/scripts/agent-operations-planner.js +1 -1
- package/scripts/agent-outcome-eval.js +1 -1
- package/scripts/agent-reliability-client.js +148 -0
- package/scripts/apple-minions-idle-compute-steal.js +428 -0
- package/scripts/autoresearch-runner.js +20 -1
- package/scripts/billing.js +0 -1
- package/scripts/cli-demo.js +505 -1
- package/scripts/cli-schema.js +36 -0
- package/scripts/colab-compute-honesty.js +93 -0
- package/scripts/corporate-email-isolation-diode.js +299 -0
- package/scripts/coverage-gap.js +396 -0
- package/scripts/dashboard-chat.js +3 -3
- package/scripts/dashboard.js +2 -2
- package/scripts/decisive-step-doctor.js +256 -0
- package/scripts/decisive-step-evaluator.js +390 -0
- package/scripts/entitlement.js +18 -7
- package/scripts/experiment-tracker.js +5 -3
- package/scripts/feedback-loop.js +26 -3
- package/scripts/fiddler-control-plane-honesty.js +303 -0
- package/scripts/financial-control-plane.js +10 -2
- package/scripts/gates-engine.js +3 -1
- package/scripts/github-license-compliance-diode.js +378 -0
- package/scripts/halo-trace-optimizer.js +631 -0
- package/scripts/harness-ceiling-doctor.js +326 -0
- package/scripts/hf-papers.js +1 -1
- package/scripts/human-escalation.js +7 -1
- package/scripts/hybrid-feedback-context.js +53 -7
- package/scripts/infoq-architect-honesty.js +362 -0
- package/scripts/lesson-graph.js +785 -0
- package/scripts/lesson-inference.js +1 -1
- package/scripts/lesson-retrieval.js +26 -18
- package/scripts/license.js +122 -21
- package/scripts/llm-behavior-monitor.js +1 -1
- package/scripts/llm-obs-honesty.js +52 -0
- package/scripts/local-model-profile.js +11 -7
- package/scripts/mailer/resend-mailer.js +6 -3
- package/scripts/mcp-transport-strategy.js +1 -1
- package/scripts/meko-datapack-honesty.js +414 -0
- package/scripts/migrate-lesson-graph.js +442 -0
- package/scripts/mintlify-knowledge-honesty.js +647 -0
- package/scripts/model-distress-detector.js +207 -0
- package/scripts/model-distress-doctor.js +368 -0
- package/scripts/multi-harness-invariants.js +305 -0
- package/scripts/omp-coordination-honesty.js +488 -0
- package/scripts/pro-local-dashboard.js +20 -3
- package/scripts/prompt-eval.js +1 -1
- package/scripts/prove-herdr-adapter.js +367 -3
- package/scripts/rag-embedding-identity.js +1 -1
- package/scripts/rrsi-regularizer.js +531 -0
- package/scripts/saas-moat-honesty.js +443 -0
- package/scripts/salt-code-policy-honesty.js +1204 -0
- package/scripts/secret-redaction.js +58 -0
- package/scripts/session-export-gate.js +368 -0
- package/scripts/siren-mcp-governance.js +539 -0
- package/scripts/strands-box-doctor.js +130 -0
- package/scripts/strands-harness-doctor.js +390 -0
- package/scripts/stripe-revenue-catalog-audit.js +12 -0
- package/scripts/stripe-revenue-catalog.js +40 -0
- package/scripts/switchyard-router.js +153 -0
- package/scripts/tailscale-p2p-doctor.js +252 -0
- package/scripts/task-outcomes.js +148 -3
- package/scripts/thumbgate-board-loop.js +4 -2
- package/scripts/thumbgate-daily-discoveries-publish.js +86 -38
- package/scripts/triage-savings-calculator.js +181 -0
- package/scripts/vector-store.js +41 -2
- package/scripts/vulnerability-pre-action-diode.js +319 -0
- package/scripts/windbg-evidence-diagnostics.js +241 -0
- package/scripts/workflow-intake-queue.js +1 -1
- package/scripts/workspace-agent-routines.js +534 -6
- package/scripts/workspace-evolver.js +143 -13
- package/server.json +2 -2
- package/skills/aws-strands-harness-not-clone/SKILL.md +53 -0
- package/skills/siren-mcp-governance/SKILL.md +50 -0
- package/src/api/server.js +191 -5
- package/src/mcp-writeguard.js +1 -1
- package/src/session-interactivity.js +284 -0
|
@@ -563,7 +563,7 @@ const LLM_LESSON_MULTISHOT_EXAMPLES = [
|
|
|
563
563
|
'file-level',
|
|
564
564
|
['regression-test', 'stripe', 'billing', 'tier'],
|
|
565
565
|
],
|
|
566
|
-
].map(createLessonPromptExample);
|
|
566
|
+
].map((x) => createLessonPromptExample(x));
|
|
567
567
|
|
|
568
568
|
function renderMultishotExamplesForPrompt(examples = LLM_LESSON_MULTISHOT_EXAMPLES) {
|
|
569
569
|
return examples.map((ex) => (
|
|
@@ -247,10 +247,10 @@ function retrieveRelevantLessons(toolName, actionContext, options = {}) {
|
|
|
247
247
|
mode: 'sync',
|
|
248
248
|
}, { feedbackDir });
|
|
249
249
|
return filterTopP(
|
|
250
|
-
dedupeSupersededLessons(results),
|
|
250
|
+
applyGraphResolution(dedupeSupersededLessons(results), options, memories),
|
|
251
251
|
resolveTopP(options),
|
|
252
252
|
{ minKeep: options.minKeep },
|
|
253
|
-
).slice(0, maxResults).map(shapeLesson);
|
|
253
|
+
).slice(0, maxResults).map((x) => shapeLesson(x));
|
|
254
254
|
} catch {
|
|
255
255
|
// fall through to classic path
|
|
256
256
|
}
|
|
@@ -295,18 +295,10 @@ function retrieveRelevantLessons(toolName, actionContext, options = {}) {
|
|
|
295
295
|
|
|
296
296
|
// Stage 3 (opt-in) — Memora-style nucleus stop: trim the low-mass tail so a
|
|
297
297
|
// dominant lesson isn't padded out to maxResults. No-op unless topP < 1.
|
|
298
|
-
const deduped = dedupeSupersededLessons(reranked);
|
|
298
|
+
const deduped = applyGraphResolution(dedupeSupersededLessons(reranked), options, memories);
|
|
299
299
|
const selected = filterTopP(deduped, resolveTopP(options), { minKeep: options.minKeep });
|
|
300
300
|
|
|
301
|
-
const shaped = selected.slice(0, maxResults).map((
|
|
302
|
-
id: m.id,
|
|
303
|
-
title: m.title,
|
|
304
|
-
content: m.content,
|
|
305
|
-
signal: m.tags?.includes('negative') ? 'negative' : 'positive',
|
|
306
|
-
rule: m.structuredRule || null,
|
|
307
|
-
relevanceScore: m.rerankedScore ?? m.relevanceScore,
|
|
308
|
-
timestamp: m.timestamp,
|
|
309
|
-
}));
|
|
301
|
+
const shaped = selected.slice(0, maxResults).map((x) => shapeLesson(x));
|
|
310
302
|
|
|
311
303
|
// Attach retrieval quality tier once (non-enumerable-ish via property on array)
|
|
312
304
|
try {
|
|
@@ -375,16 +367,31 @@ function loadMemories(feedbackDir, options = {}) {
|
|
|
375
367
|
);
|
|
376
368
|
}
|
|
377
369
|
|
|
370
|
+
function applyGraphResolution(lessons, options = {}, memories) {
|
|
371
|
+
const graph = require('./lesson-graph');
|
|
372
|
+
const db = graph.openGraphDBIfExists(options);
|
|
373
|
+
if (!db) return lessons;
|
|
374
|
+
try {
|
|
375
|
+
const allowed = selectRetrievalMemories(memories || loadMemories(options.feedbackDir, options), options);
|
|
376
|
+
return graph.annotateAndFilterLessons(db, lessons, { lookup: new Map(allowed.map(record => [record.id, record])) });
|
|
377
|
+
} catch {
|
|
378
|
+
return lessons;
|
|
379
|
+
} finally {
|
|
380
|
+
db.close();
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
378
384
|
function shapeLesson(m, retrieval = null) {
|
|
379
385
|
const shaped = {
|
|
380
386
|
id: m.id,
|
|
381
387
|
title: m.title,
|
|
382
388
|
content: m.content,
|
|
383
|
-
signal: m.tags?.includes('negative') ? 'negative' : 'positive',
|
|
389
|
+
signal: m.signal === 'negative' || m.signal === 'positive' ? m.signal : (m.tags?.includes('negative') ? 'negative' : 'positive'),
|
|
384
390
|
rule: m.structuredRule || null,
|
|
385
391
|
relevanceScore: m.rerankedScore ?? m.relevanceScore,
|
|
386
392
|
timestamp: m.timestamp,
|
|
387
393
|
};
|
|
394
|
+
if (m.lessonGraph) shaped.graph = m.lessonGraph;
|
|
388
395
|
if (retrieval) shaped.retrieval = retrieval;
|
|
389
396
|
return shaped;
|
|
390
397
|
}
|
|
@@ -482,9 +489,9 @@ async function retrieveRelevantLessonsAsync(toolName, actionContext, options = {
|
|
|
482
489
|
// Short-circuit: skip embedding/dense search completely
|
|
483
490
|
const { rerankLessons } = require('./lesson-reranker');
|
|
484
491
|
const reranked = rerankLessons(actionContext, dedupeCandidatePool(lexicalScored), { topK: Math.max(maxResults * 2, maxResults), toolName });
|
|
485
|
-
return filterTopP(dedupeSupersededLessons(reranked), resolveTopP(options), { minKeep: options.minKeep })
|
|
492
|
+
return filterTopP(applyGraphResolution(dedupeSupersededLessons(reranked), options, memories), resolveTopP(options), { minKeep: options.minKeep })
|
|
486
493
|
.slice(0, maxResults)
|
|
487
|
-
.map(shapeLesson);
|
|
494
|
+
.map((x) => shapeLesson(x));
|
|
488
495
|
}
|
|
489
496
|
|
|
490
497
|
const queryPlan = lexicalScored[0]?.relevanceScore >= (options.rewriteBelowScore ?? 0.6)
|
|
@@ -584,7 +591,7 @@ async function retrieveRelevantLessonsAsync(toolName, actionContext, options = {
|
|
|
584
591
|
lexicalPool: meta.lexicalPool,
|
|
585
592
|
}, { feedbackDir });
|
|
586
593
|
const cut = filterTopP(
|
|
587
|
-
dedupeSupersededLessons(results),
|
|
594
|
+
applyGraphResolution(dedupeSupersededLessons(results), options, memories),
|
|
588
595
|
resolveTopP(options),
|
|
589
596
|
{ minKeep: options.minKeep },
|
|
590
597
|
).slice(0, maxResults);
|
|
@@ -626,9 +633,9 @@ async function retrieveRelevantLessonsAsync(toolName, actionContext, options = {
|
|
|
626
633
|
|
|
627
634
|
const { rerankLessons } = require('./lesson-reranker');
|
|
628
635
|
const reranked = rerankLessons(actionContext, candidates, { topK: Math.max(maxResults * 2, maxResults), toolName });
|
|
629
|
-
const rows = filterTopP(dedupeSupersededLessons(reranked), resolveTopP(options), { minKeep: options.minKeep })
|
|
636
|
+
const rows = filterTopP(applyGraphResolution(dedupeSupersededLessons(reranked), options, memories), resolveTopP(options), { minKeep: options.minKeep })
|
|
630
637
|
.slice(0, maxResults)
|
|
631
|
-
.map(shapeLesson);
|
|
638
|
+
.map((x) => shapeLesson(x));
|
|
632
639
|
return attachArrayRetrievalMeta(rows, {
|
|
633
640
|
strategy: 'hybrid-rrf+bm25',
|
|
634
641
|
indexUpdatedAtMs: options.indexUpdatedAtMs ?? null,
|
|
@@ -890,6 +897,7 @@ function calculateRetrievalEntropy(lessons) {
|
|
|
890
897
|
}
|
|
891
898
|
|
|
892
899
|
module.exports = {
|
|
900
|
+
applyGraphResolution,
|
|
893
901
|
retrieveRelevantLessons,
|
|
894
902
|
retrieveWithLatencyBudget,
|
|
895
903
|
retrieveRelevantLessonsAsync,
|
package/scripts/license.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
-
const
|
|
4
|
+
const {
|
|
5
|
+
verifyLicense: verifySignedEntitlement,
|
|
6
|
+
isEnforced: isEntitlementEnforced,
|
|
7
|
+
} = require('./entitlement');
|
|
5
8
|
|
|
6
9
|
const VALID_PREFIXES = ['tg_pro_', 'tg_'];
|
|
7
10
|
const LEGACY_COMPATIBLE_KEY = /^[a-z]{4,16}_[a-f0-9]{24,}$/i;
|
|
@@ -10,11 +13,16 @@ function getLicensePath(homeDir = process.env.HOME || process.env.USERPROFILE ||
|
|
|
10
13
|
return path.join(homeDir, '.thumbgate', 'license.json');
|
|
11
14
|
}
|
|
12
15
|
|
|
16
|
+
function getSignedConfigLicensePath(homeDir = process.env.HOME || process.env.USERPROFILE || '.') {
|
|
17
|
+
return path.join(homeDir, '.config', 'thumbgate', 'license.json');
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
const LICENSE_PATH = getLicensePath();
|
|
14
21
|
|
|
15
|
-
function
|
|
22
|
+
function isLegacyKeyFormat(key) {
|
|
16
23
|
return Boolean(
|
|
17
|
-
key
|
|
24
|
+
typeof key === 'string'
|
|
25
|
+
&& key
|
|
18
26
|
&& (
|
|
19
27
|
VALID_PREFIXES.some((p) => key.startsWith(p))
|
|
20
28
|
|| LEGACY_COMPATIBLE_KEY.test(key)
|
|
@@ -22,25 +30,114 @@ function isValidKey(key) {
|
|
|
22
30
|
);
|
|
23
31
|
}
|
|
24
32
|
|
|
33
|
+
function verifySignedCandidate(token, options = {}) {
|
|
34
|
+
if (typeof token !== 'string' || !token.includes('.')) {
|
|
35
|
+
return { valid: false };
|
|
36
|
+
}
|
|
37
|
+
const verified = verifySignedEntitlement(token, {
|
|
38
|
+
trustedKeys: options.trustedKeys,
|
|
39
|
+
now: options.now,
|
|
40
|
+
});
|
|
41
|
+
if (!verified.valid || verified.tier === 'free') {
|
|
42
|
+
return { valid: false, reason: verified.reason || 'free_tier' };
|
|
43
|
+
}
|
|
44
|
+
return verified;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isValidKey(key, options = {}) {
|
|
48
|
+
if (typeof key !== 'string' || !key) return false;
|
|
49
|
+
if (verifySignedCandidate(key, options).valid) return true;
|
|
50
|
+
const env = options.env || process.env;
|
|
51
|
+
if (isEntitlementEnforced(env)) return false;
|
|
52
|
+
return isLegacyKeyFormat(key);
|
|
53
|
+
}
|
|
54
|
+
|
|
25
55
|
function verifyLicense(options = {}) {
|
|
26
|
-
|
|
56
|
+
const env = options.env || process.env;
|
|
57
|
+
const enforced = isEntitlementEnforced(env);
|
|
58
|
+
|
|
59
|
+
// 1. Check explicit signed Ed25519 license env (THUMBGATE_LICENSE) first.
|
|
60
|
+
if (typeof env.THUMBGATE_LICENSE === 'string' && env.THUMBGATE_LICENSE.trim()) {
|
|
61
|
+
const signed = verifySignedCandidate(env.THUMBGATE_LICENSE.trim(), options);
|
|
62
|
+
if (signed.valid) {
|
|
63
|
+
return {
|
|
64
|
+
valid: true,
|
|
65
|
+
signed: true,
|
|
66
|
+
tier: signed.tier,
|
|
67
|
+
features: signed.features,
|
|
68
|
+
source: 'env',
|
|
69
|
+
envVar: 'THUMBGATE_LICENSE',
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// 2. Only ThumbGate's own env vars are license candidates — scanning foreign
|
|
27
75
|
// *_API_KEY / *_PRO_KEY vars would treat another vendor's secret as a
|
|
28
76
|
// license key. The result object never carries the raw key value.
|
|
29
|
-
const
|
|
30
|
-
['THUMBGATE_API_KEY',
|
|
31
|
-
['THUMBGATE_PRO_KEY',
|
|
32
|
-
...Object.entries(
|
|
77
|
+
const envCandidates = [
|
|
78
|
+
['THUMBGATE_API_KEY', env.THUMBGATE_API_KEY],
|
|
79
|
+
['THUMBGATE_PRO_KEY', env.THUMBGATE_PRO_KEY],
|
|
80
|
+
...Object.entries(env)
|
|
33
81
|
.filter(([name]) => name.startsWith('THUMBGATE_') && /(?:_API_KEY|_PRO_KEY)$/.test(name)),
|
|
34
|
-
]
|
|
35
|
-
|
|
36
|
-
|
|
82
|
+
];
|
|
83
|
+
for (const [envVar, value] of envCandidates) {
|
|
84
|
+
if (typeof value !== 'string' || !value) continue;
|
|
85
|
+
const signed = verifySignedCandidate(value, options);
|
|
86
|
+
if (signed.valid) {
|
|
87
|
+
return {
|
|
88
|
+
valid: true,
|
|
89
|
+
signed: true,
|
|
90
|
+
tier: signed.tier,
|
|
91
|
+
features: signed.features,
|
|
92
|
+
source: 'env',
|
|
93
|
+
envVar,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
if (!enforced && isLegacyKeyFormat(value)) {
|
|
97
|
+
return { valid: true, source: 'env', envVar };
|
|
98
|
+
}
|
|
37
99
|
}
|
|
38
100
|
|
|
101
|
+
// 3. Check ~/.config/thumbgate/license.json for signed Ed25519 tokens.
|
|
102
|
+
const signedConfigPath = getSignedConfigLicensePath(options.homeDir);
|
|
103
|
+
try {
|
|
104
|
+
if (fs.existsSync(signedConfigPath)) {
|
|
105
|
+
const data = JSON.parse(fs.readFileSync(signedConfigPath, 'utf8'));
|
|
106
|
+
const token = data.license || data.token || data.key;
|
|
107
|
+
const signed = verifySignedCandidate(token, options);
|
|
108
|
+
if (signed.valid) {
|
|
109
|
+
return {
|
|
110
|
+
valid: true,
|
|
111
|
+
signed: true,
|
|
112
|
+
tier: signed.tier,
|
|
113
|
+
features: signed.features,
|
|
114
|
+
source: 'file',
|
|
115
|
+
activatedAt: data.activatedAt,
|
|
116
|
+
path: signedConfigPath,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
} catch (_) {}
|
|
121
|
+
|
|
122
|
+
// 4. Check ~/.thumbgate/license.json (signed token or, when not enforced, legacy key).
|
|
39
123
|
const licensePath = getLicensePath(options.homeDir);
|
|
40
124
|
try {
|
|
41
125
|
if (fs.existsSync(licensePath)) {
|
|
42
126
|
const data = JSON.parse(fs.readFileSync(licensePath, 'utf8'));
|
|
43
|
-
|
|
127
|
+
const candidate = data.key || data.license || data.token;
|
|
128
|
+
const signed = verifySignedCandidate(candidate, options);
|
|
129
|
+
if (signed.valid) {
|
|
130
|
+
return {
|
|
131
|
+
valid: true,
|
|
132
|
+
signed: true,
|
|
133
|
+
tier: signed.tier,
|
|
134
|
+
features: signed.features,
|
|
135
|
+
source: 'file',
|
|
136
|
+
activatedAt: data.activatedAt,
|
|
137
|
+
path: licensePath,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
if (!enforced && isLegacyKeyFormat(data.key)) {
|
|
44
141
|
return {
|
|
45
142
|
valid: true,
|
|
46
143
|
source: 'file',
|
|
@@ -51,7 +148,11 @@ function verifyLicense(options = {}) {
|
|
|
51
148
|
}
|
|
52
149
|
} catch (_) {}
|
|
53
150
|
|
|
54
|
-
return {
|
|
151
|
+
return {
|
|
152
|
+
valid: false,
|
|
153
|
+
source: null,
|
|
154
|
+
...(enforced ? { reason: 'signed_entitlement_required' } : {}),
|
|
155
|
+
};
|
|
55
156
|
}
|
|
56
157
|
|
|
57
158
|
function isProLicensed(options) {
|
|
@@ -59,8 +160,14 @@ function isProLicensed(options) {
|
|
|
59
160
|
}
|
|
60
161
|
|
|
61
162
|
function activateLicense(key, options = {}) {
|
|
62
|
-
if (!isValidKey(key)) {
|
|
63
|
-
|
|
163
|
+
if (!isValidKey(key, options)) {
|
|
164
|
+
const enforced = isEntitlementEnforced(options.env || process.env);
|
|
165
|
+
return {
|
|
166
|
+
success: false,
|
|
167
|
+
error: enforced
|
|
168
|
+
? 'Invalid license token. Signed Ed25519 entitlement token required when THUMBGATE_ENFORCE_ENTITLEMENTS=1.'
|
|
169
|
+
: 'Invalid key format. Expected signed Ed25519 token, tg_..., or tg_pro_...',
|
|
170
|
+
};
|
|
64
171
|
}
|
|
65
172
|
|
|
66
173
|
const licensePath = getLicensePath(options.homeDir);
|
|
@@ -71,12 +178,6 @@ function activateLicense(key, options = {}) {
|
|
|
71
178
|
return { success: true, path: licensePath };
|
|
72
179
|
}
|
|
73
180
|
|
|
74
|
-
function generateLicenseKey(email) {
|
|
75
|
-
const payload = `${email}:${Date.now()}`;
|
|
76
|
-
const hash = crypto.createHash('sha256').update(payload).digest('hex').slice(0, 24);
|
|
77
|
-
return `tg_pro_${hash}`;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
181
|
module.exports = {
|
|
81
182
|
verifyLicense,
|
|
82
183
|
isProLicensed,
|
|
@@ -25,7 +25,7 @@ const DEFAULT_THRESHOLDS = {
|
|
|
25
25
|
|
|
26
26
|
function analyzeBehaviorEvents(events = [], options = {}) {
|
|
27
27
|
const thresholds = { ...DEFAULT_THRESHOLDS, ...(options.thresholds || {}) };
|
|
28
|
-
const normalized = events.map(normalizeEvent);
|
|
28
|
+
const normalized = events.map((x) => normalizeEvent(x));
|
|
29
29
|
const total = normalized.length;
|
|
30
30
|
const counts = {
|
|
31
31
|
malformed: normalized.filter((event) => !event.schemaValid).length,
|
|
@@ -460,6 +460,57 @@ function main(argv = process.argv.slice(2)) {
|
|
|
460
460
|
return 0;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
+
/**
|
|
464
|
+
* Audit the three multi-agent crew blind spots from datadog.pdf on local rails
|
|
465
|
+
* ($0 cost, zero dd-trace / OTLP dependencies):
|
|
466
|
+
* 1. Cost per agent across multi-model crews (Gemini, Grok, Ollama, Codex, Claude)
|
|
467
|
+
* 2. Exact handoff edge (`fromAgent -> toAgent`) where a 3-4 agent chain breaks
|
|
468
|
+
* 3. Runs that fail quietly (exitCode === 0 / status === 'completed' with empty handoff output)
|
|
469
|
+
*/
|
|
470
|
+
function auditMultiAgentCrewHandoffs(crewTrace = {}) {
|
|
471
|
+
const steps = Array.isArray(crewTrace.steps) ? crewTrace.steps : [];
|
|
472
|
+
const costByAgent = {};
|
|
473
|
+
const brokenHandoffEdges = [];
|
|
474
|
+
const silentFailureRuns = [];
|
|
475
|
+
|
|
476
|
+
for (let i = 0; i < steps.length; i++) {
|
|
477
|
+
const step = steps[i] || {};
|
|
478
|
+
const agentId = String(step.agentId || step.fromAgent || `agent_${i + 1}`).trim();
|
|
479
|
+
const costUsd = Number(step.costUsd) || 0;
|
|
480
|
+
costByAgent[agentId] = Number(((costByAgent[agentId] || 0) + costUsd).toFixed(4));
|
|
481
|
+
|
|
482
|
+
if (step.toAgent && (step.handoffFailed === true || step.status === 'handoff_broken')) {
|
|
483
|
+
brokenHandoffEdges.push({
|
|
484
|
+
stepIndex: i,
|
|
485
|
+
fromAgent: agentId,
|
|
486
|
+
toAgent: String(step.toAgent).trim(),
|
|
487
|
+
edge: `${agentId} -> ${String(step.toAgent).trim()}`,
|
|
488
|
+
reason: String(step.error || 'handoff_chain_broken'),
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
const exitedGreen = step.exitCode === 0 || step.status === 'completed';
|
|
493
|
+
const emptyOutput = (Number(step.tokensOut) === 0 && !step.outputArtifact) || step.handoffPayloadEmpty === true;
|
|
494
|
+
if (exitedGreen && emptyOutput) {
|
|
495
|
+
silentFailureRuns.push({
|
|
496
|
+
stepIndex: i,
|
|
497
|
+
agentId,
|
|
498
|
+
model: step.model || 'unknown',
|
|
499
|
+
reason: 'silent_failure_green_exit_with_empty_handoff',
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
return {
|
|
505
|
+
ok: brokenHandoffEdges.length === 0 && silentFailureRuns.length === 0,
|
|
506
|
+
totalSteps: steps.length,
|
|
507
|
+
costByAgent,
|
|
508
|
+
totalCostUsd: Number(Object.values(costByAgent).reduce((a, b) => a + b, 0).toFixed(4)),
|
|
509
|
+
brokenHandoffEdges,
|
|
510
|
+
silentFailureRuns,
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
|
|
463
514
|
module.exports = {
|
|
464
515
|
PRACTICES,
|
|
465
516
|
PRACTICE_RAILS,
|
|
@@ -467,6 +518,7 @@ module.exports = {
|
|
|
467
518
|
SOURCE_URL,
|
|
468
519
|
detectCloneAttempt,
|
|
469
520
|
auditTrace,
|
|
521
|
+
auditMultiAgentCrewHandoffs,
|
|
470
522
|
probeRails,
|
|
471
523
|
buildLlmObsHonestyReport,
|
|
472
524
|
formatLlmObsHonestyReport,
|
|
@@ -67,6 +67,16 @@ const EMBEDDING_PROFILES = {
|
|
|
67
67
|
maxChars: 4096,
|
|
68
68
|
rationale: 'Higher-quality local embedding when memory headroom is available.',
|
|
69
69
|
},
|
|
70
|
+
embeddinggemma: {
|
|
71
|
+
id: 'embeddinggemma',
|
|
72
|
+
model: 'google/embeddinggemma-2-270m',
|
|
73
|
+
quantized: true,
|
|
74
|
+
maxChars: 32768, // 8K token context window (~4 chars/token)
|
|
75
|
+
dimensions: 768,
|
|
76
|
+
matryoshkaDim: 256,
|
|
77
|
+
modality: 'multimodal',
|
|
78
|
+
rationale: 'Google DeepMind EmbeddingGemma 2: 740M/270M modular architecture, 8K context, native 768d with MRL 256d for sub-0.5ms PreToolUse evaluation.',
|
|
79
|
+
},
|
|
70
80
|
};
|
|
71
81
|
|
|
72
82
|
const INDEXCACHE_SERVER_ENGINES = new Set([
|
|
@@ -294,13 +304,7 @@ function pickAutoProfile(hardware) {
|
|
|
294
304
|
}
|
|
295
305
|
|
|
296
306
|
function cloneProfile(profile) {
|
|
297
|
-
return {
|
|
298
|
-
id: profile.id,
|
|
299
|
-
model: profile.model,
|
|
300
|
-
quantized: profile.quantized,
|
|
301
|
-
maxChars: profile.maxChars,
|
|
302
|
-
rationale: profile.rationale,
|
|
303
|
-
};
|
|
307
|
+
return { ...profile };
|
|
304
308
|
}
|
|
305
309
|
|
|
306
310
|
function resolveEmbeddingProfile(env = process.env) {
|
|
@@ -19,8 +19,8 @@ const dns = require('node:dns').promises;
|
|
|
19
19
|
|
|
20
20
|
const PRODUCT_NAME = 'ThumbGate Pro';
|
|
21
21
|
const DASHBOARD_URL = 'https://thumbgate-production.up.railway.app/dashboard';
|
|
22
|
-
const DEFAULT_CONTACT_EMAIL = '
|
|
23
|
-
const DEFAULT_FROM = '
|
|
22
|
+
const DEFAULT_CONTACT_EMAIL = 'igor@igorganapolsky.com';
|
|
23
|
+
const DEFAULT_FROM = 'ThumbGate <igor@igorganapolsky.com>';
|
|
24
24
|
const DEFAULT_REPLY_TO = DEFAULT_CONTACT_EMAIL;
|
|
25
25
|
const DEFAULT_UNSUBSCRIBE_EMAIL = DEFAULT_CONTACT_EMAIL;
|
|
26
26
|
const DEFAULT_BUSINESS_NAME = 'Max Smith KDP LLC';
|
|
@@ -112,8 +112,11 @@ function splitCsv(value) {
|
|
|
112
112
|
.filter(Boolean);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
const DEFAULT_VERIFIED_SENDER_DOMAINS = ['igorganapolsky.com'];
|
|
116
|
+
|
|
115
117
|
function getVerifiedSenderDomains() {
|
|
116
|
-
|
|
118
|
+
const fromEnv = splitCsv(process.env.THUMBGATE_VERIFIED_SENDER_DOMAINS);
|
|
119
|
+
return new Set([...DEFAULT_VERIFIED_SENDER_DOMAINS, ...fromEnv]);
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
function flattenTxt(records) {
|
|
@@ -45,7 +45,7 @@ function recommendMcpTransport(service = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function buildMcpTransportMigrationPlan(services = []) {
|
|
48
|
-
const recommendations = services.map(recommendMcpTransport);
|
|
48
|
+
const recommendations = services.map((x) => recommendMcpTransport(x));
|
|
49
49
|
return {
|
|
50
50
|
recommendations,
|
|
51
51
|
pilots: recommendations.filter((item) => item.transport === 'grpc').slice(0, 1),
|