@zhixuan92/multi-model-agent 5.0.3 → 5.2.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.
Files changed (122) hide show
  1. package/README.md +6 -5
  2. package/dist/cli/serve.d.ts.map +1 -1
  3. package/dist/cli/serve.js +9 -34
  4. package/dist/cli/serve.js.map +1 -1
  5. package/dist/cli/status.js +1 -1
  6. package/dist/cli/status.js.map +1 -1
  7. package/dist/http/handler-deps.d.ts +3 -3
  8. package/dist/http/handler-deps.d.ts.map +1 -1
  9. package/dist/http/handlers/control/context-blocks.d.ts +1 -2
  10. package/dist/http/handlers/control/context-blocks.d.ts.map +1 -1
  11. package/dist/http/handlers/control/context-blocks.js +7 -30
  12. package/dist/http/handlers/control/context-blocks.js.map +1 -1
  13. package/dist/http/handlers/introspection/status.d.ts +3 -3
  14. package/dist/http/handlers/introspection/status.d.ts.map +1 -1
  15. package/dist/http/handlers/introspection/status.js +13 -31
  16. package/dist/http/handlers/introspection/status.js.map +1 -1
  17. package/dist/http/handlers/unified-task.d.ts +5 -0
  18. package/dist/http/handlers/unified-task.d.ts.map +1 -0
  19. package/dist/http/handlers/unified-task.js +520 -0
  20. package/dist/http/handlers/unified-task.js.map +1 -0
  21. package/dist/http/project-registry.d.ts +5 -4
  22. package/dist/http/project-registry.d.ts.map +1 -1
  23. package/dist/http/project-registry.js +5 -7
  24. package/dist/http/project-registry.js.map +1 -1
  25. package/dist/http/server.d.ts +4 -3
  26. package/dist/http/server.d.ts.map +1 -1
  27. package/dist/http/server.js +76 -134
  28. package/dist/http/server.js.map +1 -1
  29. package/dist/skill-install/discover.d.ts +1 -1
  30. package/dist/skill-install/discover.d.ts.map +1 -1
  31. package/dist/skill-install/discover.js +1 -0
  32. package/dist/skill-install/discover.js.map +1 -1
  33. package/dist/skills/_shared/error-handling.md +2 -2
  34. package/dist/skills/_shared/polling.md +7 -7
  35. package/dist/skills/_shared/response-shape.md +8 -8
  36. package/dist/skills/_shared/review-policy.md +1 -3
  37. package/dist/skills/mma-audit/SKILL.md +16 -15
  38. package/dist/skills/mma-context-blocks/SKILL.md +9 -9
  39. package/dist/skills/mma-debug/SKILL.md +9 -13
  40. package/dist/skills/mma-delegate/SKILL.md +14 -13
  41. package/dist/skills/mma-execute-plan/SKILL.md +15 -14
  42. package/dist/skills/mma-explore/SKILL.md +4 -3
  43. package/dist/skills/mma-investigate/SKILL.md +7 -6
  44. package/dist/skills/mma-journal-recall/SKILL.md +7 -6
  45. package/dist/skills/mma-journal-record/SKILL.md +10 -18
  46. package/dist/skills/mma-orchestrate/SKILL.md +74 -0
  47. package/dist/skills/mma-research/SKILL.md +7 -5
  48. package/dist/skills/mma-retry/SKILL.md +38 -37
  49. package/dist/skills/mma-review/SKILL.md +7 -6
  50. package/dist/skills/multi-model-agent/SKILL.md +7 -7
  51. package/dist/telemetry/flusher.d.ts.map +1 -1
  52. package/dist/telemetry/flusher.js +8 -11
  53. package/dist/telemetry/flusher.js.map +1 -1
  54. package/package.json +2 -2
  55. package/dist/http/async-dispatch.d.ts +0 -44
  56. package/dist/http/async-dispatch.d.ts.map +0 -1
  57. package/dist/http/async-dispatch.js +0 -175
  58. package/dist/http/async-dispatch.js.map +0 -1
  59. package/dist/http/canonicalize-file-paths.d.ts +0 -8
  60. package/dist/http/canonicalize-file-paths.d.ts.map +0 -1
  61. package/dist/http/canonicalize-file-paths.js +0 -43
  62. package/dist/http/canonicalize-file-paths.js.map +0 -1
  63. package/dist/http/execution-context.d.ts +0 -18
  64. package/dist/http/execution-context.d.ts.map +0 -1
  65. package/dist/http/execution-context.js +0 -61
  66. package/dist/http/execution-context.js.map +0 -1
  67. package/dist/http/handlers/control/batch-slice.d.ts +0 -4
  68. package/dist/http/handlers/control/batch-slice.d.ts.map +0 -1
  69. package/dist/http/handlers/control/batch-slice.js +0 -40
  70. package/dist/http/handlers/control/batch-slice.js.map +0 -1
  71. package/dist/http/handlers/control/batch.d.ts +0 -23
  72. package/dist/http/handlers/control/batch.d.ts.map +0 -1
  73. package/dist/http/handlers/control/batch.js +0 -332
  74. package/dist/http/handlers/control/batch.js.map +0 -1
  75. package/dist/http/handlers/tools/audit.d.ts +0 -4
  76. package/dist/http/handlers/tools/audit.d.ts.map +0 -1
  77. package/dist/http/handlers/tools/audit.js +0 -43
  78. package/dist/http/handlers/tools/audit.js.map +0 -1
  79. package/dist/http/handlers/tools/debug.d.ts +0 -4
  80. package/dist/http/handlers/tools/debug.d.ts.map +0 -1
  81. package/dist/http/handlers/tools/debug.js +0 -43
  82. package/dist/http/handlers/tools/debug.js.map +0 -1
  83. package/dist/http/handlers/tools/delegate.d.ts +0 -4
  84. package/dist/http/handlers/tools/delegate.d.ts.map +0 -1
  85. package/dist/http/handlers/tools/delegate.js +0 -43
  86. package/dist/http/handlers/tools/delegate.js.map +0 -1
  87. package/dist/http/handlers/tools/execute-plan.d.ts +0 -4
  88. package/dist/http/handlers/tools/execute-plan.d.ts.map +0 -1
  89. package/dist/http/handlers/tools/execute-plan.js +0 -45
  90. package/dist/http/handlers/tools/execute-plan.js.map +0 -1
  91. package/dist/http/handlers/tools/investigate.d.ts +0 -4
  92. package/dist/http/handlers/tools/investigate.d.ts.map +0 -1
  93. package/dist/http/handlers/tools/investigate.js +0 -64
  94. package/dist/http/handlers/tools/investigate.js.map +0 -1
  95. package/dist/http/handlers/tools/journal-recall.d.ts +0 -4
  96. package/dist/http/handlers/tools/journal-recall.d.ts.map +0 -1
  97. package/dist/http/handlers/tools/journal-recall.js +0 -40
  98. package/dist/http/handlers/tools/journal-recall.js.map +0 -1
  99. package/dist/http/handlers/tools/journal-record.d.ts +0 -8
  100. package/dist/http/handlers/tools/journal-record.d.ts.map +0 -1
  101. package/dist/http/handlers/tools/journal-record.js +0 -40
  102. package/dist/http/handlers/tools/journal-record.js.map +0 -1
  103. package/dist/http/handlers/tools/research.d.ts +0 -4
  104. package/dist/http/handlers/tools/research.d.ts.map +0 -1
  105. package/dist/http/handlers/tools/research.js +0 -64
  106. package/dist/http/handlers/tools/research.js.map +0 -1
  107. package/dist/http/handlers/tools/retry.d.ts +0 -4
  108. package/dist/http/handlers/tools/retry.d.ts.map +0 -1
  109. package/dist/http/handlers/tools/retry.js +0 -73
  110. package/dist/http/handlers/tools/retry.js.map +0 -1
  111. package/dist/http/handlers/tools/review.d.ts +0 -4
  112. package/dist/http/handlers/tools/review.d.ts.map +0 -1
  113. package/dist/http/handlers/tools/review.js +0 -43
  114. package/dist/http/handlers/tools/review.js.map +0 -1
  115. package/dist/http/journal-lock.d.ts +0 -4
  116. package/dist/http/journal-lock.d.ts.map +0 -1
  117. package/dist/http/journal-lock.js +0 -34
  118. package/dist/http/journal-lock.js.map +0 -1
  119. package/dist/http/request-observability.d.ts +0 -8
  120. package/dist/http/request-observability.d.ts.map +0 -1
  121. package/dist/http/request-observability.js +0 -20
  122. package/dist/http/request-observability.js.map +0 -1
