create-agdf 0.11.4 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -1
  2. package/generated/.agdf/control/templates/artefacts/BROWNFIELD_REVIEW.md +25 -0
  3. package/generated/.github/skills/agdf-brownfield-analysis/SKILL.md +26 -0
  4. package/generated/.github/skills/agdf-gate-check/SKILL.md +40 -18
  5. package/generated/.github/skills/agdf-interaction-locales.json +50 -0
  6. package/generated/.github/skills/agdf-runtime-contract.md +1 -0
  7. package/generated/.github/skills/contracts/gate-transition.md +7 -3
  8. package/generated/.github/skills/contracts/interaction.md +22 -0
  9. package/generated/.github/skills/contracts/modes.md +81 -0
  10. package/generated/.github/skills/contracts/task-target-resolution.md +102 -0
  11. package/generated/.opencode/AGDF.md +2 -0
  12. package/generated/.opencode/agdf-interaction-locales.json +50 -0
  13. package/generated/.opencode/agdf-runtime-contract.md +1 -0
  14. package/generated/.opencode/contracts/gate-transition.md +7 -3
  15. package/generated/.opencode/contracts/interaction.md +22 -0
  16. package/generated/.opencode/contracts/modes.md +81 -0
  17. package/generated/.opencode/contracts/task-target-resolution.md +102 -0
  18. package/generated/.opencode/skills/agdf-brownfield-analysis/SKILL.md +26 -0
  19. package/generated/.opencode/skills/agdf-gate-check/SKILL.md +40 -18
  20. package/generated/AGENTS.md +1 -0
  21. package/generated/plugins/agdf/.claude-plugin/plugin.json +1 -1
  22. package/generated/plugins/agdf/.codex-plugin/plugin.json +1 -1
  23. package/generated/plugins/agdf/control/templates/artefacts/BROWNFIELD_REVIEW.md +25 -0
  24. package/generated/plugins/agdf/meta/agdf-agent-router.md +16 -0
  25. package/generated/plugins/agdf/meta/agdf-interaction-locales.json +50 -0
  26. package/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  27. package/generated/plugins/agdf/meta/agdf-runtime-contract.md +1 -0
  28. package/generated/plugins/agdf/meta/contracts/gate-transition.md +7 -3
  29. package/generated/plugins/agdf/meta/contracts/interaction.md +22 -0
  30. package/generated/plugins/agdf/meta/contracts/modes.md +81 -0
  31. package/generated/plugins/agdf/meta/contracts/task-target-resolution.md +102 -0
  32. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-interaction-locales.json +50 -0
  33. package/generated/plugins/agdf/runtime/create-agdf/generated/plugins/agdf/meta/agdf-plugin.definition.json +1 -1
  34. package/generated/plugins/agdf/runtime/create-agdf/lib/control-evaluation/gate-policy.js +14 -7
  35. package/generated/plugins/agdf/runtime/create-agdf/lib/interaction-presentation.js +85 -0
  36. package/generated/plugins/agdf/runtime/create-agdf/package.json +5 -2
  37. package/generated/plugins/agdf/runtime/runtime-manifest.json +2 -2
  38. package/generated/plugins/agdf/scripts/check-runtime-integrity.mjs +119 -3
  39. package/generated/plugins/agdf/skills/brownfield-analysis/SKILL.md +26 -0
  40. package/generated/plugins/agdf/skills/gate-check/SKILL.md +40 -18
  41. package/lib/cli/application.js +13 -2
  42. package/lib/control-evaluation/gate-policy.js +14 -7
  43. package/lib/installers/opencode.js +128 -1
  44. package/lib/interaction-presentation.js +85 -0
  45. package/lib/live-agent/read-only-structured.js +43 -0
  46. package/lib/proportionality-benchmark/blind-prompt.js +37 -0
  47. package/lib/proportionality-benchmark/contracts.js +120 -0
  48. package/lib/proportionality-benchmark/corpus-loader.js +110 -0
  49. package/lib/proportionality-benchmark/evaluator.js +250 -0
  50. package/lib/proportionality-benchmark/index.js +7 -0
  51. package/lib/proportionality-benchmark/live-recorder.js +100 -0
  52. package/lib/proportionality-benchmark/report.js +51 -0
  53. package/lib/proportionality-benchmark/source-fingerprint.js +30 -0
  54. package/lib/skill-evals/live-recorder.js +3 -26
  55. package/opencode-plugin.js +40 -1
  56. package/package.json +5 -2
