@ipab/cli 0.1.0-rc.7 → 0.1.0-rc.8
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/README.md +24 -1
- package/dist/app-authoring.d.ts.map +1 -1
- package/dist/app-authoring.js +2 -44
- package/dist/app-authoring.js.map +1 -1
- package/dist/app-prebuild.d.ts +18 -0
- package/dist/app-prebuild.d.ts.map +1 -1
- package/dist/app-prebuild.js +46 -0
- package/dist/app-prebuild.js.map +1 -1
- package/dist/builtins/skill.ipab.car +0 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +290 -152
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +9 -4
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +4 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +11 -2
- package/dist/context.js.map +1 -1
- package/dist/errors.d.ts +1 -8
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -20
- package/dist/errors.js.map +1 -1
- package/dist/host-error.d.ts +9 -0
- package/dist/host-error.d.ts.map +1 -0
- package/dist/host-error.js +21 -0
- package/dist/host-error.js.map +1 -0
- package/dist/ipc.d.ts.map +1 -1
- package/dist/ipc.js +17 -0
- package/dist/ipc.js.map +1 -1
- package/dist/kubo-install.js +1 -1
- package/dist/kubo-install.js.map +1 -1
- package/dist/kubo-peers.d.ts.map +1 -1
- package/dist/kubo-peers.js +2 -1
- package/dist/kubo-peers.js.map +1 -1
- package/dist/kubo-topology.d.ts +19 -0
- package/dist/kubo-topology.d.ts.map +1 -0
- package/dist/kubo-topology.js +105 -0
- package/dist/kubo-topology.js.map +1 -0
- package/dist/kubo.d.ts +10 -0
- package/dist/kubo.d.ts.map +1 -1
- package/dist/kubo.js +96 -15
- package/dist/kubo.js.map +1 -1
- package/dist/space-path.d.ts +3 -0
- package/dist/space-path.d.ts.map +1 -0
- package/dist/space-path.js +17 -0
- package/dist/space-path.js.map +1 -0
- package/dist/space.d.ts +1 -2
- package/dist/space.d.ts.map +1 -1
- package/dist/space.js +2 -15
- package/dist/space.js.map +1 -1
- package/dist/state-storage.js +1 -1
- package/dist/state-storage.js.map +1 -1
- package/dist/state.d.ts +2 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +31 -12
- package/dist/state.js.map +1 -1
- package/dist/swarm-files.d.ts +1 -1
- package/dist/swarm-files.d.ts.map +1 -1
- package/dist/swarm-files.js +2 -2
- package/dist/swarm-files.js.map +1 -1
- package/dist/swarm-meta.d.ts +1 -4
- package/dist/swarm-meta.d.ts.map +1 -1
- package/dist/swarm-meta.js +3 -34
- package/dist/swarm-meta.js.map +1 -1
- package/dist/swarm-observations.d.ts +40 -0
- package/dist/swarm-observations.d.ts.map +1 -0
- package/dist/swarm-observations.js +262 -0
- package/dist/swarm-observations.js.map +1 -0
- package/dist/swarm.d.ts +119 -6
- package/dist/swarm.d.ts.map +1 -1
- package/dist/swarm.js +662 -80
- package/dist/swarm.js.map +1 -1
- package/package.json +4 -4
- package/src/app-authoring.ts +12 -53
- package/src/app-prebuild.ts +61 -0
- package/src/cli.ts +370 -190
- package/src/config.ts +12 -4
- package/src/context.ts +15 -2
- package/src/errors.ts +1 -25
- package/src/host-error.ts +26 -0
- package/src/ipc.ts +19 -0
- package/src/kubo-install.ts +1 -1
- package/src/kubo-peers.ts +2 -3
- package/src/kubo-topology.ts +135 -0
- package/src/kubo.ts +134 -25
- package/src/space-path.ts +30 -0
- package/src/space.ts +2 -28
- package/src/state-storage.ts +1 -1
- package/src/state.ts +37 -12
- package/src/swarm-files.ts +2 -1
- package/src/swarm-meta.ts +15 -34
- package/src/swarm-observations.ts +374 -0
- package/src/swarm.ts +942 -91
package/src/cli.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
publicUrl,
|
|
13
13
|
stateLocation,
|
|
14
14
|
storeConfiguration,
|
|
15
|
+
swarmUrl,
|
|
15
16
|
visibleConfig,
|
|
16
17
|
type GlobalOptions,
|
|
17
18
|
} from "./config.js";
|
|
@@ -29,6 +30,7 @@ import { validatedBundle } from "./space.js";
|
|
|
29
30
|
import {
|
|
30
31
|
createAssociation,
|
|
31
32
|
exactCid,
|
|
33
|
+
swarmAlias,
|
|
32
34
|
State,
|
|
33
35
|
type Association,
|
|
34
36
|
type RunRecord,
|
|
@@ -46,6 +48,7 @@ import { doctorDevice, doctorText } from "./doctor.js";
|
|
|
46
48
|
import { keyId } from "@ipab/bundle/pointer/crypto";
|
|
47
49
|
import {
|
|
48
50
|
createSwarm,
|
|
51
|
+
swarmDaemon,
|
|
49
52
|
requestMembership,
|
|
50
53
|
approveMembership,
|
|
51
54
|
exportRequest,
|
|
@@ -55,12 +58,10 @@ import {
|
|
|
55
58
|
accountProfile,
|
|
56
59
|
updateAccountProfile,
|
|
57
60
|
swarmMembers,
|
|
61
|
+
inspectSwarmStatus,
|
|
58
62
|
verifiedRequest,
|
|
59
63
|
verifiedRequestStream,
|
|
60
64
|
membershipRequestSummary,
|
|
61
|
-
swarmHeader,
|
|
62
|
-
sharedSwarmStatus,
|
|
63
|
-
addSwarm,
|
|
64
65
|
updateSwarm,
|
|
65
66
|
searchNames,
|
|
66
67
|
formatNameReference,
|
|
@@ -155,36 +156,37 @@ export const processIO: IO = {
|
|
|
155
156
|
},
|
|
156
157
|
};
|
|
157
158
|
const commands: Record<string, string> = {
|
|
158
|
-
|
|
159
|
+
daemon: "daemon [--swarm URL_OR_ALIAS]",
|
|
160
|
+
"skills list": "skills list [--refresh | --no-refresh]",
|
|
159
161
|
"skills sync":
|
|
160
|
-
"skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--
|
|
162
|
+
"skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--refresh | --no-refresh]",
|
|
161
163
|
doctor: "doctor [--fix [--yes]]",
|
|
162
164
|
profile: "profile [--name NAME] [--description TEXT]",
|
|
163
165
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
164
|
-
"swarm request": "swarm request
|
|
166
|
+
"swarm request": "swarm request URL_OR_ALIAS [--output FILE]",
|
|
165
167
|
"swarm export": "swarm export --output FILE",
|
|
166
168
|
"swarm approve": "swarm approve REQUEST_FILE [--again] --yes",
|
|
167
169
|
"swarm exclude": "swarm exclude MEMBER_PUBLIC_KEY --yes",
|
|
168
170
|
"swarm resume": "swarm resume",
|
|
169
171
|
"swarm profile": "swarm profile --address MULTIADDR",
|
|
170
|
-
"swarm status": "swarm status [--
|
|
171
|
-
"swarm members": "swarm members",
|
|
172
|
+
"swarm status": "swarm status [--refresh | --no-refresh]",
|
|
173
|
+
"swarm members": "swarm members [--refresh | --no-refresh]",
|
|
172
174
|
"swarm list": "swarm list",
|
|
173
|
-
"swarm
|
|
175
|
+
"swarm set": "swarm set ALIAS CONFIG_URL [--yes]",
|
|
174
176
|
"swarm use": "swarm use URL_OR_ALIAS",
|
|
175
177
|
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
176
178
|
"swarm update": "swarm update [--name TEXT] [--description TEXT]",
|
|
177
179
|
publish: "publish NAME SOURCE [--expect OLD_CID | --snapshot]",
|
|
178
|
-
get: "get REF [--raw] [--
|
|
179
|
-
search: "search QUERY [--all | --current] [--
|
|
180
|
+
get: "get REF [--raw] [--refresh | --no-refresh] [-o DIRECTORY]",
|
|
181
|
+
search: "search QUERY [--all | --current] [--refresh | --no-refresh]",
|
|
180
182
|
"templates render": "templates render TEMPLATE NAME [DIR] [OPTIONS]",
|
|
181
183
|
build: "build [SOURCE] [OPTIONS]",
|
|
182
184
|
"bundle build": "bundle build SOURCE [OPTIONS]",
|
|
183
185
|
"bundle inspect": "bundle inspect SOURCE",
|
|
184
186
|
"bundle import": "bundle import FILE.car",
|
|
185
|
-
exec: "exec [--log] [--
|
|
186
|
-
open: "open [--log] [--raw] [--
|
|
187
|
-
pin: "pin REF",
|
|
187
|
+
exec: "exec [--log] [--refresh | --no-refresh] APP [APP_ARGS...]",
|
|
188
|
+
open: "open [--log] [--raw] [--refresh | --no-refresh] CONTENT",
|
|
189
|
+
pin: "pin REF [--refresh | --no-refresh]",
|
|
188
190
|
unpin: "unpin REF",
|
|
189
191
|
"pin list": "pin list",
|
|
190
192
|
"pin show": "pin show REF",
|
|
@@ -192,8 +194,8 @@ const commands: Record<string, string> = {
|
|
|
192
194
|
"register set":
|
|
193
195
|
"register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]",
|
|
194
196
|
"register remove": "register remove SCHEMA [--swarm URL_OR_ALIAS]...",
|
|
195
|
-
"templates list": "templates list [--
|
|
196
|
-
"templates show": "templates show NAME [--
|
|
197
|
+
"templates list": "templates list [--refresh | --no-refresh]",
|
|
198
|
+
"templates show": "templates show NAME [--refresh | --no-refresh]",
|
|
197
199
|
"templates set": "templates set NAME SOURCE [--expect OLD_TARGET_CID]",
|
|
198
200
|
"templates remove": "templates remove NAME --expect OLD_TARGET_CID",
|
|
199
201
|
"config get": "config get [KEY]",
|
|
@@ -228,10 +230,20 @@ const commandHelp: Record<
|
|
|
228
230
|
notes?: string[];
|
|
229
231
|
}
|
|
230
232
|
> = {
|
|
233
|
+
daemon: {
|
|
234
|
+
summary: "Manage existing private Swarm nodes in the foreground",
|
|
235
|
+
examples: ["ipab daemon", "ipab daemon --swarm work"],
|
|
236
|
+
notes: [
|
|
237
|
+
"Manages all registered Swarms independently, or only the explicitly selected --swarm; ignores the saved default.",
|
|
238
|
+
"Probes pivot candidates, refreshes approved profiles and retries with cooldown. Diagnostics go to stderr.",
|
|
239
|
+
"Ctrl-C / TERM drains operations and releases the device/state-dir lock; Kubo stays running. Run under your own supervisor if desired.",
|
|
240
|
+
"Role and relay candidate changes restart only the verified managed Kubo node.",
|
|
241
|
+
],
|
|
242
|
+
},
|
|
231
243
|
"templates list": {
|
|
232
244
|
summary: "List templates under the selected Swarm Meta templatePath",
|
|
233
245
|
options: [
|
|
234
|
-
"--
|
|
246
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
235
247
|
],
|
|
236
248
|
examples: [
|
|
237
249
|
"ipab --swarm work templates list",
|
|
@@ -247,7 +259,7 @@ const commandHelp: Record<
|
|
|
247
259
|
"NAME Safe relative template Name; nested names are supported.",
|
|
248
260
|
],
|
|
249
261
|
options: [
|
|
250
|
-
"--
|
|
262
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
251
263
|
],
|
|
252
264
|
examples: ["ipab --swarm work templates show node"],
|
|
253
265
|
},
|
|
@@ -285,7 +297,7 @@ const commandHelp: Record<
|
|
|
285
297
|
"skills list": {
|
|
286
298
|
summary: "List typed Skills and local installation status from one Swarm",
|
|
287
299
|
options: [
|
|
288
|
-
"--
|
|
300
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
289
301
|
"Global --json Emit machine-readable names, exact payload CIDs and status.",
|
|
290
302
|
],
|
|
291
303
|
examples: ["ipab --swarm work skills list", "ipab --json skills list"],
|
|
@@ -304,7 +316,7 @@ const commandHelp: Record<
|
|
|
304
316
|
"--agent AGENT Repeatable globally supported agent ID; default is detected agents.",
|
|
305
317
|
"--dry-run Preview without invoking npx or changing installed Skills.",
|
|
306
318
|
"--yes Skip IPAB consent only; conflicts and local edits remain protected.",
|
|
307
|
-
"--
|
|
319
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
308
320
|
],
|
|
309
321
|
examples: [
|
|
310
322
|
"ipab --swarm work skills sync --dry-run",
|
|
@@ -380,11 +392,10 @@ const commandHelp: Record<
|
|
|
380
392
|
"swarm request": {
|
|
381
393
|
summary: "Save and export a signed self-contained membership Request",
|
|
382
394
|
examples: [
|
|
383
|
-
"ipab swarm request
|
|
384
|
-
"ipab swarm request CONFIG_URL --output request.json
|
|
395
|
+
"ipab swarm request work",
|
|
396
|
+
"ipab swarm request CONFIG_URL --output request.json",
|
|
385
397
|
],
|
|
386
398
|
options: [
|
|
387
|
-
"--alias ALIAS Pre-register the target for lazy onboarding.",
|
|
388
399
|
"--output FILE Export to a new file instead of stdout; never overwrites.",
|
|
389
400
|
],
|
|
390
401
|
notes: [
|
|
@@ -394,7 +405,7 @@ const commandHelp: Record<
|
|
|
394
405
|
"Retries export the exact saved Request without expiry or a new PeerID.",
|
|
395
406
|
"No Invite, Response file, password or Join. Next normal use fetches and decrypts the approved package.",
|
|
396
407
|
"Set your account-wide personal name with ipab profile --name NAME before requesting membership.",
|
|
397
|
-
"
|
|
408
|
+
"Accepts a local alias or a configuration URL. Never changes local registrations, aliases or the saved default; use ipab swarm set ALIAS CONFIG_URL separately.",
|
|
398
409
|
],
|
|
399
410
|
},
|
|
400
411
|
"swarm approve": {
|
|
@@ -438,24 +449,35 @@ const commandHelp: Record<
|
|
|
438
449
|
},
|
|
439
450
|
"swarm members": {
|
|
440
451
|
summary: "List every public member, including the Owner",
|
|
441
|
-
|
|
452
|
+
options: [
|
|
453
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
454
|
+
"--local Deprecated no-op; local daemon observations are always included.",
|
|
455
|
+
],
|
|
456
|
+
examples: [
|
|
457
|
+
"ipab --swarm work swarm members",
|
|
458
|
+
"ipab --json swarm members --refresh",
|
|
459
|
+
],
|
|
442
460
|
notes: [
|
|
443
|
-
"
|
|
461
|
+
"Default: reuse the inspection cache, fetching public Variables if missing. Includes Pivot declarations and existing daemon observations; no HOME identity access, node activation or probes.",
|
|
462
|
+
"PIVOT: - for ordinary members; selected, cooldown, unknown, self or candidate for declared Pivots. Selected means applied configuration, not connectivity.",
|
|
444
463
|
],
|
|
445
464
|
},
|
|
446
465
|
"swarm status": {
|
|
447
|
-
summary: "
|
|
466
|
+
summary: "Inspect cached Swarm directory, HEAD and local networking",
|
|
448
467
|
options: [
|
|
449
|
-
"--
|
|
468
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
469
|
+
"--local Deprecated no-op; never activates a node.",
|
|
450
470
|
],
|
|
451
471
|
examples: [
|
|
452
472
|
"ipab swarm status",
|
|
453
473
|
"ipab --swarm work swarm status",
|
|
454
|
-
"ipab --swarm work swarm status --
|
|
474
|
+
"ipab --swarm work swarm status --refresh",
|
|
455
475
|
],
|
|
456
476
|
notes: [
|
|
457
|
-
"
|
|
458
|
-
"
|
|
477
|
+
"Default: reuse the inspection cache, fetching public Variables if missing. Refresh verifies Config, Scope, members, Profiles and HEAD, not connectivity or State content.",
|
|
478
|
+
"Always shows daemon freshness, Pivot selection, probes/cooldown and separately timestamped daemon connection snapshots. Never contacts Kubo, initializes HOME identity, changes remote profiles or activates a node.",
|
|
479
|
+
"State content is explicitly unavailable in inspection; use get ipab:/// to obtain the State Bundle.",
|
|
480
|
+
"Local connectivity is not global availability; a relay connection does not guarantee content transfer.",
|
|
459
481
|
],
|
|
460
482
|
},
|
|
461
483
|
"swarm list": {
|
|
@@ -463,13 +485,19 @@ const commandHelp: Record<
|
|
|
463
485
|
examples: ["ipab swarm list", "ipab --json swarm list"],
|
|
464
486
|
notes: ["Local only; does not verify remote membership or refresh HEAD."],
|
|
465
487
|
},
|
|
466
|
-
"swarm
|
|
467
|
-
summary: "
|
|
488
|
+
"swarm set": {
|
|
489
|
+
summary: "Set a local alias for a swarm configuration URL",
|
|
468
490
|
options: [
|
|
469
|
-
"--
|
|
491
|
+
"--yes Authorize retargeting an existing alias without prompting.",
|
|
492
|
+
],
|
|
493
|
+
examples: [
|
|
494
|
+
"ipab swarm set work CONFIG_URL",
|
|
495
|
+
"ipab swarm set work OTHER_CONFIG_URL --yes",
|
|
470
496
|
],
|
|
471
|
-
examples: ["ipab swarm add CONFIG_URL --alias work"],
|
|
472
497
|
notes: [
|
|
498
|
+
"Local only; no network, account identity or approved membership required.",
|
|
499
|
+
"Setting the same mapping is idempotent. One alias per URL; a new alias for that URL replaces its old alias.",
|
|
500
|
+
"Retargeting an alias requires confirmation or --yes. Keeps the old URL registered without that alias; credentials, caches and the saved default URL are unchanged.",
|
|
473
501
|
"Not a membership grant. The first registration becomes the saved default only if none exists.",
|
|
474
502
|
],
|
|
475
503
|
},
|
|
@@ -509,13 +537,13 @@ const commandHelp: Record<
|
|
|
509
537
|
options: [
|
|
510
538
|
"--all Search all registered swarms; conflicts with --current and --swarm.",
|
|
511
539
|
"--current Explicitly select the default search scope; conflicts with --swarm.",
|
|
512
|
-
"--
|
|
513
|
-
"--no-
|
|
540
|
+
"--refresh Refresh HEAD for every swarm in the search scope.",
|
|
541
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
514
542
|
],
|
|
515
543
|
examples: [
|
|
516
544
|
"ipab search hello",
|
|
517
545
|
"ipab search hello --all",
|
|
518
|
-
"ipab --swarm work search hello --
|
|
546
|
+
"ipab --swarm work search hello --refresh",
|
|
519
547
|
],
|
|
520
548
|
notes: [
|
|
521
549
|
"Searches only --swarm or the saved current swarm by default. Use --all to search every registration.",
|
|
@@ -548,8 +576,8 @@ const commandHelp: Record<
|
|
|
548
576
|
summary: "Verify and unpack Bundle content without executing it",
|
|
549
577
|
options: [
|
|
550
578
|
"--raw Select the Artifact node instead of its value.",
|
|
551
|
-
"--
|
|
552
|
-
"--no-
|
|
579
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
580
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
553
581
|
"-o, --output DIRECTORY New or empty directory; defaults to a unique temporary directory.",
|
|
554
582
|
],
|
|
555
583
|
examples: [
|
|
@@ -590,7 +618,7 @@ const commandHelp: Record<
|
|
|
590
618
|
],
|
|
591
619
|
options: [
|
|
592
620
|
"--description TEXT Set the declared description parameter.",
|
|
593
|
-
"--
|
|
621
|
+
"--refresh / --no-refresh Refresh Swarm HEAD now / allow its valid cached snapshot.",
|
|
594
622
|
"--param KEY=VALUE Template parameter; repeatable. Strings are literal;",
|
|
595
623
|
" other parameter types use JSON.",
|
|
596
624
|
],
|
|
@@ -669,8 +697,8 @@ const commandHelp: Record<
|
|
|
669
697
|
],
|
|
670
698
|
options: [
|
|
671
699
|
"--log Record stdout/stderr; must precede APP. Requires history enabled.",
|
|
672
|
-
"--
|
|
673
|
-
"--no-
|
|
700
|
+
"--refresh Refresh the shared Name's swarm HEAD; must precede APP.",
|
|
701
|
+
"--no-refresh Override swarm.forceRefresh; must precede APP.",
|
|
674
702
|
],
|
|
675
703
|
examples: [
|
|
676
704
|
"ipab exec reader",
|
|
@@ -693,16 +721,17 @@ const commandHelp: Record<
|
|
|
693
721
|
options: [
|
|
694
722
|
"--log Record stdout/stderr; requires history enabled.",
|
|
695
723
|
"--raw Open the Artifact node rather than its value.",
|
|
696
|
-
"--
|
|
697
|
-
"--no-
|
|
724
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
725
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
698
726
|
],
|
|
699
727
|
examples: [
|
|
700
728
|
"ipab open CONTENT_CID",
|
|
701
|
-
"ipab open --log
|
|
702
|
-
"ipab open ipab:///
|
|
729
|
+
"ipab open --log --refresh ipab:///documents/readme",
|
|
730
|
+
"ipab open ipab:///",
|
|
703
731
|
],
|
|
704
732
|
notes: [
|
|
705
733
|
"Requires a saved registration and App support for the exact content type.",
|
|
734
|
+
"An empty URI Name (ipab:/// or ipab://ALIAS/) resolves to that Swarm's verified root State CID, not its publication CID. The root binding cannot be overwritten.",
|
|
706
735
|
"Uses only the content URI's Swarm, otherwise --swarm, otherwise swarm.default. A selected Swarm is required.",
|
|
707
736
|
"A registered App's retrieval, compatibility or execution failure never triggers fallback.",
|
|
708
737
|
"Legacy User registrations are inactive and preserved in the state database's legacy_user_registrations table; review them before explicit Swarm registration.",
|
|
@@ -717,6 +746,9 @@ const commandHelp: Record<
|
|
|
717
746
|
arguments: [
|
|
718
747
|
"REF Exact Bundle CID or ipab://SWARM/NAME; no local content aliases.",
|
|
719
748
|
],
|
|
749
|
+
options: [
|
|
750
|
+
"--refresh / --no-refresh Refresh shared HEAD now / allow its valid cached snapshot.",
|
|
751
|
+
],
|
|
720
752
|
examples: [
|
|
721
753
|
"ipab pin APP_CID",
|
|
722
754
|
"ipab pin ipab://work/apps/reader",
|
|
@@ -923,7 +955,18 @@ ${footer}`;
|
|
|
923
955
|
return [
|
|
924
956
|
`${topic.summary}.\n\nUsage: ipab [GLOBAL_OPTIONS] ${usage}`,
|
|
925
957
|
...(topic.arguments ? [section("Arguments", topic.arguments)] : []),
|
|
926
|
-
...(topic.options
|
|
958
|
+
...(topic.options
|
|
959
|
+
? [
|
|
960
|
+
section(
|
|
961
|
+
"Options",
|
|
962
|
+
topic.options.map((line) =>
|
|
963
|
+
line.startsWith("--refresh")
|
|
964
|
+
? `${line} Legacy aliases: --force/--no-force.`
|
|
965
|
+
: line,
|
|
966
|
+
),
|
|
967
|
+
),
|
|
968
|
+
]
|
|
969
|
+
: []),
|
|
927
970
|
section("Examples", topic.examples),
|
|
928
971
|
...([
|
|
929
972
|
"swarm status",
|
|
@@ -976,11 +1019,17 @@ export function formatSearchResults(
|
|
|
976
1019
|
matches: Awaited<ReturnType<typeof searchNames>>["matches"],
|
|
977
1020
|
): string {
|
|
978
1021
|
return matches.length
|
|
979
|
-
?
|
|
980
|
-
.map(
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1022
|
+
? alignedRows(
|
|
1023
|
+
matches.map((match) => [
|
|
1024
|
+
match.alias ?? match.swarm,
|
|
1025
|
+
match.name,
|
|
1026
|
+
match.targetCid,
|
|
1027
|
+
]),
|
|
1028
|
+
)
|
|
1029
|
+
.map((row, index) => {
|
|
1030
|
+
const match = matches[index]!;
|
|
1031
|
+
return `${row}\n ipab get ${formatNameReference(match.alias ?? match.swarm, match.name)}`;
|
|
1032
|
+
})
|
|
984
1033
|
.join("\n")
|
|
985
1034
|
: "No matching Names.";
|
|
986
1035
|
}
|
|
@@ -1027,26 +1076,24 @@ function storageBytes(bytes: number): string {
|
|
|
1027
1076
|
: `${scaled.toLocaleString("en-US", { maximumFractionDigits: 2 })} ${units[unit]} (${exact} bytes)`;
|
|
1028
1077
|
}
|
|
1029
1078
|
|
|
1030
|
-
function
|
|
1031
|
-
if (!rows.length) return empty;
|
|
1079
|
+
function alignedRows(rows: string[][]): string[] {
|
|
1032
1080
|
const cells = rows.map((row) => row.map(printable));
|
|
1033
|
-
const widths =
|
|
1034
|
-
cells.reduce(
|
|
1035
|
-
(width, row) => Math.max(width, stringWidth(row[column]!)),
|
|
1036
|
-
stringWidth(header),
|
|
1037
|
-
),
|
|
1081
|
+
const widths = (cells[0] ?? []).map((_, column) =>
|
|
1082
|
+
cells.reduce((width, row) => Math.max(width, stringWidth(row[column]!)), 0),
|
|
1038
1083
|
);
|
|
1039
|
-
return
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
.
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1084
|
+
return cells.map((row) =>
|
|
1085
|
+
row
|
|
1086
|
+
.map((cell, column) =>
|
|
1087
|
+
column === widths.length - 1
|
|
1088
|
+
? cell
|
|
1089
|
+
: cell.padEnd(cell.length + widths[column]! - stringWidth(cell)),
|
|
1090
|
+
)
|
|
1091
|
+
.join(" "),
|
|
1092
|
+
);
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
function table(headers: string[], rows: string[][], empty: string): string {
|
|
1096
|
+
return rows.length ? alignedRows([headers, ...rows]).join("\n") : empty;
|
|
1050
1097
|
}
|
|
1051
1098
|
|
|
1052
1099
|
function runDetails(record: RunRecord): string {
|
|
@@ -1091,6 +1138,12 @@ interface Parsed {
|
|
|
1091
1138
|
help: boolean;
|
|
1092
1139
|
version: boolean;
|
|
1093
1140
|
}
|
|
1141
|
+
function validateRefreshOptions(options: Parsed["options"]): void {
|
|
1142
|
+
const positive = ["refresh", "force"].find((key) => options[key]);
|
|
1143
|
+
const negative = ["no-refresh", "no-force"].find((key) => options[key]);
|
|
1144
|
+
if (positive && negative)
|
|
1145
|
+
syntax(`--${positive} and --${negative} are mutually exclusive.`);
|
|
1146
|
+
}
|
|
1094
1147
|
|
|
1095
1148
|
async function closeStore(
|
|
1096
1149
|
store: IpfsStore | undefined,
|
|
@@ -1174,14 +1227,17 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1174
1227
|
if (!group) return result;
|
|
1175
1228
|
if (group === "exec") {
|
|
1176
1229
|
if (flags.json) syntax("--json is not supported for exec/open.");
|
|
1177
|
-
while (
|
|
1230
|
+
while (
|
|
1231
|
+
["--log", "--force", "--no-force", "--refresh", "--no-refresh"].includes(
|
|
1232
|
+
tokens[0] ?? "",
|
|
1233
|
+
)
|
|
1234
|
+
) {
|
|
1178
1235
|
const option = tokens.shift()!.slice(2);
|
|
1179
1236
|
if (Object.hasOwn(result.options, option))
|
|
1180
1237
|
syntax(`Duplicate option --${option}.`);
|
|
1181
1238
|
result.options[option] = true;
|
|
1182
1239
|
}
|
|
1183
|
-
|
|
1184
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1240
|
+
validateRefreshOptions(result.options);
|
|
1185
1241
|
if (tokens[0] === "-h" || tokens[0] === "--help") {
|
|
1186
1242
|
result.help = true;
|
|
1187
1243
|
return result;
|
|
@@ -1199,6 +1255,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1199
1255
|
"get",
|
|
1200
1256
|
"search",
|
|
1201
1257
|
"doctor",
|
|
1258
|
+
"daemon",
|
|
1202
1259
|
"profile",
|
|
1203
1260
|
"unpin",
|
|
1204
1261
|
].includes(group)
|
|
@@ -1230,6 +1287,10 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1230
1287
|
} else result.path = `${group} ${tokens.shift()!}`;
|
|
1231
1288
|
} else if (group === "open" && flags.json)
|
|
1232
1289
|
syntax("--json is not supported for exec/open.");
|
|
1290
|
+
if (result.path === "swarm add")
|
|
1291
|
+
syntax(
|
|
1292
|
+
"swarm add was removed. Use ipab swarm set ALIAS CONFIG_URL for local naming, then ipab swarm request ALIAS to request membership.",
|
|
1293
|
+
);
|
|
1233
1294
|
if (!commands[result.path]) syntax(`Unknown command "${result.path}".`);
|
|
1234
1295
|
if (group === "skills" && swarms.length > 1)
|
|
1235
1296
|
syntax(
|
|
@@ -1277,9 +1338,9 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1277
1338
|
? ["all", "current", "force", "no-force"]
|
|
1278
1339
|
: result.path === "swarm approve"
|
|
1279
1340
|
? ["yes", "again"]
|
|
1280
|
-
:
|
|
1281
|
-
? ["local"]
|
|
1282
|
-
:
|
|
1341
|
+
: ["swarm status", "swarm members"].includes(result.path)
|
|
1342
|
+
? ["local", "force", "no-force"]
|
|
1343
|
+
: ["swarm exclude", "swarm set"].includes(result.path)
|
|
1283
1344
|
? ["yes"]
|
|
1284
1345
|
: result.path === "register set"
|
|
1285
1346
|
? ["replace"]
|
|
@@ -1287,45 +1348,46 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1287
1348
|
? ["yes"]
|
|
1288
1349
|
: result.path === "open"
|
|
1289
1350
|
? ["log", "raw", "force", "no-force"]
|
|
1290
|
-
:
|
|
1351
|
+
: result.path === "pin"
|
|
1352
|
+
? ["force", "no-force"]
|
|
1353
|
+
: [];
|
|
1354
|
+
if (booleans.includes("force")) booleans.push("refresh", "no-refresh");
|
|
1291
1355
|
const values =
|
|
1292
1356
|
result.path === "swarm create"
|
|
1293
1357
|
? ["service", "resume", "name", "description", "alias"]
|
|
1294
|
-
: result.path === "swarm
|
|
1295
|
-
? ["
|
|
1296
|
-
: result.path === "swarm
|
|
1297
|
-
? ["
|
|
1298
|
-
: result.path === "swarm
|
|
1299
|
-
? ["
|
|
1300
|
-
: result.path === "swarm profile"
|
|
1301
|
-
? ["
|
|
1302
|
-
: result.path === "swarm
|
|
1303
|
-
? [
|
|
1304
|
-
:
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
? ["
|
|
1310
|
-
: result.path === "
|
|
1311
|
-
? ["
|
|
1312
|
-
: result.path === "
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
? [
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
:
|
|
1327
|
-
? ["app", "status", "since", "until"]
|
|
1328
|
-
: [];
|
|
1358
|
+
: result.path === "swarm request"
|
|
1359
|
+
? ["output"]
|
|
1360
|
+
: result.path === "swarm export"
|
|
1361
|
+
? ["output"]
|
|
1362
|
+
: result.path === "swarm profile"
|
|
1363
|
+
? ["address"]
|
|
1364
|
+
: result.path === "swarm update" || result.path === "profile"
|
|
1365
|
+
? ["name", "description"]
|
|
1366
|
+
: result.path === "swarm approve"
|
|
1367
|
+
? []
|
|
1368
|
+
: ["publish", "templates set", "templates remove"].includes(
|
|
1369
|
+
result.path,
|
|
1370
|
+
)
|
|
1371
|
+
? ["expect"]
|
|
1372
|
+
: result.path === "get"
|
|
1373
|
+
? ["output"]
|
|
1374
|
+
: result.path === "templates render"
|
|
1375
|
+
? ["description"]
|
|
1376
|
+
: result.path === "bundle build" ||
|
|
1377
|
+
result.path === "build"
|
|
1378
|
+
? ["output"]
|
|
1379
|
+
: result.path === "history list"
|
|
1380
|
+
? [
|
|
1381
|
+
"app",
|
|
1382
|
+
"status",
|
|
1383
|
+
"since",
|
|
1384
|
+
"until",
|
|
1385
|
+
"limit",
|
|
1386
|
+
"before",
|
|
1387
|
+
]
|
|
1388
|
+
: result.path === "history remove"
|
|
1389
|
+
? ["app", "status", "since", "until"]
|
|
1390
|
+
: [];
|
|
1329
1391
|
while (tokens.length) {
|
|
1330
1392
|
const value = tokens.shift()!;
|
|
1331
1393
|
if (
|
|
@@ -1335,6 +1397,14 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1335
1397
|
result.positional.push(value);
|
|
1336
1398
|
} else if (value.startsWith("--") || value === "-o") {
|
|
1337
1399
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
1400
|
+
if (result.path === "daemon" && option === "swarm") {
|
|
1401
|
+
const input = tokens.shift();
|
|
1402
|
+
if (!input || input.startsWith("-")) syntax("--swarm needs a value.");
|
|
1403
|
+
if (flags.swarm !== undefined)
|
|
1404
|
+
syntax("daemon accepts --swarm at most once.");
|
|
1405
|
+
flags.swarm = input;
|
|
1406
|
+
continue;
|
|
1407
|
+
}
|
|
1338
1408
|
if (result.path === "skills sync" && option === "agent") {
|
|
1339
1409
|
const input = tokens.shift();
|
|
1340
1410
|
if (!input || input.startsWith("-")) syntax("--agent needs a value.");
|
|
@@ -1359,6 +1429,10 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1359
1429
|
(result.parameters ??= []).push(input);
|
|
1360
1430
|
continue;
|
|
1361
1431
|
}
|
|
1432
|
+
if (result.path === "swarm request" && option === "alias")
|
|
1433
|
+
syntax(
|
|
1434
|
+
"swarm request --alias was removed. First run ipab swarm set ALIAS CONFIG_URL, then ipab swarm request ALIAS.",
|
|
1435
|
+
);
|
|
1362
1436
|
if (Object.hasOwn(result.options, option))
|
|
1363
1437
|
syntax(`Duplicate option ${value}.`);
|
|
1364
1438
|
if (booleans.includes(option)) result.options[option] = true;
|
|
@@ -1385,8 +1459,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1385
1459
|
else syntax(`Unknown option "${value}".`);
|
|
1386
1460
|
} else result.positional.push(value);
|
|
1387
1461
|
}
|
|
1388
|
-
|
|
1389
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1462
|
+
validateRefreshOptions(result.options);
|
|
1390
1463
|
if (
|
|
1391
1464
|
result.path === "search" &&
|
|
1392
1465
|
result.options.current &&
|
|
@@ -1407,6 +1480,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1407
1480
|
"register list accepts --swarm at most once. Select one Swarm or omit it to use the current Swarm.",
|
|
1408
1481
|
);
|
|
1409
1482
|
const counts: Record<string, [number, number]> = {
|
|
1483
|
+
daemon: [0, 0],
|
|
1410
1484
|
doctor: [0, 0],
|
|
1411
1485
|
"skills list": [0, 0],
|
|
1412
1486
|
"skills sync": [0, Number.MAX_SAFE_INTEGER],
|
|
@@ -1421,7 +1495,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1421
1495
|
"swarm status": [0, 0],
|
|
1422
1496
|
"swarm members": [0, 0],
|
|
1423
1497
|
"swarm list": [0, 0],
|
|
1424
|
-
"swarm
|
|
1498
|
+
"swarm set": [2, 2],
|
|
1425
1499
|
"swarm use": [1, 1],
|
|
1426
1500
|
"swarm remove": [1, 1],
|
|
1427
1501
|
"swarm update": [0, 0],
|
|
@@ -1627,9 +1701,12 @@ async function performCli(
|
|
|
1627
1701
|
}
|
|
1628
1702
|
const items = effectiveConfig(
|
|
1629
1703
|
state.config({
|
|
1630
|
-
includeSecrets:
|
|
1631
|
-
|
|
1632
|
-
|
|
1704
|
+
includeSecrets: ![
|
|
1705
|
+
"swarm members",
|
|
1706
|
+
"profile",
|
|
1707
|
+
"swarm status",
|
|
1708
|
+
"swarm set",
|
|
1709
|
+
].includes(parsed.path),
|
|
1633
1710
|
}),
|
|
1634
1711
|
parsed.flags,
|
|
1635
1712
|
env,
|
|
@@ -1664,11 +1741,13 @@ async function performCli(
|
|
|
1664
1741
|
stateDir: stateLocation(parsed.flags, env).path,
|
|
1665
1742
|
cacheTtl: Number(value("swarm.cacheTtl")),
|
|
1666
1743
|
listen: value("swarm.listen") === "loopback" ? "loopback" : "lan",
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
?
|
|
1671
|
-
:
|
|
1744
|
+
pivot: Boolean(value("swarm.pivot")),
|
|
1745
|
+
forceRefresh:
|
|
1746
|
+
parsed.options.refresh || parsed.options.force
|
|
1747
|
+
? true
|
|
1748
|
+
: parsed.options["no-refresh"] || parsed.options["no-force"]
|
|
1749
|
+
? false
|
|
1750
|
+
: Boolean(value("swarm.forceRefresh")),
|
|
1672
1751
|
diagnostic: (text) => {
|
|
1673
1752
|
io.err(text);
|
|
1674
1753
|
},
|
|
@@ -1975,9 +2054,11 @@ async function performCli(
|
|
|
1975
2054
|
})),
|
|
1976
2055
|
},
|
|
1977
2056
|
[
|
|
1978
|
-
...
|
|
1979
|
-
(entry) =>
|
|
1980
|
-
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${
|
|
2057
|
+
...alignedRows(
|
|
2058
|
+
result.swarms.map((entry) => [
|
|
2059
|
+
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${entry.alias ?? entry.cid}`,
|
|
2060
|
+
entry.cid,
|
|
2061
|
+
]),
|
|
1981
2062
|
),
|
|
1982
2063
|
...(result.swarms.length ? [] : ["No registered Swarms."]),
|
|
1983
2064
|
...(result.effectiveCurrent === null
|
|
@@ -2014,7 +2095,61 @@ async function performCli(
|
|
|
2014
2095
|
);
|
|
2015
2096
|
break;
|
|
2016
2097
|
}
|
|
2017
|
-
case "swarm
|
|
2098
|
+
case "swarm set": {
|
|
2099
|
+
swarmAlias(first!);
|
|
2100
|
+
const cid = swarmUrl(second!);
|
|
2101
|
+
const previous = state.swarms().find((entry) => entry.alias === first);
|
|
2102
|
+
if (previous && previous.cid !== cid) {
|
|
2103
|
+
io.err(`Swarm alias ${first}: ${previous.cid} -> ${cid}`);
|
|
2104
|
+
if (
|
|
2105
|
+
!parsed.options.yes &&
|
|
2106
|
+
(!io.tty ||
|
|
2107
|
+
!(await io.confirm(
|
|
2108
|
+
`Retarget local Swarm alias "${first}" from ${previous.cid} to ${cid}?`,
|
|
2109
|
+
)))
|
|
2110
|
+
)
|
|
2111
|
+
throw new HostError(
|
|
2112
|
+
"Alias unchanged. Retargeting requires --yes or interactive confirmation.",
|
|
2113
|
+
);
|
|
2114
|
+
}
|
|
2115
|
+
const entry = state.setSwarm(first!, cid, previous?.cid ?? null);
|
|
2116
|
+
emit(
|
|
2117
|
+
{
|
|
2118
|
+
configUrl: entry.cid,
|
|
2119
|
+
alias: entry.alias,
|
|
2120
|
+
savedCurrent:
|
|
2121
|
+
state.config({ includeSecrets: false })["swarm.default"] ?? null,
|
|
2122
|
+
},
|
|
2123
|
+
`Set local swarm alias ${entry.alias} (${cid}).`,
|
|
2124
|
+
);
|
|
2125
|
+
break;
|
|
2126
|
+
}
|
|
2127
|
+
case "daemon": {
|
|
2128
|
+
if (parsed.flags.json)
|
|
2129
|
+
syntax(
|
|
2130
|
+
"--json is not supported for daemon; diagnostics are written to stderr.",
|
|
2131
|
+
);
|
|
2132
|
+
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
2133
|
+
const controller = new AbortController();
|
|
2134
|
+
const interrupt = () => {
|
|
2135
|
+
controller.abort();
|
|
2136
|
+
};
|
|
2137
|
+
process.once("SIGINT", interrupt);
|
|
2138
|
+
process.once("SIGTERM", interrupt);
|
|
2139
|
+
try {
|
|
2140
|
+
await swarmDaemon(
|
|
2141
|
+
swarmContext(),
|
|
2142
|
+
parsed.flags.swarm === undefined ? undefined : requireSwarm(),
|
|
2143
|
+
controller.signal,
|
|
2144
|
+
);
|
|
2145
|
+
} catch (cause) {
|
|
2146
|
+
if (!controller.signal.aborted) throw cause;
|
|
2147
|
+
} finally {
|
|
2148
|
+
process.removeListener("SIGINT", interrupt);
|
|
2149
|
+
process.removeListener("SIGTERM", interrupt);
|
|
2150
|
+
}
|
|
2151
|
+
break;
|
|
2152
|
+
}
|
|
2018
2153
|
case "swarm update":
|
|
2019
2154
|
case "search":
|
|
2020
2155
|
case "skills list":
|
|
@@ -2090,20 +2225,33 @@ async function performCli(
|
|
|
2090
2225
|
break;
|
|
2091
2226
|
}
|
|
2092
2227
|
if (parsed.path === "swarm members") {
|
|
2093
|
-
const result = await swarmMembers(
|
|
2228
|
+
const result = await swarmMembers(
|
|
2229
|
+
context,
|
|
2230
|
+
requireSwarm(),
|
|
2231
|
+
Boolean(parsed.options.refresh || parsed.options.force),
|
|
2232
|
+
);
|
|
2094
2233
|
emit(
|
|
2095
2234
|
result,
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
result.
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
member
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2235
|
+
[
|
|
2236
|
+
`Directory: ${result.cache.source} (${result.cache.freshness}), observed ${result.cache.updatedAt}`,
|
|
2237
|
+
`Daemon: ${result.local.status}, observed ${result.local.updatedAt ?? "unknown"}; control-plane verified ${result.local.verifiedAt ?? "unknown"}`,
|
|
2238
|
+
table(
|
|
2239
|
+
["NAME", "DESCRIPTION", "ROLE", "PIVOT", "PUBLIC KEY"],
|
|
2240
|
+
result.members.map((member) => [
|
|
2241
|
+
member.name,
|
|
2242
|
+
member.description,
|
|
2243
|
+
member.role,
|
|
2244
|
+
member.pivot ? (member.localStatus ?? "candidate") : "-",
|
|
2245
|
+
member.publicKey,
|
|
2246
|
+
]),
|
|
2247
|
+
"No members.",
|
|
2248
|
+
),
|
|
2249
|
+
].join("\n"),
|
|
2106
2250
|
);
|
|
2251
|
+
if (result.local.error)
|
|
2252
|
+
io.err(
|
|
2253
|
+
`Local Pivot observations (${result.local.status}): ${printable(result.local.error)}`,
|
|
2254
|
+
);
|
|
2107
2255
|
break;
|
|
2108
2256
|
}
|
|
2109
2257
|
if (parsed.path === "swarm export") {
|
|
@@ -2160,28 +2308,6 @@ async function performCli(
|
|
|
2160
2308
|
);
|
|
2161
2309
|
break;
|
|
2162
2310
|
}
|
|
2163
|
-
if (parsed.path === "swarm add") {
|
|
2164
|
-
const cid = state.resolveSwarm(first!);
|
|
2165
|
-
await addSwarm(
|
|
2166
|
-
context,
|
|
2167
|
-
cid,
|
|
2168
|
-
typeof parsed.options.alias === "string"
|
|
2169
|
-
? parsed.options.alias
|
|
2170
|
-
: undefined,
|
|
2171
|
-
);
|
|
2172
|
-
const entry = state.registeredSwarm(cid);
|
|
2173
|
-
emit(
|
|
2174
|
-
{
|
|
2175
|
-
configUrl: entry.cid,
|
|
2176
|
-
alias: entry.alias,
|
|
2177
|
-
savedCurrent:
|
|
2178
|
-
state.config({ includeSecrets: false })["swarm.default"] ??
|
|
2179
|
-
null,
|
|
2180
|
-
},
|
|
2181
|
-
`Registered swarm ${entry.alias ?? cid} (${cid}).`,
|
|
2182
|
-
);
|
|
2183
|
-
break;
|
|
2184
|
-
}
|
|
2185
2311
|
if (parsed.path === "search") {
|
|
2186
2312
|
const registrations = state.swarms();
|
|
2187
2313
|
const scope = parsed.options.all
|
|
@@ -2200,10 +2326,17 @@ async function performCli(
|
|
|
2200
2326
|
}
|
|
2201
2327
|
if (parsed.path === "swarm status") {
|
|
2202
2328
|
const cid = requireSwarm();
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2329
|
+
const {
|
|
2330
|
+
head,
|
|
2331
|
+
config,
|
|
2332
|
+
networking,
|
|
2333
|
+
cache,
|
|
2334
|
+
state: contentState,
|
|
2335
|
+
} = await inspectSwarmStatus(
|
|
2336
|
+
context,
|
|
2337
|
+
cid,
|
|
2338
|
+
Boolean(parsed.options.refresh || parsed.options.force),
|
|
2339
|
+
);
|
|
2207
2340
|
const fingerprint = await keyId(config.owner);
|
|
2208
2341
|
store = context.store;
|
|
2209
2342
|
emit(
|
|
@@ -2212,12 +2345,11 @@ async function performCli(
|
|
|
2212
2345
|
owner: config.owner,
|
|
2213
2346
|
ownerFingerprint: fingerprint,
|
|
2214
2347
|
epoch: config.epoch,
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
: {}),
|
|
2348
|
+
scopeId: config.scopeId,
|
|
2349
|
+
headId: config.headId,
|
|
2350
|
+
cache,
|
|
2351
|
+
state: contentState,
|
|
2352
|
+
networking,
|
|
2221
2353
|
root: head.root,
|
|
2222
2354
|
valueCid: head.cid,
|
|
2223
2355
|
properties: {
|
|
@@ -2227,6 +2359,7 @@ async function performCli(
|
|
|
2227
2359
|
},
|
|
2228
2360
|
[
|
|
2229
2361
|
"Swarm",
|
|
2362
|
+
` Directory: ${cache.source} (${cache.freshness}), observed ${cache.updatedAt}`,
|
|
2230
2363
|
` Name: ${printable(config.name)}`,
|
|
2231
2364
|
` Description: ${config.description ? printable(config.description) : "(none)"}`,
|
|
2232
2365
|
" Config URL:",
|
|
@@ -2235,23 +2368,69 @@ async function performCli(
|
|
|
2235
2368
|
"Identity",
|
|
2236
2369
|
" Owner fingerprint:",
|
|
2237
2370
|
` ${fingerprint}`,
|
|
2238
|
-
...(local
|
|
2239
|
-
? [
|
|
2240
|
-
" PeerID:",
|
|
2241
|
-
` ${context.node!.peerId}`,
|
|
2242
|
-
"",
|
|
2243
|
-
"Local addresses",
|
|
2244
|
-
...context.node!.addresses.map(
|
|
2245
|
-
(address) => ` ${printable(address)}`,
|
|
2246
|
-
),
|
|
2247
|
-
]
|
|
2248
|
-
: []),
|
|
2249
2371
|
"",
|
|
2250
2372
|
"Content",
|
|
2251
2373
|
" HEAD (publication root):",
|
|
2252
2374
|
` ${head.root}`,
|
|
2253
2375
|
" Content CID (HEAD value):",
|
|
2254
2376
|
` ${head.cid}`,
|
|
2377
|
+
` State: ${contentState.status}. ${contentState.error}`,
|
|
2378
|
+
"",
|
|
2379
|
+
"Local networking",
|
|
2380
|
+
` Daemon observations: ${networking.daemon.status}`,
|
|
2381
|
+
` Updated: ${networking.daemon.updatedAt ?? "unknown"}`,
|
|
2382
|
+
` Control-plane verified: ${networking.daemon.verifiedAt ?? "unknown"}`,
|
|
2383
|
+
...(networking.daemon.error
|
|
2384
|
+
? [` Observation error: ${printable(networking.daemon.error)}`]
|
|
2385
|
+
: []),
|
|
2386
|
+
` Connections observed: ${networking.connections.observedAt ?? "unknown"} (${networking.connections.freshness})`,
|
|
2387
|
+
...(networking.connections.error
|
|
2388
|
+
? [
|
|
2389
|
+
` Connection error: ${printable(networking.connections.error)}`,
|
|
2390
|
+
]
|
|
2391
|
+
: []),
|
|
2392
|
+
table(
|
|
2393
|
+
[
|
|
2394
|
+
"PIVOT PEER ID",
|
|
2395
|
+
"LOCAL",
|
|
2396
|
+
"PROBE",
|
|
2397
|
+
"PROBED AT",
|
|
2398
|
+
"FAILURES",
|
|
2399
|
+
"RETRY AT",
|
|
2400
|
+
"CONNECTION",
|
|
2401
|
+
],
|
|
2402
|
+
networking.pivots.map((pivot) => [
|
|
2403
|
+
pivot.peerId,
|
|
2404
|
+
pivot.localStatus ?? "unknown",
|
|
2405
|
+
`${pivot.probe.result} (${pivot.probe.freshness})`,
|
|
2406
|
+
pivot.probe.at ?? "-",
|
|
2407
|
+
pivot.failures === null ? "-" : String(pivot.failures),
|
|
2408
|
+
pivot.retryAt ?? "-",
|
|
2409
|
+
pivot.connection.status,
|
|
2410
|
+
]),
|
|
2411
|
+
"No declared Pivots.",
|
|
2412
|
+
),
|
|
2413
|
+
...networking.pivots.flatMap((pivot) =>
|
|
2414
|
+
pivot.probe.error
|
|
2415
|
+
? [
|
|
2416
|
+
` ${pivot.peerId} probe error: ${printable(pivot.probe.error)}`,
|
|
2417
|
+
]
|
|
2418
|
+
: [],
|
|
2419
|
+
),
|
|
2420
|
+
...(networking.connections.error
|
|
2421
|
+
? []
|
|
2422
|
+
: [
|
|
2423
|
+
table(
|
|
2424
|
+
["CONNECTED PEER ID", "TRANSPORT", "ADDRESS"],
|
|
2425
|
+
networking.connections.peers.map((peer) => [
|
|
2426
|
+
peer.peerId,
|
|
2427
|
+
peer.transport,
|
|
2428
|
+
peer.address,
|
|
2429
|
+
]),
|
|
2430
|
+
"No observed peer connections.",
|
|
2431
|
+
),
|
|
2432
|
+
]),
|
|
2433
|
+
" Selected is configuration, not connection success. Relay connectivity does not guarantee content availability.",
|
|
2255
2434
|
].join("\n"),
|
|
2256
2435
|
);
|
|
2257
2436
|
break;
|
|
@@ -2332,14 +2511,15 @@ async function performCli(
|
|
|
2332
2511
|
: {}),
|
|
2333
2512
|
});
|
|
2334
2513
|
} else if (parsed.path === "swarm request") {
|
|
2335
|
-
const result = await requestMembership(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2514
|
+
const result = await requestMembership(
|
|
2515
|
+
context,
|
|
2516
|
+
state.resolveSwarm(first!),
|
|
2517
|
+
{
|
|
2518
|
+
...(typeof parsed.options.output === "string"
|
|
2519
|
+
? { output: parsed.options.output }
|
|
2520
|
+
: {}),
|
|
2521
|
+
},
|
|
2522
|
+
);
|
|
2343
2523
|
store = context.store;
|
|
2344
2524
|
io.err(
|
|
2345
2525
|
`Owner fingerprint: ${result.ownerFingerprint}\nVerify this fingerprint through an independent trusted channel before manually sending the Request file to the Owner.`,
|