@treeseed/sdk 0.13.0-rc.119 → 0.13.0-rc.120

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.
Files changed (53) hide show
  1. package/dist/.treeseed-build-complete.json +1 -1
  2. package/dist/agent-capacity/allocation.d.ts +0 -3
  3. package/dist/agent-capacity/allocation.js +0 -221
  4. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.d.ts +280 -84
  5. package/dist/agent-capacity/contracts/capacity/assignments/agent-execution.js +22 -1
  6. package/dist/agent-capacity/contracts/capacity/assignments/assignment-records.d.ts +5 -0
  7. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.d.ts +82 -0
  8. package/dist/agent-capacity/contracts/capacity/workdays/assignment-allocation.js +115 -0
  9. package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.d.ts +142 -0
  10. package/dist/agent-capacity/contracts/capacity/workdays/capability-accounting.js +51 -0
  11. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.d.ts +167 -35
  12. package/dist/agent-capacity/contracts/capacity/workdays/workday-allocation.js +59 -20
  13. package/dist/agent-capacity/contracts/capacity/workdays/workday-records.d.ts +2 -21
  14. package/dist/agent-capacity/contracts/support/execution-graph.d.ts +18 -18
  15. package/dist/agent-capacity/contracts/support/time-capacity.d.ts +0 -14
  16. package/dist/agent-capacity/contracts/support/time-capacity.js +1 -8
  17. package/dist/agent-capacity/validation/agent-definition-schema.d.ts +338 -338
  18. package/dist/capacity/agents/agent-capacity.d.ts +2 -0
  19. package/dist/capacity/agents/agent-capacity.js +2 -0
  20. package/dist/capacity-provider/client.d.ts +5 -3
  21. package/dist/capacity-provider/contracts/capacity-facts.d.ts +14 -0
  22. package/dist/capacity-provider/contracts/governance.d.ts +6 -0
  23. package/dist/capacity-provider/sandbox-contracts.d.ts +55 -1
  24. package/dist/capacity-provider/sandbox-contracts.js +4 -0
  25. package/dist/capacity-provider/source-workspace.d.ts +69 -37
  26. package/dist/capacity-provider/source-workspace.js +36 -5
  27. package/dist/content/validation/auxiliary-content-schemas.d.ts +10 -10
  28. package/dist/content/validation/content-model-schemas.d.ts +613 -613
  29. package/dist/content/validation/content-model-schemas.js +14 -2
  30. package/dist/content/validation/portable-content-data.d.ts +22 -22
  31. package/dist/deployment/postgres/requirements.d.ts +3 -2
  32. package/dist/deployment/postgres/requirements.js +3 -1
  33. package/dist/operator-contracts/canonical-command-tree.js +20 -6
  34. package/dist/operator-contracts/catalog/communication-operations.d.ts +2 -0
  35. package/dist/operator-contracts/catalog/workdays/profile-commands.js +4 -4
  36. package/dist/operator-contracts/catalog/workdays/profile-operations.d.ts +28 -3
  37. package/dist/operator-contracts/catalog/workdays/profile-operations.js +10 -8
  38. package/dist/operator-contracts/catalog/workdays/selection-commands.js +13 -0
  39. package/dist/operator-contracts/command-tree.d.ts +1 -1
  40. package/dist/operator-contracts/communication/contracts.d.ts +6 -0
  41. package/dist/operator-contracts/communication/contracts.js +2 -0
  42. package/dist/operator-contracts/control-plane-operations.d.ts +34 -3
  43. package/dist/operator-contracts/control-plane-operations.js +1 -0
  44. package/dist/operator-contracts/index.d.ts +0 -1
  45. package/dist/operator-contracts/index.js +0 -1
  46. package/dist/operator-contracts/workday-lifecycle.d.ts +8 -20
  47. package/dist/operator-contracts/workday-lifecycle.js +15 -5
  48. package/dist/secrets-capability/shared-resources.d.ts +6 -6
  49. package/package.json +1 -1
  50. package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.d.ts +0 -29
  51. package/dist/agent-capacity/policy/capacity/allocations/allocation-hierarchy.js +0 -110
  52. package/dist/operator-contracts/workday-profile.d.ts +0 -72
  53. package/dist/operator-contracts/workday-profile.js +0 -106
@@ -10,6 +10,8 @@ export * from '../../agent-capacity/contracts/capacity/communication/communicati
10
10
  export * from '../../agent-capacity/contracts/capacity/providers/supply-policy.js';
11
11
  export * from '../../agent-capacity/contracts/capacity/workdays/workday-records.js';
12
12
  export * from '../../agent-capacity/contracts/capacity/workdays/workday-allocation.js';
