bamboo-agents 0.1.5-dev.63.0d55db2 → 0.1.5-dev.64.96d1b4d
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 +117 -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.64.96d1b4d
|
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.64.96d1b4d";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12646,6 +12646,28 @@ var init_install_token = __esm({
|
|
|
12646
12646
|
}
|
|
12647
12647
|
});
|
|
12648
12648
|
|
|
12649
|
+
// ../../src/lib/api-contracts/cli/episodes.ts
|
|
12650
|
+
var CliOutcomeEpisodeRequestSchema, CliOutcomeEpisodeResponseSchema;
|
|
12651
|
+
var init_episodes = __esm({
|
|
12652
|
+
"../../src/lib/api-contracts/cli/episodes.ts"() {
|
|
12653
|
+
init_zod();
|
|
12654
|
+
CliOutcomeEpisodeRequestSchema = external_exports.object({
|
|
12655
|
+
brand_id: external_exports.string().uuid(),
|
|
12656
|
+
/** The recommendation episode this outcome follows. */
|
|
12657
|
+
parent_episode_id: external_exports.string().uuid(),
|
|
12658
|
+
description: external_exports.string().min(1).max(4e3),
|
|
12659
|
+
metrics_before: external_exports.record(external_exports.unknown()).optional(),
|
|
12660
|
+
metrics_after: external_exports.record(external_exports.unknown()).optional()
|
|
12661
|
+
});
|
|
12662
|
+
CliOutcomeEpisodeResponseSchema = external_exports.object({
|
|
12663
|
+
id: external_exports.string().uuid(),
|
|
12664
|
+
brand_id: external_exports.string().uuid(),
|
|
12665
|
+
parent_episode_id: external_exports.string().uuid(),
|
|
12666
|
+
created_at: external_exports.string()
|
|
12667
|
+
});
|
|
12668
|
+
}
|
|
12669
|
+
});
|
|
12670
|
+
|
|
12649
12671
|
// src/lib/api.ts
|
|
12650
12672
|
import { platform as platform2 } from "node:os";
|
|
12651
12673
|
function defaultApiBase(version) {
|
|
@@ -13124,6 +13146,19 @@ async function mintCliInstallToken(bambooSession) {
|
|
|
13124
13146
|
const json = await res.json();
|
|
13125
13147
|
return CliInstallTokenSuccessSchema.parse(json);
|
|
13126
13148
|
}
|
|
13149
|
+
async function postOutcomeEpisode(bambooSession, body) {
|
|
13150
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/episodes`, {
|
|
13151
|
+
method: "POST",
|
|
13152
|
+
headers: {
|
|
13153
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
13154
|
+
"Content-Type": "application/json"
|
|
13155
|
+
},
|
|
13156
|
+
body: JSON.stringify(body)
|
|
13157
|
+
});
|
|
13158
|
+
if (!res.ok) throw await parseError(res);
|
|
13159
|
+
const json = await res.json();
|
|
13160
|
+
return CliOutcomeEpisodeResponseSchema.parse(json);
|
|
13161
|
+
}
|
|
13127
13162
|
var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema, SkillCatalogEntrySchema, SkillCatalogResponseSchema, SkillSubscriptionsResponseSchema, ScaffoldSkillResponseSchema;
|
|
13128
13163
|
var init_api = __esm({
|
|
13129
13164
|
"src/lib/api.ts"() {
|
|
@@ -13147,6 +13182,7 @@ var init_api = __esm({
|
|
|
13147
13182
|
init_onboarding_status();
|
|
13148
13183
|
init_context_health();
|
|
13149
13184
|
init_install_token();
|
|
13185
|
+
init_episodes();
|
|
13150
13186
|
init_version();
|
|
13151
13187
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
13152
13188
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -18641,6 +18677,79 @@ var init_agents2 = __esm({
|
|
|
18641
18677
|
}
|
|
18642
18678
|
});
|
|
18643
18679
|
|
|
18680
|
+
// src/commands/episode.ts
|
|
18681
|
+
var episode_exports = {};
|
|
18682
|
+
__export(episode_exports, {
|
|
18683
|
+
runEpisodeLogOutcome: () => runEpisodeLogOutcome
|
|
18684
|
+
});
|
|
18685
|
+
async function requireSession10() {
|
|
18686
|
+
const creds = await readCredentials();
|
|
18687
|
+
if (!creds) {
|
|
18688
|
+
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
18689
|
+
process.exit(1);
|
|
18690
|
+
}
|
|
18691
|
+
return creds.bamboo_session;
|
|
18692
|
+
}
|
|
18693
|
+
async function runEpisodeLogOutcome(options) {
|
|
18694
|
+
if (!options.rec || !options.brand || !options.description) {
|
|
18695
|
+
console.error(
|
|
18696
|
+
"bamboo-agents: `episode log-outcome` requires --rec, --brand, and --description."
|
|
18697
|
+
);
|
|
18698
|
+
process.exit(2);
|
|
18699
|
+
}
|
|
18700
|
+
let metricsBefore;
|
|
18701
|
+
let metricsAfter;
|
|
18702
|
+
if (options.metricsBefore) {
|
|
18703
|
+
try {
|
|
18704
|
+
metricsBefore = JSON.parse(options.metricsBefore);
|
|
18705
|
+
} catch {
|
|
18706
|
+
console.error(`bamboo-agents: --metrics-before must be valid JSON, e.g. '{"cpa": 35}'.`);
|
|
18707
|
+
process.exit(2);
|
|
18708
|
+
}
|
|
18709
|
+
}
|
|
18710
|
+
if (options.metricsAfter) {
|
|
18711
|
+
try {
|
|
18712
|
+
metricsAfter = JSON.parse(options.metricsAfter);
|
|
18713
|
+
} catch {
|
|
18714
|
+
console.error(`bamboo-agents: --metrics-after must be valid JSON, e.g. '{"cpa": 31}'.`);
|
|
18715
|
+
process.exit(2);
|
|
18716
|
+
}
|
|
18717
|
+
}
|
|
18718
|
+
const session = await requireSession10();
|
|
18719
|
+
let result;
|
|
18720
|
+
try {
|
|
18721
|
+
result = await postOutcomeEpisode(session, {
|
|
18722
|
+
brand_id: options.brand,
|
|
18723
|
+
parent_episode_id: options.rec,
|
|
18724
|
+
description: options.description,
|
|
18725
|
+
...metricsBefore ? { metrics_before: metricsBefore } : {},
|
|
18726
|
+
...metricsAfter ? { metrics_after: metricsAfter } : {}
|
|
18727
|
+
});
|
|
18728
|
+
} catch (err) {
|
|
18729
|
+
console.error(`bamboo-agents: outcome entry failed: ${err.message}`);
|
|
18730
|
+
process.exit(1);
|
|
18731
|
+
}
|
|
18732
|
+
if (options.json) {
|
|
18733
|
+
console.log(JSON.stringify(result));
|
|
18734
|
+
return;
|
|
18735
|
+
}
|
|
18736
|
+
if (!options.quiet) {
|
|
18737
|
+
console.log("");
|
|
18738
|
+
console.log(` \u2713 Outcome logged \u2014 episode ${result.id}`);
|
|
18739
|
+
console.log(` Chained to rec: ${result.parent_episode_id}`);
|
|
18740
|
+
console.log(` Brand: ${result.brand_id}`);
|
|
18741
|
+
console.log(` Created: ${result.created_at}`);
|
|
18742
|
+
console.log("");
|
|
18743
|
+
}
|
|
18744
|
+
}
|
|
18745
|
+
var init_episode = __esm({
|
|
18746
|
+
"src/commands/episode.ts"() {
|
|
18747
|
+
"use strict";
|
|
18748
|
+
init_credentials();
|
|
18749
|
+
init_api();
|
|
18750
|
+
}
|
|
18751
|
+
});
|
|
18752
|
+
|
|
18644
18753
|
// node_modules/commander/esm.mjs
|
|
18645
18754
|
var import_index = __toESM(require_commander(), 1);
|
|
18646
18755
|
var {
|
|
@@ -19048,6 +19157,13 @@ agents.command("pause <agent>").description("Pause an agent \u2014 stops its sch
|
|
|
19048
19157
|
const { runAgentsPause: runAgentsPause2 } = await Promise.resolve().then(() => (init_agents2(), agents_exports2));
|
|
19049
19158
|
await runAgentsPause2(agent, options);
|
|
19050
19159
|
});
|
|
19160
|
+
var episode = program2.command("episode").description("Pilot decision-ledger \u2014 log outcomes against recommendations");
|
|
19161
|
+
episode.command("log-outcome").description(
|
|
19162
|
+
"Log an outcome episode chained to a recommendation (closes the accept\u2192result loop)"
|
|
19163
|
+
).requiredOption("--rec <uuid>", "Recommendation episode id to chain this outcome to").requiredOption("--brand <id>", "Brand id the recommendation belongs to").requiredOption("--description <text>", "What happened after the recommendation was applied").option("--metrics-before <json>", `JSON object of metrics before the change, e.g. '{"cpa":35}'`).option("--metrics-after <json>", `JSON object of metrics after the change, e.g. '{"cpa":31}'`).option("--json", "Emit a JSON envelope for agent consumption").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (options) => {
|
|
19164
|
+
const { runEpisodeLogOutcome: runEpisodeLogOutcome2 } = await Promise.resolve().then(() => (init_episode(), episode_exports));
|
|
19165
|
+
await runEpisodeLogOutcome2(options);
|
|
19166
|
+
});
|
|
19051
19167
|
(async () => {
|
|
19052
19168
|
const rawArgs = process.argv.slice(2);
|
|
19053
19169
|
const { operands } = program2.parseOptions(rawArgs);
|