@karlorz/codexhost-cli-win32-x64 0.17.4-7 → 0.17.4-8

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.
@@ -14998,44 +14998,73 @@ var CONSOLE_HOST_METHODS = Object.freeze([
14998
14998
  var WORKSPACE_CONTRACT_VERSION = 1;
14999
14999
 
15000
15000
  // ../../shared-contracts/dist/thread-questions.js
15001
- var threadQuestionsParamsSchema = external_exports.strictObject({ threadId: hostThreadIdSchema });
15001
+ var threadQuestionsParamsSchema = external_exports.strictObject({
15002
+ threadId: hostThreadIdSchema,
15003
+ unobserved: external_exports.literal(true).optional()
15004
+ });
15002
15005
  var field = { id: external_exports.string().min(1), prompt: external_exports.string(), optional: external_exports.boolean() };
15003
15006
  var questionAutoResolutionSchema = external_exports.strictObject({
15004
15007
  deadlineUnixMs: external_exports.number().int().min(0).max(864e13),
15005
15008
  action: external_exports.enum(["recommended", "decline"]),
15006
15009
  resetOnActivity: external_exports.boolean().optional()
15007
15010
  });
15011
+ var threadQuestionFieldSchema = external_exports.discriminatedUnion("type", [
15012
+ external_exports.strictObject({
15013
+ ...field,
15014
+ type: external_exports.literal("choice"),
15015
+ multiple: external_exports.boolean(),
15016
+ allowOther: external_exports.boolean(),
15017
+ options: external_exports.array(external_exports.strictObject({
15018
+ value: external_exports.string().min(1),
15019
+ label: external_exports.string(),
15020
+ description: external_exports.string().optional()
15021
+ })).min(1)
15022
+ }),
15023
+ external_exports.strictObject({
15024
+ ...field,
15025
+ type: external_exports.literal("text"),
15026
+ multiline: external_exports.boolean(),
15027
+ secret: external_exports.literal(false),
15028
+ placeholder: external_exports.string().optional(),
15029
+ prefill: external_exports.string().optional()
15030
+ })
15031
+ ]);
15008
15032
  var threadQuestionSchema = external_exports.strictObject({
15009
15033
  interactionId: hostInteractionIdSchema,
15010
15034
  turnId: hostTurnIdSchema,
15011
15035
  title: external_exports.string().optional(),
15012
15036
  expiresAt: external_exports.string().optional(),
15013
15037
  autoResolution: questionAutoResolutionSchema.optional(),
15014
- questions: external_exports.array(external_exports.discriminatedUnion("type", [
15015
- external_exports.strictObject({
15016
- ...field,
15017
- type: external_exports.literal("choice"),
15018
- multiple: external_exports.boolean(),
15019
- allowOther: external_exports.boolean(),
15020
- options: external_exports.array(external_exports.strictObject({
15021
- value: external_exports.string().min(1),
15022
- label: external_exports.string(),
15023
- description: external_exports.string().optional()
15024
- })).min(1)
15025
- }),
15026
- external_exports.strictObject({
15027
- ...field,
15028
- type: external_exports.literal("text"),
15029
- multiline: external_exports.boolean(),
15030
- secret: external_exports.literal(false),
15031
- placeholder: external_exports.string().optional(),
15032
- prefill: external_exports.string().optional()
15033
- })
15034
- ])).min(1)
15038
+ questions: external_exports.array(threadQuestionFieldSchema).min(1)
15035
15039
  });
15036
15040
  var threadQuestionsResultSchema = external_exports.strictObject({
15037
15041
  questions: external_exports.array(threadQuestionSchema)
15038
15042
  });
15043
+ var questionRecordOutcomeSchema = external_exports.enum([
15044
+ "answered",
15045
+ "skipped",
15046
+ "closedByHarness",
15047
+ "expired",
15048
+ "turnEnded"
15049
+ ]);
15050
+ var threadQuestionRecordSchema = external_exports.strictObject({
15051
+ interactionId: hostInteractionIdSchema,
15052
+ turnId: hostTurnIdSchema,
15053
+ itemId: hostItemIdSchema,
15054
+ title: external_exports.string().optional(),
15055
+ questions: external_exports.array(threadQuestionFieldSchema).min(1),
15056
+ outcome: questionRecordOutcomeSchema,
15057
+ answers: external_exports.record(external_exports.string(), external_exports.array(external_exports.string()))
15058
+ });
15059
+ var threadQuestionPendingAnchorSchema = external_exports.strictObject({
15060
+ interactionId: hostInteractionIdSchema,
15061
+ turnId: hostTurnIdSchema,
15062
+ itemId: hostItemIdSchema
15063
+ });
15064
+ var threadQuestionRecordsResultSchema = external_exports.strictObject({
15065
+ records: external_exports.array(threadQuestionRecordSchema),
15066
+ pendingAnchors: external_exports.array(threadQuestionPendingAnchorSchema)
15067
+ });
15039
15068
  var threadQuestionRespondParamsSchema = external_exports.strictObject({
15040
15069
  threadId: hostThreadIdSchema,
15041
15070
  interactionId: hostInteractionIdSchema,
@@ -55788,9 +55817,125 @@ function claudeTranscriptItemId(nativeTurnKey, kind, ordinal) {
55788
55817
  return hostItemIdSchema.parse(`claude-item-v2-${nativeTurnKey}-${kind}-${ordinal}`);
55789
55818
  }
55790
55819
 
55820
+ // dist/claude-question-record.js
55821
+ function isRecord8(value) {
55822
+ return typeof value === "object" && value !== null && !Array.isArray(value);
55823
+ }
55824
+ function parseAskUserQuestionInput(input) {
55825
+ if (!isRecord8(input) || !Array.isArray(input.questions) || input.questions.length === 0) {
55826
+ return null;
55827
+ }
55828
+ const questions = [];
55829
+ for (const [index, value] of input.questions.entries()) {
55830
+ if (!isRecord8(value) || typeof value.question !== "string" || value.question.length === 0) {
55831
+ return null;
55832
+ }
55833
+ const options = Array.isArray(value.options) ? value.options.flatMap((option2) => isRecord8(option2) && typeof option2.label === "string" && option2.label.length > 0 ? [
55834
+ {
55835
+ value: option2.label,
55836
+ label: option2.label,
55837
+ ...typeof option2.description === "string" ? { description: option2.description } : {}
55838
+ }
55839
+ ] : []) : [];
55840
+ if (options.length === 0)
55841
+ return null;
55842
+ questions.push({
55843
+ id: `question-${index + 1}`,
55844
+ type: "choice",
55845
+ prompt: value.question,
55846
+ options,
55847
+ multiple: value.multiSelect === true,
55848
+ allowOther: true,
55849
+ optional: false
55850
+ });
55851
+ }
55852
+ return questions;
55853
+ }
55854
+ function parseJsonObject(output) {
55855
+ const trimmed = output.trim();
55856
+ try {
55857
+ const parsed = JSON.parse(trimmed);
55858
+ return isRecord8(parsed) ? parsed : null;
55859
+ } catch {
55860
+ const start = trimmed.indexOf("{");
55861
+ const end = trimmed.lastIndexOf("}");
55862
+ if (start < 0 || end <= start)
55863
+ return null;
55864
+ try {
55865
+ const parsed = JSON.parse(trimmed.slice(start, end + 1));
55866
+ return isRecord8(parsed) ? parsed : null;
55867
+ } catch {
55868
+ return null;
55869
+ }
55870
+ }
55871
+ }
55872
+ function selectedValues(raw) {
55873
+ if (typeof raw === "string") {
55874
+ return raw.split(",").map((part) => part.trim()).filter((part) => part.length > 0);
55875
+ }
55876
+ if (!Array.isArray(raw))
55877
+ return [];
55878
+ return raw.filter((value) => typeof value === "string" && value.trim().length > 0);
55879
+ }
55880
+ function answersFromRecord(parsed, questions) {
55881
+ const answers = {};
55882
+ for (const question of questions) {
55883
+ const selected = selectedValues(parsed[question.prompt] ?? parsed[question.id]);
55884
+ if (selected.length)
55885
+ answers[question.id] = selected;
55886
+ }
55887
+ return answers;
55888
+ }
55889
+ function answersFromProse(output, questions) {
55890
+ const answers = {};
55891
+ for (const question of questions) {
55892
+ const escaped = question.prompt.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
55893
+ const match = output.match(new RegExp(`"${escaped}"\\s*=\\s*"([^"]*)"`, "u"));
55894
+ if (!match?.[1])
55895
+ continue;
55896
+ const selected = selectedValues(match[1]);
55897
+ if (selected.length)
55898
+ answers[question.id] = selected;
55899
+ }
55900
+ return answers;
55901
+ }
55902
+ function parseAnswers(output, questions, toolUseResult) {
55903
+ if (isRecord8(toolUseResult) && isRecord8(toolUseResult.answers)) {
55904
+ const fromStructured = answersFromRecord(toolUseResult.answers, questions);
55905
+ if (Object.keys(fromStructured).length > 0)
55906
+ return fromStructured;
55907
+ }
55908
+ if (!output)
55909
+ return {};
55910
+ const parsed = parseJsonObject(output);
55911
+ if (parsed) {
55912
+ const fromJson = answersFromRecord(parsed, questions);
55913
+ if (Object.keys(fromJson).length > 0)
55914
+ return fromJson;
55915
+ }
55916
+ return answersFromProse(output, questions);
55917
+ }
55918
+ function claudeAskUserQuestionRecord(toolName, input, output, failed, toolUseResult) {
55919
+ if (toolName !== "AskUserQuestion")
55920
+ return void 0;
55921
+ const questions = parseAskUserQuestionInput(input);
55922
+ if (!questions)
55923
+ return void 0;
55924
+ const cancelled = /cancelled the Question/iu.test(output ?? "") || typeof toolUseResult === "string" && /cancelled the Question/iu.test(toolUseResult);
55925
+ const answers = cancelled ? {} : parseAnswers(output, questions, toolUseResult);
55926
+ const first = isRecord8(input) && Array.isArray(input.questions) ? input.questions[0] : void 0;
55927
+ const header = isRecord8(first) && typeof first.header === "string" ? first.header : "";
55928
+ return {
55929
+ title: questions.length === 1 && header.length > 0 ? header : "Claude Code",
55930
+ questions,
55931
+ outcome: cancelled ? "skipped" : failed ? "closedByHarness" : Object.keys(answers).length > 0 ? "answered" : "skipped",
55932
+ answers
55933
+ };
55934
+ }
55935
+
55791
55936
  // dist/claude-history.js
55792
55937
  var claudeCodeHarnessId = harnessIdSchema.parse("claude-code");
55793
- function isRecord8(value) {
55938
+ function isRecord9(value) {
55794
55939
  return typeof value === "object" && value !== null && !Array.isArray(value);
55795
55940
  }
55796
55941
  function textParts(value) {
@@ -55798,12 +55943,12 @@ function textParts(value) {
55798
55943
  return value.length > 0 ? [value] : [];
55799
55944
  if (!Array.isArray(value))
55800
55945
  return [];
55801
- return value.flatMap((part) => isRecord8(part) && part.type === "text" && typeof part.text === "string" ? [part.text] : []);
55946
+ return value.flatMap((part) => isRecord9(part) && part.type === "text" && typeof part.text === "string" ? [part.text] : []);
55802
55947
  }
55803
55948
  function thinkingParts(value) {
55804
55949
  if (!Array.isArray(value))
55805
55950
  return [];
55806
- return value.flatMap((part) => isRecord8(part) && part.type === "thinking" && typeof part.thinking === "string" ? [part.thinking] : []);
55951
+ return value.flatMap((part) => isRecord9(part) && part.type === "thinking" && typeof part.thinking === "string" ? [part.thinking] : []);
55807
55952
  }
55808
55953
  var localCommandRecordPattern = /^\s*<(local-command-(?:stdout|caveat))>[\s\S]*<\/\1>\s*$/u;
55809
55954
  var taskNotificationRecordPattern = /^\s*<task-notification>[\s\S]*<\/task-notification>\s*$/u;
@@ -55853,7 +55998,7 @@ function localCommandStdoutText(text2) {
55853
55998
  return match[1] ?? "";
55854
55999
  }
55855
56000
  function isTaskNotificationOrigin(value) {
55856
- return isRecord8(value.origin) && value.origin.kind === "task-notification";
56001
+ return isRecord9(value.origin) && value.origin.kind === "task-notification";
55857
56002
  }
55858
56003
  function visibleUserTextParts(message) {
55859
56004
  if (message.type !== "user" || message.syntheticUser)
@@ -55864,13 +56009,13 @@ function visibleUserTextParts(message) {
55864
56009
  return parts.filter((part) => !isLocalCommandRecord(part) && !isTaskNotificationRecord(part));
55865
56010
  }
55866
56011
  function isInterruptionRecord(value, promptId) {
55867
- if (value.type !== "user" || promptId === null || value.promptId !== promptId || value.promptSource !== void 0 || !isRecord8(value.message))
56012
+ if (value.type !== "user" || promptId === null || value.promptId !== promptId || value.promptSource !== void 0 || !isRecord9(value.message))
55868
56013
  return false;
55869
56014
  const content = value.message.content;
55870
56015
  if (!Array.isArray(content) || content.length !== 1)
55871
56016
  return false;
55872
56017
  const part = content[0];
55873
- return isRecord8(part) && part.type === "text" && (part.text === "[Request interrupted by user]" || part.text === "[Request interrupted by user for tool use]");
56018
+ return isRecord9(part) && part.type === "text" && (part.text === "[Request interrupted by user]" || part.text === "[Request interrupted by user for tool use]");
55874
56019
  }
55875
56020
  function conversationMessages(values, sessionId) {
55876
56021
  const messages = [];
@@ -55881,11 +56026,11 @@ function conversationMessages(values, sessionId) {
55881
56026
  const sends = /* @__PURE__ */ new Map();
55882
56027
  let pendingNotification = false;
55883
56028
  for (const value of values) {
55884
- if (!isRecord8(value))
56029
+ if (!isRecord9(value))
55885
56030
  throw new Error("Claude history contains a malformed message");
55886
56031
  if (value.type === "system")
55887
56032
  continue;
55888
- if (value.type !== "user" && value.type !== "assistant" || typeof value.uuid !== "string" || value.uuid.length === 0 || value.session_id !== sessionId || !isRecord8(value.message) || value.message.role !== value.type) {
56033
+ 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) {
55889
56034
  throw new Error("Claude history contains an invalid message identity");
55890
56035
  }
55891
56036
  if (ids.has(value.uuid))
@@ -55901,7 +56046,8 @@ function conversationMessages(values, sessionId) {
55901
56046
  nested: typeof value.parent_tool_use_id === "string" && value.parent_tool_use_id.length > 0,
55902
56047
  interrupted,
55903
56048
  startsTurn: false,
55904
- syntheticUser: value.type === "user" && (interrupted || value.isSynthetic === true || value.isMeta === true || isTaskNotificationOrigin(value) || value.toolUseResult !== void 0 && value.toolUseResult !== null)
56049
+ syntheticUser: value.type === "user" && (interrupted || value.isSynthetic === true || value.isMeta === true || isTaskNotificationOrigin(value) || value.toolUseResult !== void 0 && value.toolUseResult !== null),
56050
+ ...value.toolUseResult !== void 0 || value.tool_use_result !== void 0 ? { toolUseResult: value.toolUseResult ?? value.tool_use_result } : {}
55905
56051
  };
55906
56052
  const notification = message.type === "user" && !message.nested && (isTaskNotificationOrigin(value) || textParts(message.message.content).some(isTaskNotificationRecord));
55907
56053
  message.startsTurn = isHumanUser(message) || notification && !occupancy.unsettled && !pendingNotification;
@@ -56069,7 +56215,7 @@ function mapClaudeSnapshot(values, sessionId) {
56069
56215
  let projectedReasoning = false;
56070
56216
  let projectedText = false;
56071
56217
  for (const [blockIndex, block] of content.entries()) {
56072
- if (!isRecord8(block))
56218
+ if (!isRecord9(block))
56073
56219
  continue;
56074
56220
  if (block.type === "thinking" && !projectedReasoning && reasoning.length > 0) {
56075
56221
  items.push({
@@ -56113,7 +56259,7 @@ function mapClaudeSnapshot(values, sessionId) {
56113
56259
  }
56114
56260
  } : { status: "succeeded" };
56115
56261
  const itemId = toolItem !== null ? claudeTranscriptItemId(user.uuid, "tool", toolItem) : hostItemIdSchema.parse(`claude-item-v1-${message.uuid}-tool-${blockIndex}`);
56116
- if (block.name === "Bash" && isRecord8(block.input) && typeof block.input.command === "string") {
56262
+ if (block.name === "Bash" && isRecord9(block.input) && typeof block.input.command === "string") {
56117
56263
  items.push({
56118
56264
  item: {
56119
56265
  type: "commandExecution",
@@ -56126,13 +56272,15 @@ function mapClaudeSnapshot(values, sessionId) {
56126
56272
  continue;
56127
56273
  }
56128
56274
  const argumentsResult = jsonValueSchema.safeParse(block.input);
56275
+ const questionRecord = claudeAskUserQuestionRecord(block.name, block.input, output, failed, result.toolUseResult);
56129
56276
  items.push({
56130
56277
  item: {
56131
56278
  type: "toolExecution",
56132
56279
  itemId,
56133
56280
  toolName: block.name,
56134
56281
  arguments: argumentsResult.success ? argumentsResult.data : null,
56135
- ...output ? { output: { content: [{ type: "text", text: output }] } } : {}
56282
+ ...output ? { output: { content: [{ type: "text", text: output }] } } : {},
56283
+ ...questionRecord ? { questionRecord } : {}
56136
56284
  },
56137
56285
  outcome: toolOutcome
56138
56286
  });
@@ -56151,8 +56299,11 @@ function toolResultBlocks(messages) {
56151
56299
  if (message.type !== "user" || !Array.isArray(message.message.content))
56152
56300
  continue;
56153
56301
  for (const block of message.message.content) {
56154
- if (isRecord8(block) && block.type === "tool_result" && typeof block.tool_use_id === "string") {
56155
- results.set(block.tool_use_id, block);
56302
+ if (isRecord9(block) && block.type === "tool_result" && typeof block.tool_use_id === "string") {
56303
+ results.set(block.tool_use_id, {
56304
+ ...block,
56305
+ ...message.toolUseResult !== void 0 ? { toolUseResult: message.toolUseResult } : {}
56306
+ });
56156
56307
  }
56157
56308
  }
56158
56309
  }
@@ -56166,7 +56317,7 @@ function toolResultOutput(block) {
56166
56317
  }
56167
56318
  function resultSubagentId(value, block) {
56168
56319
  const nativeResult = value.tool_use_result;
56169
- if (isRecord8(nativeResult)) {
56320
+ if (isRecord9(nativeResult)) {
56170
56321
  const structured = nativeResult.agentId ?? nativeResult.agent_id ?? nativeResult.task_id;
56171
56322
  if (typeof structured === "string" && structured.length > 0)
56172
56323
  return structured;
@@ -56177,13 +56328,13 @@ function resultSubagentId(value, block) {
56177
56328
  function subagentPrompt2(values, nativeSubagentId2) {
56178
56329
  const toolUses = /* @__PURE__ */ new Map();
56179
56330
  for (const value of values) {
56180
- if (!isRecord8(value) || !isRecord8(value.message) || !Array.isArray(value.message.content)) {
56331
+ if (!isRecord9(value) || !isRecord9(value.message) || !Array.isArray(value.message.content)) {
56181
56332
  continue;
56182
56333
  }
56183
56334
  for (const block of value.message.content) {
56184
- if (!isRecord8(block))
56335
+ if (!isRecord9(block))
56185
56336
  continue;
56186
- if (block.type === "tool_use" && typeof block.id === "string" && (block.name === "Agent" || block.name === "Task") && isRecord8(block.input) && typeof block.input.prompt === "string" && block.input.prompt.length > 0) {
56337
+ 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) {
56187
56338
  toolUses.set(block.id, block.input.prompt);
56188
56339
  continue;
56189
56340
  }
@@ -56197,7 +56348,7 @@ function subagentPrompt2(values, nativeSubagentId2) {
56197
56348
  return void 0;
56198
56349
  }
56199
56350
  function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, parentValues = []) {
56200
- const messages = conversationMessages(values.map((value) => isRecord8(value) ? { ...value, session_id: parentSessionId } : value), parentSessionId);
56351
+ const messages = conversationMessages(values.map((value) => isRecord9(value) ? { ...value, session_id: parentSessionId } : value), parentSessionId);
56201
56352
  const turns = [];
56202
56353
  for (let index = 0; index < messages.length; ) {
56203
56354
  const first = messages[index];
@@ -56228,7 +56379,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
56228
56379
  const content = Array.isArray(message.message.content) ? message.message.content : [{ type: "text", text: message.message.content }];
56229
56380
  for (let blockIndex = 0; blockIndex < content.length; blockIndex += 1) {
56230
56381
  const block = content[blockIndex];
56231
- if (!isRecord8(block))
56382
+ if (!isRecord9(block))
56232
56383
  continue;
56233
56384
  const itemId = hostItemIdSchema.parse(`claude-subagent-item-v2-${nativeSubagentId2}-${message.uuid}-${blockIndex}`);
56234
56385
  if (block.type === "thinking" && typeof block.thinking === "string") {
@@ -56265,7 +56416,7 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
56265
56416
  retryable: false
56266
56417
  }
56267
56418
  } : { status: "succeeded" };
56268
- if (block.name === "Bash" && isRecord8(block.input) && typeof block.input.command === "string") {
56419
+ if (block.name === "Bash" && isRecord9(block.input) && typeof block.input.command === "string") {
56269
56420
  items.push({
56270
56421
  item: {
56271
56422
  type: "commandExecution",
@@ -56279,13 +56430,15 @@ function mapClaudeSubagentSnapshot(values, parentSessionId, nativeSubagentId2, p
56279
56430
  continue;
56280
56431
  }
56281
56432
  const argumentsResult = jsonValueSchema.safeParse(block.input);
56433
+ const questionRecord = claudeAskUserQuestionRecord(block.name, block.input, output, failed, result.toolUseResult);
56282
56434
  items.push({
56283
56435
  item: {
56284
56436
  type: "toolExecution",
56285
56437
  itemId,
56286
56438
  toolName: block.name,
56287
56439
  arguments: argumentsResult.success ? argumentsResult.data : null,
56288
- ...output ? { output: { content: [{ type: "text", text: output }] } } : {}
56440
+ ...output ? { output: { content: [{ type: "text", text: output }] } } : {},
56441
+ ...questionRecord ? { questionRecord } : {}
56289
56442
  },
56290
56443
  outcome: toolOutcome
56291
56444
  });
@@ -56531,7 +56684,7 @@ async function findClaudeTranscript(input) {
56531
56684
  }
56532
56685
  return null;
56533
56686
  }
56534
- function isRecord9(value) {
56687
+ function isRecord10(value) {
56535
56688
  return typeof value === "object" && value !== null && !Array.isArray(value);
56536
56689
  }
56537
56690
  async function readClaudeTranscript(input) {
@@ -56549,7 +56702,7 @@ async function readClaudeTranscript(input) {
56549
56702
  } catch {
56550
56703
  continue;
56551
56704
  }
56552
- if (!isRecord9(entry) || entry.type !== "user" && entry.type !== "assistant" || typeof entry.uuid !== "string" || !isRecord9(entry.message)) {
56705
+ if (!isRecord10(entry) || entry.type !== "user" && entry.type !== "assistant" || typeof entry.uuid !== "string" || !isRecord10(entry.message)) {
56553
56706
  continue;
56554
56707
  }
56555
56708
  messages.set(entry.uuid, { ...entry, session_id: input.sessionId });
@@ -56558,7 +56711,7 @@ async function readClaudeTranscript(input) {
56558
56711
  }
56559
56712
 
56560
56713
  // dist/claude-fork-references.js
56561
- function isRecord10(value) {
56714
+ function isRecord11(value) {
56562
56715
  return typeof value === "object" && value !== null && !Array.isArray(value);
56563
56716
  }
56564
56717
  function parseEntry(line) {
@@ -56566,7 +56719,7 @@ function parseEntry(line) {
56566
56719
  return null;
56567
56720
  try {
56568
56721
  const entry = JSON.parse(line);
56569
- return isRecord10(entry) ? entry : null;
56722
+ return isRecord11(entry) ? entry : null;
56570
56723
  } catch {
56571
56724
  return null;
56572
56725
  }
@@ -56575,7 +56728,7 @@ function remapSameAs(value, copies) {
56575
56728
  if (Array.isArray(value)) {
56576
56729
  return value.reduce((count5, item) => count5 + remapSameAs(item, copies), 0);
56577
56730
  }
56578
- if (!isRecord10(value))
56731
+ if (!isRecord11(value))
56579
56732
  return 0;
56580
56733
  let count4 = 0;
56581
56734
  for (const [key, child] of Object.entries(value)) {
@@ -56601,7 +56754,7 @@ async function remapForkedSessionReferences(input) {
56601
56754
  const copies = /* @__PURE__ */ new Map();
56602
56755
  for (const entry of entries) {
56603
56756
  const source = entry?.forkedFrom;
56604
- if (typeof entry?.uuid === "string" && isRecord10(source) && typeof source.messageUuid === "string") {
56757
+ if (typeof entry?.uuid === "string" && isRecord11(source) && typeof source.messageUuid === "string") {
56605
56758
  copies.set(source.messageUuid, entry.uuid);
56606
56759
  }
56607
56760
  }
@@ -57236,17 +57389,17 @@ function rejectAfter(milliseconds, message) {
57236
57389
  function processExited(child) {
57237
57390
  return child.exitCode !== null || child.signalCode !== null;
57238
57391
  }
57239
- function isRecord11(value) {
57392
+ function isRecord12(value) {
57240
57393
  return typeof value === "object" && value !== null && !Array.isArray(value);
57241
57394
  }
57242
57395
  function permissionModeFromMessage(value) {
57243
- if (!isRecord11(value) || value.type !== "system" || value.subtype !== "init" && value.subtype !== "status" || !("permissionMode" in value) || value.permissionMode === void 0) {
57396
+ if (!isRecord12(value) || value.type !== "system" || value.subtype !== "init" && value.subtype !== "status" || !("permissionMode" in value) || value.permissionMode === void 0) {
57244
57397
  return void 0;
57245
57398
  }
57246
57399
  return isClaudePermissionMode(value.permissionMode) ? value.permissionMode : void 0;
57247
57400
  }
57248
57401
  function parseContextUsage(value) {
57249
- if (!isRecord11(value))
57402
+ if (!isRecord12(value))
57250
57403
  throw new Error("Claude SDK context Usage is invalid");
57251
57404
  const usedTokens = value.totalTokens;
57252
57405
  const maxTokens = value.maxTokens;
@@ -57263,7 +57416,7 @@ function parseQuestions(input) {
57263
57416
  const questions = [];
57264
57417
  const questionTexts = /* @__PURE__ */ new Set();
57265
57418
  for (const value of input.questions) {
57266
- if (!isRecord11(value))
57419
+ if (!isRecord12(value))
57267
57420
  return null;
57268
57421
  const question = value.question;
57269
57422
  const header = value.header;
@@ -57274,7 +57427,7 @@ function parseQuestions(input) {
57274
57427
  const labels = /* @__PURE__ */ new Set();
57275
57428
  const options = [];
57276
57429
  for (const option2 of value.options) {
57277
- if (!isRecord11(option2) || typeof option2.label !== "string" || option2.label.length === 0 || labels.has(option2.label) || typeof option2.description !== "string") {
57430
+ if (!isRecord12(option2) || typeof option2.label !== "string" || option2.label.length === 0 || labels.has(option2.label) || typeof option2.description !== "string") {
57278
57431
  return null;
57279
57432
  }
57280
57433
  labels.add(option2.label);
@@ -57316,7 +57469,7 @@ function permissionUpdateDestination(value) {
57316
57469
  return void 0;
57317
57470
  }
57318
57471
  function isPermissionUpdate(value) {
57319
- if (!isRecord11(value) || !permissionUpdateDestination(value.destination))
57472
+ if (!isRecord12(value) || !permissionUpdateDestination(value.destination))
57320
57473
  return false;
57321
57474
  if (value.type === "setMode") {
57322
57475
  return typeof value.mode === "string" && PERMISSION_MODES.has(value.mode);
@@ -57325,7 +57478,7 @@ function isPermissionUpdate(value) {
57325
57478
  return Array.isArray(value.directories) && value.directories.every((directory) => typeof directory === "string");
57326
57479
  }
57327
57480
  if (value.type === "addRules" || value.type === "replaceRules" || value.type === "removeRules") {
57328
- 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"));
57481
+ 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"));
57329
57482
  }
57330
57483
  return false;
57331
57484
  }
@@ -57579,15 +57732,15 @@ var ClaudeSdkTransport = class {
57579
57732
  return this.#idleLive && this.#idleHandler !== null;
57580
57733
  }
57581
57734
  #observeRootToolCalls(message) {
57582
- if (!isRecord11(message) || message.parent_tool_use_id != null)
57735
+ if (!isRecord12(message) || message.parent_tool_use_id != null)
57583
57736
  return;
57584
57737
  if (message.type !== "assistant" && message.type !== "user")
57585
57738
  return;
57586
57739
  const body = message.message;
57587
- if (!isRecord11(body) || !Array.isArray(body.content))
57740
+ if (!isRecord12(body) || !Array.isArray(body.content))
57588
57741
  return;
57589
57742
  for (const block of body.content) {
57590
- if (!isRecord11(block))
57743
+ if (!isRecord12(block))
57591
57744
  continue;
57592
57745
  if (message.type === "assistant" && block.type === "tool_use" && typeof block.id === "string") {
57593
57746
  this.#rootToolCalls.add(block.id);
@@ -57597,12 +57750,12 @@ var ClaudeSdkTransport = class {
57597
57750
  }
57598
57751
  }
57599
57752
  #observeNativeCapabilities(message) {
57600
- if (!isRecord11(message) || message.type !== "system" || message.subtype !== "init")
57753
+ if (!isRecord12(message) || message.type !== "system" || message.subtype !== "init")
57601
57754
  return;
57602
57755
  this.#nativeSteer = Array.isArray(message.capabilities) && message.capabilities.includes("msg_lifecycle_v1");
57603
57756
  }
57604
57757
  #observeSlashCommands(message) {
57605
- if (!isRecord11(message) || message.type !== "system")
57758
+ if (!isRecord12(message) || message.type !== "system")
57606
57759
  return;
57607
57760
  if (message.subtype === "init" && Array.isArray(message.skills)) {
57608
57761
  this.#skillNames = new Set(message.skills.filter((name) => typeof name === "string"));
@@ -58099,7 +58252,7 @@ var ClaudeSdkTransport = class {
58099
58252
  * without `started` means no native turn takes it over.
58100
58253
  */
58101
58254
  #observeSteer(message) {
58102
- if (this.#pendingSteers.size === 0 && this.#steerTakeovers.size === 0 || !isRecord11(message) || message.type !== "command_lifecycle") {
58255
+ if (this.#pendingSteers.size === 0 && this.#steerTakeovers.size === 0 || !isRecord12(message) || message.type !== "command_lifecycle") {
58103
58256
  return;
58104
58257
  }
58105
58258
  if (typeof message.command_uuid !== "string" || message.command_uuid.length === 0)
@@ -58113,10 +58266,10 @@ var ClaudeSdkTransport = class {
58113
58266
  }
58114
58267
  }
58115
58268
  #observeBackgroundTasks(message) {
58116
- if (!isRecord11(message) || message.type !== "system")
58269
+ if (!isRecord12(message) || message.type !== "system")
58117
58270
  return;
58118
58271
  if (message.subtype === "background_tasks_changed" && Array.isArray(message.tasks)) {
58119
- this.#backgroundTasks = new Set(message.tasks.flatMap((task) => isRecord11(task) && typeof task.task_id === "string" ? [task.task_id] : []));
58272
+ this.#backgroundTasks = new Set(message.tasks.flatMap((task) => isRecord12(task) && typeof task.task_id === "string" ? [task.task_id] : []));
58120
58273
  } else if (message.subtype === "task_started" && typeof message.task_id === "string") {
58121
58274
  this.#backgroundTasks.add(message.task_id);
58122
58275
  } else if (message.subtype === "task_notification" && typeof message.task_id === "string" && ["completed", "failed", "stopped"].includes(String(message.status))) {
@@ -58132,7 +58285,7 @@ var ClaudeSdkTransport = class {
58132
58285
  }
58133
58286
  /** Remembers Workflow agent labels so their approvals can name the agent asking. */
58134
58287
  #observeWorkflowAgents(message) {
58135
- if (!isRecord11(message) || message.type !== "system" || message.subtype !== "task_progress") {
58288
+ if (!isRecord12(message) || message.type !== "system" || message.subtype !== "task_progress") {
58136
58289
  return;
58137
58290
  }
58138
58291
  for (const agent of parseClaudeWorkflowAgents(message.workflow_progress) ?? []) {
@@ -58197,7 +58350,7 @@ var ClaudeSdkTransport = class {
58197
58350
  userMessageId: null,
58198
58351
  live: false
58199
58352
  });
58200
- 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) {
58353
+ 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) {
58201
58354
  autonomous.userMessageId = message.uuid;
58202
58355
  }
58203
58356
  const interpreted = autonomous.accumulator.consume(message);
@@ -58729,11 +58882,11 @@ var ClaudeWorkflowLifecycle = class {
58729
58882
  };
58730
58883
 
58731
58884
  // dist/task-tracker.js
58732
- function isRecord12(value) {
58885
+ function isRecord13(value) {
58733
58886
  return typeof value === "object" && value !== null && !Array.isArray(value);
58734
58887
  }
58735
58888
  function stringField(value, keys) {
58736
- if (!isRecord12(value))
58889
+ if (!isRecord13(value))
58737
58890
  return void 0;
58738
58891
  for (const key of keys) {
58739
58892
  const field2 = value[key];
@@ -58768,7 +58921,7 @@ var ClaudeTaskTracker = class {
58768
58921
  };
58769
58922
  }
58770
58923
  #create(args, result) {
58771
- if (!isRecord12(result) || !isRecord12(result.task))
58924
+ if (!isRecord13(result) || !isRecord13(result.task))
58772
58925
  return;
58773
58926
  const id2 = stringField(result.task, ["id"]);
58774
58927
  const subject = stringField(args, ["subject"]) ?? stringField(result.task, ["subject"]);
@@ -58786,7 +58939,7 @@ var ClaudeTaskTracker = class {
58786
58939
  const id2 = stringField(args, ["taskId", "id", "task_id"]);
58787
58940
  if (!id2)
58788
58941
  return;
58789
- const status = isRecord12(args) ? taskStatus2(args.status) : void 0;
58942
+ const status = isRecord13(args) ? taskStatus2(args.status) : void 0;
58790
58943
  if (status === "deleted") {
58791
58944
  this.#tasks.delete(id2);
58792
58945
  return;
@@ -58804,13 +58957,13 @@ var ClaudeTaskTracker = class {
58804
58957
  });
58805
58958
  }
58806
58959
  #replace(result) {
58807
- if (!isRecord12(result) || !Array.isArray(result.tasks))
58960
+ if (!isRecord13(result) || !Array.isArray(result.tasks))
58808
58961
  return;
58809
58962
  const next = /* @__PURE__ */ new Map();
58810
58963
  for (const value of result.tasks) {
58811
58964
  const id2 = stringField(value, ["id"]);
58812
58965
  const subject = stringField(value, ["subject"]);
58813
- const status = isRecord12(value) ? taskStatus2(value.status) : void 0;
58966
+ const status = isRecord13(value) ? taskStatus2(value.status) : void 0;
58814
58967
  if (!id2 || !subject || !status || status === "deleted")
58815
58968
  continue;
58816
58969
  const existing = this.#tasks.get(id2);
@@ -58977,11 +59130,11 @@ var ClaudeBackgroundCommandItems = class {
58977
59130
  };
58978
59131
 
58979
59132
  // dist/tool-lifecycle.js
58980
- function isRecord13(value) {
59133
+ function isRecord14(value) {
58981
59134
  return typeof value === "object" && value !== null && !Array.isArray(value);
58982
59135
  }
58983
59136
  function stringField2(value, key) {
58984
- return isRecord13(value) && typeof value[key] === "string" ? value[key] : void 0;
59137
+ return isRecord14(value) && typeof value[key] === "string" ? value[key] : void 0;
58985
59138
  }
58986
59139
  function toolFailure(toolName) {
58987
59140
  return {
@@ -59248,7 +59401,7 @@ var CONTEXT_USAGE_TTL_MS = 1e4;
59248
59401
  var CONTEXT_USAGE_FAILURE_COOLDOWN_MS = 5e3;
59249
59402
  var REQUEST_USAGE_RETRY_DELAYS_MS = [0, 100, 250, 500, 1e3];
59250
59403
  var DEFAULT_CONTINUATION_QUIESCENCE_MS = 2e3;
59251
- function isRecord14(value) {
59404
+ function isRecord15(value) {
59252
59405
  return typeof value === "object" && value !== null && !Array.isArray(value);
59253
59406
  }
59254
59407
  function safeNonNegativeInteger2(value) {
@@ -59257,7 +59410,7 @@ function safeNonNegativeInteger2(value) {
59257
59410
  function transcriptRequestUsage(messages, messageId) {
59258
59411
  for (let index = messages.length - 1; index >= 0; index -= 1) {
59259
59412
  const entry = messages[index];
59260
- 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)) {
59413
+ 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)) {
59261
59414
  continue;
59262
59415
  }
59263
59416
  const inputTokens = entry.message.usage.input_tokens;
@@ -59574,7 +59727,7 @@ var ClaudeHarnessSession = class {
59574
59727
  cwd: this.#cwd,
59575
59728
  sessionId: this.#sessionId
59576
59729
  }) ?? [];
59577
- const ids = new Set(messages.flatMap((message) => isRecord14(message) && typeof message.uuid === "string" ? [message.uuid] : []));
59730
+ const ids = new Set(messages.flatMap((message) => isRecord15(message) && typeof message.uuid === "string" ? [message.uuid] : []));
59578
59731
  if (this.#unpersistedMessageIds.every((id2) => ids.has(id2))) {
59579
59732
  this.#unpersistedMessageIds = [];
59580
59733
  break;