@jigs.design/server 0.3.3 → 0.3.4
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/compile.js +15 -2
- package/dist/types.d.ts +2 -2
- package/package.json +6 -6
package/dist/compile.js
CHANGED
|
@@ -3,7 +3,7 @@ import { JigsCompileError, JigsError, fatalDiagnostics } from "./errors.js";
|
|
|
3
3
|
import { inputDiagnostics } from "./inputs.js";
|
|
4
4
|
import { outputDiagnostics } from "./outputs.js";
|
|
5
5
|
import { splitPragma, versionDiagnostics } from "./pragma.js";
|
|
6
|
-
import { compileJigs, compileLibrary, spanIn } from "@jigs.design/compiler";
|
|
6
|
+
import { compileJigs, compileLibrary, nearest, spanIn } from "@jigs.design/compiler";
|
|
7
7
|
import { TOOL_RESULTS } from "@jigs.design/prompt";
|
|
8
8
|
import { componentSchema } from "@jigs.design/host";
|
|
9
9
|
import { PROGRAM_FORMAT } from "@jigs.design/protocol";
|
|
@@ -69,6 +69,18 @@ const KIND_NAMES = {
|
|
|
69
69
|
function hookFor(kind) {
|
|
70
70
|
return kind === "query" || kind === "data" ? "useQuery" : "useMutation";
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* The host's name nearest to `name`, for an unknown one: one `hook` can
|
|
74
|
+
* read first, so the fix is a rename and not a second error, else any.
|
|
75
|
+
*/
|
|
76
|
+
function nearestProcedure(host, name, hook) {
|
|
77
|
+
const names = Object.keys(host.procedures);
|
|
78
|
+
const fitting = names.filter((entry) => {
|
|
79
|
+
const procedure = host.procedures[entry];
|
|
80
|
+
return procedure !== void 0 && hookFor(procedure.kind) === hook;
|
|
81
|
+
});
|
|
82
|
+
return nearest(name, fitting, 1)[0] ?? nearest(name, names, 1)[0];
|
|
83
|
+
}
|
|
72
84
|
function procedureDiagnostics(host, source, uses) {
|
|
73
85
|
const diagnostics = [];
|
|
74
86
|
const report = (use, code, message) => {
|
|
@@ -95,7 +107,8 @@ function procedureDiagnostics(host, source, uses) {
|
|
|
95
107
|
}
|
|
96
108
|
const procedure = Object.hasOwn(host.procedures, use.name) ? host.procedures[use.name] : void 0;
|
|
97
109
|
if (procedure === void 0) {
|
|
98
|
-
|
|
110
|
+
const near = nearestProcedure(host, use.name, use.hook);
|
|
111
|
+
report(use, "unknown_procedure", `"${use.name}" is not a query, mutation, action or provided data on this host; its handle reports UNKNOWN_PROCEDURE${near === void 0 ? "" : `. Did you mean "${near}"?`}`);
|
|
99
112
|
continue;
|
|
100
113
|
}
|
|
101
114
|
const expected = hookFor(procedure.kind);
|
package/dist/types.d.ts
CHANGED
|
@@ -718,8 +718,8 @@ export interface JigsServer<TContext, TPageName extends string = never> {
|
|
|
718
718
|
/**
|
|
719
719
|
* The start of `prompt(mode)` that is the same on every turn: the
|
|
720
720
|
* language and the catalog, before the instructions and procedures. Mark
|
|
721
|
-
* it for a provider's prompt cache
|
|
722
|
-
* `@jigs.design/ai-sdk`).
|
|
721
|
+
* it, and the end of the prompt, for a provider's prompt cache
|
|
722
|
+
* (`cachedInstructions` in `@jigs.design/ai-sdk`).
|
|
723
723
|
*/
|
|
724
724
|
promptPrefix: (mode?: PromptMode) => string;
|
|
725
725
|
/** Changes whenever the compiler, the runtime or the host does. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jigs.design/server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"description": "createJigsServer: checks and streams programs, runs procedures, and serves the sandbox frame.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,11 +29,11 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@jigs.design/
|
|
33
|
-
"@jigs.design/host": "0.3.
|
|
34
|
-
"@jigs.design/
|
|
35
|
-
"@jigs.design/
|
|
36
|
-
"@jigs.design/
|
|
32
|
+
"@jigs.design/compiler": "0.3.4",
|
|
33
|
+
"@jigs.design/host": "0.3.4",
|
|
34
|
+
"@jigs.design/prompt": "0.3.4",
|
|
35
|
+
"@jigs.design/runtime": "0.3.4",
|
|
36
|
+
"@jigs.design/protocol": "0.3.4"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"zod": "^4.0.0"
|