@antelopejs/dms-ai 0.7.0 → 0.8.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/README.md +17 -7
- package/dist/lifecycle/skill-sources.js +17 -17
- package/dist/lifecycle/skill-sources.js.map +1 -1
- package/dist/pages/settings/availability.js.map +1 -1
- package/dist/routes/builder.d.ts +7 -1
- package/dist/routes/builder.js.map +1 -1
- package/dist/routes/changes.d.ts +5 -4
- package/dist/routes/changes.js.map +1 -1
- package/dist/routes/codex-account.d.ts +3 -2
- package/dist/routes/codex-account.js.map +1 -1
- package/dist/routes/sidecar-results.d.ts +2 -2
- package/dist/routes/sidecar-results.js.map +1 -1
- package/dist/routes/status.js.map +1 -1
- package/dist/sidecar/http-client.js +3 -1
- package/dist/sidecar/http-client.js.map +1 -1
- package/dist/sidecar/index.d.ts +1 -0
- package/dist/sidecar/index.js +1 -0
- package/dist/sidecar/index.js.map +1 -1
- package/dist/sidecar/json-body.d.ts +4 -0
- package/dist/sidecar/json-body.js +33 -0
- package/dist/sidecar/json-body.js.map +1 -0
- package/dist/sidecar/settings-values.d.ts +5 -2
- package/dist/sidecar/settings-values.js.map +1 -1
- package/frontend-vue/app/components/SkillDetail.vue +1 -1
- package/frontend-vue/app/views/ChangeSetPanel.vue +1 -1
- package/frontend-vue/app/views/composables/useAiData.ts +10 -18
- package/frontend-vue/app/views/composables/useChangeSetActions.ts +5 -15
- package/frontend-vue/app/views/constants.ts +1 -1
- package/frontend-vue/app/views/types.ts +1 -1
- package/frontend-vue/build/backend-boundary.ts +54 -21
- package/frontend-vue/tests/support/api-error-presenter.ts +28 -0
- package/frontend-vue/tests/views/api-data-reads.test.ts +2 -0
- package/frontend-vue/tests/views/api-error-presentation.test.ts +89 -0
- package/package.json +4 -3
- package/sidecar/dist/logs/logs-client.js +2 -1
- package/sidecar/dist/logs/logs-client.js.map +1 -1
- package/sidecar/dist/logs/types.d.ts +2 -1
- package/sidecar/dist/mcp/define-tool.d.ts +1 -1
- package/sidecar/dist/mcp/define-tool.js.map +1 -1
- package/sidecar/dist/mcp/tools/builder-expr.d.ts +5 -0
- package/sidecar/dist/mcp/tools/builder-expr.js +25 -0
- package/sidecar/dist/mcp/tools/builder-expr.js.map +1 -0
- package/sidecar/dist/mcp/tools/builder-gate.js +2 -2
- package/sidecar/dist/mcp/tools/builder-gate.js.map +1 -1
- package/sidecar/dist/mcp/tools/builder-queries.d.ts +34 -0
- package/sidecar/dist/mcp/tools/builder-queries.js +56 -0
- package/sidecar/dist/mcp/tools/builder-queries.js.map +1 -0
- package/sidecar/dist/mcp/tools/builder.d.ts +31 -19
- package/sidecar/dist/mcp/tools/builder.js +3 -69
- package/sidecar/dist/mcp/tools/builder.js.map +1 -1
- package/sidecar/dist/mcp/types.d.ts +2 -1
- package/sidecar/dist/protocol/json.d.ts +4 -0
- package/sidecar/dist/protocol/json.js +29 -0
- package/sidecar/dist/protocol/json.js.map +1 -1
- package/sidecar/dist/providers/claude/config.d.ts +4 -1
- package/sidecar/dist/providers/claude/config.js.map +1 -1
- package/sidecar/dist/providers/claude/provider.js.map +1 -1
- package/sidecar/dist/server/chat-events.d.ts +16 -3
- package/sidecar/dist/server/chat-events.js.map +1 -1
- package/sidecar/dist/server/http-io.d.ts +2 -1
- package/sidecar/dist/server/http-io.js.map +1 -1
- package/sidecar/dist/server/http-routes.js +4 -7
- package/sidecar/dist/server/http-routes.js.map +1 -1
- package/sidecar/dist/server/permission-events.d.ts +8 -4
- package/sidecar/dist/server/permission-events.js.map +1 -1
- package/sidecar/dist/server/routing.js +4 -1
- package/sidecar/dist/server/routing.js.map +1 -1
- package/sidecar/dist/server/safety-net.js +2 -2
- package/sidecar/dist/server/safety-net.js.map +1 -1
- package/sidecar/dist/server/tool-calls.d.ts +13 -4
- package/sidecar/dist/server/tool-calls.js.map +1 -1
- package/sidecar/dist/server/turns.d.ts +16 -2
- package/sidecar/dist/server/turns.js +5 -3
- package/sidecar/dist/server/turns.js.map +1 -1
- package/sidecar/dist/state/change-sets.js +4 -1
- package/sidecar/dist/state/change-sets.js.map +1 -1
- package/sidecar/dist/state/store.js +8 -2
- package/sidecar/dist/state/store.js.map +1 -1
- package/skills/dms-ai/SKILL.md +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
2
2
|
import { dirname, isAbsolute, join, relative, sep } from "node:path";
|
|
3
|
-
import type {
|
|
3
|
+
import type { DmsVitePluginEntry } from "#dms/frontend-build";
|
|
4
|
+
|
|
5
|
+
type VitePlugin = Extract<DmsVitePluginEntry, { name: string }>;
|
|
4
6
|
|
|
5
7
|
const BACKEND_PACKAGE = "@antelopejs/dms-ai";
|
|
6
8
|
const BACKEND_SOURCE = "src";
|
|
@@ -8,20 +10,32 @@ const QUERY_OR_HASH = /[?#].*$/;
|
|
|
8
10
|
|
|
9
11
|
const backendRoots = new Map<string, string | null>();
|
|
10
12
|
|
|
13
|
+
/** Whether a parsed manifest names its package. */
|
|
14
|
+
function isNamedManifest(value: unknown): value is { name: string } {
|
|
15
|
+
return (
|
|
16
|
+
typeof value === "object" &&
|
|
17
|
+
value !== null &&
|
|
18
|
+
"name" in value &&
|
|
19
|
+
typeof value.name === "string"
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The package name a `package.json` declares, or `undefined`. */
|
|
11
24
|
function packageName(manifest: string): string | undefined {
|
|
12
25
|
try {
|
|
13
|
-
const parsed:
|
|
14
|
-
|
|
15
|
-
);
|
|
16
|
-
return parsed.name;
|
|
26
|
+
const parsed: unknown = JSON.parse(readFileSync(manifest, "utf8"));
|
|
27
|
+
return isNamedManifest(parsed) ? parsed.name : undefined;
|
|
17
28
|
} catch {
|
|
18
29
|
return undefined;
|
|
19
30
|
}
|
|
20
31
|
}
|
|
21
32
|
|
|
33
|
+
/** The directory of the backend package that holds `directory`, or null. */
|
|
22
34
|
function backendRoot(directory: string): string | null {
|
|
23
35
|
const known = backendRoots.get(directory);
|
|
24
|
-
if (known !== undefined)
|
|
36
|
+
if (known !== undefined) {
|
|
37
|
+
return known;
|
|
38
|
+
}
|
|
25
39
|
const manifest = join(directory, "package.json");
|
|
26
40
|
const parent = dirname(directory);
|
|
27
41
|
let root: string | null = null;
|
|
@@ -38,12 +52,13 @@ function backendRoot(directory: string): string | null {
|
|
|
38
52
|
* The real path of a resolved module id when it lies under the `src`
|
|
39
53
|
* directory of the backend package, or `undefined`. The package that owns the
|
|
40
54
|
* file decides, not a path, so the answer is the same in the repository and in
|
|
41
|
-
* the workspace
|
|
42
|
-
* not files are ignored.
|
|
55
|
+
* the build workspace. Virtual ids and ids that are not files are ignored.
|
|
43
56
|
*/
|
|
44
57
|
function backendSourceFile(id: string): string | undefined {
|
|
45
58
|
const path = id.replace(QUERY_OR_HASH, "");
|
|
46
|
-
if (!isAbsolute(path))
|
|
59
|
+
if (!isAbsolute(path)) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
47
62
|
let real: string;
|
|
48
63
|
try {
|
|
49
64
|
real = realpathSync(path);
|
|
@@ -51,38 +66,56 @@ function backendSourceFile(id: string): string | undefined {
|
|
|
51
66
|
return undefined;
|
|
52
67
|
}
|
|
53
68
|
const root = backendRoot(dirname(real));
|
|
54
|
-
if (root === null)
|
|
69
|
+
if (root === null) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
55
72
|
return relative(root, real).split(sep)[0] === BACKEND_SOURCE
|
|
56
73
|
? real
|
|
57
74
|
: undefined;
|
|
58
75
|
}
|
|
59
76
|
|
|
60
77
|
/**
|
|
61
|
-
* Fails the build
|
|
62
|
-
*
|
|
63
|
-
* backend only through its HTTP
|
|
64
|
-
* chain returns, so an alias is seen through
|
|
65
|
-
* returns is followed to its real path, and it runs
|
|
66
|
-
* (`enforce: "pre"`).
|
|
78
|
+
* Fails the build and the dev server when a module of the frontend resolves to
|
|
79
|
+
* a file under the `src` of the backend package: the browser reaches the
|
|
80
|
+
* backend only through its HTTP interface. It checks what the whole resolution
|
|
81
|
+
* chain returns, an id marked external included, so an alias is seen through
|
|
82
|
+
* and a symlink the resolver returns is followed to its real path, and it runs
|
|
83
|
+
* before the other plugins (`enforce: "pre"`). Vite builds workers with their
|
|
84
|
+
* own plugin list, so the plugin adds itself there too.
|
|
85
|
+
*
|
|
86
|
+
* antelopejs-sync writes this file from `@antelopejs/tooling-configs` and
|
|
87
|
+
* restores it on every run: change the plugin in the pack, not here.
|
|
67
88
|
*/
|
|
68
|
-
export function backendBoundary():
|
|
89
|
+
export function backendBoundary(): VitePlugin {
|
|
90
|
+
return {
|
|
91
|
+
...boundaryCheck(),
|
|
92
|
+
config: () => ({ worker: { plugins: () => [boundaryCheck()] } }),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** The check alone, as a worker build runs it. */
|
|
97
|
+
function boundaryCheck(): VitePlugin {
|
|
69
98
|
return {
|
|
70
|
-
name:
|
|
99
|
+
name: `${BACKEND_PACKAGE}:backend-boundary`,
|
|
71
100
|
enforce: "pre",
|
|
72
101
|
async resolveId(source, importer, options) {
|
|
73
102
|
const resolved = await this.resolve(source, importer, {
|
|
74
103
|
...options,
|
|
75
104
|
skipSelf: true,
|
|
76
105
|
});
|
|
77
|
-
if (resolved === null
|
|
106
|
+
if (resolved === null) {
|
|
107
|
+
return resolved;
|
|
108
|
+
}
|
|
78
109
|
const file = backendSourceFile(resolved.id);
|
|
79
|
-
if (file === undefined)
|
|
110
|
+
if (file === undefined) {
|
|
111
|
+
return resolved;
|
|
112
|
+
}
|
|
80
113
|
const from =
|
|
81
114
|
importer === undefined
|
|
82
115
|
? "an entry point"
|
|
83
116
|
: importer.replace(QUERY_OR_HASH, "");
|
|
84
117
|
return this.error(
|
|
85
|
-
`Backend boundary: ${from} imports ${file}, which is under src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP
|
|
118
|
+
`Backend boundary: ${from} imports ${file}, which is under the src of ${BACKEND_PACKAGE}. The frontend reaches the backend only through its HTTP interface.`,
|
|
86
119
|
);
|
|
87
120
|
},
|
|
88
121
|
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import { afterEach, vi } from "vitest";
|
|
3
|
+
import { useApiErrorPresenter } from "../../../node_modules/@antelopejs/dms/frontend-vue/layers/dms-core/app/composables/useApiErrorPresenter";
|
|
4
|
+
|
|
5
|
+
afterEach(() => vi.unstubAllEnvs());
|
|
6
|
+
|
|
7
|
+
export function installApiErrorPresenter() {
|
|
8
|
+
vi.stubEnv("SSR", false);
|
|
9
|
+
const add = vi.fn(() => ({ id: "notice" }));
|
|
10
|
+
const messages: Record<string, string> = {
|
|
11
|
+
"error.read_only_demo": "This demo is read-only.",
|
|
12
|
+
"error.500.description": "Something went wrong.",
|
|
13
|
+
"dms_ai.views.error.description": "Could not load the assistant's data.",
|
|
14
|
+
"dms_ai.views.unavailable.description": "The assistant is not running.",
|
|
15
|
+
};
|
|
16
|
+
vi.stubGlobal("useToast", () => ({ add }));
|
|
17
|
+
vi.stubGlobal("getPluginI18n", () => ({
|
|
18
|
+
i18n: {
|
|
19
|
+
tm: (key: string) =>
|
|
20
|
+
Object.hasOwn(messages, key) ? messages[key] : null,
|
|
21
|
+
rt: (message: string) => message,
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
const presented = ref(new WeakMap<object, string | number | null>());
|
|
25
|
+
vi.stubGlobal("useDmsState", () => presented);
|
|
26
|
+
vi.stubGlobal("useApiErrorPresenter", useApiErrorPresenter);
|
|
27
|
+
return { add };
|
|
28
|
+
}
|
|
@@ -15,6 +15,7 @@ import ActivityDetail from "../../app/components/ActivityDetail.vue";
|
|
|
15
15
|
import ChangesView from "../../app/components/ChangesView.vue";
|
|
16
16
|
import ChangeSetPanel from "../../app/views/ChangeSetPanel.vue";
|
|
17
17
|
import UnavailableState from "../../app/views/UnavailableState.vue";
|
|
18
|
+
import { installApiErrorPresenter } from "../support/api-error-presenter";
|
|
18
19
|
|
|
19
20
|
// The views read what they render with the DMS's `useApiData`, which a server
|
|
20
21
|
// render hands to the browser (this repository has no renderer to run it:
|
|
@@ -241,6 +242,7 @@ beforeEach(() => {
|
|
|
241
242
|
vi.stubGlobal("useApiPagedData", useApiPagedData);
|
|
242
243
|
vi.stubGlobal("refreshPageBlocks", refreshPageBlocks);
|
|
243
244
|
vi.stubGlobal("useAuthFetch", () => ({ $authFetch: authFetch }));
|
|
245
|
+
installApiErrorPresenter();
|
|
244
246
|
vi.stubGlobal("useI18n", () => ({
|
|
245
247
|
t: (key: string) => key,
|
|
246
248
|
te: () => false,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
2
|
+
import { ref } from "vue";
|
|
3
|
+
import { useAiData } from "../../app/views/composables/useAiData";
|
|
4
|
+
import { useChangeSetActions } from "../../app/views/composables/useChangeSetActions";
|
|
5
|
+
import { installApiErrorPresenter } from "../support/api-error-presenter";
|
|
6
|
+
|
|
7
|
+
afterEach(() => vi.unstubAllGlobals());
|
|
8
|
+
|
|
9
|
+
it.each([
|
|
10
|
+
{
|
|
11
|
+
status: 403,
|
|
12
|
+
data: { message: "error.read_only_demo", severity: "warning" },
|
|
13
|
+
title: "This demo is read-only.",
|
|
14
|
+
color: "warning",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
status: 403,
|
|
18
|
+
data: { message: "unknown.server.key" },
|
|
19
|
+
title: "Could not load the assistant's data.",
|
|
20
|
+
color: "warning",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
status: 503,
|
|
24
|
+
data: { message: "unknown.server.key" },
|
|
25
|
+
title: "The assistant is not running.",
|
|
26
|
+
color: "error",
|
|
27
|
+
},
|
|
28
|
+
])(
|
|
29
|
+
"presents redo failure $status once with server or fallback copy",
|
|
30
|
+
async ({ status, data, title, color }) => {
|
|
31
|
+
const { add } = installApiErrorPresenter();
|
|
32
|
+
const error = Object.assign(new Error("Request failed"), {
|
|
33
|
+
response: new Response(JSON.stringify(data), {
|
|
34
|
+
status,
|
|
35
|
+
headers: { "content-type": "application/json" },
|
|
36
|
+
}),
|
|
37
|
+
data,
|
|
38
|
+
});
|
|
39
|
+
vi.stubGlobal("useI18n", () => ({ t: (key: string) => key }));
|
|
40
|
+
vi.stubGlobal("useConfirmFrom", () => ({}));
|
|
41
|
+
vi.stubGlobal("useAuthFetch", () => ({
|
|
42
|
+
$authFetch: async () => {
|
|
43
|
+
throw error;
|
|
44
|
+
},
|
|
45
|
+
}));
|
|
46
|
+
const actions = useChangeSetActions();
|
|
47
|
+
const changeSet = {
|
|
48
|
+
id: "change-1",
|
|
49
|
+
number: 1,
|
|
50
|
+
conversationId: "conversation-1",
|
|
51
|
+
title: "Rename page",
|
|
52
|
+
createdAtMs: 1,
|
|
53
|
+
agent: "claude",
|
|
54
|
+
scope: "safe",
|
|
55
|
+
isAutoFix: false,
|
|
56
|
+
overlapped: false,
|
|
57
|
+
files: [],
|
|
58
|
+
added: 1,
|
|
59
|
+
removed: 0,
|
|
60
|
+
typecheck: "passed",
|
|
61
|
+
state: "applied",
|
|
62
|
+
approvalsNeeded: 0,
|
|
63
|
+
builderOps: 0,
|
|
64
|
+
} satisfies Parameters<typeof actions.redo>[0];
|
|
65
|
+
await actions.redo(changeSet);
|
|
66
|
+
await actions.redo(changeSet);
|
|
67
|
+
expect(add.mock.calls).toEqual([
|
|
68
|
+
[expect.objectContaining({ title, color })],
|
|
69
|
+
]);
|
|
70
|
+
expect(actions.isBusy.value).toBe(false);
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
it("resolves a JSON read refusal as translated inline copy without a toast", () => {
|
|
75
|
+
const { add } = installApiErrorPresenter();
|
|
76
|
+
const data = { message: "error.read_only_demo", severity: "warning" };
|
|
77
|
+
const error = Object.assign(new Error("Forbidden"), {
|
|
78
|
+
response: new Response(JSON.stringify(data), { status: 403 }),
|
|
79
|
+
data,
|
|
80
|
+
});
|
|
81
|
+
vi.stubGlobal("useApiData", () => ({
|
|
82
|
+
error: ref(error),
|
|
83
|
+
status: ref("error"),
|
|
84
|
+
}));
|
|
85
|
+
const read = useAiData("/ai/changes");
|
|
86
|
+
expect(read.failure.value).toBe("error");
|
|
87
|
+
expect(read.message.value).toBe("This demo is read-only.");
|
|
88
|
+
expect(add).not.toHaveBeenCalled();
|
|
89
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/dms-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "AI development assistant for the AntelopeJS DMS: a chat panel next to every page and a coding agent that edits the project in reviewable, undoable change sets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"prepack": "pnpm run build && pnpm run build:sidecar",
|
|
48
48
|
"frontend:dev": "cd playground && pnpm frontend:dev",
|
|
49
49
|
"dev": "cd playground && pnpm dev",
|
|
50
|
-
"lint": "oxlint && pnpm --dir frontend-vue lint && antelopejs-check-interface-ranges && node scripts/check-playground-install.mjs && node scripts/check-i18n.mjs",
|
|
50
|
+
"lint": "oxlint && pnpm --dir frontend-vue lint && node node_modules/@antelopejs/dms/frontend-vue/scripts/check-api-error-presentation.mjs frontend-vue/app && antelopejs-check-interface-ranges && node scripts/check-playground-install.mjs && node scripts/check-i18n.mjs",
|
|
51
51
|
"lint:fix": "oxlint --fix && oxfmt . && pnpm --dir frontend-vue lint:fix",
|
|
52
52
|
"typecheck": "tsc --noEmit && pnpm --dir frontend-vue typecheck:chat && pnpm --dir sidecar typecheck",
|
|
53
53
|
"test": "pnpm run test:node",
|
|
@@ -86,7 +86,8 @@
|
|
|
86
86
|
"zod": "^4.0.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
|
-
"@antelopejs/
|
|
89
|
+
"@antelopejs/dms": ">=0.13.1 <1.0.0",
|
|
90
|
+
"@antelopejs/tooling-configs": "^0.2.17",
|
|
90
91
|
"@types/node": "^24.0.0",
|
|
91
92
|
"@types/ws": "^8.5.12",
|
|
92
93
|
"knip": "^6.34.0",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { SIDECAR_AUTH_HEADER } from "../constants/daemon.js";
|
|
3
3
|
import { LOGS_FETCH_FAILED_MESSAGE, LOGS_FETCH_TIMEOUT_MS, LOGS_LOG_PREFIX, LOGS_PATH, } from "../constants/logs.js";
|
|
4
|
+
import { isJsonValue } from "../protocol/json.js";
|
|
4
5
|
function buildHeaders(token) {
|
|
5
6
|
return token === undefined ? {} : { [SIDECAR_AUTH_HEADER]: token };
|
|
6
7
|
}
|
|
@@ -32,7 +33,7 @@ const BufferedLogSchema = z.object({
|
|
|
32
33
|
time: z.number(),
|
|
33
34
|
channel: z.string(),
|
|
34
35
|
levelId: z.number(),
|
|
35
|
-
args: z.array(z.unknown()),
|
|
36
|
+
args: z.array(z.unknown().refine(isJsonValue)),
|
|
36
37
|
});
|
|
37
38
|
const BufferedLogListSchema = z.array(z.unknown()).catch([]);
|
|
38
39
|
export function createLogsClient(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-client.js","sourceRoot":"","sources":["../../src/logs/logs-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,eAAe,EACf,SAAS,GACV,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"logs-client.js","sourceRoot":"","sources":["../../src/logs/logs-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wB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S,EACT,OAAO,CACR,CAAC;gBACF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBACjB,MAAM,IAAI,KAAK,CAAC,sBAAsB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC3D,CAAC;gBACD,OAAO,qBAAqB,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,CAC/D,CAAC,KAAK,EAAE,EAAE;oBACR,MAAM,GAAG,GAAG,iBAAiB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;oBAC/C,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,CAAC,CACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAChE,MAAM,CAAC,IAAI,CACT,GAAG,eAAe,IAAI,yBAAyB,KAAK,MAAM,GAAG,CAC9D,CAAC;gBACF,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -13,7 +13,7 @@ export type McpToolArgs<Schema extends McpToolInputSchema> = {
|
|
|
13
13
|
_output: infer Output;
|
|
14
14
|
} ? Output : never;
|
|
15
15
|
} & {};
|
|
16
|
-
export type McpToolHandler<Schema extends McpToolInputSchema> = (args: McpToolArgs<Schema
|
|
16
|
+
export type McpToolHandler<Schema extends McpToolInputSchema> = (args: McpToolArgs<Schema>) => Promise<McpToolResult>;
|
|
17
17
|
export interface McpToolDefinition<Schema extends McpToolInputSchema = McpToolInputSchema> {
|
|
18
18
|
name: string;
|
|
19
19
|
description: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-tool.js","sourceRoot":"","sources":["../../src/mcp/define-tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"define-tool.js","sourceRoot":"","sources":["../../src/mcp/define-tool.ts"],"names":[],"mappings":"AA8CA,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,WAAmB,EACnB,MAAc,EACd,OAA+B;IAE/B,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { McpToolResult } from "../define-tool.js";
|
|
2
|
+
export type BuilderRun = (op: string, args: unknown[]) => Promise<McpToolResult>;
|
|
3
|
+
export declare function note(description: string): string;
|
|
4
|
+
export declare function hasExprSentinel(value: unknown): boolean;
|
|
5
|
+
export declare function exprRefusal(): McpToolResult;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { BUILDER_ESCALATION_NOTE, BUILDER_EXPR_REFUSAL, } from "../../prompts/builder.js";
|
|
3
|
+
import { opResult } from "./builder-project.js";
|
|
4
|
+
export function note(description) {
|
|
5
|
+
return `${description}\n\n${BUILDER_ESCALATION_NOTE}`;
|
|
6
|
+
}
|
|
7
|
+
const EXPR_SENTINEL = z.object({ $expr: z.string() });
|
|
8
|
+
const EXPR_CARRIER = z.record(z.string(), z.unknown());
|
|
9
|
+
export function hasExprSentinel(value) {
|
|
10
|
+
if (Array.isArray(value)) {
|
|
11
|
+
return value.some(hasExprSentinel);
|
|
12
|
+
}
|
|
13
|
+
if (EXPR_SENTINEL.safeParse(value).success) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
const record = EXPR_CARRIER.safeParse(value);
|
|
17
|
+
return record.success && Object.values(record.data).some(hasExprSentinel);
|
|
18
|
+
}
|
|
19
|
+
export function exprRefusal() {
|
|
20
|
+
return opResult({
|
|
21
|
+
ok: false,
|
|
22
|
+
error: { code: "unsupported", detail: BUILDER_EXPR_REFUSAL },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=builder-expr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builder-expr.js","sourceRoot":"","sources":["../../../src/mcp/tools/builder-expr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAShD,MAAM,UAAU,IAAI,CAAC,WAAmB;IACtC,OAAO,GAAG,WAAW,OAAO,uBAAuB,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACtD,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAGvD,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IACrC,CAAC;IACD,IAAI,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;QAC3C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAC7C,OAAO,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;AAC5E,CAAC;AAGD,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC;QACd,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE;KAC7D,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,12 +9,12 @@ function withGate(definition, gate) {
|
|
|
9
9
|
return definition;
|
|
10
10
|
return {
|
|
11
11
|
...definition,
|
|
12
|
-
handler: async (args
|
|
12
|
+
handler: async (args) => {
|
|
13
13
|
const decision = await gate(definition.name, args);
|
|
14
14
|
if (!decision.isAllowed)
|
|
15
15
|
return refusal(decision.message);
|
|
16
16
|
const granted = decision.keepData === true ? { ...args, keepData: true } : args;
|
|
17
|
-
return definition.handler(granted
|
|
17
|
+
return definition.handler(granted);
|
|
18
18
|
},
|
|
19
19
|
};
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder-gate.js","sourceRoot":"","sources":["../../../src/mcp/tools/builder-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AAsBnC,SAAS,OAAO,CAAC,OAA2B;IAC1C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,IAAI,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC7E,CAAC;AAED,SAAS,QAAQ,CACf,UAAgC,EAChC,IAAiB;IAEjB,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IAC/D,IAAI,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC;QAAE,OAAO,UAAU,CAAC;IAC5D,OAAO;QACL,GAAG,UAAU;QACb,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"builder-gate.js","sourceRoot":"","sources":["../../../src/mcp/tools/builder-gate.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,qBAAqB,GACtB,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define-tool.js").McpToolDefinition<{
|
|
4
|
+
resourceType: z.ZodOptional<z.ZodString>;
|
|
5
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
6
|
+
page: z.ZodString;
|
|
7
|
+
name: z.ZodString;
|
|
8
|
+
resource: z.ZodString;
|
|
9
|
+
template: z.ZodString;
|
|
10
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
response: z.ZodOptional<z.ZodEnum<{
|
|
12
|
+
value: "value";
|
|
13
|
+
items: "items";
|
|
14
|
+
series: "series";
|
|
15
|
+
card: "card";
|
|
16
|
+
}>>;
|
|
17
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
19
|
+
query: z.ZodString;
|
|
20
|
+
patch: z.ZodObject<{
|
|
21
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
22
|
+
template: z.ZodOptional<z.ZodString>;
|
|
23
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
+
response: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
value: "value";
|
|
26
|
+
items: "items";
|
|
27
|
+
series: "series";
|
|
28
|
+
card: "card";
|
|
29
|
+
}>>;
|
|
30
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
33
|
+
query: z.ZodString;
|
|
34
|
+
}>)[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { defineTool } from "../define-tool.js";
|
|
3
|
+
import { exprRefusal, hasExprSentinel, note, } from "./builder-expr.js";
|
|
4
|
+
const QUERY_REF = z
|
|
5
|
+
.string()
|
|
6
|
+
.describe("A query ref `<pageRef>@<queryName>` (e.g. `/catalog/books@inStockCount`), as reported in BuilderPageStructure's `queries`.");
|
|
7
|
+
const QUERY_ENDPOINT = z
|
|
8
|
+
.string()
|
|
9
|
+
.describe('Route path relative to the page\'s slug, e.g. `/stats/in-stock`. Must start with `/` and not collide with another route the page serves. Omit for `/stats/<kebab-name>`. A `$param` bound with `in: "param"` reads a path segment, so include a matching `:name` (e.g. `/stats/by-author/:author`).');
|
|
10
|
+
const QUERY_PARAMS = z
|
|
11
|
+
.record(z.string(), z.unknown())
|
|
12
|
+
.describe("The template's parameters, keyed exactly as the `params` schema BuilderQueryTemplates reports for it — that schema documents every key and value shape, and an unrecognised key is rejected.");
|
|
13
|
+
const QUERY_RESPONSE = z
|
|
14
|
+
.enum(["series", "card", "value", "items"])
|
|
15
|
+
.describe("How the route arranges a `series` template's points for the block that reads them: `series` (the default) one point per group, for a bare chart such as ChartLine, ChartColumn or ChartBar; `card` a figure above its series, for a ChartCard; `value` a figure and its sparkline, for a KpiCard; `items` ranked entries, for a TopListCard. A block reads only its own arrangement, so match the block. A `count` or `aggregate` query answers `{ value }` whatever you pass.");
|
|
16
|
+
export function buildQueryTools(run) {
|
|
17
|
+
return [
|
|
18
|
+
defineTool("BuilderQueryTemplates", note("Lists the query templates BuilderAddQuery can compile, each with its id, what it computes, its `output` kind, and the JSON Schema for its `params`. Call this before adding a query — the schema is the reference for every parameter and value shape."), {
|
|
19
|
+
resourceType: z
|
|
20
|
+
.string()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Filter to templates for one resource type (v1 has only `database-table`). Omit for all."),
|
|
23
|
+
}, ({ resourceType }) => run("ListQueryTemplates", resourceType ? [resourceType] : [])),
|
|
24
|
+
defineTool("BuilderAddQuery", note("Adds a query — a page-hosted GET route serving a computed number, or one per group, that the DataAPI cannot give you. Compiles the template into a method on the resource's model and a route on the page, atomically. Returns `{ query, route }`; `route` is the full URL to pass as the reading block's `fetchUrl`. A `count` or `aggregate` route serves `{ \"value\": <number> }`; a `series` route serves the arrangement `response` names."), {
|
|
25
|
+
page: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe("PageRef the query is served from — the page that displays it, not the resource's page."),
|
|
28
|
+
name: z
|
|
29
|
+
.string()
|
|
30
|
+
.describe("camelCase identifier, unique among the page's members. Names the route; the model method it compiles into may differ, since queries wanting the identical chain share one."),
|
|
31
|
+
resource: z
|
|
32
|
+
.string()
|
|
33
|
+
.describe("Resource ref to read, from BuilderListResources."),
|
|
34
|
+
template: z
|
|
35
|
+
.string()
|
|
36
|
+
.describe("A template id from BuilderQueryTemplates."),
|
|
37
|
+
params: QUERY_PARAMS.optional(),
|
|
38
|
+
response: QUERY_RESPONSE.optional(),
|
|
39
|
+
endpoint: QUERY_ENDPOINT.optional(),
|
|
40
|
+
}, async ({ page, ...input }) => hasExprSentinel(input) ? exprRefusal() : run("AddQuery", [page, input])),
|
|
41
|
+
defineTool("BuilderConfigureQuery", note("Recompiles a query, replacing both its route and its chain. Only the keys you pass change; the rest are re-read from the query. A query BuilderPageStructure reports as `opaque` is refused with opaque_target, leaving the hand-edit intact. Renaming is not supported — remove and re-add. Never affects another page's query, even one sharing the same model method."), {
|
|
42
|
+
query: QUERY_REF,
|
|
43
|
+
patch: z.object({
|
|
44
|
+
resource: z.string().optional(),
|
|
45
|
+
template: z.string().optional(),
|
|
46
|
+
params: QUERY_PARAMS.optional(),
|
|
47
|
+
response: QUERY_RESPONSE.optional(),
|
|
48
|
+
endpoint: QUERY_ENDPOINT.optional(),
|
|
49
|
+
}),
|
|
50
|
+
}, async ({ query, patch }) => hasExprSentinel(patch)
|
|
51
|
+
? exprRefusal()
|
|
52
|
+
: run("ConfigureQuery", [query, patch])),
|
|
53
|
+
defineTool("BuilderRemoveQuery", note("Removes a query's route from the page, and its model method too once no route on any page still calls it. Works on an opaque query as well — the builder can always remove what it cannot edit. Does not detect blocks whose fetchUrl points at the removed route: fix those in the same turn."), { query: QUERY_REF }, ({ query }) => run("RemoveQuery", [query])),
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=builder-queries.js.map
|
|
@@ -0,0 +1 @@
|
|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AAI,CACF,gSAAgS,CACjS,EACD,EAAE,KAAK,EAAE,SAAS,EAAE,EACpB,CAAC,EAAE,KAAK,EAAqB,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,CAAC,CAC9D;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -6,6 +6,37 @@ export interface BuilderToolsDeps {
|
|
|
6
6
|
gate?: BuilderGate;
|
|
7
7
|
}
|
|
8
8
|
export declare function buildBuilderTools(deps: BuilderToolsDeps): (import("../define-tool.js").AnyMcpToolDefinition | import("../define-tool.js").McpToolDefinition<{
|
|
9
|
+
resourceType: z.ZodOptional<z.ZodString>;
|
|
10
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
11
|
+
page: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
resource: z.ZodString;
|
|
14
|
+
template: z.ZodString;
|
|
15
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
16
|
+
response: z.ZodOptional<z.ZodEnum<{
|
|
17
|
+
value: "value";
|
|
18
|
+
items: "items";
|
|
19
|
+
series: "series";
|
|
20
|
+
card: "card";
|
|
21
|
+
}>>;
|
|
22
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
24
|
+
query: z.ZodString;
|
|
25
|
+
patch: z.ZodObject<{
|
|
26
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
27
|
+
template: z.ZodOptional<z.ZodString>;
|
|
28
|
+
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
|
+
response: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
value: "value";
|
|
31
|
+
items: "items";
|
|
32
|
+
series: "series";
|
|
33
|
+
card: "card";
|
|
34
|
+
}>>;
|
|
35
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
38
|
+
query: z.ZodString;
|
|
39
|
+
}> | import("../define-tool.js").McpToolDefinition<{
|
|
9
40
|
blocks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
41
|
dataTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
11
42
|
}> | import("../define-tool.js").McpToolDefinition<{
|
|
@@ -139,23 +170,4 @@ export declare function buildBuilderTools(deps: BuilderToolsDeps): (import("../d
|
|
|
139
170
|
indexed: z.ZodOptional<z.ZodBoolean>;
|
|
140
171
|
order: z.ZodOptional<z.ZodNumber>;
|
|
141
172
|
}, z.core.$strip>;
|
|
142
|
-
}> | import("../define-tool.js").McpToolDefinition<{
|
|
143
|
-
resourceType: z.ZodOptional<z.ZodString>;
|
|
144
|
-
}> | import("../define-tool.js").McpToolDefinition<{
|
|
145
|
-
page: z.ZodString;
|
|
146
|
-
name: z.ZodString;
|
|
147
|
-
resource: z.ZodString;
|
|
148
|
-
template: z.ZodString;
|
|
149
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
150
|
-
endpoint: z.ZodOptional<z.ZodString>;
|
|
151
|
-
}> | import("../define-tool.js").McpToolDefinition<{
|
|
152
|
-
query: z.ZodString;
|
|
153
|
-
patch: z.ZodObject<{
|
|
154
|
-
resource: z.ZodOptional<z.ZodString>;
|
|
155
|
-
template: z.ZodOptional<z.ZodString>;
|
|
156
|
-
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
157
|
-
endpoint: z.ZodOptional<z.ZodString>;
|
|
158
|
-
}, z.core.$strip>;
|
|
159
|
-
}> | import("../define-tool.js").McpToolDefinition<{
|
|
160
|
-
query: z.ZodString;
|
|
161
173
|
}>)[];
|