@parall/sdk 1.26.3 → 1.28.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/constants.ts CHANGED
@@ -135,6 +135,8 @@ export const ENDPOINTS = {
135
135
  `${API_BASE}/orgs/${orgId}/chats/${chatId}/members`,
136
136
  CHAT_MEMBER: (orgId: string, chatId: string, userId: string) =>
137
137
  `${API_BASE}/orgs/${orgId}/chats/${chatId}/members/${userId}`,
138
+ CHAT_TRANSFER_OWNERSHIP: (orgId: string, chatId: string) =>
139
+ `${API_BASE}/orgs/${orgId}/chats/${chatId}/transfer-ownership`,
138
140
  CHAT_MESSAGES: (orgId: string, chatId: string) =>
139
141
  `${API_BASE}/orgs/${orgId}/chats/${chatId}/messages`,
140
142
 
@@ -215,10 +217,32 @@ export const ENDPOINTS = {
215
217
  `${API_BASE}/orgs/${orgId}/machines/${machineId}/status`,
216
218
  MACHINE_LOGS: (orgId: string, machineId: string) =>
217
219
  `${API_BASE}/orgs/${orgId}/machines/${machineId}/logs`,
220
+ MACHINE_SPEC: (orgId: string, machineId: string) =>
221
+ `${API_BASE}/orgs/${orgId}/machines/${machineId}/spec`,
218
222
  MACHINE_RESTART: (orgId: string, machineId: string) =>
219
223
  `${API_BASE}/orgs/${orgId}/machines/${machineId}/restart`,
220
224
  MACHINE_RESTART_ALL: (orgId: string) =>
221
225
  `${API_BASE}/orgs/${orgId}/machines/restart-all`,
226
+ // Daemon-mode Machine management (org-scoped, user auth).
227
+ // POST creates a new daemon-mode Machine (daemon_mode=true always).
228
+ // Attach/Detach bind an agent to/from a daemon Machine.
229
+ MACHINE_ATTACH_AGENT: (orgId: string, machineId: string, agentId: string) =>
230
+ `${API_BASE}/orgs/${orgId}/machines/${machineId}/agents/${agentId}`,
231
+ MACHINE_DETACH_AGENT: (orgId: string, machineId: string, agentId: string) =>
232
+ `${API_BASE}/orgs/${orgId}/machines/${machineId}/agents/${agentId}`,
233
+ MACHINE_RUNTIME_AUTH: (orgId: string, machineId: string) =>
234
+ `${API_BASE}/orgs/${orgId}/machines/${machineId}/runtime-auth`,
235
+
236
+ // Machine self-control-plane (mck_-scoped). The bearer token implicitly
237
+ // identifies the Machine, so there is no `:mid` URL parameter — these are
238
+ // "self" routes called by the daemon for its own host.
239
+ MACHINES_ME: `${API_BASE}/machines/me`,
240
+ MACHINES_ME_AGENTS: `${API_BASE}/machines/me/agents`,
241
+ MACHINES_ME_HEALTH: `${API_BASE}/machines/me/health`,
242
+ MACHINES_ME_AGENT_LAUNCH_CREDENTIAL: (agentId: string) =>
243
+ `${API_BASE}/machines/me/agents/${agentId}/launch-credential`,
244
+ MACHINES_ME_WS_TICKET: `${API_BASE}/machines/me/ws/ticket`,
245
+
222
246
  // Tasks (org-scoped)
223
247
  TASKS: (orgId: string) => `${API_BASE}/orgs/${orgId}/tasks`,
224
248
  TASK: (orgId: string, taskId: string) => `${API_BASE}/orgs/${orgId}/tasks/${taskId}`,
@@ -378,9 +402,6 @@ export const ENDPOINTS = {
378
402
  BILLING_CHECKOUT: (orgId: string) => `${API_BASE}/orgs/${orgId}/billing/checkout`,
379
403
  BILLING_AUTO_RELOAD: (orgId: string) => `${API_BASE}/orgs/${orgId}/billing/auto-reload`,
380
404
  BILLING_SETUP_INTENT: (orgId: string) => `${API_BASE}/orgs/${orgId}/billing/setup-intent`,
381
- // MACHINE_SPEC is intentionally absent until the server registers
382
- // `PATCH /machines/{machineId}/spec`. Reintroduce with ParallClient.resizeMachine
383
- // once the in-place resize endpoint lands.
384
405
  COMPUTE_PRICING: () => `${API_BASE}/billing/compute-pricing`,
385
406
 
386
407
  // ADMIN_GRANTS intentionally NOT exported here — it sits under the
@@ -450,6 +471,10 @@ export const WS_EVENTS = {
450
471
  BILLING_MACHINE_STOPPED: 'billing.machine_stopped',
451
472
  BILLING_INSUFFICIENT: 'billing.insufficient',
452
473
  USER_UPDATED: 'user.updated',
474
+ MACHINE_HELLO: 'machine.hello',
475
+ MACHINE_AGENT_ATTACHED: 'machine.agent.attached',
476
+ MACHINE_AGENT_DETACHED: 'machine.agent.detached',
477
+ MACHINE_STOP: 'machine.stop',
453
478
  } as const;
454
479
 
455
480
  // Canonical target URI builders for unified comments.
package/src/types.ts CHANGED
@@ -44,6 +44,7 @@ export interface Chat {
44
44
  archived_at?: string | null;
45
45
  deleted_at?: string | null;
46
46
  pinned: boolean;
47
+ hidden: boolean;
47
48
  my_notification_level?: NotificationLevel;
48
49
  }
49
50
 
@@ -84,6 +85,7 @@ export interface ChatMember {
84
85
  role: ChatMemberRole;
85
86
  notification_level: NotificationLevel;
86
87
  pinned: boolean;
88
+ hidden: boolean;
87
89
  joined_at: string;
88
90
  user?: User;
89
91
  }
@@ -91,9 +93,14 @@ export interface ChatMember {
91
93
  export interface UpdateChatMemberRequest {
92
94
  role?: ChatMemberRole;
93
95
  pinned?: boolean;
96
+ hidden?: boolean;
94
97
  notification_level?: NotificationLevel;
95
98
  }
96
99
 
100
+ export interface TransferChatOwnershipRequest {
101
+ target_user_id: string;
102
+ }
103
+
97
104
  export interface UnreadEntry {
98
105
  count: number;
99
106
  mentions: number;
@@ -526,6 +533,12 @@ export interface CreateAgentRequest {
526
533
  description?: string;
527
534
  machine_type?: string;
528
535
  machine_label?: string; // preset: "lite" | "standard" | "pro" | "custom"
536
+ /**
537
+ * Bind the new agent to an existing daemon-mode Machine in the same org.
538
+ * The machine must have the same owner as the new agent.
539
+ * When set, machine_label / cpu_cores / memory_mb / storage_gb are ignored.
540
+ */
541
+ machine_id?: string;
529
542
  // Required when machine_label === "custom". Validated server-side.
530
543
  cpu_cores?: number;
531
544
  memory_mb?: number;
@@ -635,12 +648,16 @@ export interface Machine {
635
648
  status: MachineStatus;
636
649
  compute_provider: string;
637
650
  runtime_type: string;
651
+ daemon_mode: boolean;
638
652
  region: string | null;
639
653
  created_by: string;
640
654
  created_at: string;
641
655
  updated_at: string;
642
656
  }
643
657
 
658
+ /** Response from `GET /orgs/{orgId}/machines/{machineId}/runtime-auth`. */
659
+ export type MachineRuntimeAuthState = RuntimeAuthConnectedState;
660
+
644
661
  // ---- Agent enriched types ----
645
662
 
646
663
  export interface RunConfig {
@@ -655,6 +672,7 @@ export interface AgentProfile {
655
672
  model_management: string | null; // "platform" | "self" | null
656
673
  permissions: string[];
657
674
  machine_id: string | null;
675
+ hosting_mode?: 'hosted' | 'self_hosted';
658
676
  runtime_type: string;
659
677
  description: string | null;
660
678
  thinking_effort: string | null;
@@ -680,6 +698,65 @@ export interface AgentWithRuntime extends User {
680
698
  presence?: AgentPresence | null;
681
699
  }
682
700
 
701
+ // ---- Daemon self-control-plane (mck_-scoped) ----
702
+ //
703
+ // These mirror the response shapes from the server's `/machines/me/...`
704
+ // routes. They are consumed by `ts/daemon` running on a daemon-mode
705
+ // Machine; ordinary product clients have no reason to import them.
706
+
707
+ /**
708
+ * One element of `GET /machines/me/agents`. Pairs the agent User row with
709
+ * its AgentProfile so the daemon can derive runtime_type / endpoint /
710
+ * model in one round-trip. Mirrors `handler.AttachedAgent` on the server.
711
+ *
712
+ * `user` may be null in the unlikely case the User row was deleted
713
+ * out from under an AgentProfile — the server still returns the
714
+ * profile so the daemon can log + skip.
715
+ */
716
+ export interface AttachedAgent {
717
+ user: User | null;
718
+ profile: AgentProfile;
719
+ }
720
+
721
+ // ---- Machine WS event data (daemon control plane) ----
722
+
723
+ export interface MachineHelloData {
724
+ conn_id: string;
725
+ machine_id: string;
726
+ server_time: string;
727
+ heartbeat_interval: number;
728
+ }
729
+
730
+ export interface MachineAgentAttachedData {
731
+ machine_id: string;
732
+ agent_id: string;
733
+ }
734
+
735
+ export interface MachineAgentDetachedData {
736
+ machine_id: string;
737
+ agent_id: string;
738
+ }
739
+
740
+ export interface MachineStopData {
741
+ machine_id: string;
742
+ reason?: string;
743
+ }
744
+
745
+ /** Wrapper for `GET /machines/me/agents`. */
746
+ export interface AttachedAgentsResponse {
747
+ data: AttachedAgent[];
748
+ }
749
+
750
+ /**
751
+ * Body of `POST /machines/me/agents/{agentId}/launch-credential`. Keys
752
+ * have no expiry; the daemon revokes previous keys on re-mint.
753
+ */
754
+ export interface LaunchCredentialResponse {
755
+ api_key: string;
756
+ id: string;
757
+ agent_id: string;
758
+ }
759
+
683
760
  export interface PresignUploadRequest {
684
761
  file_name: string;
685
762
  file_size: number;
@@ -1417,7 +1494,7 @@ export interface WatchingData {
1417
1494
  export interface MembershipChangedData {
1418
1495
  chat_id: string;
1419
1496
  user_id: string;
1420
- action: 'added' | 'removed';
1497
+ action: 'added' | 'removed' | 'role_changed';
1421
1498
  }
1422
1499
 
1423
1500
  // ---- Task Comment & Activity Types ----
@@ -1488,9 +1565,12 @@ export interface AgentSessionDB {
1488
1565
  id: string;
1489
1566
  agent_id: string;
1490
1567
  org_id: string;
1491
- status: string; // idle | active | completed | failed | cancelled
1568
+ status: string; // open | closed | failed | cancelled | superseded
1492
1569
  runtime_type: string;
1493
1570
  runtime_key: string | null;
1571
+ runtime_lane_key: string;
1572
+ runtime_session_id: string;
1573
+ parent_session_id: string | null;
1494
1574
  runtime_ref: Record<string, unknown> | null;
1495
1575
  trigger_message_id: string | null;
1496
1576
  started_at: string;
@@ -1514,6 +1594,9 @@ export interface AgentStep {
1514
1594
  export interface CreateAgentSessionRequest {
1515
1595
  runtime_type?: string;
1516
1596
  runtime_key?: string;
1597
+ runtime_lane_key?: string;
1598
+ runtime_session_id?: string;
1599
+ parent_session_id?: string;
1517
1600
  runtime_ref?: Record<string, unknown>;
1518
1601
  }
1519
1602
 
@@ -1592,7 +1675,8 @@ export interface CommentDeletedData {
1592
1675
  export type InboxItemType =
1593
1676
  | 'mention' | 'task_assign' | 'task_update'
1594
1677
  | 'task_comment' | 'approval_request'
1595
- | 'agent_alert' | 'invitation' | 'schedule_fire';
1678
+ | 'agent_alert' | 'invitation' | 'schedule_fire'
1679
+ | 'thread_reply';
1596
1680
 
1597
1681
  export interface InboxItem {
1598
1682
  id: string;
@@ -1739,6 +1823,10 @@ export type WsEventMap = {
1739
1823
  'billing.machine_stopped': BillingMachineStoppedEvent;
1740
1824
  'billing.insufficient': BillingInsufficientEvent;
1741
1825
  'user.updated': User;
1826
+ 'machine.hello': MachineHelloData;
1827
+ 'machine.agent.attached': MachineAgentAttachedData;
1828
+ 'machine.agent.detached': MachineAgentDetachedData;
1829
+ 'machine.stop': MachineStopData;
1742
1830
  };
1743
1831
 
1744
1832
  // Invitation WS event data
@@ -1902,7 +1990,7 @@ export type RuntimeAuthStatus = 'pending' | 'completed' | 'failed' | 'expired';
1902
1990
 
1903
1991
  export interface RuntimeAuthSession {
1904
1992
  id: string;
1905
- agent_id: string;
1993
+ agent_id: string | null;
1906
1994
  machine_id: string;
1907
1995
  runtime_type: string;
1908
1996
  method: RuntimeAuthMethod;
@@ -1989,7 +2077,7 @@ export interface CreditWallet {
1989
2077
  export interface CreditTransaction {
1990
2078
  id: string;
1991
2079
  org_id: string;
1992
- type: 'topup' | 'auto_reload' | 'llm_deduct' | 'compute_deduct' | 'adjustment' | 'refund' | 'grant' | 'grant_expire';
2080
+ type: 'topup' | 'auto_reload' | 'llm_deduct' | 'compute_deduct' | 'compute_hold' | 'compute_settle' | 'adjustment' | 'refund' | 'grant' | 'grant_expire';
1993
2081
  amount: number;
1994
2082
  balance_after: number;
1995
2083
  grant_id: string | null;
@@ -1997,9 +2085,23 @@ export interface CreditTransaction {
1997
2085
  reference_type: string | null;
1998
2086
  reference_id: string | null;
1999
2087
  metadata: Record<string, unknown> | null;
2088
+ actor_id: string | null;
2000
2089
  created_at: string;
2001
2090
  }
2002
2091
 
2092
+ export interface CreditTransactionAgentGroup {
2093
+ actor_id: string | null;
2094
+ count: number;
2095
+ total: number;
2096
+ }
2097
+
2098
+ export interface CreditTransactionMachineGroup {
2099
+ machine_id: string | null;
2100
+ machine_label: string | null;
2101
+ count: number;
2102
+ total: number;
2103
+ }
2104
+
2003
2105
  export interface BillingSummary {
2004
2106
  balance: number;
2005
2107
  llm_usage_this_month: number;
@@ -2094,9 +2196,11 @@ export interface CreateSetupIntentResponse {
2094
2196
  client_secret?: string;
2095
2197
  }
2096
2198
 
2097
- // ResizeMachineRequest was retired pending the server-side
2098
- // `PATCH /machines/{id}/spec` route. Reintroduce alongside the route and
2099
- // the matching ParallClient method when in-place resize is implemented.
2199
+ export interface ResizeMachineRequest {
2200
+ cpu_cores?: number;
2201
+ memory_mb?: number;
2202
+ storage_gb?: number;
2203
+ }
2100
2204
 
2101
2205
  // Invalidation signal: server publishes only { org_id } on any wallet
2102
2206
  // change; clients refetch `getBilling` / `listBillingTransactions` to get