@shrkcrft/cli 0.1.0-alpha.26 → 0.1.0-alpha.28
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/dist/command-registry.d.ts +12 -0
- package/dist/command-registry.d.ts.map +1 -1
- package/dist/command-registry.js +25 -0
- package/dist/commands/baseline.command.d.ts +8 -0
- package/dist/commands/baseline.command.d.ts.map +1 -0
- package/dist/commands/baseline.command.js +511 -0
- package/dist/commands/changelog-data.d.ts.map +1 -1
- package/dist/commands/changelog-data.js +43 -0
- package/dist/commands/check.command.d.ts.map +1 -1
- package/dist/commands/check.command.js +28 -1
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +112 -0
- package/dist/commands/delegate.command.d.ts +76 -1
- package/dist/commands/delegate.command.d.ts.map +1 -1
- package/dist/commands/delegate.command.js +585 -25
- package/dist/commands/finish.command.js +4 -4
- package/dist/commands/gates.command.d.ts +6 -0
- package/dist/commands/gates.command.d.ts.map +1 -0
- package/dist/commands/gates.command.js +334 -0
- package/dist/commands/generated.command.d.ts +6 -0
- package/dist/commands/generated.command.d.ts.map +1 -0
- package/dist/commands/generated.command.js +514 -0
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +73 -0
- package/dist/commands/ingest.command.d.ts +11 -0
- package/dist/commands/ingest.command.d.ts.map +1 -1
- package/dist/commands/ingest.command.js +49 -23
- package/dist/commands/policy-lint.command.d.ts +37 -0
- package/dist/commands/policy-lint.command.d.ts.map +1 -1
- package/dist/commands/policy-lint.command.js +119 -2
- package/dist/commands/registry-resolve.d.ts +11 -4
- package/dist/commands/registry-resolve.d.ts.map +1 -1
- package/dist/commands/registry-resolve.js +50 -24
- package/dist/commands/registry.command.d.ts.map +1 -1
- package/dist/commands/registry.command.js +36 -4
- package/dist/commands/trace.command.d.ts.map +1 -1
- package/dist/commands/trace.command.js +7 -1
- package/dist/commands/wiring.command.d.ts.map +1 -1
- package/dist/commands/wiring.command.js +113 -14
- package/dist/exit-codes.d.ts +41 -0
- package/dist/exit-codes.d.ts.map +1 -1
- package/dist/exit-codes.js +85 -0
- package/dist/finish/run-finish.d.ts +22 -3
- package/dist/finish/run-finish.d.ts.map +1 -1
- package/dist/finish/run-finish.js +194 -18
- package/dist/gates/gate-rule-view.d.ts +35 -0
- package/dist/gates/gate-rule-view.d.ts.map +1 -0
- package/dist/gates/gate-rule-view.js +80 -0
- package/dist/gates/rule-coverage.d.ts +53 -0
- package/dist/gates/rule-coverage.d.ts.map +1 -0
- package/dist/gates/rule-coverage.js +165 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +46 -6
- package/dist/output/output-compression.d.ts.map +1 -1
- package/dist/output/output-compression.js +4 -1
- package/package.json +33 -33
|
@@ -686,7 +686,32 @@ async function checkWiring(args) {
|
|
|
686
686
|
for (const d of report.diagnostics)
|
|
687
687
|
process.stdout.write(` ! ${d}\n`);
|
|
688
688
|
}
|
|
689
|
+
// Rules that checked NOTHING, reported per-rule. `matchedNothing` gives the
|
|
690
|
+
// count; this names them, because "which rule went stale" is the actionable
|
|
691
|
+
// half. A `failOnEmpty` rule turns its own skip into a hard failure.
|
|
692
|
+
if (report.skipped.length > 0) {
|
|
693
|
+
process.stdout.write('\nRules that checked nothing:\n');
|
|
694
|
+
for (const sk of report.skipped) {
|
|
695
|
+
process.stdout.write(` ${sk.failed ? '✗' : '–'} ${sk.ruleId} ${sk.failed ? 'FAILED' : 'SKIPPED'} — ${sk.reason}\n`);
|
|
696
|
+
}
|
|
697
|
+
if (report.skipped.some((sk) => !sk.failed)) {
|
|
698
|
+
process.stdout.write(' Fix the selector, or set `failOnEmpty: true` once the rule is known to have\n' +
|
|
699
|
+
' real subjects. Run `shrk gates coverage` to audit every plane at once.\n');
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
// A sink that extracted 0 ids while the source had some is a real failure, but
|
|
703
|
+
// almost always a stale SINK glob — say so instead of listing N "unwired"
|
|
704
|
+
// tokens with no explanation.
|
|
705
|
+
for (const r of report.rules) {
|
|
706
|
+
if (!r.emptySink)
|
|
707
|
+
continue;
|
|
708
|
+
process.stdout.write(`\n ! ${r.ruleId}: the registered side extracted 0 ids while ${r.declaredCount} were declared —\n` +
|
|
709
|
+
` every declared token "fails". Check the registered glob before chasing the tokens.\n`);
|
|
710
|
+
}
|
|
689
711
|
if (report.violations.length === 0 && report.diagnostics.length === 0) {
|
|
712
|
+
// A failOnEmpty skip produces no violation object but IS a failure.
|
|
713
|
+
if (report.verdict === 'errors')
|
|
714
|
+
return ExitCode.Failure;
|
|
690
715
|
if (allEvaluated) {
|
|
691
716
|
// Every configured rule ran — the earned full green.
|
|
692
717
|
process.stdout.write('\nNo wiring violations — every declared token is registered. ✓\n');
|
|
@@ -709,7 +734,9 @@ async function checkWiring(args) {
|
|
|
709
734
|
process.stdout.write(`\n[${r.severity}] ${r.ruleId}${r.description ? ' — ' + r.description : ''}\n`);
|
|
710
735
|
process.stdout.write(` declared ${r.declaredCount} / registered ${r.registeredCount} — ${r.violations.length} not wired:\n`);
|
|
711
736
|
for (const v of r.violations.slice(0, 50)) {
|
|
712
|
-
|
|
737
|
+
const where = `(${v.file}:${v.line})`;
|
|
738
|
+
const hop = v.hop !== undefined ? ` [hop ${v.hop}]` : '';
|
|
739
|
+
process.stdout.write(v.message ? ` • ${v.message} ${where}${hop}\n` : ` • ${v.token} ${where}${hop}\n`);
|
|
713
740
|
}
|
|
714
741
|
if (r.violations.length > 50) {
|
|
715
742
|
process.stdout.write(` … (${r.violations.length - 50} more)\n`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/command-catalog.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,cAAc;IACtB,iBAAiB,mBAAmB;IACpC,gBAAgB,kBAAkB;IAClC,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,cAAc,oBAAoB;C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SAAS,eAAe,EAAE,CAAC;IAC9C,kCAAkC;IAClC,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,6DAA6D;IAC7D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,0DAA0D;IAC1D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,oBAAoB,
|
|
1
|
+
{"version":3,"file":"command-catalog.d.ts","sourceRoot":"","sources":["../../src/commands/command-catalog.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,QAAQ,cAAc;IACtB,iBAAiB,mBAAmB;IACpC,gBAAgB,kBAAkB;IAClC,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,cAAc,oBAAoB;CACnC;AAED;;;;;;GAMG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;CAClB;AAED,8BAA8B;AAC9B,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,EAAE,OAAO;IACT,UAAU,gBAAgB;IAC1B,UAAU,eAAe;CAC1B;AAED;;;;;;GAMG;AACH,oBAA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AC,CAAC,EAAE,oBAAoB,GAAG,gBAAgB,CAQ1E;AAwFD;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAclE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,oBAAoB,EAAE,CAgBnE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAwC9D;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,wBAAwB,IAAI,SAAS,uBAAuB,EAAE,CAsB7E;AAED,wBAAgB,iCAAiC,CAC/C,IAAI,EAAE,SAAS,uBAAuB,EAAE,GACvC,MAAM,CAaR;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,CAAC,MAAM,CAAC,CAW/C"}
|
|
@@ -406,6 +406,118 @@ export const COMMAND_CATALOG = Object.freeze([
|
|
|
406
406
|
surface: CommandSurface.Common,
|
|
407
407
|
taskRole: CommandTaskRole.Validate,
|
|
408
408
|
}),
|
|
409
|
+
entry({
|
|
410
|
+
command: 'policy-lint explain',
|
|
411
|
+
description: 'Dry-run ONE policyRule and print every hit with file:line — INCLUDING the hits an exemption (exemptFiles / exemptLines) or the lexical scan zone dropped, each labelled with which one applied. The author-loop view of what the gate sees. [--json]',
|
|
412
|
+
category: 'core',
|
|
413
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
414
|
+
surface: CommandSurface.Advanced,
|
|
415
|
+
taskRole: CommandTaskRole.Explain,
|
|
416
|
+
}),
|
|
417
|
+
entry({
|
|
418
|
+
command: 'registry duplicates',
|
|
419
|
+
description: 'Ids declared more than once across roots in a config-defined registry — a latent bug the compiler cannot see (whichever registration wins at runtime is an accident of load order). Every declaration site is reported. Exit 1 on duplicates, 2 when the registry matched 0 ids. [--json]',
|
|
420
|
+
category: 'core',
|
|
421
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
422
|
+
surface: CommandSurface.Common,
|
|
423
|
+
taskRole: CommandTaskRole.Validate,
|
|
424
|
+
}),
|
|
425
|
+
entry({
|
|
426
|
+
command: 'gates list',
|
|
427
|
+
description: 'Every data-defined rule across every plane (wiring / policy / registry / registration / baseline / generated) with its severity and empty-match policy. [--plane <p>] [--json]',
|
|
428
|
+
category: 'core',
|
|
429
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
430
|
+
surface: CommandSurface.Common,
|
|
431
|
+
taskRole: CommandTaskRole.Inspect,
|
|
432
|
+
}),
|
|
433
|
+
entry({
|
|
434
|
+
command: 'gates coverage',
|
|
435
|
+
description: 'The stale-selector detector: what every data-defined rule actually MATCHED against the live tree, flagging each rule that matched 0 files/ids (a rule matching nothing is a bug in the rule, never a pass) and running each rule\'s declared selfTest expectations. Run it in CI so a rule quietly dying is itself a failure. Exit 2 when a rule matched nothing, 1 when it set failOnEmpty. [--plane <p>] [--json]',
|
|
436
|
+
category: 'core',
|
|
437
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
438
|
+
surface: CommandSurface.Common,
|
|
439
|
+
taskRole: CommandTaskRole.Validate,
|
|
440
|
+
}),
|
|
441
|
+
entry({
|
|
442
|
+
command: 'gates explain',
|
|
443
|
+
description: 'Universal rule introspection: for a rule of ANY plane, print the concrete inputs it resolved — files matched, ids extracted with file:line, and the computed diff. Dispatches to the plane-specific explainer. [--plane <p>] [--json]',
|
|
444
|
+
category: 'core',
|
|
445
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
446
|
+
surface: CommandSurface.Advanced,
|
|
447
|
+
taskRole: CommandTaskRole.Explain,
|
|
448
|
+
}),
|
|
449
|
+
entry({
|
|
450
|
+
command: 'baseline list',
|
|
451
|
+
description: 'Every declared baseline: what it pins, how it recomputes, and which direction of drift fails. [--json]',
|
|
452
|
+
category: 'core',
|
|
453
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
454
|
+
surface: CommandSurface.Common,
|
|
455
|
+
taskRole: CommandTaskRole.Inspect,
|
|
456
|
+
}),
|
|
457
|
+
entry({
|
|
458
|
+
command: 'baseline check',
|
|
459
|
+
description: 'Recompute every committed baseline (adoption ledger / API digest / coverage ratchet / allow-list) and fail on drift. TWO-WAY by default: a silently LOST entry fails exactly like a gained one. Rules from sharkcraft.config.ts baselines[]. Runs the declared compute command for `kind: "command"` rules. [--id X] [--changed-only] [--json]',
|
|
460
|
+
category: 'core',
|
|
461
|
+
safetyLevel: SafetyLevel.RunsShell,
|
|
462
|
+
surface: CommandSurface.Common,
|
|
463
|
+
taskRole: CommandTaskRole.Validate,
|
|
464
|
+
}),
|
|
465
|
+
entry({
|
|
466
|
+
command: 'baseline diff',
|
|
467
|
+
description: 'Human-readable +added / −removed for each baseline, without a verdict — the inspection verb. [--id X] [--json]',
|
|
468
|
+
category: 'core',
|
|
469
|
+
safetyLevel: SafetyLevel.RunsShell,
|
|
470
|
+
surface: CommandSurface.Advanced,
|
|
471
|
+
taskRole: CommandTaskRole.Explain,
|
|
472
|
+
}),
|
|
473
|
+
entry({
|
|
474
|
+
command: 'baseline update',
|
|
475
|
+
description: 'Rewrite a committed baseline from the current value — the explicit, reviewable bless step (deliberately a separate verb from `check` so a drift can never be blessed by accident). Writes files. [--id X] [--dry-run] [--json]',
|
|
476
|
+
category: 'core',
|
|
477
|
+
safetyLevel: SafetyLevel.WritesSource,
|
|
478
|
+
surface: CommandSurface.Common,
|
|
479
|
+
taskRole: CommandTaskRole.Apply,
|
|
480
|
+
}),
|
|
481
|
+
entry({
|
|
482
|
+
command: 'baseline explain',
|
|
483
|
+
description: 'What ONE baseline computes and compares — the command or extractor, the canonical form, both entry counts, and the diff — without turning it into a verdict. [--id X] [--json]',
|
|
484
|
+
category: 'core',
|
|
485
|
+
safetyLevel: SafetyLevel.RunsShell,
|
|
486
|
+
surface: CommandSurface.Advanced,
|
|
487
|
+
taskRole: CommandTaskRole.Explain,
|
|
488
|
+
}),
|
|
489
|
+
entry({
|
|
490
|
+
command: 'generated list',
|
|
491
|
+
description: 'Every declared generated-artifact rule: its globs, regen command, and "do not edit" header contract. [--json]',
|
|
492
|
+
category: 'core',
|
|
493
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
494
|
+
surface: CommandSurface.Common,
|
|
495
|
+
taskRole: CommandTaskRole.Inspect,
|
|
496
|
+
}),
|
|
497
|
+
entry({
|
|
498
|
+
command: 'generated check',
|
|
499
|
+
description: 'Regenerate into a temp dir and diff BOTH ways — catching a hand-edited generated file AND a regen that writes a subset — plus the provenance-header contract (missing header on a generated file, header on a hand-written one). `--headers-only` never spawns. Rules from sharkcraft.config.ts generatedArtifacts[]. [--id X] [--headers-only] [--json]',
|
|
500
|
+
category: 'core',
|
|
501
|
+
safetyLevel: SafetyLevel.RunsShell,
|
|
502
|
+
surface: CommandSurface.Common,
|
|
503
|
+
taskRole: CommandTaskRole.Validate,
|
|
504
|
+
}),
|
|
505
|
+
entry({
|
|
506
|
+
command: 'generated update',
|
|
507
|
+
description: 'Run the declared regen command in place — the one-command bless step after an intentional source change. Writes files. [--id X] [--json]',
|
|
508
|
+
category: 'core',
|
|
509
|
+
safetyLevel: SafetyLevel.WritesSource,
|
|
510
|
+
surface: CommandSurface.Common,
|
|
511
|
+
taskRole: CommandTaskRole.Apply,
|
|
512
|
+
}),
|
|
513
|
+
entry({
|
|
514
|
+
command: 'generated explain',
|
|
515
|
+
description: 'What ONE generated-artifact rule sees right now: files matched, header-contract results, mislabel candidates — without running the regen. [--id X] [--json]',
|
|
516
|
+
category: 'core',
|
|
517
|
+
safetyLevel: SafetyLevel.ReadOnly,
|
|
518
|
+
surface: CommandSurface.Advanced,
|
|
519
|
+
taskRole: CommandTaskRole.Explain,
|
|
520
|
+
}),
|
|
409
521
|
entry({
|
|
410
522
|
command: 'wiring explain',
|
|
411
523
|
description: 'Dry-run ONE configured wiringRule and print the declared set + registered set it extracts (token + file:line), the alias-resolved set-difference, and the verdict — the author-loop view of what `check wiring` sees, without re-running the gate. [--json]',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type IAiProvider } from '@shrkcrft/ai';
|
|
1
|
+
import { type IAiProvider, type IQueryDescriptor, type QueryExecutor } from '@shrkcrft/ai';
|
|
2
2
|
import { type IDelegateRecipe } from '@shrkcrft/config';
|
|
3
|
+
import { type IDelegateAnalysisReport, type IDelegateFailureContext, type IGroundingFacts, type IResolvedDelegateRecipe, type ISharkcraftInspection } from '@shrkcrft/inspector';
|
|
3
4
|
import { type IDroppedOp } from '@shrkcrft/generator';
|
|
4
5
|
import { type ICommandHandler } from '../command-registry.js';
|
|
5
6
|
export type DelegateRunStatus = 'no-provider' | 'generate-failed' | 'guardrail-refused' | 'package-error' | 'conflicts' | 'sign-failed' | 'no-verification' | 'generated' | 'applied' | 'apply-failed' | 'verify-failed';
|
|
@@ -16,6 +17,14 @@ export interface IExecuteDelegateRunInput {
|
|
|
16
17
|
planSecret?: string;
|
|
17
18
|
/** Validation report dir. Default `.sharkcraft/delegate/reports`. */
|
|
18
19
|
reportDir?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional retry advisor (Phase 2, `--assisted-retry`). Between retryable
|
|
22
|
+
* failures it may return a corrected-instruction string, appended to the
|
|
23
|
+
* deterministic retry feedback. Best-effort: a null return / throw is ignored,
|
|
24
|
+
* so the deterministic loop is never blocked by the advisor. Injectable for
|
|
25
|
+
* tests; the cli wires one from a `retry-analysis` recipe.
|
|
26
|
+
*/
|
|
27
|
+
retryAdvisor?: (failure: IDelegateFailureContext, attempt: number) => Promise<string | null>;
|
|
19
28
|
}
|
|
20
29
|
export interface IExecuteDelegateRunResult {
|
|
21
30
|
status: DelegateRunStatus;
|
|
@@ -61,5 +70,71 @@ export declare function gatherRecipeContext(projectRoot: string, recipe: IDelega
|
|
|
61
70
|
* retried. Takes an already-resolved recipe + provider so tests inject a fake.
|
|
62
71
|
*/
|
|
63
72
|
export declare function executeDelegateRun(input: IExecuteDelegateRunInput): Promise<IExecuteDelegateRunResult>;
|
|
73
|
+
export type DelegateAnalyzeStatus = 'no-provider' | 'analyze-failed' | 'analyzed';
|
|
74
|
+
export interface IExecuteDelegateAnalyzeInput {
|
|
75
|
+
task: string;
|
|
76
|
+
/** An analysis recipe (mode === 'analysis'); its provider/model are folded. */
|
|
77
|
+
recipe: IResolvedDelegateRecipe;
|
|
78
|
+
/** The deterministic ground truth produced by `runGroundingReport`. */
|
|
79
|
+
facts: IGroundingFacts;
|
|
80
|
+
/** Injectable for tests; `null` means no local LLM is reachable. */
|
|
81
|
+
provider: IAiProvider | null;
|
|
82
|
+
/** Drop non-grounded findings instead of keeping+flagging them. */
|
|
83
|
+
strict?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Read-only query executor for the bounded query loop (Phase 3). Injected by
|
|
86
|
+
* the cli from the inspection; absent (or a recipe with no `allowedQueries` /
|
|
87
|
+
* `maxQueryRounds`) ⇒ single-shot analysis. Tests inject a fake.
|
|
88
|
+
*/
|
|
89
|
+
queryExecutor?: QueryExecutor;
|
|
90
|
+
/** Human-readable provider label for the report when no model id is returned. */
|
|
91
|
+
providerLabel: string;
|
|
92
|
+
/** Timestamp source (kept out of the core so tests are deterministic). */
|
|
93
|
+
generatedAt: string;
|
|
94
|
+
}
|
|
95
|
+
/** Human descriptions of the read-only queries shown to the model in the loop. */
|
|
96
|
+
export declare const DELEGATE_QUERY_CATALOG: readonly IQueryDescriptor[];
|
|
97
|
+
/**
|
|
98
|
+
* Build the read-only query executor: maps each `DELEGATE_QUERY_IDS` value to a
|
|
99
|
+
* deterministic inspector function. Every query is read-only — there is no
|
|
100
|
+
* write/apply query. Returns compact text + the entities it surfaced (merged
|
|
101
|
+
* into the analysis ground truth so a finding citing a pulled fact is grounded).
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildAnalysisQueryExecutor(inspection: ISharkcraftInspection, task: string): QueryExecutor;
|
|
104
|
+
export interface IExecuteDelegateAnalyzeResult {
|
|
105
|
+
status: DelegateAnalyzeStatus;
|
|
106
|
+
recipeId: string;
|
|
107
|
+
report: IDelegateAnalysisReport;
|
|
108
|
+
usage?: {
|
|
109
|
+
inputTokens?: number;
|
|
110
|
+
outputTokens?: number;
|
|
111
|
+
};
|
|
112
|
+
retried?: boolean;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The testable analysis core (no I/O beyond the injected provider). Runs the
|
|
116
|
+
* model on the deterministic ground truth, cross-checks its findings, and
|
|
117
|
+
* assembles the advisory report. NEVER writes — analysis mode is read-only.
|
|
118
|
+
* `provider === null` degrades to a deterministic grounding-only report (ok).
|
|
119
|
+
*/
|
|
120
|
+
export declare function executeDelegateAnalyze(input: IExecuteDelegateAnalyzeInput): Promise<IExecuteDelegateAnalyzeResult>;
|
|
121
|
+
/** The single corrected instruction to feed back: a grounded finding wins. */
|
|
122
|
+
export declare function correctedInstruction(report: IDelegateAnalysisReport): string | null;
|
|
123
|
+
export interface IRetryAdvisorDeps {
|
|
124
|
+
/** A `mode: 'analysis'`, `groundedOn: 'delegate-failure'` recipe. */
|
|
125
|
+
retryRecipe: IResolvedDelegateRecipe;
|
|
126
|
+
provider: IAiProvider | null;
|
|
127
|
+
providerLabel: string;
|
|
128
|
+
/** The patch recipe being retried (named in the advisor prompt). */
|
|
129
|
+
patchRecipeId: string;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Build a retry advisor from a `retry-analysis` recipe: it grounds on the failed
|
|
133
|
+
* attempt (`buildDelegateFailureFacts`), runs the analysis model, and returns the
|
|
134
|
+
* single corrected instruction. Read-only — it never writes; a null provider or
|
|
135
|
+
* an empty analysis yields `null` (no enrichment). The corrected instruction is
|
|
136
|
+
* cross-checked against the failure ground truth just like any analysis finding.
|
|
137
|
+
*/
|
|
138
|
+
export declare function buildRetryAnalysisAdvisor(deps: IRetryAdvisorDeps): (failure: IDelegateFailureContext, attempt: number) => Promise<string | null>;
|
|
64
139
|
export declare const delegateCommand: ICommandHandler;
|
|
65
140
|
//# sourceMappingURL=delegate.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegate.command.d.ts","sourceRoot":"","sources":["../../src/commands/delegate.command.ts"],"names":[],"mappings":"AAgBA,OAAO,
|
|
1
|
+
{"version":3,"file":"delegate.command.d.ts","sourceRoot":"","sources":["../../src/commands/delegate.command.ts"],"names":[],"mappings":"AAgBA,OAAO,EAWL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAqB,KAAK,eAAe,EAA0B,MAAM,kBAAkB,CAAC;AAInG,OAAO,EAYL,KAAK,uBAAuB,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAOL,KAAK,UAAU,EAChB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAIL,KAAK,eAAe,EAErB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,iBAAiB,GACjB,mBAAmB,GACnB,eAAe,GACf,WAAW,GACX,aAAa,GACb,iBAAiB,GACjB,WAAW,GACX,SAAS,GACT,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB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