aai-lark-bridge 0.1.4 → 0.1.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/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.1.4",
7
+ version: "0.1.5",
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",
@@ -14724,8 +14724,9 @@ async function runAgentBatch(deps) {
14724
14724
  });
14725
14725
  }
14726
14726
  }
14727
+ const scopeEngaged = Boolean(sessions2.getRaw(scope)) || (sessionCatalog?.hasActiveForScope(scope) ?? false);
14727
14728
  let topicContext = [];
14728
- if (mode === "topic" && threadId && !sessions2.getRaw(scope)) {
14729
+ if (mode === "topic" && threadId && !scopeEngaged) {
14729
14730
  const exclude = /* @__PURE__ */ new Set([...batchIds, ...quoteTargets]);
14730
14731
  topicContext = await fetchTopicContext(channel, threadId, {
14731
14732
  maxMessages: 40,
@@ -16937,6 +16938,22 @@ var SessionCatalog = class {
16937
16938
  }
16938
16939
  return { ...entry };
16939
16940
  }
16941
+ /**
16942
+ * Whether this scope has any live session, regardless of agent, cwd or
16943
+ * policy. Callers that run before the policy is resolved cannot build a
16944
+ * full identity, but still need to know "has the agent already engaged
16945
+ * here" — topic upstream backfill is the case: it must not re-inject the
16946
+ * thread's history into a conversation that already carries it.
16947
+ */
16948
+ hasActiveForScope(scopeId) {
16949
+ for (const entry of this.data.values()) {
16950
+ if (entry.scopeId !== scopeId) continue;
16951
+ if (entry.status !== "active") continue;
16952
+ if (!isValidAgentEntry(entry)) continue;
16953
+ return true;
16954
+ }
16955
+ return false;
16956
+ }
16940
16957
  upsertActive(input) {
16941
16958
  assertAgentIdentity(input);
16942
16959
  const key = sessionCatalogKey(input);