bamboo-agents 0.1.8-dev.96.9c7d886 → 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 CHANGED
@@ -1 +1 @@
1
- 0.1.8-dev.96.9c7d886
1
+ 0.1.8-dev.97.7cdd11e
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.96.9c7d886";
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, lifecycleMutationInputs, FDE_ACTION_MANAGEMENT_BINDINGS, GRAPH_RECOVERY_MANAGEMENT_BINDINGS, InboxManagementCatalogResponseSchema, OpportunityDecisionInputBaseSchema, InboxManagementCallSchema, InboxWorkItemSchema, InboxListReceiptSchema, InboxGetReceiptSchema, InboxEnvelopeBaseSchema, UnknownMutationReceiptSchema, ChangeReadBackSchema, OpportunitySnapshotSchema, OpportunityUnknownReceiptSchema, OpportunityCommandSchema, FdeActionSnapshotSchema, GraphRecoverySnapshotSchema, LifecycleUnknownReceiptSchema, 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();
@@ -12783,7 +12783,10 @@ var init_inbox_management = __esm({
12783
12783
  "fde_action.command",
12784
12784
  "graph_recovery.get",
12785
12785
  "graph_recovery.command",
12786
- "graph_recovery.select_predecessor"
12786
+ "graph_recovery.select_predecessor",
12787
+ "annotation.get",
12788
+ "annotation.command",
12789
+ "annotation.complete"
12787
12790
  ]);