@@ -0,0 +1,30 @@
1
+ import { createHash } from "node:crypto";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { stable } from "./contracts.js";
5
+
6
+ export const BEHAVIOR_SOURCES = Object.freeze([
7
+ "plugin/meta/agdf-agent-router.md",
8
+ "plugin/meta/contracts/modes.md",
9
+ "plugin/meta/contracts/gate-transition.md",
10
+ "plugin/meta/contracts/interaction.md",
11
+ "plugin/skills/gate-check/SKILL.md",
12
+ ]);
13
+ export const IMPLEMENTATION_SOURCES = Object.freeze([
14
+ "create-agdf/lib/live-agent/read-only-structured.js",
15
+ "create-agdf/lib/proportionality-benchmark/blind-prompt.js",
16
+ "create-agdf/lib/proportionality-benchmark/contracts.js",
17
+ "create-agdf/lib/proportionality-benchmark/corpus-loader.js",
18
+ "create-agdf/lib/proportionality-benchmark/evaluator.js",
19
+ "create-agdf/lib/proportionality-benchmark/live-recorder.js",
20
+ "create-agdf/lib/proportionality-benchmark/source-fingerprint.js",
21
+ ]);
22
+ export function behaviorSourceText(repoRoot) {
23
+ return BEHAVIOR_SOURCES.map((path) => `--- ${path} ---\n${readFileSync(join(repoRoot, path), "utf8")}`).join("\n\n");
24
+ }
25
+ export function sourceFingerprint(repoRoot, testCase, fixture, adapterVersion) {
26
+ const hash = createHash("sha256");
27
+ hash.update(JSON.stringify(stable({ testCase, fixture, adapterVersion })));
28
+ for (const path of [...BEHAVIOR_SOURCES, ...IMPLEMENTATION_SOURCES]) hash.update(path).update(readFileSync(join(repoRoot, path)));
29
+ return hash.digest("hex");
30
+ }
@@ -1,8 +1,7 @@
1
1
  import { execFileSync } from "node:child_process";
2
- import { mkdirSync, mkdtempSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
3
- import { tmpdir } from "node:os";
2
+ import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
4
3
  import { dirname, join } from "node:path";
5
- import { guardedExecFileSync } from "../delivery-path-search/transports/read-only-guard.js";
4
+ import { executeStructuredAgent } from "../live-agent/read-only-structured.js";
6
5
  import { gradeCase } from "./index.js";
7
6
  import { changedPaths, disposeFixture, materializeFixture, mutationViolations, snapshotWorkspace, workspaceEvidence } from "./workspace.js";
8
7
 
@@ -43,29 +42,7 @@ function promptFor(skillSource, routingSource, testCase, fixtureDefinition, fixt
43
42
  }
44
43
 
45
44
  function defaultExecute({ surface, cwd, prompt, model, timeoutMs = 120000 }) {
46
- if (surface === "codex") {
47
- const temp = mkdtempSync(join(tmpdir(), "agdf-live-codex-"));
48
- try {
49
- const schemaPath = join(temp, "schema.json");
50
- const outputPath = join(temp, "output.json");
51
- writeFileSync(schemaPath, `${JSON.stringify(outputSchema, null, 2)}\n`, "utf8");
52
- const args = ["exec", "--sandbox", "read-only", "--ephemeral", "--ignore-user-config", "--skip-git-repo-check", "--output-schema", schemaPath, "--output-last-message", outputPath, "--color", "never"];
53
- if (model) args.push("--model", model);
54
- args.push(prompt);
55
- guardedExecFileSync("codex", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: timeoutMs });
56
- return readFileSync(outputPath, "utf8");
57
- } finally { rmSync(temp, { recursive: true, force: true }); }
58
- }
59
- if (surface === "claude") {
60
- const args = ["-p", "--disallowedTools", "Edit,Write,Bash", "--output-format", "json", "--json-schema", JSON.stringify(outputSchema)];
61
- if (model) args.push("--model", model);
62
- args.push(prompt);
63
- const raw = guardedExecFileSync("claude", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: timeoutMs });
64
- const envelope = JSON.parse(raw);
65
- if (envelope.is_error) throw new Error(`claude live adapter failed: ${envelope.result ?? "unknown error"}`);
66
- return envelope.result;
67
- }
68
- throw new Error(`unsupported live surface: ${surface}`);
45
+ return executeStructuredAgent({ surface, cwd, prompt, model, outputSchema, timeoutMs });
69
46
  }
70
47
 
