@rynx-ai/daemon 0.1.11-beta.32 → 0.1.11-beta.34

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/plugin-channel-lark",
3
- "version": "0.1.11-beta.32",
3
+ "version": "0.1.11-beta.34",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -294,7 +294,7 @@ export async function startRynxDaemonServer({ config, warn = defaultWarn, onShut
294
294
  "semantic.session.list.v1",
295
295
  "semantic.session.snapshot.v1",
296
296
  "semantic.session.events.v1",
297
- "semantic.session.terminal.v1",
297
+ "semantic.session.terminal.v2",
298
298
  "semantic.session.terminal-start.v1",
299
299
  "semantic.session.interrupt.v1",
300
300
  "semantic.session.agent-options.v1",
@@ -1,4 +1,4 @@
1
- export { formatControlUrl, isPm2DaemonOnline, statusDaemon, stopDaemon, streamLogs, } from "./pm2.js";
1
+ export { formatControlUrl, isDaemonStartRequired, isPm2DaemonOnline, statusDaemon, stopDaemon, streamLogs, } from "./pm2.js";
2
2
  export { resolveDaemonEntry } from "./entry-path.js";
3
3
  export interface StandaloneDaemonLaunchContext {
4
4
  builtinSkillsDir: string;
package/dist/lifecycle.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { startDaemon as startPm2Daemon, } from "./pm2.js";
2
- export { formatControlUrl, isPm2DaemonOnline, statusDaemon, stopDaemon, streamLogs, } from "./pm2.js";
2
+ export { formatControlUrl, isDaemonStartRequired, isPm2DaemonOnline, statusDaemon, stopDaemon, streamLogs, } from "./pm2.js";
3
3
  export { resolveDaemonEntry } from "./entry-path.js";
4
4
  export function startDaemon(options) {
5
5
  return startPm2Daemon({
@@ -544,7 +544,7 @@ export class PluginHostRpc {
544
544
  run.responseId = started.responseId;
545
545
  const result = {
546
546
  runId,
547
- responseId: started.responseId,
547
+ ...(started.responseId ? { responseId: started.responseId } : {}),
548
548
  sessionId,
549
549
  provider: started.provider,
550
550
  model: started.model,
@@ -567,6 +567,7 @@ export class PluginHostRpc {
567
567
  return;
568
568
  if (this.disposed || this.activeRuns.get(run.runId) !== run)
569
569
  return;
570
+ run.responseId ??= sessionEventResponseId(event);
570
571
  const finalResponse = topLevelAssistantResponse(event);
571
572
  if (finalResponse !== undefined) {
572
573
  run.finalAssistantResponse = truncateUtf8(finalResponse, MAX_PLUGIN_RUN_FINAL_RESPONSE_BYTES);
@@ -657,6 +658,11 @@ export class PluginHostRpc {
657
658
  const image = jsonRecord(data?.generatedImage);
658
659
  if (!image || typeof image.mediaType !== "string")
659
660
  return undefined;
661
+ const responseId = typeof item.responseId === "string"
662
+ ? item.responseId
663
+ : run.responseId;
664
+ if (!responseId)
665
+ return undefined;
660
666
  let filePath;
661
667
  if (typeof image.path === "string" && path.isAbsolute(image.path)) {
662
668
  filePath = image.path;
@@ -671,9 +677,7 @@ export class PluginHostRpc {
671
677
  event: "session.run.file",
672
678
  payload: {
673
679
  runId: run.runId,
674
- responseId: typeof item.responseId === "string"
675
- ? item.responseId
676
- : run.responseId,
680
+ responseId,
677
681
  sessionId: run.sessionId,
678
682
  itemId: typeof item.id === "string" ? item.id : "unknown",
679
683
  filename: typeof image.filename === "string" && image.filename
@@ -1496,6 +1500,13 @@ function topLevelAssistantResponse(event) {
1496
1500
  .trim();
1497
1501
  return text || undefined;
1498
1502
  }
1503
+ function sessionEventResponseId(event) {
1504
+ const input = jsonRecord(event);
1505
+ if (typeof input?.responseId === "string")
1506
+ return input.responseId;
1507
+ const item = jsonRecord(input?.item);
1508
+ return typeof item?.responseId === "string" ? item.responseId : undefined;
1509
+ }
1499
1510
  function sessionRunFailure(event) {
1500
1511
  const input = jsonRecord(event);
1501
1512
  if (input?.type !== "response.failed")
package/dist/pm2.d.ts CHANGED
@@ -14,6 +14,8 @@ export declare function startDaemon({ force, quiet, launchEnvironment, }: {
14
14
  launchEnvironment?: NodeJS.ProcessEnv;
15
15
  }): number;
16
16
  export declare function isPm2DaemonOnline(): boolean;
17
+ /** Whether `start` must replace or recreate the resident daemon generation. */
18
+ export declare function isDaemonStartRequired(): boolean;
17
19
  /**
18
20
  * Stop the daemon and terminate its dedicated pm2 supervisor.
19
21
  *
package/dist/pm2.js CHANGED
@@ -234,6 +234,12 @@ export function startDaemon({ force, quiet = false, launchEnvironment, }) {
234
234
  export function isPm2DaemonOnline() {
235
235
  return describe()?.pm2_env?.status === "online";
236
236
  }
237
+ /** Whether `start` must replace or recreate the resident daemon generation. */
238
+ export function isDaemonStartRequired() {
239
+ const existing = describe();
240
+ return existing?.pm2_env?.status !== "online" ||
241
+ residentBuildRestartRequired(existing);
242
+ }
237
243
  /**
238
244
  * Stop the daemon and terminate its dedicated pm2 supervisor.
239
245
  *
@@ -977,7 +977,22 @@ export class DaemonRuntimeConnectionManager {
977
977
  return {
978
978
  sessionId: terminal.sessionId,
979
979
  role: terminal.role,
980
+ seedBytes: terminal.seedBytes,
981
+ ...(terminal.dimensions ? { dimensions: terminal.dimensions } : {}),
980
982
  closed: terminal.closed,
983
+ onResize: (listener) => terminal.onResize?.(listener),
984
+ readSeed: (offset, maxBytes) => {
985
+ this.assertSlotCurrent(slot);
986
+ return terminal.readSeed(offset, maxBytes);
987
+ },
988
+ start: () => {
989
+ this.assertSlotCurrent(slot);
990
+ return terminal.start();
991
+ },
992
+ read: (offset, maxBytes) => {
993
+ this.assertSlotCurrent(slot);
994
+ return terminal.read(offset, maxBytes);
995
+ },
981
996
  write: (data) => {
982
997
  this.assertSlotCurrent(slot);
983
998
  return terminal.write(data);
@@ -987,19 +1002,6 @@ export class DaemonRuntimeConnectionManager {
987
1002
  return terminal.resize(cols, rows);
988
1003
  },
989
1004
  close,
990
- [Symbol.asyncIterator]: () => {
991
- const iterator = terminal[Symbol.asyncIterator]();
992
- return {
993
- next: () => {
994
- this.assertSlotCurrent(slot);
995
- return iterator.next();
996
- },
997
- return: async () => {
998
- await close();
999
- return { done: true, value: undefined };
1000
- },
1001
- };
1002
- },
1003
1005
  };
1004
1006
  }
1005
1007
  trackDedicatedBrowserSurface(slot, surface) {
@@ -1214,44 +1216,25 @@ function dedicatedDirectTerminal(connection, terminal, signal) {
1214
1216
  onAbort();
1215
1217
  else
1216
1218
  signal?.addEventListener("abort", onAbort, { once: true });
1217
- const closed = terminal.closed
1218
- .then((frame) => ({
1219
+ const closed = terminal.closed.then((frame) => ({
1219
1220
  reason: frame.reason,
1220
1221
  ...(frame.exitCode === undefined ? {} : { exitCode: frame.exitCode }),
1221
- }))
1222
- .finally(() => {
1223
- signal?.removeEventListener("abort", onAbort);
1224
- void closeConnection().catch(() => undefined);
1225
- });
1222
+ ...(frame.finalOffset === undefined ? {} : { finalOffset: frame.finalOffset }),
1223
+ }));
1226
1224
  void closed.catch(() => undefined);
1227
1225
  return {
1228
1226
  sessionId: terminal.sessionId,
1229
1227
  role: terminal.role,
1228
+ seedBytes: terminal.seedBytes,
1229
+ ...(terminal.dimensions ? { dimensions: terminal.dimensions } : {}),
1230
1230
  closed,
1231
+ onResize: (listener) => terminal.onResize(listener),
1232
+ readSeed: (offset, maxBytes) => terminal.readSeed(offset, maxBytes),
1233
+ start: () => terminal.start(),
1234
+ read: (offset, maxBytes) => terminal.read(offset, maxBytes),
1231
1235
  write: (data) => terminal.write(data),
1232
1236
  resize: (cols, rows) => terminal.resize(cols, rows),
1233
1237
  close,
1234
- [Symbol.asyncIterator]: () => {
1235
- const iterator = terminal[Symbol.asyncIterator]();
1236
- return {
1237
- next: async () => {
1238
- try {
1239
- const result = await iterator.next();
1240
- if (result.done)
1241
- await closeConnection().catch(() => undefined);
1242
- return result;
1243
- }
1244
- catch (error) {
1245
- await closeConnection().catch(() => undefined);
1246
- throw error;
1247
- }
1248
- },
1249
- return: async () => {
1250
- await close();
1251
- return { done: true, value: undefined };
1252
- },
1253
- };
1254
- },
1255
1238
  };
1256
1239
  }
1257
1240
  function remoteTerminalOpenErrorCode(reason) {
@@ -3,6 +3,6 @@
3
3
  * broken pipe (a `pm2 logs` stream detaching, or a pm2 restart) would otherwise
4
4
  * surface as an unhandled `'error'` on the stream and crash a daemon that has
5
5
  * no uncaughtException trap. Swallow EPIPE on the std streams; re-throw anything
6
- * else. (Borrowed from botmux's daemon bootstrap.)
6
+ * else.
7
7
  */
8
8
  export declare function installStdioEpipeGuard(): void;
@@ -3,7 +3,7 @@
3
3
  * broken pipe (a `pm2 logs` stream detaching, or a pm2 restart) would otherwise
4
4
  * surface as an unhandled `'error'` on the stream and crash a daemon that has
5
5
  * no uncaughtException trap. Swallow EPIPE on the std streams; re-throw anything
6
- * else. (Borrowed from botmux's daemon bootstrap.)
6
+ * else.
7
7
  */
8
8
  export function installStdioEpipeGuard() {
9
9
  for (const stream of [process.stdout, process.stderr]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/daemon",
3
- "version": "0.1.11-beta.32",
3
+ "version": "0.1.11-beta.34",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -51,17 +51,17 @@
51
51
  "tar": "^7.5.19",
52
52
  "undici": "^7.28.0",
53
53
  "ws": "^8.21.0",
54
- "@rynx-ai/core": "0.1.11-beta.32",
55
- "@rynx-ai/emulator": "0.1.11-beta.32",
56
- "@rynx-ai/plugin-runner": "0.1.11-beta.32",
57
- "@rynx-ai/plugin-sdk": "0.1.11-beta.32",
58
- "@rynx-ai/protocol": "0.1.11-beta.32",
59
- "@rynx-ai/remote-runtime-client": "0.1.11-beta.32",
60
- "@rynx-ai/server": "0.1.11-beta.32"
54
+ "@rynx-ai/core": "0.1.11-beta.34",
55
+ "@rynx-ai/emulator": "0.1.11-beta.34",
56
+ "@rynx-ai/plugin-runner": "0.1.11-beta.34",
57
+ "@rynx-ai/plugin-sdk": "0.1.11-beta.34",
58
+ "@rynx-ai/protocol": "0.1.11-beta.34",
59
+ "@rynx-ai/remote-runtime-client": "0.1.11-beta.34",
60
+ "@rynx-ai/server": "0.1.11-beta.34"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/ws": "^8.18.1",
64
- "@rynx-ai/plugin-channel-lark": "0.1.11-beta.32"
64
+ "@rynx-ai/plugin-channel-lark": "0.1.11-beta.34"
65
65
  },
66
66
  "scripts": {
67
67
  "build": "rm -rf dist bundled-plugins && tsc -p tsconfig.json && chmod +x dist/index-daemon.js && node ../../scripts/stage-bundled-plugins.mjs",