@ttsc/graph 0.30.4 → 0.31.1
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/README.md +122 -30
- package/lib/CapturedProcessOutput.d.ts +47 -0
- package/lib/CapturedProcessOutput.js +3 -0
- package/lib/CapturedProcessOutput.js.map +1 -0
- package/lib/ILauncherOption.d.ts +22 -0
- package/lib/ILauncherOption.js +3 -0
- package/lib/ILauncherOption.js.map +1 -0
- package/lib/IProjectOptions.d.ts +18 -0
- package/lib/IProjectOptions.js +3 -0
- package/lib/IProjectOptions.js.map +1 -0
- package/lib/ParsedLauncherOptions.d.ts +13 -0
- package/lib/ParsedLauncherOptions.js +3 -0
- package/lib/ParsedLauncherOptions.js.map +1 -0
- package/lib/TtscGraphApplication.d.ts +38 -1
- package/lib/TtscGraphApplication.js +26 -1
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/TtscGraphLauncherArguments.d.ts +115 -0
- package/lib/TtscGraphLauncherArguments.js +181 -0
- package/lib/TtscGraphLauncherArguments.js.map +1 -0
- package/lib/TtscGraphViewSnapshot.d.ts +35 -0
- package/lib/TtscGraphViewSnapshot.js +48 -0
- package/lib/TtscGraphViewSnapshot.js.map +1 -0
- package/lib/index.d.ts +9 -24
- package/lib/index.js +6 -128
- package/lib/index.js.map +1 -1
- package/lib/internal/GraphProcessTrace.d.ts +1 -0
- package/lib/internal/GraphProcessTrace.js +235 -0
- package/lib/internal/GraphProcessTrace.js.map +1 -0
- package/lib/launcherArgs.d.ts +75 -16
- package/lib/launcherArgs.js +77 -8
- package/lib/launcherArgs.js.map +1 -1
- package/lib/model/IArtifactDirectory.d.ts +26 -0
- package/lib/model/IArtifactDirectory.js +3 -0
- package/lib/model/IArtifactDirectory.js.map +1 -0
- package/lib/model/IArtifactInputs.d.ts +19 -0
- package/lib/model/IArtifactInputs.js +3 -0
- package/lib/model/IArtifactInputs.js.map +1 -0
- package/lib/model/IPublishedArtifacts.d.ts +76 -0
- package/lib/model/IPublishedArtifacts.js +3 -0
- package/lib/model/IPublishedArtifacts.js.map +1 -0
- package/lib/model/IPublishedArtifactsResident.d.ts +19 -0
- package/lib/model/IPublishedArtifactsResident.js +3 -0
- package/lib/model/IPublishedArtifactsResident.js.map +1 -0
- package/lib/model/ITtscLintDaemonTarget.d.ts +20 -0
- package/lib/model/ITtscLintDaemonTarget.js +3 -0
- package/lib/model/ITtscLintDaemonTarget.js.map +1 -0
- package/lib/model/TtscGraphLinePeer.d.ts +146 -0
- package/lib/model/TtscGraphLinePeer.js +213 -0
- package/lib/model/TtscGraphLinePeer.js.map +1 -0
- package/lib/model/TtscGraphMemory.d.ts +156 -16
- package/lib/model/TtscGraphMemory.js +228 -222
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/TtscGraphNativeArguments.d.ts +40 -0
- package/lib/model/TtscGraphNativeArguments.js +64 -0
- package/lib/model/TtscGraphNativeArguments.js.map +1 -0
- package/lib/model/TtscGraphNodeId.d.ts +55 -3
- package/lib/model/TtscGraphNodeId.js +40 -2
- package/lib/model/TtscGraphNodeId.js.map +1 -1
- package/lib/model/TtscGraphProjection.d.ts +156 -0
- package/lib/model/TtscGraphProjection.js +390 -0
- package/lib/model/TtscGraphProjection.js.map +1 -0
- package/lib/model/TtscGraphProtocol.d.ts +28 -0
- package/lib/model/TtscGraphProtocol.js +928 -0
- package/lib/model/TtscGraphProtocol.js.map +1 -0
- package/lib/model/TtscGraphReadonly.d.ts +15 -0
- package/lib/model/TtscGraphReadonly.js +3 -0
- package/lib/model/TtscGraphReadonly.js.map +1 -0
- package/lib/model/TtscGraphRequestOptions.d.ts +16 -0
- package/lib/model/TtscGraphRequestOptions.js +3 -0
- package/lib/model/TtscGraphRequestOptions.js.map +1 -0
- package/lib/model/TtscGraphSession.d.ts +82 -36
- package/lib/model/TtscGraphSession.js +164 -1238
- package/lib/model/TtscGraphSession.js.map +1 -1
- package/lib/model/TtscGraphSessionOptions.d.ts +20 -0
- package/lib/model/TtscGraphSessionOptions.js +3 -0
- package/lib/model/TtscGraphSessionOptions.js.map +1 -0
- package/lib/model/TtscGraphSessionState.d.ts +187 -0
- package/lib/model/TtscGraphSessionState.js +417 -0
- package/lib/model/TtscGraphSessionState.js.map +1 -0
- package/lib/model/TtscGraphShardStore.d.ts +64 -3
- package/lib/model/TtscGraphShardStore.js +85 -15
- package/lib/model/TtscGraphShardStore.js.map +1 -1
- package/lib/model/TtscGraphSourceReader.d.ts +31 -8
- package/lib/model/TtscGraphSourceReader.js +37 -13
- package/lib/model/TtscGraphSourceReader.js.map +1 -1
- package/lib/model/TtscLintDaemon.d.ts +35 -17
- package/lib/model/TtscLintDaemon.js +39 -117
- package/lib/model/TtscLintDaemon.js.map +1 -1
- package/lib/model/TtscLintDaemonState.d.ts +69 -0
- package/lib/model/TtscLintDaemonState.js +166 -0
- package/lib/model/TtscLintDaemonState.js.map +1 -0
- package/lib/model/copyGraphRecords.d.ts +14 -0
- package/lib/model/copyGraphRecords.js +19 -0
- package/lib/model/copyGraphRecords.js.map +1 -0
- package/lib/model/copyGraphSnapshot.d.ts +17 -0
- package/lib/model/copyGraphSnapshot.js +33 -0
- package/lib/model/copyGraphSnapshot.js.map +1 -0
- package/lib/model/loadGraph.d.ts +19 -10
- package/lib/model/loadGraph.js +21 -12
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/model/publishedArtifacts.d.ts +78 -97
- package/lib/model/publishedArtifacts.js +271 -85
- package/lib/model/publishedArtifacts.js.map +1 -1
- package/lib/nativeExecutable.d.ts +19 -8
- package/lib/nativeExecutable.js +75 -15
- package/lib/nativeExecutable.js.map +1 -1
- package/lib/reduce.d.ts +19 -45
- package/lib/reduce.js +19 -3
- package/lib/reduce.js.map +1 -1
- package/lib/resolveGraphBinary.d.ts +9 -0
- package/lib/resolveGraphBinary.js +11 -3
- package/lib/resolveGraphBinary.js.map +1 -1
- package/lib/runGraph.d.ts +21 -0
- package/lib/runGraph.js +83 -0
- package/lib/runGraph.js.map +1 -0
- package/lib/server/IResolvedGraphHandle.d.ts +22 -0
- package/lib/server/IResolvedGraphHandle.js +3 -0
- package/lib/server/IResolvedGraphHandle.js.map +1 -0
- package/lib/server/createServer.d.ts +14 -10
- package/lib/server/createServer.js +42 -39
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/exportSurface.d.ts +23 -1
- package/lib/server/exportSurface.js +23 -1
- package/lib/server/exportSurface.js.map +1 -1
- package/lib/server/formatGraphFailure.d.ts +20 -0
- package/lib/server/formatGraphFailure.js +35 -0
- package/lib/server/formatGraphFailure.js.map +1 -0
- package/lib/server/pathPolicy.d.ts +70 -5
- package/lib/server/pathPolicy.js +66 -4
- package/lib/server/pathPolicy.js.map +1 -1
- package/lib/server/resolveHandle.d.ts +10 -5
- package/lib/server/resolveHandle.js +39 -7
- package/lib/server/resolveHandle.js.map +1 -1
- package/lib/server/resultAudit.d.ts +17 -14
- package/lib/server/resultAudit.js +56 -27
- package/lib/server/resultAudit.js.map +1 -1
- package/lib/server/resultNext.d.ts +26 -1
- package/lib/server/resultNext.js +14 -0
- package/lib/server/resultNext.js.map +1 -1
- package/lib/server/runDetails.d.ts +72 -15
- package/lib/server/runDetails.js +104 -69
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.d.ts +9 -0
- package/lib/server/runEntrypoints.js +9 -0
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.d.ts +13 -3
- package/lib/server/runLookup.js +19 -6
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runOverview.d.ts +13 -4
- package/lib/server/runOverview.js +13 -4
- package/lib/server/runOverview.js.map +1 -1
- package/lib/server/runTour.d.ts +9 -0
- package/lib/server/runTour.js +33 -65
- package/lib/server/runTour.js.map +1 -1
- package/lib/server/runTrace.d.ts +25 -1
- package/lib/server/runTrace.js +133 -88
- package/lib/server/runTrace.js.map +1 -1
- package/lib/server/startServer.d.ts +16 -0
- package/lib/server/startServer.js +24 -1
- package/lib/server/startServer.js.map +1 -1
- package/lib/structures/ITtscGraphApplication.d.ts +95 -41
- package/lib/structures/ITtscGraphDecorator.d.ts +18 -0
- package/lib/structures/ITtscGraphDetails.d.ts +81 -6
- package/lib/structures/ITtscGraphDocTag.d.ts +17 -8
- package/lib/structures/ITtscGraphDump.d.ts +106 -8
- package/lib/structures/ITtscGraphEdge.d.ts +14 -2
- package/lib/structures/ITtscGraphEntrypoints.d.ts +81 -6
- package/lib/structures/ITtscGraphEscape.d.ts +24 -2
- package/lib/structures/ITtscGraphEvidence.d.ts +9 -0
- package/lib/structures/ITtscGraphLookup.d.ts +42 -9
- package/lib/structures/ITtscGraphNext.d.ts +12 -1
- package/lib/structures/ITtscGraphNode.d.ts +38 -11
- package/lib/structures/ITtscGraphOverview.d.ts +81 -6
- package/lib/structures/ITtscGraphSnapshot.d.ts +97 -2
- package/lib/structures/ITtscGraphSpan.d.ts +9 -0
- package/lib/structures/ITtscGraphTour.d.ts +83 -9
- package/lib/structures/ITtscGraphTrace.d.ts +99 -14
- package/lib/structures/RawDump.d.ts +22 -0
- package/lib/structures/RawDump.js +3 -0
- package/lib/structures/RawDump.js.map +1 -0
- package/lib/structures/RawEdge.d.ts +20 -0
- package/lib/structures/RawEdge.js +3 -0
- package/lib/structures/RawEdge.js.map +1 -0
- package/lib/structures/RawNode.d.ts +26 -0
- package/lib/structures/RawNode.js +3 -0
- package/lib/structures/RawNode.js.map +1 -0
- package/lib/structures/TtscGraphArtifactNodeKind.d.ts +9 -0
- package/lib/structures/TtscGraphArtifactNodeKind.js +9 -0
- package/lib/structures/TtscGraphArtifactNodeKind.js.map +1 -1
- package/lib/structures/TtscGraphDumpEdgeKind.d.ts +15 -1
- package/lib/structures/TtscGraphDumpNodeKind.d.ts +9 -0
- package/lib/structures/TtscGraphEdgeKind.d.ts +13 -4
- package/lib/structures/TtscGraphNodeKind.d.ts +9 -0
- package/lib/structures/TtscGraphNodeModifier.d.ts +9 -0
- package/lib/structures/ViewerLink.d.ts +20 -0
- package/lib/structures/ViewerLink.js +3 -0
- package/lib/structures/ViewerLink.js.map +1 -0
- package/lib/structures/ViewerNode.d.ts +24 -0
- package/lib/structures/ViewerNode.js +3 -0
- package/lib/structures/ViewerNode.js.map +1 -0
- package/lib/structures/ViewerPayload.d.ts +42 -0
- package/lib/structures/ViewerPayload.js +3 -0
- package/lib/structures/ViewerPayload.js.map +1 -0
- package/lib/view.d.ts +9 -0
- package/lib/view.js +203 -91
- package/lib/view.js.map +1 -1
- package/lib/viewer/viewer.js +1 -1
- package/package.json +8 -6
- package/src/CapturedProcessOutput.ts +50 -0
- package/src/ILauncherOption.ts +24 -0
- package/src/IProjectOptions.ts +19 -0
- package/src/ParsedLauncherOptions.ts +13 -0
- package/src/TtscGraphApplication.ts +38 -1
- package/src/TtscGraphLauncherArguments.ts +207 -0
- package/src/TtscGraphViewSnapshot.ts +46 -0
- package/src/index.ts +9 -160
- package/src/internal/GraphProcessTrace.ts +242 -0
- package/src/launcherArgs.ts +89 -23
- package/src/model/IArtifactDirectory.ts +27 -0
- package/src/model/IArtifactInputs.ts +21 -0
- package/src/model/IPublishedArtifacts.ts +81 -0
- package/src/model/IPublishedArtifactsResident.ts +24 -0
- package/src/model/ITtscLintDaemonTarget.ts +22 -0
- package/src/model/TtscGraphLinePeer.ts +318 -0
- package/src/model/TtscGraphMemory.ts +284 -246
- package/src/model/TtscGraphNativeArguments.ts +67 -0
- package/src/model/TtscGraphNodeId.ts +57 -3
- package/src/model/TtscGraphProjection.ts +473 -0
- package/src/model/TtscGraphProtocol.ts +90 -0
- package/src/model/TtscGraphReadonly.ts +17 -0
- package/src/model/TtscGraphRequestOptions.ts +16 -0
- package/src/model/TtscGraphSession.ts +196 -475
- package/src/model/TtscGraphSessionOptions.ts +22 -0
- package/src/model/TtscGraphSessionState.ts +558 -0
- package/src/model/TtscGraphShardStore.ts +99 -23
- package/src/model/TtscGraphSourceReader.ts +37 -15
- package/src/model/TtscLintDaemon.ts +55 -136
- package/src/model/TtscLintDaemonState.ts +174 -0
- package/src/model/copyGraphRecords.ts +17 -0
- package/src/model/copyGraphSnapshot.ts +30 -0
- package/src/model/loadGraph.ts +23 -12
- package/src/model/publishedArtifacts.ts +361 -182
- package/src/nativeExecutable.ts +93 -26
- package/src/reduce.ts +24 -51
- package/src/resolveGraphBinary.ts +13 -3
- package/src/runGraph.ts +90 -0
- package/src/server/IResolvedGraphHandle.ts +24 -0
- package/src/server/createServer.ts +16 -22
- package/src/server/exportSurface.ts +23 -1
- package/src/server/formatGraphFailure.ts +32 -0
- package/src/server/pathPolicy.ts +70 -5
- package/src/server/resolveHandle.ts +45 -14
- package/src/server/resultAudit.ts +58 -27
- package/src/server/resultNext.ts +26 -1
- package/src/server/runDetails.ts +138 -73
- package/src/server/runEntrypoints.ts +13 -1
- package/src/server/runLookup.ts +23 -7
- package/src/server/runOverview.ts +17 -5
- package/src/server/runTour.ts +44 -82
- package/src/server/runTrace.ts +175 -102
- package/src/server/startServer.ts +29 -1
- package/src/structures/ITtscGraphApplication.ts +95 -41
- package/src/structures/ITtscGraphDecorator.ts +18 -0
- package/src/structures/ITtscGraphDetails.ts +81 -6
- package/src/structures/ITtscGraphDocTag.ts +17 -8
- package/src/structures/ITtscGraphDump.ts +106 -8
- package/src/structures/ITtscGraphEdge.ts +14 -2
- package/src/structures/ITtscGraphEntrypoints.ts +81 -6
- package/src/structures/ITtscGraphEscape.ts +24 -2
- package/src/structures/ITtscGraphEvidence.ts +9 -0
- package/src/structures/ITtscGraphLookup.ts +42 -9
- package/src/structures/ITtscGraphNext.ts +12 -1
- package/src/structures/ITtscGraphNode.ts +38 -11
- package/src/structures/ITtscGraphOverview.ts +88 -6
- package/src/structures/ITtscGraphSnapshot.ts +117 -2
- package/src/structures/ITtscGraphSpan.ts +9 -0
- package/src/structures/ITtscGraphTour.ts +83 -9
- package/src/structures/ITtscGraphTrace.ts +100 -14
- package/src/structures/RawDump.ts +25 -0
- package/src/structures/RawEdge.ts +22 -0
- package/src/structures/RawNode.ts +31 -0
- package/src/structures/TtscGraphArtifactNodeKind.ts +9 -0
- package/src/structures/TtscGraphDumpEdgeKind.ts +15 -1
- package/src/structures/TtscGraphDumpNodeKind.ts +9 -0
- package/src/structures/TtscGraphEdgeKind.ts +13 -4
- package/src/structures/TtscGraphNodeKind.ts +9 -0
- package/src/structures/TtscGraphNodeModifier.ts +9 -0
- package/src/structures/ViewerLink.ts +22 -0
- package/src/structures/ViewerNode.ts +28 -0
- package/src/structures/ViewerPayload.ts +52 -0
- package/src/view.ts +208 -110
- package/src/viewer/legend.ts +119 -27
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type ITtscCapabilityPluginResolution } from "ttsc";
|
|
2
|
+
import { IArtifactInputs } from "./IArtifactInputs";
|
|
3
|
+
/**
|
|
4
|
+
* Ask the project's `@ttsc/lint` for the artifacts a citation can name, and
|
|
5
|
+
* write them where `ttscgraph dump --artifacts` reads them.
|
|
6
|
+
*
|
|
7
|
+
* A project that configures no such plugin gets `file: null`, which is the
|
|
8
|
+
* common case and not an error: the graph it produces is the graph it produced
|
|
9
|
+
* before this existed, and the dump says so by not claiming the capability.
|
|
10
|
+
*
|
|
11
|
+
* ## Why this runs here and not in the compiler host
|
|
12
|
+
*
|
|
13
|
+
* The addresses a citation names — a Markdown anchor, `prisma:Sale.price`,
|
|
14
|
+
* `POST:/orders` — are produced by parsers that live in the rule that owns
|
|
15
|
+
* them, and re-deriving any of them in the graph producer would be a second
|
|
16
|
+
* implementation of a published contract. So the units have to arrive from the
|
|
17
|
+
* rule.
|
|
18
|
+
*
|
|
19
|
+
* They cannot arrive in-process. `ttscgraph` is the shipped per-platform
|
|
20
|
+
* binary, never a per-project native host, so it can never have a linked
|
|
21
|
+
* plugin; and `packages/lint` is its own Go module that deliberately carries no
|
|
22
|
+
* requirement on the compiler host. What is left is the channel the host
|
|
23
|
+
* already has: a plugin declares a capability and its sidecar answers a verb,
|
|
24
|
+
* exactly as `lsp-hints` does. `resolveCapabilityPluginResolution` builds and
|
|
25
|
+
* locates those sidecars, and it is the seam `ttscserver` already uses for
|
|
26
|
+
* `capabilities.lsp`, published so a consumer outside the compiler can ask
|
|
27
|
+
* too.
|
|
28
|
+
*
|
|
29
|
+
* Nothing here knows what `@ttsc/evidence` is. It asks a lint install for
|
|
30
|
+
* whatever its configured rules published, and a project that configured none
|
|
31
|
+
* gets an empty answer.
|
|
32
|
+
*
|
|
33
|
+
* @evidence contracts/common.md#principled-implementation Publication carries the sidecar's artifact file and the input identity captured before asking for artifacts, so later input changes can invalidate that answer.
|
|
34
|
+
* @evidence contracts/common.md#clear-and-simple-design The result separates the producer exchange path, input inventory and freshness identity without embedding compiler Program state.
|
|
35
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A null file states an absent publication, not an invented artifact set or a successful compiler capability claim.
|
|
36
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose explains publication absence, independent document inputs and the fingerprint's ordering role.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources data shape only: it holds no handle, task or retained state.
|
|
38
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms data shape only: it contains no loop or algorithm.
|
|
39
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work data shape only: it computes nothing another request could share.
|
|
40
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation data shape only: it touches no file, path or process.
|
|
41
|
+
*/
|
|
42
|
+
export interface IPublishedArtifacts {
|
|
43
|
+
/**
|
|
44
|
+
* Path to the JSON the native producer reads, or `null` when no configured
|
|
45
|
+
* plugin publishes one.
|
|
46
|
+
*
|
|
47
|
+
* `null` is a state rather than an absence, which is why it still carries
|
|
48
|
+
* {@link inputs}. A project that adds an evidence plugin while a session is
|
|
49
|
+
* running would otherwise never be reconsidered: nothing would be watched, so
|
|
50
|
+
* nothing could report that the answer had changed from "none" to "some".
|
|
51
|
+
*/
|
|
52
|
+
file: string | null;
|
|
53
|
+
/**
|
|
54
|
+
* Everything the answer was derived from, as paths this process can state for
|
|
55
|
+
* itself.
|
|
56
|
+
*
|
|
57
|
+
* The artifacts describe documents the compiler's Program never read, so a
|
|
58
|
+
* source edit does not move them and a document edit does not move the code
|
|
59
|
+
* graph. Refreshing them is therefore a second invalidation with its own
|
|
60
|
+
* inputs, and these are those inputs.
|
|
61
|
+
*/
|
|
62
|
+
inputs: IArtifactInputs;
|
|
63
|
+
/**
|
|
64
|
+
* The state of {@link inputs} when the answer was produced.
|
|
65
|
+
*
|
|
66
|
+
* Compared against a freshly taken one to decide whether the answer is stale.
|
|
67
|
+
* When it moved, nothing else in the session can tell: the compiler's own
|
|
68
|
+
* invalidation watches the build universe, and none of this is in it.
|
|
69
|
+
*/
|
|
70
|
+
fingerprint: string;
|
|
71
|
+
/**
|
|
72
|
+
* Owning plugin discovery proof, including successful absence. Omitted by
|
|
73
|
+
* legacy callers, whose publication cannot establish discovery freshness.
|
|
74
|
+
*/
|
|
75
|
+
discovery?: ITtscCapabilityPluginResolution;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPublishedArtifacts.js","sourceRoot":"","sources":["../../src/model/IPublishedArtifacts.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CapabilityPluginResolver } from "ttsc";
|
|
2
|
+
import type { IPublishedArtifacts } from "./IPublishedArtifacts";
|
|
3
|
+
/**
|
|
4
|
+
* Publication paired with the exact resolver-owned asynchronous proof. The
|
|
5
|
+
* session releases this proof on replacement or resolver shutdown.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/common.md#principled-implementation The publication inputs remain separate from the exact discovery generation's opaque validity query.
|
|
8
|
+
* @evidence contracts/common.md#clear-and-simple-design Only discovery ownership differs from the synchronous publication data shape.
|
|
9
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The original SDK authority supplies currentness rather than a consumer-reconstructed watch list.
|
|
10
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies asynchronous proof identity and release ownership.
|
|
11
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This data shape selects no computation strategy.
|
|
12
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The producing and freshness operations decide whether consumers may reuse it.
|
|
13
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The holder must release discovery after replacement; resolver close also drops all retained proofs.
|
|
14
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This representation performs no filesystem or process operation.
|
|
15
|
+
*/
|
|
16
|
+
export interface IPublishedArtifactsResident extends Omit<IPublishedArtifacts, "discovery"> {
|
|
17
|
+
/** Owning asynchronous discovery authority, released by the session. */
|
|
18
|
+
discovery: CapabilityPluginResolver.Resolution;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPublishedArtifactsResident.js","sourceRoot":"","sources":["../../src/model/IPublishedArtifactsResident.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One plugin sidecar this daemon can be opened against.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation Binary, plugin manifest and optional project context identify the sidecar executable and configuration inputs for its verbs.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design The target groups only launch identity while cwd and tsconfig remain session-owned coordinates.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Plugin configuration is passed through its supported manifest/context flags rather than patched into a running foreign process.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation Native member comments explain binary identity and the two configuration channels.
|
|
8
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources data shape only: it holds no handle, task or retained state.
|
|
9
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms data shape only: it contains no loop or algorithm.
|
|
10
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work data shape only: it computes nothing another request could share.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation data shape only: it touches no file, path or process.
|
|
12
|
+
*/
|
|
13
|
+
export interface ITtscLintDaemonTarget {
|
|
14
|
+
/** Native plugin sidecar executable path. */
|
|
15
|
+
binary: string;
|
|
16
|
+
/** Serialized plugin manifest consumed by the sidecar. */
|
|
17
|
+
manifest: string;
|
|
18
|
+
/** Optional serialized project identity passed to context-aware rules. */
|
|
19
|
+
projectContext?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ITtscLintDaemonTarget.js","sourceRoot":"","sources":["../../src/model/ITtscLintDaemonTarget.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native line transport shared by graph and lint resident owners.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/common.md#principled-implementation Node stdout line framing and explicit process events preserve the native protocols while request correlation remains with their state owners.
|
|
5
|
+
* @evidence contracts/common.md#clear-and-simple-design A connection exposes only liveness, diagnostics, writes and retirement; EOF retirement and authoritative process/stdio joining serve both state owners.
|
|
6
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The default adapter invokes the actual binary and argv without a shell, synthetic responses or replaced foreign methods.
|
|
7
|
+
* @evidence contracts/common.md#meaningful-documentation Connection comments state line/event ownership, bounded diagnostic capture and the difference between reader retirement and process termination.
|
|
8
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms open owns process and line setup; the namespace groups its connection protocol.
|
|
9
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Resident state owners decide peer reuse; this namespace adds no result cache.
|
|
10
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources open and its returned close implementation own actual child/reader acquisition and retirement.
|
|
11
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Events, Connection and open document the native representation and operations rather than the namespace grouping them.
|
|
12
|
+
*/
|
|
13
|
+
export declare namespace TtscGraphLinePeer {
|
|
14
|
+
/**
|
|
15
|
+
* Events produced by a native child, addressed by its connection owner.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/common.md#principled-implementation Complete stdout lines, startup errors and nullable code/signal exit coordinates represent distinct Node process events.
|
|
18
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
19
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
20
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
21
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
23
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
24
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
25
|
+
*/
|
|
26
|
+
interface Events {
|
|
27
|
+
/**
|
|
28
|
+
* One complete stdout line.
|
|
29
|
+
*
|
|
30
|
+
* @evidence contracts/common.md#principled-implementation The callback receives a complete UTF-8 stdout line without imposing graph syntax or response correlation.
|
|
31
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
32
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
33
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
34
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
35
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
36
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
37
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
38
|
+
*/
|
|
39
|
+
line(line: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Child startup or transport failure.
|
|
42
|
+
*
|
|
43
|
+
* @evidence contracts/common.md#principled-implementation The callback preserves the actual child Error as a failure event rather than a synthetic success frame.
|
|
44
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
45
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
46
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
47
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
48
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
49
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
50
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
51
|
+
*/
|
|
52
|
+
error(error: Error): void;
|
|
53
|
+
/**
|
|
54
|
+
* Actual process exit; a retired reader cannot publish later lines.
|
|
55
|
+
*
|
|
56
|
+
* @evidence contracts/common.md#principled-implementation Nullable numeric code and Node signal name preserve whether a native process exited normally or by signal.
|
|
57
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
58
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
59
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
60
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
61
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
62
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
63
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
64
|
+
*/
|
|
65
|
+
exit(code: number | null, signal: NodeJS.Signals | null): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Owned native handle used by resident state machines.
|
|
69
|
+
*
|
|
70
|
+
* @evidence contracts/common.md#principled-implementation A connection groups actual process liveness, bounded diagnostics, writes and reader/process retirement under one owned identity.
|
|
71
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
72
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
73
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
74
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
75
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
76
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
77
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
78
|
+
*/
|
|
79
|
+
interface Connection {
|
|
80
|
+
/**
|
|
81
|
+
* Up to the last 65,536 UTF-16 code units of diagnostics when capture is
|
|
82
|
+
* selected.
|
|
83
|
+
*/
|
|
84
|
+
readonly stderr: string;
|
|
85
|
+
/**
|
|
86
|
+
* Whether the underlying child still has no exit status.
|
|
87
|
+
*
|
|
88
|
+
* @evidence contracts/common.md#principled-implementation Liveness reflects the Node child exitCode/signalCode pair; a sent kill signal alone is not a completed exit.
|
|
89
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
90
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
91
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
92
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
93
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
94
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
95
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
96
|
+
*/
|
|
97
|
+
alive(): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Write one complete request; errors belong to the request owner.
|
|
100
|
+
*
|
|
101
|
+
* @evidence contracts/common.md#principled-implementation The actual stdin callback transfers write failure to its request owner without manufacturing a response.
|
|
102
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
103
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
104
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
105
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
106
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
107
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
108
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
109
|
+
*/
|
|
110
|
+
write(line: string, done: (error?: Error | null) => void): void;
|
|
111
|
+
/**
|
|
112
|
+
* Detach the reader, or end stdin and await the owned process and stdio.
|
|
113
|
+
*
|
|
114
|
+
* @evidence contracts/common.md#principled-implementation Reader retirement is distinct from joined shutdown; repeated close(true) returns the same completion, which rejects unknown or forced termination.
|
|
115
|
+
* @evidence contracts/common.md#clear-and-simple-design The signature transfers only its stated process operation or event; resident state owns protocol decisions.
|
|
116
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Node-native representations remain explicit rather than shell strings, process stand-ins or replaced foreign methods.
|
|
117
|
+
* @evidence contracts/common.md#meaningful-documentation Native member prose states event, liveness or retirement meaning needed by the state owner.
|
|
118
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This boundary signature defines an operation or event; open and its returned adapter implementations own the work.
|
|
119
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The boundary descriptor computes no reusable graph result; state coordinates continued peer reuse.
|
|
120
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The signature acquires no handle itself; open and the returned close implementation own actual lifetime.
|
|
121
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node numeric exit status, signal names, stdin callbacks and decoded line strings preserve native process semantics without assuming shell quoting or platform path spelling.
|
|
122
|
+
*/
|
|
123
|
+
close(terminate: boolean): void | Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Open the actual Node child and attach its reader and diagnostic drain.
|
|
127
|
+
*
|
|
128
|
+
* EOF permits the resident loop to finish. close(true) resolves only after
|
|
129
|
+
* Node joins the process and all stdio after a normal numeric exit, including
|
|
130
|
+
* a nonzero status already delivered to the request owner. A transport
|
|
131
|
+
* failure, signal, forced kill or unjoined deadline rejects instead.
|
|
132
|
+
*
|
|
133
|
+
* @evidence contracts/common.md#principled-implementation Node spawn and readline preserve executable, argv and complete lines; the close callback's private retirementError decision accepts normal numeric exit after process/stdio join while transport failure, unknown status, signal and forced termination remain failures. Exit events separately preserve failed request outcomes.
|
|
134
|
+
* @evidence contracts/common.md#clear-and-simple-design One adapter owns actual process I/O and joined EOF shutdown; its private retirementError helper qualifies completion without changing the resident state owners' protocol or diagnostic decisions.
|
|
135
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Real process APIs retain their defaults and explicit argv; no test-only executable or response path is supplied.
|
|
136
|
+
* @evidence contracts/common.md#meaningful-documentation Prose explains EOF completion and unknown/forced failure and connection comments describe bounded stderr and retirement.
|
|
137
|
+
* @evidence contracts/performance.md#efficient-algorithms One spawn/reader setup is constant-count; writes and line decoding process frame bytes once, while captured diagnostics retain a tail of at most 65,536 UTF-16 code units and draining avoids pipe backpressure.
|
|
138
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This effectful opener creates one native peer; resident state determines when that peer remains reusable or must be replaced.
|
|
139
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The returned close owns one reader and child, detaches once and terminates at most once; a delivery deadline bounds an unread pipe after the caller yields, while child grace starts after EOF delivery. Streams drain through authoritative completion; an unjoined deadline first rejects and then releases only this connection's handles without terminating foreign pipe holders.
|
|
140
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node spawn receives an executable and argv vector directly with windowsHide; Node stream/process APIs own native signals and optional cwd, without a shell or manual path normalization.
|
|
141
|
+
*/
|
|
142
|
+
function open(binary: string, args: string[], events: Events, options: {
|
|
143
|
+
cwd?: string;
|
|
144
|
+
stderr: "capture" | "drain";
|
|
145
|
+
}): Connection;
|
|
146
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TtscGraphLinePeer = void 0;
|
|
7
|
+
const node_readline_1 = __importDefault(require("node:readline"));
|
|
8
|
+
const GraphProcessTrace_1 = require("../internal/GraphProcessTrace");
|
|
9
|
+
const TERMINATION_GRACE_MS = 1_000;
|
|
10
|
+
/**
|
|
11
|
+
* Native line transport shared by graph and lint resident owners.
|
|
12
|
+
*
|
|
13
|
+
* @evidence contracts/common.md#principled-implementation Node stdout line framing and explicit process events preserve the native protocols while request correlation remains with their state owners.
|
|
14
|
+
* @evidence contracts/common.md#clear-and-simple-design A connection exposes only liveness, diagnostics, writes and retirement; EOF retirement and authoritative process/stdio joining serve both state owners.
|
|
15
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts The default adapter invokes the actual binary and argv without a shell, synthetic responses or replaced foreign methods.
|
|
16
|
+
* @evidence contracts/common.md#meaningful-documentation Connection comments state line/event ownership, bounded diagnostic capture and the difference between reader retirement and process termination.
|
|
17
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms open owns process and line setup; the namespace groups its connection protocol.
|
|
18
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Resident state owners decide peer reuse; this namespace adds no result cache.
|
|
19
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources open and its returned close implementation own actual child/reader acquisition and retirement.
|
|
20
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Events, Connection and open document the native representation and operations rather than the namespace grouping them.
|
|
21
|
+
*/
|
|
22
|
+
var TtscGraphLinePeer;
|
|
23
|
+
(function (TtscGraphLinePeer) {
|
|
24
|
+
/**
|
|
25
|
+
* Open the actual Node child and attach its reader and diagnostic drain.
|
|
26
|
+
*
|
|
27
|
+
* EOF permits the resident loop to finish. close(true) resolves only after
|
|
28
|
+
* Node joins the process and all stdio after a normal numeric exit, including
|
|
29
|
+
* a nonzero status already delivered to the request owner. A transport
|
|
30
|
+
* failure, signal, forced kill or unjoined deadline rejects instead.
|
|
31
|
+
*
|
|
32
|
+
* @evidence contracts/common.md#principled-implementation Node spawn and readline preserve executable, argv and complete lines; the close callback's private retirementError decision accepts normal numeric exit after process/stdio join while transport failure, unknown status, signal and forced termination remain failures. Exit events separately preserve failed request outcomes.
|
|
33
|
+
* @evidence contracts/common.md#clear-and-simple-design One adapter owns actual process I/O and joined EOF shutdown; its private retirementError helper qualifies completion without changing the resident state owners' protocol or diagnostic decisions.
|
|
34
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Real process APIs retain their defaults and explicit argv; no test-only executable or response path is supplied.
|
|
35
|
+
* @evidence contracts/common.md#meaningful-documentation Prose explains EOF completion and unknown/forced failure and connection comments describe bounded stderr and retirement.
|
|
36
|
+
* @evidence contracts/performance.md#efficient-algorithms One spawn/reader setup is constant-count; writes and line decoding process frame bytes once, while captured diagnostics retain a tail of at most 65,536 UTF-16 code units and draining avoids pipe backpressure.
|
|
37
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This effectful opener creates one native peer; resident state determines when that peer remains reusable or must be replaced.
|
|
38
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The returned close owns one reader and child, detaches once and terminates at most once; a delivery deadline bounds an unread pipe after the caller yields, while child grace starts after EOF delivery. Streams drain through authoritative completion; an unjoined deadline first rejects and then releases only this connection's handles without terminating foreign pipe holders.
|
|
39
|
+
* @evidence contracts/portability.md#os-neutral-implementation Node spawn receives an executable and argv vector directly with windowsHide; Node stream/process APIs own native signals and optional cwd, without a shell or manual path normalization.
|
|
40
|
+
*/
|
|
41
|
+
function open(binary, args, events, options) {
|
|
42
|
+
const child = GraphProcessTrace_1.GraphProcessTrace.spawn(binary, args, {
|
|
43
|
+
...(options.cwd === undefined ? {} : { cwd: options.cwd }),
|
|
44
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
45
|
+
windowsHide: true,
|
|
46
|
+
});
|
|
47
|
+
const lines = node_readline_1.default.createInterface({ input: child.stdout });
|
|
48
|
+
let stderr = "";
|
|
49
|
+
let readerClosed = false;
|
|
50
|
+
let terminated = false;
|
|
51
|
+
let joined = false;
|
|
52
|
+
let forced = false;
|
|
53
|
+
let joinFailed = false;
|
|
54
|
+
let failure;
|
|
55
|
+
let force;
|
|
56
|
+
let flushDeadline;
|
|
57
|
+
let deadline;
|
|
58
|
+
let resolve;
|
|
59
|
+
let reject;
|
|
60
|
+
const completion = new Promise((res, rej) => {
|
|
61
|
+
resolve = res;
|
|
62
|
+
reject = rej;
|
|
63
|
+
});
|
|
64
|
+
// Existing fire-and-forget disposal remains safe; awaiting the original
|
|
65
|
+
// promise still exposes failure instead of turning it into joined success.
|
|
66
|
+
void completion.catch(() => undefined);
|
|
67
|
+
child.on("error", (error) => {
|
|
68
|
+
failure = error;
|
|
69
|
+
});
|
|
70
|
+
for (const stream of [child.stdin, child.stdout, child.stderr])
|
|
71
|
+
stream.on("error", (error) => {
|
|
72
|
+
failure = error;
|
|
73
|
+
events.error(error);
|
|
74
|
+
});
|
|
75
|
+
child.once("close", (code, signal) => {
|
|
76
|
+
joined = true;
|
|
77
|
+
if (force !== undefined)
|
|
78
|
+
clearTimeout(force);
|
|
79
|
+
if (flushDeadline !== undefined)
|
|
80
|
+
clearTimeout(flushDeadline);
|
|
81
|
+
if (deadline !== undefined)
|
|
82
|
+
clearTimeout(deadline);
|
|
83
|
+
if (joinFailed)
|
|
84
|
+
return;
|
|
85
|
+
const error = retirementError(code, signal, forced, failure);
|
|
86
|
+
if (error !== undefined)
|
|
87
|
+
reject(error);
|
|
88
|
+
else
|
|
89
|
+
resolve();
|
|
90
|
+
});
|
|
91
|
+
const captureStderr = (chunk) => {
|
|
92
|
+
stderr = (stderr + chunk).slice(-64 * 1024);
|
|
93
|
+
};
|
|
94
|
+
if (options.stderr === "capture") {
|
|
95
|
+
child.stderr.setEncoding("utf8");
|
|
96
|
+
child.stderr.on("data", captureStderr);
|
|
97
|
+
}
|
|
98
|
+
else
|
|
99
|
+
child.stderr.resume();
|
|
100
|
+
lines.on("line", events.line);
|
|
101
|
+
child.on("error", events.error);
|
|
102
|
+
child.on("exit", events.exit);
|
|
103
|
+
const forceTerminationAndJoin = () => {
|
|
104
|
+
if (joined || deadline !== undefined)
|
|
105
|
+
return;
|
|
106
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
107
|
+
forced = true;
|
|
108
|
+
try {
|
|
109
|
+
child.kill("SIGKILL");
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
failure = error instanceof Error ? error : new Error(String(error));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
deadline = setTimeout(() => {
|
|
116
|
+
if (joined)
|
|
117
|
+
return;
|
|
118
|
+
// Failure is final before destroying our streams can induce Node close.
|
|
119
|
+
// Foreign descendants may retain inherited pipe endpoints; release our
|
|
120
|
+
// endpoints without claiming their lifetime was joined or killing them.
|
|
121
|
+
joinFailed = true;
|
|
122
|
+
reject(new Error("@ttsc/graph: peer shutdown could not be joined"));
|
|
123
|
+
if (force !== undefined)
|
|
124
|
+
clearTimeout(force);
|
|
125
|
+
if (flushDeadline !== undefined)
|
|
126
|
+
clearTimeout(flushDeadline);
|
|
127
|
+
if (deadline !== undefined)
|
|
128
|
+
clearTimeout(deadline);
|
|
129
|
+
lines.removeListener("line", events.line);
|
|
130
|
+
lines.close();
|
|
131
|
+
child.removeListener("error", events.error);
|
|
132
|
+
child.removeListener("exit", events.exit);
|
|
133
|
+
child.stderr.removeListener("data", captureStderr);
|
|
134
|
+
for (const stream of [child.stdin, child.stdout, child.stderr])
|
|
135
|
+
stream.destroy();
|
|
136
|
+
child.unref();
|
|
137
|
+
}, TERMINATION_GRACE_MS);
|
|
138
|
+
};
|
|
139
|
+
const startTerminationGrace = () => {
|
|
140
|
+
if (flushDeadline !== undefined)
|
|
141
|
+
clearTimeout(flushDeadline);
|
|
142
|
+
if (joined || force !== undefined || deadline !== undefined)
|
|
143
|
+
return;
|
|
144
|
+
force = setTimeout(forceTerminationAndJoin, TERMINATION_GRACE_MS);
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
get stderr() {
|
|
148
|
+
return stderr;
|
|
149
|
+
},
|
|
150
|
+
alive: () => child.exitCode === null && child.signalCode === null,
|
|
151
|
+
write: (line, done) => {
|
|
152
|
+
child.stdin.write(line, done);
|
|
153
|
+
},
|
|
154
|
+
close: (terminate) => {
|
|
155
|
+
if (!readerClosed) {
|
|
156
|
+
readerClosed = true;
|
|
157
|
+
lines.close();
|
|
158
|
+
}
|
|
159
|
+
if (!terminate)
|
|
160
|
+
return;
|
|
161
|
+
if (terminated || joined)
|
|
162
|
+
return completion;
|
|
163
|
+
terminated = true;
|
|
164
|
+
// Keep output drained until Node's close event joins both the process
|
|
165
|
+
// and inherited stdio. EOF permits the real resident loop to finish.
|
|
166
|
+
child.stdout.resume();
|
|
167
|
+
// The child cannot act on EOF until the pipe finishes. Starting its
|
|
168
|
+
// grace period before that callback charged a blocked parent event
|
|
169
|
+
// loop against a shutdown request it had not yet delivered.
|
|
170
|
+
if (!child.stdin.destroyed) {
|
|
171
|
+
try {
|
|
172
|
+
child.stdin.end(startTerminationGrace);
|
|
173
|
+
// An unread pipe can prevent the EOF callback indefinitely. Start
|
|
174
|
+
// delivery's own deadline only after synchronous caller work yields.
|
|
175
|
+
queueMicrotask(() => {
|
|
176
|
+
if (joined || force !== undefined || deadline !== undefined)
|
|
177
|
+
return;
|
|
178
|
+
flushDeadline = setTimeout(forceTerminationAndJoin, TERMINATION_GRACE_MS);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
catch (error) {
|
|
182
|
+
failure = error instanceof Error ? error : new Error(String(error));
|
|
183
|
+
child.stdin.destroy();
|
|
184
|
+
startTerminationGrace();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else
|
|
188
|
+
startTerminationGrace();
|
|
189
|
+
return completion;
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
TtscGraphLinePeer.open = open;
|
|
194
|
+
/**
|
|
195
|
+
* Qualify an authoritative Node close event for resource retirement.
|
|
196
|
+
*
|
|
197
|
+
* A normal numeric exit establishes joined release regardless of the work's
|
|
198
|
+
* status. The exit callback owns that status; retirement still rejects an
|
|
199
|
+
* unknown exit, signal, forced termination or actual transport failure. This
|
|
200
|
+
* internal decision does not establish joining before Node closes stdio.
|
|
201
|
+
*
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
function retirementError(code, signal, forced, failure) {
|
|
205
|
+
if (failure !== undefined)
|
|
206
|
+
return failure;
|
|
207
|
+
if (forced || code === null || signal !== null)
|
|
208
|
+
return new Error(`@ttsc/graph: peer shutdown failed (code=${String(code)}, signal=${String(signal)}, forced=${forced})`);
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
TtscGraphLinePeer.retirementError = retirementError;
|
|
212
|
+
})(TtscGraphLinePeer || (exports.TtscGraphLinePeer = TtscGraphLinePeer = {}));
|
|
213
|
+
//# sourceMappingURL=TtscGraphLinePeer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphLinePeer.js","sourceRoot":"","sources":["../../src/model/TtscGraphLinePeer.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAqC;AAErC,qEAAkE;AAElE,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,IAAiB,iBAAiB,CA2SjC;AA3SD,WAAiB,iBAAiB;IAuHhC;;;;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