bamboo-agents 0.1.5-dev.21 → 0.1.5-dev.23
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 +276 -2
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.5-dev.
|
|
1
|
+
0.1.5-dev.23
|
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.23";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -11522,6 +11522,49 @@ 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
|
+
|
|
11543
|
+
// ../../src/lib/api-contracts/cli/onboarding-next-prompt.ts
|
|
11544
|
+
var OnboardingNextPromptResponseSchema;
|
|
11545
|
+
var init_onboarding_next_prompt = __esm({
|
|
11546
|
+
"../../src/lib/api-contracts/cli/onboarding-next-prompt.ts"() {
|
|
11547
|
+
init_zod();
|
|
11548
|
+
OnboardingNextPromptResponseSchema = external_exports.object({
|
|
11549
|
+
/** Checklist item key from `compute_onboarding_status.next_best_step.key`.
|
|
11550
|
+
* Empty string when there's no next step at all. */
|
|
11551
|
+
key: external_exports.string(),
|
|
11552
|
+
/** Human-readable item label (e.g., "Add Important Context"). */
|
|
11553
|
+
label: external_exports.string(),
|
|
11554
|
+
/** The question to ask the user. `null` when no prompt is available
|
|
11555
|
+
* for this item (CLI treats null as "skip"). */
|
|
11556
|
+
prompt: external_exports.string().nullable(),
|
|
11557
|
+
/** Optional one-liner explaining why answering this matters. Surfaces
|
|
11558
|
+
* above the prompt as `💡 <impact>` in the CLI. */
|
|
11559
|
+
impact: external_exports.string().nullable(),
|
|
11560
|
+
/** Workspace-repo-relative path where the answer should be written.
|
|
11561
|
+
* Non-null ONLY when `key === 'knowledge'` — the only item v1 saves
|
|
11562
|
+
* inline from the CLI. Other keys get `null` (CLI skips). */
|
|
11563
|
+
save_path: external_exports.string().nullable()
|
|
11564
|
+
});
|
|
11565
|
+
}
|
|
11566
|
+
});
|
|
11567
|
+
|
|
11525
11568
|
// src/lib/api.ts
|
|
11526
11569
|
import { platform as platform2 } from "node:os";
|
|
11527
11570
|
function defaultApiBase(version) {
|
|
@@ -11599,7 +11642,66 @@ async function provisionWorkspace(bambooSession) {
|
|
|
11599
11642
|
const json = await res.json();
|
|
11600
11643
|
return ProvisionWorkspaceResponseSchema.parse(json);
|
|
11601
11644
|
}
|
|
11602
|
-
|
|
11645
|
+
async function getFirstAutoInstalledAgent(bambooSession) {
|
|
11646
|
+
const res = await cliApiFetch(
|
|
11647
|
+
`${apiBase()}/api/v1/agents/first-auto-installed`,
|
|
11648
|
+
{
|
|
11649
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
11650
|
+
}
|
|
11651
|
+
);
|
|
11652
|
+
if (!res.ok) throw await parseError(res);
|
|
11653
|
+
const json = await res.json();
|
|
11654
|
+
return FirstAutoInstalledAgentResponseSchema.parse(json).agent_id;
|
|
11655
|
+
}
|
|
11656
|
+
async function getAgentHealth(bambooSession, agentId) {
|
|
11657
|
+
const res = await cliApiFetch(
|
|
11658
|
+
`${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/health`,
|
|
11659
|
+
{
|
|
11660
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
11661
|
+
}
|
|
11662
|
+
);
|
|
11663
|
+
if (!res.ok) throw await parseError(res);
|
|
11664
|
+
const json = await res.json();
|
|
11665
|
+
return AgentHealthResponseSchema.parse(json);
|
|
11666
|
+
}
|
|
11667
|
+
async function getOnboardingNextPrompt(bambooSession) {
|
|
11668
|
+
const res = await cliApiFetch(
|
|
11669
|
+
`${apiBase()}/api/v1/cli/onboarding/next-prompt`,
|
|
11670
|
+
{
|
|
11671
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
11672
|
+
}
|
|
11673
|
+
);
|
|
11674
|
+
if (!res.ok) throw await parseError(res);
|
|
11675
|
+
const json = await res.json();
|
|
11676
|
+
return OnboardingNextPromptResponseSchema.parse(json);
|
|
11677
|
+
}
|
|
11678
|
+
async function saveKnowledgeAnswer(bambooSession, path2, prompt, answer) {
|
|
11679
|
+
const content = formatAsMarkdown(prompt, answer);
|
|
11680
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/workspace/save`, {
|
|
11681
|
+
method: "POST",
|
|
11682
|
+
headers: {
|
|
11683
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
11684
|
+
"Content-Type": "application/json"
|
|
11685
|
+
},
|
|
11686
|
+
body: JSON.stringify({
|
|
11687
|
+
edits: [{ path: path2, content, base_sha: null }],
|
|
11688
|
+
intent: "Save Boo's first-chat answer"
|
|
11689
|
+
})
|
|
11690
|
+
});
|
|
11691
|
+
if (!res.ok) throw await parseError(res);
|
|
11692
|
+
await res.json().catch(() => void 0);
|
|
11693
|
+
}
|
|
11694
|
+
function formatAsMarkdown(prompt, answer) {
|
|
11695
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
11696
|
+
return `# ${prompt}
|
|
11697
|
+
|
|
11698
|
+
${answer}
|
|
11699
|
+
|
|
11700
|
+
---
|
|
11701
|
+
Saved by Boo via CLI magic-moment, ${stamp}.
|
|
11702
|
+
`;
|
|
11703
|
+
}
|
|
11704
|
+
var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema;
|
|
11603
11705
|
var init_api = __esm({
|
|
11604
11706
|
"src/lib/api.ts"() {
|
|
11605
11707
|
"use strict";
|
|
@@ -11607,6 +11709,8 @@ var init_api = __esm({
|
|
|
11607
11709
|
init_auth_token();
|
|
11608
11710
|
init_auth_status();
|
|
11609
11711
|
init_billing_status();
|
|
11712
|
+
init_agent_health();
|
|
11713
|
+
init_onboarding_next_prompt();
|
|
11610
11714
|
init_version();
|
|
11611
11715
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
11612
11716
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -11625,6 +11729,9 @@ var init_api = __esm({
|
|
|
11625
11729
|
ProvisionWorkspaceResponseSchema = external_exports.object({
|
|
11626
11730
|
workspace_repo: external_exports.string()
|
|
11627
11731
|
});
|
|
11732
|
+
FirstAutoInstalledAgentResponseSchema = external_exports.object({
|
|
11733
|
+
agent_id: external_exports.string().nullable()
|
|
11734
|
+
});
|
|
11628
11735
|
}
|
|
11629
11736
|
});
|
|
11630
11737
|
|
|
@@ -12513,6 +12620,135 @@ var init_clone_or_adopt_phase = __esm({
|
|
|
12513
12620
|
}
|
|
12514
12621
|
});
|
|
12515
12622
|
|
|
12623
|
+
// src/lib/prompt.ts
|
|
12624
|
+
import { createInterface } from "node:readline";
|
|
12625
|
+
async function promptStdin(question, opts = {}) {
|
|
12626
|
+
const maxRetries = opts.maxRetries ?? 2;
|
|
12627
|
+
const isInteractive2 = process.stdin.isTTY === true;
|
|
12628
|
+
const rl = createInterface({
|
|
12629
|
+
input: process.stdin,
|
|
12630
|
+
output: process.stdout,
|
|
12631
|
+
terminal: isInteractive2
|
|
12632
|
+
});
|
|
12633
|
+
const onSigInt = () => {
|
|
12634
|
+
rl.close();
|
|
12635
|
+
};
|
|
12636
|
+
rl.on("SIGINT", onSigInt);
|
|
12637
|
+
try {
|
|
12638
|
+
let attempts = 0;
|
|
12639
|
+
while (attempts <= maxRetries) {
|
|
12640
|
+
const answer = await readOnce(rl, question);
|
|
12641
|
+
if (answer === null) return null;
|
|
12642
|
+
const trimmed = answer.trim();
|
|
12643
|
+
if (trimmed.length > 0) return trimmed;
|
|
12644
|
+
attempts += 1;
|
|
12645
|
+
if (attempts > maxRetries || !isInteractive2) return null;
|
|
12646
|
+
console.log(" (Press Enter without typing to skip \u2014 or answer Boo's question.)");
|
|
12647
|
+
}
|
|
12648
|
+
return null;
|
|
12649
|
+
} finally {
|
|
12650
|
+
rl.off("SIGINT", onSigInt);
|
|
12651
|
+
rl.close();
|
|
12652
|
+
}
|
|
12653
|
+
}
|
|
12654
|
+
function readOnce(rl, question) {
|
|
12655
|
+
return new Promise((resolve) => {
|
|
12656
|
+
let resolved = false;
|
|
12657
|
+
const settle = (value) => {
|
|
12658
|
+
if (resolved) return;
|
|
12659
|
+
resolved = true;
|
|
12660
|
+
resolve(value);
|
|
12661
|
+
};
|
|
12662
|
+
rl.once("close", () => settle(null));
|
|
12663
|
+
rl.question(question, (answer) => settle(answer));
|
|
12664
|
+
});
|
|
12665
|
+
}
|
|
12666
|
+
var init_prompt = __esm({
|
|
12667
|
+
"src/lib/prompt.ts"() {
|
|
12668
|
+
"use strict";
|
|
12669
|
+
}
|
|
12670
|
+
});
|
|
12671
|
+
|
|
12672
|
+
// src/lib/phases-impl/magic-moment-phase.ts
|
|
12673
|
+
var magicMomentSpec;
|
|
12674
|
+
var init_magic_moment_phase = __esm({
|
|
12675
|
+
"src/lib/phases-impl/magic-moment-phase.ts"() {
|
|
12676
|
+
"use strict";
|
|
12677
|
+
init_api();
|
|
12678
|
+
init_prompt();
|
|
12679
|
+
magicMomentSpec = {
|
|
12680
|
+
name: "magic-moment",
|
|
12681
|
+
async probe(ctx) {
|
|
12682
|
+
if (!ctx.credentials) {
|
|
12683
|
+
return {
|
|
12684
|
+
status: "needs_action",
|
|
12685
|
+
summary: "(no creds)",
|
|
12686
|
+
reason: "Run `bamboo-agents login` first."
|
|
12687
|
+
};
|
|
12688
|
+
}
|
|
12689
|
+
try {
|
|
12690
|
+
const next = await getOnboardingNextPrompt(ctx.credentials.bamboo_session);
|
|
12691
|
+
if (next.key !== "knowledge" || !next.prompt || !next.save_path) {
|
|
12692
|
+
return { status: "done", summary: "no question to ask" };
|
|
12693
|
+
}
|
|
12694
|
+
ctx.magicMoment = next;
|
|
12695
|
+
return {
|
|
12696
|
+
status: "needs_work",
|
|
12697
|
+
summary: "answer Boo's first question"
|
|
12698
|
+
};
|
|
12699
|
+
} catch {
|
|
12700
|
+
return {
|
|
12701
|
+
status: "done",
|
|
12702
|
+
summary: "no question to ask (endpoint unavailable)"
|
|
12703
|
+
};
|
|
12704
|
+
}
|
|
12705
|
+
},
|
|
12706
|
+
async execute(ctx) {
|
|
12707
|
+
const next = ctx.magicMoment;
|
|
12708
|
+
if (!next || !next.prompt || !next.save_path || !ctx.credentials) {
|
|
12709
|
+
return { kind: "done" };
|
|
12710
|
+
}
|
|
12711
|
+
console.log("");
|
|
12712
|
+
if (next.impact) {
|
|
12713
|
+
console.log(` \u{1F4A1} ${next.impact}`);
|
|
12714
|
+
console.log("");
|
|
12715
|
+
}
|
|
12716
|
+
const answer = await promptStdin(` Boo asks: ${next.prompt}
|
|
12717
|
+
> `);
|
|
12718
|
+
if (!answer) {
|
|
12719
|
+
return { kind: "done" };
|
|
12720
|
+
}
|
|
12721
|
+
try {
|
|
12722
|
+
await saveKnowledgeAnswer(
|
|
12723
|
+
ctx.credentials.bamboo_session,
|
|
12724
|
+
next.save_path,
|
|
12725
|
+
next.prompt,
|
|
12726
|
+
answer
|
|
12727
|
+
);
|
|
12728
|
+
console.log("");
|
|
12729
|
+
console.log(" \u2713 Saved to your workspace. Boo will use this in your first chat.");
|
|
12730
|
+
return {
|
|
12731
|
+
kind: "advanced",
|
|
12732
|
+
summary: "answered Boo's first question"
|
|
12733
|
+
};
|
|
12734
|
+
} catch (err) {
|
|
12735
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
12736
|
+
console.warn(
|
|
12737
|
+
"[magic-moment] save failed:",
|
|
12738
|
+
JSON.stringify({ path: next.save_path, error: msg })
|
|
12739
|
+
);
|
|
12740
|
+
console.log("");
|
|
12741
|
+
console.log(" (Couldn't save your answer right now \u2014 Boo will ask again in your first chat.)");
|
|
12742
|
+
return {
|
|
12743
|
+
kind: "advanced",
|
|
12744
|
+
summary: "answered Boo's first question (save retried in-app)"
|
|
12745
|
+
};
|
|
12746
|
+
}
|
|
12747
|
+
}
|
|
12748
|
+
};
|
|
12749
|
+
}
|
|
12750
|
+
});
|
|
12751
|
+
|
|
12516
12752
|
// src/lib/claude-desktop.ts
|
|
12517
12753
|
import { execFile as execFile7 } from "node:child_process";
|
|
12518
12754
|
import { platform as platform3 } from "node:os";
|
|
@@ -12619,6 +12855,35 @@ var init_open_phase = __esm({
|
|
|
12619
12855
|
}
|
|
12620
12856
|
});
|
|
12621
12857
|
|
|
12858
|
+
// src/lib/orchestrator-steps/health-line.ts
|
|
12859
|
+
async function printHealthLine(ctx) {
|
|
12860
|
+
try {
|
|
12861
|
+
if (!ctx.credentials?.bamboo_session) return;
|
|
12862
|
+
const agentId = await getFirstAutoInstalledAgent(
|
|
12863
|
+
ctx.credentials.bamboo_session
|
|
12864
|
+
);
|
|
12865
|
+
if (!agentId) return;
|
|
12866
|
+
const health = await getAgentHealth(
|
|
12867
|
+
ctx.credentials.bamboo_session,
|
|
12868
|
+
agentId
|
|
12869
|
+
);
|
|
12870
|
+
if (!health) return;
|
|
12871
|
+
const score = Math.round(health.score);
|
|
12872
|
+
const max = health.max;
|
|
12873
|
+
const gap = health.top_gap_slot;
|
|
12874
|
+
const line = gap ? ` Health: ${score} / ${max} \u2014 top gap: ${gap}` : ` Health: ${score} / ${max}`;
|
|
12875
|
+
console.log("");
|
|
12876
|
+
console.log(line);
|
|
12877
|
+
} catch {
|
|
12878
|
+
}
|
|
12879
|
+
}
|
|
12880
|
+
var init_health_line = __esm({
|
|
12881
|
+
"src/lib/orchestrator-steps/health-line.ts"() {
|
|
12882
|
+
"use strict";
|
|
12883
|
+
init_api();
|
|
12884
|
+
}
|
|
12885
|
+
});
|
|
12886
|
+
|
|
12622
12887
|
// src/commands/orchestrator.ts
|
|
12623
12888
|
var orchestrator_exports = {};
|
|
12624
12889
|
__export(orchestrator_exports, {
|
|
@@ -12692,6 +12957,9 @@ async function runOrchestrator() {
|
|
|
12692
12957
|
}
|
|
12693
12958
|
if (probe.status === "done") {
|
|
12694
12959
|
console.log(` \u2713 ${probe.summary}`);
|
|
12960
|
+
if (phase.name === cloneOrAdoptSpec.name) {
|
|
12961
|
+
await printHealthLine(ctx);
|
|
12962
|
+
}
|
|
12695
12963
|
continue;
|
|
12696
12964
|
}
|
|
12697
12965
|
const result = await phase.execute(ctx);
|
|
@@ -12699,6 +12967,9 @@ async function runOrchestrator() {
|
|
|
12699
12967
|
printNeedsAction(result.reason);
|
|
12700
12968
|
process.exit(2);
|
|
12701
12969
|
}
|
|
12970
|
+
if (phase.name === cloneOrAdoptSpec.name) {
|
|
12971
|
+
await printHealthLine(ctx);
|
|
12972
|
+
}
|
|
12702
12973
|
}
|
|
12703
12974
|
}
|
|
12704
12975
|
var PHASES;
|
|
@@ -12710,11 +12981,14 @@ var init_orchestrator = __esm({
|
|
|
12710
12981
|
init_login_phase();
|
|
12711
12982
|
init_provision_phase();
|
|
12712
12983
|
init_clone_or_adopt_phase();
|
|
12984
|
+
init_magic_moment_phase();
|
|
12713
12985
|
init_open_phase();
|
|
12986
|
+
init_health_line();
|
|
12714
12987
|
PHASES = [
|
|
12715
12988
|
loginSpec,
|
|
12716
12989
|
provisionSpec,
|
|
12717
12990
|
cloneOrAdoptSpec,
|
|
12991
|
+
magicMomentSpec,
|
|
12718
12992
|
openSpec
|
|
12719
12993
|
];
|
|
12720
12994
|
}
|