@parall/sdk 1.55.3 → 1.55.5

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
@@ -4,6 +4,13 @@ import type {
4
4
  LabelDeletedData,
5
5
  LabelUpdatedData,
6
6
  } from './task-label-types.js';
7
+ export type {
8
+ CompletedUploadPart,
9
+ FileUrlResponse,
10
+ PresignedUploadPart,
11
+ PresignResponse,
12
+ PresignUploadRequest,
13
+ } from './attachment-types.js';
7
14
 
8
15
  // ============================================================
9
16
  // Entity Types — mirror server data model
@@ -60,12 +67,31 @@ export interface Chat {
60
67
  pinned: boolean;
61
68
  hidden: boolean;
62
69
  my_notification_level?: NotificationLevel;
70
+ /**
71
+ * Resolved per-(agent, chat) reply policy for an AGENT caller: override →
72
+ * room default → mentions_only floor, gated on the runtime capability.
73
+ * Absent for human callers, DMs, and smart chats — a runtime reading
74
+ * nothing here falls back to its legacy agent_routing_mode check.
75
+ */
76
+ my_agent_reply_policy?: AgentReplyPolicy;
63
77
  }
64
78
 
65
79
  export type ChatMemberRole = 'owner' | 'admin' | 'member';
66
80
 
67
81
  export type NotificationLevel = 'all' | 'mentions_only' | 'none';
68
82
 
83
+ /** Trigger axis of the per-(agent, chat) reply policy. No 'none': @mentions
84
+ * are an unsuppressible floor, so it would equal 'mentions_only'. */
85
+ export type AgentReplyTrigger = 'all' | 'mentions_only';
86
+
87
+ /** Reply-form axis; V1 defines only 'full'. */
88
+ export type AgentReplyForm = 'full';
89
+
90
+ export interface AgentReplyPolicy {
91
+ trigger: AgentReplyTrigger;
92
+ form: AgentReplyForm;
93
+ }
94
+
69
95
  // Push notification subscription
