bamboo-agents 0.1.10-dev.105.540ee26 → 0.1.10-dev.106.12d3cfa

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.10-dev.105.540ee26
1
+ 0.1.10-dev.106.12d3cfa
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.10-dev.105.540ee26";
3040
+ VERSION = "0.1.10-dev.106.12d3cfa";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -14730,11 +14730,129 @@ var init_eval_test_sets = __esm({
14730
14730
  }
14731
14731
  });
14732
14732
 
14733
+ // ../../src/lib/api-contracts/investigation-waves.ts
14734
+ var InvestigationWaveMemberSchema, InvestigationWaveCoreSchema, InvestigationWaveSchema, InvestigationWaveRequestMemberSchema, InvestigationWaveRequestSchema, InvestigationWaveDetailSchema;
14735
+ var init_investigation_waves = __esm({
14736
+ "../../src/lib/api-contracts/investigation-waves.ts"() {
14737
+ init_zod();
14738
+ InvestigationWaveMemberSchema = external_exports.object({
14739
+ investigation_id: external_exports.string().uuid(),
14740
+ position: external_exports.number().int().nonnegative(),
14741
+ title: external_exports.string().nullable().optional(),
14742
+ agent_id: external_exports.string().uuid().nullable().optional(),
14743
+ lifecycle_state: external_exports.string().nullable().optional()
14744
+ });
14745
+ InvestigationWaveCoreSchema = external_exports.object({
14746
+ id: external_exports.string().uuid(),
14747
+ org_id: external_exports.string().uuid(),
14748
+ brand_id: external_exports.string().uuid(),
14749
+ name: external_exports.string(),
14750
+ status: external_exports.enum(["active", "retired"]),
14751
+ membership_revision: external_exports.number().int().nonnegative(),
14752
+ not_before: external_exports.string().nullable(),
14753
+ timezone: external_exports.string(),
14754
+ created_at: external_exports.string(),
14755
+ updated_at: external_exports.string()
14756
+ });
14757
+ InvestigationWaveSchema = InvestigationWaveCoreSchema.extend({
14758
+ members: external_exports.array(InvestigationWaveMemberSchema)
14759
+ });
14760
+ InvestigationWaveRequestMemberSchema = external_exports.object({
14761
+ investigation_id: external_exports.string().uuid(),
14762
+ position: external_exports.number().int().nonnegative(),
14763
+ case_ids: external_exports.array(external_exports.string().uuid()),
14764
+ child_key: external_exports.string(),
14765
+ status: external_exports.enum(["pending", "admitted", "blocked"]),
14766
+ run_id: external_exports.string().uuid().nullable(),
14767
+ blocker: external_exports.string().nullable()
14768
+ });
14769
+ InvestigationWaveRequestSchema = external_exports.object({
14770
+ id: external_exports.string().uuid(),
14771
+ membership_revision: external_exports.number().int().nonnegative(),
14772
+ target_agent_id: external_exports.string().uuid().nullable(),
14773
+ request_fingerprint: external_exports.string().nullable(),
14774
+ not_before: external_exports.string().nullable(),
14775
+ status: external_exports.enum(["pending", "partial", "completed", "blocked", "failed"]),
14776
+ created_at: external_exports.string(),
14777
+ members: external_exports.array(InvestigationWaveRequestMemberSchema)
14778
+ });
14779
+ InvestigationWaveDetailSchema = InvestigationWaveSchema.extend({
14780
+ requests: external_exports.array(InvestigationWaveRequestSchema)
14781
+ });
14782
+ }
14783
+ });
14784
+
14733
14785
  // ../../src/lib/api-contracts/cli/eval-management.ts
