@commonlyai/cli 0.1.404 → 0.1.405

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commonlyai/cli",
3
- "version": "0.1.404",
3
+ "version": "0.1.405",
4
4
  "license": "Apache-2.0",
5
5
  "description": "The Commonly CLI — connect agents, manage pods, iterate fast",
6
6
  "type": "module",
@@ -1,3 +1,4 @@
1
+ import { Option } from 'commander';
1
2
  import { createOwnKeyResolver, createMachineReportClient } from '../lib/own-key-launch.js';
2
3
  import { foregroundDaemonHint } from '../lib/daemon-hint.js';
3
4
  import { loadDaemonRecord } from '../lib/daemon-store.js';
@@ -116,7 +117,9 @@ import {
116
117
  import { formatPodConventionsFrame } from '../lib/pod-conventions.js';
117
118
  import { claimReleaseFor, ackResultFor, EMPTY_OUTPUT } from '../lib/claim-outcome.js';
118
119
  import { createClaimedWorkGate } from '../lib/claimed-work-gate.js';
119
- import { prepareCommitAttribution } from '../lib/commit-attribution.js';
120
+ import {
121
+ commitAttributionEnabled, prepareCommitAttribution, withCommitAttributionChoice,
122
+ } from '../lib/commit-attribution.js';
120
123
  import { detectBwrap } from '../lib/sandbox/bwrap.js';
121
124
  import { resolveCodexSandboxMode, resolvePublicSandboxMode } from '../lib/sandbox/mode.js';
122
125
  import {
@@ -2312,6 +2315,9 @@ export const performRun = ({
2312
2315
  // (lib/long-poll.js). Undefined derives it from the read timeout; 0 turns
2313
2316
  // the long-poll off. Tests pin a small value.
2314
2317
  longPollWaitMs: longPollWaitOverride,
2318
+ // F656: false when the person turned commit attribution off for this agent
2319
+ // (the record's `commitAttribution`). Unset is on, as it always was.
2320
+ commitAttribution: commitAttributionOn = true,
2315
2321
  }) => {
2316
2322
  const stateKey = localKey || agentName;
2317
2323
  const supervising = superviseRuns ?? superviseRunsByDefault(adapter?.name);
@@ -3379,7 +3385,9 @@ export const performRun = ({
3379
3385
  // The local CLI is a wrapper for a Commonly seat, so its Git commits
3380
3386
  // carry the seat and the adapter's selected model/effort. `stub` exists
3381
3387
  // only for tests and has no commit-making child process.
3382
- if (adapter?.name !== 'stub') {
3388
+ // F656: the person turned attribution off for this agent, so nothing is
3389
+ // prepared and the child gets the plain environment.
3390
+ if (adapter?.name !== 'stub' && commitAttributionOn !== false) {
3383
3391
  commitAttribution = prepareCommitAttribution({
3384
3392
  cwd: placement.cwd,
3385
3393
  env: process.env,
@@ -5997,6 +6005,10 @@ Docs:
5997
6005
  .option('--refusal-handoff <agent>', 'Agent to @mention when the model provider refuses a request\'s content; the request is acked as refused, never retried')
5998
6006
  .option('--allow <grants>', 'On first run of an agent that works in its folder, also let it edit files and run commands (write) and/or fetch web pages (web), comma-separated. Commands reach the network.')
5999
6007
  .option('--unsandboxed', 'Native Windows, or a private Codex agent on Linux: run this agent without a sandbox, with your own access to files and commands. It gets no connector grants. Codex can run commands in invite-only pods, where anyone in the pod, including people invited later, can direct it.')
6008
+ // The positive form first, so no flag leaves opts.commitAttribution
6009
+ // undefined (the saved choice) rather than commander's implied true.
6010
+ .addOption(new Option('--commit-attribution').hideHelp())
6011
+ .option('--no-commit-attribution', "Don't add Co-authored-by and Agent-Model trailers to this agent's commits; saved for its later runs, and --commit-attribution turns them back on")
6000
6012
  .option('--api-url <url>', 'The Commonly instance this agent joins (the Connect your own agent page fills it in; same as COMMONLY_API_URL)')
6001
6013
  .option('--connect <code>', "The connect code from the Connect your own agent page's line, traded once for this agent's key; it stops working once the agent has listened, or after 30 minutes")
6002
6014
  .action(async (typedName, opts) => {
@@ -6282,6 +6294,9 @@ Docs:
6282
6294
  ? 'this agent is set to workspace trust'
6283
6295
  : "a pod this agent answers in isn't confirmed private and invite-only"}, so it runs in Codex's own sandbox.`);
6284
6296
  }
6297
+ // F656: --[no-]commit-attribution is saved on the record, so a later run
6298
+ // and a daemon-started seat (which passes no flag) keep the choice.
6299
+ record = withCommitAttributionChoice(record, opts.commitAttribution);
6285
6300
  if (saved && record !== saved) saveAgentToken(name, record);
6286
6301
  if (bootstrapped) {
6287
6302
  // A named instance is saved under its seat key; an unnamed run keeps
@@ -6357,6 +6372,10 @@ Docs:
6357
6372
  });
6358
6373
 
6359
6374
  console.log(`${stamp()} [${name}] polling ${record.instanceUrl} for events (ctrl+c to stop)`);
6375
+ if (!commitAttributionEnabled(record)) {
6376
+ console.log(`${stamp()} [${name}] commit attribution is off: this agent's commits get no Co-authored-by `
6377
+ + `or Agent-Model trailers. To turn it back on: ${CLI} agent run ${name} --commit-attribution`);
6378
+ }
6360
6379
  console.log(`${stamp()} [${name}] ${foregroundDaemonHint({ daemonRegistered: hasDaemonRecord(), instanceUrl: record.instanceUrl })}`);
6361
6380
  // TASK-660: one line when this CLI is stale. Fired, not awaited, so a
6362
6381
  // slow registry never delays the first poll.
@@ -6398,6 +6417,7 @@ Docs:
6398
6417
  readGrantBrokers: !record.machineId && process.env.COMMONLY_MANAGED_RUNNER !== '1',
6399
6418
  spawnCredentialTtlSeconds: resolveSpawnTtlSeconds(process.env),
6400
6419
  refusalHandoff: opts.refusalHandoff || null,
6420
+ commitAttribution: commitAttributionEnabled(record),
6401
6421
  log: (line) => console.log(`${stamp()} [${name}] ${line}`),
6402
6422
  // Both sinks are stamped, and both must be — but not for the reason
6403
6423
  // this comment gave until now, which its own PR falsified.
@@ -389,3 +389,25 @@ export const prepareCommitAttribution = ({
389
389
  };
390
390
 
391
391
  export const supportedGitHooks = () => [...GIT_HOOKS];
392
+
393
+ // F656: the person can turn the trailers off for one agent. The choice lives
394
+ // on the agent's local record as `commitAttribution: false`; any other value,
395
+ // or none, is on. Off means prepareCommitAttribution is never called, so no
396
+ // hooks directory, core.hooksPath overlay or COMMONLY_AGENT_* metadata exists.
397
+ export const commitAttributionEnabled = (record) => record?.commitAttribution !== false;
398
+
399
+ /**
400
+ * The record after `agent run`'s flag: false saves off, true removes the field
401
+ * (the default again), undefined (no flag, as a daemon-started seat runs)
402
+ * keeps the saved choice. The same object comes back when nothing changes.
403
+ */
404
+ export const withCommitAttributionChoice = (record, flag) => {
405
+ if (flag === false) {
406
+ return record.commitAttribution === false ? record : { ...record, commitAttribution: false };
407
+ }
408
+ if (flag === true && Object.hasOwn(record, 'commitAttribution')) {
409
+ const { commitAttribution: _cleared, ...rest } = record;
410
+ return rest;
411
+ }
412
+ return record;
413
+ };