@treeseed/sdk 0.13.0-rc.113 → 0.13.0-rc.115

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.
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ import { sourceWorkspaceKeySchema } from "../source-workspace.js";
3
+ const sourceCandidateChunkBytes = 524288;
4
+ const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
5
+ const commit = z.string().regex(/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u);
6
+ const id = z.string().min(1).max(256);
7
+ const sourceCandidateAttestationSchema = z.object({
8
+ schemaVersion: z.literal("treeseed.source-candidate-attestation/v1"),
9
+ providerId: id,
10
+ assignmentId: id,
11
+ attempt: z.number().int().positive(),
12
+ leaseId: id,
13
+ source: sourceWorkspaceKeySchema,
14
+ commit,
15
+ parentCandidateId: id.nullable(),
16
+ bundle: z.object({
17
+ digest,
18
+ bytes: z.number().int().positive().max(sourceCandidateChunkBytes * 1024),
19
+ chunks: z.array(digest).min(1).max(1024)
20
+ }).strict(),
21
+ verification: z.object({
22
+ clean: z.literal(true),
23
+ objectClosure: z.literal(true),
24
+ ancestry: z.literal(true),
25
+ isolatedVerifier: z.literal(true),
26
+ executionStopped: z.literal(true),
27
+ verifierStopped: z.literal(true)
28
+ }).strict(),
29
+ verifiedAt: z.string().datetime()
30
+ }).strict().superRefine((value, context) => {
31
+ if (value.bundle.chunks.length !== Math.ceil(value.bundle.bytes / sourceCandidateChunkBytes)) {
32
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["bundle", "chunks"], message: "Candidate chunk count must match its bounded size." });
33
+ }
34
+ });
35
+ const signedSourceCandidateSchema = z.object({
36
+ attestation: sourceCandidateAttestationSchema,
37
+ signature: z.object({
38
+ algorithm: z.literal("Ed25519"),
39
+ keyId: id,
40
+ value: z.string().regex(/^[A-Za-z0-9_-]{86}$/u)
41
+ }).strict()
42
+ }).strict();
43
+ const authority = { runnerId: id, leaseToken: z.string().min(1).max(4096), candidate: signedSourceCandidateSchema };
44
+ const sourceCandidateRequestSchema = z.discriminatedUnion("action", [
45
+ z.object({
46
+ ...authority,
47
+ action: z.literal("chunk"),
48
+ index: z.number().int().min(0).max(1023),
49
+ content: z.string().min(4).max(Math.ceil(sourceCandidateChunkBytes / 3) * 4).regex(/^[A-Za-z0-9+/]+={0,2}$/u)
50
+ }).strict(),
51
+ z.object({ ...authority, action: z.literal("commit") }).strict()
52
+ ]);
53
+ const sourceChunkRequestSchema = z.object({
54
+ runnerId: id,
55
+ leaseToken: z.string().min(1).max(4096),
56
+ artifactId: id,
57
+ index: z.number().int().min(0).max(1023)
58
+ }).strict();
59
+ const sourceChunkResponseSchema = z.object({
60
+ artifactId: id,
61
+ index: z.number().int().min(0).max(1023),
62
+ digest,
63
+ content: z.string().min(4).max(Math.ceil(sourceCandidateChunkBytes / 3) * 4).regex(/^[A-Za-z0-9+/]+={0,2}$/u)
64
+ }).strict();
65
+ export {
66
+ signedSourceCandidateSchema,
67
+ sourceCandidateAttestationSchema,
68
+ sourceCandidateChunkBytes,
69
+ sourceCandidateRequestSchema,
70
+ sourceChunkRequestSchema,
71
+ sourceChunkResponseSchema
72
+ };
@@ -183,7 +183,7 @@ export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
183
183
  expiresAt: z.ZodString;
184
184
  }, "strict", z.ZodTypeAny, {
185
185
  id: string;
186
- state: "active" | "released" | "quarantined" | "exporting";
186
+ state: "active" | "released" | "exporting" | "quarantined";
187
187
  expiresAt: string;
188
188
  schemaVersion: "treeseed.source-workspace-lease/v1";
189
189
  createdAt: string;
@@ -205,7 +205,7 @@ export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
205
205
  workspaceDigest: string;
206
206
  }, {
207
207
  id: string;
208
- state: "active" | "released" | "quarantined" | "exporting";
208
+ state: "active" | "released" | "exporting" | "quarantined";
209
209
  expiresAt: string;
210
210
  schemaVersion: "treeseed.source-workspace-lease/v1";
211
211
  createdAt: string;
@@ -505,6 +505,23 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
505
505
  publication: "denied" | "candidate-only";
506
506
  credentialBindingId: string;
507
507
  }>;
508
+ /** Present only for an accepted predecessor candidate selected by the control plane. */
509
+ sourceBundle: z.ZodOptional<z.ZodObject<{
510
+ artifactId: z.ZodString;
511
+ digest: z.ZodString;
512
+ bytes: z.ZodNumber;
513
+ chunks: z.ZodArray<z.ZodString, "many">;
514
+ }, "strict", z.ZodTypeAny, {
515
+ digest: string;
516
+ bytes: number;
517
+ artifactId: string;
518
+ chunks: string[];
519
+ }, {
520
+ digest: string;
521
+ bytes: number;
522
+ artifactId: string;
523
+ chunks: string[];
524
+ }>>;
508
525
  repository: z.ZodObject<{
509
526
  provider: z.ZodLiteral<"github">;
510
527
  owner: z.ZodString;
@@ -595,6 +612,12 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
595
612
  authorizationId: string;
596
613
  ephemeralPublicKey: string;
597
614
  };
