@kindgi/api 0.1.4-rc.1 → 0.1.4-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-binding.d.ts +12 -2
- package/dist/agent-binding.d.ts.map +1 -1
- package/dist/agent-pins.d.ts.map +1 -1
- package/dist/agent-pins.js +4 -1
- package/dist/agent-pins.js.map +1 -1
- package/dist/app.d.ts +8 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +23 -4
- package/dist/app.js.map +1 -1
- package/dist/deploy-versions.d.ts +8 -5
- package/dist/deploy-versions.d.ts.map +1 -1
- package/dist/deploy-versions.js +3 -9
- package/dist/deploy-versions.js.map +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +25 -0
- package/dist/errors.js.map +1 -1
- package/dist/eval-case-binding.d.ts +10 -0
- package/dist/eval-case-binding.d.ts.map +1 -1
- package/dist/eval-run-binding.d.ts +14 -3
- package/dist/eval-run-binding.d.ts.map +1 -1
- package/dist/eval-run-binding.js.map +1 -1
- package/dist/flow-pins.d.ts +20 -7
- package/dist/flow-pins.d.ts.map +1 -1
- package/dist/flow-pins.js +36 -11
- package/dist/flow-pins.js.map +1 -1
- package/dist/gate-policy-binding.d.ts +164 -0
- package/dist/gate-policy-binding.d.ts.map +1 -0
- package/dist/gate-policy-binding.js +12 -0
- package/dist/gate-policy-binding.js.map +1 -0
- package/dist/gate.d.ts +56 -0
- package/dist/gate.d.ts.map +1 -0
- package/dist/gate.js +359 -0
- package/dist/gate.js.map +1 -0
- package/dist/handler-binding.d.ts +14 -2
- package/dist/handler-binding.d.ts.map +1 -1
- package/dist/hitl-binding.d.ts +5 -0
- package/dist/hitl-binding.d.ts.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/judged-dispatcher.d.ts +16 -1
- package/dist/judged-dispatcher.d.ts.map +1 -1
- package/dist/judged-dispatcher.js +45 -6
- package/dist/judged-dispatcher.js.map +1 -1
- package/dist/judgment-binding.d.ts +38 -0
- package/dist/judgment-binding.d.ts.map +1 -1
- package/dist/judgment-binding.js +19 -0
- package/dist/judgment-binding.js.map +1 -1
- package/dist/live-version-binding.d.ts +206 -0
- package/dist/live-version-binding.d.ts.map +1 -0
- package/dist/live-version-binding.js +4 -0
- package/dist/live-version-binding.js.map +1 -0
- package/dist/middleware/authorize.d.ts.map +1 -1
- package/dist/middleware/authorize.js +13 -2
- package/dist/middleware/authorize.js.map +1 -1
- package/dist/middleware/project-ref.d.ts +25 -0
- package/dist/middleware/project-ref.d.ts.map +1 -0
- package/dist/middleware/project-ref.js +72 -0
- package/dist/middleware/project-ref.js.map +1 -0
- package/dist/openapi/generate.d.ts.map +1 -1
- package/dist/openapi/generate.js +4 -0
- package/dist/openapi/generate.js.map +1 -1
- package/dist/openapi/operations.d.ts +6 -0
- package/dist/openapi/operations.d.ts.map +1 -1
- package/dist/openapi/operations.js +512 -22
- package/dist/openapi/operations.js.map +1 -1
- package/dist/openapi/schemas.d.ts +37 -0
- package/dist/openapi/schemas.d.ts.map +1 -1
- package/dist/openapi/schemas.js +709 -5
- package/dist/openapi/schemas.js.map +1 -1
- package/dist/publish-refused.d.ts +18 -0
- package/dist/publish-refused.d.ts.map +1 -0
- package/dist/publish-refused.js +22 -0
- package/dist/publish-refused.js.map +1 -0
- package/dist/retention-binding.d.ts +29 -0
- package/dist/retention-binding.d.ts.map +1 -1
- package/dist/routes/agent-releases.d.ts +40 -0
- package/dist/routes/agent-releases.d.ts.map +1 -0
- package/dist/routes/agent-releases.js +462 -0
- package/dist/routes/agent-releases.js.map +1 -0
- package/dist/routes/agents.d.ts +7 -1
- package/dist/routes/agents.d.ts.map +1 -1
- package/dist/routes/agents.js +31 -3
- package/dist/routes/agents.js.map +1 -1
- package/dist/routes/approvals.d.ts.map +1 -1
- package/dist/routes/approvals.js +40 -9
- package/dist/routes/approvals.js.map +1 -1
- package/dist/routes/audit.d.ts.map +1 -1
- package/dist/routes/audit.js +7 -0
- package/dist/routes/audit.js.map +1 -1
- package/dist/routes/auth.js +1 -1
- package/dist/routes/auth.js.map +1 -1
- package/dist/routes/conversations.d.ts +0 -7
- package/dist/routes/conversations.d.ts.map +1 -1
- package/dist/routes/conversations.js +19 -3
- package/dist/routes/conversations.js.map +1 -1
- package/dist/routes/deployments.d.ts +6 -0
- package/dist/routes/deployments.d.ts.map +1 -1
- package/dist/routes/deployments.js +33 -5
- package/dist/routes/deployments.js.map +1 -1
- package/dist/routes/env.d.ts.map +1 -1
- package/dist/routes/env.js +1 -0
- package/dist/routes/env.js.map +1 -1
- package/dist/routes/eval-comparison.d.ts +2 -1
- package/dist/routes/eval-comparison.d.ts.map +1 -1
- package/dist/routes/eval-comparison.js +22 -9
- package/dist/routes/eval-comparison.js.map +1 -1
- package/dist/routes/flows.d.ts +14 -7
- package/dist/routes/flows.d.ts.map +1 -1
- package/dist/routes/flows.js +10 -8
- package/dist/routes/flows.js.map +1 -1
- package/dist/routes/gate-policies.d.ts +19 -0
- package/dist/routes/gate-policies.d.ts.map +1 -0
- package/dist/routes/gate-policies.js +191 -0
- package/dist/routes/gate-policies.js.map +1 -0
- package/dist/routes/gate-policy-spec.d.ts +17 -0
- package/dist/routes/gate-policy-spec.d.ts.map +1 -0
- package/dist/routes/gate-policy-spec.js +192 -0
- package/dist/routes/gate-policy-spec.js.map +1 -0
- package/dist/routes/gate-policy-wire.d.ts +3 -0
- package/dist/routes/gate-policy-wire.d.ts.map +1 -0
- package/dist/routes/gate-policy-wire.js +18 -0
- package/dist/routes/gate-policy-wire.js.map +1 -0
- package/dist/routes/hierarchy-errors.d.ts +11 -0
- package/dist/routes/hierarchy-errors.d.ts.map +1 -1
- package/dist/routes/hierarchy-errors.js +13 -0
- package/dist/routes/hierarchy-errors.js.map +1 -1
- package/dist/routes/judged-suites.js +7 -0
- package/dist/routes/judged-suites.js.map +1 -1
- package/dist/routes/judgments.d.ts +4 -1
- package/dist/routes/judgments.d.ts.map +1 -1
- package/dist/routes/judgments.js +92 -19
- package/dist/routes/judgments.js.map +1 -1
- package/dist/routes/live-scope-wire.d.ts +32 -0
- package/dist/routes/live-scope-wire.d.ts.map +1 -0
- package/dist/routes/live-scope-wire.js +71 -0
- package/dist/routes/live-scope-wire.js.map +1 -0
- package/dist/routes/policies.d.ts +6 -3
- package/dist/routes/policies.d.ts.map +1 -1
- package/dist/routes/policies.js +55 -3
- package/dist/routes/policies.js.map +1 -1
- package/dist/routes/projects.d.ts.map +1 -1
- package/dist/routes/projects.js +47 -3
- package/dist/routes/projects.js.map +1 -1
- package/dist/routes/retention.d.ts.map +1 -1
- package/dist/routes/retention.js +18 -2
- package/dist/routes/retention.js.map +1 -1
- package/dist/routes/reviewers.d.ts +8 -1
- package/dist/routes/reviewers.d.ts.map +1 -1
- package/dist/routes/reviewers.js +20 -3
- package/dist/routes/reviewers.js.map +1 -1
- package/dist/routes/runs.d.ts.map +1 -1
- package/dist/routes/runs.js +22 -13
- package/dist/routes/runs.js.map +1 -1
- package/dist/routes/secrets.d.ts.map +1 -1
- package/dist/routes/secrets.js +2 -0
- package/dist/routes/secrets.js.map +1 -1
- package/dist/routes/segments.d.ts +17 -0
- package/dist/routes/segments.d.ts.map +1 -0
- package/dist/routes/segments.js +68 -0
- package/dist/routes/segments.js.map +1 -0
- package/dist/routes/teams.d.ts.map +1 -1
- package/dist/routes/teams.js +42 -3
- package/dist/routes/teams.js.map +1 -1
- package/dist/routes/uuid-param.d.ts +11 -0
- package/dist/routes/uuid-param.d.ts.map +1 -0
- package/dist/routes/uuid-param.js +19 -0
- package/dist/routes/uuid-param.js.map +1 -0
- package/openapi.json +7008 -3624
- package/package.json +21 -21
- package/src/agent-binding.ts +12 -2
- package/src/agent-pins.ts +3 -1
- package/src/app.ts +37 -3
- package/src/deploy-versions.ts +11 -14
- package/src/errors.ts +25 -0
- package/src/eval-case-binding.ts +7 -0
- package/src/eval-run-binding.ts +24 -3
- package/src/flow-pins.ts +49 -9
- package/src/gate-policy-binding.ts +171 -0
- package/src/gate.ts +467 -0
- package/src/handler-binding.ts +14 -2
- package/src/hitl-binding.ts +5 -0
- package/src/index.ts +46 -1
- package/src/judged-dispatcher.ts +74 -6
- package/src/judgment-binding.ts +62 -0
- package/src/live-version-binding.ts +237 -0
- package/src/middleware/authorize.ts +18 -2
- package/src/middleware/project-ref.ts +88 -0
- package/src/openapi/generate.ts +5 -0
- package/src/openapi/operations.ts +619 -22
- package/src/openapi/schemas.ts +788 -5
- package/src/publish-refused.ts +31 -0
- package/src/retention-binding.ts +30 -0
- package/src/routes/agent-releases.ts +581 -0
- package/src/routes/agents.ts +43 -2
- package/src/routes/approvals.ts +58 -8
- package/src/routes/audit.ts +10 -0
- package/src/routes/auth.ts +1 -1
- package/src/routes/conversations.ts +31 -3
- package/src/routes/deployments.ts +50 -5
- package/src/routes/env.ts +1 -0
- package/src/routes/eval-comparison.ts +24 -10
- package/src/routes/flows.ts +27 -11
- package/src/routes/gate-policies.ts +226 -0
- package/src/routes/gate-policy-spec.ts +229 -0
- package/src/routes/gate-policy-wire.ts +20 -0
- package/src/routes/hierarchy-errors.ts +14 -0
- package/src/routes/judged-suites.ts +5 -0
- package/src/routes/judgments.ts +107 -23
- package/src/routes/live-scope-wire.ts +90 -0
- package/src/routes/policies.ts +61 -3
- package/src/routes/projects.ts +54 -2
- package/src/routes/retention.ts +21 -2
- package/src/routes/reviewers.ts +23 -4
- package/src/routes/runs.ts +33 -20
- package/src/routes/secrets.ts +2 -0
- package/src/routes/segments.ts +75 -0
- package/src/routes/teams.ts +53 -3
- package/src/routes/uuid-param.ts +28 -0
package/dist/openapi/schemas.js
CHANGED
|
@@ -62,12 +62,18 @@
|
|
|
62
62
|
* per-route parsers in `routes/*.ts` validate ad hoc.
|
|
63
63
|
*/
|
|
64
64
|
import { EVIDENCE_KINDS } from '@kindgi/compliance';
|
|
65
|
-
import { MAX_TOOL_ERROR_RETRIES, POLICY_KINDS, TOOL_ERROR_KINDS } from '@kindgi/policy-contract';
|
|
65
|
+
import { MAX_TOOL_ERROR_RETRIES, POLICY_KINDS, RETENTION_DOMAINS, TOOL_ERROR_KINDS, } from '@kindgi/policy-contract';
|
|
66
|
+
import { ERROR_CODE_TO_STATUS } from '../errors.js';
|
|
66
67
|
// ---------------- shared shapes ----------------
|
|
67
68
|
export const WireErrorSchema = {
|
|
68
69
|
type: 'object',
|
|
69
70
|
additionalProperties: false,
|
|
70
71
|
required: ['error'],
|
|
72
|
+
// Every code the API answers with, and its HTTP status. Not a closed
|
|
73
|
+
// list for clients (a newer server may add codes); the clients' tests
|
|
74
|
+
// read it to check that each 4xx code maps to a typed error, not to a
|
|
75
|
+
// server error. Generators and validators ignore `x-` keys.
|
|
76
|
+
'x-error-codes': ERROR_CODE_TO_STATUS,
|
|
71
77
|
properties: {
|
|
72
78
|
error: {
|
|
73
79
|
type: 'object',
|
|
@@ -128,6 +134,387 @@ export const RunAgentSchema = {
|
|
|
128
134
|
id: { type: 'string', description: 'The agent id.' },
|
|
129
135
|
version: { type: 'string', description: 'The agent version that ran (semver).' },
|
|
130
136
|
conversationId: { type: 'string', format: 'uuid' },
|
|
137
|
+
via: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
enum: ['explicit', 'flow-pin', 'conversation', 'live', 'latest'],
|
|
140
|
+
description: "Why this version ran: named by the caller (`explicit`); held by the flow version a flow's agent step runs in (`flow-pin`: the node's `config.version`, else the version the flow version pinned when it was published); the conversation's own (`conversation`); the version live for the run's scope (`live`); or the latest, nothing being live (`latest`). Absent on runs from before Kindgi 0.1.4.",
|
|
141
|
+
},
|
|
142
|
+
liveScope: {
|
|
143
|
+
$ref: '#/components/schemas/LiveScope',
|
|
144
|
+
description: 'The pin that chose the version, when `via` is `live`.',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
export const ScopeSegmentSchema = {
|
|
149
|
+
type: 'object',
|
|
150
|
+
additionalProperties: false,
|
|
151
|
+
required: ['key', 'value'],
|
|
152
|
+
properties: {
|
|
153
|
+
key: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
pattern: '^[a-z][a-z0-9_-]{0,63}$',
|
|
156
|
+
description: 'Lowercase, like an identifier: `company`, `contact-role`.',
|
|
157
|
+
},
|
|
158
|
+
value: { type: 'string', minLength: 1, maxLength: 256 },
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
const liveScopeVariant = (kind, description, properties) => ({
|
|
162
|
+
type: 'object',
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
required: ['kind', ...Object.keys(properties)],
|
|
165
|
+
description,
|
|
166
|
+
properties: { kind: { type: 'string', enum: [kind] }, ...properties },
|
|
167
|
+
});
|
|
168
|
+
export const LiveScopeTenantSchema = liveScopeVariant('tenant', "The agent's default for the whole tenant.", {});
|
|
169
|
+
export const LiveScopeOrgSchema = liveScopeVariant('org', "An org's projects.", {
|
|
170
|
+
orgId: { type: 'string', format: 'uuid' },
|
|
171
|
+
});
|
|
172
|
+
export const LiveScopeProjectSchema = liveScopeVariant('project', 'One project.', {
|
|
173
|
+
projectId: { type: 'string', format: 'uuid' },
|
|
174
|
+
});
|
|
175
|
+
export const LiveScopeSegmentSchema = liveScopeVariant('segment', 'A segment path within a project: it covers every run whose path starts with it.', {
|
|
176
|
+
projectId: { type: 'string', format: 'uuid' },
|
|
177
|
+
path: {
|
|
178
|
+
type: 'array',
|
|
179
|
+
minItems: 1,
|
|
180
|
+
maxItems: 8,
|
|
181
|
+
items: { $ref: '#/components/schemas/ScopeSegment' },
|
|
182
|
+
},
|
|
183
|
+
});
|
|
184
|
+
export const LiveScopeSchema = {
|
|
185
|
+
description: 'Where a live version is pinned, from least to most specific: tenant, org, project, segment path. A run takes the most specific pin that covers it.',
|
|
186
|
+
oneOf: [
|
|
187
|
+
{ $ref: '#/components/schemas/LiveScopeTenant' },
|
|
188
|
+
{ $ref: '#/components/schemas/LiveScopeOrg' },
|
|
189
|
+
{ $ref: '#/components/schemas/LiveScopeProject' },
|
|
190
|
+
{ $ref: '#/components/schemas/LiveScopeSegment' },
|
|
191
|
+
],
|
|
192
|
+
discriminator: { propertyName: 'kind' },
|
|
193
|
+
};
|
|
194
|
+
export const LiveVersionResolutionSchema = {
|
|
195
|
+
type: 'object',
|
|
196
|
+
additionalProperties: false,
|
|
197
|
+
required: ['agentId', 'version', 'via'],
|
|
198
|
+
properties: {
|
|
199
|
+
agentId: { type: 'string' },
|
|
200
|
+
version: { type: 'string', description: 'The version a run would use (semver).' },
|
|
201
|
+
via: {
|
|
202
|
+
type: 'string',
|
|
203
|
+
enum: ['live', 'latest'],
|
|
204
|
+
description: 'A live pin chose it, or nothing is live on the way up and it is the latest.',
|
|
205
|
+
},
|
|
206
|
+
liveScope: { $ref: '#/components/schemas/LiveScope' },
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
export const LivePinSchema = {
|
|
210
|
+
type: 'object',
|
|
211
|
+
additionalProperties: false,
|
|
212
|
+
required: ['agentId', 'scope', 'version', 'promotionId', 'setAt'],
|
|
213
|
+
properties: {
|
|
214
|
+
agentId: { type: 'string' },
|
|
215
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
216
|
+
version: { type: 'string' },
|
|
217
|
+
promotionId: { type: 'string', format: 'uuid', description: 'The promotion that set it.' },
|
|
218
|
+
setAt: { type: 'string', format: 'date-time' },
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
export const LivePinListSchema = {
|
|
222
|
+
type: 'object',
|
|
223
|
+
additionalProperties: false,
|
|
224
|
+
required: ['data'],
|
|
225
|
+
properties: { data: { type: 'array', items: { $ref: '#/components/schemas/LivePin' } } },
|
|
226
|
+
};
|
|
227
|
+
export const PromotionSchema = {
|
|
228
|
+
type: 'object',
|
|
229
|
+
additionalProperties: false,
|
|
230
|
+
required: [
|
|
231
|
+
'id',
|
|
232
|
+
'agentId',
|
|
233
|
+
'scope',
|
|
234
|
+
'action',
|
|
235
|
+
'fromVersion',
|
|
236
|
+
'toVersion',
|
|
237
|
+
'requestedBy',
|
|
238
|
+
'createdAt',
|
|
239
|
+
],
|
|
240
|
+
description: "One change of a scope's live version, kept for good: what was live before, what is after, who asked and why.",
|
|
241
|
+
properties: {
|
|
242
|
+
id: { type: 'string', format: 'uuid' },
|
|
243
|
+
agentId: { type: 'string' },
|
|
244
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
245
|
+
action: { type: 'string', enum: ['promote', 'rollback', 'unpin'] },
|
|
246
|
+
fromVersion: {
|
|
247
|
+
type: ['string', 'null'],
|
|
248
|
+
description: "The scope's own pin before; null when it had none.",
|
|
249
|
+
},
|
|
250
|
+
toVersion: {
|
|
251
|
+
type: ['string', 'null'],
|
|
252
|
+
description: "The scope's own pin after; null after an unpin.",
|
|
253
|
+
},
|
|
254
|
+
requestedBy: {
|
|
255
|
+
type: 'object',
|
|
256
|
+
additionalProperties: false,
|
|
257
|
+
required: ['kind', 'id'],
|
|
258
|
+
properties: {
|
|
259
|
+
kind: { type: 'string', enum: ['user', 'service'] },
|
|
260
|
+
id: { type: 'string' },
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
reason: { type: 'string' },
|
|
264
|
+
evalRunId: { type: 'string', description: 'The comparison the change was judged on.' },
|
|
265
|
+
createdAt: { type: 'string', format: 'date-time' },
|
|
266
|
+
status: {
|
|
267
|
+
type: 'string',
|
|
268
|
+
enum: ['promoted', 'pending-approval', 'refused', 'superseded', 'rejected', 'expired'],
|
|
269
|
+
description: "A `promote` row's state: it changes once, from `pending-approval` to its final state. Absent on rollback and unpin rows, and on promotions made before gates (`promoted`).",
|
|
270
|
+
},
|
|
271
|
+
policy: {
|
|
272
|
+
oneOf: [{ $ref: '#/components/schemas/GatePolicyRef' }, { type: 'null' }],
|
|
273
|
+
description: 'The gate policy that applied; null when none did. Absent before gates.',
|
|
274
|
+
},
|
|
275
|
+
checks: { type: 'array', items: { $ref: '#/components/schemas/GateCheck' } },
|
|
276
|
+
approvalId: {
|
|
277
|
+
type: 'string',
|
|
278
|
+
description: 'The approval a `pending-approval` promotion waits on (kept once decided).',
|
|
279
|
+
},
|
|
280
|
+
resolvedAt: {
|
|
281
|
+
type: 'string',
|
|
282
|
+
format: 'date-time',
|
|
283
|
+
description: 'When a `pending-approval` promotion reached its final state.',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
};
|
|
287
|
+
export const PromotionPageSchema = {
|
|
288
|
+
type: 'object',
|
|
289
|
+
additionalProperties: false,
|
|
290
|
+
required: ['data', 'hasMore'],
|
|
291
|
+
properties: {
|
|
292
|
+
data: { type: 'array', items: { $ref: '#/components/schemas/Promotion' } },
|
|
293
|
+
hasMore: { type: 'boolean' },
|
|
294
|
+
nextCursor: { type: 'string' },
|
|
295
|
+
},
|
|
296
|
+
};
|
|
297
|
+
// ---------------- the promotion gate (evals step 4b) ----------------
|
|
298
|
+
export const GateCheckSchema = {
|
|
299
|
+
type: 'object',
|
|
300
|
+
additionalProperties: false,
|
|
301
|
+
required: ['name', 'passed', 'message'],
|
|
302
|
+
description: "One of a gate's checks, as the promotion records it.",
|
|
303
|
+
properties: {
|
|
304
|
+
name: {
|
|
305
|
+
type: 'string',
|
|
306
|
+
description: 'Stable: `comparison.required`, `comparison.status`, `comparison.freshness`, `comparison.suite`, `sameContents`, `baselineIsLive`, `scopeCovered`, `evidence.<metric>.minCases|minWeight|baselineMinCases|baselineMinWeight`, `metric.<metric>.k|minCandidate|maxDrop`, `replay.maxDiverged|maxErrors|maxRefusedWrites|maxStopped`, `classWeights.restrictedOnly`.',
|
|
307
|
+
},
|
|
308
|
+
passed: { type: 'boolean' },
|
|
309
|
+
message: {
|
|
310
|
+
type: 'string',
|
|
311
|
+
description: 'A plain sentence: what was found against what the policy asks.',
|
|
312
|
+
},
|
|
313
|
+
value: { type: ['number', 'string'] },
|
|
314
|
+
threshold: { type: ['number', 'string'] },
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
|
+
export const GatePolicyRefSchema = {
|
|
318
|
+
type: 'object',
|
|
319
|
+
additionalProperties: false,
|
|
320
|
+
required: ['id', 'version'],
|
|
321
|
+
properties: { id: { type: 'string' }, version: { type: 'string' } },
|
|
322
|
+
};
|
|
323
|
+
export const GateApprovalSchema = {
|
|
324
|
+
type: 'object',
|
|
325
|
+
additionalProperties: false,
|
|
326
|
+
required: ['role', 'count', 'separateApprover'],
|
|
327
|
+
description: 'The approval a passing promotion waits for.',
|
|
328
|
+
properties: {
|
|
329
|
+
role: { type: 'string', enum: ['standard', 'senior', 'admin'] },
|
|
330
|
+
count: { type: 'integer', minimum: 1 },
|
|
331
|
+
separateApprover: {
|
|
332
|
+
type: 'boolean',
|
|
333
|
+
description: 'Whoever asked for the promotion may not approve it.',
|
|
334
|
+
},
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
const GateMetricSpecSchema = {
|
|
338
|
+
type: 'object',
|
|
339
|
+
additionalProperties: false,
|
|
340
|
+
required: ['name'],
|
|
341
|
+
properties: {
|
|
342
|
+
name: { type: 'string', enum: ['weightedYesShare', 'judgedCoverage', 'weightedPrecisionAtK'] },
|
|
343
|
+
k: {
|
|
344
|
+
type: 'integer',
|
|
345
|
+
minimum: 1,
|
|
346
|
+
maximum: 100,
|
|
347
|
+
description: "`weightedPrecisionAtK` only: the summary's `k` must be this.",
|
|
348
|
+
},
|
|
349
|
+
minCandidate: { type: 'number', minimum: 0, maximum: 1 },
|
|
350
|
+
maxDrop: {
|
|
351
|
+
type: 'number',
|
|
352
|
+
minimum: 0,
|
|
353
|
+
maximum: 1,
|
|
354
|
+
description: 'How far the candidate may fall below the baseline (the live version).',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
export const GatePolicySpecSchema = {
|
|
359
|
+
type: 'object',
|
|
360
|
+
additionalProperties: false,
|
|
361
|
+
description: 'What a promotion must show. Every part is optional; an empty spec checks nothing. A promotion must name a comparison (`evalRunId`) exactly when the spec has `comparison`, `evidence`, `metrics`, `replay` or `onlyRestrictedClasses`. Unknown keys are refused.',
|
|
362
|
+
properties: {
|
|
363
|
+
comparison: {
|
|
364
|
+
type: 'object',
|
|
365
|
+
additionalProperties: false,
|
|
366
|
+
properties: {
|
|
367
|
+
maxAgeHours: { type: 'number', exclusiveMinimum: 0 },
|
|
368
|
+
suite: {
|
|
369
|
+
type: 'object',
|
|
370
|
+
additionalProperties: false,
|
|
371
|
+
required: ['id'],
|
|
372
|
+
properties: { id: { type: 'string' }, version: { type: 'string' } },
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
evidence: {
|
|
377
|
+
type: 'object',
|
|
378
|
+
additionalProperties: false,
|
|
379
|
+
description: "The judged evidence behind each gated metric; for a metric with `maxDrop`, the baseline's too.",
|
|
380
|
+
properties: {
|
|
381
|
+
minCases: { type: 'integer', minimum: 0 },
|
|
382
|
+
minWeight: { type: 'number', minimum: 0 },
|
|
383
|
+
},
|
|
384
|
+
},
|
|
385
|
+
metrics: { type: 'array', items: GateMetricSpecSchema },
|
|
386
|
+
replay: {
|
|
387
|
+
type: 'object',
|
|
388
|
+
additionalProperties: false,
|
|
389
|
+
description: 'Each knob left out of the block is 0. No block: no replay checks.',
|
|
390
|
+
properties: {
|
|
391
|
+
maxDiverged: { type: 'integer', minimum: 0 },
|
|
392
|
+
maxErrors: { type: 'integer', minimum: 0 },
|
|
393
|
+
maxRefusedWrites: { type: 'integer', minimum: 0 },
|
|
394
|
+
maxStopped: { type: 'integer', minimum: 0 },
|
|
395
|
+
},
|
|
396
|
+
},
|
|
397
|
+
approvals: {
|
|
398
|
+
type: 'object',
|
|
399
|
+
additionalProperties: false,
|
|
400
|
+
description: 'A passing promotion waits for a reviewer.',
|
|
401
|
+
properties: {
|
|
402
|
+
role: {
|
|
403
|
+
type: 'string',
|
|
404
|
+
enum: ['standard', 'senior', 'admin'],
|
|
405
|
+
description: 'Default `senior`.',
|
|
406
|
+
},
|
|
407
|
+
separateApprover: { type: 'boolean', description: 'Default `true`.' },
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
onlyRestrictedClasses: {
|
|
411
|
+
type: 'boolean',
|
|
412
|
+
description: "Only restricted judge classes count: the comparison must be weighted `restricted-only`, so a class anyone may assert can't move the gate.",
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
export const GatePolicySchema = {
|
|
417
|
+
type: 'object',
|
|
418
|
+
additionalProperties: false,
|
|
419
|
+
required: ['id', 'version', 'agentId', 'scope', 'spec', 'createdAt'],
|
|
420
|
+
properties: {
|
|
421
|
+
id: { type: 'string' },
|
|
422
|
+
version: { type: 'string' },
|
|
423
|
+
agentId: { type: 'string' },
|
|
424
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
425
|
+
spec: { $ref: '#/components/schemas/GatePolicySpec' },
|
|
426
|
+
description: { type: 'string' },
|
|
427
|
+
createdAt: { type: 'string', format: 'date-time' },
|
|
428
|
+
unregisteredAt: { type: 'string', format: 'date-time' },
|
|
429
|
+
},
|
|
430
|
+
};
|
|
431
|
+
export const GatePolicyPageSchema = {
|
|
432
|
+
type: 'object',
|
|
433
|
+
additionalProperties: false,
|
|
434
|
+
required: ['data', 'hasMore'],
|
|
435
|
+
properties: {
|
|
436
|
+
data: { type: 'array', items: { $ref: '#/components/schemas/GatePolicy' } },
|
|
437
|
+
hasMore: { type: 'boolean' },
|
|
438
|
+
nextCursor: { type: 'string' },
|
|
439
|
+
},
|
|
440
|
+
};
|
|
441
|
+
export const PublishGatePolicyBodySchema = {
|
|
442
|
+
type: 'object',
|
|
443
|
+
additionalProperties: false,
|
|
444
|
+
required: ['id', 'version', 'agentId', 'scope', 'spec'],
|
|
445
|
+
properties: {
|
|
446
|
+
id: {
|
|
447
|
+
type: 'string',
|
|
448
|
+
pattern: '^[a-z0-9][a-z0-9._-]{0,127}$',
|
|
449
|
+
description: 'Yours to choose, e.g. `acme.drafting-prod`.',
|
|
450
|
+
},
|
|
451
|
+
version: { type: 'string', pattern: '^\\d+\\.\\d+\\.\\d+$' },
|
|
452
|
+
agentId: { type: 'string' },
|
|
453
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
454
|
+
spec: { $ref: '#/components/schemas/GatePolicySpec' },
|
|
455
|
+
description: { type: 'string' },
|
|
456
|
+
},
|
|
457
|
+
};
|
|
458
|
+
export const GatePolicyResolutionSchema = {
|
|
459
|
+
type: 'object',
|
|
460
|
+
additionalProperties: false,
|
|
461
|
+
required: ['policy'],
|
|
462
|
+
properties: {
|
|
463
|
+
policy: {
|
|
464
|
+
oneOf: [{ $ref: '#/components/schemas/GatePolicy' }, { type: 'null' }],
|
|
465
|
+
description: 'The policy that gates a promotion for the scope; null when none does.',
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
};
|
|
469
|
+
export const PromotionCheckSchema = {
|
|
470
|
+
type: 'object',
|
|
471
|
+
additionalProperties: false,
|
|
472
|
+
required: ['outcome', 'policy', 'checks'],
|
|
473
|
+
description: 'What the gate would say about a promotion. Nothing is recorded.',
|
|
474
|
+
properties: {
|
|
475
|
+
outcome: { type: 'string', enum: ['would-promote', 'needs-approval', 'gate-failed'] },
|
|
476
|
+
policy: {
|
|
477
|
+
oneOf: [{ $ref: '#/components/schemas/GatePolicyRef' }, { type: 'null' }],
|
|
478
|
+
description: 'The policy that applies; null when none does.',
|
|
479
|
+
},
|
|
480
|
+
checks: { type: 'array', items: { $ref: '#/components/schemas/GateCheck' } },
|
|
481
|
+
approval: { $ref: '#/components/schemas/GateApproval' },
|
|
482
|
+
},
|
|
483
|
+
};
|
|
484
|
+
export const PromoteBodySchema = {
|
|
485
|
+
type: 'object',
|
|
486
|
+
additionalProperties: false,
|
|
487
|
+
required: ['version', 'scope'],
|
|
488
|
+
properties: {
|
|
489
|
+
version: {
|
|
490
|
+
type: 'string',
|
|
491
|
+
description: 'The agent version to make live (registered, active).',
|
|
492
|
+
},
|
|
493
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
494
|
+
reason: { type: 'string', maxLength: 2000 },
|
|
495
|
+
evalRunId: { type: 'string', description: 'The comparison this promotion was judged on.' },
|
|
496
|
+
},
|
|
497
|
+
};
|
|
498
|
+
export const RollbackBodySchema = {
|
|
499
|
+
type: 'object',
|
|
500
|
+
additionalProperties: false,
|
|
501
|
+
required: ['scope'],
|
|
502
|
+
properties: {
|
|
503
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
504
|
+
toVersion: {
|
|
505
|
+
type: 'string',
|
|
506
|
+
description: "An earlier version to go back to; omit → the scope's previous live version.",
|
|
507
|
+
},
|
|
508
|
+
reason: { type: 'string', maxLength: 2000 },
|
|
509
|
+
},
|
|
510
|
+
};
|
|
511
|
+
export const UnpinBodySchema = {
|
|
512
|
+
type: 'object',
|
|
513
|
+
additionalProperties: false,
|
|
514
|
+
required: ['scope'],
|
|
515
|
+
properties: {
|
|
516
|
+
scope: { $ref: '#/components/schemas/LiveScope' },
|
|
517
|
+
reason: { type: 'string', maxLength: 2000 },
|
|
131
518
|
},
|
|
132
519
|
};
|
|
133
520
|
export const RunSchema = {
|
|
@@ -178,6 +565,11 @@ export const RunSchema = {
|
|
|
178
565
|
description: 'Set on a replay run: the eval run that started it.',
|
|
179
566
|
},
|
|
180
567
|
versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
|
|
568
|
+
segments: {
|
|
569
|
+
type: 'array',
|
|
570
|
+
items: { $ref: '#/components/schemas/ScopeSegment' },
|
|
571
|
+
description: "The segment path the run was started with (coarse to fine), which picks live agent versions. A child run has its parent's. Absent when there was none.",
|
|
572
|
+
},
|
|
181
573
|
publicAccessToken: {
|
|
182
574
|
type: 'string',
|
|
183
575
|
description: 'Only in the response to `POST /v1/runs`, when the deployment issues public run tokens: a read-only token for this run (and its descendants) to hand to a browser, for `GET /v1/runs/{runId}/progress` and its stream.',
|
|
@@ -228,12 +620,21 @@ export const StartRunBodySchema = {
|
|
|
228
620
|
required: ['agent', 'input'],
|
|
229
621
|
properties: {
|
|
230
622
|
agent: { type: 'string', description: 'AgentId.' },
|
|
231
|
-
agentVersion: {
|
|
623
|
+
agentVersion: {
|
|
624
|
+
type: 'string',
|
|
625
|
+
description: "Semver. Omit → the conversation's own version for a follow-up turn, else the version live for the run's scope, else the latest.",
|
|
626
|
+
},
|
|
232
627
|
projectId: {
|
|
233
628
|
type: 'string',
|
|
234
629
|
format: 'uuid',
|
|
235
630
|
description: "Project to run under; omit → the tenant's Default project.",
|
|
236
631
|
},
|
|
632
|
+
segments: {
|
|
633
|
+
type: 'array',
|
|
634
|
+
maxItems: 8,
|
|
635
|
+
items: { $ref: '#/components/schemas/ScopeSegment' },
|
|
636
|
+
description: "The run's segment path below its project, coarse to fine (an app-defined finer scope, e.g. company then role). A version live on a prefix of it serves the run.",
|
|
637
|
+
},
|
|
237
638
|
input: {
|
|
238
639
|
description: 'Opaque payload forwarded to the agent binding.',
|
|
239
640
|
},
|
|
@@ -252,6 +653,12 @@ export const StartRunBodySchema = {
|
|
|
252
653
|
format: 'uuid',
|
|
253
654
|
description: "Project to run under; omit → the tenant's Default project.",
|
|
254
655
|
},
|
|
656
|
+
segments: {
|
|
657
|
+
type: 'array',
|
|
658
|
+
maxItems: 8,
|
|
659
|
+
items: { $ref: '#/components/schemas/ScopeSegment' },
|
|
660
|
+
description: "The run's segment path below its project, coarse to fine (an app-defined finer scope, e.g. company then role). A version live on a prefix of it serves the run.",
|
|
661
|
+
},
|
|
255
662
|
input: {
|
|
256
663
|
description: 'Opaque payload forwarded to the flow runtime.',
|
|
257
664
|
},
|
|
@@ -719,6 +1126,27 @@ export const CompleteApprovalResultSchema = {
|
|
|
719
1126
|
type: 'boolean',
|
|
720
1127
|
description: 'True when the approval had a `waitTokenId` + terminal accept/reject and the run waitpoint was completed as part of this call.',
|
|
721
1128
|
},
|
|
1129
|
+
resume: {
|
|
1130
|
+
description: "How the run went on, when this call resumed it (the runtime resumes inline): `ok`, or `failed` with the run's error, e.g. `tool-version-unresolvable` when a tool version the turn started with is gone. The decision stands either way.",
|
|
1131
|
+
oneOf: [
|
|
1132
|
+
{
|
|
1133
|
+
type: 'object',
|
|
1134
|
+
additionalProperties: false,
|
|
1135
|
+
required: ['kind'],
|
|
1136
|
+
properties: { kind: { type: 'string', const: 'ok' } },
|
|
1137
|
+
},
|
|
1138
|
+
{
|
|
1139
|
+
type: 'object',
|
|
1140
|
+
additionalProperties: false,
|
|
1141
|
+
required: ['kind', 'code', 'message'],
|
|
1142
|
+
properties: {
|
|
1143
|
+
kind: { type: 'string', const: 'failed' },
|
|
1144
|
+
code: { type: 'string' },
|
|
1145
|
+
message: { type: 'string' },
|
|
1146
|
+
},
|
|
1147
|
+
},
|
|
1148
|
+
],
|
|
1149
|
+
},
|
|
722
1150
|
},
|
|
723
1151
|
};
|
|
724
1152
|
// ---------------- agents ----------------
|
|
@@ -1898,6 +2326,32 @@ export const JudgeClassScopeSchema = {
|
|
|
1898
2326
|
},
|
|
1899
2327
|
],
|
|
1900
2328
|
};
|
|
2329
|
+
export const JudgeClassAssertableBySchema = {
|
|
2330
|
+
type: 'object',
|
|
2331
|
+
additionalProperties: false,
|
|
2332
|
+
minProperties: 1,
|
|
2333
|
+
description: 'Who may assert the class: every part that is set must hold. A class with one is restricted: a judgment recorded while it is carries `restricted`, and a comparison weighted `restricted-only` counts only those.',
|
|
2334
|
+
properties: {
|
|
2335
|
+
minReviewerRole: {
|
|
2336
|
+
type: 'string',
|
|
2337
|
+
enum: ['standard', 'senior', 'admin'],
|
|
2338
|
+
description: "The caller's reviewer role is at least this (its token's, or the roster's).",
|
|
2339
|
+
},
|
|
2340
|
+
principalKinds: {
|
|
2341
|
+
type: 'array',
|
|
2342
|
+
minItems: 1,
|
|
2343
|
+
items: { type: 'string', enum: ['user', 'service'] },
|
|
2344
|
+
description: 'Users, service tokens, or both.',
|
|
2345
|
+
},
|
|
2346
|
+
principalIds: {
|
|
2347
|
+
type: 'array',
|
|
2348
|
+
minItems: 1,
|
|
2349
|
+
maxItems: 100,
|
|
2350
|
+
items: { type: 'string', minLength: 1 },
|
|
2351
|
+
description: 'Only these principals: user ids, or service token ids.',
|
|
2352
|
+
},
|
|
2353
|
+
},
|
|
2354
|
+
};
|
|
1901
2355
|
export const JudgeClassSchema = {
|
|
1902
2356
|
type: 'object',
|
|
1903
2357
|
additionalProperties: false,
|
|
@@ -1916,6 +2370,7 @@ export const JudgeClassSchema = {
|
|
|
1916
2370
|
description: 'How much a judgment of this class counts, relative to the others.',
|
|
1917
2371
|
},
|
|
1918
2372
|
description: { type: 'string' },
|
|
2373
|
+
assertableBy: { $ref: '#/components/schemas/JudgeClassAssertableBy' },
|
|
1919
2374
|
createdAt: { type: 'string', format: 'date-time' },
|
|
1920
2375
|
updatedAt: { type: 'string', format: 'date-time' },
|
|
1921
2376
|
unregisteredAt: {
|
|
@@ -1944,6 +2399,7 @@ export const CreateJudgeClassBodySchema = {
|
|
|
1944
2399
|
name: { type: 'string', minLength: 1, maxLength: 100 },
|
|
1945
2400
|
weight: { type: 'number', minimum: 0 },
|
|
1946
2401
|
description: { type: 'string' },
|
|
2402
|
+
assertableBy: { $ref: '#/components/schemas/JudgeClassAssertableBy' },
|
|
1947
2403
|
},
|
|
1948
2404
|
};
|
|
1949
2405
|
export const UpdateJudgeClassBodySchema = {
|
|
@@ -1953,6 +2409,10 @@ export const UpdateJudgeClassBodySchema = {
|
|
|
1953
2409
|
properties: {
|
|
1954
2410
|
weight: { type: 'number', minimum: 0 },
|
|
1955
2411
|
description: { type: 'string' },
|
|
2412
|
+
assertableBy: {
|
|
2413
|
+
oneOf: [{ $ref: '#/components/schemas/JudgeClassAssertableBy' }, { type: 'null' }],
|
|
2414
|
+
description: 'Who may assert the class; `null` lifts the restriction.',
|
|
2415
|
+
},
|
|
1956
2416
|
},
|
|
1957
2417
|
};
|
|
1958
2418
|
export const UnregisterJudgeClassResultSchema = {
|
|
@@ -2033,6 +2493,11 @@ export const JudgmentSchema = {
|
|
|
2033
2493
|
type: 'string',
|
|
2034
2494
|
description: 'The judge class the judgment is recorded under. Absent when unclassified (counts with weight 1).',
|
|
2035
2495
|
},
|
|
2496
|
+
restricted: {
|
|
2497
|
+
type: 'boolean',
|
|
2498
|
+
enum: [true],
|
|
2499
|
+
description: "Present (true) when the judge class was restricted (`assertableBy`) when the judgment was recorded, so the judge was checked against it. A restriction added or lifted later doesn't change it.",
|
|
2500
|
+
},
|
|
2036
2501
|
assertedBy: { $ref: '#/components/schemas/JudgmentAssertedBy' },
|
|
2037
2502
|
participantId: {
|
|
2038
2503
|
type: 'string',
|
|
@@ -2209,6 +2674,13 @@ export const JudgedItemSummarySchema = {
|
|
|
2209
2674
|
description: 'The weight behind "yes" (an unclassified judgment counts 1).',
|
|
2210
2675
|
},
|
|
2211
2676
|
totalWeight: { type: 'number', description: 'The weight behind all judgments of the item.' },
|
|
2677
|
+
restricted: {
|
|
2678
|
+
type: 'object',
|
|
2679
|
+
additionalProperties: false,
|
|
2680
|
+
required: ['yesWeight', 'totalWeight'],
|
|
2681
|
+
description: 'The same weights, counting only judgments recorded while their class was restricted (`Judgment.restricted`), for a comparison weighted `restricted-only`. Absent from a test set built before restrictions.',
|
|
2682
|
+
properties: { yesWeight: { type: 'number' }, totalWeight: { type: 'number' } },
|
|
2683
|
+
},
|
|
2212
2684
|
reasons: {
|
|
2213
2685
|
type: 'array',
|
|
2214
2686
|
description: 'The reasons given, newest first.',
|
|
@@ -3957,7 +4429,7 @@ export const PolicySchema = {
|
|
|
3957
4429
|
spec: {
|
|
3958
4430
|
type: 'object',
|
|
3959
4431
|
additionalProperties: true,
|
|
3960
|
-
description: "Kind-specific policy body. For `access-control`, matches `@kindgi/specs/policy.schema.json` (rules + defaults). For `model-routing`, matches `TenantPolicy` from `@kindgi/capabilities` (providers.allow / providers.deny / models.allow / models.deny / regionAllow / maxCostPerCallUsd / maxTokensPerCall). For `tool-errors`, `ToolErrorsSpec` (maxRetries / retryOn). For `hitl`, `HitlSpec` from `@kindgi/policy-contract` (maxTimeoutMs / minReviewerRole / tools — per tool id a mode or `{ mode, requiredRole }`); it only tightens an agent's approvals. `tool-errors` and `
|
|
4432
|
+
description: "Kind-specific policy body. For `access-control`, matches `@kindgi/specs/policy.schema.json` (rules + defaults). For `model-routing`, matches `TenantPolicy` from `@kindgi/capabilities` (providers.allow / providers.deny / models.allow / models.deny / regionAllow / maxCostPerCallUsd / maxTokensPerCall). For `tool-errors`, `ToolErrorsSpec` (maxRetries / retryOn). For `hitl`, `HitlSpec` from `@kindgi/policy-contract` (maxTimeoutMs / minReviewerRole / tools — per tool id a mode or `{ mode, requiredRole }`); it only tightens an agent's approvals. For `retention`, `{ v: 1, doc: RetentionSpec }` from `@kindgi/policy-contract` (domain / graceSeconds / mode, which must be `purge`); a tenant has one retention policy per domain, plus one for `*`. `tool-errors`, `hitl` and `retention` specs are validated on publish. For other kinds, the shape is defined by the runtime consumer.",
|
|
3961
4433
|
},
|
|
3962
4434
|
},
|
|
3963
4435
|
};
|
|
@@ -4053,6 +4525,167 @@ export const ReinstatePolicyVersionResultSchema = {
|
|
|
4053
4525
|
wasTombstoned: { type: 'boolean' },
|
|
4054
4526
|
},
|
|
4055
4527
|
};
|
|
4528
|
+
// ---------------- retention (admin plane) ----------------
|
|
4529
|
+
/** A tombstoning domain a retention policy can cover; `*` is the tenant-wide default. */
|
|
4530
|
+
export const RetentionDomainSchema = {
|
|
4531
|
+
type: 'string',
|
|
4532
|
+
enum: [...RETENTION_DOMAINS],
|
|
4533
|
+
};
|
|
4534
|
+
/**
|
|
4535
|
+
* A domain more than one retention policy covers. Publishing refuses a
|
|
4536
|
+
* second policy for a domain, so only policies stored before that rule
|
|
4537
|
+
* can do this.
|
|
4538
|
+
*/
|
|
4539
|
+
export const RetentionPolicyConflictSchema = {
|
|
4540
|
+
type: 'object',
|
|
4541
|
+
additionalProperties: false,
|
|
4542
|
+
required: ['domain', 'policyIds', 'appliedPolicyId'],
|
|
4543
|
+
properties: {
|
|
4544
|
+
domain: { $ref: '#/components/schemas/RetentionDomain' },
|
|
4545
|
+
policyIds: {
|
|
4546
|
+
type: 'array',
|
|
4547
|
+
items: { type: 'string' },
|
|
4548
|
+
minItems: 2,
|
|
4549
|
+
description: 'Every policy id that covers the domain, sorted.',
|
|
4550
|
+
},
|
|
4551
|
+
appliedPolicyId: {
|
|
4552
|
+
type: 'string',
|
|
4553
|
+
description: 'The one that applies: the policy whose latest version is highest, and on equal versions the lower policy id. Unregister the others.',
|
|
4554
|
+
},
|
|
4555
|
+
},
|
|
4556
|
+
};
|
|
4557
|
+
export const RetentionScheduledItemSchema = {
|
|
4558
|
+
type: 'object',
|
|
4559
|
+
additionalProperties: false,
|
|
4560
|
+
required: [
|
|
4561
|
+
'domain',
|
|
4562
|
+
'id',
|
|
4563
|
+
'unregisteredAt',
|
|
4564
|
+
'purgeAt',
|
|
4565
|
+
'pastGrace',
|
|
4566
|
+
'policyId',
|
|
4567
|
+
'policyVersion',
|
|
4568
|
+
'graceSeconds',
|
|
4569
|
+
],
|
|
4570
|
+
properties: {
|
|
4571
|
+
domain: { $ref: '#/components/schemas/RetentionDomain' },
|
|
4572
|
+
id: { type: 'string', description: "The tombstoned row's id in its domain." },
|
|
4573
|
+
unregisteredAt: { type: 'string', format: 'date-time' },
|
|
4574
|
+
purgeAt: {
|
|
4575
|
+
type: 'string',
|
|
4576
|
+
format: 'date-time',
|
|
4577
|
+
description: "`unregisteredAt` plus the policy's grace: when a sweep purges the row.",
|
|
4578
|
+
},
|
|
4579
|
+
pastGrace: {
|
|
4580
|
+
type: 'boolean',
|
|
4581
|
+
description: 'Whether a sweep would purge the row now.',
|
|
4582
|
+
},
|
|
4583
|
+
policyId: { type: 'string', description: 'The retention policy that applies.' },
|
|
4584
|
+
policyVersion: { type: 'string' },
|
|
4585
|
+
graceSeconds: {
|
|
4586
|
+
type: 'integer',
|
|
4587
|
+
description: "The policy's grace, in seconds (`-1`: a hold, never purged).",
|
|
4588
|
+
},
|
|
4589
|
+
},
|
|
4590
|
+
};
|
|
4591
|
+
export const RetentionScheduledPageSchema = {
|
|
4592
|
+
type: 'object',
|
|
4593
|
+
additionalProperties: false,
|
|
4594
|
+
required: ['data', 'domainsMissingAdapter', 'unpolicedDomains'],
|
|
4595
|
+
properties: {
|
|
4596
|
+
data: {
|
|
4597
|
+
type: 'array',
|
|
4598
|
+
items: { $ref: '#/components/schemas/RetentionScheduledItem' },
|
|
4599
|
+
},
|
|
4600
|
+
hasMore: {
|
|
4601
|
+
type: 'boolean',
|
|
4602
|
+
description: 'Some domain has more scheduled rows than this page returned (`limit` is per domain). Always sent from 0.1.4; a runtime before it sends none.',
|
|
4603
|
+
},
|
|
4604
|
+
nextCursor: {
|
|
4605
|
+
type: 'string',
|
|
4606
|
+
description: 'The `cursor` for the next page. Absent when `hasMore: false`, or when the runtime cannot continue a page.',
|
|
4607
|
+
},
|
|
4608
|
+
domainsMissingAdapter: {
|
|
4609
|
+
type: 'array',
|
|
4610
|
+
items: { $ref: '#/components/schemas/RetentionDomain' },
|
|
4611
|
+
description: "Domains a retention policy covers that this deployment can't purge (no adapter is wired).",
|
|
4612
|
+
},
|
|
4613
|
+
unpolicedDomains: {
|
|
4614
|
+
type: 'array',
|
|
4615
|
+
items: { $ref: '#/components/schemas/RetentionDomain' },
|
|
4616
|
+
description: 'Domains no retention policy covers: their tombstones are kept.',
|
|
4617
|
+
},
|
|
4618
|
+
conflicts: {
|
|
4619
|
+
type: 'array',
|
|
4620
|
+
items: { $ref: '#/components/schemas/RetentionPolicyConflict' },
|
|
4621
|
+
description: 'Domains more than one retention policy covers. Absent or empty: none.',
|
|
4622
|
+
},
|
|
4623
|
+
},
|
|
4624
|
+
};
|
|
4625
|
+
export const RetentionSweepBodySchema = {
|
|
4626
|
+
type: 'object',
|
|
4627
|
+
additionalProperties: false,
|
|
4628
|
+
properties: {
|
|
4629
|
+
domain: {
|
|
4630
|
+
$ref: '#/components/schemas/RetentionDomain',
|
|
4631
|
+
description: 'Sweep only this domain. Absent: every domain.',
|
|
4632
|
+
},
|
|
4633
|
+
maxPerDomain: {
|
|
4634
|
+
type: 'integer',
|
|
4635
|
+
minimum: 1,
|
|
4636
|
+
maximum: 10000,
|
|
4637
|
+
description: 'The most rows one call purges per domain (default 500); the rest are `remaining`.',
|
|
4638
|
+
},
|
|
4639
|
+
},
|
|
4640
|
+
};
|
|
4641
|
+
export const RetentionSweepDomainBodySchema = {
|
|
4642
|
+
type: 'object',
|
|
4643
|
+
additionalProperties: false,
|
|
4644
|
+
properties: {
|
|
4645
|
+
maxPerDomain: {
|
|
4646
|
+
type: 'integer',
|
|
4647
|
+
minimum: 1,
|
|
4648
|
+
maximum: 10000,
|
|
4649
|
+
description: 'The most rows this call purges (default 500); the rest are `remaining`.',
|
|
4650
|
+
},
|
|
4651
|
+
},
|
|
4652
|
+
};
|
|
4653
|
+
export const RetentionSweepResultSchema = {
|
|
4654
|
+
type: 'object',
|
|
4655
|
+
additionalProperties: false,
|
|
4656
|
+
required: ['perDomain', 'totalPurged'],
|
|
4657
|
+
properties: {
|
|
4658
|
+
perDomain: {
|
|
4659
|
+
type: 'array',
|
|
4660
|
+
items: {
|
|
4661
|
+
type: 'object',
|
|
4662
|
+
additionalProperties: false,
|
|
4663
|
+
required: ['domain', 'purged', 'remaining'],
|
|
4664
|
+
properties: {
|
|
4665
|
+
domain: { $ref: '#/components/schemas/RetentionDomain' },
|
|
4666
|
+
purged: { type: 'integer', minimum: 0 },
|
|
4667
|
+
remaining: {
|
|
4668
|
+
type: 'integer',
|
|
4669
|
+
minimum: 0,
|
|
4670
|
+
description: 'Rows past grace this call left (the `maxPerDomain` cap); sweep again.',
|
|
4671
|
+
},
|
|
4672
|
+
policyId: { type: 'string', description: 'The retention policy that applied.' },
|
|
4673
|
+
missingAdapter: {
|
|
4674
|
+
type: 'boolean',
|
|
4675
|
+
const: true,
|
|
4676
|
+
description: "Present when this deployment can't purge the domain (no adapter).",
|
|
4677
|
+
},
|
|
4678
|
+
},
|
|
4679
|
+
},
|
|
4680
|
+
},
|
|
4681
|
+
totalPurged: { type: 'integer', minimum: 0 },
|
|
4682
|
+
conflicts: {
|
|
4683
|
+
type: 'array',
|
|
4684
|
+
items: { $ref: '#/components/schemas/RetentionPolicyConflict' },
|
|
4685
|
+
description: 'Domains more than one retention policy covers. Absent or empty: none.',
|
|
4686
|
+
},
|
|
4687
|
+
},
|
|
4688
|
+
};
|
|
4056
4689
|
// ---------------- eval suites (admin plane) ----------------
|
|
4057
4690
|
/**
|
|
4058
4691
|
* Closed set of eval kinds the framework knows about. Extended
|
|
@@ -4298,7 +4931,7 @@ export const EvalRunFlowRefSchema = {
|
|
|
4298
4931
|
},
|
|
4299
4932
|
};
|
|
4300
4933
|
export const EvalBaselineSchema = {
|
|
4301
|
-
description: "What a comparison compares the candidate against: `'recorded'` (each case's recorded output, what was judged), a version (`{ agentId, version }`, replayed under the same rules), or the version live in a scope (`{ live: { projectId?, segments? } }`). Only `'recorded'` runs today; the others are refused when the run starts.",
|
|
4934
|
+
description: "What a comparison compares the candidate against: `'recorded'` (each case's recorded output, what was judged), a version (`{ agentId, version }`, replayed under the same rules), or the version live in a scope (`{ live: { projectId?, segments? } }`, `segments` a path in the project, coarse to fine). Only `'recorded'` runs today; the others are refused when the run starts.",
|
|
4302
4935
|
oneOf: [
|
|
4303
4936
|
{ type: 'string', enum: ['recorded'] },
|
|
4304
4937
|
{
|
|
@@ -4317,7 +4950,12 @@ export const EvalBaselineSchema = {
|
|
|
4317
4950
|
additionalProperties: false,
|
|
4318
4951
|
properties: {
|
|
4319
4952
|
projectId: { type: 'string' },
|
|
4320
|
-
segments: {
|
|
4953
|
+
segments: {
|
|
4954
|
+
type: 'array',
|
|
4955
|
+
items: { $ref: '#/components/schemas/ScopeSegment' },
|
|
4956
|
+
maxItems: 8,
|
|
4957
|
+
description: 'A segment path in `projectId`, coarse to fine, as live versions resolve it. Needs `projectId`.',
|
|
4958
|
+
},
|
|
4321
4959
|
},
|
|
4322
4960
|
},
|
|
4323
4961
|
},
|
|
@@ -4339,6 +4977,11 @@ export const EvalComparisonSchema = {
|
|
|
4339
4977
|
repetitions: { type: 'integer', minimum: 1, maximum: 10 },
|
|
4340
4978
|
k: { type: 'integer', minimum: 1, maximum: 100 },
|
|
4341
4979
|
versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
|
|
4980
|
+
classWeights: {
|
|
4981
|
+
type: 'string',
|
|
4982
|
+
enum: ['as-recorded', 'restricted-only'],
|
|
4983
|
+
description: "Which judgments count: each at its class's weight (`as-recorded`, the default), or only those recorded while their class was restricted (`Judgment.restricted`), the others weighing 0 (`restricted-only`).",
|
|
4984
|
+
},
|
|
4342
4985
|
},
|
|
4343
4986
|
};
|
|
4344
4987
|
// ---------------- comparison results (a `judged` eval run's `result`) ----------------
|
|
@@ -4388,6 +5031,10 @@ export const ComparisonCandidateSchema = {
|
|
|
4388
5031
|
kind: { type: 'string', enum: ['agent'] },
|
|
4389
5032
|
agentId: { type: 'string' },
|
|
4390
5033
|
version: { type: 'string' },
|
|
5034
|
+
pinsDigest: {
|
|
5035
|
+
type: 'string',
|
|
5036
|
+
description: "The version's pinsDigest: what it ran, as a promotion gate checks. Absent for a version published before pins, and from a comparison recorded before it.",
|
|
5037
|
+
},
|
|
4391
5038
|
},
|
|
4392
5039
|
},
|
|
4393
5040
|
{
|
|
@@ -4499,6 +5146,11 @@ export const JudgedComparisonSummarySchema = {
|
|
|
4499
5146
|
description: "Flow cases that stopped at a write the replay refused: no output to score, so they're left out of the metrics.",
|
|
4500
5147
|
},
|
|
4501
5148
|
reads: { type: 'string', enum: ['recorded', 'live'] },
|
|
5149
|
+
classWeights: {
|
|
5150
|
+
type: 'string',
|
|
5151
|
+
enum: ['as-recorded', 'restricted-only'],
|
|
5152
|
+
description: 'Which judgments counted. Absent from a comparison recorded before restricted classes: `as-recorded`.',
|
|
5153
|
+
},
|
|
4502
5154
|
sampling: {
|
|
4503
5155
|
type: 'object',
|
|
4504
5156
|
additionalProperties: false,
|
|
@@ -4719,6 +5371,11 @@ export const StartEvalRunBodySchema = {
|
|
|
4719
5371
|
repetitions: { type: 'integer', minimum: 1, maximum: 10 },
|
|
4720
5372
|
k: { type: 'integer', minimum: 1, maximum: 100 },
|
|
4721
5373
|
versions: { $ref: '#/components/schemas/FlowVersionOverrides' },
|
|
5374
|
+
classWeights: {
|
|
5375
|
+
type: 'string',
|
|
5376
|
+
enum: ['as-recorded', 'restricted-only'],
|
|
5377
|
+
description: "Which judgments count: each at its class's weight (`as-recorded`, the default), or only those recorded while their class was restricted (`Judgment.restricted`), the others weighing 0 (`restricted-only`).",
|
|
5378
|
+
},
|
|
4722
5379
|
},
|
|
4723
5380
|
description: "Exactly one of `agentRef` or `flowRef` MUST be supplied. `dryRun: true` returns a plan preview without invoking the subject. For a `judged` suite (a test set), the run is a comparison: `agentRef` or `flowRef` with its `version` is the candidate, replayed on each case without doing anything the past run didn't (a flow stops at a write the replay refuses); `baseline` (default `'recorded'`), `reads` (default `recorded`), `repetitions` (default 1) and `k` (default 10) set how. With `flowRef`, `versions` runs the flow with some of its agents or tools at other versions; an id the flow doesn't use, or a version that isn't published, is refused (`400 validation-failed`, each under `details.issues`).",
|
|
4724
5381
|
};
|
|
@@ -4799,6 +5456,10 @@ export const IdentityProviderCollectionPageSchema = {
|
|
|
4799
5456
|
required: ['data'],
|
|
4800
5457
|
properties: {
|
|
4801
5458
|
data: { type: 'array', items: { $ref: '#/components/schemas/IdentityProviderConfig' } },
|
|
5459
|
+
hasMore: {
|
|
5460
|
+
type: 'boolean',
|
|
5461
|
+
description: 'Always `false`: the list comes whole. Absent from older servers.',
|
|
5462
|
+
},
|
|
4802
5463
|
},
|
|
4803
5464
|
};
|
|
4804
5465
|
export const RegisterIdentityProviderResultSchema = {
|
|
@@ -6054,6 +6715,10 @@ export const EnvCollectionPageSchema = {
|
|
|
6054
6715
|
required: ['data'],
|
|
6055
6716
|
properties: {
|
|
6056
6717
|
data: { type: 'array', items: { $ref: '#/components/schemas/EnvRecord' } },
|
|
6718
|
+
hasMore: {
|
|
6719
|
+
type: 'boolean',
|
|
6720
|
+
description: "Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.",
|
|
6721
|
+
},
|
|
6057
6722
|
nextCursor: { type: 'string' },
|
|
6058
6723
|
},
|
|
6059
6724
|
};
|
|
@@ -6088,6 +6753,10 @@ export const SecretCollectionPageSchema = {
|
|
|
6088
6753
|
required: ['data'],
|
|
6089
6754
|
properties: {
|
|
6090
6755
|
data: { type: 'array', items: { $ref: '#/components/schemas/SecretRecord' } },
|
|
6756
|
+
hasMore: {
|
|
6757
|
+
type: 'boolean',
|
|
6758
|
+
description: "Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.",
|
|
6759
|
+
},
|
|
6091
6760
|
nextCursor: { type: 'string' },
|
|
6092
6761
|
},
|
|
6093
6762
|
};
|
|
@@ -6097,6 +6766,10 @@ export const SecretVersionCollectionPageSchema = {
|
|
|
6097
6766
|
required: ['data'],
|
|
6098
6767
|
properties: {
|
|
6099
6768
|
data: { type: 'array', items: { $ref: '#/components/schemas/SecretVersionRecord' } },
|
|
6769
|
+
hasMore: {
|
|
6770
|
+
type: 'boolean',
|
|
6771
|
+
description: "Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.",
|
|
6772
|
+
},
|
|
6100
6773
|
nextCursor: { type: 'string' },
|
|
6101
6774
|
},
|
|
6102
6775
|
};
|
|
@@ -6796,6 +7469,29 @@ export const COMPONENT_SCHEMAS = [
|
|
|
6796
7469
|
['HealthResult', HealthResultSchema],
|
|
6797
7470
|
['RunStatus', RunStatusSchema],
|
|
6798
7471
|
['RunAgent', RunAgentSchema],
|
|
7472
|
+
['ScopeSegment', ScopeSegmentSchema],
|
|
7473
|
+
['LiveScopeTenant', LiveScopeTenantSchema],
|
|
7474
|
+
['LiveScopeOrg', LiveScopeOrgSchema],
|
|
7475
|
+
['LiveScopeProject', LiveScopeProjectSchema],
|
|
7476
|
+
['LiveScopeSegment', LiveScopeSegmentSchema],
|
|
7477
|
+
['LiveScope', LiveScopeSchema],
|
|
7478
|
+
['LiveVersionResolution', LiveVersionResolutionSchema],
|
|
7479
|
+
['LivePin', LivePinSchema],
|
|
7480
|
+
['LivePinList', LivePinListSchema],
|
|
7481
|
+
['Promotion', PromotionSchema],
|
|
7482
|
+
['PromotionPage', PromotionPageSchema],
|
|
7483
|
+
['GateCheck', GateCheckSchema],
|
|
7484
|
+
['GatePolicyRef', GatePolicyRefSchema],
|
|
7485
|
+
['GateApproval', GateApprovalSchema],
|
|
7486
|
+
['GatePolicySpec', GatePolicySpecSchema],
|
|
7487
|
+
['GatePolicy', GatePolicySchema],
|
|
7488
|
+
['GatePolicyPage', GatePolicyPageSchema],
|
|
7489
|
+
['PublishGatePolicyBody', PublishGatePolicyBodySchema],
|
|
7490
|
+
['GatePolicyResolution', GatePolicyResolutionSchema],
|
|
7491
|
+
['PromotionCheck', PromotionCheckSchema],
|
|
7492
|
+
['PromoteBody', PromoteBodySchema],
|
|
7493
|
+
['RollbackBody', RollbackBodySchema],
|
|
7494
|
+
['UnpinBody', UnpinBodySchema],
|
|
6799
7495
|
['Run', RunSchema],
|
|
6800
7496
|
['StartRunOptions', StartRunOptionsSchema],
|
|
6801
7497
|
['StartRunBody', StartRunBodySchema],
|
|
@@ -6854,6 +7550,7 @@ export const COMPONENT_SCHEMAS = [
|
|
|
6854
7550
|
['CreateJudgmentBody', CreateJudgmentBodySchema],
|
|
6855
7551
|
['UnregisterJudgmentResult', UnregisterJudgmentResultSchema],
|
|
6856
7552
|
['JudgedItemSummary', JudgedItemSummarySchema],
|
|
7553
|
+
['JudgeClassAssertableBy', JudgeClassAssertableBySchema],
|
|
6857
7554
|
['JudgedEvalCase', JudgedEvalCaseSchema],
|
|
6858
7555
|
['JudgedEvalCaseCollectionPage', JudgedEvalCaseCollectionPageSchema],
|
|
6859
7556
|
['BuildJudgedSuiteBody', BuildJudgedSuiteBodySchema],
|
|
@@ -7018,6 +7715,13 @@ export const COMPONENT_SCHEMAS = [
|
|
|
7018
7715
|
['PublishPolicyResult', PublishPolicyResultSchema],
|
|
7019
7716
|
['UnregisterPolicyResult', UnregisterPolicyResultSchema],
|
|
7020
7717
|
['ReinstatePolicyVersionResult', ReinstatePolicyVersionResultSchema],
|
|
7718
|
+
['RetentionDomain', RetentionDomainSchema],
|
|
7719
|
+
['RetentionPolicyConflict', RetentionPolicyConflictSchema],
|
|
7720
|
+
['RetentionScheduledItem', RetentionScheduledItemSchema],
|
|
7721
|
+
['RetentionScheduledPage', RetentionScheduledPageSchema],
|
|
7722
|
+
['RetentionSweepBody', RetentionSweepBodySchema],
|
|
7723
|
+
['RetentionSweepDomainBody', RetentionSweepDomainBodySchema],
|
|
7724
|
+
['RetentionSweepResult', RetentionSweepResultSchema],
|
|
7021
7725
|
['EvalKind', EvalKindSchema],
|
|
7022
7726
|
['EvalSuite', EvalSuiteSchema],
|
|
7023
7727
|
['EvalSuiteCollectionPage', EvalSuiteCollectionPageSchema],
|