@sanity/ailf 3.7.0 → 3.8.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 (104) hide show
  1. package/config/airbyte/ai_literacy_framework.connector.yaml +1 -1
  2. package/config/thresholds.ts +3 -3
  3. package/dist/_vendor/ailf-core/examples/index.d.ts +2 -2
  4. package/dist/_vendor/ailf-core/examples/index.js +2 -2
  5. package/dist/_vendor/ailf-core/ports/context.d.ts +0 -4
  6. package/dist/_vendor/ailf-core/schemas/eval-config.d.ts +38 -12
  7. package/dist/_vendor/ailf-core/schemas/eval-config.js +102 -22
  8. package/dist/_vendor/ailf-core/schemas/pipeline-request.d.ts +4 -6
  9. package/dist/_vendor/ailf-core/schemas/pipeline-request.js +1 -3
  10. package/dist/_vendor/ailf-core/schemas/schedules.d.ts +2 -2
  11. package/dist/_vendor/ailf-shared/run-classification.d.ts +2 -2
  12. package/dist/_vendor/ailf-shared/run-classification.js +1 -1
  13. package/dist/_vendor/ailf-shared/run-context.d.ts +1 -1
  14. package/dist/adapters/api-client/build-request.d.ts +0 -2
  15. package/dist/adapters/api-client/build-request.js +2 -6
  16. package/dist/adapters/config-sources/cli-config-adapter.d.ts +1 -1
  17. package/dist/adapters/config-sources/file-config-adapter.d.ts +1 -1
  18. package/dist/adapters/config-sources/file-config-adapter.js +42 -17
  19. package/dist/adapters/task-sources/repo-schemas.d.ts +41 -3
  20. package/dist/adapters/task-sources/repo-schemas.js +127 -0
  21. package/dist/cli-program.d.ts +39 -0
  22. package/dist/cli-program.js +137 -0
  23. package/dist/cli.d.ts +8 -2
  24. package/dist/cli.js +128 -142
  25. package/dist/commands/agent-report.js +1 -1
  26. package/dist/commands/calculate-scores.js +0 -2
  27. package/dist/commands/check-staleness.js +1 -1
  28. package/dist/commands/chronic-failures.js +4 -4
  29. package/dist/commands/coverage-audit.js +6 -7
  30. package/dist/commands/discovery-report.js +16 -4
  31. package/dist/commands/eval.d.ts +1 -1
  32. package/dist/commands/eval.js +1 -1
  33. package/dist/commands/explain-handler.d.ts +1 -1
  34. package/dist/commands/explain-handler.js +13 -44
  35. package/dist/commands/fetch-docs.js +0 -2
  36. package/dist/commands/generate-configs.js +0 -2
  37. package/dist/commands/grader/index.js +3 -3
  38. package/dist/commands/init.d.ts +2 -2
  39. package/dist/commands/init.js +10 -9
  40. package/dist/commands/interactive.d.ts +1 -1
  41. package/dist/commands/interactive.js +8 -8
  42. package/dist/commands/pipeline-action.d.ts +1 -3
  43. package/dist/commands/pipeline-action.js +174 -140
  44. package/dist/commands/pr-comment.js +1 -3
  45. package/dist/commands/publish.d.ts +1 -1
  46. package/dist/commands/publish.js +2 -4
  47. package/dist/commands/readiness-report.js +17 -8
  48. package/dist/commands/remote-pipeline.d.ts +1 -1
  49. package/dist/commands/remote-pipeline.js +1 -3
  50. package/dist/commands/run.d.ts +64 -0
  51. package/dist/commands/{pipeline.js → run.js} +19 -30
  52. package/dist/commands/shared/help.js +4 -4
  53. package/dist/commands/shared/options.d.ts +29 -3
  54. package/dist/commands/shared/options.js +37 -13
  55. package/dist/commands/validate-tasks.js +1 -1
  56. package/dist/commands/validate.d.ts +1 -1
  57. package/dist/commands/validate.js +2 -2
  58. package/dist/commands/weekly-digest.js +3 -3
  59. package/dist/config/thresholds.ts +3 -3
  60. package/dist/orchestration/build-app-context.js +0 -2
  61. package/dist/orchestration/build-step-sequence.js +1 -11
  62. package/dist/orchestration/steps/fetch-docs-step.js +1 -1
  63. package/dist/orchestration/steps/index.d.ts +0 -2
  64. package/dist/orchestration/steps/index.js +0 -2
  65. package/dist/orchestration/steps/run-eval-step.js +1 -1
  66. package/dist/pipeline/cache.d.ts +1 -1
  67. package/dist/pipeline/map-request-to-config.js +0 -2
  68. package/dist/pipeline/mirror-repo-tasks.d.ts +1 -1
  69. package/dist/pipeline/plan.d.ts +2 -4
  70. package/dist/pipeline/plan.js +4 -32
  71. package/dist/pipeline/run-context.d.ts +1 -1
  72. package/dist/pipeline/run-context.js +4 -4
  73. package/dist/pipeline/validate.d.ts +1 -1
  74. package/dist/pipeline/validate.js +1 -1
  75. package/package.json +11 -9
  76. package/dist/commands/pipeline.d.ts +0 -77
  77. package/dist/orchestration/steps/discovery-report-step.d.ts +0 -13
  78. package/dist/orchestration/steps/discovery-report-step.js +0 -62
  79. package/dist/orchestration/steps/readiness-step.d.ts +0 -13
  80. package/dist/orchestration/steps/readiness-step.js +0 -98
  81. package/dist/pipeline/compiler/__tests__/agent-harness-handler.test.d.ts +0 -10
  82. package/dist/pipeline/compiler/__tests__/agent-harness-handler.test.js +0 -366
  83. package/dist/pipeline/compiler/__tests__/assertion-mapper.test.d.ts +0 -9
  84. package/dist/pipeline/compiler/__tests__/assertion-mapper.test.js +0 -145
  85. package/dist/pipeline/compiler/__tests__/knowledge-probe-handler.test.d.ts +0 -10
  86. package/dist/pipeline/compiler/__tests__/knowledge-probe-handler.test.js +0 -314
  87. package/dist/pipeline/compiler/__tests__/literacy-handler.test.d.ts +0 -10
  88. package/dist/pipeline/compiler/__tests__/literacy-handler.test.js +0 -486
  89. package/dist/pipeline/compiler/__tests__/mcp-server-handler.test.d.ts +0 -10
  90. package/dist/pipeline/compiler/__tests__/mcp-server-handler.test.js +0 -425
  91. package/dist/pipeline/compiler/__tests__/promptfoo-compiler.test.d.ts +0 -9
  92. package/dist/pipeline/compiler/__tests__/promptfoo-compiler.test.js +0 -332
  93. package/dist/pipeline/compiler/__tests__/sandbox-and-fixtures.test.d.ts +0 -12
  94. package/dist/pipeline/compiler/__tests__/sandbox-and-fixtures.test.js +0 -210
  95. package/dist/pipeline/compiler/__tests__/scoring-and-presets.test.d.ts +0 -7
  96. package/dist/pipeline/compiler/__tests__/scoring-and-presets.test.js +0 -404
  97. package/dist/pipeline/compiler/__tests__/scoring-bridge.test.d.ts +0 -10
  98. package/dist/pipeline/compiler/__tests__/scoring-bridge.test.js +0 -184
  99. package/dist/pipeline/compiler/__tests__/task-graph-builder.test.d.ts +0 -8
  100. package/dist/pipeline/compiler/__tests__/task-graph-builder.test.js +0 -301
  101. package/dist/pipeline/compiler/__tests__/telemetry.test.d.ts +0 -9
  102. package/dist/pipeline/compiler/__tests__/telemetry.test.js +0 -503
  103. package/dist/pipeline/compiler/__tests__/tool-loop-openai.test.d.ts +0 -10
  104. package/dist/pipeline/compiler/__tests__/tool-loop-openai.test.js +0 -509
