@jungjaehoon/mama-os 0.29.1 → 0.30.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/dist/agent/agent-loop.d.ts +1 -12
- package/dist/agent/agent-loop.d.ts.map +1 -1
- package/dist/agent/agent-loop.js +6 -21
- package/dist/agent/agent-loop.js.map +1 -1
- package/dist/agent/code-act/constants.d.ts.map +1 -1
- package/dist/agent/code-act/constants.js +2 -4
- package/dist/agent/code-act/constants.js.map +1 -1
- package/dist/agent/code-act/host-bridge.d.ts.map +1 -1
- package/dist/agent/code-act/host-bridge.js +1 -290
- package/dist/agent/code-act/host-bridge.js.map +1 -1
- package/dist/agent/code-act/types.d.ts +1 -1
- package/dist/agent/code-act/types.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.d.ts +1 -124
- package/dist/agent/gateway-tool-executor.d.ts.map +1 -1
- package/dist/agent/gateway-tool-executor.js +18 -1163
- package/dist/agent/gateway-tool-executor.js.map +1 -1
- package/dist/agent/gateway-tools.md +0 -38
- package/dist/agent/os-agent-capabilities.md +0 -14
- package/dist/agent/tool-registry.d.ts +1 -1
- package/dist/agent/tool-registry.d.ts.map +1 -1
- package/dist/agent/tool-registry.js +0 -183
- package/dist/agent/tool-registry.js.map +1 -1
- package/dist/agent/types.d.ts +2 -110
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/api/graph-api-types.d.ts +0 -25
- package/dist/api/graph-api-types.d.ts.map +1 -1
- package/dist/api/graph-api.d.ts.map +1 -1
- package/dist/api/graph-api.js +0 -50
- package/dist/api/graph-api.js.map +1 -1
- package/dist/cli/commands/start.d.ts +18 -0
- package/dist/cli/commands/start.d.ts.map +1 -1
- package/dist/cli/commands/start.js +180 -42
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/config/types.d.ts +21 -0
- package/dist/cli/config/types.d.ts.map +1 -1
- package/dist/cli/config/types.js +7 -0
- package/dist/cli/config/types.js.map +1 -1
- package/dist/cli/runtime/api-routes-init.d.ts.map +1 -1
- package/dist/cli/runtime/api-routes-init.js +0 -3
- package/dist/cli/runtime/api-routes-init.js.map +1 -1
- package/dist/cli/runtime/gateway-wiring.d.ts +1 -1
- package/dist/cli/runtime/gateway-wiring.js +1 -1
- package/dist/gateways/discord.d.ts.map +1 -1
- package/dist/gateways/discord.js +0 -8
- package/dist/gateways/discord.js.map +1 -1
- package/dist/gateways/message-router.d.ts +13 -0
- package/dist/gateways/message-router.d.ts.map +1 -1
- package/dist/gateways/message-router.js +36 -0
- package/dist/gateways/message-router.js.map +1 -1
- package/dist/multi-agent/agent-process-manager.d.ts.map +1 -1
- package/dist/multi-agent/agent-process-manager.js +4 -3
- package/dist/multi-agent/agent-process-manager.js.map +1 -1
- package/dist/multi-agent/tool-permission-manager.d.ts +0 -5
- package/dist/multi-agent/tool-permission-manager.d.ts.map +1 -1
- package/dist/multi-agent/tool-permission-manager.js +0 -40
- package/dist/multi-agent/tool-permission-manager.js.map +1 -1
- package/dist/operator/board-reground.d.ts +19 -0
- package/dist/operator/board-reground.d.ts.map +1 -0
- package/dist/operator/board-reground.js +31 -0
- package/dist/operator/board-reground.js.map +1 -0
- package/dist/operator/conductor-inbox.d.ts +73 -0
- package/dist/operator/conductor-inbox.d.ts.map +1 -0
- package/dist/operator/conductor-inbox.js +184 -0
- package/dist/operator/conductor-inbox.js.map +1 -0
- package/dist/operator/conductor-session.d.ts +55 -0
- package/dist/operator/conductor-session.d.ts.map +1 -0
- package/dist/operator/conductor-session.js +110 -0
- package/dist/operator/conductor-session.js.map +1 -0
- package/dist/operator/conductor.d.ts +68 -0
- package/dist/operator/conductor.d.ts.map +1 -0
- package/dist/operator/conductor.js +84 -0
- package/dist/operator/conductor.js.map +1 -0
- package/dist/operator/operator-trigger-loop.d.ts +13 -0
- package/dist/operator/operator-trigger-loop.d.ts.map +1 -1
- package/dist/operator/operator-trigger-loop.js +39 -8
- package/dist/operator/operator-trigger-loop.js.map +1 -1
- package/dist/operator/report-run.d.ts +8 -2
- package/dist/operator/report-run.d.ts.map +1 -1
- package/dist/operator/report-run.js +9 -9
- package/dist/operator/report-run.js.map +1 -1
- package/dist/operator/trigger-author.d.ts +0 -1
- package/dist/operator/trigger-author.d.ts.map +1 -1
- package/dist/operator/trigger-author.js +24 -3
- package/dist/operator/trigger-author.js.map +1 -1
- package/dist/operator/workorder-consumer.d.ts +2 -0
- package/dist/operator/workorder-consumer.d.ts.map +1 -1
- package/dist/operator/workorder-consumer.js +57 -8
- package/dist/operator/workorder-consumer.js.map +1 -1
- package/package.json +1 -2
- package/public/viewer/src/utils/api.ts +0 -10
- package/scripts/backfill-channel-keys.ts +75 -17
- package/dist/multi-agent/conductor-persona.d.ts +0 -13
- package/dist/multi-agent/conductor-persona.d.ts.map +0 -1
- package/dist/multi-agent/conductor-persona.js +0 -157
- package/dist/multi-agent/conductor-persona.js.map +0 -1
- package/dist/tools/browser-tool.d.ts +0 -164
- package/dist/tools/browser-tool.d.ts.map +0 -1
- package/dist/tools/browser-tool.js +0 -315
- package/dist/tools/browser-tool.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jungjaehoon/mama-os",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "MAMA OS - Local AI Runtime. Your scattered knowledge, organized by AI agents that never sleep.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -77,7 +77,6 @@
|
|
|
77
77
|
"minimatch": "^10.1.1",
|
|
78
78
|
"multer": "^2.0.2",
|
|
79
79
|
"node-cron": "^3.0.3",
|
|
80
|
-
"playwright": "^1.58.1",
|
|
81
80
|
"quickjs-emscripten": "^0.32.0",
|
|
82
81
|
"sharp": "^0.34.5",
|
|
83
82
|
"ws": "^8.18.0"
|
|
@@ -255,16 +255,6 @@ export interface MultiAgentAgentsResponse {
|
|
|
255
255
|
export interface MultiAgentDashboardStatus {
|
|
256
256
|
enabled: boolean;
|
|
257
257
|
agents: MultiAgentAgent[];
|
|
258
|
-
recentDelegations?: {
|
|
259
|
-
id?: string;
|
|
260
|
-
description?: string;
|
|
261
|
-
category?: string;
|
|
262
|
-
wave?: number;
|
|
263
|
-
status?: string;
|
|
264
|
-
claimedBy?: string | null;
|
|
265
|
-
claimedAt?: number | null;
|
|
266
|
-
completedAt?: number | null;
|
|
267
|
-
}[];
|
|
268
258
|
activeChains?: number;
|
|
269
259
|
}
|
|
270
260
|
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* 1..N sequences; the moved rows are renumbered above the target's high-water mark
|
|
42
42
|
* rather than left to abort the transaction on the unique index.
|
|
43
43
|
*/
|
|
44
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
44
|
+
import { existsSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
|
|
45
45
|
import { homedir } from 'node:os';
|
|
46
46
|
import { join } from 'node:path';
|
|
47
47
|
import Database from 'better-sqlite3';
|
|
@@ -356,6 +356,79 @@ export function runningDaemonPid(): number | null {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
/**
|
|
360
|
+
* Carry the delta cursors, then rekey the rows - in that order, and not the other one.
|
|
361
|
+
*
|
|
362
|
+
* Cursors are carried BEFORE the rekey commits, and the direction is not arbitrary.
|
|
363
|
+
*
|
|
364
|
+
* The two halves of this migration live in different stores - rows in SQLite, delta
|
|
365
|
+
* cursors in a JSON file - so no transaction spans them and a crash can land between.
|
|
366
|
+
* Both orders leave an inconsistent pair; they are not equally bad:
|
|
367
|
+
*
|
|
368
|
+
* rekey first, then cursors -> rows under the new key, cursors still on the old one.
|
|
369
|
+
* `drainNew` finds no cursor for the new key and starts
|
|
370
|
+
* from 0, REDELIVERING every event in the partition -
|
|
371
|
+
* the exact outcome the merge rules exist to prevent.
|
|
372
|
+
* Re-running does not heal it: the plan finds no old
|
|
373
|
+
* keys left to rekey, so the cursors are never carried.
|
|
374
|
+
*
|
|
375
|
+
* cursors first, then rekey -> cursors on the new key, rows still under the old one.
|
|
376
|
+
* The partition stalls, delivering nothing new until the
|
|
377
|
+
* script is re-run - and a re-run DOES heal it, because
|
|
378
|
+
* the rows are still there to be found and re-planned.
|
|
379
|
+
*
|
|
380
|
+
* A recoverable stall beats an unrecoverable flood, so cursors go first. If the rekey then
|
|
381
|
+
* fails, the file is restored from the pre-image rather than left ahead of the rows.
|
|
382
|
+
*/
|
|
383
|
+
export function rekeyWithCursorsFirst(
|
|
384
|
+
db: Db,
|
|
385
|
+
plan: Plan,
|
|
386
|
+
cursorPath: string,
|
|
387
|
+
cursors: Record<string, number>
|
|
388
|
+
): Record<string, number> {
|
|
389
|
+
const carried = carryDeltaCursors(cursors, plan.rekeys);
|
|
390
|
+
const cursorsWritten = carried.carried > 0;
|
|
391
|
+
if (cursorsWritten) {
|
|
392
|
+
writeFileSync(`${cursorPath}.before-channel-rekey`, JSON.stringify(cursors, null, 2));
|
|
393
|
+
writeCursorsAtomically(cursorPath, carried.cursors);
|
|
394
|
+
console.log(` delta cursors carried: ${carried.carried}`);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const moved: Record<string, number> = {};
|
|
398
|
+
try {
|
|
399
|
+
const run = db.transaction(() => {
|
|
400
|
+
for (const rekey of plan.rekeys) {
|
|
401
|
+
for (const [table, count] of Object.entries(applyRekey(db, rekey))) {
|
|
402
|
+
moved[table] = (moved[table] ?? 0) + count;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
run();
|
|
407
|
+
} catch (error) {
|
|
408
|
+
if (cursorsWritten) {
|
|
409
|
+
writeCursorsAtomically(cursorPath, cursors);
|
|
410
|
+
console.error(' rekey failed; delta cursors restored to their pre-image');
|
|
411
|
+
}
|
|
412
|
+
throw error;
|
|
413
|
+
}
|
|
414
|
+
return moved;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Replace the cursor file in one step.
|
|
419
|
+
*
|
|
420
|
+
* A plain `writeFileSync` truncates before it writes, so a crash mid-write leaves a
|
|
421
|
+
* half-written JSON file - and an unparseable cursor file is worse than either
|
|
422
|
+
* inconsistent state the ordering above guards against, because every partition falls
|
|
423
|
+
* back to starting from 0 at once. Write beside it, then rename: on the same filesystem
|
|
424
|
+
* the rename is atomic, so a reader sees the old file or the new one, never a partial.
|
|
425
|
+
*/
|
|
426
|
+
export function writeCursorsAtomically(cursorPath: string, cursors: Record<string, number>): void {
|
|
427
|
+
const tmp = `${cursorPath}.tmp`;
|
|
428
|
+
writeFileSync(tmp, JSON.stringify(cursors, null, 2));
|
|
429
|
+
renameSync(tmp, cursorPath);
|
|
430
|
+
}
|
|
431
|
+
|
|
359
432
|
function main(): void {
|
|
360
433
|
const apply = process.argv.includes('--apply');
|
|
361
434
|
const dbPath = process.env.MAMA_DB_PATH ?? join(homedir(), '.mama', 'mama-memory.db');
|
|
@@ -420,26 +493,11 @@ function main(): void {
|
|
|
420
493
|
db.prepare('VACUUM INTO ?').run(backup);
|
|
421
494
|
console.log(`\nbackup: ${backup}`);
|
|
422
495
|
|
|
423
|
-
const moved
|
|
424
|
-
const run = db.transaction(() => {
|
|
425
|
-
for (const rekey of plan.rekeys) {
|
|
426
|
-
for (const [table, count] of Object.entries(applyRekey(db, rekey))) {
|
|
427
|
-
moved[table] = (moved[table] ?? 0) + count;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
});
|
|
431
|
-
run();
|
|
496
|
+
const moved = rekeyWithCursorsFirst(db, plan, cursorPath, cursors);
|
|
432
497
|
|
|
433
498
|
for (const [table, count] of Object.entries(moved)) {
|
|
434
499
|
console.log(` ${table}: ${count}`);
|
|
435
500
|
}
|
|
436
|
-
|
|
437
|
-
const carried = carryDeltaCursors(cursors, plan.rekeys);
|
|
438
|
-
if (carried.carried > 0) {
|
|
439
|
-
writeFileSync(`${cursorPath}.before-channel-rekey`, JSON.stringify(cursors, null, 2));
|
|
440
|
-
writeFileSync(cursorPath, JSON.stringify(carried.cursors, null, 2));
|
|
441
|
-
console.log(` delta cursors carried: ${carried.carried}`);
|
|
442
|
-
}
|
|
443
501
|
db.close();
|
|
444
502
|
}
|
|
445
503
|
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Conductor persona section injector.
|
|
3
|
-
*
|
|
4
|
-
* Unlike Dashboard/Memory/Wiki personas (fully managed, overwritten on upgrade),
|
|
5
|
-
* Conductor persona is user-editable. We only inject specific managed sections
|
|
6
|
-
* (Agent Factory, Agent Monitor) if they are missing, preserving user customizations.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Ensure Conductor persona has Agent Factory + Agent Monitor sections.
|
|
10
|
-
* Does NOT overwrite existing content — only appends missing sections.
|
|
11
|
-
*/
|
|
12
|
-
export declare function ensureConductorPersona(mamaHomeDir?: string): void;
|
|
13
|
-
//# sourceMappingURL=conductor-persona.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conductor-persona.d.ts","sourceRoot":"","sources":["../../src/multi-agent/conductor-persona.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA2GH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,GAAE,MAAiC,GAAG,IAAI,CA4C3F"}
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Conductor persona section injector.
|
|
4
|
-
*
|
|
5
|
-
* Unlike Dashboard/Memory/Wiki personas (fully managed, overwritten on upgrade),
|
|
6
|
-
* Conductor persona is user-editable. We only inject specific managed sections
|
|
7
|
-
* (Agent Factory, Agent Monitor) if they are missing, preserving user customizations.
|
|
8
|
-
*/
|
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.ensureConductorPersona = ensureConductorPersona;
|
|
11
|
-
const fs_1 = require("fs");
|
|
12
|
-
const path_1 = require("path");
|
|
13
|
-
const os_1 = require("os");
|
|
14
|
-
const AGENT_FACTORY_MARKER = '## Agent Factory (v0.19)';
|
|
15
|
-
const AGENT_MONITOR_MARKER = '## Agent Monitor (v0.19)';
|
|
16
|
-
const AGENT_FACTORY_SECTION = `## Agent Factory (v0.19)
|
|
17
|
-
|
|
18
|
-
You can create, test, and manage agents through the lifecycle.
|
|
19
|
-
|
|
20
|
-
### Creating Agents
|
|
21
|
-
|
|
22
|
-
When the user asks to create an agent (Korean or English, e.g. "make an agent"):
|
|
23
|
-
|
|
24
|
-
1. Check connectors: \`kagemusha_overview\` to see available data sources
|
|
25
|
-
2. Read starter template if applicable: \`Read ~/.mama/skills/agent-persona-{type}.md\` (qa, analyst, automation)
|
|
26
|
-
3. Design config: name, model (default: claude-sonnet-4-6), tier (default: 2), system prompt, tools
|
|
27
|
-
4. Present design to user: "[config summary]. Proceed?"
|
|
28
|
-
5. On approval: \`agent_create(id, name, model, tier, system)\`
|
|
29
|
-
6. \`viewer_navigate('agents')\` to show new card
|
|
30
|
-
7. Suggest: "Want to test?"
|
|
31
|
-
|
|
32
|
-
### Testing Agents
|
|
33
|
-
|
|
34
|
-
1. \`agent_test(agent_id)\` or \`agent_test(agent_id, sample_count: 2)\` (demo default: 2)
|
|
35
|
-
- Connector data available: auto-fetches recent items
|
|
36
|
-
- No connector data: provide test_data directly: \`agent_test(agent_id, test_data: [{input: "..."}])\`
|
|
37
|
-
2. Review returned \`results[]\` — each has \`{input, output, error?}\`
|
|
38
|
-
3. Two scores:
|
|
39
|
-
- \`auto_score\` (DB record): pass/fail ratio, auto-saved by agent_test. This is the official score.
|
|
40
|
-
- Your rubric assessment (chat report): analyze on 4 dimensions below. Not saved to DB.
|
|
41
|
-
4. Report: "auto_score: [N]/100 ([passed]/[total]). [rubric commentary]."
|
|
42
|
-
5. If auto_score < 80: suggest specific system prompt improvements
|
|
43
|
-
6. \`agent_update(agent_id, version, {system: improved}, 'Improve: [reason]')\` to create new version
|
|
44
|
-
7. Offer retest: "Retest with v2?" Always show Before/After: "v1: 70 → v2: 95"
|
|
45
|
-
|
|
46
|
-
### Evaluation Rubric (chat commentary only — not saved to DB)
|
|
47
|
-
|
|
48
|
-
When reporting results, provide commentary on:
|
|
49
|
-
- **Accuracy (40%)**: Correct output for each input?
|
|
50
|
-
- **Tool Usage (20%)**: Appropriate tools used?
|
|
51
|
-
- **Output Quality (20%)**: Actionable and relevant?
|
|
52
|
-
- **Error Handling (20%)**: Edge cases handled?
|
|
53
|
-
|
|
54
|
-
### Enabling/Disabling
|
|
55
|
-
|
|
56
|
-
\`agent_update(agent_id, version, {enabled: true/false}, 'Enable/disable')\`
|
|
57
|
-
|
|
58
|
-
### Demo Mode
|
|
59
|
-
|
|
60
|
-
When user says "create and test" (or equivalent in any language):
|
|
61
|
-
Skip intermediate confirmations. Run create → test(sample_count: 2) → evaluate → report in one shot.
|
|
62
|
-
Only pause if auto_score < 50 (critical failure).
|
|
63
|
-
|
|
64
|
-
### Lifecycle
|
|
65
|
-
|
|
66
|
-
Create → Test → Evaluate (inline) → Improve → Retest → Enable`;
|
|
67
|
-
const AGENT_MONITOR_SECTION = `## Agent Monitor (v0.19)
|
|
68
|
-
|
|
69
|
-
During hourly audit, add this agent health check:
|
|
70
|
-
|
|
71
|
-
### Agent Health Check
|
|
72
|
-
|
|
73
|
-
1. Check activity summary via API (NOT mama_search — it searches decisions, not agent_activity):
|
|
74
|
-
- Dashboard Agent fetches \`/api/agents/activity-summary?since={yesterday}\`
|
|
75
|
-
- Or review \`agent_notices({limit: 10})\` for recent agent events
|
|
76
|
-
2. Flag issues:
|
|
77
|
-
- Error rate > 30%: "agent [name] error rate [N]% — investigate"
|
|
78
|
-
- 3+ consecutive errors: "[name] [N] consecutive errors — immediate attention"
|
|
79
|
-
- 24h no activity (for enabled agents): "[name] no activity in 24h — verify"
|
|
80
|
-
3. For each flagged agent:
|
|
81
|
-
- Read recent errors: \`agent_get(agent_id)\` to check status
|
|
82
|
-
- Diagnose: analyze error patterns
|
|
83
|
-
- **Recommend only** (do NOT auto-fix): "Suggested fix: [specific change]. Apply?"
|
|
84
|
-
4. Report in chat + \`viewer_notify\` for urgent items
|
|
85
|
-
|
|
86
|
-
### Validation-Aware Monitoring
|
|
87
|
-
|
|
88
|
-
You receive \`<viewer-context>\` at the start of each message showing what the user sees.
|
|
89
|
-
Use this to give contextual responses — if they're on the Validation tab, discuss metrics.
|
|
90
|
-
If they're on the agent list, summarize which agents need attention.
|
|
91
|
-
|
|
92
|
-
**Active UI guidance:**
|
|
93
|
-
- Use \`viewer_navigate("agents")\` to show the agent list
|
|
94
|
-
- Use \`viewer_navigate("agents", {id: agentId})\` to show an enabled agent detail
|
|
95
|
-
- Use \`viewer_notify({type: "warning", message: "[agentId] regressed: latency 70s > 60s threshold"})\` for alerts
|
|
96
|
-
- After running \`agent_test\`, navigate to validation tab: \`viewer_navigate("agents", {id: agentId})\` and tell user to check the Validation tab
|
|
97
|
-
|
|
98
|
-
**Validation checks during audit:**
|
|
99
|
-
1. Check each agent: \`viewer_state()\` shows current validation outcomes on agent cards
|
|
100
|
-
2. \`regressed\`: flag immediately — tell user which metric exceeded threshold
|
|
101
|
-
3. \`inconclusive\`: evidence missing — run \`agent_test(agent_id)\` to collect data
|
|
102
|
-
4. \`healthy\` / \`improved\`: no action
|
|
103
|
-
5. After checking, navigate user to the worst agent's validation tab
|
|
104
|
-
|
|
105
|
-
### Daily Briefing Contribution
|
|
106
|
-
|
|
107
|
-
When generating daily briefing, include agent activity:
|
|
108
|
-
- Total delegations today
|
|
109
|
-
- Per-agent completion rate
|
|
110
|
-
- Validation status per agent (healthy/improved/regressed/inconclusive)
|
|
111
|
-
- Any active alerts`;
|
|
112
|
-
/**
|
|
113
|
-
* Ensure Conductor persona has Agent Factory + Agent Monitor sections.
|
|
114
|
-
* Does NOT overwrite existing content — only appends missing sections.
|
|
115
|
-
*/
|
|
116
|
-
function ensureConductorPersona(mamaHomeDir = (0, path_1.join)((0, os_1.homedir)(), '.mama')) {
|
|
117
|
-
const personaDir = (0, path_1.join)(mamaHomeDir, 'personas');
|
|
118
|
-
const personaPath = (0, path_1.join)(personaDir, 'conductor.md');
|
|
119
|
-
if (!(0, fs_1.existsSync)(personaDir)) {
|
|
120
|
-
(0, fs_1.mkdirSync)(personaDir, { recursive: true });
|
|
121
|
-
}
|
|
122
|
-
if (!(0, fs_1.existsSync)(personaPath)) {
|
|
123
|
-
// No conductor persona at all — skip (created during onboarding)
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
let content = (0, fs_1.readFileSync)(personaPath, 'utf-8');
|
|
127
|
-
let modified = false;
|
|
128
|
-
// Inject Agent Factory section if missing
|
|
129
|
-
if (!content.includes(AGENT_FACTORY_MARKER)) {
|
|
130
|
-
// Insert before "## Agent Result Querying" if it exists, otherwise append
|
|
131
|
-
const insertPoint = content.indexOf('## Agent Result Querying');
|
|
132
|
-
if (insertPoint >= 0) {
|
|
133
|
-
content =
|
|
134
|
-
content.slice(0, insertPoint) + AGENT_FACTORY_SECTION + '\n\n' + content.slice(insertPoint);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
content += '\n\n' + AGENT_FACTORY_SECTION;
|
|
138
|
-
}
|
|
139
|
-
modified = true;
|
|
140
|
-
}
|
|
141
|
-
// Inject Agent Monitor section if missing
|
|
142
|
-
if (!content.includes(AGENT_MONITOR_MARKER)) {
|
|
143
|
-
const insertPoint = content.indexOf('## Skill Management');
|
|
144
|
-
if (insertPoint >= 0) {
|
|
145
|
-
content =
|
|
146
|
-
content.slice(0, insertPoint) + AGENT_MONITOR_SECTION + '\n\n' + content.slice(insertPoint);
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
content += '\n\n' + AGENT_MONITOR_SECTION;
|
|
150
|
-
}
|
|
151
|
-
modified = true;
|
|
152
|
-
}
|
|
153
|
-
if (modified) {
|
|
154
|
-
(0, fs_1.writeFileSync)(personaPath, content, 'utf-8');
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
//# sourceMappingURL=conductor-persona.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"conductor-persona.js","sourceRoot":"","sources":["../../src/multi-agent/conductor-persona.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AA+GH,wDA4CC;AAzJD,2BAAwE;AACxE,+BAA4B;AAC5B,2BAA6B;AAE7B,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AACxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAkDgC,CAAC;AAE/D,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBA4CV,CAAC;AAErB;;;GAGG;AACH,SAAgB,sBAAsB,CAAC,cAAsB,IAAA,WAAI,EAAC,IAAA,YAAO,GAAE,EAAE,OAAO,CAAC;IACnF,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IAErD,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC5B,IAAA,cAAS,EAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,IAAA,eAAU,EAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,iEAAiE;QACjE,OAAO;IACT,CAAC;IAED,IAAI,OAAO,GAAG,IAAA,iBAAY,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACjD,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,0CAA0C;IAC1C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC5C,0EAA0E;QAC1E,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;QAChE,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,qBAAqB,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChG,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,MAAM,GAAG,qBAAqB,CAAC;QAC5C,CAAC;QACD,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,0CAA0C;IAC1C,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC5C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QAC3D,IAAI,WAAW,IAAI,CAAC,EAAE,CAAC;YACrB,OAAO;gBACL,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,GAAG,qBAAqB,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAChG,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,MAAM,GAAG,qBAAqB,CAAC;QAC5C,CAAC;QACD,QAAQ,GAAG,IAAI,CAAC;IAClB,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,IAAA,kBAAa,EAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser Tool
|
|
3
|
-
*
|
|
4
|
-
* Playwright-based browser automation for MAMA
|
|
5
|
-
* Migrated from Puppeteer for better stability and multi-browser support
|
|
6
|
-
*/
|
|
7
|
-
export interface BrowserToolConfig {
|
|
8
|
-
/** Headless mode (default: true) */
|
|
9
|
-
headless?: boolean;
|
|
10
|
-
/** Default viewport width */
|
|
11
|
-
viewportWidth?: number;
|
|
12
|
-
/** Default viewport height */
|
|
13
|
-
viewportHeight?: number;
|
|
14
|
-
/** Screenshot output directory */
|
|
15
|
-
screenshotDir?: string;
|
|
16
|
-
/** Browser type: chromium, firefox, webkit (default: chromium) */
|
|
17
|
-
browserType?: 'chromium' | 'firefox' | 'webkit';
|
|
18
|
-
}
|
|
19
|
-
export declare class BrowserTool {
|
|
20
|
-
private config;
|
|
21
|
-
private browser;
|
|
22
|
-
private context;
|
|
23
|
-
private page;
|
|
24
|
-
constructor(config?: BrowserToolConfig);
|
|
25
|
-
/**
|
|
26
|
-
* Launch browser if not already running
|
|
27
|
-
*/
|
|
28
|
-
launch(): Promise<void>;
|
|
29
|
-
/**
|
|
30
|
-
* Close browser
|
|
31
|
-
*/
|
|
32
|
-
close(): Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Ensure browser is running
|
|
35
|
-
*/
|
|
36
|
-
private ensureBrowser;
|
|
37
|
-
private screenshotPaths;
|
|
38
|
-
private removeOwnedArtifact;
|
|
39
|
-
/**
|
|
40
|
-
* Navigate to URL
|
|
41
|
-
*/
|
|
42
|
-
navigate(url: string): Promise<{
|
|
43
|
-
success: boolean;
|
|
44
|
-
title: string;
|
|
45
|
-
url: string;
|
|
46
|
-
}>;
|
|
47
|
-
/**
|
|
48
|
-
* Take screenshot
|
|
49
|
-
*/
|
|
50
|
-
screenshot(filename?: string, signal?: AbortSignal): Promise<{
|
|
51
|
-
success: boolean;
|
|
52
|
-
path: string;
|
|
53
|
-
}>;
|
|
54
|
-
/**
|
|
55
|
-
* Take full page screenshot
|
|
56
|
-
*/
|
|
57
|
-
screenshotFullPage(filename?: string, signal?: AbortSignal): Promise<{
|
|
58
|
-
success: boolean;
|
|
59
|
-
path: string;
|
|
60
|
-
}>;
|
|
61
|
-
/**
|
|
62
|
-
* Click element by selector
|
|
63
|
-
* Playwright auto-waits for element to be actionable
|
|
64
|
-
*/
|
|
65
|
-
click(selector: string): Promise<{
|
|
66
|
-
success: boolean;
|
|
67
|
-
}>;
|
|
68
|
-
/**
|
|
69
|
-
* Type text into element
|
|
70
|
-
* Playwright auto-waits for element to be ready
|
|
71
|
-
*/
|
|
72
|
-
type(selector: string, text: string): Promise<{
|
|
73
|
-
success: boolean;
|
|
74
|
-
}>;
|
|
75
|
-
/**
|
|
76
|
-
* Wait for selector
|
|
77
|
-
*/
|
|
78
|
-
waitFor(selector: string, timeout?: number): Promise<{
|
|
79
|
-
success: boolean;
|
|
80
|
-
}>;
|
|
81
|
-
/**
|
|
82
|
-
* Get page content (HTML)
|
|
83
|
-
*/
|
|
84
|
-
getContent(): Promise<{
|
|
85
|
-
success: boolean;
|
|
86
|
-
html: string;
|
|
87
|
-
}>;
|
|
88
|
-
/**
|
|
89
|
-
* Get page text content
|
|
90
|
-
*/
|
|
91
|
-
getText(): Promise<{
|
|
92
|
-
success: boolean;
|
|
93
|
-
text: string;
|
|
94
|
-
}>;
|
|
95
|
-
/**
|
|
96
|
-
* Evaluate JavaScript in page
|
|
97
|
-
*/
|
|
98
|
-
evaluate(script: string): Promise<{
|
|
99
|
-
success: boolean;
|
|
100
|
-
result: unknown;
|
|
101
|
-
}>;
|
|
102
|
-
/**
|
|
103
|
-
* Get element text by selector
|
|
104
|
-
*/
|
|
105
|
-
getElementText(selector: string): Promise<{
|
|
106
|
-
success: boolean;
|
|
107
|
-
text: string | null;
|
|
108
|
-
}>;
|
|
109
|
-
/**
|
|
110
|
-
* Get all elements matching selector
|
|
111
|
-
*/
|
|
112
|
-
queryAll(selector: string): Promise<{
|
|
113
|
-
success: boolean;
|
|
114
|
-
count: number;
|
|
115
|
-
texts: string[];
|
|
116
|
-
}>;
|
|
117
|
-
/**
|
|
118
|
-
* Scroll page
|
|
119
|
-
*/
|
|
120
|
-
scroll(direction: 'up' | 'down' | 'top' | 'bottom', amount?: number): Promise<{
|
|
121
|
-
success: boolean;
|
|
122
|
-
}>;
|
|
123
|
-
/**
|
|
124
|
-
* Press keyboard key
|
|
125
|
-
*/
|
|
126
|
-
press(key: string): Promise<{
|
|
127
|
-
success: boolean;
|
|
128
|
-
}>;
|
|
129
|
-
/**
|
|
130
|
-
* Go back
|
|
131
|
-
*/
|
|
132
|
-
goBack(): Promise<{
|
|
133
|
-
success: boolean;
|
|
134
|
-
}>;
|
|
135
|
-
/**
|
|
136
|
-
* Go forward
|
|
137
|
-
*/
|
|
138
|
-
goForward(): Promise<{
|
|
139
|
-
success: boolean;
|
|
140
|
-
}>;
|
|
141
|
-
/**
|
|
142
|
-
* Reload page
|
|
143
|
-
*/
|
|
144
|
-
reload(): Promise<{
|
|
145
|
-
success: boolean;
|
|
146
|
-
}>;
|
|
147
|
-
/**
|
|
148
|
-
* Get current URL
|
|
149
|
-
*/
|
|
150
|
-
getUrl(): string | null;
|
|
151
|
-
/**
|
|
152
|
-
* Check if browser is running
|
|
153
|
-
*/
|
|
154
|
-
isRunning(): boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Take a PDF of the page (Chromium only)
|
|
157
|
-
*/
|
|
158
|
-
pdf(filename?: string): Promise<{
|
|
159
|
-
success: boolean;
|
|
160
|
-
path: string;
|
|
161
|
-
}>;
|
|
162
|
-
}
|
|
163
|
-
export declare function getBrowserTool(config?: BrowserToolConfig): BrowserTool;
|
|
164
|
-
//# sourceMappingURL=browser-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browser-tool.d.ts","sourceRoot":"","sources":["../../src/tools/browser-tool.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8BAA8B;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,kCAAkC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kEAAkE;IAClE,WAA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