@codexhost/cli-darwin-x64 0.13.2 → 0.13.3
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/README.md +1 -1
- package/app/codexhost-distribution.json +1 -1
- package/app/console-server.mjs +36 -3
- package/app/console-web.js +100 -78
- package/app/desktop-controller.mjs +36 -3
- package/app/host-runtime.mjs +81 -21
- package/app/plugins/antigravity/plugin.mjs +52 -7
- package/app/plugins/claude-code/plugin.mjs +194 -45
- package/app/plugins/codebuddy/plugin.mjs +110 -8
- package/app/plugins/codex-usage/plugin.mjs +36 -3
- package/app/plugins/cursor-cli/plugin.mjs +71 -10
- package/app/plugins/deepseek-harness/manifest.json +2 -2
- package/app/plugins/deepseek-harness/plugin.mjs +119 -10
- package/app/plugins/grok/plugin.mjs +64 -5
- package/app/plugins/hermes/plugin.mjs +63 -3
- package/app/plugins/kimi-code/plugin.mjs +64 -9
- package/app/plugins/kiro-cli/plugin.mjs +45 -3
- package/app/plugins/omp/plugin.mjs +46 -3
- package/app/plugins/opencode/plugin.mjs +52 -5
- package/app/plugins/pi/plugin.mjs +37 -3
- package/app/plugins/qoder/plugin.mjs +50 -3
- package/app/plugins/qoder-cn/plugin.mjs +50 -3
- package/app/plugins/workbuddy/plugin.mjs +227 -12
- package/app/plugins/zcode/plugin.mjs +49 -3
- package/app/renderer-extension.js +337 -366
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
|
@@ -14604,6 +14604,15 @@ var harnessDisplaySetSchema = external_exports.strictObject({
|
|
|
14604
14604
|
initializeOnly: external_exports.boolean().optional()
|
|
14605
14605
|
});
|
|
14606
14606
|
|
|
14607
|
+
// ../../shared-contracts/dist/harness-presentation.js
|
|
14608
|
+
var localeSchema = external_exports.string().max(64).regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/u);
|
|
14609
|
+
var displayText = (maximum) => external_exports.string().min(1).max(maximum).refine((text2) => text2.trim().length > 0);
|
|
14610
|
+
var harnessLocalizationsSchema = external_exports.record(localeSchema, external_exports.object({
|
|
14611
|
+
label: displayText(256).optional(),
|
|
14612
|
+
description: displayText(1024).optional()
|
|
14613
|
+
}).strict()).refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14614
|
+
var harnessLocalizedTextSchema = external_exports.record(localeSchema, displayText(4096)).refine((entries) => typeof entries.en === "string", "English fallback is required").refine((entries) => Object.keys(entries).length <= 16, "Too many locales");
|
|
14615
|
+
|
|
14607
14616
|
// ../../shared-contracts/dist/model-price-overrides.js
|
|
14608
14617
|
var usdPerMillionTokens = external_exports.number().finite().nonnegative();
|
|
14609
14618
|
var modelPriceOverrideSchema = external_exports.strictObject({
|
|
@@ -14940,8 +14949,24 @@ var threadUsageSnapshotSchema = external_exports.object({
|
|
|
14940
14949
|
}
|
|
14941
14950
|
});
|
|
14942
14951
|
var usagePercentSchema = external_exports.number().finite().min(0).max(100);
|
|
14952
|
+
var accountCreditsPeriodSchema = external_exports.enum([
|
|
14953
|
+
"weekly",
|
|
14954
|
+
"monthly",
|
|
14955
|
+
"five_hour",
|
|
14956
|
+
"seven_day",
|
|
14957
|
+
"unknown"
|
|
14958
|
+
]);
|
|
14959
|
+
var accountCreditsScopeSchema = external_exports.object({
|
|
14960
|
+
id: external_exports.string().min(1).max(256),
|
|
14961
|
+
label: external_exports.string().min(1).max(256),
|
|
14962
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
14963
|
+
}).strict();
|
|
14943
14964
|
var accountCreditsProductUsageSchema = external_exports.object({
|
|
14944
14965
|
product: external_exports.string().min(1),
|
|
14966
|
+
/** Native period and scope, never inferred from the display name. */
|
|
14967
|
+
periodType: accountCreditsPeriodSchema.optional(),
|
|
14968
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
14969
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
14945
14970
|
used: external_exports.number().finite().nonnegative().optional(),
|
|
14946
14971
|
// Zero is a real empty cap, not an absent field.
|
|
14947
14972
|
limit: external_exports.number().finite().nonnegative().optional(),
|
|
@@ -14961,9 +14986,11 @@ var accountCreditsSnapshotSchema = external_exports.object({
|
|
|
14961
14986
|
unit: external_exports.string().min(1).max(32).optional(),
|
|
14962
14987
|
/** Native label when the primary limit is scoped to a model or product group. */
|
|
14963
14988
|
label: external_exports.string().min(1).optional(),
|
|
14989
|
+
scope: accountCreditsScopeSchema.optional(),
|
|
14990
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
14964
14991
|
usedPercent: usagePercentSchema,
|
|
14965
14992
|
resetsAt: external_exports.string().min(1).optional(),
|
|
14966
|
-
periodType:
|
|
14993
|
+
periodType: accountCreditsPeriodSchema,
|
|
14967
14994
|
productUsage: external_exports.array(accountCreditsProductUsageSchema).min(1).optional(),
|
|
14968
14995
|
resetCredits: accountResetCreditsSchema.optional()
|
|
14969
14996
|
}).strict();
|
|
@@ -14974,7 +15001,9 @@ var threadUsageInspectionParamsSchema = external_exports.object({
|
|
|
14974
15001
|
var threadUsageInspectionSchema = external_exports.object({
|
|
14975
15002
|
threadId: hostThreadIdSchema,
|
|
14976
15003
|
usage: threadUsageSnapshotSchema.nullable(),
|
|
14977
|
-
accountCredits: accountCreditsSnapshotSchema.optional()
|
|
15004
|
+
accountCredits: accountCreditsSnapshotSchema.optional(),
|
|
15005
|
+
/** Whether this source can provide cached account quota independently of usage. */
|
|
15006
|
+
accountCreditsSupported: external_exports.boolean().optional()
|
|
14978
15007
|
}).strict();
|
|
14979
15008
|
|
|
14980
15009
|
// ../../shared-contracts/dist/harness-accounts.js
|
|
@@ -15101,7 +15130,8 @@ var harnessPermissionModeSchema = external_exports.object({
|
|
|
15101
15130
|
id: harnessPermissionModeIdSchema,
|
|
15102
15131
|
label: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_LABEL_MAX_LENGTH),
|
|
15103
15132
|
description: nonBlankTextSchema.max(HARNESS_PERMISSION_MODE_DESCRIPTION_MAX_LENGTH).optional(),
|
|
15104
|
-
dangerous: external_exports.boolean().optional()
|
|
15133
|
+
dangerous: external_exports.boolean().optional(),
|
|
15134
|
+
localizations: harnessLocalizationsSchema.optional()
|
|
15105
15135
|
}).strict();
|
|
15106
15136
|
var harnessPermissionModeCatalogSchema = external_exports.object({
|
|
15107
15137
|
modes: external_exports.array(harnessPermissionModeSchema).min(1).max(HARNESS_PERMISSION_MODE_CATALOG_MAX_LENGTH),
|
|
@@ -15488,6 +15518,8 @@ var harnessInstallationStateSchema = external_exports.object({
|
|
|
15488
15518
|
// Adapter-owned diagnostic text; UI uses messageCode rather than displaying it verbatim.
|
|
15489
15519
|
message: external_exports.string().max(2048).optional(),
|
|
15490
15520
|
messageCode: external_exports.string().min(1).max(128).optional(),
|
|
15521
|
+
/** Safe plugin-owned explanation, distinct from raw diagnostic message. */
|
|
15522
|
+
notice: harnessLocalizedTextSchema.optional(),
|
|
15491
15523
|
latestVersionKind: external_exports.enum(["unknown", "tracking-branch"]).optional()
|
|
15492
15524
|
}).strict();
|
|
15493
15525
|
|
|
@@ -15614,6 +15646,7 @@ var harnessCommandDescriptorSchema = external_exports.object({
|
|
|
15614
15646
|
invocation: commandInvocationSchema,
|
|
15615
15647
|
label: commandLabelSchema,
|
|
15616
15648
|
description: commandDescriptionSchema.optional(),
|
|
15649
|
+
localizations: harnessLocalizationsSchema.optional(),
|
|
15617
15650
|
argumentMode: external_exports.enum(["none", "text"]),
|
|
15618
15651
|
/**
|
|
15619
15652
|
* Native distinction reported by the Harness. Omitted when the Harness does
|
|
@@ -17160,6 +17193,8 @@ var BrokeredHarnessAdapter = class {
|
|
|
17160
17193
|
commandCatalog;
|
|
17161
17194
|
liveCommandCatalog;
|
|
17162
17195
|
harnessId;
|
|
17196
|
+
credits;
|
|
17197
|
+
refreshCredits;
|
|
17163
17198
|
#descriptorPath;
|
|
17164
17199
|
#forwardEnvironment;
|
|
17165
17200
|
#isInstalled;
|
|
@@ -17180,6 +17215,10 @@ var BrokeredHarnessAdapter = class {
|
|
|
17180
17215
|
};
|
|
17181
17216
|
constructor(input = {}) {
|
|
17182
17217
|
this.harnessId = harnessPluginIdSchema.parse(input.harnessId ?? "claude-code");
|
|
17218
|
+
if (input.accountCredits !== false) {
|
|
17219
|
+
this.credits = () => this.#credits;
|
|
17220
|
+
this.refreshCredits = () => this.#refreshAccountCredits();
|
|
17221
|
+
}
|
|
17183
17222
|
this.#forwardEnvironment = input.forwardDelegationEnvironment === true;
|
|
17184
17223
|
if (input.commandCatalog)
|
|
17185
17224
|
this.commandCatalog = input.commandCatalog;
|
|
@@ -17191,10 +17230,7 @@ var BrokeredHarnessAdapter = class {
|
|
|
17191
17230
|
this.#startBroker = input.startBroker === false ? void 0 : input.startBroker ?? (process.platform === "darwin" && !input.descriptorPath ? () => startBrokerLaunchAgent(this.harnessId, environment) : void 0);
|
|
17192
17231
|
this.#startTimeoutMs = input.startTimeoutMs ?? BROKER_START_TIMEOUT_MS;
|
|
17193
17232
|
}
|
|
17194
|
-
|
|
17195
|
-
return this.#credits;
|
|
17196
|
-
}
|
|
17197
|
-
refreshCredits() {
|
|
17233
|
+
#refreshAccountCredits() {
|
|
17198
17234
|
if (this.#closed)
|
|
17199
17235
|
return Promise.resolve(null);
|
|
17200
17236
|
if (this.#creditsRefresh)
|
|
@@ -17613,7 +17649,7 @@ function createClaudeUsageStatistics(environment) {
|
|
|
17613
17649
|
}
|
|
17614
17650
|
|
|
17615
17651
|
// dist/claude-code-adapter.js
|
|
17616
|
-
import { randomUUID as
|
|
17652
|
+
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
17617
17653
|
import path16 from "node:path";
|
|
17618
17654
|
|
|
17619
17655
|
// ../../../node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
|
@@ -55821,6 +55857,10 @@ async function forkClaudeSession(input) {
|
|
|
55821
55857
|
return { ok: true, value: { sessionId: derivedSessionId } };
|
|
55822
55858
|
}
|
|
55823
55859
|
|
|
55860
|
+
// dist/claude-fork-references.js
|
|
55861
|
+
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
55862
|
+
import { readFile as readFile6, rename as rename4, rm as rm5, stat as stat5, writeFile as writeFile2 } from "node:fs/promises";
|
|
55863
|
+
|
|
55824
55864
|
// dist/claude-transcript.js
|
|
55825
55865
|
import os6 from "node:os";
|
|
55826
55866
|
import path13 from "node:path";
|
|
@@ -55838,7 +55878,7 @@ async function existingFile(file2) {
|
|
|
55838
55878
|
return false;
|
|
55839
55879
|
}
|
|
55840
55880
|
}
|
|
55841
|
-
async function
|
|
55881
|
+
async function findClaudeTranscript(input) {
|
|
55842
55882
|
const projectsDirectory = path13.join(configDirectory(input.environment), "projects");
|
|
55843
55883
|
const name = `${input.sessionId}.jsonl`;
|
|
55844
55884
|
const expected = path13.join(projectsDirectory, projectDirectoryName(input.cwd), name);
|
|
@@ -55861,7 +55901,7 @@ function isRecord9(value) {
|
|
|
55861
55901
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55862
55902
|
}
|
|
55863
55903
|
async function readClaudeTranscript(input) {
|
|
55864
|
-
const transcript = await
|
|
55904
|
+
const transcript = await findClaudeTranscript(input);
|
|
55865
55905
|
if (!transcript)
|
|
55866
55906
|
return null;
|
|
55867
55907
|
const contents = await readFile5(transcript, "utf8");
|
|
@@ -55883,9 +55923,83 @@ async function readClaudeTranscript(input) {
|
|
|
55883
55923
|
return [...messages.values()];
|
|
55884
55924
|
}
|
|
55885
55925
|
|
|
55926
|
+
// dist/claude-fork-references.js
|
|
55927
|
+
function isRecord10(value) {
|
|
55928
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55929
|
+
}
|
|
55930
|
+
function parseEntry(line) {
|
|
55931
|
+
if (line.trim().length === 0)
|
|
55932
|
+
return null;
|
|
55933
|
+
try {
|
|
55934
|
+
const entry = JSON.parse(line);
|
|
55935
|
+
return isRecord10(entry) ? entry : null;
|
|
55936
|
+
} catch {
|
|
55937
|
+
return null;
|
|
55938
|
+
}
|
|
55939
|
+
}
|
|
55940
|
+
function remapSameAs(value, copies) {
|
|
55941
|
+
if (Array.isArray(value)) {
|
|
55942
|
+
return value.reduce((count4, item) => count4 + remapSameAs(item, copies), 0);
|
|
55943
|
+
}
|
|
55944
|
+
if (!isRecord10(value))
|
|
55945
|
+
return 0;
|
|
55946
|
+
let count3 = 0;
|
|
55947
|
+
for (const [key, child] of Object.entries(value)) {
|
|
55948
|
+
const copy = key === "sameAs" && typeof child === "string" ? copies.get(child) : void 0;
|
|
55949
|
+
if (copy) {
|
|
55950
|
+
value[key] = copy;
|
|
55951
|
+
count3 += 1;
|
|
55952
|
+
} else {
|
|
55953
|
+
count3 += remapSameAs(child, copies);
|
|
55954
|
+
}
|
|
55955
|
+
}
|
|
55956
|
+
return count3;
|
|
55957
|
+
}
|
|
55958
|
+
async function remapForkedSessionReferences(input) {
|
|
55959
|
+
const transcript = await findClaudeTranscript(input);
|
|
55960
|
+
if (!transcript)
|
|
55961
|
+
return 0;
|
|
55962
|
+
const contents = await readFile6(transcript, "utf8");
|
|
55963
|
+
if (!contents.includes('"sameAs"'))
|
|
55964
|
+
return 0;
|
|
55965
|
+
const lines = contents.split("\n");
|
|
55966
|
+
const entries = lines.map(parseEntry);
|
|
55967
|
+
const copies = /* @__PURE__ */ new Map();
|
|
55968
|
+
for (const entry of entries) {
|
|
55969
|
+
const source = entry?.forkedFrom;
|
|
55970
|
+
if (typeof entry?.uuid === "string" && isRecord10(source) && typeof source.messageUuid === "string") {
|
|
55971
|
+
copies.set(source.messageUuid, entry.uuid);
|
|
55972
|
+
}
|
|
55973
|
+
}
|
|
55974
|
+
let remapped = 0;
|
|
55975
|
+
const output = lines.map((line, index) => {
|
|
55976
|
+
const entry = entries[index];
|
|
55977
|
+
if (entry?.type !== "attachment")
|
|
55978
|
+
return line;
|
|
55979
|
+
const count3 = remapSameAs(entry.attachment, copies);
|
|
55980
|
+
if (count3 === 0)
|
|
55981
|
+
return line;
|
|
55982
|
+
remapped += count3;
|
|
55983
|
+
return JSON.stringify(entry);
|
|
55984
|
+
});
|
|
55985
|
+
if (remapped === 0)
|
|
55986
|
+
return 0;
|
|
55987
|
+
const temporary = `${transcript}.${randomUUID4()}.tmp`;
|
|
55988
|
+
try {
|
|
55989
|
+
await writeFile2(temporary, output.join("\n"), {
|
|
55990
|
+
flag: "wx",
|
|
55991
|
+
mode: (await stat5(transcript)).mode & 511
|
|
55992
|
+
});
|
|
55993
|
+
await rename4(temporary, transcript);
|
|
55994
|
+
} finally {
|
|
55995
|
+
await rm5(temporary, { force: true });
|
|
55996
|
+
}
|
|
55997
|
+
return remapped;
|
|
55998
|
+
}
|
|
55999
|
+
|
|
55886
56000
|
// dist/model-catalog.js
|
|
55887
56001
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
55888
|
-
import { readFile as
|
|
56002
|
+
import { readFile as readFile7 } from "node:fs/promises";
|
|
55889
56003
|
import os7 from "node:os";
|
|
55890
56004
|
import path14 from "node:path";
|
|
55891
56005
|
|
|
@@ -56025,7 +56139,7 @@ async function readClaudeUserModelPicker(environment = process.env) {
|
|
|
56025
56139
|
const settingsPath = path14.join(resolveClaudeConfigDirectory(environment), "settings.json");
|
|
56026
56140
|
let raw;
|
|
56027
56141
|
try {
|
|
56028
|
-
raw = await
|
|
56142
|
+
raw = await readFile7(settingsPath, "utf8");
|
|
56029
56143
|
} catch {
|
|
56030
56144
|
return void 0;
|
|
56031
56145
|
}
|
|
@@ -56184,26 +56298,38 @@ var claudePermissionModes = [
|
|
|
56184
56298
|
{
|
|
56185
56299
|
id: "plan",
|
|
56186
56300
|
label: "Plan mode",
|
|
56301
|
+
localizations: {
|
|
56302
|
+
"zh-CN": {
|
|
56303
|
+
label: "规划模式",
|
|
56304
|
+
description: "探索并制定计划;批准计划后退出规划,恢复此前的权限模式。"
|
|
56305
|
+
}
|
|
56306
|
+
},
|
|
56187
56307
|
description: "Explore and prepare a plan; approval exits planning and resumes the previous permission mode."
|
|
56188
56308
|
},
|
|
56189
56309
|
{
|
|
56190
56310
|
id: "default",
|
|
56191
56311
|
label: "Default",
|
|
56312
|
+
localizations: { "zh-CN": { label: "默认", description: "编辑和其他受保护操作前询问。" } },
|
|
56192
56313
|
description: "Ask before edits and other protected actions."
|
|
56193
56314
|
},
|
|
56194
56315
|
{
|
|
56195
56316
|
id: "acceptEdits",
|
|
56196
56317
|
label: "Accept edits",
|
|
56318
|
+
localizations: {
|
|
56319
|
+
"zh-CN": { label: "接受编辑", description: "允许文件编辑;其他受保护操作前询问。" }
|
|
56320
|
+
},
|
|
56197
56321
|
description: "Allow file edits and ask for other protected actions."
|
|
56198
56322
|
},
|
|
56199
56323
|
{
|
|
56200
56324
|
id: "auto",
|
|
56201
56325
|
label: "Auto mode",
|
|
56326
|
+
localizations: { "zh-CN": { label: "自动模式", description: "由 Claude 判断权限请求。" } },
|
|
56202
56327
|
description: "Let Claude classify permission requests."
|
|
56203
56328
|
},
|
|
56204
56329
|
{
|
|
56205
56330
|
id: "bypassPermissions",
|
|
56206
56331
|
label: "Bypass permissions",
|
|
56332
|
+
localizations: { "zh-CN": { label: "绕过权限", description: "跳过 Claude Code 权限检查。" } },
|
|
56207
56333
|
description: "Skip Claude Code permission checks.",
|
|
56208
56334
|
dangerous: true
|
|
56209
56335
|
}
|
|
@@ -56310,23 +56436,24 @@ function projectClaudeAccountUsage(usage, account) {
|
|
|
56310
56436
|
return null;
|
|
56311
56437
|
const limits = usage.rate_limits;
|
|
56312
56438
|
const windows = [];
|
|
56313
|
-
const add = (product, periodType, value) => {
|
|
56439
|
+
const add = (product, periodType, value, scope) => {
|
|
56314
56440
|
if (!value || typeof value.utilization !== "number" || !Number.isFinite(value.utilization) || value.utilization < 0 || value.utilization > 100)
|
|
56315
56441
|
return;
|
|
56316
56442
|
windows.push({
|
|
56317
56443
|
product,
|
|
56318
56444
|
periodType,
|
|
56445
|
+
...scope ? { scope: { id: scope, label: scope } } : {},
|
|
56319
56446
|
usagePercent: value.utilization,
|
|
56320
56447
|
...value.resets_at && Number.isFinite(Date.parse(value.resets_at)) ? { resetsAt: value.resets_at } : {}
|
|
56321
56448
|
});
|
|
56322
56449
|
};
|
|
56323
56450
|
add("5-hour window", "five_hour", limits.five_hour);
|
|
56324
56451
|
add("7-day window", "seven_day", limits.seven_day);
|
|
56325
|
-
add("OAuth apps · 7-day", "seven_day", limits.seven_day_oauth_apps);
|
|
56326
|
-
add("Opus · 7-day", "seven_day", limits.seven_day_opus);
|
|
56327
|
-
add("Sonnet · 7-day", "seven_day", limits.seven_day_sonnet);
|
|
56452
|
+
add("OAuth apps · 7-day", "seven_day", limits.seven_day_oauth_apps, "OAuth apps");
|
|
56453
|
+
add("Opus · 7-day", "seven_day", limits.seven_day_opus, "Opus");
|
|
56454
|
+
add("Sonnet · 7-day", "seven_day", limits.seven_day_sonnet, "Sonnet");
|
|
56328
56455
|
for (const window2 of limits.model_scoped ?? [])
|
|
56329
|
-
add(`${window2.display_name} · 7-day`, "seven_day", window2);
|
|
56456
|
+
add(`${window2.display_name} · 7-day`, "seven_day", window2, window2.display_name);
|
|
56330
56457
|
const [primary, ...others] = windows;
|
|
56331
56458
|
if (!primary)
|
|
56332
56459
|
return null;
|
|
@@ -56337,11 +56464,14 @@ function projectClaudeAccountUsage(usage, account) {
|
|
|
56337
56464
|
credits: {
|
|
56338
56465
|
usedPercent: primary.usagePercent,
|
|
56339
56466
|
periodType: primary.periodType,
|
|
56467
|
+
...primary.scope ? { scope: primary.scope } : {},
|
|
56340
56468
|
...!genericPrimary ? { label: primary.product } : {},
|
|
56341
56469
|
...primary.resetsAt ? { resetsAt: primary.resetsAt } : {},
|
|
56342
56470
|
...others.length ? {
|
|
56343
|
-
productUsage: others.map(({ product, usagePercent, resetsAt }) => ({
|
|
56471
|
+
productUsage: others.map(({ product, periodType, scope, usagePercent, resetsAt }) => ({
|
|
56344
56472
|
product,
|
|
56473
|
+
periodType,
|
|
56474
|
+
...scope ? { scope } : {},
|
|
56345
56475
|
usagePercent,
|
|
56346
56476
|
...resetsAt ? { resetsAt } : {}
|
|
56347
56477
|
}))
|
|
@@ -56463,17 +56593,17 @@ function rejectAfter(milliseconds, message) {
|
|
|
56463
56593
|
function processExited(child) {
|
|
56464
56594
|
return child.exitCode !== null || child.signalCode !== null;
|
|
56465
56595
|
}
|
|
56466
|
-
function
|
|
56596
|
+
function isRecord11(value) {
|
|
56467
56597
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56468
56598
|
}
|
|
56469
56599
|
function permissionModeFromMessage(value) {
|
|
56470
|
-
if (!
|
|
56600
|
+
if (!isRecord11(value) || value.type !== "system" || value.subtype !== "init" && value.subtype !== "status" || !("permissionMode" in value) || value.permissionMode === void 0) {
|
|
56471
56601
|
return void 0;
|
|
56472
56602
|
}
|
|
56473
56603
|
return isClaudePermissionMode(value.permissionMode) ? value.permissionMode : void 0;
|
|
56474
56604
|
}
|
|
56475
56605
|
function parseContextUsage(value) {
|
|
56476
|
-
if (!
|
|
56606
|
+
if (!isRecord11(value))
|
|
56477
56607
|
throw new Error("Claude SDK context Usage is invalid");
|
|
56478
56608
|
const usedTokens = value.totalTokens;
|
|
56479
56609
|
const maxTokens = value.maxTokens;
|
|
@@ -56490,7 +56620,7 @@ function parseQuestions(input) {
|
|
|
56490
56620
|
const questions = [];
|
|
56491
56621
|
const questionTexts = /* @__PURE__ */ new Set();
|
|
56492
56622
|
for (const value of input.questions) {
|
|
56493
|
-
if (!
|
|
56623
|
+
if (!isRecord11(value))
|
|
56494
56624
|
return null;
|
|
56495
56625
|
const question = value.question;
|
|
56496
56626
|
const header = value.header;
|
|
@@ -56501,7 +56631,7 @@ function parseQuestions(input) {
|
|
|
56501
56631
|
const labels = /* @__PURE__ */ new Set();
|
|
56502
56632
|
const options = [];
|
|
56503
56633
|
for (const option2 of value.options) {
|
|
56504
|
-
if (!
|
|
56634
|
+
if (!isRecord11(option2) || typeof option2.label !== "string" || option2.label.length === 0 || labels.has(option2.label) || typeof option2.description !== "string") {
|
|
56505
56635
|
return null;
|
|
56506
56636
|
}
|
|
56507
56637
|
labels.add(option2.label);
|
|
@@ -56543,7 +56673,7 @@ function permissionUpdateDestination(value) {
|
|
|
56543
56673
|
return void 0;
|
|
56544
56674
|
}
|
|
56545
56675
|
function isPermissionUpdate(value) {
|
|
56546
|
-
if (!
|
|
56676
|
+
if (!isRecord11(value) || !permissionUpdateDestination(value.destination))
|
|
56547
56677
|
return false;
|
|
56548
56678
|
if (value.type === "setMode") {
|
|
56549
56679
|
return typeof value.mode === "string" && PERMISSION_MODES.has(value.mode);
|
|
@@ -56552,7 +56682,7 @@ function isPermissionUpdate(value) {
|
|
|
56552
56682
|
return Array.isArray(value.directories) && value.directories.every((directory) => typeof directory === "string");
|
|
56553
56683
|
}
|
|
56554
56684
|
if (value.type === "addRules" || value.type === "replaceRules" || value.type === "removeRules") {
|
|
56555
|
-
return typeof value.behavior === "string" && PERMISSION_BEHAVIORS.has(value.behavior) && Array.isArray(value.rules) && value.rules.every((rule) =>
|
|
56685
|
+
return typeof value.behavior === "string" && PERMISSION_BEHAVIORS.has(value.behavior) && Array.isArray(value.rules) && value.rules.every((rule) => isRecord11(rule) && typeof rule.toolName === "string" && (rule.ruleContent === void 0 || typeof rule.ruleContent === "string"));
|
|
56556
56686
|
}
|
|
56557
56687
|
return false;
|
|
56558
56688
|
}
|
|
@@ -56779,7 +56909,7 @@ var ClaudeSdkTransport = class {
|
|
|
56779
56909
|
return { commands: this.#slashCommands, skillNames: this.#skillNames };
|
|
56780
56910
|
}
|
|
56781
56911
|
#observeSlashCommands(message) {
|
|
56782
|
-
if (!
|
|
56912
|
+
if (!isRecord11(message) || message.type !== "system")
|
|
56783
56913
|
return;
|
|
56784
56914
|
if (message.subtype === "init" && Array.isArray(message.skills)) {
|
|
56785
56915
|
this.#skillNames = new Set(message.skills.filter((name) => typeof name === "string"));
|
|
@@ -57198,10 +57328,10 @@ var ClaudeSdkTransport = class {
|
|
|
57198
57328
|
}
|
|
57199
57329
|
}
|
|
57200
57330
|
#observeBackgroundTasks(message) {
|
|
57201
|
-
if (!
|
|
57331
|
+
if (!isRecord11(message) || message.type !== "system")
|
|
57202
57332
|
return;
|
|
57203
57333
|
if (message.subtype === "background_tasks_changed" && Array.isArray(message.tasks)) {
|
|
57204
|
-
this.#backgroundTasks = new Set(message.tasks.flatMap((task) =>
|
|
57334
|
+
this.#backgroundTasks = new Set(message.tasks.flatMap((task) => isRecord11(task) && typeof task.task_id === "string" ? [task.task_id] : []));
|
|
57205
57335
|
} else if (message.subtype === "task_started" && typeof message.task_id === "string") {
|
|
57206
57336
|
this.#backgroundTasks.add(message.task_id);
|
|
57207
57337
|
} else if (message.subtype === "task_notification" && typeof message.task_id === "string" && ["completed", "failed", "stopped"].includes(String(message.status))) {
|
|
@@ -57217,7 +57347,7 @@ var ClaudeSdkTransport = class {
|
|
|
57217
57347
|
}
|
|
57218
57348
|
/** Remembers Workflow agent labels so their approvals can name the agent asking. */
|
|
57219
57349
|
#observeWorkflowAgents(message) {
|
|
57220
|
-
if (!
|
|
57350
|
+
if (!isRecord11(message) || message.type !== "system" || message.subtype !== "task_progress") {
|
|
57221
57351
|
return;
|
|
57222
57352
|
}
|
|
57223
57353
|
for (const agent of parseClaudeWorkflowAgents(message.workflow_progress) ?? []) {
|
|
@@ -57278,7 +57408,7 @@ var ClaudeSdkTransport = class {
|
|
|
57278
57408
|
userMessageId: null,
|
|
57279
57409
|
live: false
|
|
57280
57410
|
});
|
|
57281
|
-
if (autonomous.userMessageId === null &&
|
|
57411
|
+
if (autonomous.userMessageId === null && isRecord11(message) && message.type === "user" && (message.parent_tool_use_id === null || message.parent_tool_use_id === void 0) && typeof message.uuid === "string" && message.uuid.length > 0) {
|
|
57282
57412
|
autonomous.userMessageId = message.uuid;
|
|
57283
57413
|
}
|
|
57284
57414
|
const interpreted = autonomous.accumulator.consume(message);
|
|
@@ -57806,11 +57936,11 @@ var ClaudeWorkflowLifecycle = class {
|
|
|
57806
57936
|
};
|
|
57807
57937
|
|
|
57808
57938
|
// dist/task-tracker.js
|
|
57809
|
-
function
|
|
57939
|
+
function isRecord12(value) {
|
|
57810
57940
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57811
57941
|
}
|
|
57812
57942
|
function stringField(value, keys) {
|
|
57813
|
-
if (!
|
|
57943
|
+
if (!isRecord12(value))
|
|
57814
57944
|
return void 0;
|
|
57815
57945
|
for (const key of keys) {
|
|
57816
57946
|
const field = value[key];
|
|
@@ -57845,7 +57975,7 @@ var ClaudeTaskTracker = class {
|
|
|
57845
57975
|
};
|
|
57846
57976
|
}
|
|
57847
57977
|
#create(args, result) {
|
|
57848
|
-
if (!
|
|
57978
|
+
if (!isRecord12(result) || !isRecord12(result.task))
|
|
57849
57979
|
return;
|
|
57850
57980
|
const id2 = stringField(result.task, ["id"]);
|
|
57851
57981
|
const subject = stringField(args, ["subject"]) ?? stringField(result.task, ["subject"]);
|
|
@@ -57863,7 +57993,7 @@ var ClaudeTaskTracker = class {
|
|
|
57863
57993
|
const id2 = stringField(args, ["taskId", "id", "task_id"]);
|
|
57864
57994
|
if (!id2)
|
|
57865
57995
|
return;
|
|
57866
|
-
const status =
|
|
57996
|
+
const status = isRecord12(args) ? taskStatus2(args.status) : void 0;
|
|
57867
57997
|
if (status === "deleted") {
|
|
57868
57998
|
this.#tasks.delete(id2);
|
|
57869
57999
|
return;
|
|
@@ -57881,13 +58011,13 @@ var ClaudeTaskTracker = class {
|
|
|
57881
58011
|
});
|
|
57882
58012
|
}
|
|
57883
58013
|
#replace(result) {
|
|
57884
|
-
if (!
|
|
58014
|
+
if (!isRecord12(result) || !Array.isArray(result.tasks))
|
|
57885
58015
|
return;
|
|
57886
58016
|
const next = /* @__PURE__ */ new Map();
|
|
57887
58017
|
for (const value of result.tasks) {
|
|
57888
58018
|
const id2 = stringField(value, ["id"]);
|
|
57889
58019
|
const subject = stringField(value, ["subject"]);
|
|
57890
|
-
const status =
|
|
58020
|
+
const status = isRecord12(value) ? taskStatus2(value.status) : void 0;
|
|
57891
58021
|
if (!id2 || !subject || !status || status === "deleted")
|
|
57892
58022
|
continue;
|
|
57893
58023
|
const existing = this.#tasks.get(id2);
|
|
@@ -58054,11 +58184,11 @@ var ClaudeBackgroundCommandItems = class {
|
|
|
58054
58184
|
};
|
|
58055
58185
|
|
|
58056
58186
|
// dist/tool-lifecycle.js
|
|
58057
|
-
function
|
|
58187
|
+
function isRecord13(value) {
|
|
58058
58188
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58059
58189
|
}
|
|
58060
58190
|
function stringField2(value, key) {
|
|
58061
|
-
return
|
|
58191
|
+
return isRecord13(value) && typeof value[key] === "string" ? value[key] : void 0;
|
|
58062
58192
|
}
|
|
58063
58193
|
function toolFailure(toolName) {
|
|
58064
58194
|
return {
|
|
@@ -58248,6 +58378,7 @@ var claudeCommandCatalog = harnessCommandCatalogSchema.parse({
|
|
|
58248
58378
|
{
|
|
58249
58379
|
id: "claude.compact",
|
|
58250
58380
|
invocation: "/compact",
|
|
58381
|
+
localizations: { "zh-CN": { label: "压缩上下文", description: "压缩当前对话上下文" } },
|
|
58251
58382
|
label: "Compact context",
|
|
58252
58383
|
description: "Compact the current conversation context",
|
|
58253
58384
|
argumentMode: "text"
|
|
@@ -58324,7 +58455,7 @@ var CONTEXT_USAGE_TTL_MS = 1e4;
|
|
|
58324
58455
|
var CONTEXT_USAGE_FAILURE_COOLDOWN_MS = 5e3;
|
|
58325
58456
|
var REQUEST_USAGE_RETRY_DELAYS_MS = [0, 100, 250, 500, 1e3];
|
|
58326
58457
|
var DEFAULT_CONTINUATION_QUIESCENCE_MS = 2e3;
|
|
58327
|
-
function
|
|
58458
|
+
function isRecord14(value) {
|
|
58328
58459
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58329
58460
|
}
|
|
58330
58461
|
function safeNonNegativeInteger2(value) {
|
|
@@ -58333,7 +58464,7 @@ function safeNonNegativeInteger2(value) {
|
|
|
58333
58464
|
function transcriptRequestUsage(messages, messageId) {
|
|
58334
58465
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
58335
58466
|
const entry = messages[index];
|
|
58336
|
-
if (!
|
|
58467
|
+
if (!isRecord14(entry) || entry.type !== "assistant" || entry.parent_tool_use_id !== null && entry.parent_tool_use_id !== void 0 || !isRecord14(entry.message) || entry.message.id !== messageId || !isRecord14(entry.message.usage)) {
|
|
58337
58468
|
continue;
|
|
58338
58469
|
}
|
|
58339
58470
|
const inputTokens = entry.message.usage.input_tokens;
|
|
@@ -58481,6 +58612,7 @@ function projectClaudePlanLimitToCredits(planLimit) {
|
|
|
58481
58612
|
productUsage: [
|
|
58482
58613
|
{
|
|
58483
58614
|
product: "7-day window",
|
|
58615
|
+
periodType: "seven_day",
|
|
58484
58616
|
usagePercent: other.utilizationPercent,
|
|
58485
58617
|
...other.resetsAtUnix !== void 0 ? { resetsAt: isoFromUnix(other.resetsAtUnix) } : {}
|
|
58486
58618
|
}
|
|
@@ -58635,7 +58767,7 @@ var ClaudeHarnessSession = class {
|
|
|
58635
58767
|
cwd: this.#cwd,
|
|
58636
58768
|
sessionId: this.#sessionId
|
|
58637
58769
|
}) ?? [];
|
|
58638
|
-
const ids = new Set(messages.flatMap((message) =>
|
|
58770
|
+
const ids = new Set(messages.flatMap((message) => isRecord14(message) && typeof message.uuid === "string" ? [message.uuid] : []));
|
|
58639
58771
|
if (this.#unpersistedMessageIds.every((id2) => ids.has(id2))) {
|
|
58640
58772
|
this.#unpersistedMessageIds = [];
|
|
58641
58773
|
break;
|
|
@@ -60591,7 +60723,7 @@ var ClaudeCodeAdapter = class {
|
|
|
60591
60723
|
throw new RangeError("Claude Code continuation quiescence must be a positive safe integer");
|
|
60592
60724
|
}
|
|
60593
60725
|
this.#dependencies = dependencies ?? {
|
|
60594
|
-
randomUUID:
|
|
60726
|
+
randomUUID: randomUUID5,
|
|
60595
60727
|
bypassPermissionsAvailable: (environment2) => claudeBypassPermissionsAvailable(environment2 ?? options.environment ?? process.env),
|
|
60596
60728
|
inspectInstallation: () => {
|
|
60597
60729
|
resolveClaudeCodeExecutable({
|
|
@@ -60613,7 +60745,18 @@ var ClaudeCodeAdapter = class {
|
|
|
60613
60745
|
abortTimeoutMs: this.#cancelTimeoutMs
|
|
60614
60746
|
}),
|
|
60615
60747
|
deleteSession: ({ cwd, sessionId }) => M5t(sessionId, { dir: cwd }),
|
|
60616
|
-
forkSession: ({ checkpointId, cwd, sourceSessionId }) =>
|
|
60748
|
+
forkSession: async ({ checkpointId, cwd, sourceSessionId }) => {
|
|
60749
|
+
const forked = await U5t(sourceSessionId, {
|
|
60750
|
+
dir: cwd,
|
|
60751
|
+
upToMessageId: checkpointId
|
|
60752
|
+
});
|
|
60753
|
+
await remapForkedSessionReferences({
|
|
60754
|
+
cwd,
|
|
60755
|
+
environment: options.environment ?? process.env,
|
|
60756
|
+
sessionId: forked.sessionId
|
|
60757
|
+
}).catch(() => void 0);
|
|
60758
|
+
return forked;
|
|
60759
|
+
},
|
|
60617
60760
|
getSessionInfo: async ({ sessionId }) => {
|
|
60618
60761
|
const info = await D5t(sessionId);
|
|
60619
60762
|
if (!info)
|
|
@@ -60977,11 +61120,11 @@ var ClaudeCodeAdapter = class {
|
|
|
60977
61120
|
};
|
|
60978
61121
|
|
|
60979
61122
|
// dist/installation.js
|
|
60980
|
-
import { readFile as
|
|
61123
|
+
import { readFile as readFile8, realpath as realpath5 } from "node:fs/promises";
|
|
60981
61124
|
import { homedir as homedir2 } from "node:os";
|
|
60982
61125
|
import path17 from "node:path";
|
|
60983
61126
|
async function readSettings(file2) {
|
|
60984
|
-
const text2 = await
|
|
61127
|
+
const text2 = await readFile8(file2, "utf8").catch((error52) => {
|
|
60985
61128
|
if (error52.code === "ENOENT")
|
|
60986
61129
|
return "{}";
|
|
60987
61130
|
throw error52;
|
|
@@ -61032,6 +61175,12 @@ function createClaudeInstallation(environment, command) {
|
|
|
61032
61175
|
canUpdate,
|
|
61033
61176
|
...!canUpdate ? {
|
|
61034
61177
|
messageCode: blocked ? "claude-policy-restricted" : "original-installer",
|
|
61178
|
+
...blocked ? {
|
|
61179
|
+
notice: {
|
|
61180
|
+
en: "Claude updates are restricted by the installation's settings or policy.",
|
|
61181
|
+
"zh-CN": "此 Claude 安装的设置或策略限制了更新。"
|
|
61182
|
+
}
|
|
61183
|
+
} : {},
|
|
61035
61184
|
message: blocked ? "Claude updates are restricted by the installation's settings or policy." : "Use the original installer or package manager for this Claude installation."
|
|
61036
61185
|
} : {}
|
|
61037
61186
|
};
|