@dam-agents/cli 0.2.11 → 0.2.12
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/bin.js +57 -300
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -26767,7 +26767,11 @@ var skillRefSchema = external_exports.object({
|
|
|
26767
26767
|
var localSkillSchema = external_exports.object({
|
|
26768
26768
|
name: external_exports.string(),
|
|
26769
26769
|
description: external_exports.string(),
|
|
26770
|
-
skillPath: external_exports.string()
|
|
26770
|
+
skillPath: external_exports.string(),
|
|
26771
|
+
/** Provenance vs. the image's pristine copy: shipped untouched, shipped
|
|
26772
|
+
* but diverged, or created at runtime. Absent on pre-provenance pods —
|
|
26773
|
+
* treat as `user`. */
|
|
26774
|
+
origin: external_exports.enum(["system", "system-modified", "user"]).optional()
|
|
26771
26775
|
});
|
|
26772
26776
|
var skillPublishRecordSchema = external_exports.object({
|
|
26773
26777
|
skillName: external_exports.string(),
|
|
@@ -26829,6 +26833,24 @@ var skillListLocalInputSchema = external_exports.object({
|
|
|
26829
26833
|
var skillStateInputSchema = external_exports.object({
|
|
26830
26834
|
agentId: external_exports.string().min(1)
|
|
26831
26835
|
});
|
|
26836
|
+
var skillDeleteLocalInputSchema = external_exports.object({
|
|
26837
|
+
agentId: external_exports.string().min(1),
|
|
26838
|
+
name: external_exports.string().min(1)
|
|
26839
|
+
});
|
|
26840
|
+
var skillReadLocalInputSchema = external_exports.object({
|
|
26841
|
+
agentId: external_exports.string().min(1),
|
|
26842
|
+
name: external_exports.string().min(1)
|
|
26843
|
+
});
|
|
26844
|
+
var skillLocalFilesSchema = external_exports.object({
|
|
26845
|
+
dir: external_exports.string(),
|
|
26846
|
+
files: external_exports.array(
|
|
26847
|
+
external_exports.object({
|
|
26848
|
+
relPath: external_exports.string(),
|
|
26849
|
+
content: external_exports.string(),
|
|
26850
|
+
base64: external_exports.literal(true).optional()
|
|
26851
|
+
})
|
|
26852
|
+
)
|
|
26853
|
+
});
|
|
26832
26854
|
var skillPublishInputSchema = external_exports.object({
|
|
26833
26855
|
agentId: external_exports.string().min(1),
|
|
26834
26856
|
sourceId: external_exports.string().min(1),
|
|
@@ -26897,6 +26919,10 @@ var templateSpecSchema = external_exports.object({
|
|
|
26897
26919
|
// explicit choice at create time still wins over this.
|
|
26898
26920
|
hibernationTimeout: external_exports.string().optional(),
|
|
26899
26921
|
storageSize: external_exports.string().optional(),
|
|
26922
|
+
backend: external_exports.object({
|
|
26923
|
+
type: external_exports.enum(["container", "vm"]),
|
|
26924
|
+
vm: external_exports.object({}).passthrough().optional()
|
|
26925
|
+
}).optional(),
|
|
26900
26926
|
runtimeClassName: external_exports.string().optional(),
|
|
26901
26927
|
nodeSelector: external_exports.record(external_exports.string(), external_exports.string()).optional(),
|
|
26902
26928
|
skillSources: external_exports.array(skillSourceSeedSchema).optional()
|
|
@@ -27010,7 +27036,10 @@ var skillPublishInputSchema2 = external_exports.object({
|
|
|
27010
27036
|
// subdir source's own scan finds what was published back to it.
|
|
27011
27037
|
path: external_exports.string().optional()
|
|
27012
27038
|
});
|
|
27013
|
-
var
|
|
27039
|
+
var skillReadLocalInputSchema2 = external_exports.object({
|
|
27040
|
+
name: external_exports.string().min(1)
|
|
27041
|
+
});
|
|
27042
|
+
var skillDeleteLocalInputSchema2 = external_exports.object({
|
|
27014
27043
|
name: external_exports.string().min(1)
|
|
27015
27044
|
});
|
|
27016
27045
|
var skillWriteLocalInputSchema = external_exports.object({
|
|
@@ -27361,7 +27390,6 @@ var agentCreateInputSchema = external_exports.object({
|
|
|
27361
27390
|
username: external_exports.string().min(1),
|
|
27362
27391
|
password: external_exports.string().min(1)
|
|
27363
27392
|
}).optional(),
|
|
27364
|
-
allowedUserEmails: external_exports.array(external_exports.email()).optional(),
|
|
27365
27393
|
egressPreset: egressPresetSchema.optional(),
|
|
27366
27394
|
// Per-agent idle timeout override in minutes (0 = never hibernate); omit to inherit the global default.
|
|
27367
27395
|
hibernationTimeoutMin: external_exports.number().int().min(0).optional(),
|
|
@@ -27404,7 +27432,6 @@ var agentUpdateInputSchema = external_exports.object({
|
|
|
27404
27432
|
description: external_exports.string().optional(),
|
|
27405
27433
|
env: external_exports.array(envVarSchema).max(64).optional(),
|
|
27406
27434
|
secretRef: external_exports.string().optional(),
|
|
27407
|
-
allowedUserEmails: external_exports.array(external_exports.email()).optional(),
|
|
27408
27435
|
// Per-agent idle timeout override in minutes (0 = never hibernate); null clears it back to the global default.
|
|
27409
27436
|
hibernationTimeoutMin: external_exports.number().int().min(0).nullable().optional(),
|
|
27410
27437
|
// Resize (#1900). On a sleeping sandbox the new Size rides the next start
|
|
@@ -27415,14 +27442,8 @@ var agentUpdateInputSchema = external_exports.object({
|
|
|
27415
27442
|
var agentConnectSlackInputSchema = external_exports.object({
|
|
27416
27443
|
id: external_exports.string().min(1),
|
|
27417
27444
|
slackChannelId: external_exports.string().min(1),
|
|
27418
|
-
//
|
|
27419
|
-
mode: external_exports.enum(["shared", "person-scoped"]).optional(),
|
|
27420
|
-
// Ambient mode; absent = off. Unlike mode it is mutable: re-connecting
|
|
27421
|
-
// with the same mode updates it in place.
|
|
27445
|
+
// Ambient mode; absent = off. Mutable: re-connecting updates it in place.
|
|
27422
27446
|
ambient: external_exports.boolean().optional()
|
|
27423
|
-
}).refine((v2) => !v2.ambient || v2.mode === "shared", {
|
|
27424
|
-
message: "Ambient mode requires a shared binding",
|
|
27425
|
-
path: ["ambient"]
|
|
27426
27447
|
});
|
|
27427
27448
|
var agentListTelegramChatsInputSchema = external_exports.object({
|
|
27428
27449
|
agentId: external_exports.string().min(1)
|
|
@@ -27730,7 +27751,7 @@ var folderUpdateInputSchema = external_exports.object({
|
|
|
27730
27751
|
var folderIdInputSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
27731
27752
|
|
|
27732
27753
|
// ../api-server-api/src/modules/features/schemas.ts
|
|
27733
|
-
var featureIdSchema = external_exports.enum(["advanced-connections"]);
|
|
27754
|
+
var featureIdSchema = external_exports.enum(["advanced-connections", "vm-sandboxes"]);
|
|
27734
27755
|
var featureSetFlagInputSchema = external_exports.object({
|
|
27735
27756
|
feature: featureIdSchema,
|
|
27736
27757
|
enabled: external_exports.boolean()
|
|
@@ -33883,10 +33904,6 @@ function renderAgent(agent) {
|
|
|
33883
33904
|
];
|
|
33884
33905
|
if (agent.description) entries.push(["DESCRIPTION", agent.description]);
|
|
33885
33906
|
entries.push(["CHANNELS", renderChannels(agent.channels)]);
|
|
33886
|
-
entries.push([
|
|
33887
|
-
"ALLOWED",
|
|
33888
|
-
agent.allowedUserEmails.length === 0 ? "<none>" : agent.allowedUserEmails.join(", ")
|
|
33889
|
-
]);
|
|
33890
33907
|
if (agent.state === "error" && agent.error)
|
|
33891
33908
|
entries.push(["ERROR", agent.error]);
|
|
33892
33909
|
const pad = Math.max(...entries.map(([k2]) => k2.length)) + 2;
|
|
@@ -34149,24 +34166,6 @@ function createAgentService(deps) {
|
|
|
34149
34166
|
} catch (e2) {
|
|
34150
34167
|
return notFoundOnMutate(e2, id);
|
|
34151
34168
|
}
|
|
34152
|
-
},
|
|
34153
|
-
async updateAllowedUserEmails(id, emails) {
|
|
34154
|
-
try {
|
|
34155
|
-
return ok2(
|
|
34156
|
-
await deps.trpc.agents.update.mutate({
|
|
34157
|
-
id,
|
|
34158
|
-
allowedUserEmails: [...emails]
|
|
34159
|
-
})
|
|
34160
|
-
);
|
|
34161
|
-
} catch (e2) {
|
|
34162
|
-
if (e2?.data?.code === "BAD_REQUEST") {
|
|
34163
|
-
return err2({
|
|
34164
|
-
kind: "invalid-input",
|
|
34165
|
-
message: e2 instanceof Error ? e2.message : String(e2)
|
|
34166
|
-
});
|
|
34167
|
-
}
|
|
34168
|
-
return notFoundOnMutate(e2, id);
|
|
34169
|
-
}
|
|
34170
34169
|
}
|
|
34171
34170
|
};
|
|
34172
34171
|
}
|
|
@@ -34330,20 +34329,6 @@ function buildDenyCommand(deps) {
|
|
|
34330
34329
|
);
|
|
34331
34330
|
}
|
|
34332
34331
|
|
|
34333
|
-
// src/modules/agent/domain/allowed-users.ts
|
|
34334
|
-
function mergeAllowedUserEmails(current, opts) {
|
|
34335
|
-
const removeSet = new Set((opts.remove ?? []).map((e2) => e2.toLowerCase()));
|
|
34336
|
-
const seen = /* @__PURE__ */ new Set();
|
|
34337
|
-
const result = [];
|
|
34338
|
-
for (const email3 of [...current, ...opts.add ?? []]) {
|
|
34339
|
-
const key = email3.toLowerCase();
|
|
34340
|
-
if (removeSet.has(key) || seen.has(key)) continue;
|
|
34341
|
-
seen.add(key);
|
|
34342
|
-
result.push(email3);
|
|
34343
|
-
}
|
|
34344
|
-
return result;
|
|
34345
|
-
}
|
|
34346
|
-
|
|
34347
34332
|
// src/modules/shared/relative-time.ts
|
|
34348
34333
|
var MINUTE_MS = 6e4;
|
|
34349
34334
|
var HOUR_MS = 36e5;
|
|
@@ -37420,94 +37405,6 @@ function composeAuthModule(opts) {
|
|
|
37420
37405
|
};
|
|
37421
37406
|
}
|
|
37422
37407
|
|
|
37423
|
-
// src/modules/channel/commands/allow.ts
|
|
37424
|
-
var collect = (v2, acc) => [...acc, v2];
|
|
37425
|
-
var emailSchema = external_exports.email();
|
|
37426
|
-
function buildAllowCommand(deps) {
|
|
37427
|
-
return new Command("allow").description(
|
|
37428
|
-
"Add one or more users to an Agent's allowed-user list (gates Slack drivers)"
|
|
37429
|
-
).argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
37430
|
-
"--user <email>",
|
|
37431
|
-
"user email to allow (repeatable)",
|
|
37432
|
-
collect,
|
|
37433
|
-
[]
|
|
37434
|
-
).option(
|
|
37435
|
-
"--server <url>",
|
|
37436
|
-
"override the configured server URL for this call"
|
|
37437
|
-
).option("--json", "emit { ok, agentId, allowedUserEmails } as JSON").addHelpText(
|
|
37438
|
-
"after",
|
|
37439
|
-
"\nExamples:\n dam channel allow my-agent --user teammate@example.com\n dam channel allow my-agent --user a@x.com --user b@y.com\n"
|
|
37440
|
-
).action(
|
|
37441
|
-
async (ref, opts) => {
|
|
37442
|
-
const users = opts.user;
|
|
37443
|
-
if (users.length === 0) {
|
|
37444
|
-
process.stderr.write("error: pass at least one --user <email>\n");
|
|
37445
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37446
|
-
}
|
|
37447
|
-
const invalid = users.filter((u) => !emailSchema.safeParse(u).success);
|
|
37448
|
-
if (invalid.length > 0) {
|
|
37449
|
-
process.stderr.write(
|
|
37450
|
-
`error: invalid email(s): ${invalid.join(", ")}
|
|
37451
|
-
`
|
|
37452
|
-
);
|
|
37453
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37454
|
-
}
|
|
37455
|
-
const host = await resolveActiveHost(deps, {
|
|
37456
|
-
flag: opts.server ? { server: opts.server } : void 0,
|
|
37457
|
-
exitCodes: {
|
|
37458
|
-
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
37459
|
-
belowFloor: EXIT_BELOW_FLOOR
|
|
37460
|
-
}
|
|
37461
|
-
});
|
|
37462
|
-
const svc = deps.createAgentService(host);
|
|
37463
|
-
const resolver = createAgentResolver({ agentService: svc });
|
|
37464
|
-
const resolved = await resolver.resolve(ref);
|
|
37465
|
-
if (!resolved.ok) {
|
|
37466
|
-
printResolveError(resolved.error, host);
|
|
37467
|
-
process.exit(exitCodeForResolveError(resolved.error));
|
|
37468
|
-
}
|
|
37469
|
-
const merged = mergeAllowedUserEmails(
|
|
37470
|
-
resolved.value.allowedUserEmails,
|
|
37471
|
-
{
|
|
37472
|
-
add: users
|
|
37473
|
-
}
|
|
37474
|
-
);
|
|
37475
|
-
const res = await svc.updateAllowedUserEmails(
|
|
37476
|
-
resolved.value.id,
|
|
37477
|
-
merged
|
|
37478
|
-
);
|
|
37479
|
-
if (!res.ok) {
|
|
37480
|
-
if (res.error.kind === "invalid-input") {
|
|
37481
|
-
process.stderr.write(`error: ${res.error.message}
|
|
37482
|
-
`);
|
|
37483
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37484
|
-
}
|
|
37485
|
-
if (res.error.kind === "not-found") {
|
|
37486
|
-
process.stderr.write(
|
|
37487
|
-
`error: no agent with id \`${resolved.value.id}\`
|
|
37488
|
-
`
|
|
37489
|
-
);
|
|
37490
|
-
process.exit(EXIT_AGENT_NOT_RESOLVED);
|
|
37491
|
-
}
|
|
37492
|
-
printServiceError(res.error, host);
|
|
37493
|
-
process.exit(EXIT_RUNTIME_FAILURE);
|
|
37494
|
-
}
|
|
37495
|
-
if (opts.json) {
|
|
37496
|
-
process.stdout.write(
|
|
37497
|
-
`${JSON.stringify({ ok: true, agentId: resolved.value.id, allowedUserEmails: res.value.allowedUserEmails })}
|
|
37498
|
-
`
|
|
37499
|
-
);
|
|
37500
|
-
} else {
|
|
37501
|
-
process.stdout.write(
|
|
37502
|
-
`\u2713 Allowed ${users.length} user(s) on ${resolved.value.name}. Agent now has ${res.value.allowedUserEmails.length} allowed user(s).
|
|
37503
|
-
`
|
|
37504
|
-
);
|
|
37505
|
-
}
|
|
37506
|
-
process.exit(EXIT_SUCCESS);
|
|
37507
|
-
}
|
|
37508
|
-
);
|
|
37509
|
-
}
|
|
37510
|
-
|
|
37511
37408
|
// src/modules/channel/commands/available.ts
|
|
37512
37409
|
var PROVIDER_ORDER = [
|
|
37513
37410
|
"slack" /* Slack */,
|
|
@@ -37554,115 +37451,24 @@ function buildAvailableCommand(deps) {
|
|
|
37554
37451
|
});
|
|
37555
37452
|
}
|
|
37556
37453
|
|
|
37557
|
-
// src/modules/channel/commands/disallow.ts
|
|
37558
|
-
var collect2 = (v2, acc) => [...acc, v2];
|
|
37559
|
-
function buildDisallowCommand(deps) {
|
|
37560
|
-
return new Command("disallow").description(
|
|
37561
|
-
"Remove one or more users from an Agent's allowed-user list. Idempotent."
|
|
37562
|
-
).argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
37563
|
-
"--user <email>",
|
|
37564
|
-
"user email to remove (repeatable)",
|
|
37565
|
-
collect2,
|
|
37566
|
-
[]
|
|
37567
|
-
).option(
|
|
37568
|
-
"--server <url>",
|
|
37569
|
-
"override the configured server URL for this call"
|
|
37570
|
-
).option("--json", "emit { ok, agentId, allowedUserEmails } as JSON").addHelpText(
|
|
37571
|
-
"after",
|
|
37572
|
-
"\nExamples:\n dam channel disallow my-agent --user teammate@example.com\n"
|
|
37573
|
-
).action(
|
|
37574
|
-
async (ref, opts) => {
|
|
37575
|
-
const users = opts.user;
|
|
37576
|
-
if (users.length === 0) {
|
|
37577
|
-
process.stderr.write("error: pass at least one --user <email>\n");
|
|
37578
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37579
|
-
}
|
|
37580
|
-
const host = await resolveActiveHost(deps, {
|
|
37581
|
-
flag: opts.server ? { server: opts.server } : void 0,
|
|
37582
|
-
exitCodes: {
|
|
37583
|
-
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
37584
|
-
belowFloor: EXIT_BELOW_FLOOR
|
|
37585
|
-
}
|
|
37586
|
-
});
|
|
37587
|
-
const svc = deps.createAgentService(host);
|
|
37588
|
-
const resolver = createAgentResolver({ agentService: svc });
|
|
37589
|
-
const resolved = await resolver.resolve(ref);
|
|
37590
|
-
if (!resolved.ok) {
|
|
37591
|
-
printResolveError(resolved.error, host);
|
|
37592
|
-
process.exit(exitCodeForResolveError(resolved.error));
|
|
37593
|
-
}
|
|
37594
|
-
const merged = mergeAllowedUserEmails(
|
|
37595
|
-
resolved.value.allowedUserEmails,
|
|
37596
|
-
{
|
|
37597
|
-
remove: users
|
|
37598
|
-
}
|
|
37599
|
-
);
|
|
37600
|
-
const res = await svc.updateAllowedUserEmails(
|
|
37601
|
-
resolved.value.id,
|
|
37602
|
-
merged
|
|
37603
|
-
);
|
|
37604
|
-
if (!res.ok) {
|
|
37605
|
-
if (res.error.kind === "invalid-input") {
|
|
37606
|
-
process.stderr.write(`error: ${res.error.message}
|
|
37607
|
-
`);
|
|
37608
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37609
|
-
}
|
|
37610
|
-
if (res.error.kind === "not-found") {
|
|
37611
|
-
process.stderr.write(
|
|
37612
|
-
`error: no agent with id \`${resolved.value.id}\`
|
|
37613
|
-
`
|
|
37614
|
-
);
|
|
37615
|
-
process.exit(EXIT_AGENT_NOT_RESOLVED);
|
|
37616
|
-
}
|
|
37617
|
-
printServiceError(res.error, host);
|
|
37618
|
-
process.exit(EXIT_RUNTIME_FAILURE);
|
|
37619
|
-
}
|
|
37620
|
-
if (opts.json) {
|
|
37621
|
-
process.stdout.write(
|
|
37622
|
-
`${JSON.stringify({ ok: true, agentId: resolved.value.id, allowedUserEmails: res.value.allowedUserEmails })}
|
|
37623
|
-
`
|
|
37624
|
-
);
|
|
37625
|
-
} else {
|
|
37626
|
-
process.stdout.write(
|
|
37627
|
-
`\u2713 Disallowed ${users.length} user(s) from ${resolved.value.name}. Agent now has ${res.value.allowedUserEmails.length} allowed user(s).
|
|
37628
|
-
`
|
|
37629
|
-
);
|
|
37630
|
-
}
|
|
37631
|
-
process.exit(EXIT_SUCCESS);
|
|
37632
|
-
}
|
|
37633
|
-
);
|
|
37634
|
-
}
|
|
37635
|
-
|
|
37636
37454
|
// src/modules/channel/commands/list.ts
|
|
37637
|
-
function renderHuman(channels
|
|
37638
|
-
|
|
37639
|
-
["TYPE", "IDENTIFIER", "
|
|
37455
|
+
function renderHuman(channels) {
|
|
37456
|
+
return channels.length === 0 ? "No channels connected.\n" : renderTable([
|
|
37457
|
+
["TYPE", "IDENTIFIER", "AMBIENT"],
|
|
37640
37458
|
...channels.map(
|
|
37641
37459
|
(c2) => (
|
|
37642
37460
|
// Telegram has no readable identifier — the bot token is write-only.
|
|
37643
|
-
//
|
|
37644
|
-
c2.type === "slack" /* Slack */ ? [
|
|
37645
|
-
"slack",
|
|
37646
|
-
c2.slackChannelId,
|
|
37647
|
-
c2.ambient ? "shared (ambient)" : c2.mode ?? "person-scoped"
|
|
37648
|
-
] : ["telegram", "\u2014", "shared"]
|
|
37461
|
+
// Ambient is Slack-only.
|
|
37462
|
+
c2.type === "slack" /* Slack */ ? ["slack", c2.slackChannelId, c2.ambient ? "on" : "off"] : ["telegram", "\u2014", "\u2014"]
|
|
37649
37463
|
)
|
|
37650
37464
|
)
|
|
37651
37465
|
]);
|
|
37652
|
-
const allowed = allowedUserEmails.length === 0 ? " (unrestricted)\n" : `${allowedUserEmails.map((e2) => ` ${e2}`).join("\n")}
|
|
37653
|
-
`;
|
|
37654
|
-
return `${channelsBlock}
|
|
37655
|
-
Allowed users:
|
|
37656
|
-
${allowed}`;
|
|
37657
37466
|
}
|
|
37658
37467
|
function buildListCommand3(deps) {
|
|
37659
|
-
return new Command("list").description("List an Agent's connected channels
|
|
37468
|
+
return new Command("list").description("List an Agent's connected channels").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
37660
37469
|
"--server <url>",
|
|
37661
37470
|
"override the configured server URL for this call"
|
|
37662
|
-
).option(
|
|
37663
|
-
"--json",
|
|
37664
|
-
"emit { channels, allowedUserEmails } as JSON instead of the default tables"
|
|
37665
|
-
).addHelpText(
|
|
37471
|
+
).option("--json", "emit { channels } as JSON instead of the default table").addHelpText(
|
|
37666
37472
|
"after",
|
|
37667
37473
|
"\nExamples:\n dam channel list my-agent\n dam channel list my-agent --json\n"
|
|
37668
37474
|
).action(async (ref, opts) => {
|
|
@@ -37681,18 +37487,15 @@ function buildListCommand3(deps) {
|
|
|
37681
37487
|
printResolveError(resolved.error, host);
|
|
37682
37488
|
process.exit(exitCodeForResolveError(resolved.error));
|
|
37683
37489
|
}
|
|
37684
|
-
const { channels
|
|
37490
|
+
const { channels } = resolved.value;
|
|
37685
37491
|
if (opts.json) {
|
|
37686
37492
|
return writeStdoutAndExit(
|
|
37687
|
-
`${JSON.stringify({ channels
|
|
37493
|
+
`${JSON.stringify({ channels })}
|
|
37688
37494
|
`,
|
|
37689
37495
|
EXIT_SUCCESS
|
|
37690
37496
|
);
|
|
37691
37497
|
}
|
|
37692
|
-
return writeStdoutAndExit(
|
|
37693
|
-
renderHuman(channels, allowedUserEmails),
|
|
37694
|
-
EXIT_SUCCESS
|
|
37695
|
-
);
|
|
37498
|
+
return writeStdoutAndExit(renderHuman(channels), EXIT_SUCCESS);
|
|
37696
37499
|
});
|
|
37697
37500
|
}
|
|
37698
37501
|
|
|
@@ -37717,17 +37520,14 @@ async function ensureProviderAvailable(svc, provider, host) {
|
|
|
37717
37520
|
// src/modules/channel/commands/slack-connect.ts
|
|
37718
37521
|
function buildSlackConnectCommand(deps) {
|
|
37719
37522
|
return new Command("connect").description("Bind a Slack channel to an Agent").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").requiredOption("--channel-id <id>", "Slack channel id (e.g. C0123ABCD)").option(
|
|
37720
|
-
"--mode <mode>",
|
|
37721
|
-
"access mode: 'person-scoped' (default) or 'shared'"
|
|
37722
|
-
).option(
|
|
37723
37523
|
"--ambient",
|
|
37724
|
-
"ambient mode
|
|
37524
|
+
"ambient mode: the agent reads along and may chime in without being mentioned"
|
|
37725
37525
|
).option(
|
|
37726
37526
|
"--server <url>",
|
|
37727
37527
|
"override the configured server URL for this call"
|
|
37728
37528
|
).option("--json", "emit the updated ChannelConfig[] as JSON").addHelpText(
|
|
37729
37529
|
"after",
|
|
37730
|
-
"\nExamples:\n dam channel slack connect my-agent --channel-id C0123ABCD\n dam channel slack connect my-agent --channel-id C0123ABCD --
|
|
37530
|
+
"\nExamples:\n dam channel slack connect my-agent --channel-id C0123ABCD\n dam channel slack connect my-agent --channel-id C0123ABCD --ambient\n"
|
|
37731
37531
|
).action(
|
|
37732
37532
|
async (ref, opts) => {
|
|
37733
37533
|
const channelId = opts.channelId.trim();
|
|
@@ -37735,17 +37535,6 @@ function buildSlackConnectCommand(deps) {
|
|
|
37735
37535
|
process.stderr.write("error: --channel-id must not be empty\n");
|
|
37736
37536
|
process.exit(EXIT_INVALID_INPUT);
|
|
37737
37537
|
}
|
|
37738
|
-
if (opts.mode !== void 0 && opts.mode !== "shared" && opts.mode !== "person-scoped") {
|
|
37739
|
-
process.stderr.write(
|
|
37740
|
-
"error: --mode must be 'shared' or 'person-scoped'\n"
|
|
37741
|
-
);
|
|
37742
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37743
|
-
}
|
|
37744
|
-
const mode = opts.mode;
|
|
37745
|
-
if (opts.ambient && mode !== "shared") {
|
|
37746
|
-
process.stderr.write("error: --ambient requires --mode shared\n");
|
|
37747
|
-
process.exit(EXIT_INVALID_INPUT);
|
|
37748
|
-
}
|
|
37749
37538
|
const host = await resolveActiveHost(deps, {
|
|
37750
37539
|
flag: opts.server ? { server: opts.server } : void 0,
|
|
37751
37540
|
exitCodes: {
|
|
@@ -37766,7 +37555,6 @@ function buildSlackConnectCommand(deps) {
|
|
|
37766
37555
|
const res = await svc.connectSlack(
|
|
37767
37556
|
resolved.value.id,
|
|
37768
37557
|
channelId,
|
|
37769
|
-
mode,
|
|
37770
37558
|
opts.ambient
|
|
37771
37559
|
);
|
|
37772
37560
|
if (!res.ok) {
|
|
@@ -37784,28 +37572,11 @@ function buildSlackConnectCommand(deps) {
|
|
|
37784
37572
|
printServiceError(res.error, host);
|
|
37785
37573
|
process.exit(EXIT_RUNTIME_FAILURE);
|
|
37786
37574
|
}
|
|
37787
|
-
if (mode === "shared") {
|
|
37788
|
-
const slackCh = res.value.find((c2) => c2.type === "slack" /* Slack */);
|
|
37789
|
-
if (!slackCh || slackCh.mode !== "shared") {
|
|
37790
|
-
const rolledBack = await svc.disconnectSlack(resolved.value.id);
|
|
37791
|
-
if (rolledBack.ok) {
|
|
37792
|
-
process.stderr.write(
|
|
37793
|
-
"error: this server does not support shared access mode \u2014 binding rolled back\n"
|
|
37794
|
-
);
|
|
37795
|
-
} else {
|
|
37796
|
-
process.stderr.write(
|
|
37797
|
-
"error: this server does not support shared access mode, and rolling the binding back failed \u2014 the channel is still bound in person-scoped mode; disconnect it manually\n"
|
|
37798
|
-
);
|
|
37799
|
-
printServiceError(rolledBack.error, host);
|
|
37800
|
-
}
|
|
37801
|
-
process.exit(EXIT_RUNTIME_FAILURE);
|
|
37802
|
-
}
|
|
37803
|
-
}
|
|
37804
37575
|
if (opts.ambient) {
|
|
37805
37576
|
const slackCh = res.value.find((c2) => c2.type === "slack" /* Slack */);
|
|
37806
|
-
if (slackCh?.
|
|
37577
|
+
if (!slackCh?.ambient) {
|
|
37807
37578
|
process.stderr.write(
|
|
37808
|
-
"error: this server does not support ambient mode \u2014 the channel is connected
|
|
37579
|
+
"error: this server does not support ambient mode \u2014 the channel is connected without it\n"
|
|
37809
37580
|
);
|
|
37810
37581
|
process.exit(EXIT_RUNTIME_FAILURE);
|
|
37811
37582
|
}
|
|
@@ -37815,7 +37586,7 @@ function buildSlackConnectCommand(deps) {
|
|
|
37815
37586
|
`);
|
|
37816
37587
|
} else {
|
|
37817
37588
|
process.stdout.write(
|
|
37818
|
-
`\u2713 Slack channel ${channelId} connected to ${resolved.value.name}${
|
|
37589
|
+
`\u2713 Slack channel ${channelId} connected to ${resolved.value.name}${opts.ambient ? " with ambient on" : ""}.
|
|
37819
37590
|
`
|
|
37820
37591
|
);
|
|
37821
37592
|
if (opts.ambient) {
|
|
@@ -37823,15 +37594,9 @@ function buildSlackConnectCommand(deps) {
|
|
|
37823
37594
|
"note: the agent reads along in this channel and may chime in without being mentioned; the channel gets a visible notice\n"
|
|
37824
37595
|
);
|
|
37825
37596
|
}
|
|
37826
|
-
|
|
37827
|
-
|
|
37828
|
-
|
|
37829
|
-
);
|
|
37830
|
-
} else {
|
|
37831
|
-
process.stderr.write(
|
|
37832
|
-
"hint: users must run `/platform login` inside Slack before they can drive this agent\n"
|
|
37833
|
-
);
|
|
37834
|
-
}
|
|
37597
|
+
process.stderr.write(
|
|
37598
|
+
"note: everyone in the channel drives this agent under its credentials; your Terms-of-Use acceptance covers every turn\n"
|
|
37599
|
+
);
|
|
37835
37600
|
}
|
|
37836
37601
|
process.exit(EXIT_SUCCESS);
|
|
37837
37602
|
}
|
|
@@ -37889,12 +37654,11 @@ function createChannelService(deps) {
|
|
|
37889
37654
|
async available() {
|
|
37890
37655
|
return trpcCall(() => deps.trpc.channels.available.query());
|
|
37891
37656
|
},
|
|
37892
|
-
async connectSlack(id, slackChannelId,
|
|
37657
|
+
async connectSlack(id, slackChannelId, ambient) {
|
|
37893
37658
|
try {
|
|
37894
37659
|
const agent = await deps.trpc.agents.connectSlack.mutate({
|
|
37895
37660
|
id,
|
|
37896
37661
|
slackChannelId,
|
|
37897
|
-
...mode ? { mode } : {},
|
|
37898
37662
|
...ambient ? { ambient: true } : {}
|
|
37899
37663
|
});
|
|
37900
37664
|
return ok2(agent.channels);
|
|
@@ -37952,13 +37716,6 @@ function composeChannelModule(opts) {
|
|
|
37952
37716
|
slack.addCommand(buildSlackConnectCommand(agentScoped));
|
|
37953
37717
|
slack.addCommand(buildSlackDisconnectCommand(agentScoped));
|
|
37954
37718
|
parent.addCommand(slack);
|
|
37955
|
-
const allowScoped = {
|
|
37956
|
-
compatService: opts.compatService,
|
|
37957
|
-
configService: opts.configService,
|
|
37958
|
-
createAgentService: opts.createAgentService
|
|
37959
|
-
};
|
|
37960
|
-
parent.addCommand(buildAllowCommand(allowScoped));
|
|
37961
|
-
parent.addCommand(buildDisallowCommand(allowScoped));
|
|
37962
37719
|
return { commands: [parent], exports: { createService } };
|
|
37963
37720
|
}
|
|
37964
37721
|
|
|
@@ -40488,7 +40245,7 @@ function createProcessEnvReader() {
|
|
|
40488
40245
|
|
|
40489
40246
|
// src/modules/cli/infrastructure/package-version.ts
|
|
40490
40247
|
function readPackageVersion() {
|
|
40491
|
-
return true ? "0.2.
|
|
40248
|
+
return true ? "0.2.12" : DEV_VERSION;
|
|
40492
40249
|
}
|
|
40493
40250
|
|
|
40494
40251
|
// src/modules/cli/infrastructure/version-probe.ts
|
|
@@ -41247,12 +41004,12 @@ function buildDisconnectCommand(deps) {
|
|
|
41247
41004
|
}
|
|
41248
41005
|
|
|
41249
41006
|
// src/modules/connection/commands/grant.ts
|
|
41250
|
-
var
|
|
41007
|
+
var collect = (v2, acc) => [...acc, v2];
|
|
41251
41008
|
function buildGrantCommand(deps) {
|
|
41252
41009
|
return new Command("grant").description("Grant one or more connections to an Agent").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
41253
41010
|
"--connection <id-or-name>",
|
|
41254
41011
|
"connection id or unique name to grant (repeatable)",
|
|
41255
|
-
|
|
41012
|
+
collect,
|
|
41256
41013
|
[]
|
|
41257
41014
|
).option(
|
|
41258
41015
|
"--server <url>",
|
|
@@ -41448,14 +41205,14 @@ function buildListCommand4(deps) {
|
|
|
41448
41205
|
}
|
|
41449
41206
|
|
|
41450
41207
|
// src/modules/connection/commands/revoke.ts
|
|
41451
|
-
var
|
|
41208
|
+
var collect2 = (v2, acc) => [...acc, v2];
|
|
41452
41209
|
function buildRevokeCommand(deps) {
|
|
41453
41210
|
return new Command("revoke").description(
|
|
41454
41211
|
"Revoke one or more connections from an Agent. Idempotent \u2014 revoking an ungranted id exits 0."
|
|
41455
41212
|
).argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").option(
|
|
41456
41213
|
"--connection <id-or-name>",
|
|
41457
41214
|
"connection id or unique name to revoke (repeatable)",
|
|
41458
|
-
|
|
41215
|
+
collect2,
|
|
41459
41216
|
[]
|
|
41460
41217
|
).option(
|
|
41461
41218
|
"--server <url>",
|