@zhixuan92/multi-model-agent 3.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/LICENSE +21 -0
- package/README.md +217 -0
- package/dist/cli/index.d.ts +61 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +252 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install-skill.d.ts +158 -0
- package/dist/cli/install-skill.d.ts.map +1 -0
- package/dist/cli/install-skill.js +425 -0
- package/dist/cli/install-skill.js.map +1 -0
- package/dist/cli/print-token.d.ts +18 -0
- package/dist/cli/print-token.d.ts.map +1 -0
- package/dist/cli/print-token.js +60 -0
- package/dist/cli/print-token.js.map +1 -0
- package/dist/cli/serve.d.ts +44 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +61 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/status.d.ts +49 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +155 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/http/async-dispatch.d.ts +32 -0
- package/dist/http/async-dispatch.d.ts.map +1 -0
- package/dist/http/async-dispatch.js +53 -0
- package/dist/http/async-dispatch.js.map +1 -0
- package/dist/http/auth.d.ts +26 -0
- package/dist/http/auth.d.ts.map +1 -0
- package/dist/http/auth.js +64 -0
- package/dist/http/auth.js.map +1 -0
- package/dist/http/cwd-validator.d.ts +11 -0
- package/dist/http/cwd-validator.d.ts.map +1 -0
- package/dist/http/cwd-validator.js +115 -0
- package/dist/http/cwd-validator.js.map +1 -0
- package/dist/http/errors.d.ts +4 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +9 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/execution-context.d.ts +15 -0
- package/dist/http/execution-context.d.ts.map +1 -0
- package/dist/http/execution-context.js +35 -0
- package/dist/http/execution-context.js.map +1 -0
- package/dist/http/handler-deps.d.ts +16 -0
- package/dist/http/handler-deps.d.ts.map +1 -0
- package/dist/http/handler-deps.js +2 -0
- package/dist/http/handler-deps.js.map +1 -0
- package/dist/http/handlers/control/batch.d.ts +24 -0
- package/dist/http/handlers/control/batch.d.ts.map +1 -0
- package/dist/http/handlers/control/batch.js +81 -0
- package/dist/http/handlers/control/batch.js.map +1 -0
- package/dist/http/handlers/control/clarifications.d.ts +19 -0
- package/dist/http/handlers/control/clarifications.d.ts.map +1 -0
- package/dist/http/handlers/control/clarifications.js +58 -0
- package/dist/http/handlers/control/clarifications.js.map +1 -0
- package/dist/http/handlers/control/context-blocks.d.ts +22 -0
- package/dist/http/handlers/control/context-blocks.d.ts.map +1 -0
- package/dist/http/handlers/control/context-blocks.js +88 -0
- package/dist/http/handlers/control/context-blocks.js.map +1 -0
- package/dist/http/handlers/introspection/health.d.ts +13 -0
- package/dist/http/handlers/introspection/health.d.ts.map +1 -0
- package/dist/http/handlers/introspection/health.js +17 -0
- package/dist/http/handlers/introspection/health.js.map +1 -0
- package/dist/http/handlers/introspection/status.d.ts +26 -0
- package/dist/http/handlers/introspection/status.d.ts.map +1 -0
- package/dist/http/handlers/introspection/status.js +136 -0
- package/dist/http/handlers/introspection/status.js.map +1 -0
- package/dist/http/handlers/introspection/tools-list.d.ts +9 -0
- package/dist/http/handlers/introspection/tools-list.d.ts.map +1 -0
- package/dist/http/handlers/introspection/tools-list.js +28 -0
- package/dist/http/handlers/introspection/tools-list.js.map +1 -0
- package/dist/http/handlers/tools/audit.d.ts +4 -0
- package/dist/http/handlers/tools/audit.d.ts.map +1 -0
- package/dist/http/handlers/tools/audit.js +39 -0
- package/dist/http/handlers/tools/audit.js.map +1 -0
- package/dist/http/handlers/tools/debug.d.ts +4 -0
- package/dist/http/handlers/tools/debug.d.ts.map +1 -0
- package/dist/http/handlers/tools/debug.js +39 -0
- package/dist/http/handlers/tools/debug.js.map +1 -0
- package/dist/http/handlers/tools/delegate.d.ts +4 -0
- package/dist/http/handlers/tools/delegate.d.ts.map +1 -0
- package/dist/http/handlers/tools/delegate.js +57 -0
- package/dist/http/handlers/tools/delegate.js.map +1 -0
- package/dist/http/handlers/tools/execute-plan.d.ts +4 -0
- package/dist/http/handlers/tools/execute-plan.d.ts.map +1 -0
- package/dist/http/handlers/tools/execute-plan.js +39 -0
- package/dist/http/handlers/tools/execute-plan.js.map +1 -0
- package/dist/http/handlers/tools/retry.d.ts +4 -0
- package/dist/http/handlers/tools/retry.d.ts.map +1 -0
- package/dist/http/handlers/tools/retry.js +52 -0
- package/dist/http/handlers/tools/retry.js.map +1 -0
- package/dist/http/handlers/tools/review.d.ts +4 -0
- package/dist/http/handlers/tools/review.d.ts.map +1 -0
- package/dist/http/handlers/tools/review.js +39 -0
- package/dist/http/handlers/tools/review.js.map +1 -0
- package/dist/http/handlers/tools/verify.d.ts +4 -0
- package/dist/http/handlers/tools/verify.d.ts.map +1 -0
- package/dist/http/handlers/tools/verify.js +39 -0
- package/dist/http/handlers/tools/verify.js.map +1 -0
- package/dist/http/loopback.d.ts +17 -0
- package/dist/http/loopback.d.ts.map +1 -0
- package/dist/http/loopback.js +43 -0
- package/dist/http/loopback.js.map +1 -0
- package/dist/http/middleware/body-reader.d.ts +16 -0
- package/dist/http/middleware/body-reader.d.ts.map +1 -0
- package/dist/http/middleware/body-reader.js +44 -0
- package/dist/http/middleware/body-reader.js.map +1 -0
- package/dist/http/project-registry.d.ts +54 -0
- package/dist/http/project-registry.d.ts.map +1 -0
- package/dist/http/project-registry.js +132 -0
- package/dist/http/project-registry.js.map +1 -0
- package/dist/http/router.d.ts +14 -0
- package/dist/http/router.d.ts.map +1 -0
- package/dist/http/router.js +41 -0
- package/dist/http/router.js.map +1 -0
- package/dist/http/server.d.ts +16 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +235 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/types.d.ts +9 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +2 -0
- package/dist/http/types.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/install/claude-code.d.ts +43 -0
- package/dist/install/claude-code.d.ts.map +1 -0
- package/dist/install/claude-code.js +65 -0
- package/dist/install/claude-code.js.map +1 -0
- package/dist/install/codex-cli.d.ts +39 -0
- package/dist/install/codex-cli.d.ts.map +1 -0
- package/dist/install/codex-cli.js +318 -0
- package/dist/install/codex-cli.js.map +1 -0
- package/dist/install/cursor.d.ts +72 -0
- package/dist/install/cursor.d.ts.map +1 -0
- package/dist/install/cursor.js +81 -0
- package/dist/install/cursor.js.map +1 -0
- package/dist/install/gemini-cli.d.ts +66 -0
- package/dist/install/gemini-cli.d.ts.map +1 -0
- package/dist/install/gemini-cli.js +111 -0
- package/dist/install/gemini-cli.js.map +1 -0
- package/dist/install/include-utils.d.ts +27 -0
- package/dist/install/include-utils.d.ts.map +1 -0
- package/dist/install/include-utils.js +90 -0
- package/dist/install/include-utils.js.map +1 -0
- package/dist/install/manifest.d.ts +90 -0
- package/dist/install/manifest.d.ts.map +1 -0
- package/dist/install/manifest.js +200 -0
- package/dist/install/manifest.js.map +1 -0
- package/dist/openapi.d.ts +15 -0
- package/dist/openapi.d.ts.map +1 -0
- package/dist/openapi.js +314 -0
- package/dist/openapi.js.map +1 -0
- package/dist/skills/_shared/auth.md +32 -0
- package/dist/skills/_shared/error-handling.md +31 -0
- package/dist/skills/_shared/polling.md +40 -0
- package/dist/skills/_shared/response-shape.md +46 -0
- package/dist/skills/mma-audit/SKILL.md +55 -0
- package/dist/skills/mma-clarifications/SKILL.md +68 -0
- package/dist/skills/mma-context-blocks/SKILL.md +69 -0
- package/dist/skills/mma-debug/SKILL.md +59 -0
- package/dist/skills/mma-delegate/SKILL.md +63 -0
- package/dist/skills/mma-execute-plan/SKILL.md +63 -0
- package/dist/skills/mma-retry/SKILL.md +54 -0
- package/dist/skills/mma-review/SKILL.md +55 -0
- package/dist/skills/mma-verify/SKILL.md +57 -0
- package/dist/skills/multi-model-agent/SKILL.md +55 -0
- package/package.json +60 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { RawHandler } from '../../router.js';
|
|
2
|
+
import type { BatchRegistry } from '@zhixuan92/multi-model-agent-core';
|
|
3
|
+
import type { ProjectRegistry } from '../../project-registry.js';
|
|
4
|
+
/**
|
|
5
|
+
* SemVer range this server is compatible with for installed skills.
|
|
6
|
+
* A manifest version that does NOT match means the skill is out of date.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SKILL_VERSION_COMPATIBLE = ">=3.0.0 <4.0.0";
|
|
9
|
+
export interface StatusHandlerDeps {
|
|
10
|
+
batchRegistry: BatchRegistry;
|
|
11
|
+
projectRegistry: ProjectRegistry;
|
|
12
|
+
serverStartedAt: number;
|
|
13
|
+
bind: string;
|
|
14
|
+
version: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* GET /status — operator introspection endpoint.
|
|
18
|
+
*
|
|
19
|
+
* Requires both:
|
|
20
|
+
* - Bearer auth (enforced by server pipeline, step 4)
|
|
21
|
+
* - Loopback origin (enforced by server pipeline, step 3 — LOOPBACK_ONLY_PATHS)
|
|
22
|
+
*
|
|
23
|
+
* Returns the §5.10 status shape.
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildStatusHandler(deps: StatusHandlerDeps): RawHandler;
|
|
26
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/introspection/status.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AASjE;;;GAGG;AACH,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAsDzD,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,aAAa,CAAC;IAC7B,eAAe,EAAE,eAAe,CAAC;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,iBAAiB,GAAG,UAAU,CAkGtE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// packages/server/src/http/handlers/introspection/status.ts
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { join } from 'node:path';
|
|
5
|
+
import { sendJson } from '../../errors.js';
|
|
6
|
+
/**
|
|
7
|
+
* The skill manifest is installed by the `install-skill` CLI (Phase 9).
|
|
8
|
+
* We read it at /status request time — if absent, skillVersion and
|
|
9
|
+
* skillCompatible are both null.
|
|
10
|
+
*/
|
|
11
|
+
const SKILL_MANIFEST_PATH = join(homedir(), '.multi-model', 'skills-install-manifest.json');
|
|
12
|
+
/**
|
|
13
|
+
* SemVer range this server is compatible with for installed skills.
|
|
14
|
+
* A manifest version that does NOT match means the skill is out of date.
|
|
15
|
+
*/
|
|
16
|
+
export const SKILL_VERSION_COMPATIBLE = '>=3.0.0 <4.0.0';
|
|
17
|
+
/** Simple semver range check: parses major.minor.patch and checks >=min <max. */
|
|
18
|
+
function checkSkillCompatible(version) {
|
|
19
|
+
// Parse the version string
|
|
20
|
+
const match = /^(\d+)\.(\d+)\.(\d+)/.exec(version);
|
|
21
|
+
if (!match)
|
|
22
|
+
return false;
|
|
23
|
+
const [, majorStr, minorStr, patchStr] = match;
|
|
24
|
+
const major = parseInt(majorStr, 10);
|
|
25
|
+
const minor = parseInt(minorStr, 10);
|
|
26
|
+
const patch = parseInt(patchStr, 10);
|
|
27
|
+
// Must be >= 3.0.0
|
|
28
|
+
if (major < 3)
|
|
29
|
+
return false;
|
|
30
|
+
if (major === 3 && minor === 0 && patch < 0)
|
|
31
|
+
return false;
|
|
32
|
+
// Must be < 4.0.0
|
|
33
|
+
if (major >= 4)
|
|
34
|
+
return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
function readSkillManifest() {
|
|
38
|
+
try {
|
|
39
|
+
const raw = readFileSync(SKILL_MANIFEST_PATH, 'utf8');
|
|
40
|
+
const manifest = JSON.parse(raw);
|
|
41
|
+
const skillVersion = typeof manifest['skillVersion'] === 'string'
|
|
42
|
+
? manifest['skillVersion']
|
|
43
|
+
: null;
|
|
44
|
+
if (skillVersion === null) {
|
|
45
|
+
return { skillVersion: null, skillCompatible: null };
|
|
46
|
+
}
|
|
47
|
+
let skillCompatible;
|
|
48
|
+
try {
|
|
49
|
+
skillCompatible = checkSkillCompatible(skillVersion);
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Version parse failed — report incompatible
|
|
53
|
+
skillCompatible = false;
|
|
54
|
+
}
|
|
55
|
+
return { skillVersion, skillCompatible };
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
// File absent or unreadable
|
|
59
|
+
return { skillVersion: null, skillCompatible: null };
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* GET /status — operator introspection endpoint.
|
|
64
|
+
*
|
|
65
|
+
* Requires both:
|
|
66
|
+
* - Bearer auth (enforced by server pipeline, step 4)
|
|
67
|
+
* - Loopback origin (enforced by server pipeline, step 3 — LOOPBACK_ONLY_PATHS)
|
|
68
|
+
*
|
|
69
|
+
* Returns the §5.10 status shape.
|
|
70
|
+
*/
|
|
71
|
+
export function buildStatusHandler(deps) {
|
|
72
|
+
return (_req, res) => {
|
|
73
|
+
const { batchRegistry, projectRegistry, serverStartedAt, bind, version, } = deps;
|
|
74
|
+
const now = Date.now();
|
|
75
|
+
// ── Counters ──────────────────────────────────────────────────────────────
|
|
76
|
+
let activeRequests = 0;
|
|
77
|
+
let activeBatches = 0;
|
|
78
|
+
const projects = [];
|
|
79
|
+
for (const [, pc] of projectRegistry.entries()) {
|
|
80
|
+
const pcActiveBatches = batchRegistry.countActiveForProject(pc.cwd);
|
|
81
|
+
activeRequests += pc.activeRequests;
|
|
82
|
+
activeBatches += pcActiveBatches;
|
|
83
|
+
projects.push({
|
|
84
|
+
cwd: pc.cwd,
|
|
85
|
+
createdAt: pc.createdAt,
|
|
86
|
+
lastActivityAt: pc.lastActivityAt,
|
|
87
|
+
activeRequests: pc.activeRequests,
|
|
88
|
+
activeBatches: pcActiveBatches,
|
|
89
|
+
contextBlockCount: pc.contextBlocks.size,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// ── Batch lists ───────────────────────────────────────────────────────────
|
|
93
|
+
const inflight = [];
|
|
94
|
+
const recent = [];
|
|
95
|
+
for (const entry of batchRegistry.entries()) {
|
|
96
|
+
if (entry.state === 'pending' || entry.state === 'awaiting_clarification') {
|
|
97
|
+
inflight.push({
|
|
98
|
+
batchId: entry.batchId,
|
|
99
|
+
tool: entry.tool,
|
|
100
|
+
cwd: entry.projectCwd,
|
|
101
|
+
startedAt: entry.startedAt,
|
|
102
|
+
state: entry.state,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
else if (entry.state === 'complete' || entry.state === 'failed') {
|
|
106
|
+
recent.push({
|
|
107
|
+
batchId: entry.batchId,
|
|
108
|
+
tool: entry.tool,
|
|
109
|
+
cwd: entry.projectCwd,
|
|
110
|
+
state: entry.state,
|
|
111
|
+
stateChangedAt: entry.stateChangedAt,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// ── Skill manifest ────────────────────────────────────────────────────────
|
|
116
|
+
const { skillVersion, skillCompatible } = readSkillManifest();
|
|
117
|
+
sendJson(res, 200, {
|
|
118
|
+
version,
|
|
119
|
+
pid: process.pid,
|
|
120
|
+
bind,
|
|
121
|
+
uptimeMs: now - serverStartedAt,
|
|
122
|
+
auth: { enabled: true },
|
|
123
|
+
counters: {
|
|
124
|
+
projectCount: projectRegistry.size,
|
|
125
|
+
activeRequests,
|
|
126
|
+
activeBatches,
|
|
127
|
+
},
|
|
128
|
+
projects,
|
|
129
|
+
inflight,
|
|
130
|
+
recent,
|
|
131
|
+
skillVersion,
|
|
132
|
+
skillCompatible,
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../../src/http/handlers/introspection/status.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAa,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAKtD;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,cAAc,EAAE,8BAA8B,CAAC,CAAC;AAE5F;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,gBAAgB,CAAC;AAEzD,iFAAiF;AACjF,SAAS,oBAAoB,CAAC,OAAe;IAC3C,2BAA2B;IAC3B,MAAM,KAAK,GAAG,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC;IAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAS,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAS,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAS,EAAE,EAAE,CAAC,CAAC;IAE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ACnB,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAClE,MAAM,CAAC,IAAI,CAAC;oBACV,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,IAAI,EAAE,KAAK,CAAC,IAAI;oBAChB,GAAG,EAAE,KAAK,CAAC,UAAU;oBACrB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,cAAc,EAAE,KAAK,CAAC,cAAc;iBACrC,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,6EAA6E;QAC7E,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,iBAAiB,EAAE,CAAC;QAE9D,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE;YACjB,OAAO;YACP,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,IAAI;YACJ,QAAQ,EAAE,GAAG,GAAG,eAAe;YAC/B,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;YACvB,QAAQ,EAAE;gBACR,YAAY,EAAE,eAAe,CAAC,IAAI;gBAClC,cAAc;gBACd,aAAa;aACd;YACD,QAAQ;YACR,QAAQ;YACR,MAAM;YACN,YAAY;YACZ,eAAe;SAChB,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RawHandler } from '../../router.js';
|
|
2
|
+
/**
|
|
3
|
+
* GET /tools — serves the OpenAPI 3.0 document describing all server endpoints.
|
|
4
|
+
*
|
|
5
|
+
* Auth is required (checked by the server pipeline) but this endpoint is NOT
|
|
6
|
+
* loopback-gated — LAN clients can fetch the OpenAPI spec.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildToolsHandler(): RawHandler;
|
|
9
|
+
//# sourceMappingURL=tools-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-list.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/introspection/tools-list.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAelD;;;;;GAKG;AACH,wBAAgB,iBAAiB,IAAI,UAAU,CAS9C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { buildOpenApiDoc, serializeOpenApiDoc } from '../../../openapi.js';
|
|
2
|
+
// Build the OpenAPI document once at handler-creation time (module-level lazy
|
|
3
|
+
// singleton pattern — no need to rebuild on every request).
|
|
4
|
+
let cachedDoc;
|
|
5
|
+
function getDocBuffer() {
|
|
6
|
+
if (!cachedDoc) {
|
|
7
|
+
const doc = buildOpenApiDoc();
|
|
8
|
+
cachedDoc = Buffer.from(serializeOpenApiDoc(doc), 'utf8');
|
|
9
|
+
}
|
|
10
|
+
return cachedDoc;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* GET /tools — serves the OpenAPI 3.0 document describing all server endpoints.
|
|
14
|
+
*
|
|
15
|
+
* Auth is required (checked by the server pipeline) but this endpoint is NOT
|
|
16
|
+
* loopback-gated — LAN clients can fetch the OpenAPI spec.
|
|
17
|
+
*/
|
|
18
|
+
export function buildToolsHandler() {
|
|
19
|
+
return (_req, res) => {
|
|
20
|
+
const buf = getDocBuffer();
|
|
21
|
+
res.writeHead(200, {
|
|
22
|
+
'content-type': 'application/json',
|
|
23
|
+
'content-length': String(buf.byteLength),
|
|
24
|
+
});
|
|
25
|
+
res.end(buf);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=tools-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-list.js","sourceRoot":"","sources":["../../../../src/http/handlers/introspection/tools-list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,8EAA8E;AAC9E,4DAA4D;AAC5D,IAAI,SAA6B,CAAC;AAElC,SAAS,YAAY;IACnB,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,GAAG,GAAG,eAAe,EAAE,CAAC;QAC9B,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,CAAC,IAAqB,EAAE,GAAmB,EAAE,EAAE;QACpD,MAAM,GAAG,GAAG,YAAY,EAAE,CAAC;QAC3B,GAAG,CAAC,SAAS,CAAC,GAAG,EAAE;YACjB,cAAc,EAAE,kBAAkB;YAClC,gBAAgB,EAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC;SACzC,CAAC,CAAC;QACH,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACf,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/tools/audit.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAqC/D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as audit from '@zhixuan92/multi-model-agent-core/tool-schemas/audit';
|
|
2
|
+
import { executeAudit } from '@zhixuan92/multi-model-agent-core/executors/audit';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
export function buildAuditHandler(deps) {
|
|
6
|
+
return async (_req, res, _params, ctx) => {
|
|
7
|
+
const parsed = audit.inputSchema.safeParse(ctx.body);
|
|
8
|
+
if (!parsed.success) {
|
|
9
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
10
|
+
fieldErrors: parsed.error.flatten(),
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const input = parsed.data;
|
|
15
|
+
const cwd = ctx.cwd;
|
|
16
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
17
|
+
if (!reserveResult.ok) {
|
|
18
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pc = reserveResult.projectContext;
|
|
22
|
+
pc.lastActivityAt = Date.now();
|
|
23
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
24
|
+
const blockIds = input.contextBlockIds ?? [];
|
|
25
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
26
|
+
tool: 'audit',
|
|
27
|
+
projectCwd: cwd,
|
|
28
|
+
blockIds,
|
|
29
|
+
batchRegistry: deps.batchRegistry,
|
|
30
|
+
projectContext: pc,
|
|
31
|
+
deps,
|
|
32
|
+
executor: async (executionCtx) => {
|
|
33
|
+
return executeAudit(executionCtx, input);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../../../src/http/handlers/tools/audit.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,sDAAsD,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,OAAO,KAAK,EAAE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CAAC;YAC3C,CAAC;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/tools/debug.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAqC/D"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as debug from '@zhixuan92/multi-model-agent-core/tool-schemas/debug';
|
|
2
|
+
import { executeDebug } from '@zhixuan92/multi-model-agent-core/executors/debug';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
export function buildDebugHandler(deps) {
|
|
6
|
+
return async (_req, res, _params, ctx) => {
|
|
7
|
+
const parsed = debug.inputSchema.safeParse(ctx.body);
|
|
8
|
+
if (!parsed.success) {
|
|
9
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
10
|
+
fieldErrors: parsed.error.flatten(),
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const input = parsed.data;
|
|
15
|
+
const cwd = ctx.cwd;
|
|
16
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
17
|
+
if (!reserveResult.ok) {
|
|
18
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pc = reserveResult.projectContext;
|
|
22
|
+
pc.lastActivityAt = Date.now();
|
|
23
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
24
|
+
const blockIds = input.contextBlockIds ?? [];
|
|
25
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
26
|
+
tool: 'debug',
|
|
27
|
+
projectCwd: cwd,
|
|
28
|
+
blockIds,
|
|
29
|
+
batchRegistry: deps.batchRegistry,
|
|
30
|
+
projectContext: pc,
|
|
31
|
+
deps,
|
|
32
|
+
executor: async (executionCtx) => {
|
|
33
|
+
return executeDebug(executionCtx, input);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../../../src/http/handlers/tools/debug.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,sDAAsD,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,OAAO,KAAK,EAAE,IAAqB,EAAE,GAAmB,EAAE,OAA+B,EAAE,GAAG,EAAE,EAAE;QAChG,MAAM,MAAM,GAAG,KAAK,CAAC,WAAW,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,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC;QAC1B,MAAM,GAAG,GAAG,GAAG,CAA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CA2ClE"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import * as delegate from '@zhixuan92/multi-model-agent-core/tool-schemas/delegate';
|
|
2
|
+
import { executeDelegate } from '@zhixuan92/multi-model-agent-core/executors/delegate';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
/** Builds injectDefaults for delegate/retry — fills harness-level TaskSpec fields from config. */
|
|
6
|
+
function makeInjectDefaults(config, cwd) {
|
|
7
|
+
return (tasks) => tasks.map(t => ({
|
|
8
|
+
...t,
|
|
9
|
+
cwd: t.cwd ?? cwd,
|
|
10
|
+
tools: t.tools ?? config.defaults?.tools ?? 'full',
|
|
11
|
+
timeoutMs: t.timeoutMs ?? config.defaults?.timeoutMs ?? 1_800_000,
|
|
12
|
+
maxCostUSD: t.maxCostUSD ?? config.defaults?.maxCostUSD ?? 10,
|
|
13
|
+
sandboxPolicy: t.sandboxPolicy ?? config.defaults?.sandboxPolicy ?? 'cwd-only',
|
|
14
|
+
parentModel: t.parentModel ?? config.defaults?.parentModel ?? process.env['PARENT_MODEL_NAME'],
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
export function buildDelegateHandler(deps) {
|
|
18
|
+
return async (_req, res, _params, ctx) => {
|
|
19
|
+
// Step 7: Validate body against delegate.inputSchema
|
|
20
|
+
const parsed = delegate.inputSchema.safeParse(ctx.body);
|
|
21
|
+
if (!parsed.success) {
|
|
22
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
23
|
+
fieldErrors: parsed.error.flatten(),
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
const input = parsed.data;
|
|
28
|
+
const cwd = ctx.cwd;
|
|
29
|
+
// Step 8: Get or create project context, update activity timestamp
|
|
30
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
31
|
+
if (!reserveResult.ok) {
|
|
32
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const pc = reserveResult.projectContext;
|
|
36
|
+
pc.lastActivityAt = Date.now();
|
|
37
|
+
// Release the reservation (HTTP requests are not session-based)
|
|
38
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
39
|
+
// Step 9: Async-dispatch
|
|
40
|
+
const blockIds = input.tasks.flatMap(t => t.contextBlockIds ?? []);
|
|
41
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
42
|
+
tool: 'delegate',
|
|
43
|
+
projectCwd: cwd,
|
|
44
|
+
blockIds,
|
|
45
|
+
batchRegistry: deps.batchRegistry,
|
|
46
|
+
projectContext: pc,
|
|
47
|
+
deps,
|
|
48
|
+
executor: async (executionCtx) => {
|
|
49
|
+
return executeDelegate(executionCtx, input, {
|
|
50
|
+
injectDefaults: makeInjectDefaults(deps.config, cwd),
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=delegate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delegate.js","sourceRoot":"","sources":["../../../../src/http/handlers/tools/delegate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,QAAQ,MAAM,yDAAyD,CAAC;AACpF,OAAO,EAAE,eAAe,EAAE,MAAM,sDAAsD,CAAC;AAEvF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,kGAAkG;AAClG,SAAS,kBAAkB,CAAC,MAAwB,EAAE,GAAW;IAC/D,OAAO,CAAC,KAAiB,EAAE,EAAE,CAC3B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACd,GAAG,CAAC;QACJ,GAAG,EAAE,CAAC,C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AAU,CAqCrE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as executePlan from '@zhixuan92/multi-model-agent-core/tool-schemas/execute-plan';
|
|
2
|
+
import { executeExecutePlan } from '@zhixuan92/multi-model-agent-core/executors/execute-plan';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
export function buildExecutePlanHandler(deps) {
|
|
6
|
+
return async (_req, res, _params, ctx) => {
|
|
7
|
+
const parsed = executePlan.inputSchema.safeParse(ctx.body);
|
|
8
|
+
if (!parsed.success) {
|
|
9
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
10
|
+
fieldErrors: parsed.error.flatten(),
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const input = parsed.data;
|
|
15
|
+
const cwd = ctx.cwd;
|
|
16
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
17
|
+
if (!reserveResult.ok) {
|
|
18
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pc = reserveResult.projectContext;
|
|
22
|
+
pc.lastActivityAt = Date.now();
|
|
23
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
24
|
+
const blockIds = input.contextBlockIds ?? [];
|
|
25
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
26
|
+
tool: 'execute-plan',
|
|
27
|
+
projectCwd: cwd,
|
|
28
|
+
blockIds,
|
|
29
|
+
batchRegistry: deps.batchRegistry,
|
|
30
|
+
projectContext: pc,
|
|
31
|
+
deps,
|
|
32
|
+
executor: async (executionCtx) => {
|
|
33
|
+
return executeExecutePlan(executionCtx, input);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=execute-plan.js.map
|
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CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QAE5C,MAAM,QAAQ,GAAG,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;QAC7C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,aAAa,CAAC;YAC3C,IAAI,EAAE,cAAc;YACpB,UAAU,EAAE,GAAG;YACf,QAAQ;YACR,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,cAAc,EAAE,EAAE;YAClB,IAAI;YACJ,QAAQ,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;gBAC/B,OAAO,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YACjD,CAAC;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/tools/retry.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAgBlD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAsC/D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as retry from '@zhixuan92/multi-model-agent-core/tool-schemas/retry';
|
|
2
|
+
import { executeRetry } from '@zhixuan92/multi-model-agent-core/executors/retry';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
/** Same inject-defaults logic as delegate — fills harness fields from config. */
|
|
6
|
+
function makeInjectDefaults(config, cwd) {
|
|
7
|
+
return (tasks) => tasks.map(t => ({
|
|
8
|
+
...t,
|
|
9
|
+
cwd: t.cwd ?? cwd,
|
|
10
|
+
tools: t.tools ?? config.defaults?.tools ?? 'full',
|
|
11
|
+
timeoutMs: t.timeoutMs ?? config.defaults?.timeoutMs ?? 1_800_000,
|
|
12
|
+
maxCostUSD: t.maxCostUSD ?? config.defaults?.maxCostUSD ?? 10,
|
|
13
|
+
sandboxPolicy: t.sandboxPolicy ?? config.defaults?.sandboxPolicy ?? 'cwd-only',
|
|
14
|
+
parentModel: t.parentModel ?? config.defaults?.parentModel ?? process.env['PARENT_MODEL_NAME'],
|
|
15
|
+
}));
|
|
16
|
+
}
|
|
17
|
+
export function buildRetryHandler(deps) {
|
|
18
|
+
return async (_req, res, _params, ctx) => {
|
|
19
|
+
const parsed = retry.inputSchema.safeParse(ctx.body);
|
|
20
|
+
if (!parsed.success) {
|
|
21
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
22
|
+
fieldErrors: parsed.error.flatten(),
|
|
23
|
+
});
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const input = parsed.data;
|
|
27
|
+
const cwd = ctx.cwd;
|
|
28
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
29
|
+
if (!reserveResult.ok) {
|
|
30
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const pc = reserveResult.projectContext;
|
|
34
|
+
pc.lastActivityAt = Date.now();
|
|
35
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
36
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
37
|
+
tool: 'retry',
|
|
38
|
+
projectCwd: cwd,
|
|
39
|
+
blockIds: [],
|
|
40
|
+
batchRegistry: deps.batchRegistry,
|
|
41
|
+
projectContext: pc,
|
|
42
|
+
deps,
|
|
43
|
+
executor: async (executionCtx) => {
|
|
44
|
+
return executeRetry(executionCtx, input, {
|
|
45
|
+
injectDefaults: makeInjectDefaults(deps.config, cwd),
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=retry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retry.js","sourceRoot":"","sources":["../../../../src/http/handlers/tools/retry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,sDAAsD,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,iFAAiF;AACjF,SAAS,kBAAkB,CAAC,MAAwB,EAAE,GAAW;IAC/D,OAAO,CAAC,KAAiB,EAAE,EAAE,CAC3B,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACd,GAAG,CAAC;QACJ,GAAG,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG;QACjB,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ,EAAE,KAAK,IAAI,MAAM;QAClD,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,MAAM,CAAC,QAAQ,EAAE,SAAS,IAAI,SAAS;QACjE,UAAU,EAAE,CAAC,CAAC,UAAU,IAAI,MAAM,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE;QAC7D,aAAa,EAAE,CAAC,CAAC,aAAa,IAAI,MAAM,CAAC,QAAQ,EAAE,aAAa,IAAI,UAAU;QAC9E,WAAW,EAAE,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;KAC/F,CAAC,CAAC,CAAC;AACR,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAiB;IACjD,OAAO,KAAK,EAAE,IAAqB,EAAE,GAAmB,EAAE,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CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC7C,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../../../src/http/handlers/tools/review.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,UAAU,CAqChE"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as review from '@zhixuan92/multi-model-agent-core/tool-schemas/review';
|
|
2
|
+
import { executeReview } from '@zhixuan92/multi-model-agent-core/executors/review';
|
|
3
|
+
import { sendError, sendJson } from '../../errors.js';
|
|
4
|
+
import { asyncDispatch } from '../../async-dispatch.js';
|
|
5
|
+
export function buildReviewHandler(deps) {
|
|
6
|
+
return async (_req, res, _params, ctx) => {
|
|
7
|
+
const parsed = review.inputSchema.safeParse(ctx.body);
|
|
8
|
+
if (!parsed.success) {
|
|
9
|
+
sendError(res, 400, 'invalid_request', 'Request body validation failed', {
|
|
10
|
+
fieldErrors: parsed.error.flatten(),
|
|
11
|
+
});
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const input = parsed.data;
|
|
15
|
+
const cwd = ctx.cwd;
|
|
16
|
+
const reserveResult = deps.projectRegistry.reserveProject(cwd);
|
|
17
|
+
if (!reserveResult.ok) {
|
|
18
|
+
sendError(res, 503, reserveResult.error, reserveResult.message);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const pc = reserveResult.projectContext;
|
|
22
|
+
pc.lastActivityAt = Date.now();
|
|
23
|
+
deps.projectRegistry.cancelReservation(cwd);
|
|
24
|
+
const blockIds = input.contextBlockIds ?? [];
|
|
25
|
+
const { batchId, statusUrl } = asyncDispatch({
|
|
26
|
+
tool: 'review',
|
|
27
|
+
projectCwd: cwd,
|
|
28
|
+
blockIds,
|
|
29
|
+
batchRegistry: deps.batchRegistry,
|
|
30
|
+
projectContext: pc,
|
|
31
|
+
deps,
|
|
32
|
+
executor: async (executionCtx) => {
|
|
33
|
+
return executeReview(executionCtx, input);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
sendJson(res, 202, { batchId, statusUrl });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,aAAa,EAAE,MAAM,oDAAoD,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAIxD,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,GAAG,GAAG,CAAC,GAAI,CAAC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