@parall/daemon 1.87.0 → 1.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/manifest.json +13 -13
- package/bundle/parall-browser-pod.js +159 -18
- package/bundle/parall-channel-exec.js +36 -3
- package/bundle/parall-claude-agent.js +773 -514
- package/bundle/parall-codex-agent.js +283 -85
- package/bundle/parall-daemon.js +259 -20
- package/package.json +6 -6
|
@@ -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
|
|
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 =
|
|
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
|
|
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`,
|
|
@@ -52269,6 +52277,30 @@ function teamEndpoints(apiBase) {
|
|
|
52269
52277
|
};
|
|
52270
52278
|
}
|
|
52271
52279
|
|
|
52280
|
+
// ts/sdk/dist/secret-endpoints.js
|
|
52281
|
+
function secretEndpoints(apiBase) {
|
|
52282
|
+
return {
|
|
52283
|
+
AGENT_SECRETS: (orgId, agentId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets`,
|
|
52284
|
+
AGENT_SECRET: (orgId, agentId, secretId) => `${apiBase}/orgs/${orgId}/agents/${agentId}/secrets/${secretId}`,
|
|
52285
|
+
ORG_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/secrets`,
|
|
52286
|
+
ORG_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}`,
|
|
52287
|
+
/** The caller's own secrets (login session only, like the rest up to the runtime's). */
|
|
52288
|
+
ORG_MY_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/me/secrets`,
|
|
52289
|
+
ORG_MY_SECRET: (orgId, secretId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}`,
|
|
52290
|
+
ORG_MY_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/me/secrets/${secretId}/grants/${agentId}`,
|
|
52291
|
+
TEAM_SECRETS: (orgId, teamId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets`,
|
|
52292
|
+
TEAM_SECRET: (orgId, teamId, secretId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}`,
|
|
52293
|
+
TEAM_SECRET_GRANT: (orgId, teamId, secretId, agentId) => `${apiBase}/orgs/${orgId}/teams/${teamId}/secrets/${secretId}/grants/${agentId}`,
|
|
52294
|
+
/** `agentId` holds `ownerAgentId`'s own secret. */
|
|
52295
|
+
AGENT_SECRET_GRANT: (orgId, ownerAgentId, secretId, agentId) => `${apiBase}/orgs/${orgId}/agents/${ownerAgentId}/secrets/${secretId}/grants/${agentId}`,
|
|
52296
|
+
ORG_SECRET_GRANT: (orgId, secretId, agentId) => `${apiBase}/orgs/${orgId}/secrets/${secretId}/grants/${agentId}`,
|
|
52297
|
+
/** The runtime's own routes, with the agent's key. */
|
|
52298
|
+
AGENT_ME_SECRETS: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets`,
|
|
52299
|
+
AGENT_ME_SECRETS_CATALOG: (orgId, q) => `${apiBase}/orgs/${orgId}/agents/me/secrets/catalog${q ? `?q=${encodeURIComponent(q)}` : ""}`,
|
|
52300
|
+
AGENT_ME_SECRETS_APPLIED: (orgId) => `${apiBase}/orgs/${orgId}/agents/me/secrets/applied`
|
|
52301
|
+
};
|
|
52302
|
+
}
|
|
52303
|
+
|
|
52272
52304
|
// ts/sdk/dist/constants.js
|
|
52273
52305
|
var API_BASE2 = "/api/v1";
|
|
52274
52306
|
var WIKI_BASE = "/wiki/v1";
|
|
@@ -52352,6 +52384,8 @@ var ENDPOINTS = {
|
|
|
52352
52384
|
CHAT_RESTORE: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/restore`,
|
|
52353
52385
|
CHAT_MEMBERS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members`,
|
|
52354
52386
|
CHAT_MEMBER: (orgId, chatId, userId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/members/${userId}`,
|
|
52387
|
+
CHAT_BOOKMARKS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks`,
|
|
52388
|
+
CHAT_BOOKMARK: (orgId, chatId, bookmarkId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/bookmarks/${bookmarkId}`,
|
|
52355
52389
|
CHAT_INVITATIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations`,
|
|
52356
52390
|
CHAT_INVITATION: (orgId, chatId, invId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/invitations/${invId}`,
|
|
52357
52391
|
CHAT_CONNECTIONS: (orgId, chatId) => `${API_BASE2}/orgs/${orgId}/chats/${chatId}/connections`,
|
|
@@ -52394,14 +52428,7 @@ var ENDPOINTS = {
|
|
|
52394
52428
|
AGENT_ME: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me`,
|
|
52395
52429
|
AGENT_REPLY_POLICY_CAPABILITY: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/reply-policy-capability`,
|
|
52396
52430
|
AGENT_RUNTIME_REPORT: (orgId) => `${API_BASE2}/orgs/${orgId}/agents/me/runtime-report`,
|
|
52397
|
-
|
|
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`,
|
|
52431
|
+
...secretEndpoints(API_BASE2),
|
|
52405
52432
|
AGENT_NEW_SESSION: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/new-session`,
|
|
52406
52433
|
AGENT_DEEP_RESET: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/deep-reset`,
|
|
52407
52434
|
AGENT_SESSIONS: (orgId, agentId) => `${API_BASE2}/orgs/${orgId}/agents/${agentId}/sessions`,
|
|
@@ -52859,6 +52886,7 @@ var WS_EVENTS = {
|
|
|
52859
52886
|
TYPING_UPDATE: "typing.update",
|
|
52860
52887
|
CHAT_UPDATE: "chat.update",
|
|
52861
52888
|
CHAT_DELETED: "chat.deleted",
|
|
52889
|
+
CHAT_BOOKMARKS_UPDATED: "chat.bookmarks.updated",
|
|
52862
52890
|
APPROVAL_UPDATE: "approval.update",
|
|
52863
52891
|
// deprecated
|
|
52864
52892
|
CARD_UPDATE: "card.update",
|
|
@@ -53691,6 +53719,23 @@ var ClipConnectionClient = class extends ChannelConversationClient {
|
|
|
53691
53719
|
return this.request("PUT", ENDPOINTS.ORG_CLIP_MCP_CONFIG_BY_ID(orgId, clipId, configId), req, void 0, false, { headers: { "If-Match": `"${expectedVersion}"` }, timeoutMs: 4e4 });
|
|
53692
53720
|
}
|
|
53693
53721
|
// ---- Clip connections ----
|
|
53722
|
+
/** Missing keys are unknown/hidden; present empty arrays are known empty. */
|
|
53723
|
+
async listClipMCPSummaries(orgId, clipIds) {
|
|
53724
|
+
return this.readDiscoverySummaries(ENDPOINTS.CLIP_MCP_SUMMARIES(orgId), "clip_ids", clipIds);
|
|
53725
|
+
}
|
|
53726
|
+
async listEdgeProfileSummaries(orgId, edgeIds) {
|
|
53727
|
+
return this.readDiscoverySummaries(ENDPOINTS.EDGE_PROFILE_SUMMARIES(orgId), "edge_ids", edgeIds);
|
|
53728
|
+
}
|
|
53729
|
+
async readDiscoverySummaries(endpoint, key, ids) {
|
|
53730
|
+
const data = {};
|
|
53731
|
+
const unique = [...new Set(ids)];
|
|
53732
|
+
for (let offset = 0; offset < unique.length; offset += 500) {
|
|
53733
|
+
const batch = unique.slice(offset, offset + 500);
|
|
53734
|
+
const response = await this.request("GET", `${endpoint}?${key}=${encodeURIComponent(batch.join(","))}`);
|
|
53735
|
+
Object.assign(data, response.data);
|
|
53736
|
+
}
|
|
53737
|
+
return { data };
|
|
53738
|
+
}
|
|
53694
53739
|
async listClipConnections(orgId, clipId) {
|
|
53695
53740
|
return this.request("GET", ENDPOINTS.CLIP_CONNECTIONS(orgId, clipId));
|
|
53696
53741
|
}
|
|
@@ -53725,10 +53770,42 @@ var ClipConnectionClient = class extends ChannelConversationClient {
|
|
|
53725
53770
|
async cancelClipMCPOAuthAttempt(orgId, clipId, attemptId) {
|
|
53726
53771
|
return this.request("DELETE", ENDPOINTS.ORG_CLIP_MCP_OAUTH_ATTEMPT(orgId, clipId, attemptId));
|
|
53727
53772
|
}
|
|
53773
|
+
// ---- The caller's own connections (login session only) ----
|
|
53774
|
+
/** The caller's person-owned connections, optionally for one connector. */
|
|
53775
|
+
async listMyConnections(orgId, clipId) {
|
|
53776
|
+
return this.request("GET", ENDPOINTS.ORG_MY_CONNECTIONS(orgId), void 0, clipId ? { clip_id: clipId } : void 0);
|
|
53777
|
+
}
|
|
53778
|
+
/** Stop one agent from using one of the caller's connections. */
|
|
53779
|
+
async revokeMyConnectionAgent(orgId, connId, agentId) {
|
|
53780
|
+
return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION_AGENT(orgId, connId, agentId));
|
|
53781
|
+
}
|
|
53782
|
+
/** Disconnect one of the caller's connections: the connection, its credential and grants go. */
|
|
53783
|
+
async deleteMyConnection(orgId, connId) {
|
|
53784
|
+
return this.request("DELETE", ENDPOINTS.ORG_MY_CONNECTION(orgId, connId));
|
|
53785
|
+
}
|
|
53786
|
+
};
|
|
53787
|
+
|
|
53788
|
+
// ts/sdk/dist/hosted-profile-creation.js
|
|
53789
|
+
var HostedProfileCreationClient = class extends ClipConnectionClient {
|
|
53790
|
+
getHostedProfileCreationAccess(orgId, agentId) {
|
|
53791
|
+
return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId));
|
|
53792
|
+
}
|
|
53793
|
+
changeHostedProfileCreationGrant(orgId, agentId, change, key, revoke = false) {
|
|
53794
|
+
return this.request(revoke ? "DELETE" : "PUT", ENDPOINTS.ORG_HOSTED_CREATION_GRANT(orgId, agentId), change, void 0, false, { headers: { "Idempotency-Key": key } });
|
|
53795
|
+
}
|
|
53796
|
+
getHostedProfileCreationEvents(orgId, agentId, before) {
|
|
53797
|
+
return this.request("GET", ENDPOINTS.ORG_HOSTED_CREATION_EVENTS(orgId, agentId), void 0, {
|
|
53798
|
+
before
|
|
53799
|
+
});
|
|
53800
|
+
}
|
|
53801
|
+
/** A lost response is recovered with the same name and key, never a new key. */
|
|
53802
|
+
createAuthorizedHostedProfile(orgId, name, key) {
|
|
53803
|
+
return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), { name, placement: "hosted" }, void 0, false, { headers: { "Idempotency-Key": key } });
|
|
53804
|
+
}
|
|
53728
53805
|
};
|
|
53729
53806
|
|
|
53730
53807
|
// ts/sdk/dist/browser-profile-client.js
|
|
53731
|
-
var BrowserProfileClient = class extends
|
|
53808
|
+
var BrowserProfileClient = class extends HostedProfileCreationClient {
|
|
53732
53809
|
/** Metadata-only compatibility discovery. Management scope errors propagate;
|
|
53733
53810
|
* callers with a known Profile can execute without this discovery chain. */
|
|
53734
53811
|
async listBrowserUseProfiles(orgId, profileId) {
|
|
@@ -53912,7 +53989,10 @@ var UserPreferencesClient = class extends OrgAccentClient {
|
|
|
53912
53989
|
|
|
53913
53990
|
// ts/sdk/dist/secret-client.js
|
|
53914
53991
|
var AgentSecretClient = class extends UserPreferencesClient {
|
|
53915
|
-
/**
|
|
53992
|
+
/**
|
|
53993
|
+
* One agent's own secrets and those it is given — the org's, a team's,
|
|
53994
|
+
* another user's — each as this agent holds it.
|
|
53995
|
+
*/
|
|
53916
53996
|
async getAgentSecrets(orgId, agentId) {
|
|
53917
53997
|
return this.request("GET", ENDPOINTS.AGENT_SECRETS(orgId, agentId));
|
|
53918
53998
|
}
|
|
@@ -53938,13 +54018,58 @@ var AgentSecretClient = class extends UserPreferencesClient {
|
|
|
53938
54018
|
async deleteOrgSecret(orgId, secretId) {
|
|
53939
54019
|
await this.request("DELETE", ENDPOINTS.ORG_SECRET(orgId, secretId));
|
|
53940
54020
|
}
|
|
54021
|
+
/** The caller's own secrets and who each is given to. Only that person. */
|
|
54022
|
+
async getMySecrets(orgId) {
|
|
54023
|
+
return this.request("GET", ENDPOINTS.ORG_MY_SECRETS(orgId));
|
|
54024
|
+
}
|
|
54025
|
+
async createMySecret(orgId, data) {
|
|
54026
|
+
return this.request("POST", ENDPOINTS.ORG_MY_SECRETS(orgId), data);
|
|
54027
|
+
}
|
|
54028
|
+
async updateMySecret(orgId, secretId, data) {
|
|
54029
|
+
return this.request("PATCH", ENDPOINTS.ORG_MY_SECRET(orgId, secretId), data);
|
|
54030
|
+
}
|
|
54031
|
+
async deleteMySecret(orgId, secretId) {
|
|
54032
|
+
await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET(orgId, secretId));
|
|
54033
|
+
}
|
|
54034
|
+
/** A team's secrets and who each is given to: its human managers and org admins. */
|
|
54035
|
+
async getTeamSecrets(orgId, teamId) {
|
|
54036
|
+
return this.request("GET", ENDPOINTS.TEAM_SECRETS(orgId, teamId));
|
|
54037
|
+
}
|
|
54038
|
+
async createTeamSecret(orgId, teamId, data) {
|
|
54039
|
+
return this.request("POST", ENDPOINTS.TEAM_SECRETS(orgId, teamId), data);
|
|
54040
|
+
}
|
|
54041
|
+
async updateTeamSecret(orgId, teamId, secretId, data) {
|
|
54042
|
+
return this.request("PATCH", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId), data);
|
|
54043
|
+
}
|
|
54044
|
+
async deleteTeamSecret(orgId, teamId, secretId) {
|
|
54045
|
+
await this.request("DELETE", ENDPOINTS.TEAM_SECRET(orgId, teamId, secretId));
|
|
54046
|
+
}
|
|
54047
|
+
// Taking one agent off a secret, whether it holds it for long or once. A
|
|
54048
|
+
// grant the agent does not hold answers 404 SECRET_GRANT_NOT_FOUND.
|
|
54049
|
+
async revokeOrgSecretGrant(orgId, secretId, agentId) {
|
|
54050
|
+
await this.request("DELETE", ENDPOINTS.ORG_SECRET_GRANT(orgId, secretId, agentId));
|
|
54051
|
+
}
|
|
54052
|
+
async revokeMySecretGrant(orgId, secretId, agentId) {
|
|
54053
|
+
await this.request("DELETE", ENDPOINTS.ORG_MY_SECRET_GRANT(orgId, secretId, agentId));
|
|
54054
|
+
}
|
|
54055
|
+
/** Takes `agentId` off one of `ownerAgentId`'s own secrets. */
|
|
54056
|
+
async revokeAgentSecretGrant(orgId, ownerAgentId, secretId, agentId) {
|
|
54057
|
+
await this.request("DELETE", ENDPOINTS.AGENT_SECRET_GRANT(orgId, ownerAgentId, secretId, agentId));
|
|
54058
|
+
}
|
|
54059
|
+
async revokeTeamSecretGrant(orgId, teamId, secretId, agentId) {
|
|
54060
|
+
await this.request("DELETE", ENDPOINTS.TEAM_SECRET_GRANT(orgId, teamId, secretId, agentId));
|
|
54061
|
+
}
|
|
53941
54062
|
/** Agent runtime only: the values to export to the agent's commands. */
|
|
53942
54063
|
async getMyAgentSecrets(orgId) {
|
|
53943
54064
|
return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS(orgId));
|
|
53944
54065
|
}
|
|
53945
|
-
/**
|
|
53946
|
-
|
|
53947
|
-
|
|
54066
|
+
/**
|
|
54067
|
+
* Agent only: the names it holds or may ask to use, its pending requests,
|
|
54068
|
+
* and the teams it may ask in. `q` keeps the keys whose name, purpose or
|
|
54069
|
+
* owner's name contains it, ignoring case.
|
|
54070
|
+
*/
|
|
54071
|
+
async getMyAgentSecretCatalog(orgId, q) {
|
|
54072
|
+
return this.request("GET", ENDPOINTS.AGENT_ME_SECRETS_CATALOG(orgId, q));
|
|
53948
54073
|
}
|
|
53949
54074
|
/** Agent runtime only: confirm the version the commands now run with. */
|
|
53950
54075
|
async ackMyAgentSecrets(orgId, version) {
|
|
@@ -54077,6 +54202,8 @@ var BillingClient = class extends TeamGraphClient {
|
|
|
54077
54202
|
const params = new URLSearchParams();
|
|
54078
54203
|
params.set("start_date", opts.start_date);
|
|
54079
54204
|
params.set("end_date", opts.end_date);
|
|
54205
|
+
if (opts.timezone !== void 0)
|
|
54206
|
+
params.set("timezone", opts.timezone);
|
|
54080
54207
|
return this.request("GET", `${ENDPOINTS.BILLING_USAGE_DAILY(orgId, accountId)}?${params}`);
|
|
54081
54208
|
}
|
|
54082
54209
|
async getUsageHeatmap(orgId, opts, accountId) {
|
|
@@ -54278,6 +54405,20 @@ var WikiPageShareClient = class extends TeamInviteClient {
|
|
|
54278
54405
|
}
|
|
54279
54406
|
};
|
|
54280
54407
|
|
|
54408
|
+
// ts/sdk/dist/chat-bookmarks-client.js
|
|
54409
|
+
var ChatBookmarksClient = class extends WikiPageShareClient {
|
|
54410
|
+
async getChatBookmarks(orgId, chatId) {
|
|
54411
|
+
return this.request("GET", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId));
|
|
54412
|
+
}
|
|
54413
|
+
/** `ref` is a `prll://` reference or an http(s) URL. */
|
|
54414
|
+
async addChatBookmark(orgId, chatId, ref) {
|
|
54415
|
+
return this.request("POST", ENDPOINTS.CHAT_BOOKMARKS(orgId, chatId), { ref });
|
|
54416
|
+
}
|
|
54417
|
+
async removeChatBookmark(orgId, chatId, bookmarkId) {
|
|
54418
|
+
return this.request("DELETE", ENDPOINTS.CHAT_BOOKMARK(orgId, chatId, bookmarkId));
|
|
54419
|
+
}
|
|
54420
|
+
};
|
|
54421
|
+
|
|
54281
54422
|
// ts/sdk/dist/wiki-changeset.js
|
|
54282
54423
|
function normalizeWikiChangeset(changeset) {
|
|
54283
54424
|
return {
|
|
@@ -54313,7 +54454,7 @@ function legacyHeartbeatFromReport(report) {
|
|
|
54313
54454
|
detectedRuntimes
|
|
54314
54455
|
};
|
|
54315
54456
|
}
|
|
54316
|
-
var ParallClient = class _ParallClient extends
|
|
54457
|
+
var ParallClient = class _ParallClient extends ChatBookmarksClient {
|
|
54317
54458
|
baseUrl;
|
|
54318
54459
|
wikiBaseUrl;
|
|
54319
54460
|
token;
|
|
@@ -56609,7 +56750,7 @@ var ParallClient = class _ParallClient extends WikiPageShareClient {
|
|
|
56609
56750
|
return this.request("GET", ENDPOINTS.ORG_EDGE_DEVICES(orgId));
|
|
56610
56751
|
}
|
|
56611
56752
|
/** Register an Edge. `placement` defaults to BYOC; hosted creates an idle,
|
|
56612
|
-
* org-shared Cloud Profile
|
|
56753
|
+
* org-shared Cloud Profile; Agents need a separate creation grant and key. */
|
|
56613
56754
|
async registerEdgeDevice(orgId, input, options) {
|
|
56614
56755
|
const headers = options?.idempotencyKey ? { "Idempotency-Key": options.idempotencyKey } : void 0;
|
|
56615
56756
|
return this.request("POST", ENDPOINTS.ORG_EDGE(orgId), input, void 0, false, { headers });
|
|
@@ -56854,10 +56995,11 @@ var ParallClient = class _ParallClient extends WikiPageShareClient {
|
|
|
56854
56995
|
async listClipMCPConnections(orgId, clipId) {
|
|
56855
56996
|
return this.request("GET", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId));
|
|
56856
56997
|
}
|
|
56857
|
-
/** Create one MCP credential slot and its connection. */
|
|
56858
56998
|
async createClipMCPConnection(orgId, clipId, req) {
|
|
56859
56999
|
return this.request("POST", ENDPOINTS.ORG_CLIP_MCP_CONFIGS(orgId, clipId), req, void 0, false, {
|
|
56860
|
-
|
|
57000
|
+
// A card may start OAuth: allow discovery (30s) and persistence like
|
|
57001
|
+
// createClipMCPOAuthConnection.
|
|
57002
|
+
timeoutMs: "approval_id" in req ? 5e4 : 4e4
|
|
56861
57003
|
});
|
|
56862
57004
|
}
|
|
56863
57005
|
/** Delete one MCP config and its paired connection. */
|
|
@@ -57725,6 +57867,11 @@ var VENDOR_CLIS = [
|
|
|
57725
57867
|
channel: "feishu",
|
|
57726
57868
|
command: "lark-cli",
|
|
57727
57869
|
install: "npm i -g @larksuite/cli && npx skills add larksuite/cli -y -g",
|
|
57870
|
+
// Before 1.0.97, im +messages-send / +messages-reply took `--markdown
|
|
57871
|
+
// @file` (the form the official skill teaches) as the literal text
|
|
57872
|
+
// "@file", sent it and reported success
|
|
57873
|
+
// (https://github.com/larksuite/cli/pull/2760).
|
|
57874
|
+
minVersion: "1.0.97",
|
|
57728
57875
|
ownedEnv: [
|
|
57729
57876
|
// injected
|
|
57730
57877
|
"LARKSUITE_CLI_APP_ID",
|
|
@@ -63823,11 +63970,14 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
|
|
|
63823
63970
|
|
|
63824
63971
|
\u8FD0\u884C \`parall browser profiles --json\`\uFF0C\u4ECE\u53EF\u8BBF\u95EE\u5217\u8868\u6309\u8D26\u53F7\u540D\u79F0\u9009\u62E9 Profile\u3002
|
|
63825
63972
|
\u591A\u4E2A\u8D26\u53F7\u65E0\u6CD5\u533A\u5206\u65F6\u95EE\u7528\u6237\u3002\u5217\u8868\u8868\u793A\u4F60\u6709\u8BBF\u95EE\u6743\u9650\uFF0C\u4E0D\u4FDD\u8BC1\u7F51\u7AD9\u5DF2\u767B\u5F55\u6216\u6BCF\u79CD\u52A8\u4F5C\u90FD\u83B7\u6388\u6743\u3002
|
|
63826
|
-
\u6CA1\u6709\u53EF\u7528 Profile \u65F6\uFF0C\
|
|
63973
|
+
\u6CA1\u6709\u53EF\u7528 Profile \u65F6\uFF0C\u5148\u7528 \`parall cloud-profile access\` \u67E5\u8BE2\u81EA\u5DF1\u7684\u521B\u5EFA\u6388\u6743\uFF1B\u4EC5\u5728\u72B6\u6001\u4E3A active\u3001\u5269\u4F59\u6570\u91CF\u8DB3\u591F\u4E14\u4EFB\u52A1\u9700\u8981\u65B0\u7684\u7A7A\u767D hosted Profile\u65F6\uFF0C\u7528 \`parall cloud-profile create <name>\`\u3002
|
|
63974
|
+
\u521B\u5EFA\u56DE\u4F20\u7684 \`profile_id\` \u624D\u662F\u540E\u7EED \`--profile\` \u7684\u503C\uFF1B\u4E0D\u8981\u628A\u8BBE\u5907 ID \u5F53\u4F5C Profile ID\u3002
|
|
63975
|
+
\u65E0\u6709\u6548\u521B\u5EFA\u6388\u6743\u6216\u4EFB\u52A1\u9700\u8981\u5DF2\u6709\u767B\u5F55\u8D26\u53F7\u65F6\uFF0C\u95EE\u7528\u6237\uFF1A
|
|
63827
63976
|
- **\u7528\u6237\u6709 Desktop \u4F46\u4F60\u6CA1\u6743\u9650**\uFF1A\u8BF7\u7528\u6237\u544A\u8BC9\u4F60 Profile ID\uFF08\`ebp_...\`\uFF0C\u5728 Desktop\u300C\u8FDE\u63A5\u5668\u300D\u9875\u7684 Devices \u91CC\u53EF\u4EE5\u770B\u5230\uFF09\uFF0C\u7136\u540E\u901A\u8FC7\u5BA1\u6279\u5361\u8BF7\u6C42\u6388\u6743\u2014\u2014
|
|
63828
63977
|
\`parall approvals request --action browser.profile.authorize --resource prll://<ebp_id> --title "Request browser profile access" --chat prll://<cht_id>\`
|
|
63829
63978
|
\u4EBA approve \u540E\u4F60\u81EA\u52A8\u83B7\u5F97\u8BE5 Profile \u7684\u5168\u90E8\u64CD\u4F5C\u6743\u9650\u3002
|
|
63830
|
-
- **\
|
|
63979
|
+
- **\u9700\u8981\u81EA\u5EFA\u7A7A\u767D hosted Profile**\uFF1A\u8BF7\u771F\u4EBA\u7EC4\u7EC7 owner/admin \u7ED9\u4F60\u7684 Agent \`usr_\` \u6388\u4E88\u6709\u6570\u91CF\u548C\u5230\u671F\u7684\u521B\u5EFA\u6743\uFF1B\u5DF2\u5B58\u5728 Profile \u7684\u5BA1\u6279\u5361\u4E0D\u4F1A\u6388\u4E88\u521B\u5EFA\u6743\u3002
|
|
63980
|
+
- **\u9700\u8981\u672C\u673A\u6D4F\u89C8\u5668\u4E14\u7528\u6237\u6CA1\u6709 Desktop**\uFF1A\u8BF7\u7528\u6237\u5B89\u88C5\u5E76\u6253\u5F00 Parall Desktop\uFF0C\u518D\u660E\u786E\u6388\u4E88\u5BF9\u5E94 Profile \u8BBF\u95EE\u6743\uFF1B\u5B89\u88C5\u672C\u8EAB\u4E0D\u4EE3\u8868\u4F60\u5DF2\u6709\u6743\u9650\u3002
|
|
63831
63981
|
\u5217\u8868\u62A5\u9519\u65F6\u4FDD\u7559\u9519\u8BEF\uFF0C\u4E0D\u80FD\u5F53\u4F5C\u7A7A\u5217\u8868\u3002
|
|
63832
63982
|
\u7528\u6237\u5DF2\u7ED9 Profile ID \u65F6\u53EF\u76F4\u63A5\u4F7F\u7528\u3002\u6BCF\u6B21\u547D\u4EE4\u90FD\u5E26 \`--profile\`\uFF0C\u4E0D\u731C\u9ED8\u8BA4\u8D26\u53F7\u3002
|
|
63833
63983
|
|
|
@@ -63835,6 +63985,19 @@ var PARALL_BROWSER_SKILL = `# Parall Browser
|
|
|
63835
63985
|
\`profiles\` \u548C \`operation get\` \u514D\u8D39\u3002\u6309\u7528\u6237\u6388\u6743\u7684\u6B21\u6570\u548C\u9884\u7B97\u6267\u884C\uFF1B\u672A\u7ED9\u9884\u7B97\u65F6\u5148\u8BF4\u660E\u9884\u8BA1\u8D39\u7528\u3002
|
|
63836
63986
|
\u80FD\u4ECE\u5DF2\u6709\u7ED3\u679C\u56DE\u7B54\u5C31\u4E0D\u8981\u518D\u8C03\u7528\uFF1B\u4E0D\u8981\u5FAA\u73AF\u622A\u56FE\u3001\u67E5\u8BE2 tabs \u6216\u6362\u52A8\u4F5C\u8BD5\u63A2\u3002
|
|
63837
63987
|
|
|
63988
|
+
## \u81EA\u5EFA Profile \u7684\u8FB9\u754C\u4E0E\u6062\u590D
|
|
63989
|
+
|
|
63990
|
+
\u521B\u5EFA\u662F\u514D\u8D39\u7684\uFF0C\u4E5F\u4E0D\u542F\u52A8\u6D4F\u89C8\u5668\uFF1B\u540E\u7EED Browser Use \u4ECD\u6309\u539F\u89C4\u5219\u6536\u8D39\uFF0C\u521B\u5EFA\u6B21\u6570\u4E0D\u662F\u6267\u884C\u8D39\u7528\u9884\u7B97\u3002
|
|
63991
|
+
\u65B0\u5EFA\u4E3A\u7A7A\u767D\u6D4F\u89C8\u5668\uFF0C\u9ED8\u8BA4\u4E0D\u516C\u5F00\uFF0C\u53EA\u7ED9\u521B\u5EFA Agent \u5B8C\u6574 Browser Use \u6743\u9650\uFF1B\u7EF4\u62A4\u4EBA\u4E3A\u6388\u4E88\u6388\u6743\u7684\u771F\u4EBA\u3002
|
|
63992
|
+
\u4EE3\u7406\u51ED\u636E\u3001\u7F51\u7AD9\u767B\u5F55\u3001cookie \u548C\u73B0\u6709\u767B\u5F55\u6001\u9ED8\u8BA4\u4E0D\u53EF\u89E6\u78B0\uFF1B\u9700\u8981\u65F6\u8BF7\u4EBA\u5904\u7406\uFF0C\u4E0D\u81EA\u884C\u8BFB\u53D6\u3001\u514B\u9686\u6216\u914D\u7F6E\u3002
|
|
63993
|
+
\u5220\u9664\u4E0D\u8FD4\u521B\u5EFA\u540D\u989D\uFF1B\u6388\u6743\u5230\u671F\u6216\u64A4\u9500\u53EA\u505C\u6B62\u65B0\u5EFA\uFF0C\u5DF2\u6709\u6D4F\u89C8\u5668\u53CA\u72EC\u7ACB\u4F7F\u7528\u6743\u4FDD\u7559\u3002
|
|
63994
|
+
|
|
63995
|
+
- \`HOSTED_CREATION_NOT_ALLOWED\` / \`HOSTED_CREATION_LIMIT\`\uFF1A\u505C\u6B62\u65B0\u5EFA\uFF0C\u8BF7\u771F\u4EBA\u7BA1\u7406\u5458\u67E5\u770B\u6216\u4FEE\u6539\u6388\u6743\uFF1B\u4E0D\u6362 key\u3001\u8EAB\u4EFD\u6216\u5220\u8D44\u6E90\u7ED5\u8FC7\u3002
|
|
63996
|
+
- \`HOSTED_CREATION_CONFLICT\`\uFF1A\u7BA1\u7406\u53D8\u66F4\u5148\u91CD\u65B0\u8BFB\u53D6\u6388\u6743\uFF1B\u521B\u5EFA\u8BF7\u6C42\u4FDD\u7559\u539F\u53C2\u6570\u548C\u6062\u590D\u6587\u4EF6\uFF0C\u4E0D\u80FD\u6539\u540D\u6362 key \u91CD\u8BD5\u3002
|
|
63997
|
+
- \u521B\u5EFA\u6216\u7BA1\u7406\u547D\u4EE4\u62A5\u7ED3\u679C\u672A\u77E5\u65F6\uFF0C\u53EA\u7528\u8F93\u51FA\u4E2D\u7684 \`parall cloud-profile recover <file>\` \u6062\u590D\u539F\u8BF7\u6C42\uFF1B\u4E0D\u91CD\u65B0\u8FD0\u884C create/grant \u751F\u6210\u66FF\u4EE3\u8BF7\u6C42\u3002
|
|
63998
|
+
- \u6062\u590D\u7ED3\u679C \`deleted: true\` \u8868\u793A\u539F Profile \u5DF2\u5220\u9664\uFF0C\u4E0D\u80FD\u627F\u8BFA\u53EF\u7528\uFF0C\u4E5F\u4E0D\u80FD\u901A\u8FC7\u6062\u590D\u53E6\u5EFA\u4E00\u4E2A Profile\u3002
|
|
63999
|
+
- \u670D\u52A1\u7AEF\u6CA1\u6709\u6B64\u547D\u4EE4\u6216\u529F\u80FD\u4E0D\u53EF\u7528\u65F6\uFF0C\u5982\u5B9E\u62A5\u544A\u80FD\u529B\u4E0D\u53EF\u7528\uFF0C\u6CBF\u73B0\u6709 Profile \u6388\u6743\u8DEF\u5F84\u5904\u7406\u3002
|
|
64000
|
+
|
|
63838
64001
|
## \u793A\u4F8B\uFF1A\u6253\u5F00\u9875\u9762\uFF0C\u8BFB\u53D6\u6807\u9898\uFF0C\u7559\u7ED9\u7528\u6237\u67E5\u770B
|
|
63839
64002
|
|
|
63840
64003
|
\u4E0B\u9762\u5C16\u62EC\u53F7\u987B\u66FF\u6362\u4E3A\u5B9E\u9645\u8FD4\u56DE\u503C\uFF0C\u4E0D\u8981\u7167\u6284\u3002
|
|
@@ -63971,6 +64134,16 @@ parall messages list prll://cht_xxx # Read chat message history
|
|
|
63971
64134
|
parall messages list prll://cht_xxx --since 2026-01-01 # Only messages at/after a date (RFC3339 or YYYY-MM-DD)
|
|
63972
64135
|
\`\`\`
|
|
63973
64136
|
|
|
64137
|
+
A chat's **bookmarks** are the references pinned to its top, which every member
|
|
64138
|
+
sees in the bookmark bar above the messages. Use them when someone asks you to
|
|
64139
|
+
bookmark or pin something in a chat, or asks what is bookmarked there:
|
|
64140
|
+
|
|
64141
|
+
\`\`\`bash
|
|
64142
|
+
parall chats bookmarks list prll://cht_xxx
|
|
64143
|
+
parall chats bookmarks add prll://cht_xxx prll://tsk_xxx # any prll:// reference, or an https:// link
|
|
64144
|
+
parall chats bookmarks remove prll://cht_xxx prll://tsk_xxx
|
|
64145
|
+
\`\`\`
|
|
64146
|
+
|
|
63974
64147
|
## Org-Context Search
|
|
63975
64148
|
|
|
63976
64149
|
Before deciding or starting non-trivial work, search the org's real history \u2014
|
|
@@ -65112,7 +65285,7 @@ bound to the connector, and the connection is what your access is granted on.
|
|
|
65112
65285
|
\u6216\u628A\u8C03\u7528\u8005\u52A0\u5165\u8FDE\u63A5\u5668\u540D\u5355\uFF1Bagent \u672C\u7248\u4ECD\u8FD4\u56DE\u4E0B\u8FF0\u4E24\u4E2A\u9519\u8BEF\u7801\u3002
|
|
65113
65286
|
- \`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\` mean a
|
|
65114
65287
|
human has restricted who may run this connector (or through which account);
|
|
65115
|
-
|
|
65288
|
+
you cannot grant it to yourself \u2014 ask on a card (next section).
|
|
65116
65289
|
- Waiting on a cloud profile is handled by the CLI: \`EDGE_ACTIVATING\` (cold
|
|
65117
65290
|
start), \`EDGE_BUSY\` (another exec is running) and
|
|
65118
65291
|
\`EDGE_CONCURRENCY_LIMIT\` (org at capacity) are all guaranteed-unexecuted
|
|
@@ -65121,6 +65294,24 @@ bound to the connector, and the connection is what your access is granted on.
|
|
|
65121
65294
|
fails already spent that budget \u2014 report the error, do not blind-retry in
|
|
65122
65295
|
a loop.
|
|
65123
65296
|
|
|
65297
|
+
## Ask a person to connect
|
|
65298
|
+
|
|
65299
|
+
When the task needs a connector you cannot run yet \u2014 it is not installed
|
|
65300
|
+
(find it with \`parall connector search <text>\`), you have no connection to it
|
|
65301
|
+
(\`CONNECTION_NOT_FOUND\`), you are not allowed through one
|
|
65302
|
+
(\`CLIP_AGENT_NOT_ALLOWED\`, \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`) or it needs
|
|
65303
|
+
signing in again (\`MCP_OAUTH_REAUTH_REQUIRED\`) \u2014 post a card:
|
|
65304
|
+
|
|
65305
|
+
\`\`\`bash
|
|
65306
|
+
parall connector connect <connector> --reason "<what you need it for>" # the person's own account (mail, calendar, personal tools)
|
|
65307
|
+
parall connector connect <connector> --reason "<what you need it for>" --from org # a company-shared account
|
|
65308
|
+
\`\`\`
|
|
65309
|
+
|
|
65310
|
+
The card installs the connector and creates the connection \u2014 don't send the
|
|
65311
|
+
person to the Connectors page or install it yourself. Relay the sentence the
|
|
65312
|
+
command prints, carry on with what doesn't need the connector, and you are
|
|
65313
|
+
woken with the result. Use a person's account only for that person's requests.
|
|
65314
|
+
|
|
65124
65315
|
## MCP connectors (remote tool servers)
|
|
65125
65316
|
|
|
65126
65317
|
A connection with target \`mcp\` routes to a remote MCP server; the command
|
|
@@ -65138,7 +65329,7 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
|
|
|
65138
65329
|
|
|
65139
65330
|
- \`connector connections\` marks MCP rows with their auth mode, \`credential_set\`
|
|
65140
65331
|
/ \`oauth_status\` and \`tool_count\` \u2014 a \`needs_reauth\` or credential-less
|
|
65141
|
-
row will refuse exec until
|
|
65332
|
+
row will refuse exec until someone signs in again; ask on a card (above).
|
|
65142
65333
|
- \`--connection\` is REQUIRED to exec an MCP connection, exactly like every
|
|
65143
65334
|
other target. The alias tells you WHICH account you act as \u2014 always name
|
|
65144
65335
|
it.
|
|
@@ -65155,17 +65346,16 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
|
|
|
65155
65346
|
or MCP is off for this deployment \u2014 ask an org admin; retrying won't help.
|
|
65156
65347
|
- \`MCP_OAUTH_REAUTH_REQUIRED\` = that connection's authorization is no longer
|
|
65157
65348
|
valid (revoked or expired at the provider, or disconnected) \u2014 nothing ran and
|
|
65158
|
-
retrying won't help.
|
|
65159
|
-
|
|
65160
|
-
|
|
65161
|
-
usually also get an Inbox alert, but don't rely on it \u2014 still tell the user
|
|
65162
|
-
who needs to act.
|
|
65349
|
+
retrying won't help. Ask on a card (above; \`--from org\` for a
|
|
65350
|
+
company-shared account). For a person's own account the card makes a new
|
|
65351
|
+
connection: use the \`connection_id\` from the decision, not the old one.
|
|
65163
65352
|
- \`MCP_AUTH_FAILED\` = the MCP server refused this request with this
|
|
65164
65353
|
connection's credentials \u2014 nothing ran; don't retry as-is.
|
|
65165
65354
|
\`details.reason\` \`insufficient_scope\`: this account may not do that \u2014 use
|
|
65166
65355
|
a connection with the needed access, or ask an org admin to review its
|
|
65167
65356
|
permissions. \`credential_rejected\`: the saved credential is no longer
|
|
65168
|
-
accepted \u2014 an org admin must update it.
|
|
65357
|
+
accepted \u2014 an org admin must update it. On a person's own account the
|
|
65358
|
+
message says to ask that person on a card instead; follow the message.
|
|
65169
65359
|
- \`MCP_SERVER_UNREACHABLE\` = the MCP server (or its OAuth token endpoint)
|
|
65170
65360
|
could not be reached \u2014 nothing ran; safe to retry after a short wait.
|
|
65171
65361
|
- \`OUTCOME_UNKNOWN\` follows the rule below: dispatched and MAY HAVE
|
|
@@ -65179,11 +65369,11 @@ parall connector exec <connector> <tool> [json-args] --connection <ccn_|alias>
|
|
|
65179
65369
|
|
|
65180
65370
|
## Behavior rules
|
|
65181
65371
|
|
|
65182
|
-
- An authorization error
|
|
65183
|
-
\`CLIP_AGENT_CONNECTION_NOT_ALLOWED
|
|
65184
|
-
|
|
65185
|
-
an org admin to grant the
|
|
65186
|
-
|
|
65372
|
+
- An authorization error is a fail-fast \u2014 do not retry or work around it.
|
|
65373
|
+
\`CLIP_AGENT_NOT_ALLOWED\` / \`CLIP_AGENT_CONNECTION_NOT_ALLOWED\`: ask on a
|
|
65374
|
+
card with \`parall connector connect\`. \`CONNECTION_NOT_ALLOWED\`,
|
|
65375
|
+
\`PROFILE_NOT_ALLOWED\`, \`FORBIDDEN\`: ask an org admin to grant the
|
|
65376
|
+
connector or the connection.
|
|
65187
65377
|
- If the target device is offline or the call times out, report that
|
|
65188
65378
|
plainly; do not queue, and never fabricate a result for a run that errored.
|
|
65189
65379
|
- **\`OUTCOME_UNKNOWN\` is never retryable.** It means the command was
|
|
@@ -65605,7 +65795,7 @@ var SKILLS = [
|
|
|
65605
65795
|
},
|
|
65606
65796
|
{
|
|
65607
65797
|
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.",
|
|
65798
|
+
description: "Parall platform queries and lightweight agent provisioning: list org members, agents, chats, read message history, list/add/remove a chat's bookmarks (references pinned to the top of a chat), watch/unwatch threads, check identity, create another agent, walk the prll:// reference graph (resolve URIs, backlinks, multi-hop graph), or put a chart / interactive visual into a message (html-embed blocks). Use when: user asks about org members, who's online, chat history, bookmarking or pinning something in a chat, agent list, creating an agent, identity/auth questions, you want to follow or mute a thread (e.g. after `Thread Reply` wake-ups), you need to find what an entity is connected to / who references it, or a chart, comparison or small interactive tool would help in your reply.",
|
|
65609
65799
|
content: PARALL_PLATFORM_SKILL
|
|
65610
65800
|
},
|
|
65611
65801
|
{
|
|
@@ -65630,7 +65820,7 @@ var SKILLS = [
|
|
|
65630
65820
|
},
|
|
65631
65821
|
{
|
|
65632
65822
|
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.",
|
|
65823
|
+
description: "Parall connector operations (connectors were formerly called clips): list installed connectors and their connections, inspect connector commands/tools, execute connector commands on an explicit connection, and ask a person on a card to connect an account when you cannot run one yet. Use when: the task requires external capabilities (GitHub, web search, etc.), user asks about available tools/clips, or you need to call a connector command. For WRITING a new connector, use parall-clip-authoring instead.",
|
|
65634
65824
|
content: PARALL_CLIPS_SKILL
|
|
65635
65825
|
},
|
|
65636
65826
|
{
|
|
@@ -65933,7 +66123,7 @@ function createCommandEnv(opts) {
|
|
|
65933
66123
|
// ts/claude-agent/dist/dispatch.js
|
|
65934
66124
|
import { execSync as execSync2, spawn } from "node:child_process";
|
|
65935
66125
|
import { randomUUID as randomUUID10 } from "node:crypto";
|
|
65936
|
-
import * as
|
|
66126
|
+
import * as fs11 from "node:fs";
|
|
65937
66127
|
import * as path13 from "node:path";
|
|
65938
66128
|
|
|
65939
66129
|
// ts/agent-core/dist/internal/attachment-input.js
|
|
@@ -66596,7 +66786,7 @@ var ClaudeBusyTracker = class {
|
|
|
66596
66786
|
* REPLACE frame arrives BEFORE the task_notification for the task it
|
|
66597
66787
|
* removed (2.1.292 sends it after), and the notification itself carries
|
|
66598
66788
|
* only a summary. Both orders occur — self-hosted machines run whatever
|
|
66599
|
-
* CLI the user installed (probes/background-tasks-2.1.
|
|
66789
|
+
* CLI the user installed (probes/background-tasks-2.1.318.md).
|
|
66600
66790
|
*/
|
|
66601
66791
|
finishedDescriptions = /* @__PURE__ */ new Map();
|
|
66602
66792
|
constructor(holdMs = DEFAULT_FOLLOW_UP_HOLD_MS) {
|
|
@@ -66712,378 +66902,6 @@ function aggregateBusyState(states) {
|
|
|
66712
66902
|
return { activeTurns, backgroundWork, ...holdUntil !== void 0 ? { holdUntil } : {} };
|
|
66713
66903
|
}
|
|
66714
66904
|
|
|
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
66905
|
// ts/claude-agent/dist/runtime-observations.js
|
|
67088
66906
|
function claudeObservation(frame) {
|
|
67089
66907
|
const sessionId = observationField(frame.session_id);
|
|
@@ -67523,6 +67341,499 @@ function extractResultMeta(frame, isError, numTurns) {
|
|
|
67523
67341
|
return meta;
|
|
67524
67342
|
}
|
|
67525
67343
|
|
|
67344
|
+
// ts/claude-agent/dist/stdin-frames.js
|
|
67345
|
+
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
67346
|
+
function writeCapabilityProbe(handle) {
|
|
67347
|
+
const payload = JSON.stringify({
|
|
67348
|
+
type: "user",
|
|
67349
|
+
uuid: randomUUID7(),
|
|
67350
|
+
parent_tool_use_id: null,
|
|
67351
|
+
message: { role: "user", content: [] }
|
|
67352
|
+
});
|
|
67353
|
+
handle.proc.stdin.write(`${payload}
|
|
67354
|
+
`);
|
|
67355
|
+
}
|
|
67356
|
+
function writeUserMessage(handle, text, commandUuid) {
|
|
67357
|
+
const payload = JSON.stringify({
|
|
67358
|
+
type: "user",
|
|
67359
|
+
uuid: commandUuid,
|
|
67360
|
+
parent_tool_use_id: null,
|
|
67361
|
+
message: {
|
|
67362
|
+
role: "user",
|
|
67363
|
+
content: [{ type: "text", text }]
|
|
67364
|
+
}
|
|
67365
|
+
});
|
|
67366
|
+
handle.proc.stdin.write(`${payload}
|
|
67367
|
+
`);
|
|
67368
|
+
}
|
|
67369
|
+
|
|
67370
|
+
// ts/claude-agent/dist/capability-probe.js
|
|
67371
|
+
var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
|
|
67372
|
+
var MissingClaudeLifecycleCapabilityError = class extends Error {
|
|
67373
|
+
};
|
|
67374
|
+
var UnknownPromptSnapshotFlagError = class extends Error {
|
|
67375
|
+
};
|
|
67376
|
+
var ClaudeCapabilityProbe = class {
|
|
67377
|
+
host;
|
|
67378
|
+
capabilityProbe;
|
|
67379
|
+
capabilityProbeHandle;
|
|
67380
|
+
snapshotOff = true;
|
|
67381
|
+
constructor(host) {
|
|
67382
|
+
this.host = host;
|
|
67383
|
+
}
|
|
67384
|
+
/**
|
|
67385
|
+
* Whether spawns pass `--system-prompt-snapshot off`. The CLI records the
|
|
67386
|
+
* system prompt on a conversation's first request and resends that record on
|
|
67387
|
+
* every later request and --resume, so a rewritten prompt file would never
|
|
67388
|
+
* reach a resumed session (probes/system-prompt-snapshot-2.1.318.md). CLIs
|
|
67389
|
+
* that predate the recording also lack the flag and exit on it; the probe
|
|
67390
|
+
* observes that once and spawns without it from then on.
|
|
67391
|
+
*/
|
|
67392
|
+
get promptSnapshotOff() {
|
|
67393
|
+
return this.snapshotOff;
|
|
67394
|
+
}
|
|
67395
|
+
ensureRuntimeCapability(log2) {
|
|
67396
|
+
if (!this.capabilityProbe) {
|
|
67397
|
+
const probe = this.probeRuntimeCapability(log2);
|
|
67398
|
+
this.capabilityProbe = probe.catch((err) => {
|
|
67399
|
+
if (!(err instanceof MissingClaudeLifecycleCapabilityError)) {
|
|
67400
|
+
this.capabilityProbe = void 0;
|
|
67401
|
+
}
|
|
67402
|
+
throw err;
|
|
67403
|
+
});
|
|
67404
|
+
}
|
|
67405
|
+
return this.capabilityProbe;
|
|
67406
|
+
}
|
|
67407
|
+
/** Shutdown: end a probe process that is still running. */
|
|
67408
|
+
terminate() {
|
|
67409
|
+
if (this.capabilityProbeHandle) {
|
|
67410
|
+
this.host.terminateHandle(this.capabilityProbeHandle);
|
|
67411
|
+
this.capabilityProbeHandle = void 0;
|
|
67412
|
+
}
|
|
67413
|
+
}
|
|
67414
|
+
async probeRuntimeCapability(log2) {
|
|
67415
|
+
try {
|
|
67416
|
+
await this.probeOnce(log2);
|
|
67417
|
+
} catch (err) {
|
|
67418
|
+
if (!(err instanceof UnknownPromptSnapshotFlagError))
|
|
67419
|
+
throw err;
|
|
67420
|
+
this.snapshotOff = false;
|
|
67421
|
+
await this.probeOnce(log2);
|
|
67422
|
+
}
|
|
67423
|
+
}
|
|
67424
|
+
async probeOnce(log2) {
|
|
67425
|
+
const handle = this.host.spawnProbe(log2);
|
|
67426
|
+
this.capabilityProbeHandle = handle;
|
|
67427
|
+
const parser = parseClaudeStreamJson(handle.proc.stdout);
|
|
67428
|
+
let timedOut = false;
|
|
67429
|
+
const timer = setTimeout(() => {
|
|
67430
|
+
timedOut = true;
|
|
67431
|
+
this.host.terminateHandle(handle);
|
|
67432
|
+
}, CAPABILITY_PROBE_TIMEOUT_MS);
|
|
67433
|
+
timer.unref?.();
|
|
67434
|
+
try {
|
|
67435
|
+
writeCapabilityProbe(handle);
|
|
67436
|
+
while (true) {
|
|
67437
|
+
const next = await parser.next();
|
|
67438
|
+
if (next.done) {
|
|
67439
|
+
const detail = handle.stderrChunks.join("").trim();
|
|
67440
|
+
if (this.snapshotOff && detail.includes("unknown option '--system-prompt-snapshot'")) {
|
|
67441
|
+
throw new UnknownPromptSnapshotFlagError(detail);
|
|
67442
|
+
}
|
|
67443
|
+
if (timedOut) {
|
|
67444
|
+
throw new Error(`Claude runtime capability probe timed out after ${CAPABILITY_PROBE_TIMEOUT_MS}ms`);
|
|
67445
|
+
}
|
|
67446
|
+
throw new Error(detail || "Claude exited before its runtime capability probe completed");
|
|
67447
|
+
}
|
|
67448
|
+
if (next.value.type !== "runtime_init")
|
|
67449
|
+
continue;
|
|
67450
|
+
if (!next.value.capabilities.includes("msg_lifecycle_v1")) {
|
|
67451
|
+
throw new MissingClaudeLifecycleCapabilityError("Claude runtime lacks required msg_lifecycle_v1 capability; refusing heuristic input coverage");
|
|
67452
|
+
}
|
|
67453
|
+
return;
|
|
67454
|
+
}
|
|
67455
|
+
} finally {
|
|
67456
|
+
clearTimeout(timer);
|
|
67457
|
+
if (this.capabilityProbeHandle === handle) {
|
|
67458
|
+
this.capabilityProbeHandle = void 0;
|
|
67459
|
+
}
|
|
67460
|
+
this.host.terminateHandle(handle);
|
|
67461
|
+
}
|
|
67462
|
+
}
|
|
67463
|
+
};
|
|
67464
|
+
|
|
67465
|
+
// ts/claude-agent/dist/input-lifecycle.js
|
|
67466
|
+
import { randomUUID as randomUUID8 } from "node:crypto";
|
|
67467
|
+
|
|
67468
|
+
// ts/claude-agent/dist/turn-outcome.js
|
|
67469
|
+
var LIMIT_TEXT = /you'?ve (hit|reached) your .*limit|usage limit reached|weekly limit/i;
|
|
67470
|
+
var AUTH_TEXT = /not logged in|please run \/login|authentication_error|authentication_failed|failed to authenticate|invalid api key|oauth (token|session) (has )?expired|\[action required\]/i;
|
|
67471
|
+
var CONTEXT_TEXT = /prompt is too long|context (window|length) exceeded|request too large/i;
|
|
67472
|
+
var RATE_LIMIT_ERROR_TEXT = /rate_limit_error/i;
|
|
67473
|
+
var QUOTA_TEXT = /credit balance is too low|insufficient credits|insufficient_quota|payment required/i;
|
|
67474
|
+
var DETAIL_MAX = 500;
|
|
67475
|
+
function minutesOfDayInZone(fmt, at) {
|
|
67476
|
+
const parts = Object.fromEntries(fmt.formatToParts(at).filter((p) => p.type !== "literal").map((p) => [p.type, Number(p.value)]));
|
|
67477
|
+
const hour = parts.hour === 24 ? 0 : parts.hour;
|
|
67478
|
+
return hour * 60 + parts.minute;
|
|
67479
|
+
}
|
|
67480
|
+
function parseClaudeResetTime(text, now) {
|
|
67481
|
+
const m = /resets\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)?\s*\(([^)]+)\)/i.exec(text);
|
|
67482
|
+
if (!m)
|
|
67483
|
+
return void 0;
|
|
67484
|
+
let hour = Number(m[1]);
|
|
67485
|
+
const minute = m[2] ? Number(m[2]) : 0;
|
|
67486
|
+
const meridiem = m[3]?.toLowerCase();
|
|
67487
|
+
const timeZone = m[4].trim();
|
|
67488
|
+
if (!Number.isFinite(hour) || hour > 23 || minute > 59)
|
|
67489
|
+
return void 0;
|
|
67490
|
+
if (meridiem === "pm" && hour < 12)
|
|
67491
|
+
hour += 12;
|
|
67492
|
+
if (meridiem === "am" && hour === 12)
|
|
67493
|
+
hour = 0;
|
|
67494
|
+
let fmt;
|
|
67495
|
+
let nowMinutesOfDay;
|
|
67496
|
+
try {
|
|
67497
|
+
fmt = new Intl.DateTimeFormat("en-US", {
|
|
67498
|
+
timeZone,
|
|
67499
|
+
hour12: false,
|
|
67500
|
+
hour: "2-digit",
|
|
67501
|
+
minute: "2-digit"
|
|
67502
|
+
});
|
|
67503
|
+
nowMinutesOfDay = minutesOfDayInZone(fmt, now);
|
|
67504
|
+
} catch {
|
|
67505
|
+
return void 0;
|
|
67506
|
+
}
|
|
67507
|
+
const targetMinutesOfDay = hour * 60 + minute;
|
|
67508
|
+
let deltaMinutes = targetMinutesOfDay - nowMinutesOfDay;
|
|
67509
|
+
if (deltaMinutes <= 0)
|
|
67510
|
+
deltaMinutes += 24 * 60;
|
|
67511
|
+
const anchored = now.getTime() - (now.getSeconds() * 1e3 + now.getMilliseconds());
|
|
67512
|
+
let target = anchored + deltaMinutes * 6e4;
|
|
67513
|
+
for (let i = 0; i < 2; i++) {
|
|
67514
|
+
let diff = targetMinutesOfDay - minutesOfDayInZone(fmt, new Date(target));
|
|
67515
|
+
if (diff > 720)
|
|
67516
|
+
diff -= 1440;
|
|
67517
|
+
if (diff < -720)
|
|
67518
|
+
diff += 1440;
|
|
67519
|
+
if (diff === 0)
|
|
67520
|
+
break;
|
|
67521
|
+
target += diff * 6e4;
|
|
67522
|
+
}
|
|
67523
|
+
if (target <= now.getTime())
|
|
67524
|
+
target += 24 * 60 * 6e4;
|
|
67525
|
+
return new Date(target).toISOString();
|
|
67526
|
+
}
|
|
67527
|
+
function usageOf(meta) {
|
|
67528
|
+
const usage = {};
|
|
67529
|
+
if (meta.inputTokens !== void 0)
|
|
67530
|
+
usage.inputTokens = meta.inputTokens;
|
|
67531
|
+
if (meta.outputTokens !== void 0)
|
|
67532
|
+
usage.outputTokens = meta.outputTokens;
|
|
67533
|
+
if (meta.cacheReadTokens !== void 0)
|
|
67534
|
+
usage.cacheReadTokens = meta.cacheReadTokens;
|
|
67535
|
+
if (meta.cacheCreationTokens !== void 0)
|
|
67536
|
+
usage.cacheCreationTokens = meta.cacheCreationTokens;
|
|
67537
|
+
if (meta.totalCostUsd !== void 0)
|
|
67538
|
+
usage.costUsd = meta.totalCostUsd;
|
|
67539
|
+
if (meta.durationMs !== void 0)
|
|
67540
|
+
usage.durationMs = meta.durationMs;
|
|
67541
|
+
if (meta.durationApiMs !== void 0)
|
|
67542
|
+
usage.durationApiMs = meta.durationApiMs;
|
|
67543
|
+
return Object.keys(usage).length > 0 ? usage : void 0;
|
|
67544
|
+
}
|
|
67545
|
+
function classifyClaudeTurn(meta, noticeTexts, now = /* @__PURE__ */ new Date()) {
|
|
67546
|
+
if (!meta) {
|
|
67547
|
+
return { type: "turn_outcome", outcome: "runtime_crash" };
|
|
67548
|
+
}
|
|
67549
|
+
const usage = usageOf(meta);
|
|
67550
|
+
const evidence = [meta.resultText, ...noticeTexts].filter(Boolean).join("\n");
|
|
67551
|
+
const base = {
|
|
67552
|
+
type: "turn_outcome",
|
|
67553
|
+
...usage ? { usage } : {},
|
|
67554
|
+
...meta.model ? { model: meta.model } : {},
|
|
67555
|
+
raw: {
|
|
67556
|
+
...meta.subtype ? { subtype: meta.subtype } : {},
|
|
67557
|
+
...meta.terminalReason ? { terminal_reason: meta.terminalReason } : {},
|
|
67558
|
+
...meta.apiErrorStatus !== void 0 ? { api_error_status: meta.apiErrorStatus } : {},
|
|
67559
|
+
...meta.stopReason ? { stop_reason: meta.stopReason } : {}
|
|
67560
|
+
}
|
|
67561
|
+
};
|
|
67562
|
+
const withDetail = (outcome, retryAt) => ({
|
|
67563
|
+
...base,
|
|
67564
|
+
outcome,
|
|
67565
|
+
...evidence ? { detail: evidence.slice(0, DETAIL_MAX) } : {},
|
|
67566
|
+
...retryAt ? { retryAt } : {}
|
|
67567
|
+
});
|
|
67568
|
+
if (meta.apiErrorStatus === 401 || meta.apiErrorStatus === 403)
|
|
67569
|
+
return withDetail("auth");
|
|
67570
|
+
if (meta.apiErrorStatus === 402)
|
|
67571
|
+
return withDetail("quota_exhausted");
|
|
67572
|
+
if (meta.apiErrorStatus === 413)
|
|
67573
|
+
return withDetail("context_overflow");
|
|
67574
|
+
if (meta.apiErrorStatus === 429) {
|
|
67575
|
+
if (QUOTA_TEXT.test(evidence))
|
|
67576
|
+
return withDetail("quota_exhausted");
|
|
67577
|
+
if (RATE_LIMIT_ERROR_TEXT.test(evidence))
|
|
67578
|
+
return withDetail("transient");
|
|
67579
|
+
return withDetail("usage_limit", evidence ? parseClaudeResetTime(evidence, now) : void 0);
|
|
67580
|
+
}
|
|
67581
|
+
const failed = meta.isError || // Claude CLI 2.1.220 sets terminal_reason=completed on clean result
|
|
67582
|
+
// frames. Any other terminal reason stays fail-closed.
|
|
67583
|
+
meta.terminalReason !== void 0 && meta.terminalReason !== "completed" || meta.subtype !== void 0 && meta.subtype !== "success";
|
|
67584
|
+
const syntheticQuiet = !failed && // A "successful" turn that never touched the API and produced no tool
|
|
67585
|
+
// activity is the synthetic-notice shape (limit/auth text emitted
|
|
67586
|
+
// locally by the CLI): zero usage + stop_sequence.
|
|
67587
|
+
meta.stopReason === "stop_sequence" && (meta.inputTokens ?? 0) === 0 && (meta.outputTokens ?? 0) === 0 && (meta.durationApiMs ?? 0) === 0;
|
|
67588
|
+
if (failed || syntheticQuiet || noticeTexts.length > 0) {
|
|
67589
|
+
if (CONTEXT_TEXT.test(evidence))
|
|
67590
|
+
return withDetail("context_overflow");
|
|
67591
|
+
if (QUOTA_TEXT.test(evidence))
|
|
67592
|
+
return withDetail("quota_exhausted");
|
|
67593
|
+
if (LIMIT_TEXT.test(evidence)) {
|
|
67594
|
+
return withDetail("usage_limit", parseClaudeResetTime(evidence, now));
|
|
67595
|
+
}
|
|
67596
|
+
if (AUTH_TEXT.test(evidence))
|
|
67597
|
+
return withDetail("auth");
|
|
67598
|
+
return withDetail("transient");
|
|
67599
|
+
}
|
|
67600
|
+
return { ...base, outcome: "ok" };
|
|
67601
|
+
}
|
|
67602
|
+
|
|
67603
|
+
// ts/agent-core/dist/internal/async-queue.js
|
|
67604
|
+
var AsyncQueue = class {
|
|
67605
|
+
opts;
|
|
67606
|
+
items = [];
|
|
67607
|
+
waiter = null;
|
|
67608
|
+
closed = false;
|
|
67609
|
+
droppedCount = 0;
|
|
67610
|
+
constructor(opts = {}) {
|
|
67611
|
+
this.opts = opts;
|
|
67612
|
+
}
|
|
67613
|
+
/** True once close() ran — parked items may still drain via next(). */
|
|
67614
|
+
get isClosed() {
|
|
67615
|
+
return this.closed;
|
|
67616
|
+
}
|
|
67617
|
+
/** Parked items not yet consumed. */
|
|
67618
|
+
get size() {
|
|
67619
|
+
return this.items.length;
|
|
67620
|
+
}
|
|
67621
|
+
/** Items dropped past the parked cap (diagnostics). */
|
|
67622
|
+
get dropped() {
|
|
67623
|
+
return this.droppedCount;
|
|
67624
|
+
}
|
|
67625
|
+
/** Returns false when the queue is closed (item discarded). */
|
|
67626
|
+
push(item) {
|
|
67627
|
+
if (this.closed)
|
|
67628
|
+
return false;
|
|
67629
|
+
if (this.waiter) {
|
|
67630
|
+
const resolve3 = this.waiter;
|
|
67631
|
+
this.waiter = null;
|
|
67632
|
+
resolve3({ value: item, done: false });
|
|
67633
|
+
return true;
|
|
67634
|
+
}
|
|
67635
|
+
const cap = Math.max(1, this.opts.maxParked ?? 5e3);
|
|
67636
|
+
if (this.items.length >= cap) {
|
|
67637
|
+
this.items.shift();
|
|
67638
|
+
if (this.droppedCount === 0)
|
|
67639
|
+
this.opts.onFirstDrop?.();
|
|
67640
|
+
this.droppedCount += 1;
|
|
67641
|
+
}
|
|
67642
|
+
this.items.push(item);
|
|
67643
|
+
return true;
|
|
67644
|
+
}
|
|
67645
|
+
next() {
|
|
67646
|
+
if (this.items.length > 0) {
|
|
67647
|
+
return Promise.resolve({ value: this.items.shift(), done: false });
|
|
67648
|
+
}
|
|
67649
|
+
if (this.closed) {
|
|
67650
|
+
return Promise.resolve({ value: void 0, done: true });
|
|
67651
|
+
}
|
|
67652
|
+
return new Promise((resolve3) => {
|
|
67653
|
+
this.waiter = resolve3;
|
|
67654
|
+
});
|
|
67655
|
+
}
|
|
67656
|
+
close() {
|
|
67657
|
+
if (this.closed)
|
|
67658
|
+
return;
|
|
67659
|
+
this.closed = true;
|
|
67660
|
+
const waiter = this.waiter;
|
|
67661
|
+
this.waiter = null;
|
|
67662
|
+
waiter?.({ value: void 0, done: true });
|
|
67663
|
+
}
|
|
67664
|
+
};
|
|
67665
|
+
|
|
67666
|
+
// ts/claude-agent/dist/turn-sink.js
|
|
67667
|
+
function newTurnEvidence() {
|
|
67668
|
+
return { noticeTexts: [], sawError: false };
|
|
67669
|
+
}
|
|
67670
|
+
function newTurnSink(label, log2) {
|
|
67671
|
+
return new AsyncQueue({
|
|
67672
|
+
onFirstDrop: () => log2?.warn?.(`Claude turn sink ${label} exceeded its parked-frame cap; dropping oldest`)
|
|
67673
|
+
});
|
|
67674
|
+
}
|
|
67675
|
+
|
|
67676
|
+
// ts/claude-agent/dist/input-lifecycle.js
|
|
67677
|
+
var ClaudeInputRegistry = class {
|
|
67678
|
+
byKey = /* @__PURE__ */ new Map();
|
|
67679
|
+
byCommand = /* @__PURE__ */ new Map();
|
|
67680
|
+
getByKey(deliveryKey) {
|
|
67681
|
+
return this.byKey.get(deliveryKey);
|
|
67682
|
+
}
|
|
67683
|
+
getByCommand(commandUuid) {
|
|
67684
|
+
return this.byCommand.get(commandUuid);
|
|
67685
|
+
}
|
|
67686
|
+
findOverlapping(dispatchEventIds) {
|
|
67687
|
+
const ids = new Set(dispatchEventIds);
|
|
67688
|
+
for (const delivery of this.byKey.values()) {
|
|
67689
|
+
if (delivery.lifecycle?.dispatchEventIds.some((id) => ids.has(id))) {
|
|
67690
|
+
return delivery;
|
|
67691
|
+
}
|
|
67692
|
+
}
|
|
67693
|
+
return void 0;
|
|
67694
|
+
}
|
|
67695
|
+
values() {
|
|
67696
|
+
return this.byKey.values();
|
|
67697
|
+
}
|
|
67698
|
+
hasPendingInjections() {
|
|
67699
|
+
return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.drained);
|
|
67700
|
+
}
|
|
67701
|
+
/**
|
|
67702
|
+
* Injected inputs whose lifecycle has NOT reached a terminal state. A
|
|
67703
|
+
* terminal delivery still counts as pending (its buffered copy owes frame
|
|
67704
|
+
* boundary bookkeeping) but owes the server nothing — the lane complete
|
|
67705
|
+
* defers on this predicate, never on hasPendingInjections, so a bookkeeping
|
|
67706
|
+
* copy that never drains cannot hold the lane open past its lease. Drained
|
|
67707
|
+
* is deliberately NOT part of this predicate: a discarded bookkeeping copy
|
|
67708
|
+
* (drained, non-terminal) is still a running input — completing its lane
|
|
67709
|
+
* would release the member for redrive mid-processing.
|
|
67710
|
+
*/
|
|
67711
|
+
hasUnsettledInjections() {
|
|
67712
|
+
return [...this.byKey.values()].some((delivery) => delivery.injected && !delivery.terminal);
|
|
67713
|
+
}
|
|
67714
|
+
register(deliveryKey, lifecycle, injected, noteActivity, log2) {
|
|
67715
|
+
if (this.byKey.has(deliveryKey)) {
|
|
67716
|
+
throw new Error(`duplicate Claude delivery key ${deliveryKey}`);
|
|
67717
|
+
}
|
|
67718
|
+
const commandUuid = randomUUID8();
|
|
67719
|
+
const delivery = {
|
|
67720
|
+
deliveryKey,
|
|
67721
|
+
commandUuid,
|
|
67722
|
+
lifecycle,
|
|
67723
|
+
injected,
|
|
67724
|
+
drained: !injected,
|
|
67725
|
+
resultFailed: false,
|
|
67726
|
+
sink: newTurnSink(`delivery ${deliveryKey}`, log2),
|
|
67727
|
+
evidence: newTurnEvidence(),
|
|
67728
|
+
noteActivity,
|
|
67729
|
+
sessionAnnounced: false
|
|
67730
|
+
};
|
|
67731
|
+
this.byKey.set(deliveryKey, delivery);
|
|
67732
|
+
this.byCommand.set(delivery.commandUuid, delivery);
|
|
67733
|
+
return delivery;
|
|
67734
|
+
}
|
|
67735
|
+
/** Undefined while an input under the same key is still registered. */
|
|
67736
|
+
registerLocal(input, log2) {
|
|
67737
|
+
const deliveryKey = `local:${input.localKey}`;
|
|
67738
|
+
if (this.byKey.has(deliveryKey))
|
|
67739
|
+
return void 0;
|
|
67740
|
+
const delivery = this.register(deliveryKey, void 0, false, void 0, log2);
|
|
67741
|
+
const settlement = new LocalInputSettlement(input, log2);
|
|
67742
|
+
delivery.local = { label: input.label, settlement, surfaced: false };
|
|
67743
|
+
return delivery;
|
|
67744
|
+
}
|
|
67745
|
+
/** A local input not yet terminal: the CLI has (or will start) work no dispatch drains. */
|
|
67746
|
+
hasOpenLocalInput() {
|
|
67747
|
+
return [...this.byKey.values()].some((delivery) => delivery.local && !delivery.terminal);
|
|
67748
|
+
}
|
|
67749
|
+
remove(delivery) {
|
|
67750
|
+
if (this.byKey.get(delivery.deliveryKey) === delivery) {
|
|
67751
|
+
this.byKey.delete(delivery.deliveryKey);
|
|
67752
|
+
}
|
|
67753
|
+
if (this.byCommand.get(delivery.commandUuid) === delivery) {
|
|
67754
|
+
this.byCommand.delete(delivery.commandUuid);
|
|
67755
|
+
}
|
|
67756
|
+
}
|
|
67757
|
+
/**
|
|
67758
|
+
* The buffered copy backing this delivery was discarded without a
|
|
67759
|
+
* dispatch (already rendered into a frame the model saw), so the normal
|
|
67760
|
+
* bookkeeping drain never comes. Its frame-boundary obligation is void:
|
|
67761
|
+
* mark it drained so nothing waits on it, and drop it once terminal. A
|
|
67762
|
+
* still-running input keeps its registration — byCommand must keep routing
|
|
67763
|
+
* its lifecycle frames — and is dropped when its terminal state arrives
|
|
67764
|
+
* (see apply/fail).
|
|
67765
|
+
*/
|
|
67766
|
+
discardBookkeeping(deliveryKey) {
|
|
67767
|
+
const delivery = this.byKey.get(deliveryKey);
|
|
67768
|
+
if (!delivery)
|
|
67769
|
+
return;
|
|
67770
|
+
delivery.drained = true;
|
|
67771
|
+
if (delivery.terminal)
|
|
67772
|
+
this.remove(delivery);
|
|
67773
|
+
}
|
|
67774
|
+
async apply(delivery, state) {
|
|
67775
|
+
if (delivery.terminal || state === "queued")
|
|
67776
|
+
return;
|
|
67777
|
+
if (state !== "cancelled" && state !== "discarded") {
|
|
67778
|
+
delivery.local?.settlement.settle("delivered");
|
|
67779
|
+
}
|
|
67780
|
+
if (state === "started") {
|
|
67781
|
+
if (delivery.reportedState)
|
|
67782
|
+
return;
|
|
67783
|
+
await delivery.lifecycle?.update("started");
|
|
67784
|
+
delivery.reportedState = "started";
|
|
67785
|
+
return;
|
|
67786
|
+
}
|
|
67787
|
+
if (state === "cancelled" || state === "discarded" || delivery.resultFailed) {
|
|
67788
|
+
await this.fail(delivery);
|
|
67789
|
+
return;
|
|
67790
|
+
}
|
|
67791
|
+
if (delivery.reportedState !== "completed") {
|
|
67792
|
+
await delivery.lifecycle?.update("completed");
|
|
67793
|
+
delivery.reportedState = "completed";
|
|
67794
|
+
}
|
|
67795
|
+
delivery.terminal = "completed";
|
|
67796
|
+
if (delivery.drained)
|
|
67797
|
+
this.remove(delivery);
|
|
67798
|
+
}
|
|
67799
|
+
async fail(delivery, detail) {
|
|
67800
|
+
if (delivery.terminal)
|
|
67801
|
+
return;
|
|
67802
|
+
delivery.local?.settlement.settle("not_delivered");
|
|
67803
|
+
if (delivery.suppressFailReport) {
|
|
67804
|
+
delivery.terminal = "settled";
|
|
67805
|
+
if (delivery.drained)
|
|
67806
|
+
this.remove(delivery);
|
|
67807
|
+
return;
|
|
67808
|
+
}
|
|
67809
|
+
try {
|
|
67810
|
+
if (delivery.reportedState !== "failed") {
|
|
67811
|
+
const classified = classifyClaudeTurn(delivery.evidence.lastResultMeta, delivery.evidence.noticeTexts);
|
|
67812
|
+
const result = await delivery.lifecycle?.update("failed", {
|
|
67813
|
+
outcomeClass: classified.outcome === "ok" || classified.outcome === "usage_limit" ? "runtime_crash" : classified.outcome,
|
|
67814
|
+
detail: detail ?? classified.detail ?? "Claude input failed"
|
|
67815
|
+
});
|
|
67816
|
+
delivery.reportedState = "failed";
|
|
67817
|
+
delivery.terminal = result && !result.pending && result.retry === false ? "settled" : "failed";
|
|
67818
|
+
}
|
|
67819
|
+
} finally {
|
|
67820
|
+
delivery.terminal ??= "failed";
|
|
67821
|
+
if (delivery.drained)
|
|
67822
|
+
this.remove(delivery);
|
|
67823
|
+
}
|
|
67824
|
+
}
|
|
67825
|
+
async failBestEffort(delivery, log2, detail) {
|
|
67826
|
+
try {
|
|
67827
|
+
await this.fail(delivery, detail);
|
|
67828
|
+
} catch (err) {
|
|
67829
|
+
log2?.warn?.(`failed to report Claude input ${delivery.commandUuid} as failed: ${String(err)}`);
|
|
67830
|
+
}
|
|
67831
|
+
}
|
|
67832
|
+
async failAllBestEffort(log2, detail) {
|
|
67833
|
+
await Promise.all([...this.byKey.values()].filter((delivery) => !delivery.terminal).map((delivery) => this.failBestEffort(delivery, log2, detail)));
|
|
67834
|
+
}
|
|
67835
|
+
};
|
|
67836
|
+
|
|
67526
67837
|
// ts/claude-agent/dist/child-turn.js
|
|
67527
67838
|
var ClaudeChildTurn = class extends RuntimeTurnBase {
|
|
67528
67839
|
announce;
|
|
@@ -67909,7 +68220,7 @@ var ClaudeProcessPump = class {
|
|
|
67909
68220
|
* A local input may join only a turn executing now (a started dispatch or
|
|
67910
68221
|
* steer delivery, or an open runtime-initiated turn), and never while any
|
|
67911
68222
|
* input waits to start: queued inputs start together as one turn that
|
|
67912
|
-
* answers only the last (probes/queue-steer-2.1.
|
|
68223
|
+
* answers only the last (probes/queue-steer-2.1.318.md S3).
|
|
67913
68224
|
*/
|
|
67914
68225
|
acceptsLocalInput() {
|
|
67915
68226
|
let executing = this.runtimeTurn !== null;
|
|
@@ -67944,7 +68255,7 @@ var ClaudeProcessPump = class {
|
|
|
67944
68255
|
/**
|
|
67945
68256
|
* Dispatch abort: fail every live delivery and release its drain. Local
|
|
67946
68257
|
* inputs are left alone: the CLI still runs a queued one, even after stdin
|
|
67947
|
-
* closes (probes/queue-steer-2.1.
|
|
68258
|
+
* closes (probes/queue-steer-2.1.318.md S5), so failing it here would
|
|
67948
68259
|
* report it undelivered and hand it out a second time.
|
|
67949
68260
|
*/
|
|
67950
68261
|
abortDeliveries(message) {
|
|
@@ -68343,7 +68654,7 @@ function ownsFrames(delivery) {
|
|
|
68343
68654
|
// ts/claude-agent/dist/session-manager.js
|
|
68344
68655
|
import * as fs9 from "node:fs";
|
|
68345
68656
|
import * as path11 from "node:path";
|
|
68346
|
-
import { randomUUID as
|
|
68657
|
+
import { randomUUID as randomUUID9 } from "node:crypto";
|
|
68347
68658
|
var ClaudeSessionManager = class _ClaudeSessionManager {
|
|
68348
68659
|
mainSessionKey;
|
|
68349
68660
|
stateFilePath;
|
|
@@ -68385,7 +68696,7 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
|
|
|
68385
68696
|
const parentSessionId = this.sessionIds.get(parentSessionKey);
|
|
68386
68697
|
if (!parentSessionId)
|
|
68387
68698
|
return null;
|
|
68388
|
-
const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${
|
|
68699
|
+
const sessionKey = `${_ClaudeSessionManager.FORK_LANE_PREFIX}${randomUUID9()}`;
|
|
68389
68700
|
this.pendingForkParents.set(sessionKey, parentSessionId);
|
|
68390
68701
|
return {
|
|
68391
68702
|
sessionKey,
|
|
@@ -68524,7 +68835,36 @@ var ClaudeSessionManager = class _ClaudeSessionManager {
|
|
|
68524
68835
|
};
|
|
68525
68836
|
|
|
68526
68837
|
// ts/claude-agent/dist/spawn-env.js
|
|
68838
|
+
import * as fs10 from "node:fs";
|
|
68839
|
+
import * as os4 from "node:os";
|
|
68527
68840
|
import * as path12 from "node:path";
|
|
68841
|
+
function setAsideCorruptClaudeConfig(env, log2) {
|
|
68842
|
+
const file = path12.join(env.CLAUDE_CONFIG_DIR || env.HOME || os4.homedir(), ".claude.json");
|
|
68843
|
+
let text;
|
|
68844
|
+
try {
|
|
68845
|
+
text = fs10.readFileSync(file, "utf8");
|
|
68846
|
+
} catch {
|
|
68847
|
+
return;
|
|
68848
|
+
}
|
|
68849
|
+
if (/^[\s\0]*$/.test(text))
|
|
68850
|
+
return;
|
|
68851
|
+
try {
|
|
68852
|
+
JSON.parse(text.replace(/^/, ""));
|
|
68853
|
+
return;
|
|
68854
|
+
} catch (err) {
|
|
68855
|
+
const aside = `${file}.corrupt-${Date.now()}`;
|
|
68856
|
+
try {
|
|
68857
|
+
if (fs10.lstatSync(file).isSymbolicLink()) {
|
|
68858
|
+
log2?.warn(`${file} is not valid JSON (${String(err)}); it links to another file, left in place`);
|
|
68859
|
+
return;
|
|
68860
|
+
}
|
|
68861
|
+
fs10.renameSync(file, aside);
|
|
68862
|
+
log2?.warn(`${file} is not valid JSON (${String(err)}); moved it to ${aside}`);
|
|
68863
|
+
} catch (moveErr) {
|
|
68864
|
+
log2?.warn(`${file} is not valid JSON and could not be moved aside: ${String(moveErr)}`);
|
|
68865
|
+
}
|
|
68866
|
+
}
|
|
68867
|
+
}
|
|
68528
68868
|
function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
|
|
68529
68869
|
const env = { ...parentEnv };
|
|
68530
68870
|
if (!opts.allowApiKey) {
|
|
@@ -68575,37 +68915,8 @@ function buildSpawnEnv(parentEnv, claudeHome, context2, opts) {
|
|
|
68575
68915
|
return result;
|
|
68576
68916
|
}
|
|
68577
68917
|
|
|
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
68918
|
// ts/claude-agent/dist/dispatch.js
|
|
68605
68919
|
var IS_WIN32 = process.platform === "win32";
|
|
68606
|
-
var CAPABILITY_PROBE_TIMEOUT_MS = 15e3;
|
|
68607
|
-
var MissingClaudeLifecycleCapabilityError = class extends Error {
|
|
68608
|
-
};
|
|
68609
68920
|
function quoteWin32Arg(arg) {
|
|
68610
68921
|
if (!/[\s"&|^<>()]/.test(arg))
|
|
68611
68922
|
return arg;
|
|
@@ -68633,8 +68944,10 @@ var ClaudeCodeAdapter = class {
|
|
|
68633
68944
|
processes = /* @__PURE__ */ new Map();
|
|
68634
68945
|
/** Retired by abortDispatch while the CLI still had its own work: busy until idle, then terminated. */
|
|
68635
68946
|
retiring = /* @__PURE__ */ new Set();
|
|
68636
|
-
capabilityProbe
|
|
68637
|
-
|
|
68947
|
+
capabilityProbe = new ClaudeCapabilityProbe({
|
|
68948
|
+
spawnProbe: (log2) => this.spawnProcess("__capability_probe__", log2, false),
|
|
68949
|
+
terminateHandle: (handle) => this.terminateHandle(handle)
|
|
68950
|
+
});
|
|
68638
68951
|
shuttingDown = false;
|
|
68639
68952
|
activity;
|
|
68640
68953
|
_model;
|
|
@@ -68854,7 +69167,7 @@ var ClaudeCodeAdapter = class {
|
|
|
68854
69167
|
return void 0;
|
|
68855
69168
|
const projectSlug = this.opts.workspaceDir.replace(/[/.]/g, "-");
|
|
68856
69169
|
const filePath = path13.join(this.opts.claudeHome, ".claude", "projects", projectSlug, `${sessionId}.jsonl`);
|
|
68857
|
-
return
|
|
69170
|
+
return fs11.existsSync(filePath) ? filePath : void 0;
|
|
68858
69171
|
}
|
|
68859
69172
|
forkSession({ sessionKey }) {
|
|
68860
69173
|
return this.opts.sessionManager.createForkSession(sessionKey);
|
|
@@ -68880,10 +69193,7 @@ var ClaudeCodeAdapter = class {
|
|
|
68880
69193
|
}
|
|
68881
69194
|
async shutdown() {
|
|
68882
69195
|
this.shuttingDown = true;
|
|
68883
|
-
|
|
68884
|
-
this.terminateHandle(this.capabilityProbeHandle);
|
|
68885
|
-
this.capabilityProbeHandle = void 0;
|
|
68886
|
-
}
|
|
69196
|
+
this.capabilityProbe.terminate();
|
|
68887
69197
|
this.resetProcesses();
|
|
68888
69198
|
await this.opts.sessionManager.shutdownAll();
|
|
68889
69199
|
}
|
|
@@ -68893,7 +69203,7 @@ var ClaudeCodeAdapter = class {
|
|
|
68893
69203
|
async *runTurn(sessionKey, promptBody, deliveryKey, lifecycle, log2, noteActivity) {
|
|
68894
69204
|
let state;
|
|
68895
69205
|
try {
|
|
68896
|
-
await this.ensureRuntimeCapability(log2);
|
|
69206
|
+
await this.capabilityProbe.ensureRuntimeCapability(log2);
|
|
68897
69207
|
state = this.ensureProcess(sessionKey, log2);
|
|
68898
69208
|
} catch (err) {
|
|
68899
69209
|
try {
|
|
@@ -68926,7 +69236,7 @@ var ClaudeCodeAdapter = class {
|
|
|
68926
69236
|
/** Idle auto-compact (compact.ts): a `/compact` frame into the long-lived process. */
|
|
68927
69237
|
compact(opts) {
|
|
68928
69238
|
return runClaudeCompact({
|
|
68929
|
-
ensureRuntimeCapability: (log2) => this.ensureRuntimeCapability(log2),
|
|
69239
|
+
ensureRuntimeCapability: (log2) => this.capabilityProbe.ensureRuntimeCapability(log2),
|
|
68930
69240
|
ensureProcess: (sessionKey, log2) => this.ensureProcess(sessionKey, log2),
|
|
68931
69241
|
killProcess: (sessionKey, state) => {
|
|
68932
69242
|
void this.killProcess(sessionKey, state);
|
|
@@ -68935,60 +69245,6 @@ var ClaudeCodeAdapter = class {
|
|
|
68935
69245
|
applyPendingRestart: (sessionKey, state) => this.maybeApplyRestart(sessionKey, state)
|
|
68936
69246
|
}, opts);
|
|
68937
69247
|
}
|
|
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
69248
|
/**
|
|
68993
69249
|
* Drain the envelopes the pump routed to `target` until its exact stdin
|
|
68994
69250
|
* UUID reaches a terminal lifecycle state. Other injected inputs may start
|
|
@@ -69133,6 +69389,7 @@ var ClaudeCodeAdapter = class {
|
|
|
69133
69389
|
capabilityBinDir: this.opts.capabilityBinDir,
|
|
69134
69390
|
commandEnvFile: this.opts.commandEnvFile
|
|
69135
69391
|
});
|
|
69392
|
+
setAsideCorruptClaudeConfig(env, log2);
|
|
69136
69393
|
log2?.info(`spawn long-lived ${this.opts.claudeBin} (session ${sessionKey}, model=${this._model || "default"}, context=${this._contextWindow || "cli-default"}, maxOut=${this._maxTokens || "cli-default"}, effort=${this._effortLevel || "default"}, mode=${this.opts.permissionMode})`);
|
|
69137
69394
|
const proc = spawn(IS_WIN32 ? quoteWin32Arg(this.opts.claudeBin) : this.opts.claudeBin, IS_WIN32 ? args.map(quoteWin32Arg) : args, {
|
|
69138
69395
|
cwd: this.opts.workspaceDir,
|
|
@@ -69216,6 +69473,8 @@ var ClaudeCodeAdapter = class {
|
|
|
69216
69473
|
args.push("--disallowedTools", this.opts.disallowedTools.join(","));
|
|
69217
69474
|
}
|
|
69218
69475
|
args.push("--append-system-prompt-file", path13.join(this.opts.workspaceDir, ".parall", "system-prompt.md"));
|
|
69476
|
+
if (this.capabilityProbe.promptSnapshotOff)
|
|
69477
|
+
args.push("--system-prompt-snapshot", "off");
|
|
69219
69478
|
if (this.opts.appendSystemPrompt) {
|
|
69220
69479
|
args.push("--append-system-prompt", this.opts.appendSystemPrompt);
|
|
69221
69480
|
}
|
|
@@ -69248,19 +69507,19 @@ var ClaudeCodeAdapter = class {
|
|
|
69248
69507
|
};
|
|
69249
69508
|
|
|
69250
69509
|
// ts/claude-agent/dist/workspace.js
|
|
69251
|
-
import * as
|
|
69510
|
+
import * as fs12 from "node:fs";
|
|
69252
69511
|
import * as path14 from "node:path";
|
|
69253
69512
|
function buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
|
|
69254
69513
|
return buildClaudeCodePlatformInstructions(workspaceDir, agentIdentity, capabilityFragments);
|
|
69255
69514
|
}
|
|
69256
69515
|
function writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments) {
|
|
69257
69516
|
const parallDir = path14.join(workspaceDir, ".parall");
|
|
69258
|
-
|
|
69259
|
-
|
|
69517
|
+
fs12.mkdirSync(parallDir, { recursive: true });
|
|
69518
|
+
fs12.writeFileSync(path14.join(parallDir, "system-prompt.md"), buildClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments), "utf8");
|
|
69260
69519
|
}
|
|
69261
69520
|
function ensureClaudeWorkspace(workspaceDir, _log, agentIdentity, capabilityFragments) {
|
|
69262
|
-
|
|
69263
|
-
|
|
69521
|
+
fs12.mkdirSync(workspaceDir, { recursive: true });
|
|
69522
|
+
fs12.mkdirSync(path14.join(workspaceDir, ".claude"), { recursive: true });
|
|
69264
69523
|
writeClaudeSystemPrompt(workspaceDir, agentIdentity, capabilityFragments);
|
|
69265
69524
|
writeSkillFiles(path14.join(workspaceDir, ".parall", "skills"));
|
|
69266
69525
|
ensureLocalAttachmentGitExclude(workspaceDir);
|
|
@@ -69474,7 +69733,7 @@ async function main() {
|
|
|
69474
69733
|
runtimeFeatures: secrets ? ["agent_secrets"] : [],
|
|
69475
69734
|
runtimeKey,
|
|
69476
69735
|
runtimeRef: {
|
|
69477
|
-
hostname:
|
|
69736
|
+
hostname: os5.hostname(),
|
|
69478
69737
|
pid: process.pid,
|
|
69479
69738
|
workspace_dir: config.workspaceDir,
|
|
69480
69739
|
claude_home: config.claudeHome
|