lark-remote 0.4.3 → 0.4.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/binder.d.ts +11 -10
  3. package/dist/binder.js +17 -16
  4. package/dist/bridge/inbound-media.d.ts +1 -27
  5. package/dist/bridge/inbound-media.js +13 -14
  6. package/dist/bridge/index.d.ts +49 -49
  7. package/dist/bridge/index.js +99 -92
  8. package/dist/bridge/queue-manager.d.ts +33 -26
  9. package/dist/bridge/queue-manager.js +117 -117
  10. package/dist/card/bash-renderer.js +4 -4
  11. package/dist/card/card-shared.d.ts +1 -1
  12. package/dist/card/card-shared.js +2 -2
  13. package/dist/card/run-renderer.js +8 -8
  14. package/dist/card/run-state.js +81 -31
  15. package/dist/card/tool-render.js +6 -2
  16. package/dist/cli.js +5 -6
  17. package/dist/clone.d.ts +1 -6
  18. package/dist/clone.js +4 -4
  19. package/dist/common/clamp.d.ts +2 -0
  20. package/dist/common/clamp.js +5 -0
  21. package/dist/common/fs.d.ts +4 -3
  22. package/dist/common/fs.js +5 -4
  23. package/dist/config/dir.d.ts +4 -5
  24. package/dist/config/dir.js +7 -8
  25. package/dist/config/wizard.js +2 -2
  26. package/dist/connector/index.d.ts +0 -2
  27. package/dist/connector/index.js +5 -5
  28. package/dist/inbound/receipt.d.ts +1 -3
  29. package/dist/inbound/receipt.js +2 -2
  30. package/dist/inbound/turn-assembler.d.ts +1 -3
  31. package/dist/inbound/turn-assembler.js +2 -2
  32. package/dist/index.js +30 -22
  33. package/dist/instance-lock.js +4 -4
  34. package/dist/persistence/atomic-write.js +3 -3
  35. package/dist/platform/agent-stopper.d.ts +1 -1
  36. package/dist/platform/terminator-posix.js +5 -5
  37. package/dist/platform/terminator-win32.js +1 -1
  38. package/dist/router/card-helpers.d.ts +1 -3
  39. package/dist/router/card-helpers.js +2 -2
  40. package/dist/router/config/codex.js +1 -1
  41. package/dist/router/config/common/model-patch.d.ts +1 -2
  42. package/dist/router/config/common/model-patch.js +1 -2
  43. package/dist/router/config/opencode.js +1 -1
  44. package/dist/router/config/pi.js +1 -1
  45. package/dist/router/index.d.ts +22 -22
  46. package/dist/router/index.js +71 -52
  47. package/dist/router/order-exec-dispatch.d.ts +3 -10
  48. package/dist/router/order-exec-dispatch.js +3 -3
  49. package/dist/router/{utils.d.ts → usage-format.d.ts} +2 -4
  50. package/dist/router/{utils.js → usage-format.js} +3 -8
  51. package/dist/runner/claude/runner.d.ts +1 -1
  52. package/dist/runner/claude/runner.js +1 -2
  53. package/dist/runner/claude/session.d.ts +2 -4
  54. package/dist/runner/claude/session.js +7 -9
  55. package/dist/runner/common/acp/{protocol-helpers.d.ts → acp-approval.d.ts} +2 -8
  56. package/dist/runner/common/acp/{protocol-helpers.js → acp-approval.js} +4 -3
  57. package/dist/runner/common/acp/base-acp-runner.d.ts +1 -1
  58. package/dist/runner/common/acp/base-acp-runner.js +1 -1
  59. package/dist/runner/common/acp/base-translator.d.ts +43 -0
  60. package/dist/runner/common/acp/base-translator.js +83 -18
  61. package/dist/runner/common/connection-based-runner.d.ts +4 -4
  62. package/dist/runner/common/connection-based-runner.js +3 -3
  63. package/dist/runner/common/jsonrpc/connection-manager.d.ts +12 -12
  64. package/dist/runner/common/jsonrpc/connection-manager.js +36 -36
  65. package/dist/runner/common/{usage.d.ts → result-usage.d.ts} +1 -1
  66. package/dist/runner/common/{usage.js → result-usage.js} +2 -2
  67. package/dist/runner/common/spawning-runner.d.ts +2 -2
  68. package/dist/runner/common/spawning-runner.js +8 -8
  69. package/dist/runner/common/{runner-utils.d.ts → synthetic-events.d.ts} +4 -4
  70. package/dist/runner/common/{runner-utils.js → synthetic-events.js} +5 -5
  71. package/dist/runner/dsh/client.d.ts +1 -1
  72. package/dist/runner/dsh/client.js +1 -1
  73. package/dist/runner/dsh/runner.js +1 -1
  74. package/dist/runner/kimi/acp/runner.d.ts +1 -1
  75. package/dist/runner/kimi/acp/runner.js +1 -1
  76. package/dist/runner/kimi/acp/translator.js +1 -1
  77. package/dist/runner/opencode/acp/runner.d.ts +2 -2
  78. package/dist/runner/opencode/acp/runner.js +1 -1
  79. package/dist/runner/opencode/acp/translator.d.ts +22 -1
  80. package/dist/runner/opencode/acp/translator.js +61 -1
  81. package/dist/runner/pi/rpc/runner.d.ts +1 -1
  82. package/dist/runner/pi/rpc/translator.d.ts +0 -1
  83. package/dist/runner/pi/rpc/translator.js +0 -2
  84. package/dist/runner/registry.d.ts +3 -3
  85. package/dist/runner/registry.js +3 -3
  86. package/dist/session/claude/session-index.d.ts +1 -1
  87. package/dist/session/claude/session-index.js +1 -1
  88. package/dist/session/claude/session-reader.d.ts +1 -1
  89. package/dist/session/claude/session-reader.js +1 -1
  90. package/dist/session/codex/rollout-reader.js +2 -2
  91. package/dist/session/dsh/sessions.d.ts +1 -1
  92. package/dist/session/dsh/sessions.js +1 -1
  93. package/dist/session/kimi/sessions.d.ts +0 -4
  94. package/dist/session/kimi/sessions.js +2 -8
  95. package/dist/session/opencode/sessions.js +3 -3
  96. package/dist/session/registry.d.ts +1 -1
  97. package/dist/session/registry.js +1 -1
  98. package/dist/session/session-store.d.ts +2 -3
  99. package/dist/session/session-store.js +2 -4
  100. package/dist/update/index.d.ts +1 -1
  101. package/dist/update/index.js +1 -1
  102. package/dist/update/version-check.d.ts +5 -3
  103. package/dist/update/version-check.js +10 -8
  104. package/dist/workspace/index.d.ts +4 -4
  105. package/dist/workspace/index.js +5 -5
  106. package/package.json +1 -1
