bamboo-agents 0.1.5-dev.26 → 0.1.5-dev.28

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 CHANGED
@@ -1 +1 @@
1
- 0.1.5-dev.26
1
+ 0.1.5-dev.28
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.26";
3040
+ VERSION = "0.1.5-dev.28";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -11536,7 +11536,14 @@ var init_agent_health = __esm({
11536
11536
  max: external_exports.number(),
11537
11537
  /** Slot key of the highest-impact unfilled dimension. Null when
11538
11538
  * every weighted slot is filled (agent is fully scored). */
11539
- top_gap_slot: external_exports.string().nullable()
11539
+ top_gap_slot: external_exports.string().nullable(),
11540
+ /**
11541
+ * ISO-8601 timestamp of when the underlying skill run produced this
11542
+ * score (BAM-2289 P3). Optional for backwards compat with CLI bundles
11543
+ * shipped before the cache layer existed — newer bundles use it to
11544
+ * render "evaluated 12m ago" in the picker. Older bundles ignore it.
11545
+ */
11546
+ evaluated_at: external_exports.string().optional()
11540
11547
  }).nullable();
11541
11548
  }
11542
11549
  });
@@ -11582,15 +11589,7 @@ var init_agents = __esm({
11582
11589
  name: external_exports.string(),
11583
11590
  /** `false` = user-created (eligible for picker choices).
11584
11591
  * `true` = pre-installed (MAM etc.) — shown informational-only. */
11585
- is_auto_installed: external_exports.boolean(),
11586
- /**
11587
- * 0..100 weighted health score (round at render time). Null when
11588
- * the server omits the value (BAM-2246 omits today because per-agent
11589
- * health is an N round-trip fan-out; CLI fetches lazily via
11590
- * `/api/v1/agents/<id>/health`). Also null for legacy agents
11591
- * without an effective_rubric (pre-BAM-2084 installs).
11592
- */
11593
- health_score: external_exports.number().nullable()
11592
+ is_auto_installed: external_exports.boolean()
11594
11593
  });
