larkway 0.3.10 → 0.3.11

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/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  You @ the bot in a Feishu thread. It runs on your machine — reading your real codebase, executing commands, opening MRs — and posts the result back. You define what the agent knows and what it can do. Larkway just carries the messages.
10
10
 
11
- **Current release: v0.3.10**
11
+ **Current release: v0.3.11**
12
12
 
13
13
  ---
14
14
 
package/README.zh.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  你在飞书话题里 @ bot,它在你的机器上运行——读真实代码库、执行命令、开 MR——把结果贴回飞书。你定义 agent 知道什么、能做什么。Larkway 只负责传递消息。
10
10
 
11
- **当前版本:v0.3.10**
11
+ **当前版本:v0.3.11**
12
12
 
13
13
  ---
14
14
 
package/dist/cli/index.js CHANGED
@@ -107597,6 +107597,10 @@ function stringField(obj, key) {
107597
107597
  const value = obj[key];
107598
107598
  return typeof value === "string" ? value : void 0;
107599
107599
  }
107600
+ function nonEmptyStringField(obj, key) {
107601
+ const value = stringField(obj, key);
107602
+ return value && value.length > 0 ? value : void 0;
107603
+ }
107600
107604
  function parseLarkCliMessages(stdout2) {
107601
107605
  const parsed = JSON.parse(stdout2);
107602
107606
  if (Array.isArray(parsed)) return parsed;
@@ -107610,6 +107614,25 @@ function parseLarkCliMessages(stdout2) {
107610
107614
  }
107611
107615
  return null;
107612
107616
  }
