@brainbase-labs/cli 0.59.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/index.js +1139 -554
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35182,9 +35182,9 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
35182
35182
|
});
|
|
35183
35183
|
|
|
35184
35184
|
// src/index.ts
|
|
35185
|
-
var
|
|
35186
|
-
import
|
|
35187
|
-
import
|
|
35185
|
+
var import_picocolors87 = __toESM(require_picocolors(), 1);
|
|
35186
|
+
import process15 from "node:process";
|
|
35187
|
+
import fs98 from "node:fs";
|
|
35188
35188
|
|
|
35189
35189
|
// src/cli/template.ts
|
|
35190
35190
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
@@ -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.
|
|
36094
|
+
version: "0.61.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
|
|
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,
|
|
69077
|
-
return fastApiDetails(body).some((entry) => entry.type === "extra_forbidden" && Array.isArray(entry.loc) && entry.loc[0] === "body" && entry.loc[1] ===
|
|
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(
|
|
70696
|
-
return
|
|
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
|
|
70931
|
-
if (
|
|
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 (
|
|
71019
|
+
if (field2.localChanged) {
|
|
70936
71020
|
lines.push(` ${import_picocolors31.default.yellow("→ push")} capabilities.${name} edited locally`);
|
|
70937
71021
|
}
|
|
70938
|
-
if (
|
|
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
|
-
|
|
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(
|
|
73097
|
+
async function defaultPrompt(field2) {
|
|
73002
73098
|
const answer = await re({
|
|
73003
|
-
message:
|
|
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
|
|
73021
|
-
const value = clean2(source[
|
|
73116
|
+
for (const field2 of missing) {
|
|
73117
|
+
const value = clean2(source[field2.key]);
|
|
73022
73118
|
if (value)
|
|
73023
|
-
out[
|
|
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
|
|
73039
|
-
const value = clean2(
|
|
73134
|
+
for (const field2 of fields) {
|
|
73135
|
+
const value = clean2(field2.value) ?? clean2(env3[field2.envVar]);
|
|
73040
73136
|
if (value)
|
|
73041
|
-
resolved[
|
|
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
|
|
73147
|
+
for (const field2 of missing) {
|
|
73052
73148
|
if (!interactive()) {
|
|
73053
|
-
throw new NonInteractiveError(`${
|
|
73149
|
+
throw new NonInteractiveError(`${field2.label} is required. Pass ${field2.flag}, set ${field2.envVar}, or pipe it on stdin.`);
|
|
73054
73150
|
}
|
|
73055
|
-
resolved[
|
|
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
|
|
75061
|
-
if (
|
|
75156
|
+
const field2 = shape[key2]._zod;
|
|
75157
|
+
if (field2.values) {
|
|
75062
75158
|
propValues[key2] ?? (propValues[key2] = new Set);
|
|
75063
|
-
for (const v3 of
|
|
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
|
|
80515
|
-
processField(
|
|
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(
|
|
80518
|
-
switch (
|
|
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 "${
|
|
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,
|
|
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(
|
|
82848
|
+
if (booleanConfig.has(field2))
|
|
82753
82849
|
result2 = explicitBoolean(input, flag);
|
|
82754
|
-
else if (
|
|
82850
|
+
else if (field2 === "allowed_models" || field2 === "computer_panel_tabs")
|
|
82755
82851
|
result2 = list(input);
|
|
82756
|
-
else if (
|
|
82852
|
+
else if (field2 === "template_prompts")
|
|
82757
82853
|
result2 = await readPrompts(path95.resolve(cwd2, input));
|
|
82758
|
-
else if (
|
|
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, { [
|
|
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
|
|
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(
|
|
84011
|
-
out.push(
|
|
84012
|
-
out.push(
|
|
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(
|
|
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(
|
|
84112
|
+
out.push(field2("changes", "none"));
|
|
84017
84113
|
} else {
|
|
84018
84114
|
const count = body.sections.length;
|
|
84019
|
-
out.push(
|
|
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) {
|
|
@@ -85138,6 +85234,7 @@ async function waitForTask(taskId, options) {
|
|
|
85138
85234
|
downtimeTimer = undefined;
|
|
85139
85235
|
failedPolls = 0;
|
|
85140
85236
|
latest = polled.value;
|
|
85237
|
+
options.onTask?.(latest);
|
|
85141
85238
|
if (latest.status !== lastStatus) {
|
|
85142
85239
|
lastStatus = latest.status;
|
|
85143
85240
|
options.onStatus?.(latest);
|
|
@@ -85297,8 +85394,8 @@ async function list2(ctx) {
|
|
|
85297
85394
|
}
|
|
85298
85395
|
banner("agent versions, newest first");
|
|
85299
85396
|
const out = [""];
|
|
85300
|
-
out.push(
|
|
85301
|
-
out.push(
|
|
85397
|
+
out.push(field2("agent", safe(agentId)));
|
|
85398
|
+
out.push(field2("pinned", pinLine(listing.pin)));
|
|
85302
85399
|
out.push("");
|
|
85303
85400
|
if (listing.items.length === 0) {
|
|
85304
85401
|
out.push(` ${import_picocolors49.default.dim("No versions yet. One is saved a few seconds after each change to the agent.")}`);
|
|
@@ -85343,21 +85440,21 @@ function printVersion(version2) {
|
|
|
85343
85440
|
const none = import_picocolors49.default.dim("none");
|
|
85344
85441
|
banner(`agent version ${versionName(version2)}`);
|
|
85345
85442
|
const out = [""];
|
|
85346
|
-
out.push(
|
|
85347
|
-
out.push(
|
|
85348
|
-
out.push(
|
|
85349
|
-
out.push(
|
|
85350
|
-
out.push(
|
|
85351
|
-
out.push(
|
|
85352
|
-
out.push(
|
|
85353
|
-
out.push(
|
|
85354
|
-
out.push(
|
|
85443
|
+
out.push(field2("version", `v${version2.version_number}`));
|
|
85444
|
+
out.push(field2("id", safe(version2.id)));
|
|
85445
|
+
out.push(field2("kind", safe(version2.kind)));
|
|
85446
|
+
out.push(field2("label", version2.label ? safe(version2.label) : none));
|
|
85447
|
+
out.push(field2("description", version2.description ? safe(version2.description) : none));
|
|
85448
|
+
out.push(field2("summary", version2.summary ? safe(version2.summary) : none));
|
|
85449
|
+
out.push(field2("created", `${safe(version2.created_at)} ${import_picocolors49.default.dim(`(${ago(version2.created_at)})`)}`));
|
|
85450
|
+
out.push(field2("by", `${safe(version2.actor_type ?? "unknown")} ${safe(version2.created_by ?? "")}`.trim()));
|
|
85451
|
+
out.push(field2("source", version2.source ? safe(version2.source) : none));
|
|
85355
85452
|
if (version2.restored_from)
|
|
85356
|
-
out.push(
|
|
85453
|
+
out.push(field2("restored", `from ${safe(version2.restored_from)}`));
|
|
85357
85454
|
if (version2.labeled_at) {
|
|
85358
|
-
out.push(
|
|
85455
|
+
out.push(field2("labelled", `${ago(version2.labeled_at)}${version2.labeled_by ? ` by ${safe(version2.labeled_by)}` : ""}`));
|
|
85359
85456
|
}
|
|
85360
|
-
out.push(
|
|
85457
|
+
out.push(field2("pinned", version2.pinned ? "yes, new tasks run this version" : "no"));
|
|
85361
85458
|
out.push("");
|
|
85362
85459
|
console.log(out.join(`
|
|
85363
85460
|
`));
|
|
@@ -85468,6 +85565,8 @@ var SyncedOrchestrationMetaSchema = exports_external.object({
|
|
|
85468
85565
|
});
|
|
85469
85566
|
var OrchestrationSyncStateSchema = exports_external.object({
|
|
85470
85567
|
schemaVersion: exports_external.literal(1),
|
|
85568
|
+
self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
|
|
85569
|
+
self_delegation_concurrency_supported: exports_external.boolean().optional(),
|
|
85471
85570
|
orchestration_id: exports_external.string(),
|
|
85472
85571
|
revision: exports_external.number(),
|
|
85473
85572
|
synced_at: exports_external.string(),
|
|
@@ -85952,7 +86051,8 @@ var DECISION_MODELS = [
|
|
|
85952
86051
|
"classify-1",
|
|
85953
86052
|
"microsoft-decision-1",
|
|
85954
86053
|
"clef-omni",
|
|
85955
|
-
"d1"
|
|
86054
|
+
"d1",
|
|
86055
|
+
"gemini-decision-1"
|
|
85956
86056
|
];
|
|
85957
86057
|
var DEFAULT_DECISION_MODEL = "clef-flash";
|
|
85958
86058
|
var DECISION_LIMITS = {
|
|
@@ -85988,6 +86088,7 @@ var DecisionSchema = exports_external.object({
|
|
|
85988
86088
|
});
|
|
85989
86089
|
var OrchestrationManifestSchema = exports_external.object({
|
|
85990
86090
|
schema: exports_external.literal(1),
|
|
86091
|
+
self_delegation_concurrency_limit: SelfDelegationConcurrencySchema,
|
|
85991
86092
|
orchestration: OrchMetaSchema,
|
|
85992
86093
|
members: exports_external.array(MemberSchema).default([]),
|
|
85993
86094
|
edges: exports_external.array(EdgeSchema).default([]),
|
|
@@ -86068,6 +86169,7 @@ import os15 from "node:os";
|
|
|
86068
86169
|
async function installAgentFresh(input) {
|
|
86069
86170
|
const { cwd: cwd2, agent: agent2, cloud, harness } = input;
|
|
86070
86171
|
const scope = input.scope ?? "project";
|
|
86172
|
+
const { claimedByOther, previousManifest, previousMeta } = input.previousState ?? readFreshInstallPreviousState(cwd2, agent2.id);
|
|
86071
86173
|
ensureDir(cwd2);
|
|
86072
86174
|
const availableSecrets = input.pullSecrets === false ? {} : await pullAgentSecrets(cwd2, agent2.id);
|
|
86073
86175
|
const stageRoot = stageManifestComponents2(cloud.components);
|
|
@@ -86107,10 +86209,7 @@ async function installAgentFresh(input) {
|
|
|
86107
86209
|
}
|
|
86108
86210
|
materializeInstructions2(cwd2, cloud);
|
|
86109
86211
|
materializePlaybooks2(cwd2, cloud);
|
|
86110
|
-
const
|
|
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;
|
|
86212
|
+
const previousMode = previousManifest?.runtime_mode;
|
|
86114
86213
|
const localOnly = input.preserveManifest || claimedByOther ? {} : readLocalOnlyContentReporting(cwd2);
|
|
86115
86214
|
if (claimedByOther) {
|
|
86116
86215
|
f2.warn(`${path98.basename(cwd2)} was linked to a different agent; its local-only blocks were left out of the rebuilt manifest.`);
|
|
@@ -86119,6 +86218,8 @@ async function installAgentFresh(input) {
|
|
|
86119
86218
|
if (manifest && agent2.runtime_mode === undefined && previousMode !== undefined) {
|
|
86120
86219
|
manifest.runtime_mode = previousMode;
|
|
86121
86220
|
}
|
|
86221
|
+
if (manifest)
|
|
86222
|
+
Object.assign(manifest, concurrencyManifest(agent2, previousManifest));
|
|
86122
86223
|
if (manifest)
|
|
86123
86224
|
writeManifest(cwd2, manifest);
|
|
86124
86225
|
writeLink(cwd2, {
|
|
@@ -86151,6 +86252,7 @@ async function installAgentFresh(input) {
|
|
|
86151
86252
|
...agent2.machine_kind ? { machine_kind: agent2.machine_kind } : {},
|
|
86152
86253
|
...Object.prototype.hasOwnProperty.call(agent2, "default_model") ? { default_model: agent2.default_model ?? null } : {},
|
|
86153
86254
|
...runtimeModeBaseline(agent2, previousMeta),
|
|
86255
|
+
...concurrencyBaseline(agent2, previousMeta),
|
|
86154
86256
|
...capabilityBaseline(agent2, undefined)
|
|
86155
86257
|
}
|
|
86156
86258
|
});
|
|
@@ -86259,6 +86361,7 @@ function buildManifestFromCloud(cloud, agent2, localOnly = {}) {
|
|
|
86259
86361
|
schema: 1,
|
|
86260
86362
|
...agent2.machine_kind ? { machine_kind: agent2.machine_kind } : {},
|
|
86261
86363
|
...agent2.runtime_mode === "auto" ? { runtime_mode: "auto" } : {},
|
|
86364
|
+
...concurrencyManifest(agent2),
|
|
86262
86365
|
...agent2.default_model ? { default_model: agent2.default_model } : {},
|
|
86263
86366
|
agent: {
|
|
86264
86367
|
name: agent2.name,
|
|
@@ -86300,9 +86403,16 @@ async function pullAgentSecrets(cwd2, agentId) {
|
|
|
86300
86403
|
return {};
|
|
86301
86404
|
}
|
|
86302
86405
|
}
|
|
86303
|
-
function
|
|
86304
|
-
const
|
|
86305
|
-
|
|
86406
|
+
function readFreshInstallPreviousState(cwd2, agentId) {
|
|
86407
|
+
const manifest = safeRead(() => readManifest(cwd2)) ?? undefined;
|
|
86408
|
+
const lock = safeRead(() => readSyncState(cwd2));
|
|
86409
|
+
const claimedBy = (manifest ? manifest.id : readManifestAgentId(cwd2)) ?? safeRead(() => LinkSchema.parse(JSON.parse(fs85.readFileSync(legacyLinkPath(cwd2), "utf8"))).agent_id) ?? lock?.agent_id;
|
|
86410
|
+
const claimedByOther = claimedBy !== undefined && claimedBy !== agentId;
|
|
86411
|
+
return {
|
|
86412
|
+
claimedByOther,
|
|
86413
|
+
previousManifest: claimedByOther ? undefined : manifest,
|
|
86414
|
+
previousMeta: lock?.agent_id === agentId ? lock.agentMeta : undefined
|
|
86415
|
+
};
|
|
86306
86416
|
}
|
|
86307
86417
|
function safeRead(read2) {
|
|
86308
86418
|
try {
|
|
@@ -86700,14 +86810,14 @@ function decideOrchestrationMeta(input) {
|
|
|
86700
86810
|
if (!meta)
|
|
86701
86811
|
return [];
|
|
86702
86812
|
const out = [];
|
|
86703
|
-
for (const
|
|
86704
|
-
const local = metaText(meta[
|
|
86705
|
-
const cloud = metaText(input.cloud[
|
|
86813
|
+
for (const field3 of ORCH_META_FIELDS) {
|
|
86814
|
+
const local = metaText(meta[field3]);
|
|
86815
|
+
const cloud = metaText(input.cloud[field3]) ?? "";
|
|
86706
86816
|
if (local === undefined)
|
|
86707
86817
|
continue;
|
|
86708
86818
|
if (local === cloud)
|
|
86709
86819
|
continue;
|
|
86710
|
-
const base2 = input.baseline === undefined ? undefined : metaText(input.baseline[
|
|
86820
|
+
const base2 = input.baseline === undefined ? undefined : metaText(input.baseline[field3]) ?? "";
|
|
86711
86821
|
let kind;
|
|
86712
86822
|
if (base2 === undefined) {
|
|
86713
86823
|
kind = "conflict";
|
|
@@ -86720,21 +86830,21 @@ function decideOrchestrationMeta(input) {
|
|
|
86720
86830
|
}
|
|
86721
86831
|
if (kind === "conflict" && input.force)
|
|
86722
86832
|
kind = "push";
|
|
86723
|
-
out.push({ field:
|
|
86833
|
+
out.push({ field: field3, kind, local, cloud });
|
|
86724
86834
|
}
|
|
86725
86835
|
return out;
|
|
86726
86836
|
}
|
|
86727
86837
|
function nextOrchestrationMeta(input) {
|
|
86728
86838
|
const kept = new Set(input.decisions.filter((d3) => d3.kind === "keep").map((d3) => d3.field));
|
|
86729
86839
|
const out = {};
|
|
86730
|
-
for (const
|
|
86731
|
-
const value3 = kept.has(
|
|
86840
|
+
for (const field3 of ORCH_META_FIELDS) {
|
|
86841
|
+
const value3 = kept.has(field3) ? input.previous?.[field3] : input.applied[field3];
|
|
86732
86842
|
if (value3 == null)
|
|
86733
86843
|
continue;
|
|
86734
|
-
if (
|
|
86844
|
+
if (field3 === "credit_limit") {
|
|
86735
86845
|
out.credit_limit = typeof value3 === "number" ? value3 : Number(value3);
|
|
86736
86846
|
} else {
|
|
86737
|
-
out[
|
|
86847
|
+
out[field3] = String(value3);
|
|
86738
86848
|
}
|
|
86739
86849
|
}
|
|
86740
86850
|
return out;
|
|
@@ -86817,6 +86927,34 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
86817
86927
|
}
|
|
86818
86928
|
const slugByAgent = resolveMemberSlugs(cloud.members);
|
|
86819
86929
|
const slugFor = (agentId) => slugByAgent.get(agentId) ?? agentId;
|
|
86930
|
+
let previousManifest = null;
|
|
86931
|
+
try {
|
|
86932
|
+
previousManifest = readOrchManifest(cwd2);
|
|
86933
|
+
} catch {}
|
|
86934
|
+
const previousLock = readOrchSyncState(cwd2);
|
|
86935
|
+
const memberStates = new Map(cloud.members.filter((m3) => m3.manifest).map((m3) => [
|
|
86936
|
+
m3.agent_id,
|
|
86937
|
+
readFreshInstallPreviousState(memberDir(cwd2, slugFor(m3.agent_id)), m3.agent_id)
|
|
86938
|
+
]));
|
|
86939
|
+
const edited = [];
|
|
86940
|
+
if (previousManifest && (!existingLink || existingLink.orchestration_id === cloud.id || previousLock?.orchestration_id === cloud.id)) {
|
|
86941
|
+
const diff3 = diffConcurrency(previousManifest, previousLock?.orchestration_id === cloud.id ? previousLock : undefined, cloud);
|
|
86942
|
+
if (diff3.localChanged && !diff3.converged)
|
|
86943
|
+
edited.push("brainbase-orchestration.yaml");
|
|
86944
|
+
}
|
|
86945
|
+
for (const m3 of cloud.members) {
|
|
86946
|
+
const state = memberStates.get(m3.agent_id);
|
|
86947
|
+
if (!state?.previousManifest || state.claimedByOther)
|
|
86948
|
+
continue;
|
|
86949
|
+
const diff3 = diffConcurrency(state.previousManifest, state.previousMeta, m3);
|
|
86950
|
+
if (diff3.localChanged && !diff3.converged)
|
|
86951
|
+
edited.push(`${ORCH_MEMBERS_DIR}/${slugFor(m3.agent_id)}/brainbase.agent.yaml`);
|
|
86952
|
+
}
|
|
86953
|
+
if (edited.length && !args.force) {
|
|
86954
|
+
fail(`self_delegation_concurrency_limit has local edits that pull would overwrite: ${edited.join(", ")}.`);
|
|
86955
|
+
f2.info(`Push the edits first, or run ${import_picocolors54.default.cyan("brainbase orchestration pull --force")} to discard them.`);
|
|
86956
|
+
return;
|
|
86957
|
+
}
|
|
86820
86958
|
const planLines = [];
|
|
86821
86959
|
planLines.push("");
|
|
86822
86960
|
planLines.push(` ${import_picocolors54.default.bold(cloud.name)} ${import_picocolors54.default.dim(`(${cloud.id})`)}`);
|
|
@@ -86893,12 +87031,15 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
86893
87031
|
harness: fallbackHarness,
|
|
86894
87032
|
machine_kind: m3.machine_kind,
|
|
86895
87033
|
default_model: m3.default_model,
|
|
86896
|
-
runtime_mode: m3.runtime_mode
|
|
87034
|
+
runtime_mode: m3.runtime_mode,
|
|
87035
|
+
self_delegation_concurrency_limit: m3.self_delegation_concurrency_limit,
|
|
87036
|
+
self_delegation_concurrency_supported: m3.self_delegation_concurrency_supported
|
|
86897
87037
|
},
|
|
86898
87038
|
cloud: m3.manifest,
|
|
86899
87039
|
harness: fallbackHarness,
|
|
86900
87040
|
scope: "project",
|
|
86901
|
-
pullSecrets: true
|
|
87041
|
+
pullSecrets: true,
|
|
87042
|
+
previousState: memberStates.get(m3.agent_id)
|
|
86902
87043
|
});
|
|
86903
87044
|
memberSp.stop(`Installed ${import_picocolors54.default.bold(slug)} ${import_picocolors54.default.dim(`(${m3.manifest.components.length} components)`)}.`);
|
|
86904
87045
|
installedMembers.push({
|
|
@@ -86916,11 +87057,8 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
86916
87057
|
let manifestDecisions2 = pulledDecisions ? decisionsForManifest(pulledDecisions) : undefined;
|
|
86917
87058
|
let decisionBaseline = pulledDecisions ? syncedDecisions(pulledDecisions) : undefined;
|
|
86918
87059
|
if (!pulledDecisions) {
|
|
86919
|
-
|
|
86920
|
-
|
|
86921
|
-
} catch {}
|
|
86922
|
-
const lock = readOrchSyncState(cwd2);
|
|
86923
|
-
decisionBaseline = lock?.orchestration_id === cloud.id ? lock.decisions : undefined;
|
|
87060
|
+
manifestDecisions2 = previousManifest?.decisions;
|
|
87061
|
+
decisionBaseline = previousLock?.orchestration_id === cloud.id ? previousLock.decisions : undefined;
|
|
86924
87062
|
}
|
|
86925
87063
|
for (const [decisionId, count] of deadDecisionLinks(cloud)) {
|
|
86926
87064
|
const name = pulledDecisions?.find((d3) => d3.id === decisionId)?.name;
|
|
@@ -86928,6 +87066,7 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
86928
87066
|
}
|
|
86929
87067
|
const manifest = {
|
|
86930
87068
|
schema: 1,
|
|
87069
|
+
...concurrencyManifest(cloud, previousManifest ?? undefined),
|
|
86931
87070
|
orchestration: {
|
|
86932
87071
|
name: cloud.name,
|
|
86933
87072
|
...cloud.description ? { description: cloud.description } : {},
|
|
@@ -86965,6 +87104,7 @@ async function runOrchestrationPull(cwd2, args) {
|
|
|
86965
87104
|
});
|
|
86966
87105
|
writeOrchSyncState(cwd2, {
|
|
86967
87106
|
schemaVersion: 1,
|
|
87107
|
+
...concurrencyBaseline(cloud, previousLock ?? undefined),
|
|
86968
87108
|
orchestration_id: cloud.id,
|
|
86969
87109
|
revision: cloud.revision,
|
|
86970
87110
|
synced_at: new Date().toISOString(),
|
|
@@ -87293,6 +87433,17 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
87293
87433
|
return;
|
|
87294
87434
|
}
|
|
87295
87435
|
const agentIdToSlug = new Map([...slugToAgentId.entries()].map(([slug, id]) => [id, slug]));
|
|
87436
|
+
const concurrency = diffConcurrency(manifest, lock ?? undefined, cloud);
|
|
87437
|
+
if (concurrency.unsupported) {
|
|
87438
|
+
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.");
|
|
87439
|
+
process.exitCode = 1;
|
|
87440
|
+
return;
|
|
87441
|
+
}
|
|
87442
|
+
if (concurrency.conflict && !args.force) {
|
|
87443
|
+
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.");
|
|
87444
|
+
process.exitCode = 1;
|
|
87445
|
+
return;
|
|
87446
|
+
}
|
|
87296
87447
|
const slugForAgent = (agentId, fallback) => agentIdToSlug.get(agentId) ?? fallback;
|
|
87297
87448
|
const selfConflicts = selfEdgeConflicts(manifest, cloud, lock, slugToAgentId);
|
|
87298
87449
|
if (selfConflicts.length && args.force)
|
|
@@ -87549,16 +87700,17 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
87549
87700
|
}
|
|
87550
87701
|
}
|
|
87551
87702
|
const keptFields = new Set(metaKept.map((d3) => d3.field));
|
|
87552
|
-
const metaField = (
|
|
87553
|
-
const value3 = manifest.orchestration[
|
|
87554
|
-
if (value3 === undefined || keptFields.has(
|
|
87703
|
+
const metaField = (field3) => {
|
|
87704
|
+
const value3 = manifest.orchestration[field3];
|
|
87705
|
+
if (value3 === undefined || keptFields.has(field3))
|
|
87555
87706
|
return {};
|
|
87556
|
-
return { [
|
|
87707
|
+
return { [field3]: value3 };
|
|
87557
87708
|
};
|
|
87558
87709
|
const sp = spinner();
|
|
87559
87710
|
sp.start("Updating orchestration graph…");
|
|
87560
87711
|
try {
|
|
87561
87712
|
const updateInput = {
|
|
87713
|
+
...concurrencyWrite(manifest, cloud, concurrency),
|
|
87562
87714
|
...metaField("name"),
|
|
87563
87715
|
...metaField("description"),
|
|
87564
87716
|
...metaField("icon"),
|
|
@@ -87581,10 +87733,12 @@ async function runOrchestrationPush(cwd2, args) {
|
|
|
87581
87733
|
sp.stop("Connection lost after the graph was sent — reading the cloud graph back…");
|
|
87582
87734
|
updated = await reconcileOrchestrationUpdate(link2.orchestration_id, updateInput, sendDecisions ? localDecisions : null, slugForAgent, pushStartedAt);
|
|
87583
87735
|
}
|
|
87736
|
+
verifyConcurrencyWrite(updateInput, updated);
|
|
87584
87737
|
sp.stop(`Graph updated. New cloud revision ${updated.revision}.`);
|
|
87585
87738
|
const settledDecisions = sendDecisions ? cloudDecisions(updated, slugForAgent) : decisionPlan?.kind === "reconcile" ? cloudDecisionList : null;
|
|
87586
87739
|
writeOrchSyncState(cwd2, {
|
|
87587
87740
|
schemaVersion: 1,
|
|
87741
|
+
...concurrencyBaselineAfterPush(manifest, lock ?? undefined, concurrency),
|
|
87588
87742
|
orchestration_id: updated.id,
|
|
87589
87743
|
revision: updated.revision,
|
|
87590
87744
|
synced_at: new Date().toISOString(),
|
|
@@ -87705,20 +87859,20 @@ function graphDivergence(cloud, sent) {
|
|
|
87705
87859
|
}))));
|
|
87706
87860
|
}
|
|
87707
87861
|
}
|
|
87708
|
-
for (const
|
|
87862
|
+
for (const field3 of [
|
|
87709
87863
|
"name",
|
|
87710
87864
|
"description",
|
|
87711
87865
|
"icon",
|
|
87712
87866
|
"icon_color",
|
|
87713
87867
|
"credit_limit"
|
|
87714
87868
|
]) {
|
|
87715
|
-
let expected = sent[
|
|
87716
|
-
if (
|
|
87869
|
+
let expected = sent[field3];
|
|
87870
|
+
if (field3 === "name" && typeof expected === "string")
|
|
87717
87871
|
expected = expected.trim();
|
|
87718
|
-
if ((
|
|
87872
|
+
if ((field3 === "icon" || field3 === "icon_color") && expected === "")
|
|
87719
87873
|
expected = null;
|
|
87720
|
-
if (expected !== undefined && cloud[
|
|
87721
|
-
diffs.push(`${
|
|
87874
|
+
if (expected !== undefined && cloud[field3] !== expected) {
|
|
87875
|
+
diffs.push(`${field3}: cloud has "${String(cloud[field3])}", sent "${String(expected)}"`);
|
|
87722
87876
|
}
|
|
87723
87877
|
}
|
|
87724
87878
|
return diffs;
|
|
@@ -87930,6 +88084,22 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
87930
88084
|
lines.push(` ${import_picocolors57.default.cyan("← pull")} added on cloud: ${k3}`);
|
|
87931
88085
|
lines.push("");
|
|
87932
88086
|
}
|
|
88087
|
+
const concurrency = diffConcurrency(localManifest ?? {}, lock ?? undefined, cloud);
|
|
88088
|
+
const concurrencyDrifted = concurrency.unsupported || concurrency.localChanged || concurrency.cloudChanged || concurrency.conflict;
|
|
88089
|
+
if (concurrencyDrifted) {
|
|
88090
|
+
lines.push(` ${import_picocolors57.default.bold("children running at once")}`);
|
|
88091
|
+
if (concurrency.unsupported)
|
|
88092
|
+
lines.push(` ${import_picocolors57.default.red("! unsupported")} self_delegation_concurrency_limit not exposed by this control plane`);
|
|
88093
|
+
else if (concurrency.conflict)
|
|
88094
|
+
lines.push(` ${import_picocolors57.default.red("! conflict")} self_delegation_concurrency_limit conflicts with cloud or has no sync baseline`);
|
|
88095
|
+
else {
|
|
88096
|
+
if (concurrency.localChanged)
|
|
88097
|
+
lines.push(` ${import_picocolors57.default.yellow("→ push")} self_delegation_concurrency_limit edited locally`);
|
|
88098
|
+
if (concurrency.cloudChanged)
|
|
88099
|
+
lines.push(` ${import_picocolors57.default.cyan("← pull")} self_delegation_concurrency_limit changed on cloud; push leaves it alone`);
|
|
88100
|
+
}
|
|
88101
|
+
lines.push("");
|
|
88102
|
+
}
|
|
87933
88103
|
const metaDecisions = decideOrchestrationMeta({
|
|
87934
88104
|
manifest: localManifest,
|
|
87935
88105
|
cloud,
|
|
@@ -88146,7 +88316,7 @@ async function runOrchestrationStatus(cwd2) {
|
|
|
88146
88316
|
endpointLines.push(...webhookEndpointLines(cloudWebhooks, " "));
|
|
88147
88317
|
endpointLines.push("");
|
|
88148
88318
|
}
|
|
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) {
|
|
88319
|
+
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
88320
|
lines.push(` ${import_picocolors57.default.green("✓")} everything is in sync`);
|
|
88151
88321
|
lines.push("");
|
|
88152
88322
|
lines.push(...endpointLines);
|
|
@@ -88462,6 +88632,7 @@ async function runOrchestrationCreate(cwd2, args) {
|
|
|
88462
88632
|
sp.start("Creating orchestration…");
|
|
88463
88633
|
try {
|
|
88464
88634
|
const created = await api.createOrchestration({
|
|
88635
|
+
...concurrencyLimit(manifest),
|
|
88465
88636
|
org_id: target.org.id,
|
|
88466
88637
|
team_id: target.team.id,
|
|
88467
88638
|
name: manifest.orchestration.name,
|
|
@@ -88486,8 +88657,10 @@ async function runOrchestrationCreate(cwd2, args) {
|
|
|
88486
88657
|
description: created.description || undefined,
|
|
88487
88658
|
linked_at: new Date().toISOString()
|
|
88488
88659
|
});
|
|
88660
|
+
verifyConcurrencyWrite(manifest, created);
|
|
88489
88661
|
writeOrchSyncState(cwd2, {
|
|
88490
88662
|
schemaVersion: 1,
|
|
88663
|
+
...concurrencyBaseline(created),
|
|
88491
88664
|
orchestration_id: created.id,
|
|
88492
88665
|
revision: created.revision,
|
|
88493
88666
|
synced_at: new Date().toISOString(),
|
|
@@ -88958,7 +89131,8 @@ async function runOrchestration(cwd2, sub, args, opts) {
|
|
|
88958
89131
|
await runOrchestrationPull(cwd2, {
|
|
88959
89132
|
orchestrationId: args[0],
|
|
88960
89133
|
yes: opts.yes,
|
|
88961
|
-
harness: opts.harness
|
|
89134
|
+
harness: opts.harness,
|
|
89135
|
+
force: opts.force
|
|
88962
89136
|
});
|
|
88963
89137
|
return;
|
|
88964
89138
|
case "push":
|
|
@@ -89017,7 +89191,7 @@ function printHelp4() {
|
|
|
89017
89191
|
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
89192
|
out.push(` ${import_picocolors64.default.cyan("create")} ${import_picocolors64.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
89019
89193
|
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")}`);
|
|
89194
|
+
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
89195
|
out.push(` ${import_picocolors64.default.cyan("push")} ${import_picocolors64.default.dim("push each member, then update the orchestration graph")}`);
|
|
89022
89196
|
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
89197
|
out.push(` ${import_picocolors64.default.cyan("status")} ${import_picocolors64.default.dim("show what would push and what would pull")}`);
|
|
@@ -90780,10 +90954,10 @@ async function waitForAccount(agentId, slug, before2, options) {
|
|
|
90780
90954
|
}
|
|
90781
90955
|
|
|
90782
90956
|
// src/cli/task.ts
|
|
90783
|
-
var
|
|
90957
|
+
var import_picocolors75 = __toESM(require_picocolors(), 1);
|
|
90784
90958
|
|
|
90785
90959
|
// src/cli/task-create.ts
|
|
90786
|
-
var
|
|
90960
|
+
var import_picocolors71 = __toESM(require_picocolors(), 1);
|
|
90787
90961
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
90788
90962
|
|
|
90789
90963
|
// src/cli/task-update.ts
|
|
@@ -90949,6 +91123,33 @@ function format(task) {
|
|
|
90949
91123
|
`);
|
|
90950
91124
|
}
|
|
90951
91125
|
|
|
91126
|
+
// src/cli/task-model-notice.ts
|
|
91127
|
+
var import_picocolors70 = __toESM(require_picocolors(), 1);
|
|
91128
|
+
function modelNoticeOf(body) {
|
|
91129
|
+
if (!body || typeof body !== "object")
|
|
91130
|
+
return;
|
|
91131
|
+
const notice = body.model_notice;
|
|
91132
|
+
if (!notice || typeof notice !== "object")
|
|
91133
|
+
return;
|
|
91134
|
+
const message3 = notice.message;
|
|
91135
|
+
return typeof message3 === "string" && message3.trim() ? notice : undefined;
|
|
91136
|
+
}
|
|
91137
|
+
function modelNoticeLines(taskId, notice) {
|
|
91138
|
+
const id = /^[A-Za-z0-9_-]+$/.test(taskId) ? taskId : "<task-id>";
|
|
91139
|
+
return [
|
|
91140
|
+
`${import_picocolors70.default.yellow("warning:")} ${sanitizeLabel(notice.message)}`,
|
|
91141
|
+
` To decide, run \`brainbase task update ${id} --clear-model\` to use the agent default, or \`brainbase task update ${id} --model <id>\` to pick a model.`
|
|
91142
|
+
];
|
|
91143
|
+
}
|
|
91144
|
+
function warnModelNotice(taskId, body) {
|
|
91145
|
+
const notice = modelNoticeOf(body);
|
|
91146
|
+
if (!notice)
|
|
91147
|
+
return false;
|
|
91148
|
+
console.error(modelNoticeLines(taskId, notice).join(`
|
|
91149
|
+
`));
|
|
91150
|
+
return true;
|
|
91151
|
+
}
|
|
91152
|
+
|
|
90952
91153
|
// src/cli/task-create.ts
|
|
90953
91154
|
var DEFAULT_POLL_INTERVAL_MS2 = 2000;
|
|
90954
91155
|
async function createTask(input, options) {
|
|
@@ -91025,6 +91226,8 @@ async function runTaskCreate(cwd2, options, dependencies = {}) {
|
|
|
91025
91226
|
}
|
|
91026
91227
|
throw interfaceId ? toInterfaceError(error2) : error2;
|
|
91027
91228
|
}
|
|
91229
|
+
const warned = warnModelNotice(created.id, created.task);
|
|
91230
|
+
const notice = modelNoticeOf(created.task);
|
|
91028
91231
|
if (!options.wait) {
|
|
91029
91232
|
if (options.json) {
|
|
91030
91233
|
console.log(JSON.stringify({
|
|
@@ -91032,6 +91235,7 @@ async function runTaskCreate(cwd2, options, dependencies = {}) {
|
|
|
91032
91235
|
agent_id: created.agent_id,
|
|
91033
91236
|
status: created.status,
|
|
91034
91237
|
...versionFields(version2),
|
|
91238
|
+
...notice ? { model_notice: notice } : {},
|
|
91035
91239
|
...created.task ? { task: created.task } : {}
|
|
91036
91240
|
}));
|
|
91037
91241
|
return;
|
|
@@ -91046,9 +91250,9 @@ async function runTaskCreate(cwd2, options, dependencies = {}) {
|
|
|
91046
91250
|
`));
|
|
91047
91251
|
return;
|
|
91048
91252
|
}
|
|
91049
|
-
await waitForCreatedTask(created, options, dependencies, version2);
|
|
91253
|
+
await waitForCreatedTask(created, options, dependencies, version2, warned);
|
|
91050
91254
|
}
|
|
91051
|
-
async function waitForCreatedTask(created, options, dependencies, version2) {
|
|
91255
|
+
async function waitForCreatedTask(created, options, dependencies, version2, warned) {
|
|
91052
91256
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
91053
91257
|
const controller = new AbortController;
|
|
91054
91258
|
const onSigint = () => controller.abort();
|
|
@@ -91064,11 +91268,16 @@ async function waitForCreatedTask(created, options, dependencies, version2) {
|
|
|
91064
91268
|
intervalMs: options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2,
|
|
91065
91269
|
timeoutMs: options.timeoutSeconds === undefined ? undefined : options.timeoutSeconds * 1000,
|
|
91066
91270
|
signal: controller.signal,
|
|
91271
|
+
onTask: (task) => {
|
|
91272
|
+
if (!warned)
|
|
91273
|
+
warned = warnModelNotice(created.id, task);
|
|
91274
|
+
},
|
|
91067
91275
|
onStatus: options.json ? undefined : (task) => console.log(`Status: ${task.status}`)
|
|
91068
91276
|
});
|
|
91069
91277
|
const status = outcome.task?.status ?? created.status;
|
|
91070
91278
|
const code = exitCodeForWaitOutcome(outcome);
|
|
91071
91279
|
setExitCode(code);
|
|
91280
|
+
const notice = modelNoticeOf(outcome.task ?? created.task);
|
|
91072
91281
|
if (outcome.kind === "unreachable") {
|
|
91073
91282
|
console.error(waitUnreachableNotice(`Task ${created.id}'s status`, `check with \`brainbase task get ${created.id}\``, outcome.budgetMs));
|
|
91074
91283
|
}
|
|
@@ -91080,6 +91289,7 @@ async function waitForCreatedTask(created, options, dependencies, version2) {
|
|
|
91080
91289
|
outcome: outcome.kind,
|
|
91081
91290
|
exit_code: code,
|
|
91082
91291
|
...versionFields(version2),
|
|
91292
|
+
...notice ? { model_notice: notice } : {},
|
|
91083
91293
|
...outcome.task ?? created.task ? { task: outcome.task ?? created.task } : {}
|
|
91084
91294
|
}));
|
|
91085
91295
|
return;
|
|
@@ -91088,24 +91298,24 @@ async function waitForCreatedTask(created, options, dependencies, version2) {
|
|
|
91088
91298
|
return;
|
|
91089
91299
|
}
|
|
91090
91300
|
if (outcome.kind === "timeout") {
|
|
91091
|
-
console.log(
|
|
91301
|
+
console.log(import_picocolors71.default.yellow(`Timed out after ${options.timeoutSeconds}s with the task still ${status}.`));
|
|
91092
91302
|
return;
|
|
91093
91303
|
}
|
|
91094
91304
|
if (outcome.kind === "interrupted") {
|
|
91095
|
-
console.log(
|
|
91305
|
+
console.log(import_picocolors71.default.yellow("Interrupted. The task is still running."));
|
|
91096
91306
|
return;
|
|
91097
91307
|
}
|
|
91098
|
-
console.log(code === 0 ?
|
|
91308
|
+
console.log(code === 0 ? import_picocolors71.default.green("Task completed.") : import_picocolors71.default.red(`Task finished as ${status}.`));
|
|
91099
91309
|
} finally {
|
|
91100
91310
|
process.removeListener("SIGINT", onSigint);
|
|
91101
91311
|
}
|
|
91102
91312
|
}
|
|
91103
91313
|
|
|
91104
91314
|
// src/cli/task-get.ts
|
|
91105
|
-
var
|
|
91315
|
+
var import_picocolors73 = __toESM(require_picocolors(), 1);
|
|
91106
91316
|
|
|
91107
91317
|
// src/cli/task-list.ts
|
|
91108
|
-
var
|
|
91318
|
+
var import_picocolors72 = __toESM(require_picocolors(), 1);
|
|
91109
91319
|
|
|
91110
91320
|
// src/core/agent-names.ts
|
|
91111
91321
|
async function agentNames(ids) {
|
|
@@ -91170,29 +91380,29 @@ function labelFilter(options) {
|
|
|
91170
91380
|
function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = false) {
|
|
91171
91381
|
const lines = [""];
|
|
91172
91382
|
if (tasks.length === 0 && labelFiltered) {
|
|
91173
|
-
lines.push(` ${
|
|
91383
|
+
lines.push(` ${import_picocolors72.default.dim("No tasks carry every label given with --metadata.")}`, "");
|
|
91174
91384
|
return lines.join(`
|
|
91175
91385
|
`);
|
|
91176
91386
|
}
|
|
91177
91387
|
if (tasks.length === 0 && interfaceId) {
|
|
91178
91388
|
const id = sanitizeLabel(interfaceId);
|
|
91179
|
-
lines.push(` ${
|
|
91389
|
+
lines.push(` ${import_picocolors72.default.dim(`No build conversations for interface ${id}.`)}`, "", ` ${import_picocolors72.default.dim("start one with")} ${import_picocolors72.default.cyan(`brainbase interface build ${id} "..."`)}`, "");
|
|
91180
91390
|
return lines.join(`
|
|
91181
91391
|
`);
|
|
91182
91392
|
}
|
|
91183
91393
|
if (tasks.length === 0) {
|
|
91184
|
-
lines.push(` ${
|
|
91394
|
+
lines.push(` ${import_picocolors72.default.dim(agentId ? `No tasks for agent ${agentId}.` : "No tasks yet.")}`, "", ` ${import_picocolors72.default.dim("start one with")} ${import_picocolors72.default.cyan('brainbase task create --message "..."')}`, "");
|
|
91185
91395
|
return lines.join(`
|
|
91186
91396
|
`);
|
|
91187
91397
|
}
|
|
91188
91398
|
for (const task of tasks) {
|
|
91189
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
91190
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
91191
|
-
lines.push(` ${
|
|
91192
|
-
lines.push(` ${
|
|
91399
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors72.default.dim("(untitled)");
|
|
91400
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors72.default.bold(title)}`);
|
|
91401
|
+
lines.push(` ${import_picocolors72.default.dim(sanitizeLabel(task.id))}`);
|
|
91402
|
+
lines.push(` ${import_picocolors72.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${sanitizeLabel(task.created_at)}`)}`);
|
|
91193
91403
|
lines.push("");
|
|
91194
91404
|
}
|
|
91195
|
-
lines.push(` ${
|
|
91405
|
+
lines.push(` ${import_picocolors72.default.dim("inspect one with")} ${import_picocolors72.default.cyan("brainbase task get <id>")}`, "");
|
|
91196
91406
|
return lines.join(`
|
|
91197
91407
|
`);
|
|
91198
91408
|
}
|
|
@@ -91200,16 +91410,16 @@ function statusLabel(status) {
|
|
|
91200
91410
|
const padded = sanitizeLabel(status).padEnd(14);
|
|
91201
91411
|
switch (status) {
|
|
91202
91412
|
case "success":
|
|
91203
|
-
return
|
|
91413
|
+
return import_picocolors72.default.green(padded);
|
|
91204
91414
|
case "fail":
|
|
91205
|
-
return
|
|
91415
|
+
return import_picocolors72.default.red(padded);
|
|
91206
91416
|
case "need_more_info":
|
|
91207
|
-
return
|
|
91417
|
+
return import_picocolors72.default.yellow(padded);
|
|
91208
91418
|
case "running":
|
|
91209
91419
|
case "initializing":
|
|
91210
|
-
return
|
|
91420
|
+
return import_picocolors72.default.cyan(padded);
|
|
91211
91421
|
default:
|
|
91212
|
-
return
|
|
91422
|
+
return import_picocolors72.default.dim(padded);
|
|
91213
91423
|
}
|
|
91214
91424
|
}
|
|
91215
91425
|
|
|
@@ -91219,6 +91429,7 @@ async function runTaskGet(taskId, options = {}) {
|
|
|
91219
91429
|
banner("task get — one task");
|
|
91220
91430
|
const task = await masApi.getTask(taskId);
|
|
91221
91431
|
const evals = await readEvalRuns(task);
|
|
91432
|
+
warnModelNotice(task.id, task);
|
|
91222
91433
|
if (options.json) {
|
|
91223
91434
|
const payload = { task, eval_runs: evals.runs };
|
|
91224
91435
|
if (evals.unavailable)
|
|
@@ -91243,60 +91454,60 @@ async function readEvalRuns(task) {
|
|
|
91243
91454
|
}
|
|
91244
91455
|
function format2(task, evals, names) {
|
|
91245
91456
|
const lines = [""];
|
|
91246
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
91457
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors73.default.dim("(untitled)");
|
|
91247
91458
|
const id = sanitizeLabel(task.id);
|
|
91248
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
91459
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors73.default.bold(title)}`);
|
|
91249
91460
|
lines.push("");
|
|
91250
|
-
lines.push(` ${
|
|
91251
|
-
lines.push(` ${
|
|
91461
|
+
lines.push(` ${import_picocolors73.default.dim("task")} ${id}`);
|
|
91462
|
+
lines.push(` ${import_picocolors73.default.dim("agent")} ${agentLabel(task.agent_id, names)}`);
|
|
91252
91463
|
if (task.model !== undefined) {
|
|
91253
|
-
const model = task.model?.trim() ? sanitizeLabel(task.model) :
|
|
91254
|
-
lines.push(` ${
|
|
91464
|
+
const model = task.model?.trim() ? sanitizeLabel(task.model) : import_picocolors73.default.dim("agent default");
|
|
91465
|
+
lines.push(` ${import_picocolors73.default.dim("model")} ${model}`);
|
|
91255
91466
|
}
|
|
91256
|
-
lines.push(` ${
|
|
91467
|
+
lines.push(` ${import_picocolors73.default.dim("created")} ${sanitizeLabel(task.created_at)}`);
|
|
91257
91468
|
if (task.parent_task_id) {
|
|
91258
|
-
lines.push(` ${
|
|
91469
|
+
lines.push(` ${import_picocolors73.default.dim("parent")} ${sanitizeLabel(task.parent_task_id)}`);
|
|
91259
91470
|
}
|
|
91260
91471
|
if (task.machine_id) {
|
|
91261
91472
|
const size2 = task.machine_size ? ` (size ${sanitizeLabel(task.machine_size)})` : "";
|
|
91262
|
-
lines.push(` ${
|
|
91473
|
+
lines.push(` ${import_picocolors73.default.dim("machine")} ${sanitizeLabel(task.machine_id)}${size2}`);
|
|
91263
91474
|
}
|
|
91264
91475
|
if (task.sandbox_id)
|
|
91265
|
-
lines.push(` ${
|
|
91476
|
+
lines.push(` ${import_picocolors73.default.dim("sandbox")} ${sanitizeLabel(task.sandbox_id)}`);
|
|
91266
91477
|
const [failure, ...failureRest] = sanitizeLines(failureSummary(task) ?? "").filter((line2) => line2.trim());
|
|
91267
91478
|
if (failure) {
|
|
91268
91479
|
const label3 = " failure ";
|
|
91269
91480
|
lines.push("");
|
|
91270
|
-
lines.push(` ${
|
|
91481
|
+
lines.push(` ${import_picocolors73.default.red("failure")} ${failure}`);
|
|
91271
91482
|
for (const line2 of failureRest)
|
|
91272
91483
|
lines.push(`${" ".repeat(label3.length)}${line2}`);
|
|
91273
91484
|
}
|
|
91274
91485
|
const metadata = Object.entries(task.metadata ?? {});
|
|
91275
91486
|
if (metadata.length > 0) {
|
|
91276
91487
|
lines.push("");
|
|
91277
|
-
lines.push(` ${
|
|
91488
|
+
lines.push(` ${import_picocolors73.default.bold(import_picocolors73.default.dim("METADATA"))}`);
|
|
91278
91489
|
for (const [key2, value3] of metadata) {
|
|
91279
|
-
lines.push(` ${
|
|
91490
|
+
lines.push(` ${import_picocolors73.default.dim(sanitizeLabel(key2))} ${sanitizeLabel(String(value3))}`);
|
|
91280
91491
|
}
|
|
91281
91492
|
}
|
|
91282
91493
|
lines.push("");
|
|
91283
|
-
lines.push(` ${
|
|
91494
|
+
lines.push(` ${import_picocolors73.default.bold(import_picocolors73.default.dim("EVAL VERDICTS"))}`);
|
|
91284
91495
|
if (evals.unavailable) {
|
|
91285
|
-
lines.push(` ${
|
|
91496
|
+
lines.push(` ${import_picocolors73.default.dim(sanitizeLabel(evals.unavailable))}`);
|
|
91286
91497
|
} else if (evals.runs.length === 0) {
|
|
91287
|
-
lines.push(` ${
|
|
91498
|
+
lines.push(` ${import_picocolors73.default.dim("none")}`);
|
|
91288
91499
|
} else {
|
|
91289
91500
|
for (const run of evals.runs) {
|
|
91290
|
-
const verdict = run.passed === true ?
|
|
91501
|
+
const verdict = run.passed === true ? import_picocolors73.default.green("pass") : run.passed === false ? import_picocolors73.default.red("fail") : import_picocolors73.default.dim(sanitizeLabel(run.status));
|
|
91291
91502
|
lines.push(` ${verdict} ${sanitizeLabel(run.eval_slug ?? run.eval_id)}`);
|
|
91292
91503
|
for (const line2 of sanitizeLines(run.reasoning ?? "")) {
|
|
91293
91504
|
if (line2.trim())
|
|
91294
|
-
lines.push(` ${
|
|
91505
|
+
lines.push(` ${import_picocolors73.default.dim(line2)}`);
|
|
91295
91506
|
}
|
|
91296
91507
|
}
|
|
91297
91508
|
}
|
|
91298
91509
|
lines.push("");
|
|
91299
|
-
lines.push(` ${
|
|
91510
|
+
lines.push(` ${import_picocolors73.default.dim("read its transcript with")} ${import_picocolors73.default.cyan(`brainbase task logs ${id}`)}`, "");
|
|
91300
91511
|
return lines.join(`
|
|
91301
91512
|
`);
|
|
91302
91513
|
}
|
|
@@ -91313,7 +91524,7 @@ function failureSummary(task) {
|
|
|
91313
91524
|
}
|
|
91314
91525
|
|
|
91315
91526
|
// src/cli/task-logs.ts
|
|
91316
|
-
var
|
|
91527
|
+
var import_picocolors74 = __toESM(require_picocolors(), 1);
|
|
91317
91528
|
|
|
91318
91529
|
// src/core/task-events.ts
|
|
91319
91530
|
var LEGACY_RETRY_BUDGET_MS = 60000;
|
|
@@ -91894,7 +92105,7 @@ async function runTaskLogs(taskId, options = {}, dependencies = {}) {
|
|
|
91894
92105
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
91895
92106
|
events = error2.collected;
|
|
91896
92107
|
renderTranscript(events, options);
|
|
91897
|
-
console.error(
|
|
92108
|
+
console.error(import_picocolors74.default.dim(error2.message));
|
|
91898
92109
|
setExitCode(error2 instanceof TranscriptPageBudgetExhaustedError ? STREAM_EXHAUSTED_EXIT_CODE : 1);
|
|
91899
92110
|
return;
|
|
91900
92111
|
}
|
|
@@ -91918,14 +92129,14 @@ function renderTranscript(events, options) {
|
|
|
91918
92129
|
console.log(renderEvent(event, messages));
|
|
91919
92130
|
}
|
|
91920
92131
|
if (ordered.length === 0) {
|
|
91921
|
-
console.log(
|
|
92132
|
+
console.log(import_picocolors74.default.dim("No events for this task yet."));
|
|
91922
92133
|
}
|
|
91923
92134
|
}
|
|
91924
92135
|
async function followTranscript(taskId, options, dependencies) {
|
|
91925
92136
|
const backfill = options.limit === undefined ? "" : `?backfill=${options.limit}`;
|
|
91926
92137
|
const { url: url2, resolveBearer } = await masStreamTarget(`/tasks/${encodeURIComponent(taskId)}/events/stream${backfill}`);
|
|
91927
92138
|
if (!options.json) {
|
|
91928
|
-
console.log(
|
|
92139
|
+
console.log(import_picocolors74.default.dim(`Following task ${taskId} — Ctrl-C to stop.`));
|
|
91929
92140
|
}
|
|
91930
92141
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
91931
92142
|
const controller = new AbortController;
|
|
@@ -91970,20 +92181,20 @@ async function followTranscript(taskId, options, dependencies) {
|
|
|
91970
92181
|
} else if (options.json) {
|
|
91971
92182
|
console.log(JSON.stringify(frame));
|
|
91972
92183
|
} else {
|
|
91973
|
-
console.log(
|
|
92184
|
+
console.log(import_picocolors74.default.dim(frame.type));
|
|
91974
92185
|
}
|
|
91975
92186
|
},
|
|
91976
92187
|
onOpen: () => settle.noteFrame(),
|
|
91977
92188
|
onReconnect: (reason) => {
|
|
91978
92189
|
settle.noteDisconnected();
|
|
91979
|
-
console.error(
|
|
92190
|
+
console.error(import_picocolors74.default.dim(`reconnecting — ${reason}`));
|
|
91980
92191
|
}
|
|
91981
92192
|
});
|
|
91982
92193
|
if (interruptCode !== undefined)
|
|
91983
92194
|
setExitCode(interruptCode);
|
|
91984
92195
|
} catch (error2) {
|
|
91985
92196
|
if (error2 instanceof FollowBudgetExhaustedError) {
|
|
91986
|
-
console.error(
|
|
92197
|
+
console.error(import_picocolors74.default.red(error2.message));
|
|
91987
92198
|
setExitCode(STREAM_EXHAUSTED_EXIT_CODE);
|
|
91988
92199
|
return;
|
|
91989
92200
|
}
|
|
@@ -92344,6 +92555,7 @@ async function runTaskSend(taskId, message3, options = {}) {
|
|
|
92344
92555
|
} finally {
|
|
92345
92556
|
stopWatching();
|
|
92346
92557
|
}
|
|
92558
|
+
warnModelNotice(taskId, result2);
|
|
92347
92559
|
if (options.json) {
|
|
92348
92560
|
console.log(JSON.stringify({ ...result2, expected_generation: expectedGeneration }, null, 2));
|
|
92349
92561
|
} else {
|
|
@@ -92770,78 +92982,80 @@ ${didYouMean(sub, ["create", "list", "get", "logs", "send", "stop", "update", "d
|
|
|
92770
92982
|
function printHelp5() {
|
|
92771
92983
|
const out = [];
|
|
92772
92984
|
out.push("");
|
|
92773
|
-
out.push(` ${
|
|
92985
|
+
out.push(` ${import_picocolors75.default.bold("brainbase task")} ${import_picocolors75.default.dim("<sub> [options]")}`);
|
|
92774
92986
|
out.push("");
|
|
92775
|
-
out.push(` ${
|
|
92776
|
-
out.push(` ${
|
|
92777
|
-
out.push(` ${
|
|
92778
|
-
out.push(` ${
|
|
92779
|
-
out.push(` ${
|
|
92780
|
-
out.push(` ${
|
|
92781
|
-
out.push(` ${
|
|
92782
|
-
out.push(` ${
|
|
92987
|
+
out.push(` ${import_picocolors75.default.cyan("create")} ${import_picocolors75.default.dim("--message <text>")} ${import_picocolors75.default.dim("create a task and start its first run")}`);
|
|
92988
|
+
out.push(` ${import_picocolors75.default.cyan("list | ls")} ${import_picocolors75.default.dim("recent tasks you can reach (--json for scripts)")}`);
|
|
92989
|
+
out.push(` ${import_picocolors75.default.cyan("get")} ${import_picocolors75.default.dim("<task-id>")} ${import_picocolors75.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
92990
|
+
out.push(` ${import_picocolors75.default.cyan("logs")} ${import_picocolors75.default.dim("<task-id> [--follow]")} ${import_picocolors75.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
92991
|
+
out.push(` ${import_picocolors75.default.cyan("send")} ${import_picocolors75.default.dim("<task-id> <message>")} ${import_picocolors75.default.dim("send a follow-up, including while the agent is running")}`);
|
|
92992
|
+
out.push(` ${import_picocolors75.default.cyan("stop")} ${import_picocolors75.default.dim("<task-id>")} ${import_picocolors75.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
92993
|
+
out.push(` ${import_picocolors75.default.cyan("update")} ${import_picocolors75.default.dim("<task-id>")} ${import_picocolors75.default.dim("rename a task, change its metadata labels, switch its model or reset it to the agent default, including while it runs")}`);
|
|
92994
|
+
out.push(` ${import_picocolors75.default.cyan("delete")} ${import_picocolors75.default.dim("<task-id>")} ${import_picocolors75.default.dim("permanently delete a stopped task and tear down its sandbox (--yes to skip the prompt)")}`);
|
|
92783
92995
|
out.push("");
|
|
92784
|
-
out.push(` ${
|
|
92785
|
-
out.push(` ${
|
|
92786
|
-
out.push(` ${
|
|
92787
|
-
out.push(` ${
|
|
92788
|
-
out.push(` ${
|
|
92789
|
-
out.push(` ${
|
|
92790
|
-
out.push(` ${
|
|
92791
|
-
out.push(` ${
|
|
92792
|
-
out.push(` ${
|
|
92793
|
-
out.push(` ${
|
|
92996
|
+
out.push(` ${import_picocolors75.default.bold("create flags")}`);
|
|
92997
|
+
out.push(` ${import_picocolors75.default.dim("--message <text>")} required first user message`);
|
|
92998
|
+
out.push(` ${import_picocolors75.default.dim("--agent <id>")} override the claimed agent in brainbase.agent.yaml`);
|
|
92999
|
+
out.push(` ${import_picocolors75.default.dim("--interface <id>")} open it as a build conversation for this interface (agent defaults to the interface's)`);
|
|
93000
|
+
out.push(` ${import_picocolors75.default.dim("--title <text>")} optional task title`);
|
|
93001
|
+
out.push(` ${import_picocolors75.default.dim("--model <id>")} optional model override`);
|
|
93002
|
+
out.push(` ${import_picocolors75.default.dim("--version <v>")} run a saved version of the agent: 12, v12 or a version id (\`agent versions list\`)`);
|
|
93003
|
+
out.push(` ${import_picocolors75.default.dim("--metadata key=value")} label the task (repeatable)`);
|
|
93004
|
+
out.push(` ${import_picocolors75.default.dim("--wait")} block until the task finishes; exit 1 unless it succeeded`);
|
|
93005
|
+
out.push(` ${import_picocolors75.default.dim("--timeout <secs>")} give up waiting after <secs> and exit 1 (needs --wait)`);
|
|
92794
93006
|
out.push("");
|
|
92795
|
-
out.push(` ${
|
|
92796
|
-
out.push(` ${
|
|
92797
|
-
out.push(` ${
|
|
92798
|
-
out.push(` ${
|
|
92799
|
-
out.push(` ${
|
|
93007
|
+
out.push(` ${import_picocolors75.default.bold("list flags")}`);
|
|
93008
|
+
out.push(` ${import_picocolors75.default.dim("--agent <id>")} only this agent's tasks`);
|
|
93009
|
+
out.push(` ${import_picocolors75.default.dim("--interface <id>")} only this interface's build conversations (hidden from a plain list)`);
|
|
93010
|
+
out.push(` ${import_picocolors75.default.dim("--metadata key=value")} only tasks carrying this label (repeatable; all must match)`);
|
|
93011
|
+
out.push(` ${import_picocolors75.default.dim("--limit <n>")} cap the page (1-200, server default 50)`);
|
|
92800
93012
|
out.push("");
|
|
92801
|
-
out.push(` ${
|
|
92802
|
-
out.push(` ${
|
|
92803
|
-
out.push(` ${
|
|
93013
|
+
out.push(` ${import_picocolors75.default.bold("logs flags")}`);
|
|
93014
|
+
out.push(` ${import_picocolors75.default.dim("--limit <n>")} stop after <n> events instead of the whole transcript; with --follow, the first page size`);
|
|
93015
|
+
out.push(` ${import_picocolors75.default.dim("--follow, -f")} stay attached and print events as they land, until the task finishes and any queued follow-ups have run`);
|
|
92804
93016
|
out.push("");
|
|
92805
|
-
out.push(` ${
|
|
92806
|
-
out.push(` ${
|
|
92807
|
-
out.push(` ${
|
|
92808
|
-
out.push(` ${
|
|
92809
|
-
out.push(` ${
|
|
92810
|
-
out.push(` ${
|
|
92811
|
-
out.push(` ${
|
|
92812
|
-
out.push(` ${
|
|
92813
|
-
out.push(` ${
|
|
93017
|
+
out.push(` ${import_picocolors75.default.bold("update flags")}`);
|
|
93018
|
+
out.push(` ${import_picocolors75.default.dim("--title <text>")} new title`);
|
|
93019
|
+
out.push(` ${import_picocolors75.default.dim("--clear-title")} remove the title; automatic titling may name the task again on a later turn`);
|
|
93020
|
+
out.push(` ${import_picocolors75.default.dim("--metadata key=value")} set one label, keeping the others (repeatable)`);
|
|
93021
|
+
out.push(` ${import_picocolors75.default.dim("--unset-metadata <key>")} remove one label (repeatable)`);
|
|
93022
|
+
out.push(` ${import_picocolors75.default.dim(" the server applies label edits in one step, so concurrent edits from other clients are kept")}`);
|
|
93023
|
+
out.push(` ${import_picocolors75.default.dim("--clear-metadata")} remove every label; with --metadata, the labels become exactly those given`);
|
|
93024
|
+
out.push(` ${import_picocolors75.default.dim("--model <id>")} switch the model the task's next turn runs on (the running turn keeps its model)`);
|
|
93025
|
+
out.push(` ${import_picocolors75.default.dim("--clear-model")} go back to the agent's default model from the next turn`);
|
|
93026
|
+
out.push(` ${import_picocolors75.default.dim(" when a task's picked model has been retired, create, send and get print a warning on stderr until one of these two decides")}`);
|
|
92814
93027
|
out.push("");
|
|
92815
|
-
out.push(` ${
|
|
92816
|
-
out.push(` ${
|
|
92817
|
-
out.push(` ${
|
|
92818
|
-
out.push(` ${
|
|
93028
|
+
out.push(` ${import_picocolors75.default.bold("send flags")}`);
|
|
93029
|
+
out.push(` ${import_picocolors75.default.dim("--input-id <uuid>")} recover the same request using its original ID and identical message`);
|
|
93030
|
+
out.push(` ${import_picocolors75.default.dim(" omit it to send a new follow-up; an unconfirmed receipt is never automatically replayed")}`);
|
|
93031
|
+
out.push(` ${import_picocolors75.default.dim(" admission disabled/recovery unavailable means no input was admitted; retry the same ID after recovery")}`);
|
|
92819
93032
|
out.push("");
|
|
92820
|
-
out.push(` ${
|
|
92821
|
-
out.push(` ${
|
|
92822
|
-
out.push(` ${
|
|
93033
|
+
out.push(` ${import_picocolors75.default.bold("send and stop flags")}`);
|
|
93034
|
+
out.push(` ${import_picocolors75.default.dim("--generation <n>")} retain the printed generation when retrying; defaults to a fresh snapshot for a new operation`);
|
|
93035
|
+
out.push(` ${import_picocolors75.default.dim(" Stop errors may follow queued-input cancellation; retry the printed command to avoid stopping newer work")}`);
|
|
92823
93036
|
out.push("");
|
|
92824
|
-
out.push(` ${
|
|
92825
|
-
out.push(` ${
|
|
92826
|
-
out.push(` ${
|
|
92827
|
-
out.push(` ${
|
|
93037
|
+
out.push(` ${import_picocolors75.default.bold("every subcommand")}`);
|
|
93038
|
+
out.push(` ${import_picocolors75.default.dim("--json")} machine-readable output — create prints task_id, agent_id and status (with --version, also agent_version_id and version_number); list, get, logs, send, stop and update print the raw records; delete prints id and deleted`);
|
|
93039
|
+
out.push(` ${import_picocolors75.default.dim(" send and stop include expected_generation for safe retries; send also reports idempotency_replayed when present")}`);
|
|
93040
|
+
out.push(` ${import_picocolors75.default.dim(" logs --follow --json prints one record per line, since a live stream has no end to close on")}`);
|
|
93041
|
+
out.push(` ${import_picocolors75.default.dim(" create, send and get carry model_notice when the task's picked model has been retired; the warning itself goes to stderr")}`);
|
|
92828
93042
|
out.push("");
|
|
92829
|
-
out.push(` ${
|
|
92830
|
-
out.push(` ${
|
|
92831
|
-
out.push(` ${
|
|
92832
|
-
out.push(` ${
|
|
93043
|
+
out.push(` ${import_picocolors75.default.dim("Exit codes with --wait:")} ${import_picocolors75.default.dim("0 succeeded · 1 failed, needs input, or timed out · 130 interrupted")}`);
|
|
93044
|
+
out.push(` ${import_picocolors75.default.dim("Exit codes with --follow:")} ${import_picocolors75.default.dim("0 task reached a terminal state · 1 stream refused, or unreachable for 60s · 130 interrupted (Ctrl-C) · 143 terminated")}`);
|
|
93045
|
+
out.push(` ${import_picocolors75.default.dim("Exit codes with send:")} ${import_picocolors75.default.dim("0 queued, dispatching, submitted or completed · 1 unconfirmed, cancelled, failed or request error")}`);
|
|
93046
|
+
out.push(` ${import_picocolors75.default.dim("Ctrl-C while waiting or following logs detaches; use task stop to cancel remote work.")}`);
|
|
92833
93047
|
out.push("");
|
|
92834
|
-
out.push(` ${
|
|
93048
|
+
out.push(` ${import_picocolors75.default.dim("Flag-like values:")} use ${import_picocolors75.default.cyan("--flag=value")} or ${import_picocolors75.default.cyan("--flag -- <value>")}`);
|
|
92835
93049
|
out.push("");
|
|
92836
93050
|
console.log(out.join(`
|
|
92837
93051
|
`));
|
|
92838
93052
|
}
|
|
92839
93053
|
|
|
92840
93054
|
// src/cli/machine.ts
|
|
92841
|
-
var
|
|
93055
|
+
var import_picocolors78 = __toESM(require_picocolors(), 1);
|
|
92842
93056
|
|
|
92843
93057
|
// src/cli/machine-list.ts
|
|
92844
|
-
var
|
|
93058
|
+
var import_picocolors76 = __toESM(require_picocolors(), 1);
|
|
92845
93059
|
async function runMachineList(args = {}) {
|
|
92846
93060
|
if (!args.json)
|
|
92847
93061
|
banner("machine list — sandboxes you can reach");
|
|
@@ -92859,7 +93073,7 @@ async function runMachineList(args = {}) {
|
|
|
92859
93073
|
function formatMachineList(machines, includedDead, names = new Map) {
|
|
92860
93074
|
const lines = [""];
|
|
92861
93075
|
if (machines.length === 0) {
|
|
92862
|
-
lines.push(` ${
|
|
93076
|
+
lines.push(` ${import_picocolors76.default.dim(includedDead ? "No machines." : "No live machines. Pass --all to include torn-down ones.")}`, "");
|
|
92863
93077
|
return lines.join(`
|
|
92864
93078
|
`);
|
|
92865
93079
|
}
|
|
@@ -92879,7 +93093,7 @@ function formatMachineList(machines, includedDead, names = new Map) {
|
|
|
92879
93093
|
const statusWidth = width((row) => row.status);
|
|
92880
93094
|
const sizeWidth = width((row) => row.size);
|
|
92881
93095
|
const agentWidth = width((row) => row.agent);
|
|
92882
|
-
lines.push(` ${
|
|
93096
|
+
lines.push(` ${import_picocolors76.default.dim([
|
|
92883
93097
|
header.id.padEnd(idWidth),
|
|
92884
93098
|
header.kind.padEnd(kindWidth),
|
|
92885
93099
|
header.status.padEnd(statusWidth),
|
|
@@ -92895,21 +93109,21 @@ function formatMachineList(machines, includedDead, names = new Map) {
|
|
|
92895
93109
|
row.dead ? status : statusTint(row.status, status),
|
|
92896
93110
|
row.size.padEnd(sizeWidth),
|
|
92897
93111
|
row.agent.padEnd(agentWidth),
|
|
92898
|
-
|
|
93112
|
+
import_picocolors76.default.dim(row.age)
|
|
92899
93113
|
].join(" ");
|
|
92900
|
-
lines.push(` ${row.dead ?
|
|
93114
|
+
lines.push(` ${row.dead ? import_picocolors76.default.dim(cells) : cells}`);
|
|
92901
93115
|
}
|
|
92902
|
-
lines.push("", ` ${
|
|
93116
|
+
lines.push("", ` ${import_picocolors76.default.dim("tear one down with")} ${import_picocolors76.default.cyan("brainbase machine rm <id>")}`, "");
|
|
92903
93117
|
return lines.join(`
|
|
92904
93118
|
`);
|
|
92905
93119
|
}
|
|
92906
93120
|
function statusTint(status, padded) {
|
|
92907
93121
|
switch (status) {
|
|
92908
93122
|
case "running":
|
|
92909
|
-
return
|
|
93123
|
+
return import_picocolors76.default.green(padded);
|
|
92910
93124
|
case "stopped":
|
|
92911
93125
|
case "starting":
|
|
92912
|
-
return
|
|
93126
|
+
return import_picocolors76.default.yellow(padded);
|
|
92913
93127
|
default:
|
|
92914
93128
|
return padded;
|
|
92915
93129
|
}
|
|
@@ -92932,7 +93146,7 @@ function age(createdAt) {
|
|
|
92932
93146
|
}
|
|
92933
93147
|
|
|
92934
93148
|
// src/cli/machine-rm.ts
|
|
92935
|
-
var
|
|
93149
|
+
var import_picocolors77 = __toESM(require_picocolors(), 1);
|
|
92936
93150
|
async function runMachineRm(args, dependencies = {}) {
|
|
92937
93151
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
92938
93152
|
const machineId = args.machineId?.trim();
|
|
@@ -92946,7 +93160,7 @@ async function runMachineRm(args, dependencies = {}) {
|
|
|
92946
93160
|
if (args.json) {
|
|
92947
93161
|
console.log(JSON.stringify({ id: machineId, torn_down: false, outcome: "declined" }, null, 2));
|
|
92948
93162
|
} else {
|
|
92949
|
-
console.log(` ${
|
|
93163
|
+
console.log(` ${import_picocolors77.default.dim("Left alone.")}`);
|
|
92950
93164
|
}
|
|
92951
93165
|
return;
|
|
92952
93166
|
}
|
|
@@ -92964,7 +93178,7 @@ async function promptForTeardown(args) {
|
|
|
92964
93178
|
return true;
|
|
92965
93179
|
if (!args.json) {
|
|
92966
93180
|
console.log(`
|
|
92967
|
-
${
|
|
93181
|
+
${import_picocolors77.default.red("This destroys the sandbox.")} ${import_picocolors77.default.dim("Anything not committed out of it is lost. The machine row is kept for cost history.")}
|
|
92968
93182
|
`);
|
|
92969
93183
|
}
|
|
92970
93184
|
const answer = await se({
|
|
@@ -92976,9 +93190,9 @@ async function promptForTeardown(args) {
|
|
|
92976
93190
|
function formatMachineRm(machine) {
|
|
92977
93191
|
const lines = [""];
|
|
92978
93192
|
if (machine.destroyed_at) {
|
|
92979
|
-
lines.push(` ${
|
|
93193
|
+
lines.push(` ${import_picocolors77.default.green("✓")} ${machine.kind} sandbox ${machine.id} is torn down.`, ` ${import_picocolors77.default.dim(`destroyed_at ${machine.destroyed_at}`)}`);
|
|
92980
93194
|
} else {
|
|
92981
|
-
lines.push(` ${
|
|
93195
|
+
lines.push(` ${import_picocolors77.default.yellow("!")} ${machine.id} came back without a teardown timestamp (status ${machine.status}).`, ` ${import_picocolors77.default.dim("Re-check with `brainbase machine ls --all` before assuming it stopped billing.")}`);
|
|
92982
93196
|
}
|
|
92983
93197
|
lines.push("");
|
|
92984
93198
|
return lines.join(`
|
|
@@ -93019,25 +93233,25 @@ ${didYouMean(sub, ["ls", "rm"], "brainbase machine")}`);
|
|
|
93019
93233
|
function printHelp6() {
|
|
93020
93234
|
const out = [];
|
|
93021
93235
|
out.push("");
|
|
93022
|
-
out.push(` ${
|
|
93236
|
+
out.push(` ${import_picocolors78.default.bold("brainbase machine")} ${import_picocolors78.default.dim("<sub> [options]")}`);
|
|
93023
93237
|
out.push("");
|
|
93024
|
-
out.push(` ${
|
|
93025
|
-
out.push(` ${
|
|
93238
|
+
out.push(` ${import_picocolors78.default.cyan("ls")} ${import_picocolors78.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
93239
|
+
out.push(` ${import_picocolors78.default.cyan("rm")} ${import_picocolors78.default.dim("<id>")} ${import_picocolors78.default.dim("tear a sandbox down (terminal; the row is kept for cost history)")}`);
|
|
93026
93240
|
out.push("");
|
|
93027
|
-
out.push(` ${
|
|
93028
|
-
out.push(` ${
|
|
93029
|
-
out.push(` ${
|
|
93030
|
-
out.push(` ${
|
|
93241
|
+
out.push(` ${import_picocolors78.default.dim("--all")} ${import_picocolors78.default.dim("for ls: include machines already torn down")}`);
|
|
93242
|
+
out.push(` ${import_picocolors78.default.dim("--limit <n>")} ${import_picocolors78.default.dim("for ls: how many to fetch (1-200, default 50)")}`);
|
|
93243
|
+
out.push(` ${import_picocolors78.default.dim("--yes, -y")} ${import_picocolors78.default.dim("for rm: skip the confirmation")}`);
|
|
93244
|
+
out.push(` ${import_picocolors78.default.dim("--json")} ${import_picocolors78.default.dim("machine-readable output")}`);
|
|
93031
93245
|
out.push("");
|
|
93032
93246
|
console.log(out.join(`
|
|
93033
93247
|
`));
|
|
93034
93248
|
}
|
|
93035
93249
|
|
|
93036
93250
|
// src/cli/interface.ts
|
|
93037
|
-
var
|
|
93251
|
+
var import_picocolors84 = __toESM(require_picocolors(), 1);
|
|
93038
93252
|
|
|
93039
93253
|
// src/cli/interface-build.ts
|
|
93040
|
-
var
|
|
93254
|
+
var import_picocolors79 = __toESM(require_picocolors(), 1);
|
|
93041
93255
|
var USAGE2 = 'brainbase interface build <id> "<request>" [--timeout <seconds>] [--idempotency-key <key>] [--json]';
|
|
93042
93256
|
var SETTLE_TIMEOUT_MS = 120000;
|
|
93043
93257
|
async function reportingErrors(json4, work) {
|
|
@@ -93136,28 +93350,28 @@ function buildExitCode(outcome) {
|
|
|
93136
93350
|
function reportBuild(say, interfaceId, outcome, timeoutSeconds) {
|
|
93137
93351
|
switch (outcome.kind) {
|
|
93138
93352
|
case "built":
|
|
93139
|
-
say(` ${
|
|
93353
|
+
say(` ${import_picocolors79.default.dim("build")} ${safe(outcome.build.id)} ${import_picocolors79.default.green("succeeded")}`);
|
|
93140
93354
|
say("");
|
|
93141
|
-
say(` ${
|
|
93355
|
+
say(` ${import_picocolors79.default.dim("Next:")} ${import_picocolors79.default.cyan(`brainbase interface publish ${safe(interfaceId)}`)}`);
|
|
93142
93356
|
return;
|
|
93143
93357
|
case "failed": {
|
|
93144
93358
|
const reason = outcome.build?.error_summary ?? outcome.operation?.error ?? outcome.operation?.reason ?? null;
|
|
93145
|
-
say(` ${
|
|
93359
|
+
say(` ${import_picocolors79.default.dim("build")} ${outcome.build ? safe(outcome.build.id) : import_picocolors79.default.dim("none")} ${import_picocolors79.default.red("failed")}`);
|
|
93146
93360
|
if (reason)
|
|
93147
93361
|
say(` ${safeBlock(reason).split(`
|
|
93148
93362
|
`).join(`
|
|
93149
93363
|
`)}`);
|
|
93150
|
-
say(` ${
|
|
93364
|
+
say(` ${import_picocolors79.default.dim("Try again with")} ${import_picocolors79.default.cyan(`brainbase interface rebuild ${safe(interfaceId)}`)}`);
|
|
93151
93365
|
return;
|
|
93152
93366
|
}
|
|
93153
93367
|
case "busy":
|
|
93154
|
-
say(` ${
|
|
93368
|
+
say(` ${import_picocolors79.default.yellow(safe(outcome.message))}`);
|
|
93155
93369
|
return;
|
|
93156
93370
|
case "timeout":
|
|
93157
|
-
say(` ${
|
|
93371
|
+
say(` ${import_picocolors79.default.yellow(`Still building after ${timeoutSeconds}s.`)} ${import_picocolors79.default.dim(`It keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
93158
93372
|
return;
|
|
93159
93373
|
case "interrupted":
|
|
93160
|
-
say(` ${
|
|
93374
|
+
say(` ${import_picocolors79.default.yellow("Stopped waiting.")} ${import_picocolors79.default.dim(`The build keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
93161
93375
|
return;
|
|
93162
93376
|
default: {
|
|
93163
93377
|
const unreachable = outcome;
|
|
@@ -93204,8 +93418,8 @@ async function build(ctx) {
|
|
|
93204
93418
|
throw held;
|
|
93205
93419
|
}
|
|
93206
93420
|
const reattach = `brainbase task logs ${safe(taskId)} --follow`;
|
|
93207
|
-
say(` ${
|
|
93208
|
-
say(` ${
|
|
93421
|
+
say(` ${import_picocolors79.default.dim("Build conversation")} ${import_picocolors79.default.bold(safe(taskId))} ${import_picocolors79.default.dim(`on ${safe(before2.name)}`)}`);
|
|
93422
|
+
say(` ${import_picocolors79.default.dim(`If this stops early, reattach with \`${reattach}\`.`)}`);
|
|
93209
93423
|
const finish = (result2, exitCode) => {
|
|
93210
93424
|
if (json4)
|
|
93211
93425
|
console.log(JSON.stringify({ type: "result", task_id: taskId, ...result2 }));
|
|
@@ -93222,13 +93436,13 @@ async function build(ctx) {
|
|
|
93222
93436
|
});
|
|
93223
93437
|
} catch (error2) {
|
|
93224
93438
|
say("");
|
|
93225
|
-
say(` ${
|
|
93226
|
-
say(` ${
|
|
93439
|
+
say(` ${import_picocolors79.default.red(`Lost the conversation's event stream: ${safe(error2.message)}`)}`);
|
|
93440
|
+
say(` ${import_picocolors79.default.dim(`Conversation ${safe(taskId)} may still be running. Reattach with`)} ${import_picocolors79.default.cyan(reattach)}`);
|
|
93227
93441
|
finish({ version_id: null, build_id: null, status: "stream_lost", task_status: null }, 1);
|
|
93228
93442
|
return;
|
|
93229
93443
|
}
|
|
93230
93444
|
if (followExit !== undefined) {
|
|
93231
|
-
say(` ${
|
|
93445
|
+
say(` ${import_picocolors79.default.yellow("Stopped following.")} ${import_picocolors79.default.dim(`The conversation keeps running. Reattach with \`${reattach}\`.`)}`);
|
|
93232
93446
|
finish({ version_id: null, build_id: null, status: "interrupted", task_status: null }, followExit);
|
|
93233
93447
|
return;
|
|
93234
93448
|
}
|
|
@@ -93248,7 +93462,7 @@ async function build(ctx) {
|
|
|
93248
93462
|
if (settled.kind !== "terminal") {
|
|
93249
93463
|
const interrupted = settled.kind === "interrupted";
|
|
93250
93464
|
const status2 = settled.task?.status ?? null;
|
|
93251
|
-
say(` ${
|
|
93465
|
+
say(` ${import_picocolors79.default.yellow(interrupted ? "Stopped." : `The conversation is still ${safe(status2 ?? "running")}.`)} ${import_picocolors79.default.dim(`Check it with \`brainbase task get ${safe(taskId)}\`.`)}`);
|
|
93252
93466
|
finish({ version_id: null, build_id: null, status: interrupted ? "interrupted" : "task_unsettled", task_status: status2 }, interrupted ? SIGINT_EXIT_CODE : 1);
|
|
93253
93467
|
return;
|
|
93254
93468
|
}
|
|
@@ -93268,36 +93482,36 @@ async function build(ctx) {
|
|
|
93268
93482
|
}
|
|
93269
93483
|
const codes = [exitCodeForTaskStatus(task.status)];
|
|
93270
93484
|
say("");
|
|
93271
|
-
say(` ${
|
|
93485
|
+
say(` ${import_picocolors79.default.dim("conversation")} ${safe(taskId)} ${import_picocolors79.default.dim("ended")} ${safe(task.status)}`);
|
|
93272
93486
|
if (mine?.status === "failed") {
|
|
93273
93487
|
codes.push(1);
|
|
93274
93488
|
const why = [mine.reason, mine.error].filter(Boolean).map((part) => safe(part)).join(": ");
|
|
93275
|
-
say(` ${
|
|
93489
|
+
say(` ${import_picocolors79.default.red(`This conversation's build work failed${why ? ` (${why})` : ""}.`)}`);
|
|
93276
93490
|
} else if (task.status !== "success" && task.status !== "need_more_info") {
|
|
93277
|
-
say(` ${
|
|
93491
|
+
say(` ${import_picocolors79.default.red(`The conversation finished as ${safe(task.status)}.`)} ${import_picocolors79.default.dim(`See \`brainbase task logs ${safe(taskId)}\`.`)}`);
|
|
93278
93492
|
}
|
|
93279
93493
|
if (task.status === "need_more_info") {
|
|
93280
93494
|
const question = await lastAgentMessage(taskId);
|
|
93281
93495
|
say("");
|
|
93282
93496
|
if (question) {
|
|
93283
|
-
say(` ${
|
|
93497
|
+
say(` ${import_picocolors79.default.bold("The agent asks:")}`);
|
|
93284
93498
|
say(` ${safeBlock(question).split(`
|
|
93285
93499
|
`).join(`
|
|
93286
93500
|
`)}`);
|
|
93287
93501
|
} else {
|
|
93288
|
-
say(` ${
|
|
93502
|
+
say(` ${import_picocolors79.default.bold("The agent needs more from you before it can go on.")}`);
|
|
93289
93503
|
}
|
|
93290
93504
|
say("");
|
|
93291
|
-
say(` ${
|
|
93292
|
-
say(` ${
|
|
93505
|
+
say(` ${import_picocolors79.default.dim("Reply with")} ${import_picocolors79.default.cyan(`brainbase task send ${safe(taskId)} "<reply>"`)}`);
|
|
93506
|
+
say(` ${import_picocolors79.default.dim("then follow it with")} ${import_picocolors79.default.cyan(reattach)}`);
|
|
93293
93507
|
}
|
|
93294
93508
|
let status;
|
|
93295
93509
|
let buildId = null;
|
|
93296
93510
|
if (versionId) {
|
|
93297
93511
|
say("");
|
|
93298
|
-
say(` ${
|
|
93512
|
+
say(` ${import_picocolors79.default.dim("version")} ${safe(versionId)}`);
|
|
93299
93513
|
if (!json4)
|
|
93300
|
-
say(` ${
|
|
93514
|
+
say(` ${import_picocolors79.default.dim("Waiting for its build...")}`);
|
|
93301
93515
|
const buildKey = `${key2}-build`;
|
|
93302
93516
|
let outcome;
|
|
93303
93517
|
try {
|
|
@@ -93307,7 +93521,7 @@ async function build(ctx) {
|
|
|
93307
93521
|
signal: stop.signal,
|
|
93308
93522
|
now: deps.now,
|
|
93309
93523
|
idempotencyKey: buildKey,
|
|
93310
|
-
onStall: () => say(` ${
|
|
93524
|
+
onStall: () => say(` ${import_picocolors79.default.yellow("The build looks stalled; still waiting in case another worker picks it up.")}`)
|
|
93311
93525
|
});
|
|
93312
93526
|
} catch (error2) {
|
|
93313
93527
|
if (error2 instanceof LostResponseError) {
|
|
@@ -93323,9 +93537,9 @@ async function build(ctx) {
|
|
|
93323
93537
|
status = noVersionStatus(mine?.status === "failed", task.status);
|
|
93324
93538
|
if (status === "no_version") {
|
|
93325
93539
|
codes.push(1);
|
|
93326
|
-
say(` ${
|
|
93540
|
+
say(` ${import_picocolors79.default.red("The conversation finished without committing a version, so there is nothing to build.")}`);
|
|
93327
93541
|
} else if (task.status !== "need_more_info") {
|
|
93328
|
-
say(` ${
|
|
93542
|
+
say(` ${import_picocolors79.default.dim("This conversation produced no version, so there is nothing to build.")}`);
|
|
93329
93543
|
}
|
|
93330
93544
|
}
|
|
93331
93545
|
if (!json4)
|
|
@@ -93340,7 +93554,7 @@ async function build(ctx) {
|
|
|
93340
93554
|
var buildCommands = { build };
|
|
93341
93555
|
|
|
93342
93556
|
// src/cli/interface-lifecycle.ts
|
|
93343
|
-
var
|
|
93557
|
+
var import_picocolors81 = __toESM(require_picocolors(), 1);
|
|
93344
93558
|
|
|
93345
93559
|
// src/core/org-members.ts
|
|
93346
93560
|
async function listAllOrgMembers(orgId) {
|
|
@@ -93394,7 +93608,7 @@ function membersById(members) {
|
|
|
93394
93608
|
}
|
|
93395
93609
|
|
|
93396
93610
|
// src/cli/interface-read.ts
|
|
93397
|
-
var
|
|
93611
|
+
var import_picocolors80 = __toESM(require_picocolors(), 1);
|
|
93398
93612
|
function interfaceState(row) {
|
|
93399
93613
|
if (row.archived_at)
|
|
93400
93614
|
return "archived";
|
|
@@ -93416,11 +93630,11 @@ function threadsLabel(shared) {
|
|
|
93416
93630
|
function stateTint(state) {
|
|
93417
93631
|
switch (state) {
|
|
93418
93632
|
case "live":
|
|
93419
|
-
return
|
|
93633
|
+
return import_picocolors80.default.green;
|
|
93420
93634
|
case "building":
|
|
93421
|
-
return
|
|
93635
|
+
return import_picocolors80.default.yellow;
|
|
93422
93636
|
case "archived":
|
|
93423
|
-
return
|
|
93637
|
+
return import_picocolors80.default.dim;
|
|
93424
93638
|
case "draft":
|
|
93425
93639
|
return (cell) => cell;
|
|
93426
93640
|
default: {
|
|
@@ -93453,7 +93667,7 @@ async function list3(ctx) {
|
|
|
93453
93667
|
if (shown.length === 0) {
|
|
93454
93668
|
const empty = onlyArchived ? "No archived interfaces." : includeArchived ? "No interfaces. Create one with `brainbase interface create`." : await emptyWithoutArchived(agentId);
|
|
93455
93669
|
console.log(`
|
|
93456
|
-
${
|
|
93670
|
+
${import_picocolors80.default.dim(empty)}
|
|
93457
93671
|
`);
|
|
93458
93672
|
return;
|
|
93459
93673
|
}
|
|
@@ -93466,7 +93680,7 @@ async function list3(ctx) {
|
|
|
93466
93680
|
audienceWord(row),
|
|
93467
93681
|
ago(row.last_edited_at ?? row.created_at, now2)
|
|
93468
93682
|
]);
|
|
93469
|
-
console.log(["", ...table(cells, [null,
|
|
93683
|
+
console.log(["", ...table(cells, [null, import_picocolors80.default.bold, null, null, null, import_picocolors80.default.dim]), ""].join(`
|
|
93470
93684
|
`));
|
|
93471
93685
|
});
|
|
93472
93686
|
}
|
|
@@ -93497,19 +93711,19 @@ async function get2(ctx) {
|
|
|
93497
93711
|
banner(`interface — ${safe(row.name)}`);
|
|
93498
93712
|
const state = interfaceState(row);
|
|
93499
93713
|
const out = [""];
|
|
93500
|
-
out.push(
|
|
93501
|
-
out.push(
|
|
93502
|
-
out.push(
|
|
93503
|
-
out.push(
|
|
93504
|
-
out.push(
|
|
93505
|
-
out.push(
|
|
93506
|
-
out.push(
|
|
93507
|
-
out.push(
|
|
93714
|
+
out.push(field2("id", safe(row.id)));
|
|
93715
|
+
out.push(field2("agent", agentLabel(safe(row.agent_id), await agentNames([row.agent_id]))));
|
|
93716
|
+
out.push(field2("state", stateTint(state)(state)));
|
|
93717
|
+
out.push(field2("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${import_picocolors80.default.dim("(nothing live yet)")}`));
|
|
93718
|
+
out.push(field2("audience", audienceLabel(row)));
|
|
93719
|
+
out.push(field2("threads", threadsLabel(row.share_agent_threads)));
|
|
93720
|
+
out.push(field2("live", row.live_release ? `${safe(row.live_release.id)} ${import_picocolors80.default.dim(`published ${ago(row.live_release.published_at)}`)}` : import_picocolors80.default.dim("none")));
|
|
93721
|
+
out.push(field2("draft", row.draft_version_id ? safe(row.draft_version_id) : import_picocolors80.default.dim("none yet")));
|
|
93508
93722
|
if (row.running_generation) {
|
|
93509
|
-
out.push(
|
|
93723
|
+
out.push(field2("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${import_picocolors80.default.dim(`(follow it with \`brainbase task logs ${safe(row.running_generation.thread_id ?? "")} --follow\`)`)}`));
|
|
93510
93724
|
}
|
|
93511
93725
|
if (row.archived_at)
|
|
93512
|
-
out.push(
|
|
93726
|
+
out.push(field2("archived", ago(row.archived_at)));
|
|
93513
93727
|
out.push("");
|
|
93514
93728
|
console.log(out.join(`
|
|
93515
93729
|
`));
|
|
@@ -93535,7 +93749,7 @@ async function open(ctx) {
|
|
|
93535
93749
|
}
|
|
93536
93750
|
console.log(safe(url2));
|
|
93537
93751
|
if (new URL(url2).hostname.endsWith("vercel.app")) {
|
|
93538
|
-
console.error(
|
|
93752
|
+
console.error(import_picocolors80.default.yellow("This is the raw Vercel deployment address, which sits behind Vercel protection and will not open for viewers. The control plane has no public interfaces domain configured."));
|
|
93539
93753
|
}
|
|
93540
93754
|
});
|
|
93541
93755
|
}
|
|
@@ -93573,7 +93787,7 @@ async function history(ctx, name) {
|
|
|
93573
93787
|
banner(`interface ${name} — ${safe(id)}`);
|
|
93574
93788
|
if (rows.length === 0) {
|
|
93575
93789
|
console.log(`
|
|
93576
|
-
${
|
|
93790
|
+
${import_picocolors80.default.dim(`No ${name} yet.`)}
|
|
93577
93791
|
`);
|
|
93578
93792
|
return;
|
|
93579
93793
|
}
|
|
@@ -93650,14 +93864,14 @@ function exactlyOne(parsed, flags) {
|
|
|
93650
93864
|
}
|
|
93651
93865
|
function peopleLine(access, members) {
|
|
93652
93866
|
const ids = grantIds(access);
|
|
93653
|
-
return ids.length ? namesOf(ids, members) :
|
|
93867
|
+
return ids.length ? namesOf(ids, members) : import_picocolors81.default.dim("nobody named");
|
|
93654
93868
|
}
|
|
93655
93869
|
function printAccess(row, access, members) {
|
|
93656
93870
|
console.log([
|
|
93657
93871
|
"",
|
|
93658
|
-
|
|
93659
|
-
|
|
93660
|
-
|
|
93872
|
+
field2("audience", audienceLabel(access)),
|
|
93873
|
+
field2("people", peopleLine(access, members)),
|
|
93874
|
+
field2("threads", threadsLabel(row.share_agent_threads)),
|
|
93661
93875
|
""
|
|
93662
93876
|
].join(`
|
|
93663
93877
|
`));
|
|
@@ -93746,27 +93960,27 @@ async function create3(ctx) {
|
|
|
93746
93960
|
const id = safe(created.id);
|
|
93747
93961
|
const out = [
|
|
93748
93962
|
"",
|
|
93749
|
-
` ${
|
|
93963
|
+
` ${import_picocolors81.default.green("Created")} ${import_picocolors81.default.bold(safe(created.name))}`,
|
|
93750
93964
|
"",
|
|
93751
|
-
|
|
93752
|
-
|
|
93753
|
-
|
|
93754
|
-
|
|
93965
|
+
field2("id", id),
|
|
93966
|
+
field2("agent", safe(created.agent_id)),
|
|
93967
|
+
field2("address", `${safe(created.slug)} ${import_picocolors81.default.dim("(nothing live yet)")}`),
|
|
93968
|
+
field2("threads", threadsLabel(created.share_agent_threads))
|
|
93755
93969
|
];
|
|
93756
93970
|
if (access) {
|
|
93757
|
-
out.push(
|
|
93971
|
+
out.push(field2("audience", audienceLabel(access)));
|
|
93758
93972
|
if (access.audience_mode === "users")
|
|
93759
|
-
out.push(
|
|
93973
|
+
out.push(field2("people", peopleLine(access, members)));
|
|
93760
93974
|
}
|
|
93761
93975
|
if (!audience) {
|
|
93762
93976
|
out.push("", ` Nobody can open it until you choose who can: \`brainbase interface access ${id} --everyone\` or \`--people <emails>\`.`);
|
|
93763
93977
|
}
|
|
93764
93978
|
if (created.share_agent_threads) {
|
|
93765
|
-
out.push(` ${
|
|
93979
|
+
out.push(` ${import_picocolors81.default.dim(`To show viewers only their own conversations: \`brainbase interface threads ${id} --private\`.`)}`);
|
|
93766
93980
|
}
|
|
93767
93981
|
if (note)
|
|
93768
93982
|
out.push("", ` ${safe(note)}`);
|
|
93769
|
-
out.push("", ` ${
|
|
93983
|
+
out.push("", ` ${import_picocolors81.default.dim(`Next: \`brainbase interface build ${id} "<what to build>"\``)}`, "");
|
|
93770
93984
|
console.log(out.join(`
|
|
93771
93985
|
`));
|
|
93772
93986
|
if (readFailed) {
|
|
@@ -93902,9 +94116,9 @@ async function threads(ctx) {
|
|
|
93902
94116
|
printJson({ id: row.id, share_agent_threads: row.share_agent_threads });
|
|
93903
94117
|
return;
|
|
93904
94118
|
}
|
|
93905
|
-
const already = wanted === null ? "" : ` ${
|
|
94119
|
+
const already = wanted === null ? "" : ` ${import_picocolors81.default.dim("(already set; nothing changed)")}`;
|
|
93906
94120
|
console.log(`
|
|
93907
|
-
${
|
|
94121
|
+
${field2("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
|
|
93908
94122
|
`);
|
|
93909
94123
|
return;
|
|
93910
94124
|
}
|
|
@@ -93925,7 +94139,7 @@ ${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
|
|
|
93925
94139
|
return;
|
|
93926
94140
|
}
|
|
93927
94141
|
console.log(`
|
|
93928
|
-
${
|
|
94142
|
+
${field2("threads", threadsLabel(updated.share_agent_threads))}
|
|
93929
94143
|
`);
|
|
93930
94144
|
});
|
|
93931
94145
|
}
|
|
@@ -93941,7 +94155,7 @@ async function rename(ctx) {
|
|
|
93941
94155
|
return;
|
|
93942
94156
|
}
|
|
93943
94157
|
console.log(`
|
|
93944
|
-
Renamed ${safe(updated.id)} to ${
|
|
94158
|
+
Renamed ${safe(updated.id)} to ${import_picocolors81.default.bold(safe(updated.name))}.
|
|
93945
94159
|
`);
|
|
93946
94160
|
});
|
|
93947
94161
|
}
|
|
@@ -93977,7 +94191,7 @@ async function address(ctx) {
|
|
|
93977
94191
|
}
|
|
93978
94192
|
const where = updated.live_release ? safe(updated.live_release.url) : safe(updated.slug);
|
|
93979
94193
|
console.log(`
|
|
93980
|
-
${safe(updated.name)} is now at ${
|
|
94194
|
+
${safe(updated.name)} is now at ${import_picocolors81.default.bold(where)}.
|
|
93981
94195
|
`);
|
|
93982
94196
|
});
|
|
93983
94197
|
}
|
|
@@ -94069,9 +94283,9 @@ var lifecycleCommands = {
|
|
|
94069
94283
|
};
|
|
94070
94284
|
|
|
94071
94285
|
// src/cli/interface-preview.ts
|
|
94072
|
-
var
|
|
94286
|
+
var import_picocolors82 = __toESM(require_picocolors(), 1);
|
|
94073
94287
|
function warn(line2) {
|
|
94074
|
-
console.error(
|
|
94288
|
+
console.error(import_picocolors82.default.yellow(line2));
|
|
94075
94289
|
}
|
|
94076
94290
|
var PREVIEW_TIMEOUT_SECONDS = 300;
|
|
94077
94291
|
var PROBE_INTERVAL_MS = 2000;
|
|
@@ -94161,12 +94375,12 @@ async function preview(ctx) {
|
|
|
94161
94375
|
const say = progress(json4);
|
|
94162
94376
|
const row = await interfacesApi.get(id);
|
|
94163
94377
|
const { taskId, why } = await pickConversation(row, stringOption(parsed, "task")?.trim() || undefined);
|
|
94164
|
-
say(
|
|
94378
|
+
say(import_picocolors82.default.dim(` Previewing ${why}, ${safe(taskId)}.`));
|
|
94165
94379
|
const started = await interfacesApi.startPreview(taskId, row.id);
|
|
94166
94380
|
const address2 = previewAddress(started, row);
|
|
94167
94381
|
let outcome = started.state === "serving" ? "serving" : "not_waited";
|
|
94168
94382
|
if (outcome !== "serving" && !noWait) {
|
|
94169
|
-
say(
|
|
94383
|
+
say(import_picocolors82.default.dim(" Starting the dev server in the sandbox…"));
|
|
94170
94384
|
outcome = await waitUntilServing(started, { timeoutMs: waitMs, deps: ctx.deps });
|
|
94171
94385
|
}
|
|
94172
94386
|
if (json4) {
|
|
@@ -94174,12 +94388,12 @@ async function preview(ctx) {
|
|
|
94174
94388
|
} else {
|
|
94175
94389
|
const out = [
|
|
94176
94390
|
"",
|
|
94177
|
-
` ${outcome === "serving" ?
|
|
94391
|
+
` ${outcome === "serving" ? import_picocolors82.default.green("Preview ready") : import_picocolors82.default.yellow("Preview starting")} ${import_picocolors82.default.bold(safe(started.name))}`,
|
|
94178
94392
|
"",
|
|
94179
|
-
|
|
94180
|
-
|
|
94393
|
+
field2("address", address2 ? safe(address2) : import_picocolors82.default.dim(missingAddress(started))),
|
|
94394
|
+
field2("showing", showing(started, taskId)),
|
|
94181
94395
|
"",
|
|
94182
|
-
` ${
|
|
94396
|
+
` ${import_picocolors82.default.dim("Opens for people who can edit the agent, after signing in. Nothing is published.")}`,
|
|
94183
94397
|
""
|
|
94184
94398
|
];
|
|
94185
94399
|
console.log(out.join(`
|
|
@@ -94200,13 +94414,13 @@ async function preview(ctx) {
|
|
|
94200
94414
|
var previewCommands = { preview };
|
|
94201
94415
|
|
|
94202
94416
|
// src/cli/interface-release.ts
|
|
94203
|
-
var
|
|
94417
|
+
var import_picocolors83 = __toESM(require_picocolors(), 1);
|
|
94204
94418
|
var PUBLISH_TIMEOUT_SECONDS = 300;
|
|
94205
94419
|
var REBUILD_USAGE = "brainbase interface rebuild <id> [--version <version id>] [--yes]";
|
|
94206
94420
|
var PUBLISH_USAGE = "brainbase interface publish <id> [--build <build id>]";
|
|
94207
94421
|
var ROLLBACK_USAGE = "brainbase interface rollback <id> --release <release id>";
|
|
94208
94422
|
function warn2(line2) {
|
|
94209
|
-
console.error(
|
|
94423
|
+
console.error(import_picocolors83.default.yellow(line2));
|
|
94210
94424
|
}
|
|
94211
94425
|
function text3(value3) {
|
|
94212
94426
|
return typeof value3 === "string" && value3.trim() ? value3 : null;
|
|
@@ -94223,7 +94437,7 @@ async function follow(operationId, what, options) {
|
|
|
94223
94437
|
intervalMs: options.deps.pollIntervalMs,
|
|
94224
94438
|
signal: stop.signal,
|
|
94225
94439
|
now: options.deps.now,
|
|
94226
|
-
onStatus: (operation) => say(
|
|
94440
|
+
onStatus: (operation) => say(import_picocolors83.default.dim(` ${what} ${operation.status}`)),
|
|
94227
94441
|
onStall: () => warn2(`The ${what} looks stalled: its worker stopped checking in. Still waiting, in case another worker picks it up.`)
|
|
94228
94442
|
});
|
|
94229
94443
|
if (outcome.kind === "settled") {
|
|
@@ -94242,7 +94456,7 @@ function reportUnsuccessful(result2, what, options) {
|
|
|
94242
94456
|
if (options.json) {
|
|
94243
94457
|
printJson({ outcome: result2.outcome, operation_id: result2.operationId, operation: result2.operation });
|
|
94244
94458
|
} else if (result2.outcome === "failed") {
|
|
94245
|
-
console.error(
|
|
94459
|
+
console.error(import_picocolors83.default.red(`The ${what} failed (operation ${id}):`));
|
|
94246
94460
|
console.error(safeBlock(result2.operation?.error ?? "Brainbase gave no reason."));
|
|
94247
94461
|
} else if (result2.outcome === "timeout") {
|
|
94248
94462
|
warn2(`Stopped waiting after ${Math.round(options.timeoutMs / 1000)}s. The ${what} keeps running on the server (operation ${id}).`);
|
|
@@ -94302,7 +94516,7 @@ async function rebuild(ctx) {
|
|
|
94302
94516
|
if (json4)
|
|
94303
94517
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
94304
94518
|
else
|
|
94305
|
-
console.log(
|
|
94519
|
+
console.log(import_picocolors83.default.dim(` Follow it with \`brainbase interface builds ${safe(id)}\`.`));
|
|
94306
94520
|
return;
|
|
94307
94521
|
}
|
|
94308
94522
|
const result2 = await follow(operationId, "build", { json: json4, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -94314,8 +94528,8 @@ async function rebuild(ctx) {
|
|
|
94314
94528
|
}
|
|
94315
94529
|
const buildId = safe(result2.operation?.build_id ?? "");
|
|
94316
94530
|
const version2 = safe(result2.operation?.source_version_id ?? "");
|
|
94317
|
-
console.log(
|
|
94318
|
-
console.log(
|
|
94531
|
+
console.log(import_picocolors83.default.green(`✓ Build ${buildId} succeeded${version2 ? ` (version ${version2})` : ""}.`));
|
|
94532
|
+
console.log(import_picocolors83.default.dim(` Publish it with \`brainbase interface publish ${safe(id)} --build ${buildId}\`.`));
|
|
94319
94533
|
});
|
|
94320
94534
|
}
|
|
94321
94535
|
function liveBuildOf(row, releases) {
|
|
@@ -94373,7 +94587,7 @@ function describeBuild(buildId, builds) {
|
|
|
94373
94587
|
const build2 = builds.find((candidate) => candidate.id === buildId);
|
|
94374
94588
|
if (!build2)
|
|
94375
94589
|
return `build ${safe(buildId)}`;
|
|
94376
|
-
return `build ${safe(build2.id)} ${
|
|
94590
|
+
return `build ${safe(build2.id)} ${import_picocolors83.default.dim(`(version ${safe(build2.source_version_id)}, built ${ago(build2.created_at)})`)}`;
|
|
94377
94591
|
}
|
|
94378
94592
|
function reportAlreadyLive(json4, buildId, releaseId, url2) {
|
|
94379
94593
|
if (json4) {
|
|
@@ -94427,8 +94641,8 @@ async function publish(ctx) {
|
|
|
94427
94641
|
}
|
|
94428
94642
|
if (!json4) {
|
|
94429
94643
|
console.log("");
|
|
94430
|
-
console.log(` ${
|
|
94431
|
-
console.log(` ${
|
|
94644
|
+
console.log(` ${import_picocolors83.default.dim("Live now".padEnd(14))}${liveBuildId ? `${describeBuild(liveBuildId, builds)} at ${safe(row.live_release?.url)}` : row.live_release ? `release ${safe(row.live_release.id)} at ${safe(row.live_release.url)}` : import_picocolors83.default.dim("nothing")}`);
|
|
94645
|
+
console.log(` ${import_picocolors83.default.dim("Will publish".padEnd(14))}${describeBuild(buildId, builds)}`);
|
|
94432
94646
|
console.log("");
|
|
94433
94647
|
}
|
|
94434
94648
|
const proceed = await confirmChange({
|
|
@@ -94471,7 +94685,7 @@ async function publish(ctx) {
|
|
|
94471
94685
|
if (json4)
|
|
94472
94686
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
94473
94687
|
else
|
|
94474
|
-
console.log(
|
|
94688
|
+
console.log(import_picocolors83.default.dim(` Check it with \`brainbase interface get ${safe(id)}\`.`));
|
|
94475
94689
|
return;
|
|
94476
94690
|
}
|
|
94477
94691
|
const result2 = await follow(operationId, "publish", { json: json4, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -94488,11 +94702,11 @@ async function publish(ctx) {
|
|
|
94488
94702
|
printJson({ outcome: "succeeded", operation_id: operationId, operation: result2.operation, url: url2 });
|
|
94489
94703
|
return;
|
|
94490
94704
|
}
|
|
94491
|
-
console.log(
|
|
94705
|
+
console.log(import_picocolors83.default.green(`✓ Build ${safe(buildId)} is live.`));
|
|
94492
94706
|
if (url2)
|
|
94493
94707
|
console.log(` ${safe(url2)}`);
|
|
94494
94708
|
if (urlUnread) {
|
|
94495
|
-
console.log(
|
|
94709
|
+
console.log(import_picocolors83.default.dim(` Its address could not be read just now; see it with \`brainbase interface open ${safe(id)}\`.`));
|
|
94496
94710
|
}
|
|
94497
94711
|
});
|
|
94498
94712
|
}
|
|
@@ -94528,8 +94742,8 @@ async function rollback(ctx) {
|
|
|
94528
94742
|
}
|
|
94529
94743
|
if (!json4) {
|
|
94530
94744
|
console.log("");
|
|
94531
|
-
console.log(` ${
|
|
94532
|
-
console.log(` ${
|
|
94745
|
+
console.log(` ${import_picocolors83.default.dim("Live now".padEnd(16))}release ${safe(row.live_release.id)} at ${safe(row.live_release.url)}`);
|
|
94746
|
+
console.log(` ${import_picocolors83.default.dim("Will republish".padEnd(16))}release ${safe(releaseId)} ${import_picocolors83.default.dim("as a new release, with a new id")}`);
|
|
94533
94747
|
console.log("");
|
|
94534
94748
|
}
|
|
94535
94749
|
const proceed = await confirmChange({
|
|
@@ -94562,7 +94776,7 @@ async function rollback(ctx) {
|
|
|
94562
94776
|
printJson(release);
|
|
94563
94777
|
return;
|
|
94564
94778
|
}
|
|
94565
|
-
console.log(
|
|
94779
|
+
console.log(import_picocolors83.default.green(release.id === releaseId ? `✓ Release ${safe(releaseId)} is live (build ${safe(release.build_id)}).` : `✓ Republished release ${safe(releaseId)} as new release ${safe(release.id)} (build ${safe(release.build_id)}). It is live.`));
|
|
94566
94780
|
console.log(` ${safe(release.url)}`);
|
|
94567
94781
|
});
|
|
94568
94782
|
}
|
|
@@ -94597,14 +94811,14 @@ ${didYouMean(sub, Object.keys(COMMANDS2), "brainbase interface")}`);
|
|
|
94597
94811
|
await command({ cwd: cwd2, args, deps });
|
|
94598
94812
|
}
|
|
94599
94813
|
function line2(command, args, description) {
|
|
94600
|
-
return ` ${
|
|
94601
|
-
${
|
|
94814
|
+
return ` ${import_picocolors84.default.cyan(command)}${args ? ` ${import_picocolors84.default.dim(args)}` : ""}
|
|
94815
|
+
${import_picocolors84.default.dim(description)}`;
|
|
94602
94816
|
}
|
|
94603
94817
|
function printHelp7() {
|
|
94604
94818
|
const out = [];
|
|
94605
94819
|
out.push("");
|
|
94606
|
-
out.push(` ${
|
|
94607
|
-
out.push(` ${
|
|
94820
|
+
out.push(` ${import_picocolors84.default.bold("brainbase interface")} ${import_picocolors84.default.dim("<sub> [options]")}`);
|
|
94821
|
+
out.push(` ${import_picocolors84.default.dim("Dashboards for an agent: build them in a conversation, publish them, choose who can open them.")}`);
|
|
94608
94822
|
out.push("");
|
|
94609
94823
|
out.push(line2("ls", "[--agent <id>] [--archived | --only-archived]", "list interfaces you can see"));
|
|
94610
94824
|
out.push(line2("get", "<id>", "one interface: address, audience, live release, draft, running build conversation"));
|
|
@@ -94624,22 +94838,22 @@ function printHelp7() {
|
|
|
94624
94838
|
out.push(line2("rollback", "<id> --release <id>", "republish an earlier release; it goes live under a new release id"));
|
|
94625
94839
|
out.push(line2("preview", "<id> [--task <id>] [--no-wait]", "serve the unpublished draft from its build conversation and print the preview address"));
|
|
94626
94840
|
out.push("");
|
|
94627
|
-
out.push(` ${
|
|
94628
|
-
out.push(` ${
|
|
94629
|
-
out.push(` ${
|
|
94630
|
-
out.push(` ${
|
|
94631
|
-
out.push(` ${
|
|
94841
|
+
out.push(` ${import_picocolors84.default.dim("--json")} machine-readable output; never prompts`);
|
|
94842
|
+
out.push(` ${import_picocolors84.default.dim("--yes, -y")} skip confirmation (required without a terminal)`);
|
|
94843
|
+
out.push(` ${import_picocolors84.default.dim("--no-wait")} for rebuild and publish: return the operation at once; for preview: do not wait for the dev server`);
|
|
94844
|
+
out.push(` ${import_picocolors84.default.dim("--timeout <seconds>")} for build, rebuild, publish and preview: how long to wait (builds 900, publish and preview 300)`);
|
|
94845
|
+
out.push(` ${import_picocolors84.default.dim("--idempotency-key <key>")} replay a create, build, rebuild, publish or rollback whose answer was lost`);
|
|
94632
94846
|
out.push("");
|
|
94633
|
-
out.push(` ${
|
|
94634
|
-
out.push(` ${
|
|
94635
|
-
out.push(` ${
|
|
94847
|
+
out.push(` ${import_picocolors84.default.dim("People are emails (see `brainbase member ls`), user ids, or `me`. Audience members also need access to the agent.")}`);
|
|
94848
|
+
out.push(` ${import_picocolors84.default.dim("Audience: everyone (--everyone, `org` under --json) or chosen people (--people, `users` under --json).")}`);
|
|
94849
|
+
out.push(` ${import_picocolors84.default.dim("Exit codes: 0 done, 1 refused or failed, 130 interrupted (the server keeps working).")}`);
|
|
94636
94850
|
out.push("");
|
|
94637
94851
|
console.log(out.join(`
|
|
94638
94852
|
`));
|
|
94639
94853
|
}
|
|
94640
94854
|
|
|
94641
94855
|
// src/cli/member.ts
|
|
94642
|
-
var
|
|
94856
|
+
var import_picocolors85 = __toESM(require_picocolors(), 1);
|
|
94643
94857
|
async function runMember(sub, args, opts) {
|
|
94644
94858
|
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
94645
94859
|
printHelp8();
|
|
@@ -94682,7 +94896,7 @@ async function runMemberList(opts) {
|
|
|
94682
94896
|
function formatMemberList(members) {
|
|
94683
94897
|
if (members.length === 0)
|
|
94684
94898
|
return `
|
|
94685
|
-
${
|
|
94899
|
+
${import_picocolors85.default.dim("Nobody here you can see.")}
|
|
94686
94900
|
`;
|
|
94687
94901
|
const sorted = [...members].sort((a3, b4) => (a3.email ?? a3.id).localeCompare(b4.email ?? b4.id));
|
|
94688
94902
|
const rows = sorted.map((member) => ({
|
|
@@ -94696,24 +94910,24 @@ function formatMemberList(members) {
|
|
|
94696
94910
|
const roleWidth = Math.max(...rows.map((row) => row.role.length));
|
|
94697
94911
|
const lines = [""];
|
|
94698
94912
|
for (const row of rows) {
|
|
94699
|
-
lines.push(` ${row.email.padEnd(emailWidth)} ${row.name.padEnd(nameWidth)} ${
|
|
94913
|
+
lines.push(` ${row.email.padEnd(emailWidth)} ${row.name.padEnd(nameWidth)} ${import_picocolors85.default.dim(row.role.padEnd(roleWidth))} ${import_picocolors85.default.dim(row.teams)}`.trimEnd());
|
|
94700
94914
|
}
|
|
94701
|
-
lines.push("", ` ${
|
|
94915
|
+
lines.push("", ` ${import_picocolors85.default.dim("share a dashboard with one of them:")} ${import_picocolors85.default.cyan("brainbase interface access <id> --add <email>")}`, "");
|
|
94702
94916
|
return lines.join(`
|
|
94703
94917
|
`);
|
|
94704
94918
|
}
|
|
94705
94919
|
function printHelp8() {
|
|
94706
94920
|
const out = [];
|
|
94707
94921
|
out.push("");
|
|
94708
|
-
out.push(` ${
|
|
94922
|
+
out.push(` ${import_picocolors85.default.bold("brainbase member")} ${import_picocolors85.default.dim("<sub> [options]")}`);
|
|
94709
94923
|
out.push("");
|
|
94710
|
-
out.push(` ${
|
|
94924
|
+
out.push(` ${import_picocolors85.default.cyan("ls")} ${import_picocolors85.default.dim("the people in an organization you can see, with their emails, roles and teams")}`);
|
|
94711
94925
|
out.push("");
|
|
94712
|
-
out.push(` ${
|
|
94713
|
-
out.push(` ${
|
|
94926
|
+
out.push(` ${import_picocolors85.default.dim("--org <id-or-slug>")} ${import_picocolors85.default.dim("which organization (picked automatically when you are in one)")}`);
|
|
94927
|
+
out.push(` ${import_picocolors85.default.dim("--json")} ${import_picocolors85.default.dim("machine-readable output")}`);
|
|
94714
94928
|
out.push("");
|
|
94715
|
-
out.push(` ${
|
|
94716
|
-
out.push(` ${
|
|
94929
|
+
out.push(` ${import_picocolors85.default.dim("Owners and admins see everyone. Anyone else sees the owners, the admins, themselves")}`);
|
|
94930
|
+
out.push(` ${import_picocolors85.default.dim("and the people who share a team with them, as in the web app.")}`);
|
|
94717
94931
|
out.push("");
|
|
94718
94932
|
console.log(out.join(`
|
|
94719
94933
|
`));
|
|
@@ -97806,7 +98020,7 @@ async function runBenchmarkPhase(specPathInput, resultPathInput, expectedPhase,
|
|
|
97806
98020
|
}
|
|
97807
98021
|
|
|
97808
98022
|
// src/cli/benchmark-control.ts
|
|
97809
|
-
var
|
|
98023
|
+
var import_picocolors86 = __toESM(require_picocolors(), 1);
|
|
97810
98024
|
import fs93 from "node:fs";
|
|
97811
98025
|
import path104 from "node:path";
|
|
97812
98026
|
|
|
@@ -98202,13 +98416,13 @@ var CaseEvaluatorOverrideSchema = exports_external.object({
|
|
|
98202
98416
|
value3.evidence,
|
|
98203
98417
|
value3.evaluation_materials
|
|
98204
98418
|
];
|
|
98205
|
-
if (value3.mode === "override" && overrides.every((
|
|
98419
|
+
if (value3.mode === "override" && overrides.every((field3) => field3 == null)) {
|
|
98206
98420
|
ctx.addIssue({
|
|
98207
98421
|
code: exports_external.ZodIssueCode.custom,
|
|
98208
98422
|
message: "override mode must change evaluator fields"
|
|
98209
98423
|
});
|
|
98210
98424
|
}
|
|
98211
|
-
if (value3.mode !== "override" && overrides.some((
|
|
98425
|
+
if (value3.mode !== "override" && overrides.some((field3) => field3 != null)) {
|
|
98212
98426
|
ctx.addIssue({
|
|
98213
98427
|
code: exports_external.ZodIssueCode.custom,
|
|
98214
98428
|
message: `${value3.mode} mode must not include evaluator overrides`
|
|
@@ -100282,11 +100496,11 @@ function bundledFileSetDigest(output, value3, label3) {
|
|
|
100282
100496
|
return output.digest(descriptors);
|
|
100283
100497
|
}
|
|
100284
100498
|
function stringField(value3, key2) {
|
|
100285
|
-
const
|
|
100286
|
-
if (typeof
|
|
100499
|
+
const field3 = value3[key2];
|
|
100500
|
+
if (typeof field3 !== "string" || !field3.trim()) {
|
|
100287
100501
|
throw usageError(`Response is missing ${key2}`);
|
|
100288
100502
|
}
|
|
100289
|
-
return
|
|
100503
|
+
return field3;
|
|
100290
100504
|
}
|
|
100291
100505
|
function context(cwd2, command, options, deps) {
|
|
100292
100506
|
const agentId = resolveBenchmarkAgentId(cwd2, options.agent);
|
|
@@ -100335,20 +100549,20 @@ async function emitCursorPages(output, fetchPage, options) {
|
|
|
100335
100549
|
function commandHelp() {
|
|
100336
100550
|
return [
|
|
100337
100551
|
"",
|
|
100338
|
-
` ${
|
|
100552
|
+
` ${import_picocolors86.default.bold("brainbase benchmark")} ${import_picocolors86.default.dim("<command> [options]")}`,
|
|
100339
100553
|
"",
|
|
100340
|
-
` ${
|
|
100341
|
-
` ${
|
|
100342
|
-
` ${
|
|
100343
|
-
` ${
|
|
100344
|
-
` ${
|
|
100554
|
+
` ${import_picocolors86.default.cyan("init | list | show | create | validate | pull | push")}`,
|
|
100555
|
+
` ${import_picocolors86.default.cyan("publish | revisions | import | export | archive | restore")}`,
|
|
100556
|
+
` ${import_picocolors86.default.cyan("run plan|start|watch|list|show|cancel|resume")}`,
|
|
100557
|
+
` ${import_picocolors86.default.cyan("results | diagnoses | attempt | artifacts | export-results")}`,
|
|
100558
|
+
` ${import_picocolors86.default.cyan("history | baseline show|set|clear")}`,
|
|
100345
100559
|
"",
|
|
100346
|
-
` ${
|
|
100560
|
+
` ${import_picocolors86.default.dim("Use --agent to override brainbase.agent.yaml, and --json or --jsonl for automation.")}`,
|
|
100347
100561
|
"",
|
|
100348
|
-
` ${
|
|
100349
|
-
` ${
|
|
100350
|
-
` ${
|
|
100351
|
-
` ${
|
|
100562
|
+
` ${import_picocolors86.default.bold("benchmark runtime (machine-only)")}`,
|
|
100563
|
+
` ${import_picocolors86.default.cyan("hydrate")} ${import_picocolors86.default.dim("--spec <path> --result <path> --json")}`,
|
|
100564
|
+
` ${import_picocolors86.default.cyan("evaluate")} ${import_picocolors86.default.dim("--spec <path> --result <path> --json")}`,
|
|
100565
|
+
` ${import_picocolors86.default.cyan("capabilities")} ${import_picocolors86.default.dim("--json")}`,
|
|
100352
100566
|
""
|
|
100353
100567
|
].join(`
|
|
100354
100568
|
`);
|
|
@@ -102093,18 +102307,18 @@ function rowItem(row, options, fallbackId) {
|
|
|
102093
102307
|
if (!isRecord2(row))
|
|
102094
102308
|
return { id, error: "Not an object, so --text-field has nothing to select" };
|
|
102095
102309
|
if (options.textFields.length === 1) {
|
|
102096
|
-
const
|
|
102097
|
-
const value3 = row[
|
|
102310
|
+
const field3 = options.textFields[0];
|
|
102311
|
+
const value3 = row[field3];
|
|
102098
102312
|
if (value3 === undefined || value3 === null || value3 === "")
|
|
102099
|
-
return { id, error: `Empty ${
|
|
102313
|
+
return { id, error: `Empty ${field3}` };
|
|
102100
102314
|
return { id, text: typeof value3 === "string" ? value3 : JSON.stringify(value3) };
|
|
102101
102315
|
}
|
|
102102
|
-
const missing = options.textFields.filter((
|
|
102316
|
+
const missing = options.textFields.filter((field3) => row[field3] === undefined);
|
|
102103
102317
|
if (missing.length)
|
|
102104
102318
|
return { id, error: `Missing ${missing.join(", ")}` };
|
|
102105
102319
|
const picked = {};
|
|
102106
|
-
for (const
|
|
102107
|
-
picked[
|
|
102320
|
+
for (const field3 of options.textFields)
|
|
102321
|
+
picked[field3] = row[field3];
|
|
102108
102322
|
return { id, json: picked };
|
|
102109
102323
|
}
|
|
102110
102324
|
function sourceLabel(cwd2, file) {
|
|
@@ -102143,39 +102357,39 @@ function jsonlItems(cwd2, file, options) {
|
|
|
102143
102357
|
function parseCsv(text4) {
|
|
102144
102358
|
const rows = [];
|
|
102145
102359
|
let row = [];
|
|
102146
|
-
let
|
|
102360
|
+
let field3 = "";
|
|
102147
102361
|
let quoted = false;
|
|
102148
102362
|
for (let i = 0;i < text4.length; i += 1) {
|
|
102149
102363
|
const char = text4[i];
|
|
102150
102364
|
if (quoted) {
|
|
102151
102365
|
if (char === '"' && text4[i + 1] === '"') {
|
|
102152
|
-
|
|
102366
|
+
field3 += '"';
|
|
102153
102367
|
i += 1;
|
|
102154
102368
|
} else if (char === '"') {
|
|
102155
102369
|
quoted = false;
|
|
102156
102370
|
} else {
|
|
102157
|
-
|
|
102371
|
+
field3 += char;
|
|
102158
102372
|
}
|
|
102159
|
-
} else if (char === '"' &&
|
|
102373
|
+
} else if (char === '"' && field3 === "") {
|
|
102160
102374
|
quoted = true;
|
|
102161
102375
|
} else if (char === ",") {
|
|
102162
|
-
row.push(
|
|
102163
|
-
|
|
102376
|
+
row.push(field3);
|
|
102377
|
+
field3 = "";
|
|
102164
102378
|
} else if (char === `
|
|
102165
102379
|
` || char === "\r") {
|
|
102166
102380
|
if (char === "\r" && text4[i + 1] === `
|
|
102167
102381
|
`)
|
|
102168
102382
|
i += 1;
|
|
102169
|
-
row.push(
|
|
102383
|
+
row.push(field3);
|
|
102170
102384
|
rows.push(row);
|
|
102171
102385
|
row = [];
|
|
102172
|
-
|
|
102386
|
+
field3 = "";
|
|
102173
102387
|
} else {
|
|
102174
|
-
|
|
102388
|
+
field3 += char;
|
|
102175
102389
|
}
|
|
102176
102390
|
}
|
|
102177
|
-
if (
|
|
102178
|
-
row.push(
|
|
102391
|
+
if (field3 !== "" || row.length > 0) {
|
|
102392
|
+
row.push(field3);
|
|
102179
102393
|
rows.push(row);
|
|
102180
102394
|
}
|
|
102181
102395
|
return rows.filter((cells) => cells.some((cell) => cell !== ""));
|
|
@@ -102311,7 +102525,8 @@ Questions:
|
|
|
102311
102525
|
joey-1, d1.1, mammoth-1, elephant-1, drex-max,
|
|
102312
102526
|
pplx-decider-flash-v1.2, pplx-decider-v1.2,
|
|
102313
102527
|
d1-ultra, jev-1.14, classify-1,
|
|
102314
|
-
microsoft-decision-1, clef-omni or
|
|
102528
|
+
microsoft-decision-1, clef-omni, d1 or
|
|
102529
|
+
gemini-decision-1
|
|
102315
102530
|
(default: the server's default)
|
|
102316
102531
|
--min-confidence <0-1> mark answers below this confidence as uncertain
|
|
102317
102532
|
|
|
@@ -102640,6 +102855,368 @@ function routeConsoleThroughStreams() {
|
|
|
102640
102855
|
process.stderr.on("error", ignoreClosedReader);
|
|
102641
102856
|
}
|
|
102642
102857
|
|
|
102858
|
+
// src/core/telemetry.ts
|
|
102859
|
+
import { spawn as spawn6 } from "node:child_process";
|
|
102860
|
+
import crypto12 from "node:crypto";
|
|
102861
|
+
import fs97 from "node:fs";
|
|
102862
|
+
import os20 from "node:os";
|
|
102863
|
+
import path109 from "node:path";
|
|
102864
|
+
import process14 from "node:process";
|
|
102865
|
+
var POSTHOG_PROJECT_KEY = "phc_HV6qImqhLGuZ0g6AaxRVJrprKhf1yCMXXPzsfcOI9Iu";
|
|
102866
|
+
var POSTHOG_HOST = "https://us.i.posthog.com";
|
|
102867
|
+
var TELEMETRY_EVENT = "cli_command";
|
|
102868
|
+
var TELEMETRY_FILE = path109.join(BRAINBASE_HOME, "telemetry.json");
|
|
102869
|
+
var TRUTHY = new Set(["1", "true", "yes", "on"]);
|
|
102870
|
+
function truthy(value3) {
|
|
102871
|
+
return value3 !== undefined && TRUTHY.has(value3.trim().toLowerCase());
|
|
102872
|
+
}
|
|
102873
|
+
function readTelemetryState(file = TELEMETRY_FILE) {
|
|
102874
|
+
try {
|
|
102875
|
+
const parsed = JSON.parse(fs97.readFileSync(file, "utf8"));
|
|
102876
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
102877
|
+
} catch {
|
|
102878
|
+
return {};
|
|
102879
|
+
}
|
|
102880
|
+
}
|
|
102881
|
+
function updateTelemetryState(change, file = TELEMETRY_FILE, lockTimeoutMs = 2000) {
|
|
102882
|
+
const release = acquireLock(`${file}.lock`, lockTimeoutMs);
|
|
102883
|
+
if (!release)
|
|
102884
|
+
return false;
|
|
102885
|
+
try {
|
|
102886
|
+
writeJsonAtomic(file, change(readTelemetryState(file)));
|
|
102887
|
+
return true;
|
|
102888
|
+
} finally {
|
|
102889
|
+
release();
|
|
102890
|
+
}
|
|
102891
|
+
}
|
|
102892
|
+
function telemetryDisabledReason(env3 = process14.env, state = readTelemetryState()) {
|
|
102893
|
+
if (truthy(env3.BRAINBASE_TELEMETRY_DISABLED))
|
|
102894
|
+
return "env";
|
|
102895
|
+
if (truthy(env3.DO_NOT_TRACK))
|
|
102896
|
+
return "do_not_track";
|
|
102897
|
+
if (env3.BRAINBASE_THREAD_ID || env3.BB_TASK_KEY || env3.BRAINBASE_BENCHMARK_WORKSPACE) {
|
|
102898
|
+
return "sandbox";
|
|
102899
|
+
}
|
|
102900
|
+
if (state.enabled === false)
|
|
102901
|
+
return "config";
|
|
102902
|
+
return null;
|
|
102903
|
+
}
|
|
102904
|
+
var KNOWN_SUBCOMMANDS = {
|
|
102905
|
+
login: [],
|
|
102906
|
+
logout: [],
|
|
102907
|
+
whoami: [],
|
|
102908
|
+
link: [],
|
|
102909
|
+
unlink: [],
|
|
102910
|
+
sync: [],
|
|
102911
|
+
status: [],
|
|
102912
|
+
publish: [],
|
|
102913
|
+
decide: [],
|
|
102914
|
+
run: [],
|
|
102915
|
+
help: [],
|
|
102916
|
+
version: [],
|
|
102917
|
+
telemetry: ["status", "enable", "disable"],
|
|
102918
|
+
template: [
|
|
102919
|
+
"info",
|
|
102920
|
+
"install",
|
|
102921
|
+
"list",
|
|
102922
|
+
"ls",
|
|
102923
|
+
"onboard",
|
|
102924
|
+
"pack",
|
|
102925
|
+
"publish",
|
|
102926
|
+
"remove",
|
|
102927
|
+
"rm",
|
|
102928
|
+
"search",
|
|
102929
|
+
"show",
|
|
102930
|
+
"uninstall"
|
|
102931
|
+
],
|
|
102932
|
+
skill: [
|
|
102933
|
+
"add",
|
|
102934
|
+
"info",
|
|
102935
|
+
"install",
|
|
102936
|
+
"list",
|
|
102937
|
+
"ls",
|
|
102938
|
+
"publish",
|
|
102939
|
+
"remove",
|
|
102940
|
+
"rm",
|
|
102941
|
+
"search",
|
|
102942
|
+
"show",
|
|
102943
|
+
"uninstall",
|
|
102944
|
+
"update",
|
|
102945
|
+
"upgrade"
|
|
102946
|
+
],
|
|
102947
|
+
token: ["clear", "create", "list", "ls", "new", "rename", "revoke", "rm"],
|
|
102948
|
+
agent: [
|
|
102949
|
+
"connect",
|
|
102950
|
+
"connections",
|
|
102951
|
+
"create",
|
|
102952
|
+
"delete",
|
|
102953
|
+
"design",
|
|
102954
|
+
"designs",
|
|
102955
|
+
"disconnect",
|
|
102956
|
+
"env",
|
|
102957
|
+
"eval",
|
|
102958
|
+
"init",
|
|
102959
|
+
"list",
|
|
102960
|
+
"ls",
|
|
102961
|
+
"pull",
|
|
102962
|
+
"push",
|
|
102963
|
+
"status",
|
|
102964
|
+
"surface",
|
|
102965
|
+
"unpack",
|
|
102966
|
+
"versions"
|
|
102967
|
+
],
|
|
102968
|
+
team: ["list", "ls"],
|
|
102969
|
+
member: ["list", "ls"],
|
|
102970
|
+
task: ["create", "delete", "get", "list", "logs", "ls", "send", "stop", "update"],
|
|
102971
|
+
interface: ["access", "build", "create", "list", "ls", "open", "preview", "publish", "rollback"],
|
|
102972
|
+
machine: ["list", "ls", "rm"],
|
|
102973
|
+
benchmark: [
|
|
102974
|
+
"archive",
|
|
102975
|
+
"artifacts",
|
|
102976
|
+
"attempt",
|
|
102977
|
+
"baseline",
|
|
102978
|
+
"capabilities",
|
|
102979
|
+
"create",
|
|
102980
|
+
"diagnoses",
|
|
102981
|
+
"evaluate",
|
|
102982
|
+
"export",
|
|
102983
|
+
"export-results",
|
|
102984
|
+
"history",
|
|
102985
|
+
"hydrate",
|
|
102986
|
+
"import",
|
|
102987
|
+
"init",
|
|
102988
|
+
"list",
|
|
102989
|
+
"publish",
|
|
102990
|
+
"pull",
|
|
102991
|
+
"push",
|
|
102992
|
+
"restore",
|
|
102993
|
+
"results",
|
|
102994
|
+
"revisions",
|
|
102995
|
+
"run",
|
|
102996
|
+
"show",
|
|
102997
|
+
"validate"
|
|
102998
|
+
],
|
|
102999
|
+
orchestration: [
|
|
103000
|
+
"add",
|
|
103001
|
+
"add-agent",
|
|
103002
|
+
"create",
|
|
103003
|
+
"delete",
|
|
103004
|
+
"from-agent",
|
|
103005
|
+
"init",
|
|
103006
|
+
"list",
|
|
103007
|
+
"ls",
|
|
103008
|
+
"pull",
|
|
103009
|
+
"push",
|
|
103010
|
+
"status",
|
|
103011
|
+
"trigger",
|
|
103012
|
+
"triggers"
|
|
103013
|
+
],
|
|
103014
|
+
mcp: ["add", "call", "check", "connect", "list", "search", "tools"],
|
|
103015
|
+
integrations: [
|
|
103016
|
+
"actions",
|
|
103017
|
+
"add",
|
|
103018
|
+
"allow",
|
|
103019
|
+
"ask",
|
|
103020
|
+
"connect",
|
|
103021
|
+
"context",
|
|
103022
|
+
"deny",
|
|
103023
|
+
"disconnect",
|
|
103024
|
+
"list",
|
|
103025
|
+
"remove",
|
|
103026
|
+
"search"
|
|
103027
|
+
]
|
|
103028
|
+
};
|
|
103029
|
+
var COMMAND_ALIASES = {
|
|
103030
|
+
teams: "team",
|
|
103031
|
+
members: "member",
|
|
103032
|
+
interfaces: "interface",
|
|
103033
|
+
machines: "machine",
|
|
103034
|
+
orch: "orchestration",
|
|
103035
|
+
integration: "integrations",
|
|
103036
|
+
"--help": "help",
|
|
103037
|
+
"-h": "help",
|
|
103038
|
+
"--version": "version",
|
|
103039
|
+
"-v": "version"
|
|
103040
|
+
};
|
|
103041
|
+
var FLAG = /^--?[a-zA-Z][a-zA-Z0-9-]{0,39}$/;
|
|
103042
|
+
function describeInvocation(argv) {
|
|
103043
|
+
const [first, ...rest2] = argv;
|
|
103044
|
+
if (first === undefined)
|
|
103045
|
+
return { command: "none", subcommand: null, flags: [] };
|
|
103046
|
+
const name = COMMAND_ALIASES[first] ?? first;
|
|
103047
|
+
const subcommands = Object.hasOwn(KNOWN_SUBCOMMANDS, name) ? KNOWN_SUBCOMMANDS[name] : undefined;
|
|
103048
|
+
if (subcommands === undefined)
|
|
103049
|
+
return { command: "unknown", subcommand: null, flags: [] };
|
|
103050
|
+
if (name === "run")
|
|
103051
|
+
return { command: name, subcommand: null, flags: [] };
|
|
103052
|
+
const separator = rest2.indexOf("--");
|
|
103053
|
+
const own = separator < 0 ? rest2 : rest2.slice(0, separator);
|
|
103054
|
+
let subcommand = null;
|
|
103055
|
+
if (subcommands.length > 0 && own[0] !== undefined && !own[0].startsWith("-")) {
|
|
103056
|
+
subcommand = subcommands.includes(own[0]) ? own[0] : "other";
|
|
103057
|
+
}
|
|
103058
|
+
const flags = new Set;
|
|
103059
|
+
for (const token of own) {
|
|
103060
|
+
const flag = token.split("=", 1)[0];
|
|
103061
|
+
if (FLAG.test(flag))
|
|
103062
|
+
flags.add(flag);
|
|
103063
|
+
}
|
|
103064
|
+
return { command: name, subcommand, flags: [...flags].sort() };
|
|
103065
|
+
}
|
|
103066
|
+
function activeCredential() {
|
|
103067
|
+
const active = describeCredentials().active;
|
|
103068
|
+
if (active === "env_pat")
|
|
103069
|
+
return "env_token";
|
|
103070
|
+
return active ?? "none";
|
|
103071
|
+
}
|
|
103072
|
+
function anonymousId(file) {
|
|
103073
|
+
let id = readTelemetryState(file).anonymousId;
|
|
103074
|
+
if (id)
|
|
103075
|
+
return id;
|
|
103076
|
+
const minted = crypto12.randomUUID();
|
|
103077
|
+
try {
|
|
103078
|
+
updateTelemetryState((state) => {
|
|
103079
|
+
id = state.anonymousId ?? minted;
|
|
103080
|
+
return { ...state, anonymousId: id };
|
|
103081
|
+
}, file, 0);
|
|
103082
|
+
} catch {}
|
|
103083
|
+
return id ?? minted;
|
|
103084
|
+
}
|
|
103085
|
+
function buildEvent(argv, exitCode, durationMs, options = {}) {
|
|
103086
|
+
const env3 = options.env ?? process14.env;
|
|
103087
|
+
const file = options.file ?? TELEMETRY_FILE;
|
|
103088
|
+
const session = options.session === undefined ? readAuth() : options.session;
|
|
103089
|
+
const storedPatUserId = options.storedPatUserId === undefined ? readToken()?.user_id ?? null : options.storedPatUserId;
|
|
103090
|
+
const credential = options.credential ?? activeCredential();
|
|
103091
|
+
const userId = credential === "stored_pat" ? storedPatUserId : credential === "session" || credential === "none" ? session?.user_id ?? null : null;
|
|
103092
|
+
const { command, subcommand, flags } = describeInvocation(argv);
|
|
103093
|
+
return {
|
|
103094
|
+
api_key: POSTHOG_PROJECT_KEY,
|
|
103095
|
+
event: TELEMETRY_EVENT,
|
|
103096
|
+
distinct_id: userId ?? anonymousId(file),
|
|
103097
|
+
timestamp: new Date().toISOString(),
|
|
103098
|
+
properties: {
|
|
103099
|
+
command,
|
|
103100
|
+
subcommand,
|
|
103101
|
+
command_path: subcommand ? `${command} ${subcommand}` : command,
|
|
103102
|
+
flags,
|
|
103103
|
+
exit_code: exitCode,
|
|
103104
|
+
success: exitCode === 0,
|
|
103105
|
+
duration_ms: Math.round(durationMs),
|
|
103106
|
+
cli_version: VERSION,
|
|
103107
|
+
os: process14.platform,
|
|
103108
|
+
os_release: os20.release(),
|
|
103109
|
+
arch: process14.arch,
|
|
103110
|
+
runtime: typeof globalThis.Bun !== "undefined" ? "bun" : "node",
|
|
103111
|
+
runtime_version: process14.versions.bun ?? process14.versions.node,
|
|
103112
|
+
ci: env3.CI !== undefined && !["", "0", "false", "no", "off"].includes(env3.CI.trim().toLowerCase()),
|
|
103113
|
+
interactive: Boolean(process14.stdout.isTTY),
|
|
103114
|
+
credential,
|
|
103115
|
+
$lib: "brainbase-cli",
|
|
103116
|
+
$lib_version: VERSION,
|
|
103117
|
+
$geoip_disable: true,
|
|
103118
|
+
$process_person_profile: userId !== null
|
|
103119
|
+
}
|
|
103120
|
+
};
|
|
103121
|
+
}
|
|
103122
|
+
var SENDER = `
|
|
103123
|
+
fetch(process.env.BRAINBASE_TELEMETRY_URL, { method: 'POST',
|
|
103124
|
+
headers: { 'content-type': 'application/json' }, body: process.env.BRAINBASE_TELEMETRY_BODY,
|
|
103125
|
+
signal: AbortSignal.timeout(3000) }).catch(() => {}).finally(() => process.exit(0));
|
|
103126
|
+
`;
|
|
103127
|
+
function sendDetached(event) {
|
|
103128
|
+
const child = spawn6(process14.execPath, ["-e", SENDER], {
|
|
103129
|
+
detached: true,
|
|
103130
|
+
stdio: "ignore",
|
|
103131
|
+
env: {
|
|
103132
|
+
PATH: process14.env.PATH ?? "",
|
|
103133
|
+
BRAINBASE_TELEMETRY_URL: `${(process14.env.BRAINBASE_TELEMETRY_HOST || POSTHOG_HOST).replace(/\/+$/, "")}/i/v0/e/`,
|
|
103134
|
+
BRAINBASE_TELEMETRY_BODY: JSON.stringify(event)
|
|
103135
|
+
}
|
|
103136
|
+
});
|
|
103137
|
+
child.on("error", () => {});
|
|
103138
|
+
child.unref();
|
|
103139
|
+
}
|
|
103140
|
+
function noticeText() {
|
|
103141
|
+
return [
|
|
103142
|
+
"",
|
|
103143
|
+
"The brainbase CLI sends usage data to help us improve it: which commands and",
|
|
103144
|
+
"flag names you run, exit codes and timings. Never arguments, flag values, paths",
|
|
103145
|
+
"or prompts. It is tied to your Brainbase account when you are logged in.",
|
|
103146
|
+
"Turn it off with `brainbase telemetry disable` or BRAINBASE_TELEMETRY_DISABLED=1.",
|
|
103147
|
+
""
|
|
103148
|
+
].join(`
|
|
103149
|
+
`);
|
|
103150
|
+
}
|
|
103151
|
+
function startTelemetry(argv) {
|
|
103152
|
+
try {
|
|
103153
|
+
const state = readTelemetryState();
|
|
103154
|
+
if (telemetryDisabledReason(process14.env, state) !== null)
|
|
103155
|
+
return;
|
|
103156
|
+
if (argv[0] === "telemetry")
|
|
103157
|
+
return;
|
|
103158
|
+
if (!state.noticeShownAt && process14.stderr.isTTY) {
|
|
103159
|
+
process14.stderr.write(`${noticeText()}
|
|
103160
|
+
`);
|
|
103161
|
+
try {
|
|
103162
|
+
updateTelemetryState((current) => ({ ...current, noticeShownAt: new Date().toISOString() }), TELEMETRY_FILE, 0);
|
|
103163
|
+
} catch {}
|
|
103164
|
+
}
|
|
103165
|
+
const started = performance.now();
|
|
103166
|
+
const snapshot = [...argv];
|
|
103167
|
+
process14.once("exit", (code) => {
|
|
103168
|
+
try {
|
|
103169
|
+
if (telemetryDisabledReason(process14.env, readTelemetryState()) !== null)
|
|
103170
|
+
return;
|
|
103171
|
+
const event = buildEvent(snapshot, code, performance.now() - started);
|
|
103172
|
+
if (truthy(process14.env.BRAINBASE_TELEMETRY_DEBUG)) {
|
|
103173
|
+
process14.stderr.write(`[telemetry] ${JSON.stringify(event)}
|
|
103174
|
+
`);
|
|
103175
|
+
return;
|
|
103176
|
+
}
|
|
103177
|
+
sendDetached(event);
|
|
103178
|
+
} catch {}
|
|
103179
|
+
});
|
|
103180
|
+
} catch {}
|
|
103181
|
+
}
|
|
103182
|
+
function runTelemetry(sub) {
|
|
103183
|
+
switch (sub) {
|
|
103184
|
+
case "enable":
|
|
103185
|
+
case "disable": {
|
|
103186
|
+
const enabled = sub === "enable";
|
|
103187
|
+
if (!updateTelemetryState((current) => ({ ...current, enabled }))) {
|
|
103188
|
+
console.error(`Could not change ${TELEMETRY_FILE}: another brainbase process holds ${TELEMETRY_FILE}.lock. ` + "Try again, or remove that file if no brainbase command is running.");
|
|
103189
|
+
return 1;
|
|
103190
|
+
}
|
|
103191
|
+
console.log(enabled ? "Telemetry enabled." : "Telemetry disabled. Nothing more will be sent from this machine.");
|
|
103192
|
+
return 0;
|
|
103193
|
+
}
|
|
103194
|
+
case undefined:
|
|
103195
|
+
case "status": {
|
|
103196
|
+
const reason = telemetryDisabledReason(process14.env, readTelemetryState());
|
|
103197
|
+
const why = {
|
|
103198
|
+
env: "BRAINBASE_TELEMETRY_DISABLED is set",
|
|
103199
|
+
do_not_track: "DO_NOT_TRACK is set",
|
|
103200
|
+
config: "turned off with `brainbase telemetry disable`",
|
|
103201
|
+
sandbox: "running inside a Brainbase sandbox"
|
|
103202
|
+
};
|
|
103203
|
+
console.log(reason === null ? "Telemetry is on." : `Telemetry is off (${why[reason]}).`);
|
|
103204
|
+
console.log(noticeText().trim());
|
|
103205
|
+
return 0;
|
|
103206
|
+
}
|
|
103207
|
+
case "help":
|
|
103208
|
+
case "--help":
|
|
103209
|
+
case "-h":
|
|
103210
|
+
console.log("Usage: brainbase telemetry [status|enable|disable]");
|
|
103211
|
+
console.log(noticeText().trim());
|
|
103212
|
+
return 0;
|
|
103213
|
+
default:
|
|
103214
|
+
console.error(`Unknown telemetry subcommand: ${sub}
|
|
103215
|
+
Usage: brainbase telemetry [status|enable|disable]`);
|
|
103216
|
+
return 1;
|
|
103217
|
+
}
|
|
103218
|
+
}
|
|
103219
|
+
|
|
102643
103220
|
// src/index.ts
|
|
102644
103221
|
routeConsoleThroughStreams();
|
|
102645
103222
|
var PROTECTED = new Set([
|
|
@@ -102675,6 +103252,7 @@ var COMMANDS3 = [
|
|
|
102675
103252
|
"integrations",
|
|
102676
103253
|
"decide",
|
|
102677
103254
|
"run",
|
|
103255
|
+
"telemetry",
|
|
102678
103256
|
"help",
|
|
102679
103257
|
"version"
|
|
102680
103258
|
];
|
|
@@ -102684,224 +103262,226 @@ var SUBCOMMAND_OWNED_FLAGS = {
|
|
|
102684
103262
|
function help() {
|
|
102685
103263
|
const out = [];
|
|
102686
103264
|
out.push("");
|
|
102687
|
-
out.push(` ${brandTint("◆")} ${
|
|
102688
|
-
out.push(` ${
|
|
103265
|
+
out.push(` ${brandTint("◆")} ${import_picocolors87.default.bold("brainbase")} ${import_picocolors87.default.dim(`v${VERSION}`)}`);
|
|
103266
|
+
out.push(` ${import_picocolors87.default.dim("connect your local agent to the brainbase platform")}`);
|
|
102689
103267
|
out.push("");
|
|
102690
103268
|
out.push(divider("USAGE"));
|
|
102691
103269
|
out.push("");
|
|
102692
|
-
out.push(` ${
|
|
103270
|
+
out.push(` ${import_picocolors87.default.bold("brainbase")} ${import_picocolors87.default.dim("<command> [options]")}`);
|
|
102693
103271
|
out.push("");
|
|
102694
103272
|
out.push(divider("AUTH"));
|
|
102695
103273
|
out.push("");
|
|
102696
|
-
out.push(` ${
|
|
102697
|
-
out.push(` ${
|
|
102698
|
-
out.push(` ${
|
|
103274
|
+
out.push(` ${import_picocolors87.default.cyan("login")} ${import_picocolors87.default.dim(" open the web app and connect this device")}`);
|
|
103275
|
+
out.push(` ${import_picocolors87.default.cyan("logout")} ${import_picocolors87.default.dim(" clear the local session")}`);
|
|
103276
|
+
out.push(` ${import_picocolors87.default.cyan("whoami")} ${import_picocolors87.default.dim("[--json]")} ${import_picocolors87.default.dim(" show which credential is in use and what it covers")}`);
|
|
103277
|
+
out.push(` ${import_picocolors87.default.cyan("telemetry")} ${import_picocolors87.default.dim("[status|enable|disable]")} ${import_picocolors87.default.dim(" see or change usage data collection")}`);
|
|
102699
103278
|
out.push("");
|
|
102700
103279
|
out.push(divider("DISCOVERY"));
|
|
102701
103280
|
out.push("");
|
|
102702
|
-
out.push(` ${
|
|
102703
|
-
out.push(` ${
|
|
102704
|
-
out.push(` ${
|
|
103281
|
+
out.push(` ${import_picocolors87.default.cyan("team list")} ${import_picocolors87.default.dim("show the teams you can create agents in")}`);
|
|
103282
|
+
out.push(` ${import_picocolors87.default.cyan("member ls")} ${import_picocolors87.default.dim("show the people in an organization, with the emails interface access takes")}`);
|
|
103283
|
+
out.push(` ${import_picocolors87.default.cyan("agent list")} ${import_picocolors87.default.dim("show a team's agents and their ids")}`);
|
|
102705
103284
|
out.push("");
|
|
102706
103285
|
out.push(divider("LINKED AGENT"));
|
|
102707
103286
|
out.push("");
|
|
102708
|
-
out.push(` ${
|
|
102709
|
-
out.push(` ${
|
|
102710
|
-
out.push(` ${
|
|
102711
|
-
out.push(` ${
|
|
102712
|
-
out.push(` ${
|
|
102713
|
-
out.push(` ${
|
|
102714
|
-
out.push(` ${
|
|
102715
|
-
out.push(` ${
|
|
102716
|
-
out.push(` ${
|
|
102717
|
-
out.push(` ${
|
|
102718
|
-
out.push(` ${
|
|
102719
|
-
out.push(` ${
|
|
102720
|
-
out.push(` ${
|
|
102721
|
-
out.push(` ${
|
|
102722
|
-
out.push(` ${
|
|
102723
|
-
out.push(` ${
|
|
102724
|
-
out.push(` ${
|
|
102725
|
-
out.push(` ${
|
|
103287
|
+
out.push(` ${import_picocolors87.default.cyan("agent init")} ${import_picocolors87.default.dim("write a starter brainbase.agent.yaml here — offline, no login needed")}`);
|
|
103288
|
+
out.push(` ${import_picocolors87.default.cyan("agent create")} ${import_picocolors87.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
103289
|
+
out.push(` ${import_picocolors87.default.cyan("agent pull")} ${import_picocolors87.default.dim("[<id>]")} ${import_picocolors87.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint; --link to link first)")}`);
|
|
103290
|
+
out.push(` ${import_picocolors87.default.cyan("agent push")} ${import_picocolors87.default.dim("send local changes to the cloud (--force to overwrite cloud-side conflicts with local)")}`);
|
|
103291
|
+
out.push(` ${import_picocolors87.default.cyan("agent delete")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("permanently delete a cloud agent and every task it has run")}`);
|
|
103292
|
+
out.push(` ${import_picocolors87.default.cyan("agent unpack")} ${import_picocolors87.default.dim("install the claimed agent into a harness layout")}`);
|
|
103293
|
+
out.push(` ${import_picocolors87.default.cyan("link")} ${import_picocolors87.default.dim("attach this folder to an existing agent")}`);
|
|
103294
|
+
out.push(` ${import_picocolors87.default.cyan("agent status")} ${import_picocolors87.default.dim("show what would pull and what would push")}`);
|
|
103295
|
+
out.push(` ${import_picocolors87.default.cyan("agent connections")} ${import_picocolors87.default.dim("show which integrations this agent is wired to (--json for CI)")}`);
|
|
103296
|
+
out.push(` ${import_picocolors87.default.cyan("agent connect")} ${import_picocolors87.default.dim("<name>")} ${import_picocolors87.default.dim("connect chat, slack, meeting, github, linear or phone")}`);
|
|
103297
|
+
out.push(` ${import_picocolors87.default.cyan("agent disconnect")} ${import_picocolors87.default.dim("<name>")} ${import_picocolors87.default.dim("disable or disconnect an agent surface")}`);
|
|
103298
|
+
out.push(` ${import_picocolors87.default.cyan("agent surface")} ${import_picocolors87.default.dim("<name>")} ${import_picocolors87.default.dim("status, settings and setup for all six surfaces (--help)")}`);
|
|
103299
|
+
out.push(` ${import_picocolors87.default.cyan("agent versions")} ${import_picocolors87.default.dim("saved versions: list, show, diff, label, restore, pin and unpin (`agent versions --help`)")}`);
|
|
103300
|
+
out.push(` ${import_picocolors87.default.cyan("agent eval")} ${import_picocolors87.default.dim("<list|runs>")} ${import_picocolors87.default.dim("read eval definitions and judge verdicts (`agent eval --help`)")}`);
|
|
103301
|
+
out.push(` ${import_picocolors87.default.cyan("agent env")} ${import_picocolors87.default.dim("print export lines for `eval $(brainbase agent env)`")}`);
|
|
103302
|
+
out.push(` ${import_picocolors87.default.cyan("run")} ${import_picocolors87.default.dim("<cmd> [args...]")} ${import_picocolors87.default.dim("run <cmd> with secrets.env loaded into env")}`);
|
|
103303
|
+
out.push(` ${import_picocolors87.default.cyan("status")} ${import_picocolors87.default.dim("show what this folder is linked to")}`);
|
|
103304
|
+
out.push(` ${import_picocolors87.default.cyan("unlink")} ${import_picocolors87.default.dim("disconnect this folder")}`);
|
|
102726
103305
|
out.push("");
|
|
102727
103306
|
out.push(divider("TASKS"));
|
|
102728
103307
|
out.push("");
|
|
102729
|
-
out.push(` ${
|
|
102730
|
-
out.push(` ${
|
|
102731
|
-
out.push(` ${
|
|
102732
|
-
out.push(` ${
|
|
102733
|
-
out.push(` ${
|
|
102734
|
-
out.push(` ${
|
|
102735
|
-
out.push(` ${
|
|
102736
|
-
out.push(` ${
|
|
103308
|
+
out.push(` ${import_picocolors87.default.cyan("task create")} ${import_picocolors87.default.dim("--message <text>")} ${import_picocolors87.default.dim("create a managed task and start its first run (--wait to block on it; --interface <id> for a build conversation)")}`);
|
|
103309
|
+
out.push(` ${import_picocolors87.default.cyan("task list")} ${import_picocolors87.default.dim("recent tasks you can reach (--metadata k=v to filter by label; --interface <id> for its build conversations)")}`);
|
|
103310
|
+
out.push(` ${import_picocolors87.default.cyan("task get")} ${import_picocolors87.default.dim("<task-id>")} ${import_picocolors87.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
103311
|
+
out.push(` ${import_picocolors87.default.cyan("task logs")} ${import_picocolors87.default.dim("<task-id> [--follow]")} ${import_picocolors87.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
103312
|
+
out.push(` ${import_picocolors87.default.cyan("task send")} ${import_picocolors87.default.dim("<task-id> <message>")} ${import_picocolors87.default.dim("send a follow-up during execution, or queue it for the next turn")}`);
|
|
103313
|
+
out.push(` ${import_picocolors87.default.cyan("task stop")} ${import_picocolors87.default.dim("<task-id>")} ${import_picocolors87.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
103314
|
+
out.push(` ${import_picocolors87.default.cyan("task update")} ${import_picocolors87.default.dim("<task-id>")} ${import_picocolors87.default.dim("rename a task, change its metadata labels, switch its model or reset it to the agent default, including while it runs")}`);
|
|
103315
|
+
out.push(` ${import_picocolors87.default.cyan("task delete")} ${import_picocolors87.default.dim("<task-id>")} ${import_picocolors87.default.dim("permanently delete a stopped task and tear down its sandbox")}`);
|
|
102737
103316
|
out.push("");
|
|
102738
103317
|
out.push(divider("INTERFACES"));
|
|
102739
103318
|
out.push("");
|
|
102740
|
-
out.push(` ${
|
|
102741
|
-
out.push(` ${
|
|
102742
|
-
out.push(` ${
|
|
102743
|
-
out.push(` ${
|
|
102744
|
-
out.push(` ${
|
|
102745
|
-
out.push(` ${
|
|
102746
|
-
out.push(` ${
|
|
103319
|
+
out.push(` ${import_picocolors87.default.cyan("interface ls")} ${import_picocolors87.default.dim("dashboards you can see (--agent to narrow)")}`);
|
|
103320
|
+
out.push(` ${import_picocolors87.default.cyan("interface create")} ${import_picocolors87.default.dim("--name <n>")} ${import_picocolors87.default.dim("create one on an agent, with who can open it")}`);
|
|
103321
|
+
out.push(` ${import_picocolors87.default.cyan("interface build")} ${import_picocolors87.default.dim('<id> "<ask>"')} ${import_picocolors87.default.dim("describe a change; the agent builds it while you watch")}`);
|
|
103322
|
+
out.push(` ${import_picocolors87.default.cyan("interface publish")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("make the newest succeeded build live")}`);
|
|
103323
|
+
out.push(` ${import_picocolors87.default.cyan("interface rollback")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("republish an earlier release under a new id (--release <id>)")}`);
|
|
103324
|
+
out.push(` ${import_picocolors87.default.cyan("interface access")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("show or set who can open it")}`);
|
|
103325
|
+
out.push(` ${import_picocolors87.default.cyan("interface --help")} ${import_picocolors87.default.dim("every interface subcommand")}`);
|
|
102747
103326
|
out.push("");
|
|
102748
103327
|
out.push(divider("SANDBOXES"));
|
|
102749
103328
|
out.push("");
|
|
102750
|
-
out.push(` ${
|
|
102751
|
-
out.push(` ${
|
|
103329
|
+
out.push(` ${import_picocolors87.default.cyan("machine ls")} ${import_picocolors87.default.dim("[--all]")} ${import_picocolors87.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
103330
|
+
out.push(` ${import_picocolors87.default.cyan("machine rm")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("tear a sandbox down (it bills until you do)")}`);
|
|
102752
103331
|
out.push("");
|
|
102753
103332
|
out.push(divider("BENCHMARKS"));
|
|
102754
103333
|
out.push("");
|
|
102755
|
-
out.push(` ${
|
|
102756
|
-
out.push(` ${
|
|
102757
|
-
out.push(` ${
|
|
102758
|
-
out.push(` ${
|
|
102759
|
-
out.push(` ${
|
|
103334
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark list")} ${import_picocolors87.default.dim("list benchmarks for the linked agent")}`);
|
|
103335
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark init")} ${import_picocolors87.default.dim("[directory]")} ${import_picocolors87.default.dim("scaffold a local benchmark")}`);
|
|
103336
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark create")} ${import_picocolors87.default.dim("[path|-]")} ${import_picocolors87.default.dim("create a benchmark draft")}`);
|
|
103337
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark run")} ${import_picocolors87.default.dim("<benchmark> --yes")} ${import_picocolors87.default.dim("plan and start a benchmark run")}`);
|
|
103338
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark results")} ${import_picocolors87.default.dim("<run>")} ${import_picocolors87.default.dim("inspect normalized benchmark results")}`);
|
|
102760
103339
|
out.push("");
|
|
102761
103340
|
out.push(divider("BENCHMARK RUNTIME"));
|
|
102762
103341
|
out.push("");
|
|
102763
|
-
out.push(` ${
|
|
102764
|
-
out.push(` ${
|
|
102765
|
-
out.push(` ${
|
|
103342
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark hydrate")} ${import_picocolors87.default.dim("--spec <path> --result <path> --json")}`);
|
|
103343
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark evaluate")} ${import_picocolors87.default.dim("--spec <path> --result <path> --json")}`);
|
|
103344
|
+
out.push(` ${import_picocolors87.default.cyan("benchmark capabilities")} ${import_picocolors87.default.dim("--json")}`);
|
|
102766
103345
|
out.push("");
|
|
102767
103346
|
out.push(divider("ORCHESTRATIONS"));
|
|
102768
103347
|
out.push("");
|
|
102769
|
-
out.push(` ${
|
|
102770
|
-
out.push(` ${
|
|
102771
|
-
out.push(` ${
|
|
102772
|
-
out.push(` ${
|
|
102773
|
-
out.push(` ${
|
|
102774
|
-
out.push(` ${
|
|
102775
|
-
out.push(` ${
|
|
102776
|
-
out.push(` ${
|
|
103348
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration init")} ${import_picocolors87.default.dim("write a starter brainbase-orchestration.yaml here (offline, no login)")}`);
|
|
103349
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration create")} ${import_picocolors87.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
103350
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration from-agent")} ${import_picocolors87.default.dim("turn an existing agent into an orchestration")}`);
|
|
103351
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration list")} ${import_picocolors87.default.dim("list orchestrations under a team")}`);
|
|
103352
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration pull")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("recursively fetch an orchestration + every member agent (--force to discard local concurrency edits)")}`);
|
|
103353
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration push")} ${import_picocolors87.default.dim("recursively push each member, then update the graph")}`);
|
|
103354
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration status")} ${import_picocolors87.default.dim("show what would push and what would pull")}`);
|
|
103355
|
+
out.push(` ${import_picocolors87.default.cyan("orchestration delete")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("permanently delete an orchestration graph (member agents are kept)")}`);
|
|
102777
103356
|
out.push("");
|
|
102778
103357
|
out.push(divider("TEMPLATES"));
|
|
102779
103358
|
out.push("");
|
|
102780
|
-
out.push(` ${
|
|
102781
|
-
out.push(` ${
|
|
102782
|
-
out.push(` ${
|
|
102783
|
-
out.push(` ${
|
|
102784
|
-
out.push(` ${
|
|
102785
|
-
out.push(` ${
|
|
102786
|
-
out.push(` ${
|
|
103359
|
+
out.push(` ${import_picocolors87.default.cyan("template pack")} ${import_picocolors87.default.dim("bundle the current agent into a template")}`);
|
|
103360
|
+
out.push(` ${import_picocolors87.default.cyan("template publish")} ${import_picocolors87.default.dim("upload a template to the registry")}`);
|
|
103361
|
+
out.push(` ${import_picocolors87.default.cyan("template search")} ${import_picocolors87.default.dim("[query]")} ${import_picocolors87.default.dim("search the registry")}`);
|
|
103362
|
+
out.push(` ${import_picocolors87.default.cyan("template info")} ${import_picocolors87.default.dim("<creator/slug>")} ${import_picocolors87.default.dim("show registry details for a template")}`);
|
|
103363
|
+
out.push(` ${import_picocolors87.default.cyan("template onboard")} ${import_picocolors87.default.dim("<creator/slug>")} ${import_picocolors87.default.dim("install (or refresh) a template")}`);
|
|
103364
|
+
out.push(` ${import_picocolors87.default.cyan("template list")} ${import_picocolors87.default.dim("show installed templates")}`);
|
|
103365
|
+
out.push(` ${import_picocolors87.default.cyan("template remove")} ${import_picocolors87.default.dim("<creator/slug>")} ${import_picocolors87.default.dim("uninstall a template")}`);
|
|
102787
103366
|
out.push("");
|
|
102788
103367
|
out.push(divider("SKILLS"));
|
|
102789
103368
|
out.push("");
|
|
102790
|
-
out.push(` ${
|
|
102791
|
-
out.push(` ${
|
|
102792
|
-
out.push(` ${
|
|
102793
|
-
out.push(` ${
|
|
102794
|
-
out.push(` ${
|
|
102795
|
-
out.push(` ${
|
|
102796
|
-
out.push(` ${
|
|
103369
|
+
out.push(` ${import_picocolors87.default.cyan("skill add")} ${import_picocolors87.default.dim("<source>")} ${import_picocolors87.default.dim("install a skill (github / git / brainbase)")}`);
|
|
103370
|
+
out.push(` ${import_picocolors87.default.cyan("skill list")} ${import_picocolors87.default.dim("show locally installed skills + their source")}`);
|
|
103371
|
+
out.push(` ${import_picocolors87.default.cyan("skill update")} ${import_picocolors87.default.dim("<slug>")} ${import_picocolors87.default.dim("re-fetch a skill from its recorded source")}`);
|
|
103372
|
+
out.push(` ${import_picocolors87.default.cyan("skill remove")} ${import_picocolors87.default.dim("<slug>")} ${import_picocolors87.default.dim("uninstall a skill")}`);
|
|
103373
|
+
out.push(` ${import_picocolors87.default.cyan("skill search")} ${import_picocolors87.default.dim("[query]")} ${import_picocolors87.default.dim("search the brainbase skill registry")}`);
|
|
103374
|
+
out.push(` ${import_picocolors87.default.cyan("skill info")} ${import_picocolors87.default.dim("<creator/slug>")} ${import_picocolors87.default.dim("show registry details for a skill")}`);
|
|
103375
|
+
out.push(` ${import_picocolors87.default.cyan("skill publish")} ${import_picocolors87.default.dim("[dir]")} ${import_picocolors87.default.dim("publish a SKILL.md folder (defaults to .)")}`);
|
|
102797
103376
|
out.push("");
|
|
102798
103377
|
out.push(divider("CLI TOKENS"));
|
|
102799
103378
|
out.push("");
|
|
102800
|
-
out.push(` ${
|
|
102801
|
-
out.push(` ${
|
|
102802
|
-
out.push(` ${
|
|
102803
|
-
out.push(` ${
|
|
103379
|
+
out.push(` ${import_picocolors87.default.cyan("token create")} ${import_picocolors87.default.dim("issue a long-lived CLI key for CI / scripts")}`);
|
|
103380
|
+
out.push(` ${import_picocolors87.default.cyan("token list")} ${import_picocolors87.default.dim("show your tokens")}`);
|
|
103381
|
+
out.push(` ${import_picocolors87.default.cyan("token rename")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("relabel a token")}`);
|
|
103382
|
+
out.push(` ${import_picocolors87.default.cyan("token revoke")} ${import_picocolors87.default.dim("<id>")} ${import_picocolors87.default.dim("revoke a token")}`);
|
|
102804
103383
|
out.push("");
|
|
102805
103384
|
out.push(divider("DECISIONS"));
|
|
102806
103385
|
out.push("");
|
|
102807
|
-
out.push(` ${
|
|
103386
|
+
out.push(` ${import_picocolors87.default.cyan("decide")} ${import_picocolors87.default.dim("-q <questions.json> <sources...>")} ${import_picocolors87.default.dim("answer decision-model questions over many files or rows in a few requests (`decide --help`)")}`);
|
|
102808
103387
|
out.push("");
|
|
102809
103388
|
out.push(divider("MCP"));
|
|
102810
103389
|
out.push("");
|
|
102811
|
-
out.push(` ${
|
|
102812
|
-
out.push(` ${
|
|
102813
|
-
out.push(` ${
|
|
102814
|
-
out.push(` ${
|
|
102815
|
-
out.push(` ${
|
|
102816
|
-
out.push(` ${
|
|
102817
|
-
out.push(` ${
|
|
103390
|
+
out.push(` ${import_picocolors87.default.cyan("mcp check")} ${import_picocolors87.default.dim("[--json]")} ${import_picocolors87.default.dim("verify MCP server connectivity through the brainbase proxy (runs at sandbox bootstrap)")}`);
|
|
103391
|
+
out.push(` ${import_picocolors87.default.cyan("mcp list")} ${import_picocolors87.default.dim("[--json]")} ${import_picocolors87.default.dim("show configured servers with OAuth state and expiry")}`);
|
|
103392
|
+
out.push(` ${import_picocolors87.default.cyan("mcp connect")} ${import_picocolors87.default.dim("<name>")} ${import_picocolors87.default.dim("authorize an OAuth-backed server: prints a single-use link, opens it, waits for approval")}`);
|
|
103393
|
+
out.push(` ${import_picocolors87.default.cyan("mcp tools")} ${import_picocolors87.default.dim("<server>")} ${import_picocolors87.default.dim("list a server's tools, including the built-in slack connector (--agent <id>)")}`);
|
|
103394
|
+
out.push(` ${import_picocolors87.default.cyan("mcp call")} ${import_picocolors87.default.dim("<server> <tool>")} ${import_picocolors87.default.dim("call a tool with --args '<json>', --args-file <path> or JSON on stdin; writes need --yes with no terminal")}`);
|
|
103395
|
+
out.push(` ${import_picocolors87.default.cyan("mcp search")} ${import_picocolors87.default.dim("<query>")} ${import_picocolors87.default.dim("find MCP servers in the registry, Pipedream and Brainbase (--source, --limit)")}`);
|
|
103396
|
+
out.push(` ${import_picocolors87.default.cyan("mcp add")} ${import_picocolors87.default.dim("<registry-name>")} ${import_picocolors87.default.dim("add a registry server to brainbase.agent.yaml (--name); then agent push")}`);
|
|
102818
103397
|
out.push("");
|
|
102819
103398
|
out.push(divider("INTEGRATIONS"));
|
|
102820
103399
|
out.push("");
|
|
102821
|
-
out.push(` ${
|
|
102822
|
-
out.push(` ${
|
|
102823
|
-
out.push(` ${
|
|
102824
|
-
out.push(` ${
|
|
102825
|
-
out.push(` ${
|
|
102826
|
-
out.push(` ${
|
|
102827
|
-
out.push(` ${
|
|
102828
|
-
out.push(` ${
|
|
102829
|
-
out.push(` ${
|
|
102830
|
-
out.push(` ${
|
|
103400
|
+
out.push(` ${import_picocolors87.default.cyan("integrations list")} ${import_picocolors87.default.dim("show the agent's Pipedream apps, accounts and app-level permission")}`);
|
|
103401
|
+
out.push(` ${import_picocolors87.default.cyan("integrations search")} ${import_picocolors87.default.dim("<query>")} ${import_picocolors87.default.dim("find apps in the Pipedream catalog")}`);
|
|
103402
|
+
out.push(` ${import_picocolors87.default.cyan("integrations actions")} ${import_picocolors87.default.dim("<app>")} ${import_picocolors87.default.dim("list an app's actions and whether each is allowed")}`);
|
|
103403
|
+
out.push(` ${import_picocolors87.default.cyan("integrations add")} ${import_picocolors87.default.dim("<app>")} ${import_picocolors87.default.dim("install an app; one that needs an account runs connect")}`);
|
|
103404
|
+
out.push(` ${import_picocolors87.default.cyan("integrations connect")} ${import_picocolors87.default.dim("<app>")} ${import_picocolors87.default.dim("open Pipedream's connect page for the app and wait for the account")}`);
|
|
103405
|
+
out.push(` ${import_picocolors87.default.cyan("integrations disconnect")} ${import_picocolors87.default.dim("<app>")} ${import_picocolors87.default.dim("delete the app's connected account")}`);
|
|
103406
|
+
out.push(` ${import_picocolors87.default.cyan("integrations remove")} ${import_picocolors87.default.dim("<app>")} ${import_picocolors87.default.dim("uninstall an app that needs no account")}`);
|
|
103407
|
+
out.push(` ${import_picocolors87.default.cyan("integrations allow|ask|deny")} ${import_picocolors87.default.dim("<app>[.<action>]")} ${import_picocolors87.default.dim("set the permission for an app or one of its actions")}`);
|
|
103408
|
+
out.push(` ${import_picocolors87.default.cyan("integrations context create")} ${import_picocolors87.default.dim("--application <name>")} ${import_picocolors87.default.dim("let a program outside Brainbase (the SDK) use the agent's integrations; prints a renewal handle once")}`);
|
|
103409
|
+
out.push(` ${import_picocolors87.default.cyan("integrations context end")} ${import_picocolors87.default.dim("<context-id>")} ${import_picocolors87.default.dim("end a standalone integration context now")}`);
|
|
102831
103410
|
out.push("");
|
|
102832
103411
|
out.push(divider("FLAGS"));
|
|
102833
103412
|
out.push("");
|
|
102834
|
-
out.push(` ${
|
|
102835
|
-
out.push(` ${
|
|
102836
|
-
out.push(` ${
|
|
103413
|
+
out.push(` ${import_picocolors87.default.dim("--harness <id>")} force harness for onboard / sync (e.g. claude-code)`);
|
|
103414
|
+
out.push(` ${import_picocolors87.default.dim("--scope <s>")} force scope: global | project`);
|
|
103415
|
+
out.push(` ${import_picocolors87.default.dim("--yes, -y")} skip confirmations / auto-overwrite`);
|
|
102837
103416
|
out.push(` ${" ".repeat("--yes, -y".length)} required for destructive commands with no terminal (pipes, CI)`);
|
|
102838
|
-
out.push(` ${
|
|
102839
|
-
out.push(` ${
|
|
102840
|
-
out.push(` ${
|
|
102841
|
-
out.push(` ${
|
|
102842
|
-
out.push(` ${
|
|
102843
|
-
out.push(` ${
|
|
102844
|
-
out.push(` ${
|
|
102845
|
-
out.push(` ${
|
|
102846
|
-
out.push(` ${
|
|
102847
|
-
out.push(` ${
|
|
102848
|
-
out.push(` ${
|
|
102849
|
-
out.push(` ${
|
|
102850
|
-
out.push(` ${
|
|
102851
|
-
out.push(` ${
|
|
102852
|
-
out.push(` ${
|
|
102853
|
-
out.push(` ${
|
|
102854
|
-
out.push(` ${
|
|
102855
|
-
out.push(` ${
|
|
102856
|
-
out.push(` ${
|
|
102857
|
-
out.push(` ${
|
|
102858
|
-
out.push(` ${
|
|
102859
|
-
out.push(` ${
|
|
102860
|
-
out.push(` ${
|
|
102861
|
-
out.push(` ${
|
|
102862
|
-
out.push(` ${
|
|
102863
|
-
out.push(` ${
|
|
102864
|
-
out.push(` ${
|
|
102865
|
-
out.push(` ${
|
|
102866
|
-
out.push(` ${
|
|
102867
|
-
out.push(` ${
|
|
102868
|
-
out.push(` ${
|
|
102869
|
-
out.push(` ${
|
|
102870
|
-
out.push(` ${
|
|
102871
|
-
out.push(` ${
|
|
102872
|
-
out.push(` ${
|
|
102873
|
-
out.push(` ${
|
|
102874
|
-
out.push(` ${
|
|
103417
|
+
out.push(` ${import_picocolors87.default.dim("--agent <id>")} for link/task create/mcp list/connect/tools/call/integrations: use this agent id explicitly instead of the linked folder's (task list: filter to it)`);
|
|
103418
|
+
out.push(` ${import_picocolors87.default.dim("--message <text>")} for task create: required first user message`);
|
|
103419
|
+
out.push(` ${import_picocolors87.default.dim("--title <text>")} for task create: optional task title; for task update: the new title`);
|
|
103420
|
+
out.push(` ${import_picocolors87.default.dim("--clear-title")} for task update: remove the title (automatic titling may name it again later)`);
|
|
103421
|
+
out.push(` ${import_picocolors87.default.dim("--metadata k=v")} for task create: label the task; for task list: only tasks with this label; for task update: set one label, keeping the others (all repeatable)`);
|
|
103422
|
+
out.push(` ${import_picocolors87.default.dim("--unset-metadata <k>")} for task update: remove one label (repeatable)`);
|
|
103423
|
+
out.push(` ${import_picocolors87.default.dim("--clear-metadata")} for task update: remove every label; with --metadata, keep only those given`);
|
|
103424
|
+
out.push(` ${import_picocolors87.default.dim("--model <id>")} for task create: optional model override; for task update: switch the model the task's next turn runs on (the running turn keeps its model)`);
|
|
103425
|
+
out.push(` ${import_picocolors87.default.dim("--clear-model")} for task update: go back to the agent's default model from the next turn`);
|
|
103426
|
+
out.push(` ${import_picocolors87.default.dim("--version <v>")} for task create: run a saved version of the agent (12, v12 or a version id)`);
|
|
103427
|
+
out.push(` ${import_picocolors87.default.dim("--wait")} for task create: block until the task finishes; exit 1 unless it succeeded`);
|
|
103428
|
+
out.push(` ${import_picocolors87.default.dim("--timeout <secs>")} for task create --wait: give up after <secs> and exit 1`);
|
|
103429
|
+
out.push(` ${import_picocolors87.default.dim("--limit <n>")} for task list (1-200), task logs (events to print; with --follow, the first page size) and machine ls`);
|
|
103430
|
+
out.push(` ${import_picocolors87.default.dim("--follow, -f")} for task logs: stay attached and print events as they land`);
|
|
103431
|
+
out.push(` ${import_picocolors87.default.dim("--org <id-or-slug>")} pick the organization (team/agent list, agent create, orchestration create/list)`);
|
|
103432
|
+
out.push(` ${import_picocolors87.default.dim("--team <id>")} pick the team, same commands (works without --org)`);
|
|
103433
|
+
out.push(` ${import_picocolors87.default.dim("--all-teams")} for agent list: every team in the org (the default with no terminal)`);
|
|
103434
|
+
out.push(` ${import_picocolors87.default.dim("--json")} machine-readable output for supported commands`);
|
|
103435
|
+
out.push(` ${import_picocolors87.default.dim("--no-tracking")} for link / agent pull --link: skip routing LLM traffic through brainbase`);
|
|
103436
|
+
out.push(` ${import_picocolors87.default.dim("--link")} for agent pull: link this folder to the agent first, as \`brainbase link --agent <id> --yes\` would, in one process`);
|
|
103437
|
+
out.push(` ${import_picocolors87.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
103438
|
+
out.push(` ${import_picocolors87.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
103439
|
+
out.push(` ${import_picocolors87.default.dim("--bot-token <t>")} for agent connect slack (or BRAINBASE_SLACK_BOT_TOKEN, or stdin); without one, a setup link opens instead`);
|
|
103440
|
+
out.push(` ${import_picocolors87.default.dim("--signing-secret <s>")} for agent connect slack (or BRAINBASE_SLACK_SIGNING_SECRET, or stdin)`);
|
|
103441
|
+
out.push(` ${import_picocolors87.default.dim("--bot-name <name>")} for agent connect meeting: the bot's display name`);
|
|
103442
|
+
out.push(` ${import_picocolors87.default.dim("--app-id <id> / --app-name <name>")} optional Slack app identity`);
|
|
103443
|
+
out.push(` ${import_picocolors87.default.dim("--bot-image-url <url>")} optional meeting bot image`);
|
|
103444
|
+
out.push(` ${import_picocolors87.default.dim("--full")} for agent/orchestration init: write a commented template covering every block`);
|
|
103445
|
+
out.push(` ${import_picocolors87.default.dim("--minimal")} for agent init: write the starter manifest (the default)`);
|
|
103446
|
+
out.push(` ${import_picocolors87.default.dim("--all")} for template list: include installs from other folders; for machine ls: include torn-down machines`);
|
|
103447
|
+
out.push(` ${import_picocolors87.default.dim("--web <url>")} for login: web app URL (default https://app.brainbaselabs.com)`);
|
|
103448
|
+
out.push(` ${import_picocolors87.default.dim("--no-open")} for mcp/integrations/slack connect: print the link without opening a browser (implied with no terminal)`);
|
|
103449
|
+
out.push(` ${import_picocolors87.default.dim("--no-wait")} for mcp/integrations/slack connect: print the link and exit instead of waiting`);
|
|
103450
|
+
out.push(` ${import_picocolors87.default.dim("--account <id>")} for integrations disconnect: which account, when the app has more than one`);
|
|
103451
|
+
out.push(` ${import_picocolors87.default.dim("--application <name>")} for integrations context create: names the program the context is for`);
|
|
103452
|
+
out.push(` ${import_picocolors87.default.dim("--max-lifetime <dur>")} for integrations context create: when the context ends at the latest, 60s-30d (default 7d)`);
|
|
103453
|
+
out.push(` ${import_picocolors87.default.dim("--reason <text>")} for integrations context end: recorded with the context`);
|
|
102875
103454
|
out.push("");
|
|
102876
103455
|
out.push(divider("ENV"));
|
|
102877
103456
|
out.push("");
|
|
102878
|
-
out.push(` ${
|
|
102879
|
-
out.push(` ${
|
|
103457
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_HOME")} override the local config dir (default ~/.brainbase)`);
|
|
103458
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_DEBUG")} print full stack traces on error (any value; unset to disable)`);
|
|
102880
103459
|
if (httpRetryEnabled())
|
|
102881
|
-
out.push(` ${
|
|
102882
|
-
out.push(` ${
|
|
102883
|
-
out.push(` ${
|
|
102884
|
-
out.push(` ${
|
|
102885
|
-
out.push(` ${
|
|
102886
|
-
out.push(` ${
|
|
102887
|
-
out.push(` ${
|
|
102888
|
-
out.push(` ${
|
|
102889
|
-
out.push(` ${
|
|
102890
|
-
out.push(` ${
|
|
103460
|
+
out.push(` ${import_picocolors87.default.dim("--debug")} print stack traces and the full error cause chain`);
|
|
103461
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_WEB_URL")} override the web app URL used by login, console links and integrations`);
|
|
103462
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_CONTROL_PLANE_URL")} override the MAS host (/v2/cli; task and interface commands use /v2/tasks and /v2/interfaces)`);
|
|
103463
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_API_URL")} legacy KLS host override (uses /api/cli; proxy/registry fallback)`);
|
|
103464
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_PROXY_URL")} override the model-proxy URL used by harness traffic (default https://api.v1.brainbaselabs.com)`);
|
|
103465
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_REGISTRY_URL")} override the registry API URL (default https://api.v1.brainbaselabs.com)`);
|
|
103466
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_TOKEN")} long-lived CLI PAT; outranks the login session and the PAT saved in token.json`);
|
|
103467
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_SKIP_AUTH")} bypass the auth gate for development`);
|
|
103468
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_NON_INTERACTIVE")} force non-interactive mode — skip/auto-default prompts (CI & agents)`);
|
|
103469
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_RUN_ENTRYPOINT")} =1 → agent pull executes the agent entrypoint (sandbox boots; or pass --run-entrypoint)`);
|
|
103470
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_TELEMETRY_DISABLED")} =1 → send no usage data (also DO_NOT_TRACK=1, or brainbase telemetry disable)`);
|
|
102891
103471
|
out.push("");
|
|
102892
|
-
out.push(` ${
|
|
102893
|
-
out.push(` ${
|
|
102894
|
-
out.push(` ${
|
|
102895
|
-
out.push(` ${
|
|
102896
|
-
out.push(` ${
|
|
102897
|
-
out.push(` ${
|
|
102898
|
-
out.push(` ${
|
|
103472
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_MEMORY_MCP_URL")} override the built-in memory MCP host`);
|
|
103473
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_BROWSER_MCP_URL")} override the built-in browser MCP host`);
|
|
103474
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_SLACK_MCP_URL")} override the built-in Slack MCP host`);
|
|
103475
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_MEETING_MCP_URL")} override the built-in meeting MCP host`);
|
|
103476
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_GITHUB_MCP_URL")} override the built-in GitHub MCP host`);
|
|
103477
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_LINEAR_MCP_URL")} override the built-in Linear MCP host`);
|
|
103478
|
+
out.push(` ${import_picocolors87.default.dim("BRAINBASE_ORCHESTRATION_MCP_URL")} override the built-in orchestration MCP host`);
|
|
102899
103479
|
out.push("");
|
|
102900
103480
|
out.push(divider("HARNESSES"));
|
|
102901
103481
|
out.push("");
|
|
102902
|
-
out.push(` ${
|
|
102903
|
-
out.push(` ${
|
|
102904
|
-
out.push(` ${
|
|
103482
|
+
out.push(` ${import_picocolors87.default.dim("•")} ${import_picocolors87.default.bold("claude-code")} ${import_picocolors87.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
103483
|
+
out.push(` ${import_picocolors87.default.dim("•")} ${import_picocolors87.default.bold("codex")} ${import_picocolors87.default.dim("skills, mcps, commands, playbooks, instructions, files")}`);
|
|
103484
|
+
out.push(` ${import_picocolors87.default.dim("•")} ${import_picocolors87.default.bold("kafka")} ${import_picocolors87.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
102905
103485
|
out.push("");
|
|
102906
103486
|
console.log(out.join(`
|
|
102907
103487
|
`));
|
|
@@ -103034,9 +103614,9 @@ function hasFlag2(args, ...names) {
|
|
|
103034
103614
|
async function requireAuth(cmd) {
|
|
103035
103615
|
if (!PROTECTED.has(cmd))
|
|
103036
103616
|
return;
|
|
103037
|
-
if (
|
|
103617
|
+
if (process15.env.BRAINBASE_SKIP_AUTH === "1")
|
|
103038
103618
|
return;
|
|
103039
|
-
const envToken =
|
|
103619
|
+
const envToken = process15.env.BRAINBASE_TOKEN;
|
|
103040
103620
|
if (envToken && envToken.trim())
|
|
103041
103621
|
return;
|
|
103042
103622
|
let status = authStatus();
|
|
@@ -103059,15 +103639,15 @@ async function requireAuth(cmd) {
|
|
|
103059
103639
|
if (storedPatFor(status.session))
|
|
103060
103640
|
return;
|
|
103061
103641
|
console.error("");
|
|
103062
|
-
console.error(` ${brandTint("◆")} ${
|
|
103642
|
+
console.error(` ${brandTint("◆")} ${import_picocolors87.default.bold("brainbase")}`);
|
|
103063
103643
|
console.error("");
|
|
103064
|
-
console.error(` ${
|
|
103065
|
-
console.error(` ${
|
|
103644
|
+
console.error(` ${import_picocolors87.default.red("✗")} You need to sign in to use ${import_picocolors87.default.bold("brainbase " + cmd)}.`);
|
|
103645
|
+
console.error(` ${import_picocolors87.default.dim(noUsableCredentialMessage())}`);
|
|
103066
103646
|
console.error("");
|
|
103067
|
-
|
|
103647
|
+
process15.exit(1);
|
|
103068
103648
|
}
|
|
103069
103649
|
async function main() {
|
|
103070
|
-
const argv =
|
|
103650
|
+
const argv = process15.argv.slice(2);
|
|
103071
103651
|
const separator = argv.indexOf("--");
|
|
103072
103652
|
const debugIndex = argv.findIndex((arg, index) => arg === "--debug" && !isValueOfPriorFlag2(argv, index) && (separator < 0 || index < separator));
|
|
103073
103653
|
const debug = httpRetryEnabled() && argv[0] !== "run" && debugIndex >= 0;
|
|
@@ -103075,11 +103655,12 @@ async function main() {
|
|
|
103075
103655
|
argv.splice(debugIndex, 1);
|
|
103076
103656
|
enableDebugOutput();
|
|
103077
103657
|
}
|
|
103658
|
+
startTelemetry(argv);
|
|
103078
103659
|
const cmd = argv.shift();
|
|
103079
|
-
const rawCwd =
|
|
103660
|
+
const rawCwd = process15.cwd();
|
|
103080
103661
|
const cwd2 = (() => {
|
|
103081
103662
|
try {
|
|
103082
|
-
return
|
|
103663
|
+
return fs98.realpathSync(rawCwd);
|
|
103083
103664
|
} catch {
|
|
103084
103665
|
return rawCwd;
|
|
103085
103666
|
}
|
|
@@ -103169,6 +103750,10 @@ async function main() {
|
|
|
103169
103750
|
await runWhoami({ json: jsonFlag });
|
|
103170
103751
|
break;
|
|
103171
103752
|
}
|
|
103753
|
+
case "telemetry": {
|
|
103754
|
+
process15.exitCode = runTelemetry(argv.shift());
|
|
103755
|
+
break;
|
|
103756
|
+
}
|
|
103172
103757
|
case "template": {
|
|
103173
103758
|
const sub = argv.shift();
|
|
103174
103759
|
await runTemplate(cwd2, sub, argv, {
|
|
@@ -103289,7 +103874,7 @@ async function main() {
|
|
|
103289
103874
|
}
|
|
103290
103875
|
case "benchmark": {
|
|
103291
103876
|
const sub = argv.shift();
|
|
103292
|
-
|
|
103877
|
+
process15.exitCode = await runBenchmark(sub, argv, undefined, cwd2);
|
|
103293
103878
|
break;
|
|
103294
103879
|
}
|
|
103295
103880
|
case "orchestration":
|
|
@@ -103330,17 +103915,17 @@ async function main() {
|
|
|
103330
103915
|
noOpen: noOpenFlag,
|
|
103331
103916
|
noWait: noWaitFlag
|
|
103332
103917
|
});
|
|
103333
|
-
|
|
103918
|
+
process15.exitCode = code;
|
|
103334
103919
|
break;
|
|
103335
103920
|
}
|
|
103336
103921
|
case "decide": {
|
|
103337
|
-
|
|
103922
|
+
process15.exitCode = await runDecide(cwd2, argv);
|
|
103338
103923
|
break;
|
|
103339
103924
|
}
|
|
103340
103925
|
case "integration":
|
|
103341
103926
|
case "integrations": {
|
|
103342
103927
|
const sub = argv.shift();
|
|
103343
|
-
|
|
103928
|
+
process15.exitCode = await runIntegrations(cwd2, sub, argv, {
|
|
103344
103929
|
agentId: agentFlag,
|
|
103345
103930
|
json: jsonFlag,
|
|
103346
103931
|
yes: yes2,
|
|
@@ -103354,20 +103939,20 @@ async function main() {
|
|
|
103354
103939
|
console.error(`Unknown command: ${cmd}
|
|
103355
103940
|
${didYouMean(cmd, COMMANDS3, "brainbase")}`);
|
|
103356
103941
|
help();
|
|
103357
|
-
|
|
103942
|
+
process15.exit(1);
|
|
103358
103943
|
}
|
|
103359
103944
|
} catch (err) {
|
|
103360
103945
|
const message3 = sanitizeLines(err.message).join(`
|
|
103361
103946
|
`);
|
|
103362
|
-
console.error(
|
|
103947
|
+
console.error(import_picocolors87.default.red(`
|
|
103363
103948
|
${message3}`));
|
|
103364
103949
|
if (err instanceof ApiError && err.status === 401 && !err.message.includes("brainbase login")) {
|
|
103365
|
-
console.error(` Run ${
|
|
103950
|
+
console.error(` Run ${import_picocolors87.default.cyan("brainbase login")} to connect this device.`);
|
|
103366
103951
|
}
|
|
103367
|
-
if (debug ||
|
|
103952
|
+
if (debug || process15.env.BRAINBASE_DEBUG) {
|
|
103368
103953
|
console.error(debug || httpRetryEnabled() ? formatErrorCauseChain(err) : err.stack);
|
|
103369
103954
|
}
|
|
103370
|
-
|
|
103955
|
+
process15.exit(1);
|
|
103371
103956
|
}
|
|
103372
103957
|
}
|
|
103373
103958
|
main();
|