@jskit-ai/jskit-catalog 0.2.128 → 0.2.129
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/catalog/packages.json +16 -16
- package/package.json +1 -1
- package/scripts/jskit.mjs +8 -3
- package/scripts/server-setup.mjs +86 -0
package/catalog/packages.json
CHANGED
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
"release": {
|
|
7
7
|
"packages": {
|
|
8
8
|
"@jskit-ai/agent": "0.1.5",
|
|
9
|
-
"@jskit-ai/agent-docs": "0.1.
|
|
10
|
-
"@jskit-ai/agent-runtime": "0.1.
|
|
9
|
+
"@jskit-ai/agent-docs": "0.1.377",
|
|
10
|
+
"@jskit-ai/agent-runtime": "0.1.56",
|
|
11
11
|
"@jskit-ai/architecture-inspector": "0.1.37",
|
|
12
|
-
"@jskit-ai/assistant-core": "0.2.
|
|
13
|
-
"@jskit-ai/assistant-runtime": "0.2.
|
|
14
|
-
"@jskit-ai/assistant-voice": "0.2.
|
|
15
|
-
"@jskit-ai/assistant-voice-sherpa": "0.1.
|
|
12
|
+
"@jskit-ai/assistant-core": "0.2.103",
|
|
13
|
+
"@jskit-ai/assistant-runtime": "0.2.111",
|
|
14
|
+
"@jskit-ai/assistant-voice": "0.2.111",
|
|
15
|
+
"@jskit-ai/assistant-voice-sherpa": "0.1.158",
|
|
16
16
|
"@jskit-ai/auth-core": "0.2.43",
|
|
17
17
|
"@jskit-ai/auth-pass": "0.1.12",
|
|
18
18
|
"@jskit-ai/auth-provider-local-core": "0.2.52",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@jskit-ai/database-runtime-postgres": "0.1.292",
|
|
34
34
|
"@jskit-ai/http-runtime": "0.2.39",
|
|
35
35
|
"@jskit-ai/http-web": "0.2.72",
|
|
36
|
-
"@jskit-ai/jskit-catalog": "0.2.
|
|
36
|
+
"@jskit-ai/jskit-catalog": "0.2.129",
|
|
37
37
|
"@jskit-ai/kernel": "0.2.38",
|
|
38
38
|
"@jskit-ai/material-web": "0.1.17",
|
|
39
39
|
"@jskit-ai/mobile-capacitor": "0.2.63",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"packageId": "@jskit-ai/agent-runtime",
|
|
116
|
-
"version": "0.1.
|
|
116
|
+
"version": "0.1.56",
|
|
117
117
|
"description": "Opt-in parts of the agent: its own tables (saved runs, goals, summaries, commands) and coding tools (files, commands in gVisor or a local process, to-do list, notes, goals, asking the person). PostgreSQL.",
|
|
118
118
|
"jskit": {
|
|
119
119
|
"kind": "runtime",
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
187
|
"packageId": "@jskit-ai/assistant-core",
|
|
188
|
-
"version": "0.2.
|
|
188
|
+
"version": "0.2.103",
|
|
189
189
|
"description": "Reusable assistant client/server/shared primitives without surface-specific routes or settings ownership.",
|
|
190
190
|
"jskit": {
|
|
191
191
|
"kind": "runtime",
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
},
|
|
370
370
|
{
|
|
371
371
|
"packageId": "@jskit-ai/assistant-runtime",
|
|
372
|
-
"version": "0.2.
|
|
372
|
+
"version": "0.2.111",
|
|
373
373
|
"description": "Capability-based assistant runtime with per-surface chat, transcripts, settings, and action tools.",
|
|
374
374
|
"jskit": {
|
|
375
375
|
"kind": "runtime",
|
|
@@ -475,7 +475,7 @@
|
|
|
475
475
|
},
|
|
476
476
|
"packageJson": {
|
|
477
477
|
"dependencies": {
|
|
478
|
-
"@jskit-ai/assistant-core": "0.2.
|
|
478
|
+
"@jskit-ai/assistant-core": "0.2.103",
|
|
479
479
|
"@jskit-ai/resource-core": "0.1.229",
|
|
480
480
|
"json-rest-schema": "^1.0.20"
|
|
481
481
|
},
|
|
@@ -495,7 +495,7 @@
|
|
|
495
495
|
},
|
|
496
496
|
{
|
|
497
497
|
"packageId": "@jskit-ai/assistant-voice",
|
|
498
|
-
"version": "0.2.
|
|
498
|
+
"version": "0.2.111",
|
|
499
499
|
"description": "Duplex voice conversations with application-owned targets and authorization, and the speech service engine with its client.",
|
|
500
500
|
"jskit": {
|
|
501
501
|
"kind": "runtime",
|
|
@@ -541,7 +541,7 @@
|
|
|
541
541
|
},
|
|
542
542
|
"packageJson": {
|
|
543
543
|
"dependencies": {
|
|
544
|
-
"@jskit-ai/assistant-core": "0.2.
|
|
544
|
+
"@jskit-ai/assistant-core": "0.2.103",
|
|
545
545
|
"ws": "^8.20.1"
|
|
546
546
|
},
|
|
547
547
|
"peerDependencies": {
|
|
@@ -553,7 +553,7 @@
|
|
|
553
553
|
},
|
|
554
554
|
{
|
|
555
555
|
"packageId": "@jskit-ai/assistant-voice-sherpa",
|
|
556
|
-
"version": "0.1.
|
|
556
|
+
"version": "0.1.158",
|
|
557
557
|
"description": "Optional native Sherpa speech engine and explicit model preparation for assistant voice.",
|
|
558
558
|
"jskit": {
|
|
559
559
|
"kind": "runtime",
|
|
@@ -591,7 +591,7 @@
|
|
|
591
591
|
},
|
|
592
592
|
"packageJson": {
|
|
593
593
|
"dependencies": {
|
|
594
|
-
"@jskit-ai/assistant-voice": "0.2.
|
|
594
|
+
"@jskit-ai/assistant-voice": "0.2.111",
|
|
595
595
|
"sherpa-onnx-node": "1.13.6"
|
|
596
596
|
}
|
|
597
597
|
}
|
|
@@ -4337,7 +4337,7 @@
|
|
|
4337
4337
|
"@jskit-ai/shell-web"
|
|
4338
4338
|
],
|
|
4339
4339
|
"packageId": "@jskit-ai/assistant-runtime",
|
|
4340
|
-
"packageVersion": "0.2.
|
|
4340
|
+
"packageVersion": "0.2.111",
|
|
4341
4341
|
"documentPath": "patterns/assistant-surface/PATTERN.md",
|
|
4342
4342
|
"examplePath": "patterns/assistant-surface/example",
|
|
4343
4343
|
"files": [
|
package/package.json
CHANGED
package/scripts/jskit.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { checkManifestCapabilities, formatManifestCapabilitiesReport } from "./m
|
|
|
18
18
|
import { checkMaterial3, formatMaterial3Report } from "./material3.mjs";
|
|
19
19
|
import { checkPackageNix, formatPackageNixReport, packageNix } from "./package-nix.mjs";
|
|
20
20
|
import { checkProject, updateProject } from "./project-packages.mjs";
|
|
21
|
+
import { checkServerSetup, formatServerSetupReport } from "./server-setup.mjs";
|
|
21
22
|
import { runTests } from "./testing/command.mjs";
|
|
22
23
|
import { runMigrationHistory } from "./testing/databases.mjs";
|
|
23
24
|
import { checkTestRuns, formatTestRunsReport } from "./testing/runs.mjs";
|
|
@@ -81,7 +82,9 @@ function usage() {
|
|
|
81
82
|
" (package/nix-current), when package.json lacks what the package needs (package/nix-manifest), or",
|
|
82
83
|
" when package-lock.json names a dependency a build with no network cannot fetch by its hash",
|
|
83
84
|
" (package/nix-offline). In an app whose package.json declares @jskit-ai/jskit-catalog, it fails when",
|
|
84
|
-
" AGENTS.md lacks this catalog's JSKIT block, or its block differs (agents/jskit-block).",
|
|
85
|
+
" AGENTS.md lacks this catalog's JSKIT block, or its block differs (agents/jskit-block). It fails",
|
|
86
|
+
" when the app's server.js creates Fastify without a trustProxy option (server/trust-proxy), which",
|
|
87
|
+
" behind a reverse proxy sees every request as the proxy's; options it cannot read pass.",
|
|
85
88
|
" check m3 Check application UI source against the JSKIT Material 3 guide alone, with each finding's guide",
|
|
86
89
|
" section and every exception: the whole app, or only the given files and directories (a section,",
|
|
87
90
|
" or a task's changed files). Plain jskit check applies the same rules to the whole app.",
|
|
@@ -413,6 +416,7 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
413
416
|
const capabilities = await checkManifestCapabilities({ projectRoot: options.projectRoot, manifests: result.manifests });
|
|
414
417
|
const nixPackage = await checkPackageNix({ projectRoot: options.projectRoot });
|
|
415
418
|
const agents = await checkAgentsBlock({ projectRoot: options.projectRoot });
|
|
419
|
+
const server = await checkServerSetup({ projectRoot: options.projectRoot });
|
|
416
420
|
// The data rules first: a graph that fails on many pin versions would otherwise bury them.
|
|
417
421
|
const reports = [
|
|
418
422
|
formatDataAccessReport(data),
|
|
@@ -425,9 +429,10 @@ async function main(argv = process.argv.slice(2)) {
|
|
|
425
429
|
formatTestSourcesReport(sources),
|
|
426
430
|
formatManifestCapabilitiesReport(capabilities),
|
|
427
431
|
formatPackageNixReport(nixPackage),
|
|
428
|
-
formatAgentsBlockReport(agents)
|
|
432
|
+
formatAgentsBlockReport(agents),
|
|
433
|
+
formatServerSetupReport(server)
|
|
429
434
|
];
|
|
430
|
-
if (!result.ok || !ui.ok || !tests.ok || !sources.ok || !data.ok || !capabilities.ok || !nixPackage.ok || !agents.ok) {
|
|
435
|
+
if (!result.ok || !ui.ok || !tests.ok || !sources.ok || !data.ok || !capabilities.ok || !nixPackage.ok || !agents.ok || !server.ok) {
|
|
431
436
|
throw new Error(reports.join("\n"));
|
|
432
437
|
}
|
|
433
438
|
process.stdout.write(`${reports.join("\n")}\n`);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { nextCodeOffset, objectArgument, objectKeys, readSourceFile } from "./data-access-source.mjs";
|
|
4
|
+
|
|
5
|
+
// The server part of plain `jskit check`, read from source, never run: the app's server.js creates Fastify with a
|
|
6
|
+
// trustProxy option, so behind a reverse proxy request.ip, the logs and the per-address rate limits see each visitor
|
|
7
|
+
// rather than the proxy. The foundation patterns pass `trustProxy: resolveTrustedProxies(runtimeEnv)`; a trustProxy the
|
|
8
|
+
// app sets another way is the app's choice. Only a Fastify call whose options are known to lack one is reported: options
|
|
9
|
+
// passed as a variable, or spread into the literal, are not something a source read can see into.
|
|
10
|
+
|
|
11
|
+
const GUIDE = "https://mobily-enterprises.github.io/jskit-ai/guide/app-setup/authentication#sign-in-protection";
|
|
12
|
+
const SERVER_FILE = "server.js";
|
|
13
|
+
const RULE = "server/trust-proxy";
|
|
14
|
+
const MESSAGE = "Fastify is created without trustProxy, so behind a reverse proxy every request comes from the proxy: " +
|
|
15
|
+
"request.ip, the logs and the per-address rate limits see one visitor. Pass `trustProxy: resolveTrustedProxies(runtimeEnv)` " +
|
|
16
|
+
"from @jskit-ai/kernel/server/http.";
|
|
17
|
+
|
|
18
|
+
const IDENTIFIER = String.raw`[A-Za-z_$][\w$]*`;
|
|
19
|
+
const FROM_FASTIFY = String.raw`\s*from\s*["']fastify["']`;
|
|
20
|
+
|
|
21
|
+
// The names server.js gives Fastify's factory: its default import, its `fastify` or `default` named import, or require().
|
|
22
|
+
function fastifyNames(code) {
|
|
23
|
+
const names = new Set();
|
|
24
|
+
for (const match of code.matchAll(new RegExp(String.raw`\bimport\s+(${IDENTIFIER})\s*(?:,\s*\{[^}]*\})?${FROM_FASTIFY}`, "gu"))) {
|
|
25
|
+
names.add(match[1]);
|
|
26
|
+
}
|
|
27
|
+
for (const match of code.matchAll(new RegExp(String.raw`\bimport\s+(?:${IDENTIFIER}\s*,\s*)?\{([^}]*)\}${FROM_FASTIFY}`, "gu"))) {
|
|
28
|
+
for (const specifier of match[1].split(",")) {
|
|
29
|
+
const named = new RegExp(String.raw`^\s*(fastify|default)(?:\s+as\s+(${IDENTIFIER}))?\s*$`, "u").exec(specifier);
|
|
30
|
+
if (named) names.add(named[2] || named[1]);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
for (const match of code.matchAll(new RegExp(String.raw`\b(?:const|let|var)\s+(${IDENTIFIER})\s*=\s*require\(\s*["']fastify["']\s*\)`, "gu"))) {
|
|
34
|
+
names.add(match[1]);
|
|
35
|
+
}
|
|
36
|
+
names.delete("default");
|
|
37
|
+
return names;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Each Fastify call in server.js, by whether its options set trustProxy ("set"), are known to lack it ("missing"), or
|
|
41
|
+
// cannot be read from source ("unread": a variable, or a literal that spreads or computes keys).
|
|
42
|
+
function fastifyCalls({ code, masked, position }) {
|
|
43
|
+
const calls = [];
|
|
44
|
+
for (const name of fastifyNames(code)) {
|
|
45
|
+
for (const match of masked.matchAll(new RegExp(String.raw`(?<![\w$.])${name.replace(/\$/gu, "\\$")}\s*\(`, "gu"))) {
|
|
46
|
+
if (/function\s*\*?\s*$/u.test(masked.slice(Math.max(0, match.index - 20), match.index))) continue;
|
|
47
|
+
const options = objectArgument(masked, match.index, match[0].length);
|
|
48
|
+
let status;
|
|
49
|
+
if (options) {
|
|
50
|
+
const { keys, partial } = objectKeys(masked, options.start, options.end);
|
|
51
|
+
status = keys.some(({ key }) => key === "trustProxy") ? "set" : partial ? "unread" : "missing";
|
|
52
|
+
} else {
|
|
53
|
+
status = masked[nextCodeOffset(masked, match.index + match[0].length)] === ")" ? "missing" : "unread";
|
|
54
|
+
}
|
|
55
|
+
calls.push({ line: position(match.index).line, status });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return calls.sort((left, right) => left.line - right.line);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async function checkServerSetup({ projectRoot }) {
|
|
62
|
+
let source;
|
|
63
|
+
try {
|
|
64
|
+
source = await readFile(path.join(path.resolve(projectRoot), SERVER_FILE), "utf8");
|
|
65
|
+
} catch (error) {
|
|
66
|
+
if (error?.code === "ENOENT") return { ok: true, findings: [], servers: 0, unread: 0 };
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
const calls = fastifyCalls(readSourceFile(source));
|
|
70
|
+
const findings = calls.filter(({ status }) => status === "missing")
|
|
71
|
+
.map(({ line }) => ({ file: SERVER_FILE, line, rule: RULE, message: MESSAGE }));
|
|
72
|
+
const count = (wanted) => calls.filter(({ status }) => status === wanted).length;
|
|
73
|
+
return { ok: findings.length < 1, findings, servers: count("set"), unread: count("unread") };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatServerSetupReport(result) {
|
|
77
|
+
const lines = result.findings.flatMap(({ file, line, rule, message }) => [`${file}:${line} ${rule} ${message}`, ` ${GUIDE}`]);
|
|
78
|
+
const unread = result.unread ? ` (and creates ${result.unread} whose options it reads from elsewhere)` : "";
|
|
79
|
+
lines.push(result.ok
|
|
80
|
+
? `JSKIT server sets Fastify's trustProxy in ${result.servers} server(s)${unread}.`
|
|
81
|
+
: `JSKIT server: ${result.findings.length} error(s). server.js creates Fastify with a trustProxy option, so each ` +
|
|
82
|
+
"visitor behind the app's proxies keeps its own address.");
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { checkServerSetup, formatServerSetupReport };
|