@inhuman.tools/harness-contract 0.0.0-stage → 0.2.0
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/LICENSE.md +7 -0
- package/dist/contract.d.ts +1938 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +371 -0
- package/dist/contract.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonrpc.d.ts +18 -0
- package/dist/jsonrpc.d.ts.map +1 -0
- package/dist/jsonrpc.js +34 -0
- package/dist/jsonrpc.js.map +1 -0
- package/dist/schemas/authorization.d.ts +1721 -0
- package/dist/schemas/authorization.d.ts.map +1 -0
- package/dist/schemas/authorization.js +289 -0
- package/dist/schemas/authorization.js.map +1 -0
- package/dist/schemas/connection.d.ts +133 -0
- package/dist/schemas/connection.d.ts.map +1 -0
- package/dist/schemas/connection.js +55 -0
- package/dist/schemas/connection.js.map +1 -0
- package/dist/schemas/rpc.d.ts +86 -0
- package/dist/schemas/rpc.d.ts.map +1 -0
- package/dist/schemas/rpc.js +66 -0
- package/dist/schemas/rpc.js.map +1 -0
- package/dist/schemas/shapes.d.ts +539 -0
- package/dist/schemas/shapes.d.ts.map +1 -0
- package/dist/schemas/shapes.js +364 -0
- package/dist/schemas/shapes.js.map +1 -0
- package/dist/spec/cli.d.ts +3 -0
- package/dist/spec/cli.d.ts.map +1 -0
- package/dist/spec/cli.js +40 -0
- package/dist/spec/cli.js.map +1 -0
- package/dist/spec/generate.d.ts +21 -0
- package/dist/spec/generate.d.ts.map +1 -0
- package/dist/spec/generate.js +100 -0
- package/dist/spec/generate.js.map +1 -0
- package/dist/spec/readme.d.ts +4 -0
- package/dist/spec/readme.d.ts.map +1 -0
- package/dist/spec/readme.js +124 -0
- package/dist/spec/readme.js.map +1 -0
- package/package.json +57 -3
- package/src/contract.ts +437 -0
- package/src/index.ts +6 -0
- package/src/jsonrpc.ts +42 -0
- package/src/schemas/authorization.ts +312 -0
- package/src/schemas/connection.ts +68 -0
- package/src/schemas/rpc.ts +88 -0
- package/src/schemas/shapes.ts +402 -0
- package/src/spec/cli.ts +45 -0
- package/src/spec/generate.ts +115 -0
- package/src/spec/readme.ts +126 -0
- package/README.md +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.d.ts","sourceRoot":"","sources":["../../src/schemas/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,SAAS,iVAqBZ,CAAC;AACX,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;EAAoB,CAAC;AAE/C,eAAO,MAAM,YAAY,kDAAmD,CAAC;AAC7E,eAAO,MAAM,gBAAgB;;;;;EAAuB,CAAC;AAErD,8FAA8F;AAC9F,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BA6B7B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAehB,CAAC;AAEZ,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;kBAUhB,CAAC;AACZ,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA8C,CAAC;AAE3E,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUf,CAAC;AACZ,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAMzB,CAAC;AAEH,eAA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B;;;iBAA6D,CAAC;AAE9F,eAAO,MAAM,oBAAoB,iCAAwB,CAAC;AAC1D,eAAO,MAAM,qBAAqB;;;;;;;iBAQhC,CAAC"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire shapes of the policy v2 engine: grants (a stored human "yes" to an ask), the extended
|
|
3
|
+
* `ask/answer`, `policy/explain`, the session overlay.
|
|
4
|
+
*
|
|
5
|
+
* The class ids are the closed taxonomy owned by `@inhuman.tools/policy` (classes.ts); a test in
|
|
6
|
+
* `@inhuman.tools/harness` pins that this list equals it. Tier names on the wire are "soft-deny" and
|
|
7
|
+
* "ask"; the engine names `deny` / `ask` appear only where a tier is a disposition.
|
|
8
|
+
*/
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
export const CLASS_IDS = [
|
|
11
|
+
"destroy-catastrophic",
|
|
12
|
+
"destroy-local",
|
|
13
|
+
"vcs-history",
|
|
14
|
+
"privilege",
|
|
15
|
+
"credential",
|
|
16
|
+
"control-plane",
|
|
17
|
+
"attack-shape",
|
|
18
|
+
"policy-fault",
|
|
19
|
+
"package-install",
|
|
20
|
+
"publish",
|
|
21
|
+
"remote-write",
|
|
22
|
+
"network-egress",
|
|
23
|
+
"exec-unknown",
|
|
24
|
+
"unmodelled",
|
|
25
|
+
"envelope-read",
|
|
26
|
+
"envelope-write",
|
|
27
|
+
"protected-file",
|
|
28
|
+
"workspace-write",
|
|
29
|
+
"mcp-lookup",
|
|
30
|
+
"mcp-action",
|
|
31
|
+
];
|
|
32
|
+
export const classIdSchema = z.enum(CLASS_IDS);
|
|
33
|
+
export const GRANT_SCOPES = ["session", "project", "bot", "global"];
|
|
34
|
+
export const grantScopeSchema = z.enum(GRANT_SCOPES);
|
|
35
|
+
/** What a grant covers. Commands are families: program + subcommand spine + `family_args`. */
|
|
36
|
+
export const grantSubjectSchema = z.discriminatedUnion("kind", [
|
|
37
|
+
z
|
|
38
|
+
.object({
|
|
39
|
+
kind: z.literal("command"),
|
|
40
|
+
argv0: z.string().min(1),
|
|
41
|
+
spine: z.array(z.string()),
|
|
42
|
+
args: z.array(z.string()),
|
|
43
|
+
})
|
|
44
|
+
.strict(),
|
|
45
|
+
z
|
|
46
|
+
.object({
|
|
47
|
+
kind: z.literal("path"),
|
|
48
|
+
cluster: z.enum(["read", "write"]),
|
|
49
|
+
path: z.string().min(1),
|
|
50
|
+
depth: z.enum(["exact", "subtree"]),
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
/** `account` is the connection id: one ConnectionSpec is one account. */
|
|
54
|
+
z
|
|
55
|
+
.object({
|
|
56
|
+
kind: z.literal("mcp"),
|
|
57
|
+
server: z.string().min(1),
|
|
58
|
+
account: z.string().min(1).optional(),
|
|
59
|
+
tool: z.string().min(1).optional(),
|
|
60
|
+
})
|
|
61
|
+
.strict(),
|
|
62
|
+
z.object({ kind: z.literal("tool"), name: z.string().min(1) }).strict(),
|
|
63
|
+
/** Acknowledgements only: "any call of this class". */
|
|
64
|
+
z.object({ kind: z.literal("class"), class: classIdSchema }).strict(),
|
|
65
|
+
]);
|
|
66
|
+
export const grantRowSchema = z
|
|
67
|
+
.object({
|
|
68
|
+
id: z.string().min(1),
|
|
69
|
+
/** Absent: a grant (a stored "yes" to an ask). `ack`: a stored acknowledgement. */
|
|
70
|
+
kind: z.enum(["grant", "ack"]).optional(),
|
|
71
|
+
scope: grantScopeSchema,
|
|
72
|
+
/** sessionId | project path | bot name | "" */
|
|
73
|
+
scopeKey: z.string(),
|
|
74
|
+
subject: grantSubjectSchema,
|
|
75
|
+
createdAtMs: z.number().int(),
|
|
76
|
+
/** `null`: no expiry (session grants end with the session; settings-file grants never expire). */
|
|
77
|
+
expiresAtMs: z.number().int().nullable(),
|
|
78
|
+
source: z.enum(["prompt", "settings"]),
|
|
79
|
+
label: z.string(),
|
|
80
|
+
})
|
|
81
|
+
.strict();
|
|
82
|
+
export const grantListInput = z
|
|
83
|
+
.object({
|
|
84
|
+
/** Default `grant`. Acknowledgements are listed by `ack/list`. */
|
|
85
|
+
kind: z.enum(["grant", "ack"]).optional(),
|
|
86
|
+
scope: grantScopeSchema.optional(),
|
|
87
|
+
sessionId: z.string().optional(),
|
|
88
|
+
projectPath: z.string().optional(),
|
|
89
|
+
bot: z.string().optional(),
|
|
90
|
+
includeExpired: z.boolean().optional(),
|
|
91
|
+
})
|
|
92
|
+
.strict();
|
|
93
|
+
export const grantListOutput = z.object({ rows: z.array(grantRowSchema) });
|
|
94
|
+
export const grantAddInput = z
|
|
95
|
+
.object({
|
|
96
|
+
/** Default `grant`. */
|
|
97
|
+
kind: z.enum(["grant", "ack"]).optional(),
|
|
98
|
+
scope: grantScopeSchema,
|
|
99
|
+
/** Required for session (the session id), project (its path) and bot (its name). */
|
|
100
|
+
scopeKey: z.string().optional(),
|
|
101
|
+
subject: grantSubjectSchema,
|
|
102
|
+
ttlMs: z.number().int().positive().optional(),
|
|
103
|
+
})
|
|
104
|
+
.strict();
|
|
105
|
+
export const grantAddOutput = z.union([
|
|
106
|
+
z.object({ ok: z.literal(true), row: grantRowSchema }),
|
|
107
|
+
z.object({
|
|
108
|
+
ok: z.literal(false),
|
|
109
|
+
reason: z.enum(["fenced-path", "invalid-scope", "unknown-session", "subject-not-allowed"]),
|
|
110
|
+
}),
|
|
111
|
+
]);
|
|
112
|
+
export const grantRevokeInput = z.object({ id: z.string().min(1), sessionId: z.string().optional() }).strict();
|
|
113
|
+
export const grantRevokeOutput = z.object({ ok: z.boolean() });
|
|
114
|
+
/** Remember a human "yes" to an ask. Never for a soft-deny, never for a block. */
|
|
115
|
+
export const askStoreInput = z
|
|
116
|
+
.object({
|
|
117
|
+
scope: grantScopeSchema,
|
|
118
|
+
/** Must be one of the subjects the daemon offers for this job (`grantOptions`). */
|
|
119
|
+
subject: grantSubjectSchema,
|
|
120
|
+
/** `null`: no expiry. Absent: the prompt default (session: none, project/bot/global: 7 days). */
|
|
121
|
+
ttlMs: z.number().int().positive().nullable().optional(),
|
|
122
|
+
})
|
|
123
|
+
.strict();
|
|
124
|
+
export const askAnswerInput = z.object({
|
|
125
|
+
sessionId: z.string().trim().min(1),
|
|
126
|
+
jobId: z.string().trim().min(1),
|
|
127
|
+
allow: z.boolean(),
|
|
128
|
+
comment: z.string().optional(),
|
|
129
|
+
/** "Treat <folder> as part of this session?" answered yes: the folder becomes a session read root. */
|
|
130
|
+
widen: z.string().optional(),
|
|
131
|
+
store: askStoreInput.optional(),
|
|
132
|
+
/** A combined prompt (ask + acknowledgement): also remember the acknowledgement (one of `ackRequest.storeOptions`). */
|
|
133
|
+
ackStore: askStoreInput.optional(),
|
|
134
|
+
/** Refusing an MCP look-up: hide the tool for this session or for good. Allowing is `store`, not this. */
|
|
135
|
+
persist: z.enum(["session", "always"]).optional(),
|
|
136
|
+
});
|
|
137
|
+
export const askAnswerOutput = z.object({
|
|
138
|
+
ok: z.boolean(),
|
|
139
|
+
reason: z
|
|
140
|
+
.enum([
|
|
141
|
+
"not-pending",
|
|
142
|
+
"block",
|
|
143
|
+
"soft-deny-not-storable",
|
|
144
|
+
"subject-not-offered",
|
|
145
|
+
"folder-not-allowed",
|
|
146
|
+
"scope-unavailable",
|
|
147
|
+
])
|
|
148
|
+
.optional(),
|
|
149
|
+
grant: grantRowSchema.optional(),
|
|
150
|
+
});
|
|
151
|
+
/**
|
|
152
|
+
* A call that is allowed but waits for the user's acknowledgement (a `needsAcknowledgement` flag). The
|
|
153
|
+
* daemon holds the ledger; it is never a job, a transcript entry or a model-visible field.
|
|
154
|
+
*/
|
|
155
|
+
export const ackStoreOptionSchema = z.object({
|
|
156
|
+
scope: grantScopeSchema,
|
|
157
|
+
subject: grantSubjectSchema,
|
|
158
|
+
label: z.string(),
|
|
159
|
+
/** What a prompt-created ack lasts in this scope; `null` for the session's own life. */
|
|
160
|
+
defaultTtlMs: z.number().int().nullable(),
|
|
161
|
+
});
|
|
162
|
+
export const ackRequestSchema = z.object({
|
|
163
|
+
/** The job's id: stable while the call waits. */
|
|
164
|
+
ackId: z.string(),
|
|
165
|
+
sessionId: z.string(),
|
|
166
|
+
jobId: z.string(),
|
|
167
|
+
tool: z.string(),
|
|
168
|
+
/** One line, e.g. `shell · git push origin main`. */
|
|
169
|
+
summary: z.string(),
|
|
170
|
+
/** The call's arguments, agent-written strings JSON-encoded and cut for display. */
|
|
171
|
+
detail: z.string(),
|
|
172
|
+
flags: z.array(z.object({
|
|
173
|
+
label: z.string(),
|
|
174
|
+
why: z.string().optional(),
|
|
175
|
+
layer: z.enum(["dist", "managed", "user", "project", "session"]),
|
|
176
|
+
})),
|
|
177
|
+
verdict: z.object({
|
|
178
|
+
tier: z.enum(["allow", "ask", "soft-deny"]),
|
|
179
|
+
classes: z.array(classIdSchema),
|
|
180
|
+
/** `pending`: the ask or soft-deny is not resolved yet; answering settles both (one prompt). */
|
|
181
|
+
licensedBy: z.enum(["floor", "grant", "judge", "resolver", "pending"]),
|
|
182
|
+
}),
|
|
183
|
+
storeOptions: z.array(ackStoreOptionSchema),
|
|
184
|
+
createdAtMs: z.number().int(),
|
|
185
|
+
});
|
|
186
|
+
export const ackPendingInput = z.object({ sessionId: z.string().optional() }).strict();
|
|
187
|
+
export const ackPendingOutput = z.object({ acks: z.array(ackRequestSchema) });
|
|
188
|
+
export const ackAnswerInput = z
|
|
189
|
+
.object({
|
|
190
|
+
sessionId: z.string().trim().min(1),
|
|
191
|
+
jobId: z.string().trim().min(1),
|
|
192
|
+
ackId: z.string().trim().min(1),
|
|
193
|
+
accept: z.boolean(),
|
|
194
|
+
/** Remember the acknowledgement. Must be one of `ackRequest.storeOptions`. */
|
|
195
|
+
store: askStoreInput.optional(),
|
|
196
|
+
/** A refusal's comment is what the agent reads. */
|
|
197
|
+
comment: z.string().optional(),
|
|
198
|
+
})
|
|
199
|
+
.strict();
|
|
200
|
+
export const ackAnswerOutput = z.object({
|
|
201
|
+
ok: z.boolean(),
|
|
202
|
+
reason: z.enum(["not-pending", "subject-not-offered", "scope-unavailable"]).optional(),
|
|
203
|
+
ack: grantRowSchema.optional(),
|
|
204
|
+
});
|
|
205
|
+
export const ackListInput = grantListInput.omit({ kind: true });
|
|
206
|
+
export const ackListOutput = grantListOutput;
|
|
207
|
+
export const ackAddInput = grantAddInput.omit({ kind: true });
|
|
208
|
+
export const ackAddOutput = grantAddOutput;
|
|
209
|
+
export const ackRevokeInput = grantRevokeInput;
|
|
210
|
+
export const ackRevokeOutput = grantRevokeOutput;
|
|
211
|
+
/** What a call is, for `policy/explain`. */
|
|
212
|
+
export const policyProbeSchema = z.discriminatedUnion("kind", [
|
|
213
|
+
z.object({ kind: z.literal("shell"), command: z.string().min(1), cwd: z.string().optional() }).strict(),
|
|
214
|
+
z.object({ kind: z.literal("path"), cluster: z.enum(["read", "write"]), path: z.string().min(1) }).strict(),
|
|
215
|
+
z
|
|
216
|
+
.object({
|
|
217
|
+
kind: z.literal("mcp"),
|
|
218
|
+
server: z.string().min(1),
|
|
219
|
+
account: z.string().optional(),
|
|
220
|
+
tool: z.string().min(1),
|
|
221
|
+
})
|
|
222
|
+
.strict(),
|
|
223
|
+
z
|
|
224
|
+
.object({ kind: z.literal("tool"), name: z.string().min(1), args: z.record(z.string(), z.unknown()).optional() })
|
|
225
|
+
.strict(),
|
|
226
|
+
]);
|
|
227
|
+
export const policyExplainInput = z
|
|
228
|
+
.object({
|
|
229
|
+
probe: policyProbeSchema,
|
|
230
|
+
mode: z.enum(["manual", "auto", "yolo"]).optional(),
|
|
231
|
+
unattended: z.boolean().optional(),
|
|
232
|
+
})
|
|
233
|
+
.strict();
|
|
234
|
+
export const explainResolverSchema = z.object({
|
|
235
|
+
/** allow | judge | human | deny */
|
|
236
|
+
kind: z.enum(["allow", "judge", "human", "deny"]),
|
|
237
|
+
layer: z.enum(["dist", "managed", "user", "project", "session"]),
|
|
238
|
+
/** Judge cells only: what a judge deny / failure resolves to. */
|
|
239
|
+
onDeny: z.enum(["human", "deny"]).optional(),
|
|
240
|
+
onFail: z.enum(["human", "deny"]).optional(),
|
|
241
|
+
});
|
|
242
|
+
export const policyExplainOutput = z.object({
|
|
243
|
+
/** The floor's tier: block | soft-deny | ask | allow. */
|
|
244
|
+
tier: z.enum(["block", "soft-deny", "ask", "allow"]),
|
|
245
|
+
classes: z.array(z.object({ id: classIdSchema, label: z.string() })),
|
|
246
|
+
votes: z.array(z.object({
|
|
247
|
+
tier: z.enum(["block", "soft-deny", "ask", "allow"]),
|
|
248
|
+
class: classIdSchema,
|
|
249
|
+
ruleId: z.string(),
|
|
250
|
+
lift: z.string().optional(),
|
|
251
|
+
})),
|
|
252
|
+
/** Null for allow and block: the resolution table is not consulted. */
|
|
253
|
+
resolver: explainResolverSchema.nullable(),
|
|
254
|
+
/** A stored grant that would cover this call (ask only), else null. */
|
|
255
|
+
grant: grantRowSchema.nullable(),
|
|
256
|
+
/** What a prompt could offer to remember. Empty for soft-deny. */
|
|
257
|
+
grantable: z.array(grantSubjectSchema),
|
|
258
|
+
outcome: z.enum(["runs", "judge-ask", "judge-soft-deny", "prompts-you", "denied", "blocked"]),
|
|
259
|
+
/**
|
|
260
|
+
* Acknowledgement flags that cover the call in this mode, and the stored ack that satisfies them. Null
|
|
261
|
+
* when no flag applies. An unsatisfied flag turns `runs` into a prompt (`prompts-you`) or, unattended, a denial.
|
|
262
|
+
*/
|
|
263
|
+
ack: z
|
|
264
|
+
.object({
|
|
265
|
+
flags: z.array(z.object({ label: z.string(), why: z.string().optional(), layer: z.string() })),
|
|
266
|
+
satisfiedBy: grantRowSchema.nullable(),
|
|
267
|
+
})
|
|
268
|
+
.nullable(),
|
|
269
|
+
/** Why, in a sentence. */
|
|
270
|
+
reason: z.string(),
|
|
271
|
+
});
|
|
272
|
+
export const policyOverlayInput = z
|
|
273
|
+
.object({
|
|
274
|
+
/** An `authorization` block for this session only, or `null` to clear it. Capped by the project layer. */
|
|
275
|
+
overlay: z.record(z.string(), z.unknown()).nullable(),
|
|
276
|
+
})
|
|
277
|
+
.strict();
|
|
278
|
+
export const policyOverlayOutput = z.object({ ok: z.boolean(), errors: z.array(z.string()) });
|
|
279
|
+
export const policyConfigGetInput = z.object({}).strict();
|
|
280
|
+
export const policyConfigGetOutput = z.object({
|
|
281
|
+
/** The layers as text ("" = none) and what is wrong with them, if anything. */
|
|
282
|
+
layers: z.object({
|
|
283
|
+
user: z.string(),
|
|
284
|
+
project: z.string(),
|
|
285
|
+
session: z.string(),
|
|
286
|
+
}),
|
|
287
|
+
warnings: z.array(z.string()),
|
|
288
|
+
});
|
|
289
|
+
//# sourceMappingURL=authorization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization.js","sourceRoot":"","sources":["../../src/schemas/authorization.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,sBAAsB;IACtB,eAAe;IACf,aAAa;IACb,WAAW;IACX,YAAY;IACZ,eAAe;IACf,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,cAAc;IACd,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,YAAY;CACJ,CAAC;AACX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,CAAU,CAAC;AAC7E,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;AAErD,8FAA8F;AAC9F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC7D,CAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;QAC1B,KAA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K,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const connectionStatusSchema: z.ZodEnum<{
|
|
3
|
+
idle: "idle";
|
|
4
|
+
connecting: "connecting";
|
|
5
|
+
ready: "ready";
|
|
6
|
+
"needs-auth": "needs-auth";
|
|
7
|
+
failed: "failed";
|
|
8
|
+
disabled: "disabled";
|
|
9
|
+
}>;
|
|
10
|
+
export type ConnectionStatus = z.infer<typeof connectionStatusSchema>;
|
|
11
|
+
export declare const connectionListRowSchema: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
driver: z.ZodString;
|
|
15
|
+
abilityClaim: z.ZodArray<z.ZodString>;
|
|
16
|
+
enabled: z.ZodBoolean;
|
|
17
|
+
status: z.ZodEnum<{
|
|
18
|
+
idle: "idle";
|
|
19
|
+
connecting: "connecting";
|
|
20
|
+
ready: "ready";
|
|
21
|
+
"needs-auth": "needs-auth";
|
|
22
|
+
failed: "failed";
|
|
23
|
+
disabled: "disabled";
|
|
24
|
+
}>;
|
|
25
|
+
toolCount: z.ZodNumber;
|
|
26
|
+
error: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type ConnectionListRow = z.infer<typeof connectionListRowSchema>;
|
|
29
|
+
export declare const connectionGetRowSchema: z.ZodObject<{
|
|
30
|
+
id: z.ZodString;
|
|
31
|
+
name: z.ZodString;
|
|
32
|
+
driver: z.ZodString;
|
|
33
|
+
abilityClaim: z.ZodArray<z.ZodString>;
|
|
34
|
+
enabled: z.ZodBoolean;
|
|
35
|
+
status: z.ZodEnum<{
|
|
36
|
+
idle: "idle";
|
|
37
|
+
connecting: "connecting";
|
|
38
|
+
ready: "ready";
|
|
39
|
+
"needs-auth": "needs-auth";
|
|
40
|
+
failed: "failed";
|
|
41
|
+
disabled: "disabled";
|
|
42
|
+
}>;
|
|
43
|
+
toolCount: z.ZodNumber;
|
|
44
|
+
error: z.ZodString;
|
|
45
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type ConnectionGetRow = z.infer<typeof connectionGetRowSchema>;
|
|
48
|
+
export declare const listConnectionsInput: z.ZodObject<{
|
|
49
|
+
abilityClaim: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export declare const listConnectionsOutput: z.ZodObject<{
|
|
52
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
driver: z.ZodString;
|
|
56
|
+
abilityClaim: z.ZodArray<z.ZodString>;
|
|
57
|
+
enabled: z.ZodBoolean;
|
|
58
|
+
status: z.ZodEnum<{
|
|
59
|
+
idle: "idle";
|
|
60
|
+
connecting: "connecting";
|
|
61
|
+
ready: "ready";
|
|
62
|
+
"needs-auth": "needs-auth";
|
|
63
|
+
failed: "failed";
|
|
64
|
+
disabled: "disabled";
|
|
65
|
+
}>;
|
|
66
|
+
toolCount: z.ZodNumber;
|
|
67
|
+
error: z.ZodString;
|
|
68
|
+
}, z.core.$strip>>;
|
|
69
|
+
}, z.core.$strip>;
|
|
70
|
+
export declare const getConnectionInput: z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
export declare const getConnectionOutput: z.ZodObject<{
|
|
74
|
+
id: z.ZodString;
|
|
75
|
+
name: z.ZodString;
|
|
76
|
+
driver: z.ZodString;
|
|
77
|
+
abilityClaim: z.ZodArray<z.ZodString>;
|
|
78
|
+
enabled: z.ZodBoolean;
|
|
79
|
+
status: z.ZodEnum<{
|
|
80
|
+
idle: "idle";
|
|
81
|
+
connecting: "connecting";
|
|
82
|
+
ready: "ready";
|
|
83
|
+
"needs-auth": "needs-auth";
|
|
84
|
+
failed: "failed";
|
|
85
|
+
disabled: "disabled";
|
|
86
|
+
}>;
|
|
87
|
+
toolCount: z.ZodNumber;
|
|
88
|
+
error: z.ZodString;
|
|
89
|
+
settings: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export declare const connectModelsInput: z.ZodObject<{
|
|
92
|
+
id: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
export declare const connectModelsRowSchema: z.ZodObject<{
|
|
95
|
+
id: z.ZodString;
|
|
96
|
+
models: z.ZodArray<z.ZodString>;
|
|
97
|
+
error: z.ZodString;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
export declare const connectModelsOutput: z.ZodObject<{
|
|
100
|
+
connections: z.ZodArray<z.ZodObject<{
|
|
101
|
+
id: z.ZodString;
|
|
102
|
+
models: z.ZodArray<z.ZodString>;
|
|
103
|
+
error: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
export type ConnectModelsRow = z.infer<typeof connectModelsRowSchema>;
|
|
107
|
+
export declare const setEnabledInput: z.ZodObject<{
|
|
108
|
+
id: z.ZodString;
|
|
109
|
+
enabled: z.ZodBoolean;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export declare const setEnabledOutput: z.ZodObject<{
|
|
112
|
+
ok: z.ZodBoolean;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
export declare const persistToolInput: z.ZodObject<{
|
|
115
|
+
id: z.ZodString;
|
|
116
|
+
tool: z.ZodString;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export declare const persistToolOutput: z.ZodObject<{
|
|
119
|
+
ok: z.ZodLiteral<true>;
|
|
120
|
+
}, z.core.$strip>;
|
|
121
|
+
export declare const loginInput: z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export declare const loginOutput: z.ZodObject<{
|
|
125
|
+
ok: z.ZodBoolean;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export declare const logoutInput: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
}, z.core.$strip>;
|
|
130
|
+
export declare const logoutOutput: z.ZodObject<{
|
|
131
|
+
ok: z.ZodLiteral<true>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
//# sourceMappingURL=connection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/schemas/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,sBAAsB;;;;;;;EAA8E,CAAC;AAClH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;iBASlC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;iBAEjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;iBAEhC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;iBAAyB,CAAC;AAE1D,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AACH,eAAO,MAAM,sBAAsB;;;;iBAIjC,CAAC;AACH,eAAO,MAAM,mBAAmB;;;;;;iBAE9B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,eAAO,MAAM,eAAe;;;iBAG1B,CAAC;AACH,eAAO,MAAM,gBAAgB;;iBAAgC,CAAC;AAE9D,eAAO,MAAM,gBAAgB;;;iBAG3B,CAAC;AACH,eAAO,MAAM,iBAAiB;;iBAAoC,CAAC;AAEnE,eAAO,MAAM,UAAU;;iBAErB,CAAC;AACH,eAAO,MAAM,WAAW;;iBAAgC,CAAC;AAEzD,eAAO,MAAM,WAAW;;iBAEtB,CAAC;AACH,eAAO,MAAM,YAAY;;iBAAoC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const connectionStatusSchema = z.enum(["idle", "connecting", "ready", "needs-auth", "failed", "disabled"]);
|
|
3
|
+
export const connectionListRowSchema = z.object({
|
|
4
|
+
id: z.string(),
|
|
5
|
+
name: z.string(),
|
|
6
|
+
driver: z.string(),
|
|
7
|
+
abilityClaim: z.array(z.string()),
|
|
8
|
+
enabled: z.boolean(),
|
|
9
|
+
status: connectionStatusSchema,
|
|
10
|
+
toolCount: z.number(),
|
|
11
|
+
error: z.string(),
|
|
12
|
+
});
|
|
13
|
+
export const connectionGetRowSchema = connectionListRowSchema.extend({
|
|
14
|
+
settings: z.record(z.string(), z.unknown()),
|
|
15
|
+
});
|
|
16
|
+
export const listConnectionsInput = z.object({
|
|
17
|
+
abilityClaim: z.string().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const listConnectionsOutput = z.object({
|
|
20
|
+
connections: z.array(connectionListRowSchema),
|
|
21
|
+
});
|
|
22
|
+
export const getConnectionInput = z.object({
|
|
23
|
+
id: z.string().trim().min(1, "id is required"),
|
|
24
|
+
});
|
|
25
|
+
export const getConnectionOutput = connectionGetRowSchema;
|
|
26
|
+
export const connectModelsInput = z.object({
|
|
27
|
+
id: z.string().trim().min(1).optional(),
|
|
28
|
+
});
|
|
29
|
+
export const connectModelsRowSchema = z.object({
|
|
30
|
+
id: z.string(),
|
|
31
|
+
models: z.array(z.string()),
|
|
32
|
+
error: z.string(),
|
|
33
|
+
});
|
|
34
|
+
export const connectModelsOutput = z.object({
|
|
35
|
+
connections: z.array(connectModelsRowSchema),
|
|
36
|
+
});
|
|
37
|
+
export const setEnabledInput = z.object({
|
|
38
|
+
id: z.string().trim().min(1, "id is required"),
|
|
39
|
+
enabled: z.boolean(),
|
|
40
|
+
});
|
|
41
|
+
export const setEnabledOutput = z.object({ ok: z.boolean() });
|
|
42
|
+
export const persistToolInput = z.object({
|
|
43
|
+
id: z.string().trim().min(1, "id is required"),
|
|
44
|
+
tool: z.string().trim().min(1, "tool is required"),
|
|
45
|
+
});
|
|
46
|
+
export const persistToolOutput = z.object({ ok: z.literal(true) });
|
|
47
|
+
export const loginInput = z.object({
|
|
48
|
+
id: z.string().trim().min(1, "id is required"),
|
|
49
|
+
});
|
|
50
|
+
export const loginOutput = z.object({ ok: z.boolean() });
|
|
51
|
+
export const logoutInput = z.object({
|
|
52
|
+
id: z.string().trim().min(1, "id is required"),
|
|
53
|
+
});
|
|
54
|
+
export const logoutOutput = z.object({ ok: z.literal(true) });
|
|
55
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../../src/schemas/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;AAGlH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IA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AAC,CAAC;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAEzD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC;CAC/C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** `ui/resolve` payload minus `pending`. Closed union — extra keys fail. */
|
|
3
|
+
export declare const uiAnswerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
kind: z.ZodLiteral<"accept">;
|
|
5
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
6
|
+
kind: z.ZodLiteral<"cancel">;
|
|
7
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
8
|
+
kind: z.ZodLiteral<"text">;
|
|
9
|
+
input: z.ZodString;
|
|
10
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
11
|
+
kind: z.ZodLiteral<"opened">;
|
|
12
|
+
url: z.ZodString;
|
|
13
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
14
|
+
kind: z.ZodLiteral<"dismiss">;
|
|
15
|
+
}, z.core.$strict>], "kind">;
|
|
16
|
+
export type UiAnswer = z.infer<typeof uiAnswerSchema>;
|
|
17
|
+
/** Parked `harness/open-url` result. `pending` may be absent on the contract park. */
|
|
18
|
+
export declare const uiParkSchema: z.ZodObject<{
|
|
19
|
+
form: z.ZodLiteral<"ui">;
|
|
20
|
+
body: z.ZodString;
|
|
21
|
+
}, z.core.$loose>;
|
|
22
|
+
export declare const uiFormSchema: z.ZodObject<{
|
|
23
|
+
form: z.ZodLiteral<"ui">;
|
|
24
|
+
body: z.ZodString;
|
|
25
|
+
pending: z.ZodString;
|
|
26
|
+
}, z.core.$loose>;
|
|
27
|
+
export type UiForm = {
|
|
28
|
+
readonly form: "ui";
|
|
29
|
+
readonly body: string;
|
|
30
|
+
readonly pending: string;
|
|
31
|
+
};
|
|
32
|
+
export declare const jsonRpcId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
33
|
+
export type JsonRpcId = z.infer<typeof jsonRpcId>;
|
|
34
|
+
export declare const jsonRpcError: z.ZodObject<{
|
|
35
|
+
code: z.ZodNumber;
|
|
36
|
+
message: z.ZodString;
|
|
37
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
export type JsonRpcError = z.infer<typeof jsonRpcError>;
|
|
40
|
+
export declare const jsonRpcRequest: z.ZodObject<{
|
|
41
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
42
|
+
method: z.ZodString;
|
|
43
|
+
params: z.ZodOptional<z.ZodUnknown>;
|
|
44
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export type JsonRpcRequest = z.infer<typeof jsonRpcRequest>;
|
|
47
|
+
export declare const jsonRpcResponse: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
49
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
50
|
+
error: z.ZodObject<{
|
|
51
|
+
code: z.ZodNumber;
|
|
52
|
+
message: z.ZodString;
|
|
53
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
56
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
57
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
58
|
+
result: z.ZodUnknown;
|
|
59
|
+
}, z.core.$strip>]>;
|
|
60
|
+
export type JsonRpcResponse = z.infer<typeof jsonRpcResponse>;
|
|
61
|
+
export declare function isUiForm(value: unknown): value is UiForm;
|
|
62
|
+
/** `ui/resolve` envelope: the park id. The answer fields ride beside it (see {@link uiResolveInput}). */
|
|
63
|
+
export declare const uiResolvePending: z.ZodObject<{
|
|
64
|
+
pending: z.ZodString;
|
|
65
|
+
}, z.core.$loose>;
|
|
66
|
+
/** Full `ui/resolve` params: {@link uiAnswerSchema} plus the `pending` id. */
|
|
67
|
+
export declare const uiResolveInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
68
|
+
pending: z.ZodString;
|
|
69
|
+
kind: z.ZodLiteral<"accept">;
|
|
70
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
71
|
+
pending: z.ZodString;
|
|
72
|
+
kind: z.ZodLiteral<"cancel">;
|
|
73
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
74
|
+
pending: z.ZodString;
|
|
75
|
+
kind: z.ZodLiteral<"text">;
|
|
76
|
+
input: z.ZodString;
|
|
77
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
78
|
+
pending: z.ZodString;
|
|
79
|
+
kind: z.ZodLiteral<"opened">;
|
|
80
|
+
url: z.ZodString;
|
|
81
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
82
|
+
pending: z.ZodString;
|
|
83
|
+
kind: z.ZodLiteral<"dismiss">;
|
|
84
|
+
}, z.core.$strict>], "kind">;
|
|
85
|
+
export type UiResolveInput = z.infer<typeof uiResolveInput>;
|
|
86
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/schemas/rpc.ts"],"names":[],"mappings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