@sanity/ailf 2.8.0 → 3.0.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 (91) hide show
  1. package/dist/_vendor/ailf-core/artifact-capture/association.d.ts +35 -0
  2. package/dist/_vendor/ailf-core/artifact-capture/association.js +28 -0
  3. package/dist/_vendor/ailf-core/artifact-registry.d.ts +124 -23
  4. package/dist/_vendor/ailf-core/artifact-registry.js +708 -64
  5. package/dist/_vendor/ailf-core/batch-signing.d.ts +64 -0
  6. package/dist/_vendor/ailf-core/batch-signing.js +23 -0
  7. package/dist/_vendor/ailf-core/index.d.ts +3 -2
  8. package/dist/_vendor/ailf-core/index.js +3 -2
  9. package/dist/_vendor/ailf-core/ports/artifact-writer.d.ts +59 -20
  10. package/dist/_vendor/ailf-core/ports/artifact-writer.js +33 -10
  11. package/dist/_vendor/ailf-core/ports/context.d.ts +20 -17
  12. package/dist/_vendor/ailf-core/ports/index.d.ts +0 -2
  13. package/dist/_vendor/ailf-core/schemas/pipeline.d.ts +6 -6
  14. package/dist/_vendor/ailf-core/services/index.d.ts +1 -0
  15. package/dist/_vendor/ailf-core/services/index.js +1 -0
  16. package/dist/_vendor/ailf-core/services/slim-report-summary.d.ts +31 -0
  17. package/dist/_vendor/ailf-core/services/slim-report-summary.js +217 -0
  18. package/dist/_vendor/ailf-core/types/branded-ids.d.ts +33 -0
  19. package/dist/_vendor/ailf-core/types/index.d.ts +202 -23
  20. package/dist/adapters/config-sources/file-config-adapter.js +0 -4
  21. package/dist/artifact-capture/accumulating-artifact-writer.d.ts +50 -0
  22. package/dist/artifact-capture/accumulating-artifact-writer.js +111 -0
  23. package/dist/artifact-capture/api-gateway-artifact-writer.d.ts +17 -4
  24. package/dist/artifact-capture/api-gateway-artifact-writer.js +58 -7
  25. package/dist/artifact-capture/emit-file.d.ts +28 -0
  26. package/dist/artifact-capture/emit-file.js +56 -0
  27. package/dist/artifact-capture/fanout-artifact-writer.d.ts +39 -0
  28. package/dist/artifact-capture/fanout-artifact-writer.js +76 -0
  29. package/dist/artifact-capture/gcs-artifact-writer.d.ts +40 -3
  30. package/dist/artifact-capture/gcs-artifact-writer.js +238 -14
  31. package/dist/artifact-capture/local-fs-artifact-writer.d.ts +71 -0
  32. package/dist/artifact-capture/local-fs-artifact-writer.js +273 -0
  33. package/dist/artifact-capture/redact-artifact.d.ts +3 -5
  34. package/dist/artifact-capture/redact-artifact.js +3 -5
  35. package/dist/cli.js +56 -2
  36. package/dist/commands/explain-handler.js +4 -4
  37. package/dist/commands/pipeline-action.d.ts +5 -4
  38. package/dist/commands/pipeline-action.js +33 -16
  39. package/dist/commands/pipeline.d.ts +4 -4
  40. package/dist/commands/pipeline.js +4 -4
  41. package/dist/commands/publish.js +4 -1
  42. package/dist/commands/runs.d.ts +18 -0
  43. package/dist/commands/runs.js +71 -0
  44. package/dist/composition-root.d.ts +13 -10
  45. package/dist/composition-root.js +74 -46
  46. package/dist/orchestration/build-app-context.js +4 -7
  47. package/dist/orchestration/pipeline-orchestrator.d.ts +1 -1
  48. package/dist/orchestration/pipeline-orchestrator.js +37 -46
  49. package/dist/orchestration/steps/calculate-scores-step.d.ts +1 -1
  50. package/dist/orchestration/steps/calculate-scores-step.js +19 -19
  51. package/dist/orchestration/steps/callback-step.d.ts +1 -1
  52. package/dist/orchestration/steps/callback-step.js +6 -4
  53. package/dist/orchestration/steps/compare-step.d.ts +1 -1
  54. package/dist/orchestration/steps/compare-step.js +4 -2
  55. package/dist/orchestration/steps/discovery-report-step.d.ts +1 -1
  56. package/dist/orchestration/steps/discovery-report-step.js +4 -1
  57. package/dist/orchestration/steps/fetch-docs-step.js +9 -15
  58. package/dist/orchestration/steps/finalize-run-step.js +21 -7
  59. package/dist/orchestration/steps/gap-analysis-step.js +34 -6
  60. package/dist/orchestration/steps/generate-configs-step.d.ts +1 -1
  61. package/dist/orchestration/steps/generate-configs-step.js +11 -11
  62. package/dist/orchestration/steps/publish-report-step.d.ts +1 -1
  63. package/dist/orchestration/steps/publish-report-step.js +24 -19
  64. package/dist/orchestration/steps/readiness-step.d.ts +1 -1
  65. package/dist/orchestration/steps/readiness-step.js +4 -1
  66. package/dist/orchestration/steps/report-step.d.ts +1 -1
  67. package/dist/orchestration/steps/report-step.js +6 -3
  68. package/dist/orchestration/steps/run-eval-step.js +14 -9
  69. package/dist/pipeline/compare.d.ts +2 -2
  70. package/dist/pipeline/emit-eval-results.d.ts +38 -0
  71. package/dist/pipeline/emit-eval-results.js +100 -0
  72. package/dist/pipeline/map-request-to-config.js +0 -4
  73. package/package.json +1 -1
  74. package/dist/_vendor/ailf-core/artifact-capture/noop-collector.d.ts +0 -14
  75. package/dist/_vendor/ailf-core/artifact-capture/noop-collector.js +0 -25
  76. package/dist/_vendor/ailf-core/ports/artifact-collector.d.ts +0 -94
  77. package/dist/_vendor/ailf-core/ports/artifact-collector.js +0 -13
  78. package/dist/_vendor/ailf-core/ports/capture-comparator.d.ts +0 -138
  79. package/dist/_vendor/ailf-core/ports/capture-comparator.js +0 -10
  80. package/dist/artifact-capture/comparator.d.ts +0 -22
  81. package/dist/artifact-capture/comparator.js +0 -493
  82. package/dist/artifact-capture/filesystem-collector.d.ts +0 -42
  83. package/dist/artifact-capture/filesystem-collector.js +0 -237
  84. package/dist/artifact-capture/gcs-collector.d.ts +0 -55
  85. package/dist/artifact-capture/gcs-collector.js +0 -117
  86. package/dist/commands/capture-compare.d.ts +0 -15
  87. package/dist/commands/capture-compare.js +0 -253
  88. package/dist/commands/capture-list.d.ts +0 -12
  89. package/dist/commands/capture-list.js +0 -150
  90. package/dist/commands/capture.d.ts +0 -9
  91. package/dist/commands/capture.js +0 -16
