@endora-commerce/mod-prompt-actions 0.0.0-stage → 0.100.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/LICENSE +21 -0
- package/README.md +51 -2
- package/dist/backend/entities/prompt-action-request.entity.d.ts +37 -0
- package/dist/backend/entities/prompt-action-request.entity.d.ts.map +1 -0
- package/dist/backend/entities/prompt-action-request.entity.js +130 -0
- package/dist/backend/entities/prompt-action-request.entity.js.map +1 -0
- package/dist/backend/index.d.ts +94 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +127 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/routes.admin.d.ts +30 -0
- package/dist/backend/routes.admin.d.ts.map +1 -0
- package/dist/backend/routes.admin.js +71 -0
- package/dist/backend/routes.admin.js.map +1 -0
- package/dist/backend/services/bulk-progress-registry.d.ts +82 -0
- package/dist/backend/services/bulk-progress-registry.d.ts.map +1 -0
- package/dist/backend/services/bulk-progress-registry.js +44 -0
- package/dist/backend/services/bulk-progress-registry.js.map +1 -0
- package/dist/backend/services/interpreter.service.d.ts +59 -0
- package/dist/backend/services/interpreter.service.d.ts.map +1 -0
- package/dist/backend/services/interpreter.service.js +270 -0
- package/dist/backend/services/interpreter.service.js.map +1 -0
- package/dist/backend/services/llm/anthropic-adapter.d.ts +9 -0
- package/dist/backend/services/llm/anthropic-adapter.d.ts.map +1 -0
- package/dist/backend/services/llm/anthropic-adapter.js +83 -0
- package/dist/backend/services/llm/anthropic-adapter.js.map +1 -0
- package/dist/backend/services/llm/google-adapter.d.ts +9 -0
- package/dist/backend/services/llm/google-adapter.d.ts.map +1 -0
- package/dist/backend/services/llm/google-adapter.js +125 -0
- package/dist/backend/services/llm/google-adapter.js.map +1 -0
- package/dist/backend/services/llm/openai-adapter.d.ts +9 -0
- package/dist/backend/services/llm/openai-adapter.d.ts.map +1 -0
- package/dist/backend/services/llm/openai-adapter.js +95 -0
- package/dist/backend/services/llm/openai-adapter.js.map +1 -0
- package/dist/backend/services/llm/provider-factory.d.ts +60 -0
- package/dist/backend/services/llm/provider-factory.d.ts.map +1 -0
- package/dist/backend/services/llm/provider-factory.js +111 -0
- package/dist/backend/services/llm/provider-factory.js.map +1 -0
- package/dist/backend/services/llm/provider.d.ts +63 -0
- package/dist/backend/services/llm/provider.d.ts.map +1 -0
- package/dist/backend/services/llm/provider.js +67 -0
- package/dist/backend/services/llm/provider.js.map +1 -0
- package/dist/backend/services/plan-executor.service.d.ts +49 -0
- package/dist/backend/services/plan-executor.service.d.ts.map +1 -0
- package/dist/backend/services/plan-executor.service.js +132 -0
- package/dist/backend/services/plan-executor.service.js.map +1 -0
- package/dist/backend/services/prompt-request.service.d.ts +84 -0
- package/dist/backend/services/prompt-request.service.d.ts.map +1 -0
- package/dist/backend/services/prompt-request.service.js +338 -0
- package/dist/backend/services/prompt-request.service.js.map +1 -0
- package/dist/backend/services/tool-registry.d.ts +17 -0
- package/dist/backend/services/tool-registry.d.ts.map +1 -0
- package/dist/backend/services/tool-registry.js +89 -0
- package/dist/backend/services/tool-registry.js.map +1 -0
- package/dist/manifest.d.ts +252 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +199 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260611T140410_prompt_actions_init.d.ts +17 -0
- package/dist/migrations/20260611T140410_prompt_actions_init.d.ts.map +1 -0
- package/dist/migrations/20260611T140410_prompt_actions_init.js +47 -0
- package/dist/migrations/20260611T140410_prompt_actions_init.js.map +1 -0
- package/dist/migrations/index.d.ts +27 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +29 -0
- package/dist/migrations/index.js.map +1 -0
- package/docs/prompt-actions.md +117 -0
- package/i18n/en.json +40 -0
- package/i18n/pl.json +40 -0
- package/package.json +67 -3
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* PromptActionToolRegistry — the module-facing port of feature 043
|
|
4
|
+
* (data-model §4, contracts/prompt-actions-api.md "Tool-contribution
|
|
5
|
+
* contract").
|
|
6
|
+
*
|
|
7
|
+
* Owning modules contribute tools at composition time (the same pattern as
|
|
8
|
+
* the payment/shipping adapter registries), so `prompt_actions` never
|
|
9
|
+
* imports another module's internals. The registry is the ONLY catalogue the
|
|
10
|
+
* interpreter may draw operations from: anything the LLM proposes that is
|
|
11
|
+
* not registered here is rejected (FR-002 / FR-014).
|
|
12
|
+
*
|
|
13
|
+
* Contribution rules (enforced at registration where statically checkable):
|
|
14
|
+
* 1. `id` is '<moduleId>.<snake_case_name>' and unique.
|
|
15
|
+
* 2. `requiredPermission` mirrors the permission guarding the equivalent
|
|
16
|
+
* manual admin route.
|
|
17
|
+
* 3. `paramsSchema` (Zod) is the single source for validating LLM
|
|
18
|
+
* arguments and for the provider-facing JSON Schema.
|
|
19
|
+
* 4. Mutations are inert at interpretation time and MUST implement
|
|
20
|
+
* `preview()` returning server-computed facts.
|
|
21
|
+
* 5. Resolvers are side-effect-free and cap their result size.
|
|
22
|
+
*
|
|
23
|
+
* **The contribution shape is published** (feature 075, D-75):
|
|
24
|
+
* `PromptActionTool`, `ToolContext`, `ToolAuditContext`, `LlmToolDefinition`,
|
|
25
|
+
* `ToolVisibilityContext` and `PromptActionToolRegistryPort` all live in
|
|
26
|
+
* `@endora-commerce/contracts`, so a contributor names the interface and this module keeps
|
|
27
|
+
* the class. What made that possible was deleting `ToolContext.em`: it carried
|
|
28
|
+
* a MikroORM type that may not appear in a browser-bundled package, and — more
|
|
29
|
+
* to the point — it carried nothing anybody used. Every contributor read it in
|
|
30
|
+
* `preview()` only, only for reads, only of its own tables.
|
|
31
|
+
*/
|
|
32
|
+
const TOOL_ID_RE = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$/;
|
|
33
|
+
export class PromptActionToolRegistry {
|
|
34
|
+
tools = new Map();
|
|
35
|
+
register(tool) {
|
|
36
|
+
if (!TOOL_ID_RE.test(tool.id)) {
|
|
37
|
+
throw new Error(`Prompt-action tool id "${tool.id}" must match '<moduleId>.<snake_case_name>'.`);
|
|
38
|
+
}
|
|
39
|
+
const [prefix] = tool.id.split('.', 1);
|
|
40
|
+
if (prefix !== tool.moduleId) {
|
|
41
|
+
throw new Error(`Prompt-action tool "${tool.id}" must be prefixed with its owning moduleId "${tool.moduleId}".`);
|
|
42
|
+
}
|
|
43
|
+
if (tool.kind === 'mutation' && typeof tool.preview !== 'function') {
|
|
44
|
+
throw new Error(`Prompt-action mutation "${tool.id}" must implement preview() — plans render server-computed facts only.`);
|
|
45
|
+
}
|
|
46
|
+
if (this.tools.has(tool.id)) {
|
|
47
|
+
throw new Error(`Duplicate prompt-action tool id "${tool.id}".`);
|
|
48
|
+
}
|
|
49
|
+
this.tools.set(tool.id, tool);
|
|
50
|
+
}
|
|
51
|
+
get(id) {
|
|
52
|
+
return this.tools.get(id);
|
|
53
|
+
}
|
|
54
|
+
list() {
|
|
55
|
+
return [...this.tools.values()];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The catalogue sent to the LLM for one operator: tools whose owning
|
|
59
|
+
* module is installed AND whose permission the operator holds. Filtering
|
|
60
|
+
* happens here (before the model ever sees a tool) and again at execution
|
|
61
|
+
* time in the plan executor (defense in depth, FR-007).
|
|
62
|
+
*/
|
|
63
|
+
async visibleFor(ctx) {
|
|
64
|
+
const out = [];
|
|
65
|
+
const moduleStates = new Map();
|
|
66
|
+
for (const tool of this.tools.values()) {
|
|
67
|
+
let installed = moduleStates.get(tool.moduleId);
|
|
68
|
+
if (installed === undefined) {
|
|
69
|
+
installed = await ctx.isModuleInstalled(tool.moduleId);
|
|
70
|
+
moduleStates.set(tool.moduleId, installed);
|
|
71
|
+
}
|
|
72
|
+
if (!installed)
|
|
73
|
+
continue;
|
|
74
|
+
if (!(await ctx.hasPermission(tool.requiredPermission)))
|
|
75
|
+
continue;
|
|
76
|
+
out.push(tool);
|
|
77
|
+
}
|
|
78
|
+
return out;
|
|
79
|
+
}
|
|
80
|
+
/** Provider-facing definition: same Zod schema, serialized as JSON Schema. */
|
|
81
|
+
toLlmToolDefinition(tool) {
|
|
82
|
+
return {
|
|
83
|
+
name: tool.id,
|
|
84
|
+
description: tool.description,
|
|
85
|
+
inputSchema: z.toJSONSchema(tool.paramsSchema, { io: 'input' }),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-registry.js","sourceRoot":"","sources":["../../../src/backend/services/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,MAAM,UAAU,GAAG,oCAAoC,CAAC;AAExD,MAAM,OAAO,wBAAwB;IAClB,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAE7D,QAAQ,CAAI,IAAyB;QACnC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,0BAA0B,IAAI,CAAC,EAAE,8CAA8C,CAChF,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvC,IAAI,MAAM,KAAK,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,uBAAuB,IAAI,CAAC,EAAE,gDAAgD,IAAI,CAAC,QAAQ,IAAI,CAChG,CAAC;QACJ,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;YACnE,MAAM,IAAI,KAAK,CACb,2BAA2B,IAAI,CAAC,EAAE,u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AC;IAED,8EAA8E;IAC9E,mBAAmB,CAAC,IAAsB;QACxC,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,CAA4B;SAC3F,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Actions module — feature 043.
|
|
3
|
+
*
|
|
4
|
+
* Natural-language prompt mode for the admin command palette: the operator
|
|
5
|
+
* types an instruction (PL/EN), the backend interprets it with an LLM via
|
|
6
|
+
* tool use / function calling against a curated, module-contributed tool
|
|
7
|
+
* catalogue, presents a confirmable plan, and executes it through existing
|
|
8
|
+
* module services under the operator's own permissions.
|
|
9
|
+
*
|
|
10
|
+
* Settings (research §R4; provider credentials via feature 058):
|
|
11
|
+
* - prompt_actions.enabled — platform-wide kill switch (FR-015).
|
|
12
|
+
* - prompt_actions.llm_credentials — reference to a reusable `llm` credential
|
|
13
|
+
* configuration (provider + model + API
|
|
14
|
+
* key). The single credential source.
|
|
15
|
+
* - prompt_actions.bulk_limit — max affected records per prompt (FR-010).
|
|
16
|
+
*
|
|
17
|
+
* No palette `actions:` entry: feature 020 actions are navigation-only, and
|
|
18
|
+
* the prompt mode has no standalone route — its entry point is the
|
|
19
|
+
* capability-gated "Ask the assistant" row the admin shell pins inside the
|
|
20
|
+
* palette itself.
|
|
21
|
+
*/
|
|
22
|
+
export declare const PROMPT_ACTIONS_SETTING_CODES: {
|
|
23
|
+
/**
|
|
24
|
+
* Feature 074 — the operator-activation control, and a **different switch**
|
|
25
|
+
* from `ENABLED` below. The two answer different questions and neither can
|
|
26
|
+
* stand in for the other:
|
|
27
|
+
*
|
|
28
|
+
* - `ENABLED` is the assistant's own kill switch, default `false`. Off, the
|
|
29
|
+
* module is *present*: the capability endpoint answers `200 {status:
|
|
30
|
+
* 'disabled'}` and a submission answers `409 ASSISTANT_DISABLED`, which is
|
|
31
|
+
* what the palette reads to learn it should not offer prompt mode.
|
|
32
|
+
* - `ACTIVATION` is the Constitution XVII axis, default `true`. Off, the
|
|
33
|
+
* module is *absent*: `ctx.routes` 503s the whole surface, including the
|
|
34
|
+
* probe above.
|
|
35
|
+
*
|
|
36
|
+
* Adopting `ENABLED` as the activation control — which D-44 §6 proposed —
|
|
37
|
+
* would have done two things at once: taken the probe away from the palette,
|
|
38
|
+
* and switched the module off in every existing deployment, because the row
|
|
39
|
+
* resolves `false` by default. FR-012 forbids the second outright.
|
|
40
|
+
*/
|
|
41
|
+
readonly ACTIVATION: "prompt_actions.activation";
|
|
42
|
+
readonly ENABLED: "prompt_actions.enabled";
|
|
43
|
+
readonly LLM_CREDENTIALS: "prompt_actions.llm_credentials";
|
|
44
|
+
readonly BULK_LIMIT: "prompt_actions.bulk_limit";
|
|
45
|
+
};
|
|
46
|
+
export declare const PROMPT_ACTIONS_USE_PERMISSION = "prompt_actions:use";
|
|
47
|
+
/** Settings-only export consumed by the boot-time ManifestReconciler lists. */
|
|
48
|
+
export declare const promptActionsSettingsManifest: {
|
|
49
|
+
moduleCode: string;
|
|
50
|
+
groups: {
|
|
51
|
+
code: string;
|
|
52
|
+
name: string;
|
|
53
|
+
salesChannelCodes?: string[] | undefined;
|
|
54
|
+
isSystemProtected?: boolean | undefined;
|
|
55
|
+
}[];
|
|
56
|
+
settings: {
|
|
57
|
+
code: string;
|
|
58
|
+
name: string;
|
|
59
|
+
valueType: "string" | "number" | "boolean" | "json" | "string_list" | "secret" | "credential_ref";
|
|
60
|
+
defaultValue: unknown;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
groupCode?: string | undefined;
|
|
63
|
+
previousDefaultValues?: unknown[] | undefined;
|
|
64
|
+
salesChannelCodes?: string[] | undefined;
|
|
65
|
+
enumOptions?: string[] | undefined;
|
|
66
|
+
configurationType?: string | undefined;
|
|
67
|
+
hidden?: boolean | undefined;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
export declare const manifest: {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
version: string;
|
|
74
|
+
dependencies: string[];
|
|
75
|
+
description?: string | undefined;
|
|
76
|
+
acknowledgedDependencies?: {
|
|
77
|
+
moduleId: string;
|
|
78
|
+
port: string;
|
|
79
|
+
reason: string;
|
|
80
|
+
}[] | undefined;
|
|
81
|
+
nonBindingDependencies?: {
|
|
82
|
+
moduleId: string;
|
|
83
|
+
name: string;
|
|
84
|
+
kind: "contributes-to" | "degrades-without" | "refuses-without";
|
|
85
|
+
reason: string;
|
|
86
|
+
whenAbsent?: string | undefined;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
activation?: {
|
|
89
|
+
settingCode: string;
|
|
90
|
+
default: boolean;
|
|
91
|
+
} | {
|
|
92
|
+
nonDeactivatable: true;
|
|
93
|
+
reason: string;
|
|
94
|
+
} | undefined;
|
|
95
|
+
settings?: {
|
|
96
|
+
moduleCode: string;
|
|
97
|
+
groups: {
|
|
98
|
+
code: string;
|
|
99
|
+
name: string;
|
|
100
|
+
salesChannelCodes?: string[] | undefined;
|
|
101
|
+
isSystemProtected?: boolean | undefined;
|
|
102
|
+
}[];
|
|
103
|
+
settings: {
|
|
104
|
+
code: string;
|
|
105
|
+
name: string;
|
|
106
|
+
valueType: "string" | "number" | "boolean" | "json" | "string_list" | "secret" | "credential_ref";
|
|
107
|
+
defaultValue: unknown;
|
|
108
|
+
description?: string | undefined;
|
|
109
|
+
groupCode?: string | undefined;
|
|
110
|
+
previousDefaultValues?: unknown[] | undefined;
|
|
111
|
+
salesChannelCodes?: string[] | undefined;
|
|
112
|
+
enumOptions?: string[] | undefined;
|
|
113
|
+
configurationType?: string | undefined;
|
|
114
|
+
hidden?: boolean | undefined;
|
|
115
|
+
}[];
|
|
116
|
+
} | undefined;
|
|
117
|
+
i18n?: {
|
|
118
|
+
bundlesDir: string;
|
|
119
|
+
} | undefined;
|
|
120
|
+
docs?: false | {
|
|
121
|
+
dir: string;
|
|
122
|
+
} | undefined;
|
|
123
|
+
demo?: false | {
|
|
124
|
+
summary: string;
|
|
125
|
+
seed: (context: import("@endora-commerce/contracts").ModuleDemoContext<never>) => Promise<import("@endora-commerce/contracts").DemoSeedResult>;
|
|
126
|
+
reset: (context: import("@endora-commerce/contracts").ModuleDemoContext<never>) => Promise<import("@endora-commerce/contracts").DemoResetResult>;
|
|
127
|
+
after?: readonly string[] | undefined;
|
|
128
|
+
package?: string | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
actions?: {
|
|
131
|
+
id: string;
|
|
132
|
+
labelKey: string;
|
|
133
|
+
icon: "Plus" | "Sparkles" | "Settings" | "Search" | "Boxes" | "Layers" | "Menu" | "PlusCircle" | "PlusSquare" | "FilePlus" | "FolderPlus" | "Upload" | "FileUp" | "CloudUpload" | "Download" | "FileDown" | "FileText" | "BookOpen" | "Rss" | "Package" | "Tag" | "ShoppingCart" | "Receipt" | "CreditCard" | "Users" | "UserPlus" | "Inbox" | "ListChecks" | "ClipboardList" | "Image" | "Video" | "LayoutDashboard" | "PanelLeft" | "KeyRound" | "ShieldCheck" | "Edit" | "Archive" | "Box" | "Truck" | "CircleDollarSign" | "Activity" | "LineChart" | "Smartphone" | "Webhook" | "Scale" | "PlugZap" | "PercentDiamond" | "Newspaper" | "Languages" | "Eraser" | "Warehouse" | "TrendingDown" | "Bell" | "PackageOpen" | "Building2" | "Store" | "ClipboardCheck";
|
|
134
|
+
targetRoute: string;
|
|
135
|
+
keywords: string[];
|
|
136
|
+
weight: number;
|
|
137
|
+
descriptionKey?: string | undefined;
|
|
138
|
+
requiredPermission?: string | undefined;
|
|
139
|
+
}[] | undefined;
|
|
140
|
+
permissions?: {
|
|
141
|
+
code: string;
|
|
142
|
+
label: string;
|
|
143
|
+
module?: string | undefined;
|
|
144
|
+
description?: string | undefined;
|
|
145
|
+
requires?: string[] | undefined;
|
|
146
|
+
}[] | undefined;
|
|
147
|
+
transactionalEmails?: {
|
|
148
|
+
code: string;
|
|
149
|
+
name: string;
|
|
150
|
+
variables: {
|
|
151
|
+
key: string;
|
|
152
|
+
label: string;
|
|
153
|
+
sampleValue?: string | undefined;
|
|
154
|
+
description?: string | undefined;
|
|
155
|
+
}[];
|
|
156
|
+
description?: string | undefined;
|
|
157
|
+
group?: string | undefined;
|
|
158
|
+
}[] | undefined;
|
|
159
|
+
capabilities?: string[] | undefined;
|
|
160
|
+
exclusiveCapabilities?: {
|
|
161
|
+
key: string;
|
|
162
|
+
errorCode: string;
|
|
163
|
+
}[] | undefined;
|
|
164
|
+
errorCodes?: {
|
|
165
|
+
code: string;
|
|
166
|
+
tokens?: string[] | undefined;
|
|
167
|
+
}[] | undefined;
|
|
168
|
+
blocks?: {
|
|
169
|
+
name: string;
|
|
170
|
+
labelKey: string;
|
|
171
|
+
category: string;
|
|
172
|
+
contexts: ("invoice" | "email" | "cms" | "newsletter")[];
|
|
173
|
+
fields: Record<string, {
|
|
174
|
+
type: "number" | "object" | "array" | "text" | "textarea" | "select" | "radio" | "external" | "uuid" | "richtext";
|
|
175
|
+
label?: string | undefined;
|
|
176
|
+
required?: boolean | undefined;
|
|
177
|
+
options?: {
|
|
178
|
+
label: string;
|
|
179
|
+
value: string | number;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
refKind?: string | undefined;
|
|
182
|
+
}>;
|
|
183
|
+
descriptionKey?: string | undefined;
|
|
184
|
+
defaultProps?: Record<string, unknown> | undefined;
|
|
185
|
+
responsiveFields?: string[] | undefined;
|
|
186
|
+
previewIcon?: string | undefined;
|
|
187
|
+
weight?: number | undefined;
|
|
188
|
+
}[] | undefined;
|
|
189
|
+
blockCategories?: {
|
|
190
|
+
key: string;
|
|
191
|
+
titleKey: string;
|
|
192
|
+
contexts: ("invoice" | "email" | "cms" | "newsletter")[];
|
|
193
|
+
weight?: number | undefined;
|
|
194
|
+
visible?: boolean | undefined;
|
|
195
|
+
}[] | undefined;
|
|
196
|
+
env?: {
|
|
197
|
+
name: string;
|
|
198
|
+
describes: {
|
|
199
|
+
en: string;
|
|
200
|
+
pl: string;
|
|
201
|
+
};
|
|
202
|
+
requirement: {
|
|
203
|
+
kind: "required";
|
|
204
|
+
} | {
|
|
205
|
+
kind: "requiredWhen";
|
|
206
|
+
input: string;
|
|
207
|
+
equals: string;
|
|
208
|
+
} | {
|
|
209
|
+
kind: "optional";
|
|
210
|
+
without: {
|
|
211
|
+
en: string;
|
|
212
|
+
pl: string;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
secret: boolean;
|
|
216
|
+
generable: boolean;
|
|
217
|
+
owner: {
|
|
218
|
+
kind: "platform";
|
|
219
|
+
} | {
|
|
220
|
+
kind: "application";
|
|
221
|
+
application: "admin" | "backend" | "storefront";
|
|
222
|
+
} | {
|
|
223
|
+
kind: "module";
|
|
224
|
+
moduleId: string;
|
|
225
|
+
};
|
|
226
|
+
consumers: ("admin" | "backend" | "storefront")[];
|
|
227
|
+
addressOf: "admin" | "backend" | "storefront" | null;
|
|
228
|
+
}[] | undefined;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* What this module offers the admin home dashboard's Recent Activity card —
|
|
232
|
+
* feature 080, T042j / D-163.1.
|
|
233
|
+
*
|
|
234
|
+
* **This entry is the drift D-163 named.** `prompt_action.execute` was in the
|
|
235
|
+
* host's server-side allow-list and in its action-to-module prefix map, and
|
|
236
|
+
* absent from the route's three-member `module` enum and from the admin's
|
|
237
|
+
* `ACTIVITY_RENDERING` — so a prompt-assistant row was fetched, classified
|
|
238
|
+
* `prompt_actions`, and then rendered with the unknown-verb fallback, while the
|
|
239
|
+
* response schema described a `module` value the server could emit and the
|
|
240
|
+
* contract did not list. Four hand-maintained tables in two languages, and they
|
|
241
|
+
* were not kept true. It is repaired here by the derivation rather than by a
|
|
242
|
+
* fifth hand-written entry, which is the difference between fixing an instance
|
|
243
|
+
* and fixing the class.
|
|
244
|
+
*/
|
|
245
|
+
export declare const recentActivity: {
|
|
246
|
+
entries: {
|
|
247
|
+
action: string;
|
|
248
|
+
icon: "Plus" | "Sparkles" | "Settings" | "Search" | "Boxes" | "Layers" | "Menu" | "PlusCircle" | "PlusSquare" | "FilePlus" | "FolderPlus" | "Upload" | "FileUp" | "CloudUpload" | "Download" | "FileDown" | "FileText" | "BookOpen" | "Rss" | "Package" | "Tag" | "ShoppingCart" | "Receipt" | "CreditCard" | "Users" | "UserPlus" | "Inbox" | "ListChecks" | "ClipboardList" | "Image" | "Video" | "LayoutDashboard" | "PanelLeft" | "KeyRound" | "ShieldCheck" | "Edit" | "Archive" | "Box" | "Truck" | "CircleDollarSign" | "Activity" | "LineChart" | "Smartphone" | "Webhook" | "Scale" | "PlugZap" | "PercentDiamond" | "Newspaper" | "Languages" | "Eraser" | "Warehouse" | "TrendingDown" | "Bell" | "PackageOpen" | "Building2" | "Store" | "ClipboardCheck";
|
|
249
|
+
labelKey: string;
|
|
250
|
+
}[];
|
|
251
|
+
};
|
|
252
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,eAAO,MAAM,4BAA4B;IACvC;;;;;;;;;;;;;;;;;OAiBG;;;;;CAOK,CAAC;AAEX,eAAO,MAAM,6BAA6B,uBAAuB,CAAC;AAiDlE,+EAA+E;AAC/E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;CAAW,CAAC;AAEtD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkFnB,CAAC;AAEH;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc;;;;;;CAQzB,CAAC"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { defineModuleManifest, defineModuleRecentActivity, defineModuleSettingsManifest, } from '@endora-commerce/contracts';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt Actions module — feature 043.
|
|
4
|
+
*
|
|
5
|
+
* Natural-language prompt mode for the admin command palette: the operator
|
|
6
|
+
* types an instruction (PL/EN), the backend interprets it with an LLM via
|
|
7
|
+
* tool use / function calling against a curated, module-contributed tool
|
|
8
|
+
* catalogue, presents a confirmable plan, and executes it through existing
|
|
9
|
+
* module services under the operator's own permissions.
|
|
10
|
+
*
|
|
11
|
+
* Settings (research §R4; provider credentials via feature 058):
|
|
12
|
+
* - prompt_actions.enabled — platform-wide kill switch (FR-015).
|
|
13
|
+
* - prompt_actions.llm_credentials — reference to a reusable `llm` credential
|
|
14
|
+
* configuration (provider + model + API
|
|
15
|
+
* key). The single credential source.
|
|
16
|
+
* - prompt_actions.bulk_limit — max affected records per prompt (FR-010).
|
|
17
|
+
*
|
|
18
|
+
* No palette `actions:` entry: feature 020 actions are navigation-only, and
|
|
19
|
+
* the prompt mode has no standalone route — its entry point is the
|
|
20
|
+
* capability-gated "Ask the assistant" row the admin shell pins inside the
|
|
21
|
+
* palette itself.
|
|
22
|
+
*/
|
|
23
|
+
export const PROMPT_ACTIONS_SETTING_CODES = {
|
|
24
|
+
/**
|
|
25
|
+
* Feature 074 — the operator-activation control, and a **different switch**
|
|
26
|
+
* from `ENABLED` below. The two answer different questions and neither can
|
|
27
|
+
* stand in for the other:
|
|
28
|
+
*
|
|
29
|
+
* - `ENABLED` is the assistant's own kill switch, default `false`. Off, the
|
|
30
|
+
* module is *present*: the capability endpoint answers `200 {status:
|
|
31
|
+
* 'disabled'}` and a submission answers `409 ASSISTANT_DISABLED`, which is
|
|
32
|
+
* what the palette reads to learn it should not offer prompt mode.
|
|
33
|
+
* - `ACTIVATION` is the Constitution XVII axis, default `true`. Off, the
|
|
34
|
+
* module is *absent*: `ctx.routes` 503s the whole surface, including the
|
|
35
|
+
* probe above.
|
|
36
|
+
*
|
|
37
|
+
* Adopting `ENABLED` as the activation control — which D-44 §6 proposed —
|
|
38
|
+
* would have done two things at once: taken the probe away from the palette,
|
|
39
|
+
* and switched the module off in every existing deployment, because the row
|
|
40
|
+
* resolves `false` by default. FR-012 forbids the second outright.
|
|
41
|
+
*/
|
|
42
|
+
ACTIVATION: 'prompt_actions.activation',
|
|
43
|
+
ENABLED: 'prompt_actions.enabled',
|
|
44
|
+
// Feature 058 — the single credential source: a reusable `llm` credential
|
|
45
|
+
// configuration supplying provider + model + API key.
|
|
46
|
+
LLM_CREDENTIALS: 'prompt_actions.llm_credentials',
|
|
47
|
+
BULK_LIMIT: 'prompt_actions.bulk_limit',
|
|
48
|
+
};
|
|
49
|
+
export const PROMPT_ACTIONS_USE_PERMISSION = 'prompt_actions:use';
|
|
50
|
+
const settings = defineModuleSettingsManifest({
|
|
51
|
+
moduleCode: 'prompt_actions',
|
|
52
|
+
groups: [{ code: 'prompt_actions', name: 'Prompt actions (AI assistant)' }],
|
|
53
|
+
settings: [
|
|
54
|
+
{
|
|
55
|
+
// Feature 074 — the operator's activation control. Platform-wide, and
|
|
56
|
+
// never channel-scoped: activation stops at `global_value` →
|
|
57
|
+
// `default_value` by construction.
|
|
58
|
+
code: PROMPT_ACTIONS_SETTING_CODES.ACTIVATION,
|
|
59
|
+
name: 'Prompt actions enabled',
|
|
60
|
+
description: 'Switches the whole module on or off: the prompt API, the plan preview and execution path, and the tools other modules contribute to it. This is the module switch; the assistant\'s own on/off, which leaves the palette able to say "not available", is the setting below. Nothing is dropped — every recorded plan, its audit trail and the LLM credential reference stay in the database.',
|
|
61
|
+
groupCode: 'prompt_actions',
|
|
62
|
+
valueType: 'boolean',
|
|
63
|
+
defaultValue: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
code: PROMPT_ACTIONS_SETTING_CODES.ENABLED,
|
|
67
|
+
name: 'Assistant enabled',
|
|
68
|
+
description: 'Platform-wide switch for the natural-language prompt mode in the admin command palette. When off, the palette behaves exactly as without the module.',
|
|
69
|
+
groupCode: 'prompt_actions',
|
|
70
|
+
valueType: 'boolean',
|
|
71
|
+
defaultValue: false,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
code: PROMPT_ACTIONS_SETTING_CODES.LLM_CREDENTIALS,
|
|
75
|
+
name: 'LLM credentials',
|
|
76
|
+
description: 'Reference a reusable LLM credential configuration (Credentials screen) providing the provider, model and API key. Required to enable the assistant.',
|
|
77
|
+
groupCode: 'prompt_actions',
|
|
78
|
+
valueType: 'credential_ref',
|
|
79
|
+
configurationType: 'llm',
|
|
80
|
+
defaultValue: '',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
code: PROMPT_ACTIONS_SETTING_CODES.BULK_LIMIT,
|
|
84
|
+
name: 'Bulk operation limit',
|
|
85
|
+
description: 'Maximum number of records a single prompt may affect. Plans whose preview exceeds the limit are blocked before execution.',
|
|
86
|
+
groupCode: 'prompt_actions',
|
|
87
|
+
valueType: 'number',
|
|
88
|
+
defaultValue: 500,
|
|
89
|
+
},
|
|
90
|
+
],
|
|
91
|
+
});
|
|
92
|
+
/** Settings-only export consumed by the boot-time ManifestReconciler lists. */
|
|
93
|
+
export const promptActionsSettingsManifest = settings;
|
|
94
|
+
export const manifest = defineModuleManifest({
|
|
95
|
+
id: 'prompt_actions',
|
|
96
|
+
name: 'Prompt Actions',
|
|
97
|
+
description: 'Natural-language prompt mode for the admin command palette: interpret an operator instruction with an LLM, preview the plan, execute it through existing module services after explicit confirmation.',
|
|
98
|
+
version: '1.0.0',
|
|
99
|
+
// `auth` owns the `requireAdmin` port and `admin_roles` owns
|
|
100
|
+
// `permissionService`; both are resolved from the container, so both are
|
|
101
|
+
// real dependencies of this module rather than of its composition root.
|
|
102
|
+
dependencies: ['_i18n', '_lifecycle', 'admin_roles', 'auth', 'credentials', 'settings'],
|
|
103
|
+
settings,
|
|
104
|
+
// Feature 074 (Constitution XVII) — a control this module never had, so the
|
|
105
|
+
// module was governed by the platform axis alone. `backend.ts` explains why
|
|
106
|
+
// it was withheld: adopting `prompt_actions.enabled` would 503 the capability
|
|
107
|
+
// probe the palette needs in order to *learn* the assistant is off. That
|
|
108
|
+
// argument is answered by giving the module its own activation code rather
|
|
109
|
+
// than by leaving it without a control — the two switches now sit side by
|
|
110
|
+
// side and mean different things.
|
|
111
|
+
//
|
|
112
|
+
// Default `true`, superseding D-44 §6's `default: false`. The ground is
|
|
113
|
+
// general and not a judgement about the assistant: merging must not change
|
|
114
|
+
// the state of any existing deployment, and a module with no activation
|
|
115
|
+
// declaration resolves as activated today. A client who does not want it
|
|
116
|
+
// switches it off, like every other operator-controlled module — and the
|
|
117
|
+
// assistant's own kill switch below still defaults to `false`, so nothing
|
|
118
|
+
// starts talking to an LLM because of this.
|
|
119
|
+
activation: { settingCode: PROMPT_ACTIONS_SETTING_CODES.ACTIVATION, default: true },
|
|
120
|
+
i18n: { bundlesDir: 'i18n' },
|
|
121
|
+
docs: { dir: 'docs' },
|
|
122
|
+
/**
|
|
123
|
+
* The `ASSISTANT_*` and `PROMPT_*` codes — D-129's remaining sweep, Tier A
|
|
124
|
+
* (`specs/090-module-owned-error-codes/d129-sweep.md` §5.2, Appendix A;
|
|
125
|
+
* MR 3).
|
|
126
|
+
*
|
|
127
|
+
* All six were declared by `_i18n` until this merge request, not because
|
|
128
|
+
* anybody judged them the platform's but because the deleted prefix chain
|
|
129
|
+
* had no rule for them and its last line was `return 'core'`. **D-121 T1
|
|
130
|
+
* puts them here**: the noun in each is either the prompt assistant — the
|
|
131
|
+
* LLM capability this module configures, gates and calls — or a prompt
|
|
132
|
+
* action request, the `PromptActionRequest` row this module owns and whose
|
|
133
|
+
* whole state machine it runs. This module is also the only one that raises
|
|
134
|
+
* them, so T1 and the raise-site count agree.
|
|
135
|
+
*
|
|
136
|
+
* **`ASSISTANT_*` is not `MODULE_DISABLED`, and the distinction is the
|
|
137
|
+
* reason it is a code of its own.** `ASSISTANT_DISABLED` refuses a
|
|
138
|
+
* submission while this module is *present and switched on* and its own
|
|
139
|
+
* `prompt_actions.assistant_enabled` kill switch is off; a switched-off
|
|
140
|
+
* module answers `MODULE_DISABLED`, which is the platform's vocabulary and
|
|
141
|
+
* stays with it (Constitution XVII, `d129-sweep.md` §2.5).
|
|
142
|
+
*
|
|
143
|
+
* **No sentence moves with them.** None of the six has a sentence in either
|
|
144
|
+
* language anywhere in the tree; all six were already on
|
|
145
|
+
* `UNTRANSLATED_ERROR_CODES` under `_i18n` and move to this module's group
|
|
146
|
+
* there, so the bundle this module already ships gains no key. The admin's
|
|
147
|
+
* prompt panel maps four of them to its own copy
|
|
148
|
+
* (`admin/src/components/prompt-actions/PromptModePanel.tsx`), which is a
|
|
149
|
+
* surface string and not the envelope's sentence — that mapping is untouched
|
|
150
|
+
* and unaffected by which bundle the envelope reads.
|
|
151
|
+
*
|
|
152
|
+
* **`tokens` is derived from the raise sites, not from the bundle**
|
|
153
|
+
* (runbook §5), and there are none to declare: every raise is a bare
|
|
154
|
+
* `HttpError(status, code, message)` or a `readonly code =` on an `Error`
|
|
155
|
+
* subclass in `services/llm/provider-factory.ts` and
|
|
156
|
+
* `services/plan-executor.service.ts`, and no site puts a `details.code` on
|
|
157
|
+
* the wire.
|
|
158
|
+
*/
|
|
159
|
+
errorCodes: [
|
|
160
|
+
{ code: 'ASSISTANT_DISABLED' },
|
|
161
|
+
{ code: 'ASSISTANT_NOT_CONFIGURED' },
|
|
162
|
+
{ code: 'PROMPT_PERMISSION_REVOKED' },
|
|
163
|
+
{ code: 'PROMPT_PLAN_EXPIRED' },
|
|
164
|
+
{ code: 'PROMPT_REQUEST_INVALID_STATE' },
|
|
165
|
+
{ code: 'PROMPT_REQUEST_IN_FLIGHT' },
|
|
166
|
+
],
|
|
167
|
+
permissions: [
|
|
168
|
+
{
|
|
169
|
+
code: PROMPT_ACTIONS_USE_PERMISSION,
|
|
170
|
+
label: 'Use the prompt assistant',
|
|
171
|
+
description: 'Allows the operator to open the prompt mode in the admin command palette and execute confirmed plans (each planned operation is additionally re-checked against the permission of its underlying action).',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* What this module offers the admin home dashboard's Recent Activity card —
|
|
177
|
+
* feature 080, T042j / D-163.1.
|
|
178
|
+
*
|
|
179
|
+
* **This entry is the drift D-163 named.** `prompt_action.execute` was in the
|
|
180
|
+
* host's server-side allow-list and in its action-to-module prefix map, and
|
|
181
|
+
* absent from the route's three-member `module` enum and from the admin's
|
|
182
|
+
* `ACTIVITY_RENDERING` — so a prompt-assistant row was fetched, classified
|
|
183
|
+
* `prompt_actions`, and then rendered with the unknown-verb fallback, while the
|
|
184
|
+
* response schema described a `module` value the server could emit and the
|
|
185
|
+
* contract did not list. Four hand-maintained tables in two languages, and they
|
|
186
|
+
* were not kept true. It is repaired here by the derivation rather than by a
|
|
187
|
+
* fifth hand-written entry, which is the difference between fixing an instance
|
|
188
|
+
* and fixing the class.
|
|
189
|
+
*/
|
|
190
|
+
export const recentActivity = defineModuleRecentActivity({
|
|
191
|
+
entries: [
|
|
192
|
+
{
|
|
193
|
+
action: 'prompt_action.execute',
|
|
194
|
+
icon: 'Sparkles',
|
|
195
|
+
labelKey: 'activity.verb.prompt_action.execute',
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
});
|
|
199
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,CAAC,MAAM,4BA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;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,0BAA0B,CAAC;IACvD,OAAO,EAAE;QACP;YACE,MAAM,EAAE,uBAAuB;YAC/B,IAAI,EAAE,UAAU;YAChB,QAAQ,EAAE,qCAAqC;SAChD;KACF;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt Actions module init (feature 043).
|
|
4
|
+
*
|
|
5
|
+
* Creates `prompt_action_requests` — one row per operator-submitted
|
|
6
|
+
* natural-language instruction, carrying the full lifecycle: interpretation
|
|
7
|
+
* output (plan / clarification), confirmation, execution result, and the
|
|
8
|
+
* `seen_at` marker that drives the "finished while you were away" notice.
|
|
9
|
+
*
|
|
10
|
+
* No FK on `admin_user_id` (matches the `module_actions` precedent: admin
|
|
11
|
+
* users are platform-owned; the lifecycle orchestrator owns cleanup).
|
|
12
|
+
*/
|
|
13
|
+
export declare class Migration20260611T140410PromptActionsInit extends Migration {
|
|
14
|
+
up(): Promise<void>;
|
|
15
|
+
down(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=20260611T140410_prompt_actions_init.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260611T140410_prompt_actions_init.d.ts","sourceRoot":"","sources":["../../src/migrations/20260611T140410_prompt_actions_init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACvD,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IA8BnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Prompt Actions module init (feature 043).
|
|
4
|
+
*
|
|
5
|
+
* Creates `prompt_action_requests` — one row per operator-submitted
|
|
6
|
+
* natural-language instruction, carrying the full lifecycle: interpretation
|
|
7
|
+
* output (plan / clarification), confirmation, execution result, and the
|
|
8
|
+
* `seen_at` marker that drives the "finished while you were away" notice.
|
|
9
|
+
*
|
|
10
|
+
* No FK on `admin_user_id` (matches the `module_actions` precedent: admin
|
|
11
|
+
* users are platform-owned; the lifecycle orchestrator owns cleanup).
|
|
12
|
+
*/
|
|
13
|
+
export class Migration20260611T140410PromptActionsInit extends Migration {
|
|
14
|
+
async up() {
|
|
15
|
+
this.addSql(`
|
|
16
|
+
create table "prompt_action_requests" (
|
|
17
|
+
"id" uuid not null,
|
|
18
|
+
"admin_user_id" uuid not null,
|
|
19
|
+
"prompt" text not null,
|
|
20
|
+
"language" varchar(12) null,
|
|
21
|
+
"status" varchar(32) not null,
|
|
22
|
+
"provider" varchar(32) null,
|
|
23
|
+
"model" varchar(120) null,
|
|
24
|
+
"plan" jsonb null,
|
|
25
|
+
"clarification" jsonb null,
|
|
26
|
+
"conversation" jsonb null,
|
|
27
|
+
"result" jsonb null,
|
|
28
|
+
"error" text null,
|
|
29
|
+
"bulk_operation_id" uuid null,
|
|
30
|
+
"seen_at" timestamptz null,
|
|
31
|
+
"confirmed_at" timestamptz null,
|
|
32
|
+
"finished_at" timestamptz null,
|
|
33
|
+
"created_at" timestamptz not null,
|
|
34
|
+
"updated_at" timestamptz not null,
|
|
35
|
+
constraint "prompt_action_requests_pkey" primary key ("id")
|
|
36
|
+
);
|
|
37
|
+
`);
|
|
38
|
+
this.addSql(`
|
|
39
|
+
create index "prompt_action_requests_admin_user_id_created_at_index"
|
|
40
|
+
on "prompt_action_requests" ("admin_user_id", "created_at" desc);
|
|
41
|
+
`);
|
|
42
|
+
}
|
|
43
|
+
async down() {
|
|
44
|
+
this.addSql(`drop table if exists "prompt_action_requests" cascade;`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=20260611T140410_prompt_actions_init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260611T140410_prompt_actions_init.js","sourceRoot":"","sources":["../../src/migrations/20260611T140410_prompt_actions_init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,yCAA0C,SAAQ,SAAS;IAC7D,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;KAsBX,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC;;;KAGX,CAAC,CAAC;IACL,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./migrations` subpath — every migration class this module owns, as one
|
|
3
|
+
* ordered `migrations` array.
|
|
4
|
+
*
|
|
5
|
+
* The array is what the platform reads when this module is **installed**:
|
|
6
|
+
* `src/packages/package-runtime.ts` takes `exported['migrations']` and refuses
|
|
7
|
+
* the package outright when it is absent (D-168).
|
|
8
|
+
*
|
|
9
|
+
* Listed in ascending timestamp, which is the order of this module's own
|
|
10
|
+
* migrations and of nothing else (feature 081): a manifest `dependencies` array
|
|
11
|
+
* is the only thing ordering this block against another module's.
|
|
12
|
+
*
|
|
13
|
+
* The **named** exports stay beside the array, and the asymmetry with
|
|
14
|
+
* `./backend` — which publishes an array and no named class (D-168) — is
|
|
15
|
+
* deliberate. `db/migrations-registry.generated.ts` imports each class by name
|
|
16
|
+
* from this specifier, and a migration class name is contract in a way an entity
|
|
17
|
+
* class name is not: `mikro_orm_migrations` persists it, so it is a string every
|
|
18
|
+
* already-migrated database holds.
|
|
19
|
+
*
|
|
20
|
+
* A class that is in neither the array nor the barrel is a migration that does
|
|
21
|
+
* not run: `migration:pending` reports nothing pending and the first symptom is
|
|
22
|
+
* a query against a table nobody created.
|
|
23
|
+
*/
|
|
24
|
+
import { Migration20260611T140410PromptActionsInit } from './20260611T140410_prompt_actions_init.js';
|
|
25
|
+
export declare const migrations: (typeof Migration20260611T140410PromptActionsInit)[];
|
|
26
|
+
export { Migration20260611T140410PromptActionsInit, };
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|