@kindgi/client 0.1.2 → 0.1.4-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -218,8 +218,54 @@ export interface Page<T> {
218
218
  * The brand prevents mixing free-form strings with validated semver values.
219
219
  */
220
220
  export type Semver = Brand<string, "Semver">;
221
+ /**
222
+ * Why the runtime registered a version of an agent or flow under another
223
+ * number than its definition names. Versions never change, so a deploy
224
+ * whose definition's version is registered already with other content
225
+ * registers the next free version in its line instead:
226
+ *
227
+ * - `pins-changed`: the definition's version is registered with other
228
+ * pins (a block it uses has a new version);
229
+ * - `unpinned`: the definition's version was published before pins
230
+ * existed, so it has none;
231
+ * - `version-taken`: the definition's version holds another definition;
232
+ * - `edited`: derived from an existing version with some data-block pins
233
+ * swapped (an expert's edit), not from a definition at all.
234
+ */
235
+ export type VersionDerivationReason = "pins-changed" | "unpinned" | "version-taken" | "edited";
236
+ /** The version a version was registered in place of (or derived from), and why. */
237
+ export interface VersionDerivation {
238
+ /** The version the definition names, or the one an edit derived from. */
239
+ readonly version: string;
240
+ readonly reason: VersionDerivationReason;
241
+ /** For an edit: a short label for the version (e.g. "warmer tone"). */
242
+ readonly label?: string;
243
+ /** For an edit: who made it (`user:<id>`, or the token for a key). */
244
+ readonly by?: string;
245
+ }
221
246
  /** Terminal states are `completed`, `failed`, `cancelled`. */
222
247
  export type RunStatus = "pending" | "running" | "suspended" | "completed" | "failed" | "cancelled";
248
+ /**
249
+ * The exact version of each block a flow version runs: its lockfile.
250
+ *
251
+ * A flow names its tools by id (a tool node's `ref`, a fanout branch's
252
+ * `handler`) and its agents by id, with an exact `config.version` or
253
+ * none. When a version of the flow is published, the runtime pins each
254
+ * tool, and each agent that names no version, to its latest version
255
+ * then, and every run of that flow version uses those versions. So a
256
+ * new tool or agent version reaches the flow only through a new flow
257
+ * version.
258
+ *
259
+ * Set by the runtime at publish, never authored. A flow version
260
+ * published before pins existed has none and binds the latest versions
261
+ * per run.
262
+ */
263
+ export interface FlowPins {
264
+ /** Tool id → the exact version this flow version runs. */
265
+ readonly tools: Readonly<Record<string, string>>;
266
+ /** Agent id → the exact version its agent nodes that name none run. */
267
+ readonly agents: Readonly<Record<string, string>>;
268
+ }
223
269
  /**
224
270
  * A path into the run's addressable state. Dot-separated segments, always
225
271
  * starting with a recognized root. Path syntax is deliberately narrow — no
@@ -928,6 +974,20 @@ export interface Flow {
928
974
  * `$end` edge (the lowest-id taken one when several fire).
929
975
  */
930
976
  readonly output?: FlowOutputSpec;
977
+ /**
978
+ * The exact tool and agent versions this flow version runs, resolved by
979
+ * the runtime when the version was published (see `FlowPins`). Never
980
+ * authored: `loadFlow` refuses it. Absent on a flow version published
981
+ * before pins existed; it binds the latest versions per run.
982
+ */
983
+ readonly pins?: FlowPins;
984
+ /** `flowPinsDigest(pins)`, recorded when the version was published. */
985
+ readonly pinsDigest?: string;
986
+ /**
987
+ * Set by the runtime on a version a deploy registered under another
988
+ * number than the definition's (see `VersionDerivation`). Never authored.
989
+ */
990
+ readonly derivedFrom?: VersionDerivation;
931
991
  }
932
992
  /**
933
993
  * A flow's declared output: what the run returns, built from the
@@ -1172,6 +1232,29 @@ export interface ToolHitlRule {
1172
1232
  readonly mode: ToolHitlMode;
1173
1233
  readonly requiredRole?: ReviewerRole;
1174
1234
  }
1235
+ /**
1236
+ * The exact version of each block an agent version runs: its lockfile.
1237
+ *
1238
+ * An agent names its tools by range (`{ id: 'acme.lookup', version:
1239
+ * '^1.0.0' }`), like `package.json`. When a version of the agent is
1240
+ * published, the runtime resolves each range once, and every run of that
1241
+ * version uses the versions recorded here. So a new tool version reaches
1242
+ * an agent only through a new agent version, and two runs of one agent
1243
+ * version always run the same blocks.
1244
+ *
1245
+ * Set by the runtime at publish, never authored. A version published
1246
+ * before pins existed has none and resolves its ranges per run.
1247
+ */
1248
+ export interface AgentPins {
1249
+ /** Tool id → the exact version this agent version runs. */
1250
+ readonly tools: Readonly<Record<string, string>>;
1251
+ /** Prompt block id → exact version. Empty until the agent references prompt blocks. */
1252
+ readonly prompts: Readonly<Record<string, string>>;
1253
+ /** Settings block id → exact version. Empty until the agent references settings blocks. */
1254
+ readonly settings: Readonly<Record<string, string>>;
1255
+ }
1256
+ /** The version an agent version was registered in place of, and why. */
1257
+ export type AgentDerivation = VersionDerivation;
1175
1258
  type AgentId$1 = Brand<string, "AgentId">;
1176
1259
  /**
1177
1260
  * A single message inside a conversation. Persisted as a `Fact` in
@@ -1269,6 +1352,20 @@ export interface ToolRef {
1269
1352
  readonly id: string;
1270
1353
  readonly version: string;
1271
1354
  }
1355
+ /**
1356
+ * A prompt block an agent's instructions come from: its id and a semver
1357
+ * range, resolved like a tool's (`pickVersion`) and pinned when the
1358
+ * agent version is published.
1359
+ */
1360
+ export interface PromptRef {
1361
+ readonly prompt: string;
1362
+ readonly version: string;
1363
+ }
1364
+ /** A settings block an agent reads: its id and a semver range, pinned at publish. */
1365
+ export interface BlockRef {
1366
+ readonly id: string;
1367
+ readonly version: string;
1368
+ }
1272
1369
  /**
1273
1370
  * Per-agent behavior for multi-turn conversations. The agent chooses:
1274
1371
  * - How many prior messages to load (`historyLimit`; unset = all).
@@ -1328,6 +1425,14 @@ export interface ConversationHitlPolicy {
1328
1425
  * (see `resolveEffectiveHitlPolicy`).
1329
1426
  */
1330
1427
  readonly timeoutMs?: number;
1428
+ /**
1429
+ * What happens when an approval's time runs out: it escalates one
1430
+ * reviewer tier, and at `admin` it expires (the turn fails with
1431
+ * `hitl-cancelled`). `'escalate'` is the only behavior today, and the
1432
+ * default; `'auto-approve'` and `'auto-reject'` are refused rather than
1433
+ * accepted and ignored.
1434
+ */
1435
+ readonly onTimeout?: "escalate";
1331
1436
  }
1332
1437
  /**
1333
1438
  * Budgets guard a single agent turn. Every field is optional; unset
@@ -1405,8 +1510,13 @@ export interface Agent {
1405
1510
  * unresolved reference fails the turn at invoke time
1406
1511
  * (`model-invocation-failed` whose `cause` is the `missing-parameter`
1407
1512
  * render error), never a silent empty string.
1513
+ *
1514
+ * Or a prompt block, by range (`{ prompt: 'acme.intake-prompt',
1515
+ * version: '^1.0.0' }`): its template renders here instead, with the
1516
+ * parameters it declares, and the version that runs is pinned when the
1517
+ * agent version is published (`pins.prompts`).
1408
1518
  */
1409
- readonly instructions: string;
1519
+ readonly instructions: string | PromptRef;
1410
1520
  /**
1411
1521
  * Typed parameters the caller supplies at invoke time. The UI reads
1412
1522
  * this to build a "configure agent" form; the runtime validates each
@@ -1518,6 +1628,35 @@ export interface Agent {
1518
1628
  * A tenant's `tool-errors` policy can lower it. See `ToolErrorsSpec`.
1519
1629
  */
1520
1630
  readonly toolErrors?: ToolErrorsSpec;
1631
+ /**
1632
+ * The exact block versions this agent version runs, resolved by the
1633
+ * runtime when the version was published (see `AgentPins`). Never
1634
+ * authored: `defineAgent` doesn't take it. Absent on an agent defined
1635
+ * in code and on a version published before pins existed; its tool
1636
+ * ranges then resolve per run.
1637
+ */
1638
+ readonly pins?: AgentPins;
1639
+ /**
1640
+ * Settings blocks the agent reads, by range. Each block's values reach
1641
+ * its tools as `ToolContext.settings[<block id>]` and its templates as
1642
+ * `settings.<block id>.<key>`; the versions are pinned at publish
1643
+ * (`pins.settings`).
1644
+ */
1645
+ readonly settings?: readonly BlockRef[];
1646
+ /**
1647
+ * A settings block of model settings (`MODEL_SETTINGS_SCHEMA`:
1648
+ * `temperature`, `maxOutputTokens`) the turn's model calls use. Pinned
1649
+ * at publish with the other settings.
1650
+ */
1651
+ readonly modelSettings?: BlockRef;
1652
+ /** `pinsDigest(pins)`, recorded when the version was published. */
1653
+ readonly pinsDigest?: string;
1654
+ /**
1655
+ * Set by the runtime on a version it registered under another number
1656
+ * than the definition's, when a deploy couldn't register that number
1657
+ * as it was (see `AgentDerivation`). Never authored.
1658
+ */
1659
+ readonly derivedFrom?: AgentDerivation;
1521
1660
  }
1522
1661
  /** A retrieved fact + the retrieval intent that pulled it. */
1523
1662
  export interface RetrievedFact {
@@ -1608,8 +1747,16 @@ export interface DefineAgentSpec {
1608
1747
  * The system prompt. Sent to the model with every turn as the
1609
1748
  * baseline instructions. Load-bearing — this is where you shape
1610
1749
  * the agent's behavior (persona, output format, tool-use policy).
1750
+ *
1751
+ * Or a prompt block by range (`{ prompt: 'acme.intake-prompt',
1752
+ * version: '^1.0.0' }`), whose template and parameters are used
1753
+ * instead; then `parameters` stays unset (the block declares them).
1611
1754
  */
1612
- readonly instructions: string;
1755
+ readonly instructions: string | PromptRef;
1756
+ /** Settings blocks the agent reads, by range (see `Agent.settings`). */
1757
+ readonly settings?: readonly BlockRef[];
1758
+ /** A model-settings block, by range (see `Agent.modelSettings`). */
1759
+ readonly modelSettings?: BlockRef;
1613
1760
  /**
1614
1761
  * Required capabilities the agent needs from a `ModelProvider`.
1615
1762
  * Typically one entry: `[{ needs: [{ feature: 'tool-use' }] }]`
@@ -1711,18 +1858,6 @@ export interface DefineAgentSpec {
1711
1858
  /** Free-form tags for catalog filtering. Not interpreted by the runtime. */
1712
1859
  readonly tags?: readonly string[];
1713
1860
  }
1714
- export type Scope = {
1715
- readonly kind: "tenant";
1716
- readonly tenantId: TenantId;
1717
- } | {
1718
- readonly kind: "org";
1719
- readonly tenantId: TenantId;
1720
- readonly orgId: OrgId;
1721
- } | {
1722
- readonly kind: "project";
1723
- readonly tenantId: TenantId;
1724
- readonly projectId: ProjectId;
1725
- };
1726
1861
  export type GuardrailSeverity = "info" | "warn" | "error" | "critical";
1727
1862
  /**
1728
1863
  * Actions the engine surfaces when a check fails. Open string — the
@@ -1816,6 +1951,11 @@ export interface ToolCompletedEvent {
1816
1951
  readonly invocationId: string;
1817
1952
  readonly output: unknown;
1818
1953
  readonly durationMs: number;
1954
+ /**
1955
+ * In a replay turn: whether the tool ran (`live`), the past run's result
1956
+ * was used (`recorded`), or the call was refused (`refused`).
1957
+ */
1958
+ readonly replay?: "live" | "recorded" | "refused";
1819
1959
  }
1820
1960
  export interface ToolFailedEvent {
1821
1961
  readonly kind: "tool.failed";
@@ -1856,6 +1996,43 @@ export interface TurnFailedEvent {
1856
1996
  readonly errorCode: string;
1857
1997
  readonly message: string;
1858
1998
  }
1999
+ /**
2000
+ * Wire-body serialization for `Scope` values.
2001
+ *
2002
+ * The `Scope` type from `@kindgi/platform` carries `tenantId` because
2003
+ * server-internal code (routes, bindings, storage adapters) needs it
2004
+ * everywhere the tuple flows. On the HTTP wire body, however, tenantId
2005
+ * is redundant: every route derives it authoritatively from the bearer
2006
+ * and any mismatched value is rejected as
2007
+ * `scope-mismatch 400`.
2008
+ *
2009
+ * Client callers rarely know their session tenantId ahead of time, and
2010
+ * a placeholder value would trip the mismatch check.
2011
+ * `scopeForBody(scope)` strips tenantId at the SDK boundary so request
2012
+ * bodies carry only the fields the server actually reads off the wire
2013
+ * (`kind` + `orgId`/`projectId`).
2014
+ *
2015
+ * Use this ONLY for request bodies. Query-string helpers (`scopeToQuery`)
2016
+ * already omit tenantId by construction and don't need this shim.
2017
+ */
2018
+ /**
2019
+ * A scope, as the client takes it: the kind and its id. `tenantId` is
2020
+ * optional. The API derives the tenant from the bearer token, so the
2021
+ * client never sends it, and an app needn't know it. `@kindgi/platform`'s
2022
+ * `Scope`, which carries one, fits here as well.
2023
+ */
2024
+ export type ScopeRef = {
2025
+ readonly kind: "tenant";
2026
+ readonly tenantId?: string;
2027
+ } | {
2028
+ readonly kind: "org";
2029
+ readonly orgId: string;
2030
+ readonly tenantId?: string;
2031
+ } | {
2032
+ readonly kind: "project";
2033
+ readonly projectId: string;
2034
+ readonly tenantId?: string;
2035
+ };
1859
2036
  /** @unwired SDK-defined id for a schedule. */
1860
2037
  export type ScheduleId = Brand<string, "ScheduleId">;
1861
2038
  /** @unwired SDK-defined id for a model provider. */
@@ -2323,6 +2500,25 @@ export interface Approval {
2323
2500
  readonly updatedAt: Timestamp;
2324
2501
  readonly decidedAt?: Timestamp;
2325
2502
  readonly expiresAt?: Timestamp;
2503
+ /**
2504
+ * The reviewer's decision, once one is recorded. Absent while the
2505
+ * approval is open, and when it ended without one (it expired, or a
2506
+ * timeout escalated it).
2507
+ */
2508
+ readonly decision?: ApprovalDecisionRecord;
2509
+ }
2510
+ /**
2511
+ * Wire shape — matches `@kindgi/api/openapi.json#ApprovalDecisionRecord`.
2512
+ * An approval's recorded decision: what the reviewer decided, why, and who.
2513
+ */
2514
+ export interface ApprovalDecisionRecord {
2515
+ readonly decision: ApprovalDecision;
2516
+ /** Who decided, as an actor: `user:<userId>`, the reviewer's user (the Kindgi runtime always records it). */
2517
+ readonly decidedBy?: string;
2518
+ readonly reviewerId: ReviewerId;
2519
+ readonly reviewerRoleAtDecision: ReviewerRole$1;
2520
+ readonly decidedAt: Timestamp;
2521
+ readonly rationale?: string;
2326
2522
  }
2327
2523
  /**
2328
2524
  * Wire shape — matches `@kindgi/api/openapi.json#ReviewDecision`. Decision row
@@ -2595,6 +2791,12 @@ export interface Conversation {
2595
2791
  readonly agentVersion: string;
2596
2792
  readonly title: string;
2597
2793
  readonly participantId?: string;
2794
+ /**
2795
+ * The project the conversation is in: the project of the run that
2796
+ * opened it, or `projectId` on open (the tenant's Default project when
2797
+ * omitted). Absent on conversations from before 0.1.3.
2798
+ */
2799
+ readonly projectId?: string;
2598
2800
  /** Structural scope (project id, matter id, etc.). */
2599
2801
  readonly scope: Readonly<Record<string, unknown>>;
2600
2802
  readonly status: ConversationStatus;
@@ -2612,6 +2814,11 @@ export interface Conversation {
2612
2814
  export interface OpenConversationInput {
2613
2815
  readonly agentId: AgentId;
2614
2816
  readonly agentVersion: string;
2817
+ /**
2818
+ * Put the conversation in a project (one of the tenant's): lists filter
2819
+ * by it. Omitted: the tenant's Default project, as for a run.
2820
+ */
2821
+ readonly projectId?: string;
2615
2822
  readonly scope?: Readonly<Record<string, unknown>>;
2616
2823
  readonly participantId?: string;
2617
2824
  readonly title?: string;
@@ -2782,6 +2989,17 @@ export interface ProvenanceRecord {
2782
2989
  readonly value: string;
2783
2990
  readonly signedAt: Timestamp;
2784
2991
  };
2992
+ /**
2993
+ * Each model call's usage from the cost ledger, by the `callId` in its
2994
+ * `model-call` node's attributes. Joined when read: not part of the
2995
+ * signed DAG.
2996
+ */
2997
+ readonly callUsage?: Readonly<Record<string, {
2998
+ readonly usage: ModelCallTokens;
2999
+ readonly costUsd?: number;
3000
+ readonly durationMs?: number;
3001
+ readonly servedModel?: string;
3002
+ }>>;
2785
3003
  }
2786
3004
  /**
2787
3005
  * Wire shape for records surfaced by `GET /v1/provenance` (list). The
@@ -2799,6 +3017,8 @@ export interface ProvenanceRecordMetadata {
2799
3017
  readonly version: string;
2800
3018
  };
2801
3019
  readonly signed: boolean;
3020
+ /** The project of the record's run; absent on records from before 0.1.3. */
3021
+ readonly projectId?: string;
2802
3022
  }
2803
3023
  /**
2804
3024
  * Wire shape of a signed export bundle envelope — matches
@@ -2818,6 +3038,8 @@ export interface ExportedProvenance {
2818
3038
  readonly exportedAt: Timestamp;
2819
3039
  }
2820
3040
  export interface ProvenanceQueryFilter extends Filter {
3041
+ /** Only one project's records (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
3042
+ readonly scope?: ScopeRef;
2821
3043
  readonly runId?: RunId;
2822
3044
  readonly agentId?: AgentId;
2823
3045
  /** ISO 8601 timestamp — server filters `createdAt > createdAfter`. */
@@ -2879,6 +3101,69 @@ export interface CostRecord {
2879
3101
  readonly occurredAt: Timestamp;
2880
3102
  readonly metrics?: Readonly<Record<string, unknown>>;
2881
3103
  readonly attributes?: Readonly<Record<string, unknown>>;
3104
+ /** The call's id; its provenance `model-call` node carries it too. */
3105
+ readonly callId?: string;
3106
+ readonly projectId?: ProjectId;
3107
+ /** The root of the record's run tree (a flow run, for its agent turns). */
3108
+ readonly rootRunId?: RunId;
3109
+ readonly parentRunId?: RunId;
3110
+ readonly agentVersion?: string;
3111
+ /** The flow of the run tree's root. */
3112
+ readonly flowId?: string;
3113
+ /** The step that made the call, and the turn's step number. */
3114
+ readonly nodeId?: string;
3115
+ readonly step?: number;
3116
+ /** What the call was for, beyond the turn's own model step (`guardrail-judge:<id>`). */
3117
+ readonly purpose?: string;
3118
+ /** The model actually called. */
3119
+ readonly model?: string;
3120
+ /** The exact model version the vendor reported. */
3121
+ readonly servedModel?: string;
3122
+ /** The router picked a fallback provider for the turn. */
3123
+ readonly fallback?: boolean;
3124
+ /** `ok`: the provider answered. `failed`: the call threw. */
3125
+ readonly status?: "ok" | "failed";
3126
+ readonly usage?: ModelCallTokens;
3127
+ readonly durationMs?: number;
3128
+ readonly finishReason?: string;
3129
+ /** The vendor's id for the request. */
3130
+ readonly providerRequestId?: string;
3131
+ /** HTTP attempts the call took, the client's retries included. */
3132
+ readonly attempts?: number;
3133
+ readonly error?: {
3134
+ readonly message: string;
3135
+ };
3136
+ /** The vendor's own usage object, as it reported it (only with `includeRawUsage`). */
3137
+ readonly rawUsage?: {
3138
+ readonly provider: string;
3139
+ readonly model: string;
3140
+ readonly usage: Readonly<Record<string, unknown>>;
3141
+ };
3142
+ }
3143
+ /**
3144
+ * A model call's tokens. `promptTokens` / `completionTokens` are the
3145
+ * totals; `cacheReadTokens` / `cacheWriteTokens` are parts of
3146
+ * `promptTokens`, `reasoningTokens` of `completionTokens`, present when
3147
+ * the provider reports them.
3148
+ */
3149
+ export interface ModelCallTokens {
3150
+ readonly promptTokens: number;
3151
+ readonly completionTokens: number;
3152
+ readonly cacheReadTokens?: number;
3153
+ readonly cacheWriteTokens?: number;
3154
+ readonly reasoningTokens?: number;
3155
+ }
3156
+ /**
3157
+ * Token sums of an aggregate. `prompt` / `completion` are the totals;
3158
+ * `cacheRead` / `cacheWrite` are parts of `prompt`, `reasoning` of
3159
+ * `completion` (`0` where providers didn't report them).
3160
+ */
3161
+ export interface CostTokenTotals {
3162
+ readonly prompt: number;
3163
+ readonly completion: number;
3164
+ readonly cacheRead: number;
3165
+ readonly cacheWrite: number;
3166
+ readonly reasoning: number;
2882
3167
  }
2883
3168
  /** @deprecated Renamed to `CostRecord` to match the wire. */
2884
3169
  export type UsageRecord = CostRecord;
@@ -2888,12 +3173,25 @@ export type UsageRecord = CostRecord;
2888
3173
  */
2889
3174
  export interface CostRecordFilter extends Filter {
2890
3175
  readonly runId?: RunId;
3176
+ /** With `runId`: also every run it started, at any depth. */
3177
+ readonly includeDescendants?: boolean;
3178
+ /** Every record of the run tree whose root is this run. */
3179
+ readonly rootRunId?: RunId;
2891
3180
  readonly agentId?: AgentId;
2892
3181
  readonly conversationId?: ThreadId;
2893
3182
  readonly category?: string;
2894
3183
  readonly providerId?: ProviderId;
3184
+ /** The model actually called. */
3185
+ readonly model?: string;
3186
+ /** The exact model version the vendor reported. */
3187
+ readonly servedModel?: string;
3188
+ /** Records in this scope: a project, or every project of an org. */
3189
+ readonly scope?: ScopeRef;
2895
3190
  readonly from?: Timestamp;
3191
+ /** Exclusive. */
2896
3192
  readonly to?: Timestamp;
3193
+ /** Add each model call's `rawUsage`: the vendor's own usage object. */
3194
+ readonly includeRawUsage?: boolean;
2897
3195
  }
2898
3196
  /** @deprecated Renamed to `CostRecordFilter` to match the wire. */
2899
3197
  export type UsageQueryFilter = CostRecordFilter;
@@ -2901,7 +3199,7 @@ export type UsageQueryFilter = CostRecordFilter;
2901
3199
  * Wire enum of dimensions callers can pass to `cost.aggregate` — matches
2902
3200
  * `@kindgi/api/openapi.json#CostGroupDimension`.
2903
3201
  */
2904
- export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId";
3202
+ export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId" | "model" | "servedModel" | "projectId" | "orgId" | "rootRunId" | "flowId";
2905
3203
  /**
2906
3204
  * Wire shape for one aggregated bucket — matches
2907
3205
  * `@kindgi/api/openapi.json#CostAggregateGroup`.
@@ -2914,6 +3212,7 @@ export interface CostAggregateGroup {
2914
3212
  readonly key: Readonly<Record<string, string | null>>;
2915
3213
  readonly count: number;
2916
3214
  readonly totalUsd: number;
3215
+ readonly tokens: CostTokenTotals;
2917
3216
  }
2918
3217
  /**
2919
3218
  * Wire shape for `GET /v1/cost/aggregate` response — matches
@@ -2923,6 +3222,7 @@ export interface CostAggregateResult {
2923
3222
  readonly groups: readonly CostAggregateGroup[];
2924
3223
  readonly totalUsd: number;
2925
3224
  readonly totalRecords: number;
3225
+ readonly tokens: CostTokenTotals;
2926
3226
  readonly timeRange: {
2927
3227
  readonly from: Timestamp;
2928
3228
  readonly to: Timestamp;
@@ -3374,7 +3674,7 @@ export interface RegisterMcpEndpointInput {
3374
3674
  */
3375
3675
  readonly secretRef?: McpEndpointSecretRef;
3376
3676
  /** The scope the endpoint is registered in; authorization checks it. */
3377
- readonly scope: Scope;
3677
+ readonly scope: ScopeRef;
3378
3678
  }
