@treeseed/sdk 0.9.0 → 0.10.5

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 (76) hide show
  1. package/dist/api/app.d.ts +8 -0
  2. package/dist/api/app.js +404 -0
  3. package/dist/api/auth/d1-database.d.ts +3 -0
  4. package/dist/api/auth/d1-database.js +20 -0
  5. package/dist/api/auth/d1-provider.d.ts +79 -0
  6. package/dist/api/auth/d1-provider.js +92 -0
  7. package/dist/api/auth/d1-store.d.ts +114 -0
  8. package/dist/api/auth/d1-store.js +902 -0
  9. package/dist/api/auth/memory-provider.d.ts +77 -0
  10. package/dist/api/auth/memory-provider.js +256 -0
  11. package/dist/api/auth/rbac.d.ts +22 -0
  12. package/dist/api/auth/rbac.js +162 -0
  13. package/dist/api/auth/tokens.d.ts +18 -0
  14. package/dist/api/auth/tokens.js +56 -0
  15. package/dist/api/config.d.ts +2 -0
  16. package/dist/api/config.js +118 -0
  17. package/dist/api/http.d.ts +28 -0
  18. package/dist/api/http.js +51 -0
  19. package/dist/api/index.d.ts +10 -0
  20. package/dist/api/index.js +27 -0
  21. package/dist/api/operations-routes.d.ts +11 -0
  22. package/dist/api/operations-routes.js +39 -0
  23. package/dist/api/operations.d.ts +3 -0
  24. package/dist/api/operations.js +26 -0
  25. package/dist/api/providers.d.ts +2 -0
  26. package/dist/api/providers.js +68 -0
  27. package/dist/api/railway.d.ts +52 -0
  28. package/dist/api/railway.js +71 -0
  29. package/dist/api/sdk-dispatch.d.ts +6 -0
  30. package/dist/api/sdk-dispatch.js +14 -0
  31. package/dist/api/sdk-routes.d.ts +11 -0
  32. package/dist/api/sdk-routes.js +29 -0
  33. package/dist/api/templates.d.ts +3 -0
  34. package/dist/api/templates.js +31 -0
  35. package/dist/api/types.d.ts +232 -0
  36. package/dist/api/types.js +0 -0
  37. package/dist/capacity-provider.d.ts +383 -0
  38. package/dist/capacity-provider.js +535 -0
  39. package/dist/capacity.d.ts +2 -35
  40. package/dist/control-plane-client.d.ts +8 -3
  41. package/dist/control-plane-client.js +12 -1
  42. package/dist/dispatch.js +0 -1
  43. package/dist/index.d.ts +2 -0
  44. package/dist/index.js +40 -0
  45. package/dist/market-client.d.ts +1 -5
  46. package/dist/market-client.js +2 -8
  47. package/dist/operations/providers/default.js +0 -9
  48. package/dist/operations/services/config-runtime.d.ts +2 -2
  49. package/dist/operations/services/config-runtime.js +55 -3
  50. package/dist/operations/services/github-automation.d.ts +10 -15
  51. package/dist/operations/services/github-automation.js +3 -35
  52. package/dist/operations/services/hosting-audit.d.ts +1 -1
  53. package/dist/operations/services/hosting-audit.js +3 -27
  54. package/dist/operations/services/hub-launch.d.ts +0 -1
  55. package/dist/operations/services/hub-launch.js +1 -2
  56. package/dist/operations/services/hub-provider-launch.d.ts +0 -15
  57. package/dist/operations/services/hub-provider-launch.js +5 -41
  58. package/dist/operations/services/package-reference-policy.d.ts +1 -0
  59. package/dist/operations/services/package-reference-policy.js +10 -2
  60. package/dist/operations/services/project-platform.d.ts +9 -9
  61. package/dist/operations/services/project-platform.js +6 -17
  62. package/dist/operations/services/release-candidate.js +19 -3
  63. package/dist/operations-registry.js +1 -3
  64. package/dist/platform/contracts.d.ts +2 -2
  65. package/dist/project-workflow.d.ts +0 -3
  66. package/dist/scripts/publish-package.js +5 -1
  67. package/dist/scripts/tenant-workflow-action.js +3 -3
  68. package/dist/scripts/workflow-commands.test.js +3 -6
  69. package/dist/sdk-types.d.ts +33 -1
  70. package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +1 -4
  71. package/dist/treeseed/template-catalog/templates/starter-basic/template/src/api/server.js +1 -1
  72. package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +1 -17
  73. package/dist/workflow/operations.js +26 -8
  74. package/package.json +14 -1
  75. package/templates/github/hosted-project.workflow.yml +0 -1
  76. package/templates/github/deploy-processing.workflow.yml +0 -123
package/dist/index.js CHANGED
@@ -4,6 +4,27 @@ import { projectConnectionModeFromHosting } from "./sdk-types.js";
4
4
  import { createControlPlaneReporter } from "./control-plane.js";
5
5
  import { ControlPlaneClient } from "./control-plane-client.js";