@@ -5,6 +5,6 @@
5
5
  * package installation (detect package manager + global install),
6
6
  * and the combined workflow for the /update command and --update CLI flag.
7
7
  */
8
- export { isNewer, checkLatestVersion, formatUpdateHint, } from './version-check.js';
8
+ export { compareVersions, checkLatestVersion, formatUpdateHint, } from './version-check.js';
9
9
  export { runInstallLatest } from './install.js';
10
10
  //# sourceMappingURL=index.js.map
@@ -12,10 +12,12 @@ export interface VersionCheckResult {
12
12
  }
13
13
  /**
14
14
  * Compare two semver strings (major.minor.patch).
15
- * Returns true if latest > current, false if latest <= current,
16
- * null if either version is not a valid semver string.
15
+ *
16
+ * Returns the sign of `latest - current`: `1` if latest is newer, `-1` if it
17
+ * is older, `0` if equal. Returns `null` if either version is not a valid
18
+ * semver string (callers should treat `null` as "not newer").
17
19
  */
18
- export declare function isNewer(current: string, latest: string): boolean | null;
20
+ export declare function compareVersions(current: string, latest: string): -1 | 0 | 1 | null;
19
21
  /**
20
22
  * Check the latest available version of lark-remote.
21
23
  * Uses a local cache file with 1-hour TTL to avoid frequent network requests.
@@ -10,10 +10,12 @@ export const CACHE_TTL_MS = 60 * 60 * 1000;
10
10
  const DEFAULT_REGISTRY_URL = 'https://registry.npmjs.org/lark-remote/latest';
11
11
  /**
12
12
  * Compare two semver strings (major.minor.patch).
13
- * Returns true if latest > current, false if latest <= current,
14
- * null if either version is not a valid semver string.
13
+ *
14
+ * Returns the sign of `latest - current`: `1` if latest is newer, `-1` if it
15
+ * is older, `0` if equal. Returns `null` if either version is not a valid
16
+ * semver string (callers should treat `null` as "not newer").
15
17
  */
