@brainbase-labs/cli 0.53.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +823 -486
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35182,7 +35182,7 @@ var require_dist2 = __commonJS((exports, module) => {
|
|
|
35182
35182
|
});
|
|
35183
35183
|
|
|
35184
35184
|
// src/index.ts
|
|
35185
|
-
var
|
|
35185
|
+
var import_picocolors81 = __toESM(require_picocolors(), 1);
|
|
35186
35186
|
import process14 from "node:process";
|
|
35187
35187
|
import fs94 from "node:fs";
|
|
35188
35188
|
|
|
@@ -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.54.0",
|
|
36095
36095
|
description: "Pack, share, and install agent templates across harnesses (Claude Code, Codex, ...).",
|
|
36096
36096
|
type: "module",
|
|
36097
36097
|
bin: {
|
|
@@ -67885,6 +67885,14 @@ function automationErrorEnvelope(command, error) {
|
|
|
67885
67885
|
};
|
|
67886
67886
|
}
|
|
67887
67887
|
|
|
67888
|
+
// src/ui/terminal-safe.ts
|
|
67889
|
+
function sanitizeLabel(s3) {
|
|
67890
|
+
return s3.replace(/\u001b\][\s\S]*?(?:\u0007|\u001b\\|$)/g, "").replace(/\u001b\[[\u0030-\u003f]*[\u0020-\u002f]*[\u0040-\u007e]?/g, "").replace(/\u001b[\s\S]?/g, "").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, "");
|
|
67891
|
+
}
|
|
67892
|
+
function sanitizeLines(s3) {
|
|
67893
|
+
return s3.split(/\r\n|[\n\r\u2028\u2029]/).map(sanitizeLabel);
|
|
67894
|
+
}
|
|
67895
|
+
|
|
67888
67896
|
// src/core/fastapi-detail.ts
|
|
67889
67897
|
function record(value) {
|
|
67890
67898
|
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
@@ -67893,22 +67901,22 @@ function fastApiDetails(body) {
|
|
|
67893
67901
|
const detail = record(body)?.detail;
|
|
67894
67902
|
return Array.isArray(detail) ? detail.filter((entry) => !!record(entry)) : [];
|
|
67895
67903
|
}
|
|
67904
|
+
function fastApiValidationMessage(body) {
|
|
67905
|
+
const parts = fastApiDetails(body).map((entry) => {
|
|
67906
|
+
const msg = typeof entry.msg === "string" ? sanitizeLabel(entry.msg.trim()) : "";
|
|
67907
|
+
if (!msg)
|
|
67908
|
+
return null;
|
|
67909
|
+
const loc = Array.isArray(entry.loc) ? sanitizeLabel(entry.loc.filter((part) => part !== "body").map(String).join(".")) : "";
|
|
67910
|
+
return loc ? `${loc}: ${msg}` : msg;
|
|
67911
|
+
}).filter((part) => !!part);
|
|
67912
|
+
return parts.length ? parts.join("; ") : null;
|
|
67913
|
+
}
|
|
67896
67914
|
function rejectsBodyField(body, field) {
|
|
67897
67915
|
return fastApiDetails(body).some((entry) => entry.type === "extra_forbidden" && Array.isArray(entry.loc) && entry.loc[0] === "body" && entry.loc[1] === field);
|
|
67898
67916
|
}
|
|
67899
67917
|
|
|
67900
67918
|
// src/core/interfaces-api.ts
|
|
67901
67919
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
67902
|
-
|
|
67903
|
-
// src/ui/terminal-safe.ts
|
|
67904
|
-
function sanitizeLabel(s3) {
|
|
67905
|
-
return s3.replace(/\u001b\][\s\S]*?(?:\u0007|\u001b\\|$)/g, "").replace(/\u001b\[[\u0030-\u003f]*[\u0020-\u002f]*[\u0040-\u007e]?/g, "").replace(/\u001b[\s\S]?/g, "").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, "");
|
|
67906
|
-
}
|
|
67907
|
-
function sanitizeLines(s3) {
|
|
67908
|
-
return s3.split(/\r\n|[\n\r\u2028\u2029]/).map(sanitizeLabel);
|
|
67909
|
-
}
|
|
67910
|
-
|
|
67911
|
-
// src/core/interfaces-api.ts
|
|
67912
67920
|
function isSettled(status) {
|
|
67913
67921
|
return status === "succeeded" || status === "failed";
|
|
67914
67922
|
}
|
|
@@ -68022,17 +68030,7 @@ function clean(value) {
|
|
|
68022
68030
|
`);
|
|
68023
68031
|
}
|
|
68024
68032
|
function fieldMessages(fields) {
|
|
68025
|
-
|
|
68026
|
-
return null;
|
|
68027
|
-
const parts = fields.map((entry) => {
|
|
68028
|
-
const item = record2(entry);
|
|
68029
|
-
if (!item)
|
|
68030
|
-
return null;
|
|
68031
|
-
const loc = Array.isArray(item.loc) ? sanitizeLabel(item.loc.filter((part) => part !== "body").map(String).join(".")) : "";
|
|
68032
|
-
const msg = text2(item.msg);
|
|
68033
|
-
return msg ? loc ? `${loc}: ${sanitizeLabel(msg)}` : sanitizeLabel(msg) : null;
|
|
68034
|
-
}).filter((part) => !!part);
|
|
68035
|
-
return parts.length ? parts.join("; ") : null;
|
|
68033
|
+
return fastApiValidationMessage({ detail: fields });
|
|
68036
68034
|
}
|
|
68037
68035
|
function toInterfaceError(error, options = {}) {
|
|
68038
68036
|
if (error instanceof InterfaceApiError || !(error instanceof ApiError))
|
|
@@ -68082,9 +68080,8 @@ function toInterfaceError(error, options = {}) {
|
|
|
68082
68080
|
break;
|
|
68083
68081
|
}
|
|
68084
68082
|
default:
|
|
68085
|
-
if (status === 422
|
|
68086
|
-
message =
|
|
68087
|
-
}
|
|
68083
|
+
if (status === 422)
|
|
68084
|
+
message = fastApiValidationMessage(body) ?? serverMessage;
|
|
68088
68085
|
}
|
|
68089
68086
|
const rawInterfaceId = text2(details?.interface_id);
|
|
68090
68087
|
const interfaceId = rawInterfaceId ? sanitizeLabel(rawInterfaceId) : null;
|
|
@@ -85764,7 +85761,324 @@ function printTokenHelp() {
|
|
|
85764
85761
|
}
|
|
85765
85762
|
|
|
85766
85763
|
// src/cli/integrations.ts
|
|
85764
|
+
var import_picocolors63 = __toESM(require_picocolors(), 1);
|
|
85765
|
+
|
|
85766
|
+
// src/cli/integration-context.ts
|
|
85767
85767
|
var import_picocolors62 = __toESM(require_picocolors(), 1);
|
|
85768
|
+
|
|
85769
|
+
// src/core/integration-contexts-api.ts
|
|
85770
|
+
var REQUEST_TIMEOUT_MS2 = 30000;
|
|
85771
|
+
var TOKEN_REFUSED_MESSAGE = "Integration contexts can only be created or ended with your own `brainbase login` session, and BRAINBASE_TOKEN is set. " + "Personal access tokens and task keys cannot create or end them. Unset BRAINBASE_TOKEN and run `brainbase login`.";
|
|
85772
|
+
async function resolveHumanSession() {
|
|
85773
|
+
if (process.env.BRAINBASE_TOKEN?.trim()) {
|
|
85774
|
+
throw new ApiError(TOKEN_REFUSED_MESSAGE, 401);
|
|
85775
|
+
}
|
|
85776
|
+
const session = await ensureFreshSession();
|
|
85777
|
+
if (session)
|
|
85778
|
+
return session;
|
|
85779
|
+
const stored = readToken() ? ` The PAT saved in ${TOKEN_FILE} cannot create or end integration contexts.` : "";
|
|
85780
|
+
const problem = readAuth() ? "Your login session has expired and could not be renewed." : "Not logged in.";
|
|
85781
|
+
throw new ApiError(`${problem} Run \`brainbase login\`.${stored}`, 401);
|
|
85782
|
+
}
|
|
85783
|
+
async function contextRequest(pathname, body, operation) {
|
|
85784
|
+
const session = await resolveHumanSession();
|
|
85785
|
+
const base2 = masControlPlaneBaseUrl(session);
|
|
85786
|
+
const send = async (refreshed) => {
|
|
85787
|
+
const current = refreshed ?? session;
|
|
85788
|
+
try {
|
|
85789
|
+
return await fetch(`${masControlPlaneBaseUrl(current)}/v2${pathname}`, {
|
|
85790
|
+
method: "POST",
|
|
85791
|
+
headers: {
|
|
85792
|
+
Authorization: `Bearer ${current.access_token}`,
|
|
85793
|
+
Accept: "application/json",
|
|
85794
|
+
"Content-Type": "application/json"
|
|
85795
|
+
},
|
|
85796
|
+
body: JSON.stringify(body),
|
|
85797
|
+
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS2)
|
|
85798
|
+
});
|
|
85799
|
+
} catch (err) {
|
|
85800
|
+
throw new ApiError(`Network error: ${err.message}`);
|
|
85801
|
+
}
|
|
85802
|
+
};
|
|
85803
|
+
const res = await sendWithAuthRetry(session, send);
|
|
85804
|
+
let text3;
|
|
85805
|
+
try {
|
|
85806
|
+
text3 = await res.text();
|
|
85807
|
+
} catch (err) {
|
|
85808
|
+
throw new ApiError(`Network error while reading the response: ${err.message}`);
|
|
85809
|
+
}
|
|
85810
|
+
let parsed = text3;
|
|
85811
|
+
try {
|
|
85812
|
+
parsed = text3 ? JSON.parse(text3) : null;
|
|
85813
|
+
} catch {}
|
|
85814
|
+
if (!res.ok) {
|
|
85815
|
+
throw new ApiError(contextErrorMessage(res.status, parsed, operation, base2), res.status, parsed);
|
|
85816
|
+
}
|
|
85817
|
+
return parsed;
|
|
85818
|
+
}
|
|
85819
|
+
function nonEmptyString(value2) {
|
|
85820
|
+
return typeof value2 === "string" && value2.length > 0;
|
|
85821
|
+
}
|
|
85822
|
+
function absentOrString(value2) {
|
|
85823
|
+
return value2 === undefined || typeof value2 === "string";
|
|
85824
|
+
}
|
|
85825
|
+
function isCreatedContext(value2) {
|
|
85826
|
+
const body = record(value2);
|
|
85827
|
+
return !!body && nonEmptyString(body.context_id) && nonEmptyString(body.renewal_handle) && absentOrString(body.renewal_expires_at) && absentOrString(body.max_expires_at);
|
|
85828
|
+
}
|
|
85829
|
+
function isEndedContext(value2) {
|
|
85830
|
+
return typeof record(value2)?.state === "string";
|
|
85831
|
+
}
|
|
85832
|
+
function contextErrorMessage(status, body, operation, base2) {
|
|
85833
|
+
const detail = record(body)?.detail;
|
|
85834
|
+
if (status === 404) {
|
|
85835
|
+
if (detail === "Not Found") {
|
|
85836
|
+
return `Standalone integration contexts are not enabled on this Brainbase deployment (${hostOf(base2)}).`;
|
|
85837
|
+
}
|
|
85838
|
+
if (detail === "agent not found" && operation.kind === "create") {
|
|
85839
|
+
return `Agent ${operation.agentId} was not found, or you cannot manage it. Creating an integration context needs management rights on the agent.`;
|
|
85840
|
+
}
|
|
85841
|
+
if (detail === "integration context not found" && operation.kind === "end") {
|
|
85842
|
+
return `Integration context ${operation.contextId} was not found, or you cannot manage its agent.`;
|
|
85843
|
+
}
|
|
85844
|
+
}
|
|
85845
|
+
if (status === 403 && record(detail)?.code === "human_credential_required") {
|
|
85846
|
+
return "Brainbase refused this credential: integration contexts can only be created or ended with your own `brainbase login` session. Run `brainbase login` and try again.";
|
|
85847
|
+
}
|
|
85848
|
+
if (status === 401) {
|
|
85849
|
+
return `Brainbase did not accept your login session (${sanitizeLabel(masApiErrorMessage(body, status))}). Run \`brainbase login\` to sign in again.`;
|
|
85850
|
+
}
|
|
85851
|
+
if (status === 422) {
|
|
85852
|
+
const fields = fastApiValidationMessage(body);
|
|
85853
|
+
if (fields)
|
|
85854
|
+
return `Brainbase rejected the request: ${fields}`;
|
|
85855
|
+
}
|
|
85856
|
+
return sanitizeLabel(masApiErrorMessage(body, status));
|
|
85857
|
+
}
|
|
85858
|
+
function hostOf(base2) {
|
|
85859
|
+
try {
|
|
85860
|
+
return new URL(base2).host;
|
|
85861
|
+
} catch {
|
|
85862
|
+
return sanitizeLabel(base2);
|
|
85863
|
+
}
|
|
85864
|
+
}
|
|
85865
|
+
var integrationContextsApi = {
|
|
85866
|
+
async create(input) {
|
|
85867
|
+
const created = await contextRequest("/integration-contexts", input, {
|
|
85868
|
+
kind: "create",
|
|
85869
|
+
agentId: input.agent_id
|
|
85870
|
+
});
|
|
85871
|
+
if (!isCreatedContext(created)) {
|
|
85872
|
+
throw new ApiError("Brainbase answered without a context id and renewal handle.");
|
|
85873
|
+
}
|
|
85874
|
+
return created;
|
|
85875
|
+
},
|
|
85876
|
+
async end(contextId, reason) {
|
|
85877
|
+
const ended = await contextRequest(`/integration-contexts/${encodeURIComponent(contextId)}/end`, { reason }, { kind: "end", contextId });
|
|
85878
|
+
if (!isEndedContext(ended)) {
|
|
85879
|
+
throw new ApiError("Brainbase answered without the context state.");
|
|
85880
|
+
}
|
|
85881
|
+
return ended;
|
|
85882
|
+
}
|
|
85883
|
+
};
|
|
85884
|
+
|
|
85885
|
+
// src/cli/integration-context.ts
|
|
85886
|
+
var MIN_LIFETIME_S = 60;
|
|
85887
|
+
var MAX_LIFETIME_S = 30 * 24 * 60 * 60;
|
|
85888
|
+
var DEFAULT_LIFETIME_S = 7 * 24 * 60 * 60;
|
|
85889
|
+
var DEFAULT_END_REASON = "ended with brainbase integrations context end";
|
|
85890
|
+
var MAX_REASON_LENGTH2 = 200;
|
|
85891
|
+
var APPLICATION_PATTERN = /^[a-z0-9][a-z0-9._:/-]{0,119}$/;
|
|
85892
|
+
var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
85893
|
+
var UNIT_SECONDS = { "": 1, s: 1, m: 60, h: 3600, d: 86400 };
|
|
85894
|
+
var CONTEXT_USAGE = `Usage: brainbase integrations context <create|end> [--json]
|
|
85895
|
+
|
|
85896
|
+
create [--agent <id>] --application <name> [--max-lifetime <dur>]
|
|
85897
|
+
Let a program outside Brainbase (the Brainbase SDK) use the agent's
|
|
85898
|
+
integrations on your behalf. Prints a renewal handle once: store it in
|
|
85899
|
+
that program's secret store. It rotates on every renewal, so the program
|
|
85900
|
+
must keep the newest one.
|
|
85901
|
+
--agent the agent's id; defaults to the agent this folder is linked to
|
|
85902
|
+
--application names the program: up to 120 of a-z 0-9 . _ : / -,
|
|
85903
|
+
starting with a letter or digit (e.g. billing-sync)
|
|
85904
|
+
--max-lifetime when the context ends at the latest: 60s to 30d, as
|
|
85905
|
+
seconds or <n>s, <n>m, <n>h, <n>d. Default 7d.
|
|
85906
|
+
|
|
85907
|
+
end <context-id> [--reason <text>]
|
|
85908
|
+
End a context now. Its renewal handle and access grants stop working.
|
|
85909
|
+
--reason recorded with the context, 1-200 characters
|
|
85910
|
+
(default "${DEFAULT_END_REASON}")
|
|
85911
|
+
|
|
85912
|
+
Both need your own \`brainbase login\` session and management rights on the
|
|
85913
|
+
agent. BRAINBASE_TOKEN and the PAT saved by \`brainbase token create\` are refused.
|
|
85914
|
+
`;
|
|
85915
|
+
async function runIntegrationContext(cwd2, argv, options) {
|
|
85916
|
+
const { write: write3, fail: fail3 } = options;
|
|
85917
|
+
const [action, ...rest2] = argv;
|
|
85918
|
+
const parsed = parseContextArgs(rest2, "--application", "--max-lifetime", "--reason");
|
|
85919
|
+
if (action === "help" || action === "--help" || action === "-h" || "help" in parsed) {
|
|
85920
|
+
write3(CONTEXT_USAGE);
|
|
85921
|
+
return 0;
|
|
85922
|
+
}
|
|
85923
|
+
if (action !== "create" && action !== "end") {
|
|
85924
|
+
const problem = action ? `Unknown integrations context subcommand: ${sanitizeLabel(action)}.` : "Missing integrations context subcommand.";
|
|
85925
|
+
return fail3(`${problem} ${CONTEXT_USAGE.split(`
|
|
85926
|
+
`)[0]}`);
|
|
85927
|
+
}
|
|
85928
|
+
if ("error" in parsed)
|
|
85929
|
+
return fail3(parsed.error);
|
|
85930
|
+
const { values: values2, positionals } = parsed;
|
|
85931
|
+
if (action === "create") {
|
|
85932
|
+
if (positionals.length > 0)
|
|
85933
|
+
return fail3(`Unexpected argument: ${sanitizeLabel(positionals[0])}. ${CREATE_USAGE}`);
|
|
85934
|
+
if (values2.has("--reason"))
|
|
85935
|
+
return fail3(`--reason is for \`context end\`. ${CREATE_USAGE}`);
|
|
85936
|
+
const target = cloudTargetAgent(cwd2, options);
|
|
85937
|
+
if (!target)
|
|
85938
|
+
return fail3(NO_AGENT_MESSAGE);
|
|
85939
|
+
if ("error" in target)
|
|
85940
|
+
return fail3(target.error);
|
|
85941
|
+
if (!UUID_PATTERN.test(target.agentId)) {
|
|
85942
|
+
return fail3(`${sanitizeLabel(target.agentId)} is not an agent id. --agent takes the agent's UUID, as \`brainbase agent list\` shows it.`);
|
|
85943
|
+
}
|
|
85944
|
+
const agentId = target.agentId.toLowerCase();
|
|
85945
|
+
const application = values2.get("--application");
|
|
85946
|
+
if (application === undefined)
|
|
85947
|
+
return fail3(`--application is required. ${CREATE_USAGE}`);
|
|
85948
|
+
if (!APPLICATION_PATTERN.test(application)) {
|
|
85949
|
+
return fail3(`--application must be 1-120 characters of lowercase letters, digits and . _ : / -, starting with a letter or digit (e.g. billing-sync); got "${sanitizeLabel(application)}".`);
|
|
85950
|
+
}
|
|
85951
|
+
const rawLifetime = values2.get("--max-lifetime");
|
|
85952
|
+
const lifetime = rawLifetime === undefined ? DEFAULT_LIFETIME_S : parseMaxLifetime(rawLifetime);
|
|
85953
|
+
if (typeof lifetime !== "number")
|
|
85954
|
+
return fail3(lifetime.error);
|
|
85955
|
+
let created;
|
|
85956
|
+
try {
|
|
85957
|
+
created = await integrationContextsApi.create({
|
|
85958
|
+
agent_id: agentId,
|
|
85959
|
+
application,
|
|
85960
|
+
max_lifetime_s: lifetime
|
|
85961
|
+
});
|
|
85962
|
+
} catch (err) {
|
|
85963
|
+
return fail3(`brainbase integrations context create failed: ${message(err)}`);
|
|
85964
|
+
}
|
|
85965
|
+
if (options.json) {
|
|
85966
|
+
write3(JSON.stringify(created) + `
|
|
85967
|
+
`);
|
|
85968
|
+
return 0;
|
|
85969
|
+
}
|
|
85970
|
+
write3(renderCreated(created, agentId, application));
|
|
85971
|
+
return 0;
|
|
85972
|
+
}
|
|
85973
|
+
if (values2.has("--application") || values2.has("--max-lifetime")) {
|
|
85974
|
+
return fail3(`--application and --max-lifetime are for \`context create\`. ${END_USAGE}`);
|
|
85975
|
+
}
|
|
85976
|
+
if (positionals.length !== 1)
|
|
85977
|
+
return fail3(END_USAGE);
|
|
85978
|
+
const contextId = positionals[0];
|
|
85979
|
+
if (!UUID_PATTERN.test(contextId)) {
|
|
85980
|
+
return fail3(`${sanitizeLabel(contextId)} is not a context id. Pass the context_id \`context create\` printed.`);
|
|
85981
|
+
}
|
|
85982
|
+
const reason = (values2.get("--reason") ?? DEFAULT_END_REASON).trim();
|
|
85983
|
+
const reasonLength = [...reason].length;
|
|
85984
|
+
if (reasonLength < 1 || reasonLength > MAX_REASON_LENGTH2) {
|
|
85985
|
+
return fail3(`--reason must be 1-${MAX_REASON_LENGTH2} characters; got ${reasonLength}.`);
|
|
85986
|
+
}
|
|
85987
|
+
let ended;
|
|
85988
|
+
try {
|
|
85989
|
+
ended = await integrationContextsApi.end(contextId.toLowerCase(), reason);
|
|
85990
|
+
} catch (err) {
|
|
85991
|
+
return fail3(`brainbase integrations context end failed: ${message(err)}`);
|
|
85992
|
+
}
|
|
85993
|
+
const id = contextId.toLowerCase();
|
|
85994
|
+
if (options.json) {
|
|
85995
|
+
write3(JSON.stringify({ context_id: id, ...ended }) + `
|
|
85996
|
+
`);
|
|
85997
|
+
return 0;
|
|
85998
|
+
}
|
|
85999
|
+
const state = sanitizeLabel(ended.state);
|
|
86000
|
+
write3(state === "ended" ? `${import_picocolors62.default.green("✓")} Ended integration context ${id}. Its renewal handle and access grants no longer work.
|
|
86001
|
+
` : `Integration context ${id} is ${state}. Its renewal handle and access grants no longer work.
|
|
86002
|
+
`);
|
|
86003
|
+
return 0;
|
|
86004
|
+
}
|
|
86005
|
+
var CREATE_USAGE = "Usage: brainbase integrations context create [--agent <id>] --application <name> [--max-lifetime <dur>]";
|
|
86006
|
+
var END_USAGE = "Usage: brainbase integrations context end <context-id> [--reason <text>]";
|
|
86007
|
+
function parseContextArgs(rest2, ...valueFlags) {
|
|
86008
|
+
for (let i = 0;i < rest2.length; i++) {
|
|
86009
|
+
if (valueFlags.includes(rest2[i]))
|
|
86010
|
+
i++;
|
|
86011
|
+
else if (rest2[i] === "--help" || rest2[i] === "-h")
|
|
86012
|
+
return { help: true };
|
|
86013
|
+
}
|
|
86014
|
+
const values2 = new Map;
|
|
86015
|
+
const positionals = [];
|
|
86016
|
+
for (let i = 0;i < rest2.length; i++) {
|
|
86017
|
+
const arg = rest2[i];
|
|
86018
|
+
const eq = arg.indexOf("=");
|
|
86019
|
+
const name = arg.startsWith("--") && eq > 0 ? arg.slice(0, eq) : arg;
|
|
86020
|
+
if (valueFlags.includes(name)) {
|
|
86021
|
+
let value2;
|
|
86022
|
+
if (name !== arg) {
|
|
86023
|
+
value2 = arg.slice(eq + 1);
|
|
86024
|
+
} else {
|
|
86025
|
+
value2 = rest2[i + 1];
|
|
86026
|
+
if (value2 === undefined || name !== "--reason" && value2.startsWith("-")) {
|
|
86027
|
+
return { error: `${name} needs a value.` };
|
|
86028
|
+
}
|
|
86029
|
+
i++;
|
|
86030
|
+
}
|
|
86031
|
+
if (values2.has(name))
|
|
86032
|
+
return { error: `${name} was given more than once.` };
|
|
86033
|
+
values2.set(name, value2);
|
|
86034
|
+
continue;
|
|
86035
|
+
}
|
|
86036
|
+
if (arg.startsWith("-")) {
|
|
86037
|
+
return { error: `Unknown option for brainbase integrations context: ${sanitizeLabel(arg)}` };
|
|
86038
|
+
}
|
|
86039
|
+
positionals.push(arg);
|
|
86040
|
+
}
|
|
86041
|
+
return { values: values2, positionals };
|
|
86042
|
+
}
|
|
86043
|
+
function parseMaxLifetime(raw) {
|
|
86044
|
+
const match = /^(\d+)([smhd]?)$/i.exec(raw.trim());
|
|
86045
|
+
if (!match) {
|
|
86046
|
+
return { error: `--max-lifetime takes seconds or a duration such as 90m, 12h or 7d; got "${sanitizeLabel(raw)}".` };
|
|
86047
|
+
}
|
|
86048
|
+
const seconds = Number(match[1]) * UNIT_SECONDS[match[2].toLowerCase()];
|
|
86049
|
+
if (!Number.isSafeInteger(seconds) || seconds < MIN_LIFETIME_S || seconds > MAX_LIFETIME_S) {
|
|
86050
|
+
return {
|
|
86051
|
+
error: `--max-lifetime must be between 60s and 30d (${MAX_LIFETIME_S} seconds); got "${sanitizeLabel(raw)}".`
|
|
86052
|
+
};
|
|
86053
|
+
}
|
|
86054
|
+
return seconds;
|
|
86055
|
+
}
|
|
86056
|
+
function renderCreated(created, agentId, application) {
|
|
86057
|
+
const id = sanitizeLabel(created.context_id);
|
|
86058
|
+
const lines = [
|
|
86059
|
+
`${import_picocolors62.default.green("✓")} Created integration context ${id}`,
|
|
86060
|
+
` ${import_picocolors62.default.dim(`agent ${agentId} · application ${application}`)}`,
|
|
86061
|
+
"",
|
|
86062
|
+
" Renewal handle:",
|
|
86063
|
+
"",
|
|
86064
|
+
` ${sanitizeLabel(created.renewal_handle)}`,
|
|
86065
|
+
"",
|
|
86066
|
+
import_picocolors62.default.yellow(" Store it now in the SDK program's secret store: it is shown only this once, and it rotates on every renewal, so the program must save the newest handle each time."),
|
|
86067
|
+
"",
|
|
86068
|
+
` Handle expires ${sanitizeLabel(created.renewal_expires_at ?? "unknown")}`,
|
|
86069
|
+
` Context ends ${sanitizeLabel(created.max_expires_at ?? "unknown")} ${import_picocolors62.default.dim("(its maximum lifetime)")}`,
|
|
86070
|
+
"",
|
|
86071
|
+
import_picocolors62.default.dim(` End it sooner with \`brainbase integrations context end ${id}\`.`),
|
|
86072
|
+
""
|
|
86073
|
+
];
|
|
86074
|
+
return lines.join(`
|
|
86075
|
+
`);
|
|
86076
|
+
}
|
|
86077
|
+
function message(err) {
|
|
86078
|
+
return sanitizeLabel(err?.message ?? String(err));
|
|
86079
|
+
}
|
|
86080
|
+
|
|
86081
|
+
// src/cli/integrations.ts
|
|
85768
86082
|
var EFFECTS = ["allow", "ask", "deny"];
|
|
85769
86083
|
var USAGE = `Usage: brainbase integrations <command> [--agent <id>] [--json]
|
|
85770
86084
|
|
|
@@ -85776,6 +86090,12 @@ var USAGE = `Usage: brainbase integrations <command> [--agent <id>] [--json]
|
|
|
85776
86090
|
disconnect <app> delete the app's connected account [--account <id>] [--yes]
|
|
85777
86091
|
remove <app> uninstall an app that needs no account
|
|
85778
86092
|
allow|ask|deny <app>[.<action>] set the permission for an app or one action
|
|
86093
|
+
context create --application <name> [--max-lifetime <dur>]
|
|
86094
|
+
let a program outside Brainbase (the SDK) use the agent's
|
|
86095
|
+
integrations; prints a renewal handle once. Lifetime 60s-30d, default 7d
|
|
86096
|
+
context end <context-id> [--reason <text>]
|
|
86097
|
+
end a standalone integration context now
|
|
86098
|
+
(\`brainbase integrations context --help\` for details)
|
|
85779
86099
|
`;
|
|
85780
86100
|
var POLL_INTERVAL_MS2 = 2000;
|
|
85781
86101
|
var MAX_CONSECUTIVE_POLL_FAILURES2 = 5;
|
|
@@ -85785,12 +86105,12 @@ async function runIntegrations(cwd2, sub, argv, options) {
|
|
|
85785
86105
|
const write3 = options.write ?? ((s3) => process.stdout.write(s3));
|
|
85786
86106
|
const writeErr = options.writeErr ?? ((s3) => process.stderr.write(s3));
|
|
85787
86107
|
const api4 = { ...integrationsApi, ...options.api };
|
|
85788
|
-
const fail3 = (
|
|
86108
|
+
const fail3 = (message2) => {
|
|
85789
86109
|
if (options.json)
|
|
85790
|
-
write3(JSON.stringify({ error:
|
|
86110
|
+
write3(JSON.stringify({ error: message2 }) + `
|
|
85791
86111
|
`);
|
|
85792
86112
|
else
|
|
85793
|
-
writeErr(
|
|
86113
|
+
writeErr(message2 + `
|
|
85794
86114
|
`);
|
|
85795
86115
|
return 1;
|
|
85796
86116
|
};
|
|
@@ -85799,6 +86119,15 @@ async function runIntegrations(cwd2, sub, argv, options) {
|
|
|
85799
86119
|
` : human);
|
|
85800
86120
|
return 0;
|
|
85801
86121
|
};
|
|
86122
|
+
if (sub === "context") {
|
|
86123
|
+
return await runIntegrationContext(cwd2, argv, {
|
|
86124
|
+
json: options.json,
|
|
86125
|
+
agentId: options.agentId,
|
|
86126
|
+
resolveAgentId: options.resolveAgentId,
|
|
86127
|
+
write: write3,
|
|
86128
|
+
fail: fail3
|
|
86129
|
+
});
|
|
86130
|
+
}
|
|
85802
86131
|
const isHelpFlag = (s3) => s3 === "--help" || s3 === "-h";
|
|
85803
86132
|
if (sub === "help" || isHelpFlag(sub) || argv.some(isHelpFlag)) {
|
|
85804
86133
|
write3(USAGE);
|
|
@@ -85824,7 +86153,7 @@ ${USAGE}`);
|
|
|
85824
86153
|
const apps = await api4.searchApps(arg);
|
|
85825
86154
|
return out({ apps }, renderSearch(apps));
|
|
85826
86155
|
} catch (err) {
|
|
85827
|
-
return fail3(`brainbase integrations search failed: ${
|
|
86156
|
+
return fail3(`brainbase integrations search failed: ${message2(err)}`);
|
|
85828
86157
|
}
|
|
85829
86158
|
}
|
|
85830
86159
|
const target = cloudTargetAgent(cwd2, options);
|
|
@@ -85851,7 +86180,7 @@ ${USAGE}`);
|
|
|
85851
86180
|
return await setEffect(agentId, sub, arg);
|
|
85852
86181
|
}
|
|
85853
86182
|
} catch (err) {
|
|
85854
|
-
return fail3(`brainbase integrations ${sub} failed: ${
|
|
86183
|
+
return fail3(`brainbase integrations ${sub} failed: ${message2(err)}`);
|
|
85855
86184
|
}
|
|
85856
86185
|
async function list3(agentId2) {
|
|
85857
86186
|
const [accounts, noAuthApps, permissions] = await Promise.all([
|
|
@@ -85904,7 +86233,7 @@ ${USAGE}`);
|
|
|
85904
86233
|
if (needsAccount(app))
|
|
85905
86234
|
return await connect2(agentId2, slug, app);
|
|
85906
86235
|
const added = await api4.addNoAuthApp(agentId2, slug);
|
|
85907
|
-
return out({ app: added.appSlug, name: added.name, needs_account: false, added: true }, `${
|
|
86236
|
+
return out({ app: added.appSlug, name: added.name, needs_account: false, added: true }, `${import_picocolors63.default.green("✓")} Added ${import_picocolors63.default.bold(label2(added.name))}. It needs no account; your agent can use it on its next turn.
|
|
85908
86237
|
`);
|
|
85909
86238
|
}
|
|
85910
86239
|
async function connect2(agentId2, slug, known2) {
|
|
@@ -85924,20 +86253,20 @@ ${USAGE}`);
|
|
|
85924
86253
|
return 0;
|
|
85925
86254
|
}
|
|
85926
86255
|
const interactive = options.interactive ?? isInteractive();
|
|
85927
|
-
write3(`Open this link to connect ${
|
|
86256
|
+
write3(`Open this link to connect ${import_picocolors63.default.bold(name)}:
|
|
85928
86257
|
|
|
85929
|
-
${
|
|
86258
|
+
${import_picocolors63.default.cyan(url2)}
|
|
85930
86259
|
|
|
85931
86260
|
`);
|
|
85932
|
-
write3(
|
|
86261
|
+
write3(import_picocolors63.default.dim(`Anyone with this link can connect an account to this agent until it expires, so do not share it.
|
|
85933
86262
|
`));
|
|
85934
86263
|
if (!options.noOpen && interactive) {
|
|
85935
|
-
write3(
|
|
86264
|
+
write3(import_picocolors63.default.dim(`Opening your browser…
|
|
85936
86265
|
`));
|
|
85937
86266
|
(options.openUrl ?? openInBrowser)(url2);
|
|
85938
86267
|
}
|
|
85939
86268
|
if (options.noWait) {
|
|
85940
|
-
write3(
|
|
86269
|
+
write3(import_picocolors63.default.dim("Not waiting. Run `brainbase integrations list` to see when it is connected.\n"));
|
|
85941
86270
|
return 0;
|
|
85942
86271
|
}
|
|
85943
86272
|
const controller = new AbortController;
|
|
@@ -85970,7 +86299,7 @@ ${USAGE}`);
|
|
|
85970
86299
|
if (spinner2)
|
|
85971
86300
|
spinner2.stop(text3, ok ? 0 : 2);
|
|
85972
86301
|
else if (ok)
|
|
85973
|
-
write3(`${
|
|
86302
|
+
write3(`${import_picocolors63.default.green("✔")} ${text3}
|
|
85974
86303
|
`);
|
|
85975
86304
|
else
|
|
85976
86305
|
writeErr(`${text3}
|
|
@@ -86010,11 +86339,11 @@ ${USAGE}`);
|
|
|
86010
86339
|
const confirm = options.confirmDisconnect ?? promptForDisconnect;
|
|
86011
86340
|
const accountLabel = account.name ? `${label2(account.name)} (${account.id})` : account.id;
|
|
86012
86341
|
if (!await confirm(`Disconnect ${label2(slug)} account ${accountLabel}? Everyone using this agent loses it.`, options.yes)) {
|
|
86013
|
-
return out({ app: slug, account_id: account.id, disconnected: false, outcome: "declined" }, ` ${
|
|
86342
|
+
return out({ app: slug, account_id: account.id, disconnected: false, outcome: "declined" }, ` ${import_picocolors63.default.dim("Left alone.")}
|
|
86014
86343
|
`);
|
|
86015
86344
|
}
|
|
86016
86345
|
await api4.deleteAccount(agentId2, account.id);
|
|
86017
|
-
return out({ app: slug, account_id: account.id, disconnected: true }, `${
|
|
86346
|
+
return out({ app: slug, account_id: account.id, disconnected: true }, `${import_picocolors63.default.green("✓")} Disconnected ${import_picocolors63.default.bold(label2(slug))} account ${accountLabel}.
|
|
86018
86347
|
`);
|
|
86019
86348
|
}
|
|
86020
86349
|
async function remove2(agentId2, slug) {
|
|
@@ -86027,7 +86356,7 @@ ${USAGE}`);
|
|
|
86027
86356
|
return fail3(`${label2(slug)} is not installed on this agent.`);
|
|
86028
86357
|
}
|
|
86029
86358
|
await api4.removeNoAuthApp(agentId2, slug);
|
|
86030
|
-
return out({ app: slug, removed: true }, `${
|
|
86359
|
+
return out({ app: slug, removed: true }, `${import_picocolors63.default.green("✓")} Removed ${import_picocolors63.default.bold(label2(slug))}.
|
|
86031
86360
|
`);
|
|
86032
86361
|
}
|
|
86033
86362
|
async function setEffect(agentId2, effect, raw) {
|
|
@@ -86040,7 +86369,7 @@ ${USAGE}`);
|
|
|
86040
86369
|
const capability = pattern(appSlug(app), action);
|
|
86041
86370
|
await api4.setPermission(agentId2, capability, effect);
|
|
86042
86371
|
const scope = action ? `${label2(action)} on ${label2(app)}` : `every ${label2(app)} action without its own rule`;
|
|
86043
|
-
return out({ capability_pattern: capability, effect }, `${
|
|
86372
|
+
return out({ capability_pattern: capability, effect }, `${import_picocolors63.default.green("✓")} ${capability} → ${import_picocolors63.default.bold(effect)} ${import_picocolors63.default.dim(`(${scope})`)}
|
|
86044
86373
|
`);
|
|
86045
86374
|
}
|
|
86046
86375
|
}
|
|
@@ -86050,7 +86379,7 @@ function appSlug(raw) {
|
|
|
86050
86379
|
function label2(s3) {
|
|
86051
86380
|
return sanitizeLabel(s3);
|
|
86052
86381
|
}
|
|
86053
|
-
function
|
|
86382
|
+
function message2(err) {
|
|
86054
86383
|
return sanitizeLabel(err?.message ?? String(err));
|
|
86055
86384
|
}
|
|
86056
86385
|
function needsAccount(app) {
|
|
@@ -86093,27 +86422,27 @@ async function promptForDisconnect(question, yes) {
|
|
|
86093
86422
|
return ensureNotCancelled(answer);
|
|
86094
86423
|
}
|
|
86095
86424
|
var EFFECT_COLOR = {
|
|
86096
|
-
allow:
|
|
86097
|
-
ask:
|
|
86098
|
-
deny:
|
|
86425
|
+
allow: import_picocolors63.default.green,
|
|
86426
|
+
ask: import_picocolors63.default.yellow,
|
|
86427
|
+
deny: import_picocolors63.default.red
|
|
86099
86428
|
};
|
|
86100
86429
|
function effectLabel(effect, width = 0) {
|
|
86101
|
-
return (EFFECT_COLOR[effect] ??
|
|
86430
|
+
return (EFFECT_COLOR[effect] ?? import_picocolors63.default.dim)(sanitizeLabel(effect).padEnd(width));
|
|
86102
86431
|
}
|
|
86103
86432
|
function renderList(rows, permissions) {
|
|
86104
86433
|
const lines = [""];
|
|
86105
86434
|
if (!permissions.permissionsAvailable) {
|
|
86106
|
-
lines.push(
|
|
86435
|
+
lines.push(import_picocolors63.default.yellow(" Integrations only work on Kafka agents for now; this agent cannot use them."), "");
|
|
86107
86436
|
}
|
|
86108
86437
|
if (rows.length === 0) {
|
|
86109
|
-
lines.push(
|
|
86110
|
-
lines.push(
|
|
86438
|
+
lines.push(import_picocolors63.default.dim(" No integrations on this agent."));
|
|
86439
|
+
lines.push(import_picocolors63.default.dim(" Find one with `brainbase integrations search <query>`, then `brainbase integrations add <app>`."), "");
|
|
86111
86440
|
return lines.join(`
|
|
86112
86441
|
`);
|
|
86113
86442
|
}
|
|
86114
86443
|
for (const row of rows) {
|
|
86115
86444
|
const healthy = row.accounts.every((a3) => a3.healthy);
|
|
86116
|
-
const mark = healthy ?
|
|
86445
|
+
const mark = healthy ? import_picocolors63.default.green("✓") : import_picocolors63.default.yellow("!");
|
|
86117
86446
|
const bits = [sanitizeLabel(row.name)];
|
|
86118
86447
|
if (!row.needs_account)
|
|
86119
86448
|
bits.push("no account needed");
|
|
@@ -86121,35 +86450,35 @@ function renderList(rows, permissions) {
|
|
|
86121
86450
|
bits.push(`account ${account.name ? sanitizeLabel(account.name) : account.id}${account.healthy ? "" : " (needs reconnecting)"}`);
|
|
86122
86451
|
}
|
|
86123
86452
|
const effect = row.effect ?? permissions.defaultEffect;
|
|
86124
|
-
lines.push(` ${mark} ${
|
|
86453
|
+
lines.push(` ${mark} ${import_picocolors63.default.bold(sanitizeLabel(row.app))} ${import_picocolors63.default.dim(bits.join(" · "))} ${effectLabel(effect)}${row.effect ? "" : import_picocolors63.default.dim(" (default)")}`);
|
|
86125
86454
|
}
|
|
86126
|
-
lines.push("",
|
|
86455
|
+
lines.push("", import_picocolors63.default.dim(" Run `brainbase integrations actions <app>` to see and set per-action permissions."), "");
|
|
86127
86456
|
return lines.join(`
|
|
86128
86457
|
`);
|
|
86129
86458
|
}
|
|
86130
86459
|
function renderSearch(apps) {
|
|
86131
86460
|
if (apps.length === 0)
|
|
86132
|
-
return
|
|
86461
|
+
return import_picocolors63.default.dim("No apps match.") + `
|
|
86133
86462
|
`;
|
|
86134
86463
|
const lines = [""];
|
|
86135
86464
|
for (const app of apps) {
|
|
86136
|
-
const hint = needsAccount(app) ? "" :
|
|
86137
|
-
lines.push(` ${
|
|
86465
|
+
const hint = needsAccount(app) ? "" : import_picocolors63.default.dim(" no account needed");
|
|
86466
|
+
lines.push(` ${import_picocolors63.default.bold(sanitizeLabel(app.nameSlug))} ${sanitizeLabel(app.name)}${hint}`);
|
|
86138
86467
|
}
|
|
86139
|
-
lines.push("",
|
|
86468
|
+
lines.push("", import_picocolors63.default.dim(" Add one with `brainbase integrations add <app>`."), "");
|
|
86140
86469
|
return lines.join(`
|
|
86141
86470
|
`);
|
|
86142
86471
|
}
|
|
86143
86472
|
function renderActions(slug, rows) {
|
|
86144
86473
|
if (rows.length === 0)
|
|
86145
|
-
return
|
|
86474
|
+
return import_picocolors63.default.dim(`No actions found for ${sanitizeLabel(slug)}.`) + `
|
|
86146
86475
|
`;
|
|
86147
86476
|
const lines = [""];
|
|
86148
86477
|
for (const row of rows) {
|
|
86149
|
-
const source =
|
|
86150
|
-
lines.push(` ${effectLabel(row.effect, 5)} ${source} ${
|
|
86478
|
+
const source = import_picocolors63.default.dim((row.source === "action" ? "" : `(${row.source})`).padEnd(9));
|
|
86479
|
+
lines.push(` ${effectLabel(row.effect, 5)} ${source} ${import_picocolors63.default.bold(sanitizeLabel(row.key))} ${import_picocolors63.default.dim(sanitizeLabel(row.name))}`);
|
|
86151
86480
|
}
|
|
86152
|
-
lines.push("",
|
|
86481
|
+
lines.push("", import_picocolors63.default.dim(` Change one with \`brainbase integrations allow|ask|deny ${sanitizeLabel(slug)}.<action>\`, or the whole app with \`… ${sanitizeLabel(slug)}\`.`), "");
|
|
86153
86482
|
return lines.join(`
|
|
86154
86483
|
`);
|
|
86155
86484
|
}
|
|
@@ -86213,14 +86542,14 @@ async function waitForAccount(agentId, slug, before2, options) {
|
|
|
86213
86542
|
}
|
|
86214
86543
|
|
|
86215
86544
|
// src/cli/task.ts
|
|
86216
|
-
var
|
|
86545
|
+
var import_picocolors69 = __toESM(require_picocolors(), 1);
|
|
86217
86546
|
|
|
86218
86547
|
// src/cli/task-create.ts
|
|
86219
|
-
var
|
|
86548
|
+
var import_picocolors65 = __toESM(require_picocolors(), 1);
|
|
86220
86549
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
86221
86550
|
|
|
86222
86551
|
// src/cli/task-update.ts
|
|
86223
|
-
var
|
|
86552
|
+
var import_picocolors64 = __toESM(require_picocolors(), 1);
|
|
86224
86553
|
var TASK_UPDATE_USAGE = "brainbase task update <task-id> [--title <text> | --clear-title] [--metadata key=value]... [--unset-metadata <key>]... [--clear-metadata] [--model <id> | --clear-model] [--json]";
|
|
86225
86554
|
var TITLE_MAX = 200;
|
|
86226
86555
|
var MODEL_UNSUPPORTED = "This control plane does not support changing a task's model yet.";
|
|
@@ -86359,25 +86688,25 @@ function applyLabelEdit(current, edit) {
|
|
|
86359
86688
|
}
|
|
86360
86689
|
function format(task) {
|
|
86361
86690
|
const lines = [""];
|
|
86362
|
-
const title = task.title?.trim() ? sanitizeLabel(task.title) :
|
|
86363
|
-
lines.push(` ${
|
|
86691
|
+
const title = task.title?.trim() ? sanitizeLabel(task.title) : import_picocolors64.default.dim("(untitled)");
|
|
86692
|
+
lines.push(` ${import_picocolors64.default.green("updated")} ${import_picocolors64.default.bold(title)}`);
|
|
86364
86693
|
lines.push("");
|
|
86365
|
-
lines.push(` ${
|
|
86694
|
+
lines.push(` ${import_picocolors64.default.dim("task")} ${sanitizeLabel(task.id)}`);
|
|
86366
86695
|
if (task.model !== undefined) {
|
|
86367
|
-
const model = task.model?.trim() ? sanitizeLabel(task.model) :
|
|
86368
|
-
lines.push(` ${
|
|
86696
|
+
const model = task.model?.trim() ? sanitizeLabel(task.model) : import_picocolors64.default.dim("agent default");
|
|
86697
|
+
lines.push(` ${import_picocolors64.default.dim("model")} ${model}`);
|
|
86369
86698
|
}
|
|
86370
86699
|
const metadata = Object.entries(task.metadata ?? {});
|
|
86371
86700
|
lines.push("");
|
|
86372
|
-
lines.push(` ${
|
|
86701
|
+
lines.push(` ${import_picocolors64.default.bold(import_picocolors64.default.dim("METADATA"))}`);
|
|
86373
86702
|
if (metadata.length === 0) {
|
|
86374
|
-
lines.push(` ${
|
|
86703
|
+
lines.push(` ${import_picocolors64.default.dim("none")}`);
|
|
86375
86704
|
}
|
|
86376
86705
|
for (const [key2, value2] of metadata) {
|
|
86377
|
-
lines.push(` ${
|
|
86706
|
+
lines.push(` ${import_picocolors64.default.dim(sanitizeLabel(key2))} ${sanitizeLabel(value2)}`);
|
|
86378
86707
|
}
|
|
86379
86708
|
lines.push("");
|
|
86380
|
-
lines.push(` ${
|
|
86709
|
+
lines.push(` ${import_picocolors64.default.dim("read it with")} ${import_picocolors64.default.cyan(`brainbase task get ${sanitizeLabel(task.id)}`)}`, "");
|
|
86381
86710
|
return lines.join(`
|
|
86382
86711
|
`);
|
|
86383
86712
|
}
|
|
@@ -86423,13 +86752,13 @@ async function resolveAgentId2(cwd2, agentId, interfaceId, readLocalManifest) {
|
|
|
86423
86752
|
return manifest.id;
|
|
86424
86753
|
}
|
|
86425
86754
|
function isPublishScopeError(error2) {
|
|
86426
|
-
const
|
|
86755
|
+
const message3 = error2 instanceof Error ? error2.message : String(error2);
|
|
86427
86756
|
const body = error2 && typeof error2 === "object" && "body" in error2 ? JSON.stringify(error2.body) : "";
|
|
86428
|
-
return /PAT lacks required scope:\s*publish/i.test(`${
|
|
86757
|
+
return /PAT lacks required scope:\s*publish/i.test(`${message3} ${body}`);
|
|
86429
86758
|
}
|
|
86430
86759
|
async function runTaskCreate(cwd2, options, dependencies = {}) {
|
|
86431
86760
|
const idempotencyKey = (dependencies.randomUUID ?? randomUUID4)();
|
|
86432
|
-
const
|
|
86761
|
+
const message3 = requiredValue(options.message, "--message");
|
|
86433
86762
|
const interfaceId = optionalValue(options.interfaceId, "--interface");
|
|
86434
86763
|
const agentId = await resolveAgentId2(cwd2, options.agentId, interfaceId, dependencies.readManifest ?? readManifest);
|
|
86435
86764
|
const title = optionalValue(options.title, "--title");
|
|
@@ -86439,7 +86768,7 @@ async function runTaskCreate(cwd2, options, dependencies = {}) {
|
|
|
86439
86768
|
const version2 = versionRef ? (await agentVersionsApi.resolve(agentId, versionRef)).version : undefined;
|
|
86440
86769
|
const input = {
|
|
86441
86770
|
agent_id: agentId,
|
|
86442
|
-
initial_messages: [{ role: "user", content:
|
|
86771
|
+
initial_messages: [{ role: "user", content: message3 }],
|
|
86443
86772
|
auto_run: true,
|
|
86444
86773
|
...title ? { title } : {},
|
|
86445
86774
|
...model ? { default_model: model } : {},
|
|
@@ -86515,24 +86844,24 @@ async function waitForCreatedTask(created, options, dependencies, version2) {
|
|
|
86515
86844
|
return;
|
|
86516
86845
|
}
|
|
86517
86846
|
if (outcome.kind === "timeout") {
|
|
86518
|
-
console.log(
|
|
86847
|
+
console.log(import_picocolors65.default.yellow(`Timed out after ${options.timeoutSeconds}s with the task still ${status}.`));
|
|
86519
86848
|
return;
|
|
86520
86849
|
}
|
|
86521
86850
|
if (outcome.kind === "interrupted") {
|
|
86522
|
-
console.log(
|
|
86851
|
+
console.log(import_picocolors65.default.yellow("Interrupted. The task is still running."));
|
|
86523
86852
|
return;
|
|
86524
86853
|
}
|
|
86525
|
-
console.log(code === 0 ?
|
|
86854
|
+
console.log(code === 0 ? import_picocolors65.default.green("Task completed.") : import_picocolors65.default.red(`Task finished as ${status}.`));
|
|
86526
86855
|
} finally {
|
|
86527
86856
|
process.removeListener("SIGINT", onSigint);
|
|
86528
86857
|
}
|
|
86529
86858
|
}
|
|
86530
86859
|
|
|
86531
86860
|
// src/cli/task-get.ts
|
|
86532
|
-
var
|
|
86861
|
+
var import_picocolors67 = __toESM(require_picocolors(), 1);
|
|
86533
86862
|
|
|
86534
86863
|
// src/cli/task-list.ts
|
|
86535
|
-
var
|
|
86864
|
+
var import_picocolors66 = __toESM(require_picocolors(), 1);
|
|
86536
86865
|
|
|
86537
86866
|
// src/core/agent-names.ts
|
|
86538
86867
|
async function agentNames(ids) {
|
|
@@ -86597,29 +86926,29 @@ function labelFilter(options) {
|
|
|
86597
86926
|
function formatTaskList(tasks, names, agentId, interfaceId, labelFiltered = false) {
|
|
86598
86927
|
const lines = [""];
|
|
86599
86928
|
if (tasks.length === 0 && labelFiltered) {
|
|
86600
|
-
lines.push(` ${
|
|
86929
|
+
lines.push(` ${import_picocolors66.default.dim("No tasks carry every label given with --metadata.")}`, "");
|
|
86601
86930
|
return lines.join(`
|
|
86602
86931
|
`);
|
|
86603
86932
|
}
|
|
86604
86933
|
if (tasks.length === 0 && interfaceId) {
|
|
86605
86934
|
const id = sanitizeLabel(interfaceId);
|
|
86606
|
-
lines.push(` ${
|
|
86935
|
+
lines.push(` ${import_picocolors66.default.dim(`No build conversations for interface ${id}.`)}`, "", ` ${import_picocolors66.default.dim("start one with")} ${import_picocolors66.default.cyan(`brainbase interface build ${id} "..."`)}`, "");
|
|
86607
86936
|
return lines.join(`
|
|
86608
86937
|
`);
|
|
86609
86938
|
}
|
|
86610
86939
|
if (tasks.length === 0) {
|
|
86611
|
-
lines.push(` ${
|
|
86940
|
+
lines.push(` ${import_picocolors66.default.dim(agentId ? `No tasks for agent ${agentId}.` : "No tasks yet.")}`, "", ` ${import_picocolors66.default.dim("start one with")} ${import_picocolors66.default.cyan('brainbase task create --message "..."')}`, "");
|
|
86612
86941
|
return lines.join(`
|
|
86613
86942
|
`);
|
|
86614
86943
|
}
|
|
86615
86944
|
for (const task of tasks) {
|
|
86616
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
86617
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
86618
|
-
lines.push(` ${
|
|
86619
|
-
lines.push(` ${
|
|
86945
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors66.default.dim("(untitled)");
|
|
86946
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors66.default.bold(title)}`);
|
|
86947
|
+
lines.push(` ${import_picocolors66.default.dim(sanitizeLabel(task.id))}`);
|
|
86948
|
+
lines.push(` ${import_picocolors66.default.dim(`agent ${agentLabel(task.agent_id, names)} · created ${sanitizeLabel(task.created_at)}`)}`);
|
|
86620
86949
|
lines.push("");
|
|
86621
86950
|
}
|
|
86622
|
-
lines.push(` ${
|
|
86951
|
+
lines.push(` ${import_picocolors66.default.dim("inspect one with")} ${import_picocolors66.default.cyan("brainbase task get <id>")}`, "");
|
|
86623
86952
|
return lines.join(`
|
|
86624
86953
|
`);
|
|
86625
86954
|
}
|
|
@@ -86627,16 +86956,16 @@ function statusLabel(status) {
|
|
|
86627
86956
|
const padded = sanitizeLabel(status).padEnd(14);
|
|
86628
86957
|
switch (status) {
|
|
86629
86958
|
case "success":
|
|
86630
|
-
return
|
|
86959
|
+
return import_picocolors66.default.green(padded);
|
|
86631
86960
|
case "fail":
|
|
86632
|
-
return
|
|
86961
|
+
return import_picocolors66.default.red(padded);
|
|
86633
86962
|
case "need_more_info":
|
|
86634
|
-
return
|
|
86963
|
+
return import_picocolors66.default.yellow(padded);
|
|
86635
86964
|
case "running":
|
|
86636
86965
|
case "initializing":
|
|
86637
|
-
return
|
|
86966
|
+
return import_picocolors66.default.cyan(padded);
|
|
86638
86967
|
default:
|
|
86639
|
-
return
|
|
86968
|
+
return import_picocolors66.default.dim(padded);
|
|
86640
86969
|
}
|
|
86641
86970
|
}
|
|
86642
86971
|
|
|
@@ -86670,60 +86999,60 @@ async function readEvalRuns(task) {
|
|
|
86670
86999
|
}
|
|
86671
87000
|
function format2(task, evals, names) {
|
|
86672
87001
|
const lines = [""];
|
|
86673
|
-
const title = sanitizeLabel(task.title ?? "").trim() ||
|
|
87002
|
+
const title = sanitizeLabel(task.title ?? "").trim() || import_picocolors67.default.dim("(untitled)");
|
|
86674
87003
|
const id = sanitizeLabel(task.id);
|
|
86675
|
-
lines.push(` ${statusLabel(task.status)} ${
|
|
87004
|
+
lines.push(` ${statusLabel(task.status)} ${import_picocolors67.default.bold(title)}`);
|
|
86676
87005
|
lines.push("");
|
|
86677
|
-
lines.push(` ${
|
|
86678
|
-
lines.push(` ${
|
|
87006
|
+
lines.push(` ${import_picocolors67.default.dim("task")} ${id}`);
|
|
87007
|
+
lines.push(` ${import_picocolors67.default.dim("agent")} ${agentLabel(task.agent_id, names)}`);
|
|
86679
87008
|
if (task.model !== undefined) {
|
|
86680
|
-
const model = task.model?.trim() ? sanitizeLabel(task.model) :
|
|
86681
|
-
lines.push(` ${
|
|
87009
|
+
const model = task.model?.trim() ? sanitizeLabel(task.model) : import_picocolors67.default.dim("agent default");
|
|
87010
|
+
lines.push(` ${import_picocolors67.default.dim("model")} ${model}`);
|
|
86682
87011
|
}
|
|
86683
|
-
lines.push(` ${
|
|
87012
|
+
lines.push(` ${import_picocolors67.default.dim("created")} ${sanitizeLabel(task.created_at)}`);
|
|
86684
87013
|
if (task.parent_task_id) {
|
|
86685
|
-
lines.push(` ${
|
|
87014
|
+
lines.push(` ${import_picocolors67.default.dim("parent")} ${sanitizeLabel(task.parent_task_id)}`);
|
|
86686
87015
|
}
|
|
86687
87016
|
if (task.machine_id) {
|
|
86688
87017
|
const size2 = task.machine_size ? ` (size ${sanitizeLabel(task.machine_size)})` : "";
|
|
86689
|
-
lines.push(` ${
|
|
87018
|
+
lines.push(` ${import_picocolors67.default.dim("machine")} ${sanitizeLabel(task.machine_id)}${size2}`);
|
|
86690
87019
|
}
|
|
86691
87020
|
if (task.sandbox_id)
|
|
86692
|
-
lines.push(` ${
|
|
87021
|
+
lines.push(` ${import_picocolors67.default.dim("sandbox")} ${sanitizeLabel(task.sandbox_id)}`);
|
|
86693
87022
|
const [failure, ...failureRest] = sanitizeLines(failureSummary(task) ?? "").filter((line2) => line2.trim());
|
|
86694
87023
|
if (failure) {
|
|
86695
87024
|
const label3 = " failure ";
|
|
86696
87025
|
lines.push("");
|
|
86697
|
-
lines.push(` ${
|
|
87026
|
+
lines.push(` ${import_picocolors67.default.red("failure")} ${failure}`);
|
|
86698
87027
|
for (const line2 of failureRest)
|
|
86699
87028
|
lines.push(`${" ".repeat(label3.length)}${line2}`);
|
|
86700
87029
|
}
|
|
86701
87030
|
const metadata = Object.entries(task.metadata ?? {});
|
|
86702
87031
|
if (metadata.length > 0) {
|
|
86703
87032
|
lines.push("");
|
|
86704
|
-
lines.push(` ${
|
|
87033
|
+
lines.push(` ${import_picocolors67.default.bold(import_picocolors67.default.dim("METADATA"))}`);
|
|
86705
87034
|
for (const [key2, value2] of metadata) {
|
|
86706
|
-
lines.push(` ${
|
|
87035
|
+
lines.push(` ${import_picocolors67.default.dim(sanitizeLabel(key2))} ${sanitizeLabel(String(value2))}`);
|
|
86707
87036
|
}
|
|
86708
87037
|
}
|
|
86709
87038
|
lines.push("");
|
|
86710
|
-
lines.push(` ${
|
|
87039
|
+
lines.push(` ${import_picocolors67.default.bold(import_picocolors67.default.dim("EVAL VERDICTS"))}`);
|
|
86711
87040
|
if (evals.unavailable) {
|
|
86712
|
-
lines.push(` ${
|
|
87041
|
+
lines.push(` ${import_picocolors67.default.dim(sanitizeLabel(evals.unavailable))}`);
|
|
86713
87042
|
} else if (evals.runs.length === 0) {
|
|
86714
|
-
lines.push(` ${
|
|
87043
|
+
lines.push(` ${import_picocolors67.default.dim("none")}`);
|
|
86715
87044
|
} else {
|
|
86716
87045
|
for (const run of evals.runs) {
|
|
86717
|
-
const verdict = run.passed === true ?
|
|
87046
|
+
const verdict = run.passed === true ? import_picocolors67.default.green("pass") : run.passed === false ? import_picocolors67.default.red("fail") : import_picocolors67.default.dim(sanitizeLabel(run.status));
|
|
86718
87047
|
lines.push(` ${verdict} ${sanitizeLabel(run.eval_slug ?? run.eval_id)}`);
|
|
86719
87048
|
for (const line2 of sanitizeLines(run.reasoning ?? "")) {
|
|
86720
87049
|
if (line2.trim())
|
|
86721
|
-
lines.push(` ${
|
|
87050
|
+
lines.push(` ${import_picocolors67.default.dim(line2)}`);
|
|
86722
87051
|
}
|
|
86723
87052
|
}
|
|
86724
87053
|
}
|
|
86725
87054
|
lines.push("");
|
|
86726
|
-
lines.push(` ${
|
|
87055
|
+
lines.push(` ${import_picocolors67.default.dim("read its transcript with")} ${import_picocolors67.default.cyan(`brainbase task logs ${id}`)}`, "");
|
|
86727
87056
|
return lines.join(`
|
|
86728
87057
|
`);
|
|
86729
87058
|
}
|
|
@@ -86740,7 +87069,7 @@ function failureSummary(task) {
|
|
|
86740
87069
|
}
|
|
86741
87070
|
|
|
86742
87071
|
// src/cli/task-logs.ts
|
|
86743
|
-
var
|
|
87072
|
+
var import_picocolors68 = __toESM(require_picocolors(), 1);
|
|
86744
87073
|
|
|
86745
87074
|
// src/core/task-events.ts
|
|
86746
87075
|
var DEFAULT_RETRY_BUDGET_MS = 60000;
|
|
@@ -86816,12 +87145,12 @@ function followTaskEvents(options) {
|
|
|
86816
87145
|
onOpen?.();
|
|
86817
87146
|
});
|
|
86818
87147
|
source.addEventListener("error", (event) => {
|
|
86819
|
-
const { message:
|
|
87148
|
+
const { message: message3, code } = event;
|
|
86820
87149
|
if (source.readyState === source.CLOSED) {
|
|
86821
|
-
finish(streamError(
|
|
87150
|
+
finish(streamError(message3, code));
|
|
86822
87151
|
return;
|
|
86823
87152
|
}
|
|
86824
|
-
lastReason =
|
|
87153
|
+
lastReason = message3?.trim() || "connection lost";
|
|
86825
87154
|
onReconnect?.(lastReason);
|
|
86826
87155
|
if (downTimer === undefined) {
|
|
86827
87156
|
downTimer = setTimeout(() => {
|
|
@@ -86841,8 +87170,8 @@ function parseFrameData(raw) {
|
|
|
86841
87170
|
return raw;
|
|
86842
87171
|
}
|
|
86843
87172
|
}
|
|
86844
|
-
function streamError(
|
|
86845
|
-
const detail =
|
|
87173
|
+
function streamError(message3, code) {
|
|
87174
|
+
const detail = message3?.trim() || "the log stream closed";
|
|
86846
87175
|
switch (code) {
|
|
86847
87176
|
case 401:
|
|
86848
87177
|
return new ApiError(`Not authorized to read this task's events: ${detail}`, 401);
|
|
@@ -87023,14 +87352,14 @@ async function runTaskLogs(taskId, options = {}, dependencies = {}) {
|
|
|
87023
87352
|
console.log(renderEvent(event, messages));
|
|
87024
87353
|
}
|
|
87025
87354
|
if (ordered.length === 0) {
|
|
87026
|
-
console.log(
|
|
87355
|
+
console.log(import_picocolors68.default.dim("No events for this task yet."));
|
|
87027
87356
|
}
|
|
87028
87357
|
}
|
|
87029
87358
|
async function followTranscript(taskId, options, dependencies) {
|
|
87030
87359
|
const backfill = options.limit === undefined ? "" : `?backfill=${options.limit}`;
|
|
87031
87360
|
const { url: url2, resolveBearer } = await masStreamTarget(`/tasks/${encodeURIComponent(taskId)}/events/stream${backfill}`);
|
|
87032
87361
|
if (!options.json) {
|
|
87033
|
-
console.log(
|
|
87362
|
+
console.log(import_picocolors68.default.dim(`Following task ${taskId} — Ctrl-C to stop.`));
|
|
87034
87363
|
}
|
|
87035
87364
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
87036
87365
|
const controller = new AbortController;
|
|
@@ -87072,13 +87401,13 @@ async function followTranscript(taskId, options, dependencies) {
|
|
|
87072
87401
|
} else if (options.json) {
|
|
87073
87402
|
console.log(JSON.stringify(frame));
|
|
87074
87403
|
} else {
|
|
87075
|
-
console.log(
|
|
87404
|
+
console.log(import_picocolors68.default.dim(frame.type));
|
|
87076
87405
|
}
|
|
87077
87406
|
},
|
|
87078
87407
|
onOpen: () => settle.noteFrame(),
|
|
87079
87408
|
onReconnect: (reason) => {
|
|
87080
87409
|
settle.noteDisconnected();
|
|
87081
|
-
console.error(
|
|
87410
|
+
console.error(import_picocolors68.default.dim(`reconnecting — ${reason}`));
|
|
87082
87411
|
}
|
|
87083
87412
|
});
|
|
87084
87413
|
if (interruptCode !== undefined)
|
|
@@ -87234,8 +87563,8 @@ function errorCode(error2) {
|
|
|
87234
87563
|
const code = detail.code;
|
|
87235
87564
|
return typeof code === "string" ? code : undefined;
|
|
87236
87565
|
}
|
|
87237
|
-
function jsonError(error2,
|
|
87238
|
-
return { ...errorShape(error2), message:
|
|
87566
|
+
function jsonError(error2, message3, status, code) {
|
|
87567
|
+
return { ...errorShape(error2), message: message3, status, ...code ? { code } : {} };
|
|
87239
87568
|
}
|
|
87240
87569
|
function stopRetryCommand(taskId, generation) {
|
|
87241
87570
|
const argument = /^[A-Za-z0-9_-]+$/.test(taskId) ? taskId : `'${sanitizeLabel(taskId).replaceAll("'", "'\\''")}'`;
|
|
@@ -87285,8 +87614,8 @@ function onInterrupt(handler) {
|
|
|
87285
87614
|
process.off(name, listener);
|
|
87286
87615
|
};
|
|
87287
87616
|
}
|
|
87288
|
-
async function runTaskSend(taskId,
|
|
87289
|
-
if (!
|
|
87617
|
+
async function runTaskSend(taskId, message3, options = {}) {
|
|
87618
|
+
if (!message3.trim())
|
|
87290
87619
|
throw new Error("The follow-up message must not be blank.");
|
|
87291
87620
|
const inputId = options.inputId?.trim().toLowerCase() ?? randomUUID5();
|
|
87292
87621
|
if (!/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(inputId)) {
|
|
@@ -87305,7 +87634,7 @@ async function runTaskSend(taskId, message2, options = {}) {
|
|
|
87305
87634
|
attempted = true;
|
|
87306
87635
|
result2 = await masApi.sendTaskInput(taskId, {
|
|
87307
87636
|
input_id: inputId,
|
|
87308
|
-
messages: [{ role: "user", content:
|
|
87637
|
+
messages: [{ role: "user", content: message3 }],
|
|
87309
87638
|
expected_generation: expectedGeneration
|
|
87310
87639
|
});
|
|
87311
87640
|
} catch (error2) {
|
|
@@ -87384,17 +87713,17 @@ async function runTaskStop(taskId, options = {}) {
|
|
|
87384
87713
|
${retry}
|
|
87385
87714
|
Omit --generation only for a deliberately new Stop.`;
|
|
87386
87715
|
}
|
|
87387
|
-
const
|
|
87716
|
+
const message3 = `${detail}${guidance}`;
|
|
87388
87717
|
if (options.json) {
|
|
87389
87718
|
console.log(JSON.stringify({
|
|
87390
87719
|
task_id: taskId,
|
|
87391
87720
|
expected_generation: expectedGeneration,
|
|
87392
|
-
error: jsonError(error2,
|
|
87721
|
+
error: jsonError(error2, message3, status, code)
|
|
87393
87722
|
}));
|
|
87394
87723
|
process.exitCode = 1;
|
|
87395
87724
|
return;
|
|
87396
87725
|
}
|
|
87397
|
-
throw new ApiError(
|
|
87726
|
+
throw new ApiError(message3, status, error2 instanceof ApiError ? error2.body : undefined);
|
|
87398
87727
|
}
|
|
87399
87728
|
if (options.json) {
|
|
87400
87729
|
console.log(JSON.stringify({ ...task, expected_generation: expectedGeneration }, null, 2));
|
|
@@ -87756,78 +88085,78 @@ ${didYouMean(sub, ["create", "list", "get", "logs", "send", "stop", "update", "d
|
|
|
87756
88085
|
function printHelp5() {
|
|
87757
88086
|
const out = [];
|
|
87758
88087
|
out.push("");
|
|
87759
|
-
out.push(` ${
|
|
88088
|
+
out.push(` ${import_picocolors69.default.bold("brainbase task")} ${import_picocolors69.default.dim("<sub> [options]")}`);
|
|
87760
88089
|
out.push("");
|
|
87761
|
-
out.push(` ${
|
|
87762
|
-
out.push(` ${
|
|
87763
|
-
out.push(` ${
|
|
87764
|
-
out.push(` ${
|
|
87765
|
-
out.push(` ${
|
|
87766
|
-
out.push(` ${
|
|
87767
|
-
out.push(` ${
|
|
87768
|
-
out.push(` ${
|
|
88090
|
+
out.push(` ${import_picocolors69.default.cyan("create")} ${import_picocolors69.default.dim("--message <text>")} ${import_picocolors69.default.dim("create a task and start its first run")}`);
|
|
88091
|
+
out.push(` ${import_picocolors69.default.cyan("list | ls")} ${import_picocolors69.default.dim("recent tasks you can reach (--json for scripts)")}`);
|
|
88092
|
+
out.push(` ${import_picocolors69.default.cyan("get")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
88093
|
+
out.push(` ${import_picocolors69.default.cyan("logs")} ${import_picocolors69.default.dim("<task-id> [--follow]")} ${import_picocolors69.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
88094
|
+
out.push(` ${import_picocolors69.default.cyan("send")} ${import_picocolors69.default.dim("<task-id> <message>")} ${import_picocolors69.default.dim("send a follow-up, including while the agent is running")}`);
|
|
88095
|
+
out.push(` ${import_picocolors69.default.cyan("stop")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
88096
|
+
out.push(` ${import_picocolors69.default.cyan("update")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("rename a task, change its metadata labels, switch its model or reset it to the agent default, including while it runs")}`);
|
|
88097
|
+
out.push(` ${import_picocolors69.default.cyan("delete")} ${import_picocolors69.default.dim("<task-id>")} ${import_picocolors69.default.dim("permanently delete a stopped task and tear down its sandbox (--yes to skip the prompt)")}`);
|
|
87769
88098
|
out.push("");
|
|
87770
|
-
out.push(` ${
|
|
87771
|
-
out.push(` ${
|
|
87772
|
-
out.push(` ${
|
|
87773
|
-
out.push(` ${
|
|
87774
|
-
out.push(` ${
|
|
87775
|
-
out.push(` ${
|
|
87776
|
-
out.push(` ${
|
|
87777
|
-
out.push(` ${
|
|
87778
|
-
out.push(` ${
|
|
87779
|
-
out.push(` ${
|
|
88099
|
+
out.push(` ${import_picocolors69.default.bold("create flags")}`);
|
|
88100
|
+
out.push(` ${import_picocolors69.default.dim("--message <text>")} required first user message`);
|
|
88101
|
+
out.push(` ${import_picocolors69.default.dim("--agent <id>")} override the claimed agent in brainbase.agent.yaml`);
|
|
88102
|
+
out.push(` ${import_picocolors69.default.dim("--interface <id>")} open it as a build conversation for this interface (agent defaults to the interface's)`);
|
|
88103
|
+
out.push(` ${import_picocolors69.default.dim("--title <text>")} optional task title`);
|
|
88104
|
+
out.push(` ${import_picocolors69.default.dim("--model <id>")} optional model override`);
|
|
88105
|
+
out.push(` ${import_picocolors69.default.dim("--version <v>")} run a saved version of the agent: 12, v12 or a version id (\`agent versions list\`)`);
|
|
88106
|
+
out.push(` ${import_picocolors69.default.dim("--metadata key=value")} label the task (repeatable)`);
|
|
88107
|
+
out.push(` ${import_picocolors69.default.dim("--wait")} block until the task finishes; exit 1 unless it succeeded`);
|
|
88108
|
+
out.push(` ${import_picocolors69.default.dim("--timeout <secs>")} give up waiting after <secs> and exit 1 (needs --wait)`);
|
|
87780
88109
|
out.push("");
|
|
87781
|
-
out.push(` ${
|
|
87782
|
-
out.push(` ${
|
|
87783
|
-
out.push(` ${
|
|
87784
|
-
out.push(` ${
|
|
87785
|
-
out.push(` ${
|
|
88110
|
+
out.push(` ${import_picocolors69.default.bold("list flags")}`);
|
|
88111
|
+
out.push(` ${import_picocolors69.default.dim("--agent <id>")} only this agent's tasks`);
|
|
88112
|
+
out.push(` ${import_picocolors69.default.dim("--interface <id>")} only this interface's build conversations (hidden from a plain list)`);
|
|
88113
|
+
out.push(` ${import_picocolors69.default.dim("--metadata key=value")} only tasks carrying this label (repeatable; all must match)`);
|
|
88114
|
+
out.push(` ${import_picocolors69.default.dim("--limit <n>")} cap the page (1-200, server default 50)`);
|
|
87786
88115
|
out.push("");
|
|
87787
|
-
out.push(` ${
|
|
87788
|
-
out.push(` ${
|
|
87789
|
-
out.push(` ${
|
|
88116
|
+
out.push(` ${import_picocolors69.default.bold("logs flags")}`);
|
|
88117
|
+
out.push(` ${import_picocolors69.default.dim("--limit <n>")} stop after <n> events instead of the whole transcript; with --follow, the first page size`);
|
|
88118
|
+
out.push(` ${import_picocolors69.default.dim("--follow, -f")} stay attached and print events as they land, until the task finishes and any queued follow-ups have run`);
|
|
87790
88119
|
out.push("");
|
|
87791
|
-
out.push(` ${
|
|
87792
|
-
out.push(` ${
|
|
87793
|
-
out.push(` ${
|
|
87794
|
-
out.push(` ${
|
|
87795
|
-
out.push(` ${
|
|
87796
|
-
out.push(` ${
|
|
87797
|
-
out.push(` ${
|
|
87798
|
-
out.push(` ${
|
|
87799
|
-
out.push(` ${
|
|
88120
|
+
out.push(` ${import_picocolors69.default.bold("update flags")}`);
|
|
88121
|
+
out.push(` ${import_picocolors69.default.dim("--title <text>")} new title`);
|
|
88122
|
+
out.push(` ${import_picocolors69.default.dim("--clear-title")} remove the title; automatic titling may name the task again on a later turn`);
|
|
88123
|
+
out.push(` ${import_picocolors69.default.dim("--metadata key=value")} set one label, keeping the others (repeatable)`);
|
|
88124
|
+
out.push(` ${import_picocolors69.default.dim("--unset-metadata <key>")} remove one label (repeatable)`);
|
|
88125
|
+
out.push(` ${import_picocolors69.default.dim(" the server applies label edits in one step, so concurrent edits from other clients are kept")}`);
|
|
88126
|
+
out.push(` ${import_picocolors69.default.dim("--clear-metadata")} remove every label; with --metadata, the labels become exactly those given`);
|
|
88127
|
+
out.push(` ${import_picocolors69.default.dim("--model <id>")} switch the model the task's next turn runs on (the running turn keeps its model)`);
|
|
88128
|
+
out.push(` ${import_picocolors69.default.dim("--clear-model")} go back to the agent's default model from the next turn`);
|
|
87800
88129
|
out.push("");
|
|
87801
|
-
out.push(` ${
|
|
87802
|
-
out.push(` ${
|
|
87803
|
-
out.push(` ${
|
|
87804
|
-
out.push(` ${
|
|
88130
|
+
out.push(` ${import_picocolors69.default.bold("send flags")}`);
|
|
88131
|
+
out.push(` ${import_picocolors69.default.dim("--input-id <uuid>")} recover the same request using its original ID and identical message`);
|
|
88132
|
+
out.push(` ${import_picocolors69.default.dim(" omit it to send a new follow-up; an unconfirmed receipt is never automatically replayed")}`);
|
|
88133
|
+
out.push(` ${import_picocolors69.default.dim(" admission disabled/recovery unavailable means no input was admitted; retry the same ID after recovery")}`);
|
|
87805
88134
|
out.push("");
|
|
87806
|
-
out.push(` ${
|
|
87807
|
-
out.push(` ${
|
|
87808
|
-
out.push(` ${
|
|
88135
|
+
out.push(` ${import_picocolors69.default.bold("send and stop flags")}`);
|
|
88136
|
+
out.push(` ${import_picocolors69.default.dim("--generation <n>")} retain the printed generation when retrying; defaults to a fresh snapshot for a new operation`);
|
|
88137
|
+
out.push(` ${import_picocolors69.default.dim(" Stop errors may follow queued-input cancellation; retry the printed command to avoid stopping newer work")}`);
|
|
87809
88138
|
out.push("");
|
|
87810
|
-
out.push(` ${
|
|
87811
|
-
out.push(` ${
|
|
87812
|
-
out.push(` ${
|
|
87813
|
-
out.push(` ${
|
|
88139
|
+
out.push(` ${import_picocolors69.default.bold("every subcommand")}`);
|
|
88140
|
+
out.push(` ${import_picocolors69.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`);
|
|
88141
|
+
out.push(` ${import_picocolors69.default.dim(" send and stop include expected_generation for safe retries; send also reports idempotency_replayed when present")}`);
|
|
88142
|
+
out.push(` ${import_picocolors69.default.dim(" logs --follow --json prints one record per line, since a live stream has no end to close on")}`);
|
|
87814
88143
|
out.push("");
|
|
87815
|
-
out.push(` ${
|
|
87816
|
-
out.push(` ${
|
|
87817
|
-
out.push(` ${
|
|
87818
|
-
out.push(` ${
|
|
88144
|
+
out.push(` ${import_picocolors69.default.dim("Exit codes with --wait:")} ${import_picocolors69.default.dim("0 succeeded · 1 failed, needs input, or timed out · 130 interrupted")}`);
|
|
88145
|
+
out.push(` ${import_picocolors69.default.dim("Exit codes with --follow:")} ${import_picocolors69.default.dim("0 task reached a terminal state · 1 stream refused, or unreachable for 60s · 130 interrupted (Ctrl-C) · 143 terminated")}`);
|
|
88146
|
+
out.push(` ${import_picocolors69.default.dim("Exit codes with send:")} ${import_picocolors69.default.dim("0 queued, dispatching, submitted or completed · 1 unconfirmed, cancelled, failed or request error")}`);
|
|
88147
|
+
out.push(` ${import_picocolors69.default.dim("Ctrl-C while waiting or following logs detaches; use task stop to cancel remote work.")}`);
|
|
87819
88148
|
out.push("");
|
|
87820
|
-
out.push(` ${
|
|
88149
|
+
out.push(` ${import_picocolors69.default.dim("Flag-like values:")} use ${import_picocolors69.default.cyan("--flag=value")} or ${import_picocolors69.default.cyan("--flag -- <value>")}`);
|
|
87821
88150
|
out.push("");
|
|
87822
88151
|
console.log(out.join(`
|
|
87823
88152
|
`));
|
|
87824
88153
|
}
|
|
87825
88154
|
|
|
87826
88155
|
// src/cli/machine.ts
|
|
87827
|
-
var
|
|
88156
|
+
var import_picocolors72 = __toESM(require_picocolors(), 1);
|
|
87828
88157
|
|
|
87829
88158
|
// src/cli/machine-list.ts
|
|
87830
|
-
var
|
|
88159
|
+
var import_picocolors70 = __toESM(require_picocolors(), 1);
|
|
87831
88160
|
async function runMachineList(args = {}) {
|
|
87832
88161
|
if (!args.json)
|
|
87833
88162
|
banner("machine list — sandboxes you can reach");
|
|
@@ -87845,7 +88174,7 @@ async function runMachineList(args = {}) {
|
|
|
87845
88174
|
function formatMachineList(machines, includedDead, names = new Map) {
|
|
87846
88175
|
const lines = [""];
|
|
87847
88176
|
if (machines.length === 0) {
|
|
87848
|
-
lines.push(` ${
|
|
88177
|
+
lines.push(` ${import_picocolors70.default.dim(includedDead ? "No machines." : "No live machines. Pass --all to include torn-down ones.")}`, "");
|
|
87849
88178
|
return lines.join(`
|
|
87850
88179
|
`);
|
|
87851
88180
|
}
|
|
@@ -87865,7 +88194,7 @@ function formatMachineList(machines, includedDead, names = new Map) {
|
|
|
87865
88194
|
const statusWidth = width((row) => row.status);
|
|
87866
88195
|
const sizeWidth = width((row) => row.size);
|
|
87867
88196
|
const agentWidth = width((row) => row.agent);
|
|
87868
|
-
lines.push(` ${
|
|
88197
|
+
lines.push(` ${import_picocolors70.default.dim([
|
|
87869
88198
|
header.id.padEnd(idWidth),
|
|
87870
88199
|
header.kind.padEnd(kindWidth),
|
|
87871
88200
|
header.status.padEnd(statusWidth),
|
|
@@ -87881,21 +88210,21 @@ function formatMachineList(machines, includedDead, names = new Map) {
|
|
|
87881
88210
|
row.dead ? status : statusTint(row.status, status),
|
|
87882
88211
|
row.size.padEnd(sizeWidth),
|
|
87883
88212
|
row.agent.padEnd(agentWidth),
|
|
87884
|
-
|
|
88213
|
+
import_picocolors70.default.dim(row.age)
|
|
87885
88214
|
].join(" ");
|
|
87886
|
-
lines.push(` ${row.dead ?
|
|
88215
|
+
lines.push(` ${row.dead ? import_picocolors70.default.dim(cells) : cells}`);
|
|
87887
88216
|
}
|
|
87888
|
-
lines.push("", ` ${
|
|
88217
|
+
lines.push("", ` ${import_picocolors70.default.dim("tear one down with")} ${import_picocolors70.default.cyan("brainbase machine rm <id>")}`, "");
|
|
87889
88218
|
return lines.join(`
|
|
87890
88219
|
`);
|
|
87891
88220
|
}
|
|
87892
88221
|
function statusTint(status, padded) {
|
|
87893
88222
|
switch (status) {
|
|
87894
88223
|
case "running":
|
|
87895
|
-
return
|
|
88224
|
+
return import_picocolors70.default.green(padded);
|
|
87896
88225
|
case "stopped":
|
|
87897
88226
|
case "starting":
|
|
87898
|
-
return
|
|
88227
|
+
return import_picocolors70.default.yellow(padded);
|
|
87899
88228
|
default:
|
|
87900
88229
|
return padded;
|
|
87901
88230
|
}
|
|
@@ -87918,7 +88247,7 @@ function age(createdAt) {
|
|
|
87918
88247
|
}
|
|
87919
88248
|
|
|
87920
88249
|
// src/cli/machine-rm.ts
|
|
87921
|
-
var
|
|
88250
|
+
var import_picocolors71 = __toESM(require_picocolors(), 1);
|
|
87922
88251
|
async function runMachineRm(args, dependencies = {}) {
|
|
87923
88252
|
const setExitCode = dependencies.setExitCode ?? ((code) => process.exitCode = code);
|
|
87924
88253
|
const machineId = args.machineId?.trim();
|
|
@@ -87932,7 +88261,7 @@ async function runMachineRm(args, dependencies = {}) {
|
|
|
87932
88261
|
if (args.json) {
|
|
87933
88262
|
console.log(JSON.stringify({ id: machineId, torn_down: false, outcome: "declined" }, null, 2));
|
|
87934
88263
|
} else {
|
|
87935
|
-
console.log(` ${
|
|
88264
|
+
console.log(` ${import_picocolors71.default.dim("Left alone.")}`);
|
|
87936
88265
|
}
|
|
87937
88266
|
return;
|
|
87938
88267
|
}
|
|
@@ -87950,7 +88279,7 @@ async function promptForTeardown(args) {
|
|
|
87950
88279
|
return true;
|
|
87951
88280
|
if (!args.json) {
|
|
87952
88281
|
console.log(`
|
|
87953
|
-
${
|
|
88282
|
+
${import_picocolors71.default.red("This destroys the sandbox.")} ${import_picocolors71.default.dim("Anything not committed out of it is lost. The machine row is kept for cost history.")}
|
|
87954
88283
|
`);
|
|
87955
88284
|
}
|
|
87956
88285
|
const answer = await se({
|
|
@@ -87962,9 +88291,9 @@ async function promptForTeardown(args) {
|
|
|
87962
88291
|
function formatMachineRm(machine) {
|
|
87963
88292
|
const lines = [""];
|
|
87964
88293
|
if (machine.destroyed_at) {
|
|
87965
|
-
lines.push(` ${
|
|
88294
|
+
lines.push(` ${import_picocolors71.default.green("✓")} ${machine.kind} sandbox ${machine.id} is torn down.`, ` ${import_picocolors71.default.dim(`destroyed_at ${machine.destroyed_at}`)}`);
|
|
87966
88295
|
} else {
|
|
87967
|
-
lines.push(` ${
|
|
88296
|
+
lines.push(` ${import_picocolors71.default.yellow("!")} ${machine.id} came back without a teardown timestamp (status ${machine.status}).`, ` ${import_picocolors71.default.dim("Re-check with `brainbase machine ls --all` before assuming it stopped billing.")}`);
|
|
87968
88297
|
}
|
|
87969
88298
|
lines.push("");
|
|
87970
88299
|
return lines.join(`
|
|
@@ -88005,25 +88334,25 @@ ${didYouMean(sub, ["ls", "rm"], "brainbase machine")}`);
|
|
|
88005
88334
|
function printHelp6() {
|
|
88006
88335
|
const out = [];
|
|
88007
88336
|
out.push("");
|
|
88008
|
-
out.push(` ${
|
|
88337
|
+
out.push(` ${import_picocolors72.default.bold("brainbase machine")} ${import_picocolors72.default.dim("<sub> [options]")}`);
|
|
88009
88338
|
out.push("");
|
|
88010
|
-
out.push(` ${
|
|
88011
|
-
out.push(` ${
|
|
88339
|
+
out.push(` ${import_picocolors72.default.cyan("ls")} ${import_picocolors72.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
88340
|
+
out.push(` ${import_picocolors72.default.cyan("rm")} ${import_picocolors72.default.dim("<id>")} ${import_picocolors72.default.dim("tear a sandbox down (terminal; the row is kept for cost history)")}`);
|
|
88012
88341
|
out.push("");
|
|
88013
|
-
out.push(` ${
|
|
88014
|
-
out.push(` ${
|
|
88015
|
-
out.push(` ${
|
|
88016
|
-
out.push(` ${
|
|
88342
|
+
out.push(` ${import_picocolors72.default.dim("--all")} ${import_picocolors72.default.dim("for ls: include machines already torn down")}`);
|
|
88343
|
+
out.push(` ${import_picocolors72.default.dim("--limit <n>")} ${import_picocolors72.default.dim("for ls: how many to fetch (1-200, default 50)")}`);
|
|
88344
|
+
out.push(` ${import_picocolors72.default.dim("--yes, -y")} ${import_picocolors72.default.dim("for rm: skip the confirmation")}`);
|
|
88345
|
+
out.push(` ${import_picocolors72.default.dim("--json")} ${import_picocolors72.default.dim("machine-readable output")}`);
|
|
88017
88346
|
out.push("");
|
|
88018
88347
|
console.log(out.join(`
|
|
88019
88348
|
`));
|
|
88020
88349
|
}
|
|
88021
88350
|
|
|
88022
88351
|
// src/cli/interface.ts
|
|
88023
|
-
var
|
|
88352
|
+
var import_picocolors78 = __toESM(require_picocolors(), 1);
|
|
88024
88353
|
|
|
88025
88354
|
// src/cli/interface-build.ts
|
|
88026
|
-
var
|
|
88355
|
+
var import_picocolors73 = __toESM(require_picocolors(), 1);
|
|
88027
88356
|
var USAGE2 = 'brainbase interface build <id> "<request>" [--timeout <seconds>] [--idempotency-key <key>] [--json]';
|
|
88028
88357
|
var SETTLE_TIMEOUT_MS = 120000;
|
|
88029
88358
|
async function reportingErrors(json3, work) {
|
|
@@ -88050,8 +88379,8 @@ function heldBy(row, ownTaskId) {
|
|
|
88050
88379
|
const taskId = held.thread_id;
|
|
88051
88380
|
if (ownTaskId !== undefined && taskId === ownTaskId)
|
|
88052
88381
|
return null;
|
|
88053
|
-
const
|
|
88054
|
-
return cliRefusal("conflict", "generation_running",
|
|
88382
|
+
const message3 = taskId ? `Another build conversation (${safe(taskId)}) is working on this interface. Follow it with \`brainbase task logs ${safe(taskId)} --follow\`, or wait for it to finish and run this again.` : `A build conversation is working on this interface (operation ${safe(held.operation_id)}). Wait for it to finish and run this again.`;
|
|
88383
|
+
return cliRefusal("conflict", "generation_running", message3, {
|
|
88055
88384
|
operation_id: held.operation_id,
|
|
88056
88385
|
task_id: taskId
|
|
88057
88386
|
});
|
|
@@ -88122,28 +88451,28 @@ function buildExitCode(outcome) {
|
|
|
88122
88451
|
function reportBuild(say, interfaceId, outcome, timeoutSeconds) {
|
|
88123
88452
|
switch (outcome.kind) {
|
|
88124
88453
|
case "built":
|
|
88125
|
-
say(` ${
|
|
88454
|
+
say(` ${import_picocolors73.default.dim("build")} ${safe(outcome.build.id)} ${import_picocolors73.default.green("succeeded")}`);
|
|
88126
88455
|
say("");
|
|
88127
|
-
say(` ${
|
|
88456
|
+
say(` ${import_picocolors73.default.dim("Next:")} ${import_picocolors73.default.cyan(`brainbase interface publish ${safe(interfaceId)}`)}`);
|
|
88128
88457
|
return;
|
|
88129
88458
|
case "failed": {
|
|
88130
88459
|
const reason = outcome.build?.error_summary ?? outcome.operation?.error ?? outcome.operation?.reason ?? null;
|
|
88131
|
-
say(` ${
|
|
88460
|
+
say(` ${import_picocolors73.default.dim("build")} ${outcome.build ? safe(outcome.build.id) : import_picocolors73.default.dim("none")} ${import_picocolors73.default.red("failed")}`);
|
|
88132
88461
|
if (reason)
|
|
88133
88462
|
say(` ${safeBlock(reason).split(`
|
|
88134
88463
|
`).join(`
|
|
88135
88464
|
`)}`);
|
|
88136
|
-
say(` ${
|
|
88465
|
+
say(` ${import_picocolors73.default.dim("Try again with")} ${import_picocolors73.default.cyan(`brainbase interface rebuild ${safe(interfaceId)}`)}`);
|
|
88137
88466
|
return;
|
|
88138
88467
|
}
|
|
88139
88468
|
case "busy":
|
|
88140
|
-
say(` ${
|
|
88469
|
+
say(` ${import_picocolors73.default.yellow(safe(outcome.message))}`);
|
|
88141
88470
|
return;
|
|
88142
88471
|
case "timeout":
|
|
88143
|
-
say(` ${
|
|
88472
|
+
say(` ${import_picocolors73.default.yellow(`Still building after ${timeoutSeconds}s.`)} ${import_picocolors73.default.dim(`It keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
88144
88473
|
return;
|
|
88145
88474
|
case "interrupted":
|
|
88146
|
-
say(` ${
|
|
88475
|
+
say(` ${import_picocolors73.default.yellow("Stopped waiting.")} ${import_picocolors73.default.dim(`The build keeps going; check \`brainbase interface builds ${safe(interfaceId)}\`.`)}`);
|
|
88147
88476
|
return;
|
|
88148
88477
|
default: {
|
|
88149
88478
|
const unreachable = outcome;
|
|
@@ -88190,8 +88519,8 @@ async function build(ctx) {
|
|
|
88190
88519
|
throw held;
|
|
88191
88520
|
}
|
|
88192
88521
|
const reattach = `brainbase task logs ${safe(taskId)} --follow`;
|
|
88193
|
-
say(` ${
|
|
88194
|
-
say(` ${
|
|
88522
|
+
say(` ${import_picocolors73.default.dim("Build conversation")} ${import_picocolors73.default.bold(safe(taskId))} ${import_picocolors73.default.dim(`on ${safe(before2.name)}`)}`);
|
|
88523
|
+
say(` ${import_picocolors73.default.dim(`If this stops early, reattach with \`${reattach}\`.`)}`);
|
|
88195
88524
|
const finish = (result2, exitCode) => {
|
|
88196
88525
|
if (json3)
|
|
88197
88526
|
console.log(JSON.stringify({ type: "result", task_id: taskId, ...result2 }));
|
|
@@ -88208,13 +88537,13 @@ async function build(ctx) {
|
|
|
88208
88537
|
});
|
|
88209
88538
|
} catch (error2) {
|
|
88210
88539
|
say("");
|
|
88211
|
-
say(` ${
|
|
88212
|
-
say(` ${
|
|
88540
|
+
say(` ${import_picocolors73.default.red(`Lost the conversation's event stream: ${safe(error2.message)}`)}`);
|
|
88541
|
+
say(` ${import_picocolors73.default.dim(`Conversation ${safe(taskId)} may still be running. Reattach with`)} ${import_picocolors73.default.cyan(reattach)}`);
|
|
88213
88542
|
finish({ version_id: null, build_id: null, status: "stream_lost", task_status: null }, 1);
|
|
88214
88543
|
return;
|
|
88215
88544
|
}
|
|
88216
88545
|
if (followExit !== undefined) {
|
|
88217
|
-
say(` ${
|
|
88546
|
+
say(` ${import_picocolors73.default.yellow("Stopped following.")} ${import_picocolors73.default.dim(`The conversation keeps running. Reattach with \`${reattach}\`.`)}`);
|
|
88218
88547
|
finish({ version_id: null, build_id: null, status: "interrupted", task_status: null }, followExit);
|
|
88219
88548
|
return;
|
|
88220
88549
|
}
|
|
@@ -88229,7 +88558,7 @@ async function build(ctx) {
|
|
|
88229
88558
|
if (settled.kind !== "terminal") {
|
|
88230
88559
|
const interrupted = settled.kind === "interrupted";
|
|
88231
88560
|
const status2 = settled.task?.status ?? null;
|
|
88232
|
-
say(` ${
|
|
88561
|
+
say(` ${import_picocolors73.default.yellow(interrupted ? "Stopped." : `The conversation is still ${safe(status2 ?? "running")}.`)} ${import_picocolors73.default.dim(`Check it with \`brainbase task get ${safe(taskId)}\`.`)}`);
|
|
88233
88562
|
finish({ version_id: null, build_id: null, status: interrupted ? "interrupted" : "task_unsettled", task_status: status2 }, interrupted ? SIGINT_EXIT_CODE : 1);
|
|
88234
88563
|
return;
|
|
88235
88564
|
}
|
|
@@ -88249,36 +88578,36 @@ async function build(ctx) {
|
|
|
88249
88578
|
}
|
|
88250
88579
|
const codes = [exitCodeForTaskStatus(task.status)];
|
|
88251
88580
|
say("");
|
|
88252
|
-
say(` ${
|
|
88581
|
+
say(` ${import_picocolors73.default.dim("conversation")} ${safe(taskId)} ${import_picocolors73.default.dim("ended")} ${safe(task.status)}`);
|
|
88253
88582
|
if (mine?.status === "failed") {
|
|
88254
88583
|
codes.push(1);
|
|
88255
88584
|
const why = [mine.reason, mine.error].filter(Boolean).map((part) => safe(part)).join(": ");
|
|
88256
|
-
say(` ${
|
|
88585
|
+
say(` ${import_picocolors73.default.red(`This conversation's build work failed${why ? ` (${why})` : ""}.`)}`);
|
|
88257
88586
|
} else if (task.status !== "success" && task.status !== "need_more_info") {
|
|
88258
|
-
say(` ${
|
|
88587
|
+
say(` ${import_picocolors73.default.red(`The conversation finished as ${safe(task.status)}.`)} ${import_picocolors73.default.dim(`See \`brainbase task logs ${safe(taskId)}\`.`)}`);
|
|
88259
88588
|
}
|
|
88260
88589
|
if (task.status === "need_more_info") {
|
|
88261
88590
|
const question = await lastAgentMessage(taskId);
|
|
88262
88591
|
say("");
|
|
88263
88592
|
if (question) {
|
|
88264
|
-
say(` ${
|
|
88593
|
+
say(` ${import_picocolors73.default.bold("The agent asks:")}`);
|
|
88265
88594
|
say(` ${safeBlock(question).split(`
|
|
88266
88595
|
`).join(`
|
|
88267
88596
|
`)}`);
|
|
88268
88597
|
} else {
|
|
88269
|
-
say(` ${
|
|
88598
|
+
say(` ${import_picocolors73.default.bold("The agent needs more from you before it can go on.")}`);
|
|
88270
88599
|
}
|
|
88271
88600
|
say("");
|
|
88272
|
-
say(` ${
|
|
88273
|
-
say(` ${
|
|
88601
|
+
say(` ${import_picocolors73.default.dim("Reply with")} ${import_picocolors73.default.cyan(`brainbase task send ${safe(taskId)} "<reply>"`)}`);
|
|
88602
|
+
say(` ${import_picocolors73.default.dim("then follow it with")} ${import_picocolors73.default.cyan(reattach)}`);
|
|
88274
88603
|
}
|
|
88275
88604
|
let status;
|
|
88276
88605
|
let buildId = null;
|
|
88277
88606
|
if (versionId) {
|
|
88278
88607
|
say("");
|
|
88279
|
-
say(` ${
|
|
88608
|
+
say(` ${import_picocolors73.default.dim("version")} ${safe(versionId)}`);
|
|
88280
88609
|
if (!json3)
|
|
88281
|
-
say(` ${
|
|
88610
|
+
say(` ${import_picocolors73.default.dim("Waiting for its build...")}`);
|
|
88282
88611
|
const buildKey = `${key2}-build`;
|
|
88283
88612
|
let outcome;
|
|
88284
88613
|
try {
|
|
@@ -88288,7 +88617,7 @@ async function build(ctx) {
|
|
|
88288
88617
|
signal: stop.signal,
|
|
88289
88618
|
now: deps.now,
|
|
88290
88619
|
idempotencyKey: buildKey,
|
|
88291
|
-
onStall: () => say(` ${
|
|
88620
|
+
onStall: () => say(` ${import_picocolors73.default.yellow("The build looks stalled; still waiting in case another worker picks it up.")}`)
|
|
88292
88621
|
});
|
|
88293
88622
|
} catch (error2) {
|
|
88294
88623
|
if (error2 instanceof LostResponseError) {
|
|
@@ -88304,9 +88633,9 @@ async function build(ctx) {
|
|
|
88304
88633
|
status = noVersionStatus(mine?.status === "failed", task.status);
|
|
88305
88634
|
if (status === "no_version") {
|
|
88306
88635
|
codes.push(1);
|
|
88307
|
-
say(` ${
|
|
88636
|
+
say(` ${import_picocolors73.default.red("The conversation finished without committing a version, so there is nothing to build.")}`);
|
|
88308
88637
|
} else if (task.status !== "need_more_info") {
|
|
88309
|
-
say(` ${
|
|
88638
|
+
say(` ${import_picocolors73.default.dim("This conversation produced no version, so there is nothing to build.")}`);
|
|
88310
88639
|
}
|
|
88311
88640
|
}
|
|
88312
88641
|
if (!json3)
|
|
@@ -88321,7 +88650,7 @@ async function build(ctx) {
|
|
|
88321
88650
|
var buildCommands = { build };
|
|
88322
88651
|
|
|
88323
88652
|
// src/cli/interface-lifecycle.ts
|
|
88324
|
-
var
|
|
88653
|
+
var import_picocolors75 = __toESM(require_picocolors(), 1);
|
|
88325
88654
|
|
|
88326
88655
|
// src/core/org-members.ts
|
|
88327
88656
|
async function listAllOrgMembers(orgId) {
|
|
@@ -88375,7 +88704,7 @@ function membersById(members) {
|
|
|
88375
88704
|
}
|
|
88376
88705
|
|
|
88377
88706
|
// src/cli/interface-read.ts
|
|
88378
|
-
var
|
|
88707
|
+
var import_picocolors74 = __toESM(require_picocolors(), 1);
|
|
88379
88708
|
function interfaceState(row) {
|
|
88380
88709
|
if (row.archived_at)
|
|
88381
88710
|
return "archived";
|
|
@@ -88397,11 +88726,11 @@ function threadsLabel(shared) {
|
|
|
88397
88726
|
function stateTint(state) {
|
|
88398
88727
|
switch (state) {
|
|
88399
88728
|
case "live":
|
|
88400
|
-
return
|
|
88729
|
+
return import_picocolors74.default.green;
|
|
88401
88730
|
case "building":
|
|
88402
|
-
return
|
|
88731
|
+
return import_picocolors74.default.yellow;
|
|
88403
88732
|
case "archived":
|
|
88404
|
-
return
|
|
88733
|
+
return import_picocolors74.default.dim;
|
|
88405
88734
|
case "draft":
|
|
88406
88735
|
return (cell) => cell;
|
|
88407
88736
|
default: {
|
|
@@ -88434,7 +88763,7 @@ async function list3(ctx) {
|
|
|
88434
88763
|
if (shown.length === 0) {
|
|
88435
88764
|
const empty = onlyArchived ? "No archived interfaces." : includeArchived ? "No interfaces. Create one with `brainbase interface create`." : await emptyWithoutArchived(agentId);
|
|
88436
88765
|
console.log(`
|
|
88437
|
-
${
|
|
88766
|
+
${import_picocolors74.default.dim(empty)}
|
|
88438
88767
|
`);
|
|
88439
88768
|
return;
|
|
88440
88769
|
}
|
|
@@ -88447,7 +88776,7 @@ async function list3(ctx) {
|
|
|
88447
88776
|
audienceWord(row),
|
|
88448
88777
|
ago(row.last_edited_at ?? row.created_at, now2)
|
|
88449
88778
|
]);
|
|
88450
|
-
console.log(["", ...table(cells, [null,
|
|
88779
|
+
console.log(["", ...table(cells, [null, import_picocolors74.default.bold, null, null, null, import_picocolors74.default.dim]), ""].join(`
|
|
88451
88780
|
`));
|
|
88452
88781
|
});
|
|
88453
88782
|
}
|
|
@@ -88481,13 +88810,13 @@ async function get2(ctx) {
|
|
|
88481
88810
|
out.push(field("id", safe(row.id)));
|
|
88482
88811
|
out.push(field("agent", agentLabel(safe(row.agent_id), await agentNames([row.agent_id]))));
|
|
88483
88812
|
out.push(field("state", stateTint(state)(state)));
|
|
88484
|
-
out.push(field("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${
|
|
88813
|
+
out.push(field("address", row.live_release ? safe(row.live_release.url) : `${safe(row.slug)} ${import_picocolors74.default.dim("(nothing live yet)")}`));
|
|
88485
88814
|
out.push(field("audience", audienceLabel(row)));
|
|
88486
88815
|
out.push(field("threads", threadsLabel(row.share_agent_threads)));
|
|
88487
|
-
out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${
|
|
88488
|
-
out.push(field("draft", row.draft_version_id ? safe(row.draft_version_id) :
|
|
88816
|
+
out.push(field("live", row.live_release ? `${safe(row.live_release.id)} ${import_picocolors74.default.dim(`published ${ago(row.live_release.published_at)}`)}` : import_picocolors74.default.dim("none")));
|
|
88817
|
+
out.push(field("draft", row.draft_version_id ? safe(row.draft_version_id) : import_picocolors74.default.dim("none yet")));
|
|
88489
88818
|
if (row.running_generation) {
|
|
88490
|
-
out.push(field("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${
|
|
88819
|
+
out.push(field("building", `conversation ${safe(row.running_generation.thread_id ?? "")} ${import_picocolors74.default.dim(`(follow it with \`brainbase task logs ${safe(row.running_generation.thread_id ?? "")} --follow\`)`)}`));
|
|
88491
88820
|
}
|
|
88492
88821
|
if (row.archived_at)
|
|
88493
88822
|
out.push(field("archived", ago(row.archived_at)));
|
|
@@ -88516,7 +88845,7 @@ async function open(ctx) {
|
|
|
88516
88845
|
}
|
|
88517
88846
|
console.log(safe(url2));
|
|
88518
88847
|
if (new URL(url2).hostname.endsWith("vercel.app")) {
|
|
88519
|
-
console.error(
|
|
88848
|
+
console.error(import_picocolors74.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."));
|
|
88520
88849
|
}
|
|
88521
88850
|
});
|
|
88522
88851
|
}
|
|
@@ -88554,7 +88883,7 @@ async function history(ctx, name) {
|
|
|
88554
88883
|
banner(`interface ${name} — ${safe(id)}`);
|
|
88555
88884
|
if (rows.length === 0) {
|
|
88556
88885
|
console.log(`
|
|
88557
|
-
${
|
|
88886
|
+
${import_picocolors74.default.dim(`No ${name} yet.`)}
|
|
88558
88887
|
`);
|
|
88559
88888
|
return;
|
|
88560
88889
|
}
|
|
@@ -88631,7 +88960,7 @@ function exactlyOne(parsed, flags) {
|
|
|
88631
88960
|
}
|
|
88632
88961
|
function peopleLine(access, members) {
|
|
88633
88962
|
const ids = grantIds(access);
|
|
88634
|
-
return ids.length ? namesOf(ids, members) :
|
|
88963
|
+
return ids.length ? namesOf(ids, members) : import_picocolors75.default.dim("nobody named");
|
|
88635
88964
|
}
|
|
88636
88965
|
function printAccess(row, access, members) {
|
|
88637
88966
|
console.log([
|
|
@@ -88692,8 +89021,8 @@ async function create3(ctx) {
|
|
|
88692
89021
|
}
|
|
88693
89022
|
} catch (error2) {
|
|
88694
89023
|
readFailed = true;
|
|
88695
|
-
const
|
|
88696
|
-
accessError = error2 instanceof InterfaceApiError ? new InterfaceApiError(
|
|
89024
|
+
const message3 = `Created ${created.id}, but its audience could not be read, so it was not changed. ` + `Check it with \`brainbase interface access ${created.id}\`. (${error2.message})`;
|
|
89025
|
+
accessError = error2 instanceof InterfaceApiError ? new InterfaceApiError(message3, error2.code, error2.reason, error2.details, error2.status, error2.body) : new Error(message3);
|
|
88697
89026
|
}
|
|
88698
89027
|
}
|
|
88699
89028
|
if (audience && !note && !readFailed) {
|
|
@@ -88727,11 +89056,11 @@ async function create3(ctx) {
|
|
|
88727
89056
|
const id = safe(created.id);
|
|
88728
89057
|
const out = [
|
|
88729
89058
|
"",
|
|
88730
|
-
` ${
|
|
89059
|
+
` ${import_picocolors75.default.green("Created")} ${import_picocolors75.default.bold(safe(created.name))}`,
|
|
88731
89060
|
"",
|
|
88732
89061
|
field("id", id),
|
|
88733
89062
|
field("agent", safe(created.agent_id)),
|
|
88734
|
-
field("address", `${safe(created.slug)} ${
|
|
89063
|
+
field("address", `${safe(created.slug)} ${import_picocolors75.default.dim("(nothing live yet)")}`),
|
|
88735
89064
|
field("threads", threadsLabel(created.share_agent_threads))
|
|
88736
89065
|
];
|
|
88737
89066
|
if (access) {
|
|
@@ -88743,11 +89072,11 @@ async function create3(ctx) {
|
|
|
88743
89072
|
out.push("", ` Nobody can open it until you choose who can: \`brainbase interface access ${id} --everyone\` or \`--people <emails>\`.`);
|
|
88744
89073
|
}
|
|
88745
89074
|
if (created.share_agent_threads) {
|
|
88746
|
-
out.push(` ${
|
|
89075
|
+
out.push(` ${import_picocolors75.default.dim(`To show viewers only their own conversations: \`brainbase interface threads ${id} --private\`.`)}`);
|
|
88747
89076
|
}
|
|
88748
89077
|
if (note)
|
|
88749
89078
|
out.push("", ` ${safe(note)}`);
|
|
88750
|
-
out.push("", ` ${
|
|
89079
|
+
out.push("", ` ${import_picocolors75.default.dim(`Next: \`brainbase interface build ${id} "<what to build>"\``)}`, "");
|
|
88751
89080
|
console.log(out.join(`
|
|
88752
89081
|
`));
|
|
88753
89082
|
if (readFailed) {
|
|
@@ -88883,7 +89212,7 @@ async function threads(ctx) {
|
|
|
88883
89212
|
printJson({ id: row.id, share_agent_threads: row.share_agent_threads });
|
|
88884
89213
|
return;
|
|
88885
89214
|
}
|
|
88886
|
-
const already = wanted === null ? "" : ` ${
|
|
89215
|
+
const already = wanted === null ? "" : ` ${import_picocolors75.default.dim("(already set; nothing changed)")}`;
|
|
88887
89216
|
console.log(`
|
|
88888
89217
|
${field("threads", `${threadsLabel(row.share_agent_threads)}${already}`)}
|
|
88889
89218
|
`);
|
|
@@ -88922,7 +89251,7 @@ async function rename(ctx) {
|
|
|
88922
89251
|
return;
|
|
88923
89252
|
}
|
|
88924
89253
|
console.log(`
|
|
88925
|
-
Renamed ${safe(updated.id)} to ${
|
|
89254
|
+
Renamed ${safe(updated.id)} to ${import_picocolors75.default.bold(safe(updated.name))}.
|
|
88926
89255
|
`);
|
|
88927
89256
|
});
|
|
88928
89257
|
}
|
|
@@ -88958,7 +89287,7 @@ async function address(ctx) {
|
|
|
88958
89287
|
}
|
|
88959
89288
|
const where = updated.live_release ? safe(updated.live_release.url) : safe(updated.slug);
|
|
88960
89289
|
console.log(`
|
|
88961
|
-
${safe(updated.name)} is now at ${
|
|
89290
|
+
${safe(updated.name)} is now at ${import_picocolors75.default.bold(where)}.
|
|
88962
89291
|
`);
|
|
88963
89292
|
});
|
|
88964
89293
|
}
|
|
@@ -89050,9 +89379,9 @@ var lifecycleCommands = {
|
|
|
89050
89379
|
};
|
|
89051
89380
|
|
|
89052
89381
|
// src/cli/interface-preview.ts
|
|
89053
|
-
var
|
|
89382
|
+
var import_picocolors76 = __toESM(require_picocolors(), 1);
|
|
89054
89383
|
function warn(line2) {
|
|
89055
|
-
console.error(
|
|
89384
|
+
console.error(import_picocolors76.default.yellow(line2));
|
|
89056
89385
|
}
|
|
89057
89386
|
var PREVIEW_TIMEOUT_SECONDS = 300;
|
|
89058
89387
|
var PROBE_INTERVAL_MS = 2000;
|
|
@@ -89142,12 +89471,12 @@ async function preview(ctx) {
|
|
|
89142
89471
|
const say = progress(json3);
|
|
89143
89472
|
const row = await interfacesApi.get(id);
|
|
89144
89473
|
const { taskId, why } = await pickConversation(row, stringOption(parsed, "task")?.trim() || undefined);
|
|
89145
|
-
say(
|
|
89474
|
+
say(import_picocolors76.default.dim(` Previewing ${why}, ${safe(taskId)}.`));
|
|
89146
89475
|
const started = await interfacesApi.startPreview(taskId, row.id);
|
|
89147
89476
|
const address2 = previewAddress(started, row);
|
|
89148
89477
|
let outcome = started.state === "serving" ? "serving" : "not_waited";
|
|
89149
89478
|
if (outcome !== "serving" && !noWait) {
|
|
89150
|
-
say(
|
|
89479
|
+
say(import_picocolors76.default.dim(" Starting the dev server in the sandbox…"));
|
|
89151
89480
|
outcome = await waitUntilServing(started, { timeoutMs: waitMs, deps: ctx.deps });
|
|
89152
89481
|
}
|
|
89153
89482
|
if (json3) {
|
|
@@ -89155,12 +89484,12 @@ async function preview(ctx) {
|
|
|
89155
89484
|
} else {
|
|
89156
89485
|
const out = [
|
|
89157
89486
|
"",
|
|
89158
|
-
` ${outcome === "serving" ?
|
|
89487
|
+
` ${outcome === "serving" ? import_picocolors76.default.green("Preview ready") : import_picocolors76.default.yellow("Preview starting")} ${import_picocolors76.default.bold(safe(started.name))}`,
|
|
89159
89488
|
"",
|
|
89160
|
-
field("address", address2 ? safe(address2) :
|
|
89489
|
+
field("address", address2 ? safe(address2) : import_picocolors76.default.dim(missingAddress(started))),
|
|
89161
89490
|
field("showing", showing(started, taskId)),
|
|
89162
89491
|
"",
|
|
89163
|
-
` ${
|
|
89492
|
+
` ${import_picocolors76.default.dim("Opens for people who can edit the agent, after signing in. Nothing is published.")}`,
|
|
89164
89493
|
""
|
|
89165
89494
|
];
|
|
89166
89495
|
console.log(out.join(`
|
|
@@ -89181,19 +89510,19 @@ async function preview(ctx) {
|
|
|
89181
89510
|
var previewCommands = { preview };
|
|
89182
89511
|
|
|
89183
89512
|
// src/cli/interface-release.ts
|
|
89184
|
-
var
|
|
89513
|
+
var import_picocolors77 = __toESM(require_picocolors(), 1);
|
|
89185
89514
|
var PUBLISH_TIMEOUT_SECONDS = 300;
|
|
89186
89515
|
var REBUILD_USAGE = "brainbase interface rebuild <id> [--version <version id>] [--yes]";
|
|
89187
89516
|
var PUBLISH_USAGE = "brainbase interface publish <id> [--build <build id>]";
|
|
89188
89517
|
var ROLLBACK_USAGE = "brainbase interface rollback <id> --release <release id>";
|
|
89189
89518
|
function warn2(line2) {
|
|
89190
|
-
console.error(
|
|
89519
|
+
console.error(import_picocolors77.default.yellow(line2));
|
|
89191
89520
|
}
|
|
89192
89521
|
function text3(value2) {
|
|
89193
89522
|
return typeof value2 === "string" && value2.trim() ? value2 : null;
|
|
89194
89523
|
}
|
|
89195
|
-
function reword(error2,
|
|
89196
|
-
return new InterfaceApiError(
|
|
89524
|
+
function reword(error2, message3) {
|
|
89525
|
+
return new InterfaceApiError(message3, error2.code, error2.reason, error2.details, error2.status, error2.body);
|
|
89197
89526
|
}
|
|
89198
89527
|
async function follow(operationId, what, options) {
|
|
89199
89528
|
const stop = interruption(options.deps);
|
|
@@ -89204,7 +89533,7 @@ async function follow(operationId, what, options) {
|
|
|
89204
89533
|
intervalMs: options.deps.pollIntervalMs,
|
|
89205
89534
|
signal: stop.signal,
|
|
89206
89535
|
now: options.deps.now,
|
|
89207
|
-
onStatus: (operation) => say(
|
|
89536
|
+
onStatus: (operation) => say(import_picocolors77.default.dim(` ${what} ${operation.status}`)),
|
|
89208
89537
|
onStall: () => warn2(`The ${what} looks stalled: its worker stopped checking in. Still waiting, in case another worker picks it up.`)
|
|
89209
89538
|
});
|
|
89210
89539
|
if (outcome.kind === "settled") {
|
|
@@ -89223,7 +89552,7 @@ function reportUnsuccessful(result2, what, options) {
|
|
|
89223
89552
|
if (options.json) {
|
|
89224
89553
|
printJson({ outcome: result2.outcome, operation_id: result2.operationId, operation: result2.operation });
|
|
89225
89554
|
} else if (result2.outcome === "failed") {
|
|
89226
|
-
console.error(
|
|
89555
|
+
console.error(import_picocolors77.default.red(`The ${what} failed (operation ${id}):`));
|
|
89227
89556
|
console.error(safeBlock(result2.operation?.error ?? "Brainbase gave no reason."));
|
|
89228
89557
|
} else if (result2.outcome === "timeout") {
|
|
89229
89558
|
warn2(`Stopped waiting after ${Math.round(options.timeoutMs / 1000)}s. The ${what} keeps running on the server (operation ${id}).`);
|
|
@@ -89283,7 +89612,7 @@ async function rebuild(ctx) {
|
|
|
89283
89612
|
if (json3)
|
|
89284
89613
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
89285
89614
|
else
|
|
89286
|
-
console.log(
|
|
89615
|
+
console.log(import_picocolors77.default.dim(` Follow it with \`brainbase interface builds ${safe(id)}\`.`));
|
|
89287
89616
|
return;
|
|
89288
89617
|
}
|
|
89289
89618
|
const result2 = await follow(operationId, "build", { json: json3, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -89295,8 +89624,8 @@ async function rebuild(ctx) {
|
|
|
89295
89624
|
}
|
|
89296
89625
|
const buildId = safe(result2.operation?.build_id ?? "");
|
|
89297
89626
|
const version2 = safe(result2.operation?.source_version_id ?? "");
|
|
89298
|
-
console.log(
|
|
89299
|
-
console.log(
|
|
89627
|
+
console.log(import_picocolors77.default.green(`✓ Build ${buildId} succeeded${version2 ? ` (version ${version2})` : ""}.`));
|
|
89628
|
+
console.log(import_picocolors77.default.dim(` Publish it with \`brainbase interface publish ${safe(id)} --build ${buildId}\`.`));
|
|
89300
89629
|
});
|
|
89301
89630
|
}
|
|
89302
89631
|
function liveBuildOf(row, releases) {
|
|
@@ -89354,7 +89683,7 @@ function describeBuild(buildId, builds) {
|
|
|
89354
89683
|
const build2 = builds.find((candidate) => candidate.id === buildId);
|
|
89355
89684
|
if (!build2)
|
|
89356
89685
|
return `build ${safe(buildId)}`;
|
|
89357
|
-
return `build ${safe(build2.id)} ${
|
|
89686
|
+
return `build ${safe(build2.id)} ${import_picocolors77.default.dim(`(version ${safe(build2.source_version_id)}, built ${ago(build2.created_at)})`)}`;
|
|
89358
89687
|
}
|
|
89359
89688
|
function reportAlreadyLive(json3, buildId, releaseId, url2) {
|
|
89360
89689
|
if (json3) {
|
|
@@ -89408,8 +89737,8 @@ async function publish(ctx) {
|
|
|
89408
89737
|
}
|
|
89409
89738
|
if (!json3) {
|
|
89410
89739
|
console.log("");
|
|
89411
|
-
console.log(` ${
|
|
89412
|
-
console.log(` ${
|
|
89740
|
+
console.log(` ${import_picocolors77.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_picocolors77.default.dim("nothing")}`);
|
|
89741
|
+
console.log(` ${import_picocolors77.default.dim("Will publish".padEnd(14))}${describeBuild(buildId, builds)}`);
|
|
89413
89742
|
console.log("");
|
|
89414
89743
|
}
|
|
89415
89744
|
const proceed = await confirmChange({
|
|
@@ -89452,7 +89781,7 @@ async function publish(ctx) {
|
|
|
89452
89781
|
if (json3)
|
|
89453
89782
|
printJson({ outcome: "started", operation_id: operationId, operation });
|
|
89454
89783
|
else
|
|
89455
|
-
console.log(
|
|
89784
|
+
console.log(import_picocolors77.default.dim(` Check it with \`brainbase interface get ${safe(id)}\`.`));
|
|
89456
89785
|
return;
|
|
89457
89786
|
}
|
|
89458
89787
|
const result2 = await follow(operationId, "publish", { json: json3, timeoutMs: waitMs, deps: ctx.deps });
|
|
@@ -89469,11 +89798,11 @@ async function publish(ctx) {
|
|
|
89469
89798
|
printJson({ outcome: "succeeded", operation_id: operationId, operation: result2.operation, url: url2 });
|
|
89470
89799
|
return;
|
|
89471
89800
|
}
|
|
89472
|
-
console.log(
|
|
89801
|
+
console.log(import_picocolors77.default.green(`✓ Build ${safe(buildId)} is live.`));
|
|
89473
89802
|
if (url2)
|
|
89474
89803
|
console.log(` ${safe(url2)}`);
|
|
89475
89804
|
if (urlUnread) {
|
|
89476
|
-
console.log(
|
|
89805
|
+
console.log(import_picocolors77.default.dim(` Its address could not be read just now; see it with \`brainbase interface open ${safe(id)}\`.`));
|
|
89477
89806
|
}
|
|
89478
89807
|
});
|
|
89479
89808
|
}
|
|
@@ -89509,8 +89838,8 @@ async function rollback(ctx) {
|
|
|
89509
89838
|
}
|
|
89510
89839
|
if (!json3) {
|
|
89511
89840
|
console.log("");
|
|
89512
|
-
console.log(` ${
|
|
89513
|
-
console.log(` ${
|
|
89841
|
+
console.log(` ${import_picocolors77.default.dim("Live now".padEnd(16))}release ${safe(row.live_release.id)} at ${safe(row.live_release.url)}`);
|
|
89842
|
+
console.log(` ${import_picocolors77.default.dim("Will republish".padEnd(16))}release ${safe(releaseId)} ${import_picocolors77.default.dim("as a new release, with a new id")}`);
|
|
89514
89843
|
console.log("");
|
|
89515
89844
|
}
|
|
89516
89845
|
const proceed = await confirmChange({
|
|
@@ -89543,7 +89872,7 @@ async function rollback(ctx) {
|
|
|
89543
89872
|
printJson(release);
|
|
89544
89873
|
return;
|
|
89545
89874
|
}
|
|
89546
|
-
console.log(
|
|
89875
|
+
console.log(import_picocolors77.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.`));
|
|
89547
89876
|
console.log(` ${safe(release.url)}`);
|
|
89548
89877
|
});
|
|
89549
89878
|
}
|
|
@@ -89578,14 +89907,14 @@ ${didYouMean(sub, Object.keys(COMMANDS2), "brainbase interface")}`);
|
|
|
89578
89907
|
await command({ cwd: cwd2, args, deps });
|
|
89579
89908
|
}
|
|
89580
89909
|
function line2(command, args, description) {
|
|
89581
|
-
return ` ${
|
|
89582
|
-
${
|
|
89910
|
+
return ` ${import_picocolors78.default.cyan(command)}${args ? ` ${import_picocolors78.default.dim(args)}` : ""}
|
|
89911
|
+
${import_picocolors78.default.dim(description)}`;
|
|
89583
89912
|
}
|
|
89584
89913
|
function printHelp7() {
|
|
89585
89914
|
const out = [];
|
|
89586
89915
|
out.push("");
|
|
89587
|
-
out.push(` ${
|
|
89588
|
-
out.push(` ${
|
|
89916
|
+
out.push(` ${import_picocolors78.default.bold("brainbase interface")} ${import_picocolors78.default.dim("<sub> [options]")}`);
|
|
89917
|
+
out.push(` ${import_picocolors78.default.dim("Dashboards for an agent: build them in a conversation, publish them, choose who can open them.")}`);
|
|
89589
89918
|
out.push("");
|
|
89590
89919
|
out.push(line2("ls", "[--agent <id>] [--archived | --only-archived]", "list interfaces you can see"));
|
|
89591
89920
|
out.push(line2("get", "<id>", "one interface: address, audience, live release, draft, running build conversation"));
|
|
@@ -89605,22 +89934,22 @@ function printHelp7() {
|
|
|
89605
89934
|
out.push(line2("rollback", "<id> --release <id>", "republish an earlier release; it goes live under a new release id"));
|
|
89606
89935
|
out.push(line2("preview", "<id> [--task <id>] [--no-wait]", "serve the unpublished draft from its build conversation and print the preview address"));
|
|
89607
89936
|
out.push("");
|
|
89608
|
-
out.push(` ${
|
|
89609
|
-
out.push(` ${
|
|
89610
|
-
out.push(` ${
|
|
89611
|
-
out.push(` ${
|
|
89612
|
-
out.push(` ${
|
|
89937
|
+
out.push(` ${import_picocolors78.default.dim("--json")} machine-readable output; never prompts`);
|
|
89938
|
+
out.push(` ${import_picocolors78.default.dim("--yes, -y")} skip confirmation (required without a terminal)`);
|
|
89939
|
+
out.push(` ${import_picocolors78.default.dim("--no-wait")} for rebuild and publish: return the operation at once; for preview: do not wait for the dev server`);
|
|
89940
|
+
out.push(` ${import_picocolors78.default.dim("--timeout <seconds>")} for build, rebuild, publish and preview: how long to wait (builds 900, publish and preview 300)`);
|
|
89941
|
+
out.push(` ${import_picocolors78.default.dim("--idempotency-key <key>")} replay a create, build, rebuild, publish or rollback whose answer was lost`);
|
|
89613
89942
|
out.push("");
|
|
89614
|
-
out.push(` ${
|
|
89615
|
-
out.push(` ${
|
|
89616
|
-
out.push(` ${
|
|
89943
|
+
out.push(` ${import_picocolors78.default.dim("People are emails (see `brainbase member ls`), user ids, or `me`. Audience members also need access to the agent.")}`);
|
|
89944
|
+
out.push(` ${import_picocolors78.default.dim("Audience: everyone (--everyone, `org` under --json) or chosen people (--people, `users` under --json).")}`);
|
|
89945
|
+
out.push(` ${import_picocolors78.default.dim("Exit codes: 0 done, 1 refused or failed, 130 interrupted (the server keeps working).")}`);
|
|
89617
89946
|
out.push("");
|
|
89618
89947
|
console.log(out.join(`
|
|
89619
89948
|
`));
|
|
89620
89949
|
}
|
|
89621
89950
|
|
|
89622
89951
|
// src/cli/member.ts
|
|
89623
|
-
var
|
|
89952
|
+
var import_picocolors79 = __toESM(require_picocolors(), 1);
|
|
89624
89953
|
async function runMember(sub, args, opts) {
|
|
89625
89954
|
if (args.some((arg) => arg === "--help" || arg === "-h")) {
|
|
89626
89955
|
printHelp8();
|
|
@@ -89663,7 +89992,7 @@ async function runMemberList(opts) {
|
|
|
89663
89992
|
function formatMemberList(members) {
|
|
89664
89993
|
if (members.length === 0)
|
|
89665
89994
|
return `
|
|
89666
|
-
${
|
|
89995
|
+
${import_picocolors79.default.dim("Nobody here you can see.")}
|
|
89667
89996
|
`;
|
|
89668
89997
|
const sorted = [...members].sort((a3, b4) => (a3.email ?? a3.id).localeCompare(b4.email ?? b4.id));
|
|
89669
89998
|
const rows = sorted.map((member) => ({
|
|
@@ -89677,24 +90006,24 @@ function formatMemberList(members) {
|
|
|
89677
90006
|
const roleWidth = Math.max(...rows.map((row) => row.role.length));
|
|
89678
90007
|
const lines = [""];
|
|
89679
90008
|
for (const row of rows) {
|
|
89680
|
-
lines.push(` ${row.email.padEnd(emailWidth)} ${row.name.padEnd(nameWidth)} ${
|
|
90009
|
+
lines.push(` ${row.email.padEnd(emailWidth)} ${row.name.padEnd(nameWidth)} ${import_picocolors79.default.dim(row.role.padEnd(roleWidth))} ${import_picocolors79.default.dim(row.teams)}`.trimEnd());
|
|
89681
90010
|
}
|
|
89682
|
-
lines.push("", ` ${
|
|
90011
|
+
lines.push("", ` ${import_picocolors79.default.dim("share a dashboard with one of them:")} ${import_picocolors79.default.cyan("brainbase interface access <id> --add <email>")}`, "");
|
|
89683
90012
|
return lines.join(`
|
|
89684
90013
|
`);
|
|
89685
90014
|
}
|
|
89686
90015
|
function printHelp8() {
|
|
89687
90016
|
const out = [];
|
|
89688
90017
|
out.push("");
|
|
89689
|
-
out.push(` ${
|
|
90018
|
+
out.push(` ${import_picocolors79.default.bold("brainbase member")} ${import_picocolors79.default.dim("<sub> [options]")}`);
|
|
89690
90019
|
out.push("");
|
|
89691
|
-
out.push(` ${
|
|
90020
|
+
out.push(` ${import_picocolors79.default.cyan("ls")} ${import_picocolors79.default.dim("the people in an organization you can see, with their emails, roles and teams")}`);
|
|
89692
90021
|
out.push("");
|
|
89693
|
-
out.push(` ${
|
|
89694
|
-
out.push(` ${
|
|
90022
|
+
out.push(` ${import_picocolors79.default.dim("--org <id-or-slug>")} ${import_picocolors79.default.dim("which organization (picked automatically when you are in one)")}`);
|
|
90023
|
+
out.push(` ${import_picocolors79.default.dim("--json")} ${import_picocolors79.default.dim("machine-readable output")}`);
|
|
89695
90024
|
out.push("");
|
|
89696
|
-
out.push(` ${
|
|
89697
|
-
out.push(` ${
|
|
90025
|
+
out.push(` ${import_picocolors79.default.dim("Owners and admins see everyone. Anyone else sees the owners, the admins, themselves")}`);
|
|
90026
|
+
out.push(` ${import_picocolors79.default.dim("and the people who share a team with them, as in the web app.")}`);
|
|
89698
90027
|
out.push("");
|
|
89699
90028
|
console.log(out.join(`
|
|
89700
90029
|
`));
|
|
@@ -90146,8 +90475,8 @@ var BENCHMARK_CAPABILITIES = {
|
|
|
90146
90475
|
class BenchmarkPhaseError extends Error {
|
|
90147
90476
|
code;
|
|
90148
90477
|
details;
|
|
90149
|
-
constructor(code,
|
|
90150
|
-
super(
|
|
90478
|
+
constructor(code, message3, details) {
|
|
90479
|
+
super(message3);
|
|
90151
90480
|
this.code = code;
|
|
90152
90481
|
this.details = details;
|
|
90153
90482
|
this.name = "BenchmarkPhaseError";
|
|
@@ -90158,8 +90487,8 @@ class BenchmarkCommandExecutionError extends BenchmarkPhaseError {
|
|
|
90158
90487
|
stdout;
|
|
90159
90488
|
stderr;
|
|
90160
90489
|
durationMs;
|
|
90161
|
-
constructor(code,
|
|
90162
|
-
super(code,
|
|
90490
|
+
constructor(code, message3, stdout, stderr, durationMs) {
|
|
90491
|
+
super(code, message3);
|
|
90163
90492
|
this.stdout = stdout;
|
|
90164
90493
|
this.stderr = stderr;
|
|
90165
90494
|
this.durationMs = durationMs;
|
|
@@ -92787,7 +93116,7 @@ async function runBenchmarkPhase(specPathInput, resultPathInput, expectedPhase,
|
|
|
92787
93116
|
}
|
|
92788
93117
|
|
|
92789
93118
|
// src/cli/benchmark-control.ts
|
|
92790
|
-
var
|
|
93119
|
+
var import_picocolors80 = __toESM(require_picocolors(), 1);
|
|
92791
93120
|
import fs92 from "node:fs";
|
|
92792
93121
|
import path103 from "node:path";
|
|
92793
93122
|
|
|
@@ -92799,8 +93128,8 @@ var BENCHMARK_UPLOAD_MIN_BYTES_PER_SECOND = 256 * 1024;
|
|
|
92799
93128
|
class BenchmarkClientUsageError extends Error {
|
|
92800
93129
|
code = "invalid_arguments";
|
|
92801
93130
|
retryable = false;
|
|
92802
|
-
constructor(
|
|
92803
|
-
super(
|
|
93131
|
+
constructor(message3) {
|
|
93132
|
+
super(message3);
|
|
92804
93133
|
this.name = "BenchmarkClientUsageError";
|
|
92805
93134
|
}
|
|
92806
93135
|
}
|
|
@@ -92809,8 +93138,8 @@ class BenchmarkApiError extends ApiError {
|
|
|
92809
93138
|
code;
|
|
92810
93139
|
requestId;
|
|
92811
93140
|
retryable;
|
|
92812
|
-
constructor(
|
|
92813
|
-
super(
|
|
93141
|
+
constructor(message3, status, body, code, requestId, retryable) {
|
|
93142
|
+
super(message3, status, body);
|
|
92814
93143
|
this.code = code;
|
|
92815
93144
|
this.requestId = requestId;
|
|
92816
93145
|
this.name = "BenchmarkApiError";
|
|
@@ -95091,8 +95420,8 @@ function expectPositionals2(positionals, minimum, maximum, usage) {
|
|
|
95091
95420
|
throw usageError(`Usage: ${usage}`);
|
|
95092
95421
|
}
|
|
95093
95422
|
}
|
|
95094
|
-
function usageError(
|
|
95095
|
-
return Object.assign(new Error(
|
|
95423
|
+
function usageError(message3) {
|
|
95424
|
+
return Object.assign(new Error(message3), {
|
|
95096
95425
|
code: "invalid_arguments",
|
|
95097
95426
|
retryable: false
|
|
95098
95427
|
});
|
|
@@ -95801,20 +96130,20 @@ async function emitCursorPages(output, fetchPage, options) {
|
|
|
95801
96130
|
function commandHelp() {
|
|
95802
96131
|
return [
|
|
95803
96132
|
"",
|
|
95804
|
-
` ${
|
|
96133
|
+
` ${import_picocolors80.default.bold("brainbase benchmark")} ${import_picocolors80.default.dim("<command> [options]")}`,
|
|
95805
96134
|
"",
|
|
95806
|
-
` ${
|
|
95807
|
-
` ${
|
|
95808
|
-
` ${
|
|
95809
|
-
` ${
|
|
95810
|
-
` ${
|
|
96135
|
+
` ${import_picocolors80.default.cyan("init | list | show | create | validate | pull | push")}`,
|
|
96136
|
+
` ${import_picocolors80.default.cyan("publish | revisions | import | export | archive | restore")}`,
|
|
96137
|
+
` ${import_picocolors80.default.cyan("run plan|start|watch|list|show|cancel|resume")}`,
|
|
96138
|
+
` ${import_picocolors80.default.cyan("results | diagnoses | attempt | artifacts | export-results")}`,
|
|
96139
|
+
` ${import_picocolors80.default.cyan("history | baseline show|set|clear")}`,
|
|
95811
96140
|
"",
|
|
95812
|
-
` ${
|
|
96141
|
+
` ${import_picocolors80.default.dim("Use --agent to override brainbase.agent.yaml, and --json or --jsonl for automation.")}`,
|
|
95813
96142
|
"",
|
|
95814
|
-
` ${
|
|
95815
|
-
` ${
|
|
95816
|
-
` ${
|
|
95817
|
-
` ${
|
|
96143
|
+
` ${import_picocolors80.default.bold("benchmark runtime (machine-only)")}`,
|
|
96144
|
+
` ${import_picocolors80.default.cyan("hydrate")} ${import_picocolors80.default.dim("--spec <path> --result <path> --json")}`,
|
|
96145
|
+
` ${import_picocolors80.default.cyan("evaluate")} ${import_picocolors80.default.dim("--spec <path> --result <path> --json")}`,
|
|
96146
|
+
` ${import_picocolors80.default.cyan("capabilities")} ${import_picocolors80.default.dim("--json")}`,
|
|
95818
96147
|
""
|
|
95819
96148
|
].join(`
|
|
95820
96149
|
`);
|
|
@@ -96260,8 +96589,8 @@ async function runStart(cwd2, argv, deps) {
|
|
|
96260
96589
|
}
|
|
96261
96590
|
function pausedRunHint(runId, run, agentId) {
|
|
96262
96591
|
const reason = run.paused_reason;
|
|
96263
|
-
const
|
|
96264
|
-
const first = typeof
|
|
96592
|
+
const message3 = reason && typeof reason === "object" && !Array.isArray(reason) ? reason.message : undefined;
|
|
96593
|
+
const first = typeof message3 === "string" && message3.trim() ? `Run paused: ${message3.trim()}` : "Run paused.";
|
|
96265
96594
|
const agent = agentId ? ` --agent ${agentId}` : "";
|
|
96266
96595
|
return `${first}
|
|
96267
96596
|
Resume with: brainbase benchmark run resume ${runId} --yes${agent}`;
|
|
@@ -96917,7 +97246,7 @@ function parsePhaseArgs(args) {
|
|
|
96917
97246
|
throw new Error("--json is required for benchmark phase commands");
|
|
96918
97247
|
return { spec, result: result2, json: true };
|
|
96919
97248
|
}
|
|
96920
|
-
function argumentFailure(phase,
|
|
97249
|
+
function argumentFailure(phase, message3) {
|
|
96921
97250
|
const timestamp = new Date().toISOString();
|
|
96922
97251
|
return {
|
|
96923
97252
|
schema_version: "1",
|
|
@@ -96935,11 +97264,11 @@ function argumentFailure(phase, message2) {
|
|
|
96935
97264
|
outputs: [],
|
|
96936
97265
|
error: {
|
|
96937
97266
|
code: "invalid_arguments",
|
|
96938
|
-
message:
|
|
97267
|
+
message: message3
|
|
96939
97268
|
}
|
|
96940
97269
|
};
|
|
96941
97270
|
}
|
|
96942
|
-
function phaseFailure(invocation, startedAt, started, code,
|
|
97271
|
+
function phaseFailure(invocation, startedAt, started, code, message3) {
|
|
96943
97272
|
return {
|
|
96944
97273
|
schema_version: "1",
|
|
96945
97274
|
cli_version: VERSION,
|
|
@@ -96954,7 +97283,7 @@ function phaseFailure(invocation, startedAt, started, code, message2) {
|
|
|
96954
97283
|
steps: [],
|
|
96955
97284
|
inputs: [],
|
|
96956
97285
|
outputs: [],
|
|
96957
|
-
error: { code, message:
|
|
97286
|
+
error: { code, message: message3 }
|
|
96958
97287
|
};
|
|
96959
97288
|
}
|
|
96960
97289
|
function descendantPids2(parentPid) {
|
|
@@ -97282,208 +97611,213 @@ var SUBCOMMAND_OWNED_FLAGS = {
|
|
|
97282
97611
|
function help() {
|
|
97283
97612
|
const out = [];
|
|
97284
97613
|
out.push("");
|
|
97285
|
-
out.push(` ${brandTint("◆")} ${
|
|
97286
|
-
out.push(` ${
|
|
97614
|
+
out.push(` ${brandTint("◆")} ${import_picocolors81.default.bold("brainbase")} ${import_picocolors81.default.dim(`v${VERSION}`)}`);
|
|
97615
|
+
out.push(` ${import_picocolors81.default.dim("connect your local agent to the brainbase platform")}`);
|
|
97287
97616
|
out.push("");
|
|
97288
97617
|
out.push(divider("USAGE"));
|
|
97289
97618
|
out.push("");
|
|
97290
|
-
out.push(` ${
|
|
97619
|
+
out.push(` ${import_picocolors81.default.bold("brainbase")} ${import_picocolors81.default.dim("<command> [options]")}`);
|
|
97291
97620
|
out.push("");
|
|
97292
97621
|
out.push(divider("AUTH"));
|
|
97293
97622
|
out.push("");
|
|
97294
|
-
out.push(` ${
|
|
97295
|
-
out.push(` ${
|
|
97296
|
-
out.push(` ${
|
|
97623
|
+
out.push(` ${import_picocolors81.default.cyan("login")} ${import_picocolors81.default.dim(" open the web app and connect this device")}`);
|
|
97624
|
+
out.push(` ${import_picocolors81.default.cyan("logout")} ${import_picocolors81.default.dim(" clear the local session")}`);
|
|
97625
|
+
out.push(` ${import_picocolors81.default.cyan("whoami")} ${import_picocolors81.default.dim("[--json]")} ${import_picocolors81.default.dim(" show which credential is in use and what it covers")}`);
|
|
97297
97626
|
out.push("");
|
|
97298
97627
|
out.push(divider("DISCOVERY"));
|
|
97299
97628
|
out.push("");
|
|
97300
|
-
out.push(` ${
|
|
97301
|
-
out.push(` ${
|
|
97302
|
-
out.push(` ${
|
|
97629
|
+
out.push(` ${import_picocolors81.default.cyan("team list")} ${import_picocolors81.default.dim("show the teams you can create agents in")}`);
|
|
97630
|
+
out.push(` ${import_picocolors81.default.cyan("member ls")} ${import_picocolors81.default.dim("show the people in an organization, with the emails interface access takes")}`);
|
|
97631
|
+
out.push(` ${import_picocolors81.default.cyan("agent list")} ${import_picocolors81.default.dim("show a team's agents and their ids")}`);
|
|
97303
97632
|
out.push("");
|
|
97304
97633
|
out.push(divider("LINKED AGENT"));
|
|
97305
97634
|
out.push("");
|
|
97306
|
-
out.push(` ${
|
|
97307
|
-
out.push(` ${
|
|
97308
|
-
out.push(` ${
|
|
97309
|
-
out.push(` ${
|
|
97310
|
-
out.push(` ${
|
|
97311
|
-
out.push(` ${
|
|
97312
|
-
out.push(` ${
|
|
97313
|
-
out.push(` ${
|
|
97314
|
-
out.push(` ${
|
|
97315
|
-
out.push(` ${
|
|
97316
|
-
out.push(` ${
|
|
97317
|
-
out.push(` ${
|
|
97318
|
-
out.push(` ${
|
|
97319
|
-
out.push(` ${
|
|
97320
|
-
out.push(` ${
|
|
97321
|
-
out.push(` ${
|
|
97322
|
-
out.push(` ${
|
|
97323
|
-
out.push(` ${
|
|
97635
|
+
out.push(` ${import_picocolors81.default.cyan("agent init")} ${import_picocolors81.default.dim("write a starter brainbase.agent.yaml here — offline, no login needed")}`);
|
|
97636
|
+
out.push(` ${import_picocolors81.default.cyan("agent create")} ${import_picocolors81.default.dim("claim an unclaimed brainbase.agent.yaml and create the cloud agent")}`);
|
|
97637
|
+
out.push(` ${import_picocolors81.default.cyan("agent pull")} ${import_picocolors81.default.dim("[<id>]")} ${import_picocolors81.default.dim("bring cloud changes into this folder (--force to override; --run-entrypoint to also execute the agent entrypoint; --link to link first)")}`);
|
|
97638
|
+
out.push(` ${import_picocolors81.default.cyan("agent push")} ${import_picocolors81.default.dim("send local changes to the cloud (--force to overwrite cloud-side conflicts with local)")}`);
|
|
97639
|
+
out.push(` ${import_picocolors81.default.cyan("agent delete")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("permanently delete a cloud agent and every task it has run")}`);
|
|
97640
|
+
out.push(` ${import_picocolors81.default.cyan("agent unpack")} ${import_picocolors81.default.dim("install the claimed agent into a harness layout")}`);
|
|
97641
|
+
out.push(` ${import_picocolors81.default.cyan("link")} ${import_picocolors81.default.dim("attach this folder to an existing agent")}`);
|
|
97642
|
+
out.push(` ${import_picocolors81.default.cyan("agent status")} ${import_picocolors81.default.dim("show what would pull and what would push")}`);
|
|
97643
|
+
out.push(` ${import_picocolors81.default.cyan("agent connections")} ${import_picocolors81.default.dim("show which integrations this agent is wired to (--json for CI)")}`);
|
|
97644
|
+
out.push(` ${import_picocolors81.default.cyan("agent connect")} ${import_picocolors81.default.dim("<name>")} ${import_picocolors81.default.dim("connect chat, slack, meeting, github, linear or phone")}`);
|
|
97645
|
+
out.push(` ${import_picocolors81.default.cyan("agent disconnect")} ${import_picocolors81.default.dim("<name>")} ${import_picocolors81.default.dim("disable or disconnect an agent surface")}`);
|
|
97646
|
+
out.push(` ${import_picocolors81.default.cyan("agent surface")} ${import_picocolors81.default.dim("<name>")} ${import_picocolors81.default.dim("status, settings and setup for all six surfaces (--help)")}`);
|
|
97647
|
+
out.push(` ${import_picocolors81.default.cyan("agent versions")} ${import_picocolors81.default.dim("saved versions: list, show, diff, label, restore, pin and unpin (`agent versions --help`)")}`);
|
|
97648
|
+
out.push(` ${import_picocolors81.default.cyan("agent eval")} ${import_picocolors81.default.dim("<list|runs>")} ${import_picocolors81.default.dim("read eval definitions and judge verdicts (`agent eval --help`)")}`);
|
|
97649
|
+
out.push(` ${import_picocolors81.default.cyan("agent env")} ${import_picocolors81.default.dim("print export lines for `eval $(brainbase agent env)`")}`);
|
|
97650
|
+
out.push(` ${import_picocolors81.default.cyan("run")} ${import_picocolors81.default.dim("<cmd> [args...]")} ${import_picocolors81.default.dim("run <cmd> with secrets.env loaded into env")}`);
|
|
97651
|
+
out.push(` ${import_picocolors81.default.cyan("status")} ${import_picocolors81.default.dim("show what this folder is linked to")}`);
|
|
97652
|
+
out.push(` ${import_picocolors81.default.cyan("unlink")} ${import_picocolors81.default.dim("disconnect this folder")}`);
|
|
97324
97653
|
out.push("");
|
|
97325
97654
|
out.push(divider("TASKS"));
|
|
97326
97655
|
out.push("");
|
|
97327
|
-
out.push(` ${
|
|
97328
|
-
out.push(` ${
|
|
97329
|
-
out.push(` ${
|
|
97330
|
-
out.push(` ${
|
|
97331
|
-
out.push(` ${
|
|
97332
|
-
out.push(` ${
|
|
97333
|
-
out.push(` ${
|
|
97334
|
-
out.push(` ${
|
|
97656
|
+
out.push(` ${import_picocolors81.default.cyan("task create")} ${import_picocolors81.default.dim("--message <text>")} ${import_picocolors81.default.dim("create a managed task and start its first run (--wait to block on it; --interface <id> for a build conversation)")}`);
|
|
97657
|
+
out.push(` ${import_picocolors81.default.cyan("task list")} ${import_picocolors81.default.dim("recent tasks you can reach (--metadata k=v to filter by label; --interface <id> for its build conversations)")}`);
|
|
97658
|
+
out.push(` ${import_picocolors81.default.cyan("task get")} ${import_picocolors81.default.dim("<task-id>")} ${import_picocolors81.default.dim("one task: status, agent, machine, eval verdicts")}`);
|
|
97659
|
+
out.push(` ${import_picocolors81.default.cyan("task logs")} ${import_picocolors81.default.dim("<task-id> [--follow]")} ${import_picocolors81.default.dim("one line per event in the task's transcript, or tail it live")}`);
|
|
97660
|
+
out.push(` ${import_picocolors81.default.cyan("task send")} ${import_picocolors81.default.dim("<task-id> <message>")} ${import_picocolors81.default.dim("send a follow-up during execution, or queue it for the next turn")}`);
|
|
97661
|
+
out.push(` ${import_picocolors81.default.cyan("task stop")} ${import_picocolors81.default.dim("<task-id>")} ${import_picocolors81.default.dim("stop execution and cancel pending follow-ups, retaining their text")}`);
|
|
97662
|
+
out.push(` ${import_picocolors81.default.cyan("task update")} ${import_picocolors81.default.dim("<task-id>")} ${import_picocolors81.default.dim("rename a task, change its metadata labels, switch its model or reset it to the agent default, including while it runs")}`);
|
|
97663
|
+
out.push(` ${import_picocolors81.default.cyan("task delete")} ${import_picocolors81.default.dim("<task-id>")} ${import_picocolors81.default.dim("permanently delete a stopped task and tear down its sandbox")}`);
|
|
97335
97664
|
out.push("");
|
|
97336
97665
|
out.push(divider("INTERFACES"));
|
|
97337
97666
|
out.push("");
|
|
97338
|
-
out.push(` ${
|
|
97339
|
-
out.push(` ${
|
|
97340
|
-
out.push(` ${
|
|
97341
|
-
out.push(` ${
|
|
97342
|
-
out.push(` ${
|
|
97343
|
-
out.push(` ${
|
|
97344
|
-
out.push(` ${
|
|
97667
|
+
out.push(` ${import_picocolors81.default.cyan("interface ls")} ${import_picocolors81.default.dim("dashboards you can see (--agent to narrow)")}`);
|
|
97668
|
+
out.push(` ${import_picocolors81.default.cyan("interface create")} ${import_picocolors81.default.dim("--name <n>")} ${import_picocolors81.default.dim("create one on an agent, with who can open it")}`);
|
|
97669
|
+
out.push(` ${import_picocolors81.default.cyan("interface build")} ${import_picocolors81.default.dim('<id> "<ask>"')} ${import_picocolors81.default.dim("describe a change; the agent builds it while you watch")}`);
|
|
97670
|
+
out.push(` ${import_picocolors81.default.cyan("interface publish")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("make the newest succeeded build live")}`);
|
|
97671
|
+
out.push(` ${import_picocolors81.default.cyan("interface rollback")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("republish an earlier release under a new id (--release <id>)")}`);
|
|
97672
|
+
out.push(` ${import_picocolors81.default.cyan("interface access")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("show or set who can open it")}`);
|
|
97673
|
+
out.push(` ${import_picocolors81.default.cyan("interface --help")} ${import_picocolors81.default.dim("every interface subcommand")}`);
|
|
97345
97674
|
out.push("");
|
|
97346
97675
|
out.push(divider("SANDBOXES"));
|
|
97347
97676
|
out.push("");
|
|
97348
|
-
out.push(` ${
|
|
97349
|
-
out.push(` ${
|
|
97677
|
+
out.push(` ${import_picocolors81.default.cyan("machine ls")} ${import_picocolors81.default.dim("[--all]")} ${import_picocolors81.default.dim("list your sandboxes — live ones only unless --all")}`);
|
|
97678
|
+
out.push(` ${import_picocolors81.default.cyan("machine rm")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("tear a sandbox down (it bills until you do)")}`);
|
|
97350
97679
|
out.push("");
|
|
97351
97680
|
out.push(divider("BENCHMARKS"));
|
|
97352
97681
|
out.push("");
|
|
97353
|
-
out.push(` ${
|
|
97354
|
-
out.push(` ${
|
|
97355
|
-
out.push(` ${
|
|
97356
|
-
out.push(` ${
|
|
97357
|
-
out.push(` ${
|
|
97682
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark list")} ${import_picocolors81.default.dim("list benchmarks for the linked agent")}`);
|
|
97683
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark init")} ${import_picocolors81.default.dim("[directory]")} ${import_picocolors81.default.dim("scaffold a local benchmark")}`);
|
|
97684
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark create")} ${import_picocolors81.default.dim("[path|-]")} ${import_picocolors81.default.dim("create a benchmark draft")}`);
|
|
97685
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark run")} ${import_picocolors81.default.dim("<benchmark> --yes")} ${import_picocolors81.default.dim("plan and start a benchmark run")}`);
|
|
97686
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark results")} ${import_picocolors81.default.dim("<run>")} ${import_picocolors81.default.dim("inspect normalized benchmark results")}`);
|
|
97358
97687
|
out.push("");
|
|
97359
97688
|
out.push(divider("BENCHMARK RUNTIME"));
|
|
97360
97689
|
out.push("");
|
|
97361
|
-
out.push(` ${
|
|
97362
|
-
out.push(` ${
|
|
97363
|
-
out.push(` ${
|
|
97690
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark hydrate")} ${import_picocolors81.default.dim("--spec <path> --result <path> --json")}`);
|
|
97691
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark evaluate")} ${import_picocolors81.default.dim("--spec <path> --result <path> --json")}`);
|
|
97692
|
+
out.push(` ${import_picocolors81.default.cyan("benchmark capabilities")} ${import_picocolors81.default.dim("--json")}`);
|
|
97364
97693
|
out.push("");
|
|
97365
97694
|
out.push(divider("ORCHESTRATIONS"));
|
|
97366
97695
|
out.push("");
|
|
97367
|
-
out.push(` ${
|
|
97368
|
-
out.push(` ${
|
|
97369
|
-
out.push(` ${
|
|
97370
|
-
out.push(` ${
|
|
97371
|
-
out.push(` ${
|
|
97372
|
-
out.push(` ${
|
|
97373
|
-
out.push(` ${
|
|
97696
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration init")} ${import_picocolors81.default.dim("write a starter brainbase-orchestration.yaml here (offline, no login)")}`);
|
|
97697
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration create")} ${import_picocolors81.default.dim("claim a local orchestration manifest and create it in the cloud")}`);
|
|
97698
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration list")} ${import_picocolors81.default.dim("list orchestrations under a team")}`);
|
|
97699
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration pull")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("recursively fetch an orchestration + every member agent")}`);
|
|
97700
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration push")} ${import_picocolors81.default.dim("recursively push each member, then update the graph")}`);
|
|
97701
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration status")} ${import_picocolors81.default.dim("show what would push and what would pull")}`);
|
|
97702
|
+
out.push(` ${import_picocolors81.default.cyan("orchestration delete")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("permanently delete an orchestration graph (member agents are kept)")}`);
|
|
97374
97703
|
out.push("");
|
|
97375
97704
|
out.push(divider("TEMPLATES"));
|
|
97376
97705
|
out.push("");
|
|
97377
|
-
out.push(` ${
|
|
97378
|
-
out.push(` ${
|
|
97379
|
-
out.push(` ${
|
|
97380
|
-
out.push(` ${
|
|
97381
|
-
out.push(` ${
|
|
97382
|
-
out.push(` ${
|
|
97383
|
-
out.push(` ${
|
|
97706
|
+
out.push(` ${import_picocolors81.default.cyan("template pack")} ${import_picocolors81.default.dim("bundle the current agent into a template")}`);
|
|
97707
|
+
out.push(` ${import_picocolors81.default.cyan("template publish")} ${import_picocolors81.default.dim("upload a template to the registry")}`);
|
|
97708
|
+
out.push(` ${import_picocolors81.default.cyan("template search")} ${import_picocolors81.default.dim("[query]")} ${import_picocolors81.default.dim("search the registry")}`);
|
|
97709
|
+
out.push(` ${import_picocolors81.default.cyan("template info")} ${import_picocolors81.default.dim("<creator/slug>")} ${import_picocolors81.default.dim("show registry details for a template")}`);
|
|
97710
|
+
out.push(` ${import_picocolors81.default.cyan("template onboard")} ${import_picocolors81.default.dim("<creator/slug>")} ${import_picocolors81.default.dim("install (or refresh) a template")}`);
|
|
97711
|
+
out.push(` ${import_picocolors81.default.cyan("template list")} ${import_picocolors81.default.dim("show installed templates")}`);
|
|
97712
|
+
out.push(` ${import_picocolors81.default.cyan("template remove")} ${import_picocolors81.default.dim("<creator/slug>")} ${import_picocolors81.default.dim("uninstall a template")}`);
|
|
97384
97713
|
out.push("");
|
|
97385
97714
|
out.push(divider("SKILLS"));
|
|
97386
97715
|
out.push("");
|
|
97387
|
-
out.push(` ${
|
|
97388
|
-
out.push(` ${
|
|
97389
|
-
out.push(` ${
|
|
97390
|
-
out.push(` ${
|
|
97391
|
-
out.push(` ${
|
|
97392
|
-
out.push(` ${
|
|
97393
|
-
out.push(` ${
|
|
97716
|
+
out.push(` ${import_picocolors81.default.cyan("skill add")} ${import_picocolors81.default.dim("<source>")} ${import_picocolors81.default.dim("install a skill (github / git / brainbase)")}`);
|
|
97717
|
+
out.push(` ${import_picocolors81.default.cyan("skill list")} ${import_picocolors81.default.dim("show locally installed skills + their source")}`);
|
|
97718
|
+
out.push(` ${import_picocolors81.default.cyan("skill update")} ${import_picocolors81.default.dim("<slug>")} ${import_picocolors81.default.dim("re-fetch a skill from its recorded source")}`);
|
|
97719
|
+
out.push(` ${import_picocolors81.default.cyan("skill remove")} ${import_picocolors81.default.dim("<slug>")} ${import_picocolors81.default.dim("uninstall a skill")}`);
|
|
97720
|
+
out.push(` ${import_picocolors81.default.cyan("skill search")} ${import_picocolors81.default.dim("[query]")} ${import_picocolors81.default.dim("search the brainbase skill registry")}`);
|
|
97721
|
+
out.push(` ${import_picocolors81.default.cyan("skill info")} ${import_picocolors81.default.dim("<creator/slug>")} ${import_picocolors81.default.dim("show registry details for a skill")}`);
|
|
97722
|
+
out.push(` ${import_picocolors81.default.cyan("skill publish")} ${import_picocolors81.default.dim("[dir]")} ${import_picocolors81.default.dim("publish a SKILL.md folder (defaults to .)")}`);
|
|
97394
97723
|
out.push("");
|
|
97395
97724
|
out.push(divider("CLI TOKENS"));
|
|
97396
97725
|
out.push("");
|
|
97397
|
-
out.push(` ${
|
|
97398
|
-
out.push(` ${
|
|
97399
|
-
out.push(` ${
|
|
97400
|
-
out.push(` ${
|
|
97726
|
+
out.push(` ${import_picocolors81.default.cyan("token create")} ${import_picocolors81.default.dim("issue a long-lived CLI key for CI / scripts")}`);
|
|
97727
|
+
out.push(` ${import_picocolors81.default.cyan("token list")} ${import_picocolors81.default.dim("show your tokens")}`);
|
|
97728
|
+
out.push(` ${import_picocolors81.default.cyan("token rename")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("relabel a token")}`);
|
|
97729
|
+
out.push(` ${import_picocolors81.default.cyan("token revoke")} ${import_picocolors81.default.dim("<id>")} ${import_picocolors81.default.dim("revoke a token")}`);
|
|
97401
97730
|
out.push("");
|
|
97402
97731
|
out.push(divider("MCP"));
|
|
97403
97732
|
out.push("");
|
|
97404
|
-
out.push(` ${
|
|
97405
|
-
out.push(` ${
|
|
97406
|
-
out.push(` ${
|
|
97733
|
+
out.push(` ${import_picocolors81.default.cyan("mcp check")} ${import_picocolors81.default.dim("[--json]")} ${import_picocolors81.default.dim("verify MCP server connectivity through the brainbase proxy (runs at sandbox bootstrap)")}`);
|
|
97734
|
+
out.push(` ${import_picocolors81.default.cyan("mcp list")} ${import_picocolors81.default.dim("[--json]")} ${import_picocolors81.default.dim("show configured servers with OAuth state and expiry")}`);
|
|
97735
|
+
out.push(` ${import_picocolors81.default.cyan("mcp connect")} ${import_picocolors81.default.dim("<name>")} ${import_picocolors81.default.dim("authorize an OAuth-backed server: prints a single-use link, opens it, waits for approval")}`);
|
|
97407
97736
|
out.push("");
|
|
97408
97737
|
out.push(divider("INTEGRATIONS"));
|
|
97409
97738
|
out.push("");
|
|
97410
|
-
out.push(` ${
|
|
97411
|
-
out.push(` ${
|
|
97412
|
-
out.push(` ${
|
|
97413
|
-
out.push(` ${
|
|
97414
|
-
out.push(` ${
|
|
97415
|
-
out.push(` ${
|
|
97416
|
-
out.push(` ${
|
|
97417
|
-
out.push(` ${
|
|
97739
|
+
out.push(` ${import_picocolors81.default.cyan("integrations list")} ${import_picocolors81.default.dim("show the agent's Pipedream apps, accounts and app-level permission")}`);
|
|
97740
|
+
out.push(` ${import_picocolors81.default.cyan("integrations search")} ${import_picocolors81.default.dim("<query>")} ${import_picocolors81.default.dim("find apps in the Pipedream catalog")}`);
|
|
97741
|
+
out.push(` ${import_picocolors81.default.cyan("integrations actions")} ${import_picocolors81.default.dim("<app>")} ${import_picocolors81.default.dim("list an app's actions and whether each is allowed")}`);
|
|
97742
|
+
out.push(` ${import_picocolors81.default.cyan("integrations add")} ${import_picocolors81.default.dim("<app>")} ${import_picocolors81.default.dim("install an app; one that needs an account runs connect")}`);
|
|
97743
|
+
out.push(` ${import_picocolors81.default.cyan("integrations connect")} ${import_picocolors81.default.dim("<app>")} ${import_picocolors81.default.dim("open Pipedream's connect page for the app and wait for the account")}`);
|
|
97744
|
+
out.push(` ${import_picocolors81.default.cyan("integrations disconnect")} ${import_picocolors81.default.dim("<app>")} ${import_picocolors81.default.dim("delete the app's connected account")}`);
|
|
97745
|
+
out.push(` ${import_picocolors81.default.cyan("integrations remove")} ${import_picocolors81.default.dim("<app>")} ${import_picocolors81.default.dim("uninstall an app that needs no account")}`);
|
|
97746
|
+
out.push(` ${import_picocolors81.default.cyan("integrations allow|ask|deny")} ${import_picocolors81.default.dim("<app>[.<action>]")} ${import_picocolors81.default.dim("set the permission for an app or one of its actions")}`);
|
|
97747
|
+
out.push(` ${import_picocolors81.default.cyan("integrations context create")} ${import_picocolors81.default.dim("--application <name>")} ${import_picocolors81.default.dim("let a program outside Brainbase (the SDK) use the agent's integrations; prints a renewal handle once")}`);
|
|
97748
|
+
out.push(` ${import_picocolors81.default.cyan("integrations context end")} ${import_picocolors81.default.dim("<context-id>")} ${import_picocolors81.default.dim("end a standalone integration context now")}`);
|
|
97418
97749
|
out.push("");
|
|
97419
97750
|
out.push(divider("FLAGS"));
|
|
97420
97751
|
out.push("");
|
|
97421
|
-
out.push(` ${
|
|
97422
|
-
out.push(` ${
|
|
97423
|
-
out.push(` ${
|
|
97752
|
+
out.push(` ${import_picocolors81.default.dim("--harness <id>")} force harness for onboard / sync (e.g. claude-code)`);
|
|
97753
|
+
out.push(` ${import_picocolors81.default.dim("--scope <s>")} force scope: global | project`);
|
|
97754
|
+
out.push(` ${import_picocolors81.default.dim("--yes, -y")} skip confirmations / auto-overwrite`);
|
|
97424
97755
|
out.push(` ${" ".repeat("--yes, -y".length)} required for destructive commands with no terminal (pipes, CI)`);
|
|
97425
|
-
out.push(` ${
|
|
97426
|
-
out.push(` ${
|
|
97427
|
-
out.push(` ${
|
|
97428
|
-
out.push(` ${
|
|
97429
|
-
out.push(` ${
|
|
97430
|
-
out.push(` ${
|
|
97431
|
-
out.push(` ${
|
|
97432
|
-
out.push(` ${
|
|
97433
|
-
out.push(` ${
|
|
97434
|
-
out.push(` ${
|
|
97435
|
-
out.push(` ${
|
|
97436
|
-
out.push(` ${
|
|
97437
|
-
out.push(` ${
|
|
97438
|
-
out.push(` ${
|
|
97439
|
-
out.push(` ${
|
|
97440
|
-
out.push(` ${
|
|
97441
|
-
out.push(` ${
|
|
97442
|
-
out.push(` ${
|
|
97443
|
-
out.push(` ${
|
|
97444
|
-
out.push(` ${
|
|
97445
|
-
out.push(` ${
|
|
97446
|
-
out.push(` ${
|
|
97447
|
-
out.push(` ${
|
|
97448
|
-
out.push(` ${
|
|
97449
|
-
out.push(` ${
|
|
97450
|
-
out.push(` ${
|
|
97451
|
-
out.push(` ${
|
|
97452
|
-
out.push(` ${
|
|
97453
|
-
out.push(` ${
|
|
97454
|
-
out.push(` ${
|
|
97455
|
-
out.push(` ${
|
|
97456
|
-
out.push(` ${
|
|
97457
|
-
out.push(` ${
|
|
97458
|
-
out.push(` ${
|
|
97756
|
+
out.push(` ${import_picocolors81.default.dim("--agent <id>")} for link/task create/mcp list/mcp connect/integrations: use this agent id explicitly instead of the linked folder's (task list: filter to it)`);
|
|
97757
|
+
out.push(` ${import_picocolors81.default.dim("--message <text>")} for task create: required first user message`);
|
|
97758
|
+
out.push(` ${import_picocolors81.default.dim("--title <text>")} for task create: optional task title; for task update: the new title`);
|
|
97759
|
+
out.push(` ${import_picocolors81.default.dim("--clear-title")} for task update: remove the title (automatic titling may name it again later)`);
|
|
97760
|
+
out.push(` ${import_picocolors81.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)`);
|
|
97761
|
+
out.push(` ${import_picocolors81.default.dim("--unset-metadata <k>")} for task update: remove one label (repeatable)`);
|
|
97762
|
+
out.push(` ${import_picocolors81.default.dim("--clear-metadata")} for task update: remove every label; with --metadata, keep only those given`);
|
|
97763
|
+
out.push(` ${import_picocolors81.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)`);
|
|
97764
|
+
out.push(` ${import_picocolors81.default.dim("--clear-model")} for task update: go back to the agent's default model from the next turn`);
|
|
97765
|
+
out.push(` ${import_picocolors81.default.dim("--version <v>")} for task create: run a saved version of the agent (12, v12 or a version id)`);
|
|
97766
|
+
out.push(` ${import_picocolors81.default.dim("--wait")} for task create: block until the task finishes; exit 1 unless it succeeded`);
|
|
97767
|
+
out.push(` ${import_picocolors81.default.dim("--timeout <secs>")} for task create --wait: give up after <secs> and exit 1`);
|
|
97768
|
+
out.push(` ${import_picocolors81.default.dim("--limit <n>")} for task list (1-200), task logs (events to print; with --follow, the first page size) and machine ls`);
|
|
97769
|
+
out.push(` ${import_picocolors81.default.dim("--follow, -f")} for task logs: stay attached and print events as they land`);
|
|
97770
|
+
out.push(` ${import_picocolors81.default.dim("--org <id-or-slug>")} pick the organization (team/agent list, agent create, orchestration create/list)`);
|
|
97771
|
+
out.push(` ${import_picocolors81.default.dim("--team <id>")} pick the team, same commands (works without --org)`);
|
|
97772
|
+
out.push(` ${import_picocolors81.default.dim("--all-teams")} for agent list: every team in the org (the default with no terminal)`);
|
|
97773
|
+
out.push(` ${import_picocolors81.default.dim("--json")} machine-readable output for supported commands`);
|
|
97774
|
+
out.push(` ${import_picocolors81.default.dim("--no-tracking")} for link / agent pull --link: skip routing LLM traffic through brainbase`);
|
|
97775
|
+
out.push(` ${import_picocolors81.default.dim("--link")} for agent pull: link this folder to the agent first, as \`brainbase link --agent <id> --yes\` would, in one process`);
|
|
97776
|
+
out.push(` ${import_picocolors81.default.dim("--track")} for agent create: enable tracking non-interactively (off without a TTY)`);
|
|
97777
|
+
out.push(` ${import_picocolors81.default.dim("--shell <sh|fish>")} for agent env: pick output format (auto-detected from $SHELL)`);
|
|
97778
|
+
out.push(` ${import_picocolors81.default.dim("--bot-token <t>")} for agent connect slack (or BRAINBASE_SLACK_BOT_TOKEN, or stdin)`);
|
|
97779
|
+
out.push(` ${import_picocolors81.default.dim("--signing-secret <s>")} for agent connect slack (or BRAINBASE_SLACK_SIGNING_SECRET, or stdin)`);
|
|
97780
|
+
out.push(` ${import_picocolors81.default.dim("--bot-name <name>")} for agent connect meeting: the bot's display name`);
|
|
97781
|
+
out.push(` ${import_picocolors81.default.dim("--app-id <id> / --app-name <name>")} optional Slack app identity`);
|
|
97782
|
+
out.push(` ${import_picocolors81.default.dim("--bot-image-url <url>")} optional meeting bot image`);
|
|
97783
|
+
out.push(` ${import_picocolors81.default.dim("--full")} for agent/orchestration init: write a commented template covering every block`);
|
|
97784
|
+
out.push(` ${import_picocolors81.default.dim("--minimal")} for agent init: write the starter manifest (the default)`);
|
|
97785
|
+
out.push(` ${import_picocolors81.default.dim("--all")} for template list: include installs from other folders; for machine ls: include torn-down machines`);
|
|
97786
|
+
out.push(` ${import_picocolors81.default.dim("--web <url>")} for login: web app URL (default https://app.brainbaselabs.com)`);
|
|
97787
|
+
out.push(` ${import_picocolors81.default.dim("--no-open")} for mcp/integrations connect: print the link without opening a browser (implied with no terminal)`);
|
|
97788
|
+
out.push(` ${import_picocolors81.default.dim("--no-wait")} for mcp/integrations connect: print the link and exit instead of waiting`);
|
|
97789
|
+
out.push(` ${import_picocolors81.default.dim("--account <id>")} for integrations disconnect: which account, when the app has more than one`);
|
|
97790
|
+
out.push(` ${import_picocolors81.default.dim("--application <name>")} for integrations context create: names the program the context is for`);
|
|
97791
|
+
out.push(` ${import_picocolors81.default.dim("--max-lifetime <dur>")} for integrations context create: when the context ends at the latest, 60s-30d (default 7d)`);
|
|
97792
|
+
out.push(` ${import_picocolors81.default.dim("--reason <text>")} for integrations context end: recorded with the context`);
|
|
97459
97793
|
out.push("");
|
|
97460
97794
|
out.push(divider("ENV"));
|
|
97461
97795
|
out.push("");
|
|
97462
|
-
out.push(` ${
|
|
97463
|
-
out.push(` ${
|
|
97464
|
-
out.push(` ${
|
|
97465
|
-
out.push(` ${
|
|
97466
|
-
out.push(` ${
|
|
97467
|
-
out.push(` ${
|
|
97468
|
-
out.push(` ${
|
|
97469
|
-
out.push(` ${
|
|
97470
|
-
out.push(` ${
|
|
97471
|
-
out.push(` ${
|
|
97472
|
-
out.push(` ${
|
|
97796
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_HOME")} override the local config dir (default ~/.brainbase)`);
|
|
97797
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_DEBUG")} print full stack traces on error (any value; unset to disable)`);
|
|
97798
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_WEB_URL")} override the web app URL used by login, console links and integrations`);
|
|
97799
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_CONTROL_PLANE_URL")} override the MAS host (/v2/cli; task and interface commands use /v2/tasks and /v2/interfaces)`);
|
|
97800
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_API_URL")} legacy KLS host override (uses /api/cli; proxy/registry fallback)`);
|
|
97801
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_PROXY_URL")} override the model-proxy URL used by harness traffic (default https://api.v1.brainbaselabs.com)`);
|
|
97802
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_REGISTRY_URL")} override the registry API URL (default https://api.v1.brainbaselabs.com)`);
|
|
97803
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_TOKEN")} long-lived CLI PAT; outranks the login session and the PAT saved in token.json`);
|
|
97804
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_SKIP_AUTH")} bypass the auth gate for development`);
|
|
97805
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_NON_INTERACTIVE")} force non-interactive mode — skip/auto-default prompts (CI & agents)`);
|
|
97806
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_RUN_ENTRYPOINT")} =1 → agent pull executes the agent entrypoint (sandbox boots; or pass --run-entrypoint)`);
|
|
97473
97807
|
out.push("");
|
|
97474
|
-
out.push(` ${
|
|
97475
|
-
out.push(` ${
|
|
97476
|
-
out.push(` ${
|
|
97477
|
-
out.push(` ${
|
|
97478
|
-
out.push(` ${
|
|
97479
|
-
out.push(` ${
|
|
97480
|
-
out.push(` ${
|
|
97808
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_MEMORY_MCP_URL")} override the built-in memory MCP host`);
|
|
97809
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_BROWSER_MCP_URL")} override the built-in browser MCP host`);
|
|
97810
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_SLACK_MCP_URL")} override the built-in Slack MCP host`);
|
|
97811
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_MEETING_MCP_URL")} override the built-in meeting MCP host`);
|
|
97812
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_GITHUB_MCP_URL")} override the built-in GitHub MCP host`);
|
|
97813
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_LINEAR_MCP_URL")} override the built-in Linear MCP host`);
|
|
97814
|
+
out.push(` ${import_picocolors81.default.dim("BRAINBASE_ORCHESTRATION_MCP_URL")} override the built-in orchestration MCP host`);
|
|
97481
97815
|
out.push("");
|
|
97482
97816
|
out.push(divider("HARNESSES"));
|
|
97483
97817
|
out.push("");
|
|
97484
|
-
out.push(` ${
|
|
97485
|
-
out.push(` ${
|
|
97486
|
-
out.push(` ${
|
|
97818
|
+
out.push(` ${import_picocolors81.default.dim("•")} ${import_picocolors81.default.bold("claude-code")} ${import_picocolors81.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
97819
|
+
out.push(` ${import_picocolors81.default.dim("•")} ${import_picocolors81.default.bold("codex")} ${import_picocolors81.default.dim("skills, mcps, commands, playbooks, instructions, files")}`);
|
|
97820
|
+
out.push(` ${import_picocolors81.default.dim("•")} ${import_picocolors81.default.bold("kafka")} ${import_picocolors81.default.dim("skills, mcps, agents, commands, playbooks, instructions, files")}`);
|
|
97487
97821
|
out.push("");
|
|
97488
97822
|
console.log(out.join(`
|
|
97489
97823
|
`));
|
|
@@ -97517,7 +97851,10 @@ var VALUE_TAKING_FLAGS = new Set([
|
|
|
97517
97851
|
"--bot-image-url",
|
|
97518
97852
|
"--task-id",
|
|
97519
97853
|
"--limit",
|
|
97520
|
-
"--file"
|
|
97854
|
+
"--file",
|
|
97855
|
+
"--application",
|
|
97856
|
+
"--max-lifetime",
|
|
97857
|
+
"--reason"
|
|
97521
97858
|
]);
|
|
97522
97859
|
function isValueOfPriorFlag2(args, index) {
|
|
97523
97860
|
return index > 0 && VALUE_TAKING_FLAGS.has(args[index - 1]);
|
|
@@ -97638,10 +97975,10 @@ async function requireAuth(cmd) {
|
|
|
97638
97975
|
if (storedPatFor(status.session))
|
|
97639
97976
|
return;
|
|
97640
97977
|
console.error("");
|
|
97641
|
-
console.error(` ${brandTint("◆")} ${
|
|
97978
|
+
console.error(` ${brandTint("◆")} ${import_picocolors81.default.bold("brainbase")}`);
|
|
97642
97979
|
console.error("");
|
|
97643
|
-
console.error(` ${
|
|
97644
|
-
console.error(` ${
|
|
97980
|
+
console.error(` ${import_picocolors81.default.red("✗")} You need to sign in to use ${import_picocolors81.default.bold("brainbase " + cmd)}.`);
|
|
97981
|
+
console.error(` ${import_picocolors81.default.dim(noUsableCredentialMessage())}`);
|
|
97645
97982
|
console.error("");
|
|
97646
97983
|
process14.exit(1);
|
|
97647
97984
|
}
|
|
@@ -97925,12 +98262,12 @@ ${didYouMean(cmd, COMMANDS3, "brainbase")}`);
|
|
|
97925
98262
|
process14.exit(1);
|
|
97926
98263
|
}
|
|
97927
98264
|
} catch (err) {
|
|
97928
|
-
const
|
|
98265
|
+
const message3 = sanitizeLines(err.message).join(`
|
|
97929
98266
|
`);
|
|
97930
|
-
console.error(
|
|
97931
|
-
${
|
|
98267
|
+
console.error(import_picocolors81.default.red(`
|
|
98268
|
+
${message3}`));
|
|
97932
98269
|
if (err instanceof ApiError && err.status === 401 && !err.message.includes("brainbase login")) {
|
|
97933
|
-
console.error(` Run ${
|
|
98270
|
+
console.error(` Run ${import_picocolors81.default.cyan("brainbase login")} to connect this device.`);
|
|
97934
98271
|
}
|
|
97935
98272
|
if (process14.env.BRAINBASE_DEBUG)
|
|
97936
98273
|
console.error(err.stack);
|