@kindgi/client 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/index.d.cts CHANGED
@@ -243,6 +243,20 @@ export interface VersionDerivation {
243
243
  /** For an edit: who made it (`user:<id>`, or the token for a key). */
244
244
  readonly by?: string;
245
245
  }
246
+ /**
247
+ * What every list call answers: the wire's page — `data`, `hasMore` and
248
+ * `nextCursor` — as the API and the Python client have it. `items` is the
249
+ * same list under the name the client used first: readable, but not an
250
+ * own enumerable property, so a page serializes with its list once.
251
+ */
252
+ export interface ListPage<T> extends Page<T> {
253
+ readonly data: readonly T[];
254
+ /** Whether there's another page (`nextCursor` names it). */
255
+ readonly hasMore: boolean;
256
+ readonly nextCursor?: Cursor;
257
+ /** @deprecated Use `data`; removed in 0.2. */
258
+ readonly items: readonly T[];
259
+ }
246
260
  /** Terminal states are `completed`, `failed`, `cancelled`. */
247
261
  export type RunStatus = "pending" | "running" | "suspended" | "completed" | "failed" | "cancelled";
248
262
  /**
@@ -1176,7 +1190,7 @@ export interface SourceRefresh {
1176
1190
  * configured once per type in the memory implementation. There is no
1177
1191
  * per-fact retrieval hint.
1178
1192
  */
