lark-remote 0.5.7 → 0.5.8

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 (47) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/bridge/index.d.ts +15 -0
  3. package/dist/bridge/index.js +61 -0
  4. package/dist/bridge/queue-manager.js +41 -58
  5. package/dist/card/approval-render.js +2 -1
  6. package/dist/card/bash-card-session.d.ts +0 -1
  7. package/dist/card/bash-card-session.js +0 -8
  8. package/dist/card/bash-renderer.js +2 -1
  9. package/dist/card/card-budget.js +15 -19
  10. package/dist/card/card-session.d.ts +3 -13
  11. package/dist/card/card-session.js +4 -18
  12. package/dist/card/card-shared.d.ts +11 -0
  13. package/dist/card/card-shared.js +19 -13
  14. package/dist/card/run-card-session.d.ts +0 -1
  15. package/dist/card/run-card-session.js +0 -6
  16. package/dist/card/run-renderer.d.ts +3 -9
  17. package/dist/card/run-renderer.js +99 -27
  18. package/dist/card/text-truncate.d.ts +3 -5
  19. package/dist/card/text-truncate.js +3 -5
  20. package/dist/card/tool-render.js +7 -21
  21. package/dist/common/tool-summary.d.ts +8 -0
  22. package/dist/common/tool-summary.js +38 -20
  23. package/dist/common/turn-failure.d.ts +13 -0
  24. package/dist/common/turn-failure.js +18 -0
  25. package/dist/index.js +5 -7
  26. package/dist/order/index.d.ts +2 -0
  27. package/dist/order/index.js +2 -0
  28. package/dist/router/card-helpers.js +23 -42
  29. package/dist/router/config/codex.js +2 -3
  30. package/dist/router/config/common/model-patch.d.ts +8 -0
  31. package/dist/router/config/common/model-patch.js +13 -0
  32. package/dist/router/config/common/render.js +30 -77
  33. package/dist/router/config/dsh.js +2 -1
  34. package/dist/router/config/kimi.js +3 -3
  35. package/dist/router/index.d.ts +0 -11
  36. package/dist/router/index.js +108 -349
  37. package/dist/router/order-exec-dispatch.js +2 -1
  38. package/dist/runner/common/defaults.d.ts +2 -0
  39. package/dist/runner/common/defaults.js +3 -0
  40. package/dist/runner/common/jsonrpc/connection-manager.js +1 -1
  41. package/dist/runner/dsh/client.js +1 -2
  42. package/dist/runner/types.d.ts +19 -0
  43. package/dist/runner/types.js +9 -0
  44. package/dist/session/claude/session-index.d.ts +0 -4
  45. package/dist/session/claude/session-index.js +0 -8
  46. package/dist/session/dsh/sessions.js +57 -2
  47. package/package.json +1 -1
@@ -5,6 +5,7 @@
5
5
  * Used by all agent config builders and the shared tabs (idle, logging).
6
6
  */
7
7
  import { getConfigValue } from '../../../config/index.js';
8
+ import { cardButton } from '../../../card/card-shared.js';
8
9
  /** Build CardKit 2.0 elements for a list of config fields. */
9
10
  function buildFieldElements(fields, displayConfig) {
10
11
  const elements = [];
@@ -29,8 +30,8 @@ function buildFieldElements(fields, displayConfig) {
29
30
  }
30
31
  return elements;
31
32
  }
32
- function buildBooleanElement(field, isOn) {
33
- const displayVal = isOn ? '✅ 已开启' : '⚪ 已关闭';
33
+ /** 配置项统一行:左 label(2 份宽)+ 右控件(3 份宽)。 */
34
+ function fieldRow(label, control) {
34
35
  return {
35
36
  tag: 'column_set',
36
37
  flex_mode: 'none',
@@ -40,25 +41,24 @@ function buildBooleanElement(field, isOn) {
40
41
  width: 'weighted',
41
42
  weight: 2,
42
43
  vertical_align: 'center',
43
- elements: [{ tag: 'div', text: { tag: 'lark_md', content: field.label } }],
44
+ elements: [{ tag: 'div', text: { tag: 'lark_md', content: label } }],
44
45
  },
45
46
  {
46
47
  tag: 'column',
47
48
  width: 'weighted',
48
49
  weight: 3,
49
50
  vertical_align: 'center',
50
- elements: [
51
- {
52
- tag: 'button',
53
- text: { tag: 'plain_text', content: displayVal },
54
- type: isOn ? 'primary' : 'default',
55
- behaviors: [{ type: 'callback', value: { cmd: 'config.toggle', key: field.key } }],
56
- },
57
- ],
51
+ elements: [control],
58
52
  },
59
53
  ],
60
54
  };
61
55
  }
