@mono-agent/operator-adapter 0.15.2 → 0.15.3

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.
@@ -0,0 +1,28 @@
1
+ import type { JsonEnvFieldSpec, RedactedSecretValue, SettingsJson } from "@mono-agent/agent-contracts";
2
+ export interface LiveAdapterConfig {
3
+ readonly enabled: boolean;
4
+ readonly host: string;
5
+ readonly port: number;
6
+ readonly basePath: string;
7
+ readonly allowNonLoopback: boolean;
8
+ readonly apiKey?: string;
9
+ }
10
+ export interface RedactedLiveAdapterConfig extends Omit<LiveAdapterConfig, "apiKey"> {
11
+ readonly apiKey: RedactedSecretValue;
12
+ }
13
+ export interface LoadLiveAdapterConfigInput {
14
+ readonly env: Record<string, string | undefined>;
15
+ readonly json?: SettingsJson;
16
+ readonly jsonPath?: string;
17
+ }
18
+ export declare function loadLiveAdapterConfig(input: LoadLiveAdapterConfigInput): Promise<LiveAdapterConfig>;
19
+ export declare function redactLiveAdapterConfig(config: LiveAdapterConfig): RedactedLiveAdapterConfig;
20
+ /**
21
+ * The `live` section's field registry: the single source of truth for JSON→env
22
+ * layering and the app's config provenance view. The `live.apiKey` id doubles as
23
+ * a cross-package contract — `@mono-agent/session-web` resolves a running
24
+ * agent's key by reading this field from the agent's config file (the registry
25
+ * carries no secrets).
26
+ */
27
+ export declare const LIVE_CONFIG_FIELDS: readonly JsonEnvFieldSpec[];
28
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/live/config.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAKvG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,yBAA0B,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,CAAC;IAClF,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAC;CACtC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAcD,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,iBAAiB,CAAC,CAoB5B;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,iBAAiB,GAAG,yBAAyB,CAS5F;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,gBAAgB,EAOzD,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { fieldSpecMappings, layerJsonOntoEnv, normalizeOptionalString, readBoolean, readInteger, readJsonSection, readSettingsJson, readString, redactedSecret, } from "@mono-agent/agent-contracts";
2
+ import { DEFAULT_LIVE_BASE_PATH, DEFAULT_LIVE_HOST, DEFAULT_LIVE_PORT } from "./constants.js";
3
+ import { LiveAdapterError } from "./errors.js";
4
+ /**
5
+ * Like the TUI endpoint (and unlike every chat channel, default OFF), the live
6
+ * event relay is ON by default: it is a read-only operator surface, binds
7
+ * loopback-only on an ephemeral port, and needs no credentials — so read-only
8
+ * consumers such as `@mono-agent/session-web` can observe any running agent
9
+ * without a per-agent config edit. Set `"live": { "enabled": false }` to opt out.
10
+ */
11
+ const DEFAULT_ENABLED = true;
12
+ const invalidConfig = (message, details) => new LiveAdapterError("invalid_config", message, details);
13
+ export async function loadLiveAdapterConfig(input) {
14
+ const json = input.json ?? (input.jsonPath === undefined ? {} : (await readSettingsJson(input.jsonPath)).json);
15
+ const env = layerLiveJsonOntoEnv(json, input.env);
16
+ const apiKey = normalizeOptionalString(env.MONO_AGENT_LIVE_API_KEY);
17
+ return {
18
+ enabled: readBoolean(env.MONO_AGENT_LIVE_ENABLED, "MONO_AGENT_LIVE_ENABLED", DEFAULT_ENABLED, invalidConfig),
19
+ host: readString(env.MONO_AGENT_LIVE_HOST, DEFAULT_LIVE_HOST),
20
+ port: readInteger(env.MONO_AGENT_LIVE_PORT, "MONO_AGENT_LIVE_PORT", DEFAULT_LIVE_PORT, invalidConfig, {
21
+ min: 0,
22
+ max: 65535,
23
+ }),
24
+ basePath: readBasePath(env.MONO_AGENT_LIVE_BASE_PATH),
25
+ allowNonLoopback: readBoolean(env.MONO_AGENT_LIVE_ALLOW_NON_LOOPBACK, "MONO_AGENT_LIVE_ALLOW_NON_LOOPBACK", false, invalidConfig),
26
+ ...(apiKey === undefined ? {} : { apiKey }),
27
+ };
28
+ }
29
+ export function redactLiveAdapterConfig(config) {
30
+ return {
31
+ enabled: config.enabled,
32
+ host: config.host,
33
+ port: config.port,
34
+ basePath: config.basePath,
35
+ allowNonLoopback: config.allowNonLoopback,
36
+ apiKey: redactedSecret(config.apiKey),
37
+ };
38
+ }
39
+ /**
40
+ * The `live` section's field registry: the single source of truth for JSON→env
41
+ * layering and the app's config provenance view. The `live.apiKey` id doubles as
42
+ * a cross-package contract — `@mono-agent/session-web` resolves a running
43
+ * agent's key by reading this field from the agent's config file (the registry
44
+ * carries no secrets).
45
+ */
46
+ export const LIVE_CONFIG_FIELDS = [
47
+ { id: "live.enabled", env: "MONO_AGENT_LIVE_ENABLED", kind: "boolean", fromJson: (s) => s.enabled },
48
+ { id: "live.host", env: "MONO_AGENT_LIVE_HOST", fromJson: (s) => s.host },
49
+ { id: "live.port", env: "MONO_AGENT_LIVE_PORT", kind: "integer", fromJson: (s) => s.port },
50
+ { id: "live.basePath", env: "MONO_AGENT_LIVE_BASE_PATH", fromJson: (s) => s.basePath },
51
+ { id: "live.allowNonLoopback", env: "MONO_AGENT_LIVE_ALLOW_NON_LOOPBACK", kind: "boolean", fromJson: (s) => s.allowNonLoopback },
52
+ { id: "live.apiKey", env: "MONO_AGENT_LIVE_API_KEY", secret: true, fromJson: (s) => s.apiKey },
53
+ ];
54
+ function layerLiveJsonOntoEnv(json, env) {
55
+ return layerJsonOntoEnv(env, fieldSpecMappings(readJsonSection(json, "live"), LIVE_CONFIG_FIELDS));
56
+ }
57
+ function readBasePath(raw) {
58
+ const value = readString(raw, DEFAULT_LIVE_BASE_PATH);
59
+ if (!isLiteralBasePath(value)) {
60
+ throw invalidConfig("MONO_AGENT_LIVE_BASE_PATH must be an absolute literal path made of slash-separated URL path segments.");
61
+ }
62
+ const stripped = value.replace(/\/+$/u, "");
63
+ return stripped.length === 0 ? "/" : stripped;
64
+ }
65
+ function isLiteralBasePath(basePath) {
66
+ return basePath === "/" || /^\/[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*\/?$/u.test(basePath);
67
+ }
68
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/live/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,cAAc,GACf,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAqB/C;;;;;;GAMG;AACH,MAAM,eAAe,GAAG,IAAI,CAAC;AAE7B,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,OAAi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AAG,EAAE,iBAAiB,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACrG,CAAC;AAED,SAAS,YAAY,CAAC,GAAuB;IAC3C,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,sBAAsB,CAAC,CAAC;IACtD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9B,MAAM,aAAa,CAAC,uGAAuG,CAAC,CAAC;IAC/H,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAC5C,OAAO,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC;AAChD,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACzC,OAAO,QAAQ,KAAK,GAAG,IAAI,iDAAiD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9F,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Loopback-only default bind host — the adapter refuses non-loopback unless explicitly allowed. */
2
+ export declare const DEFAULT_LIVE_HOST = "127.0.0.1";
3
+ /** Default TCP port. `0` lets the OS pick a free ephemeral port (read back from the handle's baseUrl). */
4
+ export declare const DEFAULT_LIVE_PORT = 0;
5
+ /** Default URL prefix under which the adapter mounts `/v1/info` and `/v1/events`. */
6
+ export declare const DEFAULT_LIVE_BASE_PATH = "/live";
7
+ /**
8
+ * Schema tag surfaced by GET /v1/info so a discovery probe can identify the
9
+ * adapter and its wire version before subscribing to the event stream.
10
+ */
11
+ export declare const LIVE_ADAPTER_INFO_SCHEMA = "live-adapter.v1";
12
+ /**
13
+ * Interval between SSE heartbeat comment lines (`: ping\n\n`). Heartbeats keep
14
+ * idle proxies/clients from dropping the connection between runs; the comment
15
+ * form carries no data and is ignored by SSE parsers.
16
+ */
17
+ export declare const LIVE_HEARTBEAT_INTERVAL_MS = 15000;
18
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/live/constants.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAE7C,0GAA0G;AAC1G,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,qFAAqF;AACrF,eAAO,MAAM,sBAAsB,UAAU,CAAC;AAE9C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,oBAAoB,CAAC;AAE1D;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAS,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** Loopback-only default bind host — the adapter refuses non-loopback unless explicitly allowed. */
2
+ export const DEFAULT_LIVE_HOST = "127.0.0.1";
3
+ /** Default TCP port. `0` lets the OS pick a free ephemeral port (read back from the handle's baseUrl). */
4
+ export const DEFAULT_LIVE_PORT = 0;
5
+ /** Default URL prefix under which the adapter mounts `/v1/info` and `/v1/events`. */
6
+ export const DEFAULT_LIVE_BASE_PATH = "/live";
7
+ /**
8
+ * Schema tag surfaced by GET /v1/info so a discovery probe can identify the
9
+ * adapter and its wire version before subscribing to the event stream.
10
+ */
11
+ export const LIVE_ADAPTER_INFO_SCHEMA = "live-adapter.v1";
12
+ /**
13
+ * Interval between SSE heartbeat comment lines (`: ping\n\n`). Heartbeats keep
14
+ * idle proxies/clients from dropping the connection between runs; the comment
15
+ * form carries no data and is ignored by SSE parsers.
16
+ */
17
+ export const LIVE_HEARTBEAT_INTERVAL_MS = 15_000;
18
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/live/constants.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAW,CAAC;AAE7C,0GAA0G;AAC1G,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAEnC,qFAAqF;AACrF,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,iBAAiB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,MAAM,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { CodedError } from "@mono-agent/agent-contracts";
2
+ export type LiveAdapterErrorCode = "invalid_config" | "unsafe_host" | "start_failed";
3
+ export interface LiveAdapterErrorDetails {
4
+ readonly code?: LiveAdapterErrorCode;
5
+ readonly reason?: string;
6
+ readonly [key: string]: unknown;
7
+ }
8
+ export declare class LiveAdapterError extends CodedError<LiveAdapterErrorCode> {
9
+ readonly details: LiveAdapterErrorDetails;
10
+ constructor(code: LiveAdapterErrorCode, message: string, details?: LiveAdapterErrorDetails);
11
+ }
12
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/live/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,aAAa,GACb,cAAc,CAAC;AAEnB,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC;IACrC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,qBAAa,gBAAiB,SAAQ,UAAU,CAAC,oBAAoB,CAAC;IACpE,SAAiB,OAAO,EAAE,uBAAuB,CAAC;gBAGhD,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,uBAA4B;CAIxC"}
@@ -0,0 +1,7 @@
1
+ import { CodedError } from "@mono-agent/agent-contracts";
2
+ export class LiveAdapterError extends CodedError {
3
+ constructor(code, message, details = {}) {
4
+ super(code, message, details);
5
+ }
6
+ }
7
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/live/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAazD,MAAM,OAAO,gBAAiB,SAAQ,UAAgC;IAGpE,YACE,IAA0B,EAC1B,OAAe,EACf,UAAmC,EAAE;QAErC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export { startLiveAdapter } from "./server.js";
2
+ export type { LiveAdapterHandle, LiveAdapterLogger, LiveAdapterOptions, } from "./server.js";
3
+ export { LiveAdapterError } from "./errors.js";
4
+ export type { LiveAdapterErrorCode, LiveAdapterErrorDetails } from "./errors.js";
5
+ export { loadLiveAdapterConfig, redactLiveAdapterConfig, LIVE_CONFIG_FIELDS } from "./config.js";
6
+ export type { LiveAdapterConfig, RedactedLiveAdapterConfig, LoadLiveAdapterConfigInput, } from "./config.js";
7
+ export { DEFAULT_LIVE_BASE_PATH, DEFAULT_LIVE_HOST, DEFAULT_LIVE_PORT, LIVE_ADAPTER_INFO_SCHEMA, LIVE_HEARTBEAT_INTERVAL_MS, } from "./constants.js";
8
+ export { LIVE_EVENT_SCHEMA, createLiveEventBus } from "@mono-agent/agent-contracts";
9
+ export type { CreateLiveEventBusOptions, RunEventBus, RunEventFrame, RunEventSink, } from "@mono-agent/agent-contracts";
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/live/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjG,YAAY,EACV,iBAAiB,EACjB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACpF,YAAY,EACV,yBAAyB,EACzB,WAAW,EACX,aAAa,EACb,YAAY,GACb,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { startLiveAdapter } from "./server.js";
2
+ export { LiveAdapterError } from "./errors.js";
3
+ export { loadLiveAdapterConfig, redactLiveAdapterConfig, LIVE_CONFIG_FIELDS } from "./config.js";
4
+ export { DEFAULT_LIVE_BASE_PATH, DEFAULT_LIVE_HOST, DEFAULT_LIVE_PORT, LIVE_ADAPTER_INFO_SCHEMA, LIVE_HEARTBEAT_INTERVAL_MS, } from "./constants.js";
5
+ // Re-export the shared live-event contract + the in-process bus factory (both live
6
+ // in core) so consumers can build/type producers and subscribers from one import.
7
+ export { LIVE_EVENT_SCHEMA, createLiveEventBus } from "@mono-agent/agent-contracts";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/live/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAM/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAMjG,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AAExB,mFAAmF;AACnF,kFAAkF;AAClF,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type RunEventBus } from "@mono-agent/agent-contracts";
2
+ export interface LiveAdapterLogger {
3
+ debug?(message: string, metadata?: Record<string, unknown>): void;
4
+ info?(message: string, metadata?: Record<string, unknown>): void;
5
+ warn?(message: string, metadata?: Record<string, unknown>): void;
6
+ error?(message: string, metadata?: Record<string, unknown>): void;
7
+ }
8
+ export interface LiveAdapterOptions {
9
+ /** In-process bus the adapter subscribes to and replays. Read-only — never written. */
10
+ readonly bus: RunEventBus;
11
+ readonly host?: string;
12
+ readonly port?: number;
13
+ readonly basePath?: string;
14
+ readonly allowNonLoopback?: boolean;
15
+ /** When set, both routes require `Authorization: Bearer <apiKey>`; a mismatch is a 401. */
16
+ readonly apiKey?: string;
17
+ /** Human label surfaced by GET /v1/info so a discovery probe can name the instance. */
18
+ readonly label?: string;
19
+ /**
20
+ * Invoked when the already-listening HTTP server dies (e.g. a socket-level
21
+ * failure appearing later). The hosting channel driver maps this to its
22
+ * onFailure hook so the channel flips to "failed" instead of silently serving
23
+ * nothing.
24
+ */
25
+ readonly onServerError?: (reason: string) => void;
26
+ readonly logger?: LiveAdapterLogger;
27
+ }
28
+ export interface LiveAdapterHandle {
29
+ /** SSE root: `http://<host>:<actualPort><basePath>`. `/v1/events` and `/v1/info` hang off it. */
30
+ readonly baseUrl: string;
31
+ /** Tear down every open SSE connection and close the HTTP server. */
32
+ stop(): Promise<void>;
33
+ }
34
+ /**
35
+ * Start a loopback, read-only SSE server that relays a {@link RunEventBus} to
36
+ * operator surfaces. It observes only: there is no turn-driving endpoint and no
37
+ * reference to a responder.
38
+ */
39
+ export declare function startLiveAdapter(options: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CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,iBAAiB,CAAC;CACrC;AAED,MAAM,WAAW,iBAAiB;IAChC,iGAAiG;IACjG,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,qEAAqE;IACrE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AASD;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyM9F"}
@@ -0,0 +1,234 @@
1
+ import { createServer } from "node:http";
2
+ import { DEFAULT_RUN_EVENT_MAX_FRAME_BYTES } from "@mono-agent/agent-contracts";
3
+ import { assertSafeBind, bearerTokensEqual, close, hostForUrl, isLoopbackHost, listen, normalizeOptionalString, readAuthorizationBearer, } from "@mono-agent/agent-contracts";
4
+ import express, {} from "express";
5
+ import { DEFAULT_LIVE_BASE_PATH, DEFAULT_LIVE_HOST, DEFAULT_LIVE_PORT, LIVE_ADAPTER_INFO_SCHEMA, LIVE_HEARTBEAT_INTERVAL_MS, } from "./constants.js";
6
+ import { LiveAdapterError } from "./errors.js";
7
+ const MAX_SSE_QUEUE_FRAMES = 1_000;
8
+ const FRAME_ENCODER = new TextEncoder();
9
+ /**
10
+ * Start a loopback, read-only SSE server that relays a {@link RunEventBus} to
11
+ * operator surfaces. It observes only: there is no turn-driving endpoint and no
12
+ * reference to a responder.
13
+ */
14
+ export async function startLiveAdapter(options) {
15
+ if (options.bus === undefined || typeof options.bus.subscribe !== "function") {
16
+ throw new LiveAdapterError("invalid_config", "startLiveAdapter requires a RunEventBus.");
17
+ }
18
+ const host = options.host ?? DEFAULT_LIVE_HOST;
19
+ const port = options.port ?? DEFAULT_LIVE_PORT;
20
+ const basePath = normalizeBasePath(options.basePath ?? DEFAULT_LIVE_BASE_PATH);
21
+ const apiKey = normalizeOptionalString(options.apiKey);
22
+ const label = normalizeOptionalString(options.label);
23
+ assertSafeBind(host, options.allowNonLoopback === true, (boundHost) => new LiveAdapterError("unsafe_host", "Live adapter refuses to bind a non-loopback host unless allowNonLoopback is true.", { host: boundHost }));
24
+ const app = express();
25
+ const server = createServer(app);
26
+ const infoPath = `${basePath}/v1/info`;
27
+ const eventsPath = `${basePath}/v1/events`;
28
+ const connections = new Set();
29
+ app.get(infoPath, (req, res) => {
30
+ if (!authorize(req, res, apiKey)) {
31
+ return;
32
+ }
33
+ res.status(200).json({
34
+ schema: LIVE_ADAPTER_INFO_SCHEMA,
35
+ pid: process.pid,
36
+ ...(label === undefined ? {} : { label }),
37
+ });
38
+ });
39
+ app.get(eventsPath, (req, res) => {
40
+ if (!authorize(req, res, apiKey)) {
41
+ return;
42
+ }
43
+ handleEvents(res);
44
+ });
45
+ const address = await listen(server, port, host, {
46
+ listenFailed: (reason) => new LiveAdapterError("start_failed", "Live adapter failed to listen.", { reason }),
47
+ noAddress: () => new LiveAdapterError("start_failed", "Live adapter did not receive a TCP address."),
48
+ });
49
+ async function closeRejectedServer() {
50
+ for (const connection of [...connections]) {
51
+ connection.teardown();
52
+ if (!connection.res.writableEnded) {
53
+ connection.res.end();
54
+ }
55
+ }
56
+ connections.clear();
57
+ await close(server);
58
+ }
59
+ const boundNonLoopback = !isLoopbackHost(address.address);
60
+ if (boundNonLoopback && options.allowNonLoopback !== true) {
61
+ await closeRejectedServer();
62
+ throw new LiveAdapterError("unsafe_host", "Live adapter resolved a loopback host to a non-loopback bind address.", { host, boundAddress: address.address, boundPort: address.port });
63
+ }
64
+ server.on("error", (error) => {
65
+ options.onServerError?.(errorToMessage(error));
66
+ });
67
+ const baseUrl = `http://${hostForUrl(host)}:${address.port}${basePath}`;
68
+ function handleEvents(res) {
69
+ // SSE handshake. Mirror the openai-api-adapter header set; disable Nagle so
70
+ // each frame flushes immediately, and flush headers before subscribing so
71
+ // the client sees the stream open promptly.
72
+ res.status(200);
73
+ res.setHeader("Content-Type", "text/event-stream");
74
+ res.setHeader("Cache-Control", "no-cache, no-transform");
75
+ res.setHeader("Connection", "keep-alive");
76
+ res.setHeader("X-Accel-Buffering", "no");
77
+ res.socket?.setNoDelay(true);
78
+ res.flushHeaders();
79
+ const queue = [];
80
+ let draining = false;
81
+ let closed = false;
82
+ let teardown;
83
+ const flush = () => {
84
+ while (!closed && !draining && queue.length > 0) {
85
+ const payload = queue.shift();
86
+ if (payload === undefined) {
87
+ break;
88
+ }
89
+ if (res.writableEnded) {
90
+ closed = true;
91
+ return;
92
+ }
93
+ const ok = res.write(payload);
94
+ if (!ok) {
95
+ draining = true;
96
+ res.once("drain", () => {
97
+ draining = false;
98
+ flush();
99
+ });
100
+ return;
101
+ }
102
+ }
103
+ };
104
+ const closeSlowClient = () => {
105
+ if (closed) {
106
+ return;
107
+ }
108
+ options.logger?.warn?.("Closing slow live SSE client after queue overflow.", {
109
+ queuedFrames: queue.length,
110
+ maxQueuedFrames: MAX_SSE_QUEUE_FRAMES,
111
+ });
112
+ teardown?.();
113
+ closed = true;
114
+ queue.length = 0;
115
+ if (!res.writableEnded) {
116
+ res.end();
117
+ }
118
+ };
119
+ const enqueue = (payload) => {
120
+ if (closed || res.writableEnded) {
121
+ return;
122
+ }
123
+ queue.push(payload);
124
+ if (queue.length > MAX_SSE_QUEUE_FRAMES) {
125
+ closeSlowClient();
126
+ return;
127
+ }
128
+ flush();
129
+ };
130
+ const write = (frame) => {
131
+ const payload = serializeFrame(frame, options.logger);
132
+ if (payload !== undefined) {
133
+ enqueue(payload);
134
+ }
135
+ };
136
+ // Replay the ring buffer (oldest-first) so a late joiner can reconstruct
137
+ // in-flight runs, then stream every subsequent frame the same way.
138
+ for (const frame of options.bus.recentFrames()) {
139
+ write(frame);
140
+ }
141
+ if (closed) {
142
+ return;
143
+ }
144
+ const unsubscribe = options.bus.subscribe(write);
145
+ const heartbeat = setInterval(() => {
146
+ if (closed || draining || res.writableEnded) {
147
+ return;
148
+ }
149
+ enqueue(": ping\n\n");
150
+ }, LIVE_HEARTBEAT_INTERVAL_MS);
151
+ // Never keep the process alive solely for the heartbeat timer.
152
+ heartbeat.unref?.();
153
+ let torn = false;
154
+ teardown = () => {
155
+ if (torn) {
156
+ return;
157
+ }
158
+ torn = true;
159
+ closed = true;
160
+ clearInterval(heartbeat);
161
+ unsubscribe();
162
+ queue.length = 0;
163
+ };
164
+ const connection = { res, teardown };
165
+ connections.add(connection);
166
+ res.once("close", () => {
167
+ connections.delete(connection);
168
+ teardown();
169
+ });
170
+ }
171
+ return {
172
+ baseUrl,
173
+ async stop() {
174
+ // SSE connections never end on their own, so `server.close()` would hang
175
+ // waiting for them — tear each down and end the response first.
176
+ for (const connection of [...connections]) {
177
+ connection.teardown();
178
+ if (!connection.res.writableEnded) {
179
+ connection.res.end();
180
+ }
181
+ }
182
+ connections.clear();
183
+ await close(server);
184
+ },
185
+ };
186
+ }
187
+ function authorize(req, res, apiKey) {
188
+ if (apiKey === undefined) {
189
+ return true;
190
+ }
191
+ const presented = readAuthorizationBearer(req.header("authorization"));
192
+ if (presented !== undefined && bearerTokensEqual(presented, apiKey)) {
193
+ return true;
194
+ }
195
+ res.status(401).json({ error: { message: "Invalid API key.", code: "invalid_api_key" } });
196
+ return false;
197
+ }
198
+ function errorToMessage(error) {
199
+ if (error instanceof Error && error.message.length > 0) {
200
+ return error.message;
201
+ }
202
+ return String(error);
203
+ }
204
+ function normalizeBasePath(basePath) {
205
+ if (!isLiteralBasePath(basePath)) {
206
+ throw new LiveAdapterError("invalid_config", "basePath must be an absolute literal path made of slash-separated URL path segments.");
207
+ }
208
+ return basePath.length === 1 ? "" : basePath.replace(/\/+$/u, "");
209
+ }
210
+ function serializeFrame(frame, logger) {
211
+ try {
212
+ // JSON.stringify is single-line, so the only newlines are the SSE terminator.
213
+ const json = JSON.stringify(frame);
214
+ if (FRAME_ENCODER.encode(json).length > DEFAULT_RUN_EVENT_MAX_FRAME_BYTES) {
215
+ logger?.warn?.("Dropped oversized live event frame.", {
216
+ maxFrameBytes: DEFAULT_RUN_EVENT_MAX_FRAME_BYTES,
217
+ runId: "runId" in frame ? frame.runId : undefined,
218
+ });
219
+ return undefined;
220
+ }
221
+ return `data: ${json}\n\n`;
222
+ }
223
+ catch (error) {
224
+ logger?.warn?.("Dropped unserializable live event frame.", {
225
+ reason: error instanceof Error ? error.message : String(error),
226
+ runId: "runId" in frame ? frame.runId : undefined,
227
+ });
228
+ return undefined;
229
+ }
230
+ }
231
+ function isLiteralBasePath(basePath) {
232
+ return basePath === "/" || /^\/[A-Za-z0-9._~-]+(?:\/[A-Za-z0-9._~-]+)*\/?$/u.test(basePath);
233
+ }
234
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/live/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,EAAE,iCAAiC,EAAwC,MAAM,6BAA6B,CAAC;AACtH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,KAAK,EACL,UAAU,EACV,cAAc,EACd,MAAM,EACN,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,OAAO,EAAE,EAA+B,MAAM,SAAS,CAAC;AAE/D,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,aAAa,GAAG,IAAI,WAAW,EAAE,CAAC;AA4CxC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAA2B;IAChE,IAAI,OAAO,CAAC,GAAG,KAAK,SAAS,IAAI,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,KAAK,UAAU,EAAE,CAAC;QAC7E,MAAM,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,0CAA0C,CAAC,CAAC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,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9F,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mono-agent/operator-adapter",
3
- "version": "0.15.2",
3
+ "version": "0.15.3",
4
4
  "description": "Loopback operator adapter for mono-agent structured TUI and web NDJSON turns.",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-only",
@@ -26,7 +26,7 @@
26
26
  "README.md"
27
27
  ],
28
28
  "dependencies": {
29
- "@mono-agent/agent-contracts": "0.15.2",
29
+ "@mono-agent/agent-contracts": "0.15.3",
30
30
  "express": "^5.1.0"
31
31
  },
32
32
  "devDependencies": {