@treeseed/sdk 0.8.7 → 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/capacity.d.ts +120 -1
- package/dist/capacity.js +371 -2
- 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 +5 -5
- package/dist/index.js +33 -23
- package/dist/market-client.d.ts +32 -0
- package/dist/market-client.js +48 -0
- package/dist/operations/services/config-runtime.js +57 -20
- 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 -9
- 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/reconcile/builtin-adapters.js +95 -11
- package/dist/scripts/tenant-d1-migrate-local.js +1 -0
- package/dist/sdk-types.d.ts +5 -4
- 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
|
@@ -139,13 +139,13 @@ function buildManifest(projectRoot, input) {
|
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function resolveMarketPackageOutputRoot(projectRoot, kind, slug) {
|
|
143
143
|
return resolve(projectRoot, ".treeseed", "packages", kind, `${slug}-${nowStamp()}`);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function buildTemplateMarketPackage(projectRoot, input = {}) {
|
|
146
146
|
const projectSlug = slugify(input.projectSlug ?? basename(projectRoot), "project");
|
|
147
147
|
const packageId = slugify(input.id ?? `${projectSlug}-template`, "template");
|
|
148
|
-
const outputRoot = resolve(input.outputRoot ??
|
|
148
|
+
const outputRoot = resolve(input.outputRoot ?? resolveMarketPackageOutputRoot(projectRoot, "template", packageId));
|
|
149
149
|
const payloadRoot = resolve(outputRoot, "payload");
|
|
150
150
|
ensureDir(payloadRoot);
|
|
151
151
|
const files = copySelectedPaths(projectRoot, payloadRoot, defaultTemplatePaths(projectRoot), TEMPLATE_IGNORES);
|
|
@@ -168,10 +168,10 @@ function buildKnowledgeCoopTemplatePackage(projectRoot, input = {}) {
|
|
|
168
168
|
manifest
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
function
|
|
171
|
+
function buildKnowledgePackMarketPackage(projectRoot, input = {}) {
|
|
172
172
|
const projectSlug = slugify(input.projectSlug ?? basename(projectRoot), "project");
|
|
173
173
|
const packageId = slugify(input.id ?? `${projectSlug}-knowledge-pack`, "knowledge-pack");
|
|
174
|
-
const outputRoot = resolve(input.outputRoot ??
|
|
174
|
+
const outputRoot = resolve(input.outputRoot ?? resolveMarketPackageOutputRoot(projectRoot, "knowledge_pack", packageId));
|
|
175
175
|
const payloadRoot = resolve(outputRoot, "payload");
|
|
176
176
|
ensureDir(payloadRoot);
|
|
177
177
|
const includePaths = (input.includePaths ?? KNOWLEDGE_PACK_DEFAULT_PATHS).filter((relativePath) => existsSync(resolve(projectRoot, relativePath)));
|
|
@@ -195,7 +195,7 @@ function buildKnowledgeCoopKnowledgePackPackage(projectRoot, input = {}) {
|
|
|
195
195
|
manifest
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function importKnowledgePack(targetRoot, sourcePath) {
|
|
199
199
|
const resolvedSource = resolve(sourcePath);
|
|
200
200
|
const manifestPath = statSync(resolvedSource).isDirectory() ? resolve(resolvedSource, "manifest.json") : resolvedSource;
|
|
201
201
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
@@ -226,9 +226,9 @@ function relativePackageFiles(outputRoot) {
|
|
|
226
226
|
return listFiles(outputRoot).map((entry) => relative(outputRoot, resolve(outputRoot, entry)) || basename(entry));
|
|
227
227
|
}
|
|
228
228
|
export {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
buildKnowledgePackMarketPackage,
|
|
230
|
+
buildTemplateMarketPackage,
|
|
231
|
+
importKnowledgePack,
|
|
232
232
|
relativePackageFiles,
|
|
233
|
-
|
|
233
|
+
resolveMarketPackageOutputRoot
|
|
234
234
|
};
|
|
@@ -214,6 +214,22 @@ export declare function deployProjectPlatform(options: ProjectPlatformActionOpti
|
|
|
214
214
|
readiness: any;
|
|
215
215
|
};
|
|
216
216
|
};
|
|
217
|
+
hostingRepair: {
|
|
218
|
+
ok: boolean;
|
|
219
|
+
phase: "repaired" | "already_ready";
|
|
220
|
+
environment: import("./hosting-audit.ts").TreeseedHostingAuditResolvedEnvironment;
|
|
221
|
+
repairMode: boolean;
|
|
222
|
+
repaired: boolean;
|
|
223
|
+
repairedChecks: number;
|
|
224
|
+
failedChecks: number;
|
|
225
|
+
blockers: string[];
|
|
226
|
+
warnings: string[];
|
|
227
|
+
checkedAt: string;
|
|
228
|
+
} | {
|
|
229
|
+
ok: boolean;
|
|
230
|
+
skipped: boolean;
|
|
231
|
+
reason: string;
|
|
232
|
+
};
|
|
217
233
|
serviceResults: ({
|
|
218
234
|
service: any;
|
|
219
235
|
status: string;
|
|
@@ -641,6 +657,22 @@ export declare function runProjectPlatformAction(action: ProjectPlatformAction,
|
|
|
641
657
|
readiness: any;
|
|
642
658
|
};
|
|
643
659
|
};
|
|
660
|
+
hostingRepair: {
|
|
661
|
+
ok: boolean;
|
|
662
|
+
phase: "repaired" | "already_ready";
|
|
663
|
+
environment: import("./hosting-audit.ts").TreeseedHostingAuditResolvedEnvironment;
|
|
664
|
+
repairMode: boolean;
|
|
665
|
+
repaired: boolean;
|
|
666
|
+
repairedChecks: number;
|
|
667
|
+
failedChecks: number;
|
|
668
|
+
blockers: string[];
|
|
669
|
+
warnings: string[];
|
|
670
|
+
checkedAt: string;
|
|
671
|
+
} | {
|
|
672
|
+
ok: boolean;
|
|
673
|
+
skipped: boolean;
|
|
674
|
+
reason: string;
|
|
675
|
+
};
|
|
644
676
|
serviceResults: ({
|
|
645
677
|
service: any;
|
|
646
678
|
status: string;
|
|
@@ -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
|
};
|