ccem 2.80.0 → 2.82.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/dist/index.js +23 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2467,6 +2467,22 @@ import path7 from "path";
|
|
|
2467
2467
|
// src/desktopControl.ts
|
|
2468
2468
|
import fs7 from "fs";
|
|
2469
2469
|
import path6 from "path";
|
|
2470
|
+
function validateDesktopTaskModel(provider, model) {
|
|
2471
|
+
if (model === void 0 || model === null) return void 0;
|
|
2472
|
+
if (provider !== "codex") {
|
|
2473
|
+
throw new Error("MODEL_PROVIDER_UNSUPPORTED: task model selection is only available for Codex sessions.");
|
|
2474
|
+
}
|
|
2475
|
+
if (typeof model !== "string" || model !== model.trim() || !/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,255}$/.test(model)) {
|
|
2476
|
+
throw new Error("MODEL_INVALID: expected a model identifier (1-256 ASCII letters, digits, dots, underscores, colons, slashes or hyphens; starting with a letter or digit).");
|
|
2477
|
+
}
|
|
2478
|
+
return model;
|
|
2479
|
+
}
|
|
2480
|
+
function requireTaskModelCapability(health) {
|
|
2481
|
+
const capability = health?.capabilities?.taskModelSelection;
|
|
2482
|
+
if (capability?.version !== 1 || !Array.isArray(capability.providers) || !capability.providers.includes("codex")) {
|
|
2483
|
+
throw new Error("MODEL_SELECTION_UNSUPPORTED: this Desktop does not advertise Codex task model selection v1. No session was created.");
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2470
2486
|
var DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
2471
2487
|
var LOOPBACK_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "[::1]"]);
|
|
2472
2488
|
var ENDPOINT_UNREACHABLE_CODES = /* @__PURE__ */ new Set([
|
|
@@ -6138,12 +6154,16 @@ desktopCmd.command("health").description("Check the running CCEM Desktop control
|
|
|
6138
6154
|
const result = await requestDesktopControl("ccem.health");
|
|
6139
6155
|
outputDesktopResult(result, opts);
|
|
6140
6156
|
});
|
|
6141
|
-
desktopCmd.command("create").description("Create a workspace session in the running CCEM Desktop app").requiredOption("--provider <provider>", "Agent provider: claude or codex").requiredOption("--cwd <path>", "Working directory").requiredOption("--prompt <text>", "Initial prompt").option("--env <name>", "Environment name").option("--perm <mode>", "Permission mode").option("--runtime-perm <mode>", "Runtime permission mode").option("--provider-session-id <id>", "Provider session id to continue").option("--effort <level>", "Codex effort level").option("--open <value>", "Open the created session in Desktop (true/false)").option("--route <key=env>", "Add a session route binding (repeatable)", collectDesktopRoute, []).option("--routes-json <json>", "Session route bindings as a JSON object").option("--json", "Output JSON").action(async function() {
|
|
6157
|
+
desktopCmd.command("create").description("Create a workspace session in the running CCEM Desktop app").requiredOption("--provider <provider>", "Agent provider: claude or codex").requiredOption("--cwd <path>", "Working directory").requiredOption("--prompt <text>", "Initial prompt").option("--env <name>", "Environment name").option("--perm <mode>", "Permission mode").option("--runtime-perm <mode>", "Runtime permission mode").option("--provider-session-id <id>", "Provider session id to continue").option("--effort <level>", "Codex effort level").option("--model <model>", "Requested task model (Codex only)").option("--open <value>", "Open the created session in Desktop (true/false)").option("--route <key=env>", "Add a session route binding (repeatable)", collectDesktopRoute, []).option("--routes-json <json>", "Session route bindings as a JSON object").option("--json", "Output JSON").action(async function() {
|
|
6142
6158
|
const opts = this.opts();
|
|
6143
6159
|
const provider = String(opts.provider).trim().toLowerCase();
|
|
6144
6160
|
if (provider !== "claude" && provider !== "codex") {
|
|
6145
6161
|
throw new Error("Unsupported provider. Use 'claude' or 'codex'.");
|
|
6146
6162
|
}
|
|
6163
|
+
const model = validateDesktopTaskModel(provider, opts.model);
|
|
6164
|
+
const descriptor = model === void 0 ? void 0 : resolveDesktopControlDescriptor();
|
|
6165
|
+
const request = descriptor === void 0 ? requestDesktopControl : (method, params) => requestDesktopControl(method, params, descriptor);
|
|
6166
|
+
if (model !== void 0) requireTaskModelCapability(await request("ccem.health"));
|
|
6147
6167
|
const hasRouteOptions = opts.route.length > 0 || opts.routesJson !== void 0;
|
|
6148
6168
|
const routes = provider === "claude" ? parseDesktopRoutes(opts.route, opts.routesJson) : void 0;
|
|
6149
6169
|
if (provider === "codex" && hasRouteOptions) {
|
|
@@ -6151,7 +6171,7 @@ desktopCmd.command("create").description("Create a workspace session in the runn
|
|
|
6151
6171
|
"Warning: Codex sessions do not support routing; --route and --routes-json were ignored."
|
|
6152
6172
|
));
|
|
6153
6173
|
}
|
|
6154
|
-
const result = await
|
|
6174
|
+
const result = await request("ccem.workspace.createSession", {
|
|
6155
6175
|
provider,
|
|
6156
6176
|
cwd: opts.cwd,
|
|
6157
6177
|
prompt: opts.prompt,
|
|
@@ -6160,6 +6180,7 @@ desktopCmd.command("create").description("Create a workspace session in the runn
|
|
|
6160
6180
|
runtimePermissionMode: opts.runtimePerm ?? null,
|
|
6161
6181
|
providerSessionId: opts.providerSessionId ?? null,
|
|
6162
6182
|
effort: opts.effort ?? null,
|
|
6183
|
+
...model === void 0 ? {} : { model },
|
|
6163
6184
|
open: parseOptionalBoolean(opts.open),
|
|
6164
6185
|
...routes === void 0 ? {} : { routes }
|
|
6165
6186
|
});
|