@parall/daemon 1.86.0 → 1.88.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.
@@ -17931,7 +17931,7 @@ var require_ProcessDetectorSync = __commonJS({
17931
17931
  var api_1 = (init_esm(), __toCommonJS(esm_exports));
17932
17932
  var semantic_conventions_1 = (init_esm2(), __toCommonJS(esm_exports2));
17933
17933
  var Resource_1 = require_Resource();
17934
- var os5 = __require("os");
17934
+ var os6 = __require("os");
17935
17935
  var ProcessDetectorSync = class {
17936
17936
  detect(_config) {
17937
17937
  const attributes = {
@@ -17951,7 +17951,7 @@ var require_ProcessDetectorSync = __commonJS({
17951
17951
  attributes[semantic_conventions_1.SEMRESATTRS_PROCESS_COMMAND] = process.argv[1];
17952
17952
  }
17953
17953
  try {
17954
- const userInfo = os5.userInfo();
17954
+ const userInfo = os6.userInfo();
17955
17955
  attributes[semantic_conventions_1.SEMRESATTRS_PROCESS_OWNER] = userInfo.username;
17956
17956
  } catch (e) {
17957
17957
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -52009,7 +52009,7 @@ ${captureLines}` : capture.stack;
52009
52009
  });
52010
52010
 
52011
52011
  // ts/claude-agent/dist/index.js
52012
- import * as os4 from "node:os";
52012
+ import * as os5 from "node:os";
52013
52013
 
52014
52014
  // ts/sdk/dist/browser-use-contract.generated.js
52015
52015
  var browserUseContract = { "actions": { "read": { "grant": "browser.read", "target": "optional_tab", "params": { "required": [], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "rules": ["exactly one of params.url or target is required", "params.url creates a hidden Profile-bound tab and closes it before terminal success or failure"], "additional_properties": false }, "success": { "base": null, "fields": { "profile_id": "ebp_identifier", "url": "string", "title": "string", "article": "nullable_article" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "tabs": { "grant": "browser.read", "target": "none", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": null, "fields": { "tabs": "tab_summary_array" } }, "errors": ["TAB_GONE"] }, "wait": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "state": { "enum": ["attached", "detached", "visible", "hidden", "load"], "default": "attached" }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 3e4, "default": 1e4 } }, "rules": ["selector is required unless state=load", "state=load forbids selector"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "matched": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "snapshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": { "interactive": { "type": "boolean", "default": false }, "compact": { "type": "boolean", "default": false }, "depth": { "type": "integer", "minimum": 0, "maximum": 64 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "snapshot": "string", "snapshot_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "get": { "grant": "browser.read", "target": "tab_or_ref", "params": { "required": ["prop"], "properties": { "selector": { "type": "string", "min_length": 1, "max_length": 4096 }, "prop": { "enum": ["text", "html", "value", "attr", "title", "url"] }, "name": { "type": "string", "min_length": 1, "max_length": 256 } }, "rules": ["title/url forbid locator and name", "text/html/value require exactly one locator", "attr requires exactly one locator and name"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "nullable_string" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "screenshot": { "grant": "browser.read", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "format": { "const": "png" }, "base64": "canonical_base64" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "open": { "grant": "browser.interact", "target": "none", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] }, "hidden": { "type": "boolean", "default": false }, "viewport": { "type": "viewport" } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["PAGE_LOAD_FAILED"] }, "navigate": { "grant": "browser.interact", "target": "tab", "params": { "required": ["url"], "properties": { "url": { "type": "string", "min_length": 1, "max_length": 8192, "schemes": ["http", "https", "about:blank"] } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": {} }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "viewport": { "grant": "browser.interact", "target": "tab", "params": { "required": ["width", "height"], "properties": { "width": { "type": "integer", "minimum": 320, "maximum": 3840 }, "height": { "type": "integer", "minimum": 240, "maximum": 2160 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "viewport": "viewport" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "DIALOG_OPEN"] }, "click": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": [], "properties": { "selector": "selector" }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "clicked": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "fill": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "allow_empty": true } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "filled": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "type": { "grant": "browser.interact", "target": "tab_or_ref", "params": { "required": ["text"], "properties": { "selector": "selector", "text": { "type": "string", "min_length": 1 } }, "rules": ["exactly one of params.selector or target.ref"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "typed": { "const": true }, "characters": "non_negative_integer" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "STALE_REF", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "press": { "grant": "browser.interact", "target": "tab", "params": { "required": ["key"], "properties": { "key": "single_unicode_character_or_named_key" }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "pressed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "scroll": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": { "direction": { "enum": ["up", "down", "left", "right"], "default": "down" }, "pixels": { "type": "integer", "minimum": 1, "maximum": 1e5, "default": 500 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "scrolled": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] }, "dialog": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": { "accept": { "type": "boolean" }, "text": { "type": "string", "allow_empty": true, "max_length": 4096 } }, "rules": ["absent accept inspects the open dialog without answering it", "present accept answers the open dialog: true accepts, false dismisses", "text requires accept"], "additional_properties": false }, "success": { "base": "tab_state", "fields": { "dialog": "nullable_dialog" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "close": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "closed": { "const": true } } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE"] }, "recover": { "grant": "browser.interact", "target": "tab", "params": { "required": [], "properties": {}, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "recovered_from_tab_id": "identifier" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED"] }, "eval": { "grant": "browser.advanced", "target": "tab", "params": { "required": ["expression"], "properties": { "expression": { "type": "string", "min_length": 1 }, "timeout_ms": { "type": "integer", "minimum": 1, "maximum": 15e3, "default": 15e3 } }, "additional_properties": false }, "success": { "base": "tab_state", "fields": { "value": "json_value_max_256_kib" } }, "errors": ["TAB_NOT_FOUND", "TAB_GONE", "PAGE_LOAD_FAILED", "DIALOG_OPEN"] } }, "successShapes": { "tab_state": { "required": ["tab_id", "profile_id", "browser_generation", "document_generation", "url", "title"], "fields": { "tab_id": "identifier", "profile_id": "ebp_identifier", "browser_generation": "positive_integer", "document_generation": "positive_integer", "url": "string", "title": "string" }, "additional_properties": false }, "tab_summary": { "base": "tab_state", "required_additions": ["loading"], "fields": { "loading": "boolean" }, "additional_properties": false }, "article": { "required": ["title", "byline", "excerpt", "text", "published_time", "site_name", "length"], "fields": { "title": "nullable_string", "byline": "nullable_string", "excerpt": "nullable_string", "text": "string", "published_time": "nullable_string", "site_name": "nullable_string", "length": "non_negative_integer" }, "additional_properties": false }, "dialog": { "required": ["type", "message"], "fields": { "type": "string", "message": "string", "accepted": "boolean" }, "type_values": ["alert", "confirm", "prompt"], "additional_properties": false } } };
@@ -52155,16 +52155,24 @@ function attachmentEndpoints(apiBase) {
52155
52155
 
52156
52156
  // ts/sdk/dist/clip-connection-endpoints.js
52157
52157
  var clipConnectionEndpoints = {
52158
+ CLIP_MCP_SUMMARIES: (orgId) => `/api/v1/orgs/${orgId}/clip-mcp-summaries`,
52159
+ EDGE_PROFILE_SUMMARIES: (orgId) => `/api/v1/orgs/${orgId}/edge/profile-summaries`,
52158
52160
  ORG_CLIP_MCP_OAUTH_ATTEMPT: (orgId, clipId, attemptId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/mcp-oauth-attempts/${attemptId}`,
52159
52161
  CLIP_CONNECTIONS_ALL: (orgId) => `/api/v1/orgs/${orgId}/clip-connections/all`,
52160
52162
  CLIP_CONNECTIONS: (orgId, clipId) => `/api/v1/orgs/${orgId}/clip-registry/${clipId}/connections`,
52161
52163
  CLIP_CONNECTION_ACCESS: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}/access`,
52162
- CLIP_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}`
52164
+ CLIP_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/clip-connections/${connId}`,
52165
+ /** The caller's own (person-owned) connections; login session only. */
52166
+ ORG_MY_CONNECTIONS: (orgId) => `/api/v1/orgs/${orgId}/me/connections`,
52167
+ ORG_MY_CONNECTION: (orgId, connId) => `/api/v1/orgs/${orgId}/me/connections/${connId}`,
52168
+ ORG_MY_CONNECTION_AGENT: (orgId, connId, agentId) => `/api/v1/orgs/${orgId}/me/connections/${connId}/agents/${agentId}`
52163
52169
  };
52164
52170
 
52165
52171
  // ts/sdk/dist/edge-endpoints.js
52166
52172
  var API_BASE = "/api/v1";
52167
52173
  var edgeEndpoints = {
52174
+ ORG_HOSTED_CREATION_GRANT: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/edge/profile-creation-grants/${encodeURIComponent(agentId)}`,
52175
+ ORG_HOSTED_CREATION_EVENTS: (orgId, agentId) => `${API_BASE}/orgs/${orgId}/edge/profile-creation-grants/${encodeURIComponent(agentId)}/events`,
52168
52176
  ORG_EDGE_PROFILE_ACCESS: (orgId, edgeId, profileName) => `${API_BASE}/orgs/${orgId}/edge/${edgeId}/profiles/${encodeURIComponent(profileName)}/access`,
52169
52177
  ORG_EDGE: (orgId) => `${API_BASE}/orgs/${orgId}/edge`,
52170
52178
  ORG_EDGE_CONNECT: (orgId) => `${API_BASE}/orgs/${orgId}/edge/connect`,
@@ -52209,6 +52217,7 @@ function teamInviteEndpoints(apiBase) {
52209
52217
  TEMPLATE_INVITE_REQUESTS: (orgId, templateId) => `${apiBase}/orgs/${seg(orgId)}/templates/${seg(templateId)}/invite-link/requests`,
52210
52218
  TEMPLATE_INVITE_REQUEST_DECIDE: (orgId, templateId, requestId) => `${apiBase}/orgs/${seg(orgId)}/templates/${seg(templateId)}/invite-link/requests/${seg(requestId)}/decide`,
52211
52219
  TEAM_INVITE: (token) => `${apiBase}/team-invites/${seg(token)}`,
52220
+ TEAM_INVITE_TEAMS: (token) => `${apiBase}/team-invites/${seg(token)}/teams`,
52212
52221
  TEAM_INVITE_REQUESTS: (token) => `${apiBase}/team-invites/${seg(token)}/requests`,
52213
52222
  TEAM_INVITE_REQUEST_MINE: (token) => `${apiBase}/team-invites/${seg(token)}/requests/mine`,
52214
52223
  TEAM_INVITE_REQUEST_CANCEL: (requestId) => `${apiBase}/team-invite-requests/${seg(requestId)}/cancel`,
@@ -52268,11 +52277,38 @@ function teamEndpoints(apiBase) {
52268
52277
  };
52269
52278
  }
52270
52279
 
52280
+ // ts/sdk/dist/secret-endpoints.js
52281
+ function secretEndpoints(apiBase) {
52282
+ return {
52283
+ AGENT_SECRETS: (orgId, agentId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets`,
52284
+ AGENT_SECRET: (orgId, agentId, secretId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets/${secretId}`,
52285
+ ORG_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/secrets`,
52286
+ ORG_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}`,
52287
+ /** The caller's own secrets (login session only, like the rest up to the runtime's). */
52288
+ ORG_MY_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/me/secrets`,
52289
+ ORG_MY_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}`,
52290
+ ORG_MY_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}/grants/${agentId}`,
52291
+ TEAM_SECRETS: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets`,
52292
+ TEAM_SECRET: (orgId, teamId, secretId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}`,
52293
+ TEAM_SECRET_GRANT: (orgId, teamId, secretId, agentId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}/grants/${agentId}`,
52294
+ /** `agentId` holds `ownerAgentId`'s own secret. */
52295
+ AGENT_SECRET_GRANT: (orgId, ownerAgentId, secretId, agentId) => `${apiBase}/orgs/${orgId}/agents/${ownerAgentId}/secrets/${secretId}/grants/${agentId}`,
52296
+ ORG_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}/grants/${agentId}`,
52297
+ /** The runtime's own routes, with the agent's key. */
52298
+ AGENT_ME_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets`,
52299
+ AGENT_ME_SECRETS_CATALOG: (orgId, q) => `${apiBase}/orgs/${orgId}/agents/me/secrets/catalog${q ? `?q=${encodeURIComponent(q)}` : ""}`,
52300
+ AGENT_ME_SECRETS_APPLIED: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets/applied`
52301
+ };
52302
+ }
52303
+
52271
52304
  // ts/sdk/dist/constants.js
52272
52305
  var API_BASE2 = "/api/v1";
52273
52306
  var WIKI_BASE = "/wiki/v1";
52274
52307
  var CLIP_BASE = "/clip/v1";
52275
52308
  var ENDPOINTS = {
52309
+ WIKI_PAGE_SHARES: (orgId, wikiId) => `/wiki/v1/orgs/${orgId}/wikis/${wikiId}/page-shares`,
52310
+ WIKI_PAGE_SHARE_CANDIDATES: (orgId, wikiId) => `/wiki/v1/orgs/${orgId}/wikis/${wikiId}/page-share-candidates`,
52311
+ WIKI_SHARED_PAGE: (shareId) => `/wiki/v1/shared-pages/${encodeURIComponent(shareId)}`,
52276
52312
  // Auth
52277
52313
  AUTH_REGISTER: `${API_BASE2}/auth/register`,
52278
52314
  AUTH_LOGIN: `${API_BASE2}/auth/login`,
@@ -52348,6 +52384,8 @@ var ENDPOINTS = {
52348
52384
  CHAT_RESTORE: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/restore`,
52349
52385
  CHAT_MEMBERS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members`,
52350
52386
  CHAT_MEMBER: (orgId, chatId, userId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members/${userId}`,
52387
+ CHAT_BOOKMARKS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks`,
52388
+ CHAT_BOOKMARK: (orgId, chatId, bookmarkId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks/${bookmarkId}`,
52351
52389
  CHAT_INVITATIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations`,
52352
52390
  CHAT_INVITATION: (orgId, chatId, invId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations/${invId}`,
52353
52391
  CHAT_CONNECTIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/connections`,
@@ -52390,14 +52428,7 @@ var ENDPOINTS = {
52390
52428
  AGENT_ME: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me`,
52391
52429
  AGENT_REPLY_POLICY_CAPABILITY: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/reply-policy-capability`,
52392
52430
  AGENT_RUNTIME_REPORT: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/runtime-report`,
52393
- // Agent secrets (agent-secrets-design.md): management, then the runtime's own two routes.
52394
- AGENT_SECRETS: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/secrets`,
52395
- AGENT_SECRET: (orgId, agentId, secretId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/secrets/${secretId}`,
52396
- ORG_SECRETS: (orgId) => `${API_BASE2}/orgs/${orgId}/secrets`,
52397
- ORG_SECRET: (orgId, secretId) => `${API_BASE2}/orgs/${orgId}/secrets/${secretId}`,
52398
- AGENT_ME_SECRETS: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets`,
52399
- AGENT_ME_SECRETS_CATALOG: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets/catalog`,
52400
- AGENT_ME_SECRETS_APPLIED: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets/applied`,
52431
+ ...secretEndpoints(API_BASE2),
52401
52432
  AGENT_NEW_SESSION: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/new-session`,
52402
52433
  AGENT_DEEP_RESET: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/deep-reset`,
52403
52434
  AGENT_SESSIONS: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/sessions`,
@@ -52855,6 +52886,7 @@ var WS_EVENTS = {
52855
52886
  TYPING_UPDATE: "typing.update",
52856
52887
  CHAT_UPDATE: "chat.update",
52857
52888
  CHAT_DELETED: "chat.deleted",
52889
+ CHAT_BOOKMARKS_UPDATED: "chat.bookmarks.updated",
52858
52890
  APPROVAL_UPDATE: "approval.update",
52859
52891
  // deprecated
52860
52892
  CARD_UPDATE: "card.update",
@@ -53687,6 +53719,23 @@ var ClipConnectionClient = class extends ChannelConversationClient {
53687
53719
  return this.request("PUT", ENDPOINTS.ORG_CLIP_MCP_CONFIG_BY_ID(orgId, clipId, configId), req, void 0, false, { headers: { "If-Match": `"${expectedVersion}"` }, timeoutMs: 4e4 });
53688
53720
  }
53689
53721
  // ---- Clip connections ----
53722
+ /** Missing keys are unknown/hidden; present empty arrays are known empty. */
53723
+ async listClipMCPSummaries(orgId, clipIds) {
53724
+ return this.readDiscoverySummaries(ENDPOINTS.CLIP_MCP_SUMMARIES(orgId), "clip_ids", clipIds);
53725
+ }
53726
+ async listEdgeProfileSummaries(orgId, edgeIds) {
53727
+ return this.readDiscoverySummaries(ENDPOINTS.EDGE_PROFILE_SUMMARIES(orgId), "edge_ids", edgeIds);
53728
+ }
53729
+ async readDiscoverySummaries(endpoint, key, ids) {
53730
+ const data = {};
53731
+ const unique = [...new Set(ids)];
53732
+ for (let offset = 0; offset < unique.length; offset += 500) {
53733
+ const batch = unique.slice(offset, offset + 500);
53734
+ const response = await this.request("GET", `${endpoint}?${key}=${encodeURIComponent(batch.join(","))}`);
53735
+ Object.assign(data, response.data);
53736
+ }
53737
+ return { data };
53738
+ }
53690
53739
  async listClipConnections(orgId, clipId) {
53691
53740
  return this.request("GET", ENDPOINTS.CLIP_CONNECTIONS(orgId, clipId));
53692
53741
  }
@@ -53721,10 +53770,42 @@ var ClipConnectionClient = class extends ChannelConversationClient {
53721
53770
  async cancelClipMCPOAuthAttempt(orgId, clipId, attemptId) {
53722
53771
  return this.request("DELETE", ENDPOINTS.ORG_CLIP_MCP_OAUTH_ATTEMPT(orgId, clipId, attemptId));
53723
53772
  }
53773
+ // ---- The caller's own connections (login session only) ----
53774
+ /** The caller's person-owned connections, optionally for one connector. */
53775
+ async listMyConnections(orgId, clipId) {
53776
+ return this.request("GET", ENDPOINTS.ORG_MY_CONNECTIONS(orgId), void 0, clipId ? { clip_id: clipId } : void 0);
53777
+ }
53778
+ /** Stop one agent from using one of the caller's connections. */
53779
+ async revokeMyConnectionAgent(orgId, connId, agentId) {
53780
+ return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION_AGENT(orgId, connId, agentId));
53781
+ }
53782
+ /** Disconnect one of the caller's connections: the connection, its credential and grants go. */
53783
+ async deleteMyConnection(orgId, connId) {
53784
+ return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION(orgId, connId));
53785
+ }
53786
+ };
53787
+
53788
+ // ts/sdk/dist/hosted-profile-creation.js
53789
+ var HostedProfileCreationClient = class extends ClipConnectionClient {
53790
+ getHostedProfileCreationAccess(orgId, agentId) {
53791
+ return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId));
53792
+ }
53793
+ changeHostedProfileCreationGrant(orgId, agentId, change, key, revoke = false) {
53794
+ return this.request(revoke ? "DELETE" : "PUT", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId), change, void 0, false, { headers: { "Idempotency-Key": key } });
53795
+ }
53796
+ getHostedProfileCreationEvents(orgId, agentId, before) {
53797
+ return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_EVENTS(orgId, agentId), void 0, {
53798
+ before
53799
+ });
53800
+ }
53801
+ /** A lost response is recovered with the same name and key, never a new key. */
53802
+ createAuthorizedHostedProfile(orgId, name, key) {
53803
+ return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), { name, placement: "hosted" }, void 0, false, { headers: { "Idempotency-Key": key } });
53804
+ }
53724
53805
  };
