@zhixuan92/multi-model-agent 3.12.7 → 4.0.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/README.md +10 -4
- package/dist/cli/install-skill.d.ts +7 -7
- package/dist/cli/install-skill.d.ts.map +1 -1
- package/dist/cli/install-skill.js +56 -11
- package/dist/cli/install-skill.js.map +1 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +17 -3
- package/dist/cli/serve.js.map +1 -1
- package/dist/cli/update-skills.js +3 -3
- package/dist/cli/update-skills.js.map +1 -1
- package/dist/http/async-dispatch.d.ts +1 -1
- package/dist/http/async-dispatch.d.ts.map +1 -1
- package/dist/http/async-dispatch.js +3 -38
- package/dist/http/async-dispatch.js.map +1 -1
- package/dist/http/cwd-validator.d.ts.map +1 -1
- package/dist/http/cwd-validator.js +3 -0
- package/dist/http/cwd-validator.js.map +1 -1
- package/dist/http/execution-context.d.ts +8 -6
- package/dist/http/execution-context.d.ts.map +1 -1
- package/dist/http/execution-context.js +33 -15
- package/dist/http/execution-context.js.map +1 -1
- package/dist/http/handler-deps.d.ts +11 -3
- package/dist/http/handler-deps.d.ts.map +1 -1
- package/dist/http/handlers/control/batch-slice.d.ts +1 -1
- package/dist/http/handlers/control/batch-slice.d.ts.map +1 -1
- package/dist/http/handlers/control/batch.d.ts +1 -2
- package/dist/http/handlers/control/batch.d.ts.map +1 -1
- package/dist/http/handlers/control/batch.js +0 -15
- package/dist/http/handlers/control/batch.js.map +1 -1
- package/dist/http/handlers/control/context-blocks.d.ts +7 -5
- package/dist/http/handlers/control/context-blocks.d.ts.map +1 -1
- package/dist/http/handlers/control/context-blocks.js +34 -13
- package/dist/http/handlers/control/context-blocks.js.map +1 -1
- package/dist/http/handlers/control/retry.d.ts +1 -1
- package/dist/http/handlers/control/retry.d.ts.map +1 -1
- package/dist/http/handlers/control/retry.js +32 -20
- package/dist/http/handlers/control/retry.js.map +1 -1
- package/dist/http/handlers/introspection/health.d.ts +16 -10
- package/dist/http/handlers/introspection/health.d.ts.map +1 -1
- package/dist/http/handlers/introspection/health.js +9 -12
- package/dist/http/handlers/introspection/health.js.map +1 -1
- package/dist/http/handlers/introspection/status.d.ts +1 -1
- package/dist/http/handlers/introspection/status.d.ts.map +1 -1
- package/dist/http/handlers/introspection/status.js +1 -1
- package/dist/http/handlers/introspection/status.js.map +1 -1
- package/dist/http/handlers/introspection/tools-list.d.ts +1 -1
- package/dist/http/handlers/introspection/tools-list.d.ts.map +1 -1
- package/dist/http/handlers/introspection/tools-list.js +1 -1
- package/dist/http/handlers/introspection/tools-list.js.map +1 -1
- package/dist/http/handlers/tools/audit.d.ts +1 -1
- package/dist/http/handlers/tools/audit.d.ts.map +1 -1
- package/dist/http/handlers/tools/audit.js +14 -8
- package/dist/http/handlers/tools/audit.js.map +1 -1
- package/dist/http/handlers/tools/debug.d.ts +1 -1
- package/dist/http/handlers/tools/debug.d.ts.map +1 -1
- package/dist/http/handlers/tools/debug.js +14 -8
- package/dist/http/handlers/tools/debug.js.map +1 -1
- package/dist/http/handlers/tools/delegate.d.ts +1 -1
- package/dist/http/handlers/tools/delegate.d.ts.map +1 -1
- package/dist/http/handlers/tools/delegate.js +14 -21
- package/dist/http/handlers/tools/delegate.js.map +1 -1
- package/dist/http/handlers/tools/execute-plan.d.ts +1 -1
- package/dist/http/handlers/tools/execute-plan.d.ts.map +1 -1
- package/dist/http/handlers/tools/execute-plan.js +18 -25
- package/dist/http/handlers/tools/execute-plan.js.map +1 -1
- package/dist/http/handlers/tools/explore.d.ts +1 -1
- package/dist/http/handlers/tools/explore.d.ts.map +1 -1
- package/dist/http/handlers/tools/explore.js +20 -13
- package/dist/http/handlers/tools/explore.js.map +1 -1
- package/dist/http/handlers/tools/investigate.d.ts +1 -1
- package/dist/http/handlers/tools/investigate.d.ts.map +1 -1
- package/dist/http/handlers/tools/investigate.js +28 -22
- package/dist/http/handlers/tools/investigate.js.map +1 -1
- package/dist/http/handlers/tools/retry.d.ts +1 -1
- package/dist/http/handlers/tools/retry.d.ts.map +1 -1
- package/dist/http/handlers/tools/retry.js +65 -17
- package/dist/http/handlers/tools/retry.js.map +1 -1
- package/dist/http/handlers/tools/review.d.ts +1 -1
- package/dist/http/handlers/tools/review.d.ts.map +1 -1
- package/dist/http/handlers/tools/review.js +14 -8
- package/dist/http/handlers/tools/review.js.map +1 -1
- package/dist/http/handlers/tools/verify.d.ts +1 -1
- package/dist/http/handlers/tools/verify.d.ts.map +1 -1
- package/dist/http/handlers/tools/verify.js +14 -8
- package/dist/http/handlers/tools/verify.js.map +1 -1
- package/dist/http/middleware/caller-identity.js +1 -1
- package/dist/http/middleware/caller-identity.js.map +1 -1
- package/dist/http/project-registry.d.ts.map +1 -1
- package/dist/http/project-registry.js +0 -2
- package/dist/http/project-registry.js.map +1 -1
- package/dist/http/request-observability.js +2 -2
- package/dist/http/request-observability.js.map +1 -1
- package/dist/http/request-pipeline.d.ts +3 -2
- package/dist/http/request-pipeline.d.ts.map +1 -1
- package/dist/http/request-pipeline.js +1 -1
- package/dist/http/request-pipeline.js.map +1 -1
- package/dist/http/server.d.ts +1 -1
- package/dist/http/server.d.ts.map +1 -1
- package/dist/http/server.js +127 -55
- package/dist/http/server.js.map +1 -1
- package/dist/http/types.d.ts +8 -1
- package/dist/http/types.d.ts.map +1 -1
- package/dist/http/wire/delegate-wire.d.ts +4 -0
- package/dist/http/wire/delegate-wire.d.ts.map +1 -0
- package/dist/http/wire/delegate-wire.js +16 -0
- package/dist/http/wire/delegate-wire.js.map +1 -0
- package/dist/http/wire/execute-plan-wire.d.ts +18 -0
- package/dist/http/wire/execute-plan-wire.d.ts.map +1 -0
- package/dist/http/wire/execute-plan-wire.js +26 -0
- package/dist/http/wire/execute-plan-wire.js.map +1 -0
- package/dist/http/wire/register-all-handlers.d.ts +3 -0
- package/dist/http/wire/register-all-handlers.d.ts.map +1 -0
- package/dist/http/wire/register-all-handlers.js +25 -0
- package/dist/http/wire/register-all-handlers.js.map +1 -0
- package/dist/http/wire/registry.d.ts +3 -0
- package/dist/http/wire/registry.d.ts.map +1 -0
- package/dist/http/wire/registry.js +20 -0
- package/dist/http/wire/registry.js.map +1 -0
- package/dist/install/discover.d.ts +9 -1
- package/dist/install/discover.d.ts.map +1 -1
- package/dist/install/discover.js +14 -1
- package/dist/install/discover.js.map +1 -1
- package/dist/install/headers.d.ts +1 -1
- package/dist/install/headers.d.ts.map +1 -1
- package/dist/install/manifest-resolve.d.ts +7 -1
- package/dist/install/manifest-resolve.d.ts.map +1 -1
- package/dist/install/manifest-resolve.js +23 -4
- package/dist/install/manifest-resolve.js.map +1 -1
- package/dist/install/manifest.d.ts.map +1 -1
- package/dist/install/manifest.js +2 -26
- package/dist/install/manifest.js.map +1 -1
- package/dist/install/missing-skills.d.ts +8 -1
- package/dist/install/missing-skills.d.ts.map +1 -1
- package/dist/install/missing-skills.js +9 -0
- package/dist/install/missing-skills.js.map +1 -1
- package/dist/install/orchestrate.d.ts +13 -1
- package/dist/install/orchestrate.d.ts.map +1 -1
- package/dist/install/orchestrate.js +48 -3
- package/dist/install/orchestrate.js.map +1 -1
- package/dist/install/skill-manifest-sync.d.ts +11 -0
- package/dist/install/skill-manifest-sync.d.ts.map +1 -0
- package/dist/install/skill-manifest-sync.js +65 -0
- package/dist/install/skill-manifest-sync.js.map +1 -0
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +88 -35
- package/dist/openapi.js.map +1 -1
- package/dist/skills/_shared/error-handling.md +1 -1
- package/dist/skills/_shared/polling.md +3 -4
- package/dist/skills/_shared/response-shape.md +5 -7
- package/dist/skills/_shared/verify-and-review.md +2 -2
- package/dist/skills/mma-audit/SKILL.md +17 -7
- package/dist/skills/mma-context-blocks/SKILL.md +5 -5
- package/dist/skills/mma-debug/SKILL.md +17 -7
- package/dist/skills/mma-delegate/SKILL.md +13 -2
- package/dist/skills/mma-execute-plan/SKILL.md +13 -4
- package/dist/skills/mma-explore/SKILL.md +10 -4
- package/dist/skills/mma-investigate/SKILL.md +18 -8
- package/dist/skills/mma-retry/SKILL.md +7 -1
- package/dist/skills/mma-review/SKILL.md +17 -7
- package/dist/skills/mma-verify/SKILL.md +17 -7
- package/dist/skills/multi-model-agent/SKILL.md +14 -15
- package/dist/telemetry/consent.d.ts +1 -1
- package/dist/telemetry/consent.d.ts.map +1 -1
- package/dist/telemetry/consent.js +1 -1
- package/dist/telemetry/consent.js.map +1 -1
- package/dist/telemetry/flusher.js +1 -1
- package/dist/telemetry/flusher.js.map +1 -1
- package/dist/telemetry/notice.d.ts +1 -1
- package/dist/telemetry/notice.d.ts.map +1 -1
- package/dist/telemetry/recorder.d.ts +2 -2
- package/dist/telemetry/recorder.d.ts.map +1 -1
- package/dist/telemetry/recorder.js +12 -11
- package/dist/telemetry/recorder.js.map +1 -1
- package/package.json +2 -2
- package/dist/http/cross-tier-guard.d.ts +0 -15
- package/dist/http/cross-tier-guard.d.ts.map +0 -1
- package/dist/http/cross-tier-guard.js +0 -30
- package/dist/http/cross-tier-guard.js.map +0 -1
- package/dist/http/handlers/control/clarifications.d.ts +0 -19
- package/dist/http/handlers/control/clarifications.d.ts.map +0 -1
- package/dist/http/handlers/control/clarifications.js +0 -58
- package/dist/http/handlers/control/clarifications.js.map +0 -1
- package/dist/http/test-provider-override.d.ts +0 -4
- package/dist/http/test-provider-override.d.ts.map +0 -1
- package/dist/http/test-provider-override.js +0 -17
- package/dist/http/test-provider-override.js.map +0 -1
- package/dist/skills/mma-clarifications/SKILL.md +0 -129
|
@@ -6,8 +6,8 @@ import { deleteInstallId } from './install-id.js';
|
|
|
6
6
|
import { buildInstallMeta } from './install-meta.js';
|
|
7
7
|
import { Queue } from './queue.js';
|
|
8
8
|
import { readGeneration, bumpGeneration } from './generation.js';
|
|
9
|
-
import { SCHEMA_VERSION, TaskCompletedEventSchema, ValidatedTaskCompletedEventSchema } from '@zhixuan92/multi-model-agent-core/telemetry
|
|
10
|
-
import { buildTaskCompletedEvent, } from '@zhixuan92/multi-model-agent-core/
|
|
9
|
+
import { SCHEMA_VERSION, TaskCompletedEventSchema, ValidatedTaskCompletedEventSchema } from '@zhixuan92/multi-model-agent-core/events/telemetry-types';
|
|
10
|
+
import { buildTaskCompletedEvent, } from '@zhixuan92/multi-model-agent-core/events/event-builder';
|
|
11
11
|
/**
|
|
12
12
|
* Run both base-schema and cross-field validation on a built event
|
|
13
13
|
* without dropping it. Returns deduplicated warnings and separate
|
|
@@ -52,7 +52,7 @@ function checkR6b(event) {
|
|
|
52
52
|
for (let i = 0; i < event.stages.length; i++) {
|
|
53
53
|
const s = event.stages[i];
|
|
54
54
|
if (s.inputTokens > 0) {
|
|
55
|
-
const cachedSum = (s.cachedReadTokens ?? 0) + (s.
|
|
55
|
+
const cachedSum = (s.cachedReadTokens ?? 0) + (s.cachedNonReadTokens ?? 0);
|
|
56
56
|
if (cachedSum > 100 * s.inputTokens) {
|
|
57
57
|
warnings.push({ rule: 'R6b', path: `stages[${i}]` });
|
|
58
58
|
}
|
|
@@ -119,26 +119,27 @@ function _buildRecorder(opts) {
|
|
|
119
119
|
if (!d.enabled)
|
|
120
120
|
return;
|
|
121
121
|
const event = buildTaskCompletedEvent(ctx);
|
|
122
|
-
const
|
|
122
|
+
const ev = event;
|
|
123
|
+
const { warnings, baseIssues, refinedIssues } = collectValidationWarnings(ev);
|
|
123
124
|
if (baseIssues.length > 0) {
|
|
124
125
|
console.warn('mma-telemetry: schema warning (event still emitted)', {
|
|
125
|
-
eventId:
|
|
126
|
+
eventId: ev.eventId,
|
|
126
127
|
issues: baseIssues,
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
130
|
if (refinedIssues.length > 0) {
|
|
130
|
-
const stageModelsByName = (
|
|
131
|
+
const stageModelsByName = (ev.stages ?? []).reduce((acc, s) => {
|
|
131
132
|
if (s.name && s.model)
|
|
132
133
|
acc[s.name] = s.model;
|
|
133
134
|
return acc;
|
|
134
135
|
}, {});
|
|
135
136
|
console.warn('mma-telemetry: cross-field warning (event still emitted)', {
|
|
136
|
-
eventId:
|
|
137
|
-
implementerModel:
|
|
137
|
+
eventId: ev.eventId,
|
|
138
|
+
implementerModel: ev.implementerModel,
|
|
138
139
|
stageModels: stageModelsByName,
|
|
139
|
-
totalDurationMs:
|
|
140
|
-
inputTokens:
|
|
141
|
-
outputTokens:
|
|
140
|
+
totalDurationMs: ev.totalDurationMs,
|
|
141
|
+
inputTokens: ev.inputTokens,
|
|
142
|
+
outputTokens: ev.outputTokens,
|
|
142
143
|
issues: refinedIssues.map((e) => ({
|
|
143
144
|
rule: e.message,
|
|
144
145
|
path: e.path,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/telemetry/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,wBAAwB,EAAE,iCAAiC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/telemetry/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EA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,CAAC;QAED,KAAK,CAAC,cAAc,CAAC,OAAO;YAC1B,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC9B,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;YAC1D,IAAI,UAAU,CAAC,SAAS,CAAC;gBAAE,UAAU,CAAC,SAAS,CAAC,CAAC;YACjD,UAAU,GAAG,IAAI,CAAC;YAClB,IAAI,OAAO,EAAE,eAAe,EAAE,CAAC;gBAC7B,eAAe,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhixuan92/multi-model-agent",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Standalone HTTP server for multi-model-agent. Routes tool-invocation work to Claude, Codex, or OpenAI-compatible sub-agents with async-polling REST dispatch and installable skills for Claude Code, Gemini CLI, Codex CLI, and Cursor.",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@asteasolutions/zod-to-openapi": "^8.5.0",
|
|
55
|
-
"@zhixuan92/multi-model-agent-core": "^
|
|
55
|
+
"@zhixuan92/multi-model-agent-core": "^4.0.0",
|
|
56
56
|
"gray-matter": "^4.0.3",
|
|
57
57
|
"minimist": "^1.2.8",
|
|
58
58
|
"proper-lockfile": "^4.1.2",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ServerResponse } from 'node:http';
|
|
2
|
-
import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
|
|
3
|
-
/**
|
|
4
|
-
* Guards read-only routes against misconfigured cross-tier review topology.
|
|
5
|
-
*
|
|
6
|
-
* Read-only routes (audit, review, verify, investigate, debug) require both
|
|
7
|
-
* 'standard' and 'complex' agent slots to be configured so the quality_only
|
|
8
|
-
* review pipeline can run cross-tier comparison.
|
|
9
|
-
*
|
|
10
|
-
* Callers MUST check the read-only-review kill switch before calling this
|
|
11
|
-
* function — if quality review is disabled for the route, the cross-tier
|
|
12
|
-
* check is skipped entirely.
|
|
13
|
-
*/
|
|
14
|
-
export declare function assertCrossTierConfigured(config: MultiModelConfig, res: ServerResponse): boolean;
|
|
15
|
-
//# sourceMappingURL=cross-tier-guard.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cross-tier-guard.d.ts","sourceRoot":"","sources":["../../src/http/cross-tier-guard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,cAAc,GAClB,OAAO,CA6BT"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { sendError } from './errors.js';
|
|
2
|
-
/**
|
|
3
|
-
* Guards read-only routes against misconfigured cross-tier review topology.
|
|
4
|
-
*
|
|
5
|
-
* Read-only routes (audit, review, verify, investigate, debug) require both
|
|
6
|
-
* 'standard' and 'complex' agent slots to be configured so the quality_only
|
|
7
|
-
* review pipeline can run cross-tier comparison.
|
|
8
|
-
*
|
|
9
|
-
* Callers MUST check the read-only-review kill switch before calling this
|
|
10
|
-
* function — if quality review is disabled for the route, the cross-tier
|
|
11
|
-
* check is skipped entirely.
|
|
12
|
-
*/
|
|
13
|
-
export function assertCrossTierConfigured(config, res) {
|
|
14
|
-
// Cast to unknown — this is a runtime defense-in-depth guard; the Zod schema
|
|
15
|
-
// already requires both slots, but a config constructed outside parseConfig
|
|
16
|
-
// (e.g. in tests) may be missing one.
|
|
17
|
-
const agents = config.agents;
|
|
18
|
-
if (!agents?.standard) {
|
|
19
|
-
sendError(res, 400, 'invalid_configuration', "Read-only routes require both 'standard' and 'complex' slots configured for cross-tier review. " +
|
|
20
|
-
"Configure the missing 'standard' slot or set MMAGENT_READ_ONLY_REVIEW=disabled to skip the review topology.");
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (!agents?.complex) {
|
|
24
|
-
sendError(res, 400, 'invalid_configuration', "Read-only routes require both 'standard' and 'complex' slots configured for cross-tier review. " +
|
|
25
|
-
"Configure the missing 'complex' slot or set MMAGENT_READ_ONLY_REVIEW=disabled to skip the review topology.");
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=cross-tier-guard.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cross-tier-guard.js","sourceRoot":"","sources":["../../src/http/cross-tier-guard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAAwB,EACxB,GAAmB;IAEnB,6EAA6E;IAC7E,4EAA4E;IAC5E,sCAAsC;IACtC,MAAM,MAAM,GAAI,MAA0D,CAAC,MAAM,CAAC;IAElF,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;QACtB,SAAS,CACP,GAAG,EACH,GAAG,EACH,uBAAuB,EACvB,iGAAiG;YAC/F,6GAA6G,CAChH,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;QACrB,SAAS,CACP,GAAG,EACH,GAAG,EACH,uBAAuB,EACvB,iGAAiG;YAC/F,4GAA4G,CAC/G,CAAC;QACF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { RawHandler } from '../../router.js';
|
|
2
|
-
import type { BatchRegistry } from '@zhixuan92/multi-model-agent-core';
|
|
3
|
-
export interface ClarificationsHandlerDeps {
|
|
4
|
-
batchRegistry: BatchRegistry;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* POST /clarifications/confirm — confirms (or idempotently re-confirms) an
|
|
8
|
-
* awaiting_clarification batch by providing the caller's chosen interpretation.
|
|
9
|
-
*
|
|
10
|
-
* Auth required; NOT cwd-gated (operates on a batchId, not a project cwd).
|
|
11
|
-
*
|
|
12
|
-
* Success → 200 { batchId, state: <current state after confirmation> }
|
|
13
|
-
* Errors:
|
|
14
|
-
* invalid body → 400 invalid_request
|
|
15
|
-
* unknown batchId → 404 not_found
|
|
16
|
-
* wrong state w/ different interpretation → 409 invalid_batch_state
|
|
17
|
-
*/
|
|
18
|
-
export declare function buildClarificationsHandler(deps: ClarificationsHandlerDeps): RawHandler;
|
|
19
|
-
//# sourceMappingURL=clarifications.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clarifications.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/control/clarifications.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAEvE,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,yBAAyB,GAAG,UAAU,CA8CtF"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { InvalidBatchStateError } from '@zhixuan92/multi-model-agent-core';
|
|
3
|
-
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
-
const confirmBodySchema = z.object({
|
|
5
|
-
batchId: z.string().uuid(),
|
|
6
|
-
interpretation: z.string().min(1),
|
|
7
|
-
});
|
|
8
|
-
/**
|
|
9
|
-
* POST /clarifications/confirm — confirms (or idempotently re-confirms) an
|
|
10
|
-
* awaiting_clarification batch by providing the caller's chosen interpretation.
|
|
11
|
-
*
|
|
12
|
-
* Auth required; NOT cwd-gated (operates on a batchId, not a project cwd).
|
|
13
|
-
*
|
|
14
|
-
* Success → 200 { batchId, state: <current state after confirmation> }
|
|
15
|
-
* Errors:
|
|
16
|
-
* invalid body → 400 invalid_request
|
|
17
|
-
* unknown batchId → 404 not_found
|
|
18
|
-
* wrong state w/ different interpretation → 409 invalid_batch_state
|
|
19
|
-
*/
|
|
20
|
-
export function buildClarificationsHandler(deps) {
|
|
21
|
-
return async (_req, res, _params, ctx) => {
|
|
22
|
-
// ── 1. Validate body ───────────────────────────────────────────────────
|
|
23
|
-
const parsed = confirmBodySchema.safeParse(ctx.body);
|
|
24
|
-
if (!parsed.success) {
|
|
25
|
-
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
26
|
-
fieldErrors: parsed.error.flatten(),
|
|
27
|
-
});
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const { batchId, interpretation } = parsed.data;
|
|
31
|
-
// ── 2. Lookup ──────────────────────────────────────────────────────────
|
|
32
|
-
const entry = deps.batchRegistry.get(batchId);
|
|
33
|
-
if (!entry) {
|
|
34
|
-
sendError(res, 404, 'not_found', `Batch ${batchId} not found`);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
// ── 3. Resume (handles idempotency + state validation) ─────────────────
|
|
38
|
-
try {
|
|
39
|
-
deps.batchRegistry.resumeFromClarification(batchId, interpretation);
|
|
40
|
-
}
|
|
41
|
-
catch (err) {
|
|
42
|
-
if (err instanceof InvalidBatchStateError) {
|
|
43
|
-
sendError(res, 409, 'invalid_batch_state', `Cannot confirm clarification: batch is in state '${err.currentState}'`, {
|
|
44
|
-
currentState: err.currentState,
|
|
45
|
-
});
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
throw err;
|
|
49
|
-
}
|
|
50
|
-
// ── 4. Echo current state ──────────────────────────────────────────────
|
|
51
|
-
// Re-read the entry after resumeFromClarification — the batch may have
|
|
52
|
-
// already completed if the executor was waiting.
|
|
53
|
-
const updatedEntry = deps.batchRegistry.get(batchId);
|
|
54
|
-
const currentState = updatedEntry?.state ?? 'pending';
|
|
55
|
-
sendJson(res, 200, { batchId, state: currentState });
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=clarifications.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clarifications.js","sourceRoot":"","sources":["../../../../src/http/handlers/control/clarifications.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAQtD,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IAC1B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAClC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B,CAAC,IAA+B;IACxE,OAAO,KAAK,EACV,IAAqB,EACrB,GAAmB,EACnB,OAA+B,EAC/B,GAAG,EACH,EAAE;QACF,0EAA0E;QAC1E,MAAM,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrD,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,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;QAEhD,0EAA0E;QAC1E,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAC9C,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,SAAS,OAAO,YAAY,CAAC,CAAC;YAC/D,OAAO;QACT,CAAC;QAED,0EAA0E;QAC1E,IAAI,CAAC;YACH,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;QACtE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,sBAAsB,EAAE,CAAC;gBAC1C,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,qBAAqB,EAAE,oDAAoD,GAAG,CAAC,YAAY,GAAG,EAAE;oBAClH,YAAY,EAAE,GAAG,CAAC,YAAY;iBAC/B,CAAC,CAAC;gBACH,OAAO;YACT,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,0EAA0E;QAC1E,uEAAuE;QACvE,iDAAiD;QACjD,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACrD,MAAM,YAAY,GAAG,YAAY,EAAE,KAAK,IAAI,SAAS,CAAC;QAEtD,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Provider } from '@zhixuan92/multi-model-agent-core';
|
|
2
|
-
export declare function __setTestProviderOverride(provider: Provider | null): void;
|
|
3
|
-
export declare function __getTestProviderOverride(): Provider | null;
|
|
4
|
-
//# sourceMappingURL=test-provider-override.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-provider-override.d.ts","sourceRoot":"","sources":["../../src/http/test-provider-override.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAUlE,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,GAAG,IAAI,CAGzE;AAED,wBAAgB,yBAAyB,IAAI,QAAQ,GAAG,IAAI,CAK3D"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
let testProviderOverride = null;
|
|
2
|
-
function assertEnabled() {
|
|
3
|
-
if (process.env.MMAGENT_TEST_PROVIDER_OVERRIDE !== '1') {
|
|
4
|
-
throw new Error('MMAGENT_TEST_PROVIDER_OVERRIDE must be set to 1 to use the test provider override');
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
export function __setTestProviderOverride(provider) {
|
|
8
|
-
assertEnabled();
|
|
9
|
-
testProviderOverride = provider;
|
|
10
|
-
}
|
|
11
|
-
export function __getTestProviderOverride() {
|
|
12
|
-
if (process.env.MMAGENT_TEST_PROVIDER_OVERRIDE !== '1') {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return testProviderOverride;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=test-provider-override.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-provider-override.js","sourceRoot":"","sources":["../../src/http/test-provider-override.ts"],"names":[],"mappings":"AAEA,IAAI,oBAAoB,GAAoB,IAAI,CAAC;AAEjD,SAAS,aAAa;IACpB,IAAI,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAAK,GAAG,EAAE,CAAC;QACvD,MAAM,IAAI,KAAK,CAAC,mFAAmF,CAAC,CAAC;IACvG,CAAC;AACH,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,QAAyB;IACjE,aAAa,EAAE,CAAC;IAChB,oBAAoB,GAAG,QAAQ,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,yBAAyB;IACvC,IAAI,OAAO,CAAC,GAAG,CAAC,8BAA8B,KAAK,GAAG,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mma-clarifications
|
|
3
|
-
description: >-
|
|
4
|
-
Use when a previous mma-* batch's terminal envelope has
|
|
5
|
-
`proposedInterpretation` as a string (not the `not_applicable` sentinel) — the
|
|
6
|
-
service paused waiting for you to confirm or correct its read of the task
|
|
7
|
-
when_to_use: >-
|
|
8
|
-
A previous mma-delegate / mma-audit / mma-review / mma-execute-plan /
|
|
9
|
-
mma-debug / mma-investigate terminal envelope has `proposedInterpretation` as
|
|
10
|
-
a string. Read the proposal, decide whether to accept or correct it, then call
|
|
11
|
-
this skill. The batch resumes immediately after the POST returns. A string
|
|
12
|
-
`proposedInterpretation` is a hard gate — the batch is paused, not
|
|
13
|
-
informational. The batch will not complete until the caller responds. Treating
|
|
14
|
-
it as advisory is the clarification-as-info anti-pattern (AP5).
|
|
15
|
-
version: 3.12.7
|
|
16
|
-
---
|
|
17
|
-
|
|
18
|
-
# mma-clarifications
|
|
19
|
-
|
|
20
|
-
## Overview
|
|
21
|
-
|
|
22
|
-
When a batch pauses with `state: 'awaiting_clarification'`, the service has proposed an interpretation of an ambiguous task and is waiting for your decision. Read the proposal, then `POST /clarifications/confirm` with either the proposal verbatim (accept) or a corrected version (override). The batch resumes immediately.
|
|
23
|
-
|
|
24
|
-
**Core principle:** Clarification is a quality gate, not an error. Ambiguous tasks would silently produce the wrong work — the pause forces a deliberate choice.
|
|
25
|
-
|
|
26
|
-
## When to Use
|
|
27
|
-
|
|
28
|
-
```dot
|
|
29
|
-
digraph when_to_use {
|
|
30
|
-
"Polling a batch?" [shape=diamond];
|
|
31
|
-
"state == awaiting_clarification?" [shape=diamond];
|
|
32
|
-
"proposedInterpretation is a string?" [shape=diamond];
|
|
33
|
-
"Read proposal" [shape=box];
|
|
34
|
-
"Accept or correct" [shape=diamond];
|
|
35
|
-
"POST proposal verbatim" [shape=box];
|
|
36
|
-
"POST corrected text" [shape=box];
|
|
37
|
-
|
|
38
|
-
"Polling a batch?" -> "state == awaiting_clarification?";
|
|
39
|
-
"state == awaiting_clarification?" -> "proposedInterpretation is a string?" [label="yes"];
|
|
40
|
-
"state == awaiting_clarification?" -> "Continue polling" [label="no"];
|
|
41
|
-
"proposedInterpretation is a string?" -> "Read proposal" [label="yes"];
|
|
42
|
-
"Read proposal" -> "Accept or correct";
|
|
43
|
-
"Accept or correct" -> "POST proposal verbatim" [label="proposal is right"];
|
|
44
|
-
"Accept or correct" -> "POST corrected text" [label="proposal is wrong"];
|
|
45
|
-
}
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
**Use when:**
|
|
49
|
-
- Polling a batch and the terminal envelope has `proposedInterpretation` as a string
|
|
50
|
-
- The mma-* skill that dispatched explicitly references this skill in its "if awaiting_clarification" line
|
|
51
|
-
|
|
52
|
-
**Don't use when:**
|
|
53
|
-
- `proposedInterpretation` is `{ kind: 'not_applicable', ... }` → batch isn't waiting; just read `results`
|
|
54
|
-
- The batch failed (`error` is a real object) → don't confirm; debug or re-dispatch
|
|
55
|
-
- You don't yet have a `batchId` → this skill resumes existing batches, not new ones
|
|
56
|
-
|
|
57
|
-
## Endpoint
|
|
58
|
-
|
|
59
|
-
`POST /clarifications/confirm`
|
|
60
|
-
|
|
61
|
-
Auth required. NOT cwd-gated — operates on a `batchId`.
|
|
62
|
-
|
|
63
|
-
@include _shared/auth.md
|
|
64
|
-
|
|
65
|
-
## Request body
|
|
66
|
-
|
|
67
|
-
```json
|
|
68
|
-
{
|
|
69
|
-
"batchId": "550e8400-e29b-41d4-a716-446655440000",
|
|
70
|
-
"interpretation": "Refactor only the auth module, leaving the user module unchanged"
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
| Field | Type | Required | Notes |
|
|
75
|
-
|---|---|---|---|
|
|
76
|
-
| `batchId` | string (UUID) | yes | Batch in `awaiting_clarification` state |
|
|
77
|
-
| `interpretation` | string | yes | Accept proposal verbatim, OR provide corrected text the worker should follow instead |
|
|
78
|
-
|
|
79
|
-
## Response (200)
|
|
80
|
-
|
|
81
|
-
```json
|
|
82
|
-
{ "batchId": "...", "state": "pending" }
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
`state` is usually `pending` (batch resumes). May be `complete` if the executor was already waiting and finishes immediately.
|
|
86
|
-
|
|
87
|
-
## Full flow
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
# 1. Poll until terminal
|
|
91
|
-
RESP=$(curl -f --show-error -s -H "Authorization: Bearer $TOKEN" \
|
|
92
|
-
"http://localhost:$PORT/batch/$BATCH_ID")
|
|
93
|
-
|
|
94
|
-
# 2. Check for a string proposal (not the not_applicable sentinel)
|
|
95
|
-
PROPOSAL=$(echo "$RESP" | jq -r 'select(.proposedInterpretation | type == "string") | .proposedInterpretation')
|
|
96
|
-
|
|
97
|
-
# 3. Confirm — accept proposal verbatim, or supply corrected text
|
|
98
|
-
curl -f --show-error -s -X POST \
|
|
99
|
-
-H "Authorization: Bearer $TOKEN" \
|
|
100
|
-
-H "Content-Type: application/json" \
|
|
101
|
-
-d "{\"batchId\":\"$BATCH_ID\",\"interpretation\":\"$PROPOSAL\"}" \
|
|
102
|
-
"http://localhost:$PORT/clarifications/confirm"
|
|
103
|
-
|
|
104
|
-
# 4. Resume polling for terminal
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
@include _shared/polling.md
|
|
108
|
-
|
|
109
|
-
## Best practices
|
|
110
|
-
|
|
111
|
-
This skill is described in `multi-model-agent` → "Best practices". Clarification resumption is a universal flow — it triggers whenever any batch enters `awaiting_clarification`, regardless of which recipe produced the batch. There is no per-recipe entry to call out.
|
|
112
|
-
|
|
113
|
-
Anti-pattern alert: **`clarification-as-info`** (AP5). A string `proposedInterpretation` is a hard gate, not an FYI. The batch will not complete until the caller responds. Either accept the proposal verbatim or correct it.
|
|
114
|
-
|
|
115
|
-
## Common pitfalls
|
|
116
|
-
|
|
117
|
-
❌ **Confirming a wrong proposal verbatim because "the service knows best"**
|
|
118
|
-
The service is GUESSING from limited context. If the proposal would do the wrong thing, supply corrected `interpretation` text. **Why:** post-confirmation work is hard to undo.
|
|
119
|
-
|
|
120
|
-
❌ **Treating the pause as an error**
|
|
121
|
-
`awaiting_clarification` is a SUCCESS path — it caught ambiguity before producing wrong work. Read, decide, confirm.
|
|
122
|
-
|
|
123
|
-
❌ **Forgetting the `batchId` is the original, not a new one**
|
|
124
|
-
This endpoint mutates the existing batch — it does not create a new one. **Fix:** poll the SAME `batchId` after confirming.
|
|
125
|
-
|
|
126
|
-
❌ **Polling without checking `proposedInterpretation`'s shape**
|
|
127
|
-
The field is either a `string` (paused) or `{ kind: 'not_applicable' }` (terminal). **Fix:** check the JSON type before treating it as text.
|
|
128
|
-
|
|
129
|
-
@include _shared/error-handling.md
|