@sanity/ailf 3.6.0 → 3.7.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/adapters/task-sources/content-lake-task-source.js +17 -0
- package/dist/adapters/task-sources/index.d.ts +1 -1
- package/dist/adapters/task-sources/index.js +1 -1
- package/dist/adapters/task-sources/repo-schemas.d.ts +116 -0
- package/dist/adapters/task-sources/repo-schemas.js +10 -0
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* @see packages/core/src/ports/task-source.ts — TaskSource port
|
|
16
16
|
* @see docs/decisions/D0038-content-lake-authorable-task-modes.md
|
|
17
17
|
*/
|
|
18
|
+
import { ContentLakeAuthorableTaskSchema } from "./repo-schemas.js";
|
|
18
19
|
// ---------------------------------------------------------------------------
|
|
19
20
|
// GROQ query — fetches ailf.task documents with resolved references
|
|
20
21
|
// ---------------------------------------------------------------------------
|
|
@@ -98,6 +99,22 @@ export class ContentLakeTaskSource {
|
|
|
98
99
|
const mapped = mapToAuthorableTask(entry);
|
|
99
100
|
if (!mapped)
|
|
100
101
|
continue;
|
|
102
|
+
// Runtime gate (W0073): every mapped task must satisfy the domain
|
|
103
|
+
// schema before it flows into the pipeline. Throws loudly on drift so
|
|
104
|
+
// a Studio document that strays from GeneralizedTaskDefinition
|
|
105
|
+
// surfaces at load time rather than corrupting downstream state.
|
|
106
|
+
const parsed = ContentLakeAuthorableTaskSchema.safeParse(mapped);
|
|
107
|
+
if (!parsed.success) {
|
|
108
|
+
const issues = parsed.error.issues
|
|
109
|
+
.slice(0, 5)
|
|
110
|
+
.map((i) => ` [${i.path.join(".")}]: ${i.message}`)
|
|
111
|
+
.join("\n");
|
|
112
|
+
const more = parsed.error.issues.length > 5
|
|
113
|
+
? `\n …and ${parsed.error.issues.length - 5} more issue(s)`
|
|
114
|
+
: "";
|
|
115
|
+
throw new Error(`ContentLakeTaskSource: ailf.task "${mapped.id}" failed domain ` +
|
|
116
|
+
`schema validation:\n${issues}${more}`);
|
|
117
|
+
}
|
|
101
118
|
definitions.push(mapped);
|
|
102
119
|
}
|
|
103
120
|
if (definitions.length === 0 && !filter) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CompositeTaskSource } from "./composite-task-source.js";
|
|
2
2
|
export { ContentLakeTaskSource } from "./content-lake-task-source.js";
|
|
3
|
-
export { CanonicalTaskFileSchema, CanonicalTaskSchema, CURATED_ASSERTION_TYPES, detectLegacyFieldNames, parseCanonicalTaskFile, parseRepoConfig, RepoConfigSchema, RUBRIC_TEMPLATE_NAMES, type CanonicalTask, type CuratedAssertionType, type RepoConfig, type RubricTemplateName, } from "./repo-schemas.js";
|
|
3
|
+
export { CanonicalTaskFileSchema, CanonicalTaskSchema, ContentLakeAuthorableTaskSchema, CURATED_ASSERTION_TYPES, detectLegacyFieldNames, parseCanonicalTaskFile, parseRepoConfig, RepoConfigSchema, RUBRIC_TEMPLATE_NAMES, type CanonicalTask, type ContentLakeAuthorableTaskParsed, type CuratedAssertionType, type RepoConfig, type RubricTemplateName, } from "./repo-schemas.js";
|
|
4
4
|
export { RepoTaskSource } from "./repo-task-source.js";
|
|
5
5
|
export { detectTriggerContext, resolveTrigger, type ResolvedTrigger, type TriggerContext, } from "./repo-trigger.js";
|
|
6
6
|
export { formatValidationResult, validateCanonicalTasks, type ValidationMessage, type ValidationResult, } from "./repo-validation.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { CompositeTaskSource } from "./composite-task-source.js";
|
|
2
2
|
export { ContentLakeTaskSource } from "./content-lake-task-source.js";
|
|
3
|
-
export { CanonicalTaskFileSchema, CanonicalTaskSchema, CURATED_ASSERTION_TYPES, detectLegacyFieldNames, parseCanonicalTaskFile, parseRepoConfig, RepoConfigSchema, RUBRIC_TEMPLATE_NAMES, } from "./repo-schemas.js";
|
|
3
|
+
export { CanonicalTaskFileSchema, CanonicalTaskSchema, ContentLakeAuthorableTaskSchema, CURATED_ASSERTION_TYPES, detectLegacyFieldNames, parseCanonicalTaskFile, parseRepoConfig, RepoConfigSchema, RUBRIC_TEMPLATE_NAMES, } from "./repo-schemas.js";
|
|
4
4
|
export { RepoTaskSource } from "./repo-task-source.js";
|
|
5
5
|
export { detectTriggerContext, resolveTrigger, } from "./repo-trigger.js";
|
|
6
6
|
export { formatValidationResult, validateCanonicalTasks, } from "./repo-validation.js";
|
|
@@ -664,6 +664,122 @@ export declare const CanonicalTaskSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
664
664
|
}, z.core.$strip>>;
|
|
665
665
|
}, z.core.$strict>], "mode">;
|
|
666
666
|
export type CanonicalTask = z.infer<typeof CanonicalTaskSchema>;
|
|
667
|
+
export declare const ContentLakeAuthorableTaskSchema: z.ZodObject<{
|
|
668
|
+
id: z.ZodString;
|
|
669
|
+
title: z.ZodString;
|
|
670
|
+
description: z.ZodOptional<z.ZodString>;
|
|
671
|
+
area: z.ZodOptional<z.ZodString>;
|
|
672
|
+
difficulty: z.ZodOptional<z.ZodEnum<{
|
|
673
|
+
basic: "basic";
|
|
674
|
+
intermediate: "intermediate";
|
|
675
|
+
advanced: "advanced";
|
|
676
|
+
}>>;
|
|
677
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
678
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
679
|
+
active: "active";
|
|
680
|
+
draft: "draft";
|
|
681
|
+
paused: "paused";
|
|
682
|
+
archived: "archived";
|
|
683
|
+
}>>>;
|
|
684
|
+
assertions: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
685
|
+
type: z.ZodLiteral<"llm-rubric">;
|
|
686
|
+
template: z.ZodEnum<{
|
|
687
|
+
"task-completion": "task-completion";
|
|
688
|
+
"code-correctness": "code-correctness";
|
|
689
|
+
"doc-coverage": "doc-coverage";
|
|
690
|
+
"mcp-input-validation": "mcp-input-validation";
|
|
691
|
+
"mcp-output-correctness": "mcp-output-correctness";
|
|
692
|
+
"mcp-error-handling": "mcp-error-handling";
|
|
693
|
+
"mcp-security": "mcp-security";
|
|
694
|
+
"factual-correctness": "factual-correctness";
|
|
695
|
+
completeness: "completeness";
|
|
696
|
+
currency: "currency";
|
|
697
|
+
"process-quality": "process-quality";
|
|
698
|
+
"agent-output": "agent-output";
|
|
699
|
+
"agent-tool-usage": "agent-tool-usage";
|
|
700
|
+
}>;
|
|
701
|
+
criteria: z.ZodArray<z.ZodString>;
|
|
702
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
703
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
704
|
+
type: z.ZodEnum<{
|
|
705
|
+
"llm-rubric": "llm-rubric";
|
|
706
|
+
contains: "contains";
|
|
707
|
+
"contains-any": "contains-any";
|
|
708
|
+
"contains-all": "contains-all";
|
|
709
|
+
"not-contains": "not-contains";
|
|
710
|
+
icontains: "icontains";
|
|
711
|
+
"icontains-any": "icontains-any";
|
|
712
|
+
regex: "regex";
|
|
713
|
+
javascript: "javascript";
|
|
714
|
+
similar: "similar";
|
|
715
|
+
cost: "cost";
|
|
716
|
+
latency: "latency";
|
|
717
|
+
"file-exists": "file-exists";
|
|
718
|
+
"file-contains": "file-contains";
|
|
719
|
+
"command-succeeds": "command-succeeds";
|
|
720
|
+
"diff-matches": "diff-matches";
|
|
721
|
+
}>;
|
|
722
|
+
value: z.ZodOptional<z.ZodUnknown>;
|
|
723
|
+
threshold: z.ZodOptional<z.ZodNumber>;
|
|
724
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
725
|
+
}, z.core.$loose>]>>>;
|
|
726
|
+
rubric: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
727
|
+
ref: z.ZodString;
|
|
728
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
729
|
+
inline: z.ZodString;
|
|
730
|
+
dimensions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
731
|
+
key: z.ZodString;
|
|
732
|
+
weight: z.ZodNumber;
|
|
733
|
+
}, z.core.$strip>>>;
|
|
734
|
+
}, z.core.$strip>]>>;
|
|
735
|
+
providers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
736
|
+
id: z.ZodString;
|
|
737
|
+
config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
738
|
+
}, z.core.$strip>>>;
|
|
739
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
740
|
+
timeout: z.ZodOptional<z.ZodNumber>;
|
|
741
|
+
cache: z.ZodOptional<z.ZodBoolean>;
|
|
742
|
+
transformOutput: z.ZodOptional<z.ZodString>;
|
|
743
|
+
promptfooOverrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
744
|
+
}, z.core.$strip>>;
|
|
745
|
+
prompt: z.ZodOptional<z.ZodObject<{
|
|
746
|
+
template: z.ZodOptional<z.ZodString>;
|
|
747
|
+
text: z.ZodOptional<z.ZodString>;
|
|
748
|
+
systemMessage: z.ZodOptional<z.ZodString>;
|
|
749
|
+
vars: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
750
|
+
}, z.core.$strip>>;
|
|
751
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
752
|
+
mode: z.ZodLiteral<"literacy">;
|
|
753
|
+
context: z.ZodOptional<z.ZodObject<{
|
|
754
|
+
docs: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
755
|
+
id: z.ZodString;
|
|
756
|
+
reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
757
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
758
|
+
path: z.ZodOptional<z.ZodString>;
|
|
759
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
760
|
+
slug: z.ZodString;
|
|
761
|
+
reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
762
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
763
|
+
path: z.ZodString;
|
|
764
|
+
reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
765
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
766
|
+
perspective: z.ZodString;
|
|
767
|
+
reason: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
768
|
+
}, z.core.$strip>]>>>;
|
|
769
|
+
fixtures: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
770
|
+
}, z.core.$strip>>;
|
|
771
|
+
referenceSolution: z.ZodOptional<z.ZodString>;
|
|
772
|
+
docCoverage: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
773
|
+
baseline: z.ZodOptional<z.ZodObject<{
|
|
774
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
775
|
+
rubric: z.ZodOptional<z.ZodEnum<{
|
|
776
|
+
full: "full";
|
|
777
|
+
abbreviated: "abbreviated";
|
|
778
|
+
none: "none";
|
|
779
|
+
}>>;
|
|
780
|
+
}, z.core.$strip>>;
|
|
781
|
+
}, z.core.$strict>;
|
|
782
|
+
export type ContentLakeAuthorableTaskParsed = z.infer<typeof ContentLakeAuthorableTaskSchema>;
|
|
667
783
|
/**
|
|
668
784
|
* Schema for an array of canonical tasks — what a single .ailf/tasks/*.yaml
|
|
669
785
|
* file contains. Each file must define at least one task.
|
|
@@ -320,6 +320,16 @@ export const CanonicalTaskSchema = z.discriminatedUnion("mode", [
|
|
|
320
320
|
KnowledgeProbeTaskSchema,
|
|
321
321
|
CustomTaskSchema,
|
|
322
322
|
]);
|
|
323
|
+
// ---------------------------------------------------------------------------
|
|
324
|
+
// Content Lake authorable slice (D0038 / W0073)
|
|
325
|
+
//
|
|
326
|
+
// Runtime validator for Content Lake-authored tasks. Mirrors the
|
|
327
|
+
// `ContentLakeAuthorableTask` type from @sanity/ailf-core: today exactly
|
|
328
|
+
// the literacy variant. Expanding `ContentLakeAuthorableMode` requires
|
|
329
|
+
// extending this schema in the same pass (use `z.discriminatedUnion("mode", [...])`
|
|
330
|
+
// once the authorable set has more than one member).
|
|
331
|
+
// ---------------------------------------------------------------------------
|
|
332
|
+
export const ContentLakeAuthorableTaskSchema = LiteracyTaskSchema;
|
|
323
333
|
/**
|
|
324
334
|
* Schema for an array of canonical tasks — what a single .ailf/tasks/*.yaml
|
|
325
335
|
* file contains. Each file must define at least one task.
|