@codexhost/cli-darwin-x64 0.18.0-beta.3 → 0.18.0-beta.5
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 +102 -57
- package/app/console-web.js +168 -123
- package/app/desktop-controller.mjs +292 -117
- package/app/host-runtime.mjs +5875 -3270
- package/app/plugins/antigravity/plugin.mjs +796 -307
- package/app/plugins/claude-code/plugin.mjs +214 -103
- package/app/plugins/codebuddy/plugin.mjs +108 -63
- package/app/plugins/codex-usage/plugin.mjs +94 -49
- package/app/plugins/copilot/plugin.mjs +99 -54
- package/app/plugins/cursor-cli/plugin.mjs +122 -77
- package/app/plugins/deepseek-harness/plugin.mjs +125 -80
- package/app/plugins/devin/plugin.mjs +99 -54
- package/app/plugins/grok/plugin.mjs +105 -60
- package/app/plugins/hermes/plugin.mjs +86 -41
- package/app/plugins/kimi-code/plugin.mjs +103 -58
- package/app/plugins/kiro-cli/plugin.mjs +99 -54
- package/app/plugins/omp/plugin.mjs +90 -45
- package/app/plugins/opencode/plugin.mjs +87 -42
- package/app/plugins/pi/plugin.mjs +103 -58
- package/app/plugins/qoder/plugin.mjs +115 -70
- package/app/plugins/qoder-cn/plugin.mjs +115 -70
- package/app/plugins/qwen-code/plugin.mjs +110 -65
- package/app/plugins/workbuddy/plugin.mjs +108 -63
- package/app/plugins/zcode/plugin.mjs +91 -46
- package/app/renderer-extension.js +362 -299
- package/app/web/assets/index-C0aXz2jD.js +199 -0
- package/app/web/codex-agent.png +0 -0
- package/app/web/codexhost-settings.js +163 -118
- package/app/web/index.html +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +61 -61
- package/app/web/plugins/deepseek-ai__dsh-client-connection/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +8 -8
- package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +63 -63
- package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +12 -12
- package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-permission-presets/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings/client.js +1 -1
- package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar/client.js +2 -2
- package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
- package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +9 -13
- package/app/web/plugins.json +4 -0
- package/app/web/sw.js +1 -6
- package/app/web-modules/server.mjs +2443 -1345
- package/bin/codexhost +0 -0
- package/libexec/codexhost-shim +0 -0
- package/libexec/codexhost-updater +0 -0
- package/package.json +1 -1
- package/app/web/assets/index-aKvkfNJN.js +0 -199
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __codexhostCreateRequire } from "node:module"; const require = __codexhostCreateRequire(import.meta.url);
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __export = (
|
|
3
|
+
var __export = (target2, all) => {
|
|
4
4
|
for (var name in all)
|
|
5
|
-
__defProp(
|
|
5
|
+
__defProp(target2, name, { get: all[name], enumerable: true });
|
|
6
6
|
};
|
|
7
7
|
|
|
8
8
|
// ../../harness-broker/dist/client.js
|
|
@@ -758,8 +758,8 @@ function defineLazy(object2, key, getter) {
|
|
|
758
758
|
function objectClone(obj) {
|
|
759
759
|
return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
|
|
760
760
|
}
|
|
761
|
-
function assignProp(
|
|
762
|
-
Object.defineProperty(
|
|
761
|
+
function assignProp(target2, prop, value) {
|
|
762
|
+
Object.defineProperty(target2, prop, {
|
|
763
763
|
value,
|
|
764
764
|
writable: true,
|
|
765
765
|
enumerable: true,
|
|
@@ -942,35 +942,35 @@ function normalizeParams(_params) {
|
|
|
942
942
|
return params;
|
|
943
943
|
}
|
|
944
944
|
function createTransparentProxy(getter) {
|
|
945
|
-
let
|
|
945
|
+
let target2;
|
|
946
946
|
return new Proxy({}, {
|
|
947
947
|
get(_3, prop, receiver) {
|
|
948
|
-
|
|
949
|
-
return Reflect.get(
|
|
948
|
+
target2 ?? (target2 = getter());
|
|
949
|
+
return Reflect.get(target2, prop, receiver);
|
|
950
950
|
},
|
|
951
951
|
set(_3, prop, value, receiver) {
|
|
952
|
-
|
|
953
|
-
return Reflect.set(
|
|
952
|
+
target2 ?? (target2 = getter());
|
|
953
|
+
return Reflect.set(target2, prop, value, receiver);
|
|
954
954
|
},
|
|
955
955
|
has(_3, prop) {
|
|
956
|
-
|
|
957
|
-
return Reflect.has(
|
|
956
|
+
target2 ?? (target2 = getter());
|
|
957
|
+
return Reflect.has(target2, prop);
|
|
958
958
|
},
|
|
959
959
|
deleteProperty(_3, prop) {
|
|
960
|
-
|
|
961
|
-
return Reflect.deleteProperty(
|
|
960
|
+
target2 ?? (target2 = getter());
|
|
961
|
+
return Reflect.deleteProperty(target2, prop);
|
|
962
962
|
},
|
|
963
963
|
ownKeys(_3) {
|
|
964
|
-
|
|
965
|
-
return Reflect.ownKeys(
|
|
964
|
+
target2 ?? (target2 = getter());
|
|
965
|
+
return Reflect.ownKeys(target2);
|
|
966
966
|
},
|
|
967
967
|
getOwnPropertyDescriptor(_3, prop) {
|
|
968
|
-
|
|
969
|
-
return Reflect.getOwnPropertyDescriptor(
|
|
968
|
+
target2 ?? (target2 = getter());
|
|
969
|
+
return Reflect.getOwnPropertyDescriptor(target2, prop);
|
|
970
970
|
},
|
|
971
971
|
defineProperty(_3, prop, descriptor) {
|
|
972
|
-
|
|
973
|
-
return Reflect.defineProperty(
|
|
972
|
+
target2 ?? (target2 = getter());
|
|
973
|
+
return Reflect.defineProperty(target2, prop, descriptor);
|
|
974
974
|
}
|
|
975
975
|
});
|
|
976
976
|
}
|
|
@@ -11422,15 +11422,15 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
11422
11422
|
|
|
11423
11423
|
// ../../../node_modules/zod/v4/core/to-json-schema.js
|
|
11424
11424
|
function initializeContext(params) {
|
|
11425
|
-
let
|
|
11426
|
-
if (
|
|
11427
|
-
|
|
11428
|
-
if (
|
|
11429
|
-
|
|
11425
|
+
let target2 = params?.target ?? "draft-2020-12";
|
|
11426
|
+
if (target2 === "draft-4")
|
|
11427
|
+
target2 = "draft-04";
|
|
11428
|
+
if (target2 === "draft-7")
|
|
11429
|
+
target2 = "draft-07";
|
|
11430
11430
|
return {
|
|
11431
11431
|
processors: params.processors ?? {},
|
|
11432
11432
|
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
11433
|
-
target,
|
|
11433
|
+
target: target2,
|
|
11434
11434
|
unrepresentable: params?.unrepresentable ?? "throw",
|
|
11435
11435
|
override: params?.override ?? (() => {
|
|
11436
11436
|
}),
|
|
@@ -11772,8 +11772,8 @@ var createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
11772
11772
|
return finalize(ctx, schema);
|
|
11773
11773
|
};
|
|
11774
11774
|
var createStandardJSONSchemaMethod = (schema, io2, processors = {}) => (params) => {
|
|
11775
|
-
const { libraryOptions, target } = params ?? {};
|
|
11776
|
-
const ctx = initializeContext({ ...libraryOptions ?? {}, target, io: io2, processors });
|
|
11775
|
+
const { libraryOptions, target: target2 } = params ?? {};
|
|
11776
|
+
const ctx = initializeContext({ ...libraryOptions ?? {}, target: target2, io: io2, processors });
|
|
11777
11777
|
process2(schema, ctx);
|
|
11778
11778
|
extractDefs(ctx, schema);
|
|
11779
11779
|
return finalize(ctx, schema);
|
|
@@ -12832,8 +12832,8 @@ var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
|
12832
12832
|
catch(params) {
|
|
12833
12833
|
return _catch2(this, params);
|
|
12834
12834
|
},
|
|
12835
|
-
pipe(
|
|
12836
|
-
return pipe(this,
|
|
12835
|
+
pipe(target2) {
|
|
12836
|
+
return pipe(this, target2);
|
|
12837
12837
|
},
|
|
12838
12838
|
readonly() {
|
|
12839
12839
|
return readonly(this);
|
|
@@ -15063,15 +15063,15 @@ var threadOwnershipListResultSchema = external_exports.object({
|
|
|
15063
15063
|
threads: external_exports.array(threadOwnershipSchema).min(1).max(THREAD_OWNERSHIP_LIST_MAX_LENGTH)
|
|
15064
15064
|
}).strict().superRefine(({ threads }, context) => {
|
|
15065
15065
|
const seen = /* @__PURE__ */ new Set();
|
|
15066
|
-
for (const [index,
|
|
15067
|
-
if (seen.has(
|
|
15066
|
+
for (const [index, thread2] of threads.entries()) {
|
|
15067
|
+
if (seen.has(thread2.threadId)) {
|
|
15068
15068
|
context.addIssue({
|
|
15069
15069
|
code: "custom",
|
|
15070
15070
|
message: "Thread ownership-list results must be unique",
|
|
15071
15071
|
path: ["threads", index, "threadId"]
|
|
15072
15072
|
});
|
|
15073
15073
|
}
|
|
15074
|
-
seen.add(
|
|
15074
|
+
seen.add(thread2.threadId);
|
|
15075
15075
|
}
|
|
15076
15076
|
});
|
|
15077
15077
|
var threadSteeringInspectParamsSchema = external_exports.object({
|
|
@@ -15280,13 +15280,18 @@ var clientChannelResponseSchema = external_exports.object({
|
|
|
15280
15280
|
});
|
|
15281
15281
|
|
|
15282
15282
|
// ../../shared-contracts/dist/thread-catalog.js
|
|
15283
|
-
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15283
|
+
var threadCatalogReadParamsSchema = external_exports.object({
|
|
15284
|
+
includeArchived: external_exports.boolean().optional(),
|
|
15285
|
+
/** Absent means first page; null means this branch is exhausted. Native cursors only. */
|
|
15286
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15287
|
+
}).strict();
|
|
15284
15288
|
var threadCatalogReadResultSchema = external_exports.object({
|
|
15285
15289
|
threads: external_exports.array(jsonObjectSchema),
|
|
15286
15290
|
ownership: external_exports.array(threadOwnershipSchema),
|
|
15287
15291
|
/** Known archived IDs, including visible local external records even when their rows are
|
|
15288
|
-
* excluded. Native archived IDs
|
|
15289
|
-
archivedThreadIds: external_exports.array(hostThreadIdSchema)
|
|
15292
|
+
* excluded. Native archived IDs describe only the returned page, never a complete set. */
|
|
15293
|
+
archivedThreadIds: external_exports.array(hostThreadIdSchema),
|
|
15294
|
+
officialCursor: external_exports.object({ live: external_exports.string().nullable(), archived: external_exports.string().nullable().optional() }).strict().optional()
|
|
15290
15295
|
}).strict();
|
|
15291
15296
|
|
|
15292
15297
|
// ../../shared-contracts/dist/voice.js
|
|
@@ -15501,7 +15506,7 @@ var idleReleaseSettingsSchema = external_exports.strictObject({
|
|
|
15501
15506
|
});
|
|
15502
15507
|
var DEFAULT_IDLE_RELEASE_SETTINGS = Object.freeze({
|
|
15503
15508
|
enabled: false,
|
|
15504
|
-
timeoutMinutes:
|
|
15509
|
+
timeoutMinutes: 10
|
|
15505
15510
|
});
|
|
15506
15511
|
|
|
15507
15512
|
// ../../shared-contracts/dist/harness-preferences.js
|
|
@@ -16404,6 +16409,44 @@ var remoteSshSetupParamsSchema = external_exports.object({
|
|
|
16404
16409
|
}).strict();
|
|
16405
16410
|
var remoteSshSetupResultSchema = external_exports.object({ state: external_exports.enum(["installed", "not-installed"]) }).strict();
|
|
16406
16411
|
|
|
16412
|
+
// ../../shared-contracts/dist/remote-sessions.js
|
|
16413
|
+
var REMOTE_CONTROLLER_REQUEST_MAX_BYTES = 16 * 1024;
|
|
16414
|
+
var identity = external_exports.string().min(1).max(1024);
|
|
16415
|
+
var target = { hostId: identity.regex(/^remote-(?:ssh(?:-|:)|control:)/u) };
|
|
16416
|
+
var thread = { ...target, threadId: identity };
|
|
16417
|
+
var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
|
|
16418
|
+
external_exports.strictObject({ kind: external_exports.literal("hosts") }),
|
|
16419
|
+
external_exports.strictObject({
|
|
16420
|
+
kind: external_exports.literal("list"),
|
|
16421
|
+
...target,
|
|
16422
|
+
cursor: external_exports.string().nullable(),
|
|
16423
|
+
archived: external_exports.boolean()
|
|
16424
|
+
}),
|
|
16425
|
+
external_exports.strictObject({ kind: external_exports.literal("read"), ...thread }),
|
|
16426
|
+
external_exports.strictObject({
|
|
16427
|
+
kind: external_exports.literal("prompt"),
|
|
16428
|
+
...thread,
|
|
16429
|
+
epoch: identity,
|
|
16430
|
+
text: external_exports.string().min(1).max(8e3),
|
|
16431
|
+
requestId: identity.optional()
|
|
16432
|
+
}),
|
|
16433
|
+
external_exports.strictObject({ kind: external_exports.literal("interrupt"), ...thread, epoch: identity, turnId: identity }),
|
|
16434
|
+
external_exports.strictObject({
|
|
16435
|
+
kind: external_exports.literal("rename"),
|
|
16436
|
+
...thread,
|
|
16437
|
+
epoch: identity,
|
|
16438
|
+
name: external_exports.string().min(1).max(512)
|
|
16439
|
+
}),
|
|
16440
|
+
external_exports.strictObject({ kind: external_exports.literal("archive"), ...thread, epoch: identity, archived: external_exports.boolean() }),
|
|
16441
|
+
external_exports.strictObject({
|
|
16442
|
+
kind: external_exports.literal("respond"),
|
|
16443
|
+
...thread,
|
|
16444
|
+
epoch: identity,
|
|
16445
|
+
requestId: external_exports.union([identity, external_exports.number().int()]),
|
|
16446
|
+
result: external_exports.record(external_exports.string(), external_exports.unknown())
|
|
16447
|
+
})
|
|
16448
|
+
]);
|
|
16449
|
+
|
|
16407
16450
|
// ../../shared-contracts/dist/remote-connections.js
|
|
16408
16451
|
var hostId = external_exports.string().min(1).max(1024);
|
|
16409
16452
|
var codexSshConnectionSchema = external_exports.object({
|
|
@@ -16424,7 +16467,9 @@ var codexSshDraftSchema = external_exports.strictObject({
|
|
|
16424
16467
|
identity: external_exports.string().max(4096).nullable()
|
|
16425
16468
|
});
|
|
16426
16469
|
var remoteConnectionsRequestSchema = external_exports.discriminatedUnion("action", [
|
|
16470
|
+
external_exports.strictObject({ action: external_exports.literal("session"), operation: remoteSessionOperationSchema }),
|
|
16427
16471
|
external_exports.strictObject({ action: external_exports.literal("list") }),
|
|
16472
|
+
external_exports.strictObject({ action: external_exports.literal("catalog") }),
|
|
16428
16473
|
external_exports.strictObject({
|
|
16429
16474
|
action: external_exports.literal("read-thread"),
|
|
16430
16475
|
hostId: hostId.refine((id2) => id2 !== "local"),
|
|
@@ -17499,15 +17544,15 @@ async function startBrokerLaunchAgent(harnessId, environment) {
|
|
|
17499
17544
|
const uid = process.getuid?.();
|
|
17500
17545
|
if (uid === void 0)
|
|
17501
17546
|
return;
|
|
17502
|
-
const
|
|
17503
|
-
if (await runLaunchctl(["kickstart",
|
|
17547
|
+
const target2 = `gui/${uid}/${harnessBrokerLaunchAgentLabel(harnessId)}`;
|
|
17548
|
+
if (await runLaunchctl(["kickstart", target2]))
|
|
17504
17549
|
return;
|
|
17505
17550
|
await runLaunchctl([
|
|
17506
17551
|
"bootstrap",
|
|
17507
17552
|
`gui/${uid}`,
|
|
17508
17553
|
harnessBrokerLaunchAgentPlistPath(environment, harnessId)
|
|
17509
17554
|
]);
|
|
17510
|
-
await runLaunchctl(["kickstart",
|
|
17555
|
+
await runLaunchctl(["kickstart", target2]);
|
|
17511
17556
|
}
|
|
17512
17557
|
var BrokerConnection = class _BrokerConnection {
|
|
17513
17558
|
#onClose;
|
|
@@ -54731,9 +54776,9 @@ import path8 from "node:path";
|
|
|
54731
54776
|
function referencesNpmBin(shim, name, bin) {
|
|
54732
54777
|
if (bin.includes(".."))
|
|
54733
54778
|
return false;
|
|
54734
|
-
const
|
|
54779
|
+
const target2 = `node_modules/${name}/${bin.replace(/^\.\//, "")}`.toLowerCase();
|
|
54735
54780
|
const text2 = shim.replaceAll("\\", "/").toLowerCase();
|
|
54736
|
-
return text2.includes(`%dp0%/${
|
|
54781
|
+
return text2.includes(`%dp0%/${target2}"`) || text2.includes(`%~dp0/${target2}"`);
|
|
54737
54782
|
}
|
|
54738
54783
|
async function npmInstallation(command, packages, environment) {
|
|
54739
54784
|
let selected = await realpath4(command);
|
|
@@ -54772,8 +54817,8 @@ async function npmInstallation(command, packages, environment) {
|
|
|
54772
54817
|
const launchers = await Promise.all(Object.entries(bins).map(async ([bin, entry]) => {
|
|
54773
54818
|
if (path8.basename(bin) !== bin || entry.includes(".."))
|
|
54774
54819
|
return false;
|
|
54775
|
-
const
|
|
54776
|
-
if (
|
|
54820
|
+
const target2 = await realpath4(path8.join(directory, entry)).catch(() => "");
|
|
54821
|
+
if (target2.toLowerCase() !== selected.toLowerCase())
|
|
54777
54822
|
return false;
|
|
54778
54823
|
const shim = await readFile3(path8.join(prefix, `${bin}.cmd`), "utf8").catch(() => "");
|
|
54779
54824
|
return referencesNpmBin(shim, name, entry);
|
|
@@ -55961,9 +56006,24 @@ function claudeTranscriptItemId(nativeTurnKey, kind, ordinal) {
|
|
|
55961
56006
|
return hostItemIdSchema.parse(`claude-item-v2-${nativeTurnKey}-${kind}-${ordinal}`);
|
|
55962
56007
|
}
|
|
55963
56008
|
|
|
56009
|
+
// dist/claude-queued-command.js
|
|
56010
|
+
function isRecord8(value) {
|
|
56011
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56012
|
+
}
|
|
56013
|
+
function readClaudeQueuedCommand(value, sessionId) {
|
|
56014
|
+
const attachment = value.attachment;
|
|
56015
|
+
if (value.type !== "attachment" || !isRecord8(attachment) || attachment.type !== "queued_command" || attachment.commandMode !== "prompt" || !isRecord8(attachment.origin) || attachment.origin.kind !== "human" || attachment.humanTurn === false || attachment.isMeta === true || attachment.isSynthetic === true || value.isMeta === true || value.isSynthetic === true || value.isSidechain === true || isRecord8(value.origin) && value.origin.kind !== "human" || typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0 || value.sessionId !== void 0 && value.sessionId !== sessionId || value.session_id !== sessionId) {
|
|
56016
|
+
return null;
|
|
56017
|
+
}
|
|
56018
|
+
if (typeof value.uuid !== "string" || value.uuid.length === 0 || typeof attachment.source_uuid !== "string" || attachment.source_uuid.length === 0 || typeof attachment.prompt !== "string" || attachment.prompt.length === 0) {
|
|
56019
|
+
throw new Error("Claude queued human input has an invalid identity or text prompt");
|
|
56020
|
+
}
|
|
56021
|
+
return { uuid: value.uuid, sourceUuid: attachment.source_uuid, prompt: attachment.prompt };
|
|
56022
|
+
}
|
|
56023
|
+
|
|
55964
56024
|
// dist/claude-history.js
|
|
55965
56025
|
var claudeCodeHarnessId = harnessIdSchema.parse("claude-code");
|
|
55966
|
-
function
|
|
56026
|
+
function isRecord9(value) {
|
|
55967
56027
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
55968
56028
|
}
|
|
55969
56029
|
function textParts(value) {
|
|
@@ -55971,12 +56031,12 @@ function textParts(value) {
|
|
|
55971
56031
|
return value.length > 0 ? [value] : [];
|
|
55972
56032
|
if (!Array.isArray(value))
|
|
55973
56033
|
return [];
|
|
55974
|
-
return value.flatMap((part) =>
|
|
56034
|
+
return value.flatMap((part) => isRecord9(part) && part.type === "text" && typeof part.text === "string" ? [part.text] : []);
|
|
55975
56035
|
}
|
|
55976
56036
|
function thinkingParts(value) {
|
|
55977
56037
|
if (!Array.isArray(value))
|
|
55978
56038
|
return [];
|
|
55979
|
-
return value.flatMap((part) =>
|
|
56039
|
+
return value.flatMap((part) => isRecord9(part) && part.type === "thinking" && typeof part.thinking === "string" ? [part.thinking] : []);
|
|
55980
56040
|
}
|
|
55981
56041
|
var localCommandRecordPattern = /^\s*<(local-command-(?:stdout|caveat))>[\s\S]*<\/\1>\s*$/u;
|
|
55982
56042
|
var taskNotificationRecordPattern = /^\s*<task-notification>[\s\S]*<\/task-notification>\s*$/u;
|
|
@@ -56026,7 +56086,7 @@ function localCommandStdoutText(text2) {
|
|
|
56026
56086
|
return match[1] ?? "";
|
|
56027
56087
|
}
|
|
56028
56088
|
function isTaskNotificationOrigin(value) {
|
|
56029
|
-
return
|
|
56089
|
+
return isRecord9(value.origin) && value.origin.kind === "task-notification";
|
|
56030
56090
|
}
|
|
56031
56091
|
function visibleUserTextParts(message) {
|
|
56032
56092
|
if (message.type !== "user" || message.syntheticUser)
|
|
@@ -56037,13 +56097,13 @@ function visibleUserTextParts(message) {
|
|
|
56037
56097
|
return parts.filter((part) => !isLocalCommandRecord(part) && !isTaskNotificationRecord(part));
|
|
56038
56098
|
}
|
|
56039
56099
|
function isInterruptionRecord(value, promptId) {
|
|
56040
|
-
if (value.type !== "user" || promptId === null || value.promptId !== promptId || value.promptSource !== void 0 || !
|
|
56100
|
+
if (value.type !== "user" || promptId === null || value.promptId !== promptId || value.promptSource !== void 0 || !isRecord9(value.message))
|
|
56041
56101
|
return false;
|
|
56042
56102
|
const content = value.message.content;
|
|
56043
56103
|
if (!Array.isArray(content) || content.length !== 1)
|
|
56044
56104
|
return false;
|
|
56045
56105
|
const part = content[0];
|
|
56046
|
-
return
|
|
56106
|
+
return isRecord9(part) && part.type === "text" && (part.text === "[Request interrupted by user]" || part.text === "[Request interrupted by user for tool use]");
|
|
56047
56107
|
}
|
|
56048
56108
|
function conversationMessages(values, sessionId) {
|
|
56049
56109
|
const messages = [];
|
|
@@ -56054,11 +56114,31 @@ function conversationMessages(values, sessionId) {
|
|
|
56054
56114
|
const sends = /* @__PURE__ */ new Map();
|
|
56055
56115
|
let pendingNotification = false;
|
|
56056
56116
|
for (const value of values) {
|
|
56057
|
-
if (!
|
|
56117
|
+
if (!isRecord9(value))
|
|
56058
56118
|
throw new Error("Claude history contains a malformed message");
|
|
56059
56119
|
if (value.type === "system")
|
|
56060
56120
|
continue;
|
|
56061
|
-
if (value.type
|
|
56121
|
+
if (value.type === "attachment") {
|
|
56122
|
+
const queued = readClaudeQueuedCommand(value, sessionId);
|
|
56123
|
+
if (!queued)
|
|
56124
|
+
continue;
|
|
56125
|
+
if (ids.has(queued.uuid))
|
|
56126
|
+
throw new Error("Claude history contains duplicate message IDs");
|
|
56127
|
+
ids.add(queued.uuid);
|
|
56128
|
+
messages.push({
|
|
56129
|
+
type: "steering",
|
|
56130
|
+
uuid: queued.uuid,
|
|
56131
|
+
sourceUuid: queued.sourceUuid,
|
|
56132
|
+
message: { role: "user", content: queued.prompt },
|
|
56133
|
+
failed: false,
|
|
56134
|
+
nested: false,
|
|
56135
|
+
syntheticUser: false,
|
|
56136
|
+
interrupted: false,
|
|
56137
|
+
startsTurn: false
|
|
56138
|
+
});
|
|
56139
|
+
continue;
|
|
56140
|
+
}
|
|
56141
|
+
if (value.type !== "user" && value.type !== "assistant" || typeof value.uuid !== "string" || value.uuid.length === 0 || value.session_id !== sessionId || !isRecord9(value.message) || value.message.role !== value.type) {
|
|
56062
56142
|
throw new Error("Claude history contains an invalid message identity");
|
|
56063
56143
|
}
|
|
56064
56144
|
if (ids.has(value.uuid))
|
|
@@ -56074,6 +56154,7 @@ function conversationMessages(values, sessionId) {
|
|
|
56074
56154
|
nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
|
|
56075
56155
|
interrupted,
|
|
56076
56156
|
startsTurn: false,
|
|
56157
|
+
...isRecord9(value.forkedFrom) && typeof value.forkedFrom.messageUuid === "string" ? { forkSourceUuid: value.forkedFrom.messageUuid } : {},
|
|
56077
56158
|
syntheticUser: value.type === "user" && (interrupted || value.isSynthetic === true || value.isMeta === true || isTaskNotificationOrigin(value) || value.toolUseResult !== void 0 && value.toolUseResult !== null)
|
|
56078
56159
|
};
|
|
56079
56160
|
const notification = message.type === "user" && !message.nested && (isTaskNotificationOrigin(value) || textParts(message.message.content).some(isTaskNotificationRecord));
|
|
@@ -56120,7 +56201,21 @@ function conversationMessages(values, sessionId) {
|
|
|
56120
56201
|
promptId = typeof value.promptId === "string" && value.promptId.length > 0 ? value.promptId : null;
|
|
56121
56202
|
}
|
|
56122
56203
|
}
|
|
56123
|
-
|
|
56204
|
+
const userIds = new Set(messages.flatMap((message) => isHumanUser(message) ? [message.uuid, ...message.forkSourceUuid ? [message.forkSourceUuid] : []] : []));
|
|
56205
|
+
const delivered = /* @__PURE__ */ new Map();
|
|
56206
|
+
return messages.filter((message) => {
|
|
56207
|
+
if (message.type !== "steering")
|
|
56208
|
+
return true;
|
|
56209
|
+
const id2 = message.sourceUuid;
|
|
56210
|
+
if (userIds.has(id2))
|
|
56211
|
+
return false;
|
|
56212
|
+
const prompt = message.message.content;
|
|
56213
|
+
const previous = delivered.get(id2);
|
|
56214
|
+
if (previous !== void 0 && previous !== prompt)
|
|
56215
|
+
throw new Error("Claude queued input UUID refers to different prompts");
|
|
56216
|
+
delivered.set(id2, prompt);
|
|
56217
|
+
return previous === void 0;
|
|
56218
|
+
});
|
|
56124
56219
|
}
|
|
56125
56220
|
function isHumanUser(message) {
|
|
56126
56221
|
return visibleUserTextParts(message).length > 0;
|
|
@@ -56172,6 +56267,8 @@ function mapClaudeSnapshot(values, sessionId) {
|
|
|
56172
56267
|
for (let index = 0; index < messages.length; ) {
|
|
56173
56268
|
const user = messages[index];
|
|
56174
56269
|
if (!user || !user.startsTurn) {
|
|
56270
|
+
if (user?.type === "steering")
|
|
56271
|
+
throw new Error("Claude queued input has no native Turn anchor");
|
|
56175
56272
|
index += 1;
|
|
56176
56273
|
continue;
|
|
56177
56274
|
}
|
|
@@ -56181,7 +56278,9 @@ function mapClaudeSnapshot(values, sessionId) {
|
|
|
56181
56278
|
const turnMessages = messages.slice(index, end);
|
|
56182
56279
|
const outcome = turnOutcome(turnMessages);
|
|
56183
56280
|
const results = toolResultBlocks(turnMessages);
|
|
56184
|
-
const
|
|
56281
|
+
const checkpointIndex = turnMessages.findLastIndex(({ type, interrupted, nested }) => !nested && (type === "assistant" || interrupted));
|
|
56282
|
+
const lastSteering = turnMessages.findLastIndex(({ type }) => type === "steering");
|
|
56283
|
+
const checkpointMessage = checkpointIndex > lastSteering ? turnMessages[checkpointIndex] : void 0;
|
|
56185
56284
|
let agentMessageOrdinal = 0;
|
|
56186
56285
|
let reasoningOrdinal = 0;
|
|
56187
56286
|
let toolOrdinal = 0;
|
|
@@ -56205,6 +56304,18 @@ function mapClaudeSnapshot(values, sessionId) {
|
|
|
56205
56304
|
text: displayedUserText(text2)
|
|
56206
56305
|
})),
|
|
56207
56306
|
items: turnMessages.flatMap((message) => {
|
|
56307
|
+
if (message.type === "steering") {
|
|
56308
|
+
return [
|
|
56309
|
+
{
|
|
56310
|
+
item: {
|
|
56311
|
+
type: "userMessage",
|
|
56312
|
+
itemId: hostItemIdSchema.parse(message.uuid),
|
|
56313
|
+
input: [{ type: "text", text: message.message.content }]
|
|
56314
|
+
},
|
|
56315
|
+
outcome: { status: "succeeded" }
|
|
56316
|
+
}
|
|
56317
|
+
];
|
|
56318
|
+
}
|
|
56208
56319
|
if (message.type === "user") {
|
|
56209
56320
|
const recapOutput = visibleUserTextParts(user).some((text3) => isNamedCommandEnvelope(text3, recapCommandNamePattern)) ? textParts(message.message.content).map(localCommandStdoutText).find((text3) => text3 !== null && text3.length > 0) : void 0;
|
|
56210
56321
|
if (!recapOutput)
|
|
@@ -56242,7 +56353,7 @@ function mapClaudeSnapshot(values, sessionId) {
|
|
|
56242
56353
|
let projectedReasoning = false;
|
|
56243
56354
|
let projectedText = false;
|
|
56244
56355
|
for (const [blockIndex, block] of content.entries()) {
|
|
56245
|
-
if (!
|
|
56356
|
+
if (!isRecord9(block))
|
|
56246
56357
|
continue;
|
|
56247
56358
|
if (block.type === "thinking" && !projectedReasoning && reasoning.length > 0) {
|
|
56248
56359
|
items.push({
|
|
@@ -56286,7 +56397,7 @@ function mapClaudeSnapshot(values, sessionId) {
|
|
|
56286
56397
|
}
|
|
56287
56398
|
} : { status: "succeeded" };
|
|
56288
56399
|
const itemId = toolItem !== null ? claudeTranscriptItemId(user.uuid, "tool", toolItem) : hostItemIdSchema.parse(`claude-item-v1-${message.uuid}-tool-${blockIndex}`);
|
|
56289
|
-
if (block.name === "Bash" &&
|
|
56400
|
+
if (block.name === "Bash" && isRecord9(block.input) && typeof block.input.command === "string") {
|
|
56290
56401
|
items.push({
|
|
56291
56402
|
item: {
|
|
56292
56403
|
type: "commandExecution",
|
|
@@ -56324,7 +56435,7 @@ function toolResultBlocks(messages) {
|
|
|
56324
56435
|
if (message.type !== "user" || !Array.isArray(message.message.content))
|
|
56325
56436
|
continue;
|
|
56326
56437
|
for (const block of message.message.content) {
|
|
56327
|
-
if (
|
|
56438
|
+
if (isRecord9(block) && block.type === "tool_result" && typeof block.tool_use_id === "string") {
|
|
56328
56439
|
results.set(block.tool_use_id, block);
|
|
56329
56440
|
}
|
|
56330
56441
|
}
|
|
@@ -56339,7 +56450,7 @@ function toolResultOutput(block) {
|
|
|
56339
56450
|
}
|
|
56340
56451
|
function resultSubagentId(value, block) {
|
|
56341
56452
|
const nativeResult = value.tool_use_result;
|
|
56342
|
-
if (
|
|
56453
|
+
if (isRecord9(nativeResult)) {
|
|
56343
56454
|
const structured = nativeResult.agentId ?? nativeResult.agent_id ?? nativeResult.task_id;
|
|
56344
56455
|
if (typeof structured === "string" && structured.length > 0)
|
|
56345
56456
|
return structured;
|
|
@@ -56350,13 +56461,13 @@ function resultSubagentId(value, block) {
|
|
|
56350
56461
|
function subagentPrompt2(values, nativeSubagentId2) {
|
|
56351
56462
|
const toolUses = /* @__PURE__ */ new Map();
|
|
56352
56463
|
for (const value of values) {
|
|
56353
|
-
if (!
|
|
56464
|
+
if (!isRecord9(value) || !isRecord9(value.message) || !Array.isArray(value.message.content)) {
|
|
56354
56465
|
continue;
|
|
56355
56466
|
}
|
|
56356
56467
|
for (const block of value.message.content) {
|
|
56357
|
-
if (!
|
|
56468
|
+
if (!isRecord9(block))
|
|
56358
56469
|
continue;
|
|
56359
|
-
if (block.type === "tool_use" && typeof block.id === "string" && (block.name === "Agent" || block.name === "Task") &&
|
|
56470
|
+
if (block.type === "tool_use" && typeof block.id === "string" && (block.name === "Agent" || block.name === "Task") && isRecord9(block.input) && typeof block.input.prompt === "string" && block.input.prompt.length > 0) {
|
|
56360
56471
|
toolUses.set(block.id, block.input.prompt);
|
|
56361
56472
|
continue;
|
|
56362
56473
|
}
|
|
@@ -56370,7 +56481,7 @@ function subagentPrompt2(values, nativeSubagentId2) {
|
|
|
56370
56481
|
return void 0;
|
|
56371
56482
|
}
|
|
56372
56483
|
function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, parentValues = []) {
|
|
56373
|
-
const messages = conversationMessages(values.map((value) =>
|
|
56484
|
+
const messages = conversationMessages(values.map((value) => isRecord9(value) ? { ...value, session_id: parentSessionId } : value), parentSessionId);
|
|
56374
56485
|
const turns = [];
|
|
56375
56486
|
for (let index = 0; index < messages.length; ) {
|
|
56376
56487
|
const first = messages[index];
|
|
@@ -56401,7 +56512,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
|
|
|
56401
56512
|
const content = Array.isArray(message.message.content) ? message.message.content : [{ type: "text", text: message.message.content }];
|
|
56402
56513
|
for (let blockIndex = 0; blockIndex < content.length; blockIndex += 1) {
|
|
56403
56514
|
const block = content[blockIndex];
|
|
56404
|
-
if (!
|
|
56515
|
+
if (!isRecord9(block))
|
|
56405
56516
|
continue;
|
|
56406
56517
|
const itemId = hostItemIdSchema.parse(`claude-subagent-item-v2-${nativeSubagentId2}-${message.uuid}-${blockIndex}`);
|
|
56407
56518
|
if (block.type === "thinking" && typeof block.thinking === "string") {
|
|
@@ -56438,7 +56549,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
|
|
|
56438
56549
|
retryable: false
|
|
56439
56550
|
}
|
|
56440
56551
|
} : { status: "succeeded" };
|
|
56441
|
-
if (block.name === "Bash" &&
|
|
56552
|
+
if (block.name === "Bash" && isRecord9(block.input) && typeof block.input.command === "string") {
|
|
56442
56553
|
items.push({
|
|
56443
56554
|
item: {
|
|
56444
56555
|
type: "commandExecution",
|
|
@@ -56704,7 +56815,7 @@ async function findClaudeTranscript(input) {
|
|
|
56704
56815
|
}
|
|
56705
56816
|
return null;
|
|
56706
56817
|
}
|
|
56707
|
-
function
|
|
56818
|
+
function isRecord10(value) {
|
|
56708
56819
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56709
56820
|
}
|
|
56710
56821
|
async function readClaudeTranscript(input) {
|
|
@@ -56722,7 +56833,7 @@ async function readClaudeTranscript(input) {
|
|
|
56722
56833
|
} catch {
|
|
56723
56834
|
continue;
|
|
56724
56835
|
}
|
|
56725
|
-
if (!
|
|
56836
|
+
if (!isRecord10(entry) || entry.type !== "user" && entry.type !== "assistant" && entry.type !== "attachment" || typeof entry.uuid !== "string" || entry.type !== "attachment" && !isRecord10(entry.message)) {
|
|
56726
56837
|
continue;
|
|
56727
56838
|
}
|
|
56728
56839
|
messages.set(entry.uuid, { ...entry, session_id: input.sessionId });
|
|
@@ -56731,7 +56842,7 @@ async function readClaudeTranscript(input) {
|
|
|
56731
56842
|
}
|
|
56732
56843
|
|
|
56733
56844
|
// dist/claude-fork-references.js
|
|
56734
|
-
function
|
|
56845
|
+
function isRecord11(value) {
|
|
56735
56846
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
56736
56847
|
}
|
|
56737
56848
|
function parseEntry(line) {
|
|
@@ -56739,7 +56850,7 @@ function parseEntry(line) {
|
|
|
56739
56850
|
return null;
|
|
56740
56851
|
try {
|
|
56741
56852
|
const entry = JSON.parse(line);
|
|
56742
|
-
return
|
|
56853
|
+
return isRecord11(entry) ? entry : null;
|
|
56743
56854
|
} catch {
|
|
56744
56855
|
return null;
|
|
56745
56856
|
}
|
|
@@ -56748,7 +56859,7 @@ function remapSameAs(value, copies) {
|
|
|
56748
56859
|
if (Array.isArray(value)) {
|
|
56749
56860
|
return value.reduce((count4, item) => count4 + remapSameAs(item, copies), 0);
|
|
56750
56861
|
}
|
|
56751
|
-
if (!
|
|
56862
|
+
if (!isRecord11(value))
|
|
56752
56863
|
return 0;
|
|
56753
56864
|
let count3 = 0;
|
|
56754
56865
|
for (const [key, child] of Object.entries(value)) {
|
|
@@ -56774,7 +56885,7 @@ async function remapForkedSessionReferences(input) {
|
|
|
56774
56885
|
const copies = /* @__PURE__ */ new Map();
|
|
56775
56886
|
for (const entry of entries) {
|
|
56776
56887
|
const source = entry?.forkedFrom;
|
|
56777
|
-
if (typeof entry?.uuid === "string" &&
|
|
56888
|
+
if (typeof entry?.uuid === "string" && isRecord11(source) && typeof source.messageUuid === "string") {
|
|
56778
56889
|
copies.set(source.messageUuid, entry.uuid);
|
|
56779
56890
|
}
|
|
56780
56891
|
}
|
|
@@ -57409,17 +57520,17 @@ function rejectAfter(milliseconds, message) {
|
|
|
57409
57520
|
function processExited(child) {
|
|
57410
57521
|
return child.exitCode !== null || child.signalCode !== null;
|
|
57411
57522
|
}
|
|
57412
|
-
function
|
|
57523
|
+
function isRecord12(value) {
|
|
57413
57524
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
57414
57525
|
}
|
|
57415
57526
|
function permissionModeFromMessage(value) {
|
|
57416
|
-
if (!
|
|
57527
|
+
if (!isRecord12(value) || value.type !== "system" || value.subtype !== "init" && value.subtype !== "status" || !("permissionMode" in value) || value.permissionMode === void 0) {
|
|
57417
57528
|
return void 0;
|
|
57418
57529
|
}
|
|
57419
57530
|
return isClaudePermissionMode(value.permissionMode) ? value.permissionMode : void 0;
|
|
57420
57531
|
}
|
|
57421
57532
|
function parseContextUsage(value) {
|
|
57422
|
-
if (!
|
|
57533
|
+
if (!isRecord12(value))
|
|
57423
57534
|
throw new Error("Claude SDK context Usage is invalid");
|
|
57424
57535
|
const usedTokens = value.totalTokens;
|
|
57425
57536
|
const maxTokens = value.maxTokens;
|
|
@@ -57436,7 +57547,7 @@ function parseQuestions(input) {
|
|
|
57436
57547
|
const questions = [];
|
|
57437
57548
|
const questionTexts = /* @__PURE__ */ new Set();
|
|
57438
57549
|
for (const value of input.questions) {
|
|
57439
|
-
if (!
|
|
57550
|
+
if (!isRecord12(value))
|
|
57440
57551
|
return null;
|
|
57441
57552
|
const question = value.question;
|
|
57442
57553
|
const header = value.header;
|
|
@@ -57447,7 +57558,7 @@ function parseQuestions(input) {
|
|
|
57447
57558
|
const labels = /* @__PURE__ */ new Set();
|
|
57448
57559
|
const options = [];
|
|
57449
57560
|
for (const option2 of value.options) {
|
|
57450
|
-
if (!
|
|
57561
|
+
if (!isRecord12(option2) || typeof option2.label !== "string" || option2.label.length === 0 || labels.has(option2.label) || typeof option2.description !== "string") {
|
|
57451
57562
|
return null;
|
|
57452
57563
|
}
|
|
57453
57564
|
labels.add(option2.label);
|
|
@@ -57489,7 +57600,7 @@ function permissionUpdateDestination(value) {
|
|
|
57489
57600
|
return void 0;
|
|
57490
57601
|
}
|
|
57491
57602
|
function isPermissionUpdate(value) {
|
|
57492
|
-
if (!
|
|
57603
|
+
if (!isRecord12(value) || !permissionUpdateDestination(value.destination))
|
|
57493
57604
|
return false;
|
|
57494
57605
|
if (value.type === "setMode") {
|
|
57495
57606
|
return typeof value.mode === "string" && PERMISSION_MODES.has(value.mode);
|
|
@@ -57498,7 +57609,7 @@ function isPermissionUpdate(value) {
|
|
|
57498
57609
|
return Array.isArray(value.directories) && value.directories.every((directory) => typeof directory === "string");
|
|
57499
57610
|
}
|
|
57500
57611
|
if (value.type === "addRules" || value.type === "replaceRules" || value.type === "removeRules") {
|
|
57501
|
-
return typeof value.behavior === "string" && PERMISSION_BEHAVIORS.has(value.behavior) && Array.isArray(value.rules) && value.rules.every((rule) =>
|
|
57612
|
+
return typeof value.behavior === "string" && PERMISSION_BEHAVIORS.has(value.behavior) && Array.isArray(value.rules) && value.rules.every((rule) => isRecord12(rule) && typeof rule.toolName === "string" && (rule.ruleContent === void 0 || typeof rule.ruleContent === "string"));
|
|
57502
57613
|
}
|
|
57503
57614
|
return false;
|
|
57504
57615
|
}
|
|
@@ -57752,15 +57863,15 @@ var ClaudeSdkTransport = class {
|
|
|
57752
57863
|
return this.#idleLive && this.#idleHandler !== null;
|
|
57753
57864
|
}
|
|
57754
57865
|
#observeRootToolCalls(message) {
|
|
57755
|
-
if (!
|
|
57866
|
+
if (!isRecord12(message) || message.parent_tool_use_id != null)
|
|
57756
57867
|
return;
|
|
57757
57868
|
if (message.type !== "assistant" && message.type !== "user")
|
|
57758
57869
|
return;
|
|
57759
57870
|
const body = message.message;
|
|
57760
|
-
if (!
|
|
57871
|
+
if (!isRecord12(body) || !Array.isArray(body.content))
|
|
57761
57872
|
return;
|
|
57762
57873
|
for (const block of body.content) {
|
|
57763
|
-
if (!
|
|
57874
|
+
if (!isRecord12(block))
|
|
57764
57875
|
continue;
|
|
57765
57876
|
if (message.type === "assistant" && block.type === "tool_use" && typeof block.id === "string") {
|
|
57766
57877
|
this.#rootToolCalls.add(block.id);
|
|
@@ -57770,12 +57881,12 @@ var ClaudeSdkTransport = class {
|
|
|
57770
57881
|
}
|
|
57771
57882
|
}
|
|
57772
57883
|
#observeNativeCapabilities(message) {
|
|
57773
|
-
if (!
|
|
57884
|
+
if (!isRecord12(message) || message.type !== "system" || message.subtype !== "init")
|
|
57774
57885
|
return;
|
|
57775
57886
|
this.#nativeSteer = Array.isArray(message.capabilities) && message.capabilities.includes("msg_lifecycle_v1");
|
|
57776
57887
|
}
|
|
57777
57888
|
#observeSlashCommands(message) {
|
|
57778
|
-
if (!
|
|
57889
|
+
if (!isRecord12(message) || message.type !== "system")
|
|
57779
57890
|
return;
|
|
57780
57891
|
if (message.subtype === "init" && Array.isArray(message.skills)) {
|
|
57781
57892
|
this.#skillNames = new Set(message.skills.filter((name) => typeof name === "string"));
|
|
@@ -58272,7 +58383,7 @@ var ClaudeSdkTransport = class {
|
|
|
58272
58383
|
* without `started` means no native turn takes it over.
|
|
58273
58384
|
*/
|
|
58274
58385
|
#observeSteer(message) {
|
|
58275
|
-
if (this.#pendingSteers.size === 0 && this.#steerTakeovers.size === 0 || !
|
|
58386
|
+
if (this.#pendingSteers.size === 0 && this.#steerTakeovers.size === 0 || !isRecord12(message) || message.type !== "command_lifecycle") {
|
|
58276
58387
|
return;
|
|
58277
58388
|
}
|
|
58278
58389
|
if (typeof message.command_uuid !== "string" || message.command_uuid.length === 0)
|
|
@@ -58286,10 +58397,10 @@ var ClaudeSdkTransport = class {
|
|
|
58286
58397
|
}
|
|
58287
58398
|
}
|
|
58288
58399
|
#observeBackgroundTasks(message) {
|
|
58289
|
-
if (!
|
|
58400
|
+
if (!isRecord12(message) || message.type !== "system")
|
|
58290
58401
|
return;
|
|
58291
58402
|
if (message.subtype === "background_tasks_changed" && Array.isArray(message.tasks)) {
|
|
58292
|
-
this.#backgroundTasks = new Set(message.tasks.flatMap((task) =>
|
|
58403
|
+
this.#backgroundTasks = new Set(message.tasks.flatMap((task) => isRecord12(task) && typeof task.task_id === "string" ? [task.task_id] : []));
|
|
58293
58404
|
} else if (message.subtype === "task_started" && typeof message.task_id === "string") {
|
|
58294
58405
|
this.#backgroundTasks.add(message.task_id);
|
|
58295
58406
|
} else if (message.subtype === "task_notification" && typeof message.task_id === "string" && ["completed", "failed", "stopped"].includes(String(message.status))) {
|
|
@@ -58305,7 +58416,7 @@ var ClaudeSdkTransport = class {
|
|
|
58305
58416
|
}
|
|
58306
58417
|
/** Remembers Workflow agent labels so their approvals can name the agent asking. */
|
|
58307
58418
|
#observeWorkflowAgents(message) {
|
|
58308
|
-
if (!
|
|
58419
|
+
if (!isRecord12(message) || message.type !== "system" || message.subtype !== "task_progress") {
|
|
58309
58420
|
return;
|
|
58310
58421
|
}
|
|
58311
58422
|
for (const agent of parseClaudeWorkflowAgents(message.workflow_progress) ?? []) {
|
|
@@ -58370,7 +58481,7 @@ var ClaudeSdkTransport = class {
|
|
|
58370
58481
|
userMessageId: null,
|
|
58371
58482
|
live: false
|
|
58372
58483
|
});
|
|
58373
|
-
if (autonomous.userMessageId === null &&
|
|
58484
|
+
if (autonomous.userMessageId === null && isRecord12(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) {
|
|
58374
58485
|
autonomous.userMessageId = message.uuid;
|
|
58375
58486
|
}
|
|
58376
58487
|
const interpreted = autonomous.accumulator.consume(message);
|
|
@@ -58900,11 +59011,11 @@ var ClaudeWorkflowLifecycle = class {
|
|
|
58900
59011
|
};
|
|
58901
59012
|
|
|
58902
59013
|
// dist/task-tracker.js
|
|
58903
|
-
function
|
|
59014
|
+
function isRecord13(value) {
|
|
58904
59015
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
58905
59016
|
}
|
|
58906
59017
|
function stringField(value, keys) {
|
|
58907
|
-
if (!
|
|
59018
|
+
if (!isRecord13(value))
|
|
58908
59019
|
return void 0;
|
|
58909
59020
|
for (const key of keys) {
|
|
58910
59021
|
const field2 = value[key];
|
|
@@ -58939,7 +59050,7 @@ var ClaudeTaskTracker = class {
|
|
|
58939
59050
|
};
|
|
58940
59051
|
}
|
|
58941
59052
|
#create(args, result) {
|
|
58942
|
-
if (!
|
|
59053
|
+
if (!isRecord13(result) || !isRecord13(result.task))
|
|
58943
59054
|
return;
|
|
58944
59055
|
const id2 = stringField(result.task, ["id"]);
|
|
58945
59056
|
const subject = stringField(args, ["subject"]) ?? stringField(result.task, ["subject"]);
|
|
@@ -58957,7 +59068,7 @@ var ClaudeTaskTracker = class {
|
|
|
58957
59068
|
const id2 = stringField(args, ["taskId", "id", "task_id"]);
|
|
58958
59069
|
if (!id2)
|
|
58959
59070
|
return;
|
|
58960
|
-
const status =
|
|
59071
|
+
const status = isRecord13(args) ? taskStatus2(args.status) : void 0;
|
|
58961
59072
|
if (status === "deleted") {
|
|
58962
59073
|
this.#tasks.delete(id2);
|
|
58963
59074
|
return;
|
|
@@ -58975,13 +59086,13 @@ var ClaudeTaskTracker = class {
|
|
|
58975
59086
|
});
|
|
58976
59087
|
}
|
|
58977
59088
|
#replace(result) {
|
|
58978
|
-
if (!
|
|
59089
|
+
if (!isRecord13(result) || !Array.isArray(result.tasks))
|
|
58979
59090
|
return;
|
|
58980
59091
|
const next = /* @__PURE__ */ new Map();
|
|
58981
59092
|
for (const value of result.tasks) {
|
|
58982
59093
|
const id2 = stringField(value, ["id"]);
|
|
58983
59094
|
const subject = stringField(value, ["subject"]);
|
|
58984
|
-
const status =
|
|
59095
|
+
const status = isRecord13(value) ? taskStatus2(value.status) : void 0;
|
|
58985
59096
|
if (!id2 || !subject || !status || status === "deleted")
|
|
58986
59097
|
continue;
|
|
58987
59098
|
const existing = this.#tasks.get(id2);
|
|
@@ -59148,11 +59259,11 @@ var ClaudeBackgroundCommandItems = class {
|
|
|
59148
59259
|
};
|
|
59149
59260
|
|
|
59150
59261
|
// dist/tool-lifecycle.js
|
|
59151
|
-
function
|
|
59262
|
+
function isRecord14(value) {
|
|
59152
59263
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59153
59264
|
}
|
|
59154
59265
|
function stringField2(value, key) {
|
|
59155
|
-
return
|
|
59266
|
+
return isRecord14(value) && typeof value[key] === "string" ? value[key] : void 0;
|
|
59156
59267
|
}
|
|
59157
59268
|
function toolFailure(toolName) {
|
|
59158
59269
|
return {
|
|
@@ -59419,7 +59530,7 @@ var CONTEXT_USAGE_TTL_MS = 1e4;
|
|
|
59419
59530
|
var CONTEXT_USAGE_FAILURE_COOLDOWN_MS = 5e3;
|
|
59420
59531
|
var REQUEST_USAGE_RETRY_DELAYS_MS = [0, 100, 250, 500, 1e3];
|
|
59421
59532
|
var DEFAULT_CONTINUATION_QUIESCENCE_MS = 2e3;
|
|
59422
|
-
function
|
|
59533
|
+
function isRecord15(value) {
|
|
59423
59534
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59424
59535
|
}
|
|
59425
59536
|
function safeNonNegativeInteger2(value) {
|
|
@@ -59428,7 +59539,7 @@ function safeNonNegativeInteger2(value) {
|
|
|
59428
59539
|
function transcriptRequestUsage(messages, messageId) {
|
|
59429
59540
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
59430
59541
|
const entry = messages[index];
|
|
59431
|
-
if (!
|
|
59542
|
+
if (!isRecord15(entry) || entry.type !== "assistant" || entry.parent_tool_use_id !== null && entry.parent_tool_use_id !== void 0 || !isRecord15(entry.message) || entry.message.id !== messageId || !isRecord15(entry.message.usage)) {
|
|
59432
59543
|
continue;
|
|
59433
59544
|
}
|
|
59434
59545
|
const inputTokens = entry.message.usage.input_tokens;
|
|
@@ -59745,7 +59856,7 @@ var ClaudeHarnessSession = class {
|
|
|
59745
59856
|
cwd: this.#cwd,
|
|
59746
59857
|
sessionId: this.#sessionId
|
|
59747
59858
|
}) ?? [];
|
|
59748
|
-
const ids = new Set(messages.flatMap((message) =>
|
|
59859
|
+
const ids = new Set(messages.flatMap((message) => isRecord15(message) && typeof message.uuid === "string" ? [message.uuid] : []));
|
|
59749
59860
|
if (this.#unpersistedMessageIds.every((id2) => ids.has(id2))) {
|
|
59750
59861
|
this.#unpersistedMessageIds = [];
|
|
59751
59862
|
break;
|
|
@@ -60659,10 +60770,10 @@ var ClaudeHarnessSession = class {
|
|
|
60659
60770
|
},
|
|
60660
60771
|
onEvent: (event) => this.#deliverLiveEvent(this.#autonomousTarget, event),
|
|
60661
60772
|
onTerminal: (result) => {
|
|
60662
|
-
const
|
|
60773
|
+
const target2 = this.#autonomousTarget;
|
|
60663
60774
|
this.#autonomousTarget = null;
|
|
60664
|
-
if (
|
|
60665
|
-
this.#finishResult(
|
|
60775
|
+
if (target2)
|
|
60776
|
+
this.#finishResult(target2, result);
|
|
60666
60777
|
}
|
|
60667
60778
|
});
|
|
60668
60779
|
transport.setThreadEventHandler((event) => {
|
|
@@ -61222,13 +61333,13 @@ var ClaudeHarnessSession = class {
|
|
|
61222
61333
|
return active;
|
|
61223
61334
|
}
|
|
61224
61335
|
/** Live native events outside a requested Root Segment; settlements stay Thread-level. */
|
|
61225
|
-
#deliverLiveEvent(
|
|
61336
|
+
#deliverLiveEvent(target2, event) {
|
|
61226
61337
|
if (event.type === "usage.request") {
|
|
61227
61338
|
this.#meterUsage(event.record);
|
|
61228
61339
|
return;
|
|
61229
61340
|
}
|
|
61230
|
-
if (
|
|
61231
|
-
this.#handleTurnEvent(
|
|
61341
|
+
if (target2 && this.#active === target2) {
|
|
61342
|
+
this.#handleTurnEvent(target2, event);
|
|
61232
61343
|
return;
|
|
61233
61344
|
}
|
|
61234
61345
|
if (event.type === "subagent.settled")
|