bamboo-agents 0.1.14 → 0.1.15-dev.127.1d5f43e

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.14
1
+ 0.1.15-dev.127.1d5f43e
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.14";
3040
+ VERSION = "0.1.15-dev.127.1d5f43e";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -12866,6 +12866,12 @@ function parseEvalManagementOperationData(call, data, selectedOrgId) {
12866
12866
  parsed = InvestigationWaveUpdateReceiptSchema.parse(data);
12867
12867
  else if (operation === "wave.schedule")
12868
12868
  parsed = InvestigationWaveScheduleReceiptSchema.parse(data);
12869
+ else if (operation === "case.create" || operation === "case.update")
12870
+ parsed = CaseAuthoringReceiptSchema.parse(data);
12871
+ else if (operation === "case.retire")
12872
+ parsed = CaseRetireReceiptSchema.parse(data);
12873
+ else if (operation === "case.attach" || operation === "case.detach")
12874
+ parsed = CaseRefsReceiptSchema.parse(data);
12869
12875
  else return data;
12870
12876
  const mismatch = (label) => {
12871
12877
  throw new Error(`eval_management_receipt_mismatch:${label}`);
@@ -12907,10 +12913,41 @@ function parseEvalManagementOperationData(call, data, selectedOrgId) {
12907
12913
  const expectedRevision = call.input.expected_membership_revision;
12908
12914
  if (typeof expectedRevision === "number" && receipt.membership_revision !== expectedRevision)
12909
12915
  mismatch("membership_revision");
12916
+ } else if (operation === "case.create" || operation === "case.update") {
12917
+ const receipt = parsed;
12918
+ if (inputBrandId && !sameId(receipt.brand_id, inputBrandId))
12919
+ mismatch("brand_id");
12920
+ const inputAgentId = typeof call.input.agent_id === "string" ? call.input.agent_id : void 0;
12921
+ if (inputAgentId && !sameId(receipt.agent_id, inputAgentId))
12922
+ mismatch("agent_id");
12923
+ if (inputId && (!receipt.case_id || !sameId(receipt.case_id, inputId)))
12924
+ mismatch("case_id");
12925
+ const inputSourcePath = typeof call.input.source_path === "string" ? call.input.source_path : void 0;
12926
+ if (inputSourcePath && receipt.source_path !== inputSourcePath)
12927
+ mismatch("source_path");
12928
+ } else if (operation === "case.retire") {
12929
+ const receipt = parsed;
12930
+ if (inputBrandId && !sameId(receipt.brand_id, inputBrandId))
12931
+ mismatch("brand_id");
12932
+ if (inputId && (!receipt.case_id || !sameId(receipt.case_id, inputId)))
12933
+ mismatch("case_id");
12934
+ const inputSourcePath = typeof call.input.source_path === "string" ? call.input.source_path : void 0;
12935
+ if (inputSourcePath && receipt.source_path !== inputSourcePath)
12936
+ mismatch("source_path");
12937
+ const commandId = typeof call.input.command_id === "string" ? call.input.command_id : void 0;
12938
+ if (commandId && receipt.command_id !== commandId) mismatch("command_id");
12939
+ } else if (operation === "case.attach" || operation === "case.detach") {
12940
+ const receipt = parsed;
12941
+ if (receipt.operation !== action) mismatch("operation");
12942
+ if (inputId && !sameId(receipt.investigation_id, inputId))
12943
+ mismatch("investigation_id");
12944
+ const claimKeys = Array.isArray(call.input.claim_keys) ? call.input.claim_keys.filter((k) => typeof k === "string") : [];
12945
+ const receiptKeys = new Set(receipt.claims.map((c) => c.key));
12946
+ if (claimKeys.some((key) => !receiptKeys.has(key))) mismatch("claim_keys");
12910
12947
  }
12911
12948
  return parsed;
12912
12949
  }
12913
- var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementCatalogBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, InvestigationControlReceiptSchema, InvestigationDecisionReceiptSchema, InvestigationWaveMemberReceiptSchema, InvestigationWaveCreateReceiptSchema, InvestigationWaveUpdateReceiptSchema, InvestigationWaveScheduleReceiptSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema, EvalManagementWriteErrorSchema;
12950
+ var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementCatalogBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, InvestigationControlReceiptSchema, InvestigationDecisionReceiptSchema, InvestigationWaveMemberReceiptSchema, InvestigationWaveCreateReceiptSchema, InvestigationWaveUpdateReceiptSchema, InvestigationWaveScheduleReceiptSchema, CaseAuthoringReceiptSchema, CaseRetireReceiptSchema, CaseRefsReceiptSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema, EvalManagementWriteErrorSchema;
12914
12951
  var init_eval_management = __esm({
12915
12952
  "../../src/lib/api-contracts/cli/eval-management.ts"() {
12916
12953
  init_zod();
@@ -12932,7 +12969,12 @@ var init_eval_management = __esm({
12932
12969
  "wave.get",
12933
12970
  "wave.create",
12934
12971
  "wave.update",
12935
- "wave.schedule"
12972
+ "wave.schedule",
12973
+ "case.create",
12974
+ "case.update",
12975
+ "case.retire",
12976
+ "case.attach",
12977
+ "case.detach"
12936
12978
  ]);
12937
12979
  EvalManagementBindingSchema = external_exports.object({
12938
12980
  operation: EvalManagementOperationSchema,
@@ -12974,6 +13016,11 @@ var init_eval_management = __esm({
12974
13016
  },
12975
13017
  "investigation.update": {
12976
13018
  required: ["id", "brand_id"],
13019
+ // `claims` is a MERGE-BY-KEY patch (BAM-5180): each entry is matched to
13020
+ // the existing claim with the same `key`; fields you omit keep their
13021
+ // current values (status, conclusion, verdict_tier, decision, evidence,
13022
+ // case_refs, …); an unmatched key is appended as a new claim; a claim
13023
+ // you leave out is NEVER removed — removal is `investigation.retire_claim`.
12977
13024
  optional: [
12978
13025
  "title",
12979
13026
  "hypothesis",
@@ -13058,6 +13105,57 @@ var init_eval_management = __esm({
13058
13105
  "idempotency_key"
13059
13106
  ],
13060
13107
  optional: ["not_before"]
13108
+ },
13109
+ // BAM-5180 — case authoring. A case is one repo-authored probe-set file
13110
+ // (`brands/<brand>/agents/<agent>/evals/<category>/<probe>.yaml`) beside its
13111
+ // `_set.yaml`; `eval_cases` is the projection, never the target.
13112
+ "case.create": {
13113
+ required: ["brand_id", "agent_id", "category", "probe", "input", "rubric"],
13114
+ optional: [
13115
+ "slot",
13116
+ "family",
13117
+ "split",
13118
+ "skills",
13119
+ "set_hypothesis",
13120
+ "set_evidence_kind",
13121
+ "set_priority",
13122
+ "set_rubric_version"
13123
+ ],
13124
+ server_injected: { operation: "create" }
13125
+ },
13126
+ "case.update": {
13127
+ // Identify the case by `id` (eval_cases uuid) OR `source_path` (full
13128
+ // repo path) — exactly one. `expected_source_sha` is the optimistic fence.
13129
+ required: ["brand_id"],
13130
+ optional: [
13131
+ "id",
13132
+ "source_path",
13133
+ "input",
13134
+ "rubric",
13135
+ "slot",
13136
+ "family",
13137
+ "split",
13138
+ "skills",
13139
+ "expected_source_sha"
13140
+ ],
13141
+ server_injected: { operation: "update" }
13142
+ },
13143
+ "case.retire": {
13144
+ required: ["brand_id", "command_id", "body"],
13145
+ optional: ["id", "source_path", "expected_source_sha"],
13146
+ server_injected: { operation: "retire" }
13147
+ },
13148
+ "case.attach": {
13149
+ // `id` is the INVESTIGATION id. `case_refs` are eval_cases uuids or full
13150
+ // `source_path`s; a bare filename stem is rejected as ambiguous.
13151
+ required: ["id", "brand_id", "claim_keys", "case_refs"],
13152
+ optional: ["expected_source_sha"],
13153
+ server_injected: { operation: "attach" }
13154
+ },
13155
+ "case.detach": {
13156
+ required: ["id", "brand_id", "claim_keys", "case_refs"],
13157
+ optional: ["expected_source_sha"],
13158
+ server_injected: { operation: "detach" }
13061
13159
  }
13062
13160
  };
13063
13161
  common = {
@@ -13102,7 +13200,9 @@ var init_eval_management = __esm({
13102
13200
  {
13103
13201
  ...common,
13104
13202
  operation: "investigation.update",
13105
- description: "Revise an authored investigation with optimistic source concurrency",
13203
+ // The served catalog is where the FDE skill discovers behaviour, so the
13204
+ // merge-by-key contract lives in the description, not only in a comment.
13205
+ description: "Revise an authored investigation with optimistic source concurrency; `claims` merges by key \u2014 omitted fields keep their values, unlisted claims are never removed (use retire_claim)",
13106
13206
  method: "PATCH",
13107
13207
  path: "/api/v1/plays/{id}",
13108
13208
  side_effect: "repo-authored investigation revision",
@@ -13253,6 +13353,68 @@ var init_eval_management = __esm({
13253
13353
  receipt: "wave request and per-investigation run receipts",
13254
13354
  minimum_cli_version: "0.1.11",
13255
13355
  explicit_org_scope: true
13356
+ },
13357
+ // BAM-5180 — the five case operations. Every one is withheld from a stable
13358
+ // CLI below 0.1.15 (`isBindingAdvertisedTo` in the operations route): the
13359
+ // published 0.1.12, 0.1.13 and 0.1.14 stables parse the catalog but bundle a
13360
+ // closed 17-operation call enum that cannot invoke them (0.1.13 and 0.1.14
13361
+ // were cut by BAM-5352 before this landed), so advertising them would only
13362
+ // tell an FDE about an operation their client rejects on dispatch. 0.1.15 is
13363
+ // the first stable that can carry them.
13364
+ {
13365
+ ...common,
13366
+ operation: "case.create",
13367
+ description: "Author one executable case as a repo probe-set file; does not queue execution",
13368
+ method: "POST",
13369
+ path: "/api/v1/eval/cases/authoring",
13370
+ side_effect: "repo-authored case file (plus _set.yaml for a new category) and eval_cases projection",
13371
+ receipt: "case id, source path, source SHA, and publication result",
13372
+ minimum_cli_version: "0.1.15",
13373
+ explicit_org_scope: true
13374
+ },
13375
+ {
13376
+ ...common,
13377
+ operation: "case.update",
13378
+ description: "Revise an authored case's prompt, rubric, or constraints with optimistic source concurrency",
13379
+ method: "POST",
13380
+ path: "/api/v1/eval/cases/authoring",
13381
+ side_effect: "repo-authored case revision and eval_cases projection",
13382
+ receipt: "case id, source path, source SHA, and publication result",
13383
+ minimum_cli_version: "0.1.15",
13384
+ explicit_org_scope: true
13385
+ },
13386
+ {
13387
+ ...common,
13388
+ operation: "case.retire",
13389
+ description: "Retire an authored case canonically by removing its file; history and evidence are kept",
13390
+ method: "POST",
13391
+ path: "/api/v1/eval/cases/authoring",
13392
+ side_effect: "repo file removal; the bank reconciler marks the projected case inactive",
13393
+ receipt: "case id, source path, and publication result",
13394
+ minimum_cli_version: "0.1.15",
13395
+ explicit_org_scope: true
13396
+ },
13397
+ {
13398
+ ...common,
13399
+ operation: "case.attach",
13400
+ description: "Attach existing cases to one or more claims of an investigation by id or full source path",
13401
+ method: "POST",
13402
+ path: "/api/v1/eval/investigations/{id}/case-refs",
13403
+ side_effect: "repo-authored investigation revision (claim case_refs) and Tests membership projection",
13404
+ receipt: "per-claim case references, source SHA, and publication result",
13405
+ minimum_cli_version: "0.1.15",
13406
+ explicit_org_scope: true
13407
+ },
13408
+ {
13409
+ ...common,
13410
+ operation: "case.detach",
13411
+ description: "Detach cases from one or more claims; never deletes the case or its evidence",
13412
+ method: "POST",
13413
+ path: "/api/v1/eval/investigations/{id}/case-refs",
13414
+ side_effect: "repo-authored investigation revision (claim case_refs) and Tests membership projection",
13415
+ receipt: "per-claim case references, source SHA, and publication result",
13416
+ minimum_cli_version: "0.1.15",
13417
+ explicit_org_scope: true
13256
13418
  }
13257
13419
  ];
13258
13420
  EvalManagementCatalogResponseSchema = external_exports.object({
@@ -13392,6 +13554,45 @@ var init_eval_management = __esm({
13392
13554
  })
13393
13555
  )
13394
13556
  });
13557
+ CaseAuthoringReceiptSchema = external_exports.object({
13558
+ case_id: external_exports.string().uuid().nullable(),
13559
+ brand_id: external_exports.string().uuid(),
13560
+ agent_id: external_exports.string().uuid(),
13561
+ category: external_exports.string().min(1),
13562
+ probe: external_exports.string().min(1),
13563
+ source_path: external_exports.string().min(1),
13564
+ set_path: external_exports.string().min(1),
13565
+ publication: InvestigationPublicationReceiptSchema
13566
+ }).passthrough();
13567
+ CaseRetireReceiptSchema = external_exports.object({
13568
+ case_id: external_exports.string().uuid().nullable(),
13569
+ brand_id: external_exports.string().uuid(),
13570
+ agent_id: external_exports.string().uuid(),
13571
+ source_path: external_exports.string().min(1),
13572
+ command_id: external_exports.string().min(1),
13573
+ already_retired: external_exports.boolean(),
13574
+ publication: InvestigationPublicationReceiptSchema
13575
+ }).passthrough();
13576
+ CaseRefsReceiptSchema = external_exports.object({
13577
+ investigation_id: external_exports.string().uuid(),
13578
+ source_path: external_exports.string().min(1),
13579
+ operation: external_exports.enum(["attach", "detach"]),
13580
+ claims: external_exports.array(
13581
+ external_exports.object({
13582
+ key: external_exports.string().min(1),
13583
+ case_refs: external_exports.array(external_exports.string().min(1)),
13584
+ case_ids: external_exports.array(external_exports.string().uuid())
13585
+ })
13586
+ ),
13587
+ cases: external_exports.array(
13588
+ external_exports.object({
13589
+ ref: external_exports.string().min(1),
13590
+ case_id: external_exports.string().uuid(),
13591
+ source_path: external_exports.string().nullable()
13592
+ })
13593
+ ),
13594
+ publication: InvestigationPublicationReceiptSchema
13595
+ }).passthrough();
13395
13596
  EvalManagementCatalogResultSchema = EvalManagementCatalogResponseSchema.extend({
13396
13597
  scope: EvalManagementScopeSchema.optional()
13397
13598
  });
@@ -16181,18 +16382,8 @@ async function callEvalManagement(bambooSession, call, orgId) {
16181
16382
  path2 = path2.replace("{id}", encodeURIComponent(id));
16182
16383
  delete input.id;
16183
16384
  }
16184
- const action = call.operation.split(".")[1] ?? "";
16185
- if (call.operation.startsWith("investigation.") && [
16186
- "hold",
16187
- "resume",
16188
- "cancel",
16189
- "conclude_claim",
16190
- "retire_claim",
16191
- "close",
16192
- "reopen",
16193
- "retire"
16194
- ].includes(action)) {
16195
- input.operation = action;
16385
+ for (const [field, value] of Object.entries(help.server_injected ?? {})) {
16386
+ input[field] = value;
16196
16387
  }
16197
16388
  let url = `${apiBase()}${path2}`;
16198
16389
  const init = {
@@ -16250,7 +16441,7 @@ async function callEvalManagement(bambooSession, call, orgId) {
16250
16441
  }
16251
16442
  function unknownEvalMutationOutcome(call, orgId) {
16252
16443
  const operation = call.operation;
16253
- const recovery = operation === "investigation.create" ? `Do not blindly retry. Reconcile the selected scope first with: bamboo-agents eval manage investigation.list${orgId ? ` --org ${orgId}` : ""} --input '${JSON.stringify({ brand_id: call.input.brand_id, agent_id: call.input.agent_id, search: call.input.title })}'` : "Read the scoped investigation and repository receipt before retrying.";
16444
+ const recovery = operation === "investigation.create" ? `Do not blindly retry. Reconcile the selected scope first with: bamboo-agents eval manage investigation.list${orgId ? ` --org ${orgId}` : ""} --input '${JSON.stringify({ brand_id: call.input.brand_id, agent_id: call.input.agent_id, search: call.input.title })}'` : operation === "case.create" ? "Do not blindly retry: a repeat create refuses with case_exists if the first landed. Read the case path in the workspace repo (or eval_cases by source_path) before retrying." : "Read the scoped investigation and repository receipt before retrying.";
16254
16445
  return new ApiError(
16255
16446
  `The ${operation} request received no HTTP response, so its outcome is unknown. ${recovery}`,
16256
16447
  502,
@@ -22684,6 +22875,9 @@ function managementOutcomeLine(result, readOnly) {
22684
22875
  const reason = publication.publication_error ?? publication.error;
22685
22876
  return `Failed to publish ${result.operation}${typeof reason === "string" ? `: ${reason}` : "."}`;
22686
22877
  }
22878
+ if (result.operation.startsWith("case.")) {
22879
+ return caseOutcomeLine(result.operation, data, publication);
22880
+ }
22687
22881
  if (publication?.status === "published" && publication.projection_status === "projected") {
22688
22882
  return `Published ${result.operation} and projected it into Tests.`;
22689
22883
  }
@@ -22721,6 +22915,35 @@ function managementOutcomeLine(result, readOnly) {
22721
22915
  }
22722
22916
  return `Applied ${result.operation}.`;
22723
22917
  }
22918
+ function caseOutcomeLine(operation, data, publication) {
22919
+ const status = publication?.status;
22920
+ const projected = publication?.projection_status === "projected";
22921
+ const sourcePath = typeof data.source_path === "string" ? data.source_path : "the case";
22922
+ if (operation === "case.attach" || operation === "case.detach") {
22923
+ const claims = Array.isArray(data.claims) ? data.claims.length : 0;
22924
+ const verb2 = operation === "case.attach" ? "Attached" : "Detached";
22925
+ const membership = projected ? "Tests membership is projected" : "Tests membership projection is pending";
22926
+ if (status === "pending")
22927
+ return `${verb2} case references on ${claims} claim(s); the investigation revision is pending publication and ${membership.toLowerCase()}.`;
22928
+ if (status === "noop")
22929
+ return `No change: the ${claims} named claim(s) already carried those case references.`;
22930
+ return `${verb2} case references on ${claims} claim(s); ${membership}. No run was scheduled.`;
22931
+ }
22932
+ if (operation === "case.retire") {
22933
+ if (data.already_retired === true)
22934
+ return `${sourcePath} was already retired; nothing was written.`;
22935
+ if (status === "pending")
22936
+ return `Retirement of ${sourcePath} is queued for publication; the projected case stays active until it merges.`;
22937
+ return projected ? `Retired ${sourcePath}: the file is removed and the projected case is inactive.` : `Retired ${sourcePath}: the file is removed, but the projected case has not been marked inactive yet.`;
22938
+ }
22939
+ const verb = operation === "case.create" ? "Authored" : "Updated";
22940
+ const caseId = typeof data.case_id === "string" ? ` (eval_cases ${data.case_id})` : "";
22941
+ if (status === "pending")
22942
+ return `${verb} ${sourcePath}; publication is pending review and the case is not projected yet.`;
22943
+ if (status === "noop")
22944
+ return `No change for ${sourcePath}; the published case is current.`;
22945
+ return projected ? `${verb} ${sourcePath} and projected it into eval_cases${caseId}. No run was scheduled.` : `${verb} ${sourcePath}; the eval_cases projection is pending.`;
22946
+ }
22724
22947
  var init_eval_management2 = __esm({
22725
22948
  "src/commands/eval-management.ts"() {
22726
22949
  "use strict";
@@ -23676,11 +23899,11 @@ evals.command("scope").description("Resolve one organization and list its author
23676
23899
  const { runEvalScope: runEvalScope2 } = await Promise.resolve().then(() => (init_eval_management2(), eval_management_exports));
23677
23900
  await runEvalScope2(options);
23678
23901
  });
23679
- evals.command("operations").description("List the exact supported investigation and wave management operations").option("--org <uuid-or-name>", "Operate in this organization (exact/unique names resolve authoritatively)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").action(async (options) => {
23902
+ evals.command("operations").description("List the exact supported investigation, wave, and case management operations").option("--org <uuid-or-name>", "Operate in this organization (exact/unique names resolve authoritatively)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").action(async (options) => {
23680
23903
  const { runEvalOperations: runEvalOperations2 } = await Promise.resolve().then(() => (init_eval_management2(), eval_management_exports));
23681
23904
  await runEvalOperations2(options);
23682
23905
  });
23683
- evals.command("manage").description("Call one canonical investigation or wave operation").argument("<operation>", "Exact name from `eval operations`").requiredOption("--input <json-or-@file>", "JSON object, inline or loaded from @path").option("--org <uuid-or-name>", "Operate in this organization (exact/unique names resolve authoritatively)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (operation, options) => {
23906
+ evals.command("manage").description("Call one canonical investigation, wave, or case operation").argument("<operation>", "Exact name from `eval operations`").requiredOption("--input <json-or-@file>", "JSON object, inline or loaded from @path").option("--org <uuid-or-name>", "Operate in this organization (exact/unique names resolve authoritatively)").option("--json", "Emit a JSON envelope for agent consumption").option("--fields <list>", "Project only these dotted field paths from data (comma-separated)").option("--quiet", "Suppress human chatter (data/errors only)").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (operation, options) => {
23684
23907
  const { runEvalManage: runEvalManage2 } = await Promise.resolve().then(() => (init_eval_management2(), eval_management_exports));
23685
23908
  await runEvalManage2({ operation, ...options });
23686
23909
  });