@prismer/sdk 1.8.2 → 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.mts 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.
@@ -1925,6 +2213,141 @@ declare class CommunityHub {
1925
2213
  }): Promise<IMResult<any>>;
1926
2214
  }
1927
2215
 
2216
+ /**
2217
+ * Prismer SDK — IM WS protocol payload types (v1.9.x)
2218
+ *
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.
2222
+ *
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
2241
+ */
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
+ }>;
2253
+ }
2254
+ interface AgentHostDeclarePayload {
2255
+ daemonId: string;
2256
+ daemonVersion: string;
2257
+ platform: 'darwin' | 'linux' | 'win32';
2258
+ agents: HostedAgentDeclaration[];
2259
+ }
2260
+ interface HostAckedPayload {
2261
+ workspaceId: string;
2262
+ syncCursor: {
2263
+ workspaces: number;
2264
+ agent_profiles: number;
2265
+ [key: string]: number;
2266
+ };
2267
+ profilesToSync: string[];
2268
+ }
2269
+ interface AgentStatusChangedPayload {
2270
+ agentImUserId: string;
2271
+ status: IMAgentStatus;
2272
+ activeProfileId?: string;
2273
+ runningTaskIds?: string[];
2274
+ }
2275
+ interface TaskDispatchContextEntry {
2276
+ sender: string;
2277
+ senderRole: 'human' | 'agent' | 'admin' | 'system';
2278
+ content: string;
2279
+ createdAt: string;
2280
+ }
2281
+ interface TaskDispatchRequestPayload {
2282
+ taskId: string;
2283
+ agentImUserId: string;
2284
+ profileId: string;
2285
+ capability: string;
2286
+ prompt: string;
2287
+ metadata?: Record<string, unknown>;
2288
+ timeoutMs?: number;
2289
+ context?: TaskDispatchContextEntry[];
2290
+ conversationId?: string;
2291
+ }
2292
+ interface TaskDispatchProgressPayload {
2293
+ taskId: string;
2294
+ progress: number;
2295
+ message?: string;
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;
2315
+ }
2316
+ /**
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).
2319
+ */
2320
+ interface IMWSMessage<T = unknown> {
2321
+ type: string;
2322
+ payload: T;
2323
+ requestId?: string;
2324
+ timestamp: number;
2325
+ }
2326
+ interface WorkspaceChangedPayload {
2327
+ workspaceId: string;
2328
+ /** ISO-8601 timestamp from im_workspaces.updatedAt. */
2329
+ updatedAt: string;
2330
+ }
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;
2349
+ }
2350
+
1928
2351
  /**
1929
2352
  * Prismer SDK — Multi-Tab Coordination
1930
2353
  *
@@ -2507,6 +2930,13 @@ interface DaemonControlPlane {
2507
2930
  onCommand(handler: (cmd: ControlCommand) => Promise<CommandResult>): void;
2508
2931
  }
2509
2932
 
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
+ }
2939
+
2510
2940
  /** Account management: register, identity, token refresh */
2511
2941
  declare class AccountClient {
2512
2942
  private _r;
@@ -2523,6 +2953,19 @@ declare class AccountClient {
2523
2953
  }): Promise<IMResult<IMMeData>>;
2524
2954
  /** Refresh JWT token */
2525
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>>;
2526
2969
  }
2527
2970
  /** Direct messaging between two users */
2528
2971
  declare class DirectClient {
@@ -2706,6 +3149,26 @@ declare class TasksClient {
2706
3149
  list(options?: IMTaskListOptions): Promise<IMResult<IMTask[]>>;
2707
3150
  /** Get task details with logs */
2708
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>>;
2709
3172
  /** Update a task */
2710
3173
  update(taskId: string, options: IMUpdateTaskOptions): Promise<IMResult<IMTask>>;
2711
3174
  /** Claim a pending task */
@@ -2751,6 +3214,12 @@ declare class MemoryClient {
2751
3214
  load(scope?: string): Promise<IMResult<IMMemoryLoadResult>>;
2752
3215
  /** Get memory-gene knowledge links for the authenticated user's memory files (v1.8.0) */
2753
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>>;
2754
3223
  }
2755
3224
  /** Knowledge Links: bidirectional associations between Memory, Gene, Capsule, Signal entities (v1.8.0) */
2756
3225
  declare class KnowledgeLinkClient {
@@ -3047,6 +3516,143 @@ declare class EvolutionClient {
3047
3516
 
3048
3517
  /** Sanitize a slug/id to prevent path traversal (removes slashes, .., and null bytes) */
3049
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
+ }
3050
3656
  /** Map file extension to MIME type (no external deps) */
3051
3657
  declare function guessMimeType(fileName: string): string;
3052
3658
  /** File upload management (presign → upload → confirm) */
@@ -3101,15 +3707,42 @@ declare class FilesClient {
3101
3707
  /** Real-time connection factory (WebSocket & SSE) */
3102
3708
  declare class IMRealtimeClient {
3103
3709
  private _wsBase;
3104
- constructor(_wsBase: string);
3710
+ private _fetchFn;
3711
+ constructor(_wsBase: string, _fetchFn?: typeof fetch);
3105
3712
  /** Get the WebSocket URL */
3106
3713
  wsUrl(token?: string): string;
3107
3714
  /** Get the SSE URL */
3108
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;
3109
3722
  /** Create a WebSocket client. Call .connect() to establish connection. */
3110
3723
  connectWS(config: RealtimeConfig): RealtimeWSClient;
3111
3724
  /** Create an SSE client. Call .connect() to establish connection. */
3112
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
+ }>;
3113
3746
  }
3114
3747
  declare class IMClient {
3115
3748
  readonly account: AccountClient;
@@ -3120,7 +3753,16 @@ declare class IMClient {
3120
3753
  readonly contacts: ContactsClient;
3121
3754
  readonly bindings: BindingsClient;
3122
3755
  readonly credits: CreditsClient;
3756
+ /** Legacy 1.7-era workspace bridge (`/workspace/init`, `/workspace/init-group`). */
3123
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;
3124
3766
  readonly tasks: TasksClient;
3125
3767
  readonly memory: MemoryClient;
3126
3768
  readonly knowledge: KnowledgeLinkClient;
@@ -3179,6 +3821,8 @@ declare class PrismerClient {
3179
3821
  parseStatus(taskId: string): Promise<ParseResult>;
3180
3822
  /** Get result of a completed async parse task */
3181
3823
  parseResult(taskId: string): Promise<ParseResult>;
3824
+ /** List LLM models exposed by the cloud LLM proxy (OpenAI format). */
3825
+ listModels(): Promise<ModelEntry[]>;
3182
3826
  /** Search for content (convenience wrapper around load with query mode) */
3183
3827
  search(query: string, options?: {
3184
3828
  topK?: number;
@@ -3190,4 +3834,4 @@ declare class PrismerClient {
3190
3834
 
3191
3835
  declare function createClient(config: PrismerConfig): PrismerClient;
3192
3836
 
3193
- export { AccountClient, 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 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 LoadOptions, type LoadResult, type LoadResultItem, MemoryClient, MemoryStorage, type MessageDeletedPayload, type MessageEditPayload, type MessageNewPayload, type MessageReactionPayload, MessagesClient, 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, 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 TaskExecutor, type TaskStatus, TasksClient, type TypingIndicatorPayload, type UploadOptions, type UploadResult, WorkspaceClient, createClient, createEnrichedExtractor, decryptContext, decryptFile, decryptMessages, decryptOnReceive, PrismerClient as default, encryptContext, encryptFile, encryptForSend, extractSignals, guessMimeType, 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 };