@jungjaehoon/mama-os 0.9.0 → 0.9.2

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cli/commands/start.d.ts.map +1 -1
  3. package/dist/cli/commands/start.js +37 -9
  4. package/dist/cli/commands/start.js.map +1 -1
  5. package/dist/cli/config/types.d.ts +17 -0
  6. package/dist/cli/config/types.d.ts.map +1 -1
  7. package/dist/cli/config/types.js.map +1 -1
  8. package/dist/gateways/discord.d.ts +4 -0
  9. package/dist/gateways/discord.d.ts.map +1 -1
  10. package/dist/gateways/discord.js +48 -2
  11. package/dist/gateways/discord.js.map +1 -1
  12. package/dist/gateways/image-analyzer.d.ts.map +1 -1
  13. package/dist/gateways/image-analyzer.js +10 -1
  14. package/dist/gateways/image-analyzer.js.map +1 -1
  15. package/dist/gateways/slack.d.ts.map +1 -1
  16. package/dist/gateways/slack.js +3 -0
  17. package/dist/gateways/slack.js.map +1 -1
  18. package/dist/multi-agent/agent-process-manager.d.ts +10 -0
  19. package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
  20. package/dist/multi-agent/agent-process-manager.js +36 -2
  21. package/dist/multi-agent/agent-process-manager.js.map +1 -1
  22. package/dist/multi-agent/agent-process-pool.d.ts.map +1 -1
  23. package/dist/multi-agent/agent-process-pool.js +32 -4
  24. package/dist/multi-agent/agent-process-pool.js.map +1 -1
  25. package/dist/multi-agent/multi-agent-base.d.ts +19 -0
  26. package/dist/multi-agent/multi-agent-base.d.ts.map +1 -1
  27. package/dist/multi-agent/multi-agent-base.js +96 -0
  28. package/dist/multi-agent/multi-agent-base.js.map +1 -1
  29. package/dist/multi-agent/multi-agent-discord.d.ts.map +1 -1
  30. package/dist/multi-agent/multi-agent-discord.js +36 -0
  31. package/dist/multi-agent/multi-agent-discord.js.map +1 -1
  32. package/dist/multi-agent/multi-agent-slack.d.ts.map +1 -1
  33. package/dist/multi-agent/multi-agent-slack.js +38 -2
  34. package/dist/multi-agent/multi-agent-slack.js.map +1 -1
  35. package/dist/multi-agent/pr-review-poller.d.ts +16 -0
  36. package/dist/multi-agent/pr-review-poller.d.ts.map +1 -1
  37. package/dist/multi-agent/pr-review-poller.js +38 -0
  38. package/dist/multi-agent/pr-review-poller.js.map +1 -1
  39. package/dist/multi-agent/types.d.ts +18 -2
  40. package/dist/multi-agent/types.d.ts.map +1 -1
  41. package/dist/multi-agent/types.js.map +1 -1
  42. package/dist/multi-agent/workflow-engine.d.ts +80 -0
  43. package/dist/multi-agent/workflow-engine.d.ts.map +1 -0
  44. package/dist/multi-agent/workflow-engine.js +395 -0
  45. package/dist/multi-agent/workflow-engine.js.map +1 -0
  46. package/dist/multi-agent/workflow-types.d.ts +111 -0
  47. package/dist/multi-agent/workflow-types.d.ts.map +1 -0
  48. package/dist/multi-agent/workflow-types.js +9 -0
  49. package/dist/multi-agent/workflow-types.js.map +1 -0
  50. package/dist/setup/setup-prompt.d.ts +1 -1
  51. package/dist/setup/setup-prompt.d.ts.map +1 -1
  52. package/dist/setup/setup-prompt.js +25 -0
  53. package/dist/setup/setup-prompt.js.map +1 -1
  54. package/package.json +1 -1
  55. package/public/viewer/js/modules/chat.js +30 -14
  56. package/public/viewer/js/utils/dom.js +15 -15
  57. package/public/viewer/src/modules/chat.ts +32 -20
  58. package/public/viewer/src/utils/dom.ts +16 -16
  59. package/public/viewer/viewer.css +45 -2
  60. package/public/viewer/viewer.html +19 -8
  61. package/templates/personas/sisyphus.md +8 -0
