@treeseed/sdk 0.10.6 → 0.10.7

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 (41) hide show
  1. package/dist/index.d.ts +2 -0
  2. package/dist/index.js +58 -0
  3. package/dist/operations/repository-operations.d.ts +129 -0
  4. package/dist/operations/repository-operations.js +634 -0
  5. package/dist/operations/services/config-runtime.d.ts +7 -6
  6. package/dist/operations/services/config-runtime.js +45 -25
  7. package/dist/operations/services/deploy.d.ts +42 -0
  8. package/dist/operations/services/deploy.js +1 -1
  9. package/dist/operations/services/project-platform.d.ts +41 -1
  10. package/dist/operations/services/project-platform.js +13 -0
  11. package/dist/operations/services/railway-api.d.ts +35 -1
  12. package/dist/operations/services/railway-api.js +240 -35
  13. package/dist/operations/services/railway-deploy.d.ts +16 -234
  14. package/dist/operations/services/railway-deploy.js +177 -62
  15. package/dist/operations/services/release-candidate.js +1 -2
  16. package/dist/operations/services/runtime-tools.d.ts +14 -0
  17. package/dist/operations/services/runtime-tools.js +15 -1
  18. package/dist/operations/services/workspace-save.d.ts +24 -0
  19. package/dist/operations/services/workspace-save.js +143 -3
  20. package/dist/operations/services/workspace-tools.js +1 -1
  21. package/dist/platform/env.yaml +163 -2
  22. package/dist/platform/environment.d.ts +1 -0
  23. package/dist/platform/environment.js +9 -0
  24. package/dist/platform-operation-store.d.ts +90 -0
  25. package/dist/platform-operation-store.js +505 -0
  26. package/dist/platform-operations.d.ts +265 -0
  27. package/dist/platform-operations.js +421 -0
  28. package/dist/reconcile/bootstrap-systems.js +3 -3
  29. package/dist/reconcile/builtin-adapters.js +225 -29
  30. package/dist/reconcile/contracts.d.ts +1 -1
  31. package/dist/reconcile/desired-state.d.ts +14 -0
  32. package/dist/reconcile/desired-state.js +4 -0
  33. package/dist/reconcile/engine.d.ts +28 -0
  34. package/dist/reconcile/state.js +3 -0
  35. package/dist/reconcile/units.js +2 -0
  36. package/dist/workflow/operations.d.ts +13 -5
  37. package/dist/workflow/operations.js +69 -12
  38. package/dist/workflow-state.d.ts +2 -0
  39. package/dist/workflow-state.js +7 -2
  40. package/dist/workflow.d.ts +2 -0
  41. package/package.json +15 -2
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export { createControlPlaneReporter } from './control-plane.ts';
5
5
  export { ControlPlaneClient } from './control-plane-client.ts';
6
6
  export * from './seeds/index.ts';
7
7
  export { CAPACITY_PROVIDER_ENDPOINTS, CAPACITY_PROVIDER_DEPLOYMENT_SERVICE_ROLES, CAPACITY_PROVIDER_ENV_KEYS, CAPACITY_PROVIDER_SCOPES, CapacityProviderApiError, MarketProviderClient, assertCapacityProviderOkEnvelope, assertCapacityProviderPortfolioManifest, assertCapacityProviderRegistrationResponse, buildCapacityProviderAuthHeaders, deployCapacityProviderToManagedMarketHost, deployCapacityProviderToRailway, isCapacityProviderSecretEnvKey, redactCapacityProviderEnv, redactCapacityProviderSecret, renderCapacityProviderSelfHostInstructions, persistCapacityProviderConnectionToTreeseedConfig, resolveCapacityProviderEnvironment, resolveCapacityProviderLaunchEnvironment, } from './capacity-provider.ts';
