lark-remote 0.4.5 → 0.5.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.
Files changed (127) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/bridge/approval-coordinator.d.ts +1 -1
  3. package/dist/bridge/approval-coordinator.js +3 -3
  4. package/dist/bridge/inbound-media.js +10 -7
  5. package/dist/bridge/index.d.ts +55 -17
  6. package/dist/bridge/index.js +145 -74
  7. package/dist/bridge/queue-manager.d.ts +71 -20
  8. package/dist/bridge/queue-manager.js +139 -57
  9. package/dist/card/approval-render.d.ts +1 -1
  10. package/dist/card/approval-render.js +6 -6
  11. package/dist/card/bash-card-session.d.ts +3 -3
  12. package/dist/card/bash-card-session.js +3 -3
  13. package/dist/card/bash-renderer.js +1 -1
  14. package/dist/card/card-session.d.ts +4 -4
  15. package/dist/card/card-session.js +6 -6
  16. package/dist/card/run-card-session.js +2 -2
  17. package/dist/card/run-renderer.d.ts +1 -1
  18. package/dist/card/run-renderer.js +14 -14
  19. package/dist/card/run-state.d.ts +2 -2
  20. package/dist/card/run-state.js +3 -3
  21. package/dist/card/tool-render.d.ts +1 -1
  22. package/dist/card/tool-render.js +6 -6
  23. package/dist/cli.js +2 -1
  24. package/dist/clone.d.ts +5 -3
  25. package/dist/clone.js +8 -4
  26. package/dist/common/truncate.d.ts +1 -1
  27. package/dist/common/truncate.js +2 -2
  28. package/dist/common/ttl-cache.d.ts +2 -2
  29. package/dist/common/ttl-cache.js +2 -2
  30. package/dist/config/codex-config.d.ts +9 -9
  31. package/dist/config/codex-config.js +18 -18
  32. package/dist/config/dir.js +5 -2
  33. package/dist/config/index.d.ts +3 -3
  34. package/dist/config/index.js +6 -6
  35. package/dist/config/opencode-config.js +3 -3
  36. package/dist/connector/index.d.ts +5 -5
  37. package/dist/connector/index.js +24 -11
  38. package/dist/inbound/event.d.ts +1 -1
  39. package/dist/inbound/event.js +1 -1
  40. package/dist/inbound/placeholder.d.ts +2 -2
  41. package/dist/inbound/placeholder.js +2 -2
  42. package/dist/index.js +23 -12
  43. package/dist/instance-lock.js +4 -3
  44. package/dist/logger/index.d.ts +1 -1
  45. package/dist/logger/index.js +4 -4
  46. package/dist/persistence/atomic-write.d.ts +1 -1
  47. package/dist/persistence/atomic-write.js +6 -2
  48. package/dist/platform/agent-stopper.d.ts +1 -1
  49. package/dist/platform/identity.d.ts +7 -1
  50. package/dist/platform/identity.js +2 -2
  51. package/dist/platform/path.d.ts +6 -0
  52. package/dist/platform/path.js +14 -8
  53. package/dist/platform/select.d.ts +1 -1
  54. package/dist/platform/select.js +1 -1
  55. package/dist/platform/shell.d.ts +2 -3
  56. package/dist/platform/spawn.d.ts +2 -2
  57. package/dist/platform/spawn.js +2 -2
  58. package/dist/platform/terminator-posix.js +1 -1
  59. package/dist/platform/terminator-win32.js +2 -2
  60. package/dist/platform/terminator.d.ts +3 -3
  61. package/dist/platform/terminator.js +2 -2
  62. package/dist/platform/types.d.ts +1 -1
  63. package/dist/restart.d.ts +1 -1
  64. package/dist/restart.js +5 -3
  65. package/dist/router/config/codex.d.ts +1 -1
  66. package/dist/router/config/codex.js +2 -2
  67. package/dist/router/config/opencode.js +1 -1
  68. package/dist/router/index.d.ts +65 -16
  69. package/dist/router/index.js +141 -47
  70. package/dist/router/order-exec-dispatch.js +2 -2
  71. package/dist/runner/bash/runner.d.ts +2 -2
  72. package/dist/runner/bash/runner.js +6 -6
  73. package/dist/runner/claude/runner.js +1 -1
  74. package/dist/runner/claude/session.d.ts +2 -2
  75. package/dist/runner/claude/session.js +14 -14
  76. package/dist/runner/codex/app-server/runner.d.ts +28 -0
  77. package/dist/runner/codex/app-server/runner.js +57 -4
  78. package/dist/runner/codex/app-server/translator.d.ts +2 -2
  79. package/dist/runner/codex/app-server/translator.js +5 -5
  80. package/dist/runner/common/acp/acp-approval.d.ts +2 -2
  81. package/dist/runner/common/acp/acp-approval.js +3 -3
  82. package/dist/runner/common/acp/base-acp-runner.js +1 -1
  83. package/dist/runner/common/acp/base-translator.d.ts +3 -3
  84. package/dist/runner/common/acp/base-translator.js +4 -4
  85. package/dist/runner/common/acp/protocol-types.js +1 -1
  86. package/dist/runner/common/connection-based-runner.d.ts +1 -1
  87. package/dist/runner/common/connection-based-runner.js +2 -2
  88. package/dist/runner/common/jsonl-stream.d.ts +2 -2
  89. package/dist/runner/common/jsonl-stream.js +12 -12
  90. package/dist/runner/common/jsonrpc/client.d.ts +1 -1
  91. package/dist/runner/common/jsonrpc/client.js +1 -1
  92. package/dist/runner/common/jsonrpc/connection-manager.d.ts +1 -1
  93. package/dist/runner/common/jsonrpc/connection-manager.js +1 -1
  94. package/dist/runner/common/jsonrpc/transport.d.ts +1 -1
  95. package/dist/runner/common/jsonrpc/transport.js +2 -2
  96. package/dist/runner/common/spawning-runner.d.ts +21 -8
  97. package/dist/runner/common/spawning-runner.js +41 -15
  98. package/dist/runner/dsh/runner.js +2 -2
  99. package/dist/runner/kimi/acp/runner.d.ts +3 -3
  100. package/dist/runner/kimi/acp/runner.js +9 -9
  101. package/dist/runner/kimi/acp/translator.d.ts +2 -2
  102. package/dist/runner/kimi/acp/translator.js +4 -4
  103. package/dist/runner/opencode/acp/runner.d.ts +2 -2
  104. package/dist/runner/opencode/acp/runner.js +3 -3
  105. package/dist/runner/opencode/acp/translator.js +1 -1
  106. package/dist/runner/pi/rpc/runner.js +2 -2
  107. package/dist/runner/pi/rpc/translator.d.ts +1 -1
  108. package/dist/runner/pi/rpc/translator.js +4 -4
  109. package/dist/runner/types.d.ts +11 -2
  110. package/dist/runner/types.js +12 -1
  111. package/dist/session/claude/session-index.d.ts +12 -0
  112. package/dist/session/claude/session-index.js +20 -5
  113. package/dist/session/claude/sessions.js +10 -10
  114. package/dist/session/codex/rollout-reader.d.ts +4 -4
  115. package/dist/session/codex/rollout-reader.js +12 -12
  116. package/dist/session/common/two-pass.js +2 -2
  117. package/dist/session/common/usage-accumulator.d.ts +2 -2
  118. package/dist/session/common/usage-accumulator.js +2 -2
  119. package/dist/session/dsh/sessions.js +2 -2
  120. package/dist/session/kimi/sessions.d.ts +2 -2
  121. package/dist/session/kimi/sessions.js +11 -11
  122. package/dist/session/opencode/sessions.d.ts +3 -3
  123. package/dist/session/opencode/sessions.js +12 -10
  124. package/dist/session/pi/sessions.js +13 -12
  125. package/dist/session/session-store.d.ts +1 -1
  126. package/dist/session/session-store.js +1 -1
  127. package/package.json +1 -1
