@parall/daemon 1.87.0 → 1.89.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`,
@@ -52212,6 +52220,7 @@ function teamInviteEndpoints(apiBase) {
52212
52220
  TEAM_INVITE_TEAMS: (token) => `${apiBase}/team-invites/${seg(token)}/teams`,
52213
52221
  TEAM_INVITE_REQUESTS: (token) => `${apiBase}/team-invites/${seg(token)}/requests`,
52214
52222
  TEAM_INVITE_REQUEST_MINE: (token) => `${apiBase}/team-invites/${seg(token)}/requests/mine`,
52223
+ TEAM_INVITE_REQUEST_INTAKE: (token, requestId) => `${apiBase}/team-invites/${seg(token)}/requests/${seg(requestId)}/intake`,
52215
52224
  TEAM_INVITE_REQUEST_CANCEL: (requestId) => `${apiBase}/team-invite-requests/${seg(requestId)}/cancel`,
52216
52225
  TEAM_INVITE_REQUEST_RETRY: (requestId) => `${apiBase}/team-invite-requests/${seg(requestId)}/retry`
52217
52226
  };
@@ -52269,6 +52278,30 @@ function teamEndpoints(apiBase) {
52269
52278
  };
52270
52279
  }
52271
52280
 
52281
+ // ts/sdk/dist/secret-endpoints.js
52282
+ function secretEndpoints(apiBase) {
52283
+ return {
52284
+ AGENT_SECRETS: (orgId, agentId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets`,
52285
+ AGENT_SECRET: (orgId, agentId, secretId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets/${secretId}`,
52286
+ ORG_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/secrets`,
52287
+ ORG_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}`,
52288
+ /** The caller's own secrets (login session only, like the rest up to the runtime's). */
52289
+ ORG_MY_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/me/secrets`,
52290
+ ORG_MY_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}`,
52291
+ ORG_MY_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}/grants/${agentId}`,
52292
+ TEAM_SECRETS: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets`,
52293
+ TEAM_SECRET: (orgId, teamId, secretId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}`,
52294
+ TEAM_SECRET_GRANT: (orgId, teamId, secretId, agentId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}/grants/${agentId}`,
52295
+ /** `agentId` holds `ownerAgentId`'s own secret. */
52296
+ AGENT_SECRET_GRANT: (orgId, ownerAgentId, secretId, agentId) => `${apiBase}/orgs/${orgId}/agents/${ownerAgentId}/secrets/${secretId}/grants/${agentId}`,
52297
+ ORG_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}/grants/${agentId}`,
52298
+ /** The runtime's own routes, with the agent's key. */
52299
+ AGENT_ME_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets`,
52300
+ AGENT_ME_SECRETS_CATALOG: (orgId, q) => `${apiBase}/orgs/${orgId}/agents/me/secrets/catalog${q ? `?q=${encodeURIComponent(q)}` : ""}`,
52301
+ AGENT_ME_SECRETS_APPLIED: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets/applied`
52302
+ };
52303
+ }
52304
+
52272
52305
  // ts/sdk/dist/constants.js
52273
52306
  var API_BASE2 = "/api/v1";
52274
52307
  var WIKI_BASE = "/wiki/v1";
