bamboo-agents 0.1.5-dev.64.96d1b4d → 0.1.5-dev.65.b4a6bfe
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 +195 -5
- 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.65.b4a6bfe
|
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.65.b4a6bfe";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12646,11 +12646,92 @@ var init_install_token = __esm({
|
|
|
12646
12646
|
}
|
|
12647
12647
|
});
|
|
12648
12648
|
|
|
12649
|
-
// ../../src/lib/api-contracts/
|
|
12650
|
-
var
|
|
12649
|
+
// ../../src/lib/api-contracts/episodes/index.ts
|
|
12650
|
+
var KnowledgeCiteSchema, EpisodeCiteSchema, NoPriorHistoryCiteSchema, CiteSchema, CitesArraySchema, InsightBodySchema, RecommendationBodySchema, ActionBodySchema, OutcomeBodySchema, FeedbackBodySchema, EpisodeBaseFields, EpisodeInsertSchema, EpisodeRowSchema;
|
|
12651
12651
|
var init_episodes = __esm({
|
|
12652
|
+
"../../src/lib/api-contracts/episodes/index.ts"() {
|
|
12653
|
+
init_zod();
|
|
12654
|
+
KnowledgeCiteSchema = external_exports.object({
|
|
12655
|
+
/** Repo-relative path, e.g. `brands/acme/knowledge/competitors.md`. */
|
|
12656
|
+
path: external_exports.string().min(1).max(512),
|
|
12657
|
+
/** Verbatim excerpt from the file (validated at write time against blob). */
|
|
12658
|
+
excerpt: external_exports.string().min(1).max(2e3),
|
|
12659
|
+
/** Git SHA of the commit where this excerpt was read. */
|
|
12660
|
+
sha: external_exports.string().min(7).max(64)
|
|
12661
|
+
});
|
|
12662
|
+
EpisodeCiteSchema = external_exports.object({
|
|
12663
|
+
/** Back-reference to a prior episode (e.g. outcome cites recommendation). */
|
|
12664
|
+
episode_id: external_exports.string().uuid()
|
|
12665
|
+
});
|
|
12666
|
+
NoPriorHistoryCiteSchema = external_exports.object({
|
|
12667
|
+
kind: external_exports.literal("no-prior-history")
|
|
12668
|
+
});
|
|
12669
|
+
CiteSchema = external_exports.union([KnowledgeCiteSchema, EpisodeCiteSchema, NoPriorHistoryCiteSchema]);
|
|
12670
|
+
CitesArraySchema = external_exports.array(CiteSchema);
|
|
12671
|
+
InsightBodySchema = external_exports.object({
|
|
12672
|
+
/** Short summary of the insight. */
|
|
12673
|
+
summary: external_exports.string().min(1).max(4e3),
|
|
12674
|
+
findings: external_exports.array(external_exports.record(external_exports.unknown())).optional()
|
|
12675
|
+
});
|
|
12676
|
+
RecommendationBodySchema = external_exports.object({
|
|
12677
|
+
/** Short imperative title, e.g. "Increase Budget on Brand Campaigns". */
|
|
12678
|
+
title: external_exports.string().min(1).max(500),
|
|
12679
|
+
/** Explanation grounded in evidence. */
|
|
12680
|
+
rationale: external_exports.string().min(1).max(8e3),
|
|
12681
|
+
action_items: external_exports.array(external_exports.string().max(1e3)).optional()
|
|
12682
|
+
});
|
|
12683
|
+
ActionBodySchema = external_exports.object({
|
|
12684
|
+
/** Human-readable description of the action taken. */
|
|
12685
|
+
description: external_exports.string().min(1).max(4e3),
|
|
12686
|
+
tool_calls: external_exports.array(external_exports.record(external_exports.unknown())).optional()
|
|
12687
|
+
});
|
|
12688
|
+
OutcomeBodySchema = external_exports.object({
|
|
12689
|
+
/** What happened after the action was taken. */
|
|
12690
|
+
description: external_exports.string().min(1).max(4e3),
|
|
12691
|
+
metrics_before: external_exports.record(external_exports.unknown()).optional(),
|
|
12692
|
+
metrics_after: external_exports.record(external_exports.unknown()).optional()
|
|
12693
|
+
});
|
|
12694
|
+
FeedbackBodySchema = external_exports.object({
|
|
12695
|
+
/** true = approved, false = declined. */
|
|
12696
|
+
approved: external_exports.boolean(),
|
|
12697
|
+
/** Free-form reason, especially on decline. */
|
|
12698
|
+
reason: external_exports.string().max(2e3).optional(),
|
|
12699
|
+
/** Links this feedback episode to the conversation where the user responded. */
|
|
12700
|
+
conversation_id: external_exports.string().uuid().optional()
|
|
12701
|
+
});
|
|
12702
|
+
EpisodeBaseFields = external_exports.object({
|
|
12703
|
+
org_id: external_exports.string().uuid(),
|
|
12704
|
+
brand_id: external_exports.string().uuid(),
|
|
12705
|
+
agent_id: external_exports.string().uuid().optional(),
|
|
12706
|
+
conversation_id: external_exports.string().uuid().optional(),
|
|
12707
|
+
trace_id: external_exports.string().max(256).optional(),
|
|
12708
|
+
parent_episode_id: external_exports.string().uuid().optional(),
|
|
12709
|
+
cites: CitesArraySchema.optional().default([]),
|
|
12710
|
+
idempotency_key: external_exports.string().min(1).max(256).optional()
|
|
12711
|
+
});
|
|
12712
|
+
EpisodeInsertSchema = external_exports.discriminatedUnion("type", [
|
|
12713
|
+
EpisodeBaseFields.extend({ type: external_exports.literal("insight"), body: InsightBodySchema }),
|
|
12714
|
+
EpisodeBaseFields.extend({ type: external_exports.literal("recommendation"), body: RecommendationBodySchema }),
|
|
12715
|
+
EpisodeBaseFields.extend({ type: external_exports.literal("action"), body: ActionBodySchema }),
|
|
12716
|
+
EpisodeBaseFields.extend({ type: external_exports.literal("outcome"), body: OutcomeBodySchema }),
|
|
12717
|
+
EpisodeBaseFields.extend({ type: external_exports.literal("feedback"), body: FeedbackBodySchema })
|
|
12718
|
+
]);
|
|
12719
|
+
EpisodeRowSchema = EpisodeBaseFields.extend({
|
|
12720
|
+
id: external_exports.string().uuid(),
|
|
12721
|
+
type: external_exports.enum(["insight", "recommendation", "action", "outcome", "feedback"]),
|
|
12722
|
+
body: external_exports.record(external_exports.unknown()),
|
|
12723
|
+
cites: CitesArraySchema,
|
|
12724
|
+
created_at: external_exports.string().datetime()
|
|
12725
|
+
});
|
|
12726
|
+
}
|
|
12727
|
+
});
|
|
12728
|
+
|
|
12729
|
+
// ../../src/lib/api-contracts/cli/episodes.ts
|
|
12730
|
+
var CliOutcomeEpisodeRequestSchema, CliOutcomeEpisodeResponseSchema, CliRecEpisodeRequestSchema, CliRecEpisodeResponseSchema;
|
|
12731
|
+
var init_episodes2 = __esm({
|
|
12652
12732
|
"../../src/lib/api-contracts/cli/episodes.ts"() {
|
|
12653
12733
|
init_zod();
|
|
12734
|
+
init_episodes();
|
|
12654
12735
|
CliOutcomeEpisodeRequestSchema = external_exports.object({
|
|
12655
12736
|
brand_id: external_exports.string().uuid(),
|
|
12656
12737
|
/** The recommendation episode this outcome follows. */
|
|
@@ -12665,6 +12746,19 @@ var init_episodes = __esm({
|
|
|
12665
12746
|
parent_episode_id: external_exports.string().uuid(),
|
|
12666
12747
|
created_at: external_exports.string()
|
|
12667
12748
|
});
|
|
12749
|
+
CliRecEpisodeRequestSchema = external_exports.object({
|
|
12750
|
+
brand_id: external_exports.string().uuid(),
|
|
12751
|
+
title: external_exports.string().min(1).max(500),
|
|
12752
|
+
rationale: external_exports.string().min(1).max(8e3),
|
|
12753
|
+
action_items: external_exports.array(external_exports.string().max(1e3)).optional(),
|
|
12754
|
+
cites: CitesArraySchema,
|
|
12755
|
+
conversation_id: external_exports.string().uuid().optional(),
|
|
12756
|
+
idempotency_key: external_exports.string().min(1).max(256).optional()
|
|
12757
|
+
});
|
|
12758
|
+
CliRecEpisodeResponseSchema = external_exports.object({
|
|
12759
|
+
episode_id: external_exports.string().uuid(),
|
|
12760
|
+
is_no_prior_history: external_exports.boolean()
|
|
12761
|
+
});
|
|
12668
12762
|
}
|
|
12669
12763
|
});
|
|
12670
12764
|
|
|
@@ -13159,6 +13253,19 @@ async function postOutcomeEpisode(bambooSession, body) {
|
|
|
13159
13253
|
const json = await res.json();
|
|
13160
13254
|
return CliOutcomeEpisodeResponseSchema.parse(json);
|
|
13161
13255
|
}
|
|
13256
|
+
async function postRecEpisode(bambooSession, body) {
|
|
13257
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/episodes/recommendation`, {
|
|
13258
|
+
method: "POST",
|
|
13259
|
+
headers: {
|
|
13260
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
13261
|
+
"Content-Type": "application/json"
|
|
13262
|
+
},
|
|
13263
|
+
body: JSON.stringify(body)
|
|
13264
|
+
});
|
|
13265
|
+
if (!res.ok) throw await parseError(res);
|
|
13266
|
+
const json = await res.json();
|
|
13267
|
+
return CliRecEpisodeResponseSchema.parse(json);
|
|
13268
|
+
}
|
|
13162
13269
|
var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema, SkillCatalogEntrySchema, SkillCatalogResponseSchema, SkillSubscriptionsResponseSchema, ScaffoldSkillResponseSchema;
|
|
13163
13270
|
var init_api = __esm({
|
|
13164
13271
|
"src/lib/api.ts"() {
|
|
@@ -13182,7 +13289,7 @@ var init_api = __esm({
|
|
|
13182
13289
|
init_onboarding_status();
|
|
13183
13290
|
init_context_health();
|
|
13184
13291
|
init_install_token();
|
|
13185
|
-
|
|
13292
|
+
init_episodes2();
|
|
13186
13293
|
init_version();
|
|
13187
13294
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
13188
13295
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -18680,7 +18787,8 @@ var init_agents2 = __esm({
|
|
|
18680
18787
|
// src/commands/episode.ts
|
|
18681
18788
|
var episode_exports = {};
|
|
18682
18789
|
__export(episode_exports, {
|
|
18683
|
-
runEpisodeLogOutcome: () => runEpisodeLogOutcome
|
|
18790
|
+
runEpisodeLogOutcome: () => runEpisodeLogOutcome,
|
|
18791
|
+
runEpisodeLogRec: () => runEpisodeLogRec
|
|
18684
18792
|
});
|
|
18685
18793
|
async function requireSession10() {
|
|
18686
18794
|
const creds = await readCredentials();
|
|
@@ -18742,6 +18850,76 @@ async function runEpisodeLogOutcome(options) {
|
|
|
18742
18850
|
console.log("");
|
|
18743
18851
|
}
|
|
18744
18852
|
}
|
|
18853
|
+
async function runEpisodeLogRec(options) {
|
|
18854
|
+
if (!options.brand || !options.title || !options.rationale) {
|
|
18855
|
+
console.error(
|
|
18856
|
+
"bamboo-agents: `episode log-rec` requires --brand, --title, and --rationale."
|
|
18857
|
+
);
|
|
18858
|
+
process.exit(2);
|
|
18859
|
+
}
|
|
18860
|
+
if (!options.cites && !options.noPriorHistory) {
|
|
18861
|
+
console.error(
|
|
18862
|
+
"bamboo-agents: `episode log-rec` requires either --cites '<json>' or --no-prior-history."
|
|
18863
|
+
);
|
|
18864
|
+
process.exit(2);
|
|
18865
|
+
}
|
|
18866
|
+
let cites = [];
|
|
18867
|
+
if (options.noPriorHistory) {
|
|
18868
|
+
cites = [{ kind: "no-prior-history" }];
|
|
18869
|
+
} else if (options.cites) {
|
|
18870
|
+
try {
|
|
18871
|
+
cites = JSON.parse(options.cites);
|
|
18872
|
+
if (!Array.isArray(cites)) throw new Error("cites must be a JSON array");
|
|
18873
|
+
} catch (e) {
|
|
18874
|
+
console.error(
|
|
18875
|
+
`bamboo-agents: --cites must be a valid JSON array, e.g. '[{"path":"...","excerpt":"...","sha":"..."}]': ${e.message}`
|
|
18876
|
+
);
|
|
18877
|
+
process.exit(2);
|
|
18878
|
+
}
|
|
18879
|
+
}
|
|
18880
|
+
let actionItems;
|
|
18881
|
+
if (options.actionItems) {
|
|
18882
|
+
try {
|
|
18883
|
+
actionItems = JSON.parse(options.actionItems);
|
|
18884
|
+
if (!Array.isArray(actionItems)) throw new Error("action-items must be a JSON array");
|
|
18885
|
+
} catch (e) {
|
|
18886
|
+
console.error(
|
|
18887
|
+
`bamboo-agents: --action-items must be a valid JSON array of strings: ${e.message}`
|
|
18888
|
+
);
|
|
18889
|
+
process.exit(2);
|
|
18890
|
+
}
|
|
18891
|
+
}
|
|
18892
|
+
const session = await requireSession10();
|
|
18893
|
+
let result;
|
|
18894
|
+
try {
|
|
18895
|
+
result = await postRecEpisode(session, {
|
|
18896
|
+
brand_id: options.brand,
|
|
18897
|
+
title: options.title,
|
|
18898
|
+
rationale: options.rationale,
|
|
18899
|
+
...actionItems ? { action_items: actionItems } : {},
|
|
18900
|
+
cites,
|
|
18901
|
+
...options.conversationId ? { conversation_id: options.conversationId } : {},
|
|
18902
|
+
...options.idempotencyKey ? { idempotency_key: options.idempotencyKey } : {}
|
|
18903
|
+
});
|
|
18904
|
+
} catch (err) {
|
|
18905
|
+
if (options.json) {
|
|
18906
|
+
console.log(JSON.stringify({ ok: false, error: err.message }));
|
|
18907
|
+
} else {
|
|
18908
|
+
console.error(`bamboo-agents: recommendation entry failed: ${err.message}`);
|
|
18909
|
+
}
|
|
18910
|
+
process.exit(1);
|
|
18911
|
+
}
|
|
18912
|
+
if (options.json) {
|
|
18913
|
+
console.log(JSON.stringify({ ok: true, ...result }));
|
|
18914
|
+
return;
|
|
18915
|
+
}
|
|
18916
|
+
if (!options.quiet) {
|
|
18917
|
+
const kind = result.is_no_prior_history ? " (no prior history \u2014 cold start)" : "";
|
|
18918
|
+
console.log("");
|
|
18919
|
+
console.log(` \u2713 Recommendation logged${kind} \u2014 episode ${result.episode_id}`);
|
|
18920
|
+
console.log("");
|
|
18921
|
+
}
|
|
18922
|
+
}
|
|
18745
18923
|
var init_episode = __esm({
|
|
18746
18924
|
"src/commands/episode.ts"() {
|
|
18747
18925
|
"use strict";
|
|
@@ -19164,6 +19342,18 @@ episode.command("log-outcome").description(
|
|
|
19164
19342
|
const { runEpisodeLogOutcome: runEpisodeLogOutcome2 } = await Promise.resolve().then(() => (init_episode(), episode_exports));
|
|
19165
19343
|
await runEpisodeLogOutcome2(options);
|
|
19166
19344
|
});
|
|
19345
|
+
episode.command("log-rec").description(
|
|
19346
|
+
"Log a cited recommendation episode (sandbox-Boo pilot runtime, BAM-2944)"
|
|
19347
|
+
).requiredOption("--brand <id>", "Brand id the recommendation belongs to").requiredOption("--title <text>", "Short imperative title for the recommendation").requiredOption("--rationale <text>", "Explanation grounded in evidence").option(
|
|
19348
|
+
"--cites <json>",
|
|
19349
|
+
"JSON array of citations \u2014 [{path, excerpt, sha}] or [{episode_id}]. Omit when --no-prior-history is set."
|
|
19350
|
+
).option(
|
|
19351
|
+
"--no-prior-history",
|
|
19352
|
+
"Brand has no prior knowledge to cite (cold-start). Mutually exclusive with --cites."
|
|
19353
|
+
).option("--action-items <json>", "Optional JSON array of action item strings").option("--conversation-id <uuid>", "Conversation UUID to link this episode to a Boo session").option("--idempotency-key <key>", "Client key \u2014 same key + same brand returns existing episode").option("--json", "Emit a JSON envelope for agent consumption").option("--quiet", "Suppress human chatter (data/errors only)").action(async (options) => {
|
|
19354
|
+
const { runEpisodeLogRec: runEpisodeLogRec2 } = await Promise.resolve().then(() => (init_episode(), episode_exports));
|
|
19355
|
+
await runEpisodeLogRec2(options);
|
|
19356
|
+
});
|
|
19167
19357
|
(async () => {
|
|
19168
19358
|
const rawArgs = process.argv.slice(2);
|
|
19169
19359
|
const { operands } = program2.parseOptions(rawArgs);
|