@descryy/runtime-orchestrator 0.4.0 → 0.4.2

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.
@@ -18,6 +18,7 @@
18
18
  * Disclosed, not solved, same as `readiness.ts`.
19
19
  */
20
20
  import type { ProcessOutputSource } from "@descryy/runtime-backend-observation";
21
+ import { type AttachFence } from "@descryy/runtime-controller";
21
22
  export interface AttachToRunningProcessOptions {
22
23
  readonly processId: string;
23
24
  /** The pid of the already-running target. Verified alive before attaching, and re-checked on every poll to detect exit. */
@@ -48,6 +49,17 @@ export interface AttachToRunningProcessOptions {
48
49
  * purpose. Any other error is treated as "exists" rather than guessed away.
49
50
  */
50
51
  export declare function isProcessAlive(pid: number): boolean;
52
+ /**
53
+ * `attachToRunningProcess`'s return value: a `ProcessOutputSource` (structurally
54
+ * unchanged, so every existing consumer keeps working unmodified) plus the
55
+ * attach-time fence (RT-N3) that produced its `preExistingLineCount`. Exposed so
56
+ * a caller can disclose it -- the process's own start time, whether some other
57
+ * process also holds the log file open, and the recorded attach offset -- rather
58
+ * than that information existing only internally to this function.
59
+ */
60
+ export interface AttachedProcessOutputSource extends ProcessOutputSource {
61
+ readonly attachFence: AttachFence;
62
+ }
51
63
  /**
52
64
  * Attach to an already-running process via a log file it is already writing to.
53
65
  * Throws immediately if the pid isn't alive — refuses rather than returning a
@@ -55,11 +67,17 @@ export declare function isProcessAlive(pid: number): boolean;
55
67
  *
56
68
  * Lines already in `logFilePath` at attach time are yielded first, followed by
57
69
  * whatever the target writes afterward — indistinguishable from `execute`'s live
58
- * tail once attached.
70
+ * tail once attached, EXCEPT that each pre-existing line carries
71
+ * `ProcessOutputLine.preExisting: true` (RT-N3, `computeAttachFence`) — real,
72
+ * captured evidence, but evidence this run did not watch happen. A consumer that
73
+ * turns these lines into `Evidence` (e.g. `createLogCollector`) is expected to
74
+ * carry that flag through to `Evidence.preExisting`, and a promotion path that
75
+ * would otherwise mint or confirm an R4 graph edge from it must refuse (see
76
+ * `resolveObservedCrossServiceCall`, `@descryy/runtime-graph-correlator`).
59
77
  *
60
78
  * Ends when the caller's window closes or the target exits, whichever comes
61
79
  * first (see `stopObserving`) — both are needed, or a healthy target polls
62
80
  * forever, or a dead one polls until the caller notices.
63
81
  */
64
- export declare function attachToRunningProcess(options: AttachToRunningProcessOptions): ProcessOutputSource;
82
+ export declare function attachToRunningProcess(options: AttachToRunningProcessOptions): AttachedProcessOutputSource;
65
83
  //# sourceMappingURL=attach-to-running-process.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attach-to-running-process.d.ts","sourceRoot":"","sources":["../src/attach-to-running-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAIhF,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2HAA2H;IAC3H,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2LAA2L;IAC3L,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,mBAAmB,CA2BlG"}
1
+ {"version":3,"file":"attach-to-running-process.d.ts","sourceRoot":"","sources":["../src/attach-to-running-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAInF,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,2HAA2H;IAC3H,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,2LAA2L;IAC3L,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC;IACtC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOnD;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACnC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,6BAA6B,GAAG,2BAA2B,CAkC1G"}
@@ -18,6 +18,7 @@
18
18
  * Disclosed, not solved, same as `readiness.ts`.
19
19
  */
20
20
  import { readFileSync } from "node:fs";
21
+ import { computeAttachFence } from "@descryy/runtime-controller";
21
22
  import { createPollingProcessOutputSource } from "./polling-output-source.js";
22
23
  /**
23
24
  * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether
@@ -41,7 +42,13 @@ export function isProcessAlive(pid) {
41
42
  *
42
43
  * Lines already in `logFilePath` at attach time are yielded first, followed by
43
44
  * whatever the target writes afterward — indistinguishable from `execute`'s live
44
- * tail once attached.
45
+ * tail once attached, EXCEPT that each pre-existing line carries
46
+ * `ProcessOutputLine.preExisting: true` (RT-N3, `computeAttachFence`) — real,
47
+ * captured evidence, but evidence this run did not watch happen. A consumer that
48
+ * turns these lines into `Evidence` (e.g. `createLogCollector`) is expected to
49
+ * carry that flag through to `Evidence.preExisting`, and a promotion path that
50
+ * would otherwise mint or confirm an R4 graph edge from it must refuse (see
51
+ * `resolveObservedCrossServiceCall`, `@descryy/runtime-graph-correlator`).
45
52
  *
46
53
  * Ends when the caller's window closes or the target exits, whichever comes
47
54
  * first (see `stopObserving`) — both are needed, or a healthy target polls
@@ -52,7 +59,8 @@ export function attachToRunningProcess(options) {
52
59
  throw new Error(`attachToRunningProcess: pid ${options.pid} for "${options.processId}" is not running — attach requires ` +
53
60
  `a target that already exists. Use ExecutionController.run() to spawn a new process instead.`);
54
61
  }
55
- return createPollingProcessOutputSource({
62
+ const attachFence = computeAttachFence(options.pid, options.logFilePath);
63
+ const source = createPollingProcessOutputSource({
56
64
  processId: options.processId,
57
65
  // an ad-hoc attach may have no declared service; null is the honest answer
58
66
  serviceName: options.serviceName ?? null,
@@ -68,7 +76,11 @@ export function attachToRunningProcess(options) {
68
76
  // either reason ends the source; dropping the liveness half would leave a
69
77
  // target that dies mid-window polled until the caller noticed
70
78
  isFinished: () => options.stopObserving() || !isProcessAlive(options.pid),
79
+ // RT-N3: everything already in the file at attach time is marked, not
80
+ // discarded -- see `AttachedProcessOutputSource`'s doc.
81
+ preExistingLineCount: attachFence.preExistingLineCount,
71
82
  ...(options.pollIntervalMs !== undefined ? { pollIntervalMs: options.pollIntervalMs } : {}),
72
83
  });
84
+ return { ...source, attachFence };
73
85
  }
74
86
  //# sourceMappingURL=attach-to-running-process.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"attach-to-running-process.js","sourceRoot":"","sources":["../src/attach-to-running-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC,OAAO,EAAE,gCAAgC,EAAE,MAAM,4BAA4B,CAAC;AA0B9E;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,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AAM,CAAC,CAAC;YACnD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,MAAM,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBACtE,MAAM,IAAI,KAAK,CACb,oDAAoD,OAAO,CAAC,WAAW,aAAa,OAAO,CAAC,GAAG,KAAK,MAAM,EAAE,CAC7G,CAAC;YACJ,CAAC;QACH,CAAC;QACD,0EAA0E;QAC1E,8DAA8D;QAC9D,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC;QACzE,sEAAsE;QACtE,wDAAwD;QACxD,oBAAoB,EAAE,WAAW,CAAC,oBAAoB;QACtD,GAAG,CAAC,OAAO,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5F,CAAC,CAAC;IAEH,OAAO,EAAE,GAAG,MAAM,EAAE,WAAW,EAAE,CAAC;AACpC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type { PollingProcessOutputSourceOptions } from "./polling-output-source.ts";
2
2
  export { createPollingProcessOutputSource } from "./polling-output-source.ts";
3
- export type { AttachToRunningProcessOptions } from "./attach-to-running-process.ts";
3
+ export type { AttachToRunningProcessOptions, AttachedProcessOutputSource } from "./attach-to-running-process.ts";
4
4
  export { attachToRunningProcess, isProcessAlive } from "./attach-to-running-process.ts";
5
5
  export type { AttachToRunningNodeProcessOptions } from "./attach-to-running-node-process.ts";
6
6
  export { attachToRunningNodeProcess, discoverNodeInspectorUrl } from "./attach-to-running-node-process.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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AkC,CAAC"}
@@ -19,6 +19,25 @@ export interface PollingProcessOutputSourceOptions {
19
19
  /** True once the process has exited. Output already buffered is still drained afterwards. */
20
20
  readonly isFinished: () => boolean;
21
21
  readonly pollIntervalMs?: number;
22
+ /**
23
+ * How many of the lines this source will EVER yield already existed in the
24
+ * underlying buffer before observation began — e.g. `attachToRunningProcess`'s
25
+ * attach-time snapshot of an already-running target's log file (RT-N3).
26
+ * Counted in complete (newline-terminated) lines, not bytes: this source
27
+ * already reasons in lines, and byte offsets don't survive UTF-8 decoding
28
+ * cleanly. Default 0 — an ordinary spawned process has no pre-existing
29
+ * backlog. The Nth line this source yields (0-indexed, across BOTH the main
30
+ * loop and the final flush) is marked `preExisting: true` when N is less
31
+ * than this count.
32
+ *
33
+ * One disclosed edge case: a line torn exactly at the attach instant (an
34
+ * unterminated partial already in the file at attach, completed by content
35
+ * written afterward) is counted as NOT pre-existing by this index-based
36
+ * rule, even though its opening bytes are — the same "cannot be made
37
+ * perfectly correct over a plain text file" limit `attachToRunningProcess`
38
+ * documents, not solved here either.
39
+ */
40
+ readonly preExistingLineCount?: number;
22
41
  }
23
42
  export declare function createPollingProcessOutputSource(options: PollingProcessOutputSourceOptions): ProcessOutputSource;
24
43
  //# sourceMappingURL=polling-output-source.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polling-output-source.d.ts","sourceRoot":"","sources":["../src/polling-output-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEtH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gIAAgI;IAChI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,gGAAgG;IAChG,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAID,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,iCAAiC,GAAG,mBAAmB,CAkDhH"}
1
+ {"version":3,"file":"polling-output-source.d.ts","sourceRoot":"","sources":["../src/polling-output-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAwC,KAAK,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAEtH,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,gIAAgI;IAChI,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,gGAAgG;IAChG,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAAC;IAClC,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,EAAE,MAAM,OAAO,CAAC;IACnC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACxC;AAID,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,iCAAiC,GAAG,mBAAmB,CAyDhH"}
@@ -13,12 +13,19 @@ import { LineSplitter } from "@descryy/runtime-backend-observation";
13
13
  const DEFAULT_POLL_INTERVAL_MS = 50;
14
14
  export function createPollingProcessOutputSource(options) {
15
15
  const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
16
+ const preExistingLineCount = options.preExistingLineCount ?? 0;
16
17
  return {
17
18
  processId: options.processId,
18
19
  serviceName: options.serviceName,
19
20
  lines: (async function* () {
20
21
  const splitter = new LineSplitter();
21
22
  let consumed = 0;
23
+ let lineIndex = 0;
24
+ function nextLine(text, observedAt) {
25
+ const preExisting = lineIndex < preExistingLineCount;
26
+ lineIndex++;
27
+ return { text, stream: "combined", observedAt, ...(preExisting ? { preExisting: true } : {}) };
28
+ }
22
29
  for (;;) {
23
30
  const whole = options.readOutput();
24
31
  // Relies on the buffer only ever growing (true of `ManagedProcess` today,
@@ -36,7 +43,7 @@ export function createPollingProcessOutputSource(options) {
36
43
  consumed = whole.length;
37
44
  const observedAt = new Date().toISOString();
38
45
  for (const text of splitter.push(chunk)) {
39
- yield { text, stream: "combined", observedAt };
46
+ yield nextLine(text, observedAt);
40
47
  }
41
48
  // no sleep: a burst of output should drain at memory speed
42
49
  continue;
@@ -45,7 +52,7 @@ export function createPollingProcessOutputSource(options) {
45
52
  const observedAt = new Date().toISOString();
46
53
  // a final unterminated line matters most -- a process dying mid-write
47
54
  for (const text of splitter.flush()) {
48
- yield { text, stream: "combined", observedAt };
55
+ yield nextLine(text, observedAt);
49
56
  }
50
57
  return;
51
58
  }
@@ -1 +1 @@
1
- {"version":3,"file":"polling-output-source.js","sourceRoot":"","sources":["../src/polling-output-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAoD,MAAM,sCAAsC,CAAC;AAatH,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAEpC,MAAM,UAAU,gCAAgC,CAAC,OAA0C;IACzF,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,wBAAwB,CAAC;IAE1E,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,KAAK,EAAE,CAAC,KAAK,SAAS,CAAC;YACrB,MAAM,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;YACpC,IAAI,QAAQ,GAAG,CAAC,CAAC;YAEjB,SAAS,CAAC;gBACR,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;gBAEnC,0EAA0E;gBAC1E,4EAA4E;gBAC5E,8EAA8E;gBAC9E,wEAAwE;gBACxE,wBAAwB;gBACxB,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ,EAAE,CAAC;oBAC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,GAAG,KAAK,CAAC,MAAM,CAAC;oBACxB,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;wBACxC,MAAM,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBACnC,CAAC;oBACD,2DAA2D;oBAC3D,SAAS;gBACX,CAAC;gBAED,IAAI,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;oBACzB,MAAM,UAAU,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;oBAC5C,sEAAsE;oBACtE,KAAK,MAAM,IAAI,IAAI,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC;wBACpC,MAAM,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBACnC,CAAC;oBACD,OAAO;gBACT,CAAC;gBAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;YACtE,CAAC;QACH,CAAC,CAAC,EAAE;KACL,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descryy/runtime-orchestrator",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Assembles the runtime: controller-spawned services, live process output, collectors from a RuntimeAdapter, and a CollectorContext that can resolve script origins to source roots.",
6
6
  "license": "UNLICENSED",
@@ -29,14 +29,14 @@
29
29
  "build": "tsc -b"
30
30
  },
31
31
  "dependencies": {
32
- "@descryy/runtime-contracts": "0.3.0",
33
- "@descryy/runtime-backend-observation": "0.3.0",
34
- "@descryy/runtime-controller": "0.3.0",
35
- "@descryy/runtime-evidence-store": "0.4.0",
36
- "@descryy/runtime-adapter-typescript": "0.3.0",
37
- "@descryy/runtime-environment-profile": "0.4.0",
38
- "@descryy/runtime-remote-log-ingestion": "0.4.0",
39
- "@descryy/runtime-external-service-observation": "0.3.0"
32
+ "@descryy/runtime-contracts": "0.3.1",
33
+ "@descryy/runtime-backend-observation": "0.3.1",
34
+ "@descryy/runtime-controller": "0.3.1",
35
+ "@descryy/runtime-evidence-store": "0.4.1",
36
+ "@descryy/runtime-adapter-typescript": "0.3.1",
37
+ "@descryy/runtime-environment-profile": "0.4.1",
38
+ "@descryy/runtime-remote-log-ingestion": "0.4.1",
39
+ "@descryy/runtime-external-service-observation": "0.3.1"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@descryy/runtime-adapter-csharp": "*",