lark-remote 0.5.6 → 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.
- package/CHANGELOG.md +46 -6
- package/README.en.md +2 -2
- package/README.md +2 -2
- package/dist/bridge/index.d.ts +63 -1
- package/dist/bridge/index.js +147 -14
- package/dist/bridge/queue-manager.js +41 -58
- package/dist/card/approval-render.js +2 -1
- package/dist/card/bash-card-session.d.ts +0 -1
- package/dist/card/bash-card-session.js +0 -8
- package/dist/card/bash-renderer.js +2 -1
- package/dist/card/card-budget.d.ts +37 -0
- package/dist/card/card-budget.js +143 -24
- package/dist/card/card-session.d.ts +3 -13
- package/dist/card/card-session.js +4 -18
- package/dist/card/card-shared.d.ts +11 -0
- package/dist/card/card-shared.js +19 -13
- package/dist/card/run-card-session.d.ts +0 -1
- package/dist/card/run-card-session.js +0 -6
- package/dist/card/run-renderer.d.ts +18 -0
- package/dist/card/run-renderer.js +330 -62
- package/dist/card/run-state.d.ts +26 -0
- package/dist/card/run-state.js +45 -0
- package/dist/card/text-truncate.d.ts +3 -5
- package/dist/card/text-truncate.js +3 -5
- package/dist/card/time.d.ts +14 -0
- package/dist/card/time.js +30 -0
- package/dist/card/tool-render.d.ts +15 -2
- package/dist/card/tool-render.js +42 -82
- package/dist/common/text-width.d.ts +24 -0
- package/dist/common/text-width.js +93 -0
- package/dist/common/tool-summary.d.ts +19 -0
- package/dist/common/tool-summary.js +171 -0
- package/dist/common/turn-failure.d.ts +13 -0
- package/dist/common/turn-failure.js +18 -0
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/index.js +66 -13
- package/dist/order/index.d.ts +2 -0
- package/dist/order/index.js +2 -0
- package/dist/platform/command.js +1 -1
- package/dist/platform/shell.d.ts +2 -2
- package/dist/platform/spawn.d.ts +1 -1
- package/dist/platform/spawn.js +2 -2
- package/dist/platform/types.d.ts +1 -1
- package/dist/router/card-helpers.d.ts +18 -16
- package/dist/router/card-helpers.js +88 -46
- package/dist/router/config/codex.js +2 -3
- package/dist/router/config/common/model-patch.d.ts +8 -0
- package/dist/router/config/common/model-patch.js +13 -0
- package/dist/router/config/common/render.js +30 -77
- package/dist/router/config/dsh.js +2 -1
- package/dist/router/config/kimi.js +3 -3
- package/dist/router/index.d.ts +9 -11
- package/dist/router/index.js +165 -356
- package/dist/router/order-exec-dispatch.js +2 -1
- package/dist/runner/claude/session.d.ts +1 -1
- package/dist/runner/claude/session.js +3 -3
- package/dist/runner/common/defaults.d.ts +2 -0
- package/dist/runner/common/defaults.js +3 -0
- 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 +3 -3
- package/dist/runner/common/spawning-runner.d.ts +1 -1
- package/dist/runner/common/spawning-runner.js +2 -2
- package/dist/runner/dsh/auth.js +2 -1
- package/dist/runner/dsh/client.d.ts +100 -3
- package/dist/runner/dsh/client.js +290 -6
- package/dist/runner/dsh/exit-cancel.d.ts +32 -0
- package/dist/runner/dsh/exit-cancel.js +72 -0
- package/dist/runner/dsh/inflight.d.ts +62 -0
- package/dist/runner/dsh/inflight.js +140 -0
- package/dist/runner/dsh/runner.d.ts +90 -4
- package/dist/runner/dsh/runner.js +436 -18
- package/dist/runner/dsh/translator.d.ts +1 -1
- package/dist/runner/dsh/translator.js +103 -1
- package/dist/runner/dsh/types.d.ts +60 -0
- package/dist/runner/types.d.ts +95 -2
- package/dist/runner/types.js +9 -0
- package/dist/session/claude/session-index.d.ts +0 -4
- package/dist/session/claude/session-index.js +0 -8
- package/dist/session/claude/sessions.js +2 -2
- package/dist/session/dsh/sessions.js +157 -17
- package/dist/update/install.js +1 -1
- 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
|
-
|
|
33
|
-
|
|
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:
|
|
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: '
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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: '
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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 =
|
|
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
|
-
|
|
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 =
|
|
87
|
+
newEffort = pickMiddleValue(FALLBACK_EFFORTS);
|
|
88
88
|
return { key: 'agents.kimi.thinkingEffort', value: newEffort };
|
|
89
89
|
}
|
|
90
90
|
}
|
package/dist/router/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface CardActionPayload {
|
|
|
33
33
|
path?: string;
|
|
34
34
|
name?: string;
|
|
35
35
|
runId?: string;
|
|
36
|
+
/** 终态卡「停止」的目标后台任务 id(DSH job/list 的 jobId)。 */
|
|
37
|
+
jobId?: string;
|
|
36
38
|
sessionId?: string;
|
|
37
39
|
/** 目标工作目录(queue.* 卡片动作定位队列;stop 等卡片回传执行目录)。 */
|
|
38
40
|
cwd?: string;
|
|
@@ -352,6 +354,13 @@ export declare class CommandRouter {
|
|
|
352
354
|
* Handle stop card action: interrupt current run.
|
|
353
355
|
*/
|
|
354
356
|
private handleCardStop;
|
|
357
|
+
/**
|
|
358
|
+
* Handle a terminal card's 「停止」 on one background job.
|
|
359
|
+
*
|
|
360
|
+
* 任务跨 run 生命周期,所以卡片按钮是唯一入口;失败必须给出可读原因
|
|
361
|
+
* (任务已自行结束、服务重启后快照被回收),不能点了没反应。
|
|
362
|
+
*/
|
|
363
|
+
private handleJobKill;
|
|
355
364
|
/**
|
|
356
365
|
* Resolve an order's text at the enqueue boundary so order.exec can enter
|
|
357
366
|
* the serial queue as an equivalent user message (Plan A) — the same path a
|
|
@@ -632,17 +641,6 @@ export declare class CommandRouter {
|
|
|
632
641
|
* 不敏感。省略/空 = 无筛选。
|
|
633
642
|
*/
|
|
634
643
|
cmdWs(args: string[], ctx: CommandContext, offset?: number, q?: string): CommandResult;
|
|
635
|
-
/**
|
|
636
|
-
* degraded card when a session's export is non-empty but unparseable
|
|
637
|
-
* (truncated by opencode's pipe cap on huge sessions, or otherwise corrupt).
|
|
638
|
-
* The session exists, so reuse listSessions metadata (title) instead of the
|
|
639
|
-
* misleading "未找到". Reuses the same card-builder helpers (markdownDiv) as
|
|
640
|
-
* the normal resume card; enforceCardBudget still applies at send time.
|
|
641
|
-
*/
|
|
642
|
-
/**
|
|
643
|
-
* /resume 核心实现(public:handleResumePage / handle / resume.use 共用,
|
|
644
|
-
* 也是测试的直接 seam,避免测试用 @ts-expect-error 摸私有方法)。
|
|
645
|
-
*/
|
|
646
644
|
/**
|
|
647
645
|
* DSH /resume preset 一致性校验:返回 mismatch 详情,或 undefined(一致/不可判定)。
|
|
648
646
|
*
|