bamboo-agents 0.1.8-dev.95.4c57ace → 0.1.8-dev.97.7cdd11e
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 +1455 -217
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
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.97.7cdd11e";
|
|
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, opportunityCommon, OPPORTUNITY_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, OpportunityDecisionInputBaseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, OpportunitySnapshotSchema, OpportunityUnknownReceiptSchema, OpportunityCommandSchema, 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;
|
|
12760
12760
|
var init_inbox_management = __esm({
|
|
12761
12761
|
"../../src/lib/api-contracts/cli/inbox-management.ts"() {
|
|
12762
12762
|
init_zod();
|
|
@@ -12778,7 +12778,15 @@ var init_inbox_management = __esm({
|
|
|
12778
12778
|
"opportunity.reject",
|
|
12779
12779
|
"opportunity.defer",
|
|
12780
12780
|
"opportunity.annotate",
|
|
12781
|
-
"opportunity.block"
|
|
12781
|
+
"opportunity.block",
|
|
12782
|
+
"fde_action.get",
|
|
12783
|
+
"fde_action.command",
|
|
12784
|
+
"graph_recovery.get",
|
|
12785
|
+
"graph_recovery.command",
|
|
12786
|
+
"graph_recovery.select_predecessor",
|
|
12787
|
+
"annotation.get",
|
|
12788
|
+
"annotation.command",
|
|
12789
|
+
"annotation.complete"
|
|
12782
12790
|
]);
|
|
12783
12791
|
InboxManageOperationSchema = external_exports.enum([
|
|
12784
12792
|
"inbox.list",
|
|
@@ -12796,12 +12804,27 @@ var init_inbox_management = __esm({
|
|
|
12796
12804
|
"opportunity.reject",
|
|
12797
12805
|
"opportunity.defer",
|
|
12798
12806
|
"opportunity.annotate",
|
|
12799
|
-
"opportunity.block"
|
|
12807
|
+
"opportunity.block",
|
|
12808
|
+
"fde_action.get",
|
|
12809
|
+
"fde_action.command",
|
|
12810
|
+
"graph_recovery.get",
|
|
12811
|
+
"graph_recovery.command",
|
|
12812
|
+
"graph_recovery.select_predecessor",
|
|
12813
|
+
"annotation.get",
|
|
12814
|
+
"annotation.command",
|
|
12815
|
+
"annotation.complete"
|
|
12800
12816
|
]);
|
|
12801
12817
|
InboxOperationBindingSchema = external_exports.object({
|
|
12802
12818
|
operation: InboxOperationSchema,
|
|
12803
12819
|
description: external_exports.string(),
|
|
12804
|
-
work_item_family: external_exports.enum([
|
|
12820
|
+
work_item_family: external_exports.enum([
|
|
12821
|
+
"inbox",
|
|
12822
|
+
"workspace_change",
|
|
12823
|
+
"brain_opportunity",
|
|
12824
|
+
"fde_action",
|
|
12825
|
+
"graph_recovery",
|
|
12826
|
+
"output_annotation"
|
|
12827
|
+
]),
|
|
12805
12828
|
method: external_exports.literal("POST"),
|
|
12806
12829
|
path: external_exports.string().startsWith("/api/v1/"),
|
|
12807
12830
|
cli_command: external_exports.string().startsWith("bamboo-agents inbox "),
|
|
@@ -12833,48 +12856,69 @@ var init_inbox_management = __esm({
|
|
|
12833
12856
|
"opportunity_reject_receipt_v1",
|
|
12834
12857
|
"opportunity_defer_receipt_v1",
|
|
12835
12858
|
"opportunity_annotate_receipt_v1",
|
|
12836
|
-
"opportunity_block_receipt_v1"
|
|
12859
|
+
"opportunity_block_receipt_v1",
|
|
12860
|
+
"fde_action_get_receipt_v1",
|
|
12861
|
+
"fde_action_command_receipt_v1",
|
|
12862
|
+
"graph_recovery_get_receipt_v1",
|
|
12863
|
+
"graph_recovery_command_receipt_v1",
|
|
12864
|
+
"graph_recovery_predecessor_receipt_v1",
|
|
12865
|
+
"annotation_get_receipt_v1",
|
|
12866
|
+
"annotation_command_receipt_v1",
|
|
12867
|
+
"annotation_complete_receipt_v1"
|
|
12837
12868
|
]),
|
|
12838
|
-
error_codes: external_exports.array(
|
|
12839
|
-
|
|
12840
|
-
|
|
12841
|
-
|
|
12842
|
-
|
|
12843
|
-
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12860
|
-
|
|
12861
|
-
|
|
12862
|
-
|
|
12863
|
-
|
|
12864
|
-
|
|
12865
|
-
|
|
12866
|
-
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12871
|
-
|
|
12872
|
-
|
|
12873
|
-
|
|
12874
|
-
|
|
12875
|
-
|
|
12876
|
-
|
|
12877
|
-
|
|
12869
|
+
error_codes: external_exports.array(
|
|
12870
|
+
external_exports.enum([
|
|
12871
|
+
"authentication_required",
|
|
12872
|
+
"organization_scope_required",
|
|
12873
|
+
"organization_scope_mismatch",
|
|
12874
|
+
"forbidden",
|
|
12875
|
+
"unsupported_operation",
|
|
12876
|
+
"invalid_input",
|
|
12877
|
+
"not_found",
|
|
12878
|
+
"partial_read",
|
|
12879
|
+
"malformed_response",
|
|
12880
|
+
"invalid_request",
|
|
12881
|
+
"github_not_connected",
|
|
12882
|
+
"no_workspace_repo",
|
|
12883
|
+
"request_changes_forbidden",
|
|
12884
|
+
"request_changes_cross_scope",
|
|
12885
|
+
"pr_not_found",
|
|
12886
|
+
"policy_input_failed",
|
|
12887
|
+
"pr_already_merged",
|
|
12888
|
+
"stale_review_task",
|
|
12889
|
+
"branch_mismatch",
|
|
12890
|
+
"pr_branch_moved",
|
|
12891
|
+
"commit_failed",
|
|
12892
|
+
"merge_conflict",
|
|
12893
|
+
"merge_blocked",
|
|
12894
|
+
"github_error",
|
|
12895
|
+
"idempotency_conflict",
|
|
12896
|
+
"already_merged",
|
|
12897
|
+
"unknown_outcome",
|
|
12898
|
+
"source_output_unavailable",
|
|
12899
|
+
"source_output_read_failed",
|
|
12900
|
+
"approval_required",
|
|
12901
|
+
"policy_blocked",
|
|
12902
|
+
"decline_forbidden",
|
|
12903
|
+
"decline_cross_scope",
|
|
12904
|
+
"brain_opportunity_stale",
|
|
12905
|
+
"brain_opportunity_assignment_target_invalid",
|
|
12906
|
+
"missing_assignment",
|
|
12907
|
+
"wording_mismatch",
|
|
12908
|
+
"recipient_mismatch",
|
|
12909
|
+
"proposal_failed",
|
|
12910
|
+
"graph_decision_conflict",
|
|
12911
|
+
"stale_action",
|
|
12912
|
+
"invalid_transition",
|
|
12913
|
+
"stale_transition",
|
|
12914
|
+
"graph_recovery_unavailable",
|
|
12915
|
+
"continuation_required",
|
|
12916
|
+
"task_changed",
|
|
12917
|
+
"invalid_transition",
|
|
12918
|
+
"invalid_assignee",
|
|
12919
|
+
"label_write_failed"
|
|
12920
|
+
])
|
|
12921
|
+
),
|
|
12878
12922
|
minimum_cli_version: external_exports.string()
|
|
12879
12923
|
});
|
|
12880
12924
|
common = {
|
|
@@ -12904,7 +12948,11 @@ var init_inbox_management = __esm({
|
|
|
12904
12948
|
...common,
|
|
12905
12949
|
operation: "inbox.list",
|
|
12906
12950
|
description: "List a bounded page of actionable work in one customer Inbox",
|
|
12907
|
-
inputs: {
|
|
12951
|
+
inputs: {
|
|
12952
|
+
required: [],
|
|
12953
|
+
optional: ["brand_id", "limit", "cursor"],
|
|
12954
|
+
server_injected: {}
|
|
12955
|
+
},
|
|
12908
12956
|
receipt: "bounded actionable Inbox page with completeness metadata",
|
|
12909
12957
|
receipt_type: "inbox_list_receipt_v1"
|
|
12910
12958
|
},
|
|
@@ -12924,14 +12972,29 @@ var init_inbox_management = __esm({
|
|
|
12924
12972
|
path: "/api/v1/cli/inbox/revise",
|
|
12925
12973
|
cli_command: "bamboo-agents inbox revise",
|
|
12926
12974
|
description: "Request a revision to one pending Inbox pull request",
|
|
12927
|
-
inputs: {
|
|
12975
|
+
inputs: {
|
|
12976
|
+
required: ["pr_number", "feedback", "file"],
|
|
12977
|
+
optional: ["agent_id", "selected_lines"],
|
|
12978
|
+
server_injected: {}
|
|
12979
|
+
},
|
|
12928
12980
|
authority: "Authenticated Inbox reviewer authorized for the pull request scope",
|
|
12929
12981
|
approval_required: true,
|
|
12930
12982
|
side_effect: "dispatches a revision or materializes the file for operator editing",
|
|
12931
12983
|
receipt: "revision dispatch status or editable PR-head file",
|
|
12932
12984
|
receipt_type: "inbox_revise_receipt_v1",
|
|
12933
12985
|
minimum_cli_version: "0.1.5",
|
|
12934
|
-
error_codes: [
|
|
12986
|
+
error_codes: [
|
|
12987
|
+
"authentication_required",
|
|
12988
|
+
"invalid_request",
|
|
12989
|
+
"github_not_connected",
|
|
12990
|
+
"no_workspace_repo",
|
|
12991
|
+
"request_changes_forbidden",
|
|
12992
|
+
"request_changes_cross_scope",
|
|
12993
|
+
"pr_not_found",
|
|
12994
|
+
"policy_input_failed",
|
|
12995
|
+
"pr_already_merged",
|
|
12996
|
+
"stale_review_task"
|
|
12997
|
+
]
|
|
12935
12998
|
},
|
|
12936
12999
|
{
|
|
12937
13000
|
...common,
|
|
@@ -12939,44 +13002,501 @@ var init_inbox_management = __esm({
|
|
|
12939
13002
|
path: "/api/v1/cli/inbox/apply-revision",
|
|
12940
13003
|
cli_command: "bamboo-agents inbox apply-revision",
|
|
12941
13004
|
description: "Commit a prepared revision to a pending Inbox pull request",
|
|
12942
|
-
inputs: {
|
|
13005
|
+
inputs: {
|
|
13006
|
+
required: [
|
|
13007
|
+
"pr_number",
|
|
13008
|
+
"file",
|
|
13009
|
+
"new_content",
|
|
13010
|
+
"commit_message",
|
|
13011
|
+
"file_sha"
|
|
13012
|
+
],
|
|
13013
|
+
optional: ["branch"],
|
|
13014
|
+
server_injected: {}
|
|
13015
|
+
},
|
|
12943
13016
|
authority: "Authenticated Inbox reviewer authorized for the pull request scope",
|
|
12944
13017
|
approval_required: true,
|
|
12945
13018
|
side_effect: "commits to the existing pull-request branch",
|
|
12946
13019
|
receipt: "committed branch and pull-request number",
|
|
12947
13020
|
receipt_type: "inbox_apply_revision_receipt_v1",
|
|
12948
13021
|
minimum_cli_version: "0.1.5",
|
|
12949
|
-
error_codes: [
|
|
13022
|
+
error_codes: [
|
|
13023
|
+
"authentication_required",
|
|
13024
|
+
"invalid_request",
|
|
13025
|
+
"github_not_connected",
|
|
13026
|
+
"no_workspace_repo",
|
|
13027
|
+
"request_changes_forbidden",
|
|
13028
|
+
"request_changes_cross_scope",
|
|
13029
|
+
"pr_not_found",
|
|
13030
|
+
"pr_already_merged",
|
|
13031
|
+
"stale_review_task",
|
|
13032
|
+
"branch_mismatch",
|
|
13033
|
+
"pr_branch_moved",
|
|
13034
|
+
"commit_failed"
|
|
13035
|
+
]
|
|
12950
13036
|
}
|
|
12951
13037
|
];
|
|
12952
13038
|
changeCommon = {
|
|
12953
13039
|
...common,
|
|
12954
13040
|
work_item_family: "workspace_change",
|
|
12955
13041
|
description: "",
|
|
12956
|
-
inputs: {
|
|
12957
|
-
|
|
13042
|
+
inputs: {
|
|
13043
|
+
required: ["pr_number"],
|
|
13044
|
+
optional: ["brand_id"],
|
|
13045
|
+
server_injected: {}
|
|
13046
|
+
},
|
|
13047
|
+
error_codes: [
|
|
13048
|
+
"authentication_required",
|
|
13049
|
+
"organization_scope_required",
|
|
13050
|
+
"organization_scope_mismatch",
|
|
13051
|
+
"invalid_input",
|
|
13052
|
+
"pr_not_found",
|
|
13053
|
+
"github_not_connected",
|
|
13054
|
+
"no_workspace_repo",
|
|
13055
|
+
"github_error",
|
|
13056
|
+
"malformed_response"
|
|
13057
|
+
]
|
|
12958
13058
|
};
|
|
12959
13059
|
CHANGE_MANAGEMENT_BINDINGS = [
|
|
12960
|
-
{
|
|
12961
|
-
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
12966
|
-
|
|
13060
|
+
{
|
|
13061
|
+
...changeCommon,
|
|
13062
|
+
operation: "change.get",
|
|
13063
|
+
description: "Inspect one current workspace change and optionally reconcile a command",
|
|
13064
|
+
inputs: {
|
|
13065
|
+
required: ["pr_number"],
|
|
13066
|
+
optional: ["brand_id", "command_id", "command_operation"],
|
|
13067
|
+
server_injected: {}
|
|
13068
|
+
},
|
|
13069
|
+
receipt: "current normalized change item with optional command reconciliation",
|
|
13070
|
+
receipt_type: "change_get_receipt_v1"
|
|
13071
|
+
},
|
|
13072
|
+
{
|
|
13073
|
+
...changeCommon,
|
|
13074
|
+
operation: "change.diff",
|
|
13075
|
+
description: "Read the exact file diff and reviewed head SHA",
|
|
13076
|
+
receipt: "file changes with head and base SHAs",
|
|
13077
|
+
receipt_type: "change_diff_receipt_v1"
|
|
13078
|
+
},
|
|
13079
|
+
{
|
|
13080
|
+
...changeCommon,
|
|
13081
|
+
operation: "change.head",
|
|
13082
|
+
description: "Re-read the current PR head SHA",
|
|
13083
|
+
receipt: "current PR head SHA",
|
|
13084
|
+
receipt_type: "change_head_receipt_v1"
|
|
13085
|
+
},
|
|
13086
|
+
{
|
|
13087
|
+
...changeCommon,
|
|
13088
|
+
operation: "change.approve",
|
|
13089
|
+
description: "Approve and merge the reviewed workspace change",
|
|
13090
|
+
inputs: {
|
|
13091
|
+
required: [
|
|
13092
|
+
"pr_number",
|
|
13093
|
+
"subject_revision",
|
|
13094
|
+
"command_id",
|
|
13095
|
+
"approved",
|
|
13096
|
+
"approved_effect",
|
|
13097
|
+
"approved_reversible"
|
|
13098
|
+
],
|
|
13099
|
+
optional: ["brand_id"],
|
|
13100
|
+
server_injected: {}
|
|
13101
|
+
},
|
|
13102
|
+
approval_required: true,
|
|
13103
|
+
side_effect: "merges the workspace pull request",
|
|
13104
|
+
receipt: "merged SHA and replay status",
|
|
13105
|
+
receipt_type: "change_approve_receipt_v1",
|
|
13106
|
+
error_codes: [
|
|
13107
|
+
...changeCommon.error_codes,
|
|
13108
|
+
"approval_required",
|
|
13109
|
+
"policy_blocked",
|
|
13110
|
+
"policy_input_failed",
|
|
13111
|
+
"merge_conflict",
|
|
13112
|
+
"merge_blocked",
|
|
13113
|
+
"stale_review_task",
|
|
13114
|
+
"idempotency_conflict",
|
|
13115
|
+
"unknown_outcome"
|
|
13116
|
+
]
|
|
13117
|
+
},
|
|
13118
|
+
{
|
|
13119
|
+
...changeCommon,
|
|
13120
|
+
operation: "change.decline",
|
|
13121
|
+
description: "Decline the reviewed workspace change",
|
|
13122
|
+
inputs: {
|
|
13123
|
+
required: [
|
|
13124
|
+
"pr_number",
|
|
13125
|
+
"subject_revision",
|
|
13126
|
+
"command_id",
|
|
13127
|
+
"approved",
|
|
13128
|
+
"approved_effect",
|
|
13129
|
+
"approved_reversible"
|
|
13130
|
+
],
|
|
13131
|
+
optional: ["brand_id"],
|
|
13132
|
+
server_injected: {}
|
|
13133
|
+
},
|
|
13134
|
+
approval_required: true,
|
|
13135
|
+
side_effect: "closes the workspace pull request",
|
|
13136
|
+
receipt: "declined and replay status",
|
|
13137
|
+
receipt_type: "change_decline_receipt_v1",
|
|
13138
|
+
error_codes: [
|
|
13139
|
+
...changeCommon.error_codes,
|
|
13140
|
+
"approval_required",
|
|
13141
|
+
"decline_forbidden",
|
|
13142
|
+
"decline_cross_scope",
|
|
13143
|
+
"policy_input_failed",
|
|
13144
|
+
"already_merged",
|
|
13145
|
+
"stale_review_task",
|
|
13146
|
+
"idempotency_conflict",
|
|
13147
|
+
"unknown_outcome"
|
|
13148
|
+
]
|
|
13149
|
+
},
|
|
13150
|
+
{
|
|
13151
|
+
...changeCommon,
|
|
13152
|
+
operation: "change.revise",
|
|
13153
|
+
description: "Request a revision against the reviewed head",
|
|
13154
|
+
inputs: {
|
|
13155
|
+
required: [
|
|
13156
|
+
"pr_number",
|
|
13157
|
+
"subject_revision",
|
|
13158
|
+
"command_id",
|
|
13159
|
+
"approved",
|
|
13160
|
+
"approved_effect",
|
|
13161
|
+
"approved_reversible",
|
|
13162
|
+
"feedback",
|
|
13163
|
+
"file"
|
|
13164
|
+
],
|
|
13165
|
+
optional: ["brand_id", "agent_id", "selected_lines"],
|
|
13166
|
+
server_injected: {}
|
|
13167
|
+
},
|
|
13168
|
+
approval_required: true,
|
|
13169
|
+
side_effect: "dispatches or prepares a pull-request revision",
|
|
13170
|
+
receipt: "revision dispatch or editable head content",
|
|
13171
|
+
receipt_type: "change_revise_receipt_v1",
|
|
13172
|
+
error_codes: [
|
|
13173
|
+
...changeCommon.error_codes,
|
|
13174
|
+
"approval_required",
|
|
13175
|
+
"request_changes_forbidden",
|
|
13176
|
+
"request_changes_cross_scope",
|
|
13177
|
+
"policy_input_failed",
|
|
13178
|
+
"pr_already_merged",
|
|
13179
|
+
"stale_review_task",
|
|
13180
|
+
"idempotency_conflict",
|
|
13181
|
+
"unknown_outcome"
|
|
13182
|
+
]
|
|
13183
|
+
},
|
|
13184
|
+
{
|
|
13185
|
+
...changeCommon,
|
|
13186
|
+
operation: "change.apply_revision",
|
|
13187
|
+
description: "Apply prepared content to the reviewed pull-request head",
|
|
13188
|
+
inputs: {
|
|
13189
|
+
required: [
|
|
13190
|
+
"pr_number",
|
|
13191
|
+
"subject_revision",
|
|
13192
|
+
"command_id",
|
|
13193
|
+
"approved",
|
|
13194
|
+
"approved_effect",
|
|
13195
|
+
"approved_reversible",
|
|
13196
|
+
"file",
|
|
13197
|
+
"new_content",
|
|
13198
|
+
"commit_message",
|
|
13199
|
+
"file_sha"
|
|
13200
|
+
],
|
|
13201
|
+
optional: ["brand_id", "branch"],
|
|
13202
|
+
server_injected: {}
|
|
13203
|
+
},
|
|
13204
|
+
approval_required: true,
|
|
13205
|
+
side_effect: "commits to the workspace pull-request branch",
|
|
13206
|
+
receipt: "committed branch and PR number",
|
|
13207
|
+
receipt_type: "change_apply_revision_receipt_v1",
|
|
13208
|
+
error_codes: [
|
|
13209
|
+
...changeCommon.error_codes,
|
|
13210
|
+
"approval_required",
|
|
13211
|
+
"request_changes_forbidden",
|
|
13212
|
+
"request_changes_cross_scope",
|
|
13213
|
+
"policy_input_failed",
|
|
13214
|
+
"pr_already_merged",
|
|
13215
|
+
"stale_review_task",
|
|
13216
|
+
"idempotency_conflict",
|
|
13217
|
+
"branch_mismatch",
|
|
13218
|
+
"pr_branch_moved",
|
|
13219
|
+
"commit_failed",
|
|
13220
|
+
"unknown_outcome"
|
|
13221
|
+
]
|
|
13222
|
+
}
|
|
12967
13223
|
];
|
|
12968
13224
|
opportunityCommon = {
|
|
12969
13225
|
...common,
|
|
12970
13226
|
work_item_family: "brain_opportunity",
|
|
12971
13227
|
description: "",
|
|
12972
|
-
inputs: {
|
|
12973
|
-
|
|
13228
|
+
inputs: {
|
|
13229
|
+
required: ["opportunity_id"],
|
|
13230
|
+
optional: ["brand_id"],
|
|
13231
|
+
server_injected: {}
|
|
13232
|
+
},
|
|
13233
|
+
error_codes: [
|
|
13234
|
+
"authentication_required",
|
|
13235
|
+
"organization_scope_required",
|
|
13236
|
+
"organization_scope_mismatch",
|
|
13237
|
+
"invalid_input",
|
|
13238
|
+
"not_found",
|
|
13239
|
+
"forbidden",
|
|
13240
|
+
"malformed_response"
|
|
13241
|
+
]
|
|
12974
13242
|
};
|
|
12975
13243
|
OPPORTUNITY_MANAGEMENT_BINDINGS = [
|
|
12976
|
-
{
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
13244
|
+
{
|
|
13245
|
+
...opportunityCommon,
|
|
13246
|
+
operation: "opportunity.get",
|
|
13247
|
+
description: "Inspect one Brain Opportunity at its current source version",
|
|
13248
|
+
receipt: "current opportunity state and approved customer wording",
|
|
13249
|
+
receipt_type: "opportunity_get_receipt_v1"
|
|
13250
|
+
},
|
|
13251
|
+
{
|
|
13252
|
+
...opportunityCommon,
|
|
13253
|
+
operation: "opportunity.propose",
|
|
13254
|
+
description: "Add a stable-key proposal to internal FDE review",
|
|
13255
|
+
inputs: {
|
|
13256
|
+
required: [
|
|
13257
|
+
"brand_id",
|
|
13258
|
+
"proposal",
|
|
13259
|
+
"command_id",
|
|
13260
|
+
"approved",
|
|
13261
|
+
"approved_effect",
|
|
13262
|
+
"approved_reversible"
|
|
13263
|
+
],
|
|
13264
|
+
optional: ["agent_id"],
|
|
13265
|
+
server_injected: {}
|
|
13266
|
+
},
|
|
13267
|
+
approval_required: true,
|
|
13268
|
+
side_effect: "creates one add-only internal-review proposal",
|
|
13269
|
+
receipt: "created or reused internal-review proposal",
|
|
13270
|
+
receipt_type: "opportunity_propose_receipt_v1",
|
|
13271
|
+
error_codes: [
|
|
13272
|
+
...opportunityCommon.error_codes,
|
|
13273
|
+
"proposal_failed",
|
|
13274
|
+
"graph_decision_conflict"
|
|
13275
|
+
]
|
|
13276
|
+
},
|
|
13277
|
+
{
|
|
13278
|
+
...opportunityCommon,
|
|
13279
|
+
operation: "opportunity.assign_and_send",
|
|
13280
|
+
description: "Assign and release exact approved wording to one named customer",
|
|
13281
|
+
inputs: {
|
|
13282
|
+
required: [
|
|
13283
|
+
"opportunity_id",
|
|
13284
|
+
"source_version",
|
|
13285
|
+
"command_id",
|
|
13286
|
+
"recipient_user_id",
|
|
13287
|
+
"recipient_name",
|
|
13288
|
+
"approved_wording",
|
|
13289
|
+
"approved",
|
|
13290
|
+
"approved_effect",
|
|
13291
|
+
"approved_reversible"
|
|
13292
|
+
],
|
|
13293
|
+
optional: ["brand_id"],
|
|
13294
|
+
server_injected: {}
|
|
13295
|
+
},
|
|
13296
|
+
approval_required: true,
|
|
13297
|
+
side_effect: "moves the reviewed opportunity into the named customer's queue",
|
|
13298
|
+
receipt: "sent customer-queue state and command receipt",
|
|
13299
|
+
receipt_type: "opportunity_send_receipt_v1",
|
|
13300
|
+
error_codes: [
|
|
13301
|
+
...opportunityCommon.error_codes,
|
|
13302
|
+
"brain_opportunity_stale",
|
|
13303
|
+
"brain_opportunity_assignment_target_invalid",
|
|
13304
|
+
"missing_assignment",
|
|
13305
|
+
"wording_mismatch",
|
|
13306
|
+
"recipient_mismatch",
|
|
13307
|
+
"graph_decision_conflict"
|
|
13308
|
+
]
|
|
13309
|
+
},
|
|
13310
|
+
...["reject", "defer", "annotate", "block"].map((decision) => ({
|
|
13311
|
+
...opportunityCommon,
|
|
13312
|
+
operation: `opportunity.${decision}`,
|
|
13313
|
+
description: `${decision} one reviewed Brain Opportunity`,
|
|
13314
|
+
inputs: {
|
|
13315
|
+
required: [
|
|
13316
|
+
"opportunity_id",
|
|
13317
|
+
"source_version",
|
|
13318
|
+
"command_id",
|
|
13319
|
+
"reason",
|
|
13320
|
+
"approved",
|
|
13321
|
+
"approved_effect",
|
|
13322
|
+
"approved_reversible"
|
|
13323
|
+
],
|
|
13324
|
+
optional: ["brand_id"],
|
|
13325
|
+
server_injected: {}
|
|
13326
|
+
},
|
|
13327
|
+
approval_required: true,
|
|
13328
|
+
side_effect: `${decision}s the internal-review opportunity`,
|
|
13329
|
+
receipt: `${decision} decision and source read-back`,
|
|
13330
|
+
receipt_type: `opportunity_${decision}_receipt_v1`,
|
|
13331
|
+
error_codes: [
|
|
13332
|
+
...opportunityCommon.error_codes,
|
|
13333
|
+
"brain_opportunity_stale",
|
|
13334
|
+
"graph_decision_conflict"
|
|
13335
|
+
]
|
|
13336
|
+
}))
|
|
13337
|
+
];
|
|
13338
|
+
annotationCommon = {
|
|
13339
|
+
...common,
|
|
13340
|
+
work_item_family: "output_annotation",
|
|
13341
|
+
description: "",
|
|
13342
|
+
inputs: {
|
|
13343
|
+
required: ["task_id"],
|
|
13344
|
+
optional: ["brand_id", "command_id", "command_operation"],
|
|
13345
|
+
server_injected: {}
|
|
13346
|
+
},
|
|
13347
|
+
error_codes: [
|
|
13348
|
+
...common.error_codes,
|
|
13349
|
+
"task_changed",
|
|
13350
|
+
"invalid_transition",
|
|
13351
|
+
"invalid_assignee",
|
|
13352
|
+
"label_write_failed",
|
|
13353
|
+
"idempotency_conflict",
|
|
13354
|
+
"unknown_outcome",
|
|
13355
|
+
"source_output_unavailable",
|
|
13356
|
+
"source_output_read_failed"
|
|
13357
|
+
]
|
|
13358
|
+
};
|
|
13359
|
+
ANNOTATION_MANAGEMENT_BINDINGS = [
|
|
13360
|
+
{
|
|
13361
|
+
...annotationCommon,
|
|
13362
|
+
operation: "annotation.get",
|
|
13363
|
+
description: "Inspect one output-annotation task and its current legal actions",
|
|
13364
|
+
receipt: "current source output, evidence, legal actions, and lock version",
|
|
13365
|
+
receipt_type: "annotation_get_receipt_v1"
|
|
13366
|
+
},
|
|
13367
|
+
{
|
|
13368
|
+
...annotationCommon,
|
|
13369
|
+
operation: "annotation.command",
|
|
13370
|
+
description: "Apply one server-advertised annotation routing command",
|
|
13371
|
+
inputs: {
|
|
13372
|
+
required: ["task_id", "source_version", "command_id", "command", "approved", "approved_effect", "approved_reversible"],
|
|
13373
|
+
optional: ["brand_id", "target_user_id", "reason"],
|
|
13374
|
+
server_injected: {}
|
|
13375
|
+
},
|
|
13376
|
+
approval_required: true,
|
|
13377
|
+
side_effect: "updates the authoritative annotation task lifecycle",
|
|
13378
|
+
receipt: "completed, no-change, stale, conflict, or unknown task state",
|
|
13379
|
+
receipt_type: "annotation_command_receipt_v1"
|
|
13380
|
+
},
|
|
13381
|
+
{
|
|
13382
|
+
...annotationCommon,
|
|
13383
|
+
operation: "annotation.complete",
|
|
13384
|
+
description: "Write approved rubric labels and complete one annotation task",
|
|
13385
|
+
inputs: {
|
|
13386
|
+
required: ["task_id", "source_version", "command_id", "labels", "approved", "approved_effect", "approved_reversible"],
|
|
13387
|
+
optional: ["brand_id", "reason"],
|
|
13388
|
+
server_injected: { source: "cli" }
|
|
13389
|
+
},
|
|
13390
|
+
approval_required: true,
|
|
13391
|
+
side_effect: "writes labels through the canonical label writer and advances the task",
|
|
13392
|
+
receipt: "completion state, label-write receipts, and authoritative read-back",
|
|
13393
|
+
receipt_type: "annotation_complete_receipt_v1"
|
|
13394
|
+
}
|
|
13395
|
+
];
|
|
13396
|
+
lifecycleMutationInputs = {
|
|
13397
|
+
required: [
|
|
13398
|
+
"id",
|
|
13399
|
+
"source_version",
|
|
13400
|
+
"command_id",
|
|
13401
|
+
"reason",
|
|
13402
|
+
"approved",
|
|
13403
|
+
"approved_effect",
|
|
13404
|
+
"approved_reversible"
|
|
13405
|
+
],
|
|
13406
|
+
optional: ["brand_id"],
|
|
13407
|
+
server_injected: {}
|
|
13408
|
+
};
|
|
13409
|
+
FDE_ACTION_MANAGEMENT_BINDINGS = [
|
|
13410
|
+
{
|
|
13411
|
+
...common,
|
|
13412
|
+
work_item_family: "fde_action",
|
|
13413
|
+
operation: "fde_action.get",
|
|
13414
|
+
description: "Inspect one current FDE action and its server-advertised legal commands",
|
|
13415
|
+
inputs: {
|
|
13416
|
+
required: ["id"],
|
|
13417
|
+
optional: ["brand_id", "command_id"],
|
|
13418
|
+
server_injected: {}
|
|
13419
|
+
},
|
|
13420
|
+
receipt: "current FDE action, evidence, owner, completion condition, and legal commands",
|
|
13421
|
+
receipt_type: "fde_action_get_receipt_v1"
|
|
13422
|
+
},
|
|
13423
|
+
{
|
|
13424
|
+
...common,
|
|
13425
|
+
work_item_family: "fde_action",
|
|
13426
|
+
operation: "fde_action.command",
|
|
13427
|
+
description: "Execute one server-advertised FDE action command",
|
|
13428
|
+
inputs: {
|
|
13429
|
+
...lifecycleMutationInputs,
|
|
13430
|
+
required: [...lifecycleMutationInputs.required, "command"]
|
|
13431
|
+
},
|
|
13432
|
+
approval_required: true,
|
|
13433
|
+
side_effect: "applies the selected legal FDE action transition",
|
|
13434
|
+
receipt: "accepted or resolved transition with authoritative read-back",
|
|
13435
|
+
receipt_type: "fde_action_command_receipt_v1",
|
|
13436
|
+
error_codes: [
|
|
13437
|
+
...common.error_codes,
|
|
13438
|
+
"stale_action",
|
|
13439
|
+
"invalid_transition",
|
|
13440
|
+
"unknown_outcome"
|
|
13441
|
+
]
|
|
13442
|
+
}
|
|
13443
|
+
];
|
|
13444
|
+
GRAPH_RECOVERY_MANAGEMENT_BINDINGS = [
|
|
13445
|
+
{
|
|
13446
|
+
...common,
|
|
13447
|
+
work_item_family: "graph_recovery",
|
|
13448
|
+
operation: "graph_recovery.get",
|
|
13449
|
+
description: "Inspect one graph recovery cycle and its server-advertised legal commands",
|
|
13450
|
+
inputs: {
|
|
13451
|
+
required: ["id"],
|
|
13452
|
+
optional: ["brand_id", "command_id"],
|
|
13453
|
+
server_injected: {}
|
|
13454
|
+
},
|
|
13455
|
+
receipt: "current blocker, evidence, owner, completion condition, candidates, and legal commands",
|
|
13456
|
+
receipt_type: "graph_recovery_get_receipt_v1"
|
|
13457
|
+
},
|
|
13458
|
+
{
|
|
13459
|
+
...common,
|
|
13460
|
+
work_item_family: "graph_recovery",
|
|
13461
|
+
operation: "graph_recovery.command",
|
|
13462
|
+
description: "Execute one server-advertised graph recovery command",
|
|
13463
|
+
inputs: {
|
|
13464
|
+
...lifecycleMutationInputs,
|
|
13465
|
+
required: [...lifecycleMutationInputs.required, "command"]
|
|
13466
|
+
},
|
|
13467
|
+
approval_required: true,
|
|
13468
|
+
side_effect: "applies the selected legal graph recovery transition",
|
|
13469
|
+
receipt: "accepted transition with authoritative cycle read-back",
|
|
13470
|
+
receipt_type: "graph_recovery_command_receipt_v1",
|
|
13471
|
+
error_codes: [
|
|
13472
|
+
...common.error_codes,
|
|
13473
|
+
"stale_transition",
|
|
13474
|
+
"invalid_transition",
|
|
13475
|
+
"graph_recovery_unavailable",
|
|
13476
|
+
"unknown_outcome"
|
|
13477
|
+
]
|
|
13478
|
+
},
|
|
13479
|
+
{
|
|
13480
|
+
...common,
|
|
13481
|
+
work_item_family: "graph_recovery",
|
|
13482
|
+
operation: "graph_recovery.select_predecessor",
|
|
13483
|
+
description: "Select one server-advertised predecessor candidate",
|
|
13484
|
+
inputs: {
|
|
13485
|
+
...lifecycleMutationInputs,
|
|
13486
|
+
required: [...lifecycleMutationInputs.required, "predecessor_event_id"]
|
|
13487
|
+
},
|
|
13488
|
+
approval_required: true,
|
|
13489
|
+
side_effect: "continues the graph from the selected predecessor",
|
|
13490
|
+
receipt: "accepted predecessor transition with authoritative read-back",
|
|
13491
|
+
receipt_type: "graph_recovery_predecessor_receipt_v1",
|
|
13492
|
+
error_codes: [
|
|
13493
|
+
...common.error_codes,
|
|
13494
|
+
"stale_transition",
|
|
13495
|
+
"invalid_transition",
|
|
13496
|
+
"continuation_required",
|
|
13497
|
+
"unknown_outcome"
|
|
13498
|
+
]
|
|
13499
|
+
}
|
|
12980
13500
|
];
|
|
12981
13501
|
InboxManagementCatalogResponseSchema = external_exports.object({
|
|
12982
13502
|
contract_version: external_exports.literal(1),
|
|
@@ -13003,86 +13523,333 @@ var init_inbox_management = __esm({
|
|
|
13003
13523
|
}),
|
|
13004
13524
|
external_exports.object({
|
|
13005
13525
|
operation: external_exports.literal("inbox.get"),
|
|
13006
|
-
input: external_exports.object({
|
|
13526
|
+
input: external_exports.object({
|
|
13527
|
+
id: external_exports.string().min(1),
|
|
13528
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13529
|
+
})
|
|
13530
|
+
}),
|
|
13531
|
+
external_exports.object({
|
|
13532
|
+
operation: external_exports.literal("change.get"),
|
|
13533
|
+
input: external_exports.object({
|
|
13534
|
+
pr_number: external_exports.number().int().positive(),
|
|
13535
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13536
|
+
command_id: external_exports.string().min(1).max(200).optional(),
|
|
13537
|
+
command_operation: external_exports.enum(["approve", "decline", "request_revision", "apply_revision"]).optional()
|
|
13538
|
+
}).refine(
|
|
13539
|
+
(value) => Boolean(value.command_id) === Boolean(value.command_operation),
|
|
13540
|
+
{
|
|
13541
|
+
message: "command_id and command_operation must be supplied together"
|
|
13542
|
+
}
|
|
13543
|
+
)
|
|
13544
|
+
}),
|
|
13545
|
+
external_exports.object({
|
|
13546
|
+
operation: external_exports.literal("change.diff"),
|
|
13547
|
+
input: external_exports.object({
|
|
13548
|
+
pr_number: external_exports.number().int().positive(),
|
|
13549
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13550
|
+
})
|
|
13551
|
+
}),
|
|
13552
|
+
external_exports.object({
|
|
13553
|
+
operation: external_exports.literal("change.head"),
|
|
13554
|
+
input: external_exports.object({
|
|
13555
|
+
pr_number: external_exports.number().int().positive(),
|
|
13556
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13557
|
+
})
|
|
13558
|
+
}),
|
|
13559
|
+
external_exports.object({
|
|
13560
|
+
operation: external_exports.literal("change.approve"),
|
|
13561
|
+
input: external_exports.object({
|
|
13562
|
+
pr_number: external_exports.number().int().positive(),
|
|
13563
|
+
subject_revision: external_exports.string().min(1),
|
|
13564
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13565
|
+
approved: external_exports.literal(true),
|
|
13566
|
+
approved_effect: external_exports.literal("merge_workspace_change"),
|
|
13567
|
+
approved_reversible: external_exports.literal(false),
|
|
13568
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13569
|
+
})
|
|
13570
|
+
}),
|
|
13571
|
+
external_exports.object({
|
|
13572
|
+
operation: external_exports.literal("change.decline"),
|
|
13573
|
+
input: external_exports.object({
|
|
13574
|
+
pr_number: external_exports.number().int().positive(),
|
|
13575
|
+
subject_revision: external_exports.string().min(1),
|
|
13576
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13577
|
+
approved: external_exports.literal(true),
|
|
13578
|
+
approved_effect: external_exports.literal("close_workspace_change_without_merge"),
|
|
13579
|
+
approved_reversible: external_exports.literal(true),
|
|
13580
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13581
|
+
})
|
|
13582
|
+
}),
|
|
13583
|
+
external_exports.object({
|
|
13584
|
+
operation: external_exports.literal("change.revise"),
|
|
13585
|
+
input: external_exports.object({
|
|
13586
|
+
pr_number: external_exports.number().int().positive(),
|
|
13587
|
+
subject_revision: external_exports.string().min(1),
|
|
13588
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13589
|
+
approved: external_exports.literal(true),
|
|
13590
|
+
approved_effect: external_exports.literal("request_workspace_change_revision"),
|
|
13591
|
+
approved_reversible: external_exports.literal(true),
|
|
13592
|
+
feedback: external_exports.string().min(1).max(4e3),
|
|
13593
|
+
file: external_exports.string().min(1).max(512),
|
|
13594
|
+
agent_id: external_exports.string().nullable().optional(),
|
|
13595
|
+
selected_lines: external_exports.array(
|
|
13596
|
+
external_exports.object({
|
|
13597
|
+
kind: external_exports.enum(["add", "del", "context"]),
|
|
13598
|
+
old_line: external_exports.number().nullable(),
|
|
13599
|
+
new_line: external_exports.number().nullable(),
|
|
13600
|
+
content: external_exports.string()
|
|
13601
|
+
})
|
|
13602
|
+
).optional(),
|
|
13603
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13604
|
+
})
|
|
13605
|
+
}),
|
|
13606
|
+
external_exports.object({
|
|
13607
|
+
operation: external_exports.literal("change.apply_revision"),
|
|
13608
|
+
input: external_exports.object({
|
|
13609
|
+
pr_number: external_exports.number().int().positive(),
|
|
13610
|
+
subject_revision: external_exports.string().min(1),
|
|
13611
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13612
|
+
approved: external_exports.literal(true),
|
|
13613
|
+
approved_effect: external_exports.literal("commit_workspace_change_revision"),
|
|
13614
|
+
approved_reversible: external_exports.literal(true),
|
|
13615
|
+
file: external_exports.string().min(1).max(512),
|
|
13616
|
+
new_content: external_exports.string().min(1).max(1e6),
|
|
13617
|
+
commit_message: external_exports.string().min(1).max(200),
|
|
13618
|
+
file_sha: external_exports.string().min(1).max(64),
|
|
13619
|
+
branch: external_exports.string().optional(),
|
|
13620
|
+
brand_id: external_exports.string().uuid().optional()
|
|
13621
|
+
})
|
|
13622
|
+
}),
|
|
13623
|
+
external_exports.object({
|
|
13624
|
+
operation: external_exports.literal("opportunity.get"),
|
|
13625
|
+
input: external_exports.object({
|
|
13626
|
+
opportunity_id: external_exports.string().uuid(),
|
|
13627
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13628
|
+
command_id: external_exports.string().min(1).max(128).optional()
|
|
13629
|
+
})
|
|
13630
|
+
}),
|
|
13631
|
+
external_exports.object({
|
|
13632
|
+
operation: external_exports.literal("opportunity.propose"),
|
|
13633
|
+
input: external_exports.object({
|
|
13634
|
+
brand_id: external_exports.string().uuid(),
|
|
13635
|
+
agent_id: external_exports.string().uuid().nullable().optional(),
|
|
13636
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13637
|
+
approved: external_exports.literal(true),
|
|
13638
|
+
approved_effect: external_exports.literal("create_internal_opportunity_proposal"),
|
|
13639
|
+
approved_reversible: external_exports.literal(true),
|
|
13640
|
+
proposal: external_exports.object({
|
|
13641
|
+
opportunity_key: external_exports.string().min(1).max(240).optional(),
|
|
13642
|
+
title: external_exports.string().trim().min(1).max(500),
|
|
13643
|
+
function_key: external_exports.string().nullable().optional(),
|
|
13644
|
+
expectation_keys: external_exports.array(external_exports.string()).optional(),
|
|
13645
|
+
module_order: external_exports.number().int().optional(),
|
|
13646
|
+
priority: external_exports.enum(["high", "medium", "low"]),
|
|
13647
|
+
summary: external_exports.string(),
|
|
13648
|
+
why_it_matters: external_exports.string(),
|
|
13649
|
+
expected_artifacts: external_exports.array(external_exports.string()),
|
|
13650
|
+
subquestions: external_exports.array(
|
|
13651
|
+
external_exports.object({
|
|
13652
|
+
key: external_exports.string(),
|
|
13653
|
+
prompt: external_exports.string(),
|
|
13654
|
+
purpose: external_exports.string(),
|
|
13655
|
+
required: external_exports.boolean()
|
|
13656
|
+
})
|
|
13657
|
+
),
|
|
13658
|
+
evidence: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())),
|
|
13659
|
+
open_questions: external_exports.array(external_exports.string()),
|
|
13660
|
+
source: external_exports.string().min(1),
|
|
13661
|
+
proposed_assignee_user_id: external_exports.string().uuid().nullable().optional()
|
|
13662
|
+
})
|
|
13663
|
+
})
|
|
13664
|
+
}),
|
|
13665
|
+
external_exports.object({
|
|
13666
|
+
operation: external_exports.literal("opportunity.assign_and_send"),
|
|
13667
|
+
input: external_exports.object({
|
|
13668
|
+
opportunity_id: external_exports.string().uuid(),
|
|
13669
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13670
|
+
source_version: external_exports.string().datetime(),
|
|
13671
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13672
|
+
recipient_user_id: external_exports.string().uuid(),
|
|
13673
|
+
recipient_name: external_exports.string().trim().min(1),
|
|
13674
|
+
approved_wording: external_exports.object({
|
|
13675
|
+
title: external_exports.string(),
|
|
13676
|
+
questions: external_exports.array(external_exports.string())
|
|
13677
|
+
}),
|
|
13678
|
+
approved: external_exports.literal(true),
|
|
13679
|
+
approved_effect: external_exports.literal("assign_and_release_customer_opportunity"),
|
|
13680
|
+
approved_reversible: external_exports.literal(true)
|
|
13681
|
+
})
|
|
13682
|
+
}),
|
|
13683
|
+
external_exports.object({
|
|
13684
|
+
operation: external_exports.literal("opportunity.reject"),
|
|
13685
|
+
input: OpportunityDecisionInputBaseSchema.extend({
|
|
13686
|
+
approved_effect: external_exports.literal("reject_internal_opportunity")
|
|
13687
|
+
})
|
|
13688
|
+
}),
|
|
13689
|
+
external_exports.object({
|
|
13690
|
+
operation: external_exports.literal("opportunity.defer"),
|
|
13691
|
+
input: OpportunityDecisionInputBaseSchema.extend({
|
|
13692
|
+
approved_effect: external_exports.literal("defer_internal_opportunity")
|
|
13693
|
+
})
|
|
13694
|
+
}),
|
|
13695
|
+
external_exports.object({
|
|
13696
|
+
operation: external_exports.literal("opportunity.annotate"),
|
|
13697
|
+
input: OpportunityDecisionInputBaseSchema.extend({
|
|
13698
|
+
approved_effect: external_exports.literal("annotate_internal_opportunity")
|
|
13699
|
+
})
|
|
13007
13700
|
}),
|
|
13008
|
-
external_exports.object({
|
|
13009
|
-
|
|
13010
|
-
|
|
13011
|
-
|
|
13012
|
-
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
|
|
13025
|
-
|
|
13026
|
-
|
|
13027
|
-
|
|
13028
|
-
|
|
13029
|
-
|
|
13030
|
-
|
|
13031
|
-
|
|
13032
|
-
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13044
|
-
|
|
13045
|
-
|
|
13046
|
-
|
|
13047
|
-
|
|
13048
|
-
|
|
13049
|
-
|
|
13050
|
-
|
|
13051
|
-
|
|
13052
|
-
|
|
13053
|
-
|
|
13054
|
-
|
|
13055
|
-
|
|
13056
|
-
|
|
13057
|
-
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
|
|
13062
|
-
|
|
13701
|
+
external_exports.object({
|
|
13702
|
+
operation: external_exports.literal("opportunity.block"),
|
|
13703
|
+
input: OpportunityDecisionInputBaseSchema.extend({
|
|
13704
|
+
approved_effect: external_exports.literal("block_internal_opportunity")
|
|
13705
|
+
})
|
|
13706
|
+
}),
|
|
13707
|
+
external_exports.object({
|
|
13708
|
+
operation: external_exports.literal("fde_action.get"),
|
|
13709
|
+
input: external_exports.object({
|
|
13710
|
+
id: external_exports.string().uuid(),
|
|
13711
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13712
|
+
command_id: external_exports.string().min(1).max(128).optional()
|
|
13713
|
+
})
|
|
13714
|
+
}),
|
|
13715
|
+
external_exports.object({
|
|
13716
|
+
operation: external_exports.literal("fde_action.command"),
|
|
13717
|
+
input: external_exports.object({
|
|
13718
|
+
id: external_exports.string().uuid(),
|
|
13719
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13720
|
+
source_version: external_exports.string().datetime(),
|
|
13721
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13722
|
+
command: external_exports.enum([
|
|
13723
|
+
"assign",
|
|
13724
|
+
"approve",
|
|
13725
|
+
"annotate",
|
|
13726
|
+
"defer",
|
|
13727
|
+
"resolve",
|
|
13728
|
+
"reject"
|
|
13729
|
+
]),
|
|
13730
|
+
reason: external_exports.string().trim().min(3).max(1e3),
|
|
13731
|
+
approved: external_exports.literal(true),
|
|
13732
|
+
approved_effect: external_exports.literal("apply_server_advertised_fde_action_command"),
|
|
13733
|
+
approved_reversible: external_exports.literal(true)
|
|
13734
|
+
})
|
|
13735
|
+
}),
|
|
13736
|
+
external_exports.object({
|
|
13737
|
+
operation: external_exports.literal("graph_recovery.get"),
|
|
13738
|
+
input: external_exports.object({
|
|
13739
|
+
id: external_exports.string().uuid(),
|
|
13740
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13741
|
+
command_id: external_exports.string().min(1).max(128).optional()
|
|
13742
|
+
})
|
|
13743
|
+
}),
|
|
13744
|
+
external_exports.object({
|
|
13745
|
+
operation: external_exports.literal("graph_recovery.command"),
|
|
13746
|
+
input: external_exports.object({
|
|
13747
|
+
id: external_exports.string().uuid(),
|
|
13748
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13749
|
+
source_version: external_exports.string().uuid(),
|
|
13750
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13751
|
+
command: external_exports.enum(["retry_step", "resume", "reassign"]),
|
|
13752
|
+
reason: external_exports.string().trim().min(3).max(1e3),
|
|
13753
|
+
approved: external_exports.literal(true),
|
|
13754
|
+
approved_effect: external_exports.literal(
|
|
13755
|
+
"apply_server_advertised_graph_recovery_command"
|
|
13756
|
+
),
|
|
13757
|
+
approved_reversible: external_exports.literal(true)
|
|
13758
|
+
})
|
|
13759
|
+
}),
|
|
13760
|
+
external_exports.object({
|
|
13761
|
+
operation: external_exports.literal("graph_recovery.select_predecessor"),
|
|
13762
|
+
input: external_exports.object({
|
|
13763
|
+
id: external_exports.string().uuid(),
|
|
13764
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13765
|
+
source_version: external_exports.string().uuid(),
|
|
13766
|
+
command_id: external_exports.string().min(1).max(128),
|
|
13767
|
+
predecessor_event_id: external_exports.string().uuid(),
|
|
13768
|
+
reason: external_exports.string().trim().min(3).max(1e3),
|
|
13769
|
+
approved: external_exports.literal(true),
|
|
13770
|
+
approved_effect: external_exports.literal("continue_from_selected_predecessor"),
|
|
13771
|
+
approved_reversible: external_exports.literal(false)
|
|
13772
|
+
})
|
|
13773
|
+
}),
|
|
13774
|
+
external_exports.object({
|
|
13775
|
+
operation: external_exports.literal("annotation.get"),
|
|
13776
|
+
input: external_exports.object({
|
|
13777
|
+
task_id: external_exports.string().uuid(),
|
|
13778
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13779
|
+
command_id: external_exports.string().min(1).max(200).optional(),
|
|
13780
|
+
command_operation: external_exports.enum(["claim", "assign", "reassign", "escalate", "recall", "dismiss", "complete"]).optional()
|
|
13781
|
+
}).refine((value) => Boolean(value.command_id) === Boolean(value.command_operation), {
|
|
13782
|
+
message: "command_id and command_operation must be supplied together"
|
|
13783
|
+
})
|
|
13784
|
+
}),
|
|
13785
|
+
external_exports.object({
|
|
13786
|
+
operation: external_exports.literal("annotation.command"),
|
|
13787
|
+
input: external_exports.object({
|
|
13788
|
+
task_id: external_exports.string().uuid(),
|
|
13789
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13790
|
+
source_version: external_exports.number().int().positive(),
|
|
13791
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13792
|
+
command: external_exports.enum(["claim", "assign", "reassign", "escalate", "recall", "dismiss"]),
|
|
13793
|
+
target_user_id: external_exports.string().uuid().optional(),
|
|
13794
|
+
reason: external_exports.string().trim().min(1).max(1e3).optional(),
|
|
13795
|
+
approved: external_exports.literal(true),
|
|
13796
|
+
approved_effect: external_exports.enum([
|
|
13797
|
+
"claim_annotation_task",
|
|
13798
|
+
"assign_annotation_task",
|
|
13799
|
+
"reassign_annotation_task",
|
|
13800
|
+
"escalate_annotation_task",
|
|
13801
|
+
"recall_annotation_task",
|
|
13802
|
+
"dismiss_annotation_task"
|
|
13803
|
+
]),
|
|
13804
|
+
approved_reversible: external_exports.boolean()
|
|
13805
|
+
}).superRefine((value, ctx) => {
|
|
13806
|
+
const expected = {
|
|
13807
|
+
claim: { effect: "claim_annotation_task", reversible: true },
|
|
13808
|
+
assign: { effect: "assign_annotation_task", reversible: true },
|
|
13809
|
+
reassign: { effect: "reassign_annotation_task", reversible: true },
|
|
13810
|
+
escalate: { effect: "escalate_annotation_task", reversible: true },
|
|
13811
|
+
recall: { effect: "recall_annotation_task", reversible: true },
|
|
13812
|
+
dismiss: { effect: "dismiss_annotation_task", reversible: false }
|
|
13813
|
+
}[value.command];
|
|
13814
|
+
if (value.approved_effect !== expected.effect || value.approved_reversible !== expected.reversible) {
|
|
13815
|
+
ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "approval fingerprint does not match the annotation command" });
|
|
13816
|
+
}
|
|
13817
|
+
})
|
|
13818
|
+
}),
|
|
13819
|
+
external_exports.object({
|
|
13820
|
+
operation: external_exports.literal("annotation.complete"),
|
|
13821
|
+
input: external_exports.object({
|
|
13822
|
+
task_id: external_exports.string().uuid(),
|
|
13823
|
+
brand_id: external_exports.string().uuid().optional(),
|
|
13824
|
+
source_version: external_exports.number().int().positive(),
|
|
13825
|
+
command_id: external_exports.string().min(1).max(200),
|
|
13826
|
+
labels: external_exports.array(external_exports.object({
|
|
13827
|
+
criterion_key: external_exports.string().min(1).max(120),
|
|
13828
|
+
verdict: external_exports.enum(["pass", "fail", "n/a"]),
|
|
13829
|
+
note: external_exports.string().max(4e3).optional(),
|
|
13830
|
+
provenance: external_exports.enum(["blind", "flip", "anchored_agree"]).optional()
|
|
13831
|
+
})).min(1),
|
|
13832
|
+
reason: external_exports.string().trim().min(1).max(1e3).optional(),
|
|
13833
|
+
approved: external_exports.literal(true),
|
|
13834
|
+
approved_effect: external_exports.literal("write_annotation_labels_and_complete_task"),
|
|
13835
|
+
approved_reversible: external_exports.literal(false)
|
|
13063
13836
|
})
|
|
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") }) })
|
|
13837
|
+
})
|
|
13081
13838
|
]);
|
|
13082
13839
|
InboxWorkItemSchema = external_exports.object({
|
|
13083
13840
|
id: external_exports.string(),
|
|
13084
|
-
kind: external_exports.enum([
|
|
13085
|
-
|
|
13841
|
+
kind: external_exports.enum([
|
|
13842
|
+
"change_review",
|
|
13843
|
+
"output_annotation",
|
|
13844
|
+
"opportunity_curation",
|
|
13845
|
+
"graph_recovery",
|
|
13846
|
+
"fde_action"
|
|
13847
|
+
]),
|
|
13848
|
+
subject: external_exports.object({
|
|
13849
|
+
type: external_exports.string(),
|
|
13850
|
+
id: external_exports.string(),
|
|
13851
|
+
revision: external_exports.string()
|
|
13852
|
+
}),
|
|
13086
13853
|
brand_ids: external_exports.array(external_exports.string()),
|
|
13087
13854
|
status: external_exports.enum(["open", "blocked", "in_progress", "resolved"]),
|
|
13088
13855
|
reason: external_exports.string(),
|
|
@@ -13101,7 +13868,11 @@ var init_inbox_management = __esm({
|
|
|
13101
13868
|
});
|
|
13102
13869
|
InboxGetReceiptSchema = external_exports.discriminatedUnion("state", [
|
|
13103
13870
|
external_exports.object({ state: external_exports.literal("complete"), item: InboxWorkItemSchema }),
|
|
13104
|
-
external_exports.object({
|
|
13871
|
+
external_exports.object({
|
|
13872
|
+
state: external_exports.literal("unavailable"),
|
|
13873
|
+
item: external_exports.null(),
|
|
13874
|
+
missing: external_exports.array(external_exports.string())
|
|
13875
|
+
})
|
|
13105
13876
|
]);
|
|
13106
13877
|
InboxEnvelopeBaseSchema = external_exports.object({
|
|
13107
13878
|
scope: external_exports.object({
|
|
@@ -13118,12 +13889,24 @@ var init_inbox_management = __esm({
|
|
|
13118
13889
|
state: external_exports.literal("unknown"),
|
|
13119
13890
|
command_id: external_exports.string(),
|
|
13120
13891
|
instruction: external_exports.literal("inspect_source_before_retry"),
|
|
13121
|
-
reason: external_exports.enum([
|
|
13892
|
+
reason: external_exports.enum([
|
|
13893
|
+
"response_unproven",
|
|
13894
|
+
"read_back_unavailable",
|
|
13895
|
+
"postcondition_not_observed"
|
|
13896
|
+
]).default("response_unproven"),
|
|
13122
13897
|
read_back: external_exports.object({ head_sha: external_exports.string(), pr_state: external_exports.string(), merged: external_exports.boolean() }).optional()
|
|
13123
13898
|
});
|
|
13124
13899
|
ChangeReadBackSchema = external_exports.discriminatedUnion("state", [
|
|
13125
|
-
external_exports.object({
|
|
13126
|
-
|
|
13900
|
+
external_exports.object({
|
|
13901
|
+
state: external_exports.literal("verified"),
|
|
13902
|
+
head_sha: external_exports.string(),
|
|
13903
|
+
pr_state: external_exports.string(),
|
|
13904
|
+
merged: external_exports.boolean()
|
|
13905
|
+
}),
|
|
13906
|
+
external_exports.object({
|
|
13907
|
+
state: external_exports.literal("unavailable"),
|
|
13908
|
+
instruction: external_exports.literal("inspect_source_before_retry")
|
|
13909
|
+
})
|
|
13127
13910
|
]);
|
|
13128
13911
|
OpportunitySnapshotSchema = external_exports.object({
|
|
13129
13912
|
id: external_exports.string().uuid(),
|
|
@@ -13134,13 +13917,70 @@ var init_inbox_management = __esm({
|
|
|
13134
13917
|
summary: external_exports.string(),
|
|
13135
13918
|
brand_id: external_exports.string().nullable(),
|
|
13136
13919
|
assignee_user_id: external_exports.string().nullable(),
|
|
13137
|
-
customer_wording: external_exports.object({
|
|
13920
|
+
customer_wording: external_exports.object({
|
|
13921
|
+
title: external_exports.string(),
|
|
13922
|
+
questions: external_exports.array(external_exports.string())
|
|
13923
|
+
})
|
|
13138
13924
|
}).passthrough();
|
|
13139
|
-
OpportunityUnknownReceiptSchema = external_exports.object({
|
|
13925
|
+
OpportunityUnknownReceiptSchema = external_exports.object({
|
|
13926
|
+
state: external_exports.literal("unknown"),
|
|
13927
|
+
command_id: external_exports.string(),
|
|
13928
|
+
instruction: external_exports.literal("inspect_source_before_retry")
|
|
13929
|
+
});
|
|
13140
13930
|
OpportunityCommandSchema = external_exports.union([
|
|
13141
|
-
external_exports.object({
|
|
13931
|
+
external_exports.object({
|
|
13932
|
+
state: external_exports.literal("recorded"),
|
|
13933
|
+
operation: external_exports.string(),
|
|
13934
|
+
response: external_exports.unknown()
|
|
13935
|
+
}),
|
|
13142
13936
|
external_exports.object({ state: external_exports.literal("not_recorded") })
|
|
13143
13937
|
]);
|
|
13938
|
+
FdeActionSnapshotSchema = external_exports.object({
|
|
13939
|
+
id: external_exports.string().uuid(),
|
|
13940
|
+
brand_id: external_exports.string().uuid(),
|
|
13941
|
+
lifecycle: external_exports.string(),
|
|
13942
|
+
supported_commands: external_exports.array(external_exports.string()),
|
|
13943
|
+
updated_at: external_exports.string(),
|
|
13944
|
+
title: external_exports.string(),
|
|
13945
|
+
summary: external_exports.string(),
|
|
13946
|
+
owner_kind: external_exports.string(),
|
|
13947
|
+
owner_user_id: external_exports.string().nullable(),
|
|
13948
|
+
evidence_refs: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown()))
|
|
13949
|
+
}).passthrough();
|
|
13950
|
+
GraphRecoverySnapshotSchema = external_exports.object({
|
|
13951
|
+
invocation_id: external_exports.string().uuid(),
|
|
13952
|
+
brand_id: external_exports.string().uuid(),
|
|
13953
|
+
agent_id: external_exports.string().uuid(),
|
|
13954
|
+
expected_event_id: external_exports.string().uuid(),
|
|
13955
|
+
next_legal_commands: external_exports.array(external_exports.string()),
|
|
13956
|
+
reason: external_exports.string(),
|
|
13957
|
+
updated_at: external_exports.string()
|
|
13958
|
+
}).passthrough();
|
|
13959
|
+
LifecycleUnknownReceiptSchema = external_exports.object({
|
|
13960
|
+
state: external_exports.literal("unknown"),
|
|
13961
|
+
command_id: external_exports.string(),
|
|
13962
|
+
instruction: external_exports.literal("inspect_source_before_retry")
|
|
13963
|
+
});
|
|
13964
|
+
AnnotationSnapshotSchema = external_exports.object({
|
|
13965
|
+
id: external_exports.string().uuid(),
|
|
13966
|
+
brand_id: external_exports.string().uuid(),
|
|
13967
|
+
lock_version: external_exports.number().int().positive(),
|
|
13968
|
+
status: external_exports.string(),
|
|
13969
|
+
stage: external_exports.string(),
|
|
13970
|
+
valid_next_actions: external_exports.array(external_exports.string()),
|
|
13971
|
+
case_input: external_exports.string(),
|
|
13972
|
+
judge_summary: external_exports.record(external_exports.string(), external_exports.unknown()),
|
|
13973
|
+
source_output: external_exports.unknown().nullable().default(null),
|
|
13974
|
+
labelable_criterion_keys: external_exports.array(external_exports.string()),
|
|
13975
|
+
assignee_user_id: external_exports.string().uuid().nullable(),
|
|
13976
|
+
completed_by_user_id: external_exports.string().uuid().nullable(),
|
|
13977
|
+
updated_at: external_exports.string()
|
|
13978
|
+
}).passthrough();
|
|
13979
|
+
AnnotationUnknownReceiptSchema = external_exports.object({
|
|
13980
|
+
state: external_exports.literal("unknown"),
|
|
13981
|
+
command_id: external_exports.string(),
|
|
13982
|
+
instruction: external_exports.literal("inspect_source_before_retry")
|
|
13983
|
+
});
|
|
13144
13984
|
InboxOperationEnvelopeSchema = external_exports.discriminatedUnion("operation", [
|
|
13145
13985
|
InboxEnvelopeBaseSchema.extend({
|
|
13146
13986
|
operation: external_exports.literal("inbox.list"),
|
|
@@ -13152,40 +13992,258 @@ var init_inbox_management = __esm({
|
|
|
13152
13992
|
source_version: external_exports.string().nullable(),
|
|
13153
13993
|
receipt: InboxGetReceiptSchema
|
|
13154
13994
|
}),
|
|
13155
|
-
InboxEnvelopeBaseSchema.extend({
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13165
|
-
|
|
13166
|
-
|
|
13167
|
-
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
|
|
13177
|
-
|
|
13178
|
-
|
|
13179
|
-
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
|
|
13995
|
+
InboxEnvelopeBaseSchema.extend({
|
|
13996
|
+
operation: external_exports.literal("change.get"),
|
|
13997
|
+
source_version: external_exports.string(),
|
|
13998
|
+
receipt: external_exports.object({
|
|
13999
|
+
state: external_exports.literal("complete"),
|
|
14000
|
+
item: InboxWorkItemSchema,
|
|
14001
|
+
command: external_exports.union([
|
|
14002
|
+
external_exports.object({
|
|
14003
|
+
state: external_exports.literal("recorded"),
|
|
14004
|
+
operation: external_exports.string(),
|
|
14005
|
+
response: external_exports.unknown()
|
|
14006
|
+
}),
|
|
14007
|
+
external_exports.object({ state: external_exports.literal("not_recorded") })
|
|
14008
|
+
]).optional()
|
|
14009
|
+
})
|
|
14010
|
+
}),
|
|
14011
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14012
|
+
operation: external_exports.literal("change.diff"),
|
|
14013
|
+
source_version: external_exports.string(),
|
|
14014
|
+
receipt: external_exports.object({
|
|
14015
|
+
pr_number: external_exports.number(),
|
|
14016
|
+
head_sha: external_exports.string(),
|
|
14017
|
+
base_sha: external_exports.string(),
|
|
14018
|
+
files: external_exports.array(
|
|
14019
|
+
external_exports.object({
|
|
14020
|
+
filename: external_exports.string(),
|
|
14021
|
+
status: external_exports.string(),
|
|
14022
|
+
additions: external_exports.number(),
|
|
14023
|
+
deletions: external_exports.number(),
|
|
14024
|
+
changes: external_exports.number(),
|
|
14025
|
+
previous_filename: external_exports.string().optional(),
|
|
14026
|
+
patch: external_exports.string().optional(),
|
|
14027
|
+
too_large: external_exports.boolean(),
|
|
14028
|
+
is_binary: external_exports.boolean(),
|
|
14029
|
+
intent: external_exports.string().nullable().optional(),
|
|
14030
|
+
change: external_exports.string().nullable().optional(),
|
|
14031
|
+
agentLabel: external_exports.string().nullable().optional()
|
|
14032
|
+
})
|
|
14033
|
+
),
|
|
14034
|
+
state: external_exports.string().optional(),
|
|
14035
|
+
merged: external_exports.boolean().optional(),
|
|
14036
|
+
merged_at: external_exports.string().nullable().optional(),
|
|
14037
|
+
created_at: external_exports.string().optional(),
|
|
14038
|
+
updated_at: external_exports.string().optional()
|
|
14039
|
+
})
|
|
14040
|
+
}),
|
|
14041
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14042
|
+
operation: external_exports.literal("change.head"),
|
|
14043
|
+
source_version: external_exports.string(),
|
|
14044
|
+
receipt: external_exports.object({ pr_number: external_exports.number(), head_sha: external_exports.string() })
|
|
14045
|
+
}),
|
|
14046
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14047
|
+
operation: external_exports.literal("change.approve"),
|
|
14048
|
+
source_version: external_exports.string(),
|
|
14049
|
+
receipt: external_exports.union([
|
|
14050
|
+
external_exports.object({
|
|
14051
|
+
merged: external_exports.literal(true),
|
|
14052
|
+
sha: external_exports.string(),
|
|
14053
|
+
self_approved: external_exports.boolean(),
|
|
14054
|
+
already_resolved: external_exports.boolean(),
|
|
14055
|
+
resolved_by: external_exports.string().nullable(),
|
|
14056
|
+
replayed: external_exports.boolean(),
|
|
14057
|
+
read_back: ChangeReadBackSchema
|
|
14058
|
+
}),
|
|
14059
|
+
UnknownMutationReceiptSchema
|
|
14060
|
+
])
|
|
14061
|
+
}),
|
|
14062
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14063
|
+
operation: external_exports.literal("change.decline"),
|
|
14064
|
+
source_version: external_exports.string(),
|
|
14065
|
+
receipt: external_exports.union([
|
|
14066
|
+
external_exports.object({
|
|
14067
|
+
declined: external_exports.literal(true),
|
|
14068
|
+
already_resolved: external_exports.boolean(),
|
|
14069
|
+
resolved_by: external_exports.string().nullable().optional(),
|
|
14070
|
+
replayed: external_exports.boolean(),
|
|
14071
|
+
read_back: ChangeReadBackSchema
|
|
14072
|
+
}),
|
|
14073
|
+
UnknownMutationReceiptSchema
|
|
14074
|
+
])
|
|
14075
|
+
}),
|
|
14076
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14077
|
+
operation: external_exports.literal("change.revise"),
|
|
14078
|
+
source_version: external_exports.string(),
|
|
14079
|
+
receipt: external_exports.union([
|
|
14080
|
+
external_exports.object({
|
|
14081
|
+
dispatched: external_exports.boolean(),
|
|
14082
|
+
runtime: external_exports.enum(["anthropic_managed", "boo"]),
|
|
14083
|
+
replayed: external_exports.boolean().optional(),
|
|
14084
|
+
read_back: ChangeReadBackSchema
|
|
14085
|
+
}).passthrough(),
|
|
14086
|
+
UnknownMutationReceiptSchema
|
|
14087
|
+
])
|
|
14088
|
+
}),
|
|
14089
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14090
|
+
operation: external_exports.literal("change.apply_revision"),
|
|
14091
|
+
source_version: external_exports.string(),
|
|
14092
|
+
receipt: external_exports.union([
|
|
14093
|
+
external_exports.object({
|
|
14094
|
+
committed: external_exports.literal(true),
|
|
14095
|
+
branch: external_exports.string(),
|
|
14096
|
+
pr_number: external_exports.number(),
|
|
14097
|
+
replayed: external_exports.boolean().optional(),
|
|
14098
|
+
read_back: ChangeReadBackSchema
|
|
14099
|
+
}),
|
|
14100
|
+
UnknownMutationReceiptSchema
|
|
14101
|
+
])
|
|
14102
|
+
}),
|
|
14103
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14104
|
+
operation: external_exports.literal("opportunity.get"),
|
|
14105
|
+
source_version: external_exports.string(),
|
|
14106
|
+
receipt: external_exports.object({
|
|
14107
|
+
state: external_exports.literal("complete"),
|
|
14108
|
+
opportunity: OpportunitySnapshotSchema,
|
|
14109
|
+
command: OpportunityCommandSchema.optional()
|
|
14110
|
+
})
|
|
14111
|
+
}),
|
|
14112
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14113
|
+
operation: external_exports.literal("opportunity.propose"),
|
|
14114
|
+
source_version: external_exports.string(),
|
|
14115
|
+
receipt: external_exports.union([
|
|
14116
|
+
external_exports.object({
|
|
14117
|
+
state: external_exports.enum(["created", "reused"]),
|
|
14118
|
+
opportunity: OpportunitySnapshotSchema,
|
|
14119
|
+
replayed: external_exports.boolean()
|
|
14120
|
+
}),
|
|
14121
|
+
OpportunityUnknownReceiptSchema
|
|
14122
|
+
])
|
|
14123
|
+
}),
|
|
14124
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14125
|
+
operation: external_exports.literal("opportunity.assign_and_send"),
|
|
14126
|
+
source_version: external_exports.string(),
|
|
14127
|
+
receipt: external_exports.union([
|
|
14128
|
+
external_exports.object({
|
|
14129
|
+
state: external_exports.literal("sent"),
|
|
14130
|
+
recipient: external_exports.object({ user_id: external_exports.string().uuid(), name: external_exports.string() }),
|
|
14131
|
+
wording: external_exports.object({
|
|
14132
|
+
title: external_exports.string(),
|
|
14133
|
+
questions: external_exports.array(external_exports.string())
|
|
14134
|
+
}),
|
|
14135
|
+
deduplicated: external_exports.boolean(),
|
|
14136
|
+
trace_id: external_exports.string(),
|
|
14137
|
+
receipt_event_id: external_exports.string(),
|
|
14138
|
+
read_back: OpportunitySnapshotSchema
|
|
14139
|
+
}),
|
|
14140
|
+
OpportunityUnknownReceiptSchema
|
|
14141
|
+
])
|
|
14142
|
+
}),
|
|
14143
|
+
...["reject", "defer", "annotate", "block"].map(
|
|
14144
|
+
(decision) => InboxEnvelopeBaseSchema.extend({
|
|
14145
|
+
operation: external_exports.literal(`opportunity.${decision}`),
|
|
14146
|
+
source_version: external_exports.string(),
|
|
14147
|
+
receipt: external_exports.union([
|
|
14148
|
+
external_exports.object({
|
|
14149
|
+
state: external_exports.literal(decision),
|
|
14150
|
+
deduplicated: external_exports.boolean(),
|
|
14151
|
+
trace_id: external_exports.string(),
|
|
14152
|
+
receipt_event_id: external_exports.string(),
|
|
14153
|
+
read_back: OpportunitySnapshotSchema
|
|
14154
|
+
}),
|
|
14155
|
+
OpportunityUnknownReceiptSchema
|
|
14156
|
+
])
|
|
14157
|
+
})
|
|
14158
|
+
),
|
|
14159
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14160
|
+
operation: external_exports.literal("fde_action.get"),
|
|
14161
|
+
source_version: external_exports.string(),
|
|
14162
|
+
receipt: external_exports.object({
|
|
14163
|
+
state: external_exports.literal("complete"),
|
|
14164
|
+
action: FdeActionSnapshotSchema,
|
|
14165
|
+
command: OpportunityCommandSchema.optional()
|
|
14166
|
+
})
|
|
14167
|
+
}),
|
|
14168
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14169
|
+
operation: external_exports.literal("fde_action.command"),
|
|
14170
|
+
source_version: external_exports.string(),
|
|
14171
|
+
receipt: external_exports.union([
|
|
14172
|
+
external_exports.object({
|
|
14173
|
+
state: external_exports.enum(["accepted", "resolved", "blocked"]),
|
|
14174
|
+
result: external_exports.unknown(),
|
|
14175
|
+
read_back: FdeActionSnapshotSchema
|
|
14176
|
+
}),
|
|
14177
|
+
LifecycleUnknownReceiptSchema
|
|
14178
|
+
])
|
|
14179
|
+
}),
|
|
14180
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14181
|
+
operation: external_exports.literal("graph_recovery.get"),
|
|
14182
|
+
source_version: external_exports.string(),
|
|
14183
|
+
receipt: external_exports.object({
|
|
14184
|
+
state: external_exports.literal("complete"),
|
|
14185
|
+
cycle: GraphRecoverySnapshotSchema,
|
|
14186
|
+
command: OpportunityCommandSchema.optional()
|
|
14187
|
+
})
|
|
14188
|
+
}),
|
|
14189
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14190
|
+
operation: external_exports.literal("graph_recovery.command"),
|
|
14191
|
+
source_version: external_exports.string(),
|
|
14192
|
+
receipt: external_exports.union([
|
|
14193
|
+
external_exports.object({
|
|
14194
|
+
state: external_exports.enum(["accepted", "resolved", "blocked"]),
|
|
14195
|
+
result: external_exports.unknown(),
|
|
14196
|
+
read_back: GraphRecoverySnapshotSchema
|
|
14197
|
+
}),
|
|
14198
|
+
LifecycleUnknownReceiptSchema
|
|
14199
|
+
])
|
|
14200
|
+
}),
|
|
14201
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14202
|
+
operation: external_exports.literal("graph_recovery.select_predecessor"),
|
|
14203
|
+
source_version: external_exports.string(),
|
|
14204
|
+
receipt: external_exports.union([
|
|
14205
|
+
external_exports.object({
|
|
14206
|
+
state: external_exports.enum(["accepted", "resolved", "blocked"]),
|
|
14207
|
+
result: external_exports.unknown(),
|
|
14208
|
+
read_back: GraphRecoverySnapshotSchema
|
|
14209
|
+
}),
|
|
14210
|
+
LifecycleUnknownReceiptSchema
|
|
14211
|
+
])
|
|
14212
|
+
}),
|
|
14213
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14214
|
+
operation: external_exports.literal("annotation.get"),
|
|
14215
|
+
source_version: external_exports.number().int().positive(),
|
|
14216
|
+
receipt: external_exports.object({
|
|
14217
|
+
state: external_exports.literal("complete"),
|
|
14218
|
+
task: AnnotationSnapshotSchema,
|
|
14219
|
+
command: OpportunityCommandSchema.optional()
|
|
14220
|
+
})
|
|
14221
|
+
}),
|
|
14222
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14223
|
+
operation: external_exports.literal("annotation.command"),
|
|
14224
|
+
source_version: external_exports.number().int().positive(),
|
|
14225
|
+
receipt: external_exports.union([
|
|
14226
|
+
external_exports.object({
|
|
14227
|
+
state: external_exports.enum(["completed", "no_change"]),
|
|
14228
|
+
replayed: external_exports.boolean(),
|
|
14229
|
+
read_back: AnnotationSnapshotSchema
|
|
14230
|
+
}),
|
|
14231
|
+
AnnotationUnknownReceiptSchema
|
|
14232
|
+
])
|
|
14233
|
+
}),
|
|
14234
|
+
InboxEnvelopeBaseSchema.extend({
|
|
14235
|
+
operation: external_exports.literal("annotation.complete"),
|
|
14236
|
+
source_version: external_exports.number().int().positive(),
|
|
14237
|
+
receipt: external_exports.union([
|
|
14238
|
+
external_exports.object({
|
|
14239
|
+
state: external_exports.enum(["completed", "pending", "no_change"]),
|
|
14240
|
+
replayed: external_exports.boolean(),
|
|
14241
|
+
label_writes: external_exports.array(external_exports.unknown()),
|
|
14242
|
+
read_back: AnnotationSnapshotSchema
|
|
14243
|
+
}),
|
|
14244
|
+
AnnotationUnknownReceiptSchema
|
|
14245
|
+
])
|
|
14246
|
+
})
|
|
13189
14247
|
]);
|
|
13190
14248
|
}
|
|
13191
14249
|
});
|
|
@@ -18960,34 +20018,60 @@ __export(inbox_management_exports, {
|
|
|
18960
20018
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
18961
20019
|
async function sessionForOrg(org) {
|
|
18962
20020
|
const token = await resolveSession();
|
|
18963
|
-
if (!token)
|
|
18964
|
-
|
|
18965
|
-
|
|
20021
|
+
if (!token)
|
|
20022
|
+
throw Object.assign(new Error("Run `bamboo-agents login` first."), {
|
|
20023
|
+
code: "authentication_required"
|
|
20024
|
+
});
|
|
20025
|
+
if (token.startsWith("bam_"))
|
|
20026
|
+
throw Object.assign(
|
|
20027
|
+
new Error(
|
|
20028
|
+
"Cross-customer Inbox operations require a user session; API keys cannot switch organizations."
|
|
20029
|
+
),
|
|
20030
|
+
{ code: "organization_scope_required" }
|
|
20031
|
+
);
|
|
20032
|
+
if (!org)
|
|
20033
|
+
throw Object.assign(
|
|
20034
|
+
new Error("Pass the customer organization with --org."),
|
|
20035
|
+
{ code: "organization_scope_required" }
|
|
20036
|
+
);
|
|
18966
20037
|
return token;
|
|
18967
20038
|
}
|
|
18968
20039
|
async function inputObject(value) {
|
|
18969
20040
|
const raw = value.startsWith("@") ? await readFile8(value.slice(1), "utf8") : value;
|
|
18970
20041
|
const parsed = JSON.parse(raw);
|
|
18971
|
-
if (!parsed || Array.isArray(parsed) || typeof parsed !== "object")
|
|
20042
|
+
if (!parsed || Array.isArray(parsed) || typeof parsed !== "object")
|
|
20043
|
+
throw new Error("--input must be a JSON object");
|
|
18972
20044
|
return parsed;
|
|
18973
20045
|
}
|
|
18974
20046
|
function fail(error, output) {
|
|
18975
20047
|
const value = error;
|
|
18976
20048
|
const invalidInput = error instanceof SyntaxError || error instanceof ZodError;
|
|
18977
20049
|
const unknownOutcome = error.name === "AbortError";
|
|
18978
|
-
emitError(
|
|
18979
|
-
|
|
18980
|
-
|
|
18981
|
-
|
|
20050
|
+
emitError(
|
|
20051
|
+
{
|
|
20052
|
+
code: value.code ?? value.errorCode ?? (unknownOutcome ? "unknown_outcome" : invalidInput ? "invalid_input" : "inbox_operation_failed"),
|
|
20053
|
+
message: value.message ?? "Inbox operation failed."
|
|
20054
|
+
},
|
|
20055
|
+
output,
|
|
20056
|
+
1
|
|
20057
|
+
);
|
|
18982
20058
|
throw new Error("unreachable");
|
|
18983
20059
|
}
|
|
18984
20060
|
async function runInboxOperations(options) {
|
|
18985
20061
|
try {
|
|
18986
20062
|
const session = await resolveSession();
|
|
18987
|
-
if (!session)
|
|
20063
|
+
if (!session)
|
|
20064
|
+
throw Object.assign(new Error("Run `bamboo-agents login` first."), {
|
|
20065
|
+
code: "authentication_required"
|
|
20066
|
+
});
|
|
18988
20067
|
const catalog = await getInboxManagementOperations(session);
|
|
18989
|
-
for (const binding of catalog.bindings)
|
|
18990
|
-
|
|
20068
|
+
for (const binding of catalog.bindings)
|
|
20069
|
+
human(
|
|
20070
|
+
` ${binding.operation.padEnd(18)} ${binding.description}`,
|
|
20071
|
+
options
|
|
20072
|
+
);
|
|
20073
|
+
for (const command of catalog.related_cli_commands)
|
|
20074
|
+
human(` ${command}`, options);
|
|
18991
20075
|
emitSuccess(catalog, options);
|
|
18992
20076
|
} catch (error) {
|
|
18993
20077
|
fail(error, options);
|
|
@@ -18997,38 +20081,141 @@ async function runInboxManage(options) {
|
|
|
18997
20081
|
try {
|
|
18998
20082
|
const session = await sessionForOrg(options.org);
|
|
18999
20083
|
if (!InboxManageOperationSchema.safeParse(options.operation).success) {
|
|
19000
|
-
throw Object.assign(
|
|
20084
|
+
throw Object.assign(
|
|
20085
|
+
new Error(`Unsupported Inbox operation: ${options.operation}`),
|
|
20086
|
+
{ code: "unsupported_operation" }
|
|
20087
|
+
);
|
|
19001
20088
|
}
|
|
19002
20089
|
const input = await inputObject(options.input);
|
|
19003
|
-
const isMutation = options.operation.startsWith("change.") && !["change.get", "change.diff", "change.head"].includes(
|
|
20090
|
+
const isMutation = options.operation.startsWith("change.") && !["change.get", "change.diff", "change.head"].includes(
|
|
20091
|
+
options.operation
|
|
20092
|
+
) || options.operation.startsWith("opportunity.") && options.operation !== "opportunity.get" || options.operation === "fde_action.command" || options.operation.startsWith("graph_recovery.") && options.operation !== "graph_recovery.get" || options.operation.startsWith("annotation.") && options.operation !== "annotation.get";
|
|
19004
20093
|
if (isMutation) {
|
|
19005
20094
|
const isProposal = options.operation === "opportunity.propose";
|
|
19006
20095
|
const isOpportunity = options.operation.startsWith("opportunity.");
|
|
19007
|
-
const
|
|
19008
|
-
const
|
|
19009
|
-
|
|
20096
|
+
const isFdeAction = options.operation.startsWith("fde_action.");
|
|
20097
|
+
const isGraphRecovery = options.operation.startsWith("graph_recovery.");
|
|
20098
|
+
const isAnnotation = options.operation.startsWith("annotation.");
|
|
20099
|
+
const previewCall = isProposal ? InboxManagementCallSchema.parse({
|
|
20100
|
+
operation: "inbox.list",
|
|
20101
|
+
input: {
|
|
20102
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {},
|
|
20103
|
+
limit: 1
|
|
20104
|
+
}
|
|
20105
|
+
}) : isOpportunity ? InboxManagementCallSchema.parse({
|
|
20106
|
+
operation: "opportunity.get",
|
|
20107
|
+
input: {
|
|
20108
|
+
opportunity_id: input.opportunity_id,
|
|
20109
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
|
|
20110
|
+
}
|
|
20111
|
+
}) : isFdeAction ? InboxManagementCallSchema.parse({
|
|
20112
|
+
operation: "fde_action.get",
|
|
20113
|
+
input: {
|
|
20114
|
+
id: input.id,
|
|
20115
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
|
|
20116
|
+
}
|
|
20117
|
+
}) : isGraphRecovery ? InboxManagementCallSchema.parse({
|
|
20118
|
+
operation: "graph_recovery.get",
|
|
20119
|
+
input: {
|
|
20120
|
+
id: input.id,
|
|
20121
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
|
|
20122
|
+
}
|
|
20123
|
+
}) : isAnnotation ? InboxManagementCallSchema.parse({
|
|
20124
|
+
operation: "annotation.get",
|
|
20125
|
+
input: {
|
|
20126
|
+
task_id: input.task_id,
|
|
20127
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
|
|
20128
|
+
}
|
|
20129
|
+
}) : InboxManagementCallSchema.parse({
|
|
20130
|
+
operation: "change.get",
|
|
20131
|
+
input: {
|
|
20132
|
+
pr_number: input.pr_number,
|
|
20133
|
+
...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
|
|
20134
|
+
}
|
|
20135
|
+
});
|
|
20136
|
+
const preview = await callInboxManagement(
|
|
20137
|
+
session,
|
|
20138
|
+
options.org,
|
|
20139
|
+
previewCall
|
|
20140
|
+
);
|
|
20141
|
+
if (preview.scope.org_id !== options.org)
|
|
20142
|
+
throw Object.assign(
|
|
20143
|
+
new Error(
|
|
20144
|
+
`Requested organization ${options.org} but server resolved ${preview.scope.org_id}.`
|
|
20145
|
+
),
|
|
20146
|
+
{ code: "organization_scope_mismatch" }
|
|
20147
|
+
);
|
|
19010
20148
|
const suppliedVersion = input.source_version ?? input.subject_revision;
|
|
19011
|
-
if (!isProposal && preview.source_version !== suppliedVersion)
|
|
20149
|
+
if (!isProposal && preview.source_version !== suppliedVersion)
|
|
20150
|
+
throw Object.assign(
|
|
20151
|
+
new Error(
|
|
20152
|
+
`The reviewed source revision ${String(suppliedVersion)} is stale; current revision is ${preview.source_version}.`
|
|
20153
|
+
),
|
|
20154
|
+
{ code: "stale_review_task" }
|
|
20155
|
+
);
|
|
20156
|
+
const previewReceipt = preview.receipt && typeof preview.receipt === "object" ? preview.receipt : {};
|
|
20157
|
+
const action = previewReceipt.action;
|
|
20158
|
+
const cycle = previewReceipt.cycle;
|
|
20159
|
+
const advertised = isFdeAction ? action?.supported_commands : isGraphRecovery ? cycle?.next_legal_commands : isAnnotation ? previewReceipt.task?.valid_next_actions : null;
|
|
20160
|
+
const requestedCommand = options.operation === "graph_recovery.select_predecessor" ? "select_predecessor" : options.operation === "annotation.complete" ? "complete" : input.command;
|
|
20161
|
+
if (Array.isArray(advertised) && !advertised.includes(requestedCommand))
|
|
20162
|
+
throw Object.assign(
|
|
20163
|
+
new Error(
|
|
20164
|
+
`Command ${String(requestedCommand)} is not advertised by the current source item.`
|
|
20165
|
+
),
|
|
20166
|
+
{ code: "invalid_transition" }
|
|
20167
|
+
);
|
|
19012
20168
|
const recipient = input.recipient_name ? `; recipient: ${String(input.recipient_name)}` : "";
|
|
19013
20169
|
const wording = input.approved_wording ? `; wording: ${JSON.stringify(input.approved_wording)}` : "";
|
|
19014
|
-
const mutation = MUTATION_EFFECTS[options.operation];
|
|
19015
|
-
const sourceItem = isProposal ? String(
|
|
19016
|
-
|
|
20170
|
+
const mutation = options.operation === "annotation.command" ? ANNOTATION_COMMAND_EFFECTS[String(input.command)] : MUTATION_EFFECTS[options.operation];
|
|
20171
|
+
const sourceItem = isProposal ? String(
|
|
20172
|
+
input.proposal && typeof input.proposal === "object" ? input.proposal.opportunity_key ?? "new stable-key proposal" : "new proposal"
|
|
20173
|
+
) : String(
|
|
20174
|
+
input.opportunity_id ?? input.pr_number ?? input.id ?? input.task_id ?? "unknown"
|
|
20175
|
+
);
|
|
20176
|
+
human(
|
|
20177
|
+
`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}`,
|
|
20178
|
+
options
|
|
20179
|
+
);
|
|
19017
20180
|
if (!options.approve) {
|
|
19018
|
-
throw Object.assign(
|
|
20181
|
+
throw Object.assign(
|
|
20182
|
+
new Error(
|
|
20183
|
+
"This operation changes customer state. Review the preview, obtain approval for its exact scope, source version, effect, and reversibility, then re-run with --approve."
|
|
20184
|
+
),
|
|
20185
|
+
{ code: "approval_required" }
|
|
20186
|
+
);
|
|
20187
|
+
}
|
|
20188
|
+
}
|
|
20189
|
+
if (options.approve) {
|
|
20190
|
+
input.approved = true;
|
|
20191
|
+
const mutation = options.operation === "annotation.command" ? ANNOTATION_COMMAND_EFFECTS[String(input.command)] : MUTATION_EFFECTS[options.operation];
|
|
20192
|
+
if (mutation) {
|
|
20193
|
+
input.approved_effect = mutation.effect;
|
|
20194
|
+
input.approved_reversible = mutation.reversible;
|
|
19019
20195
|
}
|
|
19020
20196
|
}
|
|
19021
|
-
|
|
19022
|
-
|
|
20197
|
+
const call = InboxManagementCallSchema.parse({
|
|
20198
|
+
operation: options.operation,
|
|
20199
|
+
input
|
|
20200
|
+
});
|
|
19023
20201
|
const result = await callInboxManagement(session, options.org, call);
|
|
19024
|
-
if (result.scope.org_id !== options.org)
|
|
19025
|
-
|
|
20202
|
+
if (result.scope.org_id !== options.org)
|
|
20203
|
+
throw Object.assign(
|
|
20204
|
+
new Error(
|
|
20205
|
+
`Requested organization ${options.org} but server resolved ${result.scope.org_id}.`
|
|
20206
|
+
),
|
|
20207
|
+
{ code: "organization_scope_mismatch" }
|
|
20208
|
+
);
|
|
20209
|
+
human(
|
|
20210
|
+
`Resolved organization: ${result.scope.org_name} (${result.scope.org_id})`,
|
|
20211
|
+
options
|
|
20212
|
+
);
|
|
19026
20213
|
emitSuccess(result, options);
|
|
19027
20214
|
} catch (error) {
|
|
19028
20215
|
fail(error, options);
|
|
19029
20216
|
}
|
|
19030
20217
|
}
|
|
19031
|
-
var MUTATION_EFFECTS;
|
|
20218
|
+
var MUTATION_EFFECTS, ANNOTATION_COMMAND_EFFECTS;
|
|
19032
20219
|
var init_inbox_management2 = __esm({
|
|
19033
20220
|
"src/commands/inbox-management.ts"() {
|
|
19034
20221
|
"use strict";
|
|
@@ -19039,15 +20226,66 @@ var init_inbox_management2 = __esm({
|
|
|
19039
20226
|
init_output();
|
|
19040
20227
|
MUTATION_EFFECTS = {
|
|
19041
20228
|
"change.approve": { effect: "merge_workspace_change", reversible: false },
|
|
19042
|
-
"change.decline": {
|
|
19043
|
-
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
"
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
"
|
|
20229
|
+
"change.decline": {
|
|
20230
|
+
effect: "close_workspace_change_without_merge",
|
|
20231
|
+
reversible: true
|
|
20232
|
+
},
|
|
20233
|
+
"change.revise": {
|
|
20234
|
+
effect: "request_workspace_change_revision",
|
|
20235
|
+
reversible: true
|
|
20236
|
+
},
|
|
20237
|
+
"change.apply_revision": {
|
|
20238
|
+
effect: "commit_workspace_change_revision",
|
|
20239
|
+
reversible: true
|
|
20240
|
+
},
|
|
20241
|
+
"opportunity.propose": {
|
|
20242
|
+
effect: "create_internal_opportunity_proposal",
|
|
20243
|
+
reversible: true
|
|
20244
|
+
},
|
|
20245
|
+
"opportunity.assign_and_send": {
|
|
20246
|
+
effect: "assign_and_release_customer_opportunity",
|
|
20247
|
+
reversible: true
|
|
20248
|
+
},
|
|
20249
|
+
"opportunity.reject": {
|
|
20250
|
+
effect: "reject_internal_opportunity",
|
|
20251
|
+
reversible: true
|
|
20252
|
+
},
|
|
20253
|
+
"opportunity.defer": {
|
|
20254
|
+
effect: "defer_internal_opportunity",
|
|
20255
|
+
reversible: true
|
|
20256
|
+
},
|
|
20257
|
+
"opportunity.annotate": {
|
|
20258
|
+
effect: "annotate_internal_opportunity",
|
|
20259
|
+
reversible: true
|
|
20260
|
+
},
|
|
20261
|
+
"opportunity.block": {
|
|
20262
|
+
effect: "block_internal_opportunity",
|
|
20263
|
+
reversible: true
|
|
20264
|
+
},
|
|
20265
|
+
"fde_action.command": {
|
|
20266
|
+
effect: "apply_server_advertised_fde_action_command",
|
|
20267
|
+
reversible: true
|
|
20268
|
+
},
|
|
20269
|
+
"graph_recovery.command": {
|
|
20270
|
+
effect: "apply_server_advertised_graph_recovery_command",
|
|
20271
|
+
reversible: true
|
|
20272
|
+
},
|
|
20273
|
+
"graph_recovery.select_predecessor": {
|
|
20274
|
+
effect: "continue_from_selected_predecessor",
|
|
20275
|
+
reversible: false
|
|
20276
|
+
},
|
|
20277
|
+
"annotation.complete": {
|
|
20278
|
+
effect: "write_annotation_labels_and_complete_task",
|
|
20279
|
+
reversible: false
|
|
20280
|
+
}
|
|
20281
|
+
};
|
|
20282
|
+
ANNOTATION_COMMAND_EFFECTS = {
|
|
20283
|
+
claim: { effect: "claim_annotation_task", reversible: true },
|
|
20284
|
+
assign: { effect: "assign_annotation_task", reversible: true },
|
|
20285
|
+
reassign: { effect: "reassign_annotation_task", reversible: true },
|
|
20286
|
+
escalate: { effect: "escalate_annotation_task", reversible: true },
|
|
20287
|
+
recall: { effect: "recall_annotation_task", reversible: true },
|
|
20288
|
+
dismiss: { effect: "dismiss_annotation_task", reversible: false }
|
|
19051
20289
|
};
|
|
19052
20290
|
}
|
|
19053
20291
|
});
|