bamboo-agents 0.1.5-dev.35.1be3c48 → 0.1.5-dev.36.1aed6b6

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.35.1be3c48
1
+ 0.1.5-dev.36.1aed6b6
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.35.1be3c48";
3040
+ VERSION = "0.1.5-dev.36.1aed6b6";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -11602,7 +11602,11 @@ var init_agents = __esm({
11602
11602
  name: external_exports.string(),
11603
11603
  /** `false` = user-created (eligible for picker choices).
11604
11604
  * `true` = pre-installed (MAM etc.) — shown informational-only. */
11605
- is_auto_installed: external_exports.boolean()
11605
+ is_auto_installed: external_exports.boolean(),
11606
+ /** Canonical kebab-case identifier — last segment of `folder_path`
11607
+ * (`brands/<brand>/agents/<slug>`). `null` for legacy rows whose
11608
+ * `folder_path` is missing or malformed. */
11609
+ slug: external_exports.string().nullable()
11606
11610
  });
11607
11611
  CliTierCapSchema = external_exports.object({
11608
11612
  limit: external_exports.number().int(),
@@ -11811,6 +11815,68 @@ async function createAgentFromCli(bambooSession, body) {
11811
11815
  const json = await res.json();
11812
11816
  return CliCreateAgentResponseSchema.parse(json);
11813
11817
  }
11818
+ async function getAgentSkills(bambooSession, agentId) {
11819
+ const res = await cliApiFetch(
11820
+ `${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/skills`,
11821
+ {
11822
+ headers: { Authorization: `Bearer ${bambooSession}` }
11823
+ }
11824
+ );
11825
+ if (!res.ok) throw await parseError(res);
11826
+ const json = await res.json();
11827
+ return SkillCatalogResponseSchema.parse(json.data);
11828
+ }
11829
+ async function postAgentSkill(bambooSession, agentId, body) {
11830
+ const res = await cliApiFetch(
11831
+ `${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/skills`,
11832
+ {
11833
+ method: "POST",
11834
+ headers: {
11835
+ Authorization: `Bearer ${bambooSession}`,
11836
+ "Content-Type": "application/json"
11837
+ },
11838
+ body: JSON.stringify(body)
11839
+ }
11840
+ );
11841
+ if (!res.ok) throw await parseError(res);
11842
+ const json = await res.json();
11843
+ return SkillSubscriptionsResponseSchema.parse(json.data);
11844
+ }
11845
+ async function updateSkillFromRegistry(bambooSession, agentId, skillName) {
11846
+ const res = await cliApiFetch(
11847
+ `${apiBase()}/api/v1/agents/${encodeURIComponent(agentId)}/skills`,
11848
+ {
11849
+ method: "POST",
11850
+ headers: {
11851
+ Authorization: `Bearer ${bambooSession}`,
11852
+ "Content-Type": "application/json"
11853
+ },
11854
+ body: JSON.stringify({
11855
+ action: "update_from_registry",
11856
+ skill_name: skillName
11857
+ })
11858
+ }
11859
+ );
11860
+ if (!res.ok) throw await parseError(res);
11861
+ const json = await res.json();
11862
+ return SkillSubscriptionsResponseSchema.parse(json.data);
11863
+ }
11864
+ async function scaffoldSkill(bambooSession, args) {
11865
+ const res = await cliApiFetch(
11866
+ `${apiBase()}/api/v1/orgs/me/skills/scaffold`,
11867
+ {
11868
+ method: "POST",
11869
+ headers: {
11870
+ Authorization: `Bearer ${bambooSession}`,
11871
+ "Content-Type": "application/json"
11872
+ },
11873
+ body: JSON.stringify(args)
11874
+ }
11875
+ );
11876
+ if (!res.ok) throw await parseError(res);
11877
+ const json = await res.json();
11878
+ return ScaffoldSkillResponseSchema.parse(json.data);
11879
+ }
11814
11880
  async function uploadClaudeMdFromCli(bambooSession, body) {
11815
11881
  const res = await cliApiFetch(
11816
11882
  `${apiBase()}/api/v1/cli/agents/upload-claude-md`,
@@ -11827,7 +11893,7 @@ async function uploadClaudeMdFromCli(bambooSession, body) {
11827
11893
  const json = await res.json();
11828
11894
  return CliUploadAgentResponseSchema.parse(json);
11829
11895
  }
11830
- var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema;
11896
+ var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema, SkillCatalogEntrySchema, SkillCatalogResponseSchema, SkillSubscriptionsResponseSchema, ScaffoldSkillResponseSchema;
11831
11897
  var init_api = __esm({
11832
11898
  "src/lib/api.ts"() {
11833
11899
  "use strict";
@@ -11859,6 +11925,32 @@ var init_api = __esm({
11859
11925
  FirstAutoInstalledAgentResponseSchema = external_exports.object({
11860
11926
  agent_id: external_exports.string().nullable()
11861
11927
  });
11928
+ SkillCatalogEntrySchema = external_exports.object({
11929
+ name: external_exports.string(),
11930
+ display_name: external_exports.string(),
11931
+ description: external_exports.string(),
11932
+ tier: external_exports.enum(["system", "agent"]),
11933
+ source: external_exports.enum(["bamboo", "org", "community"]),
11934
+ category: external_exports.string().nullable(),
11935
+ recommended_for: external_exports.array(external_exports.string()),
11936
+ allowed_tools: external_exports.array(external_exports.string()),
11937
+ disable_model_invocation: external_exports.boolean(),
11938
+ body_hash: external_exports.string().nullable(),
11939
+ org_id: external_exports.string().nullable()
11940
+ });
11941
+ SkillCatalogResponseSchema = external_exports.object({
11942
+ always_on: external_exports.array(SkillCatalogEntrySchema),
11943
+ available: external_exports.array(SkillCatalogEntrySchema),
11944
+ installed: external_exports.array(SkillCatalogEntrySchema),
11945
+ custom: external_exports.array(SkillCatalogEntrySchema),
11946
+ subscriptions: external_exports.array(external_exports.string())
11947
+ });
11948
+ SkillSubscriptionsResponseSchema = external_exports.object({
11949
+ subscriptions: external_exports.array(external_exports.string())
11950
+ });
11951
+ ScaffoldSkillResponseSchema = external_exports.object({
11952
+ skill_name: external_exports.string()
11953
+ });
11862
11954
  }
11863
11955
  });
11864
11956
 
@@ -13961,8 +14053,12 @@ var init_skills_local = __esm({
13961
14053
  // src/commands/skills.ts
13962
14054
  var skills_exports = {};
13963
14055
  __export(skills_exports, {
14056
+ runSkillsCreate: () => runSkillsCreate,
13964
14057
  runSkillsGet: () => runSkillsGet,
13965
- runSkillsList: () => runSkillsList
14058
+ runSkillsList: () => runSkillsList,
14059
+ runSkillsSubscribe: () => runSkillsSubscribe,
14060
+ runSkillsUnsubscribe: () => runSkillsUnsubscribe,
14061
+ runSkillsUpdate: () => runSkillsUpdate
13966
14062
  });
13967
14063
  async function resolveWorkspacePath() {
13968
14064
  const cfg = await readConfig();
@@ -13982,7 +14078,94 @@ function summarize(description, max = 80) {
13982
14078
  function padRight(s, n) {
13983
14079
  return s.length >= n ? s : s + " ".repeat(n - s.length);
13984
14080
  }
13985
- async function runSkillsList() {
14081
+ async function resolveAgent(bambooSession, identifier) {
14082
+ const list = await listCliAgents(bambooSession);
14083
+ const target = identifier.trim().toLowerCase();
14084
+ if (target.length === 0) return null;
14085
+ const bySlug = list.agents.find(
14086
+ (a) => a.slug !== null && a.slug.toLowerCase() === target
14087
+ );
14088
+ if (bySlug) return { id: bySlug.id, name: bySlug.name };
14089
+ const byId = list.agents.find((a) => a.id.toLowerCase() === target) ?? (target.length >= 8 ? list.agents.find((a) => a.id.toLowerCase().startsWith(target)) : void 0);
14090
+ if (byId) return { id: byId.id, name: byId.name };
14091
+ const byName = list.agents.find((a) => a.name.toLowerCase() === target);
14092
+ if (byName) return { id: byName.id, name: byName.name };
14093
+ return null;
14094
+ }
14095
+ function printAgentNotFound(identifier, agents) {
14096
+ console.error(`bamboo-agents: agent not found: ${identifier}`);
14097
+ if (agents.length === 0) {
14098
+ console.error(
14099
+ "No agents in this org yet. Run `bamboo-agents` to create one."
14100
+ );
14101
+ } else {
14102
+ console.error("");
14103
+ console.error("Available agents (slug \u2014 name):");
14104
+ for (const a of agents) {
14105
+ const label = a.slug ?? `${a.id.slice(0, 8)} (no slug)`;
14106
+ console.error(` ${label} \u2014 ${a.name}`);
14107
+ }
14108
+ }
14109
+ process.exit(2);
14110
+ }
14111
+ async function requireSession() {
14112
+ const creds = await readCredentials();
14113
+ if (!creds) {
14114
+ console.error(
14115
+ "bamboo-agents: not logged in. Run `bamboo-agents login` first."
14116
+ );
14117
+ process.exit(1);
14118
+ }
14119
+ return creds.bamboo_session;
14120
+ }
14121
+ async function runSkillsList(options = {}) {
14122
+ if (options.agent) {
14123
+ const bambooSession = await requireSession();
14124
+ const resolved = await resolveAgent(bambooSession, options.agent);
14125
+ if (!resolved) {
14126
+ const list = await listCliAgents(bambooSession);
14127
+ return printAgentNotFound(options.agent, list.agents);
14128
+ }
14129
+ const { available, installed, custom: custom2, subscriptions } = await getAgentSkills(
14130
+ bambooSession,
14131
+ resolved.id
14132
+ );
14133
+ const subscribedSet = new Set(subscriptions);
14134
+ const filtered = [...installed, ...custom2, ...available].filter(
14135
+ (s) => subscribedSet.has(s.name)
14136
+ );
14137
+ if (filtered.length === 0) {
14138
+ console.log("");
14139
+ console.log(` No subscribed skills for ${resolved.name}.`);
14140
+ console.log(
14141
+ ` Subscribe with: bamboo-agents skills subscribe ${resolved.name} <skill-name>`
14142
+ );
14143
+ console.log("");
14144
+ return;
14145
+ }
14146
+ const nameCol2 = Math.max(
14147
+ "name".length,
14148
+ ...filtered.map((s) => s.name.length)
14149
+ );
14150
+ const header2 = ` ${padRight("name", nameCol2)} description`;
14151
+ const rule2 = " " + "\u2500".repeat(nameCol2) + " " + "\u2500".repeat(Math.min(60, 80 - nameCol2));
14152
+ console.log("");
14153
+ console.log(` Skills subscribed by ${resolved.name}:`);
14154
+ console.log("");
14155
+ console.log(header2);
14156
+ console.log(rule2);
14157
+ for (const s of filtered) {
14158
+ console.log(
14159
+ ` ${padRight(s.name, nameCol2)} ${summarize(s.description, 80 - nameCol2 - 4)}`
14160
+ );
14161
+ }
14162
+ console.log("");
14163
+ console.log(
14164
+ ` ${filtered.length} skill${filtered.length === 1 ? "" : "s"} subscribed.`
14165
+ );
14166
+ console.log("");
14167
+ return;
14168
+ }
13986
14169
  const repoPath = await resolveWorkspacePath();
13987
14170
  const skills2 = await listLocalSkills(repoPath);
13988
14171
  if (skills2.length === 0) {
@@ -14073,11 +14256,129 @@ async function printNotFound(repoPath, name) {
14073
14256
  console.error(` ${s.name}`);
14074
14257
  }
14075
14258
  }
14259
+ async function runSkillsSubscribe(agentIdentifier, skillName) {
14260
+ await runSubscribeOp("subscribe", agentIdentifier, skillName);
14261
+ }
14262
+ async function runSkillsUnsubscribe(agentIdentifier, skillName) {
14263
+ await runSubscribeOp("unsubscribe", agentIdentifier, skillName);
14264
+ }
14265
+ async function runSubscribeOp(action, agentIdentifier, skillName) {
14266
+ if (!agentIdentifier || !skillName) {
14267
+ console.error(
14268
+ `bamboo-agents: \`skills ${action}\` requires an agent identifier and a skill name.`
14269
+ );
14270
+ console.error(
14271
+ `Example: bamboo-agents skills ${action} "Paid Ads" walk-pr`
14272
+ );
14273
+ process.exit(2);
14274
+ }
14275
+ const bambooSession = await requireSession();
14276
+ const resolved = await resolveAgent(bambooSession, agentIdentifier);
14277
+ if (!resolved) {
14278
+ const list = await listCliAgents(bambooSession);
14279
+ printAgentNotFound(agentIdentifier, list.agents);
14280
+ }
14281
+ let result;
14282
+ try {
14283
+ result = await postAgentSkill(bambooSession, resolved.id, {
14284
+ action,
14285
+ skill_name: skillName
14286
+ });
14287
+ } catch (err) {
14288
+ console.error(
14289
+ `bamboo-agents: could not ${action} ${skillName}: ${err.message}`
14290
+ );
14291
+ process.exit(1);
14292
+ }
14293
+ if (action === "subscribe") {
14294
+ console.log("");
14295
+ console.log(` Subscribed ${resolved.name} to ${skillName}.`);
14296
+ } else {
14297
+ console.log("");
14298
+ console.log(` Unsubscribed ${resolved.name} from ${skillName}.`);
14299
+ }
14300
+ console.log("");
14301
+ console.log(
14302
+ ` ${resolved.name} now has ${result.subscriptions.length} skill${result.subscriptions.length === 1 ? "" : "s"} subscribed.`
14303
+ );
14304
+ console.log(
14305
+ " Pull the workspace repo to see the manifest.yml update locally:"
14306
+ );
14307
+ console.log(" git -C $(bamboo-agents status) pull");
14308
+ console.log("");
14309
+ }
14310
+ async function runSkillsCreate(skillName, options = {}) {
14311
+ if (!skillName || !skillName.trim()) {
14312
+ console.error("bamboo-agents: skills create requires a skill name.");
14313
+ console.error("Example: bamboo-agents skills create analyze-creative");
14314
+ process.exit(2);
14315
+ }
14316
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(skillName.trim())) {
14317
+ console.error(
14318
+ "bamboo-agents: skill name must be kebab-case (lowercase + dashes)."
14319
+ );
14320
+ process.exit(2);
14321
+ }
14322
+ const bambooSession = await requireSession();
14323
+ let result;
14324
+ try {
14325
+ result = await scaffoldSkill(bambooSession, {
14326
+ skill_name: skillName.trim(),
14327
+ category: options.category,
14328
+ description: options.description
14329
+ });
14330
+ } catch (err) {
14331
+ console.error(
14332
+ `bamboo-agents: could not scaffold ${skillName}: ${err.message}`
14333
+ );
14334
+ process.exit(1);
14335
+ }
14336
+ console.log("");
14337
+ console.log(` Scaffolded ${result.skill_name}.`);
14338
+ console.log("");
14339
+ console.log(
14340
+ ` Edit skills/${result.skill_name}/SKILL.md in your workspace clone:`
14341
+ );
14342
+ console.log(" git -C $(bamboo-agents status) pull");
14343
+ console.log(` $EDITOR skills/${result.skill_name}/SKILL.md`);
14344
+ console.log("");
14345
+ }
14346
+ async function runSkillsUpdate(agentIdentifier, skillName) {
14347
+ if (!agentIdentifier || !skillName) {
14348
+ console.error(
14349
+ "bamboo-agents: `skills update` requires an agent identifier and a skill name."
14350
+ );
14351
+ console.error('Example: bamboo-agents skills update "Paid Ads" walk-pr');
14352
+ process.exit(2);
14353
+ }
14354
+ const bambooSession = await requireSession();
14355
+ const resolved = await resolveAgent(bambooSession, agentIdentifier);
14356
+ if (!resolved) {
14357
+ const list = await listCliAgents(bambooSession);
14358
+ printAgentNotFound(agentIdentifier, list.agents);
14359
+ }
14360
+ try {
14361
+ await updateSkillFromRegistry(bambooSession, resolved.id, skillName);
14362
+ } catch (err) {
14363
+ console.error(
14364
+ `bamboo-agents: could not update ${skillName}: ${err.message}`
14365
+ );
14366
+ process.exit(1);
14367
+ }
14368
+ console.log("");
14369
+ console.log(` Updated ${skillName} from the bamboo registry.`);
14370
+ console.log("");
14371
+ console.log(" Pull your workspace to see the new body locally:");
14372
+ console.log(" git -C $(bamboo-agents status) pull");
14373
+ console.log("");
14374
+ }
14076
14375
  var init_skills = __esm({
14077
14376
  "src/commands/skills.ts"() {
14078
14377
  "use strict";
14079
14378
  init_state();
14379
+ init_credentials();
14080
14380
  init_skills_local();
14381
+ init_api();
14081
14382
  }
14082
14383
  });
14083
14384
 
@@ -14127,15 +14428,36 @@ program2.command("doctor").description("Verify your local setup is ready").actio
14127
14428
  await runDoctor2();
14128
14429
  });
14129
14430
  var skills = program2.command("skills").description("Read workspace skills from your local clone");
14130
- skills.command("list").description("List every skill in the workspace").action(async () => {
14431
+ skills.command("list").description("List every skill in the workspace").option(
14432
+ "--agent <slug>",
14433
+ "Filter to one agent's subscribed skills (via server)"
14434
+ ).action(async (options) => {
14131
14435
  const { runSkillsList: runSkillsList2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14132
- await runSkillsList2();
14436
+ await runSkillsList2(options);
14133
14437
  });
14134
14438
  skills.command("get <name>").description("Print one skill's SKILL.md body to stdout").action(async (name) => {
14135
14439
  const { runSkillsGet: runSkillsGet2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14136
14440
  await runSkillsGet2(name);
14137
14441
  });
14138
- program2.parseAsync().catch((err) => {
14442
+ skills.command("subscribe <agent> <skill-name>").description("Subscribe an agent to a skill from the catalog").action(async (agent, skillName) => {
14443
+ const { runSkillsSubscribe: runSkillsSubscribe2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14444
+ await runSkillsSubscribe2(agent, skillName);
14445
+ });
14446
+ skills.command("unsubscribe <agent> <skill-name>").description("Unsubscribe an agent from a skill").action(async (agent, skillName) => {
14447
+ const { runSkillsUnsubscribe: runSkillsUnsubscribe2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14448
+ await runSkillsUnsubscribe2(agent, skillName);
14449
+ });
14450
+ skills.command("create <skill-name>").description("Scaffold a new org-custom skill in your workspace").option("--category <category>", "Optional category label (e.g. analysis)").option("--description <description>", "Optional one-line description").action(
14451
+ async (skillName, options) => {
14452
+ const { runSkillsCreate: runSkillsCreate2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14453
+ await runSkillsCreate2(skillName, options);
14454
+ }
14455
+ );
14456
+ skills.command("update <agent> <skill-name>").description("Update an installed skill from the bamboo registry").action(async (agent, skillName) => {
14457
+ const { runSkillsUpdate: runSkillsUpdate2 } = await Promise.resolve().then(() => (init_skills(), skills_exports));
14458
+ await runSkillsUpdate2(agent, skillName);
14459
+ });
14460
+ program2.parseAsync(process.argv).catch((err) => {
14139
14461
  const message = err instanceof Error ? err.message : String(err);
14140
14462
  console.error(`bamboo-agents: ${message}`);
14141
14463
  process.exit(1);