@treeseed/sdk 0.4.8 → 0.4.10
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/README.md +1 -1
- package/dist/control-plane-client.d.ts +45 -0
- package/dist/control-plane-client.js +229 -0
- package/dist/control-plane.d.ts +94 -0
- package/dist/control-plane.js +125 -0
- package/dist/d1-store.d.ts +56 -1
- package/dist/d1-store.js +132 -0
- package/dist/dispatch.d.ts +4 -0
- package/dist/dispatch.js +180 -0
- package/dist/index.d.ts +14 -2
- package/dist/index.js +94 -4
- package/dist/operations/services/config-runtime.d.ts +10 -0
- package/dist/operations/services/config-runtime.js +62 -4
- package/dist/operations/services/deploy.d.ts +95 -3
- package/dist/operations/services/deploy.js +351 -10
- package/dist/operations/services/github-automation.d.ts +37 -1
- package/dist/operations/services/github-automation.js +71 -14
- package/dist/operations/services/project-platform.d.ts +835 -0
- package/dist/operations/services/project-platform.js +782 -0
- package/dist/operations/services/railway-deploy.d.ts +113 -18
- package/dist/operations/services/railway-deploy.js +357 -8
- package/dist/operations/services/runtime-tools.d.ts +25 -1
- package/dist/operations/services/runtime-tools.js +66 -5
- package/dist/operations/services/template-registry.d.ts +1 -1
- package/dist/operations/services/template-registry.js +17 -3
- package/dist/platform/books-data.d.ts +3 -4
- package/dist/platform/books-data.js +30 -4
- package/dist/platform/contracts.d.ts +56 -4
- package/dist/platform/deploy-config.js +109 -4
- package/dist/platform/deploy-runtime.d.ts +2 -0
- package/dist/platform/deploy-runtime.js +9 -1
- package/dist/platform/env.yaml +677 -0
- package/dist/platform/environment.js +57 -2
- package/dist/platform/plugin.d.ts +8 -0
- package/dist/platform/plugins/constants.d.ts +2 -0
- package/dist/platform/plugins/constants.js +2 -0
- package/dist/platform/plugins/runtime.d.ts +2 -0
- package/dist/platform/plugins/runtime.js +9 -1
- package/dist/platform/plugins.d.ts +1 -1
- package/dist/platform/plugins.js +4 -0
- package/dist/platform/published-content-pipeline.d.ts +84 -0
- package/dist/platform/published-content-pipeline.js +543 -0
- package/dist/platform/published-content.d.ts +223 -0
- package/dist/platform/published-content.js +588 -0
- package/dist/platform/tenant/runtime-config.d.ts +1 -1
- package/dist/platform/tenant/runtime-config.js +34 -1
- package/dist/platform/tenant-config.d.ts +2 -1
- package/dist/platform/tenant-config.js +17 -1
- package/dist/platform/utils/site-config-schema.js +104 -0
- package/dist/plugin-default.d.ts +2 -0
- package/dist/plugin-default.js +2 -0
- package/dist/remote.d.ts +65 -9
- package/dist/remote.js +104 -28
- package/dist/scripts/check-build-warnings.js +50 -0
- package/dist/scripts/config-treeseed.js +7 -0
- package/dist/scripts/tenant-workflow-action.js +71 -0
- package/dist/sdk-dispatch.d.ts +12 -0
- package/dist/sdk-dispatch.js +142 -0
- package/dist/sdk-types.d.ts +579 -7
- package/dist/sdk-types.js +53 -1
- package/dist/sdk.d.ts +17 -1
- package/dist/sdk.js +109 -0
- package/dist/stores/operational-store.d.ts +22 -2
- package/dist/stores/operational-store.js +235 -0
- package/dist/template-catalog.js +8 -1
- package/dist/treeseed/template-catalog/templates/starter-basic/template/treeseed.site.yaml +20 -0
- package/dist/types/cloudflare.d.ts +23 -0
- package/dist/workflow/operations.d.ts +12 -3
- package/dist/workflow/policy.d.ts +1 -1
- package/dist/workflow-state.js +2 -1
- package/package.json +7 -2
- package/templates/github/deploy.workflow.yml +442 -0
- package/templates/github/hosted-project.workflow.yml +77 -0
package/dist/sdk.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AgentPermissionConfig, AgentRuntimeSpec } from './types/agents.ts'
|
|
|
2
2
|
import { ContentStore } from './content-store.ts';
|
|
3
3
|
import { type AgentDatabase } from './d1-store.ts';
|
|
4
4
|
import { type LoadedTreeseedPluginEntry } from './platform/plugins.ts';
|
|
5
|
-
import type { SdkAckMessageRequest, SdkClaimMessageRequest, SdkClaimTaskRequest, SdkCloseWorkDayRequest, SdkCompleteTaskRequest, SdkCreateReportRequest, SdkCreateMessageRequest, SdkCreateTaskRequest, SdkCursorRequest, SdkFailTaskRequest, SdkFollowRequest, SdkGetRequest, SdkGetCursorRequest, SdkJsonEnvelope, SdkLeaseReleaseRequest, SdkManagerContextPayload, SdkMutationRequest, SdkGraphQueryOptions, SdkGraphQueryRequest, SdkGraphRefreshRequest, SdkGraphSearchOptions, SdkContextPackRequest, SdkGraphDslParseResult, SdkPickRequest, SdkRecordRunRequest, SdkSearchRequest, SdkStartWorkDayRequest, SdkTaskProgressRequest, SdkTaskSearchRequest, SdkUpdateRequest, SdkModelDefinition, SdkModelRegistry, SdkGraphRankingProvider } from './sdk-types.ts';
|
|
5
|
+
import type { SdkAckMessageRequest, SdkClaimMessageRequest, SdkClaimTaskRequest, SdkCloseWorkDayRequest, SdkCompleteTaskRequest, SdkCreateReportRequest, SdkCreateMessageRequest, SdkCreatePrioritySnapshotRequest, SdkCreateTaskRequest, SdkCursorRequest, SdkFailTaskRequest, SdkFollowRequest, SdkGetRequest, SdkGetCursorRequest, SdkJsonEnvelope, SdkLeaseReleaseRequest, SdkManagerContextPayload, SdkMutationRequest, SdkGraphQueryOptions, SdkGraphQueryRequest, SdkGraphRefreshRequest, SdkGraphSearchOptions, SdkContextPackRequest, SdkGraphDslParseResult, SdkPickRequest, SdkPriorityOverrideRequest, SdkRecordRunRequest, SdkRecordScaleDecisionRequest, SdkRecordTaskCreditsRequest, SdkSearchRequest, SdkStartWorkDayRequest, SdkTaskProgressRequest, SdkTaskSearchRequest, SdkUpsertWorkPolicyRequest, SdkUpdateRequest, SdkModelDefinition, SdkModelRegistry, SdkGraphRankingProvider, SdkDispatchConfig, SdkDispatchRequest, SdkDispatchResult, PrioritySnapshot, ScaleDecision, TaskCreditLedgerEntry, WorkdayPolicy } from './sdk-types.ts';
|
|
6
6
|
export interface AgentSdkOptions {
|
|
7
7
|
repoRoot?: string;
|
|
8
8
|
database?: AgentDatabase;
|
|
@@ -10,12 +10,15 @@ export interface AgentSdkOptions {
|
|
|
10
10
|
modelRegistry?: SdkModelRegistry;
|
|
11
11
|
graphRankingProvider?: SdkGraphRankingProvider;
|
|
12
12
|
plugins?: LoadedTreeseedPluginEntry[];
|
|
13
|
+
dispatch?: SdkDispatchConfig;
|
|
13
14
|
}
|
|
14
15
|
export declare class AgentSdk {
|
|
16
|
+
readonly repoRoot: string;
|
|
15
17
|
readonly database: AgentDatabase;
|
|
16
18
|
readonly content: ContentStore;
|
|
17
19
|
readonly models: SdkModelRegistry;
|
|
18
20
|
private readonly graph;
|
|
21
|
+
private readonly dispatchConfig?;
|
|
19
22
|
constructor(options?: AgentSdkOptions);
|
|
20
23
|
static createLocal(options: {
|
|
21
24
|
repoRoot?: string;
|
|
@@ -24,6 +27,9 @@ export declare class AgentSdk {
|
|
|
24
27
|
models?: SdkModelDefinition[];
|
|
25
28
|
modelRegistry?: SdkModelRegistry;
|
|
26
29
|
}): AgentSdk;
|
|
30
|
+
private resolveDispatchToken;
|
|
31
|
+
private executeDispatchLocally;
|
|
32
|
+
dispatch(request: SdkDispatchRequest): Promise<SdkDispatchResult>;
|
|
27
33
|
private envelope;
|
|
28
34
|
get(request: SdkGetRequest): Promise<SdkJsonEnvelope<Record<string, unknown> | import("./sdk-types.ts").SdkContentEntry | null>>;
|
|
29
35
|
read(request: SdkGetRequest): Promise<{
|
|
@@ -79,6 +85,16 @@ export declare class AgentSdk {
|
|
|
79
85
|
searchTasks(request: SdkTaskSearchRequest): Promise<SdkJsonEnvelope<import("./sdk-types.ts").SdkTaskEntity[]>>;
|
|
80
86
|
createReport(request: SdkCreateReportRequest): Promise<SdkJsonEnvelope<import("./sdk-types.ts").SdkReportEntity | null>>;
|
|
81
87
|
getManagerContext(taskId: string): Promise<SdkJsonEnvelope<SdkManagerContextPayload>>;
|
|
88
|
+
getWorkPolicy(projectId: string, environment?: string): Promise<SdkJsonEnvelope<WorkdayPolicy>>;
|
|
89
|
+
upsertWorkPolicy(request: SdkUpsertWorkPolicyRequest): Promise<SdkJsonEnvelope<WorkdayPolicy>>;
|
|
90
|
+
listPriorityOverrides(projectId: string): Promise<SdkJsonEnvelope<Record<string, unknown>[]>>;
|
|
91
|
+
upsertPriorityOverride(request: SdkPriorityOverrideRequest): Promise<SdkJsonEnvelope<Record<string, unknown> | null>>;
|
|
92
|
+
createPrioritySnapshot(request: SdkCreatePrioritySnapshotRequest): Promise<SdkJsonEnvelope<PrioritySnapshot>>;
|
|
93
|
+
getLatestPrioritySnapshot(projectId: string, workDayId?: string | null): Promise<SdkJsonEnvelope<PrioritySnapshot>>;
|
|
94
|
+
recordTaskCredits(request: SdkRecordTaskCreditsRequest): Promise<SdkJsonEnvelope<TaskCreditLedgerEntry>>;
|
|
95
|
+
listTaskCredits(workDayId: string): Promise<SdkJsonEnvelope<TaskCreditLedgerEntry[]>>;
|
|
96
|
+
recordScaleDecision(request: SdkRecordScaleDecisionRequest): Promise<SdkJsonEnvelope<ScaleDecision>>;
|
|
97
|
+
getLatestScaleDecision(projectId: string, environment: string, poolName: string): Promise<SdkJsonEnvelope<ScaleDecision>>;
|
|
82
98
|
listAgentSpecs(options?: {
|
|
83
99
|
enabled?: boolean;
|
|
84
100
|
}): Promise<AgentRuntimeSpec[]>;
|
package/dist/sdk.js
CHANGED
|
@@ -5,6 +5,10 @@ import { CloudflareD1AgentDatabase, MemoryAgentDatabase } from "./d1-store.js";
|
|
|
5
5
|
import { ContentGraphRuntime } from "./graph.js";
|
|
6
6
|
import { loadTreeseedPlugins } from "./platform/plugins.js";
|
|
7
7
|
import { buildScopedModelRegistry, resolveModelDefinition } from "./model-registry.js";
|
|
8
|
+
import { findDispatchCapability } from "./dispatch.js";
|
|
9
|
+
import { RemoteTreeseedClient, RemoteTreeseedDispatchClient } from "./remote.js";
|
|
10
|
+
import { executeSdkOperation } from "./sdk-dispatch.js";
|
|
11
|
+
import { TreeseedOperationsSdk } from "./operations/runtime.js";
|
|
8
12
|
import { WranglerD1Database } from "./wrangler-d1.js";
|
|
9
13
|
function normalizeAgentSpec(entry) {
|
|
10
14
|
if (!entry) {
|
|
@@ -27,12 +31,15 @@ function operationAllowed(permissions, model, operation) {
|
|
|
27
31
|
);
|
|
28
32
|
}
|
|
29
33
|
class AgentSdk {
|
|
34
|
+
repoRoot;
|
|
30
35
|
database;
|
|
31
36
|
content;
|
|
32
37
|
models;
|
|
33
38
|
graph;
|
|
39
|
+
dispatchConfig;
|
|
34
40
|
constructor(options = {}) {
|
|
35
41
|
const repoRoot = resolveSdkRepoRoot(options.repoRoot);
|
|
42
|
+
this.repoRoot = repoRoot;
|
|
36
43
|
this.models = options.modelRegistry ?? buildScopedModelRegistry(repoRoot, options.models);
|
|
37
44
|
this.database = options.database ?? new MemoryAgentDatabase();
|
|
38
45
|
this.content = new ContentStore(repoRoot, this.database, this.models);
|
|
@@ -48,6 +55,7 @@ class AgentSdk {
|
|
|
48
55
|
rankingProvider: options.graphRankingProvider,
|
|
49
56
|
plugins
|
|
50
57
|
});
|
|
58
|
+
this.dispatchConfig = options.dispatch;
|
|
51
59
|
}
|
|
52
60
|
static createLocal(options) {
|
|
53
61
|
const repoRoot = resolveSdkRepoRoot(options.repoRoot);
|
|
@@ -63,6 +71,67 @@ class AgentSdk {
|
|
|
63
71
|
modelRegistry: options.modelRegistry
|
|
64
72
|
});
|
|
65
73
|
}
|
|
74
|
+
async resolveDispatchToken(source) {
|
|
75
|
+
if (!source) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
if (source.type === "bearer") {
|
|
79
|
+
return source.token;
|
|
80
|
+
}
|
|
81
|
+
return await source.resolveToken();
|
|
82
|
+
}
|
|
83
|
+
async executeDispatchLocally(request) {
|
|
84
|
+
const namespace = request.namespace ?? "sdk";
|
|
85
|
+
if (namespace === "workflow") {
|
|
86
|
+
const operations = new TreeseedOperationsSdk();
|
|
87
|
+
return operations.execute({
|
|
88
|
+
operationName: request.operation,
|
|
89
|
+
input: request.input ?? {}
|
|
90
|
+
}, {
|
|
91
|
+
cwd: this.repoRoot,
|
|
92
|
+
env: process.env,
|
|
93
|
+
transport: "sdk"
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return executeSdkOperation(this, request.operation, request.input ?? {});
|
|
97
|
+
}
|
|
98
|
+
async dispatch(request) {
|
|
99
|
+
const namespace = request.namespace ?? "sdk";
|
|
100
|
+
const capability = findDispatchCapability(namespace, request.operation);
|
|
101
|
+
if (!capability) {
|
|
102
|
+
throw new Error(`Unknown dispatch operation "${namespace}:${request.operation}".`);
|
|
103
|
+
}
|
|
104
|
+
const preferredMode = request.preferredMode ?? this.dispatchConfig?.policy ?? capability.defaultDispatchMode;
|
|
105
|
+
const dispatchConfig = this.dispatchConfig;
|
|
106
|
+
if (!dispatchConfig && preferredMode === "remote_only") {
|
|
107
|
+
throw new Error(`Dispatch for "${namespace}:${request.operation}" requires a remote market configuration.`);
|
|
108
|
+
}
|
|
109
|
+
const shouldStayLocal = capability.executionClass === "local_only" || !dispatchConfig || preferredMode === "prefer_local";
|
|
110
|
+
if (shouldStayLocal) {
|
|
111
|
+
return {
|
|
112
|
+
ok: true,
|
|
113
|
+
mode: "inline",
|
|
114
|
+
namespace,
|
|
115
|
+
operation: request.operation,
|
|
116
|
+
target: "local",
|
|
117
|
+
capability,
|
|
118
|
+
payload: await this.executeDispatchLocally({ ...request, namespace })
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
const token = await this.resolveDispatchToken(dispatchConfig.credentialSource);
|
|
122
|
+
const client = new RemoteTreeseedDispatchClient(new RemoteTreeseedClient({
|
|
123
|
+
hosts: [{ id: "market", baseUrl: dispatchConfig.marketBaseUrl }],
|
|
124
|
+
activeHostId: "market",
|
|
125
|
+
auth: token ? { accessToken: token } : void 0
|
|
126
|
+
}, {
|
|
127
|
+
fetchImpl: dispatchConfig.fetchImpl
|
|
128
|
+
}));
|
|
129
|
+
return client.dispatch(dispatchConfig.projectId, {
|
|
130
|
+
...request,
|
|
131
|
+
namespace,
|
|
132
|
+
preferredMode
|
|
133
|
+
});
|
|
134
|
+
}
|
|
66
135
|
envelope(model, operation, payload, meta) {
|
|
67
136
|
return {
|
|
68
137
|
ok: true,
|
|
@@ -192,6 +261,46 @@ class AgentSdk {
|
|
|
192
261
|
const payload = await this.database.getManagerContext(taskId);
|
|
193
262
|
return this.envelope("task", "get", payload);
|
|
194
263
|
}
|
|
264
|
+
async getWorkPolicy(projectId, environment = "local") {
|
|
265
|
+
const payload = await this.database.getWorkPolicy(projectId, environment);
|
|
266
|
+
return this.envelope("work_day", "get", payload);
|
|
267
|
+
}
|
|
268
|
+
async upsertWorkPolicy(request) {
|
|
269
|
+
const payload = await this.database.upsertWorkPolicy(request);
|
|
270
|
+
return this.envelope("work_day", "update", payload);
|
|
271
|
+
}
|
|
272
|
+
async listPriorityOverrides(projectId) {
|
|
273
|
+
const payload = await this.database.listPriorityOverrides(projectId);
|
|
274
|
+
return this.envelope("task", "search", payload, { count: payload.length });
|
|
275
|
+
}
|
|
276
|
+
async upsertPriorityOverride(request) {
|
|
277
|
+
const payload = await this.database.upsertPriorityOverride(request);
|
|
278
|
+
return this.envelope("task", "update", payload);
|
|
279
|
+
}
|
|
280
|
+
async createPrioritySnapshot(request) {
|
|
281
|
+
const payload = await this.database.createPrioritySnapshot(request);
|
|
282
|
+
return this.envelope("report", "create", payload);
|
|
283
|
+
}
|
|
284
|
+
async getLatestPrioritySnapshot(projectId, workDayId) {
|
|
285
|
+
const payload = await this.database.getLatestPrioritySnapshot(projectId, workDayId);
|
|
286
|
+
return this.envelope("report", "get", payload);
|
|
287
|
+
}
|
|
288
|
+
async recordTaskCredits(request) {
|
|
289
|
+
const payload = await this.database.recordTaskCredits(request);
|
|
290
|
+
return this.envelope("report", "create", payload);
|
|
291
|
+
}
|
|
292
|
+
async listTaskCredits(workDayId) {
|
|
293
|
+
const payload = await this.database.listTaskCredits(workDayId);
|
|
294
|
+
return this.envelope("report", "search", payload, { count: payload.length });
|
|
295
|
+
}
|
|
296
|
+
async recordScaleDecision(request) {
|
|
297
|
+
const payload = await this.database.recordScaleDecision(request);
|
|
298
|
+
return this.envelope("report", "create", payload);
|
|
299
|
+
}
|
|
300
|
+
async getLatestScaleDecision(projectId, environment, poolName) {
|
|
301
|
+
const payload = await this.database.getLatestScaleDecision(projectId, environment, poolName);
|
|
302
|
+
return this.envelope("report", "get", payload);
|
|
303
|
+
}
|
|
195
304
|
async listAgentSpecs(options) {
|
|
196
305
|
const rawEntries = await this.listRawAgentSpecs(options);
|
|
197
306
|
return rawEntries.map((entry) => normalizeAgentSpec(entry)).filter((entry) => Boolean(entry && entry.slug));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SdkAppendTaskEventRequest, SdkClaimTaskRequest, SdkCloseWorkDayRequest, SdkCompleteTaskRequest, SdkCreateReportRequest, SdkCreateTaskRequest, SdkFailTaskRequest, SdkGraphRunEntity, SdkReportEntity, SdkStartWorkDayRequest, SdkTaskEntity, SdkTaskEventEntity, SdkTaskOutputEntity, SdkTaskProgressRequest, SdkTaskSearchRequest, SdkWorkDayEntity } from '../sdk-types.ts';
|
|
2
|
-
import { SqliteStoreBase } from './helpers.ts';
|
|
1
|
+
import type { PrioritySnapshot, SdkCreatePrioritySnapshotRequest, SdkAppendTaskEventRequest, SdkClaimTaskRequest, SdkCloseWorkDayRequest, SdkCompleteTaskRequest, SdkCreateReportRequest, SdkCreateTaskRequest, SdkFailTaskRequest, SdkGraphRunEntity, SdkPriorityOverrideRequest, SdkReportEntity, SdkRecordScaleDecisionRequest, SdkRecordTaskCreditsRequest, SdkStartWorkDayRequest, SdkTaskEntity, SdkTaskEventEntity, SdkTaskOutputEntity, SdkTaskProgressRequest, SdkTaskSearchRequest, SdkUpsertWorkPolicyRequest, SdkWorkDayEntity, ScaleDecision, TaskCreditLedgerEntry, WorkdayPolicy } from '../sdk-types.ts';
|
|
2
|
+
import { SqliteStoreBase, type DatabaseRow } from './helpers.ts';
|
|
3
3
|
export declare class OperationalStore extends SqliteStoreBase {
|
|
4
4
|
getWorkDay(id: string): Promise<SdkWorkDayEntity | null>;
|
|
5
5
|
searchWorkDays(limit?: number): Promise<SdkWorkDayEntity[]>;
|
|
@@ -21,4 +21,24 @@ export declare class OperationalStore extends SqliteStoreBase {
|
|
|
21
21
|
getLatestGraphRun(workDayId: string): Promise<SdkGraphRunEntity | null>;
|
|
22
22
|
createReport(request: SdkCreateReportRequest): Promise<SdkReportEntity | null>;
|
|
23
23
|
getReport(id: string): Promise<SdkReportEntity | null>;
|
|
24
|
+
getWorkPolicy(projectId: string, environment?: string): Promise<WorkdayPolicy | null>;
|
|
25
|
+
upsertWorkPolicy(request: SdkUpsertWorkPolicyRequest): Promise<WorkdayPolicy | null>;
|
|
26
|
+
listPriorityOverrides(projectId: string): Promise<DatabaseRow[]>;
|
|
27
|
+
upsertPriorityOverride(request: SdkPriorityOverrideRequest): Promise<{
|
|
28
|
+
id: string;
|
|
29
|
+
projectId: string;
|
|
30
|
+
model: string;
|
|
31
|
+
subjectId: string;
|
|
32
|
+
priority: number;
|
|
33
|
+
estimatedCredits: number | null;
|
|
34
|
+
metadata: Record<string, unknown>;
|
|
35
|
+
createdAt: string;
|
|
36
|
+
updatedAt: string;
|
|
37
|
+
} | null>;
|
|
38
|
+
createPrioritySnapshot(request: SdkCreatePrioritySnapshotRequest): Promise<PrioritySnapshot | null>;
|
|
39
|
+
getLatestPrioritySnapshot(projectId: string, workDayId?: string | null): Promise<PrioritySnapshot | null>;
|
|
40
|
+
recordTaskCredits(request: SdkRecordTaskCreditsRequest): Promise<TaskCreditLedgerEntry | null>;
|
|
41
|
+
listTaskCredits(workDayId: string): Promise<TaskCreditLedgerEntry[]>;
|
|
42
|
+
recordScaleDecision(request: SdkRecordScaleDecisionRequest): Promise<ScaleDecision | null>;
|
|
43
|
+
getLatestScaleDecision(projectId: string, environment: string, poolName: string): Promise<ScaleDecision | null>;
|
|
24
44
|
}
|
|
@@ -88,6 +88,78 @@ function reportFromRow(row) {
|
|
|
88
88
|
createdAt: String(row.created_at ?? row.createdAt ?? nowIso())
|
|
89
89
|
};
|
|
90
90
|
}
|
|
91
|
+
function parseJsonValue(value, fallback) {
|
|
92
|
+
if (typeof value !== "string" || !value.trim()) {
|
|
93
|
+
return fallback;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
return JSON.parse(value);
|
|
97
|
+
} catch {
|
|
98
|
+
return fallback;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function normalizeAutoscale(value, fallback) {
|
|
102
|
+
return {
|
|
103
|
+
minWorkers: Number(value?.minWorkers ?? fallback?.minWorkers ?? 0),
|
|
104
|
+
maxWorkers: Number(value?.maxWorkers ?? fallback?.maxWorkers ?? 1),
|
|
105
|
+
targetQueueDepth: Number(value?.targetQueueDepth ?? fallback?.targetQueueDepth ?? 1),
|
|
106
|
+
cooldownSeconds: Number(value?.cooldownSeconds ?? fallback?.cooldownSeconds ?? 60)
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function workPolicyFromRow(row) {
|
|
110
|
+
return {
|
|
111
|
+
projectId: String(row.project_id ?? ""),
|
|
112
|
+
environment: String(row.environment ?? "local"),
|
|
113
|
+
schedule: parseJsonValue(row.schedule_json, {
|
|
114
|
+
timezone: "UTC",
|
|
115
|
+
windows: []
|
|
116
|
+
}),
|
|
117
|
+
dailyTaskCreditBudget: Number(row.daily_task_credit_budget ?? 0),
|
|
118
|
+
maxQueuedTasks: Number(row.max_queued_tasks ?? 0),
|
|
119
|
+
maxQueuedCredits: Number(row.max_queued_credits ?? 0),
|
|
120
|
+
autoscale: normalizeAutoscale(parseJsonValue(row.autoscale_json, {})),
|
|
121
|
+
creditWeights: parseJsonValue(row.credit_weights_json, []),
|
|
122
|
+
metadata: parseJsonValue(row.metadata_json, {})
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function prioritySnapshotFromRow(row) {
|
|
126
|
+
const payload = parseJsonValue(row.snapshot_json, {});
|
|
127
|
+
return {
|
|
128
|
+
id: String(row.id ?? ""),
|
|
129
|
+
projectId: String(row.project_id ?? ""),
|
|
130
|
+
workDayId: row.work_day_id !== void 0 && row.work_day_id !== null ? String(row.work_day_id) : null,
|
|
131
|
+
generatedAt: String(row.generated_at ?? row.created_at ?? nowIso()),
|
|
132
|
+
items: Array.isArray(payload.items) ? payload.items : [],
|
|
133
|
+
metadata: parseJsonValue(row.metadata_json, {})
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function taskCreditLedgerEntryFromRow(row) {
|
|
137
|
+
return {
|
|
138
|
+
id: String(row.id ?? ""),
|
|
139
|
+
projectId: String(row.project_id ?? ""),
|
|
140
|
+
workDayId: String(row.work_day_id ?? ""),
|
|
141
|
+
taskId: row.task_id !== void 0 && row.task_id !== null ? String(row.task_id) : null,
|
|
142
|
+
phase: String(row.phase ?? "seed"),
|
|
143
|
+
credits: Number(row.credits ?? 0),
|
|
144
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
145
|
+
createdAt: String(row.created_at ?? nowIso())
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function scaleDecisionFromRow(row) {
|
|
149
|
+
return {
|
|
150
|
+
id: String(row.id ?? ""),
|
|
151
|
+
projectId: String(row.project_id ?? ""),
|
|
152
|
+
environment: String(row.environment ?? "local"),
|
|
153
|
+
poolName: String(row.pool_name ?? ""),
|
|
154
|
+
workDayId: row.work_day_id !== void 0 && row.work_day_id !== null ? String(row.work_day_id) : null,
|
|
155
|
+
desiredWorkers: Number(row.desired_workers ?? 0),
|
|
156
|
+
observedQueueDepth: Number(row.observed_queue_depth ?? 0),
|
|
157
|
+
observedActiveLeases: Number(row.observed_active_leases ?? 0),
|
|
158
|
+
reason: String(row.reason ?? "reconcile"),
|
|
159
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
160
|
+
createdAt: String(row.created_at ?? nowIso())
|
|
161
|
+
};
|
|
162
|
+
}
|
|
91
163
|
class OperationalStore extends SqliteStoreBase {
|
|
92
164
|
async getWorkDay(id) {
|
|
93
165
|
const row = await this.selectFirst(`SELECT * FROM work_days WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
@@ -273,6 +345,169 @@ class OperationalStore extends SqliteStoreBase {
|
|
|
273
345
|
const row = await this.selectFirst(`SELECT * FROM reports WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
274
346
|
return row ? reportFromRow(row) : null;
|
|
275
347
|
}
|
|
348
|
+
async getWorkPolicy(projectId, environment = "local") {
|
|
349
|
+
if (!await this.tableExists("work_policies")) {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
const row = await this.selectFirst(
|
|
353
|
+
`SELECT * FROM work_policies WHERE project_id = ${toSqlValue(projectId)} AND environment = ${toSqlValue(environment)} LIMIT 1`
|
|
354
|
+
);
|
|
355
|
+
return row ? workPolicyFromRow(row) : null;
|
|
356
|
+
}
|
|
357
|
+
async upsertWorkPolicy(request) {
|
|
358
|
+
const timestamp = nowIso();
|
|
359
|
+
await this.execute(
|
|
360
|
+
`INSERT OR REPLACE INTO work_policies (
|
|
361
|
+
project_id, environment, schedule_json, daily_task_credit_budget, max_queued_tasks, max_queued_credits, autoscale_json, credit_weights_json, metadata_json, created_at, updated_at
|
|
362
|
+
) VALUES (
|
|
363
|
+
${toSqlValue(request.projectId)},
|
|
364
|
+
${toSqlValue(request.environment)},
|
|
365
|
+
${toSqlValue(json(request.schedule))},
|
|
366
|
+
${Number(request.dailyTaskCreditBudget ?? 0)},
|
|
367
|
+
${Number(request.maxQueuedTasks ?? 0)},
|
|
368
|
+
${Number(request.maxQueuedCredits ?? 0)},
|
|
369
|
+
${toSqlValue(json(request.autoscale))},
|
|
370
|
+
${toSqlValue(json(request.creditWeights ?? []))},
|
|
371
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
372
|
+
COALESCE((SELECT created_at FROM work_policies WHERE project_id = ${toSqlValue(request.projectId)} AND environment = ${toSqlValue(request.environment)}), ${toSqlValue(timestamp)}),
|
|
373
|
+
${toSqlValue(timestamp)}
|
|
374
|
+
)`
|
|
375
|
+
);
|
|
376
|
+
return this.getWorkPolicy(request.projectId, request.environment);
|
|
377
|
+
}
|
|
378
|
+
async listPriorityOverrides(projectId) {
|
|
379
|
+
if (!await this.tableExists("priority_overrides")) {
|
|
380
|
+
return [];
|
|
381
|
+
}
|
|
382
|
+
return this.selectAll(
|
|
383
|
+
`SELECT * FROM priority_overrides WHERE project_id = ${toSqlValue(projectId)} ORDER BY priority DESC, updated_at DESC`
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
async upsertPriorityOverride(request) {
|
|
387
|
+
const id = request.id ?? crypto.randomUUID();
|
|
388
|
+
const timestamp = nowIso();
|
|
389
|
+
await this.execute(
|
|
390
|
+
`INSERT OR REPLACE INTO priority_overrides (
|
|
391
|
+
id, project_id, model, subject_id, priority, estimated_credits, metadata_json, created_at, updated_at
|
|
392
|
+
) VALUES (
|
|
393
|
+
${toSqlValue(id)},
|
|
394
|
+
${toSqlValue(request.projectId)},
|
|
395
|
+
${toSqlValue(request.model)},
|
|
396
|
+
${toSqlValue(request.subjectId)},
|
|
397
|
+
${Number(request.priority ?? 0)},
|
|
398
|
+
${toSqlValue(request.estimatedCredits ?? null)},
|
|
399
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
400
|
+
COALESCE((SELECT created_at FROM priority_overrides WHERE id = ${toSqlValue(id)}), ${toSqlValue(timestamp)}),
|
|
401
|
+
${toSqlValue(timestamp)}
|
|
402
|
+
)`
|
|
403
|
+
);
|
|
404
|
+
const row = await this.selectFirst(`SELECT * FROM priority_overrides WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
405
|
+
return row ? {
|
|
406
|
+
id: String(row.id ?? ""),
|
|
407
|
+
projectId: String(row.project_id ?? ""),
|
|
408
|
+
model: String(row.model ?? ""),
|
|
409
|
+
subjectId: String(row.subject_id ?? ""),
|
|
410
|
+
priority: Number(row.priority ?? 0),
|
|
411
|
+
estimatedCredits: row.estimated_credits === null || row.estimated_credits === void 0 ? null : Number(row.estimated_credits),
|
|
412
|
+
metadata: parseJsonValue(row.metadata_json, {}),
|
|
413
|
+
createdAt: String(row.created_at ?? timestamp),
|
|
414
|
+
updatedAt: String(row.updated_at ?? timestamp)
|
|
415
|
+
} : null;
|
|
416
|
+
}
|
|
417
|
+
async createPrioritySnapshot(request) {
|
|
418
|
+
const id = request.id ?? crypto.randomUUID();
|
|
419
|
+
const timestamp = nowIso();
|
|
420
|
+
await this.execute(
|
|
421
|
+
`INSERT OR REPLACE INTO priority_snapshots (
|
|
422
|
+
id, project_id, work_day_id, snapshot_json, metadata_json, generated_at, created_at, updated_at
|
|
423
|
+
) VALUES (
|
|
424
|
+
${toSqlValue(id)},
|
|
425
|
+
${toSqlValue(request.projectId)},
|
|
426
|
+
${toSqlValue(request.workDayId ?? null)},
|
|
427
|
+
${toSqlValue(json({ items: request.items }))},
|
|
428
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
429
|
+
${toSqlValue(timestamp)},
|
|
430
|
+
COALESCE((SELECT created_at FROM priority_snapshots WHERE id = ${toSqlValue(id)}), ${toSqlValue(timestamp)}),
|
|
431
|
+
${toSqlValue(timestamp)}
|
|
432
|
+
)`
|
|
433
|
+
);
|
|
434
|
+
const row = await this.selectFirst(`SELECT * FROM priority_snapshots WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
435
|
+
return row ? prioritySnapshotFromRow(row) : null;
|
|
436
|
+
}
|
|
437
|
+
async getLatestPrioritySnapshot(projectId, workDayId) {
|
|
438
|
+
if (!await this.tableExists("priority_snapshots")) {
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
const row = await this.selectFirst(
|
|
442
|
+
`SELECT * FROM priority_snapshots WHERE project_id = ${toSqlValue(projectId)}${workDayId ? ` AND work_day_id = ${toSqlValue(workDayId)}` : ""} ORDER BY generated_at DESC LIMIT 1`
|
|
443
|
+
);
|
|
444
|
+
return row ? prioritySnapshotFromRow(row) : null;
|
|
445
|
+
}
|
|
446
|
+
async recordTaskCredits(request) {
|
|
447
|
+
const id = request.id ?? crypto.randomUUID();
|
|
448
|
+
const timestamp = nowIso();
|
|
449
|
+
await this.execute(
|
|
450
|
+
`INSERT INTO task_credit_ledger (
|
|
451
|
+
id, project_id, work_day_id, task_id, phase, credits, metadata_json, created_at
|
|
452
|
+
) VALUES (
|
|
453
|
+
${toSqlValue(id)},
|
|
454
|
+
${toSqlValue(request.projectId)},
|
|
455
|
+
${toSqlValue(request.workDayId)},
|
|
456
|
+
${toSqlValue(request.taskId ?? null)},
|
|
457
|
+
${toSqlValue(request.phase)},
|
|
458
|
+
${Number(request.credits ?? 0)},
|
|
459
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
460
|
+
${toSqlValue(timestamp)}
|
|
461
|
+
)`
|
|
462
|
+
);
|
|
463
|
+
const delta = request.phase === "refund" ? -Math.abs(Number(request.credits ?? 0)) : Math.abs(Number(request.credits ?? 0));
|
|
464
|
+
await this.execute(
|
|
465
|
+
`UPDATE work_days SET capacity_used = MAX(0, capacity_used + ${delta}), updated_at = ${toSqlValue(timestamp)} WHERE id = ${toSqlValue(request.workDayId)}`
|
|
466
|
+
);
|
|
467
|
+
const row = await this.selectFirst(`SELECT * FROM task_credit_ledger WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
468
|
+
return row ? taskCreditLedgerEntryFromRow(row) : null;
|
|
469
|
+
}
|
|
470
|
+
async listTaskCredits(workDayId) {
|
|
471
|
+
if (!await this.tableExists("task_credit_ledger")) {
|
|
472
|
+
return [];
|
|
473
|
+
}
|
|
474
|
+
const rows = await this.selectAll(
|
|
475
|
+
`SELECT * FROM task_credit_ledger WHERE work_day_id = ${toSqlValue(workDayId)} ORDER BY created_at ASC`
|
|
476
|
+
);
|
|
477
|
+
return rows.map(taskCreditLedgerEntryFromRow);
|
|
478
|
+
}
|
|
479
|
+
async recordScaleDecision(request) {
|
|
480
|
+
const id = request.id ?? crypto.randomUUID();
|
|
481
|
+
const timestamp = nowIso();
|
|
482
|
+
await this.execute(
|
|
483
|
+
`INSERT INTO scale_decisions (
|
|
484
|
+
id, project_id, environment, pool_name, work_day_id, desired_workers, observed_queue_depth, observed_active_leases, reason, metadata_json, created_at
|
|
485
|
+
) VALUES (
|
|
486
|
+
${toSqlValue(id)},
|
|
487
|
+
${toSqlValue(request.projectId)},
|
|
488
|
+
${toSqlValue(request.environment)},
|
|
489
|
+
${toSqlValue(request.poolName)},
|
|
490
|
+
${toSqlValue(request.workDayId ?? null)},
|
|
491
|
+
${Number(request.desiredWorkers ?? 0)},
|
|
492
|
+
${Number(request.observedQueueDepth ?? 0)},
|
|
493
|
+
${Number(request.observedActiveLeases ?? 0)},
|
|
494
|
+
${toSqlValue(request.reason)},
|
|
495
|
+
${toSqlValue(json(request.metadata ?? {}))},
|
|
496
|
+
${toSqlValue(timestamp)}
|
|
497
|
+
)`
|
|
498
|
+
);
|
|
499
|
+
const row = await this.selectFirst(`SELECT * FROM scale_decisions WHERE id = ${toSqlValue(id)} LIMIT 1`);
|
|
500
|
+
return row ? scaleDecisionFromRow(row) : null;
|
|
501
|
+
}
|
|
502
|
+
async getLatestScaleDecision(projectId, environment, poolName) {
|
|
503
|
+
if (!await this.tableExists("scale_decisions")) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
const row = await this.selectFirst(
|
|
507
|
+
`SELECT * FROM scale_decisions WHERE project_id = ${toSqlValue(projectId)} AND environment = ${toSqlValue(environment)} AND pool_name = ${toSqlValue(poolName)} ORDER BY created_at DESC LIMIT 1`
|
|
508
|
+
);
|
|
509
|
+
return row ? scaleDecisionFromRow(row) : null;
|
|
510
|
+
}
|
|
276
511
|
}
|
|
277
512
|
export {
|
|
278
513
|
OperationalStore
|
package/dist/template-catalog.js
CHANGED
|
@@ -67,7 +67,14 @@ function normalizeTemplateCatalogEntry(value) {
|
|
|
67
67
|
minCoreVersion: optionalString(record.minCoreVersion),
|
|
68
68
|
fulfillment: {
|
|
69
69
|
mode: optionalString(fulfillment.mode),
|
|
70
|
-
source: {
|
|
70
|
+
source: optionalString(source.kind) === "r2" ? {
|
|
71
|
+
kind: "r2",
|
|
72
|
+
bucket: optionalString(source.bucket),
|
|
73
|
+
objectKey: expectString(source.objectKey, "fulfillment.source.objectKey"),
|
|
74
|
+
version: expectString(source.version, "fulfillment.source.version"),
|
|
75
|
+
publicUrl: optionalString(source.publicUrl),
|
|
76
|
+
integrity: optionalString(source.integrity)
|
|
77
|
+
} : {
|
|
71
78
|
kind: "git",
|
|
72
79
|
repoUrl: expectString(source.repoUrl, "fulfillment.source.repoUrl"),
|
|
73
80
|
directory: expectString(source.directory, "fulfillment.source.directory"),
|
|
@@ -2,9 +2,27 @@ name: __SITE_NAME__
|
|
|
2
2
|
slug: __SITE_SLUG__
|
|
3
3
|
siteUrl: __SITE_URL__
|
|
4
4
|
contactEmail: __CONTACT_EMAIL__
|
|
5
|
+
hosting:
|
|
6
|
+
kind: hosted_project
|
|
7
|
+
registration: optional
|
|
8
|
+
marketBaseUrl: https://api.treeseed.ai
|
|
9
|
+
teamId: __SITE_SLUG__
|
|
10
|
+
projectId: __SITE_SLUG__
|
|
5
11
|
cloudflare:
|
|
6
12
|
accountId: replace-with-cloudflare-account-id
|
|
7
13
|
workerName: __SITE_SLUG__
|
|
14
|
+
pages:
|
|
15
|
+
projectName: __SITE_SLUG__
|
|
16
|
+
previewProjectName: __SITE_SLUG__-staging
|
|
17
|
+
productionBranch: main
|
|
18
|
+
stagingBranch: staging
|
|
19
|
+
buildOutputDir: dist
|
|
20
|
+
r2:
|
|
21
|
+
binding: TREESEED_CONTENT_BUCKET
|
|
22
|
+
bucketName: __SITE_SLUG__-content
|
|
23
|
+
manifestKeyTemplate: teams/{teamId}/published/common.json
|
|
24
|
+
previewRootTemplate: teams/{teamId}/previews
|
|
25
|
+
previewTtlHours: 168
|
|
8
26
|
plugins:
|
|
9
27
|
- package: '@treeseed/sdk/plugin-default'
|
|
10
28
|
providers:
|
|
@@ -18,6 +36,8 @@ providers:
|
|
|
18
36
|
research: stub
|
|
19
37
|
deploy: cloudflare
|
|
20
38
|
content:
|
|
39
|
+
runtime: team_scoped_r2_overlay
|
|
40
|
+
publish: team_scoped_r2_overlay
|
|
21
41
|
docs: default
|
|
22
42
|
site: default
|
|
23
43
|
smtp:
|
|
@@ -22,11 +22,34 @@ export interface D1DatabaseLike {
|
|
|
22
22
|
export interface CloudflareRuntimeAssets {
|
|
23
23
|
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
24
24
|
}
|
|
25
|
+
export interface R2ObjectBodyLike {
|
|
26
|
+
text(): Promise<string>;
|
|
27
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
28
|
+
json<T = unknown>(): Promise<T>;
|
|
29
|
+
}
|
|
30
|
+
export interface R2ObjectLike extends R2ObjectBodyLike {
|
|
31
|
+
httpEtag?: string;
|
|
32
|
+
etag?: string;
|
|
33
|
+
size?: number;
|
|
34
|
+
uploaded?: Date;
|
|
35
|
+
writeHttpMetadata?(headers: Headers): void;
|
|
36
|
+
}
|
|
37
|
+
export interface R2PutOptionsLike {
|
|
38
|
+
httpMetadata?: Record<string, unknown>;
|
|
39
|
+
customMetadata?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
export interface R2BucketLike {
|
|
42
|
+
get(key: string): Promise<R2ObjectLike | null>;
|
|
43
|
+
head?(key: string): Promise<R2ObjectLike | null>;
|
|
44
|
+
put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: R2PutOptionsLike): Promise<unknown>;
|
|
45
|
+
delete?(key: string | string[]): Promise<void>;
|
|
46
|
+
}
|
|
25
47
|
export interface CloudflareRuntime {
|
|
26
48
|
env: {
|
|
27
49
|
FORM_GUARD_KV: KvNamespaceLike;
|
|
28
50
|
SITE_DATA_DB: D1DatabaseLike;
|
|
29
51
|
SESSION: KvNamespaceLike;
|
|
30
52
|
ASSETS?: CloudflareRuntimeAssets;
|
|
53
|
+
[key: string]: unknown;
|
|
31
54
|
};
|
|
32
55
|
}
|
|
@@ -30,7 +30,7 @@ export declare function workflowTasks(helpers: WorkflowOperationHelpers): Promis
|
|
|
30
30
|
export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?: TreeseedConfigInput): Promise<TreeseedWorkflowResult<{
|
|
31
31
|
mode: string;
|
|
32
32
|
scopes: ("local" | "staging" | "prod")[];
|
|
33
|
-
sync: "
|
|
33
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
34
34
|
configPath: string;
|
|
35
35
|
keyPath: string;
|
|
36
36
|
repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
|
|
@@ -79,6 +79,12 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
79
79
|
}>;
|
|
80
80
|
connectionChecks: ReturnType<typeof checkTreeseedProviderConnections>[];
|
|
81
81
|
validationByScope: Record<import("../operations/services/config-runtime.ts").TreeseedConfigScope, ReturnType<typeof import("../platform/environment.ts").validateTreeseedEnvironmentValues>>;
|
|
82
|
+
readinessByScope: Record<import("../operations/services/config-runtime.ts").TreeseedConfigScope, {
|
|
83
|
+
configured: boolean;
|
|
84
|
+
provisioned: boolean;
|
|
85
|
+
deployable: boolean;
|
|
86
|
+
checks: Record<string, unknown>;
|
|
87
|
+
}>;
|
|
82
88
|
updated: {
|
|
83
89
|
scope: import("../operations/services/config-runtime.ts").TreeseedConfigScope | "shared";
|
|
84
90
|
id: string;
|
|
@@ -133,7 +139,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
133
139
|
payload: {
|
|
134
140
|
mode: string;
|
|
135
141
|
scopes: ("local" | "staging" | "prod")[];
|
|
136
|
-
sync: "
|
|
142
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
137
143
|
secretsRevealed: boolean;
|
|
138
144
|
reports: {
|
|
139
145
|
scope: "local" | "staging" | "prod";
|
|
@@ -196,7 +202,7 @@ export declare function workflowConfig(helpers: WorkflowOperationHelpers, input?
|
|
|
196
202
|
payload: {
|
|
197
203
|
mode: string;
|
|
198
204
|
scopes: ("local" | "staging" | "prod")[];
|
|
199
|
-
sync: "
|
|
205
|
+
sync: "none" | "cloudflare" | "railway" | "github" | "all";
|
|
200
206
|
keyPath: string;
|
|
201
207
|
repairs: import("../operations/services/config-runtime.ts").TreeseedRepairAction[];
|
|
202
208
|
preflight: {
|
|
@@ -455,9 +461,12 @@ export declare function workflowDestroy(helpers: WorkflowOperationHelpers, input
|
|
|
455
461
|
workerName: any;
|
|
456
462
|
siteUrl: any;
|
|
457
463
|
accountId: any;
|
|
464
|
+
pages: any;
|
|
458
465
|
formGuardKv: any;
|
|
459
466
|
sessionKv: any;
|
|
460
467
|
siteDataDb: any;
|
|
468
|
+
queue: any;
|
|
469
|
+
content: any;
|
|
461
470
|
};
|
|
462
471
|
operations: {
|
|
463
472
|
worker: {
|
|
@@ -9,4 +9,4 @@ export type TreeseedResolvedWorkflowPaths = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare function classifyTreeseedBranchRole(branchName: string | null, repoDir: string | null): TreeseedWorkflowBranchRole;
|
|
11
11
|
export declare function resolveTreeseedWorkflowPaths(startCwd: string): TreeseedResolvedWorkflowPaths;
|
|
12
|
-
export declare function workflowEnvironmentForBranchRole(branchRole: TreeseedWorkflowBranchRole): "local" | "
|
|
12
|
+
export declare function workflowEnvironmentForBranchRole(branchRole: TreeseedWorkflowBranchRole): "local" | "none" | "staging" | "prod";
|
package/dist/workflow-state.js
CHANGED
|
@@ -88,6 +88,7 @@ function resolveTreeseedWorkflowState(cwd) {
|
|
|
88
88
|
agents: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null },
|
|
89
89
|
manager: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null },
|
|
90
90
|
worker: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null },
|
|
91
|
+
runner: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null },
|
|
91
92
|
workdayStart: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null },
|
|
92
93
|
workdayReport: { enabled: false, initialized: false, lastDeploymentTimestamp: null, lastDeployedUrl: null, provider: null }
|
|
93
94
|
},
|
|
@@ -128,7 +129,7 @@ function resolveTreeseedWorkflowState(cwd) {
|
|
|
128
129
|
url: typeof latestHistory?.url === "string" ? latestHistory.url : deployState.lastDeployedUrl ?? null
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
|
-
for (const serviceKey of ["api", "agents", "manager", "worker", "workdayStart", "workdayReport"]) {
|
|
132
|
+
for (const serviceKey of ["api", "agents", "manager", "worker", "runner", "workdayStart", "workdayReport"]) {
|
|
132
133
|
const service = deployState.services?.[serviceKey];
|
|
133
134
|
if (!service) continue;
|
|
134
135
|
state.managedServices[serviceKey] = {
|