@@ -1,43 +0,0 @@
1
- import * as review from '@zhixuan92/multi-model-agent-core/tools/review/schema';
2
- import { executeTask } from '@zhixuan92/multi-model-agent-core/lifecycle/task-executor';
3
- import { toolConfig } from '@zhixuan92/multi-model-agent-core/tools/review/tool-config';
4
- import { sendError, sendJson } from '../../errors.js';
5
- import { asyncDispatch } from '../../async-dispatch.js';
6
- import { emitRequestReceived } from '../../request-observability.js';
7
- export function buildReviewHandler(deps) {
8
- return async (_req, res, _params, ctx) => {
9
- const parsed = review.inputSchema.safeParse(ctx.body);
10
- if (!parsed.success) {
11
- sendError(res, 400, 'invalid_request', 'Request body validation failed', {
12
- fieldErrors: parsed.error.flatten(),
13
- });
14
- return;
15
- }
16
- const input = parsed.data;
17
- const cwd = ctx.cwd;
18
- const reserveResult = deps.projectRegistry.reserveProject(cwd);
19
- if (!reserveResult.ok) {
20
- sendError(res, 503, reserveResult.error, reserveResult.message);
21
- return;
22
- }
23
- const pc = reserveResult.projectContext;
24
- pc.lastActivityAt = Date.now();
25
- deps.projectRegistry.cancelReservation(cwd);
26
- const blockIds = input.contextBlockIds ?? [];
27
- const { batchId, statusUrl } = asyncDispatch({
28
- tool: 'review',
29
- projectCwd: cwd,
30
- blockIds,
31
- batchRegistry: deps.batchRegistry,
32
- projectContext: pc,
33
- deps,
34
- caller: { client: ctx.callerClient, mainModel: ctx.mainModel },
35
- executor: async (executionCtx) => {
36
- return executeTask(toolConfig, executionCtx, input);
37
- },
38
- });
39
- await emitRequestReceived(deps, batchId, _req.url ?? '', input);
40
- sendJson(res, 202, { batchId, statusUrl });
41
- };
42
- }
43
- //# sourceMappingURL=review.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../../../src/http/handlers/tools/review.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,uDAAuD,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,2DAA2D,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,4DAA4D,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IAClD,OAAO,KAAK,EAAE,IAAqB,EAAE,GAAmB,EAAE,OAA+B,EAAE,GAAG,EAAE,EAAE;QAChG,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,iBAAiB,EAAE,gCAAgC,EAAE;gBACvE,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE;aACpC,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;QAC1B,MAAM,GAAG,G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<T>): Promise<T>;
2
- /** Test-only: number of cwds with a live lock tail. */
3
- export declare function __journalLockMapSize(): number;
4
- //# sourceMappingURL=journal-lock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-lock.d.ts","sourceRoot":"","sources":["../../src/http/journal-lock.ts"],"names":[],"mappings":"AAUA,wBAAsB,sBAAsB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAoB7F;AAED,uDAAuD;AACvD,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Per-project (per-cwd) async mutex for journal writes. Chained-promise
3
- * implementation: each caller awaits the previous caller's tail before running.
4
- * Distinct cwds never block each other. The map entry is removed once the last
5
- * queued caller for a cwd completes, so lock state grows only with active
6
- * contention. On a contended acquire, one stderr breadcrumb is emitted; an
7
- * uncontended acquire emits nothing.
8
- */
9
- const tails = new Map();
10
- export async function withProjectJournalLock(cwd, fn) {
11
- const prev = tails.get(cwd); // undefined => uncontended
12
- let release;
13
- const mine = new Promise((resolve) => { release = resolve; });
14
- const tail = (prev ?? Promise.resolve()).then(() => mine);
15
- tails.set(cwd, tail);
16
- const start = Date.now();
17
- if (prev) {
18
- await prev; // queue behind the current holder
19
- process.stderr.write(`[mmagent] event=journal_lock_wait cwd=${cwd} wait_ms=${Date.now() - start}\n`);
20
- }
21
- try {
22
- return await fn();
23
- }
24
- finally {
25
- release(); // let the next waiter proceed
26
- if (tails.get(cwd) === tail)
27
- tails.delete(cwd); // nobody queued behind us
28
- }
29
- }
30
- /** Test-only: number of cwds with a live lock tail. */
31
- export function __journalLockMapSize() {
32
- return tails.size;
33
- }
34
- //# sourceMappingURL=journal-lock.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"journal-lock.js","sourceRoot":"","sources":["../../src/http/journal-lock.ts"],"names":[],"mappings":"AAAA;;;;;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@zhixuan92/multi-model-agent-core/events/log-writer';
3
- export interface EmitRequestReceivedDeps {
4
- bus: EnvelopeBus;
5
- logWriter: LogWriter;
6
- }
7
- export declare function emitRequestReceived(deps: EmitRequestReceivedDeps, batchId: string, route: string, parsed: unknown): Promise<void>;
8
- //# sourceMappingURL=request-observability.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-observability.d.ts","sourceRoot":"","sources":["../../src/http/request-observability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAC;AACzF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qDAAqD,CAAC;AAErF,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,WAAW,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,uBAAuB,EAC7B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,IAAI,CAAC,CAmBf"}
@@ -1,20 +0,0 @@
1
- export async function emitRequestReceived(deps, batchId, route, parsed) {
2
- const json = JSON.stringify(parsed);
3
- const bodyBytes = Buffer.byteLength(json, 'utf8');
4
- const ts = new Date().toISOString();
5
- // Emit batch_created plain entry
6
- deps.bus.emitPlainEntry({ ts, kind: 'batch_created', fields: { batch_id: batchId, route } });
7
- // Emit request_received plain entry
8
- const inline = bodyBytes <= deps.logWriter.inlineBodyLimit();
9
- const fields = { batch_id: batchId, route, body_bytes: bodyBytes };
10
- if (inline) {
11
- fields.body = json;
12
- }
13
- else {
14
- const spilled = await deps.logWriter.spillRequestBody({ batchId, body: parsed });
15
- fields.body_path = spilled.path;
16
- fields.body_bytes = spilled.bytes;
17
- }
18
- deps.bus.emitPlainEntry({ ts, kind: 'request_received', fields });
19
- }
20
- //# sourceMappingURL=request-observability.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"request-observability.js","sourceRoot":"","sources":["../../src/http/request-observability.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,IAA6B,EAC7B,OAAe,EACf,KAAa,EACb,MAAe;IAEf,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAClD,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAEpC,iCAAiC;IACjC,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;IAE7F,oCAAoC;IACpC,MAAM,MAAM,GAAG,SAAS,IAAI,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC;IAC7D,MAAM,MAAM,GAAqD,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;IACrH,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC;QAChC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC;IACpC,CAAC;IACD,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,CAAC,CAAC;AACpE,CAAC"}