bamboo-agents 0.1.9-dev.101.4f25224 → 0.1.9-dev.99.79f8b94
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 +28 -92
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.9-dev.
|
|
1
|
+
0.1.9-dev.99.79f8b94
|
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.9-dev.
|
|
3040
|
+
VERSION = "0.1.9-dev.99.79f8b94";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12756,19 +12756,10 @@ var init_inbox_apply_revision = __esm({
|
|
|
12756
12756
|
});
|
|
12757
12757
|
|
|
12758
12758
|
// ../../src/lib/api-contracts/cli/inbox-management.ts
|
|
12759
|
-
|
|
12760
|
-
if (typeof current !== "string" || typeof reviewed !== "string") return current === reviewed;
|
|
12761
|
-
const canonicalUtc = (value) => value.replace(/\+00:00$/i, "Z");
|
|
12762
|
-
return canonicalUtc(current) === canonicalUtc(reviewed);
|
|
12763
|
-
}
|
|
12764
|
-
var InboxUtcTimestampSchema, InboxOperationSchema, InboxManageOperationSchema, InboxOperationBindingSchema, common, INBOX_MANAGEMENT_BINDINGS, INBOX_EXISTING_COMMAND_BINDINGS, changeCommon, CHANGE_MANAGEMENT_BINDINGS, opportunityCommon, OPPORTUNITY_MANAGEMENT_BINDINGS, annotationCommon, ANNOTATION_MANAGEMENT_BINDINGS, lifecycleMutationInputs, FDE_ACTION_MANAGEMENT_BINDINGS, GRAPH_RECOVERY_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, InboxOrganizationsResponseSchema, OpportunityDecisionInputBaseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, OpportunitySnapshotSchema, OpportunityUnknownReceiptSchema, OpportunityCommandSchema, FdeActionSnapshotSchema, GraphRecoverySnapshotSchema, LifecycleUnknownReceiptSchema, AnnotationSnapshotSchema, AnnotationUnknownReceiptSchema, InboxOperationEnvelopeSchema;
|
|
12759
|
+
var InboxOperationSchema, InboxManageOperationSchema, InboxOperationBindingSchema, common, INBOX_MANAGEMENT_BINDINGS, INBOX_EXISTING_COMMAND_BINDINGS, changeCommon, CHANGE_MANAGEMENT_BINDINGS, opportunityCommon, OPPORTUNITY_MANAGEMENT_BINDINGS, annotationCommon, ANNOTATION_MANAGEMENT_BINDINGS, lifecycleMutationInputs, FDE_ACTION_MANAGEMENT_BINDINGS, GRAPH_RECOVERY_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, OpportunityDecisionInputBaseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, OpportunitySnapshotSchema, OpportunityUnknownReceiptSchema, OpportunityCommandSchema, FdeActionSnapshotSchema, GraphRecoverySnapshotSchema, LifecycleUnknownReceiptSchema, AnnotationSnapshotSchema, AnnotationUnknownReceiptSchema, InboxOperationEnvelopeSchema;
|
|
12765
12760
|
var init_inbox_management = __esm({
|
|
12766
12761
|
"../../src/lib/api-contracts/cli/inbox-management.ts"() {
|
|
12767
12762
|
init_zod();
|
|
12768
|
-
InboxUtcTimestampSchema = external_exports.string().datetime({ offset: true }).refine(
|
|
12769
|
-
(value) => /(?:Z|\+00:00)$/i.test(value),
|
|
12770
|
-
"source version must use UTC (Z or +00:00)"
|
|
12771
|
-
);
|
|
12772
12763
|
InboxOperationSchema = external_exports.enum([
|
|
12773
12764
|
"inbox.list",
|
|
12774
12765
|
"inbox.get",
|
|
@@ -13545,17 +13536,10 @@ var init_inbox_management = __esm({
|
|
|
13545
13536
|
bindings: external_exports.array(InboxOperationBindingSchema),
|
|
13546
13537
|
related_cli_commands: external_exports.array(external_exports.string())
|
|
13547
13538
|
});
|
|
13548
|
-
InboxOrganizationsResponseSchema = external_exports.object({
|
|
13549
|
-
orgs: external_exports.array(external_exports.object({
|
|
13550
|
-
id: external_exports.string().uuid(),
|
|
13551
|
-
name: external_exports.string().min(1),
|
|
13552
|
-
status: external_exports.string()
|
|
13553
|
-
}))
|
|
13554
|
-
});
|
|
13555
13539
|
OpportunityDecisionInputBaseSchema = external_exports.object({
|
|
13556
13540
|
opportunity_id: external_exports.string().uuid(),
|
|
13557
13541
|
brand_id: external_exports.string().uuid().optional(),
|
|
13558
|
-
source_version:
|
|
13542
|
+
source_version: external_exports.string().datetime(),
|
|
13559
13543
|
command_id: external_exports.string().min(1).max(128),
|
|
13560
13544
|
reason: external_exports.string().trim().min(1),
|
|
13561
13545
|
approved: external_exports.literal(true),
|
|
@@ -13716,7 +13700,7 @@ var init_inbox_management = __esm({
|
|
|
13716
13700
|
input: external_exports.object({
|
|
13717
13701
|
opportunity_id: external_exports.string().uuid(),
|
|
13718
13702
|
brand_id: external_exports.string().uuid().optional(),
|
|
13719
|
-
source_version:
|
|
13703
|
+
source_version: external_exports.string().datetime(),
|
|
13720
13704
|
command_id: external_exports.string().min(1).max(128),
|
|
13721
13705
|
recipient_user_id: external_exports.string().uuid(),
|
|
13722
13706
|
recipient_name: external_exports.string().trim().min(1),
|
|
@@ -13758,7 +13742,7 @@ var init_inbox_management = __esm({
|
|
|
13758
13742
|
input: external_exports.object({
|
|
13759
13743
|
opportunity_id: external_exports.string().uuid(),
|
|
13760
13744
|
brand_id: external_exports.string().uuid().optional(),
|
|
13761
|
-
source_version:
|
|
13745
|
+
source_version: external_exports.string().datetime(),
|
|
13762
13746
|
command_id: external_exports.string().min(1).max(128),
|
|
13763
13747
|
answer: external_exports.string().trim().min(1).max(2e4),
|
|
13764
13748
|
subquestion_key: external_exports.string().trim().min(1).max(240).optional(),
|
|
@@ -13783,7 +13767,7 @@ var init_inbox_management = __esm({
|
|
|
13783
13767
|
input: external_exports.object({
|
|
13784
13768
|
id: external_exports.string().uuid(),
|
|
13785
13769
|
brand_id: external_exports.string().uuid().optional(),
|
|
13786
|
-
source_version:
|
|
13770
|
+
source_version: external_exports.string().datetime(),
|
|
13787
13771
|
command_id: external_exports.string().min(1).max(128),
|
|
13788
13772
|
command: external_exports.enum([
|
|
13789
13773
|
"assign",
|
|
@@ -15048,18 +15032,6 @@ async function getInboxManagementOperations(session) {
|
|
|
15048
15032
|
throw new ApiError("The Inbox operation catalog response was malformed.", 502, "malformed_response");
|
|
15049
15033
|
}
|
|
15050
15034
|
}
|
|
15051
|
-
async function listInboxOrganizations(session) {
|
|
15052
|
-
const res = await cliApiFetch(`${apiBase()}/api/v1/admin/orgs`, {
|
|
15053
|
-
headers: { Authorization: `Bearer ${session}` }
|
|
15054
|
-
});
|
|
15055
|
-
if (!res.ok) throw await parseError(res);
|
|
15056
|
-
const json = await res.json();
|
|
15057
|
-
try {
|
|
15058
|
-
return InboxOrganizationsResponseSchema.parse(json.data);
|
|
15059
|
-
} catch {
|
|
15060
|
-
throw new ApiError("The organization list response was malformed.", 502, "malformed_response");
|
|
15061
|
-
}
|
|
15062
|
-
}
|
|
15063
15035
|
async function callInboxManagement(session, orgId, call) {
|
|
15064
15036
|
const res = await cliApiFetch(`${apiBase()}/api/v1/inbox/manage`, {
|
|
15065
15037
|
method: "POST",
|
|
@@ -20120,11 +20092,10 @@ var init_knowledge = __esm({
|
|
|
20120
20092
|
var inbox_management_exports = {};
|
|
20121
20093
|
__export(inbox_management_exports, {
|
|
20122
20094
|
runInboxManage: () => runInboxManage,
|
|
20123
|
-
runInboxOperations: () => runInboxOperations
|
|
20124
|
-
runInboxOrganizations: () => runInboxOrganizations
|
|
20095
|
+
runInboxOperations: () => runInboxOperations
|
|
20125
20096
|
});
|
|
20126
20097
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
20127
|
-
async function
|
|
20098
|
+
async function sessionForOrg(org) {
|
|
20128
20099
|
const token = await resolveSession();
|
|
20129
20100
|
if (!token)
|
|
20130
20101
|
throw Object.assign(new Error("Run `bamboo-agents login` first."), {
|
|
@@ -20137,26 +20108,13 @@ async function inboxSession() {
|
|
|
20137
20108
|
),
|
|
20138
20109
|
{ code: "organization_scope_required" }
|
|
20139
20110
|
);
|
|
20111
|
+
if (!org)
|
|
20112
|
+
throw Object.assign(
|
|
20113
|
+
new Error("Pass the customer organization with --org."),
|
|
20114
|
+
{ code: "organization_scope_required" }
|
|
20115
|
+
);
|
|
20140
20116
|
return token;
|
|
20141
20117
|
}
|
|
20142
|
-
async function resolveOrganization(session, requested) {
|
|
20143
|
-
const query = requested.trim();
|
|
20144
|
-
if (!query) throw Object.assign(new Error("Pass the customer organization with --org."), { code: "organization_scope_required" });
|
|
20145
|
-
if (UUID.test(query)) return { id: query, name: void 0 };
|
|
20146
|
-
const { orgs } = await listInboxOrganizations(session);
|
|
20147
|
-
const normalized = query.toLowerCase();
|
|
20148
|
-
const exact = orgs.filter((org) => org.name.toLowerCase() === normalized);
|
|
20149
|
-
const matches = exact.length ? exact : orgs.filter((org) => org.name.toLowerCase().includes(normalized));
|
|
20150
|
-
if (matches.length === 1) return matches[0];
|
|
20151
|
-
if (matches.length === 0) throw Object.assign(
|
|
20152
|
-
new Error(`No organization matches "${query}". Run \`bamboo-agents inbox organizations ${JSON.stringify(query)}\` to inspect available organizations.`),
|
|
20153
|
-
{ code: "organization_scope_not_found" }
|
|
20154
|
-
);
|
|
20155
|
-
throw Object.assign(
|
|
20156
|
-
new Error(`Organization "${query}" is ambiguous: ${matches.map((org) => `${org.name} (${org.id})`).join(", ")}. Re-run with the exact name or UUID.`),
|
|
20157
|
-
{ code: "organization_scope_ambiguous" }
|
|
20158
|
-
);
|
|
20159
|
-
}
|
|
20160
20118
|
async function inputObject(value) {
|
|
20161
20119
|
const raw = value.startsWith("@") ? await readFile8(value.slice(1), "utf8") : value;
|
|
20162
20120
|
const parsed = JSON.parse(raw);
|
|
@@ -20198,25 +20156,9 @@ async function runInboxOperations(options) {
|
|
|
20198
20156
|
fail(error, options);
|
|
20199
20157
|
}
|
|
20200
20158
|
}
|
|
20201
|
-
async function runInboxOrganizations(options) {
|
|
20202
|
-
try {
|
|
20203
|
-
const session = await inboxSession();
|
|
20204
|
-
const { orgs } = await listInboxOrganizations(session);
|
|
20205
|
-
const query = options.query?.trim() ?? "";
|
|
20206
|
-
const normalized = query.toLowerCase();
|
|
20207
|
-
const organizations = query ? orgs.filter((org) => org.name.toLowerCase().includes(normalized) || org.id.toLowerCase().includes(normalized)) : orgs;
|
|
20208
|
-
for (const org of organizations) human(` ${org.name} (${org.id}) [${org.status}]`, options);
|
|
20209
|
-
emitSuccess({ organizations, count: organizations.length, query: query || null }, options);
|
|
20210
|
-
} catch (error) {
|
|
20211
|
-
fail(error, options);
|
|
20212
|
-
}
|
|
20213
|
-
}
|
|
20214
20159
|
async function runInboxManage(options) {
|
|
20215
20160
|
try {
|
|
20216
|
-
const session = await
|
|
20217
|
-
const organization = await resolveOrganization(session, options.org);
|
|
20218
|
-
const orgId = organization.id;
|
|
20219
|
-
if (organization.name) human(`Operating as organization: ${organization.name} (${orgId})`, options);
|
|
20161
|
+
const session = await sessionForOrg(options.org);
|
|
20220
20162
|
if (!InboxManageOperationSchema.safeParse(options.operation).success) {
|
|
20221
20163
|
throw Object.assign(
|
|
20222
20164
|
new Error(`Unsupported Inbox operation: ${options.operation}`),
|
|
@@ -20272,18 +20214,18 @@ async function runInboxManage(options) {
|
|
|
20272
20214
|
});
|
|
20273
20215
|
const preview = await callInboxManagement(
|
|
20274
20216
|
session,
|
|
20275
|
-
|
|
20217
|
+
options.org,
|
|
20276
20218
|
previewCall
|
|
20277
20219
|
);
|
|
20278
|
-
if (preview.scope.org_id !==
|
|
20220
|
+
if (preview.scope.org_id !== options.org)
|
|
20279
20221
|
throw Object.assign(
|
|
20280
20222
|
new Error(
|
|
20281
|
-
`Requested organization ${
|
|
20223
|
+
`Requested organization ${options.org} but server resolved ${preview.scope.org_id}.`
|
|
20282
20224
|
),
|
|
20283
20225
|
{ code: "organization_scope_mismatch" }
|
|
20284
20226
|
);
|
|
20285
20227
|
const suppliedVersion = input.source_version ?? input.subject_revision;
|
|
20286
|
-
if (!isProposal &&
|
|
20228
|
+
if (!isProposal && preview.source_version !== suppliedVersion)
|
|
20287
20229
|
throw Object.assign(
|
|
20288
20230
|
new Error(
|
|
20289
20231
|
`The reviewed source revision ${String(suppliedVersion)} is stale; current revision is ${preview.source_version}.`
|
|
@@ -20310,15 +20252,14 @@ async function runInboxManage(options) {
|
|
|
20310
20252
|
) : String(
|
|
20311
20253
|
input.opportunity_id ?? input.pr_number ?? input.id ?? input.task_id ?? "unknown"
|
|
20312
20254
|
);
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
human(previewSummary, options);
|
|
20255
|
+
human(
|
|
20256
|
+
`Approval preview \u2014 organization: ${preview.scope.org_name} (${preview.scope.org_id}); brand: ${preview.scope.brand_name ?? "all brands"}; operation: ${options.operation}; source item: ${sourceItem}; source version: ${preview.source_version ?? "new proposal"}; effect: ${mutation?.effect ?? "unspecified"}; reversible: ${String(mutation?.reversible ?? "unspecified")}${recipient}${wording}`,
|
|
20257
|
+
options
|
|
20258
|
+
);
|
|
20318
20259
|
if (!options.approve) {
|
|
20319
20260
|
throw Object.assign(
|
|
20320
20261
|
new Error(
|
|
20321
|
-
|
|
20262
|
+
"This operation changes customer state. Review the preview, obtain approval for its exact scope, source version, effect, and reversibility, then re-run with --approve."
|
|
20322
20263
|
),
|
|
20323
20264
|
{ code: "approval_required" }
|
|
20324
20265
|
);
|
|
@@ -20336,11 +20277,11 @@ async function runInboxManage(options) {
|
|
|
20336
20277
|
operation: options.operation,
|
|
20337
20278
|
input
|
|
20338
20279
|
});
|
|
20339
|
-
const result = await callInboxManagement(session,
|
|
20340
|
-
if (result.scope.org_id !==
|
|
20280
|
+
const result = await callInboxManagement(session, options.org, call);
|
|
20281
|
+
if (result.scope.org_id !== options.org)
|
|
20341
20282
|
throw Object.assign(
|
|
20342
20283
|
new Error(
|
|
20343
|
-
`Requested organization ${
|
|
20284
|
+
`Requested organization ${options.org} but server resolved ${result.scope.org_id}.`
|
|
20344
20285
|
),
|
|
20345
20286
|
{ code: "organization_scope_mismatch" }
|
|
20346
20287
|
);
|
|
@@ -20353,7 +20294,7 @@ async function runInboxManage(options) {
|
|
|
20353
20294
|
fail(error, options);
|
|
20354
20295
|
}
|
|
20355
20296
|
}
|
|
20356
|
-
var
|
|
20297
|
+
var MUTATION_EFFECTS, ANNOTATION_COMMAND_EFFECTS;
|
|
20357
20298
|
var init_inbox_management2 = __esm({
|
|
20358
20299
|
"src/commands/inbox-management.ts"() {
|
|
20359
20300
|
"use strict";
|
|
@@ -20362,7 +20303,6 @@ var init_inbox_management2 = __esm({
|
|
|
20362
20303
|
init_api();
|
|
20363
20304
|
init_credentials();
|
|
20364
20305
|
init_output();
|
|
20365
|
-
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;
|
|
20366
20306
|
MUTATION_EFFECTS = {
|
|
20367
20307
|
"change.approve": { effect: "merge_workspace_change", reversible: false },
|
|
20368
20308
|
"change.decline": {
|
|
@@ -22597,11 +22537,7 @@ inbox.command("operations").description("List the supported customer Inbox opera
|
|
|
22597
22537
|
const { runInboxOperations: runInboxOperations2 } = await Promise.resolve().then(() => (init_inbox_management2(), inbox_management_exports));
|
|
22598
22538
|
await runInboxOperations2(options);
|
|
22599
22539
|
});
|
|
22600
|
-
inbox.command("
|
|
22601
|
-
const { runInboxOrganizations: runInboxOrganizations2 } = await Promise.resolve().then(() => (init_inbox_management2(), inbox_management_exports));
|
|
22602
|
-
await runInboxOrganizations2({ query, ...options });
|
|
22603
|
-
});
|
|
22604
|
-
inbox.command("manage").description("Call one catalog-advertised customer Inbox operation").argument("<operation>", "Exact operation name").requiredOption("--input <json-or-@file>", "JSON object, inline or loaded from @path").requiredOption("--org <uuid-or-name>", "Explicit customer organization UUID or unique name").option("--approve", "Confirm the exact displayed mutation after user approval").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").action(async (operation, options) => {
|
|
22540
|
+
inbox.command("manage").description("Call one exact read operation (`inbox.list` or `inbox.get`)").argument("<operation>", "Exact operation name").requiredOption("--input <json-or-@file>", "JSON object, inline or loaded from @path").requiredOption("--org <uuid>", "Explicit customer organization UUID").option("--approve", "Confirm the exact displayed mutation after user approval").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").action(async (operation, options) => {
|
|
22605
22541
|
const { runInboxManage: runInboxManage2 } = await Promise.resolve().then(() => (init_inbox_management2(), inbox_management_exports));
|
|
22606
22542
|
await runInboxManage2({ operation, ...options });
|
|
22607
22543
|
});
|