107617
+ function expandMessagesWithThreadReplies(messages) {
107618
+ const expanded = [];
107619
+ for (const raw of messages) {
107620
+ expanded.push(raw);
107621
+ if (!raw || typeof raw !== "object") continue;
107622
+ const parent = raw;
107623
+ const parentRootId = nonEmptyStringField(parent, "root_id") ?? nonEmptyStringField(parent, "message_id");
107624
+ const replies = arrayField(parent, "thread_replies") ?? [];
107625
+ for (const replyRaw of replies) {
107626
+ if (!replyRaw || typeof replyRaw !== "object") continue;
107627
+ const reply = replyRaw;
107628
+ expanded.push({
107629
+ ...reply,
107630
+ root_id: nonEmptyStringField(reply, "root_id") ?? parentRootId
107631
+ });
107632
+ }
107633
+ }
107634
+ return expanded;
107635
+ }
107613
107636
  function cardActionChoice(value) {
107614
107637
  if (value && typeof value === "object") {
107615
107638
  const choice = value["larkway_choice"];
@@ -107942,8 +107965,9 @@ var init_channelClient = __esm({
107942
107965
  log(`gap-fill: failed to parse lark-cli output for chat ${chatId}`);
107943
107966
  continue;
107944
107967
  }
107945
- totalFetched += messages.length;
107946
- for (const raw of messages) {
107968
+ const messagesWithReplies = expandMessagesWithThreadReplies(messages);
107969
+ totalFetched += messagesWithReplies.length;
107970
+ for (const raw of messagesWithReplies) {
107947
107971
  if (this.closed) break;
107948
107972
  const m = raw;
107949
107973
  const messageId = m["message_id"];
package/dist/main.js CHANGED
@@ -111823,6 +111823,10 @@ function stringField(obj, key) {
111823
111823
  const value = obj[key];
111824
111824
  return typeof value === "string" ? value : void 0;
111825
111825
  }
111826
+ function nonEmptyStringField(obj, key) {
111827
+ const value = stringField(obj, key);
111828
+ return value && value.length > 0 ? value : void 0;
111829
+ }
111826
111830
  function parseLarkCliMessages(stdout) {
111827
111831
  const parsed = JSON.parse(stdout);
111828
111832
  if (Array.isArray(parsed)) return parsed;
@@ -111836,6 +111840,25 @@ function parseLarkCliMessages(stdout) {
111836
111840
  }
111837
111841
  return null;
111838
111842
  }
111843
+ function expandMessagesWithThreadReplies(messages) {
111844
+ const expanded = [];
111845
+ for (const raw of messages) {
111846
+ expanded.push(raw);
111847
+ if (!raw || typeof raw !== "object") continue;
111848
+ const parent = raw;
111849
+ const parentRootId = nonEmptyStringField(parent, "root_id") ?? nonEmptyStringField(parent, "message_id");
111850
+ const replies = arrayField(parent, "thread_replies") ?? [];
111851
+ for (const replyRaw of replies) {
111852
+ if (!replyRaw || typeof replyRaw !== "object") continue;
111853
+ const reply = replyRaw;
111854
+ expanded.push({
111855
+ ...reply,
111856
+ root_id: nonEmptyStringField(reply, "root_id") ?? parentRootId
111857
+ });
111858
+ }
111859
+ }
111860
+ return expanded;
111861
+ }
111839
111862
  function cardActionChoice(value) {
111840
111863
  if (value && typeof value === "object") {
111841
111864
  const choice = value["larkway_choice"];
@@ -112154,8 +112177,9 @@ var ChannelClient = class {
112154
112177
  log(`gap-fill: failed to parse lark-cli output for chat ${chatId}`);
112155
112178
  continue;
112156
112179
  }
112157
- totalFetched += messages.length;
112158
- for (const raw of messages) {
112180
+ const messagesWithReplies = expandMessagesWithThreadReplies(messages);
112181
+ totalFetched += messagesWithReplies.length;
112182
+ for (const raw of messagesWithReplies) {
112159
112183
  if (this.closed) break;
112160
112184
  const m = raw;
112161
112185
  const messageId = m["message_id"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "larkway",
3
- "version": "0.3.10",
3
+ "version": "0.3.11",
4
4
  "description": "Thin bridge: Feishu thread to local Claude Code CLI",
5
5
  "license": "MIT",
6
6
  "author": "Chuck Wu (chuckwu0)",
@@ -19,6 +19,18 @@
19
19
  "bin": {
20
20
  "larkway": "bin/larkway"
21
21
  },
22
+ "scripts": {
23
+ "start": "tsx src/main.ts",
24
+ "cli": "tsx src/cli/index.ts",
25
+ "start:supervised": "bin/start-bridge.sh",
26
+ "dev": "tsx watch src/main.ts",
27
+ "build": "node scripts/build.mjs",
28
+ "prepack": "node scripts/build.mjs",
29
+ "typecheck": "tsc --noEmit",
30
+ "check:links": "bash bin/check-doc-links.sh",
31
+ "test": "vitest run",
32
+ "test:v0.3": "bash bin/v0.3-local-acceptance.sh"
33
+ },
22
34
  "dependencies": {},
23
35
  "devDependencies": {
24
36
  "@types/js-yaml": "^4.0.9",
@@ -36,6 +48,7 @@
36
48
  "qrcode-terminal": "^0.12.0",
37
49
  "zod": "^3.22.0"
38
50
  },
51
+ "packageManager": "pnpm@9.0.0",
39
52
  "engines": {
40
53
  "node": ">=20"
41
54
  },
@@ -43,16 +56,5 @@
43
56
  "dist/",
44
57
  "bin/larkway",
45
58
  "README.md"
46
- ],
47
- "scripts": {
48
- "start": "tsx src/main.ts",
49
- "cli": "tsx src/cli/index.ts",
50
- "start:supervised": "bin/start-bridge.sh",
51
- "dev": "tsx watch src/main.ts",
52
- "build": "node scripts/build.mjs",
53
- "typecheck": "tsc --noEmit",
54
- "check:links": "bash bin/check-doc-links.sh",
55
- "test": "vitest run",
56
- "test:v0.3": "bash bin/v0.3-local-acceptance.sh"
57
- }
58
- }
59
+ ]
60
+ }