6
6
  export * from "./seeds/index.js";
7
+ import {
8
+ CAPACITY_PROVIDER_ENDPOINTS,
9
+ CAPACITY_PROVIDER_DEPLOYMENT_SERVICE_ROLES,
10
+ CAPACITY_PROVIDER_ENV_KEYS,
11
+ CAPACITY_PROVIDER_SCOPES,
12
+ CapacityProviderApiError,
13
+ MarketProviderClient,
14
+ assertCapacityProviderOkEnvelope,
15
+ assertCapacityProviderPortfolioManifest,
16
+ assertCapacityProviderRegistrationResponse,
17
+ buildCapacityProviderAuthHeaders,
18
+ deployCapacityProviderToManagedMarketHost,
19
+ deployCapacityProviderToRailway,
20
+ isCapacityProviderSecretEnvKey,
21
+ redactCapacityProviderEnv,
22
+ redactCapacityProviderSecret,
23
+ renderCapacityProviderSelfHostInstructions,
24
+ persistCapacityProviderConnectionToTreeseedConfig,
25
+ resolveCapacityProviderEnvironment,
26
+ resolveCapacityProviderLaunchEnvironment
27
+ } from "./capacity-provider.js";
7
28
  import {
8
29
  DEFAULT_EXECUTION_PROFILE_ID,
9
30
  DEFAULT_EXECUTION_PROFILES,
@@ -249,6 +270,11 @@ export {
249
270
  AGENT_OPERATION_NAMES,
250
271
  AgentSdk,
251
272
  BUILTIN_MODEL_REGISTRY,
273
+ CAPACITY_PROVIDER_DEPLOYMENT_SERVICE_ROLES,
274
+ CAPACITY_PROVIDER_ENDPOINTS,
275
+ CAPACITY_PROVIDER_ENV_KEYS,
276
+ CAPACITY_PROVIDER_SCOPES,
277
+ CapacityProviderApiError,
252
278
  CloudflareHttpD1Database,
253
279
  CloudflareQueuePullClient,
254
280
  CloudflareQueuePushClient,
@@ -263,6 +289,7 @@ export {
263
289
  MODEL_REGISTRY,
264
290
  MarketApiError,
265
291
  MarketClient,
292
+ MarketProviderClient,
266
293
  PROJECT_JOB_STATUSES,
267
294
  PROJECT_TEAM_CAPABILITIES,
268
295
  PUBLISHED_CONTENT_MANIFEST_SCHEMA_VERSION,
@@ -289,7 +316,11 @@ export {
289
316
  TreeseedWorkflowSdk,
290
317
  WORKSTREAM_STATES,
291
318
  addMarketProfile,
319
+ assertCapacityProviderOkEnvelope,
320
+ assertCapacityProviderPortfolioManifest,
321
+ assertCapacityProviderRegistrationResponse,
292
322
  buildBuiltinModelRegistry,
323
+ buildCapacityProviderAuthHeaders,
293
324
  buildCopilotAllowToolArgs,
294
325
  buildKnowledgePackMarketPackage,
295
326
  buildModelRegistry,
@@ -320,6 +351,8 @@ export {
320
351
  declarativeContextPurposeToGraphStage,
321
352
  defaultHubContentResolutionPolicy,
322
353
  deniedAgentOperationResult,
354
+ deployCapacityProviderToManagedMarketHost,
355
+ deployCapacityProviderToRailway,
323
356
  deriveTreeseedDesiredUnits,
324
357
  destroyTreeseedTargetUnits,
325
358
  ensureRailwayEnvironment,
@@ -345,6 +378,7 @@ export {
345
378
  importKnowledgePack,
346
379
  installTreeseedDependencies,
347
380
  isAgentOperationName,
381
+ isCapacityProviderSecretEnvKey,
348
382
  isInterruptedUsageActual,
349
383
  isTeamScopedR2ContentEnabled,
350
384
  listIntegratedMarketCatalog,
@@ -384,6 +418,7 @@ export {
384
418
  parsePublishedContentManifest,
385
419
  parsePublishedOverlayManifest,
386
420
  parseTemplateCatalogResponse,
421
+ persistCapacityProviderConnectionToTreeseedConfig,
387
422
  planKnowledgeHubLaunch,
388
423
  planKnowledgeHubRepositories,
389
424
  planTreeseedReconciliation,
@@ -397,11 +432,16 @@ export {
397
432
  readPublishedContentManifest,
398
433
  readPublishedOverlayManifest,
399
434
  reconcileTreeseedTarget,
435
+ redactCapacityProviderEnv,
436
+ redactCapacityProviderSecret,
400
437
  removeMarketProfile,
438
+ renderCapacityProviderSelfHostInstructions,
401
439
  reservationHasCapacity,
402
440
  reserveCreditsForEstimate,
403
441
  resolveAgentOperationGrant,
404
442
  resolveAliasedField,
443
+ resolveCapacityProviderEnvironment,
444
+ resolveCapacityProviderLaunchEnvironment,
405
445
  resolveCatalogMarketProfiles,
406
446
  resolveCloudflareR2Bucket,
407
447
  resolveDefaultCentralMarketBaseUrl,
@@ -179,11 +179,7 @@ export declare class MarketClient {
179
179
  ok: true;
180
180
  payload: Record<string, unknown>;
181
181
  }>;
182
- resetCapacityProviderApiKey(providerId: string, body?: Record<string, unknown>): Promise<{
183
- ok: true;
184
- payload: Record<string, unknown>;
185
- }>;
186
- revokeCapacityProviderApiKey(providerId: string, keyId: string): Promise<{
182
+ rotateCapacityProviderApiKey(teamId: string, providerId: string): Promise<{
187
183
  ok: true;
188
184
  payload: Record<string, unknown>;
189
185
  }>;
@@ -365,15 +365,9 @@ class MarketClient {
365
365
  { requireAuth: true }
366
366
  );
367
367
  }
368
- resetCapacityProviderApiKey(providerId, body = {}) {
368
+ rotateCapacityProviderApiKey(teamId, providerId) {
369
369
  return this.request(
370
- `/v1/capacity/providers/${encodeURIComponent(providerId)}/api-keys/reset`,
371
- { method: "POST", body, requireAuth: true }
372
- );
373
- }
374
- revokeCapacityProviderApiKey(providerId, keyId) {
375
- return this.request(
376
- `/v1/capacity/providers/${encodeURIComponent(providerId)}/api-keys/${encodeURIComponent(keyId)}/revoke`,
370
+ `/v1/teams/${encodeURIComponent(teamId)}/capacity-providers/${encodeURIComponent(providerId)}/keys/rotate`,
377
371
  { method: "POST", requireAuth: true }
378
372
  );
379
373
  }
@@ -182,13 +182,6 @@ function workflowInputForOperation(name, input) {
182
182
  case "status":
183
183
  case "tasks":
184
184
  return {};
185
- case "dev:watch":
186
- return { ...input, watch: true };
187
- case "dev:manager":
188
- return {
189
- ...input,
190
- surfaces: input.withWorker === true ? "manager,worker" : typeof input.surfaces === "string" ? input.surfaces : "manager"
191
- };
192
185
  default:
193
186
  return input;
194
187
  }
@@ -1076,8 +1069,6 @@ class DefaultTreeseedOperationsProvider {
1076
1069
  new WorkflowOperation("release"),
1077
1070
  new WorkflowOperation("destroy"),
1078
1071
  new WorkflowOperation("dev"),
1079
- new WorkflowOperation("dev:manager", "dev"),
1080
- new WorkflowOperation("dev:watch", "dev"),
1081
1072
  new InitOperation("init"),
1082
1073
  new HubPlanLaunchOperation("hub.plan_launch"),
1083
1074
  new HubValidateLaunchOperation("hub.validate_launch"),
@@ -226,7 +226,7 @@ export type TreeseedRepairAction = {
226
226
  detail: string;
227
227
  };
228
228
  export declare function applyTreeseedSafeRepairs(tenantRoot: string): TreeseedRepairAction[];
229
- export declare function resolveTreeseedMachineEnvironmentValues(tenantRoot: any, scope: any): {};
229
+ export declare function resolveTreeseedMachineEnvironmentValues(tenantRoot: any, scope: any, additionalKeys?: never[]): {};
230
230
  export declare function setTreeseedMachineEnvironmentValue(tenantRoot: any, scope: any, entry: any, value: any): any;
231
231
  export declare function collectTreeseedEnvironmentContext(tenantRoot: any): import("../../platform/environment.ts").TreeseedResolvedEnvironmentRegistry;
232
232
  export declare function collectTreeseedConfigSeedValues(tenantRoot: any, scope: any, env?: NodeJS.ProcessEnv, valuesOverlay?: {}): {
@@ -360,7 +360,7 @@ export declare function syncTreeseedRailwayEnvironment({ tenantRoot, scope, dryR
360
360
  service: string;
361
361
  projectName: any;
362
362
  serviceName: any;
363
- serviceId: string;
363
+ serviceId: any;
364
364
  rootDir: string;
365
365
  baseUrl: any;
366
366
  environmentName: string;
@@ -223,7 +223,56 @@ function syncManagedServiceSettingsFromDeployConfig(tenantRoot) {
223
223
  return config;
224
224
  }
225
225
  function loadTenantDeployConfig(tenantRoot) {
226
- return loadCliDeployConfig(tenantRoot);
226
+ try {
227
+ return loadCliDeployConfig(tenantRoot);
228
+ } catch (error) {
229
+ const packageJsonPath = resolve(tenantRoot, "package.json");
230
+ if (!existsSync(packageJsonPath)) {
231
+ throw error;
232
+ }
233
+ try {
234
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
235
+ if (packageJson?.name !== "@treeseed/agent") {
236
+ throw error;
237
+ }
238
+ const deployConfig = {
239
+ name: "TreeSeed Agent Capacity Provider",
240
+ slug: "treeseed-agent-capacity-provider",
241
+ siteUrl: "http://127.0.0.1:3100",
242
+ contactEmail: "hello@treeseed.ai",
243
+ hosting: { kind: "self_hosted_project", registration: "none" },
244
+ hub: { mode: "treeseed_hosted" },
245
+ runtime: { mode: "byo_attached", registration: "none" },
246
+ surfaces: {
247
+ web: { enabled: false },
248
+ api: { enabled: true, provider: "local", rootDir: ".", localBaseUrl: "http://127.0.0.1:3100" }
249
+ },
250
+ services: {
251
+ api: { enabled: true, provider: "local", rootDir: "." }
252
+ },
253
+ processing: { mode: "local" },
254
+ providers: {
255
+ agents: {
256
+ execution: "codex",
257
+ mutation: "local_branch",
258
+ repository: "git",
259
+ verification: "local",
260
+ notification: "sdk_message",
261
+ research: "project_graph"
262
+ }
263
+ },
264
+ plugins: []
265
+ };
266
+ Object.defineProperty(deployConfig, "__tenantRoot", {
267
+ value: tenantRoot,
268
+ enumerable: false
269
+ });
270
+ return deployConfig;
271
+ } catch (fallbackError) {
272
+ if (fallbackError === error) throw error;
273
+ throw fallbackError;
274
+ }
275
+ }
227
276
  }
228
277
  function loadOptionalTenantManifest(tenantRoot) {
229
278
  try {
@@ -1406,7 +1455,7 @@ function resolveEntryValueFromBuckets(entry, entryId, scope, bucketValuesByScope
1406
1455
  }
1407
1456
  return bucketValuesByScope[scope]?.[entryId] ?? "";
1408
1457
  }
1409
- function resolveTreeseedMachineEnvironmentValues(tenantRoot, scope) {
1458
+ function resolveTreeseedMachineEnvironmentValues(tenantRoot, scope, additionalKeys = []) {
1410
1459
  const key = loadMachineKey(tenantRoot);
1411
1460
  const config = loadTreeseedMachineConfig(tenantRoot);
1412
1461
  const registry = collectTreeseedEnvironmentContext(tenantRoot);
@@ -1421,7 +1470,10 @@ function resolveTreeseedMachineEnvironmentValues(tenantRoot, scope) {
1421
1470
  };
1422
1471
  const entryById = new Map(registry.entries.map((entry) => [entry.id, entry]));
1423
1472
  const values = {};
1424
- const knownKeys = new Set(registry.entries.map((entry) => entry.id));
1473
+ const knownKeys = /* @__PURE__ */ new Set([
1474
+ ...registry.entries.map((entry) => entry.id),
1475
+ ...additionalKeys
1476
+ ]);
1425
1477
  for (const entryId of knownKeys) {
1426
1478
  const resolved = resolveEntryValueFromBuckets(entryById.get(entryId), entryId, scope, bucketValuesByScope);
1427
1479
  if (typeof resolved === "string" && resolved.length > 0) {
@@ -80,9 +80,6 @@ export declare function requiredGitHubSecrets(tenantRoot: any): string[];
80
80
  export declare function renderDeployWebWorkflow({ workingDirectory }: {
81
81
  workingDirectory: any;
82
82
  }): string;
83
- export declare function renderDeployProcessingWorkflow({ workingDirectory }: {
84
- workingDirectory: any;
85
- }): string;
86
83
  export declare function renderHostedProjectWorkflow({ workingDirectory }: {
87
84
  workingDirectory: any;
88
85
  }): string;
@@ -91,12 +88,7 @@ export declare function ensureDeployWorkflow(tenantRoot: any): {
91
88
  changed: boolean;
92
89
  workingDirectory: string;
93
90
  executionBoundary: string;
94
- additionalWorkflows: {
95
- workingDirectory: string;
96
- executionBoundary: string;
97
- workflowPath: string;
98
- changed: boolean;
99
- }[];
91
+ additionalWorkflows: never[];
100
92
  };
101
93
  export declare function ensureHostedProjectWorkflow(tenantRoot: any): {
102
94
  workingDirectory: string;
@@ -104,10 +96,11 @@ export declare function ensureHostedProjectWorkflow(tenantRoot: any): {
104
96
  changed: boolean;
105
97
  };
106
98
  export declare function ensureStandardizedGitHubWorkflows(tenantRoot: any): {
107
- workingDirectory: string;
108
- executionBoundary: string;
109
99
  workflowPath: string;
110
100
  changed: boolean;
101
+ workingDirectory: string;
102
+ executionBoundary: string;
103
+ additionalWorkflows: never[];
111
104
  }[];
112
105
  export declare function listGitHubSecretNames(repository: any, tenantRoot: any): Promise<Set<string>>;
113
106
  export declare function listGitHubVariableNames(repository: any, tenantRoot: any): Promise<Set<string>>;
@@ -156,16 +149,18 @@ export declare function ensureGitHubDeployAutomation(tenantRoot: any, { dryRun,
156
149
  }): Promise<{
157
150
  mode: string;
158
151
  workflow: {
159
- workingDirectory: string;
160
- executionBoundary: string;
161
152
  workflowPath: string;
162
153
  changed: boolean;
163
- };
164
- workflows: {
165
154
  workingDirectory: string;
166
155
  executionBoundary: string;
156
+ additionalWorkflows: never[];
157
+ };
158
+ workflows: {
167
159
  workflowPath: string;
168
160
  changed: boolean;
161
+ workingDirectory: string;
162
+ executionBoundary: string;
163
+ additionalWorkflows: never[];
169
164
  }[];
170
165
  secrets: {
171
166
  existing: never[];
@@ -307,9 +307,6 @@ function renderWorkflowTemplate(templateName, { workingDirectory }) {
307
307
  function renderDeployWebWorkflow({ workingDirectory }) {
308
308
  return renderWorkflowTemplate("deploy-web.workflow.yml", { workingDirectory });
309
309
  }
310
- function renderDeployProcessingWorkflow({ workingDirectory }) {
311
- return renderWorkflowTemplate("deploy-processing.workflow.yml", { workingDirectory });
312
- }
313
310
  function renderHostedProjectWorkflow({ workingDirectory }) {
314
311
  return renderWorkflowTemplate("hosted-project.workflow.yml", { workingDirectory });
315
312
  }
@@ -323,44 +320,16 @@ function ensureWorkflowFile(tenantRoot, fileName, expected) {
323
320
  writeFileSync(workflowPath, expected, "utf8");
324
321
  return { workflowPath, changed: true };
325
322
  }
326
- function hasConcreteProcessingServices(deployConfig) {
327
- return Object.entries(deployConfig.services ?? {}).some(
328
- ([serviceKey, service]) => ["api", "manager", "worker", "workerRunner", "workdayStart", "workdayReport"].includes(serviceKey) && service && service.enabled !== false
329
- );
330
- }
331
- function shouldWriteProcessingWorkflow(deployConfig) {
332
- if ((deployConfig.hosting?.kind ?? "self_hosted_project") === "market_control_plane") {
333
- return true;
334
- }
335
- const mode = deployConfig.processing?.mode ?? "market-assigned";
336
- return mode === "project-owned" || mode === "local" || hasConcreteProcessingServices(deployConfig);
337
- }
338
323
  function ensureDeployWorkflow(tenantRoot) {
339
324
  const repositoryRoot = resolveGitRepositoryRoot(tenantRoot);
340
325
  const workingDirectory = relative(repositoryRoot, tenantRoot).replaceAll("\\", "/") || ".";
341
- const deployConfig = loadCliDeployConfig(tenantRoot);
342
326
  const web = ensureWorkflowFile(tenantRoot, "deploy-web.yml", renderDeployWebWorkflow({ workingDirectory }));
343
- const additionalWorkflows = [];
344
- let changed = web.changed;
345
- if (shouldWriteProcessingWorkflow(deployConfig)) {
346
- const processing = ensureWorkflowFile(
347
- tenantRoot,
348
- "deploy-processing.yml",
349
- renderDeployProcessingWorkflow({ workingDirectory })
350
- );
351
- changed = changed || processing.changed;
352
- additionalWorkflows.push({
353
- ...processing,
354
- workingDirectory,
355
- executionBoundary: "split-plane"
356
- });
357
- }
358
327
  return {
359
328
  workflowPath: web.workflowPath,
360
- changed,
329
+ changed: web.changed,
361
330
  workingDirectory,
362
- executionBoundary: "split-plane",
363
- additionalWorkflows
331
+ executionBoundary: "market-web-api",
332
+ additionalWorkflows: []
364
333
  };
365
334
  }
366
335
  function ensureHostedProjectWorkflow(tenantRoot) {
@@ -527,7 +496,6 @@ export {
527
496
  listGitHubVariableNames,
528
497
  maybeResolveGitHubRepositorySlug,
529
498
  parseGitHubRepositoryFromRemote,
530
- renderDeployProcessingWorkflow,
531
499
  renderDeployWebWorkflow,
532
500
  renderHostedProjectWorkflow,
533
501
  requiredGitHubEnvironment,
@@ -2,7 +2,7 @@ import { type TreeseedEnvironmentScope } from '../../platform/environment.ts';
2
2
  import type { TreeseedReconcileTarget } from '../../reconcile/contracts.ts';
3
3
  export type TreeseedHostingAuditEnvironment = 'current' | 'local' | 'staging' | 'prod';
4
4
  export type TreeseedHostingAuditResolvedEnvironment = 'local' | 'staging' | 'prod' | 'preview';
5
- export type TreeseedHostingAuditHostKind = 'repository' | 'web' | 'processing' | 'email';
5
+ export type TreeseedHostingAuditHostKind = 'repository' | 'web' | 'email';
6
6
  export type TreeseedHostingAuditCheckStatus = 'passed' | 'warning' | 'failed' | 'skipped' | 'repaired';
7
7
  export type TreeseedHostingAuditSeverity = 'info' | 'warning' | 'critical';
8
8
  export type TreeseedHostingAuditCheck = {
@@ -25,11 +25,10 @@ import {
25
25
  collectTreeseedReconcileStatus,
26
26
  reconcileTreeseedTarget
27
27
  } from "../../reconcile/index.js";
28
- const HOST_KINDS = ["repository", "web", "processing", "email"];
28
+ const HOST_KINDS = ["repository", "web", "email"];
29
29
  const HOST_GROUPS = {
30
30
  repository: /* @__PURE__ */ new Set(["auth", "github"]),
31
31
  web: /* @__PURE__ */ new Set(["cloudflare", "hosting"]),
32
- processing: /* @__PURE__ */ new Set(["railway", "hosting"]),
33
32
  email: /* @__PURE__ */ new Set(["smtp"])
34
33
  };
35
34
  function hasValue(value) {
@@ -236,24 +235,6 @@ function appendManualConfigChecks(checks, values, hostKinds) {
236
235
  remediation: "Set CLOUDFLARE_ACCOUNT_ID for TreeSeed-managed Web hosting."
237
236
  });
238
237
  }
239
- if (hostKinds.includes("processing")) {
240
- requiredKeyCheck(checks, values, {
241
- id: "processing.railway.token",
242
- hostType: "processing",
243
- provider: "railway",
244
- keys: ["RAILWAY_API_TOKEN"],
245
- label: "Processing provider token",
246
- remediation: "Set RAILWAY_API_TOKEN for TreeSeed-managed Processing hosting."
247
- });
248
- requiredKeyCheck(checks, values, {
249
- id: "processing.railway.workspace",
250
- hostType: "processing",
251
- provider: "railway",
252
- keys: ["TREESEED_RAILWAY_WORKSPACE"],
253
- label: "Processing provider workspace",
254
- remediation: "Set TREESEED_RAILWAY_WORKSPACE for TreeSeed-managed Processing hosting."
255
- });
256
- }
257
238
  if (hostKinds.includes("email")) {
258
239
  requiredKeyCheck(checks, values, {
259
240
  id: "email.smtp.host",
@@ -327,9 +308,8 @@ function providerConnectionChecks(report, hostKinds) {
327
308
  const allowedProviders = /* @__PURE__ */ new Set();
328
309
  if (hostKinds.includes("repository")) allowedProviders.add("github");
329
310
  if (hostKinds.includes("web")) allowedProviders.add("cloudflare");
330
- if (hostKinds.includes("processing")) allowedProviders.add("railway");
331
311
  return report.checks.filter((check) => allowedProviders.has(check.provider)).map((check) => {
332
- const hostType = check.provider === "github" ? "repository" : check.provider === "railway" ? "processing" : "web";
312
+ const hostType = check.provider === "github" ? "repository" : "web";
333
313
  return {
334
314
  id: `identity.${check.provider}`,
335
315
  hostType,
@@ -351,16 +331,12 @@ function reconcileSystemsForHostKinds(hostKinds) {
351
331
  systems.add("data");
352
332
  systems.add("web");
353
333
  }
354
- if (hostKinds.includes("processing")) {
355
- systems.add("api");
356
- systems.add("agents");
357
- }
358
334
  return [...systems];
359
335
  }
360
336
  function reconcileStatusChecks(status, repairedIds = /* @__PURE__ */ new Set()) {
361
337
  const checks = [];
362
338
  for (const unit of status.units) {
363
- const hostType = unit.provider === "github" ? "repository" : unit.provider === "railway" ? "processing" : "web";
339
+ const hostType = unit.provider === "github" ? "repository" : "web";
364
340
  const verified = unit.verification?.verified === true;
365
341
  const id = `resource.${unit.provider}.${unit.unitType}.${unit.unitId}`;
366
342
  const repaired = repairedIds.has(id);
@@ -61,7 +61,6 @@ export interface KnowledgeHubLaunchIntent {
61
61
  hosting?: {
62
62
  mode?: KnowledgeHubHostMode | 'managed';
63
63
  webHost?: Record<string, unknown> | null;
64
- processingHost?: Record<string, unknown> | null;
65
64
  };
66
65
  contentResolution?: HubContentResolutionPolicy;
67
66
  direction?: {
@@ -43,8 +43,7 @@ function normalizeKnowledgeHubLaunchIntent(input) {
43
43
  },
44
44
  hosting: {
45
45
  mode: input.hosting?.mode === "managed" ? "treeseed_managed" : input.hosting?.mode ?? "treeseed_managed",
46
- webHost: input.hosting?.webHost ?? null,
47
- processingHost: input.hosting?.processingHost ?? null
46
+ webHost: input.hosting?.webHost ?? null
48
47
  },
49
48
  contentResolution: input.contentResolution ?? defaultHubContentResolutionPolicy(),
50
49
  direction: input.direction ?? {},
@@ -38,7 +38,6 @@ export interface KnowledgeHubProviderLaunchInput {
38
38
  enableDefaultAgents?: boolean;
39
39
  preserveWorkingTree?: boolean;
40
40
  cloudflareHost?: KnowledgeHubCloudflareHostLaunchInput | null;
41
- processingHost?: KnowledgeHubProcessingHostLaunchInput | null;
42
41
  }
43
42
  export interface KnowledgeHubCloudflareHostConfig {
44
43
  CLOUDFLARE_API_TOKEN?: string;
@@ -58,20 +57,6 @@ export interface KnowledgeHubCloudflareHostLaunchInput {
58
57
  targetEnvironments?: Array<'local' | 'staging' | 'prod'>;
59
58
  config?: KnowledgeHubCloudflareHostConfig | null;
60
59
  }
61
- export interface KnowledgeHubProcessingHostConfig {
62
- RAILWAY_API_TOKEN?: string;
63
- TREESEED_RAILWAY_WORKSPACE?: string;
64
- TREESEED_RAILWAY_API_URL?: string;
65
- TREESEED_WORKER_POOL_SCALER?: string;
66
- environments?: Partial<Record<'staging' | 'prod', Record<string, unknown>>>;
67
- [key: string]: unknown;
68
- }
69
- export interface KnowledgeHubProcessingHostLaunchInput {
70
- mode: 'team_owned' | 'treeseed_managed';
71
- hostId?: string | null;
72
- targetEnvironments?: Array<'local' | 'staging' | 'prod'>;
73
- config?: KnowledgeHubProcessingHostConfig | null;
74
- }
75
60
  export interface KnowledgeHubProviderLaunchPhaseRecord {
76
61
  phase: string;
77
62
  status: 'running' | 'completed' | 'failed';
@@ -227,8 +227,8 @@ This hub is live and ready for the first team release cycle.
227
227
  };
228
228
  }
229
229
  function ensureHostedProjectFiles(projectRoot) {
230
- const agentApiPackage = ["@treeseed", "agent/api"].join("/");
231
- writeText(resolve(projectRoot, "src/api/server.js"), `import { createRailwayTreeseedApiServer } from '${agentApiPackage}';
230
+ const sdkApiPackage = ["@treeseed", "sdk/api"].join("/");
231
+ writeText(resolve(projectRoot, "src/api/server.js"), `import { createRailwayTreeseedApiServer } from '${sdkApiPackage}';
232
232
 
233
233
  const server = await createRailwayTreeseedApiServer();
234
234
  console.log(\`Treeseed project API listening on \${server.url}\`);
@@ -316,7 +316,7 @@ function applyManagedProjectDefaults(projectRoot, input) {
316
316
  railway: {
317
317
  serviceName: `${slug}-api`,
318
318
  buildCommand: "npm run build:api",
319
- startCommand: "node ./packages/agent/dist/scripts/treeseed-processing.js api",
319
+ startCommand: "node ./src/api/server.js",
320
320
  healthcheckTimeoutSeconds: 120
321
321
  },
322
322
  environments: {
@@ -325,26 +325,6 @@ function applyManagedProjectDefaults(projectRoot, input) {
325
325
  }
326
326
  }
327
327
  },
328
- workdayManager: {
329
- enabled: managedRuntime,
330
- provider: managedRuntime ? "railway" : "none",
331
- railway: {
332
- serviceName: `${slug}-workday-manager`,
333
- rootDir: ".",
334
- buildCommand: "npm run build:api",
335
- startCommand: "node ./packages/agent/dist/scripts/treeseed-processing.js manager",
336
- schedule: "0 9 * * 1-5"
337
- }
338
- },
339
- workerRunner: {
340
- enabled: managedRuntime,
341
- provider: managedRuntime ? "railway" : "none",
342
- railway: {
343
- rootDir: ".",
344
- buildCommand: "npm run build:api",
345
- startCommand: "node ./packages/agent/dist/scripts/treeseed-processing.js worker"
346
- }
347
- },
348
328
  ...config.services ?? {}
349
329
  },
350
330
  plugins: [{ package: "@treeseed/core/plugin-default" }],
@@ -553,20 +533,6 @@ function buildCloudflareHostEnvironmentOverlay(input, scope) {
553
533
  overlayValue(overlay, "TREESEED_CONTENT_BUCKET_BINDING", overlay.TREESEED_CONTENT_BUCKET_BINDING || "TREESEED_CONTENT_BUCKET");
554
534
  return overlay;
555
535
  }
556
- function buildProcessingHostEnvironmentOverlay(input, scope) {
557
- const config = input.processingHost?.config ?? {};
558
- const environmentConfig = config.environments?.[scope] ?? {};
559
- const overlay = {};
560
- for (const [key, value] of Object.entries(config)) {
561
- if (key === "environments") continue;
562
- overlayValue(overlay, key, value);
563
- }
564
- for (const [key, value] of Object.entries(environmentConfig)) {
565
- overlayValue(overlay, key, value);
566
- }
567
- overlayValue(overlay, "TREESEED_WORKER_POOL_SCALER", overlay.TREESEED_WORKER_POOL_SCALER || "railway");
568
- return overlay;
569
- }
570
536
  function scaffoldLaunchSource(projectRoot, input) {
571
537
  const repositoryName = slugify(input.repoName ?? input.projectSlug, "project");
572
538
  const templateId = input.sourceKind === "template" ? slugify(input.sourceRef ?? "starter-basic", "starter-basic") : "starter-basic";
@@ -682,12 +648,10 @@ async function executeKnowledgeHubProviderLaunch(input, options = {}) {
682
648
  const phases = [];
683
649
  const reportPhase = options.onPhase;
684
650
  const prodEnvOverlay = {
685
- ...buildCloudflareHostEnvironmentOverlay(input, "prod"),
686
- ...buildProcessingHostEnvironmentOverlay(input, "prod")
651
+ ...buildCloudflareHostEnvironmentOverlay(input, "prod")
687
652
  };
688
653
  const stagingEnvOverlay = {
689
- ...buildCloudflareHostEnvironmentOverlay(input, "staging"),
690
- ...buildProcessingHostEnvironmentOverlay(input, "staging")
654
+ ...buildCloudflareHostEnvironmentOverlay(input, "staging")
691
655
  };
692
656
  const preflight = await validateKnowledgeHubProviderLaunchPrerequisites(process.cwd(), { valuesOverlay: prodEnvOverlay });
693
657
  if (!preflight.ok) {
@@ -40,6 +40,7 @@ export declare function isPrereleaseVersion(version: string): boolean;
40
40
  export declare function isStableVersion(version: string): boolean;
41
41
  export declare function isGitDependencySpec(spec: string): boolean;
42
42
  export declare function devTagFromDependencySpec(spec: string): string | null;
43
+ export declare function releaseTagFromDependencySpec(spec: string): string | null;
43
44
  export declare function normalizeGitRemoteForDependency(remoteUrl: string, protocol?: GitDependencyProtocol): string | null;
44
45
  export declare function normalizeGitRemoteForManifest(remoteUrl: string, protocol?: GitDependencyProtocol): string | null;
45
46
  export declare function createPackageDependencyReference(input: {
@@ -43,6 +43,13 @@ function devTagFromDependencySpec(spec) {
43
43
  const ref = decodeURIComponent(value.slice(hashIndex + 1));
44
44
  return ref.includes("-dev.") ? ref : null;
45
45
  }
46
+ function releaseTagFromDependencySpec(spec) {
47
+ const value = String(spec).trim();
48
+ const hashIndex = value.lastIndexOf("#");
49
+ if (hashIndex === -1) return null;
50
+ const ref = decodeURIComponent(value.slice(hashIndex + 1));
51
+ return isStableVersion(ref) ? ref : null;
52
+ }
46
53
  function normalizeGitRemoteForDependency(remoteUrl, protocol = "preserve-origin") {
47
54
  const remote = String(remoteUrl).trim();
48
55
  if (!remote) return null;
@@ -224,7 +231,7 @@ function collectInternalDevReferenceIssues(root = workspaceRoot(), packageNames
224
231
  for (const [depName, specValue] of Object.entries(values)) {
225
232
  if (!packageNames.has(depName)) continue;
226
233
  const spec = String(specValue);
227
- if (isGitDependencySpec(spec) || devTagFromDependencySpec(spec)) {
234
+ if (isGitDependencySpec(spec) && !releaseTagFromDependencySpec(spec)) {
228
235
  issues.push({ repoName: pkg.name, filePath: packageJsonPath, field, dependencyName: depName, spec, reason: "git-dev-ref" });
229
236
  } else if (isPrereleaseVersion(spec)) {
230
237
  issues.push({ repoName: pkg.name, filePath: packageJsonPath, field, dependencyName: depName, spec, reason: "prerelease-dev-ref" });
@@ -252,7 +259,7 @@ function collectInternalDevReferenceIssues(root = workspaceRoot(), packageNames
252
259
  record.resolved,
253
260
  record.from
254
261
  ].map((value) => typeof value === "string" ? value : "").find(
255
- (value) => isGitDependencySpec(value) || devTagFromDependencySpec(value) || isPrereleaseVersion(value)
262
+ (value) => isGitDependencySpec(value) && !releaseTagFromDependencySpec(value) || devTagFromDependencySpec(value) || isPrereleaseVersion(value)
256
263
  );
257
264
  if (spec) {
258
265
  issues.push({ repoName: lockRoot.name, filePath: lockPath, spec, reason: "lockfile-dev-ref", dependencyName: packageName });
@@ -458,6 +465,7 @@ export {
458
465
  normalizeGitRemoteForDependency,
459
466
  normalizeGitRemoteForManifest,
460
467
  parseTreeseedDevTag,
468
+ releaseTagFromDependencySpec,
461
469
  rewriteInternalDependenciesToStableVersions,
462
470
  rewriteProjectInternalDependenciesToStableVersions,
463
471
  tagHasTreeseedDevMetadata,