bamboo-agents 0.1.16-dev.133.a75755c → 0.1.16-dev.136.c3da754
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 +67 -11
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.16-dev.
|
|
1
|
+
0.1.16-dev.136.c3da754
|
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.16-dev.
|
|
3040
|
+
VERSION = "0.1.16-dev.136.c3da754";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7212,7 +7212,7 @@ var init_knowledge_slots = __esm({
|
|
|
7212
7212
|
"../../src/lib/api-contracts/cli/knowledge-slots.ts"() {
|
|
7213
7213
|
init_zod();
|
|
7214
7214
|
KnowledgeSlotKindSchema = external_exports.object({
|
|
7215
|
-
/** Directory taxonomy: knowledge | memory | context | skills | scheduled_tasks |
|
|
7215
|
+
/** Directory taxonomy: knowledge | memory | context | skills | scheduled_tasks | identity */
|
|
7216
7216
|
kind: external_exports.string(),
|
|
7217
7217
|
/** Scope this kind may be written at. */
|
|
7218
7218
|
scope: external_exports.enum(["org", "brand", "agent"]),
|
|
@@ -7224,8 +7224,8 @@ var init_knowledge_slots = __esm({
|
|
|
7224
7224
|
*/
|
|
7225
7225
|
example_path: external_exports.string(),
|
|
7226
7226
|
/**
|
|
7227
|
-
* True when the filename is pinned by the server (
|
|
7228
|
-
*
|
|
7227
|
+
* True when the filename is pinned by the server (identity) and the
|
|
7228
|
+
* caller's filename is ignored.
|
|
7229
7229
|
*/
|
|
7230
7230
|
filename_pinned: external_exports.boolean()
|
|
7231
7231
|
});
|
|
@@ -7256,7 +7256,7 @@ function isSafeRepoPath(path2) {
|
|
|
7256
7256
|
if (path2.split("/").includes("..")) return false;
|
|
7257
7257
|
return true;
|
|
7258
7258
|
}
|
|
7259
|
-
var SaveEditSchema, SaveBatchRequestSchema, SaveFileResultSchema, SaveBatchResponseSchema;
|
|
7259
|
+
var SaveEditSchema, SaveBatchRequestSchema, SaveFileResultSchema, SaveBatchResponseSchema, SaveFindingSchema, SaveRefusalDetailsSchema;
|
|
7260
7260
|
var init_save = __esm({
|
|
7261
7261
|
"../../src/lib/api-contracts/cli/save.ts"() {
|
|
7262
7262
|
init_zod();
|
|
@@ -7311,6 +7311,20 @@ var init_save = __esm({
|
|
|
7311
7311
|
/** BAM-2588: true when this was a --dry-run preview (nothing was written). */
|
|
7312
7312
|
dry_run: external_exports.boolean().optional()
|
|
7313
7313
|
});
|
|
7314
|
+
SaveFindingSchema = external_exports.object({
|
|
7315
|
+
ruleId: external_exports.string(),
|
|
7316
|
+
check: external_exports.number().int(),
|
|
7317
|
+
path: external_exports.string(),
|
|
7318
|
+
line: external_exports.number().int().nullable(),
|
|
7319
|
+
message: external_exports.string(),
|
|
7320
|
+
fix: external_exports.string()
|
|
7321
|
+
});
|
|
7322
|
+
SaveRefusalDetailsSchema = external_exports.object({
|
|
7323
|
+
routed: external_exports.literal("rejected"),
|
|
7324
|
+
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
7325
|
+
reason: external_exports.string(),
|
|
7326
|
+
findings: external_exports.array(SaveFindingSchema)
|
|
7327
|
+
});
|
|
7314
7328
|
}
|
|
7315
7329
|
});
|
|
7316
7330
|
|
|
@@ -7346,7 +7360,8 @@ var init_knowledge_save = __esm({
|
|
|
7346
7360
|
pr_url: external_exports.string().optional(),
|
|
7347
7361
|
pr_number: external_exports.number().optional(),
|
|
7348
7362
|
/** Present on `rejected` / `noop` / `conflict` — short machine-friendly reason. */
|
|
7349
|
-
reason: external_exports.string().optional()
|
|
7363
|
+
reason: external_exports.string().optional(),
|
|
7364
|
+
findings: external_exports.array(SaveFindingSchema).optional()
|
|
7350
7365
|
});
|
|
7351
7366
|
}
|
|
7352
7367
|
});
|
|
@@ -7783,7 +7798,15 @@ function emitError(err, opts, exitCode) {
|
|
|
7783
7798
|
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7784
7799
|
} else if (!opts.quiet) {
|
|
7785
7800
|
writeStderr(`bamboo-agents: [${err.code}] ${err.message}`);
|
|
7786
|
-
|
|
7801
|
+
const findings = Array.isArray(err.details?.findings) ? err.details.findings.filter(
|
|
7802
|
+
(finding) => finding !== null && typeof finding === "object" && typeof finding.path === "string" && (finding.line === null || typeof finding.line === "number") && typeof finding.message === "string" && typeof finding.fix === "string"
|
|
7803
|
+
) : [];
|
|
7804
|
+
for (const finding of findings) {
|
|
7805
|
+
const location = `${finding.path}${finding.line === null ? "" : `:${finding.line}`}`;
|
|
7806
|
+
writeStderr(` ${location} ${finding.message}`);
|
|
7807
|
+
writeStderr(` Fix: ${finding.fix}`);
|
|
7808
|
+
}
|
|
7809
|
+
if (findings.length === 0 && typeof err.details?.reason === "string")
|
|
7787
7810
|
writeStderr(` Reason: ${err.details.reason}`);
|
|
7788
7811
|
if (err.details?.read_back !== void 0)
|
|
7789
7812
|
writeStderr(` Read-back: ${JSON.stringify(err.details.read_back)}`);
|
|
@@ -12493,7 +12516,9 @@ var init_auth_status = __esm({
|
|
|
12493
12516
|
OrgRefSchema = external_exports.object({
|
|
12494
12517
|
id: external_exports.string(),
|
|
12495
12518
|
name: external_exports.string(),
|
|
12496
|
-
workspace_repo: external_exports.string().nullable()
|
|
12519
|
+
workspace_repo: external_exports.string().nullable(),
|
|
12520
|
+
/** Present when Bamboo's shared installation serves this workspace. */
|
|
12521
|
+
workspace_managed: external_exports.boolean().optional()
|
|
12497
12522
|
});
|
|
12498
12523
|
MembershipSchema = external_exports.object({
|
|
12499
12524
|
org: OrgRefSchema,
|
|
@@ -16869,7 +16894,7 @@ async function fetchGithubTokenForLogin(bambooSession) {
|
|
|
16869
16894
|
return handleMissingGithubToken(bambooSession);
|
|
16870
16895
|
}
|
|
16871
16896
|
}
|
|
16872
|
-
async function finishLogin(bambooSession, tokenResp) {
|
|
16897
|
+
async function finishLogin(bambooSession, tokenResp, options = {}) {
|
|
16873
16898
|
await writeCredentials({
|
|
16874
16899
|
bamboo_session: bambooSession,
|
|
16875
16900
|
github_token: tokenResp?.access_token ?? "",
|
|
@@ -16877,6 +16902,13 @@ async function finishLogin(bambooSession, tokenResp) {
|
|
|
16877
16902
|
github_username: tokenResp?.github_username ?? null,
|
|
16878
16903
|
written_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
16879
16904
|
});
|
|
16905
|
+
if (options.managedWorkspace) {
|
|
16906
|
+
console.log("");
|
|
16907
|
+
console.log(" \u2713 Logged in to your Bamboo-managed workspace.");
|
|
16908
|
+
console.log(" Local git cloning may require separate GitHub access.");
|
|
16909
|
+
console.log("");
|
|
16910
|
+
return;
|
|
16911
|
+
}
|
|
16880
16912
|
if (!tokenResp) {
|
|
16881
16913
|
console.log("");
|
|
16882
16914
|
console.log(" Your Bamboo session is saved \u2014 GitHub isn't linked yet.");
|
|
@@ -16902,7 +16934,7 @@ async function runLogin() {
|
|
|
16902
16934
|
console.log("");
|
|
16903
16935
|
console.log(" bamboo-agents will:");
|
|
16904
16936
|
console.log(" \u2022 open your browser so you can sign in to Bamboo");
|
|
16905
|
-
console.log(" \u2022
|
|
16937
|
+
console.log(" \u2022 save your Bamboo session to ~/.bamboo/");
|
|
16906
16938
|
console.log("");
|
|
16907
16939
|
console.log(` Verification code: ${code}`);
|
|
16908
16940
|
console.log(" (the browser page should show the same code)");
|
|
@@ -16918,6 +16950,14 @@ async function runLogin() {
|
|
|
16918
16950
|
process.exit(1);
|
|
16919
16951
|
}
|
|
16920
16952
|
spinner.succeed("Bamboo session captured");
|
|
16953
|
+
try {
|
|
16954
|
+
const status = await getCliAuthStatus(bambooSession);
|
|
16955
|
+
if (status.memberships.length > 0 && status.pending_invites.length === 0 && status.memberships.every((membership) => membership.org.workspace_managed === true)) {
|
|
16956
|
+
await finishLogin(bambooSession, null, { managedWorkspace: true });
|
|
16957
|
+
return;
|
|
16958
|
+
}
|
|
16959
|
+
} catch {
|
|
16960
|
+
}
|
|
16921
16961
|
const tokenResp = await fetchGithubTokenForLogin(bambooSession);
|
|
16922
16962
|
await finishLogin(bambooSession, tokenResp);
|
|
16923
16963
|
}
|
|
@@ -18964,6 +19004,21 @@ async function runSave(intent, options = {}) {
|
|
|
18964
19004
|
dry_run: dryRun || void 0
|
|
18965
19005
|
});
|
|
18966
19006
|
} catch (err) {
|
|
19007
|
+
if (err instanceof ApiError && err.status === 422) {
|
|
19008
|
+
const findings = err.details?.findings;
|
|
19009
|
+
const count = Array.isArray(findings) ? findings.length : null;
|
|
19010
|
+
emitError(
|
|
19011
|
+
{
|
|
19012
|
+
code: err.errorCode ?? "rejected",
|
|
19013
|
+
message: count === null ? `couldn't save \u2014 ${err.message}` : `couldn't save \u2014 ${count} problem${count === 1 ? "" : "s"} to fix.`,
|
|
19014
|
+
hint: "Fix each problem and run `bamboo-agents save` again.",
|
|
19015
|
+
details: err.details
|
|
19016
|
+
},
|
|
19017
|
+
opts,
|
|
19018
|
+
1
|
|
19019
|
+
);
|
|
19020
|
+
return;
|
|
19021
|
+
}
|
|
18967
19022
|
if (err instanceof ApiError && err.status === 403) {
|
|
18968
19023
|
emitError(
|
|
18969
19024
|
{
|
|
@@ -20988,7 +21043,8 @@ async function runKnowledgeSave(options) {
|
|
|
20988
21043
|
{
|
|
20989
21044
|
code: "rejected",
|
|
20990
21045
|
message: `save rejected${result.reason ? `: ${result.reason}` : "."}`,
|
|
20991
|
-
hint: "Check the path scope and your permissions."
|
|
21046
|
+
hint: "Check the path scope and your permissions.",
|
|
21047
|
+
details: { reason: result.reason, findings: result.findings }
|
|
20992
21048
|
},
|
|
20993
21049
|
opts,
|
|
20994
21050
|
1
|