vigiles 29.1.0 → 30.0.1

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.
Files changed (122) hide show
  1. package/dist/adapter-conformance.d.ts +1 -1
  2. package/dist/adapter-conformance.js +106 -25
  3. package/dist/adapter-registry.d.ts +61 -14
  4. package/dist/adapter-registry.js +78 -10
  5. package/dist/adapter.d.ts +23 -2
  6. package/dist/adapter.js +13 -1
  7. package/dist/adapters/claude-code/adapter.d.ts +32 -2
  8. package/dist/adapters/claude-code/adapter.js +44 -23
  9. package/dist/adapters/claude-code/agent-runtime.js +3 -1
  10. package/dist/adapters/claude-code/dialect.js +87 -21
  11. package/dist/adapters/claude-code/effect-region.js +3 -1
  12. package/dist/adapters/claude-code/hook-protocol.js +16 -0
  13. package/dist/adapters/claude-code/instruction-chain.d.ts +25 -0
  14. package/dist/adapters/claude-code/instruction-chain.js +626 -0
  15. package/dist/adapters/claude-code/layout.d.ts +2 -2
  16. package/dist/adapters/claude-code/layout.js +42 -8
  17. package/dist/adapters/claude-code/model-access.d.ts +41 -0
  18. package/dist/adapters/claude-code/model-access.js +46 -0
  19. package/dist/adapters/claude-code/skill-reachability.d.ts +125 -0
  20. package/dist/adapters/claude-code/skill-reachability.js +111 -0
  21. package/dist/adapters/claude-code/skill-runtime.js +3 -1
  22. package/dist/adapters/codex/adapter.d.ts +39 -2
  23. package/dist/adapters/codex/adapter.js +29 -29
  24. package/dist/adapters/codex/dialect.js +11 -6
  25. package/dist/adapters/codex/eval.d.ts +10 -0
  26. package/dist/adapters/codex/eval.js +48 -1
  27. package/dist/adapters/codex/hook-protocol.d.ts +2 -1
  28. package/dist/adapters/codex/hook-protocol.js +10 -0
  29. package/dist/adapters/codex/instruction-chain.d.ts +40 -0
  30. package/dist/adapters/codex/instruction-chain.js +105 -0
  31. package/dist/adapters/codex/layout.d.ts +1 -1
  32. package/dist/adapters/codex/layout.js +41 -14
  33. package/dist/adapters/opencode/adapter.d.ts +33 -2
  34. package/dist/adapters/opencode/adapter.js +36 -36
  35. package/dist/adapters/opencode/dialect.js +2 -2
  36. package/dist/adapters/opencode/instruction-chain.d.ts +37 -0
  37. package/dist/adapters/opencode/instruction-chain.js +70 -0
  38. package/dist/adapters/opencode/layout.d.ts +19 -0
  39. package/dist/adapters/opencode/layout.js +34 -15
  40. package/dist/adoptability.d.ts +31 -1
  41. package/dist/adoptability.js +57 -0
  42. package/dist/cli-main.js +185 -102
  43. package/dist/core/adapter.d.ts +213 -61
  44. package/dist/core/compile.d.ts +2 -2
  45. package/dist/core/compile.js +57 -46
  46. package/dist/core/compose.d.ts +5 -3
  47. package/dist/core/compose.js +5 -3
  48. package/dist/core/config-schema.d.ts +14 -2
  49. package/dist/core/config-schema.js +20 -7
  50. package/dist/core/dialect.d.ts +54 -12
  51. package/dist/core/dialect.js +56 -0
  52. package/dist/core/eval-driver.d.ts +194 -0
  53. package/dist/core/eval-driver.js +3 -0
  54. package/dist/core/frontmatter-read.d.ts +10 -0
  55. package/dist/core/frontmatter-read.js +30 -3
  56. package/dist/core/guards.js +3 -1
  57. package/dist/core/hook-program.d.ts +27 -2
  58. package/dist/core/hook-program.js +29 -24
  59. package/dist/core/hook-protocol.d.ts +54 -0
  60. package/dist/core/install-reader.d.ts +18 -0
  61. package/dist/core/install-reader.js +88 -0
  62. package/dist/core/instruction-chain.d.ts +444 -0
  63. package/dist/core/instruction-chain.js +292 -0
  64. package/dist/core/instruction-weight.d.ts +96 -14
  65. package/dist/core/instruction-weight.js +65 -30
  66. package/dist/core/layout.d.ts +220 -33
  67. package/dist/core/layout.js +115 -1
  68. package/dist/core/lethal-trifecta.d.ts +12 -7
  69. package/dist/core/lethal-trifecta.js +13 -13
  70. package/dist/core/live-driver.d.ts +137 -0
  71. package/dist/core/live-driver.js +14 -0
  72. package/dist/core/markdown.d.ts +23 -0
  73. package/dist/core/markdown.js +77 -28
  74. package/dist/core/orphans.js +9 -7
  75. package/dist/core/settings-codec.d.ts +17 -0
  76. package/dist/core/settings-codec.js +56 -0
  77. package/dist/core/surface-discovery.d.ts +2 -2
  78. package/dist/core/surface-discovery.js +24 -12
  79. package/dist/core/surface-scopes.d.ts +26 -6
  80. package/dist/core/surface-scopes.js +52 -11
  81. package/dist/core/validate.js +16 -3
  82. package/dist/coverage-artifact.d.ts +3 -2
  83. package/dist/coverage-artifact.js +6 -5
  84. package/dist/eval-cache.d.ts +6 -1
  85. package/dist/eval-cache.js +11 -1
  86. package/dist/eval.d.ts +16 -108
  87. package/dist/eval.js +36 -2
  88. package/dist/harness-test.d.ts +3 -63
  89. package/dist/hook-install.d.ts +12 -1
  90. package/dist/hook-install.js +12 -1
  91. package/dist/hook-runtime.js +4 -2
  92. package/dist/hook-state-store.js +3 -1
  93. package/dist/local-files-tracked.d.ts +17 -0
  94. package/dist/local-files-tracked.js +70 -0
  95. package/dist/local-files.d.ts +62 -0
  96. package/dist/local-files.js +183 -0
  97. package/dist/observe.d.ts +3 -2
  98. package/dist/observe.js +7 -6
  99. package/dist/plugin-loader.d.ts +1 -1
  100. package/dist/plugin-loader.js +43 -36
  101. package/dist/scan-behavioral.d.ts +34 -25
  102. package/dist/scan-behavioral.js +122 -58
  103. package/dist/scan-core.js +37 -18
  104. package/dist/scan-files.d.ts +1 -1
  105. package/dist/scan-files.js +53 -33
  106. package/dist/scan-trigger-suggest.d.ts +0 -21
  107. package/dist/scan-trigger-suggest.js +0 -23
  108. package/dist/scan.d.ts +4 -4
  109. package/dist/scan.js +120 -84
  110. package/dist/skill-harness.d.ts +21 -5
  111. package/dist/skill-harness.js +29 -11
  112. package/dist/surface-discovery-fs.d.ts +2 -0
  113. package/dist/surface-discovery-fs.js +108 -6
  114. package/dist/test-coverage-files.js +24 -17
  115. package/dist/test-coverage.d.ts +9 -3
  116. package/dist/test-coverage.js +32 -22
  117. package/dist/verify-plugin-guards.js +1 -1
  118. package/package.json +1 -1
  119. package/dist/skill-reachability.d.ts +0 -68
  120. package/dist/skill-reachability.js +0 -205
  121. /package/dist/{dialect-drift.d.ts → adapters/claude-code/dialect-drift.d.ts} +0 -0
  122. /package/dist/{dialect-drift.js → adapters/claude-code/dialect-drift.js} +0 -0
