@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.
@@ -1 +1 @@
1
- {"completedAt":"2026-09-10T23:14:23.976Z"}
1
+ {"completedAt":"2026-09-11T00:53:42.630Z"}
@@ -2,6 +2,8 @@ import type { ProviderAssignmentLifecycleRequest, ProviderAssignmentLifecycleRes
2
2
  import type { ProviderRuntimeEventInput } from '../agent-capacity/contracts/capacity/workdays/workday-records.js';
3
3
  import type { CapacityProviderIdentity, CapacityProviderIdentityRotationRequest, CapacityProviderSignedProof, ProviderAccessTokenIssue, ProviderAvailabilitySession, ProviderCredentialIssuanceAuthorization, ProviderRegistrationRequest, ProviderRegistrationSubmission, ProviderTeamCredentialIssue } from './contracts/index.js';
4
4
  import type { ProviderDiscussionResponseRequest } from '../operator-contracts/communication/contracts.js';
5
+ import { type SourceWorkspaceRequest } from './source-workspace.js';
6
+ import { type SourceCandidateRequest, type SourceChunkRequest } from './source/candidate.js';
5
7
  export interface ProviderProtocolClientOptions {
6
8
  controlPlaneUrl: string;
7
9
  accessToken?: string;
@@ -44,6 +46,89 @@ export declare class ProviderProtocolClient {
44
46
  startAssignmentExecution(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
45
47
  startAssignmentCloseout(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
46
48
  preflightAssignmentCompletion(assignmentId: string, request: Record<string, unknown>): Promise<Record<string, unknown>>;
49
+ /** Host provider transport only; the recipient key belongs to the trusted source fetch worker. */
50
+ authorizeAssignmentSource(assignmentId: string, request: SourceWorkspaceRequest): Promise<{
51
+ repository: {
52
+ provider: "github";
53
+ name: string;
54
+ owner: string;
55
+ ref: string;
56
+ cloneUrl: string;
57
+ };
58
+ authorization: {
59
+ id: string;
60
+ expiresAt: string;
61
+ schemaVersion: "treeseed.source-workspace-authorization/v1";
62
+ providerId: string;
63
+ issuedAt: string;
64
+ assignmentId: string;
65
+ source: {
66
+ commit: string;
67
+ projectId: string;
68
+ teamId: string;
69
+ profile: "source-only";
70
+ repositoryId: string;
71
+ controlPlaneId: string;
72
+ formatVersion: 1;
73
+ };
74
+ mode: "analysis" | "work";
75
+ attempt: number;
76
+ publication: "denied" | "candidate-only";
77
+ credentialBindingId: string;
78
+ };
79
+ credential: {
80
+ id: string;
81
+ nonce: string;
82
+ expiresAt: string;
83
+ schemaVersion: "treeseed.source-credential-delivery/v1";
84
+ algorithm: "x25519-hkdf-sha256-chacha20-poly1305";
85
+ ciphertext: string;
86
+ tag: string;
87
+ authorizationId: string;
88
+ ephemeralPublicKey: string;
89
+ };
90
+ sourceBundle?: {
91
+ digest: string;
92
+ bytes: number;
93
+ artifactId: string;
94
+ chunks: string[];
95
+ } | undefined;
96
+ }>;
97
+ /** Bounded host-only transfer. The API verifies registered-provider signatures and live publication authority. */
98
+ publishAssignmentSourceCandidate(assignmentId: string, request: SourceCandidateRequest): Promise<Record<string, unknown> | {
99
+ id: string;
100
+ schemaVersion: "treeseed.source-candidate-receipt/v1";
101
+ commit: string;
102
+ source: {
103
+ commit: string;
104
+ projectId: string;
105
+ teamId: string;
106
+ profile: "source-only";
107
+ repositoryId: string;
108
+ controlPlaneId: string;
109
+ formatVersion: 1;
110
+ };
111
+ verification: {
112
+ authority: true;
113
+ objectClosure: true;
114
+ ancestry: true;
115
+ };
116
+ bundle: {
117
+ digest: string;
118
+ bytes: number;
119
+ artifactId: string;
120
+ };
121
+ leaseId: string;
122
+ parentCandidateId: string | null;
123
+ persistedAt: string;
124
+ }>;
125
+ /** Source artifacts are accessible only through a current assignment, never ambient team access. */
126
+ readAssignmentSourceChunk(assignmentId: string, request: SourceChunkRequest): Promise<{
127
+ content: string;
128
+ digest: string;
129
+ index: number;
130
+ artifactId: string;
131
+ }>;
47
132
  respondToAssignmentDiscussion(assignmentId: string, request: ProviderDiscussionResponseRequest, idempotencyKey: string): Promise<{
48
133
  status: "responded" | "abstained";
49
134
  schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
@@ -1,5 +1,7 @@
1
1
  import { ControlPlaneClient, ControlPlaneClientError } from "../entrypoints/clients/control-plane-client.js";
2
2
  import { CONTROL_PLANE_OPERATIONS } from "../operator-contracts/index.js";
3
+ import { sourceWorkspaceRequestSchema, sourceWorkspaceResponseSchema, sourceCandidateReceiptSchema } from "./source-workspace.js";
4
+ import { sourceCandidateRequestSchema, sourceChunkRequestSchema, sourceChunkResponseSchema } from "./source/candidate.js";
3
5
  class CapacityProviderApiError extends Error {
4
6
  constructor(message, status, payload) {
5
7
  super(message);
@@ -126,6 +128,36 @@ class ProviderProtocolClient {
126
128
  preflightAssignmentCompletion(assignmentId, request) {
127
129
  return this.invoke(CONTROL_PLANE_OPERATIONS.providers.completionPreflight, { path: { assignmentId }, body: request });
128
130
  }
131
+ /** Host provider transport only; the recipient key belongs to the trusted source fetch worker. */
132
+ async authorizeAssignmentSource(assignmentId, request) {
133
+ const body = sourceWorkspaceRequestSchema.parse(request);
134
+ const response = sourceWorkspaceResponseSchema.parse(await this.invoke(
135
+ CONTROL_PLANE_OPERATIONS.providers.sourceWorkspace,
136
+ { path: { assignmentId }, body }
137
+ ));
138
+ if (response.authorization.assignmentId !== assignmentId) throw new CapacityProviderApiError("Source authority assignment correlation failed.", 502, { code: "source_authority_mismatch" });
139
+ return response;
140
+ }
141
+ /** Bounded host-only transfer. The API verifies registered-provider signatures and live publication authority. */
142
+ async publishAssignmentSourceCandidate(assignmentId, request) {
143
+ const body = sourceCandidateRequestSchema.parse(request);
144
+ if (body.candidate.attestation.assignmentId !== assignmentId) throw new CapacityProviderApiError("Candidate assignment correlation failed.", 400, { code: "source_candidate_mismatch" });
145
+ const response = await this.invoke(CONTROL_PLANE_OPERATIONS.providers.sourceCandidate, { path: { assignmentId }, body });
146
+ if (body.action === "commit") {
147
+ const receipt = sourceCandidateReceiptSchema.parse(response);
148
+ if (receipt.leaseId !== body.candidate.attestation.leaseId || receipt.commit !== body.candidate.attestation.commit || receipt.bundle.digest !== body.candidate.attestation.bundle.digest || JSON.stringify(receipt.source) !== JSON.stringify(body.candidate.attestation.source)) throw new CapacityProviderApiError("Candidate receipt correlation failed.", 502, { code: "source_candidate_receipt_mismatch" });
149
+ return receipt;
150
+ }
151
+ if (response.accepted !== true || response.index !== body.index || response.digest !== body.candidate.attestation.bundle.chunks[body.index]) throw new CapacityProviderApiError("Candidate chunk receipt correlation failed.", 502, { code: "source_candidate_chunk_mismatch" });
152
+ return response;
153
+ }
154
+ /** Source artifacts are accessible only through a current assignment, never ambient team access. */
155
+ async readAssignmentSourceChunk(assignmentId, request) {
156
+ const body = sourceChunkRequestSchema.parse(request);
157
+ const response = sourceChunkResponseSchema.parse(await this.invoke(CONTROL_PLANE_OPERATIONS.providers.sourceChunk, { path: { assignmentId }, body }));
158
+ if (response.artifactId !== body.artifactId || response.index !== body.index) throw new CapacityProviderApiError("Source chunk correlation failed.", 502, { code: "source_chunk_mismatch" });
159
+ return response;
160
+ }
129
161
  respondToAssignmentDiscussion(assignmentId, request, idempotencyKey) {
130
162
  return this.invoke(CONTROL_PLANE_OPERATIONS.providers.discussionResponse, { path: { assignmentId }, body: request }, { idempotencyKey });
131
163
  }
@@ -823,7 +823,7 @@ export declare const providerSandboxEnvironmentAvailabilitySchema: z.ZodObject<{
823
823
  checkedAt: z.ZodString;
824
824
  reason: z.ZodNullable<z.ZodString>;
825
825
  }, "strict", z.ZodTypeAny, {
826
- status: "ready" | "failed" | "pulling" | "quarantined";
826
+ status: "ready" | "failed" | "quarantined" | "pulling";
827
827
  version: string;
828
828
  reason: string | null;
829
829
  contractDigest: string;
@@ -831,7 +831,7 @@ export declare const providerSandboxEnvironmentAvailabilitySchema: z.ZodObject<{
831
831
  entryId: string;
832
832
  checkedAt: string;
833
833
  }, {
834
- status: "ready" | "failed" | "pulling" | "quarantined";
834
+ status: "ready" | "failed" | "quarantined" | "pulling";
835
835
  version: string;
836
836
  reason: string | null;
837
837
  contractDigest: string;
@@ -841,7 +841,7 @@ export declare const providerSandboxEnvironmentAvailabilitySchema: z.ZodObject<{
841
841
  }>, "many">;
842
842
  }, "strict", z.ZodTypeAny, {
843
843
  entries: {
844
- status: "ready" | "failed" | "pulling" | "quarantined";
844
+ status: "ready" | "failed" | "quarantined" | "pulling";
845
845
  version: string;
846
846
  reason: string | null;
847
847
  contractDigest: string;
@@ -855,7 +855,7 @@ export declare const providerSandboxEnvironmentAvailabilitySchema: z.ZodObject<{
855
855
  catalogGeneration: number;
856
856
  }, {
857
857
  entries: {
858
- status: "ready" | "failed" | "pulling" | "quarantined";
858
+ status: "ready" | "failed" | "quarantined" | "pulling";
859
859
  version: string;
860
860
  reason: string | null;
861
861
  contractDigest: string;
@@ -1,2 +1,3 @@
1
1
  export * from './sandbox-contracts.js';
2
2
  export * from './source-workspace.js';
3
+ export * from './source/candidate.js';
@@ -1,2 +1,3 @@
1
1
  export * from "./sandbox-contracts.js";
2
2
  export * from "./source-workspace.js";
3
+ export * from "./source/candidate.js";