@rynx-ai/daemon 0.1.11-beta.2 → 0.1.11-beta.21

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 (88) hide show
  1. package/bundled-plugins/plugins/lark/.rynx-plugin/plugin.json +0 -12
  2. package/bundled-plugins/plugins/lark/dist/cli-mirror/mirror-index.js +3 -1
  3. package/bundled-plugins/plugins/lark/dist/host-adapters.d.ts +3 -3
  4. package/bundled-plugins/plugins/lark/dist/host-adapters.js +20 -18
  5. package/bundled-plugins/plugins/lark/dist/lark.js +18 -12
  6. package/bundled-plugins/plugins/lark/dist/runtime.js +6046 -6022
  7. package/bundled-plugins/plugins/lark/dist/settings.js +6006 -5988
  8. package/bundled-plugins/plugins/lark/package.json +1 -1
  9. package/bundled-plugins/plugins/lark/ui/assets/index-CGUVAMsv.css +1 -0
  10. package/bundled-plugins/plugins/lark/ui/index.html +2 -2
  11. package/dist/agent-file.js +0 -1
  12. package/dist/browser-artifact-management.d.ts +4 -1
  13. package/dist/browser-artifact-management.js +22 -11
  14. package/dist/browser-artifacts.d.ts +1 -0
  15. package/dist/browser-artifacts.js +1 -0
  16. package/dist/chrome-for-testing-runtime.d.ts +27 -0
  17. package/dist/chrome-for-testing-runtime.js +194 -0
  18. package/dist/chrome-for-testing-store.d.ts +2 -0
  19. package/dist/chrome-for-testing-store.js +37 -6
  20. package/dist/control-deps.d.ts +6 -2
  21. package/dist/control-deps.js +87 -4
  22. package/dist/control-link-store.js +4 -3
  23. package/dist/daemon-owner.js +4 -7
  24. package/dist/daemon-server.d.ts +4 -1
  25. package/dist/daemon-server.js +158 -45
  26. package/dist/db.d.ts +2 -2
  27. package/dist/db.js +55 -20
  28. package/dist/entry-path.d.ts +3 -0
  29. package/dist/entry-path.js +12 -0
  30. package/dist/index-daemon.js +3 -87
  31. package/dist/lifecycle.d.ts +13 -0
  32. package/dist/lifecycle.js +19 -0
  33. package/dist/maintenance-lease.d.ts +39 -0
  34. package/dist/maintenance-lease.js +250 -0
  35. package/dist/migrations/cleanup-legacy-sessions.js +4 -3
  36. package/dist/plugin-cli.d.ts +10 -0
  37. package/dist/plugin-cli.js +19 -2
  38. package/dist/plugin-host-rpc.d.ts +35 -6
  39. package/dist/plugin-host-rpc.js +222 -59
  40. package/dist/plugin-installer.js +62 -2
  41. package/dist/plugin-management-service.js +0 -2
  42. package/dist/plugin-marketplace.js +2 -1
  43. package/dist/plugin-store.js +2 -4
  44. package/dist/plugin-supervisor.d.ts +5 -0
  45. package/dist/plugin-supervisor.js +218 -33
  46. package/dist/pm2.d.ts +11 -2
  47. package/dist/pm2.js +116 -19
  48. package/dist/process.d.ts +12 -0
  49. package/dist/process.js +91 -0
  50. package/dist/remote-runtime-access-store.d.ts +2 -2
  51. package/dist/remote-runtime-access-store.js +6 -9
  52. package/dist/remote-runtime-target-store.d.ts +2 -2
  53. package/dist/remote-runtime-target-store.js +6 -6
  54. package/dist/session-emulator-binding-store.js +4 -6
  55. package/dist/session-fork-store.js +24 -8
  56. package/dist/session-launch-operations.d.ts +10 -1
  57. package/dist/session-launch-operations.js +21 -11
  58. package/dist/session-log-store.js +2 -1
  59. package/dist/session-meta-store.d.ts +5 -0
  60. package/dist/session-meta-store.js +25 -2
  61. package/dist/session-portal-grant-store.d.ts +29 -0
  62. package/dist/session-portal-grant-store.js +85 -0
  63. package/dist/session-resource-store.js +3 -2
  64. package/dist/setup-service.d.ts +21 -0
  65. package/dist/setup-service.js +39 -0
  66. package/dist/skills-catalog.d.ts +11 -2
  67. package/dist/skills-catalog.js +307 -10
  68. package/dist/sqlite.d.ts +22 -0
  69. package/dist/sqlite.js +57 -0
  70. package/dist/system-dependencies.d.ts +22 -0
  71. package/dist/system-dependencies.js +79 -0
  72. package/package.json +37 -21
  73. package/bundled-plugins/plugins/lark/ui/assets/index-B2dhMlMU.css +0 -1
  74. package/dist/browser-cli-args.d.ts +0 -20
  75. package/dist/browser-cli-args.js +0 -100
  76. package/dist/cli.d.ts +0 -2
  77. package/dist/cli.js +0 -550
  78. package/dist/control-client.d.ts +0 -122
  79. package/dist/control-client.js +0 -855
  80. package/dist/control-endpoint.d.ts +0 -14
  81. package/dist/control-endpoint.js +0 -124
  82. package/dist/desktop-browser-host-client.d.ts +0 -35
  83. package/dist/desktop-browser-host-client.js +0 -415
  84. package/dist/setup.d.ts +0 -20
  85. package/dist/setup.js +0 -386
  86. package/dist/update.d.ts +0 -25
  87. package/dist/update.js +0 -133
  88. /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: session.execution.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 capability-checked