70
96
  export interface PushSubscribeRequest {
71
97
  platform: 'web' | 'ios' | 'android';
@@ -101,6 +127,14 @@ export interface ChatMember {
101
127
  pinned: boolean;
102
128
  hidden: boolean;
103
129
  joined_at: string;
130
+ /**
131
+ * Per-(agent, chat) trigger override on an AGENT member row; absent/null =
132
+ * follow the room default. Writable by chat owners/admins and org admins
133
+ * only — never by the agent itself.
134
+ */
135
+ agent_reply_trigger?: AgentReplyTrigger | null;
136
+ /** Reply-form axis; always 'full' in V1. Absent on older servers. */
137
+ agent_reply_form?: AgentReplyForm;
104
138
  /** Org-scoped public title. Omitted by older servers and for former DM peers. */
105
139
  title?: string;
106
140
  user?: User;
@@ -111,6 +145,11 @@ export interface UpdateChatMemberRequest {
111
145
  pinned?: boolean;
112
146
  hidden?: boolean;
113
147
  notification_level?: NotificationLevel;
148
+ /** 'all' | 'mentions_only' sets the override; '' clears it (follow the
149
+ * room default). Chat-governance authz — agents can never write it. */
150
+ agent_reply_trigger?: AgentReplyTrigger | '';
151
+ /** V1 accepts only 'full'. */
152
+ agent_reply_form?: AgentReplyForm;
114
153
  }
115
154
 
116
155
  export interface TransferChatOwnershipRequest {
@@ -237,6 +276,8 @@ export interface ApprovalCardContent {
237
276
  display: {
238
277
  title: string;
239
278
  description?: string;
279
+ request_reason?: string;
280
+ resource_label?: string;
240
281
  requester?: { id: string; name: string };
241
282
  };
242
283
  interaction: {
@@ -248,6 +289,7 @@ export interface ApprovalCardContent {
248
289
  status: string;
249
290
  decided_by?: string;
250
291
  decided_at?: string;
292
+ decision_reason?: string | null;
251
293
  execution_status?: ExecutionStatus | null;
252
294
  execution_error?: string | null;
253
295
  executed_at?: string | null;
@@ -289,6 +331,7 @@ export interface SystemContent {
289
331
  actor_name: string;
290
332
  target_id?: string;
291
333
  target_name?: string;
334
+ decision_reason?: string;
292
335
  }
293
336
 
294
337
  export type MessageContent =
@@ -381,9 +424,12 @@ export interface Approval {
381
424
  resource_uri: string;
382
425
  action_payload: Record<string, unknown>;
383
426
  title: string;
427
+ request_reason?: string | null;
428
+ resource_label?: string | null;
384
429
  requester_id: string;
385
430
  decided_by: string | null;
386
431
  decided_at: string | null;
432
+ decision_reason?: string | null;
387
433
  status: ApprovalStatus;
388
434
  expires_at: string | null;
389
435
  execution_status?: ExecutionStatus | null;
@@ -412,6 +458,9 @@ export interface Organization {
412
458
  avatar_url: string | null;
413
459
  is_personal: boolean;
414
460
  member_limit: number | null;
461
+ attachment_max_file_size_bytes?: number | null;
462
+ attachment_storage_limit_bytes?: number | null;
463
+ attachment_storage_used_bytes?: number;
415
464
  /** Org-level default smart routing strategy: 'llm' | 'agent' | null. */
416
465
  smart_routing_strategy: string | null;
417
466
  /** Agent ID for strategy='agent'. NULL when strategy is 'llm' or unset. */
@@ -699,12 +748,6 @@ export interface CheckEmailResponse {
699
748
  pending_verification?: boolean;
700
749
  }
701
750
 
702
- export interface PresignResponse {
703
- upload_url: string;
704
- attachment_id: string;
705
- expires_in: number;
706
- }
707
-
708
751
  export interface WsTicketResponse {
709
752
  ticket: string;
710
753
  expires_at: string;
@@ -1000,6 +1043,13 @@ export interface SendMessageRequest {
1000
1043
  export interface MessageDispatchSource {
1001
1044
  source_type: string;
1002
1045
  source_id: string;
1046
+ /**
1047
+ * Conversation generation of the sending execution (parel v2 invocation
1048
+ * context). Required by the server for agents on the direct_session_v2
1049
+ * transport; a value older than the current New Session barrier is
1050
+ * rejected (STALE_GENERATION).
1051
+ */
1052
+ generation?: number;
1003
1053
  }
1004
1054
 
1005
1055
  /** One WorkItem source pointer for the by-source complete surface. */
@@ -1529,23 +1579,6 @@ export interface LaunchCredentialResponse {
1529
1579
  agent_id: string;
1530
1580
  }
1531
1581
 
1532
- export interface PresignUploadRequest {
1533
- file_name: string;
1534
- file_size: number;
1535
- mime_type?: string;
1536
- }
1537
-
1538
- export interface FileUrlResponse {
1539
- url: string;
1540
- is_proxy_url?: boolean;
1541
- expires_in: number;
1542
- width?: number;
1543
- height?: number;
1544
- file_name: string;
1545
- file_size: number;
1546
- mime_type: string;
1547
- }
1548
-
1549
1582
  export interface AvatarUploadResponse {
1550
1583
  avatar_url: string;
1551
1584
  }
@@ -1730,16 +1763,25 @@ export interface UpdateTaskRequest {
1730
1763
  */
1731
1764
  label_ids?: string[] | null;
1732
1765
  /**
1733
- * Dispatch lane binding (agent senders during a typed dispatch turn).
1734
- * dispatch_lane + dispatch_event_id bind the update to the claimed typed
1735
- * lane (incumbency-checked); dispatch_effect_key — exactly
1736
- * "task_update:<dispatch_event_id>" additionally commits the update as
1766
+ * Dispatch binding (agent senders during a typed dispatch turn).
1767
+ * Lane-bound form (v1 consumers): dispatch_lane + dispatch_event_id bind
1768
+ * the update to the claimed typed lane (incumbency-checked).
1769
+ * By-id form (parel v2 converged consumers — no lane exists):
1770
+ * dispatch_event_id + dispatch_generation bind the update to the WorkItem
1771
+ * directly under the conversation-generation fence.
1772
+ * In both forms dispatch_effect_key additionally commits the update as
1737
1773
  * the dispatch's idempotent Effect and resolves the WorkItem in the same
1738
- * transaction (first update only).
1774
+ * transaction. Lane-bound: exactly "task_update:<dispatch_event_id>" —
1775
+ * first update only; later updates go fenced keyless (the CLI sidecar
1776
+ * arbitrates). By-id: "task_update:<dispatch_event_id>:<payload-hash>" —
1777
+ * content-addressed, every distinct update carries its own key; the first
1778
+ * resolves the WorkItem and later keys land as their own Effects against
1779
+ * the already-resolved row.
1739
1780
  */
1740
1781
  dispatch_lane?: string;
1741
1782
  dispatch_event_id?: string;
1742
1783
  dispatch_effect_key?: string;
1784
+ dispatch_generation?: number;
1743
1785
  }
1744
1786
 
1745
1787
  export interface CreateTaskRelationRequest {
@@ -2239,10 +2281,35 @@ export type WikiChangesetStatus =
2239
2281
  | 'superseded'
2240
2282
  | 'conflict';
2241
2283
 
2284
+ export type WikiAccessTier = 'public' | 'restricted' | 'private';
2285
+ export type WikiMemberRole = 'viewer' | 'editor' | 'manager';
2286
+
2287
+ export interface WikiAccessPolicyMember {
2288
+ subject: string; // usr_* or team ID
2289
+ role: WikiMemberRole;
2290
+ }
2291
+
2292
+ /** GET/PUT shape of the who-can-access projection (membership design §4).
2293
+ * PUT must echo the revision from the latest GET (409 POLICY_REVISION_STALE
2294
+ * on mismatch). Container policy bits ride the root ('' path) PUT only. */
2295
+ export interface WikiAccessPolicy {
2296
+ path: string;
2297
+ general_access: WikiAccessTier | 'inherit';
2298
+ default_role?: 'editor' | 'viewer';
2299
+ discoverable: boolean;
2300
+ members: WikiAccessPolicyMember[];
2301
+ revision: string;
2302
+ /** Stored rows the projection cannot express — route to the advanced rules surface. */
2303
+ advanced?: boolean;
2304
+ editors_can_invite?: boolean;
2305
+ viewers_can_download?: boolean;
2306
+ }
2307
+
2242
2308
  export interface Wiki {
2243
2309
  id: string;
2244
2310
  org_id: string;
2245
- slug: string;
2311
+ /** Absent on degraded listing entries (discoverable-but-unreadable). */
2312
+ slug?: string;
2246
2313
  name: string;
2247
2314
  repo_owner: string;
2248
2315
  repo_name: string;
@@ -2263,6 +2330,14 @@ export interface Wiki {
2263
2330
  purge_eligible_at?: string | null;
2264
2331
  /** Server-computed restore availability for recycle-bin rows. */
2265
2332
  restorable?: boolean | null;
2333
+ /** Derived from the root path rules (never stored): public | restricted | private. */
2334
+ access_tier?: 'public' | 'restricted' | 'private';
2335
+ /** Caller's explicit membership at the library root: none | viewer | editor | manager. */
2336
+ my_membership?: 'none' | 'viewer' | 'editor' | 'manager';
2337
+ /** True for discoverable-but-unreadable listing entries: only id, name and
2338
+ * access_tier are populated — enough to request to join, nothing else.
2339
+ * Degraded entries must not be mounted, synced or treated as content. */
2340
+ degraded?: boolean;
2266
2341
  }
2267
2342
 
2268
2343
  export interface WikiFileChange {
@@ -2300,6 +2375,12 @@ export interface WikiTreeEntry {
2300
2375
  * entry; use it to badge private folders, never for access decisions.
2301
2376
  */
2302
2377
  restricted?: boolean;
2378
+ /**
2379
+ * Committer date (RFC3339) of the newest default-branch commit touching this
2380
+ * entry — the listing's "Last published" value. Present only when the tree
2381
+ * was requested with `last_commit: true` and the lookup succeeded.
2382
+ */
2383
+ last_commit_at?: string;
2303
2384
  }
2304
2385
 
2305
2386
  export interface WikiTreeResponse {
@@ -2842,6 +2923,7 @@ export interface CardUpdateData {
2842
2923
  execution_status?: ExecutionStatus | null;
2843
2924
  decided_by?: string;
2844
2925
  decided_at?: string;
2926
+ decision_reason?: string | null;
2845
2927
  executed_at?: string | null;
2846
2928
  execution_error?: string | null;
2847
2929
  }
@@ -2857,7 +2939,7 @@ export interface WatchingData {
2857
2939
  export interface MembershipChangedData {
2858
2940
  chat_id: string;
2859
2941
  user_id: string;
2860
- action: 'added' | 'removed' | 'role_changed';
2942
+ action: 'added' | 'removed' | 'role_changed' | 'policy_changed';
2861
2943
  }
2862
2944
 
2863
2945
  /**
@@ -4006,6 +4088,7 @@ export interface PresenceUpdateData {
4006
4088
  export interface ResolveRefsRequest {
4007
4089
  refs: string[];
4008
4090
  source_message_id?: string;
4091
+ full?: boolean;
4009
4092
  }
4010
4093
 
4011
4094
  export interface ResolvedRef {
@@ -4998,6 +5081,12 @@ export interface EdgeBrowserProfile {
4998
5081
  edge_id: string;
4999
5082
  name: string;
5000
5083
  is_default: boolean;
5084
+ /** Stable compare-and-swap revision for Local BYOC Profile operations. */
5085
+ version: number;
5086
+ /** Stable configuration binding used by Alias readiness and execution. */
5087
+ config_revision: number;
5088
+ /** Authoritative persisted Profile operation lifecycle. */
5089
+ lifecycle_state: 'active' | 'pending_create' | 'pending_rename' | 'pending_delete';
5001
5090
  created_at: string;
5002
5091
  updated_at: string;
5003
5092
  /**
@@ -5009,6 +5098,338 @@ export interface EdgeBrowserProfile {
5009
5098
  proxy_configured?: boolean;
5010
5099
  }
5011
5100
 
5101
+ export type EdgeProfileOperationAction = 'create' | 'rename' | 'delete';
5102
+ export type EdgeProfileOperationStatus =
5103
+ | 'confirmation_required'
5104
+ | 'pending'
5105
+ | 'retryable'
5106
+ | 'rejected'
5107
+ | 'outcome_unknown'
5108
+ | 'succeeded';
5109
+ export type EdgeProfileOperationOutcome = 'applied' | 'retryable' | 'rejected';
5110
+
5111
+ export type EdgeProfileOperationErrorCode =
5112
+ | 'JWT_REQUIRED'
5113
+ | 'HUMAN_REQUIRED'
5114
+ | 'EDGE_NOT_FOUND'
5115
+ | 'EDGE_OFFLINE'
5116
+ | 'EDGE_STATUS_UNAVAILABLE'
5117
+ | 'PROFILE_NOT_FOUND'
5118
+ | 'PROFILE_VERSION_CONFLICT'
5119
+ | 'PROFILE_OPERATION_IN_PROGRESS'
5120
+ | 'PROFILE_OPERATION_NOT_FOUND'
5121
+ | 'PROFILE_OPERATION_CONFLICT'
5122
+ | 'PROFILE_DELETE_IMPACT_CHANGED'
5123
+ | 'IDEMPOTENCY_CONFLICT'
5124
+ | 'INVALID_IDEMPOTENCY_KEY'
5125
+ | 'INVALID_INPUT';
5126
+
5127
+ export type EdgeProfileOperationRequest =
5128
+ | { action: 'create'; name: string }
5129
+ | { action: 'rename'; profile_id: string; expected_version: number; name: string }
5130
+ | { action: 'delete'; profile_id: string; expected_version: number };
5131
+
5132
+ export interface EdgeProfileOperationConfirmRequest {
5133
+ impact_hash: string;
5134
+ confirmation_token: string;
5135
+ }
5136
+
5137
+ export interface EdgeProfileDeleteImpact {
5138
+ profile_id: string;
5139
+ profile_version: number;
5140
+ aliases: Array<{ alias_id: string; name: string }>;
5141
+ /** Classified legacy rows block confirmation; they are never silently deleted. */
5142
+ legacy_connections: Array<{ connection_id: string; classification: string }>;
5143
+ grants_count: number;
5144
+ accepted_or_running_executions: number;
5145
+ impact_hash: string;
5146
+ confirmation_token: string;
5147
+ }
5148
+
5149
+ export interface EdgeProfileOperationReceipt {
5150
+ operation_id: string;
5151
+ edge_id: string;
5152
+ profile_id: string;
5153
+ action: EdgeProfileOperationAction;
5154
+ status: EdgeProfileOperationStatus;
5155
+ expected_version?: number;
5156
+ target_version: number;
5157
+ attempt: number;
5158
+ name_before?: string;
5159
+ name_after?: string;
5160
+ impact?: EdgeProfileDeleteImpact;
5161
+ /** Present only while a Delete is awaiting the explicit strong confirmation. */
5162
+ confirmation_token?: string;
5163
+ /** Exact Edge outcome only; Server-private lifecycle evidence is never exposed here. */
5164
+ edge_outcome?: EdgeProfileOperationOutcome;
5165
+ error?: { code: string; message?: string };
5166
+ created_at: string;
5167
+ updated_at: string;
5168
+ completed_at?: string;
5169
+ }
5170
+
5171
+ export interface BrowserAliasCreateRequest {
5172
+ name: string;
5173
+ clip_id: string;
5174
+ edge_id: string;
5175
+ profile_id: string;
5176
+ idempotency_key: string;
5177
+ }
5178
+
5179
+ export interface BrowserAliasRenameRequest {
5180
+ name: string;
5181
+ expected_version: number;
5182
+ idempotency_key: string;
5183
+ }
5184
+
5185
+ export interface BrowserAliasDeleteRequest {
5186
+ expected_version: number;
5187
+ idempotency_key: string;
5188
+ }
5189
+
5190
+ export type BrowserAliasErrorCode =
5191
+ | 'JWT_REQUIRED'
5192
+ | 'HUMAN_REQUIRED'
5193
+ | 'INVALID_REQUEST'
5194
+ | 'INVALID_ALIAS_NAME'
5195
+ | 'CLIP_NOT_AVAILABLE'
5196
+ | 'PROFILE_NOT_FOUND'
5197
+ | 'ALIAS_NOT_FOUND'
5198
+ | 'ALIAS_NOT_READY'
5199
+ | 'ALIAS_NAME_TAKEN'
5200
+ | 'ALIAS_STALE'
5201
+ | 'PROFILE_OPERATION_IN_PROGRESS'
5202
+ | 'IDEMPOTENCY_CONFLICT'
5203
+ | 'EDGE_OFFLINE'
5204
+ | 'EDGE_STATUS_UNAVAILABLE';
5205
+
5206
+ export interface BrowserAliasVersion {
5207
+ id: string;
5208
+ version_seq: number;
5209
+ source_kind: 'publisher_working_copy' | 'approved_public_snapshot';
5210
+ source_clip_version_id?: string;
5211
+ source_working_revision?: string;
5212
+ version_label?: string;
5213
+ artifact_digest?: string;
5214
+ preparation_status: 'pending' | 'preparing' | 'ready' | 'failed';
5215
+ preparation_result?: Record<string, unknown>;
5216
+ created_at: string;
5217
+ updated_at: string;
5218
+ }
5219
+
5220
+ export type BrowserAliasReadinessStatus =
5221
+ | 'checking'
5222
+ | 'ready'
5223
+ | 'needs_action'
5224
+ | 'unavailable'
5225
+ | 'error';
5226
+
5227
+ export const BROWSER_ALIAS_READINESS_REASON_CODES = [
5228
+ 'edge_offline',
5229
+ 'profile_not_found',
5230
+ 'profile_damaged',
5231
+ 'artifact_invalid',
5232
+ 'runtime_incompatible',
5233
+ 'needs_login',
5234
+ 'target_service_unavailable',
5235
+ 'readiness_check_running',
5236
+ 'readiness_check_timeout',
5237
+ 'readiness_contract_error',
5238
+ ] as const;
5239
+
5240
+ export type BrowserAliasReadinessReasonCode = (typeof BROWSER_ALIAS_READINESS_REASON_CODES)[number];
5241
+
5242
+ export interface BrowserAliasReadinessReason {
5243
+ code: BrowserAliasReadinessReasonCode;
5244
+ status: BrowserAliasReadinessStatus;
5245
+ hint: string;
5246
+ observed_at: string;
5247
+ retry_after_ms?: number;
5248
+ }
5249
+
5250
+ export interface BrowserAliasReadiness {
5251
+ alias_id: string;
5252
+ status: BrowserAliasReadinessStatus;
5253
+ blocking_reasons: BrowserAliasReadinessReason[];
5254
+ primary_reason?: BrowserAliasReadinessReasonCode;
5255
+ hint?: string;
5256
+ observed_at: string;
5257
+ source: 'server' | 'edge';
5258
+ retry_after_ms?: number;
5259
+ alias_revision: number;
5260
+ active_alias_version_id?: string;
5261
+ profile_revision: number;
5262
+ profile_config_revision: number;
5263
+ generation: number;
5264
+ updated_at: string;
5265
+ }
5266
+
5267
+ export interface BrowserAliasReadinessCheckRequest {
5268
+ idempotency_key: string;
5269
+ }
5270
+
5271
+ export type BrowserAliasReadinessCheckStatus = 'pending' | 'dispatched' | 'succeeded' | 'rejected';
5272
+
5273
+ export interface BrowserAliasReadinessCheckReceipt {
5274
+ check_id: string;
5275
+ alias_id: string;
5276
+ status: BrowserAliasReadinessCheckStatus;
5277
+ error_code?: 'REPORT_STALE';
5278
+ generation: number;
5279
+ attempt: number;
5280
+ readiness?: BrowserAliasReadiness;
5281
+ created_at: string;
5282
+ updated_at: string;
5283
+ dispatched_at?: string;
5284
+ completed_at?: string;
5285
+ }
5286
+
5287
+ export interface BrowserAlias {
5288
+ id: string;
5289
+ name: string;
5290
+ version: number;
5291
+ lifecycle: 'preparing' | 'active' | 'update_preparing' | 'update_failed' | 'deleting';
5292
+ edge: { id: string; name: string; status: 'online' | 'offline'; placement: 'byoc' | 'hosted' };
5293
+ profile: {
5294
+ id: string;
5295
+ name: string;
5296
+ version: number;
5297
+ config_revision: number;
5298
+ lifecycle_state: string;
5299
+ };
5300
+ clip: { id: string; name: string; version?: string };
5301
+ desired_version?: BrowserAliasVersion;
5302
+ active_version?: BrowserAliasVersion;
5303
+ active_artifact_digest?: string;
5304
+ preparation_result?: Record<string, unknown>;
5305
+ update_result?: Record<string, unknown>;
5306
+ readiness?: BrowserAliasReadiness;
5307
+ created_at: string;
5308
+ updated_at: string;
5309
+ }
5310
+
5311
+ export interface BrowserAliasDeleteProof {
5312
+ alias_deleted: true;
5313
+ grants_deleted: number;
5314
+ name_released: true;
5315
+ }
5316
+
5317
+ export interface BrowserAliasCommandContractSnapshot {
5318
+ command_name: string;
5319
+ input_schema: Record<string, unknown>;
5320
+ output_schema: Record<string, unknown> | null;
5321
+ side_effect_level: string;
5322
+ data_scopes: string[];
5323
+ allowed_domains: string[];
5324
+ required_capabilities: string[];
5325
+ }
5326
+
5327
+ export interface BrowserAliasGrantContractEvidence {
5328
+ contract_hash: string;
5329
+ contract_snapshot: BrowserAliasCommandContractSnapshot;
5330
+ }
5331
+
5332
+ export interface BrowserAliasGrantCommand {
5333
+ command_name: string;
5334
+ status: 'missing' | 'active' | 'review_required';
5335
+ authorized?: BrowserAliasGrantContractEvidence;
5336
+ current: BrowserAliasGrantContractEvidence;
5337
+ delta?: { changed_fields: string[] };
5338
+ }
5339
+
5340
+ export interface BrowserAliasGrantSet {
5341
+ key_id: string;
5342
+ alias: { id: string; name: string; clip: BrowserAlias['clip'] };
5343
+ /** Zero means this Key+Alias set has never been written. */
5344
+ version: number;
5345
+ commands: BrowserAliasGrantCommand[];
5346
+ updated_at?: string;
5347
+ }
5348
+
5349
+ export interface BrowserAliasGrantReplaceRequest {
5350
+ expected_version: number;
5351
+ idempotency_key: string;
5352
+ commands: Array<{
5353
+ command_name: string;
5354
+ authorized_contract_hash: string;
5355
+ authorized_contract_snapshot: BrowserAliasCommandContractSnapshot;
5356
+ }>;
5357
+ }
5358
+
5359
+ export interface ManagedBrowserAliasSummary {
5360
+ id: string;
5361
+ name: string;
5362
+ clip: BrowserAlias['clip'];
5363
+ readiness?: BrowserAliasReadiness;
5364
+ commands: string[];
5365
+ needs_owner_review: string[];
5366
+ }
5367
+
5368
+ export interface ManagedBrowserAliasCommand {
5369
+ name: string;
5370
+ status: 'active';
5371
+ description: string;
5372
+ input_schema: Record<string, unknown>;
5373
+ output_schema: Record<string, unknown> | null;
5374
+ side_effect_level: string;
5375
+ data_scopes: string[];
5376
+ allowed_domains: string[];
5377
+ required_capabilities: string[];
5378
+ }
5379
+
5380
+ export interface ManagedBrowserAliasReviewRequiredCommand {
5381
+ name: string;
5382
+ status: 'review_required';
5383
+ hint: string;
5384
+ }
5385
+
5386
+ export interface ManagedBrowserAliasInfo {
5387
+ id: string;
5388
+ name: string;
5389
+ clip: BrowserAlias['clip'];
5390
+ readiness?: BrowserAliasReadiness;
5391
+ commands: ManagedBrowserAliasCommand[];
5392
+ needs_owner_review: ManagedBrowserAliasReviewRequiredCommand[];
5393
+ }
5394
+
5395
+ export type BrowserAliasExecutionStatus =
5396
+ | 'accepted'
5397
+ | 'running'
5398
+ | 'succeeded'
5399
+ | 'failed'
5400
+ | 'outcome_unknown';
5401
+
5402
+ export interface BrowserAliasExecutionRequest {
5403
+ request_id: string;
5404
+ alias: string;
5405
+ command: string;
5406
+ args: Record<string, unknown>;
5407
+ }
5408
+
5409
+ export interface BrowserAliasExecutionError {
5410
+ code: string;
5411
+ message: string;
5412
+ hint?: string;
5413
+ }
5414
+
5415
+ /** Redacted managed-key/Owner recovery DTO. It never contains target IDs,
5416
+ * hashes, dispatch claims or Edge-ledger evidence. */
5417
+ export interface BrowserAliasExecutionReceipt {
5418
+ request_id: string;
5419
+ alias: string;
5420
+ command: string;
5421
+ status: BrowserAliasExecutionStatus;
5422
+ dispatched: true;
5423
+ command_timeout_ms: number;
5424
+ execution_deadline: string;
5425
+ result?: Record<string, unknown>;
5426
+ error?: BrowserAliasExecutionError;
5427
+ accepted_at: string;
5428
+ running_at?: string;
5429
+ terminal_at?: string;
5430
+ updated_at: string;
5431
+ }
5432
+
5012
5433
  /**
5013
5434
  * Sanitized per-profile egress proxy status (hosted Cloud Profiles) — the GET
5014
5435
  * response and the PUT/DELETE result. NEVER carries the password; `password_set`
@@ -0,0 +1,35 @@
1
+ import { ENDPOINTS } from './constants.js';
2
+ import { TaskLabelClient } from './task-label-client.js';
3
+ import type { WechatContactsPage, WechatProfileView, WechatStatusView } from './types.js';
4
+ import type { WechatHistoryPage, WechatHistoryQuery } from './wechat-types.js';
5
+
6
+ /** WeChat channel read methods shared by every ParallClient instance. */
7
+ export abstract class WechatClient extends TaskLabelClient {
8
+ /** Address book enriched with display names. */
9
+ async listWechatContacts(orgId: string): Promise<WechatContactsPage> {
10
+ return this.request('GET', ENDPOINTS.WECHAT_CONTACTS(orgId));
11
+ }
12
+
13
+ /** Platform-retained context in chronological page order. */
14
+ async wechatHistory(
15
+ orgId: string,
16
+ conversation: string,
17
+ query?: WechatHistoryQuery,
18
+ ): Promise<WechatHistoryPage> {
19
+ const params = new URLSearchParams({ conversation });
20
+ if (query?.before) params.set('before', query.before);
21
+ if (query?.since) params.set('since', query.since);
22
+ if (query?.limit !== undefined) params.set('limit', String(query.limit));
23
+ return this.request('GET', `${ENDPOINTS.WECHAT_HISTORY(orgId)}?${params.toString()}`);
24
+ }
25
+
26
+ /** Connected WeChat account identity. */
27
+ async wechatProfile(orgId: string): Promise<WechatProfileView> {
28
+ return this.request('GET', ENDPOINTS.WECHAT_PROFILE(orgId));
29
+ }
30
+
31
+ /** Live online probe, identity, and platform offline record. */
32
+ async wechatStatus(orgId: string): Promise<WechatStatusView> {
33
+ return this.request('GET', ENDPOINTS.WECHAT_STATUS(orgId));
34
+ }
35
+ }
@@ -0,0 +1,28 @@
1
+ /** Query for platform-retained WeChat context. */
2
+ export interface WechatHistoryQuery {
3
+ /** External message id returned as next_before by a previous page. */
4
+ before?: string;
5
+ /** Inclusive RFC3339 timestamp or YYYY-MM-DD (UTC midnight). */
6
+ since?: string;
7
+ /** Page size; defaults to 20 and is capped at 100. */
8
+ limit?: number;
9
+ }
10
+
11
+ export interface WechatHistoryMessage {
12
+ /** Vendor external message id. */
13
+ id: string;
14
+ direction: 'inbound' | 'outbound';
15
+ sender_wxid: string;
16
+ sender_name: string;
17
+ text: string;
18
+ occurred_at: string;
19
+ }
20
+
21
+ export interface WechatHistoryPage {
22
+ conversation: string;
23
+ /** Chronological order: oldest to newest within this page. */
24
+ messages: WechatHistoryMessage[];
25
+ has_more: boolean;
26
+ /** Pass back as before to continue toward older messages. */
27
+ next_before?: string;
28
+ }