@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,8 +0,0 @@
1
- export type CanonicalizeResult = string[] | {
2
- error: 'invalid_request';
3
- fieldErrors: {
4
- filePaths: string[];
5
- };
6
- };
7
- export declare function canonicalizeFilePaths(rawPaths: string[], cwd: string): CanonicalizeResult;
8
- //# sourceMappingURL=canonicalize-file-paths.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonicalize-file-paths.d.ts","sourceRoot":"","sources":["../../src/http/canonicalize-file-paths.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAC1B,MAAM,EAAE,GACR;IAAE,KAAK,EAAE,iBAAiB,CAAC;IAAC,WAAW,EAAE;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAAE,CAAC;AAEvE,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,kBAAkB,CAoCzF"}
@@ -1,43 +0,0 @@
1
- import { realpathSync, existsSync } from 'node:fs';
2
- import * as path from 'node:path';
3
- export function canonicalizeFilePaths(rawPaths, cwd) {
4
- const realCwd = realpathSync(cwd);
5
- const accepted = [];
6
- const offenders = [];
7
- for (const raw of rawPaths) {
8
- const resolved = path.isAbsolute(raw) ? path.normalize(raw) : path.resolve(realCwd, raw);
9
- let cursor = resolved;
10
- while (!existsSync(cursor) && path.dirname(cursor) !== cursor) {
11
- cursor = path.dirname(cursor);
12
- }
13
- let realAncestor;
14
- try {
15
- realAncestor = realpathSync(cursor);
16
- }
17
- catch {
18
- offenders.push(raw);
19
- continue;
20
- }
21
- const suffix = path.relative(cursor, resolved);
22
- const candidate = suffix ? path.normalize(path.join(realAncestor, suffix)) : realAncestor;
23
- const rel = path.relative(realCwd, candidate);
24
- const inside = rel === '' || (!rel.startsWith('..' + path.sep) && rel !== '..' && !path.isAbsolute(rel));
25
- if (!inside) {
26
- offenders.push(raw);
27
- continue;
28
- }
29
- accepted.push(candidate);
30
- }
31
- if (offenders.length > 0) {
32
- return { error: 'invalid_request', fieldErrors: { filePaths: offenders } };
33
- }
34
- const seen = new Set();
35
- const dedup = [];
36
- for (const p of accepted)
37
- if (!seen.has(p)) {
38
- seen.add(p);
39
- dedup.push(p);
40
- }
41
- return dedup;
42
- }
43
- //# sourceMappingURL=canonicalize-file-paths.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"canonicalize-file-paths.js","sourceRoot":"","sources":["../../src/http/canonicalize-file-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAMlC,MAAM,UAAU,qBAAqB,CAAC,QAAkB,EAAE,GAAW;IACnE,MAAM,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAA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C;IAED,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC;IAC7E,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,QAAQ;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;YAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,18 +0,0 @@
1
- import type { ExecutionContext } from '@zhixuan92/multi-model-agent-core';
2
- import type { TaskEnvelopeStore } from '@zhixuan92/multi-model-agent-core/events/task-envelope';
3
- import type { HandlerDeps } from './handler-deps.js';
4
- import type { ProjectContext } from '@zhixuan92/multi-model-agent-core';
5
- /**
6
- * Builds a canonical ExecutionContext for the async-dispatch → executor path.
7
- *
8
- * The canonical type carries lifecycle-specific required fields (task, timing,
9
- * stall, etc.) that aren't applicable in the server→executor code path. We
10
- * cast through `as ExecutionContext` because the executors only access the
11
- * subset of fields populated here. Phase B/E will migrate executors into the
12
- * full lifecycle, after which this shim can be deleted.
13
- */
14
- export declare function buildExecutionContext(deps: HandlerDeps, pc: ProjectContext, batchId: string, envelope: TaskEnvelopeStore, route?: string, caller?: {
15
- client: string;
16
- mainModel?: string | null;
17
- }): ExecutionContext;
18
- //# sourceMappingURL=execution-context.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/http/execution-context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAGxE;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,WAAW,EACjB,EAAE,EAAE,cAAc,EAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACrD,gBAAgB,CAkDlB"}
@@ -1,61 +0,0 @@
1
- import { getRecorder } from '../telemetry/recorder.js';
2
- /**
3
- * Builds a canonical ExecutionContext for the async-dispatch → executor path.
4
- *
5
- * The canonical type carries lifecycle-specific required fields (task, timing,
6
- * stall, etc.) that aren't applicable in the server→executor code path. We
7
- * cast through `as ExecutionContext` because the executors only access the
8
- * subset of fields populated here. Phase B/E will migrate executors into the
9
- * full lifecycle, after which this shim can be deleted.
10
- */
11
- export function buildExecutionContext(deps, pc, batchId, envelope, route, caller) {
12
- const recordHeartbeat = (tick) => {
13
- const effectiveBatchId = tick.batchId || batchId;
14
- const entry = deps.batchRegistry.get(effectiveBatchId);
15
- if (!entry)
16
- return;
17
- entry.lastHeartbeatAt = Date.now();
18
- entry.running = [{ worker: tick.provider, turn: Math.max(1, tick.stageIndex) }];
19
- // Record heartbeat to envelope — this triggers snapshot push with recomputed headline
20
- envelope.recordHeartbeat({ stallIdleMs: 0 });
21
- };
22
- let recorder;
23
- try {
24
- recorder = getRecorder();
25
- }
26
- catch {
27
- // Recorder not initialized — telemetry disabled
28
- }
29
- const now = Date.now();
30
- return {
31
- config: deps.config,
32
- bus: deps.bus,
33
- // Per-request X-MMA-Main-Model header is the only source. Enforced at
34
- // the request-pipeline boundary (4.0.3+); by the time we reach this
35
- // builder, caller.mainModel is guaranteed non-null for tool routes.
36
- mainModel: caller?.mainModel ?? null,
37
- route: route ?? '',
38
- client: caller?.client ?? 'other',
39
- batchId,
40
- recordHeartbeat,
41
- recorder,
42
- projectContext: pc,
43
- contextBlockStore: pc.contextBlocks,
44
- // Thread the BatchRegistry so task-runner can attach this ctx for
45
- // shutdown-drain visibility into in-flight tasks.
46
- batchRegistry: deps.batchRegistry,
47
- task: { prompt: '' },
48
- taskIndex: 0,
49
- cwd: pc.cwd,
50
- assignedTier: 'standard',
51
- implementerProvider: undefined,
52
- providers: {},
53
- timing: { startMs: now, timeoutMs: 0, deadlineMs: 0, stallTimeoutMs: 0 },
54
- stall: { controller: new AbortController(), lastEventAtMs: now, fired: false },
55
- implementerToolMode: undefined,
56
- heartbeat: undefined,
57
- outputTargets: [],
58
- envelope,
59
- };
60
- }
61
- //# sourceMappingURL=execution-context.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"execution-context.js","sourceRoot":"","sources":["../../src/http/execution-context.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAiB,EACjB,EAAkB,EAClB,OAAe,EACf,QAA2B,EAC3B,KAAc,EACd,MAAsD;IAEtD,MAAM,eAAe,GAAG,CAAC,IAAuB,EAAE,EAAE;QAClD,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC;QACjD,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK;YAAE,OAAO;QACnB,KAAK,CAAC,eAAe,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACnC,KAAK,CAAC,OAAO,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC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S,EAAE,SAAS;QACpB,aAAa,EAAE,EAAE;QACjB,QAAQ;KACsB,CAAC;AACnC,CAAC"}
@@ -1,4 +0,0 @@
1
- import type { HandlerDeps } from '../../handler-deps.js';
2
- import type { RawHandler } from '../../types.js';
3
- export declare function buildBatchSliceHandler(deps: HandlerDeps): RawHandler;
4
- //# sourceMappingURL=batch-slice.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-slice.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/control/batch-slice.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAOjD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAyCpE"}
@@ -1,40 +0,0 @@
1
- import { z } from 'zod';
2
- import { sendError, sendJson } from '../../errors.js';
3
- const inputSchema = z.object({
4
- batchId: z.string(),
5
- taskIndex: z.number().int().nonnegative(),
6
- });
7
- export function buildBatchSliceHandler(deps) {
8
- return async (_req, res, _params, ctx) => {
9
- const parsed = 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
- // T4: use the registry/delegate batchId directly as the cache key.
27
- const entry = pc.batchCache.get(input.batchId);
28
- if (!entry) {
29
- sendError(res, 404, 'not_found', `Batch ${input.batchId} not found`);
30
- return;
31
- }
32
- const results = entry.results;
33
- if (!Array.isArray(results) || input.taskIndex >= results.length) {
34
- sendError(res, 404, 'unknown_task_index', `taskIndex ${input.taskIndex} is out of range (batch has ${Array.isArray(results) ? results.length : 0} result(s))`);
35
- return;
36
- }
37
- sendJson(res, 200, { batchId: input.batchId, result: results[input.taskIndex] });
38
- };
39
- }
40
- //# sourceMappingURL=batch-slice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch-slice.js","sourceRoot":"","sources":["../../../../src/http/handlers/control/batch-slice.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAItD,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;CAC1C,CAAC,CAAC;AAEH,MAAM,UAAU,sBAAsB,CAAC,IAAiB;IACtD,OAAO,KAAK,EAAE,IAAqB,EAAE,GAAmB,EAAE,OAA+B,EAAE,GAAG,EAAE,EAAE;QAChG,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/C,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,GAAG,GAAG,CAAC,GAAI,CAAC;QACrB,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;QAC/D,IAAI,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;YACtB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,aAAa,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;YAChE,OAAO;QACT,CAAC;QACD,MAAM,EAAE,GAAG,aAAa,CAAC,cAAc,CAAC;QACxC,EAAE,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC/B,IAAI,CAAC,eAAe,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAE5C,mEAAmE;QACnE,MAAM,KAAK,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;YACrE,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,KAAK,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;YACjE,SAAS,CACP,GAAG,EACH,GAAG,EACH,oBAAoB,EACpB,aAAa,KAAK,CAAC,SAAS,+BAA+B,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,aAAa,CACpH,CAAC;YACF,OAAO;QACT,CAAC;QAED,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACnF,CAAC,CAAC;AACJ,CAAC"}
@@ -1,23 +0,0 @@
1
- import type { RawHandler } from '../../types.js';
2
- import { type BatchRegistry } from '@zhixuan92/multi-model-agent-core';
3
- import type { TaskEnvelope } from '@zhixuan92/multi-model-agent-core/events/task-envelope';
4
- export interface BatchHandlerDeps {
5
- batchRegistry: BatchRegistry;
6
- }
7
- export declare function envelopeToPublicResult(env: TaskEnvelope): any;
8
- /**
9
- * GET /batch/:batchId — poll a batch.
10
- *
11
- * Status split (Theme 7):
12
- * - pending → 202 text/plain — body is the runningHeadline
13
- * - complete/failed/expired → 200 JSON uniform 7-field envelope
14
- *
15
- * Optional ?taskIndex=N slices `results` on a complete envelope.
16
- *
17
- * Errors:
18
- * unknown batchId → 404 not_found
19
- * non-numeric taskIndex → 400 invalid_task_index
20
- * taskIndex ≥ results.len → 404 unknown_task_index
21
- */
22
- export declare function buildBatchHandler(deps: BatchHandlerDeps): RawHandler;
23
- //# sourceMappingURL=batch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/control/batch.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAiB,KAAK,aAAa,EAAiB,MAAM,mCAAmC,CAAC;AACrG,OAAO,KAAK,EAAE,YAAY,EAAqB,MAAM,wDAAwD,CAAC;AAE9G,MAAM,WAAW,gBAAgB;IAC/B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAGD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,YAAY,OAgEvD;AAqBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,gBAAgB,GAAG,UAAU,CAwQpE"}
@@ -1,332 +0,0 @@
1
- import { sendError, sendJson } from '../../errors.js';
2
- import { notApplicable, formatElapsed } from '@zhixuan92/multi-model-agent-core';
3
- // envelopeToPublicResult converts a TaskEnvelope to the public-safe per-task result shape.
4
- export function envelopeToPublicResult(env) {
5
- // 4.7.4+ standardization: findings/outcome summary fields live ONLY at
6
- // the top level of the per-task result. Per-stage rows carry stage
7
- // mechanics (durationMs, costUSD, verdict, etc.) but NOT findings
8
- // duplicates — one source of truth for backend + dashboard consumers.
9
- const stripFindingsFields = (s) => {
10
- const { findingsOutcome, findingsOutcomeReason, outcomeInferred, outcomeMalformed, findingsBySeverity, ...rest } = s ?? {};
11
- return rest;
12
- };
13
- // Outcome rollup: review > annotating > implementing (first non-null wins).
14
- const outcomePriority = ['reviewing', 'annotating', 'implementing'];
15
- const pick = outcomePriority
16
- .map((n) => env.stages.find((st) => st.name === n && st.findingsOutcome != null))
17
- .find((s) => s !== undefined);
18
- const sevCounts = env.findings.reduce((acc, f) => {
19
- const s = f.severity;
20
- if (s === 'critical' || s === 'high' || s === 'medium' || s === 'low')
21
- acc[s] += 1;
22
- return acc;
23
- }, { critical: 0, high: 0, medium: 0, low: 0 });
24
- return {
25
- taskId: env.taskId, taskIndex: env.taskIndex, route: env.route, agentType: env.agentType,
26
- status: env.status, terminalAt: env.terminalAt, stopReason: env.stopReason,
27
- stages: env.stages.map(stripFindingsFields),
28
- totals: {
29
- costUSD: env.totalCostUSD, durationMs: env.totalDurationMs, turnsUsed: env.turnsUsed,
30
- inputTokens: env.totalInputTokens, outputTokens: env.totalOutputTokens,
31
- },
32
- findings: env.findings.map((f) => ({
33
- id: f.id, severity: f.severity, category: f.category, claim: f.claim,
34
- ...(f.evidence !== undefined && f.evidence !== '' && { evidence: f.evidence }),
35
- ...(f.suggestion !== undefined && f.suggestion !== '' && { suggestion: f.suggestion }),
36
- source: f.source,
37
- })),
38
- findingsBySeverity: sevCounts,
39
- ...(pick && {
40
- findingsOutcome: pick.findingsOutcome ?? null,
41
- ...(pick.findingsOutcomeReason !== undefined && { findingsOutcomeReason: pick.findingsOutcomeReason }),
42
- ...(pick.outcomeInferred !== undefined && { outcomeInferred: pick.outcomeInferred }),
43
- ...(pick.outcomeMalformed !== undefined && { outcomeMalformed: pick.outcomeMalformed }),
44
- }),
45
- // filesChangedCount prefers the authoritative git-diff signal
46
- // (env.realFilesChanged, populated by terminal-handlers via getRealFilesChanged).
47
- // Falls back to the per-task worker tool-call signal (env.filesWritten)
48
- // when realFilesChanged is empty but filesWritten is non-empty — covers
49
- // cwds that are not git repos (e.g. /tmp), where `git diff` returns
50
- // nothing even though the worker actually wrote files. Pre-fix, codex
51
- // tasks under /tmp reported filesChangedCount=0 despite the file existing
52
- // on disk; reviewer then halted on "no files changed."
53
- filesChangedCount: env.realFilesChanged.length > 0
54
- ? env.realFilesChanged.length
55
- : env.filesWritten.length,
56
- error: env.structuredError ? { code: env.structuredError.code, message: env.structuredError.message } : null,
57
- escalationSummary: { count: env.escalationLog.length, distinctProviders: new Set(env.escalationLog.map((e) => (e.toModel ?? ''))).size },
58
- // 4.7.5: surface parser-side validation warnings (e.g. dropped Finding blocks)
59
- // so operators can see WHY a worker's output yielded fewer findings than
60
- // expected. recordValidationWarning() on the envelope pushes here; without
61
- // this projection the data was invisible to /batch callers.
62
- validationWarnings: env.validationWarnings,
63
- // terminal context block id for read routes (null on write routes / failure)
64
- contextBlockId: env.contextBlockId,
65
- };
66
- }
67
- // buildPendingHeadline constructs a pending batch headline from running envelope snapshots.
68
- function buildPendingHeadline(entry) {
69
- const running = (entry.taskEnvelopes ?? []).filter((e) => e !== null && e.snapshot().status === 'running');
70
- if (running.length === 0)
71
- return `[0/${entry.tasksTotal ?? 1}] queued`;
72
- const rep = running[0];
73
- const repSnap = rep.snapshot();
74
- const summed = running.reduce((acc, e) => {
75
- const s = e.snapshot().headline;
76
- return { writes: acc.writes + s.toolWrites, total: acc.total + s.toolTotal };
77
- }, { writes: 0, total: 0 });
78
- const suffix = running.length > 1 ? ` +${running.length - 1}` : '';
79
- // Adaptive: tools=N always (the most reliable activity signal across all
80
- // providers); writes= only when > 0.
81
- const statsParts = [`tools=${summed.total}`];
82
- if (summed.writes > 0)
83
- statsParts.push(`writes=${summed.writes}`);
84
- const stats = statsParts.join(' ');
85
- return `[${repSnap.headline.stageIndex}/${repSnap.headline.stageTotal}] ${repSnap.headline.stageLabel}${suffix} — ${stats}`;
86
- }
87
- /**
88
- * GET /batch/:batchId — poll a batch.
89
- *
90
- * Status split (Theme 7):
91
- * - pending → 202 text/plain — body is the runningHeadline
92
- * - complete/failed/expired → 200 JSON uniform 7-field envelope
93
- *
94
- * Optional ?taskIndex=N slices `results` on a complete envelope.
95
- *
96
- * Errors:
97
- * unknown batchId → 404 not_found
98
- * non-numeric taskIndex → 400 invalid_task_index
99
- * taskIndex ≥ results.len → 404 unknown_task_index
100
- */
101
- export function buildBatchHandler(deps) {
102
- return async (_req, res, params, ctx) => {
103
- const { batchId } = params;
104
- const entry = deps.batchRegistry.get(batchId);
105
- if (!entry) {
106
- sendError(res, 404, 'not_found', `Batch ${batchId} not found`);
107
- return;
108
- }
109
- // Parse optional taskIndex BEFORE checking batch state — syntactic
110
- // validation is independent of state, and clients shouldn't get a 202
111
- // when the request URL itself is malformed.
112
- const rawTaskIndex = ctx.url.searchParams.get('taskIndex');
113
- let taskIndex = null;
114
- if (rawTaskIndex !== null) {
115
- if (!/^\d+$/.test(rawTaskIndex)) {
116
- sendError(res, 400, 'invalid_task_index', `taskIndex must be a non-negative integer; got: ${JSON.stringify(rawTaskIndex)}`);
117
- return;
118
- }
119
- taskIndex = parseInt(rawTaskIndex, 10);
120
- }
121
- // Pending → 202 text/plain progress line.
122
- // ALWAYS one line, regardless of single-task or batch. For batches, the
123
- // line aggregates per-task state: slowest running task is the headline's
124
- // representative (largest elapsed = oldest dispatchedAt, ties broken by
125
- // lowest taskIndex), counts are summed across all started tasks, and a
126
- // " +K" suffix marks how many other tasks are running concurrently.
127
- // Final shape (identical for N=1 and N>1):
128
- // [X/Y] Implementing by Standard worker (1/9)[+K] - 6m 0s, 8 write, 234 tool calls
129
- if (entry.state === 'pending') {
130
- let headline;
131
- // Try envelope-based path first if envelopes are available
132
- if (entry.taskEnvelopes && entry.taskEnvelopes.length > 0) {
133
- headline = buildPendingHeadline(entry);
134
- }
135
- else {
136
- const perTask = entry.perTaskHeadlineSnapshots;
137
- // tasksTotal is set by async-dispatch to a placeholder (1) before the
138
- // executor knows the real fan-out size; perTask.size reflects actual
139
- // tasks that have started, so prefer the larger of the two.
140
- const totalTasks = Math.max(entry.tasksTotal ?? 1, perTask?.size ?? 0);
141
- if (perTask && perTask.size > 0) {
142
- const sortedIndices = [...perTask.keys()].sort((a, b) => a - b);
143
- // Slowest = oldest dispatchedAt (i.e., largest elapsed). Stable
144
- // tie-break on lowest taskIndex (sortedIndices is already ascending).
145
- let slowestIdx = sortedIndices[0];
146
- let slowest = perTask.get(slowestIdx);
147
- for (const idx of sortedIndices) {
148
- const snap = perTask.get(idx);
149
- if (snap.dispatchedAt < slowest.dispatchedAt) {
150
- slowest = snap;
151
- slowestIdx = idx;
152
- }
153
- }
154
- // Sum counts across all started tasks for the aggregate stats clause.
155
- let sumWrite = 0;
156
- let sumTotal = 0;
157
- let haveStructuredCounts = false;
158
- for (const idx of sortedIndices) {
159
- const snap = perTask.get(idx);
160
- if (typeof snap.toolWrites === 'number' ||
161
- typeof snap.toolTotal === 'number') {
162
- haveStructuredCounts = true;
163
- sumWrite += snap.toolWrites ?? 0;
164
- sumTotal += snap.toolTotal ?? 0;
165
- }
166
- }
167
- const startedCount = perTask.size;
168
- const taskBracket = `[${startedCount}/${totalTasks}]`;
169
- const runningSuffix = startedCount > 1 ? ` +${startedCount - 1}` : '';
170
- const elapsedMs = Date.now() - slowest.dispatchedAt;
171
- if (haveStructuredCounts && slowest.stageLabel) {
172
- const tierClause = slowest.tier ? ` by ${slowest.tier} worker` : '';
173
- const stageProgressClause = typeof slowest.stageDone === 'number' && typeof slowest.stageTotal === 'number'
174
- ? ` (${slowest.stageDone}/${slowest.stageTotal})`
175
- : '';
176
- const statsClause = `, ${sumWrite} write, ${sumTotal} tool calls`;
177
- headline = `${taskBracket} ${slowest.stageLabel}${tierClause}${stageProgressClause}${runningSuffix} - ${formatElapsed(elapsedMs)}${statsClause}`;
178
- }
179
- else if (slowest.prefix) {
180
- // Older snapshot path: inject the +K suffix before the prefix's " - "
181
- // separator if needed.
182
- const prefixWithSuffix = runningSuffix
183
- ? slowest.prefix.replace(/ - $/, `${runningSuffix} - `)
184
- : slowest.prefix;
185
- headline = `${taskBracket} ${prefixWithSuffix}${formatElapsed(elapsedMs)}${slowest.statsClause}`;
186
- }
187
- else {
188
- headline = `${taskBracket} ${slowest.fallback}${runningSuffix}`;
189
- }
190
- }
191
- else {
192
- const snap = entry.runningHeadlineSnapshot;
193
- if (!snap) {
194
- headline = '[0/0] queued';
195
- }
196
- else {
197
- const elapsedMs = Date.now() - snap.dispatchedAt;
198
- headline = snap.prefix
199
- ? `${snap.prefix}${formatElapsed(elapsedMs)}${snap.statsClause}`
200
- : snap.fallback;
201
- }
202
- }
203
- }
204
- res.writeHead(202, { 'content-type': 'text/plain; charset=utf-8' });
205
- res.end(headline);
206
- return;
207
- }
208
- // Build terminal response from envelopes if available, otherwise use pre-computed result
209
- let fullResult;
210
- if (entry.taskEnvelopes && entry.taskEnvelopes.length > 0) {
211
- // Build response from envelope snapshots
212
- const snapshots = entry.taskEnvelopes
213
- .map(e => e?.snapshot())
214
- .filter((snap) => snap !== undefined && snap !== null);
215
- if (snapshots.length > 0) {
216
- // Build results array from envelopes
217
- const results = snapshots.map((env) => envelopeToPublicResult(env));
218
- // Derive batchTimings from envelopes
219
- const allStartedAt = snapshots.map(s => new Date(s.startedAt).getTime());
220
- const allTerminalAt = snapshots.map(s => (s.terminalAt ? new Date(s.terminalAt).getTime() : 0));
221
- const batchStart = Math.min(...allStartedAt);
222
- const batchEnd = Math.max(...allTerminalAt.filter(t => t > 0));
223
- const sumDurations = snapshots.reduce((sum, s) => sum + s.totalDurationMs, 0);
224
- const batchTimings = {
225
- wallClockMs: batchEnd - batchStart,
226
- sumOfTaskMs: sumDurations,
227
- estimatedParallelSavingsMs: Math.max(0, sumDurations - (batchEnd - batchStart)),
228
- };
229
- // Derive costSummary from envelopes
230
- const costSummary = {
231
- totalActualCostUSD: snapshots.reduce((sum, s) => sum + s.totalCostUSD, 0),
232
- totalCostDeltaVsMainUSD: 0, // Not available from envelopes
233
- };
234
- // Derive structuredReport from findings + per-stage outcome roll-up.
235
- // findingsOutcome aggregation rule: any 'found' → 'found'; else any
236
- // 'not_applicable' → 'not_applicable'; else 'clean'. null entries skip.
237
- const allFindings = snapshots.flatMap(s => s.findings);
238
- const stageOutcomes = snapshots
239
- .flatMap(s => s.stages)
240
- .map(st => st.findingsOutcome)
241
- .filter((o) => o === 'found' || o === 'clean' || o === 'not_applicable');
242
- const rollupOutcome = stageOutcomes.length === 0
243
- ? null
244
- : stageOutcomes.includes('found') ? 'found'
245
- : stageOutcomes.includes('not_applicable') ? 'not_applicable'
246
- : 'clean';
247
- // Commit fields come from the per-task envelopes (sealed from the commit
248
- // gate payload — see terminal-handlers.ts). For a MULTI-task batch the
249
- // aggregate must represent whether the batch committed, not just task 0:
250
- // use the first task that actually committed (has a SHA), so a no-op task 0
251
- // can't mask sibling commits. commitSkipReason is surfaced only when NOTHING
252
- // committed (then from task 0). filesChanged already unions across tasks.
253
- const firstSnap = snapshots[0];
254
- const committedSnap = snapshots.find((s) => s.commitSha) ?? null;
255
- const structuredReport = {
256
- summary: allFindings.length > 0 ? `${allFindings.length} finding(s)` : 'No findings',
257
- workerStatus: snapshots.length > 0 ? snapshots[0].status : 'unknown',
258
- unresolved: [],
259
- filesChanged: snapshots.flatMap(s => s.realFilesChanged.length > 0 ? s.realFilesChanged : s.filesWritten),
260
- reviewVerdict: null,
261
- reviewConcerns: [],
262
- reworkApplied: false,
263
- commitSha: committedSnap?.commitSha ?? null,
264
- commitMessage: committedSnap?.commitMessage ?? null,
265
- commitSkipReason: committedSnap ? null : (firstSnap?.commitSkipReason ?? null),
266
- findings: allFindings.map(f => ({
267
- severity: f.severity, category: f.category, claim: f.claim,
268
- ...(f.evidence !== undefined && f.evidence !== '' && { evidence: f.evidence }),
269
- ...(f.suggestion !== undefined && f.suggestion !== '' && { suggestion: f.suggestion }),
270
- })),
271
- findingsOutcome: rollupOutcome,
272
- criteriaErrors: [],
273
- // research-only: the `## Sources used` table, deduped by source group
274
- // across tasks. Empty on every non-research route.
275
- sourcesUsed: (() => {
276
- const seen = new Map();
277
- for (const s of snapshots) {
278
- for (const row of (s.sourcesUsed ?? [])) {
279
- const prev = seen.get(row.source);
280
- // Prefer a `used:true` row over an attempted-but-failed one.
281
- if (!prev || (row.used && !prev.used))
282
- seen.set(row.source, row);
283
- }
284
- }
285
- return [...seen.values()];
286
- })(),
287
- };
288
- // Build headline
289
- const headline = `${entry.tool}: ${snapshots.length} task(s) complete`;
290
- // Build error from first failed envelope if any
291
- const firstError = snapshots.find(s => s.structuredError);
292
- const error = firstError?.structuredError
293
- ? { code: firstError.structuredError.code, message: firstError.structuredError.message }
294
- : { kind: 'not_applicable', reason: 'batch succeeded' };
295
- fullResult = { headline, results, batchTimings, costSummary, structuredReport, error };
296
- }
297
- }
298
- // Fall back to pre-computed result if not built from envelopes
299
- if (!fullResult) {
300
- fullResult = entry.result;
301
- }
302
- if (entry.state === 'failed' || entry.state === 'expired' || !fullResult) {
303
- const reason = `batch ${entry.state}`;
304
- const errPayload = entry.error ?? (fullResult && fullResult['error']) ?? notApplicable('batch succeeded');
305
- sendJson(res, 200, {
306
- headline: entry.state === 'expired'
307
- ? 'batch expired'
308
- : entry.state === 'failed'
309
- ? 'batch failed'
310
- : fullResult?.['headline'] ?? `batch ${entry.state}`,
311
- results: fullResult?.['results'] ?? notApplicable(reason),
312
- batchTimings: fullResult?.['batchTimings'] ?? notApplicable(reason),
313
- costSummary: fullResult?.['costSummary'] ?? notApplicable(reason),
314
- structuredReport: fullResult?.['structuredReport'] ?? notApplicable(reason),
315
- error: errPayload,
316
- });
317
- return;
318
- }
319
- // entry.state === 'complete' with a stored result. Executor emits all 7 fields.
320
- if (taskIndex !== null) {
321
- const results = fullResult['results'];
322
- if (!Array.isArray(results) || taskIndex >= results.length) {
323
- sendError(res, 404, 'unknown_task_index', `taskIndex ${taskIndex} is out of range (batch has ${Array.isArray(results) ? results.length : 0} result(s))`);
324
- return;
325
- }
326
- sendJson(res, 200, { ...fullResult, results: [results[taskIndex]] });
327
- return;
328
- }
329
- sendJson(res, 200, fullResult);
330
- };
331
- }
332
- //# sourceMappingURL=batch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"batch.js","sourceRoot":"","sources":["../../../../src/http/handlers/control/batch.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAsB,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAOrG,2FAA2F;AAC3F,MAAM,UAAU,sBAAsB,CAAC,GAAiB;IACtD,uEAAuE;IACvE,mEAAmE;IACnE,kEAAkE;IAClE,sEAAsE;IACtE,MAAM,mBAAmB,GAAG,CAAC,CAAM,EAAE,EAAE;QACrC,MAAM,EAAE,eAAe,EAAE,qBAAqB,EAAE,eAAe,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;QAC3H,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;IACF,4EAA4E;IAC5E,MAAM,eAAe,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IACpE,MAAM,IAAI,GAAG,eAAe;SACzB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,GAAG,CAAC,MAAgB,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,eAAe,IAAI,IAAI,CAAC,CAAC;SAC3F,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC;IAChC,MAAM,SAAS,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CACnC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACT,MAAM,CAAC,GAAI,CAAS,CAAC,QAA8D,CAAC;QACpF,I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"}
@@ -1,4 +0,0 @@
1
- import type { HandlerDeps } from '../../handler-deps.js';
2
- import type { RawHandler } from '../../types.js';
3
- export declare function buildAuditHandler(deps: HandlerDeps): RawHandler;
4
- //# sourceMappingURL=audit.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/tools/audit.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAwC/D"}