thumbgate 1.16.12 → 1.16.19
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 +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.well-known/mcp/server-card.json +1 -1
- package/README.md +3 -1
- package/adapters/claude/.mcp.json +2 -2
- package/adapters/mcp/server-stdio.js +26 -1
- package/adapters/opencode/opencode.json +1 -1
- package/bin/cli.js +420 -1
- package/config/gate-templates.json +372 -0
- package/config/mcp-allowlists.json +25 -0
- package/config/model-candidates.json +59 -2
- package/config/model-tiers.json +4 -1
- package/package.json +79 -22
- package/public/compare.html +6 -0
- package/public/index.html +144 -11
- package/public/numbers.html +11 -11
- package/public/pro.html +22 -24
- package/scripts/agent-design-governance.js +211 -0
- package/scripts/agent-reasoning-traces.js +683 -0
- package/scripts/agent-reward-model.js +438 -0
- package/scripts/agent-stack-survival-audit.js +231 -0
- package/scripts/ai-engineering-stack-guardrails.js +256 -0
- package/scripts/billing.js +16 -4
- package/scripts/chatgpt-ads-readiness-pack.js +195 -0
- package/scripts/cli-schema.js +277 -0
- package/scripts/code-graph-guardrails.js +176 -0
- package/scripts/deepseek-v4-runtime-guardrails.js +253 -0
- package/scripts/gemini-embedding-policy.js +198 -0
- package/scripts/inference-cache-policy.js +39 -0
- package/scripts/judge-reward-function.js +396 -0
- package/scripts/llm-behavior-monitor.js +251 -0
- package/scripts/long-running-agent-context-guardrails.js +176 -0
- package/scripts/multimodal-retrieval-plan.js +31 -11
- package/scripts/oss-pr-opportunity-scout.js +240 -0
- package/scripts/proactive-agent-eval-guardrails.js +230 -0
- package/scripts/profile-router.js +5 -4
- package/scripts/prompting-operating-system.js +273 -0
- package/scripts/proxy-pointer-rag-guardrails.js +189 -0
- package/scripts/rag-precision-guardrails.js +202 -0
- package/scripts/rate-limiter.js +1 -1
- package/scripts/reasoning-efficiency-guardrails.js +176 -0
- package/scripts/reward-hacking-guardrails.js +251 -0
- package/scripts/seo-gsd.js +1201 -11
- package/scripts/single-use-credential-gate.js +182 -0
- package/scripts/structured-prompt-driven.js +226 -0
- package/scripts/telemetry-analytics.js +31 -6
- package/scripts/tool-registry.js +92 -0
- package/scripts/upstream-contribution-engine.js +379 -0
- package/scripts/vector-store.js +119 -4
- package/src/api/server.js +333 -100
- package/scripts/agents-sdk-sandbox-plan.js +0 -57
- package/scripts/ai-org-governance.js +0 -98
- package/scripts/artifact-agent-plan.js +0 -81
- package/scripts/enterprise-agent-rollout.js +0 -34
- package/scripts/experience-replay-governance.js +0 -69
- package/scripts/inference-economics.js +0 -53
- package/scripts/knowledge-layer-plan.js +0 -108
- package/scripts/memory-store-governance.js +0 -60
- package/scripts/post-training-governance.js +0 -34
- package/scripts/production-agent-readiness.js +0 -40
- package/scripts/scaling-law-claims.js +0 -60
- package/scripts/student-consistent-training.js +0 -73
package/scripts/cli-schema.js
CHANGED
|
@@ -162,6 +162,283 @@ const CLI_COMMANDS = [
|
|
|
162
162
|
{ name: 'ai-only', type: 'boolean', description: 'Only report AI/browser bridge manifests' },
|
|
163
163
|
],
|
|
164
164
|
}),
|
|
165
|
+
discoveryCommand({
|
|
166
|
+
name: 'code-graph-guardrails',
|
|
167
|
+
aliases: ['knowledge-graph-guardrails', 'graph-guardrails'],
|
|
168
|
+
description: 'Map code-graph risk signals to Knowledge Graph Safety pre-action gates',
|
|
169
|
+
flags: [
|
|
170
|
+
jsonFlag(),
|
|
171
|
+
{ name: 'graph-tool', type: 'string', description: 'Graph tool name, such as understand-anything or code-graph-mcp' },
|
|
172
|
+
{ name: 'graph-path', type: 'string', description: 'Path to generated graph output or cache directory' },
|
|
173
|
+
{ name: 'central-files', type: 'string', description: 'Comma-separated high-centrality files' },
|
|
174
|
+
{ name: 'layers', type: 'string', description: 'Comma-separated architecture layers touched, such as api,data,ui' },
|
|
175
|
+
{ name: 'generated-artifacts', type: 'string', description: 'Comma-separated generated graph artifacts to protect' },
|
|
176
|
+
{ name: 'changed-files', type: 'number', description: 'Estimated changed file count for blast-radius context' },
|
|
177
|
+
],
|
|
178
|
+
}),
|
|
179
|
+
discoveryCommand({
|
|
180
|
+
name: 'proxy-pointer-rag-guardrails',
|
|
181
|
+
aliases: ['document-rag-guardrails', 'multimodal-rag-guardrails'],
|
|
182
|
+
description: 'Map document-tree and image-pointer RAG signals to Document RAG Safety gates',
|
|
183
|
+
flags: [
|
|
184
|
+
jsonFlag(),
|
|
185
|
+
{ name: 'rag-tool', type: 'string', description: 'RAG pipeline name, such as proxy-pointer-rag or docling-rag' },
|
|
186
|
+
{ name: 'tree-path', type: 'string', description: 'Path to generated document section tree JSON' },
|
|
187
|
+
{ name: 'section-ids', type: 'string', description: 'Comma-separated section ids included in retrieved context' },
|
|
188
|
+
{ name: 'image-pointers', type: 'string', description: 'Comma-separated image, chart, or figure pointers selected for the answer' },
|
|
189
|
+
{ name: 'documents', type: 'string', description: 'Comma-separated source document ids represented in the answer' },
|
|
190
|
+
{ name: 'candidate-images', type: 'number', description: 'Number of candidate images considered before final answer synthesis' },
|
|
191
|
+
{ name: 'cross-doc-policy', type: 'string', description: 'Set to strict when images must never cross source documents' },
|
|
192
|
+
{ name: 'vision-filter', type: 'boolean', description: 'Mark that a vision sanity check was used or required' },
|
|
193
|
+
{ name: 'visual-claims', type: 'boolean', description: 'Mark that the answer makes claims about visual content' },
|
|
194
|
+
],
|
|
195
|
+
}),
|
|
196
|
+
discoveryCommand({
|
|
197
|
+
name: 'gemini-embedding-plan',
|
|
198
|
+
aliases: ['embedding-plan'],
|
|
199
|
+
description: 'Plan Gemini Embedding 2 task prefixes, Matryoshka dimensions, and Batch API indexing',
|
|
200
|
+
flags: [
|
|
201
|
+
jsonFlag(),
|
|
202
|
+
{ name: 'task', type: 'string', description: 'Retrieval task, such as code retrieval, search result, or classification' },
|
|
203
|
+
{ name: 'corpus-items', type: 'number', description: 'Estimated number of lessons, docs, or proof artifacts to index' },
|
|
204
|
+
{ name: 'dim', type: 'number', description: 'Requested output dimensionality; snaps to 3072, 1536, or 768' },
|
|
205
|
+
{ name: 'no-batch', type: 'boolean', description: 'Skip Batch API recommendation for online-only indexing' },
|
|
206
|
+
],
|
|
207
|
+
}),
|
|
208
|
+
discoveryCommand({
|
|
209
|
+
name: 'agent-design-governance',
|
|
210
|
+
aliases: ['agent-architecture', 'agent-governance-plan'],
|
|
211
|
+
description: 'Decide single-agent vs multi-agent architecture and required eval/tool safeguards',
|
|
212
|
+
mcpTool: 'plan_agent_design_governance',
|
|
213
|
+
flags: [
|
|
214
|
+
jsonFlag(),
|
|
215
|
+
{ name: 'workflow', type: 'string', description: 'Workflow name or short description' },
|
|
216
|
+
{ name: 'tools', type: 'string', description: 'Comma-separated tool names available to the agent' },
|
|
217
|
+
{ name: 'tool-count', type: 'number', description: 'Total available tools when not listing names' },
|
|
218
|
+
{ name: 'similar-tool-count', type: 'number', description: 'Number of similar/overlapping tools competing for selection' },
|
|
219
|
+
{ name: 'conditional-branches', type: 'number', description: 'Rough count of if/then instruction branches' },
|
|
220
|
+
{ name: 'high-risk-tools', type: 'string', description: 'Comma-separated tools that affect production, money, data, secrets, or outbound actions' },
|
|
221
|
+
{ name: 'write-tools', type: 'string', description: 'Comma-separated write-capable tools' },
|
|
222
|
+
{ name: 'baseline-evals', type: 'boolean', description: 'Whether baseline agent evals already exist' },
|
|
223
|
+
{ name: 'docs', type: 'boolean', description: 'Instructions draw on existing workflow docs' },
|
|
224
|
+
{ name: 'examples', type: 'boolean', description: 'Instructions include concrete examples' },
|
|
225
|
+
{ name: 'edge-cases', type: 'boolean', description: 'Instructions include edge cases and failure paths' },
|
|
226
|
+
{ name: 'tool-approvals', type: 'boolean', description: 'Risky tool calls require approval' },
|
|
227
|
+
{ name: 'exit-condition', type: 'boolean', description: 'Instructions define when the run is complete' },
|
|
228
|
+
],
|
|
229
|
+
}),
|
|
230
|
+
discoveryCommand({
|
|
231
|
+
name: 'proactive-agent-eval-guardrails',
|
|
232
|
+
aliases: ['pare-guardrails', 'proactive-agent-guardrails'],
|
|
233
|
+
description: 'Map PARE-style proactive-agent eval gaps to stateful pre-action gates',
|
|
234
|
+
mcpTool: 'plan_proactive_agent_eval_guardrails',
|
|
235
|
+
flags: [
|
|
236
|
+
jsonFlag(),
|
|
237
|
+
{ name: 'workflow', type: 'string', description: 'Proactive assistant workflow name' },
|
|
238
|
+
{ name: 'apps', type: 'string', description: 'Comma-separated apps involved in the workflow' },
|
|
239
|
+
{ name: 'states', type: 'string', description: 'Comma-separated app states modeled for the eval' },
|
|
240
|
+
{ name: 'state-count', type: 'number', description: 'Number of modeled states' },
|
|
241
|
+
{ name: 'action-count', type: 'number', description: 'Number of state-dependent actions' },
|
|
242
|
+
{ name: 'task-count', type: 'number', description: 'Number of benchmark tasks or scenarios' },
|
|
243
|
+
{ name: 'state-machine', type: 'boolean', description: 'Whether apps are modeled as finite state machines' },
|
|
244
|
+
{ name: 'active-user-simulation', type: 'boolean', description: 'Whether active user simulation exists' },
|
|
245
|
+
{ name: 'goal-inference-evals', type: 'boolean', description: 'Whether goal inference is graded' },
|
|
246
|
+
{ name: 'intervention-timing-evals', type: 'boolean', description: 'Whether intervention timing is graded' },
|
|
247
|
+
{ name: 'multi-app-evals', type: 'boolean', description: 'Whether multi-app orchestration is graded' },
|
|
248
|
+
{ name: 'flat-tool-api-only', type: 'boolean', description: 'Mark that the current eval only covers flat tool calls' },
|
|
249
|
+
{ name: 'proactive-writes', type: 'boolean', description: 'Mark that the proactive agent can write or mutate state' },
|
|
250
|
+
{ name: 'user-visible-actions', type: 'boolean', description: 'Mark that interventions can notify, schedule, send, or otherwise affect users' },
|
|
251
|
+
],
|
|
252
|
+
}),
|
|
253
|
+
discoveryCommand({
|
|
254
|
+
name: 'reward-hacking-guardrails',
|
|
255
|
+
aliases: ['proxy-reward-guardrails', 'reward-guardrails'],
|
|
256
|
+
description: 'Detect reward-hacking patterns and require proof before proxy metrics or completion claims are trusted',
|
|
257
|
+
mcpTool: 'plan_reward_hacking_guardrails',
|
|
258
|
+
flags: [
|
|
259
|
+
jsonFlag(),
|
|
260
|
+
{ name: 'workflow', type: 'string', description: 'Agent workflow or release lane being evaluated' },
|
|
261
|
+
{ name: 'text', type: 'string', description: 'Candidate response, claim, summary, or verifier output to inspect' },
|
|
262
|
+
{ name: 'evidence', type: 'string', description: 'Comma-separated evidence artifacts attached to the claim' },
|
|
263
|
+
{ name: 'metrics', type: 'string', description: 'Comma-separated proxy metrics or reward scores used by the workflow' },
|
|
264
|
+
{ name: 'holdout', type: 'boolean', description: 'Whether holdout, regression, or real-workflow evidence exists' },
|
|
265
|
+
{ name: 'human-objective', type: 'boolean', description: 'Whether proxy metrics are mapped to a human/user objective' },
|
|
266
|
+
{ name: 'verifier-trace', type: 'boolean', description: 'Whether verifier trace, run log, or proof artifact exists' },
|
|
267
|
+
{ name: 'optimized-for-score', type: 'boolean', description: 'Mark that the workflow is optimizing an eval, benchmark, or reward score' },
|
|
268
|
+
{ name: 'multimodal', type: 'boolean', description: 'Mark that claims depend on screenshots, PDFs, charts, images, or video' },
|
|
269
|
+
],
|
|
270
|
+
}),
|
|
271
|
+
discoveryCommand({
|
|
272
|
+
name: 'oss-pr-opportunity-scout',
|
|
273
|
+
aliases: ['github-pr-scout', 'upstream-pr-scout'],
|
|
274
|
+
description: 'Find upstream GitHub repos ThumbGate uses and rank proof-backed issue/bug-bounty PR opportunities',
|
|
275
|
+
mcpTool: 'plan_oss_pr_opportunity_scout',
|
|
276
|
+
flags: [
|
|
277
|
+
jsonFlag(),
|
|
278
|
+
{ name: 'package-path', type: 'string', description: 'Path to package.json used to discover dependencies' },
|
|
279
|
+
{ name: 'dependencies', type: 'string', description: 'Comma-separated dependency names to scout instead of package.json' },
|
|
280
|
+
{ name: 'max-repos', type: 'number', description: 'Maximum mapped upstream repositories to include' },
|
|
281
|
+
{ name: 'include-bounties', type: 'boolean', description: 'Include bug-bounty and security search queries' },
|
|
282
|
+
],
|
|
283
|
+
}),
|
|
284
|
+
discoveryCommand({
|
|
285
|
+
name: 'chatgpt-ads-readiness-pack',
|
|
286
|
+
aliases: ['chatgpt-ads-plan', 'ai-ads-plan'],
|
|
287
|
+
description: 'Prepare ThumbGate copy, intent clusters, proof gates, and measurement for ChatGPT Ads Manager tests',
|
|
288
|
+
mcpTool: 'plan_chatgpt_ads_readiness',
|
|
289
|
+
flags: [
|
|
290
|
+
jsonFlag(),
|
|
291
|
+
{ name: 'offer', type: 'string', description: 'Offer to advertise, such as Pro or Workflow Hardening Sprint' },
|
|
292
|
+
{ name: 'audience', type: 'string', description: 'Audience segment to target' },
|
|
293
|
+
{ name: 'budget', type: 'number', description: 'Initial test budget' },
|
|
294
|
+
{ name: 'keywords', type: 'string', description: 'Comma-separated high-intent conversational queries' },
|
|
295
|
+
{ name: 'proof-links', type: 'string', description: 'Comma-separated proof URLs required by ad claims' },
|
|
296
|
+
],
|
|
297
|
+
}),
|
|
298
|
+
discoveryCommand({
|
|
299
|
+
name: 'rag-precision-guardrails',
|
|
300
|
+
aliases: ['retrieval-precision-guardrails', 'agentic-rag-guardrails'],
|
|
301
|
+
description: 'Map RAG precision tuning and retrieval-regression signals to Document RAG Safety gates',
|
|
302
|
+
flags: [
|
|
303
|
+
jsonFlag(),
|
|
304
|
+
{ name: 'rag-tool', type: 'string', description: 'RAG pipeline name, such as agentic-rag or redis-rag' },
|
|
305
|
+
{ name: 'baseline-recall', type: 'number', description: 'Recall@k before embedding, threshold, or reranking changes' },
|
|
306
|
+
{ name: 'new-recall', type: 'number', description: 'Recall@k after the proposed retrieval change' },
|
|
307
|
+
{ name: 'baseline-precision', type: 'number', description: 'Precision@k before the proposed retrieval change' },
|
|
308
|
+
{ name: 'new-precision', type: 'number', description: 'Precision@k after the proposed retrieval change' },
|
|
309
|
+
{ name: 'top-k', type: 'number', description: 'Retrieval k used for the baseline and candidate metrics' },
|
|
310
|
+
{ name: 'threshold-change', type: 'boolean', description: 'Mark that vector threshold or top-k routing changed' },
|
|
311
|
+
{ name: 'embedding-finetune', type: 'boolean', description: 'Mark that embedding fine-tuning or replacement is proposed' },
|
|
312
|
+
{ name: 'structural-near-misses', type: 'boolean', description: 'Mark that negation or role-reversal near misses matter' },
|
|
313
|
+
{ name: 'verifier', type: 'boolean', description: 'Mark that a second-stage verifier or reranker is present' },
|
|
314
|
+
{ name: 'latency-ms', type: 'number', description: 'Observed end-to-end retrieval latency after verifier or reranker' },
|
|
315
|
+
{ name: 'latency-budget-ms', type: 'number', description: 'Workflow retrieval latency budget' },
|
|
316
|
+
{ name: 'agentic', type: 'boolean', description: 'Mark that retrieval output can trigger downstream agent actions' },
|
|
317
|
+
],
|
|
318
|
+
}),
|
|
319
|
+
discoveryCommand({
|
|
320
|
+
name: 'ai-engineering-stack-guardrails',
|
|
321
|
+
aliases: ['ai-stack-guardrails', 'internal-ai-stack-guardrails', 'llm-wiki-guardrails'],
|
|
322
|
+
description: 'Map AI gateway, MCP portal, AGENTS.md/LLM wiki, reviewer, and sandbox gaps to stack gates',
|
|
323
|
+
flags: [
|
|
324
|
+
jsonFlag(),
|
|
325
|
+
{ name: 'stack', type: 'string', description: 'Stack name or rollout program' },
|
|
326
|
+
{ name: 'gateway', type: 'boolean', description: 'Mark that a central model gateway or proxy exists' },
|
|
327
|
+
{ name: 'direct-provider-keys', type: 'boolean', description: 'Mark that clients still hold provider API keys directly' },
|
|
328
|
+
{ name: 'mcp-tool-count', type: 'number', description: 'Number of MCP tools exposed before progressive discovery' },
|
|
329
|
+
{ name: 'code-mode', type: 'boolean', description: 'Mark that MCP tools are hidden behind code-mode search/execute or progressive discovery' },
|
|
330
|
+
{ name: 'agents-md', type: 'boolean', description: 'Mark that short repo-local AGENTS.md context exists' },
|
|
331
|
+
{ name: 'llm-wiki-pages', type: 'number', description: 'Number of source-backed LLM wiki pages in the stack' },
|
|
332
|
+
{ name: 'context-freshness-days', type: 'number', description: 'Days since AGENTS.md or LLM wiki context was refreshed' },
|
|
333
|
+
{ name: 'ai-reviewer', type: 'boolean', description: 'Mark that risk-tiered AI code review is active' },
|
|
334
|
+
{ name: 'codex-rules', type: 'boolean', description: 'Mark that engineering standards are available as rules or skills' },
|
|
335
|
+
{ name: 'background-agents', type: 'boolean', description: 'Mark that durable/background agents can run work' },
|
|
336
|
+
{ name: 'sandbox', type: 'boolean', description: 'Mark that background agents run in isolated build/test sandboxes' },
|
|
337
|
+
{ name: 'high-risk-workflows', type: 'string', description: 'Comma-separated workflows touching money, prod, secrets, data, or publishing' },
|
|
338
|
+
],
|
|
339
|
+
}),
|
|
340
|
+
discoveryCommand({
|
|
341
|
+
name: 'long-running-agent-context-guardrails',
|
|
342
|
+
aliases: ['agent-context-guardrails', 'slack-context-guardrails'],
|
|
343
|
+
description: 'Map long-running agent context risks to director-journal and critic-review gates',
|
|
344
|
+
flags: [
|
|
345
|
+
jsonFlag(),
|
|
346
|
+
{ name: 'workflow', type: 'string', description: 'Workflow or agent loop name' },
|
|
347
|
+
{ name: 'request-count', type: 'number', description: 'Approximate number of requests in the long-running workflow' },
|
|
348
|
+
{ name: 'output-mb', type: 'number', description: 'Approximate generated output volume in megabytes' },
|
|
349
|
+
{ name: 'director-journal', type: 'boolean', description: 'Mark that structured working memory is present' },
|
|
350
|
+
{ name: 'critic-review', type: 'boolean', description: 'Mark that expert findings receive critic review' },
|
|
351
|
+
{ name: 'critic-timeline', type: 'boolean', description: 'Mark that a deduplicated credibility timeline is present' },
|
|
352
|
+
{ name: 'credibility-scores', type: 'boolean', description: 'Mark that findings carry evidence credibility scores' },
|
|
353
|
+
{ name: 'conflicts', type: 'boolean', description: 'Mark that the timeline contains unresolved conflicting findings' },
|
|
354
|
+
{ name: 'raw-chat-only', type: 'boolean', description: 'Mark that the workflow only accumulates raw chat history' },
|
|
355
|
+
],
|
|
356
|
+
}),
|
|
357
|
+
discoveryCommand({
|
|
358
|
+
name: 'reasoning-efficiency-guardrails',
|
|
359
|
+
aliases: ['sas-guardrails', 'reasoning-compression-guardrails'],
|
|
360
|
+
description: 'Map reasoning compression, verifier, and step-confidence signals to efficiency safety gates',
|
|
361
|
+
flags: [
|
|
362
|
+
jsonFlag(),
|
|
363
|
+
{ name: 'workload', type: 'string', description: 'Reasoning workload name' },
|
|
364
|
+
{ name: 'baseline-tokens', type: 'number', description: 'Average reasoning tokens before compression' },
|
|
365
|
+
{ name: 'compressed-tokens', type: 'number', description: 'Average reasoning tokens after compression' },
|
|
366
|
+
{ name: 'baseline-accuracy', type: 'number', description: 'Pass@1 or accuracy before compression' },
|
|
367
|
+
{ name: 'compressed-accuracy', type: 'number', description: 'Pass@1 or accuracy after compression' },
|
|
368
|
+
{ name: 'verifier', type: 'boolean', description: 'Mark that verifier outcomes are present' },
|
|
369
|
+
{ name: 'low-confidence-steps', type: 'number', description: 'Low-confidence accepted reasoning steps to inspect' },
|
|
370
|
+
{ name: 'high-confidence-failures', type: 'number', description: 'High-confidence failed rollouts to inspect' },
|
|
371
|
+
{ name: 'truncation-failures', type: 'boolean', description: 'Mark that failures may be truncation-related' },
|
|
372
|
+
],
|
|
373
|
+
}),
|
|
374
|
+
discoveryCommand({
|
|
375
|
+
name: 'deepseek-v4-runtime-guardrails',
|
|
376
|
+
aliases: ['sparse-attention-runtime-guardrails', 'deepseek-runtime-guardrails'],
|
|
377
|
+
description: 'Map DeepSeek-V4 sparse-attention serving and verified-RL rollout risks to runtime safety gates',
|
|
378
|
+
flags: [
|
|
379
|
+
jsonFlag(),
|
|
380
|
+
{ name: 'workload', type: 'string', description: 'Runtime workload name' },
|
|
381
|
+
{ name: 'model', type: 'string', description: 'Model candidate, such as deepseek-v4-flash or deepseek-v4-pro' },
|
|
382
|
+
{ name: 'engine', type: 'string', description: 'Serving engine, such as sglang' },
|
|
383
|
+
{ name: 'context-tokens', type: 'number', description: 'Observed or target long-context token count' },
|
|
384
|
+
{ name: 'target-context-tokens', type: 'number', description: 'Maximum context target for the runtime rollout' },
|
|
385
|
+
{ name: 'baseline-throughput', type: 'number', description: 'Baseline decode throughput before runtime change' },
|
|
386
|
+
{ name: 'new-throughput', type: 'number', description: 'Decode throughput after runtime change' },
|
|
387
|
+
{ name: 'hybrid-attention', type: 'boolean', description: 'Mark that hybrid sparse attention is active' },
|
|
388
|
+
{ name: 'prefix-cache', type: 'boolean', description: 'Mark that prefix caching is active' },
|
|
389
|
+
{ name: 'cache-coherence-eval', type: 'boolean', description: 'Mark that cache reuse and rollback coherence were evaluated' },
|
|
390
|
+
{ name: 'speculative-decoding', type: 'boolean', description: 'Mark that MTP, EAGLE, or another speculation path is active' },
|
|
391
|
+
{ name: 'accept-length', type: 'number', description: 'Measured speculative decoding accept length' },
|
|
392
|
+
{ name: 'kv-offload', type: 'boolean', description: 'Mark that KV cache offload or capacity extension is active' },
|
|
393
|
+
{ name: 'training', type: 'boolean', description: 'Mark that the rollout feeds RL, DPO, or fine-tuning' },
|
|
394
|
+
{ name: 'rollout-replay', type: 'boolean', description: 'Mark that rollout routing replay is captured' },
|
|
395
|
+
{ name: 'indexer-replay', type: 'boolean', description: 'Mark that sparse indexer choices are replayed for training' },
|
|
396
|
+
{ name: 'train-inference-drift', type: 'number', description: 'Measured train versus inference log-prob or route drift' },
|
|
397
|
+
{ name: 'precision-mode', type: 'string', description: 'Precision mode, such as fp4, fp8, mxfp, or mixed' },
|
|
398
|
+
{ name: 'deterministic', type: 'boolean', description: 'Mark that deterministic settings and sensitive FP32 paths are enforced' },
|
|
399
|
+
{ name: 'numerical-spikes', type: 'boolean', description: 'Mark that KL, reward, or eval spikes were observed' },
|
|
400
|
+
],
|
|
401
|
+
}),
|
|
402
|
+
discoveryCommand({
|
|
403
|
+
name: 'upstream-contributions',
|
|
404
|
+
aliases: ['upstream-contribution-engine', 'upstream-prs'],
|
|
405
|
+
description: 'Rank issues in upstream repos ThumbGate depends on and generate governed PR contribution lanes',
|
|
406
|
+
flags: [
|
|
407
|
+
jsonFlag(),
|
|
408
|
+
{ name: 'write', type: 'boolean', description: 'Write markdown and JSON operator artifacts under docs/marketing' },
|
|
409
|
+
{ name: 'live', type: 'boolean', description: 'Use gh issue list for live issue discovery; default is offline query planning' },
|
|
410
|
+
{ name: 'max-repos', type: 'number', description: 'Maximum direct dependency repos to scan or plan' },
|
|
411
|
+
{ name: 'max-issues', type: 'number', description: 'Maximum issues to keep per repo' },
|
|
412
|
+
],
|
|
413
|
+
}),
|
|
414
|
+
discoveryCommand({
|
|
415
|
+
name: 'background-governance',
|
|
416
|
+
aliases: ['background-agent-governance', 'agent-governance'],
|
|
417
|
+
description: 'Report background-agent runs and pre-check unattended PR dispatch risk',
|
|
418
|
+
flags: [
|
|
419
|
+
jsonFlag(),
|
|
420
|
+
{ name: 'window-hours', type: 'number', description: 'Lookback window for the run report (default 24)' },
|
|
421
|
+
{ name: 'feedback-dir', type: 'string', description: 'Explicit ThumbGate feedback directory' },
|
|
422
|
+
{ name: 'check', type: 'boolean', description: 'Run a pre-dispatch governance check instead of the report' },
|
|
423
|
+
{ name: 'agent-id', type: 'string', description: 'Agent identifier for --check' },
|
|
424
|
+
{ name: 'run-type', type: 'string', description: 'Run type for --check, such as pr or ci-repair' },
|
|
425
|
+
{ name: 'branch', type: 'string', description: 'Target branch for --check' },
|
|
426
|
+
{ name: 'files-changed', type: 'number', description: 'Estimated files changed for --check' },
|
|
427
|
+
],
|
|
428
|
+
}),
|
|
429
|
+
discoveryCommand({
|
|
430
|
+
name: 'model-candidates',
|
|
431
|
+
aliases: ['managed-models'],
|
|
432
|
+
description: 'Rank managed model candidates and emit benchmark plans for routed workloads',
|
|
433
|
+
flags: [
|
|
434
|
+
jsonFlag(),
|
|
435
|
+
{ name: 'workload', type: 'string', description: 'Workload id, such as pretool-gating, long-trace-review, cheap-fast-path, or dashboard-analysis' },
|
|
436
|
+
{ name: 'provider', type: 'string', description: 'Provider filter, such as openai, anthropic, or openai-compatible' },
|
|
437
|
+
{ name: 'family', type: 'string', description: 'Model family filter' },
|
|
438
|
+
{ name: 'gateway', type: 'string', description: 'Gateway filter for openai-compatible providers' },
|
|
439
|
+
{ name: 'max', type: 'number', description: 'Maximum recommendations to return (default 3)' },
|
|
440
|
+
],
|
|
441
|
+
}),
|
|
165
442
|
{
|
|
166
443
|
name: 'lesson-health',
|
|
167
444
|
aliases: ['stale'],
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { listGateTemplates } = require('./gate-templates');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_GRAPH_TOOL = 'code-graph';
|
|
8
|
+
const KNOWLEDGE_GRAPH_CATEGORY = 'Knowledge Graph Safety';
|
|
9
|
+
|
|
10
|
+
function splitCsv(value) {
|
|
11
|
+
if (Array.isArray(value)) return value.map(String).map((item) => item.trim()).filter(Boolean);
|
|
12
|
+
if (value === undefined || value === null || value === true) return [];
|
|
13
|
+
return String(value)
|
|
14
|
+
.split(',')
|
|
15
|
+
.map((item) => item.trim())
|
|
16
|
+
.filter(Boolean);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function unique(values) {
|
|
20
|
+
return Array.from(new Set(values.filter(Boolean)));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function normalizeOptions(options = {}) {
|
|
24
|
+
const layers = unique([
|
|
25
|
+
...splitCsv(options.layers),
|
|
26
|
+
...splitCsv(options['layers-touched']),
|
|
27
|
+
]);
|
|
28
|
+
const centralFiles = unique([
|
|
29
|
+
...splitCsv(options['central-files']),
|
|
30
|
+
...splitCsv(options.centrality === 'high' || options.centrality === 'critical' ? options.files : []),
|
|
31
|
+
]);
|
|
32
|
+
const generatedArtifacts = unique([
|
|
33
|
+
...splitCsv(options['generated-artifacts']),
|
|
34
|
+
...splitCsv(options.artifacts),
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
graphTool: String(options['graph-tool'] || options.tool || DEFAULT_GRAPH_TOOL).trim() || DEFAULT_GRAPH_TOOL,
|
|
39
|
+
graphPath: options['graph-path'] ? String(options['graph-path']).trim() : null,
|
|
40
|
+
centralFiles,
|
|
41
|
+
layersTouched: layers,
|
|
42
|
+
generatedArtifacts,
|
|
43
|
+
changedFiles: Number.isFinite(Number(options['changed-files'])) ? Number(options['changed-files']) : null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function gateApplicability(template, options) {
|
|
48
|
+
if (template.id === 'require-diff-impact-before-central-edit') {
|
|
49
|
+
return options.centralFiles.length > 0;
|
|
50
|
+
}
|
|
51
|
+
if (template.id === 'checkpoint-cross-layer-refactor') {
|
|
52
|
+
return options.layersTouched.length >= 2;
|
|
53
|
+
}
|
|
54
|
+
if (template.id === 'protect-graph-generated-artifacts') {
|
|
55
|
+
return options.generatedArtifacts.length > 0 || Boolean(options.graphPath);
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function buildSignalSummary(options) {
|
|
61
|
+
const signals = [];
|
|
62
|
+
if (options.centralFiles.length > 0) {
|
|
63
|
+
signals.push({
|
|
64
|
+
id: 'central_files',
|
|
65
|
+
label: 'High-centrality files',
|
|
66
|
+
values: options.centralFiles,
|
|
67
|
+
risk: 'central edits can break many downstream paths',
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
if (options.layersTouched.length >= 2) {
|
|
71
|
+
signals.push({
|
|
72
|
+
id: 'cross_layer_refactor',
|
|
73
|
+
label: 'Cross-layer refactor',
|
|
74
|
+
values: options.layersTouched,
|
|
75
|
+
risk: 'one run is crossing architectural layers',
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
if (options.generatedArtifacts.length > 0 || options.graphPath) {
|
|
79
|
+
signals.push({
|
|
80
|
+
id: 'generated_graph_artifacts',
|
|
81
|
+
label: 'Generated graph artifacts',
|
|
82
|
+
values: unique([...options.generatedArtifacts, options.graphPath ? path.normalize(options.graphPath) : null]),
|
|
83
|
+
risk: 'graph outputs should be regenerated from source, not hand-edited',
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (options.changedFiles !== null && options.changedFiles >= 20) {
|
|
87
|
+
signals.push({
|
|
88
|
+
id: 'large_blast_radius',
|
|
89
|
+
label: 'Large blast radius',
|
|
90
|
+
values: [`${options.changedFiles} changed files`],
|
|
91
|
+
risk: 'large graph-informed changes should be checkpointed before execution continues',
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return signals;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function buildCodeGraphGuardrailsPlan(rawOptions, templatesPath) {
|
|
98
|
+
const options = normalizeOptions(rawOptions || {});
|
|
99
|
+
const templates = listGateTemplates(templatesPath)
|
|
100
|
+
.filter((template) => template.category === KNOWLEDGE_GRAPH_CATEGORY);
|
|
101
|
+
const signals = buildSignalSummary(options);
|
|
102
|
+
const recommendedTemplates = templates.map((template) => ({
|
|
103
|
+
...template,
|
|
104
|
+
recommended: gateApplicability(template, options),
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
const activeTemplates = recommendedTemplates.filter((template) => template.recommended);
|
|
108
|
+
const status = activeTemplates.length > 0 ? 'actionable' : 'ready';
|
|
109
|
+
|
|
110
|
+
return {
|
|
111
|
+
name: 'thumbgate-code-graph-guardrails',
|
|
112
|
+
status,
|
|
113
|
+
graphTool: options.graphTool,
|
|
114
|
+
graphPath: options.graphPath,
|
|
115
|
+
summary: {
|
|
116
|
+
signalCount: signals.length,
|
|
117
|
+
templateCount: templates.length,
|
|
118
|
+
recommendedTemplateCount: activeTemplates.length,
|
|
119
|
+
changedFiles: options.changedFiles,
|
|
120
|
+
},
|
|
121
|
+
signals,
|
|
122
|
+
templates: recommendedTemplates,
|
|
123
|
+
nextActions: buildNextActions(),
|
|
124
|
+
exampleCommand: 'npx thumbgate code-graph-guardrails --central-files=src/api/server.js --layers=api,data --generated-artifacts=.codegraph/index.json --json',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function buildNextActions() {
|
|
129
|
+
return [
|
|
130
|
+
'Generate or refresh the code graph before a risky agent edit session.',
|
|
131
|
+
'Tag central files, architecture layers, and generated graph outputs in your agent context.',
|
|
132
|
+
'Enable the recommended Knowledge Graph Safety templates as pre-action gates.',
|
|
133
|
+
'Capture thumbs-down corrections when a graph-informed action still misses impact review.',
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function formatCodeGraphGuardrailsPlan(report) {
|
|
138
|
+
const lines = [
|
|
139
|
+
'',
|
|
140
|
+
'ThumbGate Code Graph Guardrails',
|
|
141
|
+
'-'.repeat(36),
|
|
142
|
+
`Status : ${report.status}`,
|
|
143
|
+
`Graph tool : ${report.graphTool}`,
|
|
144
|
+
];
|
|
145
|
+
if (report.graphPath) lines.push(`Graph path : ${report.graphPath}`);
|
|
146
|
+
lines.push(`Signals : ${report.summary.signalCount}`);
|
|
147
|
+
lines.push(`Templates : ${report.summary.recommendedTemplateCount}/${report.summary.templateCount} recommended`);
|
|
148
|
+
|
|
149
|
+
if (report.signals.length > 0) {
|
|
150
|
+
lines.push('', 'Detected graph risk signals:');
|
|
151
|
+
for (const signal of report.signals) {
|
|
152
|
+
lines.push(` - ${signal.label}: ${signal.values.join(', ')}`);
|
|
153
|
+
lines.push(` Risk: ${signal.risk}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
lines.push('', 'Recommended templates:');
|
|
158
|
+
for (const template of report.templates.filter((entry) => entry.recommended)) {
|
|
159
|
+
lines.push(` - ${template.id} [${template.defaultAction}]`);
|
|
160
|
+
lines.push(` ${template.roi}`);
|
|
161
|
+
}
|
|
162
|
+
if (report.summary.recommendedTemplateCount === 0) {
|
|
163
|
+
lines.push(' - No graph-specific signals were passed. Start by supplying --central-files, --layers, or --generated-artifacts.');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
lines.push('', 'Next actions:');
|
|
167
|
+
for (const action of report.nextActions) lines.push(` - ${action}`);
|
|
168
|
+
lines.push('', `Example: ${report.exampleCommand}`, '');
|
|
169
|
+
return `${lines.join('\n')}\n`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
module.exports = {
|
|
173
|
+
buildCodeGraphGuardrailsPlan,
|
|
174
|
+
formatCodeGraphGuardrailsPlan,
|
|
175
|
+
normalizeOptions,
|
|
176
|
+
};
|