615
+ sourceBundle?: {
616
+ digest: string;
617
+ bytes: number;
618
+ artifactId: string;
619
+ chunks: string[];
620
+ } | undefined;
598
621
  }, {
599
622
  repository: {
600
623
  provider: "github";
@@ -635,6 +658,12 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
635
658
  authorizationId: string;
636
659
  ephemeralPublicKey: string;
637
660
  };
661
+ sourceBundle?: {
662
+ digest: string;
663
+ bytes: number;
664
+ artifactId: string;
665
+ chunks: string[];
666
+ } | undefined;
638
667
  }>, {
639
668
  repository: {
640
669
  provider: "github";
@@ -675,6 +704,12 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
675
704
  authorizationId: string;
676
705
  ephemeralPublicKey: string;
677
706
  };
707
+ sourceBundle?: {
708
+ digest: string;
709
+ bytes: number;
710
+ artifactId: string;
711
+ chunks: string[];
712
+ } | undefined;
678
713
  }, {
679
714
  repository: {
680
715
  provider: "github";
@@ -715,6 +750,12 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
715
750
  authorizationId: string;
716
751
  ephemeralPublicKey: string;
717
752
  };
753
+ sourceBundle?: {
754
+ digest: string;
755
+ bytes: number;
756
+ artifactId: string;
757
+ chunks: string[];
758
+ } | undefined;
718
759
  }>;
719
760
  export type SourceCredentialDelivery = z.infer<typeof sourceCredentialDeliverySchema>;
720
761
  export type SourceWorkspaceRequest = z.infer<typeof sourceWorkspaceRequestSchema>;
@@ -75,6 +75,13 @@ const sourceCredentialDeliverySchema = z.object({
75
75
  }).strict();
76
76
  const sourceWorkspaceResponseSchema = z.object({
77
77
  authorization: sourceWorkspaceAuthorizationSchema,
78
+ /** Present only for an accepted predecessor candidate selected by the control plane. */
79
+ sourceBundle: z.object({
80
+ artifactId: id,
81
+ digest,
82
+ bytes: z.number().int().positive().max(536870912),
83
+ chunks: z.array(digest).min(1).max(1024)
84
+ }).strict().optional(),
78
85
  repository: z.object({
79
86
  provider: z.literal("github"),
80
87
  owner: z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9-]{0,99}$/u),
@@ -84,6 +91,9 @@ const sourceWorkspaceResponseSchema = z.object({
84
91
  }).strict(),
85
92
  credential: sourceCredentialDeliverySchema
86
93
  }).strict().superRefine((value, context) => {
94
+ if (value.sourceBundle && value.sourceBundle.chunks.length !== Math.ceil(value.sourceBundle.bytes / 524288)) {
95
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["sourceBundle"], message: "Source bundle chunks must match its bounded size." });
96
+ }
87
97
  if (value.repository.cloneUrl !== `https://github.com/${value.repository.owner}/${value.repository.name}.git`) {
88
98
  context.addIssue({ code: z.ZodIssueCode.custom, path: ["repository", "cloneUrl"], message: "Source transport must match its provider repository." });
89
99
  }
@@ -2573,6 +2573,9 @@ export declare const CONTROL_PLANE_OPERATIONS: {
2573
2573
  readonly sourceCandidate: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2574
2574
  assignmentId: string;
2575
2575
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2576
+ readonly sourceChunk: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2577
+ assignmentId: string;
2578
+ }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
2576
2579
  readonly renewAssignment: import("./control-plane-operation.js").ControlPlaneOperationBinding<{
2577
2580
  assignmentId: string;
2578
2581
  }, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
@@ -482,7 +482,8 @@ const CONTROL_PLANE_OPERATIONS = {
482
482
  assignment: providerPath("providers.assignments.show", "GET", "/v1/provider/assignments/{assignmentId}", { assignmentId: z.string().min(1) }, { read: true }),
483
483
  assignmentExplanation: providerPath("providers.assignments.explain", "GET", "/v1/provider/assignments/{assignmentId}/explanation", { assignmentId: z.string().min(1) }, { read: true }),
484
484
  sourceWorkspace: providerPath("providers.assignments.source.authorize", "POST", "/v1/provider/assignments/{assignmentId}/source-workspace", { assignmentId: z.string().min(1) }, { redactedPaths: ["body.leaseToken", "output.credential.ciphertext"] }),
485
- sourceCandidate: providerPath("providers.assignments.source.candidate", "POST", "/v1/provider/assignments/{assignmentId}/source-candidates", { assignmentId: z.string().min(1) }, { redactedPaths: ["body.leaseToken"] }),
485
+ sourceCandidate: providerPath("providers.assignments.source.candidate", "POST", "/v1/provider/assignments/{assignmentId}/source-candidates", { assignmentId: z.string().min(1) }, { redactedPaths: ["body.leaseToken", "body.content"] }),
486
+ sourceChunk: providerPath("providers.assignments.source.chunk", "POST", "/v1/provider/assignments/{assignmentId}/source-workspace/chunks", { assignmentId: z.string().min(1) }, { redactedPaths: ["body.leaseToken", "output.content"] }),
486
487
  renewAssignment: providerPath("providers.assignments.renew", "POST", "/v1/provider/assignments/{assignmentId}/renew", { assignmentId: z.string().min(1) }),
487
488
  startExecution: providerPath("providers.assignments.execution.start", "POST", "/v1/provider/assignments/{assignmentId}/execution-start", { assignmentId: z.string().min(1) }),
488
489
  startCloseout: providerPath("providers.assignments.closeout.start", "POST", "/v1/provider/assignments/{assignmentId}/closeout-start", { assignmentId: z.string().min(1) }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeseed/sdk",
3
- "version": "0.13.0-rc.113",
3
+ "version": "0.13.0-rc.115",
4
4
  "description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {