@treeseed/sdk 0.13.0-rc.37 → 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/capacity-provider/client.d.ts +1 -1
- package/dist/content/validation/agent-operational-content-schemas.d.ts +8 -8
- package/dist/content/validation/auxiliary-content-schemas.d.ts +36 -36
- package/dist/content/validation/content-model-schemas.d.ts +128 -128
- package/dist/content/validation/portable-content-data.d.ts +15 -15
- package/dist/entrypoints/clients/control-plane-client.d.ts +5 -0
- package/dist/guarantees/index.d.ts +96 -0
- package/dist/guarantees/index.js +41 -0
- package/dist/operator-contracts/canonical-command-tree.js +6 -2
- package/dist/operator-contracts/catalog/communication-operations.d.ts +95 -15
- package/dist/operator-contracts/catalog/communication-operations.js +1 -1
- package/dist/operator-contracts/communication/addressing.d.ts +8 -0
- package/dist/operator-contracts/communication/addressing.js +57 -0
- package/dist/operator-contracts/communication/contracts.d.ts +418 -40
- package/dist/operator-contracts/communication/contracts.js +43 -11
- package/dist/operator-contracts/control-plane-operations.d.ts +95 -15
- package/dist/operator-contracts/index.d.ts +1 -0
- package/dist/operator-contracts/index.js +1 -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;
|
|
@@ -1711,6 +1711,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1711
1711
|
revision: number;
|
|
1712
1712
|
description: string;
|
|
1713
1713
|
query: string;
|
|
1714
|
+
depth: number;
|
|
1714
1715
|
title: string;
|
|
1715
1716
|
filters: Record<string, unknown>;
|
|
1716
1717
|
target: {
|
|
@@ -1718,7 +1719,6 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1718
1719
|
paths?: string[] | undefined;
|
|
1719
1720
|
models?: string[] | undefined;
|
|
1720
1721
|
};
|
|
1721
|
-
depth: number;
|
|
1722
1722
|
purpose: string;
|
|
1723
1723
|
maturity: "draft" | "validated" | "simulated" | "proven";
|
|
1724
1724
|
relations: import("../../sdk-types/support/sdk-search-request.js").SdkGraphDslRelation[];
|
|
@@ -1844,6 +1844,7 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1844
1844
|
createdAt: Date;
|
|
1845
1845
|
teamId: string;
|
|
1846
1846
|
projectId: string;
|
|
1847
|
+
outcome: "failed" | "passed" | "needs-revision";
|
|
1847
1848
|
title: string;
|
|
1848
1849
|
contextQueryRefs: {
|
|
1849
1850
|
id: string;
|
|
@@ -1858,7 +1859,6 @@ export declare function validatePortableContentData(model: string, value: unknow
|
|
|
1858
1859
|
revision: number;
|
|
1859
1860
|
}[];
|
|
1860
1861
|
agentId: string;
|
|
1861
|
-
outcome: "failed" | "passed" | "needs-revision";
|
|
1862
1862
|
agentDefinitionRef: {
|
|
1863
1863
|
id: string;
|
|
1864
1864
|
revision: number;
|
|
@@ -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;
|
|
@@ -15,6 +15,11 @@ export interface ControlPlaneServerSession {
|
|
|
15
15
|
refreshToken?: string;
|
|
16
16
|
expiresAt?: string;
|
|
17
17
|
principal?: ApiPrincipal | null;
|
|
18
|
+
activeTeam?: {
|
|
19
|
+
id: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
name: string;
|
|
22
|
+
} | null;
|
|
18
23
|
}
|
|
19
24
|
export interface ControlPlaneServerRegistry {
|
|
20
25
|
version: 1;
|
|
@@ -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
|
+
};
|
|
@@ -13,7 +13,10 @@ const operationBindings = {
|
|
|
13
13
|
"auth logout": protocol("protocol.oauth.revoke"),
|
|
14
14
|
"auth status": operation("accounts.current.show"),
|
|
15
15
|
"users create": protocol("protocol.accounts.create"),
|
|
16
|
-
"send": operation("communications.send", [field("path", "teamId", "context", "team", true), field("path", "channel", "argument", "channel", true), field("body", "message", "argument", "message", true), field("body", "projectId", "context", "project"), field("body", "recipients", "option", "to"), field("body", "
|
|
16
|
+
"send": operation("communications.send", [field("path", "teamId", "context", "team", true), field("path", "channel", "argument", "channel", true), field("body", "message", "argument", "message", true), field("body", "projectId", "context", "project", true), field("body", "recipients", "option", "to"), field("body", "timeoutSeconds", "option", "timeout", false, "integer")]),
|
|
17
|
+
"teams list": operation("teams.list", page()),
|
|
18
|
+
"teams current": local("local.teams.current"),
|
|
19
|
+
"teams use": local("local.teams.use"),
|
|
17
20
|
"secrets list": local("local.secrets.list"),
|
|
18
21
|
"secrets status": local("local.secrets.status"),
|
|
19
22
|
"secrets unlock": local("local.secrets.unlock"),
|
|
@@ -192,9 +195,10 @@ const commandTree = {
|
|
|
192
195
|
schemaVersion: "treeseed.command-tree/v1",
|
|
193
196
|
executable: "trsd",
|
|
194
197
|
commands: [
|
|
195
|
-
{ nodeType: "leaf", segment: "send", description: "Send a message to project agents
|
|
198
|
+
{ nodeType: "leaf", segment: "send", description: "Send a message to addressed project agents in a team discussion topic.", kind: "mutation", arguments: [{ name: "channel", description: "Team discussion-topic channel.", required: true }, { name: "message", description: "Markdown message containing agent addresses.", required: true }], options: [planOption, { name: "--team", description: "One-command team override.", type: "string" }, { name: "--project", description: "Project for agent resolution and the topic stream.", type: "string", required: true }, { name: "--to", description: "Deprecated validation-only address list.", type: "string[]" }, { name: "--timeout", description: "Maximum seconds to wait for the complete response chain.", type: "number", defaultValue: 1800 }, { name: "--no-wait", description: "Return immediately after durable admission.", type: "boolean" }, { name: "--wait", description: "Deprecated wait duration in seconds.", type: "number" }], authorization: { capability: "agents.execute", confirmation: "never" }, resultSchemaId: "treeseed.communication-send-receipt/v2", execution: unavailable() },
|
|
196
199
|
branch("auth", [authLogin(), leaf("logout", "mutation"), leaf("status")]),
|
|
197
200
|
branch("users", [userCreate()]),
|
|
201
|
+
branch("teams", [leaf("list"), { nodeType: "leaf", segment: "current", description: "Show the active team for this authenticated server session.", kind: "read", resultSchemaId: "treeseed.command.teams.current/v1", execution: unavailable() }, { nodeType: "leaf", segment: "use", description: "Select the active team for this authenticated server session.", kind: "mutation", arguments: [{ name: "team", description: "Team UUID or unambiguous slug.", required: true }], options: [planOption], authorization: { capability: "teams.read", confirmation: "never" }, resultSchemaId: "treeseed.command.teams.use/v1", execution: unavailable() }]),
|
|
198
202
|
branch("secrets", [leaf("list"), leaf("status"), leaf("unlock", "mutation", void 0, "credential"), leaf("lock", "mutation"), leaf("rotate", "mutation", void 0, "credential")]),
|
|
199
203
|
branch("host", [
|
|
200
204
|
leaf("status"),
|
|
@@ -4,84 +4,164 @@ export declare function communicationOperations(): {
|
|
|
4
4
|
channel: string;
|
|
5
5
|
}, {}, {
|
|
6
6
|
message: string;
|
|
7
|
-
projectId
|
|
7
|
+
projectId: string;
|
|
8
|
+
timeoutSeconds?: number | undefined;
|
|
8
9
|
recipients?: string[] | undefined;
|
|
9
|
-
topic?: string | undefined;
|
|
10
|
-
waitSeconds?: number | undefined;
|
|
11
10
|
}, {
|
|
12
11
|
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
13
|
-
schemaVersion: "treeseed.communication-send-receipt/
|
|
12
|
+
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
14
13
|
createdAt: string;
|
|
15
14
|
responses: {
|
|
16
|
-
status: "failed" | "cancelled" | "responded";
|
|
15
|
+
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
17
16
|
createdAt: string;
|
|
18
17
|
projectId: string;
|
|
19
18
|
agentSlug: string;
|
|
20
19
|
assignmentId: string | null;
|
|
21
20
|
invocationId: string;
|
|
21
|
+
requirement: "required" | "optional";
|
|
22
22
|
messageRef: string;
|
|
23
23
|
markdown: string;
|
|
24
24
|
}[];
|
|
25
25
|
teamId: string;
|
|
26
26
|
channel: string;
|
|
27
|
-
|
|
27
|
+
updatedAt: string;
|
|
28
28
|
messageRef: string;
|
|
29
29
|
sendId: string;
|
|
30
|
+
topic: {
|
|
31
|
+
id: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
};
|
|
34
|
+
projectStream: {
|
|
35
|
+
id: string;
|
|
36
|
+
projectId: string;
|
|
37
|
+
projectSlug: string;
|
|
38
|
+
};
|
|
30
39
|
discussionId: string;
|
|
40
|
+
sourceMessage: string;
|
|
31
41
|
targets: {
|
|
32
|
-
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
42
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
43
|
+
completedAt: string | null;
|
|
33
44
|
projectId: string;
|
|
34
45
|
agentSlug: string;
|
|
46
|
+
capacity: {
|
|
47
|
+
status: string | null;
|
|
48
|
+
completedAt: string | null;
|
|
49
|
+
providerId: string | null;
|
|
50
|
+
assignmentId: string | null;
|
|
51
|
+
executionProviderId: string | null;
|
|
52
|
+
laneId: string | null;
|
|
53
|
+
lanePurpose: string | null;
|
|
54
|
+
assignedAt: string | null;
|
|
55
|
+
claimedAt: string | null;
|
|
56
|
+
returnedAt: string | null;
|
|
57
|
+
failedAt: string | null;
|
|
58
|
+
};
|
|
35
59
|
projectSlug: string;
|
|
36
60
|
definitionRevision: string;
|
|
61
|
+
revisions: {
|
|
62
|
+
project: string;
|
|
63
|
+
library: string;
|
|
64
|
+
agentDefinition: string;
|
|
65
|
+
chatProfile: string;
|
|
66
|
+
};
|
|
37
67
|
invocationId: string | null;
|
|
68
|
+
requirement: "required" | "optional";
|
|
69
|
+
parentInvocationId: string | null;
|
|
70
|
+
depth: number;
|
|
71
|
+
requestedAt: string;
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
failure: {
|
|
74
|
+
code: string;
|
|
75
|
+
message: string | null;
|
|
76
|
+
} | null;
|
|
38
77
|
}[];
|
|
39
|
-
|
|
78
|
+
replayed: boolean;
|
|
40
79
|
}>;
|
|
41
80
|
sendStatus: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
42
81
|
teamId: string;
|
|
43
82
|
sendId: string;
|
|
44
83
|
}, {}, undefined, {
|
|
45
84
|
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
46
|
-
schemaVersion: "treeseed.communication-send-receipt/
|
|
85
|
+
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
47
86
|
createdAt: string;
|
|
48
87
|
responses: {
|
|
49
|
-
status: "failed" | "cancelled" | "responded";
|
|
88
|
+
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
50
89
|
createdAt: string;
|
|
51
90
|
projectId: string;
|
|
52
91
|
agentSlug: string;
|
|
53
92
|
assignmentId: string | null;
|
|
54
93
|
invocationId: string;
|
|
94
|
+
requirement: "required" | "optional";
|
|
55
95
|
messageRef: string;
|
|
56
96
|
markdown: string;
|
|
57
97
|
}[];
|
|
58
98
|
teamId: string;
|
|
59
99
|
channel: string;
|
|
60
|
-
|
|
100
|
+
updatedAt: string;
|
|
61
101
|
messageRef: string;
|
|
62
102
|
sendId: string;
|
|
103
|
+
topic: {
|
|
104
|
+
id: string;
|
|
105
|
+
slug: string;
|
|
106
|
+
};
|
|
107
|
+
projectStream: {
|
|
108
|
+
id: string;
|
|
109
|
+
projectId: string;
|
|
110
|
+
projectSlug: string;
|
|
111
|
+
};
|
|
63
112
|
discussionId: string;
|
|
113
|
+
sourceMessage: string;
|
|
64
114
|
targets: {
|
|
65
|
-
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
115
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
116
|
+
completedAt: string | null;
|
|
66
117
|
projectId: string;
|
|
67
118
|
agentSlug: string;
|
|
119
|
+
capacity: {
|
|
120
|
+
status: string | null;
|
|
121
|
+
completedAt: string | null;
|
|
122
|
+
providerId: string | null;
|
|
123
|
+
assignmentId: string | null;
|
|
124
|
+
executionProviderId: string | null;
|
|
125
|
+
laneId: string | null;
|
|
126
|
+
lanePurpose: string | null;
|
|
127
|
+
assignedAt: string | null;
|
|
128
|
+
claimedAt: string | null;
|
|
129
|
+
returnedAt: string | null;
|
|
130
|
+
failedAt: string | null;
|
|
131
|
+
};
|
|
68
132
|
projectSlug: string;
|
|
69
133
|
definitionRevision: string;
|
|
134
|
+
revisions: {
|
|
135
|
+
project: string;
|
|
136
|
+
library: string;
|
|
137
|
+
agentDefinition: string;
|
|
138
|
+
chatProfile: string;
|
|
139
|
+
};
|
|
70
140
|
invocationId: string | null;
|
|
141
|
+
requirement: "required" | "optional";
|
|
142
|
+
parentInvocationId: string | null;
|
|
143
|
+
depth: number;
|
|
144
|
+
requestedAt: string;
|
|
145
|
+
updatedAt: string;
|
|
146
|
+
failure: {
|
|
147
|
+
code: string;
|
|
148
|
+
message: string | null;
|
|
149
|
+
} | null;
|
|
71
150
|
}[];
|
|
72
|
-
|
|
151
|
+
replayed: boolean;
|
|
73
152
|
}>;
|
|
74
153
|
};
|
|
75
154
|
export declare function providerDiscussionResponseOperation(): import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
76
155
|
assignmentId: string;
|
|
77
156
|
}, {}, {
|
|
78
|
-
markdown: string;
|
|
79
157
|
leaseToken: string;
|
|
80
158
|
runnerId: string;
|
|
81
159
|
summary?: string | undefined;
|
|
82
160
|
usage?: Record<string, unknown> | undefined;
|
|
161
|
+
markdown?: string | undefined;
|
|
162
|
+
outcome?: "responded" | "abstained" | undefined;
|
|
83
163
|
}, {
|
|
84
|
-
status: "responded";
|
|
164
|
+
status: "responded" | "abstained";
|
|
85
165
|
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
86
166
|
assignmentId: string;
|
|
87
167
|
invocationId: string;
|
|
@@ -10,7 +10,7 @@ const empty = z.object({}).strict();
|
|
|
10
10
|
const none = z.undefined();
|
|
11
11
|
function communicationOperations() {
|
|
12
12
|
return {
|
|
13
|
-
send: defineOperation({ operationId: "communications.send", description: "Post a team-
|
|
13
|
+
send: defineOperation({ operationId: "communications.send", description: "Post a team discussion-topic message and admit its addressed project agents to the communication lane.", rest: { method: "POST", path: "/v1/teams/{teamId}/discussion-topics/{channel}/messages" }, parameters: "treeseed.communications.send.parameters/v2", capability: "agents.execute", authentication: "oauth", oauthScopes: ["treeseed:execution"], kind: "mutation", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, {
|
|
14
14
|
path: z.object({ teamId: z.string().min(1), channel: z.string().trim().min(1).max(120) }).strict(),
|
|
15
15
|
query: empty,
|
|
16
16
|
body: communicationSendRequestSchema,
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CommunicationAddressRequirement = 'required' | 'optional';
|
|
2
|
+
export interface CommunicationAddress {
|
|
3
|
+
projectSlug: string | null;
|
|
4
|
+
agentSlug: string;
|
|
5
|
+
requirement: CommunicationAddressRequirement;
|
|
6
|
+
address: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseCommunicationAddresses(markdown: string): CommunicationAddress[];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const ADDRESS = /(^|[^\p{L}\p{N}._%+-])@([a-z0-9][a-z0-9-]*)(?:\/([a-z0-9][a-z0-9-]*))?/giu;
|
|
2
|
+
function visibleMarkdown(markdown) {
|
|
3
|
+
const lines = markdown.replace(/\r\n?/gu, "\n").split("\n");
|
|
4
|
+
let fenced = false;
|
|
5
|
+
return lines.map((line) => {
|
|
6
|
+
if (/^\s*```/u.test(line)) {
|
|
7
|
+
fenced = !fenced;
|
|
8
|
+
return "";
|
|
9
|
+
}
|
|
10
|
+
if (fenced || /^\s*>/u.test(line)) return "";
|
|
11
|
+
return line.replace(/`[^`]*`/gu, "").replace(/!?\[[^\]]*\]\([^)]*\)/gu, "").replace(/\b[\w.+-]+@[\w.-]+\.[a-z]{2,}\b/giu, "");
|
|
12
|
+
}).join("\n");
|
|
13
|
+
}
|
|
14
|
+
function initialAddressLines(markdown) {
|
|
15
|
+
const lines = visibleMarkdown(markdown).split("\n");
|
|
16
|
+
let started = false;
|
|
17
|
+
const requiredThrough = /* @__PURE__ */ new Map();
|
|
18
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
19
|
+
const source = lines[index];
|
|
20
|
+
const line = source.trim();
|
|
21
|
+
if (!line && !started) continue;
|
|
22
|
+
if (!line) break;
|
|
23
|
+
started = true;
|
|
24
|
+
const leading = source.match(/^\s*(?:@[a-z0-9][a-z0-9-]*(?:\/[a-z0-9][a-z0-9-]*)?[\s,;:—–-]*)+/iu);
|
|
25
|
+
if (!leading) break;
|
|
26
|
+
requiredThrough.set(index, leading[0].length);
|
|
27
|
+
if (source.slice(leading[0].length).trim()) break;
|
|
28
|
+
}
|
|
29
|
+
return { markdown: visibleMarkdown(markdown), requiredThrough };
|
|
30
|
+
}
|
|
31
|
+
function parseCommunicationAddresses(markdown) {
|
|
32
|
+
const visible = initialAddressLines(markdown);
|
|
33
|
+
const addresses = /* @__PURE__ */ new Map();
|
|
34
|
+
for (const [lineIndex, line] of visible.markdown.split("\n").entries()) {
|
|
35
|
+
ADDRESS.lastIndex = 0;
|
|
36
|
+
for (const match of line.matchAll(ADDRESS)) {
|
|
37
|
+
const first = match[2].toLowerCase();
|
|
38
|
+
const second = match[3]?.toLowerCase() ?? null;
|
|
39
|
+
const projectSlug = second ? first : null;
|
|
40
|
+
const agentSlug = second ?? first;
|
|
41
|
+
const key = `${projectSlug ?? ""}/${agentSlug}`;
|
|
42
|
+
const addressIndex = (match.index ?? 0) + match[1].length;
|
|
43
|
+
const requirement = addressIndex < (visible.requiredThrough.get(lineIndex) ?? 0) ? "required" : "optional";
|
|
44
|
+
const existing = addresses.get(key);
|
|
45
|
+
if (!existing || requirement === "required") addresses.set(key, {
|
|
46
|
+
projectSlug,
|
|
47
|
+
agentSlug,
|
|
48
|
+
requirement,
|
|
49
|
+
address: `@${projectSlug ? `${projectSlug}/` : ""}${agentSlug}`
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return [...addresses.values()];
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
parseCommunicationAddresses
|
|
57
|
+
};
|