bamboo-agents 0.1.5-dev.42.12bcb59 → 0.1.5-dev.44.fc84729
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 +490 -141
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2823,16 +2823,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2823
2823
|
*/
|
|
2824
2824
|
_getHelpContext(contextOptions) {
|
|
2825
2825
|
contextOptions = contextOptions || {};
|
|
2826
|
-
const
|
|
2826
|
+
const context2 = { error: !!contextOptions.error };
|
|
2827
2827
|
let write;
|
|
2828
|
-
if (
|
|
2828
|
+
if (context2.error) {
|
|
2829
2829
|
write = (arg) => this._outputConfiguration.writeErr(arg);
|
|
2830
2830
|
} else {
|
|
2831
2831
|
write = (arg) => this._outputConfiguration.writeOut(arg);
|
|
2832
2832
|
}
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
return
|
|
2833
|
+
context2.write = contextOptions.write || write;
|
|
2834
|
+
context2.command = this;
|
|
2835
|
+
return context2;
|
|
2836
2836
|
}
|
|
2837
2837
|
/**
|
|
2838
2838
|
* Output help information for this command.
|
|
@@ -2847,23 +2847,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2847
2847
|
deprecatedCallback = contextOptions;
|
|
2848
2848
|
contextOptions = void 0;
|
|
2849
2849
|
}
|
|
2850
|
-
const
|
|
2851
|
-
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp",
|
|
2852
|
-
this.emit("beforeHelp",
|
|
2853
|
-
let helpInformation = this.helpInformation(
|
|
2850
|
+
const context2 = this._getHelpContext(contextOptions);
|
|
2851
|
+
this._getCommandAndAncestors().reverse().forEach((command) => command.emit("beforeAllHelp", context2));
|
|
2852
|
+
this.emit("beforeHelp", context2);
|
|
2853
|
+
let helpInformation = this.helpInformation(context2);
|
|
2854
2854
|
if (deprecatedCallback) {
|
|
2855
2855
|
helpInformation = deprecatedCallback(helpInformation);
|
|
2856
2856
|
if (typeof helpInformation !== "string" && !Buffer.isBuffer(helpInformation)) {
|
|
2857
2857
|
throw new Error("outputHelp callback must return a string or a Buffer");
|
|
2858
2858
|
}
|
|
2859
2859
|
}
|
|
2860
|
-
|
|
2860
|
+
context2.write(helpInformation);
|
|
2861
2861
|
if (this._getHelpOption()?.long) {
|
|
2862
2862
|
this.emit(this._getHelpOption().long);
|
|
2863
2863
|
}
|
|
2864
|
-
this.emit("afterHelp",
|
|
2864
|
+
this.emit("afterHelp", context2);
|
|
2865
2865
|
this._getCommandAndAncestors().forEach(
|
|
2866
|
-
(command) => command.emit("afterAllHelp",
|
|
2866
|
+
(command) => command.emit("afterAllHelp", context2)
|
|
2867
2867
|
);
|
|
2868
2868
|
}
|
|
2869
2869
|
/**
|
|
@@ -2948,15 +2948,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2948
2948
|
Expecting one of '${allowedValues.join("', '")}'`);
|
|
2949
2949
|
}
|
|
2950
2950
|
const helpEvent = `${position}Help`;
|
|
2951
|
-
this.on(helpEvent, (
|
|
2951
|
+
this.on(helpEvent, (context2) => {
|
|
2952
2952
|
let helpStr;
|
|
2953
2953
|
if (typeof text === "function") {
|
|
2954
|
-
helpStr = text({ error:
|
|
2954
|
+
helpStr = text({ error: context2.error, command: context2.command });
|
|
2955
2955
|
} else {
|
|
2956
2956
|
helpStr = text;
|
|
2957
2957
|
}
|
|
2958
2958
|
if (helpStr) {
|
|
2959
|
-
|
|
2959
|
+
context2.write(`${helpStr}
|
|
2960
2960
|
`);
|
|
2961
2961
|
}
|
|
2962
2962
|
});
|
|
@@ -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.5-dev.
|
|
3040
|
+
VERSION = "0.1.5-dev.44.fc84729";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7147,6 +7147,160 @@ var init_zod = __esm({
|
|
|
7147
7147
|
}
|
|
7148
7148
|
});
|
|
7149
7149
|
|
|
7150
|
+
// ../../src/lib/api-contracts/cli/history.ts
|
|
7151
|
+
var history_exports = {};
|
|
7152
|
+
__export(history_exports, {
|
|
7153
|
+
HistoryEntrySchema: () => HistoryEntrySchema,
|
|
7154
|
+
HistoryResponseSchema: () => HistoryResponseSchema
|
|
7155
|
+
});
|
|
7156
|
+
var HistoryEntrySchema, HistoryResponseSchema;
|
|
7157
|
+
var init_history = __esm({
|
|
7158
|
+
"../../src/lib/api-contracts/cli/history.ts"() {
|
|
7159
|
+
init_zod();
|
|
7160
|
+
HistoryEntrySchema = external_exports.object({
|
|
7161
|
+
tool_name: external_exports.string().nullable(),
|
|
7162
|
+
status: external_exports.string(),
|
|
7163
|
+
timestamp: external_exports.string(),
|
|
7164
|
+
duration_ms: external_exports.number().nullable()
|
|
7165
|
+
});
|
|
7166
|
+
HistoryResponseSchema = external_exports.object({
|
|
7167
|
+
entries: external_exports.array(HistoryEntrySchema),
|
|
7168
|
+
count: external_exports.number()
|
|
7169
|
+
});
|
|
7170
|
+
}
|
|
7171
|
+
});
|
|
7172
|
+
|
|
7173
|
+
// ../../src/lib/api-contracts/cli/changes.ts
|
|
7174
|
+
var changes_exports = {};
|
|
7175
|
+
__export(changes_exports, {
|
|
7176
|
+
ChangeEntrySchema: () => ChangeEntrySchema,
|
|
7177
|
+
ChangesResponseSchema: () => ChangesResponseSchema
|
|
7178
|
+
});
|
|
7179
|
+
var ChangeEntrySchema, ChangesResponseSchema;
|
|
7180
|
+
var init_changes = __esm({
|
|
7181
|
+
"../../src/lib/api-contracts/cli/changes.ts"() {
|
|
7182
|
+
init_zod();
|
|
7183
|
+
ChangeEntrySchema = external_exports.object({
|
|
7184
|
+
id: external_exports.string(),
|
|
7185
|
+
tool_name: external_exports.string().nullable(),
|
|
7186
|
+
action: external_exports.string().nullable(),
|
|
7187
|
+
entity_type: external_exports.string().nullable(),
|
|
7188
|
+
entity_id: external_exports.string().nullable(),
|
|
7189
|
+
entity_name: external_exports.string().nullable(),
|
|
7190
|
+
agent: external_exports.string().nullable(),
|
|
7191
|
+
brand_id: external_exports.string().nullable(),
|
|
7192
|
+
timestamp: external_exports.string()
|
|
7193
|
+
});
|
|
7194
|
+
ChangesResponseSchema = external_exports.object({
|
|
7195
|
+
entries: external_exports.array(ChangeEntrySchema),
|
|
7196
|
+
count: external_exports.number()
|
|
7197
|
+
});
|
|
7198
|
+
}
|
|
7199
|
+
});
|
|
7200
|
+
|
|
7201
|
+
// ../../src/lib/api-contracts/cli/knowledge-slots.ts
|
|
7202
|
+
var knowledge_slots_exports = {};
|
|
7203
|
+
__export(knowledge_slots_exports, {
|
|
7204
|
+
KnowledgeDimensionSchema: () => KnowledgeDimensionSchema,
|
|
7205
|
+
KnowledgeSlotKindSchema: () => KnowledgeSlotKindSchema,
|
|
7206
|
+
KnowledgeSlotsResponseSchema: () => KnowledgeSlotsResponseSchema
|
|
7207
|
+
});
|
|
7208
|
+
var KnowledgeSlotKindSchema, KnowledgeDimensionSchema, KnowledgeSlotsResponseSchema;
|
|
7209
|
+
var init_knowledge_slots = __esm({
|
|
7210
|
+
"../../src/lib/api-contracts/cli/knowledge-slots.ts"() {
|
|
7211
|
+
init_zod();
|
|
7212
|
+
KnowledgeSlotKindSchema = external_exports.object({
|
|
7213
|
+
/** Directory taxonomy: knowledge | memory | context | skills | scheduled_tasks | instructions | identity */
|
|
7214
|
+
kind: external_exports.string(),
|
|
7215
|
+
/** Scope this kind may be written at. */
|
|
7216
|
+
scope: external_exports.enum(["org", "brand", "agent"]),
|
|
7217
|
+
/**
|
|
7218
|
+
* Example workspace-relative path, derived from the server's
|
|
7219
|
+
* `resolveRepoPathByKind`. Uses `{brand}` / `{agent}` placeholders the
|
|
7220
|
+
* skill substitutes from its workspace config. `example.md` stands in
|
|
7221
|
+
* for the caller-chosen filename.
|
|
7222
|
+
*/
|
|
7223
|
+
example_path: external_exports.string(),
|
|
7224
|
+
/**
|
|
7225
|
+
* True when the filename is pinned by the server (instructions/identity)
|
|
7226
|
+
* and the caller's filename is ignored.
|
|
7227
|
+
*/
|
|
7228
|
+
filename_pinned: external_exports.boolean()
|
|
7229
|
+
});
|
|
7230
|
+
KnowledgeDimensionSchema = external_exports.object({
|
|
7231
|
+
key: external_exports.string(),
|
|
7232
|
+
label: external_exports.string(),
|
|
7233
|
+
tags: external_exports.array(external_exports.string())
|
|
7234
|
+
});
|
|
7235
|
+
KnowledgeSlotsResponseSchema = external_exports.object({
|
|
7236
|
+
/** Spec §3 filename regex (source string) the skill validates against before writing. */
|
|
7237
|
+
filename_regex: external_exports.string(),
|
|
7238
|
+
/** Every (kind × allowed-scope) with its canonical path pattern. */
|
|
7239
|
+
kinds: external_exports.array(KnowledgeSlotKindSchema),
|
|
7240
|
+
/** The knowledge dimensions, for metadata tagging. */
|
|
7241
|
+
dimensions: external_exports.array(KnowledgeDimensionSchema)
|
|
7242
|
+
});
|
|
7243
|
+
}
|
|
7244
|
+
});
|
|
7245
|
+
|
|
7246
|
+
// ../../src/lib/api-contracts/cli/knowledge-save.ts
|
|
7247
|
+
var knowledge_save_exports = {};
|
|
7248
|
+
__export(knowledge_save_exports, {
|
|
7249
|
+
KnowledgeSaveRequestSchema: () => KnowledgeSaveRequestSchema,
|
|
7250
|
+
KnowledgeSaveResponseSchema: () => KnowledgeSaveResponseSchema
|
|
7251
|
+
});
|
|
7252
|
+
var KnowledgeSaveRequestSchema, KnowledgeSaveResponseSchema;
|
|
7253
|
+
var init_knowledge_save = __esm({
|
|
7254
|
+
"../../src/lib/api-contracts/cli/knowledge-save.ts"() {
|
|
7255
|
+
init_zod();
|
|
7256
|
+
KnowledgeSaveRequestSchema = external_exports.object({
|
|
7257
|
+
/** Canonical repo path, e.g. `brands/acme/knowledge/competitors.md`. Derived by the caller from `knowledge slots`. */
|
|
7258
|
+
path: external_exports.string().min(1).max(512),
|
|
7259
|
+
/** UTF-8 file content. Ignored when `delete` is true. */
|
|
7260
|
+
content: external_exports.string(),
|
|
7261
|
+
/** Emit as a git-level deletion instead of a content write. */
|
|
7262
|
+
delete: external_exports.boolean().optional(),
|
|
7263
|
+
/** Human-readable summary surfaced in the PR body / commit trailer. */
|
|
7264
|
+
intent: external_exports.string().max(500).optional()
|
|
7265
|
+
});
|
|
7266
|
+
KnowledgeSaveResponseSchema = external_exports.object({
|
|
7267
|
+
/** Routing outcome from `executeKnowledgeWrite`. */
|
|
7268
|
+
routed: external_exports.enum(["auto", "queued", "submitted", "rejected", "noop"]),
|
|
7269
|
+
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
7270
|
+
/** Present when a PR was opened (queued/submitted, or auto via queue-PR). */
|
|
7271
|
+
pr_url: external_exports.string().optional(),
|
|
7272
|
+
pr_number: external_exports.number().optional(),
|
|
7273
|
+
/** Present on `rejected` / `noop` — short machine-friendly reason. */
|
|
7274
|
+
reason: external_exports.string().optional()
|
|
7275
|
+
});
|
|
7276
|
+
}
|
|
7277
|
+
});
|
|
7278
|
+
|
|
7279
|
+
// ../../src/lib/api-contracts/cli/onboarding-status.ts
|
|
7280
|
+
var onboarding_status_exports = {};
|
|
7281
|
+
__export(onboarding_status_exports, {
|
|
7282
|
+
OnboardingStatusResponseSchema: () => OnboardingStatusResponseSchema
|
|
7283
|
+
});
|
|
7284
|
+
var OnboardingStatusResponseSchema;
|
|
7285
|
+
var init_onboarding_status = __esm({
|
|
7286
|
+
"../../src/lib/api-contracts/cli/onboarding-status.ts"() {
|
|
7287
|
+
init_zod();
|
|
7288
|
+
OnboardingStatusResponseSchema = external_exports.object({
|
|
7289
|
+
composite_gate: external_exports.object({
|
|
7290
|
+
passed: external_exports.boolean(),
|
|
7291
|
+
knowledge_ok: external_exports.boolean(),
|
|
7292
|
+
activation_ok: external_exports.boolean()
|
|
7293
|
+
}),
|
|
7294
|
+
health: external_exports.object({
|
|
7295
|
+
grade: external_exports.enum(["A", "B", "C", "D", "F"]).nullable(),
|
|
7296
|
+
score: external_exports.number().nullable()
|
|
7297
|
+
}),
|
|
7298
|
+
/** Raw `compute_onboarding_status` payload (shape owned by the RPC). */
|
|
7299
|
+
milestones: external_exports.unknown().nullable()
|
|
7300
|
+
});
|
|
7301
|
+
}
|
|
7302
|
+
});
|
|
7303
|
+
|
|
7150
7304
|
// src/lib/paths.ts
|
|
7151
7305
|
import { homedir } from "node:os";
|
|
7152
7306
|
import { join } from "node:path";
|
|
@@ -11980,131 +12134,69 @@ var init_agents = __esm({
|
|
|
11980
12134
|
}
|
|
11981
12135
|
});
|
|
11982
12136
|
|
|
11983
|
-
// ../../src/lib/api-contracts/cli/
|
|
11984
|
-
var
|
|
11985
|
-
var
|
|
11986
|
-
"../../src/lib/api-contracts/cli/
|
|
12137
|
+
// ../../src/lib/api-contracts/cli/context-health.ts
|
|
12138
|
+
var ScopeKindSchema, ScopeSchema, CriterionMetricsSchema, StatusSchema, CriterionContributionSchema, CriterionResultSchema, BucketScoresSchema, ResolvedScopeSchema, GapsSchema, ContextHealthResponseSchema;
|
|
12139
|
+
var init_context_health = __esm({
|
|
12140
|
+
"../../src/lib/api-contracts/cli/context-health.ts"() {
|
|
11987
12141
|
init_zod();
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
kind:
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
/**
|
|
11994
|
-
* Example workspace-relative path, derived from the server's
|
|
11995
|
-
* `resolveRepoPathByKind`. Uses `{brand}` / `{agent}` placeholders the
|
|
11996
|
-
* skill substitutes from its workspace config. `example.md` stands in
|
|
11997
|
-
* for the caller-chosen filename.
|
|
11998
|
-
*/
|
|
11999
|
-
example_path: external_exports.string(),
|
|
12000
|
-
/**
|
|
12001
|
-
* True when the filename is pinned by the server (instructions/identity)
|
|
12002
|
-
* and the caller's filename is ignored.
|
|
12003
|
-
*/
|
|
12004
|
-
filename_pinned: external_exports.boolean()
|
|
12142
|
+
ScopeKindSchema = external_exports.enum(["org", "brand", "agent"]);
|
|
12143
|
+
ScopeSchema = external_exports.object({
|
|
12144
|
+
kind: ScopeKindSchema,
|
|
12145
|
+
brandId: external_exports.string().nullish(),
|
|
12146
|
+
agentId: external_exports.string().nullish()
|
|
12005
12147
|
});
|
|
12006
|
-
|
|
12007
|
-
|
|
12008
|
-
|
|
12009
|
-
|
|
12148
|
+
CriterionMetricsSchema = external_exports.object({
|
|
12149
|
+
rowCount: external_exports.number(),
|
|
12150
|
+
totalWords: external_exports.number(),
|
|
12151
|
+
hasRecent: external_exports.boolean()
|
|
12010
12152
|
});
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
12014
|
-
|
|
12015
|
-
|
|
12016
|
-
/** The knowledge dimensions, for metadata tagging. */
|
|
12017
|
-
dimensions: external_exports.array(KnowledgeDimensionSchema)
|
|
12153
|
+
StatusSchema = external_exports.enum(["empty", "basic", "good", "deep"]);
|
|
12154
|
+
CriterionContributionSchema = external_exports.object({
|
|
12155
|
+
repo_path: external_exports.string().nullable(),
|
|
12156
|
+
points: external_exports.number(),
|
|
12157
|
+
row_id: external_exports.string()
|
|
12018
12158
|
});
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
|
|
12026
|
-
|
|
12027
|
-
|
|
12028
|
-
/** Canonical repo path, e.g. `brands/acme/knowledge/competitors.md`. Derived by the caller from `knowledge slots`. */
|
|
12029
|
-
path: external_exports.string().min(1).max(512),
|
|
12030
|
-
/** UTF-8 file content. Ignored when `delete` is true. */
|
|
12031
|
-
content: external_exports.string(),
|
|
12032
|
-
/** Emit as a git-level deletion instead of a content write. */
|
|
12033
|
-
delete: external_exports.boolean().optional(),
|
|
12034
|
-
/** Human-readable summary surfaced in the PR body / commit trailer. */
|
|
12035
|
-
intent: external_exports.string().max(500).optional()
|
|
12036
|
-
});
|
|
12037
|
-
KnowledgeSaveResponseSchema = external_exports.object({
|
|
12038
|
-
/** Routing outcome from `executeKnowledgeWrite`. */
|
|
12039
|
-
routed: external_exports.enum(["auto", "queued", "submitted", "rejected", "noop"]),
|
|
12040
|
-
classification: external_exports.enum(["self_only", "cross_scope", "forbidden"]),
|
|
12041
|
-
/** Present when a PR was opened (queued/submitted, or auto via queue-PR). */
|
|
12042
|
-
pr_url: external_exports.string().optional(),
|
|
12043
|
-
pr_number: external_exports.number().optional(),
|
|
12044
|
-
/** Present on `rejected` / `noop` — short machine-friendly reason. */
|
|
12045
|
-
reason: external_exports.string().optional()
|
|
12046
|
-
});
|
|
12047
|
-
}
|
|
12048
|
-
});
|
|
12049
|
-
|
|
12050
|
-
// ../../src/lib/api-contracts/cli/history.ts
|
|
12051
|
-
var HistoryEntrySchema, HistoryResponseSchema;
|
|
12052
|
-
var init_history = __esm({
|
|
12053
|
-
"../../src/lib/api-contracts/cli/history.ts"() {
|
|
12054
|
-
init_zod();
|
|
12055
|
-
HistoryEntrySchema = external_exports.object({
|
|
12056
|
-
tool_name: external_exports.string().nullable(),
|
|
12057
|
-
status: external_exports.string(),
|
|
12058
|
-
timestamp: external_exports.string(),
|
|
12059
|
-
duration_ms: external_exports.number().nullable()
|
|
12159
|
+
CriterionResultSchema = external_exports.object({
|
|
12160
|
+
key: external_exports.string(),
|
|
12161
|
+
status: StatusSchema,
|
|
12162
|
+
score: external_exports.number(),
|
|
12163
|
+
metrics: CriterionMetricsSchema,
|
|
12164
|
+
inheritedFrom: ScopeKindSchema.optional(),
|
|
12165
|
+
contributions: external_exports.array(CriterionContributionSchema),
|
|
12166
|
+
/** BAM-2445: category enrichment added by the tool layer. */
|
|
12167
|
+
category: external_exports.enum(["content", "hygiene"]).optional()
|
|
12060
12168
|
});
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12169
|
+
BucketScoresSchema = external_exports.object({
|
|
12170
|
+
inherited: external_exports.number().nullable(),
|
|
12171
|
+
structural: external_exports.number().nullable(),
|
|
12172
|
+
job_spec: external_exports.number().nullable()
|
|
12064
12173
|
});
|
|
12065
|
-
|
|
12066
|
-
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
|
|
12070
|
-
|
|
12071
|
-
|
|
12072
|
-
|
|
12073
|
-
|
|
12074
|
-
id: external_exports.string(),
|
|
12075
|
-
tool_name: external_exports.string().nullable(),
|
|
12076
|
-
action: external_exports.string().nullable(),
|
|
12077
|
-
entity_type: external_exports.string().nullable(),
|
|
12078
|
-
entity_id: external_exports.string().nullable(),
|
|
12079
|
-
entity_name: external_exports.string().nullable(),
|
|
12080
|
-
agent: external_exports.string().nullable(),
|
|
12081
|
-
brand_id: external_exports.string().nullable(),
|
|
12082
|
-
timestamp: external_exports.string()
|
|
12174
|
+
ResolvedScopeSchema = external_exports.object({
|
|
12175
|
+
orgId: external_exports.string(),
|
|
12176
|
+
orgName: external_exports.string(),
|
|
12177
|
+
brandId: external_exports.string().optional(),
|
|
12178
|
+
brandName: external_exports.string().optional(),
|
|
12179
|
+
brandSlug: external_exports.string().optional(),
|
|
12180
|
+
agentId: external_exports.string().optional(),
|
|
12181
|
+
agentName: external_exports.string().optional(),
|
|
12182
|
+
agentSlug: external_exports.string().optional()
|
|
12083
12183
|
});
|
|
12084
|
-
|
|
12085
|
-
|
|
12086
|
-
|
|
12184
|
+
GapsSchema = external_exports.object({
|
|
12185
|
+
/** Criterion keys that are still in "empty" status (most urgent). */
|
|
12186
|
+
empty: external_exports.array(external_exports.string()),
|
|
12187
|
+
/** Criterion keys that are at "basic" status (partially filled). */
|
|
12188
|
+
basic: external_exports.array(external_exports.string())
|
|
12087
12189
|
});
|
|
12088
|
-
|
|
12089
|
-
|
|
12090
|
-
|
|
12091
|
-
|
|
12092
|
-
|
|
12093
|
-
|
|
12094
|
-
|
|
12095
|
-
|
|
12096
|
-
|
|
12097
|
-
|
|
12098
|
-
passed: external_exports.boolean(),
|
|
12099
|
-
knowledge_ok: external_exports.boolean(),
|
|
12100
|
-
activation_ok: external_exports.boolean()
|
|
12101
|
-
}),
|
|
12102
|
-
health: external_exports.object({
|
|
12103
|
-
grade: external_exports.enum(["A", "B", "C", "D", "F"]).nullable(),
|
|
12104
|
-
score: external_exports.number().nullable()
|
|
12105
|
-
}),
|
|
12106
|
-
/** Raw `compute_onboarding_status` payload (shape owned by the RPC). */
|
|
12107
|
-
milestones: external_exports.unknown().nullable()
|
|
12190
|
+
ContextHealthResponseSchema = external_exports.object({
|
|
12191
|
+
scope: ScopeSchema,
|
|
12192
|
+
grade: external_exports.enum(["A", "B", "C", "D", "F"]),
|
|
12193
|
+
score: external_exports.number(),
|
|
12194
|
+
bucketScores: BucketScoresSchema,
|
|
12195
|
+
results: external_exports.array(CriterionResultSchema),
|
|
12196
|
+
resolvedScope: ResolvedScopeSchema.nullable(),
|
|
12197
|
+
/** Derived gap summary — pre-computed from `results` so CLI consumers
|
|
12198
|
+
* don't need to iterate the full results array. */
|
|
12199
|
+
gaps: GapsSchema
|
|
12108
12200
|
});
|
|
12109
12201
|
}
|
|
12110
12202
|
});
|
|
@@ -12213,6 +12305,16 @@ async function getChanges(bambooSession, opts = {}) {
|
|
|
12213
12305
|
if (!res.ok) throw await parseError(res);
|
|
12214
12306
|
return ChangesResponseSchema.parse(await res.json());
|
|
12215
12307
|
}
|
|
12308
|
+
async function getContextHealth(bambooSession, opts = {}) {
|
|
12309
|
+
const url = new URL(`${apiBase()}/api/v1/cli/context/health`);
|
|
12310
|
+
if (opts.brandId) url.searchParams.set("brand_id", opts.brandId);
|
|
12311
|
+
if (opts.agentId) url.searchParams.set("agent_id", opts.agentId);
|
|
12312
|
+
const res = await cliApiFetch(url.toString(), {
|
|
12313
|
+
headers: { Authorization: `Bearer ${bambooSession}` }
|
|
12314
|
+
});
|
|
12315
|
+
if (!res.ok) throw await parseError(res);
|
|
12316
|
+
return ContextHealthResponseSchema.parse(await res.json());
|
|
12317
|
+
}
|
|
12216
12318
|
async function getOnboardingStatus(bambooSession, opts = {}) {
|
|
12217
12319
|
const url = new URL(`${apiBase()}/api/v1/cli/onboarding/status`);
|
|
12218
12320
|
if (opts.brandId) url.searchParams.set("brand_id", opts.brandId);
|
|
@@ -12416,6 +12518,7 @@ var init_api = __esm({
|
|
|
12416
12518
|
init_history();
|
|
12417
12519
|
init_changes();
|
|
12418
12520
|
init_onboarding_status();
|
|
12521
|
+
init_context_health();
|
|
12419
12522
|
init_version();
|
|
12420
12523
|
PROD_DEFAULT_BASE = "https://withbamboo.com";
|
|
12421
12524
|
DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
|
|
@@ -15810,8 +15913,8 @@ var init_knowledge = __esm({
|
|
|
15810
15913
|
});
|
|
15811
15914
|
|
|
15812
15915
|
// src/commands/history.ts
|
|
15813
|
-
var
|
|
15814
|
-
__export(
|
|
15916
|
+
var history_exports2 = {};
|
|
15917
|
+
__export(history_exports2, {
|
|
15815
15918
|
runChanges: () => runChanges,
|
|
15816
15919
|
runHistory: () => runHistory
|
|
15817
15920
|
});
|
|
@@ -15899,12 +16002,77 @@ var init_history2 = __esm({
|
|
|
15899
16002
|
}
|
|
15900
16003
|
});
|
|
15901
16004
|
|
|
16005
|
+
// src/commands/context.ts
|
|
16006
|
+
var context_exports = {};
|
|
16007
|
+
__export(context_exports, {
|
|
16008
|
+
runContextHealth: () => runContextHealth
|
|
16009
|
+
});
|
|
16010
|
+
async function requireSession4() {
|
|
16011
|
+
const creds = await readCredentials();
|
|
16012
|
+
if (!creds) {
|
|
16013
|
+
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
16014
|
+
process.exit(1);
|
|
16015
|
+
}
|
|
16016
|
+
return creds.bamboo_session;
|
|
16017
|
+
}
|
|
16018
|
+
function gradeSymbol(grade) {
|
|
16019
|
+
return grade === "A" ? "\u2713" : grade === "B" || grade === "C" ? "\u2022" : "\u2717";
|
|
16020
|
+
}
|
|
16021
|
+
function printHealth(data) {
|
|
16022
|
+
const { grade, score, gaps, bucketScores, scope } = data;
|
|
16023
|
+
const scopeLabel = scope.kind === "agent" ? `agent (${scope.agentId ?? "\u2014"})` : scope.kind === "brand" ? `brand (${scope.brandId ?? "\u2014"})` : "org";
|
|
16024
|
+
console.log("");
|
|
16025
|
+
console.log(
|
|
16026
|
+
` Context health [${scopeLabel}]: ${gradeSymbol(grade)} ${grade} (score ${Math.round(score)}/100)`
|
|
16027
|
+
);
|
|
16028
|
+
const fmtBucket = (label, v) => ` ${label.padEnd(12)} ${v != null ? `${Math.round(v)}/100` : "n/a"}`;
|
|
16029
|
+
console.log(fmtBucket("inherited:", bucketScores.inherited));
|
|
16030
|
+
console.log(fmtBucket("structural:", bucketScores.structural));
|
|
16031
|
+
console.log(fmtBucket("job_spec:", bucketScores.job_spec));
|
|
16032
|
+
console.log("");
|
|
16033
|
+
if (gaps.empty.length > 0) {
|
|
16034
|
+
console.log(` Missing (empty): ${gaps.empty.join(", ")}`);
|
|
16035
|
+
}
|
|
16036
|
+
if (gaps.basic.length > 0) {
|
|
16037
|
+
console.log(` Sparse (basic): ${gaps.basic.join(", ")}`);
|
|
16038
|
+
}
|
|
16039
|
+
if (gaps.empty.length === 0 && gaps.basic.length === 0) {
|
|
16040
|
+
console.log(" No gaps \u2014 all criteria at good or deep.");
|
|
16041
|
+
}
|
|
16042
|
+
console.log("");
|
|
16043
|
+
}
|
|
16044
|
+
async function runContextHealth(options) {
|
|
16045
|
+
const session = await requireSession4();
|
|
16046
|
+
let data;
|
|
16047
|
+
try {
|
|
16048
|
+
data = await getContextHealth(session, {
|
|
16049
|
+
brandId: options.brand,
|
|
16050
|
+
agentId: options.agent
|
|
16051
|
+
});
|
|
16052
|
+
} catch (err) {
|
|
16053
|
+
console.error(`bamboo-agents: couldn't load context health: ${err.message}`);
|
|
16054
|
+
process.exit(1);
|
|
16055
|
+
}
|
|
16056
|
+
if (options.json) {
|
|
16057
|
+
console.log(JSON.stringify(data, null, 2));
|
|
16058
|
+
return;
|
|
16059
|
+
}
|
|
16060
|
+
printHealth(data);
|
|
16061
|
+
}
|
|
16062
|
+
var init_context = __esm({
|
|
16063
|
+
"src/commands/context.ts"() {
|
|
16064
|
+
"use strict";
|
|
16065
|
+
init_credentials();
|
|
16066
|
+
init_api();
|
|
16067
|
+
}
|
|
16068
|
+
});
|
|
16069
|
+
|
|
15902
16070
|
// src/commands/onboarding.ts
|
|
15903
16071
|
var onboarding_exports = {};
|
|
15904
16072
|
__export(onboarding_exports, {
|
|
15905
16073
|
runOnboardingStatus: () => runOnboardingStatus
|
|
15906
16074
|
});
|
|
15907
|
-
async function
|
|
16075
|
+
async function requireSession5() {
|
|
15908
16076
|
const creds = await readCredentials();
|
|
15909
16077
|
if (!creds) {
|
|
15910
16078
|
console.error("bamboo-agents: not signed in. Run `bamboo-agents login` first.");
|
|
@@ -15923,7 +16091,7 @@ function printStatus(data) {
|
|
|
15923
16091
|
console.log("");
|
|
15924
16092
|
}
|
|
15925
16093
|
async function runOnboardingStatus(options) {
|
|
15926
|
-
const session = await
|
|
16094
|
+
const session = await requireSession5();
|
|
15927
16095
|
let data;
|
|
15928
16096
|
try {
|
|
15929
16097
|
data = await getOnboardingStatus(session, { brandId: options.brand });
|
|
@@ -15964,8 +16132,152 @@ var {
|
|
|
15964
16132
|
|
|
15965
16133
|
// src/index.ts
|
|
15966
16134
|
init_version();
|
|
16135
|
+
|
|
16136
|
+
// src/lib/describe.ts
|
|
16137
|
+
function zodToJsonSchema(schema) {
|
|
16138
|
+
const s = schema;
|
|
16139
|
+
const typeName = s?._def?.typeName ?? "";
|
|
16140
|
+
switch (typeName) {
|
|
16141
|
+
case "ZodString":
|
|
16142
|
+
return { type: "string" };
|
|
16143
|
+
case "ZodNumber":
|
|
16144
|
+
return { type: "number" };
|
|
16145
|
+
case "ZodBoolean":
|
|
16146
|
+
return { type: "boolean" };
|
|
16147
|
+
case "ZodUnknown":
|
|
16148
|
+
case "ZodAny":
|
|
16149
|
+
return {};
|
|
16150
|
+
case "ZodEnum": {
|
|
16151
|
+
const values = s._def.values;
|
|
16152
|
+
return { type: "string", enum: values };
|
|
16153
|
+
}
|
|
16154
|
+
case "ZodLiteral":
|
|
16155
|
+
return { const: s._def.value };
|
|
16156
|
+
case "ZodNull":
|
|
16157
|
+
return { type: "null" };
|
|
16158
|
+
case "ZodNullable": {
|
|
16159
|
+
const inner = zodToJsonSchema(s._def.innerType);
|
|
16160
|
+
if (!inner) return null;
|
|
16161
|
+
return { anyOf: [inner, { type: "null" }] };
|
|
16162
|
+
}
|
|
16163
|
+
case "ZodOptional": {
|
|
16164
|
+
return zodToJsonSchema(s._def.innerType);
|
|
16165
|
+
}
|
|
16166
|
+
case "ZodArray": {
|
|
16167
|
+
const items = zodToJsonSchema(s._def.type);
|
|
16168
|
+
return items ? { type: "array", items } : { type: "array" };
|
|
16169
|
+
}
|
|
16170
|
+
case "ZodObject": {
|
|
16171
|
+
const shape = s._def.shape();
|
|
16172
|
+
const properties = {};
|
|
16173
|
+
const required = [];
|
|
16174
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
16175
|
+
const fieldSchema = zodToJsonSchema(value);
|
|
16176
|
+
if (fieldSchema !== null) {
|
|
16177
|
+
properties[key] = fieldSchema;
|
|
16178
|
+
}
|
|
16179
|
+
const fieldTypeName = value?._def?.typeName ?? "";
|
|
16180
|
+
if (fieldTypeName !== "ZodOptional") {
|
|
16181
|
+
required.push(key);
|
|
16182
|
+
}
|
|
16183
|
+
}
|
|
16184
|
+
const result = { type: "object", properties };
|
|
16185
|
+
if (required.length > 0) {
|
|
16186
|
+
result.required = required;
|
|
16187
|
+
}
|
|
16188
|
+
return result;
|
|
16189
|
+
}
|
|
16190
|
+
default:
|
|
16191
|
+
return null;
|
|
16192
|
+
}
|
|
16193
|
+
}
|
|
16194
|
+
async function loadOutputSchemas() {
|
|
16195
|
+
const map = /* @__PURE__ */ new Map();
|
|
16196
|
+
try {
|
|
16197
|
+
const [history, changes, knowledgeSlots, knowledgeSave, onboarding2] = await Promise.all([
|
|
16198
|
+
Promise.resolve().then(() => (init_history(), history_exports)).catch(() => null),
|
|
16199
|
+
Promise.resolve().then(() => (init_changes(), changes_exports)).catch(() => null),
|
|
16200
|
+
Promise.resolve().then(() => (init_knowledge_slots(), knowledge_slots_exports)).catch(() => null),
|
|
16201
|
+
Promise.resolve().then(() => (init_knowledge_save(), knowledge_save_exports)).catch(() => null),
|
|
16202
|
+
Promise.resolve().then(() => (init_onboarding_status(), onboarding_status_exports)).catch(() => null)
|
|
16203
|
+
]);
|
|
16204
|
+
if (history?.HistoryResponseSchema) {
|
|
16205
|
+
const s = zodToJsonSchema(history.HistoryResponseSchema);
|
|
16206
|
+
if (s) map.set("history", s);
|
|
16207
|
+
}
|
|
16208
|
+
if (changes?.ChangesResponseSchema) {
|
|
16209
|
+
const s = zodToJsonSchema(changes.ChangesResponseSchema);
|
|
16210
|
+
if (s) map.set("changes", s);
|
|
16211
|
+
}
|
|
16212
|
+
if (knowledgeSlots?.KnowledgeSlotsResponseSchema) {
|
|
16213
|
+
const s = zodToJsonSchema(knowledgeSlots.KnowledgeSlotsResponseSchema);
|
|
16214
|
+
if (s) map.set("knowledge slots", s);
|
|
16215
|
+
}
|
|
16216
|
+
if (knowledgeSave?.KnowledgeSaveResponseSchema) {
|
|
16217
|
+
const s = zodToJsonSchema(knowledgeSave.KnowledgeSaveResponseSchema);
|
|
16218
|
+
if (s) map.set("knowledge save", s);
|
|
16219
|
+
}
|
|
16220
|
+
if (onboarding2?.OnboardingStatusResponseSchema) {
|
|
16221
|
+
const s = zodToJsonSchema(onboarding2.OnboardingStatusResponseSchema);
|
|
16222
|
+
if (s) map.set("onboarding status", s);
|
|
16223
|
+
}
|
|
16224
|
+
} catch {
|
|
16225
|
+
}
|
|
16226
|
+
return map;
|
|
16227
|
+
}
|
|
16228
|
+
function serializeOption(opt) {
|
|
16229
|
+
const mandatory = opt.mandatory;
|
|
16230
|
+
return {
|
|
16231
|
+
flag: opt.flags,
|
|
16232
|
+
description: opt.description ?? "",
|
|
16233
|
+
required: mandatory === true,
|
|
16234
|
+
type: opt.required || opt.optional ? "string" : "boolean"
|
|
16235
|
+
};
|
|
16236
|
+
}
|
|
16237
|
+
function serializeArgument(arg) {
|
|
16238
|
+
return {
|
|
16239
|
+
name: arg.name(),
|
|
16240
|
+
description: arg.description ?? "",
|
|
16241
|
+
required: arg.required,
|
|
16242
|
+
variadic: arg.variadic
|
|
16243
|
+
};
|
|
16244
|
+
}
|
|
16245
|
+
function flattenCommands(cmd, prefix) {
|
|
16246
|
+
const results = [];
|
|
16247
|
+
for (const child of cmd.commands) {
|
|
16248
|
+
const fullName = prefix ? `${prefix} ${child.name()}` : child.name();
|
|
16249
|
+
results.push({ fullName, cmd: child });
|
|
16250
|
+
if (child.commands.length > 0) {
|
|
16251
|
+
results.push(...flattenCommands(child, fullName));
|
|
16252
|
+
}
|
|
16253
|
+
}
|
|
16254
|
+
return results;
|
|
16255
|
+
}
|
|
16256
|
+
async function buildManifest(program3, cliVersion) {
|
|
16257
|
+
const outputSchemas = await loadOutputSchemas();
|
|
16258
|
+
const flat = flattenCommands(program3, "");
|
|
16259
|
+
const commands = flat.map(({ fullName, cmd }) => ({
|
|
16260
|
+
name: fullName,
|
|
16261
|
+
description: cmd.description() ?? "",
|
|
16262
|
+
arguments: cmd.registeredArguments.map(serializeArgument),
|
|
16263
|
+
options: cmd.options.map(serializeOption),
|
|
16264
|
+
output_schema: outputSchemas.get(fullName) ?? null
|
|
16265
|
+
}));
|
|
16266
|
+
return {
|
|
16267
|
+
version: 1,
|
|
16268
|
+
cli: program3.name(),
|
|
16269
|
+
cli_version: cliVersion,
|
|
16270
|
+
commands
|
|
16271
|
+
};
|
|
16272
|
+
}
|
|
16273
|
+
async function buildCommandSchema(program3, cliVersion, commandName) {
|
|
16274
|
+
const manifest = await buildManifest(program3, cliVersion);
|
|
16275
|
+
return manifest.commands.find((c) => c.name === commandName) ?? null;
|
|
16276
|
+
}
|
|
16277
|
+
|
|
16278
|
+
// src/index.ts
|
|
15967
16279
|
var program2 = new Command();
|
|
15968
|
-
program2.name("bamboo-agents").description("Set up your local Bamboo workspace and drop into Claude.").version(VERSION).option("--no-sync", "Skip the auto-sync git pull on this command");
|
|
16280
|
+
program2.name("bamboo-agents").description("Set up your local Bamboo workspace and drop into Claude.").version(VERSION).option("--no-sync", "Skip the auto-sync git pull on this command").option("--describe", "Emit full JSON manifest of every CLI command (machine introspection)").option("--schema <command>", "Emit JSON schema for one command by name, e.g. 'history' or 'knowledge save'");
|
|
15969
16281
|
program2.action(async () => {
|
|
15970
16282
|
const { runOrchestrator: runOrchestrator2 } = await Promise.resolve().then(() => (init_orchestrator(), orchestrator_exports));
|
|
15971
16283
|
await runOrchestrator2();
|
|
@@ -16041,21 +16353,58 @@ knowledge.command("save").description("Save a knowledge file (routed write \u201
|
|
|
16041
16353
|
await runKnowledgeSave2(options);
|
|
16042
16354
|
});
|
|
16043
16355
|
program2.command("history").description("Recent workspace actions (reverse-chronological)").option("--limit <n>", "Max entries (default 20, max 100)").option("--json", "Emit raw JSON for agent consumption").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (options) => {
|
|
16044
|
-
const { runHistory: runHistory2 } = await Promise.resolve().then(() => (init_history2(),
|
|
16356
|
+
const { runHistory: runHistory2 } = await Promise.resolve().then(() => (init_history2(), history_exports2));
|
|
16045
16357
|
await runHistory2(options);
|
|
16046
16358
|
});
|
|
16047
16359
|
program2.command("changes").description("Structured change log \u2014 what was created/updated/deleted").option("--limit <n>", "Max entries (default 20, max 100)").option("--brand <id>", "Filter to one brand_id").option("--since <iso>", "Only changes at/after this ISO timestamp").option("--entity-type <type>", "Filter by entity type").option("--json", "Emit raw JSON for agent consumption").option("--no-sync", "Skip the auto-sync git pull on this command").action(
|
|
16048
16360
|
async (options) => {
|
|
16049
|
-
const { runChanges: runChanges2 } = await Promise.resolve().then(() => (init_history2(),
|
|
16361
|
+
const { runChanges: runChanges2 } = await Promise.resolve().then(() => (init_history2(), history_exports2));
|
|
16050
16362
|
await runChanges2(options);
|
|
16051
16363
|
}
|
|
16052
16364
|
);
|
|
16365
|
+
var context = program2.command("context").description("Context health for CLI-first skills");
|
|
16366
|
+
context.command("health").description("Knowledge/context health \u2014 grade, score, and gaps").option("--brand <id>", "Scope to a brand_id (default: org)").option("--agent <id>", "Scope to an agent_id").option("--json", "Emit raw JSON for agent consumption").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (options) => {
|
|
16367
|
+
const { runContextHealth: runContextHealth2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
16368
|
+
await runContextHealth2(options);
|
|
16369
|
+
});
|
|
16053
16370
|
var onboarding = program2.command("onboarding").description("Onboarding status for CLI-first skills");
|
|
16054
16371
|
onboarding.command("status").description("Composite onboarding gate (activation milestones + knowledge health)").option("--brand <id>", "Scope to a brand_id (default: org)").option("--json", "Emit raw JSON for agent consumption").option("--no-sync", "Skip the auto-sync git pull on this command").action(async (options) => {
|
|
16055
16372
|
const { runOnboardingStatus: runOnboardingStatus2 } = await Promise.resolve().then(() => (init_onboarding(), onboarding_exports));
|
|
16056
16373
|
await runOnboardingStatus2(options);
|
|
16057
16374
|
});
|
|
16058
|
-
|
|
16375
|
+
(async () => {
|
|
16376
|
+
const { operands, unknown: unknownArgs } = program2.parseOptions(
|
|
16377
|
+
process.argv.slice(2)
|
|
16378
|
+
);
|
|
16379
|
+
const rawArgs = process.argv.slice(2);
|
|
16380
|
+
const describeIdx = rawArgs.indexOf("--describe");
|
|
16381
|
+
const schemaIdx = rawArgs.indexOf("--schema");
|
|
16382
|
+
if (describeIdx !== -1) {
|
|
16383
|
+
const manifest = await buildManifest(program2, VERSION);
|
|
16384
|
+
process.stdout.write(JSON.stringify(manifest, null, 2) + "\n");
|
|
16385
|
+
process.exit(0);
|
|
16386
|
+
}
|
|
16387
|
+
if (schemaIdx !== -1) {
|
|
16388
|
+
const commandName = rawArgs[schemaIdx + 1];
|
|
16389
|
+
if (!commandName || commandName.startsWith("--")) {
|
|
16390
|
+
process.stderr.write(
|
|
16391
|
+
"bamboo-agents: --schema requires a command name, e.g. --schema history\n"
|
|
16392
|
+
);
|
|
16393
|
+
process.exit(1);
|
|
16394
|
+
}
|
|
16395
|
+
const entry = await buildCommandSchema(program2, VERSION, commandName);
|
|
16396
|
+
if (entry === null) {
|
|
16397
|
+
process.stderr.write(
|
|
16398
|
+
`bamboo-agents: unknown command '${commandName}'. Run --describe for the full list.
|
|
16399
|
+
`
|
|
16400
|
+
);
|
|
16401
|
+
process.exit(1);
|
|
16402
|
+
}
|
|
16403
|
+
process.stdout.write(JSON.stringify(entry, null, 2) + "\n");
|
|
16404
|
+
process.exit(0);
|
|
16405
|
+
}
|
|
16406
|
+
await program2.parseAsync(process.argv);
|
|
16407
|
+
})().catch((err) => {
|
|
16059
16408
|
const message = err instanceof Error ? err.message : String(err);
|
|
16060
16409
|
console.error(`bamboo-agents: ${message}`);
|
|
16061
16410
|
process.exit(1);
|