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

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.25
1
+ 0.1.5-dev.26
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.25";
3040
+ VERSION = "0.1.5-dev.26";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -11542,10 +11542,13 @@ var init_agent_health = __esm({
11542
11542
  });
11543
11543
 
11544
11544
  // ../../src/lib/api-contracts/cli/onboarding-next-prompt.ts
11545
- var OnboardingNextPromptResponseSchema;
11545
+ var OnboardingNextPromptRequestSchema, OnboardingNextPromptResponseSchema;
11546
11546
  var init_onboarding_next_prompt = __esm({
11547
11547
  "../../src/lib/api-contracts/cli/onboarding-next-prompt.ts"() {
11548
11548
  init_zod();
11549
+ OnboardingNextPromptRequestSchema = external_exports.object({
11550
+ agent_id: external_exports.string().uuid()
11551
+ });
11549
11552
  OnboardingNextPromptResponseSchema = external_exports.object({
11550
11553
  /** Checklist item key from `compute_onboarding_status.next_best_step.key`.
11551
11554
  * Empty string when there's no next step at all. */
@@ -11717,17 +11720,6 @@ async function provisionWorkspace(bambooSession) {
11717
11720
  const json = await res.json();
11718
11721
  return ProvisionWorkspaceResponseSchema.parse(json);
11719
11722
  }
11720
- async function getFirstAutoInstalledAgent(bambooSession) {
11721
- const res = await cliApiFetch(
11722
- `${apiBase()}/api/v1/agents/first-auto-installed`,
11723
- {
11724
- headers: { Authorization: `Bearer ${bambooSession}` }
11725
- }
11726
- );
11727
- if (!res.ok) throw await parseError(res);
11728
- const json = await res.json();
11729
- return FirstAutoInstalledAgentResponseSchema.parse(json).agent_id;
11730
- }
11731
11723
  async function getAgentHealth(bambooSession, agentId) {
11732
11724
  const res = await cliApiFetch(
11733
11725
  `${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/health`,
@@ -11739,13 +11731,12 @@ async function getAgentHealth(bambooSession, agentId) {
11739
11731
  const json = await res.json();
11740
11732
  return AgentHealthResponseSchema.parse(json);
11741
11733
  }
11742
- async function getOnboardingNextPrompt(bambooSession) {
11743
- const res = await cliApiFetch(
11744
- `${apiBase()}/api/v1/cli/onboarding/next-prompt`,
11745
- {
11746
- headers: { Authorization: `Bearer ${bambooSession}` }
11747
- }
11748
- );
11734
+ async function getOnboardingNextPrompt(bambooSession, agentId) {
11735
+ const url = new URL(`${apiBase()}/api/v1/cli/onboarding/next-prompt`);
11736
+ url.searchParams.set("agent_id", agentId);
11737
+ const res = await cliApiFetch(url.toString(), {
11738
+ headers: { Authorization: `Bearer ${bambooSession}` }
11739
+ });
11749
11740
  if (!res.ok) throw await parseError(res);
11750
11741
  const json = await res.json();
11751
11742
  return OnboardingNextPromptResponseSchema.parse(json);
@@ -13120,8 +13111,18 @@ var init_magic_moment_phase = __esm({
13120
13111
  reason: "Run `bamboo-agents login` first."
13121
13112
  };
13122
13113
  }
13114
+ if (!ctx.agentId) {
13115
+ return {
13116
+ status: "needs_action",
13117
+ summary: "(no agent picked)",
13118
+ reason: "Internal: magic-moment ran before pick-first-user-agent populated ctx.agentId."
13119
+ };
13120
+ }
13123
13121
  try {
13124
- const next = await getOnboardingNextPrompt(ctx.credentials.bamboo_session);
13122
+ const next = await getOnboardingNextPrompt(
13123
+ ctx.credentials.bamboo_session,
13124
+ ctx.agentId
13125
+ );
13125
13126
  if (next.key !== "knowledge" || !next.prompt || !next.save_path) {
13126
13127
  return { status: "done", summary: "no question to ask" };
13127
13128
  }
@@ -13293,13 +13294,10 @@ var init_open_phase = __esm({
13293
13294
  async function printHealthLine(ctx) {
13294
13295
  try {
13295
13296
  if (!ctx.credentials?.bamboo_session) return;
13296
- const agentId = await getFirstAutoInstalledAgent(
13297
- ctx.credentials.bamboo_session
13298
- );
13299
- if (!agentId) return;
13297
+ if (!ctx.agentId) return;
13300
13298
  const health = await getAgentHealth(
13301
13299
  ctx.credentials.bamboo_session,
13302
- agentId
13300
+ ctx.agentId
13303
13301
  );
13304
13302
  if (!health) return;
13305
13303
  const score = Math.round(health.score);