13
+ export * from '../../agent-capacity/contracts/capacity/workdays/assignment-allocation.js';
14
+ export * from '../../agent-capacity/contracts/capacity/workdays/capability-accounting.js';
13
15
  export * from '../../agent-capacity/contracts/configuration/configuration.js';
14
16
  export * from '../../agent-capacity/contracts/operations/research-workflow.js';
15
17
  export * from '../../agent-capacity/contracts/operations/agent-team-clone.js';
@@ -8,6 +8,8 @@ export * from "../../agent-capacity/contracts/capacity/communication/communicati
8
8
  export * from "../../agent-capacity/contracts/capacity/providers/supply-policy.js";
9
9
  export * from "../../agent-capacity/contracts/capacity/workdays/workday-records.js";
10
10
  export * from "../../agent-capacity/contracts/capacity/workdays/workday-allocation.js";
11
+ export * from "../../agent-capacity/contracts/capacity/workdays/assignment-allocation.js";
12
+ export * from "../../agent-capacity/contracts/capacity/workdays/capability-accounting.js";
11
13
  export * from "../../agent-capacity/contracts/configuration/configuration.js";
12
14
  export * from "../../agent-capacity/contracts/operations/research-workflow.js";
13
15
  export * from "../../agent-capacity/contracts/operations/agent-team-clone.js";
@@ -72,8 +72,10 @@ export declare class ProviderProtocolClient {
72
72
  };
73
73
  mode: "analysis" | "work";
74
74
  attempt: number;
75
- publication: "denied" | "assignment-branch";
76
- credentialBindingId: string;
75
+ publication: "denied" | "assignment-branch" | "simulation-branch";
76
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
77
+ publicationRef?: string | undefined;
78
+ credentialBindingId?: string | undefined;
77
79
  };
78
80
  credential: {
79
81
  id: string;
@@ -85,7 +87,7 @@ export declare class ProviderProtocolClient {
85
87
  tag: string;
86
88
  authorizationId: string;
87
89
  ephemeralPublicKey: string;
88
- };
90
+ } | null;
89
91
  }>;
