@cbxss/tack-typecheck 1.0.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/dist/ambient.d.ts +15 -0
- package/dist/ambient.d.ts.map +1 -0
- package/dist/ambient.js +75 -0
- package/dist/ambient.js.map +1 -0
- package/dist/checker.d.ts +15 -0
- package/dist/checker.d.ts.map +1 -0
- package/dist/checker.js +117 -0
- package/dist/checker.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TackManifest } from "@cbxss/tack-core";
|
|
2
|
+
import { type OperationPolicy } from "@cbxss/tack-codemode";
|
|
3
|
+
/**
|
|
4
|
+
* Build the self-contained ambient `.d.ts` the typechecker checks each cell
|
|
5
|
+
* against: an inline `interface`/`type` for every policy-allowed operation's
|
|
6
|
+
* input and output, the `CodeModeResult` / `TackSearchResult` / `TackDescribedTool`
|
|
7
|
+
* aliases, the shadowed-globals declarations, and the `declare global { const
|
|
8
|
+
* tools … ; function emit … }` block. Deterministic for a given manifest+policy;
|
|
9
|
+
* built once per checker.
|
|
10
|
+
*
|
|
11
|
+
* Schema-less outputs resolve to `any` (not `unknown`) so `r.data.foo` on a
|
|
12
|
+
* tool whose upstream gave no output schema isn't a false error.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildAmbientDts(manifest: TackManifest, policy?: OperationPolicy): Promise<string>;
|
|
15
|
+
//# sourceMappingURL=ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient.d.ts","sourceRoot":"","sources":["../src/ambient.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,YAAY,EAElB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,sBAAsB,CAAC;AAuB9B;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,YAAY,EACtB,MAAM,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,CAiCjB"}
|
package/dist/ambient.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { assignOperationTypeNames, CODE_MODE_RESULT_TS, listOperations } from "@cbxss/tack-core";
|
|
2
|
+
import { filterAllowedOperations, operationTypeScript } from "@cbxss/tack-codemode";
|
|
3
|
+
import { DESCRIBED_TOOL_TS, renderAmbientToolsBlock, SEARCH_RESULT_TS } from "@cbxss/tack-sdk-types";
|
|
4
|
+
/**
|
|
5
|
+
* Globals the code-mode sandbox shadows to `undefined` (or a throwing stub).
|
|
6
|
+
* Typing them `never` turns "you called `fetch`" into a crisp error instead of
|
|
7
|
+
* a confusing property-access one.
|
|
8
|
+
*/
|
|
9
|
+
const SHADOW_DECLS = [
|
|
10
|
+
"declare const fetch: never;",
|
|
11
|
+
"declare const process: never;",
|
|
12
|
+
"declare const require: never;",
|
|
13
|
+
"declare const globalThis: never;",
|
|
14
|
+
"declare const module: never;",
|
|
15
|
+
"declare const self: never;",
|
|
16
|
+
"declare const window: never;"
|
|
17
|
+
].join("\n");
|
|
18
|
+
/**
|
|
19
|
+
* Build the self-contained ambient `.d.ts` the typechecker checks each cell
|
|
20
|
+
* against: an inline `interface`/`type` for every policy-allowed operation's
|
|
21
|
+
* input and output, the `CodeModeResult` / `TackSearchResult` / `TackDescribedTool`
|
|
22
|
+
* aliases, the shadowed-globals declarations, and the `declare global { const
|
|
23
|
+
* tools … ; function emit … }` block. Deterministic for a given manifest+policy;
|
|
24
|
+
* built once per checker.
|
|
25
|
+
*
|
|
26
|
+
* Schema-less outputs resolve to `any` (not `unknown`) so `r.data.foo` on a
|
|
27
|
+
* tool whose upstream gave no output schema isn't a false error.
|
|
28
|
+
*/
|
|
29
|
+
export async function buildAmbientDts(manifest, policy) {
|
|
30
|
+
const operations = filterAllowedOperations(listOperations(manifest), policy);
|
|
31
|
+
const typeNames = assignOperationTypeNames(operations);
|
|
32
|
+
const interfaces = [];
|
|
33
|
+
const methods = [];
|
|
34
|
+
for (const operation of operations) {
|
|
35
|
+
const names = typeNames.get(operation.fullPathString);
|
|
36
|
+
if (!names) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const { inputTypeScript, outputTypeScript } = await operationTypeScript(operation, {
|
|
40
|
+
includeUnknownOutput: true,
|
|
41
|
+
unknownOutputAs: "any"
|
|
42
|
+
});
|
|
43
|
+
interfaces.push(inputTypeScript.trim());
|
|
44
|
+
interfaces.push((outputTypeScript ?? `export type ${names.outputType} = any;`).trim());
|
|
45
|
+
methods.push(toMethodLike(operation, names.inputType, names.outputType, names.resultType));
|
|
46
|
+
}
|
|
47
|
+
return [
|
|
48
|
+
...interfaces,
|
|
49
|
+
"",
|
|
50
|
+
CODE_MODE_RESULT_TS.trim(),
|
|
51
|
+
"",
|
|
52
|
+
SEARCH_RESULT_TS.trim(),
|
|
53
|
+
"",
|
|
54
|
+
DESCRIBED_TOOL_TS.trim(),
|
|
55
|
+
"",
|
|
56
|
+
SHADOW_DECLS,
|
|
57
|
+
"",
|
|
58
|
+
renderAmbientToolsBlock(methods)
|
|
59
|
+
].join("\n");
|
|
60
|
+
}
|
|
61
|
+
function toMethodLike(operation, inputType, outputType, resultType) {
|
|
62
|
+
return {
|
|
63
|
+
namespaceName: operation.namespaceName,
|
|
64
|
+
path: operation.path,
|
|
65
|
+
inputType,
|
|
66
|
+
outputType,
|
|
67
|
+
resultType,
|
|
68
|
+
inputSchema: operation.inputSchema,
|
|
69
|
+
...(operation.outputSchema ? { outputSchema: operation.outputSchema } : {}),
|
|
70
|
+
...(operation.description ? { description: operation.description } : {}),
|
|
71
|
+
examples: operation.examples,
|
|
72
|
+
...(operation.injectedArgs ? { injectedArgs: operation.injectedArgs } : {})
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=ambient.js.map
|
|
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
|
+
import type { TackManifest } from "@cbxss/tack-core";
|
|
2
|
+
import type { OperationPolicy, TypeChecker } from "@cbxss/tack-codemode";
|
|
3
|
+
export interface CreateTypeCheckerOptions {
|
|
4
|
+
readonly manifest: TackManifest;
|
|
5
|
+
readonly policy?: OperationPolicy | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A persistent in-process TypeScript language service that checks one code-mode
|
|
9
|
+
* cell at a time against a synthesized ambient `.d.ts`. The ambient + lib files
|
|
10
|
+
* are parsed once; each `check` swaps the cell's snapshot and re-checks only it
|
|
11
|
+
* (~1–5ms warm, ~100–200ms for the first call). Any internal failure returns
|
|
12
|
+
* `{ skipped: true }` — a checker fault never blocks execution.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createTypeChecker(options: CreateTypeCheckerOptions): TypeChecker;
|
|
15
|
+
//# sourceMappingURL=checker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,KAAK,EACV,eAAe,EACf,WAAW,EAIZ,MAAM,sBAAsB,CAAC;AAmB9B,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,WAAW,CAmFhF"}
|
package/dist/checker.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { basename, dirname, join } from "node:path";
|
|
2
|
+
import ts from "typescript-5";
|
|
3
|
+
import { buildAmbientDts } from "./ambient.js";
|
|
4
|
+
const CELL_PATH = "/__tack_cell.ts";
|
|
5
|
+
const AMBIENT_PATH = "/__tack_ambient.d.ts";
|
|
6
|
+
const REF_NAME = /^\$(\d+|_)$/;
|
|
7
|
+
const COMPILER_OPTIONS = {
|
|
8
|
+
noEmit: true,
|
|
9
|
+
strict: true,
|
|
10
|
+
target: ts.ScriptTarget.ES2022,
|
|
11
|
+
lib: ["lib.es2022.d.ts"],
|
|
12
|
+
types: [],
|
|
13
|
+
moduleDetection: ts.ModuleDetectionKind.Force,
|
|
14
|
+
skipLibCheck: true
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* A persistent in-process TypeScript language service that checks one code-mode
|
|
18
|
+
* cell at a time against a synthesized ambient `.d.ts`. The ambient + lib files
|
|
19
|
+
* are parsed once; each `check` swaps the cell's snapshot and re-checks only it
|
|
20
|
+
* (~1–5ms warm, ~100–200ms for the first call). Any internal failure returns
|
|
21
|
+
* `{ skipped: true }` — a checker fault never blocks execution.
|
|
22
|
+
*/
|
|
23
|
+
export function createTypeChecker(options) {
|
|
24
|
+
let service;
|
|
25
|
+
let ambientText = "";
|
|
26
|
+
let cellText = "";
|
|
27
|
+
let cellVersion = 0;
|
|
28
|
+
const libDir = dirname(ts.getDefaultLibFilePath(COMPILER_OPTIONS));
|
|
29
|
+
const readFile = (fileName) => {
|
|
30
|
+
if (fileName === AMBIENT_PATH)
|
|
31
|
+
return ambientText;
|
|
32
|
+
if (fileName === CELL_PATH)
|
|
33
|
+
return cellText;
|
|
34
|
+
return ts.sys.readFile(toLibPath(fileName, libDir));
|
|
35
|
+
};
|
|
36
|
+
const initService = async () => {
|
|
37
|
+
if (service)
|
|
38
|
+
return service;
|
|
39
|
+
ambientText = await buildAmbientDts(options.manifest, options.policy);
|
|
40
|
+
const host = {
|
|
41
|
+
getScriptFileNames: () => [AMBIENT_PATH, CELL_PATH],
|
|
42
|
+
getScriptVersion: (fileName) => (fileName === CELL_PATH ? String(cellVersion) : "1"),
|
|
43
|
+
getScriptSnapshot: (fileName) => {
|
|
44
|
+
const text = readFile(fileName);
|
|
45
|
+
return text === undefined ? undefined : ts.ScriptSnapshot.fromString(text);
|
|
46
|
+
},
|
|
47
|
+
getCurrentDirectory: () => "/",
|
|
48
|
+
getCompilationSettings: () => COMPILER_OPTIONS,
|
|
49
|
+
getDefaultLibFileName: (o) => "/" + ts.getDefaultLibFileName(o),
|
|
50
|
+
fileExists: (fileName) => fileName === AMBIENT_PATH || fileName === CELL_PATH || ts.sys.fileExists(toLibPath(fileName, libDir)),
|
|
51
|
+
readFile,
|
|
52
|
+
readDirectory: (...args) => ts.sys.readDirectory(...args),
|
|
53
|
+
getDirectories: (dir) => ts.sys.getDirectories(dir),
|
|
54
|
+
directoryExists: (dir) => ts.sys.directoryExists(dir),
|
|
55
|
+
useCaseSensitiveFileNames: () => true
|
|
56
|
+
};
|
|
57
|
+
service = ts.createLanguageService(host, ts.createDocumentRegistry());
|
|
58
|
+
return service;
|
|
59
|
+
};
|
|
60
|
+
return {
|
|
61
|
+
check: async (code, context) => {
|
|
62
|
+
try {
|
|
63
|
+
const ls = await initService();
|
|
64
|
+
const decls = scopeDecls(context?.scopeNames ?? []);
|
|
65
|
+
// Lines before the user's first line: the scope decls + the wrapper's
|
|
66
|
+
// `async function …` line. `getLineAndCharacterOfPosition` is 0-based.
|
|
67
|
+
const offset = (decls ? decls.split("\n").length : 0) + 1;
|
|
68
|
+
cellText = `${decls}${decls ? "\n" : ""}async function __tackCheckCell(): Promise<any> {\n${code}\n}\n`;
|
|
69
|
+
cellVersion += 1;
|
|
70
|
+
const diagnostics = [
|
|
71
|
+
...ls.getSyntacticDiagnostics(CELL_PATH),
|
|
72
|
+
...ls.getSemanticDiagnostics(CELL_PATH)
|
|
73
|
+
];
|
|
74
|
+
const source = ls.getProgram()?.getSourceFile(CELL_PATH);
|
|
75
|
+
if (!source) {
|
|
76
|
+
return { diagnostics: [], skipped: true, skipReason: "no cell source file" };
|
|
77
|
+
}
|
|
78
|
+
const mapped = [];
|
|
79
|
+
for (const d of diagnostics) {
|
|
80
|
+
if (d.file?.fileName !== CELL_PATH || d.start === undefined)
|
|
81
|
+
continue;
|
|
82
|
+
const lc = source.getLineAndCharacterOfPosition(d.start);
|
|
83
|
+
const line = lc.line - offset + 1;
|
|
84
|
+
if (line < 1)
|
|
85
|
+
continue;
|
|
86
|
+
mapped.push({
|
|
87
|
+
line,
|
|
88
|
+
column: lc.character + 1,
|
|
89
|
+
code: `TS${d.code}`,
|
|
90
|
+
message: ts.flattenDiagnosticMessageText(d.messageText, "\n"),
|
|
91
|
+
category: d.category === ts.DiagnosticCategory.Error ? "error" : "warning"
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
mapped.sort((a, b) => a.line - b.line || a.column - b.column);
|
|
95
|
+
return { diagnostics: mapped };
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
return {
|
|
99
|
+
diagnostics: [],
|
|
100
|
+
skipped: true,
|
|
101
|
+
skipReason: error instanceof Error ? error.message : String(error)
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Declare prior-cell scope so the cell isn't flagged for undefined names. */
|
|
108
|
+
function scopeDecls(names) {
|
|
109
|
+
return names
|
|
110
|
+
.filter((name) => /^[A-Za-z_$][\w$]*$/.test(name))
|
|
111
|
+
.map((name) => `declare const ${name}: ${REF_NAME.test(name) ? "unknown" : "any"};`)
|
|
112
|
+
.join("\n");
|
|
113
|
+
}
|
|
114
|
+
function toLibPath(fileName, libDir) {
|
|
115
|
+
return /^\/lib\.[^/]+\.d\.ts$/.test(fileName) ? join(libDir, basename(fileName)) : fileName;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=checker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checker.js","sourceRoot":"","sources":["../src/checker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAUpD,OAAO,EAAE,MAAM,cAAc,CAAC;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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,iBAAiB,IAAI,KAAK,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC;SACnF,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,SAAS,SAAS,CAAC,QAAgB,EAAE,MAAc;IACjD,OAAO,uBAAuB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9F,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// @cbxss/tack-typecheck — a persistent in-process TypeScript language service that
|
|
2
|
+
// checks a code-mode cell against a synthesized ambient `tools` surface before
|
|
3
|
+
// it runs. Implements the `TypeChecker` seam from `@cbxss/tack-codemode`; injected
|
|
4
|
+
// into `createExecutionEngine` by the CLI.
|
|
5
|
+
export { buildAmbientDts } from "./ambient.js";
|
|
6
|
+
export { createTypeChecker } from "./checker.js";
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,+EAA+E;AAC/E,mFAAmF;AACnF,2CAA2C;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAiC,MAAM,cAAc,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cbxss/tack-typecheck",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "rm -rf dist && tsc -p tsconfig.json",
|
|
16
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
17
|
+
"test": "vitest run --passWithNoTests"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@cbxss/tack-codemode": "1.0.0",
|
|
21
|
+
"@cbxss/tack-core": "1.0.0",
|
|
22
|
+
"@cbxss/tack-sdk-types": "1.0.0",
|
|
23
|
+
"typescript-5": "npm:typescript@^5.9.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"typescript": "^7.0.2",
|
|
27
|
+
"vitest": "^4.1.10"
|
|
28
|
+
},
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"url": "git+https://github.com/shrimp-software/tack.git"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/shrimp-software/tack#readme",
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/shrimp-software/tack/issues"
|
|
37
|
+
}
|
|
38
|
+
}
|