thumbgate 1.27.17 → 1.27.18
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/.claude-plugin/marketplace.json +85 -0
- package/.claude-plugin/plugin.json +3 -4
- package/.well-known/llms.txt +12 -33
- package/.well-known/mcp/server-card.json +8 -8
- package/README.md +30 -221
- package/adapters/chatgpt/openapi.yaml +1695 -0
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/gemini/function-declarations.json +0 -1
- package/adapters/mcp/server-stdio.js +11 -263
- package/adapters/opencode/opencode.json +1 -1
- package/bench/thumbgate-bench.json +2 -2
- package/bin/cli.js +122 -1421
- package/bin/postinstall.js +27 -11
- package/config/gate-templates.json +0 -216
- package/config/gates/claim-verification.json +0 -12
- package/config/gates/default.json +2 -31
- package/config/github-about.json +2 -2
- package/config/mcp-allowlists.json +13 -23
- package/config/merge-quality-checks.json +1 -0
- package/config/model-candidates.json +6 -121
- package/openapi/openapi.yaml +0 -12
- package/package.json +99 -229
- package/public/blog.html +4 -4
- package/public/codex-plugin.html +20 -72
- package/public/compare.html +8 -31
- package/public/dashboard.html +166 -930
- package/public/federal.html +2 -2
- package/public/guide.html +9 -33
- package/public/index.html +116 -495
- package/public/learn.html +18 -191
- package/public/lessons.html +10 -168
- package/public/numbers.html +7 -7
- package/public/pro.html +11 -34
- package/scripts/agent-memory-lifecycle.js +0 -211
- package/scripts/agent-readiness.js +3 -167
- package/scripts/agent-reward-model.js +1 -53
- package/scripts/auto-promote-gates.js +10 -82
- package/scripts/auto-wire-hooks.js +0 -14
- package/scripts/billing.js +1 -93
- package/scripts/build-metadata.js +10 -50
- package/scripts/cli-feedback.js +6 -18
- package/scripts/cli-schema.js +0 -90
- package/scripts/cli-telemetry.js +1 -6
- package/scripts/commercial-offer.js +2 -82
- package/scripts/context-manager.js +6 -74
- package/scripts/dashboard.js +2 -68
- package/scripts/durability/step.js +3 -3
- package/scripts/export-databricks-bundle.js +1 -5
- package/scripts/export-dpo-pairs.js +2 -7
- package/scripts/feedback-loop.js +1 -145
- package/scripts/feedback-quality.js +0 -87
- package/scripts/filesystem-search.js +10 -35
- package/scripts/gate-stats.js +0 -89
- package/scripts/gates-engine.js +85 -1105
- package/scripts/gemini-embedding-policy.js +1 -2
- package/scripts/hook-runtime.js +14 -20
- package/scripts/hook-thumbgate-cache-updater.js +2 -18
- package/scripts/hybrid-feedback-context.js +7 -142
- package/scripts/lesson-inference.js +3 -8
- package/scripts/lesson-search.js +1 -17
- package/scripts/license.js +1 -0
- package/scripts/llm-client.js +9 -390
- package/scripts/local-model-profile.js +8 -15
- package/scripts/memory-scope-readiness.js +0 -159
- package/scripts/meta-agent-loop.js +0 -36
- package/scripts/operational-integrity.js +5 -39
- package/scripts/oss-pr-opportunity-scout.js +5 -35
- package/scripts/plausible-server-events.js +6 -9
- package/scripts/pro-local-dashboard.js +4 -4
- package/scripts/proxy-pointer-rag-guardrails.js +1 -42
- package/scripts/rate-limiter.js +13 -64
- package/scripts/secret-scanner.js +5 -44
- package/scripts/security-scanner.js +10 -260
- package/scripts/self-distill-agent.js +1 -3
- package/scripts/seo-gsd.js +2 -916
- package/scripts/statusline-cache-path.js +2 -17
- package/scripts/statusline-local-stats.js +1 -9
- package/scripts/statusline-meta.js +2 -28
- package/scripts/statusline.sh +4 -20
- package/scripts/telemetry-analytics.js +0 -357
- package/scripts/thompson-sampling.js +10 -31
- package/scripts/thumbgate-bench.js +1 -16
- package/scripts/thumbgate-search.js +19 -85
- package/scripts/tool-registry.js +1 -169
- package/scripts/vector-store.js +0 -45
- package/scripts/workflow-sentinel.js +53 -286
- package/scripts/workspace-evolver.js +2 -62
- package/src/api/server.js +290 -2578
- package/.claude/commands/dashboard.md +0 -15
- package/.claude/commands/thumbgate-blocked.md +0 -27
- package/.claude/commands/thumbgate-dashboard.md +0 -15
- package/.claude/commands/thumbgate-doctor.md +0 -30
- package/.claude/commands/thumbgate-guard.md +0 -36
- package/.claude/commands/thumbgate-protect.md +0 -30
- package/.claude/commands/thumbgate-rules.md +0 -30
- package/.well-known/agentic-verify.txt +0 -1
- package/adapters/gcp/dfcx-webhook-gate.js +0 -295
- package/adapters/letta/README.md +0 -41
- package/adapters/letta/thumbgate-letta-adapter.js +0 -133
- package/adapters/policy-engine/ethicore-guardian-client.js +0 -68
- package/adapters/policy-engine/thumbgate-policy-engine-adapter.js +0 -260
- package/bench/observability-eval-suite.json +0 -26
- package/bin/dashboard-cli.js +0 -7
- package/commands/dashboard.md +0 -15
- package/commands/thumbgate-dashboard.md +0 -15
- package/config/builtin-lessons.json +0 -23
- package/config/gate-classifier-routing.json +0 -98
- package/config/post-deploy-marketing-pages.json +0 -61
- package/public/about.html +0 -162
- package/public/agent-manager.html +0 -179
- package/public/agents-cost-savings.html +0 -153
- package/public/ai-malpractice-prevention.html +0 -818
- package/public/assets/brand/github-social-preview.png +0 -0
- package/public/assets/brand/thumbgate-icon-512.png +0 -0
- package/public/assets/brand/thumbgate-icon-pro-512.png +0 -0
- package/public/assets/brand/thumbgate-icon-team-512.png +0 -0
- package/public/assets/brand/thumbgate-logo-1200x360.png +0 -0
- package/public/assets/brand/thumbgate-logo-transparent.svg +0 -22
- package/public/assets/brand/thumbgate-mark-inline-v3.svg +0 -19
- package/public/assets/brand/thumbgate-mark-pro.svg +0 -23
- package/public/assets/brand/thumbgate-mark-team.svg +0 -26
- package/public/assets/brand/thumbgate-mark.svg +0 -21
- package/public/assets/brand/thumbgate-wordmark.svg +0 -20
- package/public/assets/claude-thumbgate-statusbar.svg +0 -8
- package/public/assets/codex-thumbgate-statusbar-test.svg +0 -9
- package/public/assets/legal-intake-control-flow.svg +0 -66
- package/public/brand/thumbgate-mark.svg +0 -19
- package/public/brand/thumbgate-og.svg +0 -16
- package/public/chatgpt-app.html +0 -330
- package/public/codex-enterprise.html +0 -123
- package/public/js/buyer-intent.js +0 -672
- package/public/pricing.html +0 -399
- package/scripts/action-receipts.js +0 -324
- package/scripts/activation-quickstart.js +0 -187
- package/scripts/agent-operations-planner.js +0 -621
- package/scripts/ai-component-inventory.js +0 -367
- package/scripts/async-eval-observability.js +0 -236
- package/scripts/audit.js +0 -65
- package/scripts/aws-blocks-guardrails.js +0 -228
- package/scripts/classifier-routing.js +0 -130
- package/scripts/dashboard-chat.js +0 -332
- package/scripts/feedback-aggregate.js +0 -281
- package/scripts/feedback-sanitizer.js +0 -105
- package/scripts/hob-pack.js +0 -591
- package/scripts/hook-stop-anti-claim.js +0 -301
- package/scripts/install-shim.js +0 -87
- package/scripts/mcp-oauth.js +0 -293
- package/scripts/noop-detect.js +0 -285
- package/scripts/omlx-smoke.js +0 -192
- package/scripts/parallel-workflow-orchestrator.js +0 -293
- package/scripts/plan-gate.js +0 -243
- package/scripts/plausible-domain-config.js +0 -99
- package/scripts/qa-scenario-planner.js +0 -136
- package/scripts/repeat-metric.js +0 -137
- package/scripts/secret-fixture-tokens.js +0 -61
- package/scripts/secret-redaction.js +0 -166
- package/scripts/self-harness-optimizer.js +0 -141
- package/scripts/self-healing-check.js +0 -193
- package/scripts/silent-failure-cluster.js +0 -531
- package/scripts/statusline-cache-read.js +0 -57
- package/scripts/sync-telemetry-from-prod.js +0 -374
- package/scripts/tool-contract-validator.js +0 -76
- package/scripts/trajectory-scorer.js +0 -63
- package/scripts/verify-marketing-pages-deployed.js +0 -195
- package/scripts/visitor-journey.js +0 -172
package/scripts/cli-schema.js
CHANGED
|
@@ -51,20 +51,6 @@ const CLI_COMMANDS = [
|
|
|
51
51
|
{ name: 'json', type: 'boolean', description: 'Output as JSON' },
|
|
52
52
|
],
|
|
53
53
|
},
|
|
54
|
-
{
|
|
55
|
-
name: 'feedback-self-test',
|
|
56
|
-
aliases: ['dogfood'],
|
|
57
|
-
description: 'Prove thumbs feedback capture works in the current runtime',
|
|
58
|
-
group: 'capture',
|
|
59
|
-
mcpTool: 'capture_feedback',
|
|
60
|
-
flags: [
|
|
61
|
-
{ name: 'feedback', type: 'string', description: 'Signal to test: up or down (default down)' },
|
|
62
|
-
{ name: 'context', type: 'string', description: 'Context to store in the test capture' },
|
|
63
|
-
{ name: 'persist', type: 'boolean', description: 'Use the active ThumbGate store instead of an isolated test store' },
|
|
64
|
-
{ name: 'feedback-dir', type: 'string', description: 'Explicit feedback directory for the self-test' },
|
|
65
|
-
{ name: 'json', type: 'boolean', description: 'Output as JSON' },
|
|
66
|
-
],
|
|
67
|
-
},
|
|
68
54
|
|
|
69
55
|
// -------------------------------------------------------------------------
|
|
70
56
|
// Discovery
|
|
@@ -94,25 +80,6 @@ const CLI_COMMANDS = [
|
|
|
94
80
|
{ name: 'remote', type: 'boolean', description: 'Fetch from hosted Railway instance' },
|
|
95
81
|
],
|
|
96
82
|
},
|
|
97
|
-
{
|
|
98
|
-
name: 'brain',
|
|
99
|
-
aliases: ['customer-brain', 'repo-brain'],
|
|
100
|
-
description: 'Scaffold, query, or build the governed customer/repo context brain',
|
|
101
|
-
group: 'discovery',
|
|
102
|
-
flags: [
|
|
103
|
-
{ name: 'json', type: 'boolean', description: 'Output as JSON' },
|
|
104
|
-
{ name: 'task', type: 'string', description: 'Task description for routed context loading' },
|
|
105
|
-
{ name: 'type', type: 'string', description: 'Memory type for remember: decision | pattern | feedback | log' },
|
|
106
|
-
{ name: 'title', type: 'string', description: 'Title for a sourced memory entry' },
|
|
107
|
-
{ name: 'content', type: 'string', description: 'Body for a sourced memory entry' },
|
|
108
|
-
{ name: 'source', type: 'string', description: 'Required provenance for factual memory writes' },
|
|
109
|
-
{ name: 'tags', type: 'string', description: 'Comma-separated memory tags' },
|
|
110
|
-
{ name: 'text', type: 'string', description: 'Text/action to check against never-do rules' },
|
|
111
|
-
{ name: 'stale-days', type: 'number', description: 'Age threshold for cleanup report (default 60)' },
|
|
112
|
-
{ name: 'write', type: 'boolean', description: 'Save to .thumbgate/BRAIN.md (versioned, deterministic)' },
|
|
113
|
-
{ name: 'limit', type: 'number', description: 'Max lessons to include (default 15)' },
|
|
114
|
-
],
|
|
115
|
-
},
|
|
116
83
|
{
|
|
117
84
|
name: 'stats',
|
|
118
85
|
description: 'Feedback analytics — approval rate, Revenue-at-Risk, recent trend',
|
|
@@ -370,19 +337,6 @@ const CLI_COMMANDS = [
|
|
|
370
337
|
{ name: 'high-risk-workflows', type: 'string', description: 'Comma-separated workflows touching money, prod, secrets, data, or publishing' },
|
|
371
338
|
],
|
|
372
339
|
}),
|
|
373
|
-
discoveryCommand({
|
|
374
|
-
name: 'ai-inventory',
|
|
375
|
-
aliases: ['ai-component-inventory', 'ml-bom', 'mlbom'],
|
|
376
|
-
description: 'Scan AI/ML components and export enterprise ML-BOM evidence',
|
|
377
|
-
mcpTool: 'ai_component_inventory',
|
|
378
|
-
flags: [
|
|
379
|
-
jsonFlag(),
|
|
380
|
-
{ name: 'root', type: 'string', description: 'Project root to scan' },
|
|
381
|
-
{ name: 'format', type: 'string', description: 'summary, json, or cyclonedx' },
|
|
382
|
-
{ name: 'output', type: 'string', description: 'Write evidence to this path' },
|
|
383
|
-
{ name: 'max-files', type: 'number', description: 'Maximum files to scan' },
|
|
384
|
-
],
|
|
385
|
-
}),
|
|
386
340
|
discoveryCommand({
|
|
387
341
|
name: 'long-running-agent-context-guardrails',
|
|
388
342
|
aliases: ['agent-context-guardrails', 'slack-context-guardrails'],
|
|
@@ -505,12 +459,6 @@ const CLI_COMMANDS = [
|
|
|
505
459
|
group: 'gates',
|
|
506
460
|
flags: [],
|
|
507
461
|
},
|
|
508
|
-
{
|
|
509
|
-
name: 'hermes-gate',
|
|
510
|
-
description: 'Hermes Agent pre_tool_call hook: gate runtime tool calls (incl. skill_manage) before they run',
|
|
511
|
-
group: 'gates',
|
|
512
|
-
flags: [],
|
|
513
|
-
},
|
|
514
462
|
{
|
|
515
463
|
name: 'force-gate',
|
|
516
464
|
description: 'Immediately create a blocking gate from a pattern string',
|
|
@@ -577,14 +525,6 @@ const CLI_COMMANDS = [
|
|
|
577
525
|
{ name: 'json', type: 'boolean', description: 'Output as JSON' },
|
|
578
526
|
],
|
|
579
527
|
},
|
|
580
|
-
{
|
|
581
|
-
name: 'audit',
|
|
582
|
-
description: 'Audit an agent transcript for repeat-mistake patterns and estimated token waste',
|
|
583
|
-
group: 'ops',
|
|
584
|
-
flags: [
|
|
585
|
-
{ name: 'file', type: 'string', description: 'Path to the agent transcript to audit' },
|
|
586
|
-
],
|
|
587
|
-
},
|
|
588
528
|
{
|
|
589
529
|
name: 'init',
|
|
590
530
|
description: 'Scaffold .thumbgate/ config and wire agent hooks',
|
|
@@ -642,36 +582,6 @@ const CLI_COMMANDS = [
|
|
|
642
582
|
{ name: 'info', type: 'boolean', description: 'Show Pro feature list' },
|
|
643
583
|
],
|
|
644
584
|
},
|
|
645
|
-
|
|
646
|
-
{
|
|
647
|
-
name: 'workflow',
|
|
648
|
-
aliases: ['swarm'],
|
|
649
|
-
description: 'Execute a dynamic parallel workflow for security audit, benchmarking, or exploration',
|
|
650
|
-
group: 'ops',
|
|
651
|
-
mcpTool: 'parallel_workflow',
|
|
652
|
-
flags: [
|
|
653
|
-
{ name: 'objective', type: 'string', required: true, description: 'The objective to plan and execute (e.g. security audit, performance benchmark)' },
|
|
654
|
-
{ name: 'concurrency', type: 'number', description: 'Maximum parallel subtasks (default 3)' },
|
|
655
|
-
{ name: 'timeoutMs', type: 'number', description: 'Timeout in milliseconds (default 60000)' },
|
|
656
|
-
{ name: 'json', type: 'boolean', description: 'Output results as JSON' },
|
|
657
|
-
],
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
name: 'check-update',
|
|
661
|
-
aliases: ['upgrade-check'],
|
|
662
|
-
description: 'Check for newer versions of ThumbGate from npm or GitHub',
|
|
663
|
-
group: 'ops',
|
|
664
|
-
flags: [
|
|
665
|
-
{ name: 'json', type: 'boolean', description: 'Output results as JSON' },
|
|
666
|
-
],
|
|
667
|
-
},
|
|
668
|
-
{
|
|
669
|
-
name: 'self-update',
|
|
670
|
-
aliases: ['upgrade-cli'],
|
|
671
|
-
description: 'Automatically install the latest version of ThumbGate globally',
|
|
672
|
-
group: 'ops',
|
|
673
|
-
flags: [],
|
|
674
|
-
},
|
|
675
585
|
];
|
|
676
586
|
|
|
677
587
|
/**
|
package/scripts/cli-telemetry.js
CHANGED
|
@@ -10,9 +10,6 @@ const _DEFAULT_TELEMETRY_HOST = 'https://thumbgate-production.up.railway.app';
|
|
|
10
10
|
const TELEMETRY_ENDPOINT = `${process.env.THUMBGATE_API_URL || _DEFAULT_TELEMETRY_HOST}/v1/telemetry/ping`;
|
|
11
11
|
const INSTALL_ID_PATH = path.join(process.env.HOME || process.env.USERPROFILE || '.', '.thumbgate', 'install-id');
|
|
12
12
|
|
|
13
|
-
// Session ID: random per process invocation. Groups all events from one CLI run.
|
|
14
|
-
const SESSION_ID = crypto.randomUUID ? crypto.randomUUID() : crypto.randomBytes(16).toString('hex');
|
|
15
|
-
|
|
16
13
|
/**
|
|
17
14
|
* Get or create a stable anonymous install ID.
|
|
18
15
|
* This is NOT tied to any personal info — it's a random UUID stored locally.
|
|
@@ -64,9 +61,7 @@ function trackEvent(eventType, metadata = {}) {
|
|
|
64
61
|
const payload = JSON.stringify({
|
|
65
62
|
eventType,
|
|
66
63
|
installId: getInstallId(),
|
|
67
|
-
sessionId: SESSION_ID,
|
|
68
64
|
visitorType: classifyInstall(),
|
|
69
|
-
clientType: 'cli',
|
|
70
65
|
platform: os.platform(),
|
|
71
66
|
arch: os.arch(),
|
|
72
67
|
nodeVersion: process.version,
|
|
@@ -92,4 +87,4 @@ function trackEvent(eventType, metadata = {}) {
|
|
|
92
87
|
} catch (_) {} // never crash the CLI
|
|
93
88
|
}
|
|
94
89
|
|
|
95
|
-
module.exports = { trackEvent, getInstallId, classifyInstall, INSTALL_ID_PATH
|
|
90
|
+
module.exports = { trackEvent, getInstallId, classifyInstall, INSTALL_ID_PATH };
|
|
@@ -14,12 +14,7 @@ const TEAM_ANNUAL_PRICE_DOLLARS = 588;
|
|
|
14
14
|
const TEAM_MIN_SEATS = 3;
|
|
15
15
|
|
|
16
16
|
const PRO_PRICE_LABEL = '$19/mo or $149/yr (individual)';
|
|
17
|
-
|
|
18
|
-
// regulated-industry lane). Pricing is scoped after intake — no self-serve seat
|
|
19
|
-
// price is surfaced. The dormant TEAM_* Stripe constants below remain only as
|
|
20
|
-
// inert billing plumbing pending a dedicated cleanup; they are no longer a
|
|
21
|
-
// customer-facing tier.
|
|
22
|
-
const ENTERPRISE_PRICE_LABEL = 'Custom pricing, scoped after intake — Enterprise agent governance';
|
|
17
|
+
const TEAM_PRICE_LABEL = '$49/seat/mo — Agent governance for engineering teams';
|
|
23
18
|
|
|
24
19
|
function normalizePlanId(value) {
|
|
25
20
|
const text = String(value || '').trim().toLowerCase();
|
|
@@ -40,78 +35,6 @@ function normalizeSeatCount(value, fallback = TEAM_MIN_SEATS) {
|
|
|
40
35
|
return Math.max(TEAM_MIN_SEATS, Math.round(parsed));
|
|
41
36
|
}
|
|
42
37
|
|
|
43
|
-
function trackedProUrl(source = 'cli_receipt', content = 'value_receipt') {
|
|
44
|
-
try {
|
|
45
|
-
const url = new URL(PRO_MONTHLY_PAYMENT_LINK);
|
|
46
|
-
url.searchParams.set('utm_source', source);
|
|
47
|
-
url.searchParams.set('utm_medium', 'cli');
|
|
48
|
-
url.searchParams.set('utm_campaign', 'pro_conversion');
|
|
49
|
-
url.searchParams.set('utm_content', content);
|
|
50
|
-
return url.toString();
|
|
51
|
-
} catch (_) {
|
|
52
|
-
return PRO_MONTHLY_PAYMENT_LINK;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function pluralize(count, singular, plural = `${singular}s`) {
|
|
57
|
-
return Number(count) === 1 ? singular : plural;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function buildCaptureReceipt({ signal, feedbackId, memoryId, actionType } = {}) {
|
|
61
|
-
const normalizedSignal = String(signal || '').toUpperCase() || 'UNKNOWN';
|
|
62
|
-
const lines = [
|
|
63
|
-
'',
|
|
64
|
-
'Value receipt',
|
|
65
|
-
'─'.repeat(50),
|
|
66
|
-
` Stored proof : ${normalizedSignal} feedback${feedbackId ? ` (${feedbackId})` : ''}`,
|
|
67
|
-
memoryId ? ` Local memory : ${memoryId}` : ' Local memory : saved locally',
|
|
68
|
-
actionType ? ` Rule pressure : ${actionType}` : ' Rule pressure : available for promotion',
|
|
69
|
-
' Free today : this proof protects this local machine',
|
|
70
|
-
' Pro sync : keep this lesson, rule, and dashboard synced across machines and agent runtimes',
|
|
71
|
-
' Next proof : npx thumbgate stats',
|
|
72
|
-
' Cost proof : npx thumbgate cost',
|
|
73
|
-
'',
|
|
74
|
-
` Solo Pro : ${PRO_PRICE_LABEL} for hosted sync, search, dashboard, and exports`,
|
|
75
|
-
` Upgrade : ${trackedProUrl('cli_capture_receipt', actionType || normalizedSignal.toLowerCase())}`,
|
|
76
|
-
` Enterprise : ${ENTERPRISE_PRICE_LABEL}; start with one repeated workflow failure`,
|
|
77
|
-
' https://thumbgate.ai/#workflow-sprint-intake',
|
|
78
|
-
'',
|
|
79
|
-
];
|
|
80
|
-
return lines.join('\n');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function buildStatsReceipt(stats = {}) {
|
|
84
|
-
const negatives = Number(stats.negatives || stats.totalNegative || 0);
|
|
85
|
-
const blocked = Number(stats.gatesBlocked || stats.blocked || 0);
|
|
86
|
-
const warned = Number(stats.gatesWarned || stats.warned || 0);
|
|
87
|
-
const gates = Number(stats.totalGates || 0);
|
|
88
|
-
const autoPromoted = Number(stats.autoPromotedGates || 0);
|
|
89
|
-
const hasFriction = negatives > 0 || blocked > 0 || warned > 0 || gates > 0;
|
|
90
|
-
if (!hasFriction) return '';
|
|
91
|
-
|
|
92
|
-
const interventions = blocked + warned;
|
|
93
|
-
const lines = [
|
|
94
|
-
'',
|
|
95
|
-
'Paid-intent next step',
|
|
96
|
-
'─'.repeat(50),
|
|
97
|
-
];
|
|
98
|
-
if (interventions > 0) {
|
|
99
|
-
lines.push(` Proof already seen : ${interventions} gate ${pluralize(interventions, 'intervention')}`);
|
|
100
|
-
}
|
|
101
|
-
if (gates > 0) {
|
|
102
|
-
lines.push(` Active prevention : ${gates} ${pluralize(gates, 'gate')} (${autoPromoted} auto-promoted)`);
|
|
103
|
-
}
|
|
104
|
-
if (negatives > 0) {
|
|
105
|
-
lines.push(` Failure pressure : ${negatives} negative ${pluralize(negatives, 'signal')}`);
|
|
106
|
-
}
|
|
107
|
-
lines.push(' Show the buyer : npx thumbgate cost');
|
|
108
|
-
lines.push(' Pro sync value : keep these lessons/rules visible across laptops, CI, containers, and agent runtimes');
|
|
109
|
-
lines.push(` Solo Pro : ${trackedProUrl('cli_stats_receipt', 'proof_seen')}`);
|
|
110
|
-
lines.push(' Enterprise : https://thumbgate.ai/#workflow-sprint-intake');
|
|
111
|
-
lines.push('');
|
|
112
|
-
return lines.join('\n');
|
|
113
|
-
}
|
|
114
|
-
|
|
115
38
|
module.exports = {
|
|
116
39
|
PRO_MONTHLY_PAYMENT_LINK,
|
|
117
40
|
PRO_ANNUAL_PAYMENT_LINK,
|
|
@@ -124,11 +47,8 @@ module.exports = {
|
|
|
124
47
|
TEAM_ANNUAL_PRICE_DOLLARS,
|
|
125
48
|
TEAM_MIN_SEATS,
|
|
126
49
|
PRO_PRICE_LABEL,
|
|
127
|
-
|
|
50
|
+
TEAM_PRICE_LABEL,
|
|
128
51
|
normalizePlanId,
|
|
129
52
|
normalizeBillingCycle,
|
|
130
53
|
normalizeSeatCount,
|
|
131
|
-
buildCaptureReceipt,
|
|
132
|
-
buildStatsReceipt,
|
|
133
|
-
trackedProUrl,
|
|
134
54
|
};
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
5
|
* Context Manager — Unified Context-Augmented Generation (CAG) Orchestrator
|
|
9
6
|
*
|
|
@@ -30,9 +27,8 @@ const {
|
|
|
30
27
|
recordProvenance,
|
|
31
28
|
} = require('./contextfs');
|
|
32
29
|
const { loadOptionalModule } = require('./private-core-boundary');
|
|
33
|
-
const { retrieveRelevantLessons
|
|
30
|
+
const { retrieveRelevantLessons } = loadOptionalModule('./lesson-retrieval', () => ({
|
|
34
31
|
retrieveRelevantLessons: () => [],
|
|
35
|
-
calculateRetrievalEntropy: () => 0,
|
|
36
32
|
}));
|
|
37
33
|
const { evaluatePretool } = require('./hybrid-feedback-context');
|
|
38
34
|
const { loadProfile } = require('./user-profile');
|
|
@@ -97,21 +93,13 @@ function assembleSession() {
|
|
|
97
93
|
|
|
98
94
|
function assembleLessons(query, agentProfile, options = {}) {
|
|
99
95
|
try {
|
|
100
|
-
|
|
96
|
+
return retrieveRelevantLessons(
|
|
101
97
|
options.toolName || '',
|
|
102
98
|
query,
|
|
103
99
|
{ maxResults: agentProfile.maxLessons, feedbackDir: options.feedbackDir },
|
|
104
100
|
);
|
|
105
|
-
|
|
106
|
-
const entropy = calculateRetrievalEntropy(lessons);
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
items: lessons,
|
|
110
|
-
entropy,
|
|
111
|
-
highConflict: entropy > 0.7
|
|
112
|
-
};
|
|
113
101
|
} catch {
|
|
114
|
-
return
|
|
102
|
+
return [];
|
|
115
103
|
}
|
|
116
104
|
}
|
|
117
105
|
|
|
@@ -123,41 +111,13 @@ function assembleGuards(toolName, toolInput) {
|
|
|
123
111
|
}
|
|
124
112
|
}
|
|
125
113
|
|
|
126
|
-
function assembleContextPack(query, agentProfile
|
|
127
|
-
const { guards } = options;
|
|
114
|
+
function assembleContextPack(query, agentProfile) {
|
|
128
115
|
try {
|
|
129
116
|
ensureContextFs();
|
|
130
|
-
|
|
131
|
-
// 1. Proactive Governance: Filter what the agent sees based on prevention rules
|
|
132
|
-
let structuredQuery = query;
|
|
133
|
-
if (guards && guards.mode === 'block') {
|
|
134
|
-
structuredQuery = `${query} (Active Block Policy: ${guards.reason})`;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// 2. Elevate Thompson Sampling to Architecture Level
|
|
138
|
-
let strategy = null;
|
|
139
|
-
try {
|
|
140
|
-
const ts = require('./thompson-sampling');
|
|
141
|
-
const model = ts.loadModel();
|
|
142
|
-
const bestCategory = ts.argmaxPosteriors(model);
|
|
143
|
-
|
|
144
|
-
// Route between context-building strategies based on TS posterior mean
|
|
145
|
-
if (bestCategory === 'architecture' || bestCategory === 'infra') {
|
|
146
|
-
strategy = 'hierarchical';
|
|
147
|
-
} else if (bestCategory === 'observability' || bestCategory === 'debugging') {
|
|
148
|
-
strategy = 'summarize-then-expand';
|
|
149
|
-
} else {
|
|
150
|
-
strategy = 'semantic';
|
|
151
|
-
}
|
|
152
|
-
} catch (e) {
|
|
153
|
-
// Fallback to default routing
|
|
154
|
-
}
|
|
155
|
-
|
|
156
117
|
return constructContextPack({
|
|
157
|
-
query
|
|
118
|
+
query,
|
|
158
119
|
maxItems: Math.min(8, Math.ceil(agentProfile.contextBudget / 1000)),
|
|
159
120
|
maxChars: agentProfile.contextBudget,
|
|
160
|
-
strategy
|
|
161
121
|
});
|
|
162
122
|
} catch {
|
|
163
123
|
return null;
|
|
@@ -236,8 +196,7 @@ function assembleUnifiedContext(params = {}) {
|
|
|
236
196
|
// Assemble all components — each is fault-tolerant
|
|
237
197
|
const session = assembleSession();
|
|
238
198
|
const userProfile = assembleUserProfile();
|
|
239
|
-
const
|
|
240
|
-
const lessons = lessonData.items;
|
|
199
|
+
const lessons = assembleLessons(query, agentProfile, { toolName, feedbackDir });
|
|
241
200
|
const guards = assembleGuards(toolName, toolInput);
|
|
242
201
|
const contextPack = assembleContextPack(query, agentProfile);
|
|
243
202
|
const codeGraph = assembleCodeGraph(query, repoPath, agentProfile);
|
|
@@ -245,24 +204,9 @@ function assembleUnifiedContext(params = {}) {
|
|
|
245
204
|
const components = { session, userProfile, lessons, guards, contextPack, codeGraph };
|
|
246
205
|
const tier = classifyTier(components);
|
|
247
206
|
|
|
248
|
-
// v4.2: Entropy-Aware Reliability Directive
|
|
249
|
-
let reliabilityDirective = null;
|
|
250
|
-
if (lessonData.highConflict) {
|
|
251
|
-
reliabilityDirective = 'CAUTION: Conflicting past patterns detected for this action. Prioritize absolute ground truth verification over rapid completion.';
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// v1.26.0: CodeRabbit Planning Directive
|
|
255
|
-
const planPath = path.join(repoPath || process.cwd(), 'PLAN.md');
|
|
256
|
-
if (!fs.existsSync(planPath) && ['Bash', 'Write', 'Edit', 'Deploy'].includes(toolName)) {
|
|
257
|
-
const planReminder = 'ORCHESTRATION: High-risk action detected without a PLAN.md. Please document your intent, assumptions, and verification steps before proceeding.';
|
|
258
|
-
reliabilityDirective = reliabilityDirective ? `${reliabilityDirective}\n\n${planReminder}` : planReminder;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
207
|
const result = {
|
|
262
208
|
tier,
|
|
263
209
|
agentType: agentType || 'default',
|
|
264
|
-
reliabilityDirective,
|
|
265
|
-
entropy: lessonData.entropy,
|
|
266
210
|
agentProfile: {
|
|
267
211
|
maxLessons: agentProfile.maxLessons,
|
|
268
212
|
contextBudget: agentProfile.contextBudget,
|
|
@@ -284,12 +228,6 @@ function assembleUnifiedContext(params = {}) {
|
|
|
284
228
|
})),
|
|
285
229
|
visibility: contextPack.visibility || null,
|
|
286
230
|
cached: !!(contextPack.cache && contextPack.cache.hit),
|
|
287
|
-
layers: {
|
|
288
|
-
localState: session || null,
|
|
289
|
-
graphState: codeGraph || null,
|
|
290
|
-
policyState: guards || null,
|
|
291
|
-
sessionState: contextPack.items ? contextPack.items.filter(i => i.namespace === 'session') : []
|
|
292
|
-
}
|
|
293
231
|
} : null,
|
|
294
232
|
codeGraph: codeGraph || null,
|
|
295
233
|
assembledAt: new Date().toISOString(),
|
|
@@ -368,12 +306,6 @@ function formatUnifiedContext(ctx) {
|
|
|
368
306
|
|
|
369
307
|
// Context pack
|
|
370
308
|
if (ctx.contextPack) {
|
|
371
|
-
lines.push(`### Context Architecture Layers`);
|
|
372
|
-
lines.push(`- Local State: ${ctx.contextPack.layers.localState ? 'Active' : 'Empty'}`);
|
|
373
|
-
lines.push(`- Graph State: ${ctx.contextPack.layers.graphState ? 'Active' : 'Empty'}`);
|
|
374
|
-
lines.push(`- Policy State: ${ctx.contextPack.layers.policyState ? ctx.contextPack.layers.policyState.mode : 'Empty'}`);
|
|
375
|
-
lines.push(`- Session State: ${ctx.contextPack.layers.sessionState.length} items`);
|
|
376
|
-
lines.push('');
|
|
377
309
|
lines.push(`### Context Pack (${ctx.contextPack.itemCount} items)`);
|
|
378
310
|
ctx.contextPack.items.forEach((item) => {
|
|
379
311
|
lines.push(`- [${item.namespace}] ${item.title} (score: ${item.score})`);
|
package/scripts/dashboard.js
CHANGED
|
@@ -17,7 +17,6 @@ const { filterEntriesForWindow, resolveAnalyticsWindow } = require('./analytics-
|
|
|
17
17
|
const { resolveHostedBillingConfig } = require('./hosted-config');
|
|
18
18
|
const { generateAgentReadinessReport } = require('./agent-readiness');
|
|
19
19
|
const { summarizeGateTemplates } = require('./gate-templates');
|
|
20
|
-
const { mergeRepeatMetricIntoGateStats } = require('./repeat-metric');
|
|
21
20
|
const { buildPredictiveInsights } = loadOptionalModule('./predictive-insights', () => ({
|
|
22
21
|
buildPredictiveInsights: () => ({
|
|
23
22
|
upgradePropensity: {
|
|
@@ -49,10 +48,6 @@ const {
|
|
|
49
48
|
readDecisionLog,
|
|
50
49
|
} = require('./decision-journal');
|
|
51
50
|
const { analyzeFeedback } = require('./feedback-loop');
|
|
52
|
-
const {
|
|
53
|
-
collectAggregateLogEntries,
|
|
54
|
-
shouldAggregateFeedback,
|
|
55
|
-
} = require('./feedback-aggregate');
|
|
56
51
|
|
|
57
52
|
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
58
53
|
const DEFAULT_GATES_PATH = path.join(PROJECT_ROOT, 'config', 'gates', 'default.json');
|
|
@@ -972,20 +967,6 @@ function computeAnalyticsSummary(feedbackDir, options = {}) {
|
|
|
972
967
|
return {
|
|
973
968
|
window: telemetry.window || analyticsWindow,
|
|
974
969
|
telemetry,
|
|
975
|
-
firstPartyTrafficQuality: telemetry.trafficQuality || {
|
|
976
|
-
rawEvents: telemetry.totalEvents || 0,
|
|
977
|
-
externalEvents: 0,
|
|
978
|
-
excludedEvents: 0,
|
|
979
|
-
exclusionRate: 0,
|
|
980
|
-
byAudience: {},
|
|
981
|
-
byExclusionReason: {},
|
|
982
|
-
external: {
|
|
983
|
-
uniqueVisitors: 0,
|
|
984
|
-
pageViews: 0,
|
|
985
|
-
checkoutStarts: 0,
|
|
986
|
-
},
|
|
987
|
-
verdict: 'missing',
|
|
988
|
-
},
|
|
989
970
|
funnel: {
|
|
990
971
|
visitors: uniqueVisitors,
|
|
991
972
|
sessions: telemetry.visitors ? telemetry.visitors.uniqueSessions || 0 : 0,
|
|
@@ -1168,42 +1149,16 @@ function computeInstrumentationReadiness(analytics, billing) {
|
|
|
1168
1149
|
const coverage = billing && billing.coverage ? billing.coverage : {};
|
|
1169
1150
|
const telemetry = analytics.telemetry || {};
|
|
1170
1151
|
const visitors = telemetry.visitors || {};
|
|
1171
|
-
const quality = telemetry.trafficQuality || analytics.firstPartyTrafficQuality || {};
|
|
1172
|
-
const external = quality.external || {};
|
|
1173
1152
|
const cli = telemetry.cli || {};
|
|
1174
|
-
const plausibleExportConfigured = Boolean(
|
|
1175
|
-
process.env.PLAUSIBLE_API_KEY && (process.env.PLAUSIBLE_SITE_ID || process.env.PLAUSIBLE_DOMAIN)
|
|
1176
|
-
);
|
|
1177
|
-
const posthogExportConfigured = Boolean(
|
|
1178
|
-
(process.env.POSTHOG_PERSONAL_API_KEY || process.env.POSTHOG_API_KEY) && process.env.POSTHOG_PROJECT_ID
|
|
1179
|
-
);
|
|
1180
|
-
const ga4ExportConfigured = Boolean(
|
|
1181
|
-
process.env.GA4_PROPERTY_ID && (process.env.GOOGLE_APPLICATION_CREDENTIALS || process.env.GOOGLE_CLIENT_EMAIL)
|
|
1182
|
-
);
|
|
1183
|
-
const dashboardGradeExportReady = plausibleExportConfigured || posthogExportConfigured || ga4ExportConfigured;
|
|
1184
1153
|
|
|
1185
1154
|
return {
|
|
1186
|
-
plausibleConfigured: /plausible\.io\/js\/script
|
|
1155
|
+
plausibleConfigured: /plausible\.io\/js\/script\.js|\/js\/analytics\.js/.test(landingPage),
|
|
1187
1156
|
ga4Configured: Boolean(runtimeConfig.gaMeasurementId),
|
|
1188
1157
|
googleSearchConsoleConfigured: Boolean(runtimeConfig.googleSiteVerification),
|
|
1189
1158
|
softwareApplicationSchemaPresent: /"@type": "SoftwareApplication"/.test(landingPage),
|
|
1190
1159
|
faqSchemaPresent: /"@type": "FAQPage"/.test(landingPage),
|
|
1191
1160
|
telemetryEventsPresent: (telemetry.totalEvents || 0) > 0,
|
|
1192
1161
|
uniqueVisitorsTracked: visitors.uniqueVisitors || 0,
|
|
1193
|
-
rawTelemetryEvents: quality.rawEvents || telemetry.totalEvents || 0,
|
|
1194
|
-
externalTelemetryEvents: quality.externalEvents || 0,
|
|
1195
|
-
excludedTelemetryEvents: quality.excludedEvents || 0,
|
|
1196
|
-
externalVisitorsTracked: external.uniqueVisitors || 0,
|
|
1197
|
-
externalPageViewsTracked: external.pageViews || 0,
|
|
1198
|
-
externalCheckoutStartsTracked: external.checkoutStarts || 0,
|
|
1199
|
-
externalVisitorPathsTracked: Array.isArray(external.visitorPaths) ? external.visitorPaths.length : 0,
|
|
1200
|
-
internalTestPollutionRate: quality.exclusionRate || 0,
|
|
1201
|
-
trafficQualityVerdict: quality.verdict || 'missing',
|
|
1202
|
-
topExcludedTrafficReason: quality.topExclusionReason || null,
|
|
1203
|
-
plausibleExportConfigured,
|
|
1204
|
-
posthogExportConfigured,
|
|
1205
|
-
ga4ExportConfigured,
|
|
1206
|
-
dashboardGradeExportReady,
|
|
1207
1162
|
cliInstallsTracked: cli.uniqueInstalls || 0,
|
|
1208
1163
|
funnelEventsPresent: (analytics.reconciliation.telemetryCheckoutStarts || 0) > 0,
|
|
1209
1164
|
seoSignalsPresent: (analytics.seo.landingViews || 0) > 0,
|
|
@@ -1549,10 +1504,6 @@ function resolveTeamWindowHours(analyticsWindow) {
|
|
|
1549
1504
|
// ---------------------------------------------------------------------------
|
|
1550
1505
|
|
|
1551
1506
|
function collectAllFeedbackEntries(feedbackDir) {
|
|
1552
|
-
if (shouldAggregateFeedback()) {
|
|
1553
|
-
return collectAggregateLogEntries('feedback-log.jsonl', { feedbackDir }).entries;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
1507
|
const entries = [];
|
|
1557
1508
|
const seen = new Set();
|
|
1558
1509
|
|
|
@@ -1622,11 +1573,7 @@ function generateDashboard(feedbackDir, options = {}) {
|
|
|
1622
1573
|
const billingSummary = options.billingSummary || getBillingSummary(analyticsWindow);
|
|
1623
1574
|
|
|
1624
1575
|
const approval = computeApprovalStats(entries);
|
|
1625
|
-
|
|
1626
|
-
// dashboard JSON and the /v1/dashboard HTTP route. Use the non-mutating
|
|
1627
|
-
// helper (mirrors server-stdio.js) instead of mutating computeGateStats()'s
|
|
1628
|
-
// return value. (mergeRepeatMetricIntoGateStats is imported at top of file.)
|
|
1629
|
-
const gateStats = mergeRepeatMetricIntoGateStats(computeGateStats());
|
|
1576
|
+
const gateStats = computeGateStats();
|
|
1630
1577
|
const prevention = computePreventionImpact(feedbackDir, gateStats);
|
|
1631
1578
|
const trend = computeSessionTrend(entries, 10);
|
|
1632
1579
|
const health = computeSystemHealth(feedbackDir, gateStats);
|
|
@@ -1918,10 +1865,8 @@ function printDashboard(data) {
|
|
|
1918
1865
|
console.log('');
|
|
1919
1866
|
console.log('\uD83D\uDCBC Growth Analytics');
|
|
1920
1867
|
console.log(` Unique Visitors : ${analytics.trafficMetrics.visitors}`);
|
|
1921
|
-
console.log(` External Visitors: ${instrumentation.externalVisitorsTracked}`);
|
|
1922
1868
|
console.log(` Sessions : ${analytics.trafficMetrics.sessions}`);
|
|
1923
1869
|
console.log(` Page Views : ${analytics.trafficMetrics.pageViews}`);
|
|
1924
|
-
console.log(` External Views : ${instrumentation.externalPageViewsTracked}`);
|
|
1925
1870
|
console.log(` CTA Clicks : ${analytics.trafficMetrics.ctaClicks}`);
|
|
1926
1871
|
console.log(` Leads : ${analytics.funnel.acquisitionLeads}`);
|
|
1927
1872
|
console.log(` Sprint Leads : ${analytics.pipeline.workflowSprintLeads.total}`);
|
|
@@ -1932,7 +1877,6 @@ function printDashboard(data) {
|
|
|
1932
1877
|
console.log(` Booked Revenue : $${(analytics.revenue.bookedRevenueCents / 100).toFixed(2)}`);
|
|
1933
1878
|
console.log(` Matched Journeys : ${analytics.reconciliation.matchedPaidOrders}/${analytics.reconciliation.telemetryCheckoutStarts}`);
|
|
1934
1879
|
console.log(` Buyer Loss : ${analytics.buyerLoss.totalSignals}`);
|
|
1935
|
-
console.log(` Data Quality : ${analytics.firstPartyTrafficQuality.verdict} (${instrumentation.excludedTelemetryEvents}/${instrumentation.rawTelemetryEvents} excluded)`);
|
|
1936
1880
|
if (analytics.telemetry.visitors.topSource) {
|
|
1937
1881
|
console.log(` Top Source : ${analytics.telemetry.visitors.topSource.key} (${analytics.telemetry.visitors.topSource.count}\u00D7)`);
|
|
1938
1882
|
}
|
|
@@ -1952,15 +1896,6 @@ function printDashboard(data) {
|
|
|
1952
1896
|
console.log(` GA4 : ${instrumentation.ga4Configured ? 'configured' : 'missing'}`);
|
|
1953
1897
|
console.log(` Search Console : ${instrumentation.googleSearchConsoleConfigured ? 'configured' : 'missing'}`);
|
|
1954
1898
|
console.log(` Telemetry Events : ${instrumentation.telemetryEventsPresent ? instrumentation.uniqueVisitorsTracked : 0} visitors`);
|
|
1955
|
-
console.log(` Clean Visitors : ${instrumentation.externalVisitorsTracked} external (${Math.round((instrumentation.internalTestPollutionRate || 0) * 100)}% internal/test/bot events)`);
|
|
1956
|
-
console.log(` Clean Paths : ${instrumentation.externalVisitorPathsTracked} first-party paths`);
|
|
1957
|
-
if (instrumentation.topExcludedTrafficReason) {
|
|
1958
|
-
console.log(` Top Exclusion : ${instrumentation.topExcludedTrafficReason.key} (${instrumentation.topExcludedTrafficReason.count}\u00D7)`);
|
|
1959
|
-
}
|
|
1960
|
-
console.log(` Plausible Export : ${instrumentation.plausibleExportConfigured ? 'configured' : 'missing API credentials'}`);
|
|
1961
|
-
console.log(` PostHog Export : ${instrumentation.posthogExportConfigured ? 'configured' : 'missing API credentials'}`);
|
|
1962
|
-
console.log(` GA4 Export : ${instrumentation.ga4ExportConfigured ? 'configured' : 'missing API credentials'}`);
|
|
1963
|
-
console.log(` Visitor Paths : ${instrumentation.dashboardGradeExportReady ? 'export-ready' : 'not dashboard-grade in repo'}`);
|
|
1964
1899
|
console.log(` SEO Signals : ${instrumentation.seoSignalsPresent ? analytics.seo.landingViews : 0}`);
|
|
1965
1900
|
console.log(` Buyer Loss : ${instrumentation.buyerLossSignalsPresent ? analytics.buyerLoss.totalSignals : 0}`);
|
|
1966
1901
|
console.log(` Attribution : ${Math.round((instrumentation.trafficAttributionCoverage || 0) * 100)}% page-view coverage`);
|
|
@@ -2090,7 +2025,6 @@ module.exports = {
|
|
|
2090
2025
|
computeObservabilityStats,
|
|
2091
2026
|
readJSONL,
|
|
2092
2027
|
readJsonFile,
|
|
2093
|
-
collectAllFeedbackEntries,
|
|
2094
2028
|
};
|
|
2095
2029
|
|
|
2096
2030
|
if (require.main === module) {
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
* the full durable-execution runtime. Gives each external call (HTTP,
|
|
8
8
|
* LanceDB, LLM) a uniform retry + idempotency wrapper:
|
|
9
9
|
*
|
|
10
|
-
* const result = await runStep('
|
|
10
|
+
* const result = await runStep('zernio.publishPost', {
|
|
11
11
|
* retries: 3,
|
|
12
12
|
* idempotencyKey: idempotencyKey(content, platforms),
|
|
13
13
|
* }, async ({ attempt }) => {
|
|
14
|
-
* return
|
|
14
|
+
* return zernioFetch('POST', '/posts', body, { idempotencyKey: ... });
|
|
15
15
|
* });
|
|
16
16
|
*
|
|
17
17
|
* Why a custom helper instead of Vercel Workflows / Temporal / Inngest?
|
|
@@ -98,7 +98,7 @@ function idempotencyKey(...parts) {
|
|
|
98
98
|
* `fn` resolves to, or throws the last error after exhausting retries /
|
|
99
99
|
* hitting a non-retryable verdict.
|
|
100
100
|
*
|
|
101
|
-
* @param {string} name Step name, used in logs. e.g. '
|
|
101
|
+
* @param {string} name Step name, used in logs. e.g. 'zernio.publishPost'.
|
|
102
102
|
* @param {object|function} options { retries, backoffMs, classify, onRetry, onFail, logger }
|
|
103
103
|
* (may be passed directly as the callback shorthand)
|
|
104
104
|
* @param {function({attempt:number}):Promise} fn The actual work.
|
|
@@ -6,7 +6,6 @@ const path = require('path');
|
|
|
6
6
|
|
|
7
7
|
const { getFeedbackPaths } = require('./feedback-loop');
|
|
8
8
|
const { ensureDir } = require('./fs-utils');
|
|
9
|
-
const { redactSecretsDeep } = require('./secret-redaction');
|
|
10
9
|
|
|
11
10
|
const PROJECT_ROOT = path.join(__dirname, '..');
|
|
12
11
|
const DEFAULT_PROOF_DIR = process.env.THUMBGATE_PROOF_DIR
|
|
@@ -48,10 +47,7 @@ function readJSON(filePath) {
|
|
|
48
47
|
}
|
|
49
48
|
|
|
50
49
|
function writeJSONL(filePath, rows) {
|
|
51
|
-
|
|
52
|
-
// (feedback_events, memory_records, sequences, attributions, proof_reports). A shared/published
|
|
53
|
-
// dataset must never ship a captured credential. See scripts/secret-redaction.js.
|
|
54
|
-
const content = rows.map((row) => JSON.stringify(redactSecretsDeep(row))).join('\n');
|
|
50
|
+
const content = rows.map((row) => JSON.stringify(row)).join('\n');
|
|
55
51
|
fs.writeFileSync(filePath, content ? `${content}\n` : '');
|
|
56
52
|
}
|
|
57
53
|
|
|
@@ -9,7 +9,6 @@ const fs = require('fs');
|
|
|
9
9
|
const path = require('path');
|
|
10
10
|
const { traceForDpoPair, aggregateTraces } = require('./code-reasoning');
|
|
11
11
|
const { resolveFeedbackDir } = require('./feedback-paths');
|
|
12
|
-
const { redactSecretsDeep } = require('./secret-redaction');
|
|
13
12
|
|
|
14
13
|
const DEFAULT_LOCAL_MEMORY_LOG = path.join(resolveFeedbackDir(), 'memory-log.jsonl');
|
|
15
14
|
|
|
@@ -202,18 +201,14 @@ function exportDpoFromMemories(memories) {
|
|
|
202
201
|
},
|
|
203
202
|
}));
|
|
204
203
|
|
|
205
|
-
// Redact secrets before the pairs leave this module — they are derived from memory content and
|
|
206
|
-
// are shipped to disk here AND consumed by export-hf-dataset.js. See scripts/secret-redaction.js.
|
|
207
|
-
const redactedPairs = pairsWithTraces.map((pair) => redactSecretsDeep(pair));
|
|
208
|
-
|
|
209
204
|
return {
|
|
210
|
-
pairs:
|
|
205
|
+
pairs: pairsWithTraces,
|
|
211
206
|
unpairedErrors: result.unpairedErrors,
|
|
212
207
|
unpairedLearnings: result.unpairedLearnings,
|
|
213
208
|
errors,
|
|
214
209
|
learnings,
|
|
215
210
|
reasoning,
|
|
216
|
-
jsonl: toJSONL(
|
|
211
|
+
jsonl: toJSONL(pairsWithTraces),
|
|
217
212
|
};
|
|
218
213
|
}
|
|
219
214
|
|