bamboo-agents 0.1.15-dev.131.ba9b62e → 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 +106 -36
- 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(),
|
|
@@ -14867,7 +14871,13 @@ var init_inbox_management = __esm({
|
|
|
14867
14871
|
brand_id: external_exports.string().nullable(),
|
|
14868
14872
|
brand_name: external_exports.string().nullable()
|
|
14869
14873
|
}),
|
|
14870
|
-
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
|
+
}),
|
|
14871
14881
|
command_id: external_exports.string().nullable(),
|
|
14872
14882
|
outcome: external_exports.enum(["succeeded", "no_change", "pending", "unknown"])
|
|
14873
14883
|
});
|
|
@@ -15723,12 +15733,19 @@ async function getCliOrganizationScope(session, orgId) {
|
|
|
15723
15733
|
});
|
|
15724
15734
|
if (!res.ok) throw await parseError(res);
|
|
15725
15735
|
const json = await res.json();
|
|
15726
|
-
|
|
15736
|
+
const parsed = external_exports.object({
|
|
15727
15737
|
scope: external_exports.object({
|
|
15728
15738
|
effective_org_id: external_exports.string().uuid(),
|
|
15729
15739
|
effective_org_name: external_exports.string()
|
|
15730
|
-
})
|
|
15731
|
-
|
|
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 } : {} };
|
|
15732
15749
|
}
|
|
15733
15750
|
async function callInboxManagement(session, orgId, call) {
|
|
15734
15751
|
const res = await cliApiFetch(`${apiBase()}/api/v1/inbox/manage`, {
|
|
@@ -15791,11 +15808,27 @@ async function cliApiFetch(url, init = {}) {
|
|
|
15791
15808
|
const headers = new Headers(init.headers);
|
|
15792
15809
|
headers.set("User-Agent", userAgent());
|
|
15793
15810
|
headers.set("Bamboo-CLI-Version", VERSION);
|
|
15794
|
-
|
|
15811
|
+
const response = await fetch(url, {
|
|
15795
15812
|
...init,
|
|
15796
15813
|
headers,
|
|
15797
15814
|
signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS)
|
|
15798
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
|
+
}));
|
|
15799
15832
|
}
|
|
15800
15833
|
async function getGithubToken(bambooSession) {
|
|
15801
15834
|
const res = await cliApiFetch(`${apiBase()}/api/auth/github/token`, {
|
|
@@ -16513,7 +16546,7 @@ async function postRecEpisode(bambooSession, body) {
|
|
|
16513
16546
|
const json = await res.json();
|
|
16514
16547
|
return CliRecEpisodeResponseSchema.parse(json);
|
|
16515
16548
|
}
|
|
16516
|
-
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;
|
|
16517
16550
|
var init_api = __esm({
|
|
16518
16551
|
"src/lib/api.ts"() {
|
|
16519
16552
|
"use strict";
|
|
@@ -16556,6 +16589,7 @@ var init_api = __esm({
|
|
|
16556
16589
|
this.name = "ApiError";
|
|
16557
16590
|
}
|
|
16558
16591
|
};
|
|
16592
|
+
operatorExpiryWarningEmitted = false;
|
|
16559
16593
|
OAuthRelinkStartResponseSchema = external_exports.object({
|
|
16560
16594
|
relink_url: external_exports.string().url()
|
|
16561
16595
|
});
|
|
@@ -18598,6 +18632,45 @@ var init_orchestrator = __esm({
|
|
|
18598
18632
|
}
|
|
18599
18633
|
});
|
|
18600
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
|
+
|
|
18601
18674
|
// src/lib/claude-desktop.ts
|
|
18602
18675
|
import { execFile as execFile7 } from "node:child_process";
|
|
18603
18676
|
import { platform as platform4 } from "node:os";
|
|
@@ -20960,10 +21033,25 @@ async function resolveOrganizationSelection(requested, listOrganizations) {
|
|
|
20960
21033
|
{ code: "organization_scope_ambiguous" }
|
|
20961
21034
|
);
|
|
20962
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
|
+
}
|
|
20963
21050
|
var UUID;
|
|
20964
21051
|
var init_organization_selection = __esm({
|
|
20965
21052
|
"src/lib/organization-selection.ts"() {
|
|
20966
21053
|
"use strict";
|
|
21054
|
+
init_api();
|
|
20967
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;
|
|
20968
21056
|
}
|
|
20969
21057
|
});
|
|
@@ -20983,13 +21071,6 @@ async function inboxSession() {
|
|
|
20983
21071
|
throw Object.assign(new Error("Run `bamboo-agents login` first."), {
|
|
20984
21072
|
code: "authentication_required"
|
|
20985
21073
|
});
|
|
20986
|
-
if (token.startsWith("bam_"))
|
|
20987
|
-
throw Object.assign(
|
|
20988
|
-
new Error(
|
|
20989
|
-
"Cross-customer Inbox operations require a user session; API keys cannot switch organizations."
|
|
20990
|
-
),
|
|
20991
|
-
{ code: "organization_scope_required" }
|
|
20992
|
-
);
|
|
20993
21074
|
return token;
|
|
20994
21075
|
}
|
|
20995
21076
|
async function inputObject(value) {
|
|
@@ -21036,7 +21117,7 @@ async function runInboxOperations(options) {
|
|
|
21036
21117
|
async function runInboxOrganizations(options) {
|
|
21037
21118
|
try {
|
|
21038
21119
|
const session = await inboxSession();
|
|
21039
|
-
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);
|
|
21040
21121
|
const query = options.query?.trim() ?? "";
|
|
21041
21122
|
const normalized = query.toLowerCase();
|
|
21042
21123
|
const organizations = query ? orgs.filter((org) => org.name.toLowerCase().includes(normalized) || org.id.toLowerCase().includes(normalized)) : orgs;
|
|
@@ -21049,10 +21130,7 @@ async function runInboxOrganizations(options) {
|
|
|
21049
21130
|
async function runInboxMembers(options) {
|
|
21050
21131
|
try {
|
|
21051
21132
|
const session = await inboxSession();
|
|
21052
|
-
const organization = await
|
|
21053
|
-
options.org,
|
|
21054
|
-
() => listInboxOrganizations(session)
|
|
21055
|
-
);
|
|
21133
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
21056
21134
|
const result = await listInboxMembers(session, organization.id);
|
|
21057
21135
|
if (result.scope.org_id !== organization.id) {
|
|
21058
21136
|
throw Object.assign(
|
|
@@ -21088,10 +21166,7 @@ async function runInboxMembers(options) {
|
|
|
21088
21166
|
async function runInboxManage(options) {
|
|
21089
21167
|
try {
|
|
21090
21168
|
const session = await inboxSession();
|
|
21091
|
-
const organization = await
|
|
21092
|
-
options.org,
|
|
21093
|
-
() => listInboxOrganizations(session)
|
|
21094
|
-
);
|
|
21169
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
21095
21170
|
const orgId = organization.id;
|
|
21096
21171
|
if (organization.name) human(`Operating as organization: ${organization.name} (${orgId})`, options);
|
|
21097
21172
|
if (!InboxManageOperationSchema.safeParse(options.operation).success) {
|
|
@@ -21195,7 +21270,7 @@ async function runInboxManage(options) {
|
|
|
21195
21270
|
if (!options.approve) {
|
|
21196
21271
|
throw Object.assign(
|
|
21197
21272
|
new Error(
|
|
21198
|
-
`${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.`
|
|
21199
21274
|
),
|
|
21200
21275
|
{ code: "approval_required" }
|
|
21201
21276
|
);
|
|
@@ -22718,10 +22793,7 @@ import { readFile as readFile10 } from "node:fs/promises";
|
|
|
22718
22793
|
async function runEvalScope(options) {
|
|
22719
22794
|
const session = await requireSession12(options);
|
|
22720
22795
|
try {
|
|
22721
|
-
const organization = await
|
|
22722
|
-
options.org,
|
|
22723
|
-
() => listInboxOrganizations(session)
|
|
22724
|
-
);
|
|
22796
|
+
const organization = await resolveCredentialOrganization(session, options.org);
|
|
22725
22797
|
const [brandResult, agentResult] = await Promise.all([
|
|
22726
22798
|
listCliBrands(session, organization.id),
|
|
22727
22799
|
listCliAgents(session, organization.id)
|
|
@@ -22779,10 +22851,7 @@ async function parseInput(value) {
|
|
|
22779
22851
|
async function runEvalOperations(options) {
|
|
22780
22852
|
const session = await requireSession12(options);
|
|
22781
22853
|
try {
|
|
22782
|
-
const organization = options.org ? await
|
|
22783
|
-
options.org,
|
|
22784
|
-
() => listInboxOrganizations(session)
|
|
22785
|
-
) : null;
|
|
22854
|
+
const organization = options.org || session.startsWith("bam_") ? await resolveCredentialOrganization(session, options.org) : null;
|
|
22786
22855
|
const catalog = organization ? await getEvalManagementOperations(session, organization.id) : await getEvalManagementOperations(session);
|
|
22787
22856
|
human("", options);
|
|
22788
22857
|
for (const binding of catalog.bindings) {
|
|
@@ -22821,10 +22890,7 @@ async function runEvalManage(options) {
|
|
|
22821
22890
|
const session = await requireSession12(output);
|
|
22822
22891
|
try {
|
|
22823
22892
|
const input = await parseInput(options.input);
|
|
22824
|
-
const organization = options.org ? await
|
|
22825
|
-
options.org,
|
|
22826
|
-
() => listInboxOrganizations(session)
|
|
22827
|
-
) : null;
|
|
22893
|
+
const organization = options.org || session.startsWith("bam_") ? await resolveCredentialOrganization(session, options.org) : null;
|
|
22828
22894
|
const call = EvalManagementCallSchema.parse({
|
|
22829
22895
|
operation: options.operation,
|
|
22830
22896
|
input
|
|
@@ -23714,6 +23780,10 @@ program2.command("login").description("Sign in to Bamboo via your browser (or us
|
|
|
23714
23780
|
const { runLogin: runLogin2 } = await Promise.resolve().then(() => (init_login(), login_exports));
|
|
23715
23781
|
await runLogin2();
|
|
23716
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
|
+
});
|
|
23717
23787
|
program2.command("init").description("Clone your workspace + set up git credentials").option(
|
|
23718
23788
|
"--reset",
|
|
23719
23789
|
"Delete the existing workspace clone and start over (prompts for confirmation)"
|