56
+ function buildBooleanElement(field, isOn) {
57
+ const displayVal = isOn ? '✅ 已开启' : '⚪ 已关闭';
58
+ return fieldRow(field.label, cardButton(displayVal, { cmd: 'config.toggle', key: field.key }, {
59
+ type: isOn ? 'primary' : 'default',
60
+ }));
61
+ }
62
62
  function buildSelectElement(field, currentValue) {
63
63
  // 优先使用 field.currentValue(卡片显示用覆盖值),否则使用 config 中的值
64
64
  const selectedValue = field.currentValue != null
@@ -66,38 +66,17 @@ function buildSelectElement(field, currentValue) {
66
66
  : currentValue == null
67
67
  ? undefined
68
68
  : String(currentValue);
69
- return {
70
- tag: 'column_set',
71
- flex_mode: 'none',
72
- columns: [
73
- {
74
- tag: 'column',
75
- width: 'weighted',
76
- weight: 2,
77
- vertical_align: 'center',
78
- elements: [{ tag: 'div', text: { tag: 'lark_md', content: field.label } }],
79
- },
80
- {
81
- tag: 'column',
82
- width: 'weighted',
83
- weight: 3,
84
- vertical_align: 'center',
85
- elements: [
86
- {
87
- tag: 'select_static',
88
- placeholder: { tag: 'plain_text', content: '请选择' },
89
- options: field.options.map((opt) => {
90
- const text = typeof opt === 'string' ? opt : opt.text;
91
- const value = typeof opt === 'string' ? opt : opt.value;
92
- return { text: { tag: 'plain_text', content: text }, value };
93
- }),
94
- initial_option: selectedValue,
95
- behaviors: [{ type: 'callback', value: { cmd: 'config.set', key: field.key } }],
96
- },
97
- ],
98
- },
99
- ],
100
- };
69
+ return fieldRow(field.label, {
70
+ tag: 'select_static',
71
+ placeholder: { tag: 'plain_text', content: '请选择' },
72
+ options: field.options.map((opt) => {
73
+ const text = typeof opt === 'string' ? opt : opt.text;
74
+ const value = typeof opt === 'string' ? opt : opt.value;
75
+ return { text: { tag: 'plain_text', content: text }, value };
76
+ }),
77
+ initial_option: selectedValue,
78
+ behaviors: [{ type: 'callback', value: { cmd: 'config.set', key: field.key } }],
79
+ });
101
80
  }
102
81
  function buildInputElement(field, currentValue) {
103
82
  // 优先使用 field.currentValue(允许覆盖 displayConfig 中的值)
@@ -106,34 +85,13 @@ function buildInputElement(field, currentValue) {
106
85
  : currentValue == null
107
86
  ? ''
108
87
  : String(currentValue);
109
- return {
110
- tag: 'column_set',
111
- flex_mode: 'none',
112
- columns: [
113
- {
114
- tag: 'column',
115
- width: 'weighted',
116
- weight: 2,
117
- vertical_align: 'center',
118
- elements: [{ tag: 'div', text: { tag: 'lark_md', content: field.label } }],
119
- },
120
- {
121
- tag: 'column',
122
- width: 'weighted',
123
- weight: 3,
124
- vertical_align: 'center',
125
- elements: [
126
- {
127
- tag: 'input',
128
- name: field.key,
129
- placeholder: { tag: 'plain_text', content: '请输入值' },
130
- default_value: currentStr,
131
- behaviors: [{ type: 'callback', value: { cmd: 'config.input', key: field.key } }],
132
- },
133
- ],
134
- },
135
- ],
136
- };
88
+ return fieldRow(field.label, {
89
+ tag: 'input',
90
+ name: field.key,
91
+ placeholder: { tag: 'plain_text', content: '请输入值' },
92
+ default_value: currentStr,
93
+ behaviors: [{ type: 'callback', value: { cmd: 'config.input', key: field.key } }],
94
+ });
137
95
  }
138
96
  /** Build the full CardKit 2.0 card from tabs. */
139
97
  export function buildConfigCardFromTabs(tabs, displayConfig) {
@@ -147,12 +105,7 @@ export function buildConfigCardFromTabs(tabs, displayConfig) {
147
105
  elements.push({ tag: 'hr' });
148
106
  }
149
107
  // 底部保存按钮
150
- elements.push({
151
- tag: 'button',
152
- text: { tag: 'plain_text', content: '💾 保存所有修改' },
153
- type: 'primary',
154
- behaviors: [{ type: 'callback', value: { cmd: 'config.save' } }],
155
- });
108
+ elements.push(cardButton('💾 保存所有修改', { cmd: 'config.save' }, { type: 'primary' }));
156
109
  return {
157
110
  schema: '2.0',
158
111
  config: { wide_screen_mode: true, update_multi: true },
@@ -16,6 +16,7 @@
16
16
  * 与 runner 的兼容规则一致。provider 清单不硬编码,来自服务端目录。
17
17
  */
18
18
  import { DEFAULT_DSH_HOST } from '../../config/index.js';
19
+ import { pickMiddleValue } from './common/model-patch.js';
19
20
  import { DshClient } from '../../runner/dsh/client.js';
20
21
  import { getLogger } from '../../logger/index.js';
21
22
  /** 旧配置没有 provider 时的生效值(与 DshRunner 的兼容规则一致)。 */
@@ -361,7 +362,7 @@ export class DshConfigBuilder {
361
362
  if (currentEffort && supported.includes(currentEffort))
362
363
  return null;
363
364
  // 新模型目录中位档位;偶数长度取偏高位(off/low → low,符合 DSH 默认 high 语义)
364
- const middle = supported[Math.floor(supported.length / 2)];
365
+ const middle = pickMiddleValue(supported, 'upper');
365
366
  return { key: 'agents.dsh.reasoningEffort', value: middle };
366
367
  }
367
368
  }
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { loadKimiConfig, KIMI_THINKING_EFFORTS, FALLBACK_EFFORTS, } from '../../config/kimi-config.js';
8
8
  import { DEFAULT_TURN_IDLE_TIMEOUT_MINUTES } from '../../config/index.js';
9
+ import { pickMiddleValue } from './common/model-patch.js';
9
10
  const PERMISSION_MODE_OPTIONS = [
10
11
  // kimi 0.40.0(2026-09-02)起官方语义:manual=始终询问 / yolo=必要时询问 / auto=完全自动
11
12
  { text: 'manual(始终询问)', value: 'manual' },
@@ -79,12 +80,11 @@ export class KimiConfigBuilder {
79
80
  const supported = kimiCfg.modelEfforts[newModel] ?? [...FALLBACK_EFFORTS];
80
81
  if (currentEffort && supported.includes(currentEffort))
81
82
  return null;
82
- const middle = supported[Math.floor((supported.length - 1) / 2)];
83
- let newEffort = middle;
83
+ let newEffort = pickMiddleValue(supported);
84
84
  if (!newEffort)
85
85
  newEffort = kimiCfg.modelDefaultEfforts?.[newModel];
86
86
  if (!newEffort)
87
- newEffort = FALLBACK_EFFORTS[Math.floor((FALLBACK_EFFORTS.length - 1) / 2)];
87
+ newEffort = pickMiddleValue(FALLBACK_EFFORTS);
88
88
  return { key: 'agents.kimi.thinkingEffort', value: newEffort };
89
89
  }
90
90
  }
@@ -641,17 +641,6 @@ export declare class CommandRouter {
641
641
  * 不敏感。省略/空 = 无筛选。
642
642
  */
643
643
  cmdWs(args: string[], ctx: CommandContext, offset?: number, q?: string): CommandResult;
644
- /**
645
- * degraded card when a session's export is non-empty but unparseable
646
- * (truncated by opencode's pipe cap on huge sessions, or otherwise corrupt).
647
- * The session exists, so reuse listSessions metadata (title) instead of the
648
- * misleading "未找到". Reuses the same card-builder helpers (markdownDiv) as
649
- * the normal resume card; enforceCardBudget still applies at send time.
650
- */
651
- /**
652
- * /resume 核心实现(public:handleResumePage / handle / resume.use 共用,
653
- * 也是测试的直接 seam,避免测试用 @ts-expect-error 摸私有方法)。
654
- */
655
644
  /**
656
645
  * DSH /resume preset 一致性校验:返回 mismatch 详情,或 undefined(一致/不可判定)。
657
646
  *