11595
11594
  CliTierCapSchema = external_exports.object({
11596
11595
  limit: external_exports.number().int(),
@@ -12785,8 +12784,8 @@ var init_prompt = __esm({
12785
12784
  });
12786
12785
 
12787
12786
  // src/lib/phases-impl/pick-first-user-agent-phase.ts
12788
- import { readFile as readFile3 } from "node:fs/promises";
12789
- import { resolve as pathResolve3 } from "node:path";
12787
+ import { readFile as readFile3, stat } from "node:fs/promises";
12788
+ import { join as pathJoin, resolve as pathResolve3 } from "node:path";
12790
12789
  async function runCaseA(ctx) {
12791
12790
  console.log(" Let's set up YOUR first agent. How would you like to start?");
12792
12791
  console.log("");
@@ -12797,7 +12796,7 @@ async function runCaseA(ctx) {
12797
12796
  if (choice === null) return null;
12798
12797
  return choice === "1" ? runCreateFlow(ctx) : runUploadFlow(ctx);
12799
12798
  }
12800
- async function runCaseB(ctx, agents) {
12799
+ async function runCaseB(ctx, agents, healthByAgentId) {
12801
12800
  console.log(
12802
12801
  ` You have ${agents.length} user-created ${pluralize(
12803
12802
  agents.length,
@@ -12805,7 +12804,9 @@ async function runCaseB(ctx, agents) {
12805
12804
  )} so far:`
12806
12805
  );
12807
12806
  for (const a of agents) {
12808
- console.log(` \u2022 ${a.name} \u2014 ${formatHealth(a.health_score)}`);
12807
+ console.log(
12808
+ ` \u2022 ${a.name} \u2014 ${formatHealth(healthByAgentId.get(a.id) ?? null)}`
12809
+ );
12809
12810
  }
12810
12811
  console.log("");
12811
12812
  console.log(" What's next?");
@@ -12822,13 +12823,15 @@ async function runCaseB(ctx, agents) {
12822
12823
  if (choice === "2") return runUploadFlow(ctx);
12823
12824
  return runImproveExistingFlow(agents);
12824
12825
  }
12825
- async function runCaseC(agents) {
12826
+ async function runCaseC(agents, healthByAgentId) {
12826
12827
  console.log(
12827
12828
  ` You're at your tier's agent cap (${agents.length}/${agents.length}). Pick one to improve:`
12828
12829
  );
12829
12830
  console.log("");
12830
12831
  agents.forEach((a, idx) => {
12831
- console.log(` ${idx + 1}) ${a.name} \u2014 ${formatHealth(a.health_score)}`);
12832
+ console.log(
12833
+ ` ${idx + 1}) ${a.name} \u2014 ${formatHealth(healthByAgentId.get(a.id) ?? null)}`
12834
+ );
12832
12835
  });
12833
12836
  console.log("");
12834
12837
  console.log(` (To add more agents, upgrade your plan at ${BILLING_URL})`);
@@ -12877,7 +12880,34 @@ async function runUploadFlow(ctx) {
12877
12880
  ` Path to the CLAUDE.md/AGENTS.md file (default: ${defaultsHint}): `
12878
12881
  );
12879
12882
  const filePath = filePathInput ?? UPLOAD_DEFAULT_PATHS[0];
12880
- const absPath = pathResolve3(ctx.cwd, filePath);
12883
+ const requestedPath = pathResolve3(ctx.cwd, filePath);
12884
+ let absPath = requestedPath;
12885
+ try {
12886
+ const s = await stat(requestedPath);
12887
+ if (s.isDirectory()) {
12888
+ let resolved = null;
12889
+ for (const name2 of UPLOAD_DEFAULT_PATHS) {
12890
+ const candidate = pathJoin(requestedPath, name2);
12891
+ try {
12892
+ const cs = await stat(candidate);
12893
+ if (cs.isFile()) {
12894
+ resolved = candidate;
12895
+ break;
12896
+ }
12897
+ } catch {
12898
+ }
12899
+ }
12900
+ if (!resolved) {
12901
+ console.log("");
12902
+ console.log(
12903
+ ` ${requestedPath} is a directory and doesn't contain a ${UPLOAD_DEFAULT_PATHS.join(" or ")}.`
12904
+ );
12905
+ return null;
12906
+ }
12907
+ absPath = resolved;
12908
+ }
12909
+ } catch {
12910
+ }
12881
12911
  let content;
12882
12912
  try {
12883
12913
  content = await readFile3(absPath, "utf8");
@@ -13060,6 +13090,20 @@ var init_pick_first_user_agent_phase = __esm({
13060
13090
  const preInstalled = listing.agents.filter((a) => a.is_auto_installed);
13061
13091
  const cap = listing.tier_cap;
13062
13092
  const atCap = cap.limit > -1 && cap.current >= cap.limit;
13093
+ const healthByAgentId = /* @__PURE__ */ new Map();
13094
+ await Promise.all(
13095
+ userCreated.map(async (a) => {
13096
+ try {
13097
+ const h = await getAgentHealth(
13098
+ ctx.credentials.bamboo_session,
13099
+ a.id
13100
+ );
13101
+ healthByAgentId.set(a.id, h?.score ?? null);
13102
+ } catch {
13103
+ healthByAgentId.set(a.id, null);
13104
+ }
13105
+ })
13106
+ );
13063
13107
  console.log("");
13064
13108
  if (preInstalled.length > 0) {
13065
13109
  console.log(
@@ -13074,9 +13118,9 @@ var init_pick_first_user_agent_phase = __esm({
13074
13118
  if (userCreated.length === 0) {
13075
13119
  pickedAgentId = await runCaseA(ctx);
13076
13120
  } else if (atCap) {
13077
- pickedAgentId = await runCaseC(userCreated);
13121
+ pickedAgentId = await runCaseC(userCreated, healthByAgentId);
13078
13122
  } else {
13079
- pickedAgentId = await runCaseB(ctx, userCreated);
13123
+ pickedAgentId = await runCaseB(ctx, userCreated, healthByAgentId);
13080
13124
  }
13081
13125
  if (!pickedAgentId) {
13082
13126
  return {