16
- export function isNewer(current, latest) {
18
+ export function compareVersions(current, latest) {
17
19
  const parse = (v) => {
18
20
  // Split core and pre-release suffix; compare the core numerically and treat
19
21
  // a release as newer than any pre-release of the same core version.
@@ -32,14 +34,14 @@ export function isNewer(current, latest) {
32
34
  return null;
33
35
  for (let i = 0; i < 3; i++) {
34
36
  if (l.nums[i] > c.nums[i])
35
- return true;
37
+ return 1;
36
38
  if (l.nums[i] < c.nums[i])
37
- return false;
39
+ return -1;
38
40
  }
39
41
  // Equal core version: a release beats a pre-release of the same version.
40
42
  if (c.pre !== l.pre)
41
- return l.pre === '';
42
- return false;
43
+ return l.pre === '' ? 1 : -1;
44
+ return 0;
43
45
  }
44
46
  /**
45
47
  * Fetch the latest version from npm registry.
@@ -151,7 +153,7 @@ export async function checkLatestVersion(opts) {
151
153
  * Returns null if no newer version is available.
152
154
  */
153
155
  export function formatUpdateHint(current, latest) {
154
- if (!isNewer(current, latest))
156
+ if (compareVersions(current, latest) !== 1)
155
157
  return null;
156
158
  return `📦 有新版本 ${latest} 可用(当前 ${current}),发送 /update 升级`;
157
159
  }
@@ -1,11 +1,11 @@
1
- /** Public view of a workspace entry returned by list(). */
1
+ /** Public view of a cwd entry returned by list(). */
2
2
  export interface WorkspaceEntry {
3
3
  name: string;
4
4
  path: string;
5
5
  lastUsedAt: number;
6
6
  }
7
7
  /**
8
- * Persistent named-alias store for workspace directories.
8
+ * Persistent named-alias store for cwd directories.
9
9
  *
10
10
  * Atomic write (§9.10): writes a temp file then `fs.rename` so a crash
11
11
  * mid-write cannot leave a truncated JSON file. On load, a corrupt file
@@ -13,7 +13,7 @@ export interface WorkspaceEntry {
13
13
  *
14
14
  * lastUsedAt 语义(2026-08-19 语义对齐):保存(save)与使用(use/touch)
15
15
  * 都会把时间戳更新为当前时间。save 内部调用 touch,保证「最近使用」排序
16
- * 对新保存的 workspace 同样生效(新条目应排在列表最前,而非沉底)。
16
+ * 对新保存的 cwd 同样生效(新条目应排在列表最前,而非沉底)。
17
17
  * 同一毫秒内连续操作时 touch 会用 max+1 保证严格递增,避免 Date.now 相同
18
18
  * 导致最近排序退化为字母序。
19
19
  *
@@ -42,7 +42,7 @@ export declare class WorkspaceStore {
42
42
  */
43
43
  touch(name: string): void;
44
44
  /**
45
- * List all workspace entries in insertion order.
45
+ * List all cwd entries in insertion order.
46
46
  * Sorting is the caller's responsibility (view concern).
47
47
  */
48
48
  list(): WorkspaceEntry[];
@@ -4,7 +4,7 @@ import { atomicWriteJson } from '../persistence/atomic-write.js';
4
4
  import { loadJsonFile } from '../persistence/load-json-file.js';
5
5
  import { getLogger } from '../logger/index.js';
6
6
  /**
7
- * Persistent named-alias store for workspace directories.
7
+ * Persistent named-alias store for cwd directories.
8
8
  *
9
9
  * Atomic write (§9.10): writes a temp file then `fs.rename` so a crash
10
10
  * mid-write cannot leave a truncated JSON file. On load, a corrupt file
@@ -12,7 +12,7 @@ import { getLogger } from '../logger/index.js';
12
12
  *
13
13
  * lastUsedAt 语义(2026-08-19 语义对齐):保存(save)与使用(use/touch)
14
14
  * 都会把时间戳更新为当前时间。save 内部调用 touch,保证「最近使用」排序
15
- * 对新保存的 workspace 同样生效(新条目应排在列表最前,而非沉底)。
15
+ * 对新保存的 cwd 同样生效(新条目应排在列表最前,而非沉底)。
16
16
  * 同一毫秒内连续操作时 touch 会用 max+1 保证严格递增,避免 Date.now 相同
17
17
  * 导致最近排序退化为字母序。
18
18
  *
@@ -46,7 +46,7 @@ export class WorkspaceStore {
46
46
  const lastUsedAt = typeof obj.lastUsedAt === 'number' ? obj.lastUsedAt : 0;
47
47
  if (typeof obj.lastUsedAt !== 'number') {
48
48
  if (obj.lastUsedAt !== undefined) {
49
- getLogger().warn(`[workspace] "${k}" has invalid lastUsedAt (${JSON.stringify(obj.lastUsedAt)}), resetting to 0`);
49
+ getLogger().warn(`[cwd] "${k}" has invalid lastUsedAt (${JSON.stringify(obj.lastUsedAt)}), resetting to 0`);
50
50
  }
51
51
  needsMigration = true;
52
52
  }
@@ -66,7 +66,7 @@ export class WorkspaceStore {
66
66
  atomicWriteJson(this.filePath, obj);
67
67
  }
68
68
  save(name, dirPath) {
69
- // 保存即视为使用(语义对齐):新建/覆盖的 workspace 都应拿到当前
69
+ // 保存即视为使用(语义对齐):新建/覆盖的 cwd 都应拿到当前
70
70
  // lastUsedAt,而不是 0,否则「最近使用」排序下新条目会沉底。
71
71
  // touch() 负责统一写入时间戳并 persist,消除 save 写 0 / use 写 now 的不对称。
72
72
  this.data.set(name, { path: dirPath, lastUsedAt: 0 });
@@ -111,7 +111,7 @@ export class WorkspaceStore {
111
111
  this.persist();
112
112
  }
113
113
  /**
114
- * List all workspace entries in insertion order.
114
+ * List all cwd entries in insertion order.
115
115
  * Sorting is the caller's responsibility (view concern).
116
116
  */
117
117
  list() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-remote",
3
- "version": "0.4.3",
3
+ "version": "0.4.5",
4
4
  "description": "Feishu (Lark) private-chat bridge to local coding agents — Claude Code / Codex / opencode / pi / kimi, with live-streaming CardKit 2.0 cards",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",