@telorun/runner-core 0.8.1 → 0.9.0

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 (97) hide show
  1. package/README.md +33 -2
  2. package/dist/backend.d.ts +107 -23
  3. package/dist/backend.d.ts.map +1 -1
  4. package/dist/config.d.ts +27 -0
  5. package/dist/config.d.ts.map +1 -1
  6. package/dist/config.js +12 -0
  7. package/dist/config.js.map +1 -1
  8. package/dist/contract.d.ts +199 -15
  9. package/dist/contract.d.ts.map +1 -1
  10. package/dist/contract.js +9 -0
  11. package/dist/contract.js.map +1 -1
  12. package/dist/debug/ports-resolved.d.ts +26 -0
  13. package/dist/debug/ports-resolved.d.ts.map +1 -0
  14. package/dist/debug/ports-resolved.js +42 -0
  15. package/dist/debug/ports-resolved.js.map +1 -0
  16. package/dist/debug/relay.d.ts.map +1 -1
  17. package/dist/debug/relay.js +34 -6
  18. package/dist/debug/relay.js.map +1 -1
  19. package/dist/debug/run-projection.d.ts +53 -0
  20. package/dist/debug/run-projection.d.ts.map +1 -0
  21. package/dist/debug/run-projection.js +115 -0
  22. package/dist/debug/run-projection.js.map +1 -0
  23. package/dist/index.d.ts +8 -2
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +7 -1
  26. package/dist/index.js.map +1 -1
  27. package/dist/routes/apps.d.ts +1 -1
  28. package/dist/routes/apps.d.ts.map +1 -1
  29. package/dist/routes/apps.js +14 -4
  30. package/dist/routes/apps.js.map +1 -1
  31. package/dist/routes/io.d.ts.map +1 -1
  32. package/dist/routes/io.js +42 -9
  33. package/dist/routes/io.js.map +1 -1
  34. package/dist/routes/session-start.d.ts +12 -12
  35. package/dist/routes/session-start.d.ts.map +1 -1
  36. package/dist/routes/session-start.js +86 -13
  37. package/dist/routes/session-start.js.map +1 -1
  38. package/dist/routes/sessions.d.ts +11 -1
  39. package/dist/routes/sessions.d.ts.map +1 -1
  40. package/dist/routes/sessions.js +429 -4
  41. package/dist/routes/sessions.js.map +1 -1
  42. package/dist/server.d.ts.map +1 -1
  43. package/dist/server.js +21 -1
  44. package/dist/server.js.map +1 -1
  45. package/dist/session/byte-ring-buffer.d.ts +6 -1
  46. package/dist/session/byte-ring-buffer.d.ts.map +1 -1
  47. package/dist/session/byte-ring-buffer.js +2 -2
  48. package/dist/session/byte-ring-buffer.js.map +1 -1
  49. package/dist/session/registry.d.ts +144 -13
  50. package/dist/session/registry.d.ts.map +1 -1
  51. package/dist/session/registry.js +166 -25
  52. package/dist/session/registry.js.map +1 -1
  53. package/dist/session/watch-supervisor.d.ts +42 -0
  54. package/dist/session/watch-supervisor.d.ts.map +1 -0
  55. package/dist/session/watch-supervisor.js +99 -0
  56. package/dist/session/watch-supervisor.js.map +1 -0
  57. package/dist/session/workspace-app.d.ts +4 -0
  58. package/dist/session/workspace-app.d.ts.map +1 -0
  59. package/dist/session/workspace-app.js +26 -0
  60. package/dist/session/workspace-app.js.map +1 -0
  61. package/dist/session/workspace-client.d.ts +33 -0
  62. package/dist/session/workspace-client.d.ts.map +1 -0
  63. package/dist/session/workspace-client.js +62 -0
  64. package/dist/session/workspace-client.js.map +1 -0
  65. package/dist/session/workspace-marker.d.ts +25 -0
  66. package/dist/session/workspace-marker.d.ts.map +1 -0
  67. package/dist/session/workspace-marker.js +35 -0
  68. package/dist/session/workspace-marker.js.map +1 -0
  69. package/dist/sse/channel.d.ts.map +1 -1
  70. package/dist/sse/channel.js +4 -0
  71. package/dist/sse/channel.js.map +1 -1
  72. package/package.json +5 -4
  73. package/src/backend.ts +111 -22
  74. package/src/config.ts +59 -0
  75. package/src/contract.ts +197 -15
  76. package/src/debug/ports-resolved.test.ts +66 -0
  77. package/src/debug/ports-resolved.ts +43 -0
  78. package/src/debug/relay.ts +32 -4
  79. package/src/debug/run-projection.test.ts +155 -0
  80. package/src/debug/run-projection.ts +122 -0
  81. package/src/index.ts +20 -1
  82. package/src/routes/apps.ts +14 -5
  83. package/src/routes/io.ts +58 -12
  84. package/src/routes/session-start.ts +106 -27
  85. package/src/routes/sessions.ts +498 -7
  86. package/src/server.ts +22 -1
  87. package/src/session/byte-ring-buffer.ts +8 -2
  88. package/src/session/registry.ts +288 -28
  89. package/src/session/ring-buffer.test.ts +4 -3
  90. package/src/session/watch-lifetime.test.ts +203 -0
  91. package/src/session/watch-supervisor.ts +112 -0
  92. package/src/session/workspace-app.ts +27 -0
  93. package/src/session/workspace-client.ts +80 -0
  94. package/src/session/workspace-marker.test.ts +35 -0
  95. package/src/session/workspace-marker.ts +39 -0
  96. package/src/sse/channel.ts +5 -0
  97. package/workspace-app/telo.yaml +228 -0
