@ttsc/graph 0.30.4 → 0.31.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/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,417 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TtscGraphSessionState = void 0;
|
|
4
|
+
const TtscGraphMemory_1 = require("./TtscGraphMemory");
|
|
5
|
+
const TtscGraphShardStore_1 = require("./TtscGraphShardStore");
|
|
6
|
+
const loadGraph_1 = require("./loadGraph");
|
|
7
|
+
const GRAPH_SNAPSHOT_PROTOCOL_VERSION = 1;
|
|
8
|
+
/**
|
|
9
|
+
* Queue, request correlation and generation ownership for one resident graph.
|
|
10
|
+
*
|
|
11
|
+
* The host supplies artifact synchronization and validated line decoding; this
|
|
12
|
+
* owner accepts typed envelopes, atomically replaces graph generations, and
|
|
13
|
+
* retires a peer when its transport or generation cannot be trusted. It is
|
|
14
|
+
* internal to the graph facade, not an alternate public session API.
|
|
15
|
+
*
|
|
16
|
+
* @evidence contracts/common.md#principled-implementation Serialized admission and identity-checked reply settlement protect one atomic shard generation across abort, close and peer replacement.
|
|
17
|
+
* @evidence contracts/common.md#clear-and-simple-design Artifact discovery and generated schema decoding remain host responsibilities; this owner controls queue, pending replies, memory and shard retirement.
|
|
18
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Typed receive requires validated envelopes from the actual decoder; it supplies no schema substitute or fabricated fallback facts.
|
|
19
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states the validated-input premise and internal ownership; receive and failure events distinguish peer identity and lifecycle effects.
|
|
20
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms graph/receive/close own admission, frame processing and retirement; this declaration groups their retained state.
|
|
21
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work graph/receive/close establish continued peer/model reuse, not the class descriptor independently.
|
|
22
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources graph/receive/close control acquisition and release; the class declaration adds no separate lifecycle transition.
|
|
23
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation keeps queue and pending-request state in memory and reaches the process only through the Host and Connection operations it is given.
|
|
24
|
+
*/
|
|
25
|
+
class TtscGraphSessionState {
|
|
26
|
+
host;
|
|
27
|
+
child;
|
|
28
|
+
nextId = 0;
|
|
29
|
+
pending = new Map();
|
|
30
|
+
queue = Promise.resolve();
|
|
31
|
+
waiting;
|
|
32
|
+
current;
|
|
33
|
+
shardStore = new TtscGraphShardStore_1.TtscGraphShardStore();
|
|
34
|
+
closed = false;
|
|
35
|
+
closing;
|
|
36
|
+
retirements = new Set();
|
|
37
|
+
constructor(host) {
|
|
38
|
+
this.host = host;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Whether artifact refresh currently has a peer to update.
|
|
42
|
+
*
|
|
43
|
+
* @evidence contracts/common.md#principled-implementation The presence of owned peer state distinguishes an active publication target from a yet-unopened or retired session.
|
|
44
|
+
* @evidence contracts/common.md#clear-and-simple-design One read-only query lets the artifact facade retain its original live-peer refresh precondition.
|
|
45
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Ownership is observed directly rather than guessed from previous artifact values or a clock.
|
|
46
|
+
* @evidence contracts/common.md#meaningful-documentation The headline states why the facade asks this ownership question.
|
|
47
|
+
* @evidence contracts/performance.md#efficient-algorithms This constant-time reference check scans no pending or shard population.
|
|
48
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The query returns current ownership and coordinates no completed computation.
|
|
49
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources It acquires or releases nothing; graph and close own the queried peer.
|
|
50
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation reads one field.
|
|
51
|
+
*/
|
|
52
|
+
hasPeer() {
|
|
53
|
+
return this.child !== undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Refresh one graph for callers admitted before its freshness check starts.
|
|
57
|
+
*
|
|
58
|
+
* Later arrivals form another group. Cancellation releases only that caller;
|
|
59
|
+
* the native request is aborted when every caller in its group has left.
|
|
60
|
+
*
|
|
61
|
+
* @evidence contracts/common.md#principled-implementation A group closes before refresh starts, so its one validation is after every member's admission; later arrivals cannot inherit a check already in progress. Each consumer settles once and owns only its cancellation.
|
|
62
|
+
* @evidence contracts/common.md#clear-and-simple-design Admission groups callers, refresh owns artifact synchronization and atomic model replacement, and the group's controller owns the shared producer independently of caller signals.
|
|
63
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Sharing is justified by admission before validation, without a clock, cooldown or quiet-watcher assumption. The last active consumer's abort cancels shared work and retires a peer with an outstanding native request rather than returning fabricated facts.
|
|
64
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs state the admission boundary and distinguish individual cancellation from producer cancellation; receive separately states its validation premise.
|
|
65
|
+
* @evidence contracts/performance.md#efficient-algorithms Set insertion/removal is expected constant time per consumer and settlement visits each live consumer once. One frame and artifact validation serve each group; changed transactions retain complete validation and reference scans while equivalent immutable projection components and ordered index buckets are reused.
|
|
66
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Callers admitted before a refresh starts share its validation and immutable model. A later group validates again, changed responses replace memory atomically, and retirement clears reusable generation state.
|
|
67
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Queued groups and live consumer sets grow with outstanding demand. Settlement removes consumers and abort listeners immediately; completed queue callbacks release their groups, while one current peer/model/store remains session-owned.
|
|
68
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation queues a request and calls injected host operations; it opens no file or process itself.
|
|
69
|
+
*/
|
|
70
|
+
graph(options = {}) {
|
|
71
|
+
if (this.closed) {
|
|
72
|
+
return Promise.reject(new Error("@ttsc/graph: native session is closed"));
|
|
73
|
+
}
|
|
74
|
+
let resolve;
|
|
75
|
+
let reject;
|
|
76
|
+
let group = this.waiting;
|
|
77
|
+
const created = group === undefined;
|
|
78
|
+
if (group === undefined) {
|
|
79
|
+
group = {
|
|
80
|
+
controller: new AbortController(),
|
|
81
|
+
started: false,
|
|
82
|
+
consumers: new Set(),
|
|
83
|
+
};
|
|
84
|
+
this.waiting = group;
|
|
85
|
+
}
|
|
86
|
+
const consumer = {
|
|
87
|
+
settled: false,
|
|
88
|
+
resolve: undefined,
|
|
89
|
+
reject: undefined,
|
|
90
|
+
};
|
|
91
|
+
const result = new Promise((res, rej) => {
|
|
92
|
+
resolve = (graph) => {
|
|
93
|
+
if (consumer.settled)
|
|
94
|
+
return;
|
|
95
|
+
consumer.settled = true;
|
|
96
|
+
group.consumers.delete(consumer);
|
|
97
|
+
options.signal?.removeEventListener("abort", cancelQueued);
|
|
98
|
+
res(graph);
|
|
99
|
+
};
|
|
100
|
+
reject = (error) => {
|
|
101
|
+
if (consumer.settled)
|
|
102
|
+
return;
|
|
103
|
+
consumer.settled = true;
|
|
104
|
+
group.consumers.delete(consumer);
|
|
105
|
+
options.signal?.removeEventListener("abort", cancelQueued);
|
|
106
|
+
rej(error);
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
const cancelQueued = () => {
|
|
110
|
+
reject(cancelledError(options.signal));
|
|
111
|
+
if (group.started && group.consumers.size === 0)
|
|
112
|
+
group.controller.abort(options.signal?.reason);
|
|
113
|
+
};
|
|
114
|
+
consumer.resolve = resolve;
|
|
115
|
+
consumer.reject = reject;
|
|
116
|
+
group.consumers.add(consumer);
|
|
117
|
+
if (options.signal?.aborted) {
|
|
118
|
+
reject(cancelledError(options.signal));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
options.signal?.addEventListener("abort", cancelQueued, { once: true });
|
|
122
|
+
}
|
|
123
|
+
if (!created)
|
|
124
|
+
return result;
|
|
125
|
+
this.queue = this.queue
|
|
126
|
+
.catch(() => undefined)
|
|
127
|
+
.then(async () => {
|
|
128
|
+
group.started = true;
|
|
129
|
+
if (this.waiting === group)
|
|
130
|
+
this.waiting = undefined;
|
|
131
|
+
if (group.consumers.size === 0)
|
|
132
|
+
return;
|
|
133
|
+
try {
|
|
134
|
+
const graph = await this.refresh(group.controller.signal);
|
|
135
|
+
for (const item of group.consumers)
|
|
136
|
+
item.resolve(graph);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
for (const item of group.consumers)
|
|
140
|
+
item.reject(asError(error));
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Close the native session. Safe to call more than once.
|
|
147
|
+
*
|
|
148
|
+
* Retires artifact sidecars and rejects pending native requests. Queued
|
|
149
|
+
* requests observe the closed state before they can create another child.
|
|
150
|
+
*
|
|
151
|
+
* @evidence contracts/common.md#principled-implementation The closed flag precedes sidecar disposal and child failure, so every pending or subsequent native operation observes retired ownership.
|
|
152
|
+
* @evidence contracts/common.md#clear-and-simple-design The explicit close path reuses failChild/failPending cleanup instead of a second cancellation implementation.
|
|
153
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Disposing a session cannot trigger a compensating respawn or pretend outstanding requests succeeded.
|
|
154
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose documents idempotence, pending rejection and queued-request behavior.
|
|
155
|
+
* @evidence contracts/performance.md#efficient-algorithms Shutdown invokes the artifact host once and visits pending owners once; the actual peer adapter owns any native kill timer.
|
|
156
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Closure ends this owner's permission to reuse native Program, model and sidecars; subsequent graph calls reject.
|
|
157
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The host retires artifact sidecars, pending listeners are removed, current model/shards are cleared and peer.close transfers reader/process disposal to its actual adapter.
|
|
158
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation marks the state closed and calls the injected host and peer close operations; the process work lives there.
|
|
159
|
+
*/
|
|
160
|
+
close() {
|
|
161
|
+
if (this.closing !== undefined)
|
|
162
|
+
return this.closing;
|
|
163
|
+
this.closed = true;
|
|
164
|
+
const hostClose = Promise.resolve().then(() => this.host.close());
|
|
165
|
+
void hostClose.catch(() => undefined);
|
|
166
|
+
const error = new Error("@ttsc/graph: native session closed");
|
|
167
|
+
if (this.child !== undefined)
|
|
168
|
+
this.failChild(this.child, error);
|
|
169
|
+
else
|
|
170
|
+
this.failPending(error);
|
|
171
|
+
this.closing = (async () => {
|
|
172
|
+
await this.queue;
|
|
173
|
+
const results = await Promise.allSettled([
|
|
174
|
+
hostClose,
|
|
175
|
+
...this.retirements,
|
|
176
|
+
]);
|
|
177
|
+
const failures = results
|
|
178
|
+
.filter((result) => result.status === "rejected")
|
|
179
|
+
.map((result) => result.reason);
|
|
180
|
+
if (failures.length > 0)
|
|
181
|
+
throw new AggregateError(failures, "@ttsc/graph: session shutdown failed");
|
|
182
|
+
})();
|
|
183
|
+
void this.closing.catch(() => undefined);
|
|
184
|
+
return this.closing;
|
|
185
|
+
}
|
|
186
|
+
async refresh(signal) {
|
|
187
|
+
if (this.closed)
|
|
188
|
+
throw new Error("@ttsc/graph: native session is closed");
|
|
189
|
+
await Promise.all(this.retirements);
|
|
190
|
+
if (this.closed)
|
|
191
|
+
throw new Error("@ttsc/graph: native session is closed");
|
|
192
|
+
// The protocol version and envelope shape were settled by the host decoder,
|
|
193
|
+
// before this frame was ever routed here.
|
|
194
|
+
await this.host.beforeRequest(signal);
|
|
195
|
+
if (this.closed)
|
|
196
|
+
throw new Error("@ttsc/graph: native session is closed");
|
|
197
|
+
const response = await this.request(signal);
|
|
198
|
+
this.assertResponseSemantics(response);
|
|
199
|
+
if (response.error !== undefined) {
|
|
200
|
+
throw new Error(`@ttsc/graph: ${response.error}`);
|
|
201
|
+
}
|
|
202
|
+
if (response.changed) {
|
|
203
|
+
if (response.snapshot !== undefined) {
|
|
204
|
+
try {
|
|
205
|
+
this.current = this.shardStore.applyProjection(response.snapshot, (dump) => TtscGraphMemory_1.TtscGraphMemory.fromResident(dump, this.current));
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
const failure = asError(error);
|
|
209
|
+
if (this.child !== undefined)
|
|
210
|
+
this.failChild(this.child, failure);
|
|
211
|
+
throw failure;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else if (response.dump !== undefined) {
|
|
215
|
+
// A serve-protocol-v1 binary predating graph shard negotiation ignores
|
|
216
|
+
// the optional request field and retains the complete-dump response.
|
|
217
|
+
this.current = TtscGraphMemory_1.TtscGraphMemory.from(response.dump);
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
throw new Error(`@ttsc/graph: native ${response.mode} response omitted both graph snapshot protocol v${String(GRAPH_SNAPSHOT_PROTOCOL_VERSION)} data and a compatible dump`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (this.current === undefined) {
|
|
224
|
+
throw new Error("@ttsc/graph: native session returned no initial graph snapshot");
|
|
225
|
+
}
|
|
226
|
+
return this.current;
|
|
227
|
+
}
|
|
228
|
+
assertResponseSemantics(response) {
|
|
229
|
+
const bodies = Number(response.dump !== undefined) +
|
|
230
|
+
Number(response.snapshot !== undefined);
|
|
231
|
+
let problem;
|
|
232
|
+
if (response.error !== undefined) {
|
|
233
|
+
if (response.mode !== "error" || response.changed || bodies !== 0) {
|
|
234
|
+
problem = "an error response carried snapshot state";
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
else if (response.mode === "error") {
|
|
238
|
+
problem = "an error-mode response omitted its error";
|
|
239
|
+
}
|
|
240
|
+
else if (response.changed) {
|
|
241
|
+
if (response.mode === "unchanged" || bodies !== 1) {
|
|
242
|
+
problem = "a changed response did not carry exactly one snapshot body";
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else if (response.mode !== "unchanged" || bodies !== 0) {
|
|
246
|
+
problem = "an unchanged response carried changed mode or snapshot state";
|
|
247
|
+
}
|
|
248
|
+
if (problem === undefined)
|
|
249
|
+
return;
|
|
250
|
+
const error = new Error(`@ttsc/graph: native session returned ${problem}`);
|
|
251
|
+
if (this.child !== undefined)
|
|
252
|
+
this.failChild(this.child, error);
|
|
253
|
+
throw error;
|
|
254
|
+
}
|
|
255
|
+
request(signal) {
|
|
256
|
+
if (signal?.aborted)
|
|
257
|
+
throw cancelledError(signal);
|
|
258
|
+
const child = this.ensureChild();
|
|
259
|
+
const id = ++this.nextId;
|
|
260
|
+
return new Promise((resolve, reject) => {
|
|
261
|
+
const pending = {
|
|
262
|
+
child,
|
|
263
|
+
resolve,
|
|
264
|
+
reject,
|
|
265
|
+
signal,
|
|
266
|
+
};
|
|
267
|
+
if (signal !== undefined) {
|
|
268
|
+
pending.abort = () => this.failChild(child, cancelledError(signal, child));
|
|
269
|
+
signal.addEventListener("abort", pending.abort, { once: true });
|
|
270
|
+
}
|
|
271
|
+
this.pending.set(id, pending);
|
|
272
|
+
if (signal?.aborted) {
|
|
273
|
+
pending.abort();
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
child.write(`${JSON.stringify({
|
|
277
|
+
id,
|
|
278
|
+
graphSnapshotVersion: GRAPH_SNAPSHOT_PROTOCOL_VERSION,
|
|
279
|
+
// Empty when the project publishes nothing, which withdraws whatever
|
|
280
|
+
// the server holds: a publisher the user removed must stop being
|
|
281
|
+
// answered with, and omitting the field instead would say only that
|
|
282
|
+
// this client has no opinion. Omitted only before a child exists,
|
|
283
|
+
// which no request reaches.
|
|
284
|
+
artifacts: this.host.artifacts(),
|
|
285
|
+
})}\n`, (error) => {
|
|
286
|
+
if (error === null || error === undefined)
|
|
287
|
+
return;
|
|
288
|
+
if (this.pending.get(id) !== pending)
|
|
289
|
+
return;
|
|
290
|
+
this.failChild(child, new Error(`@ttsc/graph: could not request native snapshot: ${error.message}`));
|
|
291
|
+
});
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
ensureChild() {
|
|
295
|
+
if (this.closed)
|
|
296
|
+
throw new Error("@ttsc/graph: native session is closed");
|
|
297
|
+
if (this.child !== undefined && this.child.alive())
|
|
298
|
+
return this.child;
|
|
299
|
+
const child = this.host.open({
|
|
300
|
+
line: (line) => {
|
|
301
|
+
if (this.child !== child)
|
|
302
|
+
return;
|
|
303
|
+
try {
|
|
304
|
+
this.receive(child, this.host.decode(line));
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
this.failChild(child, asError(error));
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
error: (error) => this.failChild(child, new Error(`@ttsc/graph: native session failed: ${error.message}`)),
|
|
311
|
+
exit: (code, signal) => this.failChild(child, new Error(`@ttsc/graph: native session exited (code=${String(code)}, signal=${String(signal)})${stderrSuffix(child)}`)),
|
|
312
|
+
});
|
|
313
|
+
this.child = child;
|
|
314
|
+
return child;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Admit a decoded envelope from the current peer; stale peers cannot publish.
|
|
318
|
+
*
|
|
319
|
+
* Callers must supply the actual decoder's validated envelope. This operation
|
|
320
|
+
* checks body schema agreement and correlation; it does not substitute for
|
|
321
|
+
* full envelope shape validation.
|
|
322
|
+
*
|
|
323
|
+
* @evidence contracts/common.md#principled-implementation Peer identity precedes body compatibility and request-id lookup; only the matching pending owner may receive this typed envelope.
|
|
324
|
+
* @evidence contracts/common.md#clear-and-simple-design Wire shape belongs to the decoder; body version and pending correlation belong to the state that will consume its generation.
|
|
325
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Unknown request ids cannot settle the live caller, and incompatible body versions retire ownership rather than trusting absent fields.
|
|
326
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states the validated-input premise and the checks this operation actually performs.
|
|
327
|
+
* @evidence contracts/performance.md#efficient-algorithms Schema checks and pending-map lookup are constant-time before one settlement; body facts are processed by refresh only for the matching request.
|
|
328
|
+
* @evidence contracts/performance.md#reuse-equivalent-work This routes a validated frame; refresh alone permits memory reuse after an unchanged response, and schema failure clears the reusable peer generation.
|
|
329
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Settlement removes exactly one pending entry and its abort listener; mismatch retirement clears this peer's current model/store and fails its pending owners.
|
|
330
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation correlates a decoded envelope with its pending request in memory.
|
|
331
|
+
*/
|
|
332
|
+
receive(child, response) {
|
|
333
|
+
if (this.child !== child)
|
|
334
|
+
return;
|
|
335
|
+
// The envelope's version is not the body's, and only the envelope has been
|
|
336
|
+
// held to one so far. A producer can speak this protocol and still carry a
|
|
337
|
+
// dump from another schema — the two move apart the moment a node field is
|
|
338
|
+
// added without the frame around it changing — and then the facts that field
|
|
339
|
+
// holds are silently absent rather than refused. `literals` is exactly that
|
|
340
|
+
// shape: an older producer resolves no value set, so a union comes back
|
|
341
|
+
// looking like a type with no members. Hold the body to its own number too,
|
|
342
|
+
// once the frame is understood.
|
|
343
|
+
if ((response.dump !== undefined &&
|
|
344
|
+
response.dump.provenance.schemaVersion !== loadGraph_1.DUMP_SCHEMA_VERSION) ||
|
|
345
|
+
(response.snapshot !== undefined &&
|
|
346
|
+
response.snapshot.schemaVersion !== loadGraph_1.DUMP_SCHEMA_VERSION)) {
|
|
347
|
+
// Session-wide, for the same reason the protocol mismatch above is: it is
|
|
348
|
+
// the wrong binary, not one bad frame.
|
|
349
|
+
this.failChild(child, new Error(`@ttsc/graph: ttscgraph sends dump schema v${String(response.dump?.provenance.schemaVersion ??
|
|
350
|
+
response.snapshot?.schemaVersion)}, this client reads v${String(loadGraph_1.DUMP_SCHEMA_VERSION)}. ` +
|
|
351
|
+
"Install a matching `ttsc` (the binary resolves from the target " +
|
|
352
|
+
"project, or from TTSC_GRAPH_BINARY)."));
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const pending = this.pending.get(response.id);
|
|
356
|
+
if (pending === undefined || pending.child !== child)
|
|
357
|
+
return;
|
|
358
|
+
this.settlePending(response.id, pending, response);
|
|
359
|
+
}
|
|
360
|
+
failChild(child, error) {
|
|
361
|
+
if (this.child !== child)
|
|
362
|
+
return;
|
|
363
|
+
this.child = undefined;
|
|
364
|
+
this.current = undefined;
|
|
365
|
+
this.shardStore = new TtscGraphShardStore_1.TtscGraphShardStore();
|
|
366
|
+
child.close(false);
|
|
367
|
+
this.failPending(error, child);
|
|
368
|
+
// Even an exited process must join its stdio before release is known.
|
|
369
|
+
const retirement = Promise.resolve(child.close(true));
|
|
370
|
+
this.retirements.add(retirement);
|
|
371
|
+
void retirement.then(() => this.retirements.delete(retirement), () => undefined);
|
|
372
|
+
}
|
|
373
|
+
failPending(error, child) {
|
|
374
|
+
for (const [id, pending] of this.pending) {
|
|
375
|
+
if (child === undefined || pending.child === child) {
|
|
376
|
+
this.settlePending(id, pending, error);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
settlePending(id, pending, result) {
|
|
381
|
+
if (this.pending.get(id) !== pending)
|
|
382
|
+
return;
|
|
383
|
+
this.pending.delete(id);
|
|
384
|
+
if (pending.signal !== undefined && pending.abort !== undefined) {
|
|
385
|
+
pending.signal.removeEventListener("abort", pending.abort);
|
|
386
|
+
}
|
|
387
|
+
if (result instanceof Error)
|
|
388
|
+
pending.reject(result);
|
|
389
|
+
else
|
|
390
|
+
pending.resolve(result);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
exports.TtscGraphSessionState = TtscGraphSessionState;
|
|
394
|
+
function cancelledError(signal, child) {
|
|
395
|
+
const error = new Error(`@ttsc/graph: native snapshot request cancelled${abortDetail(signal)}${child === undefined ? "" : stderrSuffix(child)}`);
|
|
396
|
+
error.name = "AbortError";
|
|
397
|
+
return error;
|
|
398
|
+
}
|
|
399
|
+
function abortDetail(signal) {
|
|
400
|
+
const reason = signal?.reason;
|
|
401
|
+
if (reason === undefined)
|
|
402
|
+
return "";
|
|
403
|
+
try {
|
|
404
|
+
return `: ${reason instanceof Error ? reason.message : String(reason)}`;
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
return "";
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
function stderrSuffix(child) {
|
|
411
|
+
const stderr = child.stderr.trim();
|
|
412
|
+
return stderr === "" ? "" : `: ${stderr}`;
|
|
413
|
+
}
|
|
414
|
+
function asError(error) {
|
|
415
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
416
|
+
}
|
|
417
|
+
//# sourceMappingURL=TtscGraphSessionState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphSessionState.js","sourceRoot":"","sources":["../../src/model/TtscGraphSessionState.ts"],"names":[],"mappings":";;;AAEA,uDAAoD;AACpD,+DAA4D;AAC5D,2CAAkD;AAElD,MAAM,+BAA+B,GAAG,CAAC,CAAC;AAU1C;;;;;;;;;;;;;;;;GAgBG;AACH;IAsBsC,IAAI;IArBhC,KAAK,CAA2C;IAChD,MAAM,GAAG,CAAC,CAAC;IACF,OAAO,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC9C,KAAK,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IACzC,OAAO,CAUD;IACN,OAAO,CAA8B;IACrC,UAAU,GAAG,IAAI,yCAAmB,EAAE,CAAC;IACvC,MAAM,GAAG,KAAK,CAAC;IACf,OAAO,CAA4B;IAC1B,WAAW,GAAG,IAAI,GAAG,EAAiB,CAAC;IAExD,YAAoC,IAAgC;oBAAhC,IAAI;IAA+B,CAAC;IAExE;;;;;;;;;;;OAWG;IACI,OAAO;QACZ,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC;IAClC,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACI,KAAK,CACV,OAAO,GAA6B,EAAE;QAEtC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,OAAO,OAAO,CAAC,MAAM,CA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;IAC1B,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,MAAoB;IACvC,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC;IAC9B,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACpC,IAAI,CAAC;QACH,OAAO,KAAK,MAAM,YAAY,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,YAAY,CAAC,KAAmC;IACvD,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,OAAO,MAAM,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC;AAC5C,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
import { ITtscGraphDump } from "../structures/ITtscGraphDump";
|
|
2
2
|
import { ITtscGraphSnapshot } from "../structures/ITtscGraphSnapshot";
|
|
3
|
-
|
|
3
|
+
import { TtscGraphReadonly } from "./TtscGraphReadonly";
|
|
4
|
+
/**
|
|
5
|
+
* Atomic validator and assembler for native ttscgraph shard transactions.
|
|
6
|
+
*
|
|
7
|
+
* A transaction is committed only after base coordinates, digests, ownership
|
|
8
|
+
* and the complete manifest agree. Rejected transactions preserve prior state.
|
|
9
|
+
*
|
|
10
|
+
* @evidence contracts/common.md#principled-implementation Content digests and consecutive base coordinates qualify source-owned shards before cross-shard assembly and atomic state replacement.
|
|
11
|
+
* @evidence contracts/common.md#clear-and-simple-design The store owns committed generation state; private validation and assembly helpers keep wire checks outside consumers.
|
|
12
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Stale bases or inconsistent contents are rejected rather than merged under compensating guesses.
|
|
13
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states the commit boundary and preserved prior state; public methods describe validation and canonical hashing.
|
|
14
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms apply owns staged validation and assembly algorithms; this declaration defines committed state.
|
|
15
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work apply establishes permission to reuse unchanged shard payloads.
|
|
16
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources apply owns population replacement and the session owns store retirement; the class declaration performs no independent lifecycle transition.
|
|
17
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation validates and assembles in-memory shard objects; no file, path or process.
|
|
18
|
+
*/
|
|
4
19
|
export declare class TtscGraphShardStore {
|
|
5
20
|
static readonly PROTOCOL_VERSION = 1;
|
|
6
21
|
private sequence;
|
|
@@ -8,9 +23,55 @@ export declare class TtscGraphShardStore {
|
|
|
8
23
|
private project;
|
|
9
24
|
private tsconfig;
|
|
10
25
|
private shards;
|
|
11
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Validate and atomically commit one complete or base-generation delta.
|
|
28
|
+
*
|
|
29
|
+
* Throws on invalid coordinates, repeated changes, content/manifest mismatch
|
|
30
|
+
* or inconsistent ownership. The prior generation remains committed until
|
|
31
|
+
* full dump assembly succeeds. Retained shard records are detached and
|
|
32
|
+
* frozen; the returned dump owns mutable copies of those records.
|
|
33
|
+
*
|
|
34
|
+
* @evidence contracts/common.md#principled-implementation A staged shard map validates changes, exact manifest and generation hash before assembly establishes node/edge/config ownership and commits state together.
|
|
35
|
+
* @evidence contracts/common.md#clear-and-simple-design One operation owns transaction staging and the final state swap; helper validators do not independently mutate committed fields.
|
|
36
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts A bad delta is not retried against an invented base or partially applied to the resident store.
|
|
37
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose documents rejection causes and the unchanged-state guarantee before the tags.
|
|
38
|
+
* @evidence contracts/performance.md#efficient-algorithms Map staging and manifest/ownership scans are linear in shards and facts; canonical hashes cost changed content bytes and deterministic dump sorting costs O(N log N + E log E).
|
|
39
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Unchanged frozen shard payloads retain their validated digest in the staged map; only upserts are rehashed, while the generation manifest validates continued membership and mutable output copies cannot change retained facts.
|
|
40
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The store retains only the current manifest's shards and coordinates; commit drops removed payloads and rejection leaves the prior generation intact.
|
|
41
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation validates and assembles shard objects in memory and hashes JSON text with node:crypto; no file, path or process.
|
|
42
|
+
*/
|
|
12
43
|
apply(transaction: ITtscGraphSnapshot.ITransaction): ITtscGraphDump;
|
|
13
|
-
/**
|
|
44
|
+
/**
|
|
45
|
+
* Validate a staged immutable population and commit only after projection.
|
|
46
|
+
*
|
|
47
|
+
* The callback borrows store-owned frozen facts, not caller DTOs. A thrown
|
|
48
|
+
* projection leaves every committed coordinate and shard unchanged.
|
|
49
|
+
*
|
|
50
|
+
* @evidence contracts/common.md#principled-implementation Full transaction/manifest/ownership validation precedes projection and the synchronous commit; callback failure cannot publish a partial generation.
|
|
51
|
+
* @evidence contracts/common.md#clear-and-simple-design Public mutable apply and resident immutable projection share the same staged validator and commit boundary.
|
|
52
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Immutable borrowing does not remove any digest, universe, owner or edge check; apply still returns a detached mutable DTO.
|
|
53
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states input ownership and callback-failure atomicity.
|
|
54
|
+
* @evidence contracts/performance.md#efficient-algorithms Changed shards are cloned/hashed once; full manifest/ownership scans and deterministic sorting remain. The resident callback avoids full nested mutable materialization.
|
|
55
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Retained frozen payload identities survive staged validation, qualifying downstream reuse independently of caller-owned transactions.
|
|
56
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Commit retains only current shards; rejected staging and callback values remain local, with prior state intact.
|
|
57
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Hashes and validates in-memory records without filesystem or process operations.
|
|
58
|
+
*/
|
|
59
|
+
applyProjection<T>(transaction: ITtscGraphSnapshot.ITransaction, project: (dump: TtscGraphReadonly<ITtscGraphDump>) => T): T;
|
|
60
|
+
/**
|
|
61
|
+
* SHA-256 over the producer's deterministic Go JSON encoding.
|
|
62
|
+
*
|
|
63
|
+
* JSON-serializable wire shards use producer field order and Go's escaping
|
|
64
|
+
* for HTML-sensitive characters and Unicode line separators.
|
|
65
|
+
*
|
|
66
|
+
* @evidence contracts/common.md#principled-implementation Canonical Go-compatible JSON escaping and UTF-8 SHA-256 reproduce the producer's content witness for the supplied wire shard.
|
|
67
|
+
* @evidence contracts/common.md#clear-and-simple-design One helper shares canonical digest logic with generation verification.
|
|
68
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Digest checks compare content rather than a size/time proxy or expected fixture hash.
|
|
69
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose states serializability, ordering and escaping premises needed for cross-language digest equivalence.
|
|
70
|
+
* @evidence contracts/performance.md#efficient-algorithms Serialization preserves the wire object's insertion order, escapes Go-sensitive characters in one text pass and hashes the resulting bytes once.
|
|
71
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work This digest primitive computes one shard identity; apply coordinates continued reuse of validated payloads.
|
|
72
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The digest string transfers to its caller and the canonical buffer is local to this computation.
|
|
73
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation hashes the canonical JSON text of one shard with node:crypto; no file, path or process.
|
|
74
|
+
*/
|
|
14
75
|
static shardDigest(shard: ITtscGraphSnapshot.IShard): string;
|
|
15
76
|
private assertCoordinates;
|
|
16
77
|
}
|