bamboo-agents 0.1.6-dev.80.3b0f3f6 → 0.1.6-dev.82.ffce4c6
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/VERSION +1 -1
- package/dist/index.js +184 -2
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.6-dev.
|
|
1
|
+
0.1.6-dev.82.ffce4c6
|
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.6-dev.
|
|
3040
|
+
VERSION = "0.1.6-dev.82.ffce4c6";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -13015,7 +13015,7 @@ var init_evidence_kinds = __esm({
|
|
|
13015
13015
|
});
|
|
13016
13016
|
|
|
13017
13017
|
// ../../src/lib/api-contracts/cli/eval-test-sets.ts
|
|
13018
|
-
var CliEvalTestSetCreateRequestSchema, CliEvalTestSetCreateResponseSchema;
|
|
13018
|
+
var CliEvalTestSetCreateRequestSchema, CliEvalTestSetCreateResponseSchema, CliRoadmapSetMembershipSchema, CliRoadmapMembershipResponseSchema, CliEvalTestSetCasesRequestSchema;
|
|
13019
13019
|
var init_eval_test_sets = __esm({
|
|
13020
13020
|
"../../src/lib/api-contracts/cli/eval-test-sets.ts"() {
|
|
13021
13021
|
init_zod();
|
|
@@ -13047,6 +13047,17 @@ var init_eval_test_sets = __esm({
|
|
|
13047
13047
|
priority: external_exports.number().int(),
|
|
13048
13048
|
hypothesis: external_exports.string().nullable()
|
|
13049
13049
|
});
|
|
13050
|
+
CliRoadmapSetMembershipSchema = external_exports.object({
|
|
13051
|
+
id: external_exports.string().uuid(),
|
|
13052
|
+
cases: external_exports.array(external_exports.object({ id: external_exports.string().uuid() })).default([])
|
|
13053
|
+
});
|
|
13054
|
+
CliRoadmapMembershipResponseSchema = external_exports.array(
|
|
13055
|
+
CliRoadmapSetMembershipSchema
|
|
13056
|
+
);
|
|
13057
|
+
CliEvalTestSetCasesRequestSchema = external_exports.object({
|
|
13058
|
+
brand_id: external_exports.string().uuid(),
|
|
13059
|
+
case_ids: external_exports.array(external_exports.string().uuid())
|
|
13060
|
+
});
|
|
13050
13061
|
}
|
|
13051
13062
|
});
|
|
13052
13063
|
|
|
@@ -13577,6 +13588,29 @@ async function createEvalTestSet(bambooSession, body) {
|
|
|
13577
13588
|
const json = await res.json();
|
|
13578
13589
|
return CliEvalTestSetCreateResponseSchema.parse(json.data);
|
|
13579
13590
|
}
|
|
13591
|
+
async function getEvalTestSetMemberships(bambooSession, brandId) {
|
|
13592
|
+
const url = `${apiBase()}/api/v1/eval/test-roadmap?brand_id=${encodeURIComponent(brandId)}`;
|
|
13593
|
+
const res = await cliApiFetch(url, {
|
|
13594
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
13595
|
+
});
|
|
13596
|
+
if (!res.ok) throw await parseError(res);
|
|
13597
|
+
const json = await res.json();
|
|
13598
|
+
return CliRoadmapMembershipResponseSchema.parse(json.data ?? []);
|
|
13599
|
+
}
|
|
13600
|
+
async function updateEvalTestSetCases(bambooSession, setId, body) {
|
|
13601
|
+
const res = await cliApiFetch(
|
|
13602
|
+
`${apiBase()}/api/v1/eval/test-sets/${encodeURIComponent(setId)}`,
|
|
13603
|
+
{
|
|
13604
|
+
method: "PATCH",
|
|
13605
|
+
headers: {
|
|
13606
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
13607
|
+
"Content-Type": "application/json"
|
|
13608
|
+
},
|
|
13609
|
+
body: JSON.stringify(body)
|
|
13610
|
+
}
|
|
13611
|
+
);
|
|
13612
|
+
if (!res.ok) throw await parseError(res);
|
|
13613
|
+
}
|
|
13580
13614
|
function absoluteUrl(relativePath) {
|
|
13581
13615
|
return `${apiBase()}${relativePath}`;
|
|
13582
13616
|
}
|
|
@@ -19515,6 +19549,145 @@ var init_eval_test_sets2 = __esm({
|
|
|
19515
19549
|
}
|
|
19516
19550
|
});
|
|
19517
19551
|
|
|
19552
|
+
// src/commands/eval-set-cases.ts
|
|
19553
|
+
var eval_set_cases_exports = {};
|
|
19554
|
+
__export(eval_set_cases_exports, {
|
|
19555
|
+
parseCaseIds: () => parseCaseIds,
|
|
19556
|
+
runEvalSetsAddCases: () => runEvalSetsAddCases,
|
|
19557
|
+
unionCaseIds: () => unionCaseIds
|
|
19558
|
+
});
|
|
19559
|
+
async function requireSession14(opts) {
|
|
19560
|
+
const creds = await readCredentials();
|
|
19561
|
+
if (!creds) {
|
|
19562
|
+
emitError(
|
|
19563
|
+
{
|
|
19564
|
+
code: "not_signed_in",
|
|
19565
|
+
message: "not signed in.",
|
|
19566
|
+
hint: "Run `bamboo-agents login` first."
|
|
19567
|
+
},
|
|
19568
|
+
opts,
|
|
19569
|
+
1
|
|
19570
|
+
);
|
|
19571
|
+
throw new Error("unreachable");
|
|
19572
|
+
}
|
|
19573
|
+
return creds.bamboo_session;
|
|
19574
|
+
}
|
|
19575
|
+
function parseCaseIds(raw) {
|
|
19576
|
+
return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
|
|
19577
|
+
}
|
|
19578
|
+
function unionCaseIds(existing, incoming) {
|
|
19579
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19580
|
+
const out = [];
|
|
19581
|
+
for (const id of [...existing, ...incoming]) {
|
|
19582
|
+
if (seen.has(id)) continue;
|
|
19583
|
+
seen.add(id);
|
|
19584
|
+
out.push(id);
|
|
19585
|
+
}
|
|
19586
|
+
return out;
|
|
19587
|
+
}
|
|
19588
|
+
async function runEvalSetsAddCases(options) {
|
|
19589
|
+
const opts = options;
|
|
19590
|
+
const session = await requireSession14(opts);
|
|
19591
|
+
const incoming = parseCaseIds(options.cases);
|
|
19592
|
+
if (incoming.length === 0) {
|
|
19593
|
+
emitError(
|
|
19594
|
+
{ code: "no_cases", message: "--cases was empty \u2014 nothing to attach." },
|
|
19595
|
+
opts,
|
|
19596
|
+
1
|
|
19597
|
+
);
|
|
19598
|
+
throw new Error("unreachable");
|
|
19599
|
+
}
|
|
19600
|
+
const brandId = await resolveBrandId(
|
|
19601
|
+
session,
|
|
19602
|
+
options.brand,
|
|
19603
|
+
opts,
|
|
19604
|
+
"Specify the brand the test set belongs to with --brand <id>."
|
|
19605
|
+
);
|
|
19606
|
+
let finalIds;
|
|
19607
|
+
let existingCount = 0;
|
|
19608
|
+
if (options.replace) {
|
|
19609
|
+
finalIds = unionCaseIds([], incoming);
|
|
19610
|
+
} else {
|
|
19611
|
+
let sets;
|
|
19612
|
+
try {
|
|
19613
|
+
sets = await getEvalTestSetMemberships(session, brandId);
|
|
19614
|
+
} catch (err) {
|
|
19615
|
+
const e = err;
|
|
19616
|
+
emitError(
|
|
19617
|
+
{
|
|
19618
|
+
code: e.code ?? "roadmap_read_failed",
|
|
19619
|
+
message: `couldn't read the set's current cases: ${e.message ?? "unknown error"}`,
|
|
19620
|
+
hint: "Pass --replace to write the list without reading first."
|
|
19621
|
+
},
|
|
19622
|
+
opts,
|
|
19623
|
+
1
|
|
19624
|
+
);
|
|
19625
|
+
throw new Error("unreachable");
|
|
19626
|
+
}
|
|
19627
|
+
const target = sets.find((s) => s.id === options.set);
|
|
19628
|
+
if (!target) {
|
|
19629
|
+
emitError(
|
|
19630
|
+
{
|
|
19631
|
+
code: "set_not_found",
|
|
19632
|
+
message: `no test set ${options.set} in brand ${brandId}.`,
|
|
19633
|
+
hint: "Check the set id, or pass --brand if the set is in another brand."
|
|
19634
|
+
},
|
|
19635
|
+
opts,
|
|
19636
|
+
1
|
|
19637
|
+
);
|
|
19638
|
+
throw new Error("unreachable");
|
|
19639
|
+
}
|
|
19640
|
+
const existing = target.cases.map((c) => c.id);
|
|
19641
|
+
existingCount = existing.length;
|
|
19642
|
+
finalIds = unionCaseIds(existing, incoming);
|
|
19643
|
+
}
|
|
19644
|
+
try {
|
|
19645
|
+
await updateEvalTestSetCases(session, options.set, {
|
|
19646
|
+
brand_id: brandId,
|
|
19647
|
+
case_ids: finalIds
|
|
19648
|
+
});
|
|
19649
|
+
} catch (err) {
|
|
19650
|
+
const e = err;
|
|
19651
|
+
emitError(
|
|
19652
|
+
{
|
|
19653
|
+
code: e.code ?? "attach_failed",
|
|
19654
|
+
message: e.message ?? "failed to attach the cases."
|
|
19655
|
+
},
|
|
19656
|
+
opts,
|
|
19657
|
+
1
|
|
19658
|
+
);
|
|
19659
|
+
throw new Error("unreachable");
|
|
19660
|
+
}
|
|
19661
|
+
const added = finalIds.length - existingCount;
|
|
19662
|
+
human("", opts);
|
|
19663
|
+
if (options.replace) {
|
|
19664
|
+
human(` Set ${options.set} now holds exactly ${finalIds.length} cases.`, opts);
|
|
19665
|
+
} else {
|
|
19666
|
+
human(
|
|
19667
|
+
` Added ${added} of ${incoming.length} to ${options.set} \u2014 ${finalIds.length} cases total.`,
|
|
19668
|
+
opts
|
|
19669
|
+
);
|
|
19670
|
+
const skipped = incoming.length - added;
|
|
19671
|
+
if (skipped > 0) {
|
|
19672
|
+
human(` ${skipped} ${skipped === 1 ? "was" : "were"} already in the set.`, opts);
|
|
19673
|
+
}
|
|
19674
|
+
}
|
|
19675
|
+
human("", opts);
|
|
19676
|
+
emitSuccess(
|
|
19677
|
+
{ set_id: options.set, case_ids: finalIds, total: finalIds.length, added },
|
|
19678
|
+
opts
|
|
19679
|
+
);
|
|
19680
|
+
}
|
|
19681
|
+
var init_eval_set_cases = __esm({
|
|
19682
|
+
"src/commands/eval-set-cases.ts"() {
|
|
19683
|
+
"use strict";
|
|
19684
|
+
init_credentials();
|
|
19685
|
+
init_api();
|
|
19686
|
+
init_resolve_brand();
|
|
19687
|
+
init_output();
|
|
19688
|
+
}
|
|
19689
|
+
});
|
|
19690
|
+
|
|
19518
19691
|
// node_modules/commander/esm.mjs
|
|
19519
19692
|
var import_index = __toESM(require_commander(), 1);
|
|
19520
19693
|
var {
|
|
@@ -20001,6 +20174,15 @@ evalSets.command("create").description("Create an empty test set of a given evid
|
|
|
20001
20174
|
await runEvalSetsCreate2(options);
|
|
20002
20175
|
}
|
|
20003
20176
|
);
|
|
20177
|
+
evalSets.command("add-cases").description("Attach existing cases to a test set (adds by default; --replace overwrites)").requiredOption("--set <id>", "Test set id").requiredOption("--cases <ids>", "Comma-separated eval case ids").option(
|
|
20178
|
+
"--replace",
|
|
20179
|
+
"Send exactly these cases, dropping any others. Without it, the current cases are read and merged"
|
|
20180
|
+
).option("--brand <id>", "Brand id \u2014 only needed when the org has 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(
|
|
20181
|
+
async (options) => {
|
|
20182
|
+
const { runEvalSetsAddCases: runEvalSetsAddCases2 } = await Promise.resolve().then(() => (init_eval_set_cases(), eval_set_cases_exports));
|
|
20183
|
+
await runEvalSetsAddCases2(options);
|
|
20184
|
+
}
|
|
20185
|
+
);
|
|
20004
20186
|
(async () => {
|
|
20005
20187
|
const rawArgs = process.argv.slice(2);
|
|
20006
20188
|
const { operands } = program2.parseOptions(rawArgs);
|