commonswarm 0.1.48 → 0.1.49
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/cswarm.cjs +28 -14
- package/package.json +1 -1
package/cswarm.cjs
CHANGED
|
@@ -31310,10 +31310,12 @@ var AcpHostError = class extends Error {
|
|
|
31310
31310
|
}
|
|
31311
31311
|
};
|
|
31312
31312
|
var AcpProtocolError = class extends AcpHostError {
|
|
31313
|
-
constructor(message, code = "protocol_error") {
|
|
31313
|
+
constructor(message, code = "protocol_error", peerError = null) {
|
|
31314
31314
|
super(code, message);
|
|
31315
|
+
this.peerError = peerError;
|
|
31315
31316
|
this.name = "AcpProtocolError";
|
|
31316
31317
|
}
|
|
31318
|
+
peerError;
|
|
31317
31319
|
};
|
|
31318
31320
|
var AcpTimeoutError = class extends AcpHostError {
|
|
31319
31321
|
constructor(message) {
|
|
@@ -31370,14 +31372,16 @@ var AcpVersionBelowFloorError = class extends AcpVersionError {
|
|
|
31370
31372
|
actual;
|
|
31371
31373
|
};
|
|
31372
31374
|
var AcpPermissionCanaryError = class extends AcpHostError {
|
|
31373
|
-
constructor(message, reasonCode = null, minimumRequiredVersion = null) {
|
|
31375
|
+
constructor(message, reasonCode = null, minimumRequiredVersion = null, peerError = null) {
|
|
31374
31376
|
super("permission_canary_failed", message);
|
|
31375
31377
|
this.reasonCode = reasonCode;
|
|
31376
31378
|
this.minimumRequiredVersion = minimumRequiredVersion;
|
|
31379
|
+
this.peerError = peerError;
|
|
31377
31380
|
this.name = "AcpPermissionCanaryError";
|
|
31378
31381
|
}
|
|
31379
31382
|
reasonCode;
|
|
31380
31383
|
minimumRequiredVersion;
|
|
31384
|
+
peerError;
|
|
31381
31385
|
};
|
|
31382
31386
|
var AcpPromptsBlockedError = class extends AcpHostError {
|
|
31383
31387
|
constructor() {
|
|
@@ -31657,7 +31661,11 @@ var AcpTransport = class extends import_node_events.EventEmitter {
|
|
|
31657
31661
|
if ("error" in rec && rec.error !== void 0) {
|
|
31658
31662
|
const errObj = rec.error;
|
|
31659
31663
|
const message = errObj && typeof errObj.message === "string" ? errObj.message : `RPC error for ${pending.method}`;
|
|
31660
|
-
|
|
31664
|
+
const peerError = errObj && typeof errObj.code === "number" && Number.isInteger(errObj.code) ? {
|
|
31665
|
+
code: errObj.code,
|
|
31666
|
+
...Object.prototype.hasOwnProperty.call(errObj, "data") ? { data: errObj.data } : {}
|
|
31667
|
+
} : null;
|
|
31668
|
+
pending.reject(new AcpProtocolError(message, "rpc_error", peerError));
|
|
31661
31669
|
return;
|
|
31662
31670
|
}
|
|
31663
31671
|
pending.resolve(rec.result);
|
|
@@ -31847,7 +31855,9 @@ var AcpHostSession = class _AcpHostSession {
|
|
|
31847
31855
|
const detail = last?.reason ?? "permission-boundary canary failed: need host reject + correlated terminal tool status";
|
|
31848
31856
|
throw new AcpPermissionCanaryError(
|
|
31849
31857
|
total === 1 ? detail : `${detail} (failed ${total} attempts)`,
|
|
31850
|
-
last?.reasonCode ?? null
|
|
31858
|
+
last?.reasonCode ?? null,
|
|
31859
|
+
null,
|
|
31860
|
+
last?.peerError ?? null
|
|
31851
31861
|
);
|
|
31852
31862
|
}
|
|
31853
31863
|
/** Test/helper: force-enable prompts without canary (never used by production open path). */
|
|
@@ -31893,7 +31903,8 @@ var AcpHostSession = class _AcpHostSession {
|
|
|
31893
31903
|
sawPermissionRequest: this.canaryState.sawPermissionRequest,
|
|
31894
31904
|
sawDeniedToolResult: this.canaryState.sawDeniedToolResult,
|
|
31895
31905
|
reason: err instanceof Error ? err.message : String(err),
|
|
31896
|
-
...err instanceof AcpHostError ? { reasonCode: err.code } : {}
|
|
31906
|
+
...err instanceof AcpHostError ? { reasonCode: err.code } : {},
|
|
31907
|
+
...err instanceof AcpProtocolError && err.peerError ? { peerError: err.peerError } : {}
|
|
31897
31908
|
};
|
|
31898
31909
|
}
|
|
31899
31910
|
}
|
|
@@ -35319,10 +35330,15 @@ var import_promises7 = require("node:fs/promises");
|
|
|
35319
35330
|
var import_node_os8 = require("node:os");
|
|
35320
35331
|
var import_node_path13 = require("node:path");
|
|
35321
35332
|
var CLAUDE_CODE_VERSION_REQUIRED_RE = /\bClaude Code (\d+\.\d+\.\d+) does not support this model; version (\d+\.\d+\.\d+) or newer is required\b/;
|
|
35322
|
-
var CLAUDE_AUTH_FAILURE_RE = /\b(?:authentication failed|authentication required|not authenticated|OAuth (?:sign-in|login|token)|keychain\/OAuth|please (?:log|sign) in)\b/i;
|
|
35333
|
+
var CLAUDE_AUTH_FAILURE_RE = /\b(?:authentication failed|failed to authenticate|authentication required|not authenticated|OAuth (?:sign-in|login|token)|OAuth session (?:expired|could not be refreshed)|keychain\/OAuth|please (?:log|sign) in)\b/i;
|
|
35323
35334
|
var CLAUDE_CANARY_TIMEOUT_RE = /^ACP request timed out: session\/prompt(?: \(failed \d+ attempts\))?$/;
|
|
35324
|
-
function classifyClaudeCanaryFailure(detail, typedReasonCode) {
|
|
35335
|
+
function classifyClaudeCanaryFailure(detail, typedReasonCode, peerError) {
|
|
35325
35336
|
const recorded = detail?.trim() ?? "";
|
|
35337
|
+
const peerData = peerError?.data;
|
|
35338
|
+
const peerErrorKind = peerData && typeof peerData === "object" && !Array.isArray(peerData) ? peerData.errorKind : void 0;
|
|
35339
|
+
if (typedReasonCode === "claude_canary_auth_failed" || (typedReasonCode === "rpc_error" || typedReasonCode === null || typedReasonCode === void 0) && (peerError?.code === -32e3 || peerErrorKind === "authentication_failed")) {
|
|
35340
|
+
return { code: "claude_canary_auth_failed", minimumRequiredVersion: null };
|
|
35341
|
+
}
|
|
35326
35342
|
const demanded = CLAUDE_CODE_VERSION_REQUIRED_RE.exec(recorded);
|
|
35327
35343
|
if (demanded?.[2]) {
|
|
35328
35344
|
return {
|
|
@@ -35333,9 +35349,6 @@ function classifyClaudeCanaryFailure(detail, typedReasonCode) {
|
|
|
35333
35349
|
if (typedReasonCode === "claude_canary_timeout" || typedReasonCode === "timeout" || (typedReasonCode === null || typedReasonCode === void 0) && CLAUDE_CANARY_TIMEOUT_RE.test(recorded)) {
|
|
35334
35350
|
return { code: "claude_canary_timeout", minimumRequiredVersion: null };
|
|
35335
35351
|
}
|
|
35336
|
-
if (typedReasonCode === "claude_canary_auth_failed") {
|
|
35337
|
-
return { code: "claude_canary_auth_failed", minimumRequiredVersion: null };
|
|
35338
|
-
}
|
|
35339
35352
|
if (typedReasonCode === "claude_bridge_version_required") {
|
|
35340
35353
|
return {
|
|
35341
35354
|
code: "claude_bridge_version_required",
|
|
@@ -35518,7 +35531,8 @@ var ClaudeListenerModel = class {
|
|
|
35518
35531
|
if (canaryError instanceof AcpPermissionCanaryError) {
|
|
35519
35532
|
const shape = classifyClaudeCanaryFailure(
|
|
35520
35533
|
canaryError.message,
|
|
35521
|
-
canaryError.reasonCode
|
|
35534
|
+
canaryError.reasonCode,
|
|
35535
|
+
canaryError.peerError
|
|
35522
35536
|
);
|
|
35523
35537
|
throw new AcpPermissionCanaryError(
|
|
35524
35538
|
canaryError.message,
|
|
@@ -41822,8 +41836,8 @@ var ACCEPTED_AGENT_CREDENTIAL_MESSAGES = [
|
|
|
41822
41836
|
AGENT_CREDENTIAL_MESSAGE_D088
|
|
41823
41837
|
];
|
|
41824
41838
|
function packageVersion() {
|
|
41825
|
-
if ("0.1.
|
|
41826
|
-
return "0.1.
|
|
41839
|
+
if ("0.1.49".length > 0) {
|
|
41840
|
+
return "0.1.49";
|
|
41827
41841
|
}
|
|
41828
41842
|
try {
|
|
41829
41843
|
const value = JSON.parse(
|
|
@@ -45317,7 +45331,7 @@ function listenerFailureMessage(code, provider, detail, reasonCode, minimumRequi
|
|
|
45317
45331
|
return `${ran}. ${response}. Next: run claude -p and check for session-limit text, check host load, then retry`;
|
|
45318
45332
|
}
|
|
45319
45333
|
if (shape.code === "claude_canary_auth_failed") {
|
|
45320
|
-
return `${ran}. ${response}. Next:
|
|
45334
|
+
return `${ran}. ${response}. Next: as the operator, sign in with claude auth login on this host (or start claude interactively and complete the prompt), then run cswarm listen start again. Every Claude-provider listener on this host shares that session`;
|
|
45321
45335
|
}
|
|
45322
45336
|
return `${ran}. ${response}. The cause was not determined. Next: inspect the quoted bridge response and local worker stderr, then retry only after the cause is known or the failure appears transient`;
|
|
45323
45337
|
}
|