@@ -1,28 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.opencodeLayout = void 0;
4
+ const instruction_chain_js_1 = require("../../core/instruction-chain.js");
5
+ const settings_codec_js_1 = require("../../core/settings-codec.js");
6
+ const instruction_chain_js_2 = require("./instruction-chain.js");
4
7
  exports.opencodeLayout = {
5
8
  name: "opencode",
6
9
  manifestPath: "opencode.json",
7
- // Vestigial: OpenCode hooks are JS plugin modules under `.opencode/plugin`, not
8
- // shell-hook settings, so the shell-hook settings round-trip does NOT apply here
9
- // (the adapter declares shellHooks:false; assertAdapterLoadsHooks is skipped).
10
- hooksConventionPath: ".opencode/plugin",
10
+ // No `hooksConventionPath`: OpenCode hooks are JS plugin modules under
11
+ // `.opencode/plugin`, which is a DIRECTORY. The field names a standalone
12
+ // hooks FILE, and every reader treats it as one (dirname it, parse it,
13
+ // round-trip it), so naming a directory there made each of them wrong about
14
+ // it. The field is optional now and this layout omits it; the adapter already
15
+ // declares `shellHooks: false`, so no shell-hook reader asks.
11
16
  settingsPath: "opencode.json",
12
- settingsFormat: "json",
17
+ settings: settings_codec_js_1.jsonSettingsCodec,
13
18
  instructionFile: "AGENTS.md",
14
- // OpenCode's surfaces already live UNDER `.opencode/` at the source, so they
15
- // are NOT relocated — materializeRoot is "" (no prefix) to avoid doubling the
16
- // `.opencode/` segment. (Contrast Claude Code: root-level `skills/` surfaces
17
- // relocated under `.claude`.)
18
- surfaceDirs: [".opencode/agent", ".opencode/command"],
19
- skillDir: ".opencode/skill",
20
- agentDir: ".opencode/agent",
21
- commandDir: ".opencode/command",
22
- materializeRoot: "",
19
+ surfaces: {
20
+ skill: ".opencode/skill",
21
+ agent: ".opencode/agent",
22
+ command: ".opencode/command",
23
+ },
24
+ // No `userSurfaceRoot`: OpenCode's surfaces already live UNDER `.opencode/`
25
+ // at the source, so they are NOT relocated and the materialize prefix is ""
26
+ // (doubling the `.opencode/` segment is what a prefix here would do).
27
+ // Contrast Claude Code: root-level `skills/` surfaces relocated under
28
+ // `.claude`.
29
+ //
30
+ // No `hookScriptsDir`: there are no hook SCRIPTS to scan — the hooks are
31
+ // in-process code modules, which is the same fact `shellHooks: false` states
32
+ // on the adapter.
23
33
  pluginRootToken: "${OPENCODE_PLUGIN_ROOT}",
24
34
  mcpConfigFile: "opencode.json",
25
35
  mcpManifestKey: "mcp",
26
- intraRefDirs: [".opencode/agent", ".opencode/command"],
36
+ // The root file plus whatever `opencode.json#instructions` names: a concrete
37
+ // path is an import, a glob is a PATTERN that is reported and never walked.
38
+ // This is the only implementation here that populates `patterns`.
39
+ instructionChain(files) {
40
+ return (0, instruction_chain_js_2.opencodeInstructionChain)(files, {
41
+ instructionFile: exports.opencodeLayout.instructionFile,
42
+ settingsPaths: (0, instruction_chain_js_1.settingsSourcePaths)(exports.opencodeLayout),
43
+ parseSettings: (text) => exports.opencodeLayout.settings.parse(text),
44
+ });
45
+ },
27
46
  };