package/README.md CHANGED
@@ -9,6 +9,14 @@ and [`k8s-runner`](../../apps/k8s-runner)). It owns everything about a run
9
9
  `/v1/sessions/:id/io` WebSocket PTY);
10
10
  - the in-memory **session registry**, event/byte **ring buffers** (SSE + PTY
11
11
  replay with gap detection), and bundle-path traversal guards;
12
+ - the **run projection** — per-app run outcomes derived from the kernel
13
+ lifecycle events already on the debug stream, so the runner never parses a
14
+ terminal to learn how a run ended;
15
+ - the **watch supervisor** — the workspace checkpoint timer and the idle reaper;
16
+ - the **workspace application** (`workspace-app/telo.yaml`), the manifest a watch
17
+ session's `workspace` container runs. It lives here because the workspace
18
+ surface is part of the `/v1` contract: both backends mount the same bytes, and
19
+ a copy per backend would be two manifests to hold in agreement;
12
20
  - graceful-shutdown helpers and base config parsing.
13
21
 
14
22
  ## The seam: `RunnerBackend`
@@ -25,11 +33,34 @@ interface RunnerBackend {
25
33
  }
26
34
  ```
27
35
 
36
+ Every callback is qualified by the application it belongs to. A session runs one
37
+ container per application — usually exactly one — and each has its own terminal,
38
+ so the byte channel is keyed `(session, app)` rather than labelled on a merged
39
+ stream. A single-app session carries the qualifier too, so no client needs two
40
+ readings.
41
+
42
+ A watch session's `BackendSession` additionally exposes `workspace`, `reload`,
43
+ `setApps` and `suspend`: it is a workspace that runs continuously rather than one
44
+ run, so its lifetime outlives every run inside it.
45
+
28
46
  Bundle delivery is the backend's responsibility (docker writes a shared-volume
29
- workdir; k8s stages a tarball for an initContainer fetch), so `start` receives
30
- the raw `bundle` rather than a pre-resolved path. `buildServer({ backend, config,
47
+ workdir; k8s stages a tarball for an initContainer fetch, and a watch session
48
+ seeds through the workspace container's own routes), so `start` receives the raw
49
+ `bundle` rather than a pre-resolved path. `buildServer({ backend, config,
31
50
  version })` wires a backend into the full `/v1` app.
32
51
 
52
+ ## Two nouns, one stream
53
+
54
+ `status` is the SESSION's state; `run` is one application's outcome. They are
55
+ separate because a session can outlive its runs: a one-shot Runnable finishing in
56
+ a watch session emits `run` with `phase: "completed"` and leaves `status:
57
+ running`, so the next edit starts that app's next generation.
58
+
59
+ Workload output travels neither — it goes over the byte channel (`/io`), which
60
+ exists precisely because per-chunk events are wasteful for high-volume output.
61
+ The `stdout` / `stderr` `RunEvent` variants that used to be declared here were
62
+ emitted by nothing; they are gone rather than qualified.
63
+
33
64
  ## Development
34
65
 
35
66
  ```bash
package/dist/backend.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { DebugFrame } from "@telorun/debug-wire";
2
- import type { AvailabilityReport, PortMapping, ProbeConfig, ReachabilityState, RunBundle, RunPhase, RunStatus, SessionConfig } from "./contract.js";
2
+ import type { ResolvedRunnerApp } from "./config.js";
3
+ import type { AvailabilityReport, ByteStreamTag, IoMode, PortMapping, ProbeConfig, ReachabilityState, RunBundle, RunnerEndpoint, RunPhase, RunStatus, SessionConfig, SessionMode, WorkspaceChangeSet, WorkspaceCheckpointFile, WorkspaceTree } from "./contract.js";
3
4
  /**
4
5
  * The seam between backend-neutral session machinery (routes, registry, SSE)
5
6
  * and a concrete workload runtime (docker container, kubernetes pod).
@@ -26,55 +27,138 @@ export interface RunnerBackend {
26
27
  * in-memory, so a restart otherwise leaks running workloads. */
27
28
  reapOrphans?(): Promise<void>;
28
29
  }
29
- export interface BackendStartSpec {
30
- sessionId: string;
31
- bundle: RunBundle;
32
- /** Bundle-relative entry path, already traversal-normalized by core. */
30
+ /** One application container the backend must stand up. */
31
+ export interface BackendAppSpec {
32
+ name: string;
33
+ /** Bundle-relative entry path, already traversal-normalized by core. Empty for
34
+ * a self-contained app session, where the image's own entrypoint runs. */
33
35
  entryRelativePath: string;
34
- env: Record<string, string>;
35
36
  ports: PortMapping[];
37
+ io: IoMode;
38
+ }
39
+ /**
40
+ * The DATA half of a workload launch — everything a start needs that is not a
41
+ * callback. Retained on the session entry so `resume` can build a fresh pod
42
+ * under the same session id from the same description, rather than a second,
43
+ * drifting copy of it.
44
+ */
45
+ export interface WorkloadLaunch {
46
+ bundle: RunBundle;
47
+ env: Record<string, string>;
36
48
  config: SessionConfig;
37
49
  /** True for an operator-predefined app session (`POST /v1/apps/:name/sessions`):
38
50
  * `config.image` is self-contained (app + controllers baked in), so the
39
51
  * backend runs the image's own entrypoint and stages no bundle — `bundle`
40
52
  * is an empty placeholder. */
41
53
  selfContained: boolean;
42
- /** When true, launch the workload with `--inspect` and relay its kernel debug
54
+ /** When true, launch each app with `--inspect` and relay its kernel debug
43
55
  * stream via `onDebug`. The inspect endpoint stays reachable only by the
44
- * runner — never published outward. */
56
+ * runner — never published outward. Always true for a watch session: that
57
+ * stream is where `run` events are projected from. */
45
58
  inspect: boolean;
59
+ /** `run` (one pod, terminal on exit, today's shape) or `watch` (a workspace
60
+ * volume, `telo run --watch` per app, the pod outliving its runs). */
61
+ mode: SessionMode;
62
+ /** The applications to run, one container each. Never empty — core defaults a
63
+ * request with no `apps` to a single entry. */
64
+ apps: BackendAppSpec[];
65
+ /** The resolved catalog entry for a co-resident agent container, when one was
66
+ * requested. Its operator env goes on THAT container and nowhere else — the
67
+ * credential boundary used to be structural (two pods) and is now a code
68
+ * invariant (containers in one pod). */
69
+ agent?: ResolvedRunnerApp;
70
+ }
71
+ export interface BackendStartSpec extends WorkloadLaunch {
72
+ sessionId: string;
46
73
  /** Emit a lifecycle status. The backend drives `starting` → `running` →
47
- * terminal (`exited`/`failed`/`stopped`). */
74
+ * terminal (`exited`/`failed`/`stopped`), or `suspended` on an idle reap. */
48
75
  onStatus(status: RunStatus): void;
49
76
  /** Emit a progress message for a coming-up phase (build / provision / boot).
50
77
  * Additive to status — surfaces what's happening while the session is still
51
- * `starting`, driving the editor's spinner + step feed. */
52
- onProgress(phase: RunPhase, message: string, done?: boolean): void;
53
- /** Raw merged stdout/stderr (PTY) bytes from the workload. */
54
- onOutput(chunk: Buffer): void;
55
- /** A frame relayed from the workload's kernel debug stream. Only called when
56
- * `inspect` is true and the backend has connected to the inspect endpoint. */
57
- onDebug(frame: DebugFrame): void;
78
+ * `starting`. `app` is omitted for session-scoped provisioning. */
79
+ onProgress(phase: RunPhase, message: string, done?: boolean, app?: string): void;
80
+ /** Bytes from one app's terminal. `stream` is `tty` under a terminal attach
81
+ * and `stdout`/`stderr` only where the transport genuinely separated them. */
82
+ onOutput(app: string, chunk: Buffer, stream: ByteStreamTag): void;
83
+ /** A frame relayed from one app's kernel debug stream. Only called when
84
+ * `inspect` is true and the backend has connected to that app's endpoint. */
85
+ onDebug(app: string, frame: DebugFrame): void;
58
86
  /** Report a declared port's reachability from the runner network — `checking`
59
87
  * while the workload comes up, then `reachable`, or `unreachable` after a
60
88
  * timeout. Surfaced on the editor's endpoint badge, not the log stream. */
61
- onReachability(port: number, state: ReachabilityState): void;
89
+ onReachability(app: string, port: number, state: ReachabilityState): void;
90
+ /** One app's workload ended on its own. A run session's workload ending IS the
91
+ * session ending, so this is a watch-session concern: under `--watch` a
92
+ * finished run leaves the container up, and a container that goes away has
93
+ * died. Reported through the contract rather than by synthesizing a kernel
94
+ * frame — that stream's contract is "frames relayed from the workload", and a
95
+ * backend writing into it puts an event on the wire no kernel emitted. */
96
+ onRunEnded(app: string, outcome: {
97
+ code?: number;
98
+ reason?: string;
99
+ }): void;
100
+ /** An app's routable endpoint set changed after a reload re-read its declared
101
+ * ports. */
102
+ onEndpoints(app: string, change: {
103
+ added?: RunnerEndpoint[];
104
+ removed?: RunnerEndpoint[];
105
+ rejected?: Array<{
106
+ port: number;
107
+ reason: string;
108
+ }>;
109
+ }): void;
62
110
  /** True once a user stop / shutdown has been requested — lets the backend
63
111
  * classify a kill as `stopped` rather than `failed`. */
64
112
  isUserStopped(): boolean;
65
113
  }
66
114
  export interface BackendSession {
67
- /** Write bytes to the workload's stdin (PTY). A no-op once the workload has
68
- * terminated, so callers need not track liveness. */
69
- writeStdin(bytes: Uint8Array): void;
70
- /** Resize the workload's PTY. */
71
- resize(cols: number, rows: number): void;
115
+ /** Write bytes to one app's stdin. A no-op once that workload has terminated,
116
+ * so callers need not track liveness. */
117
+ writeStdin(app: string, bytes: Uint8Array): void;
118
+ /** Resize one app's PTY. A no-op for an app running under `io: "streams"` —
119
+ * the route rejects such a resize before it reaches here. */
120
+ resize(app: string, cols: number, rows: number): void;
72
121
  /** Resolves after the workload terminates and its terminal status has been
73
122
  * emitted via `onStatus`. Never rejects — terminal failures surface as a
74
- * `failed` status. */
123
+ * `failed` status. A watch session's workload outlives its runs, so this
124
+ * settles only on stop, suspend, or the pod deadline. */
75
125
  readonly done: Promise<void>;
76
126
  /** Force-stop the workload. Idempotent and safe to call after natural exit
77
127
  * (a backend should treat an already-gone workload as a no-op). */
78
128
  stop(): Promise<void>;
129
+ /** The workspace surface, present only on a watch session. Everything outside
130
+ * the pod writes through here; the agent (inside it) writes the volume with
131
+ * its own filesystem tools. */
132
+ readonly workspace?: WorkspaceAccess;
133
+ /** Re-run one app with no file change (`POST /v1/sessions/:id/reload`), by
134
+ * touching its entry manifest through the same path every other write takes.
135
+ * No signalling into the container, no shared PID namespace, no `exec` — RBAC
136
+ * is unchanged. Watch sessions only. */
137
+ reload?(app: string): Promise<void>;
138
+ /** Replace the running app set. A pod's container list is fixed at creation,
139
+ * so this checkpoints, deletes the pod and creates one with the new set —
140
+ * the suspend/resume path, reused because it has to be. */
141
+ setApps?(apps: BackendAppSpec[]): Promise<void>;
142
+ /** Delete the workload, keeping nothing but what the caller already
143
+ * checkpointed. `resume` builds a fresh one from that checkpoint. */
144
+ suspend?(): Promise<void>;
145
+ }
146
+ /** The `workspace` container's routes, proxied by the runner. Reading and
147
+ * applying a change set are the only two shapes: a single-file write route
148
+ * would be a second set of concurrency rules over the same directory. */
149
+ export interface WorkspaceAccess {
150
+ tree(): Promise<WorkspaceTree>;
151
+ readFile(path: string): Promise<{
152
+ content: string;
153
+ size: number;
154
+ }>;
155
+ apply(changes: WorkspaceChangeSet): Promise<{
156
+ written: number;
157
+ deleted: number;
158
+ }>;
159
+ /** Whole-tree pull for the checkpoint timer and for suspend. Whole tree rather
160
+ * than a delta log: a manifest workspace is small, and one shape is easier to
161
+ * reason about than a replay that has to be correct. */
162
+ snapshot(): Promise<WorkspaceCheckpointFile[]>;
79
163
  }
80
164
  //# sourceMappingURL=backend.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EACV,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,QAAQ,EACR,SAAS,EACT,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,aAAa;IAC5B;wEACoE;IACpE,KAAK,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAExD;;8DAE0D;IAC1D,KAAK,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAEvD;;qEAEiE;IACjE,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,SAAS,CAAC;IAClB,wEAAwE;IACxE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,CAA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,CAAC;IAEtD;;;8DAG0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B;wEACoE;IACpE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtB;;oCAEgC;IAChC,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IAErC;;;6CAGyC;IACzC,MAAM,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpC;;gEAE4D;IAC5D,OAAO,CAAC,CAAC,IAAI,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;0EACsE;IACtE,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED;;0EAE0E;AAC1E,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,KAAK,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClF;;6DAEyD;IACzD,QAAQ,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;CAChD"}
package/dist/config.d.ts CHANGED
@@ -11,6 +11,32 @@ export interface RunnerCoreConfig {
11
11
  exitTtlMs: number;
12
12
  replayBufferBytes: number;
13
13
  corsOrigins: string[] | "*";
14
+ watch: WatchSessionConfig;
15
+ }
16
+ /**
17
+ * Watch-session policy. Off by default and separately ceilinged, because a watch
18
+ * session is a materially different resource shape from a run: a pod that
19
+ * outlives its runs, whose concurrency is bounded by simultaneous EDITORS rather
20
+ * than simultaneous runs. Inheriting a run session's ceilings would size it for
21
+ * the opposite assumption.
22
+ */
23
+ export interface WatchSessionConfig {
24
+ /** Server-side gate. Watch sessions are never client-requestable when off. */
25
+ enabled: boolean;
26
+ /** No SSE/WS subscriber for this long → suspend (pod deleted, checkpoint held). */
27
+ idleMs: number;
28
+ /** Pod deadline for a watch session. The agent and app containers share one
29
+ * pod, so one deadline covers both: take the longer (agent) ceiling and let
30
+ * idleness do the real work, or the conversation dies at an hour mid-turn. */
31
+ maxTtlSeconds: number;
32
+ maxSessions: number;
33
+ reloadLimitPerMinute: number;
34
+ /** How long a SUSPENDED record is retained before eviction. Deliberately not
35
+ * the pod deadline: that bounds a pod, so on its own nothing would ever evict
36
+ * a suspended record. */
37
+ suspendedTtlMs: number;
38
+ /** How often the runner pulls a whole-tree workspace snapshot. */
39
+ checkpointMs: number;
14
40
  }
15
41
  export declare class RunnerConfigError extends Error {
16
42
  }
@@ -76,4 +102,5 @@ export declare function parseCorsOrigins(raw: string | undefined): string[] | "*
76
102
  export declare function loadCoreConfig(env: NodeJS.ProcessEnv, defaults?: {
77
103
  port?: number;
78
104
  }): RunnerCoreConfig;
105
+ export declare function loadWatchConfig(env: NodeJS.ProcessEnv): WatchSessionConfig;
79
106
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;CAC7B;AAED,qBAAa,iBAAkB,SAAQ,KAAK;CAAG;AAE/C,wBAAgB,gBAAgB,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AAE,MAAM,CAAC,UAAU,EACtB,QAAQ,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,gBAAgB,CAkBlB;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,kBAAkB,CA6B1E"}
package/dist/config.js CHANGED
@@ -165,6 +165,18 @@ export function loadCoreConfig(env, defaults = {}) {
165
165
  exitTtlMs: parsePositiveInt(env.RUNNER_EXIT_TTL_MS, 4 * 60 * 60 * 1000, "RUNNER_EXIT_TTL_MS"),
166
166
  replayBufferBytes: parsePositiveInt(env.RUNNER_REPLAY_BUFFER_BYTES, 5_000_000, "RUNNER_REPLAY_BUFFER_BYTES"),
167
167
  corsOrigins: parseCorsOrigins(env.RUNNER_CORS_ORIGINS),
168
+ watch: loadWatchConfig(env),
169
+ };
170
+ }
171
+ export function loadWatchConfig(env) {
172
+ return {
173
+ enabled: parseBool(env.RUNNER_WATCH_SESSIONS, false, "RUNNER_WATCH_SESSIONS"),
174
+ idleMs: parsePositiveInt(env.RUNNER_WATCH_IDLE_SECONDS, 300, "RUNNER_WATCH_IDLE_SECONDS") * 1000,
175
+ maxTtlSeconds: parsePositiveInt(env.RUNNER_WATCH_MAX_TTL_SECONDS, 21600, "RUNNER_WATCH_MAX_TTL_SECONDS"),
176
+ maxSessions: parsePositiveInt(env.RUNNER_WATCH_MAX_SESSIONS, 8, "RUNNER_WATCH_MAX_SESSIONS"),
177
+ reloadLimitPerMinute: parsePositiveInt(env.RUNNER_WATCH_RELOAD_LIMIT, 30, "RUNNER_WATCH_RELOAD_LIMIT"),
178
+ suspendedTtlMs: parsePositiveInt(env.RUNNER_WATCH_SUSPENDED_TTL_SECONDS, 86400, "RUNNER_WATCH_SUSPENDED_TTL_SECONDS") * 1000,
179
+ checkpointMs: parsePositiveInt(env.RUNNER_WORKSPACE_CHECKPOINT_SECONDS, 30, "RUNNER_WORKSPACE_CHECKPOINT_SECONDS") * 1000,
168
180
  };
169
181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;QACtD,KAAK,EAAE,eAAe,CAAC,GAAG,CAAC;KAC5B,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,GAAsB;IACpD,OAAO;QACL,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,qBAAqB,EAAE,KAAK,EAAE,uBAAuB,CAAC;QAC7E,MAAM,EACJ,gBAAgB,CAAC,GAAG,CAAC,yBAAyB,EAAE,GAAG,EAAE,2BAA2B,CAAC,GAAG,IAAI;QAC1F,aAAa,EAAE,gBAAgB,CAC7B,GAAG,CAAC,4BAA4B,EAChC,KAAK,EACL,8BAA8B,CAC/B;QACD,WAAW,EAAE,gBAAgB,CAAC,GAAG,CAAC,yBAAyB,EAAE,CAAC,EAAE,2BAA2B,CAAC;QAC5F,oBAAoB,EAAE,gBAAgB,CACpC,GAAG,CAAC,yBAAyB,EAC7B,EAAE,EACF,2BAA2B,CAC5B;QACD,cAAc,EACZ,gBAAgB,CACd,GAAG,CAAC,kCAAkC,EACtC,KAAK,EACL,oCAAoC,CACrC,GAAG,IAAI;QACV,YAAY,EACV,gBAAgB,CACd,GAAG,CAAC,mCAAmC,EACvC,EAAE,EACF,qCAAqC,CACtC,GAAG,IAAI;KACX,CAAC;AACJ,CAAC"}
@@ -42,11 +42,29 @@ export interface RunnerTerms {
42
42
  }
43
43
  /** HTTP header carrying the accepted terms version on `POST /v1/sessions`. */
44
44
  export declare const ACCEPTED_TERMS_HEADER = "x-telo-accepted-terms";
45
+ /**
46
+ * How an application container's byte channel is attached.
47
+ * - `tty` — one merged stream, as a terminal produces. Resize works;
48
+ * `CLICOLOR_FORCE` is injected.
49
+ * - `streams` — stdout and stderr separated at the source. Resize is rejected
50
+ * (meaningless with no PTY) and no colour is forced, so the app
51
+ * sees the environment it would see in production.
52
+ * Nothing is invented at the transport layer: docker's non-TTY attach is already
53
+ * a multiplexed stream carrying a per-frame stream id, and the kubernetes attach
54
+ * subresource without a TTY already gives separate stdout/stderr channels.
55
+ */
56
+ export type IoMode = "tty" | "streams";
45
57
  export interface RunnerFeatures {
46
- /** Runner exposes a live PTY byte channel (`/v1/sessions/:id/io`). */
47
- io: boolean;
58
+ /** Byte-channel attach modes this runner offers (`/v1/sessions/:id/io`). */
59
+ io: IoMode[];
48
60
  /** Runner can publish workload ports back to the client. */
49
61
  ports: boolean;
62
+ /** Watch sessions (`mode: "watch"`) are requestable. Server-gated: a runner
63
+ * with watch disabled advertises `false` and rejects the field. */
64
+ watch: boolean;
65
+ /** Catalog names admissible as a session's co-resident `agent`. Empty/absent
66
+ * when the operator configured none. */
67
+ agents?: string[];
50
68
  }
51
69
  /** An operator-predefined application the runner can launch by name. Only the
52
70
  * identity is advertised — the image and the operator env injected into it
@@ -90,6 +108,10 @@ export interface RunBundle {
90
108
  files: Array<{
91
109
  relativePath: string;
92
110
  contents: string;
111
+ /** `utf8` when omitted. A checkpoint re-seeds a resumed session through this
112
+ * same shape, and a workspace may hold a binary asset, so dropping anything
113
+ * that is not text would silently lose a file across a suspend. */
114
+ encoding?: "utf8" | "base64";
93
115
  }>;
94
116
  }
95
117
  export type PortProtocol = "tcp" | "udp";
@@ -112,6 +134,39 @@ export interface RunnerEndpoint {
112
134
  /** Fully-qualified URL when the endpoint is fronted by a proxy/ingress. */
113
135
  url?: string;
114
136
  }
137
+ /**
138
+ * How long a session lives relative to its runs.
139
+ * - `run` — one run. The workload exits and the session is terminal. Today's
140
+ * behaviour, and the default.
141
+ * - `watch` — a workspace that runs continuously. Each application container
142
+ * runs `telo run --watch`, an edit costs a kernel reload rather
143
+ * than a pod, and a completed one-shot run leaves the session up.
144
+ */
145
+ export type SessionMode = "run" | "watch";
146
+ /** The name a single-app session's one application takes when the request
147
+ * declares no `apps` — so every `run` / `debug` / `endpoints` event names an
148
+ * app, and no client needs two readings of the same stream. */
149
+ export declare const DEFAULT_APP_NAME = "app";
150
+ /**
151
+ * One application in a session — one container, one kernel, one watcher. Most
152
+ * workspaces have exactly one: an Application with several Services in its
153
+ * `targets:` is still one kernel. The multi-app case is two independent
154
+ * Applications, which genuinely cannot be merged (importing a `Telo.Application`
155
+ * is a hard error, so no manifest composes them).
156
+ */
157
+ export interface SessionAppSpec {
158
+ /** Unique within the session and usable as a DNS label — it appears in the
159
+ * container name and in every run event. */
160
+ name: string;
161
+ /** Bundle-relative entry manifest this app runs. */
162
+ entryRelativePath: string;
163
+ /** Ports this app declares. Unique across the WHOLE session: session hosts are
164
+ * `<port>-<sessionId>.<base-domain>`, a single label, so two apps on one port
165
+ * would collide with nothing to tell them apart. */
166
+ ports?: PortMapping[];
167
+ /** Terminal or separated streams; defaults to `tty`. */
168
+ io?: IoMode;
169
+ }
115
170
  export interface StartSessionRequest {
116
171
  bundle: RunBundle;
117
172
  env: Record<string, string>;
@@ -120,15 +175,37 @@ export interface StartSessionRequest {
120
175
  /** Request the kernel debug stream. When true the runner launches the
121
176
  * workload with `--inspect`, subscribes to the in-workload inspect endpoint
122
177
  * (reachable only by the runner — never published outward), and relays each
123
- * frame to the client as a `debug` {@link RunEvent}. */
178
+ * frame to the client as a `debug` {@link RunEvent}. A watch session always
179
+ * runs with it on — that stream is where `run` events are projected from. */
124
180
  inspect?: boolean;
181
+ /** Defaults to `run`. */
182
+ mode?: SessionMode;
183
+ /** Catalog name of a co-resident agent container. At most one per session,
184
+ * never per app: the agent's unit is the workspace, and two agents over one
185
+ * workspace would contend on the same files and split one conversation in
186
+ * half. Requires `mode: "watch"` — an agent with nothing watching its writes
187
+ * is a silent no-op. */
188
+ agent?: string;
189
+ /** The applications this session runs, one container each. Omitted, it
190
+ * defaults to a single app named `app` on the bundle's own entry with the
191
+ * request's `ports` — so a single-app session is written exactly as before. */
192
+ apps?: SessionAppSpec[];
125
193
  }
194
+ /**
195
+ * The SESSION's status — how the session itself is doing, not how any one run
196
+ * ended. The two are separate nouns on the same stream: a one-shot app finishing
197
+ * in a watch session emits `run.completed` and leaves the session `running`, so
198
+ * the next edit starts that app's next generation.
199
+ *
200
+ * `exited` belongs to a `run` session only, where the session IS the run.
201
+ */
126
202
  export type RunStatus = {
127
203
  kind: "starting";
128
204
  }
129
- /** `inspectUrl` is the kernel debug/inspection UI fronted by a proxy (set only
130
- * when the session ran with `inspect` and the runner has a public base URL);
131
- * absent when the inspect endpoint isn't externally reachable. */
205
+ /** Every application container is up. `inspectUrl` is the kernel
206
+ * debug/inspection UI fronted by a proxy (set only when the session ran with
207
+ * `inspect` and the runner has a public base URL); absent when the inspect
208
+ * endpoint isn't externally reachable. */
132
209
  | {
133
210
  kind: "running";
134
211
  endpoints?: RunnerEndpoint[];
@@ -136,6 +213,14 @@ export type RunStatus = {
136
213
  } | {
137
214
  kind: "exited";
138
215
  code: number;
216
+ }
217
+ /** Reaped for idleness: the pod is gone, the workspace checkpoint is held, and
218
+ * `POST /v1/sessions/:id/resume` brings it back under the same session id.
219
+ * NOT terminal — nothing is evicted on it. Best-effort by design: the runner
220
+ * holds the checkpoint in memory, so a runner restart loses it and the editor
221
+ * (which holds the authoritative workspace) re-seeds from its own copy. */
222
+ | {
223
+ kind: "suspended";
139
224
  } | {
140
225
  kind: "failed";
141
226
  message: string;
@@ -152,34 +237,133 @@ export type RunPhase = "build" | "provision" | "boot";
152
237
  * runner from its own network. Drives the editor's endpoint badge
153
238
  * (spinner → ok / error) instead of an app-log line. */
154
239
  export type ReachabilityState = "checking" | "reachable" | "unreachable";
155
- export type RunEvent = {
156
- type: "stdout";
157
- chunk: string;
240
+ /** What started one generation of an application.
241
+ * - `initial` — the session came up
242
+ * - `watch` — a file changed under the app's watcher
243
+ * - `manual` — `POST /v1/sessions/:id/reload`
244
+ * - `resume` — a suspended session was brought back, or the app set changed */
245
+ export type RunTrigger = "initial" | "watch" | "manual" | "resume";
246
+ /**
247
+ * A RUN outcome — one per app per reload generation, distinct from the session
248
+ * status above. `generation` is monotonic per app and starts at 1; it is counted
249
+ * by the runner from the kernel lifecycle events already on the debug stream, so
250
+ * it asks the kernel for nothing.
251
+ */
252
+ export type RunOutcomeEvent = {
253
+ type: "run";
254
+ app: string;
255
+ generation: number;
256
+ phase: "started";
257
+ trigger: RunTrigger;
158
258
  } | {
159
- type: "stderr";
160
- chunk: string;
259
+ type: "run";
260
+ app: string;
261
+ generation: number;
262
+ phase: "completed";
263
+ code: number;
264
+ durationMs?: number;
161
265
  } | {
266
+ type: "run";
267
+ app: string;
268
+ generation: number;
269
+ phase: "failed";
270
+ reason: string;
271
+ };
272
+ /**
273
+ * Workload output does NOT travel this channel, in either mode — it goes over the
274
+ * byte channel (`/io`), which exists precisely because per-chunk events are
275
+ * wasteful for high-volume output. The `stdout` / `stderr` variants that used to
276
+ * be declared here were emitted by nothing: a contract in shape only.
277
+ */
278
+ export type RunEvent = {
162
279
  type: "status";
163
280
  status: RunStatus;
164
- } | {
281
+ }
282
+ /** `app` is absent for session-scoped provisioning (scheduling, image pull) and
283
+ * present once the message belongs to one application. */
284
+ | {
165
285
  type: "progress";
286
+ app?: string;
166
287
  phase: RunPhase;
167
288
  message: string;
168
289
  done?: boolean;
169
290
  }
170
- /** A frame relayed from the workload's kernel debug stream (kernel event or
171
- * log line). Only emitted when the session was started with `inspect`. */
291
+ /** A frame relayed from one app's kernel debug stream (kernel event or log
292
+ * line). Only emitted when the session was started with `inspect`. */
172
293
  | {
173
294
  type: "debug";
295
+ app: string;
174
296
  frame: DebugFrame;
175
297
  }
176
- /** A reachability transition for one declared port, keyed by port. */
298
+ /** A reachability transition for one declared port of one app. */
177
299
  | {
178
300
  type: "reachability";
301
+ app: string;
179
302
  port: number;
180
303
  state: ReachabilityState;
304
+ } | RunOutcomeEvent
305
+ /** An app's declared port set changed on reload and the runner re-patched the
306
+ * Service and Ingress. Without this the app binds the new port inside the pod
307
+ * and is simply unreachable: no ingress, no error, no event. */
308
+ | {
309
+ type: "endpoints";
310
+ app: string;
311
+ added?: RunnerEndpoint[];
312
+ removed?: RunnerEndpoint[];
313
+ /** A declared port that could not be routed (it collides with another app
314
+ * in this session). Reported, never dropped. */
315
+ rejected?: Array<{
316
+ port: number;
317
+ reason: string;
318
+ }>;
181
319
  };
320
+ /**
321
+ * Terminal = the session is over and the registry may schedule eviction.
322
+ * `suspended` is deliberately NOT terminal: the session record and its workspace
323
+ * checkpoint outlive the pod, and `resume` brings it back under the same id.
324
+ */
182
325
  export declare function isTerminal(status: RunStatus): boolean;
326
+ /**
327
+ * Which stream a byte-channel chunk came from. Under `io: "tty"` every chunk is
328
+ * `tty` — the tag never asserts a split that does not exist, which is exactly the
329
+ * failure the deleted `stdout` / `stderr` run events represented.
330
+ */
331
+ export type ByteStreamTag = "tty" | "stdout" | "stderr";
332
+ /** One file in a workspace snapshot: its path and the sha256 of its bytes.
333
+ * Hashing content — rather than comparing sizes or timestamps — is what makes
334
+ * two snapshots diff into an exact change set. */
335
+ export interface WorkspaceFileEntry {
336
+ path: string;
337
+ hash: string;
338
+ }
339
+ export interface WorkspaceTree {
340
+ files: WorkspaceFileEntry[];
341
+ }
342
+ /**
343
+ * An explicit write/delete list rather than a whole-tree PUT: a deletion has to
344
+ * be expressible, and a whole-tree PUT can only express it by treating absence as
345
+ * intent. A one-file save is a change set of one — there is deliberately no
346
+ * single-file write route, which would be a second set of concurrency rules.
347
+ */
348
+ export interface WorkspaceChangeSet {
349
+ write?: Array<{
350
+ path: string;
351
+ content: string;
352
+ encoding?: "utf8" | "base64";
353
+ }>;
354
+ delete?: string[];
355
+ }
356
+ export interface WorkspaceApplyResult {
357
+ written: number;
358
+ deleted: number;
359
+ }
360
+ /** One file of a checkpoint — a tree entry plus the bytes needed to re-seed a
361
+ * fresh pod. Text stays `utf8`; anything that is not valid text is carried
362
+ * `base64`, so a binary asset survives a suspend/resume round trip. */
363
+ export interface WorkspaceCheckpointFile extends WorkspaceFileEntry {
364
+ content: string;
365
+ encoding: "utf8" | "base64";
366
+ }
183
367
  /**
184
368
  * Stages a session start can fail at. The docker/k8s backends share the
185
369
  * vocabulary; not every stage applies to every backend (`pull`/`inspect` are
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","s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