run402 4.155.1 → 4.156.1
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/cli.mjs +0 -6
- package/lib/admin.mjs +3 -3
- package/lib/agent.mjs +9 -17
- package/lib/billing.mjs +12 -12
- package/lib/buzz.mjs +7 -7
- package/lib/command-manifest.mjs +2 -2
- package/lib/contacts.mjs +73 -15
- package/lib/deliveries.mjs +1 -1
- package/lib/jobs.mjs +6 -6
- package/lib/repos.mjs +2 -2
- package/package.json +1 -1
- package/sdk/dist/namespaces/admin.d.ts +62 -29
- package/sdk/dist/namespaces/admin.d.ts.map +1 -1
- package/sdk/dist/namespaces/admin.js +48 -22
- package/sdk/dist/namespaces/admin.js.map +1 -1
- package/sdk/dist/namespaces/billing.d.ts +9 -9
- package/sdk/dist/namespaces/billing.d.ts.map +1 -1
- package/sdk/dist/namespaces/billing.js +26 -26
- package/sdk/dist/namespaces/billing.js.map +1 -1
- package/sdk/dist/namespaces/buzz.d.ts +5 -5
- package/sdk/dist/namespaces/buzz.d.ts.map +1 -1
- package/sdk/dist/namespaces/buzz.js +13 -13
- package/sdk/dist/namespaces/buzz.js.map +1 -1
- package/sdk/dist/namespaces/buzz.types.d.ts +3 -3
- package/sdk/dist/namespaces/buzz.types.d.ts.map +1 -1
- package/sdk/dist/namespaces/jobs.d.ts +7 -7
- package/sdk/dist/namespaces/jobs.d.ts.map +1 -1
- package/sdk/dist/namespaces/jobs.js +15 -13
- package/sdk/dist/namespaces/jobs.js.map +1 -1
- package/sdk/dist/namespaces/repos.d.ts +9 -8
- package/sdk/dist/namespaces/repos.d.ts.map +1 -1
- package/sdk/dist/namespaces/repos.js +14 -13
- package/sdk/dist/namespaces/repos.js.map +1 -1
- package/sdk/dist/secret-gate.d.ts +7 -3
- package/sdk/dist/secret-gate.d.ts.map +1 -1
- package/sdk/dist/secret-gate.js +7 -3
- package/sdk/dist/secret-gate.js.map +1 -1
- package/vault-surface.json +1 -1
- package/lib/webhook-secret.mjs +0 -52
package/cli.mjs
CHANGED
|
@@ -87,7 +87,6 @@ DELIVER — reach a human when something happens
|
|
|
87
87
|
deliveries Did a notification actually land (list, get)
|
|
88
88
|
contacts Where a human is reachable — paging ladder + Telegram (list, add, connect, rm, preferences)
|
|
89
89
|
subscriptions Which events go where (add, list, rm)
|
|
90
|
-
webhook-secret Rotate your webhook signing secret
|
|
91
90
|
email Send template-based emails from your project
|
|
92
91
|
|
|
93
92
|
PLATFORM — everything else, and the things still finding a home
|
|
@@ -480,11 +479,6 @@ switch (cmd) {
|
|
|
480
479
|
await run(sub, rest);
|
|
481
480
|
break;
|
|
482
481
|
}
|
|
483
|
-
case "webhook-secret": {
|
|
484
|
-
const { run } = await import("./lib/webhook-secret.mjs");
|
|
485
|
-
await run(sub, rest);
|
|
486
|
-
break;
|
|
487
|
-
}
|
|
488
482
|
case "logs": {
|
|
489
483
|
const { run } = await import("./lib/logs.mjs");
|
|
490
484
|
await run(sub, rest);
|
package/lib/admin.mjs
CHANGED
|
@@ -116,10 +116,10 @@ function validateFlags(sub, args) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
async function leasePerpetual(args) {
|
|
119
|
-
const
|
|
119
|
+
const orgId = args.find((a) => typeof a === "string" && !a.startsWith("--"));
|
|
120
120
|
const enable = args.includes("--enable");
|
|
121
121
|
const disable = args.includes("--disable");
|
|
122
|
-
if (!
|
|
122
|
+
if (!orgId) {
|
|
123
123
|
fail({
|
|
124
124
|
code: "BAD_USAGE",
|
|
125
125
|
message: "Missing <org_id>.",
|
|
@@ -134,7 +134,7 @@ async function leasePerpetual(args) {
|
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
try {
|
|
137
|
-
const adminOrg = getSdk().admin.org(
|
|
137
|
+
const adminOrg = getSdk().admin.org(orgId);
|
|
138
138
|
const data = enable ? await adminOrg.pinLease() : await adminOrg.unpinLease();
|
|
139
139
|
console.log(JSON.stringify(data, null, 2));
|
|
140
140
|
} catch (err) {
|
package/lib/agent.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { walletAuthHeaders } from "./config.mjs";
|
|
2
2
|
import { getSdk } from "./sdk.mjs";
|
|
3
3
|
import { reportSdkError, fail } from "./sdk-errors.mjs";
|
|
4
|
-
import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs,
|
|
4
|
+
import { assertKnownFlags, flagValue, normalizeArgv, positionalArgs, failUnknownSubcommand } from "./argparse.mjs";
|
|
5
5
|
|
|
6
6
|
const HELP = `run402 agent — Manage agent identity
|
|
7
7
|
|
|
8
8
|
Usage:
|
|
9
|
-
run402 agent contact --name <name> [--email <email>]
|
|
9
|
+
run402 agent contact --name <name> [--email <email>]
|
|
10
10
|
run402 agent status
|
|
11
11
|
run402 agent verify-email
|
|
12
12
|
run402 agent passkey enroll
|
|
@@ -14,13 +14,14 @@ Usage:
|
|
|
14
14
|
Notes:
|
|
15
15
|
- Free with SIWX auth
|
|
16
16
|
- Registers contact info so Run402 can reach your agent
|
|
17
|
-
- Only name is required; email
|
|
17
|
+
- Only name is required; email is optional
|
|
18
|
+
- The webhook is its own channel: run402 contacts webhook set <https_url>
|
|
18
19
|
- New or changed emails start reply verification
|
|
19
20
|
- Passkey enrollment requires email_verified
|
|
20
21
|
|
|
21
22
|
Examples:
|
|
22
23
|
run402 agent contact --name my-agent
|
|
23
|
-
run402 agent contact --name my-agent --email ops@example.com
|
|
24
|
+
run402 agent contact --name my-agent --email ops@example.com
|
|
24
25
|
run402 agent status
|
|
25
26
|
run402 agent verify-email
|
|
26
27
|
run402 agent passkey enroll
|
|
@@ -30,13 +31,11 @@ const SUB_HELP = {
|
|
|
30
31
|
contact: `run402 agent contact — Register agent contact info
|
|
31
32
|
|
|
32
33
|
Usage:
|
|
33
|
-
run402 agent contact --name <name> [--email <email>]
|
|
34
|
+
run402 agent contact --name <name> [--email <email>]
|
|
34
35
|
|
|
35
36
|
Options:
|
|
36
37
|
--name <name> Required: agent name (e.g. "my-agent")
|
|
37
38
|
--email <email> Optional: contact email address
|
|
38
|
-
--webhook <url> Optional: webhook URL Run402 can call to reach the
|
|
39
|
-
agent
|
|
40
39
|
|
|
41
40
|
Notes:
|
|
42
41
|
- Free with SIWX auth (run 'run402 init' first)
|
|
@@ -46,8 +45,7 @@ Notes:
|
|
|
46
45
|
|
|
47
46
|
Examples:
|
|
48
47
|
run402 agent contact --name my-agent
|
|
49
|
-
run402 agent contact --name my-agent --email ops@example.com
|
|
50
|
-
--webhook https://example.com/hook
|
|
48
|
+
run402 agent contact --name my-agent --email ops@example.com
|
|
51
49
|
`,
|
|
52
50
|
status: `run402 agent status — Get agent contact assurance status
|
|
53
51
|
|
|
@@ -79,26 +77,21 @@ whose verified email their principal holds.
|
|
|
79
77
|
|
|
80
78
|
async function contact(args) {
|
|
81
79
|
const parsedArgs = normalizeArgv(args);
|
|
82
|
-
const valueFlags = ["--name", "--email"
|
|
80
|
+
const valueFlags = ["--name", "--email"];
|
|
83
81
|
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
84
82
|
const extra = positionalArgs(parsedArgs, valueFlags);
|
|
85
83
|
if (extra.length > 0) {
|
|
86
84
|
fail({
|
|
87
85
|
code: "BAD_USAGE",
|
|
88
86
|
message: `Unexpected argument for agent contact: ${extra[0]}`,
|
|
89
|
-
hint: "Use `run402 agent contact --name <name> [--email <email>]
|
|
87
|
+
hint: "Use `run402 agent contact --name <name> [--email <email>]`.",
|
|
90
88
|
});
|
|
91
89
|
}
|
|
92
90
|
const name = flagValue(parsedArgs, "--name");
|
|
93
91
|
const email = flagValue(parsedArgs, "--email");
|
|
94
|
-
const webhook = flagValue(parsedArgs, "--webhook");
|
|
95
92
|
if (!name) {
|
|
96
93
|
fail({ code: "BAD_USAGE", message: "Missing --name <name>" });
|
|
97
94
|
}
|
|
98
|
-
// validate webhook scheme locally BEFORE the wallet check so
|
|
99
|
-
// bad URLs fail fast even without a wallet configured. No-op when
|
|
100
|
-
// --webhook is omitted (it's optional).
|
|
101
|
-
validateWebhookUrl(webhook, "--webhook");
|
|
102
95
|
// Preserve the aggressive early exit when no local wallet is configured.
|
|
103
96
|
walletAuthHeaders("/agent/v1/contact");
|
|
104
97
|
|
|
@@ -106,7 +99,6 @@ async function contact(args) {
|
|
|
106
99
|
const data = await getSdk().admin.setAgentContact({
|
|
107
100
|
name,
|
|
108
101
|
email: email ?? undefined,
|
|
109
|
-
webhook: webhook ?? undefined,
|
|
110
102
|
});
|
|
111
103
|
console.log(JSON.stringify(data, null, 2));
|
|
112
104
|
} catch (err) {
|
package/lib/billing.mjs
CHANGED
|
@@ -363,7 +363,7 @@ async function linkWallet(args) {
|
|
|
363
363
|
const parsedArgs = normalizeArgv(args);
|
|
364
364
|
assertKnownFlags(parsedArgs, ["--org", "--address", "--help", "-h"], ["--org", "--address"]);
|
|
365
365
|
const walletFlag = flagValue(parsedArgs, "--address");
|
|
366
|
-
const { orgId
|
|
366
|
+
const { orgId, rest } = await takeOrgPositional(parsedArgs, ["--org", "--address"], { cmd: "billing" });
|
|
367
367
|
const count = walletFlag ? 0 : 1;
|
|
368
368
|
requireRest(rest, {
|
|
369
369
|
min: count, max: count,
|
|
@@ -372,10 +372,10 @@ async function linkWallet(args) {
|
|
|
372
372
|
});
|
|
373
373
|
const wallet = walletFlag ?? rest[0];
|
|
374
374
|
try {
|
|
375
|
-
const data = await getSdk().billing.linkWallet(
|
|
375
|
+
const data = await getSdk().billing.linkWallet(orgId, wallet);
|
|
376
376
|
const output = {
|
|
377
377
|
status: data?.status ?? "ok",
|
|
378
|
-
org_id: data?.org_id ??
|
|
378
|
+
org_id: data?.org_id ?? orgId,
|
|
379
379
|
wallet: data?.wallet ?? wallet.toLowerCase(),
|
|
380
380
|
...(data?.pool_implications ? { pool_implications: data.pool_implications } : {}),
|
|
381
381
|
};
|
|
@@ -396,7 +396,7 @@ async function autoRecharge(args) {
|
|
|
396
396
|
const threshold = parsedArgs.includes("--threshold")
|
|
397
397
|
? parseIntegerFlag("--threshold", thresholdStr, { min: 0 })
|
|
398
398
|
: undefined;
|
|
399
|
-
const { orgId
|
|
399
|
+
const { orgId, rest } = await takeOrgPositional(parsedArgs, valueFlags, { cmd: "billing" });
|
|
400
400
|
const count = stateFlag ? 0 : 1;
|
|
401
401
|
requireRest(rest, {
|
|
402
402
|
min: count, max: count,
|
|
@@ -413,11 +413,11 @@ async function autoRecharge(args) {
|
|
|
413
413
|
}
|
|
414
414
|
try {
|
|
415
415
|
await getSdk().billing.setAutoRecharge({
|
|
416
|
-
|
|
416
|
+
orgId,
|
|
417
417
|
enabled: state === "on",
|
|
418
418
|
threshold,
|
|
419
419
|
});
|
|
420
|
-
console.log(JSON.stringify({ org_id:
|
|
420
|
+
console.log(JSON.stringify({ org_id: orgId, enabled: state === "on", updated: true }));
|
|
421
421
|
} catch (err) {
|
|
422
422
|
reportSdkError(err);
|
|
423
423
|
}
|
|
@@ -457,7 +457,7 @@ async function metering(args) {
|
|
|
457
457
|
const rechargeUsdMicros = parsedArgs.includes("--recharge") ? parseUsdFlag("--recharge", flagValue(parsedArgs, "--recharge")) : undefined;
|
|
458
458
|
const standingRaw = flagValue(parsedArgs, "--standing-order");
|
|
459
459
|
if (standingRaw !== null) assertAllowedValue(standingRaw, ["on", "off"], "--standing-order");
|
|
460
|
-
const { orgId
|
|
460
|
+
const { orgId, rest } = await takeOrgPositional(parsedArgs, valueFlags, { cmd: "billing" });
|
|
461
461
|
requireRest(rest, {
|
|
462
462
|
min: 0, max: 0,
|
|
463
463
|
command: "run402 billing metering [<org_id>] [--enable --cap <usd> | --disable] [--standing-order <on|off>] [--threshold <usd>] [--recharge <usd>]",
|
|
@@ -470,9 +470,9 @@ async function metering(args) {
|
|
|
470
470
|
// without on|off) keeps the current state for the part it does not name,
|
|
471
471
|
// so `--standing-order on` alone never turns metering off.
|
|
472
472
|
const needsCurrent = !writes || !(enable || disable) || (touchesStandingOrder && standingRaw === null);
|
|
473
|
-
const current = needsCurrent ? await sdk.billing.getMetering(
|
|
473
|
+
const current = needsCurrent ? await sdk.billing.getMetering(orgId) : null;
|
|
474
474
|
if (!writes) {
|
|
475
|
-
console.log(JSON.stringify({ org_id:
|
|
475
|
+
console.log(JSON.stringify({ org_id: orgId, metering: current }, null, 2));
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
478
478
|
const enabled = enable ? true : disable ? false : (current?.enabled ?? false);
|
|
@@ -483,7 +483,7 @@ async function metering(args) {
|
|
|
483
483
|
rechargeUsdMicros,
|
|
484
484
|
}
|
|
485
485
|
: undefined;
|
|
486
|
-
const data = await sdk.billing.setMetering({
|
|
486
|
+
const data = await sdk.billing.setMetering({ orgId, enabled, capUsdMicros, standingOrder });
|
|
487
487
|
console.log(JSON.stringify(data, null, 2));
|
|
488
488
|
if (data?.metering?.suspended_reason) {
|
|
489
489
|
console.error(`Metering is suspended (${data.metering.suspended_reason}): fund the allowance, raise the cap, or save a card; it resumes on the next daily pass.`);
|
|
@@ -503,10 +503,10 @@ async function card(args) {
|
|
|
503
503
|
const valueFlags = ["--org", "--return-url"];
|
|
504
504
|
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
505
505
|
const returnUrl = flagValue(parsedArgs, "--return-url");
|
|
506
|
-
const { orgId
|
|
506
|
+
const { orgId, rest } = await takeOrgPositional(parsedArgs, valueFlags, { cmd: "billing" });
|
|
507
507
|
requireRest(rest, { min: 0, max: 0, command: "run402 billing card setup [<org_id>] [--return-url <url>]" });
|
|
508
508
|
try {
|
|
509
|
-
const data = await getSdk().billing.createCardSetup(
|
|
509
|
+
const data = await getSdk().billing.createCardSetup(orgId, { returnUrl: returnUrl ?? undefined });
|
|
510
510
|
console.log(JSON.stringify(data, null, 2));
|
|
511
511
|
console.error(`Open setup_url in a browser to save a card for this organization (the link expires ${data.expires_at}); then run402 billing metering --standing-order on.`);
|
|
512
512
|
} catch (err) {
|
package/lib/buzz.mjs
CHANGED
|
@@ -150,9 +150,9 @@ async function adopt(args) {
|
|
|
150
150
|
const values = ["--org", "--identity-link", "--idempotency-key"];
|
|
151
151
|
assertKnownFlags(a, values, values);
|
|
152
152
|
requirePositionalCount(a, values, { min: 0, max: 0, command: "run402 buzz adopt direct [--org <org_id>] --identity-link <idlnk_id>" });
|
|
153
|
-
const
|
|
153
|
+
const orgId = await resolveOrgId(a, { cmd: "buzz" });
|
|
154
154
|
return invoke(() => getSdk({ authMode: "wallet" }).buzz.adopt({
|
|
155
|
-
|
|
155
|
+
orgId,
|
|
156
156
|
identityLinkId: requiredFlag(a, "--identity-link"),
|
|
157
157
|
idempotencyKey: flagValue(a, "--idempotency-key") ?? undefined,
|
|
158
158
|
}));
|
|
@@ -178,7 +178,7 @@ async function adoptionOffer(args) {
|
|
|
178
178
|
assertKnownFlags(a, values, values);
|
|
179
179
|
requirePositionalCount(a, values, { min: 0, max: 0, command: "run402 buzz adopt offer [--org <org_id>] --identity-link <idlnk_id>" });
|
|
180
180
|
const deploymentPath = flagValue(a, "--deployment-context-file");
|
|
181
|
-
const
|
|
181
|
+
const orgId = await resolveOrgId(a, { cmd: "buzz" });
|
|
182
182
|
return invoke(async () => {
|
|
183
183
|
const client = getSdk({ authMode: "wallet" });
|
|
184
184
|
const status = await client.buzz.status();
|
|
@@ -191,7 +191,7 @@ async function adoptionOffer(args) {
|
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
193
|
return client.buzz.offerAdoption({
|
|
194
|
-
|
|
194
|
+
orgId,
|
|
195
195
|
identityLinkId: requiredFlag(a, "--identity-link"),
|
|
196
196
|
deploymentContext: deploymentPath ? readJsonFile(deploymentPath, "--deployment-context-file") : undefined,
|
|
197
197
|
idempotencyKey: flagValue(a, "--idempotency-key") ?? undefined,
|
|
@@ -261,9 +261,9 @@ async function install(args) {
|
|
|
261
261
|
assertKnownFlags(a, values, values);
|
|
262
262
|
requirePositionalCount(a, values, { min: 0, max: 0, command: "run402 buzz install [--org <org_id>] --community <subject> [--authority <hex>]" });
|
|
263
263
|
const policyFile = flagValue(a, "--policy-file");
|
|
264
|
-
const
|
|
264
|
+
const orgId = await resolveOrgId(a, { cmd: "buzz" });
|
|
265
265
|
return invoke(() => getSdk().buzz.install({
|
|
266
|
-
|
|
266
|
+
orgId,
|
|
267
267
|
buzzCommunitySubject: requiredFlag(a, "--community"),
|
|
268
268
|
buzzCommunityAuthoritySubject: flagValue(a, "--authority") ?? undefined,
|
|
269
269
|
enrollmentPolicy: policyFile ? readJsonFile(policyFile, "--policy-file") : undefined,
|
|
@@ -278,7 +278,7 @@ async function enroll(args) {
|
|
|
278
278
|
const values = ["--org", "--status"];
|
|
279
279
|
assertKnownFlags(a, values, values);
|
|
280
280
|
requirePositionalCount(a, values, { min: 0, max: 0, command: "run402 buzz enroll list [--org <org_id>] [--status <state>]" });
|
|
281
|
-
return invoke(() => getSdk().buzz.enrollments.list({
|
|
281
|
+
return invoke(() => getSdk().buzz.enrollments.list({ orgId: flagValue(a, "--org") ?? undefined, status: flagValue(a, "--status") ?? undefined }));
|
|
282
282
|
}
|
|
283
283
|
if (operation === "show") {
|
|
284
284
|
const a = normalizeArgv(rest);
|
package/lib/command-manifest.mjs
CHANGED
|
@@ -277,6 +277,7 @@ export const COMMAND_MANIFEST = [
|
|
|
277
277
|
{ path: ["contacts", "rm"], positionals: [p("contact_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["c_1"], runStyle: "sub" },
|
|
278
278
|
{ path: ["contacts", "test"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
|
|
279
279
|
{ path: ["contacts", "preferences"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
|
|
280
|
+
{ path: ["contacts", "webhook"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
|
|
280
281
|
{ path: ["subscriptions", "add"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
|
|
281
282
|
{ path: ["subscriptions", "list"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [], runStyle: "sub" },
|
|
282
283
|
{ path: ["subscriptions", "rm"], positionals: [p("subscription_id")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["r_1"], runStyle: "sub" },
|
|
@@ -504,7 +505,7 @@ export const COMMAND_MANIFEST = [
|
|
|
504
505
|
{ path: ["contracts", "drain"], positionals: [p("signer_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["cwlt_gate1", "--to", "0x4444444444444444444444444444444444444444", "--confirm"] },
|
|
505
506
|
{ path: ["contracts", "delete"], positionals: [p("signer_id")], projectScoped: true, legacyPositionalProject: true, minimalArgs: ["cwlt_gate1", "--confirm"] },
|
|
506
507
|
|
|
507
|
-
// ── service / cache / doctor / notifications /
|
|
508
|
+
// ── service / cache / doctor / notifications / logs ─────
|
|
508
509
|
{ path: ["service", "status"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
|
|
509
510
|
{ path: ["service", "health"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
|
|
510
511
|
{ path: ["cache", "inspect"], positionals: [p("url")], projectScoped: false, legacyPositionalProject: false, minimalArgs: ["https://example.com/"] },
|
|
@@ -514,7 +515,6 @@ export const COMMAND_MANIFEST = [
|
|
|
514
515
|
// wallet/machine-wide, but the gate's contract is "accepts --project
|
|
515
516
|
// without rejecting it," which this satisfies.
|
|
516
517
|
{ path: ["doctor"], positionals: [], projectScoped: true, legacyPositionalProject: false, minimalArgs: ["--no-scan"], runStyle: "merged" },
|
|
517
|
-
{ path: ["webhook-secret", "rotate"], positionals: [], projectScoped: false, legacyPositionalProject: false, minimalArgs: [] },
|
|
518
518
|
// `run402 logs [<function>] --request-id <request_id>`: the optional positional is
|
|
519
519
|
// the function name (`run402 errors list` samples print it that way); it is
|
|
520
520
|
// never a project id.
|
package/lib/contacts.mjs
CHANGED
|
@@ -45,8 +45,12 @@ Usage:
|
|
|
45
45
|
run402 contacts add <email> [--level <1-10>] [--name <display>]
|
|
46
46
|
run402 contacts connect telegram [--label <name>]
|
|
47
47
|
run402 contacts rm <contact_id>
|
|
48
|
-
run402 contacts preferences
|
|
49
|
-
run402 contacts preferences set <key>=<value> [<key>=<value> ...]
|
|
48
|
+
run402 contacts preferences [--email <address>]
|
|
49
|
+
run402 contacts preferences set <key>=<value> [<key>=<value> ...] [--email <address>]
|
|
50
|
+
run402 contacts webhook
|
|
51
|
+
run402 contacts webhook set <https_url>
|
|
52
|
+
run402 contacts webhook rm
|
|
53
|
+
run402 contacts webhook rotate-secret
|
|
50
54
|
run402 contacts test [--source app|platform] [--type <event_type>] [--severity <level>]
|
|
51
55
|
|
|
52
56
|
Two kinds, one question:
|
|
@@ -58,6 +62,17 @@ Two kinds, one question:
|
|
|
58
62
|
|
|
59
63
|
Every row carries \`kind\`. \`rm\` takes either kind's id and works out which.
|
|
60
64
|
|
|
65
|
+
Preferences belong to the verified email a notice goes to, not to a wallet:
|
|
66
|
+
a wallet acts on its verified contact email, a person signed in with
|
|
67
|
+
\`run402 login\` on their own verified email (--email picks among several).
|
|
68
|
+
Keys: lifecycle_events (off|critical_only|all), threshold_alerts
|
|
69
|
+
(off|digest_only|immediate), digest_cadence (off|daily|weekly|monthly),
|
|
70
|
+
digest_day_of_week (1-7), digest_hour_utc (0-23), locale, timezone.
|
|
71
|
+
|
|
72
|
+
The webhook is the wallet's own channel. \`webhook set\` needs passkey
|
|
73
|
+
assurance ('run402 login'); the first URL prints its signing secret EXACTLY
|
|
74
|
+
once. \`webhook rotate-secret\` prints a new one; the previous stays valid 24h.
|
|
75
|
+
|
|
61
76
|
Notes:
|
|
62
77
|
- Adding an address with no verified contact email is ACCEPTED with a
|
|
63
78
|
reachability warning — you must be able to configure the chain before the
|
|
@@ -67,14 +82,14 @@ Notes:
|
|
|
67
82
|
|
|
68
83
|
async function preferences(args) {
|
|
69
84
|
const parsedArgs = normalizeArgv(args);
|
|
70
|
-
assertKnownFlags(parsedArgs, ["--help", "-h"]);
|
|
85
|
+
assertKnownFlags(parsedArgs, ["--help", "-h", "--email"]);
|
|
71
86
|
const positionals = positionalArgs(parsedArgs);
|
|
72
|
-
|
|
87
|
+
const email = flagValue(parsedArgs, "--email");
|
|
88
|
+
const opts = email ? { email } : {};
|
|
73
89
|
|
|
74
90
|
if (positionals.length === 0) {
|
|
75
|
-
// GET preferences
|
|
76
91
|
try {
|
|
77
|
-
const data = await getSdk().admin.getNotificationPreferences();
|
|
92
|
+
const data = await getSdk().admin.getNotificationPreferences(opts);
|
|
78
93
|
console.log(JSON.stringify(data, null, 2));
|
|
79
94
|
} catch (err) {
|
|
80
95
|
reportSdkError(err);
|
|
@@ -83,7 +98,7 @@ async function preferences(args) {
|
|
|
83
98
|
}
|
|
84
99
|
|
|
85
100
|
if (positionals[0] !== "set") {
|
|
86
|
-
fail({ code: "BAD_USAGE", message: "Usage: run402 contacts preferences [set <key>=<value> ...]" });
|
|
101
|
+
fail({ code: "BAD_USAGE", message: "Usage: run402 contacts preferences [set <key>=<value> ...] [--email <address>]" });
|
|
87
102
|
}
|
|
88
103
|
|
|
89
104
|
// SET — parse remaining positional args as key=value
|
|
@@ -95,22 +110,62 @@ async function preferences(args) {
|
|
|
95
110
|
}
|
|
96
111
|
const key = kv.slice(0, eq);
|
|
97
112
|
const rawValue = kv.slice(eq + 1);
|
|
98
|
-
|
|
99
|
-
patch[key] = Number(rawValue);
|
|
100
|
-
} else if (key === "webhook_url" && (rawValue === "null" || rawValue === "")) {
|
|
101
|
-
patch[key] = null;
|
|
102
|
-
} else {
|
|
103
|
-
patch[key] = rawValue;
|
|
104
|
-
}
|
|
113
|
+
patch[key] = key === "digest_day_of_week" || key === "digest_hour_utc" ? Number(rawValue) : rawValue;
|
|
105
114
|
}
|
|
106
115
|
try {
|
|
107
|
-
const data = await getSdk().admin.setNotificationPreferences(patch,
|
|
116
|
+
const data = await getSdk().admin.setNotificationPreferences(patch, opts);
|
|
108
117
|
console.log(JSON.stringify(data, null, 2));
|
|
109
118
|
} catch (err) {
|
|
110
119
|
reportSdkError(err);
|
|
111
120
|
}
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
async function webhook(args) {
|
|
124
|
+
const parsedArgs = normalizeArgv(args);
|
|
125
|
+
assertKnownFlags(parsedArgs, ["--help", "-h"]);
|
|
126
|
+
const positionals = positionalArgs(parsedArgs);
|
|
127
|
+
const verb = positionals[0];
|
|
128
|
+
const channels = getSdk().admin.channels;
|
|
129
|
+
try {
|
|
130
|
+
if (verb === undefined) {
|
|
131
|
+
console.log(JSON.stringify(await channels.getWebhook(), null, 2));
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (verb === "set") {
|
|
135
|
+
if (positionals.length !== 2) {
|
|
136
|
+
fail({ code: "BAD_USAGE", message: "Usage: run402 contacts webhook set <https_url>" });
|
|
137
|
+
}
|
|
138
|
+
walletAuthHeaders("/agent/v1/notifications/channels/webhook");
|
|
139
|
+
const data = await channels.setWebhook(positionals[1], await sessionProofs("/agent/v1/notifications/channels/webhook"));
|
|
140
|
+
console.log(JSON.stringify(data, null, 2));
|
|
141
|
+
if (data.webhook_signing_secret) {
|
|
142
|
+
console.error("");
|
|
143
|
+
console.error("⚠ Store this signing secret NOW — it will not be shown again.");
|
|
144
|
+
}
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
if (verb === "rm") {
|
|
148
|
+
walletAuthHeaders("/agent/v1/notifications/channels/webhook");
|
|
149
|
+
const data = await channels.removeWebhook(await sessionProofs("/agent/v1/notifications/channels/webhook"));
|
|
150
|
+
console.log(JSON.stringify(data, null, 2));
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
if (verb === "rotate-secret") {
|
|
154
|
+
walletAuthHeaders("/agent/v1/notifications/channels/webhook/rotate-secret");
|
|
155
|
+
const data = await channels.rotateWebhookSecret(await sessionProofs("/agent/v1/notifications/channels/webhook/rotate-secret"));
|
|
156
|
+
console.log(JSON.stringify(data, null, 2));
|
|
157
|
+
console.error("");
|
|
158
|
+
console.error("⚠ Store this secret NOW — it will not be shown again.");
|
|
159
|
+
console.error("⚠ Your previous secret remains valid for the next 24 hours.");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
} catch (err) {
|
|
163
|
+
reportSdkError(err);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
failUnknownSubcommand("contacts webhook", verb, { extraSubcommands: ["set", "rm", "rotate-secret"] });
|
|
167
|
+
}
|
|
168
|
+
|
|
114
169
|
// ---------------------------------------------------------------------------
|
|
115
170
|
// Telegram channel bindings — notification-channel-routing-telegram.
|
|
116
171
|
// ---------------------------------------------------------------------------
|
|
@@ -422,6 +477,9 @@ export async function run(sub, args) {
|
|
|
422
477
|
case "preferences":
|
|
423
478
|
await preferences(rest);
|
|
424
479
|
return;
|
|
480
|
+
case "webhook":
|
|
481
|
+
await webhook(rest);
|
|
482
|
+
return;
|
|
425
483
|
case "test":
|
|
426
484
|
// "Am I actually reachable?" — sends a synthetic event through the
|
|
427
485
|
// configured channels and subscriptions. It belongs to the noun that
|
package/lib/deliveries.mjs
CHANGED
|
@@ -45,7 +45,7 @@ async function list(args) {
|
|
|
45
45
|
assertKnownFlags(parsedArgs, [...valueFlags, "--help", "-h"], valueFlags);
|
|
46
46
|
const extra = positionalArgs(parsedArgs, valueFlags);
|
|
47
47
|
if (extra.length > 0) {
|
|
48
|
-
fail({ code: "BAD_USAGE", message: `Unexpected argument for
|
|
48
|
+
fail({ code: "BAD_USAGE", message: `Unexpected argument for deliveries list: ${extra[0]}` });
|
|
49
49
|
}
|
|
50
50
|
walletAuthHeaders("/agent/v1/notifications");
|
|
51
51
|
const opts = {};
|
package/lib/jobs.mjs
CHANGED
|
@@ -24,10 +24,10 @@ Usage:
|
|
|
24
24
|
|
|
25
25
|
Subcommands:
|
|
26
26
|
submit --file <path>|--stdin Submit a managed job request
|
|
27
|
-
get <job_id> Get a job
|
|
27
|
+
get <job_id> Get a job
|
|
28
28
|
logs <job_id> Read job logs
|
|
29
29
|
cancel <job_id> Cancel a queued or running job
|
|
30
|
-
purge Purge all
|
|
30
|
+
purge Purge all jobs for the project
|
|
31
31
|
artifacts get <job_id> --file <name> Download a completed job's artifact (legacy: <job_id> <file>)
|
|
32
32
|
|
|
33
33
|
Examples:
|
|
@@ -69,7 +69,7 @@ Example request:
|
|
|
69
69
|
dedupe on the Run402-Webhook-Id header and re-fetch with 'jobs get'
|
|
70
70
|
before acting.
|
|
71
71
|
`,
|
|
72
|
-
get: `run402 jobs get — Get a managed job
|
|
72
|
+
get: `run402 jobs get — Get a managed job
|
|
73
73
|
|
|
74
74
|
Usage:
|
|
75
75
|
run402 jobs get <job_id> [--project <project_id>]
|
|
@@ -87,7 +87,7 @@ Options:
|
|
|
87
87
|
--tail <n> Maximum entries to return (gateway max: 1000)
|
|
88
88
|
--since <iso> Only include logs at or after this ISO-8601 timestamp
|
|
89
89
|
`,
|
|
90
|
-
cancel: `run402 jobs cancel — Cancel a managed job
|
|
90
|
+
cancel: `run402 jobs cancel — Cancel a managed job
|
|
91
91
|
|
|
92
92
|
Usage:
|
|
93
93
|
run402 jobs cancel <job_id> [--project <project_id>]
|
|
@@ -95,7 +95,7 @@ Usage:
|
|
|
95
95
|
Options:
|
|
96
96
|
--project <project_id> Project ID (defaults to the active project)
|
|
97
97
|
`,
|
|
98
|
-
purge: `run402 jobs purge — Purge all managed
|
|
98
|
+
purge: `run402 jobs purge — Purge all managed jobs for a project
|
|
99
99
|
|
|
100
100
|
Usage:
|
|
101
101
|
run402 jobs purge [--project <project_id>]
|
|
@@ -103,7 +103,7 @@ Usage:
|
|
|
103
103
|
Options:
|
|
104
104
|
--project <project_id> Project ID (defaults to the active project)
|
|
105
105
|
|
|
106
|
-
Deletes all project
|
|
106
|
+
Deletes all of the project's managed-job records. Queued/running jobs are
|
|
107
107
|
included in the purge; known active runner instances are terminated first.
|
|
108
108
|
Prints { deleted_jobs, cancelled_active_jobs, terminated_instances }.
|
|
109
109
|
`,
|
package/lib/repos.mjs
CHANGED
|
@@ -2033,7 +2033,7 @@ async function invite(args) {
|
|
|
2033
2033
|
// The inviter's own message must not wake the inviter's next `messages wait`:
|
|
2034
2034
|
// advance this checkout's stored cursor past it (best-effort).
|
|
2035
2035
|
if (result.room?.room_key && result.room_message?.posted && typeof result.room_message.cursor === "string") {
|
|
2036
|
-
try { updateRoomState(result.room.
|
|
2036
|
+
try { updateRoomState(result.room.org_id, result.room.room_key, { cursor: result.room_message.cursor }); } catch { /* never fails a mint */ }
|
|
2037
2037
|
}
|
|
2038
2038
|
if (asJson) {
|
|
2039
2039
|
printJson(sdk, result);
|
|
@@ -2099,7 +2099,7 @@ async function joinInvite(args) {
|
|
|
2099
2099
|
try {
|
|
2100
2100
|
const dir = result.restored?.dir;
|
|
2101
2101
|
if (dir && existsSync(dir)) {
|
|
2102
|
-
updateRoomState(result.room.
|
|
2102
|
+
updateRoomState(result.room.org_id, result.room.room_key, {
|
|
2103
2103
|
...(result.presence ? { presence_id: result.presence.presence_id, name: result.presence.name } : {}),
|
|
2104
2104
|
...(typeof result.cursor === "string" ? { cursor: result.cursor } : {}),
|
|
2105
2105
|
}, { cwd: dir });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "run402",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.156.1",
|
|
4
4
|
"description": "CLI for Run402 — full-stack backend infrastructure for AI agents: Postgres, auth, storage, serverless functions and atomic deploys. Paid with x402/MPP. Includes $0.03 image generation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|