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.
- package/CHANGELOG.md +34 -0
- package/dist/bridge/approval-coordinator.d.ts +1 -1
- package/dist/bridge/approval-coordinator.js +3 -3
- package/dist/bridge/inbound-media.js +10 -7
- package/dist/bridge/index.d.ts +55 -17
- package/dist/bridge/index.js +145 -74
- package/dist/bridge/queue-manager.d.ts +71 -20
- package/dist/bridge/queue-manager.js +139 -57
- package/dist/card/approval-render.d.ts +1 -1
- package/dist/card/approval-render.js +6 -6
- package/dist/card/bash-card-session.d.ts +3 -3
- package/dist/card/bash-card-session.js +3 -3
- package/dist/card/bash-renderer.js +1 -1
- package/dist/card/card-session.d.ts +4 -4
- package/dist/card/card-session.js +6 -6
- package/dist/card/run-card-session.js +2 -2
- package/dist/card/run-renderer.d.ts +1 -1
- package/dist/card/run-renderer.js +14 -14
- package/dist/card/run-state.d.ts +2 -2
- package/dist/card/run-state.js +3 -3
- package/dist/card/tool-render.d.ts +1 -1
- package/dist/card/tool-render.js +6 -6
- package/dist/cli.js +2 -1
- package/dist/clone.d.ts +5 -3
- package/dist/clone.js +8 -4
- package/dist/common/truncate.d.ts +1 -1
- package/dist/common/truncate.js +2 -2
- package/dist/common/ttl-cache.d.ts +2 -2
- package/dist/common/ttl-cache.js +2 -2
- package/dist/config/codex-config.d.ts +9 -9
- package/dist/config/codex-config.js +18 -18
- package/dist/config/dir.js +5 -2
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +6 -6
- package/dist/config/opencode-config.js +3 -3
- package/dist/connector/index.d.ts +5 -5
- package/dist/connector/index.js +24 -11
- package/dist/inbound/event.d.ts +1 -1
- package/dist/inbound/event.js +1 -1
- package/dist/inbound/placeholder.d.ts +2 -2
- package/dist/inbound/placeholder.js +2 -2
- package/dist/index.js +23 -12
- package/dist/instance-lock.js +4 -3
- package/dist/logger/index.d.ts +1 -1
- package/dist/logger/index.js +4 -4
- package/dist/persistence/atomic-write.d.ts +1 -1
- package/dist/persistence/atomic-write.js +6 -2
- package/dist/platform/agent-stopper.d.ts +1 -1
- package/dist/platform/identity.d.ts +7 -1
- package/dist/platform/identity.js +2 -2
- package/dist/platform/path.d.ts +6 -0
- package/dist/platform/path.js +14 -8
- package/dist/platform/select.d.ts +1 -1
- package/dist/platform/select.js +1 -1
- package/dist/platform/shell.d.ts +2 -3
- package/dist/platform/spawn.d.ts +2 -2
- package/dist/platform/spawn.js +2 -2
- package/dist/platform/terminator-posix.js +1 -1
- package/dist/platform/terminator-win32.js +2 -2
- package/dist/platform/terminator.d.ts +3 -3
- package/dist/platform/terminator.js +2 -2
- package/dist/platform/types.d.ts +1 -1
- package/dist/restart.d.ts +1 -1
- package/dist/restart.js +5 -3
- package/dist/router/config/codex.d.ts +1 -1
- package/dist/router/config/codex.js +2 -2
- package/dist/router/config/opencode.js +1 -1
- package/dist/router/index.d.ts +65 -16
- package/dist/router/index.js +141 -47
- package/dist/router/order-exec-dispatch.js +2 -2
- package/dist/runner/bash/runner.d.ts +2 -2
- package/dist/runner/bash/runner.js +6 -6
- package/dist/runner/claude/runner.js +1 -1
- package/dist/runner/claude/session.d.ts +2 -2
- package/dist/runner/claude/session.js +14 -14
- package/dist/runner/codex/app-server/runner.d.ts +28 -0
- package/dist/runner/codex/app-server/runner.js +57 -4
- package/dist/runner/codex/app-server/translator.d.ts +2 -2
- package/dist/runner/codex/app-server/translator.js +5 -5
- package/dist/runner/common/acp/acp-approval.d.ts +2 -2
- package/dist/runner/common/acp/acp-approval.js +3 -3
- package/dist/runner/common/acp/base-acp-runner.js +1 -1
- package/dist/runner/common/acp/base-translator.d.ts +3 -3
- package/dist/runner/common/acp/base-translator.js +4 -4
- package/dist/runner/common/acp/protocol-types.js +1 -1
- package/dist/runner/common/connection-based-runner.d.ts +1 -1
- package/dist/runner/common/connection-based-runner.js +2 -2
- package/dist/runner/common/jsonl-stream.d.ts +2 -2
- package/dist/runner/common/jsonl-stream.js +12 -12
- package/dist/runner/common/jsonrpc/client.d.ts +1 -1
- package/dist/runner/common/jsonrpc/client.js +1 -1
- package/dist/runner/common/jsonrpc/connection-manager.d.ts +1 -1
- package/dist/runner/common/jsonrpc/connection-manager.js +1 -1
- package/dist/runner/common/jsonrpc/transport.d.ts +1 -1
- package/dist/runner/common/jsonrpc/transport.js +2 -2
- package/dist/runner/common/spawning-runner.d.ts +21 -8
- package/dist/runner/common/spawning-runner.js +41 -15
- package/dist/runner/dsh/runner.js +2 -2
- package/dist/runner/kimi/acp/runner.d.ts +3 -3
- package/dist/runner/kimi/acp/runner.js +9 -9
- package/dist/runner/kimi/acp/translator.d.ts +2 -2
- package/dist/runner/kimi/acp/translator.js +4 -4
- package/dist/runner/opencode/acp/runner.d.ts +2 -2
- package/dist/runner/opencode/acp/runner.js +3 -3
- package/dist/runner/opencode/acp/translator.js +1 -1
- package/dist/runner/pi/rpc/runner.js +2 -2
- package/dist/runner/pi/rpc/translator.d.ts +1 -1
- package/dist/runner/pi/rpc/translator.js +4 -4
- package/dist/runner/types.d.ts +11 -2
- package/dist/runner/types.js +12 -1
- package/dist/session/claude/session-index.d.ts +12 -0
- package/dist/session/claude/session-index.js +20 -5
- package/dist/session/claude/sessions.js +10 -10
- package/dist/session/codex/rollout-reader.d.ts +4 -4
- package/dist/session/codex/rollout-reader.js +12 -12
- package/dist/session/common/two-pass.js +2 -2
- package/dist/session/common/usage-accumulator.d.ts +2 -2
- package/dist/session/common/usage-accumulator.js +2 -2
- package/dist/session/dsh/sessions.js +2 -2
- package/dist/session/kimi/sessions.d.ts +2 -2
- package/dist/session/kimi/sessions.js +11 -11
- package/dist/session/opencode/sessions.d.ts +3 -3
- package/dist/session/opencode/sessions.js +12 -10
- package/dist/session/pi/sessions.js +13 -12
- package/dist/session/session-store.d.ts +1 -1
- package/dist/session/session-store.js +1 -1
- 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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
|
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 —
|
|
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
|
-
*
|
|
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)
|
|
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
|
|
291
|
+
if (fileCwd && !samePath(fileCwd, cwd)) {
|
|
291
292
|
return { events: [] };
|
|
292
293
|
}
|
|
293
|
-
//
|
|
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
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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.
|
|
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",
|