8
+ export { PLATFORM_OPERATION_ENDPOINTS, PLATFORM_OPERATION_NAMESPACES, PLATFORM_OPERATION_SCOPES, PLATFORM_OPERATION_STATUSES, PLATFORM_OPERATION_TARGETS, PlatformOperationApiError, PlatformRunnerClient, assertPlatformOperation, assertPlatformOperationEvent, assertPlatformOperationOkEnvelope, buildPlatformRunnerAuthHeaders, createPlatformOperationExecutorRegistry, derivePlatformOperationNavigation, isPlatformOperationSuccessful, isPlatformOperationTerminal, pollPlatformOperation, runPlatformOperationOnce, type PlatformOperation, type PlatformOperationEvent, type PlatformOperationNavigationResult, type PlatformOperationPollOptions, type PlatformOperationPollResult, } from './platform-operations.ts';
9
+ export { PLATFORM_CONTENT_COLLECTIONS, PLATFORM_WORK_CONTENT_COLLECTIONS, createPlatformRepositoryClaim, derivePlatformRepositoryKey, executePlatformRepositoryOperation, normalizePlatformContentInput, normalizePlatformRelationArray, platformContentRelationPolicy, resolvePlatformRepositoryWorkspacePath, slugifyPlatformContent, type PlatformContentCollection, type PlatformRepositoryClaim, type PlatformRepositoryClaimInput, type PlatformRepositoryDescriptor, type PlatformRepositoryOperationInput, type PlatformRepositoryOperationOptions, type PlatformRepositoryOperationResult, type PlatformRepositoryPathPolicy, type PlatformRepositoryVerificationCommand, type PlatformRepositoryVerificationResult, type NormalizedPlatformContentInput, } from './operations/repository-operations.ts';
8
10
  export { DEFAULT_EXECUTION_PROFILE_ID, DEFAULT_EXECUTION_PROFILES, DEFAULT_TASK_ADMISSION_POLICY, buildTaskEstimateProfileFromActuals, computeWorkdayBudgetEnvelope, decideTaskAdmission, estimateAttentionForTask, estimateConfidenceFromProfile, estimateLearningPercentile, estimateLearningVariance, estimateForClassification, estimateProfileConfidenceScore, estimateUtilityForTask, isInterruptedUsageActual, normalizeHybridExecutionPlan, mutationRequiresRepositoryClaim, normalizePlanningPolicy, normalizePredictiveReservePolicy, normalizeTaskPlanProposal, normalizeExecutionProfile, normalizeAttentionPolicy, normalizeTaskAdmissionPolicy, normalizeUtilityPolicy, predictReserveForCapacityPlan, progressivelyAdmitPlanProposal, rankPlannedTaskNodes, reservationHasCapacity, reserveCreditsForEstimate, routeAndReserveCapacity, scoreCapacityLane, selectBestCapacityLane, selectTaskEstimateProfile, settleCapacityActuals, shouldInterruptForCapacity, synthesizePlanEstimate, createReservationReleaseEntry, summarizeCapacityPlan, summarizeProjectCapacityPlan, summarizeTeamCapacityPlan, validateTaskPlanProposal, } from './capacity.ts';
9
11
  export { executeKnowledgeHubProviderLaunch, validateKnowledgeHubProviderLaunchPrerequisites, } from './operations/services/hub-provider-launch.ts';
10
12
  export { createKnowledgeHubRepositories, defaultHubContentResolutionPolicy, executeKnowledgeHubLaunch, normalizeKnowledgeHubLaunchIntent, planKnowledgeHubLaunch, planKnowledgeHubRepositories, validateRepositoryHost, type HubContentResolutionPolicy, type KnowledgeHubLaunchIntent, type KnowledgeHubLaunchPhase, type KnowledgeHubLaunchPlan, type KnowledgeHubLaunchResult, type KnowledgeHubRepositoryPlan, type RepositoryHost, } from './operations/services/hub-launch.ts';
package/dist/index.js CHANGED
@@ -25,6 +25,37 @@ import {
25
25
  resolveCapacityProviderEnvironment,
26
26
  resolveCapacityProviderLaunchEnvironment
27
27
  } from "./capacity-provider.js";