14734
- var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common2, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema;
14786
+ function parseEvalManagementOperationData(call, data, selectedOrgId) {
14787
+ const operation = call.operation;
14788
+ let parsed;
14789
+ if (operation === "investigation.create" || operation === "investigation.update")
14790
+ parsed = InvestigationAuthoringDataSchema.parse(data);
14791
+ else if ([
14792
+ "investigation.hold",
14793
+ "investigation.resume",
14794
+ "investigation.cancel"
14795
+ ].includes(operation))
14796
+ parsed = InvestigationControlReceiptSchema.parse(data);
14797
+ else if ([
14798
+ "investigation.conclude_claim",
14799
+ "investigation.close",
14800
+ "investigation.reopen",
14801
+ "investigation.retire"
14802
+ ].includes(operation))
14803
+ parsed = InvestigationDecisionReceiptSchema.parse(data);
14804
+ else if (operation === "wave.create")
14805
+ parsed = InvestigationWaveCreateReceiptSchema.parse(data);
14806
+ else if (operation === "wave.update")
14807
+ parsed = InvestigationWaveUpdateReceiptSchema.parse(data);
14808
+ else if (operation === "wave.schedule")
14809
+ parsed = InvestigationWaveScheduleReceiptSchema.parse(data);
14810
+ else return data;
14811
+ const mismatch = (label) => {
14812
+ throw new Error(`eval_management_receipt_mismatch:${label}`);
14813
+ };
14814
+ const sameId = (left, right) => left.toLowerCase() === right.toLowerCase();
14815
+ const inputId = typeof call.input.id === "string" ? call.input.id : void 0;
14816
+ const inputBrandId = typeof call.input.brand_id === "string" ? call.input.brand_id : void 0;
14817
+ const action = operation.split(".")[1];
14818
+ if (operation === "investigation.update") {
14819
+ const receipt = parsed;
14820
+ if (inputId && (!receipt.investigation_id || !sameId(receipt.investigation_id, inputId)))
14821
+ mismatch("investigation_id");
14822
+ } else if (operation === "investigation.hold" || operation === "investigation.resume" || operation === "investigation.cancel") {
14823
+ const receipt = parsed;
14824
+ if (receipt.operation !== action) mismatch("operation");
14825
+ if (inputId && !sameId(receipt.investigation_id, inputId))
14826
+ mismatch("investigation_id");
14827
+ } else if (operation === "investigation.conclude_claim" || operation === "investigation.close" || operation === "investigation.reopen" || operation === "investigation.retire") {
14828
+ const receipt = parsed;
14829
+ if (receipt.operation !== action) mismatch("operation");
14830
+ if (inputId && !sameId(receipt.investigation_id, inputId))
14831
+ mismatch("investigation_id");
14832
+ } else if (operation === "wave.create") {
14833
+ const receipt = parsed;
14834
+ if (selectedOrgId && !sameId(receipt.wave.org_id, selectedOrgId))
14835
+ mismatch("org_id");
14836
+ if (inputBrandId && !sameId(receipt.wave.brand_id, inputBrandId))
14837
+ mismatch("brand_id");
14838
+ } else if (operation === "wave.update") {
14839
+ const receipt = parsed;
14840
+ if (inputId && !sameId(receipt.wave.id, inputId)) mismatch("wave_id");
14841
+ if (receipt.wave.org_id && selectedOrgId && !sameId(receipt.wave.org_id, selectedOrgId))
14842
+ mismatch("org_id");
14843
+ if (receipt.wave.brand_id && inputBrandId && !sameId(receipt.wave.brand_id, inputBrandId))
14844
+ mismatch("brand_id");
14845
+ } else if (operation === "wave.schedule") {
14846
+ const receipt = parsed;
14847
+ if (inputId && !sameId(receipt.wave_id, inputId)) mismatch("wave_id");
14848
+ }
14849
+ return parsed;
14850
+ }
14851
+ var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common2, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, InvestigationControlReceiptSchema, InvestigationDecisionReceiptSchema, InvestigationWaveMemberReceiptSchema, InvestigationWaveCreateReceiptSchema, InvestigationWaveUpdateReceiptSchema, InvestigationWaveScheduleReceiptSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema;
14735
14852
  var init_eval_management = __esm({
14736
14853
  "../../src/lib/api-contracts/cli/eval-management.ts"() {
14737
14854
  init_zod();
14855
+ init_investigation_waves();
14738
14856
  EvalManagementOperationSchema = external_exports.enum([
14739
14857
  "investigation.list",
14740
14858
  "investigation.get",
@@ -14922,7 +15040,9 @@ var init_eval_management = __esm({
14922
15040
  method: "POST",
14923
15041
  path: "/api/v1/eval/investigations/{id}/control",
14924
15042
  side_effect: "execution gate becomes held",
14925
- receipt: "control receipt and resulting revision"
15043
+ receipt: "control receipt and resulting revision",
15044
+ minimum_cli_version: "0.1.11",
15045
+ explicit_org_scope: true
14926
15046
  },
14927
15047
  {
14928
15048
  ...common2,
@@ -14931,7 +15051,9 @@ var init_eval_management = __esm({
14931
15051
  method: "POST",
14932
15052
  path: "/api/v1/eval/investigations/{id}/control",
14933
15053
  side_effect: "execution gate becomes active",
14934
- receipt: "control receipt and resulting revision"
15054
+ receipt: "control receipt and resulting revision",
15055
+ minimum_cli_version: "0.1.11",
15056
+ explicit_org_scope: true
14935
15057
  },
14936
15058
  {
14937
15059
  ...common2,
@@ -14940,7 +15062,9 @@ var init_eval_management = __esm({
14940
15062
  method: "POST",
14941
15063
  path: "/api/v1/eval/investigations/{id}/control",
14942
15064
  side_effect: "pending queue items are canceled",
14943
- receipt: "control receipt with affected count and served ids"
15065
+ receipt: "control receipt with affected count and served ids",
15066
+ minimum_cli_version: "0.1.11",
15067
+ explicit_org_scope: true
14944
15068
  },
14945
15069
  {
14946
15070
  ...common2,
@@ -14949,7 +15073,9 @@ var init_eval_management = __esm({
14949
15073
  method: "POST",
14950
15074
  path: "/api/v1/eval/investigations/{id}/decisions",
14951
15075
  side_effect: "append-only judgment plus repo publication",
14952
- receipt: "decision, judgment, publication, and evidence references"
15076
+ receipt: "decision, judgment, publication, and evidence references",
15077
+ minimum_cli_version: "0.1.11",
15078
+ explicit_org_scope: true
14953
15079
  },
14954
15080
  {
14955
15081
  ...common2,
@@ -14958,7 +15084,9 @@ var init_eval_management = __esm({
14958
15084
  method: "POST",
14959
15085
  path: "/api/v1/eval/investigations/{id}/decisions",
14960
15086
  side_effect: "repo lifecycle closes and pending work is canceled",
14961
- receipt: "decision, publication, cancellation count, and served ids"
15087
+ receipt: "decision, publication, cancellation count, and served ids",
15088
+ minimum_cli_version: "0.1.11",
15089
+ explicit_org_scope: true
14962
15090
  },
14963
15091
  {
14964
15092
  ...common2,
@@ -14967,7 +15095,9 @@ var init_eval_management = __esm({
14967
15095
  method: "POST",
14968
15096
  path: "/api/v1/eval/investigations/{id}/decisions",
14969
15097
  side_effect: "repo lifecycle opens and held execution resumes",
14970
- receipt: "decision and publication receipt"
15098
+ receipt: "decision and publication receipt",
15099
+ minimum_cli_version: "0.1.11",
15100
+ explicit_org_scope: true
14971
15101
  },
14972
15102
  {
14973
15103
  ...common2,
@@ -14976,7 +15106,9 @@ var init_eval_management = __esm({
14976
15106
  method: "POST",
14977
15107
  path: "/api/v1/eval/investigations/{id}/decisions",
14978
15108
  side_effect: "repo lifecycle retires and pending work is canceled",
14979
- receipt: "decision, publication, cancellation count, and served ids"
15109
+ receipt: "decision, publication, cancellation count, and served ids",
15110
+ minimum_cli_version: "0.1.11",
15111
+ explicit_org_scope: true
14980
15112
  },
14981
15113
  {
14982
15114
  ...common2,
@@ -15005,7 +15137,9 @@ var init_eval_management = __esm({
15005
15137
  method: "POST",
15006
15138
  path: "/api/v1/eval/waves",
15007
15139
  side_effect: "operational wave row",
15008
- receipt: "wave id and membership revision"
15140
+ receipt: "wave id and membership revision",
15141
+ minimum_cli_version: "0.1.11",
15142
+ explicit_org_scope: true
15009
15143
  },
15010
15144
  {
15011
15145
  ...common2,
@@ -15014,7 +15148,9 @@ var init_eval_management = __esm({
15014
15148
  method: "PATCH",
15015
15149
  path: "/api/v1/eval/waves/{id}",
15016
15150
  side_effect: "wave metadata or membership revision",
15017
- receipt: "wave and resulting membership revision"
15151
+ receipt: "wave and resulting membership revision",
15152
+ minimum_cli_version: "0.1.11",
15153
+ explicit_org_scope: true
15018
15154
  },
15019
15155
  {
15020
15156
  ...common2,
@@ -15023,7 +15159,9 @@ var init_eval_management = __esm({
15023
15159
  method: "POST",
15024
15160
  path: "/api/v1/eval/waves/{id}/schedule",
15025
15161
  side_effect: "durable run and queue admission",
15026
- receipt: "wave request and per-investigation run receipts"
15162
+ receipt: "wave request and per-investigation run receipts",
15163
+ minimum_cli_version: "0.1.11",
15164
+ explicit_org_scope: true
15027
15165
  }
15028
15166
  ];
15029
15167
  EvalManagementCatalogResponseSchema = external_exports.object({
@@ -15082,6 +15220,83 @@ var init_eval_management = __esm({
15082
15220
  source_path: external_exports.string().min(1),
15083
15221
  publication: InvestigationPublicationReceiptSchema
15084
15222
  }).passthrough();
15223
+ InvestigationControlReceiptSchema = external_exports.object({
15224
+ id: external_exports.string().uuid(),
15225
+ receipt_version: external_exports.literal(1),
15226
+ investigation_id: external_exports.string().uuid(),
15227
+ operation: external_exports.enum(["hold", "resume", "cancel"]),
15228
+ expected_revision: external_exports.number().int().nonnegative(),
15229
+ resulting_gate_state: external_exports.enum(["active", "held"]),
15230
+ resulting_revision: external_exports.number().int().nonnegative(),
15231
+ affected_pending_count: external_exports.number().int().nonnegative(),
15232
+ served_ids: external_exports.array(external_exports.string().uuid()),
15233
+ terminal_count: external_exports.number().int().nonnegative(),
15234
+ idempotent: external_exports.boolean()
15235
+ }).passthrough();
15236
+ InvestigationDecisionReceiptSchema = external_exports.object({
15237
+ id: external_exports.string().uuid(),
15238
+ judgment_id: external_exports.string().uuid(),
15239
+ investigation_id: external_exports.string().uuid(),
15240
+ operation: external_exports.enum(["conclude_claim", "close", "reopen", "retire"]),
15241
+ publication_status: external_exports.enum(["pending", "published", "failed"]),
15242
+ source_sha: external_exports.string().nullable().optional(),
15243
+ pr_url: external_exports.string().url().nullable().optional(),
15244
+ canceled_pending_count: external_exports.number().int().nonnegative(),
15245
+ served_ids: external_exports.array(external_exports.string().uuid()),
15246
+ actor_user_id: external_exports.string().uuid()
15247
+ }).passthrough();
15248
+ InvestigationWaveMemberReceiptSchema = external_exports.object({
15249
+ investigation_id: external_exports.string().uuid(),
15250
+ position: external_exports.number().int().nonnegative().optional(),
15251
+ case_ids: external_exports.array(external_exports.string().uuid()).optional(),
15252
+ child_key: external_exports.string().optional(),
15253
+ status: external_exports.enum(["pending", "admitted", "blocked"]).optional(),
15254
+ run_id: external_exports.string().uuid().nullable().optional(),
15255
+ blocker: external_exports.string().nullable().optional()
15256
+ });
15257
+ InvestigationWaveCreateReceiptSchema = external_exports.object({
15258
+ wave: InvestigationWaveCoreSchema.omit({
15259
+ created_at: true,
15260
+ updated_at: true
15261
+ }).passthrough()
15262
+ });
15263
+ InvestigationWaveUpdateReceiptSchema = external_exports.object({
15264
+ wave: InvestigationWaveCoreSchema.pick({
15265
+ id: true,
15266
+ org_id: true,
15267
+ brand_id: true,
15268
+ name: true,
15269
+ status: true,
15270
+ membership_revision: true,
15271
+ not_before: true,
15272
+ timezone: true
15273
+ }).partial({
15274
+ org_id: true,
15275
+ brand_id: true,
15276
+ name: true,
15277
+ status: true,
15278
+ not_before: true,
15279
+ timezone: true
15280
+ }).extend({ members: external_exports.array(InvestigationWaveMemberSchema) })
15281
+ });
15282
+ InvestigationWaveScheduleReceiptSchema = external_exports.object({
15283
+ request_id: external_exports.string().uuid(),
15284
+ wave_id: external_exports.string().uuid(),
15285
+ membership_revision: external_exports.number().int().nonnegative(),
15286
+ not_before: external_exports.string().nullable(),
15287
+ request_fingerprint: external_exports.string().min(1),
15288
+ status: external_exports.enum(["pending", "partial", "completed", "blocked", "failed"]),
15289
+ already_scheduled: external_exports.boolean(),
15290
+ members: external_exports.array(
15291
+ InvestigationWaveMemberReceiptSchema.extend({
15292
+ case_ids: external_exports.array(external_exports.string().uuid()),
15293
+ child_key: external_exports.string(),
15294
+ status: external_exports.enum(["pending", "admitted", "blocked"]),
15295
+ run_id: external_exports.string().uuid().nullable(),
15296
+ blocker: external_exports.string().nullable()
15297
+ })
15298
+ )
15299
+ });
15085
15300
  EvalManagementCatalogResultSchema = EvalManagementCatalogResponseSchema.extend({
15086
15301
  scope: EvalManagementScopeSchema.optional()
15087
15302
  });
@@ -15818,10 +16033,16 @@ async function callEvalManagement(bambooSession, call, orgId) {
15818
16033
  data: Object.keys(siblings).length > 0 ? { data, ...siblings } : data,
15819
16034
  scope: meta
15820
16035
  });
15821
- if (call.operation === "investigation.create" || call.operation === "investigation.update") {
15822
- result.data = InvestigationAuthoringDataSchema.parse(result.data);
15823
- }
16036
+ result.data = parseEvalManagementOperationData(call, result.data, orgId);
15824
16037
  assertExplicitOrgReceipt(result.scope, orgId);
16038
+ if (isMutation) {
16039
+ const expectedBrand = call.input.brand_id;
16040
+ const expectedAgent = call.input.agent_id;
16041
+ if (typeof expectedBrand === "string" && result.scope?.brand_id?.toLowerCase() !== expectedBrand.toLowerCase())
16042
+ throw new Error("eval_management_scope_mismatch:brand_id");
16043
+ if (typeof expectedAgent === "string" && result.scope?.agent_id?.toLowerCase() !== expectedAgent.toLowerCase())
16044
+ throw new Error("eval_management_scope_mismatch:agent_id");
16045
+ }
15825
16046
  return result;
15826
16047
  } catch (error) {
15827
16048
  if (error instanceof ApiError) throw error;
@@ -22084,6 +22305,22 @@ function managementOutcomeLine(result, readOnly) {
22084
22305
  if (publication?.status === "noop") {
22085
22306
  return `No change for ${result.operation}; the existing publication is current.`;
22086
22307
  }
22308
+ if (result.operation === "wave.schedule") {
22309
+ const status = typeof data.status === "string" ? data.status : "recorded";
22310
+ return `Scheduled the investigation wave; admission status is ${status}.`;
22311
+ }
22312
+ if (result.operation === "wave.create")
22313
+ return "Created the investigation wave without scheduling it.";
22314
+ if (result.operation === "wave.update")
22315
+ return "Updated the investigation wave without scheduling it.";
22316
+ const lifecycle = result.operation.split(".")[1];
22317
+ if (["hold", "resume", "cancel"].includes(lifecycle ?? "")) {
22318
+ return `${lifecycle === "hold" ? "Held" : lifecycle === "resume" ? "Resumed" : "Canceled pending work for"} the investigation.`;
22319
+ }
22320
+ if (["conclude_claim", "close", "reopen", "retire"].includes(lifecycle ?? "")) {
22321
+ const publicationStatus = data.publication_status;
22322
+ return publicationStatus === "pending" ? `Recorded ${result.operation}; repository publication is pending.` : `Published ${result.operation} with its decision receipt.`;
22323
+ }
22087
22324
  return `Applied ${result.operation}.`;
22088
22325
  }
22089
22326
  var init_eval_management2 = __esm({