zcode-app-cli 3.7.5-11 → 3.7.6-12

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-app-cli",
3
- "version": "3.7.5-11",
3
+ "version": "3.7.6-12",
4
4
  "description": "Unofficial terminal client for the ZCode agent runtime",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,9 +1,9 @@
1
1
  {
2
- "appVersion": "3.7.5",
3
- "cliVersion": "0.16.1",
4
- "extractedAt": "2026-08-10T13:21:56.494Z",
5
- "sha512": "+gCFedwyxr4BJEIQ4QWmbj21FlyGn7Gb3LbcQsyx38PKAt2qoRbjAVjM5XVU0Tj5wViuKFZk/1xRuem28Kjf7A==",
6
- "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.5/linux-x64/ZCode-3.7.5-linux-x64.deb",
2
+ "appVersion": "3.7.6",
3
+ "cliVersion": "0.16.3",
4
+ "extractedAt": "2026-08-13T03:56:59.351Z",
5
+ "sha512": "G2/jCJdOOc7vlCSoqJjCyz7UTdaBWucW7+itRYU5jCEeqvirGOau3hK7HAuf4/Ahv5qQNBO3kU2JjwXx4kdCWQ==",
6
+ "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.6/linux-x64/ZCode-3.7.6-linux-x64.deb",
7
7
  "tui": {
8
8
  "implementation": "@zcode/tui",
9
9
  "foundation": "@earendil-works/pi-tui"
@@ -33758,6 +33758,8 @@ var ModelRetryReason = {
33758
33758
  StreamIdleTimeout: "stream_idle_timeout",
33759
33759
  StaleConnection: "stale_connection",
33760
33760
  AuthRefresh: "auth_refresh",
33761
+ /** Anthropic 明确拒绝历史 thinking signature 后,对请求副本清理并立即重试一次。 */
33762
+ ReasoningSignatureRepair: "reasoning_signature_repair",
33761
33763
  /** off-peak 闲时排队(429/3105+Retry-After):豁免重试预算、无限探测(D24,仅 idle plan provider)。 */
33762
33764
  OffpeakQueued: "offpeak_queued"
33763
33765
  };
@@ -43411,7 +43413,7 @@ var MessageHistoryImpl = class {
43411
43413
  this.entries.push(...entries.map(cloneRuntimeMessageEntry));
43412
43414
  this.cacheStats.totalMessages = this.entries.length;
43413
43415
  }
43414
- addAssistant(content, toolCalls, reasoning) {
43416
+ addAssistant(content, toolCalls, reasoning, modelRef) {
43415
43417
  const reasoningBlocks = reasoning?.map((block) => cloneReasoningBlock(block)) ?? [];
43416
43418
  this.entries.push({
43417
43419
  message: {
@@ -43424,7 +43426,8 @@ var MessageHistoryImpl = class {
43424
43426
  id: tc.id,
43425
43427
  name: tc.name,
43426
43428
  input: tc.input
43427
- }))
43429
+ })),
43430
+ ...modelRef ? { modelRef: { ...modelRef } } : {}
43428
43431
  }
43429
43432
  });
43430
43433
  this.cacheStats.totalMessages = this.entries.length;
@@ -43592,6 +43595,8 @@ function cloneModelInputMessage(message) {
43592
43595
  next.toolName = message.toolName;
43593
43596
  if (message.isError !== void 0)
43594
43597
  next.isError = message.isError;
43598
+ if (message.modelRef)
43599
+ next.modelRef = { ...message.modelRef };
43595
43600
  return next;
43596
43601
  }
43597
43602
  function cloneReasoningBlock(block) {
@@ -43974,7 +43979,11 @@ async function hydrateMessageHistoryFromSession(input) {
43974
43979
  id: part.callID,
43975
43980
  input: part.state.input,
43976
43981
  name: providerToolNameFromPart(part)
43977
- })), reasoning);
43982
+ })), reasoning, {
43983
+ modelId: message.info.modelID,
43984
+ providerId: message.info.providerID,
43985
+ ...message.info.variant ? { variant: message.info.variant } : {}
43986
+ });
43978
43987
  appliedMessageCount++;
