@peasant-labs/schema 0.1.0-rc8 → 0.1.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/internal/generated/contract/zod.gen.d.ts +1262 -91
- package/dist/internal/generated/contract/zod.gen.js +462 -13
- package/dist/internal/generated/enums.gen.d.ts +42 -6
- package/dist/internal/generated/enums.gen.js +41 -1
- package/dist/internal/generated/local-api.d.ts +3 -1
- package/dist/internal/generated/public-contract.gen.d.ts +2 -2
- package/dist/internal/generated/public-contract.gen.js +1 -1
- package/dist/internal/generated/versions.gen.d.ts +3 -3
- package/dist/internal/generated/versions.gen.js +3 -3
- package/dist/internal/generated/village-api.d.ts +234 -32
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// publication-contract-semantic-refinement
|
|
1
2
|
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
3
|
import * as z from 'zod';
|
|
3
4
|
export const zActivityEdge = z.object({
|
|
@@ -29,7 +30,12 @@ export const zAnnotationDatatype = z.enum([
|
|
|
29
30
|
export const zAnnotationEntryTarget = z.object({
|
|
30
31
|
endIndex: z.int(),
|
|
31
32
|
entryIndex: z.int(),
|
|
32
|
-
sessionId: z.string()
|
|
33
|
+
sessionId: z.string().min(1)
|
|
34
|
+
}).superRefine((value, context) => {
|
|
35
|
+
if (value.sessionId === "")
|
|
36
|
+
context.addIssue({ code: "custom", message: "entry targets require a non-empty sessionId" });
|
|
37
|
+
if (value.endIndex <= value.entryIndex)
|
|
38
|
+
context.addIssue({ code: "custom", message: "entry targets require endIndex greater than entryIndex" });
|
|
33
39
|
});
|
|
34
40
|
export const zAnnotationManifestResponse = z.object({
|
|
35
41
|
digest: z.string(),
|
|
@@ -181,6 +187,40 @@ export const zAssociationEvidenceObservation = z.object({
|
|
|
181
187
|
* Opaque durable Peasant identifier for one session-to-commit association
|
|
182
188
|
*/
|
|
183
189
|
export const zAssociationID = z.string().min(1).max(128).regex(/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/);
|
|
190
|
+
export const zAuthoritativeCommitInfo = z.object({
|
|
191
|
+
authorEmail: z.string(),
|
|
192
|
+
authorName: z.string(),
|
|
193
|
+
authorTime: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
194
|
+
commitTime: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
195
|
+
hash: z.string(),
|
|
196
|
+
message: z.string()
|
|
197
|
+
}).strict();
|
|
198
|
+
export const zAuthoritativeDiagnosticEntry = z.object({
|
|
199
|
+
errorType: z.string(),
|
|
200
|
+
location: z.string(),
|
|
201
|
+
message: z.string(),
|
|
202
|
+
remediation: z.string()
|
|
203
|
+
}).strict();
|
|
204
|
+
export const zAuthoritativeDiagnosticsInfo = z.object({
|
|
205
|
+
partial: z.boolean().nullish(),
|
|
206
|
+
warnings: z.array(zAuthoritativeDiagnosticEntry)
|
|
207
|
+
}).strict();
|
|
208
|
+
export const zAuthoritativeSessionStats = z.object({
|
|
209
|
+
cachedReadTokens: z.int().nullish(),
|
|
210
|
+
cachedWriteTokens: z.int().nullish(),
|
|
211
|
+
durationMs: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
212
|
+
subagentCount: z.int(),
|
|
213
|
+
thoughtTokens: z.int().nullish(),
|
|
214
|
+
tokensIn: z.int(),
|
|
215
|
+
tokensOut: z.int(),
|
|
216
|
+
toolCallCount: z.int(),
|
|
217
|
+
turnCount: z.int()
|
|
218
|
+
}).strict();
|
|
219
|
+
export const zAuthoritativeTimestampInfo = z.object({
|
|
220
|
+
end: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
221
|
+
ingested: z.int().nullish(),
|
|
222
|
+
start: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
|
|
223
|
+
}).strict();
|
|
184
224
|
export const zBatchCreateAnnotationsErrorResponse = z.object({
|
|
185
225
|
error: z.string(),
|
|
186
226
|
failingIndex: z.int()
|
|
@@ -225,6 +265,13 @@ export const zCLILoginQuery = z.object({
|
|
|
225
265
|
port: z.int(),
|
|
226
266
|
state: z.string()
|
|
227
267
|
});
|
|
268
|
+
export const zCanonicalPublishGitContext = z.object({
|
|
269
|
+
branch: z.string().nullable(),
|
|
270
|
+
commits: z.array(zAuthoritativeCommitInfo),
|
|
271
|
+
remote: z.string().nullable(),
|
|
272
|
+
tracking: z.string().nullable(),
|
|
273
|
+
worktree: z.string().nullable()
|
|
274
|
+
}).strict();
|
|
228
275
|
/**
|
|
229
276
|
* Change Binding
|
|
230
277
|
*
|
|
@@ -454,13 +501,6 @@ export const zFrictionCluster = z.object({
|
|
|
454
501
|
label: z.string(),
|
|
455
502
|
sessions: z.int()
|
|
456
503
|
});
|
|
457
|
-
export const zGitContext = z.object({
|
|
458
|
-
branch: z.string().nullish(),
|
|
459
|
-
commits: z.array(zCommitInfo).optional(),
|
|
460
|
-
remote: z.string().nullish(),
|
|
461
|
-
tracking: z.string().nullish(),
|
|
462
|
-
worktree: z.string().nullish()
|
|
463
|
-
});
|
|
464
504
|
/**
|
|
465
505
|
* Harness
|
|
466
506
|
*
|
|
@@ -472,7 +512,8 @@ export const zHarness = z.enum([
|
|
|
472
512
|
'codex',
|
|
473
513
|
'opencode',
|
|
474
514
|
'cursor',
|
|
475
|
-
'antigravity'
|
|
515
|
+
'antigravity',
|
|
516
|
+
'strike'
|
|
476
517
|
]);
|
|
477
518
|
export const zHealthResponse = z.object({
|
|
478
519
|
status: z.string()
|
|
@@ -577,18 +618,37 @@ export const zMockConfigResponse = z.object({
|
|
|
577
618
|
* Model identifier (e.g. 'claude-opus-4-6', 'gemini-2.0-flash')
|
|
578
619
|
*/
|
|
579
620
|
export const zModelID = z.string().min(1);
|
|
621
|
+
export const zAuthoritativeModelInfo = z.object({
|
|
622
|
+
harness: zHarness,
|
|
623
|
+
hostSlug: zHostSlug.optional(),
|
|
624
|
+
model: zModelID,
|
|
625
|
+
version: z.string().optional()
|
|
626
|
+
}).strict();
|
|
580
627
|
export const zModelInfo = z.object({
|
|
581
628
|
harness: zHarness,
|
|
582
629
|
hostSlug: zHostSlug.optional(),
|
|
583
630
|
model: zModelID,
|
|
584
631
|
version: z.string().optional()
|
|
585
632
|
});
|
|
633
|
+
/**
|
|
634
|
+
* Omitted preserves, null requests clear, and a canonical license replaces
|
|
635
|
+
*/
|
|
636
|
+
export const zOwnerUpdateLicenseIntent = z.enum([
|
|
637
|
+
'CC0-1.0',
|
|
638
|
+
'CC-BY-4.0',
|
|
639
|
+
'CC-BY-SA-4.0'
|
|
640
|
+
]).nullable();
|
|
586
641
|
/**
|
|
587
642
|
* Project Hash
|
|
588
643
|
*
|
|
589
644
|
* SHA-256 hex digest of the project's origin URL or local path
|
|
590
645
|
*/
|
|
591
646
|
export const zProjectHash = z.string().regex(/^[0-9a-f]{64}$/).brand();
|
|
647
|
+
export const zAuthoritativeProjectContext = z.object({
|
|
648
|
+
filePath: z.string().optional(),
|
|
649
|
+
hash: zProjectHash,
|
|
650
|
+
name: z.string()
|
|
651
|
+
}).strict();
|
|
592
652
|
export const zProjectContext = z.object({
|
|
593
653
|
filePath: z.string().optional(),
|
|
594
654
|
hash: zProjectHash,
|
|
@@ -616,6 +676,30 @@ export const zProvenance = z.object({
|
|
|
616
676
|
method: z.string(),
|
|
617
677
|
version: z.string().optional()
|
|
618
678
|
});
|
|
679
|
+
/**
|
|
680
|
+
* Publish Operation Kind
|
|
681
|
+
*
|
|
682
|
+
* Mutation semantic for one publish operation arm
|
|
683
|
+
*/
|
|
684
|
+
export const zPublishOperationKind = z.enum([
|
|
685
|
+
'preserve',
|
|
686
|
+
'replace',
|
|
687
|
+
'append'
|
|
688
|
+
]);
|
|
689
|
+
export const zPublishLicenseOperation = z.object({
|
|
690
|
+
kind: zPublishOperationKind,
|
|
691
|
+
license: zLicense.nullable()
|
|
692
|
+
}).strict().superRefine((value, context) => {
|
|
693
|
+
const valid = (value.kind === "preserve" && value.license === null) || (value.kind === "replace" && value.license !== null);
|
|
694
|
+
if (!valid)
|
|
695
|
+
context.addIssue({ code: "custom", message: "license operation must be preserve+null or replace+license" });
|
|
696
|
+
});
|
|
697
|
+
/**
|
|
698
|
+
* Publish Request Fingerprint
|
|
699
|
+
*
|
|
700
|
+
* SHA3-256 digest of the canonical domain-separated publish operation
|
|
701
|
+
*/
|
|
702
|
+
export const zPublishRequestFingerprint = z.string().length(64).regex(/^[0-9a-f]{64}$/);
|
|
619
703
|
export const zPublishResponse = z.object({
|
|
620
704
|
blobKey: z.string(),
|
|
621
705
|
blobSizeBytes: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
@@ -624,6 +708,70 @@ export const zPublishResponse = z.object({
|
|
|
624
708
|
transcriptId: z.string(),
|
|
625
709
|
updatedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
|
|
626
710
|
});
|
|
711
|
+
export const zPublishedAssociation = z.object({
|
|
712
|
+
id: zAssociationID,
|
|
713
|
+
observedCommitHash: z.string()
|
|
714
|
+
}).strict();
|
|
715
|
+
export const zAuthoritativeGitContext = z.object({
|
|
716
|
+
associations: z.array(zPublishedAssociation).optional(),
|
|
717
|
+
branch: z.string().nullish(),
|
|
718
|
+
commits: z.array(zAuthoritativeCommitInfo).optional(),
|
|
719
|
+
remote: z.string().nullish(),
|
|
720
|
+
tracking: z.string().nullish(),
|
|
721
|
+
worktree: z.string().nullish()
|
|
722
|
+
}).strict();
|
|
723
|
+
export const zGitContext = z.object({
|
|
724
|
+
associations: z.array(zPublishedAssociation).optional(),
|
|
725
|
+
branch: z.string().nullish(),
|
|
726
|
+
commits: z.array(zCommitInfo).optional(),
|
|
727
|
+
remote: z.string().nullish(),
|
|
728
|
+
tracking: z.string().nullish(),
|
|
729
|
+
worktree: z.string().nullish()
|
|
730
|
+
}).superRefine((value, context) => {
|
|
731
|
+
if (value.associations === undefined || value.associations === null)
|
|
732
|
+
return;
|
|
733
|
+
const seenIDs = new Map();
|
|
734
|
+
const seenObservedHashes = new Map();
|
|
735
|
+
for (const [index, association] of value.associations.entries()) {
|
|
736
|
+
if (association.observedCommitHash.trim() === "") {
|
|
737
|
+
context.addIssue({ code: "custom", path: ["associations", index, "observedCommitHash"], message: "published associations require a non-empty observedCommitHash" });
|
|
738
|
+
}
|
|
739
|
+
const priorID = seenIDs.get(association.id);
|
|
740
|
+
if (priorID !== undefined) {
|
|
741
|
+
context.addIssue({ code: "custom", path: ["associations", index, "id"], message: "published association IDs must be unique within one request" });
|
|
742
|
+
}
|
|
743
|
+
else {
|
|
744
|
+
seenIDs.set(association.id, index);
|
|
745
|
+
}
|
|
746
|
+
const priorObservedHash = seenObservedHashes.get(association.observedCommitHash);
|
|
747
|
+
if (priorObservedHash !== undefined) {
|
|
748
|
+
context.addIssue({ code: "custom", path: ["associations", index, "observedCommitHash"], message: "published association observedCommitHash values must be unique within one request" });
|
|
749
|
+
}
|
|
750
|
+
else {
|
|
751
|
+
seenObservedHashes.set(association.observedCommitHash, index);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
});
|
|
755
|
+
export const zPublishAssociationOperation = z.object({
|
|
756
|
+
associations: z.array(zPublishedAssociation),
|
|
757
|
+
kind: zPublishOperationKind
|
|
758
|
+
}).strict().superRefine((value, context) => {
|
|
759
|
+
if (value.kind !== "append")
|
|
760
|
+
context.addIssue({ code: "custom", path: ["kind"], message: "association operation must append" });
|
|
761
|
+
const ids = new Set();
|
|
762
|
+
const hashes = new Set();
|
|
763
|
+
let prior = "";
|
|
764
|
+
for (const [index, association] of value.associations.entries()) {
|
|
765
|
+
const key = association.id + "\0" + association.observedCommitHash;
|
|
766
|
+
if (key < prior)
|
|
767
|
+
context.addIssue({ code: "custom", path: ["associations", index], message: "associations must use canonical ID and binding order" });
|
|
768
|
+
if (ids.has(association.id) || hashes.has(association.observedCommitHash) || association.observedCommitHash.trim() === "")
|
|
769
|
+
context.addIssue({ code: "custom", path: ["associations", index], message: "associations require unique nonempty IDs and bindings" });
|
|
770
|
+
ids.add(association.id);
|
|
771
|
+
hashes.add(association.observedCommitHash);
|
|
772
|
+
prior = key;
|
|
773
|
+
}
|
|
774
|
+
});
|
|
627
775
|
/**
|
|
628
776
|
* Read Attribution State
|
|
629
777
|
*
|
|
@@ -775,9 +923,18 @@ export const zServerMessage = z.object({
|
|
|
775
923
|
/**
|
|
776
924
|
* Session ID
|
|
777
925
|
*
|
|
778
|
-
* Unique session identifier (UUID, agent-{hex}, ses_{id}, sess_{id} (ACP),
|
|
926
|
+
* Unique session identifier (UUID, agent-{hex}, ses_{id}, sess_{id} (ACP), msg_{id}, or a Strike session ID)
|
|
779
927
|
*/
|
|
780
|
-
export const zSessionID = z.string().regex(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|agent-[a-f0-9]+|sess?_[a-zA-Z0-9]+|msg_[a-zA-Z0-9]
|
|
928
|
+
export const zSessionID = z.string().regex(/^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|agent-[a-f0-9]+|sess?_[a-zA-Z0-9]+|msg_[a-zA-Z0-9]+|[0-9]{8}T[0-9]{6}\.[0-9]{9}Z-[A-Z2-7]{26}|[A-Z2-7]{26})$/);
|
|
929
|
+
export const zAuthoritativeSessionIdentity = z.object({
|
|
930
|
+
parentSessionId: zSessionID.optional(),
|
|
931
|
+
schemaVersion: z.int(),
|
|
932
|
+
sessionId: zSessionID
|
|
933
|
+
}).strict();
|
|
934
|
+
export const zAuthoritativeSubagentRef = z.object({
|
|
935
|
+
parentUuid: zSessionID,
|
|
936
|
+
sessionId: zSessionID
|
|
937
|
+
}).strict();
|
|
781
938
|
export const zInsightEvidence = z.object({
|
|
782
939
|
commitHash: z.string().optional(),
|
|
783
940
|
entryIndex: z.int().nullish(),
|
|
@@ -877,6 +1034,50 @@ export const zSessionOutcome = z.enum([
|
|
|
877
1034
|
'partial',
|
|
878
1035
|
'failed'
|
|
879
1036
|
]);
|
|
1037
|
+
export const zAuthoritativeQualityMetrics = z.object({
|
|
1038
|
+
computeVersion: z.int().nullish(),
|
|
1039
|
+
computedAt: z.int().nullish(),
|
|
1040
|
+
costCacheReadUsd: z.number().nullish(),
|
|
1041
|
+
costCacheWriteUsd: z.number().nullish(),
|
|
1042
|
+
costInputUsd: z.number().nullish(),
|
|
1043
|
+
costModelId: z.string().nullish(),
|
|
1044
|
+
costOutputUsd: z.number().nullish(),
|
|
1045
|
+
costReasoningUsd: z.number().nullish(),
|
|
1046
|
+
costTotalUsd: z.number().nullish(),
|
|
1047
|
+
discoveryTurns: z.int().nullish(),
|
|
1048
|
+
durationMinutes: z.number().nullish(),
|
|
1049
|
+
explorationRatio: z.number().nullish(),
|
|
1050
|
+
filesTouched: z.int().nullish(),
|
|
1051
|
+
inputTokens: z.int().nullish(),
|
|
1052
|
+
linesChanged: z.int().nullish(),
|
|
1053
|
+
m2TokenOutcomeRatio: z.number().nullish(),
|
|
1054
|
+
m3UniqueToolCount: z.int().nullish(),
|
|
1055
|
+
m4ConsecutiveErrorMax: z.int().nullish(),
|
|
1056
|
+
m4ErrorRecoveryCount: z.int().nullish(),
|
|
1057
|
+
m5AvgMessageTokens: z.int().nullish(),
|
|
1058
|
+
m5ContextUtilizationPct: z.number().nullish(),
|
|
1059
|
+
m5PeakContextTokens: z.int().nullish(),
|
|
1060
|
+
m6LinesSurvived: z.int().nullish(),
|
|
1061
|
+
m6LinesTotal: z.int().nullish(),
|
|
1062
|
+
m6OutputSurvivalPct: z.number().nullish(),
|
|
1063
|
+
m7SpecHasConstraints: z.boolean().nullish(),
|
|
1064
|
+
m7SpecHasExamples: z.boolean().nullish(),
|
|
1065
|
+
m7SpecWordCount: z.int().nullish(),
|
|
1066
|
+
outcome: zSessionOutcome.nullish(),
|
|
1067
|
+
outputTokens: z.int().nullish(),
|
|
1068
|
+
retryLoops: z.int().nullish(),
|
|
1069
|
+
retryTokensWasted: z.int().nullish(),
|
|
1070
|
+
scope: z.string().nullish(),
|
|
1071
|
+
scopeBreadth: z.int().nullish(),
|
|
1072
|
+
signalDensity: z.number().nullish(),
|
|
1073
|
+
specQualityScore: z.number().nullish(),
|
|
1074
|
+
subagentCount: z.int().nullish(),
|
|
1075
|
+
titleGenerated: z.string().nullish(),
|
|
1076
|
+
toolCalls: z.int().nullish(),
|
|
1077
|
+
totalTokens: z.int().nullish(),
|
|
1078
|
+
turnCount: z.int().nullish(),
|
|
1079
|
+
withinSessionReverts: z.int().nullish()
|
|
1080
|
+
}).strict();
|
|
880
1081
|
export const zQualityMetrics = z.object({
|
|
881
1082
|
computeVersion: z.int().nullish(),
|
|
882
1083
|
computedAt: z.int().nullish(),
|
|
@@ -973,6 +1174,10 @@ export const zShutdownResponse = z.object({
|
|
|
973
1174
|
* Transcript file format
|
|
974
1175
|
*/
|
|
975
1176
|
export const zSourceFormat = z.enum(['jsonl', 'json']);
|
|
1177
|
+
export const zAuthoritativeSourceInfo = z.object({
|
|
1178
|
+
filePath: z.string().optional(),
|
|
1179
|
+
format: zSourceFormat
|
|
1180
|
+
}).strict();
|
|
976
1181
|
export const zSourceInfo = z.object({
|
|
977
1182
|
filePath: z.string().optional(),
|
|
978
1183
|
format: zSourceFormat
|
|
@@ -1006,7 +1211,28 @@ export const zTargetKind = z.enum([
|
|
|
1006
1211
|
'file_version',
|
|
1007
1212
|
'association'
|
|
1008
1213
|
]);
|
|
1009
|
-
export const zAnnotationPushItem = z.
|
|
1214
|
+
export const zAnnotationPushItem = z.intersection(z.union([
|
|
1215
|
+
z.object({
|
|
1216
|
+
targetAssociationId: zAssociationID,
|
|
1217
|
+
targetKind: z.literal('association')
|
|
1218
|
+
}),
|
|
1219
|
+
z.object({
|
|
1220
|
+
sessionId: z.string().min(1),
|
|
1221
|
+
targetKind: z.literal('session')
|
|
1222
|
+
}),
|
|
1223
|
+
z.object({
|
|
1224
|
+
entryTarget: zAnnotationEntryTarget,
|
|
1225
|
+
targetKind: z.literal('entry')
|
|
1226
|
+
}),
|
|
1227
|
+
z.object({
|
|
1228
|
+
annotationId: z.string().min(1),
|
|
1229
|
+
targetKind: z.literal('annotation')
|
|
1230
|
+
}),
|
|
1231
|
+
z.object({
|
|
1232
|
+
projectHash: zProjectHash,
|
|
1233
|
+
targetKind: z.literal('project')
|
|
1234
|
+
})
|
|
1235
|
+
]), z.object({
|
|
1010
1236
|
annotationId: z.string().nullish(),
|
|
1011
1237
|
annotatorName: z.string().optional(),
|
|
1012
1238
|
confidence: z.number().nullish(),
|
|
@@ -1017,12 +1243,59 @@ export const zAnnotationPushItem = z.object({
|
|
|
1017
1243
|
provenance: zProvenance.nullish(),
|
|
1018
1244
|
reason: z.string().nullish(),
|
|
1019
1245
|
sessionId: z.string().nullish(),
|
|
1246
|
+
targetAssociationId: zAssociationID.nullish(),
|
|
1020
1247
|
targetKind: zTargetKind,
|
|
1021
1248
|
typeId: z.string(),
|
|
1022
1249
|
value: z.string()
|
|
1250
|
+
})).superRefine((value, context) => {
|
|
1251
|
+
const isPresent = (detail) => detail !== undefined && detail !== null;
|
|
1252
|
+
const hasNonEmptyString = (detail) => typeof detail === "string" && detail !== "";
|
|
1253
|
+
const hasOnly = (allowed) => {
|
|
1254
|
+
const targetFields = [
|
|
1255
|
+
["targetAssociationId", value.targetAssociationId],
|
|
1256
|
+
["sessionId", value.sessionId],
|
|
1257
|
+
["entryTarget", value.entryTarget],
|
|
1258
|
+
["annotationId", value.annotationId],
|
|
1259
|
+
["projectHash", value.projectHash]
|
|
1260
|
+
];
|
|
1261
|
+
return targetFields.every(([name, detail]) => allowed.includes(name) || !isPresent(detail));
|
|
1262
|
+
};
|
|
1263
|
+
const addIssue = (message) => context.addIssue({ code: "custom", message });
|
|
1264
|
+
switch (value.targetKind) {
|
|
1265
|
+
case "association":
|
|
1266
|
+
if (!isPresent(value.targetAssociationId))
|
|
1267
|
+
addIssue("association annotations require targetAssociationId");
|
|
1268
|
+
if (!hasOnly(["targetAssociationId"]))
|
|
1269
|
+
addIssue("association annotations must not mix target arms");
|
|
1270
|
+
return;
|
|
1271
|
+
case "session":
|
|
1272
|
+
if (!hasNonEmptyString(value.sessionId))
|
|
1273
|
+
addIssue("session annotations require a non-empty sessionId");
|
|
1274
|
+
if (!hasOnly(["sessionId"]))
|
|
1275
|
+
addIssue("session annotations must not mix target arms");
|
|
1276
|
+
return;
|
|
1277
|
+
case "entry":
|
|
1278
|
+
if (!isPresent(value.entryTarget))
|
|
1279
|
+
addIssue("entry annotations require entryTarget");
|
|
1280
|
+
if (!hasOnly(["entryTarget"]))
|
|
1281
|
+
addIssue("entry annotations must not mix target arms");
|
|
1282
|
+
return;
|
|
1283
|
+
case "annotation":
|
|
1284
|
+
if (!hasNonEmptyString(value.annotationId))
|
|
1285
|
+
addIssue("annotation targets require a non-empty annotationId");
|
|
1286
|
+
if (!hasOnly(["annotationId"]))
|
|
1287
|
+
addIssue("annotation targets must not mix target arms");
|
|
1288
|
+
return;
|
|
1289
|
+
case "project":
|
|
1290
|
+
if (!isPresent(value.projectHash))
|
|
1291
|
+
addIssue("project annotations require projectHash");
|
|
1292
|
+
if (!hasOnly(["projectHash"]))
|
|
1293
|
+
addIssue("project annotations must not mix target arms");
|
|
1294
|
+
return;
|
|
1295
|
+
}
|
|
1023
1296
|
});
|
|
1024
1297
|
export const zAnnotationPushRequest = z.object({
|
|
1025
|
-
annotations: z.array(zAnnotationPushItem)
|
|
1298
|
+
annotations: z.array(zAnnotationPushItem),
|
|
1026
1299
|
retractions: z.array(z.string()).optional()
|
|
1027
1300
|
});
|
|
1028
1301
|
export const zAnnotationSummary = z.object({
|
|
@@ -1247,6 +1520,46 @@ export const zToolCallKind = z.enum([
|
|
|
1247
1520
|
'fetch',
|
|
1248
1521
|
'other'
|
|
1249
1522
|
]);
|
|
1523
|
+
export const zAuthoritativeSessionEntry = z.object({
|
|
1524
|
+
contentPreview: z.string().nullish(),
|
|
1525
|
+
depth: z.int(),
|
|
1526
|
+
entryId: z.string().nullish(),
|
|
1527
|
+
entryIndex: z.int(),
|
|
1528
|
+
entryType: zEntryType,
|
|
1529
|
+
extra: z.string().nullish(),
|
|
1530
|
+
harness: zHarness,
|
|
1531
|
+
hasThinking: z.boolean(),
|
|
1532
|
+
hasToolUse: z.boolean(),
|
|
1533
|
+
isError: z.boolean(),
|
|
1534
|
+
parentEntryId: z.string().nullish(),
|
|
1535
|
+
parentIndex: z.int().nullish(),
|
|
1536
|
+
partType: z.string().nullish(),
|
|
1537
|
+
rawByteLength: z.int().nullish(),
|
|
1538
|
+
role: zRole,
|
|
1539
|
+
sessionId: zSessionID,
|
|
1540
|
+
stopReason: zStopReason.nullish(),
|
|
1541
|
+
timestampMs: z.int().nullish(),
|
|
1542
|
+
tokensIn: z.int().nullish(),
|
|
1543
|
+
tokensOut: z.int().nullish(),
|
|
1544
|
+
toolCallId: z.string().nullish(),
|
|
1545
|
+
toolInput: z.string().nullish(),
|
|
1546
|
+
toolKind: zToolCallKind.nullish(),
|
|
1547
|
+
toolNamesCsv: z.string().nullish(),
|
|
1548
|
+
toolOutput: z.string().nullish()
|
|
1549
|
+
}).strict();
|
|
1550
|
+
export const zCanonicalPublishReplacement = z.object({
|
|
1551
|
+
diagnostics: zAuthoritativeDiagnosticsInfo,
|
|
1552
|
+
entries: z.array(zAuthoritativeSessionEntry),
|
|
1553
|
+
git: zCanonicalPublishGitContext,
|
|
1554
|
+
identity: zAuthoritativeSessionIdentity,
|
|
1555
|
+
model: zAuthoritativeModelInfo,
|
|
1556
|
+
project: zAuthoritativeProjectContext,
|
|
1557
|
+
quality: zAuthoritativeQualityMetrics.nullable(),
|
|
1558
|
+
source: zAuthoritativeSourceInfo,
|
|
1559
|
+
stats: zAuthoritativeSessionStats,
|
|
1560
|
+
subagents: z.array(zAuthoritativeSubagentRef),
|
|
1561
|
+
timestamp: zAuthoritativeTimestampInfo
|
|
1562
|
+
}).strict();
|
|
1250
1563
|
export const zSessionEntry = z.object({
|
|
1251
1564
|
contentPreview: z.string().nullish(),
|
|
1252
1565
|
depth: z.int(),
|
|
@@ -1299,6 +1612,18 @@ export const zToolCallDetail = z.object({
|
|
|
1299
1612
|
result: z.string(),
|
|
1300
1613
|
toolKind: zToolCallKind.optional()
|
|
1301
1614
|
});
|
|
1615
|
+
/**
|
|
1616
|
+
* Transcript Content Hash
|
|
1617
|
+
*
|
|
1618
|
+
* SHA3-256 digest of the exact transcript file bytes
|
|
1619
|
+
*/
|
|
1620
|
+
export const zTranscriptContentHash = z.string().length(64).regex(/^[0-9a-f]{64}$/);
|
|
1621
|
+
export const zCanonicalPublishOperation = z.object({
|
|
1622
|
+
associations: zPublishAssociationOperation,
|
|
1623
|
+
contentHash: zTranscriptContentHash,
|
|
1624
|
+
license: zPublishLicenseOperation,
|
|
1625
|
+
replacement: zCanonicalPublishReplacement
|
|
1626
|
+
}).strict();
|
|
1302
1627
|
/**
|
|
1303
1628
|
* Transcript ID
|
|
1304
1629
|
*
|
|
@@ -1321,6 +1646,65 @@ export const zPullSkipGateResult = z.object({
|
|
|
1321
1646
|
export const zPullSkipGateResponse = z.object({
|
|
1322
1647
|
results: z.array(zPullSkipGateResult)
|
|
1323
1648
|
});
|
|
1649
|
+
/**
|
|
1650
|
+
* TranscriptUpdateLicense
|
|
1651
|
+
*
|
|
1652
|
+
* License value for the owner transcript update operation: a canonical menu license, or the empty string to clear. Clearing a license that was actually granted is refused, because a granted Creative Commons license is irrevocable.
|
|
1653
|
+
*/
|
|
1654
|
+
export const zTranscriptUpdateLicense = z.enum([
|
|
1655
|
+
'',
|
|
1656
|
+
'CC0-1.0',
|
|
1657
|
+
'CC-BY-4.0',
|
|
1658
|
+
'CC-BY-SA-4.0'
|
|
1659
|
+
]);
|
|
1660
|
+
/**
|
|
1661
|
+
* TranscriptUpdateVisibility
|
|
1662
|
+
*
|
|
1663
|
+
* Visibility values accepted by the owner transcript update operation. Organization-scoped visibility is deferred and is deliberately not offered here.
|
|
1664
|
+
*/
|
|
1665
|
+
export const zTranscriptUpdateVisibility = z.enum(['private', 'public']);
|
|
1666
|
+
export const zOwnerTranscriptUpdateRequest = z.object({
|
|
1667
|
+
description: z.string().optional(),
|
|
1668
|
+
license: zOwnerUpdateLicenseIntent.optional(),
|
|
1669
|
+
tags: z.array(z.string()).optional(),
|
|
1670
|
+
title: z.string().max(500).optional(),
|
|
1671
|
+
visibility: zTranscriptUpdateVisibility.optional()
|
|
1672
|
+
}).strict();
|
|
1673
|
+
export const zOwnerTranscriptUpdateResponse = z.object({
|
|
1674
|
+
description: z.string().nullable(),
|
|
1675
|
+
license: zLicense.nullable(),
|
|
1676
|
+
tags: z.array(z.string()),
|
|
1677
|
+
title: z.string().nullable(),
|
|
1678
|
+
transcriptId: zTranscriptID,
|
|
1679
|
+
transcriptUrl: z.string(),
|
|
1680
|
+
updatedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1681
|
+
visibility: zTranscriptUpdateVisibility
|
|
1682
|
+
}).strict().superRefine((value, context) => {
|
|
1683
|
+
let parsed;
|
|
1684
|
+
try {
|
|
1685
|
+
parsed = new URL(value.transcriptUrl);
|
|
1686
|
+
}
|
|
1687
|
+
catch {
|
|
1688
|
+
context.addIssue({ code: "custom", path: ["transcriptUrl"], message: "transcriptUrl must be absolute HTTPS and bind transcriptId" });
|
|
1689
|
+
return;
|
|
1690
|
+
}
|
|
1691
|
+
if (parsed.protocol !== "https:" || parsed.search || parsed.hash || parsed.pathname.replace(/\/$/, "") !== "/transcripts/" + value.transcriptId)
|
|
1692
|
+
context.addIssue({ code: "custom", path: ["transcriptUrl"], message: "transcriptUrl must be exact HTTPS /transcripts/{transcriptId}" });
|
|
1693
|
+
if (value.updatedAt <= 0n)
|
|
1694
|
+
context.addIssue({ code: "custom", path: ["updatedAt"], message: "updatedAt must be positive" });
|
|
1695
|
+
const tags = new Set();
|
|
1696
|
+
for (const [index, tag] of value.tags.entries()) {
|
|
1697
|
+
if (tag.trim() === "" || tag !== tag.trim() || tags.has(tag))
|
|
1698
|
+
context.addIssue({ code: "custom", path: ["tags", index], message: "tags must be unique nonempty trimmed strings" });
|
|
1699
|
+
tags.add(tag);
|
|
1700
|
+
}
|
|
1701
|
+
});
|
|
1702
|
+
export const zTranscriptUpdateRequest = z.object({
|
|
1703
|
+
description: z.string().optional(),
|
|
1704
|
+
license: zTranscriptUpdateLicense.optional(),
|
|
1705
|
+
title: z.string().max(500).optional(),
|
|
1706
|
+
visibility: zTranscriptUpdateVisibility.optional()
|
|
1707
|
+
}).strict();
|
|
1324
1708
|
export const zTrendsPayload = z.object({
|
|
1325
1709
|
days: z.array(zDayStats).nullable(),
|
|
1326
1710
|
totalSessions: z.int(),
|
|
@@ -1474,6 +1858,49 @@ export const zVisibility = z.enum([
|
|
|
1474
1858
|
'group',
|
|
1475
1859
|
'public'
|
|
1476
1860
|
]);
|
|
1861
|
+
export const zPublishNormalizedValues = z.object({
|
|
1862
|
+
derivedTitle: z.string().nullable(),
|
|
1863
|
+
entryHarnesses: z.array(zHarness),
|
|
1864
|
+
rootHarness: zHarness,
|
|
1865
|
+
schemaVersion: z.string(),
|
|
1866
|
+
visibility: zVisibility
|
|
1867
|
+
}).strict().superRefine((value, context) => {
|
|
1868
|
+
if (!/^[1-9][0-9]*$/.test(value.schemaVersion))
|
|
1869
|
+
context.addIssue({ code: "custom", path: ["schemaVersion"], message: "schemaVersion must be positive canonical decimal text" });
|
|
1870
|
+
});
|
|
1871
|
+
export const zPublishAppliedState = z.object({
|
|
1872
|
+
associations: z.array(zPublishedAssociation),
|
|
1873
|
+
license: zLicense.nullable(),
|
|
1874
|
+
normalizedValues: zPublishNormalizedValues
|
|
1875
|
+
}).strict();
|
|
1876
|
+
export const zAuthoritativePublishResponse = z.object({
|
|
1877
|
+
applied: zPublishAppliedState,
|
|
1878
|
+
blobKey: z.string(),
|
|
1879
|
+
blobSizeBytes: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1880
|
+
contentHash: zTranscriptContentHash,
|
|
1881
|
+
created: z.boolean(),
|
|
1882
|
+
publishedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1883
|
+
requestOperationFingerprint: zPublishRequestFingerprint,
|
|
1884
|
+
transcriptId: zTranscriptID,
|
|
1885
|
+
transcriptUrl: z.string(),
|
|
1886
|
+
updatedAt: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
|
|
1887
|
+
visibility: zVisibility
|
|
1888
|
+
}).strict().superRefine((value, context) => {
|
|
1889
|
+
let parsed;
|
|
1890
|
+
try {
|
|
1891
|
+
parsed = new URL(value.transcriptUrl);
|
|
1892
|
+
}
|
|
1893
|
+
catch {
|
|
1894
|
+
context.addIssue({ code: "custom", path: ["transcriptUrl"], message: "transcriptUrl must be absolute HTTPS and bind transcriptId" });
|
|
1895
|
+
return;
|
|
1896
|
+
}
|
|
1897
|
+
if (parsed.protocol !== "https:" || parsed.search || parsed.hash || parsed.pathname.replace(/\/$/, "") !== "/transcripts/" + value.transcriptId)
|
|
1898
|
+
context.addIssue({ code: "custom", path: ["transcriptUrl"], message: "transcriptUrl must be exact HTTPS /transcripts/{transcriptId}" });
|
|
1899
|
+
if (value.blobKey.trim() === "" || value.blobSizeBytes < 0n || value.publishedAt <= 0n || value.updatedAt < value.publishedAt)
|
|
1900
|
+
context.addIssue({ code: "custom", message: "blob facts and publication chronology must be complete and ordered" });
|
|
1901
|
+
if (value.visibility !== value.applied.normalizedValues.visibility)
|
|
1902
|
+
context.addIssue({ code: "custom", path: ["applied", "normalizedValues", "visibility"], message: "top-level and applied visibility must agree" });
|
|
1903
|
+
});
|
|
1477
1904
|
export const zPullTranscriptInfo = z.object({
|
|
1478
1905
|
annotationCount: z.int(),
|
|
1479
1906
|
contentHash: z.string().optional(),
|
|
@@ -1496,6 +1923,28 @@ export const zPullListResponse = z.object({
|
|
|
1496
1923
|
total: z.int(),
|
|
1497
1924
|
transcripts: z.array(zPullTranscriptInfo).nullable()
|
|
1498
1925
|
});
|
|
1926
|
+
/**
|
|
1927
|
+
* Visibility Intent
|
|
1928
|
+
*
|
|
1929
|
+
* Optional desired final access for legacy compatibility; content replacement remains private and widening occurs separately
|
|
1930
|
+
*/
|
|
1931
|
+
export const zVisibilityIntent = z.enum(['private', 'public']);
|
|
1932
|
+
export const zAuthoritativePublishRequest = z.object({
|
|
1933
|
+
contentHash: zTranscriptContentHash,
|
|
1934
|
+
diagnostics: zAuthoritativeDiagnosticsInfo.optional(),
|
|
1935
|
+
entries: z.array(zAuthoritativeSessionEntry).optional(),
|
|
1936
|
+
git: zAuthoritativeGitContext.optional(),
|
|
1937
|
+
identity: zAuthoritativeSessionIdentity.optional(),
|
|
1938
|
+
license: zLicense.optional(),
|
|
1939
|
+
model: zAuthoritativeModelInfo,
|
|
1940
|
+
project: zAuthoritativeProjectContext.optional(),
|
|
1941
|
+
quality: zAuthoritativeQualityMetrics.optional(),
|
|
1942
|
+
source: zAuthoritativeSourceInfo.optional(),
|
|
1943
|
+
stats: zAuthoritativeSessionStats.optional(),
|
|
1944
|
+
subagents: z.array(zAuthoritativeSubagentRef).optional(),
|
|
1945
|
+
timestamp: zAuthoritativeTimestampInfo.optional(),
|
|
1946
|
+
visibilityIntent: zVisibilityIntent.optional()
|
|
1947
|
+
}).strict();
|
|
1499
1948
|
export const zWalkthroughStep = z.object({
|
|
1500
1949
|
excerpt: z.string(),
|
|
1501
1950
|
file: z.string(),
|