@antelopejs/dms-ai 0.2.1 → 0.4.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 +64 -205
- package/dist/constants/frontend-module.d.ts +2 -0
- package/dist/constants/frontend-module.js +6 -1
- package/dist/constants/frontend-module.js.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/lifecycle/skill-sources.d.ts +1 -1
- package/dist/lifecycle/skill-sources.js +29 -13
- package/dist/lifecycle/skill-sources.js.map +1 -1
- package/frontend-vue/app/chat/components/BlockPreviewCard.vue +172 -0
- package/frontend-vue/app/chat/components/BlockPreviewModal.vue +324 -0
- package/frontend-vue/app/chat/components/BlockPreviewThumb.vue +141 -0
- package/frontend-vue/app/chat/components/MessageList.vue +20 -0
- package/frontend-vue/app/chat/components/SketchFrame.vue +59 -0
- package/frontend-vue/app/chat/composables/conversation-events.ts +23 -1
- package/frontend-vue/app/chat/composables/useBlockPreviewComponent.ts +15 -0
- package/frontend-vue/app/chat/composables/useDashboardScheme.ts +42 -0
- package/frontend-vue/app/chat/constants/block-preview.ts +27 -0
- package/frontend-vue/app/chat/constants/conversation.ts +1 -0
- package/frontend-vue/app/chat/constants/protocol.ts +1 -0
- package/frontend-vue/app/chat/constants/sketch.ts +105 -0
- package/frontend-vue/app/chat/types/conversation.ts +11 -1
- package/frontend-vue/app/chat/types/protocol.ts +56 -0
- package/frontend-vue/app/chat/utils/block-preview.ts +145 -0
- package/frontend-vue/app/chat/utils/conversation-messages.ts +23 -1
- package/frontend-vue/app/chat/utils/render-items.ts +13 -2
- package/frontend-vue/app/chat/utils/sketch.ts +56 -0
- package/frontend-vue/app/chat/utils/tool-lexicon.ts +7 -0
- package/frontend-vue/app/components/ActivityDetail.vue +11 -13
- package/frontend-vue/app/components/ChangesView.vue +56 -49
- package/frontend-vue/app/plugins/ai.client.ts +16 -6
- package/frontend-vue/app/runtime/assistant-activity.ts +38 -21
- package/frontend-vue/app/runtime/sidecar-status.ts +78 -56
- package/frontend-vue/app/views/ChangeSetPanel.vue +13 -18
- package/frontend-vue/app/views/UnavailableState.vue +1 -1
- package/frontend-vue/app/views/composables/useAiData.ts +116 -0
- package/frontend-vue/app/views/composables/useAssistant.ts +8 -2
- package/frontend-vue/app/views/composables/useChangeSetActions.ts +7 -6
- package/frontend-vue/app/views/utils/change-sets.ts +0 -7
- package/frontend-vue/i18n/locales/dms-ai-panel-en-GB.json +23 -1
- package/frontend-vue/i18n/locales/dms-ai-panel-fr-FR.json +23 -1
- package/frontend-vue/package.json +1 -1
- package/frontend-vue/tests/assistant-activity.test.ts +69 -0
- package/frontend-vue/tests/chat/block-preview.test.ts +448 -0
- package/frontend-vue/tests/sidecar-guest.test.ts +1 -1
- package/frontend-vue/tests/sidecar-status.test.ts +93 -15
- package/frontend-vue/tests/support/dms-frontend-module.ts +9 -0
- package/frontend-vue/tests/views/api-data-reads.test.ts +445 -0
- package/frontend-vue/tests/views/use-assistant.test.ts +53 -0
- package/frontend-vue/vitest.config.ts +10 -0
- package/package.json +20 -6
- package/sidecar/dist/constants/mcp.js +2 -0
- package/sidecar/dist/constants/mcp.js.map +1 -1
- package/sidecar/dist/constants/preview.d.ts +39 -0
- package/sidecar/dist/constants/preview.js +55 -0
- package/sidecar/dist/constants/preview.js.map +1 -0
- package/sidecar/dist/constants/tool-kinds.js +2 -0
- package/sidecar/dist/constants/tool-kinds.js.map +1 -1
- package/sidecar/dist/mcp/tool-definitions.js +5 -0
- package/sidecar/dist/mcp/tool-definitions.js.map +1 -1
- package/sidecar/dist/mcp/tools/preview-blocks.d.ts +65 -0
- package/sidecar/dist/mcp/tools/preview-blocks.js +176 -0
- package/sidecar/dist/mcp/tools/preview-blocks.js.map +1 -0
- package/sidecar/dist/mcp/types.d.ts +3 -0
- package/sidecar/dist/prompts/agent.d.ts +1 -1
- package/sidecar/dist/prompts/agent.js +3 -2
- package/sidecar/dist/prompts/agent.js.map +1 -1
- package/sidecar/dist/protocol/events.d.ts +313 -0
- package/sidecar/dist/protocol/events.js +9 -0
- package/sidecar/dist/protocol/events.js.map +1 -1
- package/sidecar/dist/protocol/preview.d.ts +130 -0
- package/sidecar/dist/protocol/preview.js +91 -0
- package/sidecar/dist/protocol/preview.js.map +1 -0
- package/sidecar/dist/server/chat-events.d.ts +3 -0
- package/sidecar/dist/server/chat-events.js +21 -0
- package/sidecar/dist/server/chat-events.js.map +1 -1
- package/sidecar/dist/server/ws.js +3 -1
- package/sidecar/dist/server/ws.js.map +1 -1
- package/sidecar/dist/state/types.d.ts +3 -1
- package/sidecar/dist/state/types.js +1 -0
- package/sidecar/dist/state/types.js.map +1 -1
- package/sidecar/package.json +1 -1
- package/skills/dms-ai/SKILL.md +30 -0
- package/skills/dms-ai-code-mode/SKILL.md +51 -0
- package/skills/dms-builder-safe/SKILL.md +9 -2
- package/frontend-vue/app/views/composables/useAiRequest.ts +0 -89
- package/skills/dms-builder-page/SKILL.md +0 -80
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PREVIEW_MAX_CAPTION_CHARS, PREVIEW_MAX_DESCRIPTION_CHARS, PREVIEW_MAX_JSON_BYTES, PREVIEW_MAX_LABEL_CHARS, PREVIEW_MAX_ROOTS, PREVIEW_MAX_TITLE_CHARS, PREVIEW_MAX_URL_CHARS, PREVIEW_MAX_VARIANTS, PREVIEW_SKETCH_DEFAULT_HEIGHT_PX, PREVIEW_SKETCH_MAX_HEIGHT_PX, PREVIEW_SKETCH_MIN_HEIGHT_PX, } from "../constants/preview.js";
|
|
3
|
+
export const PreviewNodeSchema = z.object({
|
|
4
|
+
type: z
|
|
5
|
+
.string()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe("Block type from BuilderCatalog, e.g. `KpiCard`."),
|
|
8
|
+
componentName: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Registered block component name, e.g. `dms-kpi-card`; only when `type` is unknown."),
|
|
12
|
+
options: z
|
|
13
|
+
.record(z.string(), z.unknown())
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("The block's options, as its declaration takes them. A `fetchUrl` must be a same-origin path."),
|
|
16
|
+
id: z.string().optional().describe("Child id, unique among its siblings."),
|
|
17
|
+
slot: z
|
|
18
|
+
.string()
|
|
19
|
+
.optional()
|
|
20
|
+
.describe("Slot of the parent the child renders in, when it has several."),
|
|
21
|
+
colSpan: z
|
|
22
|
+
.number()
|
|
23
|
+
.int()
|
|
24
|
+
.positive()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Columns a GridRow child spans."),
|
|
27
|
+
get children() {
|
|
28
|
+
return z
|
|
29
|
+
.array(PreviewNodeSchema)
|
|
30
|
+
.optional()
|
|
31
|
+
.describe("Nested blocks, in order.");
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
export const PreviewTreeSchema = z
|
|
35
|
+
.union([
|
|
36
|
+
PreviewNodeSchema,
|
|
37
|
+
z.array(PreviewNodeSchema).min(1).max(PREVIEW_MAX_ROOTS),
|
|
38
|
+
])
|
|
39
|
+
.describe("One block, or a list of blocks stacked in order.");
|
|
40
|
+
export const PreviewSketchSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
html: z
|
|
43
|
+
.string()
|
|
44
|
+
.min(1)
|
|
45
|
+
.max(PREVIEW_MAX_JSON_BYTES)
|
|
46
|
+
.describe("Body markup of the component. Static only: no script, event handler or external resource; images and fonts as data: URLs."),
|
|
47
|
+
css: z
|
|
48
|
+
.string()
|
|
49
|
+
.max(PREVIEW_MAX_JSON_BYTES)
|
|
50
|
+
.optional()
|
|
51
|
+
.describe("Styles for the markup. The `--sketch-*` variables (surface, text, border, accent, radius, font) follow the dashboard's light or dark theme."),
|
|
52
|
+
caption: z
|
|
53
|
+
.string()
|
|
54
|
+
.max(PREVIEW_MAX_CAPTION_CHARS)
|
|
55
|
+
.optional()
|
|
56
|
+
.describe("One line on what the sketch shows, e.g. `Revenue card with a sparkline`."),
|
|
57
|
+
height: z
|
|
58
|
+
.number()
|
|
59
|
+
.int()
|
|
60
|
+
.min(PREVIEW_SKETCH_MIN_HEIGHT_PX)
|
|
61
|
+
.max(PREVIEW_SKETCH_MAX_HEIGHT_PX)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe(`Frame height in pixels; the sketch scrolls past it. Default ${PREVIEW_SKETCH_DEFAULT_HEIGHT_PX}.`),
|
|
64
|
+
})
|
|
65
|
+
.describe("A proposed custom component as static HTML and CSS, shown beside the DMS option and labelled as not a DMS block.");
|
|
66
|
+
export const PreviewVariantSchema = z.object({
|
|
67
|
+
label: z
|
|
68
|
+
.string()
|
|
69
|
+
.min(1)
|
|
70
|
+
.max(PREVIEW_MAX_LABEL_CHARS)
|
|
71
|
+
.describe("Tab label, e.g. `Compact` or `Custom sketch`."),
|
|
72
|
+
tree: PreviewTreeSchema.optional(),
|
|
73
|
+
sketch: PreviewSketchSchema.optional(),
|
|
74
|
+
});
|
|
75
|
+
export const BlockPreviewReferenceSchema = z.object({
|
|
76
|
+
attachmentName: z.string().optional(),
|
|
77
|
+
url: z.string().max(PREVIEW_MAX_URL_CHARS).optional(),
|
|
78
|
+
caption: z.string().max(PREVIEW_MAX_CAPTION_CHARS).optional(),
|
|
79
|
+
});
|
|
80
|
+
export const BlockPreviewSchema = z.object({
|
|
81
|
+
id: z.string(),
|
|
82
|
+
title: z.string().max(PREVIEW_MAX_TITLE_CHARS),
|
|
83
|
+
description: z.string().max(PREVIEW_MAX_DESCRIPTION_CHARS).optional(),
|
|
84
|
+
label: z.string().max(PREVIEW_MAX_LABEL_CHARS).optional(),
|
|
85
|
+
tree: PreviewTreeSchema.optional(),
|
|
86
|
+
sketch: PreviewSketchSchema.optional(),
|
|
87
|
+
reference: BlockPreviewReferenceSchema.optional(),
|
|
88
|
+
variants: z.array(PreviewVariantSchema).max(PREVIEW_MAX_VARIANTS).optional(),
|
|
89
|
+
timestampMs: z.number(),
|
|
90
|
+
});
|
|
91
|
+
//# source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;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,QAAQ,EAAE;IACrD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,QAAQ,EAAE;CAC9D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAC9C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,QAAQ,EAAE;IACrE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,QAAQ,EAAE;IACzD,IAAI,EAAE,iBAAiB,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,2BAA2B,CAAC,QAAQ,EAAE;IACjD,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;IAC5E,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;CACxB,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PendingRequest } from "../agent/permission-bus.js";
|
|
2
2
|
import type { PendingQuestion } from "../agent/question-bus.js";
|
|
3
3
|
import { type AskQuestionEventType, type ConversationListEventType, type ConversationSnapshotEventType, type ConversationSummaryType, type PermissionRequestEventType, type SettingsUpdateEventType } from "../protocol/events.js";
|
|
4
|
+
import type { BlockPreviewType } from "../protocol/preview.js";
|
|
4
5
|
import type { Notice } from "../state/types.js";
|
|
5
6
|
import type { SidecarServices } from "./services.js";
|
|
6
7
|
export declare function buildSnapshotEvent(services: SidecarServices, conversationId: string): ConversationSnapshotEventType | null;
|
|
@@ -10,6 +11,8 @@ export declare function broadcastConversationList(services: SidecarServices): vo
|
|
|
10
11
|
export declare function sendConversationMode(services: SidecarServices, conversationId: string): void;
|
|
11
12
|
export declare function sendRulesState(services: SidecarServices, conversationId: string): void;
|
|
12
13
|
export declare function emitNotice(services: SidecarServices, conversationId: string, notice: Notice): void;
|
|
14
|
+
export declare function emitBlockPreview(services: SidecarServices, conversationId: string, preview: BlockPreviewType): void;
|
|
15
|
+
export declare function listAttachedImages(services: SidecarServices, conversationId: string): string[];
|
|
13
16
|
export declare function buildPermissionRequestEvent(request: PendingRequest): PermissionRequestEventType;
|
|
14
17
|
export declare function buildAskQuestionEvent(question: PendingQuestion): AskQuestionEventType;
|
|
15
18
|
export declare function buildSettingsUpdateEvent(services: Pick<SidecarServices, "settingsStore">): SettingsUpdateEventType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getBuilderAvailable } from "../builder/capability.js";
|
|
2
|
+
import { PREVIEW_IMAGE_MIME_PREFIX } from "../constants/preview.js";
|
|
2
3
|
import { EVENT_TYPES, } from "../protocol/events.js";
|
|
3
4
|
import { getProviderAvailability } from "../providers/registry.js";
|
|
4
5
|
const HIDDEN_ROLES = ["permission"];
|
|
@@ -98,6 +99,26 @@ export function emitNotice(services, conversationId, notice) {
|
|
|
98
99
|
notice,
|
|
99
100
|
});
|
|
100
101
|
}
|
|
102
|
+
export function emitBlockPreview(services, conversationId, preview) {
|
|
103
|
+
services.conversationStore.appendMessage(conversationId, {
|
|
104
|
+
role: "block_preview",
|
|
105
|
+
content: "",
|
|
106
|
+
preview,
|
|
107
|
+
timestampMs: preview.timestampMs,
|
|
108
|
+
});
|
|
109
|
+
services.chatSocketRegistry.send(conversationId, {
|
|
110
|
+
type: EVENT_TYPES.BLOCK_PREVIEW,
|
|
111
|
+
conversationId,
|
|
112
|
+
preview,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
export function listAttachedImages(services, conversationId) {
|
|
116
|
+
const messages = services.conversationStore.get(conversationId)?.messages ?? [];
|
|
117
|
+
return messages
|
|
118
|
+
.flatMap((message) => message.attachments ?? [])
|
|
119
|
+
.filter((attachment) => attachment.mimeType.startsWith(PREVIEW_IMAGE_MIME_PREFIX))
|
|
120
|
+
.map((attachment) => attachment.name);
|
|
121
|
+
}
|
|
101
122
|
export function buildPermissionRequestEvent(request) {
|
|
102
123
|
return { type: EVENT_TYPES.PERMISSION_REQUEST, ...request };
|
|
103
124
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-events.js","sourceRoot":"","sources":["../../src/server/chat-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAKL,WAAW,GAGZ,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-events.js","sourceRoot":"","sources":["../../src/server/chat-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAKL,WAAW,GAGZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AASnE,MAAM,YAAY,GAAqC,CAAC,YAAY,CAAC,CAAC;AAEtE,MAAM,iBAAiB,GAAuC;IAC5D,WAAW;IACX,MAAM;IACN,WAAW;IACX,SAAS;IACT,MAAM;IACN,eAAe;IACf,aAAa;IACb,UAAU;IACV,WAAW;IACX,UAAU;CACX,CAAC;AAEF,SAAS,iBAAiB,CAAC,OAAsB;IAC/C,MAAM,IAAI,GAAG,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AC;AAGD,MAAM,UAAU,kBAAkB,CAChC,QAAyB,EACzB,cAAsB;IAEtB,MAAM,QAAQ,GACZ,QAAQ,CAAC,iBAAiB,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAC;IACjE,OAAO,QAAQ;SACZ,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,IAAI,EAAE,CAAC;SAC/C,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CACrB,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,yBAAyB,CAAC,CAC1D;SACA,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,OAAuB;IAEvB,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,kBAAkB,EAAE,GAAG,OAAO,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,QAAyB;IAEzB,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,YAAY,EAAE,GAAG,QAAQ,EAAE,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,QAAgD;IAEhD,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,eAAe;QACjC,QAAQ,EAAE,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE;QACtC,gBAAgB,EAAE,mBAAmB,EAAE;QACvC,SAAS,EAAE,uBAAuB,EAAE;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -18,7 +18,7 @@ import { createAiMcpServer } from "../mcp/sdk-binding.js";
|
|
|
18
18
|
import { PROVIDER_MODULES } from "../providers/registry.js";
|
|
19
19
|
import { createChangeSetStore } from "../state/change-sets.js";
|
|
20
20
|
import { PROVIDER_NAMES } from "../state/types.js";
|
|
21
|
-
import { broadcastConversationList, emitNotice, sendConversationMode, } from "./chat-events.js";
|
|
21
|
+
import { broadcastConversationList, emitBlockPreview, emitNotice, listAttachedImages, sendConversationMode, } from "./chat-events.js";
|
|
22
22
|
import { isClientAuthorized } from "./client-auth.js";
|
|
23
23
|
import { createHostCommandRouter, } from "./host-command-router.js";
|
|
24
24
|
import { createChatSocketRegistry, } from "./chat-socket-registry.js";
|
|
@@ -80,6 +80,8 @@ function buildMcpDepsFactory(staticDeps, holder, hostCommandsOf) {
|
|
|
80
80
|
sendToHost: hostCommandsOf(conversationId),
|
|
81
81
|
requestQuestion: (req) => askUser(services(holder), req),
|
|
82
82
|
getLastEditedFile: () => services(holder).editTracker.getLastEditedFile(conversationId),
|
|
83
|
+
showPreview: (preview) => emitBlockPreview(services(holder), conversationId, preview),
|
|
84
|
+
listAttachedImages: () => listAttachedImages(services(holder), conversationId),
|
|
83
85
|
gateBuilderOp: (toolName, args) => buildBuilderGate(services(holder), conversationId)(toolName, args),
|
|
84
86
|
});
|
|
85
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../src/server/ws.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,eAAe,EAAE,MAAM,IAAI,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAoB,MAAM,0BAA0B,CAAC;AAC/E,OAAO,EACL,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,iBAAiB,GAIlB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,GAEtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAEL,iBAAiB,GAClB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etState, FullAutoDuration, PermissionKind, ToolOutcome, TypecheckOutcome } from "../constants/audit.js";
|
|
2
|
+
import type { BlockPreviewType } from "../protocol/preview.js";
|
|
2
3
|
import type { ChatMode, GenerationMode } from "./settings-types.js";
|
|
3
|
-
declare const STORED_MESSAGE_ROLES: readonly ["user", "assistant", "tool_use", "tool_result", "permission", "error", "notice", "change_set", "question_answer"];
|
|
4
|
+
declare const STORED_MESSAGE_ROLES: readonly ["user", "assistant", "tool_use", "tool_result", "permission", "error", "notice", "change_set", "question_answer", "block_preview"];
|
|
4
5
|
type StoredMessageRole = (typeof STORED_MESSAGE_ROLES)[number];
|
|
5
6
|
declare const STORED_MESSAGE_STATUSES: readonly ["success", "error"];
|
|
6
7
|
type StoredMessageStatus = (typeof STORED_MESSAGE_STATUSES)[number];
|
|
@@ -56,6 +57,7 @@ export interface StoredMessage {
|
|
|
56
57
|
changeSetId?: string;
|
|
57
58
|
notice?: Notice;
|
|
58
59
|
answers?: QuestionAnswerRecord[];
|
|
60
|
+
preview?: BlockPreviewType;
|
|
59
61
|
isAutoFix?: boolean;
|
|
60
62
|
requestId?: string;
|
|
61
63
|
kind?: PermissionKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/state/types.ts"],"names":[],"mappings":"AAYA,MAAM,oBAAoB,GAAG;IAC3B,MAAM;IACN,WAAW;IACX,UAAU;IACV,aAAa;IAIb,YAAY;IACZ,OAAO;IAIP,QAAQ;IAER,YAAY;IAEZ,iBAAiB;IAEjB,eAAe;CACP,CAAC;AAIX,MAAM,uBAAuB,GAAG,CAAC,SAAS,EAAE,OAAO,CAAU,CAAC;AAM9D,MAAM,2BAA2B,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAU,CAAC;AAoFpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AAG3D,MAAM,CAAC,MAAM,qBAAqB,GAAiB,cAAc,CAAC,CAAC,CAAC,CAAC;AAUrE,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;CACf,CAAC"}
|
package/sidecar/package.json
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dms-ai
|
|
3
|
+
description: Sets up and troubleshoots @antelopejs/dms-ai, the AI development assistant of the AntelopeJS DMS (chat panel, sidecar running Claude Code or Codex, change sets with undo, audit log and skills pages under /modules/ai). Use when installing or configuring dms-ai (backendUrl, DMS_AI, providers, Codex), when the assistant is offline, or when a module must ship skills to it through antelopeJs.skills.
|
|
4
|
+
icon: i-lucide-sparkles
|
|
5
|
+
category: ai
|
|
6
|
+
tags: [ai, assistant, sidecar, claude-code, codex, skills]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# dms-ai
|
|
10
|
+
|
|
11
|
+
An owner-only development assistant. The backend starts a sidecar (child process, `127.0.0.1` only) that runs the agent in the project folder; the browser reaches it only through the DMS frontend server. User docs: https://dms.antelopejs.com/docs/modules/ai (source: `docs/` of this package).
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
- `ajs project modules add @antelopejs/dms-ai`; config `backendUrl: "${@api.API_LOCAL_BASE_URL}"`.
|
|
16
|
+
- Version 0.3+ needs `@antelopejs/dms` 0.9 (`interface-dms` 0.7) and `@antelopejs/dms-frontend` 0.6; 0.2 is the DMS 0.8 line. The frontend server proxies `/ai/**` to the backend with the session (`backendProxies`).
|
|
17
|
+
- Load `@antelopejs/dms-builder` too: chats then default to Safe mode (Builder tools only, typechecked writes). Code mode allows file edits and commands under the approval mode.
|
|
18
|
+
- Claude Code is the default provider. Codex needs `@openai/codex` at the exact version in `peerDependencies` and `OPENAI_API_KEY`; a provider that cannot run fails the turn, never falls back.
|
|
19
|
+
|
|
20
|
+
## Skills
|
|
21
|
+
|
|
22
|
+
The sidecar loads every directory a loaded module declares in `package.json` `antelopeJs.skills` (and `~/.claude/skills` when Settings allow it). Ship a module's skill as `skills/<name>/SKILL.md` with `name`, `description`, `icon`, `category`, `tags: [a, b]` frontmatter, add `skills` to `files`. Two skills with one name: one is Shadowed.
|
|
23
|
+
|
|
24
|
+
## Gotchas
|
|
25
|
+
|
|
26
|
+
- Refuses to run with `NODE_ENV=production`; `DMS_AI=0` starts the backend without the sidecar.
|
|
27
|
+
- Offline assistant: Restart on the Overview; lists and settings answer `503` while the sidecar is down.
|
|
28
|
+
- Remote over plain HTTP: start the frontend with `DMS_COOKIE_SECURE=false`.
|
|
29
|
+
- Deleting pages, tables, fields or queries asks in every mode, Full auto included.
|
|
30
|
+
- Undo is limited to the checkpoint retention (7, 30 or 90 days).
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dms-ai-code-mode
|
|
3
|
+
description: Runs the dms-ai Code-mode loop for changing a DMS page in code while the user watches it in the dashboard overlay, with the ListPages, NavigateToPage, FindPagesUsing, Typecheck and QueryLogs host tools. Use when the dms-ai generation mode is Code and a change touches a rendered page, or when the user allows Code mode after a Builder tool answered opaque_target or unsupported.
|
|
4
|
+
icon: i-ph-code
|
|
5
|
+
category: Builder
|
|
6
|
+
tags: [Pages, CodeMode, DMS]
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Code mode in dms-ai
|
|
10
|
+
|
|
11
|
+
What a page is made of and how to write it belongs to the core skills: **dms-best-practices**
|
|
12
|
+
(blocks described backend-side, custom only for the missing block, `.meta()` on it, design
|
|
13
|
+
fidelity) and **dms-pages** (`PageController`, blocks, the routes that feed them). This skill adds
|
|
14
|
+
what dms-ai changes: its host tools and the live overlay the user is watching. Without the
|
|
15
|
+
`NavigateToPage` tool you are not inside dms-ai, and this skill does not apply.
|
|
16
|
+
|
|
17
|
+
Before writing any custom block, run the path *Before any custom block* of **dms-best-practices**.
|
|
18
|
+
|
|
19
|
+
## The loop, one page at a time
|
|
20
|
+
|
|
21
|
+
1. **Map the edit.** Call `FindPagesUsing` on every file you intend to edit to get the pages that
|
|
22
|
+
render it, and group your edits by page.
|
|
23
|
+
2. **Show the page.** Look its route up with `ListPages` (the `path` field: routes come from the
|
|
24
|
+
category chain and the `/modules` prefix, never from the file name) and call `NavigateToPage`
|
|
25
|
+
with it. Prefer the page the user is on, reported each turn in the host-context block. For a new
|
|
26
|
+
page, register the empty `PageController`, call `ListPages` with `refresh: true`, navigate to
|
|
27
|
+
it, and only then add blocks, so the user watches it fill in.
|
|
28
|
+
3. **Edit.** The overlay hot-reloads the page and highlights the nodes that changed.
|
|
29
|
+
4. **Typecheck.** Run `Typecheck` on the module after every source edit and fix every error: a
|
|
30
|
+
non-compiling edit makes the host reload fail and the page 404.
|
|
31
|
+
5. **Verify.** If the page still looks wrong after the reload, read `QueryLogs`. Then take the
|
|
32
|
+
next page from step 2.
|
|
33
|
+
|
|
34
|
+
The change is done when every impacted page shows it and `Typecheck` reports no error.
|
|
35
|
+
|
|
36
|
+
## Builder tools in Code mode
|
|
37
|
+
|
|
38
|
+
When `@antelopejs/dms-builder` is loaded, the `Builder*` tools stay available in Code mode.
|
|
39
|
+
Prefer them for what they cover: every operation is atomic and typecheck-gated. For a computed number over a builder-managed resource (a `KpiCard` count or sum),
|
|
40
|
+
`BuilderQueryTemplates` then `BuilderAddQuery` generate the route to pass as `fetchUrl`.
|
|
41
|
+
|
|
42
|
+
The Builder recognizes a query by its shape alone: a scalar route over a resource model calling a
|
|
43
|
+
`this.table…` chain. A hand-written route in that shape becomes editable by the Builder like a
|
|
44
|
+
generated one. To keep a hand-written aggregate out of its reach, compute it outside the chain
|
|
45
|
+
(an intermediate variable or a helper) and it reads back as `opaque`.
|
|
46
|
+
|
|
47
|
+
## Leave the servers running
|
|
48
|
+
|
|
49
|
+
dms-ai runs inside the DMS backend, so stopping or restarting the dev servers stops the
|
|
50
|
+
assistant. Rely on hot reload; when a change needs a full restart (a new module or dependency, a
|
|
51
|
+
config edit), ask the user to run it.
|
|
@@ -12,6 +12,13 @@ In safe mode you act **only through the `Builder*` MCP tools** — raw file edit
|
|
|
12
12
|
(`Write`/`Edit`/`Bash`) are blocked. Every op is **atomic and typecheck-gated**: on
|
|
13
13
|
success it returns the file changes; on `typecheck_failed` **nothing is written**.
|
|
14
14
|
|
|
15
|
+
Load the core `dms-best-practices` skill first and follow it: it decides what a
|
|
16
|
+
page is made of (DMS blocks, custom only for a missing block, `.meta()` on custom
|
|
17
|
+
blocks) and runs the design-fidelity protocol when the user brings a mockup. This
|
|
18
|
+
skill only covers driving the Builder tools. Safe mode cannot write a custom block:
|
|
19
|
+
when the path *Before any custom block* of dms-best-practices leads to one, follow
|
|
20
|
+
its safe-mode branch.
|
|
21
|
+
|
|
15
22
|
## Addressing
|
|
16
23
|
|
|
17
24
|
- **PageRef** = the page's route, e.g. `/charts/revenue`.
|
|
@@ -104,8 +111,8 @@ template catalog, route-bound params, opaque read-back, and the full query workf
|
|
|
104
111
|
or doesn't implement the op (`request_failed` with `HTTP 400` = the host answered
|
|
105
112
|
`unknown_op`). Explain the limitation; don't retry.
|
|
106
113
|
- `opaque_target` / `unsupported` → **safe mode cannot do this**. Explain the
|
|
107
|
-
limitation and ask
|
|
108
|
-
force it. After any Code mode excursion, call `BuilderRefresh` (optionally scoped
|
|
114
|
+
limitation and ask with `AskUser` to switch to **Code mode** for that one step; do
|
|
115
|
+
not force it. After any Code mode excursion, call `BuilderRefresh` (optionally scoped
|
|
109
116
|
to the page) so the builder's source index reconciles with disk before further
|
|
110
117
|
safe-mode ops.
|
|
111
118
|
- `stale` → the page changed under you; re-read with `BuilderPageStructure`, retry.
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { ref, shallowRef, type Ref, type ShallowRef } from "vue";
|
|
2
|
-
import { HTTP_SERVICE_UNAVAILABLE } from "../constants";
|
|
3
|
-
|
|
4
|
-
/** Why a request failed: the sidecar is down (503), or anything else. */
|
|
5
|
-
export type RequestFailure = "unavailable" | "error";
|
|
6
|
-
|
|
7
|
-
export interface AiRequest<T> {
|
|
8
|
-
data: ShallowRef<T | null>;
|
|
9
|
-
isLoading: Ref<boolean>;
|
|
10
|
-
failure: Ref<RequestFailure | null>;
|
|
11
|
-
message: Ref<string>;
|
|
12
|
-
/**
|
|
13
|
-
* Runs `fetcher`, keeping the previous data while it loads; a run that a
|
|
14
|
-
* later one overtook is dropped.
|
|
15
|
-
*/
|
|
16
|
-
run: (fetcher: () => Promise<T>) => Promise<T | null>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
interface FetchErrorResponse {
|
|
20
|
-
status?: number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
interface FetchErrorBody {
|
|
24
|
-
message?: unknown;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface FetchErrorLike {
|
|
28
|
-
status?: number;
|
|
29
|
-
statusCode?: number;
|
|
30
|
-
response?: FetchErrorResponse;
|
|
31
|
-
data?: FetchErrorBody;
|
|
32
|
-
message?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** The HTTP status of a `$authFetch` rejection, if it got an answer. */
|
|
36
|
-
function errorStatus(error: unknown): number | undefined {
|
|
37
|
-
const candidate = error as FetchErrorLike | null;
|
|
38
|
-
return (
|
|
39
|
-
candidate?.status ?? candidate?.statusCode ?? candidate?.response?.status
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/** The server's `{ message }`, else the error's own text. */
|
|
44
|
-
export function errorMessage(error: unknown): string {
|
|
45
|
-
const candidate = error as FetchErrorLike | null;
|
|
46
|
-
const serverMessage = candidate?.data?.message;
|
|
47
|
-
if (typeof serverMessage === "string") return serverMessage;
|
|
48
|
-
return candidate?.message ?? String(error);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export function classifyFailure(error: unknown): RequestFailure {
|
|
52
|
-
return errorStatus(error) === HTTP_SERVICE_UNAVAILABLE
|
|
53
|
-
? "unavailable"
|
|
54
|
-
: "error";
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* One request's state for a view: its data, whether it loads, and whether a
|
|
59
|
-
* failure means "the assistant isn't running" (503) rather than an error.
|
|
60
|
-
*/
|
|
61
|
-
export function useAiRequest<T>(): AiRequest<T> {
|
|
62
|
-
const data = shallowRef<T | null>(null);
|
|
63
|
-
const isLoading = ref(false);
|
|
64
|
-
const failure = ref<RequestFailure | null>(null);
|
|
65
|
-
const message = ref("");
|
|
66
|
-
let latestRun = 0;
|
|
67
|
-
|
|
68
|
-
async function run(fetcher: () => Promise<T>): Promise<T | null> {
|
|
69
|
-
latestRun += 1;
|
|
70
|
-
const runId = latestRun;
|
|
71
|
-
isLoading.value = true;
|
|
72
|
-
try {
|
|
73
|
-
const result = await fetcher();
|
|
74
|
-
if (runId !== latestRun) return null;
|
|
75
|
-
data.value = result;
|
|
76
|
-
failure.value = null;
|
|
77
|
-
return result;
|
|
78
|
-
} catch (error) {
|
|
79
|
-
if (runId !== latestRun) return null;
|
|
80
|
-
failure.value = classifyFailure(error);
|
|
81
|
-
message.value = errorMessage(error);
|
|
82
|
-
return null;
|
|
83
|
-
} finally {
|
|
84
|
-
if (runId === latestRun) isLoading.value = false;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return { data, isLoading, failure, message, run };
|
|
89
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dms-builder-page
|
|
3
|
-
description: Builds or modifies an AntelopeJS DMS admin page (dashboard screen). Use when the user wants to add, edit, or compose an admin page, dashboard, table, form, or chart in a dms-* module.
|
|
4
|
-
icon: i-ph-layout
|
|
5
|
-
category: Builder
|
|
6
|
-
tags: [Pages, Dashboard, DMS]
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Building an AntelopeJS DMS admin page
|
|
10
|
-
|
|
11
|
-
Use this when adding or reshaping an admin page (a dashboard screen) in a DMS
|
|
12
|
-
module. A page is a `@RegisterPage()` controller composed of DMS components bound
|
|
13
|
-
to backend routes.
|
|
14
|
-
|
|
15
|
-
## Workflow
|
|
16
|
-
|
|
17
|
-
1. **Locate the module.** Pages belong to a module registered with
|
|
18
|
-
`RegisterModule({ id, title, description, icon, landingPage })`. Find the existing
|
|
19
|
-
`pages/module.ts` and the `pages/all.ts` barrel — every page file must be
|
|
20
|
-
re-exported from `all.ts` or it will not load.
|
|
21
|
-
|
|
22
|
-
2. **Declare the page.** Create `pages/<name>/page.ts`:
|
|
23
|
-
```ts
|
|
24
|
-
@RegisterPage()
|
|
25
|
-
export class MyPage extends PageController(
|
|
26
|
-
"<slug>",
|
|
27
|
-
{ displayName, description, icon, module: "<moduleId>", order: <n> },
|
|
28
|
-
DefaultLayout({ fullWidth: true }),
|
|
29
|
-
) {
|
|
30
|
-
static content = /* components */;
|
|
31
|
-
}
|
|
32
|
-
```
|
|
33
|
-
`order` controls sidebar position. Keep one page per file.
|
|
34
|
-
|
|
35
|
-
3. **Compose with shared components, not raw HTML.** Build the screen from the
|
|
36
|
-
dms-base components (`KpiCard`, `ChartCard`, `TopListCard`, `TableView`,
|
|
37
|
-
`Form`, `PeriodSelector`, `Grid`/`GridRow`). Lay them out with
|
|
38
|
-
`Grid({ gap }).child(...)`.
|
|
39
|
-
|
|
40
|
-
4. **Bind to data via `fetchUrl`.** Components fetch from backend routes
|
|
41
|
-
(e.g. `fetchUrl: "/<module>/metrics/kpi/actions"`). Each route is a
|
|
42
|
-
`Controller` method that returns the payload shape the component expects —
|
|
43
|
-
a `KpiCard` reads `{ value: number }`. Add the route alongside the existing
|
|
44
|
-
ones and register it in the routes barrel.
|
|
45
|
-
To make cards period-aware, declare one `PeriodSelector({ id })` and give each
|
|
46
|
-
card `periodScope: <that id>`; the components then append `from`/`to`/
|
|
47
|
-
`compareFrom`/`compareTo` query params to `fetchUrl`.
|
|
48
|
-
|
|
49
|
-
An aggregate route can live **on the page controller itself**, which is
|
|
50
|
-
simpler than a separate controller and inherits the page's auth gate for free:
|
|
51
|
-
a `@Get("/stats/…")` method taking `@Model(XModel)` and returning
|
|
52
|
-
`{ value: await model.someCount() }`. If the data comes from a builder-managed
|
|
53
|
-
resource, prefer generating it — `BuilderAddQuery` emits exactly that shape and
|
|
54
|
-
keeps the AQL chain typechecked. The Builder recognizes a query by its shape
|
|
55
|
-
alone (a scalar route over a resource model calling a `this.table…` chain), so
|
|
56
|
-
a hand-written route matching that grammar is picked up and editable just like
|
|
57
|
-
a generated one — there is no marker. To keep a hand-written aggregate off the
|
|
58
|
-
Builder's radar, write it **outside** the chain grammar (compute via an
|
|
59
|
-
intermediate variable or a helper), and it reads back as `opaque`.
|
|
60
|
-
|
|
61
|
-
5. **Read before you write.** Model new components on the closest existing page
|
|
62
|
-
in the same module and copy its option shape exactly — the component option
|
|
63
|
-
contracts live in `node_modules/@antelopejs/interface-dms`.
|
|
64
|
-
|
|
65
|
-
6. **Typecheck before declaring done.** Run the `Typecheck` tool on the module
|
|
66
|
-
after every source edit and fix every error — a non-compiling edit makes the
|
|
67
|
-
host reload fail and the page 404. Use `FindPagesUsing` to map each file you
|
|
68
|
-
edit to the pages that render it, and `QueryLogs` if the page still looks
|
|
69
|
-
wrong after the reload.
|
|
70
|
-
|
|
71
|
-
## Guardrails
|
|
72
|
-
|
|
73
|
-
- Re-export every new page from `pages/all.ts`.
|
|
74
|
-
- A page's `module` must match an `id` passed to `RegisterModule`.
|
|
75
|
-
- Prefer adding fields to an existing route payload over inventing new routes.
|
|
76
|
-
- Before editing a page, make sure the host is displaying it (`NavigateToPage` —
|
|
77
|
-
look the route up via `ListPages`, never derive it from the filename) so the
|
|
78
|
-
live overlay hot-reloads onto your change while the user watches; for a
|
|
79
|
-
brand-new page, register the empty page and navigate to it before composing
|
|
80
|
-
content.
|