@treeseed/sdk 0.8.19 → 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.
- package/dist/api/app.d.ts +8 -0
- package/dist/api/app.js +404 -0
- package/dist/api/auth/d1-database.d.ts +3 -0
- package/dist/api/auth/d1-database.js +20 -0
- package/dist/api/auth/d1-provider.d.ts +79 -0
- package/dist/api/auth/d1-provider.js +92 -0
- package/dist/api/auth/d1-store.d.ts +114 -0
- package/dist/api/auth/d1-store.js +902 -0
- package/dist/api/auth/memory-provider.d.ts +77 -0
- package/dist/api/auth/memory-provider.js +256 -0
- package/dist/api/auth/rbac.d.ts +22 -0
- package/dist/api/auth/rbac.js +162 -0
- package/dist/api/auth/tokens.d.ts +18 -0
- package/dist/api/auth/tokens.js +56 -0
- package/dist/api/config.d.ts +2 -0
- package/dist/api/config.js +118 -0
- package/dist/api/http.d.ts +28 -0
- package/dist/api/http.js +51 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.js +27 -0
- package/dist/api/operations-routes.d.ts +11 -0
- package/dist/api/operations-routes.js +39 -0
- package/dist/api/operations.d.ts +3 -0
- package/dist/api/operations.js +26 -0
- package/dist/api/providers.d.ts +2 -0
- package/dist/api/providers.js +68 -0
- package/dist/api/railway.d.ts +52 -0
- package/dist/api/railway.js +71 -0
- package/dist/api/sdk-dispatch.d.ts +6 -0
- package/dist/api/sdk-dispatch.js +14 -0
- package/dist/api/sdk-routes.d.ts +11 -0
- package/dist/api/sdk-routes.js +29 -0
- package/dist/api/templates.d.ts +3 -0
- package/dist/api/templates.js +31 -0
- package/dist/api/types.d.ts +232 -0
- package/dist/api/types.js +0 -0
- package/dist/capacity-provider.d.ts +383 -0
- package/dist/capacity-provider.js +535 -0
- package/dist/capacity.d.ts +2 -35
- package/dist/control-plane-client.d.ts +8 -3
- package/dist/control-plane-client.js +12 -1
- package/dist/d1-store.js +27 -3
- package/dist/db/node-sqlite.js +11 -2
- package/dist/dispatch.js +0 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/market-client.d.ts +1 -5
- package/dist/market-client.js +2 -8
- package/dist/model-registry.js +55 -24
- package/dist/operations/providers/default.js +0 -9
- package/dist/operations/services/config-runtime.d.ts +2 -2
- package/dist/operations/services/config-runtime.js +55 -3
- package/dist/operations/services/d1-migration.js +32 -0
- package/dist/operations/services/deploy.js +3 -0
- package/dist/operations/services/github-automation.d.ts +10 -15
- package/dist/operations/services/github-automation.js +3 -35
- package/dist/operations/services/hosting-audit.d.ts +1 -1
- package/dist/operations/services/hosting-audit.js +3 -27
- package/dist/operations/services/hub-launch.d.ts +0 -1
- package/dist/operations/services/hub-launch.js +1 -2
- package/dist/operations/services/hub-provider-launch.d.ts +0 -15
- package/dist/operations/services/hub-provider-launch.js +5 -41
- package/dist/operations/services/package-reference-policy.d.ts +1 -0
- package/dist/operations/services/package-reference-policy.js +10 -2
- package/dist/operations/services/project-platform.d.ts +69 -1
- package/dist/operations/services/project-platform.js +33 -13
- package/dist/operations/services/release-candidate.js +19 -3
- package/dist/operations/services/repository-save-orchestrator.js +10 -1
- package/dist/operations-registry.js +1 -3
- package/dist/platform/contracts.d.ts +2 -2
- package/dist/project-workflow.d.ts +0 -3
- package/dist/scripts/publish-package.js +5 -1
- package/dist/scripts/tenant-workflow-action.js +3 -3
- package/dist/scripts/workflow-commands.test.js +3 -6
- package/dist/sdk-types.d.ts +34 -2
- package/dist/sdk-types.js +2 -1
- package/dist/stores/operational-store.d.ts +13 -0
- package/dist/stores/operational-store.js +50 -0
- package/dist/treeseed/template-catalog/templates/starter-basic/template/package.json +1 -4
- package/dist/treeseed/template-catalog/templates/starter-basic/template/src/api/server.js +1 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +1 -17
- package/dist/workflow/operations.js +26 -8
- package/package.json +14 -1
- package/templates/github/hosted-project.workflow.yml +0 -1
- package/templates/github/deploy-processing.workflow.yml +0 -123
package/dist/d1-store.js
CHANGED
|
@@ -187,6 +187,9 @@ class MemoryAgentDatabase {
|
|
|
187
187
|
if (model === "task") {
|
|
188
188
|
return [...this.tasks.values()];
|
|
189
189
|
}
|
|
190
|
+
if (model === "task_event") {
|
|
191
|
+
return [...this.taskEvents.values()].flat();
|
|
192
|
+
}
|
|
190
193
|
if (model === "task_output") {
|
|
191
194
|
return [...this.taskOutputs.values()].flat();
|
|
192
195
|
}
|
|
@@ -1183,6 +1186,12 @@ class CloudflareD1AgentDatabase {
|
|
|
1183
1186
|
if (request.model === "task") {
|
|
1184
1187
|
return this.operational.getTask(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1185
1188
|
}
|
|
1189
|
+
if (request.model === "task_event") {
|
|
1190
|
+
return this.operational.getTaskEvent(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1191
|
+
}
|
|
1192
|
+
if (request.model === "task_output") {
|
|
1193
|
+
return this.operational.getTaskOutput(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1194
|
+
}
|
|
1186
1195
|
if (request.model === "report") {
|
|
1187
1196
|
return this.operational.getReport(String(request.id ?? request.key ?? request.slug ?? ""));
|
|
1188
1197
|
}
|
|
@@ -1215,9 +1224,24 @@ class CloudflareD1AgentDatabase {
|
|
|
1215
1224
|
}
|
|
1216
1225
|
if (request.model === "task") {
|
|
1217
1226
|
return this.operational.searchTasks({
|
|
1218
|
-
workDayId:
|
|
1219
|
-
agentId:
|
|
1220
|
-
state:
|
|
1227
|
+
workDayId: normalizedRequest.filters?.find((entry) => entry.field === "work_day_id")?.value,
|
|
1228
|
+
agentId: normalizedRequest.filters?.find((entry) => entry.field === "agent_id")?.value,
|
|
1229
|
+
state: normalizedRequest.filters?.find((entry) => entry.field === "state")?.value,
|
|
1230
|
+
limit: request.limit
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
if (request.model === "task_event") {
|
|
1234
|
+
return this.operational.searchTaskEvents({
|
|
1235
|
+
id: normalizedRequest.filters?.find((entry) => entry.field === "id")?.value,
|
|
1236
|
+
taskId: normalizedRequest.filters?.find((entry) => entry.field === "task_id")?.value,
|
|
1237
|
+
kind: normalizedRequest.filters?.find((entry) => entry.field === "kind")?.value,
|
|
1238
|
+
limit: request.limit
|
|
1239
|
+
});
|
|
1240
|
+
}
|
|
1241
|
+
if (request.model === "task_output") {
|
|
1242
|
+
return this.operational.searchTaskOutputs({
|
|
1243
|
+
id: normalizedRequest.filters?.find((entry) => entry.field === "id")?.value,
|
|
1244
|
+
taskId: normalizedRequest.filters?.find((entry) => entry.field === "task_id")?.value,
|
|
1221
1245
|
limit: request.limit
|
|
1222
1246
|
});
|
|
1223
1247
|
}
|
package/dist/db/node-sqlite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mkdirSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, readdirSync, statSync } from "node:fs";
|
|
2
2
|
import { dirname, resolve } from "node:path";
|
|
3
3
|
import { DatabaseSync } from "node:sqlite";
|
|
4
4
|
import { drizzle } from "drizzle-orm/sqlite-proxy";
|
|
@@ -8,7 +8,16 @@ function isDirectoryLike(path) {
|
|
|
8
8
|
}
|
|
9
9
|
function resolveTreeseedSqlitePath(input) {
|
|
10
10
|
const base = input?.trim() || ".treeseed/generated/environments/local/site-data.sqlite";
|
|
11
|
-
|
|
11
|
+
if (!isDirectoryLike(base)) return resolve(base);
|
|
12
|
+
const miniflareRoot = resolve(base, "miniflare-D1DatabaseObject");
|
|
13
|
+
if (existsSync(miniflareRoot)) {
|
|
14
|
+
const candidates = readdirSync(miniflareRoot).filter((entry) => /\.sqlite$/u.test(entry) && entry !== "metadata.sqlite").map((entry) => {
|
|
15
|
+
const path = resolve(miniflareRoot, entry);
|
|
16
|
+
return { path, size: statSync(path).size };
|
|
17
|
+
}).sort((left, right) => right.size - left.size || left.path.localeCompare(right.path));
|
|
18
|
+
if (candidates[0]?.path) return candidates[0].path;
|
|
19
|
+
}
|
|
20
|
+
return resolve(base, "site-data.sqlite");
|
|
12
21
|
}
|
|
13
22
|
function toD1Result(result, rows = []) {
|
|
14
23
|
const changes = Number(result?.changes ?? 0);
|
package/dist/dispatch.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { projectConnectionModeFromHosting } from './sdk-types.ts';
|
|
|
4
4
|
export { createControlPlaneReporter } from './control-plane.ts';
|
|
5
5
|
export { ControlPlaneClient } from './control-plane-client.ts';
|
|
6
6
|
export * from './seeds/index.ts';
|
|
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';
|
|
7
8
|
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';
|
|
8
9
|
export { executeKnowledgeHubProviderLaunch, validateKnowledgeHubProviderLaunchPrerequisites, } from './operations/services/hub-provider-launch.ts';
|
|
9
10
|
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';
|
|
@@ -39,6 +40,7 @@ export type { KnowledgeHubProviderLaunchPreflightReport, KnowledgeHubProviderLau
|
|
|
39
40
|
export type * from './project-workflow.ts';
|
|
40
41
|
export type { ControlPlaneAgentPoolHeartbeat, ControlPlaneDeploymentReport, ControlPlaneEnvironmentReport, ControlPlaneReporter, ControlPlaneReporterKind, ControlPlaneResourceReport, ControlPlaneScaleDecisionReport, ControlPlaneWorkdaySummaryReport, } from './control-plane.ts';
|
|
41
42
|
export type { ControlPlaneClientOptions } from './control-plane-client.ts';
|
|
43
|
+
export type { CapacityProviderBudgetCapacity, CapacityProviderCapability, CapacityProviderConnectionState, CapacityProviderDeploymentIntent, CapacityProviderDeploymentResult, CapacityProviderDeploymentStatus, CapacityProviderEnvironmentInput, CapacityProviderEnvironmentName, CapacityProviderHealthState, CapacityProviderHeartbeatRequest, CapacityProviderHeartbeatResponse, CapacityProviderLaunchMode, CapacityProviderLaunchEnvironment, CapacityProviderLaunchEnvironmentInput, CapacityProviderConnectionConfigInput, CapacityProviderConnectionConfigResult, CapacityProviderPortfolioManifest, CapacityProviderPortfolioProject, CapacityProviderRegistrationRequest, CapacityProviderRegistrationResponse, CapacityProviderRuntimeInfo, CapacityProviderScope, CapacityProviderSelfHostInstructions, CapacityProviderStatus, MarketProviderClientOptions, ProviderReportRequest, ProviderReportResponse, ProviderTaskClaimRequest, ProviderTaskClaimResponse, ProviderTaskCompleteRequest, ProviderTaskCompleteResponse, ProviderTaskEventRequest, ProviderTaskEventResponse, ProviderTaskFailRequest, ProviderTaskFailResponse, ProviderUsageReport, ProviderUsageReportResponse, ProviderWorkdayRequest, ProviderWorkdayResponse, } from './capacity-provider.ts';
|
|
42
44
|
export type { AdmissionEstimateInput, CapacityInterruptionInput, CapacityEstimateInput, CapacityLaneCandidate, CapacityLaneScore, CapacityTaskEstimate, AttentionEstimate, AttentionPolicy, CapacityRoutePressure, RouteAndReserveCandidate, RouteAndReserveResult, TaskAdmissionInput, WorkdayBudgetEnvelopeInput, } from './capacity.ts';
|
|
43
45
|
export type { TreeseedFieldAliasBinding, TreeseedFieldAliasRegistry, } from './field-aliases.ts';
|
|
44
46
|
export type * from './operations-types.ts';
|
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,
|
package/dist/market-client.d.ts
CHANGED
|
@@ -179,11 +179,7 @@ export declare class MarketClient {
|
|
|
179
179
|
ok: true;
|
|
180
180
|
payload: Record<string, unknown>;
|
|
181
181
|
}>;
|
|
182
|
-
|
|
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
|
}>;
|
package/dist/market-client.js
CHANGED
|
@@ -365,15 +365,9 @@ class MarketClient {
|
|
|
365
365
|
{ requireAuth: true }
|
|
366
366
|
);
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
rotateCapacityProviderApiKey(teamId, providerId) {
|
|
369
369
|
return this.request(
|
|
370
|
-
`/v1/capacity
|
|
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
|
}
|
package/dist/model-registry.js
CHANGED
|
@@ -336,12 +336,13 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
336
336
|
storage: "d1",
|
|
337
337
|
operations: ["get", "read", "search", "create", "update"],
|
|
338
338
|
fields: {
|
|
339
|
-
|
|
339
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
340
|
+
project_id: field("project_id", { aliases: ["projectId"], filterable: true, dbColumns: ["project_id"], payloadPaths: ["projectId"], writeDbColumn: "project_id" }),
|
|
340
341
|
state: field("state", { filterable: true, dbColumns: ["state"], writeDbColumn: "state" }),
|
|
341
|
-
started_at: field("started_at", { aliases: ["startedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["started_at"], writeDbColumn: "started_at" }),
|
|
342
|
-
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
342
|
+
started_at: field("started_at", { aliases: ["startedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["started_at"], payloadPaths: ["startedAt"], writeDbColumn: "started_at" }),
|
|
343
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], payloadPaths: ["updatedAt"], writeDbColumn: "updated_at" })
|
|
343
344
|
},
|
|
344
|
-
filterableFields: ["project_id", "state", "started_at", "updated_at"],
|
|
345
|
+
filterableFields: ["id", "project_id", "state", "started_at", "updated_at"],
|
|
345
346
|
sortableFields: ["started_at", "updated_at"],
|
|
346
347
|
pickField: "updated_at"
|
|
347
348
|
},
|
|
@@ -351,16 +352,17 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
351
352
|
storage: "d1",
|
|
352
353
|
operations: ["get", "read", "search", "pick", "create", "update"],
|
|
353
354
|
fields: {
|
|
354
|
-
|
|
355
|
-
|
|
355
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
356
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], payloadPaths: ["workDayId"], writeDbColumn: "work_day_id" }),
|
|
357
|
+
agent_id: field("agent_id", { aliases: ["agentId"], filterable: true, dbColumns: ["agent_id"], payloadPaths: ["agentId"], writeDbColumn: "agent_id" }),
|
|
356
358
|
type: field("type", { filterable: true, dbColumns: ["type"], writeDbColumn: "type" }),
|
|
357
359
|
state: field("state", { filterable: true, dbColumns: ["state"], writeDbColumn: "state" }),
|
|
358
360
|
priority: field("priority", { filterable: true, sortable: true, comparableAs: "number", dbColumns: ["priority"], writeDbColumn: "priority" }),
|
|
359
|
-
idempotency_key: field("idempotency_key", { aliases: ["idempotencyKey"], filterable: true, dbColumns: ["idempotency_key"], writeDbColumn: "idempotency_key" }),
|
|
360
|
-
available_at: field("available_at", { aliases: ["availableAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["available_at"], writeDbColumn: "available_at" }),
|
|
361
|
-
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], writeDbColumn: "updated_at" })
|
|
361
|
+
idempotency_key: field("idempotency_key", { aliases: ["idempotencyKey"], filterable: true, dbColumns: ["idempotency_key"], payloadPaths: ["idempotencyKey"], writeDbColumn: "idempotency_key" }),
|
|
362
|
+
available_at: field("available_at", { aliases: ["availableAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["available_at"], payloadPaths: ["availableAt"], writeDbColumn: "available_at" }),
|
|
363
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["updated_at"], payloadPaths: ["updatedAt"], writeDbColumn: "updated_at" })
|
|
362
364
|
},
|
|
363
|
-
filterableFields: ["work_day_id", "agent_id", "type", "state", "priority", "idempotency_key", "available_at", "updated_at"],
|
|
365
|
+
filterableFields: ["id", "work_day_id", "agent_id", "type", "state", "priority", "idempotency_key", "available_at", "updated_at"],
|
|
364
366
|
sortableFields: ["priority", "available_at", "updated_at"],
|
|
365
367
|
pickField: "available_at"
|
|
366
368
|
},
|
|
@@ -370,12 +372,13 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
370
372
|
storage: "d1",
|
|
371
373
|
operations: ["get", "read", "search", "create"],
|
|
372
374
|
fields: {
|
|
373
|
-
|
|
375
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
376
|
+
task_id: field("task_id", { aliases: ["taskId"], filterable: true, dbColumns: ["task_id"], payloadPaths: ["taskId"], writeDbColumn: "task_id" }),
|
|
374
377
|
kind: field("kind", { filterable: true, dbColumns: ["kind"], writeDbColumn: "kind" }),
|
|
375
378
|
seq: field("seq", { filterable: true, sortable: true, comparableAs: "number", dbColumns: ["seq"], writeDbColumn: "seq" }),
|
|
376
|
-
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
379
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], payloadPaths: ["createdAt"], writeDbColumn: "created_at" })
|
|
377
380
|
},
|
|
378
|
-
filterableFields: ["task_id", "kind", "seq", "created_at"],
|
|
381
|
+
filterableFields: ["id", "task_id", "kind", "seq", "created_at"],
|
|
379
382
|
sortableFields: ["seq", "created_at"],
|
|
380
383
|
pickField: "created_at"
|
|
381
384
|
},
|
|
@@ -385,10 +388,11 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
385
388
|
storage: "d1",
|
|
386
389
|
operations: ["get", "read", "search", "create"],
|
|
387
390
|
fields: {
|
|
388
|
-
|
|
389
|
-
|
|
391
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
392
|
+
task_id: field("task_id", { aliases: ["taskId"], filterable: true, dbColumns: ["task_id"], payloadPaths: ["taskId"], writeDbColumn: "task_id" }),
|
|
393
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], payloadPaths: ["createdAt"], writeDbColumn: "created_at" })
|
|
390
394
|
},
|
|
391
|
-
filterableFields: ["task_id", "created_at"],
|
|
395
|
+
filterableFields: ["id", "task_id", "created_at"],
|
|
392
396
|
sortableFields: ["created_at"],
|
|
393
397
|
pickField: "created_at"
|
|
394
398
|
},
|
|
@@ -398,11 +402,18 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
398
402
|
storage: "d1",
|
|
399
403
|
operations: ["get", "read", "search", "create"],
|
|
400
404
|
fields: {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
405
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
406
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], payloadPaths: ["workDayId"], writeDbColumn: "work_day_id" }),
|
|
407
|
+
corpus_hash: field("corpus_hash", { aliases: ["corpusHash"], filterable: true, dbColumns: ["corpus_hash"], payloadPaths: ["corpusHash"], writeDbColumn: "corpus_hash" }),
|
|
408
|
+
graph_version: field("graph_version", { aliases: ["graphVersion"], filterable: true, sortable: true, dbColumns: ["graph_version"], payloadPaths: ["graphVersion"], writeDbColumn: "graph_version" }),
|
|
409
|
+
query_json: field("query_json", { aliases: ["queryJson"], dbColumns: ["query_json"], payloadPaths: ["queryJson"], writeDbColumn: "query_json" }),
|
|
410
|
+
seed_ids_json: field("seed_ids_json", { aliases: ["seedIdsJson"], dbColumns: ["seed_ids_json"], payloadPaths: ["seedIdsJson"], writeDbColumn: "seed_ids_json" }),
|
|
411
|
+
selected_node_ids_json: field("selected_node_ids_json", { aliases: ["selectedNodeIdsJson"], dbColumns: ["selected_node_ids_json"], payloadPaths: ["selectedNodeIdsJson"], writeDbColumn: "selected_node_ids_json" }),
|
|
412
|
+
stats_json: field("stats_json", { aliases: ["statsJson"], dbColumns: ["stats_json"], payloadPaths: ["statsJson"], writeDbColumn: "stats_json" }),
|
|
413
|
+
snapshot_ref: field("snapshot_ref", { aliases: ["snapshotRef"], filterable: true, dbColumns: ["snapshot_ref"], payloadPaths: ["snapshotRef"], writeDbColumn: "snapshot_ref" }),
|
|
414
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], payloadPaths: ["createdAt"], writeDbColumn: "created_at" })
|
|
404
415
|
},
|
|
405
|
-
filterableFields: ["work_day_id", "graph_version", "created_at"],
|
|
416
|
+
filterableFields: ["id", "work_day_id", "corpus_hash", "graph_version", "snapshot_ref", "created_at"],
|
|
406
417
|
sortableFields: ["created_at"],
|
|
407
418
|
pickField: "created_at"
|
|
408
419
|
},
|
|
@@ -412,12 +423,13 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
412
423
|
storage: "d1",
|
|
413
424
|
operations: ["get", "read", "search", "create", "update"],
|
|
414
425
|
fields: {
|
|
415
|
-
|
|
426
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
427
|
+
work_day_id: field("work_day_id", { aliases: ["workDayId"], filterable: true, dbColumns: ["work_day_id"], payloadPaths: ["workDayId"], writeDbColumn: "work_day_id" }),
|
|
416
428
|
kind: field("kind", { filterable: true, dbColumns: ["kind"], writeDbColumn: "kind" }),
|
|
417
|
-
sent_at: field("sent_at", { aliases: ["sentAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["sent_at"], writeDbColumn: "sent_at" }),
|
|
418
|
-
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], writeDbColumn: "created_at" })
|
|
429
|
+
sent_at: field("sent_at", { aliases: ["sentAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["sent_at"], payloadPaths: ["sentAt"], writeDbColumn: "sent_at" }),
|
|
430
|
+
created_at: field("created_at", { aliases: ["createdAt"], filterable: true, sortable: true, comparableAs: "date", dbColumns: ["created_at"], payloadPaths: ["createdAt"], writeDbColumn: "created_at" })
|
|
419
431
|
},
|
|
420
|
-
filterableFields: ["work_day_id", "kind", "sent_at", "created_at"],
|
|
432
|
+
filterableFields: ["id", "work_day_id", "kind", "sent_at", "created_at"],
|
|
421
433
|
sortableFields: ["sent_at", "created_at"],
|
|
422
434
|
pickField: "created_at"
|
|
423
435
|
},
|
|
@@ -571,6 +583,25 @@ function buildBuiltinModelRegistry(repoRoot) {
|
|
|
571
583
|
filterableFields: ["project_id", "environment", "runner_id", "runner_service_name", "state"],
|
|
572
584
|
sortableFields: ["runner_id", "available_capacity", "last_heartbeat_at"],
|
|
573
585
|
pickField: "last_heartbeat_at"
|
|
586
|
+
},
|
|
587
|
+
repository_claim: {
|
|
588
|
+
name: "repository_claim",
|
|
589
|
+
aliases: ["repository_claims"],
|
|
590
|
+
storage: "d1",
|
|
591
|
+
operations: ["get", "read", "search", "create", "update"],
|
|
592
|
+
fields: {
|
|
593
|
+
id: field("id", { filterable: true, dbColumns: ["id"], writeDbColumn: "id" }),
|
|
594
|
+
project_id: field("project_id", { aliases: ["projectId"], filterable: true, dbColumns: ["project_id"], payloadPaths: ["projectId"], writeDbColumn: "project_id" }),
|
|
595
|
+
repository_id: field("repository_id", { aliases: ["repositoryId"], filterable: true, dbColumns: ["repository_id"], payloadPaths: ["repositoryId"], writeDbColumn: "repository_id" }),
|
|
596
|
+
runner_id: field("runner_id", { aliases: ["runnerId"], filterable: true, dbColumns: ["runner_id"], payloadPaths: ["runnerId"], writeDbColumn: "runner_id" }),
|
|
597
|
+
runner_service_name: field("runner_service_name", { aliases: ["runnerServiceName"], filterable: true, dbColumns: ["runner_service_name"], payloadPaths: ["runnerServiceName"], writeDbColumn: "runner_service_name" }),
|
|
598
|
+
volume_identity: field("volume_identity", { aliases: ["volumeIdentity"], filterable: true, dbColumns: ["volume_identity"], payloadPaths: ["volumeIdentity"], writeDbColumn: "volume_identity" }),
|
|
599
|
+
claim_state: field("claim_state", { aliases: ["claimState"], filterable: true, dbColumns: ["claim_state"], payloadPaths: ["claimState"], writeDbColumn: "claim_state" }),
|
|
600
|
+
updated_at: field("updated_at", { aliases: ["updatedAt"], sortable: true, comparableAs: "date", dbColumns: ["updated_at"], payloadPaths: ["updatedAt"], writeDbColumn: "updated_at" })
|
|
601
|
+
},
|
|
602
|
+
filterableFields: ["id", "project_id", "repository_id", "runner_id", "runner_service_name", "volume_identity", "claim_state"],
|
|
603
|
+
sortableFields: ["updated_at"],
|
|
604
|
+
pickField: "updated_at"
|
|
574
605
|
}
|
|
575
606
|
};
|
|
576
607
|
}
|
|
@@ -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:
|
|
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
|
-
|
|
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(
|
|
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) {
|
|
@@ -2,6 +2,7 @@ import { existsSync, readdirSync } from "node:fs";
|
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
|
+
import { NodeSqliteD1Database } from "../../db/node-sqlite.js";
|
|
5
6
|
import { resolveWranglerBin } from "./runtime-tools.js";
|
|
6
7
|
const DATABASE_BINDING = "SITE_DATA_DB";
|
|
7
8
|
const WRANGLER_D1_TIMEOUT_MS = 12e4;
|
|
@@ -121,6 +122,36 @@ function migrationAlreadySatisfied({ cwd, wranglerConfig, persistTo, filePath })
|
|
|
121
122
|
const profileColumns = tableColumns({ cwd, wranglerConfig, persistTo, tableName: "task_estimate_profiles" });
|
|
122
123
|
return estimateColumns.has("execution_profile_id") && actualColumns.has("execution_profile_id") && profileColumns.has("execution_profile_id") && profileColumns.has("completed_sample_count") && profileColumns.has("interrupted_sample_count") && profileColumns.has("confidence_score");
|
|
123
124
|
}
|
|
125
|
+
function ensureLocalSdkRuntimeState({ migrationsRoot, persistTo }) {
|
|
126
|
+
if (!persistTo) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
const migrationPath = resolve(migrationsRoot, "0025_agent_runtime_state.sql");
|
|
130
|
+
if (!existsSync(migrationPath)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const sql = readFileSync(migrationPath, "utf8");
|
|
134
|
+
const targets = /* @__PURE__ */ new Set();
|
|
135
|
+
const sdkDb = new NodeSqliteD1Database(persistTo);
|
|
136
|
+
targets.add(sdkDb.path);
|
|
137
|
+
sdkDb.close();
|
|
138
|
+
const miniflareRoot = resolve(persistTo, "miniflare-D1DatabaseObject");
|
|
139
|
+
if (existsSync(miniflareRoot)) {
|
|
140
|
+
for (const entry of readdirSync(miniflareRoot)) {
|
|
141
|
+
if (entry.endsWith(".sqlite") && entry !== "metadata.sqlite") {
|
|
142
|
+
targets.add(resolve(miniflareRoot, entry));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
for (const target of targets) {
|
|
147
|
+
const db = new NodeSqliteD1Database(target);
|
|
148
|
+
try {
|
|
149
|
+
db.client.exec(sql);
|
|
150
|
+
} finally {
|
|
151
|
+
db.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
124
155
|
function runLocalD1Migrations({ cwd, wranglerConfig, migrationsRoot, persistTo }) {
|
|
125
156
|
ensureSchemaMigrationsTable({ cwd, wranglerConfig, persistTo });
|
|
126
157
|
const appliedMigrations = loadAppliedMigrations({ cwd, wranglerConfig, persistTo });
|
|
@@ -141,6 +172,7 @@ function runLocalD1Migrations({ cwd, wranglerConfig, migrationsRoot, persistTo }
|
|
|
141
172
|
executeSqlFile({ cwd, wranglerConfig, filePath, persistTo });
|
|
142
173
|
markMigrationApplied({ cwd, wranglerConfig, persistTo, migration });
|
|
143
174
|
}
|
|
175
|
+
ensureLocalSdkRuntimeState({ migrationsRoot, persistTo });
|
|
144
176
|
}
|
|
145
177
|
export {
|
|
146
178
|
runLocalD1Migrations
|
|
@@ -358,9 +358,12 @@ function buildLocalRuntimeVars(deployConfig, state, target, env) {
|
|
|
358
358
|
if (target.kind !== "persistent" || target.scope !== "local") {
|
|
359
359
|
return {};
|
|
360
360
|
}
|
|
361
|
+
const localDevAuthTtlSeconds = String(365 * 24 * 60 * 60);
|
|
361
362
|
return {
|
|
362
363
|
...localAuthRuntimeVars(env),
|
|
363
364
|
TREESEED_LOCAL_DEV_MODE: envValue(env, "TREESEED_LOCAL_DEV_MODE") ?? "cloudflare",
|
|
365
|
+
TREESEED_API_ACCESS_TOKEN_TTL: envValue(env, "TREESEED_API_ACCESS_TOKEN_TTL") ?? localDevAuthTtlSeconds,
|
|
366
|
+
TREESEED_API_REFRESH_TOKEN_TTL: envValue(env, "TREESEED_API_REFRESH_TOKEN_TTL") ?? localDevAuthTtlSeconds,
|
|
364
367
|
TREESEED_FORM_TOKEN_SECRET: envValue(env, "TREESEED_FORM_TOKEN_SECRET") ?? state.generatedSecrets?.TREESEED_FORM_TOKEN_SECRET ?? "treeseed-local-form-token-secret",
|
|
365
368
|
TREESEED_BETTER_AUTH_SECRET: envValue(env, "TREESEED_BETTER_AUTH_SECRET") ?? state.generatedSecrets?.TREESEED_BETTER_AUTH_SECRET ?? state.generatedSecrets?.TREESEED_FORM_TOKEN_SECRET ?? "treeseed-local-better-auth-secret-minimum-32-characters",
|
|
366
369
|
TREESEED_EDITORIAL_PREVIEW_SECRET: envValue(env, "TREESEED_EDITORIAL_PREVIEW_SECRET") ?? state.generatedSecrets?.TREESEED_EDITORIAL_PREVIEW_SECRET ?? "treeseed-local-editorial-preview-secret",
|
|
@@ -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[];
|