@@ -6,7 +6,7 @@ import { scanJsonlOnce, tailOffsetAfter, scanTailEvents } from '../common/two-pa
6
6
  import { extractContentBlocks } from '../common/content-blocks.js';
7
7
  import { UsageAccumulator, contextWindowOccupancy, cumulativeUsageFields, } from '../common/usage-accumulator.js';
8
8
  import { isStale } from '../common/constants.js';
9
- import { encodeProjectDirName } from '../../platform/path.js';
9
+ import { encodeProjectDirName, samePath } from '../../platform/path.js';
10
10
  import { paginate } from '../common/pagination.js';
11
11
  import { sortByRecencyDesc } from '../common/recency.js';
12
12
  import { TtlCache } from '../../common/ttl-cache.js';
@@ -26,7 +26,7 @@ function projectDirForCwd(cwd, sessionsDir) {
26
26
  return path.join(sessionsDir, encoded);
27
27
  }
28
28
  /**
29
- * P1-19: TTL cache for pi directory scans (mirror codex getSessionIndex's
29
+ * TTL cache for pi directory scans (mirror codex getSessionIndex's
30
30
  * 5s TTL). Repeated /resume pages re-scan the whole sessions dir per call.
31
31
  */
32
32
  const piListCache = new TtlCache(5_000, 32);
@@ -71,7 +71,7 @@ function compressSkillInjection(text) {
71
71
  }
