@treeseed/sdk 0.13.0-rc.39 → 0.13.0-rc.41
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 +384 -384
- package/dist/content/validation/agent-operational-content-schemas.d.ts +66 -66
- package/dist/content/validation/auxiliary-content-schemas.d.ts +16 -16
- package/dist/content/validation/content-model-schemas.d.ts +869 -869
- package/dist/content/validation/portable-content-data.d.ts +93 -93
- package/dist/deployment/schemas.d.ts +782 -782
- package/dist/development/index.d.ts +1 -0
- package/dist/development/index.js +1 -0
- package/dist/development/schemas.d.ts +3149 -0
- package/dist/development/schemas.js +153 -0
- package/dist/operator-contracts/canonical-command-tree.js +35 -0
- package/dist/operator-contracts/catalog/admin-account-team-operations.d.ts +33 -0
- package/dist/operator-contracts/catalog/admin-account-team-operations.js +51 -0
- package/dist/operator-contracts/catalog/communication-operations.d.ts +40 -40
- package/dist/operator-contracts/communication/contracts.d.ts +44 -44
- package/dist/operator-contracts/control-plane-operations.d.ts +75 -46
- package/dist/operator-contracts/control-plane-operations.js +3 -0
- package/package.json +5 -1
|
@@ -0,0 +1,153 @@
|
|
|
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 relativePath = z.string().min(1).max(512).refine((value) => {
|
|
6
|
+
if (value.startsWith("/") || value.includes("\\") || value.includes("\0")) return false;
|
|
7
|
+
return !value.split("/").some((part) => part === ".." || part === "");
|
|
8
|
+
}, "Paths must be safe, normalized, repository-relative paths.");
|
|
9
|
+
const environmentName = z.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/u);
|
|
10
|
+
const localAlias = z.string().regex(/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)*\.localhost$/u);
|
|
11
|
+
const developmentModeSchema = z.enum(["released", "candidate", "live"]);
|
|
12
|
+
const developmentTargetKindSchema = z.enum(["package-watch", "live-web", "live-api", "rebuild-restart", "local-companion"]);
|
|
13
|
+
const developmentReactionSchema = z.enum(["reload", "restart", "rebuild", "stale", "manual", "none"]);
|
|
14
|
+
const developmentStatePolicySchema = z.enum(["stateless", "ephemeral", "clone", "shared-compatible"]);
|
|
15
|
+
const operationSchema = z.object({
|
|
16
|
+
command: z.string().min(1).max(256),
|
|
17
|
+
args: z.array(z.string().max(4096)).max(64).default([]),
|
|
18
|
+
cwd: relativePath.optional(),
|
|
19
|
+
environment: z.record(environmentName, z.string().max(16384)).default({}),
|
|
20
|
+
timeoutSeconds: z.number().int().positive().max(86400).default(600)
|
|
21
|
+
}).strict();
|
|
22
|
+
const readinessSchema = z.discriminatedUnion("kind", [
|
|
23
|
+
z.object({ kind: z.literal("marker"), path: relativePath, timeoutSeconds: z.number().int().positive().max(3600) }).strict(),
|
|
24
|
+
z.object({ kind: z.literal("http"), path: z.string().startsWith("/"), expectedStatus: z.number().int().min(100).max(599).default(200), timeoutSeconds: z.number().int().positive().max(3600) }).strict(),
|
|
25
|
+
z.object({ kind: z.literal("tcp"), timeoutSeconds: z.number().int().positive().max(3600) }).strict(),
|
|
26
|
+
z.object({ kind: z.literal("process"), graceSeconds: z.number().int().nonnegative().max(600).default(2) }).strict()
|
|
27
|
+
]);
|
|
28
|
+
const endpointSchema = z.object({
|
|
29
|
+
id: identifier,
|
|
30
|
+
protocol: z.enum(["http", "https", "tcp"]),
|
|
31
|
+
port: z.number().int().min(1).max(65535),
|
|
32
|
+
canonicalAlias: localAlias.optional(),
|
|
33
|
+
visibility: z.enum(["host", "loopback", "private"]),
|
|
34
|
+
authentication: z.enum(["none", "application", "mtls"]).default("none")
|
|
35
|
+
}).strict().superRefine((endpoint, context) => {
|
|
36
|
+
if (endpoint.visibility === "host" && !endpoint.canonicalAlias) context.addIssue({ code: z.ZodIssueCode.custom, path: ["canonicalAlias"], message: "Host-visible endpoints require a canonical .localhost alias." });
|
|
37
|
+
if (endpoint.visibility !== "host" && endpoint.canonicalAlias) context.addIssue({ code: z.ZodIssueCode.custom, path: ["canonicalAlias"], message: "Only host-visible endpoints may request a canonical alias." });
|
|
38
|
+
});
|
|
39
|
+
const outputSchema = z.object({
|
|
40
|
+
path: relativePath,
|
|
41
|
+
mediaType: z.string().min(1).max(256),
|
|
42
|
+
completionMarker: relativePath.optional(),
|
|
43
|
+
digestAlgorithm: z.literal("sha256").default("sha256")
|
|
44
|
+
}).strict();
|
|
45
|
+
const dependencySchema = z.object({
|
|
46
|
+
id: identifier,
|
|
47
|
+
target: identifier,
|
|
48
|
+
capability: identifier.optional(),
|
|
49
|
+
locality: z.enum(["local", "remote", "either"]).default("either"),
|
|
50
|
+
reaction: developmentReactionSchema
|
|
51
|
+
}).strict();
|
|
52
|
+
const freezeSchema = z.object({
|
|
53
|
+
kind: z.enum(["npm-package", "oci-image", "archive", "executable"]),
|
|
54
|
+
operation: operationSchema,
|
|
55
|
+
artifacts: z.array(relativePath).min(1),
|
|
56
|
+
contractOperations: z.array(operationSchema).default([])
|
|
57
|
+
}).strict();
|
|
58
|
+
const developmentTargetSchema = z.object({
|
|
59
|
+
id: identifier,
|
|
60
|
+
kind: developmentTargetKindSchema,
|
|
61
|
+
platforms: z.array(z.enum(["linux-amd64", "linux-arm64", "darwin-arm64", "darwin-amd64"])).min(1),
|
|
62
|
+
runtimeRequirements: z.array(z.string().min(1).max(128)).default([]),
|
|
63
|
+
sourceRoots: z.array(relativePath).min(1),
|
|
64
|
+
ignoredPaths: z.array(relativePath).default([]),
|
|
65
|
+
operations: z.object({
|
|
66
|
+
setup: operationSchema.optional(),
|
|
67
|
+
watch: operationSchema.optional(),
|
|
68
|
+
build: operationSchema.optional(),
|
|
69
|
+
start: operationSchema.optional(),
|
|
70
|
+
stop: operationSchema.optional(),
|
|
71
|
+
verify: operationSchema.optional(),
|
|
72
|
+
cleanup: operationSchema.optional()
|
|
73
|
+
}).strict(),
|
|
74
|
+
ready: readinessSchema,
|
|
75
|
+
outputs: z.array(outputSchema).default([]),
|
|
76
|
+
endpoints: z.array(endpointSchema).default([]),
|
|
77
|
+
dependencies: z.array(dependencySchema).default([]),
|
|
78
|
+
statePolicy: developmentStatePolicySchema,
|
|
79
|
+
migrationPolicy: z.enum(["none", "explicit-review", "disposable-only"]),
|
|
80
|
+
secretRefs: z.record(environmentName, identifier).default({}),
|
|
81
|
+
shutdown: z.object({ drainOperation: operationSchema.optional(), graceSeconds: z.number().int().nonnegative().max(3600).default(30), activeWorkPolicy: z.enum(["block", "drain", "cancel-authorized"]).default("block") }).strict(),
|
|
82
|
+
resources: z.object({ cpuCores: z.number().positive().optional(), memoryBytes: z.number().int().positive().optional(), diskBytes: z.number().int().positive().optional() }).strict().default({}),
|
|
83
|
+
logs: z.array(relativePath).default([]),
|
|
84
|
+
forbiddenOperations: z.array(z.string().min(1).max(128)).default([]),
|
|
85
|
+
freeze: freezeSchema.optional(),
|
|
86
|
+
promotion: z.object({ liveAdmissible: z.literal(false), candidateRequiresVerification: z.literal(true) }).strict()
|
|
87
|
+
}).strict().superRefine((target, context) => {
|
|
88
|
+
const endpoints = target.endpoints.map((entry) => entry.id);
|
|
89
|
+
if (new Set(endpoints).size !== endpoints.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endpoints"], message: "Development endpoint IDs must be unique." });
|
|
90
|
+
if (target.kind === "package-watch" && target.endpoints.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endpoints"], message: "Package-watch targets cannot own service endpoints." });
|
|
91
|
+
if (target.kind === "local-companion" && target.endpoints.some((entry) => entry.visibility !== "loopback")) context.addIssue({ code: z.ZodIssueCode.custom, path: ["endpoints"], message: "Local companions must remain loopback-only." });
|
|
92
|
+
if (target.kind !== "package-watch" && target.ready.kind === "marker") context.addIssue({ code: z.ZodIssueCode.custom, path: ["ready"], message: "Service targets require process, TCP, or HTTP readiness." });
|
|
93
|
+
if (target.statePolicy === "shared-compatible" && target.migrationPolicy !== "explicit-review") context.addIssue({ code: z.ZodIssueCode.custom, path: ["migrationPolicy"], message: "Shared state requires explicit migration review." });
|
|
94
|
+
});
|
|
95
|
+
const developmentRuntimeSchema = z.object({
|
|
96
|
+
schemaVersion: z.literal("treeseed.development-runtime/v1"),
|
|
97
|
+
project: z.object({ id: identifier, repository: z.string().regex(/^[a-z0-9_.-]+\/[a-z0-9_.-]+$/iu) }).strict(),
|
|
98
|
+
defaults: z.object({ leaseSeconds: z.number().int().min(60).max(86400).default(14400), restoreOnFailure: z.boolean().default(true) }).strict(),
|
|
99
|
+
targets: z.array(developmentTargetSchema).min(1)
|
|
100
|
+
}).strict().superRefine((runtime, context) => {
|
|
101
|
+
const ids = runtime.targets.map((target) => target.id);
|
|
102
|
+
if (new Set(ids).size !== ids.length) context.addIssue({ code: z.ZodIssueCode.custom, path: ["targets"], message: "Development target IDs must be unique." });
|
|
103
|
+
});
|
|
104
|
+
const repositoryClosureSchema = z.object({
|
|
105
|
+
projectId: identifier,
|
|
106
|
+
repository: z.string().min(1),
|
|
107
|
+
worktree: z.string().min(1),
|
|
108
|
+
commit: gitCommit,
|
|
109
|
+
branch: z.string().min(1).nullable(),
|
|
110
|
+
dirty: z.boolean(),
|
|
111
|
+
dirtyDigest: digest.nullable(),
|
|
112
|
+
recipeDigest: digest
|
|
113
|
+
}).strict();
|
|
114
|
+
const developmentSessionSchema = z.object({
|
|
115
|
+
schemaVersion: z.literal("treeseed.development-session/v1"),
|
|
116
|
+
sessionId: identifier,
|
|
117
|
+
actor: z.string().min(1).max(256),
|
|
118
|
+
hostId: identifier,
|
|
119
|
+
createdAt: z.string().datetime(),
|
|
120
|
+
expiresAt: z.string().datetime(),
|
|
121
|
+
status: z.enum(["planning", "active", "degraded", "restoring", "stopped", "expired"]),
|
|
122
|
+
repositories: z.array(repositoryClosureSchema),
|
|
123
|
+
targets: z.array(z.object({ projectId: identifier, targetId: identifier, mode: developmentModeSchema, generation: z.number().int().nonnegative(), health: z.enum(["pending", "ready", "degraded", "stopped"]), reaction: developmentReactionSchema.optional() }).strict()),
|
|
124
|
+
leases: z.array(z.object({ kind: z.enum(["alias", "component", "state", "secret"]), resource: z.string().min(1), acquiredAt: z.string().datetime(), expiresAt: z.string().datetime() }).strict()),
|
|
125
|
+
restoredReceiptId: identifier.nullable(),
|
|
126
|
+
blockers: z.array(z.object({ code: identifier, message: z.string().min(1), targetId: identifier.optional() }).strict())
|
|
127
|
+
}).strict();
|
|
128
|
+
const developmentCandidateSchema = z.object({
|
|
129
|
+
schemaVersion: z.literal("treeseed.development-candidate/v1"),
|
|
130
|
+
candidateId: identifier,
|
|
131
|
+
sessionId: identifier,
|
|
132
|
+
createdAt: z.string().datetime(),
|
|
133
|
+
source: z.array(repositoryClosureSchema),
|
|
134
|
+
artifacts: z.array(z.object({ projectId: identifier, targetId: identifier, kind: z.enum(["npm-package", "oci-image", "archive", "executable", "contract-bundle"]), identity: z.string().min(1), digest, integrity: z.string().min(1).optional() }).strict()).min(1),
|
|
135
|
+
configurationDigest: digest,
|
|
136
|
+
dependencyGenerations: z.record(z.number().int().nonnegative()),
|
|
137
|
+
compatibilityAttestations: z.array(z.object({ contractId: z.string().min(1), digest, compatible: z.boolean(), minimumBump: z.enum(["none", "patch", "minor", "major"]) }).strict()),
|
|
138
|
+
verification: z.object({ status: z.enum(["pending", "passed", "failed"]), operations: z.array(z.string().min(1)), completedAt: z.string().datetime().nullable() }).strict(),
|
|
139
|
+
promotable: z.boolean()
|
|
140
|
+
}).strict().superRefine((candidate, context) => {
|
|
141
|
+
if (candidate.source.some((source) => source.dirty) && candidate.promotable) context.addIssue({ code: z.ZodIssueCode.custom, path: ["promotable"], message: "Candidates containing dirty source cannot be promotable." });
|
|
142
|
+
if (candidate.verification.status !== "passed" && candidate.promotable) context.addIssue({ code: z.ZodIssueCode.custom, path: ["promotable"], message: "Only verified candidates can be promotable." });
|
|
143
|
+
});
|
|
144
|
+
export {
|
|
145
|
+
developmentCandidateSchema,
|
|
146
|
+
developmentModeSchema,
|
|
147
|
+
developmentReactionSchema,
|
|
148
|
+
developmentRuntimeSchema,
|
|
149
|
+
developmentSessionSchema,
|
|
150
|
+
developmentStatePolicySchema,
|
|
151
|
+
developmentTargetKindSchema,
|
|
152
|
+
developmentTargetSchema
|
|
153
|
+
};
|
|
@@ -53,6 +53,15 @@ const operationBindings = {
|
|
|
53
53
|
"host bootstrap status": local("local.host.bootstrap.status"),
|
|
54
54
|
"host bootstrap enroll": local("local.host.bootstrap.enroll"),
|
|
55
55
|
"host reset": local("local.host.reset"),
|
|
56
|
+
"dev session start": local("local.dev.session.start"),
|
|
57
|
+
"dev session stop": local("local.dev.session.stop"),
|
|
58
|
+
"dev use": local("local.dev.use"),
|
|
59
|
+
"dev rebuild": local("local.dev.rebuild"),
|
|
60
|
+
"dev status": local("local.dev.status"),
|
|
61
|
+
"dev logs": local("local.dev.logs"),
|
|
62
|
+
"dev plan": local("local.dev.plan"),
|
|
63
|
+
"dev freeze": local("local.dev.freeze"),
|
|
64
|
+
"dev verify": local("local.dev.verify"),
|
|
56
65
|
"agents list": operation("agents.list", [field("path", "projectId", "context", "project", true), ...page()]),
|
|
57
66
|
"agents show": operation("agents.show", [field("path", "projectId", "context", "project", true), field("path", "agentSlug", "argument", "agent", true)]),
|
|
58
67
|
"agents classes list": operation("agents.classes.list", [field("path", "projectId", "context", "project", true)]),
|
|
@@ -191,6 +200,19 @@ function addOptions(node, options) {
|
|
|
191
200
|
if (node.nodeType === "leaf") node.options = [...node.options ?? [], ...options];
|
|
192
201
|
return node;
|
|
193
202
|
}
|
|
203
|
+
function developmentCommand(segment, kind, argument, options = []) {
|
|
204
|
+
return {
|
|
205
|
+
nodeType: "leaf",
|
|
206
|
+
segment,
|
|
207
|
+
description: `${segment[0].toUpperCase()}${segment.slice(1)} a local development session.`,
|
|
208
|
+
kind,
|
|
209
|
+
arguments: argument ? [{ name: argument, description: `${argument} value.`, required: true }] : void 0,
|
|
210
|
+
options: [...kind === "mutation" ? [planOption] : [], ...options],
|
|
211
|
+
authorization: kind === "mutation" ? { capability: `development.${segment}`, confirmation: "never" } : void 0,
|
|
212
|
+
resultSchemaId: `treeseed.command.dev.${segment}/v1`,
|
|
213
|
+
execution: local(`local.dev.${segment}`)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
194
216
|
const commandTree = {
|
|
195
217
|
schemaVersion: "treeseed.command-tree/v1",
|
|
196
218
|
executable: "trsd",
|
|
@@ -200,6 +222,19 @@ const commandTree = {
|
|
|
200
222
|
branch("users", [userCreate()]),
|
|
201
223
|
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() }]),
|
|
202
224
|
branch("secrets", [leaf("list"), leaf("status"), leaf("unlock", "mutation", void 0, "credential"), leaf("lock", "mutation"), leaf("rotate", "mutation", void 0, "credential")]),
|
|
225
|
+
branch("dev", [
|
|
226
|
+
branch("session", [
|
|
227
|
+
developmentCommand("start", "mutation", "manifest", [{ name: "--actor", description: "Audited development-session actor.", type: "string" }, { name: "--lease-seconds", description: "Requested bounded lease duration.", type: "number" }]),
|
|
228
|
+
developmentCommand("stop", "mutation", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--restore", description: "Restore released routes and targets.", type: "boolean" }])
|
|
229
|
+
]),
|
|
230
|
+
developmentCommand("use", "mutation", "selection", [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--target", description: "Additional project.target=mode selections.", type: "string[]" }]),
|
|
231
|
+
developmentCommand("rebuild", "mutation", "target", [{ name: "--session", description: "Development session identity.", type: "string" }]),
|
|
232
|
+
developmentCommand("status", "read", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--all", description: "Include stopped and expired sessions.", type: "boolean" }]),
|
|
233
|
+
developmentCommand("logs", "read", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--target", description: "Development target identity.", type: "string" }, { name: "--follow", description: "Follow target logs.", type: "boolean" }]),
|
|
234
|
+
developmentCommand("plan", "read", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--affected", description: "Show the smallest affected closure.", type: "boolean" }]),
|
|
235
|
+
developmentCommand("freeze", "mutation", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--allow-dirty", description: "Create a non-promotable dirty-source candidate.", type: "boolean" }]),
|
|
236
|
+
developmentCommand("verify", "mutation", void 0, [{ name: "--session", description: "Development session identity.", type: "string" }, { name: "--candidate", description: "Candidate identity.", type: "string" }])
|
|
237
|
+
]),
|
|
203
238
|
branch("host", [
|
|
204
239
|
leaf("status"),
|
|
205
240
|
leaf("doctor"),
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare const adminAccountOperations: {
|
|
2
|
+
readonly updateUsername: import("../control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
3
|
+
readonly notificationPreferences: import("../control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
4
|
+
readonly updateNotificationPreferences: import("../control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
5
|
+
readonly themes: import("../control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
6
|
+
readonly createTheme: import("../control-plane-operation.js").ControlPlaneOperationBinding<{}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
7
|
+
readonly updateTheme: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
8
|
+
themeId: string;
|
|
9
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
10
|
+
readonly deleteTheme: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
11
|
+
themeId: string;
|
|
12
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
13
|
+
readonly unlinkProvider: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
14
|
+
identityId: string;
|
|
15
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
16
|
+
};
|
|
17
|
+
export declare const adminTeamOperations: {
|
|
18
|
+
readonly revokeInvite: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
19
|
+
teamId: string;
|
|
20
|
+
inviteId: string;
|
|
21
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
22
|
+
readonly resendInvite: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
23
|
+
teamId: string;
|
|
24
|
+
inviteId: string;
|
|
25
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
26
|
+
readonly memberRemovalBlockers: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
27
|
+
teamId: string;
|
|
28
|
+
membershipId: string;
|
|
29
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
30
|
+
readonly remove: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
31
|
+
teamId: string;
|
|
32
|
+
}, {}, Record<string, unknown> | undefined, Record<string, unknown>>;
|
|
33
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineOperation } from "../operation-builder.js";
|
|
3
|
+
const empty = z.object({}).strict();
|
|
4
|
+
const none = z.undefined();
|
|
5
|
+
const record = z.record(z.unknown());
|
|
6
|
+
function operation(operationId, method, path, pathShape, options) {
|
|
7
|
+
const read = method === "GET";
|
|
8
|
+
const riskClass = options.risk ?? "ordinary";
|
|
9
|
+
return defineOperation({
|
|
10
|
+
operationId,
|
|
11
|
+
description: `${read ? "Read" : "Apply"} ${operationId}.`,
|
|
12
|
+
rest: { method, path },
|
|
13
|
+
...Object.keys(pathShape).length ? { parameters: `treeseed.${operationId}.parameters/v1` } : {},
|
|
14
|
+
capability: options.capability,
|
|
15
|
+
authentication: "oauth",
|
|
16
|
+
oauthScopes: [read ? "treeseed:read" : "treeseed:projects:write"],
|
|
17
|
+
kind: read ? "read" : "mutation",
|
|
18
|
+
riskClass,
|
|
19
|
+
confirmation: riskClass === "ordinary" ? "never" : "input_required",
|
|
20
|
+
surfaces: ["rest"],
|
|
21
|
+
cacheScope: read ? "principal" : "none",
|
|
22
|
+
pagination: options.pagination ?? "none",
|
|
23
|
+
concurrencyRequired: options.concurrency,
|
|
24
|
+
redactedPaths: options.redactedPaths
|
|
25
|
+
}, {
|
|
26
|
+
path: z.object(pathShape).strict(),
|
|
27
|
+
query: read ? record : empty,
|
|
28
|
+
body: read ? none : record,
|
|
29
|
+
output: record
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
const adminAccountOperations = {
|
|
33
|
+
updateUsername: operation("accounts.username.update", "PATCH", "/v1/auth/web/username", {}, { capability: "accounts.write", concurrency: true }),
|
|
34
|
+
notificationPreferences: operation("accounts.notification.preferences.show", "GET", "/v1/auth/web/notifications/preferences", {}, { capability: "accounts.read" }),
|
|
35
|
+
updateNotificationPreferences: operation("accounts.notification.preferences.update", "PUT", "/v1/auth/web/notifications/preferences", {}, { capability: "accounts.write", concurrency: true }),
|
|
36
|
+
themes: operation("accounts.themes.list", "GET", "/v1/auth/web/themes", {}, { capability: "accounts.read", pagination: "cursor" }),
|
|
37
|
+
createTheme: operation("accounts.themes.create", "POST", "/v1/auth/web/themes", {}, { capability: "accounts.write" }),
|
|
38
|
+
updateTheme: operation("accounts.themes.update", "PUT", "/v1/auth/web/themes/{themeId}", { themeId: z.string().min(1) }, { capability: "accounts.write", concurrency: true }),
|
|
39
|
+
deleteTheme: operation("accounts.themes.delete", "DELETE", "/v1/auth/web/themes/{themeId}", { themeId: z.string().min(1) }, { capability: "accounts.write", risk: "destructive", concurrency: true }),
|
|
40
|
+
unlinkProvider: operation("accounts.providers.unlink", "DELETE", "/v1/auth/web/providers/{identityId}", { identityId: z.string().min(1) }, { capability: "accounts.write", risk: "credential" })
|
|
41
|
+
};
|
|
42
|
+
const adminTeamOperations = {
|
|
43
|
+
revokeInvite: operation("teams.invites.revoke", "DELETE", "/v1/teams/{teamId}/invites/{inviteId}", { teamId: z.string().min(1), inviteId: z.string().min(1) }, { capability: "teams.write", risk: "destructive", concurrency: true }),
|
|
44
|
+
resendInvite: operation("teams.invites.resend", "POST", "/v1/teams/{teamId}/invites/{inviteId}/resend", { teamId: z.string().min(1), inviteId: z.string().min(1) }, { capability: "teams.write" }),
|
|
45
|
+
memberRemovalBlockers: operation("teams.members.removal.blockers", "GET", "/v1/teams/{teamId}/members/{membershipId}/removal-blockers", { teamId: z.string().min(1), membershipId: z.string().min(1) }, { capability: "teams.read" }),
|
|
46
|
+
remove: operation("teams.delete", "DELETE", "/v1/teams/{teamId}/permanent-delete", { teamId: z.string().min(1) }, { capability: "teams.delete", risk: "irreversible", concurrency: true, redactedPaths: ["body.confirmation", "body.currentPassword", "body.reauthenticationGrantId"] })
|
|
47
|
+
};
|
|
48
|
+
export {
|
|
49
|
+
adminAccountOperations,
|
|
50
|
+
adminTeamOperations
|
|
51
|
+
};
|
|
@@ -8,40 +8,12 @@ export declare function communicationOperations(): {
|
|
|
8
8
|
timeoutSeconds?: number | undefined;
|
|
9
9
|
recipients?: string[] | undefined;
|
|
10
10
|
}, {
|
|
11
|
-
status: "
|
|
11
|
+
status: "failed" | "partial" | "complete" | "running" | "queued";
|
|
12
12
|
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
13
|
-
createdAt: string;
|
|
14
|
-
responses: {
|
|
15
|
-
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
16
|
-
createdAt: string;
|
|
17
|
-
projectId: string;
|
|
18
|
-
agentSlug: string;
|
|
19
|
-
assignmentId: string | null;
|
|
20
|
-
invocationId: string;
|
|
21
|
-
requirement: "required" | "optional";
|
|
22
|
-
messageRef: string;
|
|
23
|
-
markdown: string;
|
|
24
|
-
}[];
|
|
25
|
-
teamId: string;
|
|
26
|
-
channel: string;
|
|
27
|
-
updatedAt: string;
|
|
28
|
-
messageRef: string;
|
|
29
|
-
sendId: string;
|
|
30
|
-
topic: {
|
|
31
|
-
id: string;
|
|
32
|
-
slug: string;
|
|
33
|
-
};
|
|
34
|
-
projectStream: {
|
|
35
|
-
id: string;
|
|
36
|
-
projectId: string;
|
|
37
|
-
projectSlug: string;
|
|
38
|
-
};
|
|
39
|
-
discussionId: string;
|
|
40
|
-
sourceMessage: string;
|
|
41
13
|
targets: {
|
|
42
14
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
43
|
-
completedAt: string | null;
|
|
44
15
|
projectId: string;
|
|
16
|
+
completedAt: string | null;
|
|
45
17
|
agentSlug: string;
|
|
46
18
|
capacity: {
|
|
47
19
|
status: string | null;
|
|
@@ -75,19 +47,11 @@ export declare function communicationOperations(): {
|
|
|
75
47
|
message: string | null;
|
|
76
48
|
} | null;
|
|
77
49
|
}[];
|
|
78
|
-
replayed: boolean;
|
|
79
|
-
}>;
|
|
80
|
-
sendStatus: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
81
|
-
teamId: string;
|
|
82
|
-
sendId: string;
|
|
83
|
-
}, {}, undefined, {
|
|
84
|
-
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
85
|
-
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
86
50
|
createdAt: string;
|
|
87
51
|
responses: {
|
|
88
52
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
89
|
-
createdAt: string;
|
|
90
53
|
projectId: string;
|
|
54
|
+
createdAt: string;
|
|
91
55
|
agentSlug: string;
|
|
92
56
|
assignmentId: string | null;
|
|
93
57
|
invocationId: string;
|
|
@@ -111,10 +75,18 @@ export declare function communicationOperations(): {
|
|
|
111
75
|
};
|
|
112
76
|
discussionId: string;
|
|
113
77
|
sourceMessage: string;
|
|
78
|
+
replayed: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
sendStatus: import("../control-plane-operation.js").ControlPlaneOperationBinding<{
|
|
81
|
+
teamId: string;
|
|
82
|
+
sendId: string;
|
|
83
|
+
}, {}, undefined, {
|
|
84
|
+
status: "failed" | "partial" | "complete" | "running" | "queued";
|
|
85
|
+
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
114
86
|
targets: {
|
|
115
87
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
116
|
-
completedAt: string | null;
|
|
117
88
|
projectId: string;
|
|
89
|
+
completedAt: string | null;
|
|
118
90
|
agentSlug: string;
|
|
119
91
|
capacity: {
|
|
120
92
|
status: string | null;
|
|
@@ -148,6 +120,34 @@ export declare function communicationOperations(): {
|
|
|
148
120
|
message: string | null;
|
|
149
121
|
} | null;
|
|
150
122
|
}[];
|
|
123
|
+
createdAt: string;
|
|
124
|
+
responses: {
|
|
125
|
+
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
126
|
+
projectId: string;
|
|
127
|
+
createdAt: string;
|
|
128
|
+
agentSlug: string;
|
|
129
|
+
assignmentId: string | null;
|
|
130
|
+
invocationId: string;
|
|
131
|
+
requirement: "required" | "optional";
|
|
132
|
+
messageRef: string;
|
|
133
|
+
markdown: string;
|
|
134
|
+
}[];
|
|
135
|
+
teamId: string;
|
|
136
|
+
channel: string;
|
|
137
|
+
updatedAt: string;
|
|
138
|
+
messageRef: string;
|
|
139
|
+
sendId: string;
|
|
140
|
+
topic: {
|
|
141
|
+
id: string;
|
|
142
|
+
slug: string;
|
|
143
|
+
};
|
|
144
|
+
projectStream: {
|
|
145
|
+
id: string;
|
|
146
|
+
projectId: string;
|
|
147
|
+
projectSlug: string;
|
|
148
|
+
};
|
|
149
|
+
discussionId: string;
|
|
150
|
+
sourceMessage: string;
|
|
151
151
|
replayed: boolean;
|
|
152
152
|
}>;
|
|
153
153
|
};
|
|
@@ -104,8 +104,8 @@ export declare const communicationTargetSchema: z.ZodObject<{
|
|
|
104
104
|
}>;
|
|
105
105
|
}, "strict", z.ZodTypeAny, {
|
|
106
106
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
107
|
-
completedAt: string | null;
|
|
108
107
|
projectId: string;
|
|
108
|
+
completedAt: string | null;
|
|
109
109
|
agentSlug: string;
|
|
110
110
|
capacity: {
|
|
111
111
|
status: string | null;
|
|
@@ -140,8 +140,8 @@ export declare const communicationTargetSchema: z.ZodObject<{
|
|
|
140
140
|
} | null;
|
|
141
141
|
}, {
|
|
142
142
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
143
|
-
completedAt: string | null;
|
|
144
143
|
projectId: string;
|
|
144
|
+
completedAt: string | null;
|
|
145
145
|
agentSlug: string;
|
|
146
146
|
capacity: {
|
|
147
147
|
status: string | null;
|
|
@@ -188,8 +188,8 @@ export declare const communicationResponseSchema: z.ZodObject<{
|
|
|
188
188
|
createdAt: z.ZodString;
|
|
189
189
|
}, "strict", z.ZodTypeAny, {
|
|
190
190
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
191
|
-
createdAt: string;
|
|
192
191
|
projectId: string;
|
|
192
|
+
createdAt: string;
|
|
193
193
|
agentSlug: string;
|
|
194
194
|
assignmentId: string | null;
|
|
195
195
|
invocationId: string;
|
|
@@ -198,8 +198,8 @@ export declare const communicationResponseSchema: z.ZodObject<{
|
|
|
198
198
|
markdown: string;
|
|
199
199
|
}, {
|
|
200
200
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
201
|
-
createdAt: string;
|
|
202
201
|
projectId: string;
|
|
202
|
+
createdAt: string;
|
|
203
203
|
agentSlug: string;
|
|
204
204
|
assignmentId: string | null;
|
|
205
205
|
invocationId: string;
|
|
@@ -318,8 +318,8 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
318
318
|
}>;
|
|
319
319
|
}, "strict", z.ZodTypeAny, {
|
|
320
320
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
321
|
-
completedAt: string | null;
|
|
322
321
|
projectId: string;
|
|
322
|
+
completedAt: string | null;
|
|
323
323
|
agentSlug: string;
|
|
324
324
|
capacity: {
|
|
325
325
|
status: string | null;
|
|
@@ -354,8 +354,8 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
354
354
|
} | null;
|
|
355
355
|
}, {
|
|
356
356
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
357
|
-
completedAt: string | null;
|
|
358
357
|
projectId: string;
|
|
358
|
+
completedAt: string | null;
|
|
359
359
|
agentSlug: string;
|
|
360
360
|
capacity: {
|
|
361
361
|
status: string | null;
|
|
@@ -402,8 +402,8 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
402
402
|
createdAt: z.ZodString;
|
|
403
403
|
}, "strict", z.ZodTypeAny, {
|
|
404
404
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
405
|
-
createdAt: string;
|
|
406
405
|
projectId: string;
|
|
406
|
+
createdAt: string;
|
|
407
407
|
agentSlug: string;
|
|
408
408
|
assignmentId: string | null;
|
|
409
409
|
invocationId: string;
|
|
@@ -412,8 +412,8 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
412
412
|
markdown: string;
|
|
413
413
|
}, {
|
|
414
414
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
415
|
-
createdAt: string;
|
|
416
415
|
projectId: string;
|
|
416
|
+
createdAt: string;
|
|
417
417
|
agentSlug: string;
|
|
418
418
|
assignmentId: string | null;
|
|
419
419
|
invocationId: string;
|
|
@@ -425,40 +425,12 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
425
425
|
updatedAt: z.ZodString;
|
|
426
426
|
replayed: z.ZodBoolean;
|
|
427
427
|
}, "strict", z.ZodTypeAny, {
|
|
428
|
-
status: "
|
|
428
|
+
status: "failed" | "partial" | "complete" | "running" | "queued";
|
|
429
429
|
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
430
|
-
createdAt: string;
|
|
431
|
-
responses: {
|
|
432
|
-
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
433
|
-
createdAt: string;
|
|
434
|
-
projectId: string;
|
|
435
|
-
agentSlug: string;
|
|
436
|
-
assignmentId: string | null;
|
|
437
|
-
invocationId: string;
|
|
438
|
-
requirement: "required" | "optional";
|
|
439
|
-
messageRef: string;
|
|
440
|
-
markdown: string;
|
|
441
|
-
}[];
|
|
442
|
-
teamId: string;
|
|
443
|
-
channel: string;
|
|
444
|
-
updatedAt: string;
|
|
445
|
-
messageRef: string;
|
|
446
|
-
sendId: string;
|
|
447
|
-
topic: {
|
|
448
|
-
id: string;
|
|
449
|
-
slug: string;
|
|
450
|
-
};
|
|
451
|
-
projectStream: {
|
|
452
|
-
id: string;
|
|
453
|
-
projectId: string;
|
|
454
|
-
projectSlug: string;
|
|
455
|
-
};
|
|
456
|
-
discussionId: string;
|
|
457
|
-
sourceMessage: string;
|
|
458
430
|
targets: {
|
|
459
431
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
460
|
-
completedAt: string | null;
|
|
461
432
|
projectId: string;
|
|
433
|
+
completedAt: string | null;
|
|
462
434
|
agentSlug: string;
|
|
463
435
|
capacity: {
|
|
464
436
|
status: string | null;
|
|
@@ -492,15 +464,11 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
492
464
|
message: string | null;
|
|
493
465
|
} | null;
|
|
494
466
|
}[];
|
|
495
|
-
replayed: boolean;
|
|
496
|
-
}, {
|
|
497
|
-
status: "partial" | "failed" | "complete" | "running" | "queued";
|
|
498
|
-
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
499
467
|
createdAt: string;
|
|
500
468
|
responses: {
|
|
501
469
|
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
502
|
-
createdAt: string;
|
|
503
470
|
projectId: string;
|
|
471
|
+
createdAt: string;
|
|
504
472
|
agentSlug: string;
|
|
505
473
|
assignmentId: string | null;
|
|
506
474
|
invocationId: string;
|
|
@@ -524,10 +492,14 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
524
492
|
};
|
|
525
493
|
discussionId: string;
|
|
526
494
|
sourceMessage: string;
|
|
495
|
+
replayed: boolean;
|
|
496
|
+
}, {
|
|
497
|
+
status: "failed" | "partial" | "complete" | "running" | "queued";
|
|
498
|
+
schemaVersion: "treeseed.communication-send-receipt/v2";
|
|
527
499
|
targets: {
|
|
528
500
|
status: "failed" | "running" | "cancelled" | "queued" | "responded" | "abstained";
|
|
529
|
-
completedAt: string | null;
|
|
530
501
|
projectId: string;
|
|
502
|
+
completedAt: string | null;
|
|
531
503
|
agentSlug: string;
|
|
532
504
|
capacity: {
|
|
533
505
|
status: string | null;
|
|
@@ -561,6 +533,34 @@ export declare const communicationSendReceiptSchema: z.ZodObject<{
|
|
|
561
533
|
message: string | null;
|
|
562
534
|
} | null;
|
|
563
535
|
}[];
|
|
536
|
+
createdAt: string;
|
|
537
|
+
responses: {
|
|
538
|
+
status: "failed" | "cancelled" | "responded" | "abstained";
|
|
539
|
+
projectId: string;
|
|
540
|
+
createdAt: string;
|
|
541
|
+
agentSlug: string;
|
|
542
|
+
assignmentId: string | null;
|
|
543
|
+
invocationId: string;
|
|
544
|
+
requirement: "required" | "optional";
|
|
545
|
+
messageRef: string;
|
|
546
|
+
markdown: string;
|
|
547
|
+
}[];
|
|
548
|
+
teamId: string;
|
|
549
|
+
channel: string;
|
|
550
|
+
updatedAt: string;
|
|
551
|
+
messageRef: string;
|
|
552
|
+
sendId: string;
|
|
553
|
+
topic: {
|
|
554
|
+
id: string;
|
|
555
|
+
slug: string;
|
|
556
|
+
};
|
|
557
|
+
projectStream: {
|
|
558
|
+
id: string;
|
|
559
|
+
projectId: string;
|
|
560
|
+
projectSlug: string;
|
|
561
|
+
};
|
|
562
|
+
discussionId: string;
|
|
563
|
+
sourceMessage: string;
|
|
564
564
|
replayed: boolean;
|
|
565
565
|
}>;
|
|
566
566
|
export declare const providerDiscussionResponseRequestSchema: z.ZodEffects<z.ZodObject<{
|