@loomcycle/client 1.121.0 → 1.123.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/README.md +50 -2
- package/dist/cjs/client.js +184 -2
- package/dist/cjs/errors.js +29 -1
- package/dist/cjs/fetch-helpers.js +49 -0
- package/dist/cjs/index.js +14 -2
- package/dist/client.d.ts +173 -3
- package/dist/client.js +184 -2
- package/dist/errors.d.ts +29 -0
- package/dist/errors.js +27 -0
- package/dist/fetch-helpers.d.ts +2 -0
- package/dist/fetch-helpers.js +50 -1
- package/dist/index.d.ts +14 -3
- package/dist/index.js +13 -2
- package/dist/types.d.ts +708 -6
- package/package.json +1 -1
package/dist/types.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* `client.ts` for the input shapes (RunOptions, CreateSnapshotOptions,
|
|
8
8
|
* etc.) — those are translated to snake_case in the request body.
|
|
9
9
|
*/
|
|
10
|
-
export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "awaiting_review" | "subagent_hold" | "awaiting_children" | "children_note" | "steer" | "context_compaction" | "capability_inert" | "hook_decision" | "limit" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "team_decision" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "spawn_child_read" | "prompt_snapshot" | "queued" | "admitted" | "call_queued" | "call_admitted" | "_meta";
|
|
10
|
+
export type EventType = "started" | "text" | "tool_call" | "tool_result" | "usage" | "done" | "error" | "retry" | "host_widened" | "session" | "agent" | "awaiting_input" | "awaiting_review" | "subagent_hold" | "awaiting_children" | "children_note" | "steer" | "context_compaction" | "capability_inert" | "hook_decision" | "limit" | "file_captured" | "transcription" | "override" | "context_recap" | "context_state" | "context_distill_declined" | "context_exhausted" | "thinking" | "team_decision" | "turn_cancelled" | "provider_fallback" | "fallback_suppressed" | "model_downgraded" | "cache_invalidated" | "reasoning_invalidated" | "channel_publish" | "channel_delivery" | "interruption_pending" | "spawn_child_started" | "spawn_child_result" | "spawn_child_read" | "prompt_snapshot" | "queued" | "admitted" | "call_queued" | "call_admitted" | "_meta";
|
|
11
11
|
export interface ToolUse {
|
|
12
12
|
id: string;
|
|
13
13
|
name: string;
|
|
@@ -445,6 +445,60 @@ export interface AdmissionInfo {
|
|
|
445
445
|
/** On `call_queued` / `call_admitted`: the call lane's model kind (`"chat"`). */
|
|
446
446
|
kind?: string;
|
|
447
447
|
}
|
|
448
|
+
/** Payload on `event: file_captured`: a file a tool returned, as the runtime
|
|
449
|
+
* kept it in the run's inbox volume. Never the bytes, never a URL's query. */
|
|
450
|
+
export interface FileCapturedInfo {
|
|
451
|
+
/** The file's reference, `volume:inbox:<dir>/<name>`. */
|
|
452
|
+
ref: string;
|
|
453
|
+
media_type: string;
|
|
454
|
+
/** Length in bytes. */
|
|
455
|
+
size: number;
|
|
456
|
+
/** Hex SHA-256 of the bytes. */
|
|
457
|
+
sha256: string;
|
|
458
|
+
/** Which producer returned it: `mcp:<server>/<tool>`, `http`, `webfetch` or
|
|
459
|
+
* `download:<host>`. */
|
|
460
|
+
origin: string;
|
|
461
|
+
/** The run whose tool call returned it (a sub-agent's capture is reported
|
|
462
|
+
* on the tree's stream). */
|
|
463
|
+
run_id?: string;
|
|
464
|
+
}
|
|
465
|
+
/** Payload on `event: transcription`: one OCR or speech-to-text pass a File
|
|
466
|
+
* tool call made over an inbox file. Never the transcribed text. */
|
|
467
|
+
export interface TranscriptionInfo {
|
|
468
|
+
/** The source file, `volume:inbox:<dir>/<name>`. */
|
|
469
|
+
ref: string;
|
|
470
|
+
/** The Markdown the pass wrote, when it wrote one. */
|
|
471
|
+
out?: string;
|
|
472
|
+
/** `"ocr"` or `"stt"`. */
|
|
473
|
+
purpose: string;
|
|
474
|
+
/** The configured engine that ran: `"vision"`, `"openai-audio"`,
|
|
475
|
+
* `"command"`, …. */
|
|
476
|
+
engine: string;
|
|
477
|
+
/** The concrete provider/model pair the engine called, when it called one. */
|
|
478
|
+
provider?: string;
|
|
479
|
+
model?: string;
|
|
480
|
+
/** Pages sent to an OCR engine. */
|
|
481
|
+
pages?: number;
|
|
482
|
+
/** Audio duration sent to a speech-to-text engine, in seconds. */
|
|
483
|
+
seconds?: number;
|
|
484
|
+
input_tokens?: number;
|
|
485
|
+
output_tokens?: number;
|
|
486
|
+
/** The priced cost in `currency`. Absent when the pair is unpriced, which is
|
|
487
|
+
* not the same as free. */
|
|
488
|
+
cost?: number;
|
|
489
|
+
currency?: string;
|
|
490
|
+
/** `"ok"`, `"partial"` (a cap or an engine error stopped it after some
|
|
491
|
+
* units; what was written stays) or `"failed"`. */
|
|
492
|
+
status: string;
|
|
493
|
+
/** An estimate: no engine was called and nothing was spent. */
|
|
494
|
+
dry_run?: boolean;
|
|
495
|
+
/** The run whose tool call made the pass. */
|
|
496
|
+
run_id?: string;
|
|
497
|
+
/** Why the pass failed or stopped early (set on `"failed"`, and on
|
|
498
|
+
* `"partial"` when a cap or an engine error stopped it). Never a secret, a
|
|
499
|
+
* URL's query or the file's content. */
|
|
500
|
+
error?: string;
|
|
501
|
+
}
|
|
448
502
|
export interface LimitInfo {
|
|
449
503
|
/** Which axis tripped: "operator" | "tenant" | "user". */
|
|
450
504
|
scope: string;
|
|
@@ -685,6 +739,12 @@ export interface AgentEvent {
|
|
|
685
739
|
/** Payload on `event: limit` (RFC AW) — a per-scope token-budget crossing.
|
|
686
740
|
* Nil on all other event types. */
|
|
687
741
|
limit?: LimitInfo;
|
|
742
|
+
/** Payload on `event: file_captured` — a file a tool returned, kept in the
|
|
743
|
+
* run's inbox. Nil on all other event types. */
|
|
744
|
+
file?: FileCapturedInfo;
|
|
745
|
+
/** Payload on `event: transcription` — one OCR or speech-to-text pass a
|
|
746
|
+
* File tool call made. Nil on all other event types. */
|
|
747
|
+
transcription?: TranscriptionInfo;
|
|
688
748
|
/** Payload on `event: queued` (why the run waits, and its place) and
|
|
689
749
|
* `event: admitted` (how long it waited), and on `event: call_queued` /
|
|
690
750
|
* `event: call_admitted` (the same for one model call, with its provider
|
|
@@ -1499,6 +1559,15 @@ export interface RunSpec {
|
|
|
1499
1559
|
* own `crypto_scopes` were narrowed to, and are narrowed to again on
|
|
1500
1560
|
* resume. Absent: the parent held none. */
|
|
1501
1561
|
crypto_scopes?: string[];
|
|
1562
|
+
/** The parent run's shell-credential narrowing at spawn (RFC EW): the
|
|
1563
|
+
* names the child's own `shell_credentials` were narrowed to, and are
|
|
1564
|
+
* narrowed to again on resume. Absent: the parent narrowed nothing. `[]`:
|
|
1565
|
+
* the parent allowed none. */
|
|
1566
|
+
shell_credentials?: string[];
|
|
1567
|
+
/** The parent run's Git network grant at spawn (RFC FB): the operations
|
|
1568
|
+
* the child's own `git_remote` was narrowed to, and is narrowed to again
|
|
1569
|
+
* on resume. Absent: the parent had none. */
|
|
1570
|
+
git_remote?: Array<'fetch' | 'push'>;
|
|
1502
1571
|
/** The override offer the child passes on to its own children: its
|
|
1503
1572
|
* parent's, unchanged, so a resume offers what the live child did. Only
|
|
1504
1573
|
* a child of the offering run's definition (`def_id`, else `agent_name`)
|
|
@@ -1801,6 +1870,22 @@ export interface ErasureResidue {
|
|
|
1801
1870
|
sessions_examined: number;
|
|
1802
1871
|
truncated: boolean;
|
|
1803
1872
|
}
|
|
1873
|
+
/** One bearer token an erasure names: its def id and name, never the bearer. */
|
|
1874
|
+
export interface ErasureTokenRef {
|
|
1875
|
+
def_id: string;
|
|
1876
|
+
name: string;
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* What an erasure removes from the subject's authority — in a report or a dry
|
|
1880
|
+
* run, what it would: the groups the subject leaves, the lists its bindings
|
|
1881
|
+
* (and its tokens' bindings) named, and the member tokens revoked.
|
|
1882
|
+
* Config-declared rows are not listed; the store cannot remove them.
|
|
1883
|
+
*/
|
|
1884
|
+
export interface ErasureAccess {
|
|
1885
|
+
groups: string[];
|
|
1886
|
+
lists: string[];
|
|
1887
|
+
tokens: ErasureTokenRef[];
|
|
1888
|
+
}
|
|
1804
1889
|
/** Result of {@link LoomcycleClient.erasureReport} (RFC BL P5). */
|
|
1805
1890
|
export interface ErasureReport {
|
|
1806
1891
|
tenant: string;
|
|
@@ -1808,6 +1893,7 @@ export interface ErasureReport {
|
|
|
1808
1893
|
tier1_covered: ErasureTier;
|
|
1809
1894
|
tier2_uncovered: ErasureTier;
|
|
1810
1895
|
tier3_residue: ErasureResidue;
|
|
1896
|
+
access: ErasureAccess;
|
|
1811
1897
|
notes: string[];
|
|
1812
1898
|
/** Planes that could not be READ. Non-empty means every count is a lower bound. */
|
|
1813
1899
|
errors?: string[];
|
|
@@ -1821,6 +1907,8 @@ export interface ErasureResult {
|
|
|
1821
1907
|
/** Plane -> why it was kept. Never empty. */
|
|
1822
1908
|
retained: Record<string, string>;
|
|
1823
1909
|
residue: ErasureResidue;
|
|
1910
|
+
/** The groups, lists and member tokens removed (or, in a dry run, that would be). */
|
|
1911
|
+
access: ErasureAccess;
|
|
1824
1912
|
errors?: string[];
|
|
1825
1913
|
notes: string[];
|
|
1826
1914
|
}
|
|
@@ -2059,6 +2147,43 @@ export interface WhoamiResponse {
|
|
|
2059
2147
|
is_admin: boolean;
|
|
2060
2148
|
legacy: boolean;
|
|
2061
2149
|
open_mode?: boolean;
|
|
2150
|
+
/** The deployment's access-control rollout mode: `compat`, `shadow` or
|
|
2151
|
+
* `enforce`. Absent on a server that predates access-control lists. */
|
|
2152
|
+
acl_mode?: AclMode;
|
|
2153
|
+
/** The caller's groups, transitive. Absent when none were resolved. */
|
|
2154
|
+
groups?: string[];
|
|
2155
|
+
/** The version of the caller's compiled access-control set. Absent in open
|
|
2156
|
+
* mode and when the set could not be resolved. */
|
|
2157
|
+
acl_version?: number;
|
|
2158
|
+
/** What the caller may reach, as the server's own gates would answer it.
|
|
2159
|
+
* Absent on a server that predates the summary. */
|
|
2160
|
+
effective?: WhoamiEffective;
|
|
2161
|
+
/** How the caller signed in. Absent on a server that predates Web UI
|
|
2162
|
+
* sessions. */
|
|
2163
|
+
auth?: WhoamiAuth;
|
|
2164
|
+
}
|
|
2165
|
+
/** GET /v1/_me's sign-in block. `mode` is always present; the rest only when
|
|
2166
|
+
* a Web UI session (not a bearer) authenticated the request. */
|
|
2167
|
+
export interface WhoamiAuth {
|
|
2168
|
+
/** `open` (no credential configured), `token` or `strict`. */
|
|
2169
|
+
mode: "open" | "token" | "strict";
|
|
2170
|
+
/** The configured gate the session was created through. */
|
|
2171
|
+
gate?: string;
|
|
2172
|
+
/** The authentication methods the gate used, e.g. `["bearer"]`. */
|
|
2173
|
+
amr?: string[];
|
|
2174
|
+
/** When the session's login happened (RFC 3339). */
|
|
2175
|
+
auth_time?: string;
|
|
2176
|
+
/** When the session stops authenticating unless renewed by activity. */
|
|
2177
|
+
session_expires_at?: string;
|
|
2178
|
+
}
|
|
2179
|
+
/** GET /v1/_me's capability summary. Bounded and non-secret: a fixed list of
|
|
2180
|
+
* Web UI pages, no per-instance data. */
|
|
2181
|
+
export interface WhoamiEffective {
|
|
2182
|
+
/** Per Web UI page id (`run`, `runs`, `channels`, `access`, `users`, …),
|
|
2183
|
+
* whether a request to the route the page loads first would pass the
|
|
2184
|
+
* route's scope gate and its access-control question in the current mode.
|
|
2185
|
+
* Every page is true in open mode. */
|
|
2186
|
+
surfaces: Record<string, boolean>;
|
|
2062
2187
|
}
|
|
2063
2188
|
export type RuntimeStateStatus = "running" | "pausing" | "paused";
|
|
2064
2189
|
/** A timed override of an agent's no-trace mode: until `until`, runs of
|
|
@@ -2259,6 +2384,49 @@ export interface MemorySearchInput {
|
|
|
2259
2384
|
* while `"require"` is a real filter. A tight `"require"` window is how a
|
|
2260
2385
|
* scope that holds the answer comes back empty. */
|
|
2261
2386
|
when?: MemoryWhen;
|
|
2387
|
+
/** Aim the search at part of the scope's documents: return only the chunks of
|
|
2388
|
+
* documents named at or under ANY of these Path-tree paths, in the scope's own
|
|
2389
|
+
* tree (sent as `under_paths`). Narrows DOCUMENT chunks only — facts and notes
|
|
2390
|
+
* the same search returns pass untouched — and is applied before ranking.
|
|
2391
|
+
*
|
|
2392
|
+
* The four document filters need a search that can return documents (no
|
|
2393
|
+
* `sources`, or `sources` including `"documents"`; otherwise 400
|
|
2394
|
+
* `invalid_filter`), are refused on `scope: "tenant"` (400 `invalid_filter`),
|
|
2395
|
+
* and need SQL Memory on the server (400 `filter_unavailable`). They resolve in
|
|
2396
|
+
* the caller's own tenant. The response then carries {@link
|
|
2397
|
+
* MemorySearchResponse.filter}. For chunk-level filters (type, status, tags, a
|
|
2398
|
+
* validity instant) use `document({ op: "search" })`. */
|
|
2399
|
+
underPaths?: string[];
|
|
2400
|
+
/** Never return the chunks of documents named at or under these paths (sent as
|
|
2401
|
+
* `exclude_under_paths`). Documents only, as {@link underPaths}. */
|
|
2402
|
+
excludeUnderPaths?: string[];
|
|
2403
|
+
/** Return only the chunks of these documents (sent as `document_ids`).
|
|
2404
|
+
* Documents only, as {@link underPaths}. */
|
|
2405
|
+
documentIds?: string[];
|
|
2406
|
+
/** Never return the chunks of these documents (sent as
|
|
2407
|
+
* `exclude_document_ids`). Documents only, as {@link underPaths}. */
|
|
2408
|
+
excludeDocumentIds?: string[];
|
|
2409
|
+
}
|
|
2410
|
+
/** What a document filter on {@link LoomcycleClient.memorySearch} resolved to —
|
|
2411
|
+
* present on the response ONLY when a filter was sent. */
|
|
2412
|
+
export interface MemorySearchDocumentFilter {
|
|
2413
|
+
/** The filter as applied: paths canonicalised, blanks and duplicates dropped.
|
|
2414
|
+
* Only the kinds that were sent appear. */
|
|
2415
|
+
applied: {
|
|
2416
|
+
under_paths?: string[];
|
|
2417
|
+
exclude_under_paths?: string[];
|
|
2418
|
+
document_ids?: string[];
|
|
2419
|
+
exclude_document_ids?: string[];
|
|
2420
|
+
};
|
|
2421
|
+
/** Documents with at least one matching chunk. 0 means the paths/ids name no
|
|
2422
|
+
* document in this scope — not that nothing relevant was found. */
|
|
2423
|
+
matched_documents: number;
|
|
2424
|
+
/** Chunks the filter let through. */
|
|
2425
|
+
matched_chunks: number;
|
|
2426
|
+
/** True when the match was sent as "everything except" its complement. Always
|
|
2427
|
+
* false while access-control rules can deny the caller reading part of the
|
|
2428
|
+
* scope — the counts then cover only documents it may read. */
|
|
2429
|
+
inverted: boolean;
|
|
2262
2430
|
}
|
|
2263
2431
|
/** The observed-time predicate on {@link MemorySearchInput}. Timestamps are
|
|
2264
2432
|
* RFC3339 instants — resolve phrases like "the first weekend of October"
|
|
@@ -2347,6 +2515,9 @@ export interface MemorySearchResponse {
|
|
|
2347
2515
|
* those call for very different responses. Counts describe the candidate pool
|
|
2348
2516
|
* the ranker saw, not a scope-wide census. */
|
|
2349
2517
|
time_filter?: MemoryTimeFilter;
|
|
2518
|
+
/** What the document filter resolved to — present only when one was sent
|
|
2519
|
+
* ({@link MemorySearchInput.underPaths} and its siblings). */
|
|
2520
|
+
filter?: MemorySearchDocumentFilter;
|
|
2350
2521
|
}
|
|
2351
2522
|
export interface MemoryTimeFilter {
|
|
2352
2523
|
mode: "prefer" | "require";
|
|
@@ -3032,8 +3203,50 @@ export type DocumentToolInput = {
|
|
|
3032
3203
|
from_id?: string;
|
|
3033
3204
|
to_id?: string;
|
|
3034
3205
|
kind?: string;
|
|
3035
|
-
/** query_chunks
|
|
3206
|
+
/** query_chunks / query_documents / documents_summary: restrict to documents
|
|
3207
|
+
* at/under this Path-tree path. search / related: return only chunks of
|
|
3208
|
+
* documents named at or under it — applied inside every retrieval leg before
|
|
3209
|
+
* its limit, so the best matches come from that part of the tree. */
|
|
3036
3210
|
under_path?: string;
|
|
3211
|
+
/** search / related: chunks of documents named at or under ANY of these paths
|
|
3212
|
+
* (with `under_path`, the union of both). */
|
|
3213
|
+
under_paths?: string[];
|
|
3214
|
+
/** search / related: never chunks of documents named at or under this path. */
|
|
3215
|
+
exclude_under_path?: string;
|
|
3216
|
+
/** search / related: never chunks of documents named at or under these paths. */
|
|
3217
|
+
exclude_under_paths?: string[];
|
|
3218
|
+
/** documents_summary: the documents to summarize. search / related: return
|
|
3219
|
+
* only chunks of these documents. */
|
|
3220
|
+
document_ids?: string[];
|
|
3221
|
+
/** search / related: never chunks of these documents (e.g. the document under
|
|
3222
|
+
* review, so its own text is not found as evidence for itself). */
|
|
3223
|
+
exclude_document_ids?: string[];
|
|
3224
|
+
/** search / related: chunk types, each including its ontology subtypes (with
|
|
3225
|
+
* `type`, the union of both). */
|
|
3226
|
+
types?: string[];
|
|
3227
|
+
/** search / related: exact chunk statuses; any matches (with `status`, the union). */
|
|
3228
|
+
statuses?: string[];
|
|
3229
|
+
/** graph_recall / list_facts: answer as of this instant (unix nanoseconds).
|
|
3230
|
+
* search / related / query_chunks: only chunks whose stated validity (the
|
|
3231
|
+
* chunk's own valid_at/invalid_at and, for a fact, its fact dates) contains
|
|
3232
|
+
* it; a chunk with no stated validity always matches. */
|
|
3233
|
+
as_of?: number;
|
|
3234
|
+
/** graph_recall: how much of each chunk's text the rows carry. Omitted: chunks
|
|
3235
|
+
* that are not facts carry the first 600 characters of their body (a fact's
|
|
3236
|
+
* title is its claim, so facts stay title-only). `0`: titles only — the
|
|
3237
|
+
* cheapest structural walk, the response shape from before bodies existed.
|
|
3238
|
+
* `N` (at most 4000): up to N characters on every row, facts included. A cut
|
|
3239
|
+
* body ends on a word and the row says `body_truncated: true`; `budget_chars`
|
|
3240
|
+
* counts body characters too. */
|
|
3241
|
+
body_chars?: number;
|
|
3242
|
+
/** When the content became true in the world (unix nanoseconds).
|
|
3243
|
+
* upsert_chunk: the fact's start. create_chunk / update_chunk: the chunk's
|
|
3244
|
+
* own start (an edition coming into force); update_chunk with `null` clears
|
|
3245
|
+
* it. Omit when unknown. */
|
|
3246
|
+
valid_at?: number | null;
|
|
3247
|
+
/** When the content stopped being true (unix nanoseconds, exclusive; after
|
|
3248
|
+
* valid_at). Same ops as {@link valid_at}; `null` clears on update_chunk. */
|
|
3249
|
+
invalid_at?: number | null;
|
|
3037
3250
|
/** query_chunks: raw read-only SELECT (escape hatch; validator-gated). */
|
|
3038
3251
|
sql?: string;
|
|
3039
3252
|
/** Row/response bound. On `documents_summary` it defaults to 500 (max 5000) and
|
|
@@ -3107,6 +3320,74 @@ export type DocumentToolInput = {
|
|
|
3107
3320
|
* `create_document` returns `{document_id, root_chunk_id, ...}`). */
|
|
3108
3321
|
export type PathToolResponse = unknown;
|
|
3109
3322
|
export type DocumentToolResponse = unknown;
|
|
3323
|
+
/** What a filtered `document({op:"search"|"related", …})` call resolved its
|
|
3324
|
+
* structural filter to — present on the response ONLY when a filter argument
|
|
3325
|
+
* was passed (a filter-free response has no `filter` key). */
|
|
3326
|
+
export type DocumentSearchFilter = {
|
|
3327
|
+
/** The filter as applied: singular fields folded into the plural ones, paths
|
|
3328
|
+
* canonicalised. Only the kinds that were passed appear. */
|
|
3329
|
+
applied: {
|
|
3330
|
+
under_paths?: string[];
|
|
3331
|
+
exclude_under_paths?: string[];
|
|
3332
|
+
document_ids?: string[];
|
|
3333
|
+
exclude_document_ids?: string[];
|
|
3334
|
+
types?: string[];
|
|
3335
|
+
statuses?: string[];
|
|
3336
|
+
tag?: string;
|
|
3337
|
+
tag_prefix?: string;
|
|
3338
|
+
as_of?: number;
|
|
3339
|
+
};
|
|
3340
|
+
/** Documents with at least one matching chunk. */
|
|
3341
|
+
matched_documents: number;
|
|
3342
|
+
/** Chunks the search could return. 0 = the filter matched nothing (the
|
|
3343
|
+
* response then has no hits and the query was never embedded). */
|
|
3344
|
+
matched_chunks: number;
|
|
3345
|
+
/** Present when a type was widened to its ontology subtypes. */
|
|
3346
|
+
type_expanded_to?: string[];
|
|
3347
|
+
/** True when the match was sent to the search as "everything except" its
|
|
3348
|
+
* complement (the smaller list). Always false while access-control rules can
|
|
3349
|
+
* deny the caller reading part of the scope — the counts above then cover
|
|
3350
|
+
* only documents it may read. */
|
|
3351
|
+
inverted: boolean;
|
|
3352
|
+
};
|
|
3353
|
+
/** One hit of `document({op:"search"})`. */
|
|
3354
|
+
export type DocumentSearchHit = {
|
|
3355
|
+
chunk_id: string;
|
|
3356
|
+
score: number;
|
|
3357
|
+
rank_score: number;
|
|
3358
|
+
title?: string;
|
|
3359
|
+
type?: string;
|
|
3360
|
+
document_id?: string;
|
|
3361
|
+
/** The chunk's own validity period, present only when set. */
|
|
3362
|
+
valid_at?: number;
|
|
3363
|
+
invalid_at?: number;
|
|
3364
|
+
matched_unit?: {
|
|
3365
|
+
kind: string;
|
|
3366
|
+
text: string;
|
|
3367
|
+
};
|
|
3368
|
+
};
|
|
3369
|
+
/** Response of `document({op:"search"})` — narrow a {@link DocumentToolResponse}
|
|
3370
|
+
* to it. */
|
|
3371
|
+
export type DocumentSearchResult = {
|
|
3372
|
+
chunks: DocumentSearchHit[];
|
|
3373
|
+
filter?: DocumentSearchFilter;
|
|
3374
|
+
reranked?: boolean;
|
|
3375
|
+
rerank_reason?: string;
|
|
3376
|
+
};
|
|
3377
|
+
/** Response of `document({op:"related"})` — narrow a {@link DocumentToolResponse}
|
|
3378
|
+
* to it. */
|
|
3379
|
+
export type DocumentRelatedResult = {
|
|
3380
|
+
related: Array<{
|
|
3381
|
+
chunk_id: string;
|
|
3382
|
+
score: number;
|
|
3383
|
+
title?: string;
|
|
3384
|
+
type?: string;
|
|
3385
|
+
document_id?: string;
|
|
3386
|
+
valid_at?: number;
|
|
3387
|
+
invalid_at?: number;
|
|
3388
|
+
}>;
|
|
3389
|
+
filter?: DocumentSearchFilter;
|
|
3390
|
+
};
|
|
3110
3391
|
/** Input for {@link LoomcycleClient.history} — the RFC BE History tool
|
|
3111
3392
|
* (POST /v1/_history). Browse/search/annotate PAST CHATS (a chat = a session).
|
|
3112
3393
|
* Op-discriminated; the owner is resolved server-side from the authenticated
|
|
@@ -3928,6 +4209,15 @@ export interface EnsureMcpServerOptions {
|
|
|
3928
4209
|
* loomcycle's idempotent create dedup the re-registration. */
|
|
3929
4210
|
headers?: Record<string, string>;
|
|
3930
4211
|
description?: string;
|
|
4212
|
+
/** How the server's text results reach the model. `"passthrough"` (the
|
|
4213
|
+
* default) hands them over as they came. `"capture"` keeps a file the
|
|
4214
|
+
* server returns as base64 inside a text block — the whole block, or a
|
|
4215
|
+
* JSON string field such as Microsoft Graph's `contentBytes` — in the
|
|
4216
|
+
* run's inbox and hands the model a one-line reference instead. Opt in
|
|
4217
|
+
* only for a server that returns files that way: a long opaque token
|
|
4218
|
+
* could otherwise look like one. Part of the registration's content, so
|
|
4219
|
+
* changing it mints a new version. Sent as the overlay's `binary_results`. */
|
|
4220
|
+
binaryResults?: "passthrough" | "capture";
|
|
3931
4221
|
/** Force a `tools/list` refresh after registering. Default false.
|
|
3932
4222
|
*
|
|
3933
4223
|
* You usually do NOT need this: registration auto-discovers the upstream's
|
|
@@ -4040,6 +4330,18 @@ export interface AgentCompaction {
|
|
|
4040
4330
|
* memory its definition must authorize. */
|
|
4041
4331
|
memory_flush?: boolean;
|
|
4042
4332
|
}
|
|
4333
|
+
/** An agent's OCR and speech-to-text settings. It can opt in to OCR and lower
|
|
4334
|
+
* the operator's per-run caps; it can never raise them or pick an engine. */
|
|
4335
|
+
export interface AgentTranscription {
|
|
4336
|
+
/** OCR for scans and images. Default `never`: OCR is billed per page. */
|
|
4337
|
+
ocr?: 'auto' | 'always' | 'never';
|
|
4338
|
+
/** Speech-to-text. Default `on` when the operator configured an engine. */
|
|
4339
|
+
stt?: 'on' | 'off';
|
|
4340
|
+
/** At most the operator's `transcription.ocr.max_pages_per_run`. */
|
|
4341
|
+
max_pages_per_run?: number;
|
|
4342
|
+
/** At most the operator's `transcription.stt.max_minutes_per_run`. */
|
|
4343
|
+
max_minutes_per_run?: number;
|
|
4344
|
+
}
|
|
4043
4345
|
/** The `context` block of an {@link AgentDefOverlay}: {@link ContextOptions}
|
|
4044
4346
|
* in its wire spelling — see there for what each field does. A fork merges it
|
|
4045
4347
|
* per field, and the spawn tree inherits it. */
|
|
@@ -4186,6 +4488,19 @@ export interface AgentDefOverlay {
|
|
|
4186
4488
|
* only. Held to the author's own grant; a sub-agent holds only what its
|
|
4187
4489
|
* parent run also holds. */
|
|
4188
4490
|
crypto_scopes?: string[];
|
|
4491
|
+
/** Which operator-listed credentials the agent's `Bash` and Bashbox host
|
|
4492
|
+
* commands receive (RFC EW): only these names of
|
|
4493
|
+
* `LOOMCYCLE_BASH_ALLOWED_CREDS` / `LOOMCYCLE_BASHBOX_FALLBACK_ALLOWED_CREDS`.
|
|
4494
|
+
* Unset = every credential the operator lists; `[]` = none; never adds one.
|
|
4495
|
+
* Held to the author's own narrowing; a sub-agent gets only the names its
|
|
4496
|
+
* parent run also allows. */
|
|
4497
|
+
shell_credentials?: string[];
|
|
4498
|
+
/** Which network operations the agent's `Git` tool may perform (RFC FB):
|
|
4499
|
+
* `['fetch']` (clone, fetch, pull, ls_remote) or `['fetch', 'push']`.
|
|
4500
|
+
* Unset or `[]` = none, local repositories only; `push` needs `fetch`.
|
|
4501
|
+
* Held to the author's own grant; a sub-agent may perform an operation
|
|
4502
|
+
* only when its parent run also may. */
|
|
4503
|
+
git_remote?: Array<'fetch' | 'push'>;
|
|
4189
4504
|
/** Channel tool ACL (default-deny until set). */
|
|
4190
4505
|
channels?: AgentChannelACL;
|
|
4191
4506
|
/** Interruption tool gate — `enabled: true` REQUIRED for the tool to work. */
|
|
@@ -4221,6 +4536,8 @@ export interface AgentDefOverlay {
|
|
|
4221
4536
|
sampling?: AgentSampling;
|
|
4222
4537
|
/** Context compaction in `append` mode, merged per field. */
|
|
4223
4538
|
compaction?: AgentCompaction;
|
|
4539
|
+
/** OCR and speech-to-text settings, merged per field. */
|
|
4540
|
+
transcription?: AgentTranscription;
|
|
4224
4541
|
/** How history is distilled, merged per field. */
|
|
4225
4542
|
context?: AgentContext;
|
|
4226
4543
|
/** Volumes the file and exec tools may resolve paths against. None declared
|
|
@@ -4881,6 +5198,10 @@ export interface LibraryEntry<T = unknown> {
|
|
|
4881
5198
|
active_def_id?: string;
|
|
4882
5199
|
latest_version?: number;
|
|
4883
5200
|
last_updated?: string;
|
|
5201
|
+
/** /v1/_library/agents only: the context window, in tokens, a run of
|
|
5202
|
+
* this agent starts with — the resolved provider's window, lowered by
|
|
5203
|
+
* the agent's own max_context_tokens. Omitted when unknown. */
|
|
5204
|
+
context_window?: number;
|
|
4884
5205
|
/** Static-side definition body. Omitted when in_static is false
|
|
4885
5206
|
* (dynamic-only entries have no static body — query the substrate
|
|
4886
5207
|
* via AgentDef/SkillDef/MCPServerDef tools to fetch the active
|
|
@@ -5732,16 +6053,20 @@ export interface DefNameSummary {
|
|
|
5732
6053
|
export interface DefNamesResponse {
|
|
5733
6054
|
names: DefNameSummary[];
|
|
5734
6055
|
}
|
|
5735
|
-
/** One token name
|
|
5736
|
-
*
|
|
6056
|
+
/** One (tenant, token name) summary from {@link LoomcycleClient.listOperatorTokenDefNames}.
|
|
6057
|
+
* A per-user (`u-`) name repeats across tenants, so it can appear once per
|
|
6058
|
+
* tenant. Carries no secret material. */
|
|
5737
6059
|
export interface OperatorTokenDefNameSummary {
|
|
5738
6060
|
name: string;
|
|
5739
6061
|
tenant_id: string;
|
|
5740
6062
|
subject: string;
|
|
5741
|
-
/** Every token minted under the name, rotated and retired ones included. */
|
|
6063
|
+
/** Every token minted under the name in this tenant, rotated and retired ones included. */
|
|
5742
6064
|
token_count: number;
|
|
5743
|
-
/** A non-retired token exists. */
|
|
6065
|
+
/** A non-retired, unexpired token exists. */
|
|
5744
6066
|
has_current: boolean;
|
|
6067
|
+
/** The newest live token's def_id; absent when none is live. Rotate or
|
|
6068
|
+
* retire by it: a per-user name is refused as a target. */
|
|
6069
|
+
current_def_id?: string;
|
|
5745
6070
|
last_updated: string;
|
|
5746
6071
|
}
|
|
5747
6072
|
/** Response of {@link LoomcycleClient.listOperatorTokenDefNames}. */
|
|
@@ -5913,6 +6238,49 @@ export interface RoutingResponse {
|
|
|
5913
6238
|
throughput_mode?: string;
|
|
5914
6239
|
/** Absent when no search providers are configured. */
|
|
5915
6240
|
search?: SearchRoutingProvider[];
|
|
6241
|
+
/** The memory embedder. Absent when none is configured. */
|
|
6242
|
+
embedder?: RoutingEmbedder;
|
|
6243
|
+
/** The decision models. Absent when none are configured. */
|
|
6244
|
+
decision?: RoutingDecision;
|
|
6245
|
+
}
|
|
6246
|
+
/** The memory embedder in {@link RoutingResponse}. `state` is what its calls
|
|
6247
|
+
* did since boot, not a probe: `untried` means nothing has been embedded yet.
|
|
6248
|
+
* No error text or address is reported. */
|
|
6249
|
+
export interface RoutingEmbedder {
|
|
6250
|
+
state: "untried" | "ok" | "failing";
|
|
6251
|
+
provider?: string;
|
|
6252
|
+
model?: string;
|
|
6253
|
+
/** The `models:` alias `memory.embedder` names, when it names one. */
|
|
6254
|
+
alias?: string;
|
|
6255
|
+
/** Absent until the embedder has learned it. */
|
|
6256
|
+
dimension?: number;
|
|
6257
|
+
calls: number;
|
|
6258
|
+
failures: number;
|
|
6259
|
+
last_failure_kind?: string;
|
|
6260
|
+
last_ok_unix?: number;
|
|
6261
|
+
last_failure_unix?: number;
|
|
6262
|
+
}
|
|
6263
|
+
/** The decision block in {@link RoutingResponse}. */
|
|
6264
|
+
export interface RoutingDecision {
|
|
6265
|
+
/** The model a call that names none is asked. */
|
|
6266
|
+
default: string;
|
|
6267
|
+
models: RoutingDecisionModel[];
|
|
6268
|
+
}
|
|
6269
|
+
/** One decision model. The state fields are its provider's probe; all three are
|
|
6270
|
+
* absent when the provider was never probed, and `listed` is also absent while
|
|
6271
|
+
* the provider is unreachable. Under the operator-key gate a tenant sees only
|
|
6272
|
+
* the models it can key. */
|
|
6273
|
+
export interface RoutingDecisionModel {
|
|
6274
|
+
/** What a caller names: a `models:` alias or a model name. */
|
|
6275
|
+
name: string;
|
|
6276
|
+
provider: string;
|
|
6277
|
+
model: string;
|
|
6278
|
+
default?: boolean;
|
|
6279
|
+
/** Reachable and listed. */
|
|
6280
|
+
available?: boolean;
|
|
6281
|
+
reachable?: boolean;
|
|
6282
|
+
/** The provider's model list carries the model (for Ollama: it is pulled). */
|
|
6283
|
+
listed?: boolean;
|
|
5916
6284
|
}
|
|
5917
6285
|
/** Response of {@link LoomcycleClient.listProviderModels}: a live listing from
|
|
5918
6286
|
* the provider, not the cached probe matrix. */
|
|
@@ -6050,3 +6418,337 @@ export interface StreamChangesOptions {
|
|
|
6050
6418
|
/** Abort to close the stream; the iterator then throws an `AbortError`. */
|
|
6051
6419
|
signal?: AbortSignal;
|
|
6052
6420
|
}
|
|
6421
|
+
/** The access-control rollout mode a deployment runs in. */
|
|
6422
|
+
export type AclMode = "compat" | "shadow" | "enforce";
|
|
6423
|
+
/** Marks an entry the config declares rather than the store holds. */
|
|
6424
|
+
export type AclSource = "config";
|
|
6425
|
+
export type AclEffect = "allow" | "deny";
|
|
6426
|
+
/** What a binding attaches a list to. `tenant` is everyone in the tenant. */
|
|
6427
|
+
export type AclSubjectKind = "user" | "group" | "token" | "tenant";
|
|
6428
|
+
/** The closed `when` set of a rule. Every present field narrows the rule; an
|
|
6429
|
+
* absent one does not. */
|
|
6430
|
+
export interface AclCondition {
|
|
6431
|
+
/** The request arrived on one of these (see `AclCatalog.transports`). */
|
|
6432
|
+
transport?: string[];
|
|
6433
|
+
/** A wall-clock window: on one of `days` (`mon`…`sun`), inside
|
|
6434
|
+
* `between: [from, to)` (`HH:MM`), in `tz` (an IANA zone). */
|
|
6435
|
+
time?: {
|
|
6436
|
+
days?: string[];
|
|
6437
|
+
between?: string[];
|
|
6438
|
+
tz?: string;
|
|
6439
|
+
};
|
|
6440
|
+
interactive?: boolean;
|
|
6441
|
+
tier?: string[];
|
|
6442
|
+
user_tier?: string[];
|
|
6443
|
+
source_cidr?: string[];
|
|
6444
|
+
owner_is_self?: boolean;
|
|
6445
|
+
/** Inside a run: the run's agent matches this glob. */
|
|
6446
|
+
agent?: string;
|
|
6447
|
+
/** The run's spawn depth is at most `max`. */
|
|
6448
|
+
depth?: {
|
|
6449
|
+
max: number;
|
|
6450
|
+
};
|
|
6451
|
+
}
|
|
6452
|
+
/** One rule: `effect` on any of `actions` over any of `resources`
|
|
6453
|
+
* (`type:selector`, e.g. `agent:reviewer-*`), when `when` holds. */
|
|
6454
|
+
export interface AclRule {
|
|
6455
|
+
effect: AclEffect;
|
|
6456
|
+
actions: string[];
|
|
6457
|
+
resources: string[];
|
|
6458
|
+
when?: AclCondition;
|
|
6459
|
+
description?: string;
|
|
6460
|
+
}
|
|
6461
|
+
/** A rule list as written: a built-in baseline, or a draft list for
|
|
6462
|
+
* {@link LoomcycleClient.authzSimulate}. */
|
|
6463
|
+
export interface AclList {
|
|
6464
|
+
name: string;
|
|
6465
|
+
description?: string;
|
|
6466
|
+
rules: AclRule[];
|
|
6467
|
+
}
|
|
6468
|
+
/** One rule list: a stored one, or (`source: "config"`) one the config
|
|
6469
|
+
* declares, which has only a name, a description and its rules. */
|
|
6470
|
+
export interface AclDefRow {
|
|
6471
|
+
tenant_id?: string;
|
|
6472
|
+
name: string;
|
|
6473
|
+
/** Bumped on every write. Absent on a config list. */
|
|
6474
|
+
version?: number;
|
|
6475
|
+
content_sha256?: string;
|
|
6476
|
+
catalog_version?: number;
|
|
6477
|
+
rules: AclRule[];
|
|
6478
|
+
description?: string;
|
|
6479
|
+
created_at?: string;
|
|
6480
|
+
updated_at?: string;
|
|
6481
|
+
created_by?: string;
|
|
6482
|
+
/** Set once the list is retired; absent while it is live. */
|
|
6483
|
+
retired_at?: string;
|
|
6484
|
+
source?: AclSource;
|
|
6485
|
+
}
|
|
6486
|
+
/** `aclDef({op: "list"})`. `builtin` is the code-defined baselines, which no
|
|
6487
|
+
* call can change. */
|
|
6488
|
+
export interface AclDefListResponse {
|
|
6489
|
+
acls: AclDefRow[];
|
|
6490
|
+
builtin: AclList[];
|
|
6491
|
+
}
|
|
6492
|
+
/** `GET /v1/_acldef/names`: every live list name the tenant's bindings can
|
|
6493
|
+
* reach, stored and config, sorted. */
|
|
6494
|
+
export interface AclDefNamesResponse {
|
|
6495
|
+
names: string[];
|
|
6496
|
+
}
|
|
6497
|
+
/** `aclDef({op: "validate"})` on rules the server accepts. Rules it refuses
|
|
6498
|
+
* are a 400 (`acl_invalid`) naming the fault. */
|
|
6499
|
+
export interface AclValidateResult {
|
|
6500
|
+
valid: boolean;
|
|
6501
|
+
/** How many rules were read. */
|
|
6502
|
+
rules: number;
|
|
6503
|
+
catalog_version: number;
|
|
6504
|
+
}
|
|
6505
|
+
/** One resource type of the catalog: its verbs, and for a scoped type the
|
|
6506
|
+
* scopes a selector may name (`separator` joins scope and name). */
|
|
6507
|
+
export interface AclCatalogType {
|
|
6508
|
+
type: string;
|
|
6509
|
+
verbs: string[];
|
|
6510
|
+
scopes?: string[];
|
|
6511
|
+
separator?: string;
|
|
6512
|
+
}
|
|
6513
|
+
/** `aclDef({op: "catalog"})`: what a rule may name. */
|
|
6514
|
+
export interface AclCatalog {
|
|
6515
|
+
catalog_version: number;
|
|
6516
|
+
types: AclCatalogType[];
|
|
6517
|
+
transports: string[];
|
|
6518
|
+
}
|
|
6519
|
+
/** The ops of the AclDef family. `create`, `update` and `put` are the same
|
|
6520
|
+
* upsert. */
|
|
6521
|
+
export type AclDefOp = "create" | "update" | "put" | "get" | "list" | "retire" | "validate" | "catalog" | "names";
|
|
6522
|
+
/** The input of {@link LoomcycleClient.aclDef}. `name` is required by
|
|
6523
|
+
* create/update/put/get/retire, `rules` by create/update/put/validate,
|
|
6524
|
+
* `include_retired` is read by list. */
|
|
6525
|
+
export interface AclDefInput {
|
|
6526
|
+
op: AclDefOp;
|
|
6527
|
+
name?: string;
|
|
6528
|
+
rules?: AclRule[];
|
|
6529
|
+
description?: string;
|
|
6530
|
+
include_retired?: boolean;
|
|
6531
|
+
}
|
|
6532
|
+
/** One group: a stored one, or (`source: "config"`) one the config declares,
|
|
6533
|
+
* which lists its direct `members` (subjects) and member `groups` inline and
|
|
6534
|
+
* has no timestamps. A stored group's members come from
|
|
6535
|
+
* {@link LoomcycleClient.getGroup}. */
|
|
6536
|
+
export interface GroupRow {
|
|
6537
|
+
tenant_id?: string;
|
|
6538
|
+
name: string;
|
|
6539
|
+
description?: string;
|
|
6540
|
+
/** Set on a group an identity provider owns: its members are managed there,
|
|
6541
|
+
* and a write here is refused (409 `group_external`). */
|
|
6542
|
+
external_id?: string;
|
|
6543
|
+
created_at?: string;
|
|
6544
|
+
updated_at?: string;
|
|
6545
|
+
created_by?: string;
|
|
6546
|
+
source?: AclSource;
|
|
6547
|
+
members?: string[];
|
|
6548
|
+
groups?: string[];
|
|
6549
|
+
}
|
|
6550
|
+
export type GroupMemberKind = "user" | "group";
|
|
6551
|
+
/** One direct membership edge of a stored group. */
|
|
6552
|
+
export interface GroupMember {
|
|
6553
|
+
tenant_id?: string;
|
|
6554
|
+
group: string;
|
|
6555
|
+
member_kind: GroupMemberKind;
|
|
6556
|
+
member_id: string;
|
|
6557
|
+
added_at: string;
|
|
6558
|
+
added_by?: string;
|
|
6559
|
+
}
|
|
6560
|
+
export interface GroupListResponse {
|
|
6561
|
+
groups: GroupRow[];
|
|
6562
|
+
}
|
|
6563
|
+
/** `GET /v1/_groups/{name}`: a stored group with its direct members. */
|
|
6564
|
+
export interface GroupDetail {
|
|
6565
|
+
group: GroupRow;
|
|
6566
|
+
members: GroupMember[] | null;
|
|
6567
|
+
/** Every group a member of this one is also in, transitively, this one
|
|
6568
|
+
* included. */
|
|
6569
|
+
contained_in: string[] | null;
|
|
6570
|
+
}
|
|
6571
|
+
/** `GET /v1/_groups/{name}/effective`: everyone the group holds, at any
|
|
6572
|
+
* nesting depth, config-declared members included. */
|
|
6573
|
+
export interface GroupEffective {
|
|
6574
|
+
group: string;
|
|
6575
|
+
/** User subjects, sorted. */
|
|
6576
|
+
users: string[];
|
|
6577
|
+
/** The nested groups walked, sorted (the group itself excluded). */
|
|
6578
|
+
groups: string[];
|
|
6579
|
+
}
|
|
6580
|
+
/** The body of {@link LoomcycleClient.createGroup}: an upsert by name. */
|
|
6581
|
+
export interface CreateGroupBody {
|
|
6582
|
+
name: string;
|
|
6583
|
+
description?: string;
|
|
6584
|
+
external_id?: string;
|
|
6585
|
+
}
|
|
6586
|
+
/** What a membership write reports. `removed` is set by a removal. */
|
|
6587
|
+
export interface GroupMemberChange {
|
|
6588
|
+
group: string;
|
|
6589
|
+
kind: GroupMemberKind;
|
|
6590
|
+
id: string;
|
|
6591
|
+
removed?: boolean;
|
|
6592
|
+
}
|
|
6593
|
+
/** One binding of a list to a subject: a stored one, or (`source: "config"`)
|
|
6594
|
+
* one the config declares, which has no `binding_id` and no timestamps. */
|
|
6595
|
+
export interface AclBinding {
|
|
6596
|
+
binding_id?: string;
|
|
6597
|
+
tenant_id?: string;
|
|
6598
|
+
acl: string;
|
|
6599
|
+
subject_kind: AclSubjectKind;
|
|
6600
|
+
/** Absent for a tenant-wide binding. */
|
|
6601
|
+
subject_id?: string;
|
|
6602
|
+
/** Absent when the binding never expires. */
|
|
6603
|
+
expires_at?: string;
|
|
6604
|
+
created_at?: string;
|
|
6605
|
+
created_by?: string;
|
|
6606
|
+
/** Set once retired; absent while live. */
|
|
6607
|
+
retired_at?: string;
|
|
6608
|
+
source?: AclSource;
|
|
6609
|
+
}
|
|
6610
|
+
export interface AclBindingListResponse {
|
|
6611
|
+
bindings: AclBinding[];
|
|
6612
|
+
}
|
|
6613
|
+
/** The body of {@link LoomcycleClient.createAclBinding}. The list must exist
|
|
6614
|
+
* and `expires_at` (RFC 3339) must be in the future, or the server refuses
|
|
6615
|
+
* with 400 `acl_binding_invalid`. */
|
|
6616
|
+
export interface CreateAclBindingBody {
|
|
6617
|
+
acl: string;
|
|
6618
|
+
subject_kind: AclSubjectKind;
|
|
6619
|
+
subject_id?: string;
|
|
6620
|
+
expires_at?: string;
|
|
6621
|
+
}
|
|
6622
|
+
/** One rule that decided: list, its version, the rule's index, its effect. */
|
|
6623
|
+
export interface AuthzReason {
|
|
6624
|
+
acl: string;
|
|
6625
|
+
version?: number;
|
|
6626
|
+
rule: number;
|
|
6627
|
+
effect: AclEffect;
|
|
6628
|
+
}
|
|
6629
|
+
/** An access-control decision (AuthZEN 1.0 shape). `decision` is true only
|
|
6630
|
+
* when a rule allowed; `outcome` `no_match` means no rule spoke, which in
|
|
6631
|
+
* `compat` and `shadow` mode the scope gate then decides. */
|
|
6632
|
+
export interface AuthzDecision {
|
|
6633
|
+
decision: boolean;
|
|
6634
|
+
outcome: "allow" | "deny" | "no_match";
|
|
6635
|
+
reasons?: AuthzReason[];
|
|
6636
|
+
/** The request crossed a tenant and no rule was read. */
|
|
6637
|
+
tenant_floor?: boolean;
|
|
6638
|
+
mode: AclMode;
|
|
6639
|
+
}
|
|
6640
|
+
/** The request context a rule's `when` is judged against. Omitted fields take
|
|
6641
|
+
* the call's own (`transport` is the transport the call arrived on). */
|
|
6642
|
+
export interface AuthzRequestContext {
|
|
6643
|
+
transport?: string;
|
|
6644
|
+
interactive?: boolean;
|
|
6645
|
+
tier?: string;
|
|
6646
|
+
user_tier?: string;
|
|
6647
|
+
agent?: string;
|
|
6648
|
+
depth?: number;
|
|
6649
|
+
}
|
|
6650
|
+
/** One question: may `subject` do `action` to `resource`? An omitted
|
|
6651
|
+
* `subject` (or one naming the caller) asks about the caller; naming another
|
|
6652
|
+
* subject of the tenant needs a tenant operator. An empty `resource.id` asks
|
|
6653
|
+
* about any instance of the type. */
|
|
6654
|
+
export interface AuthzEvaluationRequest {
|
|
6655
|
+
subject?: {
|
|
6656
|
+
type?: string;
|
|
6657
|
+
id?: string;
|
|
6658
|
+
};
|
|
6659
|
+
action: {
|
|
6660
|
+
name: string;
|
|
6661
|
+
};
|
|
6662
|
+
resource: {
|
|
6663
|
+
type: string;
|
|
6664
|
+
id: string;
|
|
6665
|
+
owner?: string;
|
|
6666
|
+
};
|
|
6667
|
+
context?: AuthzRequestContext;
|
|
6668
|
+
}
|
|
6669
|
+
/** How {@link LoomcycleClient.authzEvaluations} runs its batch. */
|
|
6670
|
+
export type AuthzEvaluationsSemantic = "execute_all" | "deny_on_first_deny" | "permit_on_first_permit";
|
|
6671
|
+
/** A batch of questions for one subject. A top-level `action`, `resource` or
|
|
6672
|
+
* `context` is the default each entry that omits its own inherits. 1 to 256
|
|
6673
|
+
* entries. */
|
|
6674
|
+
export interface AuthzEvaluationsRequest {
|
|
6675
|
+
subject?: {
|
|
6676
|
+
type?: string;
|
|
6677
|
+
id?: string;
|
|
6678
|
+
};
|
|
6679
|
+
action?: {
|
|
6680
|
+
name: string;
|
|
6681
|
+
};
|
|
6682
|
+
resource?: {
|
|
6683
|
+
type: string;
|
|
6684
|
+
id: string;
|
|
6685
|
+
owner?: string;
|
|
6686
|
+
};
|
|
6687
|
+
context?: AuthzRequestContext;
|
|
6688
|
+
evaluations: Array<Partial<Omit<AuthzEvaluationRequest, "subject">>>;
|
|
6689
|
+
options?: {
|
|
6690
|
+
evaluations_semantic?: AuthzEvaluationsSemantic;
|
|
6691
|
+
};
|
|
6692
|
+
}
|
|
6693
|
+
export interface AuthzEvaluationsResponse {
|
|
6694
|
+
evaluations: AuthzDecision[];
|
|
6695
|
+
}
|
|
6696
|
+
/** One rule the engine read for an explanation, matching or not, and why. */
|
|
6697
|
+
export interface AuthzTrace {
|
|
6698
|
+
acl: string;
|
|
6699
|
+
version?: number;
|
|
6700
|
+
rule: number;
|
|
6701
|
+
effect: AclEffect;
|
|
6702
|
+
matched: boolean;
|
|
6703
|
+
why: string;
|
|
6704
|
+
}
|
|
6705
|
+
/** A binding as the engine applied it. */
|
|
6706
|
+
export interface AuthzAppliedBinding {
|
|
6707
|
+
id?: string;
|
|
6708
|
+
acl: string;
|
|
6709
|
+
subject_kind: AclSubjectKind;
|
|
6710
|
+
subject_id?: string;
|
|
6711
|
+
expires_at?: string;
|
|
6712
|
+
}
|
|
6713
|
+
/** `POST /v1/_authz/explain`: the decision, every rule read for the resource's
|
|
6714
|
+
* type, the bound lists that do not exist, the bindings applied, and the
|
|
6715
|
+
* subject's groups. */
|
|
6716
|
+
export interface AuthzExplainResponse {
|
|
6717
|
+
decision: AuthzDecision;
|
|
6718
|
+
traces: AuthzTrace[] | null;
|
|
6719
|
+
missing_acls: string[] | null;
|
|
6720
|
+
applied_bindings: AuthzAppliedBinding[] | null;
|
|
6721
|
+
groups: string[] | null;
|
|
6722
|
+
}
|
|
6723
|
+
/** A draft binding for {@link LoomcycleClient.authzSimulate}. */
|
|
6724
|
+
export interface AuthzDraftBinding {
|
|
6725
|
+
acl: string;
|
|
6726
|
+
subject_kind: AclSubjectKind;
|
|
6727
|
+
subject_id?: string;
|
|
6728
|
+
expires_at?: string;
|
|
6729
|
+
}
|
|
6730
|
+
/** Evaluate questions against a DRAFT: the subject's lists and bindings now,
|
|
6731
|
+
* with `acls` added or replaced by name and `bindings` added. Nothing is
|
|
6732
|
+
* written. 1 to 256 requests. */
|
|
6733
|
+
export interface AuthzSimulateRequest {
|
|
6734
|
+
subject?: {
|
|
6735
|
+
type?: string;
|
|
6736
|
+
id?: string;
|
|
6737
|
+
};
|
|
6738
|
+
acls?: AclList[];
|
|
6739
|
+
bindings?: AuthzDraftBinding[];
|
|
6740
|
+
requests: AuthzEvaluationRequest[];
|
|
6741
|
+
}
|
|
6742
|
+
export interface AuthzSimulateResult {
|
|
6743
|
+
/** The request, echoed. */
|
|
6744
|
+
request: AuthzEvaluationRequest;
|
|
6745
|
+
now: AuthzDecision;
|
|
6746
|
+
with_draft: AuthzDecision;
|
|
6747
|
+
/** The outcome differs between `now` and `with_draft`. */
|
|
6748
|
+
changed: boolean;
|
|
6749
|
+
}
|
|
6750
|
+
export interface AuthzSimulateResponse {
|
|
6751
|
+
results: AuthzSimulateResult[];
|
|
6752
|
+
/** Lists the draft's bindings name that no layer has. */
|
|
6753
|
+
missing_acls: string[] | null;
|
|
6754
|
+
}
|