90
92
  respondToAssignmentDiscussion(assignmentId: string, request: ProviderDiscussionResponseRequest, idempotencyKey: string): Promise<{
91
93
  status: "responded" | "abstained";
@@ -36,6 +36,12 @@ export interface ExecutionProviderObservationCapacity {
36
36
  resetAt?: string | null;
37
37
  confidence?: NativeCapacityConfidence;
38
38
  metadata?: Record<string, unknown>;
39
+ /** UTC-day active execution accounting, keyed by the advertised capability. */
40
+ capabilityUsage?: Record<string, {
41
+ day: string;
42
+ activeSeconds: number;
43
+ reservedSeconds: number;
44
+ }>;
39
45
  }
40
46
  export interface ExecutionProviderNativeCapacity {
41
47
  id?: string;
@@ -50,6 +56,14 @@ export interface ExecutionProviderNativeCapacity {
50
56
  metadata?: Record<string, unknown>;
51
57
  nativeLimits?: ExecutionProviderNativeLimitCapacity[];
52
58
  observation?: ExecutionProviderObservationCapacity;
59
+ /** Shared by all capabilities exposed through this model configuration. */
60
+ modelConfigurationId?: string;
61
+ dailyActiveSecondsLimit?: number;
62
+ capabilityLimits?: Record<string, {
63
+ dailyActiveSecondsLimit: number;
64
+ minimumAssignmentSeconds?: number;
65
+ maximumAssignmentSeconds?: number;
66
+ }>;
53
67
  }
54
68
  export interface CapacityProviderNativeCapacity {
55
69
  executionProviders: ExecutionProviderNativeCapacity[];
@@ -1,5 +1,6 @@
1
1
  import type { ResearchSourcePolicy } from '../../agent-capacity/contracts/support/research-source-policy.js';
2
2
  import type { CapabilityOffer } from '../capability-ontology.js';
3
+ import type { CapabilityAccountingObservation } from '../../agent-capacity/contracts/capacity/workdays/capability-accounting.js';
3
4
  export declare const CAPACITY_PROVIDER_IDENTITY_ALGORITHM: "Ed25519";
4
5
  export declare const CAPACITY_PROVIDER_PROOF_TTL_SECONDS = 300;
5
6
  export declare const CAPACITY_PROVIDER_ACCESS_TOKEN_TTL_SECONDS = 900;
@@ -295,6 +296,10 @@ export interface ProviderExecutionAdapterSnapshot {
295
296
  minimumAssignmentDuration?: MinimumAssignmentDuration;
296
297
  nativeLimits: Record<string, unknown>;
297
298
  observations?: Record<string, unknown>;
299
+ accountingObservation?: {
300
+ modelUsage: CapabilityAccountingObservation;
301
+ capabilityUsage: Record<string, CapabilityAccountingObservation>;
302
+ };
298
303
  }
299
304
  export interface ProviderAvailabilitySnapshot {
300
305
  sequence: number;
@@ -446,6 +451,7 @@ export interface CapacityProviderManifestV5 {
446
451
  endpointRef?: string;
447
452
  baseUrl?: string;
448
453
  model?: string;
454
+ reasoningEffort?: 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
449
455
  };
450
456
  credentialProfiles?: string[];
451
457
  laneIds: string[];
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ export { assignmentTimingAwarenessReceiptSchema } from '../agent-capacity/contracts/capacity/assignments/agent-execution.js';
3
+ export type { AssignmentTimingAwarenessReceipt } from '../agent-capacity/contracts/capacity/assignments/agent-execution.js';
2
4
  declare const sandboxProfile: z.ZodString;
3
5
  export declare const sandboxAssignmentSchema: z.ZodObject<{
4
6
  schemaVersion: z.ZodLiteral<"treeseed.sandbox-assignment/v1">;
@@ -394,6 +396,37 @@ export declare const sandboxResultSchema: z.ZodObject<{
394
396
  mediaType: string;
395
397
  bytes: number;
396
398
  }>, "many">;
399
+ timingAwareness: z.ZodObject<{
400
+ schemaVersion: z.ZodLiteral<"treeseed.assignment-timing-awareness/v1">;
401
+ requiredChecks: z.ZodLiteral<2>;
402
+ completedChecks: z.ZodNumber;
403
+ firstTool: z.ZodLiteral<"treedx:treeseed_time_status">;
404
+ firstToolSucceeded: z.ZodLiteral<true>;
405
+ lastTool: z.ZodLiteral<"treedx:treeseed_time_status">;
406
+ lastToolSucceeded: z.ZodLiteral<true>;
407
+ firstToolCompliant: z.ZodLiteral<true>;
408
+ finalToolCompliant: z.ZodLiteral<true>;
409
+ }, "strict", z.ZodTypeAny, {
410
+ schemaVersion: "treeseed.assignment-timing-awareness/v1";
411
+ requiredChecks: 2;
412
+ completedChecks: number;
413
+ firstTool: "treedx:treeseed_time_status";
414
+ firstToolSucceeded: true;
415
+ lastTool: "treedx:treeseed_time_status";
416
+ lastToolSucceeded: true;
417
+ firstToolCompliant: true;
418
+ finalToolCompliant: true;
419
+ }, {
420
+ schemaVersion: "treeseed.assignment-timing-awareness/v1";
421
+ requiredChecks: 2;
422
+ completedChecks: number;
423
+ firstTool: "treedx:treeseed_time_status";
424
+ firstToolSucceeded: true;
425
+ lastTool: "treedx:treeseed_time_status";
426
+ lastToolSucceeded: true;
427
+ firstToolCompliant: true;
428
+ finalToolCompliant: true;
429
+ }>;
397
430
  usage: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
398
431
  diagnostics: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
399
432
  teardown: z.ZodObject<{
@@ -420,6 +453,17 @@ export declare const sandboxResultSchema: z.ZodObject<{
420
453
  summary: string;
421
454
  usage: Record<string, unknown>;
422
455
  diagnostics: Record<string, unknown>;
456
+ timingAwareness: {
457
+ schemaVersion: "treeseed.assignment-timing-awareness/v1";
458
+ requiredChecks: 2;
459
+ completedChecks: number;
460
+ firstTool: "treedx:treeseed_time_status";
461
+ firstToolSucceeded: true;
462
+ lastTool: "treedx:treeseed_time_status";
463
+ lastToolSucceeded: true;
464
+ firstToolCompliant: true;
465
+ finalToolCompliant: true;
466
+ };
423
467
  sandboxId: string;
424
468
  teardown: {
425
469
  completedAt: string | null;
@@ -438,6 +482,17 @@ export declare const sandboxResultSchema: z.ZodObject<{
438
482
  bytes: number;
439
483
  }[];
440
484
  summary: string;
485
+ timingAwareness: {
486
+ schemaVersion: "treeseed.assignment-timing-awareness/v1";
487
+ requiredChecks: 2;
488
+ completedChecks: number;
489
+ firstTool: "treedx:treeseed_time_status";
490
+ firstToolSucceeded: true;
491
+ lastTool: "treedx:treeseed_time_status";
492
+ lastToolSucceeded: true;
493
+ firstToolCompliant: true;
494
+ finalToolCompliant: true;
495
+ };
441
496
  sandboxId: string;
442
497
  teardown: {
443
498
  completedAt: string | null;
@@ -545,4 +600,3 @@ export type SandboxLeaseRenewal = z.infer<typeof sandboxLeaseRenewalSchema>;
545
600
  export type SandboxResult = z.infer<typeof sandboxResultSchema>;
546
601
  export type ProviderEnvironmentReceipt = z.infer<typeof providerEnvironmentReceiptSchema>;
547
602
  export type SandboxEnvironmentProfile = z.infer<typeof sandboxProfile>;
548
- export {};
@@ -1,4 +1,6 @@
1
1
  import { z } from "zod";
2
+ import { assignmentTimingAwarenessReceiptSchema } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
3
+ import { assignmentTimingAwarenessReceiptSchema as assignmentTimingAwarenessReceiptSchema2 } from "../agent-capacity/contracts/capacity/assignments/agent-execution.js";
2
4
  const identifier = z.string().regex(/^[a-z][a-z0-9._-]{0,127}$/u);
3
5
  const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
4
6
  const sandboxProfile = identifier;
@@ -60,6 +62,7 @@ const sandboxResultSchema = z.object({
60
62
  summary: z.string(),
61
63
  responseMarkdown: z.string().optional(),
62
64
  artifacts: z.array(z.object({ id: identifier, path: z.string().startsWith("/run/treeseed-output/"), digest, mediaType: z.string().min(1), bytes: z.number().int().nonnegative() }).strict()),
65
+ timingAwareness: assignmentTimingAwarenessReceiptSchema,
63
66
  usage: z.record(z.unknown()).default({}),
64
67
  diagnostics: z.record(z.unknown()).default({}),
65
68
  teardown: z.object({ verified: z.boolean(), completedAt: z.string().datetime().nullable() }).strict()
@@ -78,6 +81,7 @@ const providerEnvironmentReceiptSchema = z.object({
78
81
  signature: z.object({ keyId: identifier, algorithm: z.literal("Ed25519"), value: z.string().min(1) }).strict()
79
82
  }).strict();
80
83
  export {
84
+ assignmentTimingAwarenessReceiptSchema2 as assignmentTimingAwarenessReceiptSchema,
81
85
  providerEnvironmentReceiptSchema,
82
86
  sandboxAssignmentSchema,
83
87
  sandboxEventSchema,
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  /** The assignment identity already includes node revision and attempt. */
3
3
  export declare function assignmentSourceBranch(assignmentId: string): string;
4
+ export declare function simulationSourceBranch(campaignId: string, workdayId: string, assignmentId: string): string;
4
5
  /** Portable identity of canonical source. Physical storage belongs exclusively to Deployment. */
5
6
  export declare const sourceWorkspaceKeySchema: z.ZodObject<{
6
7
  controlPlaneId: z.ZodString;
@@ -60,8 +61,10 @@ export declare const sourceWorkspaceAuthorizationSchema: z.ZodEffects<z.ZodObjec
60
61
  formatVersion: 1;
61
62
  }>;
62
63
  mode: z.ZodEnum<["analysis", "work"]>;
63
- publication: z.ZodEnum<["denied", "assignment-branch"]>;
64
- credentialBindingId: z.ZodString;
64
+ acquisition: z.ZodEnum<["upstream-public", "upstream-authorized", "simulation-local"]>;
65
+ publication: z.ZodEnum<["denied", "assignment-branch", "simulation-branch"]>;
66
+ publicationRef: z.ZodOptional<z.ZodString>;
67
+ credentialBindingId: z.ZodOptional<z.ZodString>;
65
68
  issuedAt: z.ZodString;
66
69
  expiresAt: z.ZodString;
67
70
  }, "strict", z.ZodTypeAny, {
@@ -82,8 +85,10 @@ export declare const sourceWorkspaceAuthorizationSchema: z.ZodEffects<z.ZodObjec
82
85
  };
83
86
  mode: "analysis" | "work";
84
87
  attempt: number;
85
- publication: "denied" | "assignment-branch";
86
- credentialBindingId: string;
88
+ publication: "denied" | "assignment-branch" | "simulation-branch";
89
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
90
+ publicationRef?: string | undefined;
91
+ credentialBindingId?: string | undefined;
87
92
  }, {
88
93
  id: string;
89
94
  expiresAt: string;
@@ -102,8 +107,10 @@ export declare const sourceWorkspaceAuthorizationSchema: z.ZodEffects<z.ZodObjec
102
107
  };
103
108
  mode: "analysis" | "work";
104
109
  attempt: number;
105
- publication: "denied" | "assignment-branch";
106
- credentialBindingId: string;
110
+ publication: "denied" | "assignment-branch" | "simulation-branch";
111
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
112
+ publicationRef?: string | undefined;
113
+ credentialBindingId?: string | undefined;
107
114
  }>, {
108
115
  id: string;
109
116
  expiresAt: string;
@@ -122,8 +129,10 @@ export declare const sourceWorkspaceAuthorizationSchema: z.ZodEffects<z.ZodObjec
122
129
  };
123
130
  mode: "analysis" | "work";
124
131
  attempt: number;
125
- publication: "denied" | "assignment-branch";
126
- credentialBindingId: string;
132
+ publication: "denied" | "assignment-branch" | "simulation-branch";
133
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
134
+ publicationRef?: string | undefined;
135
+ credentialBindingId?: string | undefined;
127
136
  }, {
128
137
  id: string;
129
138
  expiresAt: string;
@@ -142,8 +151,10 @@ export declare const sourceWorkspaceAuthorizationSchema: z.ZodEffects<z.ZodObjec
142
151
  };
143
152
  mode: "analysis" | "work";
144
153
  attempt: number;
145
- publication: "denied" | "assignment-branch";
146
- credentialBindingId: string;
154
+ publication: "denied" | "assignment-branch" | "simulation-branch";
155
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
156
+ publicationRef?: string | undefined;
157
+ credentialBindingId?: string | undefined;
147
158
  }>;
148
159
  export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
149
160
  schemaVersion: z.ZodLiteral<"treeseed.source-workspace-lease/v1">;
@@ -179,7 +190,8 @@ export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
179
190
  }>;
180
191
  workspaceDigest: z.ZodString;
181
192
  mode: z.ZodEnum<["analysis", "work"]>;
182
- publication: z.ZodEnum<["denied", "assignment-branch"]>;
193
+ acquisition: z.ZodEnum<["upstream-public", "upstream-authorized", "simulation-local"]>;
194
+ publication: z.ZodEnum<["denied", "assignment-branch", "simulation-branch"]>;
183
195
  state: z.ZodEnum<["active", "exporting", "released", "quarantined"]>;
184
196
  createdAt: z.ZodString;
185
197
  expiresAt: z.ZodString;
@@ -202,7 +214,8 @@ export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
202
214
  };
203
215
  mode: "analysis" | "work";
204
216
  attempt: number;
205
- publication: "denied" | "assignment-branch";
217
+ publication: "denied" | "assignment-branch" | "simulation-branch";
218
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
206
219
  authorizationId: string;
207
220
  workspaceDigest: string;
208
221
  }, {
@@ -224,7 +237,8 @@ export declare const sourceWorkspaceLeaseSchema: z.ZodObject<{
224
237
  };
225
238
  mode: "analysis" | "work";
226
239
  attempt: number;
227
- publication: "denied" | "assignment-branch";
240
+ publication: "denied" | "assignment-branch" | "simulation-branch";
241
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
228
242
  authorizationId: string;
229
243
  workspaceDigest: string;
230
244
  }>;
@@ -309,8 +323,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
309
323
  formatVersion: 1;
310
324
  }>;
311
325
  mode: z.ZodEnum<["analysis", "work"]>;
312
- publication: z.ZodEnum<["denied", "assignment-branch"]>;
313
- credentialBindingId: z.ZodString;
326
+ acquisition: z.ZodEnum<["upstream-public", "upstream-authorized", "simulation-local"]>;
327
+ publication: z.ZodEnum<["denied", "assignment-branch", "simulation-branch"]>;
328
+ publicationRef: z.ZodOptional<z.ZodString>;
329
+ credentialBindingId: z.ZodOptional<z.ZodString>;
314
330
  issuedAt: z.ZodString;
315
331
  expiresAt: z.ZodString;
316
332
  }, "strict", z.ZodTypeAny, {
@@ -331,8 +347,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
331
347
  };
332
348
  mode: "analysis" | "work";
333
349
  attempt: number;
334
- publication: "denied" | "assignment-branch";
335
- credentialBindingId: string;
350
+ publication: "denied" | "assignment-branch" | "simulation-branch";
351
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
352
+ publicationRef?: string | undefined;
353
+ credentialBindingId?: string | undefined;
336
354
  }, {
337
355
  id: string;
338
356
  expiresAt: string;
@@ -351,8 +369,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
351
369
  };
352
370
  mode: "analysis" | "work";
353
371
  attempt: number;
354
- publication: "denied" | "assignment-branch";
355
- credentialBindingId: string;
372
+ publication: "denied" | "assignment-branch" | "simulation-branch";
373
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
374
+ publicationRef?: string | undefined;
375
+ credentialBindingId?: string | undefined;
356
376
  }>, {
357
377
  id: string;
358
378
  expiresAt: string;
@@ -371,8 +391,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
371
391
  };