@@ -1,301 +0,0 @@
1
- /**
2
- * task-graph-builder.test.ts — Unit tests for TaskGraphBuilder.
3
- *
4
- * Tests DAG construction, cycle detection, filtering, and priority assignment.
5
- *
6
- * Run: npx tsx --test src/pipeline/compiler/__tests__/task-graph-builder.test.ts
7
- */
8
- import assert from "node:assert/strict";
9
- import { describe, it } from "node:test";
10
- import { buildTaskGraph, detectCycle } from "../task-graph-builder.js";
11
- // ---------------------------------------------------------------------------
12
- // Helpers
13
- // ---------------------------------------------------------------------------
14
- /**
15
- * Build a LiteracyTaskDefinition for testing. The task-graph-builder now
16
- * accepts GeneralizedTaskDefinition[] and LiteracyTaskDefinition is a
17
- * valid variant of that union.
18
- */
19
- function makeTask(overrides) {
20
- return {
21
- mode: "literacy",
22
- title: `Task ${overrides.id}`,
23
- area: overrides.area ?? "groq",
24
- prompt: overrides.prompt ?? { text: `Do ${overrides.id}` },
25
- ...overrides,
26
- };
27
- }
28
- // ---------------------------------------------------------------------------
29
- // buildTaskGraph — basic construction
30
- // ---------------------------------------------------------------------------
31
- describe("buildTaskGraph", () => {
32
- it("builds a graph from a list of tasks", () => {
33
- const result = buildTaskGraph({
34
- tasks: [makeTask({ id: "task-a" }), makeTask({ id: "task-b" })],
35
- });
36
- assert.ok(result.graph);
37
- assert.equal(result.graph.nodes.size, 2);
38
- assert.ok(result.graph.nodes.has("task-a"));
39
- assert.ok(result.graph.nodes.has("task-b"));
40
- assert.equal(result.warnings.length, 0);
41
- });
42
- it("returns null graph when no tasks match filter", () => {
43
- const result = buildTaskGraph({
44
- tasks: [makeTask({ id: "task-a", area: "groq" })],
45
- filter: { areas: ["studio"] },
46
- });
47
- assert.equal(result.graph, null);
48
- assert.equal(result.filteredOut.length, 1);
49
- assert.ok(result.filteredOut.includes("task-a"));
50
- });
51
- it("filters by area", () => {
52
- const result = buildTaskGraph({
53
- tasks: [
54
- makeTask({ id: "groq-1", area: "groq" }),
55
- makeTask({ id: "studio-1", area: "studio" }),
56
- ],
57
- filter: { areas: ["groq"] },
58
- });
59
- assert.ok(result.graph);
60
- assert.equal(result.graph.nodes.size, 1);
61
- assert.ok(result.graph.nodes.has("groq-1"));
62
- });
63
- it("filters by task IDs", () => {
64
- const result = buildTaskGraph({
65
- tasks: [makeTask({ id: "task-a" }), makeTask({ id: "task-b" })],
66
- filter: { taskIds: ["task-a"] },
67
- });
68
- assert.ok(result.graph);
69
- assert.equal(result.graph.nodes.size, 1);
70
- });
71
- it("filters by tags", () => {
72
- const result = buildTaskGraph({
73
- tasks: [
74
- makeTask({ id: "task-a", tags: ["groq", "basics"] }),
75
- makeTask({ id: "task-b", tags: ["studio"] }),
76
- ],
77
- filter: { tags: ["groq"] },
78
- });
79
- assert.ok(result.graph);
80
- assert.equal(result.graph.nodes.size, 1);
81
- assert.ok(result.graph.nodes.has("task-a"));
82
- });
83
- it("filters out archived tasks", () => {
84
- const result = buildTaskGraph({
85
- tasks: [
86
- makeTask({ id: "active" }),
87
- makeTask({ id: "archived", status: "archived" }),
88
- ],
89
- });
90
- assert.ok(result.graph);
91
- assert.equal(result.graph.nodes.size, 1);
92
- assert.ok(result.graph.nodes.has("active"));
93
- });
94
- it("filters out paused tasks unless targeted by ID", () => {
95
- const result = buildTaskGraph({
96
- tasks: [makeTask({ id: "paused-task", status: "paused" })],
97
- filter: { taskIds: ["paused-task"] },
98
- });
99
- assert.ok(result.graph);
100
- assert.equal(result.graph.nodes.size, 1);
101
- });
102
- it("warns about duplicate task IDs", () => {
103
- const result = buildTaskGraph({
104
- tasks: [makeTask({ id: "dup" }), makeTask({ id: "dup", area: "studio" })],
105
- });
106
- assert.ok(result.graph);
107
- assert.equal(result.graph.nodes.size, 1);
108
- assert.ok(result.warnings.some((w) => w.includes("Duplicate")));
109
- });
110
- it("resolves task variables into envelope", () => {
111
- const result = buildTaskGraph({
112
- tasks: [makeTask({ id: "task-a", prompt: { text: "Do the thing" } })],
113
- });
114
- assert.ok(result.graph);
115
- const node = result.graph.nodes.get("task-a");
116
- assert.equal(node.resolvedVariables.values.task, "Do the thing");
117
- });
118
- it("includes prompt.vars in the variable envelope", () => {
119
- const result = buildTaskGraph({
120
- tasks: [
121
- makeTask({
122
- id: "task-a",
123
- prompt: { text: "Do task-a", vars: { docs: "file://ctx.md" } },
124
- }),
125
- ],
126
- });
127
- assert.ok(result.graph);
128
- const node = result.graph.nodes.get("task-a");
129
- assert.equal(node.resolvedVariables.values.docs, "file://ctx.md");
130
- });
131
- });
132
- // ---------------------------------------------------------------------------
133
- // Dependency edges and ordering
134
- // ---------------------------------------------------------------------------
135
- describe("buildTaskGraph — dependencies", () => {
136
- it("resolves explicit dependsOn edges", () => {
137
- const result = buildTaskGraph({
138
- tasks: [
139
- makeTask({ id: "base" }),
140
- makeTask({
141
- id: "derived",
142
- prompt: { text: "Do derived", vars: { dependsOn: ["base"] } },
143
- }),
144
- ],
145
- });
146
- assert.ok(result.graph);
147
- assert.equal(result.graph.edges.length, 1);
148
- assert.equal(result.graph.edges[0].from, "base");
149
- assert.equal(result.graph.edges[0].to, "derived");
150
- });
151
- it("assigns lower priority to upstream nodes", () => {
152
- const result = buildTaskGraph({
153
- tasks: [
154
- makeTask({ id: "step-1" }),
155
- makeTask({
156
- id: "step-2",
157
- prompt: { text: "Do step-2", vars: { dependsOn: ["step-1"] } },
158
- }),
159
- makeTask({
160
- id: "step-3",
161
- prompt: { text: "Do step-3", vars: { dependsOn: ["step-2"] } },
162
- }),
163
- ],
164
- });
165
- assert.ok(result.graph);
166
- const p1 = result.graph.nodes.get("step-1").priority;
167
- const p2 = result.graph.nodes.get("step-2").priority;
168
- const p3 = result.graph.nodes.get("step-3").priority;
169
- assert.ok(p1 < p2, `step-1 priority (${p1}) should be < step-2 (${p2})`);
170
- assert.ok(p2 < p3, `step-2 priority (${p2}) should be < step-3 (${p3})`);
171
- });
172
- it("warns when dependency target is not in graph", () => {
173
- const result = buildTaskGraph({
174
- tasks: [
175
- makeTask({
176
- id: "task-a",
177
- prompt: { text: "Do task-a", vars: { dependsOn: ["missing"] } },
178
- }),
179
- ],
180
- });
181
- assert.ok(result.graph);
182
- assert.ok(result.warnings.some((w) => w.includes("missing")));
183
- });
184
- });
185
- // ---------------------------------------------------------------------------
186
- // Cycle detection
187
- // ---------------------------------------------------------------------------
188
- describe("detectCycle", () => {
189
- it("returns null for acyclic graph", () => {
190
- const nodes = new Map([
191
- [
192
- "a",
193
- {
194
- taskId: "a",
195
- dependsOn: [],
196
- priority: 0,
197
- resolvedPrompt: "",
198
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
199
- },
200
- ],
201
- [
202
- "b",
203
- {
204
- taskId: "b",
205
- dependsOn: ["a"],
206
- priority: 0,
207
- resolvedPrompt: "",
208
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
209
- },
210
- ],
211
- ]);
212
- const edges = [{ from: "a", to: "b", type: "ordering" }];
213
- assert.equal(detectCycle(nodes, edges), null);
214
- });
215
- it("detects simple two-node cycle", () => {
216
- const nodes = new Map([
217
- [
218
- "a",
219
- {
220
- taskId: "a",
221
- dependsOn: ["b"],
222
- priority: 0,
223
- resolvedPrompt: "",
224
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
225
- },
226
- ],
227
- [
228
- "b",
229
- {
230
- taskId: "b",
231
- dependsOn: ["a"],
232
- priority: 0,
233
- resolvedPrompt: "",
234
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
235
- },
236
- ],
237
- ]);
238
- const edges = [
239
- { from: "a", to: "b", type: "ordering" },
240
- { from: "b", to: "a", type: "ordering" },
241
- ];
242
- const cycle = detectCycle(nodes, edges);
243
- assert.ok(cycle, "Should detect a cycle");
244
- assert.ok(cycle.length >= 2, "Cycle should have at least 2 nodes");
245
- });
246
- it("detects three-node cycle", () => {
247
- const nodes = new Map([
248
- [
249
- "a",
250
- {
251
- taskId: "a",
252
- dependsOn: [],
253
- priority: 0,
254
- resolvedPrompt: "",
255
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
256
- },
257
- ],
258
- [
259
- "b",
260
- {
261
- taskId: "b",
262
- dependsOn: [],
263
- priority: 0,
264
- resolvedPrompt: "",
265
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
266
- },
267
- ],
268
- [
269
- "c",
270
- {
271
- taskId: "c",
272
- dependsOn: [],
273
- priority: 0,
274
- resolvedPrompt: "",
275
- resolvedVariables: { values: {}, provenance: {}, declarations: [] },
276
- },
277
- ],
278
- ]);
279
- const edges = [
280
- { from: "a", to: "b", type: "ordering" },
281
- { from: "b", to: "c", type: "ordering" },
282
- { from: "c", to: "a", type: "ordering" },
283
- ];
284
- const cycle = detectCycle(nodes, edges);
285
- assert.ok(cycle, "Should detect a cycle");
286
- });
287
- it("throws when building a graph with cycles", () => {
288
- assert.throws(() => buildTaskGraph({
289
- tasks: [
290
- makeTask({
291
- id: "a",
292
- prompt: { text: "Do a", vars: { dependsOn: ["b"] } },
293
- }),
294
- makeTask({
295
- id: "b",
296
- prompt: { text: "Do b", vars: { dependsOn: ["a"] } },
297
- }),
298
- ],
299
- }), /cycle/i);
300
- });
301
- });
@@ -1,9 +0,0 @@
1
- /**
2
- * telemetry.test.ts — Tests for the observability & telemetry subsystem.
3
- *
4
- * Covers tool call classification, trace collection, cost tracking,
5
- * redaction pipeline, trace storage, and per-turn trace merging.
6
- *
7
- * Run: npx tsx --test src/pipeline/compiler/__tests__/telemetry.test.ts
8
- */
9
- export {};