@rynx-ai/daemon 0.1.11-beta.4 → 0.1.11-beta.41
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/bundled-plugins/plugins/lark/.rynx-plugin/plugin.json +0 -12
- package/bundled-plugins/plugins/lark/dist/cli-mirror/mirror-index.js +3 -1
- package/bundled-plugins/plugins/lark/dist/host-adapters.d.ts +3 -3
- package/bundled-plugins/plugins/lark/dist/host-adapters.js +24 -18
- package/bundled-plugins/plugins/lark/dist/lark.js +18 -12
- package/bundled-plugins/plugins/lark/dist/runtime.js +6043 -6016
- package/bundled-plugins/plugins/lark/dist/settings.js +6003 -5985
- package/bundled-plugins/plugins/lark/package.json +1 -1
- package/bundled-plugins/plugins/lark/ui/assets/index-CGUVAMsv.css +1 -0
- package/bundled-plugins/plugins/lark/ui/index.html +2 -2
- package/dist/agent-file.js +0 -1
- package/dist/browser-artifact-management.js +4 -1
- package/dist/chrome-for-testing-http.d.ts +9 -0
- package/dist/chrome-for-testing-http.js +58 -0
- package/dist/chrome-for-testing-release-resolver.js +13 -6
- package/dist/chrome-for-testing-runtime.js +4 -3
- package/dist/chrome-for-testing-store.d.ts +2 -0
- package/dist/chrome-for-testing-store.js +99 -17
- package/dist/control-deps.d.ts +6 -2
- package/dist/control-deps.js +87 -4
- package/dist/control-link-store.js +4 -3
- package/dist/daemon-owner.js +4 -7
- package/dist/daemon-server.js +42 -17
- package/dist/db.d.ts +2 -2
- package/dist/db.js +157 -21
- package/dist/headless-browser-host.js +397 -41
- package/dist/lifecycle.d.ts +2 -1
- package/dist/lifecycle.js +4 -1
- package/dist/migrations/cleanup-legacy-sessions.js +4 -3
- package/dist/plugin-cli.d.ts +10 -0
- package/dist/plugin-cli.js +19 -2
- package/dist/plugin-host-rpc.d.ts +48 -9
- package/dist/plugin-host-rpc.js +593 -81
- package/dist/plugin-installer.js +3 -2
- package/dist/plugin-management-service.js +0 -2
- package/dist/plugin-marketplace.js +2 -1
- package/dist/plugin-store.js +2 -4
- package/dist/plugin-supervisor.js +0 -4
- package/dist/pm2.d.ts +2 -0
- package/dist/pm2.js +6 -0
- package/dist/remote-runtime-access-store.d.ts +2 -2
- package/dist/remote-runtime-access-store.js +6 -9
- package/dist/remote-runtime-connection-manager.js +25 -42
- package/dist/remote-runtime-target-store.d.ts +2 -2
- package/dist/remote-runtime-target-store.js +6 -6
- package/dist/session-emulator-binding-store.js +4 -6
- package/dist/session-fork-store.d.ts +1 -0
- package/dist/session-fork-store.js +85 -30
- package/dist/session-launch-operations.js +6 -5
- package/dist/session-log-store.d.ts +1 -0
- package/dist/session-log-store.js +46 -22
- package/dist/session-meta-store.d.ts +5 -0
- package/dist/session-meta-store.js +25 -2
- package/dist/session-portal-grant-store.d.ts +55 -0
- package/dist/session-portal-grant-store.js +160 -0
- package/dist/session-resource-store.d.ts +24 -6
- package/dist/session-resource-store.js +387 -69
- package/dist/session-timeline-projection-store.d.ts +24 -0
- package/dist/session-timeline-projection-store.js +53 -0
- package/dist/setup-service.d.ts +1 -0
- package/dist/setup-service.js +1 -0
- package/dist/skills-catalog.d.ts +11 -2
- package/dist/skills-catalog.js +317 -10
- package/dist/sqlite.d.ts +22 -0
- package/dist/sqlite.js +57 -0
- package/dist/stdio-epipe-guard.d.ts +1 -1
- package/dist/stdio-epipe-guard.js +1 -1
- package/dist/system-dependencies.d.ts +22 -0
- package/dist/system-dependencies.js +79 -0
- package/package.json +17 -12
- package/bundled-plugins/plugins/lark/ui/assets/index-B2dhMlMU.css +0 -1
- /package/bundled-plugins/plugins/lark/ui/assets/{index-D9N-AkLX.js → index-D8Amoe6a.js} +0 -0
|
@@ -5,18 +5,6 @@
|
|
|
5
5
|
"displayName": "Lark",
|
|
6
6
|
"description": "Lark and Feishu channel integration managed by the plugin.",
|
|
7
7
|
"apiRange": "^1.0.0",
|
|
8
|
-
"capabilities": [
|
|
9
|
-
"conversation.run",
|
|
10
|
-
"agent.catalog.read",
|
|
11
|
-
"runtime.catalog.read",
|
|
12
|
-
"session.cancel",
|
|
13
|
-
"session.fork",
|
|
14
|
-
"session.goal.read",
|
|
15
|
-
"session.goal.write",
|
|
16
|
-
"session.meta.read",
|
|
17
|
-
"session.meta.title.write",
|
|
18
|
-
"session.provision"
|
|
19
|
-
],
|
|
20
8
|
"runtime": {
|
|
21
9
|
"entry": "./dist/runtime.js"
|
|
22
10
|
},
|
|
@@ -35,7 +35,9 @@ export class CodexMirrorIndex {
|
|
|
35
35
|
chatId: directory.chatId,
|
|
36
36
|
threadId: directory.threadId,
|
|
37
37
|
participants: directory.participants ?? [],
|
|
38
|
-
model
|
|
38
|
+
// A null model means the provider CLI owns model selection. The mirror
|
|
39
|
+
// still needs a stable string label for transcript normalization.
|
|
40
|
+
model: session.execution.model ?? session.execution.provider,
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
/** All Codex threads currently bound to a Feishu conversation (those whose
|
|
@@ -13,8 +13,8 @@ interface HostSessionLaunchMeta {
|
|
|
13
13
|
export declare const LARK_RUN_EVENT_QUEUE_MAX_ITEMS = 256;
|
|
14
14
|
export declare const LARK_RUN_EVENT_QUEUE_MAX_BYTES: number;
|
|
15
15
|
/**
|
|
16
|
-
* ConversationRuntime-shaped adapter backed exclusively by
|
|
17
|
-
*
|
|
16
|
+
* ConversationRuntime-shaped adapter backed exclusively by the typed Host API.
|
|
17
|
+
* The plugin never receives the daemon's runtime, abort controller,
|
|
18
18
|
* steer controller, or session bus.
|
|
19
19
|
*/
|
|
20
20
|
export declare class HostConversationRuntime implements LarkConversationRuntime {
|
|
@@ -23,7 +23,7 @@ export declare class HostConversationRuntime implements LarkConversationRuntime
|
|
|
23
23
|
runLive(input: ConversationStreamRequest): Promise<{
|
|
24
24
|
provider: "codex" | "traex" | "claude";
|
|
25
25
|
threadId: string;
|
|
26
|
-
model: string;
|
|
26
|
+
model: string | null;
|
|
27
27
|
authSource: "codex_cli" | "traex_cli" | "claude_cli";
|
|
28
28
|
generator: AsyncGenerator<SessionEvent, any, any>;
|
|
29
29
|
}>;
|
|
@@ -6,8 +6,8 @@ import { FileLarkActiveSessionStore, } from "./lark-session-store.js";
|
|
|
6
6
|
export const LARK_RUN_EVENT_QUEUE_MAX_ITEMS = 256;
|
|
7
7
|
export const LARK_RUN_EVENT_QUEUE_MAX_BYTES = 8 * 1024 * 1024;
|
|
8
8
|
/**
|
|
9
|
-
* ConversationRuntime-shaped adapter backed exclusively by
|
|
10
|
-
*
|
|
9
|
+
* ConversationRuntime-shaped adapter backed exclusively by the typed Host API.
|
|
10
|
+
* The plugin never receives the daemon's runtime, abort controller,
|
|
11
11
|
* steer controller, or session bus.
|
|
12
12
|
*/
|
|
13
13
|
export class HostConversationRuntime {
|
|
@@ -37,7 +37,7 @@ export class HostConversationRuntime {
|
|
|
37
37
|
const interrupt = () => {
|
|
38
38
|
if (!runId || terminal)
|
|
39
39
|
return;
|
|
40
|
-
void this.host.
|
|
40
|
+
void this.host.sessions.interrupt({ runId }).catch(() => undefined);
|
|
41
41
|
};
|
|
42
42
|
const accept = (event, payload) => {
|
|
43
43
|
if (!runId) {
|
|
@@ -86,8 +86,10 @@ export class HostConversationRuntime {
|
|
|
86
86
|
unsubscribeEvents();
|
|
87
87
|
let started;
|
|
88
88
|
try {
|
|
89
|
-
started = await this.host.
|
|
89
|
+
started = await this.host.sessions.run({
|
|
90
90
|
sessionId: input.threadId,
|
|
91
|
+
model: input.model?.trim() || null,
|
|
92
|
+
reasoningEffort: input.reasoningEffort?.trim() || null,
|
|
91
93
|
message: input.message,
|
|
92
94
|
});
|
|
93
95
|
runId = started.runId;
|
|
@@ -109,7 +111,11 @@ export class HostConversationRuntime {
|
|
|
109
111
|
const unsteer = input.steer?.subscribe((text) => {
|
|
110
112
|
if (!runId || terminal)
|
|
111
113
|
return;
|
|
112
|
-
|
|
114
|
+
// `session.run` is the only message-input operation. The Host reuses
|
|
115
|
+
// `runId` while this Turn is active and lets the native runtime choose
|
|
116
|
+
// turn/steer; callers do not select a separate steering RPC.
|
|
117
|
+
void this.host.sessions.run({ sessionId: input.threadId, message: text })
|
|
118
|
+
.catch(() => undefined);
|
|
113
119
|
});
|
|
114
120
|
input.signal?.addEventListener("abort", interrupt, { once: true });
|
|
115
121
|
const generator = (async function* () {
|
|
@@ -141,16 +147,16 @@ export class HostAgentCapabilities {
|
|
|
141
147
|
this.host = host;
|
|
142
148
|
}
|
|
143
149
|
listModels(runtime) {
|
|
144
|
-
return this.host.
|
|
150
|
+
return this.host.sessions.listModels(runtime ? { runtime } : undefined);
|
|
145
151
|
}
|
|
146
152
|
getGoal(sessionId) {
|
|
147
|
-
return this.host.
|
|
153
|
+
return this.host.sessions.goals.get({ sessionId });
|
|
148
154
|
}
|
|
149
155
|
setGoal(sessionId, objective) {
|
|
150
|
-
return this.host.
|
|
156
|
+
return this.host.sessions.goals.set({ sessionId, objective });
|
|
151
157
|
}
|
|
152
158
|
clearGoal(sessionId) {
|
|
153
|
-
return this.host.
|
|
159
|
+
return this.host.sessions.goals.clear({ sessionId });
|
|
154
160
|
}
|
|
155
161
|
}
|
|
156
162
|
/** Narrow agent catalog + first-turn execution resolver backed by Host RPC. */
|
|
@@ -160,13 +166,13 @@ export class HostAgentCatalog {
|
|
|
160
166
|
this.host = host;
|
|
161
167
|
}
|
|
162
168
|
list() {
|
|
163
|
-
return this.host.
|
|
169
|
+
return this.host.agents.list();
|
|
164
170
|
}
|
|
165
171
|
get(id) {
|
|
166
|
-
return this.host.
|
|
172
|
+
return this.host.agents.get({ id });
|
|
167
173
|
}
|
|
168
174
|
resolveExecution(input) {
|
|
169
|
-
return this.host.
|
|
175
|
+
return this.host.agents.resolveExecution(input);
|
|
170
176
|
}
|
|
171
177
|
}
|
|
172
178
|
/** Daemon-owned session allocator. operationId must identify one allocation attempt durably. */
|
|
@@ -179,7 +185,7 @@ export class HostSessionProvisioner {
|
|
|
179
185
|
this.instanceId = instanceId;
|
|
180
186
|
}
|
|
181
187
|
async provision(operationId, session = {}) {
|
|
182
|
-
const result = await this.host.
|
|
188
|
+
const result = await this.host.sessions.ensure({
|
|
183
189
|
scopeId: this.instanceId,
|
|
184
190
|
operationId,
|
|
185
191
|
session,
|
|
@@ -188,7 +194,7 @@ export class HostSessionProvisioner {
|
|
|
188
194
|
throw new Error("host did not return a provisioned session id");
|
|
189
195
|
this.resolvedExecutions.set(result.sessionId, {
|
|
190
196
|
runtime: result.execution.provider,
|
|
191
|
-
model: result.execution.model,
|
|
197
|
+
...(result.execution.model ? { model: result.execution.model } : {}),
|
|
192
198
|
...(result.execution.reasoningEffort
|
|
193
199
|
? { reasoningEffort: result.execution.reasoningEffort }
|
|
194
200
|
: {}),
|
|
@@ -203,10 +209,10 @@ export class HostSessionProvisioner {
|
|
|
203
209
|
}
|
|
204
210
|
async existingExecution(sessionId) {
|
|
205
211
|
try {
|
|
206
|
-
const session = await this.host.
|
|
212
|
+
const session = await this.host.sessions.get({ sessionId });
|
|
207
213
|
return {
|
|
208
214
|
runtime: session.execution.provider,
|
|
209
|
-
model: session.execution.model,
|
|
215
|
+
...(session.execution.model ? { model: session.execution.model } : {}),
|
|
210
216
|
...(session.execution.reasoningEffort
|
|
211
217
|
? { reasoningEffort: session.execution.reasoningEffort }
|
|
212
218
|
: {}),
|
|
@@ -225,7 +231,7 @@ export class HostSessionProvisioner {
|
|
|
225
231
|
return stableOperationId("fork", this.instanceId, fromSessionId, newSessionKey);
|
|
226
232
|
}
|
|
227
233
|
async fork(operationId, sourceSessionId, title) {
|
|
228
|
-
const result = await this.host.
|
|
234
|
+
const result = await this.host.sessions.fork({
|
|
229
235
|
sourceSessionId,
|
|
230
236
|
operationId,
|
|
231
237
|
...(title ? { title } : {}),
|
|
@@ -235,7 +241,7 @@ export class HostSessionProvisioner {
|
|
|
235
241
|
return result.sessionId;
|
|
236
242
|
}
|
|
237
243
|
async setTitle(sessionId, title) {
|
|
238
|
-
await this.host.
|
|
244
|
+
await this.host.sessions.setTitle({ sessionId, title });
|
|
239
245
|
}
|
|
240
246
|
}
|
|
241
247
|
/**
|
|
@@ -2,7 +2,7 @@ import { execFile } from "node:child_process";
|
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
|
-
import { CodexRuntimeError, collectLiveRun, } from "@rynx-ai/core";
|
|
5
|
+
import { AgentRuntimeError, CodexRuntimeError, collectLiveRun, } from "@rynx-ai/core";
|
|
6
6
|
const execFileAsync = promisify(execFile);
|
|
7
7
|
import { LarkSessionCardController, } from "./lark-card-stream.js";
|
|
8
8
|
import { buildLarkCardReplyPrompt, chunkLarkReplyText, extractLarkTextPrompt, isLarkNewSessionCommand, isLarkStopCommand, parseLarkCommand, } from "./lark-content.js";
|
|
@@ -23,10 +23,18 @@ const DEFAULT_EMPTY_RESPONSE = "抱歉,我暂时没有生成回复。";
|
|
|
23
23
|
const DEFAULT_NEW_SESSION_RESPONSE = "已开启新会话。";
|
|
24
24
|
const DEFAULT_STOP_NO_INFLIGHT_RESPONSE = "当前没有正在进行的任务。";
|
|
25
25
|
const DEFAULT_STOP_ACK_RESPONSE = "已停止当前任务。";
|
|
26
|
+
const LIVE_SESSION_UNAVAILABLE_RESPONSE = "当前设备的 Session 运行环境不可用,可能是内置 tmux 缺失或损坏。请执行 `rynx doctor` 查看状态。";
|
|
26
27
|
const LARK_WORK_STARTED_REACTION = "Get";
|
|
27
28
|
const LARK_WORK_COMPLETED_REACTION = "DONE";
|
|
28
29
|
/** Reaction added to a message whose text was steered into the running turn. */
|
|
29
30
|
const LARK_STEER_ACK_REACTION = "Get";
|
|
31
|
+
function buildRunFailureReply(error) {
|
|
32
|
+
if (error instanceof AgentRuntimeError &&
|
|
33
|
+
(error.code === "LIVE_SESSION_UNAVAILABLE" || error.code === "live_unavailable")) {
|
|
34
|
+
return LIVE_SESSION_UNAVAILABLE_RESPONSE;
|
|
35
|
+
}
|
|
36
|
+
return `处理失败:${toErrorMessage(error)}`;
|
|
37
|
+
}
|
|
30
38
|
const LARK_COMMANDS = [
|
|
31
39
|
{ name: "new", help: "/new — 开启新会话", category: "takeover" },
|
|
32
40
|
{ name: "stop", help: "/stop 或 /cancel — 停止当前正在进行的任务", category: "other" },
|
|
@@ -1308,11 +1316,9 @@ export class LarkMessageIngestor {
|
|
|
1308
1316
|
const effort = pending.effort !== SETTINGS_DEFAULT_VALUE && allowedEfforts.includes(pending.effort)
|
|
1309
1317
|
? pending.effort
|
|
1310
1318
|
: undefined;
|
|
1311
|
-
//
|
|
1312
|
-
// reasoning
|
|
1313
|
-
const rotate = runtime !== pending.currentRuntime
|
|
1314
|
-
model !== pending.currentModel ||
|
|
1315
|
-
effort !== pending.currentEffort;
|
|
1319
|
+
// Provider selects the immutable runtime implementation. Model and
|
|
1320
|
+
// reasoning effort are Turn settings and update the same idle Session.
|
|
1321
|
+
const rotate = runtime !== pending.currentRuntime;
|
|
1316
1322
|
await this.activeSessionStore.applySettings(sessionKey, {
|
|
1317
1323
|
runtime,
|
|
1318
1324
|
model,
|
|
@@ -1657,7 +1663,7 @@ export class LarkMessageIngestor {
|
|
|
1657
1663
|
error: errorMessage,
|
|
1658
1664
|
});
|
|
1659
1665
|
return {
|
|
1660
|
-
text:
|
|
1666
|
+
text: buildRunFailureReply(error),
|
|
1661
1667
|
provider: settings.provider,
|
|
1662
1668
|
};
|
|
1663
1669
|
}
|
|
@@ -1713,9 +1719,9 @@ export class LarkMessageIngestor {
|
|
|
1713
1719
|
await orchestrator.finalizeAll(cancelled ? "cancelled" : "failed");
|
|
1714
1720
|
return {
|
|
1715
1721
|
// A user-triggered cancel needs no redundant chat reply (the card carries it).
|
|
1716
|
-
text: cancelled ? "" :
|
|
1722
|
+
text: cancelled ? "" : buildRunFailureReply(error),
|
|
1717
1723
|
provider: started.provider,
|
|
1718
|
-
model: started.model,
|
|
1724
|
+
...(started.model ? { model: started.model } : {}),
|
|
1719
1725
|
};
|
|
1720
1726
|
}
|
|
1721
1727
|
// The card carries the answer; only emit a plain-text reply when no card
|
|
@@ -1723,7 +1729,7 @@ export class LarkMessageIngestor {
|
|
|
1723
1729
|
return {
|
|
1724
1730
|
text: orchestrator.cardStarted ? "" : orchestrator.fallbackText.trim() || DEFAULT_EMPTY_RESPONSE,
|
|
1725
1731
|
provider: started.provider,
|
|
1726
|
-
model: started.model,
|
|
1732
|
+
...(started.model ? { model: started.model } : {}),
|
|
1727
1733
|
};
|
|
1728
1734
|
}
|
|
1729
1735
|
/**
|
|
@@ -1765,7 +1771,7 @@ export class LarkMessageIngestor {
|
|
|
1765
1771
|
return {
|
|
1766
1772
|
text: answer.trim() || DEFAULT_EMPTY_RESPONSE,
|
|
1767
1773
|
provider: started.provider,
|
|
1768
|
-
model: started.model,
|
|
1774
|
+
...(started.model ? { model: started.model } : {}),
|
|
1769
1775
|
};
|
|
1770
1776
|
}
|
|
1771
1777
|
catch (error) {
|
|
@@ -1782,7 +1788,7 @@ export class LarkMessageIngestor {
|
|
|
1782
1788
|
error: errorMessage,
|
|
1783
1789
|
});
|
|
1784
1790
|
return {
|
|
1785
|
-
text:
|
|
1791
|
+
text: buildRunFailureReply(error),
|
|
1786
1792
|
provider: settings.provider,
|
|
1787
1793
|
};
|
|
1788
1794
|
}
|