bamboo-agents 0.1.5-dev.65.b4a6bfe → 0.1.5-dev.76.921eb32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/VERSION +1 -1
- package/dist/index.js +624 -168
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3037,7 +3037,7 @@ var VERSION;
|
|
|
3037
3037
|
var init_version = __esm({
|
|
3038
3038
|
"src/version.ts"() {
|
|
3039
3039
|
"use strict";
|
|
3040
|
-
VERSION = "0.1.5-dev.
|
|
3040
|
+
VERSION = "0.1.5-dev.76.921eb32";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7340,12 +7340,12 @@ var init_knowledge_save = __esm({
|
|
|
7340
7340
|
});
|
|
7341
7341
|
KnowledgeSaveResponseSchema = external_exports.object({
|
|
7342
7342
|
/** Routing outcome from `executeKnowledgeWrite`. */
|
|
7343
|
-
routed: external_exports.enum(["auto", "queued", "submitted", "rejected", "noop"]),
|
|
7343
|
+
routed: external_exports.enum(["auto", "queued", "submitted", "rejected", "noop", "conflict"]),
|
|
7344
7344
|
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
7345
7345
|
/** Present when a PR was opened (queued/submitted, or auto via queue-PR). */
|
|
7346
7346
|
pr_url: external_exports.string().optional(),
|
|
7347
7347
|
pr_number: external_exports.number().optional(),
|
|
7348
|
-
/** Present on `rejected` / `noop` — short machine-friendly reason. */
|
|
7348
|
+
/** Present on `rejected` / `noop` / `conflict` — short machine-friendly reason. */
|
|
7349
7349
|
reason: external_exports.string().optional()
|
|
7350
7350
|
});
|
|
7351
7351
|
}
|
|
@@ -7589,6 +7589,181 @@ var init_agents = __esm({
|
|
|
7589
7589
|
}
|
|
7590
7590
|
});
|
|
7591
7591
|
|
|
7592
|
+
// ../../src/lib/api-contracts/cli/eval-ab.ts
|
|
7593
|
+
var eval_ab_exports = {};
|
|
7594
|
+
__export(eval_ab_exports, {
|
|
7595
|
+
AB_RESULT_VIEW_PATH: () => AB_RESULT_VIEW_PATH,
|
|
7596
|
+
AbEligibilityPreviewSchema: () => AbEligibilityPreviewSchema,
|
|
7597
|
+
AgentAbTestsSnapshotSchema: () => AgentAbTestsSnapshotSchema,
|
|
7598
|
+
EvalAbEndResponseSchema: () => EvalAbEndResponseSchema,
|
|
7599
|
+
EvalAbRequestSchema: () => EvalAbRequestSchema,
|
|
7600
|
+
EvalAbResponseSchema: () => EvalAbResponseSchema,
|
|
7601
|
+
SkillAbTestSchema: () => SkillAbTestSchema,
|
|
7602
|
+
SkillAbTestStatusSchema: () => SkillAbTestStatusSchema
|
|
7603
|
+
});
|
|
7604
|
+
var AB_RESULT_VIEW_PATH, EvalAbRequestSchema, EvalAbResponseSchema, SkillAbTestStatusSchema, SkillAbTestSchema, AbEligibilityPreviewSchema, AgentAbTestsSnapshotSchema, EvalAbEndResponseSchema;
|
|
7605
|
+
var init_eval_ab = __esm({
|
|
7606
|
+
"../../src/lib/api-contracts/cli/eval-ab.ts"() {
|
|
7607
|
+
init_zod();
|
|
7608
|
+
AB_RESULT_VIEW_PATH = "/app/evals";
|
|
7609
|
+
EvalAbRequestSchema = external_exports.object({
|
|
7610
|
+
agent_id: external_exports.string().uuid().describe("The agent whose skill is under test. Must be in the caller's org."),
|
|
7611
|
+
skill_name: external_exports.string().min(1).describe(
|
|
7612
|
+
"kebab-case skill name, e.g. `liveitup-amazon-weekly`. Must resolve to an `owned` skill (tier=agent) \u2014 `shared` and `library` skills are not testable."
|
|
7613
|
+
),
|
|
7614
|
+
hypothesis: external_exports.string().min(1).describe(
|
|
7615
|
+
"Plain-language claim the edit is meant to produce \u2192 `skillopt_candidates.behavior_summary`. An experiment is a claim, not a diff."
|
|
7616
|
+
),
|
|
7617
|
+
candidate_body: external_exports.string().min(1).describe(
|
|
7618
|
+
"The full candidate SKILL.md body (frontmatter included). The baseline arm is pinned server-side from the published body \u2014 never sent."
|
|
7619
|
+
),
|
|
7620
|
+
brand_id: external_exports.string().uuid().optional().describe(
|
|
7621
|
+
"Only needed to disambiguate an agent assigned to more than one brand. Omitted = the agent's single brand."
|
|
7622
|
+
)
|
|
7623
|
+
});
|
|
7624
|
+
EvalAbResponseSchema = external_exports.object({
|
|
7625
|
+
/** The `eval_run_queue` batch both arms were staged into. */
|
|
7626
|
+
run_batch_id: external_exports.string().uuid(),
|
|
7627
|
+
/** The candidate's stable id (`skillopt_candidates.edit_id`). */
|
|
7628
|
+
edit_id: external_exports.string().uuid(),
|
|
7629
|
+
skill_name: external_exports.string(),
|
|
7630
|
+
brand_id: external_exports.string().uuid(),
|
|
7631
|
+
agent_id: external_exports.string().uuid(),
|
|
7632
|
+
/** Holdout cases the cycle will run over — chosen server-side, never passed in. */
|
|
7633
|
+
case_count: external_exports.number().int().positive(),
|
|
7634
|
+
/** Reps per ARM (not per case). `total_runs = case_count × reps_per_arm × 2`. */
|
|
7635
|
+
reps_per_arm: external_exports.number().int().positive(),
|
|
7636
|
+
/** Queue rows staged, across BOTH arms. */
|
|
7637
|
+
total_runs: external_exports.number().int().positive(),
|
|
7638
|
+
/**
|
|
7639
|
+
* The one line stating what will run, rendered server-side from the shared
|
|
7640
|
+
* `describeAbPlan` so the CLI, the sheet, and any future surface cannot drift
|
|
7641
|
+
* into three different sentences about the same 48 runs.
|
|
7642
|
+
*/
|
|
7643
|
+
plan: external_exports.string(),
|
|
7644
|
+
/** Relative link to the result view: `/app/evals?view=ab&batch=<id>`. */
|
|
7645
|
+
deep_link: external_exports.string()
|
|
7646
|
+
});
|
|
7647
|
+
SkillAbTestStatusSchema = external_exports.enum([
|
|
7648
|
+
"running",
|
|
7649
|
+
"resolved",
|
|
7650
|
+
"ended",
|
|
7651
|
+
"failed"
|
|
7652
|
+
]);
|
|
7653
|
+
SkillAbTestSchema = external_exports.object({
|
|
7654
|
+
skillName: external_exports.string(),
|
|
7655
|
+
batchId: external_exports.string().uuid(),
|
|
7656
|
+
status: SkillAbTestStatusSchema,
|
|
7657
|
+
runsCompleted: external_exports.number().int().nonnegative(),
|
|
7658
|
+
runsTotal: external_exports.number().int().nonnegative(),
|
|
7659
|
+
startedAt: external_exports.string(),
|
|
7660
|
+
lastGradedAt: external_exports.string().nullable(),
|
|
7661
|
+
resultLabel: external_exports.string().nullable()
|
|
7662
|
+
});
|
|
7663
|
+
AbEligibilityPreviewSchema = external_exports.object({
|
|
7664
|
+
caseCount: external_exports.number().int().nonnegative(),
|
|
7665
|
+
repsPerCase: external_exports.number().int().positive()
|
|
7666
|
+
});
|
|
7667
|
+
AgentAbTestsSnapshotSchema = external_exports.object({
|
|
7668
|
+
/**
|
|
7669
|
+
* `agents.ab_enabled` — the silent per-agent capability gate. When false the
|
|
7670
|
+
* tab renders no beaker at all, so `tests`/`eligibility` come back empty
|
|
7671
|
+
* (the server short-circuits before computing them).
|
|
7672
|
+
*/
|
|
7673
|
+
abEnabled: external_exports.boolean(),
|
|
7674
|
+
tests: external_exports.array(SkillAbTestSchema),
|
|
7675
|
+
eligibility: external_exports.record(external_exports.string(), AbEligibilityPreviewSchema)
|
|
7676
|
+
});
|
|
7677
|
+
EvalAbEndResponseSchema = external_exports.object({
|
|
7678
|
+
/** The batch that was ended. */
|
|
7679
|
+
batch_id: external_exports.string().uuid(),
|
|
7680
|
+
/** Always `ended` on success — the candidate's new terminal state. */
|
|
7681
|
+
status: external_exports.literal("ended"),
|
|
7682
|
+
/** Pending (never-served) queue rows removed. Graded rows are untouched. */
|
|
7683
|
+
pending_cancelled: external_exports.number().int().nonnegative()
|
|
7684
|
+
});
|
|
7685
|
+
}
|
|
7686
|
+
});
|
|
7687
|
+
|
|
7688
|
+
// src/lib/output.ts
|
|
7689
|
+
function isJsonMode(opts = {}) {
|
|
7690
|
+
if (opts.json === true) return true;
|
|
7691
|
+
return process.stdout.isTTY !== true;
|
|
7692
|
+
}
|
|
7693
|
+
function parseFields(raw) {
|
|
7694
|
+
if (!raw) return [];
|
|
7695
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
7696
|
+
}
|
|
7697
|
+
function pluckPath(value, segments) {
|
|
7698
|
+
if (segments.length === 0) return value;
|
|
7699
|
+
if (value === null || value === void 0) return void 0;
|
|
7700
|
+
if (Array.isArray(value)) {
|
|
7701
|
+
return value.map((item) => pluckPath(item, segments)).filter((v) => v !== void 0);
|
|
7702
|
+
}
|
|
7703
|
+
if (typeof value === "object") {
|
|
7704
|
+
const [head, ...rest] = segments;
|
|
7705
|
+
return pluckPath(value[head], rest);
|
|
7706
|
+
}
|
|
7707
|
+
return void 0;
|
|
7708
|
+
}
|
|
7709
|
+
function projectFields(data, fields) {
|
|
7710
|
+
if (fields.length === 0) return data;
|
|
7711
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
7712
|
+
return data;
|
|
7713
|
+
}
|
|
7714
|
+
const out = {};
|
|
7715
|
+
for (const field of fields) {
|
|
7716
|
+
const segments = field.split(".").filter((s) => s.length > 0);
|
|
7717
|
+
if (segments.length === 0) continue;
|
|
7718
|
+
const value = pluckPath(data, segments);
|
|
7719
|
+
if (value === void 0) continue;
|
|
7720
|
+
out[field] = value;
|
|
7721
|
+
}
|
|
7722
|
+
return out;
|
|
7723
|
+
}
|
|
7724
|
+
function writeStdout(line) {
|
|
7725
|
+
process.stdout.write(line.endsWith("\n") ? line : line + "\n");
|
|
7726
|
+
}
|
|
7727
|
+
function writeStderr(line) {
|
|
7728
|
+
process.stderr.write(line.endsWith("\n") ? line : line + "\n");
|
|
7729
|
+
}
|
|
7730
|
+
function emitSuccess(data, opts, renderHuman) {
|
|
7731
|
+
if (isJsonMode(opts)) {
|
|
7732
|
+
const projected = projectFields(data, parseFields(opts.fields));
|
|
7733
|
+
const envelope = { ok: true, data: projected };
|
|
7734
|
+
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7735
|
+
return;
|
|
7736
|
+
}
|
|
7737
|
+
if (opts.quiet) return;
|
|
7738
|
+
if (renderHuman) renderHuman(data);
|
|
7739
|
+
}
|
|
7740
|
+
function emitError(err, opts, exitCode) {
|
|
7741
|
+
if (isJsonMode(opts)) {
|
|
7742
|
+
const envelope = {
|
|
7743
|
+
ok: false,
|
|
7744
|
+
error: {
|
|
7745
|
+
code: err.code,
|
|
7746
|
+
message: err.message,
|
|
7747
|
+
...err.hint ? { hint: err.hint } : {}
|
|
7748
|
+
}
|
|
7749
|
+
};
|
|
7750
|
+
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7751
|
+
} else if (!opts.quiet) {
|
|
7752
|
+
writeStderr(`bamboo-agents: ${err.message}`);
|
|
7753
|
+
if (err.hint) writeStderr(` ${err.hint}`);
|
|
7754
|
+
}
|
|
7755
|
+
if (exitCode !== void 0) process.exit(exitCode);
|
|
7756
|
+
}
|
|
7757
|
+
function human(line = "", opts = {}) {
|
|
7758
|
+
if (opts.quiet) return;
|
|
7759
|
+
writeStderr(line);
|
|
7760
|
+
}
|
|
7761
|
+
var init_output = __esm({
|
|
7762
|
+
"src/lib/output.ts"() {
|
|
7763
|
+
"use strict";
|
|
7764
|
+
}
|
|
7765
|
+
});
|
|
7766
|
+
|
|
7592
7767
|
// src/lib/paths.ts
|
|
7593
7768
|
import { homedir } from "node:os";
|
|
7594
7769
|
import { join } from "node:path";
|
|
@@ -7850,9 +8025,9 @@ password=${token}
|
|
|
7850
8025
|
const proc = child;
|
|
7851
8026
|
proc.stdin?.write(input);
|
|
7852
8027
|
proc.stdin?.end();
|
|
7853
|
-
await new Promise((
|
|
8028
|
+
await new Promise((resolve3, reject) => {
|
|
7854
8029
|
proc.on("exit", (code) => {
|
|
7855
|
-
if (code === 0)
|
|
8030
|
+
if (code === 0) resolve3();
|
|
7856
8031
|
else reject(new GitError(`git credential approve exited with code ${code}`));
|
|
7857
8032
|
});
|
|
7858
8033
|
proc.on("error", reject);
|
|
@@ -7872,7 +8047,7 @@ async function cloneRepo(repoFullName, targetDir) {
|
|
|
7872
8047
|
}
|
|
7873
8048
|
}
|
|
7874
8049
|
async function checkGitCredentialForGitHub() {
|
|
7875
|
-
return new Promise((
|
|
8050
|
+
return new Promise((resolve3) => {
|
|
7876
8051
|
const proc = execFile(
|
|
7877
8052
|
"git",
|
|
7878
8053
|
["credential", "fill"],
|
|
@@ -7882,12 +8057,12 @@ async function checkGitCredentialForGitHub() {
|
|
|
7882
8057
|
},
|
|
7883
8058
|
(err, stdout) => {
|
|
7884
8059
|
if (err) {
|
|
7885
|
-
|
|
8060
|
+
resolve3(false);
|
|
7886
8061
|
return;
|
|
7887
8062
|
}
|
|
7888
8063
|
const hasOurUsername = /^username=x-access-token\s*$/m.test(stdout);
|
|
7889
8064
|
const hasPassword = /^password=\S+/m.test(stdout);
|
|
7890
|
-
|
|
8065
|
+
resolve3(hasOurUsername && hasPassword);
|
|
7891
8066
|
}
|
|
7892
8067
|
);
|
|
7893
8068
|
proc.stdin?.write("protocol=https\nhost=github.com\n\n");
|
|
@@ -8539,14 +8714,14 @@ var init_open = __esm({
|
|
|
8539
8714
|
}
|
|
8540
8715
|
const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
|
|
8541
8716
|
if (options.wait) {
|
|
8542
|
-
return new Promise((
|
|
8717
|
+
return new Promise((resolve3, reject) => {
|
|
8543
8718
|
subprocess.once("error", reject);
|
|
8544
8719
|
subprocess.once("close", (exitCode) => {
|
|
8545
8720
|
if (!options.allowNonzeroExitCode && exitCode > 0) {
|
|
8546
8721
|
reject(new Error(`Exited with code ${exitCode}`));
|
|
8547
8722
|
return;
|
|
8548
8723
|
}
|
|
8549
|
-
|
|
8724
|
+
resolve3(subprocess);
|
|
8550
8725
|
});
|
|
8551
8726
|
});
|
|
8552
8727
|
}
|
|
@@ -12598,7 +12773,10 @@ var init_context_health = __esm({
|
|
|
12598
12773
|
available: external_exports.literal(true),
|
|
12599
12774
|
scope: ScopeSchema,
|
|
12600
12775
|
grade: external_exports.enum(["A", "B", "C", "D", "F"]),
|
|
12601
|
-
|
|
12776
|
+
/** BAM-3751: `null` ⇒ never measured (no audit has scored this scope).
|
|
12777
|
+
* Mirrors `ScopeHealth.score`. Consumers render "not yet audited" —
|
|
12778
|
+
* never coerce with `?? 0` (that reintroduces the confident-0 bug). */
|
|
12779
|
+
score: external_exports.number().nullable(),
|
|
12602
12780
|
bucketScores: BucketScoresSchema,
|
|
12603
12781
|
results: external_exports.array(CriterionResultSchema),
|
|
12604
12782
|
resolvedScope: ResolvedScopeSchema.nullable(),
|
|
@@ -12646,8 +12824,46 @@ var init_install_token = __esm({
|
|
|
12646
12824
|
}
|
|
12647
12825
|
});
|
|
12648
12826
|
|
|
12827
|
+
// ../../src/lib/api-contracts/cli/usage.ts
|
|
12828
|
+
var DailyCountSchema, AgentUsageResponseSchema;
|
|
12829
|
+
var init_usage = __esm({
|
|
12830
|
+
"../../src/lib/api-contracts/cli/usage.ts"() {
|
|
12831
|
+
init_zod();
|
|
12832
|
+
DailyCountSchema = external_exports.object({
|
|
12833
|
+
date: external_exports.string(),
|
|
12834
|
+
callCount: external_exports.number()
|
|
12835
|
+
});
|
|
12836
|
+
AgentUsageResponseSchema = external_exports.object({
|
|
12837
|
+
available: external_exports.literal(true),
|
|
12838
|
+
orgId: external_exports.string(),
|
|
12839
|
+
/** Null for an org-wide read. */
|
|
12840
|
+
agentId: external_exports.string().nullable(),
|
|
12841
|
+
windowDays: external_exports.number(),
|
|
12842
|
+
windowStart: external_exports.string(),
|
|
12843
|
+
windowEnd: external_exports.string(),
|
|
12844
|
+
/** Explicit — true iff any tool_call rows fell in the window. */
|
|
12845
|
+
hasActivity: external_exports.boolean(),
|
|
12846
|
+
totalCalls: external_exports.number(),
|
|
12847
|
+
/** 30-min idle-gap sessionization per user_id — see lib doc for why (trace_id is
|
|
12848
|
+
* NOT usable: MCP tool calls mint a fresh one per call). */
|
|
12849
|
+
distinctSessions: external_exports.number(),
|
|
12850
|
+
toolCounts: external_exports.record(external_exports.string(), external_exports.number()),
|
|
12851
|
+
firstSeen: external_exports.string().nullable(),
|
|
12852
|
+
lastSeen: external_exports.string().nullable(),
|
|
12853
|
+
/** Sparse — only days with at least one call are included. */
|
|
12854
|
+
dailyCounts: external_exports.array(DailyCountSchema),
|
|
12855
|
+
/** True iff the read hit its row cap — counts above are a floor, not exact. */
|
|
12856
|
+
truncated: external_exports.boolean(),
|
|
12857
|
+
/** External (Claude/Cowork) emails custom-mapped to a Bamboo user for this
|
|
12858
|
+
* org, via `telemetry_email_mappings` (BAM-4014) — what OTEL enrichment
|
|
12859
|
+
* *can* see for this org, when it isn't desktop-gapped. */
|
|
12860
|
+
mappedExternalEmails: external_exports.array(external_exports.string())
|
|
12861
|
+
});
|
|
12862
|
+
}
|
|
12863
|
+
});
|
|
12864
|
+
|
|
12649
12865
|
// ../../src/lib/api-contracts/episodes/index.ts
|
|
12650
|
-
var KnowledgeCiteSchema, EpisodeCiteSchema, NoPriorHistoryCiteSchema, CiteSchema, CitesArraySchema, InsightBodySchema, RecommendationBodySchema, ActionBodySchema, OutcomeBodySchema, FeedbackBodySchema, EpisodeBaseFields, EpisodeInsertSchema, EpisodeRowSchema;
|
|
12866
|
+
var KnowledgeCiteSchema, EpisodeCiteSchema, NoPriorHistoryCiteSchema, CiteSchema, CitesArraySchema, DecompositionPartSchema, DecompositionSchema, InsightBodySchema, RecommendationBodySchema, ActionBodySchema, OutcomeBodySchema, FeedbackBodySchema, EpisodeBaseFields, EpisodeInsertSchema, EpisodeRowSchema;
|
|
12651
12867
|
var init_episodes = __esm({
|
|
12652
12868
|
"../../src/lib/api-contracts/episodes/index.ts"() {
|
|
12653
12869
|
init_zod();
|
|
@@ -12668,6 +12884,20 @@ var init_episodes = __esm({
|
|
|
12668
12884
|
});
|
|
12669
12885
|
CiteSchema = external_exports.union([KnowledgeCiteSchema, EpisodeCiteSchema, NoPriorHistoryCiteSchema]);
|
|
12670
12886
|
CitesArraySchema = external_exports.array(CiteSchema);
|
|
12887
|
+
DecompositionPartSchema = external_exports.object({
|
|
12888
|
+
/** What this part is, e.g. "Google Ads" or "Week of Jun 2". */
|
|
12889
|
+
label: external_exports.string().max(200).optional(),
|
|
12890
|
+
/** The numeric value of this part. Finite (no NaN/Infinity) for safe arithmetic. */
|
|
12891
|
+
value: external_exports.number().finite()
|
|
12892
|
+
});
|
|
12893
|
+
DecompositionSchema = external_exports.object({
|
|
12894
|
+
/** What is being decomposed, e.g. "Spend by channel". */
|
|
12895
|
+
label: external_exports.string().max(200).optional(),
|
|
12896
|
+
/** The parts the total is split into (at least one). */
|
|
12897
|
+
parts: external_exports.array(DecompositionPartSchema).min(1),
|
|
12898
|
+
/** The stated total the parts should sum to. */
|
|
12899
|
+
total: external_exports.number().finite()
|
|
12900
|
+
});
|
|
12671
12901
|
InsightBodySchema = external_exports.object({
|
|
12672
12902
|
/** Short summary of the insight. */
|
|
12673
12903
|
summary: external_exports.string().min(1).max(4e3),
|
|
@@ -12678,7 +12908,13 @@ var init_episodes = __esm({
|
|
|
12678
12908
|
title: external_exports.string().min(1).max(500),
|
|
12679
12909
|
/** Explanation grounded in evidence. */
|
|
12680
12910
|
rationale: external_exports.string().min(1).max(8e3),
|
|
12681
|
-
action_items: external_exports.array(external_exports.string().max(1e3)).optional()
|
|
12911
|
+
action_items: external_exports.array(external_exports.string().max(1e3)).optional(),
|
|
12912
|
+
/**
|
|
12913
|
+
* Optional structured breakdown of a total into parts. When present, it is
|
|
12914
|
+
* checked deterministically by `arithmetic-reconcile.ts` (BAM-2995) — the
|
|
12915
|
+
* precise, model-free complement to the LLM `decomposition_reconciles` check.
|
|
12916
|
+
*/
|
|
12917
|
+
decomposition: DecompositionSchema.optional()
|
|
12682
12918
|
});
|
|
12683
12919
|
ActionBodySchema = external_exports.object({
|
|
12684
12920
|
/** Human-readable description of the action taken. */
|
|
@@ -12929,6 +13165,16 @@ async function getContextHealth(bambooSession, opts = {}) {
|
|
|
12929
13165
|
if (!res.ok) throw await parseError(res);
|
|
12930
13166
|
return ContextHealthResponseSchema.parse(await res.json());
|
|
12931
13167
|
}
|
|
13168
|
+
async function getAgentUsage(bambooSession, opts = {}) {
|
|
13169
|
+
const url = new URL(`${apiBase()}/api/v1/cli/usage`);
|
|
13170
|
+
if (opts.agentId) url.searchParams.set("agent_id", opts.agentId);
|
|
13171
|
+
if (opts.windowDays) url.searchParams.set("window_days", String(opts.windowDays));
|
|
13172
|
+
const res = await cliApiFetch(url.toString(), {
|
|
13173
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
13174
|
+
});
|
|
13175
|
+
if (!res.ok) throw await parseError(res);
|
|
13176
|
+
return AgentUsageResponseSchema.parse(await res.json());
|
|
13177
|
+
}
|
|
12932
13178
|
async function getOnboardingStatus(bambooSession, opts = {}) {
|
|
12933
13179
|
const url = new URL(`${apiBase()}/api/v1/cli/onboarding/status`);
|
|
12934
13180
|
if (opts.brandId) url.searchParams.set("brand_id", opts.brandId);
|
|
@@ -13253,6 +13499,22 @@ async function postOutcomeEpisode(bambooSession, body) {
|
|
|
13253
13499
|
const json = await res.json();
|
|
13254
13500
|
return CliOutcomeEpisodeResponseSchema.parse(json);
|
|
13255
13501
|
}
|
|
13502
|
+
async function startAbTest(bambooSession, body) {
|
|
13503
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/eval/ab`, {
|
|
13504
|
+
method: "POST",
|
|
13505
|
+
headers: {
|
|
13506
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
13507
|
+
"Content-Type": "application/json"
|
|
13508
|
+
},
|
|
13509
|
+
body: JSON.stringify(body)
|
|
13510
|
+
});
|
|
13511
|
+
if (!res.ok) throw await parseError(res);
|
|
13512
|
+
const json = await res.json();
|
|
13513
|
+
return EvalAbResponseSchema.parse(json.data);
|
|
13514
|
+
}
|
|
13515
|
+
function absoluteUrl(relativePath) {
|
|
13516
|
+
return `${apiBase()}${relativePath}`;
|
|
13517
|
+
}
|
|
13256
13518
|
async function postRecEpisode(bambooSession, body) {
|
|
13257
13519
|
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/episodes/recommendation`, {
|
|
13258
13520
|
method: "POST",
|
|
@@ -13289,7 +13551,9 @@ var init_api = __esm({
|
|
|
13289
13551
|
init_onboarding_status();
|
|
13290
13552
|
init_context_health();
|
|
13291
13553
|
init_install_token();
|
|
13554
|
+
init_usage();
|
|
13292
13555
|
init_episodes2();
|
|
13556
|
+
init_eval_ab();
|
|
13293
13557
|
init_version();
|
|
13294
13558
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
13295
13559
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -13342,7 +13606,7 @@ var init_api = __esm({
|
|
|
13342
13606
|
|
|
13343
13607
|
// src/lib/util.ts
|
|
13344
13608
|
function sleep(ms) {
|
|
13345
|
-
return new Promise((
|
|
13609
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
13346
13610
|
}
|
|
13347
13611
|
var init_util2 = __esm({
|
|
13348
13612
|
"src/lib/util.ts"() {
|
|
@@ -13354,6 +13618,8 @@ var init_util2 = __esm({
|
|
|
13354
13618
|
var login_exports = {};
|
|
13355
13619
|
__export(login_exports, {
|
|
13356
13620
|
TOKEN_POLL: () => TOKEN_POLL,
|
|
13621
|
+
fetchGithubTokenForLogin: () => fetchGithubTokenForLogin,
|
|
13622
|
+
finishLogin: () => finishLogin,
|
|
13357
13623
|
handleMissingGithubToken: () => handleMissingGithubToken,
|
|
13358
13624
|
isAgentScopedKey: () => isAgentScopedKey,
|
|
13359
13625
|
runLogin: () => runLogin,
|
|
@@ -13413,8 +13679,8 @@ async function handleMissingGithubToken(bambooSession) {
|
|
|
13413
13679
|
async function startCallbackServer(expectedState) {
|
|
13414
13680
|
let resolveSession2;
|
|
13415
13681
|
let rejectSession;
|
|
13416
|
-
const session = new Promise((
|
|
13417
|
-
resolveSession2 =
|
|
13682
|
+
const session = new Promise((resolve3, reject) => {
|
|
13683
|
+
resolveSession2 = resolve3;
|
|
13418
13684
|
rejectSession = reject;
|
|
13419
13685
|
});
|
|
13420
13686
|
const server = createServer((req, res) => {
|
|
@@ -13472,10 +13738,10 @@ async function startCallbackServer(expectedState) {
|
|
|
13472
13738
|
server.close();
|
|
13473
13739
|
}, LOGIN_TIMEOUT_MS);
|
|
13474
13740
|
timer.unref();
|
|
13475
|
-
const port = await new Promise((
|
|
13741
|
+
const port = await new Promise((resolve3, reject) => {
|
|
13476
13742
|
server.once("listening", () => {
|
|
13477
13743
|
const addr = server.address();
|
|
13478
|
-
if (addr && typeof addr === "object")
|
|
13744
|
+
if (addr && typeof addr === "object") resolve3(addr.port);
|
|
13479
13745
|
else reject(new Error("Couldn't bind localhost port"));
|
|
13480
13746
|
});
|
|
13481
13747
|
server.once("error", reject);
|
|
@@ -13558,6 +13824,54 @@ async function runLoginWithToken(bambooSession) {
|
|
|
13558
13824
|
}
|
|
13559
13825
|
}
|
|
13560
13826
|
}
|
|
13827
|
+
async function fetchGithubTokenForLogin(bambooSession) {
|
|
13828
|
+
const tokenSpinner = ora("Fetching your GitHub token\u2026").start();
|
|
13829
|
+
try {
|
|
13830
|
+
const tokenResp = await getGithubToken(bambooSession);
|
|
13831
|
+
tokenSpinner.succeed("GitHub token retrieved");
|
|
13832
|
+
return tokenResp;
|
|
13833
|
+
} catch (err) {
|
|
13834
|
+
const status = err instanceof ApiError ? err.status : null;
|
|
13835
|
+
if (status === 404) {
|
|
13836
|
+
tokenSpinner.warn(
|
|
13837
|
+
"No GitHub token linked yet \u2014 opening browser to authorize Bamboo with GitHub\u2026"
|
|
13838
|
+
);
|
|
13839
|
+
} else if (status === 410) {
|
|
13840
|
+
tokenSpinner.warn(
|
|
13841
|
+
"Your GitHub token expired \u2014 opening browser to refresh authorization\u2026"
|
|
13842
|
+
);
|
|
13843
|
+
} else {
|
|
13844
|
+
tokenSpinner.warn(
|
|
13845
|
+
`Couldn't fetch GitHub token (${err.message}) \u2014 opening browser to (re)link GitHub\u2026`
|
|
13846
|
+
);
|
|
13847
|
+
}
|
|
13848
|
+
return handleMissingGithubToken(bambooSession);
|
|
13849
|
+
}
|
|
13850
|
+
}
|
|
13851
|
+
async function finishLogin(bambooSession, tokenResp) {
|
|
13852
|
+
await writeCredentials({
|
|
13853
|
+
bamboo_session: bambooSession,
|
|
13854
|
+
github_token: tokenResp?.access_token ?? "",
|
|
13855
|
+
github_token_expires_at: tokenResp?.expires_at ?? null,
|
|
13856
|
+
github_username: tokenResp?.github_username ?? null,
|
|
13857
|
+
written_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
13858
|
+
});
|
|
13859
|
+
if (!tokenResp) {
|
|
13860
|
+
console.log("");
|
|
13861
|
+
console.log(" Your Bamboo session is saved \u2014 GitHub isn't linked yet.");
|
|
13862
|
+
console.log(
|
|
13863
|
+
" Re-run `bamboo-agents login` when you're ready to link GitHub."
|
|
13864
|
+
);
|
|
13865
|
+
console.log("");
|
|
13866
|
+
process.exit(1);
|
|
13867
|
+
return;
|
|
13868
|
+
}
|
|
13869
|
+
console.log("");
|
|
13870
|
+
console.log(
|
|
13871
|
+
` \u2713 Logged in${tokenResp.github_username ? ` as @${tokenResp.github_username}` : ""}.`
|
|
13872
|
+
);
|
|
13873
|
+
console.log("");
|
|
13874
|
+
}
|
|
13561
13875
|
async function runLogin() {
|
|
13562
13876
|
const state = randomBytes2(32).toString("hex");
|
|
13563
13877
|
const code = verificationCode(state);
|
|
@@ -13583,43 +13897,8 @@ async function runLogin() {
|
|
|
13583
13897
|
process.exit(1);
|
|
13584
13898
|
}
|
|
13585
13899
|
spinner.succeed("Bamboo session captured");
|
|
13586
|
-
const
|
|
13587
|
-
|
|
13588
|
-
try {
|
|
13589
|
-
tokenResp = await getGithubToken(bambooSession);
|
|
13590
|
-
tokenSpinner.succeed("GitHub token retrieved");
|
|
13591
|
-
} catch (err) {
|
|
13592
|
-
if (err instanceof ApiError && err.status === 404) {
|
|
13593
|
-
tokenSpinner.warn(
|
|
13594
|
-
"No GitHub token linked yet \u2014 opening browser to authorize Bamboo with GitHub\u2026"
|
|
13595
|
-
);
|
|
13596
|
-
const polled = await handleMissingGithubToken(bambooSession);
|
|
13597
|
-
if (!polled) process.exit(1);
|
|
13598
|
-
tokenResp = polled;
|
|
13599
|
-
} else if (err instanceof ApiError && err.status === 410) {
|
|
13600
|
-
tokenSpinner.warn(
|
|
13601
|
-
"Your GitHub token expired \u2014 opening browser to refresh authorization\u2026"
|
|
13602
|
-
);
|
|
13603
|
-
const polled = await handleMissingGithubToken(bambooSession);
|
|
13604
|
-
if (!polled) process.exit(1);
|
|
13605
|
-
tokenResp = polled;
|
|
13606
|
-
} else {
|
|
13607
|
-
tokenSpinner.fail(`Couldn't fetch GitHub token: ${err.message}`);
|
|
13608
|
-
process.exit(1);
|
|
13609
|
-
}
|
|
13610
|
-
}
|
|
13611
|
-
await writeCredentials({
|
|
13612
|
-
bamboo_session: bambooSession,
|
|
13613
|
-
github_token: tokenResp.access_token,
|
|
13614
|
-
github_token_expires_at: tokenResp.expires_at,
|
|
13615
|
-
github_username: tokenResp.github_username ?? null,
|
|
13616
|
-
written_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
13617
|
-
});
|
|
13618
|
-
console.log("");
|
|
13619
|
-
console.log(
|
|
13620
|
-
` \u2713 Logged in${tokenResp.github_username ? ` as @${tokenResp.github_username}` : ""}.`
|
|
13621
|
-
);
|
|
13622
|
-
console.log("");
|
|
13900
|
+
const tokenResp = await fetchGithubTokenForLogin(bambooSession);
|
|
13901
|
+
await finishLogin(bambooSession, tokenResp);
|
|
13623
13902
|
}
|
|
13624
13903
|
var FALLBACK_RELINK_URL, LOGIN_TIMEOUT_MS, TOKEN_POLL;
|
|
13625
13904
|
var init_login = __esm({
|
|
@@ -13711,12 +13990,12 @@ async function promptStdin(question, opts = {}) {
|
|
|
13711
13990
|
}
|
|
13712
13991
|
}
|
|
13713
13992
|
function readOnce(rl, question) {
|
|
13714
|
-
return new Promise((
|
|
13993
|
+
return new Promise((resolve3) => {
|
|
13715
13994
|
let resolved = false;
|
|
13716
13995
|
const settle = (value) => {
|
|
13717
13996
|
if (resolved) return;
|
|
13718
13997
|
resolved = true;
|
|
13719
|
-
|
|
13998
|
+
resolve3(value);
|
|
13720
13999
|
};
|
|
13721
14000
|
rl.once("close", () => settle(null));
|
|
13722
14001
|
rl.question(question, (answer) => settle(answer));
|
|
@@ -15424,85 +15703,6 @@ var init_open2 = __esm({
|
|
|
15424
15703
|
}
|
|
15425
15704
|
});
|
|
15426
15705
|
|
|
15427
|
-
// src/lib/output.ts
|
|
15428
|
-
function isJsonMode(opts = {}) {
|
|
15429
|
-
if (opts.json === true) return true;
|
|
15430
|
-
return process.stdout.isTTY !== true;
|
|
15431
|
-
}
|
|
15432
|
-
function parseFields(raw) {
|
|
15433
|
-
if (!raw) return [];
|
|
15434
|
-
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
15435
|
-
}
|
|
15436
|
-
function pluckPath(value, segments) {
|
|
15437
|
-
if (segments.length === 0) return value;
|
|
15438
|
-
if (value === null || value === void 0) return void 0;
|
|
15439
|
-
if (Array.isArray(value)) {
|
|
15440
|
-
return value.map((item) => pluckPath(item, segments)).filter((v) => v !== void 0);
|
|
15441
|
-
}
|
|
15442
|
-
if (typeof value === "object") {
|
|
15443
|
-
const [head, ...rest] = segments;
|
|
15444
|
-
return pluckPath(value[head], rest);
|
|
15445
|
-
}
|
|
15446
|
-
return void 0;
|
|
15447
|
-
}
|
|
15448
|
-
function projectFields(data, fields) {
|
|
15449
|
-
if (fields.length === 0) return data;
|
|
15450
|
-
if (data === null || typeof data !== "object" || Array.isArray(data)) {
|
|
15451
|
-
return data;
|
|
15452
|
-
}
|
|
15453
|
-
const out = {};
|
|
15454
|
-
for (const field of fields) {
|
|
15455
|
-
const segments = field.split(".").filter((s) => s.length > 0);
|
|
15456
|
-
if (segments.length === 0) continue;
|
|
15457
|
-
const value = pluckPath(data, segments);
|
|
15458
|
-
if (value === void 0) continue;
|
|
15459
|
-
out[field] = value;
|
|
15460
|
-
}
|
|
15461
|
-
return out;
|
|
15462
|
-
}
|
|
15463
|
-
function writeStdout(line) {
|
|
15464
|
-
process.stdout.write(line.endsWith("\n") ? line : line + "\n");
|
|
15465
|
-
}
|
|
15466
|
-
function writeStderr(line) {
|
|
15467
|
-
process.stderr.write(line.endsWith("\n") ? line : line + "\n");
|
|
15468
|
-
}
|
|
15469
|
-
function emitSuccess(data, opts, renderHuman) {
|
|
15470
|
-
if (isJsonMode(opts)) {
|
|
15471
|
-
const projected = projectFields(data, parseFields(opts.fields));
|
|
15472
|
-
const envelope = { ok: true, data: projected };
|
|
15473
|
-
writeStdout(JSON.stringify(envelope, null, 2));
|
|
15474
|
-
return;
|
|
15475
|
-
}
|
|
15476
|
-
if (opts.quiet) return;
|
|
15477
|
-
if (renderHuman) renderHuman(data);
|
|
15478
|
-
}
|
|
15479
|
-
function emitError(err, opts, exitCode) {
|
|
15480
|
-
if (isJsonMode(opts)) {
|
|
15481
|
-
const envelope = {
|
|
15482
|
-
ok: false,
|
|
15483
|
-
error: {
|
|
15484
|
-
code: err.code,
|
|
15485
|
-
message: err.message,
|
|
15486
|
-
...err.hint ? { hint: err.hint } : {}
|
|
15487
|
-
}
|
|
15488
|
-
};
|
|
15489
|
-
writeStdout(JSON.stringify(envelope, null, 2));
|
|
15490
|
-
} else if (!opts.quiet) {
|
|
15491
|
-
writeStderr(`bamboo-agents: ${err.message}`);
|
|
15492
|
-
if (err.hint) writeStderr(` ${err.hint}`);
|
|
15493
|
-
}
|
|
15494
|
-
if (exitCode !== void 0) process.exit(exitCode);
|
|
15495
|
-
}
|
|
15496
|
-
function human(line = "", opts = {}) {
|
|
15497
|
-
if (opts.quiet) return;
|
|
15498
|
-
writeStderr(line);
|
|
15499
|
-
}
|
|
15500
|
-
var init_output = __esm({
|
|
15501
|
-
"src/lib/output.ts"() {
|
|
15502
|
-
"use strict";
|
|
15503
|
-
}
|
|
15504
|
-
});
|
|
15505
|
-
|
|
15506
15706
|
// src/commands/save.ts
|
|
15507
15707
|
var save_exports = {};
|
|
15508
15708
|
__export(save_exports, {
|
|
@@ -15805,7 +16005,12 @@ var init_save2 = __esm({
|
|
|
15805
16005
|
"brands/",
|
|
15806
16006
|
"agents/",
|
|
15807
16007
|
"knowledge/",
|
|
15808
|
-
|
|
16008
|
+
// BAM-3476: the plugin skills tree is THE skill-write destination
|
|
16009
|
+
// (BAM-3464) — root `skills/` is retired and dead-letters. The server's
|
|
16010
|
+
// routed-write core now bumps the lockstep plugin manifests automatically
|
|
16011
|
+
// for any plugin-skill edit in this batch (see `/api/v1/cli/save`), so a
|
|
16012
|
+
// local edit under `plugins/` is safe to send as-is.
|
|
16013
|
+
"plugins/",
|
|
15809
16014
|
"instructions/",
|
|
15810
16015
|
"org/"
|
|
15811
16016
|
];
|
|
@@ -16300,12 +16505,12 @@ async function choose(question, choices, defaultIndex = 0) {
|
|
|
16300
16505
|
}
|
|
16301
16506
|
}
|
|
16302
16507
|
function readOnce2(rl, question) {
|
|
16303
|
-
return new Promise((
|
|
16508
|
+
return new Promise((resolve3) => {
|
|
16304
16509
|
let resolved = false;
|
|
16305
16510
|
const settle = (value) => {
|
|
16306
16511
|
if (resolved) return;
|
|
16307
16512
|
resolved = true;
|
|
16308
|
-
|
|
16513
|
+
resolve3(value);
|
|
16309
16514
|
};
|
|
16310
16515
|
rl.once("close", () => settle(null));
|
|
16311
16516
|
rl.question(question, (answer) => settle(answer));
|
|
@@ -18213,7 +18418,7 @@ function printHealth(data, opts) {
|
|
|
18213
18418
|
const scopeLabel = scope.kind === "agent" ? `agent (${scope.agentId ?? "\u2014"})` : scope.kind === "brand" ? `brand (${scope.brandId ?? "\u2014"})` : "org";
|
|
18214
18419
|
human("", opts);
|
|
18215
18420
|
human(
|
|
18216
|
-
` Context health [${scopeLabel}]: ${gradeSymbol(grade)} ${grade} (score ${Math.round(score)}/100)`,
|
|
18421
|
+
score === null ? ` Context health [${scopeLabel}]: not yet audited` : ` Context health [${scopeLabel}]: ${gradeSymbol(grade)} ${grade} (score ${Math.round(score)}/100)`,
|
|
18217
18422
|
opts
|
|
18218
18423
|
);
|
|
18219
18424
|
const fmtBucket = (label, v) => ` ${label.padEnd(12)} ${v != null ? `${Math.round(v)}/100` : "n/a"}`;
|
|
@@ -18273,12 +18478,109 @@ var init_context = __esm({
|
|
|
18273
18478
|
}
|
|
18274
18479
|
});
|
|
18275
18480
|
|
|
18481
|
+
// src/commands/usage.ts
|
|
18482
|
+
var usage_exports = {};
|
|
18483
|
+
__export(usage_exports, {
|
|
18484
|
+
runUsage: () => runUsage
|
|
18485
|
+
});
|
|
18486
|
+
async function requireSession7(opts) {
|
|
18487
|
+
const creds = await readCredentials();
|
|
18488
|
+
if (!creds) {
|
|
18489
|
+
emitError(
|
|
18490
|
+
{
|
|
18491
|
+
code: "not_signed_in",
|
|
18492
|
+
message: "not signed in.",
|
|
18493
|
+
hint: "Run `bamboo-agents login` first."
|
|
18494
|
+
},
|
|
18495
|
+
opts,
|
|
18496
|
+
1
|
|
18497
|
+
);
|
|
18498
|
+
throw new Error("unreachable");
|
|
18499
|
+
}
|
|
18500
|
+
return creds.bamboo_session;
|
|
18501
|
+
}
|
|
18502
|
+
function printUsage(data, opts) {
|
|
18503
|
+
const scopeLabel = data.agentId ? `agent (${data.agentId})` : "org";
|
|
18504
|
+
human("", opts);
|
|
18505
|
+
human(` Usage [${scopeLabel}], last ${data.windowDays}d:`, opts);
|
|
18506
|
+
if (data.agentId) {
|
|
18507
|
+
human(
|
|
18508
|
+
" \u26A0 agent-scoped: OAuth/Cowork calls without an explicit agent_id argument aren't",
|
|
18509
|
+
opts
|
|
18510
|
+
);
|
|
18511
|
+
human(
|
|
18512
|
+
" attributed here and won't count \u2014 a real zero here doesn't rule out activity.",
|
|
18513
|
+
opts
|
|
18514
|
+
);
|
|
18515
|
+
human(" Cross-check with the org-wide read (no --agent) if this looks too quiet.", opts);
|
|
18516
|
+
}
|
|
18517
|
+
if (!data.hasActivity) {
|
|
18518
|
+
human(" No activity in this window.", opts);
|
|
18519
|
+
human("", opts);
|
|
18520
|
+
return;
|
|
18521
|
+
}
|
|
18522
|
+
human(` calls: ${data.totalCalls}`, opts);
|
|
18523
|
+
human(` sessions: ${data.distinctSessions}`, opts);
|
|
18524
|
+
human(` first: ${data.firstSeen}`, opts);
|
|
18525
|
+
human(` last: ${data.lastSeen}`, opts);
|
|
18526
|
+
human("", opts);
|
|
18527
|
+
const tools = Object.entries(data.toolCounts).sort(([, a], [, b]) => b - a);
|
|
18528
|
+
if (tools.length > 0) {
|
|
18529
|
+
human(" By tool:", opts);
|
|
18530
|
+
for (const [tool, count] of tools) {
|
|
18531
|
+
human(` ${tool.padEnd(24)} ${count}`, opts);
|
|
18532
|
+
}
|
|
18533
|
+
human("", opts);
|
|
18534
|
+
}
|
|
18535
|
+
if (data.truncated) {
|
|
18536
|
+
human(" \u26A0 row cap hit \u2014 counts above are a floor, not exact.", opts);
|
|
18537
|
+
human("", opts);
|
|
18538
|
+
}
|
|
18539
|
+
}
|
|
18540
|
+
async function runUsage(options) {
|
|
18541
|
+
const opts = options;
|
|
18542
|
+
const session = await requireSession7(opts);
|
|
18543
|
+
let windowDays;
|
|
18544
|
+
if (options.windowDays) {
|
|
18545
|
+
const parsed = Number(options.windowDays);
|
|
18546
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
18547
|
+
emitError(
|
|
18548
|
+
{ code: "invalid_window_days", message: "--window-days must be a positive number." },
|
|
18549
|
+
opts,
|
|
18550
|
+
1
|
|
18551
|
+
);
|
|
18552
|
+
return;
|
|
18553
|
+
}
|
|
18554
|
+
windowDays = parsed;
|
|
18555
|
+
}
|
|
18556
|
+
let data;
|
|
18557
|
+
try {
|
|
18558
|
+
data = await getAgentUsage(session, { agentId: options.agent, windowDays });
|
|
18559
|
+
} catch (err) {
|
|
18560
|
+
emitError(
|
|
18561
|
+
{ code: "usage_read_failed", message: `couldn't load usage: ${err.message}` },
|
|
18562
|
+
opts,
|
|
18563
|
+
1
|
|
18564
|
+
);
|
|
18565
|
+
return;
|
|
18566
|
+
}
|
|
18567
|
+
emitSuccess(data, opts, (d) => printUsage(d, opts));
|
|
18568
|
+
}
|
|
18569
|
+
var init_usage2 = __esm({
|
|
18570
|
+
"src/commands/usage.ts"() {
|
|
18571
|
+
"use strict";
|
|
18572
|
+
init_credentials();
|
|
18573
|
+
init_api();
|
|
18574
|
+
init_output();
|
|
18575
|
+
}
|
|
18576
|
+
});
|
|
18577
|
+
|
|
18276
18578
|
// src/commands/onboarding.ts
|
|
18277
18579
|
var onboarding_exports = {};
|
|
18278
18580
|
__export(onboarding_exports, {
|
|
18279
18581
|
runOnboardingStatus: () => runOnboardingStatus
|
|
18280
18582
|
});
|
|
18281
|
-
async function
|
|
18583
|
+
async function requireSession8(opts) {
|
|
18282
18584
|
const creds = await readCredentials();
|
|
18283
18585
|
if (!creds) {
|
|
18284
18586
|
emitError(
|
|
@@ -18307,7 +18609,7 @@ function printStatus(data, opts) {
|
|
|
18307
18609
|
}
|
|
18308
18610
|
async function runOnboardingStatus(options) {
|
|
18309
18611
|
const opts = options;
|
|
18310
|
-
const session = await
|
|
18612
|
+
const session = await requireSession8(opts);
|
|
18311
18613
|
let data;
|
|
18312
18614
|
try {
|
|
18313
18615
|
data = await getOnboardingStatus(session, { brandId: options.brand });
|
|
@@ -18339,7 +18641,7 @@ __export(brand_exports, {
|
|
|
18339
18641
|
runBrandEditor: () => runBrandEditor,
|
|
18340
18642
|
runBrandUpdate: () => runBrandUpdate
|
|
18341
18643
|
});
|
|
18342
|
-
async function
|
|
18644
|
+
async function requireSession9() {
|
|
18343
18645
|
const creds = await readCredentials();
|
|
18344
18646
|
if (!creds) {
|
|
18345
18647
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -18352,7 +18654,7 @@ async function runBrandUpdate(brandId, options) {
|
|
|
18352
18654
|
console.error("bamboo-agents: `brand update` requires a brand id.");
|
|
18353
18655
|
process.exit(2);
|
|
18354
18656
|
}
|
|
18355
|
-
const session = await
|
|
18657
|
+
const session = await requireSession9();
|
|
18356
18658
|
let result;
|
|
18357
18659
|
try {
|
|
18358
18660
|
result = await patchBrand(session, brandId, options.website);
|
|
@@ -18373,7 +18675,7 @@ async function runBrandEditor(action, brandId, userId, options) {
|
|
|
18373
18675
|
console.error(`bamboo-agents: \`brand editor ${action}\` requires <brand-id> <user-id>.`);
|
|
18374
18676
|
process.exit(2);
|
|
18375
18677
|
}
|
|
18376
|
-
const session = await
|
|
18678
|
+
const session = await requireSession9();
|
|
18377
18679
|
let result;
|
|
18378
18680
|
try {
|
|
18379
18681
|
result = await postBrandEditor(session, brandId, { action, user_id: userId });
|
|
@@ -18412,7 +18714,7 @@ __export(agents_exports2, {
|
|
|
18412
18714
|
runAgentsProvision: () => runAgentsProvision,
|
|
18413
18715
|
runAgentsUpdate: () => runAgentsUpdate
|
|
18414
18716
|
});
|
|
18415
|
-
async function
|
|
18717
|
+
async function requireSession10(opts) {
|
|
18416
18718
|
const creds = await readCredentials();
|
|
18417
18719
|
if (!creds) {
|
|
18418
18720
|
emitError(
|
|
@@ -18499,7 +18801,7 @@ function printList(data, opts) {
|
|
|
18499
18801
|
}
|
|
18500
18802
|
async function runAgentsList(options) {
|
|
18501
18803
|
const opts = options;
|
|
18502
|
-
const session = await
|
|
18804
|
+
const session = await requireSession10(opts);
|
|
18503
18805
|
let data;
|
|
18504
18806
|
try {
|
|
18505
18807
|
data = await listCliAgents(session);
|
|
@@ -18526,7 +18828,7 @@ function printDetail(agent, opts) {
|
|
|
18526
18828
|
}
|
|
18527
18829
|
async function runAgentsGet(agentRef, options) {
|
|
18528
18830
|
const opts = options;
|
|
18529
|
-
const session = await
|
|
18831
|
+
const session = await requireSession10(opts);
|
|
18530
18832
|
const row = await resolveAgentRef(session, agentRef, opts);
|
|
18531
18833
|
let agent;
|
|
18532
18834
|
try {
|
|
@@ -18568,7 +18870,7 @@ async function resolveBrandId(session, explicit, opts) {
|
|
|
18568
18870
|
}
|
|
18569
18871
|
async function runAgentsProvision(name, options) {
|
|
18570
18872
|
const opts = options;
|
|
18571
|
-
const session = await
|
|
18873
|
+
const session = await requireSession10(opts);
|
|
18572
18874
|
const brandId = await resolveBrandId(session, options.brand, opts);
|
|
18573
18875
|
let result;
|
|
18574
18876
|
try {
|
|
@@ -18594,7 +18896,7 @@ async function runAgentsProvision(name, options) {
|
|
|
18594
18896
|
}
|
|
18595
18897
|
async function runAgentsPause(agentRef, options) {
|
|
18596
18898
|
const opts = options;
|
|
18597
|
-
const session = await
|
|
18899
|
+
const session = await requireSession10(opts);
|
|
18598
18900
|
const row = await resolveAgentRef(session, agentRef, opts);
|
|
18599
18901
|
try {
|
|
18600
18902
|
const res = await pauseCliAgent(session, row.id);
|
|
@@ -18609,7 +18911,7 @@ async function runAgentsPause(agentRef, options) {
|
|
|
18609
18911
|
}
|
|
18610
18912
|
async function runAgentsUpdate(agentRef, options) {
|
|
18611
18913
|
const opts = options;
|
|
18612
|
-
const session = await
|
|
18914
|
+
const session = await requireSession10(opts);
|
|
18613
18915
|
const body = {};
|
|
18614
18916
|
if (options.name !== void 0) body.name = options.name;
|
|
18615
18917
|
if (options.description !== void 0) body.description = options.description;
|
|
@@ -18640,7 +18942,7 @@ async function runAgentsUpdate(agentRef, options) {
|
|
|
18640
18942
|
}
|
|
18641
18943
|
async function runAgentsDelete(agentRef, options) {
|
|
18642
18944
|
const opts = options;
|
|
18643
|
-
const session = await
|
|
18945
|
+
const session = await requireSession10(opts);
|
|
18644
18946
|
const row = await resolveAgentRef(session, agentRef, opts);
|
|
18645
18947
|
try {
|
|
18646
18948
|
const res = await deleteCliAgent(session, row.id);
|
|
@@ -18662,7 +18964,7 @@ async function runAgentsDelete(agentRef, options) {
|
|
|
18662
18964
|
}
|
|
18663
18965
|
async function runAgentsClone(sourceRef, targetRef, options) {
|
|
18664
18966
|
const opts = options;
|
|
18665
|
-
const session = await
|
|
18967
|
+
const session = await requireSession10(opts);
|
|
18666
18968
|
const source = await resolveAgentRef(session, sourceRef, opts);
|
|
18667
18969
|
const target = await resolveAgentRef(session, targetRef, opts);
|
|
18668
18970
|
try {
|
|
@@ -18691,7 +18993,7 @@ async function runAgentsClone(sourceRef, targetRef, options) {
|
|
|
18691
18993
|
}
|
|
18692
18994
|
async function runAgentsEnableTemplate(agentRef, options) {
|
|
18693
18995
|
const opts = options;
|
|
18694
|
-
const session = await
|
|
18996
|
+
const session = await requireSession10(opts);
|
|
18695
18997
|
if (!options.template) {
|
|
18696
18998
|
emitError({ code: "template_required", message: "Provide --template <id>." }, opts, 2);
|
|
18697
18999
|
return;
|
|
@@ -18725,7 +19027,7 @@ async function runAgentsEnableTemplate(agentRef, options) {
|
|
|
18725
19027
|
}
|
|
18726
19028
|
async function runAgentsActivate(agentRef, options) {
|
|
18727
19029
|
const opts = options;
|
|
18728
|
-
const session = await
|
|
19030
|
+
const session = await requireSession10(opts);
|
|
18729
19031
|
const row = await resolveAgentRef(session, agentRef, opts);
|
|
18730
19032
|
let state = row.state;
|
|
18731
19033
|
let status = row.status;
|
|
@@ -18790,7 +19092,7 @@ __export(episode_exports, {
|
|
|
18790
19092
|
runEpisodeLogOutcome: () => runEpisodeLogOutcome,
|
|
18791
19093
|
runEpisodeLogRec: () => runEpisodeLogRec
|
|
18792
19094
|
});
|
|
18793
|
-
async function
|
|
19095
|
+
async function requireSession11() {
|
|
18794
19096
|
const creds = await readCredentials();
|
|
18795
19097
|
if (!creds) {
|
|
18796
19098
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -18823,7 +19125,7 @@ async function runEpisodeLogOutcome(options) {
|
|
|
18823
19125
|
process.exit(2);
|
|
18824
19126
|
}
|
|
18825
19127
|
}
|
|
18826
|
-
const session = await
|
|
19128
|
+
const session = await requireSession11();
|
|
18827
19129
|
let result;
|
|
18828
19130
|
try {
|
|
18829
19131
|
result = await postOutcomeEpisode(session, {
|
|
@@ -18889,7 +19191,7 @@ async function runEpisodeLogRec(options) {
|
|
|
18889
19191
|
process.exit(2);
|
|
18890
19192
|
}
|
|
18891
19193
|
}
|
|
18892
|
-
const session = await
|
|
19194
|
+
const session = await requireSession11();
|
|
18893
19195
|
let result;
|
|
18894
19196
|
try {
|
|
18895
19197
|
result = await postRecEpisode(session, {
|
|
@@ -18928,6 +19230,107 @@ var init_episode = __esm({
|
|
|
18928
19230
|
}
|
|
18929
19231
|
});
|
|
18930
19232
|
|
|
19233
|
+
// src/commands/eval-ab.ts
|
|
19234
|
+
var eval_ab_exports2 = {};
|
|
19235
|
+
__export(eval_ab_exports2, {
|
|
19236
|
+
runEvalAblate: () => runEvalAblate
|
|
19237
|
+
});
|
|
19238
|
+
import { readFile as readFile9 } from "node:fs/promises";
|
|
19239
|
+
import { resolve as resolve2 } from "node:path";
|
|
19240
|
+
async function requireSession12(opts) {
|
|
19241
|
+
const creds = await readCredentials();
|
|
19242
|
+
if (!creds) {
|
|
19243
|
+
emitError(
|
|
19244
|
+
{
|
|
19245
|
+
code: "not_signed_in",
|
|
19246
|
+
message: "not signed in.",
|
|
19247
|
+
hint: "Run `bamboo-agents login` first."
|
|
19248
|
+
},
|
|
19249
|
+
opts,
|
|
19250
|
+
1
|
|
19251
|
+
);
|
|
19252
|
+
throw new Error("unreachable");
|
|
19253
|
+
}
|
|
19254
|
+
return creds.bamboo_session;
|
|
19255
|
+
}
|
|
19256
|
+
function printStaged(data, opts) {
|
|
19257
|
+
human("", opts);
|
|
19258
|
+
human(` A/B test started on "${data.skill_name}".`, opts);
|
|
19259
|
+
human("", opts);
|
|
19260
|
+
human(` ${data.plan}`, opts);
|
|
19261
|
+
human(
|
|
19262
|
+
` ${data.case_count} cases \xD7 ${data.reps_per_arm} reps \xD7 2 arms = ${data.total_runs} queued runs.`,
|
|
19263
|
+
opts
|
|
19264
|
+
);
|
|
19265
|
+
human("", opts);
|
|
19266
|
+
human(` Batch: ${data.run_batch_id}`, opts);
|
|
19267
|
+
human(` Results: ${absoluteUrl(data.deep_link)}`, opts);
|
|
19268
|
+
human("", opts);
|
|
19269
|
+
human(
|
|
19270
|
+
" Runs are served to the agent's eval runtime as it polls \u2014 results fill in over time.",
|
|
19271
|
+
opts
|
|
19272
|
+
);
|
|
19273
|
+
human("", opts);
|
|
19274
|
+
}
|
|
19275
|
+
async function runEvalAblate(options) {
|
|
19276
|
+
const opts = options;
|
|
19277
|
+
const session = await requireSession12(opts);
|
|
19278
|
+
let candidateBody;
|
|
19279
|
+
const bodyPath = resolve2(process.cwd(), options.body);
|
|
19280
|
+
try {
|
|
19281
|
+
candidateBody = await readFile9(bodyPath, "utf-8");
|
|
19282
|
+
} catch (err) {
|
|
19283
|
+
emitError(
|
|
19284
|
+
{
|
|
19285
|
+
code: "body_unreadable",
|
|
19286
|
+
message: `couldn't read the candidate body at ${bodyPath}: ${err.message}`,
|
|
19287
|
+
hint: "Pass --body <path> pointing at the candidate SKILL.md."
|
|
19288
|
+
},
|
|
19289
|
+
opts,
|
|
19290
|
+
1
|
|
19291
|
+
);
|
|
19292
|
+
return;
|
|
19293
|
+
}
|
|
19294
|
+
if (candidateBody.trim().length === 0) {
|
|
19295
|
+
emitError(
|
|
19296
|
+
{
|
|
19297
|
+
code: "body_empty",
|
|
19298
|
+
message: `${bodyPath} is empty \u2014 there's nothing to test.`
|
|
19299
|
+
},
|
|
19300
|
+
opts,
|
|
19301
|
+
1
|
|
19302
|
+
);
|
|
19303
|
+
return;
|
|
19304
|
+
}
|
|
19305
|
+
let data;
|
|
19306
|
+
try {
|
|
19307
|
+
data = await startAbTest(session, {
|
|
19308
|
+
agent_id: options.agent,
|
|
19309
|
+
skill_name: options.skill,
|
|
19310
|
+
hypothesis: options.hypothesis,
|
|
19311
|
+
candidate_body: candidateBody,
|
|
19312
|
+
...options.brand ? { brand_id: options.brand } : {}
|
|
19313
|
+
});
|
|
19314
|
+
} catch (err) {
|
|
19315
|
+
const e = err;
|
|
19316
|
+
emitError(
|
|
19317
|
+
{ code: e.errorCode ?? "ablate_failed", message: e.message },
|
|
19318
|
+
opts,
|
|
19319
|
+
1
|
|
19320
|
+
);
|
|
19321
|
+
return;
|
|
19322
|
+
}
|
|
19323
|
+
emitSuccess(data, opts, (d) => printStaged(d, opts));
|
|
19324
|
+
}
|
|
19325
|
+
var init_eval_ab2 = __esm({
|
|
19326
|
+
"src/commands/eval-ab.ts"() {
|
|
19327
|
+
"use strict";
|
|
19328
|
+
init_credentials();
|
|
19329
|
+
init_api();
|
|
19330
|
+
init_output();
|
|
19331
|
+
}
|
|
19332
|
+
});
|
|
19333
|
+
|
|
18931
19334
|
// node_modules/commander/esm.mjs
|
|
18932
19335
|
var import_index = __toESM(require_commander(), 1);
|
|
18933
19336
|
var {
|
|
@@ -19038,13 +19441,14 @@ function zodToJsonSchema(schema) {
|
|
|
19038
19441
|
async function loadOutputSchemas() {
|
|
19039
19442
|
const map = /* @__PURE__ */ new Map();
|
|
19040
19443
|
try {
|
|
19041
|
-
const [history, changes, knowledgeSlots, knowledgeSave, onboarding2, agents2] = await Promise.all([
|
|
19444
|
+
const [history, changes, knowledgeSlots, knowledgeSave, onboarding2, agents2, evalAb] = await Promise.all([
|
|
19042
19445
|
Promise.resolve().then(() => (init_history(), history_exports)).catch(() => null),
|
|
19043
19446
|
Promise.resolve().then(() => (init_changes(), changes_exports)).catch(() => null),
|
|
19044
19447
|
Promise.resolve().then(() => (init_knowledge_slots(), knowledge_slots_exports)).catch(() => null),
|
|
19045
19448
|
Promise.resolve().then(() => (init_knowledge_save(), knowledge_save_exports)).catch(() => null),
|
|
19046
19449
|
Promise.resolve().then(() => (init_onboarding_status(), onboarding_status_exports)).catch(() => null),
|
|
19047
|
-
Promise.resolve().then(() => (init_agents(), agents_exports)).catch(() => null)
|
|
19450
|
+
Promise.resolve().then(() => (init_agents(), agents_exports)).catch(() => null),
|
|
19451
|
+
Promise.resolve().then(() => (init_eval_ab(), eval_ab_exports)).catch(() => null)
|
|
19048
19452
|
]);
|
|
19049
19453
|
if (history?.HistoryResponseSchema) {
|
|
19050
19454
|
const s = zodToJsonSchema(history.HistoryResponseSchema);
|
|
@@ -19082,6 +19486,10 @@ async function loadOutputSchemas() {
|
|
|
19082
19486
|
const s = zodToJsonSchema(agents2.CliAgentPauseResponseSchema);
|
|
19083
19487
|
if (s) map.set("agents pause", s);
|
|
19084
19488
|
}
|
|
19489
|
+
if (evalAb?.EvalAbResponseSchema) {
|
|
19490
|
+
const s = zodToJsonSchema(evalAb.EvalAbResponseSchema);
|
|
19491
|
+
if (s) map.set("eval ablate", s);
|
|
19492
|
+
}
|
|
19085
19493
|
} catch {
|
|
19086
19494
|
}
|
|
19087
19495
|
return map;
|
|
@@ -19148,7 +19556,31 @@ function resolveIntrospection(rawArgs, operands) {
|
|
|
19148
19556
|
return null;
|
|
19149
19557
|
}
|
|
19150
19558
|
|
|
19559
|
+
// src/lib/misrouted-flags.ts
|
|
19560
|
+
var MISROUTED_FLAGS = /* @__PURE__ */ new Map([
|
|
19561
|
+
["--path", "knowledge save"],
|
|
19562
|
+
["--content", "knowledge save"],
|
|
19563
|
+
["--content-file", "knowledge save"],
|
|
19564
|
+
["--delete", "knowledge save"],
|
|
19565
|
+
["--intent", "knowledge save"]
|
|
19566
|
+
]);
|
|
19567
|
+
function detectMisroutedSaveFlag(rawArgs, operands) {
|
|
19568
|
+
if (operands[0] !== "save") return null;
|
|
19569
|
+
for (const arg of rawArgs) {
|
|
19570
|
+
const flag = arg.split("=", 1)[0];
|
|
19571
|
+
const target = MISROUTED_FLAGS.get(flag);
|
|
19572
|
+
if (!target) continue;
|
|
19573
|
+
return {
|
|
19574
|
+
code: "wrong_save_verb",
|
|
19575
|
+
message: `\`bamboo save\` does not accept ${flag}.`,
|
|
19576
|
+
hint: `\`save\` commits the whole working tree and takes the intent as a positional argument: \`bamboo save "<intent>"\`. To write one file by path, use \`bamboo ${target} ${flag} \u2026\` (see \`bamboo --schema ${target}\`).`
|
|
19577
|
+
};
|
|
19578
|
+
}
|
|
19579
|
+
return null;
|
|
19580
|
+
}
|
|
19581
|
+
|
|
19151
19582
|
// src/index.ts
|
|
19583
|
+
init_output();
|
|
19152
19584
|
var program2 = new Command();
|
|
19153
19585
|
program2.name("bamboo-agents").description("Set up your local Bamboo workspace and drop into Claude.").version(VERSION).option("--no-sync", "Skip the auto-sync git pull on this command").option("--describe", "Emit full JSON manifest of every CLI command (machine introspection)").option("--schema <command>", "Emit JSON schema for one command by name, e.g. 'history' or 'knowledge save'");
|
|
19154
19586
|
program2.action(async () => {
|
|
@@ -19271,6 +19703,12 @@ context.command("health").description("Knowledge/context health \u2014 grade, sc
|
|
|
19271
19703
|
const { runContextHealth: runContextHealth2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
19272
19704
|
await runContextHealth2(options);
|
|
19273
19705
|
});
|
|
19706
|
+
program2.command("usage").description("Agent usage \u2014 sessions, per-tool call counts, first/last seen (from agent_logs)").option("--agent <id>", "Scope to an agent_id (default: org-wide)").option("--window-days <n>", "Trailing window in days (default: 14, max: 90)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(
|
|
19707
|
+
async (options) => {
|
|
19708
|
+
const { runUsage: runUsage2 } = await Promise.resolve().then(() => (init_usage2(), usage_exports));
|
|
19709
|
+
await runUsage2(options);
|
|
19710
|
+
}
|
|
19711
|
+
);
|
|
19274
19712
|
var onboarding = program2.command("onboarding").description("Onboarding status for CLI-first skills");
|
|
19275
19713
|
onboarding.command("status").description("Composite onboarding gate (activation milestones + knowledge health)").option("--brand <id>", "Scope to a brand_id (default: org)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (options) => {
|
|
19276
19714
|
const { runOnboardingStatus: runOnboardingStatus2 } = await Promise.resolve().then(() => (init_onboarding(), onboarding_exports));
|
|
@@ -19354,20 +19792,33 @@ episode.command("log-rec").description(
|
|
|
19354
19792
|
const { runEpisodeLogRec: runEpisodeLogRec2 } = await Promise.resolve().then(() => (init_episode(), episode_exports));
|
|
19355
19793
|
await runEpisodeLogRec2(options);
|
|
19356
19794
|
});
|
|
19795
|
+
var evals = program2.command("eval").description("Evaluation surface \u2014 A/B a candidate skill against its baseline");
|
|
19796
|
+
evals.command("ablate").description(
|
|
19797
|
+
"Start an A/B test: stage a candidate skill body against the published baseline"
|
|
19798
|
+
).requiredOption("--agent <id>", "Agent id whose skill is under test").requiredOption("--skill <name>", "kebab-case skill name (must be one of this agent's own skills)").requiredOption(
|
|
19799
|
+
"--hypothesis <text>",
|
|
19800
|
+
"Plain-language claim the edit is meant to produce (an experiment is a claim, not a diff)"
|
|
19801
|
+
).requiredOption("--body <path>", "Path to the candidate SKILL.md").option("--brand <id>", "Brand id \u2014 only needed when the agent spans more than one brand").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(
|
|
19802
|
+
async (options) => {
|
|
19803
|
+
const { runEvalAblate: runEvalAblate2 } = await Promise.resolve().then(() => (init_eval_ab2(), eval_ab_exports2));
|
|
19804
|
+
await runEvalAblate2(options);
|
|
19805
|
+
}
|
|
19806
|
+
);
|
|
19357
19807
|
(async () => {
|
|
19358
19808
|
const rawArgs = process.argv.slice(2);
|
|
19359
19809
|
const { operands } = program2.parseOptions(rawArgs);
|
|
19360
19810
|
const introspection = resolveIntrospection(rawArgs, operands);
|
|
19361
19811
|
if (introspection?.mode === "describe") {
|
|
19362
19812
|
const manifest = await buildManifest(program2, VERSION);
|
|
19363
|
-
process.stdout.write(JSON.stringify(manifest, null, 2) + "\n");
|
|
19364
|
-
|
|
19813
|
+
process.stdout.write(JSON.stringify(manifest, null, 2) + "\n", () => process.exit(0));
|
|
19814
|
+
return;
|
|
19365
19815
|
}
|
|
19366
19816
|
if (introspection?.mode === "schema-missing") {
|
|
19367
19817
|
process.stderr.write(
|
|
19368
|
-
"bamboo-agents: --schema requires a command name, e.g. --schema history\n"
|
|
19818
|
+
"bamboo-agents: --schema requires a command name, e.g. --schema history\n",
|
|
19819
|
+
() => process.exit(1)
|
|
19369
19820
|
);
|
|
19370
|
-
|
|
19821
|
+
return;
|
|
19371
19822
|
}
|
|
19372
19823
|
if (introspection?.mode === "schema") {
|
|
19373
19824
|
const entry = await buildCommandSchema(
|
|
@@ -19378,12 +19829,17 @@ episode.command("log-rec").description(
|
|
|
19378
19829
|
if (entry === null) {
|
|
19379
19830
|
process.stderr.write(
|
|
19380
19831
|
`bamboo-agents: unknown command '${introspection.command}'. Run --describe for the full list.
|
|
19381
|
-
|
|
19832
|
+
`,
|
|
19833
|
+
() => process.exit(1)
|
|
19382
19834
|
);
|
|
19383
|
-
|
|
19835
|
+
return;
|
|
19384
19836
|
}
|
|
19385
|
-
process.stdout.write(JSON.stringify(entry, null, 2) + "\n");
|
|
19386
|
-
|
|
19837
|
+
process.stdout.write(JSON.stringify(entry, null, 2) + "\n", () => process.exit(0));
|
|
19838
|
+
return;
|
|
19839
|
+
}
|
|
19840
|
+
const misrouted = detectMisroutedSaveFlag(rawArgs, operands);
|
|
19841
|
+
if (misrouted) {
|
|
19842
|
+
emitError(misrouted, { json: rawArgs.includes("--json"), quiet: rawArgs.includes("--quiet") }, 1);
|
|
19387
19843
|
}
|
|
19388
19844
|
await program2.parseAsync(process.argv);
|
|
19389
19845
|
})().catch((err) => {
|