@ricsam/r5d-worker 0.0.172 → 0.0.173

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.
@@ -273,6 +273,40 @@ export declare const ManagerCommand: z.ZodDiscriminatedUnion<[z.ZodObject<{
273
273
  }, z.core.$strict>;
274
274
  }, z.core.$strict>;
275
275
  actionId: z.ZodString;
276
+ }, z.core.$strict>, z.ZodObject<{
277
+ method: z.ZodLiteral<"subscribe">;
278
+ run: z.ZodObject<{
279
+ operationId: z.ZodString;
280
+ userId: z.ZodString;
281
+ sessionId: z.ZodOptional<z.ZodString>;
282
+ fence: z.ZodObject<{
283
+ installationId: z.ZodString;
284
+ resourceType: z.ZodString;
285
+ resourceId: z.ZodString;
286
+ ownerId: z.ZodString;
287
+ epoch: z.ZodNumber;
288
+ }, z.core.$strict>;
289
+ }, z.core.$strict>;
290
+ offset: z.ZodDefault<z.ZodNumber>;
291
+ }, z.core.$strict>, z.ZodObject<{
292
+ method: z.ZodLiteral<"input">;
293
+ run: z.ZodObject<{
294
+ operationId: z.ZodString;
295
+ userId: z.ZodString;
296
+ sessionId: z.ZodOptional<z.ZodString>;
297
+ fence: z.ZodObject<{
298
+ installationId: z.ZodString;
299
+ resourceType: z.ZodString;
300
+ resourceId: z.ZodString;
301
+ ownerId: z.ZodString;
302
+ epoch: z.ZodNumber;
303
+ }, z.core.$strict>;
304
+ }, z.core.$strict>;
305
+ data: z.ZodOptional<z.ZodString>;
306
+ resize: z.ZodOptional<z.ZodObject<{
307
+ cols: z.ZodNumber;
308
+ rows: z.ZodNumber;
309
+ }, z.core.$strict>>;
276
310
  }, z.core.$strict>], "method">;
277
311
  }, z.core.$strict>, z.ZodObject<{
278
312
  method: z.ZodLiteral<"observe">;
@@ -439,6 +473,40 @@ export declare const ManagerCommand: z.ZodDiscriminatedUnion<[z.ZodObject<{
439
473
  }, z.core.$strict>;
440
474
  }, z.core.$strict>;
441
475
  actionId: z.ZodString;
476
+ }, z.core.$strict>, z.ZodObject<{
477
+ method: z.ZodLiteral<"subscribe">;
478
+ run: z.ZodObject<{
479
+ operationId: z.ZodString;
480
+ userId: z.ZodString;
481
+ sessionId: z.ZodOptional<z.ZodString>;
482
+ fence: z.ZodObject<{
483
+ installationId: z.ZodString;
484
+ resourceType: z.ZodString;
485
+ resourceId: z.ZodString;
486
+ ownerId: z.ZodString;
487
+ epoch: z.ZodNumber;
488
+ }, z.core.$strict>;
489
+ }, z.core.$strict>;
490
+ offset: z.ZodDefault<z.ZodNumber>;
491
+ }, z.core.$strict>, z.ZodObject<{
492
+ method: z.ZodLiteral<"input">;
493
+ run: z.ZodObject<{
494
+ operationId: z.ZodString;
495
+ userId: z.ZodString;
496
+ sessionId: z.ZodOptional<z.ZodString>;
497
+ fence: z.ZodObject<{
498
+ installationId: z.ZodString;
499
+ resourceType: z.ZodString;
500
+ resourceId: z.ZodString;
501
+ ownerId: z.ZodString;
502
+ epoch: z.ZodNumber;
503
+ }, z.core.$strict>;
504
+ }, z.core.$strict>;
505
+ data: z.ZodOptional<z.ZodString>;
506
+ resize: z.ZodOptional<z.ZodObject<{
507
+ cols: z.ZodNumber;
508
+ rows: z.ZodNumber;
509
+ }, z.core.$strict>>;
442
510
  }, z.core.$strict>], "method">;
443
511
  }, z.core.$strict>, z.ZodObject<{
444
512
  method: z.ZodLiteral<"receipt">;
@@ -782,6 +850,40 @@ export declare const ManagerRequest: z.ZodObject<{
782
850
  }, z.core.$strict>;
783
851
  }, z.core.$strict>;
784
852
  actionId: z.ZodString;