53725
53806
 
53726
53807
  // ts/sdk/dist/browser-profile-client.js
53727
- var BrowserProfileClient = class extends ClipConnectionClient {
53808
+ var BrowserProfileClient = class extends HostedProfileCreationClient {
53728
53809
  /** Metadata-only compatibility discovery. Management scope errors propagate;
53729
53810
  * callers with a known Profile can execute without this discovery chain. */
53730
53811
  async listBrowserUseProfiles(orgId, profileId) {
@@ -53908,7 +53989,10 @@ var UserPreferencesClient = class extends OrgAccentClient {
53908
53989
 
53909
53990
  // ts/sdk/dist/secret-client.js
53910
53991
  var AgentSecretClient = class extends UserPreferencesClient {
53911
- /** One agent's own secrets plus the org-shared ones it is given. */
53992
+ /**
53993
+ * One agent's own secrets and those it is given — the org's, a team's,
53994
+ * another user's — each as this agent holds it.
53995
+ */
53912
53996
  async getAgentSecrets(orgId, agentId) {
53913
53997
  return this.request("GET", ENDPOINTS.AGENT_SECRETS(orgId, agentId));
53914
53998
  }
@@ -53934,13 +54018,58 @@ var AgentSecretClient = class extends UserPreferencesClient {
53934
54018
  async deleteOrgSecret(orgId, secretId) {
53935
54019
  await this.request("DELETE", ENDPOINTS.ORG_SECRET(orgId, secretId));
53936
54020
  }
54021
+ /** The caller's own secrets and who each is given to. Only that person. */
54022
+ async getMySecrets(orgId) {
54023
+ return this.request("GET", ENDPOINTS.ORG_MY_SECRETS(orgId));
54024
+ }
54025
+ async createMySecret(orgId, data) {
54026
+ return this.request("POST", ENDPOINTS.ORG_MY_SECRETS(orgId), data);
54027
+ }
54028
+ async updateMySecret(orgId, secretId, data) {
54029
+ return this.request("PATCH", ENDPOINTS.ORG_MY_SECRET(orgId, secretId), data);
54030
+ }
54031
+ async deleteMySecret(orgId, secretId) {
54032
+ await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET(orgId, secretId));
54033
+ }
54034
+ /** A team's secrets and who each is given to: its human managers and org admins. */
54035
+ async getTeamSecrets(orgId, teamId) {
54036
+ return this.request("GET", ENDPOINTS.TEAM_SECRETS(orgId, teamId));
54037
+ }
54038
+ async createTeamSecret(orgId, teamId, data) {
54039
+ return this.request("POST", ENDPOINTS.TEAM_SECRETS(orgId, teamId), data);
54040
+ }
54041
+ async updateTeamSecret(orgId, teamId, secretId, data) {
54042
+ return this.request("PATCH", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId), data);
54043
+ }
54044
+ async deleteTeamSecret(orgId, teamId, secretId) {
54045
+ await this.request("DELETE", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId));
54046
+ }
54047
+ // Taking one agent off a secret, whether it holds it for long or once. A
54048
+ // grant the agent does not hold answers 404 SECRET_GRANT_NOT_FOUND.
54049
+ async revokeOrgSecretGrant(orgId, secretId, agentId) {
54050
+ await this.request("DELETE", ENDPOINTS.ORG_SECRET_GRANT(orgId, secretId, agentId));
54051
+ }
54052
+ async revokeMySecretGrant(orgId, secretId, agentId) {
54053
+ await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET_GRANT(orgId, secretId, agentId));
54054
+ }
54055
+ /** Takes `agentId` off one of `ownerAgentId`'s own secrets. */
54056
+ async revokeAgentSecretGrant(orgId, ownerAgentId, secretId, agentId) {
54057
+ await this.request("DELETE", ENDPOINTS.AGENT_SECRET_GRANT(orgId, ownerAgentId, secretId, agentId));
54058
+ }
54059
+ async revokeTeamSecretGrant(orgId, teamId, secretId, agentId) {
54060
+ await this.request("DELETE", ENDPOINTS.TEAM_SECRET_GRANT(orgId, teamId, secretId, agentId));
54061
+ }
53937
54062
  /** Agent runtime only: the values to export to the agent's commands. */
53938
54063
  async getMyAgentSecrets(orgId) {
53939
54064
  return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS(orgId));
53940
54065
  }
53941
- /** Agent only: the names it holds or may ask to use, and its pending requests. */
53942
- async getMyAgentSecretCatalog(orgId) {
53943
- return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS_CATALOG(orgId));
54066
+ /**
54067
+ * Agent only: the names it holds or may ask to use, its pending requests,
54068
+ * and the teams it may ask in. `q` keeps the keys whose name, purpose or
54069
+ * owner's name contains it, ignoring case.
54070
+ */
54071
+ async getMyAgentSecretCatalog(orgId, q) {
54072
+ return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS_CATALOG(orgId, q));
53944
54073
  }
53945
54074
  /** Agent runtime only: confirm the version the commands now run with. */
