@gebsecure01/sdk 0.2.1
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/CHANGELOG.md +64 -0
- package/README.md +188 -0
- package/dist/index.cjs +1241 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2378 -0
- package/dist/index.d.ts +2378 -0
- package/dist/index.js +1218 -0
- package/dist/index.js.map +1 -0
- package/package.json +58 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2378 @@
|
|
|
1
|
+
/** Time source used for token expiry, backoff and approval polling. Injectable for tests. */
|
|
2
|
+
interface Clock {
|
|
3
|
+
/** Milliseconds since the epoch. */
|
|
4
|
+
now(): number;
|
|
5
|
+
/** Resolves after `ms`; rejects with the signal's reason if aborted. */
|
|
6
|
+
sleep(ms: number, signal?: AbortSignal): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
declare const systemClock: Clock;
|
|
9
|
+
|
|
10
|
+
/** Agent lifecycle status. Unknown future values are preserved as plain strings. */
|
|
11
|
+
declare const AgentStatus: {
|
|
12
|
+
readonly ACTIVE: "active";
|
|
13
|
+
readonly SUSPENDED: "suspended";
|
|
14
|
+
readonly DISABLED: "disabled";
|
|
15
|
+
readonly QUARANTINED: "quarantined";
|
|
16
|
+
};
|
|
17
|
+
type AgentStatus = (typeof AgentStatus)[keyof typeof AgentStatus] | (string & {});
|
|
18
|
+
/** Security alert lifecycle status. Unknown future values are preserved as plain strings. */
|
|
19
|
+
declare const AlertStatus: {
|
|
20
|
+
readonly OPEN: "open";
|
|
21
|
+
readonly ACKNOWLEDGED: "acknowledged";
|
|
22
|
+
readonly INVESTIGATING: "investigating";
|
|
23
|
+
readonly RESOLVED: "resolved";
|
|
24
|
+
readonly DISMISSED: "dismissed";
|
|
25
|
+
};
|
|
26
|
+
type AlertStatus = (typeof AlertStatus)[keyof typeof AlertStatus] | (string & {});
|
|
27
|
+
/** Approval request status. Unknown future values are preserved as plain strings. */
|
|
28
|
+
declare const ApprovalStatus: {
|
|
29
|
+
readonly PENDING: "pending";
|
|
30
|
+
readonly APPROVED: "approved";
|
|
31
|
+
readonly REJECTED: "rejected";
|
|
32
|
+
readonly EXPIRED: "expired";
|
|
33
|
+
readonly CANCELLED: "cancelled";
|
|
34
|
+
readonly CONSUMED: "consumed";
|
|
35
|
+
};
|
|
36
|
+
type ApprovalStatus = (typeof ApprovalStatus)[keyof typeof ApprovalStatus] | (string & {});
|
|
37
|
+
/** An approver's verdict. Unknown future values are preserved as plain strings. */
|
|
38
|
+
declare const ApprovalVerdict: {
|
|
39
|
+
readonly APPROVE: "approve";
|
|
40
|
+
readonly REJECT: "reject";
|
|
41
|
+
};
|
|
42
|
+
type ApprovalVerdict = (typeof ApprovalVerdict)[keyof typeof ApprovalVerdict] | (string & {});
|
|
43
|
+
/** Where inspected content came from (determines its trust level). Unknown future values are preserved as plain strings. */
|
|
44
|
+
declare const ContentSource: {
|
|
45
|
+
readonly PROMPT: "prompt";
|
|
46
|
+
readonly WEB: "web";
|
|
47
|
+
readonly EMAIL: "email";
|
|
48
|
+
readonly DOCUMENT: "document";
|
|
49
|
+
readonly RAG: "rag";
|
|
50
|
+
readonly MCP_RESPONSE: "mcp_response";
|
|
51
|
+
readonly TOOL_OUTPUT: "tool_output";
|
|
52
|
+
};
|
|
53
|
+
type ContentSource = (typeof ContentSource)[keyof typeof ContentSource] | (string & {});
|
|
54
|
+
/** Authorization decision. Unknown future values are preserved as plain strings. */
|
|
55
|
+
declare const Decision: {
|
|
56
|
+
readonly ALLOW: "ALLOW";
|
|
57
|
+
readonly DENY: "DENY";
|
|
58
|
+
readonly APPROVAL_REQUIRED: "APPROVAL_REQUIRED";
|
|
59
|
+
};
|
|
60
|
+
type Decision = (typeof Decision)[keyof typeof Decision] | (string & {});
|
|
61
|
+
/** Scopes that may be delegated to another agent. Unknown future values are preserved as plain strings. */
|
|
62
|
+
declare const DelegationScope: {
|
|
63
|
+
readonly AUTHORIZE: "authorize";
|
|
64
|
+
readonly EXECUTE: "execute";
|
|
65
|
+
readonly MCP_CONNECT: "mcp:connect";
|
|
66
|
+
readonly SECRETS_USE: "secrets:use";
|
|
67
|
+
readonly BROWSER_USE: "browser:use";
|
|
68
|
+
readonly DATABASE_USE: "database:use";
|
|
69
|
+
readonly DELEGATIONS_MANAGE: "delegations:manage";
|
|
70
|
+
};
|
|
71
|
+
type DelegationScope = (typeof DelegationScope)[keyof typeof DelegationScope] | (string & {});
|
|
72
|
+
/** DLP enforcement action. Unknown future values are preserved as plain strings. */
|
|
73
|
+
declare const DlpAction: {
|
|
74
|
+
readonly ALLOW: "ALLOW";
|
|
75
|
+
readonly MASK: "MASK";
|
|
76
|
+
readonly REDACT: "REDACT";
|
|
77
|
+
readonly BLOCK: "BLOCK";
|
|
78
|
+
readonly REQUIRE_APPROVAL: "REQUIRE_APPROVAL";
|
|
79
|
+
};
|
|
80
|
+
type DlpAction = (typeof DlpAction)[keyof typeof DlpAction] | (string & {});
|
|
81
|
+
/** Direction of data flow for DLP. Unknown future values are preserved as plain strings. */
|
|
82
|
+
declare const DlpDirection: {
|
|
83
|
+
readonly INBOUND: "inbound";
|
|
84
|
+
readonly OUTBOUND: "outbound";
|
|
85
|
+
};
|
|
86
|
+
type DlpDirection = (typeof DlpDirection)[keyof typeof DlpDirection] | (string & {});
|
|
87
|
+
/** Execution mode. Unknown future values are preserved as plain strings. */
|
|
88
|
+
declare const ExecuteMode: {
|
|
89
|
+
readonly SYNC: "sync";
|
|
90
|
+
readonly ASYNC: "async";
|
|
91
|
+
};
|
|
92
|
+
type ExecuteMode = (typeof ExecuteMode)[keyof typeof ExecuteMode] | (string & {});
|
|
93
|
+
/** Execution lifecycle status. Unknown future values are preserved as plain strings. */
|
|
94
|
+
declare const ExecutionStatus: {
|
|
95
|
+
readonly PENDING: "pending";
|
|
96
|
+
readonly RUNNING: "running";
|
|
97
|
+
readonly SUCCEEDED: "succeeded";
|
|
98
|
+
readonly FAILED: "failed";
|
|
99
|
+
readonly DENIED: "denied";
|
|
100
|
+
readonly AWAITING_APPROVAL: "awaiting_approval";
|
|
101
|
+
readonly CANCELLED: "cancelled";
|
|
102
|
+
readonly CANCELLING: "cancelling";
|
|
103
|
+
readonly SIMULATED: "simulated";
|
|
104
|
+
};
|
|
105
|
+
type ExecutionStatus = (typeof ExecutionStatus)[keyof typeof ExecutionStatus] | (string & {});
|
|
106
|
+
/** Prompt-injection severity level. Unknown future values are preserved as plain strings. */
|
|
107
|
+
declare const InjectionLevel: {
|
|
108
|
+
readonly NONE: "none";
|
|
109
|
+
readonly LOW: "low";
|
|
110
|
+
readonly MEDIUM: "medium";
|
|
111
|
+
readonly HIGH: "high";
|
|
112
|
+
readonly CRITICAL: "critical";
|
|
113
|
+
};
|
|
114
|
+
type InjectionLevel = (typeof InjectionLevel)[keyof typeof InjectionLevel] | (string & {});
|
|
115
|
+
/** Risk level. Unknown future values are preserved as plain strings. */
|
|
116
|
+
declare const RiskLevel: {
|
|
117
|
+
readonly LOW: "low";
|
|
118
|
+
readonly MEDIUM: "medium";
|
|
119
|
+
readonly HIGH: "high";
|
|
120
|
+
readonly CRITICAL: "critical";
|
|
121
|
+
};
|
|
122
|
+
type RiskLevel = (typeof RiskLevel)[keyof typeof RiskLevel] | (string & {});
|
|
123
|
+
/** Risk engine recommendation. Unknown future values are preserved as plain strings. */
|
|
124
|
+
declare const RiskRecommendation: {
|
|
125
|
+
readonly ALLOW: "allow";
|
|
126
|
+
readonly APPROVAL_REQUIRED: "approval_required";
|
|
127
|
+
readonly DENY: "deny";
|
|
128
|
+
};
|
|
129
|
+
type RiskRecommendation = (typeof RiskRecommendation)[keyof typeof RiskRecommendation] | (string & {});
|
|
130
|
+
/** Agent risk tier. Unknown future values are preserved as plain strings. */
|
|
131
|
+
declare const RiskTier: {
|
|
132
|
+
readonly LOW: "low";
|
|
133
|
+
readonly STANDARD: "standard";
|
|
134
|
+
readonly ELEVATED: "elevated";
|
|
135
|
+
readonly CRITICAL: "critical";
|
|
136
|
+
};
|
|
137
|
+
type RiskTier = (typeof RiskTier)[keyof typeof RiskTier] | (string & {});
|
|
138
|
+
/** Vault secret type. Unknown future values are preserved as plain strings. */
|
|
139
|
+
declare const SecretType: {
|
|
140
|
+
readonly API_KEY: "api_key";
|
|
141
|
+
readonly OAUTH_TOKEN: "oauth_token";
|
|
142
|
+
readonly DATABASE: "database";
|
|
143
|
+
readonly CERTIFICATE: "certificate";
|
|
144
|
+
readonly CLOUD: "cloud";
|
|
145
|
+
readonly SSH_KEY: "ssh_key";
|
|
146
|
+
readonly GENERIC: "generic";
|
|
147
|
+
};
|
|
148
|
+
type SecretType = (typeof SecretType)[keyof typeof SecretType] | (string & {});
|
|
149
|
+
/** Outcome of a simulation run. Unknown future values are preserved as plain strings. */
|
|
150
|
+
declare const SimulationStatus: {
|
|
151
|
+
readonly PASSED: "passed";
|
|
152
|
+
readonly FAILED: "failed";
|
|
153
|
+
readonly ERROR: "error";
|
|
154
|
+
};
|
|
155
|
+
type SimulationStatus = (typeof SimulationStatus)[keyof typeof SimulationStatus] | (string & {});
|
|
156
|
+
/** OpenTelemetry span kind. Unknown future values are preserved as plain strings. */
|
|
157
|
+
declare const SpanKind: {
|
|
158
|
+
readonly SERVER: "server";
|
|
159
|
+
readonly CLIENT: "client";
|
|
160
|
+
readonly INTERNAL: "internal";
|
|
161
|
+
readonly PRODUCER: "producer";
|
|
162
|
+
readonly CONSUMER: "consumer";
|
|
163
|
+
};
|
|
164
|
+
type SpanKind = (typeof SpanKind)[keyof typeof SpanKind] | (string & {});
|
|
165
|
+
/** Span status. Unknown future values are preserved as plain strings. */
|
|
166
|
+
declare const SpanStatus: {
|
|
167
|
+
readonly UNSET: "unset";
|
|
168
|
+
readonly OK: "ok";
|
|
169
|
+
readonly ERROR: "error";
|
|
170
|
+
};
|
|
171
|
+
type SpanStatus = (typeof SpanStatus)[keyof typeof SpanStatus] | (string & {});
|
|
172
|
+
/** Credential metadata of an agent (never the secret). */
|
|
173
|
+
interface AgentCredential {
|
|
174
|
+
id: string;
|
|
175
|
+
type: string;
|
|
176
|
+
name?: string;
|
|
177
|
+
status?: string;
|
|
178
|
+
scopes?: Array<string>;
|
|
179
|
+
expiresAt?: string | null;
|
|
180
|
+
graceUntil?: string | null;
|
|
181
|
+
lastUsedAt?: string | null;
|
|
182
|
+
createdAt?: string;
|
|
183
|
+
revokedAt?: string | null;
|
|
184
|
+
principalType?: string;
|
|
185
|
+
principalId?: string;
|
|
186
|
+
publicJwk?: Record<string, unknown> | null;
|
|
187
|
+
rotatedFrom?: string | null;
|
|
188
|
+
revokedReason?: string | null;
|
|
189
|
+
createdBy?: string | null;
|
|
190
|
+
}
|
|
191
|
+
/** An agent identity (GET /v1/agents, GET /v1/agents/{id}). */
|
|
192
|
+
interface Agent {
|
|
193
|
+
id: string;
|
|
194
|
+
name: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
status: AgentStatus;
|
|
197
|
+
statusReason?: string | null;
|
|
198
|
+
projectId?: string;
|
|
199
|
+
environmentId?: string;
|
|
200
|
+
applicationId?: string | null;
|
|
201
|
+
ownerUserId?: string | null;
|
|
202
|
+
ownerTeamId?: string | null;
|
|
203
|
+
ownerEmail?: string | null;
|
|
204
|
+
framework?: string | null;
|
|
205
|
+
model?: string | null;
|
|
206
|
+
riskTier?: string;
|
|
207
|
+
tags?: Array<string>;
|
|
208
|
+
metadata?: Record<string, unknown>;
|
|
209
|
+
createdAt?: string;
|
|
210
|
+
updatedAt?: string;
|
|
211
|
+
lastSeenAt?: string | null;
|
|
212
|
+
credentials?: Array<AgentCredential>;
|
|
213
|
+
}
|
|
214
|
+
/** Response of GET /v1/agents/{id}/credentials. */
|
|
215
|
+
interface AgentCredentialList {
|
|
216
|
+
data: Array<AgentCredential>;
|
|
217
|
+
}
|
|
218
|
+
/** Response of GET /v1/agents. */
|
|
219
|
+
interface AgentPage {
|
|
220
|
+
data: Array<Agent>;
|
|
221
|
+
nextCursor?: string | null;
|
|
222
|
+
}
|
|
223
|
+
/** */
|
|
224
|
+
interface SpanEvent {
|
|
225
|
+
name: string;
|
|
226
|
+
time: string;
|
|
227
|
+
/** Default: {}. */
|
|
228
|
+
attributes?: Record<string, unknown>;
|
|
229
|
+
}
|
|
230
|
+
/** */
|
|
231
|
+
interface AgentSpan {
|
|
232
|
+
traceId: string;
|
|
233
|
+
spanId: string;
|
|
234
|
+
parentSpanId?: string | null;
|
|
235
|
+
name: string;
|
|
236
|
+
/** Default: "internal". */
|
|
237
|
+
kind?: SpanKind;
|
|
238
|
+
startTime: string;
|
|
239
|
+
durationMs: number;
|
|
240
|
+
/** Default: "unset". */
|
|
241
|
+
status?: SpanStatus;
|
|
242
|
+
statusMessage?: string | null;
|
|
243
|
+
/** Default: {}. */
|
|
244
|
+
attributes?: Record<string, unknown>;
|
|
245
|
+
/** Default: []. */
|
|
246
|
+
events?: Array<SpanEvent>;
|
|
247
|
+
}
|
|
248
|
+
/** Input to POST /v1/agents/{id}/status. (api: POST /v1/agents/{id}/status) */
|
|
249
|
+
interface AgentStatusRequest {
|
|
250
|
+
status: AgentStatus;
|
|
251
|
+
reason?: string;
|
|
252
|
+
}
|
|
253
|
+
/** A security alert (GET /v1/alerts, GET/PATCH /v1/alerts/{id}). */
|
|
254
|
+
interface Alert {
|
|
255
|
+
id: string;
|
|
256
|
+
projectId?: string | null;
|
|
257
|
+
environmentId?: string | null;
|
|
258
|
+
kind: string;
|
|
259
|
+
severity: RiskLevel;
|
|
260
|
+
score?: number;
|
|
261
|
+
title?: string;
|
|
262
|
+
summary?: string;
|
|
263
|
+
principalType?: string | null;
|
|
264
|
+
principalId?: string | null;
|
|
265
|
+
status: AlertStatus;
|
|
266
|
+
assigneeId?: string | null;
|
|
267
|
+
dedupeKey?: string;
|
|
268
|
+
occurrences?: number;
|
|
269
|
+
evidence?: Array<unknown>;
|
|
270
|
+
response?: Record<string, unknown>;
|
|
271
|
+
resolution?: string | null;
|
|
272
|
+
firstSeenAt?: string;
|
|
273
|
+
lastSeenAt?: string;
|
|
274
|
+
acknowledgedAt?: string | null;
|
|
275
|
+
resolvedAt?: string | null;
|
|
276
|
+
createdAt?: string;
|
|
277
|
+
updatedAt?: string;
|
|
278
|
+
notes?: Array<unknown>;
|
|
279
|
+
investigation?: Record<string, unknown>;
|
|
280
|
+
}
|
|
281
|
+
/** Response of GET /v1/alerts. */
|
|
282
|
+
interface AlertPage {
|
|
283
|
+
data: Array<Alert>;
|
|
284
|
+
nextCursor?: string | null;
|
|
285
|
+
}
|
|
286
|
+
/** An approval request. GET {gateway}/v1/approvals/{id} returns the agent-facing subset; the control-plane API returns the full record. */
|
|
287
|
+
interface Approval {
|
|
288
|
+
id: string;
|
|
289
|
+
status: ApprovalStatus;
|
|
290
|
+
action?: string;
|
|
291
|
+
resource?: string;
|
|
292
|
+
summary?: string;
|
|
293
|
+
reason?: string;
|
|
294
|
+
snapshotHash?: string;
|
|
295
|
+
agentId?: string | null;
|
|
296
|
+
projectId?: string;
|
|
297
|
+
environmentId?: string;
|
|
298
|
+
requesterType?: string;
|
|
299
|
+
requesterId?: string;
|
|
300
|
+
riskScore?: number | null;
|
|
301
|
+
riskLevel?: string | null;
|
|
302
|
+
expiresAt?: string;
|
|
303
|
+
resolvedAt?: string | null;
|
|
304
|
+
resolvedBy?: string | null;
|
|
305
|
+
resolutionComment?: string | null;
|
|
306
|
+
executionId?: string | null;
|
|
307
|
+
createdAt?: string;
|
|
308
|
+
signatureValid?: boolean;
|
|
309
|
+
steps?: Array<unknown>;
|
|
310
|
+
decisions?: Array<unknown>;
|
|
311
|
+
comments?: Array<unknown>;
|
|
312
|
+
history?: Array<unknown>;
|
|
313
|
+
canDecide?: boolean;
|
|
314
|
+
}
|
|
315
|
+
/** Response of POST /v1/approvals/{id}/decision. */
|
|
316
|
+
interface ApprovalDecisionResult {
|
|
317
|
+
approvalId: string;
|
|
318
|
+
status: ApprovalStatus;
|
|
319
|
+
stepIndex?: number;
|
|
320
|
+
}
|
|
321
|
+
/** Response of GET /v1/approvals. */
|
|
322
|
+
interface ApprovalPage {
|
|
323
|
+
data: Array<Approval>;
|
|
324
|
+
nextCursor?: string | null;
|
|
325
|
+
}
|
|
326
|
+
/** Approval request associated with a decision. */
|
|
327
|
+
interface ApprovalRef {
|
|
328
|
+
id: string;
|
|
329
|
+
status: ApprovalStatus;
|
|
330
|
+
expiresAt: string;
|
|
331
|
+
snapshotHash: string;
|
|
332
|
+
url: string;
|
|
333
|
+
created: boolean;
|
|
334
|
+
}
|
|
335
|
+
/** An approval requirement contributed by a policy or risk threshold. */
|
|
336
|
+
interface ApprovalRequirement {
|
|
337
|
+
policyId: string;
|
|
338
|
+
policyName: string;
|
|
339
|
+
approvers?: Array<unknown>;
|
|
340
|
+
min?: number;
|
|
341
|
+
mode?: string;
|
|
342
|
+
expiresMs?: number | null;
|
|
343
|
+
}
|
|
344
|
+
/** A broken link in the audit hash chain. */
|
|
345
|
+
interface AuditChainError {
|
|
346
|
+
seq: number;
|
|
347
|
+
id?: string;
|
|
348
|
+
problem?: string;
|
|
349
|
+
}
|
|
350
|
+
/** One tamper-evident audit record. */
|
|
351
|
+
interface AuditEvent {
|
|
352
|
+
id: string;
|
|
353
|
+
seq: number;
|
|
354
|
+
occurredAt?: string;
|
|
355
|
+
category?: string;
|
|
356
|
+
action?: string;
|
|
357
|
+
outcome?: string;
|
|
358
|
+
actorType?: string;
|
|
359
|
+
actorId?: string | null;
|
|
360
|
+
onBehalfOf?: string | null;
|
|
361
|
+
agentId?: string | null;
|
|
362
|
+
sessionId?: string | null;
|
|
363
|
+
projectId?: string | null;
|
|
364
|
+
environmentId?: string | null;
|
|
365
|
+
resourceType?: string | null;
|
|
366
|
+
resourceId?: string | null;
|
|
367
|
+
decision?: string | null;
|
|
368
|
+
policyIds?: Array<string>;
|
|
369
|
+
riskScore?: number | null;
|
|
370
|
+
approvalId?: string | null;
|
|
371
|
+
executionId?: string | null;
|
|
372
|
+
argsHash?: string | null;
|
|
373
|
+
requestId?: string | null;
|
|
374
|
+
traceId?: string | null;
|
|
375
|
+
ip?: string | null;
|
|
376
|
+
userAgent?: string | null;
|
|
377
|
+
details?: Record<string, unknown>;
|
|
378
|
+
prevHash?: string;
|
|
379
|
+
hash?: string;
|
|
380
|
+
}
|
|
381
|
+
/** Query parameters for GET /v1/audit/export. (api: GET /v1/audit/export) */
|
|
382
|
+
interface AuditExportParams {
|
|
383
|
+
from?: string;
|
|
384
|
+
to?: string;
|
|
385
|
+
category?: string;
|
|
386
|
+
action?: string;
|
|
387
|
+
outcome?: string;
|
|
388
|
+
actorId?: string;
|
|
389
|
+
agentId?: string;
|
|
390
|
+
resourceType?: string;
|
|
391
|
+
resourceId?: string;
|
|
392
|
+
projectId?: string;
|
|
393
|
+
environmentId?: string;
|
|
394
|
+
decision?: string;
|
|
395
|
+
traceId?: string;
|
|
396
|
+
approvalId?: string;
|
|
397
|
+
executionId?: string;
|
|
398
|
+
minRisk?: number;
|
|
399
|
+
q?: string;
|
|
400
|
+
afterSeq?: number;
|
|
401
|
+
/** Default: 100. */
|
|
402
|
+
limit?: number;
|
|
403
|
+
cursor?: string;
|
|
404
|
+
/** Default: "ndjson". */
|
|
405
|
+
format?: string;
|
|
406
|
+
}
|
|
407
|
+
/** Response of GET /v1/audit/events. */
|
|
408
|
+
interface AuditPage {
|
|
409
|
+
data: Array<AuditEvent>;
|
|
410
|
+
nextCursor?: string | null;
|
|
411
|
+
}
|
|
412
|
+
/** Query parameters for GET /v1/audit/events (afterSeq = tail: records after that sequence number, oldest first). (api: GET /v1/audit/events) */
|
|
413
|
+
interface AuditSearchParams {
|
|
414
|
+
from?: string;
|
|
415
|
+
to?: string;
|
|
416
|
+
category?: string;
|
|
417
|
+
action?: string;
|
|
418
|
+
outcome?: string;
|
|
419
|
+
actorId?: string;
|
|
420
|
+
agentId?: string;
|
|
421
|
+
resourceType?: string;
|
|
422
|
+
resourceId?: string;
|
|
423
|
+
projectId?: string;
|
|
424
|
+
environmentId?: string;
|
|
425
|
+
decision?: string;
|
|
426
|
+
traceId?: string;
|
|
427
|
+
approvalId?: string;
|
|
428
|
+
executionId?: string;
|
|
429
|
+
minRisk?: number;
|
|
430
|
+
q?: string;
|
|
431
|
+
afterSeq?: number;
|
|
432
|
+
/** Default: 100. */
|
|
433
|
+
limit?: number;
|
|
434
|
+
cursor?: string;
|
|
435
|
+
}
|
|
436
|
+
/** Response of POST /v1/audit/verify. */
|
|
437
|
+
interface AuditVerification {
|
|
438
|
+
valid: boolean;
|
|
439
|
+
checked: number;
|
|
440
|
+
firstSeq?: number | null;
|
|
441
|
+
lastSeq?: number | null;
|
|
442
|
+
headMatches?: boolean;
|
|
443
|
+
errors?: Array<AuditChainError>;
|
|
444
|
+
}
|
|
445
|
+
/** A user account. */
|
|
446
|
+
interface AuthUser {
|
|
447
|
+
id: string;
|
|
448
|
+
email?: string;
|
|
449
|
+
name?: string;
|
|
450
|
+
createdAt?: string;
|
|
451
|
+
}
|
|
452
|
+
/** Error for one entry of a batch authorization. */
|
|
453
|
+
interface BatchError {
|
|
454
|
+
code: string;
|
|
455
|
+
message: string;
|
|
456
|
+
}
|
|
457
|
+
/** Environment the request was evaluated in. */
|
|
458
|
+
interface EnvironmentRef {
|
|
459
|
+
id: string;
|
|
460
|
+
slug: string;
|
|
461
|
+
tier: string;
|
|
462
|
+
}
|
|
463
|
+
/** One policy considered during evaluation. */
|
|
464
|
+
interface TraceEntry {
|
|
465
|
+
policyId: string;
|
|
466
|
+
versionId?: string | null;
|
|
467
|
+
name: string;
|
|
468
|
+
effect: string;
|
|
469
|
+
source?: string;
|
|
470
|
+
scope?: unknown;
|
|
471
|
+
outcome: string;
|
|
472
|
+
detail?: string;
|
|
473
|
+
}
|
|
474
|
+
/** Why the decision was made. */
|
|
475
|
+
interface Explanation {
|
|
476
|
+
trace: Array<TraceEntry>;
|
|
477
|
+
approvals: Array<ApprovalRequirement>;
|
|
478
|
+
grantingPolicyId?: string | null;
|
|
479
|
+
candidates: number;
|
|
480
|
+
policyDecision: Decision;
|
|
481
|
+
}
|
|
482
|
+
/** A rate/amount limit of the granting policy and its current usage. */
|
|
483
|
+
interface LimitState {
|
|
484
|
+
policyId: string;
|
|
485
|
+
key: string;
|
|
486
|
+
measure: string;
|
|
487
|
+
amount: number;
|
|
488
|
+
max: number;
|
|
489
|
+
windowMs: number;
|
|
490
|
+
subject?: string;
|
|
491
|
+
used: number;
|
|
492
|
+
remaining: number;
|
|
493
|
+
}
|
|
494
|
+
/** The principal the decision applies to. */
|
|
495
|
+
interface PrincipalRef {
|
|
496
|
+
type: string;
|
|
497
|
+
id: string;
|
|
498
|
+
}
|
|
499
|
+
/** One explainable contribution to a risk score. */
|
|
500
|
+
interface RiskSignal {
|
|
501
|
+
category: string;
|
|
502
|
+
code: string;
|
|
503
|
+
points: number;
|
|
504
|
+
reason: string;
|
|
505
|
+
}
|
|
506
|
+
/** Risk thresholds in effect. */
|
|
507
|
+
interface RiskThresholds {
|
|
508
|
+
approvalAbove: number;
|
|
509
|
+
denyAbove: number;
|
|
510
|
+
}
|
|
511
|
+
/** Risk assessment attached to a decision. */
|
|
512
|
+
interface Risk {
|
|
513
|
+
score: number;
|
|
514
|
+
level: RiskLevel;
|
|
515
|
+
recommendation: RiskRecommendation;
|
|
516
|
+
signals: Array<RiskSignal>;
|
|
517
|
+
thresholds: RiskThresholds;
|
|
518
|
+
}
|
|
519
|
+
/** One entry of POST /v1/authorize/batch: either a decision (all AuthorizeResult fields) or an error. */
|
|
520
|
+
interface AuthorizeBatchEntry {
|
|
521
|
+
decision?: Decision;
|
|
522
|
+
decisionId?: string;
|
|
523
|
+
reason?: string;
|
|
524
|
+
risk?: Risk;
|
|
525
|
+
approval?: ApprovalRef | null;
|
|
526
|
+
explanation?: Explanation;
|
|
527
|
+
limits?: Array<LimitState>;
|
|
528
|
+
snapshotHash?: string;
|
|
529
|
+
environment?: EnvironmentRef;
|
|
530
|
+
principal?: PrincipalRef;
|
|
531
|
+
dryRun?: boolean;
|
|
532
|
+
evaluatedAt?: string;
|
|
533
|
+
durationMs?: number;
|
|
534
|
+
error?: BatchError;
|
|
535
|
+
}
|
|
536
|
+
/** */
|
|
537
|
+
interface OnBehalfOf {
|
|
538
|
+
agentId: string;
|
|
539
|
+
}
|
|
540
|
+
/** Input to POST /v1/authorize. (gateway: POST /v1/authorize) */
|
|
541
|
+
interface AuthorizeRequest {
|
|
542
|
+
action: string;
|
|
543
|
+
resource: string;
|
|
544
|
+
/** Default: {}. */
|
|
545
|
+
resourceAttributes?: Record<string, unknown>;
|
|
546
|
+
/** Default: {}. */
|
|
547
|
+
context?: Record<string, unknown>;
|
|
548
|
+
environmentId?: string;
|
|
549
|
+
onBehalfOf?: OnBehalfOf;
|
|
550
|
+
approvalId?: string;
|
|
551
|
+
/** Default: false. */
|
|
552
|
+
dryRun?: boolean;
|
|
553
|
+
execution?: Record<string, unknown> | null;
|
|
554
|
+
}
|
|
555
|
+
/** Input to POST /v1/authorize/batch (1-100 requests). (gateway: POST /v1/authorize/batch) */
|
|
556
|
+
interface AuthorizeBatchRequest {
|
|
557
|
+
requests: Array<AuthorizeRequest>;
|
|
558
|
+
}
|
|
559
|
+
/** Response of POST /v1/authorize/batch (results are in request order). */
|
|
560
|
+
interface AuthorizeBatchResult {
|
|
561
|
+
results: Array<AuthorizeBatchEntry>;
|
|
562
|
+
}
|
|
563
|
+
/** Response of POST /v1/authorize. */
|
|
564
|
+
interface AuthorizeResult {
|
|
565
|
+
decision: Decision;
|
|
566
|
+
decisionId: string;
|
|
567
|
+
reason: string;
|
|
568
|
+
risk: Risk;
|
|
569
|
+
approval?: ApprovalRef | null;
|
|
570
|
+
explanation?: Explanation;
|
|
571
|
+
limits?: Array<LimitState>;
|
|
572
|
+
snapshotHash?: string;
|
|
573
|
+
environment?: EnvironmentRef;
|
|
574
|
+
principal?: PrincipalRef;
|
|
575
|
+
dryRun?: boolean;
|
|
576
|
+
evaluatedAt?: string;
|
|
577
|
+
durationMs?: number;
|
|
578
|
+
}
|
|
579
|
+
/** Response of POST /v1/executions/{id}/cancel. */
|
|
580
|
+
interface CancelExecutionResult {
|
|
581
|
+
executionId: string;
|
|
582
|
+
status: ExecutionStatus;
|
|
583
|
+
}
|
|
584
|
+
/** Input to POST /v1/connections/{id}/oauth/client-credentials. (api: POST /v1/connections/{id}/oauth/client-credentials) */
|
|
585
|
+
interface ClientCredentialsInstallRequest {
|
|
586
|
+
clientId: string;
|
|
587
|
+
clientSecret: string;
|
|
588
|
+
scopes?: Array<string>;
|
|
589
|
+
}
|
|
590
|
+
/** An action a connector exposes. */
|
|
591
|
+
interface ConnectorAction {
|
|
592
|
+
name: string;
|
|
593
|
+
action: string;
|
|
594
|
+
title?: string;
|
|
595
|
+
description?: string;
|
|
596
|
+
risk?: unknown;
|
|
597
|
+
idempotent?: boolean;
|
|
598
|
+
input?: Record<string, unknown>;
|
|
599
|
+
output?: Record<string, unknown> | null;
|
|
600
|
+
}
|
|
601
|
+
/** A connector in the catalog (GET /v1/connectors, GET /v1/connectors/{key}). */
|
|
602
|
+
interface Connector {
|
|
603
|
+
key: string;
|
|
604
|
+
name: string;
|
|
605
|
+
version?: string;
|
|
606
|
+
description?: string;
|
|
607
|
+
category?: string;
|
|
608
|
+
homepage?: string | null;
|
|
609
|
+
baseUrl?: string | null;
|
|
610
|
+
allowedHosts?: Array<string>;
|
|
611
|
+
publicHosts?: Array<string>;
|
|
612
|
+
auth?: Array<unknown>;
|
|
613
|
+
config?: Record<string, unknown>;
|
|
614
|
+
resources?: unknown;
|
|
615
|
+
securityTemplate?: unknown;
|
|
616
|
+
actions?: Array<ConnectorAction>;
|
|
617
|
+
}
|
|
618
|
+
/** A connector installed into a project (signing secrets are never returned, except signingSecret once on create). */
|
|
619
|
+
interface Connection {
|
|
620
|
+
id: string;
|
|
621
|
+
projectId?: string;
|
|
622
|
+
environmentId?: string | null;
|
|
623
|
+
connectorKey?: string;
|
|
624
|
+
connectorVersion?: string;
|
|
625
|
+
name: string;
|
|
626
|
+
description?: string;
|
|
627
|
+
authType?: string;
|
|
628
|
+
secretId?: string | null;
|
|
629
|
+
config?: Record<string, unknown>;
|
|
630
|
+
allowedHosts?: Array<string>;
|
|
631
|
+
signRequests?: boolean;
|
|
632
|
+
timeoutMs?: number;
|
|
633
|
+
maxRetries?: number;
|
|
634
|
+
status?: string;
|
|
635
|
+
health?: Record<string, unknown>;
|
|
636
|
+
lastHealthAt?: string | null;
|
|
637
|
+
createdBy?: string | null;
|
|
638
|
+
createdAt?: string;
|
|
639
|
+
updatedAt?: string;
|
|
640
|
+
connector?: Connector | null;
|
|
641
|
+
effectiveAllowedHosts?: Array<string>;
|
|
642
|
+
securityTemplate?: unknown;
|
|
643
|
+
/** Request-signing secret, returned once on create when signRequests=true. */
|
|
644
|
+
signingSecret?: string;
|
|
645
|
+
}
|
|
646
|
+
/** */
|
|
647
|
+
interface ConnectionCredential {
|
|
648
|
+
type: string;
|
|
649
|
+
value: Record<string, unknown>;
|
|
650
|
+
/** Default: {}. */
|
|
651
|
+
metadata?: Record<string, unknown>;
|
|
652
|
+
}
|
|
653
|
+
/** Response of POST /v1/connections/{id}/health. */
|
|
654
|
+
interface ConnectionHealth {
|
|
655
|
+
ok: boolean;
|
|
656
|
+
detail?: string;
|
|
657
|
+
latencyMs?: number;
|
|
658
|
+
}
|
|
659
|
+
/** Response of GET /v1/connections. */
|
|
660
|
+
interface ConnectionList {
|
|
661
|
+
data: Array<Connection>;
|
|
662
|
+
}
|
|
663
|
+
/** Response of GET /v1/connectors. */
|
|
664
|
+
interface ConnectorList {
|
|
665
|
+
data: Array<Connector>;
|
|
666
|
+
}
|
|
667
|
+
/** Provenance of inspected content. */
|
|
668
|
+
interface ContentProvenance {
|
|
669
|
+
source: string;
|
|
670
|
+
origin?: string | null;
|
|
671
|
+
trust: string;
|
|
672
|
+
contentHash?: string;
|
|
673
|
+
retrievedAt?: string;
|
|
674
|
+
}
|
|
675
|
+
/** Input to POST /v1/connections (install a connector into a project). (api: POST /v1/connections) */
|
|
676
|
+
interface CreateConnectionRequest {
|
|
677
|
+
projectId: string;
|
|
678
|
+
environmentId?: string;
|
|
679
|
+
connector: string;
|
|
680
|
+
name: string;
|
|
681
|
+
/** Default: "". */
|
|
682
|
+
description?: string;
|
|
683
|
+
/** Default: "none". */
|
|
684
|
+
authType?: string;
|
|
685
|
+
secretId?: string;
|
|
686
|
+
credential?: ConnectionCredential;
|
|
687
|
+
/** Default: {}. */
|
|
688
|
+
config?: Record<string, unknown>;
|
|
689
|
+
/** Default: []. */
|
|
690
|
+
allowedHosts?: Array<string>;
|
|
691
|
+
/** Default: false. */
|
|
692
|
+
signRequests?: boolean;
|
|
693
|
+
/** Default: 15000. */
|
|
694
|
+
timeoutMs?: number;
|
|
695
|
+
/** Default: 2. */
|
|
696
|
+
maxRetries?: number;
|
|
697
|
+
}
|
|
698
|
+
/** Input to POST /v1/agents/{id}/credentials. (api: POST /v1/agents/{id}/credentials) */
|
|
699
|
+
interface CreateCredentialRequest {
|
|
700
|
+
/** Default: "client_secret". */
|
|
701
|
+
type?: string;
|
|
702
|
+
/** Default: "default". */
|
|
703
|
+
name?: string;
|
|
704
|
+
publicJwk?: Record<string, unknown>;
|
|
705
|
+
/** Default: []. */
|
|
706
|
+
scopes?: Array<string>;
|
|
707
|
+
expiresInDays?: number;
|
|
708
|
+
}
|
|
709
|
+
/** */
|
|
710
|
+
interface DelegationConstraints {
|
|
711
|
+
maxAmount?: number;
|
|
712
|
+
environments?: Array<string>;
|
|
713
|
+
}
|
|
714
|
+
/** Input to POST /v1/delegations (control plane). (api: POST /v1/delegations) */
|
|
715
|
+
interface CreateDelegationRequest {
|
|
716
|
+
delegateAgentId: string;
|
|
717
|
+
scopes: Array<DelegationScope>;
|
|
718
|
+
/** Default: []. */
|
|
719
|
+
actions?: Array<string>;
|
|
720
|
+
/** Default: []. */
|
|
721
|
+
resources?: Array<string>;
|
|
722
|
+
/** Default: {}. */
|
|
723
|
+
constraints?: DelegationConstraints;
|
|
724
|
+
/** Default: "". */
|
|
725
|
+
purpose?: string;
|
|
726
|
+
/** Default: 3600. */
|
|
727
|
+
expiresInSeconds?: number;
|
|
728
|
+
/** Default: 3. */
|
|
729
|
+
maxDepth?: number;
|
|
730
|
+
}
|
|
731
|
+
/** Policy scope: {type: org} | {type: project, projectId} | {type: environment, environmentId}. */
|
|
732
|
+
interface PolicyScope {
|
|
733
|
+
/** org, project or environment. */
|
|
734
|
+
type: string;
|
|
735
|
+
projectId?: string;
|
|
736
|
+
environmentId?: string;
|
|
737
|
+
}
|
|
738
|
+
/** Input to POST /v1/policies (exactly one of source or templateId). (api: POST /v1/policies) */
|
|
739
|
+
interface CreatePolicyRequest {
|
|
740
|
+
name: string;
|
|
741
|
+
/** Default: "". */
|
|
742
|
+
description?: string;
|
|
743
|
+
/** Default: {"type":"org"}. */
|
|
744
|
+
scope?: PolicyScope;
|
|
745
|
+
source?: string;
|
|
746
|
+
templateId?: string;
|
|
747
|
+
templateParams?: Record<string, unknown>;
|
|
748
|
+
/** Default: "Initial version". */
|
|
749
|
+
message?: string;
|
|
750
|
+
/** Default: []. */
|
|
751
|
+
tags?: Array<string>;
|
|
752
|
+
}
|
|
753
|
+
/** */
|
|
754
|
+
interface SecretAccessPolicy {
|
|
755
|
+
agents?: Array<string>;
|
|
756
|
+
agentTags?: Array<string>;
|
|
757
|
+
connectors?: Array<string>;
|
|
758
|
+
actions?: Array<string>;
|
|
759
|
+
environments?: Array<string>;
|
|
760
|
+
}
|
|
761
|
+
/** */
|
|
762
|
+
interface SecretRotationPolicy {
|
|
763
|
+
intervalDays?: number;
|
|
764
|
+
/** Default: "manual". */
|
|
765
|
+
strategy?: string;
|
|
766
|
+
}
|
|
767
|
+
/** Input to POST /v1/secrets. `value` is write-only: it is never returned and SDKs never log it. (api: POST /v1/secrets) */
|
|
768
|
+
interface CreateSecretRequest {
|
|
769
|
+
name: string;
|
|
770
|
+
type: SecretType;
|
|
771
|
+
value: Record<string, unknown>;
|
|
772
|
+
/** Default: "". */
|
|
773
|
+
description?: string;
|
|
774
|
+
/** Default: {}. */
|
|
775
|
+
metadata?: Record<string, unknown>;
|
|
776
|
+
projectId?: string;
|
|
777
|
+
environmentId?: string;
|
|
778
|
+
/** Default: {}. */
|
|
779
|
+
accessPolicy?: SecretAccessPolicy;
|
|
780
|
+
expiresAt?: string;
|
|
781
|
+
/** Default: {"strategy":"manual"}. */
|
|
782
|
+
rotationPolicy?: SecretRotationPolicy;
|
|
783
|
+
}
|
|
784
|
+
/** Response of POST /v1/secrets (metadata only; the value is never echoed). */
|
|
785
|
+
interface CreatedSecret {
|
|
786
|
+
id: string;
|
|
787
|
+
name: string;
|
|
788
|
+
type: SecretType;
|
|
789
|
+
mask?: string;
|
|
790
|
+
version?: number;
|
|
791
|
+
}
|
|
792
|
+
/** Input to POST /v1/approvals/{id}/decision. snapshotHash must be the hash the approver reviewed. (api: POST /v1/approvals/{id}/decision) */
|
|
793
|
+
interface DecideApprovalRequest {
|
|
794
|
+
decision: ApprovalVerdict;
|
|
795
|
+
/** Default: "". */
|
|
796
|
+
comment?: string;
|
|
797
|
+
snapshotHash: string;
|
|
798
|
+
/** Default: "console". */
|
|
799
|
+
channel?: string;
|
|
800
|
+
}
|
|
801
|
+
/** Response of POST /v1/delegations. `token` (gsd_...) is shown once; hand it to the delegate agent. */
|
|
802
|
+
interface Delegation {
|
|
803
|
+
id: string;
|
|
804
|
+
token: string;
|
|
805
|
+
chain?: Array<unknown>;
|
|
806
|
+
depth?: number;
|
|
807
|
+
maxDepth?: number;
|
|
808
|
+
scopes?: Array<string>;
|
|
809
|
+
actions?: Array<string>;
|
|
810
|
+
resources?: Array<string>;
|
|
811
|
+
expiresAt?: string;
|
|
812
|
+
originatingUserId?: string | null;
|
|
813
|
+
}
|
|
814
|
+
/** Input to POST /v1/policies/{id}/deploy (default: latest version). (api: POST /v1/policies/{id}/deploy) */
|
|
815
|
+
interface DeployPolicyRequest {
|
|
816
|
+
versionId?: string;
|
|
817
|
+
/** Default: "". */
|
|
818
|
+
comment?: string;
|
|
819
|
+
}
|
|
820
|
+
/** One sensitive-data finding (masked, never the raw value). */
|
|
821
|
+
interface DlpFinding {
|
|
822
|
+
detector: string;
|
|
823
|
+
category: string;
|
|
824
|
+
label?: string;
|
|
825
|
+
confidence?: number;
|
|
826
|
+
path?: string;
|
|
827
|
+
masked?: string;
|
|
828
|
+
enforcement?: DlpAction;
|
|
829
|
+
}
|
|
830
|
+
/** A DLP rule that matched. */
|
|
831
|
+
interface DlpMatchedRule {
|
|
832
|
+
ruleId: string;
|
|
833
|
+
name: string;
|
|
834
|
+
action: DlpAction;
|
|
835
|
+
findings?: number;
|
|
836
|
+
}
|
|
837
|
+
/** Input to POST /v1/dlp/scan. (gateway: POST /v1/dlp/scan) */
|
|
838
|
+
interface DlpScanRequest {
|
|
839
|
+
content: unknown;
|
|
840
|
+
direction: DlpDirection;
|
|
841
|
+
action?: string;
|
|
842
|
+
connector?: string;
|
|
843
|
+
environmentId?: string;
|
|
844
|
+
dryRun?: boolean;
|
|
845
|
+
}
|
|
846
|
+
/** Response of POST /v1/dlp/scan. */
|
|
847
|
+
interface DlpScanResult {
|
|
848
|
+
action: DlpAction;
|
|
849
|
+
/** Transformed payload; null when blocked. */
|
|
850
|
+
content?: unknown;
|
|
851
|
+
findings: Array<DlpFinding>;
|
|
852
|
+
rules?: Array<DlpMatchedRule>;
|
|
853
|
+
eventId?: string | null;
|
|
854
|
+
dryRun?: boolean;
|
|
855
|
+
}
|
|
856
|
+
/** Input to POST /v1/execute. (gateway: POST /v1/execute) */
|
|
857
|
+
interface ExecuteRequest {
|
|
858
|
+
connection: string;
|
|
859
|
+
action: string;
|
|
860
|
+
/** Default: {}. */
|
|
861
|
+
input?: Record<string, unknown>;
|
|
862
|
+
idempotencyKey?: string;
|
|
863
|
+
approvalId?: string;
|
|
864
|
+
/** Default: "sync". */
|
|
865
|
+
mode?: ExecuteMode;
|
|
866
|
+
timeoutMs?: number;
|
|
867
|
+
/** Default: false. */
|
|
868
|
+
dryRun?: boolean;
|
|
869
|
+
environmentId?: string;
|
|
870
|
+
onBehalfOf?: OnBehalfOf;
|
|
871
|
+
}
|
|
872
|
+
/** Error of a failed/denied execution. */
|
|
873
|
+
interface ExecutionError {
|
|
874
|
+
code: string;
|
|
875
|
+
message: string;
|
|
876
|
+
upstreamStatus?: number;
|
|
877
|
+
}
|
|
878
|
+
/** Response of POST /v1/execute (HTTP 200 succeeded/simulated, 202 awaiting_approval/running, 403 denied, 502/504 failed). */
|
|
879
|
+
interface ExecuteResult {
|
|
880
|
+
executionId?: string | null;
|
|
881
|
+
status: ExecutionStatus;
|
|
882
|
+
decision?: Decision;
|
|
883
|
+
reason?: string;
|
|
884
|
+
output?: unknown;
|
|
885
|
+
outputTruncated?: boolean;
|
|
886
|
+
error?: ExecutionError | null;
|
|
887
|
+
approval?: ApprovalRef | null;
|
|
888
|
+
risk?: Risk;
|
|
889
|
+
durationMs?: number;
|
|
890
|
+
replayed?: boolean;
|
|
891
|
+
}
|
|
892
|
+
/** One step log line of an execution. */
|
|
893
|
+
interface ExecutionLog {
|
|
894
|
+
step: string;
|
|
895
|
+
level?: string;
|
|
896
|
+
message?: string;
|
|
897
|
+
data?: Record<string, unknown>;
|
|
898
|
+
durationMs?: number | null;
|
|
899
|
+
createdAt?: string;
|
|
900
|
+
}
|
|
901
|
+
/** Response of GET /v1/executions/{id} (execution record with step logs). */
|
|
902
|
+
interface Execution {
|
|
903
|
+
id: string;
|
|
904
|
+
status: ExecutionStatus;
|
|
905
|
+
projectId?: string;
|
|
906
|
+
environmentId?: string;
|
|
907
|
+
principalType?: string;
|
|
908
|
+
principalId?: string;
|
|
909
|
+
connectionId?: string | null;
|
|
910
|
+
connectorKey?: string;
|
|
911
|
+
action?: string;
|
|
912
|
+
resource?: string;
|
|
913
|
+
mode?: ExecuteMode;
|
|
914
|
+
decision?: Decision | null;
|
|
915
|
+
decisionId?: string | null;
|
|
916
|
+
approvalId?: string | null;
|
|
917
|
+
riskScore?: number | null;
|
|
918
|
+
idempotencyKey?: string | null;
|
|
919
|
+
output?: unknown;
|
|
920
|
+
outputTruncated?: boolean;
|
|
921
|
+
error?: ExecutionError | null;
|
|
922
|
+
attempts?: number;
|
|
923
|
+
traceId?: string | null;
|
|
924
|
+
createdAt?: string;
|
|
925
|
+
startedAt?: string | null;
|
|
926
|
+
finishedAt?: string | null;
|
|
927
|
+
durationMs?: number | null;
|
|
928
|
+
logs?: Array<ExecutionLog>;
|
|
929
|
+
}
|
|
930
|
+
/** Response of GET /v1/executions. */
|
|
931
|
+
interface ExecutionPage {
|
|
932
|
+
data: Array<Execution>;
|
|
933
|
+
nextCursor?: string | null;
|
|
934
|
+
}
|
|
935
|
+
/** One prompt-injection rule match. */
|
|
936
|
+
interface InjectionFinding {
|
|
937
|
+
rule: string;
|
|
938
|
+
category: string;
|
|
939
|
+
excerpt?: string;
|
|
940
|
+
}
|
|
941
|
+
/** ML classifier contribution (when configured). */
|
|
942
|
+
interface InjectionModelResult {
|
|
943
|
+
used: boolean;
|
|
944
|
+
score?: number | null;
|
|
945
|
+
error?: string | null;
|
|
946
|
+
}
|
|
947
|
+
/** Prompt-injection analysis of inspected content. */
|
|
948
|
+
interface InjectionReport {
|
|
949
|
+
/** 0-100. */
|
|
950
|
+
score: number;
|
|
951
|
+
level: InjectionLevel;
|
|
952
|
+
/** ALLOW, FLAG, SANITIZE or BLOCK. */
|
|
953
|
+
action: string;
|
|
954
|
+
findings: Array<InjectionFinding>;
|
|
955
|
+
provenance?: ContentProvenance;
|
|
956
|
+
model?: InjectionModelResult;
|
|
957
|
+
detectionId?: string | null;
|
|
958
|
+
tainted?: boolean;
|
|
959
|
+
}
|
|
960
|
+
/** Inbound DLP outcome of an inspection. */
|
|
961
|
+
interface InspectDlpReport {
|
|
962
|
+
action: DlpAction;
|
|
963
|
+
/** Finding label -> count. */
|
|
964
|
+
summary?: Record<string, unknown>;
|
|
965
|
+
rules?: Array<DlpMatchedRule>;
|
|
966
|
+
eventId?: string | null;
|
|
967
|
+
}
|
|
968
|
+
/** Input to POST /v1/inspect: untrusted content an agent is about to read. (gateway: POST /v1/inspect) */
|
|
969
|
+
interface InspectRequest {
|
|
970
|
+
content: unknown;
|
|
971
|
+
source: ContentSource;
|
|
972
|
+
origin?: string;
|
|
973
|
+
/** Default: true. */
|
|
974
|
+
dlp?: boolean;
|
|
975
|
+
environmentId?: string;
|
|
976
|
+
}
|
|
977
|
+
/** Response of POST /v1/inspect. */
|
|
978
|
+
interface InspectResult {
|
|
979
|
+
/** Overall action: ALLOW, FLAG, SANITIZE, MASK, REDACT, REQUIRE_APPROVAL or BLOCK. */
|
|
980
|
+
action: string;
|
|
981
|
+
/** Content safe to hand to the model (sanitized/masked); null when blocked. */
|
|
982
|
+
content?: unknown;
|
|
983
|
+
injection: InjectionReport;
|
|
984
|
+
dlp?: InspectDlpReport | null;
|
|
985
|
+
}
|
|
986
|
+
/** A newly issued credential. clientSecret (gsa_...) is shown ONCE (null for public_key credentials); SDKs never log it. */
|
|
987
|
+
interface IssuedCredential {
|
|
988
|
+
credential: AgentCredential;
|
|
989
|
+
clientId: string;
|
|
990
|
+
clientSecret?: string | null;
|
|
991
|
+
}
|
|
992
|
+
/** Input to POST /v1/connections/{id}/oauth/jwt-bearer: either serviceAccountJson (Google) or issuer + privateKeyPem. */
|
|
993
|
+
interface JwtBearerInstallRequest {
|
|
994
|
+
serviceAccountJson?: string;
|
|
995
|
+
issuer?: string;
|
|
996
|
+
privateKeyPem?: string;
|
|
997
|
+
keyId?: string;
|
|
998
|
+
subject?: string;
|
|
999
|
+
audience?: string;
|
|
1000
|
+
scopes?: Array<string>;
|
|
1001
|
+
}
|
|
1002
|
+
/** Query parameters for GET /v1/agents. (api: GET /v1/agents) */
|
|
1003
|
+
interface ListAgentsParams {
|
|
1004
|
+
projectId?: string;
|
|
1005
|
+
environmentId?: string;
|
|
1006
|
+
status?: AgentStatus;
|
|
1007
|
+
ownerUserId?: string;
|
|
1008
|
+
tag?: string;
|
|
1009
|
+
q?: string;
|
|
1010
|
+
/** Default: 50. */
|
|
1011
|
+
limit?: number;
|
|
1012
|
+
cursor?: string;
|
|
1013
|
+
}
|
|
1014
|
+
/** Query parameters for GET /v1/alerts. (api: GET /v1/alerts) */
|
|
1015
|
+
interface ListAlertsParams {
|
|
1016
|
+
status?: AlertStatus;
|
|
1017
|
+
severity?: RiskLevel;
|
|
1018
|
+
kind?: string;
|
|
1019
|
+
principalId?: string;
|
|
1020
|
+
active?: string;
|
|
1021
|
+
/** Default: 50. */
|
|
1022
|
+
limit?: number;
|
|
1023
|
+
cursor?: string;
|
|
1024
|
+
}
|
|
1025
|
+
/** Query parameters for GET /v1/approvals. (api: GET /v1/approvals) */
|
|
1026
|
+
interface ListApprovalsParams {
|
|
1027
|
+
status?: ApprovalStatus;
|
|
1028
|
+
inbox?: boolean;
|
|
1029
|
+
agentId?: string;
|
|
1030
|
+
projectId?: string;
|
|
1031
|
+
/** Default: 50. */
|
|
1032
|
+
limit?: number;
|
|
1033
|
+
cursor?: string;
|
|
1034
|
+
}
|
|
1035
|
+
/** Query parameters for GET /v1/connections. (api: GET /v1/connections) */
|
|
1036
|
+
interface ListConnectionsParams {
|
|
1037
|
+
projectId?: string;
|
|
1038
|
+
}
|
|
1039
|
+
/** Query parameters for GET /v1/executions. (gateway: GET /v1/executions) */
|
|
1040
|
+
interface ListExecutionsParams {
|
|
1041
|
+
status?: string;
|
|
1042
|
+
principalId?: string;
|
|
1043
|
+
connectionId?: string;
|
|
1044
|
+
/** Default: 50. */
|
|
1045
|
+
limit?: number;
|
|
1046
|
+
cursor?: string;
|
|
1047
|
+
}
|
|
1048
|
+
/** Query parameters for GET /v1/policies. (api: GET /v1/policies) */
|
|
1049
|
+
interface ListPoliciesParams {
|
|
1050
|
+
projectId?: string;
|
|
1051
|
+
environmentId?: string;
|
|
1052
|
+
status?: string;
|
|
1053
|
+
}
|
|
1054
|
+
/** Query parameters for GET /v1/secrets. (api: GET /v1/secrets) */
|
|
1055
|
+
interface ListSecretsParams {
|
|
1056
|
+
projectId?: string;
|
|
1057
|
+
environmentId?: string;
|
|
1058
|
+
type?: string;
|
|
1059
|
+
}
|
|
1060
|
+
/** Input to POST /v1/auth/login. SDKs send refreshTokenDelivery=body. (api: POST /v1/auth/login) */
|
|
1061
|
+
interface LoginRequest {
|
|
1062
|
+
email: string;
|
|
1063
|
+
password: string;
|
|
1064
|
+
orgId?: string;
|
|
1065
|
+
/** Default: "cookie". */
|
|
1066
|
+
refreshTokenDelivery?: string;
|
|
1067
|
+
}
|
|
1068
|
+
/** An organization the user belongs to. */
|
|
1069
|
+
interface OrgMembership {
|
|
1070
|
+
orgId: string;
|
|
1071
|
+
role?: string;
|
|
1072
|
+
name?: string;
|
|
1073
|
+
slug?: string;
|
|
1074
|
+
}
|
|
1075
|
+
/** Response of POST /v1/auth/login (refreshTokenDelivery=body). */
|
|
1076
|
+
interface LoginResult {
|
|
1077
|
+
accessToken: string;
|
|
1078
|
+
tokenType?: string;
|
|
1079
|
+
/** Access token lifetime in seconds. */
|
|
1080
|
+
expiresIn: number;
|
|
1081
|
+
refreshToken?: string;
|
|
1082
|
+
refreshExpiresAt?: string;
|
|
1083
|
+
familyId?: string;
|
|
1084
|
+
sessionId?: string;
|
|
1085
|
+
user?: AuthUser;
|
|
1086
|
+
orgId?: string | null;
|
|
1087
|
+
orgs?: Array<OrgMembership>;
|
|
1088
|
+
}
|
|
1089
|
+
/** The authenticated principal. */
|
|
1090
|
+
interface MePrincipal {
|
|
1091
|
+
type: string;
|
|
1092
|
+
id: string;
|
|
1093
|
+
orgId?: string | null;
|
|
1094
|
+
orgRole?: string | null;
|
|
1095
|
+
projectId?: string | null;
|
|
1096
|
+
environmentId?: string | null;
|
|
1097
|
+
scopes?: Array<string>;
|
|
1098
|
+
}
|
|
1099
|
+
/** Response of GET /v1/auth/me. */
|
|
1100
|
+
interface Me {
|
|
1101
|
+
principal: MePrincipal;
|
|
1102
|
+
user?: AuthUser | null;
|
|
1103
|
+
orgs?: Array<OrgMembership>;
|
|
1104
|
+
permissions?: Array<string>;
|
|
1105
|
+
}
|
|
1106
|
+
/** Input to POST /v1/connections/oauth/callback. (api: POST /v1/connections/oauth/callback) */
|
|
1107
|
+
interface OAuthCallbackRequest {
|
|
1108
|
+
state: string;
|
|
1109
|
+
code: string;
|
|
1110
|
+
clientSecret?: string;
|
|
1111
|
+
}
|
|
1112
|
+
/** Response of the OAuth callback and the client-credentials / jwt-bearer installs. */
|
|
1113
|
+
interface OAuthInstallResult {
|
|
1114
|
+
connectionId: string;
|
|
1115
|
+
secretId: string;
|
|
1116
|
+
scope?: string | null;
|
|
1117
|
+
expiresAt?: string | null;
|
|
1118
|
+
}
|
|
1119
|
+
/** Input to POST /v1/connections/{id}/oauth/start (authorization code + PKCE). (api: POST /v1/connections/{id}/oauth/start) */
|
|
1120
|
+
interface OAuthStartRequest {
|
|
1121
|
+
redirectUri: string;
|
|
1122
|
+
clientId: string;
|
|
1123
|
+
scopes?: Array<string>;
|
|
1124
|
+
}
|
|
1125
|
+
/** Response of POST /v1/connections/{id}/oauth/start: send the user to authorizationUrl. */
|
|
1126
|
+
interface OAuthStartResult {
|
|
1127
|
+
authorizationUrl: string;
|
|
1128
|
+
expiresInSeconds?: number;
|
|
1129
|
+
}
|
|
1130
|
+
/** A policy (GET /v1/policies). */
|
|
1131
|
+
interface Policy {
|
|
1132
|
+
id: string;
|
|
1133
|
+
name: string;
|
|
1134
|
+
description?: string;
|
|
1135
|
+
status: string;
|
|
1136
|
+
scopeType?: string;
|
|
1137
|
+
scopeId?: string;
|
|
1138
|
+
projectId?: string | null;
|
|
1139
|
+
environmentId?: string | null;
|
|
1140
|
+
latestVersion?: number;
|
|
1141
|
+
activeVersion?: number | null;
|
|
1142
|
+
activeVersionId?: string | null;
|
|
1143
|
+
tags?: Array<string>;
|
|
1144
|
+
createdAt?: string;
|
|
1145
|
+
updatedAt?: string;
|
|
1146
|
+
}
|
|
1147
|
+
/** Result of running a policy's tests (POST /v1/policies/{id}/tests/run; also embedded in deploy reports). */
|
|
1148
|
+
interface PolicyTestRun {
|
|
1149
|
+
versionId?: string;
|
|
1150
|
+
passed: number;
|
|
1151
|
+
failed: number;
|
|
1152
|
+
total: number;
|
|
1153
|
+
results?: Array<unknown>;
|
|
1154
|
+
}
|
|
1155
|
+
/** Response of POST /v1/policies/{id}/deploy. HTTP 200 when deployed; HTTP 412 with deployed=false when failing tests or blocking conflicts prevent it (returned as a result, not an error). */
|
|
1156
|
+
interface PolicyDeployResult {
|
|
1157
|
+
deployed: boolean;
|
|
1158
|
+
deploymentId?: string;
|
|
1159
|
+
versionId?: string;
|
|
1160
|
+
tests?: PolicyTestRun;
|
|
1161
|
+
conflicts?: Array<unknown>;
|
|
1162
|
+
}
|
|
1163
|
+
/** A deploy/rollback record. */
|
|
1164
|
+
interface PolicyDeployment {
|
|
1165
|
+
id: string;
|
|
1166
|
+
policyId?: string;
|
|
1167
|
+
action?: string;
|
|
1168
|
+
fromVersionId?: string | null;
|
|
1169
|
+
toVersionId?: string | null;
|
|
1170
|
+
testsPassed?: boolean | null;
|
|
1171
|
+
testReport?: Record<string, unknown>;
|
|
1172
|
+
simulation?: Record<string, unknown>;
|
|
1173
|
+
comment?: string;
|
|
1174
|
+
actorId?: string | null;
|
|
1175
|
+
createdAt?: string;
|
|
1176
|
+
}
|
|
1177
|
+
/** Response of GET /v1/policies/{id}/deployments. */
|
|
1178
|
+
interface PolicyDeploymentList {
|
|
1179
|
+
data: Array<PolicyDeployment>;
|
|
1180
|
+
}
|
|
1181
|
+
/** A stored policy test case. */
|
|
1182
|
+
interface PolicyTest {
|
|
1183
|
+
id: string;
|
|
1184
|
+
policyId?: string;
|
|
1185
|
+
name: string;
|
|
1186
|
+
request?: Record<string, unknown>;
|
|
1187
|
+
expect: Decision;
|
|
1188
|
+
createdBy?: string | null;
|
|
1189
|
+
createdAt?: string;
|
|
1190
|
+
}
|
|
1191
|
+
/** An immutable policy version. */
|
|
1192
|
+
interface PolicyVersion {
|
|
1193
|
+
id: string;
|
|
1194
|
+
policyId?: string;
|
|
1195
|
+
version: number;
|
|
1196
|
+
source?: string;
|
|
1197
|
+
ast?: Record<string, unknown>;
|
|
1198
|
+
checksum?: string;
|
|
1199
|
+
message?: string;
|
|
1200
|
+
diagnostics?: Array<unknown>;
|
|
1201
|
+
authorId?: string | null;
|
|
1202
|
+
createdAt?: string;
|
|
1203
|
+
}
|
|
1204
|
+
/** Response of GET /v1/policies/{id}: the policy with its versions, latest version and tests. */
|
|
1205
|
+
interface PolicyDetail {
|
|
1206
|
+
id: string;
|
|
1207
|
+
name: string;
|
|
1208
|
+
description?: string;
|
|
1209
|
+
status: string;
|
|
1210
|
+
scopeType?: string;
|
|
1211
|
+
scopeId?: string;
|
|
1212
|
+
projectId?: string | null;
|
|
1213
|
+
environmentId?: string | null;
|
|
1214
|
+
latestVersion?: number;
|
|
1215
|
+
activeVersion?: number | null;
|
|
1216
|
+
activeVersionId?: string | null;
|
|
1217
|
+
tags?: Array<string>;
|
|
1218
|
+
createdAt?: string;
|
|
1219
|
+
updatedAt?: string;
|
|
1220
|
+
templateId?: string | null;
|
|
1221
|
+
versions?: Array<PolicyVersion>;
|
|
1222
|
+
latest?: PolicyVersion | null;
|
|
1223
|
+
tests?: Array<PolicyTest>;
|
|
1224
|
+
}
|
|
1225
|
+
/** A policy whose clauses changed. */
|
|
1226
|
+
interface PolicyDiffChange {
|
|
1227
|
+
name: string;
|
|
1228
|
+
fields?: Array<unknown>;
|
|
1229
|
+
}
|
|
1230
|
+
/** Response of GET /v1/policies/{id}/diff. */
|
|
1231
|
+
interface PolicyDiff {
|
|
1232
|
+
from?: number;
|
|
1233
|
+
to?: number;
|
|
1234
|
+
added?: Array<string>;
|
|
1235
|
+
removed?: Array<string>;
|
|
1236
|
+
changed?: Array<PolicyDiffChange>;
|
|
1237
|
+
unified?: string;
|
|
1238
|
+
}
|
|
1239
|
+
/** Response of GET /v1/policies. */
|
|
1240
|
+
interface PolicyList {
|
|
1241
|
+
data: Array<Policy>;
|
|
1242
|
+
}
|
|
1243
|
+
/** */
|
|
1244
|
+
interface PolicyOverride {
|
|
1245
|
+
policyId: string;
|
|
1246
|
+
versionId?: string;
|
|
1247
|
+
source?: string;
|
|
1248
|
+
}
|
|
1249
|
+
/** Response of POST /v1/policies/{id}/rollback. */
|
|
1250
|
+
interface PolicyRollbackResult {
|
|
1251
|
+
rolledBack: boolean;
|
|
1252
|
+
versionId: string;
|
|
1253
|
+
previousVersionId?: string | null;
|
|
1254
|
+
}
|
|
1255
|
+
/** */
|
|
1256
|
+
interface PolicyTestEnvironment {
|
|
1257
|
+
slug: string;
|
|
1258
|
+
tier: string;
|
|
1259
|
+
}
|
|
1260
|
+
/** */
|
|
1261
|
+
interface PolicyTestPrincipal {
|
|
1262
|
+
type: string;
|
|
1263
|
+
id: string;
|
|
1264
|
+
refs?: Array<string>;
|
|
1265
|
+
attributes?: Record<string, unknown>;
|
|
1266
|
+
}
|
|
1267
|
+
/** */
|
|
1268
|
+
interface PolicyTestRisk {
|
|
1269
|
+
score: number;
|
|
1270
|
+
level: string;
|
|
1271
|
+
}
|
|
1272
|
+
/** */
|
|
1273
|
+
interface RelationshipTuple {
|
|
1274
|
+
subject: string;
|
|
1275
|
+
relation: string;
|
|
1276
|
+
object: string;
|
|
1277
|
+
}
|
|
1278
|
+
/** */
|
|
1279
|
+
interface PolicySimulationCase {
|
|
1280
|
+
principal: PolicyTestPrincipal;
|
|
1281
|
+
action: string;
|
|
1282
|
+
resource: string;
|
|
1283
|
+
resourceAttributes?: Record<string, unknown>;
|
|
1284
|
+
context?: Record<string, unknown>;
|
|
1285
|
+
environment?: PolicyTestEnvironment;
|
|
1286
|
+
risk?: PolicyTestRisk | null;
|
|
1287
|
+
delegation?: Record<string, unknown> | null;
|
|
1288
|
+
now?: string;
|
|
1289
|
+
relationships?: Array<RelationshipTuple>;
|
|
1290
|
+
limitUsage?: Record<string, unknown>;
|
|
1291
|
+
expect?: Decision;
|
|
1292
|
+
label?: string;
|
|
1293
|
+
}
|
|
1294
|
+
/** Input to POST /v1/policies/simulate (deployed vs candidate policies). (api: POST /v1/policies/simulate) */
|
|
1295
|
+
interface PolicySimulateRequest {
|
|
1296
|
+
environmentId: string;
|
|
1297
|
+
/** Default: []. */
|
|
1298
|
+
overrides?: Array<PolicyOverride>;
|
|
1299
|
+
requests: Array<PolicySimulationCase>;
|
|
1300
|
+
}
|
|
1301
|
+
/** Decision under one policy set. */
|
|
1302
|
+
interface PolicySimulationOutcome {
|
|
1303
|
+
decision: Decision;
|
|
1304
|
+
reason?: string;
|
|
1305
|
+
trace?: Array<unknown>;
|
|
1306
|
+
approvals?: Array<unknown>;
|
|
1307
|
+
}
|
|
1308
|
+
/** One request of a policy simulation. */
|
|
1309
|
+
interface PolicySimulationResult {
|
|
1310
|
+
index?: number;
|
|
1311
|
+
label?: string;
|
|
1312
|
+
baseline: PolicySimulationOutcome;
|
|
1313
|
+
candidate: PolicySimulationOutcome;
|
|
1314
|
+
changed?: boolean;
|
|
1315
|
+
expected?: string | null;
|
|
1316
|
+
matchesExpectation?: boolean | null;
|
|
1317
|
+
}
|
|
1318
|
+
/** Totals of a policy simulation. */
|
|
1319
|
+
interface PolicySimulationSummary {
|
|
1320
|
+
total: number;
|
|
1321
|
+
changed?: number;
|
|
1322
|
+
mismatches?: number;
|
|
1323
|
+
byDecision?: Record<string, unknown>;
|
|
1324
|
+
}
|
|
1325
|
+
/** Response of POST /v1/policies/simulate. */
|
|
1326
|
+
interface PolicySimulation {
|
|
1327
|
+
environment?: EnvironmentRef;
|
|
1328
|
+
summary: PolicySimulationSummary;
|
|
1329
|
+
results: Array<PolicySimulationResult>;
|
|
1330
|
+
}
|
|
1331
|
+
/** */
|
|
1332
|
+
interface PolicyTestRequest {
|
|
1333
|
+
principal: PolicyTestPrincipal;
|
|
1334
|
+
action: string;
|
|
1335
|
+
resource: string;
|
|
1336
|
+
resourceAttributes?: Record<string, unknown>;
|
|
1337
|
+
context?: Record<string, unknown>;
|
|
1338
|
+
environment?: PolicyTestEnvironment;
|
|
1339
|
+
risk?: PolicyTestRisk | null;
|
|
1340
|
+
delegation?: Record<string, unknown> | null;
|
|
1341
|
+
now?: string;
|
|
1342
|
+
relationships?: Array<RelationshipTuple>;
|
|
1343
|
+
limitUsage?: Record<string, unknown>;
|
|
1344
|
+
}
|
|
1345
|
+
/** A policy test case (POST /v1/policies/{id}/tests, PUT /v1/policies/{id}/tests). (api: POST /v1/policies/{id}/tests) */
|
|
1346
|
+
interface PolicyTestCase {
|
|
1347
|
+
name: string;
|
|
1348
|
+
request: PolicyTestRequest;
|
|
1349
|
+
expect: Decision;
|
|
1350
|
+
}
|
|
1351
|
+
/** Response of PUT /v1/policies/{id}/tests. */
|
|
1352
|
+
interface PolicyTestList {
|
|
1353
|
+
data: Array<PolicyTest>;
|
|
1354
|
+
}
|
|
1355
|
+
/** Response of POST /v1/policies/validate. */
|
|
1356
|
+
interface PolicyValidation {
|
|
1357
|
+
ok: boolean;
|
|
1358
|
+
diagnostics?: Array<unknown>;
|
|
1359
|
+
conflicts?: Array<unknown>;
|
|
1360
|
+
formatted?: string | null;
|
|
1361
|
+
}
|
|
1362
|
+
/** Response of POST /v1/policies and PUT /v1/policies/{id}: the saved version. */
|
|
1363
|
+
interface PolicyVersionResult {
|
|
1364
|
+
id: string;
|
|
1365
|
+
versionId: string;
|
|
1366
|
+
version: number;
|
|
1367
|
+
status?: string;
|
|
1368
|
+
source?: string;
|
|
1369
|
+
diagnostics?: Array<unknown>;
|
|
1370
|
+
}
|
|
1371
|
+
/** The rotated-out credential and when it stops working. */
|
|
1372
|
+
interface PreviousCredential {
|
|
1373
|
+
id: string;
|
|
1374
|
+
graceUntil?: string;
|
|
1375
|
+
}
|
|
1376
|
+
/** RFC 9457 problem details returned for every error. */
|
|
1377
|
+
interface Problem {
|
|
1378
|
+
type: string;
|
|
1379
|
+
/** Machine-readable error code (e.g. policy_denied). */
|
|
1380
|
+
title: string;
|
|
1381
|
+
status: number;
|
|
1382
|
+
detail?: string;
|
|
1383
|
+
instance?: string;
|
|
1384
|
+
details?: Record<string, unknown>;
|
|
1385
|
+
requestId?: string;
|
|
1386
|
+
traceId?: string;
|
|
1387
|
+
}
|
|
1388
|
+
/** Input to POST /v1/agents. (api: POST /v1/agents) */
|
|
1389
|
+
interface RegisterAgentRequest {
|
|
1390
|
+
environmentId: string;
|
|
1391
|
+
name: string;
|
|
1392
|
+
/** Default: "". */
|
|
1393
|
+
description?: string;
|
|
1394
|
+
ownerUserId?: string;
|
|
1395
|
+
ownerTeamId?: string;
|
|
1396
|
+
applicationId?: string;
|
|
1397
|
+
framework?: string;
|
|
1398
|
+
model?: string;
|
|
1399
|
+
/** Default: "standard". */
|
|
1400
|
+
riskTier?: RiskTier;
|
|
1401
|
+
/** Default: []. */
|
|
1402
|
+
tags?: Array<string>;
|
|
1403
|
+
/** Default: {}. */
|
|
1404
|
+
metadata?: Record<string, unknown>;
|
|
1405
|
+
credential?: CreateCredentialRequest;
|
|
1406
|
+
}
|
|
1407
|
+
/** Response of POST /v1/agents: the agent plus its initial credential (null unless requested). */
|
|
1408
|
+
interface RegisteredAgent {
|
|
1409
|
+
id: string;
|
|
1410
|
+
name: string;
|
|
1411
|
+
description?: string;
|
|
1412
|
+
status: AgentStatus;
|
|
1413
|
+
statusReason?: string | null;
|
|
1414
|
+
projectId?: string;
|
|
1415
|
+
environmentId?: string;
|
|
1416
|
+
applicationId?: string | null;
|
|
1417
|
+
ownerUserId?: string | null;
|
|
1418
|
+
ownerTeamId?: string | null;
|
|
1419
|
+
ownerEmail?: string | null;
|
|
1420
|
+
framework?: string | null;
|
|
1421
|
+
model?: string | null;
|
|
1422
|
+
riskTier?: string;
|
|
1423
|
+
tags?: Array<string>;
|
|
1424
|
+
metadata?: Record<string, unknown>;
|
|
1425
|
+
createdAt?: string;
|
|
1426
|
+
updatedAt?: string;
|
|
1427
|
+
lastSeenAt?: string | null;
|
|
1428
|
+
credentials?: Array<AgentCredential>;
|
|
1429
|
+
credential?: IssuedCredential | null;
|
|
1430
|
+
}
|
|
1431
|
+
/** Input to PUT /v1/policies/{id}/tests (replaces the whole suite atomically). (api: PUT /v1/policies/{id}/tests) */
|
|
1432
|
+
interface ReplacePolicyTestsRequest {
|
|
1433
|
+
tests: Array<PolicyTestCase>;
|
|
1434
|
+
}
|
|
1435
|
+
/** Query parameters for GET /v1/replay/{principalId}. (api: GET /v1/replay/{principalId}) */
|
|
1436
|
+
interface ReplayParams {
|
|
1437
|
+
from?: string;
|
|
1438
|
+
to?: string;
|
|
1439
|
+
/** Default: 200. */
|
|
1440
|
+
limit?: number;
|
|
1441
|
+
}
|
|
1442
|
+
/** Input to POST /v1/traces/spans (1-500 agent-side spans). (gateway: POST /v1/traces/spans) */
|
|
1443
|
+
interface ReportSpansRequest {
|
|
1444
|
+
spans: Array<AgentSpan>;
|
|
1445
|
+
}
|
|
1446
|
+
/** Response of POST /v1/traces/spans (spans outside +/-24h of now are rejected). */
|
|
1447
|
+
interface ReportSpansResult {
|
|
1448
|
+
accepted: number;
|
|
1449
|
+
rejected: number;
|
|
1450
|
+
}
|
|
1451
|
+
/** Input to POST /v1/secrets/{id}/revoke (one version, or the whole secret). (api: POST /v1/secrets/{id}/revoke) */
|
|
1452
|
+
interface RevokeSecretRequest {
|
|
1453
|
+
version?: number;
|
|
1454
|
+
reason?: string;
|
|
1455
|
+
}
|
|
1456
|
+
/** Response of POST /v1/secrets/{id}/revoke. */
|
|
1457
|
+
interface RevokeSecretResult {
|
|
1458
|
+
revoked: boolean;
|
|
1459
|
+
}
|
|
1460
|
+
/** Input to POST /v1/policies/{id}/rollback (default: the previously deployed version). (api: POST /v1/policies/{id}/rollback) */
|
|
1461
|
+
interface RollbackPolicyRequest {
|
|
1462
|
+
versionId?: string;
|
|
1463
|
+
comment?: string;
|
|
1464
|
+
}
|
|
1465
|
+
/** Input to POST /v1/credentials/{id}/rotate. (api: POST /v1/credentials/{id}/rotate) */
|
|
1466
|
+
interface RotateCredentialRequest {
|
|
1467
|
+
/** Default: 60. */
|
|
1468
|
+
gracePeriodMinutes?: number;
|
|
1469
|
+
publicJwk?: Record<string, unknown>;
|
|
1470
|
+
}
|
|
1471
|
+
/** */
|
|
1472
|
+
interface SecretGenerateOptions {
|
|
1473
|
+
length?: number;
|
|
1474
|
+
}
|
|
1475
|
+
/** Input to POST /v1/secrets/{id}/rotate (a new value, or generate one). (api: POST /v1/secrets/{id}/rotate) */
|
|
1476
|
+
interface RotateSecretRequest {
|
|
1477
|
+
value?: Record<string, unknown>;
|
|
1478
|
+
generate?: SecretGenerateOptions;
|
|
1479
|
+
}
|
|
1480
|
+
/** Response of POST /v1/credentials/{id}/rotate. */
|
|
1481
|
+
interface RotatedCredential {
|
|
1482
|
+
credential: AgentCredential;
|
|
1483
|
+
clientId: string;
|
|
1484
|
+
clientSecret?: string | null;
|
|
1485
|
+
previous: PreviousCredential;
|
|
1486
|
+
}
|
|
1487
|
+
/** Response of POST /v1/secrets/{id}/rotate. */
|
|
1488
|
+
interface RotatedSecret {
|
|
1489
|
+
id: string;
|
|
1490
|
+
version: number;
|
|
1491
|
+
mask?: string;
|
|
1492
|
+
}
|
|
1493
|
+
/** */
|
|
1494
|
+
interface ScenarioContent {
|
|
1495
|
+
source: string;
|
|
1496
|
+
text: string;
|
|
1497
|
+
origin?: string;
|
|
1498
|
+
}
|
|
1499
|
+
/** */
|
|
1500
|
+
interface ScenarioExecution {
|
|
1501
|
+
connectionId: string;
|
|
1502
|
+
action: string;
|
|
1503
|
+
/** Default: {}. */
|
|
1504
|
+
input?: Record<string, unknown>;
|
|
1505
|
+
}
|
|
1506
|
+
/** */
|
|
1507
|
+
interface ScenarioHistory {
|
|
1508
|
+
velocity1m?: number;
|
|
1509
|
+
velocity5m?: number;
|
|
1510
|
+
recentDenials?: number;
|
|
1511
|
+
openAlerts?: number;
|
|
1512
|
+
}
|
|
1513
|
+
/** Delegation context of a synthetic principal. */
|
|
1514
|
+
interface SyntheticDelegation {
|
|
1515
|
+
depth: number;
|
|
1516
|
+
chain: Array<string>;
|
|
1517
|
+
originatingUserId?: string;
|
|
1518
|
+
scopes?: Array<string>;
|
|
1519
|
+
}
|
|
1520
|
+
/** A principal that does not exist (simulation only). */
|
|
1521
|
+
interface SyntheticPrincipal {
|
|
1522
|
+
/** agent (default), user or service_account. */
|
|
1523
|
+
type?: string;
|
|
1524
|
+
id?: string;
|
|
1525
|
+
tags?: Array<string>;
|
|
1526
|
+
/** low, standard (default), high or critical. */
|
|
1527
|
+
riskTier?: string;
|
|
1528
|
+
ownerUserId?: string;
|
|
1529
|
+
ownerTeamId?: string;
|
|
1530
|
+
orgRole?: string;
|
|
1531
|
+
metadata?: Record<string, unknown>;
|
|
1532
|
+
delegation?: SyntheticDelegation;
|
|
1533
|
+
}
|
|
1534
|
+
/** Who the scenario runs as: exactly one of agentId (a real agent) or synthetic. */
|
|
1535
|
+
interface ScenarioPrincipal {
|
|
1536
|
+
agentId?: string;
|
|
1537
|
+
synthetic?: SyntheticPrincipal;
|
|
1538
|
+
}
|
|
1539
|
+
/** */
|
|
1540
|
+
interface ScenarioRequest {
|
|
1541
|
+
action: string;
|
|
1542
|
+
resource: string;
|
|
1543
|
+
/** Default: {}. */
|
|
1544
|
+
resourceAttributes?: Record<string, unknown>;
|
|
1545
|
+
/** Default: {}. */
|
|
1546
|
+
context?: Record<string, unknown>;
|
|
1547
|
+
outboundData?: unknown;
|
|
1548
|
+
}
|
|
1549
|
+
/** */
|
|
1550
|
+
interface ScenarioTaint {
|
|
1551
|
+
score: number;
|
|
1552
|
+
source: string;
|
|
1553
|
+
origin?: string;
|
|
1554
|
+
}
|
|
1555
|
+
/** Secret version metadata (never ciphertext or value). */
|
|
1556
|
+
interface SecretVersionInfo {
|
|
1557
|
+
id: string;
|
|
1558
|
+
version: number;
|
|
1559
|
+
status?: string;
|
|
1560
|
+
kmsKeyId?: string;
|
|
1561
|
+
expiresAt?: string | null;
|
|
1562
|
+
createdBy?: string | null;
|
|
1563
|
+
createdAt?: string;
|
|
1564
|
+
revokedAt?: string | null;
|
|
1565
|
+
}
|
|
1566
|
+
/** Secret metadata (GET /v1/secrets, GET/PATCH /v1/secrets/{id}). The value is never returned. */
|
|
1567
|
+
interface Secret {
|
|
1568
|
+
id: string;
|
|
1569
|
+
projectId?: string | null;
|
|
1570
|
+
environmentId?: string | null;
|
|
1571
|
+
name: string;
|
|
1572
|
+
type: SecretType;
|
|
1573
|
+
description?: string;
|
|
1574
|
+
metadata?: Record<string, unknown>;
|
|
1575
|
+
accessPolicy?: Record<string, unknown>;
|
|
1576
|
+
mask?: string;
|
|
1577
|
+
status?: string;
|
|
1578
|
+
currentVersion?: number;
|
|
1579
|
+
expiresAt?: string | null;
|
|
1580
|
+
rotationPolicy?: Record<string, unknown>;
|
|
1581
|
+
lastRotatedAt?: string | null;
|
|
1582
|
+
lastUsedAt?: string | null;
|
|
1583
|
+
useCount?: number;
|
|
1584
|
+
createdBy?: string | null;
|
|
1585
|
+
createdAt?: string;
|
|
1586
|
+
updatedAt?: string;
|
|
1587
|
+
versions?: Array<SecretVersionInfo>;
|
|
1588
|
+
}
|
|
1589
|
+
/** Response of GET /v1/secrets. */
|
|
1590
|
+
interface SecretList {
|
|
1591
|
+
data: Array<Secret>;
|
|
1592
|
+
}
|
|
1593
|
+
/** Response of GET /v1/replay/{principalId}: everything a principal did in a window. */
|
|
1594
|
+
interface SessionReplay {
|
|
1595
|
+
principalId: string;
|
|
1596
|
+
from?: string;
|
|
1597
|
+
to?: string;
|
|
1598
|
+
steps?: Array<unknown>;
|
|
1599
|
+
traces?: Array<string>;
|
|
1600
|
+
}
|
|
1601
|
+
/** Response of POST /v1/auth/refresh (refresh tokens rotate: store the new one). */
|
|
1602
|
+
interface SessionTokens {
|
|
1603
|
+
accessToken: string;
|
|
1604
|
+
tokenType?: string;
|
|
1605
|
+
/** Access token lifetime in seconds. */
|
|
1606
|
+
expiresIn: number;
|
|
1607
|
+
refreshToken?: string;
|
|
1608
|
+
refreshExpiresAt?: string;
|
|
1609
|
+
familyId?: string;
|
|
1610
|
+
}
|
|
1611
|
+
/** */
|
|
1612
|
+
interface SimulationExpectation {
|
|
1613
|
+
decision?: Decision;
|
|
1614
|
+
decisionIn?: Array<Decision>;
|
|
1615
|
+
riskLevel?: RiskLevel;
|
|
1616
|
+
minRiskScore?: number;
|
|
1617
|
+
maxRiskScore?: number;
|
|
1618
|
+
minApprovers?: number;
|
|
1619
|
+
dlp?: DlpAction;
|
|
1620
|
+
injectionAtLeast?: InjectionLevel;
|
|
1621
|
+
injectionAtMost?: InjectionLevel;
|
|
1622
|
+
reasonIncludes?: string;
|
|
1623
|
+
}
|
|
1624
|
+
/** A scenario that failed in the previous run and passes now. */
|
|
1625
|
+
interface SimulationFixed {
|
|
1626
|
+
key: string;
|
|
1627
|
+
label?: string;
|
|
1628
|
+
}
|
|
1629
|
+
/** A scenario that passed in the previous run and fails now. */
|
|
1630
|
+
interface SimulationRegression {
|
|
1631
|
+
key: string;
|
|
1632
|
+
label?: string;
|
|
1633
|
+
previous?: string | null;
|
|
1634
|
+
now?: string | null;
|
|
1635
|
+
}
|
|
1636
|
+
/** */
|
|
1637
|
+
interface SimulationScenario {
|
|
1638
|
+
key?: string;
|
|
1639
|
+
label: string;
|
|
1640
|
+
category?: string;
|
|
1641
|
+
description?: string;
|
|
1642
|
+
principal: ScenarioPrincipal;
|
|
1643
|
+
request?: ScenarioRequest;
|
|
1644
|
+
execution?: ScenarioExecution;
|
|
1645
|
+
content?: ScenarioContent;
|
|
1646
|
+
history?: ScenarioHistory;
|
|
1647
|
+
taint?: ScenarioTaint;
|
|
1648
|
+
expect?: SimulationExpectation;
|
|
1649
|
+
}
|
|
1650
|
+
/** Outcome of one scenario. */
|
|
1651
|
+
interface SimulationResult {
|
|
1652
|
+
index?: number;
|
|
1653
|
+
key?: string;
|
|
1654
|
+
label?: string;
|
|
1655
|
+
category?: string | null;
|
|
1656
|
+
scenario?: SimulationScenario;
|
|
1657
|
+
/** Decision, risk, approval plan, DLP/injection outcome (or error). */
|
|
1658
|
+
actual?: Record<string, unknown>;
|
|
1659
|
+
expected?: SimulationExpectation | null;
|
|
1660
|
+
passed?: boolean | null;
|
|
1661
|
+
failures?: Array<string>;
|
|
1662
|
+
}
|
|
1663
|
+
/** Totals of a simulation run. */
|
|
1664
|
+
interface SimulationSummary {
|
|
1665
|
+
total: number;
|
|
1666
|
+
withExpectations?: number;
|
|
1667
|
+
passed?: number;
|
|
1668
|
+
failed?: number;
|
|
1669
|
+
errors?: number;
|
|
1670
|
+
byDecision?: Record<string, unknown>;
|
|
1671
|
+
changedFromBaseline?: number;
|
|
1672
|
+
byCategory?: Array<unknown>;
|
|
1673
|
+
regressions?: number;
|
|
1674
|
+
fixed?: number;
|
|
1675
|
+
previousRunId?: string | null;
|
|
1676
|
+
}
|
|
1677
|
+
/** Response of POST /v1/simulations/run (also the body of its HTTP 422 with failOnMismatch). */
|
|
1678
|
+
interface SimulationRun {
|
|
1679
|
+
/** Null when persist=false. */
|
|
1680
|
+
id?: string | null;
|
|
1681
|
+
name?: string;
|
|
1682
|
+
status: SimulationStatus;
|
|
1683
|
+
environment?: EnvironmentRef;
|
|
1684
|
+
summary: SimulationSummary;
|
|
1685
|
+
regressions?: Array<SimulationRegression>;
|
|
1686
|
+
fixed?: Array<SimulationFixed>;
|
|
1687
|
+
results: Array<SimulationResult>;
|
|
1688
|
+
durationMs?: number;
|
|
1689
|
+
}
|
|
1690
|
+
/** Input to POST /v1/simulations/run. With failOnMismatch, a failed/errored run is returned with HTTP 422. (api: POST /v1/simulations/run) */
|
|
1691
|
+
interface SimulationRunRequest {
|
|
1692
|
+
environmentId: string;
|
|
1693
|
+
name?: string;
|
|
1694
|
+
/** Default: []. */
|
|
1695
|
+
scenarios?: Array<SimulationScenario>;
|
|
1696
|
+
scenarioSetId?: string;
|
|
1697
|
+
/** Default: []. */
|
|
1698
|
+
libraryIds?: Array<string>;
|
|
1699
|
+
/** Default: []. */
|
|
1700
|
+
policyOverrides?: Array<PolicyOverride>;
|
|
1701
|
+
riskOverride?: Record<string, unknown>;
|
|
1702
|
+
/** Default: true. */
|
|
1703
|
+
liveHistory?: boolean;
|
|
1704
|
+
/** Default: "api". */
|
|
1705
|
+
trigger?: string;
|
|
1706
|
+
/** Default: true. */
|
|
1707
|
+
persist?: boolean;
|
|
1708
|
+
/** Default: false. */
|
|
1709
|
+
failOnMismatch?: boolean;
|
|
1710
|
+
}
|
|
1711
|
+
/** OAuth 2.0 token endpoint response (POST {api}/v1/auth/token). */
|
|
1712
|
+
interface TokenResponse {
|
|
1713
|
+
access_token: string;
|
|
1714
|
+
token_type: string;
|
|
1715
|
+
/** Lifetime in seconds. */
|
|
1716
|
+
expires_in: number;
|
|
1717
|
+
scope?: string;
|
|
1718
|
+
refresh_token?: string;
|
|
1719
|
+
issued_token_type?: string;
|
|
1720
|
+
}
|
|
1721
|
+
/** A stored span (platform or agent-reported). */
|
|
1722
|
+
interface TraceSpan {
|
|
1723
|
+
traceId: string;
|
|
1724
|
+
spanId: string;
|
|
1725
|
+
parentSpanId?: string | null;
|
|
1726
|
+
name: string;
|
|
1727
|
+
kind?: SpanKind;
|
|
1728
|
+
service?: string;
|
|
1729
|
+
/** platform or agent. */
|
|
1730
|
+
source?: string;
|
|
1731
|
+
principalType?: string | null;
|
|
1732
|
+
principalId?: string | null;
|
|
1733
|
+
startTime?: string;
|
|
1734
|
+
durationMs?: number;
|
|
1735
|
+
status?: SpanStatus;
|
|
1736
|
+
statusMessage?: string | null;
|
|
1737
|
+
attributes?: Record<string, unknown>;
|
|
1738
|
+
events?: Array<unknown>;
|
|
1739
|
+
}
|
|
1740
|
+
/** Response of GET /v1/traces/{traceId}: span tree, correlated records, timeline and breakdown. */
|
|
1741
|
+
interface Trace {
|
|
1742
|
+
traceId: string;
|
|
1743
|
+
startedAt?: string | null;
|
|
1744
|
+
durationMs?: number | null;
|
|
1745
|
+
spans: Array<TraceSpan>;
|
|
1746
|
+
breakdown?: Record<string, unknown>;
|
|
1747
|
+
timeline?: Array<unknown>;
|
|
1748
|
+
records?: Record<string, unknown>;
|
|
1749
|
+
}
|
|
1750
|
+
/** Query parameters for GET /v1/traces. (api: GET /v1/traces) */
|
|
1751
|
+
interface TraceSearchParams {
|
|
1752
|
+
from?: string;
|
|
1753
|
+
to?: string;
|
|
1754
|
+
principalId?: string;
|
|
1755
|
+
name?: string;
|
|
1756
|
+
service?: string;
|
|
1757
|
+
status?: string;
|
|
1758
|
+
minDurationMs?: number;
|
|
1759
|
+
attribute?: string;
|
|
1760
|
+
/** Default: 50. */
|
|
1761
|
+
limit?: number;
|
|
1762
|
+
}
|
|
1763
|
+
/** One trace in GET /v1/traces. */
|
|
1764
|
+
interface TraceSummary {
|
|
1765
|
+
traceId: string;
|
|
1766
|
+
startedAt?: string;
|
|
1767
|
+
durationMs?: number;
|
|
1768
|
+
spanCount?: number;
|
|
1769
|
+
errorCount?: number;
|
|
1770
|
+
rootName?: string | null;
|
|
1771
|
+
principalId?: string | null;
|
|
1772
|
+
services?: Array<string>;
|
|
1773
|
+
}
|
|
1774
|
+
/** Response of GET /v1/traces. */
|
|
1775
|
+
interface TraceSearchResult {
|
|
1776
|
+
data: Array<TraceSummary>;
|
|
1777
|
+
}
|
|
1778
|
+
/** Input to PATCH /v1/agents/{id}. (api: PATCH /v1/agents/{id}) */
|
|
1779
|
+
interface UpdateAgentRequest {
|
|
1780
|
+
name?: string;
|
|
1781
|
+
description?: string;
|
|
1782
|
+
ownerUserId?: string | null;
|
|
1783
|
+
ownerTeamId?: string | null;
|
|
1784
|
+
framework?: string;
|
|
1785
|
+
model?: string;
|
|
1786
|
+
riskTier?: RiskTier;
|
|
1787
|
+
tags?: Array<string>;
|
|
1788
|
+
metadata?: Record<string, unknown>;
|
|
1789
|
+
}
|
|
1790
|
+
/** Input to PATCH /v1/alerts/{id}. (api: PATCH /v1/alerts/{id}) */
|
|
1791
|
+
interface UpdateAlertRequest {
|
|
1792
|
+
status?: AlertStatus;
|
|
1793
|
+
assigneeId?: string | null;
|
|
1794
|
+
resolution?: string;
|
|
1795
|
+
note?: string;
|
|
1796
|
+
}
|
|
1797
|
+
/** Input to PATCH /v1/connections/{id}. (api: PATCH /v1/connections/{id}) */
|
|
1798
|
+
interface UpdateConnectionRequest {
|
|
1799
|
+
description?: string;
|
|
1800
|
+
config?: Record<string, unknown>;
|
|
1801
|
+
allowedHosts?: Array<string>;
|
|
1802
|
+
secretId?: string | null;
|
|
1803
|
+
status?: string;
|
|
1804
|
+
timeoutMs?: number;
|
|
1805
|
+
maxRetries?: number;
|
|
1806
|
+
signRequests?: boolean;
|
|
1807
|
+
connectorVersion?: string;
|
|
1808
|
+
}
|
|
1809
|
+
/** Input to PUT /v1/policies/{id}: saves a new version (exactly one of source or ast). (api: PUT /v1/policies/{id}) */
|
|
1810
|
+
interface UpdatePolicyRequest {
|
|
1811
|
+
source?: string;
|
|
1812
|
+
ast?: Record<string, unknown>;
|
|
1813
|
+
/** Default: "". */
|
|
1814
|
+
message?: string;
|
|
1815
|
+
description?: string;
|
|
1816
|
+
}
|
|
1817
|
+
/** Input to PATCH /v1/secrets/{id} (metadata only). (api: PATCH /v1/secrets/{id}) */
|
|
1818
|
+
interface UpdateSecretRequest {
|
|
1819
|
+
description?: string;
|
|
1820
|
+
metadata?: Record<string, unknown>;
|
|
1821
|
+
accessPolicy?: SecretAccessPolicy;
|
|
1822
|
+
expiresAt?: string | null;
|
|
1823
|
+
/** Default: {"strategy":"manual"}. */
|
|
1824
|
+
rotationPolicy?: SecretRotationPolicy;
|
|
1825
|
+
status?: string;
|
|
1826
|
+
}
|
|
1827
|
+
/** Input to POST /v1/audit/verify (default: the whole chain). (api: POST /v1/audit/verify) */
|
|
1828
|
+
interface VerifyAuditRequest {
|
|
1829
|
+
fromSeq?: number;
|
|
1830
|
+
toSeq?: number;
|
|
1831
|
+
maxEvents?: number;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
/** Minimal fetch signature (global fetch, undici, node-fetch, or a test double). */
|
|
1835
|
+
type FetchLike = (input: string, init: {
|
|
1836
|
+
method: string;
|
|
1837
|
+
headers: Record<string, string>;
|
|
1838
|
+
body?: string;
|
|
1839
|
+
signal?: AbortSignal;
|
|
1840
|
+
}) => Promise<Response>;
|
|
1841
|
+
/** Everything a token provider needs from the client (conformance §2). */
|
|
1842
|
+
interface AuthContext {
|
|
1843
|
+
/** `{apiUrl}/v1/auth/token`. */
|
|
1844
|
+
readonly tokenUrl: string;
|
|
1845
|
+
readonly clock: Clock;
|
|
1846
|
+
/**
|
|
1847
|
+
* POSTs a grant to the token endpoint (with retries). `buildBody` is invoked once per attempt so
|
|
1848
|
+
* private_key_jwt assertions get a fresh `jti` on every retry.
|
|
1849
|
+
*/
|
|
1850
|
+
requestToken(buildBody: () => Promise<Record<string, unknown>>, opts: {
|
|
1851
|
+
idempotent: boolean;
|
|
1852
|
+
signal?: AbortSignal;
|
|
1853
|
+
}): Promise<TokenResponse>;
|
|
1854
|
+
}
|
|
1855
|
+
/** Supplies the Bearer token for API calls. */
|
|
1856
|
+
interface TokenProvider {
|
|
1857
|
+
/** Whether tokens can be re-obtained. If true, a 401 invalidates the cache and the request is replayed once. */
|
|
1858
|
+
readonly refreshable: boolean;
|
|
1859
|
+
getToken(ctx: AuthContext, signal?: AbortSignal): Promise<string>;
|
|
1860
|
+
invalidate(): void;
|
|
1861
|
+
}
|
|
1862
|
+
/** Retry configuration (conformance §3). */
|
|
1863
|
+
interface RetryOptions {
|
|
1864
|
+
/** Retries after the first attempt. Default 3. */
|
|
1865
|
+
maxRetries: number;
|
|
1866
|
+
/** Base backoff delay. Default 500 ms. */
|
|
1867
|
+
baseDelayMs: number;
|
|
1868
|
+
/** Backoff cap. Default 8 s. */
|
|
1869
|
+
maxDelayMs: number;
|
|
1870
|
+
/** Longest server-requested `Retry-After` the SDK will wait for. Default 60 s. */
|
|
1871
|
+
maxRetryAfterMs: number;
|
|
1872
|
+
}
|
|
1873
|
+
/** Per-call options accepted by every client method. */
|
|
1874
|
+
interface RequestOptions {
|
|
1875
|
+
/** Cancels the call, including in-flight requests and backoff sleeps. */
|
|
1876
|
+
signal?: AbortSignal;
|
|
1877
|
+
/** W3C traceparent of the caller's span; its trace id is propagated. */
|
|
1878
|
+
traceparent?: string;
|
|
1879
|
+
/** Overrides the per-attempt timeout for this call. */
|
|
1880
|
+
timeoutMs?: number;
|
|
1881
|
+
/** Overrides maxRetries for this call. */
|
|
1882
|
+
maxRetries?: number;
|
|
1883
|
+
/** Extra headers for this call. */
|
|
1884
|
+
headers?: Record<string, string>;
|
|
1885
|
+
/**
|
|
1886
|
+
* Sent as the `Idempotency-Key` header on every attempt; the call is then retried like an idempotent
|
|
1887
|
+
* request (conformance §3.4). Set it only when repeating the request is safe.
|
|
1888
|
+
*/
|
|
1889
|
+
idempotencyKey?: string;
|
|
1890
|
+
}
|
|
1891
|
+
/** Parses a `Retry-After` header (delta-seconds or HTTP-date) into milliseconds. */
|
|
1892
|
+
declare function parseRetryAfter(value: string | null, now: number): number | null;
|
|
1893
|
+
/** Equal-jitter exponential backoff: uniform in [d/2, d] with d = min(maxDelay, base·2ⁿ). */
|
|
1894
|
+
declare function backoffDelay(attempt: number, o: Pick<RetryOptions, 'baseDelayMs' | 'maxDelayMs'>, random: () => number): number;
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* No credentials (conformance §2): for `login()` / `refreshSession()` before a token exists. Every other
|
|
1898
|
+
* call fails with `ConfigurationError` before sending a request.
|
|
1899
|
+
*/
|
|
1900
|
+
declare function unauthenticated(): TokenProvider;
|
|
1901
|
+
/** API key (`gsk_…`), sent directly as the Bearer token. */
|
|
1902
|
+
declare function apiKey(key: string): TokenProvider;
|
|
1903
|
+
/** A pre-obtained access token (not refreshed). */
|
|
1904
|
+
declare function staticToken(token: string): TokenProvider;
|
|
1905
|
+
/** A cached access token. */
|
|
1906
|
+
interface CachedToken {
|
|
1907
|
+
accessToken: string;
|
|
1908
|
+
/** Epoch ms after which the token must not be used (expiry minus skew). */
|
|
1909
|
+
refreshAt: number;
|
|
1910
|
+
scope: string | undefined;
|
|
1911
|
+
}
|
|
1912
|
+
/**
|
|
1913
|
+
* Base class for providers that obtain tokens from the token endpoint. Tokens are cached and refreshed
|
|
1914
|
+
* `min(60 s, expires_in / 2)` before expiry; concurrent callers share one in-flight request.
|
|
1915
|
+
*/
|
|
1916
|
+
declare abstract class OAuthTokenProvider implements TokenProvider {
|
|
1917
|
+
readonly refreshable = true;
|
|
1918
|
+
private cached;
|
|
1919
|
+
private inflight;
|
|
1920
|
+
private generation;
|
|
1921
|
+
/** Builds the grant body. Called once per token request attempt. */
|
|
1922
|
+
protected abstract grant(ctx: AuthContext, signal?: AbortSignal): Promise<Record<string, unknown>>;
|
|
1923
|
+
/** Whether the grant may be retried on 5xx/network errors. */
|
|
1924
|
+
protected readonly idempotentGrant: boolean;
|
|
1925
|
+
getToken(ctx: AuthContext, signal?: AbortSignal): Promise<string>;
|
|
1926
|
+
invalidate(): void;
|
|
1927
|
+
private fetchToken;
|
|
1928
|
+
}
|
|
1929
|
+
interface ClientSecretOptions {
|
|
1930
|
+
/** The `gsa_…` client secret. */
|
|
1931
|
+
clientSecret: string;
|
|
1932
|
+
/** Optional credential or principal id (checked by the server when present). */
|
|
1933
|
+
clientId?: string;
|
|
1934
|
+
/** Space-separated scopes to request (narrowed to the credential's scopes). */
|
|
1935
|
+
scope?: string;
|
|
1936
|
+
}
|
|
1937
|
+
/** OAuth 2.0 client credentials with a client secret (`gsa_…`). */
|
|
1938
|
+
declare function clientSecret(options: ClientSecretOptions): TokenProvider;
|
|
1939
|
+
type JwtAlgorithm = 'EdDSA' | 'ES256' | 'RS256';
|
|
1940
|
+
/** Custom signer (e.g. a KMS/HSM): signs the JWS signing input and returns the raw JOSE signature. */
|
|
1941
|
+
type AssertionSigner = (signingInput: Uint8Array) => Promise<Uint8Array>;
|
|
1942
|
+
interface PrivateKeyJwtOptions {
|
|
1943
|
+
/** The agent credential id (`cred_…`): the assertion `iss`, `sub` and `kid`. */
|
|
1944
|
+
credentialId: string;
|
|
1945
|
+
/** PKCS#8 PEM string, private JWK, WebCrypto CryptoKey, or omitted when `signer` is given. */
|
|
1946
|
+
privateKey?: string | JsonWebKey | CryptoKey;
|
|
1947
|
+
/** Required with `signer` or a CryptoKey whose algorithm cannot be inferred. */
|
|
1948
|
+
algorithm?: JwtAlgorithm;
|
|
1949
|
+
/** Custom signer instead of `privateKey`. */
|
|
1950
|
+
signer?: AssertionSigner;
|
|
1951
|
+
/** Assertion audience; defaults to the token URL. Must equal the server's `{PUBLIC_API_URL}/v1/auth/token`. */
|
|
1952
|
+
audience?: string;
|
|
1953
|
+
/** Assertion lifetime in seconds (default 60, max 300). */
|
|
1954
|
+
lifetimeSeconds?: number;
|
|
1955
|
+
/** Space-separated scopes to request. */
|
|
1956
|
+
scope?: string;
|
|
1957
|
+
}
|
|
1958
|
+
/** Infers the JWS algorithm of a private key. */
|
|
1959
|
+
declare function inferAlgorithm(key: string | JsonWebKey): JwtAlgorithm;
|
|
1960
|
+
/** Imports a PKCS#8 PEM or private JWK as a WebCrypto signing key. */
|
|
1961
|
+
declare function importSigningKey(key: string | JsonWebKey, alg: JwtAlgorithm): Promise<CryptoKey>;
|
|
1962
|
+
/** Creates a signed client assertion JWT (RFC 7523). Exposed for custom integrations and tests. */
|
|
1963
|
+
declare function createClientAssertion(args: {
|
|
1964
|
+
credentialId: string;
|
|
1965
|
+
audience: string;
|
|
1966
|
+
algorithm: JwtAlgorithm;
|
|
1967
|
+
sign: AssertionSigner;
|
|
1968
|
+
nowMs: number;
|
|
1969
|
+
lifetimeSeconds?: number;
|
|
1970
|
+
}): Promise<string>;
|
|
1971
|
+
/** OAuth 2.0 client credentials with `private_key_jwt` (Ed25519 / ES256 / RS256). */
|
|
1972
|
+
declare function privateKeyJwt(options: PrivateKeyJwtOptions): TokenProvider;
|
|
1973
|
+
interface DelegationOptions {
|
|
1974
|
+
/** The delegation token (`gsd_…`) issued by `createDelegation` to this (delegate) agent. */
|
|
1975
|
+
subjectToken: string;
|
|
1976
|
+
/** The delegate agent's own credentials; its access token is sent as `actor_token`. */
|
|
1977
|
+
actor: TokenProvider;
|
|
1978
|
+
/** Subset of the delegated scopes to request. */
|
|
1979
|
+
scope?: string;
|
|
1980
|
+
}
|
|
1981
|
+
/** Exchanges a delegation token for an access token acting on behalf of the delegator. */
|
|
1982
|
+
declare function delegation(options: DelegationOptions): TokenProvider;
|
|
1983
|
+
|
|
1984
|
+
interface GebSecureOptions {
|
|
1985
|
+
/** Data-plane gateway base URL. Default `GEBSECURE_GATEWAY_URL` or `https://gateway.gebsecure.dev`. */
|
|
1986
|
+
gatewayUrl?: string;
|
|
1987
|
+
/** Control-plane API base URL. Default `GEBSECURE_API_URL` or `https://api.gebsecure.dev`. */
|
|
1988
|
+
apiUrl?: string;
|
|
1989
|
+
/** Token endpoint. Default `{apiUrl}/v1/auth/token`. */
|
|
1990
|
+
tokenUrl?: string;
|
|
1991
|
+
/** Token provider (`apiKey()`, `clientSecret()`, `privateKeyJwt()`, `delegation()`, `staticToken()`). */
|
|
1992
|
+
auth?: TokenProvider;
|
|
1993
|
+
/** Shorthand for `auth: apiKey(key)`. Defaults to `GEBSECURE_API_KEY`. */
|
|
1994
|
+
apiKey?: string;
|
|
1995
|
+
/** Retries after the first attempt (default 3). 0 disables retries and automatic idempotency keys. */
|
|
1996
|
+
maxRetries?: number;
|
|
1997
|
+
/** Per-attempt timeout in ms (default 30 000). */
|
|
1998
|
+
timeoutMs?: number;
|
|
1999
|
+
/** Backoff base delay in ms (default 500). */
|
|
2000
|
+
baseDelayMs?: number;
|
|
2001
|
+
/** Backoff cap in ms (default 8 000). */
|
|
2002
|
+
maxDelayMs?: number;
|
|
2003
|
+
/** Longest Retry-After (ms) the SDK will wait for (default 60 000). */
|
|
2004
|
+
maxRetryAfterMs?: number;
|
|
2005
|
+
/** Custom fetch implementation. Default: global fetch. */
|
|
2006
|
+
fetch?: FetchLike;
|
|
2007
|
+
/** Custom clock (tests). */
|
|
2008
|
+
clock?: Clock;
|
|
2009
|
+
/** Random source for jitter (tests). */
|
|
2010
|
+
random?: () => number;
|
|
2011
|
+
/** User-Agent header (Node only; browsers ignore it). */
|
|
2012
|
+
userAgent?: string;
|
|
2013
|
+
/** Headers added to every request. */
|
|
2014
|
+
headers?: Record<string, string>;
|
|
2015
|
+
}
|
|
2016
|
+
interface WaitOptions extends RequestOptions {
|
|
2017
|
+
/** Give up after this many ms (default 10 minutes). */
|
|
2018
|
+
timeoutMs?: number;
|
|
2019
|
+
/** Poll interval in ms (default 2 000). */
|
|
2020
|
+
pollIntervalMs?: number;
|
|
2021
|
+
}
|
|
2022
|
+
/** Result of `guard()`: whether the action may proceed right now, and the full decision. */
|
|
2023
|
+
interface GuardResult {
|
|
2024
|
+
allowed: boolean;
|
|
2025
|
+
decision: AuthorizeResult;
|
|
2026
|
+
}
|
|
2027
|
+
/**
|
|
2028
|
+
* GebSecure client. Data-plane calls go to the gateway, control-plane calls and token requests to
|
|
2029
|
+
* the API. All methods accept `RequestOptions` (AbortSignal, traceparent, timeout, retries).
|
|
2030
|
+
*
|
|
2031
|
+
* ```ts
|
|
2032
|
+
* const gs = new GebSecure({ auth: privateKeyJwt({ credentialId, privateKey }) });
|
|
2033
|
+
* const { allowed, decision } = await gs.guard('refunds:create', 'stripe:charge/ch_1', { amount: 250 });
|
|
2034
|
+
* ```
|
|
2035
|
+
*/
|
|
2036
|
+
declare class GebSecure {
|
|
2037
|
+
readonly gatewayUrl: string;
|
|
2038
|
+
readonly apiUrl: string;
|
|
2039
|
+
private readonly core;
|
|
2040
|
+
private readonly auth;
|
|
2041
|
+
private readonly clock;
|
|
2042
|
+
private readonly maxRetries;
|
|
2043
|
+
private readonly options;
|
|
2044
|
+
constructor(options?: GebSecureOptions);
|
|
2045
|
+
/** A client with the same configuration acting under a delegation token (RFC 8693 exchange). */
|
|
2046
|
+
withDelegation(subjectToken: string, opts?: {
|
|
2047
|
+
scope?: string;
|
|
2048
|
+
}): GebSecure;
|
|
2049
|
+
/** Returns a valid access token (cached/refreshed), e.g. to call GebSecure APIs not wrapped by the SDK. */
|
|
2050
|
+
getAccessToken(opts?: RequestOptions): Promise<string>;
|
|
2051
|
+
private call;
|
|
2052
|
+
/** Calls an operation that returns no body (204); resolves to `undefined`. */
|
|
2053
|
+
private callVoid;
|
|
2054
|
+
/** Unauthenticated session endpoints (login/refresh): no Authorization header. */
|
|
2055
|
+
private callAnonymous;
|
|
2056
|
+
/** Decides whether the principal may perform an action. DENY / APPROVAL_REQUIRED are results, not errors. */
|
|
2057
|
+
authorize(request: AuthorizeRequest, opts?: RequestOptions): Promise<AuthorizeResult>;
|
|
2058
|
+
/** Evaluates up to 100 requests in one call. */
|
|
2059
|
+
authorizeBatch(request: AuthorizeBatchRequest, opts?: RequestOptions): Promise<AuthorizeBatchResult>;
|
|
2060
|
+
/** Convenience around `authorize`: `allowed` is true only for ALLOW. Never throws on DENY. */
|
|
2061
|
+
guard(action: string, resource: string, context?: Record<string, unknown>, opts?: RequestOptions & Partial<AuthorizeRequest>): Promise<GuardResult>;
|
|
2062
|
+
/**
|
|
2063
|
+
* Authorizes and executes a connector action. Returns an `ExecuteResult` for succeeded, simulated,
|
|
2064
|
+
* awaiting_approval, running, denied (HTTP 403) and failed (HTTP 502/504) outcomes; problem+json errors throw.
|
|
2065
|
+
* With retries enabled, an idempotency key is generated when none is given.
|
|
2066
|
+
*/
|
|
2067
|
+
execute(request: ExecuteRequest, opts?: RequestOptions): Promise<ExecuteResult>;
|
|
2068
|
+
/** Execution status, result and step logs. */
|
|
2069
|
+
getExecution(id: string, opts?: RequestOptions): Promise<Execution>;
|
|
2070
|
+
/** Lists executions visible to the caller. */
|
|
2071
|
+
listExecutions(params?: ListExecutionsParams, opts?: RequestOptions): Promise<ExecutionPage>;
|
|
2072
|
+
/** Cancels a pending, awaiting-approval or running execution. */
|
|
2073
|
+
cancelExecution(id: string, opts?: RequestOptions): Promise<CancelExecutionResult>;
|
|
2074
|
+
/** Status of an approval request (agent-facing, via the gateway). */
|
|
2075
|
+
getApproval(id: string, opts?: RequestOptions): Promise<Approval>;
|
|
2076
|
+
/** Polls an approval until it leaves `pending`; returns it in its terminal state. */
|
|
2077
|
+
waitForApproval(id: string, opts?: WaitOptions): Promise<Approval>;
|
|
2078
|
+
/**
|
|
2079
|
+
* Executes; if human approval is required, waits for it and then follows the execution until it is
|
|
2080
|
+
* terminal. Once the approval is granted the platform resumes the stored execution itself (and consumes
|
|
2081
|
+
* the single-use approval), so this helper never re-executes (conformance §5).
|
|
2082
|
+
* Throws `ApprovalNotGrantedError` when the approval is rejected/expired/cancelled,
|
|
2083
|
+
* `ApprovalTimeoutError` when it stays pending past `timeoutMs`, and `TimeoutError` when the approved
|
|
2084
|
+
* execution has not finished by then. A resumed execution that fails is returned with `status: 'failed'`.
|
|
2085
|
+
*/
|
|
2086
|
+
executeWithApproval(request: ExecuteRequest, opts?: WaitOptions): Promise<ExecuteResult>;
|
|
2087
|
+
/** Agent directory. */
|
|
2088
|
+
listAgents(params?: ListAgentsParams, opts?: RequestOptions): Promise<AgentPage>;
|
|
2089
|
+
/** One agent, including credential metadata. */
|
|
2090
|
+
getAgent(id: string, opts?: RequestOptions): Promise<Agent>;
|
|
2091
|
+
/** Policies. */
|
|
2092
|
+
listPolicies(params?: ListPoliciesParams, opts?: RequestOptions): Promise<PolicyList>;
|
|
2093
|
+
/** Approval requests (`inbox: true` = those the caller can act on). */
|
|
2094
|
+
listApprovals(params?: ListApprovalsParams, opts?: RequestOptions): Promise<ApprovalPage>;
|
|
2095
|
+
/** Delegates a subset of authority to another agent. The returned `token` (gsd_…) is shown once. */
|
|
2096
|
+
createDelegation(request: CreateDelegationRequest, opts?: RequestOptions): Promise<Delegation>;
|
|
2097
|
+
/**
|
|
2098
|
+
* Inspects untrusted content (web page, email, RAG chunk, tool output) before the agent reads it:
|
|
2099
|
+
* prompt-injection score/level/action, a sanitized form, and inbound DLP. Hand `result.content`
|
|
2100
|
+
* (null when blocked) to the model instead of the original.
|
|
2101
|
+
*/
|
|
2102
|
+
inspect(request: InspectRequest, opts?: RequestOptions): Promise<InspectResult>;
|
|
2103
|
+
/** Scans a payload for sensitive data and applies DLP rules. Retried like a read only when `dryRun` is true. */
|
|
2104
|
+
dlpScan(request: DlpScanRequest, opts?: RequestOptions): Promise<DlpScanResult>;
|
|
2105
|
+
/** Reports agent-side spans (see `buildSpan`) into the shared trace. Safe to retry: duplicates are ignored. */
|
|
2106
|
+
reportSpans(spans: AgentSpan[] | ReportSpansRequest, opts?: RequestOptions): Promise<ReportSpansResult>;
|
|
2107
|
+
/**
|
|
2108
|
+
* Runs simulation scenarios (nothing is executed). With `failOnMismatch: true`, a failed or errored run
|
|
2109
|
+
* throws `SimulationFailedError` whose `run` is the full typed result.
|
|
2110
|
+
*/
|
|
2111
|
+
runSimulation(request: SimulationRunRequest, opts?: RequestOptions): Promise<SimulationRun>;
|
|
2112
|
+
/** Logs a user in (works on an `unauthenticated()` client). The refresh token is returned in the body. */
|
|
2113
|
+
login(request: LoginRequest, opts?: RequestOptions): Promise<LoginResult>;
|
|
2114
|
+
/** Exchanges a refresh token for new tokens. The refresh token rotates: persist the returned one. Never retried (except 429). */
|
|
2115
|
+
refreshSession(refreshToken: string, opts?: RequestOptions): Promise<SessionTokens>;
|
|
2116
|
+
/** Revokes the current user session. */
|
|
2117
|
+
logout(opts?: RequestOptions): Promise<void>;
|
|
2118
|
+
/** The authenticated principal, its organizations and effective permissions. */
|
|
2119
|
+
me(opts?: RequestOptions): Promise<Me>;
|
|
2120
|
+
/** A policy with its versions, latest version and tests. */
|
|
2121
|
+
getPolicy(id: string, opts?: RequestOptions): Promise<PolicyDetail>;
|
|
2122
|
+
/** Creates a policy (draft version 1) from GSL source or a template. */
|
|
2123
|
+
createPolicy(request: CreatePolicyRequest, opts?: RequestOptions): Promise<PolicyVersionResult>;
|
|
2124
|
+
/** Saves a new version. Not retried on 5xx/network errors: every call appends a version. */
|
|
2125
|
+
updatePolicy(id: string, request: UpdatePolicyRequest, opts?: RequestOptions): Promise<PolicyVersionResult>;
|
|
2126
|
+
/** Archives a policy (stops enforcing it). */
|
|
2127
|
+
deletePolicy(id: string, opts?: RequestOptions): Promise<void>;
|
|
2128
|
+
/** Validates, lints and formats GSL source. */
|
|
2129
|
+
validatePolicy(source: string, opts?: RequestOptions): Promise<PolicyValidation>;
|
|
2130
|
+
/** One immutable policy version. */
|
|
2131
|
+
getPolicyVersion(id: string, versionId: string, opts?: RequestOptions): Promise<PolicyVersion>;
|
|
2132
|
+
/** Semantic and unified diff between two versions. */
|
|
2133
|
+
diffPolicyVersions(id: string, from: string, to: string, opts?: RequestOptions): Promise<PolicyDiff>;
|
|
2134
|
+
/** Deploy and rollback history. */
|
|
2135
|
+
listPolicyDeployments(id: string, opts?: RequestOptions): Promise<PolicyDeploymentList>;
|
|
2136
|
+
/**
|
|
2137
|
+
* Deploys a version (default: latest). When tests fail or blocking conflicts exist the server answers
|
|
2138
|
+
* 412 with the deploy report; it is returned as a result with `deployed: false`.
|
|
2139
|
+
*/
|
|
2140
|
+
deployPolicy(id: string, request?: DeployPolicyRequest, opts?: RequestOptions): Promise<PolicyDeployResult>;
|
|
2141
|
+
/** Rolls back to a version (default: the previously deployed one). */
|
|
2142
|
+
rollbackPolicy(id: string, request?: RollbackPolicyRequest, opts?: RequestOptions): Promise<PolicyRollbackResult>;
|
|
2143
|
+
/** Adds one test case. */
|
|
2144
|
+
addPolicyTest(id: string, test: PolicyTestCase, opts?: RequestOptions): Promise<PolicyTest>;
|
|
2145
|
+
/** Replaces the whole test suite atomically (policy-as-code sync). */
|
|
2146
|
+
replacePolicyTests(id: string, tests: PolicyTestCase[], opts?: RequestOptions): Promise<PolicyTestList>;
|
|
2147
|
+
/** Deletes one test case. */
|
|
2148
|
+
deletePolicyTest(id: string, testId: string, opts?: RequestOptions): Promise<void>;
|
|
2149
|
+
/** Runs the policy's tests against a version (default: latest). */
|
|
2150
|
+
runPolicyTests(id: string, versionId?: string, opts?: RequestOptions): Promise<PolicyTestRun>;
|
|
2151
|
+
/** Evaluates requests against deployed vs candidate policies. */
|
|
2152
|
+
simulatePolicies(request: PolicySimulateRequest, opts?: RequestOptions): Promise<PolicySimulation>;
|
|
2153
|
+
/** Registers an agent; with `credential`, its client secret is returned once in `credential.clientSecret`. */
|
|
2154
|
+
createAgent(request: RegisterAgentRequest, opts?: RequestOptions): Promise<RegisteredAgent>;
|
|
2155
|
+
/** Updates agent metadata. */
|
|
2156
|
+
updateAgent(id: string, request: UpdateAgentRequest, opts?: RequestOptions): Promise<Agent>;
|
|
2157
|
+
/** Activates, suspends, disables or quarantines an agent. */
|
|
2158
|
+
setAgentStatus(id: string, request: AgentStatusRequest, opts?: RequestOptions): Promise<Agent>;
|
|
2159
|
+
/** Deletes an agent. */
|
|
2160
|
+
deleteAgent(id: string, opts?: RequestOptions): Promise<void>;
|
|
2161
|
+
/** Credential metadata of an agent (never secrets). */
|
|
2162
|
+
listAgentCredentials(id: string, opts?: RequestOptions): Promise<AgentCredentialList>;
|
|
2163
|
+
/** Issues an agent credential; the client secret is returned once. */
|
|
2164
|
+
createAgentCredential(id: string, request?: CreateCredentialRequest, opts?: RequestOptions): Promise<IssuedCredential>;
|
|
2165
|
+
/** Rotates a credential; the previous one keeps working until `previous.graceUntil`. */
|
|
2166
|
+
rotateCredential(credentialId: string, request?: RotateCredentialRequest, opts?: RequestOptions): Promise<RotatedCredential>;
|
|
2167
|
+
/** Revokes a credential immediately (idempotent). */
|
|
2168
|
+
revokeCredential(credentialId: string, reason?: string, opts?: RequestOptions): Promise<AgentCredential>;
|
|
2169
|
+
/** Stores a secret. The value is never returned by the API and never logged by the SDK. */
|
|
2170
|
+
createSecret(request: CreateSecretRequest, opts?: RequestOptions): Promise<CreatedSecret>;
|
|
2171
|
+
/** Secret metadata and masks. */
|
|
2172
|
+
listSecrets(params?: ListSecretsParams, opts?: RequestOptions): Promise<SecretList>;
|
|
2173
|
+
/** One secret's metadata and version history (never the value). */
|
|
2174
|
+
getSecret(id: string, opts?: RequestOptions): Promise<Secret>;
|
|
2175
|
+
/** Updates secret metadata, access policy, expiry, rotation policy or status. */
|
|
2176
|
+
updateSecret(id: string, request: UpdateSecretRequest, opts?: RequestOptions): Promise<Secret>;
|
|
2177
|
+
/** Writes a new version (a value, or `generate`). */
|
|
2178
|
+
rotateSecret(id: string, request: RotateSecretRequest, opts?: RequestOptions): Promise<RotatedSecret>;
|
|
2179
|
+
/** Revokes one version or the whole secret. */
|
|
2180
|
+
revokeSecret(id: string, request?: RevokeSecretRequest, opts?: RequestOptions): Promise<RevokeSecretResult>;
|
|
2181
|
+
/** Deletes a secret. */
|
|
2182
|
+
deleteSecret(id: string, opts?: RequestOptions): Promise<void>;
|
|
2183
|
+
/** The connector catalog (actions, schemas, risk metadata, auth methods). */
|
|
2184
|
+
listConnectors(opts?: RequestOptions): Promise<ConnectorList>;
|
|
2185
|
+
/** One connector of the catalog. */
|
|
2186
|
+
getConnector(key: string, opts?: RequestOptions): Promise<Connector>;
|
|
2187
|
+
/** Installed connections. */
|
|
2188
|
+
listConnections(params?: ListConnectionsParams, opts?: RequestOptions): Promise<ConnectionList>;
|
|
2189
|
+
/** One connection with its connector description and effective allowed hosts. */
|
|
2190
|
+
getConnection(id: string, opts?: RequestOptions): Promise<Connection>;
|
|
2191
|
+
/** Installs a connector into a project. */
|
|
2192
|
+
createConnection(request: CreateConnectionRequest, opts?: RequestOptions): Promise<Connection>;
|
|
2193
|
+
/** Updates a connection. */
|
|
2194
|
+
updateConnection(id: string, request: UpdateConnectionRequest, opts?: RequestOptions): Promise<Connection>;
|
|
2195
|
+
/** Deletes a connection. */
|
|
2196
|
+
deleteConnection(id: string, opts?: RequestOptions): Promise<void>;
|
|
2197
|
+
/** Runs the connection health check. */
|
|
2198
|
+
checkConnectionHealth(id: string, opts?: RequestOptions): Promise<ConnectionHealth>;
|
|
2199
|
+
/** Begins an OAuth installation (authorization code + PKCE); redirect the user to `authorizationUrl`. */
|
|
2200
|
+
startConnectionOAuth(id: string, request: OAuthStartRequest, opts?: RequestOptions): Promise<OAuthStartResult>;
|
|
2201
|
+
/** Completes an OAuth installation with the `state` and `code` from the redirect. */
|
|
2202
|
+
completeConnectionOAuth(request: OAuthCallbackRequest, opts?: RequestOptions): Promise<OAuthInstallResult>;
|
|
2203
|
+
/** Installs with the OAuth client-credentials grant (machine-to-machine). */
|
|
2204
|
+
installClientCredentials(id: string, request: ClientCredentialsInstallRequest, opts?: RequestOptions): Promise<OAuthInstallResult>;
|
|
2205
|
+
/** Installs with the RFC 7523 JWT-bearer grant (e.g. a Google service account). */
|
|
2206
|
+
installJwtBearer(id: string, request: JwtBearerInstallRequest, opts?: RequestOptions): Promise<OAuthInstallResult>;
|
|
2207
|
+
/** Searches audit events (newest first); with `afterSeq`, tails the events after that sequence number (oldest first). */
|
|
2208
|
+
searchAudit(params?: AuditSearchParams, opts?: RequestOptions): Promise<AuditPage>;
|
|
2209
|
+
/** One audit event. */
|
|
2210
|
+
getAuditEvent(id: string, opts?: RequestOptions): Promise<AuditEvent>;
|
|
2211
|
+
/** Exports audit events; resolves to the raw body (ndjson by default, csv or json). */
|
|
2212
|
+
exportAudit(params?: AuditExportParams, opts?: RequestOptions): Promise<string>;
|
|
2213
|
+
/** Verifies the integrity of the audit hash chain. */
|
|
2214
|
+
verifyAudit(request?: VerifyAuditRequest, opts?: RequestOptions): Promise<AuditVerification>;
|
|
2215
|
+
/** Full approval record (control plane): steps, decisions, comments, history and `canDecide`. */
|
|
2216
|
+
getApprovalDetails(id: string, opts?: RequestOptions): Promise<Approval>;
|
|
2217
|
+
/** Approves or rejects; `snapshotHash` must be the hash of the request snapshot the reviewer saw. */
|
|
2218
|
+
decideApproval(id: string, request: DecideApprovalRequest, opts?: RequestOptions): Promise<ApprovalDecisionResult>;
|
|
2219
|
+
/** Security alerts. */
|
|
2220
|
+
listAlerts(params?: ListAlertsParams, opts?: RequestOptions): Promise<AlertPage>;
|
|
2221
|
+
/** One alert with its investigation context. */
|
|
2222
|
+
getAlert(id: string, opts?: RequestOptions): Promise<Alert>;
|
|
2223
|
+
/** Acknowledges, assigns, annotates, resolves or dismisses an alert. */
|
|
2224
|
+
updateAlert(id: string, request: UpdateAlertRequest, opts?: RequestOptions): Promise<Alert>;
|
|
2225
|
+
/** Searches traces. */
|
|
2226
|
+
searchTraces(params?: TraceSearchParams, opts?: RequestOptions): Promise<TraceSearchResult>;
|
|
2227
|
+
/** One trace: platform and agent spans, correlated records, timeline and performance breakdown. */
|
|
2228
|
+
getTrace(traceId: string, opts?: RequestOptions): Promise<Trace>;
|
|
2229
|
+
/** Everything a principal (agent or user) did in a window, step by step. */
|
|
2230
|
+
replaySession(principalId: string, params?: ReplayParams, opts?: RequestOptions): Promise<SessionReplay>;
|
|
2231
|
+
}
|
|
2232
|
+
|
|
2233
|
+
/** Options of {@link buildSpan} (conformance §5.1). */
|
|
2234
|
+
interface BuildSpanOptions {
|
|
2235
|
+
/** W3C traceparent of the enclosing span: its trace id is used and its span id becomes the parent. */
|
|
2236
|
+
traceparent?: string;
|
|
2237
|
+
/** Explicit parent span id (16 lowercase hex); wins over the traceparent's span id. */
|
|
2238
|
+
parentSpanId?: string;
|
|
2239
|
+
/** Span id to use (16 lowercase hex). Default: random. */
|
|
2240
|
+
spanId?: string;
|
|
2241
|
+
kind?: SpanKind;
|
|
2242
|
+
status?: SpanStatus;
|
|
2243
|
+
statusMessage?: string;
|
|
2244
|
+
attributes?: Record<string, string | number | boolean | null>;
|
|
2245
|
+
events?: SpanEvent[];
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Builds an agent-side span (LLM call, planning step, tool selection) for {@link GebSecure.reportSpans}.
|
|
2249
|
+
* With the `traceparent` of the current trace, the span joins the platform's spans for that trace.
|
|
2250
|
+
*
|
|
2251
|
+
* ```ts
|
|
2252
|
+
* const start = Date.now();
|
|
2253
|
+
* const answer = await llm.complete(prompt);
|
|
2254
|
+
* await gs.reportSpans([buildSpan('llm.complete', start, Date.now(), { traceparent, attributes: { model: 'x' } })]);
|
|
2255
|
+
* ```
|
|
2256
|
+
*/
|
|
2257
|
+
declare function buildSpan(name: string, start: number | Date, end: number | Date, options?: BuildSpanOptions): AgentSpan;
|
|
2258
|
+
/** The W3C traceparent that makes subsequent calls children of `span`. */
|
|
2259
|
+
declare function traceparentOf(span: Pick<AgentSpan, 'traceId' | 'spanId'>): string;
|
|
2260
|
+
|
|
2261
|
+
/** Fields shared by every GebSecure SDK error (see sdks/conformance/README.md §4). */
|
|
2262
|
+
interface ErrorInit {
|
|
2263
|
+
status?: number;
|
|
2264
|
+
code: string;
|
|
2265
|
+
detail?: string;
|
|
2266
|
+
requestId?: string | null;
|
|
2267
|
+
traceId?: string | null;
|
|
2268
|
+
details?: Record<string, unknown> | null;
|
|
2269
|
+
type?: string | null;
|
|
2270
|
+
cause?: unknown;
|
|
2271
|
+
}
|
|
2272
|
+
/** Base class of every error raised by the SDK. */
|
|
2273
|
+
declare class GebSecureError extends Error {
|
|
2274
|
+
/** HTTP status, or 0 for client-side errors (network, timeouts, approval waits). */
|
|
2275
|
+
readonly status: number;
|
|
2276
|
+
/** Machine-readable error code, e.g. `policy_denied`, `rate_limited`, `connection_error`. */
|
|
2277
|
+
readonly code: string;
|
|
2278
|
+
/** Human-readable detail from the server (or the SDK). */
|
|
2279
|
+
readonly detail: string;
|
|
2280
|
+
/** Server request id (`x-request-id`), when known. */
|
|
2281
|
+
readonly requestId: string | null;
|
|
2282
|
+
/** W3C trace id of the request, when known. */
|
|
2283
|
+
readonly traceId: string | null;
|
|
2284
|
+
/** Structured problem details (e.g. validation issues), when provided. */
|
|
2285
|
+
readonly details: Record<string, unknown> | null;
|
|
2286
|
+
/** Problem type URI, when provided. */
|
|
2287
|
+
readonly type: string | null;
|
|
2288
|
+
constructor(init: ErrorInit);
|
|
2289
|
+
}
|
|
2290
|
+
/** An error returned by the GebSecure API (RFC 9457 problem+json). Unknown codes use this class. */
|
|
2291
|
+
declare class ApiError extends GebSecureError {
|
|
2292
|
+
}
|
|
2293
|
+
/** 401 `unauthenticated`: missing, invalid, expired or revoked credentials. */
|
|
2294
|
+
declare class AuthenticationError extends ApiError {
|
|
2295
|
+
}
|
|
2296
|
+
/** 403 `forbidden`: the principal lacks a permission or scope. */
|
|
2297
|
+
declare class PermissionDeniedError extends ApiError {
|
|
2298
|
+
}
|
|
2299
|
+
/** 403 `policy_denied`: a policy denied the action. */
|
|
2300
|
+
declare class PolicyDeniedError extends ApiError {
|
|
2301
|
+
}
|
|
2302
|
+
/** 403 `approval_required`: the action requires human approval. */
|
|
2303
|
+
declare class ApprovalRequiredError extends ApiError {
|
|
2304
|
+
}
|
|
2305
|
+
/** 400 `bad_request` / 422 `validation_failed`. */
|
|
2306
|
+
declare class ValidationError extends ApiError {
|
|
2307
|
+
}
|
|
2308
|
+
/** 404 `not_found`. */
|
|
2309
|
+
declare class NotFoundError extends ApiError {
|
|
2310
|
+
}
|
|
2311
|
+
/** 409 `conflict` / 412 `precondition_failed`. */
|
|
2312
|
+
declare class ConflictError extends ApiError {
|
|
2313
|
+
}
|
|
2314
|
+
/** 502 `upstream_error`. */
|
|
2315
|
+
declare class UpstreamError extends ApiError {
|
|
2316
|
+
}
|
|
2317
|
+
/** 504 `timeout`, or a client-side per-attempt timeout (status 0). */
|
|
2318
|
+
declare class TimeoutError extends ApiError {
|
|
2319
|
+
}
|
|
2320
|
+
/** 503 `unavailable`. */
|
|
2321
|
+
declare class UnavailableError extends ApiError {
|
|
2322
|
+
}
|
|
2323
|
+
/** 500 `internal` and unknown 5xx. */
|
|
2324
|
+
declare class InternalError extends ApiError {
|
|
2325
|
+
}
|
|
2326
|
+
/** 429 `rate_limited` / `quota_exceeded`. */
|
|
2327
|
+
declare class RateLimitError extends ApiError {
|
|
2328
|
+
/** Server-requested wait before retrying, in milliseconds (from `Retry-After`), if any. */
|
|
2329
|
+
readonly retryAfterMs: number | null;
|
|
2330
|
+
constructor(init: ErrorInit & {
|
|
2331
|
+
retryAfterMs?: number | null;
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
/** The request could not be delivered (DNS, connection refused/reset, TLS). */
|
|
2335
|
+
declare class ConnectionError extends GebSecureError {
|
|
2336
|
+
constructor(detail: string, cause?: unknown);
|
|
2337
|
+
}
|
|
2338
|
+
/** `waitForApproval` deadline passed while the approval was still pending. */
|
|
2339
|
+
declare class ApprovalTimeoutError extends GebSecureError {
|
|
2340
|
+
readonly approvalId: string;
|
|
2341
|
+
constructor(approvalId: string, timeoutMs: number);
|
|
2342
|
+
}
|
|
2343
|
+
/** `executeWithApproval`: the approval ended rejected, expired or cancelled (not `approved`/`consumed`). */
|
|
2344
|
+
declare class ApprovalNotGrantedError extends GebSecureError {
|
|
2345
|
+
readonly approval: Approval;
|
|
2346
|
+
constructor(approval: Approval);
|
|
2347
|
+
}
|
|
2348
|
+
/**
|
|
2349
|
+
* `runSimulation({ failOnMismatch: true })`: the run failed or errored and the server answered 422 with
|
|
2350
|
+
* the full run, available as `run` (conformance §4).
|
|
2351
|
+
*/
|
|
2352
|
+
declare class SimulationFailedError extends ApiError {
|
|
2353
|
+
readonly run: SimulationRun;
|
|
2354
|
+
constructor(run: SimulationRun, meta?: {
|
|
2355
|
+
requestId?: string | null;
|
|
2356
|
+
traceId?: string | null;
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
/** Invalid SDK configuration (e.g. an unsupported key or an assertion lifetime above 300 s). */
|
|
2360
|
+
declare class ConfigurationError extends GebSecureError {
|
|
2361
|
+
constructor(detail: string);
|
|
2362
|
+
}
|
|
2363
|
+
/** Default error code for an HTTP status (conformance §4). */
|
|
2364
|
+
declare function codeForStatus(status: number): string;
|
|
2365
|
+
/** Builds the typed error for a non-2xx response. */
|
|
2366
|
+
declare function errorFromResponse(args: {
|
|
2367
|
+
status: number;
|
|
2368
|
+
body: unknown;
|
|
2369
|
+
text: string;
|
|
2370
|
+
requestId: string | null;
|
|
2371
|
+
traceId: string | null;
|
|
2372
|
+
retryAfterMs: number | null;
|
|
2373
|
+
}): ApiError;
|
|
2374
|
+
|
|
2375
|
+
/** SDK version (kept in sync with package.json by the release workflow check). */
|
|
2376
|
+
declare const VERSION = "0.2.1";
|
|
2377
|
+
|
|
2378
|
+
export { type Agent, type AgentCredential, type AgentCredentialList, type AgentPage, type AgentSpan, AgentStatus, type AgentStatusRequest, type Alert, type AlertPage, AlertStatus, ApiError, type Approval, type ApprovalDecisionResult, ApprovalNotGrantedError, type ApprovalPage, type ApprovalRef, ApprovalRequiredError, type ApprovalRequirement, ApprovalStatus, ApprovalTimeoutError, ApprovalVerdict, type AssertionSigner, type AuditChainError, type AuditEvent, type AuditExportParams, type AuditPage, type AuditSearchParams, type AuditVerification, type AuthContext, type AuthUser, AuthenticationError, type AuthorizeBatchEntry, type AuthorizeBatchRequest, type AuthorizeBatchResult, type AuthorizeRequest, type AuthorizeResult, type BatchError, type BuildSpanOptions, type CachedToken, type CancelExecutionResult, type ClientCredentialsInstallRequest, type ClientSecretOptions, type Clock, ConfigurationError, ConflictError, type Connection, type ConnectionCredential, ConnectionError, type ConnectionHealth, type ConnectionList, type Connector, type ConnectorAction, type ConnectorList, type ContentProvenance, ContentSource, type CreateConnectionRequest, type CreateCredentialRequest, type CreateDelegationRequest, type CreatePolicyRequest, type CreateSecretRequest, type CreatedSecret, type DecideApprovalRequest, Decision, type Delegation, type DelegationConstraints, type DelegationOptions, DelegationScope, type DeployPolicyRequest, DlpAction, DlpDirection, type DlpFinding, type DlpMatchedRule, type DlpScanRequest, type DlpScanResult, type EnvironmentRef, type ErrorInit, ExecuteMode, type ExecuteRequest, type ExecuteResult, type Execution, type ExecutionError, type ExecutionLog, type ExecutionPage, ExecutionStatus, type Explanation, type FetchLike, GebSecure, GebSecureError, type GebSecureOptions, type GuardResult, type InjectionFinding, InjectionLevel, type InjectionModelResult, type InjectionReport, type InspectDlpReport, type InspectRequest, type InspectResult, InternalError, type IssuedCredential, type JwtAlgorithm, type JwtBearerInstallRequest, type LimitState, type ListAgentsParams, type ListAlertsParams, type ListApprovalsParams, type ListConnectionsParams, type ListExecutionsParams, type ListPoliciesParams, type ListSecretsParams, type LoginRequest, type LoginResult, type Me, type MePrincipal, NotFoundError, type OAuthCallbackRequest, type OAuthInstallResult, type OAuthStartRequest, type OAuthStartResult, OAuthTokenProvider, type OnBehalfOf, type OrgMembership, PermissionDeniedError, type Policy, PolicyDeniedError, type PolicyDeployResult, type PolicyDeployment, type PolicyDeploymentList, type PolicyDetail, type PolicyDiff, type PolicyDiffChange, type PolicyList, type PolicyOverride, type PolicyRollbackResult, type PolicyScope, type PolicySimulateRequest, type PolicySimulation, type PolicySimulationCase, type PolicySimulationOutcome, type PolicySimulationResult, type PolicySimulationSummary, type PolicyTest, type PolicyTestCase, type PolicyTestEnvironment, type PolicyTestList, type PolicyTestPrincipal, type PolicyTestRequest, type PolicyTestRisk, type PolicyTestRun, type PolicyValidation, type PolicyVersion, type PolicyVersionResult, type PreviousCredential, type PrincipalRef, type PrivateKeyJwtOptions, type Problem, RateLimitError, type RegisterAgentRequest, type RegisteredAgent, type RelationshipTuple, type ReplacePolicyTestsRequest, type ReplayParams, type ReportSpansRequest, type ReportSpansResult, type RequestOptions, type RetryOptions, type RevokeSecretRequest, type RevokeSecretResult, type Risk, RiskLevel, RiskRecommendation, type RiskSignal, type RiskThresholds, RiskTier, type RollbackPolicyRequest, type RotateCredentialRequest, type RotateSecretRequest, type RotatedCredential, type RotatedSecret, type ScenarioContent, type ScenarioExecution, type ScenarioHistory, type ScenarioPrincipal, type ScenarioRequest, type ScenarioTaint, type Secret, type SecretAccessPolicy, type SecretGenerateOptions, type SecretList, type SecretRotationPolicy, SecretType, type SecretVersionInfo, type SessionReplay, type SessionTokens, type SimulationExpectation, SimulationFailedError, type SimulationFixed, type SimulationRegression, type SimulationResult, type SimulationRun, type SimulationRunRequest, type SimulationScenario, SimulationStatus, type SimulationSummary, type SpanEvent, SpanKind, SpanStatus, type SyntheticDelegation, type SyntheticPrincipal, TimeoutError, type TokenProvider, type TokenResponse, type Trace, type TraceEntry, type TraceSearchParams, type TraceSearchResult, type TraceSpan, type TraceSummary, UnavailableError, type UpdateAgentRequest, type UpdateAlertRequest, type UpdateConnectionRequest, type UpdatePolicyRequest, type UpdateSecretRequest, UpstreamError, VERSION, ValidationError, type VerifyAuditRequest, type WaitOptions, apiKey, backoffDelay, buildSpan, clientSecret, codeForStatus, createClientAssertion, delegation, errorFromResponse, importSigningKey, inferAlgorithm, parseRetryAfter, privateKeyJwt, staticToken, systemClock, traceparentOf, unauthenticated };
|