bamboo-agents 0.1.5-dev.21 → 0.1.5-dev.22

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.21
1
+ 0.1.5-dev.22
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.21";
3040
+ VERSION = "0.1.5-dev.22";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -11522,6 +11522,24 @@ var init_billing_status = __esm({
11522
11522
  }
11523
11523
  });
11524
11524
 
11525
+ // ../../src/lib/api-contracts/cli/agent-health.ts
11526
+ var AgentHealthResponseSchema;
11527
+ var init_agent_health = __esm({
11528
+ "../../src/lib/api-contracts/cli/agent-health.ts"() {
11529
+ init_zod();
11530
+ AgentHealthResponseSchema = external_exports.object({
11531
+ /** Overall 0..100 weighted score from `computeAgentHealth`. */
11532
+ score: external_exports.number(),
11533
+ /** Always 100 today — pinned so the CLI can render "X / Y" without
11534
+ * hard-coding the denominator if we ever shift the scale. */
11535
+ max: external_exports.number(),
11536
+ /** Slot key of the highest-impact unfilled dimension. Null when
11537
+ * every weighted slot is filled (agent is fully scored). */
11538
+ top_gap_slot: external_exports.string().nullable()
11539
+ }).nullable();
11540
+ }
11541
+ });
11542
+
11525
11543
  // src/lib/api.ts
11526
11544
  import { platform as platform2 } from "node:os";
11527
11545
  function defaultApiBase(version) {
@@ -11599,7 +11617,29 @@ async function provisionWorkspace(bambooSession) {
11599
11617
  const json = await res.json();
11600
11618
  return ProvisionWorkspaceResponseSchema.parse(json);
11601
11619
  }
11602
- var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema;
11620
+ async function getFirstAutoInstalledAgent(bambooSession) {
11621
+ const res = await cliApiFetch(
11622
+ `${apiBase()}/api/v1/agents/first-auto-installed`,
11623
+ {
11624
+ headers: { Authorization: `Bearer ${bambooSession}` }
11625
+ }
11626
+ );
11627
+ if (!res.ok) throw await parseError(res);
11628
+ const json = await res.json();
11629
+ return FirstAutoInstalledAgentResponseSchema.parse(json).agent_id;
11630
+ }
11631
+ async function getAgentHealth(bambooSession, agentId) {
11632
+ const res = await cliApiFetch(
11633
+ `${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/health`,
11634
+ {
11635
+ headers: { Authorization: `Bearer ${bambooSession}` }
11636
+ }
11637
+ );
11638
+ if (!res.ok) throw await parseError(res);
11639
+ const json = await res.json();
11640
+ return AgentHealthResponseSchema.parse(json);
11641
+ }
11642
+ var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema;
11603
11643
  var init_api = __esm({
11604
11644
  "src/lib/api.ts"() {
11605
11645
  "use strict";
@@ -11607,6 +11647,7 @@ var init_api = __esm({
11607
11647
  init_auth_token();
11608
11648
  init_auth_status();
11609
11649
  init_billing_status();
11650
+ init_agent_health();
11610
11651
  init_version();
11611
11652
  PROD_DEFAULT_BASE = "https://withbamboo.com";
11612
11653
  DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
@@ -11625,6 +11666,9 @@ var init_api = __esm({
11625
11666
  ProvisionWorkspaceResponseSchema = external_exports.object({
11626
11667
  workspace_repo: external_exports.string()
11627
11668
  });
11669
+ FirstAutoInstalledAgentResponseSchema = external_exports.object({
11670
+ agent_id: external_exports.string().nullable()
11671
+ });
11628
11672
  }
11629
11673
  });
11630
11674
 
@@ -12619,6 +12663,35 @@ var init_open_phase = __esm({
12619
12663
  }
12620
12664
  });
12621
12665
 
12666
+ // src/lib/orchestrator-steps/health-line.ts
12667
+ async function printHealthLine(ctx) {
12668
+ try {
12669
+ if (!ctx.credentials?.bamboo_session) return;
12670
+ const agentId = await getFirstAutoInstalledAgent(
12671
+ ctx.credentials.bamboo_session
12672
+ );
12673
+ if (!agentId) return;
12674
+ const health = await getAgentHealth(
12675
+ ctx.credentials.bamboo_session,
12676
+ agentId
12677
+ );
12678
+ if (!health) return;
12679
+ const score = Math.round(health.score);
12680
+ const max = health.max;
12681
+ const gap = health.top_gap_slot;
12682
+ const line = gap ? ` Health: ${score} / ${max} \u2014 top gap: ${gap}` : ` Health: ${score} / ${max}`;
12683
+ console.log("");
12684
+ console.log(line);
12685
+ } catch {
12686
+ }
12687
+ }
12688
+ var init_health_line = __esm({
12689
+ "src/lib/orchestrator-steps/health-line.ts"() {
12690
+ "use strict";
12691
+ init_api();
12692
+ }
12693
+ });
12694
+
12622
12695
  // src/commands/orchestrator.ts
12623
12696
  var orchestrator_exports = {};
12624
12697
  __export(orchestrator_exports, {
@@ -12692,6 +12765,9 @@ async function runOrchestrator() {
12692
12765
  }
12693
12766
  if (probe.status === "done") {
12694
12767
  console.log(` \u2713 ${probe.summary}`);
12768
+ if (phase.name === cloneOrAdoptSpec.name) {
12769
+ await printHealthLine(ctx);
12770
+ }
12695
12771
  continue;
12696
12772
  }
12697
12773
  const result = await phase.execute(ctx);
@@ -12699,6 +12775,9 @@ async function runOrchestrator() {
12699
12775
  printNeedsAction(result.reason);
12700
12776
  process.exit(2);
12701
12777
  }
12778
+ if (phase.name === cloneOrAdoptSpec.name) {
12779
+ await printHealthLine(ctx);
12780
+ }
12702
12781
  }
12703
12782
  }
12704
12783
  var PHASES;
@@ -12711,6 +12790,7 @@ var init_orchestrator = __esm({
12711
12790
  init_provision_phase();
12712
12791
  init_clone_or_adopt_phase();
12713
12792
  init_open_phase();
12793
+ init_health_line();
12714
12794
  PHASES = [
12715
12795
  loginSpec,
12716
12796
  provisionSpec,