372
392
  mode: "analysis" | "work";
373
393
  attempt: number;
374
- publication: "denied" | "assignment-branch";
375
- credentialBindingId: string;
394
+ publication: "denied" | "assignment-branch" | "simulation-branch";
395
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
396
+ publicationRef?: string | undefined;
397
+ credentialBindingId?: string | undefined;
376
398
  }, {
377
399
  id: string;
378
400
  expiresAt: string;
@@ -391,8 +413,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
391
413
  };
392
414
  mode: "analysis" | "work";
393
415
  attempt: number;
394
- publication: "denied" | "assignment-branch";
395
- credentialBindingId: string;
416
+ publication: "denied" | "assignment-branch" | "simulation-branch";
417
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
418
+ publicationRef?: string | undefined;
419
+ credentialBindingId?: string | undefined;
396
420
  }>;
397
421
  repository: z.ZodObject<{
398
422
  provider: z.ZodLiteral<"github">;
@@ -413,7 +437,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
413
437
  ref: string;
414
438
  cloneUrl: string;
415
439
  }>;
416
- credential: z.ZodObject<{
440
+ credential: z.ZodNullable<z.ZodObject<{
417
441
  schemaVersion: z.ZodLiteral<"treeseed.source-credential-delivery/v1">;
418
442
  id: z.ZodString;
419
443
  authorizationId: z.ZodString;
@@ -443,7 +467,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
443
467
  tag: string;
444
468
  authorizationId: string;
445
469
  ephemeralPublicKey: string;
446
- }>;
470
+ }>>;
447
471
  }, "strict", z.ZodTypeAny, {
448
472
  repository: {
449
473
  provider: "github";
@@ -470,8 +494,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
470
494
  };
471
495
  mode: "analysis" | "work";
472
496
  attempt: number;
473
- publication: "denied" | "assignment-branch";
474
- credentialBindingId: string;
497
+ publication: "denied" | "assignment-branch" | "simulation-branch";
498
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
499
+ publicationRef?: string | undefined;
500
+ credentialBindingId?: string | undefined;
475
501
  };
