@dam-agents/cli 0.2.14-rc1 → 0.2.15-rc2
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 +241 -51
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -26787,6 +26787,8 @@ var scanFailureCodes = [
|
|
|
26787
26787
|
"needs_sandbox",
|
|
26788
26788
|
"repo_unreachable",
|
|
26789
26789
|
"agent_unreachable",
|
|
26790
|
+
"source_path_not_found",
|
|
26791
|
+
"source_path_empty",
|
|
26790
26792
|
"other"
|
|
26791
26793
|
];
|
|
26792
26794
|
var scanFailureSchema = external_exports.object({
|
|
@@ -26991,6 +26993,7 @@ var templateSpecSchema = external_exports.object({
|
|
|
26991
26993
|
category: templateCategorySchema,
|
|
26992
26994
|
tags: external_exports.array(external_exports.string()).optional(),
|
|
26993
26995
|
docsUrl: external_exports.string().optional(),
|
|
26996
|
+
releaseNotesUrl: external_exports.string().optional(),
|
|
26994
26997
|
setupNote: external_exports.object({ title: external_exports.string(), body: external_exports.string() }).optional(),
|
|
26995
26998
|
experimental: external_exports.boolean().optional(),
|
|
26996
26999
|
mounts: external_exports.array(mountSchema).optional(),
|
|
@@ -27042,7 +27045,8 @@ var spawnInvocationResponseSchema = external_exports.object({
|
|
|
27042
27045
|
});
|
|
27043
27046
|
var invocationViewSchema = external_exports.object({
|
|
27044
27047
|
status: external_exports.enum(["running", "done", "failed"]),
|
|
27045
|
-
result: external_exports.unknown()
|
|
27048
|
+
result: external_exports.unknown(),
|
|
27049
|
+
errorReason: external_exports.string().optional()
|
|
27046
27050
|
});
|
|
27047
27051
|
|
|
27048
27052
|
// ../agent-runtime-api/src/modules/files/schemas.ts
|
|
@@ -27126,6 +27130,10 @@ var skillWriteLocalInputSchema = external_exports.object({
|
|
|
27126
27130
|
).min(1).max(50)
|
|
27127
27131
|
});
|
|
27128
27132
|
|
|
27133
|
+
// ../agent-runtime-api/src/modules/workspace/paths.ts
|
|
27134
|
+
var AGENT_HOME_DIR = "/home/agent";
|
|
27135
|
+
var AGENT_WORK_DIR = `${AGENT_HOME_DIR}/work`;
|
|
27136
|
+
|
|
27129
27137
|
// ../agent-runtime-api/src/modules/ssh/schemas.ts
|
|
27130
27138
|
var sshAuthorizeKeyInputSchema = external_exports.object({
|
|
27131
27139
|
publicKey: external_exports.string().min(1).max(8192).refine((s) => !/[\r\n]/.test(s), "must be a single line")
|
|
@@ -27433,6 +27441,9 @@ var egressRuleUpdateInputSchema = external_exports.object({
|
|
|
27433
27441
|
pathPattern: external_exports.string().min(1).optional(),
|
|
27434
27442
|
verdict: ruleVerdictSchema.optional()
|
|
27435
27443
|
});
|
|
27444
|
+
var egressRuleGetInputSchema = external_exports.object({
|
|
27445
|
+
id: external_exports.string().min(1)
|
|
27446
|
+
});
|
|
27436
27447
|
var egressRuleRevokeInputSchema = external_exports.object({
|
|
27437
27448
|
id: external_exports.string().min(1)
|
|
27438
27449
|
});
|
|
@@ -27529,6 +27540,7 @@ var quietWindowSchema = external_exports.object({
|
|
|
27529
27540
|
}).refine((w3) => w3.startTime !== w3.endTime, {
|
|
27530
27541
|
message: "startTime and endTime must differ"
|
|
27531
27542
|
});
|
|
27543
|
+
var scheduleListForOwnerInputSchema = external_exports.object({ limit: external_exports.number().int().positive().max(200).optional() }).optional();
|
|
27532
27544
|
var scheduleListInputSchema = external_exports.object({
|
|
27533
27545
|
agentId: external_exports.string().min(1)
|
|
27534
27546
|
});
|
|
@@ -27616,13 +27628,15 @@ var skeletonSchema = external_exports.object({
|
|
|
27616
27628
|
stages: external_exports.array(
|
|
27617
27629
|
external_exports.object({
|
|
27618
27630
|
id: stageIdSchema,
|
|
27619
|
-
after: external_exports.array(stageIdSchema).max(20).default([])
|
|
27631
|
+
after: external_exports.array(stageIdSchema).max(20).default([]),
|
|
27632
|
+
description: external_exports.string().trim().min(1).max(300).optional()
|
|
27620
27633
|
})
|
|
27621
27634
|
).max(50).default([]),
|
|
27622
27635
|
loops: external_exports.array(
|
|
27623
27636
|
external_exports.object({
|
|
27624
27637
|
id: stageIdSchema,
|
|
27625
|
-
stages: external_exports.array(stageIdSchema).min(1).max(50)
|
|
27638
|
+
stages: external_exports.array(stageIdSchema).min(1).max(50),
|
|
27639
|
+
description: external_exports.string().trim().min(1).max(300).optional()
|
|
27626
27640
|
})
|
|
27627
27641
|
).max(10).default([])
|
|
27628
27642
|
});
|
|
@@ -27735,7 +27749,8 @@ var artifactKindSchema = external_exports.enum([
|
|
|
27735
27749
|
"binary"
|
|
27736
27750
|
]);
|
|
27737
27751
|
var artifactVisibilitySchema = external_exports.enum(["private", "public"]);
|
|
27738
|
-
var
|
|
27752
|
+
var ARTIFACT_TITLE_MAX_LENGTH = 300;
|
|
27753
|
+
var titleSchema = external_exports.string().trim().min(1, "title is required").max(ARTIFACT_TITLE_MAX_LENGTH);
|
|
27739
27754
|
var fileNameSchema = external_exports.string().trim().min(1).max(255);
|
|
27740
27755
|
var expiresInHoursSchema = external_exports.number().int().positive().max(24 * 365 * 10);
|
|
27741
27756
|
var artifactIdInputSchema = external_exports.object({ id: external_exports.string().min(1) });
|
|
@@ -31379,7 +31394,7 @@ function describeApprovalPayload(payload) {
|
|
|
31379
31394
|
// ../api-server-api/src/modules/egress-rules/format.ts
|
|
31380
31395
|
function formatEgressRuleSource(source) {
|
|
31381
31396
|
if (source === "manual") return "manual";
|
|
31382
|
-
if (source === "inbox") return "from
|
|
31397
|
+
if (source === "inbox") return "from an approval";
|
|
31383
31398
|
if (source === "preset:trusted") return "preset: trusted";
|
|
31384
31399
|
if (source === "preset:all") return "preset: all";
|
|
31385
31400
|
if (source.startsWith("connection:")) {
|
|
@@ -31405,6 +31420,32 @@ function stripTrailingSlashes(s) {
|
|
|
31405
31420
|
return s.slice(0, end);
|
|
31406
31421
|
}
|
|
31407
31422
|
|
|
31423
|
+
// ../api-server-api/src/modules/egress-rules/promotion.ts
|
|
31424
|
+
function needsL7Promotion(method, pathPattern, port) {
|
|
31425
|
+
return method !== "*" || pathPattern !== "*" || port != null;
|
|
31426
|
+
}
|
|
31427
|
+
function promotedHosts(rules) {
|
|
31428
|
+
const hosts = rules.filter((r) => r.host !== "*").filter((r) => !r.source.startsWith("connection:")).filter((r) => needsL7Promotion(r.method, r.pathPattern, r.port)).map((r) => r.host);
|
|
31429
|
+
return [...new Set(hosts)].sort();
|
|
31430
|
+
}
|
|
31431
|
+
function gatewayRestartImpact(input) {
|
|
31432
|
+
const removed = new Set(input.removeIds ?? []);
|
|
31433
|
+
const before = promotedHosts(input.current);
|
|
31434
|
+
const after = promotedHosts([
|
|
31435
|
+
...input.current.filter((r) => !removed.has(r.id)),
|
|
31436
|
+
...input.adds ?? []
|
|
31437
|
+
]);
|
|
31438
|
+
const beforeSet = new Set(before);
|
|
31439
|
+
const afterSet = new Set(after);
|
|
31440
|
+
const promoted = after.filter((h2) => !beforeSet.has(h2));
|
|
31441
|
+
const demoted = before.filter((h2) => !afterSet.has(h2));
|
|
31442
|
+
return {
|
|
31443
|
+
promoted,
|
|
31444
|
+
demoted,
|
|
31445
|
+
willRestart: promoted.length > 0 || demoted.length > 0
|
|
31446
|
+
};
|
|
31447
|
+
}
|
|
31448
|
+
|
|
31408
31449
|
// ../api-server-api/src/modules/acp/types.ts
|
|
31409
31450
|
var platformTurnEndedParamsSchema = external_exports.object({
|
|
31410
31451
|
sessionId: external_exports.string().min(1)
|
|
@@ -31414,6 +31455,9 @@ var platformTurnEndedNotificationSchema = external_exports.object({
|
|
|
31414
31455
|
method: external_exports.literal("platform/turnEnded"),
|
|
31415
31456
|
params: platformTurnEndedParamsSchema
|
|
31416
31457
|
});
|
|
31458
|
+
var platformClippedReplayMetaSchema = external_exports.object({
|
|
31459
|
+
older: external_exports.string().min(1).optional()
|
|
31460
|
+
});
|
|
31417
31461
|
var platformPromptAcceptedParamsSchema = external_exports.object({
|
|
31418
31462
|
sessionId: external_exports.string().min(1),
|
|
31419
31463
|
promptId: external_exports.string().min(1),
|
|
@@ -31439,6 +31483,7 @@ var brandSchema = external_exports.object({
|
|
|
31439
31483
|
name: external_exports.string(),
|
|
31440
31484
|
short: external_exports.string(),
|
|
31441
31485
|
title: external_exports.string(),
|
|
31486
|
+
vendor: external_exports.string(),
|
|
31442
31487
|
theme: external_exports.object({
|
|
31443
31488
|
light: external_exports.object({
|
|
31444
31489
|
accent: external_exports.string(),
|
|
@@ -31453,6 +31498,21 @@ var brandSchema = external_exports.object({
|
|
|
31453
31498
|
})
|
|
31454
31499
|
});
|
|
31455
31500
|
|
|
31501
|
+
// ../api-server-api/src/modules/links/types.ts
|
|
31502
|
+
var linksSchema = external_exports.object({
|
|
31503
|
+
computeRequest: external_exports.string().nullable()
|
|
31504
|
+
});
|
|
31505
|
+
|
|
31506
|
+
// ../api-server-api/src/modules/agents/public-agent.ts
|
|
31507
|
+
var publicAgentViewSchema = external_exports.object({
|
|
31508
|
+
agentId: external_exports.string(),
|
|
31509
|
+
name: external_exports.string(),
|
|
31510
|
+
ownerName: external_exports.string().nullable()
|
|
31511
|
+
});
|
|
31512
|
+
var publicAgentResponseSchema = external_exports.object({
|
|
31513
|
+
agent: publicAgentViewSchema.nullable()
|
|
31514
|
+
});
|
|
31515
|
+
|
|
31456
31516
|
// ../api-server-api/src/modules/terms/schemas.ts
|
|
31457
31517
|
var termsCurrentSchema = external_exports.object({
|
|
31458
31518
|
version: external_exports.string().min(1),
|
|
@@ -31477,6 +31537,16 @@ var termsLatestAcceptanceSchema = external_exports.object({
|
|
|
31477
31537
|
acceptedAt: external_exports.date()
|
|
31478
31538
|
}).nullable();
|
|
31479
31539
|
|
|
31540
|
+
// ../api-server-api/src/modules/usage/schemas.ts
|
|
31541
|
+
var entryPointChoiceSchema = external_exports.enum([
|
|
31542
|
+
"sandbox",
|
|
31543
|
+
"experiment",
|
|
31544
|
+
"knowledge-base"
|
|
31545
|
+
]);
|
|
31546
|
+
var entryPointChosenInputSchema = external_exports.object({
|
|
31547
|
+
choice: entryPointChoiceSchema
|
|
31548
|
+
});
|
|
31549
|
+
|
|
31480
31550
|
// ../api-server-api/src/modules/auth/types.ts
|
|
31481
31551
|
var authConfigSchema = external_exports.object({
|
|
31482
31552
|
issuer: external_exports.string().url(),
|
|
@@ -37639,7 +37709,7 @@ function buildSlackConnectCommand(deps) {
|
|
|
37639
37709
|
if (!res.ok) {
|
|
37640
37710
|
if (res.error.kind === "channel-conflict") {
|
|
37641
37711
|
process.stderr.write(
|
|
37642
|
-
"error:
|
|
37712
|
+
"error: this agent is already connected to that Slack channel\n"
|
|
37643
37713
|
);
|
|
37644
37714
|
process.exit(EXIT_INVALID_INPUT);
|
|
37645
37715
|
}
|
|
@@ -37672,7 +37742,7 @@ function buildSlackConnectCommand(deps) {
|
|
|
37672
37742
|
);
|
|
37673
37743
|
if (opts.ambient) {
|
|
37674
37744
|
process.stderr.write(
|
|
37675
|
-
"note: the agent reads along in this channel and may chime in without being mentioned;
|
|
37745
|
+
"note: the agent reads along in this channel and may chime in without being mentioned; ambient is per agent, so others connected here are unaffected\n"
|
|
37676
37746
|
);
|
|
37677
37747
|
}
|
|
37678
37748
|
process.stderr.write(
|
|
@@ -40345,7 +40415,7 @@ function createProcessEnvReader() {
|
|
|
40345
40415
|
|
|
40346
40416
|
// src/modules/cli/infrastructure/package-version.ts
|
|
40347
40417
|
function readPackageVersion() {
|
|
40348
|
-
return true ? "0.2.
|
|
40418
|
+
return true ? "0.2.15-rc2" : DEV_VERSION;
|
|
40349
40419
|
}
|
|
40350
40420
|
|
|
40351
40421
|
// src/modules/cli/infrastructure/version-probe.ts
|
|
@@ -41838,6 +41908,17 @@ function buildApplyPresetCommand(deps) {
|
|
|
41838
41908
|
);
|
|
41839
41909
|
}
|
|
41840
41910
|
|
|
41911
|
+
// src/modules/egress/domain/restart-notice.ts
|
|
41912
|
+
function gatewayRestartNotice(impact) {
|
|
41913
|
+
const clauses = [
|
|
41914
|
+
impact.promoted.length > 0 && `start inspecting requests to ${impact.promoted.join(", ")}`,
|
|
41915
|
+
impact.demoted.length > 0 && `stop inspecting requests to ${impact.demoted.join(", ")}`
|
|
41916
|
+
].filter((c2) => c2 !== false);
|
|
41917
|
+
return `The network gateway will restart (~5\u201315s) to ${clauses.join(" and ")}.
|
|
41918
|
+
The sandbox keeps running \u2014 its outbound requests are briefly interrupted.
|
|
41919
|
+
`;
|
|
41920
|
+
}
|
|
41921
|
+
|
|
41841
41922
|
// src/modules/egress/commands/create.ts
|
|
41842
41923
|
function buildCreateCommand2(deps) {
|
|
41843
41924
|
return new Command("create").description("Add a network access rule to an Agent").argument("<agent>", "Agent Ref \u2014 name or 'agent-\u2026' ID").requiredOption("--host <h>", "host the rule applies to").option("--method <m>", "HTTP method; default '*'", "*").option("--path <p>", "path pattern; default '*'", "*").addOption(
|
|
@@ -41845,7 +41926,7 @@ function buildCreateCommand2(deps) {
|
|
|
41845
41926
|
).option(
|
|
41846
41927
|
"--server <url>",
|
|
41847
41928
|
"override the configured server URL for this call"
|
|
41848
|
-
).option("-y, --yes", "skip the
|
|
41929
|
+
).option("-y, --yes", "skip the gateway restart confirmation").option("--json", "emit the created rule as JSON").addHelpText(
|
|
41849
41930
|
"after",
|
|
41850
41931
|
"\nExamples:\n dam network create my-agent --host api.example.com\n dam network create my-agent --host api.example.com --method GET --path /v1/* --yes\n"
|
|
41851
41932
|
).action(
|
|
@@ -41865,20 +41946,36 @@ function buildCreateCommand2(deps) {
|
|
|
41865
41946
|
printResolveError(resolved.error, host);
|
|
41866
41947
|
process.exit(exitCodeForResolveError(resolved.error));
|
|
41867
41948
|
}
|
|
41868
|
-
const
|
|
41869
|
-
if (
|
|
41870
|
-
|
|
41871
|
-
|
|
41872
|
-
|
|
41873
|
-
);
|
|
41874
|
-
|
|
41949
|
+
const egress = deps.createEgressService(host);
|
|
41950
|
+
if (!opts.yes) {
|
|
41951
|
+
const existing = await egress.listForAgent(resolved.value.id);
|
|
41952
|
+
if (!existing.ok) {
|
|
41953
|
+
printServiceError(existing.error, host);
|
|
41954
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
41955
|
+
}
|
|
41956
|
+
const impact = gatewayRestartImpact({
|
|
41957
|
+
current: existing.value,
|
|
41958
|
+
adds: [
|
|
41959
|
+
{
|
|
41960
|
+
host: opts.host,
|
|
41961
|
+
method: opts.method,
|
|
41962
|
+
pathPattern: opts.path,
|
|
41963
|
+
source: "manual"
|
|
41964
|
+
}
|
|
41965
|
+
]
|
|
41966
|
+
});
|
|
41967
|
+
if (impact.willRestart) {
|
|
41968
|
+
if (!process.stdin.isTTY) {
|
|
41969
|
+
process.stderr.write(
|
|
41970
|
+
"error: this rule restarts the network gateway; pass --yes on non-interactive stdin\n"
|
|
41971
|
+
);
|
|
41972
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
41973
|
+
}
|
|
41974
|
+
process.stderr.write(gatewayRestartNotice(impact));
|
|
41975
|
+
if (!await confirm("Continue?")) exitCancelled(opts);
|
|
41875
41976
|
}
|
|
41876
|
-
process.stderr.write(
|
|
41877
|
-
"This rule requires path-level enforcement (non-wildcard method/path) and will restart the agent (~5\u201315s).\n"
|
|
41878
|
-
);
|
|
41879
|
-
if (!await confirm("Continue?")) exitCancelled(opts);
|
|
41880
41977
|
}
|
|
41881
|
-
const result = await
|
|
41978
|
+
const result = await egress.create({
|
|
41882
41979
|
agentId: resolved.value.id,
|
|
41883
41980
|
host: opts.host,
|
|
41884
41981
|
method: opts.method,
|
|
@@ -42017,31 +42114,72 @@ function buildRevokeCommand2(deps) {
|
|
|
42017
42114
|
).argument("<rule-id>", "Rule UUID (copy from `dam network list`)").option(
|
|
42018
42115
|
"--server <url>",
|
|
42019
42116
|
"override the configured server URL for this call"
|
|
42020
|
-
).option("--json", "emit { ok, id } as JSON").addHelpText(
|
|
42117
|
+
).option("-y, --yes", "skip the gateway restart confirmation").option("--json", "emit { ok, id } as JSON").addHelpText(
|
|
42021
42118
|
"after",
|
|
42022
42119
|
"\nExamples:\n dam network revoke 3f2a8c0e-2b91-4d6a-9c1b-7e8a1f0a2b3c\n"
|
|
42023
|
-
).action(
|
|
42024
|
-
|
|
42025
|
-
|
|
42026
|
-
|
|
42027
|
-
|
|
42028
|
-
|
|
42120
|
+
).action(
|
|
42121
|
+
async (id, opts) => {
|
|
42122
|
+
const host = await resolveActiveHost(deps, {
|
|
42123
|
+
flag: opts.server ? { server: opts.server } : void 0,
|
|
42124
|
+
exitCodes: {
|
|
42125
|
+
runtimeFailure: EXIT_RUNTIME_FAILURE,
|
|
42126
|
+
belowFloor: EXIT_BELOW_FLOOR
|
|
42127
|
+
}
|
|
42128
|
+
});
|
|
42129
|
+
const egress = deps.createEgressService(host);
|
|
42130
|
+
const current = await egress.get(id);
|
|
42131
|
+
if (!current.ok) {
|
|
42132
|
+
const failure = current.error;
|
|
42133
|
+
if (failure.kind === "rule-lookup-unsupported") {
|
|
42134
|
+
if (!opts.yes) {
|
|
42135
|
+
process.stderr.write(
|
|
42136
|
+
"error: this server is too old to report whether revoking restarts the network gateway; re-run with --yes to revoke anyway\n"
|
|
42137
|
+
);
|
|
42138
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
42139
|
+
}
|
|
42140
|
+
} else if (failure.kind !== "rule-not-found") {
|
|
42141
|
+
printServiceError(failure, host);
|
|
42142
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
42143
|
+
}
|
|
42029
42144
|
}
|
|
42030
|
-
|
|
42031
|
-
|
|
42032
|
-
|
|
42033
|
-
|
|
42034
|
-
|
|
42035
|
-
|
|
42036
|
-
|
|
42037
|
-
|
|
42145
|
+
if (current.ok && !opts.yes) {
|
|
42146
|
+
const siblings = await egress.listForAgent(current.value.agentId);
|
|
42147
|
+
if (!siblings.ok) {
|
|
42148
|
+
process.stderr.write(
|
|
42149
|
+
"error: could not read the sandbox's rules to tell whether revoking restarts the network gateway; re-run with --yes to revoke anyway\n"
|
|
42150
|
+
);
|
|
42151
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
42152
|
+
}
|
|
42153
|
+
const impact = gatewayRestartImpact({
|
|
42154
|
+
current: siblings.value,
|
|
42155
|
+
removeIds: [id]
|
|
42156
|
+
});
|
|
42157
|
+
if (impact.willRestart) {
|
|
42158
|
+
if (!process.stdin.isTTY) {
|
|
42159
|
+
process.stderr.write(
|
|
42160
|
+
"error: this revoke restarts the network gateway; pass --yes on non-interactive stdin\n"
|
|
42161
|
+
);
|
|
42162
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
42163
|
+
}
|
|
42164
|
+
process.stderr.write(gatewayRestartNotice(impact));
|
|
42165
|
+
if (!await confirm("Continue?")) exitCancelled(opts);
|
|
42166
|
+
}
|
|
42167
|
+
}
|
|
42168
|
+
const result = await egress.revoke(id);
|
|
42169
|
+
if (!result.ok) {
|
|
42170
|
+
printServiceError(result.error, host);
|
|
42171
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
42172
|
+
}
|
|
42173
|
+
if (opts.json) {
|
|
42174
|
+
process.stdout.write(`${JSON.stringify({ ok: true, id })}
|
|
42038
42175
|
`);
|
|
42039
|
-
|
|
42040
|
-
|
|
42176
|
+
} else {
|
|
42177
|
+
process.stdout.write(`\u2713 Revoked rule ${id}.
|
|
42041
42178
|
`);
|
|
42179
|
+
}
|
|
42180
|
+
process.exit(EXIT_SUCCESS);
|
|
42042
42181
|
}
|
|
42043
|
-
|
|
42044
|
-
});
|
|
42182
|
+
);
|
|
42045
42183
|
}
|
|
42046
42184
|
|
|
42047
42185
|
// src/modules/egress/commands/trusted-hosts.ts
|
|
@@ -42081,7 +42219,7 @@ function buildUpdateCommand2(deps) {
|
|
|
42081
42219
|
).option(
|
|
42082
42220
|
"--server <url>",
|
|
42083
42221
|
"override the configured server URL for this call"
|
|
42084
|
-
).option("-y, --yes", "skip the
|
|
42222
|
+
).option("-y, --yes", "skip the gateway restart confirmation").option("--json", "emit the updated rule as JSON").addHelpText(
|
|
42085
42223
|
"after",
|
|
42086
42224
|
"\nExamples:\n dam network update 3f2a8c0e-... --verdict deny\n dam network update 3f2a8c0e-... --method GET --path /v1/* --yes\n"
|
|
42087
42225
|
).action(
|
|
@@ -42099,20 +42237,60 @@ function buildUpdateCommand2(deps) {
|
|
|
42099
42237
|
belowFloor: EXIT_BELOW_FLOOR
|
|
42100
42238
|
}
|
|
42101
42239
|
});
|
|
42102
|
-
const
|
|
42103
|
-
|
|
42104
|
-
|
|
42240
|
+
const egress = deps.createEgressService(host);
|
|
42241
|
+
const current = await egress.get(id);
|
|
42242
|
+
if (!current.ok) {
|
|
42243
|
+
const failure = current.error;
|
|
42244
|
+
if (failure.kind === "rule-not-found") {
|
|
42105
42245
|
process.stderr.write(
|
|
42106
|
-
|
|
42246
|
+
`error: network access rule not found: ${failure.id}
|
|
42247
|
+
`
|
|
42107
42248
|
);
|
|
42108
|
-
process.exit(
|
|
42249
|
+
process.exit(EXIT_RULE_NOT_FOUND);
|
|
42250
|
+
} else if (failure.kind === "rule-lookup-unsupported") {
|
|
42251
|
+
if (!opts.yes) {
|
|
42252
|
+
process.stderr.write(
|
|
42253
|
+
"error: this server is too old to report whether this change restarts the network gateway; re-run with --yes to apply it anyway\n"
|
|
42254
|
+
);
|
|
42255
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
42256
|
+
}
|
|
42257
|
+
} else {
|
|
42258
|
+
printServiceError(failure, host);
|
|
42259
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
42260
|
+
}
|
|
42261
|
+
}
|
|
42262
|
+
if (current.ok) {
|
|
42263
|
+
const rule = current.value;
|
|
42264
|
+
const siblings = await egress.listForAgent(rule.agentId);
|
|
42265
|
+
if (!siblings.ok) {
|
|
42266
|
+
printServiceError(siblings.error, host);
|
|
42267
|
+
process.exit(EXIT_RUNTIME_FAILURE);
|
|
42268
|
+
}
|
|
42269
|
+
const impact = gatewayRestartImpact({
|
|
42270
|
+
current: siblings.value,
|
|
42271
|
+
removeIds: [id],
|
|
42272
|
+
adds: [
|
|
42273
|
+
{
|
|
42274
|
+
host: rule.host,
|
|
42275
|
+
...rule.port ? { port: rule.port } : {},
|
|
42276
|
+
method: opts.method ?? rule.method,
|
|
42277
|
+
pathPattern: opts.path ?? rule.pathPattern,
|
|
42278
|
+
source: "manual"
|
|
42279
|
+
}
|
|
42280
|
+
]
|
|
42281
|
+
});
|
|
42282
|
+
if (impact.willRestart && !opts.yes) {
|
|
42283
|
+
if (!process.stdin.isTTY) {
|
|
42284
|
+
process.stderr.write(
|
|
42285
|
+
"error: this change restarts the network gateway; pass --yes on non-interactive stdin\n"
|
|
42286
|
+
);
|
|
42287
|
+
process.exit(EXIT_INVALID_INPUT);
|
|
42288
|
+
}
|
|
42289
|
+
process.stderr.write(gatewayRestartNotice(impact));
|
|
42290
|
+
if (!await confirm("Continue?")) exitCancelled(opts);
|
|
42109
42291
|
}
|
|
42110
|
-
process.stderr.write(
|
|
42111
|
-
"This rule requires path-level enforcement (non-wildcard method/path) and will restart the agent (~5\u201315s).\n"
|
|
42112
|
-
);
|
|
42113
|
-
if (!await confirm("Continue?")) exitCancelled(opts);
|
|
42114
42292
|
}
|
|
42115
|
-
const result = await
|
|
42293
|
+
const result = await egress.update({
|
|
42116
42294
|
id,
|
|
42117
42295
|
method: opts.method,
|
|
42118
42296
|
pathPattern: opts.path,
|
|
@@ -42151,6 +42329,18 @@ function createEgressService(deps) {
|
|
|
42151
42329
|
() => deps.trpc.egressRules.listForAgent.query({ agentId })
|
|
42152
42330
|
);
|
|
42153
42331
|
},
|
|
42332
|
+
async get(id) {
|
|
42333
|
+
try {
|
|
42334
|
+
const view = await deps.trpc.egressRules.get.query({ id });
|
|
42335
|
+
return ok2(view);
|
|
42336
|
+
} catch (e2) {
|
|
42337
|
+
if (e2?.data?.code === "NOT_FOUND") {
|
|
42338
|
+
const reason = e2 instanceof Error ? e2.message : String(e2);
|
|
42339
|
+
return /egress rule not found/i.test(reason) ? err2({ kind: "rule-not-found", id }) : err2({ kind: "rule-lookup-unsupported", reason });
|
|
42340
|
+
}
|
|
42341
|
+
return classifyTrpcError(e2);
|
|
42342
|
+
}
|
|
42343
|
+
},
|
|
42154
42344
|
async currentPreset(agentId) {
|
|
42155
42345
|
return trpcCall(
|
|
42156
42346
|
() => deps.trpc.egressRules.currentPreset.query({ agentId })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dam-agents/cli",
|
|
3
3
|
"author": "IBM Corp.",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.15-rc2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"homepage": "https://github.com/dam-agents/dam/tree/main/packages/cli#readme",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"vitest": "^4.1.3",
|
|
44
44
|
"ws": "^8.20.0",
|
|
45
45
|
"zod": "^4.4.3",
|
|
46
|
-
"
|
|
46
|
+
"agent-runtime-api": "0.0.1",
|
|
47
47
|
"dev-config": "0.0.1",
|
|
48
|
-
"
|
|
48
|
+
"api-server-api": "0.0.1"
|
|
49
49
|
}
|
|
50
50
|
}
|