71
48
  export function persistLiveObservation(path, result) {
@@ -1,8 +1,20 @@
1
- import { readFileSync } from "node:fs";
1
+ import { existsSync, readFileSync } from "node:fs";
2
2
  import { evaluateOpenCodeRepositoryActivation } from "./lib/installers/opencode-activation.js";
3
3
 
4
4
  const packageJson = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8"));
5
5
 
6
+ const readValidatorExpectedVersion = () => {
7
+ try {
8
+ const validatorPath = new URL("../../agdf/bin/agdf-local.js", import.meta.url);
9
+ if (!existsSync(validatorPath)) return null;
10
+ const content = readFileSync(validatorPath, "utf8");
11
+ const match = content.match(/expectedVersion["']?\s*[:=]\s*["']([^"']+)["']/);
12
+ return match?.[1] ?? null;
13
+ } catch {
14
+ return null;
15
+ }
16
+ };
17
+
6
18
  export const AGDFPlugin = async ({ directory, client }) => {
7
19
  const controlDir = `${directory}/.agdf/control`;
8
20
  const activation = () => evaluateOpenCodeRepositoryActivation(directory);
@@ -47,6 +59,12 @@ export const AGDFPlugin = async ({ directory, client }) => {
47
59
  output[key].push(activation().active ? activeGuidance : inactiveGuidance);
48
60
  };
49
61
 
62
+ const safeToast = async (message, variant) => {
63
+ try {
64
+ if (client?.tui?.showToast) await client.tui.showToast({ body: { message, variant } });
65
+ } catch {}
66
+ };
67
+
50
68
  return {
51
69
  event: async ({ event }) => {
52
70
  if (event?.type === "session.created") {
@@ -59,6 +77,27 @@ export const AGDFPlugin = async ({ directory, client }) => {
59
77
  extra: currentStatus,
60
78
  },
61
79
  });
80
+ if (!currentStatus.active) {
81
+ await safeToast(
82
+ "AGDF: No valid .agdf/control/config.json. Run npx --yes @agdf/cli@latest opencode-repo to activate governance.",
83
+ "warning",
84
+ );
85
+ }
86
+ const validatorVersion = readValidatorExpectedVersion();
87
+ if (validatorVersion && validatorVersion !== packageJson.version) {
88
+ await client.app.log({
89
+ body: {
90
+ service: "agdf",
91
+ level: "warn",
92
+ message: `AGDF version drift: plugin ${packageJson.version} vs validator ${validatorVersion}`,
93
+ extra: { plugin_version: packageJson.version, validator_version: validatorVersion },
94
+ },
95
+ });
96
+ await safeToast(
97
+ `AGDF version drift: plugin ${packageJson.version} vs validator ${validatorVersion}. Run npx --yes @agdf/cli@latest opencode-repo to repair.`,
98
+ "warning",
99
+ );
100
+ }
62
101
  }
63
102
  },
64
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-agdf",
3
- "version": "0.11.4",
3
+ "version": "0.12.0",
4
4
  "description": "Bootstrap AGDF repository-local plugin files, Copilot/OpenCode instructions, skills, control files and machine-readable checks.",
5
5
  "type": "module",
6
6
  "files": [
@@ -39,9 +39,12 @@
39
39
  "test:skill-evals": "node ./scripts/skill-evals-test.js",
40
40
  "eval:skills": "node ./scripts/run-skill-evals.js",
41
41
  "eval:skills:record": "node ./scripts/record-skill-evals.js",
42
+ "eval:proportionality:record": "node ./scripts/record-proportionality-benchmark.js",
43
+ "eval:proportionality": "node ./scripts/run-proportionality-benchmark.js",
44
+ "test:proportionality": "node ./scripts/proportionality-benchmark-test.js",
42
45
  "test:release-bootstrap": "node ./scripts/release-bootstrap-smoke-test.js",
43
46
  "test:routing": "npm run sync-package-assets && node ./scripts/test-routing.js",
44
- "smoke-test": "npm run sync-package-assets && npm run test:cli-modularization && npm run test:local-validator && npm run test:local-marketplace && npm run test:package-build && npm run test:package-contents && npm run test:lifecycle && npm run test:control-state && npm run test:interaction-presentation && npm run test:verified-change && npm run test:runtime-integrity-layout && npm run test:runtime-integrity-negative && npm run test:skill-evals && npm run eval:skills && npm run test:delivery-path-search && npm run test:delivery-path-search-unit && npm run test:delivery-path-search-generator && npm run test:opencode-hardening && node ./scripts/smoke-test.js && node ./scripts/test-routing.js",
47
+ "smoke-test": "npm run sync-package-assets && npm run test:cli-modularization && npm run test:local-validator && npm run test:local-marketplace && npm run test:package-build && npm run test:package-contents && npm run test:lifecycle && npm run test:control-state && npm run test:interaction-presentation && npm run test:verified-change && npm run test:runtime-integrity-layout && npm run test:runtime-integrity-negative && npm run test:skill-evals && npm run eval:skills && npm run test:proportionality && npm run test:delivery-path-search && npm run test:delivery-path-search-unit && npm run test:delivery-path-search-generator && npm run test:opencode-hardening && node ./scripts/smoke-test.js && node ./scripts/test-routing.js",
45
48
  "prepack": "npm run sync-package-assets"
46
49
  },
47
50
  "keywords": [