bamboo-agents 0.1.12-dev.117.3e4cbee → 0.1.12-dev.118.0f4f27c
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 +227 -44
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
package/dist/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.12-dev.
|
|
1
|
+
0.1.12-dev.118.0f4f27c
|
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.118.0f4f27c";
|
|
3041
3041
|
}
|
|
3042
3042
|
});
|
|
3043
3043
|
|
|
@@ -7755,10 +7755,14 @@ function writeStdout(line) {
|
|
|
7755
7755
|
function writeStderr(line) {
|
|
7756
7756
|
process.stderr.write(line.endsWith("\n") ? line : line + "\n");
|
|
7757
7757
|
}
|
|
7758
|
-
function emitSuccess(data, opts, renderHuman) {
|
|
7758
|
+
function emitSuccess(data, opts, renderHuman, scope) {
|
|
7759
7759
|
if (isJsonMode(opts)) {
|
|
7760
7760
|
const projected = projectFields(data, parseFields(opts.fields));
|
|
7761
|
-
const envelope = {
|
|
7761
|
+
const envelope = {
|
|
7762
|
+
ok: true,
|
|
7763
|
+
data: projected,
|
|
7764
|
+
...scope ? { scope } : {}
|
|
7765
|
+
};
|
|
7762
7766
|
writeStdout(JSON.stringify(envelope, null, 2));
|
|
7763
7767
|
return;
|
|
7764
7768
|
}
|
|
@@ -15486,6 +15490,22 @@ async function listInboxMembers(session, orgId) {
|
|
|
15486
15490
|
throw new ApiError("The Inbox member list response was malformed.", 502, "malformed_response");
|
|
15487
15491
|
}
|
|
15488
15492
|
}
|
|
15493
|
+
async function getCliOrganizationScope(session, orgId) {
|
|
15494
|
+
const res = await cliApiFetch(`${apiBase()}/api/v1/cli/org-scope`, {
|
|
15495
|
+
headers: {
|
|
15496
|
+
Authorization: `Bearer ${session}`,
|
|
15497
|
+
...orgId ? { "bamboo-active-org": orgId } : {}
|
|
15498
|
+
}
|
|
15499
|
+
});
|
|
15500
|
+
if (!res.ok) throw await parseError(res);
|
|
15501
|
+
const json = await res.json();
|
|
15502
|
+
return external_exports.object({
|
|
15503
|
+
scope: external_exports.object({
|
|
15504
|
+
effective_org_id: external_exports.string().uuid(),
|
|
15505
|
+
effective_org_name: external_exports.string()
|
|
15506
|
+
})
|
|
15507
|
+
}).parse(json).scope;
|
|
15508
|
+
}
|
|
15489
15509
|
async function callInboxManagement(session, orgId, call) {
|
|
15490
15510
|
const res = await cliApiFetch(`${apiBase()}/api/v1/inbox/manage`, {
|
|
15491
15511
|
method: "POST",
|
|
@@ -15649,7 +15669,10 @@ async function getHistory(bambooSession, opts = {}) {
|
|
|
15649
15669
|
if (opts.limit) url.searchParams.set("limit", String(opts.limit));
|
|
15650
15670
|
if (opts.source) url.searchParams.set("source", opts.source);
|
|
15651
15671
|
const res = await cliApiFetch(url.toString(), {
|
|
15652
|
-
headers: {
|
|
15672
|
+
headers: {
|
|
15673
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15674
|
+
...opts.orgId ? { "bamboo-active-org": opts.orgId } : {}
|
|
15675
|
+
}
|
|
15653
15676
|
});
|
|
15654
15677
|
if (!res.ok) throw await parseError(res);
|
|
15655
15678
|
return HistoryResponseSchema.parse(await res.json());
|
|
@@ -15661,7 +15684,10 @@ async function getChanges(bambooSession, opts = {}) {
|
|
|
15661
15684
|
if (opts.since) url.searchParams.set("since", opts.since);
|
|
15662
15685
|
if (opts.entityType) url.searchParams.set("entity_type", opts.entityType);
|
|
15663
15686
|
const res = await cliApiFetch(url.toString(), {
|
|
15664
|
-
headers: {
|
|
15687
|
+
headers: {
|
|
15688
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15689
|
+
...opts.orgId ? { "bamboo-active-org": opts.orgId } : {}
|
|
15690
|
+
}
|
|
15665
15691
|
});
|
|
15666
15692
|
if (!res.ok) throw await parseError(res);
|
|
15667
15693
|
return ChangesResponseSchema.parse(await res.json());
|
|
@@ -15671,7 +15697,10 @@ async function getContextHealth(bambooSession, opts = {}) {
|
|
|
15671
15697
|
if (opts.brandId) url.searchParams.set("brand_id", opts.brandId);
|
|
15672
15698
|
if (opts.agentId) url.searchParams.set("agent_id", opts.agentId);
|
|
15673
15699
|
const res = await cliApiFetch(url.toString(), {
|
|
15674
|
-
headers: {
|
|
15700
|
+
headers: {
|
|
15701
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15702
|
+
...opts.orgId ? { "bamboo-active-org": opts.orgId } : {}
|
|
15703
|
+
}
|
|
15675
15704
|
});
|
|
15676
15705
|
if (!res.ok) throw await parseError(res);
|
|
15677
15706
|
return ContextHealthResponseSchema.parse(await res.json());
|
|
@@ -15682,7 +15711,10 @@ async function getAgentUsage(bambooSession, opts = {}) {
|
|
|
15682
15711
|
if (opts.windowDays)
|
|
15683
15712
|
url.searchParams.set("window_days", String(opts.windowDays));
|
|
15684
15713
|
const res = await cliApiFetch(url.toString(), {
|
|
15685
|
-
headers: {
|
|
15714
|
+
headers: {
|
|
15715
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15716
|
+
...opts.orgId ? { "bamboo-active-org": opts.orgId } : {}
|
|
15717
|
+
}
|
|
15686
15718
|
});
|
|
15687
15719
|
if (!res.ok) throw await parseError(res);
|
|
15688
15720
|
return AgentUsageResponseSchema.parse(await res.json());
|
|
@@ -15691,7 +15723,10 @@ async function getOnboardingStatus(bambooSession, opts = {}) {
|
|
|
15691
15723
|
const url = new URL(`${apiBase()}/api/v1/cli/onboarding/status`);
|
|
15692
15724
|
if (opts.brandId) url.searchParams.set("brand_id", opts.brandId);
|
|
15693
15725
|
const res = await cliApiFetch(url.toString(), {
|
|
15694
|
-
headers: {
|
|
15726
|
+
headers: {
|
|
15727
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15728
|
+
...opts.orgId ? { "bamboo-active-org": opts.orgId } : {}
|
|
15729
|
+
}
|
|
15695
15730
|
});
|
|
15696
15731
|
if (!res.ok) throw await parseError(res);
|
|
15697
15732
|
return OnboardingStatusResponseSchema.parse(await res.json());
|
|
@@ -15802,10 +15837,15 @@ async function createAgentFromCli(bambooSession, body) {
|
|
|
15802
15837
|
const json = await res.json();
|
|
15803
15838
|
return CliCreateAgentResponseSchema.parse(json);
|
|
15804
15839
|
}
|
|
15805
|
-
async function getCliAgent(bambooSession, agentId) {
|
|
15840
|
+
async function getCliAgent(bambooSession, agentId, orgId) {
|
|
15806
15841
|
const res = await cliApiFetch(
|
|
15807
15842
|
`${apiBase()}/api/v1/cli/agents/${encodeURIComponent(agentId)}`,
|
|
15808
|
-
{
|
|
15843
|
+
{
|
|
15844
|
+
headers: {
|
|
15845
|
+
Authorization: `Bearer ${bambooSession}`,
|
|
15846
|
+
...orgId ? { "bamboo-active-org": orgId } : {}
|
|
15847
|
+
}
|
|
15848
|
+
}
|
|
15809
15849
|
);
|
|
15810
15850
|
if (!res.ok) throw await parseError(res);
|
|
15811
15851
|
return CliAgentGetResponseSchema.parse(await res.json());
|
|
@@ -21344,6 +21384,52 @@ var init_inbox = __esm({
|
|
|
21344
21384
|
}
|
|
21345
21385
|
});
|
|
21346
21386
|
|
|
21387
|
+
// src/lib/read-org-scope.ts
|
|
21388
|
+
async function resolveReadOrganizationScope(session, requested) {
|
|
21389
|
+
if (requested && session.startsWith("bam_live_")) {
|
|
21390
|
+
throw Object.assign(
|
|
21391
|
+
new Error(
|
|
21392
|
+
"API keys cannot select an organization. Sign in with a user session."
|
|
21393
|
+
),
|
|
21394
|
+
{
|
|
21395
|
+
code: "org_selection_unsupported"
|
|
21396
|
+
}
|
|
21397
|
+
);
|
|
21398
|
+
}
|
|
21399
|
+
const selected = requested ? await resolveOrganizationSelection(
|
|
21400
|
+
requested,
|
|
21401
|
+
() => listInboxOrganizations(session)
|
|
21402
|
+
) : null;
|
|
21403
|
+
const actual = await getCliOrganizationScope(session, selected?.id);
|
|
21404
|
+
if (selected && actual.effective_org_id.toLowerCase() !== selected.id.toLowerCase()) {
|
|
21405
|
+
throw Object.assign(
|
|
21406
|
+
new Error("The requested organization was not selected by the server."),
|
|
21407
|
+
{
|
|
21408
|
+
code: "organization_scope_mismatch"
|
|
21409
|
+
}
|
|
21410
|
+
);
|
|
21411
|
+
}
|
|
21412
|
+
return { ...actual, ...selected ? { selected_org_id: selected.id } : {} };
|
|
21413
|
+
}
|
|
21414
|
+
function printReadOrganizationScope(scope, opts) {
|
|
21415
|
+
human(
|
|
21416
|
+
` Organization: ${scope.effective_org_name} (${scope.effective_org_id})`,
|
|
21417
|
+
opts
|
|
21418
|
+
);
|
|
21419
|
+
}
|
|
21420
|
+
function readScopeErrorCode(error, fallback2) {
|
|
21421
|
+
const code = error?.code;
|
|
21422
|
+
return typeof code === "string" ? code : fallback2;
|
|
21423
|
+
}
|
|
21424
|
+
var init_read_org_scope = __esm({
|
|
21425
|
+
"src/lib/read-org-scope.ts"() {
|
|
21426
|
+
"use strict";
|
|
21427
|
+
init_api();
|
|
21428
|
+
init_organization_selection();
|
|
21429
|
+
init_output();
|
|
21430
|
+
}
|
|
21431
|
+
});
|
|
21432
|
+
|
|
21347
21433
|
// src/commands/history.ts
|
|
21348
21434
|
var history_exports2 = {};
|
|
21349
21435
|
__export(history_exports2, {
|
|
@@ -21379,7 +21465,10 @@ function printHistory(data, opts) {
|
|
|
21379
21465
|
human(" No recent actions.", opts);
|
|
21380
21466
|
return;
|
|
21381
21467
|
}
|
|
21382
|
-
const nameW = Math.max(
|
|
21468
|
+
const nameW = Math.max(
|
|
21469
|
+
4,
|
|
21470
|
+
...data.entries.map((e) => (e.tool_name ?? "\u2014").length)
|
|
21471
|
+
);
|
|
21383
21472
|
for (const e of data.entries) {
|
|
21384
21473
|
const dur = e.duration_ms != null ? `${e.duration_ms}ms` : "";
|
|
21385
21474
|
human(
|
|
@@ -21393,20 +21482,34 @@ async function runHistory(options) {
|
|
|
21393
21482
|
const opts = options;
|
|
21394
21483
|
const session = await requireSession5(opts);
|
|
21395
21484
|
let data;
|
|
21485
|
+
let scope;
|
|
21396
21486
|
try {
|
|
21487
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
21397
21488
|
data = await getHistory(session, {
|
|
21398
21489
|
limit: parseLimit(options.limit),
|
|
21399
|
-
source: options.source
|
|
21490
|
+
source: options.source,
|
|
21491
|
+
orgId: scope.selected_org_id
|
|
21400
21492
|
});
|
|
21401
21493
|
} catch (err) {
|
|
21402
21494
|
emitError(
|
|
21403
|
-
{
|
|
21495
|
+
{
|
|
21496
|
+
code: readScopeErrorCode(err, "history_failed"),
|
|
21497
|
+
message: `couldn't load history: ${err.message}`
|
|
21498
|
+
},
|
|
21404
21499
|
opts,
|
|
21405
21500
|
1
|
|
21406
21501
|
);
|
|
21407
21502
|
return;
|
|
21408
21503
|
}
|
|
21409
|
-
emitSuccess(
|
|
21504
|
+
emitSuccess(
|
|
21505
|
+
data,
|
|
21506
|
+
opts,
|
|
21507
|
+
(d) => {
|
|
21508
|
+
printReadOrganizationScope(scope, opts);
|
|
21509
|
+
printHistory(d, opts);
|
|
21510
|
+
},
|
|
21511
|
+
scope
|
|
21512
|
+
);
|
|
21410
21513
|
}
|
|
21411
21514
|
function printChanges(data, opts) {
|
|
21412
21515
|
if (data.entries.length === 0) {
|
|
@@ -21423,27 +21526,42 @@ async function runChanges(options) {
|
|
|
21423
21526
|
const opts = options;
|
|
21424
21527
|
const session = await requireSession5(opts);
|
|
21425
21528
|
let data;
|
|
21529
|
+
let scope;
|
|
21426
21530
|
try {
|
|
21531
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
21427
21532
|
data = await getChanges(session, {
|
|
21428
21533
|
limit: parseLimit(options.limit),
|
|
21429
21534
|
brandId: options.brand,
|
|
21430
21535
|
since: options.since,
|
|
21431
|
-
entityType: options.entityType
|
|
21536
|
+
entityType: options.entityType,
|
|
21537
|
+
orgId: scope.selected_org_id
|
|
21432
21538
|
});
|
|
21433
21539
|
} catch (err) {
|
|
21434
21540
|
emitError(
|
|
21435
|
-
{
|
|
21541
|
+
{
|
|
21542
|
+
code: readScopeErrorCode(err, "changes_failed"),
|
|
21543
|
+
message: `couldn't load changes: ${err.message}`
|
|
21544
|
+
},
|
|
21436
21545
|
opts,
|
|
21437
21546
|
1
|
|
21438
21547
|
);
|
|
21439
21548
|
return;
|
|
21440
21549
|
}
|
|
21441
|
-
emitSuccess(
|
|
21550
|
+
emitSuccess(
|
|
21551
|
+
data,
|
|
21552
|
+
opts,
|
|
21553
|
+
(d) => {
|
|
21554
|
+
printReadOrganizationScope(scope, opts);
|
|
21555
|
+
printChanges(d, opts);
|
|
21556
|
+
},
|
|
21557
|
+
scope
|
|
21558
|
+
);
|
|
21442
21559
|
}
|
|
21443
21560
|
var init_history2 = __esm({
|
|
21444
21561
|
"src/commands/history.ts"() {
|
|
21445
21562
|
"use strict";
|
|
21446
21563
|
init_credentials();
|
|
21564
|
+
init_read_org_scope();
|
|
21447
21565
|
init_api();
|
|
21448
21566
|
init_output();
|
|
21449
21567
|
}
|
|
@@ -21511,15 +21629,18 @@ async function runContextHealth(options) {
|
|
|
21511
21629
|
const opts = options;
|
|
21512
21630
|
const session = await requireSession6(opts);
|
|
21513
21631
|
let data;
|
|
21632
|
+
let scope;
|
|
21514
21633
|
try {
|
|
21634
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
21515
21635
|
data = await getContextHealth(session, {
|
|
21516
21636
|
brandId: options.brand,
|
|
21517
|
-
agentId: options.agent
|
|
21637
|
+
agentId: options.agent,
|
|
21638
|
+
orgId: scope.selected_org_id
|
|
21518
21639
|
});
|
|
21519
21640
|
} catch (err) {
|
|
21520
21641
|
emitError(
|
|
21521
21642
|
{
|
|
21522
|
-
code: "context_health_failed",
|
|
21643
|
+
code: readScopeErrorCode(err, "context_health_failed"),
|
|
21523
21644
|
message: `couldn't load context health: ${err.message}`
|
|
21524
21645
|
},
|
|
21525
21646
|
opts,
|
|
@@ -21527,12 +21648,25 @@ async function runContextHealth(options) {
|
|
|
21527
21648
|
);
|
|
21528
21649
|
return;
|
|
21529
21650
|
}
|
|
21530
|
-
emitSuccess(
|
|
21651
|
+
emitSuccess(
|
|
21652
|
+
data,
|
|
21653
|
+
opts,
|
|
21654
|
+
(d) => {
|
|
21655
|
+
printReadOrganizationScope(scope, opts);
|
|
21656
|
+
if (d.available && d.scope.kind === "org" && d.results.length > 0 && d.results.every((r) => r.status === "empty")) {
|
|
21657
|
+
human(" This organization has no context yet.", opts);
|
|
21658
|
+
return;
|
|
21659
|
+
}
|
|
21660
|
+
printHealthResponse(d, opts);
|
|
21661
|
+
},
|
|
21662
|
+
scope
|
|
21663
|
+
);
|
|
21531
21664
|
}
|
|
21532
21665
|
var init_context = __esm({
|
|
21533
21666
|
"src/commands/context.ts"() {
|
|
21534
21667
|
"use strict";
|
|
21535
21668
|
init_credentials();
|
|
21669
|
+
init_read_org_scope();
|
|
21536
21670
|
init_api();
|
|
21537
21671
|
init_output();
|
|
21538
21672
|
}
|
|
@@ -21572,7 +21706,10 @@ function printUsage(data, opts) {
|
|
|
21572
21706
|
" attributed here and won't count \u2014 a real zero here doesn't rule out activity.",
|
|
21573
21707
|
opts
|
|
21574
21708
|
);
|
|
21575
|
-
human(
|
|
21709
|
+
human(
|
|
21710
|
+
" Cross-check with the org-wide read (no --agent) if this looks too quiet.",
|
|
21711
|
+
opts
|
|
21712
|
+
);
|
|
21576
21713
|
}
|
|
21577
21714
|
if (!data.hasActivity) {
|
|
21578
21715
|
human(" No activity in this window.", opts);
|
|
@@ -21605,7 +21742,10 @@ async function runUsage(options) {
|
|
|
21605
21742
|
const parsed = Number(options.windowDays);
|
|
21606
21743
|
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
21607
21744
|
emitError(
|
|
21608
|
-
{
|
|
21745
|
+
{
|
|
21746
|
+
code: "invalid_window_days",
|
|
21747
|
+
message: "--window-days must be a positive number."
|
|
21748
|
+
},
|
|
21609
21749
|
opts,
|
|
21610
21750
|
1
|
|
21611
21751
|
);
|
|
@@ -21614,22 +21754,40 @@ async function runUsage(options) {
|
|
|
21614
21754
|
windowDays = parsed;
|
|
21615
21755
|
}
|
|
21616
21756
|
let data;
|
|
21757
|
+
let scope;
|
|
21617
21758
|
try {
|
|
21618
|
-
|
|
21759
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
21760
|
+
data = await getAgentUsage(session, {
|
|
21761
|
+
agentId: options.agent,
|
|
21762
|
+
windowDays,
|
|
21763
|
+
orgId: scope.selected_org_id
|
|
21764
|
+
});
|
|
21619
21765
|
} catch (err) {
|
|
21620
21766
|
emitError(
|
|
21621
|
-
{
|
|
21767
|
+
{
|
|
21768
|
+
code: readScopeErrorCode(err, "usage_read_failed"),
|
|
21769
|
+
message: `couldn't load usage: ${err.message}`
|
|
21770
|
+
},
|
|
21622
21771
|
opts,
|
|
21623
21772
|
1
|
|
21624
21773
|
);
|
|
21625
21774
|
return;
|
|
21626
21775
|
}
|
|
21627
|
-
emitSuccess(
|
|
21776
|
+
emitSuccess(
|
|
21777
|
+
data,
|
|
21778
|
+
opts,
|
|
21779
|
+
(d) => {
|
|
21780
|
+
printReadOrganizationScope(scope, opts);
|
|
21781
|
+
printUsage(d, opts);
|
|
21782
|
+
},
|
|
21783
|
+
scope
|
|
21784
|
+
);
|
|
21628
21785
|
}
|
|
21629
21786
|
var init_usage2 = __esm({
|
|
21630
21787
|
"src/commands/usage.ts"() {
|
|
21631
21788
|
"use strict";
|
|
21632
21789
|
init_credentials();
|
|
21790
|
+
init_read_org_scope();
|
|
21633
21791
|
init_api();
|
|
21634
21792
|
init_output();
|
|
21635
21793
|
}
|
|
@@ -21671,12 +21829,17 @@ async function runOnboardingStatus(options) {
|
|
|
21671
21829
|
const opts = options;
|
|
21672
21830
|
const session = await requireSession8(opts);
|
|
21673
21831
|
let data;
|
|
21832
|
+
let scope;
|
|
21674
21833
|
try {
|
|
21675
|
-
|
|
21834
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
21835
|
+
data = await getOnboardingStatus(session, {
|
|
21836
|
+
brandId: options.brand,
|
|
21837
|
+
orgId: scope.selected_org_id
|
|
21838
|
+
});
|
|
21676
21839
|
} catch (err) {
|
|
21677
21840
|
emitError(
|
|
21678
21841
|
{
|
|
21679
|
-
code: "onboarding_status_failed",
|
|
21842
|
+
code: readScopeErrorCode(err, "onboarding_status_failed"),
|
|
21680
21843
|
message: `couldn't load onboarding status: ${err.message}`
|
|
21681
21844
|
},
|
|
21682
21845
|
opts,
|
|
@@ -21684,12 +21847,21 @@ async function runOnboardingStatus(options) {
|
|
|
21684
21847
|
);
|
|
21685
21848
|
return;
|
|
21686
21849
|
}
|
|
21687
|
-
emitSuccess(
|
|
21850
|
+
emitSuccess(
|
|
21851
|
+
data,
|
|
21852
|
+
opts,
|
|
21853
|
+
(d) => {
|
|
21854
|
+
printReadOrganizationScope(scope, opts);
|
|
21855
|
+
printStatus(d, opts);
|
|
21856
|
+
},
|
|
21857
|
+
scope
|
|
21858
|
+
);
|
|
21688
21859
|
}
|
|
21689
21860
|
var init_onboarding = __esm({
|
|
21690
21861
|
"src/commands/onboarding.ts"() {
|
|
21691
21862
|
"use strict";
|
|
21692
21863
|
init_credentials();
|
|
21864
|
+
init_read_org_scope();
|
|
21693
21865
|
init_api();
|
|
21694
21866
|
init_output();
|
|
21695
21867
|
}
|
|
@@ -21827,11 +21999,11 @@ async function requireSession10(opts) {
|
|
|
21827
21999
|
function padRight4(s, n) {
|
|
21828
22000
|
return s.length >= n ? s : s + " ".repeat(n - s.length);
|
|
21829
22001
|
}
|
|
21830
|
-
async function resolveAgentRef(session, rawRef, opts) {
|
|
22002
|
+
async function resolveAgentRef(session, rawRef, opts, orgId) {
|
|
21831
22003
|
const ref = rawRef.trim();
|
|
21832
22004
|
let list;
|
|
21833
22005
|
try {
|
|
21834
|
-
list = await listCliAgents(session);
|
|
22006
|
+
list = await listCliAgents(session, orgId);
|
|
21835
22007
|
} catch (err) {
|
|
21836
22008
|
emitError(
|
|
21837
22009
|
{
|
|
@@ -21897,17 +22069,22 @@ async function runAgentsList(options) {
|
|
|
21897
22069
|
const opts = options;
|
|
21898
22070
|
const session = await requireSession10(opts);
|
|
21899
22071
|
let data;
|
|
22072
|
+
let scope;
|
|
21900
22073
|
try {
|
|
21901
|
-
|
|
22074
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
22075
|
+
data = await listCliAgents(session, scope.selected_org_id);
|
|
21902
22076
|
} catch (err) {
|
|
21903
22077
|
emitError(
|
|
21904
|
-
{ code: "agents_list_failed", message: `couldn't list agents: ${err.message}` },
|
|
22078
|
+
{ code: readScopeErrorCode(err, "agents_list_failed"), message: `couldn't list agents: ${err.message}` },
|
|
21905
22079
|
opts,
|
|
21906
22080
|
1
|
|
21907
22081
|
);
|
|
21908
22082
|
return;
|
|
21909
22083
|
}
|
|
21910
|
-
emitSuccess(data, opts, (d) =>
|
|
22084
|
+
emitSuccess(data, opts, (d) => {
|
|
22085
|
+
printReadOrganizationScope(scope, opts);
|
|
22086
|
+
printList(d, opts);
|
|
22087
|
+
}, scope);
|
|
21911
22088
|
}
|
|
21912
22089
|
function printDetail(agent, opts) {
|
|
21913
22090
|
human(` ${agent.name} (${agent.id})`, opts);
|
|
@@ -21923,19 +22100,24 @@ function printDetail(agent, opts) {
|
|
|
21923
22100
|
async function runAgentsGet(agentRef, options) {
|
|
21924
22101
|
const opts = options;
|
|
21925
22102
|
const session = await requireSession10(opts);
|
|
21926
|
-
const row = await resolveAgentRef(session, agentRef, opts);
|
|
21927
22103
|
let agent;
|
|
22104
|
+
let scope;
|
|
21928
22105
|
try {
|
|
21929
|
-
|
|
22106
|
+
scope = await resolveReadOrganizationScope(session, options.org);
|
|
22107
|
+
const row = await resolveAgentRef(session, agentRef, opts, scope.selected_org_id);
|
|
22108
|
+
agent = (await getCliAgent(session, row.id, scope.selected_org_id)).agent;
|
|
21930
22109
|
} catch (err) {
|
|
21931
22110
|
emitError(
|
|
21932
|
-
{ code: "agent_get_failed", message: `couldn't load agent: ${err.message}` },
|
|
22111
|
+
{ code: readScopeErrorCode(err, "agent_get_failed"), message: `couldn't load agent: ${err.message}` },
|
|
21933
22112
|
opts,
|
|
21934
22113
|
1
|
|
21935
22114
|
);
|
|
21936
22115
|
return;
|
|
21937
22116
|
}
|
|
21938
|
-
emitSuccess(agent, opts, (a) =>
|
|
22117
|
+
emitSuccess(agent, opts, (a) => {
|
|
22118
|
+
printReadOrganizationScope(scope, opts);
|
|
22119
|
+
printDetail(a, opts);
|
|
22120
|
+
}, scope);
|
|
21939
22121
|
}
|
|
21940
22122
|
async function runAgentsProvision(name, options) {
|
|
21941
22123
|
const opts = options;
|
|
@@ -22150,6 +22332,7 @@ var init_agents2 = __esm({
|
|
|
22150
22332
|
"src/commands/agents.ts"() {
|
|
22151
22333
|
"use strict";
|
|
22152
22334
|
init_credentials();
|
|
22335
|
+
init_read_org_scope();
|
|
22153
22336
|
init_resolve_brand();
|
|
22154
22337
|
init_api();
|
|
22155
22338
|
init_output();
|
|
@@ -23356,32 +23539,32 @@ inbox.command("apply-revision").description("Commit revised file content to a pe
|
|
|
23356
23539
|
const { runInboxApplyRevision: runInboxApplyRevision2 } = await Promise.resolve().then(() => (init_inbox(), inbox_exports));
|
|
23357
23540
|
await runInboxApplyRevision2(options);
|
|
23358
23541
|
});
|
|
23359
|
-
program2.command("history").description("Recent workspace actions (reverse-chronological)").option("--limit <n>", "Max entries (default 20, max 100)").option(
|
|
23542
|
+
program2.command("history").description("Recent workspace actions (reverse-chronological)").option("--org <org>", "Read one organization (UUID or unique name)").option("--limit <n>", "Max entries (default 20, max 100)").option(
|
|
23360
23543
|
"--source <runtime>",
|
|
23361
23544
|
"Filter by runtime origin (boo | sandbox-boo | managed-agent)"
|
|
23362
23545
|
).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 (options) => {
|
|
23363
23546
|
const { runHistory: runHistory2 } = await Promise.resolve().then(() => (init_history2(), history_exports2));
|
|
23364
23547
|
await runHistory2(options);
|
|
23365
23548
|
});
|
|
23366
|
-
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 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(
|
|
23549
|
+
program2.command("changes").description("Structured change log \u2014 what was created/updated/deleted").option("--org <org>", "Read one organization (UUID or unique name)").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 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(
|
|
23367
23550
|
async (options) => {
|
|
23368
23551
|
const { runChanges: runChanges2 } = await Promise.resolve().then(() => (init_history2(), history_exports2));
|
|
23369
23552
|
await runChanges2(options);
|
|
23370
23553
|
}
|
|
23371
23554
|
);
|
|
23372
23555
|
var context = program2.command("context").description("Context health for CLI-first skills");
|
|
23373
|
-
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 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 (options) => {
|
|
23556
|
+
context.command("health").description("Knowledge/context health \u2014 grade, score, and gaps").option("--org <org>", "Read one organization (UUID or unique name)").option("--brand <id>", "Scope to a brand_id (default: org)").option("--agent <id>", "Scope to an agent_id").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 (options) => {
|
|
23374
23557
|
const { runContextHealth: runContextHealth2 } = await Promise.resolve().then(() => (init_context(), context_exports));
|
|
23375
23558
|
await runContextHealth2(options);
|
|
23376
23559
|
});
|
|
23377
|
-
program2.command("usage").description("Agent usage \u2014 sessions, per-tool call counts, first/last seen (from agent_logs)").option("--agent <id>", "Scope to an agent_id (default: org-wide)").option("--window-days <n>", "Trailing window in days (default: 14, max: 90)").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(
|
|
23560
|
+
program2.command("usage").description("Agent usage \u2014 sessions, per-tool call counts, first/last seen (from agent_logs)").option("--org <org>", "Read one organization (UUID or unique name)").option("--agent <id>", "Scope to an agent_id (default: org-wide)").option("--window-days <n>", "Trailing window in days (default: 14, max: 90)").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(
|
|
23378
23561
|
async (options) => {
|
|
23379
23562
|
const { runUsage: runUsage2 } = await Promise.resolve().then(() => (init_usage2(), usage_exports));
|
|
23380
23563
|
await runUsage2(options);
|
|
23381
23564
|
}
|
|
23382
23565
|
);
|
|
23383
23566
|
var onboarding = program2.command("onboarding").description("Onboarding status for CLI-first skills");
|
|
23384
|
-
onboarding.command("status").description("Composite onboarding gate (activation milestones + knowledge health)").option("--brand <id>", "Scope to a brand_id (default: org)").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 (options) => {
|
|
23567
|
+
onboarding.command("status").description("Composite onboarding gate (activation milestones + knowledge health)").option("--org <org>", "Read one organization (UUID or unique name)").option("--brand <id>", "Scope to a brand_id (default: org)").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 (options) => {
|
|
23385
23568
|
const { runOnboardingStatus: runOnboardingStatus2 } = await Promise.resolve().then(() => (init_onboarding(), onboarding_exports));
|
|
23386
23569
|
await runOnboardingStatus2(options);
|
|
23387
23570
|
});
|
|
@@ -23400,11 +23583,11 @@ brandEditor.command("remove <brand-id> <user-id>").description("Revoke a user's
|
|
|
23400
23583
|
await runBrandEditor2("remove", brandId, userId, options);
|
|
23401
23584
|
});
|
|
23402
23585
|
var agents = program2.command("agents").description("Manage agents \u2014 list, get, provision, activate, pause");
|
|
23403
|
-
agents.command("list").description("List agents with their lifecycle state").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 (options) => {
|
|
23586
|
+
agents.command("list").description("List agents with their lifecycle state").option("--org <org>", "Read one organization (UUID or unique name)").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 (options) => {
|
|
23404
23587
|
const { runAgentsList: runAgentsList2 } = await Promise.resolve().then(() => (init_agents2(), agents_exports2));
|
|
23405
23588
|
await runAgentsList2(options);
|
|
23406
23589
|
});
|
|
23407
|
-
agents.command("get <agent>").description("Show one agent's full config (accepts id, slug, or name)").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 (agent, options) => {
|
|
23590
|
+
agents.command("get <agent>").description("Show one agent's full config (accepts id, slug, or name)").option("--org <org>", "Read one organization (UUID or unique name)").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 (agent, options) => {
|
|
23408
23591
|
const { runAgentsGet: runAgentsGet2 } = await Promise.resolve().then(() => (init_agents2(), agents_exports2));
|
|
23409
23592
|
await runAgentsGet2(agent, options);
|
|
23410
23593
|
});
|