1179
- export interface Fact<TContent = unknown> {
1193
+ interface Fact<TContent = unknown> {
1180
1194
  readonly id: FactId;
1181
1195
  /**
1182
1196
  * Fact type identifier. Packs define their own; a few general-purpose
@@ -1226,7 +1240,7 @@ declare const REVIEWER_ROLES: readonly [
1226
1240
  "senior",
1227
1241
  "admin"
1228
1242
  ];
1229
- export type ReviewerRole = (typeof REVIEWER_ROLES)[number];
1243
+ type ReviewerRole = (typeof REVIEWER_ROLES)[number];
1230
1244
  /** A tool's gate, and the reviewer role its approvals need. */
1231
1245
  export interface ToolHitlRule {
1232
1246
  readonly mode: ToolHitlMode;
@@ -1268,8 +1282,8 @@ type AgentId$1 = Brand<string, "AgentId">;
1268
1282
  * - `system` — a system-authored instruction (rare; e.g. HITL
1269
1283
  * intervention, out-of-band context injection).
1270
1284
  */
1271
- export type MessageRole = "user" | "agent" | "tool" | "system";
1272
- export interface ConversationMessage {
1285
+ type MessageRole = "user" | "agent" | "tool" | "system";
1286
+ interface ConversationMessage {
1273
1287
  /**
1274
1288
  * Monotonic index within the conversation. Assigned by the writer.
1275
1289
  * Combined with `conversationId` this gives a stable ordering
@@ -1880,7 +1894,7 @@ export interface CheckResult {
1880
1894
  readonly attributes?: Readonly<Record<string, unknown>>;
1881
1895
  }
1882
1896
  /** Result of evaluating a guardrail against a trace, including action to take. */
1883
- export interface EvaluationResult {
1897
+ interface EvaluationResult {
1884
1898
  readonly guardrailId: GuardrailId;
1885
1899
  readonly result: CheckResult;
1886
1900
  /** The action the caller should apply — pre-computed from `guardrail.action`. */
@@ -3390,6 +3404,74 @@ export interface Policy {
3390
3404
  export type PolicyKind = "access-control" | "model-routing" | "adapter-allowlist" | "rate-limit" | "retention" | "compliance" | "tool-errors" | "hitl";
3391
3405
  /** @deprecated The wire has no policy status; policies are selected by `kind`. */
3392
3406
  export type PolicyStatus = "draft" | "active" | "archived";
3407
+ /**
3408
+ * A tombstoning domain a `retention` policy can cover; `*` is the
3409
+ * tenant-wide default. Wire enum — matches
3410
+ * `@kindgi/api/openapi.json#RetentionDomain`.
3411
+ */
3412
+ export type RetentionDomain = "org" | "agent" | "flow" | "tool" | "eval_suite" | "guardrail" | "mcp_endpoint" | "env" | "secret" | "run" | "policy" | "judgment" | "judge_class" | "provider" | "*";
3413
+ /**
3414
+ * One tombstoned row and when a sweep purges it. Matches
3415
+ * `@kindgi/api/openapi.json#RetentionScheduledItem`.
3416
+ */
3417
+ export interface RetentionScheduledItem {
3418
+ readonly domain: RetentionDomain;
3419
+ /** The row's id in its domain. */
3420
+ readonly id: string;
3421
+ readonly unregisteredAt: string;
3422
+ /** `unregisteredAt` plus the policy's grace. */
3423
+ readonly purgeAt: string;
3424
+ /** Whether a sweep would purge it now. */
3425
+ readonly pastGrace: boolean;
3426
+ /** The retention policy that applies. */
3427
+ readonly policyId: string;
3428
+ readonly policyVersion: string;
3429
+ /** `-1`: a hold, never purged. */
3430
+ readonly graceSeconds: number;
3431
+ }
3432
+ /**
3433
+ * A domain more than one retention policy covers. Publishing refuses a
3434
+ * second policy for a domain (`409 policy-scope-taken`), so only
3435
+ * policies stored before that rule can do this. Matches
3436
+ * `@kindgi/api/openapi.json#RetentionPolicyConflict`.
3437
+ */
3438
+ export interface RetentionPolicyConflict {
3439
+ readonly domain: RetentionDomain;
3440
+ /** Every policy id that covers the domain, sorted. */
3441
+ readonly policyIds: readonly string[];
3442
+ /**
3443
+ * The one that applies: the policy whose latest version is highest,
3444
+ * and on equal versions the lower policy id. Unregister the others.
3445
+ */
3446
+ readonly appliedPolicyId: string;
3447
+ }
3448
+ /** Matches `@kindgi/api/openapi.json#RetentionScheduledPage`. */
3449
+ export interface RetentionScheduledPage {
3450
+ readonly data: readonly RetentionScheduledItem[];
3451
+ /** Some domain has more scheduled rows than this page returned (`limit` is per domain). */
3452
+ readonly hasMore: boolean;
3453
+ /** Pass as `cursor` for the next page. Absent when `hasMore` is false, or the runtime can't continue. */
3454
+ readonly nextCursor?: string;
3455
+ /** Covered domains this deployment can't purge (no adapter). */
3456
+ readonly domainsMissingAdapter: readonly RetentionDomain[];
3457
+ /** Domains no retention policy covers: their tombstones are kept. */
3458
+ readonly unpolicedDomains: readonly RetentionDomain[];
3459
+ readonly conflicts?: readonly RetentionPolicyConflict[];
3460
+ }
3461
+ /** Matches `@kindgi/api/openapi.json#RetentionSweepResult`. */
3462
+ export interface RetentionSweepResult {
3463
+ readonly perDomain: readonly {
3464
+ readonly domain: RetentionDomain;
3465
+ readonly purged: number;
3466
+ /** Rows past grace this call left (the `maxPerDomain` cap); sweep again. */
3467
+ readonly remaining: number;
3468
+ readonly policyId?: string;
3469
+ /** This deployment can't purge the domain (no adapter). */
3470
+ readonly missingAdapter?: true;
3471
+ }[];
3472
+ readonly totalPurged: number;
3473
+ readonly conflicts?: readonly RetentionPolicyConflict[];
3474
+ }
3393
3475
  /**
3394
3476
  * Wire body for `POST /v1/policies` per
3395
3477
  * `@kindgi/api/openapi.json#PublishPolicyBody`: `{ kind, description,
@@ -3932,6 +4014,18 @@ export type JudgeClassScope = {
3932
4014
  readonly projectId: string;
3933
4015
  readonly agentId: string;
3934
4016
  };
4017
+ /**
4018
+ * Who may assert a judge class. Each field narrows it; a caller must meet
4019
+ * all that are set. Matches `@kindgi/api/openapi.json#JudgeClassAssertableBy`.
4020
+ */
4021
+ export interface JudgeClassAssertableBy {
4022
+ /** The lowest reviewer role that may assert it: `standard`, `senior` or `admin`. */
4023
+ readonly minReviewerRole?: "standard" | "senior" | "admin";
4024
+ /** People (`user`), service tokens (`service`), or both. */
4025
+ readonly principalKinds?: readonly ("user" | "service")[];
4026
+ /** Only these user or token ids. */
4027
+ readonly principalIds?: readonly string[];
4028
+ }
3935
4029
  /** Matches `@kindgi/api/openapi.json#JudgeClass`. */
3936
4030
  export interface JudgeClass {
3937
4031
  readonly id: string;
@@ -3942,6 +4036,8 @@ export interface JudgeClass {
3942
4036
  /** How much a judgment of this class counts, relative to the others (≥ 0). */
3943
4037
  readonly weight: number;
3944
4038
  readonly description?: string;
4039
+ /** Who may assert it; absent: anyone who may judge the run. */
4040
+ readonly assertableBy?: JudgeClassAssertableBy;
3945
4041
  readonly createdAt: Timestamp;
3946
4042
  readonly updatedAt: Timestamp;
3947
4043
  /** Set when the class was retired. */
@@ -3953,11 +4049,14 @@ export interface CreateJudgeClassInput {
3953
4049
  readonly name: string;
3954
4050
  readonly weight: number;
3955
4051
  readonly description?: string;
4052
+ readonly assertableBy?: JudgeClassAssertableBy;
3956
4053
  }
3957
4054
  /** Input for `PATCH /v1/judge-classes/{judgeClassId}` per `#UpdateJudgeClassBody`. */
3958
4055
  export interface UpdateJudgeClassInput {
3959
4056
  readonly weight?: number;
3960
4057
  readonly description?: string;
4058
+ /** A new restriction; `null` lifts it. */
4059
+ readonly assertableBy?: JudgeClassAssertableBy | null;
3961
4060
  }
3962
4061
  /** What a judged run ran: an agent at a version, or a flow at a version. */
3963
4062
  export interface JudgedSubject {
@@ -3991,6 +4090,11 @@ export interface Judgment {
3991
4090
  readonly reason?: string;
3992
4091
  /** Absent when the judgment is unclassified (it counts with weight 1). */
3993
4092
  readonly judgeClassId?: string;
4093
+ /**
4094
+ * `true` when the class was restricted (`assertableBy`) when the judgment
4095
+ * was recorded, so the judge was checked against it.
4096
+ */
4097
+ readonly restricted?: true;
3994
4098
  readonly assertedBy: JudgmentAssertedBy;
3995
4099
  /** An app's opaque id for its end user who judged, when it judged on their behalf. */
3996
4100
  readonly participantId?: string;
@@ -4063,14 +4167,16 @@ export interface Transport {
4063
4167
  */
4064
4168
  authHeaders(): Readonly<Record<string, string>>;
4065
4169
  }
4170
+ /** One query parameter's value: an array repeats the key (`segment=a&segment=b`). */
4171
+ export type QueryValue = string | number | boolean | readonly string[] | undefined;
4066
4172
  export interface TransportRequest {
4067
4173
  readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
4068
4174
  /** Path beginning with `/` (e.g. `/v1/agents`). Combined with `apiUrl`. */
4069
4175
  readonly path: string;
4070
4176
  /** JSON body (serialized here). Omitted for `GET`/`DELETE` without body. */
4071
4177
  readonly body?: unknown;
4072
- /** Query parameters. `undefined` values are dropped. */
4073
- readonly query?: Readonly<Record<string, string | number | boolean | undefined>>;
4178
+ /** Query parameters. `undefined` values are dropped; an array repeats its key, in order. */
4179
+ readonly query?: Readonly<Record<string, QueryValue>>;
4074
4180
  /** Extra headers merged after `Authorization` + `Content-Type`. */
4075
4181
  readonly headers?: Readonly<Record<string, string>>;
4076
4182
  /** Overrides the client-level timeout. */
@@ -4125,7 +4231,7 @@ export interface AdaptersClient {
4125
4231
  * @wire `GET /v1/adapters` — see
4126
4232
  * `@kindgi/api/openapi.json#/paths/~1v1~1adapters/get`.
4127
4233
  */
4128
- list(filter?: AdapterFilter): Promise<Page<Adapter>>;
4234
+ list(filter?: AdapterFilter): Promise<ListPage<Adapter>>;
4129
4235
  /**
4130
4236
  * Fetch a single wired adapter.
4131
4237
  *
@@ -4224,6 +4330,45 @@ declare namespace Schemas {
4224
4330
  export type HealthResult = {
4225
4331
  ok: true;
4226
4332
  };
4333
+ /**
4334
+ * The agent's default for the whole tenant.
4335
+ */
4336
+ export type LiveScopeTenant = {
4337
+ kind: "tenant";
4338
+ };
4339
+ /**
4340
+ * An org's projects.
4341
+ */
4342
+ export type LiveScopeOrg = {
4343
+ kind: "org";
4344
+ orgId: string;
4345
+ };
4346
+ /**
4347
+ * One project.
4348
+ */
4349
+ export type LiveScopeProject = {
4350
+ kind: "project";
4351
+ projectId: string;
4352
+ };
4353
+ export type ScopeSegment = {
4354
+ /**
4355
+ * Lowercase, like an identifier: `company`, `contact-role`.
4356
+ */
4357
+ key: string;
4358
+ value: string;
4359
+ };
4360
+ /**
4361
+ * A segment path within a project: it covers every run whose path starts with it.
4362
+ */
4363
+ export type LiveScopeSegment = {
4364
+ kind: "segment";
4365
+ projectId: string;
4366
+ path: Array<ScopeSegment>;
4367
+ };
4368
+ /**
4369
+ * 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.
4370
+ */
4371
+ export type LiveScope = LiveScopeTenant | LiveScopeOrg | LiveScopeProject | LiveScopeSegment;
4227
4372
  /**
4228
4373
  * Set on an agent's turn (an agent run, or the turn a flow's agent step started): the agent, the version that ran and the conversation. Absent on other runs, and on turns that ran before Kindgi 0.1.3.
4229
4374
  */
@@ -4237,6 +4382,241 @@ declare namespace Schemas {
4237
4382
  */
4238
4383
  version: string;
4239
4384
  conversationId: string;
4385
+ /**
4386
+ * 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.
4387
+ */
4388
+ via?: "explicit" | "flow-pin" | "conversation" | "live" | "latest";
4389
+ liveScope?: LiveScope;
4390
+ };
4391
+ export type LiveVersionResolution = {
4392
+ agentId: string;
4393
+ /**
4394
+ * The version a run would use (semver).
4395
+ */
4396
+ version: string;
4397
+ /**
4398
+ * A live pin chose it, or nothing is live on the way up and it is the latest.
4399
+ */
4400
+ via: "live" | "latest";
4401
+ liveScope?: LiveScope;
4402
+ };
4403
+ export type LivePin = {
4404
+ agentId: string;
4405
+ scope: LiveScope;
4406
+ version: string;
4407
+ /**
4408
+ * The promotion that set it.
4409
+ */
4410
+ promotionId: string;
4411
+ setAt: string;
4412
+ };
4413
+ export type LivePinList = {
4414
+ data: Array<LivePin>;
4415
+ };
4416
+ export type GatePolicyRef = {
4417
+ id: string;
4418
+ version: string;
4419
+ };
4420
+ /**
4421
+ * One of a gate's checks, as the promotion records it.
4422
+ */
4423
+ export type GateCheck = {
4424
+ /**
4425
+ * 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`.
4426
+ */
4427
+ name: string;
4428
+ passed: boolean;
4429
+ /**
4430
+ * A plain sentence: what was found against what the policy asks.
4431
+ */
4432
+ message: string;
4433
+ value?: number | string;
4434
+ threshold?: number | string;
4435
+ };
4436
+ /**
4437
+ * One change of a scope's live version, kept for good: what was live before, what is after, who asked and why.
4438
+ */
4439
+ export type Promotion = {
4440
+ id: string;
4441
+ agentId: string;
4442
+ scope: LiveScope;
4443
+ action: "promote" | "rollback" | "unpin";
4444
+ /**
4445
+ * The scope's own pin before; null when it had none.
4446
+ */
4447
+ fromVersion: string | null;
4448
+ /**
4449
+ * The scope's own pin after; null after an unpin.
4450
+ */
4451
+ toVersion: string | null;
4452
+ requestedBy: {
4453
+ kind: "user" | "service";
4454
+ id: string;
4455
+ };
4456
+ reason?: string;
4457
+ /**
4458
+ * The comparison the change was judged on.
4459
+ */
4460
+ evalRunId?: string;
4461
+ createdAt: string;
4462
+ /**
4463
+ * 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`).
4464
+ */
4465
+ status?: "promoted" | "pending-approval" | "refused" | "superseded" | "rejected" | "expired";
4466
+ /**
4467
+ * The gate policy that applied; null when none did. Absent before gates.
4468
+ */
4469
+ policy?: GatePolicyRef | null;
4470
+ checks?: Array<GateCheck>;
4471
+ /**
4472
+ * The approval a `pending-approval` promotion waits on (kept once decided).
4473
+ */
4474
+ approvalId?: string;
4475
+ /**
4476
+ * When a `pending-approval` promotion reached its final state.
4477
+ */
4478
+ resolvedAt?: string;
4479
+ };
4480
+ export type PromotionPage = {
4481
+ data: Array<Promotion>;
4482
+ hasMore: boolean;
4483
+ nextCursor?: string;
4484
+ };
4485
+ /**
4486
+ * The approval a passing promotion waits for.
4487
+ */
4488
+ export type GateApproval = {
4489
+ role: "standard" | "senior" | "admin";
4490
+ count: number;
4491
+ /**
4492
+ * Whoever asked for the promotion may not approve it.
4493
+ */
4494
+ separateApprover: boolean;
4495
+ };
4496
+ /**
4497
+ * 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.
4498
+ */
4499
+ export type GatePolicySpec = Partial<{
4500
+ comparison: Partial<{
4501
+ maxAgeHours: number;
4502
+ suite: {
4503
+ id: string;
4504
+ version?: string;
4505
+ };
4506
+ }>;
4507
+ /**
4508
+ * The judged evidence behind each gated metric; for a metric with `maxDrop`, the baseline's too.
4509
+ */
4510
+ evidence: Partial<{
4511
+ minCases: number;
4512
+ minWeight: number;
4513
+ }>;
4514
+ metrics: Array<{
4515
+ name: "weightedYesShare" | "judgedCoverage" | "weightedPrecisionAtK";
4516
+ /**
4517
+ * `weightedPrecisionAtK` only: the summary's `k` must be this.
4518
+ */
4519
+ k?: number;
4520
+ minCandidate?: number;
4521
+ /**
4522
+ * How far the candidate may fall below the baseline (the live version).
4523
+ */
4524
+ maxDrop?: number;
4525
+ }>;
4526
+ /**
4527
+ * Each knob left out of the block is 0. No block: no replay checks.
4528
+ */
4529
+ replay: Partial<{
4530
+ maxDiverged: number;
4531
+ maxErrors: number;
4532
+ maxRefusedWrites: number;
4533
+ maxStopped: number;
4534
+ }>;
4535
+ /**
4536
+ * A passing promotion waits for a reviewer.
4537
+ */
4538
+ approvals: Partial<{
4539
+ /**
4540
+ * Default `senior`.
4541
+ */
4542
+ role: "standard" | "senior" | "admin";
4543
+ /**
4544
+ * Default `true`.
4545
+ */
4546
+ separateApprover: boolean;
4547
+ }>;
4548
+ /**
4549
+ * Only restricted judge classes count: the comparison must be weighted `restricted-only`, so a class anyone may assert can't move the gate.
4550
+ */
4551
+ onlyRestrictedClasses: boolean;
4552
+ }>;
4553
+ export type GatePolicy = {
4554
+ id: string;
4555
+ version: string;
4556
+ agentId: string;
4557
+ scope: LiveScope;
4558
+ spec: GatePolicySpec;
4559
+ description?: string;
4560
+ createdAt: string;
4561
+ unregisteredAt?: string;
4562
+ };
4563
+ export type GatePolicyPage = {
4564
+ data: Array<GatePolicy>;
4565
+ hasMore: boolean;
4566
+ nextCursor?: string;
4567
+ };
4568
+ export type PublishGatePolicyBody = {
4569
+ /**
4570
+ * Yours to choose, e.g. `acme.drafting-prod`.
4571
+ */
4572
+ id: string;
4573
+ version: string;
4574
+ agentId: string;
4575
+ scope: LiveScope;
4576
+ spec: GatePolicySpec;
4577
+ description?: string;
4578
+ };
4579
+ export type GatePolicyResolution = {
4580
+ /**
4581
+ * The policy that gates a promotion for the scope; null when none does.
4582
+ */
4583
+ policy: GatePolicy | null;
4584
+ };
4585
+ /**
4586
+ * What the gate would say about a promotion. Nothing is recorded.
4587
+ */
4588
+ export type PromotionCheck = {
4589
+ outcome: "would-promote" | "needs-approval" | "gate-failed";
4590
+ /**
4591
+ * The policy that applies; null when none does.
4592
+ */
4593
+ policy: GatePolicyRef | null;
4594
+ checks: Array<GateCheck>;
4595
+ approval?: GateApproval;
4596
+ };
4597
+ export type PromoteBody = {
4598
+ /**
4599
+ * The agent version to make live (registered, active).
4600
+ */
4601
+ version: string;
4602
+ scope: LiveScope;
4603
+ reason?: string;
4604
+ /**
4605
+ * The comparison this promotion was judged on.
4606
+ */
4607
+ evalRunId?: string;
4608
+ };
4609
+ export type RollbackBody = {
4610
+ scope: LiveScope;
4611
+ /**
4612
+ * An earlier version to go back to; omit → the scope's previous live version.
4613
+ */
4614
+ toVersion?: string;
4615
+ reason?: string;
4616
+ };
4617
+ export type UnpinBody = {
4618
+ scope: LiveScope;
4619
+ reason?: string;
4240
4620
  };
4241
4621
  /**
4242
4622
  * Agents and tools a flow runs at other exact versions than the flow version's pins ("this flow, with `acme.scorer` at 0.4.0"), without publishing a new flow version: a comparison's flow candidate (`versions` on the start body and the run's `comparison`), and the flow runs that replay it (a run's `versions`). Each id must be an agent or tool the flow uses.
@@ -4291,6 +4671,10 @@ declare namespace Schemas {
4291
4671
  */
4292
4672
  evalRunId?: string;
4293
4673
  versions?: FlowVersionOverrides;
4674
+ /**
4675
+ * 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.
4676
+ */
4677
+ segments?: Array<ScopeSegment>;
4294
4678
  /**
4295
4679
  * 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.
4296
4680
  */
@@ -4309,13 +4693,17 @@ declare namespace Schemas {
4309
4693
  */
4310
4694
  agent: string;
4311
4695
  /**
4312
- * Semver; omit → latest.
4696
+ * Semver. Omit → the conversation's own version for a follow-up turn, else the version live for the run's scope, else the latest.
4313
4697
  */
4314
4698
  agentVersion?: string;
4315
4699
  /**
4316
4700
  * Project to run under; omit → the tenant's Default project.
4317
4701
  */
4318
4702
  projectId?: string;
4703
+ /**
4704
+ * 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.
4705
+ */
4706
+ segments?: Array<ScopeSegment>;
4319
4707
  /**
4320
4708
  * Opaque payload forwarded to the agent binding.
4321
4709
  */
@@ -4343,6 +4731,10 @@ declare namespace Schemas {
4343
4731
  * Project to run under; omit → the tenant's Default project.
4344
4732
  */
4345
4733
  projectId?: string;
4734
+ /**
4735
+ * 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.
4736
+ */
4737
+ segments?: Array<ScopeSegment>;
4346
4738
  /**
4347
4739
  * Opaque payload forwarded to the flow runtime.
4348
4740
  */
@@ -4409,6 +4801,10 @@ declare namespace Schemas {
4409
4801
  */
4410
4802
  evalRunId?: string;
4411
4803
  versions?: FlowVersionOverrides;
4804
+ /**
4805
+ * 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.
4806
+ */
4807
+ segments?: Array<ScopeSegment>;
4412
4808
  /**
4413
4809
  * 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.
4414
4810
  */
@@ -4724,6 +5120,16 @@ declare namespace Schemas {
4724
5120
  * True when the approval had a `waitTokenId` + terminal accept/reject and the run waitpoint was completed as part of this call.
4725
5121
  */
4726
5122
  waitpointResolved: boolean;
5123
+ /**
5124
+ * 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.
5125
+ */
5126
+ resume?: {
5127
+ kind: "ok";
5128
+ } | {
5129
+ kind: "failed";
5130
+ code: string;
5131
+ message: string;
5132
+ };
4727
5133
  };
4728
5134
  /**
4729
5135
  * Reviewer roster row. Deactivation is soft (audit trail survives offboarding). `deactivatedAt` present → reviewer no longer receives approvals.
@@ -4851,6 +5257,23 @@ declare namespace Schemas {
4851
5257
  projectId: string;
4852
5258
  agentId: string;
4853
5259
  };
5260
+ /**
5261
+ * 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.
5262
+ */
5263
+ export type JudgeClassAssertableBy = Partial<{
5264
+ /**
5265
+ * The caller's reviewer role is at least this (its token's, or the roster's).
5266
+ */
5267
+ minReviewerRole: "standard" | "senior" | "admin";
5268
+ /**
5269
+ * Users, service tokens, or both.
5270
+ */
5271
+ principalKinds: Array<"user" | "service">;
5272
+ /**
5273
+ * Only these principals: user ids, or service token ids.
5274
+ */
5275
+ principalIds: Array<string>;
5276
+ }>;
4854
5277
  export type JudgeClass = {
4855
5278
  id: string;
4856
5279
  tenantId: string;
@@ -4864,6 +5287,7 @@ declare namespace Schemas {
4864
5287
  */
4865
5288
  weight: number;
4866
5289
  description?: string;
5290
+ assertableBy?: JudgeClassAssertableBy;
4867
5291
  createdAt: string;
4868
5292
  updatedAt: string;
4869
5293
  /**
@@ -4884,10 +5308,15 @@ declare namespace Schemas {
4884
5308
  name: string;
4885
5309
  weight: number;
4886
5310
  description?: string;
5311
+ assertableBy?: JudgeClassAssertableBy;
4887
5312
  };
4888
5313
  export type UpdateJudgeClassBody = Partial<{
4889
5314
  weight: number;
4890
5315
  description: string;
5316
+ /**
5317
+ * Who may assert the class; `null` lifts the restriction.
5318
+ */
5319
+ assertableBy: JudgeClassAssertableBy | null;
4891
5320
  }>;
4892
5321
  export type UnregisterJudgeClassResult = {
4893
5322
  judgeClassId: string;
@@ -4941,6 +5370,7 @@ declare namespace Schemas {
4941
5370
  * The judge class the judgment is recorded under. Absent when unclassified (counts with weight 1).
4942
5371
  */
4943
5372
  judgeClassId?: string;
5373
+ restricted?: true;
4944
5374
  assertedBy: JudgmentAssertedBy;
4945
5375
  /**
4946
5376
  * The app's opaque id for its end user who judged, when an app judged on their behalf.
@@ -5090,6 +5520,13 @@ declare namespace Schemas {
5090
5520
  * The weight behind all judgments of the item.
5091
5521
  */
5092
5522
  totalWeight: number;
5523
+ /**
5524
+ * 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.
5525
+ */
5526
+ restricted?: {
5527
+ yesWeight: number;
5528
+ totalWeight: number;
5529
+ };
5093
5530
  /**
5094
5531
  * The reasons given, newest first.
5095
5532
  */
@@ -6919,7 +7356,7 @@ declare namespace Schemas {
6919
7356
  kind: PolicyKind;
6920
7357
  description?: string;
6921
7358
  /**
6922
- * 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 `hitl` specs are validated on publish. For other kinds, the shape is defined by the runtime consumer.
7359
+ * 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.
6923
7360
  */
6924
7361
  spec: Record<string, unknown>;
6925
7362
  };
@@ -6938,7 +7375,7 @@ declare namespace Schemas {
6938
7375
  kind: PolicyKind;
6939
7376
  description?: string;
6940
7377
  /**
6941
- * 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 `hitl` specs are validated on publish. For other kinds, the shape is defined by the runtime consumer.
7378
+ * 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.
6942
7379
  */
6943
7380
  spec: Record<string, unknown>;
6944
7381
  /**
@@ -6976,6 +7413,99 @@ declare namespace Schemas {
6976
7413
  version: string;
6977
7414
  wasTombstoned: boolean;
6978
7415
  };
7416
+ export type RetentionDomain = "org" | "agent" | "flow" | "tool" | "eval_suite" | "guardrail" | "mcp_endpoint" | "env" | "secret" | "run" | "policy" | "judgment" | "judge_class" | "provider" | "*";
7417
+ export type RetentionPolicyConflict = {
7418
+ domain: RetentionDomain;
7419
+ /**
7420
+ * Every policy id that covers the domain, sorted.
7421
+ */
7422
+ policyIds: Array<string>;
7423
+ /**
7424
+ * The one that applies: the policy whose latest version is highest, and on equal versions the lower policy id. Unregister the others.
7425
+ */
7426
+ appliedPolicyId: string;
7427
+ };
7428
+ export type RetentionScheduledItem = {
7429
+ domain: RetentionDomain;
7430
+ /**
7431
+ * The tombstoned row's id in its domain.
7432
+ */
7433
+ id: string;
7434
+ unregisteredAt: string;
7435
+ /**
7436
+ * `unregisteredAt` plus the policy's grace: when a sweep purges the row.
7437
+ */
7438
+ purgeAt: string;
7439
+ /**
7440
+ * Whether a sweep would purge the row now.
7441
+ */
7442
+ pastGrace: boolean;
7443
+ /**
7444
+ * The retention policy that applies.
7445
+ */
7446
+ policyId: string;
7447
+ policyVersion: string;
7448
+ /**
7449
+ * The policy's grace, in seconds (`-1`: a hold, never purged).
7450
+ */
7451
+ graceSeconds: number;
7452
+ };
7453
+ export type RetentionScheduledPage = {
7454
+ data: Array<RetentionScheduledItem>;
7455
+ /**
7456
+ * 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.
7457
+ */
7458
+ hasMore?: boolean;
7459
+ /**
7460
+ * The `cursor` for the next page. Absent when `hasMore: false`, or when the runtime cannot continue a page.
7461
+ */
7462
+ nextCursor?: string;
7463
+ /**
7464
+ * Domains a retention policy covers that this deployment can't purge (no adapter is wired).
7465
+ */
7466
+ domainsMissingAdapter: Array<RetentionDomain>;
7467
+ /**
7468
+ * Domains no retention policy covers: their tombstones are kept.
7469
+ */
7470
+ unpolicedDomains: Array<RetentionDomain>;
7471
+ /**
7472
+ * Domains more than one retention policy covers. Absent or empty: none.
7473
+ */
7474
+ conflicts?: Array<RetentionPolicyConflict>;
7475
+ };
7476
+ export type RetentionSweepBody = Partial<{
7477
+ domain: RetentionDomain;
7478
+ /**
7479
+ * The most rows one call purges per domain (default 500); the rest are `remaining`.
7480
+ */
7481
+ maxPerDomain: number;
7482
+ }>;
7483
+ export type RetentionSweepDomainBody = Partial<{
7484
+ /**
7485
+ * The most rows this call purges (default 500); the rest are `remaining`.
7486
+ */
7487
+ maxPerDomain: number;
7488
+ }>;
7489
+ export type RetentionSweepResult = {
7490
+ perDomain: Array<{
7491
+ domain: RetentionDomain;
7492
+ purged: number;
7493
+ /**
7494
+ * Rows past grace this call left (the `maxPerDomain` cap); sweep again.
7495
+ */
7496
+ remaining: number;
7497
+ /**
7498
+ * The retention policy that applied.
7499
+ */
7500
+ policyId?: string;
7501
+ missingAdapter?: true;
7502
+ }>;
7503
+ totalPurged: number;
7504
+ /**
7505
+ * Domains more than one retention policy covers. Absent or empty: none.
7506
+ */
7507
+ conflicts?: Array<RetentionPolicyConflict>;
7508
+ };
6979
7509
  export type EvalKind = "accuracy" | "pairwise" | "regression" | "human-review" | "benchmark" | "custom" | "judged";
6980
7510
  export type EvalSuite = {
6981
7511
  id: string;
@@ -7108,7 +7638,7 @@ declare namespace Schemas {
7108
7638
  version?: string;
7109
7639
  };
7110
7640
  /**
7111
- * 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.
7641
+ * 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.
7112
7642
  */
7113
7643
  export type EvalBaseline = "recorded" | {
7114
7644
  agentId: string;
@@ -7116,7 +7646,10 @@ declare namespace Schemas {
7116
7646
  } | {
7117
7647
  live: Partial<{
7118
7648
  projectId: string;
7119
- segments: Record<string, string>;
7649
+ /**
7650
+ * A segment path in `projectId`, coarse to fine, as live versions resolve it. Needs `projectId`.
7651
+ */
7652
+ segments: Array<ScopeSegment>;
7120
7653
  }>;
7121
7654
  };
7122
7655
  /**
@@ -7131,6 +7664,10 @@ declare namespace Schemas {
7131
7664
  repetitions: number;
7132
7665
  k: number;
7133
7666
  versions?: FlowVersionOverrides;
7667
+ /**
7668
+ * 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`).
7669
+ */
7670
+ classWeights?: "as-recorded" | "restricted-only";
7134
7671
  };
7135
7672
  /**
7136
7673
  * One metric, the recorded runs beside the candidate. `null` where a side had no judged evidence; `n` / `weight` are the candidate's evidence (cases with judged items, and the judgment weight behind them), `baselineN` / `baselineWeight` the recorded side's.
@@ -7160,6 +7697,10 @@ declare namespace Schemas {
7160
7697
  kind: "agent";
7161
7698
  agentId: string;
7162
7699
  version: string;
7700
+ /**
7701
+ * 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.
7702
+ */
7703
+ pinsDigest?: string;
7163
7704
  } | {
7164
7705
  kind: "flow";
7165
7706
  flowId: string;
@@ -7220,7 +7761,11 @@ declare namespace Schemas {
7220
7761
  */
7221
7762
  stopped: number;
7222
7763
  reads: "recorded" | "live";
7223
- sampling: {
7764
+ /**
7765
+ * Which judgments counted. Absent from a comparison recorded before restricted classes: `as-recorded`.
7766
+ */
7767
+ classWeights?: "as-recorded" | "restricted-only";
7768
+ sampling: {
7224
7769
  /**
7225
7770
  * The models that answered the candidate's replays, and how many replays each.
7226
7771
  */
@@ -7366,6 +7911,10 @@ declare namespace Schemas {
7366
7911
  repetitions?: number;
7367
7912
  k?: number;
7368
7913
  versions?: FlowVersionOverrides;
7914
+ /**
7915
+ * 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`).
7916
+ */
7917
+ classWeights?: "as-recorded" | "restricted-only";
7369
7918
  };
7370
7919
  export type StartEvalRunResult = {
7371
7920
  runId: string;
@@ -7412,6 +7961,10 @@ declare namespace Schemas {
7412
7961
  };
7413
7962
  export type IdentityProviderCollectionPage = {
7414
7963
  data: Array<IdentityProviderConfig>;
7964
+ /**
7965
+ * Always `false`: the list comes whole. Absent from older servers.
7966
+ */
7967
+ hasMore?: boolean;
7415
7968
  };
7416
7969
  export type RegisterIdentityProviderResult = {
7417
7970
  providerId: string;
@@ -8031,6 +8584,10 @@ declare namespace Schemas {
8031
8584
  };
8032
8585
  export type EnvCollectionPage = {
8033
8586
  data: Array<EnvRecord>;
8587
+ /**
8588
+ * Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.
8589
+ */
8590
+ hasMore?: boolean;
8034
8591
  nextCursor?: string;
8035
8592
  };
8036
8593
  export type EnvSetRequest = {
@@ -8046,10 +8603,18 @@ declare namespace Schemas {
8046
8603
  };
8047
8604
  export type SecretCollectionPage = {
8048
8605
  data: Array<SecretRecord>;
8606
+ /**
8607
+ * Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.
8608
+ */
8609
+ hasMore?: boolean;
8049
8610
  nextCursor?: string;
8050
8611
  };
8051
8612
  export type SecretVersionCollectionPage = {
8052
8613
  data: Array<SecretVersionRecord>;
8614
+ /**
8615
+ * Whether there's another page. Absent from older servers: there is one when `nextCursor` is set.
8616
+ */
8617
+ hasMore?: boolean;
8053
8618
  nextCursor?: string;
8054
8619
  };
8055
8620
  export type SecretSetRequest = {
@@ -8421,8 +8986,645 @@ declare namespace Schemas {
8421
8986
  };
8422
8987
  // </Schemas>
8423
8988
  }
8989
+ export type ScopeSegment = Schemas.ScopeSegment;
8990
+ declare const ScopeSegment: z.ZodObject<{
8991
+ key: z.ZodString;
8992
+ value: z.ZodString;
8993
+ }, z.core.$strict>;
8994
+ export type LiveScope = Schemas.LiveScope;
8995
+ declare const LiveScope: z.ZodDiscriminatedUnion<[
8996
+ z.ZodObject<{
8997
+ kind: z.ZodLiteral<"tenant">;
8998
+ }, z.core.$strict>,
8999
+ z.ZodObject<{
9000
+ kind: z.ZodLiteral<"org">;
9001
+ orgId: z.ZodUUID;
9002
+ }, z.core.$strict>,
9003
+ z.ZodObject<{
9004
+ kind: z.ZodLiteral<"project">;
9005
+ projectId: z.ZodUUID;
9006
+ }, z.core.$strict>,
9007
+ z.ZodObject<{
9008
+ kind: z.ZodLiteral<"segment">;
9009
+ projectId: z.ZodUUID;
9010
+ path: z.ZodArray<z.ZodObject<{
9011
+ key: z.ZodString;
9012
+ value: z.ZodString;
9013
+ }, z.core.$strict>>;
9014
+ }, z.core.$strict>
9015
+ ], "kind">;
9016
+ export type LiveVersionResolution = Schemas.LiveVersionResolution;
9017
+ declare const LiveVersionResolution: z.ZodObject<{
9018
+ agentId: z.ZodString;
9019
+ version: z.ZodString;
9020
+ via: z.ZodEnum<{
9021
+ live: "live";
9022
+ latest: "latest";
9023
+ }>;
9024
+ liveScope: z.ZodOptional<z.ZodDiscriminatedUnion<[
9025
+ z.ZodObject<{
9026
+ kind: z.ZodLiteral<"tenant">;
9027
+ }, z.core.$strict>,
9028
+ z.ZodObject<{
9029
+ kind: z.ZodLiteral<"org">;
9030
+ orgId: z.ZodUUID;
9031
+ }, z.core.$strict>,
9032
+ z.ZodObject<{
9033
+ kind: z.ZodLiteral<"project">;
9034
+ projectId: z.ZodUUID;
9035
+ }, z.core.$strict>,
9036
+ z.ZodObject<{
9037
+ kind: z.ZodLiteral<"segment">;
9038
+ projectId: z.ZodUUID;
9039
+ path: z.ZodArray<z.ZodObject<{
9040
+ key: z.ZodString;
9041
+ value: z.ZodString;
9042
+ }, z.core.$strict>>;
9043
+ }, z.core.$strict>
9044
+ ], "kind">>;
9045
+ }, z.core.$strict>;
9046
+ export type LivePin = Schemas.LivePin;
9047
+ declare const LivePin: z.ZodObject<{
9048
+ agentId: z.ZodString;
9049
+ scope: z.ZodDiscriminatedUnion<[
9050
+ z.ZodObject<{
9051
+ kind: z.ZodLiteral<"tenant">;
9052
+ }, z.core.$strict>,
9053
+ z.ZodObject<{
9054
+ kind: z.ZodLiteral<"org">;
9055
+ orgId: z.ZodUUID;
9056
+ }, z.core.$strict>,
9057
+ z.ZodObject<{
9058
+ kind: z.ZodLiteral<"project">;
9059
+ projectId: z.ZodUUID;
9060
+ }, z.core.$strict>,
9061
+ z.ZodObject<{
9062
+ kind: z.ZodLiteral<"segment">;
9063
+ projectId: z.ZodUUID;
9064
+ path: z.ZodArray<z.ZodObject<{
9065
+ key: z.ZodString;
9066
+ value: z.ZodString;
9067
+ }, z.core.$strict>>;
9068
+ }, z.core.$strict>
9069
+ ], "kind">;
9070
+ version: z.ZodString;
9071
+ promotionId: z.ZodUUID;
9072
+ setAt: z.ZodISODateTime;
9073
+ }, z.core.$strict>;
9074
+ export type LivePinList = Schemas.LivePinList;
9075
+ declare const LivePinList: z.ZodObject<{
9076
+ data: z.ZodArray<z.ZodObject<{
9077
+ agentId: z.ZodString;
9078
+ scope: z.ZodDiscriminatedUnion<[
9079
+ z.ZodObject<{
9080
+ kind: z.ZodLiteral<"tenant">;
9081
+ }, z.core.$strict>,
9082
+ z.ZodObject<{
9083
+ kind: z.ZodLiteral<"org">;
9084
+ orgId: z.ZodUUID;
9085
+ }, z.core.$strict>,
9086
+ z.ZodObject<{
9087
+ kind: z.ZodLiteral<"project">;
9088
+ projectId: z.ZodUUID;
9089
+ }, z.core.$strict>,
9090
+ z.ZodObject<{
9091
+ kind: z.ZodLiteral<"segment">;
9092
+ projectId: z.ZodUUID;
9093
+ path: z.ZodArray<z.ZodObject<{
9094
+ key: z.ZodString;
9095
+ value: z.ZodString;
9096
+ }, z.core.$strict>>;
9097
+ }, z.core.$strict>
9098
+ ], "kind">;
9099
+ version: z.ZodString;
9100
+ promotionId: z.ZodUUID;
9101
+ setAt: z.ZodISODateTime;
9102
+ }, z.core.$strict>>;
9103
+ }, z.core.$strict>;
9104
+ export type GatePolicyRef = Schemas.GatePolicyRef;
9105
+ declare const GatePolicyRef: z.ZodObject<{
9106
+ id: z.ZodString;
9107
+ version: z.ZodString;
9108
+ }, z.core.$strict>;
9109
+ export type GateCheck = Schemas.GateCheck;
9110
+ declare const GateCheck: z.ZodObject<{
9111
+ name: z.ZodString;
9112
+ passed: z.ZodBoolean;
9113
+ message: z.ZodString;
9114
+ value: z.ZodOptional<z.ZodUnion<readonly [
9115
+ z.ZodNumber,
9116
+ z.ZodString
9117
+ ]>>;
9118
+ threshold: z.ZodOptional<z.ZodUnion<readonly [
9119
+ z.ZodNumber,
9120
+ z.ZodString
9121
+ ]>>;
9122
+ }, z.core.$strict>;
9123
+ export type Promotion = Schemas.Promotion;
9124
+ declare const Promotion: z.ZodObject<{
9125
+ id: z.ZodUUID;
9126
+ agentId: z.ZodString;
9127
+ scope: z.ZodDiscriminatedUnion<[
9128
+ z.ZodObject<{
9129
+ kind: z.ZodLiteral<"tenant">;
9130
+ }, z.core.$strict>,
9131
+ z.ZodObject<{
9132
+ kind: z.ZodLiteral<"org">;
9133
+ orgId: z.ZodUUID;
9134
+ }, z.core.$strict>,
9135
+ z.ZodObject<{
9136
+ kind: z.ZodLiteral<"project">;
9137
+ projectId: z.ZodUUID;
9138
+ }, z.core.$strict>,
9139
+ z.ZodObject<{
9140
+ kind: z.ZodLiteral<"segment">;
9141
+ projectId: z.ZodUUID;
9142
+ path: z.ZodArray<z.ZodObject<{
9143
+ key: z.ZodString;
9144
+ value: z.ZodString;
9145
+ }, z.core.$strict>>;
9146
+ }, z.core.$strict>
9147
+ ], "kind">;
9148
+ action: z.ZodEnum<{
9149
+ promote: "promote";
9150
+ rollback: "rollback";
9151
+ unpin: "unpin";
9152
+ }>;
9153
+ fromVersion: z.ZodNullable<z.ZodString>;
9154
+ toVersion: z.ZodNullable<z.ZodString>;
9155
+ requestedBy: z.ZodObject<{
9156
+ kind: z.ZodEnum<{
9157
+ user: "user";
9158
+ service: "service";
9159
+ }>;
9160
+ id: z.ZodString;
9161
+ }, z.core.$strict>;
9162
+ reason: z.ZodOptional<z.ZodString>;
9163
+ evalRunId: z.ZodOptional<z.ZodString>;
9164
+ createdAt: z.ZodISODateTime;
9165
+ status: z.ZodOptional<z.ZodEnum<{
9166
+ rejected: "rejected";
9167
+ expired: "expired";
9168
+ promoted: "promoted";
9169
+ "pending-approval": "pending-approval";
9170
+ refused: "refused";
9171
+ superseded: "superseded";
9172
+ }>>;
9173
+ policy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
9174
+ id: z.ZodString;
9175
+ version: z.ZodString;
9176
+ }, z.core.$strict>>>;
9177
+ checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
9178
+ name: z.ZodString;
9179
+ passed: z.ZodBoolean;
9180
+ message: z.ZodString;
9181
+ value: z.ZodOptional<z.ZodUnion<readonly [
9182
+ z.ZodNumber,
9183
+ z.ZodString
9184
+ ]>>;
9185
+ threshold: z.ZodOptional<z.ZodUnion<readonly [
9186
+ z.ZodNumber,
9187
+ z.ZodString
9188
+ ]>>;
9189
+ }, z.core.$strict>>>;
9190
+ approvalId: z.ZodOptional<z.ZodString>;
9191
+ resolvedAt: z.ZodOptional<z.ZodISODateTime>;
9192
+ }, z.core.$strict>;
9193
+ export type PromotionPage = Schemas.PromotionPage;
9194
+ declare const PromotionPage: z.ZodObject<{
9195
+ data: z.ZodArray<z.ZodObject<{
9196
+ id: z.ZodUUID;
9197
+ agentId: z.ZodString;
9198
+ scope: z.ZodDiscriminatedUnion<[
9199
+ z.ZodObject<{
9200
+ kind: z.ZodLiteral<"tenant">;
9201
+ }, z.core.$strict>,
9202
+ z.ZodObject<{
9203
+ kind: z.ZodLiteral<"org">;
9204
+ orgId: z.ZodUUID;
9205
+ }, z.core.$strict>,
9206
+ z.ZodObject<{
9207
+ kind: z.ZodLiteral<"project">;
9208
+ projectId: z.ZodUUID;
9209
+ }, z.core.$strict>,
9210
+ z.ZodObject<{
9211
+ kind: z.ZodLiteral<"segment">;
9212
+ projectId: z.ZodUUID;
9213
+ path: z.ZodArray<z.ZodObject<{
9214
+ key: z.ZodString;
9215
+ value: z.ZodString;
9216
+ }, z.core.$strict>>;
9217
+ }, z.core.$strict>
9218
+ ], "kind">;
9219
+ action: z.ZodEnum<{
9220
+ promote: "promote";
9221
+ rollback: "rollback";
9222
+ unpin: "unpin";
9223
+ }>;
9224
+ fromVersion: z.ZodNullable<z.ZodString>;
9225
+ toVersion: z.ZodNullable<z.ZodString>;
9226
+ requestedBy: z.ZodObject<{
9227
+ kind: z.ZodEnum<{
9228
+ user: "user";
9229
+ service: "service";
9230
+ }>;
9231
+ id: z.ZodString;
9232
+ }, z.core.$strict>;
9233
+ reason: z.ZodOptional<z.ZodString>;
9234
+ evalRunId: z.ZodOptional<z.ZodString>;
9235
+ createdAt: z.ZodISODateTime;
9236
+ status: z.ZodOptional<z.ZodEnum<{
9237
+ rejected: "rejected";
9238
+ expired: "expired";
9239
+ promoted: "promoted";
9240
+ "pending-approval": "pending-approval";
9241
+ refused: "refused";
9242
+ superseded: "superseded";
9243
+ }>>;
9244
+ policy: z.ZodOptional<z.ZodNullable<z.ZodObject<{
9245
+ id: z.ZodString;
9246
+ version: z.ZodString;
9247
+ }, z.core.$strict>>>;
9248
+ checks: z.ZodOptional<z.ZodArray<z.ZodObject<{
9249
+ name: z.ZodString;
9250
+ passed: z.ZodBoolean;
9251
+ message: z.ZodString;
9252
+ value: z.ZodOptional<z.ZodUnion<readonly [
9253
+ z.ZodNumber,
9254
+ z.ZodString
9255
+ ]>>;
9256
+ threshold: z.ZodOptional<z.ZodUnion<readonly [
9257
+ z.ZodNumber,
9258
+ z.ZodString
9259
+ ]>>;
9260
+ }, z.core.$strict>>>;
9261
+ approvalId: z.ZodOptional<z.ZodString>;
9262
+ resolvedAt: z.ZodOptional<z.ZodISODateTime>;
9263
+ }, z.core.$strict>>;
9264
+ hasMore: z.ZodBoolean;
9265
+ nextCursor: z.ZodOptional<z.ZodString>;
9266
+ }, z.core.$strict>;
9267
+ export type GateApproval = Schemas.GateApproval;
9268
+ declare const GateApproval: z.ZodObject<{
9269
+ role: z.ZodEnum<{
9270
+ standard: "standard";
9271
+ senior: "senior";
9272
+ admin: "admin";
9273
+ }>;
9274
+ count: z.ZodNumber;
9275
+ separateApprover: z.ZodBoolean;
9276
+ }, z.core.$strict>;
9277
+ export type GatePolicySpec = Schemas.GatePolicySpec;
9278
+ declare const GatePolicySpec: z.ZodObject<{
9279
+ comparison: z.ZodOptional<z.ZodObject<{
9280
+ maxAgeHours: z.ZodOptional<z.ZodNumber>;
9281
+ suite: z.ZodOptional<z.ZodObject<{
9282
+ id: z.ZodString;
9283
+ version: z.ZodOptional<z.ZodString>;
9284
+ }, z.core.$strict>>;
9285
+ }, z.core.$strict>>;
9286
+ evidence: z.ZodOptional<z.ZodObject<{
9287
+ minCases: z.ZodOptional<z.ZodNumber>;
9288
+ minWeight: z.ZodOptional<z.ZodNumber>;
9289
+ }, z.core.$strict>>;
9290
+ metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
9291
+ name: z.ZodEnum<{
9292
+ weightedYesShare: "weightedYesShare";
9293
+ judgedCoverage: "judgedCoverage";
9294
+ weightedPrecisionAtK: "weightedPrecisionAtK";
9295
+ }>;
9296
+ k: z.ZodOptional<z.ZodNumber>;
9297
+ minCandidate: z.ZodOptional<z.ZodNumber>;
9298
+ maxDrop: z.ZodOptional<z.ZodNumber>;
9299
+ }, z.core.$strict>>>;
9300
+ replay: z.ZodOptional<z.ZodObject<{
9301
+ maxDiverged: z.ZodOptional<z.ZodNumber>;
9302
+ maxErrors: z.ZodOptional<z.ZodNumber>;
9303
+ maxRefusedWrites: z.ZodOptional<z.ZodNumber>;
9304
+ maxStopped: z.ZodOptional<z.ZodNumber>;
9305
+ }, z.core.$strict>>;
9306
+ approvals: z.ZodOptional<z.ZodObject<{
9307
+ role: z.ZodOptional<z.ZodEnum<{
9308
+ standard: "standard";
9309
+ senior: "senior";
9310
+ admin: "admin";
9311
+ }>>;
9312
+ separateApprover: z.ZodOptional<z.ZodBoolean>;
9313
+ }, z.core.$strict>>;
9314
+ onlyRestrictedClasses: z.ZodOptional<z.ZodBoolean>;
9315
+ }, z.core.$strict>;
9316
+ export type GatePolicy = Schemas.GatePolicy;
9317
+ declare const GatePolicy: z.ZodObject<{
9318
+ id: z.ZodString;
9319
+ version: z.ZodString;
9320
+ agentId: z.ZodString;
9321
+ scope: z.ZodDiscriminatedUnion<[
9322
+ z.ZodObject<{
9323
+ kind: z.ZodLiteral<"tenant">;
9324
+ }, z.core.$strict>,
9325
+ z.ZodObject<{
9326
+ kind: z.ZodLiteral<"org">;
9327
+ orgId: z.ZodUUID;
9328
+ }, z.core.$strict>,
9329
+ z.ZodObject<{
9330
+ kind: z.ZodLiteral<"project">;
9331
+ projectId: z.ZodUUID;
9332
+ }, z.core.$strict>,
9333
+ z.ZodObject<{
9334
+ kind: z.ZodLiteral<"segment">;
9335
+ projectId: z.ZodUUID;
9336
+ path: z.ZodArray<z.ZodObject<{
9337
+ key: z.ZodString;
9338
+ value: z.ZodString;
9339
+ }, z.core.$strict>>;
9340
+ }, z.core.$strict>
9341
+ ], "kind">;
9342
+ spec: z.ZodObject<{
9343
+ comparison: z.ZodOptional<z.ZodObject<{
9344
+ maxAgeHours: z.ZodOptional<z.ZodNumber>;
9345
+ suite: z.ZodOptional<z.ZodObject<{
9346
+ id: z.ZodString;
9347
+ version: z.ZodOptional<z.ZodString>;
9348
+ }, z.core.$strict>>;
9349
+ }, z.core.$strict>>;
9350
+ evidence: z.ZodOptional<z.ZodObject<{
9351
+ minCases: z.ZodOptional<z.ZodNumber>;
9352
+ minWeight: z.ZodOptional<z.ZodNumber>;
9353
+ }, z.core.$strict>>;
9354
+ metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
9355
+ name: z.ZodEnum<{
9356
+ weightedYesShare: "weightedYesShare";
9357
+ judgedCoverage: "judgedCoverage";
9358
+ weightedPrecisionAtK: "weightedPrecisionAtK";
9359
+ }>;
9360
+ k: z.ZodOptional<z.ZodNumber>;
9361
+ minCandidate: z.ZodOptional<z.ZodNumber>;
9362
+ maxDrop: z.ZodOptional<z.ZodNumber>;
9363
+ }, z.core.$strict>>>;
9364
+ replay: z.ZodOptional<z.ZodObject<{
9365
+ maxDiverged: z.ZodOptional<z.ZodNumber>;
9366
+ maxErrors: z.ZodOptional<z.ZodNumber>;
9367
+ maxRefusedWrites: z.ZodOptional<z.ZodNumber>;
9368
+ maxStopped: z.ZodOptional<z.ZodNumber>;
9369
+ }, z.core.$strict>>;
9370
+ approvals: z.ZodOptional<z.ZodObject<{
9371
+ role: z.ZodOptional<z.ZodEnum<{
9372
+ standard: "standard";
9373
+ senior: "senior";
9374
+ admin: "admin";
9375
+ }>>;
9376
+ separateApprover: z.ZodOptional<z.ZodBoolean>;
9377
+ }, z.core.$strict>>;
9378
+ onlyRestrictedClasses: z.ZodOptional<z.ZodBoolean>;
9379
+ }, z.core.$strict>;
9380
+ description: z.ZodOptional<z.ZodString>;
9381
+ createdAt: z.ZodISODateTime;
9382
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
9383
+ }, z.core.$strict>;
9384
+ export type GatePolicyPage = Schemas.GatePolicyPage;
9385
+ declare const GatePolicyPage: z.ZodObject<{
9386
+ data: z.ZodArray<z.ZodObject<{
9387
+ id: z.ZodString;
9388
+ version: z.ZodString;
9389
+ agentId: z.ZodString;
9390
+ scope: z.ZodDiscriminatedUnion<[
9391
+ z.ZodObject<{
9392
+ kind: z.ZodLiteral<"tenant">;
9393
+ }, z.core.$strict>,
9394
+ z.ZodObject<{
9395
+ kind: z.ZodLiteral<"org">;
9396
+ orgId: z.ZodUUID;
9397
+ }, z.core.$strict>,
9398
+ z.ZodObject<{
9399
+ kind: z.ZodLiteral<"project">;
9400
+ projectId: z.ZodUUID;
9401
+ }, z.core.$strict>,
9402
+ z.ZodObject<{
9403
+ kind: z.ZodLiteral<"segment">;
9404
+ projectId: z.ZodUUID;
9405
+ path: z.ZodArray<z.ZodObject<{
9406
+ key: z.ZodString;
9407
+ value: z.ZodString;
9408
+ }, z.core.$strict>>;
9409
+ }, z.core.$strict>
9410
+ ], "kind">;
9411
+ spec: z.ZodObject<{
9412
+ comparison: z.ZodOptional<z.ZodObject<{
9413
+ maxAgeHours: z.ZodOptional<z.ZodNumber>;
9414
+ suite: z.ZodOptional<z.ZodObject<{
9415
+ id: z.ZodString;
9416
+ version: z.ZodOptional<z.ZodString>;
9417
+ }, z.core.$strict>>;
9418
+ }, z.core.$strict>>;
9419
+ evidence: z.ZodOptional<z.ZodObject<{
9420
+ minCases: z.ZodOptional<z.ZodNumber>;
9421
+ minWeight: z.ZodOptional<z.ZodNumber>;
9422
+ }, z.core.$strict>>;
9423
+ metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
9424
+ name: z.ZodEnum<{
9425
+ weightedYesShare: "weightedYesShare";
9426
+ judgedCoverage: "judgedCoverage";
9427
+ weightedPrecisionAtK: "weightedPrecisionAtK";
9428
+ }>;
9429
+ k: z.ZodOptional<z.ZodNumber>;
9430
+ minCandidate: z.ZodOptional<z.ZodNumber>;
9431
+ maxDrop: z.ZodOptional<z.ZodNumber>;
9432
+ }, z.core.$strict>>>;
9433
+ replay: z.ZodOptional<z.ZodObject<{
9434
+ maxDiverged: z.ZodOptional<z.ZodNumber>;
9435
+ maxErrors: z.ZodOptional<z.ZodNumber>;
9436
+ maxRefusedWrites: z.ZodOptional<z.ZodNumber>;
9437
+ maxStopped: z.ZodOptional<z.ZodNumber>;
9438
+ }, z.core.$strict>>;
9439
+ approvals: z.ZodOptional<z.ZodObject<{
9440
+ role: z.ZodOptional<z.ZodEnum<{
9441
+ standard: "standard";
9442
+ senior: "senior";
9443
+ admin: "admin";
9444
+ }>>;
9445
+ separateApprover: z.ZodOptional<z.ZodBoolean>;
9446
+ }, z.core.$strict>>;
9447
+ onlyRestrictedClasses: z.ZodOptional<z.ZodBoolean>;
9448
+ }, z.core.$strict>;
9449
+ description: z.ZodOptional<z.ZodString>;
9450
+ createdAt: z.ZodISODateTime;
9451
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
9452
+ }, z.core.$strict>>;
9453
+ hasMore: z.ZodBoolean;
9454
+ nextCursor: z.ZodOptional<z.ZodString>;
9455
+ }, z.core.$strict>;
9456
+ export type PublishGatePolicyBody = Schemas.PublishGatePolicyBody;
9457
+ declare const PublishGatePolicyBody: z.ZodObject<{
9458
+ id: z.ZodString;
9459
+ version: z.ZodString;
9460
+ agentId: z.ZodString;
9461
+ scope: z.ZodDiscriminatedUnion<[
9462
+ z.ZodObject<{
9463
+ kind: z.ZodLiteral<"tenant">;
9464
+ }, z.core.$strict>,
9465
+ z.ZodObject<{
9466
+ kind: z.ZodLiteral<"org">;
9467
+ orgId: z.ZodUUID;
9468
+ }, z.core.$strict>,
9469
+ z.ZodObject<{
9470
+ kind: z.ZodLiteral<"project">;
9471
+ projectId: z.ZodUUID;
9472
+ }, z.core.$strict>,
9473
+ z.ZodObject<{
9474
+ kind: z.ZodLiteral<"segment">;
9475
+ projectId: z.ZodUUID;
9476
+ path: z.ZodArray<z.ZodObject<{
9477
+ key: z.ZodString;
9478
+ value: z.ZodString;
9479
+ }, z.core.$strict>>;
9480
+ }, z.core.$strict>
9481
+ ], "kind">;
9482
+ spec: z.ZodObject<{
9483
+ comparison: z.ZodOptional<z.ZodObject<{
9484
+ maxAgeHours: z.ZodOptional<z.ZodNumber>;
9485
+ suite: z.ZodOptional<z.ZodObject<{
9486
+ id: z.ZodString;
9487
+ version: z.ZodOptional<z.ZodString>;
9488
+ }, z.core.$strict>>;
9489
+ }, z.core.$strict>>;
9490
+ evidence: z.ZodOptional<z.ZodObject<{
9491
+ minCases: z.ZodOptional<z.ZodNumber>;
9492
+ minWeight: z.ZodOptional<z.ZodNumber>;
9493
+ }, z.core.$strict>>;
9494
+ metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
9495
+ name: z.ZodEnum<{
9496
+ weightedYesShare: "weightedYesShare";
9497
+ judgedCoverage: "judgedCoverage";
9498
+ weightedPrecisionAtK: "weightedPrecisionAtK";
9499
+ }>;
9500
+ k: z.ZodOptional<z.ZodNumber>;
9501
+ minCandidate: z.ZodOptional<z.ZodNumber>;
9502
+ maxDrop: z.ZodOptional<z.ZodNumber>;
9503
+ }, z.core.$strict>>>;
9504
+ replay: z.ZodOptional<z.ZodObject<{
9505
+ maxDiverged: z.ZodOptional<z.ZodNumber>;
9506
+ maxErrors: z.ZodOptional<z.ZodNumber>;
9507
+ maxRefusedWrites: z.ZodOptional<z.ZodNumber>;
9508
+ maxStopped: z.ZodOptional<z.ZodNumber>;
9509
+ }, z.core.$strict>>;
9510
+ approvals: z.ZodOptional<z.ZodObject<{
9511
+ role: z.ZodOptional<z.ZodEnum<{
9512
+ standard: "standard";
9513
+ senior: "senior";
9514
+ admin: "admin";
9515
+ }>>;
9516
+ separateApprover: z.ZodOptional<z.ZodBoolean>;
9517
+ }, z.core.$strict>>;
9518
+ onlyRestrictedClasses: z.ZodOptional<z.ZodBoolean>;
9519
+ }, z.core.$strict>;
9520
+ description: z.ZodOptional<z.ZodString>;
9521
+ }, z.core.$strict>;
9522
+ export type GatePolicyResolution = Schemas.GatePolicyResolution;
9523
+ declare const GatePolicyResolution: z.ZodObject<{
9524
+ policy: z.ZodNullable<z.ZodObject<{
9525
+ id: z.ZodString;
9526
+ version: z.ZodString;
9527
+ agentId: z.ZodString;
9528
+ scope: z.ZodDiscriminatedUnion<[
9529
+ z.ZodObject<{
9530
+ kind: z.ZodLiteral<"tenant">;
9531
+ }, z.core.$strict>,
9532
+ z.ZodObject<{
9533
+ kind: z.ZodLiteral<"org">;
9534
+ orgId: z.ZodUUID;
9535
+ }, z.core.$strict>,
9536
+ z.ZodObject<{
9537
+ kind: z.ZodLiteral<"project">;
9538
+ projectId: z.ZodUUID;
9539
+ }, z.core.$strict>,
9540
+ z.ZodObject<{
9541
+ kind: z.ZodLiteral<"segment">;
9542
+ projectId: z.ZodUUID;
9543
+ path: z.ZodArray<z.ZodObject<{
9544
+ key: z.ZodString;
9545
+ value: z.ZodString;
9546
+ }, z.core.$strict>>;
9547
+ }, z.core.$strict>
9548
+ ], "kind">;
9549
+ spec: z.ZodObject<{
9550
+ comparison: z.ZodOptional<z.ZodObject<{
9551
+ maxAgeHours: z.ZodOptional<z.ZodNumber>;
9552
+ suite: z.ZodOptional<z.ZodObject<{
9553
+ id: z.ZodString;
9554
+ version: z.ZodOptional<z.ZodString>;
9555
+ }, z.core.$strict>>;
9556
+ }, z.core.$strict>>;
9557
+ evidence: z.ZodOptional<z.ZodObject<{
9558
+ minCases: z.ZodOptional<z.ZodNumber>;
9559
+ minWeight: z.ZodOptional<z.ZodNumber>;
9560
+ }, z.core.$strict>>;
9561
+ metrics: z.ZodOptional<z.ZodArray<z.ZodObject<{
9562
+ name: z.ZodEnum<{
9563
+ weightedYesShare: "weightedYesShare";
9564
+ judgedCoverage: "judgedCoverage";
9565
+ weightedPrecisionAtK: "weightedPrecisionAtK";
9566
+ }>;
9567
+ k: z.ZodOptional<z.ZodNumber>;
9568
+ minCandidate: z.ZodOptional<z.ZodNumber>;
9569
+ maxDrop: z.ZodOptional<z.ZodNumber>;
9570
+ }, z.core.$strict>>>;
9571
+ replay: z.ZodOptional<z.ZodObject<{
9572
+ maxDiverged: z.ZodOptional<z.ZodNumber>;
9573
+ maxErrors: z.ZodOptional<z.ZodNumber>;
9574
+ maxRefusedWrites: z.ZodOptional<z.ZodNumber>;
9575
+ maxStopped: z.ZodOptional<z.ZodNumber>;
9576
+ }, z.core.$strict>>;
9577
+ approvals: z.ZodOptional<z.ZodObject<{
9578
+ role: z.ZodOptional<z.ZodEnum<{
9579
+ standard: "standard";
9580
+ senior: "senior";
9581
+ admin: "admin";
9582
+ }>>;
9583
+ separateApprover: z.ZodOptional<z.ZodBoolean>;
9584
+ }, z.core.$strict>>;
9585
+ onlyRestrictedClasses: z.ZodOptional<z.ZodBoolean>;
9586
+ }, z.core.$strict>;
9587
+ description: z.ZodOptional<z.ZodString>;
9588
+ createdAt: z.ZodISODateTime;
9589
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
9590
+ }, z.core.$strict>>;
9591
+ }, z.core.$strict>;
9592
+ export type PromotionCheck = Schemas.PromotionCheck;
9593
+ declare const PromotionCheck: z.ZodObject<{
9594
+ outcome: z.ZodEnum<{
9595
+ "would-promote": "would-promote";
9596
+ "needs-approval": "needs-approval";
9597
+ "gate-failed": "gate-failed";
9598
+ }>;
9599
+ policy: z.ZodNullable<z.ZodObject<{
9600
+ id: z.ZodString;
9601
+ version: z.ZodString;
9602
+ }, z.core.$strict>>;
9603
+ checks: z.ZodArray<z.ZodObject<{
9604
+ name: z.ZodString;
9605
+ passed: z.ZodBoolean;
9606
+ message: z.ZodString;
9607
+ value: z.ZodOptional<z.ZodUnion<readonly [
9608
+ z.ZodNumber,
9609
+ z.ZodString
9610
+ ]>>;
9611
+ threshold: z.ZodOptional<z.ZodUnion<readonly [
9612
+ z.ZodNumber,
9613
+ z.ZodString
9614
+ ]>>;
9615
+ }, z.core.$strict>>;
9616
+ approval: z.ZodOptional<z.ZodObject<{
9617
+ role: z.ZodEnum<{
9618
+ standard: "standard";
9619
+ senior: "senior";
9620
+ admin: "admin";
9621
+ }>;
9622
+ count: z.ZodNumber;
9623
+ separateApprover: z.ZodBoolean;
9624
+ }, z.core.$strict>>;
9625
+ }, z.core.$strict>;
8424
9626
  export type RunProgress = Schemas.RunProgress;
8425
- export declare const RunProgress: z.ZodObject<{
9627
+ declare const RunProgress: z.ZodObject<{
8426
9628
  id: z.ZodUUID;
8427
9629
  flowId: z.ZodString;
8428
9630
  flowVersion: z.ZodString;
@@ -8439,7 +9641,7 @@ export declare const RunProgress: z.ZodObject<{
8439
9641
  completedAt: z.ZodOptional<z.ZodISODateTime>;
8440
9642
  parentRunId: z.ZodOptional<z.ZodUUID>;
8441
9643
  }, z.core.$strict>;
8442
- export type TrustedSigningKey = Schemas.TrustedSigningKey;
9644
+ type TrustedSigningKey = Schemas.TrustedSigningKey;
8443
9645
  declare const TrustedSigningKey: z.ZodObject<{
8444
9646
  keyId: z.ZodString;
8445
9647
  tenantId: z.ZodUUID;
@@ -8472,7 +9674,7 @@ declare const TrustedSigningKeyPage: z.ZodObject<{
8472
9674
  nextCursor: z.ZodOptional<z.ZodString>;
8473
9675
  hasMore: z.ZodBoolean;
8474
9676
  }, z.core.$strict>;
8475
- export type RevokeSigningKeyResult = Schemas.RevokeSigningKeyResult;
9677
+ type RevokeSigningKeyResult = Schemas.RevokeSigningKeyResult;
8476
9678
  declare const RevokeSigningKeyResult: z.ZodObject<{
8477
9679
  keyId: z.ZodString;
8478
9680
  revoked: z.ZodBoolean;
@@ -8537,6 +9739,10 @@ declare const JudgedEvalCase: z.ZodObject<{
8537
9739
  no: z.ZodNumber;
8538
9740
  yesWeight: z.ZodNumber;
8539
9741
  totalWeight: z.ZodNumber;
9742
+ restricted: z.ZodOptional<z.ZodObject<{
9743
+ yesWeight: z.ZodNumber;
9744
+ totalWeight: z.ZodNumber;
9745
+ }, z.core.$strict>>;
8540
9746
  reasons: z.ZodArray<z.ZodObject<{
8541
9747
  verdict: z.ZodEnum<{
8542
9748
  yes: "yes";
@@ -8596,6 +9802,10 @@ declare const JudgedEvalCaseCollectionPage: z.ZodObject<{
8596
9802
  no: z.ZodNumber;
8597
9803
  yesWeight: z.ZodNumber;
8598
9804
  totalWeight: z.ZodNumber;
9805
+ restricted: z.ZodOptional<z.ZodObject<{
9806
+ yesWeight: z.ZodNumber;
9807
+ totalWeight: z.ZodNumber;
9808
+ }, z.core.$strict>>;
8599
9809
  reasons: z.ZodArray<z.ZodObject<{
8600
9810
  verdict: z.ZodEnum<{
8601
9811
  yes: "yes";
@@ -9095,12 +10305,12 @@ declare const ReinstateEvalSuiteVersionResult: z.ZodObject<{
9095
10305
  wasTombstoned: z.ZodBoolean;
9096
10306
  }, z.core.$strict>;
9097
10307
  export type BlockKind = Schemas.BlockKind;
9098
- export declare const BlockKind: z.ZodEnum<{
10308
+ declare const BlockKind: z.ZodEnum<{
9099
10309
  prompt: "prompt";
9100
10310
  settings: "settings";
9101
10311
  }>;
9102
10312
  export type Block = Schemas.Block;
9103
- export declare const Block: z.ZodObject<{
10313
+ declare const Block: z.ZodObject<{
9104
10314
  id: z.ZodString;
9105
10315
  version: z.ZodString;
9106
10316
  kind: z.ZodEnum<{
@@ -9204,18 +10414,18 @@ declare const PublishBlockBody: z.ZodObject<{
9204
10414
  ]>;
9205
10415
  }, z.core.$strict>;
9206
10416
  export type PublishBlockResult = Schemas.PublishBlockResult;
9207
- export declare const PublishBlockResult: z.ZodObject<{
10417
+ declare const PublishBlockResult: z.ZodObject<{
9208
10418
  blockId: z.ZodString;
9209
10419
  version: z.ZodString;
9210
10420
  }, z.core.$strict>;
9211
10421
  export type UnregisterBlockResult = Schemas.UnregisterBlockResult;
9212
- export declare const UnregisterBlockResult: z.ZodObject<{
10422
+ declare const UnregisterBlockResult: z.ZodObject<{
9213
10423
  blockId: z.ZodString;
9214
10424
  version: z.ZodString;
9215
10425
  unregistered: z.ZodLiteral<true>;
9216
10426
  }, z.core.$strict>;
9217
10427
  export type ReinstateBlockResult = Schemas.ReinstateBlockResult;
9218
- export declare const ReinstateBlockResult: z.ZodObject<{
10428
+ declare const ReinstateBlockResult: z.ZodObject<{
9219
10429
  blockId: z.ZodString;
9220
10430
  version: z.ZodString;
9221
10431
  wasTombstoned: z.ZodBoolean;
@@ -9229,7 +10439,7 @@ declare const EvalRunStatus: z.ZodEnum<{
9229
10439
  cancelled: "cancelled";
9230
10440
  }>;
9231
10441
  export type ComparisonMetric = Schemas.ComparisonMetric;
9232
- export declare const ComparisonMetric: z.ZodObject<{
10442
+ declare const ComparisonMetric: z.ZodObject<{
9233
10443
  baseline: z.ZodNullable<z.ZodNumber>;
9234
10444
  candidate: z.ZodNullable<z.ZodNumber>;
9235
10445
  delta: z.ZodNullable<z.ZodNumber>;
@@ -9242,11 +10452,12 @@ export declare const ComparisonMetric: z.ZodObject<{
9242
10452
  spread: z.ZodOptional<z.ZodNumber>;
9243
10453
  }, z.core.$strict>;
9244
10454
  export type ComparisonCandidate = Schemas.ComparisonCandidate;
9245
- export declare const ComparisonCandidate: z.ZodUnion<readonly [
10455
+ declare const ComparisonCandidate: z.ZodUnion<readonly [
9246
10456
  z.ZodObject<{
9247
10457
  kind: z.ZodLiteral<"agent">;
9248
10458
  agentId: z.ZodString;
9249
10459
  version: z.ZodString;
10460
+ pinsDigest: z.ZodOptional<z.ZodString>;
9250
10461
  }, z.core.$strict>,
9251
10462
  z.ZodObject<{
9252
10463
  kind: z.ZodLiteral<"flow">;
@@ -9259,7 +10470,7 @@ export declare const ComparisonCandidate: z.ZodUnion<readonly [
9259
10470
  }, z.core.$strict>
9260
10471
  ]>;
9261
10472
  export type JudgedComparisonSummary = Schemas.JudgedComparisonSummary;
9262
- export declare const JudgedComparisonSummary: z.ZodObject<{
10473
+ declare const JudgedComparisonSummary: z.ZodObject<{
9263
10474
  evalRunId: z.ZodString;
9264
10475
  status: z.ZodEnum<{
9265
10476
  failed: "failed";
@@ -9276,6 +10487,7 @@ export declare const JudgedComparisonSummary: z.ZodObject<{
9276
10487
  kind: z.ZodLiteral<"agent">;
9277
10488
  agentId: z.ZodString;
9278
10489
  version: z.ZodString;
10490
+ pinsDigest: z.ZodOptional<z.ZodString>;
9279
10491
  }, z.core.$strict>,
9280
10492
  z.ZodObject<{
9281
10493
  kind: z.ZodLiteral<"flow">;
@@ -9302,8 +10514,8 @@ export declare const JudgedComparisonSummary: z.ZodObject<{
9302
10514
  agentId: z.ZodString;
9303
10515
  version: z.ZodString;
9304
10516
  via: z.ZodEnum<{
9305
- live: "live";
9306
10517
  explicit: "explicit";
10518
+ live: "live";
9307
10519
  }>;
9308
10520
  liveScope: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9309
10521
  }, z.core.$strict>
@@ -9317,9 +10529,13 @@ export declare const JudgedComparisonSummary: z.ZodObject<{
9317
10529
  errors: z.ZodNumber;
9318
10530
  stopped: z.ZodNumber;
9319
10531
  reads: z.ZodEnum<{
9320
- recorded: "recorded";
9321
10532
  live: "live";
10533
+ recorded: "recorded";
9322
10534
  }>;
10535
+ classWeights: z.ZodOptional<z.ZodEnum<{
10536
+ "as-recorded": "as-recorded";
10537
+ "restricted-only": "restricted-only";
10538
+ }>>;
9323
10539
  sampling: z.ZodObject<{
9324
10540
  models: z.ZodArray<z.ZodObject<{
9325
10541
  providerId: z.ZodString;
@@ -9368,7 +10584,7 @@ export declare const JudgedComparisonSummary: z.ZodObject<{
9368
10584
  }, z.core.$strict>;
9369
10585
  }, z.core.$strict>;
9370
10586
  export type ComparisonCaseResult = Schemas.ComparisonCaseResult;
9371
- export declare const ComparisonCaseResult: z.ZodObject<{
10587
+ declare const ComparisonCaseResult: z.ZodObject<{
9372
10588
  caseId: z.ZodString;
9373
10589
  runIds: z.ZodArray<z.ZodString>;
9374
10590
  baseline: z.ZodObject<{
@@ -9414,9 +10630,9 @@ export declare const ComparisonCaseResult: z.ZodObject<{
9414
10630
  toolVersion: z.ZodString;
9415
10631
  arguments: z.ZodUnknown;
9416
10632
  source: z.ZodEnum<{
9417
- recorded: "recorded";
9418
10633
  live: "live";
9419
10634
  refused: "refused";
10635
+ recorded: "recorded";
9420
10636
  }>;
9421
10637
  reason: z.ZodOptional<z.ZodString>;
9422
10638
  }, z.core.$strict>>>;
@@ -9432,7 +10648,7 @@ export declare const ComparisonCaseResult: z.ZodObject<{
9432
10648
  }, z.core.$strict>>;
9433
10649
  }, z.core.$strict>;
9434
10650
  export type JudgedComparisonResult = Schemas.JudgedComparisonResult;
9435
- export declare const JudgedComparisonResult: z.ZodObject<{
10651
+ declare const JudgedComparisonResult: z.ZodObject<{
9436
10652
  summary: z.ZodObject<{
9437
10653
  evalRunId: z.ZodString;
9438
10654
  status: z.ZodEnum<{
@@ -9450,6 +10666,7 @@ export declare const JudgedComparisonResult: z.ZodObject<{
9450
10666
  kind: z.ZodLiteral<"agent">;
9451
10667
  agentId: z.ZodString;
9452
10668
  version: z.ZodString;
10669
+ pinsDigest: z.ZodOptional<z.ZodString>;
9453
10670
  }, z.core.$strict>,
9454
10671
  z.ZodObject<{
9455
10672
  kind: z.ZodLiteral<"flow">;
@@ -9476,8 +10693,8 @@ export declare const JudgedComparisonResult: z.ZodObject<{
9476
10693
  agentId: z.ZodString;
9477
10694
  version: z.ZodString;
9478
10695
  via: z.ZodEnum<{
9479
- live: "live";
9480
10696
  explicit: "explicit";
10697
+ live: "live";
9481
10698
  }>;
9482
10699
  liveScope: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9483
10700
  }, z.core.$strict>
@@ -9491,9 +10708,13 @@ export declare const JudgedComparisonResult: z.ZodObject<{
9491
10708
  errors: z.ZodNumber;
9492
10709
  stopped: z.ZodNumber;
9493
10710
  reads: z.ZodEnum<{
9494
- recorded: "recorded";
9495
10711
  live: "live";
10712
+ recorded: "recorded";
9496
10713
  }>;
10714
+ classWeights: z.ZodOptional<z.ZodEnum<{
10715
+ "as-recorded": "as-recorded";
10716
+ "restricted-only": "restricted-only";
10717
+ }>>;
9497
10718
  sampling: z.ZodObject<{
9498
10719
  models: z.ZodArray<z.ZodObject<{
9499
10720
  providerId: z.ZodString;
@@ -9587,9 +10808,9 @@ export declare const JudgedComparisonResult: z.ZodObject<{
9587
10808
  toolVersion: z.ZodString;
9588
10809
  arguments: z.ZodUnknown;
9589
10810
  source: z.ZodEnum<{
9590
- recorded: "recorded";
9591
10811
  live: "live";
9592
10812
  refused: "refused";
10813
+ recorded: "recorded";
9593
10814
  }>;
9594
10815
  reason: z.ZodOptional<z.ZodString>;
9595
10816
  }, z.core.$strict>>>;
@@ -9651,13 +10872,16 @@ declare const EvalRun: z.ZodObject<{
9651
10872
  z.ZodObject<{
9652
10873
  live: z.ZodObject<{
9653
10874
  projectId: z.ZodOptional<z.ZodString>;
9654
- segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10875
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
10876
+ key: z.ZodString;
10877
+ value: z.ZodString;
10878
+ }, z.core.$strict>>>;
9655
10879
  }, z.core.$strict>;
9656
10880
  }, z.core.$strict>
9657
10881
  ]>;
9658
10882
  reads: z.ZodEnum<{
9659
- recorded: "recorded";
9660
10883
  live: "live";
10884
+ recorded: "recorded";
9661
10885
  }>;
9662
10886
  repetitions: z.ZodNumber;
9663
10887
  k: z.ZodNumber;
@@ -9665,6 +10889,10 @@ declare const EvalRun: z.ZodObject<{
9665
10889
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9666
10890
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9667
10891
  }, z.core.$strict>>;
10892
+ classWeights: z.ZodOptional<z.ZodEnum<{
10893
+ "as-recorded": "as-recorded";
10894
+ "restricted-only": "restricted-only";
10895
+ }>>;
9668
10896
  }, z.core.$strict>>;
9669
10897
  }, z.core.$strict>;
9670
10898
  export type EvalRunCollectionPage = Schemas.EvalRunCollectionPage;
@@ -9714,13 +10942,16 @@ declare const EvalRunCollectionPage: z.ZodObject<{
9714
10942
  z.ZodObject<{
9715
10943
  live: z.ZodObject<{
9716
10944
  projectId: z.ZodOptional<z.ZodString>;
9717
- segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10945
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
10946
+ key: z.ZodString;
10947
+ value: z.ZodString;
10948
+ }, z.core.$strict>>>;
9718
10949
  }, z.core.$strict>;
9719
10950
  }, z.core.$strict>
9720
10951
  ]>;
9721
10952
  reads: z.ZodEnum<{
9722
- recorded: "recorded";
9723
10953
  live: "live";
10954
+ recorded: "recorded";
9724
10955
  }>;
9725
10956
  repetitions: z.ZodNumber;
9726
10957
  k: z.ZodNumber;
@@ -9728,6 +10959,10 @@ declare const EvalRunCollectionPage: z.ZodObject<{
9728
10959
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9729
10960
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9730
10961
  }, z.core.$strict>>;
10962
+ classWeights: z.ZodOptional<z.ZodEnum<{
10963
+ "as-recorded": "as-recorded";
10964
+ "restricted-only": "restricted-only";
10965
+ }>>;
9731
10966
  }, z.core.$strict>>;
9732
10967
  }, z.core.$strict>>;
9733
10968
  nextCursor: z.ZodOptional<z.ZodString>;
@@ -9755,13 +10990,16 @@ declare const StartEvalRunBody: z.ZodObject<{
9755
10990
  z.ZodObject<{
9756
10991
  live: z.ZodObject<{
9757
10992
  projectId: z.ZodOptional<z.ZodString>;
9758
- segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10993
+ segments: z.ZodOptional<z.ZodArray<z.ZodObject<{
10994
+ key: z.ZodString;
10995
+ value: z.ZodString;
10996
+ }, z.core.$strict>>>;
9759
10997
  }, z.core.$strict>;
9760
10998
  }, z.core.$strict>
9761
10999
  ]>>;
9762
11000
  reads: z.ZodOptional<z.ZodEnum<{
9763
- recorded: "recorded";
9764
11001
  live: "live";
11002
+ recorded: "recorded";
9765
11003
  }>>;
9766
11004
  repetitions: z.ZodOptional<z.ZodNumber>;
9767
11005
  k: z.ZodOptional<z.ZodNumber>;
@@ -9769,6 +11007,10 @@ declare const StartEvalRunBody: z.ZodObject<{
9769
11007
  tools: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9770
11008
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9771
11009
  }, z.core.$strict>>;
11010
+ classWeights: z.ZodOptional<z.ZodEnum<{
11011
+ "as-recorded": "as-recorded";
11012
+ "restricted-only": "restricted-only";
11013
+ }>>;
9772
11014
  }, z.core.$strict>;
9773
11015
  export type StartEvalRunResult = Schemas.StartEvalRunResult;
9774
11016
  declare const StartEvalRunResult: z.ZodObject<{
@@ -9828,6 +11070,7 @@ declare const IdentityProviderCollectionPage: z.ZodObject<{
9828
11070
  }, z.core.$strict>>;
9829
11071
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
9830
11072
  }, z.core.$strict>>;
11073
+ hasMore: z.ZodOptional<z.ZodBoolean>;
9831
11074
  }, z.core.$strict>;
9832
11075
  export type RegisterIdentityProviderResult = Schemas.RegisterIdentityProviderResult;
9833
11076
  declare const RegisterIdentityProviderResult: z.ZodObject<{
@@ -10453,8 +11696,8 @@ declare const Tenant$1: z.ZodObject<{
10453
11696
  export type TenantConfigKind = Schemas.TenantConfigKind;
10454
11697
  declare const TenantConfigKind: z.ZodEnum<{
10455
11698
  env: "env";
10456
- config: "config";
10457
11699
  secret: "secret";
11700
+ config: "config";
10458
11701
  }>;
10459
11702
  export type TenantConfigCollectionPage = Schemas.TenantConfigCollectionPage;
10460
11703
  declare const TenantConfigCollectionPage: z.ZodObject<{
@@ -10462,8 +11705,8 @@ declare const TenantConfigCollectionPage: z.ZodObject<{
10462
11705
  tenantId: z.ZodString;
10463
11706
  kind: z.ZodEnum<{
10464
11707
  env: "env";
10465
- config: "config";
10466
11708
  secret: "secret";
11709
+ config: "config";
10467
11710
  }>;
10468
11711
  key: z.ZodString;
10469
11712
  value: z.ZodString;
@@ -10478,8 +11721,8 @@ export type UpsertTenantConfigBody = Schemas.UpsertTenantConfigBody;
10478
11721
  declare const UpsertTenantConfigBody: z.ZodObject<{
10479
11722
  kind: z.ZodEnum<{
10480
11723
  env: "env";
10481
- config: "config";
10482
11724
  secret: "secret";
11725
+ config: "config";
10483
11726
  }>;
10484
11727
  key: z.ZodString;
10485
11728
  value: z.ZodString;
@@ -10492,8 +11735,8 @@ declare const UpsertTenantConfigResult: z.ZodObject<{
10492
11735
  tenantId: z.ZodString;
10493
11736
  kind: z.ZodEnum<{
10494
11737
  env: "env";
10495
- config: "config";
10496
11738
  secret: "secret";
11739
+ config: "config";
10497
11740
  }>;
10498
11741
  key: z.ZodString;
10499
11742
  value: z.ZodString;
@@ -10693,12 +11936,12 @@ declare const WebhookTriggerUnregisterResult: z.ZodObject<{
10693
11936
  triggerId: z.ZodString;
10694
11937
  unregistered: z.ZodBoolean;
10695
11938
  }, z.core.$strict>;
10696
- export type WebhookSecretRef = Schemas.WebhookSecretRef;
11939
+ type WebhookSecretRef = Schemas.WebhookSecretRef;
10697
11940
  declare const WebhookSecretRef: z.ZodObject<{
10698
11941
  envName: z.ZodString;
10699
11942
  name: z.ZodString;
10700
11943
  }, z.core.$strict>;
10701
- export type WebhookEndpoint = Schemas.WebhookEndpoint;
11944
+ type WebhookEndpoint = Schemas.WebhookEndpoint;
10702
11945
  declare const WebhookEndpoint: z.ZodObject<{
10703
11946
  endpointId: z.ZodString;
10704
11947
  url: z.ZodURL;
@@ -10716,7 +11959,7 @@ declare const WebhookEndpoint: z.ZodObject<{
10716
11959
  createdAt: z.ZodISODateTime;
10717
11960
  updatedAt: z.ZodISODateTime;
10718
11961
  }, z.core.$strict>;
10719
- export type GeneratedWebhookSecret = Schemas.GeneratedWebhookSecret;
11962
+ type GeneratedWebhookSecret = Schemas.GeneratedWebhookSecret;
10720
11963
  declare const GeneratedWebhookSecret: z.ZodObject<{
10721
11964
  secret: z.ZodString;
10722
11965
  }, z.core.$strict>;
@@ -10777,7 +12020,7 @@ declare const WebhookEndpointUnregisterResult: z.ZodObject<{
10777
12020
  endpointId: z.ZodString;
10778
12021
  unregistered: z.ZodBoolean;
10779
12022
  }, z.core.$strict>;
10780
- export type RunFinishedEvent = Schemas.RunFinishedEvent;
12023
+ type RunFinishedEvent = Schemas.RunFinishedEvent;
10781
12024
  declare const RunFinishedEvent: z.ZodObject<{
10782
12025
  id: z.ZodString;
10783
12026
  type: z.ZodLiteral<"run.finished">;
@@ -10811,7 +12054,7 @@ declare const RunFinishedEvent: z.ZodObject<{
10811
12054
  }, z.core.$strict>;
10812
12055
  }, z.core.$strict>;
10813
12056
  }, z.core.$strict>;
10814
- export type WebhookTestEvent = Schemas.WebhookTestEvent;
12057
+ type WebhookTestEvent = Schemas.WebhookTestEvent;
10815
12058
  declare const WebhookTestEvent: z.ZodObject<{
10816
12059
  id: z.ZodString;
10817
12060
  type: z.ZodLiteral<"webhook.test">;
@@ -10820,7 +12063,7 @@ declare const WebhookTestEvent: z.ZodObject<{
10820
12063
  endpointId: z.ZodString;
10821
12064
  }, z.core.$strict>;
10822
12065
  }, z.core.$strict>;
10823
- export type WebhookEvent = Schemas.WebhookEvent;
12066
+ type WebhookEvent = Schemas.WebhookEvent;
10824
12067
  declare const WebhookEvent: z.ZodDiscriminatedUnion<[
10825
12068
  z.ZodObject<{
10826
12069
  id: z.ZodString;
@@ -10864,13 +12107,13 @@ declare const WebhookEvent: z.ZodDiscriminatedUnion<[
10864
12107
  type: z.ZodLiteral<"webhook.test">;
10865
12108
  }, z.core.$strict>
10866
12109
  ], "type">;
10867
- export type WebhookDeliveryStatus = Schemas.WebhookDeliveryStatus;
12110
+ type WebhookDeliveryStatus = Schemas.WebhookDeliveryStatus;
10868
12111
  declare const WebhookDeliveryStatus: z.ZodEnum<{
10869
12112
  pending: "pending";
10870
12113
  failed: "failed";
10871
12114
  delivered: "delivered";
10872
12115
  }>;
10873
- export type WebhookDelivery = Schemas.WebhookDelivery;
12116
+ type WebhookDelivery = Schemas.WebhookDelivery;
10874
12117
  declare const WebhookDelivery: z.ZodObject<{
10875
12118
  deliveryId: z.ZodString;
10876
12119
  endpointId: z.ZodString;
@@ -11024,9 +12267,16 @@ export interface AgentsClient {
11024
12267
  /** @wire GET /v1/agents/:agentId — latest active version */
11025
12268
  get(agentId: AgentId): Promise<Agent$1>;
11026
12269
  readonly versions: AgentVersionsClient;
12270
+ /** Which version runs where: live versions per scope, rollback and unpin. */
12271
+ readonly live: AgentLiveClient;
12272
+ /** Making a version live for a scope, and the history of those changes. */
12273
+ readonly promotions: AgentPromotionsClient;
12274
+ /** The gate policy a promotion for a scope is checked against. */
12275
+ readonly gatePolicy: AgentGatePolicyClient;
11027
12276
  /**
11028
12277
  * Un-tombstone a specific previously-unregistered version.
11029
12278
  *
12279
+ * @deprecated Use `agents.versions.reinstate`; removed in 0.2.
11030
12280
  * @wire POST /v1/agents/:agentId/versions/:version/reinstate
11031
12281
  */
11032
12282
  reinstateVersion(agentId: AgentId, version: Semver, options?: MutationOptions): Promise<ReinstateAgentVersionResult>;
@@ -11038,12 +12288,19 @@ export interface AgentVersionsClient {
11038
12288
  get(agentId: AgentId, version: Semver): Promise<Agent$1>;
11039
12289
  /**
11040
12290
  * Tombstone a specific version. Reversible via
11041
- * `agents.reinstateVersion`. Unregistering an unknown or
12291
+ * `agents.versions.reinstate`. Unregistering an unknown or
11042
12292
  * already-tombstoned version fails with `404 agent-not-found`.
11043
12293
  *
11044
12294
  * @wire POST /v1/agents/:agentId/versions/:version/unregister
11045
12295
  */
11046
12296
  unregister(agentId: AgentId, version: Semver, options?: MutationOptions): Promise<UnregisterAgentResult>;
12297
+ /**
12298
+ * Un-tombstone a specific previously-unregistered version. Idempotent:
12299
+ * reinstating an active version returns `wasTombstoned: false`.
12300
+ *
12301
+ * @wire POST /v1/agents/:agentId/versions/:version/reinstate
12302
+ */
12303
+ reinstate(agentId: AgentId, version: Semver, options?: MutationOptions): Promise<ReinstateAgentVersionResult>;
11047
12304
  /**
11048
12305
  * Derive a new version from a pinned one with some data-block pins
11049
12306
  * swapped (an expert's edit, no code change). Numbered the next free
@@ -11055,6 +12312,104 @@ export interface AgentVersionsClient {
11055
12312
  }
11056
12313
  /** Body of `POST /v1/agents/{agentId}/versions`. */
11057
12314
  export type DeriveAgentVersionInput = DeriveAgentVersionBody;
12315
+ /**
12316
+ * Live versions. A run that doesn't name its version uses the live
12317
+ * version of the most specific scope that has one (segment path,
12318
+ * project, org, tenant), else the latest registered version.
12319
+ */
12320
+ export interface AgentLiveClient {
12321
+ /**
12322
+ * The version a run would use for a project and segment path, and why
12323
+ * (`via: 'live'` with the scope, or `via: 'latest'`).
12324
+ *
12325
+ * @wire GET /v1/agents/:agentId/live
12326
+ */
12327
+ resolve(agentId: AgentId | string, where?: LiveWhere): Promise<LiveVersionResolution>;
12328
+ /** @wire GET /v1/agents/:agentId/live-versions — every scope with a pin */
12329
+ list(agentId: AgentId | string): Promise<LivePinList>;
12330
+ /**
12331
+ * Back to the scope's previous live version, or `toVersion`.
12332
+ * `409 nothing-to-roll-back` when there is none; `409 not-pinned`
12333
+ * when the scope has no pin.
12334
+ *
12335
+ * @wire POST /v1/agents/:agentId/live/rollback
12336
+ */
12337
+ rollback(agentId: AgentId | string, input: RollbackLiveInput, options?: MutationOptions): Promise<Promotion>;
12338
+ /**
12339
+ * Remove the scope's own pin: its runs use the next scope up.
12340
+ * `409 not-pinned` when it has none.
12341
+ *
12342
+ * @wire POST /v1/agents/:agentId/live/unpin
12343
+ */
12344
+ unpin(agentId: AgentId | string, input: UnpinLiveInput, options?: MutationOptions): Promise<Promotion>;
12345
+ }
12346
+ export interface AgentPromotionsClient {
12347
+ /**
12348
+ * Make `version` live for `scope`, from the next run. Open
12349
+ * conversations keep their version. `404 agent-version-not-found`
12350
+ * when the version isn't registered and active.
12351
+ *
12352
+ * With a gate policy for the scope, the promotion is checked first,
12353
+ * against the comparison named by `evalRunId`. The answer's `status`
12354
+ * says what happened: `promoted`, or `pending-approval` (a reviewer
12355
+ * must approve it; `approvalId`). A refusal throws a `KindgiApiError`
12356
+ * whose `error.serverCode` is `gate-failed`, with `promotionId`,
12357
+ * `policy` and every check in `error.fields`.
12358
+ *
12359
+ * @wire POST /v1/agents/:agentId/promotions
12360
+ */
12361
+ create(agentId: AgentId | string, input: PromoteInput, options?: MutationOptions): Promise<Promotion>;
12362
+ /**
12363
+ * What `create` with the same input would do, recording nothing:
12364
+ * `would-promote`, `needs-approval` (with the approval it needs) or
12365
+ * `gate-failed`, with every check.
12366
+ *
12367
+ * @wire POST /v1/agents/:agentId/promotions/check
12368
+ */
12369
+ check(agentId: AgentId | string, input: PromoteInput): Promise<PromotionCheck>;
12370
+ /** @wire GET /v1/agents/:agentId/promotions — newest first */
12371
+ list(agentId: AgentId | string, filter?: ListPromotionsFilter): Promise<PromotionPage>;
12372
+ /** @wire GET /v1/agents/:agentId/promotions/:promotionId */
12373
+ get(agentId: AgentId | string, promotionId: string): Promise<Promotion>;
12374
+ }
12375
+ export interface AgentGatePolicyClient {
12376
+ /**
12377
+ * The gate policy a promotion for `scope` is checked against: the most
12378
+ * specific scope with one, at its latest active version; `policy: null`
12379
+ * when none applies.
12380
+ *
12381
+ * @wire GET /v1/agents/:agentId/gate-policy
12382
+ */
12383
+ resolve(agentId: AgentId | string, scope: LiveScope): Promise<GatePolicyResolution>;
12384
+ }
12385
+ /** Where a run would happen: its project and segment path (coarse to fine). */
12386
+ export interface LiveWhere {
12387
+ readonly projectId?: string;
12388
+ readonly segments?: readonly ScopeSegment[];
12389
+ }
12390
+ export interface PromoteInput {
12391
+ readonly version: string;
12392
+ readonly scope: LiveScope;
12393
+ readonly reason?: string;
12394
+ /** The eval run behind the decision, kept on the record. */
12395
+ readonly evalRunId?: string;
12396
+ }
12397
+ export interface RollbackLiveInput {
12398
+ readonly scope: LiveScope;
12399
+ /** An earlier version to go back to; default: the scope's previous live version. */
12400
+ readonly toVersion?: string;
12401
+ readonly reason?: string;
12402
+ }
12403
+ export interface UnpinLiveInput {
12404
+ readonly scope: LiveScope;
12405
+ readonly reason?: string;
12406
+ }
12407
+ export interface ListPromotionsFilter {
12408
+ /** Only this scope's history. */
12409
+ readonly scope?: LiveScope;
12410
+ readonly limit?: number;
12411
+ readonly cursor?: string;
12412
+ }
11058
12413
  export interface ListAgentsFilter {
11059
12414
  readonly limit?: number;
11060
12415
  readonly cursor?: string;
@@ -11108,7 +12463,7 @@ export interface ApprovalsClient {
11108
12463
  * @wire `GET /v1/approvals` — see
11109
12464
  * `@kindgi/api/openapi.json#/paths/~1v1~1approvals/get`. Role-scoped.
11110
12465
  */
11111
- list(filter?: ApprovalFilter): Promise<Page<Approval>>;
12466
+ list(filter?: ApprovalFilter): Promise<ListPage<Approval>>;
11112
12467
  /**
11113
12468
  * @wire `GET /v1/approvals/{approvalId}` — see
11114
12469
  * `@kindgi/api/openapi.json#/paths/~1v1~1approvals~1{approvalId}/get`.
@@ -11172,7 +12527,7 @@ export interface ReviewersClient {
11172
12527
  * @wire `GET /v1/approvals/reviewers` — see
11173
12528
  * `@kindgi/api/openapi.json#/paths/~1v1~1approvals~1reviewers/get`.
11174
12529
  */
11175
- list(filter?: ReviewerFilter): Promise<Page<Reviewer>>;
12530
+ list(filter?: ReviewerFilter): Promise<ListPage<Reviewer>>;
11176
12531
  /**
11177
12532
  * @wire `GET /v1/approvals/reviewers/{reviewerId}` — see
11178
12533
  * `@kindgi/api/openapi.json#/paths/~1v1~1approvals~1reviewers~1{reviewerId}/get`.
@@ -11225,7 +12580,7 @@ export interface AuditClient {
11225
12580
  * @unwired The API has no `GET /v1/audit-bundles` route — bundles
11226
12581
  * are not stored server-side (see `get`).
11227
12582
  */
11228
- list(filter?: Filter): Promise<Page<AuditBundleMeta>>;
12583
+ list(filter?: Filter): Promise<ListPage<AuditBundleMeta>>;
11229
12584
  /**
11230
12585
  * Verify a bundle's Ed25519 signature client-side.
11231
12586
  *
@@ -11246,6 +12601,11 @@ export interface ApprovalFilter extends Omit<Filter<ApprovalStatus>, "status"> {
11246
12601
  readonly requiredRole?: ReviewerRole$1;
11247
12602
  /** ISO 8601 timestamp — return approvals created strictly after this. */
11248
12603
  readonly createdAfter?: Timestamp;
12604
+ /**
12605
+ * Only approvals linked to one of these run waits (an approval's
12606
+ * `waitTokenId`; a run's journal names its open waits). At most 50.
12607
+ */
12608
+ readonly waitTokenIds?: readonly string[];
11249
12609
  }
11250
12610
  export interface ReviewerFilter extends Filter {
11251
12611
  /** Filter reviewers by role class. */
@@ -11313,7 +12673,7 @@ export interface ArtifactsClient {
11313
12673
  * @wire `GET /v1/artifacts` — see
11314
12674
  * `@kindgi/api/openapi.json#/paths/~1v1~1artifacts/get`.
11315
12675
  */
11316
- list(filter?: ArtifactFilter): Promise<Page<BlobMeta>>;
12676
+ list(filter?: ArtifactFilter): Promise<ListPage<BlobMeta>>;
11317
12677
  /**
11318
12678
  * Delete an artifact. First delete returns `deleted: true`; a repeat
11319
12679
  * against an already-gone id returns `deleted: false` (idempotent —
@@ -11379,6 +12739,8 @@ export interface ListAuthzDecisionsFilter {
11379
12739
  readonly runId?: string;
11380
12740
  readonly from?: string;
11381
12741
  readonly to?: string;
12742
+ /** `asc` (absent): oldest first. `desc`: newest first. */
12743
+ readonly order?: "asc" | "desc";
11382
12744
  }
11383
12745
  export interface AuthzAuditClient {
11384
12746
  /** @wire GET /v1/audit/authz */
@@ -11387,7 +12749,10 @@ export interface AuthzAuditClient {
11387
12749
  export interface AuditResourceClient {
11388
12750
  readonly authz: AuthzAuditClient;
11389
12751
  }
11390
- export type IdentityProviderPage = IdentityProviderCollectionPage;
12752
+ /** Every identity provider: the list comes whole, so `hasMore` is `false`. */
12753
+ export interface IdentityProviderPage extends IdentityProviderCollectionPage {
12754
+ readonly hasMore: boolean;
12755
+ }
11391
12756
  export type IdentityProviderRegisterInput = IdentityProviderConfig;
11392
12757
  export type IdentityProviderRegisterOutcome = RegisterIdentityProviderResult;
11393
12758
  export type IdentityProviderUnregisterOutcome = UnregisterIdentityProviderResult;
@@ -11528,7 +12893,7 @@ export interface CapabilitiesClient {
11528
12893
  * @wire `GET /v1/capabilities` — see
11529
12894
  * `@kindgi/api/openapi.json#/paths/~1v1~1capabilities/get`.
11530
12895
  */
11531
- list(filter?: CapabilityFilter): Promise<Page<CapabilityDeclaration>>;
12896
+ list(filter?: CapabilityFilter): Promise<ListPage<CapabilityDeclaration>>;
11532
12897
  /**
11533
12898
  * Fetch a single capability declaration by id.
11534
12899
  *
@@ -11543,14 +12908,14 @@ export interface CapabilitiesClient {
11543
12908
  route(needs: readonly CapabilityNeed[]): Promise<RouteResult>;
11544
12909
  readonly providers: ProvidersClient;
11545
12910
  }
11546
- export interface ProvidersClient {
12911
+ interface ProvidersClient {
11547
12912
  /**
11548
12913
  * Paginated list of registered providers.
11549
12914
  *
11550
12915
  * @wire `GET /v1/providers` — see
11551
12916
  * `@kindgi/api/openapi.json#/paths/~1v1~1providers/get`.
11552
12917
  */
11553
- list(filter?: ProviderFilter): Promise<Page<LegacyCapabilitiesProvider>>;
12918
+ list(filter?: ProviderFilter): Promise<ListPage<LegacyCapabilitiesProvider>>;
11554
12919
  /**
11555
12920
  * @wire `GET /v1/providers/{providerId}` — see
11556
12921
  * `@kindgi/api/openapi.json#/paths/~1v1~1providers~1{providerId}/get`.
@@ -11654,9 +13019,9 @@ export interface EvidenceClient {
11654
13019
  * Flow:
11655
13020
  * 1. `open()` — establishes the thread; returns the full
11656
13021
  * `Conversation` row (wire returns 201 with the row body).
11657
- * 2. Each turn: `runs.start({ agent, input, conversation })` — the
11658
- * SDK's runs surface accepts a conversation reference so the
11659
- * turn appends to the same thread.
13022
+ * 2. Each turn: `runs.start({ agent, input: { userMessage,
13023
+ * conversationId } })` — an agent run's input names the
13024
+ * conversation, and the turn appends to it.
11660
13025
  * 3. `messages(id)` — read the accumulated message history.
11661
13026
  * 4. `close(id)` — freezes the thread; subsequent turns rejected.
11662
13027
  *
@@ -11688,7 +13053,7 @@ export interface ConversationsClient {
11688
13053
  * @wire `GET /v1/conversations` — see
11689
13054
  * `@kindgi/api/openapi.json#/paths/~1v1~1conversations/get`.
11690
13055
  */
11691
- list(filter?: ConversationFilter): Promise<Page<Conversation>>;
13056
+ list(filter?: ConversationFilter): Promise<ListPage<Conversation>>;
11692
13057
  /**
11693
13058
  * Close a conversation. Idempotent on already-closed threads — the
11694
13059
  * wire returns the current row unchanged in that case (no error, no
@@ -11715,7 +13080,7 @@ export interface ConversationsClient {
11715
13080
  * `role` / `sinceTurn` are accepted but have no effect: the SDK does
11716
13081
  * not send them and the API does not filter by them.
11717
13082
  */
11718
- messages(id: ThreadId, filter?: MessageFilter): Promise<Page<ConversationMessage$1>>;
13083
+ messages(id: ThreadId, filter?: MessageFilter): Promise<ListPage<ConversationMessage$1>>;
11719
13084
  }
11720
13085
  export interface ConversationFilter extends Omit<Filter<ConversationStatus>, "status"> {
11721
13086
  /**
@@ -11727,6 +13092,12 @@ export interface ConversationFilter extends Omit<Filter<ConversationStatus>, "st
11727
13092
  readonly scope?: ScopeRef;
11728
13093
  readonly agent?: AgentId;
11729
13094
  readonly participantId?: string;
13095
+ /**
13096
+ * Replay conversations (a comparison's replays, `metadata.replayOf`):
13097
+ * left out by default (`exclude`); `include` lists them with the
13098
+ * others, `only` lists just them.
13099
+ */
13100
+ readonly replays?: "exclude" | "include" | "only";
11730
13101
  }
11731
13102
  export interface MessageFilter extends Filter {
11732
13103
  readonly role?: MessageRole$1;
@@ -11755,7 +13126,7 @@ export interface UsageClient {
11755
13126
  * @wire `GET /v1/cost/records` — see
11756
13127
  * `@kindgi/api/openapi.json#/paths/~1v1~1cost~1records/get`.
11757
13128
  */
11758
- query(filter?: CostRecordFilter): Promise<Page<CostRecord>>;
13129
+ query(filter?: CostRecordFilter): Promise<ListPage<CostRecord>>;
11759
13130
  /**
11760
13131
  * Fetch a single cost record.
11761
13132
  *
@@ -11781,6 +13152,13 @@ export interface UsageSummaryInput extends Omit<CostRecordFilter, "from" | "to"
11781
13152
  /** Exclusive. */
11782
13153
  readonly to: Timestamp;
11783
13154
  readonly groupBy?: readonly CostGroupDimension[];
13155
+ /**
13156
+ * The most groups to return: the most expensive ones, highest first.
13157
+ * 1 to 10000; the server's default is 1000. When there were more, the
13158
+ * result's `truncated` is `true` and `totalGroups` says how many; the
13159
+ * totals still cover every record.
13160
+ */
13161
+ readonly limit?: number;
11784
13162
  }
11785
13163
  export interface BudgetsClient {
11786
13164
  /**
@@ -11910,6 +13288,8 @@ export interface EnvRecord {
11910
13288
  }
11911
13289
  export interface EnvListPage {
11912
13290
  readonly data: readonly EnvRecord[];
13291
+ /** Whether there's another page (`nextCursor` names it). */
13292
+ readonly hasMore: boolean;
11913
13293
  readonly nextCursor?: Cursor;
11914
13294
  }
11915
13295
  /**
@@ -12138,13 +13518,13 @@ export interface EventsClient {
12138
13518
  /**
12139
13519
  * @unwired The API has no `GET /v1/events` route for event history.
12140
13520
  */
12141
- query(filter?: EventListFilter): Promise<Page<Event$1>>;
13521
+ query(filter?: EventListFilter): Promise<ListPage<Event$1>>;
12142
13522
  }
12143
13523
  export interface SubscriptionsClient {
12144
13524
  /**
12145
13525
  * @unwired The API has no `GET /v1/events/subscriptions` route.
12146
13526
  */
12147
- list(): Promise<Page<Subscription>>;
13527
+ list(): Promise<ListPage<Subscription>>;
12148
13528
  /**
12149
13529
  * @unwired The API has no `GET /v1/events/subscriptions/{id}` route.
12150
13530
  */
@@ -12208,44 +13588,67 @@ export interface FlowsClient {
12208
13588
  * @wire `GET /v1/flows` — see
12209
13589
  * `@kindgi/api/openapi.json#/paths/~1v1~1flows/get`.
12210
13590
  */
12211
- list(filter?: FlowFilter): Promise<Page<Flow>>;
13591
+ list(filter?: FlowFilter): Promise<ListPage<Flow>>;
13592
+ /**
13593
+ * A flow's versions: list, get, unregister and reinstate. Calling it
13594
+ * directly lists them (deprecated: use `flows.versions.list`).
13595
+ */
13596
+ readonly versions: FlowVersionsClient;
13597
+ /** @deprecated Use `flows.versions.get`; removed in 0.2. */
13598
+ getVersion(id: FlowId, version: string): Promise<Flow>;
13599
+ /** @deprecated Use `flows.versions.unregister`; removed in 0.2. */
13600
+ delete(id: FlowId, version: string, options?: {
13601
+ readonly idempotencyKey?: string;
13602
+ }): Promise<void>;
13603
+ /** @deprecated Use `flows.versions.reinstate`; removed in 0.2. */
13604
+ reinstateVersion(id: FlowId, version: string, options?: {
13605
+ readonly idempotencyKey?: string;
13606
+ }): Promise<ReinstateFlowVersionResult>;
13607
+ }
13608
+ export interface FlowVersionsClient {
13609
+ /** @deprecated Use `flows.versions.list`; removed in 0.2. */
13610
+ (id: FlowId, filter?: PageFilter): Promise<ListPage<Flow>>;
12212
13611
  /**
12213
13612
  * Historical versions of a flow.id.
12214
13613
  *
12215
13614
  * @wire `GET /v1/flows/{flowId}/versions` — see
12216
13615
  * `@kindgi/api/openapi.json#/paths/~1v1~1flows~1{flowId}~1versions/get`.
12217
13616
  */
12218
- versions(id: FlowId, filter?: PageFilter): Promise<Page<Flow>>;
13617
+ list(id: FlowId, filter?: PageFilter): Promise<ListPage<Flow>>;
12219
13618
  /**
12220
13619
  * Fetch a specific version of a flow.
12221
13620
  *
12222
13621
  * @wire `GET /v1/flows/{flowId}/versions/{version}` — see
12223
13622
  * `@kindgi/api/openapi.json#/paths/~1v1~1flows~1{flowId}~1versions~1{version}/get`.
12224
13623
  */
12225
- getVersion(id: FlowId, version: string): Promise<Flow>;
13624
+ get(id: FlowId, version: string): Promise<Flow>;
12226
13625
  /**
12227
13626
  * Unregister a specific version (an explicit version is required —
12228
13627
  * flows are versioned). Historical runs remain in the journal; only
12229
13628
  * future `runs.start` calls against this `(flowId, version)` fail
12230
- * with `not-found/flow`.
13629
+ * with `not-found/flow`. Reversible via `flows.versions.reinstate`.
12231
13630
  *
12232
13631
  * @wire `POST /v1/flows/{flowId}/versions/{version}/unregister` —
12233
13632
  * see `@kindgi/api/openapi.json#/paths/~1v1~1flows~1{flowId}~1versions~1{version}~1unregister/post`.
12234
13633
  */
12235
- delete(id: FlowId, version: string, options?: {
13634
+ unregister(id: FlowId, version: string, options?: {
12236
13635
  readonly idempotencyKey?: string;
12237
- }): Promise<void>;
13636
+ }): Promise<UnregisterFlowVersionResult>;
12238
13637
  /**
12239
- * Un-tombstone a previously-unregistered version — the reverse of
12240
- * `delete`. Idempotent — reinstating an active version returns
12241
- * `wasTombstoned: false`.
13638
+ * Un-tombstone a previously-unregistered version. Idempotent —
13639
+ * reinstating an active version returns `wasTombstoned: false`.
12242
13640
  *
12243
13641
  * @wire `POST /v1/flows/{flowId}/versions/{version}/reinstate`
12244
13642
  */
12245
- reinstateVersion(id: FlowId, version: string, options?: {
13643
+ reinstate(id: FlowId, version: string, options?: {
12246
13644
  readonly idempotencyKey?: string;
12247
13645
  }): Promise<ReinstateFlowVersionResult>;
12248
13646
  }
13647
+ export interface UnregisterFlowVersionResult {
13648
+ readonly flowId: FlowId;
13649
+ readonly version: string;
13650
+ readonly unregistered: boolean;
13651
+ }
12249
13652
  export interface ReinstateFlowVersionResult {
12250
13653
  readonly flowId: FlowId;
12251
13654
  readonly version: string;
@@ -12272,6 +13675,56 @@ export interface FlowValidateResult {
12272
13675
  readonly message: string;
12273
13676
  }[];
12274
13677
  }
13678
+ /**
13679
+ * Gate policies (evals step 4b): what a promotion of an agent must show
13680
+ * before a version goes live for a scope. One policy per agent and scope;
13681
+ * the caller names the policy and its semver versions. Writes need
13682
+ * `admin` on the tenant.
13683
+ */
13684
+ export interface GatePoliciesClient {
13685
+ /**
13686
+ * Each policy's latest active version.
13687
+ *
13688
+ * @wire GET /v1/gate-policies
13689
+ */
13690
+ list(filter?: GatePolicyFilter): Promise<GatePolicyPage>;
13691
+ /**
13692
+ * The policy's latest active version.
13693
+ *
13694
+ * @wire GET /v1/gate-policies/:policyId
13695
+ */
13696
+ get(policyId: string): Promise<GatePolicy>;
13697
+ /**
13698
+ * Register a policy, or a new version of one. `409
13699
+ * gate-policy-scope-taken` when another policy gates the agent for the
13700
+ * scope (`details.heldBy`); `409 gate-policy-scope-changed` when a new
13701
+ * version names another agent or scope.
13702
+ *
13703
+ * @wire POST /v1/gate-policies
13704
+ */
13705
+ publish(input: PublishGatePolicyInput, options?: {
13706
+ idempotencyKey?: string;
13707
+ }): Promise<GatePolicy>;
13708
+ readonly versions: GatePolicyVersionsClient;
13709
+ }
13710
+ export interface GatePolicyVersionsClient {
13711
+ /** @wire GET /v1/gate-policies/:policyId/versions — oldest first, unregistered ones too */
13712
+ list(policyId: string): Promise<GatePolicyPage>;
13713
+ /** @wire GET /v1/gate-policies/:policyId/versions/:version */
13714
+ get(policyId: string, version: string): Promise<GatePolicy>;
13715
+ /** @wire POST /v1/gate-policies/:policyId/versions/:version/unregister */
13716
+ unregister(policyId: string, version: string): Promise<GatePolicy>;
13717
+ /** @wire POST /v1/gate-policies/:policyId/versions/:version/reinstate */
13718
+ reinstate(policyId: string, version: string): Promise<GatePolicy>;
13719
+ }
13720
+ export interface GatePolicyFilter {
13721
+ readonly agentId?: string;
13722
+ /** Only the policy of exactly this scope. */
13723
+ readonly scope?: LiveScope;
13724
+ readonly limit?: number;
13725
+ readonly cursor?: string;
13726
+ }
13727
+ export type PublishGatePolicyInput = PublishGatePolicyBody;
12275
13728
  /**
12276
13729
  * Guardrails resource — declarative rules that gate runs.
12277
13730
  *
@@ -12313,7 +13766,7 @@ export interface GuardrailsClient {
12313
13766
  * @wire `GET /v1/guardrails` — see
12314
13767
  * `@kindgi/api/openapi.json#/paths/~1v1~1guardrails/get`.
12315
13768
  */
12316
- list(filter?: GuardrailFilter): Promise<Page<Guardrail>>;
13769
+ list(filter?: GuardrailFilter): Promise<ListPage<Guardrail>>;
12317
13770
  /**
12318
13771
  * Retire a guardrail. Idempotent on already-unregistered ids —
12319
13772
  * returns `unregistered: true` in either case; only unknown ids
@@ -12334,12 +13787,12 @@ export interface GuardrailsClient {
12334
13787
  * per id; supersession via `unregister` + re-`register`), with no
12335
13788
  * version history.
12336
13789
  */
12337
- versions(id: GuardrailId): Promise<Page<Guardrail>>;
13790
+ versions(id: GuardrailId): Promise<ListPage<Guardrail>>;
12338
13791
  /**
12339
13792
  * @unwired The API has no `GET /v1/guardrails/built-ins` route for
12340
13793
  * the built-in check catalog.
12341
13794
  */
12342
- builtIns(): Promise<Page<BuiltInGuardrail>>;
13795
+ builtIns(): Promise<ListPage<BuiltInGuardrail>>;
12343
13796
  /**
12344
13797
  * @unwired The API has no `POST /v1/guardrails/{id}/evaluate`
12345
13798
  * route — guardrails are evaluated inline during a run
@@ -12406,7 +13859,7 @@ export interface JudgeClassesClient {
12406
13859
  * @wire `GET /v1/judge-classes` — see
12407
13860
  * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes/get`.
12408
13861
  */
12409
- list(filter?: JudgeClassFilter): Promise<Page<JudgeClass>>;
13862
+ list(filter?: JudgeClassFilter): Promise<ListPage<JudgeClass>>;
12410
13863
  /**
12411
13864
  * One class, also a retired one (`unregisteredAt` set).
12412
13865
  *
@@ -12415,7 +13868,7 @@ export interface JudgeClassesClient {
12415
13868
  */
12416
13869
  get(judgeClassId: string): Promise<JudgeClass>;
12417
13870
  /**
12418
- * Change a live class's weight or description.
13871
+ * Change a live class's weight, description or who may assert it.
12419
13872
  *
12420
13873
  * @wire `PATCH /v1/judge-classes/{judgeClassId}` — see
12421
13874
  * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes~1{judgeClassId}/patch`.
@@ -12460,7 +13913,7 @@ export interface JudgmentsClient {
12460
13913
  *
12461
13914
  * @wire `GET /v1/judgments` — see `@kindgi/api/openapi.json#/paths/~1v1~1judgments/get`.
12462
13915
  */
12463
- list(filter?: JudgmentFilter): Promise<Page<Judgment>>;
13916
+ list(filter?: JudgmentFilter): Promise<ListPage<Judgment>>;
12464
13917
  /**
12465
13918
  * One judgment with the stored copies of what was judged.
12466
13919
  *
@@ -12521,12 +13974,12 @@ export interface McpClient {
12521
13974
  * `client.tools.list()` — the wire `Tool` shape is the MCP
12522
13975
  * manifest.
12523
13976
  */
12524
- tools(): Promise<Page<ToolManifest>>;
13977
+ tools(): Promise<ListPage<ToolManifest>>;
12525
13978
  /**
12526
13979
  * @unwired No `GET /v1/mcp/agents` route. List agents with
12527
13980
  * `client.agents.list()`.
12528
13981
  */
12529
- agents(): Promise<Page<McpAgentExposure>>;
13982
+ agents(): Promise<ListPage<McpAgentExposure>>;
12530
13983
  /**
12531
13984
  * @unwired No `POST /v1/mcp/invoke-tool` route; tools run inside
12532
13985
  * agent and flow runs (`client.runs.start`).
@@ -12550,7 +14003,7 @@ export interface McpEndpointsClient {
12550
14003
  * @wire `GET /v1/mcp/endpoints` — see
12551
14004
  * `@kindgi/api/openapi.json#/paths/~1v1~1mcp~1endpoints/get`.
12552
14005
  */
12553
- list(filter?: McpEndpointFilter): Promise<Page<McpEndpoint>>;
14006
+ list(filter?: McpEndpointFilter): Promise<ListPage<McpEndpoint>>;
12554
14007
  /**
12555
14008
  * Register an outbound MCP endpoint.
12556
14009
  *
@@ -12675,7 +14128,7 @@ export interface FactsClient {
12675
14128
  * is serialized as a JSON-encoded `?scope=` query param per the
12676
14129
  * server-side parser (`parseScopeParam`).
12677
14130
  */
12678
- list(filter?: FactFilter): Promise<Page<Fact$1>>;
14131
+ list(filter?: FactFilter): Promise<ListPage<Fact$1>>;
12679
14132
  /**
12680
14133
  * Soft-delete a fact via supersession. Facts are append-only on the
12681
14134
  * wire. Returns the wire envelope `{ factId, superseded: true }`;
@@ -12699,7 +14152,7 @@ export interface LogsClient {
12699
14152
  /**
12700
14153
  * @unwired No `GET /v1/memory/logs` route.
12701
14154
  */
12702
- list(filter?: LogFilter): Promise<Page<LogEntry>>;
14155
+ list(filter?: LogFilter): Promise<ListPage<LogEntry>>;
12703
14156
  /**
12704
14157
  * @unwired No `POST /v1/memory/logs/verify` route. Verifying the
12705
14158
  * hash chain needs the log entries, which the API does not
@@ -12726,7 +14179,7 @@ export interface ObservationsClient {
12726
14179
  *
12727
14180
  * @wire `GET /v1/observations` — see `@kindgi/api/openapi.json#/paths/~1v1~1observations/get`.
12728
14181
  */
12729
- query(filter?: ObservationFilter): Promise<Page<Observation>>;
14182
+ query(filter?: ObservationFilter): Promise<ListPage<Observation>>;
12730
14183
  /**
12731
14184
  * @unwired No `/v1/observations/patterns` route.
12732
14185
  */
@@ -12800,11 +14253,11 @@ export interface PacksClient {
12800
14253
  */
12801
14254
  install(input: PackInstallInput): Promise<InstallationId>;
12802
14255
  /** @unwired No `GET /v1/packs/installed` route. */
12803
- installed(filter?: PackFilter): Promise<Page<InstalledPack>>;
14256
+ installed(filter?: PackFilter): Promise<ListPage<InstalledPack>>;
12804
14257
  /** @unwired No `GET /v1/packs/{id}` route. */
12805
14258
  get(id: PackId): Promise<Pack>;
12806
14259
  /** @unwired No `GET /v1/packs/{id}/versions` route. */
12807
- versions(id: PackId): Promise<Page<Pack>>;
14260
+ versions(id: PackId): Promise<ListPage<Pack>>;
12808
14261
  /** @unwired No `PATCH /v1/pack-installations/{id}/config` route. */
12809
14262
  configure(id: InstallationId, config: Readonly<Record<string, unknown>>): Promise<void>;
12810
14263
  /** @unwired No `POST /v1/pack-installations/{id}/disable` route. */
@@ -12822,9 +14275,9 @@ export interface PacksClient {
12822
14275
  */
12823
14276
  export interface RegistryClient {
12824
14277
  /** @unwired No `GET /v1/packs/registry` route. */
12825
- browse(filter?: RegistryFilter): Promise<Page<Pack>>;
14278
+ browse(filter?: RegistryFilter): Promise<ListPage<Pack>>;
12826
14279
  /** @unwired No `GET /v1/packs/registry/configured` route. */
12827
- configured(): Promise<Page<{
14280
+ configured(): Promise<ListPage<{
12828
14281
  readonly url: string;
12829
14282
  readonly name: string;
12830
14283
  }>>;
@@ -12840,7 +14293,8 @@ export interface RegistryFilter extends Filter {
12840
14293
  * Policies resource — versioned tenant policy registry.
12841
14294
  *
12842
14295
  * Each policy carries a `kind` (`access-control`, `model-routing`,
12843
- * `adapter-allowlist`, `rate-limit`, `retention`, `compliance`) and a
14296
+ * `adapter-allowlist`, `rate-limit`, `retention`, `compliance`,
14297
+ * `tool-errors`, `hitl`) and a
12844
14298
  * `spec` object whose shape that kind defines. The API stores and
12845
14299
  * versions policies (semver per id); enforcement happens where each
12846
14300
  * kind is consumed, not in this resource.
@@ -12852,16 +14306,31 @@ export interface RegistryFilter extends Filter {
12852
14306
  export interface PoliciesClient {
12853
14307
  /**
12854
14308
  * Publish a policy version. The server validates the top-level
12855
- * shape (id, semver version, `kind`, `spec` object) — failures return
12856
- * `400 validation-failed` with the issue list; deeper validation of
12857
- * `spec` belongs to the consumer of that kind. Publishing the same
14309
+ * shape (id, semver version, `kind`, `spec` object), and `spec` for
14310
+ * `tool-errors`, `hitl` and `retention` — failures return
14311
+ * `400 validation-failed` with the issue list (a retention policy with
14312
+ * an unknown domain, or `mode: 'archive'`, is refused). Other kinds'
14313
+ * specs belong to the consumer of that kind. Publishing the same
12858
14314
  * `(id, version)` twice returns `409 policy-already-registered`.
12859
14315
  *
14316
+ * A tenant has one retention policy per domain, plus one for `*`: a
14317
+ * second policy id for a covered domain returns
14318
+ * `409 policy-scope-taken` (`details.heldBy` names the one that covers
14319
+ * it; publish a new version of that one instead), and a new version
14320
+ * can't move a policy to another domain (`409 policy-scope-changed`).
14321
+ *
12860
14322
  * @wire `POST /v1/policies` — see
12861
14323
  * `@kindgi/api/openapi.json#/paths/~1v1~1policies/post`.
12862
14324
  *
12863
14325
  * The wire action is publish; there is no draft lifecycle.
12864
14326
  */
14327
+ publish(spec: PolicySpec, options?: {
14328
+ readonly idempotencyKey?: string;
14329
+ }): Promise<{
14330
+ readonly policyId: PolicyId;
14331
+ readonly version: string;
14332
+ }>;
14333
+ /** @deprecated Use `policies.publish`; removed in 0.2. */
12865
14334
  author(spec: PolicySpec, options?: {
12866
14335
  readonly idempotencyKey?: string;
12867
14336
  }): Promise<{
@@ -12877,7 +14346,7 @@ export interface PoliciesClient {
12877
14346
  * @wire `GET /v1/policies` — see
12878
14347
  * `@kindgi/api/openapi.json#/paths/~1v1~1policies/get`.
12879
14348
  */
12880
- list(filter?: PolicyListFilter): Promise<Page<Policy>>;
14349
+ list(filter?: PolicyListFilter): Promise<ListPage<Policy>>;
12881
14350
  /**
12882
14351
  * Historical versions of a policy.id. Defaults to active-only. Pass
12883
14352
  * `filter.includeTombstoned = true` to include soft-tombstoned rows
@@ -12887,7 +14356,7 @@ export interface PoliciesClient {
12887
14356
  * @wire `GET /v1/policies/{policyId}/versions` — see
12888
14357
  * `@kindgi/api/openapi.json#/paths/~1v1~1policies~1{policyId}~1versions/get`.
12889
14358
  */
12890
- versions(id: PolicyId, filter?: PolicyVersionsFilter): Promise<Page<PolicyVersionRow>>;
14359
+ versions(id: PolicyId, filter?: PolicyVersionsFilter): Promise<ListPage<PolicyVersionRow>>;
12891
14360
  /**
12892
14361
  * Fetch a specific version of a policy.
12893
14362
  *
@@ -13026,7 +14495,7 @@ export interface ProvenanceClient {
13026
14495
  * @wire `GET /v1/provenance` — see
13027
14496
  * `@kindgi/api/openapi.json#/paths/~1v1~1provenance/get`.
13028
14497
  */
13029
- query(filter?: ProvenanceQueryFilter): Promise<Page<ProvenanceRecordMetadata>>;
14498
+ query(filter?: ProvenanceQueryFilter): Promise<ListPage<ProvenanceRecordMetadata>>;
13030
14499
  /**
13031
14500
  * Export a signed JSON bundle for a run. The server canonicalizes the
13032
14501
  * DAG + optional messages, signs with the Ed25519 key named by
@@ -13086,6 +14555,52 @@ interface ProvidersClient$1 {
13086
14555
  readonly idempotencyKey?: string;
13087
14556
  }): Promise<UnregisterProviderOutcome>;
13088
14557
  }
14558
+ /**
14559
+ * Retention resource — what happens to deleted rows. Deleting most
14560
+ * things is a tombstone; a `retention` policy per domain (published with
14561
+ * `policies.author`) sets how long a tombstone stays before a sweep
14562
+ * purges it for good. Nothing sweeps on its own: call `sweep` from a
14563
+ * schedule. Both need `admin` on the tenant.
14564
+ */
14565
+ export interface RetentionClient {
14566
+ /**
14567
+ * The tombstoned rows in every domain a retention policy covers, each
14568
+ * with when it is purged (`purgeAt`) and the policy that decides it.
14569
+ * The page also names the covered domains this deployment can't purge
14570
+ * (`domainsMissingAdapter`), the ones no policy covers
14571
+ * (`unpolicedDomains`), and any domain two policies cover
14572
+ * (`conflicts`).
14573
+ *
14574
+ * @wire `GET /v1/retention/scheduled` — see
14575
+ * `@kindgi/api/openapi.json#/paths/~1v1~1retention~1scheduled/get`.
14576
+ */
14577
+ scheduled(filter?: RetentionScheduledFilter): Promise<RetentionScheduledPage>;
14578
+ /**
14579
+ * Purge, for good, the tombstoned rows past their policy's grace: in
14580
+ * every domain, or only `domain`. At most `maxPerDomain` per domain
14581
+ * per call (default 500); `remaining` counts the rest. Idempotent.
14582
+ *
14583
+ * @wire `POST /v1/retention/sweep`, or with `domain`
14584
+ * `POST /v1/retention/sweep/{domain}` — see
14585
+ * `@kindgi/api/openapi.json#/paths/~1v1~1retention~1sweep/post`.
14586
+ */
14587
+ sweep(input?: RetentionSweepInput): Promise<RetentionSweepResult>;
14588
+ }
14589
+ export interface RetentionScheduledFilter {
14590
+ readonly domain?: RetentionDomain;
14591
+ /** Only the rows a sweep would purge now. */
14592
+ readonly pastGraceOnly?: boolean;
14593
+ /** Rows per domain at most: 1..100, default 25. */
14594
+ readonly limit?: number;
14595
+ /** A previous page's `nextCursor`, to continue where it stopped. */
14596
+ readonly cursor?: string;
14597
+ }
14598
+ export interface RetentionSweepInput {
14599
+ /** One domain (not `*`). Absent: every domain. */
14600
+ readonly domain?: Exclude<RetentionDomain, "*">;
14601
+ /** 1..10000, default 500. */
14602
+ readonly maxPerDomain?: number;
14603
+ }
13089
14604
  /**
13090
14605
  * A run event without its payload: what happened, on which node, when
13091
14606
  * (`RunProgressEvent` in the OpenAPI document). What
@@ -13325,9 +14840,15 @@ export interface RunPage {
13325
14840
  */
13326
14841
  export type StartRunInput = {
13327
14842
  readonly agent: AgentId | string;
14843
+ /**
14844
+ * Omit to use the live version for this project and segment path
14845
+ * (or, in a conversation, the version its earlier turns used).
14846
+ */
13328
14847
  readonly agentVersion?: string;
13329
14848
  /** Project the run belongs to. Omit to use the tenant's default project. */
13330
14849
  readonly projectId?: string;
14850
+ /** Where the run happens, coarse to fine (e.g. company, then role); picks the live version. */
14851
+ readonly segments?: readonly ScopeSegment[];
13331
14852
  readonly input: unknown;
13332
14853
  readonly options?: StartRunOptions;
13333
14854
  readonly idempotencyKey?: string;
@@ -13336,6 +14857,8 @@ export type StartRunInput = {
13336
14857
  readonly flowVersion?: string;
13337
14858
  /** Project the run belongs to. Optional; when omitted, the API's run handler chooses. */
13338
14859
  readonly projectId?: string;
14860
+ /** Where the run happens; picks the live version of each agent step. */
14861
+ readonly segments?: readonly ScopeSegment[];
13339
14862
  readonly input: unknown;
13340
14863
  readonly options?: StartRunOptions;
13341
14864
  readonly idempotencyKey?: string;
@@ -13364,6 +14887,16 @@ export interface RunAgent {
13364
14887
  readonly id: string;
13365
14888
  readonly version: string;
13366
14889
  readonly conversationId: string;
14890
+ /**
14891
+ * How the version was chosen: named on the run (`explicit`), held by the
14892
+ * flow version a flow's agent step runs in (`flow-pin`: the node's
14893
+ * `config.version`, else the flow version's pin), the conversation's
14894
+ * version (`conversation`), a live version (`live`), or the latest
14895
+ * (`latest`). Absent on turns from before 0.1.4.
14896
+ */
14897
+ readonly via?: "explicit" | "flow-pin" | "conversation" | "live" | "latest";
14898
+ /** With `via: 'live'`: the scope whose live version ran. */
14899
+ readonly liveScope?: LiveScope;
13367
14900
  }
13368
14901
  /**
13369
14902
  * Wire shape — matches `@kindgi/api/openapi.json#Run`. Runs are
@@ -13394,6 +14927,8 @@ export interface Run {
13394
14927
  * started). Absent on other runs, and on turns from before 0.1.3.
13395
14928
  */
13396
14929
  readonly agent?: RunAgent;
14930
+ /** The segment path the run was started with; a child run has its parent's. */
14931
+ readonly segments?: readonly ScopeSegment[];
13397
14932
  }
13398
14933
  /**
13399
14934
  * What `runs.start` returns: the run, plus a public run token when the
@@ -13640,10 +15175,14 @@ export interface SecretVersionRecord {
13640
15175
  }
13641
15176
  export interface SecretListPage {
13642
15177
  readonly data: readonly SecretRecord[];
15178
+ /** Whether there's another page (`nextCursor` names it). */
15179
+ readonly hasMore: boolean;
13643
15180
  readonly nextCursor?: Cursor;
13644
15181
  }
13645
15182
  export interface SecretVersionPage {
13646
15183
  readonly data: readonly SecretVersionRecord[];
15184
+ /** Whether there's another page (`nextCursor` names it). */
15185
+ readonly hasMore: boolean;
13647
15186
  readonly nextCursor?: Cursor;
13648
15187
  }
13649
15188
  export type SecretSetOutcome = {
@@ -13794,9 +15333,9 @@ export interface SupervisorClient {
13794
15333
  /** @unwired No `GET /v1/supervisors/{id}` route. */
13795
15334
  get(id: SupervisorId): Promise<Supervisor>;
13796
15335
  /** @unwired No `GET /v1/supervisors` route. */
13797
- list(filter?: Filter): Promise<Page<Supervisor>>;
15336
+ list(filter?: Filter): Promise<ListPage<Supervisor>>;
13798
15337
  /** @unwired No `GET /v1/supervisors/{id}/versions` route. */
13799
- versions(id: SupervisorId): Promise<Page<Supervisor>>;
15338
+ versions(id: SupervisorId): Promise<ListPage<Supervisor>>;
13800
15339
  /** @unwired No `DELETE /v1/supervisors/{id}` route. */
13801
15340
  delete(id: SupervisorId): Promise<void>;
13802
15341
  readonly proposals: ProposalsClient;
@@ -13820,7 +15359,7 @@ export interface ProposalsClient {
13820
15359
  * @wire `GET /v1/proposals` — see
13821
15360
  * `@kindgi/api/openapi.json#/paths/~1v1~1proposals/get`.
13822
15361
  */
13823
- list(input: ProposalListInput): Promise<Page<FixProposal>>;
15362
+ list(input: ProposalListInput): Promise<ListPage<FixProposal>>;
13824
15363
  /**
13825
15364
  * @wire `GET /v1/proposals/{proposalId}` — see
13826
15365
  * `@kindgi/api/openapi.json#/paths/~1v1~1proposals~1{proposalId}/get`.
@@ -14032,7 +15571,7 @@ export interface TokensClient {
14032
15571
  * @wire `GET /v1/tokens` — see
14033
15572
  * `@kindgi/api/openapi.json#/paths/~1v1~1tokens/get`.
14034
15573
  */
14035
- list(filter?: TokenFilter): Promise<Page<ApiToken>>;
15574
+ list(filter?: TokenFilter): Promise<ListPage<ApiToken>>;
14036
15575
  /**
14037
15576
  * Read one API key. Never returns the secret.
14038
15577
  *
@@ -14093,7 +15632,7 @@ export interface ToolsClient {
14093
15632
  * @wire `GET /v1/tools` — see
14094
15633
  * `@kindgi/api/openapi.json#/paths/~1v1~1tools/get`.
14095
15634
  */
14096
- list(filter?: ToolFilter): Promise<Page<Tool>>;
15635
+ list(filter?: ToolFilter): Promise<ListPage<Tool>>;
14097
15636
  /**
14098
15637
  * Fetch the latest active version of a tool.
14099
15638
  *
@@ -14107,6 +15646,49 @@ export interface ToolsClient {
14107
15646
  * `@kindgi/api/openapi.json#/paths/~1v1~1tools~1{toolId}/get`.
14108
15647
  */
14109
15648
  get(id: ToolId): Promise<Tool>;
15649
+ /**
15650
+ * Register a tool manifest (the tool minus its handler) at its version,
15651
+ * in a project. Metadata only: the handler isn't uploaded, and must
15652
+ * already be available to the runtime. Registering a version again is
15653
+ * `409 tool-already-registered`; a registry that takes no writes
15654
+ * (under `kindgi dev`, the pack's files are the source) is
15655
+ * `409 registry-read-only`.
15656
+ *
15657
+ * @wire `POST /v1/tools` — see
15658
+ * `@kindgi/api/openapi.json#/paths/~1v1~1tools/post`.
15659
+ */
15660
+ register(manifest: Tool, options: {
15661
+ readonly projectId: string;
15662
+ readonly idempotencyKey?: string;
15663
+ }): Promise<{
15664
+ readonly toolId: ToolId;
15665
+ }>;
15666
+ /** A tool's versions: list, get, unregister and reinstate. */
15667
+ readonly versions: ToolVersionsClient;
15668
+ /** @deprecated Use `tools.versions.list`; removed in 0.2. */
15669
+ listVersions(id: ToolId, filter?: ToolVersionFilter): Promise<ListPage<ToolVersionRow>>;
15670
+ /** @deprecated Use `tools.versions.get`; removed in 0.2. */
15671
+ getVersion(id: ToolId, version: string): Promise<Tool>;
15672
+ /** @deprecated Use `tools.versions.reinstate`; removed in 0.2. */
15673
+ reinstateVersion(id: ToolId, version: string, options?: {
15674
+ readonly idempotencyKey?: string;
15675
+ }): Promise<ReinstateToolVersionResult>;
15676
+ /** @deprecated Use `tools.versions.unregister`; removed in 0.2. */
15677
+ unregisterVersion(id: ToolId, version: string, options?: {
15678
+ readonly idempotencyKey?: string;
15679
+ }): Promise<UnregisterToolVersionResult>;
15680
+ /**
15681
+ * @unwired No `POST /v1/tools/{toolId}/invoke` route; tools run
15682
+ * inside agent and flow runs.
15683
+ */
15684
+ invoke(id: ToolId, input: unknown): Promise<never>;
15685
+ /**
15686
+ * @unwired No separate manifests route — the wire `Tool` shape is
15687
+ * the manifest; use `list`.
15688
+ */
15689
+ manifests(filter?: ToolFilter): Promise<never>;
15690
+ }
15691
+ export interface ToolVersionsClient {
14110
15692
  /**
14111
15693
  * Cursor-paginated list of tool versions. Defaults to active-only.
14112
15694
  * Pass `filter.includeTombstoned = true` to include soft-tombstoned
@@ -14115,7 +15697,7 @@ export interface ToolsClient {
14115
15697
  *
14116
15698
  * @wire `GET /v1/tools/{toolId}/versions`
14117
15699
  */
14118
- listVersions(id: ToolId, filter?: ToolVersionFilter): Promise<Page<ToolVersionRow>>;
15700
+ list(id: ToolId, filter?: ToolVersionFilter): Promise<ListPage<ToolVersionRow>>;
14119
15701
  /**
14120
15702
  * Fetch a specific tool version by exact semver. Returns
14121
15703
  * `404 tool-not-found` when the (id, version) pair isn't registered
@@ -14123,7 +15705,16 @@ export interface ToolsClient {
14123
15705
  *
14124
15706
  * @wire `GET /v1/tools/{toolId}/versions/{version}`
14125
15707
  */
14126
- getVersion(id: ToolId, version: string): Promise<Tool>;
15708
+ get(id: ToolId, version: string): Promise<Tool>;
15709
+ /**
15710
+ * Tombstone a specific version. Reversible via `tools.versions.reinstate`.
15711
+ * Idempotent — repeat call returns `unregistered: false`.
15712
+ *
15713
+ * @wire `POST /v1/tools/{toolId}/versions/{version}/unregister`
15714
+ */
15715
+ unregister(id: ToolId, version: string, options?: {
15716
+ readonly idempotencyKey?: string;
15717
+ }): Promise<UnregisterToolVersionResult>;
14127
15718
  /**
14128
15719
  * Un-tombstone a specific previously-unregistered version.
14129
15720
  * Restores the manifest bytes verbatim (semver hygiene: reinstate
@@ -14138,28 +15729,9 @@ export interface ToolsClient {
14138
15729
  *
14139
15730
  * @wire `POST /v1/tools/{toolId}/versions/{version}/reinstate`
14140
15731
  */
14141
- reinstateVersion(id: ToolId, version: string, options?: {
15732
+ reinstate(id: ToolId, version: string, options?: {
14142
15733
  readonly idempotencyKey?: string;
14143
15734
  }): Promise<ReinstateToolVersionResult>;
14144
- /**
14145
- * Tombstone a specific version. Reversible via `reinstateVersion`.
14146
- * Idempotent — repeat call returns `unregistered: false`.
14147
- *
14148
- * @wire `POST /v1/tools/{toolId}/versions/{version}/unregister`
14149
- */
14150
- unregisterVersion(id: ToolId, version: string, options?: {
14151
- readonly idempotencyKey?: string;
14152
- }): Promise<UnregisterToolVersionResult>;
14153
- /**
14154
- * @unwired No `POST /v1/tools/{toolId}/invoke` route; tools run
14155
- * inside agent and flow runs.
14156
- */
14157
- invoke(id: ToolId, input: unknown): Promise<never>;
14158
- /**
14159
- * @unwired No separate manifests route — the wire `Tool` shape is
14160
- * the manifest; use `list`.
14161
- */
14162
- manifests(filter?: ToolFilter): Promise<never>;
14163
15735
  }
14164
15736
  export interface ToolFilter {
14165
15737
  readonly limit?: number;
@@ -14253,7 +15825,7 @@ export interface UsersClient {
14253
15825
  * @wire `GET /v1/identity/users` — see
14254
15826
  * `@kindgi/api/openapi.json#/paths/~1v1~1identity~1users/get`.
14255
15827
  */
14256
- list(filter?: UserFilter): Promise<Page<User>>;
15828
+ list(filter?: UserFilter): Promise<ListPage<User>>;
14257
15829
  /**
14258
15830
  * @unwired No user-update route — users live in the deployment's
14259
15831
  * identity directory.
@@ -14274,7 +15846,7 @@ export interface SessionsClient {
14274
15846
  * @wire `GET /v1/identity/users/{userId}/sessions` — see
14275
15847
  * `@kindgi/api/openapi.json#/paths/~1v1~1identity~1users~1{userId}~1sessions/get`.
14276
15848
  */
14277
- list(userId: UserId): Promise<Page<Session>>;
15849
+ list(userId: UserId): Promise<ListPage<Session>>;
14278
15850
  /**
14279
15851
  * Revoke ALL sessions for a user. Admin-scope. Idempotent on
14280
15852
  * already-revoked sets (returns `revokedCount: 0`).
@@ -14397,6 +15969,9 @@ export interface KindgiClient {
14397
15969
  readonly adapters: AdaptersClient;
14398
15970
  readonly providers: ProvidersClient$1;
14399
15971
  readonly policies: PoliciesClient;
15972
+ /** Gate policies: what a promotion must show before a version goes live (evals step 4b). */
15973
+ readonly gatePolicies: GatePoliciesClient;
15974
+ readonly retention: RetentionClient;
14400
15975
  readonly projects: ProjectsClient;
14401
15976
  readonly env: EnvClient;
14402
15977
  readonly secrets: SecretsClient;
@@ -14468,17 +16043,23 @@ export interface NetworkError {
14468
16043
  }
14469
16044
  export interface AuthError {
14470
16045
  readonly code: "auth";
16046
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16047
+ readonly serverCode?: string;
14471
16048
  readonly message: string;
14472
16049
  readonly reason: "unauthenticated" | "forbidden" | "token-expired";
14473
16050
  }
14474
16051
  export interface RateLimitedError {
14475
16052
  readonly code: "rate-limited";
16053
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16054
+ readonly serverCode?: string;
14476
16055
  readonly message: string;
14477
16056
  /** Suggested seconds to wait before retry (from server `Retry-After`). */
14478
16057
  readonly retryAfterSeconds?: number;
14479
16058
  }
14480
16059
  export interface NotFoundError {
14481
16060
  readonly code: "not-found";
16061
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16062
+ readonly serverCode?: string;
14482
16063
  readonly message: string;
14483
16064
  readonly resource: {
14484
16065
  readonly kind: string;
@@ -14487,11 +16068,15 @@ export interface NotFoundError {
14487
16068
  }
14488
16069
  export interface ConflictError {
14489
16070
  readonly code: "conflict";
16071
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16072
+ readonly serverCode?: string;
14490
16073
  readonly message: string;
14491
16074
  readonly reason: string;
14492
16075
  }
14493
16076
  export interface InvalidRequestError {
14494
16077
  readonly code: "invalid-request";
16078
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16079
+ readonly serverCode?: string;
14495
16080
  readonly message: string;
14496
16081
  /** JSON-pointer issues, matching the shape used across `packages/*` validators. */
14497
16082
  readonly issues: readonly {
@@ -14506,6 +16091,8 @@ export interface InvalidRequestError {
14506
16091
  */
14507
16092
  export interface GuardrailViolationError {
14508
16093
  readonly code: "guardrail-violation";
16094
+ /** The server's own error code (the wire `code`), when the error came from the server. */
16095
+ readonly serverCode?: string;
14509
16096
  readonly message: string;
14510
16097
  readonly violations: readonly GuardrailViolation[];
14511
16098
  /**
@@ -14531,12 +16118,14 @@ export interface GuardrailViolation {
14531
16118
  /**
14532
16119
  * Passthrough for server-side errors that have no dedicated SDK
14533
16120
  * variant (for example `KernelError` or `MemoryError` codes). `fromWire`
14534
- * maps any unrecognized wire `code` to `{ code: 'server', serverCode:
14535
- * <wire code>, message, fields: <wire details> }`.
16121
+ * maps a wire `code` it doesn't list to `{ code: 'server', serverCode:
16122
+ * <wire code>, message, fields: <wire details> }` — unless its HTTP
16123
+ * status names a family (404/410 not-found, 401/403 auth, 429
16124
+ * rate-limited, 400 invalid request; 409 and 422 stay `server`).
14536
16125
  *
14537
16126
  * Callers match `err.code === 'server' && err.serverCode === '...'` to
14538
- * handle specific primitive errors. Keeps the SDK's top-level `code`
14539
- * space small while preserving fidelity.
16127
+ * handle specific primitive errors. Every error from the server carries
16128
+ * `serverCode`, so matching on it alone works whatever the family.
14540
16129
  */
14541
16130
  export interface ServerError {
14542
16131
  readonly code: "server";
@@ -14578,13 +16167,16 @@ export declare function notYetWired(method: string, reason: string): NotYetWired
14578
16167
  * `{ code, message, details?, requestId }` inside its `{ error }`
14579
16168
  * envelope, which the transport unwraps before calling this. This
14580
16169
  * function reads `code` and projects the rest of the object (including
14581
- * `details`) into the matching variant. Unknown codes fall back to
14582
- * `ServerError` with the raw code preserved as `serverCode` — later SDK
14583
- * releases can add explicit variants without breaking older consumers.
16170
+ * `details`) into the matching variant. A code this client doesn't list
16171
+ * (a newer server's) is read by the HTTP `status` instead: 404/410 a
16172
+ * not-found, 400 an invalid request, 401/403 an auth error, 429
16173
+ * rate-limited. 409 and 422 stay `ServerError`: the docs match their
16174
+ * codes there (`budget-exceeded`, `agent-version-mismatch`). Every
16175
+ * error from the server keeps the raw code as `serverCode`.
14584
16176
  *
14585
16177
  * `code` is the discriminant.
14586
16178
  */
14587
- export declare function fromWire(body: unknown): KindgiError;
16179
+ export declare function fromWire(body: unknown, status?: number): KindgiError;
14588
16180
  /**
14589
16181
  * Wrap a wire error as a JS `Error` so it can be `throw`n by SDK
14590
16182
  * methods. The typed payload rides on the `.error` property; callers