@treeseed/sdk 0.13.0-rc.24 → 0.13.0-rc.26
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 +408 -408
- package/dist/capacity-provider/client.d.ts +9 -0
- package/dist/capacity-provider/client.js +3 -0
- package/dist/content/validation/agent-operational-content-schemas.d.ts +70 -70
- package/dist/content/validation/auxiliary-content-schemas.d.ts +46 -46
- package/dist/content/validation/content-model-schemas.d.ts +994 -994
- package/dist/content/validation/portable-content-data.d.ts +112 -112
- package/dist/deployment/canonical.d.ts +2 -0
- package/dist/deployment/canonical.js +17 -0
- package/dist/deployment/catalog.d.ts +16 -0
- package/dist/deployment/catalog.js +38 -0
- package/dist/deployment/index.d.ts +3 -0
- package/dist/deployment/index.js +3 -0
- package/dist/deployment/schemas.d.ts +2743 -0
- package/dist/deployment/schemas.js +179 -0
- package/dist/operator-contracts/canonical-command-tree.js +37 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +90 -0
- package/dist/operator-contracts/catalog/communication-operations.js +38 -0
- package/dist/operator-contracts/communication/contracts.d.ts +250 -0
- package/dist/operator-contracts/communication/contracts.js +64 -0
- package/dist/operator-contracts/control-plane-operations.d.ts +89 -1
- package/dist/operator-contracts/control-plane-operations.js +3 -0
- package/dist/operator-contracts/index.d.ts +1 -0
- package/dist/operator-contracts/index.js +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const identifier = z.string().regex(/^[a-z][a-z0-9.-]{1,63}$/u);
|
|
3
|
+
const digest = z.string().regex(/^sha256:[a-f0-9]{64}$/u);
|
|
4
|
+
const gitCommit = z.string().regex(/^[a-f0-9]{40}$/u);
|
|
5
|
+
const packageVersion = z.string().min(1).regex(/^[0-9][0-9A-Za-z.+:~-]*$/u);
|
|
6
|
+
const localAlias = z.string().regex(
|
|
7
|
+
/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*\.localhost$/u,
|
|
8
|
+
"Host aliases must use the .localhost namespace."
|
|
9
|
+
);
|
|
10
|
+
const binding = z.string().regex(/^(?:\[[0-9a-f:]+\]|[^:]+):[1-9][0-9]{0,4}$/iu);
|
|
11
|
+
const deploymentTrackSchema = z.enum(["stable", "development"]);
|
|
12
|
+
const hostComponentSchema = z.object({
|
|
13
|
+
enabled: z.boolean(),
|
|
14
|
+
track: deploymentTrackSchema,
|
|
15
|
+
profile: identifier.optional(),
|
|
16
|
+
aliases: z.record(z.string().min(1), localAlias).default({}),
|
|
17
|
+
configuration: z.record(z.unknown()).default({})
|
|
18
|
+
}).strict();
|
|
19
|
+
const hostConfigurationSchema = z.object({
|
|
20
|
+
schemaVersion: z.literal("treeseed.host/v1"),
|
|
21
|
+
configurationId: identifier,
|
|
22
|
+
generation: z.number().int().positive(),
|
|
23
|
+
host: z.object({
|
|
24
|
+
id: identifier,
|
|
25
|
+
role: identifier,
|
|
26
|
+
architecture: z.literal("amd64")
|
|
27
|
+
}).strict(),
|
|
28
|
+
runtime: z.object({ management: z.enum(["managed", "external"]) }).strict(),
|
|
29
|
+
updates: z.object({
|
|
30
|
+
defaultTrack: deploymentTrackSchema,
|
|
31
|
+
stable: z.object({
|
|
32
|
+
metadataPollSeconds: z.number().int().min(3600),
|
|
33
|
+
maintenanceWindow: z.object({
|
|
34
|
+
weekday: z.enum(["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]),
|
|
35
|
+
localTime: z.string().regex(/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/u),
|
|
36
|
+
jitterMinutes: z.number().int().min(0).max(30)
|
|
37
|
+
}).strict()
|
|
38
|
+
}).strict(),
|
|
39
|
+
development: z.object({ pollSeconds: z.literal(60) }).strict()
|
|
40
|
+
}).strict(),
|
|
41
|
+
components: z.record(identifier, hostComponentSchema),
|
|
42
|
+
network: z.object({
|
|
43
|
+
manager: z.object({ binding, aliases: z.array(localAlias).min(1), sans: z.array(z.string().min(1)), trustedLanCidrs: z.array(z.string().min(1)) }).strict()
|
|
44
|
+
}).strict(),
|
|
45
|
+
secrets: z.record(identifier, z.object({
|
|
46
|
+
provider: z.enum(["file", "systemd-credential", "vault", "aws-secrets-manager"]),
|
|
47
|
+
reference: z.string().min(1)
|
|
48
|
+
}).strict())
|
|
49
|
+
}).strict();
|
|
50
|
+
const packageEndpointSchema = z.object({
|
|
51
|
+
id: identifier,
|
|
52
|
+
protocol: z.enum(["http", "https", "tcp"]),
|
|
53
|
+
port: z.number().int().min(1).max(65535),
|
|
54
|
+
visibility: z.enum(["private", "host"]),
|
|
55
|
+
defaultAlias: localAlias.optional(),
|
|
56
|
+
aliasOverride: z.boolean().default(true),
|
|
57
|
+
tls: z.enum(["edge", "passthrough", "none"]),
|
|
58
|
+
authentication: z.enum(["none", "application", "mtls"]),
|
|
59
|
+
healthGate: z.object({ protocol: z.enum(["http", "https", "tcp"]), path: z.string().startsWith("/").optional(), timeoutSeconds: z.number().int().positive().max(600) }).strict().optional()
|
|
60
|
+
}).strict().superRefine((endpoint, context) => {
|
|
61
|
+
if (endpoint.visibility === "host" && !endpoint.defaultAlias) context.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultAlias"], message: "Host-visible endpoints require a .localhost alias." });
|
|
62
|
+
if (endpoint.visibility === "host" && !endpoint.healthGate) context.addIssue({ code: z.ZodIssueCode.custom, path: ["healthGate"], message: "Host-visible endpoints require a health gate." });
|
|
63
|
+
if (endpoint.visibility === "private" && endpoint.defaultAlias) context.addIssue({ code: z.ZodIssueCode.custom, path: ["defaultAlias"], message: "Private endpoints cannot declare host aliases." });
|
|
64
|
+
});
|
|
65
|
+
const packageRuntimeSchema = z.object({
|
|
66
|
+
schemaVersion: z.literal("treeseed.package-runtime/v1"),
|
|
67
|
+
componentId: identifier,
|
|
68
|
+
version: packageVersion,
|
|
69
|
+
compose: z.object({ projectName: identifier, files: z.array(z.string().min(1)).min(1) }).strict(),
|
|
70
|
+
services: z.array(z.object({ id: identifier, composeService: identifier, endpoints: z.array(packageEndpointSchema) }).strict()).min(1),
|
|
71
|
+
stateVolumes: z.array(z.object({ id: identifier, volume: z.string().min(1), backup: z.enum(["required", "optional", "none"]) }).strict()),
|
|
72
|
+
migrations: z.array(z.object({ id: identifier, order: z.number().int().nonnegative(), backupRequired: z.boolean() }).strict()),
|
|
73
|
+
requiredCapabilities: z.array(identifier)
|
|
74
|
+
}).strict().superRefine((runtime, context) => {
|
|
75
|
+
const endpointIds = runtime.services.flatMap((service) => service.endpoints.map((endpoint) => `${service.id}.${endpoint.id}`));
|
|
76
|
+
if (new Set(endpointIds).size !== endpointIds.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["services"], message: "Endpoint identities must be unique within a component." });
|
|
77
|
+
});
|
|
78
|
+
const catalogPackageSchema = z.object({ name: z.string().regex(/^treeseed(?:-[a-z0-9-]+)?$/u), version: packageVersion, architecture: z.enum(["amd64", "all"]), origin: z.literal("TreeSeed Deployment"), order: z.number().int().nonnegative() }).strict();
|
|
79
|
+
const catalogImageSchema = z.object({ role: identifier, repository: z.string().regex(/^treeseed\/[a-z0-9-]+$/u), digest, platforms: z.array(z.enum(["linux/amd64", "linux/arm64"])).min(1), consumers: z.array(identifier).min(1) }).strict();
|
|
80
|
+
const componentReleaseSchema = z.object({
|
|
81
|
+
schemaVersion: z.literal("treeseed.component-release/v1"),
|
|
82
|
+
componentId: identifier,
|
|
83
|
+
release: packageVersion,
|
|
84
|
+
track: deploymentTrackSchema,
|
|
85
|
+
source: z.object({ repository: z.string().regex(/^treeseed-ai\/[a-z0-9-]+$/u), commit: gitCommit }).strict(),
|
|
86
|
+
stableBase: z.object({ releaseRange: z.string().min(1), compatibilityId: identifier, catalogDigest: digest }).strict().nullable(),
|
|
87
|
+
packages: z.array(catalogPackageSchema).min(1),
|
|
88
|
+
images: z.array(catalogImageSchema),
|
|
89
|
+
runtime: packageRuntimeSchema,
|
|
90
|
+
runtimeDigest: digest,
|
|
91
|
+
rollback: z.object({ compatible: z.boolean(), requiresBackup: z.boolean() }).strict(),
|
|
92
|
+
evidence: z.object({ provenance: z.array(z.string().url()), sboms: z.array(z.string().url()), vulnerabilities: z.array(z.string().url()) }).strict()
|
|
93
|
+
}).strict().superRefine((release, context) => {
|
|
94
|
+
if (release.runtime.componentId !== release.componentId || release.runtime.version !== release.release) context.addIssue({ code: z.ZodIssueCode.custom, path: ["runtime"], message: "Runtime identity must match its component release." });
|
|
95
|
+
if (release.track === "development" && !release.stableBase) context.addIssue({ code: z.ZodIssueCode.custom, path: ["stableBase"], message: "Development releases require an exact stable-base binding." });
|
|
96
|
+
if (release.track === "stable" && release.stableBase) context.addIssue({ code: z.ZodIssueCode.custom, path: ["stableBase"], message: "Stable releases cannot be overlays." });
|
|
97
|
+
});
|
|
98
|
+
const releaseCatalogSchema = z.object({
|
|
99
|
+
schemaVersion: z.literal("treeseed.release-catalog/v1"),
|
|
100
|
+
release: packageVersion,
|
|
101
|
+
generation: z.number().int().positive(),
|
|
102
|
+
track: deploymentTrackSchema,
|
|
103
|
+
compatibilityId: identifier,
|
|
104
|
+
catalogDigest: digest,
|
|
105
|
+
stableBase: z.object({ release: packageVersion, catalogDigest: digest }).strict().nullable(),
|
|
106
|
+
components: z.array(componentReleaseSchema).min(1),
|
|
107
|
+
createdAt: z.string().datetime()
|
|
108
|
+
}).strict();
|
|
109
|
+
const hostPlanSchema = z.object({ schemaVersion: z.literal("treeseed.host-plan/v1"), planId: identifier, configurationDigest: digest, catalogDigest: digest, changes: z.array(z.object({ componentId: identifier, action: z.enum(["install", "upgrade", "reconfigure", "remove", "noop"]), from: packageVersion.nullable(), to: packageVersion.nullable() }).strict()), blockers: z.array(z.object({ code: identifier, message: z.string().min(1) }).strict()) }).strict();
|
|
110
|
+
const hostBootstrapSchema = z.object({
|
|
111
|
+
schemaVersion: z.literal("treeseed.host-bootstrap/v1"),
|
|
112
|
+
bootstrapId: identifier,
|
|
113
|
+
configurationDigest: digest,
|
|
114
|
+
apt: z.object({ origin: z.literal("TreeSeed Deployment"), suite: deploymentTrackSchema, repository: z.string().url(), keyFingerprint: z.string().regex(/^[A-F0-9]{40}$/u) }).strict(),
|
|
115
|
+
packages: z.array(catalogPackageSchema).min(1),
|
|
116
|
+
credentialPolicy: z.object({ noStoreResponse: z.literal(true), redactedLogging: z.literal(true), ephemeralGeneration: z.literal(true), deleteAfterInstall: z.literal(true) }).strict(),
|
|
117
|
+
createdAt: z.string().datetime()
|
|
118
|
+
}).strict();
|
|
119
|
+
const hostUpdateSchema = z.object({
|
|
120
|
+
schemaVersion: z.literal("treeseed.host-update/v1"),
|
|
121
|
+
updateId: identifier,
|
|
122
|
+
track: deploymentTrackSchema,
|
|
123
|
+
fromCatalogDigest: digest,
|
|
124
|
+
toCatalogDigest: digest,
|
|
125
|
+
components: z.array(z.object({ componentId: identifier, from: packageVersion.nullable(), to: packageVersion, imageDigests: z.array(digest) }).strict()).min(1),
|
|
126
|
+
activation: z.object({ policy: z.enum(["maintenance-window", "continuous"]), eligibleAt: z.string().datetime(), jitterSeconds: z.number().int().nonnegative() }).strict(),
|
|
127
|
+
state: z.enum(["planned", "draining", "applying", "healthy", "failed", "rolled-back"])
|
|
128
|
+
}).strict();
|
|
129
|
+
const hostReceiptSchema = z.object({ schemaVersion: z.literal("treeseed.host-receipt/v1"), receiptId: identifier, planId: identifier, state: z.enum(["known-good", "degraded", "rolled-back"]), configurationDigest: digest, catalogDigest: digest, packages: z.array(catalogPackageSchema), images: z.array(catalogImageSchema), completedAt: z.string().datetime() }).strict();
|
|
130
|
+
const hostBackupSchema = z.object({
|
|
131
|
+
schemaVersion: z.literal("treeseed.host-backup/v1"),
|
|
132
|
+
backupId: identifier,
|
|
133
|
+
componentId: identifier,
|
|
134
|
+
generation: z.number().int().positive(),
|
|
135
|
+
state: z.enum(["pending", "complete", "failed", "verified"]),
|
|
136
|
+
artifacts: z.array(z.object({ volumeId: identifier, location: z.string().min(1), digest, encrypted: z.boolean() }).strict()),
|
|
137
|
+
createdAt: z.string().datetime(),
|
|
138
|
+
verifiedAt: z.string().datetime().nullable()
|
|
139
|
+
}).strict();
|
|
140
|
+
const hostMigrationSchema = z.object({
|
|
141
|
+
schemaVersion: z.literal("treeseed.host-migration/v1"),
|
|
142
|
+
migrationId: identifier,
|
|
143
|
+
componentId: identifier,
|
|
144
|
+
operation: identifier,
|
|
145
|
+
fromGeneration: z.number().int().nonnegative(),
|
|
146
|
+
toGeneration: z.number().int().positive(),
|
|
147
|
+
backupId: identifier.nullable(),
|
|
148
|
+
state: z.enum(["pending", "quiesced", "copied", "verified", "activated", "failed", "rolled-back"]),
|
|
149
|
+
sourceWritersStopped: z.boolean(),
|
|
150
|
+
completedAt: z.string().datetime().nullable()
|
|
151
|
+
}).strict();
|
|
152
|
+
const hostRecoverySchema = z.object({
|
|
153
|
+
schemaVersion: z.literal("treeseed.host-recovery/v1"),
|
|
154
|
+
recoveryId: identifier,
|
|
155
|
+
receiptId: identifier,
|
|
156
|
+
componentId: identifier.nullable(),
|
|
157
|
+
trigger: z.enum(["health-gate", "operator", "boot", "interrupted-update"]),
|
|
158
|
+
action: z.enum(["retry", "rollback", "restore"]),
|
|
159
|
+
targetGeneration: z.number().int().positive(),
|
|
160
|
+
state: z.enum(["pending", "running", "healthy", "failed"]),
|
|
161
|
+
backupId: identifier.nullable(),
|
|
162
|
+
completedAt: z.string().datetime().nullable()
|
|
163
|
+
}).strict();
|
|
164
|
+
export {
|
|
165
|
+
componentReleaseSchema,
|
|
166
|
+
deploymentTrackSchema,
|
|
167
|
+
hostBackupSchema,
|
|
168
|
+
hostBootstrapSchema,
|
|
169
|
+
hostComponentSchema,
|
|
170
|
+
hostConfigurationSchema,
|
|
171
|
+
hostMigrationSchema,
|
|
172
|
+
hostPlanSchema,
|
|
173
|
+
hostReceiptSchema,
|
|
174
|
+
hostRecoverySchema,
|
|
175
|
+
hostUpdateSchema,
|
|
176
|
+
packageEndpointSchema,
|
|
177
|
+
packageRuntimeSchema,
|
|
178
|
+
releaseCatalogSchema
|
|
179
|
+
};
|
|
@@ -12,11 +12,34 @@ const operationBindings = {
|
|
|
12
12
|
"auth login": protocol("protocol.oauth.device.login"),
|
|
13
13
|
"auth logout": protocol("protocol.oauth.revoke"),
|
|
14
14
|
"auth status": operation("accounts.current.show"),
|
|
15
|
+
"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", "topic", "option"), field("body", "waitSeconds", "option", "wait", false, "integer")]),
|
|
15
16
|
"secrets list": local("local.secrets.list"),
|
|
16
17
|
"secrets status": local("local.secrets.status"),
|
|
17
18
|
"secrets unlock": local("local.secrets.unlock"),
|
|
18
19
|
"secrets lock": local("local.secrets.lock"),
|
|
19
20
|
"secrets rotate": local("local.secrets.rotate"),
|
|
21
|
+
"host status": local("local.host.status"),
|
|
22
|
+
"host doctor": local("local.host.doctor"),
|
|
23
|
+
"host plan": local("local.host.plan"),
|
|
24
|
+
"host apply": local("local.host.apply"),
|
|
25
|
+
"host reconcile": local("local.host.reconcile"),
|
|
26
|
+
"host events": local("local.host.events"),
|
|
27
|
+
"host update status": local("local.host.update.status"),
|
|
28
|
+
"host update check": local("local.host.update.check"),
|
|
29
|
+
"host update apply": local("local.host.update.apply"),
|
|
30
|
+
"host update channel": local("local.host.update.channel"),
|
|
31
|
+
"host update pause": local("local.host.update.pause"),
|
|
32
|
+
"host update resume": local("local.host.update.resume"),
|
|
33
|
+
"host component list": local("local.host.component.list"),
|
|
34
|
+
"host component status": local("local.host.component.status"),
|
|
35
|
+
"host component enable": local("local.host.component.enable"),
|
|
36
|
+
"host component disable": local("local.host.component.disable"),
|
|
37
|
+
"host aliases list": local("local.host.aliases.list"),
|
|
38
|
+
"host recovery status": local("local.host.recovery.status"),
|
|
39
|
+
"host recovery retry": local("local.host.recovery.retry"),
|
|
40
|
+
"host recovery restore": local("local.host.recovery.restore"),
|
|
41
|
+
"host bootstrap status": local("local.host.bootstrap.status"),
|
|
42
|
+
"host bootstrap enroll": local("local.host.bootstrap.enroll"),
|
|
20
43
|
"agents list": operation("agents.list", [field("path", "projectId", "context", "project", true), ...page()]),
|
|
21
44
|
"agents show": operation("agents.show", [field("path", "projectId", "context", "project", true), field("path", "agentSlug", "argument", "agent", true)]),
|
|
22
45
|
"agents classes list": operation("agents.classes.list", [field("path", "projectId", "context", "project", true)]),
|
|
@@ -91,8 +114,22 @@ const commandTree = {
|
|
|
91
114
|
schemaVersion: "treeseed.command-tree/v1",
|
|
92
115
|
executable: "trsd",
|
|
93
116
|
commands: [
|
|
117
|
+
{ nodeType: "leaf", segment: "send", description: "Send a message to project agents through a team discussion channel.", kind: "mutation", arguments: [{ name: "channel", description: "Team discussion channel.", required: true }, { name: "message", description: "Markdown message to send.", required: true }], options: [planOption, { name: "--team", description: "Team identity or slug.", type: "string" }, { name: "--project", description: "Default project for unqualified agent names.", type: "string" }, { name: "--to", description: "Agent target; use project/agent when names may be ambiguous.", type: "string[]" }, { name: "--topic", description: "Optional discussion topic.", type: "string" }, { name: "--wait", description: "Seconds to wait for durable responses.", type: "number", defaultValue: 0 }], authorization: { capability: "agents.execute", confirmation: "never" }, resultSchemaId: "treeseed.communication-send-receipt/v1", execution: unavailable() },
|
|
94
118
|
branch("auth", [leaf("login", "mutation", void 0, "credential"), leaf("logout", "mutation"), leaf("status")]),
|
|
95
119
|
branch("secrets", [leaf("list"), leaf("status"), leaf("unlock", "mutation", void 0, "credential"), leaf("lock", "mutation"), leaf("rotate", "mutation", void 0, "credential")]),
|
|
120
|
+
branch("host", [
|
|
121
|
+
leaf("status"),
|
|
122
|
+
leaf("doctor"),
|
|
123
|
+
leaf("plan"),
|
|
124
|
+
leaf("apply", "mutation", void 0, "authority"),
|
|
125
|
+
leaf("reconcile", "mutation", void 0, "authority"),
|
|
126
|
+
leaf("events"),
|
|
127
|
+
branch("update", [leaf("status"), leaf("check", "mutation"), leaf("apply", "mutation", void 0, "authority"), leaf("channel", "mutation", "track", "authority"), leaf("pause", "mutation", void 0, "authority"), leaf("resume", "mutation", void 0, "authority")]),
|
|
128
|
+
branch("component", [leaf("list"), leaf("status", "read", "component"), leaf("enable", "mutation", "component", "authority"), leaf("disable", "mutation", "component", "destructive")]),
|
|
129
|
+
branch("aliases", [leaf("list")]),
|
|
130
|
+
branch("recovery", [leaf("status"), leaf("retry", "mutation", void 0, "authority"), leaf("restore", "mutation", "generation", "destructive")]),
|
|
131
|
+
branch("bootstrap", [leaf("status"), leaf("enroll", "mutation", void 0, "credential")])
|
|
132
|
+
]),
|
|
96
133
|
branch("agents", [
|
|
97
134
|
leaf("list"),
|
|
98
135
|
leaf("show", "read", "agent"),
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export declare function communicationOperations(): {
|
|
2
|
+
send: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
3
|
+
teamId: string;
|
|
4
|
+
channel: string;
|
|
5
|
+
}, {}, {
|
|
6
|
+
message: string;
|
|
7
|
+
projectId?: string | undefined;
|
|
8
|
+
recipients?: string[] | undefined;
|
|
9
|
+
topic?: string | undefined;
|
|
10
|
+
waitSeconds?: number | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
13
|
+
schemaVersion: "treeseed.communication-send-receipt/v1";
|
|
14
|
+
createdAt: string;
|
|
15
|
+
responses: {
|
|
16
|
+
status: "failed" | "cancelled" | "responded";
|
|
17
|
+
createdAt: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
agentSlug: string;
|
|
20
|
+
assignmentId: string | null;
|
|
21
|
+
invocationId: string;
|
|
22
|
+
messageRef: string;
|
|
23
|
+
markdown: string;
|
|
24
|
+
}[];
|
|
25
|
+
teamId: string;
|
|
26
|
+
channel: string;
|
|
27
|
+
topic: string | null;
|
|
28
|
+
messageRef: string;
|
|
29
|
+
sendId: string;
|
|
30
|
+
discussionId: string;
|
|
31
|
+
targets: {
|
|
32
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
33
|
+
projectId: string;
|
|
34
|
+
agentSlug: string;
|
|
35
|
+
projectSlug: string;
|
|
36
|
+
definitionRevision: string;
|
|
37
|
+
invocationId: string | null;
|
|
38
|
+
}[];
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
}>;
|
|
41
|
+
sendStatus: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
42
|
+
teamId: string;
|
|
43
|
+
sendId: string;
|
|
44
|
+
}, {}, undefined, {
|
|
45
|
+
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
46
|
+
schemaVersion: "treeseed.communication-send-receipt/v1";
|
|
47
|
+
createdAt: string;
|
|
48
|
+
responses: {
|
|
49
|
+
status: "failed" | "cancelled" | "responded";
|
|
50
|
+
createdAt: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
agentSlug: string;
|
|
53
|
+
assignmentId: string | null;
|
|
54
|
+
invocationId: string;
|
|
55
|
+
messageRef: string;
|
|
56
|
+
markdown: string;
|
|
57
|
+
}[];
|
|
58
|
+
teamId: string;
|
|
59
|
+
channel: string;
|
|
60
|
+
topic: string | null;
|
|
61
|
+
messageRef: string;
|
|
62
|
+
sendId: string;
|
|
63
|
+
discussionId: string;
|
|
64
|
+
targets: {
|
|
65
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
66
|
+
projectId: string;
|
|
67
|
+
agentSlug: string;
|
|
68
|
+
projectSlug: string;
|
|
69
|
+
definitionRevision: string;
|
|
70
|
+
invocationId: string | null;
|
|
71
|
+
}[];
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
export declare function providerDiscussionResponseOperation(): import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
76
|
+
assignmentId: string;
|
|
77
|
+
}, {}, {
|
|
78
|
+
markdown: string;
|
|
79
|
+
leaseToken: string;
|
|
80
|
+
runnerId: string;
|
|
81
|
+
summary?: string | undefined;
|
|
82
|
+
usage?: Record<string, unknown> | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
status: "responded";
|
|
85
|
+
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
86
|
+
assignmentId: string;
|
|
87
|
+
invocationId: string;
|
|
88
|
+
messageRef: string;
|
|
89
|
+
settledAt: string;
|
|
90
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-builder.js";
|
|
3
|
+
import {
|
|
4
|
+
communicationSendReceiptSchema,
|
|
5
|
+
communicationSendRequestSchema,
|
|
6
|
+
providerDiscussionResponseReceiptSchema,
|
|
7
|
+
providerDiscussionResponseRequestSchema
|
|
8
|
+
} from "../communication/contracts.js";
|
|
9
|
+
const empty = z.object({}).strict();
|
|
10
|
+
const none = z.undefined();
|
|
11
|
+
function communicationOperations() {
|
|
12
|
+
return {
|
|
13
|
+
send: defineOperation({ operationId: "communications.send", description: "Post a team-channel message and admit the selected project agents to the communication lane.", rest: { method: "POST", path: "/v1/teams/{teamId}/channels/{channel}/messages" }, parameters: "treeseed.communications.send.parameters/v1", capability: "agents.execute", authentication: "oauth", oauthScopes: ["treeseed:execution"], kind: "mutation", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "cli", "mcp_tool"], cacheScope: "none", pagination: "none" }, {
|
|
14
|
+
path: z.object({ teamId: z.string().min(1), channel: z.string().trim().min(1).max(120) }).strict(),
|
|
15
|
+
query: empty,
|
|
16
|
+
body: communicationSendRequestSchema,
|
|
17
|
+
output: communicationSendReceiptSchema
|
|
18
|
+
}),
|
|
19
|
+
sendStatus: defineOperation({ operationId: "communications.sends.show", description: "Read a communication send and its durable agent responses.", rest: { method: "GET", path: "/v1/teams/{teamId}/communication-sends/{sendId}" }, parameters: "treeseed.communications.sends.show.parameters/v1", capability: "agents.read", authentication: "oauth", oauthScopes: ["treeseed:read"], kind: "read", riskClass: "ordinary", confirmation: "never", surfaces: ["rest", "mcp_tool", "mcp_resource"], cacheScope: "principal", pagination: "none" }, {
|
|
20
|
+
path: z.object({ teamId: z.string().min(1), sendId: z.string().min(1) }).strict(),
|
|
21
|
+
query: empty,
|
|
22
|
+
body: none,
|
|
23
|
+
output: communicationSendReceiptSchema
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function providerDiscussionResponseOperation() {
|
|
28
|
+
return defineOperation({ operationId: "providers.assignments.discussion.respond", description: "Commit and settle an assignment-scoped discussion response.", rest: { method: "POST", path: "/v1/provider/assignments/{assignmentId}/discussion-response" }, parameters: "treeseed.providers.assignments.discussion.respond.parameters/v1", capability: "providers.execute", authentication: "provider", oauthScopes: [], kind: "mutation", riskClass: "ordinary", confirmation: "never", surfaces: ["rest"], cacheScope: "none", pagination: "none" }, {
|
|
29
|
+
path: z.object({ assignmentId: z.string().min(1) }).strict(),
|
|
30
|
+
query: empty,
|
|
31
|
+
body: providerDiscussionResponseRequestSchema,
|
|
32
|
+
output: providerDiscussionResponseReceiptSchema
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
communicationOperations,
|
|
37
|
+
providerDiscussionResponseOperation
|
|
38
|
+
};
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const communicationRecipientSchema: z.ZodObject<{
|
|
3
|
+
projectId: z.ZodString;
|
|
4
|
+
agentSlug: z.ZodString;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
projectId: string;
|
|
7
|
+
agentSlug: string;
|
|
8
|
+
}, {
|
|
9
|
+
projectId: string;
|
|
10
|
+
agentSlug: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const communicationSendRequestSchema: z.ZodObject<{
|
|
13
|
+
message: z.ZodString;
|
|
14
|
+
topic: z.ZodOptional<z.ZodString>;
|
|
15
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
16
|
+
recipients: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
17
|
+
waitSeconds: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
message: string;
|
|
20
|
+
projectId?: string | undefined;
|
|
21
|
+
recipients?: string[] | undefined;
|
|
22
|
+
topic?: string | undefined;
|
|
23
|
+
waitSeconds?: number | undefined;
|
|
24
|
+
}, {
|
|
25
|
+
message: string;
|
|
26
|
+
projectId?: string | undefined;
|
|
27
|
+
recipients?: string[] | undefined;
|
|
28
|
+
topic?: string | undefined;
|
|
29
|
+
waitSeconds?: number | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const communicationTargetSchema: z.ZodObject<{
|
|
32
|
+
projectId: z.ZodString;
|
|
33
|
+
agentSlug: z.ZodString;
|
|
34
|
+
} & {
|
|
35
|
+
projectSlug: z.ZodString;
|
|
36
|
+
definitionRevision: z.ZodString;
|
|
37
|
+
invocationId: z.ZodNullable<z.ZodString>;
|
|
38
|
+
status: z.ZodEnum<["queued", "running", "responded", "failed", "cancelled"]>;
|
|
39
|
+
}, "strict", z.ZodTypeAny, {
|
|
40
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
41
|
+
projectId: string;
|
|
42
|
+
agentSlug: string;
|
|
43
|
+
projectSlug: string;
|
|
44
|
+
definitionRevision: string;
|
|
45
|
+
invocationId: string | null;
|
|
46
|
+
}, {
|
|
47
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
48
|
+
projectId: string;
|
|
49
|
+
agentSlug: string;
|
|
50
|
+
projectSlug: string;
|
|
51
|
+
definitionRevision: string;
|
|
52
|
+
invocationId: string | null;
|
|
53
|
+
}>;
|
|
54
|
+
export declare const communicationResponseSchema: z.ZodObject<{
|
|
55
|
+
projectId: z.ZodString;
|
|
56
|
+
agentSlug: z.ZodString;
|
|
57
|
+
} & {
|
|
58
|
+
invocationId: z.ZodString;
|
|
59
|
+
assignmentId: z.ZodNullable<z.ZodString>;
|
|
60
|
+
messageRef: z.ZodString;
|
|
61
|
+
markdown: z.ZodString;
|
|
62
|
+
status: z.ZodEnum<["responded", "failed", "cancelled"]>;
|
|
63
|
+
createdAt: z.ZodString;
|
|
64
|
+
}, "strict", z.ZodTypeAny, {
|
|
65
|
+
status: "failed" | "cancelled" | "responded";
|
|
66
|
+
createdAt: string;
|
|
67
|
+
projectId: string;
|
|
68
|
+
agentSlug: string;
|
|
69
|
+
assignmentId: string | null;
|
|
70
|
+
invocationId: string;
|
|
71
|
+
messageRef: string;
|
|
72
|
+
markdown: string;
|
|
73
|
+
}, {
|
|
74
|
+
status: "failed" | "cancelled" | "responded";
|
|
75
|
+
createdAt: string;
|
|
76
|
+
projectId: string;
|
|
77
|
+
agentSlug: string;
|
|
78
|
+
assignmentId: string | null;
|
|
79
|
+
invocationId: string;
|
|
80
|
+
messageRef: string;
|
|
81
|
+
markdown: string;
|
|
82
|
+
}>;
|
|
83
|
+
export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
84
|
+
schemaVersion: z.ZodLiteral<"treeseed.communication-send-receipt/v1">;
|
|
85
|
+
sendId: z.ZodString;
|
|
86
|
+
teamId: z.ZodString;
|
|
87
|
+
channel: z.ZodString;
|
|
88
|
+
topic: z.ZodNullable<z.ZodString>;
|
|
89
|
+
discussionId: z.ZodString;
|
|
90
|
+
messageRef: z.ZodString;
|
|
91
|
+
status: z.ZodEnum<["queued", "running", "complete", "partial", "failed"]>;
|
|
92
|
+
targets: z.ZodArray<z.ZodObject<{
|
|
93
|
+
projectId: z.ZodString;
|
|
94
|
+
agentSlug: z.ZodString;
|
|
95
|
+
} & {
|
|
96
|
+
projectSlug: z.ZodString;
|
|
97
|
+
definitionRevision: z.ZodString;
|
|
98
|
+
invocationId: z.ZodNullable<z.ZodString>;
|
|
99
|
+
status: z.ZodEnum<["queued", "running", "responded", "failed", "cancelled"]>;
|
|
100
|
+
}, "strict", z.ZodTypeAny, {
|
|
101
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
102
|
+
projectId: string;
|
|
103
|
+
agentSlug: string;
|
|
104
|
+
projectSlug: string;
|
|
105
|
+
definitionRevision: string;
|
|
106
|
+
invocationId: string | null;
|
|
107
|
+
}, {
|
|
108
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
109
|
+
projectId: string;
|
|
110
|
+
agentSlug: string;
|
|
111
|
+
projectSlug: string;
|
|
112
|
+
definitionRevision: string;
|
|
113
|
+
invocationId: string | null;
|
|
114
|
+
}>, "many">;
|
|
115
|
+
responses: z.ZodArray<z.ZodObject<{
|
|
116
|
+
projectId: z.ZodString;
|
|
117
|
+
agentSlug: z.ZodString;
|
|
118
|
+
} & {
|
|
119
|
+
invocationId: z.ZodString;
|
|
120
|
+
assignmentId: z.ZodNullable<z.ZodString>;
|
|
121
|
+
messageRef: z.ZodString;
|
|
122
|
+
markdown: z.ZodString;
|
|
123
|
+
status: z.ZodEnum<["responded", "failed", "cancelled"]>;
|
|
124
|
+
createdAt: z.ZodString;
|
|
125
|
+
}, "strict", z.ZodTypeAny, {
|
|
126
|
+
status: "failed" | "cancelled" | "responded";
|
|
127
|
+
createdAt: string;
|
|
128
|
+
projectId: string;
|
|
129
|
+
agentSlug: string;
|
|
130
|
+
assignmentId: string | null;
|
|
131
|
+
invocationId: string;
|
|
132
|
+
messageRef: string;
|
|
133
|
+
markdown: string;
|
|
134
|
+
}, {
|
|
135
|
+
status: "failed" | "cancelled" | "responded";
|
|
136
|
+
createdAt: string;
|
|
137
|
+
projectId: string;
|
|
138
|
+
agentSlug: string;
|
|
139
|
+
assignmentId: string | null;
|
|
140
|
+
invocationId: string;
|
|
141
|
+
messageRef: string;
|
|
142
|
+
markdown: string;
|
|
143
|
+
}>, "many">;
|
|
144
|
+
createdAt: z.ZodString;
|
|
145
|
+
updatedAt: z.ZodString;
|
|
146
|
+
}, "strict", z.ZodTypeAny, {
|
|
147
|
+
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
148
|
+
schemaVersion: "treeseed.communication-send-receipt/v1";
|
|
149
|
+
createdAt: string;
|
|
150
|
+
responses: {
|
|
151
|
+
status: "failed" | "cancelled" | "responded";
|
|
152
|
+
createdAt: string;
|
|
153
|
+
projectId: string;
|
|
154
|
+
agentSlug: string;
|
|
155
|
+
assignmentId: string | null;
|
|
156
|
+
invocationId: string;
|
|
157
|
+
messageRef: string;
|
|
158
|
+
markdown: string;
|
|
159
|
+
}[];
|
|
160
|
+
teamId: string;
|
|
161
|
+
channel: string;
|
|
162
|
+
topic: string | null;
|
|
163
|
+
messageRef: string;
|
|
164
|
+
sendId: string;
|
|
165
|
+
discussionId: string;
|
|
166
|
+
targets: {
|
|
167
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
168
|
+
projectId: string;
|
|
169
|
+
agentSlug: string;
|
|
170
|
+
projectSlug: string;
|
|
171
|
+
definitionRevision: string;
|
|
172
|
+
invocationId: string | null;
|
|
173
|
+
}[];
|
|
174
|
+
updatedAt: string;
|
|
175
|
+
}, {
|
|
176
|
+
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
177
|
+
schemaVersion: "treeseed.communication-send-receipt/v1";
|
|
178
|
+
createdAt: string;
|
|
179
|
+
responses: {
|
|
180
|
+
status: "failed" | "cancelled" | "responded";
|
|
181
|
+
createdAt: string;
|
|
182
|
+
projectId: string;
|
|
183
|
+
agentSlug: string;
|
|
184
|
+
assignmentId: string | null;
|
|
185
|
+
invocationId: string;
|
|
186
|
+
messageRef: string;
|
|
187
|
+
markdown: string;
|
|
188
|
+
}[];
|
|
189
|
+
teamId: string;
|
|
190
|
+
channel: string;
|
|
191
|
+
topic: string | null;
|
|
192
|
+
messageRef: string;
|
|
193
|
+
sendId: string;
|
|
194
|
+
discussionId: string;
|
|
195
|
+
targets: {
|
|
196
|
+
status: "failed" | "running" | "cancelled" | "queued" | "responded";
|
|
197
|
+
projectId: string;
|
|
198
|
+
agentSlug: string;
|
|
199
|
+
projectSlug: string;
|
|
200
|
+
definitionRevision: string;
|
|
201
|
+
invocationId: string | null;
|
|
202
|
+
}[];
|
|
203
|
+
updatedAt: string;
|
|
204
|
+
}>;
|
|
205
|
+
export declare const providerDiscussionResponseRequestSchema: z.ZodObject<{
|
|
206
|
+
leaseToken: z.ZodString;
|
|
207
|
+
runnerId: z.ZodString;
|
|
208
|
+
markdown: z.ZodString;
|
|
209
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
210
|
+
usage: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
211
|
+
}, "strict", z.ZodTypeAny, {
|
|
212
|
+
markdown: string;
|
|
213
|
+
leaseToken: string;
|
|
214
|
+
runnerId: string;
|
|
215
|
+
summary?: string | undefined;
|
|
216
|
+
usage?: Record<string, unknown> | undefined;
|
|
217
|
+
}, {
|
|
218
|
+
markdown: string;
|
|
219
|
+
leaseToken: string;
|
|
220
|
+
runnerId: string;
|
|
221
|
+
summary?: string | undefined;
|
|
222
|
+
usage?: Record<string, unknown> | undefined;
|
|
223
|
+
}>;
|
|
224
|
+
export declare const providerDiscussionResponseReceiptSchema: z.ZodObject<{
|
|
225
|
+
schemaVersion: z.ZodLiteral<"treeseed.provider-discussion-response-receipt/v1">;
|
|
226
|
+
assignmentId: z.ZodString;
|
|
227
|
+
invocationId: z.ZodString;
|
|
228
|
+
messageRef: z.ZodString;
|
|
229
|
+
status: z.ZodLiteral<"responded">;
|
|
230
|
+
settledAt: z.ZodString;
|
|
231
|
+
}, "strict", z.ZodTypeAny, {
|
|
232
|
+
status: "responded";
|
|
233
|
+
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
234
|
+
assignmentId: string;
|
|
235
|
+
invocationId: string;
|
|
236
|
+
messageRef: string;
|
|
237
|
+
settledAt: string;
|
|
238
|
+
}, {
|
|
239
|
+
status: "responded";
|
|
240
|
+
schemaVersion: "treeseed.provider-discussion-response-receipt/v1";
|
|
241
|
+
assignmentId: string;
|
|
242
|
+
invocationId: string;
|
|
243
|
+
messageRef: string;
|
|
244
|
+
settledAt: string;
|
|
245
|
+
}>;
|
|
246
|
+
export type CommunicationSendRequest = z.infer<typeof communicationSendRequestSchema>;
|
|
247
|
+
export type CommunicationSendReceipt = z.infer<typeof communicationSendReceiptSchema>;
|
|
248
|
+
export type CommunicationResponse = z.infer<typeof communicationResponseSchema>;
|
|
249
|
+
export type ProviderDiscussionResponseRequest = z.infer<typeof providerDiscussionResponseRequestSchema>;
|
|
250
|
+
export type ProviderDiscussionResponseReceipt = z.infer<typeof providerDiscussionResponseReceiptSchema>;
|