lark-remote 0.4.0 → 0.4.2

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 (41) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.en.md +2 -2
  3. package/README.md +2 -2
  4. package/dist/bridge/inbound-media.d.ts +13 -20
  5. package/dist/bridge/inbound-media.js +107 -93
  6. package/dist/bridge/index.d.ts +6 -6
  7. package/dist/bridge/index.js +6 -12
  8. package/dist/card/approval-render.js +9 -8
  9. package/dist/cli.js +5 -1
  10. package/dist/config/dir.d.ts +9 -0
  11. package/dist/config/dir.js +69 -0
  12. package/dist/config/index.d.ts +22 -3
  13. package/dist/config/index.js +25 -3
  14. package/dist/connector/index.d.ts +22 -1
  15. package/dist/connector/index.js +79 -14
  16. package/dist/inbound/event.d.ts +41 -0
  17. package/dist/inbound/event.js +11 -0
  18. package/dist/inbound/placeholder.d.ts +26 -0
  19. package/dist/inbound/placeholder.js +149 -0
  20. package/dist/inbound/prompt.d.ts +20 -0
  21. package/dist/inbound/prompt.js +47 -0
  22. package/dist/inbound/receipt.d.ts +28 -0
  23. package/dist/inbound/receipt.js +62 -0
  24. package/dist/inbound/turn-assembler.d.ts +63 -0
  25. package/dist/inbound/turn-assembler.js +233 -0
  26. package/dist/inbound/turn.d.ts +48 -0
  27. package/dist/inbound/turn.js +10 -0
  28. package/dist/index.js +96 -71
  29. package/dist/router/card-helpers.d.ts +38 -2
  30. package/dist/router/card-helpers.js +79 -2
  31. package/dist/router/config/opencode.d.ts +1 -1
  32. package/dist/router/config/opencode.js +11 -0
  33. package/dist/router/index.d.ts +56 -6
  34. package/dist/router/index.js +256 -78
  35. package/dist/runner/common/connection-based-runner.js +6 -2
  36. package/dist/runner/dsh/fake-dsh-server.d.ts +6 -0
  37. package/dist/runner/dsh/fake-dsh-server.js +6 -0
  38. package/dist/runner/kimi/acp/runner.d.ts +1 -1
  39. package/dist/runner/kimi/acp/runner.js +1 -1
  40. package/dist/runner/opencode/acp/runner.d.ts +1 -1
  41. package/package.json +1 -1
@@ -1,8 +1,12 @@
1
1
  import { ConnectionLostError } from './jsonrpc/client.js';
2
2
  import { getLogger } from '../../logger/index.js';
3
3
  import { syntheticInitEvent } from './runner-utils.js';
4
- /** How long to wait for turn output notifications before failing. */
5
- const TURN_IDLE_TIMEOUT_MS = 10 * 60 * 1000;
4
+ import { DEFAULT_TURN_IDLE_TIMEOUT_MINUTES } from '../../config/index.js';
5
+ /** How long to wait for turn output notifications before failing.
6
+ * 30 分钟(单源于 config 的 DEFAULT_TURN_IDLE_TIMEOUT_MINUTES):ACP/app-server
7
+ * 类 agent 常因长工具调用(pip/npm install 等)或等待 SubAgent 长时间静默,
8
+ * 10 分钟会误杀正常进行中的 run。未接配置的 runner(如 opencode)直接吃此默认。 */
9
+ const TURN_IDLE_TIMEOUT_MS = DEFAULT_TURN_IDLE_TIMEOUT_MINUTES * 60 * 1000;
6
10
  export class ConnectionBasedRunner {
7
11
  kind;
8
12
  sessionReader;
@@ -48,6 +48,12 @@ export declare class FakeDshServer {
48
48
  setMuxFrames(frames: Array<object | {
49
49
  close: true;
50
50
  }>): void;
51
+ /** Append a single frame at response time (real DSH only produces a turn's
52
+ * events after accepting its prompt) — avoids pre-queued frames racing a
53
+ * previous run's still-closing mux subscription. */
54
+ pushMuxFrame(frame: object | {
55
+ close: true;
56
+ }): void;
51
57
  setHistoryValue(value: unknown): void;
52
58
  /** Synchronous unary dispatch (no HTTP) — used by tests that inject the
53
59
  * reader's sync transport to avoid the spawnSync-in-process deadlock. */
@@ -95,6 +95,12 @@ export class FakeDshServer {
95
95
  setMuxFrames(frames) {
96
96
  this.muxFrames = frames;
97
97
  }
98
+ /** Append a single frame at response time (real DSH only produces a turn's
99
+ * events after accepting its prompt) — avoids pre-queued frames racing a
100
+ * previous run's still-closing mux subscription. */
101
+ pushMuxFrame(frame) {
102
+ this.muxFrames.push(frame);
103
+ }
98
104
  setHistoryValue(value) {
99
105
  this.historyValue = value;
100
106
  }
@@ -36,7 +36,7 @@ export interface KimiAcpRunnerOptions {
36
36
  requestTimeoutMs?: number;
37
37
  /** Idle TTL for connection manager. */
38
38
  idleTtlMs?: number;
39
- /** How long to wait for turn output before failing. Defaults to 10 min. */
39
+ /** How long to wait for turn output before failing. Defaults to 30 min. */
40
40
  turnIdleTimeoutMs?: number;
41
41
  /** §5.2: compaction 等待的沉默超时——距上次观察到任何新 compaction 记录
42
42
  * (begin/terminal)超过该时长仍未终态才放弃(outcome unknown,卡片 error,
@@ -27,7 +27,7 @@ import { mapAnswersByIndex } from '../../question-common.js';
27
27
  import { getLogger } from '../../../logger/index.js';
28
28
  import { BaseAcpRunner } from '../../common/acp/base-acp-runner.js';
29
29
  import { ProcessStopper } from '../../common/process-stopper.js';
30
- /** §5.2: compaction 等待的默认沉默超时(对齐 turnIdleTimeoutMs 默认值)。 */
30
+ /** §5.2: compaction 等待的默认沉默超时(10 分钟,独立于 turn idle 默认 30 分钟)。 */
31
31
  const COMPACT_IDLE_TIMEOUT_MS = 10 * 60_000;
32
32
  /** Poll interval for the wire.jsonl compaction record. */
33
33
  const COMPACT_POLL_INTERVAL_MS = 1_000;
@@ -40,7 +40,7 @@ export interface OpencodeAcpRunnerOptions {
40
40
  requestTimeoutMs?: number;
41
41
  /** Idle TTL for connection manager. */
42
42
  idleTtlMs?: number;
43
- /** How long to wait for turn output before failing. Defaults to 10 min. */
43
+ /** How long to wait for turn output before failing. Defaults to 30 min. */
44
44
  turnIdleTimeoutMs?: number;
45
45
  model?: string;
46
46
  /** Configured session mode: 'build' (default) or 'plan' (opencode agent names). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lark-remote",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
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",