43979
43988
  for (const part of toolParts) {
43980
43989
  const providerToolName = providerToolNameFromPart(part);
@@ -46091,7 +46100,10 @@ ${customSystemPrompt}` : ""
46091
46100
  if (dynamicSystemContent) {
46092
46101
  messages.push({
46093
46102
  role: "system",
46094
- content: dynamicSystemContent,
46103
+ // ZCode by design:Main Agent 的 dynamic system block 自带左边界,所有 provider 保持一致。
46104
+ content: `
46105
+
46106
+ ${dynamicSystemContent}`,
46095
46107
  cacheControl: EPHEMERAL_CACHE_CONTROL
46096
46108
  });
46097
46109
  }
@@ -46520,7 +46532,12 @@ function buildManualCompactBoundary(input) {
46520
46532
  };
46521
46533
  }
46522
46534
  function estimateMessageTokens(messages) {
46523
- return messages.reduce((total, message) => total + Math.ceil(modelMessageContentToText(message.content).length / 4), 0);
46535
+ return messages.reduce((total, message) => total + Math.ceil(modelMessageContentToTokenEstimateText(message.content).length / 4), 0);
46536
+ }
46537
+ function modelMessageContentToTokenEstimateText(content) {
46538
+ if (typeof content === "string")
46539
+ return content;
46540
+ return content.map((block) => block.type === "reasoning" ? block.text : modelMessageContentBlockToText(block)).filter(Boolean).join("\n\n");
46524
46541
  }
46525
46542
  function isContextPrefixMessage(message) {
46526
46543
  return message.role === "system" || message.role === "user" && modelMessageContentToText(message.content).trimStart().startsWith("<system-reminder>");
@@ -63583,7 +63600,12 @@ var zcodePluginMarketplaceSummarySchema = external_exports2.object({
63583
63600
  pluginCount: external_exports2.number().int().nonnegative(),
63584
63601
  isOfficial: external_exports2.boolean().optional(),
63585
63602
  // 目录顶层 featured 策展名单(商店「公开」分段 Featured 区)。
63586
- featured: external_exports2.array(external_exports2.string()).optional()
63603
+ featured: external_exports2.array(external_exports2.string()).optional(),
63604
+ refreshFailure: external_exports2.object({
63605
+ code: external_exports2.string(),
63606
+ failedAt: external_exports2.string(),
63607
+ message: external_exports2.string()
63608
+ }).strict().optional()
63587
63609
  }).strict();
63588
63610
  var zcodeAvailablePluginSummarySchema = external_exports2.object({
63589
63611
  id: nonEmptyString3,
@@ -100721,32 +100743,38 @@ function createSubagentContextBuilder(config5) {
100721
100743
  return new SubagentContextBuilder(config5);
100722
100744
  }
100723
100745
  function buildSubagentContextSections(config5) {
100724
- const sections = [
100725
- buildCliPrefixSection(),
100726
- createSubagentSection({
100746
+ const sections = [buildCliPrefixSection()];
100747
+ const agentPrompt = config5.agentPrompt.trimEnd();
100748
+ if (agentPrompt) {
100749
+ sections.push(createSubagentSection({
100727
100750
  name: "Subagent Agent Prompt",
100728
100751
  source: "subagent_agent_prompt",
100729
100752
  cacheHint: "stable",
100730
- // Runtime 已规范化普通 agent prompt;这里只保留空 base prompt 与 persistent Memory
100731
- // 拼接产生的两个前导换行,确保最终 provider-visible 文本与基线一致。
100732
- content: config5.agentPrompt.trimEnd()
100733
- }),
100734
- createSubagentSection({
100735
- name: "Subagent Notes",
100736
- source: "subagent_notes",
100737
- cacheHint: "stable",
100738
- content: buildSubagentCommonNotes()
100739
- }),
100740
- createSubagentSection({
100741
- name: "Subagent Environment",
100742
- source: "subagent_environment",
100743
- cacheHint: "dynamic",
100744
- content: buildSubagentEnvironmentContext({
100745
- agentPrompt: config5.agentPrompt,
100746
- envInfo: config5.envInfo
100747
- })
100748
- })
100749
- ];
100753
+ // 修复原因:空 prompt 不是语义段,不能让左边界单独成为 system block。
100754
+ // ZCode by design:Subagent agent prompt 自带相对 CLI prefix 的单换行左边界。
100755
+ content: `
100756
+ ${agentPrompt}`
100757
+ }));
100758
+ }
100759
+ sections.push(createSubagentSection({
100760
+ name: "Subagent Notes",
100761
+ source: "subagent_notes",
100762
+ cacheHint: "stable",
100763
+ // ZCode by design:后续 Subagent system block 统一自带双换行左边界。
100764
+ content: `
100765
+
100766
+ ${buildSubagentCommonNotes()}`
100767
+ }), createSubagentSection({
100768
+ name: "Subagent Environment",
100769
+ source: "subagent_environment",
100770
+ cacheHint: "dynamic",
100771
+ content: `
100772
+
100773
+ ${buildSubagentEnvironmentContext({
100774
+ agentPrompt: config5.agentPrompt,
100775
+ envInfo: config5.envInfo
100776
+ })}`
100777
+ }));
100750
100778
  const requestUserContextSection = buildRequestUserContextSection({
100751
100779
  userInstructions: config5.userInstructions
100752
100780
  });
@@ -104003,7 +104031,7 @@ function estimateRuntimeEntryTokens(entries, options = {}) {
104003
104031
  applyCacheControl: false,
104004
104032
  useMidConversationSystem: options.useMidConversationSystem
104005
104033
  }).messages;
104006
- return providerMessages.reduce((total, message) => total + Math.ceil(modelMessageContentToText(message.content).length / 4), 0);
104034
+ return estimateMessageTokens(providerMessages);
104007
104035
  }
104008
104036
  function truncateCompactSummaryRequestEntriesAfterPromptTooLong(options) {
104009
104037
  if (options.attempt >= MAX_COMPACT_PROMPT_TOO_LONG_RETRIES) {
@@ -108393,7 +108421,7 @@ async function recoverPartialTextOnlyFailure(input) {
108393
108421
  }
108394
108422
  },
108395
108423
  finish: "stream_recovery_discarded"
108396
- }, input.options.traceContext);
108424
+ }, input.options.traceContext, input.options.modelRef);
108397
108425
  input.state.modelResponse = "";
108398
108426
  input.state.modelStepCount += 1;
108399
108427
  recordModelHistoryRound(input.state);
@@ -110407,9 +110435,7 @@ function createDefaultSubagentPort(deps) {
110407
110435
  traceContext: request.traceContext,
110408
110436
  workspaceRoot: request.workspaceRoot
110409
110437
  });
110410
- const agentPrompt = persistentMemory ? `${baseAgentPrompt ?? ""}
110411
-
110412
- ${persistentMemory.prompt}` : baseAgentPrompt;
110438
+ const agentPrompt = [baseAgentPrompt, persistentMemory?.prompt].filter((part) => typeof part === "string" && part.length > 0).join("\n\n");
110413
110439
  const childPromptEnvInfo = {
110414
110440
  ...childEnvInfo,
110415
110441
  // 修复原因:CC 2.1.167 subagent env 段读取 child 当前 cwd;旧 envInfo snapshot 可能仍停在父会话初始目录。
@@ -113876,7 +113902,7 @@ async function persistToolModelStepFinish(runtime, state, options) {
113876
113902
  completed: Date.now(),
113877
113903
  finish: options.result.finishReason,
113878
113904
  tokens: toTokenUsageInfo(options.result.usage)
113879
- }, options.modelTraceContext);
113905
+ }, options.modelTraceContext, options.result.model);
113880
113906
  }
113881
113907
 
113882
113908
  // ../core/dist/runtime/methods/tool-part-metadata.js
@@ -114471,7 +114497,7 @@ async function enqueueFollowUpUserInputFromToolResult(state, result, traceContex
114471
114497
 
114472
114498
  // ../core/dist/runtime/methods/turn-stop.js
114473
114499
  async function finishModelStepWithoutToolCalls(state, options) {
114474
- this.messageHistory.addAssistant(state.modelResponse, void 0, options.result.reasoning);
114500
+ this.messageHistory.addAssistant(state.modelResponse, void 0, options.result.reasoning, options.result.model);
114475
114501
  await this.persistPart({
114476
114502
  id: createPartId(),
114477
114503
  sessionID: this.sessionId,
@@ -114485,7 +114511,7 @@ async function finishModelStepWithoutToolCalls(state, options) {
114485
114511
  completed: Date.now(),
114486
114512
  finish: options.result.finishReason,
114487
114513
  tokens: toTokenUsageInfo(options.result.usage)
114488
- }, options.modelTraceContext);
114514
+ }, options.modelTraceContext, options.result.model);
114489
114515
  if (state.automationCreateLimitReached) {
114490
114516
  if (state.activeTurn) {
114491
114517
  await this.fallbackPendingGuidesToQueue({
@@ -114629,7 +114655,7 @@ function createStreamingToolCoordinator(runtime, state, options) {
114629
114655
  state.modelStepCount += 1;
114630
114656
  recordModelHistoryRound(state);
114631
114657
  state.toolCallCount += streamedToolResults.length;
114632
- runtime.messageHistory.addAssistant("", toolCalls);
114658
+ runtime.messageHistory.addAssistant("", toolCalls, void 0, options.modelRef);
114633
114659
  state.turnMachine = new TurnMachineImpl(state.turnMachine.receiveModelResponse(""));
114634
114660
  await executeToolCallsForModelStep.call(runtime, state, {
114635
114661
  assistantCreatedAt,
@@ -114637,7 +114663,7 @@ function createStreamingToolCoordinator(runtime, state, options) {
114637
114663
  modelTraceContext: options.traceContext,
114638
114664
  result: {
114639
114665
  finishReason: "tool-calls",
114640
- model: runtime.defaultModelRef,
114666
+ model: options.modelRef,
114641
114667
  providerMetadata: { recoveredFromStreamFailure: true },
114642
114668
  text: "",
114643
114669
  toolCalls,
@@ -115339,7 +115365,7 @@ async function runModelBackedTurnStepImpl(state, options, assistantMessageId) {
115339
115365
  modelStepCount: state.modelStepCount,
115340
115366
  traceContext: modelTraceContext
115341
115367
  });
115342
- await this.persistAssistantMessage(assistantMessageId, state.currentUserMessageId, assistantCreatedAt, void 0, modelTraceContext);
115368
+ await this.persistAssistantMessage(assistantMessageId, state.currentUserMessageId, assistantCreatedAt, void 0, modelTraceContext, executionModelRef);
115343
115369
  await this.persistPart({
115344
115370
  id: createPartId(),
115345
115371
  sessionID: this.sessionId,
@@ -115358,6 +115384,7 @@ async function runModelBackedTurnStepImpl(state, options, assistantMessageId) {
115358
115384
  state.events.push(modelRequestEvent);
115359
115385
  const streamingToolCoordinator = createStreamingToolCoordinator(this, state, {
115360
115386
  assistantMessageId,
115387
+ modelRef: executionModelRef,
115361
115388
  traceContext: modelTraceContext
115362
115389
  });
115363
115390
  const networkEventStartIndex = state.events.length;
@@ -115447,7 +115474,7 @@ async function runModelBackedTurnStepImpl(state, options, assistantMessageId) {
115447
115474
  await this.persistAssistantMessage(assistantMessageId, state.userMessageId, assistantCreatedAt, {
115448
115475
  completed: Date.now(),
115449
115476
  finish: "start_plan_admission_retry_discarded"
115450
- }, modelTraceContext);
115477
+ }, modelTraceContext, executionModelRef);
115451
115478
  state.modelResponse = "";
115452
115479
  state.modelStepCount += 1;
115453
115480
  recordModelHistoryRound(state);
@@ -115498,7 +115525,7 @@ async function runModelBackedTurnStepImpl(state, options, assistantMessageId) {
115498
115525
  ...persistedTurnResult ? { turnResult: persistedTurnResult } : {}
115499
115526
  }
115500
115527
  }
115501
- }, modelTraceContext);
115528
+ }, modelTraceContext, executionModelRef);
115502
115529
  if (isModelContextExceededError(finalError) && await recoverModelStepAfterContextExceeded.call(this, state, finalError, modelStepIndex)) {
115503
115530
  return "continue";
115504
115531
  }
@@ -115653,7 +115680,7 @@ async function runModelBackedTurnStepImpl(state, options, assistantMessageId) {
115653
115680
  });
115654
115681
  }
115655
115682
  state.toolCallCount += executableToolCalls.length;
115656
- this.messageHistory.addAssistant(state.modelResponse, executableToolCalls, result.reasoning);
115683
+ this.messageHistory.addAssistant(state.modelResponse, executableToolCalls, result.reasoning, result.model);
115657
115684
  const toolStepResult = await executeToolCallsForModelStep.call(this, state, {
115658
115685
  assistantCreatedAt,
115659
115686
  assistantMessageId,
@@ -117256,6 +117283,8 @@ var EXTRACTION_DRAIN_TIMEOUT_MS = 6e4;
117256
117283
  function scheduleProjectMemoryExtraction(runtime, input) {
117257
117284
  if (runtime.shuttingDown)
117258
117285
  return;
117286
+ if (runtime.config.memory?.extractionEnabled === false)
117287
+ return;
117259
117288
  const memoryRoot = resolveEnabledProjectMemoryRoot(runtime.config, runtime.workspaceRoot);
117260
117289
  if (!memoryRoot)
117261
117290
  return;
@@ -122797,13 +122826,13 @@ async function recordExternalUserPrompt(input, options) {
122797
122826
  resultType: "success",
122798
122827
  inputId: options?.intent?.sourceCommandId
122799
122828
  }, turnTraceContext), turnTraceContext);
122800
- this.turnNumber += 1;
122801
122829
  const titleGenerationStarted = maybeStartSessionTitleGeneration.call(this, canonicalInput, messageId, traceContext, { goalSummaryTargetID: options?.goalSummaryTargetID });
122802
122830
  if (!titleGenerationStarted && options?.goalSummaryTargetID) {
122803
122831
  maybeStartGoalSummaryTitleGeneration.call(this, canonicalInput, options.goalSummaryTargetID, {
122804
122832
  traceContext
122805
122833
  });
122806
122834
  }
122835
+ this.turnNumber += 1;
122807
122836
  this.messageHistory.setCacheMiss();
122808
122837
  return messageId;
122809
122838
  }
@@ -122862,7 +122891,7 @@ async function persistSyntheticUserNoticeForSession(options) {
122862
122891
  metadata: partMetadata
122863
122892
  }, options.traceContext);
122864
122893
  }
122865
- async function persistAssistantMessage(messageID, parentID, created, update, traceContext) {
122894
+ async function persistAssistantMessage(messageID, parentID, created, update, traceContext, modelRef = this.defaultModelRef) {
122866
122895
  this.latestConversationMessageId = messageID;
122867
122896
  this.latestAssistantMessageId = messageID;
122868
122897
  if (traceContext.turnId) {
@@ -122880,11 +122909,11 @@ async function persistAssistantMessage(messageID, parentID, created, update, tra
122880
122909
  },
122881
122910
  error: update?.error,
122882
122911
  parentID,
122883
- modelID: this.defaultModelRef.modelId,
122884
- providerID: this.defaultModelRef.providerId,
122885
- // Bug 根因:user message 已持久化 variant,但 assistant(通常是恢复扫描命中的最后一条)
122886
- // 没有写,derivePersistedRuntimeSettings 因而只能恢复 model,不能恢复 task-local thought。
122887
- variant: this.defaultModelRef.variant,
122912
+ // Bug 根因:默认模型可能在请求进行中切换;模型请求路径必须显式传入生成这条
122913
+ // 消息的模型。默认值只保留给不经过模型结果的既有 synthetic/fallback 路径。
122914
+ modelID: modelRef.modelId,
122915
+ providerID: modelRef.providerId,
122916
+ variant: modelRef.variant,
122888
122917
  mode: this.config.mode ?? "build",
122889
122918
  agent: this.config.agentName ?? "zcode-agent",
122890
122919
  path: {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pptx
3
- description: Inspect and narrowly update PowerPoint PPTX elements selected in ZCode Preview Pane using fingerprint-checked OOXML references. Use when a prompt contains a `# Presentation elements:` block or the user asks to edit a referenced slide shape or table cell.
3
+ description: Inspect and narrowly update PowerPoint PPTX elements selected in ZCode Preview Pane using fingerprint-checked OOXML references. Use when a prompt contains a `# Presentation element comments:` or legacy `# Presentation elements:` block, or the user asks to edit a referenced slide shape or table cell.
4
4
  ---
5
5
 
6
6
  # PPTX referenced-element editing
@@ -11,12 +11,14 @@ containers may be inspected, but must not be generically rewritten.
11
11
 
12
12
  ## Required workflow
13
13
 
14
- 1. Read the `# Presentation elements:` JSON block from the prompt. Keep `sourceFingerprint`, `slidePart`,
14
+ 1. Read the `# Presentation element comments:` JSON block, or a legacy `# Presentation elements:` block, from the prompt. Keep `sourceFingerprint`, `slidePart`,
15
15
  `nodeId`, and table `rowIndex`/`cellIndex` exactly as supplied.
16
16
  2. Run `inspect` before proposing or performing an update.
17
- 3. When `selectedText` is present, treat it only as the user's intended editing context. Use the full element text
18
- returned by `inspect` to construct the complete replacement passed to `update-text`; never pass the selected
19
- substring alone unless the intended complete element text is exactly that substring.
17
+ 3. Treat optional `selectedText` as the user's intended text focus and every non-empty `comment` as the user's
18
+ requested change to that specific element. They are model context only. Process all comments without applying
19
+ one reference's comment to another. Use the full element text returned by `inspect`
20
+ to construct the complete replacement passed to `update-text`; never pass the selected substring or instruction
21
+ alone unless the intended complete element text is exactly that value.
20
22
  4. If inspect reports a fingerprint, missing-node, ambiguous-node, type, name, text, or cell-coordinate conflict,
21
23
  stop. Ask the user to reopen the PPTX preview and select the element again. Never guess by similar text/name.
22
24
  5. For shape text or table-cell text, run `update-text` to a user-requested output path. Prefer a new `.pptx`
@@ -70,7 +72,7 @@ Exit code `2` means the structured reference is stale or ambiguous and no output
70
72
  - Never treat the Preview Pane bounds, node name, or visible text as the authoritative locator. They are only
71
73
  diagnostics after `sourceFingerprint + slidePart + nodeId (+ cell coordinates)` resolves uniquely.
72
74
  - `textFingerprint` always guards the complete shape or table-cell text. Never recompute it from `selectedText`
73
- or use `selectedText` as a conflict-check target.
75
+ or `comment`, and never use either context field as a conflict-check target.
74
76
  - Do not modify the source through ad-hoc ZIP extraction. The provided script writes and validates a temporary
75
77
  archive before an atomic output replace.
76
78
  - PPTX OOXML text replacement can change line wrapping. It does not provide PowerPoint layout reflow,
@@ -155,11 +155,12 @@ class PptxReferenceTest(unittest.TestCase):
155
155
  self.assertIn(b">FY 2027 review<", slide)
156
156
  self.assertIn(b">84<", slide)
157
157
 
158
- def test_selected_text_is_context_while_full_text_fingerprint_guards_targets(self):
158
+ def test_user_context_does_not_change_full_text_fingerprint_guards(self):
159
159
  output = self.root / "selected-text-updated.pptx"
160
160
  shape_reference = reference(
161
161
  self.source,
162
162
  selectedText="Quarterly",
163
+ comment="Replace review with summary",
163
164
  textFingerprint=text_fingerprint("Quarterly review"),
164
165
  )
165
166
  table_reference = reference(
@@ -171,6 +172,7 @@ class PptxReferenceTest(unittest.TestCase):
171
172
  cellIndex=1,
172
173
  text="42",
173
174
  selectedText="4",
175
+ comment="Double this value",
174
176
  textFingerprint=text_fingerprint("42"),
175
177
  )
176
178