@treeseed/sdk 0.8.8 → 0.8.9
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/control-plane-client.d.ts +1 -1
- package/dist/d1-store.d.ts +5 -5
- package/dist/d1-store.js +24 -24
- package/dist/db/d1.d.ts +102 -0
- package/dist/db/node-sqlite.d.ts +102 -0
- package/dist/db/schema.d.ts +204 -0
- package/dist/db/schema.js +9 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +22 -22
- package/dist/operations/services/d1-migration.js +10 -2
- package/dist/operations/services/github-automation.js +1 -1
- package/dist/operations/services/hosting-audit.d.ts +2 -1
- package/dist/operations/services/hosting-audit.js +18 -15
- package/dist/operations/services/hub-provider-launch.d.ts +3 -3
- package/dist/operations/services/hub-provider-launch.js +16 -16
- package/dist/operations/services/{knowledge-coop-packaging.d.ts → market-packaging.d.ts} +13 -13
- package/dist/operations/services/{knowledge-coop-packaging.js → market-packaging.js} +10 -10
- package/dist/operations/services/project-platform.d.ts +32 -0
- package/dist/operations/services/project-platform.js +91 -1
- package/dist/platform/contracts.d.ts +53 -31
- package/dist/platform/utils/site-config-schema.js +120 -52
- package/dist/{knowledge-coop.d.ts → project-workflow.d.ts} +15 -15
- package/dist/{knowledge-coop.js → project-workflow.js} +15 -15
- package/dist/scripts/tenant-d1-migrate-local.js +1 -0
- package/dist/sdk.d.ts +1 -1
- package/dist/stores/{knowledge-coop-store.d.ts → project-workflow-store.d.ts} +3 -3
- package/dist/stores/{knowledge-coop-store.js → project-workflow-store.js} +4 -4
- package/dist/workflow/operations.js +6 -6
- package/dist/workflow-state.js +2 -2
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { createPublishedContentPipeline } from "../../platform/published-content
|
|
|
15
15
|
import { collectTreeseedReconcileStatus, reconcileTreeseedTarget, resolveTreeseedBootstrapSelection } from "../../reconcile/index.js";
|
|
16
16
|
import { loadTreeseedManifest } from "../../platform/tenant-config.js";
|
|
17
17
|
import { applyTreeseedEnvironmentToProcess, assertTreeseedCommandEnvironment } from "./config-runtime.js";
|
|
18
|
+
import { runTreeseedHostingAudit } from "./hosting-audit.js";
|
|
18
19
|
import {
|
|
19
20
|
assertDeploymentInitialized,
|
|
20
21
|
createPersistentDeployTarget,
|
|
@@ -366,6 +367,92 @@ function statSafe(filePath) {
|
|
|
366
367
|
async function reportDeployment(reporter, input) {
|
|
367
368
|
await reporter.reportDeployment(input);
|
|
368
369
|
}
|
|
370
|
+
function summarizePostDeployHostingAudit(report, phase) {
|
|
371
|
+
const failedChecks = report.checks.filter((check) => check.status === "failed").length;
|
|
372
|
+
const repairedChecks = report.checks.filter((check) => check.status === "repaired").length;
|
|
373
|
+
return {
|
|
374
|
+
ok: report.ok,
|
|
375
|
+
phase,
|
|
376
|
+
environment: report.environment,
|
|
377
|
+
repairMode: report.repairMode,
|
|
378
|
+
repaired: report.repaired || repairedChecks > 0,
|
|
379
|
+
repairedChecks,
|
|
380
|
+
failedChecks,
|
|
381
|
+
blockers: report.blockers,
|
|
382
|
+
warnings: report.warnings,
|
|
383
|
+
checkedAt: report.checkedAt
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function hostingAuditHostKindsForSystems(systems) {
|
|
387
|
+
const hostKinds = /* @__PURE__ */ new Set();
|
|
388
|
+
for (const system of systems) {
|
|
389
|
+
if (system === "github") {
|
|
390
|
+
hostKinds.add("repository");
|
|
391
|
+
} else if (system === "data" || system === "web") {
|
|
392
|
+
hostKinds.add("web");
|
|
393
|
+
} else if (system === "api" || system === "agents") {
|
|
394
|
+
hostKinds.add("processing");
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
return [...hostKinds];
|
|
398
|
+
}
|
|
399
|
+
async function repairHostingAfterSuccessfulDeploy(options, systems) {
|
|
400
|
+
if (options.scope === "local") {
|
|
401
|
+
return {
|
|
402
|
+
ok: true,
|
|
403
|
+
skipped: true,
|
|
404
|
+
reason: "local_environment"
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
if (options.dryRun) {
|
|
408
|
+
return {
|
|
409
|
+
ok: true,
|
|
410
|
+
skipped: true,
|
|
411
|
+
reason: "dry_run"
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
if (process.env.TREESEED_POST_DEPLOY_HOSTING_REPAIR === "off") {
|
|
415
|
+
return {
|
|
416
|
+
ok: true,
|
|
417
|
+
skipped: true,
|
|
418
|
+
reason: "disabled"
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
const hostKinds = hostingAuditHostKindsForSystems(systems);
|
|
422
|
+
if (hostKinds.length === 0) {
|
|
423
|
+
return {
|
|
424
|
+
ok: true,
|
|
425
|
+
skipped: true,
|
|
426
|
+
reason: "no_host_kinds"
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
const environment = options.scope === "prod" ? "prod" : "staging";
|
|
430
|
+
const env = { ...process.env, ...options.env ?? {} };
|
|
431
|
+
const audit = await runTreeseedHostingAudit({
|
|
432
|
+
tenantRoot: options.tenantRoot,
|
|
433
|
+
environment,
|
|
434
|
+
repair: false,
|
|
435
|
+
env,
|
|
436
|
+
hostKinds: [...hostKinds]
|
|
437
|
+
});
|
|
438
|
+
if (audit.ok) {
|
|
439
|
+
return summarizePostDeployHostingAudit(audit, "already_ready");
|
|
440
|
+
}
|
|
441
|
+
options.write?.(`[${environment}][hosting][repair] Hosting readiness needs repair after deploy for ${hostKinds.join(", ")}.`);
|
|
442
|
+
const repaired = await runTreeseedHostingAudit({
|
|
443
|
+
tenantRoot: options.tenantRoot,
|
|
444
|
+
environment,
|
|
445
|
+
repair: true,
|
|
446
|
+
env,
|
|
447
|
+
hostKinds: [...hostKinds],
|
|
448
|
+
write: (line) => options.write?.(`[${environment}][hosting][repair] ${line}`)
|
|
449
|
+
});
|
|
450
|
+
const summary = summarizePostDeployHostingAudit(repaired, "repaired");
|
|
451
|
+
if (!summary.ok) {
|
|
452
|
+
throw new Error(`Post-deploy hosting repair failed: ${summary.blockers[0] ?? `${summary.failedChecks} failed hosting readiness checks remain.`}`);
|
|
453
|
+
}
|
|
454
|
+
return summary;
|
|
455
|
+
}
|
|
369
456
|
function resolveReporter(tenantRoot, explicit) {
|
|
370
457
|
if (explicit) {
|
|
371
458
|
return explicit;
|
|
@@ -1191,6 +1278,7 @@ async function deployProjectPlatform(options) {
|
|
|
1191
1278
|
});
|
|
1192
1279
|
}
|
|
1193
1280
|
const monitor = await monitorProjectPlatform({ ...options, reporter, bootstrapSystems });
|
|
1281
|
+
const hostingRepair = await repairHostingAfterSuccessfulDeploy(options, bootstrapSystems);
|
|
1194
1282
|
await reportDeployment(reporter, {
|
|
1195
1283
|
environment: options.scope,
|
|
1196
1284
|
deploymentKind: "code",
|
|
@@ -1201,7 +1289,8 @@ async function deployProjectPlatform(options) {
|
|
|
1201
1289
|
metadata: {
|
|
1202
1290
|
scope: options.scope,
|
|
1203
1291
|
railway: options.scope === "local" ? [] : configuredRailwayServices(options.tenantRoot, options.scope).map((service) => service.key).filter((serviceKey) => serviceKey === "api" ? selectedSystems.has("api") : selectedSystems.has("agents")),
|
|
1204
|
-
monitor
|
|
1292
|
+
monitor,
|
|
1293
|
+
hostingRepair
|
|
1205
1294
|
},
|
|
1206
1295
|
finishedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1207
1296
|
});
|
|
@@ -1209,6 +1298,7 @@ async function deployProjectPlatform(options) {
|
|
|
1209
1298
|
ok: true,
|
|
1210
1299
|
scope: options.scope,
|
|
1211
1300
|
monitor,
|
|
1301
|
+
hostingRepair,
|
|
1212
1302
|
serviceResults
|
|
1213
1303
|
};
|
|
1214
1304
|
}
|
|
@@ -64,38 +64,60 @@ export interface TreeseedBookDefinition {
|
|
|
64
64
|
tags?: string[];
|
|
65
65
|
id?: string;
|
|
66
66
|
}
|
|
67
|
+
export type TreeseedThemeMode = 'light' | 'dark' | 'system';
|
|
68
|
+
export type TreeseedColorSchemeId = 'fern' | 'lichen' | 'cedar' | 'tidepool' | (string & {});
|
|
69
|
+
export interface TreeseedSemanticColorTokens {
|
|
70
|
+
canvas: string;
|
|
71
|
+
canvasSubtle: string;
|
|
72
|
+
surface: string;
|
|
73
|
+
surfaceMuted: string;
|
|
74
|
+
surfaceRaised: string;
|
|
75
|
+
surfaceOverlay: string;
|
|
76
|
+
text: string;
|
|
77
|
+
textMuted: string;
|
|
78
|
+
textSubtle: string;
|
|
79
|
+
textInverse: string;
|
|
80
|
+
link: string;
|
|
81
|
+
linkHover: string;
|
|
82
|
+
border: string;
|
|
83
|
+
borderMuted: string;
|
|
84
|
+
borderStrong: string;
|
|
85
|
+
focus: string;
|
|
86
|
+
accent: string;
|
|
87
|
+
accentHover: string;
|
|
88
|
+
accentStrong: string;
|
|
89
|
+
accentSoft: string;
|
|
90
|
+
accentText: string;
|
|
91
|
+
info: string;
|
|
92
|
+
infoSoft: string;
|
|
93
|
+
infoText: string;
|
|
94
|
+
infoBorder: string;
|
|
95
|
+
success: string;
|
|
96
|
+
successSoft: string;
|
|
97
|
+
successText: string;
|
|
98
|
+
successBorder: string;
|
|
99
|
+
warning: string;
|
|
100
|
+
warningSoft: string;
|
|
101
|
+
warningText: string;
|
|
102
|
+
warningBorder: string;
|
|
103
|
+
danger: string;
|
|
104
|
+
dangerSoft: string;
|
|
105
|
+
dangerText: string;
|
|
106
|
+
dangerBorder: string;
|
|
107
|
+
shadow: string;
|
|
108
|
+
grid: string;
|
|
109
|
+
}
|
|
110
|
+
export interface TreeseedSchemeTokens {
|
|
111
|
+
light: TreeseedSemanticColorTokens;
|
|
112
|
+
dark: TreeseedSemanticColorTokens;
|
|
113
|
+
}
|
|
67
114
|
export interface TreeseedThemeConfig {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
};
|
|
75
|
-
text?: {
|
|
76
|
-
body?: string;
|
|
77
|
-
muted?: string;
|
|
78
|
-
soft?: string;
|
|
79
|
-
};
|
|
80
|
-
border?: {
|
|
81
|
-
base?: string;
|
|
82
|
-
strong?: string;
|
|
83
|
-
grid?: string;
|
|
84
|
-
};
|
|
85
|
-
accent?: {
|
|
86
|
-
base?: string;
|
|
87
|
-
strong?: string;
|
|
88
|
-
soft?: string;
|
|
89
|
-
};
|
|
90
|
-
info?: {
|
|
91
|
-
base?: string;
|
|
92
|
-
strong?: string;
|
|
93
|
-
soft?: string;
|
|
94
|
-
};
|
|
95
|
-
warm?: {
|
|
96
|
-
base?: string;
|
|
97
|
-
strong?: string;
|
|
98
|
-
};
|
|
115
|
+
defaultScheme?: TreeseedColorSchemeId;
|
|
116
|
+
defaultMode?: TreeseedThemeMode;
|
|
117
|
+
schemes?: Record<TreeseedColorSchemeId, Partial<{
|
|
118
|
+
light: Partial<TreeseedSemanticColorTokens>;
|
|
119
|
+
dark: Partial<TreeseedSemanticColorTokens>;
|
|
120
|
+
}>>;
|
|
99
121
|
}
|
|
100
122
|
export interface TreeseedPluginReference {
|
|
101
123
|
package: string;
|
|
@@ -51,6 +51,19 @@ function optionalRecord(value, path) {
|
|
|
51
51
|
return expectRecord(value, path);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
function optionalEnum(value, path, allowed) {
|
|
55
|
+
if (value === undefined || value === null || value === '') {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const parsedValue = expectString(value, path);
|
|
60
|
+
if (!allowed.includes(parsedValue)) {
|
|
61
|
+
throw new Error(`Expected ${path} to be one of: ${allowed.join(', ')}.`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return parsedValue;
|
|
65
|
+
}
|
|
66
|
+
|
|
54
67
|
function stringArray(value, path) {
|
|
55
68
|
if (value === undefined || value === null) {
|
|
56
69
|
return [];
|
|
@@ -103,66 +116,121 @@ function parseContactRouting(value, path) {
|
|
|
103
116
|
);
|
|
104
117
|
}
|
|
105
118
|
|
|
119
|
+
const BUILT_IN_THEME_SCHEMES = new Set(['fern', 'lichen', 'cedar', 'tidepool']);
|
|
120
|
+
const THEME_TOKEN_NAMES = new Set([
|
|
121
|
+
'canvas',
|
|
122
|
+
'canvasSubtle',
|
|
123
|
+
'surface',
|
|
124
|
+
'surfaceMuted',
|
|
125
|
+
'surfaceRaised',
|
|
126
|
+
'surfaceOverlay',
|
|
127
|
+
'text',
|
|
128
|
+
'textMuted',
|
|
129
|
+
'textSubtle',
|
|
130
|
+
'textInverse',
|
|
131
|
+
'link',
|
|
132
|
+
'linkHover',
|
|
133
|
+
'border',
|
|
134
|
+
'borderMuted',
|
|
135
|
+
'borderStrong',
|
|
136
|
+
'focus',
|
|
137
|
+
'accent',
|
|
138
|
+
'accentHover',
|
|
139
|
+
'accentStrong',
|
|
140
|
+
'accentSoft',
|
|
141
|
+
'accentText',
|
|
142
|
+
'info',
|
|
143
|
+
'infoSoft',
|
|
144
|
+
'infoText',
|
|
145
|
+
'infoBorder',
|
|
146
|
+
'success',
|
|
147
|
+
'successSoft',
|
|
148
|
+
'successText',
|
|
149
|
+
'successBorder',
|
|
150
|
+
'warning',
|
|
151
|
+
'warningSoft',
|
|
152
|
+
'warningText',
|
|
153
|
+
'warningBorder',
|
|
154
|
+
'danger',
|
|
155
|
+
'dangerSoft',
|
|
156
|
+
'dangerText',
|
|
157
|
+
'dangerBorder',
|
|
158
|
+
'shadow',
|
|
159
|
+
'grid',
|
|
160
|
+
]);
|
|
161
|
+
|
|
162
|
+
function parseThemeSchemeId(value, path) {
|
|
163
|
+
const schemeId = expectString(value, path);
|
|
164
|
+
if (!/^[a-z][a-z0-9-]*$/u.test(schemeId)) {
|
|
165
|
+
throw new Error(`Expected ${path} to be a stable lowercase slug.`);
|
|
166
|
+
}
|
|
167
|
+
return schemeId;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function parseThemeTokenOverrides(value, path) {
|
|
171
|
+
const record = optionalRecord(value, path);
|
|
172
|
+
if (!record) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return Object.fromEntries(
|
|
177
|
+
Object.entries(record).map(([tokenName, tokenValue]) => {
|
|
178
|
+
if (!THEME_TOKEN_NAMES.has(tokenName)) {
|
|
179
|
+
throw new Error(`Unknown theme token ${path}.${tokenName}.`);
|
|
180
|
+
}
|
|
181
|
+
return [tokenName, expectString(tokenValue, `${path}.${tokenName}`)];
|
|
182
|
+
}),
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function parseThemeScheme(value, path) {
|
|
187
|
+
const scheme = expectRecord(value, path);
|
|
188
|
+
const allowedKeys = new Set(['light', 'dark']);
|
|
189
|
+
for (const key of Object.keys(scheme)) {
|
|
190
|
+
if (!allowedKeys.has(key)) {
|
|
191
|
+
throw new Error(`Unknown theme scheme key ${path}.${key}.`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
light: parseThemeTokenOverrides(scheme.light, `${path}.light`),
|
|
196
|
+
dark: parseThemeTokenOverrides(scheme.dark, `${path}.dark`),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
106
200
|
function parseTheme(value, path) {
|
|
107
201
|
const theme = optionalRecord(value, path);
|
|
108
202
|
if (!theme) {
|
|
109
203
|
return undefined;
|
|
110
204
|
}
|
|
111
205
|
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
206
|
+
const allowedKeys = new Set(['defaultScheme', 'defaultMode', 'schemes']);
|
|
207
|
+
for (const key of Object.keys(theme)) {
|
|
208
|
+
if (!allowedKeys.has(key)) {
|
|
209
|
+
throw new Error(`Unknown theme key ${path}.${key}.`);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const schemes = optionalRecord(theme.schemes, `${path}.schemes`);
|
|
214
|
+
const parsedSchemes = schemes
|
|
215
|
+
? Object.fromEntries(
|
|
216
|
+
Object.entries(schemes).map(([schemeId, scheme]) => [
|
|
217
|
+
parseThemeSchemeId(schemeId, `${path}.schemes.${schemeId}`),
|
|
218
|
+
parseThemeScheme(scheme, `${path}.schemes.${schemeId}`),
|
|
219
|
+
]),
|
|
220
|
+
)
|
|
221
|
+
: undefined;
|
|
222
|
+
const defaultScheme = optionalString(theme.defaultScheme, `${path}.defaultScheme`);
|
|
223
|
+
if (defaultScheme) {
|
|
224
|
+
parseThemeSchemeId(defaultScheme, `${path}.defaultScheme`);
|
|
225
|
+
if (!BUILT_IN_THEME_SCHEMES.has(defaultScheme) && !(parsedSchemes && defaultScheme in parsedSchemes)) {
|
|
226
|
+
throw new Error(`Expected ${path}.defaultScheme to reference a built-in or configured scheme.`);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
118
229
|
|
|
119
230
|
return {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
backgroundElevated: optionalString(
|
|
124
|
-
surfaces.backgroundElevated,
|
|
125
|
-
`${path}.surfaces.backgroundElevated`,
|
|
126
|
-
),
|
|
127
|
-
backgroundSoft: optionalString(surfaces.backgroundSoft, `${path}.surfaces.backgroundSoft`),
|
|
128
|
-
panel: optionalString(surfaces.panel, `${path}.surfaces.panel`),
|
|
129
|
-
panelStrong: optionalString(surfaces.panelStrong, `${path}.surfaces.panelStrong`),
|
|
130
|
-
}
|
|
131
|
-
: undefined,
|
|
132
|
-
text: text
|
|
133
|
-
? {
|
|
134
|
-
body: optionalString(text.body, `${path}.text.body`),
|
|
135
|
-
muted: optionalString(text.muted, `${path}.text.muted`),
|
|
136
|
-
soft: optionalString(text.soft, `${path}.text.soft`),
|
|
137
|
-
}
|
|
138
|
-
: undefined,
|
|
139
|
-
border: border
|
|
140
|
-
? {
|
|
141
|
-
base: optionalString(border.base, `${path}.border.base`),
|
|
142
|
-
strong: optionalString(border.strong, `${path}.border.strong`),
|
|
143
|
-
grid: optionalString(border.grid, `${path}.border.grid`),
|
|
144
|
-
}
|
|
145
|
-
: undefined,
|
|
146
|
-
accent: accent
|
|
147
|
-
? {
|
|
148
|
-
base: optionalString(accent.base, `${path}.accent.base`),
|
|
149
|
-
strong: optionalString(accent.strong, `${path}.accent.strong`),
|
|
150
|
-
soft: optionalString(accent.soft, `${path}.accent.soft`),
|
|
151
|
-
}
|
|
152
|
-
: undefined,
|
|
153
|
-
info: info
|
|
154
|
-
? {
|
|
155
|
-
base: optionalString(info.base, `${path}.info.base`),
|
|
156
|
-
strong: optionalString(info.strong, `${path}.info.strong`),
|
|
157
|
-
soft: optionalString(info.soft, `${path}.info.soft`),
|
|
158
|
-
}
|
|
159
|
-
: undefined,
|
|
160
|
-
warm: warm
|
|
161
|
-
? {
|
|
162
|
-
base: optionalString(warm.base, `${path}.warm.base`),
|
|
163
|
-
strong: optionalString(warm.strong, `${path}.warm.strong`),
|
|
164
|
-
}
|
|
165
|
-
: undefined,
|
|
231
|
+
defaultScheme,
|
|
232
|
+
defaultMode: optionalEnum(theme.defaultMode, `${path}.defaultMode`, ['light', 'dark', 'system']),
|
|
233
|
+
schemes: parsedSchemes,
|
|
166
234
|
};
|
|
167
235
|
}
|
|
168
236
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { ProjectConnection, RemoteJobStatus } from './sdk-types.ts';
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export type TeamCapability = (typeof
|
|
9
|
-
export type
|
|
10
|
-
export type WorkstreamState = (typeof
|
|
11
|
-
export type ReleaseState = (typeof
|
|
12
|
-
export type SharePackageState = (typeof
|
|
13
|
-
export type AgentMessageKind = (typeof
|
|
2
|
+
export declare const PROJECT_TEAM_CAPABILITIES: readonly ["launch_projects", "edit_direct", "manage_workstreams", "stage_releases", "publish_releases", "publish_market_listings", "manage_products", "manage_billing", "approve_remote_execution"];
|
|
3
|
+
export declare const PROJECT_JOB_STATUSES: readonly ["queued", "running", "waiting_for_approval", "failed", "completed", "rolled_back", "cancelled"];
|
|
4
|
+
export declare const WORKSTREAM_STATES: readonly ["drafting", "active_local", "verifying", "saved_remote", "in_staging", "archived"];
|
|
5
|
+
export declare const RELEASE_STATES: readonly ["drafting", "waiting_on_verification", "ready_to_publish", "published", "rolled_back"];
|
|
6
|
+
export declare const SHARE_PACKAGE_STATES: readonly ["draft", "packaged", "ready_to_publish", "published", "archived", "failed"];
|
|
7
|
+
export declare const AGENT_MESSAGE_KINDS: readonly ["informational", "warning", "action_requested", "release_readiness"];
|
|
8
|
+
export type TeamCapability = (typeof PROJECT_TEAM_CAPABILITIES)[number];
|
|
9
|
+
export type ProjectJobStatus = (typeof PROJECT_JOB_STATUSES)[number];
|
|
10
|
+
export type WorkstreamState = (typeof WORKSTREAM_STATES)[number];
|
|
11
|
+
export type ReleaseState = (typeof RELEASE_STATES)[number];
|
|
12
|
+
export type SharePackageState = (typeof SHARE_PACKAGE_STATES)[number];
|
|
13
|
+
export type AgentMessageKind = (typeof AGENT_MESSAGE_KINDS)[number];
|
|
14
14
|
export interface LinkedProjectRecordRef {
|
|
15
15
|
model: 'objective' | 'question' | 'note' | 'proposal' | 'decision';
|
|
16
16
|
id: string;
|
|
@@ -185,7 +185,7 @@ export interface InboxItem {
|
|
|
185
185
|
teamId: string;
|
|
186
186
|
projectId: string | null;
|
|
187
187
|
kind: string;
|
|
188
|
-
state:
|
|
188
|
+
state: ProjectJobStatus | string;
|
|
189
189
|
title: string;
|
|
190
190
|
summary: string | null;
|
|
191
191
|
href: string | null;
|
|
@@ -226,5 +226,5 @@ export interface LaunchProjectResult {
|
|
|
226
226
|
launchJobId: string | null;
|
|
227
227
|
overview: ProjectOverviewSummary | null;
|
|
228
228
|
}
|
|
229
|
-
export declare function
|
|
230
|
-
export declare function normalizeRemoteJobStatus(status: RemoteJobStatus):
|
|
229
|
+
export declare function normalizeProjectJobStatus(status: string | null | undefined): ProjectJobStatus;
|
|
230
|
+
export declare function normalizeRemoteJobStatus(status: RemoteJobStatus): ProjectJobStatus;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const PROJECT_TEAM_CAPABILITIES = [
|
|
2
2
|
"launch_projects",
|
|
3
3
|
"edit_direct",
|
|
4
4
|
"manage_workstreams",
|
|
@@ -9,7 +9,7 @@ const KNOWLEDGE_COOP_TEAM_CAPABILITIES = [
|
|
|
9
9
|
"manage_billing",
|
|
10
10
|
"approve_remote_execution"
|
|
11
11
|
];
|
|
12
|
-
const
|
|
12
|
+
const PROJECT_JOB_STATUSES = [
|
|
13
13
|
"queued",
|
|
14
14
|
"running",
|
|
15
15
|
"waiting_for_approval",
|
|
@@ -18,7 +18,7 @@ const KNOWLEDGE_COOP_JOB_STATUSES = [
|
|
|
18
18
|
"rolled_back",
|
|
19
19
|
"cancelled"
|
|
20
20
|
];
|
|
21
|
-
const
|
|
21
|
+
const WORKSTREAM_STATES = [
|
|
22
22
|
"drafting",
|
|
23
23
|
"active_local",
|
|
24
24
|
"verifying",
|
|
@@ -26,14 +26,14 @@ const KNOWLEDGE_COOP_WORKSTREAM_STATES = [
|
|
|
26
26
|
"in_staging",
|
|
27
27
|
"archived"
|
|
28
28
|
];
|
|
29
|
-
const
|
|
29
|
+
const RELEASE_STATES = [
|
|
30
30
|
"drafting",
|
|
31
31
|
"waiting_on_verification",
|
|
32
32
|
"ready_to_publish",
|
|
33
33
|
"published",
|
|
34
34
|
"rolled_back"
|
|
35
35
|
];
|
|
36
|
-
const
|
|
36
|
+
const SHARE_PACKAGE_STATES = [
|
|
37
37
|
"draft",
|
|
38
38
|
"packaged",
|
|
39
39
|
"ready_to_publish",
|
|
@@ -41,13 +41,13 @@ const KNOWLEDGE_COOP_SHARE_PACKAGE_STATES = [
|
|
|
41
41
|
"archived",
|
|
42
42
|
"failed"
|
|
43
43
|
];
|
|
44
|
-
const
|
|
44
|
+
const AGENT_MESSAGE_KINDS = [
|
|
45
45
|
"informational",
|
|
46
46
|
"warning",
|
|
47
47
|
"action_requested",
|
|
48
48
|
"release_readiness"
|
|
49
49
|
];
|
|
50
|
-
function
|
|
50
|
+
function normalizeProjectJobStatus(status) {
|
|
51
51
|
switch (String(status ?? "").trim()) {
|
|
52
52
|
case "running":
|
|
53
53
|
return "running";
|
|
@@ -68,15 +68,15 @@ function normalizeKnowledgeCoopJobStatus(status) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
function normalizeRemoteJobStatus(status) {
|
|
71
|
-
return
|
|
71
|
+
return normalizeProjectJobStatus(status);
|
|
72
72
|
}
|
|
73
73
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
74
|
+
AGENT_MESSAGE_KINDS,
|
|
75
|
+
PROJECT_JOB_STATUSES,
|
|
76
|
+
PROJECT_TEAM_CAPABILITIES,
|
|
77
|
+
RELEASE_STATES,
|
|
78
|
+
SHARE_PACKAGE_STATES,
|
|
79
|
+
WORKSTREAM_STATES,
|
|
80
|
+
normalizeProjectJobStatus,
|
|
81
81
|
normalizeRemoteJobStatus
|
|
82
82
|
};
|
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 { ReleaseDetail, ReleaseSummary, SharePackageStatus, WorkstreamDetail, WorkstreamEvent, WorkstreamSummary } from './
|
|
5
|
+
import type { ReleaseDetail, ReleaseSummary, SharePackageStatus, WorkstreamDetail, WorkstreamEvent, WorkstreamSummary } from './project-workflow.ts';
|
|
6
6
|
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, SdkClaimWorkdayManagerLeaseRequest, SdkCreateWorkdayRequest, SdkRecordRepositoryClaimRequest, SdkRecordRunnerScaleDecisionRequest, SdkRecordWorkerRunnerRequest, SdkRecordRunRequest, SdkRecordScaleDecisionRequest, SdkRecordTaskCreditsRequest, SdkReleaseWorkdayManagerLeaseRequest, SdkSearchRequest, SdkStartWorkDayRequest, SdkTaskProgressRequest, SdkTaskSearchRequest, SdkUpsertWorkPolicyRequest, SdkUpdateWorkDayGraphRequest, SdkUpdateRequest, SdkModelDefinition, SdkModelRegistry, SdkGraphRankingProvider, SdkDispatchConfig, SdkDispatchRequest, SdkDispatchResult, PrioritySnapshot, RepositoryClaim, RunnerScaleDecision, ScaleDecision, TaskCreditLedgerEntry, WorkdayManagerLease, WorkdayPolicy, WorkdayRequest, WorkerRunner } from './sdk-types.ts';
|
|
7
7
|
export interface AgentSdkOptions {
|
|
8
8
|
repoRoot?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ReleaseDetail, ReleaseSummary, SharePackageStatus, WorkstreamDetail, WorkstreamEvent, WorkstreamState, WorkstreamSummary, LinkedProjectRecordRef } from '../
|
|
1
|
+
import type { ReleaseDetail, ReleaseSummary, SharePackageStatus, WorkstreamDetail, WorkstreamEvent, WorkstreamState, WorkstreamSummary, LinkedProjectRecordRef } from '../project-workflow.ts';
|
|
2
2
|
import { SqliteStoreBase } from './helpers.ts';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class MemoryProjectWorkflowStore {
|
|
4
4
|
private readonly workstreams;
|
|
5
5
|
private readonly workstreamEvents;
|
|
6
6
|
private readonly releases;
|
|
@@ -19,7 +19,7 @@ export declare class MemoryKnowledgeCoopStore {
|
|
|
19
19
|
getSharePackage(packageId: string): SharePackageStatus | null;
|
|
20
20
|
upsertSharePackage(input: Partial<SharePackageStatus> & Pick<SharePackageStatus, 'projectId' | 'kind' | 'title'>): SharePackageStatus;
|
|
21
21
|
}
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class SqliteProjectWorkflowStore extends SqliteStoreBase {
|
|
23
23
|
private initialized;
|
|
24
24
|
private ensureSchema;
|
|
25
25
|
listWorkstreams(projectId: string): Promise<WorkstreamSummary[]>;
|
|
@@ -85,7 +85,7 @@ function sharePackageFromRow(row) {
|
|
|
85
85
|
metadata: parseJson(row.metadata_json, {})
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
class
|
|
88
|
+
class MemoryProjectWorkflowStore {
|
|
89
89
|
workstreams = /* @__PURE__ */ new Map();
|
|
90
90
|
workstreamEvents = /* @__PURE__ */ new Map();
|
|
91
91
|
releases = /* @__PURE__ */ new Map();
|
|
@@ -211,7 +211,7 @@ class MemoryKnowledgeCoopStore {
|
|
|
211
211
|
return next;
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
class
|
|
214
|
+
class SqliteProjectWorkflowStore extends SqliteStoreBase {
|
|
215
215
|
initialized = false;
|
|
216
216
|
async ensureSchema() {
|
|
217
217
|
if (this.initialized) return;
|
|
@@ -477,6 +477,6 @@ class SqliteKnowledgeCoopStore extends SqliteStoreBase {
|
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
479
|
export {
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
MemoryProjectWorkflowStore,
|
|
481
|
+
SqliteProjectWorkflowStore
|
|
482
482
|
};
|
|
@@ -973,14 +973,14 @@ async function connectTreeseedMarketProject(helpers, tenantRoot, input, context)
|
|
|
973
973
|
"Treeseed config --connect-market requires a market base URL. Pass --market-base-url or configure an authenticated remote host first."
|
|
974
974
|
);
|
|
975
975
|
}
|
|
976
|
-
const hostId = normalizeOptionalString(marketSettings.hostId) ?? "
|
|
976
|
+
const hostId = normalizeOptionalString(marketSettings.hostId) ?? "treeseed-market";
|
|
977
977
|
const activeRemoteSession = resolveTreeseedRemoteSession(tenantRoot, hostId) ?? resolveTreeseedRemoteSession(tenantRoot, remoteSettings.activeHostId) ?? resolveTreeseedRemoteSession(tenantRoot, "official");
|
|
978
978
|
const accessToken = normalizeOptionalString(input.marketAccessToken) ?? normalizeOptionalString(activeRemoteSession?.accessToken);
|
|
979
979
|
if (!accessToken) {
|
|
980
980
|
workflowError(
|
|
981
981
|
"config",
|
|
982
982
|
"validation_failed",
|
|
983
|
-
"Treeseed config --connect-market requires a market access token. Authenticate to the
|
|
983
|
+
"Treeseed config --connect-market requires a market access token. Authenticate to the TreeSeed control-plane first or pass --market-access-token."
|
|
984
984
|
);
|
|
985
985
|
}
|
|
986
986
|
const projectId = normalizeOptionalString(input.marketProjectId) ?? normalizeOptionalString(marketSettings.projectId);
|
|
@@ -1018,7 +1018,7 @@ async function connectTreeseedMarketProject(helpers, tenantRoot, input, context)
|
|
|
1018
1018
|
const hosts = Array.isArray(remoteSettings.hosts) ? [...remoteSettings.hosts] : [];
|
|
1019
1019
|
const updatedHost = {
|
|
1020
1020
|
id: hostId,
|
|
1021
|
-
label: "
|
|
1021
|
+
label: "TreeSeed",
|
|
1022
1022
|
baseUrl,
|
|
1023
1023
|
official: false
|
|
1024
1024
|
};
|
|
@@ -1051,7 +1051,7 @@ async function connectTreeseedMarketProject(helpers, tenantRoot, input, context)
|
|
|
1051
1051
|
expiresAt: "",
|
|
1052
1052
|
principal: {
|
|
1053
1053
|
id: `runner:${projectId}`,
|
|
1054
|
-
displayName: "
|
|
1054
|
+
displayName: "TreeSeed Project Runner",
|
|
1055
1055
|
scopes: [],
|
|
1056
1056
|
roles: ["project_runner"],
|
|
1057
1057
|
permissions: [],
|
|
@@ -1104,10 +1104,10 @@ async function connectTreeseedMarketProject(helpers, tenantRoot, input, context)
|
|
|
1104
1104
|
runnerTokenIssued: Boolean(connectionResult.runnerToken)
|
|
1105
1105
|
},
|
|
1106
1106
|
{
|
|
1107
|
-
summary: "
|
|
1107
|
+
summary: "TreeSeed project pairing completed.",
|
|
1108
1108
|
nextSteps: createNextSteps([
|
|
1109
1109
|
{ operation: "status", reason: "Confirm the new market connection, runner health, and current workstream posture." },
|
|
1110
|
-
{ operation: "tasks", reason: "Inspect the branch-backed workstreams that will now sync into the
|
|
1110
|
+
{ operation: "tasks", reason: "Inspect the branch-backed workstreams that will now sync into the TreeSeed UI." }
|
|
1111
1111
|
])
|
|
1112
1112
|
}
|
|
1113
1113
|
);
|
package/dist/workflow-state.js
CHANGED
|
@@ -703,8 +703,8 @@ function resolveTreeseedWorkflowState(cwd, options = {}) {
|
|
|
703
703
|
state.marketConnection.verificationPosture = state.readiness.local.ready ? "ready" : state.files.machineConfig ? "blocked" : "pending";
|
|
704
704
|
const registrationRequired = state.marketConnection.runtimeRegistration === "required";
|
|
705
705
|
state.marketConnection.approvalBlockers = [
|
|
706
|
-
...registrationRequired && !state.marketConnection.configured ? ["
|
|
707
|
-
...registrationRequired && !state.marketConnection.runtimeReady ? ["
|
|
706
|
+
...registrationRequired && !state.marketConnection.configured ? ["TreeSeed runtime attachment is not configured."] : [],
|
|
707
|
+
...registrationRequired && !state.marketConnection.runtimeReady ? ["TreeSeed runtime credential is missing or not ready."] : []
|
|
708
708
|
];
|
|
709
709
|
state.recommendations = recommendTreeseedNextSteps(state);
|
|
710
710
|
return state;
|