@vellumai/credential-executor 0.10.7-dev.202607092332.9deedf4 → 0.10.7-dev.202607100313.fffdfea
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/node_modules/@vellumai/service-contracts/package.json +0 -2
- package/node_modules/@vellumai/service-contracts/src/__tests__/contracts.test.ts +0 -2
- package/node_modules/@vellumai/service-contracts/src/credential-rpc.ts +3 -5
- package/node_modules/@vellumai/service-contracts/src/index.ts +2 -4
- package/node_modules/@vellumai/service-contracts/src/rpc.ts +4 -447
- package/package.json +1 -1
- package/src/__tests__/managed-integration.test.ts +108 -87
- package/src/index.ts +5 -85
- package/src/main.ts +79 -549
- package/src/paths.ts +0 -15
- package/src/server.ts +52 -469
- package/node_modules/@vellumai/service-contracts/src/__tests__/grants.test.ts +0 -686
- package/node_modules/@vellumai/service-contracts/src/grants.ts +0 -184
- package/node_modules/@vellumai/service-contracts/src/rendering.ts +0 -135
- package/src/__tests__/command-executor.test.ts +0 -1879
- package/src/__tests__/command-validator.test.ts +0 -1405
- package/src/__tests__/command-workspace.test.ts +0 -1050
- package/src/__tests__/grant-store.test.ts +0 -689
- package/src/__tests__/http-executor.test.ts +0 -1336
- package/src/__tests__/http-policy.test.ts +0 -1069
- package/src/__tests__/local-materializers.test.ts +0 -860
- package/src/__tests__/local-token-refresh.test.ts +0 -361
- package/src/__tests__/manage-secure-command-tool.test.ts +0 -134
- package/src/__tests__/managed-lazy-getters.test.ts +0 -359
- package/src/__tests__/managed-materializers.test.ts +0 -1028
- package/src/__tests__/managed-rejection.test.ts +0 -43
- package/src/__tests__/toolstore.test.ts +0 -773
- package/src/audit/store.ts +0 -188
- package/src/commands/auth-adapters.ts +0 -169
- package/src/commands/egress-hooks.ts +0 -203
- package/src/commands/executor.ts +0 -1155
- package/src/commands/output-scan.ts +0 -157
- package/src/commands/profiles.ts +0 -286
- package/src/commands/validator.ts +0 -702
- package/src/commands/workspace.ts +0 -550
- package/src/grants/index.ts +0 -17
- package/src/grants/persistent-store.ts +0 -309
- package/src/grants/rpc-handlers.ts +0 -293
- package/src/grants/temporary-store.ts +0 -289
- package/src/http/audit.ts +0 -84
- package/src/http/executor.ts +0 -684
- package/src/http/path-template.ts +0 -245
- package/src/http/policy.ts +0 -238
- package/src/http/response-filter.ts +0 -233
- package/src/managed-errors.ts +0 -9
- package/src/managed-lazy-getters.ts +0 -106
- package/src/materializers/local-oauth-lookup.ts +0 -98
- package/src/materializers/local-token-refresh.ts +0 -287
- package/src/materializers/local.ts +0 -316
- package/src/materializers/managed-platform.ts +0 -295
- package/src/subjects/local.ts +0 -177
- package/src/subjects/managed.ts +0 -311
- package/src/subjects/policy.ts +0 -79
- package/src/toolstore/integrity.ts +0 -94
- package/src/toolstore/manifest.ts +0 -154
- package/src/toolstore/publish.ts +0 -571
|
@@ -13,9 +13,7 @@
|
|
|
13
13
|
"./twilio-ingress": "./src/twilio-ingress.ts",
|
|
14
14
|
"./trust-rules": "./src/trust-rules.ts",
|
|
15
15
|
"./handles": "./src/handles.ts",
|
|
16
|
-
"./grants": "./src/grants.ts",
|
|
17
16
|
"./rpc": "./src/rpc.ts",
|
|
18
|
-
"./rendering": "./src/rendering.ts",
|
|
19
17
|
"./attachment-naming": "./src/attachment-naming.ts",
|
|
20
18
|
"./error": "./src/error.ts"
|
|
21
19
|
},
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @vellumai/service-contracts/credential-rpc
|
|
3
3
|
*
|
|
4
4
|
* Domain entrypoint for the CES (Credential Execution Service) transport and
|
|
5
|
-
* RPC surface. Re-exports the transport/RPC/handles/
|
|
6
|
-
*
|
|
5
|
+
* RPC surface. Re-exports the transport/RPC/handles/error contracts without
|
|
6
|
+
* the trust-rule helpers.
|
|
7
7
|
*
|
|
8
8
|
* Prefer this subpath over the root `.` import when you only need the
|
|
9
9
|
* credential RPC surface:
|
|
10
10
|
*
|
|
11
|
-
* import { CesRpcMethod,
|
|
11
|
+
* import { CesRpcMethod, GetCredentialSchema } from "@vellumai/service-contracts/credential-rpc";
|
|
12
12
|
*
|
|
13
13
|
* For trust-rule types use the dedicated subpath:
|
|
14
14
|
*
|
|
@@ -18,6 +18,4 @@
|
|
|
18
18
|
export * from "./transport.js";
|
|
19
19
|
export * from "./error.js";
|
|
20
20
|
export * from "./handles.js";
|
|
21
|
-
export * from "./grants.js";
|
|
22
|
-
export * from "./rendering.js";
|
|
23
21
|
export * from "./rpc.js";
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* This is a compatibility aggregate that re-exports everything from all
|
|
5
5
|
* submodules. Prefer the explicit domain subpaths for new code:
|
|
6
6
|
*
|
|
7
|
-
* - `@vellumai/service-contracts/credential-rpc` — transport, RPC, handles,
|
|
7
|
+
* - `@vellumai/service-contracts/credential-rpc` — transport, RPC, handles, error
|
|
8
8
|
* - `@vellumai/service-contracts/trust-rules` — trust-rule types and parsing helpers
|
|
9
9
|
* - `@vellumai/service-contracts/twilio-ingress` — shared Twilio ingress config constants
|
|
10
10
|
* - `@vellumai/service-contracts/ingress` — shared public ingress URL helpers
|
|
11
11
|
*
|
|
12
12
|
* Fine-grained subpaths are also available for low-friction migration:
|
|
13
|
-
* `./rpc`, `./handles`, `./
|
|
13
|
+
* `./rpc`, `./handles`, `./error`, `./trust-rules`, `./ingress`, `./twilio-ingress`
|
|
14
14
|
*
|
|
15
15
|
* Neutral wire-protocol contracts for communication between the assistant
|
|
16
16
|
* daemon and the Credential Execution Service (CES). This package is
|
|
@@ -23,9 +23,7 @@ export * from "./client-metadata.js";
|
|
|
23
23
|
export * from "./transport.js";
|
|
24
24
|
export * from "./error.js";
|
|
25
25
|
export * from "./handles.js";
|
|
26
|
-
export * from "./grants.js";
|
|
27
26
|
export * from "./rpc.js";
|
|
28
|
-
export * from "./rendering.js";
|
|
29
27
|
export * from "./trust-rules.js";
|
|
30
28
|
export * from "./ingress.js";
|
|
31
29
|
export * from "./twilio-ingress.js";
|
|
@@ -7,22 +7,6 @@
|
|
|
7
7
|
*
|
|
8
8
|
* Methods:
|
|
9
9
|
*
|
|
10
|
-
* **Tool execution**
|
|
11
|
-
* - `make_authenticated_request` — Execute an authenticated HTTP request
|
|
12
|
-
* - `run_authenticated_command` — Execute a command with credential env vars
|
|
13
|
-
* - `manage_secure_command_tool` — Register/unregister a secure command tool
|
|
14
|
-
*
|
|
15
|
-
* **Approval flow**
|
|
16
|
-
* - `approval_required` — CES notifies the assistant that approval is needed
|
|
17
|
-
* - `record_grant` — Record a grant decision after guardian approval
|
|
18
|
-
*
|
|
19
|
-
* **Grant management**
|
|
20
|
-
* - `list_grants` — List grants for a CES connection
|
|
21
|
-
* - `revoke_grant` — Revoke a specific grant
|
|
22
|
-
*
|
|
23
|
-
* **Audit**
|
|
24
|
-
* - `list_audit_records` — List audit records for inspection
|
|
25
|
-
*
|
|
26
10
|
* **Lifecycle**
|
|
27
11
|
* - `update_managed_credential` — Push an updated API key to CES after hatch
|
|
28
12
|
*
|
|
@@ -31,15 +15,10 @@
|
|
|
31
15
|
* - `set_credential` — Store or update a credential
|
|
32
16
|
* - `delete_credential` — Delete a credential by account name
|
|
33
17
|
* - `list_credentials` — List all credential account names
|
|
18
|
+
* - `bulk_set_credentials` — Store multiple credentials at once
|
|
34
19
|
*/
|
|
35
20
|
|
|
36
21
|
import { z } from "zod";
|
|
37
|
-
import {
|
|
38
|
-
AuditRecordSummarySchema,
|
|
39
|
-
GrantProposalSchema,
|
|
40
|
-
PersistentGrantRecordSchema,
|
|
41
|
-
TemporaryGrantDecisionSchema,
|
|
42
|
-
} from "./grants.js";
|
|
43
22
|
import { RpcErrorSchema } from "./error.js";
|
|
44
23
|
|
|
45
24
|
// ---------------------------------------------------------------------------
|
|
@@ -47,14 +26,6 @@ import { RpcErrorSchema } from "./error.js";
|
|
|
47
26
|
// ---------------------------------------------------------------------------
|
|
48
27
|
|
|
49
28
|
export const CesRpcMethod = {
|
|
50
|
-
MakeAuthenticatedRequest: "make_authenticated_request",
|
|
51
|
-
RunAuthenticatedCommand: "run_authenticated_command",
|
|
52
|
-
ManageSecureCommandTool: "manage_secure_command_tool",
|
|
53
|
-
ApprovalRequired: "approval_required",
|
|
54
|
-
RecordGrant: "record_grant",
|
|
55
|
-
ListGrants: "list_grants",
|
|
56
|
-
RevokeGrant: "revoke_grant",
|
|
57
|
-
ListAuditRecords: "list_audit_records",
|
|
58
29
|
/** Push an updated assistant credential to CES after post-hatch provisioning. */
|
|
59
30
|
UpdateManagedCredential: "update_managed_credential",
|
|
60
31
|
/** Retrieve a single credential by account name. */
|
|
@@ -69,353 +40,7 @@ export const CesRpcMethod = {
|
|
|
69
40
|
BulkSetCredentials: "bulk_set_credentials",
|
|
70
41
|
} as const;
|
|
71
42
|
|
|
72
|
-
export type CesRpcMethod =
|
|
73
|
-
(typeof CesRpcMethod)[keyof typeof CesRpcMethod];
|
|
74
|
-
|
|
75
|
-
// ---------------------------------------------------------------------------
|
|
76
|
-
// make_authenticated_request
|
|
77
|
-
// ---------------------------------------------------------------------------
|
|
78
|
-
|
|
79
|
-
export const MakeAuthenticatedRequestSchema = z.object({
|
|
80
|
-
/** CES credential handle to use for authentication. */
|
|
81
|
-
credentialHandle: z.string(),
|
|
82
|
-
/** HTTP method. */
|
|
83
|
-
method: z.string(),
|
|
84
|
-
/** Target URL. */
|
|
85
|
-
url: z.string(),
|
|
86
|
-
/** Optional request headers (credential headers are injected by CES). */
|
|
87
|
-
headers: z.record(z.string(), z.string()).optional(),
|
|
88
|
-
/** Optional request body (string or JSON-serialisable). */
|
|
89
|
-
body: z.unknown().optional(),
|
|
90
|
-
/** Human-readable purpose for audit logging. */
|
|
91
|
-
purpose: z.string(),
|
|
92
|
-
/** Existing grant ID to consume, if the caller holds one. */
|
|
93
|
-
grantId: z.string().optional(),
|
|
94
|
-
/** Conversation ID for conversation-scoped temporary grants. */
|
|
95
|
-
conversationId: z.string().optional(),
|
|
96
|
-
});
|
|
97
|
-
export type MakeAuthenticatedRequest = z.infer<
|
|
98
|
-
typeof MakeAuthenticatedRequestSchema
|
|
99
|
-
>;
|
|
100
|
-
|
|
101
|
-
export const MakeAuthenticatedRequestResponseSchema = z.object({
|
|
102
|
-
/** Whether the request was executed (not whether the HTTP call succeeded). */
|
|
103
|
-
success: z.boolean(),
|
|
104
|
-
/** HTTP status code returned by the target. */
|
|
105
|
-
statusCode: z.number().optional(),
|
|
106
|
-
/** Response headers. */
|
|
107
|
-
responseHeaders: z.record(z.string(), z.string()).optional(),
|
|
108
|
-
/** Response body (string). */
|
|
109
|
-
responseBody: z.string().optional(),
|
|
110
|
-
/** Structured error if execution failed. */
|
|
111
|
-
error: RpcErrorSchema.optional(),
|
|
112
|
-
/** Audit record ID for this execution. */
|
|
113
|
-
auditId: z.string().optional(),
|
|
114
|
-
});
|
|
115
|
-
export type MakeAuthenticatedRequestResponse = z.infer<
|
|
116
|
-
typeof MakeAuthenticatedRequestResponseSchema
|
|
117
|
-
>;
|
|
118
|
-
|
|
119
|
-
// ---------------------------------------------------------------------------
|
|
120
|
-
// run_authenticated_command
|
|
121
|
-
// ---------------------------------------------------------------------------
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* A file to stage from the assistant workspace into the CES scratch directory.
|
|
125
|
-
*/
|
|
126
|
-
const WorkspaceInputSchema = z.object({
|
|
127
|
-
/** Relative path within the assistant workspace directory. */
|
|
128
|
-
workspacePath: z.string(),
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* A file the command produces in the scratch directory that should be
|
|
133
|
-
* copied back to the assistant workspace after execution.
|
|
134
|
-
*/
|
|
135
|
-
const WorkspaceOutputSchema = z.object({
|
|
136
|
-
/** Relative path within the scratch directory where the command writes output. */
|
|
137
|
-
scratchPath: z.string(),
|
|
138
|
-
/** Relative path within the assistant workspace where the output is copied. */
|
|
139
|
-
workspacePath: z.string(),
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
export const RunAuthenticatedCommandSchema = z.object({
|
|
143
|
-
/** CES credential handle to use for environment injection. */
|
|
144
|
-
credentialHandle: z.string(),
|
|
145
|
-
/** Secure command reference in format '<bundleDigest>/<profileName> [argv...]'. Only manifest-driven secure commands are supported. */
|
|
146
|
-
command: z.string(),
|
|
147
|
-
/** Optional path used for resolving workspace input/output staging, not as the actual execution working directory (CES always runs commands in the scratch directory). */
|
|
148
|
-
cwd: z.string().optional(),
|
|
149
|
-
/** Workspace files to stage as read-only inputs in the CES scratch directory. */
|
|
150
|
-
inputs: z.array(WorkspaceInputSchema).optional(),
|
|
151
|
-
/** Workspace files to copy back from the CES scratch directory after execution. */
|
|
152
|
-
outputs: z.array(WorkspaceOutputSchema).optional(),
|
|
153
|
-
/** Human-readable purpose for audit logging. */
|
|
154
|
-
purpose: z.string(),
|
|
155
|
-
/** Existing grant ID to consume, if the caller holds one. */
|
|
156
|
-
grantId: z.string().optional(),
|
|
157
|
-
/** Conversation ID for conversation-scoped temporary grants. */
|
|
158
|
-
conversationId: z.string().optional(),
|
|
159
|
-
});
|
|
160
|
-
export type RunAuthenticatedCommand = z.infer<
|
|
161
|
-
typeof RunAuthenticatedCommandSchema
|
|
162
|
-
>;
|
|
163
|
-
|
|
164
|
-
export const RunAuthenticatedCommandResponseSchema = z.object({
|
|
165
|
-
/** Whether the command was executed. */
|
|
166
|
-
success: z.boolean(),
|
|
167
|
-
/** Process exit code. */
|
|
168
|
-
exitCode: z.number().optional(),
|
|
169
|
-
/** Combined stdout output. */
|
|
170
|
-
stdout: z.string().optional(),
|
|
171
|
-
/** Combined stderr output. */
|
|
172
|
-
stderr: z.string().optional(),
|
|
173
|
-
/** Structured error if execution failed. */
|
|
174
|
-
error: RpcErrorSchema.optional(),
|
|
175
|
-
/** Audit record ID for this execution. */
|
|
176
|
-
auditId: z.string().optional(),
|
|
177
|
-
});
|
|
178
|
-
export type RunAuthenticatedCommandResponse = z.infer<
|
|
179
|
-
typeof RunAuthenticatedCommandResponseSchema
|
|
180
|
-
>;
|
|
181
|
-
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
// manage_secure_command_tool
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
|
|
186
|
-
export const ManageSecureCommandToolAction = {
|
|
187
|
-
Register: "register",
|
|
188
|
-
Unregister: "unregister",
|
|
189
|
-
} as const;
|
|
190
|
-
|
|
191
|
-
export type ManageSecureCommandToolAction =
|
|
192
|
-
(typeof ManageSecureCommandToolAction)[keyof typeof ManageSecureCommandToolAction];
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Zod schema for allowed argv patterns within a command profile.
|
|
196
|
-
*/
|
|
197
|
-
const AllowedArgvPatternSchema = z.object({
|
|
198
|
-
name: z.string(),
|
|
199
|
-
tokens: z.array(z.string()),
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* Zod schema for allowed network targets within a command profile.
|
|
204
|
-
*/
|
|
205
|
-
const AllowedNetworkTargetSchema = z.object({
|
|
206
|
-
hostPattern: z.string(),
|
|
207
|
-
ports: z.array(z.number()).optional(),
|
|
208
|
-
protocols: z.array(z.enum(["http", "https"])).optional(),
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Zod schema for a single command profile within a secure command manifest.
|
|
213
|
-
*/
|
|
214
|
-
const CommandProfileSchema = z.object({
|
|
215
|
-
description: z.string(),
|
|
216
|
-
allowedArgvPatterns: z.array(AllowedArgvPatternSchema),
|
|
217
|
-
deniedSubcommands: z.array(z.string()),
|
|
218
|
-
deniedFlags: z.array(z.string()).optional(),
|
|
219
|
-
allowedNetworkTargets: z.array(AllowedNetworkTargetSchema).optional(),
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Zod schema for auth adapter configuration (discriminated union on `type`).
|
|
224
|
-
*/
|
|
225
|
-
const AuthAdapterConfigSchema = z.discriminatedUnion("type", [
|
|
226
|
-
z.object({
|
|
227
|
-
type: z.literal("env_var"),
|
|
228
|
-
envVarName: z.string(),
|
|
229
|
-
valuePrefix: z.string().optional(),
|
|
230
|
-
}),
|
|
231
|
-
z.object({
|
|
232
|
-
type: z.literal("temp_file"),
|
|
233
|
-
envVarName: z.string(),
|
|
234
|
-
fileExtension: z.string().optional(),
|
|
235
|
-
fileMode: z.number().optional(),
|
|
236
|
-
}),
|
|
237
|
-
z.object({
|
|
238
|
-
type: z.literal("credential_process"),
|
|
239
|
-
envVarName: z.string(),
|
|
240
|
-
helperCommand: z.string(),
|
|
241
|
-
timeoutMs: z.number().optional(),
|
|
242
|
-
}),
|
|
243
|
-
]);
|
|
244
|
-
|
|
245
|
-
/**
|
|
246
|
-
* Zod schema for the full secure command manifest passed during register.
|
|
247
|
-
* This mirrors the {@link SecureCommandManifest} interface in
|
|
248
|
-
* `credential-executor/src/commands/profiles.ts`.
|
|
249
|
-
*/
|
|
250
|
-
export const SecureCommandManifestSchema = z.object({
|
|
251
|
-
schemaVersion: z.string(),
|
|
252
|
-
bundleDigest: z.string(),
|
|
253
|
-
bundleId: z.string(),
|
|
254
|
-
version: z.string(),
|
|
255
|
-
entrypoint: z.string(),
|
|
256
|
-
commandProfiles: z.record(z.string(), CommandProfileSchema),
|
|
257
|
-
authAdapter: AuthAdapterConfigSchema,
|
|
258
|
-
egressMode: z.enum(["proxy_required", "no_network"]),
|
|
259
|
-
cleanConfigDirs: z.record(z.string(), z.string()).optional(),
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
export const ManageSecureCommandToolSchema = z.object({
|
|
263
|
-
/** Whether to register or unregister the tool. */
|
|
264
|
-
action: z.enum(["register", "unregister"]),
|
|
265
|
-
/** Tool name to register/unregister. */
|
|
266
|
-
toolName: z.string(),
|
|
267
|
-
/** CES credential handle the tool should use (required for register). */
|
|
268
|
-
credentialHandle: z.string().optional(),
|
|
269
|
-
/** Human-readable description of the tool (required for register). */
|
|
270
|
-
description: z.string().optional(),
|
|
271
|
-
/** Bundle identifier for the secure command package (required for register). */
|
|
272
|
-
bundleId: z.string().optional(),
|
|
273
|
-
/** Semantic version of the bundle to install (required for register). */
|
|
274
|
-
version: z.string().optional(),
|
|
275
|
-
/** HTTPS URL from which CES will download the bundle (required for register). */
|
|
276
|
-
sourceUrl: z.string().optional(),
|
|
277
|
-
/** SHA-256 hex digest of the bundle for integrity verification (required for register). */
|
|
278
|
-
sha256: z.string().optional(),
|
|
279
|
-
/**
|
|
280
|
-
* Full secure command manifest for the bundle (required for register).
|
|
281
|
-
* Contains entrypoint, command profiles, auth adapter, egress mode, etc.
|
|
282
|
-
* CES validates this manifest before publishing the bundle.
|
|
283
|
-
*/
|
|
284
|
-
secureCommandManifest: SecureCommandManifestSchema.optional(),
|
|
285
|
-
});
|
|
286
|
-
export type ManageSecureCommandTool = z.infer<
|
|
287
|
-
typeof ManageSecureCommandToolSchema
|
|
288
|
-
>;
|
|
289
|
-
|
|
290
|
-
export const ManageSecureCommandToolResponseSchema = z.object({
|
|
291
|
-
/** Whether the operation succeeded. */
|
|
292
|
-
success: z.boolean(),
|
|
293
|
-
/** Structured error if the operation failed. */
|
|
294
|
-
error: RpcErrorSchema.optional(),
|
|
295
|
-
});
|
|
296
|
-
export type ManageSecureCommandToolResponse = z.infer<
|
|
297
|
-
typeof ManageSecureCommandToolResponseSchema
|
|
298
|
-
>;
|
|
299
|
-
|
|
300
|
-
// ---------------------------------------------------------------------------
|
|
301
|
-
// approval_required (CES → assistant notification)
|
|
302
|
-
// ---------------------------------------------------------------------------
|
|
303
|
-
|
|
304
|
-
export const ApprovalRequiredSchema = z.object({
|
|
305
|
-
/** The proposal that requires approval. */
|
|
306
|
-
proposal: GrantProposalSchema,
|
|
307
|
-
/** Deterministic hash of the proposal. */
|
|
308
|
-
proposalHash: z.string(),
|
|
309
|
-
/** Human-readable rendering of the proposal. */
|
|
310
|
-
renderedProposal: z.string(),
|
|
311
|
-
/** The CES connection requesting approval. */
|
|
312
|
-
sessionId: z.string(),
|
|
313
|
-
/** The conversation ID for conversation-scoped grants. */
|
|
314
|
-
conversationId: z.string().optional(),
|
|
315
|
-
});
|
|
316
|
-
export type ApprovalRequired = z.infer<typeof ApprovalRequiredSchema>;
|
|
317
|
-
|
|
318
|
-
export const ApprovalRequiredResponseSchema = z.object({
|
|
319
|
-
/** Whether the assistant acknowledged the approval request. */
|
|
320
|
-
acknowledged: z.boolean(),
|
|
321
|
-
});
|
|
322
|
-
export type ApprovalRequiredResponse = z.infer<
|
|
323
|
-
typeof ApprovalRequiredResponseSchema
|
|
324
|
-
>;
|
|
325
|
-
|
|
326
|
-
// ---------------------------------------------------------------------------
|
|
327
|
-
// record_grant
|
|
328
|
-
// ---------------------------------------------------------------------------
|
|
329
|
-
|
|
330
|
-
export const RecordGrantSchema = z.object({
|
|
331
|
-
/** The grant decision from the guardian. */
|
|
332
|
-
decision: TemporaryGrantDecisionSchema,
|
|
333
|
-
/** The CES connection this grant applies to. */
|
|
334
|
-
sessionId: z.string(),
|
|
335
|
-
/** The conversation ID for conversation-scoped grants. */
|
|
336
|
-
conversationId: z.string().optional(),
|
|
337
|
-
});
|
|
338
|
-
export type RecordGrant = z.infer<typeof RecordGrantSchema>;
|
|
339
|
-
|
|
340
|
-
export const RecordGrantResponseSchema = z.object({
|
|
341
|
-
/** Whether the grant was successfully recorded. */
|
|
342
|
-
success: z.boolean(),
|
|
343
|
-
/** The persisted grant record (when approved and recorded). */
|
|
344
|
-
grant: PersistentGrantRecordSchema.optional(),
|
|
345
|
-
/** Structured error if recording failed. */
|
|
346
|
-
error: RpcErrorSchema.optional(),
|
|
347
|
-
});
|
|
348
|
-
export type RecordGrantResponse = z.infer<typeof RecordGrantResponseSchema>;
|
|
349
|
-
|
|
350
|
-
// ---------------------------------------------------------------------------
|
|
351
|
-
// list_grants
|
|
352
|
-
// ---------------------------------------------------------------------------
|
|
353
|
-
|
|
354
|
-
export const ListGrantsSchema = z.object({
|
|
355
|
-
/** Filter by CES connection ID. */
|
|
356
|
-
sessionId: z.string().optional(),
|
|
357
|
-
/** Filter by credential handle. */
|
|
358
|
-
credentialHandle: z.string().optional(),
|
|
359
|
-
/** Filter by grant status. */
|
|
360
|
-
status: z
|
|
361
|
-
.enum(["active", "expired", "revoked", "consumed"])
|
|
362
|
-
.optional(),
|
|
363
|
-
});
|
|
364
|
-
export type ListGrants = z.infer<typeof ListGrantsSchema>;
|
|
365
|
-
|
|
366
|
-
export const ListGrantsResponseSchema = z.object({
|
|
367
|
-
/** List of matching grant records. */
|
|
368
|
-
grants: z.array(PersistentGrantRecordSchema),
|
|
369
|
-
});
|
|
370
|
-
export type ListGrantsResponse = z.infer<typeof ListGrantsResponseSchema>;
|
|
371
|
-
|
|
372
|
-
// ---------------------------------------------------------------------------
|
|
373
|
-
// revoke_grant
|
|
374
|
-
// ---------------------------------------------------------------------------
|
|
375
|
-
|
|
376
|
-
export const RevokeGrantSchema = z.object({
|
|
377
|
-
/** The grant to revoke. */
|
|
378
|
-
grantId: z.string(),
|
|
379
|
-
/** Human-readable reason for revocation. */
|
|
380
|
-
reason: z.string().optional(),
|
|
381
|
-
});
|
|
382
|
-
export type RevokeGrant = z.infer<typeof RevokeGrantSchema>;
|
|
383
|
-
|
|
384
|
-
export const RevokeGrantResponseSchema = z.object({
|
|
385
|
-
/** Whether the grant was successfully revoked. */
|
|
386
|
-
success: z.boolean(),
|
|
387
|
-
/** Structured error if revocation failed. */
|
|
388
|
-
error: RpcErrorSchema.optional(),
|
|
389
|
-
});
|
|
390
|
-
export type RevokeGrantResponse = z.infer<typeof RevokeGrantResponseSchema>;
|
|
391
|
-
|
|
392
|
-
// ---------------------------------------------------------------------------
|
|
393
|
-
// list_audit_records
|
|
394
|
-
// ---------------------------------------------------------------------------
|
|
395
|
-
|
|
396
|
-
export const ListAuditRecordsSchema = z.object({
|
|
397
|
-
/** Filter by CES connection ID. */
|
|
398
|
-
sessionId: z.string().optional(),
|
|
399
|
-
/** Filter by credential handle. */
|
|
400
|
-
credentialHandle: z.string().optional(),
|
|
401
|
-
/** Filter by grant ID. */
|
|
402
|
-
grantId: z.string().optional(),
|
|
403
|
-
/** Maximum number of records to return. */
|
|
404
|
-
limit: z.number().optional(),
|
|
405
|
-
/** Cursor for pagination (opaque string from a previous response). */
|
|
406
|
-
cursor: z.string().optional(),
|
|
407
|
-
});
|
|
408
|
-
export type ListAuditRecords = z.infer<typeof ListAuditRecordsSchema>;
|
|
409
|
-
|
|
410
|
-
export const ListAuditRecordsResponseSchema = z.object({
|
|
411
|
-
/** List of matching audit record summaries. */
|
|
412
|
-
records: z.array(AuditRecordSummarySchema),
|
|
413
|
-
/** Cursor for the next page (null if no more results). */
|
|
414
|
-
nextCursor: z.string().nullable(),
|
|
415
|
-
});
|
|
416
|
-
export type ListAuditRecordsResponse = z.infer<
|
|
417
|
-
typeof ListAuditRecordsResponseSchema
|
|
418
|
-
>;
|
|
43
|
+
export type CesRpcMethod = (typeof CesRpcMethod)[keyof typeof CesRpcMethod];
|
|
419
44
|
|
|
420
45
|
// ---------------------------------------------------------------------------
|
|
421
46
|
// update_managed_credential
|
|
@@ -458,9 +83,7 @@ export const GetCredentialResponseSchema = z.object({
|
|
|
458
83
|
/** The credential value (present only when found). */
|
|
459
84
|
value: z.string().optional(),
|
|
460
85
|
});
|
|
461
|
-
export type GetCredentialResponse = z.infer<
|
|
462
|
-
typeof GetCredentialResponseSchema
|
|
463
|
-
>;
|
|
86
|
+
export type GetCredentialResponse = z.infer<typeof GetCredentialResponseSchema>;
|
|
464
87
|
|
|
465
88
|
// ---------------------------------------------------------------------------
|
|
466
89
|
// set_credential
|
|
@@ -478,9 +101,7 @@ export const SetCredentialResponseSchema = z.object({
|
|
|
478
101
|
/** Whether the credential was successfully stored. */
|
|
479
102
|
ok: z.boolean(),
|
|
480
103
|
});
|
|
481
|
-
export type SetCredentialResponse = z.infer<
|
|
482
|
-
typeof SetCredentialResponseSchema
|
|
483
|
-
>;
|
|
104
|
+
export type SetCredentialResponse = z.infer<typeof SetCredentialResponseSchema>;
|
|
484
105
|
|
|
485
106
|
// ---------------------------------------------------------------------------
|
|
486
107
|
// delete_credential
|
|
@@ -556,38 +177,6 @@ export type BulkSetCredentialsResponse = z.infer<
|
|
|
556
177
|
* schemas. Useful for building type-safe RPC dispatch layers.
|
|
557
178
|
*/
|
|
558
179
|
export interface CesRpcContract {
|
|
559
|
-
[CesRpcMethod.MakeAuthenticatedRequest]: {
|
|
560
|
-
request: MakeAuthenticatedRequest;
|
|
561
|
-
response: MakeAuthenticatedRequestResponse;
|
|
562
|
-
};
|
|
563
|
-
[CesRpcMethod.RunAuthenticatedCommand]: {
|
|
564
|
-
request: RunAuthenticatedCommand;
|
|
565
|
-
response: RunAuthenticatedCommandResponse;
|
|
566
|
-
};
|
|
567
|
-
[CesRpcMethod.ManageSecureCommandTool]: {
|
|
568
|
-
request: ManageSecureCommandTool;
|
|
569
|
-
response: ManageSecureCommandToolResponse;
|
|
570
|
-
};
|
|
571
|
-
[CesRpcMethod.ApprovalRequired]: {
|
|
572
|
-
request: ApprovalRequired;
|
|
573
|
-
response: ApprovalRequiredResponse;
|
|
574
|
-
};
|
|
575
|
-
[CesRpcMethod.RecordGrant]: {
|
|
576
|
-
request: RecordGrant;
|
|
577
|
-
response: RecordGrantResponse;
|
|
578
|
-
};
|
|
579
|
-
[CesRpcMethod.ListGrants]: {
|
|
580
|
-
request: ListGrants;
|
|
581
|
-
response: ListGrantsResponse;
|
|
582
|
-
};
|
|
583
|
-
[CesRpcMethod.RevokeGrant]: {
|
|
584
|
-
request: RevokeGrant;
|
|
585
|
-
response: RevokeGrantResponse;
|
|
586
|
-
};
|
|
587
|
-
[CesRpcMethod.ListAuditRecords]: {
|
|
588
|
-
request: ListAuditRecords;
|
|
589
|
-
response: ListAuditRecordsResponse;
|
|
590
|
-
};
|
|
591
180
|
[CesRpcMethod.UpdateManagedCredential]: {
|
|
592
181
|
request: UpdateManagedCredential;
|
|
593
182
|
response: UpdateManagedCredentialResponse;
|
|
@@ -618,38 +207,6 @@ export interface CesRpcContract {
|
|
|
618
207
|
* Schema lookup map for runtime validation of RPC payloads.
|
|
619
208
|
*/
|
|
620
209
|
export const CesRpcSchemas = {
|
|
621
|
-
[CesRpcMethod.MakeAuthenticatedRequest]: {
|
|
622
|
-
request: MakeAuthenticatedRequestSchema,
|
|
623
|
-
response: MakeAuthenticatedRequestResponseSchema,
|
|
624
|
-
},
|
|
625
|
-
[CesRpcMethod.RunAuthenticatedCommand]: {
|
|
626
|
-
request: RunAuthenticatedCommandSchema,
|
|
627
|
-
response: RunAuthenticatedCommandResponseSchema,
|
|
628
|
-
},
|
|
629
|
-
[CesRpcMethod.ManageSecureCommandTool]: {
|
|
630
|
-
request: ManageSecureCommandToolSchema,
|
|
631
|
-
response: ManageSecureCommandToolResponseSchema,
|
|
632
|
-
},
|
|
633
|
-
[CesRpcMethod.ApprovalRequired]: {
|
|
634
|
-
request: ApprovalRequiredSchema,
|
|
635
|
-
response: ApprovalRequiredResponseSchema,
|
|
636
|
-
},
|
|
637
|
-
[CesRpcMethod.RecordGrant]: {
|
|
638
|
-
request: RecordGrantSchema,
|
|
639
|
-
response: RecordGrantResponseSchema,
|
|
640
|
-
},
|
|
641
|
-
[CesRpcMethod.ListGrants]: {
|
|
642
|
-
request: ListGrantsSchema,
|
|
643
|
-
response: ListGrantsResponseSchema,
|
|
644
|
-
},
|
|
645
|
-
[CesRpcMethod.RevokeGrant]: {
|
|
646
|
-
request: RevokeGrantSchema,
|
|
647
|
-
response: RevokeGrantResponseSchema,
|
|
648
|
-
},
|
|
649
|
-
[CesRpcMethod.ListAuditRecords]: {
|
|
650
|
-
request: ListAuditRecordsSchema,
|
|
651
|
-
response: ListAuditRecordsResponseSchema,
|
|
652
|
-
},
|
|
653
210
|
[CesRpcMethod.UpdateManagedCredential]: {
|
|
654
211
|
request: UpdateManagedCredentialSchema,
|
|
655
212
|
response: UpdateManagedCredentialResponseSchema,
|