476
502
  credential: {
477
503
  id: string;
@@ -483,7 +509,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
483
509
  tag: string;
484
510
  authorizationId: string;
485
511
  ephemeralPublicKey: string;
486
- };
512
+ } | null;
487
513
  }, {
488
514
  repository: {
489
515
  provider: "github";
@@ -510,8 +536,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
510
536
  };
511
537
  mode: "analysis" | "work";
512
538
  attempt: number;
513
- publication: "denied" | "assignment-branch";
514
- credentialBindingId: string;
539
+ publication: "denied" | "assignment-branch" | "simulation-branch";
540
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
541
+ publicationRef?: string | undefined;
542
+ credentialBindingId?: string | undefined;
515
543
  };
516
544
  credential: {
517
545
  id: string;
@@ -523,7 +551,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
523
551
  tag: string;
524
552
  authorizationId: string;
525
553
  ephemeralPublicKey: string;
526
- };
554
+ } | null;
527
555
  }>, {
528
556
  repository: {
529
557
  provider: "github";
@@ -550,8 +578,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
550
578
  };
551
579
  mode: "analysis" | "work";
552
580
  attempt: number;
553
- publication: "denied" | "assignment-branch";
554
- credentialBindingId: string;
581
+ publication: "denied" | "assignment-branch" | "simulation-branch";
582
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
583
+ publicationRef?: string | undefined;
584
+ credentialBindingId?: string | undefined;
555
585
  };
