@parall/sdk 1.48.0 → 1.50.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
 
@@ -132,6 +138,38 @@ export type MessageType =
132
138
 
133
139
  export const MENTION_ALL_USER_ID = 'all';
134
140
 
141
+ /**
142
+ * Member-type-filtered variants of the @all broadcast mention (group chats
143
+ * only): identical notification semantics, recipient set limited to human /
144
+ * agent members respectively.
145
+ */
146
+ export const MENTION_ALL_HUMANS_USER_ID = 'allhuman';
147
+ export const MENTION_ALL_AGENTS_USER_ID = 'allagent';
148
+
149
+ /** True when a mention user_id is a broadcast token rather than a usr_ id. */
150
+ export function isBroadcastMentionId(userId: string): boolean {
151
+ return (
152
+ userId === MENTION_ALL_USER_ID ||
153
+ userId === MENTION_ALL_HUMANS_USER_ID ||
154
+ userId === MENTION_ALL_AGENTS_USER_ID
155
+ );
156
+ }
157
+
158
+ /**
159
+ * True when a mention user_id addresses the given viewer — either their own
160
+ * usr_ id, @all, or the typed broadcast matching their user type.
161
+ */
162
+ export function mentionTargetsUser(
163
+ mentionUserId: string,
164
+ userId: string,
165
+ userType: UserType,
166
+ ): boolean {
167
+ if (mentionUserId === userId || mentionUserId === MENTION_ALL_USER_ID) return true;
168
+ if (mentionUserId === MENTION_ALL_HUMANS_USER_ID) return userType === 'human';
169
+ if (mentionUserId === MENTION_ALL_AGENTS_USER_ID) return userType === 'agent';
170
+ return false;
171
+ }
172
+
135
173
  export interface Mention {
136
174
  user_id: string;
137
175
  offset: number;
@@ -273,6 +311,12 @@ export interface Message {
273
311
  * absent from the stack. A reload re-derives it from the server's view.
274
312
  */
275
313
  recent_repliers?: User[];
314
+ /**
315
+ * Per-viewer count of thread replies newer than the viewer's thread read
316
+ * cursor, excluding the viewer's own replies (root only). Populated on
317
+ * top-level list responses; omitted when zero.
318
+ */
319
+ unread_reply_count?: number;
276
320
  edited_at: string | null;
277
321
  deleted_at: string | null;
278
322
  created_at: string;
@@ -281,6 +325,27 @@ export interface Message {
281
325
  agent_session_id?: string | null;
282
326
  hints?: MessageHints | null;
283
327
  attachments?: Attachment[];
328
+ reactions?: ReactionSummary[];
329
+ }
330
+
331
+ /**
332
+ * Aggregated reactions for one emoji on a message.
333
+ *
334
+ * `has_reacted` is viewer-relative in REST responses. In
335
+ * `message.reaction.updated` WS broadcasts it is computed for the ACTOR who
336
+ * triggered the toggle — subscribers must recompute their own state from
337
+ * `user_ids` (see docs/engineering-design/ws-protocol.md).
338
+ */
339
+ export interface ReactionSummary {
340
+ emoji: string;
341
+ count: number;
342
+ user_ids: string[];
343
+ has_reacted: boolean;
344
+ }
345
+
346
+ export interface ToggleReactionResponse {
347
+ added: boolean;
348
+ reactions: ReactionSummary[];
284
349
  }
285
350
 
286
351
  export interface Attachment {
@@ -368,9 +433,48 @@ export interface OrgMember {
368
433
  user_id: string;
369
434
  role: OrgMemberRole;
370
435
  joined_at: string;
436
+ // Org-scoped public profile projection. Missing profile row reads as
437
+ // empty strings with profile_version 0.
438
+ title: string;
439
+ description: string;
440
+ profile_version: number;
371
441
  user?: User;
372
442
  }
373
443
 
444
+ // Org-scoped public member profile (Human and Agent alike). Never carries
445
+ // private agent Instructions.
446
+ export interface MemberProfile {
447
+ user_id: string;
448
+ display_name: string;
449
+ type: UserType;
450
+ title: string;
451
+ description: string;
452
+ profile_version: number;
453
+ }
454
+
455
+ // Full-replacement update over {title, description} with a version CAS.
456
+ // expected_version 0 = first write (no profile row yet). A stale version
457
+ // gets 409 PROFILE_VERSION_CONFLICT with error.details.current_version.
458
+ export interface UpdateMemberProfileRequest {
459
+ title: string;
460
+ description: string;
461
+ expected_version: number;
462
+ }
463
+
464
+ // Private agent Instructions — org-admin maintained runtime context.
465
+ export interface AgentInstructions {
466
+ agent_user_id: string;
467
+ instructions: string;
468
+ version: number;
469
+ updated_at?: string;
470
+ updated_by?: string;
471
+ }
472
+
473
+ export interface UpdateAgentInstructionsRequest {
474
+ instructions: string;
475
+ expected_version: number;
476
+ }
477
+
374
478
  // Team — a named group of org members, referenced in wiki ACLs as `@slug`.
375
479
  export interface Team {
376
480
  id: string;
@@ -528,6 +632,159 @@ export interface FeatureFlagsResponse {
528
632
  flags: Record<string, boolean | string | number>;
529
633
  }
530
634
 
635
+ // ============================================================
636
+ // Team Template Types
637
+ // ============================================================
638
+
639
+ export type TemplateParameterInputType = 'text' | 'select' | 'multi';
640
+ export type TemplateParameterValue = string | string[];
641
+
642
+ export interface TemplateParameter {
643
+ key: string;
644
+ label: string;
645
+ input_type: TemplateParameterInputType;
646
+ options?: string[];
647
+ default?: TemplateParameterValue;
648
+ required?: boolean;
649
+ }
650
+
651
+ export interface TemplateDependency {
652
+ type: 'clip';
653
+ ref: string;
654
+ required?: boolean;
655
+ degraded_note?: string;
656
+ }
657
+
658
+ export interface TemplateAgentPublicProfile {
659
+ title: string;
660
+ description: string;
661
+ }
662
+
663
+ export interface TemplateAgentSpec {
664
+ key: string;
665
+ display_name: string;
666
+ public_profile: TemplateAgentPublicProfile;
667
+ instructions: string;
668
+ runtime_type?: string;
669
+ model?: string | null;
670
+ compute?: {
671
+ machine_type: 'cloud';
672
+ machine_label?: string;
673
+ } | null;
674
+ dependencies?: TemplateDependency[];
675
+ }
676
+
677
+ export interface TemplateWorkspaceScaffold {
678
+ channels: Array<{
679
+ purpose?: string;
680
+ name_pattern: string;
681
+ }>;
682
+ schedules?: Array<{
683
+ agent_key: string;
684
+ name: string;
685
+ cron: string;
686
+ description: string;
687
+ }>;
688
+ project?: {
689
+ name_pattern: string;
690
+ } | null;
691
+ }
692
+
693
+ export interface TemplateDefinition {
694
+ name: string;
695
+ mission: string;
696
+ scope_tags?: string[];
697
+ outcomes?: string[];
698
+ agents: TemplateAgentSpec[];
699
+ workspace_scaffold: TemplateWorkspaceScaffold;
700
+ parameters?: TemplateParameter[];
701
+ }
702
+
703
+ // Explicit organization catalog projection. It intentionally does not extend
704
+ // the authoring types: future authoring fields must never become public by
705
+ // inheritance. Instructions, runtime/model/compute, and workspace seed data
706
+ // stay on the cluster-internal CRUD and server-side deployment path.
707
+ export interface TemplateCatalogAgentSpec {
708
+ key: string;
709
+ display_name: string;
710
+ public_profile: TemplateAgentPublicProfile;
711
+ dependencies?: Array<Pick<TemplateDependency, 'type' | 'ref' | 'required'>>;
712
+ }
713
+
714
+ export interface TemplateCatalogDefinition {
715
+ name: string;
716
+ mission: string;
717
+ scope_tags?: string[];
718
+ outcomes?: string[];
719
+ agents: TemplateCatalogAgentSpec[];
720
+ parameters?: TemplateParameter[];
721
+ }
722
+
723
+ // Resolved in the target organization at catalog-read time. This is not part
724
+ // of the persisted authoring definition and carries no readiness/connection
725
+ // state.
726
+ export interface TemplateDependencyMetadata {
727
+ type: 'clip';
728
+ ref: string;
729
+ display_name: string;
730
+ }
731
+
732
+ export interface Template {
733
+ id: string;
734
+ version: string;
735
+ /** Opaque token pinning the version + exact definition shown to the user. */
736
+ revision: string;
737
+ name: string;
738
+ definition: TemplateCatalogDefinition;
739
+ dependency_metadata?: TemplateDependencyMetadata[];
740
+ status: 'active' | 'archived';
741
+ created_at: string;
742
+ updated_at: string;
743
+ }
744
+
745
+ export interface DeployTemplateRequest {
746
+ template_id: string;
747
+ template_revision: string;
748
+ parameter_values?: Record<string, TemplateParameterValue>;
749
+ }
750
+
751
+ export type TemplateDeploymentAgentState = 'up' | 'provisioning' | 'error';
752
+
753
+ export interface TemplateDeploymentReport {
754
+ deployment_id: string;
755
+ status: 'deployed';
756
+ team: {
757
+ name: string;
758
+ main_chat_id: string;
759
+ };
760
+ agents: Array<{
761
+ key: string;
762
+ agent_id: string;
763
+ display_name: string;
764
+ public_profile: TemplateAgentPublicProfile;
765
+ runtime: string;
766
+ state: TemplateDeploymentAgentState;
767
+ }>;
768
+ resources: {
769
+ chats: Array<{ id: string; name: string }>;
770
+ schedules: Array<{ id: string; name: string }>;
771
+ project_id?: string;
772
+ };
773
+ dependencies: Array<{
774
+ type: 'clip';
775
+ ref: string;
776
+ name?: string;
777
+ required: boolean;
778
+ connected: boolean;
779
+ declared_by: string[];
780
+ }>;
781
+ kickoff: {
782
+ sent: boolean;
783
+ message_id?: string;
784
+ error?: string;
785
+ };
786
+ }
787
+
531
788
  // ============================================================
532
789
  // API Request Types
533
790
  // ============================================================
@@ -666,6 +923,9 @@ export interface CreateAgentRequest {
666
923
  thinking_effort?: string; // model-dependent: "minimal" | "low" | "medium" | "high" | "xhigh" | "max"
667
924
  agent_permissions?: string[];
668
925
  runtime_type?: string; // "openclaw" | "claude-code" | "codex"; default "openclaw"
926
+ // Preferred write field for the agent's private instruction text.
927
+ instructions?: string;
928
+ /** @deprecated Same-value alias of `instructions`; loses when both are set. */
669
929
  description?: string;
670
930
  machine_type?: string;
671
931
  machine_label?: string; // preset: "lite" | "standard" | "pro" | "custom"
@@ -762,6 +1022,9 @@ export interface UpdateAgentRequest {
762
1022
  agent_model?: string;
763
1023
  model_management?: string;
764
1024
  agent_permissions?: string[];
1025
+ // Preferred write field for the agent's private instruction text.
1026
+ instructions?: string;
1027
+ /** @deprecated Same-value alias of `instructions`; loses when both are set. */
765
1028
  description?: string;
766
1029
  thinking_effort?: string;
767
1030
  }
@@ -919,7 +1182,18 @@ export interface AgentProfile {
919
1182
  machine_id: string | null;
920
1183
  hosting_mode?: 'hosted' | 'self_hosted' | 'platform_runtime';
921
1184
  runtime_type: string;
1185
+ /**
1186
+ * @deprecated Alias of `instructions` kept for pre-rename readers; the
1187
+ * server keeps both byte-identical. Use `instructions` (and the
1188
+ * dedicated instructions endpoints) instead.
1189
+ */
922
1190
  description: string | null;
1191
+ // Private Instructions (admin-maintained runtime context). Redacted for
1192
+ // non-admin viewers on list surfaces, same as description.
1193
+ instructions?: string | null;
1194
+ instructions_version?: number;
1195
+ instructions_updated_at?: string | null;
1196
+ instructions_updated_by?: string | null;
923
1197
  thinking_effort: string | null;
924
1198
  run_config?: RunConfig;
925
1199
  created_by: string;
@@ -939,6 +1213,10 @@ export interface AgentPresence {
939
1213
 
940
1214
  export interface AgentWithRuntime extends User {
941
1215
  agent_profile?: AgentProfile | null;
1216
+ // Org-scoped public profile (title / public description) for the org the
1217
+ // request is scoped to. Runtimes read it from /agents/me to build the
1218
+ // public identity prompt section.
1219
+ public_profile?: MemberProfile | null;
942
1220
  machine?: Machine | null;
943
1221
  presence?: AgentPresence | null;
944
1222
  }
@@ -1159,6 +1437,13 @@ export interface Task {
1159
1437
  seq_number: number | null;
1160
1438
  identifier: string | null;
1161
1439
  sort_order: number;
1440
+ /**
1441
+ * Planned start date, YYYY-MM-DD (calendar date, timezone-free) — the
1442
+ * planned schedule's left edge, independent of started_at (when work
1443
+ * actually began). Absent on servers older than migration 145. When both
1444
+ * dates are set, planned_start_date <= due_date.
1445
+ */
1446
+ planned_start_date?: string | null;
1162
1447
  /** Planned completion date, YYYY-MM-DD (calendar date, timezone-free). */
1163
1448
  due_date: string | null;
1164
1449
  assignee?: User;
@@ -1246,6 +1531,8 @@ export interface CreateTaskRequest {
1246
1531
  project_id?: string;
1247
1532
  source_chat_id?: string;
1248
1533
  sort_order?: number;
1534
+ /** Planned start date, YYYY-MM-DD. Must be <= due_date when both are set. */
1535
+ planned_start_date?: string;
1249
1536
  /** Planned completion date, YYYY-MM-DD. */
1250
1537
  due_date?: string;
1251
1538
  }
@@ -1266,6 +1553,12 @@ export interface UpdateTaskRequest {
1266
1553
  * full column. Mutually exclusive with sort_order.
1267
1554
  */
1268
1555
  placement?: 'end';
1556
+ /**
1557
+ * Planned start date, YYYY-MM-DD; explicit null clears it. The post-patch
1558
+ * state must satisfy planned_start_date <= due_date when both are set
1559
+ * (400 INVALID_DATE_RANGE otherwise).
1560
+ */
1561
+ planned_start_date?: string | null;
1269
1562
  /** Planned completion date, YYYY-MM-DD; explicit null clears it. */
1270
1563
  due_date?: string | null;
1271
1564
  /**
@@ -2179,6 +2472,20 @@ export interface MessageDeleteData {
2179
2472
  thread_root_id?: string;
2180
2473
  }
2181
2474
 
2475
+ /**
2476
+ * Payload of the `message.reaction.updated` WS broadcast. `reactions` is the
2477
+ * full aggregated snapshot for the message; its `has_reacted` flags are
2478
+ * actor-relative (see {@link ReactionSummary}) — recompute from `user_ids`.
2479
+ */
2480
+ export interface ReactionUpdatedData {
2481
+ message_id: string;
2482
+ chat_id: string;
2483
+ emoji: string;
2484
+ user_id: string;
2485
+ added: boolean;
2486
+ reactions: ReactionSummary[];
2487
+ }
2488
+
2182
2489
  export interface TypingUpdateData {
2183
2490
  chat_id: string;
2184
2491
  thread_root_id: string | null;
@@ -3073,6 +3380,13 @@ export interface ReadPositionUpdateData {
3073
3380
  last_read_message_id: string;
3074
3381
  }
3075
3382
 
3383
+ /** Per-thread read cursor sync across the user's devices. */
3384
+ export interface ThreadReadPositionUpdateData {
3385
+ chat_id: string;
3386
+ thread_root_id: string;
3387
+ last_read_reply_id: string;
3388
+ }
3389
+
3076
3390
  export interface NotificationAlertData {
3077
3391
  title: string;
3078
3392
  body: string;
@@ -3087,6 +3401,7 @@ export type WsEventMap = {
3087
3401
  'message.patch': MessagePatchData;
3088
3402
  'message.edit': MessageEditData;
3089
3403
  'message.delete': MessageDeleteData;
3404
+ 'message.reaction.updated': ReactionUpdatedData;
3090
3405
  'typing.update': TypingUpdateData;
3091
3406
  'chat.created': ChatCreatedData;
3092
3407
  'chat.update': ChatUpdateData;
@@ -3131,6 +3446,7 @@ export type WsEventMap = {
3131
3446
  'inbox.update': InboxUpdateData;
3132
3447
  'inbox.bulk_update': InboxBulkUpdateData;
3133
3448
  'read_position.updated': ReadPositionUpdateData;
3449
+ 'thread_read_position.updated': ThreadReadPositionUpdateData;
3134
3450
  'dispatch.new': DispatchNewData;
3135
3451
  'dispatch.received': DispatchReceivedData;
3136
3452
  'dispatch.resolved': DispatchResolvedData;
@@ -3335,6 +3651,37 @@ export interface BacklinksResponse {
3335
3651
  next_cursor?: string;
3336
3652
  }
3337
3653
 
3654
+ /**
3655
+ * Request for POST /orgs/{orgId}/refs/outbound — two mutually exclusive
3656
+ * forms, modeled as a union so an invalid mixed shape fails at compile time:
3657
+ * `thread_root_id` resolves a thread's message set server-side (root + ALL
3658
+ * non-deleted replies — the client's reply window may be partial), while
3659
+ * `source_type` + `source_ids` lists explicit sources (max 500; v1 accepts
3660
+ * only `message` sources).
3661
+ */
3662
+ export type OutboundRefsRequest =
3663
+ | { thread_root_id: string; source_type?: never; source_ids?: never }
3664
+ | { source_type: string; source_ids: string[]; thread_root_id?: never };
3665
+
3666
+ /** One raw ref_links row; dedupe/grouping is a client concern. */
3667
+ export interface OutboundRefItem {
3668
+ uri: string;
3669
+ target_type: string;
3670
+ target_id: string;
3671
+ target_path?: string;
3672
+ target_frag?: string;
3673
+ context?: string;
3674
+ source_type: string;
3675
+ source_id: string;
3676
+ position: number;
3677
+ }
3678
+
3679
+ export interface OutboundRefsResponse {
3680
+ data: OutboundRefItem[];
3681
+ /** Set when the server-side sanity cap dropped the tail of the row set. */
3682
+ truncated?: boolean;
3683
+ }
3684
+
3338
3685
  /**
3339
3686
  * One entity in a multi-hop ref-graph traversal (GET /refs/graph). `id`/`uri` are
3340
3687
  * the ref_links endpoint identifier: a bare prll:// entity id for most nodes
@@ -3976,6 +4323,29 @@ export interface BrowserViewerCommandResponse {
3976
4323
  result: Record<string, unknown> | null;
3977
4324
  }
3978
4325
 
4326
+ /**
4327
+ * Cloud Edge live viewer (V1b, design §6). Same request/reply shape as the v2
4328
+ * browser-profile viewer — the transport-agnostic `BrowserViewer` client drives
4329
+ * either — but a distinct type so the edge viewer surface never depends on the
4330
+ * v2 browser-profile viewer symbols.
4331
+ */
4332
+ export interface EdgeViewerCommandRequest {
4333
+ /** Correlates a viewer session. Omit on `stream.start`; the server returns one. */
4334
+ session_id?: string;
4335
+ command: string;
4336
+ input?: Record<string, unknown>;
4337
+ }
4338
+
4339
+ export interface EdgeViewerCommandResponse {
4340
+ session_id: string;
4341
+ /**
4342
+ * Command-specific result. For `stream.start`:
4343
+ * `{ offer_sdp, candidates, ice_servers, streamed_tab_id }`. May be `null` on
4344
+ * the wire (a nil Go result map serializes as JSON null); coalesce to `{}`.
4345
+ */
4346
+ result: Record<string, unknown> | null;
4347
+ }
4348
+
3979
4349
  export interface GrantBrowserProfileConsentRequest {
3980
4350
  clip_id: string;
3981
4351
  }
@@ -4187,6 +4557,45 @@ export interface EdgeBrowserProfile {
4187
4557
  is_default: boolean;
4188
4558
  created_at: string;
4189
4559
  updated_at: string;
4560
+ /**
4561
+ * True when the profile has a fixed egress proxy configured (hosted Cloud
4562
+ * Profiles). Presence flag only — endpoint/username/password are readable
4563
+ * exclusively by managers via the dedicated proxy endpoint, and the password
4564
+ * never leaves the server.
4565
+ */
4566
+ proxy_configured?: boolean;
4567
+ }
4568
+
4569
+ /**
4570
+ * Sanitized per-profile egress proxy status (hosted Cloud Profiles) — the GET
4571
+ * response and the PUT/DELETE result. NEVER carries the password; `password_set`
4572
+ * is the only trace of it.
4573
+ */
4574
+ export interface EdgeProfileProxyStatus {
4575
+ configured: boolean;
4576
+ server?: string;
4577
+ username?: string;
4578
+ password_set: boolean;
4579
+ /** Opaque compare-and-swap token for conditional PUT/DELETE. */
4580
+ version: string;
4581
+ /** Authoritative mutation gate; false whenever a non-released lease exists. */
4582
+ can_mutate: boolean;
4583
+ /** Actual lease state blocking a mutation (never inferred from device status). */
4584
+ lease_status?: 'pending' | 'assigned' | 'active' | 'releasing' | 'repair';
4585
+ /** Suggested delay before re-reading authoritative state. */
4586
+ retry_after_seconds?: number;
4587
+ }
4588
+
4589
+ /**
4590
+ * PUT body for a profile's egress proxy: the FULL triple every time (no
4591
+ * tri-state merge — the stored blob is encrypted, so replace always re-supplies
4592
+ * complete credentials). Clearing is DELETE, never an empty PUT. Username and
4593
+ * password go together or not at all.
4594
+ */
4595
+ export interface SetEdgeProfileProxyRequest {
4596
+ server: string;
4597
+ username?: string;
4598
+ password?: string;
4190
4599
  }
4191
4600
 
4192
4601
  export interface ClipConnection {