aai-lark-bridge 0.2.5 → 0.2.6

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/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import { Command } from "commander";
4
4
  // package.json
5
5
  var package_default = {
6
6
  name: "aai-lark-bridge",
7
- version: "0.2.5",
7
+ version: "0.2.6",
8
8
  description: "Lark AI Native Bridge - Lark\u57FA\u7840\u8BBE\u65BD\u5C42\u548CCLI\u96C6\u6210",
9
9
  type: "module",
10
10
  main: "./dist/index.js",
@@ -6235,6 +6235,9 @@ function* translateEvent(raw) {
6235
6235
  };
6236
6236
  return;
6237
6237
  }
6238
+ if (typeof evt.result === "string" && evt.result.trim()) {
6239
+ yield { type: "final_text", content: evt.result };
6240
+ }
6238
6241
  yield { type: "done", sessionId: evt.session_id, terminationReason: "normal" };
6239
6242
  }
6240
6243
  }
@@ -15414,6 +15417,11 @@ async function runAgentBatch(deps) {
15414
15417
  if (getShowToolCalls(controls.cfg)) return state;
15415
15418
  return { ...state, blocks: state.blocks.filter((b) => b.kind !== "tool") };
15416
15419
  };
15420
+ const forView = (state) => {
15421
+ const s = filterForPrefs(state);
15422
+ if (controls.profileConfig.agentKind === "codex" || !s.finalText) return s;
15423
+ return { ...s, blocks: [{ kind: "text", content: s.finalText, streaming: false }] };
15424
+ };
15417
15425
  const cardRenderOptions = callbackAuth ? {
15418
15426
  signCallback: (action) => callbackAuth.sign({
15419
15427
  runId: execution.runId,
@@ -15494,7 +15502,7 @@ async function runAgentBatch(deps) {
15494
15502
  producerStarted = true;
15495
15503
  if (progress.abandoned()) return;
15496
15504
  cardCtrl = ctrl;
15497
- await ctrl.update(renderCard(filterForPrefs(latestState), cardRenderOptions));
15505
+ await ctrl.update(renderCard(forView(latestState), cardRenderOptions));
15498
15506
  await renderDone;
15499
15507
  }
15500
15508
  }
@@ -15512,7 +15520,7 @@ async function runAgentBatch(deps) {
15512
15520
  latestState = state;
15513
15521
  if (shouldOpenProgressStream(filterForPrefs(state))) progress.ensureOpen();
15514
15522
  if (cardCtrl) {
15515
- await cardCtrl.update(renderCard(filterForPrefs(state), cardRenderOptions));
15523
+ await cardCtrl.update(renderCard(forView(state), cardRenderOptions));
15516
15524
  }
15517
15525
  },
15518
15526
  startState
@@ -15525,10 +15533,10 @@ async function runAgentBatch(deps) {
15525
15533
  producerStarted: () => producerStarted,
15526
15534
  fallback: async (state) => {
15527
15535
  if (controls.profileConfig.agentKind === "codex") return;
15528
- if (renderText(filterForPrefs(state)).trim() === "") return;
15536
+ if (renderText(forView(state)).trim() === "") return;
15529
15537
  await channel.send(
15530
15538
  chatId,
15531
- { card: renderCard(filterForPrefs(state), cardRenderOptions) },
15539
+ { card: renderCard(forView(state), cardRenderOptions) },
15532
15540
  sendOpts
15533
15541
  );
15534
15542
  }
@@ -15537,8 +15545,8 @@ async function runAgentBatch(deps) {
15537
15545
  if (controls.profileConfig.agentKind !== "codex") throw err;
15538
15546
  log.fail("stream", err, { mode: replyMode, step: "progress-stream" });
15539
15547
  }
15540
- await recallIfEmptyStreamedReply(channel, progress, filterForPrefs(latestState), scope);
15541
- scheduleProgressTerminalUpdate(channel, progress, filterForPrefs(latestState), scope, replyMode);
15548
+ await recallIfEmptyStreamedReply(channel, progress, forView(latestState), scope);
15549
+ scheduleProgressTerminalUpdate(channel, progress, forView(latestState), scope, replyMode);
15542
15550
  if (controls.profileConfig.agentKind === "codex") {
15543
15551
  await sendFinalReply({
15544
15552
  channel,
@@ -15559,7 +15567,7 @@ async function runAgentBatch(deps) {
15559
15567
  channel,
15560
15568
  chatId,
15561
15569
  scope,
15562
- state: tailTextState(filterForPrefs(latestState)),
15570
+ state: tailTextState(forView(latestState)),
15563
15571
  replyMode,
15564
15572
  sendOpts,
15565
15573
  cardRenderOptions
@@ -15579,7 +15587,7 @@ async function runAgentBatch(deps) {
15579
15587
  producerStarted = true;
15580
15588
  if (progress.abandoned()) return;
15581
15589
  markdownCtrl = ctrl;
15582
- await ctrl.setContent(renderText(filterForPrefs(latestState)));
15590
+ await ctrl.setContent(renderText(forView(latestState)));
15583
15591
  await renderDone;
15584
15592
  }
15585
15593
  },
@@ -15596,7 +15604,7 @@ async function runAgentBatch(deps) {
15596
15604
  latestState = state;
15597
15605
  if (shouldOpenProgressStream(filterForPrefs(state))) progress.ensureOpen();
15598
15606
  if (markdownCtrl) {
15599
- await markdownCtrl.setContent(renderText(filterForPrefs(state)));
15607
+ await markdownCtrl.setContent(renderText(forView(state)));
15600
15608
  }
15601
15609
  },
15602
15610
  startState
@@ -15609,7 +15617,7 @@ async function runAgentBatch(deps) {
15609
15617
  producerStarted: () => producerStarted,
15610
15618
  fallback: async (state) => {
15611
15619
  if (controls.profileConfig.agentKind === "codex") return;
15612
- const body = renderText(filterForPrefs(state));
15620
+ const body = renderText(forView(state));
15613
15621
  if (body.trim()) {
15614
15622
  await channel.send(chatId, { markdown: body }, sendOpts);
15615
15623
  }
@@ -15619,8 +15627,8 @@ async function runAgentBatch(deps) {
15619
15627
  if (controls.profileConfig.agentKind !== "codex") throw err;
15620
15628
  log.fail("stream", err, { mode: replyMode, step: "progress-stream" });
15621
15629
  }
15622
- await recallIfEmptyStreamedReply(channel, progress, filterForPrefs(latestState), scope);
15623
- scheduleProgressTerminalUpdate(channel, progress, filterForPrefs(latestState), scope, replyMode);
15630
+ await recallIfEmptyStreamedReply(channel, progress, forView(latestState), scope);
15631
+ scheduleProgressTerminalUpdate(channel, progress, forView(latestState), scope, replyMode);
15624
15632
  if (controls.profileConfig.agentKind === "codex") {
15625
15633
  await sendFinalReply({
15626
15634
  channel,
@@ -15641,7 +15649,7 @@ async function runAgentBatch(deps) {
15641
15649
  channel,
15642
15650
  chatId,
15643
15651
  scope,
15644
- state: tailTextState(filterForPrefs(latestState)),
15652
+ state: tailTextState(forView(latestState)),
15645
15653
  replyMode,
15646
15654
  sendOpts,
15647
15655
  cardRenderOptions
@@ -15662,7 +15670,7 @@ async function runAgentBatch(deps) {
15662
15670
  channel,
15663
15671
  chatId,
15664
15672
  scope,
15665
- state: controls.profileConfig.agentKind === "codex" ? finalAnswerOnlyState(filterForPrefs(finalState)) : filterForPrefs(finalState),
15673
+ state: controls.profileConfig.agentKind === "codex" ? finalAnswerOnlyState(filterForPrefs(finalState)) : forView(finalState),
15666
15674
  replyMode,
15667
15675
  sendOpts,
15668
15676
  cardRenderOptions