53946
54075
  async ackMyAgentSecrets(orgId, version) {
@@ -54073,6 +54202,8 @@ var BillingClient = class extends TeamGraphClient {
54073
54202
  const params = new URLSearchParams();
54074
54203
  params.set("start_date", opts.start_date);
54075
54204
  params.set("end_date", opts.end_date);
54205
+ if (opts.timezone !== void 0)
54206
+ params.set("timezone", opts.timezone);
54076
54207
  return this.request("GET", `${ENDPOINTS.BILLING_USAGE_DAILY(orgId, accountId)}?${params}`);
54077
54208
  }
54078
54209
  async getUsageHeatmap(orgId, opts, accountId) {
@@ -54220,8 +54351,16 @@ var TeamInviteClient = class extends BillingClient {
54220
54351
  async getTeamInvite(token) {
54221
54352
  return this.request("GET", ENDPOINTS.TEAM_INVITE(token));
54222
54353
  }
54223
- /** Ask for a new team through a link. Submitting again returns the
54224
- * caller's open request instead of making another. */
54354
+ /** Signed in: the org's Teams to pick from on a launch link, the caller's
54355
+ * own first, each marked with whether it has (or is getting) the squad and
54356
+ * which Team account would pay. */
54357
+ async getTeamInviteTeams(token) {
54358
+ const res = await this.request("GET", ENDPOINTS.TEAM_INVITE_TEAMS(token));
54359
+ return res.teams ?? [];
54360
+ }
54361
+ /** Ask for a team through a link: pick an existing one (`team_id`) or name
54362
+ * a new one. Submitting again returns the caller's open request instead of
54363
+ * making another. */
54225
54364
  async createTeamInviteRequest(token, body) {
54226
54365
  return this.request("POST", ENDPOINTS.TEAM_INVITE_REQUESTS(token), body);
54227
54366
  }
@@ -54244,6 +54383,42 @@ function errorCode(err) {
54244
54383
  return typeof err === "object" && err !== null ? err.code : void 0;
54245
54384
  }
54246
54385
 
54386
+ // ts/sdk/dist/wiki-page-share-client.js
54387
+ var WikiPageShareClient = class extends TeamInviteClient {
54388
+ async listWikiPageShares(orgId, wikiId, path15) {
54389
+ const res = await this.request("GET", ENDPOINTS.WIKI_PAGE_SHARES(orgId, wikiId), void 0, { path: path15 });
54390
+ return res.data;
54391
+ }
54392
+ async createWikiPageShare(orgId, wikiId, path15, userId) {
54393
+ return this.request("POST", ENDPOINTS.WIKI_PAGE_SHARES(orgId, wikiId), { user_id: userId }, { path: path15 });
54394
+ }
54395
+ async revokeWikiPageShare(orgId, wikiId, path15, shareId) {
54396
+ return this.request("DELETE", `${ENDPOINTS.WIKI_PAGE_SHARES(orgId, wikiId)}/${encodeURIComponent(shareId)}`, void 0, { path: path15 });
54397
+ }
54398
+ async listWikiShareCandidates(orgId, wikiId, path15, q = "") {
54399
+ const res = await this.request("GET", ENDPOINTS.WIKI_PAGE_SHARE_CANDIDATES(orgId, wikiId), void 0, { path: path15, q });
54400
+ return res.data;
54401
+ }
54402
+ /** No path or ref override: the server always reads the shared page on main. */
54403
+ async getSharedWikiPage(shareId, opts) {
54404
+ return this.request("GET", ENDPOINTS.WIKI_SHARED_PAGE(shareId), void 0, void 0, false, opts);
54405
+ }
54406
+ };
54407
+
54408
+ // ts/sdk/dist/chat-bookmarks-client.js
54409
+ var ChatBookmarksClient = class extends WikiPageShareClient {
54410
+ async getChatBookmarks(orgId, chatId) {
54411
+ return this.request("GET", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId));
54412
+ }
54413
+ /** `ref` is a `prll://` reference or an http(s) URL. */
54414
+ async addChatBookmark(orgId, chatId, ref) {
54415
+ return this.request("POST", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId), { ref });
54416
+ }
54417
+ async removeChatBookmark(orgId, chatId, bookmarkId) {
54418
+ return this.request("DELETE", ENDPOINTS.CHAT_BOOKMARK(orgId, chatId, bookmarkId));
54419
+ }
54420
+ };
54421
+
54247
54422
  // ts/sdk/dist/wiki-changeset.js
54248
54423
  function normalizeWikiChangeset(changeset) {
54249
54424
  return {
@@ -54279,7 +54454,7 @@ function legacyHeartbeatFromReport(report) {
54279
54454
  detectedRuntimes
54280
54455
  };
54281
54456
  }
54282
- var ParallClient = class _ParallClient extends TeamInviteClient {
54457
+ var ParallClient = class _ParallClient extends ChatBookmarksClient {
54283
54458
  baseUrl;
54284
54459
  wikiBaseUrl;
54285
54460
  token;
@@ -56575,7 +56750,7 @@ var ParallClient = class _ParallClient extends TeamInviteClient {
56575
56750
  return this.request("GET", ENDPOINTS.ORG_EDGE_DEVICES(orgId));
56576
56751
  }
56577
56752
  /** Register an Edge. `placement` defaults to BYOC; hosted creates an idle,
56578
- * org-shared Cloud Profile and is restricted to human users. */
56753
+ * org-shared Cloud Profile; Agents need a separate creation grant and key. */
56579
56754
  async registerEdgeDevice(orgId, input, options) {
56580
56755
  const headers = options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : void 0;
56581
56756
  return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), input, void 0, false, { headers });
@@ -56820,10 +56995,11 @@ var ParallClient = class _ParallClient extends TeamInviteClient {
56820
56995
  async listClipMCPConnections(orgId, clipId) {
56821
56996
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
56822
56997
  }
56823
- /** Create one MCP credential slot and its connection. */
56824
56998
  async createClipMCPConnection(orgId, clipId, req) {
56825
56999
  return this.request("POST", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId), req, void 0, false, {
56826
- timeoutMs: 4e4
57000
+ // A card may start OAuth: allow discovery (30s) and persistence like
57001
+ // createClipMCPOAuthConnection.
57002
+ timeoutMs: "approval_id" in req ? 5e4 : 4e4
56827
57003
  });
56828
57004
  }
56829
57005
  /** Delete one MCP config and its paired connection. */
@@ -57691,6 +57867,11 @@ var VENDOR_CLIS = [
57691
57867
  channel: "feishu",
57692
57868
  command: "lark-cli",
57693
57869
  install: "npm i -g @larksuite/cli && npx skills add larksuite/cli -y -g",
57870
+ // Before 1.0.97, im +messages-send / +messages-reply took `--markdown
57871
+ // @file` (the form the official skill teaches) as the literal text
57872
+ // "@file", sent it and reported success
57873
+ // (https://github.com/larksuite/cli/pull/2760).
57874
+ minVersion: "1.0.97",
57694
57875
  ownedEnv: [
57695
57876
  // injected
57696
57877
  "LARKSUITE_CLI_APP_ID",
@@ -63789,11 +63970,14 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
63789
63970
 
63790
63971
  \u8FD0\u884C \`parall browser profiles --json\`\uFF0C\u4ECE\u53EF\u8BBF\u95EE\u5217\u8868\u6309\u8D26\u53F7\u540D\u79F0\u9009\u62E9 Profile\u3002
63791
63972
  \u591A\u4E2A\u8D26\u53F7\u65E0\u6CD5\u533A\u5206\u65F6\u95EE\u7528\u6237\u3002\u5217\u8868\u8868\u793A\u4F60\u6709\u8BBF\u95EE\u6743\u9650\uFF0C\u4E0D\u4FDD\u8BC1\u7F51\u7AD9\u5DF2\u767B\u5F55\u6216\u6BCF\u79CD\u52A8\u4F5C\u90FD\u83B7\u6388\u6743\u3002
63792
- \u6CA1\u6709\u53EF\u7528 Profile \u65F6\uFF0C\u95EE\u7528\u6237\uFF1A
63973
+ \u6CA1\u6709\u53EF\u7528 Profile \u65F6\uFF0C\u5148\u7528 \`parall cloud-profile access\` \u67E5\u8BE2\u81EA\u5DF1\u7684\u521B\u5EFA\u6388\u6743\uFF1B\u4EC5\u5728\u72B6\u6001\u4E3A active\u3001\u5269\u4F59\u6570\u91CF\u8DB3\u591F\u4E14\u4EFB\u52A1\u9700\u8981\u65B0\u7684\u7A7A\u767D hosted Profile\u65F6\uFF0C\u7528 \`parall cloud-profile create <name>\`\u3002
63974
+ \u521B\u5EFA\u56DE\u4F20\u7684 \`profile_id\` \u624D\u662F\u540E\u7EED \`--profile\` \u7684\u503C\uFF1B\u4E0D\u8981\u628A\u8BBE\u5907 ID \u5F53\u4F5C Profile ID\u3002
63975
+ \u65E0\u6709\u6548\u521B\u5EFA\u6388\u6743\u6216\u4EFB\u52A1\u9700\u8981\u5DF2\u6709\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u95EE\u7528\u6237\uFF1A
63793
63976
  - **\u7528\u6237\u6709 Desktop \u4F46\u4F60\u6CA1\u6743\u9650**\uFF1A\u8BF7\u7528\u6237\u544A\u8BC9\u4F60 Profile ID\uFF08\`ebp_...\`\uFF0C\u5728 Desktop\u300C\u8FDE\u63A5\u5668\u300D\u9875\u7684 Devices \u91CC\u53EF\u4EE5\u770B\u5230\uFF09\uFF0C\u7136\u540E\u901A\u8FC7\u5BA1\u6279\u5361\u8BF7\u6C42\u6388\u6743\u2014\u2014
63794
63977
  \`parall approvals request --action browser.profile.authorize --resource prll://<ebp_id> --title "Request browser profile access" --chat prll://<cht_id>\`
63795
63978
  \u4EBA approve \u540E\u4F60\u81EA\u52A8\u83B7\u5F97\u8BE5 Profile \u7684\u5168\u90E8\u64CD\u4F5C\u6743\u9650\u3002
63796
- - **\u7528\u6237\u6CA1\u6709 Desktop**\uFF1A\u544A\u8BC9\u7528\u6237\u5B89\u88C5\u5E76\u6253\u5F00 Parall Desktop\uFF0CDesktop \u542F\u52A8\u540E\u4F1A\u81EA\u52A8\u6CE8\u518C\u8BBE\u5907\u548C\u9ED8\u8BA4 Profile\u3002\u5B89\u88C5 Desktop \u540E\u4F60\u5C31\u6709\u4E86 Browser Use \u548C\u8FDE\u63A5\u5668\u80FD\u529B\u3002
63979
+ - **\u9700\u8981\u81EA\u5EFA\u7A7A\u767D hosted Profile**\uFF1A\u8BF7\u771F\u4EBA\u7EC4\u7EC7 owner/admin \u7ED9\u4F60\u7684 Agent \`usr_\` \u6388\u4E88\u6709\u6570\u91CF\u548C\u5230\u671F\u7684\u521B\u5EFA\u6743\uFF1B\u5DF2\u5B58\u5728 Profile \u7684\u5BA1\u6279\u5361\u4E0D\u4F1A\u6388\u4E88\u521B\u5EFA\u6743\u3002
63980
+ - **\u9700\u8981\u672C\u673A\u6D4F\u89C8\u5668\u4E14\u7528\u6237\u6CA1\u6709 Desktop**\uFF1A\u8BF7\u7528\u6237\u5B89\u88C5\u5E76\u6253\u5F00 Parall Desktop\uFF0C\u518D\u660E\u786E\u6388\u4E88\u5BF9\u5E94 Profile \u8BBF\u95EE\u6743\uFF1B\u5B89\u88C5\u672C\u8EAB\u4E0D\u4EE3\u8868\u4F60\u5DF2\u6709\u6743\u9650\u3002
63797
63981
  \u5217\u8868\u62A5\u9519\u65F6\u4FDD\u7559\u9519\u8BEF\uFF0C\u4E0D\u80FD\u5F53\u4F5C\u7A7A\u5217\u8868\u3002
63798
63982
  \u7528\u6237\u5DF2\u7ED9 Profile ID \u65F6\u53EF\u76F4\u63A5\u4F7F\u7528\u3002\u6BCF\u6B21\u547D\u4EE4\u90FD\u5E26 \`--profile\`\uFF0C\u4E0D\u731C\u9ED8\u8BA4\u8D26\u53F7\u3002
63799
63983
 
@@ -63801,6 +63985,19 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
63801
63985
  \`profiles\` \u548C \`operation get\` \u514D\u8D39\u3002\u6309\u7528\u6237\u6388\u6743\u7684\u6B21\u6570\u548C\u9884\u7B97\u6267\u884C\uFF1B\u672A\u7ED9\u9884\u7B97\u65F6\u5148\u8BF4\u660E\u9884\u8BA1\u8D39\u7528\u3002
63802
63986
  \u80FD\u4ECE\u5DF2\u6709\u7ED3\u679C\u56DE\u7B54\u5C31\u4E0D\u8981\u518D\u8C03\u7528\uFF1B\u4E0D\u8981\u5FAA\u73AF\u622A\u56FE\u3001\u67E5\u8BE2 tabs \u6216\u6362\u52A8\u4F5C\u8BD5\u63A2\u3002
63803
63987
 
63988
+ ## \u81EA\u5EFA Profile \u7684\u8FB9\u754C\u4E0E\u6062\u590D
63989
+
63990
+ \u521B\u5EFA\u662F\u514D\u8D39\u7684\uFF0C\u4E5F\u4E0D\u542F\u52A8\u6D4F\u89C8\u5668\uFF1B\u540E\u7EED Browser Use \u4ECD\u6309\u539F\u89C4\u5219\u6536\u8D39\uFF0C\u521B\u5EFA\u6B21\u6570\u4E0D\u662F\u6267\u884C\u8D39\u7528\u9884\u7B97\u3002
63991
+ \u65B0\u5EFA\u4E3A\u7A7A\u767D\u6D4F\u89C8\u5668\uFF0C\u9ED8\u8BA4\u4E0D\u516C\u5F00\uFF0C\u53EA\u7ED9\u521B\u5EFA Agent \u5B8C\u6574 Browser Use \u6743\u9650\uFF1B\u7EF4\u62A4\u4EBA\u4E3A\u6388\u4E88\u6388\u6743\u7684\u771F\u4EBA\u3002
63992
+ \u4EE3\u7406\u51ED\u636E\u3001\u7F51\u7AD9\u767B\u5F55\u3001cookie \u548C\u73B0\u6709\u767B\u5F55\u6001\u9ED8\u8BA4\u4E0D\u53EF\u89E6\u78B0\uFF1B\u9700\u8981\u65F6\u8BF7\u4EBA\u5904\u7406\uFF0C\u4E0D\u81EA\u884C\u8BFB\u53D6\u3001\u514B\u9686\u6216\u914D\u7F6E\u3002
63993
+ \u5220\u9664\u4E0D\u8FD4\u521B\u5EFA\u540D\u989D\uFF1B\u6388\u6743\u5230\u671F\u6216\u64A4\u9500\u53EA\u505C\u6B62\u65B0\u5EFA\uFF0C\u5DF2\u6709\u6D4F\u89C8\u5668\u53CA\u72EC\u7ACB\u4F7F\u7528\u6743\u4FDD\u7559\u3002
63994
+
63995
+ - \`HOSTED_CREATION_NOT_ALLOWED\` / \`HOSTED_CREATION_LIMIT\`\uFF1A\u505C\u6B62\u65B0\u5EFA\uFF0C\u8BF7\u771F\u4EBA\u7BA1\u7406\u5458\u67E5\u770B\u6216\u4FEE\u6539\u6388\u6743\uFF1B\u4E0D\u6362 key\u3001\u8EAB\u4EFD\u6216\u5220\u8D44\u6E90\u7ED5\u8FC7\u3002
63996
+ - \`HOSTED_CREATION_CONFLICT\`\uFF1A\u7BA1\u7406\u53D8\u66F4\u5148\u91CD\u65B0\u8BFB\u53D6\u6388\u6743\uFF1B\u521B\u5EFA\u8BF7\u6C42\u4FDD\u7559\u539F\u53C2\u6570\u548C\u6062\u590D\u6587\u4EF6\uFF0C\u4E0D\u80FD\u6539\u540D\u6362 key \u91CD\u8BD5\u3002
63997
+ - \u521B\u5EFA\u6216\u7BA1\u7406\u547D\u4EE4\u62A5\u7ED3\u679C\u672A\u77E5\u65F6\uFF0C\u53EA\u7528\u8F93\u51FA\u4E2D\u7684 \`parall cloud-profile recover <file>\` \u6062\u590D\u539F\u8BF7\u6C42\uFF1B\u4E0D\u91CD\u65B0\u8FD0\u884C create/grant \u751F\u6210\u66FF\u4EE3\u8BF7\u6C42\u3002
63998
+ - \u6062\u590D\u7ED3\u679C \`deleted: true\` \u8868\u793A\u539F Profile \u5DF2\u5220\u9664\uFF0C\u4E0D\u80FD\u627F\u8BFA\u53EF\u7528\uFF0C\u4E5F\u4E0D\u80FD\u901A\u8FC7\u6062\u590D\u53E6\u5EFA\u4E00\u4E2A Profile\u3002
63999
+ - \u670D\u52A1\u7AEF\u6CA1\u6709\u6B64\u547D\u4EE4\u6216\u529F\u80FD\u4E0D\u53EF\u7528\u65F6\uFF0C\u5982\u5B9E\u62A5\u544A\u80FD\u529B\u4E0D\u53EF\u7528\uFF0C\u6CBF\u73B0\u6709 Profile \u6388\u6743\u8DEF\u5F84\u5904\u7406\u3002
64000
+
63804
64001
  ## \u793A\u4F8B\uFF1A\u6253\u5F00\u9875\u9762\uFF0C\u8BFB\u53D6\u6807\u9898\uFF0C\u7559\u7ED9\u7528\u6237\u67E5\u770B
63805
64002
 
63806
64003
  \u4E0B\u9762\u5C16\u62EC\u53F7\u987B\u66FF\u6362\u4E3A\u5B9E\u9645\u8FD4\u56DE\u503C\uFF0C\u4E0D\u8981\u7167\u6284\u3002
@@ -63937,6 +64134,16 @@ parall messages list prll://cht_xxx # Read chat message history
63937
64134
  parall messages list prll://cht_xxx --since 2026-01-01 # Only messages at/after a date (RFC3339 or YYYY-MM-DD)
63938
64135
  \`\`\`
63939
64136
 
64137
+ A chat's **bookmarks** are the references pinned to its top, which every member
64138
+ sees in the bookmark bar above the messages. Use them when someone asks you to
64139
+ bookmark or pin something in a chat, or asks what is bookmarked there:
64140
+
64141
+ \`\`\`bash
64142
+ parall chats bookmarks list prll://cht_xxx
64143
+ parall chats bookmarks add prll://cht_xxx prll://tsk_xxx # any prll:// reference, or an https:// link
64144
+ parall chats bookmarks remove prll://cht_xxx prll://tsk_xxx
64145
+ \`\`\`
64146
+
63940
64147
  ## Org-Context Search
63941
64148
 
63942
64149
  Before deciding or starting non-trivial work, search the org's real history \u2014
@@ -65078,7 +65285,7 @@ bound to the connector, and the connection is what your access is granted on.
65078
65285
  \u6216\u628A\u8C03\u7528\u8005\u52A0\u5165\u8FDE\u63A5\u5668\u540D\u5355\uFF1Bagent \u672C\u7248\u4ECD\u8FD4\u56DE\u4E0B\u8FF0\u4E24\u4E2A\u9519\u8BEF\u7801\u3002
65079
65286
  - \`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\` mean a
65080
65287
  human has restricted who may run this connector (or through which account);
65081
- ask them to widen access \u2014 you cannot grant it to yourself.
65288
+ you cannot grant it to yourself \u2014 ask on a card (next section).
65082
65289
  - Waiting on a cloud profile is handled by the CLI: \`EDGE_ACTIVATING\` (cold
65083
65290
  start), \`EDGE_BUSY\` (another exec is running) and
65084
65291
  \`EDGE_CONCURRENCY_LIMIT\` (org at capacity) are all guaranteed-unexecuted
@@ -65087,6 +65294,24 @@ bound to the connector, and the connection is what your access is granted on.
65087
65294
  fails already spent that budget \u2014 report the error, do not blind-retry in
65088
65295
  a loop.
65089
65296
 
65297
+ ## Ask a person to connect
65298
+
65299
+ When the task needs a connector you cannot run yet \u2014 it is not installed
65300
+ (find it with \`parall connector search <text>\`), you have no connection to it
65301
+ (\`CONNECTION_NOT_FOUND\`), you are not allowed through one
65302
+ (\`CLIP_AGENT_NOT_ALLOWED\`, \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`) or it needs
65303
+ signing in again (\`MCP_OAUTH_REAUTH_REQUIRED\`) \u2014 post a card:
65304
+
65305
+ \`\`\`bash
65306
+ parall connector connect <connector> --reason "<what you need it for>" # the person's own account (mail, calendar, personal tools)
65307
+ parall connector connect <connector> --reason "<what you need it for>" --from org # a company-shared account
65308
+ \`\`\`
65309
+
65310
+ The card installs the connector and creates the connection \u2014 don't send the
65311
+ person to the Connectors page or install it yourself. Relay the sentence the
65312
+ command prints, carry on with what doesn't need the connector, and you are
65313
+ woken with the result. Use a person's account only for that person's requests.
65314
+
65090
65315
  ## MCP connectors (remote tool servers)
65091
65316
 
65092
65317
  A connection with target \`mcp\` routes to a remote MCP server; the command
@@ -65104,7 +65329,7 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65104
65329
 
65105
65330
  - \`connector connections\` marks MCP rows with their auth mode, \`credential_set\`
65106
65331
  / \`oauth_status\` and \`tool_count\` \u2014 a \`needs_reauth\` or credential-less
65107
- row will refuse exec until an org admin fixes it in the Connector Console.
65332
+ row will refuse exec until someone signs in again; ask on a card (above).
65108
65333
  - \`--connection\` is REQUIRED to exec an MCP connection, exactly like every
65109
65334
  other target. The alias tells you WHICH account you act as \u2014 always name
65110
65335
  it.
@@ -65121,17 +65346,16 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65121
65346
  or MCP is off for this deployment \u2014 ask an org admin; retrying won't help.
65122
65347
  - \`MCP_OAUTH_REAUTH_REQUIRED\` = that connection's authorization is no longer
65123
65348
  valid (revoked or expired at the provider, or disconnected) \u2014 nothing ran and
65124
- retrying won't help. Tell the user which connection broke (the message names
65125
- the connector and connection), that an org owner or admin must re-authorize it in
65126
- Connectors (Web or Desktop), and share \`details.reauth_url\` when present. Owners and admins
65127
- usually also get an Inbox alert, but don't rely on it \u2014 still tell the user
65128
- who needs to act.
65349
+ retrying won't help. Ask on a card (above; \`--from org\` for a
65350
+ company-shared account). For a person's own account the card makes a new
65351
+ connection: use the \`connection_id\` from the decision, not the old one.
65129
65352
  - \`MCP_AUTH_FAILED\` = the MCP server refused this request with this
65130
65353
  connection's credentials \u2014 nothing ran; don't retry as-is.
65131
65354
  \`details.reason\` \`insufficient_scope\`: this account may not do that \u2014 use
65132
65355
  a connection with the needed access, or ask an org admin to review its
65133
65356
  permissions. \`credential_rejected\`: the saved credential is no longer
65134
- accepted \u2014 an org admin must update it.
65357
+ accepted \u2014 an org admin must update it. On a person's own account the
65358
+ message says to ask that person on a card instead; follow the message.
65135
65359
  - \`MCP_SERVER_UNREACHABLE\` = the MCP server (or its OAuth token endpoint)
65136
65360
  could not be reached \u2014 nothing ran; safe to retry after a short wait.
65137
65361
  - \`OUTCOME_UNKNOWN\` follows the rule below: dispatched and MAY HAVE
@@ -65145,11 +65369,11 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65145
65369
 
65146
65370
  ## Behavior rules
65147
65371
 
65148
- - An authorization error (\`CLIP_AGENT_NOT_ALLOWED\`,
65149
- \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`, \`CONNECTION_NOT_ALLOWED\`,
65150
- \`PROFILE_NOT_ALLOWED\`, \`FORBIDDEN\`) is a fail-fast: ask
65151
- an org admin to grant the connector or the connection \u2014 do not retry or work
65152
- around it.
65372
+ - An authorization error is a fail-fast \u2014 do not retry or work around it.
65373
+ \`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`: ask on a
65374
+ card with \`parall connector connect\`. \`CONNECTION_NOT_ALLOWED\`,
65375
+ \`PROFILE_NOT_ALLOWED\`, \`FORBIDDEN\`: ask an org admin to grant the
65376
+ connector or the connection.
65153
65377
  - If the target device is offline or the call times out, report that
65154
65378
  plainly; do not queue, and never fabricate a result for a run that errored.
65155
65379
  - **\`OUTCOME_UNKNOWN\` is never retryable.** It means the command was
@@ -65571,7 +65795,7 @@ var SKILLS = [
65571
65795
  },
65572
65796
  {
65573
65797
  name: "parall-platform",
65574
- description: "Parall platform queries and lightweight agent provisioning: list org members, agents, chats, read message history, watch/unwatch threads, check identity, create another agent, walk the prll:// reference graph (resolve URIs, backlinks, multi-hop graph), or put a chart / interactive visual into a message (html-embed blocks). Use when: user asks about org members, who's online, chat history, agent list, creating an agent, identity/auth questions, you want to follow or mute a thread (e.g. after `Thread Reply` wake-ups), you need to find what an entity is connected to / who references it, or a chart, comparison or small interactive tool would help in your reply.",
65798
+ description: "Parall platform queries and lightweight agent provisioning: list org members, agents, chats, read message history, list/add/remove a chat's bookmarks (references pinned to the top of a chat), watch/unwatch threads, check identity, create another agent, walk the prll:// reference graph (resolve URIs, backlinks, multi-hop graph), or put a chart / interactive visual into a message (html-embed blocks). Use when: user asks about org members, who's online, chat history, bookmarking or pinning something in a chat, agent list, creating an agent, identity/auth questions, you want to follow or mute a thread (e.g. after `Thread Reply` wake-ups), you need to find what an entity is connected to / who references it, or a chart, comparison or small interactive tool would help in your reply.",
65575
65799
  content: PARALL_PLATFORM_SKILL
65576
65800
  },
65577
65801
  {
@@ -65596,7 +65820,7 @@ var SKILLS = [
65596
65820
  },
65597
65821
  {
65598
65822
  name: "parall-clips",
65599
- description: "Parall connector operations (connectors were formerly called clips): list installed connectors and their connections, inspect connector commands/tools, execute connector commands on an explicit connection. Use when: the task requires external capabilities (GitHub, web search, etc.), user asks about available tools/clips, or you need to call a connector command. For WRITING a new connector, use parall-clip-authoring instead.",
65823
+ description: "Parall connector operations (connectors were formerly called clips): list installed connectors and their connections, inspect connector commands/tools, execute connector commands on an explicit connection, and ask a person on a card to connect an account when you cannot run one yet. Use when: the task requires external capabilities (GitHub, web search, etc.), user asks about available tools/clips, or you need to call a connector command. For WRITING a new connector, use parall-clip-authoring instead.",
65600
65824
  content: PARALL_CLIPS_SKILL
65601
65825
  },
65602
65826
  {
@@ -65899,7 +66123,7 @@ function createCommandEnv(opts) {
65899
66123
  // ts/claude-agent/dist/dispatch.js
65900
66124
  import { execSync as execSync2, spawn } from "node:child_process";
65901
66125
  import { randomUUID as randomUUID10 } from "node:crypto";
65902
- import * as fs10 from "node:fs";
66126
+ import * as fs11 from "node:fs";
65903
66127
  import * as path13 from "node:path";
65904
66128
 
65905
66129
  // ts/agent-core/dist/internal/attachment-input.js
@@ -66562,7 +66786,7 @@ var ClaudeBusyTracker = class {
66562
66786
  * REPLACE frame arrives BEFORE the task_notification for the task it
66563
66787
  * removed (2.1.292 sends it after), and the notification itself carries
66564
66788
  * only a summary. Both orders occur — self-hosted machines run whatever
66565
- * CLI the user installed (probes/background-tasks-2.1.292.md).
66789
+ * CLI the user installed (probes/background-tasks-2.1.318.md).
66566
66790
  */
66567
66791
  finishedDescriptions = /* @__PURE__ */ new Map();
66568
66792
  constructor(holdMs = DEFAULT_FOLLOW_UP_HOLD_MS) {
@@ -66678,378 +66902,6 @@ function aggregateBusyState(states) {
66678
66902
  return { activeTurns, backgroundWork, ...holdUntil !== void 0 ? { holdUntil } : {} };
66679
66903
  }
66680
66904
 
66681
- // ts/claude-agent/dist/input-lifecycle.js
66682
- import { randomUUID as randomUUID7 } from "node:crypto";
66683
-
66684
- // ts/claude-agent/dist/turn-outcome.js
66685
- var LIMIT_TEXT = /you'?ve (hit|reached) your .*limit|usage limit reached|weekly limit/i;
66686
- var AUTH_TEXT = /not logged in|please run \/login|authentication_error|authentication_failed|failed to authenticate|invalid api key|oauth (token|session) (has )?expired|\[action required\]/i;
66687
- var CONTEXT_TEXT = /prompt is too long|context (window|length) exceeded|request too large/i;
66688
- var RATE_LIMIT_ERROR_TEXT = /rate_limit_error/i;
66689
- var QUOTA_TEXT = /credit balance is too low|insufficient credits|insufficient_quota|payment required/i;
66690
- var DETAIL_MAX = 500;
66691
- function minutesOfDayInZone(fmt, at) {
66692
- const parts = Object.fromEntries(fmt.formatToParts(at).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
66693
- const hour = parts.hour === 24 ? 0 : parts.hour;
66694
- return hour * 60 + parts.minute;
66695
- }
66696
- function parseClaudeResetTime(text, now) {
66697
- const m = /resets\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\s*\(([^)]+)\)/i.exec(text);
66698
- if (!m)
66699
- return void 0;
66700
- let hour = Number(m[1]);
66701
- const minute = m[2] ? Number(m[2]) : 0;
66702
- const meridiem = m[3]?.toLowerCase();
66703
- const timeZone = m[4].trim();
66704
- if (!Number.isFinite(hour) || hour > 23 || minute > 59)
66705
- return void 0;
66706
- if (meridiem === "pm" && hour < 12)
66707
- hour += 12;
66708
- if (meridiem === "am" && hour === 12)
66709
- hour = 0;
66710
- let fmt;
66711
- let nowMinutesOfDay;
66712
- try {
66713
- fmt = new Intl.DateTimeFormat("en-US", {
66714
- timeZone,
66715
- hour12: false,
66716
- hour: "2-digit",
66717
- minute: "2-digit"
66718
- });
66719
- nowMinutesOfDay = minutesOfDayInZone(fmt, now);
66720
- } catch {
66721
- return void 0;
66722
- }
66723
- const targetMinutesOfDay = hour * 60 + minute;
66724
- let deltaMinutes = targetMinutesOfDay - nowMinutesOfDay;
66725
- if (deltaMinutes <= 0)
66726
- deltaMinutes += 24 * 60;
66727
- const anchored = now.getTime() - (now.getSeconds() * 1e3 + now.getMilliseconds());
66728
- let target = anchored + deltaMinutes * 6e4;
66729
- for (let i = 0; i < 2; i++) {
66730
- let diff = targetMinutesOfDay - minutesOfDayInZone(fmt, new Date(target));
66731
- if (diff > 720)
66732
- diff -= 1440;
66733
- if (diff < -720)
66734
- diff += 1440;
66735
- if (diff === 0)
66736
- break;
66737
- target += diff * 6e4;
66738
- }
66739
- if (target <= now.getTime())
66740
- target += 24 * 60 * 6e4;
66741
- return new Date(target).toISOString();
66742
- }
66743
- function usageOf(meta) {
66744
- const usage = {};
66745
- if (meta.inputTokens !== void 0)
66746
- usage.inputTokens = meta.inputTokens;
66747
- if (meta.outputTokens !== void 0)
66748
- usage.outputTokens = meta.outputTokens;
66749
- if (meta.cacheReadTokens !== void 0)
66750
- usage.cacheReadTokens = meta.cacheReadTokens;
66751
- if (meta.cacheCreationTokens !== void 0)
66752
- usage.cacheCreationTokens = meta.cacheCreationTokens;
66753
- if (meta.totalCostUsd !== void 0)
66754
- usage.costUsd = meta.totalCostUsd;
66755
- if (meta.durationMs !== void 0)
66756
- usage.durationMs = meta.durationMs;
66757
- if (meta.durationApiMs !== void 0)
66758
- usage.durationApiMs = meta.durationApiMs;
66759
- return Object.keys(usage).length > 0 ? usage : void 0;
66760
- }
66761
- function classifyClaudeTurn(meta, noticeTexts, now = /* @__PURE__ */ new Date()) {
66762
- if (!meta) {
66763
- return { type: "turn_outcome", outcome: "runtime_crash" };
66764
- }
66765
- const usage = usageOf(meta);
66766
- const evidence = [meta.resultText, ...noticeTexts].filter(Boolean).join("\n");
66767
- const base = {
66768
- type: "turn_outcome",
66769
- ...usage ? { usage } : {},
66770
- ...meta.model ? { model: meta.model } : {},
66771
- raw: {
66772
- ...meta.subtype ? { subtype: meta.subtype } : {},
66773
- ...meta.terminalReason ? { terminal_reason: meta.terminalReason } : {},
66774
- ...meta.apiErrorStatus !== void 0 ? { api_error_status: meta.apiErrorStatus } : {},
66775
- ...meta.stopReason ? { stop_reason: meta.stopReason } : {}
66776
- }
66777
- };
66778
- const withDetail = (outcome, retryAt) => ({
66779
- ...base,
66780
- outcome,
66781
- ...evidence ? { detail: evidence.slice(0, DETAIL_MAX) } : {},
66782
- ...retryAt ? { retryAt } : {}
66783
- });
66784
- if (meta.apiErrorStatus === 401 || meta.apiErrorStatus === 403)
66785
- return withDetail("auth");
66786
- if (meta.apiErrorStatus === 402)
66787
- return withDetail("quota_exhausted");
66788
- if (meta.apiErrorStatus === 413)
66789
- return withDetail("context_overflow");
66790
- if (meta.apiErrorStatus === 429) {
66791
- if (QUOTA_TEXT.test(evidence))
66792
- return withDetail("quota_exhausted");
66793
- if (RATE_LIMIT_ERROR_TEXT.test(evidence))
66794
- return withDetail("transient");
66795
- return withDetail("usage_limit", evidence ? parseClaudeResetTime(evidence, now) : void 0);
66796
- }
66797
- const failed = meta.isError || // Claude CLI 2.1.220 sets terminal_reason=completed on clean result
66798
- // frames. Any other terminal reason stays fail-closed.
66799
- meta.terminalReason !== void 0 && meta.terminalReason !== "completed" || meta.subtype !== void 0 && meta.subtype !== "success";
66800
- const syntheticQuiet = !failed && // A "successful" turn that never touched the API and produced no tool
66801
- // activity is the synthetic-notice shape (limit/auth text emitted
66802
- // locally by the CLI): zero usage + stop_sequence.
66803
- meta.stopReason === "stop_sequence" && (meta.inputTokens ?? 0) === 0 && (meta.outputTokens ?? 0) === 0 && (meta.durationApiMs ?? 0) === 0;
66804
- if (failed || syntheticQuiet || noticeTexts.length > 0) {
66805
- if (CONTEXT_TEXT.test(evidence))
66806
- return withDetail("context_overflow");
66807
- if (QUOTA_TEXT.test(evidence))
66808
- return withDetail("quota_exhausted");
66809
- if (LIMIT_TEXT.test(evidence)) {
66810
- return withDetail("usage_limit", parseClaudeResetTime(evidence, now));
66811
- }
66812
- if (AUTH_TEXT.test(evidence))
66813
- return withDetail("auth");
66814
- return withDetail("transient");
66815
- }
66816
- return { ...base, outcome: "ok" };
66817
- }
66818
-
66819
- // ts/agent-core/dist/internal/async-queue.js
66820
- var AsyncQueue = class {
66821
- opts;
66822
- items = [];
66823
- waiter = null;
66824
- closed = false;
66825
- droppedCount = 0;
66826
- constructor(opts = {}) {
66827
- this.opts = opts;
66828
- }
66829
- /** True once close() ran — parked items may still drain via next(). */
66830
- get isClosed() {
66831
- return this.closed;
66832
- }
66833
- /** Parked items not yet consumed. */
66834
- get size() {
66835
- return this.items.length;
66836
- }
66837
- /** Items dropped past the parked cap (diagnostics). */
66838
- get dropped() {
66839
- return this.droppedCount;
66840
- }
66841
- /** Returns false when the queue is closed (item discarded). */
66842
- push(item) {
66843
- if (this.closed)
66844
- return false;
66845
- if (this.waiter) {
66846
- const resolve3 = this.waiter;
66847
- this.waiter = null;
66848
- resolve3({ value: item, done: false });
66849
- return true;
66850
- }
66851
- const cap = Math.max(1, this.opts.maxParked ?? 5e3);
66852
- if (this.items.length >= cap) {
66853
- this.items.shift();
66854
- if (this.droppedCount === 0)
66855
- this.opts.onFirstDrop?.();
66856
- this.droppedCount += 1;
66857
- }
66858
- this.items.push(item);
66859
- return true;
66860
- }
66861
- next() {
66862
- if (this.items.length > 0) {
66863
- return Promise.resolve({ value: this.items.shift(), done: false });
66864
- }
66865
- if (this.closed) {
66866
- return Promise.resolve({ value: void 0, done: true });
66867
- }
66868
- return new Promise((resolve3) => {
66869
- this.waiter = resolve3;
66870
- });
66871
- }
66872
- close() {
66873
- if (this.closed)
66874
- return;
66875
- this.closed = true;
66876
- const waiter = this.waiter;
66877
- this.waiter = null;
66878
- waiter?.({ value: void 0, done: true });
66879
- }
66880
- };
66881
-
66882
- // ts/claude-agent/dist/turn-sink.js
66883
- function newTurnEvidence() {
66884
- return { noticeTexts: [], sawError: false };
66885
- }
66886
- function newTurnSink(label, log2) {
66887
- return new AsyncQueue({
66888
- onFirstDrop: () => log2?.warn?.(`Claude turn sink ${label} exceeded its parked-frame cap; dropping oldest`)
66889
- });
66890
- }
66891
-
66892
- // ts/claude-agent/dist/input-lifecycle.js
66893
- var ClaudeInputRegistry = class {
66894
- byKey = /* @__PURE__ */ new Map();
66895
- byCommand = /* @__PURE__ */ new Map();
66896
- getByKey(deliveryKey) {
66897
- return this.byKey.get(deliveryKey);
66898
- }
66899
- getByCommand(commandUuid) {
66900
- return this.byCommand.get(commandUuid);
66901
- }
66902
- findOverlapping(dispatchEventIds) {
66903
- const ids = new Set(dispatchEventIds);
66904
- for (const delivery of this.byKey.values()) {
66905
- if (delivery.lifecycle?.dispatchEventIds.some((id) => ids.has(id))) {
66906
- return delivery;
66907
- }
66908
- }
66909
- return void 0;
66910
- }
66911
- values() {
66912
- return this.byKey.values();
66913
- }
66914
- hasPendingInjections() {
66915
- return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.drained);
66916
- }
66917
- /**
66918
- * Injected inputs whose lifecycle has NOT reached a terminal state. A
66919
- * terminal delivery still counts as pending (its buffered copy owes frame
66920
- * boundary bookkeeping) but owes the server nothing — the lane complete
66921
- * defers on this predicate, never on hasPendingInjections, so a bookkeeping
66922
- * copy that never drains cannot hold the lane open past its lease. Drained
66923
- * is deliberately NOT part of this predicate: a discarded bookkeeping copy
66924
- * (drained, non-terminal) is still a running input — completing its lane
66925
- * would release the member for redrive mid-processing.
66926
- */
66927
- hasUnsettledInjections() {
66928
- return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.terminal);
66929
- }
66930
- register(deliveryKey, lifecycle, injected, noteActivity, log2) {
66931
- if (this.byKey.has(deliveryKey)) {
66932
- throw new Error(`duplicate Claude delivery key ${deliveryKey}`);
66933
- }
66934
- const commandUuid = randomUUID7();
66935
- const delivery = {
66936
- deliveryKey,
66937
- commandUuid,
66938
- lifecycle,
66939
- injected,
66940
- drained: !injected,
66941
- resultFailed: false,
66942
- sink: newTurnSink(`delivery ${deliveryKey}`, log2),
66943
- evidence: newTurnEvidence(),
66944
- noteActivity,
66945
- sessionAnnounced: false
66946
- };
66947
- this.byKey.set(deliveryKey, delivery);
66948
- this.byCommand.set(delivery.commandUuid, delivery);
66949
- return delivery;
66950
- }
66951
- /** Undefined while an input under the same key is still registered. */
66952
- registerLocal(input, log2) {
66953
- const deliveryKey = `local:${input.localKey}`;
66954
- if (this.byKey.has(deliveryKey))
66955
- return void 0;
66956
- const delivery = this.register(deliveryKey, void 0, false, void 0, log2);
66957
- const settlement = new LocalInputSettlement(input, log2);
66958
- delivery.local = { label: input.label, settlement, surfaced: false };
66959
- return delivery;
66960
- }
66961
- /** A local input not yet terminal: the CLI has (or will start) work no dispatch drains. */
66962
- hasOpenLocalInput() {
66963
- return [...this.byKey.values()].some((delivery) => delivery.local && !delivery.terminal);
66964
- }
66965
- remove(delivery) {
66966
- if (this.byKey.get(delivery.deliveryKey) === delivery) {
66967
- this.byKey.delete(delivery.deliveryKey);
66968
- }
66969
- if (this.byCommand.get(delivery.commandUuid) === delivery) {
66970
- this.byCommand.delete(delivery.commandUuid);
66971
- }
66972
- }
66973
- /**
66974
- * The buffered copy backing this delivery was discarded without a
66975
- * dispatch (already rendered into a frame the model saw), so the normal
66976
- * bookkeeping drain never comes. Its frame-boundary obligation is void:
66977
- * mark it drained so nothing waits on it, and drop it once terminal. A
66978
- * still-running input keeps its registration — byCommand must keep routing
66979
- * its lifecycle frames — and is dropped when its terminal state arrives
66980
- * (see apply/fail).
66981
- */
66982
- discardBookkeeping(deliveryKey) {
66983
- const delivery = this.byKey.get(deliveryKey);
66984
- if (!delivery)
66985
- return;
66986
- delivery.drained = true;
66987
- if (delivery.terminal)
66988
- this.remove(delivery);
66989
- }
66990
- async apply(delivery, state) {
66991
- if (delivery.terminal || state === "queued")
66992
- return;
66993
- if (state !== "cancelled" && state !== "discarded") {
66994
- delivery.local?.settlement.settle("delivered");
66995
- }
66996
- if (state === "started") {
66997
- if (delivery.reportedState)
66998
- return;
66999
- await delivery.lifecycle?.update("started");
67000
- delivery.reportedState = "started";
67001
- return;
67002
- }
67003
- if (state === "cancelled" || state === "discarded" || delivery.resultFailed) {
67004
- await this.fail(delivery);
67005
- return;
67006
- }
67007
- if (delivery.reportedState !== "completed") {
67008
- await delivery.lifecycle?.update("completed");
67009
- delivery.reportedState = "completed";
67010
- }
67011
- delivery.terminal = "completed";
67012
- if (delivery.drained)
67013
- this.remove(delivery);
67014
- }
67015
- async fail(delivery, detail) {
67016
- if (delivery.terminal)
67017
- return;
67018
- delivery.local?.settlement.settle("not_delivered");
67019
- if (delivery.suppressFailReport) {
67020
- delivery.terminal = "settled";
67021
- if (delivery.drained)
67022
- this.remove(delivery);
67023
- return;
67024
- }
67025
- try {
67026
- if (delivery.reportedState !== "failed") {
67027
- const classified = classifyClaudeTurn(delivery.evidence.lastResultMeta, delivery.evidence.noticeTexts);
67028
- const result = await delivery.lifecycle?.update("failed", {
67029
- outcomeClass: classified.outcome === "ok" || classified.outcome === "usage_limit" ? "runtime_crash" : classified.outcome,
67030
- detail: detail ?? classified.detail ?? "Claude input failed"
67031
- });
67032
- delivery.reportedState = "failed";
67033
- delivery.terminal = result && !result.pending && result.retry === false ? "settled" : "failed";
67034
- }
67035
- } finally {
67036
- delivery.terminal ??= "failed";
67037
- if (delivery.drained)
67038
- this.remove(delivery);
67039
- }
67040
- }
67041
- async failBestEffort(delivery, log2, detail) {
67042
- try {
67043
- await this.fail(delivery, detail);
67044
- } catch (err) {
67045
- log2?.warn?.(`failed to report Claude input ${delivery.commandUuid} as failed: ${String(err)}`);
67046
- }
67047
- }
67048
- async failAllBestEffort(log2, detail) {
67049
- await Promise.all([...this.byKey.values()].filter((delivery) => !delivery.terminal).map((delivery) => this.failBestEffort(delivery, log2, detail)));
67050
- }
67051
- };
67052
-
67053
66905
  // ts/claude-agent/dist/runtime-observations.js
67054
66906
  function claudeObservation(frame) {
67055
66907
  const sessionId = observationField(frame.session_id);
@@ -67489,6 +67341,499 @@ function extractResultMeta(frame, isError, numTurns) {
67489
67341
  return meta;
67490
67342
  }
67491
67343
 
67344
+ // ts/claude-agent/dist/stdin-frames.js
67345
+ import { randomUUID as randomUUID7 } from "node:crypto";
67346
+ function writeCapabilityProbe(handle) {
67347
+ const payload = JSON.stringify({
67348
+ type: "user",
67349
+ uuid: randomUUID7(),
67350
+ parent_tool_use_id: null,
67351
+ message: { role: "user", content: [] }
67352
+ });
67353
+ handle.proc.stdin.write(`${payload}
67354
+ `);
67355
+ }
67356
+ function writeUserMessage(handle, text, commandUuid) {
67357
+ const payload = JSON.stringify({
67358
+ type: "user",
67359
+ uuid: commandUuid,
67360
+ parent_tool_use_id: null,
67361
+ message: {
67362
+ role: "user",
67363
+ content: [{ type: "text", text }]
67364
+ }
67365
+ });
67366
+ handle.proc.stdin.write(`${payload}
67367
+ `);
67368
+ }
67369
+
67370
+ // ts/claude-agent/dist/capability-probe.js
67371
+ var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
67372
+ var MissingClaudeLifecycleCapabilityError = class extends Error {
67373
+ };
67374
+ var UnknownPromptSnapshotFlagError = class extends Error {
67375
+ };
67376
+ var ClaudeCapabilityProbe = class {
67377
+ host;
67378
+ capabilityProbe;
67379
+ capabilityProbeHandle;
67380
+ snapshotOff = true;
67381
+ constructor(host) {
67382
+ this.host = host;
67383
+ }
67384
+ /**
67385
+ * Whether spawns pass `--system-prompt-snapshot off`. The CLI records the
67386
+ * system prompt on a conversation's first request and resends that record on
67387
+ * every later request and --resume, so a rewritten prompt file would never
67388
+ * reach a resumed session (probes/system-prompt-snapshot-2.1.318.md). CLIs
67389
+ * that predate the recording also lack the flag and exit on it; the probe
67390
+ * observes that once and spawns without it from then on.
67391
+ */
67392
+ get promptSnapshotOff() {
67393
+ return this.snapshotOff;
67394
+ }
67395
+ ensureRuntimeCapability(log2) {
67396
+ if (!this.capabilityProbe) {
67397
+ const probe = this.probeRuntimeCapability(log2);
67398
+ this.capabilityProbe = probe.catch((err) => {
67399
+ if (!(err instanceof MissingClaudeLifecycleCapabilityError)) {
67400
+ this.capabilityProbe = void 0;
67401
+ }
67402
+ throw err;
67403
+ });
67404
+ }
67405
+ return this.capabilityProbe;
67406
+ }
67407
+ /** Shutdown: end a probe process that is still running. */
67408
+ terminate() {
67409
+ if (this.capabilityProbeHandle) {
67410
+ this.host.terminateHandle(this.capabilityProbeHandle);
67411
+ this.capabilityProbeHandle = void 0;
67412
+ }
67413
+ }
67414
+ async probeRuntimeCapability(log2) {
67415
+ try {
67416
+ await this.probeOnce(log2);
67417
+ } catch (err) {
67418
+ if (!(err instanceof UnknownPromptSnapshotFlagError))
67419
+ throw err;
67420
+ this.snapshotOff = false;
67421
+ await this.probeOnce(log2);
67422
+ }
67423
+ }
67424
+ async probeOnce(log2) {
67425
+ const handle = this.host.spawnProbe(log2);
67426
+ this.capabilityProbeHandle = handle;
67427
+ const parser = parseClaudeStreamJson(handle.proc.stdout);
67428
+ let timedOut = false;
67429
+ const timer = setTimeout(() => {
67430
+ timedOut = true;
67431
+ this.host.terminateHandle(handle);
67432
+ }, CAPABILITY_PROBE_TIMEOUT_MS);
67433
+ timer.unref?.();
67434
+ try {
67435
+ writeCapabilityProbe(handle);
67436
+ while (true) {
67437
+ const next = await parser.next();
67438
+ if (next.done) {
67439
+ const detail = handle.stderrChunks.join("").trim();
67440
+ if (this.snapshotOff && detail.includes("unknown option '--system-prompt-snapshot'")) {
67441
+ throw new UnknownPromptSnapshotFlagError(detail);
67442
+ }
67443
+ if (timedOut) {
67444
+ throw new Error(`Claude runtime capability probe timed out after ${CAPABILITY_PROBE_TIMEOUT_MS}ms`);
67445
+ }
67446
+ throw new Error(detail || "Claude exited before its runtime capability probe completed");
67447
+ }
67448
+ if (next.value.type !== "runtime_init")
67449
+ continue;
67450
+ if (!next.value.capabilities.includes("msg_lifecycle_v1")) {
67451
+ throw new MissingClaudeLifecycleCapabilityError("Claude runtime lacks required msg_lifecycle_v1 capability; refusing heuristic input coverage");
67452
+ }
67453
+ return;
67454
+ }
67455
+ } finally {
67456
+ clearTimeout(timer);
67457
+ if (this.capabilityProbeHandle === handle) {
67458
+ this.capabilityProbeHandle = void 0;
67459
+ }
67460
+ this.host.terminateHandle(handle);
67461
+ }
67462
+ }
67463
+ };
67464
+
67465
+ // ts/claude-agent/dist/input-lifecycle.js
67466
+ import { randomUUID as randomUUID8 } from "node:crypto";
67467
+
67468
+ // ts/claude-agent/dist/turn-outcome.js
67469
+ var LIMIT_TEXT = /you'?ve (hit|reached) your .*limit|usage limit reached|weekly limit/i;
67470
+ var AUTH_TEXT = /not logged in|please run \/login|authentication_error|authentication_failed|failed to authenticate|invalid api key|oauth (token|session) (has )?expired|\[action required\]/i;
67471
+ var CONTEXT_TEXT = /prompt is too long|context (window|length) exceeded|request too large/i;
67472
+ var RATE_LIMIT_ERROR_TEXT = /rate_limit_error/i;
67473
+ var QUOTA_TEXT = /credit balance is too low|insufficient credits|insufficient_quota|payment required/i;
67474
+ var DETAIL_MAX = 500;
67475
+ function minutesOfDayInZone(fmt, at) {
67476
+ const parts = Object.fromEntries(fmt.formatToParts(at).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
67477
+ const hour = parts.hour === 24 ? 0 : parts.hour;
67478
+ return hour * 60 + parts.minute;
67479
+ }
67480
+ function parseClaudeResetTime(text, now) {
67481
+ const m = /resets\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\s*\(([^)]+)\)/i.exec(text);
67482
+ if (!m)
67483
+ return void 0;
67484
+ let hour = Number(m[1]);
67485
+ const minute = m[2] ? Number(m[2]) : 0;
67486
+ const meridiem = m[3]?.toLowerCase();
67487
+ const timeZone = m[4].trim();
67488
+ if (!Number.isFinite(hour) || hour > 23 || minute > 59)
67489
+ return void 0;
67490
+ if (meridiem === "pm" && hour < 12)
67491
+ hour += 12;
67492
+ if (meridiem === "am" && hour === 12)
67493
+ hour = 0;
67494
+ let fmt;
67495
+ let nowMinutesOfDay;
67496
+ try {
67497
+ fmt = new Intl.DateTimeFormat("en-US", {
67498
+ timeZone,
67499
+ hour12: false,
67500
+ hour: "2-digit",
67501
+ minute: "2-digit"
67502
+ });
67503
+ nowMinutesOfDay = minutesOfDayInZone(fmt, now);
67504
+ } catch {
67505
+ return void 0;
67506
+ }
67507
+ const targetMinutesOfDay = hour * 60 + minute;
67508
+ let deltaMinutes = targetMinutesOfDay - nowMinutesOfDay;
67509
+ if (deltaMinutes <= 0)
67510
+ deltaMinutes += 24 * 60;
67511
+ const anchored = now.getTime() - (now.getSeconds() * 1e3 + now.getMilliseconds());
67512
+ let target = anchored + deltaMinutes * 6e4;
67513
+ for (let i = 0; i < 2; i++) {
67514
+ let diff = targetMinutesOfDay - minutesOfDayInZone(fmt, new Date(target));
67515
+ if (diff > 720)
67516
+ diff -= 1440;
67517
+ if (diff < -720)
67518
+ diff += 1440;
67519
+ if (diff === 0)
67520
+ break;
67521
+ target += diff * 6e4;
67522
+ }
67523
+ if (target <= now.getTime())
67524
+ target += 24 * 60 * 6e4;
67525
+ return new Date(target).toISOString();
67526
+ }
67527
+ function usageOf(meta) {
67528
+ const usage = {};
67529
+ if (meta.inputTokens !== void 0)
67530
+ usage.inputTokens = meta.inputTokens;
67531
+ if (meta.outputTokens !== void 0)
67532
+ usage.outputTokens = meta.outputTokens;
67533
+ if (meta.cacheReadTokens !== void 0)
67534
+ usage.cacheReadTokens = meta.cacheReadTokens;
67535
+ if (meta.cacheCreationTokens !== void 0)
67536
+ usage.cacheCreationTokens = meta.cacheCreationTokens;
67537
+ if (meta.totalCostUsd !== void 0)
67538
+ usage.costUsd = meta.totalCostUsd;
67539
+ if (meta.durationMs !== void 0)
67540
+ usage.durationMs = meta.durationMs;
67541
+ if (meta.durationApiMs !== void 0)
67542
+ usage.durationApiMs = meta.durationApiMs;
67543
+ return Object.keys(usage).length > 0 ? usage : void 0;
67544
+ }
67545
+ function classifyClaudeTurn(meta, noticeTexts, now = /* @__PURE__ */ new Date()) {
67546
+ if (!meta) {
67547
+ return { type: "turn_outcome", outcome: "runtime_crash" };
67548
+ }
67549
+ const usage = usageOf(meta);
67550
+ const evidence = [meta.resultText, ...noticeTexts].filter(Boolean).join("\n");
67551
+ const base = {
67552
+ type: "turn_outcome",
67553
+ ...usage ? { usage } : {},
67554
+ ...meta.model ? { model: meta.model } : {},
67555
+ raw: {
67556
+ ...meta.subtype ? { subtype: meta.subtype } : {},
67557
+ ...meta.terminalReason ? { terminal_reason: meta.terminalReason } : {},
67558
+ ...meta.apiErrorStatus !== void 0 ? { api_error_status: meta.apiErrorStatus } : {},
67559
+ ...meta.stopReason ? { stop_reason: meta.stopReason } : {}
67560
+ }
67561
+ };
67562
+ const withDetail = (outcome, retryAt) => ({
67563
+ ...base,
67564
+ outcome,
67565
+ ...evidence ? { detail: evidence.slice(0, DETAIL_MAX) } : {},
67566
+ ...retryAt ? { retryAt } : {}
67567
+ });
67568
+ if (meta.apiErrorStatus === 401 || meta.apiErrorStatus === 403)
67569
+ return withDetail("auth");
67570
+ if (meta.apiErrorStatus === 402)
67571
+ return withDetail("quota_exhausted");
67572
+ if (meta.apiErrorStatus === 413)
67573
+ return withDetail("context_overflow");
67574
+ if (meta.apiErrorStatus === 429) {
67575
+ if (QUOTA_TEXT.test(evidence))
67576
+ return withDetail("quota_exhausted");
67577
+ if (RATE_LIMIT_ERROR_TEXT.test(evidence))
67578
+ return withDetail("transient");
67579
+ return withDetail("usage_limit", evidence ? parseClaudeResetTime(evidence, now) : void 0);
67580
+ }
67581
+ const failed = meta.isError || // Claude CLI 2.1.220 sets terminal_reason=completed on clean result
67582
+ // frames. Any other terminal reason stays fail-closed.
67583
+ meta.terminalReason !== void 0 && meta.terminalReason !== "completed" || meta.subtype !== void 0 && meta.subtype !== "success";
67584
+ const syntheticQuiet = !failed && // A "successful" turn that never touched the API and produced no tool
67585
+ // activity is the synthetic-notice shape (limit/auth text emitted
67586
+ // locally by the CLI): zero usage + stop_sequence.
67587
+ meta.stopReason === "stop_sequence" && (meta.inputTokens ?? 0) === 0 && (meta.outputTokens ?? 0) === 0 && (meta.durationApiMs ?? 0) === 0;
67588
+ if (failed || syntheticQuiet || noticeTexts.length > 0) {
67589
+ if (CONTEXT_TEXT.test(evidence))
67590
+ return withDetail("context_overflow");
67591
+ if (QUOTA_TEXT.test(evidence))
67592
+ return withDetail("quota_exhausted");
67593
+ if (LIMIT_TEXT.test(evidence)) {
67594
+ return withDetail("usage_limit", parseClaudeResetTime(evidence, now));
67595
+ }
67596
+ if (AUTH_TEXT.test(evidence))
67597
+ return withDetail("auth");
67598
+ return withDetail("transient");
67599
+ }
67600
+ return { ...base, outcome: "ok" };
67601
+ }
67602
+
67603
+ // ts/agent-core/dist/internal/async-queue.js
67604
+ var AsyncQueue = class {
67605
+ opts;
67606
+ items = [];
67607
+ waiter = null;
67608
+ closed = false;
67609
+ droppedCount = 0;
67610
+ constructor(opts = {}) {
67611
+ this.opts = opts;
67612
+ }
67613
+ /** True once close() ran — parked items may still drain via next(). */
67614
+ get isClosed() {
67615
+ return this.closed;
67616
+ }
67617
+ /** Parked items not yet consumed. */
67618
+ get size() {
67619
+ return this.items.length;
67620
+ }
67621
+ /** Items dropped past the parked cap (diagnostics). */
67622
+ get dropped() {
67623
+ return this.droppedCount;
67624
+ }
67625
+ /** Returns false when the queue is closed (item discarded). */
67626
+ push(item) {
67627
+ if (this.closed)
67628
+ return false;
67629
+ if (this.waiter) {
67630
+ const resolve3 = this.waiter;
67631
+ this.waiter = null;
67632
+ resolve3({ value: item, done: false });
67633
+ return true;
67634
+ }
67635
+ const cap = Math.max(1, this.opts.maxParked ?? 5e3);
67636
+ if (this.items.length >= cap) {
67637
+ this.items.shift();
67638
+ if (this.droppedCount === 0)
67639
+ this.opts.onFirstDrop?.();
67640
+ this.droppedCount += 1;
67641
+ }
67642
+ this.items.push(item);
67643
+ return true;
67644
+ }
67645
+ next() {
67646
+ if (this.items.length > 0) {
67647
+ return Promise.resolve({ value: this.items.shift(), done: false });
67648
+ }
67649
+ if (this.closed) {
67650
+ return Promise.resolve({ value: void 0, done: true });
67651
+ }
67652
+ return new Promise((resolve3) => {
67653
+ this.waiter = resolve3;
67654
+ });
67655
+ }
67656
+ close() {
67657
+ if (this.closed)
67658
+ return;
67659
+ this.closed = true;
67660
+ const waiter = this.waiter;
67661
+ this.waiter = null;
67662
+ waiter?.({ value: void 0, done: true });
67663
+ }
67664
+ };
67665
+
67666
+ // ts/claude-agent/dist/turn-sink.js
67667
+ function newTurnEvidence() {
67668
+ return { noticeTexts: [], sawError: false };
67669
+ }
67670
+ function newTurnSink(label, log2) {
67671
+ return new AsyncQueue({
67672
+ onFirstDrop: () => log2?.warn?.(`Claude turn sink ${label} exceeded its parked-frame cap; dropping oldest`)
67673
+ });
67674
+ }
67675
+
67676
+ // ts/claude-agent/dist/input-lifecycle.js
67677
+ var ClaudeInputRegistry = class {
67678
+ byKey = /* @__PURE__ */ new Map();
67679
+ byCommand = /* @__PURE__ */ new Map();
67680
+ getByKey(deliveryKey) {
67681
+ return this.byKey.get(deliveryKey);
67682
+ }
67683
+ getByCommand(commandUuid) {
67684
+ return this.byCommand.get(commandUuid);
67685
+ }
67686
+ findOverlapping(dispatchEventIds) {
67687
+ const ids = new Set(dispatchEventIds);
67688
+ for (const delivery of this.byKey.values()) {
67689
+ if (delivery.lifecycle?.dispatchEventIds.some((id) => ids.has(id))) {
67690
+ return delivery;
67691
+ }
67692
+ }
67693
+ return void 0;
67694
+ }
67695
+ values() {
67696
+ return this.byKey.values();
67697
+ }
67698
+ hasPendingInjections() {
67699
+ return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.drained);
67700
+ }
67701
+ /**
67702
+ * Injected inputs whose lifecycle has NOT reached a terminal state. A
67703
+ * terminal delivery still counts as pending (its buffered copy owes frame
67704
+ * boundary bookkeeping) but owes the server nothing — the lane complete
67705
+ * defers on this predicate, never on hasPendingInjections, so a bookkeeping
67706
+ * copy that never drains cannot hold the lane open past its lease. Drained
67707
+ * is deliberately NOT part of this predicate: a discarded bookkeeping copy
67708
+ * (drained, non-terminal) is still a running input — completing its lane
67709
+ * would release the member for redrive mid-processing.
67710
+ */
67711
+ hasUnsettledInjections() {
67712
+ return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.terminal);
67713
+ }
67714
+ register(deliveryKey, lifecycle, injected, noteActivity, log2) {
67715
+ if (this.byKey.has(deliveryKey)) {
67716
+ throw new Error(`duplicate Claude delivery key ${deliveryKey}`);
67717
+ }
67718
+ const commandUuid = randomUUID8();
67719
+ const delivery = {
67720
+ deliveryKey,
67721
+ commandUuid,
67722
+ lifecycle,
67723
+ injected,
67724
+ drained: !injected,
67725
+ resultFailed: false,
67726
+ sink: newTurnSink(`delivery ${deliveryKey}`, log2),
67727
+ evidence: newTurnEvidence(),
67728
+ noteActivity,
67729
+ sessionAnnounced: false
67730
+ };
67731
+ this.byKey.set(deliveryKey, delivery);
67732
+ this.byCommand.set(delivery.commandUuid, delivery);
67733
+ return delivery;
67734
+ }
67735
+ /** Undefined while an input under the same key is still registered. */
67736
+ registerLocal(input, log2) {
67737
+ const deliveryKey = `local:${input.localKey}`;
67738
+ if (this.byKey.has(deliveryKey))
67739
+ return void 0;
67740
+ const delivery = this.register(deliveryKey, void 0, false, void 0, log2);
67741
+ const settlement = new LocalInputSettlement(input, log2);
67742
+ delivery.local = { label: input.label, settlement, surfaced: false };
67743
+ return delivery;
67744
+ }
67745
+ /** A local input not yet terminal: the CLI has (or will start) work no dispatch drains. */
67746
+ hasOpenLocalInput() {
67747
+ return [...this.byKey.values()].some((delivery) => delivery.local && !delivery.terminal);
67748
+ }
67749
+ remove(delivery) {
67750
+ if (this.byKey.get(delivery.deliveryKey) === delivery) {
67751
+ this.byKey.delete(delivery.deliveryKey);
67752
+ }
67753
+ if (this.byCommand.get(delivery.commandUuid) === delivery) {
67754
+ this.byCommand.delete(delivery.commandUuid);
67755
+ }
67756
+ }
67757
+ /**
67758
+ * The buffered copy backing this delivery was discarded without a
67759
+ * dispatch (already rendered into a frame the model saw), so the normal
67760
+ * bookkeeping drain never comes. Its frame-boundary obligation is void:
67761
+ * mark it drained so nothing waits on it, and drop it once terminal. A
67762
+ * still-running input keeps its registration — byCommand must keep routing
67763
+ * its lifecycle frames — and is dropped when its terminal state arrives
67764
+ * (see apply/fail).
67765
+ */
67766
+ discardBookkeeping(deliveryKey) {
67767
+ const delivery = this.byKey.get(deliveryKey);
67768
+ if (!delivery)
67769
+ return;
67770
+ delivery.drained = true;
67771
+ if (delivery.terminal)
67772
+ this.remove(delivery);
67773
+ }
67774
+ async apply(delivery, state) {
67775
+ if (delivery.terminal || state === "queued")
67776
+ return;
67777
+ if (state !== "cancelled" && state !== "discarded") {
67778
+ delivery.local?.settlement.settle("delivered");
67779
+ }
67780
+ if (state === "started") {
67781
+ if (delivery.reportedState)
67782
+ return;
67783
+ await delivery.lifecycle?.update("started");
67784
+ delivery.reportedState = "started";
67785
+ return;
67786
+ }
67787
+ if (state === "cancelled" || state === "discarded" || delivery.resultFailed) {
67788
+ await this.fail(delivery);
67789
+ return;
67790
+ }
67791
+ if (delivery.reportedState !== "completed") {
67792
+ await delivery.lifecycle?.update("completed");
67793
+ delivery.reportedState = "completed";
67794
+ }
67795
+ delivery.terminal = "completed";
67796
+ if (delivery.drained)
67797
+ this.remove(delivery);
67798
+ }
67799
+ async fail(delivery, detail) {
67800
+ if (delivery.terminal)
67801
+ return;
67802
+ delivery.local?.settlement.settle("not_delivered");
67803
+ if (delivery.suppressFailReport) {
67804
+ delivery.terminal = "settled";
67805
+ if (delivery.drained)
67806
+ this.remove(delivery);
67807
+ return;
67808
+ }
67809
+ try {
67810
+ if (delivery.reportedState !== "failed") {
67811
+ const classified = classifyClaudeTurn(delivery.evidence.lastResultMeta, delivery.evidence.noticeTexts);
67812
+ const result = await delivery.lifecycle?.update("failed", {
67813
+ outcomeClass: classified.outcome === "ok" || classified.outcome === "usage_limit" ? "runtime_crash" : classified.outcome,
67814
+ detail: detail ?? classified.detail ?? "Claude input failed"
67815
+ });
67816
+ delivery.reportedState = "failed";
67817
+ delivery.terminal = result && !result.pending && result.retry === false ? "settled" : "failed";
67818
+ }
67819
+ } finally {
67820
+ delivery.terminal ??= "failed";
67821
+ if (delivery.drained)
67822
+ this.remove(delivery);
67823
+ }
67824
+ }
67825
+ async failBestEffort(delivery, log2, detail) {
67826
+ try {
67827
+ await this.fail(delivery, detail);
67828
+ } catch (err) {
67829
+ log2?.warn?.(`failed to report Claude input ${delivery.commandUuid} as failed: ${String(err)}`);
67830
+ }
67831
+ }
67832
+ async failAllBestEffort(log2, detail) {
67833
+ await Promise.all([...this.byKey.values()].filter((delivery) => !delivery.terminal).map((delivery) => this.failBestEffort(delivery, log2, detail)));
67834
+ }
67835
+ };
67836
+
67492
67837
  // ts/claude-agent/dist/child-turn.js
67493
67838
  var ClaudeChildTurn = class extends RuntimeTurnBase {
67494
67839
  announce;
@@ -67875,7 +68220,7 @@ var ClaudeProcessPump = class {
67875
68220
  * A local input may join only a turn executing now (a started dispatch or
67876
68221
  * steer delivery, or an open runtime-initiated turn), and never while any
67877
68222
  * input waits to start: queued inputs start together as one turn that
67878
- * answers only the last (probes/queue-steer-2.1.292.md S3).
68223
+ * answers only the last (probes/queue-steer-2.1.318.md S3).
67879
68224
  */
67880
68225
  acceptsLocalInput() {
67881
68226
  let executing = this.runtimeTurn !== null;
@@ -67910,7 +68255,7 @@ var ClaudeProcessPump = class {
67910
68255
  /**
67911
68256
  * Dispatch abort: fail every live delivery and release its drain. Local
67912
68257
  * inputs are left alone: the CLI still runs a queued one, even after stdin
67913
- * closes (probes/queue-steer-2.1.292.md S5), so failing it here would
68258
+ * closes (probes/queue-steer-2.1.318.md S5), so failing it here would
67914
68259
  * report it undelivered and hand it out a second time.
67915
68260
  */
67916
68261
  abortDeliveries(message) {
@@ -68309,7 +68654,7 @@ function ownsFrames(delivery) {
68309
68654
  // ts/claude-agent/dist/session-manager.js
68310
68655
  import * as fs9 from "node:fs";
68311
68656
  import * as path11 from "node:path";
68312
- import { randomUUID as randomUUID8 } from "node:crypto";
68657
+ import { randomUUID as randomUUID9 } from "node:crypto";
68313
68658
  var ClaudeSessionManager = class _ClaudeSessionManager {
68314
68659
  mainSessionKey;
68315
68660
  stateFilePath;
@@ -68351,7 +68696,7 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
68351
68696
  const parentSessionId = this.sessionIds.get(parentSessionKey);
68352
68697
  if (!parentSessionId)
68353
68698
  return null;
68354
- const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${randomUUID8()}`;
68699
+ const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${randomUUID9()}`;
68355
68700
  this.pendingForkParents.set(sessionKey, parentSessionId);
68356
68701
  return {
68357
68702
  sessionKey,
@@ -68490,7 +68835,36 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
68490
68835
  };
68491
68836
 
68492
68837
  // ts/claude-agent/dist/spawn-env.js
68838
+ import * as fs10 from "node:fs";
68839
+ import * as os4 from "node:os";
68493
68840
  import * as path12 from "node:path";
68841
+ function setAsideCorruptClaudeConfig(env, log2) {
68842
+ const file = path12.join(env.CLAUDE_CONFIG_DIR || env.HOME || os4.homedir(), ".claude.json");
68843
+ let text;
68844
+ try {
68845
+ text = fs10.readFileSync(file, "utf8");
68846
+ } catch {
68847
+ return;
68848
+ }
68849
+ if (/^[\s\0]*$/.test(text))
68850
+ return;
68851
+ try {
68852
+ JSON.parse(text.replace(/^/, ""));
68853
+ return;
68854
+ } catch (err) {
68855
+ const aside = `${file}.corrupt-${Date.now()}`;
68856
+ try {
68857
+ if (fs10.lstatSync(file).isSymbolicLink()) {
68858
+ log2?.warn(`${file} is not valid JSON (${String(err)}); it links to another file, left in place`);
68859
+ return;
68860
+ }
68861
+ fs10.renameSync(file, aside);
68862
+ log2?.warn(`${file} is not valid JSON (${String(err)}); moved it to ${aside}`);
68863
+ } catch (moveErr) {
68864
+ log2?.warn(`${file} is not valid JSON and could not be moved aside: ${String(moveErr)}`);
68865
+ }
68866
+ }
68867
+ }
68494
68868
  function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
68495
68869
  const env = { ...parentEnv };
68496
68870
  if (!opts.allowApiKey) {
@@ -68541,37 +68915,8 @@ function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
68541
68915
  return result;
68542
68916
  }
68543
68917
 
68544
- // ts/claude-agent/dist/stdin-frames.js
68545
- import { randomUUID as randomUUID9 } from "node:crypto";
68546
- function writeCapabilityProbe(handle) {
68547
- const payload = JSON.stringify({
68548
- type: "user",
68549
- uuid: randomUUID9(),
68550
- parent_tool_use_id: null,
68551
- message: { role: "user", content: [] }
68552
- });
68553
- handle.proc.stdin.write(`${payload}
68554
- `);
68555
- }
68556
- function writeUserMessage(handle, text, commandUuid) {
68557
- const payload = JSON.stringify({
68558
- type: "user",
68559
- uuid: commandUuid,
68560
- parent_tool_use_id: null,
68561
- message: {
68562
- role: "user",
68563
- content: [{ type: "text", text }]
68564
- }
68565
- });
68566
- handle.proc.stdin.write(`${payload}
68567
- `);
68568
- }
68569
-
68570
68918
  // ts/claude-agent/dist/dispatch.js
68571
68919
  var IS_WIN32 = process.platform === "win32";
68572
- var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
68573
- var MissingClaudeLifecycleCapabilityError = class extends Error {
68574
- };
68575
68920
  function quoteWin32Arg(arg) {
68576
68921
  if (!/[\s"&|^<>()]/.test(arg))
68577
68922
  return arg;
@@ -68599,8 +68944,10 @@ var ClaudeCodeAdapter = class {
68599
68944
  processes = /* @__PURE__ */ new Map();
68600
68945
  /** Retired by abortDispatch while the CLI still had its own work: busy until idle, then terminated. */
68601
68946
  retiring = /* @__PURE__ */ new Set();
68602
- capabilityProbe;
68603
- capabilityProbeHandle;
68947
+ capabilityProbe = new ClaudeCapabilityProbe({
68948
+ spawnProbe: (log2) => this.spawnProcess("__capability_probe__", log2, false),
68949
+ terminateHandle: (handle) => this.terminateHandle(handle)
68950
+ });
68604
68951
  shuttingDown = false;
68605
68952
  activity;
68606
68953
  _model;
@@ -68820,7 +69167,7 @@ var ClaudeCodeAdapter = class {
68820
69167
  return void 0;
68821
69168
  const projectSlug = this.opts.workspaceDir.replace(/[/.]/g, "-");
68822
69169
  const filePath = path13.join(this.opts.claudeHome, ".claude", "projects", projectSlug, `${sessionId}.jsonl`);
68823
- return fs10.existsSync(filePath) ? filePath : void 0;
69170
+ return fs11.existsSync(filePath) ? filePath : void 0;
68824
69171
  }
68825
69172
  forkSession({ sessionKey }) {
68826
69173
  return this.opts.sessionManager.createForkSession(sessionKey);
@@ -68846,10 +69193,7 @@ var ClaudeCodeAdapter = class {
68846
69193
  }
68847
69194
  async shutdown() {
68848
69195
  this.shuttingDown = true;
68849
- if (this.capabilityProbeHandle) {
68850
- this.terminateHandle(this.capabilityProbeHandle);
68851
- this.capabilityProbeHandle = void 0;
68852
- }
69196
+ this.capabilityProbe.terminate();
68853
69197
  this.resetProcesses();
68854
69198
  await this.opts.sessionManager.shutdownAll();
68855
69199
  }
@@ -68859,7 +69203,7 @@ var ClaudeCodeAdapter = class {
68859
69203
  async *runTurn(sessionKey, promptBody, deliveryKey, lifecycle, log2, noteActivity) {
68860
69204
  let state;
68861
69205
  try {
68862
- await this.ensureRuntimeCapability(log2);
69206
+ await this.capabilityProbe.ensureRuntimeCapability(log2);
68863
69207
  state = this.ensureProcess(sessionKey, log2);
68864
69208
  } catch (err) {
68865
69209
  try {
@@ -68892,7 +69236,7 @@ var ClaudeCodeAdapter = class {
68892
69236
  /** Idle auto-compact (compact.ts): a `/compact` frame into the long-lived process. */
68893
69237
  compact(opts) {
68894
69238
  return runClaudeCompact({
68895
- ensureRuntimeCapability: (log2) => this.ensureRuntimeCapability(log2),
69239
+ ensureRuntimeCapability: (log2) => this.capabilityProbe.ensureRuntimeCapability(log2),
68896
69240
  ensureProcess: (sessionKey, log2) => this.ensureProcess(sessionKey, log2),
68897
69241
  killProcess: (sessionKey, state) => {
68898
69242
  void this.killProcess(sessionKey, state);
@@ -68901,60 +69245,6 @@ var ClaudeCodeAdapter = class {
68901
69245
  applyPendingRestart: (sessionKey, state) => this.maybeApplyRestart(sessionKey, state)
68902
69246
  }, opts);
68903
69247
  }
68904
- ensureRuntimeCapability(log2) {
68905
- if (!this.capabilityProbe) {
68906
- const probe = this.probeRuntimeCapability(log2);
68907
- this.capabilityProbe = probe.catch((err) => {
68908
- if (!(err instanceof MissingClaudeLifecycleCapabilityError)) {
68909
- this.capabilityProbe = void 0;
68910
- }
68911
- throw err;
68912
- });
68913
- }
68914
- return this.capabilityProbe;
68915
- }
68916
- /**
68917
- * Claude does not emit system.init until it receives its first stdin
68918
- * command (2.1.220 emits queued/started before init). Probe a throwaway
68919
- * process with an empty, non-WorkItem command; only after its init
68920
- * advertises msg_lifecycle_v1 may any business input enter a real process.
68921
- */
68922
- async probeRuntimeCapability(log2) {
68923
- const handle = this.spawnProcess("__capability_probe__", log2, false);
68924
- this.capabilityProbeHandle = handle;
68925
- const parser = parseClaudeStreamJson(handle.proc.stdout);
68926
- let timedOut = false;
68927
- const timer = setTimeout(() => {
68928
- timedOut = true;
68929
- this.terminateHandle(handle);
68930
- }, CAPABILITY_PROBE_TIMEOUT_MS);
68931
- timer.unref?.();
68932
- try {
68933
- writeCapabilityProbe(handle);
68934
- while (true) {
68935
- const next = await parser.next();
68936
- if (next.done) {
68937
- const detail = handle.stderrChunks.join("").trim();
68938
- if (timedOut) {
68939
- throw new Error(`Claude runtime capability probe timed out after ${CAPABILITY_PROBE_TIMEOUT_MS}ms`);
68940
- }
68941
- throw new Error(detail || "Claude exited before its runtime capability probe completed");
68942
- }
68943
- if (next.value.type !== "runtime_init")
68944
- continue;
68945
- if (!next.value.capabilities.includes("msg_lifecycle_v1")) {
68946
- throw new MissingClaudeLifecycleCapabilityError("Claude runtime lacks required msg_lifecycle_v1 capability; refusing heuristic input coverage");
68947
- }
68948
- return;
68949
- }
68950
- } finally {
68951
- clearTimeout(timer);
68952
- if (this.capabilityProbeHandle === handle) {
68953
- this.capabilityProbeHandle = void 0;
68954
- }
68955
- this.terminateHandle(handle);
68956
- }
68957
- }
68958
69248
  /**
68959
69249
  * Drain the envelopes the pump routed to `target` until its exact stdin
68960
69250
  * UUID reaches a terminal lifecycle state. Other injected inputs may start
@@ -69099,6 +69389,7 @@ var ClaudeCodeAdapter = class {
69099
69389
  capabilityBinDir: this.opts.capabilityBinDir,
69100
69390
  commandEnvFile: this.opts.commandEnvFile
69101
69391
  });
69392
+ setAsideCorruptClaudeConfig(env, log2);
69102
69393
  log2?.info(`spawn long-lived ${this.opts.claudeBin} (session ${sessionKey}, model=${this._model || "default"}, context=${this._contextWindow || "cli-default"}, maxOut=${this._maxTokens || "cli-default"}, effort=${this._effortLevel || "default"}, mode=${this.opts.permissionMode})`);
69103
69394
  const proc = spawn(IS_WIN32 ? quoteWin32Arg(this.opts.claudeBin) : this.opts.claudeBin, IS_WIN32 ? args.map(quoteWin32Arg) : args, {
69104
69395
  cwd: this.opts.workspaceDir,
@@ -69182,6 +69473,8 @@ var ClaudeCodeAdapter = class {
69182
69473
  args.push("--disallowedTools", this.opts.disallowedTools.join(","));
69183
69474
  }
69184
69475
  args.push("--append-system-prompt-file", path13.join(this.opts.workspaceDir, ".parall", "system-prompt.md"));
69476
+ if (this.capabilityProbe.promptSnapshotOff)
69477
+ args.push("--system-prompt-snapshot", "off");
69185
69478
  if (this.opts.appendSystemPrompt) {
69186
69479
  args.push("--append-system-prompt", this.opts.appendSystemPrompt);
69187
69480
  }
@@ -69214,19 +69507,19 @@ var ClaudeCodeAdapter = class {
69214
69507
  };
69215
69508
 
69216
69509
  // ts/claude-agent/dist/workspace.js
69217
- import * as fs11 from "node:fs";
69510
+ import * as fs12 from "node:fs";
69218
69511
  import * as path14 from "node:path";
69219
69512
  function buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
69220
69513
  return buildClaudeCodePlatformInstructions(workspaceDir, agentIdentity, capabilityFragments);
69221
69514
  }
69222
69515
  function writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
69223
69516
  const parallDir = path14.join(workspaceDir, ".parall");
69224
- fs11.mkdirSync(parallDir, { recursive: true });
69225
- fs11.writeFileSync(path14.join(parallDir, "system-prompt.md"), buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments), "utf8");
69517
+ fs12.mkdirSync(parallDir, { recursive: true });
69518
+ fs12.writeFileSync(path14.join(parallDir, "system-prompt.md"), buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments), "utf8");
69226
69519
  }
69227
69520
  function ensureClaudeWorkspace(workspaceDir, _log, agentIdentity, capabilityFragments) {
69228
- fs11.mkdirSync(workspaceDir, { recursive: true });
69229
- fs11.mkdirSync(path14.join(workspaceDir, ".claude"), { recursive: true });
69521
+ fs12.mkdirSync(workspaceDir, { recursive: true });
69522
+ fs12.mkdirSync(path14.join(workspaceDir, ".claude"), { recursive: true });
69230
69523
  writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments);
69231
69524
  writeSkillFiles(path14.join(workspaceDir, ".parall", "skills"));
69232
69525
  ensureLocalAttachmentGitExclude(workspaceDir);
@@ -69440,7 +69733,7 @@ async function main() {
69440
69733
  runtimeFeatures: secrets ? ["agent_secrets"] : [],
69441
69734
  runtimeKey,
69442
69735
  runtimeRef: {
69443
- hostname: os4.hostname(),
69736
+ hostname: os5.hostname(),
69444
69737
  pid: process.pid,
69445
69738
  workspace_dir: config.workspaceDir,
69446
69739
  claude_home: config.claudeHome