@prismer/sdk 1.9.0 → 1.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -864,6 +864,12 @@ interface IMCreateTaskOptions {
864
864
  retryDelayMs?: number;
865
865
  budget?: number;
866
866
  metadata?: Record<string, unknown>;
867
+ /** v1.9.x: workspace scope. Defaults to caller's default workspace. */
868
+ workspaceId?: string;
869
+ /** v1.9.x: link task to a conversation thread. */
870
+ conversationId?: string;
871
+ /** v1.9.x: pick the executor — `agent` (default), `sandbox`, or `shell`. */
872
+ runtimeRoute?: 'agent' | 'sandbox' | 'shell';
867
873
  }
868
874
  interface IMUpdateTaskOptions {
869
875
  title?: string;
@@ -877,11 +883,19 @@ interface IMUpdateTaskOptions {
877
883
  interface IMTaskListOptions {
878
884
  status?: TaskStatus;
879
885
  capability?: string;
886
+ /** Filter by task-store semantic kind. Defaults to board work items/goals. */
887
+ kind?: string;
888
+ /** Explicit view selection: board, runs, or all. */
889
+ view?: 'board' | 'runs' | 'all';
880
890
  assigneeId?: string;
881
891
  creatorId?: string;
882
892
  scheduleType?: ScheduleType;
883
893
  limit?: number;
884
894
  cursor?: string;
895
+ /** v1.9.x: filter by workspace. */
896
+ workspaceId?: string;
897
+ /** v1.9.x: filter by conversation. */
898
+ conversationId?: string;
885
899
  }
886
900
  interface IMCompleteTaskOptions {
887
901
  result?: unknown;
@@ -941,6 +955,35 @@ interface IMTaskDetail {
941
955
  task: IMTask;
942
956
  logs: IMTaskLog[];
943
957
  }
958
+ /**
959
+ * Wave-9 Phase 1 (v1.9.4) — canonical task / run result.
960
+ *
961
+ * Replaces the legacy IMAsset(kind=task-result) read pattern. Returned by
962
+ * `tasks.getResult()` and `tasks.getRunResult()`. Shape locked by design
963
+ * review and intentionally minimal.
964
+ *
965
+ * - `output` The agent's primary text reply, normalised from the
966
+ * stored result JSON. May be null for tasks that
967
+ * completed with no textual content.
968
+ * - `assetIds` Daemon-collected outbox attachments (Wave-9). Always
969
+ * an array (possibly empty); never undefined.
970
+ * - `metrics` Adapter cost / duration / tokens. Optional — older
971
+ * tasks predate the column.
972
+ * - `resultUri` Optional prismer:// pointer for blob results. Most
973
+ * tasks use the inline `output` field; this is for
974
+ * cases that exceed the JSON column budget.
975
+ * - `completedAt` ISO string. For pending/running tasks falls back to
976
+ * `updatedAt` so the field is always populated.
977
+ */
978
+ interface IMTaskResult {
979
+ taskId: string;
980
+ status: string;
981
+ output: string | null;
982
+ metrics?: Record<string, unknown> | null;
983
+ assetIds: string[];
984
+ resultUri?: string | null;
985
+ completedAt: string;
986
+ }
944
987
  interface IMCreateMemoryFileOptions {
945
988
  path: string;
946
989
  content: string;
@@ -1289,6 +1332,251 @@ interface EvolutionSyncDelta {
1289
1332
  cursor: number;
1290
1333
  };
1291
1334
  }
1335
+ /**
1336
+ * Top-level workspace resource (v1.9.x). 1.9.x is 1:1 — most accounts have a
1337
+ * single default workspace named "Personal". Multi-workspace promotion is a
1338
+ * 1.10+ concern.
1339
+ */
1340
+ interface IMWorkspace {
1341
+ id: string;
1342
+ ownerImUserId: string;
1343
+ name: string;
1344
+ /** URL-safe slug; immutable in 1.9.x. Pattern: `^[a-z0-9][a-z0-9-]{0,63}$`. */
1345
+ slug: string;
1346
+ isDefault: boolean;
1347
+ metadata: Record<string, unknown>;
1348
+ createdAt: string;
1349
+ updatedAt: string;
1350
+ }
1351
+ interface IMCreateWorkspaceOptions {
1352
+ name: string;
1353
+ slug: string;
1354
+ isDefault?: boolean;
1355
+ metadata?: Record<string, unknown>;
1356
+ }
1357
+ interface IMUpdateWorkspaceOptions {
1358
+ /** Display name (immutable fields: slug, isDefault). */
1359
+ name?: string;
1360
+ metadata?: Record<string, unknown>;
1361
+ }
1362
+ interface IMWorkspaceSyncResult {
1363
+ items: IMWorkspace[];
1364
+ /** ISO timestamp cursor for next sync, or null when no rows returned. */
1365
+ cursor: string | null;
1366
+ }
1367
+ /**
1368
+ * Workspace file = path → assetId binding inside a workspace. Auto-versions
1369
+ * on POST: previous binding at the same path is soft-deleted, version bumps,
1370
+ * and `parentVersionId` chains the history.
1371
+ */
1372
+ interface IMWorkspaceFile {
1373
+ id: string;
1374
+ workspaceId: string;
1375
+ path: string;
1376
+ assetId: string;
1377
+ contentHash?: string;
1378
+ version: number;
1379
+ parentVersionId: string | null;
1380
+ modifierImUserId: string;
1381
+ createdAt: string;
1382
+ updatedAt: string;
1383
+ deletedAt: string | null;
1384
+ }
1385
+ interface IMCreateWorkspaceFileOptions {
1386
+ /** Relative path; no `..`, no leading `/`, ≤ 700 chars. */
1387
+ path: string;
1388
+ /** Existing asset ID in the same workspace. */
1389
+ assetId: string;
1390
+ }
1391
+ interface IMWorkspaceFileSyncResult {
1392
+ items: IMWorkspaceFile[];
1393
+ cursor: string | null;
1394
+ }
1395
+ /**
1396
+ * Asset = content-addressed immutable blob (sha256). Same hash + same workspace
1397
+ * dedupes to a single row.
1398
+ */
1399
+ interface IMAsset {
1400
+ id: string;
1401
+ workspaceId: string;
1402
+ ownerImUserId: string;
1403
+ contentHash: string;
1404
+ /** `file://...` for filesystem backend, `s3://bucket/key` for S3 backend. */
1405
+ storageUri: string;
1406
+ sizeBytes: number | null;
1407
+ mime: string | null;
1408
+ /** Caller-supplied row-level kind label. Common values: `sandbox-output`, `photo-memory-segment`, `user-upload`. */
1409
+ kind: string;
1410
+ sourceAgentImUserId: string | null;
1411
+ sourceTaskId: string | null;
1412
+ metadata: Record<string, unknown>;
1413
+ createdAt: string;
1414
+ }
1415
+ interface IMAssetListOptions {
1416
+ workspaceId?: string;
1417
+ taskId?: string;
1418
+ kind?: string;
1419
+ /** Page size, 1–200. Default 50. */
1420
+ limit?: number;
1421
+ }
1422
+ interface IMAssetUploadOptions {
1423
+ workspaceId: string;
1424
+ /** Row-level asset kind label (e.g. `sandbox-output`, `user-upload`). */
1425
+ kind?: string;
1426
+ sourceAgentImUserId?: string;
1427
+ sourceTaskId?: string;
1428
+ /** Override the auto-detected MIME type. */
1429
+ mimeType?: string;
1430
+ /** Override the file name when input has none (Buffer / Uint8Array). */
1431
+ fileName?: string;
1432
+ metadata?: Record<string, unknown>;
1433
+ /** Progress callback. */
1434
+ onProgress?: (uploaded: number, total: number) => void;
1435
+ }
1436
+ interface IMAssetDetail extends IMAsset {
1437
+ /** Freshly-signed S3 URL when storage is S3, else `null`. Expires per `expiresIn` seconds. */
1438
+ url?: string | null;
1439
+ s3Url?: string | null;
1440
+ expiresIn?: number;
1441
+ /** Reverse-lookup of `photo-memory-segment` references when applicable. */
1442
+ photoRefs?: Array<{
1443
+ localId: string;
1444
+ sourceHash: string;
1445
+ assetId: string;
1446
+ }>;
1447
+ }
1448
+ /**
1449
+ * Runtime installation = long-running daemon host inside a workspace
1450
+ * (vs. short-lived per-task sandbox). Built on top of IMContainer rows
1451
+ * with `taskId === null`.
1452
+ */
1453
+ type RuntimePhase = 'provisioning' | 'online' | 'degraded' | 'stopped' | 'failed';
1454
+ interface IMRuntimeInstallation {
1455
+ id: string;
1456
+ workspaceId: string;
1457
+ runtimeInstanceId: string;
1458
+ daemonId: string;
1459
+ podName: string;
1460
+ namespace: string;
1461
+ phase: RuntimePhase;
1462
+ desiredState: 'running' | 'stopped' | string;
1463
+ status: string;
1464
+ image: string;
1465
+ imageTag: string;
1466
+ warmPoolHit: boolean;
1467
+ resources: {
1468
+ cpuRequest: string;
1469
+ cpuLimit: string;
1470
+ memoryRequest: string;
1471
+ memoryLimit: string;
1472
+ };
1473
+ gatewayUrl: string | null;
1474
+ startedAt: string | null;
1475
+ stoppedAt: string | null;
1476
+ createdAt: string;
1477
+ updatedAt: string;
1478
+ metrics: {
1479
+ ageMs: number;
1480
+ provisionLatencyMs: number;
1481
+ heartbeatAgeMs: number | null;
1482
+ hostedAgents: number;
1483
+ onlineHostedAgents: number;
1484
+ };
1485
+ observability: {
1486
+ statusFreshness: string;
1487
+ logsPath: string;
1488
+ startPath: string;
1489
+ stopPath: string;
1490
+ snapshotPath: string;
1491
+ };
1492
+ events: Array<{
1493
+ at: string;
1494
+ kind: string;
1495
+ severity: string;
1496
+ message: string;
1497
+ }>;
1498
+ }
1499
+ interface IMCreateRuntimeInstallationOptions {
1500
+ workspaceId: string;
1501
+ name?: string;
1502
+ image?: string;
1503
+ cpuRequest?: string;
1504
+ cpuLimit?: string;
1505
+ memoryRequest?: string;
1506
+ memoryLimit?: string;
1507
+ }
1508
+ interface IMInstallAgentOnRuntimeOptions {
1509
+ agentImUserId: string;
1510
+ /** Existing AgentProfile id; if omitted, creates one with `adapterName` + `profileName`. */
1511
+ profileId?: string;
1512
+ adapterName?: string;
1513
+ profileName?: string;
1514
+ config?: Record<string, unknown>;
1515
+ }
1516
+ interface IMInstallAgentOnRuntimeResult {
1517
+ runtimeInstallationId: string;
1518
+ podName: string;
1519
+ result: unknown;
1520
+ profile: {
1521
+ id: string;
1522
+ agentImUserId: string;
1523
+ adapterName: string;
1524
+ name: string;
1525
+ version: number;
1526
+ };
1527
+ }
1528
+ /** Row from `GET /api/im/me/agents` — agents owned by the current human. */
1529
+ interface IMOwnedAgent {
1530
+ id: string;
1531
+ username: string;
1532
+ displayName: string;
1533
+ agentType: string | null;
1534
+ avatarUrl: string | null;
1535
+ createdAt: string;
1536
+ card: {
1537
+ name: string;
1538
+ description: string | null;
1539
+ capabilities: string[];
1540
+ endpoint: string | null;
1541
+ status: string;
1542
+ workspaceId: string;
1543
+ lastHeartbeat: string | null;
1544
+ } | null;
1545
+ }
1546
+ interface IMAccountDeleteResult {
1547
+ message: string;
1548
+ deletedAt: string;
1549
+ cascade: Record<string, unknown>;
1550
+ }
1551
+ /** Memory digest (CC-style always-load summary) */
1552
+ interface IMMemoryDigest {
1553
+ digest: string;
1554
+ totalLines: number;
1555
+ totalBytes: number;
1556
+ filesSummarized: number;
1557
+ filesTotal: number;
1558
+ truncated: boolean;
1559
+ generatedAt: string;
1560
+ }
1561
+ interface IMMemoryDigestOptions {
1562
+ scope?: string;
1563
+ /** 10–1000 (clamped server-side); default 200. */
1564
+ maxLines?: number;
1565
+ /** 500–30000 (clamped server-side); default 6000. */
1566
+ maxBytes?: number;
1567
+ }
1568
+ /** Task SSE events (v1.8.2) */
1569
+ type TaskEventType = 'connected' | 'task.created' | 'task.assigned' | 'task.progress' | 'task.completed' | 'task.failed' | 'task.cancelled' | 'task.updated';
1570
+ interface TaskEventEnvelope<P = Record<string, unknown>> {
1571
+ /** Stable event id (`Last-Event-ID` for replay). */
1572
+ id?: string;
1573
+ type: TaskEventType;
1574
+ payload: P;
1575
+ }
1576
+ /** Task `kind` taxonomy (v1.9.x). Server reads `metadata.kind` to drive goal projections. */
1577
+ type TaskKind = 'work_item' | 'goal';
1578
+ /** Task `runtimeRoute` taxonomy (v1.9.x). Picks which executor handles dispatch. */
1579
+ type RuntimeRoute = 'agent' | 'sandbox' | 'shell';
1292
1580
 
1293
1581
  /**
1294
1582
  * Prismer Cloud Real-Time Client — WebSocket & SSE transports.
@@ -1926,498 +2214,139 @@ declare class CommunityHub {
1926
2214
  }
1927
2215
 
1928
2216
  /**
1929
- * Prismer Remote Control Client Cloud SDK bindings for Track 3 (v1.9.0)
2217
+ * Prismer SDKIM WS protocol payload types (v1.9.x)
1930
2218
  *
1931
- * Scope:
1932
- * - Desktop binding management (list / revoke / republish candidates)
1933
- * - Pairing workflows
1934
- * • Daemon-side: pair.qrInit + pair.apiKeyBind
1935
- * • Mobile-side: pair.qrConfirm
1936
- * - Remote command dispatch (sendCommand / getCommand / approve / reject)
1937
- * - Push token registration + lifecycle (register / list / delete)
1938
- * - FS relay — mobile → daemon sandboxed filesystem ops (v1.9.0)
2219
+ * Mirror of `src/im/types/im-events.ts` from the cloud package, kept in sync
2220
+ * so that runtime/ws-client (Track B) and other SDK consumers compile against
2221
+ * the same wire shapes the cloud handlers accept and emit.
1939
2222
  *
1940
- * Note on signatures: the `approve` / `reject` / `sendCommand` methods take
1941
- * a `bindingId` + opaque `envelope`, NOT a `commandId`. The server creates
1942
- * the command and returns its id. This matches the `/api/im/remote/*`
1943
- * HTTP contract exactly.
1944
- */
1945
- interface PrismerResponse<T> {
1946
- ok: boolean;
1947
- data: T | null;
1948
- error: {
1949
- code: string;
1950
- message: string;
1951
- } | null;
1952
- }
1953
- /**
1954
- * Daemon connection candidate advertised in the pairing offer or via
1955
- * PATCH /remote/bindings/:id/candidates. Client selects lowest-latency path;
1956
- * E2EE is always applied on top regardless of transport.
2223
+ * Source of truth: `docs/refactor/03-ws-protocol.md` (Track C). When the cloud
2224
+ * file changes, this file MUST change in lockstep they describe the same
2225
+ * wire protocol. There is no automatic generation; both files are hand-maintained
2226
+ * to avoid a build dependency between the cloud Next.js app and the SDK.
2227
+ *
2228
+ * AgentStatus enum is duplicated locally (not re-exported from cloud) because
2229
+ * the SDK is shipped as an independent npm package with no dependency on the
2230
+ * Next.js app.
2231
+ *
2232
+ * m1 status (all 11 types finalized; mirrors cloud file):
2233
+ * ✅ agent.host.declare / host.acked
2234
+ * ✅ agent.status.changed
2235
+ * ✅ task.dispatch.request / .progress / .reply
2236
+ * ✅ task.cancel
2237
+ * agent.changed
2238
+ * workspace.changed
2239
+ * agent_profile.changed
2240
+ * ✅ workspace_file.changed
1957
2241
  */
1958
- type OfferCandidate = {
1959
- type: 'directTcp';
1960
- host: string;
1961
- port: number;
1962
- } | {
1963
- type: 'relay';
1964
- endpoint: string;
1965
- };
1966
- interface DesktopBinding {
1967
- id: string;
1968
- daemonId: string;
1969
- deviceName?: string | null;
1970
- bindingMethod: 'apikey' | 'qr';
1971
- status: 'active' | 'revoked';
1972
- daemonPubKey: string;
1973
- daemonSignPub: string;
1974
- relayRegion?: string | null;
1975
- /** Serialized BigInt — use as opaque string, don't parse as number. */
1976
- lastSeq: string;
1977
- isOnline: boolean;
1978
- candidates: OfferCandidate[] | null;
1979
- createdAt: string;
1980
- }
1981
- interface QrInitRequest {
1982
- daemonId: string;
1983
- daemonPubKey: string;
1984
- daemonSignPub: string;
1985
- /** base64-encoded Offer v2 JSON; see docs/version190/07-remote-control.md §5.6.2 */
1986
- offerBlob: string;
1987
- deviceName?: string;
1988
- }
1989
- interface QrInitResponse {
1990
- offerId: string;
1991
- /** RFC 3339 / ISO 8601 */
1992
- expiresAt: string;
1993
- }
1994
- interface ApiKeyBindRequest {
1995
- daemonId: string;
1996
- daemonPubKey: string;
1997
- daemonSignPub: string;
1998
- deviceName?: string;
1999
- relayRegion?: string;
2000
- candidates?: OfferCandidate[];
2001
- }
2002
- interface ApiKeyBindResponse {
2003
- bindingId: string;
2004
- }
2005
- interface QrConfirmRequest {
2006
- /** `offerId` is encoded inside the QR payload; parse it out before calling. */
2007
- offerId: string;
2008
- /** Mobile's ephemeral X25519 public key (base64) for E2EE key exchange. */
2009
- clientPubKey: string;
2010
- consumerDevice?: string;
2242
+ /** Subset of the cloud-side AgentStatus enum used by status-change events. */
2243
+ type IMAgentStatus = 'online' | 'busy' | 'idle' | 'offline';
2244
+ interface HostedAgentDeclaration {
2245
+ imUserId: string;
2246
+ name: string;
2247
+ adapterName: string;
2248
+ capabilities: string[];
2249
+ profiles: Array<{
2250
+ id: string;
2251
+ version: number;
2252
+ }>;
2011
2253
  }
2012
- interface QrConfirmResponse {
2013
- bindingId: string;
2254
+ interface AgentHostDeclarePayload {
2014
2255
  daemonId: string;
2256
+ daemonVersion: string;
2257
+ platform: 'darwin' | 'linux' | 'win32';
2258
+ agents: HostedAgentDeclaration[];
2015
2259
  }
2016
- type RemoteCommandStatus = 'pending' | 'delivered' | 'completed' | 'failed' | 'expired';
2017
- interface RemoteCommand {
2018
- id: string;
2019
- bindingId: string;
2020
- senderId: string;
2021
- type: string;
2022
- /** Decoded envelope — object when structured, string when legacy base64. */
2023
- envelope: unknown;
2024
- status: RemoteCommandStatus;
2025
- result?: unknown;
2026
- createdAt: string;
2027
- deliveredAt?: string | null;
2028
- completedAt?: string | null;
2029
- }
2030
- interface SendCommandRequest {
2031
- bindingId: string;
2032
- /** e.g. `"tool_approve"`, `"tool_reject"`, `"agent_stop"`. */
2033
- type: string;
2034
- /** Forwarded verbatim to the daemon. Object is JSON-encoded; string is passed through. */
2035
- envelope: Record<string, unknown> | string;
2036
- ttlMs?: number;
2037
- }
2038
- interface QuickDecisionRequest {
2039
- bindingId: string;
2040
- envelope: Record<string, unknown> | string;
2041
- /** Optional task bridge — if set, the server also transitions the task state. */
2042
- taskId?: string;
2043
- }
2044
- interface RegisterPushTokenRequest {
2045
- platform: 'apns' | 'fcm';
2046
- token: string;
2047
- deviceId?: string;
2048
- }
2049
- interface PushToken {
2050
- id: string;
2051
- platform: 'apns' | 'fcm';
2052
- token: string;
2053
- deviceId: string | null;
2054
- createdAt: string;
2055
- }
2056
- type FsOp = 'read' | 'write' | 'delete' | 'edit' | 'list' | 'search';
2057
- interface FsReadRequest {
2058
- path: string;
2059
- encoding?: 'utf-8' | 'base64';
2260
+ interface HostAckedPayload {
2261
+ workspaceId: string;
2262
+ syncCursor: {
2263
+ workspaces: number;
2264
+ agent_profiles: number;
2265
+ [key: string]: number;
2266
+ };
2267
+ profilesToSync: string[];
2060
2268
  }
2061
- interface FsReadResponse {
2062
- content: string;
2063
- encoding: 'utf-8' | 'base64';
2269
+ interface AgentStatusChangedPayload {
2270
+ agentImUserId: string;
2271
+ status: IMAgentStatus;
2272
+ activeProfileId?: string;
2273
+ runningTaskIds?: string[];
2064
2274
  }
2065
- interface FsWriteRequest {
2066
- path: string;
2275
+ interface TaskDispatchContextEntry {
2276
+ sender: string;
2277
+ senderRole: 'human' | 'agent' | 'admin' | 'system';
2067
2278
  content: string;
2068
- encoding?: 'utf-8' | 'base64';
2069
- }
2070
- interface FsWriteResponse {
2071
- bytesWritten: number;
2072
- }
2073
- interface FsDeleteRequest {
2074
- path: string;
2075
- }
2076
- interface FsDeleteResponse {
2077
- deleted: boolean;
2078
- }
2079
- interface FsEditRequest {
2080
- path: string;
2081
- oldString: string;
2082
- newString: string;
2083
- replaceAll?: boolean;
2084
- }
2085
- interface FsEditResponse {
2086
- replaced: number;
2087
- path: string;
2088
- }
2089
- interface FsListRequest {
2090
- path: string;
2091
- recursive?: boolean;
2092
- }
2093
- interface FsListEntry {
2094
- name: string;
2095
- type: 'file' | 'dir' | 'symlink';
2096
- size?: number;
2097
- }
2098
- interface FsListResponse {
2099
- entries: FsListEntry[];
2100
- }
2101
- interface FsSearchRequest {
2102
- path: string;
2103
- pattern: string;
2104
- glob?: string;
2105
- }
2106
- interface FsSearchMatch {
2107
- path: string;
2108
- line: number;
2109
- preview: string;
2110
- }
2111
- interface FsSearchResponse {
2112
- matches: FsSearchMatch[];
2113
- }
2114
- declare class PairingApi {
2115
- private readonly client;
2116
- constructor(client: RemoteClient);
2117
- /**
2118
- * Daemon-side: create a QR pairing offer. `offerBlob` is the base64-encoded
2119
- * Offer v2 JSON — the daemon generates it locally and the cloud only stores
2120
- * it opaquely (5-minute TTL, single-use).
2121
- */
2122
- qrInit(req: QrInitRequest): Promise<PrismerResponse<QrInitResponse>>;
2123
- /**
2124
- * Mobile-side: confirm a scanned QR pairing. Atomically consumes the offer
2125
- * and pushes `pairing.confirmed` to the daemon's WS control channel.
2126
- */
2127
- qrConfirm(req: QrConfirmRequest): Promise<PrismerResponse<QrConfirmResponse>>;
2128
- /**
2129
- * Daemon-side: bind directly via API key, no QR required. The auth header
2130
- * identifies the owning user; the body carries daemon credentials + optional
2131
- * LAN/relay candidates.
2132
- */
2133
- apiKeyBind(req: ApiKeyBindRequest): Promise<PrismerResponse<ApiKeyBindResponse>>;
2134
- }
2135
- declare class FsApi {
2136
- private readonly client;
2137
- private readonly bindingId;
2138
- constructor(client: RemoteClient, bindingId: string);
2139
- private _path;
2140
- read(req: FsReadRequest): Promise<PrismerResponse<FsReadResponse>>;
2141
- write(req: FsWriteRequest): Promise<PrismerResponse<FsWriteResponse>>;
2142
- delete(req: FsDeleteRequest): Promise<PrismerResponse<FsDeleteResponse>>;
2143
- edit(req: FsEditRequest): Promise<PrismerResponse<FsEditResponse>>;
2144
- list(req: FsListRequest): Promise<PrismerResponse<FsListResponse>>;
2145
- search(req: FsSearchRequest): Promise<PrismerResponse<FsSearchResponse>>;
2146
- }
2147
- declare class RemoteClient {
2148
- private readonly baseUrl;
2149
- private readonly apiKey;
2150
- private readonly timeout;
2151
- private readonly fetchFn;
2152
- readonly pair: PairingApi;
2153
- constructor({ baseUrl, apiKey, timeout, fetchFn, }?: {
2154
- baseUrl?: string;
2155
- apiKey?: string;
2156
- timeout?: number;
2157
- fetchFn?: typeof fetch;
2158
- });
2159
- listBindings(): Promise<PrismerResponse<DesktopBinding[]>>;
2160
- deleteBinding(bindingId: string): Promise<PrismerResponse<void>>;
2161
- /**
2162
- * v1.9.0 — Daemon republishes its LAN/relay candidates (e.g. LAN IP
2163
- * changed, relay region failover). Ownership is verified against the auth.
2164
- */
2165
- patchBindingCandidates(bindingId: string, candidates: OfferCandidate[]): Promise<PrismerResponse<void>>;
2166
- /** Mobile-side FS relay client bound to a specific binding. */
2167
- fs(bindingId: string): FsApi;
2168
- sendCommand(req: SendCommandRequest): Promise<PrismerResponse<{
2169
- commandId: string;
2170
- status: RemoteCommandStatus;
2171
- }>>;
2172
- getCommand(commandId: string): Promise<PrismerResponse<RemoteCommand>>;
2173
- /**
2174
- * Quick-approve a pending tool call. Creates a `tool_approve` command and
2175
- * forwards it via WS (if daemon online). Optionally bridges to task state
2176
- * when `taskId` is provided.
2177
- */
2178
- approve(req: QuickDecisionRequest): Promise<PrismerResponse<{
2179
- commandId: string;
2180
- }>>;
2181
- reject(req: QuickDecisionRequest): Promise<PrismerResponse<{
2182
- commandId: string;
2183
- }>>;
2184
- registerPushToken(req: RegisterPushTokenRequest): Promise<PrismerResponse<{
2185
- success: boolean;
2186
- }>>;
2187
- listPushTokens(): Promise<PrismerResponse<{
2188
- tokens: PushToken[];
2189
- }>>;
2190
- /** Revoke a push token by its ID (not by raw token string). */
2191
- deletePushToken(tokenId: string): Promise<PrismerResponse<{
2192
- success: boolean;
2193
- }>>;
2194
- _get<T>(path: string): Promise<PrismerResponse<T>>;
2195
- _post<T>(path: string, body?: unknown): Promise<PrismerResponse<T>>;
2196
- _patch<T>(path: string, body?: unknown): Promise<PrismerResponse<T>>;
2197
- _delete<T>(path: string): Promise<PrismerResponse<T>>;
2198
- private _request;
2199
- private _getHeaders;
2200
- }
2201
-
2202
- /**
2203
- * Prismer Permissions Client — Cloud SDK bindings (v1.9.0)
2204
- *
2205
- * Risk-based approval gate for high-risk daemon/agent operations.
2206
- *
2207
- * Typical flow:
2208
- * 1. Daemon calls `request({capability, operation, context?})`.
2209
- * • Response 200 with `{approved:true}` → proceed immediately (low risk).
2210
- * • Response 202 with `{requestId, expiresAt}` → wait for user decision.
2211
- * 2. Mobile Lumin app polls `list({status:"pending"})` or reacts to push,
2212
- * then calls `approve(id)` or `reject(id)` with optional `reason`.
2213
- * 3. Daemon polls `get(id)` (or subscribes to the approval WS channel) to
2214
- * discover the decision before the TTL expires (default 5 min).
2215
- */
2216
-
2217
- type RiskLevel = {
2218
- /** `"read"`, `"write"`, `"network"`, `"shell"`, etc. */
2219
- category: string;
2220
- /** Numeric scale, higher = more dangerous. Service-defined; 0-10 today. */
2221
- score: number;
2222
- /** Human-readable reason. */
2223
- label: string;
2224
- /** Heuristic flags the risk classifier raised. */
2225
- flags?: string[];
2226
- };
2227
- type ApprovalStatus = 'pending' | 'approved' | 'rejected' | 'expired';
2228
- interface ApprovalRequest {
2229
- id: string;
2230
- requesterId: string;
2231
- userId: string;
2232
- capability: string;
2233
- operation: string;
2234
- riskLevel: RiskLevel;
2235
- context?: Record<string, unknown> | null;
2236
- status: ApprovalStatus;
2237
- reason?: string | null;
2238
- expiresAt: string;
2239
2279
  createdAt: string;
2240
- decidedAt?: string | null;
2241
2280
  }
2242
- interface PermissionRequestInput {
2281
+ interface TaskDispatchRequestPayload {
2282
+ taskId: string;
2283
+ agentImUserId: string;
2284
+ profileId: string;
2243
2285
  capability: string;
2244
- operation: string;
2245
- context?: Record<string, unknown>;
2246
- ttlMs?: number;
2247
- /** Optional idempotency key — forwarded as `Idempotency-Key` header. */
2248
- idempotencyKey?: string;
2249
- }
2250
- type PermissionRequestResult =
2251
- /** Low-risk operation — auto-approved synchronously. */
2252
- {
2253
- approved: true;
2254
- riskLevel: RiskLevel;
2255
- message?: string;
2286
+ prompt: string;
2287
+ metadata?: Record<string, unknown>;
2288
+ timeoutMs?: number;
2289
+ context?: TaskDispatchContextEntry[];
2290
+ conversationId?: string;
2256
2291
  }
2257
- /** High-risk operation — pending mobile decision; poll or subscribe. */
2258
- | {
2259
- approved: false;
2260
- requestId: string;
2261
- expiresAt: string;
2262
- riskLevel: RiskLevel;
2292
+ interface TaskDispatchProgressPayload {
2293
+ taskId: string;
2294
+ progress: number;
2263
2295
  message?: string;
2264
- };
2265
- declare class PermissionsClient {
2266
- private readonly baseUrl;
2267
- private readonly apiKey;
2268
- private readonly timeout;
2269
- private readonly fetchFn;
2270
- constructor({ baseUrl, apiKey, timeout, fetchFn, }?: {
2271
- baseUrl?: string;
2272
- apiKey?: string;
2273
- timeout?: number;
2274
- fetchFn?: typeof fetch;
2275
- });
2276
- /**
2277
- * Request approval. The server may return synchronously when the
2278
- * capability+context is classified as low risk.
2279
- */
2280
- request(input: PermissionRequestInput): Promise<PrismerResponse<PermissionRequestResult>>;
2281
- /**
2282
- * List pending approval requests for the current user. Only
2283
- * `status=pending` is supported today; other values return an empty array
2284
- * with an info message.
2285
- */
2286
- list(opts?: {
2287
- status?: ApprovalStatus;
2288
- limit?: number;
2289
- }): Promise<PrismerResponse<ApprovalRequest[]>>;
2290
- get(requestId: string): Promise<PrismerResponse<ApprovalRequest>>;
2291
- approve(requestId: string, reason?: string): Promise<PrismerResponse<ApprovalRequest>>;
2292
- reject(requestId: string, reason?: string): Promise<PrismerResponse<ApprovalRequest>>;
2293
- private _request;
2294
- private _getHeaders;
2296
+ detail?: Record<string, unknown>;
2297
+ }
2298
+ interface TaskDispatchReplyPayload {
2299
+ taskId: string;
2300
+ ok: boolean;
2301
+ output?: string;
2302
+ error?: {
2303
+ code: string;
2304
+ message: string;
2305
+ };
2306
+ assetIds?: string[];
2307
+ metrics?: {
2308
+ tokensUsed?: number;
2309
+ durationMs?: number;
2310
+ };
2311
+ }
2312
+ interface TaskCancelPayload {
2313
+ taskId: string;
2314
+ reason?: string;
2295
2315
  }
2296
-
2297
2316
  /**
2298
- * Prismer SDK LAN Probe Service (v1.9.0)
2299
- *
2300
- * Client-side connection probing for remote control.
2301
- * Discovers and selects best connection path to daemon.
2302
- *
2303
- * Features:
2304
- * - Concurrent connection probing (LAN + Relay)
2305
- * - Connection quality scoring (latency, jitter, packet loss)
2306
- * - Automatic path selection
2307
- * - Connection health monitoring
2308
- * - Seamless switching between paths
2317
+ * Wire envelope for v1.9.x WS events. `timestamp` is required (mirrors the
2318
+ * cloud-side `WSMessage<T>` definition in src/im/types/index.ts).
2309
2319
  */
2310
- type ConnectionType = 'lan' | 'relay';
2311
- interface ConnectionCandidate {
2312
- type: ConnectionType;
2313
- endpoint: string;
2314
- priority: number;
2315
- }
2316
- interface ProbeResult {
2317
- candidate: ConnectionCandidate;
2318
- latencyMs: number;
2319
- jitterMs: number;
2320
- success: boolean;
2321
- error?: string;
2320
+ interface IMWSMessage<T = unknown> {
2321
+ type: string;
2322
+ payload: T;
2323
+ requestId?: string;
2322
2324
  timestamp: number;
2323
- qualityScore: number;
2324
2325
  }
2325
- interface ConnectionSelection {
2326
- type: ConnectionType;
2327
- endpoint: string;
2328
- latencyMs: number;
2329
- qualityScore: number;
2330
- selectedAt: number;
2326
+ interface WorkspaceChangedPayload {
2327
+ workspaceId: string;
2328
+ /** ISO-8601 timestamp from im_workspaces.updatedAt. */
2329
+ updatedAt: string;
2331
2330
  }
2332
- interface LanProbeOptions {
2333
- daemonId: string;
2334
- lanIP?: string;
2335
- lanPort?: number;
2336
- /**
2337
- * Base WSS URL for the relay (e.g. `wss://cloud.prismer.dev`). Callers
2338
- * typically derive it from their cloud HTTP base URL — there is no separate
2339
- * relay subdomain.
2340
- */
2341
- relayUrl: string;
2342
- maxLatencyMs?: number;
2343
- probeTimeoutMs?: number;
2344
- maxConcurrentProbes?: number;
2345
- pingCount?: number;
2346
- }
2347
- declare class LanProbeService {
2348
- private daemonId;
2349
- private lanIP?;
2350
- private lanPort;
2351
- private relayUrl;
2352
- private maxLatencyMs;
2353
- private probeTimeoutMs;
2354
- private maxConcurrentProbes;
2355
- private pingCount;
2356
- constructor(opts: LanProbeOptions);
2357
- /**
2358
- * Get all connection candidates to probe
2359
- */
2360
- getCandidates(): ConnectionCandidate[];
2361
- /**
2362
- * Probe all connection candidates with concurrency limit
2363
- */
2364
- probeAll(candidates?: ConnectionCandidate[]): Promise<ProbeResult[]>;
2365
- /**
2366
- * Select best connection from probe results
2367
- */
2368
- selectBest(results: ProbeResult[], opts?: {
2369
- maxLatencyMs?: number;
2370
- minQualityScore?: number;
2371
- }): ConnectionSelection | null;
2372
- /**
2373
- * Probe a single connection candidate with quality scoring
2374
- */
2375
- private probeCandidate;
2376
- /**
2377
- * Probe LAN connection (TCP socket test with HTTP probe)
2378
- */
2379
- private probeLAN;
2380
- /**
2381
- * Probe Relay connection (WSS handshake test)
2382
- */
2383
- private probeRelay;
2384
- /**
2385
- * Perform a single TCP ping to verify connectivity
2386
- */
2387
- private tcpPing;
2388
- /**
2389
- * Perform a single HTTP GET request to measure latency
2390
- */
2391
- private httpPing;
2392
- /**
2393
- * Perform a single WebSocket handshake to measure latency
2394
- */
2395
- private wsPing;
2396
- /**
2397
- * Calculate connection quality score based on latency, jitter, and packet loss
2398
- */
2399
- private calculateQualityScore;
2400
- /**
2401
- * Get current connection status summary
2402
- */
2403
- getStatus(): Promise<{
2404
- current: ConnectionSelection | null;
2405
- lastProbe: ProbeResult[];
2406
- timestamp: number;
2407
- }>;
2331
+ interface AgentProfileChangedPayload {
2332
+ profileId: string;
2333
+ version: number;
2334
+ }
2335
+ interface AgentChangedPayload {
2336
+ agentImUserId: string;
2337
+ fields: {
2338
+ displayName?: string;
2339
+ capabilities?: string[];
2340
+ };
2341
+ }
2342
+ interface WorkspaceFileChangedPayload {
2343
+ workspaceId: string;
2344
+ path: string;
2345
+ operation: 'create' | 'update' | 'delete';
2346
+ assetId?: string;
2347
+ contentHash?: string;
2348
+ version: number;
2408
2349
  }
2409
- /**
2410
- * Probe all connections and auto-select best path
2411
- */
2412
- declare function probeAndSelectLan(opts: LanProbeOptions): Promise<ConnectionSelection | null>;
2413
- /**
2414
- * Get current connection status
2415
- */
2416
- declare function getLanStatus(opts: LanProbeOptions): Promise<{
2417
- current: ConnectionSelection | null;
2418
- lastProbe: ProbeResult[];
2419
- timestamp: number;
2420
- }>;
2421
2350
 
2422
2351
  /**
2423
2352
  * Prismer SDK — Multi-Tab Coordination
@@ -3001,14 +2930,12 @@ interface DaemonControlPlane {
3001
2930
  onCommand(handler: (cmd: ControlCommand) => Promise<CommandResult>): void;
3002
2931
  }
3003
2932
 
3004
- /** @deprecated Use `QrInitResponse` (v1.9.0 shape: `{offerId, expiresAt}`). */
3005
- type PairingOffer = QrInitResponse;
3006
- /** @deprecated Use `QrConfirmResponse` (v1.9.0 shape: `{bindingId, daemonId}`). */
3007
- type PairConfirmResult = QrConfirmResponse;
3008
- /** @deprecated Use `SendCommandRequest` (field renamed `payload` → `envelope`). */
3009
- type SendCommandOptions = SendCommandRequest;
3010
- /** @deprecated Use `RegisterPushTokenRequest`. */
3011
- type PushTokenRegisterOptions = RegisterPushTokenRequest;
2933
+ /** Entry in the OpenAI-format model list returned by /api/v1/models. */
2934
+ interface ModelEntry {
2935
+ id: string;
2936
+ object: 'model';
2937
+ owned_by: string;
2938
+ }
3012
2939
 
3013
2940
  /** Account management: register, identity, token refresh */
3014
2941
  declare class AccountClient {
@@ -3026,6 +2953,19 @@ declare class AccountClient {
3026
2953
  }): Promise<IMResult<IMMeData>>;
3027
2954
  /** Refresh JWT token */
3028
2955
  refreshToken(): Promise<IMResult<IMTokenData>>;
2956
+ /**
2957
+ * List agents owned by the current human user (v1.9.3).
2958
+ * Mobile clients call this on launch to populate the Profile/agent runtime card.
2959
+ * Returns `[]` for non-human / api-key-proxy callers without a cloudUserId.
2960
+ */
2961
+ listAgents(): Promise<IMResult<IMOwnedAgent[]>>;
2962
+ /**
2963
+ * Self-service account deletion (v1.9.3).
2964
+ * Soft-deletes the IMUser, cascades owned conversations + open tasks,
2965
+ * revokes pc_api_keys, and blacklists the request token.
2966
+ * The caller can only delete themselves — there is no target id parameter.
2967
+ */
2968
+ deleteAccount(): Promise<IMResult<IMAccountDeleteResult>>;
3029
2969
  }
3030
2970
  /** Direct messaging between two users */
3031
2971
  declare class DirectClient {
@@ -3209,6 +3149,26 @@ declare class TasksClient {
3209
3149
  list(options?: IMTaskListOptions): Promise<IMResult<IMTask[]>>;
3210
3150
  /** Get task details with logs */
3211
3151
  get(taskId: string): Promise<IMResult<IMTaskDetail>>;
3152
+ /**
3153
+ * Wave-9 (v1.9.4) — fetch the canonical task result.
3154
+ *
3155
+ * Replaces the legacy "list IMAssets where kind=task-result + sourceTaskId"
3156
+ * pattern. Returns the locked shape defined by `IMTaskResult`; in
3157
+ * particular `assetIds` is always an array (possibly empty) so callers
3158
+ * can iterate without a null-check.
3159
+ *
3160
+ * Access: creator, assignee, or marketplace visibility on the task.
3161
+ */
3162
+ getResult(taskId: string): Promise<IMResult<IMTaskResult>>;
3163
+ /**
3164
+ * Wave-9 (v1.9.4) — fetch the canonical run result.
3165
+ *
3166
+ * Same shape as `getResult` but reads from IMTaskRun.output instead of
3167
+ * IMTask.result. Use this for chat-mention dispatches whose result lives
3168
+ * on a run row rather than a board task. The `taskId` field of the
3169
+ * returned object is the run.id.
3170
+ */
3171
+ getRunResult(runId: string): Promise<IMResult<IMTaskResult>>;
3212
3172
  /** Update a task */
3213
3173
  update(taskId: string, options: IMUpdateTaskOptions): Promise<IMResult<IMTask>>;
3214
3174
  /** Claim a pending task */
@@ -3254,6 +3214,12 @@ declare class MemoryClient {
3254
3214
  load(scope?: string): Promise<IMResult<IMMemoryLoadResult>>;
3255
3215
  /** Get memory-gene knowledge links for the authenticated user's memory files (v1.8.0) */
3256
3216
  getKnowledgeLinks(): Promise<IMResult<IMMemoryKnowledgeLinks>>;
3217
+ /**
3218
+ * Get a CC-style always-load digest of all memory files (v1.9.3).
3219
+ * The digest is a Markdown bundle suitable for prepending to LLM context.
3220
+ * Server clamps `maxLines` to 10–1000 and `maxBytes` to 500–30000.
3221
+ */
3222
+ digest(options?: IMMemoryDigestOptions): Promise<IMResult<IMMemoryDigest>>;
3257
3223
  }
3258
3224
  /** Knowledge Links: bidirectional associations between Memory, Gene, Capsule, Signal entities (v1.8.0) */
3259
3225
  declare class KnowledgeLinkClient {
@@ -3550,6 +3516,143 @@ declare class EvolutionClient {
3550
3516
 
3551
3517
  /** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
3552
3518
  declare function safeSlug(input: string): string;
3519
+ /**
3520
+ * Top-level workspace resource (v1.9.x). Different from the legacy
3521
+ * `WorkspaceClient` (which manages the 1.7-era `/workspace/init`,
3522
+ * `/workspace/init-group` superset bridge); 1.9.x workspaces are first-class
3523
+ * data containers backed by `IMWorkspace` rows.
3524
+ *
3525
+ * Most callers in 1.9.x have a single default workspace named "Personal" —
3526
+ * use `list()` and pick the row with `isDefault === true`.
3527
+ */
3528
+ declare class WorkspacesClient {
3529
+ private _r;
3530
+ constructor(_r: RequestFn);
3531
+ /** List active workspaces owned by the caller. */
3532
+ list(): Promise<IMResult<IMWorkspace[]>>;
3533
+ /**
3534
+ * Create a workspace. In 1.9.x most callers don't need this — registration
3535
+ * auto-creates a default workspace. The first workspace per owner is
3536
+ * always default; subsequent ones must omit `isDefault` (server returns 409).
3537
+ */
3538
+ create(options: IMCreateWorkspaceOptions): Promise<IMResult<IMWorkspace>>;
3539
+ /** Daemon delta-sync workspaces since an ISO timestamp. */
3540
+ sync(since?: string): Promise<IMResult<IMWorkspaceSyncResult>>;
3541
+ /** Get a single workspace by id (caller must own). */
3542
+ get(workspaceId: string): Promise<IMResult<IMWorkspace>>;
3543
+ /** Update workspace name and/or metadata. `slug` and `isDefault` are immutable in 1.9.x. */
3544
+ update(workspaceId: string, options: IMUpdateWorkspaceOptions): Promise<IMResult<IMWorkspace>>;
3545
+ /**
3546
+ * Archive (delete) a workspace. Server returns 405 in 1.9.x — workspace
3547
+ * deletion equals account close, which goes through `account.deleteAccount()`.
3548
+ * Provided for forward-compat; will become real in 1.10+.
3549
+ */
3550
+ archive(workspaceId: string): Promise<IMResult<void>>;
3551
+ }
3552
+ /**
3553
+ * Workspace files (v1.9.3). Each file is a `path → assetId` binding inside a
3554
+ * workspace. POST is auto-versioning: the previous binding at the same path
3555
+ * is soft-deleted, version bumps, and `parentVersionId` chains the history.
3556
+ */
3557
+ declare class WorkspaceFilesClient {
3558
+ private _r;
3559
+ constructor(_r: RequestFn);
3560
+ /** List the active file tree for a workspace, or look up a single file by path. */
3561
+ list(workspaceId: string, options?: {
3562
+ path?: string;
3563
+ }): Promise<IMResult<IMWorkspaceFile[] | IMWorkspaceFile>>;
3564
+ /**
3565
+ * Bind `path → assetId`. Idempotent if `(path, assetId)` matches the existing
3566
+ * active binding. Asset must already exist in the same workspace.
3567
+ */
3568
+ create(workspaceId: string, options: IMCreateWorkspaceFileOptions): Promise<IMResult<IMWorkspaceFile>>;
3569
+ /** Soft-delete the active binding at `path`. */
3570
+ delete(workspaceId: string, path: string): Promise<IMResult<void>>;
3571
+ /** Daemon delta-sync workspace files since an ISO timestamp. */
3572
+ sync(workspaceId: string, since?: string): Promise<IMResult<IMWorkspaceFileSyncResult>>;
3573
+ /** Get the version chain for a file (walks `parentVersionId`). */
3574
+ history(workspaceId: string, fileId: string): Promise<IMResult<IMWorkspaceFile[]>>;
3575
+ }
3576
+ /**
3577
+ * Assets (v1.9.3). Content-addressed immutable blobs (sha256). Same hash +
3578
+ * same workspace dedupes to a single row. The `prismer://<owner>/asset/<sha>`
3579
+ * URI is resolved by the existing Load API (`/api/context/load`) — see
3580
+ * `client.load()` for that path.
3581
+ */
3582
+ declare class AssetsClient {
3583
+ private _r;
3584
+ private _baseUrl;
3585
+ private _fetchFn;
3586
+ private _getAuthHeaders;
3587
+ constructor(_r: RequestFn, _baseUrl: string, _fetchFn: typeof fetch, _getAuthHeaders: () => Record<string, string>);
3588
+ /** List assets in a workspace (filterable by task and kind). */
3589
+ list(options: IMAssetListOptions): Promise<IMResult<IMAsset[]>>;
3590
+ /**
3591
+ * Look up an asset by content hash within a workspace. Useful for dedupe
3592
+ * checks ("do I already have this file?") before uploading.
3593
+ */
3594
+ byHash(hash: string, workspaceId: string): Promise<IMResult<IMAsset>>;
3595
+ /**
3596
+ * Get full asset metadata + a freshly-signed URL (5 min TTL, S3 backend only).
3597
+ * For `kind === 'photo-memory-segment'` this also includes a `photoRefs`
3598
+ * reverse-lookup of memory references.
3599
+ */
3600
+ detail(assetId: string): Promise<IMResult<IMAssetDetail>>;
3601
+ /**
3602
+ * Soft-delete an asset (the underlying S3 object is retained). Idempotent.
3603
+ */
3604
+ delete(assetId: string): Promise<IMResult<void>>;
3605
+ /**
3606
+ * Build a download URL for an asset. Filesystem backend streams bytes
3607
+ * directly; S3 backend returns a 302 to a 5-minute presigned URL.
3608
+ * Use `download()` for a one-shot fetch returning bytes.
3609
+ */
3610
+ url(assetId: string): string;
3611
+ /**
3612
+ * Download an asset's bytes. Authentication is forwarded; for S3 backend
3613
+ * the server returns a 302 which `fetch` follows automatically.
3614
+ */
3615
+ download(assetId: string): Promise<{
3616
+ bytes: Uint8Array;
3617
+ mime: string | null;
3618
+ sizeBytes: number | null;
3619
+ }>;
3620
+ /**
3621
+ * Upload bytes as an asset (multipart). 100 MB hard cap; >50 MB returns
3622
+ * 413 with `USE_PRESIGNED` — use S3 presign flow for those (not yet wrapped).
3623
+ */
3624
+ upload(input: FileInput, options: IMAssetUploadOptions): Promise<IMResult<IMAsset>>;
3625
+ }
3626
+ /**
3627
+ * Runtime installations (v1.9.3). Long-running daemon hosts inside a
3628
+ * workspace — distinct from short-lived per-task sandboxes. Built on
3629
+ * `IMContainer` rows with `taskId === null`.
3630
+ *
3631
+ * Endpoints live under `/api/workspace/runtime-installations` (Next.js App
3632
+ * Router), NOT under `/api/im/...`.
3633
+ */
3634
+ declare class RuntimeInstallationsClient {
3635
+ private _r;
3636
+ constructor(_r: RequestFn);
3637
+ /** List runtime installations in a workspace. */
3638
+ list(workspaceId: string, options?: {
3639
+ limit?: number;
3640
+ }): Promise<IMResult<IMRuntimeInstallation[]>>;
3641
+ /**
3642
+ * Create a new runtime installation. Mints a durable runtime API key,
3643
+ * RPCs the sandbox controller, and persists an `IMContainer` row.
3644
+ * The daemon receives `PRISMER_API_KEY`, `PRISMER_DAEMON_ID`,
3645
+ * `PRISMER_BASE_URL`, `PRISMER_WORKSPACE_ID`, and
3646
+ * `PRISMER_RUNTIME_KIND=workspace-daemon` env vars.
3647
+ */
3648
+ create(options: IMCreateRuntimeInstallationOptions): Promise<IMResult<IMRuntimeInstallation>>;
3649
+ /**
3650
+ * Install an agent onto a runtime daemon. Resolves or creates the agent
3651
+ * profile, calls the controller's `installAgent` RPC, and stamps
3652
+ * `IMAgentCard.metadata.daemonId` + `runtimeInstallationId`.
3653
+ */
3654
+ installAgent(runtimeInstallationId: string, options: IMInstallAgentOnRuntimeOptions): Promise<IMResult<IMInstallAgentOnRuntimeResult>>;
3655
+ }
3553
3656
  /** Map file extension to MIME type (no external deps) */
3554
3657
  declare function guessMimeType(fileName: string): string;
3555
3658
  /** File upload management (presign → upload → confirm) */
@@ -3604,15 +3707,42 @@ declare class FilesClient {
3604
3707
  /** Real-time connection factory (WebSocket & SSE) */
3605
3708
  declare class IMRealtimeClient {
3606
3709
  private _wsBase;
3607
- constructor(_wsBase: string);
3710
+ private _fetchFn;
3711
+ constructor(_wsBase: string, _fetchFn?: typeof fetch);
3608
3712
  /** Get the WebSocket URL */
3609
3713
  wsUrl(token?: string): string;
3610
3714
  /** Get the SSE URL */
3611
3715
  sseUrl(token?: string): string;
3716
+ /**
3717
+ * Get the URL for the v1.8.2 task SSE stream
3718
+ * (`GET /api/im/tasks/events?token=...`).
3719
+ * Supports `Last-Event-ID` for replay.
3720
+ */
3721
+ taskEventsUrl(token: string): string;
3612
3722
  /** Create a WebSocket client. Call .connect() to establish connection. */
3613
3723
  connectWS(config: RealtimeConfig): RealtimeWSClient;
3614
3724
  /** Create an SSE client. Call .connect() to establish connection. */
3615
3725
  connectSSE(config: RealtimeConfig): RealtimeSSEClient;
3726
+ /**
3727
+ * Subscribe to the task events SSE stream (v1.8.2/v1.9.3).
3728
+ *
3729
+ * Resolves with a `disconnect()` function for cleanup. Emits envelopes of
3730
+ * shape `{ id?, type, payload }` for each parsed `event:` block. Ignores
3731
+ * comment lines (`:` heartbeats).
3732
+ *
3733
+ * @example
3734
+ * const sub = await client.im.realtime.subscribeTaskEvents(apiKey, (evt) => {
3735
+ * if (evt.type === 'task.completed') console.log('done:', evt.payload);
3736
+ * });
3737
+ * // ... later:
3738
+ * sub.disconnect();
3739
+ */
3740
+ subscribeTaskEvents(token: string, onEvent: (event: TaskEventEnvelope) => void, options?: {
3741
+ lastEventId?: string;
3742
+ signal?: AbortSignal;
3743
+ }): Promise<{
3744
+ disconnect: () => void;
3745
+ }>;
3616
3746
  }
3617
3747
  declare class IMClient {
3618
3748
  readonly account: AccountClient;
@@ -3623,7 +3753,16 @@ declare class IMClient {
3623
3753
  readonly contacts: ContactsClient;
3624
3754
  readonly bindings: BindingsClient;
3625
3755
  readonly credits: CreditsClient;
3756
+ /** Legacy 1.7-era workspace bridge (`/workspace/init`, `/workspace/init-group`). */
3626
3757
  readonly workspace: WorkspaceClient;
3758
+ /** v1.9.3 first-class workspaces (`/api/im/workspaces`). */
3759
+ readonly workspaces: WorkspacesClient;
3760
+ /** v1.9.3 workspace files (`/api/im/workspaces/:id/files`). */
3761
+ readonly workspaceFiles: WorkspaceFilesClient;
3762
+ /** v1.9.3 content-addressed assets (`/api/im/assets`). */
3763
+ readonly assets: AssetsClient;
3764
+ /** v1.9.3 workspace runtime installations (`/api/workspace/runtime-installations`). */
3765
+ readonly runtimeInstallations: RuntimeInstallationsClient;
3627
3766
  readonly tasks: TasksClient;
3628
3767
  readonly memory: MemoryClient;
3629
3768
  readonly knowledge: KnowledgeLinkClient;
@@ -3653,9 +3792,6 @@ declare class PrismerClient {
3653
3792
  private _identityReady;
3654
3793
  /** IM API sub-client */
3655
3794
  readonly im: IMClient;
3656
- /** Remote Control API sub-client (Track 3) */
3657
- readonly remote: RemoteClient;
3658
- readonly permissions: PermissionsClient;
3659
3795
  constructor(config?: PrismerConfig);
3660
3796
  /** Wait for identity to be ready (useful for tests or explicit await) */
3661
3797
  ensureIdentity(): Promise<AIPIdentity | null>;
@@ -3685,6 +3821,8 @@ declare class PrismerClient {
3685
3821
  parseStatus(taskId: string): Promise<ParseResult>;
3686
3822
  /** Get result of a completed async parse task */
3687
3823
  parseResult(taskId: string): Promise<ParseResult>;
3824
+ /** List LLM models exposed by the cloud LLM proxy (OpenAI format). */
3825
+ listModels(): Promise<ModelEntry[]>;
3688
3826
  /** Search for content (convenience wrapper around load with query mode) */
3689
3827
  search(query: string, options?: {
3690
3828
  topK?: number;
@@ -3696,4 +3834,4 @@ declare class PrismerClient {
3696
3834
 
3697
3835
  declare function createClient(config: PrismerConfig): PrismerClient;
3698
3836
 
3699
- export { AccountClient, type ApiKeyBindRequest, type ApiKeyBindResponse, type ApprovalRequest, type ApprovalStatus, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, type CacheManager, type CommandResult, CommunityHub, type CommunityHubConfig, type ConnectionCandidate, type ConnectionSelection, type ConnectionType, ContactsClient, type ControlCommand, ConversationsClient, CreditsClient, type DaemonControlPlane, type DecryptResult, type DerivationMode, type DesktopBinding, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type ExecutionPolicy, type FileInput, FilesClient, FsApi, type FsDeleteRequest, type FsDeleteResponse, type FsEditRequest, type FsEditResponse, type FsListEntry, type FsListRequest, type FsListResponse, type FsOp, type FsReadRequest, type FsReadResponse, type FsSearchMatch, type FsSearchRequest, type FsSearchResponse, type FsWriteRequest, type FsWriteResponse, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMBlockedUser, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateTaskOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMFriendRequest, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMKnowledgeLink, type IMMeData, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryKnowledgeLinks, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUser, type IMUserProfile, type IMWorkspaceData, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, IdentityClient, IndexedDBStorage, type KeyManager, KnowledgeLinkClient, type KnowledgeLinkSource, type KnowledgeLinkType, type LLMBackend, type LLMDispatcher, type LLMResult, type LLMTask, type LanProbeOptions, LanProbeService, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, type MessageReactionPayload, MessagesClient, type NotificationSink, type OfferCandidate, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type PairConfirmResult, PairingApi, type PairingOffer, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PermissionRequestInput, type PermissionRequestResult, PermissionsClient, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type PrismerEvent, type ProbeResult, type PushToken, type PushTokenRegisterOptions, type QrConfirmRequest, type QrConfirmResponse, type QrInitRequest, type QrInitResponse, type QueryCost, type QuerySummary, type QueuedAttachment, type QueuedTask, type QuickDecisionRequest, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RegisterPushTokenRequest, RemoteClient, type RemoteCommand, type RemoteCommandStatus, type RequestFn, type RiskLevel, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendCommandOptions, type SendCommandRequest, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskExecutor, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, getLanStatus, guessMimeType, probeAndSelectLan, safeSlug };
3837
+ export { AccountClient, type AgentChangedPayload, type AgentHostDeclarePayload, type AgentProfileChangedPayload, type AgentStatusChangedPayload, AssetsClient, AttachmentQueue, type AuthenticatedPayload, type BatchSummary, type BatchUrlCost, BindingsClient, type CacheManager, type CommandResult, CommunityHub, type CommunityHubConfig, ContactsClient, type ControlCommand, ConversationsClient, CreditsClient, type DaemonControlPlane, type DecryptResult, type DerivationMode, DirectClient, type DisconnectedPayload, E2EEncryption, ENVIRONMENTS, type EncryptedContextResult, type EncryptedFileResult, type EncryptedMessage, type Environment, type ErrorPayload, EvolutionCache, EvolutionClient, EvolutionRuntime, type EvolutionRuntimeConfig, type EvolutionSession, type EvolutionSyncDelta, type EvolutionSyncSnapshot, type ExecutionContext, type ExecutionPolicy, type FileInput, FilesClient, type GeneCategory, type GeneSelectionResult, type GeneVisibility, GroupsClient, type HostAckedPayload, type HostedAgentDeclaration, type IMAccountDeleteResult, type IMAgentCard, type IMAgentPersonality, type IMAgentSkillRecord, type IMAgentStatus, type IMAnalyzeOptions, type IMAnalyzeResult, type IMAsset, type IMAssetDetail, type IMAssetListOptions, type IMAssetUploadOptions, type IMAutocompleteResult, type IMBinding, type IMBindingData, type IMBlockedUser, type IMCapsule, IMClient, type IMCompactOptions, type IMCompactionSummary, type IMCompleteTaskOptions, type IMConfirmResult, type IMContact, type IMConversation, type IMConversationsOptions, type IMCreateBindingOptions, type IMCreateGeneOptions, type IMCreateGroupOptions, type IMCreateMemoryFileOptions, type IMCreateRuntimeInstallationOptions, type IMCreateTaskOptions, type IMCreateWorkspaceFileOptions, type IMCreateWorkspaceOptions, type IMCreditsData, type IMDiscoverAgent, type IMDiscoverOptions, type IMEvolutionEdge, type IMEvolutionStats, type IMFileQuota, type IMForkGeneOptions, type IMFriendRequest, type IMGene, type IMGeneListOptions, type IMGroupData, type IMGroupMember, type IMIdentityKey, type IMInstallAgentOnRuntimeOptions, type IMInstallAgentOnRuntimeResult, type IMKeyAuditEntry, type IMKeyVerifyResult, type IMKnowledgeLink, type IMMeData, type IMMemoryDigest, type IMMemoryDigestOptions, type IMMemoryFile, type IMMemoryFileDetail, type IMMemoryKnowledgeLinks, type IMMemoryLoadResult, type IMMessage, type IMMessageData, type IMMultipartInitResult, type IMOwnedAgent, type IMPaginationOptions, type IMPresignOptions, type IMPresignResult, IMRealtimeClient, type IMRecordOutcomeOptions, type IMRegisterData, type IMRegisterKeyOptions, type IMRegisterOptions, type IMResult, type IMRouting, type IMRuntimeInstallation, type IMSendOptions, type IMSkillContent, type IMSkillInfo, type IMSkillInstallResult, type IMTask, type IMTaskDetail, type IMTaskListOptions, type IMTaskLog, type IMTaskResult, type IMTokenData, type IMTransaction, type IMUpdateMemoryFileOptions, type IMUpdateTaskOptions, type IMUpdateWorkspaceOptions, type IMUser, type IMUserProfile, type IMWSMessage, type IMWorkspace, type IMWorkspaceData, type IMWorkspaceFile, type IMWorkspaceFileSyncResult, type IMWorkspaceInitGroupOptions, type IMWorkspaceInitOptions, type IMWorkspaceSyncResult, IdentityClient, IndexedDBStorage, type KeyManager, KnowledgeLinkClient, type KnowledgeLinkSource, type KnowledgeLinkType, type LLMBackend, type LLMDispatcher, type LLMResult, type LLMTask, type LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, type MessageReactionPayload, MessagesClient, type ModelEntry, type NotificationSink, type OfflineConfig, type OfflineEventMap, type OfflineEventType, OfflineManager, type OutboxOperation, type ParseCost, type ParseCostBreakdown, type ParseDocument, type ParseDocumentImage, type ParseOptions, type ParseResult, type ParseUsage, type PongPayload, type PresenceChangedPayload, PrismerClient, type PrismerConfig, type PrismerEvent, type QueryCost, type QuerySummary, type QueuedAttachment, type QueuedTask, type RankingFactors, type RealtimeCommand, type RealtimeConfig, type RealtimeEventMap, type RealtimeEventType, RealtimeSSEClient, type RealtimeState, RealtimeWSClient, type ReconnectingPayload, type RequestFn, RuntimeInstallationsClient, type RuntimePhase, type RuntimeRoute, SQLiteStorage, type SaveBatchOptions, type SaveOptions, type SaveResult, type ScheduleType, SecurityClient, type SendFileOptions, type SendFileResult, type SessionMetrics, type SignalEnrichmentConfig, type SignalTag, type SingleUrlCost, type StorageAdapter, type StoredContact, type StoredConversation, type StoredMessage, type Suggestion, type SyncEvent, type SyncResult, TabCoordinator, type TaskCancelPayload, type TaskDispatchContextEntry, type TaskDispatchProgressPayload, type TaskDispatchReplyPayload, type TaskDispatchRequestPayload, type TaskEventEnvelope, type TaskEventType, type TaskExecutor, type TaskKind, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, type WorkspaceChangedPayload, WorkspaceClient, type WorkspaceFileChangedPayload, WorkspaceFilesClient, WorkspacesClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, safeSlug };