bamboo-agents 0.1.15-dev.130.15efbf5 → 0.1.15-dev.132.b9d2cf9
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 +112 -37
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.15-dev.
|
|
1
|
+
0.1.15-dev.132.b9d2cf9
|
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.15-dev.
|
|
3040
|
+
VERSION = "0.1.15-dev.132.b9d2cf9";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -13433,6 +13433,10 @@ var init_eval_management = __esm({
|
|
|
13433
13433
|
effective_org_id: external_exports.string(),
|
|
13434
13434
|
real_actor_user_id: external_exports.string().nullable().optional(),
|
|
13435
13435
|
effective_actor_user_id: external_exports.string().nullable().optional(),
|
|
13436
|
+
actor_kind: external_exports.enum(["agent", "fde"]).optional(),
|
|
13437
|
+
actor_agent_id: external_exports.string().nullable().optional(),
|
|
13438
|
+
operator_key_id: external_exports.string().nullable().optional(),
|
|
13439
|
+
issuer_user_id: external_exports.string().nullable().optional(),
|
|
13436
13440
|
credential_kind: external_exports.enum(["user_session", "api_key"]).optional(),
|
|
13437
13441
|
impersonating: external_exports.boolean().optional(),
|
|
13438
13442
|
acting_in_org: external_exports.boolean().optional(),
|
|
@@ -13793,6 +13797,8 @@ var init_inbox_management = __esm({
|
|
|
13793
13797
|
"recipient_mismatch",
|
|
13794
13798
|
"proposal_failed",
|
|
13795
13799
|
"graph_decision_conflict",
|
|
13800
|
+
"audit_opportunity_requires_customer_wording",
|
|
13801
|
+
"shaping_pending",
|
|
13796
13802
|
"opportunity_not_decidable",
|
|
13797
13803
|
"opportunity_applied_receipt_unavailable",
|
|
13798
13804
|
"opportunity_preflight_failed",
|
|
@@ -14144,7 +14150,8 @@ var init_inbox_management = __esm({
|
|
|
14144
14150
|
"graph_decision_assignee_invalid",
|
|
14145
14151
|
"graph_decision_invalid",
|
|
14146
14152
|
"graph_decision_command_id_required",
|
|
14147
|
-
"graph_decision_command_id_too_long"
|
|
14153
|
+
"graph_decision_command_id_too_long",
|
|
14154
|
+
"shaping_pending"
|
|
14148
14155
|
];
|
|
14149
14156
|
OPPORTUNITY_MANAGEMENT_BINDINGS = [
|
|
14150
14157
|
{
|
|
@@ -14208,6 +14215,7 @@ var init_inbox_management = __esm({
|
|
|
14208
14215
|
"brain_opportunity_stale",
|
|
14209
14216
|
"brain_opportunity_assignment_target_invalid",
|
|
14210
14217
|
"missing_assignment",
|
|
14218
|
+
"audit_opportunity_requires_customer_wording",
|
|
14211
14219
|
"wording_mismatch",
|
|
14212
14220
|
"recipient_mismatch",
|
|
14213
14221
|
"graph_decision_conflict",
|
|
@@ -14267,6 +14275,7 @@ var init_inbox_management = __esm({
|
|
|
14267
14275
|
...opportunityCommon.error_codes,
|
|
14268
14276
|
"brain_opportunity_answer_stale_source",
|
|
14269
14277
|
"brain_opportunity_answer_idempotency_conflict",
|
|
14278
|
+
"shaping_pending",
|
|
14270
14279
|
"unknown_outcome"
|
|
14271
14280
|
]
|
|
14272
14281
|
}
|
|
@@ -14862,7 +14871,13 @@ var init_inbox_management = __esm({
|
|
|
14862
14871
|
brand_id: external_exports.string().nullable(),
|
|
14863
14872
|
brand_name: external_exports.string().nullable()
|
|
14864
14873
|
}),
|
|
14865
|
-
actor: external_exports.object({
|
|
14874
|
+
actor: external_exports.object({
|
|
14875
|
+
user_id: external_exports.string(),
|
|
14876
|
+
role: external_exports.string(),
|
|
14877
|
+
actor_kind: external_exports.enum(["agent", "fde"]).optional(),
|
|
14878
|
+
agent_id: external_exports.string().nullable().optional(),
|
|
14879
|
+
key_id: external_exports.string().optional()
|
|
14880
|
+
}),
|
|
14866
14881
|
command_id: external_exports.string().nullable(),
|
|
14867
14882
|
outcome: external_exports.enum(["succeeded", "no_change", "pending", "unknown"])
|
|
14868
14883
|
});
|
|
@@ -15718,12 +15733,19 @@ async function getCliOrganizationScope(session, orgId) {
|
|
|
15718
15733
|
});
|
|
15719
15734
|
if (!res.ok) throw await parseError(res);
|
|
15720
15735
|
const json = await res.json();
|
|
15721
|
-
|
|
15736
|
+
const parsed = external_exports.object({
|
|
15722
15737
|
scope: external_exports.object({
|
|
15723
15738
|
effective_org_id: external_exports.string().uuid(),
|
|
15724
15739
|
effective_org_name: external_exports.string()
|
|
15725
|
-
})
|
|
15726
|
-
|
|
15740
|
+
}),
|
|
15741
|
+
operator: external_exports.object({
|
|
15742
|
+
capability: external_exports.literal("org_operator"),
|
|
15743
|
+
agent_id: external_exports.string().uuid(),
|
|
15744
|
+
key_id: external_exports.string().uuid(),
|
|
15745
|
+
expires_at: external_exports.string()
|
|
15746
|
+
}).optional()
|
|
15747
|
+
}).parse(json);
|
|
15748
|
+
return { ...parsed.scope, ...parsed.operator ? { operator: parsed.operator } : {} };
|
|
15727
15749
|
}
|
|
15728
15750
|
async function callInboxManagement(session, orgId, call) {
|
|
15729
15751
|
const res = await cliApiFetch(`${apiBase()}/api/v1/inbox/manage`, {
|
|
@@ -15786,11 +15808,27 @@ async function cliApiFetch(url, init = {}) {
|
|
|
15786
15808
|
const headers = new Headers(init.headers);
|
|
15787
15809
|
headers.set("User-Agent", userAgent());
|
|
15788
15810
|
headers.set("Bamboo-CLI-Version", VERSION);
|
|
15789
|
-
|
|
15811
|
+
const response = await fetch(url, {
|
|
15790
15812
|
...init,
|
|
15791
15813
|
headers,
|
|
15792
15814
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
15793
15815
|
});
|
|
15816
|
+
warnIfOperatorKeyNearExpiry(response);
|
|
15817
|
+
return response;
|
|
15818
|
+
}
|
|
15819
|
+
function warnIfOperatorKeyNearExpiry(response) {
|
|
15820
|
+
if (operatorExpiryWarningEmitted) return;
|
|
15821
|
+
const expiresAt = response.headers.get("Bamboo-Operator-Key-Expires-At");
|
|
15822
|
+
if (!expiresAt) return;
|
|
15823
|
+
const remainingMs = Date.parse(expiresAt) - Date.now();
|
|
15824
|
+
if (!Number.isFinite(remainingMs) || remainingMs > 14 * 864e5) return;
|
|
15825
|
+
operatorExpiryWarningEmitted = true;
|
|
15826
|
+
console.error(JSON.stringify({
|
|
15827
|
+
warning: "operator_key_expiring",
|
|
15828
|
+
expires_at: expiresAt,
|
|
15829
|
+
days_remaining: Math.max(0, Math.ceil(remainingMs / 864e5)),
|
|
15830
|
+
action: "Ask an FDE to rotate this agent's organization operator key."
|
|
15831
|
+
}));
|
|
15794
15832
|
}
|
|
15795
15833
|
async function getGithubToken(bambooSession) {
|
|
15796
15834
|
const res = await cliApiFetch(`${apiBase()}/api/auth/github/token`, {
|
|
@@ -16508,7 +16546,7 @@ async function postRecEpisode(bambooSession, body) {
|
|
|
16508
16546
|
const json = await res.json();
|
|
16509
16547
|
return CliRecEpisodeResponseSchema.parse(json);
|
|
16510
16548
|
}
|
|
16511
|
-
var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema, SkillCatalogEntrySchema, SkillCatalogResponseSchema, SkillSubscriptionsResponseSchema;
|
|
16549
|
+
var PROD_DEFAULT_BASE, DEV_DEFAULT_BASE, REQUEST_TIMEOUT_MS, ApiError, operatorExpiryWarningEmitted, OAuthRelinkStartResponseSchema, ProvisionWorkspaceResponseSchema, FirstAutoInstalledAgentResponseSchema, SkillCatalogEntrySchema, SkillCatalogResponseSchema, SkillSubscriptionsResponseSchema;
|
|
16512
16550
|
var init_api = __esm({
|
|
16513
16551
|
"src/lib/api.ts"() {
|
|
16514
16552
|
"use strict";
|
|
@@ -16551,6 +16589,7 @@ var init_api = __esm({
|
|
|
16551
16589
|
this.name = "ApiError";
|
|
16552
16590
|
}
|
|
16553
16591
|
};
|
|
16592
|
+
operatorExpiryWarningEmitted = false;
|
|
16554
16593
|
OAuthRelinkStartResponseSchema = external_exports.object({
|
|
16555
16594
|
relink_url: external_exports.string().url()
|
|
16556
16595
|
});
|
|
@@ -18593,6 +18632,45 @@ var init_orchestrator = __esm({
|
|
|
18593
18632
|
}
|
|
18594
18633
|
});
|
|
18595
18634
|
|
|
18635
|
+
// src/commands/auth-status.ts
|
|
18636
|
+
var auth_status_exports = {};
|
|
18637
|
+
__export(auth_status_exports, {
|
|
18638
|
+
runAuthStatus: () => runAuthStatus
|
|
18639
|
+
});
|
|
18640
|
+
async function runAuthStatus(options) {
|
|
18641
|
+
try {
|
|
18642
|
+
const credential = await resolveSession();
|
|
18643
|
+
if (!credential) {
|
|
18644
|
+
emitError({ code: "authentication_required", message: "Set BAMBOO_API_TOKEN or run bamboo-agents login." }, options, 1);
|
|
18645
|
+
return;
|
|
18646
|
+
}
|
|
18647
|
+
const scope = await getCliOrganizationScope(credential);
|
|
18648
|
+
const status = {
|
|
18649
|
+
credential_kind: credential.startsWith("bam_") ? "api_key" : "user_session",
|
|
18650
|
+
organization: { id: scope.effective_org_id, name: scope.effective_org_name },
|
|
18651
|
+
operator: scope.operator ?? null
|
|
18652
|
+
};
|
|
18653
|
+
human(`Organization: ${scope.effective_org_name} (${scope.effective_org_id})`, options);
|
|
18654
|
+
if (scope.operator) {
|
|
18655
|
+
human(`Agent: ${scope.operator.agent_id}`, options);
|
|
18656
|
+
human(`Capability: ${scope.operator.capability}`, options);
|
|
18657
|
+
human(`Key: ${scope.operator.key_id} (expires ${scope.operator.expires_at})`, options);
|
|
18658
|
+
}
|
|
18659
|
+
emitSuccess(status, options);
|
|
18660
|
+
} catch (error) {
|
|
18661
|
+
const value = error;
|
|
18662
|
+
emitError({ code: value.code ?? value.errorCode ?? "auth_status_failed", message: value.message ?? "Could not verify Bamboo authentication." }, options, 1);
|
|
18663
|
+
}
|
|
18664
|
+
}
|
|
18665
|
+
var init_auth_status2 = __esm({
|
|
18666
|
+
"src/commands/auth-status.ts"() {
|
|
18667
|
+
"use strict";
|
|
18668
|
+
init_api();
|
|
18669
|
+
init_credentials();
|
|
18670
|
+
init_output();
|
|
18671
|
+
}
|
|
18672
|
+
});
|
|
18673
|
+
|
|
18596
18674
|
// src/lib/claude-desktop.ts
|
|
18597
18675
|
import { execFile as execFile7 } from "node:child_process";
|
|
18598
18676
|
import { platform as platform4 } from "node:os";
|
|
@@ -20955,10 +21033,25 @@ async function resolveOrganizationSelection(requested, listOrganizations) {
|
|
|
20955
21033
|
{ code: "organization_scope_ambiguous" }
|
|
20956
21034
|
);
|
|
20957
21035
|
}
|
|
21036
|
+
async function resolveCredentialOrganization(session, selector) {
|
|
21037
|
+
if (!session.startsWith("bam_")) {
|
|
21038
|
+
if (!selector) throw Object.assign(new Error("Pass the customer organization with --org."), { code: "organization_scope_required" });
|
|
21039
|
+
return resolveOrganizationSelection(selector, () => listInboxOrganizations(session));
|
|
21040
|
+
}
|
|
21041
|
+
const bound = await getCliOrganizationScope(session);
|
|
21042
|
+
if (selector) {
|
|
21043
|
+
const requested = selector.trim().toLowerCase();
|
|
21044
|
+
if (requested !== bound.effective_org_id.toLowerCase() && requested !== bound.effective_org_name.toLowerCase()) {
|
|
21045
|
+
throw Object.assign(new Error("This API key is bound to a different organization."), { code: "organization_scope_mismatch" });
|
|
21046
|
+
}
|
|
21047
|
+
}
|
|
21048
|
+
return { id: bound.effective_org_id, name: bound.effective_org_name };
|
|
21049
|
+
}
|
|
20958
21050
|
var UUID;
|
|
20959
21051
|
var init_organization_selection = __esm({
|
|
20960
21052
|
"src/lib/organization-selection.ts"() {
|
|
20961
21053
|
"use strict";
|
|
21054
|
+
init_api();
|
|
20962
21055
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
20963
21056
|
}
|
|
20964
21057
|
});
|
|
@@ -20978,13 +21071,6 @@ async function inboxSession() {
|
|
|
20978
21071
|
throw Object.assign(new Error("Run `bamboo-agents login` first."), {
|
|
20979
21072
|
code: "authentication_required"
|
|
20980
21073
|
});
|
|
20981
|
-
if (token.startsWith("bam_"))
|
|
20982
|
-
throw Object.assign(
|
|
20983
|
-
new Error(
|
|
20984
|
-
"Cross-customer Inbox operations require a user session; API keys cannot switch organizations."
|
|
20985
|
-
),
|
|
20986
|
-
{ code: "organization_scope_required" }
|
|
20987
|
-
);
|
|
20988
21074
|
return token;
|
|
20989
21075
|
}
|
|
20990
21076
|
async function inputObject(value) {
|
|
@@ -21031,7 +21117,7 @@ async function runInboxOperations(options) {
|
|
|
21031
21117
|
async function runInboxOrganizations(options) {
|
|
21032
21118
|
try {
|
|
21033
21119
|
const session = await inboxSession();
|
|
21034
|
-
const { orgs } = await listInboxOrganizations(session);
|
|
21120
|
+
const { orgs } = session.startsWith("bam_") ? { orgs: [await getCliOrganizationScope(session)].map((scope) => ({ id: scope.effective_org_id, name: scope.effective_org_name, status: "bound" })) } : await listInboxOrganizations(session);
|
|
21035
21121
|
const query = options.query?.trim() ?? "";
|
|
21036
21122
|
const normalized = query.toLowerCase();
|
|
21037
21123
|
const organizations = query ? orgs.filter((org) => org.name.toLowerCase().includes(normalized) || org.id.toLowerCase().includes(normalized)) : orgs;
|
|
@@ -21044,10 +21130,7 @@ async function runInboxOrganizations(options) {
|
|
|
21044
21130
|
async function runInboxMembers(options) {
|
|
21045
21131
|
try {
|
|
21046
21132
|
const session = await inboxSession();
|
|
21047
|
-
const organization = await
|
|
21048
|
-
options.org,
|
|
21049
|
-
() => listInboxOrganizations(session)
|
|
21050
|
-
);
|
|
21133
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
21051
21134
|
const result = await listInboxMembers(session, organization.id);
|
|
21052
21135
|
if (result.scope.org_id !== organization.id) {
|
|
21053
21136
|
throw Object.assign(
|
|
@@ -21083,10 +21166,7 @@ async function runInboxMembers(options) {
|
|
|
21083
21166
|
async function runInboxManage(options) {
|
|
21084
21167
|
try {
|
|
21085
21168
|
const session = await inboxSession();
|
|
21086
|
-
const organization = await
|
|
21087
|
-
options.org,
|
|
21088
|
-
() => listInboxOrganizations(session)
|
|
21089
|
-
);
|
|
21169
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
21090
21170
|
const orgId = organization.id;
|
|
21091
21171
|
if (organization.name) human(`Operating as organization: ${organization.name} (${orgId})`, options);
|
|
21092
21172
|
if (!InboxManageOperationSchema.safeParse(options.operation).success) {
|
|
@@ -21190,7 +21270,7 @@ async function runInboxManage(options) {
|
|
|
21190
21270
|
if (!options.approve) {
|
|
21191
21271
|
throw Object.assign(
|
|
21192
21272
|
new Error(
|
|
21193
|
-
`${options.quiet ? `${previewSummary}. ` : ""}This operation changes customer state. Review the preview
|
|
21273
|
+
`${options.quiet ? `${previewSummary}. ` : ""}This operation changes customer state. Review the preview and re-run with --approve to acknowledge its exact scope, source version, effect, and reversibility.`
|
|
21194
21274
|
),
|
|
21195
21275
|
{ code: "approval_required" }
|
|
21196
21276
|
);
|
|
@@ -22713,10 +22793,7 @@ import { readFile as readFile10 } from "node:fs/promises";
|
|
|
22713
22793
|
async function runEvalScope(options) {
|
|
22714
22794
|
const session = await requireSession12(options);
|
|
22715
22795
|
try {
|
|
22716
|
-
const organization = await
|
|
22717
|
-
options.org,
|
|
22718
|
-
() => listInboxOrganizations(session)
|
|
22719
|
-
);
|
|
22796
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
22720
22797
|
const [brandResult, agentResult] = await Promise.all([
|
|
22721
22798
|
listCliBrands(session, organization.id),
|
|
22722
22799
|
listCliAgents(session, organization.id)
|
|
@@ -22774,10 +22851,7 @@ async function parseInput(value) {
|
|
|
22774
22851
|
async function runEvalOperations(options) {
|
|
22775
22852
|
const session = await requireSession12(options);
|
|
22776
22853
|
try {
|
|
22777
|
-
const organization = options.org ? await
|
|
22778
|
-
options.org,
|
|
22779
|
-
() => listInboxOrganizations(session)
|
|
22780
|
-
) : null;
|
|
22854
|
+
const organization = options.org || session.startsWith("bam_") ? await resolveCredentialOrganization(session, options.org) : null;
|
|
22781
22855
|
const catalog = organization ? await getEvalManagementOperations(session, organization.id) : await getEvalManagementOperations(session);
|
|
22782
22856
|
human("", options);
|
|
22783
22857
|
for (const binding of catalog.bindings) {
|
|
@@ -22816,10 +22890,7 @@ async function runEvalManage(options) {
|
|
|
22816
22890
|
const session = await requireSession12(output);
|
|
22817
22891
|
try {
|
|
22818
22892
|
const input = await parseInput(options.input);
|
|
22819
|
-
const organization = options.org ? await
|
|
22820
|
-
options.org,
|
|
22821
|
-
() => listInboxOrganizations(session)
|
|
22822
|
-
) : null;
|
|
22893
|
+
const organization = options.org || session.startsWith("bam_") ? await resolveCredentialOrganization(session, options.org) : null;
|
|
22823
22894
|
const call = EvalManagementCallSchema.parse({
|
|
22824
22895
|
operation: options.operation,
|
|
22825
22896
|
input
|
|
@@ -23709,6 +23780,10 @@ program2.command("login").description("Sign in to Bamboo via your browser (or us
|
|
|
23709
23780
|
const { runLogin: runLogin2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
23710
23781
|
await runLogin2();
|
|
23711
23782
|
});
|
|
23783
|
+
program2.command("auth").description("Inspect the active Bamboo credential").command("status").description("Show the bound organization, agent, capability, and key expiry").option("--json", "Emit a JSON envelope").option("--quiet", "Suppress human chatter").action(async (options) => {
|
|
23784
|
+
const { runAuthStatus: runAuthStatus2 } = await Promise.resolve().then(() => (init_auth_status2(), auth_status_exports));
|
|
23785
|
+
await runAuthStatus2(options);
|
|
23786
|
+
});
|
|
23712
23787
|
program2.command("init").description("Clone your workspace + set up git credentials").option(
|
|
23713
23788
|
"--reset",
|
|
23714
23789
|
"Delete the existing workspace clone and start over (prompts for confirmation)"
|