@mobile-reality/mdma-cli 0.1.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/app-dist/assets/index-Bi8tXvnb.js +646 -0
- package/app-dist/index.html +12 -0
- package/dist/bin/mdma.d.ts +3 -0
- package/dist/bin/mdma.d.ts.map +1 -0
- package/dist/bin/mdma.js +23 -0
- package/dist/bin/mdma.js.map +1 -0
- package/dist/commands/create.d.ts +6 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +12 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/validate.d.ts +7 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +68 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts/master-prompt.d.ts +12 -0
- package/dist/prompts/master-prompt.d.ts.map +1 -0
- package/dist/prompts/master-prompt.js +196 -0
- package/dist/prompts/master-prompt.js.map +1 -0
- package/dist/prompts/serialize-config.d.ts +3 -0
- package/dist/prompts/serialize-config.d.ts.map +1 -0
- package/dist/prompts/serialize-config.js +53 -0
- package/dist/prompts/serialize-config.js.map +1 -0
- package/dist/prompts/types.d.ts +42 -0
- package/dist/prompts/types.d.ts.map +1 -0
- package/dist/prompts/types.js +2 -0
- package/dist/prompts/types.js.map +1 -0
- package/dist/server/dev-server.d.ts +2 -0
- package/dist/server/dev-server.d.ts.map +1 -0
- package/dist/server/dev-server.js +18 -0
- package/dist/server/dev-server.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<title>MDMA Prompt Builder</title>
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-Bi8tXvnb.js"></script>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
</body>
|
|
12
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdma.d.ts","sourceRoot":"","sources":["../../src/bin/mdma.ts"],"names":[],"mappings":""}
|
package/dist/bin/mdma.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { createCommand } from '../commands/create.js';
|
|
4
|
+
import { validateCommand } from '../commands/validate.js';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name('mdma')
|
|
8
|
+
.version('0.1.0')
|
|
9
|
+
.description('MDMA CLI — prompt builder and document validator');
|
|
10
|
+
program
|
|
11
|
+
.command('create', { isDefault: true })
|
|
12
|
+
.description('Open the prompt builder web app')
|
|
13
|
+
.option('-p, --port <port>', 'Port to run the web app on')
|
|
14
|
+
.action(createCommand);
|
|
15
|
+
program
|
|
16
|
+
.command('validate <patterns...>')
|
|
17
|
+
.description('Validate MDMA document(s)')
|
|
18
|
+
.option('--fix', 'Apply auto-fixes', true)
|
|
19
|
+
.option('--no-fix', 'Disable auto-fixes')
|
|
20
|
+
.option('--json', 'Output results as JSON', false)
|
|
21
|
+
.action(validateCommand);
|
|
22
|
+
program.parse();
|
|
23
|
+
//# sourceMappingURL=mdma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdma.js","sourceRoot":"","sources":["../../src/bin/mdma.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,MAAM,CAAC;KACZ,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,kDAAkD,CAAC,CAAC;AAEnE,OAAO;KACJ,OAAO,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;KACtC,WAAW,CAAC,iCAAiC,CAAC;KAC9C,MAAM,CAAC,mBAAmB,EAAE,4BAA4B,CAAC;KACzD,MAAM,CAAC,aAAa,CAAC,CAAC;AAEzB,OAAO;KACJ,OAAO,CAAC,wBAAwB,CAAC;KACjC,WAAW,CAAC,2BAA2B,CAAC;KACxC,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,IAAI,CAAC;KACzC,MAAM,CAAC,UAAU,EAAE,oBAAoB,CAAC;KACxC,MAAM,CAAC,QAAQ,EAAE,wBAAwB,EAAE,KAAK,CAAC;KACjD,MAAM,CAAC,eAAe,CAAC,CAAC;AAE3B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAIA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAUzE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import getPort from 'get-port';
|
|
3
|
+
import { startDevServer } from '../server/dev-server.js';
|
|
4
|
+
export async function createCommand(options) {
|
|
5
|
+
const port = options.port ? Number.parseInt(options.port, 10) : await getPort({ port: 4200 });
|
|
6
|
+
console.log(chalk.bold('\n MDMA Prompt Builder\n'));
|
|
7
|
+
console.log(chalk.dim(' Starting web app...\n'));
|
|
8
|
+
await startDevServer(port);
|
|
9
|
+
console.log(chalk.green(`\n Ready at http://localhost:${port}\n`));
|
|
10
|
+
console.log(chalk.dim(' Press Ctrl+C to stop.\n'));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAMzD,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAE9F,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,CAAC;IAElD,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;IAE3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,iCAAiC,IAAI,IAAI,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAMA,UAAU,eAAe;IACvB,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAoCD,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CA0Cf"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { globby } from 'globby';
|
|
4
|
+
import { validate } from '@mobile-reality/mdma-validator';
|
|
5
|
+
function severityColor(severity) {
|
|
6
|
+
switch (severity) {
|
|
7
|
+
case 'error':
|
|
8
|
+
return chalk.red;
|
|
9
|
+
case 'warning':
|
|
10
|
+
return chalk.yellow;
|
|
11
|
+
case 'info':
|
|
12
|
+
return chalk.blue;
|
|
13
|
+
default:
|
|
14
|
+
return chalk.white;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function formatIssue(issue) {
|
|
18
|
+
const color = severityColor(issue.severity);
|
|
19
|
+
const location = issue.componentId ? `[${issue.componentId}]` : `[block ${issue.blockIndex}]`;
|
|
20
|
+
const field = issue.field ? `.${issue.field}` : '';
|
|
21
|
+
const fixed = issue.fixed ? chalk.green(' (fixed)') : '';
|
|
22
|
+
return ` ${color(issue.severity.padEnd(7))} ${chalk.dim(location + field)} ${issue.message}${fixed}`;
|
|
23
|
+
}
|
|
24
|
+
function printResult(file, result) {
|
|
25
|
+
const status = result.ok ? chalk.green('PASS') : chalk.red('FAIL');
|
|
26
|
+
console.log(`\n${status} ${chalk.bold(file)}`);
|
|
27
|
+
for (const issue of result.issues) {
|
|
28
|
+
console.log(formatIssue(issue));
|
|
29
|
+
}
|
|
30
|
+
if (result.fixCount > 0) {
|
|
31
|
+
console.log(chalk.green(` ${result.fixCount} issue(s) auto-fixed`));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function validateCommand(patterns, options) {
|
|
35
|
+
const files = await globby(patterns, { expandDirectories: { extensions: ['md'] } });
|
|
36
|
+
if (files.length === 0) {
|
|
37
|
+
console.log(chalk.yellow('No files matched the given pattern(s).'));
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
let totalErrors = 0;
|
|
41
|
+
let totalWarnings = 0;
|
|
42
|
+
let totalFixed = 0;
|
|
43
|
+
const allResults = {};
|
|
44
|
+
for (const file of files) {
|
|
45
|
+
const markdown = fs.readFileSync(file, 'utf-8');
|
|
46
|
+
const result = validate(markdown, { autoFix: options.fix });
|
|
47
|
+
allResults[file] = result;
|
|
48
|
+
totalErrors += result.summary.errors;
|
|
49
|
+
totalWarnings += result.summary.warnings;
|
|
50
|
+
totalFixed += result.fixCount;
|
|
51
|
+
if (options.fix && result.fixCount > 0 && result.output !== markdown) {
|
|
52
|
+
fs.writeFileSync(file, result.output, 'utf-8');
|
|
53
|
+
}
|
|
54
|
+
if (!options.json) {
|
|
55
|
+
printResult(file, result);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (options.json) {
|
|
59
|
+
console.log(JSON.stringify(allResults, null, 2));
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log(`\n${chalk.bold(`${files.length} file(s) validated`)}: ${chalk.red(`${totalErrors} errors`)}, ${chalk.yellow(`${totalWarnings} warnings`)}, ${chalk.green(`${totalFixed} fixed`)}`);
|
|
63
|
+
}
|
|
64
|
+
if (totalErrors > 0) {
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAQ1D,SAAS,aAAa,CAAC,QAAgB;IACrC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,KAAK,CAAC,GAAG,CAAC;QACnB,KAAK,SAAS;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AC,GAAG,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACrE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CACT,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,oBAAoB,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,WAAW,SAAS,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,aAAa,WAAW,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,UAAU,QAAQ,CAAC,EAAE,CACnL,CAAC;IACJ,CAAC;IAED,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createCommand } from './commands/create.js';
|
|
2
|
+
export { validateCommand } from './commands/validate.js';
|
|
3
|
+
export { MASTER_PROMPT } from './prompts/master-prompt.js';
|
|
4
|
+
export { serializeConfig } from './prompts/serialize-config.js';
|
|
5
|
+
export type { ComponentType, FormFieldConfig, ApprovalConfig, TasklistConfig, TableConfig, ComponentConfig, TriggerMode, DomainConfig, } from './prompts/types.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,YAAY,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,cAAc,EACd,WAAW,EACX,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createCommand } from './commands/create.js';
|
|
2
|
+
export { validateCommand } from './commands/validate.js';
|
|
3
|
+
export { MASTER_PROMPT } from './prompts/master-prompt.js';
|
|
4
|
+
export { serializeConfig } from './prompts/serialize-config.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Master Prompt — a meta-prompt that instructs an LLM to generate
|
|
3
|
+
* custom prompts for MDMA document authoring.
|
|
4
|
+
*
|
|
5
|
+
* The generated custom prompt is meant to be passed as the `customPrompt`
|
|
6
|
+
* parameter to `buildSystemPrompt({ customPrompt })` from @mobile-reality/mdma-prompt-pack.
|
|
7
|
+
* The MDMA_AUTHOR_PROMPT (full spec) is always prepended automatically — so
|
|
8
|
+
* the generated prompt should NOT repeat the spec, but instead layer
|
|
9
|
+
* domain-specific instructions on top.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MASTER_PROMPT = "You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.\n\n## Context\n\nMDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced `mdma` code blocks. **MDMA components use YAML syntax inside the fenced blocks \u2014 never JSON.** Users install MDMA libraries in their apps and use `buildSystemPrompt({ customPrompt })` to configure their AI chat. The `buildSystemPrompt` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the `customPrompt` that layers on top.\n\n**Your output will be concatenated AFTER the full MDMA spec.** Therefore you MUST NOT:\n- Repeat the MDMA component schemas (they're already in the spec)\n- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)\n- Include the self-check checklist (already provided)\n\n**You MUST:**\n- Define the domain context and purpose\n- Specify which components to use and when\n- Define **trigger rules** \u2014 exactly when the AI should generate MDMA components (e.g., specific user phrases, conversation milestones, or contextual conditions)\n- Provide domain-specific examples showing realistic content\n- Define business rules, validation constraints, and workflow logic\n- Specify which fields should be marked as sensitive\n- Define the expected document structure and flow\n\n## What You Receive\n\nThe user will provide a configuration describing their needs:\n- **Domain**: The business domain (e.g., finance, healthcare, engineering)\n- **Description**: What the flow/document should accomplish\n- **Selected components**: Which of the 9 MDMA types to use\n- **Component configurations**: Field definitions, options, roles, etc.\n- **Business rules**: Free-text constraints and requirements\n- **Trigger rules**: When the AI should generate MDMA components (user phrases, conversation moments)\n\n## Required Fields per Component\n\nWhen writing domain examples with `mdma` blocks, every block MUST include all required fields for its type. Missing required fields cause validation errors.\n\n| Component | Required fields (besides `id` and `type`) |\n|-----------------|--------------------------------------------------------------|\n| form | `fields` (array, each with `name`, `type`, `label`) |\n| callout | `content` |\n| button | `text` |\n| approval-gate | `title` |\n| tasklist | `items` (array, each with `id` and `text`) |\n| table | `columns` (array, each with `key` and `header`), `data` |\n| chart | `data` (pipe string: `\"Header1, Header2\\nVal1, Val2\"`) |\n| webhook | `url`, `trigger` |\n| thinking | `content` |\n\nSelect fields use `options` as an array of objects: `- label: \"Display\" value: key`, NOT flat strings.\nApproval gates use `allowedRoles` (NOT `roles`) for role restrictions.\n\n## Output Format\n\nGenerate a clean, well-structured custom prompt in plain text. Structure it as:\n\n1. **Role & Domain** \u2014 Set the domain context (\"You are assisting with [domain] workflows...\")\n2. **When to Generate** \u2014 Define the trigger rules: specific keywords/phrases the user might say, or conversation conditions that should activate MDMA component generation. Be explicit \u2014 the AI needs clear signals for when to respond with interactive components vs. plain text.\n3. **Document Purpose** \u2014 What the generated document should achieve\n4. **Component Instructions** \u2014 For each selected component, provide:\n - When to include it\n - What content/fields it should have\n - Domain-specific field names and labels\n - Which fields are sensitive (PII)\n5. **Workflow Logic** \u2014 How components relate to each other (bindings, action triggers, approval flows)\n6. **Domain Examples** \u2014 1-2 concrete examples showing what a generated MDMA document section should look like. Examples MUST use **YAML syntax** inside fenced `mdma` code blocks (never JSON). Every example block MUST include all required fields for its component type \u2014 omitting required fields is a validation error.\n7. **Constraints** \u2014 Things the AI must or must not do in this domain\n\n## Example\n\nGiven a configuration for a KYC (Know Your Customer) flow in finance with form, approval-gate, and tasklist components, you would generate:\n\n---\n\nYou are assisting with KYC (Know Your Customer) verification workflows in the financial services domain.\n\n### Document Purpose\nGenerate interactive KYC case review documents that collect applicant information, enforce compliance checks, and require dual approval before account activation.\n\n### Components to Use\n\n**Form \u2014 Applicant Information**\n- Include fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone\n- Mark as sensitive: government ID number, date of birth, residential address, email, phone\n- All fields required except phone\n- Use a select field for ID type with standard document options\n\n**Approval Gate \u2014 Compliance Review**\n- Require 2 approvers with roles: compliance-officer, senior-analyst\n- Require a reason on denial\n- Title should reflect the review stage (e.g., \"KYC Compliance Approval\")\n\n**Tasklist \u2014 Verification Checklist**\n- Items: identity document verified, address proof verified, PEP screening completed, sanctions list checked, source of funds verified\n- All items required\n\n### Workflow\n- The approval gate should follow the form (approvers review submitted data)\n- The tasklist tracks verification steps that must be completed before approval\n- Include a callout with variant \"warning\" if the case involves a PEP (Politically Exposed Person)\n\n### Domain Example\n\nHere is an example of a correctly structured MDMA document section for a KYC review:\n\n````\n## KYC Case Review\n\nPlease complete the applicant information below:\n\n```mdma\ntype: form\nid: kyc-applicant-form\nfields:\n - name: full_name\n type: text\n label: Full Legal Name\n required: true\n - name: date_of_birth\n type: date\n label: Date of Birth\n required: true\n sensitive: true\n - name: nationality\n type: text\n label: Nationality\n required: true\n - name: id_type\n type: select\n label: ID Document Type\n required: true\n options:\n - label: Passport\n value: passport\n - label: \"Driver's License\"\n value: drivers-license\n - label: National ID\n value: national-id\n - name: id_number\n type: text\n label: Government ID Number\n required: true\n sensitive: true\n```\n\n```mdma\ntype: approval-gate\nid: kyc-compliance-approval\ntitle: KYC Compliance Approval\nallowedRoles:\n - compliance-officer\n - senior-analyst\nrequiredApprovers: 2\nrequireReason: true\n```\n\n```mdma\ntype: callout\nid: pep-warning\nvariant: warning\ntitle: PEP Flag Detected\ncontent: \"This applicant has been flagged as a Politically Exposed Person (PEP). Enhanced due diligence is required before approval.\"\ndismissible: false\n```\n````\n\n### Constraints\n- Always include a thinking block analyzing the case complexity\n- Never display raw ID numbers in the document text\n- Use formal, compliance-appropriate language\n\n---\n\n## CRITICAL: Component Scope Rule\n\n**ONLY include components that appear under \"Selected Components\" in the user's configuration.** The description and business rules may mention other component types as context \u2014 IGNORE THEM. If the user selected only \"form\" and \"thinking\", your output must ONLY contain instructions and examples for form and thinking. Do not add approval-gate, tasklist, webhook, button, table, chart, or callout unless they are explicitly listed under \"Selected Components\".\n\nThis is the most important rule. Violating it produces a broken prompt that generates unwanted components.\n\n## Important Rules\n\n1. **Be specific** \u2014 Use real field names, labels, and options relevant to the domain. Don't use generic placeholders.\n2. **Strict component scope** \u2014 NEVER include components not listed under \"Selected Components\". The description and business rules provide context, not a component wishlist. If a business rule mentions \"approval required\" but approval-gate is not in Selected Components, reference the rule in prose but do NOT add an approval-gate component.\n3. **Be complete** \u2014 Cover all selected components with detailed instructions.\n4. **Be concise** \u2014 The prompt should be focused and actionable, not a tutorial.\n5. **Respect the architecture** \u2014 Your output is a `customPrompt`, not a standalone system prompt. Never include MDMA spec details that are already in the base prompt.\n6. **Use YAML, never JSON** \u2014 All domain examples with fenced `mdma` code blocks MUST use YAML syntax. MDMA components are always defined in YAML. Never use JSON objects like `{\"type\": \"form\", ...}` in examples.\n";
|
|
12
|
+
//# sourceMappingURL=master-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"master-prompt.d.ts","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,ouSAwLzB,CAAC"}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Master Prompt — a meta-prompt that instructs an LLM to generate
|
|
3
|
+
* custom prompts for MDMA document authoring.
|
|
4
|
+
*
|
|
5
|
+
* The generated custom prompt is meant to be passed as the `customPrompt`
|
|
6
|
+
* parameter to `buildSystemPrompt({ customPrompt })` from @mobile-reality/mdma-prompt-pack.
|
|
7
|
+
* The MDMA_AUTHOR_PROMPT (full spec) is always prepended automatically — so
|
|
8
|
+
* the generated prompt should NOT repeat the spec, but instead layer
|
|
9
|
+
* domain-specific instructions on top.
|
|
10
|
+
*/
|
|
11
|
+
export const MASTER_PROMPT = `You are an expert MDMA prompt engineer. Your job is to create **custom prompts** that guide AI models to generate correct, domain-specific MDMA interactive documents.
|
|
12
|
+
|
|
13
|
+
## Context
|
|
14
|
+
|
|
15
|
+
MDMA (Markdown Document with Mounted Applications) extends Markdown with interactive components defined in fenced \`mdma\` code blocks. **MDMA components use YAML syntax inside the fenced blocks — never JSON.** Users install MDMA libraries in their apps and use \`buildSystemPrompt({ customPrompt })\` to configure their AI chat. The \`buildSystemPrompt\` function automatically prepends the full MDMA specification (all component types, binding syntax, authoring rules). Your output is the \`customPrompt\` that layers on top.
|
|
16
|
+
|
|
17
|
+
**Your output will be concatenated AFTER the full MDMA spec.** Therefore you MUST NOT:
|
|
18
|
+
- Repeat the MDMA component schemas (they're already in the spec)
|
|
19
|
+
- Repeat the base authoring rules (unique IDs, sensitive flags, etc.)
|
|
20
|
+
- Include the self-check checklist (already provided)
|
|
21
|
+
|
|
22
|
+
**You MUST:**
|
|
23
|
+
- Define the domain context and purpose
|
|
24
|
+
- Specify which components to use and when
|
|
25
|
+
- Define **trigger rules** — exactly when the AI should generate MDMA components (e.g., specific user phrases, conversation milestones, or contextual conditions)
|
|
26
|
+
- Provide domain-specific examples showing realistic content
|
|
27
|
+
- Define business rules, validation constraints, and workflow logic
|
|
28
|
+
- Specify which fields should be marked as sensitive
|
|
29
|
+
- Define the expected document structure and flow
|
|
30
|
+
|
|
31
|
+
## What You Receive
|
|
32
|
+
|
|
33
|
+
The user will provide a configuration describing their needs:
|
|
34
|
+
- **Domain**: The business domain (e.g., finance, healthcare, engineering)
|
|
35
|
+
- **Description**: What the flow/document should accomplish
|
|
36
|
+
- **Selected components**: Which of the 9 MDMA types to use
|
|
37
|
+
- **Component configurations**: Field definitions, options, roles, etc.
|
|
38
|
+
- **Business rules**: Free-text constraints and requirements
|
|
39
|
+
- **Trigger rules**: When the AI should generate MDMA components (user phrases, conversation moments)
|
|
40
|
+
|
|
41
|
+
## Required Fields per Component
|
|
42
|
+
|
|
43
|
+
When writing domain examples with \`mdma\` blocks, every block MUST include all required fields for its type. Missing required fields cause validation errors.
|
|
44
|
+
|
|
45
|
+
| Component | Required fields (besides \`id\` and \`type\`) |
|
|
46
|
+
|-----------------|--------------------------------------------------------------|
|
|
47
|
+
| form | \`fields\` (array, each with \`name\`, \`type\`, \`label\`) |
|
|
48
|
+
| callout | \`content\` |
|
|
49
|
+
| button | \`text\` |
|
|
50
|
+
| approval-gate | \`title\` |
|
|
51
|
+
| tasklist | \`items\` (array, each with \`id\` and \`text\`) |
|
|
52
|
+
| table | \`columns\` (array, each with \`key\` and \`header\`), \`data\` |
|
|
53
|
+
| chart | \`data\` (pipe string: \`"Header1, Header2\\nVal1, Val2"\`) |
|
|
54
|
+
| webhook | \`url\`, \`trigger\` |
|
|
55
|
+
| thinking | \`content\` |
|
|
56
|
+
|
|
57
|
+
Select fields use \`options\` as an array of objects: \`- label: "Display" value: key\`, NOT flat strings.
|
|
58
|
+
Approval gates use \`allowedRoles\` (NOT \`roles\`) for role restrictions.
|
|
59
|
+
|
|
60
|
+
## Output Format
|
|
61
|
+
|
|
62
|
+
Generate a clean, well-structured custom prompt in plain text. Structure it as:
|
|
63
|
+
|
|
64
|
+
1. **Role & Domain** — Set the domain context ("You are assisting with [domain] workflows...")
|
|
65
|
+
2. **When to Generate** — Define the trigger rules: specific keywords/phrases the user might say, or conversation conditions that should activate MDMA component generation. Be explicit — the AI needs clear signals for when to respond with interactive components vs. plain text.
|
|
66
|
+
3. **Document Purpose** — What the generated document should achieve
|
|
67
|
+
4. **Component Instructions** — For each selected component, provide:
|
|
68
|
+
- When to include it
|
|
69
|
+
- What content/fields it should have
|
|
70
|
+
- Domain-specific field names and labels
|
|
71
|
+
- Which fields are sensitive (PII)
|
|
72
|
+
5. **Workflow Logic** — How components relate to each other (bindings, action triggers, approval flows)
|
|
73
|
+
6. **Domain Examples** — 1-2 concrete examples showing what a generated MDMA document section should look like. Examples MUST use **YAML syntax** inside fenced \`mdma\` code blocks (never JSON). Every example block MUST include all required fields for its component type — omitting required fields is a validation error.
|
|
74
|
+
7. **Constraints** — Things the AI must or must not do in this domain
|
|
75
|
+
|
|
76
|
+
## Example
|
|
77
|
+
|
|
78
|
+
Given a configuration for a KYC (Know Your Customer) flow in finance with form, approval-gate, and tasklist components, you would generate:
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
You are assisting with KYC (Know Your Customer) verification workflows in the financial services domain.
|
|
83
|
+
|
|
84
|
+
### Document Purpose
|
|
85
|
+
Generate interactive KYC case review documents that collect applicant information, enforce compliance checks, and require dual approval before account activation.
|
|
86
|
+
|
|
87
|
+
### Components to Use
|
|
88
|
+
|
|
89
|
+
**Form — Applicant Information**
|
|
90
|
+
- Include fields: full name, date of birth, nationality, government ID number, ID type (passport/driver's license/national ID), residential address, email, phone
|
|
91
|
+
- Mark as sensitive: government ID number, date of birth, residential address, email, phone
|
|
92
|
+
- All fields required except phone
|
|
93
|
+
- Use a select field for ID type with standard document options
|
|
94
|
+
|
|
95
|
+
**Approval Gate — Compliance Review**
|
|
96
|
+
- Require 2 approvers with roles: compliance-officer, senior-analyst
|
|
97
|
+
- Require a reason on denial
|
|
98
|
+
- Title should reflect the review stage (e.g., "KYC Compliance Approval")
|
|
99
|
+
|
|
100
|
+
**Tasklist — Verification Checklist**
|
|
101
|
+
- Items: identity document verified, address proof verified, PEP screening completed, sanctions list checked, source of funds verified
|
|
102
|
+
- All items required
|
|
103
|
+
|
|
104
|
+
### Workflow
|
|
105
|
+
- The approval gate should follow the form (approvers review submitted data)
|
|
106
|
+
- The tasklist tracks verification steps that must be completed before approval
|
|
107
|
+
- Include a callout with variant "warning" if the case involves a PEP (Politically Exposed Person)
|
|
108
|
+
|
|
109
|
+
### Domain Example
|
|
110
|
+
|
|
111
|
+
Here is an example of a correctly structured MDMA document section for a KYC review:
|
|
112
|
+
|
|
113
|
+
\`\`\`\`
|
|
114
|
+
## KYC Case Review
|
|
115
|
+
|
|
116
|
+
Please complete the applicant information below:
|
|
117
|
+
|
|
118
|
+
\`\`\`mdma
|
|
119
|
+
type: form
|
|
120
|
+
id: kyc-applicant-form
|
|
121
|
+
fields:
|
|
122
|
+
- name: full_name
|
|
123
|
+
type: text
|
|
124
|
+
label: Full Legal Name
|
|
125
|
+
required: true
|
|
126
|
+
- name: date_of_birth
|
|
127
|
+
type: date
|
|
128
|
+
label: Date of Birth
|
|
129
|
+
required: true
|
|
130
|
+
sensitive: true
|
|
131
|
+
- name: nationality
|
|
132
|
+
type: text
|
|
133
|
+
label: Nationality
|
|
134
|
+
required: true
|
|
135
|
+
- name: id_type
|
|
136
|
+
type: select
|
|
137
|
+
label: ID Document Type
|
|
138
|
+
required: true
|
|
139
|
+
options:
|
|
140
|
+
- label: Passport
|
|
141
|
+
value: passport
|
|
142
|
+
- label: "Driver's License"
|
|
143
|
+
value: drivers-license
|
|
144
|
+
- label: National ID
|
|
145
|
+
value: national-id
|
|
146
|
+
- name: id_number
|
|
147
|
+
type: text
|
|
148
|
+
label: Government ID Number
|
|
149
|
+
required: true
|
|
150
|
+
sensitive: true
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
\`\`\`mdma
|
|
154
|
+
type: approval-gate
|
|
155
|
+
id: kyc-compliance-approval
|
|
156
|
+
title: KYC Compliance Approval
|
|
157
|
+
allowedRoles:
|
|
158
|
+
- compliance-officer
|
|
159
|
+
- senior-analyst
|
|
160
|
+
requiredApprovers: 2
|
|
161
|
+
requireReason: true
|
|
162
|
+
\`\`\`
|
|
163
|
+
|
|
164
|
+
\`\`\`mdma
|
|
165
|
+
type: callout
|
|
166
|
+
id: pep-warning
|
|
167
|
+
variant: warning
|
|
168
|
+
title: PEP Flag Detected
|
|
169
|
+
content: "This applicant has been flagged as a Politically Exposed Person (PEP). Enhanced due diligence is required before approval."
|
|
170
|
+
dismissible: false
|
|
171
|
+
\`\`\`
|
|
172
|
+
\`\`\`\`
|
|
173
|
+
|
|
174
|
+
### Constraints
|
|
175
|
+
- Always include a thinking block analyzing the case complexity
|
|
176
|
+
- Never display raw ID numbers in the document text
|
|
177
|
+
- Use formal, compliance-appropriate language
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## CRITICAL: Component Scope Rule
|
|
182
|
+
|
|
183
|
+
**ONLY include components that appear under "Selected Components" in the user's configuration.** The description and business rules may mention other component types as context — IGNORE THEM. If the user selected only "form" and "thinking", your output must ONLY contain instructions and examples for form and thinking. Do not add approval-gate, tasklist, webhook, button, table, chart, or callout unless they are explicitly listed under "Selected Components".
|
|
184
|
+
|
|
185
|
+
This is the most important rule. Violating it produces a broken prompt that generates unwanted components.
|
|
186
|
+
|
|
187
|
+
## Important Rules
|
|
188
|
+
|
|
189
|
+
1. **Be specific** — Use real field names, labels, and options relevant to the domain. Don't use generic placeholders.
|
|
190
|
+
2. **Strict component scope** — NEVER include components not listed under "Selected Components". The description and business rules provide context, not a component wishlist. If a business rule mentions "approval required" but approval-gate is not in Selected Components, reference the rule in prose but do NOT add an approval-gate component.
|
|
191
|
+
3. **Be complete** — Cover all selected components with detailed instructions.
|
|
192
|
+
4. **Be concise** — The prompt should be focused and actionable, not a tutorial.
|
|
193
|
+
5. **Respect the architecture** — Your output is a \`customPrompt\`, not a standalone system prompt. Never include MDMA spec details that are already in the base prompt.
|
|
194
|
+
6. **Use YAML, never JSON** — All domain examples with fenced \`mdma\` code blocks MUST use YAML syntax. MDMA components are always defined in YAML. Never use JSON objects like \`{"type": "form", ...}\` in examples.
|
|
195
|
+
`;
|
|
196
|
+
//# sourceMappingURL=master-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"master-prompt.js","sourceRoot":"","sources":["../../src/prompts/master-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwL5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize-config.d.ts","sourceRoot":"","sources":["../../src/prompts/serialize-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhE,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,MAAM,CA2D3F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function serializeConfig(domain, components) {
|
|
2
|
+
const enabled = components.filter((c) => c.enabled);
|
|
3
|
+
const lines = [
|
|
4
|
+
`## User Configuration`,
|
|
5
|
+
``,
|
|
6
|
+
`**Flow Name:** ${domain.name || '(not set)'}`,
|
|
7
|
+
`**Domain:** ${domain.domain || '(not set)'}`,
|
|
8
|
+
`**Description:** ${domain.description || '(not set)'}`,
|
|
9
|
+
];
|
|
10
|
+
if (domain.businessRules) {
|
|
11
|
+
lines.push(`**Business Rules:** ${domain.businessRules}`);
|
|
12
|
+
}
|
|
13
|
+
if (domain.triggerMode === 'immediate') {
|
|
14
|
+
lines.push('**When to Display Components:** Immediately when the conversation starts — always respond with MDMA components in the first message.');
|
|
15
|
+
}
|
|
16
|
+
else if (domain.triggerMode === 'keyword' && domain.trigger) {
|
|
17
|
+
lines.push(`**When to Display Components:** When the user says one of these keywords or phrases: ${domain.trigger}. Only generate MDMA components when triggered by these phrases, otherwise respond with plain text.`);
|
|
18
|
+
}
|
|
19
|
+
else if (domain.triggerMode === 'contextual' && domain.trigger) {
|
|
20
|
+
lines.push(`**When to Display Components:** ${domain.trigger}`);
|
|
21
|
+
}
|
|
22
|
+
lines.push('', '**Selected Components:**', '');
|
|
23
|
+
for (const comp of enabled) {
|
|
24
|
+
lines.push(`### ${comp.type}`);
|
|
25
|
+
if (comp.type === 'form' && comp.form?.fields.length) {
|
|
26
|
+
lines.push('Fields:');
|
|
27
|
+
for (const f of comp.form.fields) {
|
|
28
|
+
lines.push(`- ${f.name} (${f.type}, label: "${f.label}", required: ${f.required}, sensitive: ${f.sensitive})`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (comp.type === 'approval-gate' && comp.approvalGate) {
|
|
32
|
+
const ag = comp.approvalGate;
|
|
33
|
+
lines.push(`Roles: ${ag.roles.join(', ') || '(none)'}`);
|
|
34
|
+
lines.push(`Required approvers: ${ag.requiredApprovers}`);
|
|
35
|
+
lines.push(`Require reason on denial: ${ag.requireReason}`);
|
|
36
|
+
}
|
|
37
|
+
if (comp.type === 'tasklist' && comp.tasklist?.items.length) {
|
|
38
|
+
lines.push('Items:');
|
|
39
|
+
for (const item of comp.tasklist.items) {
|
|
40
|
+
lines.push(`- ${item}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (comp.type === 'table' && comp.table?.columns.length) {
|
|
44
|
+
lines.push('Columns:');
|
|
45
|
+
for (const col of comp.table.columns) {
|
|
46
|
+
lines.push(`- ${col.key}: "${col.header}"`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
lines.push('');
|
|
50
|
+
}
|
|
51
|
+
return lines.join('\n');
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=serialize-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize-config.js","sourceRoot":"","sources":["../../src/prompts/serialize-config.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAC,MAAoB,EAAE,UAA6B;IACjF,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACpD,MAAM,KAAK,GAAa;QACtB,uBAAuB;QACvB,EAAE;QACF,kBAAkB,MAAM,CAAC,IAAI,IAAI,WAAW,EAAE;QAC9C,eAAe,MAAM,CAAC,MAAM,IAAI,WAAW,EAAE;QAC7C,oBAAoB,MAAM,CAAC,WAAW,IAAI,WAAW,EAAE;KACxD,CAAC;IAEF,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;QACzB,KAAK,CAAC,IAAI,CAAC,uBAAuB,MAAM,CAAC,aA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C7B,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC;YACxD,KAAK,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC,iBAAiB,EAAE,CAAC,CAAC;YAC1D,KAAK,CAAC,IAAI,CAAC,6BAA6B,EAAE,CAAC,aAAa,EAAE,CAAC,CAAC;QAC9D,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5D,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACrB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;gBACvC,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;YACxD,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACvB,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;gBACrC,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;YAC9C,CAAC;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type ComponentType = 'form' | 'button' | 'tasklist' | 'table' | 'callout' | 'approval-gate' | 'webhook' | 'chart' | 'thinking';
|
|
2
|
+
export interface FormFieldConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
type: 'text' | 'number' | 'email' | 'date' | 'select' | 'checkbox' | 'textarea';
|
|
5
|
+
label: string;
|
|
6
|
+
required: boolean;
|
|
7
|
+
sensitive: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ApprovalConfig {
|
|
10
|
+
roles: string[];
|
|
11
|
+
requiredApprovers: number;
|
|
12
|
+
requireReason: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface TasklistConfig {
|
|
15
|
+
items: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface TableConfig {
|
|
18
|
+
columns: {
|
|
19
|
+
key: string;
|
|
20
|
+
header: string;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
export interface ComponentConfig {
|
|
24
|
+
type: ComponentType;
|
|
25
|
+
enabled: boolean;
|
|
26
|
+
form?: {
|
|
27
|
+
fields: FormFieldConfig[];
|
|
28
|
+
};
|
|
29
|
+
approvalGate?: ApprovalConfig;
|
|
30
|
+
tasklist?: TasklistConfig;
|
|
31
|
+
table?: TableConfig;
|
|
32
|
+
}
|
|
33
|
+
export type TriggerMode = 'keyword' | 'immediate' | 'contextual';
|
|
34
|
+
export interface DomainConfig {
|
|
35
|
+
name: string;
|
|
36
|
+
domain: string;
|
|
37
|
+
description: string;
|
|
38
|
+
businessRules: string;
|
|
39
|
+
triggerMode: TriggerMode;
|
|
40
|
+
trigger: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,QAAQ,GACR,UAAU,GACV,OAAO,GACP,SAAS,GACT,eAAe,GACf,SAAS,GACT,OAAO,GACP,UAAU,CAAC;AAEf,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,CAAC;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,eAAe,EAAE,CAAA;KAAE,CAAC;IACrC,YAAY,CAAC,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.d.ts","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAMA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createServer } from 'vite';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
export async function startDevServer(port) {
|
|
6
|
+
const appRoot = path.resolve(__dirname, '../../app');
|
|
7
|
+
const server = await createServer({
|
|
8
|
+
root: appRoot,
|
|
9
|
+
configFile: path.resolve(appRoot, 'vite.config.ts'),
|
|
10
|
+
server: {
|
|
11
|
+
port,
|
|
12
|
+
open: true,
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
await server.listen();
|
|
16
|
+
server.printUrls();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=dev-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","sourceRoot":"","sources":["../../src/server/dev-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAErD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC;QAChC,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,gBAAgB,CAAC;QACnD,MAAM,EAAE;YACN,IAAI;YACJ,IAAI,EAAE,IAAI;SACX;KACF,CAAC,CAAC;IAEH,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;IACtB,MAAM,CAAC,SAAS,EAAE,CAAC;AACrB,CAAC"}
|