@rynx-ai/server 0.1.11-beta.20 → 0.1.11-beta.22

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.
@@ -7,8 +7,8 @@
7
7
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
8
8
  <link rel="icon" type="image/png" href="/favicon.png" />
9
9
  <title>rynx · control</title>
10
- <script type="module" crossorigin src="/assets/index-BKgzgxRn.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-5n6D-i-c.css">
10
+ <script type="module" crossorigin src="/assets/index-BQFR9W8k.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-0noHpRXD.css">
12
12
  </head>
13
13
  <body>
14
14
  <div id="root"></div>
@@ -1,4 +1,4 @@
1
- import { type AdmissionReservation, type AgentRuntimeId, type ConversationRuntime, type ResolvedExecutionSnapshot, type SessionWorkspaceSnapshot, type SessionProviderId, type MachineSessionRecord, type ReasoningEffort, type RuntimeUserInput, type SessionBus, type SessionLogStore, type SessionRegistry } from "@rynx-ai/core";
1
+ import { type AdmissionReservation, type AgentRuntimeId, type ConversationRuntime, type ResolvedExecutionSnapshot, type SessionWorkspaceSnapshot, type SessionProviderId, type MachineSessionRecord, type LiveSessionFailure, type ReasoningEffort, type RuntimeUserInput, type SessionBus, type SessionLogStore, type SessionRegistry } from "@rynx-ai/core";
2
2
  import type { SequencedSessionEvent, SessionEvent, SessionInteractionResolution, SessionItem, UserContentPart } from "@rynx-ai/protocol";
3
3
  import type { RemoteRuntimeSessionResourceDeleteParams, RemoteRuntimeSessionResourceDeleteResult, RemoteRuntimeSessionResourceGetParams, RemoteRuntimeSessionResourceGetResult, RemoteRuntimeSessionResourcePolicyResult, RemoteRuntimeSessionResourceReadParams, RemoteRuntimeSessionResourceReadResult, RemoteRuntimeSessionResourceUploadBeginParams, RemoteRuntimeSessionResourceUploadBeginResult, RemoteRuntimeSessionResourceUploadChunkParams, RemoteRuntimeSessionResourceUploadChunkResult, RemoteRuntimeSessionResourceUploadCommitParams, RemoteRuntimeSessionResourceUploadCommitResult } from "@rynx-ai/protocol/remote-runtime-rpc";
4
4
  import type { ControlAgentModelOption, ControlAgentSummary, ControlSessionInteractionResolveDisposition, ControlSessionRuntimeSnapshot, SessionPermissionPreset } from "@rynx-ai/protocol/control";
@@ -68,6 +68,7 @@ export interface MachineSessionRunnerPort {
68
68
  execution?: ResolvedExecutionSnapshot;
69
69
  }): Promise<boolean>;
70
70
  lastLiveSessionError?(sessionId: string): string | undefined;
71
+ lastLiveSessionFailure?(sessionId: string): LiveSessionFailure | undefined;
71
72
  injectMessage(sessionId: string, input: RuntimeUserInput | string): Promise<InjectOutcome>;
72
73
  stopRunner(sessionId: string): void;
