kagura-memory 0.1.0 → 0.2.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 +45 -2
- package/dist/index.cjs +315 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +437 -1
- package/dist/index.d.ts +437 -1
- package/dist/index.js +314 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -815,6 +815,190 @@ interface MemberAPIKey {
|
|
|
815
815
|
expires_at?: string | null;
|
|
816
816
|
bound_context_id?: string | null;
|
|
817
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* A workspace-scoped Agent Registry row (memory-cloud #1274).
|
|
820
|
+
*
|
|
821
|
+
* An agent is a registry entry that anchors context bindings, agent-bound
|
|
822
|
+
* credentials, bootstrap, and audit correlation — it is a resource, NOT a
|
|
823
|
+
* principal (it never authenticates by itself).
|
|
824
|
+
*
|
|
825
|
+
* `status` (`active` | `suspended` | `retired`) is the fail-closed kill
|
|
826
|
+
* switch: suspended/retired agents cause every key bound to them to be
|
|
827
|
+
* rejected at verify time. `enforcement_mode` (`shadow` | `enforce`) is
|
|
828
|
+
* the binding enforcement ramp. Both are typed `string` (not a literal
|
|
829
|
+
* union) for forward compatibility — the server is the authority;
|
|
830
|
+
* request-side options use the closed enums.
|
|
831
|
+
*/
|
|
832
|
+
interface Agent {
|
|
833
|
+
id: string;
|
|
834
|
+
workspace_id: string;
|
|
835
|
+
name: string;
|
|
836
|
+
owner_user_id: string;
|
|
837
|
+
status: string;
|
|
838
|
+
enforcement_mode: string;
|
|
839
|
+
description?: string | null;
|
|
840
|
+
framework?: string | null;
|
|
841
|
+
environment?: string | null;
|
|
842
|
+
version?: string | null;
|
|
843
|
+
/** ISO 8601 datetime string. */
|
|
844
|
+
last_seen_at?: string | null;
|
|
845
|
+
/** ISO 8601 datetime string. */
|
|
846
|
+
created_at: string;
|
|
847
|
+
/** ISO 8601 datetime string. */
|
|
848
|
+
updated_at: string;
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* An agent→context binding row (memory-cloud #1275).
|
|
852
|
+
*
|
|
853
|
+
* Bindings are **purely subtractive scoping**: the effective permission
|
|
854
|
+
* for an agent-bound request is the existing RBAC decision ∩ binding —
|
|
855
|
+
* `can_read` gates reads, `write_policy` (`deny` | `direct`) gates
|
|
856
|
+
* writes. Under `enforcement_mode="enforce"` contexts WITHOUT a binding
|
|
857
|
+
* row are denied for the agent (default-deny); under `"shadow"`
|
|
858
|
+
* violations are only logged. `is_default` marks the agent's bootstrap
|
|
859
|
+
* default binding (max one per agent).
|
|
860
|
+
*
|
|
861
|
+
* `allowed_memory_types` / `allowed_source_types` are reserved for
|
|
862
|
+
* memory-cloud #1286 (per-memory enforcement) and arrive as `null`
|
|
863
|
+
* today.
|
|
864
|
+
*/
|
|
865
|
+
interface AgentBinding {
|
|
866
|
+
id: string;
|
|
867
|
+
agent_id: string;
|
|
868
|
+
context_id: string;
|
|
869
|
+
can_read: boolean;
|
|
870
|
+
write_policy: string;
|
|
871
|
+
is_default: boolean;
|
|
872
|
+
allowed_memory_types?: string[] | null;
|
|
873
|
+
allowed_source_types?: string[] | null;
|
|
874
|
+
created_by: string;
|
|
875
|
+
/** ISO 8601 datetime string. */
|
|
876
|
+
created_at: string;
|
|
877
|
+
/** ISO 8601 datetime string. */
|
|
878
|
+
updated_at: string;
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Valid values for `getAgentBootstrap`'s `include` component selector.
|
|
882
|
+
*
|
|
883
|
+
* Mirrors the server's closed component set; the server rejects unknown
|
|
884
|
+
* names with `invalid_arguments`.
|
|
885
|
+
*/
|
|
886
|
+
type AgentBootstrapComponentName = "pinned" | "recall" | "upcoming" | "state" | "policy";
|
|
887
|
+
/**
|
|
888
|
+
* The context binding a bootstrap resolved (`agent.binding`).
|
|
889
|
+
*
|
|
890
|
+
* `is_default` is true when the context came from the agent's default
|
|
891
|
+
* binding (no explicit `context_id` was passed).
|
|
892
|
+
*/
|
|
893
|
+
interface AgentBootstrapBinding {
|
|
894
|
+
context_id: string;
|
|
895
|
+
/** @default false */
|
|
896
|
+
is_default?: boolean;
|
|
897
|
+
}
|
|
898
|
+
/** Agent identity block in the bootstrap envelope. */
|
|
899
|
+
interface AgentBootstrapAgent {
|
|
900
|
+
agent_id: string;
|
|
901
|
+
name: string;
|
|
902
|
+
binding?: AgentBootstrapBinding | null;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Correlation block (RFC-0002 P0-4) — session/run/trace identifiers.
|
|
906
|
+
*
|
|
907
|
+
* `session_id` echoes the bootstrap argument when given, else the
|
|
908
|
+
* server's baggage-derived session id. `run_id`/`trace_id`/`span_id` are
|
|
909
|
+
* populated from the per-request correlation context when present.
|
|
910
|
+
*/
|
|
911
|
+
interface AgentBootstrapCorrelation {
|
|
912
|
+
agent_id?: string | null;
|
|
913
|
+
session_id?: string | null;
|
|
914
|
+
run_id?: string | null;
|
|
915
|
+
trace_id?: string | null;
|
|
916
|
+
span_id?: string | null;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* One fail-soft component payload in the bootstrap envelope.
|
|
920
|
+
*
|
|
921
|
+
* `status` is `"ok"` (payload inherited from the standalone tool),
|
|
922
|
+
* `"skipped"` (e.g. recall without a `query`, with a `reason`), or
|
|
923
|
+
* `"error"` (that component failed; the rest still return). The rest of
|
|
924
|
+
* the shape belongs to the standalone tools (`load_pinned`, `recall`,
|
|
925
|
+
* `recall_upcoming`, `get_state`) and evolves with them — hence the open
|
|
926
|
+
* index signature.
|
|
927
|
+
*/
|
|
928
|
+
interface AgentBootstrapComponent {
|
|
929
|
+
status?: string;
|
|
930
|
+
[key: string]: unknown;
|
|
931
|
+
}
|
|
932
|
+
/**
|
|
933
|
+
* Composed envelope from `get_agent_bootstrap` (server v0.49.0+).
|
|
934
|
+
*
|
|
935
|
+
* One session-start call that rehydrates an agent's cognitive state by
|
|
936
|
+
* composing existing primitives. Components are **fail-soft**: a failing
|
|
937
|
+
* component reports `status="error"` under `components` while the rest
|
|
938
|
+
* still return, with the top-level `degraded` flag set.
|
|
939
|
+
*
|
|
940
|
+
* `context` reuses {@link ContextDetail} — the server emits the block
|
|
941
|
+
* byte-compatible with `get_context_info` (`search_config` is not
|
|
942
|
+
* included in bootstrap).
|
|
943
|
+
*/
|
|
944
|
+
interface AgentBootstrapResponse {
|
|
945
|
+
/** @default "success" */
|
|
946
|
+
status?: string;
|
|
947
|
+
/** @default false */
|
|
948
|
+
degraded?: boolean;
|
|
949
|
+
agent: AgentBootstrapAgent;
|
|
950
|
+
context?: ContextDetail | null;
|
|
951
|
+
instructions?: string | null;
|
|
952
|
+
components?: Record<string, AgentBootstrapComponent>;
|
|
953
|
+
correlation?: AgentBootstrapCorrelation | null;
|
|
954
|
+
/** ISO 8601 datetime string. */
|
|
955
|
+
generated_at?: string | null;
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Shared request contract for the agent bootstrap surfaces.
|
|
960
|
+
*
|
|
961
|
+
* `KaguraClient.getAgentBootstrap` (MCP tool arguments) and
|
|
962
|
+
* `AgentsClient.bootstrap` (REST JSON body) carry the same seven optional
|
|
963
|
+
* keys; this module keeps the two surfaces in lockstep without the REST
|
|
964
|
+
* client importing the MCP module — the analogue of the Python SDK homing
|
|
965
|
+
* `_bootstrap_payload` in models.py so agents_client.py never imports
|
|
966
|
+
* client.py. `agentId` stays transport-specific (MCP argument vs URL
|
|
967
|
+
* path).
|
|
968
|
+
*/
|
|
969
|
+
|
|
970
|
+
interface GetAgentBootstrapOptions {
|
|
971
|
+
/** Agent UUID from the registry (required). */
|
|
972
|
+
agentId: string;
|
|
973
|
+
/** Target context UUID. Omit to use the agent's default binding. */
|
|
974
|
+
contextId?: string;
|
|
975
|
+
/**
|
|
976
|
+
* Opaque correlation id (max 128 chars, `[A-Za-z0-9._-]`); echoed in
|
|
977
|
+
* the `correlation` block.
|
|
978
|
+
*/
|
|
979
|
+
sessionId?: string;
|
|
980
|
+
/**
|
|
981
|
+
* Recall query (max 1024 chars). Supplying it enables the trusted-only
|
|
982
|
+
* recall component; omit to skip recall — the server never fabricates
|
|
983
|
+
* a query, so the component reports `status="skipped"` even when
|
|
984
|
+
* `include` names it.
|
|
985
|
+
*/
|
|
986
|
+
query?: string;
|
|
987
|
+
/** Number of recall results; forwarded to recall's `k` validation. */
|
|
988
|
+
recallK?: number;
|
|
989
|
+
/** Override for the pinned-set cap; clamped server-side to [1, 1000]. */
|
|
990
|
+
pinnedCap?: number;
|
|
991
|
+
/**
|
|
992
|
+
* ISO upper bound for upcoming time memories (the lower bound is
|
|
993
|
+
* always now).
|
|
994
|
+
*/
|
|
995
|
+
upcomingUntil?: string;
|
|
996
|
+
/**
|
|
997
|
+
* Component selector — a subset of `"pinned"`, `"recall"`,
|
|
998
|
+
* `"upcoming"`, `"state"`, `"policy"`. Omit for all components.
|
|
999
|
+
*/
|
|
1000
|
+
include?: AgentBootstrapComponentName[];
|
|
1001
|
+
}
|
|
818
1002
|
|
|
819
1003
|
/** Low-level client for Kagura Memory Cloud MCP tools (port of client.py). */
|
|
820
1004
|
|
|
@@ -833,6 +1017,15 @@ type ToolResult = Record<string, unknown>;
|
|
|
833
1017
|
type DeliveryMode = "always" | "on_recall" | "on_trigger";
|
|
834
1018
|
type SearchMode = "hybrid" | "semantic" | "keyword";
|
|
835
1019
|
type SourceType = "file" | "url" | "vault" | "api" | "manual";
|
|
1020
|
+
/** Agent lifecycle state — `updateAgent`'s fail-closed kill switch. */
|
|
1021
|
+
type AgentStatus = "active" | "suspended" | "retired";
|
|
1022
|
+
/** Binding enforcement ramp: `enforce` denies, `shadow` only logs. */
|
|
1023
|
+
type AgentEnforcementMode = "shadow" | "enforce";
|
|
1024
|
+
/**
|
|
1025
|
+
* Per-binding write gate: `"deny"` (server default) or `"direct"`.
|
|
1026
|
+
* `"staged"` is reserved for a later server phase.
|
|
1027
|
+
*/
|
|
1028
|
+
type AgentWritePolicy = "deny" | "direct";
|
|
836
1029
|
interface KaguraClientOptions {
|
|
837
1030
|
/** Explicit Kagura API key. When omitted, the resolution chain runs. */
|
|
838
1031
|
apiKey?: string;
|
|
@@ -981,6 +1174,69 @@ interface ListMemoriesOptions {
|
|
|
981
1174
|
/** "created_at" (default, newest-first) or "trigger_from" (soonest first). */
|
|
982
1175
|
orderBy?: "created_at" | "trigger_from";
|
|
983
1176
|
}
|
|
1177
|
+
interface RegisterAgentOptions {
|
|
1178
|
+
/** Workspace-unique agent name (max 255 chars). */
|
|
1179
|
+
name: string;
|
|
1180
|
+
/** Free-text description (max 10000 chars). */
|
|
1181
|
+
description?: string;
|
|
1182
|
+
/** Framework tag, e.g. `"claude-code"`, `"langgraph"` (max 100 chars). */
|
|
1183
|
+
framework?: string;
|
|
1184
|
+
/** Deployment environment, e.g. `"production"` (max 100 chars). */
|
|
1185
|
+
environment?: string;
|
|
1186
|
+
/** Agent build/prompt version (max 100 chars). */
|
|
1187
|
+
version?: string;
|
|
1188
|
+
}
|
|
1189
|
+
interface UpdateAgentOptions {
|
|
1190
|
+
agentId: string;
|
|
1191
|
+
/** New workspace-unique name (max 255 chars). */
|
|
1192
|
+
name?: string;
|
|
1193
|
+
/** New description (max 10000 chars). */
|
|
1194
|
+
description?: string;
|
|
1195
|
+
/** New framework tag (max 100 chars). */
|
|
1196
|
+
framework?: string;
|
|
1197
|
+
/** New environment (max 100 chars). */
|
|
1198
|
+
environment?: string;
|
|
1199
|
+
/** New version (max 100 chars). */
|
|
1200
|
+
version?: string;
|
|
1201
|
+
/**
|
|
1202
|
+
* Lifecycle state — the fail-closed kill switch: `"suspended"` /
|
|
1203
|
+
* `"retired"` agents get every key bound to them rejected at verify
|
|
1204
|
+
* time.
|
|
1205
|
+
*/
|
|
1206
|
+
status?: AgentStatus;
|
|
1207
|
+
/**
|
|
1208
|
+
* Binding enforcement ramp. Setting `"enforce"` → `"shadow"` is an
|
|
1209
|
+
* audited privilege-widening event (bindings stop being enforced and
|
|
1210
|
+
* are only logged).
|
|
1211
|
+
*/
|
|
1212
|
+
enforcementMode?: AgentEnforcementMode;
|
|
1213
|
+
}
|
|
1214
|
+
/**
|
|
1215
|
+
* The subtractive scope trio shared by {@link BindAgentContextOptions}
|
|
1216
|
+
* and {@link UpdateAgentBindingOptions} — the ONE type to extend when
|
|
1217
|
+
* memory-cloud #1286 ships the reserved `allowedMemoryTypes` /
|
|
1218
|
+
* `allowedSourceTypes` filters (the server accepts only null for them
|
|
1219
|
+
* until per-memory enforcement lands, so they are deliberately not
|
|
1220
|
+
* declared yet; adding them later is non-breaking).
|
|
1221
|
+
*/
|
|
1222
|
+
interface AgentBindingScopeOptions {
|
|
1223
|
+
/** Whether the agent may read this context (server default: true). */
|
|
1224
|
+
canRead?: boolean;
|
|
1225
|
+
/** Write gate (server default: `"deny"`). */
|
|
1226
|
+
writePolicy?: AgentWritePolicy;
|
|
1227
|
+
/** Mark as the agent's bootstrap default binding (max one per agent). */
|
|
1228
|
+
isDefault?: boolean;
|
|
1229
|
+
}
|
|
1230
|
+
interface BindAgentContextOptions extends AgentBindingScopeOptions {
|
|
1231
|
+
agentId: string;
|
|
1232
|
+
/** Context to bind (must belong to the agent's workspace). */
|
|
1233
|
+
contextId: string;
|
|
1234
|
+
}
|
|
1235
|
+
interface UpdateAgentBindingOptions extends AgentBindingScopeOptions {
|
|
1236
|
+
agentId: string;
|
|
1237
|
+
/** Binding UUID from {@link KaguraClient.listAgentBindings}. */
|
|
1238
|
+
bindingId: string;
|
|
1239
|
+
}
|
|
984
1240
|
interface UpdateSearchConfigOptions {
|
|
985
1241
|
contextId: string;
|
|
986
1242
|
/** Semantic search weight (0.0-1.0); weights must sum to 1.0 (±0.01). */
|
|
@@ -1125,6 +1381,141 @@ declare class KaguraClient {
|
|
|
1125
1381
|
contextId: string;
|
|
1126
1382
|
key?: string;
|
|
1127
1383
|
}): Promise<ToolResult>;
|
|
1384
|
+
/**
|
|
1385
|
+
* Unwrap an object envelope (`agent`, `binding`, `report`, …) from a
|
|
1386
|
+
* tool result.
|
|
1387
|
+
*
|
|
1388
|
+
* Match the Python port's `result["<key>"]`: a missing envelope is a
|
|
1389
|
+
* contract violation, surfaced loudly rather than as a partial object.
|
|
1390
|
+
*/
|
|
1391
|
+
private static expectEnvelope;
|
|
1392
|
+
/**
|
|
1393
|
+
* Register an AI agent in the workspace Agent Registry.
|
|
1394
|
+
*
|
|
1395
|
+
* Calls the `register_agent` MCP tool (server v0.49.0+, RFC-0002 P0-1,
|
|
1396
|
+
* memory-cloud #1274) — owner/admin only. An agent is a
|
|
1397
|
+
* workspace-scoped registry entry (name unique per workspace) that
|
|
1398
|
+
* anchors context bindings, agent-bound credentials,
|
|
1399
|
+
* {@link getAgentBootstrap}, and audit correlation — it is a resource,
|
|
1400
|
+
* NOT a principal. New agents start with `status="active"` and
|
|
1401
|
+
* `enforcement_mode="enforce"`.
|
|
1402
|
+
*
|
|
1403
|
+
* Requires memory-cloud v0.49.0+ — older servers return an MCP
|
|
1404
|
+
* "tool not found" error ({@link MIN_SERVER_VERSION} is deliberately
|
|
1405
|
+
* not bumped; only the agent control plane needs the newer server).
|
|
1406
|
+
*
|
|
1407
|
+
* @throws KaguraError on name conflict, agent quota, or insufficient
|
|
1408
|
+
* role (owner/admin required).
|
|
1409
|
+
*/
|
|
1410
|
+
registerAgent(options: RegisterAgentOptions): Promise<Agent>;
|
|
1411
|
+
/**
|
|
1412
|
+
* Fetch one registered agent by id (owner/admin only).
|
|
1413
|
+
*
|
|
1414
|
+
* @throws KaguraNotFoundError when the agent does not exist. The 404 is
|
|
1415
|
+
* uniform (CWE-639) — nonexistent and not-yours are indistinguishable
|
|
1416
|
+
* by design, so it does NOT prove the agent is absent.
|
|
1417
|
+
*/
|
|
1418
|
+
getAgent(agentId: string): Promise<Agent>;
|
|
1419
|
+
/** List the workspace's registered agents, newest first (owner/admin only). */
|
|
1420
|
+
listAgents(): Promise<Agent[]>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Update a registered agent, including lifecycle transitions
|
|
1423
|
+
* (owner/admin only).
|
|
1424
|
+
*
|
|
1425
|
+
* `status` is the **fail-closed kill switch**: `"suspended"` /
|
|
1426
|
+
* `"retired"` agents cause every key bound to them to be rejected at
|
|
1427
|
+
* verify time. Setting `enforcementMode` from `"enforce"` to
|
|
1428
|
+
* `"shadow"` is an audited privilege-widening event.
|
|
1429
|
+
*
|
|
1430
|
+
* Set-only wrapper: omitted fields are left untouched. The server's
|
|
1431
|
+
* null-clears-a-metadata-field semantics is not expressible through
|
|
1432
|
+
* this wrapper — clear fields via the web UI or the raw API.
|
|
1433
|
+
*
|
|
1434
|
+
* @throws Error when no update field is provided (the call would be an
|
|
1435
|
+
* empty no-op request).
|
|
1436
|
+
*/
|
|
1437
|
+
updateAgent(options: UpdateAgentOptions): Promise<Agent>;
|
|
1438
|
+
/**
|
|
1439
|
+
* Hard-delete an Agent Registry row (owner/admin only). Returns true
|
|
1440
|
+
* once the server confirms deletion.
|
|
1441
|
+
*
|
|
1442
|
+
* Permanent, and cascades every API key bound to the agent
|
|
1443
|
+
* (fail-closed). Prefer `updateAgent({status: "retired"})` for
|
|
1444
|
+
* operational retirement.
|
|
1445
|
+
*/
|
|
1446
|
+
deleteAgent(agentId: string): Promise<boolean>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Build the omit-when-undefined binding scope trio shared by
|
|
1449
|
+
* {@link bindAgentContext} and {@link updateAgentBinding} — the port of
|
|
1450
|
+
* the Python SDK's `_binding_scope_payload`. When memory-cloud #1286
|
|
1451
|
+
* ships the reserved filters, extend {@link AgentBindingScopeOptions}
|
|
1452
|
+
* and map the new fields here.
|
|
1453
|
+
*/
|
|
1454
|
+
private static bindingScopeArgs;
|
|
1455
|
+
/**
|
|
1456
|
+
* Bind an agent to a context — purely subtractive scoping.
|
|
1457
|
+
*
|
|
1458
|
+
* Calls the `bind_agent_context` MCP tool (server v0.49.0+, RFC-0002
|
|
1459
|
+
* P0-2, memory-cloud #1275) — owner/admin only. The effective
|
|
1460
|
+
* permission for an agent-bound request is the existing RBAC decision
|
|
1461
|
+
* ∩ binding. Under `enforcement_mode="enforce"`, contexts WITHOUT a
|
|
1462
|
+
* binding row are denied for the agent (default-deny); under
|
|
1463
|
+
* `"shadow"`, violations are only logged.
|
|
1464
|
+
*
|
|
1465
|
+
* @throws KaguraNotFoundError when the agent or context is not found.
|
|
1466
|
+
* @throws KaguraError on duplicate binding or other server-side error.
|
|
1467
|
+
*/
|
|
1468
|
+
bindAgentContext(options: BindAgentContextOptions): Promise<AgentBinding>;
|
|
1469
|
+
/** List an agent's context bindings (owner/admin only). */
|
|
1470
|
+
listAgentBindings(agentId: string): Promise<AgentBinding[]>;
|
|
1471
|
+
/**
|
|
1472
|
+
* Update a binding's scoping fields (owner/admin only).
|
|
1473
|
+
*
|
|
1474
|
+
* `context_id` is immutable — {@link unbindAgentContext} and re-
|
|
1475
|
+
* {@link bindAgentContext} to re-target. Changes are audited with
|
|
1476
|
+
* old→new values.
|
|
1477
|
+
*
|
|
1478
|
+
* @throws Error when no scoping field is provided (the call would be
|
|
1479
|
+
* an empty no-op request).
|
|
1480
|
+
*/
|
|
1481
|
+
updateAgentBinding(options: UpdateAgentBindingOptions): Promise<AgentBinding>;
|
|
1482
|
+
/**
|
|
1483
|
+
* Delete a binding — the agent loses that context (owner/admin only).
|
|
1484
|
+
* Returns true once the server confirms deletion.
|
|
1485
|
+
*
|
|
1486
|
+
* Under `enforcement_mode="enforce"` the agent's requests against the
|
|
1487
|
+
* unbound context are denied afterwards (uniform `context_not_found`).
|
|
1488
|
+
*/
|
|
1489
|
+
unbindAgentContext(options: {
|
|
1490
|
+
agentId: string;
|
|
1491
|
+
bindingId: string;
|
|
1492
|
+
}): Promise<boolean>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Rehydrate an agent's cognitive state in one session-start call.
|
|
1495
|
+
*
|
|
1496
|
+
* Calls the `get_agent_bootstrap` MCP tool (server v0.49.0+, RFC-0002
|
|
1497
|
+
* P0-3, memory-cloud #1276). The server composes existing primitives —
|
|
1498
|
+
* context guide + pinned memories ({@link loadPinned}) + a trusted-only
|
|
1499
|
+
* {@link recall} (only when `query` is supplied) + upcoming time
|
|
1500
|
+
* memories ({@link recallUpcoming}) + the agent-state lane
|
|
1501
|
+
* ({@link getState}) — with bounds, ordering, and trust filtering
|
|
1502
|
+
* inherited from those standalone tools, not re-specified.
|
|
1503
|
+
*
|
|
1504
|
+
* Components are **fail-soft**: a failing component reports
|
|
1505
|
+
* `{"status": "error", ...}` under `components` while the rest still
|
|
1506
|
+
* return, with the top-level `degraded` flag set. Identity and
|
|
1507
|
+
* authorization failures are total and throw instead.
|
|
1508
|
+
*
|
|
1509
|
+
* The REST companion (`POST /api/v1/agents/{agent_id}/bootstrap`) is
|
|
1510
|
+
* available via `AgentsClient` for API-key-only callers such as
|
|
1511
|
+
* agent-bound member keys.
|
|
1512
|
+
*
|
|
1513
|
+
* @throws KaguraNotFoundError when the agent or context is not found
|
|
1514
|
+
* (uniform 404 — nonexistent and not-yours are indistinguishable by
|
|
1515
|
+
* design).
|
|
1516
|
+
* @throws KaguraError on invalid arguments or other server-side error.
|
|
1517
|
+
*/
|
|
1518
|
+
getAgentBootstrap(options: GetAgentBootstrapOptions): Promise<AgentBootstrapResponse>;
|
|
1128
1519
|
/** List available contexts. */
|
|
1129
1520
|
listContexts(): Promise<ToolResult>;
|
|
1130
1521
|
/**
|
|
@@ -1700,6 +2091,51 @@ declare class KaguraRestClient {
|
|
|
1700
2091
|
protected expectList(response: RestResponse): unknown[];
|
|
1701
2092
|
}
|
|
1702
2093
|
|
|
2094
|
+
/**
|
|
2095
|
+
* REST client for the agent bootstrap surface (issue #3, server
|
|
2096
|
+
* v0.49.0+) — port of the Python SDK's agents_client.py bootstrap call.
|
|
2097
|
+
*
|
|
2098
|
+
* The `get_agent_bootstrap` MCP tool has a REST companion —
|
|
2099
|
+
* `POST /api/v1/agents/{agent_id}/bootstrap` (RFC-0002 P0-3, memory-cloud
|
|
2100
|
+
* #1276) — authenticated with `APIKeyOrSessionUser`, so it accepts
|
|
2101
|
+
* agent-bound member keys: a deployed agent can rehydrate its cognitive
|
|
2102
|
+
* state without opening an MCP session. POST-for-read follows the
|
|
2103
|
+
* server's `POST /api/v1/memory/pinned` precedent.
|
|
2104
|
+
*
|
|
2105
|
+
* Construction, credential resolution, lifecycle, and the base error
|
|
2106
|
+
* mapping live in {@link KaguraRestClient}; this module keeps only the
|
|
2107
|
+
* bootstrap wire call. The registry/binding CRUD is MCP-only in this SDK
|
|
2108
|
+
* (KaguraClient) — provisioning is an operator task that has an MCP
|
|
2109
|
+
* session available.
|
|
2110
|
+
*/
|
|
2111
|
+
|
|
2112
|
+
/**
|
|
2113
|
+
* REST API client for agent bootstrap (memory-cloud v0.49.0+).
|
|
2114
|
+
*
|
|
2115
|
+
* Use this surface when the caller holds an API key but no MCP session —
|
|
2116
|
+
* e.g. an agent-bound member key minted for a deployed agent. Against an
|
|
2117
|
+
* older server the route 404s.
|
|
2118
|
+
*
|
|
2119
|
+
* All methods may reject with:
|
|
2120
|
+
* - `KaguraAuthError` — authentication failed (401)
|
|
2121
|
+
* - `KaguraConnectionError` — invalid arguments (400) or any other
|
|
2122
|
+
* HTTP/connection error
|
|
2123
|
+
* - `KaguraNotFoundError` — agent or context not found (404). The 404 is
|
|
2124
|
+
* uniform (CWE-639) — nonexistent and not-yours are indistinguishable
|
|
2125
|
+
* by design, so a 404 does NOT prove the agent is absent.
|
|
2126
|
+
* - `KaguraQuotaError` — rate limit exceeded (429)
|
|
2127
|
+
*/
|
|
2128
|
+
declare class AgentsClient extends KaguraRestClient {
|
|
2129
|
+
/**
|
|
2130
|
+
* Rehydrate an agent's cognitive state at session start.
|
|
2131
|
+
*
|
|
2132
|
+
* REST companion to `KaguraClient.getAgentBootstrap` — same options,
|
|
2133
|
+
* same composed envelope, same fail-soft component semantics (see that
|
|
2134
|
+
* method for the full contract).
|
|
2135
|
+
*/
|
|
2136
|
+
bootstrap(options: GetAgentBootstrapOptions): Promise<AgentBootstrapResponse>;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
1703
2139
|
/**
|
|
1704
2140
|
* REST client for Kagura Memory Cloud file uploads (port of files_client.py).
|
|
1705
2141
|
*
|
|
@@ -2231,4 +2667,4 @@ interface ResolveAuthOptions {
|
|
|
2231
2667
|
*/
|
|
2232
2668
|
declare function resolveAuth(options?: ResolveAuthOptions): ResolvedAuth;
|
|
2233
2669
|
|
|
2234
|
-
export { type AnalysisResult, type Artifact, type AuthProvider, type AuthSource, type ContextDetail, type ContextInfo, type ContextStats, type CostBreakdown, type CreateContextOptions, type CreateInvitationOptions, type CreateTokenOptions, DEFAULT_MCP_URL, DEFAULT_REST_BASE_URL, type DeliveryMode, type DuplicateMemoryInfo, type DuplicatePair, type DuplicatesResponse, type Edge, type EmbeddingModel, type EmbeddingModelsResponse, type EmbeddingStatus, type ExploredMemory, type FailedMemoryInfo, type FieldDefinition, type FileDownloadUrlResponse, type FileListResponse, type FileObject, type FileReserveResponse, FilesClient, type FilesClientOptions, type FromMcpUrlOptions, type HttpMethod, type IndexerJobStatus, type IndexerSkippedReason, type IndexerState, type IndexerStateMetrics, type IndexerStatusResponse, type IngestErrorRecord, type IngestResult, KaguraAuthDeniedError, KaguraAuthError, KaguraAuthExpiredError, KaguraClient, type KaguraClientOptions, type KaguraConfig, KaguraConnectionError, KaguraContextError, KaguraError, KaguraFetchError, KaguraIngestError, KaguraIntegrityError, KaguraLLMError, KaguraNotFoundError, KaguraQuotaError, KaguraRateLimitError, KaguraRestClient, type KaguraRestClientOptions, type LLMUsage, type ListInvitationsOptions, type ListMemoriesOptions, type ListResourceEventsOptions, type ListTagsOptions, type ListTagsResponse, type ListTokensOptions, type LoadConfigOptions, MIN_SERVER_VERSION, type MemberAPIKey, type Memory, type MemoryInfo, type MemoryListItem, type MemoryListResponse, type MemoryStatItem, type MemoryStatsResponse, type MemoryToStore, type Message, type OAuthAuthResult, type PaginatedResourceTokensResponse, type ProcessResult, type RecallOptions, type RecallQuery, type RememberOptions, type ResolveAuthOptions, type ResolvedAuth, ResourceClient, type ResourceEventBatchRequest, type ResourceEventBatchResponse, type ResourceEventInput, type ResourceEventItem, type ResourceEventRecord, type ResourceEventRequest, type ResourceEventResponse, type ResourceEventsListResponse, type ResourceImpactResponse, type ResourceListItem, type ResourceListResponse, type ResourceSchemaResponse, type ResourceSetupOptions, type ResourceSetupResponse, type ResourceTokenCreate, type ResourceTokenCreateResponse, type ResourceTokenResponse, type ResourceTokenUpdate, type RollbackResult, type RollbackSummary, SDK_VERSION, SETUP_OAUTH_NOT_SUPPORTED_MSG, type SearchConfig, type SearchMode, type ServerFeatures, type ServerInfo, type Session, type SetupResourceOptions, type SleepAction, type SleepReport, type SleepReportDetail, type SleepRunStatus, type SourceType, type StaticAuthResult, type StaticSource, type TagInfo, type ToolResult, type UpdateContextOptions, type UpdateMemoryOptions, type UpdateSearchConfigOptions, type UpdateTokenOptions, type UploadOptions, type UsageInfo, type UsageQuota, type UsageQuotaLimitOnly, VALID_ASSIGNABLE_ROLES, VALID_INVITE_EXPIRES, WorkspaceClient, type WorkspaceInfo, type WorkspaceInvitation, type WorkspaceMember, loadConfig, resolveAuth };
|
|
2670
|
+
export { type Agent, type AgentBinding, type AgentBindingScopeOptions, type AgentBootstrapAgent, type AgentBootstrapBinding, type AgentBootstrapComponent, type AgentBootstrapComponentName, type AgentBootstrapCorrelation, type AgentBootstrapResponse, type AgentEnforcementMode, type AgentStatus, type AgentWritePolicy, AgentsClient, type AnalysisResult, type Artifact, type AuthProvider, type AuthSource, type BindAgentContextOptions, type ContextDetail, type ContextInfo, type ContextStats, type CostBreakdown, type CreateContextOptions, type CreateInvitationOptions, type CreateTokenOptions, DEFAULT_MCP_URL, DEFAULT_REST_BASE_URL, type DeliveryMode, type DuplicateMemoryInfo, type DuplicatePair, type DuplicatesResponse, type Edge, type EmbeddingModel, type EmbeddingModelsResponse, type EmbeddingStatus, type ExploredMemory, type FailedMemoryInfo, type FieldDefinition, type FileDownloadUrlResponse, type FileListResponse, type FileObject, type FileReserveResponse, FilesClient, type FilesClientOptions, type FromMcpUrlOptions, type GetAgentBootstrapOptions, type HttpMethod, type IndexerJobStatus, type IndexerSkippedReason, type IndexerState, type IndexerStateMetrics, type IndexerStatusResponse, type IngestErrorRecord, type IngestResult, KaguraAuthDeniedError, KaguraAuthError, KaguraAuthExpiredError, KaguraClient, type KaguraClientOptions, type KaguraConfig, KaguraConnectionError, KaguraContextError, KaguraError, KaguraFetchError, KaguraIngestError, KaguraIntegrityError, KaguraLLMError, KaguraNotFoundError, KaguraQuotaError, KaguraRateLimitError, KaguraRestClient, type KaguraRestClientOptions, type LLMUsage, type ListInvitationsOptions, type ListMemoriesOptions, type ListResourceEventsOptions, type ListTagsOptions, type ListTagsResponse, type ListTokensOptions, type LoadConfigOptions, MIN_SERVER_VERSION, type MemberAPIKey, type Memory, type MemoryInfo, type MemoryListItem, type MemoryListResponse, type MemoryStatItem, type MemoryStatsResponse, type MemoryToStore, type Message, type OAuthAuthResult, type PaginatedResourceTokensResponse, type ProcessResult, type RecallOptions, type RecallQuery, type RegisterAgentOptions, type RememberOptions, type ResolveAuthOptions, type ResolvedAuth, ResourceClient, type ResourceEventBatchRequest, type ResourceEventBatchResponse, type ResourceEventInput, type ResourceEventItem, type ResourceEventRecord, type ResourceEventRequest, type ResourceEventResponse, type ResourceEventsListResponse, type ResourceImpactResponse, type ResourceListItem, type ResourceListResponse, type ResourceSchemaResponse, type ResourceSetupOptions, type ResourceSetupResponse, type ResourceTokenCreate, type ResourceTokenCreateResponse, type ResourceTokenResponse, type ResourceTokenUpdate, type RollbackResult, type RollbackSummary, SDK_VERSION, SETUP_OAUTH_NOT_SUPPORTED_MSG, type SearchConfig, type SearchMode, type ServerFeatures, type ServerInfo, type Session, type SetupResourceOptions, type SleepAction, type SleepReport, type SleepReportDetail, type SleepRunStatus, type SourceType, type StaticAuthResult, type StaticSource, type TagInfo, type ToolResult, type UpdateAgentBindingOptions, type UpdateAgentOptions, type UpdateContextOptions, type UpdateMemoryOptions, type UpdateSearchConfigOptions, type UpdateTokenOptions, type UploadOptions, type UsageInfo, type UsageQuota, type UsageQuotaLimitOnly, VALID_ASSIGNABLE_ROLES, VALID_INVITE_EXPIRES, WorkspaceClient, type WorkspaceInfo, type WorkspaceInvitation, type WorkspaceMember, loadConfig, resolveAuth };
|