@brainbase-labs/cli 0.59.0 → 0.60.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/index.js +326 -154
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36091,7 +36091,7 @@ function padStart(s, n) {
36091
36091
  // package.json
36092
36092
  var package_default = {
36093
36093
  name: "@brainbase-labs/cli",
36094
- version: "0.59.0",
36094
+ version: "0.60.0",
36095
36095
  description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
36096
36096
  type: "module",
36097
36097
  bin: {
@@ -64820,6 +64820,61 @@ var import_picocolors24 = __toESM(require_picocolors(), 1);
64820
64820
  import path82 from "node:path";
64821
64821
  import fs70 from "node:fs";
64822
64822
 
64823
+ // src/core/self-delegation-concurrency.ts
64824
+ var SelfDelegationConcurrencySchema = exports_external.number().int().min(1).nullable().optional();
64825
+ var field = "self_delegation_concurrency_limit";
64826
+ var hasLimit = (state) => !!state && Object.prototype.hasOwnProperty.call(state, field) && state[field] !== undefined;
64827
+ function concurrencyManifest(cloud, previous) {
64828
+ const source = cloud.self_delegation_concurrency_supported === true ? cloud : previous;
64829
+ return concurrencyLimit(source);
64830
+ }
64831
+ function concurrencyLimit(state) {
64832
+ return hasLimit(state) ? { [field]: state[field] } : {};
64833
+ }
64834
+ function concurrencyBaseline(cloud, previous) {
64835
+ if (cloud.self_delegation_concurrency_supported === true) {
64836
+ return { self_delegation_concurrency_supported: true, ...concurrencyManifest(cloud) };
64837
+ }
64838
+ return {
64839
+ ...previous?.self_delegation_concurrency_supported === true ? { self_delegation_concurrency_supported: true } : {},
64840
+ ...concurrencyManifest({}, previous)
64841
+ };
64842
+ }
64843
+ function diffConcurrency(local, previous, cloud) {
64844
+ const known = previous?.self_delegation_concurrency_supported === true;
64845
+ const authored = hasLimit(local);
64846
+ const baseline = hasLimit(previous);
64847
+ const supported = cloud.self_delegation_concurrency_supported === true;
64848
+ const localChanged = supported && (known ? local[field] !== previous[field] : authored && local[field] !== cloud[field]);
64849
+ const cloudChanged = supported && (known ? cloud[field] !== previous[field] : hasLimit(cloud) && local[field] !== cloud[field]);
64850
+ const same = local[field] === cloud[field];
64851
+ return {
64852
+ localChanged: localChanged && !same,
64853
+ cloudChanged: cloudChanged && !same,
64854
+ conflict: localChanged && cloudChanged && !same,
64855
+ converged: supported && same && (localChanged || known && cloud[field] !== previous[field]),
64856
+ unsupported: !supported && (authored || known && baseline)
64857
+ };
64858
+ }
64859
+ function concurrencyWrite(local, cloud, diff2) {
64860
+ if (cloud.self_delegation_concurrency_supported !== true || !diff2.localChanged)
64861
+ return {};
64862
+ return {
64863
+ ...concurrencyLimit(local),
64864
+ reconcile_self_delegation_concurrency: true
64865
+ };
64866
+ }
64867
+ function concurrencyBaselineAfterPush(local, previous, diff2) {
64868
+ return diff2.localChanged || diff2.converged ? concurrencyBaseline({ ...local, self_delegation_concurrency_supported: true }) : concurrencyBaseline({}, previous);
64869
+ }
64870
+ function verifyConcurrencyWrite(input, result2) {
64871
+ if (!hasLimit(input) && !input.reconcile_self_delegation_concurrency)
64872
+ return;
64873
+ if (result2.self_delegation_concurrency_supported !== true || input[field] !== result2[field]) {
64874
+ throw new Error("This control plane did not apply self_delegation_concurrency_limit. Upgrade it or enable self-delegation before retrying; the sync baseline is unchanged.");
64875
+ }
64876
+ }
64877
+
64823
64878
  // src/core/agent-manifest.ts
64824
64879
  import path81 from "node:path";
64825
64880
  import fs69 from "node:fs";
@@ -64963,6 +65018,7 @@ var AgentManifestSchema = exports_external.object({
64963
65018
  machine_kind: exports_external.string().trim().min(1).optional(),
64964
65019
  default_model: exports_external.string().trim().regex(MODEL_ID_RE, "default_model must use letters, digits, and . _ - : / only (max 128)").nullable().optional(),
64965
65020
  runtime_mode: exports_external.enum(["fixed", "auto"]).optional(),
65021
+ self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
64966
65022
  agent: AgentMetaSchema,
64967
65023
  instructions: InstructionsSchema.optional(),
64968
65024
  entrypoint: EntrypointSchema.optional(),
@@ -64994,6 +65050,7 @@ var MANIFEST_KEY_SYNC = {
64994
65050
  machine_kind: "synced",
64995
65051
  default_model: "synced",
64996
65052
  runtime_mode: "synced",
65053
+ self_delegation_concurrency_limit: "synced",
64997
65054
  agent: "synced",
64998
65055
  instructions: "synced",
64999
65056
  entrypoint: "synced",
@@ -65278,6 +65335,8 @@ var AgentMetaSnapshotSchema = exports_external.object({
65278
65335
  machine_kind: exports_external.string().min(1).optional(),
65279
65336
  default_model: exports_external.string().nullable().optional(),
65280
65337
  runtime_mode: exports_external.enum(["fixed", "auto"]).optional(),
65338
+ self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
65339
+ self_delegation_concurrency_supported: exports_external.boolean().optional(),
65281
65340
  memory: exports_external.boolean().nullable().optional(),
65282
65341
  browser: exports_external.boolean().nullable().optional()
65283
65342
  });
@@ -66251,6 +66310,7 @@ var WRITABLE_CAPABILITIES = ["memory", "browser"];
66251
66310
  var MIRRORED_CAPABILITIES = ["slack", "meeting", "github", "linear"];
66252
66311
  function manifestConfigState(manifest) {
66253
66312
  return {
66313
+ ...hasOwn(manifest, "self_delegation_concurrency_limit") ? { self_delegation_concurrency_limit: manifest.self_delegation_concurrency_limit } : {},
66254
66314
  ...manifest.machine_kind !== undefined ? { machine_kind: manifest.machine_kind } : {},
66255
66315
  ...hasOwn(manifest, "default_model") ? { default_model: manifest.default_model ?? null } : {},
66256
66316
  ...manifest.runtime_mode !== undefined ? { runtime_mode: manifest.runtime_mode } : {},
@@ -66260,6 +66320,8 @@ function manifestConfigState(manifest) {
66260
66320
  }
66261
66321
  function cloudConfigState(agent) {
66262
66322
  return {
66323
+ ...agent.self_delegation_concurrency_supported === true ? { self_delegation_concurrency_supported: true } : {},
66324
+ ...hasOwn(agent, "self_delegation_concurrency_limit") ? { self_delegation_concurrency_limit: agent.self_delegation_concurrency_limit } : {},
66263
66325
  ...agent.machine_kind !== undefined ? { machine_kind: agent.machine_kind } : {},
66264
66326
  ...hasOwn(agent, "default_model") ? { default_model: agent.default_model ?? null } : {},
66265
66327
  ...agent.runtime_mode !== undefined ? { runtime_mode: agent.runtime_mode } : {},
@@ -66290,6 +66352,9 @@ function staleConnectionMirrors(manifest, cloud) {
66290
66352
  }
66291
66353
  function diffAgentConfig(manifest, lock, cloud) {
66292
66354
  const unsupported = [];
66355
+ const { unsupported: concurrencyUnsupported, ...concurrency } = diffConcurrency(manifest, lock, cloud);
66356
+ if (concurrencyUnsupported)
66357
+ unsupported.push("self_delegation_concurrency_limit");
66293
66358
  const machineSupported = cloud.machine_kind !== undefined;
66294
66359
  const defaultModelSupported = hasOwn(cloud, "default_model");
66295
66360
  if (manifest.machine_kind !== undefined && !machineSupported) {
@@ -66332,9 +66397,10 @@ function diffAgentConfig(manifest, lock, cloud) {
66332
66397
  defaultModelCloudChanged: defaultModel.cloudChanged,
66333
66398
  defaultModelConflict: defaultModel.conflict,
66334
66399
  runtimeMode,
66400
+ concurrency,
66335
66401
  memory,
66336
66402
  browser,
66337
- baselineConverged: machineConverged || defaultModel.converged || runtimeMode.converged || memory.converged || browser.converged
66403
+ baselineConverged: machineConverged || defaultModel.converged || runtimeMode.converged || concurrency.converged || memory.converged || browser.converged
66338
66404
  };
66339
66405
  }
66340
66406
  function threeWayField(supported, authored, cloudRaw, lock, key2) {
@@ -67851,12 +67917,13 @@ async function runAgentPull(cwd2, args) {
67851
67917
  cloud: cloud.components
67852
67918
  });
67853
67919
  const config = diffAgentConfig(existingManifest ?? {}, lock?.agentMeta, cloudAgent);
67854
- const localRuntimeConfigChanged = config.machineLocalChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged;
67920
+ const localRuntimeConfigChanged = config.machineLocalChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged || config.concurrency.localChanged;
67855
67921
  if (localRuntimeConfigChanged && !args.force) {
67856
67922
  f2.error(`Runtime config has local edits that pull would overwrite: ${[
67857
67923
  ...config.machineLocalChanged ? ["machine_kind"] : [],
67858
67924
  ...config.defaultModelLocalChanged ? ["default_model"] : [],
67859
- ...config.runtimeMode.localChanged ? ["runtime_mode"] : []
67925
+ ...config.runtimeMode.localChanged ? ["runtime_mode"] : [],
67926
+ ...config.concurrency.localChanged ? ["self_delegation_concurrency_limit"] : []
67860
67927
  ].join(", ")}.`);
67861
67928
  if (config.machineLocalChanged) {
67862
67929
  f2.info(`machine_kind cannot change on an existing agent. Run ${import_picocolors28.default.cyan("brainbase agent pull --force")} to discard the edit, or create a new agent for that provider.`);
@@ -67872,7 +67939,8 @@ async function runAgentPull(cwd2, args) {
67872
67939
  }
67873
67940
  const runtimeModeChanged = config.runtimeMode.cloudChanged || existingManifest?.runtime_mode === "fixed" && cloudAgent.runtime_mode === "fixed" || !!args.force && config.runtimeMode.localChanged;
67874
67941
  const leadConfigChanged = config.machineCloudChanged || config.defaultModelCloudChanged || !!args.force && (config.machineLocalChanged || config.defaultModelLocalChanged);
67875
- const runtimeConfigChanged = leadConfigChanged || runtimeModeChanged;
67942
+ const concurrencyChanged = config.concurrency.cloudChanged || !!args.force && config.concurrency.localChanged;
67943
+ const runtimeConfigChanged = leadConfigChanged || runtimeModeChanged || concurrencyChanged;
67876
67944
  const toInstallKeys = new Set;
67877
67945
  const toRemoveKeys = new Set;
67878
67946
  const conflicts = [];
@@ -67981,7 +68049,8 @@ async function runAgentPull(cwd2, args) {
67981
68049
  label: "runtime config",
67982
68050
  text: [
67983
68051
  ...leadConfigChanged ? ["machine/model"] : [],
67984
- ...runtimeModeChanged ? ["runtime_mode"] : []
68052
+ ...runtimeModeChanged ? ["runtime_mode"] : [],
68053
+ ...concurrencyChanged ? ["self_delegation_concurrency_limit"] : []
67985
68054
  ].join(" + ") + " from cloud"
67986
68055
  });
67987
68056
  }
@@ -68135,7 +68204,8 @@ async function runAgentPull(cwd2, args) {
68135
68204
  ...cloudAgent.machine_kind ? { machine_kind: cloudAgent.machine_kind } : lock?.agentMeta?.machine_kind ? { machine_kind: lock.agentMeta.machine_kind } : {},
68136
68205
  ...Object.prototype.hasOwnProperty.call(cloudAgent, "default_model") ? { default_model: cloudAgent.default_model ?? null } : Object.prototype.hasOwnProperty.call(lock?.agentMeta ?? {}, "default_model") ? { default_model: lock.agentMeta.default_model ?? null } : {},
68137
68206
  ...capabilityBaseline(cloudAgent, lock?.agentMeta),
68138
- ...runtimeModeBaseline(cloudAgent, lock?.agentMeta)
68207
+ ...runtimeModeBaseline(cloudAgent, lock?.agentMeta),
68208
+ ...concurrencyBaseline(cloudAgent, lock?.agentMeta)
68139
68209
  }
68140
68210
  };
68141
68211
  writeSyncState(cwd2, newState);
@@ -68342,6 +68412,7 @@ function mergeManifest(cwd2, prev, cloud, cloudAgent, harness, localOnly = {}, s
68342
68412
  const defaultModelSupported = Object.prototype.hasOwnProperty.call(cloudAgent, "default_model");
68343
68413
  return {
68344
68414
  schema: 1,
68415
+ ...concurrencyManifest(cloudAgent, prev ?? undefined),
68345
68416
  id: cloudAgent.id,
68346
68417
  harness,
68347
68418
  ...machineKind ? { machine_kind: machineKind } : {},
@@ -68444,7 +68515,8 @@ function buildLockFromCloud(agent_id, cloud, prev, cloudAgent) {
68444
68515
  ...cloudAgent.machine_kind ? { machine_kind: cloudAgent.machine_kind } : prev?.agentMeta?.machine_kind ? { machine_kind: prev.agentMeta.machine_kind } : {},
68445
68516
  ...Object.prototype.hasOwnProperty.call(cloudAgent, "default_model") ? { default_model: cloudAgent.default_model ?? null } : Object.prototype.hasOwnProperty.call(prev?.agentMeta ?? {}, "default_model") ? { default_model: prev.agentMeta.default_model ?? null } : {},
68446
68517
  ...capabilityBaseline(cloudAgent, prev?.agentMeta),
68447
- ...runtimeModeBaseline(cloudAgent, prev?.agentMeta)
68518
+ ...runtimeModeBaseline(cloudAgent, prev?.agentMeta),
68519
+ ...concurrencyBaseline(cloudAgent, prev?.agentMeta)
68448
68520
  } : prev?.agentMeta
68449
68521
  };
68450
68522
  }
@@ -69073,8 +69145,8 @@ function fastApiValidationMessage(body) {
69073
69145
  }).filter((part) => !!part);
69074
69146
  return parts.length ? parts.join("; ") : null;
69075
69147
  }
69076
- function rejectsBodyField(body, field) {
69077
- return fastApiDetails(body).some((entry) => entry.type === "extra_forbidden" && Array.isArray(entry.loc) && entry.loc[0] === "body" && entry.loc[1] === field);
69148
+ function rejectsBodyField(body, field2) {
69149
+ return fastApiDetails(body).some((entry) => entry.type === "extra_forbidden" && Array.isArray(entry.loc) && entry.loc[0] === "body" && entry.loc[1] === field2);
69078
69150
  }
69079
69151
 
69080
69152
  // src/core/interfaces-api.ts
@@ -69940,6 +70012,11 @@ async function runAgentPush(cwd2, args) {
69940
70012
  }
69941
70013
  f2.warn(`${import_picocolors30.default.yellow("--force")}: overwriting the cloud runtime_mode with the local value.`);
69942
70014
  }
70015
+ if (config.concurrency.conflict && !args.force) {
70016
+ f2.error("Cannot push: self_delegation_concurrency_limit conflicts with cloud or has no sync baseline. Pull first, or use --force to keep the local value.");
70017
+ process.exitCode = 1;
70018
+ return;
70019
+ }
69943
70020
  const conflictedCapabilities = WRITABLE_CAPABILITIES.filter((name) => config[name].conflict);
69944
70021
  if (conflictedCapabilities.length > 0) {
69945
70022
  const label = conflictedCapabilities.map((name) => `capabilities.${name}`).join(" and ");
@@ -70138,11 +70215,11 @@ async function runAgentPush(cwd2, args) {
70138
70215
  }
70139
70216
  f2.info(`If you push now, your push targets revision ${cloud.revision} and may race. Consider \`brainbase agent pull\` first.`);
70140
70217
  }
70141
- if (config.defaultModelCloudChanged || config.machineCloudChanged || config.runtimeMode.cloudChanged) {
70218
+ if (config.defaultModelCloudChanged || config.machineCloudChanged || config.runtimeMode.cloudChanged || config.concurrency.cloudChanged) {
70142
70219
  f2.warn(`Cloud runtime config changed since the last sync. Run ${import_picocolors30.default.cyan("brainbase agent pull")} to accept it locally.`);
70143
70220
  }
70144
70221
  const shouldPushManifest = meta.localChanged || entrypointChanged || toSend.length > 0;
70145
- const shouldUpdateAgent = meta.localChanged || entrypointChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged || config.memory.localChanged || config.browser.localChanged;
70222
+ const shouldUpdateAgent = meta.localChanged || entrypointChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged || config.concurrency.localChanged || config.memory.localChanged || config.browser.localChanged;
70146
70223
  const hasAgentChanges = shouldPushManifest || shouldUpdateAgent;
70147
70224
  const outgoing = hasAgentChanges ? await buildOutgoingComponents(cwd2, manifest, cloud, resolvedVersions) : null;
70148
70225
  if (hasAgentChanges && outgoing === null) {
@@ -70186,7 +70263,7 @@ async function runAgentPush(cwd2, args) {
70186
70263
  });
70187
70264
  }
70188
70265
  if (!hasAgentChanges && !secretPlan) {
70189
- if (config.defaultModelCloudChanged || config.runtimeMode.cloudChanged || config.machineCloudChanged || config.memory.cloudChanged || config.browser.cloudChanged) {
70266
+ if (config.defaultModelCloudChanged || config.runtimeMode.cloudChanged || config.concurrency.cloudChanged || config.machineCloudChanged || config.memory.cloudChanged || config.browser.cloudChanged) {
70190
70267
  f2.info("Nothing local to push; cloud runtime config is awaiting pull.");
70191
70268
  return;
70192
70269
  }
@@ -70228,6 +70305,9 @@ async function runAgentPush(cwd2, args) {
70228
70305
  if (config.runtimeMode.localChanged) {
70229
70306
  resultRows.push({ type: "upd", label: "runtime mode", text: manifest.runtime_mode });
70230
70307
  }
70308
+ if (config.concurrency.localChanged) {
70309
+ resultRows.push({ type: "upd", label: "children running at once", text: manifest.self_delegation_concurrency_limit === null ? "Unlimited" : String(manifest.self_delegation_concurrency_limit ?? "inherit") });
70310
+ }
70231
70311
  if (toSend.length) {
70232
70312
  resultRows.push({
70233
70313
  type: "add",
@@ -70290,7 +70370,7 @@ async function runAgentPush(cwd2, args) {
70290
70370
  }
70291
70371
  const changesPinnedDefinition = toSend.length > 0 || evalArchives.length > 0 || playbookArchives.length > 0 || entrypointChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged;
70292
70372
  const pinMessage = changesPinnedDefinition ? pinnedPushMessage(agentId) : Promise.resolve(null);
70293
- if (meta.localChanged || entrypointChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged || config.memory.localChanged || config.browser.localChanged) {
70373
+ if (meta.localChanged || entrypointChanged || config.defaultModelLocalChanged || config.runtimeMode.localChanged || config.concurrency.localChanged || config.memory.localChanged || config.browser.localChanged) {
70294
70374
  const metaSpinner = spinner();
70295
70375
  metaSpinner.start("Updating agent config…");
70296
70376
  try {
@@ -70314,10 +70394,12 @@ async function runAgentPush(cwd2, args) {
70314
70394
  if (config.browser.localChanged) {
70315
70395
  update2.browser_enabled = manifest.capabilities?.browser;
70316
70396
  }
70397
+ Object.assign(update2, concurrencyWrite(manifest, cloudAgent, config.concurrency));
70317
70398
  cloudAgent = await api.updateAgent(agentId, update2, httpRetryEnabled() ? { idempotent: true } : undefined);
70318
70399
  if (update2.runtime_mode !== undefined && cloudAgent.runtime_mode !== update2.runtime_mode) {
70319
70400
  throw new Error("This control plane did not apply runtime_mode. Upgrade it before retrying; the sync baseline is unchanged.");
70320
70401
  }
70402
+ verifyConcurrencyWrite(update2, cloudAgent);
70321
70403
  metaSpinner.stop("Agent config updated.");
70322
70404
  } catch (err) {
70323
70405
  metaSpinner.stop("Failed.");
@@ -70490,7 +70572,8 @@ function buildAgentMetaAfterPush({
70490
70572
  ...config.machineCloudChanged ? lock?.agentMeta?.machine_kind ? { machine_kind: lock.agentMeta.machine_kind } : {} : cloudAgent.machine_kind ? { machine_kind: cloudAgent.machine_kind } : lock?.agentMeta?.machine_kind ? { machine_kind: lock.agentMeta.machine_kind } : {},
70491
70573
  ...config.defaultModelCloudChanged && !config.defaultModelLocalChanged ? Object.prototype.hasOwnProperty.call(lock?.agentMeta ?? {}, "default_model") ? { default_model: lock.agentMeta.default_model ?? null } : {} : Object.prototype.hasOwnProperty.call(cloudAgent, "default_model") ? { default_model: cloudAgent.default_model ?? null } : Object.prototype.hasOwnProperty.call(lock?.agentMeta ?? {}, "default_model") ? { default_model: lock.agentMeta.default_model ?? null } : {},
70492
70574
  ...capabilityBaselineAfterPush(cloudAgent, lock?.agentMeta, config),
70493
- ...runtimeModeBaselineAfterPush(lock?.agentMeta, config.runtimeMode, manifest.runtime_mode)
70575
+ ...runtimeModeBaselineAfterPush(lock?.agentMeta, config.runtimeMode, manifest.runtime_mode),
70576
+ ...concurrencyBaselineAfterPush(manifest, lock?.agentMeta, config.concurrency)
70494
70577
  };
70495
70578
  }
70496
70579
  async function planSecretPush(cwd2, agentId) {
@@ -70692,8 +70775,8 @@ function handleApiError3(err) {
70692
70775
  // src/cli/agent-status.ts
70693
70776
  import path89 from "node:path";
70694
70777
  var import_picocolors31 = __toESM(require_picocolors(), 1);
70695
- function capabilityDrifted(field) {
70696
- return field.localChanged || field.cloudChanged || field.conflict;
70778
+ function capabilityDrifted(field2) {
70779
+ return field2.localChanged || field2.cloudChanged || field2.conflict;
70697
70780
  }
70698
70781
  async function runAgentStatus(cwd2, args = {}) {
70699
70782
  const json = args.json === true;
@@ -70809,7 +70892,7 @@ async function runAgentStatus(cwd2, args = {}) {
70809
70892
  }
70810
70893
  const componentsDrifted = conflicts.length > 0 || toPush.length > 0 || toPull.length > 0;
70811
70894
  const metaDrifted = meta.localChanged || meta.cloudChanged;
70812
- const configDrifted = config.unsupported.length > 0 || config.machineMismatch || config.machineCloudChanged || config.defaultModelLocalChanged || config.defaultModelCloudChanged || capabilityDrifted(config.runtimeMode) || capabilityDrifted(config.memory) || capabilityDrifted(config.browser);
70895
+ const configDrifted = config.unsupported.length > 0 || config.machineMismatch || config.machineCloudChanged || config.defaultModelLocalChanged || config.defaultModelCloudChanged || capabilityDrifted(config.runtimeMode) || capabilityDrifted(config.concurrency) || capabilityDrifted(config.memory) || capabilityDrifted(config.browser);
70813
70896
  const secretsDrifted = secretDrift.localOnly.length > 0 || secretDrift.cloudOnly.length > 0 || secretDrift.changed.length > 0;
70814
70897
  const secretConflicts = cloudAgent.secret_conflicts ?? [];
70815
70898
  const inheritedSecrets = (cloudAgent.inherited_secret_keys ?? []).map((entry) => ({
@@ -70850,6 +70933,7 @@ async function runAgentStatus(cwd2, args = {}) {
70850
70933
  defaultModelCloudChanged: config.defaultModelCloudChanged,
70851
70934
  defaultModelConflict: config.defaultModelConflict,
70852
70935
  ...cloudAgent.runtime_mode === "auto" || manifest.runtime_mode !== undefined || lock?.agentMeta?.runtime_mode === "auto" ? { runtimeMode: config.runtimeMode } : {},
70936
+ ...cloudAgent.self_delegation_concurrency_supported === true || manifest.self_delegation_concurrency_limit !== undefined || lock?.agentMeta?.self_delegation_concurrency_limit !== undefined ? { concurrency: config.concurrency } : {},
70853
70937
  memory: config.memory,
70854
70938
  browser: config.browser
70855
70939
  },
@@ -70927,15 +71011,15 @@ async function runAgentStatus(cwd2, args = {}) {
70927
71011
  }
70928
71012
  }
70929
71013
  for (const name of WRITABLE_CAPABILITIES) {
70930
- const field = config[name];
70931
- if (field.conflict) {
71014
+ const field2 = config[name];
71015
+ if (field2.conflict) {
70932
71016
  lines.push(` ${import_picocolors31.default.red("! conflict")} capabilities.${name} changed locally and on cloud`);
70933
71017
  continue;
70934
71018
  }
70935
- if (field.localChanged) {
71019
+ if (field2.localChanged) {
70936
71020
  lines.push(` ${import_picocolors31.default.yellow("→ push")} capabilities.${name} edited locally`);
70937
71021
  }
70938
- if (field.cloudChanged) {
71022
+ if (field2.cloudChanged) {
70939
71023
  lines.push(` ${import_picocolors31.default.cyan("← pull")} capabilities.${name} changed on cloud`);
70940
71024
  }
70941
71025
  }
@@ -70947,6 +71031,14 @@ async function runAgentStatus(cwd2, args = {}) {
70947
71031
  if (config.runtimeMode.cloudChanged)
70948
71032
  lines.push(` ${import_picocolors31.default.cyan("← pull")} runtime_mode changed on cloud`);
70949
71033
  }
71034
+ if (config.concurrency.conflict) {
71035
+ lines.push(` ${import_picocolors31.default.red("! conflict")} self_delegation_concurrency_limit conflicts with cloud or has no sync baseline`);
71036
+ } else {
71037
+ if (config.concurrency.localChanged)
71038
+ lines.push(` ${import_picocolors31.default.yellow("→ push")} self_delegation_concurrency_limit edited locally`);
71039
+ if (config.concurrency.cloudChanged)
71040
+ lines.push(` ${import_picocolors31.default.cyan("← pull")} self_delegation_concurrency_limit changed on cloud`);
71041
+ }
70950
71042
  lines.push("");
70951
71043
  }
70952
71044
  if (secretsDrifted || !secretsChecked || hasInheritedSecrets) {
@@ -71613,7 +71705,8 @@ async function runAgentCreate(cwd2, args) {
71613
71705
  ...resolvedEntrypoint !== undefined ? { entrypoint: resolvedEntrypoint } : {},
71614
71706
  ...manifest.machine_kind !== undefined ? { machine_kind: manifest.machine_kind } : {},
71615
71707
  ...manifest.default_model !== undefined ? { default_model: manifest.default_model } : {},
71616
- ...manifest.runtime_mode !== undefined ? { runtime_mode: manifest.runtime_mode } : {}
71708
+ ...manifest.runtime_mode !== undefined ? { runtime_mode: manifest.runtime_mode } : {},
71709
+ ...concurrencyLimit(manifest)
71617
71710
  });
71618
71711
  createSpinner.stop(`Created ${import_picocolors34.default.bold(agent.name)}.`);
71619
71712
  } catch (err) {
@@ -71624,14 +71717,16 @@ async function runAgentCreate(cwd2, args) {
71624
71717
  const machineConfigMissing = manifest.machine_kind !== undefined && agent.machine_kind !== manifest.machine_kind;
71625
71718
  const modelConfigMissing = manifest.default_model !== undefined && (!Object.prototype.hasOwnProperty.call(agent, "default_model") || (agent.default_model ?? null) !== (manifest.default_model ?? null));
71626
71719
  const modeConfigMissing = manifest.runtime_mode !== undefined && agent.runtime_mode !== manifest.runtime_mode;
71627
- if (machineConfigMissing || modelConfigMissing || modeConfigMissing) {
71720
+ const concurrencyConfigMissing = manifest.self_delegation_concurrency_limit !== undefined && (agent.self_delegation_concurrency_supported !== true || agent.self_delegation_concurrency_limit !== manifest.self_delegation_concurrency_limit);
71721
+ if (machineConfigMissing || modelConfigMissing || modeConfigMissing || concurrencyConfigMissing) {
71628
71722
  manifest.id = agent.id;
71629
71723
  manifest.harness = harness;
71630
71724
  writeManifest(cwd2, manifest);
71631
71725
  const fields = [
71632
71726
  ...machineConfigMissing ? ["machine_kind"] : [],
71633
71727
  ...modelConfigMissing ? ["default_model"] : [],
71634
- ...modeConfigMissing ? ["runtime_mode"] : []
71728
+ ...modeConfigMissing ? ["runtime_mode"] : [],
71729
+ ...concurrencyConfigMissing ? ["self_delegation_concurrency_limit"] : []
71635
71730
  ];
71636
71731
  f2.error(`Agent ${import_picocolors34.default.bold(agent.id)} was created, but this control plane did not apply ${fields.join(" / ")}.`);
71637
71732
  if (machineConfigMissing) {
@@ -71784,7 +71879,8 @@ async function runAgentCreate(cwd2, args) {
71784
71879
  ...agent.machine_kind ? { machine_kind: agent.machine_kind } : {},
71785
71880
  ...Object.prototype.hasOwnProperty.call(agent, "default_model") ? { default_model: agent.default_model ?? null } : {},
71786
71881
  ...capabilityBaseline(agent, undefined),
71787
- ...runtimeModeBaseline(agent)
71882
+ ...runtimeModeBaseline(agent),
71883
+ ...concurrencyBaseline(agent)
71788
71884
  }
71789
71885
  };
71790
71886
  writeSyncState(cwd2, state);
@@ -72998,9 +73094,9 @@ async function defaultReadStdin(env3 = process.env, options = {}) {
72998
73094
  return "";
72999
73095
  }
73000
73096
  }
73001
- async function defaultPrompt(field) {
73097
+ async function defaultPrompt(field2) {
73002
73098
  const answer = await re({
73003
- message: field.label,
73099
+ message: field2.label,
73004
73100
  validate: (v3) => v3 && v3.trim() ? undefined : "Required"
73005
73101
  });
73006
73102
  return String(ensureNotCancelled(answer)).trim();
@@ -73017,10 +73113,10 @@ function parseStdinSecrets(raw, missing) {
73017
73113
  throw new Error('stdin looked like JSON but could not be parsed. Pass an object such as {"bot_token":"…","signing_secret":"…"}.');
73018
73114
  }
73019
73115
  const out = {};
73020
- for (const field of missing) {
73021
- const value = clean2(source[field.key]);
73116
+ for (const field2 of missing) {
73117
+ const value = clean2(source[field2.key]);
73022
73118
  if (value)
73023
- out[field.key] = value;
73119
+ out[field2.key] = value;
73024
73120
  }
73025
73121
  return out;
73026
73122
  }
@@ -73035,10 +73131,10 @@ async function resolveSecrets(fields, deps = {}) {
73035
73131
  const prompt = deps.prompt ?? defaultPrompt;
73036
73132
  const interactive = deps.interactive ?? isInteractive;
73037
73133
  const resolved = {};
73038
- for (const field of fields) {
73039
- const value = clean2(field.value) ?? clean2(env3[field.envVar]);
73134
+ for (const field2 of fields) {
73135
+ const value = clean2(field2.value) ?? clean2(env3[field2.envVar]);
73040
73136
  if (value)
73041
- resolved[field.key] = value;
73137
+ resolved[field2.key] = value;
73042
73138
  }
73043
73139
  let missing = fields.filter((f4) => !resolved[f4.key]);
73044
73140
  if (missing.length > 0) {
@@ -73048,11 +73144,11 @@ async function resolveSecrets(fields, deps = {}) {
73048
73144
  missing = fields.filter((f4) => !resolved[f4.key]);
73049
73145
  }
73050
73146
  }
73051
- for (const field of missing) {
73147
+ for (const field2 of missing) {
73052
73148
  if (!interactive()) {
73053
- throw new NonInteractiveError(`${field.label} is required. Pass ${field.flag}, set ${field.envVar}, or pipe it on stdin.`);
73149
+ throw new NonInteractiveError(`${field2.label} is required. Pass ${field2.flag}, set ${field2.envVar}, or pipe it on stdin.`);
73054
73150
  }
73055
- resolved[field.key] = await prompt(field);
73151
+ resolved[field2.key] = await prompt(field2);
73056
73152
  }
73057
73153
  return resolved;
73058
73154
  }
@@ -75057,10 +75153,10 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
75057
75153
  const shape = def.shape;
75058
75154
  const propValues = {};
75059
75155
  for (const key2 in shape) {
75060
- const field = shape[key2]._zod;
75061
- if (field.values) {
75156
+ const field2 = shape[key2]._zod;
75157
+ if (field2.values) {
75062
75158
  propValues[key2] ?? (propValues[key2] = new Set);
75063
- for (const v3 of field.values)
75159
+ for (const v3 of field2.values)
75064
75160
  propValues[key2].add(v3);
75065
75161
  }
75066
75162
  }
@@ -80511,11 +80607,11 @@ ${value2}`, dataLines++;
80511
80607
  processField(line, "", line);
80512
80608
  return;
80513
80609
  }
80514
- const field = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
80515
- processField(field, value, line);
80610
+ const field2 = line.slice(0, fieldSeparatorIndex), offset = line.charCodeAt(fieldSeparatorIndex + 1) === SPACE ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
80611
+ processField(field2, value, line);
80516
80612
  }
80517
- function processField(field, value, line) {
80518
- switch (field) {
80613
+ function processField(field2, value, line) {
80614
+ switch (field2) {
80519
80615
  case "event":
80520
80616
  eventType = value || undefined;
80521
80617
  break;
@@ -80534,7 +80630,7 @@ ${value}`, dataLines++;
80534
80630
  }));
80535
80631
  break;
80536
80632
  default:
80537
- onError(new ParseError(`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}…` : field}"`, { type: "unknown-field", field, value, line }));
80633
+ onError(new ParseError(`Unknown field "${field2.length > 20 ? `${field2.slice(0, 20)}…` : field2}"`, { type: "unknown-field", field: field2, value, line }));
80538
80634
  break;
80539
80635
  }
80540
80636
  }
@@ -82744,23 +82840,23 @@ async function runAgentSurface(cwd2, argv, deps = {}) {
82744
82840
  if (action === "configure") {
82745
82841
  expectArgs(args, 0, `${surface} configure <flags>`);
82746
82842
  const config2 = {};
82747
- for (const [flag, field] of Object.entries(configureFlags[surface])) {
82843
+ for (const [flag, field2] of Object.entries(configureFlags[surface])) {
82748
82844
  const input = s3(flag);
82749
82845
  if (input === undefined)
82750
82846
  continue;
82751
82847
  let result2 = input;
82752
- if (booleanConfig.has(field))
82848
+ if (booleanConfig.has(field2))
82753
82849
  result2 = explicitBoolean(input, flag);
82754
- else if (field === "allowed_models" || field === "computer_panel_tabs")
82850
+ else if (field2 === "allowed_models" || field2 === "computer_panel_tabs")
82755
82851
  result2 = list(input);
82756
- else if (field === "template_prompts")
82852
+ else if (field2 === "template_prompts")
82757
82853
  result2 = await readPrompts(path95.resolve(cwd2, input));
82758
- else if (field === "bot_name") {
82854
+ else if (field2 === "bot_name") {
82759
82855
  result2 = input.trim();
82760
82856
  if (!result2)
82761
82857
  throw new SurfaceCommandError("--bot-name must not be blank.");
82762
82858
  }
82763
- Object.assign(config2, { [field]: result2 });
82859
+ Object.assign(config2, { [field2]: result2 });
82764
82860
  }
82765
82861
  if (!Object.keys(config2).length)
82766
82862
  throw new SurfaceCommandError("Pass at least one configuration flag. See brainbase agent surface --help.");
@@ -83826,7 +83922,7 @@ function printJson(value3) {
83826
83922
  function progress(json4) {
83827
83923
  return json4 ? (line) => console.error(line) : (line) => console.log(line);
83828
83924
  }
83829
- function field(label, value3) {
83925
+ function field2(label, value3) {
83830
83926
  return ` ${import_picocolors45.default.dim(label.padEnd(12))}${value3}`;
83831
83927
  }
83832
83928
  function interruption(deps) {
@@ -84007,16 +84103,16 @@ function printDiff(agentId, result2) {
84007
84103
  const { diff: body } = result2;
84008
84104
  banner(`agent version diff ${result2.from ? `v${result2.from.version_number} -> ` : ""}v${result2.to.version_number}`);
84009
84105
  const out = [""];
84010
- out.push(field("agent", safe(agentId)));
84011
- out.push(field("from", versionLabel(result2.from)));
84012
- out.push(field("to", versionLabel(result2.to)));
84106
+ out.push(field2("agent", safe(agentId)));
84107
+ out.push(field2("from", versionLabel(result2.from)));
84108
+ out.push(field2("to", versionLabel(result2.to)));
84013
84109
  if (body.initial) {
84014
- out.push(field("changes", `v${result2.to.version_number} is the first version, so everything reads as added`));
84110
+ out.push(field2("changes", `v${result2.to.version_number} is the first version, so everything reads as added`));
84015
84111
  } else if (body.identical) {
84016
- out.push(field("changes", "none"));
84112
+ out.push(field2("changes", "none"));
84017
84113
  } else {
84018
84114
  const count = body.sections.length;
84019
- out.push(field("changes", `${import_picocolors47.default.green(`+${body.totals.added}`)} ${import_picocolors47.default.red(`-${body.totals.removed}`)} lines in ${count} ${count === 1 ? "section" : "sections"}`));
84115
+ out.push(field2("changes", `${import_picocolors47.default.green(`+${body.totals.added}`)} ${import_picocolors47.default.red(`-${body.totals.removed}`)} lines in ${count} ${count === 1 ? "section" : "sections"}`));
84020
84116
  }
84021
84117
  out.push("");
84022
84118
  if (body.identical) {
@@ -85297,8 +85393,8 @@ async function list2(ctx) {
85297
85393
  }
85298
85394
  banner("agent versions, newest first");
85299
85395
  const out = [""];
85300
- out.push(field("agent", safe(agentId)));
85301
- out.push(field("pinned", pinLine(listing.pin)));
85396
+ out.push(field2("agent", safe(agentId)));
85397
+ out.push(field2("pinned", pinLine(listing.pin)));
85302
85398
  out.push("");
85303
85399
  if (listing.items.length === 0) {
85304
85400
  out.push(` ${import_picocolors49.default.dim("No versions yet. One is saved a few seconds after each change to the agent.")}`);
@@ -85343,21 +85439,21 @@ function printVersion(version2) {
85343
85439
  const none = import_picocolors49.default.dim("none");
85344
85440
  banner(`agent version ${versionName(version2)}`);
85345
85441
  const out = [""];
85346
- out.push(field("version", `v${version2.version_number}`));
85347
- out.push(field("id", safe(version2.id)));
85348
- out.push(field("kind", safe(version2.kind)));
85349
- out.push(field("label", version2.label ? safe(version2.label) : none));
85350
- out.push(field("description", version2.description ? safe(version2.description) : none));
85351
- out.push(field("summary", version2.summary ? safe(version2.summary) : none));
85352
- out.push(field("created", `${safe(version2.created_at)} ${import_picocolors49.default.dim(`(${ago(version2.created_at)})`)}`));
85353
- out.push(field("by", `${safe(version2.actor_type ?? "unknown")} ${safe(version2.created_by ?? "")}`.trim()));
85354
- out.push(field("source", version2.source ? safe(version2.source) : none));
85442
+ out.push(field2("version", `v${version2.version_number}`));
85443
+ out.push(field2("id", safe(version2.id)));
85444
+ out.push(field2("kind", safe(version2.kind)));
85445
+ out.push(field2("label", version2.label ? safe(version2.label) : none));
85446
+ out.push(field2("description", version2.description ? safe(version2.description) : none));
85447
+ out.push(field2("summary", version2.summary ? safe(version2.summary) : none));
85448
+ out.push(field2("created", `${safe(version2.created_at)} ${import_picocolors49.default.dim(`(${ago(version2.created_at)})`)}`));
85449
+ out.push(field2("by", `${safe(version2.actor_type ?? "unknown")} ${safe(version2.created_by ?? "")}`.trim()));
85450
+ out.push(field2("source", version2.source ? safe(version2.source) : none));
85355
85451
  if (version2.restored_from)
85356
- out.push(field("restored", `from ${safe(version2.restored_from)}`));
85452
+ out.push(field2("restored", `from ${safe(version2.restored_from)}`));
85357
85453
  if (version2.labeled_at) {
85358
- out.push(field("labelled", `${ago(version2.labeled_at)}${version2.labeled_by ? ` by ${safe(version2.labeled_by)}` : ""}`));
85454
+ out.push(field2("labelled", `${ago(version2.labeled_at)}${version2.labeled_by ? ` by ${safe(version2.labeled_by)}` : ""}`));
85359
85455
  }
85360
- out.push(field("pinned", version2.pinned ? "yes, new tasks run this version" : "no"));
85456
+ out.push(field2("pinned", version2.pinned ? "yes, new tasks run this version" : "no"));
85361
85457
  out.push("");
85362
85458
  console.log(out.join(`
85363
85459
  `));
@@ -85468,6 +85564,8 @@ var SyncedOrchestrationMetaSchema = exports_external.object({
85468
85564
  });
85469
85565
  var OrchestrationSyncStateSchema = exports_external.object({
85470
85566
  schemaVersion: exports_external.literal(1),
85567
+ self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
85568
+ self_delegation_concurrency_supported: exports_external.boolean().optional(),
85471
85569
  orchestration_id: exports_external.string(),
85472
85570
  revision: exports_external.number(),
85473
85571
  synced_at: exports_external.string(),
@@ -85988,6 +86086,7 @@ var DecisionSchema = exports_external.object({
85988
86086
  });
85989
86087
  var OrchestrationManifestSchema = exports_external.object({
85990
86088
  schema: exports_external.literal(1),
86089
+ self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
85991
86090
  orchestration: OrchMetaSchema,
85992
86091
  members: exports_external.array(MemberSchema).default([]),
85993
86092
  edges: exports_external.array(EdgeSchema).default([]),
@@ -86068,6 +86167,7 @@ import os15 from "node:os";
86068
86167
  async function installAgentFresh(input) {
86069
86168
  const { cwd: cwd2, agent: agent2, cloud, harness } = input;
86070
86169
  const scope = input.scope ?? "project";
86170
+ const { claimedByOther, previousManifest, previousMeta } = input.previousState ?? readFreshInstallPreviousState(cwd2, agent2.id);
86071
86171
  ensureDir(cwd2);
86072
86172
  const availableSecrets = input.pullSecrets === false ? {} : await pullAgentSecrets(cwd2, agent2.id);
86073
86173
  const stageRoot = stageManifestComponents2(cloud.components);
@@ -86107,10 +86207,7 @@ async function installAgentFresh(input) {
86107
86207
  }
86108
86208
  materializeInstructions2(cwd2, cloud);
86109
86209
  materializePlaybooks2(cwd2, cloud);
86110
- const claimedByOther = folderClaimedByOtherAgent(cwd2, agent2.id);
86111
- const previousMode = claimedByOther ? undefined : safeRead(() => readManifest(cwd2)?.runtime_mode);
86112
- const previousLock = safeRead(() => readSyncState(cwd2));
86113
- const previousMeta = previousLock?.agent_id === agent2.id ? previousLock.agentMeta : undefined;
86210
+ const previousMode = previousManifest?.runtime_mode;
86114
86211
  const localOnly = input.preserveManifest || claimedByOther ? {} : readLocalOnlyContentReporting(cwd2);
86115
86212
  if (claimedByOther) {
86116
86213
  f2.warn(`${path98.basename(cwd2)} was linked to a different agent; its local-only blocks were left out of the rebuilt manifest.`);
@@ -86119,6 +86216,8 @@ async function installAgentFresh(input) {
86119
86216
  if (manifest && agent2.runtime_mode === undefined && previousMode !== undefined) {
86120
86217
  manifest.runtime_mode = previousMode;
86121
86218
  }
86219
+ if (manifest)
86220
+ Object.assign(manifest, concurrencyManifest(agent2, previousManifest));
86122
86221
  if (manifest)
86123
86222
  writeManifest(cwd2, manifest);
86124
86223
  writeLink(cwd2, {
@@ -86151,6 +86250,7 @@ async function installAgentFresh(input) {
86151
86250
  ...agent2.machine_kind ? { machine_kind: agent2.machine_kind } : {},
86152
86251
  ...Object.prototype.hasOwnProperty.call(agent2, "default_model") ? { default_model: agent2.default_model ?? null } : {},
86153
86252
  ...runtimeModeBaseline(agent2, previousMeta),
86253
+ ...concurrencyBaseline(agent2, previousMeta),
86154
86254
  ...capabilityBaseline(agent2, undefined)
86155
86255
  }
86156
86256
  });
@@ -86259,6 +86359,7 @@ function buildManifestFromCloud(cloud, agent2, localOnly = {}) {
86259
86359
  schema: 1,
86260
86360
  ...agent2.machine_kind ? { machine_kind: agent2.machine_kind } : {},
86261
86361
  ...agent2.runtime_mode === "auto" ? { runtime_mode: "auto" } : {},
86362
+ ...concurrencyManifest(agent2),
86262
86363
  ...agent2.default_model ? { default_model: agent2.default_model } : {},
86263
86364
  agent: {
86264
86365
  name: agent2.name,
@@ -86300,9 +86401,16 @@ async function pullAgentSecrets(cwd2, agentId) {
86300
86401
  return {};
86301
86402
  }
86302
86403
  }
86303
- function folderClaimedByOtherAgent(cwd2, agentId) {
86304
- const claimedBy = readManifestAgentId(cwd2) ?? safeRead(() => readLink(cwd2)?.agent_id) ?? safeRead(() => readSyncState(cwd2)?.agent_id);
86305
- return claimedBy !== undefined && claimedBy !== agentId;
86404
+ function readFreshInstallPreviousState(cwd2, agentId) {
86405
+ const manifest = safeRead(() => readManifest(cwd2)) ?? undefined;
86406
+ const lock = safeRead(() => readSyncState(cwd2));
86407
+ const claimedBy = (manifest ? manifest.id : readManifestAgentId(cwd2)) ?? safeRead(() => LinkSchema.parse(JSON.parse(fs85.readFileSync(legacyLinkPath(cwd2), "utf8"))).agent_id) ?? lock?.agent_id;
86408
+ const claimedByOther = claimedBy !== undefined && claimedBy !== agentId;
86409
+ return {
86410
+ claimedByOther,
86411
+ previousManifest: claimedByOther ? undefined : manifest,
86412
+ previousMeta: lock?.agent_id === agentId ? lock.agentMeta : undefined
86413
+ };
86306
86414
  }
86307
86415
  function safeRead(read2) {
86308
86416
  try {
@@ -86700,14 +86808,14 @@ function decideOrchestrationMeta(input) {
86700
86808
  if (!meta)
86701
86809
  return [];
86702
86810
  const out = [];
86703
- for (const field2 of ORCH_META_FIELDS) {
86704
- const local = metaText(meta[field2]);
86705
- const cloud = metaText(input.cloud[field2]) ?? "";
86811
+ for (const field3 of ORCH_META_FIELDS) {
86812
+ const local = metaText(meta[field3]);
86813
+ const cloud = metaText(input.cloud[field3]) ?? "";
86706
86814
  if (local === undefined)
86707
86815
  continue;
86708
86816
  if (local === cloud)
86709
86817
  continue;
86710
- const base2 = input.baseline === undefined ? undefined : metaText(input.baseline[field2]) ?? "";
86818
+ const base2 = input.baseline === undefined ? undefined : metaText(input.baseline[field3]) ?? "";
86711
86819
  let kind;
86712
86820
  if (base2 === undefined) {
86713
86821
  kind = "conflict";
@@ -86720,21 +86828,21 @@ function decideOrchestrationMeta(input) {
86720
86828
  }
86721
86829
  if (kind === "conflict" && input.force)
86722
86830
  kind = "push";
86723
- out.push({ field: field2, kind, local, cloud });
86831
+ out.push({ field: field3, kind, local, cloud });
86724
86832
  }
86725
86833
  return out;
86726
86834
  }
86727
86835
  function nextOrchestrationMeta(input) {
86728
86836
  const kept = new Set(input.decisions.filter((d3) => d3.kind === "keep").map((d3) => d3.field));
86729
86837
  const out = {};
86730
- for (const field2 of ORCH_META_FIELDS) {
86731
- const value3 = kept.has(field2) ? input.previous?.[field2] : input.applied[field2];
86838
+ for (const field3 of ORCH_META_FIELDS) {
86839
+ const value3 = kept.has(field3) ? input.previous?.[field3] : input.applied[field3];
86732
86840
  if (value3 == null)
86733
86841
  continue;
86734
- if (field2 === "credit_limit") {
86842
+ if (field3 === "credit_limit") {
86735
86843
  out.credit_limit = typeof value3 === "number" ? value3 : Number(value3);
86736
86844
  } else {
86737
- out[field2] = String(value3);
86845
+ out[field3] = String(value3);
86738
86846
  }
86739
86847
  }
86740
86848
  return out;
@@ -86817,6 +86925,34 @@ async function runOrchestrationPull(cwd2, args) {
86817
86925
  }
86818
86926
  const slugByAgent = resolveMemberSlugs(cloud.members);
86819
86927
  const slugFor = (agentId) => slugByAgent.get(agentId) ?? agentId;
86928
+ let previousManifest = null;
86929
+ try {
86930
+ previousManifest = readOrchManifest(cwd2);
86931
+ } catch {}
86932
+ const previousLock = readOrchSyncState(cwd2);
86933
+ const memberStates = new Map(cloud.members.filter((m3) => m3.manifest).map((m3) => [
86934
+ m3.agent_id,
86935
+ readFreshInstallPreviousState(memberDir(cwd2, slugFor(m3.agent_id)), m3.agent_id)
86936
+ ]));
86937
+ const edited = [];
86938
+ if (previousManifest && (!existingLink || existingLink.orchestration_id === cloud.id || previousLock?.orchestration_id === cloud.id)) {
86939
+ const diff3 = diffConcurrency(previousManifest, previousLock?.orchestration_id === cloud.id ? previousLock : undefined, cloud);
86940
+ if (diff3.localChanged && !diff3.converged)
86941
+ edited.push("brainbase-orchestration.yaml");
86942
+ }
86943
+ for (const m3 of cloud.members) {
86944
+ const state = memberStates.get(m3.agent_id);
86945
+ if (!state?.previousManifest || state.claimedByOther)
86946
+ continue;
86947
+ const diff3 = diffConcurrency(state.previousManifest, state.previousMeta, m3);
86948
+ if (diff3.localChanged && !diff3.converged)
86949
+ edited.push(`${ORCH_MEMBERS_DIR}/${slugFor(m3.agent_id)}/brainbase.agent.yaml`);
86950
+ }
86951
+ if (edited.length && !args.force) {
86952
+ fail(`self_delegation_concurrency_limit has local edits that pull would overwrite: ${edited.join(", ")}.`);
86953
+ f2.info(`Push the edits first, or run ${import_picocolors54.default.cyan("brainbase orchestration pull --force")} to discard them.`);
86954
+ return;
86955
+ }
86820
86956
  const planLines = [];
86821
86957
  planLines.push("");
86822
86958
  planLines.push(` ${import_picocolors54.default.bold(cloud.name)} ${import_picocolors54.default.dim(`(${cloud.id})`)}`);
@@ -86893,12 +87029,15 @@ async function runOrchestrationPull(cwd2, args) {
86893
87029
  harness: fallbackHarness,
86894
87030
  machine_kind: m3.machine_kind,
86895
87031
  default_model: m3.default_model,
86896
- runtime_mode: m3.runtime_mode
87032
+ runtime_mode: m3.runtime_mode,
87033
+ self_delegation_concurrency_limit: m3.self_delegation_concurrency_limit,
87034
+ self_delegation_concurrency_supported: m3.self_delegation_concurrency_supported
86897
87035
  },
86898
87036
  cloud: m3.manifest,
86899
87037
  harness: fallbackHarness,
86900
87038
  scope: "project",
86901
- pullSecrets: true
87039
+ pullSecrets: true,
87040
+ previousState: memberStates.get(m3.agent_id)
86902
87041
  });
86903
87042
  memberSp.stop(`Installed ${import_picocolors54.default.bold(slug)} ${import_picocolors54.default.dim(`(${m3.manifest.components.length} components)`)}.`);
86904
87043
  installedMembers.push({
@@ -86916,11 +87055,8 @@ async function runOrchestrationPull(cwd2, args) {
86916
87055
  let manifestDecisions2 = pulledDecisions ? decisionsForManifest(pulledDecisions) : undefined;
86917
87056
  let decisionBaseline = pulledDecisions ? syncedDecisions(pulledDecisions) : undefined;
86918
87057
  if (!pulledDecisions) {
86919
- try {
86920
- manifestDecisions2 = readOrchManifest(cwd2)?.decisions;
86921
- } catch {}
86922
- const lock = readOrchSyncState(cwd2);
86923
- decisionBaseline = lock?.orchestration_id === cloud.id ? lock.decisions : undefined;
87058
+ manifestDecisions2 = previousManifest?.decisions;
87059
+ decisionBaseline = previousLock?.orchestration_id === cloud.id ? previousLock.decisions : undefined;
86924
87060
  }
86925
87061
  for (const [decisionId, count] of deadDecisionLinks(cloud)) {
86926
87062
  const name = pulledDecisions?.find((d3) => d3.id === decisionId)?.name;
@@ -86928,6 +87064,7 @@ async function runOrchestrationPull(cwd2, args) {
86928
87064
  }
86929
87065
  const manifest = {
86930
87066
  schema: 1,
87067
+ ...concurrencyManifest(cloud, previousManifest ?? undefined),
86931
87068
  orchestration: {
86932
87069
  name: cloud.name,
86933
87070
  ...cloud.description ? { description: cloud.description } : {},
@@ -86965,6 +87102,7 @@ async function runOrchestrationPull(cwd2, args) {
86965
87102
  });
86966
87103
  writeOrchSyncState(cwd2, {
86967
87104
  schemaVersion: 1,
87105
+ ...concurrencyBaseline(cloud, previousLock ?? undefined),
86968
87106
  orchestration_id: cloud.id,
86969
87107
  revision: cloud.revision,
86970
87108
  synced_at: new Date().toISOString(),
@@ -87293,6 +87431,17 @@ async function runOrchestrationPush(cwd2, args) {
87293
87431
  return;
87294
87432
  }
87295
87433
  const agentIdToSlug = new Map([...slugToAgentId.entries()].map(([slug, id]) => [id, slug]));
87434
+ const concurrency = diffConcurrency(manifest, lock ?? undefined, cloud);
87435
+ if (concurrency.unsupported) {
87436
+ f2.error("This control plane does not support self_delegation_concurrency_limit. Upgrade it or enable self-delegation before retrying; the sync baseline is unchanged.");
87437
+ process.exitCode = 1;
87438
+ return;
87439
+ }
87440
+ if (concurrency.conflict && !args.force) {
87441
+ f2.error("Cannot push: self_delegation_concurrency_limit conflicts with cloud or has no sync baseline. Pull first, or use --force to keep the local value.");
87442
+ process.exitCode = 1;
87443
+ return;
87444
+ }
87296
87445
  const slugForAgent = (agentId, fallback) => agentIdToSlug.get(agentId) ?? fallback;
87297
87446
  const selfConflicts = selfEdgeConflicts(manifest, cloud, lock, slugToAgentId);
87298
87447
  if (selfConflicts.length && args.force)
@@ -87549,16 +87698,17 @@ async function runOrchestrationPush(cwd2, args) {
87549
87698
  }
87550
87699
  }
87551
87700
  const keptFields = new Set(metaKept.map((d3) => d3.field));
87552
- const metaField = (field2) => {
87553
- const value3 = manifest.orchestration[field2];
87554
- if (value3 === undefined || keptFields.has(field2))
87701
+ const metaField = (field3) => {
87702
+ const value3 = manifest.orchestration[field3];
87703
+ if (value3 === undefined || keptFields.has(field3))
87555
87704
  return {};
87556
- return { [field2]: value3 };
87705
+ return { [field3]: value3 };
87557
87706
  };
87558
87707
  const sp = spinner();
87559
87708
  sp.start("Updating orchestration graph…");
87560
87709
  try {
87561
87710
  const updateInput = {
87711
+ ...concurrencyWrite(manifest, cloud, concurrency),
87562
87712
  ...metaField("name"),
87563
87713
  ...metaField("description"),
87564
87714
  ...metaField("icon"),
@@ -87581,10 +87731,12 @@ async function runOrchestrationPush(cwd2, args) {
87581
87731
  sp.stop("Connection lost after the graph was sent — reading the cloud graph back…");
87582
87732
  updated = await reconcileOrchestrationUpdate(link2.orchestration_id, updateInput, sendDecisions ? localDecisions : null, slugForAgent, pushStartedAt);
87583
87733
  }
87734
+ verifyConcurrencyWrite(updateInput, updated);
87584
87735
  sp.stop(`Graph updated. New cloud revision ${updated.revision}.`);
87585
87736
  const settledDecisions = sendDecisions ? cloudDecisions(updated, slugForAgent) : decisionPlan?.kind === "reconcile" ? cloudDecisionList : null;
87586
87737
  writeOrchSyncState(cwd2, {
87587
87738
  schemaVersion: 1,
87739
+ ...concurrencyBaselineAfterPush(manifest, lock ?? undefined, concurrency),
87588
87740
  orchestration_id: updated.id,
87589
87741
  revision: updated.revision,
87590
87742
  synced_at: new Date().toISOString(),
@@ -87705,20 +87857,20 @@ function graphDivergence(cloud, sent) {
87705
87857
  }))));
87706
87858
  }
87707
87859
  }
87708
- for (const field2 of [
87860
+ for (const field3 of [
87709
87861
  "name",
87710
87862
  "description",
87711
87863
  "icon",
87712
87864
  "icon_color",
87713
87865
  "credit_limit"
87714
87866
  ]) {
87715
- let expected = sent[field2];
87716
- if (field2 === "name" && typeof expected === "string")
87867
+ let expected = sent[field3];
87868
+ if (field3 === "name" && typeof expected === "string")
87717
87869
  expected = expected.trim();
87718
- if ((field2 === "icon" || field2 === "icon_color") && expected === "")
87870
+ if ((field3 === "icon" || field3 === "icon_color") && expected === "")
87719
87871
  expected = null;
87720
- if (expected !== undefined && cloud[field2] !== expected) {
87721
- diffs.push(`${field2}: cloud has "${String(cloud[field2])}", sent "${String(expected)}"`);
87872
+ if (expected !== undefined && cloud[field3] !== expected) {
87873
+ diffs.push(`${field3}: cloud has "${String(cloud[field3])}", sent "${String(expected)}"`);
87722
87874
  }
87723
87875
  }
87724
87876
  return diffs;
@@ -87930,6 +88082,22 @@ async function runOrchestrationStatus(cwd2) {
87930
88082
  lines.push(` ${import_picocolors57.default.cyan("← pull")} added on cloud: ${k3}`);
87931
88083
  lines.push("");
87932
88084
  }
88085
+ const concurrency = diffConcurrency(localManifest ?? {}, lock ?? undefined, cloud);
88086
+ const concurrencyDrifted = concurrency.unsupported || concurrency.localChanged || concurrency.cloudChanged || concurrency.conflict;
88087
+ if (concurrencyDrifted) {
88088
+ lines.push(` ${import_picocolors57.default.bold("children running at once")}`);
88089
+ if (concurrency.unsupported)
88090
+ lines.push(` ${import_picocolors57.default.red("! unsupported")} self_delegation_concurrency_limit not exposed by this control plane`);
88091
+ else if (concurrency.conflict)
88092
+ lines.push(` ${import_picocolors57.default.red("! conflict")} self_delegation_concurrency_limit conflicts with cloud or has no sync baseline`);
88093
+ else {
88094
+ if (concurrency.localChanged)
88095
+ lines.push(` ${import_picocolors57.default.yellow("→ push")} self_delegation_concurrency_limit edited locally`);
88096
+ if (concurrency.cloudChanged)
88097
+ lines.push(` ${import_picocolors57.default.cyan("← pull")} self_delegation_concurrency_limit changed on cloud; push leaves it alone`);
88098
+ }
88099
+ lines.push("");
88100
+ }
87933
88101
  const metaDecisions = decideOrchestrationMeta({
87934
88102
  manifest: localManifest,
87935
88103
  cloud,
@@ -88146,7 +88314,7 @@ async function runOrchestrationStatus(cwd2) {
88146
88314
  endpointLines.push(...webhookEndpointLines(cloudWebhooks, " "));
88147
88315
  endpointLines.push("");
88148
88316
  }
88149
- if (!membersAdded.length && !membersRemoved.length && !edgesAdded.length && !edgesRemoved.length && !triggersToPush.length && !triggersToPull.length && !webhooksToPush.length && !webhooksToPull.length && !decisionsToPush.length && !decisionsToPull.length && !metaDecisions.length && !memberDrift.length && !revisionDrift) {
88317
+ if (!membersAdded.length && !membersRemoved.length && !edgesAdded.length && !edgesRemoved.length && !triggersToPush.length && !triggersToPull.length && !webhooksToPush.length && !webhooksToPull.length && !decisionsToPush.length && !decisionsToPull.length && !metaDecisions.length && !concurrencyDrifted && !memberDrift.length && !revisionDrift) {
88150
88318
  lines.push(` ${import_picocolors57.default.green("✓")} everything is in sync`);
88151
88319
  lines.push("");
88152
88320
  lines.push(...endpointLines);
@@ -88462,6 +88630,7 @@ async function runOrchestrationCreate(cwd2, args) {
88462
88630
  sp.start("Creating orchestration…");
88463
88631
  try {
88464
88632
  const created = await api.createOrchestration({
88633
+ ...concurrencyLimit(manifest),
88465
88634
  org_id: target.org.id,
88466
88635
  team_id: target.team.id,
88467
88636
  name: manifest.orchestration.name,
@@ -88486,8 +88655,10 @@ async function runOrchestrationCreate(cwd2, args) {
88486
88655
  description: created.description || undefined,
88487
88656
  linked_at: new Date().toISOString()
88488
88657
  });
88658
+ verifyConcurrencyWrite(manifest, created);
88489
88659
  writeOrchSyncState(cwd2, {
88490
88660
  schemaVersion: 1,
88661
+ ...concurrencyBaseline(created),
88491
88662
  orchestration_id: created.id,
88492
88663
  revision: created.revision,
88493
88664
  synced_at: new Date().toISOString(),
@@ -88958,7 +89129,8 @@ async function runOrchestration(cwd2, sub, args, opts) {
88958
89129
  await runOrchestrationPull(cwd2, {
88959
89130
  orchestrationId: args[0],
88960
89131
  yes: opts.yes,
88961
- harness: opts.harness
89132
+ harness: opts.harness,
89133
+ force: opts.force
88962
89134
  });
88963
89135
  return;
88964
89136
  case "push":
@@ -89017,7 +89189,7 @@ function printHelp4() {
89017
89189
  out.push(` ${import_picocolors64.default.cyan("init")} ${import_picocolors64.default.dim("write a starter brainbase-orchestration.yaml here — offline, no login (--full for a commented template, --force to overwrite)")}`);
89018
89190
  out.push(` ${import_picocolors64.default.cyan("create")} ${import_picocolors64.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
89019
89191
  out.push(` ${import_picocolors64.default.cyan("from-agent")} ${import_picocolors64.default.dim("[agent-id]")} ${import_picocolors64.default.dim("turn an existing agent (default: this folder's) into an orchestration")}`);
89020
- out.push(` ${import_picocolors64.default.cyan("pull")} ${import_picocolors64.default.dim("<id>")} ${import_picocolors64.default.dim("fetch orchestration + every member agent into this folder")}`);
89192
+ out.push(` ${import_picocolors64.default.cyan("pull")} ${import_picocolors64.default.dim("<id>")} ${import_picocolors64.default.dim("fetch orchestration + every member agent into this folder (--force to discard local concurrency edits)")}`);
89021
89193
  out.push(` ${import_picocolors64.default.cyan("push")} ${import_picocolors64.default.dim("push each member, then update the orchestration graph")}`);
89022
89194
  out.push(` ${import_picocolors64.default.cyan("add-agent")} ${import_picocolors64.default.dim("<name>")} ${import_picocolors64.default.dim("create a member agent, wire edges (--from/--to), and push")}`);
89023
89195
  out.push(` ${import_picocolors64.default.cyan("status")} ${import_picocolors64.default.dim("show what would push and what would pull")}`);
@@ -93497,19 +93669,19 @@ async function get2(ctx) {
93497
93669
  banner(`interface — ${safe(row.name)}`);
93498
93670
  const state = interfaceState(row);
93499
93671
  const out = [""];
93500
- out.push(field("id", safe(row.id)));
93501
- out.push(field("agent", agentLabel(safe(row.agent_id), await agentNames([row.agent_id]))));
93502
- out.push(field("state", stateTint(state)(state)));
93503
- out.push(field("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${import_picocolors79.default.dim("(nothing live yet)")}`));
93504
- out.push(field("audience", audienceLabel(row)));
93505
- out.push(field("threads", threadsLabel(row.share_agent_threads)));
93506
- out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${import_picocolors79.default.dim(`published ${ago(row.live_release.published_at)}`)}` : import_picocolors79.default.dim("none")));
93507
- out.push(field("draft", row.draft_version_id ? safe(row.draft_version_id) : import_picocolors79.default.dim("none yet")));
93672
+ out.push(field2("id", safe(row.id)));
93673
+ out.push(field2("agent", agentLabel(safe(row.agent_id), await agentNames([row.agent_id]))));
93674
+ out.push(field2("state", stateTint(state)(state)));
93675
+ out.push(field2("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${import_picocolors79.default.dim("(nothing live yet)")}`));
93676
+ out.push(field2("audience", audienceLabel(row)));
93677
+ out.push(field2("threads", threadsLabel(row.share_agent_threads)));
93678
+ out.push(field2("live", row.live_release ? `${safe(row.live_release.id)} ${import_picocolors79.default.dim(`published ${ago(row.live_release.published_at)}`)}` : import_picocolors79.default.dim("none")));
93679
+ out.push(field2("draft", row.draft_version_id ? safe(row.draft_version_id) : import_picocolors79.default.dim("none yet")));
93508
93680
  if (row.running_generation) {
93509
- out.push(field("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${import_picocolors79.default.dim(`(follow it with \`brainbase task logs ${safe(row.running_generation.thread_id ?? "")} --follow\`)`)}`));
93681
+ out.push(field2("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${import_picocolors79.default.dim(`(follow it with \`brainbase task logs ${safe(row.running_generation.thread_id ?? "")} --follow\`)`)}`));
93510
93682
  }
93511
93683
  if (row.archived_at)
93512
- out.push(field("archived", ago(row.archived_at)));
93684
+ out.push(field2("archived", ago(row.archived_at)));
93513
93685
  out.push("");
93514
93686
  console.log(out.join(`
93515
93687
  `));
@@ -93655,9 +93827,9 @@ function peopleLine(access, members) {
93655
93827
  function printAccess(row, access, members) {
93656
93828
  console.log([
93657
93829
  "",
93658
- field("audience", audienceLabel(access)),
93659
- field("people", peopleLine(access, members)),
93660
- field("threads", threadsLabel(row.share_agent_threads)),
93830
+ field2("audience", audienceLabel(access)),
93831
+ field2("people", peopleLine(access, members)),
93832
+ field2("threads", threadsLabel(row.share_agent_threads)),
93661
93833
  ""
93662
93834
  ].join(`
93663
93835
  `));
@@ -93748,15 +93920,15 @@ async function create3(ctx) {
93748
93920
  "",
93749
93921
  ` ${import_picocolors80.default.green("Created")} ${import_picocolors80.default.bold(safe(created.name))}`,
93750
93922
  "",
93751
- field("id", id),
93752
- field("agent", safe(created.agent_id)),
93753
- field("address", `${safe(created.slug)} ${import_picocolors80.default.dim("(nothing live yet)")}`),
93754
- field("threads", threadsLabel(created.share_agent_threads))
93923
+ field2("id", id),
93924
+ field2("agent", safe(created.agent_id)),
93925
+ field2("address", `${safe(created.slug)} ${import_picocolors80.default.dim("(nothing live yet)")}`),
93926
+ field2("threads", threadsLabel(created.share_agent_threads))
93755
93927
  ];
93756
93928
  if (access) {
93757
- out.push(field("audience", audienceLabel(access)));
93929
+ out.push(field2("audience", audienceLabel(access)));
93758
93930
  if (access.audience_mode === "users")
93759
- out.push(field("people", peopleLine(access, members)));
93931
+ out.push(field2("people", peopleLine(access, members)));
93760
93932
  }
93761
93933
  if (!audience) {
93762
93934
  out.push("", ` Nobody can open it until you choose who can: \`brainbase interface access ${id} --everyone\` or \`--people <emails>\`.`);
@@ -93904,7 +94076,7 @@ async function threads(ctx) {
93904
94076
  }
93905
94077
  const already = wanted === null ? "" : ` ${import_picocolors80.default.dim("(already set; nothing changed)")}`;
93906
94078
  console.log(`
93907
- ${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
94079
+ ${field2("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
93908
94080
  `);
93909
94081
  return;
93910
94082
  }
@@ -93925,7 +94097,7 @@ ${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
93925
94097
  return;
93926
94098
  }
93927
94099
  console.log(`
93928
- ${field("threads", threadsLabel(updated.share_agent_threads))}
94100
+ ${field2("threads", threadsLabel(updated.share_agent_threads))}
93929
94101
  `);
93930
94102
  });
93931
94103
  }
@@ -94176,8 +94348,8 @@ async function preview(ctx) {
94176
94348
  "",
94177
94349
  ` ${outcome === "serving" ? import_picocolors81.default.green("Preview ready") : import_picocolors81.default.yellow("Preview starting")} ${import_picocolors81.default.bold(safe(started.name))}`,
94178
94350
  "",
94179
- field("address", address2 ? safe(address2) : import_picocolors81.default.dim(missingAddress(started))),
94180
- field("showing", showing(started, taskId)),
94351
+ field2("address", address2 ? safe(address2) : import_picocolors81.default.dim(missingAddress(started))),
94352
+ field2("showing", showing(started, taskId)),
94181
94353
  "",
94182
94354
  ` ${import_picocolors81.default.dim("Opens for people who can edit the agent, after signing in. Nothing is published.")}`,
94183
94355
  ""
@@ -98202,13 +98374,13 @@ var CaseEvaluatorOverrideSchema = exports_external.object({
98202
98374
  value3.evidence,
98203
98375
  value3.evaluation_materials
98204
98376
  ];
98205
- if (value3.mode === "override" && overrides.every((field2) => field2 == null)) {
98377
+ if (value3.mode === "override" && overrides.every((field3) => field3 == null)) {
98206
98378
  ctx.addIssue({
98207
98379
  code: exports_external.ZodIssueCode.custom,
98208
98380
  message: "override mode must change evaluator fields"
98209
98381
  });
98210
98382
  }
98211
- if (value3.mode !== "override" && overrides.some((field2) => field2 != null)) {
98383
+ if (value3.mode !== "override" && overrides.some((field3) => field3 != null)) {
98212
98384
  ctx.addIssue({
98213
98385
  code: exports_external.ZodIssueCode.custom,
98214
98386
  message: `${value3.mode} mode must not include evaluator overrides`
@@ -100282,11 +100454,11 @@ function bundledFileSetDigest(output, value3, label3) {
100282
100454
  return output.digest(descriptors);
100283
100455
  }
100284
100456
  function stringField(value3, key2) {
100285
- const field2 = value3[key2];
100286
- if (typeof field2 !== "string" || !field2.trim()) {
100457
+ const field3 = value3[key2];
100458
+ if (typeof field3 !== "string" || !field3.trim()) {
100287
100459
  throw usageError(`Response is missing ${key2}`);
100288
100460
  }
100289
- return field2;
100461
+ return field3;
100290
100462
  }
100291
100463
  function context(cwd2, command, options, deps) {
100292
100464
  const agentId = resolveBenchmarkAgentId(cwd2, options.agent);
@@ -102093,18 +102265,18 @@ function rowItem(row, options, fallbackId) {
102093
102265
  if (!isRecord2(row))
102094
102266
  return { id, error: "Not an object, so --text-field has nothing to select" };
102095
102267
  if (options.textFields.length === 1) {
102096
- const field2 = options.textFields[0];
102097
- const value3 = row[field2];
102268
+ const field3 = options.textFields[0];
102269
+ const value3 = row[field3];
102098
102270
  if (value3 === undefined || value3 === null || value3 === "")
102099
- return { id, error: `Empty ${field2}` };
102271
+ return { id, error: `Empty ${field3}` };
102100
102272
  return { id, text: typeof value3 === "string" ? value3 : JSON.stringify(value3) };
102101
102273
  }
102102
- const missing = options.textFields.filter((field2) => row[field2] === undefined);
102274
+ const missing = options.textFields.filter((field3) => row[field3] === undefined);
102103
102275
  if (missing.length)
102104
102276
  return { id, error: `Missing ${missing.join(", ")}` };
102105
102277
  const picked = {};
102106
- for (const field2 of options.textFields)
102107
- picked[field2] = row[field2];
102278
+ for (const field3 of options.textFields)
102279
+ picked[field3] = row[field3];
102108
102280
  return { id, json: picked };
102109
102281
  }
102110
102282
  function sourceLabel(cwd2, file) {
@@ -102143,39 +102315,39 @@ function jsonlItems(cwd2, file, options) {
102143
102315
  function parseCsv(text4) {
102144
102316
  const rows = [];
102145
102317
  let row = [];
102146
- let field2 = "";
102318
+ let field3 = "";
102147
102319
  let quoted = false;
102148
102320
  for (let i = 0;i < text4.length; i += 1) {
102149
102321
  const char = text4[i];
102150
102322
  if (quoted) {
102151
102323
  if (char === '"' && text4[i + 1] === '"') {
102152
- field2 += '"';
102324
+ field3 += '"';
102153
102325
  i += 1;
102154
102326
  } else if (char === '"') {
102155
102327
  quoted = false;
102156
102328
  } else {
102157
- field2 += char;
102329
+ field3 += char;
102158
102330
  }
102159
- } else if (char === '"' && field2 === "") {
102331
+ } else if (char === '"' && field3 === "") {
102160
102332
  quoted = true;
102161
102333
  } else if (char === ",") {
102162
- row.push(field2);
102163
- field2 = "";
102334
+ row.push(field3);
102335
+ field3 = "";
102164
102336
  } else if (char === `
102165
102337
  ` || char === "\r") {
102166
102338
  if (char === "\r" && text4[i + 1] === `
102167
102339
  `)
102168
102340
  i += 1;
102169
- row.push(field2);
102341
+ row.push(field3);
102170
102342
  rows.push(row);
102171
102343
  row = [];
102172
- field2 = "";
102344
+ field3 = "";
102173
102345
  } else {
102174
- field2 += char;
102346
+ field3 += char;
102175
102347
  }
102176
102348
  }
102177
- if (field2 !== "" || row.length > 0) {
102178
- row.push(field2);
102349
+ if (field3 !== "" || row.length > 0) {
102350
+ row.push(field3);
102179
102351
  rows.push(row);
102180
102352
  }
102181
102353
  return rows.filter((cells) => cells.some((cell) => cell !== ""));
@@ -102770,7 +102942,7 @@ function help() {
102770
102942
  out.push(` ${import_picocolors86.default.cyan("orchestration create")} ${import_picocolors86.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
102771
102943
  out.push(` ${import_picocolors86.default.cyan("orchestration from-agent")} ${import_picocolors86.default.dim("turn an existing agent into an orchestration")}`);
102772
102944
  out.push(` ${import_picocolors86.default.cyan("orchestration list")} ${import_picocolors86.default.dim("list orchestrations under a team")}`);
102773
- out.push(` ${import_picocolors86.default.cyan("orchestration pull")} ${import_picocolors86.default.dim("<id>")} ${import_picocolors86.default.dim("recursively fetch an orchestration + every member agent")}`);
102945
+ out.push(` ${import_picocolors86.default.cyan("orchestration pull")} ${import_picocolors86.default.dim("<id>")} ${import_picocolors86.default.dim("recursively fetch an orchestration + every member agent (--force to discard local concurrency edits)")}`);
102774
102946
  out.push(` ${import_picocolors86.default.cyan("orchestration push")} ${import_picocolors86.default.dim("recursively push each member, then update the graph")}`);
102775
102947
  out.push(` ${import_picocolors86.default.cyan("orchestration status")} ${import_picocolors86.default.dim("show what would push and what would pull")}`);
102776
102948
  out.push(` ${import_picocolors86.default.cyan("orchestration delete")} ${import_picocolors86.default.dim("<id>")} ${import_picocolors86.default.dim("permanently delete an orchestration graph (member agents are kept)")}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainbase-labs/cli",
3
- "version": "0.59.0",
3
+ "version": "0.60.0",
4
4
  "description": "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
5
5
  "type": "module",
6
6
  "bin": {