bamboo-agents 0.1.12-dev.114.5cb2242 → 0.1.12-dev.116.b57862a
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 +58 -27
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.12-dev.
|
|
1
|
+
0.1.12-dev.116.b57862a
|
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.12-dev.
|
|
3040
|
+
VERSION = "0.1.12-dev.116.b57862a";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7772,12 +7772,17 @@ function emitError(err, opts, exitCode) {
|
|
|
7772
7772
|
error: {
|
|
7773
7773
|
code: err.code,
|
|
7774
7774
|
message: err.message,
|
|
7775
|
-
...err.hint ? { hint: err.hint } : {}
|
|
7775
|
+
...err.hint ? { hint: err.hint } : {},
|
|
7776
|
+
...err.details ? { details: err.details } : {}
|
|
7776
7777
|
}
|
|
7777
7778
|
};
|
|
7778
7779
|
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7779
7780
|
} else if (!opts.quiet) {
|
|
7780
|
-
writeStderr(`bamboo-agents: ${err.message}`);
|
|
7781
|
+
writeStderr(`bamboo-agents: [${err.code}] ${err.message}`);
|
|
7782
|
+
if (typeof err.details?.reason === "string")
|
|
7783
|
+
writeStderr(` Reason: ${err.details.reason}`);
|
|
7784
|
+
if (err.details?.read_back !== void 0)
|
|
7785
|
+
writeStderr(` Read-back: ${JSON.stringify(err.details.read_back)}`);
|
|
7781
7786
|
if (err.hint) writeStderr(` ${err.hint}`);
|
|
7782
7787
|
}
|
|
7783
7788
|
if (exitCode !== void 0) process.exit(exitCode);
|
|
@@ -14008,6 +14013,7 @@ var init_inbox_management = __esm({
|
|
|
14008
14013
|
instruction: external_exports.literal("inspect_source_before_retry"),
|
|
14009
14014
|
reason: external_exports.enum([
|
|
14010
14015
|
"response_unproven",
|
|
14016
|
+
"transport_failed",
|
|
14011
14017
|
"read_back_unavailable",
|
|
14012
14018
|
"postcondition_not_observed"
|
|
14013
14019
|
]).default("response_unproven"),
|
|
@@ -14078,7 +14084,9 @@ var init_inbox_management = __esm({
|
|
|
14078
14084
|
LifecycleUnknownReceiptSchema = external_exports.object({
|
|
14079
14085
|
state: external_exports.literal("unknown"),
|
|
14080
14086
|
command_id: external_exports.string(),
|
|
14081
|
-
instruction: external_exports.literal("inspect_source_before_retry")
|
|
14087
|
+
instruction: external_exports.literal("inspect_source_before_retry"),
|
|
14088
|
+
reason: external_exports.enum(["transport_failed", "read_back_unavailable", "postcondition_not_observed"]).optional(),
|
|
14089
|
+
read_back: external_exports.unknown().optional()
|
|
14082
14090
|
});
|
|
14083
14091
|
AnnotationSnapshotSchema = external_exports.object({
|
|
14084
14092
|
id: external_exports.string().uuid(),
|
|
@@ -14903,7 +14911,7 @@ function parseEvalManagementOperationData(call, data, selectedOrgId) {
|
|
|
14903
14911
|
}
|
|
14904
14912
|
return parsed;
|
|
14905
14913
|
}
|
|
14906
|
-
var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementCatalogBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common2, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, InvestigationControlReceiptSchema, InvestigationDecisionReceiptSchema, InvestigationWaveMemberReceiptSchema, InvestigationWaveCreateReceiptSchema, InvestigationWaveUpdateReceiptSchema, InvestigationWaveScheduleReceiptSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema;
|
|
14914
|
+
var EvalManagementOperationSchema, EvalManagementBindingSchema, EvalManagementCatalogBindingSchema, EvalManagementInputHelpSchema, EVAL_MANAGEMENT_INPUTS, common2, EVAL_MANAGEMENT_BINDINGS, EvalManagementCatalogResponseSchema, EvalManagementCallSchema, EvalManagementScopeSchema, InvestigationPublicationReceiptSchema, InvestigationAuthoringDataSchema, InvestigationControlReceiptSchema, InvestigationDecisionReceiptSchema, InvestigationWaveMemberReceiptSchema, InvestigationWaveCreateReceiptSchema, InvestigationWaveUpdateReceiptSchema, InvestigationWaveScheduleReceiptSchema, EvalManagementCatalogResultSchema, EvalManagementResultSchema, EvalManagementWriteErrorSchema;
|
|
14907
14915
|
var init_eval_management = __esm({
|
|
14908
14916
|
"../../src/lib/api-contracts/cli/eval-management.ts"() {
|
|
14909
14917
|
init_zod();
|
|
@@ -15326,6 +15334,7 @@ var init_eval_management = __esm({
|
|
|
15326
15334
|
"retire"
|
|
15327
15335
|
]),
|
|
15328
15336
|
publication_status: external_exports.enum(["pending", "published", "failed"]),
|
|
15337
|
+
publication_error: external_exports.string().nullable().optional(),
|
|
15329
15338
|
source_sha: external_exports.string().nullable().optional(),
|
|
15330
15339
|
pr_url: external_exports.string().url().nullable().optional(),
|
|
15331
15340
|
canceled_pending_count: external_exports.number().int().nonnegative(),
|
|
@@ -15392,6 +15401,24 @@ var init_eval_management = __esm({
|
|
|
15392
15401
|
data: external_exports.unknown(),
|
|
15393
15402
|
scope: EvalManagementScopeSchema.optional()
|
|
15394
15403
|
});
|
|
15404
|
+
EvalManagementWriteErrorSchema = external_exports.object({
|
|
15405
|
+
error: external_exports.object({
|
|
15406
|
+
code: external_exports.string().min(1),
|
|
15407
|
+
message: external_exports.string(),
|
|
15408
|
+
details: external_exports.object({
|
|
15409
|
+
request_id: external_exports.string().optional(),
|
|
15410
|
+
reason: external_exports.enum([
|
|
15411
|
+
"transport_failed",
|
|
15412
|
+
"read_back_unavailable",
|
|
15413
|
+
"postcondition_not_observed"
|
|
15414
|
+
]).optional(),
|
|
15415
|
+
read_back: external_exports.unknown().optional(),
|
|
15416
|
+
decision_id: external_exports.string().uuid().optional(),
|
|
15417
|
+
judgment_id: external_exports.string().uuid().nullable().optional(),
|
|
15418
|
+
publication_error: external_exports.string().optional()
|
|
15419
|
+
}).passthrough().optional()
|
|
15420
|
+
}).passthrough()
|
|
15421
|
+
});
|
|
15395
15422
|
}
|
|
15396
15423
|
});
|
|
15397
15424
|
|
|
@@ -15457,7 +15484,7 @@ function defaultApiBase(version) {
|
|
|
15457
15484
|
function apiBase() {
|
|
15458
15485
|
return process.env.BAMBOO_BASE_URL ?? defaultApiBase(VERSION);
|
|
15459
15486
|
}
|
|
15460
|
-
async function parseError(res) {
|
|
15487
|
+
async function parseError(res, options = {}) {
|
|
15461
15488
|
let body = {};
|
|
15462
15489
|
try {
|
|
15463
15490
|
body = await res.json();
|
|
@@ -15467,10 +15494,10 @@ async function parseError(res) {
|
|
|
15467
15494
|
const flatError = typeof body.error === "string" ? body.error : void 0;
|
|
15468
15495
|
let message = nested?.message ?? body.message ?? flatError ?? `HTTP ${res.status} from ${res.url}`;
|
|
15469
15496
|
const code = nested?.code ?? flatError;
|
|
15470
|
-
if (res.status === 401) {
|
|
15497
|
+
if (res.status === 401 && !options.preserveMessage) {
|
|
15471
15498
|
message += " \u2014 run `bamboo-agents login` to re-authenticate.";
|
|
15472
15499
|
}
|
|
15473
|
-
return new ApiError(message, res.status, code);
|
|
15500
|
+
return new ApiError(message, res.status, code, nested?.details);
|
|
15474
15501
|
}
|
|
15475
15502
|
function userAgent() {
|
|
15476
15503
|
const nodeVersion = process.versions.node;
|
|
@@ -16101,17 +16128,7 @@ async function callEvalManagement(bambooSession, call, orgId) {
|
|
|
16101
16128
|
throw unknownEvalMutationOutcome(call, orgId);
|
|
16102
16129
|
}
|
|
16103
16130
|
if (!res.ok) {
|
|
16104
|
-
|
|
16105
|
-
const knownPrewriteFailures = /* @__PURE__ */ new Set([
|
|
16106
|
-
"scope_validation_failed",
|
|
16107
|
-
"investigation_recovery_failed",
|
|
16108
|
-
"investigation_read_failed",
|
|
16109
|
-
"workspace_unavailable",
|
|
16110
|
-
"source_unavailable"
|
|
16111
|
-
]);
|
|
16112
|
-
if (isMutation && res.status >= 500 && !knownPrewriteFailures.has(parsedError.errorCode ?? ""))
|
|
16113
|
-
throw unknownEvalMutationOutcome(call, orgId);
|
|
16114
|
-
throw parsedError;
|
|
16131
|
+
throw await parseError(res, { preserveMessage: true });
|
|
16115
16132
|
}
|
|
16116
16133
|
try {
|
|
16117
16134
|
const json = await res.json();
|
|
@@ -16134,7 +16151,6 @@ async function callEvalManagement(bambooSession, call, orgId) {
|
|
|
16134
16151
|
return result;
|
|
16135
16152
|
} catch (error) {
|
|
16136
16153
|
if (error instanceof ApiError) throw error;
|
|
16137
|
-
if (isMutation) throw unknownEvalMutationOutcome(call, orgId);
|
|
16138
16154
|
throw malformedEvalManagementResponse();
|
|
16139
16155
|
}
|
|
16140
16156
|
}
|
|
@@ -16142,9 +16158,10 @@ function unknownEvalMutationOutcome(call, orgId) {
|
|
|
16142
16158
|
const operation = call.operation;
|
|
16143
16159
|
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.";
|
|
16144
16160
|
return new ApiError(
|
|
16145
|
-
`The ${operation} request
|
|
16161
|
+
`The ${operation} request received no HTTP response, so its outcome is unknown. ${recovery}`,
|
|
16146
16162
|
502,
|
|
16147
|
-
"outcome_unknown"
|
|
16163
|
+
"outcome_unknown",
|
|
16164
|
+
{ reason: "transport_failed" }
|
|
16148
16165
|
);
|
|
16149
16166
|
}
|
|
16150
16167
|
function malformedEvalManagementResponse() {
|
|
@@ -16238,10 +16255,11 @@ var init_api = __esm({
|
|
|
16238
16255
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
16239
16256
|
REQUEST_TIMEOUT_MS = 3e4;
|
|
16240
16257
|
ApiError = class extends Error {
|
|
16241
|
-
constructor(message, status, errorCode) {
|
|
16258
|
+
constructor(message, status, errorCode, details) {
|
|
16242
16259
|
super(message);
|
|
16243
16260
|
this.status = status;
|
|
16244
16261
|
this.errorCode = errorCode;
|
|
16262
|
+
this.details = details;
|
|
16245
16263
|
this.name = "ApiError";
|
|
16246
16264
|
}
|
|
16247
16265
|
};
|
|
@@ -22263,8 +22281,8 @@ async function requireSession12(opts) {
|
|
|
22263
22281
|
if (!session) {
|
|
22264
22282
|
emitError(
|
|
22265
22283
|
{
|
|
22266
|
-
code: "
|
|
22267
|
-
message: "
|
|
22284
|
+
code: "authentication_required",
|
|
22285
|
+
message: "Run `bamboo-agents login` first.",
|
|
22268
22286
|
hint: "Run `bamboo-agents login` first."
|
|
22269
22287
|
},
|
|
22270
22288
|
opts,
|
|
@@ -22367,7 +22385,8 @@ async function runEvalManage(options) {
|
|
|
22367
22385
|
{
|
|
22368
22386
|
code: invalidInput ? "invalid_input" : value.code ?? value.errorCode ?? "management_failed",
|
|
22369
22387
|
message: value.message ?? "Management operation failed.",
|
|
22370
|
-
|
|
22388
|
+
...value.details ? { details: value.details } : {},
|
|
22389
|
+
hint: value.status === 401 ? "Run `bamboo-agents login` to re-authenticate." : "Run `bamboo-agents eval operations --json` for supported names and bindings."
|
|
22371
22390
|
},
|
|
22372
22391
|
output,
|
|
22373
22392
|
1
|
|
@@ -22375,9 +22394,19 @@ async function runEvalManage(options) {
|
|
|
22375
22394
|
}
|
|
22376
22395
|
}
|
|
22377
22396
|
function managementOutcomeLine(result, readOnly) {
|
|
22378
|
-
if (readOnly)
|
|
22397
|
+
if (readOnly) {
|
|
22398
|
+
const investigation = result.data && typeof result.data === "object" ? result.data : null;
|
|
22399
|
+
if (result.operation === "investigation.get" && investigation?.lifecycle_state === "retired" && typeof investigation.retired_at === "string") {
|
|
22400
|
+
return `Read investigation.get. Retired on ${investigation.retired_at.slice(0, 10)}.`;
|
|
22401
|
+
}
|
|
22402
|
+
return `Read ${result.operation}.`;
|
|
22403
|
+
}
|
|
22379
22404
|
const data = result.data && typeof result.data === "object" ? result.data : {};
|
|
22380
22405
|
const publication = data.publication && typeof data.publication === "object" ? data.publication : null;
|
|
22406
|
+
if (publication?.status === "failed") {
|
|
22407
|
+
const reason = publication.publication_error ?? publication.error;
|
|
22408
|
+
return `Failed to publish ${result.operation}${typeof reason === "string" ? `: ${reason}` : "."}`;
|
|
22409
|
+
}
|
|
22381
22410
|
if (publication?.status === "published" && publication.projection_status === "projected") {
|
|
22382
22411
|
return `Published ${result.operation} and projected it into Tests.`;
|
|
22383
22412
|
}
|
|
@@ -22409,6 +22438,8 @@ function managementOutcomeLine(result, readOnly) {
|
|
|
22409
22438
|
lifecycle ?? ""
|
|
22410
22439
|
)) {
|
|
22411
22440
|
const publicationStatus = data.publication_status;
|
|
22441
|
+
if (publicationStatus === "failed")
|
|
22442
|
+
return `Failed to publish ${result.operation}${typeof data.publication_error === "string" ? `: ${data.publication_error}` : "."}`;
|
|
22412
22443
|
return publicationStatus === "pending" ? `Recorded ${result.operation}; repository publication is pending.` : `Published ${result.operation} with its decision receipt.`;
|
|
22413
22444
|
}
|
|
22414
22445
|
return `Applied ${result.operation}.`;
|