bamboo-agents 0.1.5-dev.59.bf3c8c5 → 0.1.5-dev.60.6d2930c
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 +163 -1
- 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.60.6d2930c
|
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.60.6d2930c";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12389,6 +12389,65 @@ var init_brand = __esm({
|
|
|
12389
12389
|
}
|
|
12390
12390
|
});
|
|
12391
12391
|
|
|
12392
|
+
// ../../src/lib/api-contracts/cli/skill-apply.ts
|
|
12393
|
+
var SkillEditOpSchema, SkillApplyRequestSchema, SkillApplySuccessResponseSchema;
|
|
12394
|
+
var init_skill_apply = __esm({
|
|
12395
|
+
"../../src/lib/api-contracts/cli/skill-apply.ts"() {
|
|
12396
|
+
init_zod();
|
|
12397
|
+
SkillEditOpSchema = external_exports.object({
|
|
12398
|
+
op: external_exports.enum(["add", "delete", "replace"]),
|
|
12399
|
+
anchor: external_exports.string().min(1).describe(
|
|
12400
|
+
"The section heading the op targets, verbatim including the `#` prefix."
|
|
12401
|
+
),
|
|
12402
|
+
before: external_exports.string().optional().describe(
|
|
12403
|
+
"Exact existing text to find. Required for `replace` and `delete`."
|
|
12404
|
+
),
|
|
12405
|
+
after: external_exports.string().optional().describe("New text. Required for `add` and `replace`.")
|
|
12406
|
+
}).superRefine((val, ctx) => {
|
|
12407
|
+
if ((val.op === "replace" || val.op === "delete") && !val.before) {
|
|
12408
|
+
ctx.addIssue({
|
|
12409
|
+
code: external_exports.ZodIssueCode.custom,
|
|
12410
|
+
message: `op '${val.op}' requires 'before'`,
|
|
12411
|
+
path: ["before"]
|
|
12412
|
+
});
|
|
12413
|
+
}
|
|
12414
|
+
if ((val.op === "replace" || val.op === "add") && !val.after) {
|
|
12415
|
+
ctx.addIssue({
|
|
12416
|
+
code: external_exports.ZodIssueCode.custom,
|
|
12417
|
+
message: `op '${val.op}' requires 'after'`,
|
|
12418
|
+
path: ["after"]
|
|
12419
|
+
});
|
|
12420
|
+
}
|
|
12421
|
+
});
|
|
12422
|
+
SkillApplyRequestSchema = external_exports.object({
|
|
12423
|
+
skill_name: external_exports.string().min(1).describe("Kebab-case skill name, e.g. `draft-content`."),
|
|
12424
|
+
current_skill_body: external_exports.string().min(1).describe(
|
|
12425
|
+
"The SKILL.md body the ops were reasoned against. For a Library skill with no per-org fork yet, pass the bundled body \u2014 the fork writes that same body, so the ops still apply."
|
|
12426
|
+
),
|
|
12427
|
+
ops: external_exports.array(SkillEditOpSchema).describe(
|
|
12428
|
+
"Bounded add/delete/replace ops (1\u20138). Budget + protected-section rules enforced in `applyOps` server-side."
|
|
12429
|
+
),
|
|
12430
|
+
behavior_summary: external_exports.string().min(1).describe(
|
|
12431
|
+
"One plain-English sentence describing the behavior change (what the user approves on the card)."
|
|
12432
|
+
)
|
|
12433
|
+
});
|
|
12434
|
+
SkillApplySuccessResponseSchema = external_exports.object({
|
|
12435
|
+
proposed: external_exports.literal(true),
|
|
12436
|
+
/** Whether a Library skill was forked into the workspace before applying ops. */
|
|
12437
|
+
forked: external_exports.boolean(),
|
|
12438
|
+
skill: external_exports.string(),
|
|
12439
|
+
repo_path: external_exports.string(),
|
|
12440
|
+
pr_number: external_exports.number().int().nullable(),
|
|
12441
|
+
pr_url: external_exports.string().url().nullable(),
|
|
12442
|
+
applied_ops: external_exports.number().int(),
|
|
12443
|
+
dropped_protected: external_exports.number().int(),
|
|
12444
|
+
behavior_summary: external_exports.string(),
|
|
12445
|
+
/** Plain-English next-step hint for the agent's log. */
|
|
12446
|
+
note: external_exports.string()
|
|
12447
|
+
});
|
|
12448
|
+
}
|
|
12449
|
+
});
|
|
12450
|
+
|
|
12392
12451
|
// ../../src/lib/api-contracts/cli/context-health.ts
|
|
12393
12452
|
var ScopeKindSchema, ScopeSchema, CriterionMetricsSchema, StatusSchema, CriterionContributionSchema, CriterionResultSchema, BucketScoresSchema, ResolvedScopeSchema, GapsSchema, HealthyResponseSchema, UnavailableResponseSchema, ContextHealthResponseSchema;
|
|
12394
12453
|
var init_context_health = __esm({
|
|
@@ -12564,6 +12623,19 @@ async function getKnowledgeSlots(bambooSession) {
|
|
|
12564
12623
|
const json = await res.json();
|
|
12565
12624
|
return KnowledgeSlotsResponseSchema.parse(json);
|
|
12566
12625
|
}
|
|
12626
|
+
async function applySkillEdit(bambooSession, body) {
|
|
12627
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/skill-apply`, {
|
|
12628
|
+
method: "POST",
|
|
12629
|
+
headers: {
|
|
12630
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
12631
|
+
"Content-Type": "application/json"
|
|
12632
|
+
},
|
|
12633
|
+
body: JSON.stringify(body)
|
|
12634
|
+
});
|
|
12635
|
+
if (!res.ok) throw await parseError(res);
|
|
12636
|
+
const json = await res.json();
|
|
12637
|
+
return SkillApplySuccessResponseSchema.parse(json);
|
|
12638
|
+
}
|
|
12567
12639
|
async function saveKnowledge(bambooSession, body) {
|
|
12568
12640
|
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/knowledge/save`, {
|
|
12569
12641
|
method: "POST",
|
|
@@ -12946,6 +13018,7 @@ var init_api = __esm({
|
|
|
12946
13018
|
init_agents();
|
|
12947
13019
|
init_knowledge_slots();
|
|
12948
13020
|
init_knowledge_save();
|
|
13021
|
+
init_skill_apply();
|
|
12949
13022
|
init_save();
|
|
12950
13023
|
init_history();
|
|
12951
13024
|
init_changes();
|
|
@@ -16838,6 +16911,7 @@ var init_skills_local = __esm({
|
|
|
16838
16911
|
// src/commands/skills.ts
|
|
16839
16912
|
var skills_exports = {};
|
|
16840
16913
|
__export(skills_exports, {
|
|
16914
|
+
runSkillsApply: () => runSkillsApply,
|
|
16841
16915
|
runSkillsCreate: () => runSkillsCreate,
|
|
16842
16916
|
runSkillsGet: () => runSkillsGet,
|
|
16843
16917
|
runSkillsList: () => runSkillsList,
|
|
@@ -17175,6 +17249,88 @@ async function runSkillsUpdateImpl(agentIdentifier, skillName) {
|
|
|
17175
17249
|
console.log(" git -C $(bamboo-agents status) pull");
|
|
17176
17250
|
console.log("");
|
|
17177
17251
|
}
|
|
17252
|
+
async function readJsonFromStdin() {
|
|
17253
|
+
if (process.stdin.isTTY) {
|
|
17254
|
+
throw new Error(
|
|
17255
|
+
"expected JSON on stdin (no input piped). Example: `bamboo-agents skills apply <skill> < lesson.json`"
|
|
17256
|
+
);
|
|
17257
|
+
}
|
|
17258
|
+
const chunks = [];
|
|
17259
|
+
for await (const chunk of process.stdin) {
|
|
17260
|
+
chunks.push(chunk);
|
|
17261
|
+
}
|
|
17262
|
+
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
17263
|
+
if (!raw) {
|
|
17264
|
+
throw new Error("stdin was empty \u2014 pipe a JSON body in.");
|
|
17265
|
+
}
|
|
17266
|
+
try {
|
|
17267
|
+
return JSON.parse(raw);
|
|
17268
|
+
} catch (err) {
|
|
17269
|
+
throw new Error(`stdin is not valid JSON: ${err.message}`);
|
|
17270
|
+
}
|
|
17271
|
+
}
|
|
17272
|
+
async function runSkillsApply(skillName) {
|
|
17273
|
+
const envToken = process.env.BAMBOO_API_TOKEN?.trim();
|
|
17274
|
+
let session = null;
|
|
17275
|
+
if (envToken) {
|
|
17276
|
+
session = envToken;
|
|
17277
|
+
} else {
|
|
17278
|
+
const creds = await readCredentials();
|
|
17279
|
+
session = creds?.bamboo_session ?? null;
|
|
17280
|
+
}
|
|
17281
|
+
if (!session) {
|
|
17282
|
+
console.error(
|
|
17283
|
+
"bamboo-agents: not signed in. Run `bamboo-agents login` first (or set BAMBOO_API_TOKEN for headless / managed-agent use)."
|
|
17284
|
+
);
|
|
17285
|
+
process.exit(1);
|
|
17286
|
+
}
|
|
17287
|
+
let body;
|
|
17288
|
+
try {
|
|
17289
|
+
const raw = await readJsonFromStdin();
|
|
17290
|
+
if (typeof raw !== "object" || raw === null) {
|
|
17291
|
+
throw new Error("stdin JSON must be an object");
|
|
17292
|
+
}
|
|
17293
|
+
body = { ...raw, skill_name: skillName };
|
|
17294
|
+
} catch (err) {
|
|
17295
|
+
console.error(`bamboo-agents: ${err.message}`);
|
|
17296
|
+
process.exit(1);
|
|
17297
|
+
}
|
|
17298
|
+
try {
|
|
17299
|
+
const result = await applySkillEdit(session, body);
|
|
17300
|
+
console.log("");
|
|
17301
|
+
console.log(
|
|
17302
|
+
` \u2713 Queued skill-edit PR \u2014 the "Boo is learning" card is in the inbox.`
|
|
17303
|
+
);
|
|
17304
|
+
console.log("");
|
|
17305
|
+
console.log(` Skill: ${result.skill}`);
|
|
17306
|
+
console.log(` Behavior: ${result.behavior_summary}`);
|
|
17307
|
+
console.log(` Applied ops: ${result.applied_ops}`);
|
|
17308
|
+
if (result.dropped_protected > 0) {
|
|
17309
|
+
console.log(
|
|
17310
|
+
` Dropped protected: ${result.dropped_protected} (anchor hit a <!-- protected --> section)`
|
|
17311
|
+
);
|
|
17312
|
+
}
|
|
17313
|
+
if (result.forked) {
|
|
17314
|
+
console.log(` Forked Library skill into the workspace first.`);
|
|
17315
|
+
}
|
|
17316
|
+
if (result.pr_url) {
|
|
17317
|
+
console.log(` PR: ${result.pr_url}`);
|
|
17318
|
+
}
|
|
17319
|
+
console.log("");
|
|
17320
|
+
console.log(` ${result.note}`);
|
|
17321
|
+
console.log("");
|
|
17322
|
+
} catch (err) {
|
|
17323
|
+
if (err instanceof ApiError) {
|
|
17324
|
+
const exitCode = err.status >= 500 ? 2 : 1;
|
|
17325
|
+
console.error("");
|
|
17326
|
+
console.error(` bamboo-agents: ${err.message}`);
|
|
17327
|
+
console.error("");
|
|
17328
|
+
process.exit(exitCode);
|
|
17329
|
+
}
|
|
17330
|
+
console.error(`bamboo-agents: ${err.message}`);
|
|
17331
|
+
process.exit(2);
|
|
17332
|
+
}
|
|
17333
|
+
}
|
|
17178
17334
|
var init_skills = __esm({
|
|
17179
17335
|
"src/commands/skills.ts"() {
|
|
17180
17336
|
"use strict";
|
|
@@ -18360,6 +18516,12 @@ skills.command("update <agent> <skill-name>").description("Update an installed s
|
|
|
18360
18516
|
const { runSkillsUpdate: runSkillsUpdate2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
|
|
18361
18517
|
await runSkillsUpdate2(agent, skillName);
|
|
18362
18518
|
});
|
|
18519
|
+
skills.command("apply <skill-name>").description(
|
|
18520
|
+
'Apply a bounded skill edit \u2014 opens a queued, human-gated PR (the "Boo is learning" card). Reads JSON body from stdin.'
|
|
18521
|
+
).option("--no-sync", "Skip the auto-sync git pull on this command").action(async (skillName) => {
|
|
18522
|
+
const { runSkillsApply: runSkillsApply2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
|
|
18523
|
+
await runSkillsApply2(skillName);
|
|
18524
|
+
});
|
|
18363
18525
|
var knowledge = program2.command("knowledge").description("Knowledge surface for CLI-first skills");
|
|
18364
18526
|
knowledge.command("slots").description("Print the knowledge slot schema (kind \xD7 scope \u2192 path) + dimensions").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(async (options) => {
|
|
18365
18527
|
const { runKnowledgeSlots: runKnowledgeSlots2 } = await Promise.resolve().then(() => (init_knowledge(), knowledge_exports));
|