12788
12791
  InboxManageOperationSchema = external_exports.enum([
12789
12792
  "inbox.list",
@@ -12806,7 +12809,10 @@ var init_inbox_management = __esm({
12806
12809
  "fde_action.command",
12807
12810
  "graph_recovery.get",
12808
12811
  "graph_recovery.command",
12809
- "graph_recovery.select_predecessor"
12812
+ "graph_recovery.select_predecessor",
12813
+ "annotation.get",
12814
+ "annotation.command",
12815
+ "annotation.complete"
12810
12816
  ]);
12811
12817
  InboxOperationBindingSchema = external_exports.object({
12812
12818
  operation: InboxOperationSchema,
@@ -12816,7 +12822,8 @@ var init_inbox_management = __esm({
12816
12822
  "workspace_change",
12817
12823
  "brain_opportunity",
12818
12824
  "fde_action",
12819
- "graph_recovery"
12825
+ "graph_recovery",
12826
+ "output_annotation"
12820
12827
  ]),
12821
12828
  method: external_exports.literal("POST"),
12822
12829
  path: external_exports.string().startsWith("/api/v1/"),
@@ -12854,7 +12861,10 @@ var init_inbox_management = __esm({
12854
12861
  "fde_action_command_receipt_v1",
12855
12862
  "graph_recovery_get_receipt_v1",
12856
12863
  "graph_recovery_command_receipt_v1",
12857
- "graph_recovery_predecessor_receipt_v1"
12864
+ "graph_recovery_predecessor_receipt_v1",
12865
+ "annotation_get_receipt_v1",
12866
+ "annotation_command_receipt_v1",
12867
+ "annotation_complete_receipt_v1"
12858
12868
  ]),
12859
12869
  error_codes: external_exports.array(
12860
12870
  external_exports.enum([
@@ -12885,6 +12895,8 @@ var init_inbox_management = __esm({
12885
12895
  "idempotency_conflict",
12886
12896
  "already_merged",
12887
12897
  "unknown_outcome",
12898
+ "source_output_unavailable",
12899
+ "source_output_read_failed",
12888
12900
  "approval_required",
12889
12901
  "policy_blocked",
12890
12902
  "decline_forbidden",
@@ -12900,7 +12912,11 @@ var init_inbox_management = __esm({
12900
12912
  "invalid_transition",
12901
12913
  "stale_transition",
12902
12914
  "graph_recovery_unavailable",
12903
- "continuation_required"
12915
+ "continuation_required",
12916
+ "task_changed",
12917
+ "invalid_transition",
12918
+ "invalid_assignee",
12919
+ "label_write_failed"
12904
12920
  ])
12905
12921
  ),
12906
12922
  minimum_cli_version: external_exports.string()
@@ -13319,6 +13335,64 @@ var init_inbox_management = __esm({
13319
13335
  ]
13320
13336
  }))
13321
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
+ ];
13322
13396
  lifecycleMutationInputs = {
13323
13397
  required: [
13324
13398
  "id",
@@ -13696,6 +13770,70 @@ var init_inbox_management = __esm({
13696
13770
  approved_effect: external_exports.literal("continue_from_selected_predecessor"),
13697
13771
  approved_reversible: external_exports.literal(false)
13698
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)
13836
+ })
13699
13837
  })
13700
13838
  ]);
13701
13839
  InboxWorkItemSchema = external_exports.object({
@@ -13823,6 +13961,26 @@ var init_inbox_management = __esm({
13823
13961
  command_id: external_exports.string(),
13824
13962
  instruction: external_exports.literal("inspect_source_before_retry")
13825
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
+ });
13826
13984
  InboxOperationEnvelopeSchema = external_exports.discriminatedUnion("operation", [
13827
13985
  InboxEnvelopeBaseSchema.extend({
13828
13986
  operation: external_exports.literal("inbox.list"),
@@ -14051,6 +14209,40 @@ var init_inbox_management = __esm({
14051
14209
  }),
14052
14210
  LifecycleUnknownReceiptSchema
14053
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
+ ])
14054
14246
  })
14055
14247
  ]);
14056
14248
  }
@@ -19897,12 +20089,13 @@ async function runInboxManage(options) {
19897
20089
  const input = await inputObject(options.input);
19898
20090
  const isMutation = options.operation.startsWith("change.") && !["change.get", "change.diff", "change.head"].includes(
19899
20091
  options.operation
19900
- ) || options.operation.startsWith("opportunity.") && options.operation !== "opportunity.get" || options.operation === "fde_action.command" || options.operation.startsWith("graph_recovery.") && options.operation !== "graph_recovery.get";
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";
19901
20093
  if (isMutation) {
19902
20094
  const isProposal = options.operation === "opportunity.propose";
19903
20095
  const isOpportunity = options.operation.startsWith("opportunity.");
19904
20096
  const isFdeAction = options.operation.startsWith("fde_action.");
19905
20097
  const isGraphRecovery = options.operation.startsWith("graph_recovery.");
20098
+ const isAnnotation = options.operation.startsWith("annotation.");
19906
20099
  const previewCall = isProposal ? InboxManagementCallSchema.parse({
19907
20100
  operation: "inbox.list",
19908
20101
  input: {
@@ -19927,6 +20120,12 @@ async function runInboxManage(options) {
19927
20120
  id: input.id,
19928
20121
  ...typeof input.brand_id === "string" ? { brand_id: input.brand_id } : {}
19929
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
+ }
19930
20129
  }) : InboxManagementCallSchema.parse({
19931
20130
  operation: "change.get",
19932
20131
  input: {
@@ -19957,8 +20156,8 @@ async function runInboxManage(options) {
19957
20156
  const previewReceipt = preview.receipt && typeof preview.receipt === "object" ? preview.receipt : {};
19958
20157
  const action = previewReceipt.action;
19959
20158
  const cycle = previewReceipt.cycle;
19960
- const advertised = isFdeAction ? action?.supported_commands : isGraphRecovery ? cycle?.next_legal_commands : null;
19961
- const requestedCommand = options.operation === "graph_recovery.select_predecessor" ? "select_predecessor" : input.command;
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;
19962
20161
  if (Array.isArray(advertised) && !advertised.includes(requestedCommand))
19963
20162
  throw Object.assign(
19964
20163
  new Error(
@@ -19968,11 +20167,11 @@ async function runInboxManage(options) {
19968
20167
  );
19969
20168
  const recipient = input.recipient_name ? `; recipient: ${String(input.recipient_name)}` : "";
19970
20169
  const wording = input.approved_wording ? `; wording: ${JSON.stringify(input.approved_wording)}` : "";
19971
- const mutation = MUTATION_EFFECTS[options.operation];
20170
+ const mutation = options.operation === "annotation.command" ? ANNOTATION_COMMAND_EFFECTS[String(input.command)] : MUTATION_EFFECTS[options.operation];
19972
20171
  const sourceItem = isProposal ? String(
19973
20172
  input.proposal && typeof input.proposal === "object" ? input.proposal.opportunity_key ?? "new stable-key proposal" : "new proposal"
19974
20173
  ) : String(
19975
- input.opportunity_id ?? input.pr_number ?? input.id ?? "unknown"
20174
+ input.opportunity_id ?? input.pr_number ?? input.id ?? input.task_id ?? "unknown"
19976
20175
  );
19977
20176
  human(
19978
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}`,
@@ -19989,7 +20188,7 @@ async function runInboxManage(options) {
19989
20188
  }
19990
20189
  if (options.approve) {
19991
20190
  input.approved = true;
19992
- const mutation = MUTATION_EFFECTS[options.operation];
20191
+ const mutation = options.operation === "annotation.command" ? ANNOTATION_COMMAND_EFFECTS[String(input.command)] : MUTATION_EFFECTS[options.operation];
19993
20192
  if (mutation) {
19994
20193
  input.approved_effect = mutation.effect;
19995
20194
  input.approved_reversible = mutation.reversible;
@@ -20016,7 +20215,7 @@ async function runInboxManage(options) {
20016
20215
  fail(error, options);
20017
20216
  }
20018
20217
  }
20019
- var MUTATION_EFFECTS;
20218
+ var MUTATION_EFFECTS, ANNOTATION_COMMAND_EFFECTS;
20020
20219
  var init_inbox_management2 = __esm({
20021
20220
  "src/commands/inbox-management.ts"() {
20022
20221
  "use strict";
@@ -20074,8 +20273,20 @@ var init_inbox_management2 = __esm({
20074
20273
  "graph_recovery.select_predecessor": {
20075
20274
  effect: "continue_from_selected_predecessor",
20076
20275
  reversible: false
20276
+ },
20277
+ "annotation.complete": {
20278
+ effect: "write_annotation_labels_and_complete_task",
20279
+ reversible: false
20077
20280
  }
20078
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 }
20289
+ };
20079
20290
  }
20080
20291
  });
20081
20292