@treeseed/core 0.4.9 → 0.4.11
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 -2
- package/dist/agent.d.ts +0 -1
- package/dist/agent.js +0 -2
- package/dist/agents/spec-types.d.ts +10 -10
- package/dist/api/agent-routes.d.ts +2 -2
- package/dist/api/agent-routes.js +51 -125
- package/dist/api/app.js +56 -4
- package/dist/api/auth/d1-store.d.ts +1 -0
- package/dist/api/auth/d1-store.js +21 -1
- package/dist/api/auth/rbac.d.ts +2 -2
- package/dist/api/auth/rbac.js +2 -1
- package/dist/api/config.js +4 -0
- package/dist/api/http.d.ts +4 -0
- package/dist/api/http.js +7 -0
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +2 -2
- package/dist/api/operations-routes.d.ts +1 -0
- package/dist/api/operations-routes.js +6 -1
- package/dist/api/railway.d.ts +4 -0
- package/dist/api/sdk-dispatch.d.ts +2 -11
- package/dist/api/sdk-dispatch.js +1 -133
- package/dist/api/sdk-routes.d.ts +1 -0
- package/dist/api/sdk-routes.js +5 -1
- package/dist/api/types.d.ts +32 -16
- package/dist/components/site/RouteNotFound.astro +25 -0
- package/dist/content-config.d.ts +1 -0
- package/dist/content.d.ts +1 -0
- package/dist/content.js +177 -1
- package/dist/dev.d.ts +7 -2
- package/dist/dev.js +83 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -3
- package/dist/middleware/editorial-preview.d.ts +26 -0
- package/dist/middleware/editorial-preview.js +37 -0
- package/dist/middleware/starlightRouteData.js +15 -4
- package/dist/pages/[slug].astro +12 -10
- package/dist/pages/agents/[slug].astro +28 -21
- package/dist/pages/books/[slug].astro +19 -12
- package/dist/pages/feed.xml.js +6 -4
- package/dist/pages/index.astro +43 -14
- package/dist/pages/notes/[slug].astro +19 -12
- package/dist/pages/objectives/[slug].astro +30 -23
- package/dist/pages/people/[slug].astro +28 -21
- package/dist/pages/questions/[slug].astro +30 -23
- package/dist/scripts/build-dist.js +6 -1
- package/dist/scripts/dev-platform.js +9 -1
- package/dist/scripts/test-smoke.js +0 -1
- package/dist/services/agents.d.ts +22 -0
- package/dist/services/agents.js +29 -0
- package/dist/services/common.d.ts +37 -4
- package/dist/services/common.js +135 -17
- package/dist/services/index.d.ts +4 -1
- package/dist/services/index.js +14 -2
- package/dist/services/manager.d.ts +246 -3
- package/dist/services/manager.js +1101 -171
- package/dist/services/remote-runner.d.ts +30 -0
- package/dist/services/remote-runner.js +111 -0
- package/dist/services/workday-content.d.ts +53 -0
- package/dist/services/workday-content.js +190 -0
- package/dist/services/workday-report.d.ts +160 -2
- package/dist/services/workday-report.js +4 -31
- package/dist/services/workday-start.d.ts +174 -1
- package/dist/services/workday-start.js +3 -13
- package/dist/services/worker-pool-scaler.d.ts +27 -0
- package/dist/services/worker-pool-scaler.js +109 -0
- package/dist/services/worker.d.ts +7 -0
- package/dist/services/worker.js +41 -57
- package/dist/site.js +43 -27
- package/dist/templates.d.ts +98 -0
- package/dist/templates.js +170 -0
- package/dist/tenant/runtime-config.d.ts +4 -0
- package/dist/tenant/runtime-config.js +34 -1
- package/dist/utils/hub-content.js +35 -0
- package/dist/utils/published-content.js +60 -0
- package/dist/utils/site-models.d.ts +6 -0
- package/dist/utils/site-models.js +16 -0
- package/dist/utils/starlight-nav.js +50 -0
- package/package.json +23 -9
- package/templates/github/deploy.workflow.yml +404 -9
- package/templates/github/hosted-project.workflow.yml +77 -0
- package/dist/api/gateway.d.ts +0 -5
- package/dist/api/gateway.js +0 -35
|
@@ -1,4 +1,247 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { type ControlPlaneReporter, type PrioritySnapshot, type PrioritySnapshotItem, type ProjectEnvironmentName, type ScaleDecision, type WorkdayPolicy, type WorkdaySchedule, type WorkerPoolScaleResult, type WorkerPoolScaler } from '@treeseed/sdk';
|
|
3
|
+
import { createServiceSdk } from './common.ts';
|
|
4
|
+
import { type WorkerPoolScalerKind } from './worker-pool-scaler.ts';
|
|
5
|
+
type ManagerSdk = ReturnType<typeof createServiceSdk>;
|
|
6
|
+
type ManagerMode = 'reconcile' | 'open-workday' | 'close-workday' | 'report-workday' | 'loop';
|
|
7
|
+
type ManagerConfig = ReturnType<typeof resolveManagerServiceConfig>;
|
|
8
|
+
type TaskRecord = Record<string, unknown>;
|
|
9
|
+
export declare function resolveManagerServiceConfig(): {
|
|
10
|
+
mode: ManagerMode;
|
|
11
|
+
managerId: string;
|
|
12
|
+
marketBaseUrl: string;
|
|
13
|
+
runnerToken: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
teamId: string;
|
|
16
|
+
environment: ProjectEnvironmentName | "local";
|
|
17
|
+
poolName: string;
|
|
18
|
+
serviceBaseUrl: string;
|
|
19
|
+
pollIntervalMs: number;
|
|
20
|
+
dailyTaskCreditBudget: number;
|
|
21
|
+
maxQueuedTasks: number;
|
|
22
|
+
maxQueuedCredits: number;
|
|
23
|
+
priorityModels: string[];
|
|
24
|
+
priorityLimitPerModel: number;
|
|
25
|
+
graphInvalidated: boolean;
|
|
26
|
+
defaultSchedule: WorkdaySchedule;
|
|
27
|
+
scalerKind: WorkerPoolScalerKind;
|
|
28
|
+
creditWeights: import("@treeseed/sdk").TaskCreditWeight[];
|
|
29
|
+
autoscale: {
|
|
30
|
+
minWorkers: number;
|
|
31
|
+
maxWorkers: number;
|
|
32
|
+
targetQueueDepth: number;
|
|
33
|
+
cooldownSeconds: number;
|
|
34
|
+
};
|
|
35
|
+
host: string;
|
|
36
|
+
port: number;
|
|
37
|
+
defaultCapacityBudget: number;
|
|
38
|
+
};
|
|
39
|
+
export declare function runManagerAction(options?: {
|
|
40
|
+
mode?: ManagerMode;
|
|
41
|
+
sdk?: ManagerSdk;
|
|
42
|
+
config?: ManagerConfig;
|
|
43
|
+
reporter?: ControlPlaneReporter;
|
|
44
|
+
scaler?: WorkerPoolScaler;
|
|
45
|
+
now?: Date;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
ok: boolean;
|
|
48
|
+
mode: "reconcile";
|
|
49
|
+
managerId: string;
|
|
50
|
+
projectId: string;
|
|
51
|
+
environment: "local" | "prod" | "staging";
|
|
52
|
+
insideWorkWindow: boolean;
|
|
53
|
+
workPolicy: WorkdayPolicy;
|
|
54
|
+
workDay: Record<string, unknown>;
|
|
55
|
+
prioritySnapshot: PrioritySnapshot;
|
|
56
|
+
seededTasks: TaskRecord[];
|
|
57
|
+
queuedCount: number;
|
|
58
|
+
activeLeases: number;
|
|
59
|
+
desiredWorkers: number;
|
|
60
|
+
scaleResult: WorkerPoolScaleResult;
|
|
61
|
+
workdaySummary: Record<string, unknown>;
|
|
62
|
+
} | {
|
|
63
|
+
ok: boolean;
|
|
64
|
+
created: boolean;
|
|
65
|
+
workDay: Record<string, unknown>;
|
|
66
|
+
skipped?: undefined;
|
|
67
|
+
reason?: undefined;
|
|
68
|
+
prioritySnapshot?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
ok: boolean;
|
|
71
|
+
created: boolean;
|
|
72
|
+
skipped: boolean;
|
|
73
|
+
reason: string;
|
|
74
|
+
workDay?: undefined;
|
|
75
|
+
prioritySnapshot?: undefined;
|
|
76
|
+
} | {
|
|
77
|
+
ok: boolean;
|
|
78
|
+
created: boolean;
|
|
79
|
+
workDay: import("@treeseed/sdk").SdkWorkDayEntity;
|
|
80
|
+
prioritySnapshot: PrioritySnapshot;
|
|
81
|
+
skipped?: undefined;
|
|
82
|
+
reason?: undefined;
|
|
83
|
+
} | {
|
|
84
|
+
ok: boolean;
|
|
85
|
+
skipped: boolean;
|
|
86
|
+
reason: string;
|
|
87
|
+
workDay?: undefined;
|
|
88
|
+
summary?: undefined;
|
|
89
|
+
scale?: undefined;
|
|
90
|
+
} | {
|
|
91
|
+
ok: boolean;
|
|
92
|
+
workDay: import("@treeseed/sdk").SdkWorkDayEntity;
|
|
93
|
+
summary: {
|
|
94
|
+
contentSnapshot: {
|
|
95
|
+
relativePath: string;
|
|
96
|
+
slug: string;
|
|
97
|
+
reportVersion: string;
|
|
98
|
+
title: string;
|
|
99
|
+
};
|
|
100
|
+
projectId: string;
|
|
101
|
+
environment: "local" | "prod" | "staging";
|
|
102
|
+
workDayId: string;
|
|
103
|
+
state: string;
|
|
104
|
+
totalTasks: number;
|
|
105
|
+
completedTasks: number;
|
|
106
|
+
failedTasks: number;
|
|
107
|
+
queuedTasks: number;
|
|
108
|
+
activeTasks: number;
|
|
109
|
+
dailyTaskCreditBudget: number;
|
|
110
|
+
usedTaskCredits: number;
|
|
111
|
+
remainingTaskCredits: number;
|
|
112
|
+
creditLedgerEntries: number;
|
|
113
|
+
prioritySnapshotId: string;
|
|
114
|
+
priorityItemCount: number;
|
|
115
|
+
priorityItems: PrioritySnapshotItem[];
|
|
116
|
+
taskItems: {
|
|
117
|
+
id: string;
|
|
118
|
+
agentId: string;
|
|
119
|
+
type: string;
|
|
120
|
+
state: string;
|
|
121
|
+
priority: number;
|
|
122
|
+
idempotencyKey: string;
|
|
123
|
+
createdAt: string;
|
|
124
|
+
startedAt: string;
|
|
125
|
+
completedAt: string;
|
|
126
|
+
lastErrorCode: string;
|
|
127
|
+
lastErrorMessage: string;
|
|
128
|
+
lastEventKind: string;
|
|
129
|
+
outputCount: number;
|
|
130
|
+
changedFiles: string[];
|
|
131
|
+
}[];
|
|
132
|
+
changedFiles: string[];
|
|
133
|
+
releases: {
|
|
134
|
+
id: string;
|
|
135
|
+
deploymentKind: string;
|
|
136
|
+
status: string;
|
|
137
|
+
releaseTag: string;
|
|
138
|
+
commitSha: string;
|
|
139
|
+
sourceRef: string;
|
|
140
|
+
startedAt: string;
|
|
141
|
+
finishedAt: string;
|
|
142
|
+
createdAt: string;
|
|
143
|
+
}[];
|
|
144
|
+
scaleDecision: ScaleDecision;
|
|
145
|
+
scaleResult: WorkerPoolScaleResult;
|
|
146
|
+
generatedAt: string;
|
|
147
|
+
};
|
|
148
|
+
scale: WorkerPoolScaleResult;
|
|
149
|
+
skipped?: undefined;
|
|
150
|
+
reason?: undefined;
|
|
151
|
+
} | {
|
|
152
|
+
ok: boolean;
|
|
153
|
+
skipped: boolean;
|
|
154
|
+
reason: string;
|
|
155
|
+
workDayId?: undefined;
|
|
156
|
+
summary?: undefined;
|
|
157
|
+
} | {
|
|
158
|
+
ok: boolean;
|
|
159
|
+
workDayId: unknown;
|
|
160
|
+
summary: {
|
|
161
|
+
contentSnapshot: {
|
|
162
|
+
relativePath: string;
|
|
163
|
+
slug: string;
|
|
164
|
+
reportVersion: string;
|
|
165
|
+
title: string;
|
|
166
|
+
};
|
|
167
|
+
projectId: string;
|
|
168
|
+
environment: "local" | "prod" | "staging";
|
|
169
|
+
workDayId: string;
|
|
170
|
+
state: string;
|
|
171
|
+
totalTasks: number;
|
|
172
|
+
completedTasks: number;
|
|
173
|
+
failedTasks: number;
|
|
174
|
+
queuedTasks: number;
|
|
175
|
+
activeTasks: number;
|
|
176
|
+
dailyTaskCreditBudget: number;
|
|
177
|
+
usedTaskCredits: number;
|
|
178
|
+
remainingTaskCredits: number;
|
|
179
|
+
creditLedgerEntries: number;
|
|
180
|
+
prioritySnapshotId: string;
|
|
181
|
+
priorityItemCount: number;
|
|
182
|
+
priorityItems: PrioritySnapshotItem[];
|
|
183
|
+
taskItems: {
|
|
184
|
+
id: string;
|
|
185
|
+
agentId: string;
|
|
186
|
+
type: string;
|
|
187
|
+
state: string;
|
|
188
|
+
priority: number;
|
|
189
|
+
idempotencyKey: string;
|
|
190
|
+
createdAt: string;
|
|
191
|
+
startedAt: string;
|
|
192
|
+
completedAt: string;
|
|
193
|
+
lastErrorCode: string;
|
|
194
|
+
lastErrorMessage: string;
|
|
195
|
+
lastEventKind: string;
|
|
196
|
+
outputCount: number;
|
|
197
|
+
changedFiles: string[];
|
|
198
|
+
}[];
|
|
199
|
+
changedFiles: string[];
|
|
200
|
+
releases: {
|
|
201
|
+
id: string;
|
|
202
|
+
deploymentKind: string;
|
|
203
|
+
status: string;
|
|
204
|
+
releaseTag: string;
|
|
205
|
+
commitSha: string;
|
|
206
|
+
sourceRef: string;
|
|
207
|
+
startedAt: string;
|
|
208
|
+
finishedAt: string;
|
|
209
|
+
createdAt: string;
|
|
210
|
+
}[];
|
|
211
|
+
scaleDecision: ScaleDecision;
|
|
212
|
+
scaleResult: WorkerPoolScaleResult;
|
|
213
|
+
generatedAt: string;
|
|
214
|
+
};
|
|
215
|
+
skipped?: undefined;
|
|
216
|
+
reason?: undefined;
|
|
217
|
+
}>;
|
|
218
|
+
export declare function runManagerCycle(options?: {
|
|
219
|
+
sdk?: ManagerSdk;
|
|
220
|
+
config?: ManagerConfig;
|
|
221
|
+
reporter?: ControlPlaneReporter;
|
|
222
|
+
scaler?: WorkerPoolScaler;
|
|
223
|
+
now?: Date;
|
|
224
|
+
}): Promise<{
|
|
225
|
+
ok: boolean;
|
|
226
|
+
mode: "reconcile";
|
|
227
|
+
managerId: string;
|
|
228
|
+
projectId: string;
|
|
229
|
+
environment: "local" | "prod" | "staging";
|
|
230
|
+
insideWorkWindow: boolean;
|
|
231
|
+
workPolicy: WorkdayPolicy;
|
|
232
|
+
workDay: Record<string, unknown>;
|
|
233
|
+
prioritySnapshot: PrioritySnapshot;
|
|
234
|
+
seededTasks: TaskRecord[];
|
|
235
|
+
queuedCount: number;
|
|
236
|
+
activeLeases: number;
|
|
237
|
+
desiredWorkers: number;
|
|
238
|
+
scaleResult: WorkerPoolScaleResult;
|
|
239
|
+
workdaySummary: Record<string, unknown>;
|
|
240
|
+
}>;
|
|
241
|
+
export declare function startManagerLoop(options?: {
|
|
242
|
+
sdk?: ManagerSdk;
|
|
243
|
+
config?: ManagerConfig;
|
|
244
|
+
reporter?: ControlPlaneReporter;
|
|
245
|
+
scaler?: WorkerPoolScaler;
|
|
246
|
+
}): Promise<void>;
|
|
247
|
+
export {};
|