primitive-admin 1.2.0-alpha.6 → 1.2.0-alpha.8
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 +9 -3
- package/assets/skill/skills/primitive-platform/SKILL.md +12 -6
- package/dist/src/commands/apps-children.d.ts +1 -1
- package/dist/src/commands/apps-children.js +172 -28
- package/dist/src/commands/apps-children.js.map +1 -1
- package/dist/src/commands/auth.js +147 -38
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/config.js +43 -4
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/database-types.js +313 -13
- package/dist/src/commands/database-types.js.map +1 -1
- package/dist/src/commands/databases.js +143 -54
- package/dist/src/commands/databases.js.map +1 -1
- package/dist/src/commands/documents.js +70 -11
- package/dist/src/commands/documents.js.map +1 -1
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.js +9 -1
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/llm.js +6 -9
- package/dist/src/commands/llm.js.map +1 -1
- package/dist/src/commands/settings.d.ts +9 -12
- package/dist/src/commands/settings.js +79 -31
- package/dist/src/commands/settings.js.map +1 -1
- package/dist/src/commands/sync-app-settings.d.ts +12 -2
- package/dist/src/commands/sync-app-settings.js +35 -10
- package/dist/src/commands/sync-app-settings.js.map +1 -1
- package/dist/src/commands/sync.d.ts +118 -6
- package/dist/src/commands/sync.js +638 -65
- package/dist/src/commands/sync.js.map +1 -1
- package/dist/src/lib/api-client.d.ts +25 -6
- package/dist/src/lib/api-client.js +106 -72
- package/dist/src/lib/api-client.js.map +1 -1
- package/dist/src/lib/app-settings-descriptor.d.ts +38 -0
- package/dist/src/lib/app-settings-descriptor.js +96 -4
- package/dist/src/lib/app-settings-descriptor.js.map +1 -1
- package/dist/src/lib/child-apps-local.d.ts +45 -21
- package/dist/src/lib/child-apps-local.js +68 -30
- package/dist/src/lib/child-apps-local.js.map +1 -1
- package/dist/src/lib/credentials-home.d.ts +51 -0
- package/dist/src/lib/credentials-home.js +169 -0
- package/dist/src/lib/credentials-home.js.map +1 -0
- package/dist/src/lib/credentials-lock.d.ts +80 -0
- package/dist/src/lib/credentials-lock.js +222 -0
- package/dist/src/lib/credentials-lock.js.map +1 -0
- package/dist/src/lib/credentials-store.d.ts +92 -5
- package/dist/src/lib/credentials-store.js +377 -53
- package/dist/src/lib/credentials-store.js.map +1 -1
- package/dist/src/lib/env-resolver-core.d.ts +1 -1
- package/dist/src/lib/env-resolver-core.js.map +1 -1
- package/dist/src/lib/function-bundle.d.ts +38 -18
- package/dist/src/lib/function-bundle.js +60 -35
- package/dist/src/lib/function-bundle.js.map +1 -1
- package/dist/src/lib/function-collect.d.ts +1 -1
- package/dist/src/lib/function-collect.js +4 -0
- package/dist/src/lib/function-collect.js.map +1 -1
- package/dist/src/lib/function-document-types.d.ts +5 -3
- package/dist/src/lib/function-document-types.js +10 -14
- package/dist/src/lib/function-document-types.js.map +1 -1
- package/dist/src/lib/function-source-roots.d.ts +67 -0
- package/dist/src/lib/function-source-roots.js +148 -0
- package/dist/src/lib/function-source-roots.js.map +1 -0
- package/dist/src/lib/function-sync.d.ts +27 -0
- package/dist/src/lib/function-sync.js +16 -3
- package/dist/src/lib/function-sync.js.map +1 -1
- package/dist/src/lib/function-triggers.d.ts +3 -15
- package/dist/src/lib/function-triggers.js +10 -72
- package/dist/src/lib/function-triggers.js.map +1 -1
- package/dist/src/lib/function-typecheck.d.ts +37 -2
- package/dist/src/lib/function-typecheck.js +210 -28
- package/dist/src/lib/function-typecheck.js.map +1 -1
- package/dist/src/lib/generated-config-surfaces.d.ts +148 -0
- package/dist/src/lib/generated-config-surfaces.js +229 -35
- package/dist/src/lib/generated-config-surfaces.js.map +1 -1
- package/dist/src/lib/generated-sdk-types.d.ts +1 -1
- package/dist/src/lib/generated-sdk-types.js +1 -1
- package/dist/src/lib/generated-sdk-types.js.map +1 -1
- package/dist/src/lib/local-state.d.ts +21 -6
- package/dist/src/lib/local-state.js +78 -34
- package/dist/src/lib/local-state.js.map +1 -1
- package/dist/src/lib/login-scope-lines.d.ts +1 -1
- package/dist/src/lib/login-scope-lines.js +1 -1
- package/dist/src/lib/login-scope-lines.js.map +1 -1
- package/dist/src/lib/project-config.d.ts +7 -0
- package/dist/src/lib/project-config.js +22 -1
- package/dist/src/lib/project-config.js.map +1 -1
- package/dist/src/lib/push-failure-report.d.ts +45 -0
- package/dist/src/lib/push-failure-report.js +57 -0
- package/dist/src/lib/push-failure-report.js.map +1 -0
- package/dist/src/lib/root-import-decision.d.ts +9 -4
- package/dist/src/lib/root-import-decision.js +24 -3
- package/dist/src/lib/root-import-decision.js.map +1 -1
- package/dist/src/lib/scope-request.d.ts +8 -5
- package/dist/src/lib/scope-request.js +17 -8
- package/dist/src/lib/scope-request.js.map +1 -1
- package/dist/src/lib/sync-selectors.d.ts +5 -1
- package/dist/src/lib/sync-selectors.js +23 -13
- package/dist/src/lib/sync-selectors.js.map +1 -1
- package/dist/src/lib/transient-retry.d.ts +9 -0
- package/dist/src/lib/transient-retry.js +37 -0
- package/dist/src/lib/transient-retry.js.map +1 -1
- package/dist/src/lib/vars-override.d.ts +105 -0
- package/dist/src/lib/vars-override.js +143 -0
- package/dist/src/lib/vars-override.js.map +1 -0
- package/package.json +2 -2
- package/dist/src/lib/generated-workflow-model-fields.d.ts +0 -20
- package/dist/src/lib/generated-workflow-model-fields.js +0 -53
- package/dist/src/lib/generated-workflow-model-fields.js.map +0 -1
- package/dist/src/lib/workflow-field-descriptor.d.ts +0 -91
- package/dist/src/lib/workflow-field-descriptor.js +0 -153
- package/dist/src/lib/workflow-field-descriptor.js.map +0 -1
|
@@ -48,6 +48,29 @@
|
|
|
48
48
|
* A file the tsconfig does not sweep in is added as a root rather than skipped:
|
|
49
49
|
* a narrowed `include` must not silently turn the check off for the code the
|
|
50
50
|
* push is about to ship.
|
|
51
|
+
*
|
|
52
|
+
* ── Shared sources (#4502) ───────────────────────────────────────────────
|
|
53
|
+
*
|
|
54
|
+
* A project may declare directories outside the tree (`functionSources`); the
|
|
55
|
+
* bundler inlines their files and this check has to agree with it on two
|
|
56
|
+
* things, or code would bundle that never typechecked:
|
|
57
|
+
*
|
|
58
|
+
* - WHICH files. The graph follows a file whose REAL path is inside the tree
|
|
59
|
+
* or a declared directory, as the bundler classifies, and the check is also
|
|
60
|
+
* seeded with the shared files the bundle actually read — a package whose
|
|
61
|
+
* `types` export names a declaration is bundled from its `import` export,
|
|
62
|
+
* which the type graph alone never reaches. The graph keeps TypeScript's
|
|
63
|
+
* own spelling of each file (that is what the program answers to), while
|
|
64
|
+
* its visited set is keyed by real path, so a file reached through a
|
|
65
|
+
* symlink and directly is checked and reported once per function.
|
|
66
|
+
* - HOW imports resolve. esbuild resolves from a file's real location and
|
|
67
|
+
* honours that file's nearest `tsconfig.json` `paths`. So a shared file's
|
|
68
|
+
* imports resolve from its real path, with the functions tsconfig's options
|
|
69
|
+
* but that tsconfig's `paths`/`baseUrl` in place of the functions ones.
|
|
70
|
+
* The same rule feeds the graph walk and the program's own resolution.
|
|
71
|
+
* Every other option stays the functions tsconfig's: shared code runs in
|
|
72
|
+
* the same Worker. `primitive-functions` imported from a shared file is
|
|
73
|
+
* always the generated declaration, whatever its tsconfig maps.
|
|
51
74
|
*/
|
|
52
75
|
/** The flag that skips the check, named wherever the refusal is read. */
|
|
53
76
|
export declare const TYPECHECK_SKIP_FLAG = "--no-typecheck";
|
|
@@ -62,9 +85,11 @@ export interface FunctionTypechecker {
|
|
|
62
85
|
* The diagnostics for one function's sources, or null when they typecheck.
|
|
63
86
|
*
|
|
64
87
|
* `sources` are tree-relative POSIX paths — what the bundle build collected
|
|
65
|
-
* for this function.
|
|
88
|
+
* for this function. `sharedSources` are the bundle's `projectSources`: the
|
|
89
|
+
* shared files it inlined from declared directories, relative to the real
|
|
90
|
+
* tree root.
|
|
66
91
|
*/
|
|
67
|
-
check(functionKey: string, sources: readonly string[]): FunctionTypecheckFailure | null;
|
|
92
|
+
check(functionKey: string, sources: readonly string[], sharedSources?: readonly string[]): FunctionTypecheckFailure | null;
|
|
68
93
|
}
|
|
69
94
|
export interface FunctionTypecheckSetup {
|
|
70
95
|
/** null when there is nothing to check, or no compiler to check it with. */
|
|
@@ -75,6 +100,16 @@ export interface FunctionTypecheckSetup {
|
|
|
75
100
|
export interface FunctionTypecheckOptions {
|
|
76
101
|
/** Injected in tests; the real one resolves the CLI's own TypeScript. */
|
|
77
102
|
loadTypeScript?: () => any;
|
|
103
|
+
/**
|
|
104
|
+
* The declared `functionSources` directories, as absolute paths. Defaults
|
|
105
|
+
* to what the selected project config declares.
|
|
106
|
+
*/
|
|
107
|
+
sourceRoots?: readonly string[];
|
|
108
|
+
/**
|
|
109
|
+
* Where a warning found while checking goes — a shared file's tsconfig that
|
|
110
|
+
* does not parse. Defaults to appending to the setup's `warnings`.
|
|
111
|
+
*/
|
|
112
|
+
onWarning?: (message: string) => void;
|
|
78
113
|
}
|
|
79
114
|
/**
|
|
80
115
|
* Build the checker for a config tree, or say why there is none.
|
|
@@ -48,14 +48,52 @@
|
|
|
48
48
|
* A file the tsconfig does not sweep in is added as a root rather than skipped:
|
|
49
49
|
* a narrowed `include` must not silently turn the check off for the code the
|
|
50
50
|
* push is about to ship.
|
|
51
|
+
*
|
|
52
|
+
* ── Shared sources (#4502) ───────────────────────────────────────────────
|
|
53
|
+
*
|
|
54
|
+
* A project may declare directories outside the tree (`functionSources`); the
|
|
55
|
+
* bundler inlines their files and this check has to agree with it on two
|
|
56
|
+
* things, or code would bundle that never typechecked:
|
|
57
|
+
*
|
|
58
|
+
* - WHICH files. The graph follows a file whose REAL path is inside the tree
|
|
59
|
+
* or a declared directory, as the bundler classifies, and the check is also
|
|
60
|
+
* seeded with the shared files the bundle actually read — a package whose
|
|
61
|
+
* `types` export names a declaration is bundled from its `import` export,
|
|
62
|
+
* which the type graph alone never reaches. The graph keeps TypeScript's
|
|
63
|
+
* own spelling of each file (that is what the program answers to), while
|
|
64
|
+
* its visited set is keyed by real path, so a file reached through a
|
|
65
|
+
* symlink and directly is checked and reported once per function.
|
|
66
|
+
* - HOW imports resolve. esbuild resolves from a file's real location and
|
|
67
|
+
* honours that file's nearest `tsconfig.json` `paths`. So a shared file's
|
|
68
|
+
* imports resolve from its real path, with the functions tsconfig's options
|
|
69
|
+
* but that tsconfig's `paths`/`baseUrl` in place of the functions ones.
|
|
70
|
+
* The same rule feeds the graph walk and the program's own resolution.
|
|
71
|
+
* Every other option stays the functions tsconfig's: shared code runs in
|
|
72
|
+
* the same Worker. `primitive-functions` imported from a shared file is
|
|
73
|
+
* always the generated declaration, whatever its tsconfig maps.
|
|
51
74
|
*/
|
|
52
75
|
import { createRequire } from "module";
|
|
53
|
-
import { existsSync } from "fs";
|
|
54
|
-
import { join, resolve, sep } from "path";
|
|
55
|
-
import { FUNCTIONS_TSCONFIG_FILE, SDK_MODULE_SPECIFIER, planFunctionTypeArtifacts, renderFunctionsTsconfig, } from "./function-db-types.js";
|
|
76
|
+
import { existsSync, realpathSync } from "fs";
|
|
77
|
+
import { dirname, join, relative, resolve, sep } from "path";
|
|
78
|
+
import { FUNCTIONS_TSCONFIG_FILE, SDK_MODULE_SPECIFIER, SDK_TYPES_FILE, planFunctionTypeArtifacts, renderFunctionsTsconfig, } from "./function-db-types.js";
|
|
56
79
|
import { FunctionSchemaCodegenError } from "./function-schema-codegen.js";
|
|
80
|
+
import { isInsideDirectory, resolveFunctionSourceRoots, } from "./function-source-roots.js";
|
|
57
81
|
/** The flag that skips the check, named wherever the refusal is read. */
|
|
58
82
|
export const TYPECHECK_SKIP_FLAG = "--no-typecheck";
|
|
83
|
+
/** The real path, or the spelling itself when it cannot be resolved. */
|
|
84
|
+
function realOrSelf(path) {
|
|
85
|
+
try {
|
|
86
|
+
return realpathSync(path);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return path;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* "No inputs were found" and "The 'files' list is empty": a shared file's
|
|
94
|
+
* tsconfig is read for its `paths` only, so what it would compile is moot.
|
|
95
|
+
*/
|
|
96
|
+
const SHARED_TSCONFIG_IGNORED_CODES = new Set([18002, 18003]);
|
|
59
97
|
/**
|
|
60
98
|
* "Could not find a declaration file for module 'x'" (7016) and "Cannot find
|
|
61
99
|
* module 'x' or its corresponding type declarations" (2307).
|
|
@@ -206,6 +244,7 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
206
244
|
getCurrentDirectory: () => functionsDir,
|
|
207
245
|
getNewLine: () => "\n",
|
|
208
246
|
};
|
|
247
|
+
const warn = options.onWarning ?? ((message) => warnings.push(message));
|
|
209
248
|
// Module resolution over the same overlay the program reads, so an import of
|
|
210
249
|
// `primitive-functions` lands on the planned declaration rather than on
|
|
211
250
|
// whatever is (or is not) on disk.
|
|
@@ -218,12 +257,136 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
218
257
|
getDirectories: ts.sys.getDirectories,
|
|
219
258
|
directoryExists: ts.sys.directoryExists,
|
|
220
259
|
};
|
|
221
|
-
|
|
222
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Is this an in-tree file of the author's, or a file under a declared
|
|
262
|
+
* directory, as opposed to a dependency?
|
|
263
|
+
*
|
|
264
|
+
* Decided on the REAL path, as the bundler decides (#4502), with the
|
|
265
|
+
* spelling as the fallback for a file that cannot be resolved — a seed
|
|
266
|
+
* deleted since the build, whose missing-file diagnostic should surface. A
|
|
267
|
+
* package's own declarations are not this check's business (see
|
|
268
|
+
* {@link isThirdPartyModuleDiagnostic}), and neither are the generated ones
|
|
269
|
+
* — an error in those is a push bug, not something the author's push can
|
|
270
|
+
* act on.
|
|
271
|
+
*/
|
|
272
|
+
const treeRoot = resolve(configDir);
|
|
273
|
+
const realTreeRoot = realOrSelf(treeRoot);
|
|
274
|
+
const declaredRoots = (options.sourceRoots ??
|
|
275
|
+
resolveFunctionSourceRoots(configDir).roots.map((root) => root.absolute)).map((root) => realOrSelf(resolve(root)));
|
|
276
|
+
const realPaths = new Map();
|
|
277
|
+
const realOf = (path) => {
|
|
278
|
+
let real = realPaths.get(path);
|
|
279
|
+
if (real === undefined) {
|
|
280
|
+
real = realOrSelf(path);
|
|
281
|
+
realPaths.set(path, real);
|
|
282
|
+
}
|
|
283
|
+
return real;
|
|
284
|
+
};
|
|
285
|
+
const realOverlay = new Set([...overlay.keys()].map((path) => join(realTreeRoot, relative(treeRoot, path))));
|
|
286
|
+
// The spelling counts only when it could not be resolved: an in-tree
|
|
287
|
+
// symlink into a declared directory is a shared file, as the bundler says.
|
|
288
|
+
const isTreeFile = (path) => {
|
|
289
|
+
const real = realOf(path);
|
|
290
|
+
return (isInsideDirectory(realTreeRoot, real) ||
|
|
291
|
+
(real === path && isInsideDirectory(treeRoot, path)));
|
|
292
|
+
};
|
|
293
|
+
const isSharedFile = (path) => !isTreeFile(path) &&
|
|
294
|
+
declaredRoots.some((root) => isInsideDirectory(root, realOf(path)));
|
|
295
|
+
const isCheckedSource = (path) => (isTreeFile(path) || isSharedFile(path)) &&
|
|
296
|
+
!path.split(sep).includes("node_modules") &&
|
|
297
|
+
!realOf(path).split(sep).includes("node_modules") &&
|
|
298
|
+
!overlay.has(path) &&
|
|
299
|
+
!realOverlay.has(realOf(path));
|
|
300
|
+
/**
|
|
301
|
+
* The options a file's imports resolve with: the functions tsconfig's for a
|
|
302
|
+
* tree file; for a shared file, the same with `paths`, `baseUrl` and
|
|
303
|
+
* `pathsBasePath` taken from the nearest `tsconfig.json` above its REAL
|
|
304
|
+
* path — the file esbuild reads for it. A tsconfig that does not parse is
|
|
305
|
+
* one warning, and its file resolves with the functions options.
|
|
306
|
+
*/
|
|
307
|
+
const sharedResolution = new Map();
|
|
308
|
+
const quietParseHost = {
|
|
309
|
+
useCaseSensitiveFileNames: ts.sys.useCaseSensitiveFileNames,
|
|
310
|
+
// Read for its `paths`; what it would compile is never asked.
|
|
311
|
+
readDirectory: () => [],
|
|
312
|
+
fileExists: ts.sys.fileExists,
|
|
313
|
+
readFile: ts.sys.readFile,
|
|
314
|
+
};
|
|
315
|
+
const sharedTsconfigOptions = (configPath) => {
|
|
316
|
+
const cached = sharedResolution.get(configPath);
|
|
317
|
+
if (cached !== undefined)
|
|
318
|
+
return cached;
|
|
319
|
+
let resolved = parsed.options;
|
|
320
|
+
const read = ts.readConfigFile(configPath, ts.sys.readFile);
|
|
321
|
+
if (read.error) {
|
|
322
|
+
warn(`${configPath}: not readable as a tsconfig, so the shared files below it ` +
|
|
323
|
+
`resolve imports with functions/${FUNCTIONS_TSCONFIG_FILE}'s options (` +
|
|
324
|
+
ts.flattenDiagnosticMessageText(read.error.messageText, " ") +
|
|
325
|
+
").");
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
const own = ts.parseJsonConfigFileContent(read.config, quietParseHost, dirname(configPath), undefined, configPath);
|
|
329
|
+
const errors = (own.errors ?? []).filter((diagnostic) => !SHARED_TSCONFIG_IGNORED_CODES.has(diagnostic.code));
|
|
330
|
+
const aliased = own.options.paths !== undefined || own.options.baseUrl !== undefined;
|
|
331
|
+
if (errors.length > 0) {
|
|
332
|
+
warn(`${configPath}: ` +
|
|
333
|
+
errors
|
|
334
|
+
.map((diagnostic) => ts.flattenDiagnosticMessageText(diagnostic.messageText, " "))
|
|
335
|
+
.join("; ") +
|
|
336
|
+
(aliased
|
|
337
|
+
? " — its own paths are still used for the shared files below it."
|
|
338
|
+
: ` — the shared files below it resolve imports with functions/${FUNCTIONS_TSCONFIG_FILE}'s options.`));
|
|
339
|
+
}
|
|
340
|
+
if (errors.length === 0 || aliased) {
|
|
341
|
+
resolved = {
|
|
342
|
+
...parsed.options,
|
|
343
|
+
paths: own.options.paths,
|
|
344
|
+
baseUrl: own.options.baseUrl,
|
|
345
|
+
pathsBasePath: own.options.pathsBasePath,
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
sharedResolution.set(configPath, resolved);
|
|
350
|
+
return resolved;
|
|
351
|
+
};
|
|
352
|
+
/** A shared file with no tsconfig above it has no aliases. */
|
|
353
|
+
const unaliasedOptions = {
|
|
354
|
+
...parsed.options,
|
|
355
|
+
paths: undefined,
|
|
356
|
+
baseUrl: undefined,
|
|
357
|
+
pathsBasePath: undefined,
|
|
358
|
+
};
|
|
359
|
+
const resolutionOptionsFor = (containingFile) => {
|
|
360
|
+
if (!isSharedFile(containingFile))
|
|
361
|
+
return parsed.options;
|
|
362
|
+
const configPath = ts.findConfigFile(dirname(realOf(containingFile)), ts.sys.fileExists, "tsconfig.json");
|
|
363
|
+
return configPath ? sharedTsconfigOptions(resolve(configPath)) : unaliasedOptions;
|
|
364
|
+
};
|
|
365
|
+
/** The generated SDK declaration every shared file's import lands on. */
|
|
366
|
+
const sdkDeclaration = join(functionsDir, SDK_TYPES_FILE);
|
|
367
|
+
/**
|
|
368
|
+
* The resolution mode a file's imports take when the literal itself is not
|
|
369
|
+
* at hand (the graph walk, the installed-package lookup): the file's own
|
|
370
|
+
* module format, which is what the compiler gives a static import. Under
|
|
371
|
+
* `Bundler` it is undefined and the compiler picks the `import` conditions.
|
|
372
|
+
*/
|
|
373
|
+
const impliedMode = (containingFile, options) => ts.getImpliedNodeFormatForFile(resolve(containingFile), undefined, resolutionHost, options);
|
|
374
|
+
const resolveModule = (specifier, containingFile, options, mode = impliedMode(containingFile, options)) => {
|
|
375
|
+
if (specifier === SDK_MODULE_SPECIFIER && isSharedFile(containingFile)) {
|
|
376
|
+
return {
|
|
377
|
+
resolvedFileName: resolve(sdkDeclaration),
|
|
378
|
+
extension: ".d.ts",
|
|
379
|
+
isExternalLibraryImport: false,
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
// From the file's real location, as esbuild resolves: a shared file
|
|
383
|
+
// reached through a symlink climbs and finds packages where it lives.
|
|
384
|
+
return ts.resolveModuleName(specifier, realOf(containingFile), options, resolutionHost, undefined, undefined, mode).resolvedModule;
|
|
385
|
+
};
|
|
223
386
|
/** Does this bare specifier name a package that is actually installed? */
|
|
224
387
|
const installedPackages = new Map();
|
|
225
388
|
const isInstalledPackage = (specifier, containingFile) => {
|
|
226
|
-
const key = `${specifier}
|
|
389
|
+
const key = `${specifier} ${containingFile}`;
|
|
227
390
|
const cached = installedPackages.get(key);
|
|
228
391
|
if (cached !== undefined)
|
|
229
392
|
return cached;
|
|
@@ -231,7 +394,7 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
231
394
|
// is for — resolves, and `noImplicitAny: false` so the lookup answers
|
|
232
395
|
// "found" rather than re-raising the diagnostic being classified.
|
|
233
396
|
const resolved = resolveModule(specifier, containingFile, {
|
|
234
|
-
...
|
|
397
|
+
...resolutionOptionsFor(containingFile),
|
|
235
398
|
allowJs: true,
|
|
236
399
|
checkJs: false,
|
|
237
400
|
noImplicitAny: false,
|
|
@@ -241,19 +404,7 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
241
404
|
return installed;
|
|
242
405
|
};
|
|
243
406
|
/**
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* A package's own declarations are not this check's business (see
|
|
247
|
-
* {@link isThirdPartyModuleDiagnostic}), and neither are the generated ones —
|
|
248
|
-
* an error in those is a push bug, not something the author's push can act
|
|
249
|
-
* on.
|
|
250
|
-
*/
|
|
251
|
-
const treeRoot = resolve(configDir);
|
|
252
|
-
const isTreeSource = (path) => path.startsWith(treeRoot.endsWith(sep) ? treeRoot : treeRoot + sep) &&
|
|
253
|
-
!path.split(sep).includes("node_modules") &&
|
|
254
|
-
!overlay.has(path);
|
|
255
|
-
/**
|
|
256
|
-
* The in-tree files one source pulls in — INCLUDING the type-only imports
|
|
407
|
+
* The checked files one source pulls in — INCLUDING the type-only imports
|
|
257
408
|
* esbuild erases, which is why this walks the graph itself instead of
|
|
258
409
|
* trusting the bundle's input list (SO3331-002).
|
|
259
410
|
*/
|
|
@@ -265,29 +416,34 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
265
416
|
const found = [];
|
|
266
417
|
const text = readFile(path);
|
|
267
418
|
if (text !== undefined) {
|
|
419
|
+
const options = resolutionOptionsFor(path);
|
|
268
420
|
for (const imported of ts.preProcessFile(text, true, true).importedFiles) {
|
|
269
|
-
const target = resolveModule(imported.fileName, path,
|
|
421
|
+
const target = resolveModule(imported.fileName, path, options)
|
|
270
422
|
?.resolvedFileName;
|
|
271
423
|
if (target === undefined)
|
|
272
424
|
continue;
|
|
273
425
|
const resolved = resolve(target);
|
|
274
|
-
if (
|
|
426
|
+
if (isCheckedSource(resolved))
|
|
275
427
|
found.push(resolved);
|
|
276
428
|
}
|
|
277
429
|
}
|
|
278
430
|
importsOf.set(path, found);
|
|
279
431
|
return found;
|
|
280
432
|
};
|
|
281
|
-
/**
|
|
433
|
+
/**
|
|
434
|
+
* A function's sources and everything their types reach, in tree order —
|
|
435
|
+
* one spelling per real file, the first one met.
|
|
436
|
+
*/
|
|
282
437
|
const typeGraph = (entries) => {
|
|
283
438
|
const seen = new Set();
|
|
284
439
|
const files = [];
|
|
285
440
|
const queue = [...entries];
|
|
286
441
|
while (queue.length > 0) {
|
|
287
442
|
const path = queue.shift();
|
|
288
|
-
|
|
443
|
+
const real = realOf(path);
|
|
444
|
+
if (seen.has(real))
|
|
289
445
|
continue;
|
|
290
|
-
seen.add(
|
|
446
|
+
seen.add(real);
|
|
291
447
|
files.push(path);
|
|
292
448
|
queue.push(...localImports(path));
|
|
293
449
|
}
|
|
@@ -313,6 +469,16 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
313
469
|
}
|
|
314
470
|
return getSourceFile(fileName, languageVersion, onError, shouldCreate);
|
|
315
471
|
};
|
|
472
|
+
// The program resolves by the same per-file rule as the graph walk, so
|
|
473
|
+
// the two cannot disagree about which file an import names. Each literal
|
|
474
|
+
// keeps the mode the compiler's own resolver would give it (an ESM file
|
|
475
|
+
// under NodeNext takes the `import` conditions).
|
|
476
|
+
host.resolveModuleNameLiterals = (literals, containingFile, _redirectedReference, _options, containingSourceFile) => {
|
|
477
|
+
const options = resolutionOptionsFor(containingFile);
|
|
478
|
+
return literals.map((literal) => ({
|
|
479
|
+
resolvedModule: resolveModule(literal.text, containingFile, options, ts.getModeForUsageLocation(containingSourceFile, literal, options)),
|
|
480
|
+
}));
|
|
481
|
+
};
|
|
316
482
|
return ts.createProgram({
|
|
317
483
|
rootNames: [...roots],
|
|
318
484
|
options: parsed.options,
|
|
@@ -320,8 +486,17 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
320
486
|
});
|
|
321
487
|
};
|
|
322
488
|
const checker = {
|
|
323
|
-
check(functionKey, sources) {
|
|
324
|
-
const paths = typeGraph(
|
|
489
|
+
check(functionKey, sources, sharedSources = []) {
|
|
490
|
+
const paths = typeGraph([
|
|
491
|
+
...sources.map((source) => resolve(configDir, source)),
|
|
492
|
+
// What the bundle shipped from declared directories, seeded by its
|
|
493
|
+
// real path: the graph alone misses an implementation behind a
|
|
494
|
+
// package's declaration export. A package file a shared file reached
|
|
495
|
+
// by a relative import is still a dependency, never checked.
|
|
496
|
+
...sharedSources
|
|
497
|
+
.map((source) => resolve(realTreeRoot, source))
|
|
498
|
+
.filter(isCheckedSource),
|
|
499
|
+
]);
|
|
325
500
|
// A source the tsconfig's `include` misses is added rather than skipped:
|
|
326
501
|
// this is code the push is about to ship.
|
|
327
502
|
let added = false;
|
|
@@ -336,8 +511,15 @@ export function createFunctionTypechecker(configDir, options = {}) {
|
|
|
336
511
|
const diagnostics = [];
|
|
337
512
|
for (const path of paths) {
|
|
338
513
|
const sourceFile = program.getSourceFile(path);
|
|
339
|
-
if (!sourceFile)
|
|
514
|
+
if (!sourceFile) {
|
|
515
|
+
// A file gone since the build: the compiler's own "not found".
|
|
516
|
+
for (const diagnostic of program.getOptionsDiagnostics()) {
|
|
517
|
+
const text = ts.flattenDiagnosticMessageText(diagnostic.messageText, " ");
|
|
518
|
+
if (!diagnostic.file && text.includes(path))
|
|
519
|
+
diagnostics.push(diagnostic);
|
|
520
|
+
}
|
|
340
521
|
continue;
|
|
522
|
+
}
|
|
341
523
|
for (const diagnostic of [
|
|
342
524
|
...program.getSyntacticDiagnostics(sourceFile),
|
|
343
525
|
...program.getSemanticDiagnostics(sourceFile),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-typecheck.js","sourceRoot":"","sources":["../../../src/lib/function-typecheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE1E,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAgB,CAAC;AAkCpD;;;GAGG;AACH,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,SAAS,4BAA4B,CACnC,EAAO,EACP,UAAe,EACf,kBAA0E;IAE1E,IAAI,CAAC,4BAA4B,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IACtE,MAAM,IAAI,GAAG,EAAE,CAAC,4BAA4B,CAAC,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,IAAI,CAAC,SAAS,IAAI,SAAS,KAAK,oBAAoB;QAAE,O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export declare const AGENT_BLOCK_LABEL = "[prompt.agent]";
|
|
2698
|
+
/**
|
|
2699
|
+
* One place a declaration names a server function: the key, the tool's name
|
|
2700
|
+
* for a tool, the path that makes the reference, and whether the reference
|
|
2701
|
+
* needs the function's schemas (a tool's are its function's; a turn-context or
|
|
2702
|
+
* history hook only needs the function to exist).
|
|
2703
|
+
*/
|
|
2704
|
+
export interface AgentFunctionReference {
|
|
2705
|
+
key: string;
|
|
2706
|
+
tool?: string;
|
|
2707
|
+
path: string;
|
|
2708
|
+
needsSchemas: boolean;
|
|
2709
|
+
}
|
|
2698
2710
|
/**
|
|
2699
2711
|
* The function keys a declaration references (tools, turn context, history),
|
|
2700
2712
|
* each once, in declaration order. What a caller resolves into the
|
|
@@ -2712,6 +2724,39 @@ export declare const AGENT_BLOCK_LABEL = "[prompt.agent]";
|
|
|
2712
2724
|
*/
|
|
2713
2725
|
export declare function parseAgentDeclarationBlock(agent: unknown): Record<string, unknown> | undefined;
|
|
2714
2726
|
export declare function agentDeclarationFunctionKeys(agent: unknown): string[];
|
|
2727
|
+
/**
|
|
2728
|
+
* Every function reference of a declaration (tools, turn context, history), in
|
|
2729
|
+
* declaration order, with the path that makes it. `[]` for a block that is
|
|
2730
|
+
* absent or does not parse. A declaration written as one JSON string is read
|
|
2731
|
+
* as the object it encodes.
|
|
2732
|
+
*/
|
|
2733
|
+
export declare function agentDeclarationFunctionReferences(agent: unknown): AgentFunctionReference[];
|
|
2734
|
+
/**
|
|
2735
|
+
* What a reference lacks: the function itself, or one of a tool's two schemas.
|
|
2736
|
+
* One deficit per (reference, kind), so a comparison of two states can tell a
|
|
2737
|
+
* schema restored from a schema removed without reading message text.
|
|
2738
|
+
*/
|
|
2739
|
+
export type AgentFunctionDeficitKind = "absent" | "inputSchemaMissing" | "outputSchemaMissing";
|
|
2740
|
+
/** One thing a function reference of a declaration lacks. */
|
|
2741
|
+
export interface AgentFunctionDeficit {
|
|
2742
|
+
path: string;
|
|
2743
|
+
tool?: string;
|
|
2744
|
+
key: string;
|
|
2745
|
+
kind: AgentFunctionDeficitKind;
|
|
2746
|
+
}
|
|
2747
|
+
/**
|
|
2748
|
+
* Every deficit of a declaration's function references against `functions`:
|
|
2749
|
+
* an absent function (`null`, or missing from the map), and for a tool a
|
|
2750
|
+
* missing `inputSchema` and a missing `outputSchema`, each on its own. `[]` for
|
|
2751
|
+
* a block that is absent or does not parse.
|
|
2752
|
+
*/
|
|
2753
|
+
export declare function agentFunctionDeficits(agent: unknown, functions: AgentFunctionFacts): AgentFunctionDeficit[];
|
|
2754
|
+
/**
|
|
2755
|
+
* The refusals for a list of deficits: one `AGENT_TOOL_FUNCTION_MISSING` per
|
|
2756
|
+
* absent reference, and one `AGENT_TOOL_FUNCTION_SCHEMA_MISSING` per tool
|
|
2757
|
+
* reference naming every schema it lacks.
|
|
2758
|
+
*/
|
|
2759
|
+
export declare function agentFunctionDeficitRefusals(deficits: readonly AgentFunctionDeficit[]): AgentRefusal[];
|
|
2715
2760
|
/**
|
|
2716
2761
|
* The one rule: is this `[prompt.agent]` declaration (with the prompt's kind
|
|
2717
2762
|
* and `outputSchema`) something the platform can run?
|
|
@@ -2872,6 +2917,109 @@ export interface AgentSchemaTranslationInput {
|
|
|
2872
2917
|
* A declaration with no tools and no events reads no function schema at all.
|
|
2873
2918
|
*/
|
|
2874
2919
|
export declare function agentSchemaTranslationRefusals(input: AgentSchemaTranslationInput): AgentRefusal[];
|
|
2920
|
+
/**
|
|
2921
|
+
* One schema an agent's model reads that a provider of a non-archived config
|
|
2922
|
+
* cannot carry — or, for a server tool, a function schema that does not parse.
|
|
2923
|
+
* The structured half of `agentSchemaTranslationRefusals`: its identity is
|
|
2924
|
+
* (`subject`, `which`, `provider`, `schemaPath`, `keyword`), or (`subject`,
|
|
2925
|
+
* `which`, `unparsable`), so two states can be compared without reading
|
|
2926
|
+
* message text.
|
|
2927
|
+
*/
|
|
2928
|
+
export type AgentSchemaDeficit = {
|
|
2929
|
+
/** `tool "propose"`, `tool "lookup" (function "ledger")` or `event "applied"`. */
|
|
2930
|
+
subject: string;
|
|
2931
|
+
/** `inputSchema`, `outputSchema` or `schema`. */
|
|
2932
|
+
which: string;
|
|
2933
|
+
provider: string;
|
|
2934
|
+
/** The non-archived configs on `provider`. */
|
|
2935
|
+
configNames: string[];
|
|
2936
|
+
/** The dotted path from the schema root; `""` is the root. */
|
|
2937
|
+
schemaPath: string;
|
|
2938
|
+
keyword: string;
|
|
2939
|
+
reason: string;
|
|
2940
|
+
} | {
|
|
2941
|
+
subject: string;
|
|
2942
|
+
which: string;
|
|
2943
|
+
/** The function whose stored schema does not parse. */
|
|
2944
|
+
unparsable: string;
|
|
2945
|
+
};
|
|
2946
|
+
/**
|
|
2947
|
+
* Every deficit `agentSchemaTranslationRefusals` reports, in the same order,
|
|
2948
|
+
* before it is rendered. One per (schema, path, keyword, provider), and one
|
|
2949
|
+
* per server-tool schema that does not parse.
|
|
2950
|
+
*/
|
|
2951
|
+
export declare function agentSchemaTranslationDeficits(input: AgentSchemaTranslationInput): AgentSchemaDeficit[];
|
|
2952
|
+
/** The `AGENT_SCHEMA_NOT_TRANSLATABLE` refusal one deficit renders as. */
|
|
2953
|
+
export declare function agentSchemaDeficitRefusal(deficit: AgentSchemaDeficit): AgentRefusal;
|
|
2954
|
+
/**
|
|
2955
|
+
* A change to a server function that an agent uses — issue #4441.
|
|
2956
|
+
*
|
|
2957
|
+
* An agent names server functions as its tools, its turn-context hook and its
|
|
2958
|
+
* history hook. The agent's own writes are checked against those functions
|
|
2959
|
+
* (`resolveAgentDeclaration`, `agentSchemaTranslationRefusals`), but a change
|
|
2960
|
+
* to the FUNCTION — archiving it, deleting it, changing its schemas — used to
|
|
2961
|
+
* be accepted and fail at the agent's next turn. This module is the rule for
|
|
2962
|
+
* that change: given one agent's declaration and configs, and the functions it
|
|
2963
|
+
* names before and after the change, which refusals does the change introduce?
|
|
2964
|
+
*
|
|
2965
|
+
* The admin function routes refuse such a change with `FUNCTION_USED_BY_AGENT`,
|
|
2966
|
+
* and `config push`'s preflight runs the same rule through the vendored
|
|
2967
|
+
* artifact, so the two cannot disagree.
|
|
2968
|
+
*
|
|
2969
|
+
* ONLY WHAT THE CHANGE INTRODUCES. Both states are reduced to structured
|
|
2970
|
+
* deficits (`agentFunctionDeficits`, `agentSchemaTranslationDeficits`) and the
|
|
2971
|
+
* ones already present before the change are dropped. An agent that is broken
|
|
2972
|
+
* for another reason does not block an unrelated change, and a partial repair
|
|
2973
|
+
* — restoring one of two missing schemas, removing one of two `$ref`s — is
|
|
2974
|
+
* accepted. Messages are rendered only afterwards, by the sibling rules' own
|
|
2975
|
+
* builders, so they read exactly as an agent write's refusals do.
|
|
2976
|
+
*
|
|
2977
|
+
* Pure and dependency-free, like every module under `src/config-surface/`.
|
|
2978
|
+
*/
|
|
2979
|
+
/** The code a function route answers when an agent cannot take the change. */
|
|
2980
|
+
export declare const FUNCTION_USED_BY_AGENT = "FUNCTION_USED_BY_AGENT";
|
|
2981
|
+
/** One agent, and the functions it names before and after a change to them. */
|
|
2982
|
+
export interface AgentFunctionChangeInput {
|
|
2983
|
+
/** `[prompt.agent]` as stored: a table, or one JSON string encoding one. */
|
|
2984
|
+
declaration: unknown;
|
|
2985
|
+
/** Every config of the agent's prompt. Archived ones are skipped. */
|
|
2986
|
+
configs: ReadonlyArray<AgentSchemaConfigFact>;
|
|
2987
|
+
/** What the app holds for each function the declaration names, now. */
|
|
2988
|
+
before: AgentFunctionFacts;
|
|
2989
|
+
/** The same, as the change would leave it. */
|
|
2990
|
+
after: AgentFunctionFacts;
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Every refusal the change introduces for this agent: a reference whose
|
|
2994
|
+
* function goes away (`AGENT_TOOL_FUNCTION_MISSING`), a tool schema that goes
|
|
2995
|
+
* away (`AGENT_TOOL_FUNCTION_SCHEMA_MISSING`), and a schema a non-archived
|
|
2996
|
+
* config's provider cannot carry where the previous one could
|
|
2997
|
+
* (`AGENT_SCHEMA_NOT_TRANSLATABLE`). `[]` when the agent can take the change,
|
|
2998
|
+
* and for a declaration that does not parse (it names nothing).
|
|
2999
|
+
*/
|
|
3000
|
+
export declare function agentFunctionChangeRefusals(input: AgentFunctionChangeInput): AgentRefusal[];
|
|
3001
|
+
/**
|
|
3002
|
+
* How an agent uses one function: each tool's name (or its path when the tool
|
|
3003
|
+
* has none), and `turnContext.function` / `history.function` for a hook, in
|
|
3004
|
+
* declaration order. `[]` when the declaration does not name the function.
|
|
3005
|
+
*/
|
|
3006
|
+
export declare function agentFunctionUses(declaration: unknown, functionKey: string): string[];
|
|
3007
|
+
/** What a function route was asked to do. */
|
|
3008
|
+
export type FunctionChangeKind = "archive" | "delete" | "schema";
|
|
3009
|
+
/** One agent a function change would break. */
|
|
3010
|
+
export interface FunctionUsedByAgent {
|
|
3011
|
+
promptKey: string;
|
|
3012
|
+
/** `agentFunctionUses` of the changed function. */
|
|
3013
|
+
tools: string[];
|
|
3014
|
+
/** The refusals the change introduces for this agent. */
|
|
3015
|
+
refusals: ReadonlyArray<AgentRefusal>;
|
|
3016
|
+
}
|
|
3017
|
+
/**
|
|
3018
|
+
* The sentence a function route refuses with: the function, then one sentence
|
|
3019
|
+
* per agent naming its key and each use, then the remedy. A schema change also
|
|
3020
|
+
* carries each agent's refusals, since the remedy depends on which schema broke.
|
|
3021
|
+
*/
|
|
3022
|
+
export declare function functionUsedByAgentMessage(functionKey: string, change: FunctionChangeKind, agents: ReadonlyArray<FunctionUsedByAgent>): string;
|
|
2875
3023
|
/**
|
|
2876
3024
|
* What an agent test case may say — issue #4262 (single-round prompt tests
|
|
2877
3025
|
* from a seeded history; design-docs/agents.md §D1).
|