28
+ import {
29
+ PLATFORM_OPERATION_ENDPOINTS,
30
+ PLATFORM_OPERATION_NAMESPACES,
31
+ PLATFORM_OPERATION_SCOPES,
32
+ PLATFORM_OPERATION_STATUSES,
33
+ PLATFORM_OPERATION_TARGETS,
34
+ PlatformOperationApiError,
35
+ PlatformRunnerClient,
36
+ assertPlatformOperation,
37
+ assertPlatformOperationEvent,
38
+ assertPlatformOperationOkEnvelope,
39
+ buildPlatformRunnerAuthHeaders,
40
+ createPlatformOperationExecutorRegistry,
41
+ derivePlatformOperationNavigation,
42
+ isPlatformOperationSuccessful,
43
+ isPlatformOperationTerminal,
44
+ pollPlatformOperation,
45
+ runPlatformOperationOnce
46
+ } from "./platform-operations.js";
47
+ import {
48
+ PLATFORM_CONTENT_COLLECTIONS,
49
+ PLATFORM_WORK_CONTENT_COLLECTIONS,
50
+ createPlatformRepositoryClaim,
51
+ derivePlatformRepositoryKey,
52
+ executePlatformRepositoryOperation,
53
+ normalizePlatformContentInput,
54
+ normalizePlatformRelationArray,
55
+ platformContentRelationPolicy,
56
+ resolvePlatformRepositoryWorkspacePath,
57
+ slugifyPlatformContent
58
+ } from "./operations/repository-operations.js";
28
59
  import {
29
60
  DEFAULT_EXECUTION_PROFILE_ID,
30
61
  DEFAULT_EXECUTION_PROFILES,
@@ -290,9 +321,18 @@ export {
290
321
  MarketApiError,
291
322
  MarketClient,
292
323
  MarketProviderClient,
324
+ PLATFORM_CONTENT_COLLECTIONS,
325
+ PLATFORM_OPERATION_ENDPOINTS,
326
+ PLATFORM_OPERATION_NAMESPACES,
327
+ PLATFORM_OPERATION_SCOPES,
328
+ PLATFORM_OPERATION_STATUSES,
329
+ PLATFORM_OPERATION_TARGETS,
330
+ PLATFORM_WORK_CONTENT_COLLECTIONS,
293
331
  PROJECT_JOB_STATUSES,
294
332
  PROJECT_TEAM_CAPABILITIES,
295
333
  PUBLISHED_CONTENT_MANIFEST_SCHEMA_VERSION,
334
+ PlatformOperationApiError,
335
+ PlatformRunnerClient,
296
336
  RELEASE_STATES,
297
337
  RemoteTemplateCatalogClient,
298
338
  RemoteTreeseedAuthClient,
@@ -319,11 +359,15 @@ export {
319
359
  assertCapacityProviderOkEnvelope,
320
360
  assertCapacityProviderPortfolioManifest,
321
361
  assertCapacityProviderRegistrationResponse,
362
+ assertPlatformOperation,
363
+ assertPlatformOperationEvent,
364
+ assertPlatformOperationOkEnvelope,
322
365
  buildBuiltinModelRegistry,
323
366
  buildCapacityProviderAuthHeaders,
324
367
  buildCopilotAllowToolArgs,
325
368
  buildKnowledgePackMarketPackage,
326
369
  buildModelRegistry,
370
+ buildPlatformRunnerAuthHeaders,
327
371
  buildScopedModelRegistry,
328
372
  buildTaskEstimateProfileFromActuals,
329
373
  buildTemplateMarketPackage,
@@ -339,6 +383,8 @@ export {
339
383
  createDefaultGraphRankingProvider,
340
384
  createFilesystemContentSource,
341
385
  createKnowledgeHubRepositories,
386
+ createPlatformOperationExecutorRegistry,
387
+ createPlatformRepositoryClaim,
342
388
  createPublishedContentPipeline,
343
389
  createReservationReleaseEntry,
344
390
  createTeamScopedR2OverlayContentPublishProvider,
@@ -353,6 +399,8 @@ export {
353
399
  deniedAgentOperationResult,
354
400
  deployCapacityProviderToManagedMarketHost,
355
401
  deployCapacityProviderToRailway,
402
+ derivePlatformOperationNavigation,
403
+ derivePlatformRepositoryKey,
356
404
  deriveTreeseedDesiredUnits,
357
405
  destroyTreeseedTargetUnits,
358
406
  ensureRailwayEnvironment,
@@ -367,6 +415,7 @@ export {
367
415
  estimateUtilityForTask,
368
416
  executeKnowledgeHubLaunch,
369
417
  executeKnowledgeHubProviderLaunch,
418
+ executePlatformRepositoryOperation,
370
419
  executeSdkOperation,
371
420
  findDispatchCapability,
372
421
  findSdkOperation,
@@ -380,6 +429,8 @@ export {
380
429
  isAgentOperationName,
381
430
  isCapacityProviderSecretEnvKey,
382
431
  isInterruptedUsageActual,
432
+ isPlatformOperationSuccessful,
433
+ isPlatformOperationTerminal,
383
434
  isTeamScopedR2ContentEnabled,
384
435
  listIntegratedMarketCatalog,
385
436
  listRailwayEnvironments,
@@ -404,6 +455,8 @@ export {
404
455
  normalizeKnowledgeHubLaunchIntent,
405
456
  normalizeMutationData,
406
457
  normalizePlanningPolicy,
458
+ normalizePlatformContentInput,
459
+ normalizePlatformRelationArray,
407
460
  normalizePredictiveReservePolicy,
408
461
  normalizeProjectJobStatus,
409
462
  normalizeRecordToCanonicalShape,
@@ -422,6 +475,8 @@ export {
422
475
  planKnowledgeHubLaunch,
423
476
  planKnowledgeHubRepositories,
424
477
  planTreeseedReconciliation,
478
+ platformContentRelationPolicy,
479
+ pollPlatformOperation,
425
480
  predictReserveForCapacityPlan,
426
481
  preprocessAliasedRecord,
427
482
  progressivelyAdmitPlanProposal,
@@ -450,6 +505,7 @@ export {
450
505
  resolveMarketSession,
451
506
  resolveModelDefinition,
452
507
  resolveModelField,
508
+ resolvePlatformRepositoryWorkspacePath,
453
509
  resolvePublishedContentBucketBinding,
454
510
  resolvePublishedContentManifestKey,
455
511
  resolvePublishedContentPreviewRoot,
@@ -464,6 +520,7 @@ export {
464
520
  resolveTreeseedToolBinary,
465
521
  resolveTreeseedToolCommand,
466
522
  routeAndReserveCapacity,
523
+ runPlatformOperationOnce,
467
524
  runTreeseedCopilotTask,
468
525
  runTreeseedVerifyDriver,
469
526
  scoreCapacityLane,
@@ -474,6 +531,7 @@ export {
474
531
  settleCapacityActuals,
475
532
  shouldInterruptForCapacity,
476
533
  signEditorialPreviewToken,
534
+ slugifyPlatformContent,
477
535
  summarizeCapacityPlan,
478
536
  summarizeProjectCapacityPlan,
479
537
  summarizeTeamCapacityPlan,
@@ -0,0 +1,129 @@
1
+ export declare const PLATFORM_CONTENT_COLLECTIONS: readonly ["objectives", "questions", "notes", "proposals", "decisions", "agents"];
2
+ export declare const PLATFORM_WORK_CONTENT_COLLECTIONS: readonly ["objectives", "questions", "notes", "proposals", "decisions"];
3
+ export type PlatformContentCollection = (typeof PLATFORM_CONTENT_COLLECTIONS)[number];
4
+ export interface PlatformRepositoryDescriptor {
5
+ provider?: 'github' | 'local' | string;
6
+ owner?: string;
7
+ name: string;
8
+ defaultBranch?: string;
9
+ cloneUrl: string;
10
+ writeMode?: 'workspace' | 'branch' | 'direct' | 'pull_request';
11
+ branchName?: string;
12
+ push?: boolean;
13
+ pathPolicies?: PlatformRepositoryPathPolicy[];
14
+ verificationCommands?: PlatformRepositoryVerificationCommand[];
15
+ }
16
+ export interface PlatformRepositoryPathPolicy {
17
+ allow: string;
18
+ }
19
+ export interface PlatformRepositoryVerificationCommand {
20
+ command: string;
21
+ args?: string[];
22
+ workingDirectory?: string;
23
+ timeoutMs?: number;
24
+ }
25
+ export interface PlatformRepositoryClaimInput {
26
+ repository: PlatformRepositoryDescriptor;
27
+ runnerId: string;
28
+ workspaceRoot: string;
29
+ branch?: string | null;
30
+ commitSha?: string | null;
31
+ leaseSeconds?: number;
32
+ metadata?: Record<string, unknown>;
33
+ }
34
+ export interface PlatformRepositoryClaim {
35
+ id: string;
36
+ repositoryKey: string;
37
+ runnerId: string;
38
+ workspacePath: string;
39
+ branch: string | null;
40
+ commitSha: string | null;
41
+ claimState: 'active' | 'released' | 'expired' | string;
42
+ leaseExpiresAt: string | null;
43
+ metadata: Record<string, unknown>;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ }
47
+ export interface PlatformRepositoryOperationInput {
48
+ projectId?: string;
49
+ teamId?: string;
50
+ createdBy?: string;
51
+ repository: PlatformRepositoryDescriptor;
52
+ collection?: string;
53
+ parentCollection?: string;
54
+ parentSlug?: string;
55
+ targetCollection?: string;
56
+ proposalSlugs?: string[];
57
+ decisionType?: string;
58
+ reason?: string;
59
+ title?: string;
60
+ slug?: string;
61
+ normalized?: NormalizedPlatformContentInput;
62
+ payload?: Record<string, unknown>;
63
+ commitMessage?: string;
64
+ approvalRequired?: boolean;
65
+ approvalId?: string;
66
+ }
67
+ export interface PlatformRepositoryOperationOptions {
68
+ workspaceRoot: string;
69
+ environment?: string;
70
+ }
71
+ export interface NormalizedPlatformContentInput {
72
+ slug: string;
73
+ extension: 'md' | 'mdx';
74
+ frontmatter: Record<string, unknown>;
75
+ body: string;
76
+ }
77
+ export interface PlatformRepositoryOperationResult {
78
+ ok: true;
79
+ operation: string;
80
+ repository: {
81
+ key: string;
82
+ provider: string;
83
+ owner: string | null;
84
+ name: string;
85
+ cloneUrl: string;
86
+ };
87
+ baseBranch: string;
88
+ repositoryPath: string;
89
+ workspacePath: string;
90
+ href: string | null;
91
+ branch: string | null;
92
+ operationBranch: string | null;
93
+ commitSha: string | null;
94
+ changedPaths: string[];
95
+ verification: PlatformRepositoryVerificationResult | null;
96
+ pullRequest: null;
97
+ workflowRun: null;
98
+ output: Record<string, unknown>;
99
+ }
100
+ export interface PlatformRepositoryVerificationResult {
101
+ status: 'passed' | 'failed' | 'skipped';
102
+ commands: Array<{
103
+ command: string;
104
+ args: string[];
105
+ cwd: string;
106
+ exitCode: number;
107
+ stdout: string;
108
+ stderr: string;
109
+ }>;
110
+ }
111
+ export declare class PlatformRepositoryVerificationError extends Error {
112
+ readonly verification: PlatformRepositoryVerificationResult;
113
+ constructor(message: string, verification: PlatformRepositoryVerificationResult);
114
+ }
115
+ export declare function slugifyPlatformContent(value: unknown): string;
116
+ export declare function normalizePlatformRelationArray(value: unknown): string[];
117
+ export declare function platformContentRelationPolicy(parentCollection: string, targetCollection: string): {
118
+ sourceField?: string;
119
+ targetField?: string;
120
+ sourceSingle?: boolean;
121
+ targetSingle?: boolean;
122
+ };
123
+ export declare function normalizePlatformContentInput(collection: string, body: Record<string, unknown>): NormalizedPlatformContentInput | {
124
+ error: string;
125
+ };
126
+ export declare function derivePlatformRepositoryKey(repository: PlatformRepositoryDescriptor): string;
127
+ export declare function resolvePlatformRepositoryWorkspacePath(workspaceRoot: string, repository: PlatformRepositoryDescriptor): string;
128
+ export declare function createPlatformRepositoryClaim(input: PlatformRepositoryClaimInput): PlatformRepositoryClaim;
129
+ export declare function executePlatformRepositoryOperation(operation: 'write_content_record' | 'create_related_content' | 'create_decision_from_proposals' | string, input: PlatformRepositoryOperationInput, options: PlatformRepositoryOperationOptions): Promise<PlatformRepositoryOperationResult>;