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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* 5. Generates public canonical HTML page under public/blog/ ensuring valid canonical target.
|
|
16
16
|
* 6. Coordinates fleet lease before writing to shared Obsidian Vault.
|
|
17
17
|
* 7. Acquires atomic run lock to prevent duplicate execution across cron and launchd.
|
|
18
|
-
* 8. Dispatches to Dev.to with canonical_url,
|
|
18
|
+
* 8. Dispatches to Dev.to with canonical_url, holding ambiguous attempts until their outcome is reconciled.
|
|
19
19
|
* 9. Records idempotent receipts to .thumbgate/daily-discoveries-ledger.jsonl.
|
|
20
20
|
*
|
|
21
21
|
* Usage:
|
|
@@ -29,7 +29,7 @@ const path = require('node:path');
|
|
|
29
29
|
const { execSync } = require('node:child_process');
|
|
30
30
|
const { buildUTMLink } = require('./social-analytics/utm');
|
|
31
31
|
|
|
32
|
-
const REPO_ROOT = path.resolve(__dirname, '..');
|
|
32
|
+
const REPO_ROOT = path.resolve(process.env.THUMBGATE_PUBLISH_ROOT || path.join(__dirname, '..'));
|
|
33
33
|
const MARKETING_DIR = path.join(REPO_ROOT, 'docs', 'marketing', 'daily-discoveries');
|
|
34
34
|
const PUBLIC_BLOG_DIR = path.join(REPO_ROOT, 'public', 'blog');
|
|
35
35
|
const LEDGER_PATH = path.join(REPO_ROOT, '.thumbgate', 'daily-discoveries-ledger.jsonl');
|
|
@@ -60,7 +60,8 @@ function getRecentGitCommit() {
|
|
|
60
60
|
encoding: 'utf8',
|
|
61
61
|
}).trim();
|
|
62
62
|
return log;
|
|
63
|
-
} catch
|
|
63
|
+
} catch {
|
|
64
|
+
// Staging outside a Git checkout still produces a usable draft.
|
|
64
65
|
return 'Tip of main';
|
|
65
66
|
}
|
|
66
67
|
}
|
|
@@ -140,8 +141,8 @@ By enforcing this check in the **PreToolUse** hook lifecycle, the agent runtime
|
|
|
140
141
|
|
|
141
142
|
function renderBlogHtml(topic, dateStr, markdownContent) {
|
|
142
143
|
const slug = `${dateStr}-${topic.slug}`;
|
|
143
|
-
const title = String(topic.title || '').
|
|
144
|
-
const tagline = String(topic.tagline || '').
|
|
144
|
+
const title = String(topic.title || '').replaceAll('"', '"');
|
|
145
|
+
const tagline = String(topic.tagline || '').replaceAll('"', '"');
|
|
145
146
|
const canonicalUrl = `https://thumbgate.ai/blog/${slug}`;
|
|
146
147
|
|
|
147
148
|
return `<!DOCTYPE html>
|
|
@@ -168,7 +169,7 @@ function renderBlogHtml(topic, dateStr, markdownContent) {
|
|
|
168
169
|
<p>${topic.problem}</p>
|
|
169
170
|
<h2>Architectural Resolution</h2>
|
|
170
171
|
<p>${topic.solution}</p>
|
|
171
|
-
<pre><code>${String(topic.codeSnippet || '').
|
|
172
|
+
<pre><code>${String(topic.codeSnippet || '').replaceAll('<', '<').replaceAll('>', '>')}</code></pre>
|
|
172
173
|
</section>
|
|
173
174
|
<footer class="post-footer">
|
|
174
175
|
<a href="https://thumbgate.ai/go/pro?utm_source=blog&utm_medium=article&utm_campaign=${slug}" class="cta-btn">Upgrade to ThumbGate Pro</a>
|
|
@@ -195,7 +196,9 @@ function acquireRunLock() {
|
|
|
195
196
|
fs.unlinkSync(LOCK_PATH);
|
|
196
197
|
return acquireRunLock();
|
|
197
198
|
}
|
|
198
|
-
} catch
|
|
199
|
+
} catch {
|
|
200
|
+
// A changed or unreadable lock cannot grant this process ownership.
|
|
201
|
+
}
|
|
199
202
|
return false;
|
|
200
203
|
}
|
|
201
204
|
return false;
|
|
@@ -207,7 +210,9 @@ function releaseRunLock() {
|
|
|
207
210
|
if (fs.existsSync(LOCK_PATH)) {
|
|
208
211
|
fs.unlinkSync(LOCK_PATH);
|
|
209
212
|
}
|
|
210
|
-
} catch
|
|
213
|
+
} catch {
|
|
214
|
+
// Keep an unreleasable lock in place so later runs remain blocked.
|
|
215
|
+
}
|
|
211
216
|
}
|
|
212
217
|
|
|
213
218
|
function canWriteToSharedVault(vaultDir) {
|
|
@@ -223,29 +228,48 @@ function canWriteToSharedVault(vaultDir) {
|
|
|
223
228
|
return false;
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
|
-
} catch
|
|
231
|
+
} catch {
|
|
232
|
+
// Unreadable coordination claims cannot authorize a vault write.
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
237
|
return true;
|
|
230
238
|
}
|
|
231
239
|
|
|
232
|
-
function
|
|
233
|
-
if (!
|
|
240
|
+
function hasPublicationReceipt(receipt) {
|
|
241
|
+
if (!receipt || !Number.isSafeInteger(receipt.id) || receipt.id <= 0 || typeof receipt.url !== 'string') return false;
|
|
234
242
|
try {
|
|
235
|
-
const
|
|
236
|
-
return
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return item.date === dateStr && item.status === 'published';
|
|
240
|
-
} catch (_) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
} catch (_) {
|
|
243
|
+
const url = new URL(receipt.url);
|
|
244
|
+
return url.protocol === 'https:' && url.hostname === 'dev.to' && url.pathname !== '/';
|
|
245
|
+
} catch {
|
|
246
|
+
// Invalid URLs cannot serve as proof of remote publication.
|
|
245
247
|
return false;
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
250
|
|
|
251
|
+
function getPublicationStatus(dateStr) {
|
|
252
|
+
if (!fs.existsSync(LEDGER_PATH)) return null;
|
|
253
|
+
let status = null;
|
|
254
|
+
const lines = fs.readFileSync(LEDGER_PATH, 'utf8').trim().split('\n');
|
|
255
|
+
for (const line of lines) {
|
|
256
|
+
let item;
|
|
257
|
+
try {
|
|
258
|
+
item = JSON.parse(line);
|
|
259
|
+
} catch {
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
if (!item || item.date !== dateStr) continue;
|
|
263
|
+
if (item.status === 'publication_unknown') status = 'publication_unknown';
|
|
264
|
+
if (item.status === 'published' && hasPublicationReceipt(item.devto)) status = 'published';
|
|
265
|
+
}
|
|
266
|
+
return status;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function hasAlreadyPublishedToday(dateStr) {
|
|
270
|
+
return getPublicationStatus(dateStr) === 'published';
|
|
271
|
+
}
|
|
272
|
+
|
|
249
273
|
function recordLedgerEntry(entry) {
|
|
250
274
|
fs.mkdirSync(path.dirname(LEDGER_PATH), { recursive: true });
|
|
251
275
|
fs.appendFileSync(LEDGER_PATH, JSON.stringify(entry) + '\n', 'utf8');
|
|
@@ -281,14 +305,6 @@ async function runDailyPublish(options = {}) {
|
|
|
281
305
|
};
|
|
282
306
|
}
|
|
283
307
|
|
|
284
|
-
if (!force && hasAlreadyPublishedToday(dateStr)) {
|
|
285
|
-
return {
|
|
286
|
-
status: 'skipped',
|
|
287
|
-
reason: `Already published daily discovery for ${dateStr}. Use --force to override.`,
|
|
288
|
-
date: dateStr,
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
|
|
292
308
|
// Acquire atomic process lock to prevent duplicate runs
|
|
293
309
|
if (!acquireRunLock()) {
|
|
294
310
|
return {
|
|
@@ -299,6 +315,23 @@ async function runDailyPublish(options = {}) {
|
|
|
299
315
|
}
|
|
300
316
|
|
|
301
317
|
try {
|
|
318
|
+
const publicationStatus = getPublicationStatus(dateStr);
|
|
319
|
+
if (publicationStatus === 'publication_unknown') {
|
|
320
|
+
return {
|
|
321
|
+
status: 'publication_unknown',
|
|
322
|
+
reason: 'A prior Dev.to attempt has an unknown outcome. Reconcile its remote publication before retrying; --force cannot override this hold.',
|
|
323
|
+
date: dateStr,
|
|
324
|
+
canonicalUrl,
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
if (!force && publicationStatus === 'published') {
|
|
328
|
+
return {
|
|
329
|
+
status: 'skipped',
|
|
330
|
+
reason: `Already published daily discovery for ${dateStr}. Use --force to override.`,
|
|
331
|
+
date: dateStr,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
302
335
|
// 1. Stage local marketing markdown
|
|
303
336
|
fs.mkdirSync(MARKETING_DIR, { recursive: true });
|
|
304
337
|
fs.writeFileSync(stagedPath, content, 'utf8');
|
|
@@ -326,6 +359,17 @@ async function runDailyPublish(options = {}) {
|
|
|
326
359
|
let devtoResult = null;
|
|
327
360
|
if (process.env.DEVTO_API_KEY) {
|
|
328
361
|
const { publishArticle } = require('./social-analytics/publishers/devto');
|
|
362
|
+
recordLedgerEntry({
|
|
363
|
+
date: dateStr,
|
|
364
|
+
topic: topic.slug,
|
|
365
|
+
title: topic.title,
|
|
366
|
+
status: 'publication_unknown',
|
|
367
|
+
attemptedAt: now.toISOString(),
|
|
368
|
+
canonicalUrl,
|
|
369
|
+
outputs,
|
|
370
|
+
devto: null,
|
|
371
|
+
reason: 'Dev.to publication attempt started. Reconcile the remote outcome if no confirmed receipt follows.',
|
|
372
|
+
});
|
|
329
373
|
const res = await publishArticle({
|
|
330
374
|
title: topic.title,
|
|
331
375
|
body_markdown: content,
|
|
@@ -333,24 +377,28 @@ async function runDailyPublish(options = {}) {
|
|
|
333
377
|
published: true,
|
|
334
378
|
canonical_url: canonicalUrl,
|
|
335
379
|
});
|
|
380
|
+
if (!hasPublicationReceipt(res)) {
|
|
381
|
+
const reason = 'Dev.to accepted the request without a valid publication receipt. Reconcile the remote outcome before retrying.';
|
|
382
|
+
return { status: 'publication_unknown', reason, date: dateStr, canonicalUrl, stagedPath, publicBlogHtmlPath, dryRun: false };
|
|
383
|
+
}
|
|
336
384
|
devtoResult = { id: res.id, url: res.url };
|
|
337
385
|
outputs.push({ type: 'devto', url: res.url });
|
|
338
386
|
}
|
|
339
387
|
|
|
340
|
-
|
|
388
|
+
const status = devtoResult ? 'published' : 'staged';
|
|
341
389
|
recordLedgerEntry({
|
|
342
390
|
date: dateStr,
|
|
343
391
|
topic: topic.slug,
|
|
344
392
|
title: topic.title,
|
|
345
|
-
status
|
|
346
|
-
publishedAt: now.toISOString(),
|
|
393
|
+
status,
|
|
394
|
+
...(devtoResult ? { publishedAt: now.toISOString() } : { stagedAt: now.toISOString() }),
|
|
347
395
|
canonicalUrl,
|
|
348
396
|
outputs,
|
|
349
397
|
devto: devtoResult,
|
|
350
398
|
});
|
|
351
399
|
|
|
352
400
|
return {
|
|
353
|
-
status
|
|
401
|
+
status,
|
|
354
402
|
date: dateStr,
|
|
355
403
|
topic: topic.slug,
|
|
356
404
|
title: topic.title,
|
|
@@ -366,10 +414,10 @@ async function runDailyPublish(options = {}) {
|
|
|
366
414
|
}
|
|
367
415
|
|
|
368
416
|
async function main() {
|
|
369
|
-
const args = process.argv.slice(2);
|
|
370
|
-
const dryRun = args.
|
|
371
|
-
const json = args.
|
|
372
|
-
const force = args.
|
|
417
|
+
const args = new Set(process.argv.slice(2));
|
|
418
|
+
const dryRun = args.has('--dry-run');
|
|
419
|
+
const json = args.has('--json');
|
|
420
|
+
const force = args.has('--force');
|
|
373
421
|
|
|
374
422
|
try {
|
|
375
423
|
const result = await runDailyPublish({ dryRun, force });
|
|
@@ -393,7 +441,7 @@ async function main() {
|
|
|
393
441
|
}
|
|
394
442
|
|
|
395
443
|
if (require.main === module) {
|
|
396
|
-
main();
|
|
444
|
+
void main();
|
|
397
445
|
}
|
|
398
446
|
|
|
399
447
|
module.exports = {
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Triage Savings & Enterprise ROI Calculator
|
|
6
|
+
*
|
|
7
|
+
* Quantifies the dollar value of ThumbGate pre-action interdiction using industry
|
|
8
|
+
* benchmarks from WHOOP and The New Stack:
|
|
9
|
+
* - 96 engineering hours per vulnerability incident (3 days x 4 engineers)
|
|
10
|
+
* - 4.5 engineering hours per agent bug / regression rollback
|
|
11
|
+
* - Blended engineering cost ($125/hr default)
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
const {
|
|
15
|
+
BENCHMARK_TRIAGE_HOURS_PER_INCIDENT,
|
|
16
|
+
GENERAL_INTERDICTION_HOURS_SAVED,
|
|
17
|
+
DEFAULT_BLENDED_HOURLY_RATE,
|
|
18
|
+
} = require('./vulnerability-pre-action-diode');
|
|
19
|
+
|
|
20
|
+
const PRICING_TIERS = Object.freeze({
|
|
21
|
+
free: { name: 'Community', monthlyCost: 0, annualCost: 0 },
|
|
22
|
+
pro: { name: 'Pro Firewall', monthlyCost: 19, annualCost: 149 },
|
|
23
|
+
managed: { name: 'Managed Workflow Gate', monthlyCost: 499, annualCost: 499 },
|
|
24
|
+
enterprise: { name: 'Enterprise Gateway', monthlyCost: 2500, annualCost: 27000 },
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
function calculateEnterpriseRoi(metrics = {}, options = {}) {
|
|
28
|
+
const vulnInterdictions = Math.max(0, Number(metrics.vulnerabilities || metrics.vulnCount || 0));
|
|
29
|
+
const generalInterdictions = Math.max(0, Number(metrics.general || metrics.interdictionsCount || 0));
|
|
30
|
+
const hourlyRate = Number(options.hourlyRate) || DEFAULT_BLENDED_HOURLY_RATE;
|
|
31
|
+
const tierKey = String(options.tier || 'pro').toLowerCase();
|
|
32
|
+
const tier = PRICING_TIERS[tierKey] || PRICING_TIERS.pro;
|
|
33
|
+
const timeframeMonths = Number(options.months) || 12;
|
|
34
|
+
|
|
35
|
+
const vulnHrs = vulnInterdictions * BENCHMARK_TRIAGE_HOURS_PER_INCIDENT;
|
|
36
|
+
const generalHrs = generalInterdictions * GENERAL_INTERDICTION_HOURS_SAVED;
|
|
37
|
+
const totalHoursSaved = vulnHrs + generalHrs;
|
|
38
|
+
|
|
39
|
+
const grossSavingsDollars = totalHoursSaved * hourlyRate;
|
|
40
|
+
const totalCostDollars = tier.monthlyCost * timeframeMonths;
|
|
41
|
+
const netSavingsDollars = grossSavingsDollars - totalCostDollars;
|
|
42
|
+
const roiMultiplier = totalCostDollars > 0
|
|
43
|
+
? Number((grossSavingsDollars / totalCostDollars).toFixed(2))
|
|
44
|
+
: grossSavingsDollars > 0 ? Infinity : 1.0;
|
|
45
|
+
|
|
46
|
+
// Single vulnerability break-even analysis
|
|
47
|
+
const valuePerVulnInterdiction = BENCHMARK_TRIAGE_HOURS_PER_INCIDENT * hourlyRate;
|
|
48
|
+
const annualTierCost = tier.annualCost || (tier.monthlyCost * 12);
|
|
49
|
+
const costForBreakEven = totalCostDollars > 0 ? totalCostDollars : annualTierCost;
|
|
50
|
+
const vulnsToBreakEven = costForBreakEven > 0
|
|
51
|
+
? Number((costForBreakEven / valuePerVulnInterdiction).toFixed(2))
|
|
52
|
+
: 0;
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
tier: tier.name,
|
|
56
|
+
timeframeMonths,
|
|
57
|
+
hourlyRate,
|
|
58
|
+
inputs: {
|
|
59
|
+
vulnerabilityInterdictions: vulnInterdictions,
|
|
60
|
+
generalInterdictions,
|
|
61
|
+
},
|
|
62
|
+
hoursSaved: {
|
|
63
|
+
fromVulnerabilities: vulnHrs,
|
|
64
|
+
fromGeneralRegressions: generalHrs,
|
|
65
|
+
totalHours: totalHoursSaved,
|
|
66
|
+
},
|
|
67
|
+
economics: {
|
|
68
|
+
grossSavingsDollars,
|
|
69
|
+
totalCostDollars,
|
|
70
|
+
netSavingsDollars,
|
|
71
|
+
roiMultiplier,
|
|
72
|
+
valuePerVulnPrevented: valuePerVulnInterdiction,
|
|
73
|
+
annualCost: annualTierCost,
|
|
74
|
+
vulnsToBreakEven,
|
|
75
|
+
},
|
|
76
|
+
pitchSummary: `Preventing just ${vulnsToBreakEven} critical vulnerabilities pays for ${tier.name} over ${timeframeMonths} months. Current metrics show $${grossSavingsDollars.toLocaleString()} in engineering time preserved.`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function runCli() {
|
|
81
|
+
const args = process.argv.slice(2);
|
|
82
|
+
const isJson = args.includes('--json');
|
|
83
|
+
const isWhoopModel = args.includes('--model-whoop');
|
|
84
|
+
|
|
85
|
+
if (isWhoopModel) {
|
|
86
|
+
// Model WHOOP's exact case study: 1 vulnerability every quarter (4/year), plus 24 agent PR bug interdictions
|
|
87
|
+
const whoopCase = calculateEnterpriseRoi(
|
|
88
|
+
{ vulnerabilities: 4, general: 24 },
|
|
89
|
+
{ tier: 'enterprise', months: 12, hourlyRate: 125 }
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
if (isJson) {
|
|
93
|
+
console.log(JSON.stringify(whoopCase, null, 2));
|
|
94
|
+
} else {
|
|
95
|
+
console.log('=== WHOOP / TNS Enterprise Model (1 Year) ===');
|
|
96
|
+
console.log(`Tier: ${whoopCase.tier}`);
|
|
97
|
+
console.log(`Hours Saved: ${whoopCase.hoursSaved.totalHours} hrs`);
|
|
98
|
+
console.log(`Gross Savings: $${whoopCase.economics.grossSavingsDollars.toLocaleString()}`);
|
|
99
|
+
console.log(`Net Savings: $${whoopCase.economics.netSavingsDollars.toLocaleString()}`);
|
|
100
|
+
console.log(`ROI Multiplier: ${whoopCase.economics.roiMultiplier}x`);
|
|
101
|
+
console.log(`Break-Even: ${whoopCase.economics.vulnsToBreakEven} blocked vulnerabilities/yr`);
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const vulnsArg = args.find((a) => a.startsWith('--vulnerabilities='));
|
|
107
|
+
const generalArg = args.find((a) => a.startsWith('--interdictions='));
|
|
108
|
+
const tierArg = args.find((a) => a.startsWith('--tier='));
|
|
109
|
+
const rateArg = args.find((a) => a.startsWith('--rate='));
|
|
110
|
+
|
|
111
|
+
let vulns = 2;
|
|
112
|
+
if (vulnsArg) {
|
|
113
|
+
const raw = vulnsArg.slice('--vulnerabilities='.length);
|
|
114
|
+
if (!/^\d+$/.test(raw)) {
|
|
115
|
+
console.error(`error: invalid --vulnerabilities operand: "${raw}". Must be a non-negative integer.`);
|
|
116
|
+
process.exitCode = 1;
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
vulns = parseInt(raw, 10);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let general = 10;
|
|
123
|
+
if (generalArg) {
|
|
124
|
+
const raw = generalArg.slice('--interdictions='.length);
|
|
125
|
+
if (!/^\d+$/.test(raw)) {
|
|
126
|
+
console.error(`error: invalid --interdictions operand: "${raw}". Must be a non-negative integer.`);
|
|
127
|
+
process.exitCode = 1;
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
general = parseInt(raw, 10);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let tier = 'pro';
|
|
134
|
+
if (tierArg) {
|
|
135
|
+
const raw = tierArg.slice('--tier='.length).toLowerCase();
|
|
136
|
+
if (!PRICING_TIERS[raw]) {
|
|
137
|
+
console.error(`error: unknown --tier: "${raw}". Supported tiers: ${Object.keys(PRICING_TIERS).join(', ')}.`);
|
|
138
|
+
process.exitCode = 1;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
tier = raw;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
let rate = 125;
|
|
145
|
+
if (rateArg) {
|
|
146
|
+
const raw = rateArg.slice('--rate='.length);
|
|
147
|
+
const parsed = parseFloat(raw);
|
|
148
|
+
if (isNaN(parsed) || parsed <= 0) {
|
|
149
|
+
console.error(`error: invalid --rate operand: "${raw}". Must be a positive number.`);
|
|
150
|
+
process.exitCode = 1;
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
rate = parsed;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const result = calculateEnterpriseRoi(
|
|
157
|
+
{ vulnerabilities: vulns, general },
|
|
158
|
+
{ tier, hourlyRate: rate }
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
if (isJson) {
|
|
162
|
+
console.log(JSON.stringify(result, null, 2));
|
|
163
|
+
} else {
|
|
164
|
+
console.log(`=== ThumbGate Triage ROI Report (${result.tier}) ===`);
|
|
165
|
+
console.log(`Hours Saved: ${result.hoursSaved.totalHours}h`);
|
|
166
|
+
console.log(`Gross Savings: $${result.economics.grossSavingsDollars.toLocaleString()}`);
|
|
167
|
+
console.log(`Subscription Cost: $${result.economics.totalCostDollars.toLocaleString()}`);
|
|
168
|
+
console.log(`Net Savings: $${result.economics.netSavingsDollars.toLocaleString()}`);
|
|
169
|
+
console.log(`ROI: ${result.economics.roiMultiplier}x`);
|
|
170
|
+
console.log(`Pitch: ${result.pitchSummary}`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
module.exports = {
|
|
175
|
+
PRICING_TIERS,
|
|
176
|
+
calculateEnterpriseRoi,
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
if (require.main === module) {
|
|
180
|
+
runCli();
|
|
181
|
+
}
|
package/scripts/vector-store.js
CHANGED
|
@@ -85,9 +85,42 @@ function finalizeEmbedding(vector, options = {}) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
|
|
88
|
+
let _explicitVectorStoreEngine = null;
|
|
89
|
+
|
|
90
|
+
function resolveVectorBackend(env = process.env) {
|
|
91
|
+
if (_explicitVectorStoreEngine) return _explicitVectorStoreEngine;
|
|
92
|
+
const explicit = String(env.THUMBGATE_VECTOR_BACKEND || '').trim().toLowerCase();
|
|
93
|
+
if (explicit === 'hotdata') return 'hotdata';
|
|
94
|
+
if (explicit === 'lancedb') return 'lancedb';
|
|
95
|
+
if (env.HOTDATA_API_KEY && env.HOTDATA_WORKSPACE_ID && env.HOTDATA_DATABASE_ID) return 'hotdata';
|
|
96
|
+
return 'lancedb';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function getVectorStoreEngine() {
|
|
100
|
+
return _explicitVectorStoreEngine || resolveVectorBackend();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function setVectorStoreEngine(engine) {
|
|
104
|
+
_explicitVectorStoreEngine = engine;
|
|
105
|
+
if (engine) {
|
|
106
|
+
process.env.THUMBGATE_VECTOR_BACKEND = engine;
|
|
107
|
+
} else {
|
|
108
|
+
delete process.env.THUMBGATE_VECTOR_BACKEND;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
88
112
|
async function getLanceDB() {
|
|
113
|
+
if (_lancedbLoader) {
|
|
114
|
+
if (!_lancedb) _lancedb = await _lancedbLoader();
|
|
115
|
+
return _lancedb;
|
|
116
|
+
}
|
|
117
|
+
if (resolveVectorBackend() === 'hotdata') {
|
|
118
|
+
const hotdataModPath = path.join(__dirname, '..', 'adapters', 'hotdata', 'hotdata-vector-store');
|
|
119
|
+
const { createHotdataLanceAdapter } = require(hotdataModPath);
|
|
120
|
+
return createHotdataLanceAdapter();
|
|
121
|
+
}
|
|
89
122
|
if (!_lancedb) {
|
|
90
|
-
_lancedb =
|
|
123
|
+
_lancedb = await import('@lancedb/lancedb');
|
|
91
124
|
}
|
|
92
125
|
return _lancedb;
|
|
93
126
|
}
|
|
@@ -97,7 +130,8 @@ function getFeedbackDir() {
|
|
|
97
130
|
}
|
|
98
131
|
|
|
99
132
|
function getLanceDir() {
|
|
100
|
-
|
|
133
|
+
const subdir = resolveVectorBackend() === 'hotdata' ? 'hotdata' : 'lancedb';
|
|
134
|
+
return path.join(getFeedbackDir(), subdir);
|
|
101
135
|
}
|
|
102
136
|
|
|
103
137
|
|
|
@@ -768,6 +802,8 @@ async function upsertFeedback(feedbackEvent) {
|
|
|
768
802
|
await db.createTable(TABLE_NAME, [record]);
|
|
769
803
|
}
|
|
770
804
|
});
|
|
805
|
+
|
|
806
|
+
return { ok: true, store: resolveVectorBackend(), id: feedbackEvent.id };
|
|
771
807
|
}
|
|
772
808
|
|
|
773
809
|
async function searchSimilar(queryText, limit = 5) {
|
|
@@ -846,5 +882,8 @@ module.exports = {
|
|
|
846
882
|
l2NormalizeVector,
|
|
847
883
|
resolveOutputDimensionality,
|
|
848
884
|
applyMatryoshkaDimensionality,
|
|
885
|
+
resolveVectorBackend,
|
|
886
|
+
getVectorStoreEngine,
|
|
887
|
+
setVectorStoreEngine,
|
|
849
888
|
finalizeEmbedding,
|
|
850
889
|
};
|