556
586
  credential: {
557
587
  id: string;
@@ -563,7 +593,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
563
593
  tag: string;
564
594
  authorizationId: string;
565
595
  ephemeralPublicKey: string;
566
- };
596
+ } | null;
567
597
  }, {
568
598
  repository: {
569
599
  provider: "github";
@@ -590,8 +620,10 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
590
620
  };
591
621
  mode: "analysis" | "work";
592
622
  attempt: number;
593
- publication: "denied" | "assignment-branch";
594
- credentialBindingId: string;
623
+ publication: "denied" | "assignment-branch" | "simulation-branch";
624
+ acquisition: "upstream-public" | "upstream-authorized" | "simulation-local";
625
+ publicationRef?: string | undefined;
626
+ credentialBindingId?: string | undefined;
595
627
  };
596
628
  credential: {
597
629
  id: string;
@@ -603,7 +635,7 @@ export declare const sourceWorkspaceResponseSchema: z.ZodEffects<z.ZodObject<{
603
635
  tag: string;
604
636
  authorizationId: string;
605
637
  ephemeralPublicKey: string;
606
- };
638
+ } | null;
607
639
  }>;
608
640
  export type SourceCredentialDelivery = z.infer<typeof sourceCredentialDeliverySchema>;
609
641
  export type SourceWorkspaceRequest = z.infer<typeof sourceWorkspaceRequestSchema>;
@@ -6,6 +6,12 @@ function assignmentSourceBranch(assignmentId) {
6
6
  if (!/^[A-Za-z0-9._-]+$/u.test(assignmentId)) throw new Error("Invalid assignment branch identity.");
7
7
  return `treeseed/assignments/${assignmentId}`;
8
8
  }