853
+ }, z.core.$strict>, z.ZodObject<{
854
+ method: z.ZodLiteral<"subscribe">;
855
+ run: z.ZodObject<{
856
+ operationId: z.ZodString;
857
+ userId: z.ZodString;
858
+ sessionId: z.ZodOptional<z.ZodString>;
859
+ fence: z.ZodObject<{
860
+ installationId: z.ZodString;
861
+ resourceType: z.ZodString;
862
+ resourceId: z.ZodString;
863
+ ownerId: z.ZodString;
864
+ epoch: z.ZodNumber;
865
+ }, z.core.$strict>;
866
+ }, z.core.$strict>;
867
+ offset: z.ZodDefault<z.ZodNumber>;
868
+ }, z.core.$strict>, z.ZodObject<{
869
+ method: z.ZodLiteral<"input">;
870
+ run: z.ZodObject<{
871
+ operationId: z.ZodString;
872
+ userId: z.ZodString;
873
+ sessionId: z.ZodOptional<z.ZodString>;
874
+ fence: z.ZodObject<{
875
+ installationId: z.ZodString;
876
+ resourceType: z.ZodString;
877
+ resourceId: z.ZodString;
878
+ ownerId: z.ZodString;
879
+ epoch: z.ZodNumber;
880
+ }, z.core.$strict>;
881
+ }, z.core.$strict>;
882
+ data: z.ZodOptional<z.ZodString>;
883
+ resize: z.ZodOptional<z.ZodObject<{
884
+ cols: z.ZodNumber;
885
+ rows: z.ZodNumber;
886
+ }, z.core.$strict>>;
785
887
  }, z.core.$strict>], "method">;
786
888
  }, z.core.$strict>, z.ZodObject<{
787
889
  method: z.ZodLiteral<"observe">;
@@ -948,6 +1050,40 @@ export declare const ManagerRequest: z.ZodObject<{
948
1050
  }, z.core.$strict>;
949
1051
  }, z.core.$strict>;
950
1052
  actionId: z.ZodString;
1053
+ }, z.core.$strict>, z.ZodObject<{
1054
+ method: z.ZodLiteral<"subscribe">;
1055
+ run: z.ZodObject<{
1056
+ operationId: z.ZodString;
1057
+ userId: z.ZodString;
1058
+ sessionId: z.ZodOptional<z.ZodString>;
1059
+ fence: z.ZodObject<{
1060
+ installationId: z.ZodString;
1061
+ resourceType: z.ZodString;
1062
+ resourceId: z.ZodString;
1063
+ ownerId: z.ZodString;
1064
+ epoch: z.ZodNumber;
1065
+ }, z.core.$strict>;
1066
+ }, z.core.$strict>;
1067
+ offset: z.ZodDefault<z.ZodNumber>;
1068
+ }, z.core.$strict>, z.ZodObject<{
1069
+ method: z.ZodLiteral<"input">;
1070
+ run: z.ZodObject<{
1071
+ operationId: z.ZodString;
1072
+ userId: z.ZodString;
1073
+ sessionId: z.ZodOptional<z.ZodString>;
1074
+ fence: z.ZodObject<{
1075
+ installationId: z.ZodString;
1076
+ resourceType: z.ZodString;
1077
+ resourceId: z.ZodString;
1078
+ ownerId: z.ZodString;
1079
+ epoch: z.ZodNumber;
1080
+ }, z.core.$strict>;
1081
+ }, z.core.$strict>;
1082
+ data: z.ZodOptional<z.ZodString>;
1083
+ resize: z.ZodOptional<z.ZodObject<{
1084
+ cols: z.ZodNumber;
1085
+ rows: z.ZodNumber;
1086
+ }, z.core.$strict>>;
951
1087
  }, z.core.$strict>], "method">;
