@ema.co/mcp-toolkit 2026.1.25 → 2026.1.26-4
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.
Potentially problematic release.
This version of @ema.co/mcp-toolkit might be problematic. Click here for more details.
- package/README.md +10 -2
- package/dist/mcp/handlers/action/index.js +3 -18
- package/dist/mcp/handlers/data/index.js +385 -41
- package/dist/mcp/handlers/data/templates.js +107 -0
- package/dist/mcp/handlers/deprecation.js +50 -0
- package/dist/mcp/handlers/env/index.js +8 -4
- package/dist/mcp/handlers/knowledge/index.js +44 -237
- package/dist/mcp/handlers/persona/create.js +47 -18
- package/dist/mcp/handlers/persona/index.js +14 -11
- package/dist/mcp/handlers/persona/update.js +4 -2
- package/dist/mcp/handlers/persona/version.js +234 -0
- package/dist/mcp/handlers/sync/index.js +3 -18
- package/dist/mcp/handlers/template/index.js +75 -10
- package/dist/mcp/handlers/workflow/analyze.js +171 -0
- package/dist/mcp/handlers/workflow/compare.js +70 -0
- package/dist/mcp/handlers/workflow/deploy.js +73 -0
- package/dist/mcp/handlers/workflow/generate.js +350 -0
- package/dist/mcp/handlers/workflow/index.js +294 -0
- package/dist/mcp/handlers/workflow/modify.js +456 -0
- package/dist/mcp/handlers/workflow/optimize.js +136 -0
- package/dist/mcp/handlers/workflow/types.js +4 -0
- package/dist/mcp/handlers/workflow/utils.js +30 -0
- package/dist/mcp/handlers-consolidated.js +73 -2696
- package/dist/mcp/prompts.js +83 -43
- package/dist/mcp/resources.js +382 -57
- package/dist/mcp/server.js +199 -391
- package/dist/mcp/{tools-v2.js → tools.js} +20 -54
- package/dist/mcp/workflow-operations.js +2 -2
- package/dist/sdk/client-adapter.js +267 -32
- package/dist/sdk/client.js +45 -16
- package/dist/sdk/ema-client.js +183 -0
- package/dist/sdk/generated/deprecated-actions.js +171 -0
- package/dist/sdk/generated/template-fallbacks.js +123 -0
- package/dist/sdk/guidance.js +65 -11
- package/dist/sdk/index.js +3 -1
- package/dist/sdk/knowledge.js +139 -86
- package/dist/sdk/workflow-intent.js +27 -0
- package/dist/sdk/workflow-transformer.js +0 -342
- package/docs/mcp-tools-guide.md +37 -45
- package/package.json +10 -4
- package/dist/mcp/handlers/persona/analyze.js +0 -275
- package/dist/mcp/handlers/persona/compare.js +0 -32
- package/dist/mcp/tools-consolidated.js +0 -875
- package/dist/mcp/tools-legacy.js +0 -736
- package/docs/CODEBASE-ANALYSIS-2026-01-23.md +0 -936
- package/docs/CODEBASE-ANALYSIS-PRIORITIZED.md +0 -774
- package/docs/api-contracts.md +0 -216
- package/docs/auto-builder-analysis.md +0 -271
- package/docs/blog/mcp-tool-design-lessons.md +0 -309
- package/docs/data-architecture.md +0 -166
- package/docs/demos/ap-invoice-generation.md +0 -347
- package/docs/demos/ap-invoice-processing.md +0 -271
- package/docs/ema-auto-builder-guide.html +0 -394
- package/docs/lessons-learned.md +0 -209
- package/docs/llm-native-workflow-design.md +0 -252
- package/docs/local-generation.md +0 -508
- package/docs/mcp-flow-diagram.md +0 -135
- package/docs/migration/action-composition-migration.md +0 -270
- package/docs/naming-conventions.md +0 -278
- package/docs/proposals/HANDOFF-tool-restructure.md +0 -526
- package/docs/proposals/action-composition.md +0 -490
- package/docs/proposals/explicit-method-restructure.md +0 -328
- package/docs/proposals/mcp-tool-restructure-2026-01.md +0 -366
- package/docs/proposals/self-contained-guidance.md +0 -427
- package/docs/proto-sdk-generation.md +0 -242
- package/docs/release-impact.md +0 -102
- package/docs/release-process.md +0 -157
- package/docs/staging.RULE.md +0 -142
- package/docs/test-persona-creation.md +0 -196
- package/docs/tool-consolidation-v2.md +0 -225
- package/docs/tool-response-standards.md +0 -256
- package/resources/demo-kits/README.md +0 -175
- package/resources/demo-kits/finance-ap/manifest.json +0 -150
- package/resources/demo-kits/tags.json +0 -91
- package/resources/docs/getting-started.md +0 -97
- package/resources/templates/auto-builder-rules.md +0 -224
- package/resources/templates/chat-ai/README.md +0 -119
- package/resources/templates/chat-ai/persona-config.json +0 -111
- package/resources/templates/dashboard-ai/README.md +0 -156
- package/resources/templates/dashboard-ai/persona-config.json +0 -180
- package/resources/templates/demo-scenarios/README.md +0 -63
- package/resources/templates/demo-scenarios/test-published-package.md +0 -116
- package/resources/templates/document-gen-ai/README.md +0 -132
- package/resources/templates/document-gen-ai/persona-config.json +0 -316
- package/resources/templates/voice-ai/README.md +0 -123
- package/resources/templates/voice-ai/persona-config.json +0 -74
- package/resources/templates/voice-ai/workflow-prompt.md +0 -121
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
# Action Composition Pattern
|
|
2
|
-
|
|
3
|
-
> **Status**: APPROVED - Ready for implementation
|
|
4
|
-
> **Date**: 2026-01-19
|
|
5
|
-
> **Branch**: `feat/mcp-tool-restructure`
|
|
6
|
-
|
|
7
|
-
## Summary
|
|
8
|
-
|
|
9
|
-
Replace flag-based parameters with composable action arrays for multi-step operations.
|
|
10
|
-
|
|
11
|
-
## Problem: Flag-Based Parameters Encode Operations in Names
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
// Current: semantics encoded in parameter names
|
|
15
|
-
persona(
|
|
16
|
-
method="create",
|
|
17
|
-
from="source-id",
|
|
18
|
-
name="Demo Clone",
|
|
19
|
-
include_data=true, // ← "include" + "data" = copy operation
|
|
20
|
-
sanitize=true, // ← operation encoded in name
|
|
21
|
-
sanitize_examples=[...] // ← coupled to sanitize flag
|
|
22
|
-
)
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
**Issues:**
|
|
26
|
-
|
|
27
|
-
| Problem | Impact |
|
|
28
|
-
|---------|--------|
|
|
29
|
-
| **Name = Operation** | `include_data` implies "copy data" - hidden in name |
|
|
30
|
-
| **Coupled parameters** | `sanitize_examples` only valid when `sanitize=true` |
|
|
31
|
-
| **Schema bloat** | Every capability = new parameter |
|
|
32
|
-
| **Combinatorial explosion** | `include_data` × `sanitize` × `generate` × `link` |
|
|
33
|
-
| **Hidden order** | copy then sanitize? sanitize then copy? |
|
|
34
|
-
| **Extensibility** | New capability = new flag = schema change |
|
|
35
|
-
|
|
36
|
-
## Solution: Action Composition
|
|
37
|
-
|
|
38
|
-
```typescript
|
|
39
|
-
// Proposed: operations as composable actions
|
|
40
|
-
persona(
|
|
41
|
-
method="create",
|
|
42
|
-
from="source-id",
|
|
43
|
-
name="Demo Clone",
|
|
44
|
-
actions=[
|
|
45
|
-
{tool:"data", args:{method:"copy", from:"$source"}},
|
|
46
|
-
{tool:"data", args:{method:"sanitize", examples:["Acme Corp"]}},
|
|
47
|
-
{tool:"snapshot", args:{message:"Clone ready"}},
|
|
48
|
-
]
|
|
49
|
-
)
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
**Benefits:**
|
|
53
|
-
|
|
54
|
-
| Benefit | Description |
|
|
55
|
-
|---------|-------------|
|
|
56
|
-
| **Explicit operations** | `{tool:"data", args:{method:"copy"}}` not `include_data:true` |
|
|
57
|
-
| **Composable** | Mix/match/reorder any actions |
|
|
58
|
-
| **Self-contained** | Each action has its own params |
|
|
59
|
-
| **Order explicit** | Array order = execution order |
|
|
60
|
-
| **Schema stable** | New actions don't change persona schema |
|
|
61
|
-
| **Reuses tools** | Same schema as direct tool calls |
|
|
62
|
-
|
|
63
|
-
## Design
|
|
64
|
-
|
|
65
|
-
### Actions Property
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
persona.inputSchema.properties.actions = {
|
|
69
|
-
type: "array",
|
|
70
|
-
description: "Post-operation actions to execute in sequence",
|
|
71
|
-
items: {
|
|
72
|
-
oneOf: [
|
|
73
|
-
// Object form: explicit tool + args
|
|
74
|
-
{
|
|
75
|
-
type: "object",
|
|
76
|
-
properties: {
|
|
77
|
-
tool: {
|
|
78
|
-
type: "string",
|
|
79
|
-
enum: ["data", "snapshot", "validate"],
|
|
80
|
-
description: "Tool to invoke"
|
|
81
|
-
},
|
|
82
|
-
args: {
|
|
83
|
-
type: "object",
|
|
84
|
-
description: "Arguments (same schema as direct tool call)"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
required: ["tool", "args"]
|
|
88
|
-
},
|
|
89
|
-
// String form: alias reference
|
|
90
|
-
{
|
|
91
|
-
type: "string",
|
|
92
|
-
description: "Alias name (e.g., 'standard-demo-setup')"
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
### Context Variables
|
|
100
|
-
|
|
101
|
-
Actions can reference context from the base operation:
|
|
102
|
-
|
|
103
|
-
| Variable | Description |
|
|
104
|
-
|----------|-------------|
|
|
105
|
-
| `$source` | Source persona ID (from `from` parameter) |
|
|
106
|
-
| `$target` | Created/cloned persona ID (result of base op) |
|
|
107
|
-
| `$env` | Current environment |
|
|
108
|
-
|
|
109
|
-
```typescript
|
|
110
|
-
// $source and $target auto-populated
|
|
111
|
-
persona(
|
|
112
|
-
method="create",
|
|
113
|
-
from="template-123", // $source = "template-123"
|
|
114
|
-
name="New Persona",
|
|
115
|
-
actions=[
|
|
116
|
-
// $target = ID of newly created persona
|
|
117
|
-
{tool:"data", args:{method:"copy", from:"$source"}},
|
|
118
|
-
{tool:"data", args:{method:"sanitize"}},
|
|
119
|
-
{tool:"snapshot", args:{message:"Created from $source"}},
|
|
120
|
-
]
|
|
121
|
-
)
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### Supported Action Tools
|
|
125
|
-
|
|
126
|
-
| Tool | Description | Example |
|
|
127
|
-
|------|-------------|---------|
|
|
128
|
-
| `data` | Data operations (copy, upload, sanitize) | `{tool:"data", args:{method:"copy", from:"src"}}` |
|
|
129
|
-
| `snapshot` | Create version snapshot | `{tool:"snapshot", args:{message:"..."}}` |
|
|
130
|
-
| `validate` | Run validation checks | `{tool:"validate", args:{checks:["workflow","config"]}}` |
|
|
131
|
-
|
|
132
|
-
### Aliases
|
|
133
|
-
|
|
134
|
-
Common patterns can be defined as aliases:
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
// Built-in aliases
|
|
138
|
-
const ACTION_ALIASES: Record<string, ActionSpec[]> = {
|
|
139
|
-
"copy-and-sanitize": [
|
|
140
|
-
{tool:"data", args:{method:"copy", from:"$source"}},
|
|
141
|
-
{tool:"data", args:{method:"sanitize"}},
|
|
142
|
-
],
|
|
143
|
-
"standard-demo-setup": [
|
|
144
|
-
{tool:"data", args:{method:"copy", from:"$source"}},
|
|
145
|
-
{tool:"data", args:{method:"sanitize"}},
|
|
146
|
-
{tool:"snapshot", args:{message:"Demo setup complete"}},
|
|
147
|
-
],
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
// Usage
|
|
151
|
-
persona(
|
|
152
|
-
method="create",
|
|
153
|
-
from="prod-persona",
|
|
154
|
-
name="Demo Version",
|
|
155
|
-
actions=["copy-and-sanitize"] // Expands to 2 actions
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
// Mixed usage
|
|
159
|
-
persona(
|
|
160
|
-
method="create",
|
|
161
|
-
from="prod-persona",
|
|
162
|
-
name="Demo Version",
|
|
163
|
-
actions=[
|
|
164
|
-
"copy-and-sanitize", // alias
|
|
165
|
-
{tool:"snapshot", args:{message:"Custom message"}}, // explicit
|
|
166
|
-
]
|
|
167
|
-
)
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
## Execution Model
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
persona(method="create", from="src", name="New", actions=[...])
|
|
174
|
-
│
|
|
175
|
-
▼
|
|
176
|
-
┌─────────────────────────────────────────┐
|
|
177
|
-
│ 1. Execute base operation (create) │
|
|
178
|
-
│ - Creates new persona "New" │
|
|
179
|
-
│ - Returns: { id: "new-123", ... } │
|
|
180
|
-
│ - Sets context: $target="new-123" │
|
|
181
|
-
└────────────────┬────────────────────────┘
|
|
182
|
-
│
|
|
183
|
-
▼
|
|
184
|
-
┌─────────────────────────────────────────┐
|
|
185
|
-
│ 2. Build execution context │
|
|
186
|
-
│ $source = "src" │
|
|
187
|
-
│ $target = "new-123" │
|
|
188
|
-
│ $env = "demo" │
|
|
189
|
-
└────────────────┬────────────────────────┘
|
|
190
|
-
│
|
|
191
|
-
▼
|
|
192
|
-
┌─────────────────────────────────────────┐
|
|
193
|
-
│ 3. Expand aliases │
|
|
194
|
-
│ "standard-demo-setup" → [ │
|
|
195
|
-
│ {tool:"data", args:{...}}, │
|
|
196
|
-
│ {tool:"data", args:{...}}, │
|
|
197
|
-
│ {tool:"snapshot", args:{...}}, │
|
|
198
|
-
│ ] │
|
|
199
|
-
└────────────────┬────────────────────────┘
|
|
200
|
-
│
|
|
201
|
-
▼
|
|
202
|
-
┌─────────────────────────────────────────┐
|
|
203
|
-
│ 4. Execute actions in sequence │
|
|
204
|
-
│ - Substitute context vars │
|
|
205
|
-
│ - Execute each action │
|
|
206
|
-
│ - Collect results │
|
|
207
|
-
│ - Stop on error (unless continue) │
|
|
208
|
-
└────────────────┬────────────────────────┘
|
|
209
|
-
│
|
|
210
|
-
▼
|
|
211
|
-
┌─────────────────────────────────────────┐
|
|
212
|
-
│ 5. Return composite result │
|
|
213
|
-
│ { │
|
|
214
|
-
│ persona: { id: "new-123", ... }, │
|
|
215
|
-
│ actions: [ │
|
|
216
|
-
│ { tool: "data", status: "ok" }, │
|
|
217
|
-
│ { tool: "snapshot", ... }, │
|
|
218
|
-
│ ] │
|
|
219
|
-
│ } │
|
|
220
|
-
└─────────────────────────────────────────┘
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
## Schema Changes
|
|
224
|
-
|
|
225
|
-
### Before (Flag-Based)
|
|
226
|
-
|
|
227
|
-
```typescript
|
|
228
|
-
persona.inputSchema.properties = {
|
|
229
|
-
// ... other props ...
|
|
230
|
-
include_data: { type: "boolean" },
|
|
231
|
-
sanitize: { type: "boolean" },
|
|
232
|
-
sanitize_examples: { type: "array", items: { type: "string" } },
|
|
233
|
-
create_snapshot: { type: "boolean" },
|
|
234
|
-
snapshot_message: { type: "string" },
|
|
235
|
-
// Every new capability = new props
|
|
236
|
-
}
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### After (Action-Based)
|
|
240
|
-
|
|
241
|
-
```typescript
|
|
242
|
-
persona.inputSchema.properties = {
|
|
243
|
-
// ... other props ...
|
|
244
|
-
actions: {
|
|
245
|
-
type: "array",
|
|
246
|
-
description: "Post-operation actions to execute in sequence",
|
|
247
|
-
items: {
|
|
248
|
-
oneOf: [
|
|
249
|
-
{
|
|
250
|
-
type: "object",
|
|
251
|
-
properties: {
|
|
252
|
-
tool: { type: "string", enum: ["data", "snapshot", "validate"] },
|
|
253
|
-
args: { type: "object" }
|
|
254
|
-
},
|
|
255
|
-
required: ["tool", "args"]
|
|
256
|
-
},
|
|
257
|
-
{ type: "string" } // alias reference
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
// Schema is stable - new actions don't require changes
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
## Implementation
|
|
266
|
-
|
|
267
|
-
### 1. Action Executor Module
|
|
268
|
-
|
|
269
|
-
```typescript
|
|
270
|
-
// src/mcp/handlers/action-executor.ts
|
|
271
|
-
|
|
272
|
-
interface ActionContext {
|
|
273
|
-
source?: string; // from parameter
|
|
274
|
-
target?: string; // result of base operation
|
|
275
|
-
env?: string;
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
interface ActionSpec {
|
|
279
|
-
tool: "data" | "snapshot" | "validate";
|
|
280
|
-
args: Record<string, unknown>;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
interface ActionResult {
|
|
284
|
-
tool: string;
|
|
285
|
-
status: "success" | "error";
|
|
286
|
-
result?: unknown;
|
|
287
|
-
error?: string;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* Execute a sequence of actions with context substitution
|
|
292
|
-
*/
|
|
293
|
-
export async function executeActions(
|
|
294
|
-
actions: (ActionSpec | string)[],
|
|
295
|
-
context: ActionContext,
|
|
296
|
-
client: EmaClient,
|
|
297
|
-
): Promise<ActionResult[]> {
|
|
298
|
-
const results: ActionResult[] = [];
|
|
299
|
-
const expanded = expandAliases(actions);
|
|
300
|
-
|
|
301
|
-
for (const action of expanded) {
|
|
302
|
-
const substituted = substituteContext(action, context);
|
|
303
|
-
try {
|
|
304
|
-
const result = await executeAction(substituted, context, client);
|
|
305
|
-
results.push({ tool: action.tool, status: "success", result });
|
|
306
|
-
} catch (error) {
|
|
307
|
-
results.push({ tool: action.tool, status: "error", error: String(error) });
|
|
308
|
-
break; // Stop on error
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return results;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Substitute context variables in action args
|
|
317
|
-
*/
|
|
318
|
-
function substituteContext(action: ActionSpec, context: ActionContext): ActionSpec {
|
|
319
|
-
const args = JSON.parse(JSON.stringify(action.args));
|
|
320
|
-
|
|
321
|
-
function substitute(obj: Record<string, unknown>) {
|
|
322
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
323
|
-
if (typeof value === "string") {
|
|
324
|
-
obj[key] = value
|
|
325
|
-
.replace(/\$source/g, context.source ?? "")
|
|
326
|
-
.replace(/\$target/g, context.target ?? "")
|
|
327
|
-
.replace(/\$env/g, context.env ?? "");
|
|
328
|
-
} else if (typeof value === "object" && value !== null) {
|
|
329
|
-
substitute(value as Record<string, unknown>);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
substitute(args);
|
|
335
|
-
return { tool: action.tool, args };
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
### 2. Handler Integration
|
|
340
|
-
|
|
341
|
-
```typescript
|
|
342
|
-
// In handlePersona - after base operation
|
|
343
|
-
|
|
344
|
-
// If actions provided, execute them
|
|
345
|
-
if (Array.isArray(args.actions) && args.actions.length > 0) {
|
|
346
|
-
const context: ActionContext = {
|
|
347
|
-
source: args.from as string,
|
|
348
|
-
target: baseResult.id,
|
|
349
|
-
env: args.env as string,
|
|
350
|
-
};
|
|
351
|
-
|
|
352
|
-
const actionResults = await executeActions(args.actions, context, client);
|
|
353
|
-
|
|
354
|
-
return {
|
|
355
|
-
...baseResult,
|
|
356
|
-
actions: actionResults,
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
## Examples
|
|
362
|
-
|
|
363
|
-
### Clone with Data Copy and Sanitization
|
|
364
|
-
|
|
365
|
-
```typescript
|
|
366
|
-
// Old way (flags)
|
|
367
|
-
persona(
|
|
368
|
-
method="create",
|
|
369
|
-
from="prod-persona",
|
|
370
|
-
name="Demo Copy",
|
|
371
|
-
include_data=true,
|
|
372
|
-
sanitize=true,
|
|
373
|
-
sanitize_examples=["Acme Corp", "john@acme.com"]
|
|
374
|
-
)
|
|
375
|
-
|
|
376
|
-
// New way (actions)
|
|
377
|
-
persona(
|
|
378
|
-
method="create",
|
|
379
|
-
from="prod-persona",
|
|
380
|
-
name="Demo Copy",
|
|
381
|
-
actions=[
|
|
382
|
-
{tool:"data", args:{method:"copy", from:"$source"}},
|
|
383
|
-
{tool:"data", args:{method:"sanitize", examples:["Acme Corp", "john@acme.com"]}},
|
|
384
|
-
]
|
|
385
|
-
)
|
|
386
|
-
```
|
|
387
|
-
|
|
388
|
-
### Clone with LLM-Generated Content
|
|
389
|
-
|
|
390
|
-
```typescript
|
|
391
|
-
persona(
|
|
392
|
-
method="create",
|
|
393
|
-
from="template-dashboard",
|
|
394
|
-
name="Test Dashboard",
|
|
395
|
-
actions=[
|
|
396
|
-
// LLM generates content, provides via upload
|
|
397
|
-
{tool:"data", args:{
|
|
398
|
-
method:"upload",
|
|
399
|
-
content:[
|
|
400
|
-
{document:{text:"Contract 1..."}, title:"Contract A", value:50000},
|
|
401
|
-
{document:{text:"Contract 2..."}, title:"Contract B", value:75000},
|
|
402
|
-
]
|
|
403
|
-
}},
|
|
404
|
-
{tool:"snapshot", args:{message:"Initial test data loaded"}},
|
|
405
|
-
]
|
|
406
|
-
)
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Using Aliases
|
|
410
|
-
|
|
411
|
-
```typescript
|
|
412
|
-
// Simple alias
|
|
413
|
-
persona(
|
|
414
|
-
method="create",
|
|
415
|
-
from="prod-persona",
|
|
416
|
-
name="Demo",
|
|
417
|
-
actions=["standard-demo-setup"]
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
// Alias + custom action
|
|
421
|
-
persona(
|
|
422
|
-
method="create",
|
|
423
|
-
from="prod-persona",
|
|
424
|
-
name="Demo",
|
|
425
|
-
actions=[
|
|
426
|
-
"copy-and-sanitize",
|
|
427
|
-
{tool:"validate", args:{checks:["workflow"]}},
|
|
428
|
-
{tool:"snapshot", args:{message:"Validated and ready"}},
|
|
429
|
-
]
|
|
430
|
-
)
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
## Migration
|
|
434
|
-
|
|
435
|
-
| Old (Flag-Based) | New (Action-Based) |
|
|
436
|
-
|------------------|-------------------|
|
|
437
|
-
| `include_data=true` | `actions=[{tool:"data", args:{method:"copy", from:"$source"}}]` |
|
|
438
|
-
| `sanitize=true` | `actions=[{tool:"data", args:{method:"sanitize"}}]` |
|
|
439
|
-
| `sanitize_examples=[...]` | `args:{..., examples:[...]}` in sanitize action |
|
|
440
|
-
| Combined flags | Actions array with both operations |
|
|
441
|
-
|
|
442
|
-
**Backward Compatibility:**
|
|
443
|
-
|
|
444
|
-
Phase 1: Support both flags and actions (flags converted to actions internally)
|
|
445
|
-
Phase 2: Deprecation warnings for flag usage
|
|
446
|
-
Phase 3: Remove flag parameters
|
|
447
|
-
|
|
448
|
-
## Comparison: Adding New Capability
|
|
449
|
-
|
|
450
|
-
**Scenario:** Add "link data instead of copy" capability
|
|
451
|
-
|
|
452
|
-
### Flag-Based
|
|
453
|
-
|
|
454
|
-
```typescript
|
|
455
|
-
// Schema change required - new parameter
|
|
456
|
-
inputSchema.properties.link_data = { type: "boolean" };
|
|
457
|
-
|
|
458
|
-
// Or worse, mode enum expansion
|
|
459
|
-
inputSchema.properties.data_mode = {
|
|
460
|
-
enum: ["copy", "link", "copy_sanitized", ...]
|
|
461
|
-
};
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
### Action-Based
|
|
465
|
-
|
|
466
|
-
```typescript
|
|
467
|
-
// No schema change - use existing data action with option
|
|
468
|
-
actions=[
|
|
469
|
-
{tool:"data", args:{method:"copy", from:"$source", link:true}}
|
|
470
|
-
]
|
|
471
|
-
```
|
|
472
|
-
|
|
473
|
-
## Open Questions
|
|
474
|
-
|
|
475
|
-
1. **Error handling**: Stop on first error, or continue and report all?
|
|
476
|
-
- **Decision**: Stop on error by default, add `continue_on_error: true` option
|
|
477
|
-
|
|
478
|
-
2. **Parallel execution**: Should independent actions run in parallel?
|
|
479
|
-
- **Decision**: Sequential by default, add `parallel: true` option for future
|
|
480
|
-
|
|
481
|
-
3. **Alias management**: Where to define custom aliases?
|
|
482
|
-
- **Decision**: Built-in aliases only for v1, custom alias config for future
|
|
483
|
-
|
|
484
|
-
## Approval
|
|
485
|
-
|
|
486
|
-
- [x] Design reviewed
|
|
487
|
-
- [x] Architecture analyzed
|
|
488
|
-
- [ ] Implementation started
|
|
489
|
-
- [ ] Tests written
|
|
490
|
-
- [ ] Documentation updated
|