@parall/sdk 1.47.0 → 1.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -111,6 +111,12 @@ export interface TransferChatOwnershipRequest {
111
111
  export interface UnreadEntry {
112
112
  count: number;
113
113
  mentions: number;
114
+ /** Share of `count` contributed by unread thread replies (only present when
115
+ * the unread fetch opted into `include_thread_replies`). Top-level timeline
116
+ * unread = count - (thread_count ?? 0). */
117
+ thread_count?: number;
118
+ /** Share of `mentions` contributed by unread thread replies. */
119
+ thread_mentions?: number;
114
120
  since?: string;
115
121
  }
116
122
 
@@ -273,6 +279,12 @@ export interface Message {
273
279
  * absent from the stack. A reload re-derives it from the server's view.
274
280
  */
275
281
  recent_repliers?: User[];
282
+ /**
283
+ * Per-viewer count of thread replies newer than the viewer's thread read
284
+ * cursor, excluding the viewer's own replies (root only). Populated on
285
+ * top-level list responses; omitted when zero.
286
+ */
287
+ unread_reply_count?: number;
276
288
  edited_at: string | null;
277
289
  deleted_at: string | null;
278
290
  created_at: string;
@@ -281,6 +293,27 @@ export interface Message {
281
293
  agent_session_id?: string | null;
282
294
  hints?: MessageHints | null;
283
295
  attachments?: Attachment[];
296
+ reactions?: ReactionSummary[];
297
+ }
298
+
299
+ /**
300
+ * Aggregated reactions for one emoji on a message.
301
+ *
302
+ * `has_reacted` is viewer-relative in REST responses. In
303
+ * `message.reaction.updated` WS broadcasts it is computed for the ACTOR who
304
+ * triggered the toggle — subscribers must recompute their own state from
305
+ * `user_ids` (see docs/engineering-design/ws-protocol.md).
306
+ */
307
+ export interface ReactionSummary {
308
+ emoji: string;
309
+ count: number;
310
+ user_ids: string[];
311
+ has_reacted: boolean;
312
+ }
313
+
314
+ export interface ToggleReactionResponse {
315
+ added: boolean;
316
+ reactions: ReactionSummary[];
284
317
  }
285
318
 
286
319
  export interface Attachment {
@@ -1159,6 +1192,13 @@ export interface Task {
1159
1192
  seq_number: number | null;
1160
1193
  identifier: string | null;
1161
1194
  sort_order: number;
1195
+ /**
1196
+ * Planned start date, YYYY-MM-DD (calendar date, timezone-free) — the
1197
+ * planned schedule's left edge, independent of started_at (when work
1198
+ * actually began). Absent on servers older than migration 145. When both
1199
+ * dates are set, planned_start_date <= due_date.
1200
+ */
1201
+ planned_start_date?: string | null;
1162
1202
  /** Planned completion date, YYYY-MM-DD (calendar date, timezone-free). */
1163
1203
  due_date: string | null;
1164
1204
  assignee?: User;
@@ -1246,6 +1286,8 @@ export interface CreateTaskRequest {
1246
1286
  project_id?: string;
1247
1287
  source_chat_id?: string;
1248
1288
  sort_order?: number;
1289
+ /** Planned start date, YYYY-MM-DD. Must be <= due_date when both are set. */
1290
+ planned_start_date?: string;
1249
1291
  /** Planned completion date, YYYY-MM-DD. */
1250
1292
  due_date?: string;
1251
1293
  }
@@ -1266,6 +1308,12 @@ export interface UpdateTaskRequest {
1266
1308
  * full column. Mutually exclusive with sort_order.
1267
1309
  */
1268
1310
  placement?: 'end';
1311
+ /**
1312
+ * Planned start date, YYYY-MM-DD; explicit null clears it. The post-patch
1313
+ * state must satisfy planned_start_date <= due_date when both are set
1314
+ * (400 INVALID_DATE_RANGE otherwise).
1315
+ */
1316
+ planned_start_date?: string | null;
1269
1317
  /** Planned completion date, YYYY-MM-DD; explicit null clears it. */
1270
1318
  due_date?: string | null;
1271
1319
  /**
@@ -2179,6 +2227,20 @@ export interface MessageDeleteData {
2179
2227
  thread_root_id?: string;
2180
2228
  }
2181
2229
 
2230
+ /**
2231
+ * Payload of the `message.reaction.updated` WS broadcast. `reactions` is the
2232
+ * full aggregated snapshot for the message; its `has_reacted` flags are
2233
+ * actor-relative (see {@link ReactionSummary}) — recompute from `user_ids`.
2234
+ */
2235
+ export interface ReactionUpdatedData {
2236
+ message_id: string;
2237
+ chat_id: string;
2238
+ emoji: string;
2239
+ user_id: string;
2240
+ added: boolean;
2241
+ reactions: ReactionSummary[];
2242
+ }
2243
+
2182
2244
  export interface TypingUpdateData {
2183
2245
  chat_id: string;
2184
2246
  thread_root_id: string | null;
@@ -2497,6 +2559,14 @@ export interface InboxItem {
2497
2559
  grouping_priority: number;
2498
2560
  /** Number of events in this group. Populated by the grouped list query. */
2499
2561
  group_count: number;
2562
+ /**
2563
+ * True when ANY row in this item's group is unread — the same group-level
2564
+ * definition the unread-count badge uses. The representative row's own
2565
+ * `read_at` can be set while older rows in its group are still unread, so
2566
+ * read-state display must key off this field. Optional: absent on locally
2567
+ * cached rows written before the field shipped (fall back to `read_at`).
2568
+ */
2569
+ group_unread?: boolean;
2500
2570
  read_at: string | null;
2501
2571
  archived_at: string | null;
2502
2572
  snoozed_until: string | null;
@@ -3065,6 +3135,13 @@ export interface ReadPositionUpdateData {
3065
3135
  last_read_message_id: string;
3066
3136
  }
3067
3137
 
3138
+ /** Per-thread read cursor sync across the user's devices. */
3139
+ export interface ThreadReadPositionUpdateData {
3140
+ chat_id: string;
3141
+ thread_root_id: string;
3142
+ last_read_reply_id: string;
3143
+ }
3144
+
3068
3145
  export interface NotificationAlertData {
3069
3146
  title: string;
3070
3147
  body: string;
@@ -3079,6 +3156,7 @@ export type WsEventMap = {
3079
3156
  'message.patch': MessagePatchData;
3080
3157
  'message.edit': MessageEditData;
3081
3158
  'message.delete': MessageDeleteData;
3159
+ 'message.reaction.updated': ReactionUpdatedData;
3082
3160
  'typing.update': TypingUpdateData;
3083
3161
  'chat.created': ChatCreatedData;
3084
3162
  'chat.update': ChatUpdateData;
@@ -3123,6 +3201,7 @@ export type WsEventMap = {
3123
3201
  'inbox.update': InboxUpdateData;
3124
3202
  'inbox.bulk_update': InboxBulkUpdateData;
3125
3203
  'read_position.updated': ReadPositionUpdateData;
3204
+ 'thread_read_position.updated': ThreadReadPositionUpdateData;
3126
3205
  'dispatch.new': DispatchNewData;
3127
3206
  'dispatch.received': DispatchReceivedData;
3128
3207
  'dispatch.resolved': DispatchResolvedData;
@@ -3327,6 +3406,37 @@ export interface BacklinksResponse {
3327
3406
  next_cursor?: string;
3328
3407
  }
3329
3408
 
3409
+ /**
3410
+ * Request for POST /orgs/{orgId}/refs/outbound — two mutually exclusive
3411
+ * forms, modeled as a union so an invalid mixed shape fails at compile time:
3412
+ * `thread_root_id` resolves a thread's message set server-side (root + ALL
3413
+ * non-deleted replies — the client's reply window may be partial), while
3414
+ * `source_type` + `source_ids` lists explicit sources (max 500; v1 accepts
3415
+ * only `message` sources).
3416
+ */
3417
+ export type OutboundRefsRequest =
3418
+ | { thread_root_id: string; source_type?: never; source_ids?: never }
3419
+ | { source_type: string; source_ids: string[]; thread_root_id?: never };
3420
+
3421
+ /** One raw ref_links row; dedupe/grouping is a client concern. */
3422
+ export interface OutboundRefItem {
3423
+ uri: string;
3424
+ target_type: string;
3425
+ target_id: string;
3426
+ target_path?: string;
3427
+ target_frag?: string;
3428
+ context?: string;
3429
+ source_type: string;
3430
+ source_id: string;
3431
+ position: number;
3432
+ }
3433
+
3434
+ export interface OutboundRefsResponse {
3435
+ data: OutboundRefItem[];
3436
+ /** Set when the server-side sanity cap dropped the tail of the row set. */
3437
+ truncated?: boolean;
3438
+ }
3439
+
3330
3440
  /**
3331
3441
  * One entity in a multi-hop ref-graph traversal (GET /refs/graph). `id`/`uri` are
3332
3442
  * the ref_links endpoint identifier: a bare prll:// entity id for most nodes
@@ -3968,6 +4078,29 @@ export interface BrowserViewerCommandResponse {
3968
4078
  result: Record<string, unknown> | null;
3969
4079
  }
3970
4080
 
4081
+ /**
4082
+ * Cloud Edge live viewer (V1b, design §6). Same request/reply shape as the v2
4083
+ * browser-profile viewer — the transport-agnostic `BrowserViewer` client drives
4084
+ * either — but a distinct type so the edge viewer surface never depends on the
4085
+ * v2 browser-profile viewer symbols.
4086
+ */
4087
+ export interface EdgeViewerCommandRequest {
4088
+ /** Correlates a viewer session. Omit on `stream.start`; the server returns one. */
4089
+ session_id?: string;
4090
+ command: string;
4091
+ input?: Record<string, unknown>;
4092
+ }
4093
+
4094
+ export interface EdgeViewerCommandResponse {
4095
+ session_id: string;
4096
+ /**
4097
+ * Command-specific result. For `stream.start`:
4098
+ * `{ offer_sdp, candidates, ice_servers, streamed_tab_id }`. May be `null` on
4099
+ * the wire (a nil Go result map serializes as JSON null); coalesce to `{}`.
4100
+ */
4101
+ result: Record<string, unknown> | null;
4102
+ }
4103
+
3971
4104
  export interface GrantBrowserProfileConsentRequest {
3972
4105
  clip_id: string;
3973
4106
  }
@@ -4135,6 +4268,15 @@ export type EdgePlacement = 'byoc' | 'hosted';
4135
4268
  */
4136
4269
  export type EdgeHostedState = 'idle' | 'deleting';
4137
4270
 
4271
+ /** Stable API error codes returned by the BYOC unregister contract. */
4272
+ export type EdgeDeviceUnregisterErrorCode =
4273
+ | 'JWT_REQUIRED'
4274
+ | 'HUMAN_REQUIRED'
4275
+ | 'FORBIDDEN'
4276
+ | 'EDGE_PLACEMENT_UNSUPPORTED'
4277
+ | 'EDGE_ONLINE'
4278
+ | 'EDGE_INTEGRITY_ERROR';
4279
+
4138
4280
  export interface EdgeDevice {
4139
4281
  id: string;
4140
4282
  org_id: string;
@@ -4170,6 +4312,45 @@ export interface EdgeBrowserProfile {
4170
4312
  is_default: boolean;
4171
4313
  created_at: string;
4172
4314
  updated_at: string;
4315
+ /**
4316
+ * True when the profile has a fixed egress proxy configured (hosted Cloud
4317
+ * Profiles). Presence flag only — endpoint/username/password are readable
4318
+ * exclusively by managers via the dedicated proxy endpoint, and the password
4319
+ * never leaves the server.
4320
+ */
4321
+ proxy_configured?: boolean;
4322
+ }
4323
+
4324
+ /**
4325
+ * Sanitized per-profile egress proxy status (hosted Cloud Profiles) — the GET
4326
+ * response and the PUT/DELETE result. NEVER carries the password; `password_set`
4327
+ * is the only trace of it.
4328
+ */
4329
+ export interface EdgeProfileProxyStatus {
4330
+ configured: boolean;
4331
+ server?: string;
4332
+ username?: string;
4333
+ password_set: boolean;
4334
+ /** Opaque compare-and-swap token for conditional PUT/DELETE. */
4335
+ version: string;
4336
+ /** Authoritative mutation gate; false whenever a non-released lease exists. */
4337
+ can_mutate: boolean;
4338
+ /** Actual lease state blocking a mutation (never inferred from device status). */
4339
+ lease_status?: 'pending' | 'assigned' | 'active' | 'releasing' | 'repair';
4340
+ /** Suggested delay before re-reading authoritative state. */
4341
+ retry_after_seconds?: number;
4342
+ }
4343
+
4344
+ /**
4345
+ * PUT body for a profile's egress proxy: the FULL triple every time (no
4346
+ * tri-state merge — the stored blob is encrypted, so replace always re-supplies
4347
+ * complete credentials). Clearing is DELETE, never an empty PUT. Username and
4348
+ * password go together or not at all.
4349
+ */
4350
+ export interface SetEdgeProfileProxyRequest {
4351
+ server: string;
4352
+ username?: string;
4353
+ password?: string;
4173
4354
  }
4174
4355
 
4175
4356
  export interface ClipConnection {
@@ -4185,6 +4366,102 @@ export interface ClipConnection {
4185
4366
  updated_at: string;
4186
4367
  }
4187
4368
 
4369
+ /**
4370
+ * A clip in the api-server org registry (`crg_…`, table `clip_registry`) — the
4371
+ * v3 registry that install and clip connections operate on. Distinct from
4372
+ * {@link RegistryClipInfo}, which is the clip-service → Pinix Hub catalog proxy
4373
+ * and carries no registry id.
4374
+ */
4375
+ export interface ClipRegistryEntry {
4376
+ id: string;
4377
+ org_id: string;
4378
+ name: string;
4379
+ description?: string;
4380
+ visibility: 'public' | 'private';
4381
+ version?: string;
4382
+ /** clip.json manifest. `type` absent/null means browser (predates the field). */
4383
+ manifest: Record<string, unknown> | null;
4384
+ author_id: string;
4385
+ /** Reviewed snapshot served cross-org. Absent = never approved. */
4386
+ approved_version_id?: string;
4387
+ created_at: string;
4388
+ updated_at: string;
4389
+ /** Author-org-only computed fields (state of the latest submitted version). */
4390
+ review_status?: string;
4391
+ review_note?: string;
4392
+ }
4393
+
4394
+ export interface InstallRegistryClipResponse {
4395
+ ok: boolean;
4396
+ clip_id: string;
4397
+ name: string;
4398
+ }
4399
+
4400
+ /**
4401
+ * Execute a registry (Edge) clip command on an Edge device
4402
+ * (`POST /orgs/{orgId}/edge/exec`).
4403
+ *
4404
+ * Routing is EXPLICIT — exactly one of:
4405
+ * - `connection`: a clip connection id (`ccn_…`) or its org-local alias. The
4406
+ * ONLY route to a hosted (Cloud Profile) device: the connection its
4407
+ * maintainer bound IS the org-wide authorization. Also valid for BYOC.
4408
+ * - `edge_id`: a BYOC desktop device the CALLER owns. Naming a hosted device
4409
+ * here is refused (`400 HOSTED_CONNECTION_REQUIRED`).
4410
+ * - neither: legacy BYOC fallback — resolves only to the caller's OWN online
4411
+ * desktop device, never to a hosted one.
4412
+ */
4413
+ export interface ExecEdgeClipRequest {
4414
+ /**
4415
+ * Clip name in the org's clip registry (or an installed marketplace clip).
4416
+ * Exactly ONE of `clip` or `clip_id` is required — same identity contract as
4417
+ * clip invoke: bare names keep the fail-closed collision behavior (own-org
4418
+ * shadows installs; two installed namesakes → `409 CLIP_NAME_AMBIGUOUS`).
4419
+ */
4420
+ clip?: string;
4421
+ /**
4422
+ * Exact registry Clip id (`crg_…`). Selects the exact object without
4423
+ * weakening execution trust (cross-org still requires public + approved +
4424
+ * installed and runs only the approved snapshot).
4425
+ */
4426
+ clip_id?: string;
4427
+ /** Command to run — resolves to `<command>.js` in the clip's files. */
4428
+ command: string;
4429
+ /** Command arguments, forwarded verbatim to the clip. */
4430
+ args?: unknown;
4431
+ /** Connection id (`ccn_…`) or alias. Required for hosted devices. */
4432
+ connection?: string;
4433
+ /** Owned BYOC device id. Mutually exclusive with `connection`. */
4434
+ edge_id?: string;
4435
+ /**
4436
+ * Browser profile name. With `connection` it may only restate the profile
4437
+ * that connection grants (`400 CONNECTION_PROFILE_MISMATCH` otherwise).
4438
+ */
4439
+ profile?: string;
4440
+ /** Execution timeout in MILLISECONDS (default 30000, max 120000). */
4441
+ timeout?: number;
4442
+ /**
4443
+ * Optional audit tag (≤128 chars). Keep the SAME id across an
4444
+ * EDGE_ACTIVATING retry loop so the server's audit log reads the retries as
4445
+ * one logical call. It is NOT an idempotency key — it deduplicates nothing.
4446
+ */
4447
+ correlation_id?: string;
4448
+ }
4449
+
4450
+ /**
4451
+ * A completed execution's result envelope (HTTP 200). Every non-success is
4452
+ * thrown as a typed {@link ApiError} instead — see
4453
+ * {@link ParallClient.execEdgeClip} for the full code table and, critically,
4454
+ * which codes are safe to retry.
4455
+ */
4456
+ export interface EdgeClipExecResult {
4457
+ request_id: string;
4458
+ success: boolean;
4459
+ data?: unknown;
4460
+ error?: string;
4461
+ error_code?: string;
4462
+ duration_ms: number;
4463
+ }
4464
+
4188
4465
  /**
4189
4466
  * Two INDEPENDENT onboarding journeys. The original fields mean what they always
4190
4467
  * meant — "has this org set up the desktop journey?" — and hosted-backed state