@@ -1,150 +0,0 @@
1
- /**
2
- * capture list — list pipeline captures in a directory.
3
- *
4
- * Scans a capture directory for subdirectories containing manifest.json,
5
- * reads each manifest, and prints a summary table sorted by date.
6
- *
7
- * Usage:
8
- * ailf capture list # default: .ailf/results/captures/
9
- * ailf capture list ./my-captures # custom directory
10
- */
11
- import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
12
- import { join, resolve } from "node:path";
13
- import { Command } from "commander";
14
- import { resolveOutputDir } from "./shared/resolve-output-dir.js";
15
- // ---------------------------------------------------------------------------
16
- // Command factory
17
- // ---------------------------------------------------------------------------
18
- export function createCaptureListCommand() {
19
- return new Command("list")
20
- .description("List pipeline captures in a directory")
21
- .argument("[dir]", "Captures directory (default: .ailf/results/captures/)")
22
- .option("-f, --format <fmt>", "Output format: table or json", "table")
23
- .action(async (dir, opts) => {
24
- const captureDir = dir
25
- ? resolve(dir)
26
- : resolve(resolveOutputDir(), "..", "captures");
27
- if (!existsSync(captureDir)) {
28
- console.error(` No captures directory found at ${captureDir}`);
29
- console.error(" Run 'ailf pipeline --capture' to create captures.");
30
- process.exitCode = 1;
31
- return;
32
- }
33
- const captures = discoverCaptures(captureDir);
34
- if (captures.length === 0) {
35
- console.log(` No captures found in ${captureDir}`);
36
- return;
37
- }
38
- // Sort by startedAt descending (newest first)
39
- captures.sort((a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime());
40
- if (opts.format === "json") {
41
- console.log(JSON.stringify(captures, null, 2));
42
- return;
43
- }
44
- console.log("");
45
- console.log(" ailf capture list");
46
- console.log(" " + "─".repeat(60));
47
- console.log("");
48
- console.log(" " +
49
- "Date".padEnd(22) +
50
- "Mode".padEnd(18) +
51
- "Artifacts".padEnd(12) +
52
- "Size".padEnd(10) +
53
- "Path");
54
- console.log(" " + "─".repeat(60));
55
- for (const c of captures) {
56
- const date = new Date(c.startedAt).toLocaleString("en-US", {
57
- month: "short",
58
- day: "2-digit",
59
- hour: "2-digit",
60
- minute: "2-digit",
61
- });
62
- const mode = c.mode.padEnd(18);
63
- const artifacts = String(c.artifactCount).padEnd(12);
64
- const size = formatBytes(c.totalBytes).padEnd(10);
65
- console.log(` ${date.padEnd(22)}${mode}${artifacts}${size}${c.name}`);
66
- }
67
- console.log("");
68
- console.log(` ${captures.length} capture(s) found in ${captureDir}`);
69
- console.log("");
70
- });
71
- }
72
- function discoverCaptures(captureDir) {
73
- const entries = [];
74
- for (const name of readdirSync(captureDir)) {
75
- if (name.startsWith("."))
76
- continue;
77
- const fullPath = join(captureDir, name);
78
- // Raw directory with manifest.json
79
- const manifestPath = join(fullPath, "manifest.json");
80
- if (existsSync(manifestPath)) {
81
- try {
82
- const manifest = JSON.parse(readFileSync(manifestPath, "utf-8"));
83
- const totalBytes = manifest.artifacts.reduce((sum, a) => sum + a.bytes, 0);
84
- entries.push({
85
- name,
86
- path: fullPath,
87
- mode: manifest.pipeline.mode,
88
- startedAt: manifest.startedAt,
89
- artifactCount: manifest.artifacts.length,
90
- totalBytes,
91
- compressed: false,
92
- });
93
- }
94
- catch {
95
- // Skip unparseable manifests
96
- }
97
- continue;
98
- }
99
- // .tar.gz archive — read size but don't extract
100
- if (name.endsWith(".tar.gz")) {
101
- try {
102
- const stat = statSync(fullPath);
103
- entries.push({
104
- name,
105
- path: fullPath,
106
- mode: extractModeFromName(name),
107
- startedAt: extractTimestampFromName(name),
108
- artifactCount: -1, // Unknown without extracting
109
- totalBytes: stat.size,
110
- compressed: true,
111
- });
112
- }
113
- catch {
114
- // Skip
115
- }
116
- }
117
- }
118
- return entries;
119
- }
120
- /** Known modes — used to correctly extract mode from hyphenated filenames. */
121
- const KNOWN_MODES = [
122
- "literacy",
123
- "mcp-server",
124
- "agent-harness",
125
- "knowledge-probe",
126
- ];
127
- function extractModeFromName(name) {
128
- for (const mode of KNOWN_MODES) {
129
- if (name.startsWith(mode + "-"))
130
- return mode;
131
- }
132
- return name.split("-")[0] ?? "unknown";
133
- }
134
- function extractTimestampFromName(name) {
135
- // Pattern: {mode}-YYYYMMDD-HHmmss-{id}.tar.gz
136
- const match = name.match(/(\d{4})(\d{2})(\d{2})-(\d{2})(\d{2})(\d{2})/);
137
- if (!match)
138
- return "unknown";
139
- const [, y, m, d, h, min, s] = match;
140
- return `${y}-${m}-${d}T${h}:${min}:${s}Z`;
141
- }
142
- function formatBytes(bytes) {
143
- if (bytes < 0)
144
- return "?";
145
- if (bytes < 1024)
146
- return `${bytes}B`;
147
- if (bytes < 1024 * 1024)
148
- return `${(bytes / 1024).toFixed(1)}KB`;
149
- return `${(bytes / 1024 / 1024).toFixed(1)}MB`;
150
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * capture command — manage and compare pipeline artifact captures.
3
- *
4
- * Parent command for capture-related subcommands:
5
- * ailf capture compare <baseline> <experiment>
6
- * ailf capture list [dir]
7
- */
8
- import { Command } from "commander";
9
- export declare function createCaptureCommand(): Command;
@@ -1,16 +0,0 @@
1
- /**
2
- * capture command — manage and compare pipeline artifact captures.
3
- *
4
- * Parent command for capture-related subcommands:
5
- * ailf capture compare <baseline> <experiment>
6
- * ailf capture list [dir]
7
- */
8
- import { Command } from "commander";
9
- import { createCaptureCompareCommand } from "./capture-compare.js";
10
- import { createCaptureListCommand } from "./capture-list.js";
11
- export function createCaptureCommand() {
12
- const cmd = new Command("capture").description("Manage and compare pipeline artifact captures");
13
- cmd.addCommand(createCaptureCompareCommand());
14
- cmd.addCommand(createCaptureListCommand());
15
- return cmd;
16
- }