@corenel/cli 0.9.5 → 0.10.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 (2) hide show
  1. package/dist/main.js +60 -29
  2. package/package.json +7 -7
package/dist/main.js CHANGED
@@ -28983,6 +28983,14 @@ var init_approvalsStore = __esm({
28983
28983
  });
28984
28984
 
28985
28985
  // ../tools-node/deviceLogin.ts
28986
+ function verificationLink(dc) {
28987
+ const base = dc.verification_uri;
28988
+ const complete = dc.verification_uri_complete;
28989
+ if (typeof complete === "string" && complete.startsWith(base) && (complete[base.length] === "?" || complete[base.length] === "&")) {
28990
+ return complete;
28991
+ }
28992
+ return `${base}${base.includes("?") ? "&" : "?"}code=${encodeURIComponent(dc.user_code)}`;
28993
+ }
28986
28994
  function deadlineSignal(ms, outer) {
28987
28995
  const ac = new AbortController();
28988
28996
  const onOuter = () => ac.abort();
@@ -29050,7 +29058,7 @@ async function deviceLogin(opts) {
29050
29058
  };
29051
29059
  const dc = await post("/oauth/device/code", { client_id: "corenel-cli", scope: "agent pair" });
29052
29060
  if (!dc.device_code) throw new Error("device authorization failed");
29053
- (opts.open ?? defaultOpen)(dc.verification_uri, dc.user_code);
29061
+ (opts.open ?? defaultOpen)(verificationLink(dc), dc.user_code);
29054
29062
  let interval = opts.pollMs ?? Math.max(MIN_POLL_MS, (dc.interval ?? 5) * 1e3);
29055
29063
  const lifetimeMs = (typeof dc.expires_in === "number" && dc.expires_in > 0 ? dc.expires_in : DEFAULT_LIFETIME_S) * 1e3;
29056
29064
  const deadline = Date.now() + lifetimeMs;
@@ -32846,7 +32854,7 @@ function configWorkspaceRoot(base) {
32846
32854
  import { FileRecallStore, UNATTACHED_SESSION } from "@corenel/harness/sessions/fileRecallStore";
32847
32855
  import { makeSessionFoldStorage } from "@corenel/harness/sessions/foldStorage";
32848
32856
  import { makeSummarizer } from "@corenel/harness/core/summarize";
32849
- import { stateDirName as stateDirName7, sessionsRoot, isSourceRun } from "@corenel/protocol";
32857
+ import { stateDirName as stateDirName6, sessionsRoot, isSourceRun } from "@corenel/protocol";
32850
32858
  import { PermissionService as PermissionService6 } from "@corenel/harness/guardrail/permission-service";
32851
32859
 
32852
32860
  // src/nodeContext.ts
@@ -32948,6 +32956,7 @@ var crew_exports = {};
32948
32956
  __export(crew_exports, {
32949
32957
  AUTONOMY_TOOLS: () => AUTONOMY_TOOLS,
32950
32958
  CHECK_IN_BLOCK: () => CHECK_IN_BLOCK,
32959
+ COMMAND_CAPABILITIES: () => COMMAND_CAPABILITIES,
32951
32960
  CREW_EXCLUDED_TOOLS: () => CREW_EXCLUDED_TOOLS,
32952
32961
  CREW_SEG: () => CREW_SEG,
32953
32962
  DEPLOYMENT_FILE: () => DEPLOYMENT_FILE,
@@ -33002,6 +33011,7 @@ __export(crew_exports, {
33002
33011
  foldRoom: () => foldRoom,
33003
33012
  globMatch: () => globMatch,
33004
33013
  grantOfferedTools: () => grantOfferedTools,
33014
+ grantsCommandTools: () => grantsCommandTools,
33005
33015
  interjectHuman: () => interjectHuman,
33006
33016
  isAutonomyPreset: () => isAutonomyPreset,
33007
33017
  isOrchestrator: () => isOrchestrator,
@@ -33024,6 +33034,7 @@ __export(crew_exports, {
33024
33034
  newCrewDraft: () => newCrewDraft,
33025
33035
  nextCronAfter: () => nextCronAfter,
33026
33036
  normalizeRunStatus: () => normalizeRunStatus,
33037
+ offersCommandTools: () => offersCommandTools,
33027
33038
  openLineOf: () => openLineOf,
33028
33039
  openRoom: () => openRoom,
33029
33040
  parseCron: () => parseCron,
@@ -33057,6 +33068,7 @@ __export(crew_exports, {
33057
33068
  takeTurn: () => takeTurn,
33058
33069
  tightenAutonomy: () => tightenAutonomy,
33059
33070
  turnCosts: () => turnCosts,
33071
+ unsandboxedCommandsFact: () => unsandboxedCommandsFact,
33060
33072
  userMemoryRoot: () => userMemoryRoot,
33061
33073
  validateRoomRequest: () => validateRoomRequest,
33062
33074
  writeCrewAgentAt: () => writeCrewAgentAt
@@ -33250,6 +33262,24 @@ function enforcedLevel(policy, cap) {
33250
33262
  });
33251
33263
  }
33252
33264
 
33265
+ // ../crew/commandTools.ts
33266
+ var COMMAND_CAPABILITIES = [
33267
+ { tool: "sidecar_shell_exec", label: "Run shell commands", mutating: true, address: "sidecar:shell_exec", permission: "ask" },
33268
+ { tool: "sidecar_run_check", label: "Run confirmed checks", mutating: true, address: "sidecar:run_check", permission: "ask" },
33269
+ { tool: "proc_start", label: "Start long-running processes", mutating: true, address: "shell:spawn", permission: "ask" }
33270
+ ];
33271
+ function offersCommandTools(toolNames) {
33272
+ const names = new Set(toolNames);
33273
+ return COMMAND_CAPABILITIES.some((c) => names.has(c.tool));
33274
+ }
33275
+ function grantsCommandTools(policy) {
33276
+ return COMMAND_CAPABILITIES.some((c) => enforcedLevel(policy, c) !== "deny");
33277
+ }
33278
+ function unsandboxedCommandsFact(policy, offeredToolNames) {
33279
+ const offered = new Set(offeredToolNames);
33280
+ return COMMAND_CAPABILITIES.some((c) => offered.has(c.tool) && enforcedLevel(policy, c) !== "deny") ? { unsandboxedCommands: true } : {};
33281
+ }
33282
+
33253
33283
  // ../crew/autonomy.ts
33254
33284
  import { SIDECAR_GIT_PUSH, SIDECAR_OPEN_PR } from "@corenel/protocol";
33255
33285
  import { toolAddress, resolveNamespace } from "@corenel/harness/tools/namespaces";
@@ -35106,7 +35136,7 @@ import { createChatClient, setGatewayBase } from "@corenel/harness/providers/gat
35106
35136
  // src/apiBase.ts
35107
35137
  init_tools_node();
35108
35138
  import { DEFAULT_API_BASE as DEFAULT_API_BASE2 } from "@corenel/protocol";
35109
- import { DEV_PROFILE } from "@corenel/protocol";
35139
+ import { DEV_PROFILE, SANDBOX_GATEWAY_BASE_ENV } from "@corenel/protocol";
35110
35140
  var InvalidApiBaseError = class extends Error {
35111
35141
  constructor(value, why) {
35112
35142
  super(`invalid API base ${JSON.stringify(value)} -- ${why}`);
@@ -35160,7 +35190,10 @@ async function resolveCliApiBase(explicit, opts = {}) {
35160
35190
  if (url.protocol !== "https:" && url.protocol !== "http:") {
35161
35191
  throw new InvalidApiBaseError(value, `the scheme must be https or http, not ${url.protocol.replace(/:$/, "")}`);
35162
35192
  }
35163
- if (url.protocol === "http:" && !isLoopback(url.hostname) && !warnedCleartext) {
35193
+ const trim2 = (s) => s.trim().replace(/\/+$/, "");
35194
+ const marker = env[SANDBOX_GATEWAY_BASE_ENV];
35195
+ const sanctioned = typeof marker === "string" && marker.trim() !== "" && trim2(marker) === trim2(value);
35196
+ if (url.protocol === "http:" && !isLoopback(url.hostname) && !sanctioned && !warnedCleartext) {
35164
35197
  warnedCleartext = true;
35165
35198
  process.stderr.write(
35166
35199
  `corenel: warning: ${url.host} is plain http, so your access token is sent in cleartext. Use https unless this host is on a private network you trust.
@@ -35341,10 +35374,10 @@ var EXTENSIONS = [
35341
35374
  }
35342
35375
  },
35343
35376
  {
35344
- command: "sessions",
35377
+ command: "sandboxes",
35345
35378
  ...SIDECAR,
35346
- summary: "list and inspect local sandbox sessions",
35347
- argv: (rest) => ["sessions", ...rest]
35379
+ summary: "create, list and run in local sandboxes",
35380
+ argv: (rest) => ["sandboxes", ...rest]
35348
35381
  },
35349
35382
  {
35350
35383
  command: "crew",
@@ -35448,14 +35481,13 @@ async function runExtension(ext, rest, look = {}) {
35448
35481
  }
35449
35482
 
35450
35483
  // src/commands.ts
35451
- import { stateDirName as stateDirName4 } from "@corenel/protocol";
35452
35484
  var COMMANDS = [
35453
35485
  { name: "", args: "", summary: "with no command: an interactive agent in this directory" },
35454
- { name: "run", args: '"<prompt>" [--allow-mutations] | --session ID "<prompt>"', summary: "one-shot turn, then exit -- refuses writes/shell unless --allow-mutations; --session runs the bare prompt in a sandbox instead and ignores every other flag" },
35486
+ { name: "run", args: '"<prompt>" [--allow-mutations] | --sandbox ID "<prompt>"', summary: "one-shot turn, then exit -- refuses writes/shell unless --allow-mutations; --sandbox runs the bare prompt in a sandbox instead and ignores every other flag" },
35455
35487
  { name: "run-agent", args: '<name> --input "<text>" [--allow-mutations]', summary: "run a crew agent (same refuse-by-default gate as run); events as JSON Lines on stdout" },
35456
35488
  { name: "sidecar", args: "[start] [flags]", summary: "run the sidecar on this machine" },
35457
35489
  { name: "acp", args: "<agent> [flags]", summary: "proxy an external coding agent under Corenel policy" },
35458
- { name: "sessions", args: "[list|show|create|run]", summary: "create, list and run in local sandbox sessions" },
35490
+ { name: "sandboxes", args: "[list|show|create|run|pause|resume|destroy]", summary: "create, list and run in local sandboxes" },
35459
35491
  { name: "crew", args: "deployments | deploy|undeploy|resume <agent> | pause <agent> --reason R", summary: "deploy, undeploy, pause and resume crew agents on this machine" },
35460
35492
  { name: "login", args: "[--base URL]", summary: "sign in through your browser (device flow)" },
35461
35493
  { name: "auth", summary: "show whether you are signed in, and as what" },
@@ -35508,12 +35540,7 @@ function helpText(version2) {
35508
35540
  " --version, -v print the version",
35509
35541
  " --help, -h print this",
35510
35542
  "",
35511
- "--resume reopens a CONVERSATION (this face's own chat log, saved under",
35512
- `${stateDirName4()}/sessions/) -- not the same thing as \`run --session ID\` or the`,
35513
- "`sessions` command below, which forward into a sandbox on the sidecar.",
35514
- "Same word, two different nouns.",
35515
- "",
35516
- "sidecar, acp, sessions and crew are provided by @corenel/sidecar, installed separately.",
35543
+ "sidecar, acp, sandboxes and crew are provided by @corenel/sidecar, installed separately.",
35517
35544
  "Each takes its own flags: `corenel sidecar --help`.",
35518
35545
  "",
35519
35546
  "Exit codes (corenel run, corenel run-agent):",
@@ -36626,7 +36653,7 @@ function shellTool(cwd) {
36626
36653
  import { procTools } from "@corenel/harness/tools/procs";
36627
36654
 
36628
36655
  // src/sidecarConnect.ts
36629
- import { stateDirName as stateDirName5 } from "@corenel/protocol";
36656
+ import { stateDirName as stateDirName4 } from "@corenel/protocol";
36630
36657
  import { SidecarHost, isSidecarKeyMismatch, isSidecarAccountRefusal } from "@corenel/harness/sidecar/host";
36631
36658
 
36632
36659
  // ../../node_modules/.pnpm/ws@8.21.0/node_modules/ws/wrapper.mjs
@@ -37018,7 +37045,7 @@ async function connectSidecarProcs(env = process.env, store = cliDeviceStore(),
37018
37045
  const host = new SidecarHost({
37019
37046
  channel,
37020
37047
  ...credential,
37021
- stateDir: stateDirName5(),
37048
+ stateDir: stateDirName4(),
37022
37049
  clientId: `corenel-cli-${process.pid}`,
37023
37050
  clientName: cliDeviceName(),
37024
37051
  onIdentityChallenge: identity2.answer,
@@ -37063,7 +37090,7 @@ async function connectMcpAdmin(env = process.env, store = cliDeviceStore(), iden
37063
37090
  const host = new SidecarHost({
37064
37091
  channel,
37065
37092
  ...credential,
37066
- stateDir: stateDirName5(),
37093
+ stateDir: stateDirName4(),
37067
37094
  clientId: `corenel-cli-${process.pid}`,
37068
37095
  clientName: cliDeviceName(),
37069
37096
  onIdentityChallenge: identity2.answer,
@@ -37331,7 +37358,7 @@ async function resolveStrategyPrompt(files, id) {
37331
37358
  init_tools_node();
37332
37359
  import { readFile as readFile2, stat } from "node:fs/promises";
37333
37360
  import { join as join11 } from "node:path";
37334
- import { stateDirName as stateDirName6 } from "@corenel/protocol";
37361
+ import { stateDirName as stateDirName5 } from "@corenel/protocol";
37335
37362
  import { BUILTIN_POLICIES, STANDARD_POLICY as STANDARD_POLICY3, policyFromYaml } from "@corenel/harness/guardrail";
37336
37363
  var PolicyResolutionError = class extends Error {
37337
37364
  detail;
@@ -37416,7 +37443,7 @@ async function resolvePolicy(opts) {
37416
37443
  }
37417
37444
  return { policy: STANDARD_POLICY3, source: { kind: "default" }, warnings };
37418
37445
  }
37419
- const workspacePath = join11(cwd, stateDirName6(), "policy.yaml");
37446
+ const workspacePath = join11(cwd, stateDirName5(), "policy.yaml");
37420
37447
  if (await fileExists(workspacePath)) {
37421
37448
  warnings.push(
37422
37449
  `corenel: ${workspacePath} ignored -- a policy inside the workspace can be written by the agent or arrive in a cloned repo. To use it for this folder, move it to ${projectPath}, or pass --policy ${workspacePath} explicitly.`
@@ -38958,7 +38985,7 @@ async function agentSetup(argv, chosenModel) {
38958
38985
  try {
38959
38986
  const migrated = await migrateHomeLayout();
38960
38987
  if (migrated.moved.length) {
38961
- console.error(`layout: moved ${migrated.moved.length} item(s) into the current ~/${stateDirName7()} layout`);
38988
+ console.error(`layout: moved ${migrated.moved.length} item(s) into the current ~/${stateDirName6()} layout`);
38962
38989
  }
38963
38990
  for (const left of migrated.skipped) console.error(`layout: left ${left.path} alone (${left.reason})`);
38964
38991
  } catch (e) {
@@ -39026,19 +39053,23 @@ async function buildRunPermission(opts) {
39026
39053
  }) };
39027
39054
  }
39028
39055
  async function run(argv) {
39056
+ if (hasValueFlag(argv, "session")) {
39057
+ process.stderr.write("corenel: --session is not a flag of `run`. To run inside a sandbox use --sandbox ID.\n");
39058
+ process.exit(2);
39059
+ }
39029
39060
  const prompt = promptOf(argv);
39030
39061
  if (!prompt) {
39031
- process.stderr.write('usage: corenel run "<prompt>" [--model M] [--base URL] [--session ID] [--allow-mutations]\n [--max-usd N] [--max-tokens N] [--max-ms N] [--on-budget stop|warn]\n');
39062
+ process.stderr.write('usage: corenel run "<prompt>" [--model M] [--base URL] [--sandbox ID] [--allow-mutations]\n [--max-usd N] [--max-tokens N] [--max-ms N] [--on-budget stop|warn]\n');
39032
39063
  process.exit(2);
39033
39064
  }
39034
39065
  const budget = budgetConstraintsFrom(argv);
39035
- const session = flag(argv, "session", "");
39036
- if (session) {
39066
+ const sandbox = flag(argv, "sandbox", "");
39067
+ if (sandbox) {
39037
39068
  if (hasAllowMutationsFlag(argv) || hasValueFlag(argv, "model") || hasValueFlag(argv, "base") || budget) {
39038
- process.stderr.write("corenel: note: --session ignores every other flag on this line -- the sandboxed run uses its own defaults.\n");
39069
+ process.stderr.write("corenel: note: --sandbox ignores every other flag on this line -- the sandboxed run uses its own defaults.\n");
39039
39070
  }
39040
- const ext = findExtension("sessions");
39041
- process.exitCode = ext ? await runExtension(ext, ["run", session, prompt]) : 2;
39071
+ const ext = findExtension("sandboxes");
39072
+ process.exitCode = ext ? await runExtension(ext, ["run", sandbox, prompt]) : 2;
39042
39073
  return;
39043
39074
  }
39044
39075
  const { client, model, system, tools, policy, memory, disconnect } = await agentSetup(argv);
@@ -39395,7 +39426,7 @@ async function main() {
39395
39426
  }
39396
39427
  case "sidecar":
39397
39428
  case "acp":
39398
- case "sessions":
39429
+ case "sandboxes":
39399
39430
  case "crew": {
39400
39431
  const ext = findExtension(cmd);
39401
39432
  process.exitCode = ext ? await runExtension(ext, rest) : 2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@corenel/cli",
3
- "version": "0.9.5",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "description": "Corenel CLI — runs the harness in node, in-proc, no transport. The headless proof the kernel is host-agnostic. (corenel run/ask/chat/login + start --sidecar to follow.)",
6
6
  "bin": {
@@ -9,11 +9,11 @@
9
9
  "dependencies": {
10
10
  "openai": "^4.77.0",
11
11
  "ws": "^8.18.0",
12
- "@corenel/mcp": "0.6.3",
13
- "@corenel/term": "0.8.4",
14
- "@corenel/harness": "0.18.0",
15
- "@corenel/config": "0.7.3",
16
- "@corenel/protocol": "0.16.0"
12
+ "@corenel/config": "0.7.4",
13
+ "@corenel/protocol": "0.17.0",
14
+ "@corenel/harness": "0.19.0",
15
+ "@corenel/mcp": "0.6.4",
16
+ "@corenel/term": "0.8.5"
17
17
  },
18
18
  "devDependencies": {
19
19
  "esbuild": "^0.21.5",
@@ -22,7 +22,7 @@
22
22
  "tsx": "^4.19.2",
23
23
  "typescript": "^5.9.3",
24
24
  "@corenel/crew": "0.0.0",
25
- "@corenel/tools-node": "0.8.3"
25
+ "@corenel/tools-node": "0.9.0"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"