28
47
  //# sourceMappingURL=layout.js.map
@@ -1,4 +1,11 @@
1
- import { type AgentRunner, type ModelOutputParser } from "./eval.js";
1
+ import { type AgentRunner, type ModelOutputParser, type EvalDriver, type RunOut } from "./eval.js";
2
+ /**
3
+ * The harness CLI did not run, as distinct from running and finding nothing.
4
+ * A named class so the caller can tell the two apart without matching prose.
5
+ */
6
+ export declare class DraftRunFailed extends Error {
7
+ constructor(reason: string);
8
+ }
2
9
  /** A reference the model proposes as machine-verifiable. */
3
10
  export interface DraftedRef {
4
11
  readonly kind: "enforce" | "file" | "cmd" | "dir";
@@ -36,9 +43,32 @@ export interface DraftOptions {
36
43
  readonly cwd?: string;
37
44
  readonly runner?: AgentRunner;
38
45
  readonly parse?: ModelOutputParser;
46
+ /**
47
+ * The driver's own reader for a failure the exit code does not carry — a
48
+ * refusal, or a turn error inside a zero-exit run. Supplied by
49
+ * {@link draftWith}; absent means the exit code is the only signal.
50
+ */
51
+ readonly runError?: (out: RunOut) => string | null;
39
52
  }
40
53
  /** Injectable drafter — the real one calls a model; tests pass a fake. */
41
54
  export type Drafter = (content: string) => Promise<DraftedRef[]>;
55
+ /**
56
+ * Build the real drafter from a harness's EVAL DRIVER, instead of the hard-wired
57
+ * `spawnAgent` + `parseClaudeRun` defaults above.
58
+ *
59
+ * 🔴 THIS IS WHY THE PREVIEW IS NOT CLAUDE-CODE-ONLY. `defaultDraft`'s two
60
+ * defaults ARE the two members of the Claude eval driver, and nothing else in
61
+ * the drafter is harness-specific: the prompt is over an instruction file's
62
+ * prose, and prose is prose. The VERIFIER is deterministic and harness-free
63
+ * ("LLM proposes, deterministic disposes", this file's header), so "M broken
64
+ * right now" is exactly as trustworthy driven by one harness as by another;
65
+ * only the draft's RECALL varies by model, which it already does across models
66
+ * of the same harness.
67
+ *
68
+ * `model` is passed through to whichever runner: the trigger tier already does
69
+ * this, and a runner that does not understand the alias ignores it.
70
+ */
71
+ export declare function draftWith(driver: EvalDriver, opts?: DraftOptions): Drafter;
42
72
  export interface AdoptabilityTierOptions {
43
73
  readonly instructionContent: string;
44
74
  readonly basePath: string;
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DraftRunFailed = void 0;
3
4
  exports.verifyDraftedRefs = verifyDraftedRefs;
4
5
  exports.parseDraftJson = parseDraftJson;
6
+ exports.draftWith = draftWith;
5
7
  exports.runAdoptabilityTier = runAdoptabilityTier;
6
8
  exports.formatAdoptability = formatAdoptability;
7
9
  /**
@@ -26,6 +28,17 @@ const linters_js_1 = require("./core/linters.js");
26
28
  const compile_js_1 = require("./core/compile.js");
27
29
  const hash_js_1 = require("./core/hash.js");
28
30
  const eval_js_1 = require("./eval.js");
31
+ /**
32
+ * The harness CLI did not run, as distinct from running and finding nothing.
33
+ * A named class so the caller can tell the two apart without matching prose.
34
+ */
35
+ class DraftRunFailed extends Error {
36
+ constructor(reason) {
37
+ super(`could not run the drafting model — ${reason}`);
38
+ this.name = "DraftRunFailed";
39
+ }
40
+ }
41
+ exports.DraftRunFailed = DraftRunFailed;
29
42
  /** Verify ONE drafted ref against the real repo; null = resolves, else the breakage. */
30
43
  function verifyOne(r, basePath) {
31
44
  switch (r.kind) {
@@ -163,8 +176,52 @@ async function defaultDraft(content, opts = {}) {
163
176
  timeoutMs: 120000,
164
177
  env: process.env,
165
178
  });
179
+ // 🔴 THE EXIT CODE IS READ, AND IT WAS NOT. A runner that could not start the
180
+ // harness binary returns code 1 with empty stdout; `parse` then yields no
181
+ // output, `parseDraftJson` yields `[]`, and the report prints "no
182
+ // machine-verifiable references found" — a valid-looking answer to a question
183
+ // nothing ever asked. Found on review of #265: the unconditional
184
+ // `subscription` on the Codex driver lets this path run with no binary
185
+ // present, and unlike the behavioral probe there is nothing here that
186
+ // self-reports unavailability.
187
+ //
188
+ // Thrown rather than returned empty, because "the run failed" and "the model
189
+ // found nothing" are different answers and the caller has to be able to say
190
+ // which. `runError` is the driver's own reader for a failure the exit code
191
+ // does not carry — a refusal or a turn error inside a zero-exit run.
192
+ if (out.code !== 0) {
193
+ throw new DraftRunFailed(`the harness CLI exited ${String(out.code)}${out.stderr ? `: ${out.stderr.trim().slice(0, 200)}` : " with no output"}`);
194
+ }
195
+ const driverError = opts.runError?.(out);
196
+ if (driverError !== null && driverError !== undefined) {
197
+ throw new DraftRunFailed(driverError);
198
+ }
166
199
  return parseDraftJson(parse(out).output);
167
200
  }
201
+ /**
202
+ * Build the real drafter from a harness's EVAL DRIVER, instead of the hard-wired
203
+ * `spawnAgent` + `parseClaudeRun` defaults above.
204
+ *
205
+ * 🔴 THIS IS WHY THE PREVIEW IS NOT CLAUDE-CODE-ONLY. `defaultDraft`'s two
206
+ * defaults ARE the two members of the Claude eval driver, and nothing else in
207
+ * the drafter is harness-specific: the prompt is over an instruction file's
208
+ * prose, and prose is prose. The VERIFIER is deterministic and harness-free
209
+ * ("LLM proposes, deterministic disposes", this file's header), so "M broken
210
+ * right now" is exactly as trustworthy driven by one harness as by another;
211
+ * only the draft's RECALL varies by model, which it already does across models
212
+ * of the same harness.
213
+ *
214
+ * `model` is passed through to whichever runner: the trigger tier already does
215
+ * this, and a runner that does not understand the alias ignores it.
216
+ */
217
+ function draftWith(driver, opts = {}) {
218
+ return (content) => defaultDraft(content, {
219
+ ...opts,
220
+ runner: driver.runner,
221
+ parse: driver.parse,
222
+ runError: driver.runError,
223
+ });
224
+ }
168
225
  /**
169
226
  * Run the preview: draft refs from the instruction file (model), then verify them
170
227
  * (deterministic). The composition root of "LLM proposes, deterministic disposes".