@@ -52352,6 +52385,8 @@ var ENDPOINTS = {
52352
52385
  CHAT_RESTORE: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/restore`,
52353
52386
  CHAT_MEMBERS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members`,
52354
52387
  CHAT_MEMBER: (orgId, chatId, userId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members/${userId}`,
52388
+ CHAT_BOOKMARKS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks`,
52389
+ CHAT_BOOKMARK: (orgId, chatId, bookmarkId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks/${bookmarkId}`,
52355
52390
  CHAT_INVITATIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations`,
52356
52391
  CHAT_INVITATION: (orgId, chatId, invId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations/${invId}`,
52357
52392
  CHAT_CONNECTIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/connections`,
@@ -52394,14 +52429,7 @@ var ENDPOINTS = {
52394
52429
  AGENT_ME: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me`,
52395
52430
  AGENT_REPLY_POLICY_CAPABILITY: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/reply-policy-capability`,
52396
52431
  AGENT_RUNTIME_REPORT: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/runtime-report`,
52397
- // Agent secrets (agent-secrets-design.md): management, then the runtime's own two routes.
52398
- AGENT_SECRETS: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/secrets`,
52399
- AGENT_SECRET: (orgId, agentId, secretId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/secrets/${secretId}`,
52400
- ORG_SECRETS: (orgId) => `${API_BASE2}/orgs/${orgId}/secrets`,
52401
- ORG_SECRET: (orgId, secretId) => `${API_BASE2}/orgs/${orgId}/secrets/${secretId}`,
52402
- AGENT_ME_SECRETS: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets`,
52403
- AGENT_ME_SECRETS_CATALOG: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets/catalog`,
52404
- AGENT_ME_SECRETS_APPLIED: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/secrets/applied`,
52432
+ ...secretEndpoints(API_BASE2),
52405
52433
  AGENT_NEW_SESSION: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/new-session`,
52406
52434
  AGENT_DEEP_RESET: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/deep-reset`,
52407
52435
  AGENT_SESSIONS: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/sessions`,
@@ -52859,6 +52887,7 @@ var WS_EVENTS = {
52859
52887
  TYPING_UPDATE: "typing.update",
52860
52888
  CHAT_UPDATE: "chat.update",
52861
52889
  CHAT_DELETED: "chat.deleted",
52890
+ CHAT_BOOKMARKS_UPDATED: "chat.bookmarks.updated",
52862
52891
  APPROVAL_UPDATE: "approval.update",
52863
52892
  // deprecated
52864
52893
  CARD_UPDATE: "card.update",
@@ -53691,6 +53720,23 @@ var ClipConnectionClient = class extends ChannelConversationClient {
53691
53720
  return this.request("PUT", ENDPOINTS.ORG_CLIP_MCP_CONFIG_BY_ID(orgId, clipId, configId), req, void 0, false, { headers: { "If-Match": `"${expectedVersion}"` }, timeoutMs: 4e4 });
53692
53721
  }
53693
53722
  // ---- Clip connections ----
53723
+ /** Missing keys are unknown/hidden; present empty arrays are known empty. */
53724
+ async listClipMCPSummaries(orgId, clipIds) {
53725
+ return this.readDiscoverySummaries(ENDPOINTS.CLIP_MCP_SUMMARIES(orgId), "clip_ids", clipIds);
53726
+ }
53727
+ async listEdgeProfileSummaries(orgId, edgeIds) {
53728
+ return this.readDiscoverySummaries(ENDPOINTS.EDGE_PROFILE_SUMMARIES(orgId), "edge_ids", edgeIds);
53729
+ }
53730
+ async readDiscoverySummaries(endpoint, key, ids) {
53731
+ const data = {};
53732
+ const unique = [...new Set(ids)];
53733
+ for (let offset = 0; offset < unique.length; offset += 500) {
53734
+ const batch = unique.slice(offset, offset + 500);
53735
+ const response = await this.request("GET", `${endpoint}?${key}=${encodeURIComponent(batch.join(","))}`);
53736
+ Object.assign(data, response.data);
53737
+ }
53738
+ return { data };
53739
+ }
53694
53740
  async listClipConnections(orgId, clipId) {
53695
53741
  return this.request("GET", ENDPOINTS.CLIP_CONNECTIONS(orgId, clipId));
53696
53742
  }
@@ -53725,10 +53771,42 @@ var ClipConnectionClient = class extends ChannelConversationClient {
53725
53771
  async cancelClipMCPOAuthAttempt(orgId, clipId, attemptId) {
53726
53772
  return this.request("DELETE", ENDPOINTS.ORG_CLIP_MCP_OAUTH_ATTEMPT(orgId, clipId, attemptId));
53727
53773
  }
53774
+ // ---- The caller's own connections (login session only) ----
53775
+ /** The caller's person-owned connections, optionally for one connector. */
53776
+ async listMyConnections(orgId, clipId) {
53777
+ return this.request("GET", ENDPOINTS.ORG_MY_CONNECTIONS(orgId), void 0, clipId ? { clip_id: clipId } : void 0);
53778
+ }
53779
+ /** Stop one agent from using one of the caller's connections. */
53780
+ async revokeMyConnectionAgent(orgId, connId, agentId) {
53781
+ return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION_AGENT(orgId, connId, agentId));
53782
+ }
53783
+ /** Disconnect one of the caller's connections: the connection, its credential and grants go. */
53784
+ async deleteMyConnection(orgId, connId) {
53785
+ return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION(orgId, connId));
53786
+ }
53787
+ };
53788
+
53789
+ // ts/sdk/dist/hosted-profile-creation.js
53790
+ var HostedProfileCreationClient = class extends ClipConnectionClient {
53791
+ getHostedProfileCreationAccess(orgId, agentId) {
53792
+ return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId));
53793
+ }
53794
+ changeHostedProfileCreationGrant(orgId, agentId, change, key, revoke = false) {
53795
+ return this.request(revoke ? "DELETE" : "PUT", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId), change, void 0, false, { headers: { "Idempotency-Key": key } });
53796
+ }
53797
+ getHostedProfileCreationEvents(orgId, agentId, before) {
53798
+ return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_EVENTS(orgId, agentId), void 0, {
53799
+ before
53800
+ });
53801
+ }
53802
+ /** A lost response is recovered with the same name and key, never a new key. */
53803
+ createAuthorizedHostedProfile(orgId, name, key) {
53804
+ return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), { name, placement: "hosted" }, void 0, false, { headers: { "Idempotency-Key": key } });
53805
+ }
53728
53806
  };
53729
53807
 
53730
53808
  // ts/sdk/dist/browser-profile-client.js
53731
- var BrowserProfileClient = class extends ClipConnectionClient {
53809
+ var BrowserProfileClient = class extends HostedProfileCreationClient {
53732
53810
  /** Metadata-only compatibility discovery. Management scope errors propagate;
53733
53811
  * callers with a known Profile can execute without this discovery chain. */
53734
53812
  async listBrowserUseProfiles(orgId, profileId) {
@@ -53912,7 +53990,10 @@ var UserPreferencesClient = class extends OrgAccentClient {
53912
53990
 
53913
53991
  // ts/sdk/dist/secret-client.js
53914
53992
  var AgentSecretClient = class extends UserPreferencesClient {
53915
- /** One agent's own secrets plus the org-shared ones it is given. */
53993
+ /**
53994
+ * One agent's own secrets and those it is given — the org's, a team's,
53995
+ * another user's — each as this agent holds it.
53996
+ */
53916
53997
  async getAgentSecrets(orgId, agentId) {
53917
53998
  return this.request("GET", ENDPOINTS.AGENT_SECRETS(orgId, agentId));
53918
53999
  }
@@ -53938,13 +54019,58 @@ var AgentSecretClient = class extends UserPreferencesClient {
53938
54019
  async deleteOrgSecret(orgId, secretId) {
53939
54020
  await this.request("DELETE", ENDPOINTS.ORG_SECRET(orgId, secretId));
53940
54021
  }
54022
+ /** The caller's own secrets and who each is given to. Only that person. */
54023
+ async getMySecrets(orgId) {
54024
+ return this.request("GET", ENDPOINTS.ORG_MY_SECRETS(orgId));
54025
+ }
54026
+ async createMySecret(orgId, data) {
54027
+ return this.request("POST", ENDPOINTS.ORG_MY_SECRETS(orgId), data);
54028
+ }
54029
+ async updateMySecret(orgId, secretId, data) {
54030
+ return this.request("PATCH", ENDPOINTS.ORG_MY_SECRET(orgId, secretId), data);
54031
+ }
54032
+ async deleteMySecret(orgId, secretId) {
54033
+ await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET(orgId, secretId));
54034
+ }
54035
+ /** A team's secrets and who each is given to: its human managers and org admins. */
54036
+ async getTeamSecrets(orgId, teamId) {
54037
+ return this.request("GET", ENDPOINTS.TEAM_SECRETS(orgId, teamId));
54038
+ }
54039
+ async createTeamSecret(orgId, teamId, data) {
54040
+ return this.request("POST", ENDPOINTS.TEAM_SECRETS(orgId, teamId), data);
54041
+ }
54042
+ async updateTeamSecret(orgId, teamId, secretId, data) {
54043
+ return this.request("PATCH", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId), data);
54044
+ }
54045
+ async deleteTeamSecret(orgId, teamId, secretId) {
54046
+ await this.request("DELETE", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId));
54047
+ }
54048
+ // Taking one agent off a secret, whether it holds it for long or once. A
54049
+ // grant the agent does not hold answers 404 SECRET_GRANT_NOT_FOUND.
54050
+ async revokeOrgSecretGrant(orgId, secretId, agentId) {
54051
+ await this.request("DELETE", ENDPOINTS.ORG_SECRET_GRANT(orgId, secretId, agentId));
54052
+ }
54053
+ async revokeMySecretGrant(orgId, secretId, agentId) {
54054
+ await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET_GRANT(orgId, secretId, agentId));
54055
+ }
54056
+ /** Takes `agentId` off one of `ownerAgentId`'s own secrets. */
54057
+ async revokeAgentSecretGrant(orgId, ownerAgentId, secretId, agentId) {
54058
+ await this.request("DELETE", ENDPOINTS.AGENT_SECRET_GRANT(orgId, ownerAgentId, secretId, agentId));
54059
+ }
54060
+ async revokeTeamSecretGrant(orgId, teamId, secretId, agentId) {
54061
+ await this.request("DELETE", ENDPOINTS.TEAM_SECRET_GRANT(orgId, teamId, secretId, agentId));
54062
+ }
53941
54063
  /** Agent runtime only: the values to export to the agent's commands. */
53942
54064
  async getMyAgentSecrets(orgId) {
53943
54065
  return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS(orgId));
53944
54066
  }
53945
- /** Agent only: the names it holds or may ask to use, and its pending requests. */
53946
- async getMyAgentSecretCatalog(orgId) {
53947
- return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS_CATALOG(orgId));
54067
+ /**
54068
+ * Agent only: the names it holds or may ask to use, its pending requests,
54069
+ * and the teams it may ask in. `q` keeps the keys whose name, purpose or
54070
+ * owner's name contains it, ignoring case.
54071
+ */
54072
+ async getMyAgentSecretCatalog(orgId, q) {
54073
+ return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS_CATALOG(orgId, q));
53948
54074
  }
53949
54075
  /** Agent runtime only: confirm the version the commands now run with. */
53950
54076
  async ackMyAgentSecrets(orgId, version) {
@@ -54030,8 +54156,21 @@ var AgentCallerScopeClient = class extends ChatTeamGrantClient {
54030
54156
  }
54031
54157
  };
54032
54158
 
54159
+ // ts/sdk/dist/agent-team-only-client.js
54160
+ var agentTeamOnlyPath = (orgId) => `${API_BASE2}/orgs/${orgId}/agent-team-only`;
54161
+ var AgentTeamOnlyClient = class extends AgentCallerScopeClient {
54162
+ /** The switch, and what turning it on changes. Owners and admins only. */
54163
+ async getAgentTeamOnly(orgId) {
54164
+ return this.request("GET", agentTeamOnlyPath(orgId));
54165
+ }
54166
+ /** Turn the switch on or off. Owners and admins only. */
54167
+ async setAgentTeamOnly(orgId, enabled) {
54168
+ return this.request("PUT", agentTeamOnlyPath(orgId), { enabled });
54169
+ }
54170
+ };
54171
+
54033
54172
  // ts/sdk/dist/agent-owning-team-client.js
54034
- var AgentOwningTeamClient = class extends AgentCallerScopeClient {
54173
+ var AgentOwningTeamClient = class extends AgentTeamOnlyClient {
54035
54174
  /**
54036
54175
  * Moves the agent to another Team, or to the organization with `team_id`
54037
54176
  * null. Pass the Team you saw as `expected_team_id`: someone else's change
@@ -54077,6 +54216,8 @@ var BillingClient = class extends TeamGraphClient {
54077
54216
  const params = new URLSearchParams();
54078
54217
  params.set("start_date", opts.start_date);
54079
54218
  params.set("end_date", opts.end_date);
54219
+ if (opts.timezone !== void 0)
54220
+ params.set("timezone", opts.timezone);
54080
54221
  return this.request("GET", `${ENDPOINTS.BILLING_USAGE_DAILY(orgId, accountId)}?${params}`);
54081
54222
  }
54082
54223
  async getUsageHeatmap(orgId, opts, accountId) {
@@ -54242,6 +54383,12 @@ var TeamInviteClient = class extends BillingClient {
54242
54383
  async getMyTeamInviteRequest(token) {
54243
54384
  return this.request("GET", ENDPOINTS.TEAM_INVITE_REQUEST_MINE(token));
54244
54385
  }
54386
+ /** The requester answers the link's questions for a request that already
54387
+ * finished (no new request). `TEAM_INVITE_INTAKE_INVALID` (400) names the
54388
+ * key in `details.key`. */
54389
+ async submitTeamInviteIntake(token, requestId, intake) {
54390
+ return this.request("PUT", ENDPOINTS.TEAM_INVITE_REQUEST_INTAKE(token, requestId), { intake });
54391
+ }
54245
54392
  /** The requester withdraws a request that is still waiting. */
54246
54393
  async cancelTeamInviteRequest(requestId) {
54247
54394
  return this.request("POST", ENDPOINTS.TEAM_INVITE_REQUEST_CANCEL(requestId));
@@ -54256,8 +54403,20 @@ function errorCode(err) {
54256
54403
  return typeof err === "object" && err !== null ? err.code : void 0;
54257
54404
  }
54258
54405
 
54406
+ // ts/sdk/dist/member-field-client.js
54407
+ var MemberFieldClient = class extends TeamInviteClient {
54408
+ /**
54409
+ * The member changes the value of one of their own fields: signed in only
54410
+ * (an API key gets 403 `JWT_REQUIRED`), 1–200 characters on one line.
54411
+ * Answers with the whole profile and its fields.
54412
+ */
54413
+ async updateMemberField(orgId, userId, key, value) {
54414
+ return this.request("PUT", `${ENDPOINTS.ORG_MEMBER_PROFILE(orgId, userId)}/fields/${encodeURIComponent(key)}`, { value });
54415
+ }
54416
+ };
54417
+
54259
54418
  // ts/sdk/dist/wiki-page-share-client.js
54260
- var WikiPageShareClient = class extends TeamInviteClient {
54419
+ var WikiPageShareClient = class extends MemberFieldClient {
54261
54420
  async listWikiPageShares(orgId, wikiId, path15) {
54262
54421
  const res = await this.request("GET", ENDPOINTS.WIKI_PAGE_SHARES(orgId, wikiId), void 0, { path: path15 });
54263
54422
  return res.data;
@@ -54278,6 +54437,20 @@ var WikiPageShareClient = class extends TeamInviteClient {
54278
54437
  }
54279
54438
  };
54280
54439
 
54440
+ // ts/sdk/dist/chat-bookmarks-client.js
54441
+ var ChatBookmarksClient = class extends WikiPageShareClient {
54442
+ async getChatBookmarks(orgId, chatId) {
54443
+ return this.request("GET", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId));
54444
+ }
54445
+ /** `ref` is a `prll://` reference or an http(s) URL. */
54446
+ async addChatBookmark(orgId, chatId, ref) {
54447
+ return this.request("POST", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId), { ref });
54448
+ }
54449
+ async removeChatBookmark(orgId, chatId, bookmarkId) {
54450
+ return this.request("DELETE", ENDPOINTS.CHAT_BOOKMARK(orgId, chatId, bookmarkId));
54451
+ }
54452
+ };
54453
+
54281
54454
  // ts/sdk/dist/wiki-changeset.js
54282
54455
  function normalizeWikiChangeset(changeset) {
54283
54456
  return {
@@ -54313,7 +54486,7 @@ function legacyHeartbeatFromReport(report) {
54313
54486
  detectedRuntimes
54314
54487
  };
54315
54488
  }
54316
- var ParallClient = class _ParallClient extends WikiPageShareClient {
54489
+ var ParallClient = class _ParallClient extends ChatBookmarksClient {
54317
54490
  baseUrl;
54318
54491
  wikiBaseUrl;
54319
54492
  token;
@@ -54761,7 +54934,7 @@ var ParallClient = class _ParallClient extends WikiPageShareClient {
54761
54934
  async updateOrgMember(orgId, userId, role) {
54762
54935
  return this.request("PATCH", ENDPOINTS.ORG_MEMBER(orgId, userId), { role });
54763
54936
  }
54764
- /** Org-scoped public profile (title / description) of any active member. */
54937
+ /** Org-scoped public profile (title / description) and fields of any active member. */
54765
54938
  async getMemberProfile(orgId, userId) {
54766
54939
  return this.request("GET", ENDPOINTS.ORG_MEMBER_PROFILE(orgId, userId));
54767
54940
  }
@@ -56609,7 +56782,7 @@ var ParallClient = class _ParallClient extends WikiPageShareClient {
56609
56782
  return this.request("GET", ENDPOINTS.ORG_EDGE_DEVICES(orgId));
56610
56783
  }
56611
56784
  /** Register an Edge. `placement` defaults to BYOC; hosted creates an idle,
56612
- * org-shared Cloud Profile and is restricted to human users. */
56785
+ * org-shared Cloud Profile; Agents need a separate creation grant and key. */
56613
56786
  async registerEdgeDevice(orgId, input, options) {
56614
56787
  const headers = options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : void 0;
56615
56788
  return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), input, void 0, false, { headers });
@@ -56854,10 +57027,11 @@ var ParallClient = class _ParallClient extends WikiPageShareClient {
56854
57027
  async listClipMCPConnections(orgId, clipId) {
56855
57028
  return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
56856
57029
  }
56857
- /** Create one MCP credential slot and its connection. */
56858
57030
  async createClipMCPConnection(orgId, clipId, req) {
56859
57031
  return this.request("POST", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId), req, void 0, false, {
56860
- timeoutMs: 4e4
57032
+ // A card may start OAuth: allow discovery (30s) and persistence like
57033
+ // createClipMCPOAuthConnection.
57034
+ timeoutMs: "approval_id" in req ? 5e4 : 4e4
56861
57035
  });
56862
57036
  }
56863
57037
  /** Delete one MCP config and its paired connection. */
@@ -57725,6 +57899,11 @@ var VENDOR_CLIS = [
57725
57899
  channel: "feishu",
57726
57900
  command: "lark-cli",
57727
57901
  install: "npm i -g @larksuite/cli && npx skills add larksuite/cli -y -g",
57902
+ // Before 1.0.97, im +messages-send / +messages-reply took `--markdown
57903
+ // @file` (the form the official skill teaches) as the literal text
57904
+ // "@file", sent it and reported success
57905
+ // (https://github.com/larksuite/cli/pull/2760).
57906
+ minVersion: "1.0.97",
57728
57907
  ownedEnv: [
57729
57908
  // injected
57730
57909
  "LARKSUITE_CLI_APP_ID",
@@ -63823,11 +64002,14 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
63823
64002
 
63824
64003
  \u8FD0\u884C \`parall browser profiles --json\`\uFF0C\u4ECE\u53EF\u8BBF\u95EE\u5217\u8868\u6309\u8D26\u53F7\u540D\u79F0\u9009\u62E9 Profile\u3002
63825
64004
  \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
63826
- \u6CA1\u6709\u53EF\u7528 Profile \u65F6\uFF0C\u95EE\u7528\u6237\uFF1A
64005
+ \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
64006
+ \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
64007
+ \u65E0\u6709\u6548\u521B\u5EFA\u6388\u6743\u6216\u4EFB\u52A1\u9700\u8981\u5DF2\u6709\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u95EE\u7528\u6237\uFF1A
63827
64008
  - **\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
63828
64009
  \`parall approvals request --action browser.profile.authorize --resource prll://<ebp_id> --title "Request browser profile access" --chat prll://<cht_id>\`
63829
64010
  \u4EBA approve \u540E\u4F60\u81EA\u52A8\u83B7\u5F97\u8BE5 Profile \u7684\u5168\u90E8\u64CD\u4F5C\u6743\u9650\u3002
63830
- - **\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
64011
+ - **\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
64012
+ - **\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
63831
64013
  \u5217\u8868\u62A5\u9519\u65F6\u4FDD\u7559\u9519\u8BEF\uFF0C\u4E0D\u80FD\u5F53\u4F5C\u7A7A\u5217\u8868\u3002
63832
64014
  \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
63833
64015
 
@@ -63835,6 +64017,26 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
63835
64017
  \`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
63836
64018
  \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
63837
64019
 
64020
+ ## \u81EA\u5EFA Profile \u7684\u8FB9\u754C\u4E0E\u6062\u590D
64021
+
64022
+ \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
64023
+ \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
64024
+ \u65B0\u5EFA Profile \u6CA1\u6709\u7F51\u7AD9\u767B\u5F55\u6001\uFF1BProfile \u7684\u4F7F\u7528\u6743\u6216\u521B\u5EFA\u6743\u90FD\u4E0D\u7B49\u4E8E\u8D26\u53F7\u51ED\u636E\u6388\u6743\u3002
64025
+ \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
64026
+
64027
+ - \`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
64028
+ - \`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
64029
+ - \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
64030
+ - \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
64031
+ - \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
64032
+
64033
+ ## \u7F51\u7AD9\u767B\u5F55
64034
+
64035
+ \u7528\u6237\u660E\u786E\u6388\u6743\u4F60\u767B\u5F55\u67D0\u4E2A\u8D26\u53F7\uFF0C\u4E14\u8D26\u53F7\u51ED\u636E\u5DF2\u4F5C\u4E3A\u5BC6\u94A5\u7ED9\u5230\u4F60\u65F6\uFF0C\u81EA\u5DF1\u7528 \`parall browser\` \u6253\u5F00\u767B\u5F55\u9875\u3001\u586B\u5199\u5E76\u63D0\u4EA4\u3002
64036
+ \u51ED\u636E\u53EA\u8D70\u5BC6\u94A5\uFF1A\u7F3A\u4E86\u7528 \`parall secrets request\` \u7533\u8BF7\uFF0C\u4E0D\u5728\u804A\u5929\u91CC\u8981\u6216\u4F20\uFF1B\u547D\u4EE4\u91CC\u53EA\u5F15\u7528\u73AF\u5883\u53D8\u91CF\uFF08\u5982 \`fill --text "$SITE_PASSWORD"\`\uFF09\uFF0C\u4E0D\u6253\u5370\u3001\u4E0D\u622A\u56FE\u3001\u4E0D\u5916\u53D1\u5176\u503C\u3002
64037
+ \u9047\u5230\u9A8C\u8BC1\u7801\u3001\u77ED\u4FE1/\u90AE\u7BB1\u9A8C\u8BC1\u7801\u3001\u4E8C\u6B21\u9A8C\u8BC1\u7B49\u987B\u4EBA\u5904\u7406\u7684\u6B65\u9AA4\uFF0C\u505C\u6B62\u64CD\u4F5C\u5E76\u4FDD\u7559\u53EF\u89C1\u9875\u9762\uFF0C\u8BF7\u7528\u6237\u5728 Viewer \u6216 Desktop \u63A5\u7BA1\u5B8C\u6210\uFF0C\u7B49\u7528\u6237\u660E\u786E\u8BF4\u7EE7\u7EED\u518D\u63A5\u7740\u505A\u3002
64038
+ \u4EE3\u7406\u51ED\u636E\u3001cookie \u548C\u5176\u4ED6\u6D4F\u89C8\u5668\u7684\u73B0\u6709\u767B\u5F55\u6001\u4ECD\u4E0D\u53EF\u89E6\u78B0\uFF1B\u9700\u8981\u65F6\u8BF7\u4EBA\u5904\u7406\uFF0C\u4E0D\u81EA\u884C\u8BFB\u53D6\u3001\u590D\u5236\u3001\u5BFC\u5165\u6216\u914D\u7F6E\u3002
64039
+
63838
64040
  ## \u793A\u4F8B\uFF1A\u6253\u5F00\u9875\u9762\uFF0C\u8BFB\u53D6\u6807\u9898\uFF0C\u7559\u7ED9\u7528\u6237\u67E5\u770B
63839
64041
 
63840
64042
  \u4E0B\u9762\u5C16\u62EC\u53F7\u987B\u66FF\u6362\u4E3A\u5B9E\u9645\u8FD4\u56DE\u503C\uFF0C\u4E0D\u8981\u7167\u6284\u3002
@@ -63971,6 +64173,16 @@ parall messages list prll://cht_xxx # Read chat message history
63971
64173
  parall messages list prll://cht_xxx --since 2026-01-01 # Only messages at/after a date (RFC3339 or YYYY-MM-DD)
63972
64174
  \`\`\`
63973
64175
 
64176
+ A chat's **bookmarks** are the references pinned to its top, which every member
64177
+ sees in the bookmark bar above the messages. Use them when someone asks you to
64178
+ bookmark or pin something in a chat, or asks what is bookmarked there:
64179
+
64180
+ \`\`\`bash
64181
+ parall chats bookmarks list prll://cht_xxx
64182
+ parall chats bookmarks add prll://cht_xxx prll://tsk_xxx # any prll:// reference, or an https:// link
64183
+ parall chats bookmarks remove prll://cht_xxx prll://tsk_xxx
64184
+ \`\`\`
64185
+
63974
64186
  ## Org-Context Search
63975
64187
 
63976
64188
  Before deciding or starting non-trivial work, search the org's real history \u2014
@@ -65112,7 +65324,7 @@ bound to the connector, and the connection is what your access is granted on.
65112
65324
  \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
65113
65325
  - \`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\` mean a
65114
65326
  human has restricted who may run this connector (or through which account);
65115
- ask them to widen access \u2014 you cannot grant it to yourself.
65327
+ you cannot grant it to yourself \u2014 ask on a card (next section).
65116
65328
  - Waiting on a cloud profile is handled by the CLI: \`EDGE_ACTIVATING\` (cold
65117
65329
  start), \`EDGE_BUSY\` (another exec is running) and
65118
65330
  \`EDGE_CONCURRENCY_LIMIT\` (org at capacity) are all guaranteed-unexecuted
@@ -65121,6 +65333,24 @@ bound to the connector, and the connection is what your access is granted on.
65121
65333
  fails already spent that budget \u2014 report the error, do not blind-retry in
65122
65334
  a loop.
65123
65335
 
65336
+ ## Ask a person to connect
65337
+
65338
+ When the task needs a connector you cannot run yet \u2014 it is not installed
65339
+ (find it with \`parall connector search <text>\`), you have no connection to it
65340
+ (\`CONNECTION_NOT_FOUND\`), you are not allowed through one
65341
+ (\`CLIP_AGENT_NOT_ALLOWED\`, \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`) or it needs
65342
+ signing in again (\`MCP_OAUTH_REAUTH_REQUIRED\`) \u2014 post a card:
65343
+
65344
+ \`\`\`bash
65345
+ parall connector connect <connector> --reason "<what you need it for>" # the person's own account (mail, calendar, personal tools)
65346
+ parall connector connect <connector> --reason "<what you need it for>" --from org # a company-shared account
65347
+ \`\`\`
65348
+
65349
+ The card installs the connector and creates the connection \u2014 don't send the
65350
+ person to the Connectors page or install it yourself. Relay the sentence the
65351
+ command prints, carry on with what doesn't need the connector, and you are
65352
+ woken with the result. Use a person's account only for that person's requests.
65353
+
65124
65354
  ## MCP connectors (remote tool servers)
65125
65355
 
65126
65356
  A connection with target \`mcp\` routes to a remote MCP server; the command
@@ -65138,7 +65368,7 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65138
65368
 
65139
65369
  - \`connector connections\` marks MCP rows with their auth mode, \`credential_set\`
65140
65370
  / \`oauth_status\` and \`tool_count\` \u2014 a \`needs_reauth\` or credential-less
65141
- row will refuse exec until an org admin fixes it in the Connector Console.
65371
+ row will refuse exec until someone signs in again; ask on a card (above).
65142
65372
  - \`--connection\` is REQUIRED to exec an MCP connection, exactly like every
65143
65373
  other target. The alias tells you WHICH account you act as \u2014 always name
65144
65374
  it.
@@ -65155,17 +65385,16 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65155
65385
  or MCP is off for this deployment \u2014 ask an org admin; retrying won't help.
65156
65386
  - \`MCP_OAUTH_REAUTH_REQUIRED\` = that connection's authorization is no longer
65157
65387
  valid (revoked or expired at the provider, or disconnected) \u2014 nothing ran and
65158
- retrying won't help. Tell the user which connection broke (the message names
65159
- the connector and connection), that an org owner or admin must re-authorize it in
65160
- Connectors (Web or Desktop), and share \`details.reauth_url\` when present. Owners and admins
65161
- usually also get an Inbox alert, but don't rely on it \u2014 still tell the user
65162
- who needs to act.
65388
+ retrying won't help. Ask on a card (above; \`--from org\` for a
65389
+ company-shared account). For a person's own account the card makes a new
65390
+ connection: use the \`connection_id\` from the decision, not the old one.
65163
65391
  - \`MCP_AUTH_FAILED\` = the MCP server refused this request with this
65164
65392
  connection's credentials \u2014 nothing ran; don't retry as-is.
65165
65393
  \`details.reason\` \`insufficient_scope\`: this account may not do that \u2014 use
65166
65394
  a connection with the needed access, or ask an org admin to review its
65167
65395
  permissions. \`credential_rejected\`: the saved credential is no longer
65168
- accepted \u2014 an org admin must update it.
65396
+ accepted \u2014 an org admin must update it. On a person's own account the
65397
+ message says to ask that person on a card instead; follow the message.
65169
65398
  - \`MCP_SERVER_UNREACHABLE\` = the MCP server (or its OAuth token endpoint)
65170
65399
  could not be reached \u2014 nothing ran; safe to retry after a short wait.
65171
65400
  - \`OUTCOME_UNKNOWN\` follows the rule below: dispatched and MAY HAVE
@@ -65179,11 +65408,11 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
65179
65408
 
65180
65409
  ## Behavior rules
65181
65410
 
65182
- - An authorization error (\`CLIP_AGENT_NOT_ALLOWED\`,
65183
- \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`, \`CONNECTION_NOT_ALLOWED\`,
65184
- \`PROFILE_NOT_ALLOWED\`, \`FORBIDDEN\`) is a fail-fast: ask
65185
- an org admin to grant the connector or the connection \u2014 do not retry or work
65186
- around it.
65411
+ - An authorization error is a fail-fast \u2014 do not retry or work around it.
65412
+ \`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`: ask on a
65413
+ card with \`parall connector connect\`. \`CONNECTION_NOT_ALLOWED\`,
65414
+ \`PROFILE_NOT_ALLOWED\`, \`FORBIDDEN\`: ask an org admin to grant the
65415
+ connector or the connection.
65187
65416
  - If the target device is offline or the call times out, report that
65188
65417
  plainly; do not queue, and never fabricate a result for a run that errored.
65189
65418
  - **\`OUTCOME_UNKNOWN\` is never retryable.** It means the command was
@@ -65605,7 +65834,7 @@ var SKILLS = [
65605
65834
  },
65606
65835
  {
65607
65836
  name: "parall-platform",
65608
- 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.",
65837
+ 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.",
65609
65838
  content: PARALL_PLATFORM_SKILL
65610
65839
  },
65611
65840
  {
@@ -65630,7 +65859,7 @@ var SKILLS = [
65630
65859
  },
65631
65860
  {
65632
65861
  name: "parall-clips",
65633
- 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.",
65862
+ 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.",
65634
65863
  content: PARALL_CLIPS_SKILL
65635
65864
  },
65636
65865
  {
@@ -65933,7 +66162,7 @@ function createCommandEnv(opts) {
65933
66162
  // ts/claude-agent/dist/dispatch.js
65934
66163
  import { execSync as execSync2, spawn } from "node:child_process";
65935
66164
  import { randomUUID as randomUUID10 } from "node:crypto";
65936
- import * as fs10 from "node:fs";
66165
+ import * as fs11 from "node:fs";
65937
66166
  import * as path13 from "node:path";
65938
66167
 
65939
66168
  // ts/agent-core/dist/internal/attachment-input.js
@@ -66596,7 +66825,7 @@ var ClaudeBusyTracker = class {
66596
66825
  * REPLACE frame arrives BEFORE the task_notification for the task it
66597
66826
  * removed (2.1.292 sends it after), and the notification itself carries
66598
66827
  * only a summary. Both orders occur — self-hosted machines run whatever
66599
- * CLI the user installed (probes/background-tasks-2.1.292.md).
66828
+ * CLI the user installed (probes/background-tasks-2.1.318.md).
66600
66829
  */
66601
66830
  finishedDescriptions = /* @__PURE__ */ new Map();
66602
66831
  constructor(holdMs = DEFAULT_FOLLOW_UP_HOLD_MS) {
@@ -66712,378 +66941,6 @@ function aggregateBusyState(states) {
66712
66941
  return { activeTurns, backgroundWork, ...holdUntil !== void 0 ? { holdUntil } : {} };
66713
66942
  }
66714
66943
 
66715
- // ts/claude-agent/dist/input-lifecycle.js
66716
- import { randomUUID as randomUUID7 } from "node:crypto";
66717
-
66718
- // ts/claude-agent/dist/turn-outcome.js
66719
- var LIMIT_TEXT = /you'?ve (hit|reached) your .*limit|usage limit reached|weekly limit/i;
66720
- 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;
66721
- var CONTEXT_TEXT = /prompt is too long|context (window|length) exceeded|request too large/i;
66722
- var RATE_LIMIT_ERROR_TEXT = /rate_limit_error/i;
66723
- var QUOTA_TEXT = /credit balance is too low|insufficient credits|insufficient_quota|payment required/i;
66724
- var DETAIL_MAX = 500;
66725
- function minutesOfDayInZone(fmt, at) {
66726
- const parts = Object.fromEntries(fmt.formatToParts(at).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
66727
- const hour = parts.hour === 24 ? 0 : parts.hour;
66728
- return hour * 60 + parts.minute;
66729
- }
66730
- function parseClaudeResetTime(text, now) {
66731
- const m = /resets\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\s*\(([^)]+)\)/i.exec(text);
66732
- if (!m)
66733
- return void 0;
66734
- let hour = Number(m[1]);
66735
- const minute = m[2] ? Number(m[2]) : 0;
66736
- const meridiem = m[3]?.toLowerCase();
66737
- const timeZone = m[4].trim();
66738
- if (!Number.isFinite(hour) || hour > 23 || minute > 59)
66739
- return void 0;
66740
- if (meridiem === "pm" && hour < 12)
66741
- hour += 12;
66742
- if (meridiem === "am" && hour === 12)
66743
- hour = 0;
66744
- let fmt;
66745
- let nowMinutesOfDay;
66746
- try {
66747
- fmt = new Intl.DateTimeFormat("en-US", {
66748
- timeZone,
66749
- hour12: false,
66750
- hour: "2-digit",
66751
- minute: "2-digit"
66752
- });
66753
- nowMinutesOfDay = minutesOfDayInZone(fmt, now);
66754
- } catch {
66755
- return void 0;
66756
- }
66757
- const targetMinutesOfDay = hour * 60 + minute;
66758
- let deltaMinutes = targetMinutesOfDay - nowMinutesOfDay;
66759
- if (deltaMinutes <= 0)
66760
- deltaMinutes += 24 * 60;
66761
- const anchored = now.getTime() - (now.getSeconds() * 1e3 + now.getMilliseconds());
66762
- let target = anchored + deltaMinutes * 6e4;
66763
- for (let i = 0; i < 2; i++) {
66764
- let diff = targetMinutesOfDay - minutesOfDayInZone(fmt, new Date(target));
66765
- if (diff > 720)
66766
- diff -= 1440;
66767
- if (diff < -720)
66768
- diff += 1440;
66769
- if (diff === 0)
66770
- break;
66771
- target += diff * 6e4;
66772
- }
66773
- if (target <= now.getTime())
66774
- target += 24 * 60 * 6e4;
66775
- return new Date(target).toISOString();
66776
- }
66777
- function usageOf(meta) {
66778
- const usage = {};
66779
- if (meta.inputTokens !== void 0)
66780
- usage.inputTokens = meta.inputTokens;
66781
- if (meta.outputTokens !== void 0)
66782
- usage.outputTokens = meta.outputTokens;
66783
- if (meta.cacheReadTokens !== void 0)
66784
- usage.cacheReadTokens = meta.cacheReadTokens;
66785
- if (meta.cacheCreationTokens !== void 0)
66786
- usage.cacheCreationTokens = meta.cacheCreationTokens;
66787
- if (meta.totalCostUsd !== void 0)
66788
- usage.costUsd = meta.totalCostUsd;
66789
- if (meta.durationMs !== void 0)
66790
- usage.durationMs = meta.durationMs;
66791
- if (meta.durationApiMs !== void 0)
66792
- usage.durationApiMs = meta.durationApiMs;
66793
- return Object.keys(usage).length > 0 ? usage : void 0;
66794
- }
66795
- function classifyClaudeTurn(meta, noticeTexts, now = /* @__PURE__ */ new Date()) {
66796
- if (!meta) {
66797
- return { type: "turn_outcome", outcome: "runtime_crash" };
66798
- }
66799
- const usage = usageOf(meta);
66800
- const evidence = [meta.resultText, ...noticeTexts].filter(Boolean).join("\n");
66801
- const base = {
66802
- type: "turn_outcome",
66803
- ...usage ? { usage } : {},
66804
- ...meta.model ? { model: meta.model } : {},
66805
- raw: {
66806
- ...meta.subtype ? { subtype: meta.subtype } : {},
66807
- ...meta.terminalReason ? { terminal_reason: meta.terminalReason } : {},
66808
- ...meta.apiErrorStatus !== void 0 ? { api_error_status: meta.apiErrorStatus } : {},
66809
- ...meta.stopReason ? { stop_reason: meta.stopReason } : {}
66810
- }
66811
- };
66812
- const withDetail = (outcome, retryAt) => ({
66813
- ...base,
66814
- outcome,
66815
- ...evidence ? { detail: evidence.slice(0, DETAIL_MAX) } : {},
66816
- ...retryAt ? { retryAt } : {}
66817
- });
66818
- if (meta.apiErrorStatus === 401 || meta.apiErrorStatus === 403)
66819
- return withDetail("auth");
66820
- if (meta.apiErrorStatus === 402)
66821
- return withDetail("quota_exhausted");
66822
- if (meta.apiErrorStatus === 413)
66823
- return withDetail("context_overflow");
66824
- if (meta.apiErrorStatus === 429) {
66825
- if (QUOTA_TEXT.test(evidence))
66826
- return withDetail("quota_exhausted");
66827
- if (RATE_LIMIT_ERROR_TEXT.test(evidence))
66828
- return withDetail("transient");
66829
- return withDetail("usage_limit", evidence ? parseClaudeResetTime(evidence, now) : void 0);
66830
- }
66831
- const failed = meta.isError || // Claude CLI 2.1.220 sets terminal_reason=completed on clean result
66832
- // frames. Any other terminal reason stays fail-closed.
66833
- meta.terminalReason !== void 0 && meta.terminalReason !== "completed" || meta.subtype !== void 0 && meta.subtype !== "success";
66834
- const syntheticQuiet = !failed && // A "successful" turn that never touched the API and produced no tool
66835
- // activity is the synthetic-notice shape (limit/auth text emitted
66836
- // locally by the CLI): zero usage + stop_sequence.
66837
- meta.stopReason === "stop_sequence" && (meta.inputTokens ?? 0) === 0 && (meta.outputTokens ?? 0) === 0 && (meta.durationApiMs ?? 0) === 0;
66838
- if (failed || syntheticQuiet || noticeTexts.length > 0) {
66839
- if (CONTEXT_TEXT.test(evidence))
66840
- return withDetail("context_overflow");
66841
- if (QUOTA_TEXT.test(evidence))
66842
- return withDetail("quota_exhausted");
66843
- if (LIMIT_TEXT.test(evidence)) {
66844
- return withDetail("usage_limit", parseClaudeResetTime(evidence, now));
66845
- }
66846
- if (AUTH_TEXT.test(evidence))
66847
- return withDetail("auth");
66848
- return withDetail("transient");
66849
- }
66850
- return { ...base, outcome: "ok" };
66851
- }
66852
-
66853
- // ts/agent-core/dist/internal/async-queue.js
66854
- var AsyncQueue = class {
66855
- opts;
66856
- items = [];
66857
- waiter = null;
66858
- closed = false;
66859
- droppedCount = 0;
66860
- constructor(opts = {}) {
66861
- this.opts = opts;
66862
- }
66863
- /** True once close() ran — parked items may still drain via next(). */
66864
- get isClosed() {
66865
- return this.closed;
66866
- }
66867
- /** Parked items not yet consumed. */
66868
- get size() {
66869
- return this.items.length;
66870
- }
66871
- /** Items dropped past the parked cap (diagnostics). */
66872
- get dropped() {
66873
- return this.droppedCount;
66874
- }
66875
- /** Returns false when the queue is closed (item discarded). */
66876
- push(item) {
66877
- if (this.closed)
66878
- return false;
66879
- if (this.waiter) {
66880
- const resolve3 = this.waiter;
66881
- this.waiter = null;
66882
- resolve3({ value: item, done: false });
66883
- return true;
66884
- }
66885
- const cap = Math.max(1, this.opts.maxParked ?? 5e3);
66886
- if (this.items.length >= cap) {
66887
- this.items.shift();
66888
- if (this.droppedCount === 0)
66889
- this.opts.onFirstDrop?.();
66890
- this.droppedCount += 1;
66891
- }
66892
- this.items.push(item);
66893
- return true;
66894
- }
66895
- next() {
66896
- if (this.items.length > 0) {
66897
- return Promise.resolve({ value: this.items.shift(), done: false });
66898
- }
66899
- if (this.closed) {
66900
- return Promise.resolve({ value: void 0, done: true });
66901
- }
66902
- return new Promise((resolve3) => {
66903
- this.waiter = resolve3;
66904
- });
66905
- }
66906
- close() {
66907
- if (this.closed)
66908
- return;
66909
- this.closed = true;
66910
- const waiter = this.waiter;
66911
- this.waiter = null;
66912
- waiter?.({ value: void 0, done: true });
66913
- }
66914
- };
66915
-
66916
- // ts/claude-agent/dist/turn-sink.js
66917
- function newTurnEvidence() {
66918
- return { noticeTexts: [], sawError: false };
66919
- }
66920
- function newTurnSink(label, log2) {
66921
- return new AsyncQueue({
66922
- onFirstDrop: () => log2?.warn?.(`Claude turn sink ${label} exceeded its parked-frame cap; dropping oldest`)
66923
- });
66924
- }
66925
-
66926
- // ts/claude-agent/dist/input-lifecycle.js
66927
- var ClaudeInputRegistry = class {
66928
- byKey = /* @__PURE__ */ new Map();
66929
- byCommand = /* @__PURE__ */ new Map();
66930
- getByKey(deliveryKey) {
66931
- return this.byKey.get(deliveryKey);
66932
- }
66933
- getByCommand(commandUuid) {
66934
- return this.byCommand.get(commandUuid);
66935
- }
66936
- findOverlapping(dispatchEventIds) {
66937
- const ids = new Set(dispatchEventIds);
66938
- for (const delivery of this.byKey.values()) {
66939
- if (delivery.lifecycle?.dispatchEventIds.some((id) => ids.has(id))) {
66940
- return delivery;
66941
- }
66942
- }
66943
- return void 0;
66944
- }
66945
- values() {
66946
- return this.byKey.values();
66947
- }
66948
- hasPendingInjections() {
66949
- return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.drained);
66950
- }
66951
- /**
66952
- * Injected inputs whose lifecycle has NOT reached a terminal state. A
66953
- * terminal delivery still counts as pending (its buffered copy owes frame
66954
- * boundary bookkeeping) but owes the server nothing — the lane complete
66955
- * defers on this predicate, never on hasPendingInjections, so a bookkeeping
66956
- * copy that never drains cannot hold the lane open past its lease. Drained
66957
- * is deliberately NOT part of this predicate: a discarded bookkeeping copy
66958
- * (drained, non-terminal) is still a running input — completing its lane
66959
- * would release the member for redrive mid-processing.
66960
- */
66961
- hasUnsettledInjections() {
66962
- return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.terminal);
66963
- }
66964
- register(deliveryKey, lifecycle, injected, noteActivity, log2) {
66965
- if (this.byKey.has(deliveryKey)) {
66966
- throw new Error(`duplicate Claude delivery key ${deliveryKey}`);
66967
- }
66968
- const commandUuid = randomUUID7();
66969
- const delivery = {
66970
- deliveryKey,
66971
- commandUuid,
66972
- lifecycle,
66973
- injected,
66974
- drained: !injected,
66975
- resultFailed: false,
66976
- sink: newTurnSink(`delivery ${deliveryKey}`, log2),
66977
- evidence: newTurnEvidence(),
66978
- noteActivity,
66979
- sessionAnnounced: false
66980
- };
66981
- this.byKey.set(deliveryKey, delivery);
66982
- this.byCommand.set(delivery.commandUuid, delivery);
66983
- return delivery;
66984
- }
66985
- /** Undefined while an input under the same key is still registered. */
66986
- registerLocal(input, log2) {
66987
- const deliveryKey = `local:${input.localKey}`;
66988
- if (this.byKey.has(deliveryKey))
66989
- return void 0;
66990
- const delivery = this.register(deliveryKey, void 0, false, void 0, log2);
66991
- const settlement = new LocalInputSettlement(input, log2);
66992
- delivery.local = { label: input.label, settlement, surfaced: false };
66993
- return delivery;
66994
- }
66995
- /** A local input not yet terminal: the CLI has (or will start) work no dispatch drains. */
66996
- hasOpenLocalInput() {
66997
- return [...this.byKey.values()].some((delivery) => delivery.local && !delivery.terminal);
66998
- }
66999
- remove(delivery) {
67000
- if (this.byKey.get(delivery.deliveryKey) === delivery) {
67001
- this.byKey.delete(delivery.deliveryKey);
67002
- }
67003
- if (this.byCommand.get(delivery.commandUuid) === delivery) {
67004
- this.byCommand.delete(delivery.commandUuid);
67005
- }
67006
- }
67007
- /**
67008
- * The buffered copy backing this delivery was discarded without a
67009
- * dispatch (already rendered into a frame the model saw), so the normal
67010
- * bookkeeping drain never comes. Its frame-boundary obligation is void:
67011
- * mark it drained so nothing waits on it, and drop it once terminal. A
67012
- * still-running input keeps its registration — byCommand must keep routing
67013
- * its lifecycle frames — and is dropped when its terminal state arrives
67014
- * (see apply/fail).
67015
- */
67016
- discardBookkeeping(deliveryKey) {
67017
- const delivery = this.byKey.get(deliveryKey);
67018
- if (!delivery)
67019
- return;
67020
- delivery.drained = true;
67021
- if (delivery.terminal)
67022
- this.remove(delivery);
67023
- }
67024
- async apply(delivery, state) {
67025
- if (delivery.terminal || state === "queued")
67026
- return;
67027
- if (state !== "cancelled" && state !== "discarded") {
67028
- delivery.local?.settlement.settle("delivered");
67029
- }
67030
- if (state === "started") {
67031
- if (delivery.reportedState)
67032
- return;
67033
- await delivery.lifecycle?.update("started");
67034
- delivery.reportedState = "started";
67035
- return;
67036
- }
67037
- if (state === "cancelled" || state === "discarded" || delivery.resultFailed) {
67038
- await this.fail(delivery);
67039
- return;
67040
- }
67041
- if (delivery.reportedState !== "completed") {
67042
- await delivery.lifecycle?.update("completed");
67043
- delivery.reportedState = "completed";
67044
- }
67045
- delivery.terminal = "completed";
67046
- if (delivery.drained)
67047
- this.remove(delivery);
67048
- }
67049
- async fail(delivery, detail) {
67050
- if (delivery.terminal)
67051
- return;
67052
- delivery.local?.settlement.settle("not_delivered");
67053
- if (delivery.suppressFailReport) {
67054
- delivery.terminal = "settled";
67055
- if (delivery.drained)
67056
- this.remove(delivery);
67057
- return;
67058
- }
67059
- try {
67060
- if (delivery.reportedState !== "failed") {
67061
- const classified = classifyClaudeTurn(delivery.evidence.lastResultMeta, delivery.evidence.noticeTexts);
67062
- const result = await delivery.lifecycle?.update("failed", {
67063
- outcomeClass: classified.outcome === "ok" || classified.outcome === "usage_limit" ? "runtime_crash" : classified.outcome,
67064
- detail: detail ?? classified.detail ?? "Claude input failed"
67065
- });
67066
- delivery.reportedState = "failed";
67067
- delivery.terminal = result && !result.pending && result.retry === false ? "settled" : "failed";
67068
- }
67069
- } finally {
67070
- delivery.terminal ??= "failed";
67071
- if (delivery.drained)
67072
- this.remove(delivery);
67073
- }
67074
- }
67075
- async failBestEffort(delivery, log2, detail) {
67076
- try {
67077
- await this.fail(delivery, detail);
67078
- } catch (err) {
67079
- log2?.warn?.(`failed to report Claude input ${delivery.commandUuid} as failed: ${String(err)}`);
67080
- }
67081
- }
67082
- async failAllBestEffort(log2, detail) {
67083
- await Promise.all([...this.byKey.values()].filter((delivery) => !delivery.terminal).map((delivery) => this.failBestEffort(delivery, log2, detail)));
67084
- }
67085
- };
67086
-
67087
66944
  // ts/claude-agent/dist/runtime-observations.js
67088
66945
  function claudeObservation(frame) {
67089
66946
  const sessionId = observationField(frame.session_id);
@@ -67523,6 +67380,499 @@ function extractResultMeta(frame, isError, numTurns) {
67523
67380
  return meta;
67524
67381
  }
67525
67382
 
67383
+ // ts/claude-agent/dist/stdin-frames.js
67384
+ import { randomUUID as randomUUID7 } from "node:crypto";
67385
+ function writeCapabilityProbe(handle) {
67386
+ const payload = JSON.stringify({
67387
+ type: "user",
67388
+ uuid: randomUUID7(),
67389
+ parent_tool_use_id: null,
67390
+ message: { role: "user", content: [] }
67391
+ });
67392
+ handle.proc.stdin.write(`${payload}
67393
+ `);
67394
+ }
67395
+ function writeUserMessage(handle, text, commandUuid) {
67396
+ const payload = JSON.stringify({
67397
+ type: "user",
67398
+ uuid: commandUuid,
67399
+ parent_tool_use_id: null,
67400
+ message: {
67401
+ role: "user",
67402
+ content: [{ type: "text", text }]
67403
+ }
67404
+ });
67405
+ handle.proc.stdin.write(`${payload}
67406
+ `);
67407
+ }
67408
+
67409
+ // ts/claude-agent/dist/capability-probe.js
67410
+ var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
67411
+ var MissingClaudeLifecycleCapabilityError = class extends Error {
67412
+ };
67413
+ var UnknownPromptSnapshotFlagError = class extends Error {
67414
+ };
67415
+ var ClaudeCapabilityProbe = class {
67416
+ host;
67417
+ capabilityProbe;
67418
+ capabilityProbeHandle;
67419
+ snapshotOff = true;
67420
+ constructor(host) {
67421
+ this.host = host;
67422
+ }
67423
+ /**
67424
+ * Whether spawns pass `--system-prompt-snapshot off`. The CLI records the
67425
+ * system prompt on a conversation's first request and resends that record on
67426
+ * every later request and --resume, so a rewritten prompt file would never
67427
+ * reach a resumed session (probes/system-prompt-snapshot-2.1.318.md). CLIs
67428
+ * that predate the recording also lack the flag and exit on it; the probe
67429
+ * observes that once and spawns without it from then on.
67430
+ */
67431
+ get promptSnapshotOff() {
67432
+ return this.snapshotOff;
67433
+ }
67434
+ ensureRuntimeCapability(log2) {
67435
+ if (!this.capabilityProbe) {
67436
+ const probe = this.probeRuntimeCapability(log2);
67437
+ this.capabilityProbe = probe.catch((err) => {
67438
+ if (!(err instanceof MissingClaudeLifecycleCapabilityError)) {
67439
+ this.capabilityProbe = void 0;
67440
+ }
67441
+ throw err;
67442
+ });
67443
+ }
67444
+ return this.capabilityProbe;
67445
+ }
67446
+ /** Shutdown: end a probe process that is still running. */
67447
+ terminate() {
67448
+ if (this.capabilityProbeHandle) {
67449
+ this.host.terminateHandle(this.capabilityProbeHandle);
67450
+ this.capabilityProbeHandle = void 0;
67451
+ }
67452
+ }
67453
+ async probeRuntimeCapability(log2) {
67454
+ try {
67455
+ await this.probeOnce(log2);
67456
+ } catch (err) {
67457
+ if (!(err instanceof UnknownPromptSnapshotFlagError))
67458
+ throw err;
67459
+ this.snapshotOff = false;
67460
+ await this.probeOnce(log2);
67461
+ }
67462
+ }
67463
+ async probeOnce(log2) {
67464
+ const handle = this.host.spawnProbe(log2);
67465
+ this.capabilityProbeHandle = handle;
67466
+ const parser = parseClaudeStreamJson(handle.proc.stdout);
67467
+ let timedOut = false;
67468
+ const timer = setTimeout(() => {
67469
+ timedOut = true;
67470
+ this.host.terminateHandle(handle);
67471
+ }, CAPABILITY_PROBE_TIMEOUT_MS);
67472
+ timer.unref?.();
67473
+ try {
67474
+ writeCapabilityProbe(handle);
67475
+ while (true) {
67476
+ const next = await parser.next();
67477
+ if (next.done) {
67478
+ const detail = handle.stderrChunks.join("").trim();
67479
+ if (this.snapshotOff && detail.includes("unknown option '--system-prompt-snapshot'")) {
67480
+ throw new UnknownPromptSnapshotFlagError(detail);
67481
+ }
67482
+ if (timedOut) {
67483
+ throw new Error(`Claude runtime capability probe timed out after ${CAPABILITY_PROBE_TIMEOUT_MS}ms`);
67484
+ }
67485
+ throw new Error(detail || "Claude exited before its runtime capability probe completed");
67486
+ }
67487
+ if (next.value.type !== "runtime_init")
67488
+ continue;
67489
+ if (!next.value.capabilities.includes("msg_lifecycle_v1")) {
67490
+ throw new MissingClaudeLifecycleCapabilityError("Claude runtime lacks required msg_lifecycle_v1 capability; refusing heuristic input coverage");
67491
+ }
67492
+ return;
67493
+ }
67494
+ } finally {
67495
+ clearTimeout(timer);
67496
+ if (this.capabilityProbeHandle === handle) {
67497
+ this.capabilityProbeHandle = void 0;
67498
+ }
67499
+ this.host.terminateHandle(handle);
67500
+ }
67501
+ }
67502
+ };
67503
+
67504
+ // ts/claude-agent/dist/input-lifecycle.js
67505
+ import { randomUUID as randomUUID8 } from "node:crypto";
67506
+
67507
+ // ts/claude-agent/dist/turn-outcome.js
67508
+ var LIMIT_TEXT = /you'?ve (hit|reached) your .*limit|usage limit reached|weekly limit/i;
67509
+ 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;
67510
+ var CONTEXT_TEXT = /prompt is too long|context (window|length) exceeded|request too large/i;
67511
+ var RATE_LIMIT_ERROR_TEXT = /rate_limit_error/i;
67512
+ var QUOTA_TEXT = /credit balance is too low|insufficient credits|insufficient_quota|payment required/i;
67513
+ var DETAIL_MAX = 500;
67514
+ function minutesOfDayInZone(fmt, at) {
67515
+ const parts = Object.fromEntries(fmt.formatToParts(at).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
67516
+ const hour = parts.hour === 24 ? 0 : parts.hour;
67517
+ return hour * 60 + parts.minute;
67518
+ }
67519
+ function parseClaudeResetTime(text, now) {
67520
+ const m = /resets\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\s*\(([^)]+)\)/i.exec(text);
67521
+ if (!m)
67522
+ return void 0;
67523
+ let hour = Number(m[1]);
67524
+ const minute = m[2] ? Number(m[2]) : 0;
67525
+ const meridiem = m[3]?.toLowerCase();
67526
+ const timeZone = m[4].trim();
67527
+ if (!Number.isFinite(hour) || hour > 23 || minute > 59)
67528
+ return void 0;
67529
+ if (meridiem === "pm" && hour < 12)
67530
+ hour += 12;
67531
+ if (meridiem === "am" && hour === 12)
67532
+ hour = 0;
67533
+ let fmt;
67534
+ let nowMinutesOfDay;
67535
+ try {
67536
+ fmt = new Intl.DateTimeFormat("en-US", {
67537
+ timeZone,
67538
+ hour12: false,
67539
+ hour: "2-digit",
67540
+ minute: "2-digit"
67541
+ });
67542
+ nowMinutesOfDay = minutesOfDayInZone(fmt, now);
67543
+ } catch {
67544
+ return void 0;
67545
+ }
67546
+ const targetMinutesOfDay = hour * 60 + minute;
67547
+ let deltaMinutes = targetMinutesOfDay - nowMinutesOfDay;
67548
+ if (deltaMinutes <= 0)
67549
+ deltaMinutes += 24 * 60;
67550
+ const anchored = now.getTime() - (now.getSeconds() * 1e3 + now.getMilliseconds());
67551
+ let target = anchored + deltaMinutes * 6e4;
67552
+ for (let i = 0; i < 2; i++) {
67553
+ let diff = targetMinutesOfDay - minutesOfDayInZone(fmt, new Date(target));
67554
+ if (diff > 720)
67555
+ diff -= 1440;
67556
+ if (diff < -720)
67557
+ diff += 1440;
67558
+ if (diff === 0)
67559
+ break;
67560
+ target += diff * 6e4;
67561
+ }
67562
+ if (target <= now.getTime())
67563
+ target += 24 * 60 * 6e4;
67564
+ return new Date(target).toISOString();
67565
+ }
67566
+ function usageOf(meta) {
67567
+ const usage = {};
67568
+ if (meta.inputTokens !== void 0)
67569
+ usage.inputTokens = meta.inputTokens;
67570
+ if (meta.outputTokens !== void 0)
67571
+ usage.outputTokens = meta.outputTokens;
67572
+ if (meta.cacheReadTokens !== void 0)
67573
+ usage.cacheReadTokens = meta.cacheReadTokens;
67574
+ if (meta.cacheCreationTokens !== void 0)
67575
+ usage.cacheCreationTokens = meta.cacheCreationTokens;
67576
+ if (meta.totalCostUsd !== void 0)
67577
+ usage.costUsd = meta.totalCostUsd;
67578
+ if (meta.durationMs !== void 0)
67579
+ usage.durationMs = meta.durationMs;
67580
+ if (meta.durationApiMs !== void 0)
67581
+ usage.durationApiMs = meta.durationApiMs;
67582
+ return Object.keys(usage).length > 0 ? usage : void 0;
67583
+ }
67584
+ function classifyClaudeTurn(meta, noticeTexts, now = /* @__PURE__ */ new Date()) {
67585
+ if (!meta) {
67586
+ return { type: "turn_outcome", outcome: "runtime_crash" };
67587
+ }
67588
+ const usage = usageOf(meta);
67589
+ const evidence = [meta.resultText, ...noticeTexts].filter(Boolean).join("\n");
67590
+ const base = {
67591
+ type: "turn_outcome",
67592
+ ...usage ? { usage } : {},
67593
+ ...meta.model ? { model: meta.model } : {},
67594
+ raw: {
67595
+ ...meta.subtype ? { subtype: meta.subtype } : {},
67596
+ ...meta.terminalReason ? { terminal_reason: meta.terminalReason } : {},
67597
+ ...meta.apiErrorStatus !== void 0 ? { api_error_status: meta.apiErrorStatus } : {},
67598
+ ...meta.stopReason ? { stop_reason: meta.stopReason } : {}
67599
+ }
67600
+ };
67601
+ const withDetail = (outcome, retryAt) => ({
67602
+ ...base,
67603
+ outcome,
67604
+ ...evidence ? { detail: evidence.slice(0, DETAIL_MAX) } : {},
67605
+ ...retryAt ? { retryAt } : {}
67606
+ });
67607
+ if (meta.apiErrorStatus === 401 || meta.apiErrorStatus === 403)
67608
+ return withDetail("auth");
67609
+ if (meta.apiErrorStatus === 402)
67610
+ return withDetail("quota_exhausted");
67611
+ if (meta.apiErrorStatus === 413)
67612
+ return withDetail("context_overflow");
67613
+ if (meta.apiErrorStatus === 429) {
67614
+ if (QUOTA_TEXT.test(evidence))
67615
+ return withDetail("quota_exhausted");
67616
+ if (RATE_LIMIT_ERROR_TEXT.test(evidence))
67617
+ return withDetail("transient");
67618
+ return withDetail("usage_limit", evidence ? parseClaudeResetTime(evidence, now) : void 0);
67619
+ }
67620
+ const failed = meta.isError || // Claude CLI 2.1.220 sets terminal_reason=completed on clean result
67621
+ // frames. Any other terminal reason stays fail-closed.
67622
+ meta.terminalReason !== void 0 && meta.terminalReason !== "completed" || meta.subtype !== void 0 && meta.subtype !== "success";
67623
+ const syntheticQuiet = !failed && // A "successful" turn that never touched the API and produced no tool
67624
+ // activity is the synthetic-notice shape (limit/auth text emitted
67625
+ // locally by the CLI): zero usage + stop_sequence.
67626
+ meta.stopReason === "stop_sequence" && (meta.inputTokens ?? 0) === 0 && (meta.outputTokens ?? 0) === 0 && (meta.durationApiMs ?? 0) === 0;
67627
+ if (failed || syntheticQuiet || noticeTexts.length > 0) {
67628
+ if (CONTEXT_TEXT.test(evidence))
67629
+ return withDetail("context_overflow");
67630
+ if (QUOTA_TEXT.test(evidence))
67631
+ return withDetail("quota_exhausted");
67632
+ if (LIMIT_TEXT.test(evidence)) {
67633
+ return withDetail("usage_limit", parseClaudeResetTime(evidence, now));
67634
+ }
67635
+ if (AUTH_TEXT.test(evidence))
67636
+ return withDetail("auth");
67637
+ return withDetail("transient");
67638
+ }
67639
+ return { ...base, outcome: "ok" };
67640
+ }
67641
+
67642
+ // ts/agent-core/dist/internal/async-queue.js
67643
+ var AsyncQueue = class {
67644
+ opts;
67645
+ items = [];
67646
+ waiter = null;
67647
+ closed = false;
67648
+ droppedCount = 0;
67649
+ constructor(opts = {}) {
67650
+ this.opts = opts;
67651
+ }
67652
+ /** True once close() ran — parked items may still drain via next(). */
67653
+ get isClosed() {
67654
+ return this.closed;
67655
+ }
67656
+ /** Parked items not yet consumed. */
67657
+ get size() {
67658
+ return this.items.length;
67659
+ }
67660
+ /** Items dropped past the parked cap (diagnostics). */
67661
+ get dropped() {
67662
+ return this.droppedCount;
67663
+ }
67664
+ /** Returns false when the queue is closed (item discarded). */
67665
+ push(item) {
67666
+ if (this.closed)
67667
+ return false;
67668
+ if (this.waiter) {
67669
+ const resolve3 = this.waiter;
67670
+ this.waiter = null;
67671
+ resolve3({ value: item, done: false });
67672
+ return true;
67673
+ }
67674
+ const cap = Math.max(1, this.opts.maxParked ?? 5e3);
67675
+ if (this.items.length >= cap) {
67676
+ this.items.shift();
67677
+ if (this.droppedCount === 0)
67678
+ this.opts.onFirstDrop?.();
67679
+ this.droppedCount += 1;
67680
+ }
67681
+ this.items.push(item);
67682
+ return true;
67683
+ }
67684
+ next() {
67685
+ if (this.items.length > 0) {
67686
+ return Promise.resolve({ value: this.items.shift(), done: false });
67687
+ }
67688
+ if (this.closed) {
67689
+ return Promise.resolve({ value: void 0, done: true });
67690
+ }
67691
+ return new Promise((resolve3) => {
67692
+ this.waiter = resolve3;
67693
+ });
67694
+ }
67695
+ close() {
67696
+ if (this.closed)
67697
+ return;
67698
+ this.closed = true;
67699
+ const waiter = this.waiter;
67700
+ this.waiter = null;
67701
+ waiter?.({ value: void 0, done: true });
67702
+ }
67703
+ };
67704
+
67705
+ // ts/claude-agent/dist/turn-sink.js
67706
+ function newTurnEvidence() {
67707
+ return { noticeTexts: [], sawError: false };
67708
+ }
67709
+ function newTurnSink(label, log2) {
67710
+ return new AsyncQueue({
67711
+ onFirstDrop: () => log2?.warn?.(`Claude turn sink ${label} exceeded its parked-frame cap; dropping oldest`)
67712
+ });
67713
+ }
67714
+
67715
+ // ts/claude-agent/dist/input-lifecycle.js
67716
+ var ClaudeInputRegistry = class {
67717
+ byKey = /* @__PURE__ */ new Map();
67718
+ byCommand = /* @__PURE__ */ new Map();
67719
+ getByKey(deliveryKey) {
67720
+ return this.byKey.get(deliveryKey);
67721
+ }
67722
+ getByCommand(commandUuid) {
67723
+ return this.byCommand.get(commandUuid);
67724
+ }
67725
+ findOverlapping(dispatchEventIds) {
67726
+ const ids = new Set(dispatchEventIds);
67727
+ for (const delivery of this.byKey.values()) {
67728
+ if (delivery.lifecycle?.dispatchEventIds.some((id) => ids.has(id))) {
67729
+ return delivery;
67730
+ }
67731
+ }
67732
+ return void 0;
67733
+ }
67734
+ values() {
67735
+ return this.byKey.values();
67736
+ }
67737
+ hasPendingInjections() {
67738
+ return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.drained);
67739
+ }
67740
+ /**
67741
+ * Injected inputs whose lifecycle has NOT reached a terminal state. A
67742
+ * terminal delivery still counts as pending (its buffered copy owes frame
67743
+ * boundary bookkeeping) but owes the server nothing — the lane complete
67744
+ * defers on this predicate, never on hasPendingInjections, so a bookkeeping
67745
+ * copy that never drains cannot hold the lane open past its lease. Drained
67746
+ * is deliberately NOT part of this predicate: a discarded bookkeeping copy
67747
+ * (drained, non-terminal) is still a running input — completing its lane
67748
+ * would release the member for redrive mid-processing.
67749
+ */
67750
+ hasUnsettledInjections() {
67751
+ return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.terminal);
67752
+ }
67753
+ register(deliveryKey, lifecycle, injected, noteActivity, log2) {
67754
+ if (this.byKey.has(deliveryKey)) {
67755
+ throw new Error(`duplicate Claude delivery key ${deliveryKey}`);
67756
+ }
67757
+ const commandUuid = randomUUID8();
67758
+ const delivery = {
67759
+ deliveryKey,
67760
+ commandUuid,
67761
+ lifecycle,
67762
+ injected,
67763
+ drained: !injected,
67764
+ resultFailed: false,
67765
+ sink: newTurnSink(`delivery ${deliveryKey}`, log2),
67766
+ evidence: newTurnEvidence(),
67767
+ noteActivity,
67768
+ sessionAnnounced: false
67769
+ };
67770
+ this.byKey.set(deliveryKey, delivery);
67771
+ this.byCommand.set(delivery.commandUuid, delivery);
67772
+ return delivery;
67773
+ }
67774
+ /** Undefined while an input under the same key is still registered. */
67775
+ registerLocal(input, log2) {
67776
+ const deliveryKey = `local:${input.localKey}`;
67777
+ if (this.byKey.has(deliveryKey))
67778
+ return void 0;
67779
+ const delivery = this.register(deliveryKey, void 0, false, void 0, log2);
67780
+ const settlement = new LocalInputSettlement(input, log2);
67781
+ delivery.local = { label: input.label, settlement, surfaced: false };
67782
+ return delivery;
67783
+ }
67784
+ /** A local input not yet terminal: the CLI has (or will start) work no dispatch drains. */
67785
+ hasOpenLocalInput() {
67786
+ return [...this.byKey.values()].some((delivery) => delivery.local && !delivery.terminal);
67787
+ }
67788
+ remove(delivery) {
67789
+ if (this.byKey.get(delivery.deliveryKey) === delivery) {
67790
+ this.byKey.delete(delivery.deliveryKey);
67791
+ }
67792
+ if (this.byCommand.get(delivery.commandUuid) === delivery) {
67793
+ this.byCommand.delete(delivery.commandUuid);
67794
+ }
67795
+ }
67796
+ /**
67797
+ * The buffered copy backing this delivery was discarded without a
67798
+ * dispatch (already rendered into a frame the model saw), so the normal
67799
+ * bookkeeping drain never comes. Its frame-boundary obligation is void:
67800
+ * mark it drained so nothing waits on it, and drop it once terminal. A
67801
+ * still-running input keeps its registration — byCommand must keep routing
67802
+ * its lifecycle frames — and is dropped when its terminal state arrives
67803
+ * (see apply/fail).
67804
+ */
67805
+ discardBookkeeping(deliveryKey) {
67806
+ const delivery = this.byKey.get(deliveryKey);
67807
+ if (!delivery)
67808
+ return;
67809
+ delivery.drained = true;
67810
+ if (delivery.terminal)
67811
+ this.remove(delivery);
67812
+ }
67813
+ async apply(delivery, state) {
67814
+ if (delivery.terminal || state === "queued")
67815
+ return;
67816
+ if (state !== "cancelled" && state !== "discarded") {
67817
+ delivery.local?.settlement.settle("delivered");
67818
+ }
67819
+ if (state === "started") {
67820
+ if (delivery.reportedState)
67821
+ return;
67822
+ await delivery.lifecycle?.update("started");
67823
+ delivery.reportedState = "started";
67824
+ return;
67825
+ }
67826
+ if (state === "cancelled" || state === "discarded" || delivery.resultFailed) {
67827
+ await this.fail(delivery);
67828
+ return;
67829
+ }
67830
+ if (delivery.reportedState !== "completed") {
67831
+ await delivery.lifecycle?.update("completed");
67832
+ delivery.reportedState = "completed";
67833
+ }
67834
+ delivery.terminal = "completed";
67835
+ if (delivery.drained)
67836
+ this.remove(delivery);
67837
+ }
67838
+ async fail(delivery, detail) {
67839
+ if (delivery.terminal)
67840
+ return;
67841
+ delivery.local?.settlement.settle("not_delivered");
67842
+ if (delivery.suppressFailReport) {
67843
+ delivery.terminal = "settled";
67844
+ if (delivery.drained)
67845
+ this.remove(delivery);
67846
+ return;
67847
+ }
67848
+ try {
67849
+ if (delivery.reportedState !== "failed") {
67850
+ const classified = classifyClaudeTurn(delivery.evidence.lastResultMeta, delivery.evidence.noticeTexts);
67851
+ const result = await delivery.lifecycle?.update("failed", {
67852
+ outcomeClass: classified.outcome === "ok" || classified.outcome === "usage_limit" ? "runtime_crash" : classified.outcome,
67853
+ detail: detail ?? classified.detail ?? "Claude input failed"
67854
+ });
67855
+ delivery.reportedState = "failed";
67856
+ delivery.terminal = result && !result.pending && result.retry === false ? "settled" : "failed";
67857
+ }
67858
+ } finally {
67859
+ delivery.terminal ??= "failed";
67860
+ if (delivery.drained)
67861
+ this.remove(delivery);
67862
+ }
67863
+ }
67864
+ async failBestEffort(delivery, log2, detail) {
67865
+ try {
67866
+ await this.fail(delivery, detail);
67867
+ } catch (err) {
67868
+ log2?.warn?.(`failed to report Claude input ${delivery.commandUuid} as failed: ${String(err)}`);
67869
+ }
67870
+ }
67871
+ async failAllBestEffort(log2, detail) {
67872
+ await Promise.all([...this.byKey.values()].filter((delivery) => !delivery.terminal).map((delivery) => this.failBestEffort(delivery, log2, detail)));
67873
+ }
67874
+ };
67875
+
67526
67876
  // ts/claude-agent/dist/child-turn.js
67527
67877
  var ClaudeChildTurn = class extends RuntimeTurnBase {
67528
67878
  announce;
@@ -67909,7 +68259,7 @@ var ClaudeProcessPump = class {
67909
68259
  * A local input may join only a turn executing now (a started dispatch or
67910
68260
  * steer delivery, or an open runtime-initiated turn), and never while any
67911
68261
  * input waits to start: queued inputs start together as one turn that
67912
- * answers only the last (probes/queue-steer-2.1.292.md S3).
68262
+ * answers only the last (probes/queue-steer-2.1.318.md S3).
67913
68263
  */
67914
68264
  acceptsLocalInput() {
67915
68265
  let executing = this.runtimeTurn !== null;
@@ -67944,7 +68294,7 @@ var ClaudeProcessPump = class {
67944
68294
  /**
67945
68295
  * Dispatch abort: fail every live delivery and release its drain. Local
67946
68296
  * inputs are left alone: the CLI still runs a queued one, even after stdin
67947
- * closes (probes/queue-steer-2.1.292.md S5), so failing it here would
68297
+ * closes (probes/queue-steer-2.1.318.md S5), so failing it here would
67948
68298
  * report it undelivered and hand it out a second time.
67949
68299
  */
67950
68300
  abortDeliveries(message) {
@@ -68343,7 +68693,7 @@ function ownsFrames(delivery) {
68343
68693
  // ts/claude-agent/dist/session-manager.js
68344
68694
  import * as fs9 from "node:fs";
68345
68695
  import * as path11 from "node:path";
68346
- import { randomUUID as randomUUID8 } from "node:crypto";
68696
+ import { randomUUID as randomUUID9 } from "node:crypto";
68347
68697
  var ClaudeSessionManager = class _ClaudeSessionManager {
68348
68698
  mainSessionKey;
68349
68699
  stateFilePath;
@@ -68385,7 +68735,7 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
68385
68735
  const parentSessionId = this.sessionIds.get(parentSessionKey);
68386
68736
  if (!parentSessionId)
68387
68737
  return null;
68388
- const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${randomUUID8()}`;
68738
+ const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${randomUUID9()}`;
68389
68739
  this.pendingForkParents.set(sessionKey, parentSessionId);
68390
68740
  return {
68391
68741
  sessionKey,
@@ -68524,7 +68874,36 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
68524
68874
  };
68525
68875
 
68526
68876
  // ts/claude-agent/dist/spawn-env.js
68877
+ import * as fs10 from "node:fs";
68878
+ import * as os4 from "node:os";
68527
68879
  import * as path12 from "node:path";
68880
+ function setAsideCorruptClaudeConfig(env, log2) {
68881
+ const file = path12.join(env.CLAUDE_CONFIG_DIR || env.HOME || os4.homedir(), ".claude.json");
68882
+ let text;
68883
+ try {
68884
+ text = fs10.readFileSync(file, "utf8");
68885
+ } catch {
68886
+ return;
68887
+ }
68888
+ if (/^[\s\0]*$/.test(text))
68889
+ return;
68890
+ try {
68891
+ JSON.parse(text.replace(/^/, ""));
68892
+ return;
68893
+ } catch (err) {
68894
+ const aside = `${file}.corrupt-${Date.now()}`;
68895
+ try {
68896
+ if (fs10.lstatSync(file).isSymbolicLink()) {
68897
+ log2?.warn(`${file} is not valid JSON (${String(err)}); it links to another file, left in place`);
68898
+ return;
68899
+ }
68900
+ fs10.renameSync(file, aside);
68901
+ log2?.warn(`${file} is not valid JSON (${String(err)}); moved it to ${aside}`);
68902
+ } catch (moveErr) {
68903
+ log2?.warn(`${file} is not valid JSON and could not be moved aside: ${String(moveErr)}`);
68904
+ }
68905
+ }
68906
+ }
68528
68907
  function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
68529
68908
  const env = { ...parentEnv };
68530
68909
  if (!opts.allowApiKey) {
@@ -68575,37 +68954,8 @@ function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
68575
68954
  return result;
68576
68955
  }
68577
68956
 
68578
- // ts/claude-agent/dist/stdin-frames.js
68579
- import { randomUUID as randomUUID9 } from "node:crypto";
68580
- function writeCapabilityProbe(handle) {
68581
- const payload = JSON.stringify({
68582
- type: "user",
68583
- uuid: randomUUID9(),
68584
- parent_tool_use_id: null,
68585
- message: { role: "user", content: [] }
68586
- });
68587
- handle.proc.stdin.write(`${payload}
68588
- `);
68589
- }
68590
- function writeUserMessage(handle, text, commandUuid) {
68591
- const payload = JSON.stringify({
68592
- type: "user",
68593
- uuid: commandUuid,
68594
- parent_tool_use_id: null,
68595
- message: {
68596
- role: "user",
68597
- content: [{ type: "text", text }]
68598
- }
68599
- });
68600
- handle.proc.stdin.write(`${payload}
68601
- `);
68602
- }
68603
-
68604
68957
  // ts/claude-agent/dist/dispatch.js
68605
68958
  var IS_WIN32 = process.platform === "win32";
68606
- var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
68607
- var MissingClaudeLifecycleCapabilityError = class extends Error {
68608
- };
68609
68959
  function quoteWin32Arg(arg) {
68610
68960
  if (!/[\s"&|^<>()]/.test(arg))
68611
68961
  return arg;
@@ -68633,8 +68983,10 @@ var ClaudeCodeAdapter = class {
68633
68983
  processes = /* @__PURE__ */ new Map();
68634
68984
  /** Retired by abortDispatch while the CLI still had its own work: busy until idle, then terminated. */
68635
68985
  retiring = /* @__PURE__ */ new Set();
68636
- capabilityProbe;
68637
- capabilityProbeHandle;
68986
+ capabilityProbe = new ClaudeCapabilityProbe({
68987
+ spawnProbe: (log2) => this.spawnProcess("__capability_probe__", log2, false),
68988
+ terminateHandle: (handle) => this.terminateHandle(handle)
68989
+ });
68638
68990
  shuttingDown = false;
68639
68991
  activity;
68640
68992
  _model;
@@ -68854,7 +69206,7 @@ var ClaudeCodeAdapter = class {
68854
69206
  return void 0;
68855
69207
  const projectSlug = this.opts.workspaceDir.replace(/[/.]/g, "-");
68856
69208
  const filePath = path13.join(this.opts.claudeHome, ".claude", "projects", projectSlug, `${sessionId}.jsonl`);
68857
- return fs10.existsSync(filePath) ? filePath : void 0;
69209
+ return fs11.existsSync(filePath) ? filePath : void 0;
68858
69210
  }
68859
69211
  forkSession({ sessionKey }) {
68860
69212
  return this.opts.sessionManager.createForkSession(sessionKey);
@@ -68880,10 +69232,7 @@ var ClaudeCodeAdapter = class {
68880
69232
  }
68881
69233
  async shutdown() {
68882
69234
  this.shuttingDown = true;
68883
- if (this.capabilityProbeHandle) {
68884
- this.terminateHandle(this.capabilityProbeHandle);
68885
- this.capabilityProbeHandle = void 0;
68886
- }
69235
+ this.capabilityProbe.terminate();
68887
69236
  this.resetProcesses();
68888
69237
  await this.opts.sessionManager.shutdownAll();
68889
69238
  }
@@ -68893,7 +69242,7 @@ var ClaudeCodeAdapter = class {
68893
69242
  async *runTurn(sessionKey, promptBody, deliveryKey, lifecycle, log2, noteActivity) {
68894
69243
  let state;
68895
69244
  try {
68896
- await this.ensureRuntimeCapability(log2);
69245
+ await this.capabilityProbe.ensureRuntimeCapability(log2);
68897
69246
  state = this.ensureProcess(sessionKey, log2);
68898
69247
  } catch (err) {
68899
69248
  try {
@@ -68926,7 +69275,7 @@ var ClaudeCodeAdapter = class {
68926
69275
  /** Idle auto-compact (compact.ts): a `/compact` frame into the long-lived process. */
68927
69276
  compact(opts) {
68928
69277
  return runClaudeCompact({
68929
- ensureRuntimeCapability: (log2) => this.ensureRuntimeCapability(log2),
69278
+ ensureRuntimeCapability: (log2) => this.capabilityProbe.ensureRuntimeCapability(log2),
68930
69279
  ensureProcess: (sessionKey, log2) => this.ensureProcess(sessionKey, log2),
68931
69280
  killProcess: (sessionKey, state) => {
68932
69281
  void this.killProcess(sessionKey, state);
@@ -68935,60 +69284,6 @@ var ClaudeCodeAdapter = class {
68935
69284
  applyPendingRestart: (sessionKey, state) => this.maybeApplyRestart(sessionKey, state)
68936
69285
  }, opts);
68937
69286
  }
68938
- ensureRuntimeCapability(log2) {
68939
- if (!this.capabilityProbe) {
68940
- const probe = this.probeRuntimeCapability(log2);
68941
- this.capabilityProbe = probe.catch((err) => {
68942
- if (!(err instanceof MissingClaudeLifecycleCapabilityError)) {
68943
- this.capabilityProbe = void 0;
68944
- }
68945
- throw err;
68946
- });
68947
- }
68948
- return this.capabilityProbe;
68949
- }
68950
- /**
68951
- * Claude does not emit system.init until it receives its first stdin
68952
- * command (2.1.220 emits queued/started before init). Probe a throwaway
68953
- * process with an empty, non-WorkItem command; only after its init
68954
- * advertises msg_lifecycle_v1 may any business input enter a real process.
68955
- */
68956
- async probeRuntimeCapability(log2) {
68957
- const handle = this.spawnProcess("__capability_probe__", log2, false);
68958
- this.capabilityProbeHandle = handle;
68959
- const parser = parseClaudeStreamJson(handle.proc.stdout);
68960
- let timedOut = false;
68961
- const timer = setTimeout(() => {
68962
- timedOut = true;
68963
- this.terminateHandle(handle);
68964
- }, CAPABILITY_PROBE_TIMEOUT_MS);
68965
- timer.unref?.();
68966
- try {
68967
- writeCapabilityProbe(handle);
68968
- while (true) {
68969
- const next = await parser.next();
68970
- if (next.done) {
68971
- const detail = handle.stderrChunks.join("").trim();
68972
- if (timedOut) {
68973
- throw new Error(`Claude runtime capability probe timed out after ${CAPABILITY_PROBE_TIMEOUT_MS}ms`);
68974
- }
68975
- throw new Error(detail || "Claude exited before its runtime capability probe completed");
68976
- }
68977
- if (next.value.type !== "runtime_init")
68978
- continue;
68979
- if (!next.value.capabilities.includes("msg_lifecycle_v1")) {
68980
- throw new MissingClaudeLifecycleCapabilityError("Claude runtime lacks required msg_lifecycle_v1 capability; refusing heuristic input coverage");
68981
- }
68982
- return;
68983
- }
68984
- } finally {
68985
- clearTimeout(timer);
68986
- if (this.capabilityProbeHandle === handle) {
68987
- this.capabilityProbeHandle = void 0;
68988
- }
68989
- this.terminateHandle(handle);
68990
- }
68991
- }
68992
69287
  /**
68993
69288
  * Drain the envelopes the pump routed to `target` until its exact stdin
68994
69289
  * UUID reaches a terminal lifecycle state. Other injected inputs may start
@@ -69133,6 +69428,7 @@ var ClaudeCodeAdapter = class {
69133
69428
  capabilityBinDir: this.opts.capabilityBinDir,
69134
69429
  commandEnvFile: this.opts.commandEnvFile
69135
69430
  });
69431
+ setAsideCorruptClaudeConfig(env, log2);
69136
69432
  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})`);
69137
69433
  const proc = spawn(IS_WIN32 ? quoteWin32Arg(this.opts.claudeBin) : this.opts.claudeBin, IS_WIN32 ? args.map(quoteWin32Arg) : args, {
69138
69434
  cwd: this.opts.workspaceDir,
@@ -69216,6 +69512,8 @@ var ClaudeCodeAdapter = class {
69216
69512
  args.push("--disallowedTools", this.opts.disallowedTools.join(","));
69217
69513
  }
69218
69514
  args.push("--append-system-prompt-file", path13.join(this.opts.workspaceDir, ".parall", "system-prompt.md"));
69515
+ if (this.capabilityProbe.promptSnapshotOff)
69516
+ args.push("--system-prompt-snapshot", "off");
69219
69517
  if (this.opts.appendSystemPrompt) {
69220
69518
  args.push("--append-system-prompt", this.opts.appendSystemPrompt);
69221
69519
  }
@@ -69248,19 +69546,19 @@ var ClaudeCodeAdapter = class {
69248
69546
  };
69249
69547
 
69250
69548
  // ts/claude-agent/dist/workspace.js
69251
- import * as fs11 from "node:fs";
69549
+ import * as fs12 from "node:fs";
69252
69550
  import * as path14 from "node:path";
69253
69551
  function buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
69254
69552
  return buildClaudeCodePlatformInstructions(workspaceDir, agentIdentity, capabilityFragments);
69255
69553
  }
69256
69554
  function writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
69257
69555
  const parallDir = path14.join(workspaceDir, ".parall");
69258
- fs11.mkdirSync(parallDir, { recursive: true });
69259
- fs11.writeFileSync(path14.join(parallDir, "system-prompt.md"), buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments), "utf8");
69556
+ fs12.mkdirSync(parallDir, { recursive: true });
69557
+ fs12.writeFileSync(path14.join(parallDir, "system-prompt.md"), buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments), "utf8");
69260
69558
  }
69261
69559
  function ensureClaudeWorkspace(workspaceDir, _log, agentIdentity, capabilityFragments) {
69262
- fs11.mkdirSync(workspaceDir, { recursive: true });
69263
- fs11.mkdirSync(path14.join(workspaceDir, ".claude"), { recursive: true });
69560
+ fs12.mkdirSync(workspaceDir, { recursive: true });
69561
+ fs12.mkdirSync(path14.join(workspaceDir, ".claude"), { recursive: true });
69264
69562
  writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments);
69265
69563
  writeSkillFiles(path14.join(workspaceDir, ".parall", "skills"));
69266
69564
  ensureLocalAttachmentGitExclude(workspaceDir);
@@ -69474,7 +69772,7 @@ async function main() {
69474
69772
  runtimeFeatures: secrets ? ["agent_secrets"] : [],
69475
69773
  runtimeKey,
69476
69774
  runtimeRef: {
69477
- hostname: os4.hostname(),
69775
+ hostname: os5.hostname(),
69478
69776
  pid: process.pid,
69479
69777
  workspace_dir: config.workspaceDir,
69480
69778
  claude_home: config.claudeHome