9
+ function simulationSourceBranch(campaignId, workdayId, assignmentId) {
10
+ for (const [label, value] of Object.entries({ campaignId, workdayId, assignmentId })) {
11
+ if (!/^[A-Za-z0-9._-]+$/u.test(value)) throw new Error(`Invalid simulation ${label}.`);
12
+ }
13
+ return `simulation/${campaignId}/${workdayId}/${assignmentId}`;
14
+ }
9
15
  const sourceWorkspaceKeySchema = z.object({
10
16
  controlPlaneId: id,
11
17
  teamId: id,
@@ -23,8 +29,10 @@ const sourceWorkspaceAuthorizationSchema = z.object({
23
29
  attempt: z.number().int().positive(),
24
30
  source: sourceWorkspaceKeySchema,
25
31
  mode: z.enum(["analysis", "work"]),
26
- publication: z.enum(["denied", "assignment-branch"]),
27
- credentialBindingId: id,
32
+ acquisition: z.enum(["upstream-public", "upstream-authorized", "simulation-local"]),
33
+ publication: z.enum(["denied", "assignment-branch", "simulation-branch"]),
34
+ publicationRef: id.optional(),
35
+ credentialBindingId: id.optional(),
28
36
  issuedAt: z.string().datetime(),
29
37
  expiresAt: z.string().datetime()
30
38
  }).strict().superRefine((value, context) => {
@@ -34,6 +42,24 @@ const sourceWorkspaceAuthorizationSchema = z.object({
34
42
  if (value.mode === "analysis" && value.publication !== "denied") {
35
43
  context.addIssue({ code: z.ZodIssueCode.custom, path: ["publication"], message: "Analysis cannot publish source changes." });
36
44
  }
45
+ if (value.publication === "denied" && value.publicationRef) {
46
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["publicationRef"], message: "Denied publication cannot name a destination ref." });
47
+ }
48
+ if (value.publication !== "denied" && !value.publicationRef) {
49
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["publicationRef"], message: "Work publication requires its exact destination ref." });
50
+ }
51
+ if (value.publication === "assignment-branch" && !value.credentialBindingId) {
52
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["credentialBindingId"], message: "Upstream publication requires a credential binding." });
53
+ }
54
+ if (value.publication === "simulation-branch" && value.credentialBindingId) {
55
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["credentialBindingId"], message: "Simulation cannot receive an upstream credential binding." });
56
+ }
57
+ if (value.acquisition === "upstream-authorized" && !value.credentialBindingId) {
58
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["credentialBindingId"], message: "Authorized acquisition requires a credential binding." });
59
+ }
60
+ if (value.acquisition !== "upstream-authorized" && value.credentialBindingId) {
61
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["credentialBindingId"], message: "Public and simulation-local acquisition cannot receive a credential binding." });
62
+ }
37
63
  });
