@kindgi/client 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +52 -39
- package/dist/index.d.cts +430 -58
- package/dist/index.d.ts +430 -58
- package/dist/index.js +52 -39
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -1328,6 +1328,14 @@ export interface ConversationHitlPolicy {
|
|
|
1328
1328
|
* (see `resolveEffectiveHitlPolicy`).
|
|
1329
1329
|
*/
|
|
1330
1330
|
readonly timeoutMs?: number;
|
|
1331
|
+
/**
|
|
1332
|
+
* What happens when an approval's time runs out: it escalates one
|
|
1333
|
+
* reviewer tier, and at `admin` it expires (the turn fails with
|
|
1334
|
+
* `hitl-cancelled`). `'escalate'` is the only behavior today, and the
|
|
1335
|
+
* default; `'auto-approve'` and `'auto-reject'` are refused rather than
|
|
1336
|
+
* accepted and ignored.
|
|
1337
|
+
*/
|
|
1338
|
+
readonly onTimeout?: "escalate";
|
|
1331
1339
|
}
|
|
1332
1340
|
/**
|
|
1333
1341
|
* Budgets guard a single agent turn. Every field is optional; unset
|
|
@@ -1711,18 +1719,6 @@ export interface DefineAgentSpec {
|
|
|
1711
1719
|
/** Free-form tags for catalog filtering. Not interpreted by the runtime. */
|
|
1712
1720
|
readonly tags?: readonly string[];
|
|
1713
1721
|
}
|
|
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
1722
|
export type GuardrailSeverity = "info" | "warn" | "error" | "critical";
|
|
1727
1723
|
/**
|
|
1728
1724
|
* Actions the engine surfaces when a check fails. Open string — the
|
|
@@ -1856,6 +1852,43 @@ export interface TurnFailedEvent {
|
|
|
1856
1852
|
readonly errorCode: string;
|
|
1857
1853
|
readonly message: string;
|
|
1858
1854
|
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Wire-body serialization for `Scope` values.
|
|
1857
|
+
*
|
|
1858
|
+
* The `Scope` type from `@kindgi/platform` carries `tenantId` because
|
|
1859
|
+
* server-internal code (routes, bindings, storage adapters) needs it
|
|
1860
|
+
* everywhere the tuple flows. On the HTTP wire body, however, tenantId
|
|
1861
|
+
* is redundant: every route derives it authoritatively from the bearer
|
|
1862
|
+
* and any mismatched value is rejected as
|
|
1863
|
+
* `scope-mismatch 400`.
|
|
1864
|
+
*
|
|
1865
|
+
* Client callers rarely know their session tenantId ahead of time, and
|
|
1866
|
+
* a placeholder value would trip the mismatch check.
|
|
1867
|
+
* `scopeForBody(scope)` strips tenantId at the SDK boundary so request
|
|
1868
|
+
* bodies carry only the fields the server actually reads off the wire
|
|
1869
|
+
* (`kind` + `orgId`/`projectId`).
|
|
1870
|
+
*
|
|
1871
|
+
* Use this ONLY for request bodies. Query-string helpers (`scopeToQuery`)
|
|
1872
|
+
* already omit tenantId by construction and don't need this shim.
|
|
1873
|
+
*/
|
|
1874
|
+
/**
|
|
1875
|
+
* A scope, as the client takes it: the kind and its id. `tenantId` is
|
|
1876
|
+
* optional. The API derives the tenant from the bearer token, so the
|
|
1877
|
+
* client never sends it, and an app needn't know it. `@kindgi/platform`'s
|
|
1878
|
+
* `Scope`, which carries one, fits here as well.
|
|
1879
|
+
*/
|
|
1880
|
+
export type ScopeRef = {
|
|
1881
|
+
readonly kind: "tenant";
|
|
1882
|
+
readonly tenantId?: string;
|
|
1883
|
+
} | {
|
|
1884
|
+
readonly kind: "org";
|
|
1885
|
+
readonly orgId: string;
|
|
1886
|
+
readonly tenantId?: string;
|
|
1887
|
+
} | {
|
|
1888
|
+
readonly kind: "project";
|
|
1889
|
+
readonly projectId: string;
|
|
1890
|
+
readonly tenantId?: string;
|
|
1891
|
+
};
|
|
1859
1892
|
/** @unwired SDK-defined id for a schedule. */
|
|
1860
1893
|
export type ScheduleId = Brand<string, "ScheduleId">;
|
|
1861
1894
|
/** @unwired SDK-defined id for a model provider. */
|
|
@@ -2323,6 +2356,25 @@ export interface Approval {
|
|
|
2323
2356
|
readonly updatedAt: Timestamp;
|
|
2324
2357
|
readonly decidedAt?: Timestamp;
|
|
2325
2358
|
readonly expiresAt?: Timestamp;
|
|
2359
|
+
/**
|
|
2360
|
+
* The reviewer's decision, once one is recorded. Absent while the
|
|
2361
|
+
* approval is open, and when it ended without one (it expired, or a
|
|
2362
|
+
* timeout escalated it).
|
|
2363
|
+
*/
|
|
2364
|
+
readonly decision?: ApprovalDecisionRecord;
|
|
2365
|
+
}
|
|
2366
|
+
/**
|
|
2367
|
+
* Wire shape — matches `@kindgi/api/openapi.json#ApprovalDecisionRecord`.
|
|
2368
|
+
* An approval's recorded decision: what the reviewer decided, why, and who.
|
|
2369
|
+
*/
|
|
2370
|
+
export interface ApprovalDecisionRecord {
|
|
2371
|
+
readonly decision: ApprovalDecision;
|
|
2372
|
+
/** Who decided, as an actor: `user:<userId>`, the reviewer's user (the Kindgi runtime always records it). */
|
|
2373
|
+
readonly decidedBy?: string;
|
|
2374
|
+
readonly reviewerId: ReviewerId;
|
|
2375
|
+
readonly reviewerRoleAtDecision: ReviewerRole$1;
|
|
2376
|
+
readonly decidedAt: Timestamp;
|
|
2377
|
+
readonly rationale?: string;
|
|
2326
2378
|
}
|
|
2327
2379
|
/**
|
|
2328
2380
|
* Wire shape — matches `@kindgi/api/openapi.json#ReviewDecision`. Decision row
|
|
@@ -2595,6 +2647,12 @@ export interface Conversation {
|
|
|
2595
2647
|
readonly agentVersion: string;
|
|
2596
2648
|
readonly title: string;
|
|
2597
2649
|
readonly participantId?: string;
|
|
2650
|
+
/**
|
|
2651
|
+
* The project the conversation is in: the project of the run that
|
|
2652
|
+
* opened it, or `projectId` on open (the tenant's Default project when
|
|
2653
|
+
* omitted). Absent on conversations from before 0.1.3.
|
|
2654
|
+
*/
|
|
2655
|
+
readonly projectId?: string;
|
|
2598
2656
|
/** Structural scope (project id, matter id, etc.). */
|
|
2599
2657
|
readonly scope: Readonly<Record<string, unknown>>;
|
|
2600
2658
|
readonly status: ConversationStatus;
|
|
@@ -2612,6 +2670,11 @@ export interface Conversation {
|
|
|
2612
2670
|
export interface OpenConversationInput {
|
|
2613
2671
|
readonly agentId: AgentId;
|
|
2614
2672
|
readonly agentVersion: string;
|
|
2673
|
+
/**
|
|
2674
|
+
* Put the conversation in a project (one of the tenant's): lists filter
|
|
2675
|
+
* by it. Omitted: the tenant's Default project, as for a run.
|
|
2676
|
+
*/
|
|
2677
|
+
readonly projectId?: string;
|
|
2615
2678
|
readonly scope?: Readonly<Record<string, unknown>>;
|
|
2616
2679
|
readonly participantId?: string;
|
|
2617
2680
|
readonly title?: string;
|
|
@@ -2782,6 +2845,17 @@ export interface ProvenanceRecord {
|
|
|
2782
2845
|
readonly value: string;
|
|
2783
2846
|
readonly signedAt: Timestamp;
|
|
2784
2847
|
};
|
|
2848
|
+
/**
|
|
2849
|
+
* Each model call's usage from the cost ledger, by the `callId` in its
|
|
2850
|
+
* `model-call` node's attributes. Joined when read: not part of the
|
|
2851
|
+
* signed DAG.
|
|
2852
|
+
*/
|
|
2853
|
+
readonly callUsage?: Readonly<Record<string, {
|
|
2854
|
+
readonly usage: ModelCallTokens;
|
|
2855
|
+
readonly costUsd?: number;
|
|
2856
|
+
readonly durationMs?: number;
|
|
2857
|
+
readonly servedModel?: string;
|
|
2858
|
+
}>>;
|
|
2785
2859
|
}
|
|
2786
2860
|
/**
|
|
2787
2861
|
* Wire shape for records surfaced by `GET /v1/provenance` (list). The
|
|
@@ -2799,6 +2873,8 @@ export interface ProvenanceRecordMetadata {
|
|
|
2799
2873
|
readonly version: string;
|
|
2800
2874
|
};
|
|
2801
2875
|
readonly signed: boolean;
|
|
2876
|
+
/** The project of the record's run; absent on records from before 0.1.3. */
|
|
2877
|
+
readonly projectId?: string;
|
|
2802
2878
|
}
|
|
2803
2879
|
/**
|
|
2804
2880
|
* Wire shape of a signed export bundle envelope — matches
|
|
@@ -2818,6 +2894,8 @@ export interface ExportedProvenance {
|
|
|
2818
2894
|
readonly exportedAt: Timestamp;
|
|
2819
2895
|
}
|
|
2820
2896
|
export interface ProvenanceQueryFilter extends Filter {
|
|
2897
|
+
/** Only one project's records (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
|
|
2898
|
+
readonly scope?: ScopeRef;
|
|
2821
2899
|
readonly runId?: RunId;
|
|
2822
2900
|
readonly agentId?: AgentId;
|
|
2823
2901
|
/** ISO 8601 timestamp — server filters `createdAt > createdAfter`. */
|
|
@@ -2879,6 +2957,69 @@ export interface CostRecord {
|
|
|
2879
2957
|
readonly occurredAt: Timestamp;
|
|
2880
2958
|
readonly metrics?: Readonly<Record<string, unknown>>;
|
|
2881
2959
|
readonly attributes?: Readonly<Record<string, unknown>>;
|
|
2960
|
+
/** The call's id; its provenance `model-call` node carries it too. */
|
|
2961
|
+
readonly callId?: string;
|
|
2962
|
+
readonly projectId?: ProjectId;
|
|
2963
|
+
/** The root of the record's run tree (a flow run, for its agent turns). */
|
|
2964
|
+
readonly rootRunId?: RunId;
|
|
2965
|
+
readonly parentRunId?: RunId;
|
|
2966
|
+
readonly agentVersion?: string;
|
|
2967
|
+
/** The flow of the run tree's root. */
|
|
2968
|
+
readonly flowId?: string;
|
|
2969
|
+
/** The step that made the call, and the turn's step number. */
|
|
2970
|
+
readonly nodeId?: string;
|
|
2971
|
+
readonly step?: number;
|
|
2972
|
+
/** What the call was for, beyond the turn's own model step (`guardrail-judge:<id>`). */
|
|
2973
|
+
readonly purpose?: string;
|
|
2974
|
+
/** The model actually called. */
|
|
2975
|
+
readonly model?: string;
|
|
2976
|
+
/** The exact model version the vendor reported. */
|
|
2977
|
+
readonly servedModel?: string;
|
|
2978
|
+
/** The router picked a fallback provider for the turn. */
|
|
2979
|
+
readonly fallback?: boolean;
|
|
2980
|
+
/** `ok`: the provider answered. `failed`: the call threw. */
|
|
2981
|
+
readonly status?: "ok" | "failed";
|
|
2982
|
+
readonly usage?: ModelCallTokens;
|
|
2983
|
+
readonly durationMs?: number;
|
|
2984
|
+
readonly finishReason?: string;
|
|
2985
|
+
/** The vendor's id for the request. */
|
|
2986
|
+
readonly providerRequestId?: string;
|
|
2987
|
+
/** HTTP attempts the call took, the client's retries included. */
|
|
2988
|
+
readonly attempts?: number;
|
|
2989
|
+
readonly error?: {
|
|
2990
|
+
readonly message: string;
|
|
2991
|
+
};
|
|
2992
|
+
/** The vendor's own usage object, as it reported it (only with `includeRawUsage`). */
|
|
2993
|
+
readonly rawUsage?: {
|
|
2994
|
+
readonly provider: string;
|
|
2995
|
+
readonly model: string;
|
|
2996
|
+
readonly usage: Readonly<Record<string, unknown>>;
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
/**
|
|
3000
|
+
* A model call's tokens. `promptTokens` / `completionTokens` are the
|
|
3001
|
+
* totals; `cacheReadTokens` / `cacheWriteTokens` are parts of
|
|
3002
|
+
* `promptTokens`, `reasoningTokens` of `completionTokens`, present when
|
|
3003
|
+
* the provider reports them.
|
|
3004
|
+
*/
|
|
3005
|
+
export interface ModelCallTokens {
|
|
3006
|
+
readonly promptTokens: number;
|
|
3007
|
+
readonly completionTokens: number;
|
|
3008
|
+
readonly cacheReadTokens?: number;
|
|
3009
|
+
readonly cacheWriteTokens?: number;
|
|
3010
|
+
readonly reasoningTokens?: number;
|
|
3011
|
+
}
|
|
3012
|
+
/**
|
|
3013
|
+
* Token sums of an aggregate. `prompt` / `completion` are the totals;
|
|
3014
|
+
* `cacheRead` / `cacheWrite` are parts of `prompt`, `reasoning` of
|
|
3015
|
+
* `completion` (`0` where providers didn't report them).
|
|
3016
|
+
*/
|
|
3017
|
+
export interface CostTokenTotals {
|
|
3018
|
+
readonly prompt: number;
|
|
3019
|
+
readonly completion: number;
|
|
3020
|
+
readonly cacheRead: number;
|
|
3021
|
+
readonly cacheWrite: number;
|
|
3022
|
+
readonly reasoning: number;
|
|
2882
3023
|
}
|
|
2883
3024
|
/** @deprecated Renamed to `CostRecord` to match the wire. */
|
|
2884
3025
|
export type UsageRecord = CostRecord;
|
|
@@ -2888,12 +3029,25 @@ export type UsageRecord = CostRecord;
|
|
|
2888
3029
|
*/
|
|
2889
3030
|
export interface CostRecordFilter extends Filter {
|
|
2890
3031
|
readonly runId?: RunId;
|
|
3032
|
+
/** With `runId`: also every run it started, at any depth. */
|
|
3033
|
+
readonly includeDescendants?: boolean;
|
|
3034
|
+
/** Every record of the run tree whose root is this run. */
|
|
3035
|
+
readonly rootRunId?: RunId;
|
|
2891
3036
|
readonly agentId?: AgentId;
|
|
2892
3037
|
readonly conversationId?: ThreadId;
|
|
2893
3038
|
readonly category?: string;
|
|
2894
3039
|
readonly providerId?: ProviderId;
|
|
3040
|
+
/** The model actually called. */
|
|
3041
|
+
readonly model?: string;
|
|
3042
|
+
/** The exact model version the vendor reported. */
|
|
3043
|
+
readonly servedModel?: string;
|
|
3044
|
+
/** Records in this scope: a project, or every project of an org. */
|
|
3045
|
+
readonly scope?: ScopeRef;
|
|
2895
3046
|
readonly from?: Timestamp;
|
|
3047
|
+
/** Exclusive. */
|
|
2896
3048
|
readonly to?: Timestamp;
|
|
3049
|
+
/** Add each model call's `rawUsage`: the vendor's own usage object. */
|
|
3050
|
+
readonly includeRawUsage?: boolean;
|
|
2897
3051
|
}
|
|
2898
3052
|
/** @deprecated Renamed to `CostRecordFilter` to match the wire. */
|
|
2899
3053
|
export type UsageQueryFilter = CostRecordFilter;
|
|
@@ -2901,7 +3055,7 @@ export type UsageQueryFilter = CostRecordFilter;
|
|
|
2901
3055
|
* Wire enum of dimensions callers can pass to `cost.aggregate` — matches
|
|
2902
3056
|
* `@kindgi/api/openapi.json#CostGroupDimension`.
|
|
2903
3057
|
*/
|
|
2904
|
-
export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId";
|
|
3058
|
+
export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId" | "model" | "servedModel" | "projectId" | "orgId" | "rootRunId" | "flowId";
|
|
2905
3059
|
/**
|
|
2906
3060
|
* Wire shape for one aggregated bucket — matches
|
|
2907
3061
|
* `@kindgi/api/openapi.json#CostAggregateGroup`.
|
|
@@ -2914,6 +3068,7 @@ export interface CostAggregateGroup {
|
|
|
2914
3068
|
readonly key: Readonly<Record<string, string | null>>;
|
|
2915
3069
|
readonly count: number;
|
|
2916
3070
|
readonly totalUsd: number;
|
|
3071
|
+
readonly tokens: CostTokenTotals;
|
|
2917
3072
|
}
|
|
2918
3073
|
/**
|
|
2919
3074
|
* Wire shape for `GET /v1/cost/aggregate` response — matches
|
|
@@ -2923,6 +3078,7 @@ export interface CostAggregateResult {
|
|
|
2923
3078
|
readonly groups: readonly CostAggregateGroup[];
|
|
2924
3079
|
readonly totalUsd: number;
|
|
2925
3080
|
readonly totalRecords: number;
|
|
3081
|
+
readonly tokens: CostTokenTotals;
|
|
2926
3082
|
readonly timeRange: {
|
|
2927
3083
|
readonly from: Timestamp;
|
|
2928
3084
|
readonly to: Timestamp;
|
|
@@ -3374,7 +3530,7 @@ export interface RegisterMcpEndpointInput {
|
|
|
3374
3530
|
*/
|
|
3375
3531
|
readonly secretRef?: McpEndpointSecretRef;
|
|
3376
3532
|
/** The scope the endpoint is registered in; authorization checks it. */
|
|
3377
|
-
readonly scope:
|
|
3533
|
+
readonly scope: ScopeRef;
|
|
3378
3534
|
}
|
|
3379
3535
|
/**
|
|
3380
3536
|
* @unwired SDK-defined event shapes; the API has no event emission or
|
|
@@ -3800,6 +3956,20 @@ declare namespace Schemas {
|
|
|
3800
3956
|
export type HealthResult = {
|
|
3801
3957
|
ok: true;
|
|
3802
3958
|
};
|
|
3959
|
+
/**
|
|
3960
|
+
* 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.
|
|
3961
|
+
*/
|
|
3962
|
+
export type RunAgent = {
|
|
3963
|
+
/**
|
|
3964
|
+
* The agent id.
|
|
3965
|
+
*/
|
|
3966
|
+
id: string;
|
|
3967
|
+
/**
|
|
3968
|
+
* The agent version that ran (semver).
|
|
3969
|
+
*/
|
|
3970
|
+
version: string;
|
|
3971
|
+
conversationId: string;
|
|
3972
|
+
};
|
|
3803
3973
|
export type Run = {
|
|
3804
3974
|
/**
|
|
3805
3975
|
* RunId.
|
|
@@ -3830,6 +4000,7 @@ declare namespace Schemas {
|
|
|
3830
4000
|
* Set on a child run: the node in the parent run that started it.
|
|
3831
4001
|
*/
|
|
3832
4002
|
parentNodeId?: string;
|
|
4003
|
+
agent?: RunAgent;
|
|
3833
4004
|
/**
|
|
3834
4005
|
* 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
4006
|
*/
|
|
@@ -3938,6 +4109,7 @@ declare namespace Schemas {
|
|
|
3938
4109
|
* Set on a child run: the node in the parent run that started it.
|
|
3939
4110
|
*/
|
|
3940
4111
|
parentNodeId?: string;
|
|
4112
|
+
agent?: RunAgent;
|
|
3941
4113
|
/**
|
|
3942
4114
|
* 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
4115
|
*/
|
|
@@ -4175,6 +4347,20 @@ declare namespace Schemas {
|
|
|
4175
4347
|
*/
|
|
4176
4348
|
export type ReviewerRole = "standard" | "senior" | "admin";
|
|
4177
4349
|
export type ApprovalStatus = "pending" | "assigned" | "in_review" | "approved" | "rejected" | "escalated" | "expired" | "withdrawn";
|
|
4350
|
+
export type ApprovalDecisionRecord = {
|
|
4351
|
+
decision: "approve" | "reject" | "escalate" | "withdraw";
|
|
4352
|
+
/**
|
|
4353
|
+
* 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.
|
|
4354
|
+
*/
|
|
4355
|
+
decidedBy?: string;
|
|
4356
|
+
reviewerId: string;
|
|
4357
|
+
/**
|
|
4358
|
+
* Reviewer role class. Hierarchy: standard < senior < admin.
|
|
4359
|
+
*/
|
|
4360
|
+
reviewerRoleAtDecision: "standard" | "senior" | "admin";
|
|
4361
|
+
decidedAt: string;
|
|
4362
|
+
rationale?: string;
|
|
4363
|
+
};
|
|
4178
4364
|
export type Approval = {
|
|
4179
4365
|
id: string;
|
|
4180
4366
|
tenantId: string;
|
|
@@ -4200,6 +4386,7 @@ declare namespace Schemas {
|
|
|
4200
4386
|
updatedAt: string;
|
|
4201
4387
|
decidedAt?: string;
|
|
4202
4388
|
expiresAt?: string;
|
|
4389
|
+
decision?: ApprovalDecisionRecord;
|
|
4203
4390
|
};
|
|
4204
4391
|
export type ReviewDecision = {
|
|
4205
4392
|
id: string;
|
|
@@ -4225,7 +4412,7 @@ declare namespace Schemas {
|
|
|
4225
4412
|
decision: "approve" | "reject" | "escalate" | "withdraw";
|
|
4226
4413
|
rationale?: string;
|
|
4227
4414
|
/**
|
|
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`.
|
|
4415
|
+
* 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
4416
|
*/
|
|
4230
4417
|
value?: unknown;
|
|
4231
4418
|
};
|
|
@@ -4925,6 +5112,10 @@ declare namespace Schemas {
|
|
|
4925
5112
|
agentVersion: string;
|
|
4926
5113
|
title: string;
|
|
4927
5114
|
participantId?: string;
|
|
5115
|
+
/**
|
|
5116
|
+
* 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.
|
|
5117
|
+
*/
|
|
5118
|
+
projectId?: string;
|
|
4928
5119
|
/**
|
|
4929
5120
|
* Free-form scope object (currently `{ tenantId }` in tests; enterprises extend with `matterId`, `engagementId`, etc.).
|
|
4930
5121
|
*/
|
|
@@ -4969,6 +5160,10 @@ declare namespace Schemas {
|
|
|
4969
5160
|
* Optional. Defaults to `"Untitled conversation"` when omitted.
|
|
4970
5161
|
*/
|
|
4971
5162
|
title?: string;
|
|
5163
|
+
/**
|
|
5164
|
+
* 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.
|
|
5165
|
+
*/
|
|
5166
|
+
projectId?: string;
|
|
4972
5167
|
/**
|
|
4973
5168
|
* Structural scope (project id, matter id, etc.). Treated opaquely by the runtime.
|
|
4974
5169
|
*/
|
|
@@ -5263,6 +5458,20 @@ declare namespace Schemas {
|
|
|
5263
5458
|
*/
|
|
5264
5459
|
signed: boolean;
|
|
5265
5460
|
createdAt: string;
|
|
5461
|
+
/**
|
|
5462
|
+
* The project of the record's run. Absent on records from before Kindgi 0.1.3; those are listed only without a scope.
|
|
5463
|
+
*/
|
|
5464
|
+
projectId?: string;
|
|
5465
|
+
};
|
|
5466
|
+
/**
|
|
5467
|
+
* The call's tokens. `promptTokens` / `completionTokens` are the totals; `cacheReadTokens` / `cacheWriteTokens` are parts of `promptTokens`, `reasoningTokens` of `completionTokens`, present when the provider reports them.
|
|
5468
|
+
*/
|
|
5469
|
+
export type ModelCallTokens = {
|
|
5470
|
+
promptTokens: number;
|
|
5471
|
+
completionTokens: number;
|
|
5472
|
+
cacheReadTokens?: number;
|
|
5473
|
+
cacheWriteTokens?: number;
|
|
5474
|
+
reasoningTokens?: number;
|
|
5266
5475
|
};
|
|
5267
5476
|
/**
|
|
5268
5477
|
* Full provenance record including the DAG payload.
|
|
@@ -5307,6 +5516,15 @@ declare namespace Schemas {
|
|
|
5307
5516
|
signedAt: string;
|
|
5308
5517
|
};
|
|
5309
5518
|
createdAt: string;
|
|
5519
|
+
/**
|
|
5520
|
+
* 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.
|
|
5521
|
+
*/
|
|
5522
|
+
callUsage?: Record<string, {
|
|
5523
|
+
usage: ModelCallTokens;
|
|
5524
|
+
costUsd?: number;
|
|
5525
|
+
durationMs?: number;
|
|
5526
|
+
servedModel?: string;
|
|
5527
|
+
}>;
|
|
5310
5528
|
};
|
|
5311
5529
|
export type ProvenanceCollectionPage = {
|
|
5312
5530
|
data: Array<ProvenanceRecordMetadata>;
|
|
@@ -5324,7 +5542,7 @@ declare namespace Schemas {
|
|
|
5324
5542
|
includeMessages?: boolean;
|
|
5325
5543
|
};
|
|
5326
5544
|
/**
|
|
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.
|
|
5545
|
+
* 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
5546
|
*/
|
|
5329
5547
|
export type ExportProvenanceResult = {
|
|
5330
5548
|
runId: string;
|
|
@@ -5333,7 +5551,7 @@ declare namespace Schemas {
|
|
|
5333
5551
|
*/
|
|
5334
5552
|
bundle: string;
|
|
5335
5553
|
/**
|
|
5336
|
-
* Semver for the shape of the bundle body. Currently `1.0.
|
|
5554
|
+
* 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
5555
|
*/
|
|
5338
5556
|
bundleSchemaVersion: string;
|
|
5339
5557
|
algorithm: "ed25519";
|
|
@@ -5719,7 +5937,13 @@ declare namespace Schemas {
|
|
|
5719
5937
|
export type GetMCPPromptResult = {
|
|
5720
5938
|
messages: Array<MCPPromptMessage>;
|
|
5721
5939
|
};
|
|
5722
|
-
export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId";
|
|
5940
|
+
export type CostGroupDimension = "agentId" | "runId" | "category" | "providerId" | "day" | "month" | "tenant" | "conversationId" | "model" | "servedModel" | "projectId" | "orgId" | "rootRunId" | "flowId";
|
|
5941
|
+
/**
|
|
5942
|
+
* Why a model call failed (`status: failed`).
|
|
5943
|
+
*/
|
|
5944
|
+
export type ModelCallError = {
|
|
5945
|
+
message: string;
|
|
5946
|
+
};
|
|
5723
5947
|
export type CostRecord = {
|
|
5724
5948
|
id: string;
|
|
5725
5949
|
tenantId: string;
|
|
@@ -5746,6 +5970,76 @@ declare namespace Schemas {
|
|
|
5746
5970
|
* Free-form filter/display tags — never counters.
|
|
5747
5971
|
*/
|
|
5748
5972
|
attributes?: Record<string, unknown>;
|
|
5973
|
+
/**
|
|
5974
|
+
* A model call's id (`category` `llm.inference`); its provenance `model-call` node carries it too.
|
|
5975
|
+
*/
|
|
5976
|
+
callId?: string;
|
|
5977
|
+
projectId?: string;
|
|
5978
|
+
/**
|
|
5979
|
+
* The root of the record's run tree (a flow run, for its agent turns).
|
|
5980
|
+
*/
|
|
5981
|
+
rootRunId?: string;
|
|
5982
|
+
parentRunId?: string;
|
|
5983
|
+
agentVersion?: string;
|
|
5984
|
+
/**
|
|
5985
|
+
* The flow of the run tree's root.
|
|
5986
|
+
*/
|
|
5987
|
+
flowId?: string;
|
|
5988
|
+
/**
|
|
5989
|
+
* The step that made the call.
|
|
5990
|
+
*/
|
|
5991
|
+
nodeId?: string;
|
|
5992
|
+
/**
|
|
5993
|
+
* The turn's step number.
|
|
5994
|
+
*/
|
|
5995
|
+
step?: number;
|
|
5996
|
+
/**
|
|
5997
|
+
* What the call was for, beyond the turn's own model step: `guardrail-judge:<guardrail id>`.
|
|
5998
|
+
*/
|
|
5999
|
+
purpose?: string;
|
|
6000
|
+
/**
|
|
6001
|
+
* The model actually called.
|
|
6002
|
+
*/
|
|
6003
|
+
model?: string;
|
|
6004
|
+
/**
|
|
6005
|
+
* The exact model version the vendor reported (vendors alias).
|
|
6006
|
+
*/
|
|
6007
|
+
servedModel?: string;
|
|
6008
|
+
/**
|
|
6009
|
+
* The router picked a fallback provider for the turn.
|
|
6010
|
+
*/
|
|
6011
|
+
fallback?: boolean;
|
|
6012
|
+
/**
|
|
6013
|
+
* `ok`: the provider answered. `failed`: the call threw.
|
|
6014
|
+
*/
|
|
6015
|
+
status?: "ok" | "failed";
|
|
6016
|
+
usage?: ModelCallTokens;
|
|
6017
|
+
durationMs?: number;
|
|
6018
|
+
finishReason?: string;
|
|
6019
|
+
/**
|
|
6020
|
+
* The vendor's id for the request.
|
|
6021
|
+
*/
|
|
6022
|
+
providerRequestId?: string;
|
|
6023
|
+
/**
|
|
6024
|
+
* HTTP attempts the call took, the client's retries included.
|
|
6025
|
+
*/
|
|
6026
|
+
attempts?: number;
|
|
6027
|
+
error?: ModelCallError;
|
|
6028
|
+
/**
|
|
6029
|
+
* The vendor's own usage object, exactly as it reported it. Only with `include=rawUsage`.
|
|
6030
|
+
*/
|
|
6031
|
+
rawUsage?: {
|
|
6032
|
+
provider: string;
|
|
6033
|
+
model: string;
|
|
6034
|
+
usage: Record<string, unknown>;
|
|
6035
|
+
};
|
|
6036
|
+
};
|
|
6037
|
+
export type CostTokenTotals = {
|
|
6038
|
+
prompt: number;
|
|
6039
|
+
completion: number;
|
|
6040
|
+
cacheRead: number;
|
|
6041
|
+
cacheWrite: number;
|
|
6042
|
+
reasoning: number;
|
|
5749
6043
|
};
|
|
5750
6044
|
export type CostRecordCollectionPage = {
|
|
5751
6045
|
data: Array<CostRecord>;
|
|
@@ -5759,11 +6053,13 @@ declare namespace Schemas {
|
|
|
5759
6053
|
key: Record<string, string | null>;
|
|
5760
6054
|
count: number;
|
|
5761
6055
|
totalUsd: number;
|
|
6056
|
+
tokens: CostTokenTotals;
|
|
5762
6057
|
};
|
|
5763
6058
|
export type CostAggregateResult = {
|
|
5764
6059
|
groups: Array<CostAggregateGroup>;
|
|
5765
6060
|
totalUsd: number;
|
|
5766
6061
|
totalRecords: number;
|
|
6062
|
+
tokens: CostTokenTotals;
|
|
5767
6063
|
timeRange: {
|
|
5768
6064
|
from: string;
|
|
5769
6065
|
to: string;
|
|
@@ -6082,7 +6378,7 @@ declare namespace Schemas {
|
|
|
6082
6378
|
metadata?: Record<string, unknown>;
|
|
6083
6379
|
};
|
|
6084
6380
|
/**
|
|
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
|
|
6381
|
+
* 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
6382
|
*/
|
|
6087
6383
|
export type WhoamiResult = {
|
|
6088
6384
|
tenantId: string;
|
|
@@ -6917,6 +7213,14 @@ declare namespace Schemas {
|
|
|
6917
7213
|
*/
|
|
6918
7214
|
unregistered: boolean;
|
|
6919
7215
|
};
|
|
7216
|
+
/**
|
|
7217
|
+
* 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.
|
|
7218
|
+
*/
|
|
7219
|
+
export type RunTreeUsage = {
|
|
7220
|
+
calls: number;
|
|
7221
|
+
costUsd: number;
|
|
7222
|
+
tokens: CostTokenTotals;
|
|
7223
|
+
};
|
|
6920
7224
|
/**
|
|
6921
7225
|
* A finished top-level run: its identity and outcome, never its input or output. Field names match `GET /v1/runs/{runId}`.
|
|
6922
7226
|
*/
|
|
@@ -6936,6 +7240,7 @@ declare namespace Schemas {
|
|
|
6936
7240
|
failureMessage: string | null;
|
|
6937
7241
|
createdAt: string;
|
|
6938
7242
|
completedAt: string;
|
|
7243
|
+
usage?: RunTreeUsage;
|
|
6939
7244
|
};
|
|
6940
7245
|
export type RunFinishedEvent = {
|
|
6941
7246
|
/**
|
|
@@ -6997,9 +7302,9 @@ export declare const RunProgress: z.ZodObject<{
|
|
|
6997
7302
|
flowVersion: z.ZodString;
|
|
6998
7303
|
status: z.ZodEnum<{
|
|
6999
7304
|
pending: "pending";
|
|
7305
|
+
failed: "failed";
|
|
7000
7306
|
running: "running";
|
|
7001
7307
|
completed: "completed";
|
|
7002
|
-
failed: "failed";
|
|
7003
7308
|
cancelled: "cancelled";
|
|
7004
7309
|
suspended: "suspended";
|
|
7005
7310
|
}>;
|
|
@@ -7444,9 +7749,9 @@ declare const ReinstateEvalSuiteVersionResult: z.ZodObject<{
|
|
|
7444
7749
|
export type EvalRunStatus = Schemas.EvalRunStatus;
|
|
7445
7750
|
declare const EvalRunStatus: z.ZodEnum<{
|
|
7446
7751
|
pending: "pending";
|
|
7752
|
+
failed: "failed";
|
|
7447
7753
|
running: "running";
|
|
7448
7754
|
completed: "completed";
|
|
7449
|
-
failed: "failed";
|
|
7450
7755
|
cancelled: "cancelled";
|
|
7451
7756
|
}>;
|
|
7452
7757
|
export type EvalRun = Schemas.EvalRun;
|
|
@@ -7473,9 +7778,9 @@ declare const EvalRun: z.ZodObject<{
|
|
|
7473
7778
|
}, z.core.$strict>>;
|
|
7474
7779
|
status: z.ZodEnum<{
|
|
7475
7780
|
pending: "pending";
|
|
7781
|
+
failed: "failed";
|
|
7476
7782
|
running: "running";
|
|
7477
7783
|
completed: "completed";
|
|
7478
|
-
failed: "failed";
|
|
7479
7784
|
cancelled: "cancelled";
|
|
7480
7785
|
}>;
|
|
7481
7786
|
dryRun: z.ZodBoolean;
|
|
@@ -7510,9 +7815,9 @@ declare const EvalRunCollectionPage: z.ZodObject<{
|
|
|
7510
7815
|
}, z.core.$strict>>;
|
|
7511
7816
|
status: z.ZodEnum<{
|
|
7512
7817
|
pending: "pending";
|
|
7818
|
+
failed: "failed";
|
|
7513
7819
|
running: "running";
|
|
7514
7820
|
completed: "completed";
|
|
7515
|
-
failed: "failed";
|
|
7516
7821
|
cancelled: "cancelled";
|
|
7517
7822
|
}>;
|
|
7518
7823
|
dryRun: z.ZodBoolean;
|
|
@@ -7848,9 +8153,9 @@ declare const ComplianceEvidence: z.ZodObject<{
|
|
|
7848
8153
|
outcome: z.ZodOptional<z.ZodEnum<{
|
|
7849
8154
|
succeeded: "succeeded";
|
|
7850
8155
|
escalated: "escalated";
|
|
8156
|
+
failed: "failed";
|
|
7851
8157
|
allowed: "allowed";
|
|
7852
8158
|
denied: "denied";
|
|
7853
|
-
failed: "failed";
|
|
7854
8159
|
}>>;
|
|
7855
8160
|
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
7856
8161
|
provenanceRef: z.ZodOptional<z.ZodObject<{
|
|
@@ -7892,9 +8197,9 @@ declare const ComplianceEvidenceCollectionPage: z.ZodObject<{
|
|
|
7892
8197
|
outcome: z.ZodOptional<z.ZodEnum<{
|
|
7893
8198
|
succeeded: "succeeded";
|
|
7894
8199
|
escalated: "escalated";
|
|
8200
|
+
failed: "failed";
|
|
7895
8201
|
allowed: "allowed";
|
|
7896
8202
|
denied: "denied";
|
|
7897
|
-
failed: "failed";
|
|
7898
8203
|
}>>;
|
|
7899
8204
|
payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
7900
8205
|
provenanceRef: z.ZodOptional<z.ZodObject<{
|
|
@@ -8486,14 +8791,25 @@ declare const RunFinishedEvent: z.ZodObject<{
|
|
|
8486
8791
|
flowId: z.ZodString;
|
|
8487
8792
|
flowVersion: z.ZodString;
|
|
8488
8793
|
status: z.ZodEnum<{
|
|
8489
|
-
completed: "completed";
|
|
8490
8794
|
failed: "failed";
|
|
8795
|
+
completed: "completed";
|
|
8491
8796
|
cancelled: "cancelled";
|
|
8492
8797
|
}>;
|
|
8493
8798
|
dryRun: z.ZodBoolean;
|
|
8494
8799
|
failureMessage: z.ZodNullable<z.ZodString>;
|
|
8495
8800
|
createdAt: z.ZodISODateTime;
|
|
8496
8801
|
completedAt: z.ZodISODateTime;
|
|
8802
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
8803
|
+
calls: z.ZodNumber;
|
|
8804
|
+
costUsd: z.ZodNumber;
|
|
8805
|
+
tokens: z.ZodObject<{
|
|
8806
|
+
prompt: z.ZodNumber;
|
|
8807
|
+
completion: z.ZodNumber;
|
|
8808
|
+
cacheRead: z.ZodNumber;
|
|
8809
|
+
cacheWrite: z.ZodNumber;
|
|
8810
|
+
reasoning: z.ZodNumber;
|
|
8811
|
+
}, z.core.$strict>;
|
|
8812
|
+
}, z.core.$strict>>;
|
|
8497
8813
|
}, z.core.$strict>;
|
|
8498
8814
|
}, z.core.$strict>;
|
|
8499
8815
|
}, z.core.$strict>;
|
|
@@ -8518,14 +8834,25 @@ declare const WebhookEvent: z.ZodDiscriminatedUnion<[
|
|
|
8518
8834
|
flowId: z.ZodString;
|
|
8519
8835
|
flowVersion: z.ZodString;
|
|
8520
8836
|
status: z.ZodEnum<{
|
|
8521
|
-
completed: "completed";
|
|
8522
8837
|
failed: "failed";
|
|
8838
|
+
completed: "completed";
|
|
8523
8839
|
cancelled: "cancelled";
|
|
8524
8840
|
}>;
|
|
8525
8841
|
dryRun: z.ZodBoolean;
|
|
8526
8842
|
failureMessage: z.ZodNullable<z.ZodString>;
|
|
8527
8843
|
createdAt: z.ZodISODateTime;
|
|
8528
8844
|
completedAt: z.ZodISODateTime;
|
|
8845
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
8846
|
+
calls: z.ZodNumber;
|
|
8847
|
+
costUsd: z.ZodNumber;
|
|
8848
|
+
tokens: z.ZodObject<{
|
|
8849
|
+
prompt: z.ZodNumber;
|
|
8850
|
+
completion: z.ZodNumber;
|
|
8851
|
+
cacheRead: z.ZodNumber;
|
|
8852
|
+
cacheWrite: z.ZodNumber;
|
|
8853
|
+
reasoning: z.ZodNumber;
|
|
8854
|
+
}, z.core.$strict>;
|
|
8855
|
+
}, z.core.$strict>>;
|
|
8529
8856
|
}, z.core.$strict>;
|
|
8530
8857
|
}, z.core.$strict>;
|
|
8531
8858
|
type: z.ZodLiteral<"run.finished">;
|
|
@@ -8560,14 +8887,25 @@ declare const WebhookDelivery: z.ZodObject<{
|
|
|
8560
8887
|
flowId: z.ZodString;
|
|
8561
8888
|
flowVersion: z.ZodString;
|
|
8562
8889
|
status: z.ZodEnum<{
|
|
8563
|
-
completed: "completed";
|
|
8564
8890
|
failed: "failed";
|
|
8891
|
+
completed: "completed";
|
|
8565
8892
|
cancelled: "cancelled";
|
|
8566
8893
|
}>;
|
|
8567
8894
|
dryRun: z.ZodBoolean;
|
|
8568
8895
|
failureMessage: z.ZodNullable<z.ZodString>;
|
|
8569
8896
|
createdAt: z.ZodISODateTime;
|
|
8570
8897
|
completedAt: z.ZodISODateTime;
|
|
8898
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
8899
|
+
calls: z.ZodNumber;
|
|
8900
|
+
costUsd: z.ZodNumber;
|
|
8901
|
+
tokens: z.ZodObject<{
|
|
8902
|
+
prompt: z.ZodNumber;
|
|
8903
|
+
completion: z.ZodNumber;
|
|
8904
|
+
cacheRead: z.ZodNumber;
|
|
8905
|
+
cacheWrite: z.ZodNumber;
|
|
8906
|
+
reasoning: z.ZodNumber;
|
|
8907
|
+
}, z.core.$strict>;
|
|
8908
|
+
}, z.core.$strict>>;
|
|
8571
8909
|
}, z.core.$strict>;
|
|
8572
8910
|
}, z.core.$strict>;
|
|
8573
8911
|
type: z.ZodLiteral<"run.finished">;
|
|
@@ -8610,14 +8948,25 @@ declare const WebhookDeliveryCollectionPage: z.ZodObject<{
|
|
|
8610
8948
|
flowId: z.ZodString;
|
|
8611
8949
|
flowVersion: z.ZodString;
|
|
8612
8950
|
status: z.ZodEnum<{
|
|
8613
|
-
completed: "completed";
|
|
8614
8951
|
failed: "failed";
|
|
8952
|
+
completed: "completed";
|
|
8615
8953
|
cancelled: "cancelled";
|
|
8616
8954
|
}>;
|
|
8617
8955
|
dryRun: z.ZodBoolean;
|
|
8618
8956
|
failureMessage: z.ZodNullable<z.ZodString>;
|
|
8619
8957
|
createdAt: z.ZodISODateTime;
|
|
8620
8958
|
completedAt: z.ZodISODateTime;
|
|
8959
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
8960
|
+
calls: z.ZodNumber;
|
|
8961
|
+
costUsd: z.ZodNumber;
|
|
8962
|
+
tokens: z.ZodObject<{
|
|
8963
|
+
prompt: z.ZodNumber;
|
|
8964
|
+
completion: z.ZodNumber;
|
|
8965
|
+
cacheRead: z.ZodNumber;
|
|
8966
|
+
cacheWrite: z.ZodNumber;
|
|
8967
|
+
reasoning: z.ZodNumber;
|
|
8968
|
+
}, z.core.$strict>;
|
|
8969
|
+
}, z.core.$strict>>;
|
|
8621
8970
|
}, z.core.$strict>;
|
|
8622
8971
|
}, z.core.$strict>;
|
|
8623
8972
|
type: z.ZodLiteral<"run.finished">;
|
|
@@ -8883,6 +9232,8 @@ export interface ApprovalFilter extends Omit<Filter<ApprovalStatus>, "status"> {
|
|
|
8883
9232
|
* passing several is rejected client-side with `invalid-request`.
|
|
8884
9233
|
*/
|
|
8885
9234
|
readonly status?: ApprovalStatus;
|
|
9235
|
+
/** Only one project's approvals (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
|
|
9236
|
+
readonly scope?: ScopeRef;
|
|
8886
9237
|
/** Filter by required reviewer role. Caller must have rank ≥ value (else 403). */
|
|
8887
9238
|
readonly requiredRole?: ReviewerRole$1;
|
|
8888
9239
|
/** ISO 8601 timestamp — return approvals created strictly after this. */
|
|
@@ -9311,6 +9662,8 @@ export interface ConversationFilter extends Omit<Filter<ConversationStatus>, "st
|
|
|
9311
9662
|
* passing several is rejected client-side with `invalid-request`.
|
|
9312
9663
|
*/
|
|
9313
9664
|
readonly status?: ConversationStatus;
|
|
9665
|
+
/** Only one project's conversations (`kind: 'project'`), or every project's in an org (`kind: 'org'`). */
|
|
9666
|
+
readonly scope?: ScopeRef;
|
|
9314
9667
|
readonly agent?: AgentId;
|
|
9315
9668
|
readonly participantId?: string;
|
|
9316
9669
|
}
|
|
@@ -9333,8 +9686,10 @@ export interface CostClient {
|
|
|
9333
9686
|
}
|
|
9334
9687
|
export interface UsageClient {
|
|
9335
9688
|
/**
|
|
9336
|
-
* Paginated raw cost records
|
|
9337
|
-
*
|
|
9689
|
+
* Paginated raw cost records: one per model call, with its model,
|
|
9690
|
+
* usage and what the vendor said about it. Filter by run (or a run
|
|
9691
|
+
* tree), scope, agent, conversation, category, provider, model and
|
|
9692
|
+
* time window.
|
|
9338
9693
|
*
|
|
9339
9694
|
* @wire `GET /v1/cost/records` — see
|
|
9340
9695
|
* `@kindgi/api/openapi.json#/paths/~1v1~1cost~1records/get`.
|
|
@@ -9346,26 +9701,25 @@ export interface UsageClient {
|
|
|
9346
9701
|
* @wire `GET /v1/cost/records/{recordId}` — see
|
|
9347
9702
|
* `@kindgi/api/openapi.json#/paths/~1v1~1cost~1records~1{recordId}/get`.
|
|
9348
9703
|
*/
|
|
9349
|
-
get(recordId: string
|
|
9704
|
+
get(recordId: string, options?: {
|
|
9705
|
+
readonly includeRawUsage?: boolean;
|
|
9706
|
+
}): Promise<CostRecord>;
|
|
9350
9707
|
/**
|
|
9351
|
-
* Grouped aggregate — totals in USD, bucketed by requested
|
|
9352
|
-
* over the time window. Cheaper than paginating raw records
|
|
9353
|
-
* dashboards.
|
|
9708
|
+
* Grouped aggregate — totals in USD and tokens, bucketed by requested
|
|
9709
|
+
* dimensions over the time window. Cheaper than paginating raw records
|
|
9710
|
+
* for dashboards. With `scope: { kind: 'org', orgId }`, one call sums
|
|
9711
|
+
* an org's spend across its projects.
|
|
9354
9712
|
*
|
|
9355
9713
|
* @wire `GET /v1/cost/aggregate` — see
|
|
9356
9714
|
* `@kindgi/api/openapi.json#/paths/~1v1~1cost~1aggregate/get`.
|
|
9357
9715
|
*/
|
|
9358
9716
|
summary(input: UsageSummaryInput): Promise<CostAggregateResult>;
|
|
9359
9717
|
}
|
|
9360
|
-
export interface UsageSummaryInput {
|
|
9718
|
+
export interface UsageSummaryInput extends Omit<CostRecordFilter, "from" | "to" | "limit" | "cursor" | "includeRawUsage"> {
|
|
9361
9719
|
readonly from: Timestamp;
|
|
9720
|
+
/** Exclusive. */
|
|
9362
9721
|
readonly to: Timestamp;
|
|
9363
9722
|
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
9723
|
}
|
|
9370
9724
|
export interface BudgetsClient {
|
|
9371
9725
|
/**
|
|
@@ -9459,19 +9813,19 @@ export interface EnvClient {
|
|
|
9459
9813
|
delete(input: EnvDeleteInput): Promise<EnvDeleteOutcome>;
|
|
9460
9814
|
}
|
|
9461
9815
|
export interface EnvListInput {
|
|
9462
|
-
readonly scope:
|
|
9816
|
+
readonly scope: ScopeRef;
|
|
9463
9817
|
readonly envName: EnvName;
|
|
9464
9818
|
readonly cursor?: Cursor;
|
|
9465
9819
|
readonly namePrefix?: string;
|
|
9466
9820
|
readonly limit?: number;
|
|
9467
9821
|
}
|
|
9468
9822
|
export interface EnvGetInput {
|
|
9469
|
-
readonly scope:
|
|
9823
|
+
readonly scope: ScopeRef;
|
|
9470
9824
|
readonly envName: EnvName;
|
|
9471
9825
|
readonly name: string;
|
|
9472
9826
|
}
|
|
9473
9827
|
export interface EnvSetInput {
|
|
9474
|
-
readonly scope:
|
|
9828
|
+
readonly scope: ScopeRef;
|
|
9475
9829
|
readonly envName: EnvName;
|
|
9476
9830
|
readonly name: string;
|
|
9477
9831
|
readonly value: string;
|
|
@@ -9479,12 +9833,12 @@ export interface EnvSetInput {
|
|
|
9479
9833
|
readonly tags?: Readonly<Record<string, string>>;
|
|
9480
9834
|
}
|
|
9481
9835
|
export interface EnvDeleteInput {
|
|
9482
|
-
readonly scope:
|
|
9836
|
+
readonly scope: ScopeRef;
|
|
9483
9837
|
readonly envName: EnvName;
|
|
9484
9838
|
readonly name: string;
|
|
9485
9839
|
}
|
|
9486
9840
|
export interface EnvRecord {
|
|
9487
|
-
readonly scope:
|
|
9841
|
+
readonly scope: ScopeRef;
|
|
9488
9842
|
readonly envName: EnvName;
|
|
9489
9843
|
readonly name: string;
|
|
9490
9844
|
readonly value: string;
|
|
@@ -10742,10 +11096,14 @@ export interface RunJournalPage {
|
|
|
10742
11096
|
export interface ListRunsFilter {
|
|
10743
11097
|
readonly limit?: number;
|
|
10744
11098
|
readonly cursor?: string;
|
|
11099
|
+
/** Only one project's runs (`kind: 'project'`), or the runs of every project in an org (`kind: 'org'`). */
|
|
11100
|
+
readonly scope?: ScopeRef;
|
|
10745
11101
|
/** Only the child runs of this run. */
|
|
10746
11102
|
readonly parentRunId?: RunId;
|
|
10747
11103
|
/** Only runs that are not a child of another run. */
|
|
10748
11104
|
readonly topLevel?: boolean;
|
|
11105
|
+
/** Only this agent's turns, at any version (turns from before 0.1.3 don't name their agent). */
|
|
11106
|
+
readonly agentId?: AgentId | string;
|
|
10749
11107
|
/** Include each run's `output` (omitted from lists by default). */
|
|
10750
11108
|
readonly includeOutput?: boolean;
|
|
10751
11109
|
}
|
|
@@ -10792,11 +11150,20 @@ export interface ResumeRunInput {
|
|
|
10792
11150
|
readonly value?: unknown;
|
|
10793
11151
|
readonly idempotencyKey?: string;
|
|
10794
11152
|
}
|
|
11153
|
+
/**
|
|
11154
|
+
* The agent a run is a turn of (`@kindgi/api/openapi.json#RunAgent`):
|
|
11155
|
+
* which agent, the version that ran, and the conversation.
|
|
11156
|
+
*/
|
|
11157
|
+
export interface RunAgent {
|
|
11158
|
+
readonly id: string;
|
|
11159
|
+
readonly version: string;
|
|
11160
|
+
readonly conversationId: string;
|
|
11161
|
+
}
|
|
10795
11162
|
/**
|
|
10796
11163
|
* Wire shape — matches `@kindgi/api/openapi.json#Run`. Runs are
|
|
10797
11164
|
* 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
|
-
*
|
|
11165
|
+
* server, and the row reports that flow's `flowId` / `flowVersion`;
|
|
11166
|
+
* `agent` names the agent.
|
|
10800
11167
|
*/
|
|
10801
11168
|
export interface Run {
|
|
10802
11169
|
readonly id: RunId;
|
|
@@ -10816,6 +11183,11 @@ export interface Run {
|
|
|
10816
11183
|
readonly parentRunId?: RunId;
|
|
10817
11184
|
/** Set on a child run: the node in the parent run that started it. */
|
|
10818
11185
|
readonly parentNodeId?: string;
|
|
11186
|
+
/**
|
|
11187
|
+
* Set on an agent's turn (an agent run, or the turn a flow's agent step
|
|
11188
|
+
* started). Absent on other runs, and on turns from before 0.1.3.
|
|
11189
|
+
*/
|
|
11190
|
+
readonly agent?: RunAgent;
|
|
10819
11191
|
}
|
|
10820
11192
|
/**
|
|
10821
11193
|
* What `runs.start` returns: the run, plus a public run token when the
|
|
@@ -10957,14 +11329,14 @@ export interface SecretRotationsClient {
|
|
|
10957
11329
|
}): AsyncIterable<unknown>;
|
|
10958
11330
|
}
|
|
10959
11331
|
export interface SecretRotationGetInput {
|
|
10960
|
-
readonly scope:
|
|
11332
|
+
readonly scope: ScopeRef;
|
|
10961
11333
|
readonly envName: EnvName;
|
|
10962
11334
|
readonly name: string;
|
|
10963
11335
|
readonly rotationId: string;
|
|
10964
11336
|
}
|
|
10965
11337
|
export type SecretRotationEventsInput = SecretRotationGetInput;
|
|
10966
11338
|
export interface SecretListInput {
|
|
10967
|
-
readonly scope:
|
|
11339
|
+
readonly scope: ScopeRef;
|
|
10968
11340
|
readonly envName: EnvName;
|
|
10969
11341
|
readonly cursor?: Cursor;
|
|
10970
11342
|
readonly namePrefix?: string;
|
|
@@ -10972,25 +11344,25 @@ export interface SecretListInput {
|
|
|
10972
11344
|
readonly limit?: number;
|
|
10973
11345
|
}
|
|
10974
11346
|
export interface SecretGetInput {
|
|
10975
|
-
readonly scope:
|
|
11347
|
+
readonly scope: ScopeRef;
|
|
10976
11348
|
readonly envName: EnvName;
|
|
10977
11349
|
readonly name: string;
|
|
10978
11350
|
}
|
|
10979
11351
|
export interface SecretGetVersionInput {
|
|
10980
|
-
readonly scope:
|
|
11352
|
+
readonly scope: ScopeRef;
|
|
10981
11353
|
readonly envName: EnvName;
|
|
10982
11354
|
readonly name: string;
|
|
10983
11355
|
readonly versionId: number;
|
|
10984
11356
|
}
|
|
10985
11357
|
export interface SecretListVersionsInput {
|
|
10986
|
-
readonly scope:
|
|
11358
|
+
readonly scope: ScopeRef;
|
|
10987
11359
|
readonly envName: EnvName;
|
|
10988
11360
|
readonly name: string;
|
|
10989
11361
|
readonly cursor?: Cursor;
|
|
10990
11362
|
readonly limit?: number;
|
|
10991
11363
|
}
|
|
10992
11364
|
export interface SecretSetInput {
|
|
10993
|
-
readonly scope:
|
|
11365
|
+
readonly scope: ScopeRef;
|
|
10994
11366
|
readonly envName: EnvName;
|
|
10995
11367
|
readonly name: string;
|
|
10996
11368
|
readonly value: string;
|
|
@@ -11001,7 +11373,7 @@ export interface SecretSetInput {
|
|
|
11001
11373
|
readonly idempotencyKey?: string;
|
|
11002
11374
|
}
|
|
11003
11375
|
export interface SecretRotateInput {
|
|
11004
|
-
readonly scope:
|
|
11376
|
+
readonly scope: ScopeRef;
|
|
11005
11377
|
readonly envName: EnvName;
|
|
11006
11378
|
readonly name: string;
|
|
11007
11379
|
readonly newValue?: string;
|
|
@@ -11032,14 +11404,14 @@ export interface PollingOverrides {
|
|
|
11032
11404
|
readonly sleep?: (ms: number) => Promise<void>;
|
|
11033
11405
|
}
|
|
11034
11406
|
export interface SecretRevokeInput {
|
|
11035
|
-
readonly scope:
|
|
11407
|
+
readonly scope: ScopeRef;
|
|
11036
11408
|
readonly envName: EnvName;
|
|
11037
11409
|
readonly name: string;
|
|
11038
11410
|
readonly hard?: boolean;
|
|
11039
11411
|
readonly reason?: string;
|
|
11040
11412
|
}
|
|
11041
11413
|
export interface SecretRecord {
|
|
11042
|
-
readonly scope:
|
|
11414
|
+
readonly scope: ScopeRef;
|
|
11043
11415
|
readonly envName: EnvName;
|
|
11044
11416
|
readonly name: string;
|
|
11045
11417
|
readonly currentVersion: number;
|
|
@@ -11051,7 +11423,7 @@ export interface SecretRecord {
|
|
|
11051
11423
|
readonly rotationDueAt?: string;
|
|
11052
11424
|
}
|
|
11053
11425
|
export interface SecretVersionRecord {
|
|
11054
|
-
readonly scope:
|
|
11426
|
+
readonly scope: ScopeRef;
|
|
11055
11427
|
readonly envName: EnvName;
|
|
11056
11428
|
readonly name: string;
|
|
11057
11429
|
readonly versionId: number;
|