3379
3679
  /**
3380
3680
  * @unwired SDK-defined event shapes; the API has no event emission or
@@ -3616,6 +3916,130 @@ export interface ClientOptions {
3616
3916
  /** Overridable fetch impl for testing. Defaults to global `fetch`. */
3617
3917
  readonly fetch?: typeof fetch;
3618
3918
  }
3919
+ /** The verdict of a judgment. */
3920
+ export type Verdict = "yes" | "no";
3921
+ /**
3922
+ * Where a judge class applies: the whole tenant, one project, or one
3923
+ * agent in a project. Matches `@kindgi/api/openapi.json#JudgeClassScope`.
3924
+ */
3925
+ export type JudgeClassScope = {
3926
+ readonly kind: "tenant";
3927
+ } | {
3928
+ readonly kind: "project";
3929
+ readonly projectId: string;
3930
+ } | {
3931
+ readonly kind: "agent";
3932
+ readonly projectId: string;
3933
+ readonly agentId: string;
3934
+ };
3935
+ /** Matches `@kindgi/api/openapi.json#JudgeClass`. */
3936
+ export interface JudgeClass {
3937
+ readonly id: string;
3938
+ readonly tenantId: string;
3939
+ readonly scope: JudgeClassScope;
3940
+ /** The deployment's own word for the class: "expert", "user", "arbitrator". */
3941
+ readonly name: string;
3942
+ /** How much a judgment of this class counts, relative to the others (≥ 0). */
3943
+ readonly weight: number;
3944
+ readonly description?: string;
3945
+ readonly createdAt: Timestamp;
3946
+ readonly updatedAt: Timestamp;
3947
+ /** Set when the class was retired. */
3948
+ readonly unregisteredAt?: Timestamp;
3949
+ }
3950
+ /** Input for `POST /v1/judge-classes` per `#CreateJudgeClassBody`. */
3951
+ export interface CreateJudgeClassInput {
3952
+ readonly scope: JudgeClassScope;
3953
+ readonly name: string;
3954
+ readonly weight: number;
3955
+ readonly description?: string;
3956
+ }
3957
+ /** Input for `PATCH /v1/judge-classes/{judgeClassId}` per `#UpdateJudgeClassBody`. */
3958
+ export interface UpdateJudgeClassInput {
3959
+ readonly weight?: number;
3960
+ readonly description?: string;
3961
+ }
3962
+ /** What a judged run ran: an agent at a version, or a flow at a version. */
3963
+ export interface JudgedSubject {
3964
+ readonly kind: "agent" | "flow";
3965
+ readonly id: string;
3966
+ readonly version: string;
3967
+ }
3968
+ /** The judged item of a run's output. */
3969
+ export interface JudgedItem {
3970
+ /** Your stable id for the item, e.g. a matched case's id. */
3971
+ readonly key: string;
3972
+ /** Where the item is in the run's output, as a JSON Pointer (RFC 6901), e.g. `/matches/2`. */
3973
+ readonly pointer?: string;
3974
+ /** The item's position in a ranked list (0 = first). */
3975
+ readonly rank?: number;
3976
+ }
3977
+ /** Who asserted a judgment: the authenticated caller, never a typed name. */
3978
+ export interface JudgmentAssertedBy {
3979
+ readonly kind: "user" | "service";
3980
+ readonly id: string;
3981
+ }
3982
+ /** Matches `@kindgi/api/openapi.json#Judgment`. */
3983
+ export interface Judgment {
3984
+ readonly id: string;
3985
+ readonly tenantId: string;
3986
+ readonly projectId: string;
3987
+ readonly runId: string;
3988
+ readonly subject: JudgedSubject;
3989
+ readonly item: JudgedItem;
3990
+ readonly verdict: Verdict;
3991
+ readonly reason?: string;
3992
+ /** Absent when the judgment is unclassified (it counts with weight 1). */
3993
+ readonly judgeClassId?: string;
3994
+ readonly assertedBy: JudgmentAssertedBy;
3995
+ /** An app's opaque id for its end user who judged, when it judged on their behalf. */
3996
+ readonly participantId?: string;
3997
+ readonly createdAt: Timestamp;
3998
+ /** Set when the judgment was removed or superseded. */
3999
+ readonly unregisteredAt?: Timestamp;
4000
+ /** The judgment that replaced this one. */
4001
+ readonly supersededBy?: string;
4002
+ }
4003
+ /**
4004
+ * What a judged agent turn read besides its input, captured when it was
4005
+ * first judged: the conversation before it and what its retrievals returned.
4006
+ */
4007
+ export interface JudgedRunContext {
4008
+ /** The conversation's messages before the turn, oldest first (at most the last 200). */
4009
+ readonly history?: readonly unknown[];
4010
+ /** Whether older messages were left out of `history`. */
4011
+ readonly historyTruncated?: boolean;
4012
+ /** What the turn's retrievals returned. */
4013
+ readonly retrieved?: unknown;
4014
+ }
4015
+ /** The stored copy of a judged run's input and output. */
4016
+ export interface JudgedRunCopy {
4017
+ readonly runId: string;
4018
+ readonly subject: JudgedSubject;
4019
+ readonly input: unknown;
4020
+ /** Absent for runs judged before context was captured, and for flow runs. */
4021
+ readonly context?: JudgedRunContext;
4022
+ readonly output: unknown;
4023
+ readonly capturedAt: Timestamp;
4024
+ }
4025
+ /** Matches `@kindgi/api/openapi.json#JudgmentWithCopies`. */
4026
+ export interface JudgmentWithCopies extends Judgment {
4027
+ /** The run's input and output as they were when it was first judged. */
4028
+ readonly run: JudgedRunCopy;
4029
+ /** The judged item's value, when the judgment pointed at it. */
4030
+ readonly itemValue?: unknown;
4031
+ }
4032
+ /** Input for `POST /v1/judgments` per `#CreateJudgmentBody`. */
4033
+ export interface CreateJudgmentInput {
4034
+ readonly runId: string;
4035
+ readonly item: JudgedItem;
4036
+ readonly verdict: Verdict;
4037
+ readonly reason?: string;
4038
+ /** Optional. When given it must exist and apply to the run. */
4039
+ readonly judgeClassId?: string;
4040
+ /** Your opaque id for the end user who judged, when judging on their behalf. */
4041
+ readonly participantId?: string;
4042
+ }
3619
4043
  /** Signature the resource clients call into. */