73
74
  resolveInteraction(sessionId: string, interactionId: string, resolution: SessionInteractionResolution): Promise<{
@@ -275,7 +276,8 @@ export type MachineSessionServiceFailureCode = "not_found" | "failed_preconditio
275
276
  export declare class MachineSessionServiceFailure extends Error {
276
277
  readonly code: MachineSessionServiceFailureCode;
277
278
  readonly detail?: string | undefined;
278
- constructor(code: MachineSessionServiceFailureCode, message: string, detail?: string | undefined);
279
+ readonly runtimeFailure?: LiveSessionFailure | undefined;
280
+ constructor(code: MachineSessionServiceFailureCode, message: string, detail?: string | undefined, runtimeFailure?: LiveSessionFailure | undefined);
279
281
  }
280
282
  /** Application boundary shared by an in-process Local adapter and Direct RPC. */
281
283
  export declare class MachineSessionService {
@@ -31,10 +31,12 @@ export class MachineSessionServiceInputError extends Error {
31
31
  export class MachineSessionServiceFailure extends Error {
32
32
  code;
33
33
  detail;
34
- constructor(code, message, detail) {
34
+ runtimeFailure;
35
+ constructor(code, message, detail, runtimeFailure) {
35
36
  super(message);
36
37
  this.code = code;
37
38
  this.detail = detail;
39
+ this.runtimeFailure = runtimeFailure;
38
40
  this.name = "MachineSessionServiceFailure";
39
41
  }
40
42
  }
@@ -569,27 +571,41 @@ export class MachineSessionService {
569
571
  catch (error) {
570
572
  abandonResponseHandoff?.();
571
573
  await clearStartup("idle");
574
+ const failure = execution.runner.lastLiveSessionFailure?.(sessionId)
575
+ ?? liveSessionFailureFrom(error);
576
+ const reason = failure?.message
577
+ ?? (error instanceof Error ? error.message : String(error));
572
578
  if (request.clientMessageId) {
573
- await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, error instanceof Error ? error.message : String(error))).catch(() => undefined);
579
+ await Promise.resolve(resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason)).catch(() => undefined);
574
580
  }
575
- throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown");
581
+ throw new MachineSessionServiceFailure("outcome_unknown", "live injection outcome is unknown", reason, failure);
576
582
  }
577
583
  if (outcome === "failed") {
578
584
  abandonResponseHandoff?.();
579
585
  await clearStartup("idle");
586
+ const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
587
+ const reason = failure?.message
588
+ ?? execution.runner.lastLiveSessionError?.(sessionId)
589
+ ?? `live injection ${outcome}`;
580
590
  if (request.clientMessageId) {
581
- await resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, `live injection ${outcome}`);
591
+ await resources?.markMessageOutcomeUnknown(sessionId, request.clientMessageId, reason);
582
592
  }
583
- throw new MachineSessionServiceFailure("outcome_unknown", `live injection ${outcome}`);
593
+ throw new MachineSessionServiceFailure("outcome_unknown", `live injection ${outcome}`, reason, failure);
584
594
  }
585
- if (outcome !== "injected") {
595
+ if (outcome !== "injected" && outcome !== "steered") {
586
596
  abandonResponseHandoff?.();
587
597
  await clearStartup("idle");
598
+ const failure = execution.runner.lastLiveSessionFailure?.(sessionId);
599
+ const reason = failure?.message
600
+ ?? execution.runner.lastLiveSessionError?.(sessionId)
601
+ ?? `live injection ${outcome}`;
588
602
  if (request.clientMessageId) {
589
- await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, `live injection ${outcome}`);
603
+ await resources?.markMessageFailedNotStarted(sessionId, request.clientMessageId, reason);
590
604
  }
591
- throw new MachineSessionServiceFailure("failed_precondition", `live injection ${outcome}`);
605
+ throw new MachineSessionServiceFailure("failed_precondition", `live injection ${outcome}`, reason, failure);
592
606
  }
607
+ if (outcome === "steered")
608
+ abandonResponseHandoff?.();
593
609
  await clearStartup("running");
594
610
  if (request.clientMessageId) {
595
611
  try {
@@ -677,7 +693,8 @@ export class MachineSessionService {
677
693
  request.execution.runner.ensureLiveSession.bind(request.execution.runner);
678
694
  const started = await start(sessionId, request.options);
679
695
  if (!started) {
680
- throw new MachineSessionServiceFailure("failed_precondition", `Provider terminal unavailable (${request.liveRuntime})`, request.execution.runner.lastLiveSessionError?.(sessionId));
696
+ const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
697
+ throw new MachineSessionServiceFailure("failed_precondition", `Provider terminal unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
681
698
  }
682
699
  return { ok: true };
683
700
  }
@@ -685,7 +702,8 @@ export class MachineSessionService {
685
702
  const request = await this.liveSessionRequest(sessionId, meta);
686
703
  const live = await request.execution.runner.ensureLiveSession(sessionId, request.options);
687
704
  if (!live) {
688
- throw new MachineSessionServiceFailure("failed_precondition", `live session unavailable (${request.liveRuntime})`, request.execution.runner.lastLiveSessionError?.(sessionId));
705
+ const failure = request.execution.runner.lastLiveSessionFailure?.(sessionId);
706
+ throw new MachineSessionServiceFailure("failed_precondition", `live session unavailable (${request.liveRuntime})`, failure?.message ?? request.execution.runner.lastLiveSessionError?.(sessionId), failure);
689
707
  }
690
708
  return request.execution;
691
709
  }
@@ -821,7 +839,7 @@ export class MachineSessionService {
821
839
  return;
822
840
  injectionAttempted = true;
823
841
  const outcome = await execution.runner.injectMessage(sessionId, pending.message);
824
- if (outcome === "injected") {
842
+ if (outcome === "injected" || outcome === "steered") {
825
843
  await Promise.resolve(pendingStore.delete(sessionId)).catch(async () => {
826
844
  await Promise.resolve(pendingStore.markOutcomeUnknown(sessionId)).catch(() => undefined);
827
845
  });
@@ -1130,6 +1148,20 @@ function cloneRuntimeSnapshot(snapshot) {
1130
1148
  })),
1131
1149
  };
1132
1150
  }
1151
+ function liveSessionFailureFrom(error) {
1152
+ if (!error || typeof error !== "object")
1153
+ return undefined;
1154
+ const candidate = error;
1155
+ if (typeof candidate.message !== "string" ||
1156
+ typeof candidate.code !== "string" ||
1157
+ typeof candidate.statusCode !== "number")
1158
+ return undefined;
1159
+ return {
1160
+ message: candidate.message,
1161
+ code: candidate.code,
1162
+ statusCode: candidate.statusCode,
1163
+ };
1164
+ }
1133
1165
  function requestLimit(value, fallback, maximum, field) {
1134
1166
  return value === undefined ? Math.min(fallback, maximum) : boundedInteger(value, 1, maximum, field);
1135
1167
  }
@@ -347,7 +347,10 @@ function mapHostError(request, error) {
347
347
  : error.code === "conflict"
348
348
  ? "Remote Session resource conflicts with existing state"
349
349
  : "Remote Session operation may have been applied";
350
- return { code: error.code, message };
350
+ // Native lifecycle failures are already reduced to a user-safe phase and
351
+ // concrete Provider cause. Preserve that text over Direct Runtime so the
352
+ // remote UI does not collapse every startup failure into one wrapper.
353
+ return { code: error.code, message: error.runtimeFailure?.message ?? message };
351
354
  }
352
355
  if (request.method === "session.interrupt") {
353
356
  return {
package/dist/server.d.ts CHANGED
@@ -350,7 +350,7 @@ export interface RuntimeConnectionLease {
350
350
  };
351
351
  call<M extends RemoteRuntimeRpcMethod>(method: M, params: RemoteRuntimeRpcParams<M>, options?: {
352
352
  signal?: AbortSignal;
353
- timeoutMs?: number;
353
+ timeoutMs?: number | null;
354
354
  }): Promise<RemoteRuntimeRpcResultFor<M>>;
355
355
  subscribeSessionEvents(sessionId: string, options?: {
356
356
  signal?: AbortSignal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/server",
3
- "version": "0.1.11-beta.20",
3
+ "version": "0.1.11-beta.22",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -27,15 +27,15 @@
27
27
  "@koa/router": "^15.4.0",
28
28
  "koa": "^3.2.0",
29
29
  "ws": "^8.21.0",
30
- "@rynx-ai/core": "0.1.11-beta.20",
31
- "@rynx-ai/plugin-sdk": "0.1.11-beta.20",
32
- "@rynx-ai/protocol": "0.1.11-beta.20",
33
- "@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.20",
34
- "@rynx-ai/runtime": "0.1.11-beta.20"
30
+ "@rynx-ai/core": "0.1.11-beta.22",
31
+ "@rynx-ai/plugin-sdk": "0.1.11-beta.22",
32
+ "@rynx-ai/protocol": "0.1.11-beta.22",
33
+ "@rynx-ai/runtime": "0.1.11-beta.22",
34
+ "@rynx-ai/remote-runtime-e2ee": "0.1.11-beta.22"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/ws": "^8.18.1",
38
- "@rynx-ai/control-web": "0.1.11-beta.20"
38
+ "@rynx-ai/control-web": "0.1.11-beta.22"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "rm -rf dist && tsc -p tsconfig.json && mkdir -p dist/control-web && cp -R ../control-web/dist/. dist/control-web/",