17
- * Host RPC. The plugin never receives the daemon's runtime, abort controller,
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 capability-checked
10
- * Host RPC. The plugin never receives the daemon's runtime, abort controller,
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.call("session.interrupt", { runId }).catch(() => undefined);
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.call("session.run", {
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,7 @@ export class HostConversationRuntime {
109
111
  const unsteer = input.steer?.subscribe((text) => {
110
112
  if (!runId || terminal)
111
113
  return;
112
- void this.host.call("session.steer", { runId, text }).catch(() => undefined);
114
+ void this.host.sessions.steer({ runId, text }).catch(() => undefined);
113
115
  });
114
116
  input.signal?.addEventListener("abort", interrupt, { once: true });
115
117
  const generator = (async function* () {
@@ -141,16 +143,16 @@ export class HostAgentCapabilities {
141
143
  this.host = host;
142
144
  }
143
145
  listModels(runtime) {
144
- return this.host.call("session.models", runtime ? { runtime } : {});
146
+ return this.host.sessions.listModels(runtime ? { runtime } : undefined);
145
147
  }
146
148
  getGoal(sessionId) {
147
- return this.host.call("session.goal.get", { sessionId });
149
+ return this.host.sessions.goals.get({ sessionId });
148
150
  }
149
151
  setGoal(sessionId, objective) {
150
- return this.host.call("session.goal.set", { sessionId, objective });
152
+ return this.host.sessions.goals.set({ sessionId, objective });
151
153
  }
152
154
  clearGoal(sessionId) {
153
- return this.host.call("session.goal.clear", { sessionId });
155
+ return this.host.sessions.goals.clear({ sessionId });
154
156
  }
155
157
  }
156
158
  /** Narrow agent catalog + first-turn execution resolver backed by Host RPC. */
@@ -160,13 +162,13 @@ export class HostAgentCatalog {
160
162
  this.host = host;
161
163
  }
162
164
  list() {
163
- return this.host.call("agent.catalog.list", {});
165
+ return this.host.agents.list();
164
166
  }
165
167
  get(id) {
166
- return this.host.call("agent.catalog.get", { id });
168
+ return this.host.agents.get({ id });
167
169
  }
168
170
  resolveExecution(input) {
169
- return this.host.call("agent.execution.resolve", input);
171
+ return this.host.agents.resolveExecution(input);
170
172
  }
171
173
  }
172
174
  /** Daemon-owned session allocator. operationId must identify one allocation attempt durably. */
@@ -179,7 +181,7 @@ export class HostSessionProvisioner {
179
181
  this.instanceId = instanceId;
180
182
  }
181
183
  async provision(operationId, session = {}) {
182
- const result = await this.host.call("session.ensure", {
184
+ const result = await this.host.sessions.ensure({
183
185
  scopeId: this.instanceId,
184
186
  operationId,
185
187
  session,
@@ -188,7 +190,7 @@ export class HostSessionProvisioner {
188
190
  throw new Error("host did not return a provisioned session id");
189
191
  this.resolvedExecutions.set(result.sessionId, {
190
192
  runtime: result.execution.provider,
191
- model: result.execution.model,
193
+ ...(result.execution.model ? { model: result.execution.model } : {}),
192
194
  ...(result.execution.reasoningEffort
193
195
  ? { reasoningEffort: result.execution.reasoningEffort }
194
196
  : {}),
@@ -203,10 +205,10 @@ export class HostSessionProvisioner {
203
205
  }
204
206
  async existingExecution(sessionId) {
205
207
  try {
206
- const session = await this.host.call("session.meta.get", { sessionId });
208
+ const session = await this.host.sessions.get({ sessionId });
207
209
  return {
208
210
  runtime: session.execution.provider,
209
- model: session.execution.model,
211
+ ...(session.execution.model ? { model: session.execution.model } : {}),
210
212
  ...(session.execution.reasoningEffort
211
213
  ? { reasoningEffort: session.execution.reasoningEffort }
212
214
  : {}),
@@ -225,7 +227,7 @@ export class HostSessionProvisioner {
225
227
  return stableOperationId("fork", this.instanceId, fromSessionId, newSessionKey);
226
228
  }
227
229
  async fork(operationId, sourceSessionId, title) {
228
- const result = await this.host.call("session.fork", {
230
+ const result = await this.host.sessions.fork({
229
231
  sourceSessionId,
230
232
  operationId,
231
233
  ...(title ? { title } : {}),
@@ -235,7 +237,7 @@ export class HostSessionProvisioner {
235
237
  return result.sessionId;
236
238
  }
237
239
  async setTitle(sessionId, title) {
238
- await this.host.call("session.meta.setTitle", { sessionId, title });
240
+ await this.host.sessions.setTitle({ sessionId, title });
239
241
  }
240
242
  }
241
243
  /**
@@ -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
- // Execution is immutable once a Session is created. Any Provider, model, or
1312
- // reasoning-effort change therefore starts a fresh Session snapshot.
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: `处理失败:${errorMessage}`,
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 ? "" : `处理失败:${errorMessage}`,
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: `处理失败:${errorMessage}`,
1791
+ text: buildRunFailureReply(error),
1786
1792
  provider: settings.provider,
1787
1793
  };
1788
1794
  }