bamboo-agents 0.1.8-dev.94.5536fd0 → 0.1.8-dev.95.4c57ace
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 +145 -18
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.8-dev.
|
|
1
|
+
0.1.8-dev.95.4c57ace
|
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.8-dev.
|
|
3040
|
+
VERSION = "0.1.8-dev.95.4c57ace";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -12756,7 +12756,7 @@ var init_inbox_apply_revision = __esm({
|
|
|
12756
12756
|
});
|
|
12757
12757
|
|
|
12758
12758
|
// ../../src/lib/api-contracts/cli/inbox-management.ts
|
|
12759
|
-
var InboxOperationSchema, InboxManageOperationSchema, InboxOperationBindingSchema, common, INBOX_MANAGEMENT_BINDINGS, INBOX_EXISTING_COMMAND_BINDINGS, changeCommon, CHANGE_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, InboxOperationEnvelopeSchema;
|
|
12759
|
+
var InboxOperationSchema, InboxManageOperationSchema, InboxOperationBindingSchema, common, INBOX_MANAGEMENT_BINDINGS, INBOX_EXISTING_COMMAND_BINDINGS, changeCommon, CHANGE_MANAGEMENT_BINDINGS, opportunityCommon, OPPORTUNITY_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, OpportunityDecisionInputBaseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, OpportunitySnapshotSchema, OpportunityUnknownReceiptSchema, OpportunityCommandSchema, InboxOperationEnvelopeSchema;
|
|
12760
12760
|
var init_inbox_management = __esm({
|
|
12761
12761
|
"../../src/lib/api-contracts/cli/inbox-management.ts"() {
|
|
12762
12762
|
init_zod();
|
|
@@ -12771,7 +12771,14 @@ var init_inbox_management = __esm({
|
|
|
12771
12771
|
"change.approve",
|
|
12772
12772
|
"change.decline",
|
|
12773
12773
|
"change.revise",
|
|
12774
|
-
"change.apply_revision"
|
|
12774
|
+
"change.apply_revision",
|
|
12775
|
+
"opportunity.get",
|
|
12776
|
+
"opportunity.propose",
|
|
12777
|
+
"opportunity.assign_and_send",
|
|
12778
|
+
"opportunity.reject",
|
|
12779
|
+
"opportunity.defer",
|
|
12780
|
+
"opportunity.annotate",
|
|
12781
|
+
"opportunity.block"
|
|
12775
12782
|
]);
|
|
12776
12783
|
InboxManageOperationSchema = external_exports.enum([
|
|
12777
12784
|
"inbox.list",
|
|
@@ -12782,12 +12789,19 @@ var init_inbox_management = __esm({
|
|
|
12782
12789
|
"change.approve",
|
|
12783
12790
|
"change.decline",
|
|
12784
12791
|
"change.revise",
|
|
12785
|
-
"change.apply_revision"
|
|
12792
|
+
"change.apply_revision",
|
|
12793
|
+
"opportunity.get",
|
|
12794
|
+
"opportunity.propose",
|
|
12795
|
+
"opportunity.assign_and_send",
|
|
12796
|
+
"opportunity.reject",
|
|
12797
|
+
"opportunity.defer",
|
|
12798
|
+
"opportunity.annotate",
|
|
12799
|
+
"opportunity.block"
|
|
12786
12800
|
]);
|
|
12787
12801
|
InboxOperationBindingSchema = external_exports.object({
|
|
12788
12802
|
operation: InboxOperationSchema,
|
|
12789
12803
|
description: external_exports.string(),
|
|
12790
|
-
work_item_family: external_exports.enum(["inbox", "workspace_change"]),
|
|
12804
|
+
work_item_family: external_exports.enum(["inbox", "workspace_change", "brain_opportunity"]),
|
|
12791
12805
|
method: external_exports.literal("POST"),
|
|
12792
12806
|
path: external_exports.string().startsWith("/api/v1/"),
|
|
12793
12807
|
cli_command: external_exports.string().startsWith("bamboo-agents inbox "),
|
|
@@ -12812,7 +12826,14 @@ var init_inbox_management = __esm({
|
|
|
12812
12826
|
"change_approve_receipt_v1",
|
|
12813
12827
|
"change_decline_receipt_v1",
|
|
12814
12828
|
"change_revise_receipt_v1",
|
|
12815
|
-
"change_apply_revision_receipt_v1"
|
|
12829
|
+
"change_apply_revision_receipt_v1",
|
|
12830
|
+
"opportunity_get_receipt_v1",
|
|
12831
|
+
"opportunity_propose_receipt_v1",
|
|
12832
|
+
"opportunity_send_receipt_v1",
|
|
12833
|
+
"opportunity_reject_receipt_v1",
|
|
12834
|
+
"opportunity_defer_receipt_v1",
|
|
12835
|
+
"opportunity_annotate_receipt_v1",
|
|
12836
|
+
"opportunity_block_receipt_v1"
|
|
12816
12837
|
]),
|
|
12817
12838
|
error_codes: external_exports.array(external_exports.enum([
|
|
12818
12839
|
"authentication_required",
|
|
@@ -12845,7 +12866,14 @@ var init_inbox_management = __esm({
|
|
|
12845
12866
|
"approval_required",
|
|
12846
12867
|
"policy_blocked",
|
|
12847
12868
|
"decline_forbidden",
|
|
12848
|
-
"decline_cross_scope"
|
|
12869
|
+
"decline_cross_scope",
|
|
12870
|
+
"brain_opportunity_stale",
|
|
12871
|
+
"brain_opportunity_assignment_target_invalid",
|
|
12872
|
+
"missing_assignment",
|
|
12873
|
+
"wording_mismatch",
|
|
12874
|
+
"recipient_mismatch",
|
|
12875
|
+
"proposal_failed",
|
|
12876
|
+
"graph_decision_conflict"
|
|
12849
12877
|
])),
|
|
12850
12878
|
minimum_cli_version: external_exports.string()
|
|
12851
12879
|
});
|
|
@@ -12937,11 +12965,33 @@ var init_inbox_management = __esm({
|
|
|
12937
12965
|
{ ...changeCommon, operation: "change.revise", description: "Request a revision against the reviewed head", inputs: { required: ["pr_number", "subject_revision", "command_id", "approved", "approved_effect", "approved_reversible", "feedback", "file"], optional: ["brand_id", "agent_id", "selected_lines"], server_injected: {} }, approval_required: true, side_effect: "dispatches or prepares a pull-request revision", receipt: "revision dispatch or editable head content", receipt_type: "change_revise_receipt_v1", error_codes: [...changeCommon.error_codes, "approval_required", "request_changes_forbidden", "request_changes_cross_scope", "policy_input_failed", "pr_already_merged", "stale_review_task", "idempotency_conflict", "unknown_outcome"] },
|
|
12938
12966
|
{ ...changeCommon, operation: "change.apply_revision", description: "Apply prepared content to the reviewed pull-request head", inputs: { required: ["pr_number", "subject_revision", "command_id", "approved", "approved_effect", "approved_reversible", "file", "new_content", "commit_message", "file_sha"], optional: ["brand_id", "branch"], server_injected: {} }, approval_required: true, side_effect: "commits to the workspace pull-request branch", receipt: "committed branch and PR number", receipt_type: "change_apply_revision_receipt_v1", error_codes: [...changeCommon.error_codes, "approval_required", "request_changes_forbidden", "request_changes_cross_scope", "policy_input_failed", "pr_already_merged", "stale_review_task", "idempotency_conflict", "branch_mismatch", "pr_branch_moved", "commit_failed", "unknown_outcome"] }
|
|
12939
12967
|
];
|
|
12968
|
+
opportunityCommon = {
|
|
12969
|
+
...common,
|
|
12970
|
+
work_item_family: "brain_opportunity",
|
|
12971
|
+
description: "",
|
|
12972
|
+
inputs: { required: ["opportunity_id"], optional: ["brand_id"], server_injected: {} },
|
|
12973
|
+
error_codes: ["authentication_required", "organization_scope_required", "organization_scope_mismatch", "invalid_input", "not_found", "forbidden", "malformed_response"]
|
|
12974
|
+
};
|
|
12975
|
+
OPPORTUNITY_MANAGEMENT_BINDINGS = [
|
|
12976
|
+
{ ...opportunityCommon, operation: "opportunity.get", description: "Inspect one Brain Opportunity at its current source version", receipt: "current opportunity state and approved customer wording", receipt_type: "opportunity_get_receipt_v1" },
|
|
12977
|
+
{ ...opportunityCommon, operation: "opportunity.propose", description: "Add a stable-key proposal to internal FDE review", inputs: { required: ["brand_id", "proposal", "command_id", "approved", "approved_effect", "approved_reversible"], optional: ["agent_id"], server_injected: {} }, approval_required: true, side_effect: "creates one add-only internal-review proposal", receipt: "created or reused internal-review proposal", receipt_type: "opportunity_propose_receipt_v1", error_codes: [...opportunityCommon.error_codes, "proposal_failed", "graph_decision_conflict"] },
|
|
12978
|
+
{ ...opportunityCommon, operation: "opportunity.assign_and_send", description: "Assign and release exact approved wording to one named customer", inputs: { required: ["opportunity_id", "source_version", "command_id", "recipient_user_id", "recipient_name", "approved_wording", "approved", "approved_effect", "approved_reversible"], optional: ["brand_id"], server_injected: {} }, approval_required: true, side_effect: "moves the reviewed opportunity into the named customer's queue", receipt: "sent customer-queue state and command receipt", receipt_type: "opportunity_send_receipt_v1", error_codes: [...opportunityCommon.error_codes, "brain_opportunity_stale", "brain_opportunity_assignment_target_invalid", "missing_assignment", "wording_mismatch", "recipient_mismatch", "graph_decision_conflict"] },
|
|
12979
|
+
...["reject", "defer", "annotate", "block"].map((decision) => ({ ...opportunityCommon, operation: `opportunity.${decision}`, description: `${decision} one reviewed Brain Opportunity`, inputs: { required: ["opportunity_id", "source_version", "command_id", "reason", "approved", "approved_effect", "approved_reversible"], optional: ["brand_id"], server_injected: {} }, approval_required: true, side_effect: `${decision}s the internal-review opportunity`, receipt: `${decision} decision and source read-back`, receipt_type: `opportunity_${decision}_receipt_v1`, error_codes: [...opportunityCommon.error_codes, "brain_opportunity_stale", "graph_decision_conflict"] }))
|
|
12980
|
+
];
|
|
12940
12981
|
InboxManagementCatalogResponseSchema = external_exports.object({
|
|
12941
12982
|
contract_version: external_exports.literal(1),
|
|
12942
12983
|
bindings: external_exports.array(InboxOperationBindingSchema),
|
|
12943
12984
|
related_cli_commands: external_exports.array(external_exports.string())
|
|
12944
12985
|
});
|
|
12986
|
+
OpportunityDecisionInputBaseSchema = external_exports.object({
|
|
12987
|
+
opportunity_id: external_exports.string().uuid(),
|
|
12988
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
12989
|
+
source_version: external_exports.string().datetime(),
|
|
12990
|
+
command_id: external_exports.string().min(1).max(128),
|
|
12991
|
+
reason: external_exports.string().trim().min(1),
|
|
12992
|
+
approved: external_exports.literal(true),
|
|
12993
|
+
approved_reversible: external_exports.literal(true)
|
|
12994
|
+
});
|
|
12945
12995
|
InboxManagementCallSchema = external_exports.discriminatedUnion("operation", [
|
|
12946
12996
|
external_exports.object({
|
|
12947
12997
|
operation: external_exports.literal("inbox.list"),
|
|
@@ -12986,7 +13036,48 @@ var init_inbox_management = __esm({
|
|
|
12986
13036
|
file_sha: external_exports.string().min(1).max(64),
|
|
12987
13037
|
branch: external_exports.string().optional(),
|
|
12988
13038
|
brand_id: external_exports.string().uuid().optional()
|
|
12989
|
-
}) })
|
|
13039
|
+
}) }),
|
|
13040
|
+
external_exports.object({ operation: external_exports.literal("opportunity.get"), input: external_exports.object({ opportunity_id: external_exports.string().uuid(), brand_id: external_exports.string().uuid().optional(), command_id: external_exports.string().min(1).max(128).optional() }) }),
|
|
13041
|
+
external_exports.object({ operation: external_exports.literal("opportunity.propose"), input: external_exports.object({
|
|
13042
|
+
brand_id: external_exports.string().uuid(),
|
|
13043
|
+
agent_id: external_exports.string().uuid().nullable().optional(),
|
|
13044
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13045
|
+
approved: external_exports.literal(true),
|
|
13046
|
+
approved_effect: external_exports.literal("create_internal_opportunity_proposal"),
|
|
13047
|
+
approved_reversible: external_exports.literal(true),
|
|
13048
|
+
proposal: external_exports.object({
|
|
13049
|
+
opportunity_key: external_exports.string().min(1).max(240).optional(),
|
|
13050
|
+
title: external_exports.string().trim().min(1).max(500),
|
|
13051
|
+
function_key: external_exports.string().nullable().optional(),
|
|
13052
|
+
expectation_keys: external_exports.array(external_exports.string()).optional(),
|
|
13053
|
+
module_order: external_exports.number().int().optional(),
|
|
13054
|
+
priority: external_exports.enum(["high", "medium", "low"]),
|
|
13055
|
+
summary: external_exports.string(),
|
|
13056
|
+
why_it_matters: external_exports.string(),
|
|
13057
|
+
expected_artifacts: external_exports.array(external_exports.string()),
|
|
13058
|
+
subquestions: external_exports.array(external_exports.object({ key: external_exports.string(), prompt: external_exports.string(), purpose: external_exports.string(), required: external_exports.boolean() })),
|
|
13059
|
+
evidence: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())),
|
|
13060
|
+
open_questions: external_exports.array(external_exports.string()),
|
|
13061
|
+
source: external_exports.string().min(1),
|
|
13062
|
+
proposed_assignee_user_id: external_exports.string().uuid().nullable().optional()
|
|
13063
|
+
})
|
|
13064
|
+
}) }),
|
|
13065
|
+
external_exports.object({ operation: external_exports.literal("opportunity.assign_and_send"), input: external_exports.object({
|
|
13066
|
+
opportunity_id: external_exports.string().uuid(),
|
|
13067
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13068
|
+
source_version: external_exports.string().datetime(),
|
|
13069
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13070
|
+
recipient_user_id: external_exports.string().uuid(),
|
|
13071
|
+
recipient_name: external_exports.string().trim().min(1),
|
|
13072
|
+
approved_wording: external_exports.object({ title: external_exports.string(), questions: external_exports.array(external_exports.string()) }),
|
|
13073
|
+
approved: external_exports.literal(true),
|
|
13074
|
+
approved_effect: external_exports.literal("assign_and_release_customer_opportunity"),
|
|
13075
|
+
approved_reversible: external_exports.literal(true)
|
|
13076
|
+
}) }),
|
|
13077
|
+
external_exports.object({ operation: external_exports.literal("opportunity.reject"), input: OpportunityDecisionInputBaseSchema.extend({ approved_effect: external_exports.literal("reject_internal_opportunity") }) }),
|
|
13078
|
+
external_exports.object({ operation: external_exports.literal("opportunity.defer"), input: OpportunityDecisionInputBaseSchema.extend({ approved_effect: external_exports.literal("defer_internal_opportunity") }) }),
|
|
13079
|
+
external_exports.object({ operation: external_exports.literal("opportunity.annotate"), input: OpportunityDecisionInputBaseSchema.extend({ approved_effect: external_exports.literal("annotate_internal_opportunity") }) }),
|
|
13080
|
+
external_exports.object({ operation: external_exports.literal("opportunity.block"), input: OpportunityDecisionInputBaseSchema.extend({ approved_effect: external_exports.literal("block_internal_opportunity") }) })
|
|
12990
13081
|
]);
|
|
12991
13082
|
InboxWorkItemSchema = external_exports.object({
|
|
12992
13083
|
id: external_exports.string(),
|
|
@@ -13034,6 +13125,22 @@ var init_inbox_management = __esm({
|
|
|
13034
13125
|
external_exports.object({ state: external_exports.literal("verified"), head_sha: external_exports.string(), pr_state: external_exports.string(), merged: external_exports.boolean() }),
|
|
13035
13126
|
external_exports.object({ state: external_exports.literal("unavailable"), instruction: external_exports.literal("inspect_source_before_retry") })
|
|
13036
13127
|
]);
|
|
13128
|
+
OpportunitySnapshotSchema = external_exports.object({
|
|
13129
|
+
id: external_exports.string().uuid(),
|
|
13130
|
+
opportunity_key: external_exports.string(),
|
|
13131
|
+
status: external_exports.string(),
|
|
13132
|
+
updated_at: external_exports.string(),
|
|
13133
|
+
title: external_exports.string(),
|
|
13134
|
+
summary: external_exports.string(),
|
|
13135
|
+
brand_id: external_exports.string().nullable(),
|
|
13136
|
+
assignee_user_id: external_exports.string().nullable(),
|
|
13137
|
+
customer_wording: external_exports.object({ title: external_exports.string(), questions: external_exports.array(external_exports.string()) })
|
|
13138
|
+
}).passthrough();
|
|
13139
|
+
OpportunityUnknownReceiptSchema = external_exports.object({ state: external_exports.literal("unknown"), command_id: external_exports.string(), instruction: external_exports.literal("inspect_source_before_retry") });
|
|
13140
|
+
OpportunityCommandSchema = external_exports.union([
|
|
13141
|
+
external_exports.object({ state: external_exports.literal("recorded"), operation: external_exports.string(), response: external_exports.unknown() }),
|
|
13142
|
+
external_exports.object({ state: external_exports.literal("not_recorded") })
|
|
13143
|
+
]);
|
|
13037
13144
|
InboxOperationEnvelopeSchema = external_exports.discriminatedUnion("operation", [
|
|
13038
13145
|
InboxEnvelopeBaseSchema.extend({
|
|
13039
13146
|
operation: external_exports.literal("inbox.list"),
|
|
@@ -13074,7 +13181,11 @@ var init_inbox_management = __esm({
|
|
|
13074
13181
|
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("change.approve"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ merged: external_exports.literal(true), sha: external_exports.string(), self_approved: external_exports.boolean(), already_resolved: external_exports.boolean(), resolved_by: external_exports.string().nullable(), replayed: external_exports.boolean(), read_back: ChangeReadBackSchema }), UnknownMutationReceiptSchema]) }),
|
|
13075
13182
|
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("change.decline"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ declined: external_exports.literal(true), already_resolved: external_exports.boolean(), resolved_by: external_exports.string().nullable().optional(), replayed: external_exports.boolean(), read_back: ChangeReadBackSchema }), UnknownMutationReceiptSchema]) }),
|
|
13076
13183
|
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("change.revise"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ dispatched: external_exports.boolean(), runtime: external_exports.enum(["anthropic_managed", "boo"]), replayed: external_exports.boolean().optional(), read_back: ChangeReadBackSchema }).passthrough(), UnknownMutationReceiptSchema]) }),
|
|
13077
|
-
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("change.apply_revision"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ committed: external_exports.literal(true), branch: external_exports.string(), pr_number: external_exports.number(), replayed: external_exports.boolean().optional(), read_back: ChangeReadBackSchema }), UnknownMutationReceiptSchema]) })
|
|
13184
|
+
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("change.apply_revision"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ committed: external_exports.literal(true), branch: external_exports.string(), pr_number: external_exports.number(), replayed: external_exports.boolean().optional(), read_back: ChangeReadBackSchema }), UnknownMutationReceiptSchema]) }),
|
|
13185
|
+
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("opportunity.get"), source_version: external_exports.string(), receipt: external_exports.object({ state: external_exports.literal("complete"), opportunity: OpportunitySnapshotSchema, command: OpportunityCommandSchema.optional() }) }),
|
|
13186
|
+
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("opportunity.propose"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ state: external_exports.enum(["created", "reused"]), opportunity: OpportunitySnapshotSchema, replayed: external_exports.boolean() }), OpportunityUnknownReceiptSchema]) }),
|
|
13187
|
+
InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal("opportunity.assign_and_send"), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ state: external_exports.literal("sent"), recipient: external_exports.object({ user_id: external_exports.string().uuid(), name: external_exports.string() }), wording: external_exports.object({ title: external_exports.string(), questions: external_exports.array(external_exports.string()) }), deduplicated: external_exports.boolean(), trace_id: external_exports.string(), receipt_event_id: external_exports.string(), read_back: OpportunitySnapshotSchema }), OpportunityUnknownReceiptSchema]) }),
|
|
13188
|
+
...["reject", "defer", "annotate", "block"].map((decision) => InboxEnvelopeBaseSchema.extend({ operation: external_exports.literal(`opportunity.${decision}`), source_version: external_exports.string(), receipt: external_exports.union([external_exports.object({ state: external_exports.literal(decision), deduplicated: external_exports.boolean(), trace_id: external_exports.string(), receipt_event_id: external_exports.string(), read_back: OpportunitySnapshotSchema }), OpportunityUnknownReceiptSchema]) }))
|
|
13078
13189
|
]);
|
|
13079
13190
|
}
|
|
13080
13191
|
});
|
|
@@ -18889,17 +19000,20 @@ async function runInboxManage(options) {
|
|
|
18889
19000
|
throw Object.assign(new Error(`Unsupported Inbox operation: ${options.operation}`), { code: "unsupported_operation" });
|
|
18890
19001
|
}
|
|
18891
19002
|
const input = await inputObject(options.input);
|
|
18892
|
-
const isMutation = options.operation.startsWith("change.") && !["change.get", "change.diff", "change.head"].includes(options.operation);
|
|
19003
|
+
const isMutation = options.operation.startsWith("change.") && !["change.get", "change.diff", "change.head"].includes(options.operation) || options.operation.startsWith("opportunity.") && options.operation !== "opportunity.get";
|
|
18893
19004
|
if (isMutation) {
|
|
18894
|
-
const
|
|
18895
|
-
const
|
|
18896
|
-
|
|
18897
|
-
|
|
18898
|
-
}
|
|
18899
|
-
const preview = await callInboxManagement(session, options.org, InboxManagementCallSchema.parse({ operation: "change.get", input: { pr_number: prNumber, ...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {} } }));
|
|
19005
|
+
const isProposal = options.operation === "opportunity.propose";
|
|
19006
|
+
const isOpportunity = options.operation.startsWith("opportunity.");
|
|
19007
|
+
const previewCall = isProposal ? InboxManagementCallSchema.parse({ operation: "inbox.list", input: { ...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}, limit: 1 } }) : isOpportunity ? InboxManagementCallSchema.parse({ operation: "opportunity.get", input: { opportunity_id: input.opportunity_id, ...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {} } }) : InboxManagementCallSchema.parse({ operation: "change.get", input: { pr_number: input.pr_number, ...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {} } });
|
|
19008
|
+
const preview = await callInboxManagement(session, options.org, previewCall);
|
|
18900
19009
|
if (preview.scope.org_id !== options.org) throw Object.assign(new Error(`Requested organization ${options.org} but server resolved ${preview.scope.org_id}.`), { code: "organization_scope_mismatch" });
|
|
18901
|
-
|
|
18902
|
-
|
|
19010
|
+
const suppliedVersion = input.source_version ?? input.subject_revision;
|
|
19011
|
+
if (!isProposal && preview.source_version !== suppliedVersion) throw Object.assign(new Error(`The reviewed source revision ${String(suppliedVersion)} is stale; current revision is ${preview.source_version}.`), { code: "stale_review_task" });
|
|
19012
|
+
const recipient = input.recipient_name ? `; recipient: ${String(input.recipient_name)}` : "";
|
|
19013
|
+
const wording = input.approved_wording ? `; wording: ${JSON.stringify(input.approved_wording)}` : "";
|
|
19014
|
+
const mutation = MUTATION_EFFECTS[options.operation];
|
|
19015
|
+
const sourceItem = isProposal ? String(input.proposal && typeof input.proposal === "object" ? input.proposal.opportunity_key ?? "new stable-key proposal" : "new proposal") : String(input.opportunity_id ?? input.pr_number ?? "unknown");
|
|
19016
|
+
human(`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}`, options);
|
|
18903
19017
|
if (!options.approve) {
|
|
18904
19018
|
throw Object.assign(new Error("This operation changes customer state. Review the preview, obtain approval for its exact scope, source version, effect, and reversibility, then re-run with --approve."), { code: "approval_required" });
|
|
18905
19019
|
}
|
|
@@ -18914,6 +19028,7 @@ async function runInboxManage(options) {
|
|
|
18914
19028
|
fail(error, options);
|
|
18915
19029
|
}
|
|
18916
19030
|
}
|
|
19031
|
+
var MUTATION_EFFECTS;
|
|
18917
19032
|
var init_inbox_management2 = __esm({
|
|
18918
19033
|
"src/commands/inbox-management.ts"() {
|
|
18919
19034
|
"use strict";
|
|
@@ -18922,6 +19037,18 @@ var init_inbox_management2 = __esm({
|
|
|
18922
19037
|
init_api();
|
|
18923
19038
|
init_credentials();
|
|
18924
19039
|
init_output();
|
|
19040
|
+
MUTATION_EFFECTS = {
|
|
19041
|
+
"change.approve": { effect: "merge_workspace_change", reversible: false },
|
|
19042
|
+
"change.decline": { effect: "close_workspace_change_without_merge", reversible: true },
|
|
19043
|
+
"change.revise": { effect: "request_workspace_change_revision", reversible: true },
|
|
19044
|
+
"change.apply_revision": { effect: "commit_workspace_change_revision", reversible: true },
|
|
19045
|
+
"opportunity.propose": { effect: "create_internal_opportunity_proposal", reversible: true },
|
|
19046
|
+
"opportunity.assign_and_send": { effect: "assign_and_release_customer_opportunity", reversible: true },
|
|
19047
|
+
"opportunity.reject": { effect: "reject_internal_opportunity", reversible: true },
|
|
19048
|
+
"opportunity.defer": { effect: "defer_internal_opportunity", reversible: true },
|
|
19049
|
+
"opportunity.annotate": { effect: "annotate_internal_opportunity", reversible: true },
|
|
19050
|
+
"opportunity.block": { effect: "block_internal_opportunity", reversible: true }
|
|
19051
|
+
};
|
|
18925
19052
|
}
|
|
18926
19053
|
});
|
|
18927
19054
|
|