@treeseed/sdk 0.13.0-rc.38 → 0.13.0-rc.39
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/agent-capacity/validation/agent-definition-schema.d.ts +36 -36
- package/dist/agent-capacity/validation/agent-lab-forensics-schema.d.ts +8 -8
- package/dist/content/validation/auxiliary-content-schemas.d.ts +36 -36
- package/dist/content/validation/content-model-schemas.d.ts +118 -118
- package/dist/content/validation/portable-content-data.d.ts +13 -13
- package/dist/guarantees/index.d.ts +96 -0
- package/dist/guarantees/index.js +41 -0
- package/dist/operator-contracts/oauth.d.ts +35 -0
- package/dist/operator-contracts/oauth.js +7 -0
- package/dist/site-contracts/catalog.d.ts +16 -0
- package/dist/site-contracts/catalog.js +19 -0
- package/dist/site-contracts/cloudflare.d.ts +48 -0
- package/dist/site-contracts/cloudflare.js +0 -0
- package/dist/site-contracts/platform.d.ts +94 -0
- package/dist/site-contracts/platform.js +0 -0
- package/dist/site-contracts/plugin.d.ts +63 -0
- package/dist/site-contracts/plugin.js +26 -0
- package/package.json +25 -1
|
@@ -114,12 +114,12 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
114
114
|
templates: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
115
115
|
}, "strict", import("zod").ZodTypeAny, {
|
|
116
116
|
system: string;
|
|
117
|
-
task?: string | undefined;
|
|
118
117
|
templates?: Record<string, string> | undefined;
|
|
118
|
+
task?: string | undefined;
|
|
119
119
|
}, {
|
|
120
120
|
system: string;
|
|
121
|
-
task?: string | undefined;
|
|
122
121
|
templates?: Record<string, string> | undefined;
|
|
122
|
+
task?: string | undefined;
|
|
123
123
|
}>;
|
|
124
124
|
branchPolicy: import("zod").ZodObject<{
|
|
125
125
|
kind: import("zod").ZodEnum<["read-only", "main-planning-content", "staging-content", "assignment-feature", "staging-release"]>;
|
|
@@ -853,8 +853,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
853
853
|
enabled: boolean;
|
|
854
854
|
prompt: {
|
|
855
855
|
system: string;
|
|
856
|
-
task?: string | undefined;
|
|
857
856
|
templates?: Record<string, string> | undefined;
|
|
857
|
+
task?: string | undefined;
|
|
858
858
|
};
|
|
859
859
|
branchPolicy: {
|
|
860
860
|
kind: "read-only" | "main-planning-content" | "staging-content" | "assignment-feature" | "staging-release";
|
|
@@ -1026,8 +1026,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1026
1026
|
enabled: boolean;
|
|
1027
1027
|
prompt: {
|
|
1028
1028
|
system: string;
|
|
1029
|
-
task?: string | undefined;
|
|
1030
1029
|
templates?: Record<string, string> | undefined;
|
|
1030
|
+
task?: string | undefined;
|
|
1031
1031
|
};
|
|
1032
1032
|
branchPolicy: {
|
|
1033
1033
|
kind: "read-only" | "main-planning-content" | "staging-content" | "assignment-feature" | "staging-release";
|
|
@@ -1199,8 +1199,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1199
1199
|
enabled: boolean;
|
|
1200
1200
|
prompt: {
|
|
1201
1201
|
system: string;
|
|
1202
|
-
task?: string | undefined;
|
|
1203
1202
|
templates?: Record<string, string> | undefined;
|
|
1203
|
+
task?: string | undefined;
|
|
1204
1204
|
};
|
|
1205
1205
|
branchPolicy: {
|
|
1206
1206
|
kind: "read-only" | "main-planning-content" | "staging-content" | "assignment-feature" | "staging-release";
|
|
@@ -1372,8 +1372,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1372
1372
|
enabled: boolean;
|
|
1373
1373
|
prompt: {
|
|
1374
1374
|
system: string;
|
|
1375
|
-
task?: string | undefined;
|
|
1376
1375
|
templates?: Record<string, string> | undefined;
|
|
1376
|
+
task?: string | undefined;
|
|
1377
1377
|
};
|
|
1378
1378
|
branchPolicy: {
|
|
1379
1379
|
kind: "read-only" | "main-planning-content" | "staging-content" | "assignment-feature" | "staging-release";
|
|
@@ -1550,8 +1550,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1550
1550
|
projectId: string;
|
|
1551
1551
|
slug: string;
|
|
1552
1552
|
metadata: Record<string, unknown>;
|
|
1553
|
-
title: string;
|
|
1554
1553
|
startedAt: Date;
|
|
1554
|
+
title: string;
|
|
1555
1555
|
changedFiles: string[];
|
|
1556
1556
|
workDayId: string;
|
|
1557
1557
|
reportVersion: string;
|
|
@@ -1585,8 +1585,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1585
1585
|
createdAt?: Date | undefined;
|
|
1586
1586
|
state?: string | undefined;
|
|
1587
1587
|
completedAt?: Date | undefined;
|
|
1588
|
-
priority?: number | undefined;
|
|
1589
1588
|
startedAt?: Date | undefined;
|
|
1589
|
+
priority?: number | undefined;
|
|
1590
1590
|
agentId?: string | undefined;
|
|
1591
1591
|
idempotencyKey?: string | undefined;
|
|
1592
1592
|
lastErrorCode?: string | null | undefined;
|
|
@@ -1599,8 +1599,8 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1599
1599
|
deploymentKind: string;
|
|
1600
1600
|
id?: string | undefined;
|
|
1601
1601
|
createdAt?: Date | undefined;
|
|
1602
|
-
commitSha?: string | null | undefined;
|
|
1603
1602
|
startedAt?: Date | undefined;
|
|
1603
|
+
commitSha?: string | null | undefined;
|
|
1604
1604
|
finishedAt?: Date | undefined;
|
|
1605
1605
|
releaseTag?: string | null | undefined;
|
|
1606
1606
|
sourceRef?: string | null | undefined;
|
|
@@ -1652,7 +1652,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1652
1652
|
supportsReconcile: boolean;
|
|
1653
1653
|
};
|
|
1654
1654
|
offer: {
|
|
1655
|
-
priceModel: "external" | "private" | "
|
|
1655
|
+
priceModel: "external" | "private" | "free" | "contact" | "one_time" | "one_time_current_version" | "subscription" | "subscription_updates" | "professional_hosting" | "scoped_contract";
|
|
1656
1656
|
support?: string | undefined;
|
|
1657
1657
|
license?: string | undefined;
|
|
1658
1658
|
};
|
|
@@ -1662,7 +1662,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1662
1662
|
teamId?: string | undefined;
|
|
1663
1663
|
sourceRef?: string | undefined;
|
|
1664
1664
|
} | {
|
|
1665
|
-
kind: "workday" | "
|
|
1665
|
+
kind: "workday" | "api" | "handler" | "spec" | "message_chain" | "manager_worker" | "ui" | "context-query" | "context-query-set";
|
|
1666
1666
|
id: string;
|
|
1667
1667
|
trigger: Record<string, unknown>;
|
|
1668
1668
|
agent: string;
|
|
@@ -2003,7 +2003,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
2003
2003
|
status: "review" | "archived" | "draft" | "published";
|
|
2004
2004
|
schemaVersion: "treeseed.book/v2";
|
|
2005
2005
|
id: string;
|
|
2006
|
-
visibility: "team" | "project" | "public" | "
|
|
2006
|
+
visibility: "team" | "project" | "public" | "admin" | "authenticated";
|
|
2007
2007
|
order: number;
|
|
2008
2008
|
summary: string;
|
|
2009
2009
|
slug: string;
|
|
@@ -2016,7 +2016,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
2016
2016
|
status: "review" | "archived" | "draft" | "published";
|
|
2017
2017
|
schemaVersion: "treeseed.knowledge-page/v1";
|
|
2018
2018
|
id: string;
|
|
2019
|
-
visibility: "team" | "project" | "public" | "
|
|
2019
|
+
visibility: "team" | "project" | "public" | "admin" | "authenticated";
|
|
2020
2020
|
summary: string;
|
|
2021
2021
|
slug: string;
|
|
2022
2022
|
title: string;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export type GuaranteeRunStatus = 'passed' | 'failed' | 'skipped' | 'blocked';
|
|
2
|
+
export type GuaranteeFilter = Record<string, unknown>;
|
|
3
|
+
export interface GuaranteeDiagnostic {
|
|
4
|
+
severity: 'error' | 'warning' | 'info';
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
path?: string;
|
|
8
|
+
sourcePath?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface GuaranteeRunStep {
|
|
11
|
+
id: string;
|
|
12
|
+
kind: string;
|
|
13
|
+
status: GuaranteeRunStatus;
|
|
14
|
+
evidence?: string[];
|
|
15
|
+
diagnostics?: GuaranteeDiagnostic[];
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface GuaranteePlanEntry {
|
|
19
|
+
id: string;
|
|
20
|
+
journey: string;
|
|
21
|
+
ownerPackage: string;
|
|
22
|
+
type: string;
|
|
23
|
+
subtype: string;
|
|
24
|
+
status: string;
|
|
25
|
+
gates: string[];
|
|
26
|
+
sourcePath: string;
|
|
27
|
+
selected: boolean;
|
|
28
|
+
dependency: boolean;
|
|
29
|
+
[key: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
export interface GuaranteePlanReport {
|
|
32
|
+
ok: boolean;
|
|
33
|
+
entries: GuaranteePlanEntry[];
|
|
34
|
+
diagnostics: GuaranteeDiagnostic[];
|
|
35
|
+
[key: string]: unknown;
|
|
36
|
+
}
|
|
37
|
+
export interface GuaranteeRunResult {
|
|
38
|
+
id: string;
|
|
39
|
+
journey: string;
|
|
40
|
+
ownerPackage: string;
|
|
41
|
+
type: string;
|
|
42
|
+
subtype: string;
|
|
43
|
+
status: GuaranteeRunStatus;
|
|
44
|
+
selected: boolean;
|
|
45
|
+
dependency: boolean;
|
|
46
|
+
sourcePath: string;
|
|
47
|
+
steps: GuaranteeRunStep[];
|
|
48
|
+
diagnostics: GuaranteeDiagnostic[];
|
|
49
|
+
evidence: string[];
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface GuaranteeRunReport {
|
|
53
|
+
runId: string;
|
|
54
|
+
environment: string;
|
|
55
|
+
startedAt: string;
|
|
56
|
+
completedAt?: string;
|
|
57
|
+
ok: boolean;
|
|
58
|
+
filter: GuaranteeFilter;
|
|
59
|
+
counts: {
|
|
60
|
+
passed: number;
|
|
61
|
+
failed: number;
|
|
62
|
+
skipped: number;
|
|
63
|
+
blocked: number;
|
|
64
|
+
releaseBlockingFailures: number;
|
|
65
|
+
};
|
|
66
|
+
results: GuaranteeRunResult[];
|
|
67
|
+
diagnostics?: GuaranteeDiagnostic[];
|
|
68
|
+
[key: string]: unknown;
|
|
69
|
+
}
|
|
70
|
+
interface GuaranteeManifest {
|
|
71
|
+
id: string;
|
|
72
|
+
journey: string;
|
|
73
|
+
ownerPackage: string;
|
|
74
|
+
type: string;
|
|
75
|
+
subtype: string;
|
|
76
|
+
status: string;
|
|
77
|
+
gates: string[];
|
|
78
|
+
[key: string]: unknown;
|
|
79
|
+
}
|
|
80
|
+
interface LoadedGuarantee {
|
|
81
|
+
sourcePath: string;
|
|
82
|
+
relativePath: string;
|
|
83
|
+
manifest: GuaranteeManifest | null;
|
|
84
|
+
}
|
|
85
|
+
export declare function discoverGuarantees(input: {
|
|
86
|
+
workspaceRoot: string;
|
|
87
|
+
filter?: GuaranteeFilter;
|
|
88
|
+
}): {
|
|
89
|
+
ok: boolean;
|
|
90
|
+
guarantees: LoadedGuarantee[];
|
|
91
|
+
diagnostics: GuaranteeDiagnostic[];
|
|
92
|
+
counts: {
|
|
93
|
+
total: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { relative, resolve } from "node:path";
|
|
3
|
+
import { parse } from "yaml";
|
|
4
|
+
function walk(root, out = []) {
|
|
5
|
+
if (!existsSync(root)) return out;
|
|
6
|
+
for (const name of readdirSync(root)) {
|
|
7
|
+
if ([".git", "node_modules", "dist"].includes(name)) continue;
|
|
8
|
+
const path = resolve(root, name);
|
|
9
|
+
const stat = statSync(path);
|
|
10
|
+
if (stat.isDirectory()) walk(path, out);
|
|
11
|
+
else if (name.endsWith(".guarantee.yaml") || name.endsWith(".guarantee.yml")) out.push(path);
|
|
12
|
+
}
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
function discoverGuarantees(input) {
|
|
16
|
+
const diagnostics = [];
|
|
17
|
+
const guarantees = walk(resolve(input.workspaceRoot)).map((sourcePath) => {
|
|
18
|
+
try {
|
|
19
|
+
const value = parse(readFileSync(sourcePath, "utf8"));
|
|
20
|
+
const manifest = {
|
|
21
|
+
...value,
|
|
22
|
+
id: String(value.id ?? ""),
|
|
23
|
+
journey: String(value.journey ?? value.id ?? ""),
|
|
24
|
+
ownerPackage: String(value.ownerPackage ?? ""),
|
|
25
|
+
type: String(value.type ?? ""),
|
|
26
|
+
subtype: String(value.subtype ?? ""),
|
|
27
|
+
status: String(value.status ?? "planned"),
|
|
28
|
+
gates: Array.isArray(value.gates) ? value.gates.map(String) : []
|
|
29
|
+
};
|
|
30
|
+
if (!manifest.id) throw new Error("id is required");
|
|
31
|
+
return { sourcePath, relativePath: relative(input.workspaceRoot, sourcePath).replaceAll("\\", "/"), manifest };
|
|
32
|
+
} catch (cause) {
|
|
33
|
+
diagnostics.push({ severity: "error", code: "guarantee.invalid_manifest", message: cause instanceof Error ? cause.message : "Invalid guarantee manifest.", sourcePath });
|
|
34
|
+
return { sourcePath, relativePath: relative(input.workspaceRoot, sourcePath).replaceAll("\\", "/"), manifest: null };
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
return { ok: diagnostics.every((entry) => entry.severity !== "error"), guarantees, diagnostics, counts: { total: guarantees.length } };
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
discoverGuarantees
|
|
41
|
+
};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import type { OAuthScope } from './control-plane-operation.js';
|
|
2
|
+
export declare const OAUTH_CLIENT_IDS: {
|
|
3
|
+
readonly cli: "trsd";
|
|
4
|
+
readonly admin: "treeseed-admin";
|
|
5
|
+
};
|
|
6
|
+
export type OAuthClientId = typeof OAUTH_CLIENT_IDS[keyof typeof OAUTH_CLIENT_IDS];
|
|
2
7
|
export interface ApiPrincipal {
|
|
3
8
|
id: string;
|
|
4
9
|
displayName?: string;
|
|
@@ -18,6 +23,36 @@ export interface OAuthAuthorizationServerMetadata {
|
|
|
18
23
|
code_challenge_methods_supported: ['S256'];
|
|
19
24
|
scopes_supported: OAuthScope[];
|
|
20
25
|
}
|
|
26
|
+
export interface OAuthAuthorizationPresentation {
|
|
27
|
+
schemaVersion: 'treeseed.oauth.authorization-presentation/v1';
|
|
28
|
+
clientId: string;
|
|
29
|
+
clientName: string;
|
|
30
|
+
redirectUri: string;
|
|
31
|
+
redirectOrigin: string;
|
|
32
|
+
responseType: 'code';
|
|
33
|
+
codeChallenge: string;
|
|
34
|
+
codeChallengeMethod: 'S256';
|
|
35
|
+
scopes: OAuthScope[];
|
|
36
|
+
state: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface OAuthAuthorizationDecisionRequest {
|
|
39
|
+
clientId: string;
|
|
40
|
+
redirectUri: string;
|
|
41
|
+
responseType: 'code';
|
|
42
|
+
codeChallenge: string;
|
|
43
|
+
codeChallengeMethod: 'S256';
|
|
44
|
+
scope: OAuthScope[];
|
|
45
|
+
state?: string | null;
|
|
46
|
+
decision: 'approve' | 'deny';
|
|
47
|
+
identifier?: string;
|
|
48
|
+
password?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface OAuthAuthorizationDecisionResult {
|
|
51
|
+
schemaVersion: 'treeseed.oauth.authorization-decision/v1';
|
|
52
|
+
approved: boolean;
|
|
53
|
+
redirectTo: string;
|
|
54
|
+
expiresIn?: number;
|
|
55
|
+
}
|
|
21
56
|
export interface OAuthProtectedResourceMetadata {
|
|
22
57
|
resource: string;
|
|
23
58
|
authorization_servers: string[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const REMOTE_CONTRACT_HEADER = "x-treeseed-contract-version";
|
|
2
|
+
export declare const REMOTE_CONTRACT_VERSION = 1;
|
|
3
|
+
export declare const COMMERCE_OFFER_MODES: readonly ["free", "private", "contact", "one_time", "one_time_current_version", "subscription", "subscription_updates", "professional_hosting", "scoped_contract", "external"];
|
|
4
|
+
export type CommerceOfferMode = typeof COMMERCE_OFFER_MODES[number];
|
|
5
|
+
export type CatalogItemOfferMode = CommerceOfferMode;
|
|
6
|
+
export interface CatalogItem {
|
|
7
|
+
id?: string;
|
|
8
|
+
slug: string;
|
|
9
|
+
name?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
visibility?: string;
|
|
13
|
+
offerMode?: CommerceOfferMode;
|
|
14
|
+
priceModel?: CommerceOfferMode;
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const REMOTE_CONTRACT_HEADER = "x-treeseed-contract-version";
|
|
2
|
+
const REMOTE_CONTRACT_VERSION = 1;
|
|
3
|
+
const COMMERCE_OFFER_MODES = [
|
|
4
|
+
"free",
|
|
5
|
+
"private",
|
|
6
|
+
"contact",
|
|
7
|
+
"one_time",
|
|
8
|
+
"one_time_current_version",
|
|
9
|
+
"subscription",
|
|
10
|
+
"subscription_updates",
|
|
11
|
+
"professional_hosting",
|
|
12
|
+
"scoped_contract",
|
|
13
|
+
"external"
|
|
14
|
+
];
|
|
15
|
+
export {
|
|
16
|
+
COMMERCE_OFFER_MODES,
|
|
17
|
+
REMOTE_CONTRACT_HEADER,
|
|
18
|
+
REMOTE_CONTRACT_VERSION
|
|
19
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface KvNamespacePutOptions {
|
|
2
|
+
expirationTtl?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface KvNamespaceLike {
|
|
5
|
+
get(key: string): Promise<string | null>;
|
|
6
|
+
put(key: string, value: string, options?: KvNamespacePutOptions): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export interface D1PreparedStatementLike {
|
|
9
|
+
bind(...values: unknown[]): D1PreparedStatementLike;
|
|
10
|
+
run(): Promise<unknown>;
|
|
11
|
+
first<T = Record<string, unknown>>(): Promise<T | null>;
|
|
12
|
+
all<T = Record<string, unknown>>(): Promise<{
|
|
13
|
+
results: T[];
|
|
14
|
+
}>;
|
|
15
|
+
raw<T = unknown[]>(): Promise<T[]>;
|
|
16
|
+
}
|
|
17
|
+
export interface D1DatabaseLike {
|
|
18
|
+
prepare(query: string): D1PreparedStatementLike;
|
|
19
|
+
batch?(statements: D1PreparedStatementLike[]): Promise<unknown[]>;
|
|
20
|
+
exec?(query: string): Promise<unknown>;
|
|
21
|
+
}
|
|
22
|
+
export interface CloudflareRuntimeAssets {
|
|
23
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
24
|
+
}
|
|
25
|
+
export interface R2ObjectLike {
|
|
26
|
+
text(): Promise<string>;
|
|
27
|
+
arrayBuffer(): Promise<ArrayBuffer>;
|
|
28
|
+
json<T = unknown>(): Promise<T>;
|
|
29
|
+
httpEtag?: string;
|
|
30
|
+
etag?: string;
|
|
31
|
+
size?: number;
|
|
32
|
+
uploaded?: Date;
|
|
33
|
+
writeHttpMetadata?(headers: Headers): void;
|
|
34
|
+
}
|
|
35
|
+
export interface R2BucketLike {
|
|
36
|
+
get(key: string): Promise<R2ObjectLike | null>;
|
|
37
|
+
head?(key: string): Promise<R2ObjectLike | null>;
|
|
38
|
+
put(key: string, value: string | ArrayBuffer | ArrayBufferView | ReadableStream, options?: Record<string, unknown>): Promise<unknown>;
|
|
39
|
+
delete?(key: string | string[]): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export interface CloudflareRuntime {
|
|
42
|
+
env: {
|
|
43
|
+
FORM_GUARD_KV: KvNamespaceLike;
|
|
44
|
+
SITE_DATA_DB: D1DatabaseLike;
|
|
45
|
+
ASSETS?: CloudflareRuntimeAssets;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export type ContentCollection = 'pages' | 'notes' | 'questions' | 'objectives' | 'proposals' | 'decisions' | 'people' | 'agents' | 'books' | 'docs' | 'templates' | 'workdays' | 'groups' | 'group_edges';
|
|
2
|
+
export type ThemeMode = 'light' | 'dark' | 'system';
|
|
3
|
+
export type ColorSchemeId = 'fern' | 'lichen' | 'cedar' | 'tidepool' | (string & {});
|
|
4
|
+
export interface SemanticColorTokens {
|
|
5
|
+
canvas: string;
|
|
6
|
+
canvasSubtle: string;
|
|
7
|
+
surface: string;
|
|
8
|
+
surfaceMuted: string;
|
|
9
|
+
surfaceRaised: string;
|
|
10
|
+
surfaceOverlay: string;
|
|
11
|
+
text: string;
|
|
12
|
+
textMuted: string;
|
|
13
|
+
textSubtle: string;
|
|
14
|
+
textInverse: string;
|
|
15
|
+
link: string;
|
|
16
|
+
linkHover: string;
|
|
17
|
+
border: string;
|
|
18
|
+
borderMuted: string;
|
|
19
|
+
borderStrong: string;
|
|
20
|
+
focus: string;
|
|
21
|
+
accent: string;
|
|
22
|
+
accentHover: string;
|
|
23
|
+
accentStrong: string;
|
|
24
|
+
accentSoft: string;
|
|
25
|
+
accentText: string;
|
|
26
|
+
info: string;
|
|
27
|
+
infoSoft: string;
|
|
28
|
+
infoText: string;
|
|
29
|
+
infoBorder: string;
|
|
30
|
+
success: string;
|
|
31
|
+
successSoft: string;
|
|
32
|
+
successText: string;
|
|
33
|
+
successBorder: string;
|
|
34
|
+
warning: string;
|
|
35
|
+
warningSoft: string;
|
|
36
|
+
warningText: string;
|
|
37
|
+
warningBorder: string;
|
|
38
|
+
danger: string;
|
|
39
|
+
dangerSoft: string;
|
|
40
|
+
dangerText: string;
|
|
41
|
+
dangerBorder: string;
|
|
42
|
+
shadow: string;
|
|
43
|
+
grid: string;
|
|
44
|
+
}
|
|
45
|
+
export interface SchemeTokens {
|
|
46
|
+
light: SemanticColorTokens;
|
|
47
|
+
dark: SemanticColorTokens;
|
|
48
|
+
}
|
|
49
|
+
export interface ThemeConfig {
|
|
50
|
+
defaultScheme?: ColorSchemeId;
|
|
51
|
+
defaultMode?: ThemeMode;
|
|
52
|
+
schemes?: Record<string, Partial<{
|
|
53
|
+
light: Partial<SemanticColorTokens>;
|
|
54
|
+
dark: Partial<SemanticColorTokens>;
|
|
55
|
+
}>>;
|
|
56
|
+
}
|
|
57
|
+
export type PlatformSurfaceName = 'web' | 'api' | (string & {});
|
|
58
|
+
export type PlatformResourceKind = 'pages' | 'styles' | 'components' | 'routes' | 'middleware' | 'handlers' | 'config';
|
|
59
|
+
export interface PlatformLayerDefinition {
|
|
60
|
+
root: string;
|
|
61
|
+
kinds?: PlatformResourceKind[];
|
|
62
|
+
}
|
|
63
|
+
export interface ManagedServiceEnvironmentConfig {
|
|
64
|
+
baseUrl?: string;
|
|
65
|
+
domain?: string;
|
|
66
|
+
serviceName?: string;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface DeployConfig {
|
|
70
|
+
content?: Record<string, unknown>;
|
|
71
|
+
forms?: Record<string, unknown>;
|
|
72
|
+
surfaces?: Record<string, unknown>;
|
|
73
|
+
services?: Record<string, unknown>;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}
|
|
76
|
+
export interface TenantConfig {
|
|
77
|
+
id?: string;
|
|
78
|
+
name?: string;
|
|
79
|
+
root?: string;
|
|
80
|
+
content: Record<string, string | undefined>;
|
|
81
|
+
features?: Record<string, boolean | undefined>;
|
|
82
|
+
site?: {
|
|
83
|
+
models?: Partial<Record<ContentCollection, {
|
|
84
|
+
rendered?: boolean;
|
|
85
|
+
}>>;
|
|
86
|
+
};
|
|
87
|
+
theme?: ThemeConfig;
|
|
88
|
+
plugins?: Array<{
|
|
89
|
+
package: string;
|
|
90
|
+
enabled?: boolean;
|
|
91
|
+
config?: Record<string, unknown>;
|
|
92
|
+
}>;
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { DeployConfig, PlatformLayerDefinition, PlatformResourceKind, PlatformSurfaceName, TenantConfig } from './platform.js';
|
|
2
|
+
export type RouteOwner = 'market' | 'admin' | 'core';
|
|
3
|
+
export type RouteResponseKind = 'page' | 'message' | 'redirect' | 'data' | 'proxy' | 'action' | 'feed';
|
|
4
|
+
export type RouteArchetype = 'action' | 'auth-form' | 'collection' | 'dashboard' | 'detail' | 'feed' | 'message' | 'profile' | 'reader' | 'redirect' | 'settings' | 'wizard';
|
|
5
|
+
export type RouteNavigationPosture = 'primary' | 'secondary' | 'contextual' | 'hidden';
|
|
6
|
+
export type RouteStatus = 'active' | 'planned' | 'deprecated';
|
|
7
|
+
export interface RouteCapability {
|
|
8
|
+
id: string;
|
|
9
|
+
owner: RouteOwner;
|
|
10
|
+
responseKind: RouteResponseKind;
|
|
11
|
+
archetype: RouteArchetype;
|
|
12
|
+
shell: string;
|
|
13
|
+
template: string;
|
|
14
|
+
surface: 'auth' | 'public' | 'personal' | 'team' | 'content' | 'system';
|
|
15
|
+
resourceType: string;
|
|
16
|
+
accessPolicy: string[];
|
|
17
|
+
viewModelDependencies: string[];
|
|
18
|
+
navigation: RouteNavigationPosture;
|
|
19
|
+
states: Array<'loading' | 'empty' | 'forbidden' | 'unavailable' | 'validation' | 'conflict' | 'retry' | 'success' | 'not-found'>;
|
|
20
|
+
selector: string;
|
|
21
|
+
status: RouteStatus;
|
|
22
|
+
guarantees: string[];
|
|
23
|
+
description: string;
|
|
24
|
+
knowledgePageIds?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface SiteRouteContribution {
|
|
27
|
+
pattern: string;
|
|
28
|
+
entrypoint?: string;
|
|
29
|
+
resourcePath?: string;
|
|
30
|
+
capability?: RouteCapability;
|
|
31
|
+
}
|
|
32
|
+
export interface SiteExtensionContribution {
|
|
33
|
+
routes?: SiteRouteContribution[];
|
|
34
|
+
starlightComponents?: Record<string, string>;
|
|
35
|
+
customCss?: string[];
|
|
36
|
+
remarkPlugins?: unknown[];
|
|
37
|
+
rehypePlugins?: unknown[];
|
|
38
|
+
envSchema?: Record<string, unknown>;
|
|
39
|
+
vitePlugins?: unknown[];
|
|
40
|
+
integrations?: unknown[];
|
|
41
|
+
routeMiddleware?: unknown[];
|
|
42
|
+
}
|
|
43
|
+
export interface PluginSiteContext {
|
|
44
|
+
projectRoot: string;
|
|
45
|
+
tenantConfig: TenantConfig;
|
|
46
|
+
deployConfig?: DeployConfig;
|
|
47
|
+
pluginConfig: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
export interface Plugin {
|
|
50
|
+
id?: string;
|
|
51
|
+
provides?: Record<string, unknown>;
|
|
52
|
+
siteProviders?: Record<string, SiteExtensionContribution | ((context: PluginSiteContext) => SiteExtensionContribution)>;
|
|
53
|
+
siteHooks?: SiteExtensionContribution | ((context: PluginSiteContext) => SiteExtensionContribution);
|
|
54
|
+
siteLayers?: PlatformLayerDefinition[] | ((context: PluginSiteContext) => PlatformLayerDefinition[] | undefined);
|
|
55
|
+
platformLayers?: Array<PlatformLayerDefinition & {
|
|
56
|
+
surface?: PlatformSurfaceName;
|
|
57
|
+
kinds?: PlatformResourceKind[];
|
|
58
|
+
}>;
|
|
59
|
+
[key: string]: unknown;
|
|
60
|
+
}
|
|
61
|
+
export declare function defineRoute<T extends SiteRouteContribution>(route: T): T;
|
|
62
|
+
export declare function validateRouteCapabilities(routes: readonly SiteRouteContribution[]): readonly SiteRouteContribution[];
|
|
63
|
+
export declare function definePlugin<T extends Plugin>(plugin: T): T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function defineRoute(route) {
|
|
2
|
+
if (!route.pattern.startsWith("/")) throw new Error(`TreeSeed route pattern must start with "/": ${route.pattern}`);
|
|
3
|
+
if (route.capability && !/^[a-z][a-z0-9.-]+$/u.test(route.capability.id)) throw new Error(`Invalid TreeSeed route capability id: ${route.capability.id}`);
|
|
4
|
+
return route;
|
|
5
|
+
}
|
|
6
|
+
function validateRouteCapabilities(routes) {
|
|
7
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
8
|
+
const ids = /* @__PURE__ */ new Set();
|
|
9
|
+
for (const route of routes) {
|
|
10
|
+
defineRoute(route);
|
|
11
|
+
if (patterns.has(route.pattern)) throw new Error(`Duplicate TreeSeed route pattern: ${route.pattern}`);
|
|
12
|
+
patterns.add(route.pattern);
|
|
13
|
+
if (!route.capability) throw new Error(`TreeSeed route ${route.pattern} is missing capability metadata.`);
|
|
14
|
+
if (ids.has(route.capability.id)) throw new Error(`Duplicate TreeSeed route capability id: ${route.capability.id}`);
|
|
15
|
+
ids.add(route.capability.id);
|
|
16
|
+
}
|
|
17
|
+
return routes;
|
|
18
|
+
}
|
|
19
|
+
function definePlugin(plugin) {
|
|
20
|
+
return plugin;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
definePlugin,
|
|
24
|
+
defineRoute,
|
|
25
|
+
validateRouteCapabilities
|
|
26
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treeseed/sdk",
|
|
3
|
-
"version": "0.13.0-rc.
|
|
3
|
+
"version": "0.13.0-rc.39",
|
|
4
4
|
"description": "Portable TreeSeed contracts, standards, and typed remote control-plane clients.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -85,6 +85,30 @@
|
|
|
85
85
|
"types": "./dist/operator-contracts/index.d.ts",
|
|
86
86
|
"default": "./dist/operator-contracts/index.js"
|
|
87
87
|
},
|
|
88
|
+
"./guarantees": {
|
|
89
|
+
"types": "./dist/guarantees/index.d.ts",
|
|
90
|
+
"default": "./dist/guarantees/index.js"
|
|
91
|
+
},
|
|
92
|
+
"./site-contracts/platform": {
|
|
93
|
+
"types": "./dist/site-contracts/platform.d.ts",
|
|
94
|
+
"default": "./dist/site-contracts/platform.js"
|
|
95
|
+
},
|
|
96
|
+
"./site-contracts/plugin": {
|
|
97
|
+
"types": "./dist/site-contracts/plugin.d.ts",
|
|
98
|
+
"default": "./dist/site-contracts/plugin.js"
|
|
99
|
+
},
|
|
100
|
+
"./site-contracts/cloudflare": {
|
|
101
|
+
"types": "./dist/site-contracts/cloudflare.d.ts",
|
|
102
|
+
"default": "./dist/site-contracts/cloudflare.js"
|
|
103
|
+
},
|
|
104
|
+
"./site-contracts/catalog": {
|
|
105
|
+
"types": "./dist/site-contracts/catalog.d.ts",
|
|
106
|
+
"default": "./dist/site-contracts/catalog.js"
|
|
107
|
+
},
|
|
108
|
+
"./field-aliases": {
|
|
109
|
+
"types": "./dist/entrypoints/models/field-aliases.d.ts",
|
|
110
|
+
"default": "./dist/entrypoints/models/field-aliases.js"
|
|
111
|
+
},
|
|
88
112
|
"./control-plane-client": {
|
|
89
113
|
"types": "./dist/entrypoints/clients/control-plane-client.d.ts",
|
|
90
114
|
"default": "./dist/entrypoints/clients/control-plane-client.js"
|