@@ -0,0 +1,395 @@
1
+ "use strict";
2
+ /**
3
+ * Workflow Engine
4
+ *
5
+ * Parses workflow plans from Conductor responses, validates DAGs,
6
+ * executes steps in topological order with parallel execution per level,
7
+ * and emits progress events for platform handlers.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.WorkflowEngine = exports.StepExecutionError = void 0;
11
+ const events_1 = require("events");
12
+ const crypto_1 = require("crypto");
13
+ const DEFAULT_STEP_TIMEOUT_MS = 5 * 60 * 1000; // 5 minutes
14
+ const DEFAULT_MAX_EPHEMERAL = 5;
15
+ const DEFAULT_MAX_DURATION_MS = 10 * 60 * 1000; // 10 minutes
16
+ class StepExecutionError extends Error {
17
+ duration_ms;
18
+ stepId;
19
+ agentId;
20
+ constructor(message, stepId, agentId, duration_ms) {
21
+ super(message);
22
+ this.name = 'StepExecutionError';
23
+ this.stepId = stepId;
24
+ this.agentId = agentId;
25
+ this.duration_ms = duration_ms;
26
+ }
27
+ }
28
+ exports.StepExecutionError = StepExecutionError;
29
+ /**
30
+ * WorkflowEngine
31
+ *
32
+ * Events:
33
+ * - 'progress': WorkflowProgressEvent
34
+ */
35
+ class WorkflowEngine extends events_1.EventEmitter {
36
+ config;
37
+ activeExecutions = new Map();
38
+ constructor(config) {
39
+ super();
40
+ this.config = config;
41
+ }
42
+ /**
43
+ * Parse a workflow_plan JSON block from Conductor's response.
44
+ * Returns null if no valid plan is found.
45
+ */
46
+ parseWorkflowPlan(response) {
47
+ const match = response.match(/```workflow_plan\s*\n([\s\S]*?)\n```/);
48
+ if (!match)
49
+ return null;
50
+ try {
51
+ const plan = JSON.parse(match[1].trim());
52
+ if (!plan.name || !Array.isArray(plan.steps) || plan.steps.length === 0) {
53
+ return null;
54
+ }
55
+ // Validate each step has required fields
56
+ for (const step of plan.steps) {
57
+ if (!step.id || !step.agent || !step.prompt)
58
+ return null;
59
+ if (!step.agent.id ||
60
+ !step.agent.display_name ||
61
+ !step.agent.backend ||
62
+ !step.agent.model ||
63
+ !step.agent.system_prompt) {
64
+ return null;
65
+ }
66
+ }
67
+ return plan;
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
73
+ /**
74
+ * Extract text content outside the workflow_plan block (for display as Conductor's direct message).
75
+ */
76
+ extractNonPlanContent(response) {
77
+ return response.replace(/```workflow_plan\s*\n[\s\S]*?\n```/, '').trim();
78
+ }
79
+ /**
80
+ * Validate DAG structure: no cycles, valid dependencies, agent limits.
81
+ * Returns error message or null if valid.
82
+ */
83
+ validatePlan(plan) {
84
+ const maxAgents = this.config.max_ephemeral_agents ?? DEFAULT_MAX_EPHEMERAL;
85
+ if (plan.steps.length > maxAgents) {
86
+ return `Too many steps (${plan.steps.length}), max is ${maxAgents}`;
87
+ }
88
+ const stepIds = new Set(plan.steps.map((s) => s.id));
89
+ // Check for duplicate step IDs
90
+ if (stepIds.size !== plan.steps.length) {
91
+ return 'Duplicate step IDs detected';
92
+ }
93
+ // Check dependency references
94
+ for (const step of plan.steps) {
95
+ if (step.depends_on) {
96
+ for (const dep of step.depends_on) {
97
+ if (!stepIds.has(dep)) {
98
+ return `Step "${step.id}" depends on unknown step "${dep}"`;
99
+ }
100
+ if (dep === step.id) {
101
+ return `Step "${step.id}" depends on itself`;
102
+ }
103
+ }
104
+ }
105
+ }
106
+ // Cycle detection via topological sort
107
+ const sorted = this.topologicalSort(plan.steps);
108
+ if (!sorted) {
109
+ return 'Cycle detected in workflow DAG';
110
+ }
111
+ return null;
112
+ }
113
+ /**
114
+ * Topological sort of workflow steps.
115
+ * Returns sorted steps or null if a cycle exists.
116
+ */
117
+ topologicalSort(steps) {
118
+ const inDegree = new Map();
119
+ const adjacency = new Map();
120
+ const stepMap = new Map();
121
+ for (const step of steps) {
122
+ stepMap.set(step.id, step);
123
+ inDegree.set(step.id, 0);
124
+ adjacency.set(step.id, []);
125
+ }
126
+ for (const step of steps) {
127
+ if (step.depends_on) {
128
+ for (const dep of step.depends_on) {
129
+ if (!adjacency.has(dep)) {
130
+ throw new Error(`Step "${step.id}" depends on unknown step "${dep}"`);
131
+ }
132
+ adjacency.get(dep).push(step.id);
133
+ inDegree.set(step.id, (inDegree.get(step.id) ?? 0) + 1);
134
+ }
135
+ }
136
+ }
137
+ const queue = [];
138
+ for (const [id, degree] of inDegree) {
139
+ if (degree === 0)
140
+ queue.push(id);
141
+ }
142
+ const sorted = [];
143
+ while (queue.length > 0) {
144
+ const id = queue.shift();
145
+ sorted.push(stepMap.get(id));
146
+ for (const neighbor of adjacency.get(id) ?? []) {
147
+ const newDegree = (inDegree.get(neighbor) ?? 1) - 1;
148
+ inDegree.set(neighbor, newDegree);
149
+ if (newDegree === 0)
150
+ queue.push(neighbor);
151
+ }
152
+ }
153
+ return sorted.length === steps.length ? sorted : null;
154
+ }
155
+ /**
156
+ * Group steps into execution levels (steps at same level run in parallel).
157
+ */
158
+ buildExecutionLevels(steps) {
159
+ const sorted = this.topologicalSort(steps);
160
+ if (!sorted)
161
+ return [];
162
+ const levelMap = new Map();
163
+ for (const step of sorted) {
164
+ let maxDepLevel = -1;
165
+ if (step.depends_on) {
166
+ for (const dep of step.depends_on) {
167
+ const depLevel = levelMap.get(dep) ?? 0;
168
+ if (depLevel > maxDepLevel)
169
+ maxDepLevel = depLevel;
170
+ }
171
+ }
172
+ levelMap.set(step.id, maxDepLevel + 1);
173
+ }
174
+ const levels = [];
175
+ for (const step of sorted) {
176
+ const level = levelMap.get(step.id) ?? 0;
177
+ while (levels.length <= level)
178
+ levels.push([]);
179
+ levels[level].push(step);
180
+ }
181
+ return levels;
182
+ }
183
+ /**
184
+ * Execute a workflow plan.
185
+ *
186
+ * @param plan - Validated workflow plan
187
+ * @param executeStep - Callback to execute a single step (provided by platform handler)
188
+ * @returns Execution result with all step outputs
189
+ */
190
+ async execute(plan, executeStep) {
191
+ const executionId = (0, crypto_1.randomUUID)();
192
+ const executionState = { cancelled: false };
193
+ this.activeExecutions.set(executionId, executionState);
194
+ const maxDuration = this.config.max_duration_ms ?? DEFAULT_MAX_DURATION_MS;
195
+ const execution = {
196
+ id: executionId,
197
+ planName: plan.name,
198
+ startedAt: Date.now(),
199
+ status: 'running',
200
+ steps: [],
201
+ };
202
+ const stepResults = new Map();
203
+ const levels = this.buildExecutionLevels(plan.steps);
204
+ // Global timeout
205
+ const globalTimeout = setTimeout(() => {
206
+ executionState.cancelled = true;
207
+ }, maxDuration);
208
+ try {
209
+ for (const level of levels) {
210
+ if (executionState.cancelled)
211
+ break;
212
+ const levelResults = await Promise.allSettled(level.map((step) => this.executeStep(step, stepResults, executeStep, executionId, executionState)));
213
+ for (let i = 0; i < levelResults.length; i++) {
214
+ const step = level[i];
215
+ const levelResult = levelResults[i];
216
+ if (levelResult.status === 'fulfilled') {
217
+ stepResults.set(step.id, levelResult.value);
218
+ execution.steps.push(levelResult.value);
219
+ }
220
+ else {
221
+ const reason = levelResult.reason;
222
+ const duration_ms = reason instanceof StepExecutionError ? reason.duration_ms : 0;
223
+ const failedResult = {
224
+ stepId: step.id,
225
+ agentId: step.agent.id,
226
+ result: '',
227
+ duration_ms,
228
+ status: 'failed',
229
+ error: reason?.message || String(reason),
230
+ };
231
+ stepResults.set(step.id, failedResult);
232
+ execution.steps.push(failedResult);
233
+ if (!step.optional) {
234
+ execution.status = 'failed';
235
+ break;
236
+ }
237
+ }
238
+ }
239
+ if (execution.status === 'failed')
240
+ break;
241
+ }
242
+ if (executionState.cancelled && execution.status === 'running') {
243
+ execution.status = 'cancelled';
244
+ }
245
+ else if (execution.status === 'running') {
246
+ execution.status = 'completed';
247
+ }
248
+ }
249
+ finally {
250
+ clearTimeout(globalTimeout);
251
+ this.activeExecutions.delete(executionId);
252
+ }
253
+ execution.completedAt = Date.now();
254
+ // Build final result
255
+ const result = this.buildFinalResult(plan, stepResults, execution);
256
+ this.emitProgress({
257
+ type: 'workflow-completed',
258
+ executionId,
259
+ summary: result,
260
+ duration_ms: execution.completedAt - execution.startedAt,
261
+ });
262
+ return { result, execution };
263
+ }
264
+ /**
265
+ * Cancel a running workflow execution.
266
+ */
267
+ cancel(executionId) {
268
+ const state = this.activeExecutions.get(executionId);
269
+ if (state) {
270
+ state.cancelled = true;
271
+ return true;
272
+ }
273
+ return false;
274
+ }
275
+ /**
276
+ * Check if workflow orchestration is enabled.
277
+ */
278
+ isEnabled() {
279
+ return this.config.enabled;
280
+ }
281
+ async executeStep(step, previousResults, executeStep, executionId, executionState) {
282
+ if (executionState.cancelled) {
283
+ return {
284
+ stepId: step.id,
285
+ agentId: step.agent.id,
286
+ result: '',
287
+ duration_ms: 0,
288
+ status: 'skipped',
289
+ };
290
+ }
291
+ this.emitProgress({
292
+ type: 'step-started',
293
+ executionId,
294
+ stepId: step.id,
295
+ agentDisplayName: step.agent.display_name,
296
+ agentBackend: step.agent.backend,
297
+ agentModel: step.agent.model,
298
+ });
299
+ // Interpolate previous step results into prompt
300
+ const resolvedPrompt = this.interpolatePrompt(step.prompt, previousResults);
301
+ const timeout = step.timeout_ms ?? DEFAULT_STEP_TIMEOUT_MS;
302
+ const start = Date.now();
303
+ try {
304
+ const result = await executeStep(step.agent, resolvedPrompt, timeout);
305
+ const duration_ms = Date.now() - start;
306
+ this.emitProgress({
307
+ type: 'step-completed',
308
+ executionId,
309
+ stepId: step.id,
310
+ agentDisplayName: step.agent.display_name,
311
+ agentBackend: step.agent.backend,
312
+ agentModel: step.agent.model,
313
+ result: result.substring(0, 500),
314
+ duration_ms,
315
+ });
316
+ return {
317
+ stepId: step.id,
318
+ agentId: step.agent.id,
319
+ result,
320
+ duration_ms,
321
+ status: 'success',
322
+ };
323
+ }
324
+ catch (error) {
325
+ const duration_ms = Date.now() - start;
326
+ const errorMsg = error instanceof Error ? error.message : String(error);
327
+ this.emitProgress({
328
+ type: 'step-failed',
329
+ executionId,
330
+ stepId: step.id,
331
+ agentDisplayName: step.agent.display_name,
332
+ agentBackend: step.agent.backend,
333
+ agentModel: step.agent.model,
334
+ error: errorMsg,
335
+ duration_ms,
336
+ });
337
+ if (step.optional) {
338
+ return {
339
+ stepId: step.id,
340
+ agentId: step.agent.id,
341
+ result: '',
342
+ duration_ms,
343
+ status: 'failed',
344
+ error: errorMsg,
345
+ };
346
+ }
347
+ throw new StepExecutionError(errorMsg, step.id, step.agent.id, duration_ms);
348
+ }
349
+ }
350
+ /**
351
+ * Replace {{step_id.result}} placeholders with actual step results.
352
+ */
353
+ interpolatePrompt(prompt, results) {
354
+ return prompt.replace(/\{\{(\w[\w-]*)\.result\}\}/g, (_match, stepId) => {
355
+ const result = results.get(stepId);
356
+ if (!result || result.status !== 'success') {
357
+ return `[Step "${stepId}" not available]`;
358
+ }
359
+ return result.result;
360
+ });
361
+ }
362
+ /**
363
+ * Build the final combined result from all step outputs.
364
+ */
365
+ buildFinalResult(plan, results, execution) {
366
+ if (execution.status === 'cancelled') {
367
+ return `Workflow "${plan.name}" was cancelled.`;
368
+ }
369
+ // If synthesis step is defined, use its template
370
+ if (plan.synthesis?.prompt_template) {
371
+ return this.interpolatePrompt(plan.synthesis.prompt_template, results);
372
+ }
373
+ // Default: concatenate all successful step results
374
+ const parts = [];
375
+ for (const step of plan.steps) {
376
+ const result = results.get(step.id);
377
+ if (result && result.status === 'success' && result.result) {
378
+ parts.push(`### ${step.agent.display_name}\n${result.result}`);
379
+ }
380
+ else if (result && result.status === 'failed') {
381
+ parts.push(`### ${step.agent.display_name}\n❌ Failed: ${result.error}`);
382
+ }
383
+ }
384
+ const totalMs = execution.completedAt
385
+ ? execution.completedAt - execution.startedAt
386
+ : Date.now() - execution.startedAt;
387
+ const totalSec = Math.round(totalMs / 1000);
388
+ return `## Workflow: ${plan.name} (${totalSec}s)\n\n${parts.join('\n\n')}`;
389
+ }
390
+ emitProgress(event) {
391
+ this.emit('progress', event);
392
+ }
393
+ }
394
+ exports.WorkflowEngine = WorkflowEngine;
395
+ //# sourceMappingURL=workflow-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-engine.js","sourceRoot":"","sources":["../../src/multi-agent/workflow-engine.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,mCAAsC;AACtC,mCAAoC;AAWpC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,YAAY;AAC3D,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAChC,MAAM,uBAAuB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAE7D,MAAa,kBAAmB,SAAQ,KAA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AAgB,IAAI,CAAC,IAAI,KAAK,QAAQ,SAAS,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IAC7E,CAAC;IAEO,YAAY,CAAC,KAA4B;QAC/C,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF;AAlaD,wCAkaC"}
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Dynamic Workflow Orchestration Types
3
+ *
4
+ * Conductor가 사용자 의도를 분석하여 동적으로 생성하는
5
+ * 워크플로우 DAG 관련 타입 정의.
6
+ */
7
+ export type AgentBackend = 'claude' | 'codex-mcp' | 'gemini';
8
+ /**
9
+ * Conductor가 동적으로 생성하는 임시 에이전트 정의
10
+ */
11
+ export interface EphemeralAgentDef {
12
+ /** Unique ID within the workflow, e.g. "planner-1", "coder-2" */
13
+ id: string;
14
+ /** Display name with emoji, e.g. "🔍 Researcher" */
15
+ display_name: string;
16
+ /** Runtime backend */
17
+ backend: AgentBackend;
18
+ /** Model ID */
19
+ model: string;
20
+ /** Inline system prompt */
21
+ system_prompt: string;
22
+ /** Agent tier level @default 1 */
23
+ tier?: 1 | 2 | 3;
24
+ /** Tool permissions override */
25
+ tool_permissions?: {
26
+ allowed?: string[];
27
+ blocked?: string[];
28
+ };
29
+ }
30
+ /**
31
+ * 워크플로우 DAG의 한 단계
32
+ */
33
+ export interface WorkflowStep {
34
+ /** Unique step ID within the workflow */
35
+ id: string;
36
+ /** Agent definition for this step */
37
+ agent: EphemeralAgentDef;
38
+ /** Prompt template — supports {{step_id.result}} interpolation */
39
+ prompt: string;
40
+ /** Step IDs this step depends on */
41
+ depends_on?: string[];
42
+ /** Timeout in ms @default 300000 (5 min) */
43
+ timeout_ms?: number;
44
+ /** If true, workflow continues even if this step fails @default false */
45
+ optional?: boolean;
46
+ }
47
+ /**
48
+ * Conductor가 출력하는 워크플로우 계획
49
+ */
50
+ export interface WorkflowPlan {
51
+ /** Human-readable name for the workflow */
52
+ name: string;
53
+ /** Ordered steps forming a DAG */
54
+ steps: WorkflowStep[];
55
+ /** Optional synthesis step to combine all results */
56
+ synthesis?: {
57
+ agent?: EphemeralAgentDef;
58
+ prompt_template?: string;
59
+ };
60
+ }
61
+ /**
62
+ * 워크플로우 설정 (MultiAgentConfig.workflow)
63
+ */
64
+ export interface WorkflowConfig {
65
+ /** Enable dynamic workflow orchestration */
66
+ enabled: boolean;
67
+ /** Max ephemeral agents per workflow @default 5 */
68
+ max_ephemeral_agents?: number;
69
+ /** Max total workflow duration in ms @default 600000 (10 min) */
70
+ max_duration_ms?: number;
71
+ }
72
+ /**
73
+ * 단계 실행 결과
74
+ */
75
+ export interface StepResult {
76
+ stepId: string;
77
+ agentId: string;
78
+ result: string;
79
+ duration_ms: number;
80
+ status: 'success' | 'failed' | 'timeout' | 'skipped';
81
+ error?: string;
82
+ }
83
+ /**
84
+ * 워크플로우 실행 상태
85
+ */
86
+ export interface WorkflowExecution {
87
+ id: string;
88
+ planName: string;
89
+ startedAt: number;
90
+ completedAt?: number;
91
+ status: 'running' | 'completed' | 'failed' | 'cancelled';
92
+ steps: StepResult[];
93
+ }
94
+ /**
95
+ * 워크플로우 진행 이벤트 (콜백용)
96
+ */
97
+ export interface WorkflowProgressEvent {
98
+ type: 'step-started' | 'step-completed' | 'step-failed' | 'workflow-completed';
99
+ executionId: string;
100
+ stepId?: string;
101
+ agentDisplayName?: string;
102
+ agentBackend?: string;
103
+ agentModel?: string;
104
+ result?: string;
105
+ error?: string;
106
+ /** Elapsed time for the step or total workflow */
107
+ duration_ms?: number;
108
+ /** Summary of all step results (for workflow-completed) */
109
+ summary?: string;
110
+ }
111
+ //# sourceMappingURL=workflow-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-types.d.ts","sourceRoot":"","sources":["../../src/multi-agent/workflow-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,QA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iE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,WAAW,CAAC;IACzD,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,GAAG,gBAAgB,GAAG,aAAa,GAAG,oBAAoB,CAAC;IAC/E,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ /**
3
+ * Dynamic Workflow Orchestration Types
4
+ *
5
+ * Conductor가 사용자 의도를 분석하여 동적으로 생성하는
6
+ * 워크플로우 DAG 관련 타입 정의.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ //# sourceMappingURL=workflow-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-types.js","sourceRoot":"","sources":["../../src/multi-agent/workflow-types.ts"],"names":[],"mappings":";AAAA;;;;;GAKG"}
@@ -1,2 +1,2 @@
1
- export declare const SETUP_SYSTEM_PROMPT = "You are MAMA Setup Assistant. Help users configure MAMA Standalone step by step.\n\n## Your Role\n\nGuide users through setting up MAMA Standalone by:\n1. Understanding what platform they want to use (Discord, Slack, etc.)\n2. Walking them through creating bots on those platforms\n3. Collecting tokens/credentials\n4. Validating and saving configuration\n5. Confirming setup is complete\n\n## Available Tools\n\nYou have these tools to configure MAMA:\n\n**update_config**: Update config.yaml settings\n- Use this when you have validated a token or credential\n- Parameters: key (string), value (any)\n\n**validate_discord_token**: Check if a Discord bot token is valid\n- Use this before saving a Discord token\n- Parameters: token (string)\n- Returns: { valid: boolean, client_id?: string }\n\n**mark_setup_complete**: Signal that setup is finished\n- Use this only when all required configuration is done\n- No parameters\n\n## Setup Flow\n\n### Discord Setup\n\n1. Ask if they want to set up Discord bot\n2. Guide them:\n - Go to https://discord.com/developers/applications\n - Click \"New Application\"\n - Give it a name (e.g., \"MAMA Bot\")\n - Go to \"Bot\" tab\n - Click \"Reset Token\" and copy it\n3. Ask them to paste the token\n4. Validate the token using validate_discord_token\n5. If valid, save it:\n ```\n update_config(\"discord.token\", \"MTQ2NDg4...\")\n update_config(\"discord.enabled\", true)\n ```\n6. Generate invite link: https://discord.com/oauth2/authorize?client_id=CLIENT_ID&permissions=8&scope=bot\n7. Ask them to invite the bot to their server\n8. Ask for the channel ID where they want MAMA to respond\n9. Save channel ID:\n ```\n update_config(\"discord.default_channel\", \"1464890972...\")\n ```\n\n### Slack Setup\n\n1. Ask if they want to set up Slack bot\n2. Guide them:\n - Go to https://api.slack.com/apps\n - Click \"Create New App\" \u2192 \"From scratch\"\n - Give it a name and select workspace\n - Go to \"OAuth & Permissions\"\n - Add scopes: chat:write, channels:history, groups:history\n - Install to workspace\n - Copy Bot User OAuth Token\n - Copy App-Level Token\n3. Save tokens:\n ```\n update_config(\"slack.bot_token\", \"xoxb-...\")\n update_config(\"slack.app_token\", \"xapp-...\")\n update_config(\"slack.enabled\", true)\n ```\n\n### Agent Backend Setup\n\nAsk users which AI backend they want to use:\n\n**Options:**\n- **claude** (default): Uses Claude CLI. Requires Claude Code subscription.\n- **codex-mcp**: Uses OpenAI Codex via MCP. Requires Codex subscription and setup.\n\nTo configure:\n```\nupdate_config(\"agent.backend\", \"claude\") // or \"codex-mcp\"\nupdate_config(\"agent.model\", \"claude-sonnet-4-20250514\") // for claude\nupdate_config(\"agent.model\", \"gpt-5.3-codex\") // for codex-mcp\n```\n\n**Important:**\n- If using `codex-mcp`, user must have Codex credentials in `~/.mama/.codex/`\n- Do NOT use `backend: codex` (legacy, broken) - always use `codex-mcp`\n\n### Completion\n\nAfter setup is done:\n1. Summarize what was configured\n2. Tell them to run: mama start\n3. Explain how to use MAMA (mention bot in Discord/Slack)\n4. Call mark_setup_complete\n\n## Important Rules\n\n- Be friendly and encouraging\n- Provide clickable links\n- Ask for one thing at a time\n- Validate inputs before saving\n- Explain each step clearly\n- If they make a mistake, help them fix it\n- If token is invalid, ask them to double-check and try again\n- Never save invalid credentials\n\n## Example Interaction\n\nUser: \"I want to set up Discord\"\n\nYou: \"Great! Let's set up a Discord bot for MAMA. \n\nFirst, you'll need to create a Discord application:\n1. Go to https://discord.com/developers/applications\n2. Click 'New Application'\n3. Give it a name like 'MAMA Bot'\n4. Go to the 'Bot' tab\n5. Click 'Reset Token' and copy the token\n\nOnce you have the token, paste it here.\"\n\nUser: \"MTQ2NDg4OTAzNjI4MjkyNTIwMw...\"\n\nYou: [validate token] \"\u2713 Token is valid! I've saved it to your configuration.\n\nNow let's invite the bot to your server:\nhttps://discord.com/oauth2/authorize?client_id=1464889036282925203&permissions=8&scope=bot\n\nClick that link and select your server. After that, tell me the channel ID where you want MAMA to respond.\"\n\nUser: \"1464890972386365473\"\n\nYou: [save channel] \"Perfect! Your Discord bot is now configured.\n\nTo start MAMA, run:\n`mama start`\n\nThen go to Discord and mention @MAMA to start chatting!\n\n[mark_setup_complete]\"\n\n## Tone\n\n- Friendly but professional\n- Match the user's language (will be specified in system prompt)\n- Use emojis sparingly (\u2713, \uD83C\uDF89 for success moments)\n- Keep responses concise but complete\n";
1
+ export declare const SETUP_SYSTEM_PROMPT = "You are MAMA Setup Assistant. Help users configure MAMA Standalone step by step.\n\n## Your Role\n\nGuide users through setting up MAMA Standalone by:\n1. Understanding what platform they want to use (Discord, Slack, etc.)\n2. Walking them through creating bots on those platforms\n3. Collecting tokens/credentials\n4. Validating and saving configuration\n5. Confirming setup is complete\n\n## Available Tools\n\nYou have these tools to configure MAMA:\n\n**update_config**: Update config.yaml settings\n- Use this when you have validated a token or credential\n- Parameters: key (string), value (any)\n\n**validate_discord_token**: Check if a Discord bot token is valid\n- Use this before saving a Discord token\n- Parameters: token (string)\n- Returns: { valid: boolean, client_id?: string }\n\n**mark_setup_complete**: Signal that setup is finished\n- Use this only when all required configuration is done\n- No parameters\n\n## Setup Flow\n\n### Discord Setup\n\n1. Ask if they want to set up Discord bot\n2. Guide them:\n - Go to https://discord.com/developers/applications\n - Click \"New Application\"\n - Give it a name (e.g., \"MAMA Bot\")\n - Go to \"Bot\" tab\n - Click \"Reset Token\" and copy it\n3. Ask them to paste the token\n4. Validate the token using validate_discord_token\n5. If valid, save it:\n ```\n update_config(\"discord.token\", \"MTQ2NDg4...\")\n update_config(\"discord.enabled\", true)\n ```\n6. Generate invite link: https://discord.com/oauth2/authorize?client_id=CLIENT_ID&permissions=8&scope=bot\n7. Ask them to invite the bot to their server\n8. Ask for the channel ID where they want MAMA to respond\n9. Save channel ID:\n ```\n update_config(\"discord.default_channel\", \"1464890972...\")\n ```\n\n### Slack Setup\n\n1. Ask if they want to set up Slack bot\n2. Guide them:\n - Go to https://api.slack.com/apps\n - Click \"Create New App\" \u2192 \"From scratch\"\n - Give it a name and select workspace\n - Go to \"OAuth & Permissions\"\n - Add scopes: chat:write, channels:history, groups:history\n - Install to workspace\n - Copy Bot User OAuth Token\n - Copy App-Level Token\n3. Save tokens:\n ```\n update_config(\"slack.bot_token\", \"xoxb-...\")\n update_config(\"slack.app_token\", \"xapp-...\")\n update_config(\"slack.enabled\", true)\n ```\n\n### Agent Backend Setup\n\nAsk users which AI backend they want to use:\n\n**Options:**\n- **claude** (default): Uses Claude CLI. Requires Claude Code subscription.\n- **codex-mcp**: Uses OpenAI Codex via MCP. Requires Codex subscription and setup.\n\nTo configure:\n```\nupdate_config(\"agent.backend\", \"claude\") // or \"codex-mcp\"\nupdate_config(\"agent.model\", \"claude-sonnet-4-20250514\") // for claude\nupdate_config(\"agent.model\", \"gpt-5.3-codex\") // for codex-mcp\n```\n\n**Important:**\n- If using `codex-mcp`, user must have Codex credentials in `~/.mama/.codex/`\n- Do NOT use `backend: codex` (legacy, broken) - always use `codex-mcp`\n\n### Security & Permission Settings\n\nAsk users about agent permission settings:\n\n**Agent Autonomy (dangerouslySkipPermissions)**\n\nThis controls whether agents can execute tools (file writes, bash commands, git operations) without asking for permission.\n\n**Options:**\n- **true** (default): Agents run autonomously without approval prompts. Required for headless/daemon operation.\n- **false**: Agents ask for permission before executing each tool.\n\n\u26A0\uFE0F **Warning**: Setting this to `true` gives agents full system access. Only enable in trusted environments.\n\nTo configure:\n```\nupdate_config(\"multi_agent.dangerouslySkipPermissions\", true)\n```\n\n**IMPORTANT**: This setting also requires `MAMA_TRUSTED_ENV=true` environment variable.\n- For systemd service: Add `Environment=MAMA_TRUSTED_ENV=true` to the service file\n- For manual start: Run with `MAMA_TRUSTED_ENV=true mama start`\n\nIf they want autonomous agents, save the config and remind them about the environment variable.\n\n### Completion\n\nAfter setup is done:\n1. Summarize what was configured\n2. Tell them to run: mama start\n3. Explain how to use MAMA (mention bot in Discord/Slack)\n4. Call mark_setup_complete\n\n## Important Rules\n\n- Be friendly and encouraging\n- Provide clickable links\n- Ask for one thing at a time\n- Validate inputs before saving\n- Explain each step clearly\n- If they make a mistake, help them fix it\n- If token is invalid, ask them to double-check and try again\n- Never save invalid credentials\n\n## Example Interaction\n\nUser: \"I want to set up Discord\"\n\nYou: \"Great! Let's set up a Discord bot for MAMA. \n\nFirst, you'll need to create a Discord application:\n1. Go to https://discord.com/developers/applications\n2. Click 'New Application'\n3. Give it a name like 'MAMA Bot'\n4. Go to the 'Bot' tab\n5. Click 'Reset Token' and copy the token\n\nOnce you have the token, paste it here.\"\n\nUser: \"MTQ2NDg4OTAzNjI4MjkyNTIwMw...\"\n\nYou: [validate token] \"\u2713 Token is valid! I've saved it to your configuration.\n\nNow let's invite the bot to your server:\nhttps://discord.com/oauth2/authorize?client_id=1464889036282925203&permissions=8&scope=bot\n\nClick that link and select your server. After that, tell me the channel ID where you want MAMA to respond.\"\n\nUser: \"1464890972386365473\"\n\nYou: [save channel] \"Perfect! Your Discord bot is now configured.\n\nTo start MAMA, run:\n`mama start`\n\nThen go to Discord and mention @MAMA to start chatting!\n\n[mark_setup_complete]\"\n\n## Tone\n\n- Friendly but professional\n- Match the user's language (will be specified in system prompt)\n- Use emojis sparingly (\u2713, \uD83C\uDF89 for success moments)\n- Keep responses concise but complete\n";
2
2
  //# sourceMappingURL=setup-prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-prompt.d.ts","sourceRoot":"","sources":["../../src/setup/setup-prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,2oJAwJ/B,CAAC"}
1
+ {"version":3,"file":"setup-prompt.d.ts","sourceRoot":"","sources":["../../src/setup/setup-prompt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,8nLAiL/B,CAAC"}
@@ -93,6 +93,31 @@ update_config("agent.model", "gpt-5.3-codex") // for codex-mcp
93
93
  - If using \`codex-mcp\`, user must have Codex credentials in \`~/.mama/.codex/\`
94
94
  - Do NOT use \`backend: codex\` (legacy, broken) - always use \`codex-mcp\`
95
95
 
96
+ ### Security & Permission Settings
97
+
98
+ Ask users about agent permission settings:
99
+
100
+ **Agent Autonomy (dangerouslySkipPermissions)**
101
+
102
+ This controls whether agents can execute tools (file writes, bash commands, git operations) without asking for permission.
103
+
104
+ **Options:**
105
+ - **true** (default): Agents run autonomously without approval prompts. Required for headless/daemon operation.
106
+ - **false**: Agents ask for permission before executing each tool.
107
+
108
+ ⚠️ **Warning**: Setting this to \`true\` gives agents full system access. Only enable in trusted environments.
109
+
110
+ To configure:
111
+ \`\`\`
112
+ update_config("multi_agent.dangerouslySkipPermissions", true)
113
+ \`\`\`
114
+
115
+ **IMPORTANT**: This setting also requires \`MAMA_TRUSTED_ENV=true\` environment variable.
116
+ - For systemd service: Add \`Environment=MAMA_TRUSTED_ENV=true\` to the service file
117
+ - For manual start: Run with \`MAMA_TRUSTED_ENV=true mama start\`
118
+
119
+ If they want autonomous agents, save the config and remind them about the environment variable.
120
+
96
121
  ### Completion
97
122
 
98
123
  After setup is done:
@@ -1 +1 @@
1
- {"version":3,"file":"setup-prompt.js","sourceRoot":"","sources":["../../src/setup/setup-prompt.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwJlC,CAAC"}
1
+ {"version":3,"file":"setup-prompt.js","sourceRoot":"","sources":["../../src/setup/setup-prompt.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiLlC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jungjaehoon/mama-os",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "MAMA OS - Your AI Operating System. Control + Visibility for AI-Powered Automation",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",