larkcc 0.12.0 → 0.12.1

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/CHANGELOG.md CHANGED
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.12.1] - 2026-05-09
11
+
12
+ ### Added
13
+
14
+ - Tool result collapsible panels in CardKit mode: each tool call is shown as a collapsed panel with result preview in the final card
15
+
16
+ ### Fixed
17
+
18
+ - Fix `collapsible_panel` field: `background_style` → `background_color` (align with official Feishu card JSON v2 spec)
19
+
10
20
  ## [0.12.0] - 2026-05-09
11
21
 
12
22
  ### Changed
package/dist/index.js CHANGED
@@ -136876,7 +136876,7 @@ function buildThinkingPanel(options) {
136876
136876
  {
136877
136877
  tag: "collapsible_panel",
136878
136878
  expanded: false,
136879
- background_style: "wathet",
136879
+ background_color: "wathet",
136880
136880
  header: {
136881
136881
  title: {
136882
136882
  tag: "markdown",
@@ -136909,12 +136909,50 @@ function buildThinkingPanel(options) {
136909
136909
  { tag: "hr" }
136910
136910
  ];
136911
136911
  }
136912
- var THINKING_OVERFLOW_TRUNCATE;
136912
+ function buildToolResultPanel(entry) {
136913
+ const preview = entry.resultPreview.length > TOOL_RESULT_TRUNCATE ? truncateSafely(entry.resultPreview, TOOL_RESULT_TRUNCATE, "\n...") : entry.resultPreview;
136914
+ const headerTitle = entry.detail ? `${entry.label} \u2014 ${entry.detail}` : entry.label;
136915
+ return {
136916
+ tag: "collapsible_panel",
136917
+ expanded: false,
136918
+ background_color: "grey",
136919
+ header: {
136920
+ title: {
136921
+ tag: "plain_text",
136922
+ content: headerTitle
136923
+ },
136924
+ vertical_align: "center",
136925
+ icon: {
136926
+ tag: "standard_icon",
136927
+ token: "down-small-ccm_outlined",
136928
+ size: "16px 16px"
136929
+ },
136930
+ icon_position: "right",
136931
+ icon_expanded_angle: -180
136932
+ },
136933
+ border: { color: "grey", corner_radius: "5px" },
136934
+ vertical_spacing: "8px",
136935
+ padding: "8px 8px 8px 8px",
136936
+ elements: [
136937
+ {
136938
+ tag: "markdown",
136939
+ content: preview,
136940
+ text_size: "notation"
136941
+ }
136942
+ ]
136943
+ };
136944
+ }
136945
+ function buildToolPanels(results) {
136946
+ if (results.length === 0) return [];
136947
+ return results.map((r2) => buildToolResultPanel(r2));
136948
+ }
136949
+ var THINKING_OVERFLOW_TRUNCATE, TOOL_RESULT_TRUNCATE;
136913
136950
  var init_duration = __esm({
136914
136951
  "src/format/duration.ts"() {
136915
136952
  "use strict";
136916
136953
  init_card_optimize();
136917
136954
  THINKING_OVERFLOW_TRUNCATE = 3e3;
136955
+ TOOL_RESULT_TRUNCATE = 500;
136918
136956
  }
136919
136957
  });
136920
136958
 
@@ -137501,7 +137539,7 @@ async function updateToolCard(client, msgId, label, detail, resultPreview) {
137501
137539
  elements.push({
137502
137540
  tag: "collapsible_panel",
137503
137541
  expanded: false,
137504
- background_style: "grey",
137542
+ background_color: "grey",
137505
137543
  header: {
137506
137544
  title: {
137507
137545
  tag: "plain_text",
@@ -137840,7 +137878,7 @@ var VERSION3;
137840
137878
  var init_version = __esm({
137841
137879
  "src/version.ts"() {
137842
137880
  "use strict";
137843
- VERSION3 = "0.12.0";
137881
+ VERSION3 = "0.12.1";
137844
137882
  }
137845
137883
  });
137846
137884
 
@@ -155022,7 +155060,10 @@ var init_cardkit = __esm({
155022
155060
  return;
155023
155061
  }
155024
155062
  const optimized = optimizeForCard(content);
155025
- const extraElements = this.buildThinkingElements(options?.thinking, options?.reasoningElapsedMs);
155063
+ const extraElements = [
155064
+ ...this.buildThinkingElements(options?.thinking, options?.reasoningElapsedMs),
155065
+ ...buildToolPanels(options?.toolResults ?? [])
155066
+ ];
155026
155067
  try {
155027
155068
  const finalCardJson = this.buildFinalCard(optimized, extraElements, options?.stats);
155028
155069
  await this.closeAndFinalize(finalCardJson);
@@ -155248,7 +155289,10 @@ ${displayContent}`;
155248
155289
  let cardContent = `\u{1F4DD} \u5185\u5BB9\u8F83\u957F\uFF0C\u5DF2\u5199\u5165\u4E91\u6587\u6863\uFF1A[${title}](${docUrl})`;
155249
155290
  const cleanupConfig = this.context.overflow.document.cleanup;
155250
155291
  await cleanupOldDocuments(token, cleanupConfig.max_docs, this.context.profile);
155251
- const extraElements = this.buildThinkingElements(options?.thinking, options?.reasoningElapsedMs);
155292
+ const extraElements = [
155293
+ ...this.buildThinkingElements(options?.thinking, options?.reasoningElapsedMs),
155294
+ ...buildToolPanels(options?.toolResults ?? [])
155295
+ ];
155252
155296
  const finalCardJson = this.buildFinalCard(cardContent, extraElements, options?.stats);
155253
155297
  await this.closeAndFinalize(finalCardJson);
155254
155298
  } catch (error) {
@@ -155546,6 +155590,7 @@ async function runAgent(prompt2, cwd2, config2, client, chatId, rootMsgId, image
155546
155590
  let reasoningStartTime = null;
155547
155591
  let toolCallCount = 0;
155548
155592
  const toolMsgMap = /* @__PURE__ */ new Map();
155593
+ const cardkitToolResults = [];
155549
155594
  const replyContext = buildReplyContext(config2, profile2, cwd2, chatId, rootMsgId);
155550
155595
  const isCardkitMode = config2.streaming?.mode === "cardkit";
155551
155596
  let cardkitCtrl = null;
@@ -155648,6 +155693,7 @@ async function runAgent(prompt2, cwd2, config2, client, chatId, rootMsgId, image
155648
155693
  const detail2 = formatInput(block.name, block.input ?? {});
155649
155694
  logger.tool(block.name, detail2);
155650
155695
  await cardkitCtrl?.updateStatus(`<text_tag color='orange'>${label2}</text_tag> \`${detail2}\``);
155696
+ cardkitToolResults.push({ id: block.id, label: label2, detail: detail2 });
155651
155697
  break;
155652
155698
  }
155653
155699
  if (SILENT_TOOLS.has(block.name)) break;
@@ -155671,6 +155717,9 @@ async function runAgent(prompt2, cwd2, config2, client, chatId, rootMsgId, image
155671
155717
  if (block.type === "tool_result" && block.tool_use_id) {
155672
155718
  if (isCardkitMode) {
155673
155719
  await cardkitCtrl?.clearStatus();
155720
+ const raw = typeof block.content === "string" ? block.content : JSON.stringify(block.content ?? "");
155721
+ const toolEntry = cardkitToolResults.find((t) => t.id === block.tool_use_id);
155722
+ if (toolEntry) toolEntry.resultPreview = truncate(raw, 500);
155674
155723
  break;
155675
155724
  }
155676
155725
  const toolInfo = toolMsgMap.get(block.tool_use_id);
@@ -155766,7 +155815,8 @@ async function runAgent(prompt2, cwd2, config2, client, chatId, rootMsgId, image
155766
155815
  duration: elapsedSeconds,
155767
155816
  toolCount: toolCallCount
155768
155817
  },
155769
- headerIconImgKey: config2.header_icon_img_key
155818
+ headerIconImgKey: config2.header_icon_img_key,
155819
+ toolResults: cardkitToolResults.filter((t) => t.resultPreview !== void 0).map(({ label, detail, resultPreview }) => ({ label, detail, resultPreview }))
155770
155820
  };
155771
155821
  if (cardkitCtrl) {
155772
155822
  await cardkitCtrl.complete(finalContent, completeOptions);