@super-one/cli 0.57.3-alpha → 0.57.4-alpha
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/MANIFEST.json +2 -2
- package/lib/cli.mjs +82 -18
- package/package.json +1 -1
package/MANIFEST.json
CHANGED
package/lib/cli.mjs
CHANGED
|
@@ -21306,6 +21306,52 @@ var init_slash_commands = __esm({
|
|
|
21306
21306
|
}
|
|
21307
21307
|
});
|
|
21308
21308
|
|
|
21309
|
+
// ../../packages/claude/src/result-failure.ts
|
|
21310
|
+
function isClaudeResultError(result, rejectedRateLimit = false) {
|
|
21311
|
+
return result.is_error === true || result.subtype !== "success" || rejectedRateLimit;
|
|
21312
|
+
}
|
|
21313
|
+
function resultErrorText(result, typedCode) {
|
|
21314
|
+
if (Array.isArray(result.errors)) {
|
|
21315
|
+
const errors = result.errors.filter((error51) => typeof error51 === "string" && error51.length > 0);
|
|
21316
|
+
if (errors.length > 0) return errors.join("; ");
|
|
21317
|
+
}
|
|
21318
|
+
if (typeof result.errors === "string" && result.errors) return result.errors;
|
|
21319
|
+
if (typeof result.result === "string" && result.result) return result.result;
|
|
21320
|
+
return typedCode || "Unknown error";
|
|
21321
|
+
}
|
|
21322
|
+
function decorateMessageErrorText(rawError, typedCode, apiStatus) {
|
|
21323
|
+
if (typedCode !== "model_not_found") return rawError;
|
|
21324
|
+
const suffix = apiStatus ? ` (HTTP ${apiStatus})` : "";
|
|
21325
|
+
return `Model not available for this provider${suffix}: ${rawError}`;
|
|
21326
|
+
}
|
|
21327
|
+
function buildClaudeResultFailure(result, context = {}) {
|
|
21328
|
+
const typedCode = context.rejectedRateLimit ? "rate_limit" : context.typedCode;
|
|
21329
|
+
const rawError = resultErrorText(result, typedCode);
|
|
21330
|
+
const httpStatus = typeof result.api_error_status === "number" ? result.api_error_status : void 0;
|
|
21331
|
+
const terminalReason = typeof result.terminal_reason === "string" ? result.terminal_reason : void 0;
|
|
21332
|
+
const subtype = typeof result.subtype === "string" ? result.subtype : void 0;
|
|
21333
|
+
const errorInfo = buildAgentErrorInfo(rawError, {
|
|
21334
|
+
...typedCode ? { code: typedCode } : {},
|
|
21335
|
+
...httpStatus === void 0 ? {} : { httpStatus },
|
|
21336
|
+
...terminalReason ? { terminalReason } : {},
|
|
21337
|
+
...subtype ? { subtype } : {},
|
|
21338
|
+
...context.model ? { model: context.model } : {},
|
|
21339
|
+
...context.requestId ? { requestId: context.requestId } : {},
|
|
21340
|
+
...context.retries ? { retries: context.retries } : {},
|
|
21341
|
+
...context.resetsAt === void 0 ? {} : { resetsAt: context.resetsAt }
|
|
21342
|
+
});
|
|
21343
|
+
return {
|
|
21344
|
+
error: decorateMessageErrorText(rawError, typedCode, httpStatus),
|
|
21345
|
+
errorInfo
|
|
21346
|
+
};
|
|
21347
|
+
}
|
|
21348
|
+
var init_result_failure = __esm({
|
|
21349
|
+
"../../packages/claude/src/result-failure.ts"() {
|
|
21350
|
+
"use strict";
|
|
21351
|
+
init_agent_error();
|
|
21352
|
+
}
|
|
21353
|
+
});
|
|
21354
|
+
|
|
21309
21355
|
// ../../packages/claude/src/agent-event-mapper.ts
|
|
21310
21356
|
function emptyResult(sessionId) {
|
|
21311
21357
|
return {
|
|
@@ -21416,17 +21462,6 @@ function buildClaudeResultMetadata(result, startedAt, pausedMs, lastAssistantUsa
|
|
|
21416
21462
|
}
|
|
21417
21463
|
return metadata;
|
|
21418
21464
|
}
|
|
21419
|
-
function resultErrorText(result) {
|
|
21420
|
-
if (Array.isArray(result.errors)) return result.errors.join("; ") || "Unknown error";
|
|
21421
|
-
if (typeof result.errors === "string" && result.errors) return result.errors;
|
|
21422
|
-
if (typeof result.result === "string" && result.result) return result.result;
|
|
21423
|
-
return "Unknown error";
|
|
21424
|
-
}
|
|
21425
|
-
function decorateMessageErrorText(rawError, typedCode, apiStatus) {
|
|
21426
|
-
if (typedCode !== "model_not_found") return rawError;
|
|
21427
|
-
const suffix = apiStatus ? ` (HTTP ${apiStatus})` : "";
|
|
21428
|
-
return `Model not available for this provider${suffix}: ${rawError}`;
|
|
21429
|
-
}
|
|
21430
21465
|
function createClaudeAgentEventMapper(options) {
|
|
21431
21466
|
const now = options.now ?? Date.now;
|
|
21432
21467
|
const startedAt = options.startedAt ?? now();
|
|
@@ -21443,6 +21478,12 @@ function createClaudeAgentEventMapper(options) {
|
|
|
21443
21478
|
const resolveRetractedMessageIds = (uuids) => [...new Set(uuids.map((uuid3) => wireUuidToMessageId.get(uuid3)).filter((id) => !!id))];
|
|
21444
21479
|
let lastReplayCheckpointId = "";
|
|
21445
21480
|
let lastAssistantTypedError;
|
|
21481
|
+
let lastAssistantRequestId;
|
|
21482
|
+
let lastAssistantModel;
|
|
21483
|
+
const retryDelaysMs = [];
|
|
21484
|
+
let retryMaxRetries;
|
|
21485
|
+
let rejectedRateLimitResetsAt;
|
|
21486
|
+
let hasRejectedRateLimit = false;
|
|
21446
21487
|
let pendingSlashOutput = "";
|
|
21447
21488
|
let messageInputTokens = 0;
|
|
21448
21489
|
let messageOutputTokens = 0;
|
|
@@ -21669,6 +21710,9 @@ function createClaudeAgentEventMapper(options) {
|
|
|
21669
21710
|
});
|
|
21670
21711
|
break;
|
|
21671
21712
|
case "api_retry":
|
|
21713
|
+
retryDelaysMs.push(system.retry_delay_ms ?? 0);
|
|
21714
|
+
retryMaxRetries = system.max_retries ?? 3;
|
|
21715
|
+
if (system.error) lastAssistantTypedError = String(system.error);
|
|
21672
21716
|
emit({
|
|
21673
21717
|
type: "api_retry",
|
|
21674
21718
|
attempt: system.attempt ?? 1,
|
|
@@ -21748,6 +21792,9 @@ function createClaudeAgentEventMapper(options) {
|
|
|
21748
21792
|
const usage2 = raw.message?.usage;
|
|
21749
21793
|
if (usage2) lastAssistantUsage = usage2;
|
|
21750
21794
|
if (raw.error) lastAssistantTypedError = String(raw.error);
|
|
21795
|
+
const requestId = raw.request_id ?? raw.requestId;
|
|
21796
|
+
if (requestId) lastAssistantRequestId = String(requestId);
|
|
21797
|
+
if (raw.message?.model) lastAssistantModel = String(raw.message.model);
|
|
21751
21798
|
if (!assistantParent) {
|
|
21752
21799
|
lastTopLevelAssistantUuid = raw.uuid ?? "";
|
|
21753
21800
|
if (lastTopLevelAssistantUuid) wireUuidToMessageId.set(lastTopLevelAssistantUuid, messageId);
|
|
@@ -21906,9 +21953,15 @@ ${text}` : text;
|
|
|
21906
21953
|
);
|
|
21907
21954
|
if (lastTopLevelAssistantUuid) metadata.forkAnchorId = lastTopLevelAssistantUuid;
|
|
21908
21955
|
const interrupted = options.isInterrupted?.() === true;
|
|
21909
|
-
const resultIsError = raw
|
|
21910
|
-
const
|
|
21911
|
-
|
|
21956
|
+
const resultIsError = isClaudeResultError(raw, hasRejectedRateLimit);
|
|
21957
|
+
const failure = buildClaudeResultFailure(raw, {
|
|
21958
|
+
typedCode: lastAssistantTypedError,
|
|
21959
|
+
model: lastAssistantModel,
|
|
21960
|
+
requestId: lastAssistantRequestId,
|
|
21961
|
+
retries: retryDelaysMs.length > 0 ? { attempts: retryDelaysMs.length, delaysMs: [...retryDelaysMs], ...retryMaxRetries === void 0 ? {} : { max: retryMaxRetries } } : void 0,
|
|
21962
|
+
rejectedRateLimit: hasRejectedRateLimit,
|
|
21963
|
+
resetsAt: rejectedRateLimitResetsAt
|
|
21964
|
+
});
|
|
21912
21965
|
if (interrupted) {
|
|
21913
21966
|
emit({ type: "message_interrupted", messageId, metadata });
|
|
21914
21967
|
activeBackgroundTasks.clear();
|
|
@@ -21916,9 +21969,16 @@ ${text}` : text;
|
|
|
21916
21969
|
if (pendingSlashOutput) emit({ type: "slash_command_output", messageId, content: pendingSlashOutput });
|
|
21917
21970
|
emit({ type: "message_complete", messageId, metadata });
|
|
21918
21971
|
} else {
|
|
21919
|
-
|
|
21972
|
+
metadata.errorInfo = failure.errorInfo;
|
|
21973
|
+
emit({ type: "message_error", messageId, error: failure.error, errorInfo: failure.errorInfo });
|
|
21920
21974
|
}
|
|
21921
21975
|
lastAssistantTypedError = void 0;
|
|
21976
|
+
lastAssistantRequestId = void 0;
|
|
21977
|
+
lastAssistantModel = void 0;
|
|
21978
|
+
retryDelaysMs.length = 0;
|
|
21979
|
+
retryMaxRetries = void 0;
|
|
21980
|
+
hasRejectedRateLimit = false;
|
|
21981
|
+
rejectedRateLimitResetsAt = void 0;
|
|
21922
21982
|
pendingSlashOutput = "";
|
|
21923
21983
|
resultSeen = true;
|
|
21924
21984
|
options.onStepBoundary?.();
|
|
@@ -21929,7 +21989,7 @@ ${text}` : text;
|
|
|
21929
21989
|
isResult: true,
|
|
21930
21990
|
resultIsError,
|
|
21931
21991
|
resultText: typeof raw.result === "string" ? raw.result : null,
|
|
21932
|
-
resultError: resultIsError ?
|
|
21992
|
+
resultError: resultIsError ? failure.error : null
|
|
21933
21993
|
};
|
|
21934
21994
|
}
|
|
21935
21995
|
case "prompt_suggestion":
|
|
@@ -21938,6 +21998,8 @@ ${text}` : text;
|
|
|
21938
21998
|
case "rate_limit_event": {
|
|
21939
21999
|
const info = raw.rate_limit_info;
|
|
21940
22000
|
if (info) {
|
|
22001
|
+
hasRejectedRateLimit = info.status === "rejected";
|
|
22002
|
+
rejectedRateLimitResetsAt = hasRejectedRateLimit && typeof info.resetsAt === "number" ? info.resetsAt : void 0;
|
|
21941
22003
|
emit({
|
|
21942
22004
|
type: "rate_limit",
|
|
21943
22005
|
status: info.status,
|
|
@@ -21966,6 +22028,7 @@ var init_agent_event_mapper2 = __esm({
|
|
|
21966
22028
|
"use strict";
|
|
21967
22029
|
init_model_fallback_wire();
|
|
21968
22030
|
init_slash_commands();
|
|
22031
|
+
init_result_failure();
|
|
21969
22032
|
}
|
|
21970
22033
|
});
|
|
21971
22034
|
|
|
@@ -22743,6 +22806,7 @@ var init_src2 = __esm({
|
|
|
22743
22806
|
init_message_bridge();
|
|
22744
22807
|
init_claude_live_session();
|
|
22745
22808
|
init_agent_event_mapper2();
|
|
22809
|
+
init_result_failure();
|
|
22746
22810
|
init_resolve_sdk_binary();
|
|
22747
22811
|
init_fetch_models();
|
|
22748
22812
|
init_root_permission_guard();
|
|
@@ -70591,8 +70655,8 @@ import { fileURLToPath } from "node:url";
|
|
|
70591
70655
|
function resolveCliReleaseVersion() {
|
|
70592
70656
|
const fromEnv = process.env.SUPERONE_CLI_VERSION?.trim();
|
|
70593
70657
|
if (fromEnv) return fromEnv;
|
|
70594
|
-
if ("0.57.
|
|
70595
|
-
return "0.57.
|
|
70658
|
+
if ("0.57.4-alpha".trim()) {
|
|
70659
|
+
return "0.57.4-alpha".trim();
|
|
70596
70660
|
}
|
|
70597
70661
|
const fromDist = readDistManifestVersion();
|
|
70598
70662
|
if (fromDist) return fromDist;
|
package/package.json
CHANGED