38
64
  const sourceWorkspaceLeaseSchema = z.object({
39
65
  schemaVersion: z.literal("treeseed.source-workspace-lease/v1"),
@@ -45,7 +71,8 @@ const sourceWorkspaceLeaseSchema = z.object({
45
71
  source: sourceWorkspaceKeySchema,
46
72
  workspaceDigest: digest,
47
73
  mode: z.enum(["analysis", "work"]),
48
- publication: z.enum(["denied", "assignment-branch"]),
74
+ acquisition: z.enum(["upstream-public", "upstream-authorized", "simulation-local"]),
75
+ publication: z.enum(["denied", "assignment-branch", "simulation-branch"]),
49
76
  state: z.enum(["active", "exporting", "released", "quarantined"]),
50
77
  createdAt: z.string().datetime(),
51
78
  expiresAt: z.string().datetime()
@@ -75,17 +102,21 @@ const sourceWorkspaceResponseSchema = z.object({
75
102
  cloneUrl: z.string().url().startsWith("https://github.com/"),
76
103
  ref: id
77
104
  }).strict(),
78
- credential: sourceCredentialDeliverySchema
105
+ credential: sourceCredentialDeliverySchema.nullable()
79
106
  }).strict().superRefine((value, context) => {
80
107
  if (value.repository.cloneUrl !== `https://github.com/${value.repository.owner}/${value.repository.name}.git`) {
81
108
  context.addIssue({ code: z.ZodIssueCode.custom, path: ["repository", "cloneUrl"], message: "Source transport must match its provider repository." });
82
109
  }
83
- if (value.credential.authorizationId !== value.authorization.id || value.credential.expiresAt !== value.authorization.expiresAt) {
110
+ if (value.credential && (value.credential.authorizationId !== value.authorization.id || value.credential.expiresAt !== value.authorization.expiresAt)) {
84
111
  context.addIssue({ code: z.ZodIssueCode.custom, path: ["credential"], message: "Source credential delivery must match exact authorization and lifetime." });
85
112
  }
113
+ if (Boolean(value.authorization.credentialBindingId) !== Boolean(value.credential)) {
114
+ context.addIssue({ code: z.ZodIssueCode.custom, path: ["credential"], message: "Credential delivery must match the declared binding." });
115
+ }
86
116
  });
87
117
  export {
88
118
  assignmentSourceBranch,
119
+ simulationSourceBranch,
89
120
  sourceCredentialDeliverySchema,
90
121
  sourceWorkspaceAuthorizationSchema,
91
122
  sourceWorkspaceKeySchema,
@@ -220,8 +220,8 @@ export declare const workdayContentSchema: z.ZodObject<{
220
220
  visibility?: "team" | "public" | "private" | "authenticated" | undefined;
221
221
  teamId?: string | undefined;
222
222
  createdAt?: Date | undefined;
223
- metadata?: Record<string, unknown> | undefined;
224
223
  endedAt?: Date | null | undefined;
224
+ metadata?: Record<string, unknown> | undefined;
225
225
  changedFiles?: string[] | undefined;
226
226
  reportKind?: string | undefined;
227
227
  dailyTaskCreditBudget?: number | undefined;
@@ -647,7 +647,7 @@ export declare const agentTestContentSchema: z.ZodEffects<z.ZodObject<{
647
647
  }>>;
648
648
  maxLatencyMs: z.ZodOptional<z.ZodNumber>;
649
649
  }, "strip", z.ZodTypeAny, {
650
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
650
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
651
651
  agent: string;
652
652
  id: string;
653
653
  trigger: Record<string, unknown>;
@@ -691,7 +691,7 @@ export declare const agentTestContentSchema: z.ZodEffects<z.ZodObject<{
691
691
  } | undefined;
692
692
  maxLatencyMs?: number | undefined;
693
693
  }, {
694
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
694
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
695
695
  agent: string;
696
696
  id: string;
697
697
  fixture?: string | undefined;
@@ -751,7 +751,7 @@ export declare const agentTestContentSchema: z.ZodEffects<z.ZodObject<{
751
751
  } | undefined;
752
752
  maxLatencyMs?: number | undefined;
753
753
  }>, {
754
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
754
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
755
755
  agent: string;
756
756
  id: string;
757
757
  trigger: Record<string, unknown>;
@@ -795,7 +795,7 @@ export declare const agentTestContentSchema: z.ZodEffects<z.ZodObject<{
795
795
  } | undefined;
796
796
  maxLatencyMs?: number | undefined;
797
797
  }, {
798
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
798
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
799
799
  agent: string;
800
800
  id: string;
801
801
  fixture?: string | undefined;
@@ -999,7 +999,7 @@ export declare const auxiliaryContentSchemas: {
999
999
  }>>;
1000
1000
  maxLatencyMs: z.ZodOptional<z.ZodNumber>;
1001
1001
  }, "strip", z.ZodTypeAny, {
1002
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1002
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1003
1003
  agent: string;
1004
1004
  id: string;
1005
1005
  trigger: Record<string, unknown>;
@@ -1043,7 +1043,7 @@ export declare const auxiliaryContentSchemas: {
1043
1043
  } | undefined;
1044
1044
  maxLatencyMs?: number | undefined;
1045
1045
  }, {
1046
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1046
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1047
1047
  agent: string;
1048
1048
  id: string;
1049
1049
  fixture?: string | undefined;
@@ -1103,7 +1103,7 @@ export declare const auxiliaryContentSchemas: {
1103
1103
  } | undefined;
1104
1104
  maxLatencyMs?: number | undefined;
1105
1105
  }>, {
1106
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1106
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1107
1107
  agent: string;
1108
1108
  id: string;
1109
1109
  trigger: Record<string, unknown>;
@@ -1147,7 +1147,7 @@ export declare const auxiliaryContentSchemas: {
1147
1147
  } | undefined;
1148
1148
  maxLatencyMs?: number | undefined;
1149
1149
  }, {
1150
- kind: "handler" | "workday" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1150
+ kind: "workday" | "handler" | "api" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
1151
1151
  agent: string;
1152
1152
  id: string;
1153
1153
  fixture?: string | undefined;
@@ -1428,8 +1428,8 @@ export declare const auxiliaryContentSchemas: {
1428
1428
  visibility?: "team" | "public" | "private" | "authenticated" | undefined;
1429
1429
  teamId?: string | undefined;
1430
1430
  createdAt?: Date | undefined;
1431
- metadata?: Record<string, unknown> | undefined;
1432
1431
  endedAt?: Date | null | undefined;
1432
+ metadata?: Record<string, unknown> | undefined;
1433
1433
  changedFiles?: string[] | undefined;
1434
1434
  reportKind?: string | undefined;
1435
1435
  dailyTaskCreditBudget?: number | undefined;