c8ctl-plugin-nano 1.54.0 → 1.55.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.
- package/agentic-endpoint.mjs +219 -231
- package/agentic.mjs +18 -0
- package/package.json +11 -10
- package/supervisor-log-ring.mjs +162 -0
- package/supervisor.dist.js +9 -9
- package/work-relay.mjs +8 -19
package/work-relay.mjs
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
// a duck-typed terminal handle, so it is unit-testable with a fake terminal and
|
|
24
24
|
// a fake channel.
|
|
25
25
|
|
|
26
|
-
import { transcript as agenticTranscript } from './agentic.mjs';
|
|
26
|
+
import { transcript as agenticTranscript, composeStreamId } from './agentic.mjs';
|
|
27
27
|
|
|
28
28
|
/** Prefix for a per-job relay stream name. One stream carries a job's terminal. */
|
|
29
29
|
export const RELAY_STREAM_PREFIX = 'job:';
|
|
@@ -310,23 +310,6 @@ export function createRelaySession({
|
|
|
310
310
|
return { stream, relay, attachSteer, close };
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
/**
|
|
314
|
-
* The canonical host-connection transcript stream name for a supervised job
|
|
315
|
-
* (issue #173). Unlike {@link relayStreamName} (which keys purely on the
|
|
316
|
-
* jobKey, safe only when one process owns one identity), the single host
|
|
317
|
-
* connection multiplexes N workers, so the stream carries BOTH the owning
|
|
318
|
-
* `instance` and the `jobKey` explicitly — two workers' (or two jobs') streams
|
|
319
|
-
* over the one socket can never collide. Mirrors the endpoint's own
|
|
320
|
-
* `composeTranscriptStream`, exposed here only for observability/parity.
|
|
321
|
-
*
|
|
322
|
-
* @param {string} instance the owning worker instance
|
|
323
|
-
* @param {string|number} jobKey the activated job's key
|
|
324
|
-
* @returns {string}
|
|
325
|
-
*/
|
|
326
|
-
export function hostRelayStreamName(instance, jobKey) {
|
|
327
|
-
return `t/${encodeURIComponent(String(instance))}/${encodeURIComponent(String(jobKey))}`;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
313
|
/**
|
|
331
314
|
* Create a per-job relay session backed by the single-owner supervisor's ONE
|
|
332
315
|
* multiplexed host connection (issue #173) instead of a per-worker
|
|
@@ -369,7 +352,13 @@ export function createHostRelaySession({ instance, jobKey, publish, subscribeSte
|
|
|
369
352
|
if (typeof publish !== 'function') {
|
|
370
353
|
throw new Error('createHostRelaySession requires a publish(text) sink');
|
|
371
354
|
}
|
|
372
|
-
|
|
355
|
+
// The canonical host-connection transcript stream id for this supervised job:
|
|
356
|
+
// the single connection multiplexes N workers, so the id carries BOTH the
|
|
357
|
+
// owning `instance` and the `jobKey` explicitly (the injective `composeStreamId`
|
|
358
|
+
// codec — `stream = String(jobKey)`), so two workers' (or two jobs') streams
|
|
359
|
+
// over the one socket can never collide. Used here for observability/logging;
|
|
360
|
+
// the actual wire id is composed by the emit client at emit time.
|
|
361
|
+
const stream = composeStreamId(String(instance), String(jobKey));
|
|
373
362
|
const log = logger || {};
|
|
374
363
|
|
|
375
364
|
const relay = (chunk) => {
|