@ttsc/graph 0.19.3 → 0.20.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/lib/TtscGraphApplication.js +3 -1
- package/lib/TtscGraphApplication.js.map +1 -1
- package/lib/bin.js +15 -3
- package/lib/bin.js.map +1 -1
- package/lib/index.d.ts +13 -2
- package/lib/index.js +24 -30
- package/lib/index.js.map +1 -1
- package/lib/launcherArgs.d.ts +24 -0
- package/lib/launcherArgs.js +136 -0
- package/lib/launcherArgs.js.map +1 -0
- package/lib/model/TtscGraphMemory.d.ts +9 -5
- package/lib/model/TtscGraphMemory.js +35 -58
- package/lib/model/TtscGraphMemory.js.map +1 -1
- package/lib/model/TtscGraphNodeId.d.ts +17 -0
- package/lib/model/TtscGraphNodeId.js +69 -0
- package/lib/model/TtscGraphNodeId.js.map +1 -0
- package/lib/model/TtscGraphSession.d.ts +23 -7
- package/lib/model/TtscGraphSession.js +402 -210
- package/lib/model/TtscGraphSession.js.map +1 -1
- package/lib/model/TtscGraphSourceReader.d.ts +27 -0
- package/lib/model/TtscGraphSourceReader.js +97 -0
- package/lib/model/TtscGraphSourceReader.js.map +1 -0
- package/lib/model/loadGraph.d.ts +4 -4
- package/lib/model/loadGraph.js +233 -168
- package/lib/model/loadGraph.js.map +1 -1
- package/lib/reduce.d.ts +4 -1
- package/lib/reduce.js +112 -29
- package/lib/reduce.js.map +1 -1
- package/lib/server/createServer.js +17 -6
- package/lib/server/createServer.js.map +1 -1
- package/lib/server/pathPolicy.d.ts +6 -0
- package/lib/server/pathPolicy.js +10 -1
- package/lib/server/pathPolicy.js.map +1 -1
- package/lib/server/resolveHandle.js +22 -18
- package/lib/server/resolveHandle.js.map +1 -1
- package/lib/server/resultAudit.d.ts +41 -20
- package/lib/server/resultAudit.js +62 -34
- package/lib/server/resultAudit.js.map +1 -1
- package/lib/server/resultNext.d.ts +5 -0
- package/lib/server/resultNext.js.map +1 -1
- package/lib/server/runDetails.d.ts +2 -2
- package/lib/server/runDetails.js +54 -108
- package/lib/server/runDetails.js.map +1 -1
- package/lib/server/runEntrypoints.js +1 -1
- package/lib/server/runEntrypoints.js.map +1 -1
- package/lib/server/runLookup.js +1 -1
- package/lib/server/runLookup.js.map +1 -1
- package/lib/server/runTour.js +113 -30
- package/lib/server/runTour.js.map +1 -1
- package/lib/server/runTrace.d.ts +22 -0
- package/lib/server/runTrace.js +293 -63
- package/lib/server/runTrace.js.map +1 -1
- package/lib/structures/ITtscGraphDump.d.ts +13 -13
- package/lib/structures/ITtscGraphNode.d.ts +34 -0
- package/lib/structures/ITtscGraphTrace.d.ts +1 -1
- package/lib/view.js +18 -28
- package/lib/view.js.map +1 -1
- package/package.json +5 -5
- package/src/TtscGraphApplication.ts +5 -1
- package/src/bin.ts +13 -3
- package/src/index.ts +34 -27
- package/src/launcherArgs.ts +168 -0
- package/src/model/TtscGraphMemory.ts +34 -60
- package/src/model/TtscGraphNodeId.ts +77 -0
- package/src/model/TtscGraphSession.ts +228 -55
- package/src/model/TtscGraphSourceReader.ts +117 -0
- package/src/model/loadGraph.ts +4 -4
- package/src/reduce.ts +136 -31
- package/src/server/createServer.ts +12 -2
- package/src/server/pathPolicy.ts +10 -1
- package/src/server/resolveHandle.ts +21 -22
- package/src/server/resultAudit.ts +64 -33
- package/src/server/resultNext.ts +6 -0
- package/src/server/runDetails.ts +57 -113
- package/src/server/runEntrypoints.ts +1 -1
- package/src/server/runLookup.ts +1 -1
- package/src/server/runTour.ts +133 -39
- package/src/server/runTrace.ts +401 -65
- package/src/structures/ITtscGraphDump.ts +13 -13
- package/src/structures/ITtscGraphNode.ts +40 -0
- package/src/structures/ITtscGraphTrace.ts +1 -1
- package/src/view.ts +25 -23
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseTtscGraphNodeId = parseTtscGraphNodeId;
|
|
4
|
+
exports.writeTtscGraphNodeId = writeTtscGraphNodeId;
|
|
5
|
+
exports.ttscGraphNodeIdPath = ttscGraphNodeIdPath;
|
|
6
|
+
/**
|
|
7
|
+
* Decode the graph's position-invariant `path#name:kind` identity.
|
|
8
|
+
*
|
|
9
|
+
* The producer quotes `#` and `\\` inside path and name. This reader also
|
|
10
|
+
* accepts pre-codec ordinary ids, so a current package can read an older dump.
|
|
11
|
+
*/
|
|
12
|
+
function parseTtscGraphNodeId(id) {
|
|
13
|
+
const hash = graphNodeIdHash(id);
|
|
14
|
+
if (hash < 0)
|
|
15
|
+
return undefined;
|
|
16
|
+
const tail = id.slice(hash + 1);
|
|
17
|
+
if (tail === "")
|
|
18
|
+
return undefined;
|
|
19
|
+
const colon = tail.lastIndexOf(":");
|
|
20
|
+
if (colon === 0 || colon === tail.length - 1)
|
|
21
|
+
return undefined;
|
|
22
|
+
return {
|
|
23
|
+
path: unescapeGraphNodeIdPart(id.slice(0, hash)),
|
|
24
|
+
name: unescapeGraphNodeIdPart(colon < 0 ? tail : tail.slice(0, colon)),
|
|
25
|
+
...(colon < 0 ? {} : { kind: tail.slice(colon + 1) }),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Encode a symbol identity without making its component boundaries ambiguous. */
|
|
29
|
+
function writeTtscGraphNodeId(path, name, kind) {
|
|
30
|
+
return `${escapeGraphNodeIdPart(path)}#${escapeGraphNodeIdPart(name)}:${kind}`;
|
|
31
|
+
}
|
|
32
|
+
/** Return the raw path component when id is a symbol identity. */
|
|
33
|
+
function ttscGraphNodeIdPath(id) {
|
|
34
|
+
return parseTtscGraphNodeId(id)?.path;
|
|
35
|
+
}
|
|
36
|
+
function escapeGraphNodeIdPart(value) {
|
|
37
|
+
return value.replaceAll("\\", "\\\\").replaceAll("#", "\\#");
|
|
38
|
+
}
|
|
39
|
+
function unescapeGraphNodeIdPart(value) {
|
|
40
|
+
let result = "";
|
|
41
|
+
for (let index = 0; index < value.length; index++) {
|
|
42
|
+
const next = value[index + 1];
|
|
43
|
+
if (value[index] === "\\" && next !== undefined) {
|
|
44
|
+
if (next === "#" || (next === "\\" && !legacyUNCStart(value, index))) {
|
|
45
|
+
result += next;
|
|
46
|
+
index++;
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
result += value[index];
|
|
51
|
+
}
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
function legacyUNCStart(value, index) {
|
|
55
|
+
return (index === 0 && value.length > 2 && value[2] !== "\\" && value[2] !== "#");
|
|
56
|
+
}
|
|
57
|
+
function graphNodeIdHash(id) {
|
|
58
|
+
for (let index = 0; index < id.length; index++) {
|
|
59
|
+
if (id[index] !== "#")
|
|
60
|
+
continue;
|
|
61
|
+
let slashes = 0;
|
|
62
|
+
for (let slash = index - 1; slash >= 0 && id[slash] === "\\"; slash--)
|
|
63
|
+
slashes++;
|
|
64
|
+
if (slashes % 2 === 0)
|
|
65
|
+
return index;
|
|
66
|
+
}
|
|
67
|
+
return -1;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=TtscGraphNodeId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TtscGraphNodeId.js","sourceRoot":"","sources":["../../src/model/TtscGraphNodeId.ts"],"names":[],"mappings":";;;;;AAOA;;;;;GAKG;AACH,8BAAqC,EAAU;IAC7C,MAAM,IAAI,GAAG,eAAe,CAAC,EAAE,CAAC,CAAC;IACjC,IAAI,IAAI,GAAG,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,IAAI,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAChC,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO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AAI,KAAK,IAAI,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;gBACrE,MAAM,IAAI,IAAI,CAAC;gBACf,KAAK,EAAE,CAAC;gBACR,SAAS;YACX,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa;IAClD,OAAO,CACL,KAAK,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,GAAG,CACzE,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,EAAU;IACjC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/C,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG;YAAE,SAAS;QAChC,IAAI,OAAO,GAAG,CAAC,CAAC;QAChB,KAAK,IAAI,KAAK,GAAG,KAAK,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,KAAK,EAAE;YACnE,OAAO,EAAE,CAAC;QACZ,IAAI,OAAO,GAAG,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;IACtC,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { TtscGraphMemory } from "./TtscGraphMemory";
|
|
2
|
+
/** Construction options for a resident native graph session. */
|
|
3
|
+
export interface TtscGraphSessionOptions {
|
|
4
|
+
/** Project root passed to `ttscgraph serve`. */
|
|
5
|
+
cwd: string;
|
|
6
|
+
/** Project tsconfig passed to `ttscgraph serve`. */
|
|
7
|
+
tsconfig: string;
|
|
8
|
+
/** Absolute native binary path, resolved from `cwd` when omitted. */
|
|
9
|
+
binary?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Maximum time for one native snapshot response. Defaults to five minutes,
|
|
12
|
+
* which is more than ten times the published 28.7-second VS Code cold index.
|
|
13
|
+
*/
|
|
14
|
+
requestTimeoutMs?: number;
|
|
15
|
+
}
|
|
16
|
+
/** Per-call controls for a native graph refresh. */
|
|
17
|
+
export interface TtscGraphRequestOptions {
|
|
18
|
+
/** Cancel this refresh and retire its native session. */
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}
|
|
2
21
|
/**
|
|
3
22
|
* Resident bridge to `ttscgraph serve`.
|
|
4
23
|
*
|
|
@@ -11,20 +30,16 @@ export declare class TtscGraphSession {
|
|
|
11
30
|
private readonly cwd;
|
|
12
31
|
private readonly tsconfig;
|
|
13
32
|
private readonly binary;
|
|
33
|
+
private readonly requestTimeoutMs;
|
|
14
34
|
private child;
|
|
15
|
-
private stderr;
|
|
16
35
|
private nextId;
|
|
17
36
|
private readonly pending;
|
|
18
37
|
private queue;
|
|
19
38
|
private current;
|
|
20
39
|
private closed;
|
|
21
|
-
constructor(options:
|
|
22
|
-
cwd: string;
|
|
23
|
-
tsconfig: string;
|
|
24
|
-
binary?: string;
|
|
25
|
-
});
|
|
40
|
+
constructor(options: TtscGraphSessionOptions);
|
|
26
41
|
/** Return a graph for the current disk snapshot, serialized per tool call. */
|
|
27
|
-
graph(): Promise<TtscGraphMemory>;
|
|
42
|
+
graph(options?: TtscGraphRequestOptions): Promise<TtscGraphMemory>;
|
|
28
43
|
/** Close the native session. Safe to call more than once. */
|
|
29
44
|
close(): void;
|
|
30
45
|
private refresh;
|
|
@@ -33,4 +48,5 @@ export declare class TtscGraphSession {
|
|
|
33
48
|
private onLine;
|
|
34
49
|
private failChild;
|
|
35
50
|
private failPending;
|
|
51
|
+
private settlePending;
|
|
36
52
|
}
|