952
1088
  }, z.core.$strict>, z.ZodObject<{
953
1089
  method: z.ZodLiteral<"receipt">;
@@ -1,5 +1,6 @@
1
1
  import { OperationEnvelope } from "@ricsam/r5d-api/runtime-protocol";
2
- import { type PollResult, type RunIdentity } from "../protocol";
2
+ import { ExecutorError, type PollResult, type RunIdentity, type RunReceipt, type StreamFrame } from "../protocol";
3
+ import type { ExecutorSubscription } from "../client";
3
4
  import { WorkspaceConfig, type ExecutorRoute, type WorkspaceIdentity, type OuterState, type ApprovedWorkbench as ApprovedWorkbenchInput } from "./contracts";
4
5
  import { SessionArtifactChunk } from "./artifacts";
5
6
  import { WorkspaceFileWrite } from "./file-write";
@@ -32,6 +33,7 @@ export declare class WorkspaceAuthority {
32
33
  private closed;
33
34
  private closeTask?;
34
35
  private readonly actions;
36
+ private readonly subscriptions;
35
37
  private readonly repositoryInitializations;
36
38
  private outerRepository?;
37
39
  private pending;
@@ -221,7 +223,11 @@ export declare class WorkspaceAuthority {
221
223
  code: string;
222
224
  message: string;
223
225
  operationId?: string;
224
- commit?: string;
226
+ commit? /** Storage for the account's outer repository, bound to no session. Its
227
+ * presence selects the outer-repository model: the workspace root is one
228
+ * repository whose files synchronize as a unit and whose project checkouts
229
+ * are mirrored, not published, per branch. Without it linked checkouts keep
230
+ * publishing per project, which the server workspace service relies on. */: string;
225
231
  };
226
232
  mirroredHead?: string | null;
227
233
  runs: Record<string, {
@@ -433,7 +439,7 @@ export declare class WorkspaceAuthority {
433
439
  startWithCredentials(identity: WorkspaceIdentity, input: OperationEnvelope, resolve: () => Promise<Array<{
434
440
  id: string;
435
441
  generation: number;
436
- }>>): Promise<import("..").RunReceipt>;
442
+ }>>): Promise<RunReceipt>;
437
443
  materializeArtifact(identity: WorkspaceIdentity, input: SessionArtifactChunk): Promise<{
438
444
  filename: string;
439
445
  sha256: string;
@@ -442,10 +448,28 @@ export declare class WorkspaceAuthority {
442
448
  complete: boolean;
443
449
  }>;
444
450
  /** Default arbitrary shell is mutating. Exact trusted config approval is the sole exemption. */
445
- start(identity: WorkspaceIdentity, input: OperationEnvelope, allowBlockedConflict?: boolean): Promise<import("..").RunReceipt>;
451
+ start(identity: WorkspaceIdentity, input: OperationEnvelope, allowBlockedConflict?: boolean): Promise<RunReceipt>;
446
452
  private runRoute;
447
453
  private action;
448
454
  poll(identity: WorkspaceIdentity, run: RunIdentity, stdoutOffset?: number, stderrOffset?: number, maxBytes?: number): Promise<PollResult>;
455
+ /** Run liveness is process state observed from the executor, not a workspace
456
+ * mutation: it is recorded on its own short queue, never behind the checkout's
457
+ * hydration, commit or publication work. A crash between two writers loses
458
+ * nothing lasting — `refresh` re-reads every open run from the executor. */
459
+ private recordRunState;
460
+ /** Live terminal channel. The subscription is not an admitted action: it
461
+ * lives as long as its transport, outlives the request budget, and is torn
462
+ * down on close. Its exit frame is the only durable-state effect. */
463
+ subscribe(identity: WorkspaceIdentity, run: RunIdentity, offset: number, handlers: {
464
+ frame(frame: StreamFrame): void;
465
+ close(error?: ExecutorError): void;
466
+ }): Promise<ExecutorSubscription>;
467
+ /** Live PTY input: fenced and owned like a write, but with no action receipt
468
+ * and no queue in front of it. */
469
+ streamInput(identity: WorkspaceIdentity, run: RunIdentity, data?: string, resize?: {
470
+ cols: number;
471
+ rows: number;
472
+ }): Promise<import("../protocol").InputResult>;
449
473
  private actionOutcome;
450
474
  write(identity: WorkspaceIdentity, run: RunIdentity, actionId: string, data: string, eof?: boolean): Promise<import("..").ActionReceipt>;
451
475
  resize(identity: WorkspaceIdentity, run: RunIdentity, actionId: string, cols: number, rows: number): Promise<import("..").ActionReceipt>;
@@ -44,7 +44,7 @@ export declare const WorkspaceConfig: z.ZodObject<{
44
44
  }, z.core.$strict>;
45
45
  export type WorkspaceConfig = z.input<typeof WorkspaceConfig>;
46
46
  export type ExecutorRoute = {
47
- client: Pick<HostExecutorClient, "start" | "poll" | "write" | "cancel"> & Partial<Pick<HostExecutorClient, "resize">>;
47
+ client: Pick<HostExecutorClient, "start" | "poll" | "write" | "cancel"> & Partial<Pick<HostExecutorClient, "resize" | "subscribe" | "input">>;
48
48
  workerFence: OwnershipFence;
49
49
  };
50
50
  export type WorkspaceIdentity = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.172",
3
+ "version": "0.0.173",
4
4
  "type": "module",
5
5
  "main": "./dist/mjs/main.mjs",
6
6
  "module": "./dist/mjs/main.mjs",
@@ -21,7 +21,7 @@
21
21
  "r5d-worker": "dist/mjs/main.mjs"
22
22
  },
23
23
  "dependencies": {
24
- "@ricsam/r5d-api": "^0.0.172",
24
+ "@ricsam/r5d-api": "^0.0.173",
25
25
  "node-pty": "1.1.0",
26
26
  "zod": "^4.1.13",
27
27
  "picomatch": "^4.0.3"