kimi-plugin-cc 2.3.1 → 2.4.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +5 -3
- package/.mcp.json +13 -0
- package/CHANGELOG.md +10 -0
- package/README.md +57 -5
- package/dist/cli-client.js +11 -1
- package/dist/commands/ask.js +4 -2
- package/dist/commands/cancel.js +43 -4
- package/dist/commands/pursue.js +3 -2
- package/dist/commands/rescue.js +3 -2
- package/dist/commands/review-gate.js +2 -4
- package/dist/commands/review.js +4 -2
- package/dist/commands/swarm.js +4 -3
- package/dist/companion.js +13 -40
- package/dist/help.js +2 -0
- package/dist/job-id.js +12 -0
- package/dist/job-store.js +59 -0
- package/dist/jobs.js +9 -1
- package/dist/mcp/binding.js +58 -0
- package/dist/mcp/job-control.js +345 -0
- package/dist/mcp/launcher.js +257 -0
- package/dist/mcp/operations.js +301 -0
- package/dist/mcp/protocol.js +275 -0
- package/dist/mcp/server.js +8 -0
- package/dist/mcp/stdio.js +78 -0
- package/dist/mcp/supervised-child.js +15 -0
- package/dist/mcp/tool-result.js +7 -0
- package/dist/mcp/workspace.js +34 -0
- package/dist/model-command.js +32 -0
- package/dist/version.js +1 -1
- package/docs/migration.md +2 -2
- package/docs/registry-releases.md +6 -8
- package/docs/safety.md +16 -2
- package/package.json +7 -3
- package/plugins/kimi-codex/.codex-plugin/plugin.json +7 -4
- package/plugins/kimi-codex/.mcp.json +28 -0
- package/plugins/kimi-codex/dist/cli-client.js +11 -1
- package/plugins/kimi-codex/dist/commands/ask.js +4 -2
- package/plugins/kimi-codex/dist/commands/cancel.js +43 -4
- package/plugins/kimi-codex/dist/commands/pursue.js +3 -2
- package/plugins/kimi-codex/dist/commands/rescue.js +3 -2
- package/plugins/kimi-codex/dist/commands/review-gate.js +2 -4
- package/plugins/kimi-codex/dist/commands/review.js +4 -2
- package/plugins/kimi-codex/dist/commands/swarm.js +4 -3
- package/plugins/kimi-codex/dist/companion.js +13 -40
- package/plugins/kimi-codex/dist/help.js +2 -0
- package/plugins/kimi-codex/dist/job-id.js +12 -0
- package/plugins/kimi-codex/dist/job-store.js +59 -0
- package/plugins/kimi-codex/dist/jobs.js +9 -1
- package/plugins/kimi-codex/dist/mcp/binding.js +58 -0
- package/plugins/kimi-codex/dist/mcp/job-control.js +345 -0
- package/plugins/kimi-codex/dist/mcp/launcher.js +257 -0
- package/plugins/kimi-codex/dist/mcp/operations.js +301 -0
- package/plugins/kimi-codex/dist/mcp/protocol.js +275 -0
- package/plugins/kimi-codex/dist/mcp/server.js +8 -0
- package/plugins/kimi-codex/dist/mcp/stdio.js +78 -0
- package/plugins/kimi-codex/dist/mcp/supervised-child.js +15 -0
- package/plugins/kimi-codex/dist/mcp/tool-result.js +7 -0
- package/plugins/kimi-codex/dist/mcp/workspace.js +34 -0
- package/plugins/kimi-codex/dist/model-command.js +32 -0
- package/plugins/kimi-codex/dist/version.js +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { realpath, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { RuntimeError } from "../errors.js";
|
|
4
|
+
import { resolveRepoIdentity } from "../git.js";
|
|
5
|
+
export async function resolveMcpWorkspace(env, requested) {
|
|
6
|
+
const defaultCandidate = env.KIMI_PLUGIN_CC_MCP_WORKSPACE;
|
|
7
|
+
const candidate = requested ?? defaultCandidate;
|
|
8
|
+
if (!candidate) {
|
|
9
|
+
throw new RuntimeError("MCP_WORKSPACE_REQUIRED", "This MCP server has no default workspace. Supply the absolute workspace directory explicitly; Codex calls normally require it.", "mcp.workspace");
|
|
10
|
+
}
|
|
11
|
+
const cwd = await canonicalDirectory(candidate, "workspace");
|
|
12
|
+
if (defaultCandidate) {
|
|
13
|
+
const defaultCwd = await canonicalDirectory(defaultCandidate, "host workspace");
|
|
14
|
+
const relative = path.relative(defaultCwd, cwd);
|
|
15
|
+
if (relative === ".." || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
16
|
+
throw new RuntimeError("MCP_WORKSPACE_OUTSIDE_DEFAULT", `workspace must be the host workspace or one of its descendants, not ${cwd} (host: ${defaultCwd}).`, "mcp.workspace");
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return { cwd, repo: await resolveRepoIdentity(cwd) };
|
|
20
|
+
}
|
|
21
|
+
async function canonicalDirectory(candidate, label) {
|
|
22
|
+
if (!path.isAbsolute(candidate)) {
|
|
23
|
+
throw new RuntimeError("MCP_WORKSPACE_NOT_ABSOLUTE", `${label} must be an absolute existing directory.`, "mcp.workspace");
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const cwd = await realpath(candidate);
|
|
27
|
+
if (!(await stat(cwd)).isDirectory())
|
|
28
|
+
throw new Error("not a directory");
|
|
29
|
+
return cwd;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
throw new RuntimeError("MCP_WORKSPACE_INVALID", `${label} is not an accessible existing directory: ${candidate}`, "mcp.workspace", error instanceof Error ? { cause: error } : undefined);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { runAsk } from "./commands/ask.js";
|
|
2
|
+
import { notImplementedCompanionCommand } from "./commands/not-implemented.js";
|
|
3
|
+
import { runPursue } from "./commands/pursue.js";
|
|
4
|
+
import { runRescue } from "./commands/rescue.js";
|
|
5
|
+
import { runReview } from "./commands/review.js";
|
|
6
|
+
import { runSwarm } from "./commands/swarm.js";
|
|
7
|
+
export async function runModelCommand(argv, context) {
|
|
8
|
+
const [command, ...rest] = argv;
|
|
9
|
+
switch (command) {
|
|
10
|
+
case "review":
|
|
11
|
+
return `${await runReview(rest, context, "review")}\n`;
|
|
12
|
+
case "ask":
|
|
13
|
+
return `${await runAsk(rest, context)}\n`;
|
|
14
|
+
case "task": {
|
|
15
|
+
const [taskType, ...taskArgs] = rest;
|
|
16
|
+
switch (taskType) {
|
|
17
|
+
case "rescue":
|
|
18
|
+
return runRescue(taskArgs, context);
|
|
19
|
+
case "challenge":
|
|
20
|
+
return `${await runReview(taskArgs, context, "challenge")}\n`;
|
|
21
|
+
case "pursue":
|
|
22
|
+
return runPursue(taskArgs, context);
|
|
23
|
+
case "swarm":
|
|
24
|
+
return runSwarm(taskArgs, context);
|
|
25
|
+
default:
|
|
26
|
+
notImplementedCompanionCommand(taskType ? `task ${taskType}` : "task");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
default:
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
}
|