72
72
  /** Get a one-line summary from a pi session JSONL (first user message text).
73
73
  *
74
- * P2-3 optimization: previously used `readJsonlLines` (full-file slurp)
74
+ * optimization: previously used `readJsonlLines` (full-file slurp)
75
75
  * just to get the first user message. Now uses `findJsonlLine` which
76
76
  * stops reading as soon as the predicate matches — typically only the
77
77
  * first few lines of the file, saving ~99% I/O on large sessions.
@@ -136,14 +136,14 @@ function findSessionFile(sessionId, cwd, sessionsDir) {
136
136
  return null;
137
137
  }
138
138
  /**
139
- * P2-6 + P2-5 first-pass scan: stream the file once via `scanJsonlLines`
139
+ * first-pass scan: stream the file once via `scanJsonlLines`
140
140
  * (no `string[]` materialized), parse each line exactly once, and collect
141
141
  * all metadata needed by readSessionContent (usage, tailOffset, displayTitle).
142
142
  * Does NOT retain parsed objects — the events tail is re-parsed separately
143
143
  * by `extractPiEventsFromTail` so memory for both raw line strings and
144
144
  * parsed objects is O(tail), not O(whole file).
145
145
  *
146
- * Mirrors claude's scalarScan (P2-2 + P2-5). Preserves the skill-signature
146
+ * Mirrors claude's scalarScan. Preserves the skill-signature
147
147
  * compression (`<skill>…</skill>` → `skill:x`) for displayTitle and the
148
148
  * "last turn" semantics for usage tokens.
149
149
  */
@@ -198,7 +198,7 @@ function piScalarScan(filePath) {
198
198
  * Build the AgentSessionUsage from an accumulator, preserving pi's
199
199
  * "last turn" semantics: inputTokens/outputTokens use the LAST turn's
200
200
  * values, contextLength = last turn's context-window occupancy
201
- * (input + cacheRead + cacheCreation, excludes output — review P2-8 unified
201
+ * (input + cacheRead + cacheCreation, excludes output —unified
202
202
  * contract across all five readers), cumulative = session-wide sum.
203
203
  * Returns undefined when no usage data was observed.
204
204
  */
@@ -221,10 +221,10 @@ function buildPiUsage(acc) {
221
221
  };
222
222
  }
223
223
  /**
224
- * P2-6 + P2-5 second-pass tail mapper: expand one parsed tail line into
224
+ * second-pass tail mapper: expand one parsed tail line into
225
225
  * content-block events. Re-parses only tail lines (scanTailEvents does the
226
226
  * offset re-read + line filtering), so both raw line-string memory and
227
- * parsed-object memory are O(tail), not O(whole file) — P2-6 + P2-5.
227
+ * parsed-object memory are O(tail), not O(whole file) —.
228
228
  * `maxEvents` capping is applied by scanTailEvents.
229
229
  */
230
230
  function mapPiTailLine(rawObj) {
@@ -285,12 +285,13 @@ export class PiSessionReader {
285
285
  if (!filePath) {
286
286
  return { events: [] };
287
287
  }
288
- // Verify cwd matches
288
+ // Verify cwd matches(PathKit.samePath:win32/darwin 大小写与分隔符不敏感,
289
+ // JSONL 里的 cwd 形态由写方决定,与请求 cwd 不保证逐字符一致)
289
290
  const fileCwd = readCwdFromPiJsonl(filePath);
290
- if (fileCwd && fileCwd !== cwd) {
291
+ if (fileCwd && !samePath(fileCwd, cwd)) {
291
292
  return { events: [] };
292
293
  }
293
- // P2-5 + P2-6: Two-pass scan (see `scanJsonlOnce` / `scanTailEvents` in
294
+ // Two-pass scan (see `scanJsonlOnce` / `scanTailEvents` in
294
295
  // session/common/two-pass.ts): pass 1 streams the file once collecting
295
296
  // scalars (usage, tailOffset, displayTitle) with O(1) parsed-object
296
297
  // retention; pass 2 re-reads ONLY the tail and re-parses it for events,
@@ -338,7 +339,7 @@ export class PiSessionReader {
338
339
  try {
339
340
  const st = fs.statSync(full);
340
341
  const fileCwd = readCwdFromPiJsonl(full);
341
- if (fileCwd && fileCwd !== cwd)
342
+ if (fileCwd && !samePath(fileCwd, cwd))
342
343
  continue;
343
344
  // Extract sessionId (UUID) from filename: <timestamp>_<uuid>.jsonl
344
345
  // The timestamp and uuid are separated by '_', and neither contains '_'
@@ -23,7 +23,7 @@ interface SessionEntry {
23
23
  * - Atomic write (temp + rename) to avoid truncated files on crash
24
24
  * - Corrupt files are treated as empty (with a warning)
25
25
  *
26
- * P3.3: sessions is Map<AgentKind, sessionId> (one session per agent), allowing
26
+ * 3: sessions is Map<AgentKind, sessionId> (one session per agent), allowing
27
27
  * each agent to maintain its own session context when switching between agents.
28
28
  */
29
29
  export declare class SessionStore {
@@ -13,7 +13,7 @@ import { atomicWriteJson } from '../persistence/atomic-write.js';
13
13
  * - Atomic write (temp + rename) to avoid truncated files on crash
14
14
  * - Corrupt files are treated as empty (with a warning)
15
15
  *
16
- * P3.3: sessions is Map<AgentKind, sessionId> (one session per agent), allowing
16
+ * 3: sessions is Map<AgentKind, sessionId> (one session per agent), allowing
17
17
  * each agent to maintain its own session context when switching between agents.
18
18
  */
19
19
  export class SessionStore {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-remote",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
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",