@sanity/ailf 3.5.1 → 3.6.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.
- package/dist/_vendor/ailf-core/types/generalized-task.d.ts +23 -0
- package/dist/_vendor/ailf-core/types/index.d.ts +1 -1
- package/dist/adapters/task-sources/content-lake-task-source.d.ts +8 -3
- package/dist/adapters/task-sources/content-lake-task-source.js +19 -8
- package/dist/adapters/task-sources/repo-schemas.d.ts +1093 -41
- package/dist/adapters/task-sources/repo-schemas.js +178 -44
- package/package.json +1 -1
|
@@ -341,3 +341,26 @@ export interface CustomTaskDefinition extends TaskCommonFields {
|
|
|
341
341
|
* when authoring tasks.
|
|
342
342
|
*/
|
|
343
343
|
export type GeneralizedTaskDefinition = LiteracyTaskDefinition | MCPServerTaskDefinition | AgentHarnessTaskDefinition | KnowledgeProbeTaskDefinition | CustomTaskDefinition;
|
|
344
|
+
/**
|
|
345
|
+
* The subset of task modes that can be authored as `ailf.task` documents in
|
|
346
|
+
* the Content Lake (Sanity Studio). Today exactly `"literacy"`.
|
|
347
|
+
*
|
|
348
|
+
* Expanding this set is a deliberate decision: execution-bound fields
|
|
349
|
+
* (filesystem handles, local commands, sandbox config, module paths) cannot
|
|
350
|
+
* round-trip through Content Lake, so not every mode belongs here. Adding a
|
|
351
|
+
* mode requires a new or superseding ADR and a coordinated schema update
|
|
352
|
+
* across the domain type, Studio schema, and `ContentLakeTaskSource` adapter
|
|
353
|
+
* per the `ailf-schema-sync` skill.
|
|
354
|
+
*
|
|
355
|
+
* @see docs/decisions/D0038-content-lake-authorable-task-modes.md
|
|
356
|
+
*/
|
|
357
|
+
export type ContentLakeAuthorableMode = "literacy";
|
|
358
|
+
/**
|
|
359
|
+
* The slice of `GeneralizedTaskDefinition` authorable in the Content Lake,
|
|
360
|
+
* derived mechanically from `ContentLakeAuthorableMode`. Used as the return
|
|
361
|
+
* type of `ContentLakeTaskSource` so the adapter's mode literal is
|
|
362
|
+
* type-checked against the boundary rather than a loose cast.
|
|
363
|
+
*/
|
|
364
|
+
export type ContentLakeAuthorableTask = Extract<GeneralizedTaskDefinition, {
|
|
365
|
+
mode: ContentLakeAuthorableMode;
|
|
366
|
+
}>;
|
|
@@ -25,7 +25,7 @@ export type { VariableDeclaration, VariableEnvelope, VariableProvenance, Variabl
|
|
|
25
25
|
export type { EvalTrace, ToolCallCategory, ToolCallRecord, TraceEvent, TraceSpan, TraceTokenUsage, } from "./trace.js";
|
|
26
26
|
export type { ArtifactId, AssociationAxis, AssociationValues, Brand, EntryKey, Err, FixtureId, IdValidationError, NewReportId, Ok, ProviderId, PromptId, Result, ResultId, RubricId, RunFingerprint, RunId, SuiteId, TaskId, TaskSlug, TraceId, } from "./branded-ids.js";
|
|
27
27
|
export { err, fixtureId, generateRunId, ok, providerId, resultId, runId, suiteId, taskId, traceId, } from "./branded-ids.js";
|
|
28
|
-
export type { AgentHarnessTaskDefinition, CustomTaskDefinition, GeneralizedAssertionDefinition, GeneralizedDocRef, GeneralizedTaskDefinition, GeneralizedTemplatedAssertion, GeneralizedValueAssertion, IdDocRef, KnowledgeProbeTaskDefinition, LiteracyTaskDefinition, MCPServerTaskDefinition, PathDocRef, PerspectiveDocRef, RubricRef, SlugDocRef, TaskCommonFields, TaskDifficulty, TaskOptions, TaskProviderConfig, TaskStatus, } from "./generalized-task.js";
|
|
28
|
+
export type { AgentHarnessTaskDefinition, ContentLakeAuthorableMode, ContentLakeAuthorableTask, CustomTaskDefinition, GeneralizedAssertionDefinition, GeneralizedDocRef, GeneralizedTaskDefinition, GeneralizedTemplatedAssertion, GeneralizedValueAssertion, IdDocRef, KnowledgeProbeTaskDefinition, LiteracyTaskDefinition, MCPServerTaskDefinition, PathDocRef, PerspectiveDocRef, RubricRef, SlugDocRef, TaskCommonFields, TaskDifficulty, TaskOptions, TaskProviderConfig, TaskStatus, } from "./generalized-task.js";
|
|
29
29
|
type DocumentRef = _DocumentRef;
|
|
30
30
|
/** Aggregated retrieval metrics for a feature area */
|
|
31
31
|
export interface AreaRetrievalMetrics {
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* Adapter: Load task definitions from the Sanity Content Lake.
|
|
3
3
|
*
|
|
4
4
|
* Fetches ailf.task documents via GROQ and maps them to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* `ContentLakeAuthorableTask` — the subset of `GeneralizedTaskDefinition`
|
|
6
|
+
* authorable in Studio per D0038. Today that subset is exactly the
|
|
7
|
+
* literacy variant.
|
|
8
|
+
*
|
|
9
|
+
* The pipeline never knows which adapter loaded the tasks; the
|
|
10
|
+
* `TaskSource` port widens the return type back to
|
|
11
|
+
* `GeneralizedTaskDefinition[]`.
|
|
7
12
|
*
|
|
8
13
|
* Wired in the composition root as the default task source.
|
|
9
14
|
*
|
|
10
15
|
* @see packages/core/src/ports/task-source.ts — TaskSource port
|
|
11
|
-
* @see docs/
|
|
16
|
+
* @see docs/decisions/D0038-content-lake-authorable-task-modes.md
|
|
12
17
|
*/
|
|
13
18
|
import type { SanityClient } from "@sanity/client";
|
|
14
19
|
import type { FilterOptions, GeneralizedTaskDefinition, TaskSource } from "../../_vendor/ailf-core/index.d.ts";
|
|
@@ -2,13 +2,18 @@
|
|
|
2
2
|
* Adapter: Load task definitions from the Sanity Content Lake.
|
|
3
3
|
*
|
|
4
4
|
* Fetches ailf.task documents via GROQ and maps them to
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* `ContentLakeAuthorableTask` — the subset of `GeneralizedTaskDefinition`
|
|
6
|
+
* authorable in Studio per D0038. Today that subset is exactly the
|
|
7
|
+
* literacy variant.
|
|
8
|
+
*
|
|
9
|
+
* The pipeline never knows which adapter loaded the tasks; the
|
|
10
|
+
* `TaskSource` port widens the return type back to
|
|
11
|
+
* `GeneralizedTaskDefinition[]`.
|
|
7
12
|
*
|
|
8
13
|
* Wired in the composition root as the default task source.
|
|
9
14
|
*
|
|
10
15
|
* @see packages/core/src/ports/task-source.ts — TaskSource port
|
|
11
|
-
* @see docs/
|
|
16
|
+
* @see docs/decisions/D0038-content-lake-authorable-task-modes.md
|
|
12
17
|
*/
|
|
13
18
|
// ---------------------------------------------------------------------------
|
|
14
19
|
// GROQ query — fetches ailf.task documents with resolved references
|
|
@@ -47,11 +52,15 @@ const TASKS_QUERY = /* groq */ `
|
|
|
47
52
|
&& (!defined($tags) || count((tags)[@ in $tags]) > 0)
|
|
48
53
|
] | order(coalesce(area->areaId.current, featureArea->areaId.current) asc, id.current asc) {
|
|
49
54
|
"taskId": id.current,
|
|
50
|
-
//
|
|
51
|
-
// the
|
|
55
|
+
// The coalesce on title preserves back-compat: older documents that used
|
|
56
|
+
// the description field as the task label (before title was required)
|
|
57
|
+
// still read cleanly. New documents have title and description as
|
|
58
|
+
// distinct fields.
|
|
52
59
|
"title": coalesce(title, description),
|
|
60
|
+
description,
|
|
53
61
|
"areaId": coalesce(area->areaId.current, featureArea->areaId.current),
|
|
54
62
|
"promptText": coalesce(promptText, taskPrompt),
|
|
63
|
+
status,
|
|
55
64
|
docCoverage,
|
|
56
65
|
"contextDocs": coalesce(contextDocs, canonicalDocs)[] {
|
|
57
66
|
refType,
|
|
@@ -86,7 +95,7 @@ export class ContentLakeTaskSource {
|
|
|
86
95
|
}
|
|
87
96
|
const definitions = [];
|
|
88
97
|
for (const entry of raw) {
|
|
89
|
-
const mapped =
|
|
98
|
+
const mapped = mapToAuthorableTask(entry);
|
|
90
99
|
if (!mapped)
|
|
91
100
|
continue;
|
|
92
101
|
definitions.push(mapped);
|
|
@@ -115,14 +124,14 @@ function buildGroqParams(filter) {
|
|
|
115
124
|
// Mapping: Content Lake → LiteracyTaskDefinition
|
|
116
125
|
// ---------------------------------------------------------------------------
|
|
117
126
|
/**
|
|
118
|
-
* Map a Content Lake ailf.task document
|
|
127
|
+
* Map a Content Lake ailf.task document to a `ContentLakeAuthorableTask`.
|
|
119
128
|
*
|
|
120
129
|
* Returns null if the document is missing required fields (taskId,
|
|
121
130
|
* title, areaId, promptText). These are required by the
|
|
122
131
|
* Studio schema, but defensive coding handles edge cases (drafts,
|
|
123
132
|
* partially-created documents, etc.).
|
|
124
133
|
*/
|
|
125
|
-
function
|
|
134
|
+
function mapToAuthorableTask(raw) {
|
|
126
135
|
// Required fields — skip malformed documents
|
|
127
136
|
if (!raw.taskId || !raw.title || !raw.areaId || !raw.promptText) {
|
|
128
137
|
return null;
|
|
@@ -172,6 +181,8 @@ function mapToLiteracyTask(raw) {
|
|
|
172
181
|
referenceSolution: "",
|
|
173
182
|
...(baseline ? { baseline } : {}),
|
|
174
183
|
...(raw.tags?.length ? { tags: raw.tags } : {}),
|
|
184
|
+
...(raw.status ? { status: raw.status } : {}),
|
|
185
|
+
...(raw.description ? { description: raw.description } : {}),
|
|
175
186
|
};
|
|
176
187
|
}
|
|
177
188
|
/**
|