3620
4044
  export interface Transport {
3621
4045
  /** Base URL, no trailing slash. */
@@ -3800,6 +4224,20 @@ declare namespace Schemas {
3800
4224
  export type HealthResult = {
3801
4225
  ok: true;
3802
4226
  };
4227
+ /**
4228
+ * 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
+ */
4230
+ export type RunAgent = {
4231
+ /**
4232
+ * The agent id.
4233
+ */
4234
+ id: string;
4235
+ /**
4236
+ * The agent version that ran (semver).
4237
+ */
4238
+ version: string;
4239
+ conversationId: string;
4240
+ };
3803
4241
  export type Run = {
3804
4242
  /**
3805
4243
  * RunId.
@@ -3830,6 +4268,15 @@ declare namespace Schemas {
3830
4268
  * Set on a child run: the node in the parent run that started it.
3831
4269
  */
3832
4270
  parentNodeId?: string;
4271
+ agent?: RunAgent;
4272
+ /**
4273
+ * Set on a replay run (an eval run re-running a past run): the run it replays.
4274
+ */
4275
+ replayOf?: string;
4276
+ /**
4277
+ * Set on a replay run: the eval run that started it.
4278
+ */
4279
+ evalRunId?: string;
3833
4280
  /**
3834
4281
  * 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.
3835
4282
  */
@@ -3938,6 +4385,15 @@ declare namespace Schemas {
3938
4385
  * Set on a child run: the node in the parent run that started it.
3939
4386
  */
3940
4387
  parentNodeId?: string;
4388
+ agent?: RunAgent;
4389
+ /**
4390
+ * Set on a replay run (an eval run re-running a past run): the run it replays.
4391
+ */
4392
+ replayOf?: string;
4393
+ /**
4394
+ * Set on a replay run: the eval run that started it.
4395
+ */
4396
+ evalRunId?: string;
3941
4397
  /**
3942
4398
  * 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.
3943
4399
  */
@@ -4175,6 +4631,20 @@ declare namespace Schemas {
4175
4631
  */
4176
4632
  export type ReviewerRole = "standard" | "senior" | "admin";
4177
4633
  export type ApprovalStatus = "pending" | "assigned" | "in_review" | "approved" | "rejected" | "escalated" | "expired" | "withdrawn";
4634
+ export type ApprovalDecisionRecord = {
4635
+ decision: "approve" | "reject" | "escalate" | "withdraw";
4636
+ /**
4637
+ * Who decided, as an actor: `user:<userId>`, the reviewer's user. The run's journal and provenance name the decider the same way. The Kindgi runtime always records it; a deployment whose HITL binding doesn't leaves it out.
4638
+ */
4639
+ decidedBy?: string;
4640
+ reviewerId: string;
4641
+ /**
4642
+ * Reviewer role class. Hierarchy: standard < senior < admin.
4643
+ */
4644
+ reviewerRoleAtDecision: "standard" | "senior" | "admin";
4645
+ decidedAt: string;
4646
+ rationale?: string;
4647
+ };
4178
4648
  export type Approval = {
4179
4649
  id: string;
4180
4650
  tenantId: string;
@@ -4200,6 +4670,7 @@ declare namespace Schemas {
4200
4670
  updatedAt: string;
4201
4671
  decidedAt?: string;
4202
4672
  expiresAt?: string;
4673
+ decision?: ApprovalDecisionRecord;
4203
4674
  };
4204
4675
  export type ReviewDecision = {
4205
4676
  id: string;
@@ -4225,7 +4696,7 @@ declare namespace Schemas {
4225
4696
  decision: "approve" | "reject" | "escalate" | "withdraw";
4226
4697
  rationale?: string;
4227
4698
  /**
4228
- * Payload passed to the run waitpoint (`RunBinding.completeToken`) when the approval is linked to a suspended run and the decision is `approve` or `reject`.
4699
+ * Payload passed to the run waitpoint (`RunBinding.completeToken`) when the approval is linked to a suspended run and the decision is `approve` or `reject`. Refused (400 `bad-input`) for an agent's tool-call or session gate (`tool-call:pending`, `agent-turn:session-hitl-gate`): those resume on the decision alone.
4229
4700
  */
4230
4701
  value?: unknown;
4231
4702
  };
@@ -4352,68 +4823,457 @@ declare namespace Schemas {
4352
4823
  nextCursor?: string;
4353
4824
  hasMore: boolean;
4354
4825
  };
4355
- export type PromptParameter = {
4826
+ /**
4827
+ * Where a judge class applies: the whole tenant, one project, or one agent in a project.
4828
+ */
4829
+ export type JudgeClassScope = {
4830
+ kind: "tenant";
4831
+ } | {
4832
+ kind: "project";
4833
+ projectId: string;
4834
+ } | {
4835
+ kind: "agent";
4836
+ projectId: string;
4837
+ agentId: string;
4838
+ };
4839
+ export type JudgeClass = {
4840
+ id: string;
4841
+ tenantId: string;
4842
+ scope: JudgeClassScope;
4843
+ /**
4844
+ * The deployment's own word for the class: "expert", "user", "arbitrator".
4845
+ */
4356
4846
  name: string;
4847
+ /**
4848
+ * How much a judgment of this class counts, relative to the others.
4849
+ */
4850
+ weight: number;
4357
4851
  description?: string;
4358
- type: "string" | "number" | "boolean" | "date";
4359
- required?: boolean;
4852
+ createdAt: string;
4853
+ updatedAt: string;
4360
4854
  /**
4361
- * Default value used when the caller omits this parameter.
4855
+ * Set when the class was retired.
4362
4856
  */
4363
- default?: unknown;
4857
+ unregisteredAt?: string;
4364
4858
  };
4365
- export type RetrievalIntent = {
4366
- types: Array<string>;
4367
- scope: "same-conversation" | "same-project" | "tenant";
4368
- limit?: number;
4369
- mode?: "keyword" | "semantic" | "both";
4859
+ export type JudgeClassCollectionPage = {
4860
+ data: Array<JudgeClass>;
4861
+ /**
4862
+ * Opaque cursor. Treat as opaque on the client.
4863
+ */
4864
+ nextCursor?: string;
4865
+ hasMore: boolean;
4370
4866
  };
4371
- export type ConversationPolicy = Partial<{
4372
- historyLimit: number;
4373
- autoCloseAfterInactiveSeconds: number;
4374
- hitlAfterTurns: number;
4375
- }>;
4376
- export type TurnBudget = Partial<{
4377
- maxSteps: number;
4378
- maxCostUsd: number;
4379
- maxWallMs: number;
4867
+ export type CreateJudgeClassBody = {
4868
+ scope: JudgeClassScope;
4869
+ name: string;
4870
+ weight: number;
4871
+ description?: string;
4872
+ };
4873
+ export type UpdateJudgeClassBody = Partial<{
4874
+ weight: number;
4875
+ description: string;
4380
4876
  }>;
4877
+ export type UnregisterJudgeClassResult = {
4878
+ judgeClassId: string;
4879
+ unregistered: true;
4880
+ };
4381
4881
  /**
4382
- * Capability declaration — see `@kindgi/capabilities`. Additional properties are permitted so new capability kinds do not require a wire change.
4383
- */
4384
- export type Capability = Record<string, unknown>;
4385
- /**
4386
- * Typed tool reference. `version` is a semver **range** (npm-style: `1.2.3` exact pin, `^1.2.3` compatible-updates, `~1.2.3` patch-updates-only, `>=1.0.0 <2.0.0` explicit range). Dispatch resolves the range to a concrete active version via `semver.maxSatisfying` at run start. No implicit "latest" — every tool ref names both id and range.
4882
+ * What a judged run ran: an agent at a version, or a flow at a version.
4387
4883
  */
4388
- export type ToolRef = {
4884
+ export type JudgedSubject = {
4885
+ kind: "agent" | "flow";
4389
4886
  id: string;
4390
4887
  version: string;
4391
4888
  };
4392
- export type AgentOutputSpec = {
4889
+ /**
4890
+ * The judged item of a run's output.
4891
+ */
4892
+ export type JudgedItem = {
4393
4893
  /**
4394
- * JSON Schema (draft 2020-12) the final answer must match.
4894
+ * The caller's stable id for the item.
4395
4895
  */
4396
- schema: Record<string, unknown>;
4896
+ key: string;
4397
4897
  /**
4398
- * A name for the output, shown to the model and in errors. Default `output`.
4898
+ * Where the item is in the run's output, as a JSON Pointer (RFC 6901), e.g. `/matches/2`. `""` is the whole output.
4399
4899
  */
4400
- name?: string;
4900
+ pointer?: string;
4401
4901
  /**
4402
- * How many times the model is asked to repair an invalid answer. Default 1.
4902
+ * The item's position in a ranked list (0 = first).
4403
4903
  */
4404
- maxRepairs?: number;
4904
+ rank?: number;
4405
4905
  };
4406
- export type ToolErrorsSpec = Partial<{
4906
+ /**
4907
+ * Who asserted a judgment: the authenticated caller, never a typed name.
4908
+ */
4909
+ export type JudgmentAssertedBy = {
4910
+ kind: "user" | "service";
4407
4911
  /**
4408
- * Failed calls sent back to the model per turn. Default 1.
4912
+ * A user id, or for a service token its token or session id.
4409
4913
  */
4410
- maxRetries: number;
4914
+ id: string;
4915
+ };
4916
+ export type Judgment = {
4917
+ id: string;
4918
+ tenantId: string;
4919
+ projectId: string;
4920
+ runId: string;
4921
+ subject: JudgedSubject;
4922
+ item: JudgedItem;
4923
+ verdict: "yes" | "no";
4924
+ reason?: string;
4411
4925
  /**
4412
- * Which failures are sent back: arguments that don't fit the input schema (`invalid-arguments`), a tool the agent doesn't have (`unknown-tool`), a tool that ran and failed (`tool-error`). Default `invalid-arguments`, `unknown-tool`.
4926
+ * The judge class the judgment is recorded under. Absent when unclassified (counts with weight 1).
4413
4927
  */
4414
- retryOn: Array<"invalid-arguments" | "unknown-tool" | "tool-error">;
4415
- }>;
4416
- export type Agent = {
4928
+ judgeClassId?: string;
4929
+ assertedBy: JudgmentAssertedBy;
4930
+ /**
4931
+ * The app's opaque id for its end user who judged, when an app judged on their behalf.
4932
+ */
4933
+ participantId?: string;
4934
+ createdAt: string;
4935
+ /**
4936
+ * Set when the judgment was removed or superseded.
4937
+ */
4938
+ unregisteredAt?: string;
4939
+ /**
4940
+ * The judgment that replaced this one.
4941
+ */
4942
+ supersededBy?: string;
4943
+ };
4944
+ /**
4945
+ * What a judged run needs besides its input to be replayed, captured when it was first judged. For an agent turn: the conversation before it, what its retrievals returned, and the decision at its session approval gate. For a flow run: its tool calls with their results.
4946
+ */
4947
+ export type JudgedRunContext = Partial<{
4948
+ /**
4949
+ * The conversation's messages before the turn, oldest first (at most the last 200).
4950
+ */
4951
+ history: Array<unknown>;
4952
+ /**
4953
+ * Whether older messages were left out of `history`.
4954
+ */
4955
+ historyTruncated: boolean;
4956
+ /**
4957
+ * What the turn's retrievals returned.
4958
+ */
4959
+ retrieved: unknown;
4960
+ /**
4961
+ * The reviewer's decision at the turn's session approval gate, when the turn waited on one. A replay of the turn follows it.
4962
+ */
4963
+ sessionApproval: {
4964
+ approved: boolean;
4965
+ /**
4966
+ * The reviewer's reason for a rejection.
4967
+ */
4968
+ rationale?: string;
4969
+ };
4970
+ /**
4971
+ * For a flow run: what it did, kept at its first judgment so it can be replayed. Every tool call it made with its result (at its tool nodes, in its agent steps' turns and in its sub-flows), at most 500, and its agent steps.
4972
+ */
4973
+ flow: {
4974
+ calls: Array<{
4975
+ /**
4976
+ * The run that made it: the flow run, a sub-flow's, or an agent step's turn.
4977
+ */
4978
+ runId: string;
4979
+ /**
4980
+ * The tool node that made it, or the agent step whose turn did.
4981
+ */
4982
+ nodeId?: string;
4983
+ /**
4984
+ * The loop iteration, in a loop body.
4985
+ */
4986
+ scope?: string;
4987
+ toolId: string;
4988
+ arguments?: unknown;
4989
+ result?: unknown;
4990
+ }>;
4991
+ steps: Array<{
4992
+ runId: string;
4993
+ nodeId?: string;
4994
+ scope?: string;
4995
+ agentId: string;
4996
+ agentVersion: string;
4997
+ /**
4998
+ * What the step's turn retrieved.
4999
+ */
5000
+ retrieved?: unknown;
5001
+ }>;
5002
+ /**
5003
+ * More calls were made than were kept.
5004
+ */
5005
+ truncated?: boolean;
5006
+ };
5007
+ }>;
5008
+ /**
5009
+ * The stored copy of a judged run's input and output, taken when it was first judged.
5010
+ */
5011
+ export type JudgedRunCopy = {
5012
+ runId: string;
5013
+ subject: JudgedSubject;
5014
+ input: unknown;
5015
+ context?: JudgedRunContext;
5016
+ output: unknown;
5017
+ capturedAt: string;
5018
+ };
5019
+ /**
5020
+ * A judgment with the stored copies of what was judged.
5021
+ */
5022
+ export type JudgmentWithCopies = Judgment & {
5023
+ run: JudgedRunCopy;
5024
+ /**
5025
+ * The judged item's value, when the judgment pointed at it.
5026
+ */
5027
+ itemValue?: unknown;
5028
+ };
5029
+ export type JudgmentCollectionPage = {
5030
+ data: Array<Judgment>;
5031
+ /**
5032
+ * Opaque cursor. Treat as opaque on the client.
5033
+ */
5034
+ nextCursor?: string;
5035
+ hasMore: boolean;
5036
+ };
5037
+ export type CreateJudgmentBody = {
5038
+ runId: string;
5039
+ item: JudgedItem;
5040
+ verdict: "yes" | "no";
5041
+ reason?: string;
5042
+ /**
5043
+ * Optional. When given it must exist and apply to the run.
5044
+ */
5045
+ judgeClassId?: string;
5046
+ /**
5047
+ * An app's opaque id for its end user, when judging on their behalf.
5048
+ */
5049
+ participantId?: string;
5050
+ };
5051
+ export type UnregisterJudgmentResult = {
5052
+ judgmentId: string;
5053
+ unregistered: true;
5054
+ };
5055
+ /**
5056
+ * The judgments of one item of a case's output, summed up.
5057
+ */
5058
+ export type JudgedItemSummary = {
5059
+ key: string;
5060
+ pointer?: string;
5061
+ rank?: number;
5062
+ /**
5063
+ * How many judgments said yes.
5064
+ */
5065
+ yes: number;
5066
+ /**
5067
+ * How many judgments said no.
5068
+ */
5069
+ no: number;
5070
+ /**
5071
+ * The weight behind "yes" (an unclassified judgment counts 1).
5072
+ */
5073
+ yesWeight: number;
5074
+ /**
5075
+ * The weight behind all judgments of the item.
5076
+ */
5077
+ totalWeight: number;
5078
+ /**
5079
+ * The reasons given, newest first.
5080
+ */
5081
+ reasons: Array<{
5082
+ verdict: "yes" | "no";
5083
+ reason: string;
5084
+ }>;
5085
+ };
5086
+ /**
5087
+ * One case of a `judged` eval suite: a copy of a judged run with its items' judgments summed up.
5088
+ */
5089
+ export type JudgedEvalCase = {
5090
+ /**
5091
+ * The judged run's id.
5092
+ */
5093
+ caseId: string;
5094
+ subject: JudgedSubject;
5095
+ input: unknown;
5096
+ context?: JudgedRunContext;
5097
+ output: unknown;
5098
+ items: Array<JudgedItemSummary>;
5099
+ };
5100
+ export type JudgedEvalCaseCollectionPage = {
5101
+ data: Array<JudgedEvalCase>;
5102
+ /**
5103
+ * Opaque cursor. Treat as opaque on the client.
5104
+ */
5105
+ nextCursor?: string;
5106
+ hasMore: boolean;
5107
+ };
5108
+ /**
5109
+ * Name the agent (`agentId`) or the flow (`flowId`) whose judged runs to use.
5110
+ */
5111
+ export type BuildJudgedSuiteBody = {
5112
+ /**
5113
+ * Semver version to publish, e.g. `1.0.0`.
5114
+ */
5115
+ version: string;
5116
+ projectId: string;
5117
+ agentId?: string;
5118
+ /**
5119
+ * Needs `agentId`.
5120
+ */
5121
+ agentVersion?: string;
5122
+ flowId?: string;
5123
+ /**
5124
+ * Runs first judged at or after this time.
5125
+ */
5126
+ since?: string;
5127
+ /**
5128
+ * Runs first judged before this time.
5129
+ */
5130
+ until?: string;
5131
+ /**
5132
+ * Count only judgments recorded under these judge classes.
5133
+ */
5134
+ judgeClassIds?: Array<string>;
5135
+ /**
5136
+ * Leave out runs with fewer counted judgments. Default 1.
5137
+ */
5138
+ minJudgments?: number;
5139
+ description?: string;
5140
+ };
5141
+ export type BuildJudgedSuiteResult = {
5142
+ suiteId: string;
5143
+ version: string;
5144
+ kind: "judged";
5145
+ caseCount: number;
5146
+ /**
5147
+ * Whether more judged runs matched than the 1000 cases a set holds.
5148
+ */
5149
+ truncated: boolean;
5150
+ };
5151
+ export type PromptParameter = {
5152
+ name: string;
5153
+ description?: string;
5154
+ type: "string" | "number" | "boolean" | "date";
5155
+ required?: boolean;
5156
+ /**
5157
+ * Default value used when the caller omits this parameter.
5158
+ */
5159
+ default?: unknown;
5160
+ };
5161
+ export type RetrievalIntent = {
5162
+ types: Array<string>;
5163
+ scope: "same-conversation" | "same-project" | "tenant";
5164
+ limit?: number;
5165
+ mode?: "keyword" | "semantic" | "both";
5166
+ };
5167
+ export type ConversationPolicy = Partial<{
5168
+ historyLimit: number;
5169
+ autoCloseAfterInactiveSeconds: number;
5170
+ hitlAfterTurns: number;
5171
+ }>;
5172
+ export type TurnBudget = Partial<{
5173
+ maxSteps: number;
5174
+ maxCostUsd: number;
5175
+ maxWallMs: number;
5176
+ }>;
5177
+ /**
5178
+ * Capability declaration — see `@kindgi/capabilities`. Additional properties are permitted so new capability kinds do not require a wire change.
5179
+ */
5180
+ export type Capability = Record<string, unknown>;
5181
+ /**
5182
+ * Typed tool reference. `version` is a semver **range** (npm-style: `1.2.3` exact pin, `^1.2.3` compatible-updates, `~1.2.3` patch-updates-only, `>=1.0.0 <2.0.0` explicit range). Dispatch resolves the range to a concrete active version via `semver.maxSatisfying` at run start. No implicit "latest" — every tool ref names both id and range.
5183
+ */
5184
+ export type ToolRef = {
5185
+ id: string;
5186
+ version: string;
5187
+ };
5188
+ export type AgentOutputSpec = {
5189
+ /**
5190
+ * JSON Schema (draft 2020-12) the final answer must match.
5191
+ */
5192
+ schema: Record<string, unknown>;
5193
+ /**
5194
+ * A name for the output, shown to the model and in errors. Default `output`.
5195
+ */
5196
+ name?: string;
5197
+ /**
5198
+ * How many times the model is asked to repair an invalid answer. Default 1.
5199
+ */
5200
+ maxRepairs?: number;
5201
+ };
5202
+ export type ToolErrorsSpec = Partial<{
5203
+ /**
5204
+ * Failed calls sent back to the model per turn. Default 1.
5205
+ */
5206
+ maxRetries: number;
5207
+ /**
5208
+ * Which failures are sent back: arguments that don't fit the input schema (`invalid-arguments`), a tool the agent doesn't have (`unknown-tool`), a tool that ran and failed (`tool-error`). Default `invalid-arguments`, `unknown-tool`.
5209
+ */
5210
+ retryOn: Array<"invalid-arguments" | "unknown-tool" | "tool-error">;
5211
+ }>;
5212
+ /**
5213
+ * A prompt block an agent's instructions come from, by id and semver range.
5214
+ */
5215
+ export type PromptRef = {
5216
+ /**
5217
+ * The prompt block id.
5218
+ */
5219
+ prompt: string;
5220
+ /**
5221
+ * A semver range (`^1.0.0`, `1.2.0`).
5222
+ */
5223
+ version: string;
5224
+ };
5225
+ /**
5226
+ * A settings block an agent reads, by id and semver range.
5227
+ */
5228
+ export type BlockRef = {
5229
+ /**
5230
+ * The settings block id.
5231
+ */
5232
+ id: string;
5233
+ /**
5234
+ * A semver range (`^1.0.0`, `1.2.0`).
5235
+ */
5236
+ version: string;
5237
+ };
5238
+ /**
5239
+ * The exact block versions an agent version runs: its lockfile. Set by the runtime when the version is published, never in the publish body: each tool range resolves once to the version every run of that agent version uses, so a new tool version reaches the agent only through a new agent version. Absent on a version published before pins existed (its ranges resolve per run).
5240
+ */
5241
+ export type AgentPins = {
5242
+ /**
5243
+ * Tool id → exact version.
5244
+ */
5245
+ tools: Record<string, string>;
5246
+ /**
5247
+ * Prompt block id → exact version.
5248
+ */
5249
+ prompts: Record<string, string>;
5250
+ /**
5251
+ * Settings block id → exact version.
5252
+ */
5253
+ settings: Record<string, string>;
5254
+ };
5255
+ /**
5256
+ * Set by the runtime on an agent or flow version a deploy registered in place of the definition's version, which was registered already with other pins or content (versions never change). Never in the publish body.
5257
+ */
5258
+ export type VersionDerivation = {
5259
+ /**
5260
+ * The version the definition names.
5261
+ */
5262
+ version: string;
5263
+ /**
5264
+ * `pins-changed`: a block it uses has a new version; `unpinned`: the definition's version was published before pins existed; `version-taken`: the definition's version holds another definition; `edited`: derived from `version` with some data-block pins swapped (`POST /v1/agents/{agentId}/versions`).
5265
+ */
5266
+ reason: "pins-changed" | "unpinned" | "version-taken" | "edited";
5267
+ /**
5268
+ * For `edited`: a short label for the version.
5269
+ */
5270
+ label?: string;
5271
+ /**
5272
+ * For `edited`: who derived it (`user:<id>`).
5273
+ */
5274
+ by?: string;
5275
+ };
5276
+ export type Agent = {
4417
5277
  /**
4418
5278
  * AgentId — dotted namespace (e.g. `acme.drafting`).
4419
5279
  */
@@ -4424,8 +5284,16 @@ declare namespace Schemas {
4424
5284
  version: string;
4425
5285
  name: string;
4426
5286
  description?: string;
4427
- instructions: string;
5287
+ /**
5288
+ * The system prompt (a Liquid template), or a prompt block by range whose template and parameters are used instead (pinned at publish, `pins.prompts`).
5289
+ */
5290
+ instructions: string | PromptRef;
4428
5291
  parameters?: Array<PromptParameter>;
5292
+ /**
5293
+ * Settings blocks the agent reads, by range: tools read them as `ToolContext.settings['<id>']`, templates as `settings["<id>"]`. Pinned at publish (`pins.settings`).
5294
+ */
5295
+ settings?: Array<BlockRef>;
5296
+ modelSettings?: BlockRef;
4429
5297
  capabilities: Array<Capability>;
4430
5298
  tools: Array<ToolRef>;
4431
5299
  retrieval: Array<RetrievalIntent>;
@@ -4443,6 +5311,75 @@ declare namespace Schemas {
4443
5311
  tags?: Array<string>;
4444
5312
  output?: AgentOutputSpec;
4445
5313
  toolErrors?: ToolErrorsSpec;
5314
+ pins?: AgentPins;
5315
+ derivedFrom?: VersionDerivation;
5316
+ /**
5317
+ * Present only on an unregistered version (`GET …/versions/{version}` reads those too). Unregister stops a version being chosen, not the pins that hold it: a new run naming it is refused, while a resumed run and a published version that pins it still run it.
5318
+ */
5319
+ unregisteredAt?: string;
5320
+ /**
5321
+ * Set by the runtime with `pins`: `sha256:<hex>` of the pins' canonical JSON (sorted keys, no whitespace). Two agent versions with the same digest run the same blocks.
5322
+ */
5323
+ pinsDigest?: string;
5324
+ };
5325
+ /**
5326
+ * One pin that differs between two versions of an agent or a flow.
5327
+ */
5328
+ export type PinChange = {
5329
+ kind: "tool" | "prompt" | "setting" | "agent";
5330
+ id: string;
5331
+ /**
5332
+ * The earlier version's pin; absent when it had none.
5333
+ */
5334
+ from?: string;
5335
+ /**
5336
+ * The later version's pin; absent when it has none.
5337
+ */
5338
+ to?: string;
5339
+ };
5340
+ /**
5341
+ * The data-block pins to swap, by block id → exact version. Only blocks the version already references; tool pins come from code.
5342
+ */
5343
+ export type AgentPinSwaps = Partial<{
5344
+ /**
5345
+ * Prompt block id → exact version.
5346
+ */
5347
+ prompts: Record<string, string>;
5348
+ /**
5349
+ * Settings block id → exact version.
5350
+ */
5351
+ settings: Record<string, string>;
5352
+ }>;
5353
+ /**
5354
+ * Derive a new agent version from a pinned one with some data-block pins swapped: an expert's edit reaching an agent with no code change.
5355
+ */
5356
+ export type DeriveAgentVersionBody = {
5357
+ /**
5358
+ * The version to derive from (it must be pinned).
5359
+ */
5360
+ from: string;
5361
+ pins: AgentPinSwaps;
5362
+ /**
5363
+ * A short label for the new version.
5364
+ */
5365
+ label?: string;
5366
+ /**
5367
+ * The agent's project, when the runtime doesn't record it on the version.
5368
+ */
5369
+ projectId?: string;
5370
+ };
5371
+ /**
5372
+ * The exact tool and agent versions a flow version runs: its lockfile. Set by the runtime when the version is published, never in the publish body: each tool the flow runs, and each agent it runs at no named version, resolves once to its latest version then, which every run of that flow version uses. Absent on a version published before pins existed (it binds the latest versions per run).
5373
+ */
5374
+ export type FlowPins = {
5375
+ /**
5376
+ * Tool id → exact version.
5377
+ */
5378
+ tools: Record<string, string>;
5379
+ /**
5380
+ * Agent id → exact version, for agent nodes that name no version.
5381
+ */
5382
+ agents: Record<string, string>;
4446
5383
  };
4447
5384
  /**
4448
5385
  * Full `defineAgent` spec. Validated server-side via `@kindgi/agents.defineAgent` — validation failures return `400 validation-failed` with the issue list under `details.issues`.
@@ -4456,8 +5393,16 @@ declare namespace Schemas {
4456
5393
  * Project this belongs to (its content scope). Required: missing, or not a project in the caller's tenant → `400 bad-input`.
4457
5394
  */
4458
5395
  projectId: string;
4459
- instructions: string;
5396
+ /**
5397
+ * The system prompt (a Liquid template), or a prompt block by range whose template and parameters are used instead (pinned at publish, `pins.prompts`).
5398
+ */
5399
+ instructions: string | PromptRef;
4460
5400
  parameters?: Array<PromptParameter>;
5401
+ /**
5402
+ * Settings blocks the agent reads, by range: tools read them as `ToolContext.settings['<id>']`, templates as `settings["<id>"]`. Pinned at publish (`pins.settings`).
5403
+ */
5404
+ settings?: Array<BlockRef>;
5405
+ modelSettings?: BlockRef;
4461
5406
  capabilities: Array<Capability>;
4462
5407
  tools: Array<ToolRef>;
4463
5408
  retrieval: Array<RetrievalIntent>;
@@ -4544,6 +5489,16 @@ declare namespace Schemas {
4544
5489
  edges: Array<FlowEdge>;
4545
5490
  maxParallelism?: number;
4546
5491
  metadata?: Record<string, unknown>;
5492
+ pins?: FlowPins;
5493
+ /**
5494
+ * Set by the runtime with `pins`: `sha256:<hex>` of the pins' canonical JSON (sorted keys, no whitespace).
5495
+ */
5496
+ pinsDigest?: string;
5497
+ derivedFrom?: VersionDerivation;
5498
+ /**
5499
+ * Present only on an unregistered version (`GET …/versions/{version}` reads those too). Unregister stops a version being chosen, not the pins that hold it: a new run naming it is refused, while a resumed run and a published version that pins it still run it.
5500
+ */
5501
+ unregisteredAt?: string;
4547
5502
  };
4548
5503
  /**
4549
5504
  * Full flow definition. Validated server-side via `@kindgi/flow.loadFlow` — validation failures return `400 validation-failed` with the issue list under `details.issues`.
@@ -4925,6 +5880,10 @@ declare namespace Schemas {
4925
5880
  agentVersion: string;
4926
5881
  title: string;
4927
5882
  participantId?: string;
5883
+ /**
5884
+ * The project the conversation is in: the project of the run that opened it, or `projectId` on open (the tenant's Default project when omitted). Absent on conversations from before Kindgi 0.1.3; those are listed only without a scope.
5885
+ */
5886
+ projectId?: string;
4928
5887
  /**
4929
5888
  * Free-form scope object (currently `{ tenantId }` in tests; enterprises extend with `matterId`, `engagementId`, etc.).
4930
5889
  */
@@ -4969,6 +5928,10 @@ declare namespace Schemas {
4969
5928
  * Optional. Defaults to `"Untitled conversation"` when omitted.
4970
5929
  */
4971
5930
  title?: string;
5931
+ /**
5932
+ * The project the conversation is in; `GET /v1/conversations?scopeKind=project&scopeId=…` lists it. A project of the caller's tenant, else `400 bad-input`. Omitted: the tenant's Default project, as for a run.
5933
+ */
5934
+ projectId?: string;
4972
5935
  /**
4973
5936
  * Structural scope (project id, matter id, etc.). Treated opaquely by the runtime.
4974
5937
  */
@@ -5263,6 +6226,20 @@ declare namespace Schemas {
5263
6226
  */
5264
6227
  signed: boolean;
5265
6228
  createdAt: string;
6229
+ /**
6230
+ * The project of the record's run. Absent on records from before Kindgi 0.1.3; those are listed only without a scope.
6231
+ */
6232
+ projectId?: string;
6233
+ };
6234
+ /**
6235
+ * The call's tokens. `promptTokens` / `completionTokens` are the totals; `cacheReadTokens` / `cacheWriteTokens` are parts of `promptTokens`, `reasoningTokens` of `completionTokens`, present when the provider reports them.
6236
+ */
6237
+ export type ModelCallTokens = {
6238
+ promptTokens: number;
6239
+ completionTokens: number;
6240
+ cacheReadTokens?: number;
6241
+ cacheWriteTokens?: number;
6242
+ reasoningTokens?: number;
5266
6243
  };
5267
6244
  /**
5268
6245
  * Full provenance record including the DAG payload.
@@ -5307,6 +6284,15 @@ declare namespace Schemas {
5307
6284
  signedAt: string;
5308
6285
  };
5309
6286
  createdAt: string;
6287
+ /**
6288
+ * Each model call's usage from the cost ledger, by the `callId` in its `model-call` node's attributes. Joined when read: not part of the signed DAG. A signed export includes it, as it stood when signed.
6289
+ */
6290
+ callUsage?: Record<string, {
6291
+ usage: ModelCallTokens;
6292
+ costUsd?: number;
6293
+ durationMs?: number;
6294
+ servedModel?: string;
6295
+ }>;
5310
6296
  };
5311
6297
  export type ProvenanceCollectionPage = {
5312
6298
  data: Array<ProvenanceRecordMetadata>;
@@ -5324,7 +6310,7 @@ declare namespace Schemas {
5324
6310
  includeMessages?: boolean;
5325
6311
  };
5326
6312
  /**
5327
- * Signed exportable bundle. `bundle` is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace); verifiers can pass those bytes directly to `verifyEd25519`. The bundle body itself includes `bundleSchemaVersion`, `runId`, `tenantId`, `dag: { nodes, edges }`, `messages?` (if requested), etc. See `canonicalization` for the deterministic serialization algorithm.
6313
+ * Signed exportable bundle. `bundle` is base64 of the exact bytes that were signed (sorted-key canonical JSON, no whitespace); verifiers can pass those bytes directly to `verifyEd25519`. The bundle body itself includes `bundleSchemaVersion`, `runId`, `tenantId`, `dag: { nodes, edges }`, `messages?` (if requested), `callUsage?` (the usage of the model calls, from the cost ledger), etc. See `canonicalization` for the deterministic serialization algorithm.
5328
6314
  */
5329
6315
  export type ExportProvenanceResult = {
5330
6316
  runId: string;
@@ -5333,7 +6319,7 @@ declare namespace Schemas {
5333
6319
  */
5334
6320
  bundle: string;
5335
6321
  /**
5336
- * Semver for the shape of the bundle body. Currently `1.0.0`.
6322
+ * Semver for the shape of the bundle body. Currently `1.1.0`, which adds `callUsage`: each model call's usage from the cost ledger, by call id, as it stood when signed.
5337
6323
  */
5338
6324
  bundleSchemaVersion: string;
5339
6325
  algorithm: "ed25519";
@@ -5523,6 +6509,10 @@ declare namespace Schemas {
5523
6509
  * A fallback serves a capability only when no other provider satisfies it (e.g. `kindgi dev`'s scripted `dev-echo`); an agent turn routed to one carries a `fallback-provider` warning. Absent = `false`.
5524
6510
  */
5525
6511
  fallback?: boolean;
6512
+ /**
6513
+ * Bookkeeping, such as who manages the provider; the router ignores labels. At most 32 keys; a key is 1-63 lowercase letters and digits, with `.`, `-`, `_` or `/` inside; a value is at most 256 characters. The convention key `kindgi.com/managed-by` names the manager (`kindgi-dev`, `kindgi-deploy:<environment>`). Out of bounds: `400 invalid-provider`, reason `invalid-labels`.
6514
+ */
6515
+ labels?: Record<string, string>;
5526
6516
  };
5527
6517
  export type ProviderCollectionPage = {
5528
6518
  data: Array<ProviderMetadata>;
@@ -5719,7 +6709,13 @@ declare namespace Schemas {
5719
6709
  export type GetMCPPromptResult = {
5720
6710
  messages: Array<MCPPromptMessage>;
5721
6711
  };
5722
- export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId";
6712
+ export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId" | "model" | "servedModel" | "projectId" | "orgId" | "rootRunId" | "flowId";
6713
+ /**
6714
+ * Why a model call failed (`status: failed`).
6715
+ */
6716
+ export type ModelCallError = {
6717
+ message: string;
6718
+ };
5723
6719
  export type CostRecord = {
5724
6720
  id: string;
5725
6721
  tenantId: string;
@@ -5746,6 +6742,76 @@ declare namespace Schemas {
5746
6742
  * Free-form filter/display tags — never counters.
5747
6743
  */
5748
6744
  attributes?: Record<string, unknown>;
6745
+ /**
6746
+ * A model call's id (`category` `llm.inference`); its provenance `model-call` node carries it too.
6747
+ */
6748
+ callId?: string;
6749
+ projectId?: string;
6750
+ /**
6751
+ * The root of the record's run tree (a flow run, for its agent turns).
6752
+ */
6753
+ rootRunId?: string;
6754
+ parentRunId?: string;
6755
+ agentVersion?: string;
6756
+ /**
6757
+ * The flow of the run tree's root.
6758
+ */
6759
+ flowId?: string;
6760
+ /**
6761
+ * The step that made the call.
6762
+ */
6763
+ nodeId?: string;
6764
+ /**
6765
+ * The turn's step number.
6766
+ */
6767
+ step?: number;
6768
+ /**
6769
+ * What the call was for, beyond the turn's own model step: `guardrail-judge:<guardrail id>`.
6770
+ */
6771
+ purpose?: string;
6772
+ /**
6773
+ * The model actually called.
6774
+ */
6775
+ model?: string;
6776
+ /**
6777
+ * The exact model version the vendor reported (vendors alias).
6778
+ */
6779
+ servedModel?: string;
6780
+ /**
6781
+ * The router picked a fallback provider for the turn.
6782
+ */
6783
+ fallback?: boolean;
6784
+ /**
6785
+ * `ok`: the provider answered. `failed`: the call threw.
6786
+ */
6787
+ status?: "ok" | "failed";
6788
+ usage?: ModelCallTokens;
6789
+ durationMs?: number;
6790
+ finishReason?: string;
6791
+ /**
6792
+ * The vendor's id for the request.
6793
+ */
6794
+ providerRequestId?: string;
6795
+ /**
6796
+ * HTTP attempts the call took, the client's retries included.
6797
+ */
6798
+ attempts?: number;
6799
+ error?: ModelCallError;
6800
+ /**
6801
+ * The vendor's own usage object, exactly as it reported it. Only with `include=rawUsage`.
6802
+ */
6803
+ rawUsage?: {
6804
+ provider: string;
6805
+ model: string;
6806
+ usage: Record<string, unknown>;
6807
+ };
6808
+ };
6809
+ export type CostTokenTotals = {
6810
+ prompt: number;
6811
+ completion: number;
6812
+ cacheRead: number;
6813
+ cacheWrite: number;
6814
+ reasoning: number;
5749
6815
  };
5750
6816
  export type CostRecordCollectionPage = {
5751
6817
  data: Array<CostRecord>;
@@ -5759,11 +6825,24 @@ declare namespace Schemas {
5759
6825
  key: Record<string, string | null>;
5760
6826
  count: number;
5761
6827
  totalUsd: number;
6828
+ tokens: CostTokenTotals;
5762
6829
  };
5763
6830
  export type CostAggregateResult = {
6831
+ /**
6832
+ * The most expensive groups first (`totalUsd` descending, ties by key), at most `limit`.
6833
+ */
5764
6834
  groups: Array<CostAggregateGroup>;
6835
+ /**
6836
+ * How many groups there were before the `limit` cap. Absent from a runtime before 0.1.5.
6837
+ */
6838
+ totalGroups?: number;
6839
+ /**
6840
+ * `true` when there were more groups than `limit`: `groups` holds the most expensive ones, and `totalUsd` / `totalRecords` / `tokens` still cover every record. Absent from a runtime before 0.1.5.
6841
+ */
6842
+ truncated?: boolean;
5765
6843
  totalUsd: number;
5766
6844
  totalRecords: number;
6845
+ tokens: CostTokenTotals;
5767
6846
  timeRange: {
5768
6847
  from: string;
5769
6848
  to: string;
@@ -5882,7 +6961,7 @@ declare namespace Schemas {
5882
6961
  version: string;
5883
6962
  wasTombstoned: boolean;
5884
6963
  };
5885
- export type EvalKind = "accuracy" | "pairwise" | "regression" | "human-review" | "benchmark" | "custom";
6964
+ export type EvalKind = "accuracy" | "pairwise" | "regression" | "human-review" | "benchmark" | "custom" | "judged";
5886
6965
  export type EvalSuite = {
5887
6966
  id: string;
5888
6967
  tenantId: string;
@@ -5931,6 +7010,79 @@ declare namespace Schemas {
5931
7010
  version: string;
5932
7011
  wasTombstoned: boolean;
5933
7012
  };
7013
+ /**
7014
+ * `prompt`: a Liquid template an agent renders as its instructions. `settings`: a JSON object tools and templates read.
7015
+ */
7016
+ export type BlockKind = "prompt" | "settings";
7017
+ export type PromptBlockContent = {
7018
+ /**
7019
+ * Liquid, rendered as an agent's instructions are (same parameters and auto-injected variables).
7020
+ */
7021
+ template: string;
7022
+ parameters?: Array<PromptParameter>;
7023
+ };
7024
+ export type SettingsBlockContent = {
7025
+ /**
7026
+ * What tools read (`ToolContext.settings[<block id>]`) and templates read (`settings.<block id>.<key>`).
7027
+ */
7028
+ values: Record<string, unknown>;
7029
+ /**
7030
+ * JSON Schema (draft 2020-12) the values must satisfy. A later version's values must satisfy the latest version's schema too.
7031
+ */
7032
+ schema?: Record<string, unknown>;
7033
+ };
7034
+ /**
7035
+ * A data block version: a prompt or settings, versioned like a tool (immutable versions, soft unregister). An agent version pins the block versions it uses when it is published. Belongs to one project and is authorized through it.
7036
+ */
7037
+ export type Block = {
7038
+ /**
7039
+ * Dotted lowercase id (e.g. `acme.intake-prompt`).
7040
+ */
7041
+ id: string;
7042
+ version: string;
7043
+ kind: BlockKind;
7044
+ description?: string;
7045
+ /**
7046
+ * `PromptBlockContent` for a prompt, `SettingsBlockContent` for settings.
7047
+ */
7048
+ content: PromptBlockContent | SettingsBlockContent;
7049
+ projectId: string;
7050
+ publishedAt: string;
7051
+ /**
7052
+ * Present only on an unregistered version; agent versions that pin it still read it.
7053
+ */
7054
+ unregisteredAt?: string;
7055
+ };
7056
+ export type BlockCollectionPage = {
7057
+ data: Array<Block>;
7058
+ nextCursor?: string;
7059
+ hasMore: boolean;
7060
+ };
7061
+ export type PublishBlockBody = {
7062
+ /**
7063
+ * Project this belongs to (its content scope). Required: missing, or not a project in the caller's tenant → `400 bad-input`.
7064
+ */
7065
+ projectId: string;
7066
+ id: string;
7067
+ version: string;
7068
+ kind: BlockKind;
7069
+ description?: string;
7070
+ content: PromptBlockContent | SettingsBlockContent;
7071
+ };
7072
+ export type PublishBlockResult = {
7073
+ blockId: string;
7074
+ version: string;
7075
+ };
7076
+ export type UnregisterBlockResult = {
7077
+ blockId: string;
7078
+ version: string;
7079
+ unregistered: true;
7080
+ };
7081
+ export type ReinstateBlockResult = {
7082
+ blockId: string;
7083
+ version: string;
7084
+ wasTombstoned: boolean;
7085
+ };
5934
7086
  export type EvalRunStatus = "pending" | "running" | "completed" | "failed" | "cancelled";
5935
7087
  export type EvalRunAgentRef = {
5936
7088
  agentId: string;
@@ -5940,6 +7092,30 @@ declare namespace Schemas {
5940
7092
  flowId: string;
5941
7093
  version?: string;
5942
7094
  };
7095
+ /**
7096
+ * 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.
7097
+ */
7098
+ export type EvalBaseline = "recorded" | {
7099
+ agentId: string;
7100
+ version: string;
7101
+ } | {
7102
+ live: Partial<{
7103
+ projectId: string;
7104
+ segments: Record<string, string>;
7105
+ }>;
7106
+ };
7107
+ /**
7108
+ * A comparison eval run's settings (a `judged` suite).
7109
+ */
7110
+ export type EvalComparison = {
7111
+ baseline: EvalBaseline;
7112
+ /**
7113
+ * Whether replayed reads use the past run's results when it has them (`recorded`), or run live.
7114
+ */
7115
+ reads: "recorded" | "live";
7116
+ repetitions: number;
7117
+ k: number;
7118
+ };
5943
7119
  export type EvalRun = {
5944
7120
  runId: string;
5945
7121
  tenantId: string;
@@ -5953,11 +7129,12 @@ declare namespace Schemas {
5953
7129
  startedAt: string;
5954
7130
  completedAt?: string;
5955
7131
  /**
5956
- * Kind-specific opaque JSON. For `accuracy`, contains `{ passCount, totalCount, meanScore, perCase[] }`. Other kinds define their own shapes as their dispatchers ship.
7132
+ * Kind-specific opaque JSON. For `accuracy`, contains `{ passCount, totalCount, meanScore, perCase[] }`. For `judged` (a comparison), `{ summary, perCase[] }`: the summary has the baseline (the versions behind the recorded runs) and the candidate (`{ kind: "agent", agentId, version }` or `{ kind: "flow", flowId, version }`), the case counts (`cases`, `diverged`, `refusedWrites`, `errors`, and `stopped`: flow cases that stopped at a write the replay refused, left out of the metrics), the models that answered, and `metrics` (`weightedYesShare`, `judgedCoverage`, `weightedPrecisionAtK`, each `{ baseline, candidate, delta, n, weight, baselineN, baselineWeight, direction, k?, spread? }`); each case has its replay runs, the scores, the items kept, dropped and new, the tool calls with what happened to each, and `stopped` (what it would have done) when it stopped. Other kinds define their own shapes as their dispatchers ship.
5957
7133
  */
5958
7134
  result?: Record<string, unknown>;
5959
7135
  error?: string;
5960
7136
  correlationId?: string;
7137
+ comparison?: EvalComparison;
5961
7138
  };
5962
7139
  export type EvalRunCollectionPage = {
5963
7140
  data: Array<EvalRun>;
@@ -5965,7 +7142,7 @@ declare namespace Schemas {
5965
7142
  hasMore: boolean;
5966
7143
  };
5967
7144
  /**
5968
- * Exactly one of `agentRef` or `flowRef` MUST be supplied. `dryRun: true` returns a plan preview without invoking the subject.
7145
+ * Exactly one of `agentRef` or `flowRef` MUST be supplied. `dryRun: true` returns a plan preview without invoking the subject. For a `judged` suite (a test set), the run is a comparison: `agentRef` or `flowRef` with its `version` is the candidate, replayed on each case without doing anything the past run didn't (a flow stops at a write the replay refuses); `baseline` (default `'recorded'`), `reads` (default `recorded`), `repetitions` (default 1) and `k` (default 10) set how.
5969
7146
  */
5970
7147
  export type StartEvalRunBody = {
5971
7148
  /**
@@ -5976,6 +7153,10 @@ declare namespace Schemas {
5976
7153
  flowRef?: EvalRunFlowRef;
5977
7154
  dryRun?: boolean;
5978
7155
  correlationId?: string;
7156
+ baseline?: EvalBaseline;
7157
+ reads?: "recorded" | "live";
7158
+ repetitions?: number;
7159
+ k?: number;
5979
7160
  };
5980
7161
  export type StartEvalRunResult = {
5981
7162
  runId: string;
@@ -6082,7 +7263,7 @@ declare namespace Schemas {
6082
7263
  metadata?: Record<string, unknown>;
6083
7264
  };
6084
7265
  /**
6085
- * Introspection of the caller's current authentication context. Always carries `tenantId` and `scopes` (empty for static bearer tokens), plus `userId` when the token carries one; session-token callers additionally see `sessionId`, `providerId`, and `expiresAt`. `user` is the caller's directory record, present when the deployment wires an identity directory and it knows the `userId`. `reviewerRole` is set when the token carries a reviewer role — clients can use it to gate reviewer-only UI (the approvals surface) without a second round trip.
7266
+ * Introspection of the caller's current authentication context. Always carries `tenantId` and `scopes` (empty for static bearer tokens), plus `userId` when the token carries one; session-token callers additionally see `sessionId`, `providerId`, and `expiresAt`. `user` is the caller's directory record, present when the deployment wires an identity directory and it knows the `userId`. `reviewerRole` is set when the caller is a reviewer — its token carries a reviewer role, or its user is a registered reviewer — so clients can gate reviewer-only UI (the approvals surface) without a second round trip.
6086
7267
  */
6087
7268
  export type WhoamiResult = {
6088
7269
  tenantId: string;
@@ -6147,16 +7328,48 @@ declare namespace Schemas {
6147
7328
  agents: Array<{
6148
7329
  id: string;
6149
7330
  /**
6150
- * Absent for guardrails, which have no version.
7331
+ * The version the agent is registered as.
6151
7332
  */
6152
- version?: string;
7333
+ version: string;
7334
+ /**
7335
+ * The version the agent's or flow's definition names, present when it differs from `version`: that version was registered already with other pins or content, and versions never change, so the deploy registered the next free version in its line (or an earlier deploy did).
7336
+ */
7337
+ authoredVersion?: string;
7338
+ /**
7339
+ * Why `version` differs from `authoredVersion`: `pins-changed` (a tool or agent it uses has a new version), `unpinned` (`authoredVersion` was published before pins existed), `version-taken` (`authoredVersion` is registered with other content).
7340
+ */
7341
+ reason?: "pins-changed" | "unpinned" | "version-taken";
7342
+ /**
7343
+ * `true`: this deploy registered `version`; `false`: an earlier deploy did.
7344
+ */
7345
+ newVersion?: boolean;
7346
+ /**
7347
+ * For `pins-changed`: the pins that differ from `authoredVersion`'s.
7348
+ */
7349
+ pinChanges?: Array<PinChange>;
6153
7350
  }>;
6154
7351
  flows: Array<{
6155
7352
  id: string;
6156
7353
  /**
6157
- * Absent for guardrails, which have no version.
7354
+ * The version the agent is registered as.
6158
7355
  */
6159
- version?: string;
7356
+ version: string;
7357
+ /**
7358
+ * The version the agent's or flow's definition names, present when it differs from `version`: that version was registered already with other pins or content, and versions never change, so the deploy registered the next free version in its line (or an earlier deploy did).
7359
+ */
7360
+ authoredVersion?: string;
7361
+ /**
7362
+ * Why `version` differs from `authoredVersion`: `pins-changed` (a tool or agent it uses has a new version), `unpinned` (`authoredVersion` was published before pins existed), `version-taken` (`authoredVersion` is registered with other content).
7363
+ */
7364
+ reason?: "pins-changed" | "unpinned" | "version-taken";
7365
+ /**
7366
+ * `true`: this deploy registered `version`; `false`: an earlier deploy did.
7367
+ */
7368
+ newVersion?: boolean;
7369
+ /**
7370
+ * For `pins-changed`: the pins that differ from `authoredVersion`'s.
7371
+ */
7372
+ pinChanges?: Array<PinChange>;
6160
7373
  }>;
6161
7374
  };
6162
7375
  export type DeploymentRecord = {
@@ -6917,6 +8130,14 @@ declare namespace Schemas {
6917
8130
  */
6918
8131
  unregistered: boolean;
6919
8132
  };
8133
+ /**
8134
+ * The model calls of the run tree (this run and every run it started) that the cost ledger had recorded when this run finished: a child run still running then isn't in it. `calls` counts failed calls too. Absent when the runtime records no usage.
8135
+ */
8136
+ export type RunTreeUsage = {
8137
+ calls: number;
8138
+ costUsd: number;
8139
+ tokens: CostTokenTotals;
8140
+ };
6920
8141
  /**
6921
8142
  * A finished top-level run: its identity and outcome, never its input or output. Field names match `GET /v1/runs/{runId}`.
6922
8143
  */
@@ -6936,6 +8157,7 @@ declare namespace Schemas {
6936
8157
  failureMessage: string | null;
6937
8158
  createdAt: string;
6938
8159
  completedAt: string;
8160
+ usage?: RunTreeUsage;
6939
8161
  };
6940
8162
  export type RunFinishedEvent = {
6941
8163
  /**
@@ -6997,9 +8219,9 @@ export declare const RunProgress: z.ZodObject<{
6997
8219
  flowVersion: z.ZodString;
6998
8220
  status: z.ZodEnum<{
6999
8221
  pending: "pending";
8222
+ failed: "failed";
7000
8223
  running: "running";
7001
8224
  completed: "completed";
7002
- failed: "failed";
7003
8225
  cancelled: "cancelled";
7004
8226
  suspended: "suspended";
7005
8227
  }>;
@@ -7041,21 +8263,162 @@ declare const TrustedSigningKeyPage: z.ZodObject<{
7041
8263
  nextCursor: z.ZodOptional<z.ZodString>;
7042
8264
  hasMore: z.ZodBoolean;
7043
8265
  }, z.core.$strict>;
7044
- export type RevokeSigningKeyResult = Schemas.RevokeSigningKeyResult;
7045
- declare const RevokeSigningKeyResult: z.ZodObject<{
7046
- keyId: z.ZodString;
7047
- revoked: z.ZodBoolean;
7048
- }, z.core.$strict>;
7049
- export type MintPublicRunTokenBody = Schemas.MintPublicRunTokenBody;
7050
- declare const MintPublicRunTokenBody: z.ZodObject<{
7051
- runIds: z.ZodArray<z.ZodString>;
7052
- expiresInSeconds: z.ZodOptional<z.ZodNumber>;
8266
+ export type RevokeSigningKeyResult = Schemas.RevokeSigningKeyResult;
8267
+ declare const RevokeSigningKeyResult: z.ZodObject<{
8268
+ keyId: z.ZodString;
8269
+ revoked: z.ZodBoolean;
8270
+ }, z.core.$strict>;
8271
+ export type MintPublicRunTokenBody = Schemas.MintPublicRunTokenBody;
8272
+ declare const MintPublicRunTokenBody: z.ZodObject<{
8273
+ runIds: z.ZodArray<z.ZodString>;
8274
+ expiresInSeconds: z.ZodOptional<z.ZodNumber>;
8275
+ }, z.core.$strict>;
8276
+ export type MintPublicRunTokenResult = Schemas.MintPublicRunTokenResult;
8277
+ declare const MintPublicRunTokenResult: z.ZodObject<{
8278
+ token: z.ZodString;
8279
+ expiresAt: z.ZodISODateTime;
8280
+ runIds: z.ZodArray<z.ZodString>;
8281
+ }, z.core.$strict>;
8282
+ export type JudgedEvalCase = Schemas.JudgedEvalCase;
8283
+ declare const JudgedEvalCase: z.ZodObject<{
8284
+ caseId: z.ZodString;
8285
+ subject: z.ZodObject<{
8286
+ kind: z.ZodEnum<{
8287
+ agent: "agent";
8288
+ flow: "flow";
8289
+ }>;
8290
+ id: z.ZodString;
8291
+ version: z.ZodString;
8292
+ }, z.core.$strict>;
8293
+ input: z.ZodUnknown;
8294
+ context: z.ZodOptional<z.ZodObject<{
8295
+ history: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
8296
+ historyTruncated: z.ZodOptional<z.ZodBoolean>;
8297
+ retrieved: z.ZodOptional<z.ZodUnknown>;
8298
+ sessionApproval: z.ZodOptional<z.ZodObject<{
8299
+ approved: z.ZodBoolean;
8300
+ rationale: z.ZodOptional<z.ZodString>;
8301
+ }, z.core.$strict>>;
8302
+ flow: z.ZodOptional<z.ZodObject<{
8303
+ calls: z.ZodArray<z.ZodObject<{
8304
+ runId: z.ZodString;
8305
+ nodeId: z.ZodOptional<z.ZodString>;
8306
+ scope: z.ZodOptional<z.ZodString>;
8307
+ toolId: z.ZodString;
8308
+ arguments: z.ZodOptional<z.ZodUnknown>;
8309
+ result: z.ZodOptional<z.ZodUnknown>;
8310
+ }, z.core.$strict>>;
8311
+ steps: z.ZodArray<z.ZodObject<{
8312
+ runId: z.ZodString;
8313
+ nodeId: z.ZodOptional<z.ZodString>;
8314
+ scope: z.ZodOptional<z.ZodString>;
8315
+ agentId: z.ZodString;
8316
+ agentVersion: z.ZodString;
8317
+ retrieved: z.ZodOptional<z.ZodUnknown>;
8318
+ }, z.core.$strict>>;
8319
+ truncated: z.ZodOptional<z.ZodBoolean>;
8320
+ }, z.core.$strict>>;
8321
+ }, z.core.$strict>>;
8322
+ output: z.ZodUnknown;
8323
+ items: z.ZodArray<z.ZodObject<{
8324
+ key: z.ZodString;
8325
+ pointer: z.ZodOptional<z.ZodString>;
8326
+ rank: z.ZodOptional<z.ZodNumber>;
8327
+ yes: z.ZodNumber;
8328
+ no: z.ZodNumber;
8329
+ yesWeight: z.ZodNumber;
8330
+ totalWeight: z.ZodNumber;
8331
+ reasons: z.ZodArray<z.ZodObject<{
8332
+ verdict: z.ZodEnum<{
8333
+ yes: "yes";
8334
+ no: "no";
8335
+ }>;
8336
+ reason: z.ZodString;
8337
+ }, z.core.$strict>>;
8338
+ }, z.core.$strict>>;
8339
+ }, z.core.$strict>;
8340
+ export type JudgedEvalCaseCollectionPage = Schemas.JudgedEvalCaseCollectionPage;
8341
+ declare const JudgedEvalCaseCollectionPage: z.ZodObject<{
8342
+ data: z.ZodArray<z.ZodObject<{
8343
+ caseId: z.ZodString;
8344
+ subject: z.ZodObject<{
8345
+ kind: z.ZodEnum<{
8346
+ agent: "agent";
8347
+ flow: "flow";
8348
+ }>;
8349
+ id: z.ZodString;
8350
+ version: z.ZodString;
8351
+ }, z.core.$strict>;
8352
+ input: z.ZodUnknown;
8353
+ context: z.ZodOptional<z.ZodObject<{
8354
+ history: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
8355
+ historyTruncated: z.ZodOptional<z.ZodBoolean>;
8356
+ retrieved: z.ZodOptional<z.ZodUnknown>;
8357
+ sessionApproval: z.ZodOptional<z.ZodObject<{
8358
+ approved: z.ZodBoolean;
8359
+ rationale: z.ZodOptional<z.ZodString>;
8360
+ }, z.core.$strict>>;
8361
+ flow: z.ZodOptional<z.ZodObject<{
8362
+ calls: z.ZodArray<z.ZodObject<{
8363
+ runId: z.ZodString;
8364
+ nodeId: z.ZodOptional<z.ZodString>;
8365
+ scope: z.ZodOptional<z.ZodString>;
8366
+ toolId: z.ZodString;
8367
+ arguments: z.ZodOptional<z.ZodUnknown>;
8368
+ result: z.ZodOptional<z.ZodUnknown>;
8369
+ }, z.core.$strict>>;
8370
+ steps: z.ZodArray<z.ZodObject<{
8371
+ runId: z.ZodString;
8372
+ nodeId: z.ZodOptional<z.ZodString>;
8373
+ scope: z.ZodOptional<z.ZodString>;
8374
+ agentId: z.ZodString;
8375
+ agentVersion: z.ZodString;
8376
+ retrieved: z.ZodOptional<z.ZodUnknown>;
8377
+ }, z.core.$strict>>;
8378
+ truncated: z.ZodOptional<z.ZodBoolean>;
8379
+ }, z.core.$strict>>;
8380
+ }, z.core.$strict>>;
8381
+ output: z.ZodUnknown;
8382
+ items: z.ZodArray<z.ZodObject<{
8383
+ key: z.ZodString;
8384
+ pointer: z.ZodOptional<z.ZodString>;
8385
+ rank: z.ZodOptional<z.ZodNumber>;
8386
+ yes: z.ZodNumber;
8387
+ no: z.ZodNumber;
8388
+ yesWeight: z.ZodNumber;
8389
+ totalWeight: z.ZodNumber;
8390
+ reasons: z.ZodArray<z.ZodObject<{
8391
+ verdict: z.ZodEnum<{
8392
+ yes: "yes";
8393
+ no: "no";
8394
+ }>;
8395
+ reason: z.ZodString;
8396
+ }, z.core.$strict>>;
8397
+ }, z.core.$strict>>;
8398
+ }, z.core.$strict>>;
8399
+ nextCursor: z.ZodOptional<z.ZodString>;
8400
+ hasMore: z.ZodBoolean;
8401
+ }, z.core.$strict>;
8402
+ export type BuildJudgedSuiteBody = Schemas.BuildJudgedSuiteBody;
8403
+ declare const BuildJudgedSuiteBody: z.ZodObject<{
8404
+ version: z.ZodString;
8405
+ projectId: z.ZodString;
8406
+ agentId: z.ZodOptional<z.ZodString>;
8407
+ agentVersion: z.ZodOptional<z.ZodString>;
8408
+ flowId: z.ZodOptional<z.ZodString>;
8409
+ since: z.ZodOptional<z.ZodISODateTime>;
8410
+ until: z.ZodOptional<z.ZodISODateTime>;
8411
+ judgeClassIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
8412
+ minJudgments: z.ZodOptional<z.ZodNumber>;
8413
+ description: z.ZodOptional<z.ZodString>;
7053
8414
  }, z.core.$strict>;
7054
- export type MintPublicRunTokenResult = Schemas.MintPublicRunTokenResult;
7055
- declare const MintPublicRunTokenResult: z.ZodObject<{
7056
- token: z.ZodString;
7057
- expiresAt: z.ZodISODateTime;
7058
- runIds: z.ZodArray<z.ZodString>;
8415
+ export type BuildJudgedSuiteResult = Schemas.BuildJudgedSuiteResult;
8416
+ declare const BuildJudgedSuiteResult: z.ZodObject<{
8417
+ suiteId: z.ZodString;
8418
+ version: z.ZodString;
8419
+ kind: z.ZodLiteral<"judged">;
8420
+ caseCount: z.ZodNumber;
8421
+ truncated: z.ZodBoolean;
7059
8422
  }, z.core.$strict>;
7060
8423
  type Agent$1 = Schemas.Agent;
7061
8424
  declare const Agent$1: z.ZodObject<{
@@ -7063,7 +8426,13 @@ declare const Agent$1: z.ZodObject<{
7063
8426
  version: z.ZodString;
7064
8427
  name: z.ZodString;
7065
8428
  description: z.ZodOptional<z.ZodString>;
7066
- instructions: z.ZodString;
8429
+ instructions: z.ZodUnion<readonly [
8430
+ z.ZodString,
8431
+ z.ZodObject<{
8432
+ prompt: z.ZodString;
8433
+ version: z.ZodString;
8434
+ }, z.core.$strict>
8435
+ ]>;
7067
8436
  parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
7068
8437
  name: z.ZodString;
7069
8438
  description: z.ZodOptional<z.ZodString>;
@@ -7076,6 +8445,14 @@ declare const Agent$1: z.ZodObject<{
7076
8445
  required: z.ZodOptional<z.ZodBoolean>;
7077
8446
  default: z.ZodOptional<z.ZodUnknown>;
7078
8447
  }, z.core.$strict>>>;
8448
+ settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
8449
+ id: z.ZodString;
8450
+ version: z.ZodString;
8451
+ }, z.core.$strict>>>;
8452
+ modelSettings: z.ZodOptional<z.ZodObject<{
8453
+ id: z.ZodString;
8454
+ version: z.ZodString;
8455
+ }, z.core.$strict>>;
7079
8456
  capabilities: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7080
8457
  tools: z.ZodArray<z.ZodObject<{
7081
8458
  id: z.ZodString;
@@ -7122,6 +8499,34 @@ declare const Agent$1: z.ZodObject<{
7122
8499
  "unknown-tool": "unknown-tool";
7123
8500
  }>>>;
7124
8501
  }, z.core.$strict>>;
8502
+ pins: z.ZodOptional<z.ZodObject<{
8503
+ tools: z.ZodRecord<z.ZodString, z.ZodString>;
8504
+ prompts: z.ZodRecord<z.ZodString, z.ZodString>;
8505
+ settings: z.ZodRecord<z.ZodString, z.ZodString>;
8506
+ }, z.core.$strict>>;
8507
+ derivedFrom: z.ZodOptional<z.ZodObject<{
8508
+ version: z.ZodString;
8509
+ reason: z.ZodEnum<{
8510
+ "pins-changed": "pins-changed";
8511
+ unpinned: "unpinned";
8512
+ "version-taken": "version-taken";
8513
+ edited: "edited";
8514
+ }>;
8515
+ label: z.ZodOptional<z.ZodString>;
8516
+ by: z.ZodOptional<z.ZodString>;
8517
+ }, z.core.$strict>>;
8518
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
8519
+ pinsDigest: z.ZodOptional<z.ZodString>;
8520
+ }, z.core.$strict>;
8521
+ export type DeriveAgentVersionBody = Schemas.DeriveAgentVersionBody;
8522
+ declare const DeriveAgentVersionBody: z.ZodObject<{
8523
+ from: z.ZodString;
8524
+ pins: z.ZodObject<{
8525
+ prompts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
8526
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
8527
+ }, z.core.$strict>;
8528
+ label: z.ZodOptional<z.ZodString>;
8529
+ projectId: z.ZodOptional<z.ZodUUID>;
7125
8530
  }, z.core.$strict>;
7126
8531
  export type UnregisterAgentResult = Schemas.UnregisterAgentResult;
7127
8532
  declare const UnregisterAgentResult: z.ZodObject<{
@@ -7136,7 +8541,13 @@ declare const AgentCollectionPage: z.ZodObject<{
7136
8541
  version: z.ZodString;
7137
8542
  name: z.ZodString;
7138
8543
  description: z.ZodOptional<z.ZodString>;
7139
- instructions: z.ZodString;
8544
+ instructions: z.ZodUnion<readonly [
8545
+ z.ZodString,
8546
+ z.ZodObject<{
8547
+ prompt: z.ZodString;
8548
+ version: z.ZodString;
8549
+ }, z.core.$strict>
8550
+ ]>;
7140
8551
  parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
7141
8552
  name: z.ZodString;
7142
8553
  description: z.ZodOptional<z.ZodString>;
@@ -7149,6 +8560,14 @@ declare const AgentCollectionPage: z.ZodObject<{
7149
8560
  required: z.ZodOptional<z.ZodBoolean>;
7150
8561
  default: z.ZodOptional<z.ZodUnknown>;
7151
8562
  }, z.core.$strict>>>;
8563
+ settings: z.ZodOptional<z.ZodArray<z.ZodObject<{
8564
+ id: z.ZodString;
8565
+ version: z.ZodString;
8566
+ }, z.core.$strict>>>;
8567
+ modelSettings: z.ZodOptional<z.ZodObject<{
8568
+ id: z.ZodString;
8569
+ version: z.ZodString;
8570
+ }, z.core.$strict>>;
7152
8571
  capabilities: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7153
8572
  tools: z.ZodArray<z.ZodObject<{
7154
8573
  id: z.ZodString;
@@ -7195,6 +8614,24 @@ declare const AgentCollectionPage: z.ZodObject<{
7195
8614
  "unknown-tool": "unknown-tool";
7196
8615
  }>>>;
7197
8616
  }, z.core.$strict>>;
8617
+ pins: z.ZodOptional<z.ZodObject<{
8618
+ tools: z.ZodRecord<z.ZodString, z.ZodString>;
8619
+ prompts: z.ZodRecord<z.ZodString, z.ZodString>;
8620
+ settings: z.ZodRecord<z.ZodString, z.ZodString>;
8621
+ }, z.core.$strict>>;
8622
+ derivedFrom: z.ZodOptional<z.ZodObject<{
8623
+ version: z.ZodString;
8624
+ reason: z.ZodEnum<{
8625
+ "pins-changed": "pins-changed";
8626
+ unpinned: "unpinned";
8627
+ "version-taken": "version-taken";
8628
+ edited: "edited";
8629
+ }>;
8630
+ label: z.ZodOptional<z.ZodString>;
8631
+ by: z.ZodOptional<z.ZodString>;
8632
+ }, z.core.$strict>>;
8633
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
8634
+ pinsDigest: z.ZodOptional<z.ZodString>;
7198
8635
  }, z.core.$strict>>;
7199
8636
  nextCursor: z.ZodOptional<z.ZodString>;
7200
8637
  hasMore: z.ZodBoolean;
@@ -7233,6 +8670,7 @@ declare const ProviderMetadata: z.ZodObject<{
7233
8670
  description: z.ZodOptional<z.ZodString>;
7234
8671
  capabilityKind: z.ZodOptional<z.ZodString>;
7235
8672
  fallback: z.ZodOptional<z.ZodBoolean>;
8673
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7236
8674
  }, z.core.$strict>;
7237
8675
  export type ProviderCollectionPage = Schemas.ProviderCollectionPage;
7238
8676
  declare const ProviderCollectionPage: z.ZodObject<{
@@ -7269,6 +8707,7 @@ declare const ProviderCollectionPage: z.ZodObject<{
7269
8707
  description: z.ZodOptional<z.ZodString>;
7270
8708
  capabilityKind: z.ZodOptional<z.ZodString>;
7271
8709
  fallback: z.ZodOptional<z.ZodBoolean>;
8710
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7272
8711
  }, z.core.$strict>>;
7273
8712
  nextCursor: z.ZodOptional<z.ZodString>;
7274
8713
  hasMore: z.ZodBoolean;
@@ -7308,6 +8747,7 @@ declare const RegisterProviderBody: z.ZodObject<{
7308
8747
  description: z.ZodOptional<z.ZodString>;
7309
8748
  capabilityKind: z.ZodOptional<z.ZodString>;
7310
8749
  fallback: z.ZodOptional<z.ZodBoolean>;
8750
+ labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
7311
8751
  }, z.core.$strict>;
7312
8752
  adapter_id: z.ZodString;
7313
8753
  secret_ref: z.ZodOptional<z.ZodObject<{
@@ -7370,6 +8810,7 @@ declare const EvalKind: z.ZodEnum<{
7370
8810
  "human-review": "human-review";
7371
8811
  benchmark: "benchmark";
7372
8812
  custom: "custom";
8813
+ judged: "judged";
7373
8814
  }>;
7374
8815
  export type EvalSuite = Schemas.EvalSuite;
7375
8816
  declare const EvalSuite: z.ZodObject<{
@@ -7383,6 +8824,7 @@ declare const EvalSuite: z.ZodObject<{
7383
8824
  "human-review": "human-review";
7384
8825
  benchmark: "benchmark";
7385
8826
  custom: "custom";
8827
+ judged: "judged";
7386
8828
  }>;
7387
8829
  description: z.ZodOptional<z.ZodString>;
7388
8830
  spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -7400,6 +8842,7 @@ declare const EvalSuiteCollectionPage: z.ZodObject<{
7400
8842
  "human-review": "human-review";
7401
8843
  benchmark: "benchmark";
7402
8844
  custom: "custom";
8845
+ judged: "judged";
7403
8846
  }>;
7404
8847
  description: z.ZodOptional<z.ZodString>;
7405
8848
  spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -7420,6 +8863,7 @@ declare const PublishEvalSuiteBody: z.ZodObject<{
7420
8863
  "human-review": "human-review";
7421
8864
  benchmark: "benchmark";
7422
8865
  custom: "custom";
8866
+ judged: "judged";
7423
8867
  }>;
7424
8868
  description: z.ZodOptional<z.ZodString>;
7425
8869
  spec: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -7441,12 +8885,138 @@ declare const ReinstateEvalSuiteVersionResult: z.ZodObject<{
7441
8885
  version: z.ZodString;
7442
8886
  wasTombstoned: z.ZodBoolean;
7443
8887
  }, z.core.$strict>;
8888
+ export type BlockKind = Schemas.BlockKind;
8889
+ export declare const BlockKind: z.ZodEnum<{
8890
+ prompt: "prompt";
8891
+ settings: "settings";
8892
+ }>;
8893
+ export type Block = Schemas.Block;
8894
+ export declare const Block: z.ZodObject<{
8895
+ id: z.ZodString;
8896
+ version: z.ZodString;
8897
+ kind: z.ZodEnum<{
8898
+ prompt: "prompt";
8899
+ settings: "settings";
8900
+ }>;
8901
+ description: z.ZodOptional<z.ZodString>;
8902
+ content: z.ZodUnion<readonly [
8903
+ z.ZodObject<{
8904
+ template: z.ZodString;
8905
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
8906
+ name: z.ZodString;
8907
+ description: z.ZodOptional<z.ZodString>;
8908
+ type: z.ZodEnum<{
8909
+ string: "string";
8910
+ number: "number";
8911
+ boolean: "boolean";
8912
+ date: "date";
8913
+ }>;
8914
+ required: z.ZodOptional<z.ZodBoolean>;
8915
+ default: z.ZodOptional<z.ZodUnknown>;
8916
+ }, z.core.$strict>>>;
8917
+ }, z.core.$strict>,
8918
+ z.ZodObject<{
8919
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8920
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8921
+ }, z.core.$strict>
8922
+ ]>;
8923
+ projectId: z.ZodUUID;
8924
+ publishedAt: z.ZodISODateTime;
8925
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
8926
+ }, z.core.$strict>;
8927
+ export type BlockCollectionPage = Schemas.BlockCollectionPage;
8928
+ declare const BlockCollectionPage: z.ZodObject<{
8929
+ data: z.ZodArray<z.ZodObject<{
8930
+ id: z.ZodString;
8931
+ version: z.ZodString;
8932
+ kind: z.ZodEnum<{
8933
+ prompt: "prompt";
8934
+ settings: "settings";
8935
+ }>;
8936
+ description: z.ZodOptional<z.ZodString>;
8937
+ content: z.ZodUnion<readonly [
8938
+ z.ZodObject<{
8939
+ template: z.ZodString;
8940
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
8941
+ name: z.ZodString;
8942
+ description: z.ZodOptional<z.ZodString>;
8943
+ type: z.ZodEnum<{
8944
+ string: "string";
8945
+ number: "number";
8946
+ boolean: "boolean";
8947
+ date: "date";
8948
+ }>;
8949
+ required: z.ZodOptional<z.ZodBoolean>;
8950
+ default: z.ZodOptional<z.ZodUnknown>;
8951
+ }, z.core.$strict>>>;
8952
+ }, z.core.$strict>,
8953
+ z.ZodObject<{
8954
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8955
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8956
+ }, z.core.$strict>
8957
+ ]>;
8958
+ projectId: z.ZodUUID;
8959
+ publishedAt: z.ZodISODateTime;
8960
+ unregisteredAt: z.ZodOptional<z.ZodISODateTime>;
8961
+ }, z.core.$strict>>;
8962
+ nextCursor: z.ZodOptional<z.ZodString>;
8963
+ hasMore: z.ZodBoolean;
8964
+ }, z.core.$strict>;
8965
+ export type PublishBlockBody = Schemas.PublishBlockBody;
8966
+ declare const PublishBlockBody: z.ZodObject<{
8967
+ projectId: z.ZodUUID;
8968
+ id: z.ZodString;
8969
+ version: z.ZodString;
8970
+ kind: z.ZodEnum<{
8971
+ prompt: "prompt";
8972
+ settings: "settings";
8973
+ }>;
8974
+ description: z.ZodOptional<z.ZodString>;
8975
+ content: z.ZodUnion<readonly [
8976
+ z.ZodObject<{
8977
+ template: z.ZodString;
8978
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
8979
+ name: z.ZodString;
8980
+ description: z.ZodOptional<z.ZodString>;
8981
+ type: z.ZodEnum<{
8982
+ string: "string";
8983
+ number: "number";
8984
+ boolean: "boolean";
8985
+ date: "date";
8986
+ }>;
8987
+ required: z.ZodOptional<z.ZodBoolean>;
8988
+ default: z.ZodOptional<z.ZodUnknown>;
8989
+ }, z.core.$strict>>>;
8990
+ }, z.core.$strict>,
8991
+ z.ZodObject<{
8992
+ values: z.ZodRecord<z.ZodString, z.ZodUnknown>;
8993
+ schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8994
+ }, z.core.$strict>
8995
+ ]>;
8996
+ }, z.core.$strict>;
8997
+ export type PublishBlockResult = Schemas.PublishBlockResult;
8998
+ export declare const PublishBlockResult: z.ZodObject<{
8999
+ blockId: z.ZodString;
9000
+ version: z.ZodString;
9001
+ }, z.core.$strict>;
9002
+ export type UnregisterBlockResult = Schemas.UnregisterBlockResult;
9003
+ export declare const UnregisterBlockResult: z.ZodObject<{
9004
+ blockId: z.ZodString;
9005
+ version: z.ZodString;
9006
+ unregistered: z.ZodLiteral<true>;
9007
+ }, z.core.$strict>;
9008
+ export type ReinstateBlockResult = Schemas.ReinstateBlockResult;
9009
+ export declare const ReinstateBlockResult: z.ZodObject<{
9010
+ blockId: z.ZodString;
9011
+ version: z.ZodString;
9012
+ wasTombstoned: z.ZodBoolean;
9013
+ }, z.core.$strict>;
7444
9014
  export type EvalRunStatus = Schemas.EvalRunStatus;
7445
9015
  declare const EvalRunStatus: z.ZodEnum<{
7446
9016
  pending: "pending";
9017
+ failed: "failed";
7447
9018
  running: "running";
7448
9019
  completed: "completed";
7449
- failed: "failed";
7450
9020
  cancelled: "cancelled";
7451
9021
  }>;
7452
9022
  export type EvalRun = Schemas.EvalRun;
@@ -7462,6 +9032,7 @@ declare const EvalRun: z.ZodObject<{
7462
9032
  "human-review": "human-review";
7463
9033
  benchmark: "benchmark";
7464
9034
  custom: "custom";
9035
+ judged: "judged";
7465
9036
  }>;
7466
9037
  agentRef: z.ZodOptional<z.ZodObject<{
7467
9038
  agentId: z.ZodString;
@@ -7473,9 +9044,9 @@ declare const EvalRun: z.ZodObject<{
7473
9044
  }, z.core.$strict>>;
7474
9045
  status: z.ZodEnum<{
7475
9046
  pending: "pending";
9047
+ failed: "failed";
7476
9048
  running: "running";
7477
9049
  completed: "completed";
7478
- failed: "failed";
7479
9050
  cancelled: "cancelled";
7480
9051
  }>;
7481
9052
  dryRun: z.ZodBoolean;
@@ -7484,6 +9055,27 @@ declare const EvalRun: z.ZodObject<{
7484
9055
  result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7485
9056
  error: z.ZodOptional<z.ZodString>;
7486
9057
  correlationId: z.ZodOptional<z.ZodString>;
9058
+ comparison: z.ZodOptional<z.ZodObject<{
9059
+ baseline: z.ZodUnion<readonly [
9060
+ z.ZodLiteral<"recorded">,
9061
+ z.ZodObject<{
9062
+ agentId: z.ZodString;
9063
+ version: z.ZodString;
9064
+ }, z.core.$strict>,
9065
+ z.ZodObject<{
9066
+ live: z.ZodObject<{
9067
+ projectId: z.ZodOptional<z.ZodString>;
9068
+ segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9069
+ }, z.core.$strict>;
9070
+ }, z.core.$strict>
9071
+ ]>;
9072
+ reads: z.ZodEnum<{
9073
+ recorded: "recorded";
9074
+ live: "live";
9075
+ }>;
9076
+ repetitions: z.ZodNumber;
9077
+ k: z.ZodNumber;
9078
+ }, z.core.$strict>>;
7487
9079
  }, z.core.$strict>;
7488
9080
  export type EvalRunCollectionPage = Schemas.EvalRunCollectionPage;
7489
9081
  declare const EvalRunCollectionPage: z.ZodObject<{
@@ -7499,6 +9091,7 @@ declare const EvalRunCollectionPage: z.ZodObject<{
7499
9091
  "human-review": "human-review";
7500
9092
  benchmark: "benchmark";
7501
9093
  custom: "custom";
9094
+ judged: "judged";
7502
9095
  }>;
7503
9096
  agentRef: z.ZodOptional<z.ZodObject<{
7504
9097
  agentId: z.ZodString;
@@ -7510,9 +9103,9 @@ declare const EvalRunCollectionPage: z.ZodObject<{
7510
9103
  }, z.core.$strict>>;
7511
9104
  status: z.ZodEnum<{
7512
9105
  pending: "pending";
9106
+ failed: "failed";
7513
9107
  running: "running";
7514
9108
  completed: "completed";
7515
- failed: "failed";
7516
9109
  cancelled: "cancelled";
7517
9110
  }>;
7518
9111
  dryRun: z.ZodBoolean;
@@ -7521,6 +9114,27 @@ declare const EvalRunCollectionPage: z.ZodObject<{
7521
9114
  result: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
7522
9115
  error: z.ZodOptional<z.ZodString>;
7523
9116
  correlationId: z.ZodOptional<z.ZodString>;
9117
+ comparison: z.ZodOptional<z.ZodObject<{
9118
+ baseline: z.ZodUnion<readonly [
9119
+ z.ZodLiteral<"recorded">,
9120
+ z.ZodObject<{
9121
+ agentId: z.ZodString;
9122
+ version: z.ZodString;
9123
+ }, z.core.$strict>,
9124
+ z.ZodObject<{
9125
+ live: z.ZodObject<{
9126
+ projectId: z.ZodOptional<z.ZodString>;
9127
+ segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9128
+ }, z.core.$strict>;
9129
+ }, z.core.$strict>
9130
+ ]>;
9131
+ reads: z.ZodEnum<{
9132
+ recorded: "recorded";
9133
+ live: "live";
9134
+ }>;
9135
+ repetitions: z.ZodNumber;
9136
+ k: z.ZodNumber;
9137
+ }, z.core.$strict>>;
7524
9138
  }, z.core.$strict>>;
7525
9139
  nextCursor: z.ZodOptional<z.ZodString>;
7526
9140
  hasMore: z.ZodBoolean;
@@ -7538,6 +9152,25 @@ declare const StartEvalRunBody: z.ZodObject<{
7538
9152
  }, z.core.$strict>>;
7539
9153
  dryRun: z.ZodOptional<z.ZodBoolean>;
7540
9154
  correlationId: z.ZodOptional<z.ZodString>;
9155
+ baseline: z.ZodOptional<z.ZodUnion<readonly [
9156
+ z.ZodLiteral<"recorded">,
9157
+ z.ZodObject<{
9158
+ agentId: z.ZodString;
9159
+ version: z.ZodString;
9160
+ }, z.core.$strict>,
9161
+ z.ZodObject<{
9162
+ live: z.ZodObject<{
9163
+ projectId: z.ZodOptional<z.ZodString>;
9164
+ segments: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
9165
+ }, z.core.$strict>;
9166
+ }, z.core.$strict>
9167
+ ]>>;
9168
+ reads: z.ZodOptional<z.ZodEnum<{
9169
+ recorded: "recorded";
9170
+ live: "live";
9171
+ }>>;
9172
+ repetitions: z.ZodOptional<z.ZodNumber>;
9173
+ k: z.ZodOptional<z.ZodNumber>;
7541
9174
  }, z.core.$strict>;
7542
9175
  export type StartEvalRunResult = Schemas.StartEvalRunResult;
7543
9176
  declare const StartEvalRunResult: z.ZodObject<{
@@ -7736,11 +9369,47 @@ declare const DeploymentRecord: z.ZodObject<{
7736
9369
  }, z.core.$strict>>;
7737
9370
  agents: z.ZodArray<z.ZodObject<{
7738
9371
  id: z.ZodString;
7739
- version: z.ZodOptional<z.ZodString>;
9372
+ version: z.ZodString;
9373
+ authoredVersion: z.ZodOptional<z.ZodString>;
9374
+ reason: z.ZodOptional<z.ZodEnum<{
9375
+ "pins-changed": "pins-changed";
9376
+ unpinned: "unpinned";
9377
+ "version-taken": "version-taken";
9378
+ }>>;
9379
+ newVersion: z.ZodOptional<z.ZodBoolean>;
9380
+ pinChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
9381
+ kind: z.ZodEnum<{
9382
+ tool: "tool";
9383
+ prompt: "prompt";
9384
+ agent: "agent";
9385
+ setting: "setting";
9386
+ }>;
9387
+ id: z.ZodString;
9388
+ from: z.ZodOptional<z.ZodString>;
9389
+ to: z.ZodOptional<z.ZodString>;
9390
+ }, z.core.$strict>>>;
7740
9391
  }, z.core.$strict>>;
7741
9392
  flows: z.ZodArray<z.ZodObject<{
7742
9393
  id: z.ZodString;
7743
- version: z.ZodOptional<z.ZodString>;
9394
+ version: z.ZodString;
9395
+ authoredVersion: z.ZodOptional<z.ZodString>;
9396
+ reason: z.ZodOptional<z.ZodEnum<{
9397
+ "pins-changed": "pins-changed";
9398
+ unpinned: "unpinned";
9399
+ "version-taken": "version-taken";
9400
+ }>>;
9401
+ newVersion: z.ZodOptional<z.ZodBoolean>;
9402
+ pinChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
9403
+ kind: z.ZodEnum<{
9404
+ tool: "tool";
9405
+ prompt: "prompt";
9406
+ agent: "agent";
9407
+ setting: "setting";
9408
+ }>;
9409
+ id: z.ZodString;
9410
+ from: z.ZodOptional<z.ZodString>;
9411
+ to: z.ZodOptional<z.ZodString>;
9412
+ }, z.core.$strict>>>;
7744
9413
  }, z.core.$strict>>;
7745
9414
  }, z.core.$strict>;
7746
9415
  }, z.core.$strict>;
@@ -7785,11 +9454,47 @@ declare const DeploymentCollectionPage: z.ZodObject<{
7785
9454
  }, z.core.$strict>>;
7786
9455
  agents: z.ZodArray<z.ZodObject<{
7787
9456
  id: z.ZodString;
7788
- version: z.ZodOptional<z.ZodString>;
9457
+ version: z.ZodString;
9458
+ authoredVersion: z.ZodOptional<z.ZodString>;
9459
+ reason: z.ZodOptional<z.ZodEnum<{
9460
+ "pins-changed": "pins-changed";
9461
+ unpinned: "unpinned";
9462
+ "version-taken": "version-taken";
9463
+ }>>;
9464
+ newVersion: z.ZodOptional<z.ZodBoolean>;
9465
+ pinChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
9466
+ kind: z.ZodEnum<{
9467
+ tool: "tool";
9468
+ prompt: "prompt";
9469
+ agent: "agent";
9470
+ setting: "setting";
9471
+ }>;
9472
+ id: z.ZodString;
9473
+ from: z.ZodOptional<z.ZodString>;
9474
+ to: z.ZodOptional<z.ZodString>;
9475
+ }, z.core.$strict>>>;
7789
9476
  }, z.core.$strict>>;
7790
9477
  flows: z.ZodArray<z.ZodObject<{
7791
9478
  id: z.ZodString;
7792
- version: z.ZodOptional<z.ZodString>;
9479
+ version: z.ZodString;
9480
+ authoredVersion: z.ZodOptional<z.ZodString>;
9481
+ reason: z.ZodOptional<z.ZodEnum<{
9482
+ "pins-changed": "pins-changed";
9483
+ unpinned: "unpinned";
9484
+ "version-taken": "version-taken";
9485
+ }>>;
9486
+ newVersion: z.ZodOptional<z.ZodBoolean>;
9487
+ pinChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
9488
+ kind: z.ZodEnum<{
9489
+ tool: "tool";
9490
+ prompt: "prompt";
9491
+ agent: "agent";
9492
+ setting: "setting";
9493
+ }>;
9494
+ id: z.ZodString;
9495
+ from: z.ZodOptional<z.ZodString>;
9496
+ to: z.ZodOptional<z.ZodString>;
9497
+ }, z.core.$strict>>>;
7793
9498
  }, z.core.$strict>>;
7794
9499
  }, z.core.$strict>;
7795
9500
  }, z.core.$strict>>;
@@ -7848,9 +9553,9 @@ declare const ComplianceEvidence: z.ZodObject<{
7848
9553
  outcome: z.ZodOptional<z.ZodEnum<{
7849
9554
  succeeded: "succeeded";
7850
9555
  escalated: "escalated";
9556
+ failed: "failed";
7851
9557
  allowed: "allowed";
7852
9558
  denied: "denied";
7853
- failed: "failed";
7854
9559
  }>>;
7855
9560
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
7856
9561
  provenanceRef: z.ZodOptional<z.ZodObject<{
@@ -7892,9 +9597,9 @@ declare const ComplianceEvidenceCollectionPage: z.ZodObject<{
7892
9597
  outcome: z.ZodOptional<z.ZodEnum<{
7893
9598
  succeeded: "succeeded";
7894
9599
  escalated: "escalated";
9600
+ failed: "failed";
7895
9601
  allowed: "allowed";
7896
9602
  denied: "denied";
7897
- failed: "failed";
7898
9603
  }>>;
7899
9604
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
7900
9605
  provenanceRef: z.ZodOptional<z.ZodObject<{
@@ -8486,14 +10191,25 @@ declare const RunFinishedEvent: z.ZodObject<{
8486
10191
  flowId: z.ZodString;
8487
10192
  flowVersion: z.ZodString;
8488
10193
  status: z.ZodEnum<{
8489
- completed: "completed";
8490
10194
  failed: "failed";
10195
+ completed: "completed";
8491
10196
  cancelled: "cancelled";
8492
10197
  }>;
8493
10198
  dryRun: z.ZodBoolean;
8494
10199
  failureMessage: z.ZodNullable<z.ZodString>;
8495
10200
  createdAt: z.ZodISODateTime;
8496
10201
  completedAt: z.ZodISODateTime;
10202
+ usage: z.ZodOptional<z.ZodObject<{
10203
+ calls: z.ZodNumber;
10204
+ costUsd: z.ZodNumber;
10205
+ tokens: z.ZodObject<{
10206
+ prompt: z.ZodNumber;
10207
+ completion: z.ZodNumber;
10208
+ cacheRead: z.ZodNumber;
10209
+ cacheWrite: z.ZodNumber;
10210
+ reasoning: z.ZodNumber;
10211
+ }, z.core.$strict>;
10212
+ }, z.core.$strict>>;
8497
10213
  }, z.core.$strict>;
8498
10214
  }, z.core.$strict>;
8499
10215
  }, z.core.$strict>;
@@ -8518,14 +10234,25 @@ declare const WebhookEvent: z.ZodDiscriminatedUnion<[
8518
10234
  flowId: z.ZodString;
8519
10235
  flowVersion: z.ZodString;
8520
10236
  status: z.ZodEnum<{
8521
- completed: "completed";
8522
10237
  failed: "failed";
10238
+ completed: "completed";
8523
10239
  cancelled: "cancelled";
8524
10240
  }>;
8525
10241
  dryRun: z.ZodBoolean;
8526
10242
  failureMessage: z.ZodNullable<z.ZodString>;
8527
10243
  createdAt: z.ZodISODateTime;
8528
10244
  completedAt: z.ZodISODateTime;
10245
+ usage: z.ZodOptional<z.ZodObject<{
10246
+ calls: z.ZodNumber;
10247
+ costUsd: z.ZodNumber;
10248
+ tokens: z.ZodObject<{
10249
+ prompt: z.ZodNumber;
10250
+ completion: z.ZodNumber;
10251
+ cacheRead: z.ZodNumber;
10252
+ cacheWrite: z.ZodNumber;
10253
+ reasoning: z.ZodNumber;
10254
+ }, z.core.$strict>;
10255
+ }, z.core.$strict>>;
8529
10256
  }, z.core.$strict>;
8530
10257
  }, z.core.$strict>;
8531
10258
  type: z.ZodLiteral<"run.finished">;
@@ -8560,14 +10287,25 @@ declare const WebhookDelivery: z.ZodObject<{
8560
10287
  flowId: z.ZodString;
8561
10288
  flowVersion: z.ZodString;
8562
10289
  status: z.ZodEnum<{
8563
- completed: "completed";
8564
10290
  failed: "failed";
10291
+ completed: "completed";
8565
10292
  cancelled: "cancelled";
8566
10293
  }>;
8567
10294
  dryRun: z.ZodBoolean;
8568
10295
  failureMessage: z.ZodNullable<z.ZodString>;
8569
10296
  createdAt: z.ZodISODateTime;
8570
10297
  completedAt: z.ZodISODateTime;
10298
+ usage: z.ZodOptional<z.ZodObject<{
10299
+ calls: z.ZodNumber;
10300
+ costUsd: z.ZodNumber;
10301
+ tokens: z.ZodObject<{
10302
+ prompt: z.ZodNumber;
10303
+ completion: z.ZodNumber;
10304
+ cacheRead: z.ZodNumber;
10305
+ cacheWrite: z.ZodNumber;
10306
+ reasoning: z.ZodNumber;
10307
+ }, z.core.$strict>;
10308
+ }, z.core.$strict>>;
8571
10309
  }, z.core.$strict>;
8572
10310
  }, z.core.$strict>;
8573
10311
  type: z.ZodLiteral<"run.finished">;
@@ -8610,14 +10348,25 @@ declare const WebhookDeliveryCollectionPage: z.ZodObject<{
8610
10348
  flowId: z.ZodString;
8611
10349
  flowVersion: z.ZodString;
8612
10350
  status: z.ZodEnum<{
8613
- completed: "completed";
8614
10351
  failed: "failed";
10352
+ completed: "completed";
8615
10353
  cancelled: "cancelled";
8616
10354
  }>;
8617
10355
  dryRun: z.ZodBoolean;
8618
10356
  failureMessage: z.ZodNullable<z.ZodString>;
8619
10357
  createdAt: z.ZodISODateTime;
8620
10358
  completedAt: z.ZodISODateTime;
10359
+ usage: z.ZodOptional<z.ZodObject<{
10360
+ calls: z.ZodNumber;
10361
+ costUsd: z.ZodNumber;
10362
+ tokens: z.ZodObject<{
10363
+ prompt: z.ZodNumber;
10364
+ completion: z.ZodNumber;
10365
+ cacheRead: z.ZodNumber;
10366
+ cacheWrite: z.ZodNumber;
10367
+ reasoning: z.ZodNumber;
10368
+ }, z.core.$strict>;
10369
+ }, z.core.$strict>>;
8621
10370
  }, z.core.$strict>;
8622
10371
  }, z.core.$strict>;
8623
10372
  type: z.ZodLiteral<"run.finished">;
@@ -8697,7 +10446,17 @@ export interface AgentVersionsClient {
8697
10446
  * @wire POST /v1/agents/:agentId/versions/:version/unregister
8698
10447
  */
8699
10448
  unregister(agentId: AgentId, version: Semver, options?: MutationOptions): Promise<UnregisterAgentResult>;
10449
+ /**
10450
+ * Derive a new version from a pinned one with some data-block pins
10451
+ * swapped (an expert's edit, no code change). Numbered the next free
10452
+ * patch after the agent's highest version. Needs `publish` on the agent.
10453
+ *
10454
+ * @wire POST /v1/agents/:agentId/versions
10455
+ */
10456
+ derive(agentId: AgentId, input: DeriveAgentVersionInput, options?: MutationOptions): Promise<Agent$1>;
8700
10457
  }
10458
+ /** Body of `POST /v1/agents/{agentId}/versions`. */
10459
+ export type DeriveAgentVersionInput = DeriveAgentVersionBody;
8701
10460
  export interface ListAgentsFilter {
8702
10461
  readonly limit?: number;
8703
10462
  readonly cursor?: string;
@@ -8883,6 +10642,8 @@ export interface ApprovalFilter extends Omit<Filter<ApprovalStatus>, "status"> {
8883
10642
  * passing several is rejected client-side with `invalid-request`.
8884
10643
  */
8885
10644
  readonly status?: ApprovalStatus;
10645
+ /** Only one project's approvals (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
10646
+ readonly scope?: ScopeRef;
8886
10647
  /** Filter by required reviewer role. Caller must have rank ≥ value (else 403). */
8887
10648
  readonly requiredRole?: ReviewerRole$1;
8888
10649
  /** ISO 8601 timestamp — return approvals created strictly after this. */
@@ -9084,6 +10845,59 @@ export interface AuthProvidersClient {
9084
10845
  readonly idempotencyKey?: string;
9085
10846
  }): Promise<IdentityProviderUnregisterOutcome>;
9086
10847
  }
10848
+ export type BlockPage = BlockCollectionPage;
10849
+ /**
10850
+ * The block fields of `POST /v1/blocks`. The project travels as
10851
+ * `PublishBlockOptions.projectId`, so the input stays the block itself.
10852
+ */
10853
+ export type PublishBlockInput = Omit<PublishBlockBody, "projectId">;
10854
+ export interface PublishBlockOptions {
10855
+ /** The project the block belongs to. Its versions all stay there. */
10856
+ readonly projectId: string;
10857
+ readonly idempotencyKey?: string;
10858
+ }
10859
+ export interface ListBlocksFilter {
10860
+ readonly limit?: number;
10861
+ readonly cursor?: string;
10862
+ readonly kind?: BlockKind;
10863
+ /** Prefix match on the block id. */
10864
+ readonly name?: string;
10865
+ /** Only the blocks of this project, or of every project in this org. */
10866
+ readonly scope?: ScopeRef;
10867
+ }
10868
+ export interface ListBlockVersionsFilter {
10869
+ readonly limit?: number;
10870
+ readonly cursor?: string;
10871
+ /** Include unregistered versions, each with `unregisteredAt`. */
10872
+ readonly includeTombstoned?: boolean;
10873
+ }
10874
+ export interface BlocksClient {
10875
+ /**
10876
+ * Publish a block version into a project. Needs `write` on it.
10877
+ *
10878
+ * @wire POST /v1/blocks
10879
+ */
10880
+ publish(input: PublishBlockInput, options: PublishBlockOptions): Promise<PublishBlockResult>;
10881
+ /** @wire GET /v1/blocks */
10882
+ list(filter?: ListBlocksFilter): Promise<BlockPage>;
10883
+ /** @wire GET /v1/blocks/:blockId */
10884
+ get(blockId: string): Promise<Block>;
10885
+ readonly versions: BlockVersionsClient;
10886
+ }
10887
+ export interface BlockVersionsClient {
10888
+ /** @wire GET /v1/blocks/:blockId/versions */
10889
+ list(blockId: string, filter?: ListBlockVersionsFilter): Promise<BlockPage>;
10890
+ /** @wire GET /v1/blocks/:blockId/versions/:version */
10891
+ get(blockId: string, version: string): Promise<Block>;
10892
+ /** @wire POST /v1/blocks/:blockId/versions/:version/unregister */
10893
+ unregister(blockId: string, version: string, options?: {
10894
+ readonly idempotencyKey?: string;
10895
+ }): Promise<UnregisterBlockResult>;
10896
+ /** @wire POST /v1/blocks/:blockId/versions/:version/reinstate */
10897
+ reinstate(blockId: string, version: string, options?: {
10898
+ readonly idempotencyKey?: string;
10899
+ }): Promise<ReinstateBlockResult>;
10900
+ }
9087
10901
  /**
9088
10902
  * Capabilities resource — capability declarations + model router +
9089
10903
  * provider configuration.
@@ -9311,6 +11125,8 @@ export interface ConversationFilter extends Omit<Filter<ConversationStatus>, "st
9311
11125
  * passing several is rejected client-side with `invalid-request`.
9312
11126
  */
9313
11127
  readonly status?: ConversationStatus;
11128
+ /** Only one project's conversations (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
11129
+ readonly scope?: ScopeRef;
9314
11130
  readonly agent?: AgentId;
9315
11131
  readonly participantId?: string;
9316
11132
  }
@@ -9333,8 +11149,10 @@ export interface CostClient {
9333
11149
  }
9334
11150
  export interface UsageClient {
9335
11151
  /**
9336
- * Paginated raw cost records. Filter by run, agent, conversation,
9337
- * category, provider, and time window.
11152
+ * Paginated raw cost records: one per model call, with its model,
11153
+ * usage and what the vendor said about it. Filter by run (or a run
11154
+ * tree), scope, agent, conversation, category, provider, model and
11155
+ * time window.
9338
11156
  *
9339
11157
  * @wire `GET /v1/cost/records` — see
9340
11158
  * `@kindgi/api/openapi.json#/paths/~1v1~1cost~1records/get`.
@@ -9346,26 +11164,25 @@ export interface UsageClient {
9346
11164
  * @wire `GET /v1/cost/records/{recordId}` — see
9347
11165
  * `@kindgi/api/openapi.json#/paths/~1v1~1cost~1records~1{recordId}/get`.
9348
11166
  */
9349
- get(recordId: string): Promise<CostRecord>;
11167
+ get(recordId: string, options?: {
11168
+ readonly includeRawUsage?: boolean;
11169
+ }): Promise<CostRecord>;
9350
11170
  /**
9351
- * Grouped aggregate — totals in USD, bucketed by requested dimensions
9352
- * over the time window. Cheaper than paginating raw records for
9353
- * dashboards.
11171
+ * Grouped aggregate — totals in USD and tokens, bucketed by requested
11172
+ * dimensions over the time window. Cheaper than paginating raw records
11173
+ * for dashboards. With `scope: { kind: 'org', orgId }`, one call sums
11174
+ * an org's spend across its projects.
9354
11175
  *
9355
11176
  * @wire `GET /v1/cost/aggregate` — see
9356
11177
  * `@kindgi/api/openapi.json#/paths/~1v1~1cost~1aggregate/get`.
9357
11178
  */
9358
11179
  summary(input: UsageSummaryInput): Promise<CostAggregateResult>;
9359
11180
  }
9360
- export interface UsageSummaryInput {
11181
+ export interface UsageSummaryInput extends Omit<CostRecordFilter, "from" | "to" | "limit" | "cursor" | "includeRawUsage"> {
9361
11182
  readonly from: Timestamp;
11183
+ /** Exclusive. */
9362
11184
  readonly to: Timestamp;
9363
11185
  readonly groupBy?: readonly CostGroupDimension[];
9364
- readonly category?: string;
9365
- readonly providerId?: ProviderId;
9366
- readonly agentId?: AgentId;
9367
- readonly runId?: RunId;
9368
- readonly conversationId?: ThreadId;
9369
11186
  }
9370
11187
  export interface BudgetsClient {
9371
11188
  /**
@@ -9459,19 +11276,19 @@ export interface EnvClient {
9459
11276
  delete(input: EnvDeleteInput): Promise<EnvDeleteOutcome>;
9460
11277
  }
9461
11278
  export interface EnvListInput {
9462
- readonly scope: Scope;
11279
+ readonly scope: ScopeRef;
9463
11280
  readonly envName: EnvName;
9464
11281
  readonly cursor?: Cursor;
9465
11282
  readonly namePrefix?: string;
9466
11283
  readonly limit?: number;
9467
11284
  }
9468
11285
  export interface EnvGetInput {
9469
- readonly scope: Scope;
11286
+ readonly scope: ScopeRef;
9470
11287
  readonly envName: EnvName;
9471
11288
  readonly name: string;
9472
11289
  }
9473
11290
  export interface EnvSetInput {
9474
- readonly scope: Scope;
11291
+ readonly scope: ScopeRef;
9475
11292
  readonly envName: EnvName;
9476
11293
  readonly name: string;
9477
11294
  readonly value: string;
@@ -9479,12 +11296,12 @@ export interface EnvSetInput {
9479
11296
  readonly tags?: Readonly<Record<string, string>>;
9480
11297
  }
9481
11298
  export interface EnvDeleteInput {
9482
- readonly scope: Scope;
11299
+ readonly scope: ScopeRef;
9483
11300
  readonly envName: EnvName;
9484
11301
  readonly name: string;
9485
11302
  }
9486
11303
  export interface EnvRecord {
9487
- readonly scope: Scope;
11304
+ readonly scope: ScopeRef;
9488
11305
  readonly envName: EnvName;
9489
11306
  readonly name: string;
9490
11307
  readonly value: string;
@@ -9573,6 +11390,16 @@ export type PublishSuiteInput = Omit<PublishEvalSuiteBody, "projectId">;
9573
11390
  export type PublishSuiteResult = PublishEvalSuiteResult;
9574
11391
  export type UnregisterSuiteVersionResult = UnregisterEvalSuiteResult;
9575
11392
  export type ReinstateSuiteVersionResult = ReinstateEvalSuiteVersionResult;
11393
+ /** Body of `POST /v1/eval-suites/{suiteId}/versions/from-judgments`. */
11394
+ export type BuildFromJudgmentsInput = BuildJudgedSuiteBody;
11395
+ export type BuildFromJudgmentsResult = BuildJudgedSuiteResult;
11396
+ /** One case of a `judged` suite: a copy of a judged run with its items' judgments summed up. */
11397
+ export type SuiteCase = JudgedEvalCase;
11398
+ export type SuiteCasePage = JudgedEvalCaseCollectionPage;
11399
+ export interface ListSuiteCasesQuery {
11400
+ readonly limit?: number;
11401
+ readonly cursor?: string;
11402
+ }
9576
11403
  export interface PublishSuiteOptions {
9577
11404
  /** Project the suite is published into. `POST /v1/eval-suites` requires it. */
9578
11405
  readonly projectId: string;
@@ -9604,6 +11431,22 @@ export interface EvalSuitesClient {
9604
11431
  list(filter?: ListSuitesFilter): Promise<SuitePage>;
9605
11432
  /** @wire GET /v1/eval-suites/:suiteId */
9606
11433
  get(suiteId: string): Promise<Suite>;
11434
+ /**
11435
+ * Publish a `judged` suite version whose cases are copies of judged runs
11436
+ * of an agent or flow, with each item's judgments summed up. Needs
11437
+ * `admin` on `input.projectId`.
11438
+ *
11439
+ * @wire POST /v1/eval-suites/:suiteId/versions/from-judgments
11440
+ */
11441
+ buildFromJudgments(suiteId: string, input: BuildFromJudgmentsInput, options?: {
11442
+ readonly idempotencyKey?: string;
11443
+ }): Promise<BuildFromJudgmentsResult>;
11444
+ /**
11445
+ * The cases of a `judged` suite version, in stored order.
11446
+ *
11447
+ * @wire GET /v1/eval-suites/:suiteId/versions/:version/cases
11448
+ */
11449
+ listCases(suiteId: string, version: string, query?: ListSuiteCasesQuery): Promise<SuiteCasePage>;
9607
11450
  readonly versions: EvalSuiteVersionsClient;
9608
11451
  }
9609
11452
  export interface EvalSuiteVersionsClient {
@@ -9936,6 +11779,114 @@ export interface IdentityUsersClient {
9936
11779
  readonly idempotencyKey?: string;
9937
11780
  }): Promise<RevokeSessionsOutcome>;
9938
11781
  }
11782
+ /**
11783
+ * Judge classes resource: the deployment's named kinds of judge
11784
+ * ("expert", "user", ...), each with a weight, scoped to the tenant, a
11785
+ * project, or an agent in a project.
11786
+ */
11787
+ export interface JudgeClassesClient {
11788
+ /**
11789
+ * Create a class. Names are unique among the live classes of a scope
11790
+ * (`409 judge-class-name-taken`).
11791
+ *
11792
+ * @wire `POST /v1/judge-classes` — see
11793
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes/post`.
11794
+ */
11795
+ create(input: CreateJudgeClassInput, options?: {
11796
+ readonly idempotencyKey?: string;
11797
+ }): Promise<JudgeClass>;
11798
+ /**
11799
+ * Live classes, newest first. `scope` narrows to one scope.
11800
+ *
11801
+ * @wire `GET /v1/judge-classes` — see
11802
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes/get`.
11803
+ */
11804
+ list(filter?: JudgeClassFilter): Promise<Page<JudgeClass>>;
11805
+ /**
11806
+ * One class, also a retired one (`unregisteredAt` set).
11807
+ *
11808
+ * @wire `GET /v1/judge-classes/{judgeClassId}` — see
11809
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes~1{judgeClassId}/get`.
11810
+ */
11811
+ get(judgeClassId: string): Promise<JudgeClass>;
11812
+ /**
11813
+ * Change a live class's weight or description.
11814
+ *
11815
+ * @wire `PATCH /v1/judge-classes/{judgeClassId}` — see
11816
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes~1{judgeClassId}/patch`.
11817
+ */
11818
+ update(judgeClassId: string, input: UpdateJudgeClassInput, options?: {
11819
+ readonly idempotencyKey?: string;
11820
+ }): Promise<JudgeClass>;
11821
+ /**
11822
+ * Retire a class: no new judgments may name it.
11823
+ *
11824
+ * @wire `POST /v1/judge-classes/{judgeClassId}/unregister` — see
11825
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judge-classes~1{judgeClassId}~1unregister/post`.
11826
+ */
11827
+ unregister(judgeClassId: string, options?: {
11828
+ readonly idempotencyKey?: string;
11829
+ }): Promise<void>;
11830
+ }
11831
+ export interface JudgeClassFilter {
11832
+ readonly limit?: number;
11833
+ readonly cursor?: Cursor;
11834
+ readonly scope?: JudgeClassScope;
11835
+ }
11836
+ /**
11837
+ * Judgments resource: yes or no, with an optional reason, about one item
11838
+ * of a finished run's output.
11839
+ *
11840
+ * Who judged comes from the token you call with, never from the input.
11841
+ * Judging again as the same caller for the same run, item key and
11842
+ * `participantId` supersedes the earlier judgment, which stays as history.
11843
+ */
11844
+ export interface JudgmentsClient {
11845
+ /**
11846
+ * Judge an item of a finished run.
11847
+ *
11848
+ * @wire `POST /v1/judgments` — see `@kindgi/api/openapi.json#/paths/~1v1~1judgments/post`.
11849
+ */
11850
+ create(input: CreateJudgmentInput, options?: {
11851
+ readonly idempotencyKey?: string;
11852
+ }): Promise<Judgment>;
11853
+ /**
11854
+ * Live judgments, newest first.
11855
+ *
11856
+ * @wire `GET /v1/judgments` — see `@kindgi/api/openapi.json#/paths/~1v1~1judgments/get`.
11857
+ */
11858
+ list(filter?: JudgmentFilter): Promise<Page<Judgment>>;
11859
+ /**
11860
+ * One judgment with the stored copies of what was judged.
11861
+ *
11862
+ * @wire `GET /v1/judgments/{judgmentId}` — see
11863
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judgments~1{judgmentId}/get`.
11864
+ */
11865
+ get(judgmentId: string): Promise<JudgmentWithCopies>;
11866
+ /**
11867
+ * Remove a judgment. Unknown ids fail with `404 judgment-not-found`.
11868
+ *
11869
+ * @wire `POST /v1/judgments/{judgmentId}/unregister` — see
11870
+ * `@kindgi/api/openapi.json#/paths/~1v1~1judgments~1{judgmentId}~1unregister/post`.
11871
+ */
11872
+ unregister(judgmentId: string, options?: {
11873
+ readonly idempotencyKey?: string;
11874
+ }): Promise<void>;
11875
+ }
11876
+ export interface JudgmentFilter {
11877
+ readonly limit?: number;
11878
+ readonly cursor?: Cursor;
11879
+ readonly runId?: string;
11880
+ readonly agentId?: string;
11881
+ /** Needs `agentId`. */
11882
+ readonly agentVersion?: string;
11883
+ readonly flowId?: string;
11884
+ readonly verdict?: Verdict;
11885
+ readonly judgeClassId?: string;
11886
+ readonly participantId?: string;
11887
+ /** Narrow to a project (or org). */
11888
+ readonly scope?: ScopeRef;
11889
+ }
9939
11890
  /**
9940
11891
  * MCP resource — Model Context Protocol interop.
9941
11892
  *
@@ -10742,10 +12693,18 @@ export interface RunJournalPage {
10742
12693
  export interface ListRunsFilter {
10743
12694
  readonly limit?: number;
10744
12695
  readonly cursor?: string;
12696
+ /** Only one project's runs (`kind: 'project'`), or the runs of every project in an org (`kind: 'org'`). */
12697
+ readonly scope?: ScopeRef;
10745
12698
  /** Only the child runs of this run. */
10746
12699
  readonly parentRunId?: RunId;
10747
12700
  /** Only runs that are not a child of another run. */
10748
12701
  readonly topLevel?: boolean;
12702
+ /** Only this agent's turns, at any version (turns from before 0.1.3 don't name their agent). */
12703
+ readonly agentId?: AgentId | string;
12704
+ /** Replay runs (an eval run re-running a past run): `exclude` (the default) leaves them out, `include` lists them too, `only` lists just them. */
12705
+ readonly replays?: "exclude" | "include" | "only";
12706
+ /** Only the replay runs of this eval run (implies replays are included). */
12707
+ readonly evalRunId?: string;
10749
12708
  /** Include each run's `output` (omitted from lists by default). */
10750
12709
  readonly includeOutput?: boolean;
10751
12710
  }
@@ -10792,11 +12751,20 @@ export interface ResumeRunInput {
10792
12751
  readonly value?: unknown;
10793
12752
  readonly idempotencyKey?: string;
10794
12753
  }
12754
+ /**
12755
+ * The agent a run is a turn of (`@kindgi/api/openapi.json#RunAgent`):
12756
+ * which agent, the version that ran, and the conversation.
12757
+ */
12758
+ export interface RunAgent {
12759
+ readonly id: string;
12760
+ readonly version: string;
12761
+ readonly conversationId: string;
12762
+ }
10795
12763
  /**
10796
12764
  * Wire shape — matches `@kindgi/api/openapi.json#Run`. Runs are
10797
12765
  * flow-native on the wire: an agent run executes as a flow on the
10798
- * server, and the row reports that flow's `flowId` / `flowVersion`
10799
- * rather than the `agentId`.
12766
+ * server, and the row reports that flow's `flowId` / `flowVersion`;
12767
+ * `agent` names the agent.
10800
12768
  */
10801
12769
  export interface Run {
10802
12770
  readonly id: RunId;
@@ -10816,6 +12784,11 @@ export interface Run {
10816
12784
  readonly parentRunId?: RunId;
10817
12785
  /** Set on a child run: the node in the parent run that started it. */
10818
12786
  readonly parentNodeId?: string;
12787
+ /**
12788
+ * Set on an agent's turn (an agent run, or the turn a flow's agent step
12789
+ * started). Absent on other runs, and on turns from before 0.1.3.
12790
+ */
12791
+ readonly agent?: RunAgent;
10819
12792
  }
10820
12793
  /**
10821
12794
  * What `runs.start` returns: the run, plus a public run token when the
@@ -10957,14 +12930,14 @@ export interface SecretRotationsClient {
10957
12930
  }): AsyncIterable<unknown>;
10958
12931
  }
10959
12932
  export interface SecretRotationGetInput {
10960
- readonly scope: Scope;
12933
+ readonly scope: ScopeRef;
10961
12934
  readonly envName: EnvName;
10962
12935
  readonly name: string;
10963
12936
  readonly rotationId: string;
10964
12937
  }
10965
12938
  export type SecretRotationEventsInput = SecretRotationGetInput;
10966
12939
  export interface SecretListInput {
10967
- readonly scope: Scope;
12940
+ readonly scope: ScopeRef;
10968
12941
  readonly envName: EnvName;
10969
12942
  readonly cursor?: Cursor;
10970
12943
  readonly namePrefix?: string;
@@ -10972,25 +12945,25 @@ export interface SecretListInput {
10972
12945
  readonly limit?: number;
10973
12946
  }
10974
12947
  export interface SecretGetInput {
10975
- readonly scope: Scope;
12948
+ readonly scope: ScopeRef;
10976
12949
  readonly envName: EnvName;
10977
12950
  readonly name: string;
10978
12951
  }
10979
12952
  export interface SecretGetVersionInput {
10980
- readonly scope: Scope;
12953
+ readonly scope: ScopeRef;
10981
12954
  readonly envName: EnvName;
10982
12955
  readonly name: string;
10983
12956
  readonly versionId: number;
10984
12957
  }
10985
12958
  export interface SecretListVersionsInput {
10986
- readonly scope: Scope;
12959
+ readonly scope: ScopeRef;
10987
12960
  readonly envName: EnvName;
10988
12961
  readonly name: string;
10989
12962
  readonly cursor?: Cursor;
10990
12963
  readonly limit?: number;
10991
12964
  }
10992
12965
  export interface SecretSetInput {
10993
- readonly scope: Scope;
12966
+ readonly scope: ScopeRef;
10994
12967
  readonly envName: EnvName;
10995
12968
  readonly name: string;
10996
12969
  readonly value: string;
@@ -11001,7 +12974,7 @@ export interface SecretSetInput {
11001
12974
  readonly idempotencyKey?: string;
11002
12975
  }
11003
12976
  export interface SecretRotateInput {
11004
- readonly scope: Scope;
12977
+ readonly scope: ScopeRef;
11005
12978
  readonly envName: EnvName;
11006
12979
  readonly name: string;
11007
12980
  readonly newValue?: string;
@@ -11032,14 +13005,14 @@ export interface PollingOverrides {
11032
13005
  readonly sleep?: (ms: number) => Promise<void>;
11033
13006
  }
11034
13007
  export interface SecretRevokeInput {
11035
- readonly scope: Scope;
13008
+ readonly scope: ScopeRef;
11036
13009
  readonly envName: EnvName;
11037
13010
  readonly name: string;
11038
13011
  readonly hard?: boolean;
11039
13012
  readonly reason?: string;
11040
13013
  }
11041
13014
  export interface SecretRecord {
11042
- readonly scope: Scope;
13015
+ readonly scope: ScopeRef;
11043
13016
  readonly envName: EnvName;
11044
13017
  readonly name: string;
11045
13018
  readonly currentVersion: number;
@@ -11051,7 +13024,7 @@ export interface SecretRecord {
11051
13024
  readonly rotationDueAt?: string;
11052
13025
  }
11053
13026
  export interface SecretVersionRecord {
11054
- readonly scope: Scope;
13027
+ readonly scope: ScopeRef;
11055
13028
  readonly envName: EnvName;
11056
13029
  readonly name: string;
11057
13030
  readonly versionId: number;
@@ -11826,7 +13799,11 @@ export interface KindgiClient {
11826
13799
  readonly compliance: ComplianceClient;
11827
13800
  readonly audit: AuditResourceClient;
11828
13801
  readonly evalSuites: EvalSuitesClient;
13802
+ /** Data blocks: versioned prompts and settings an agent version pins. */
13803
+ readonly blocks: BlocksClient;
11829
13804
  readonly evalRuns: EvalRunsClient;
13805
+ readonly judgments: JudgmentsClient;
13806
+ readonly judgeClasses: JudgeClassesClient;
11830
13807
  readonly users: UsersClient;
11831
13808
  readonly identity: IdentityClient;
11832
13809
  readonly auth: AuthClient;