@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/dist/cli.js
CHANGED
|
@@ -5,19 +5,19 @@ import { ContentBundleError } from "@ipab/bundle";
|
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { CID } from "multiformats/cid";
|
|
7
7
|
import stringWidth from "string-width";
|
|
8
|
-
import { configKey, effectiveConfig, parseValue, publicUrl, stateLocation, storeConfiguration, visibleConfig, } from "./config.js";
|
|
8
|
+
import { configKey, effectiveConfig, parseValue, publicUrl, stateLocation, storeConfiguration, swarmUrl, visibleConfig, } from "./config.js";
|
|
9
9
|
import { HostError, message, object, syntax } from "./errors.js";
|
|
10
10
|
import { filters, listHistory, selectedIds, Ownership, recoverInactive, removeHistory, } from "./history.js";
|
|
11
11
|
import { execute } from "./runtime.js";
|
|
12
12
|
import { validatedBundle } from "./space.js";
|
|
13
|
-
import { createAssociation, exactCid, State, } from "./state.js";
|
|
13
|
+
import { createAssociation, exactCid, swarmAlias, State, } from "./state.js";
|
|
14
14
|
import { buildBundle, inspectBundle, importBundle, nodeError, } from "./authoring.js";
|
|
15
15
|
import { initApp } from "./app-authoring.js";
|
|
16
16
|
import { assembleBundle } from "./assembly.js";
|
|
17
17
|
import { getBundle } from "./get.js";
|
|
18
18
|
import { doctorDevice, doctorText } from "./doctor.js";
|
|
19
19
|
import { keyId } from "@ipab/bundle/pointer/crypto";
|
|
20
|
-
import { createSwarm, requestMembership, approveMembership, exportRequest, removeMember, resumeRemoval, updateProfile, accountProfile, updateAccountProfile, swarmMembers, verifiedRequest, verifiedRequestStream, membershipRequestSummary,
|
|
20
|
+
import { createSwarm, swarmDaemon, requestMembership, approveMembership, exportRequest, removeMember, resumeRemoval, updateProfile, accountProfile, updateAccountProfile, swarmMembers, inspectSwarmStatus, verifiedRequest, verifiedRequestStream, membershipRequestSummary, updateSwarm, searchNames, formatNameReference, resolveReference, parseNameReference, formalName, publish, pinNameSubscription, pinReference, swarmRegistrations, swarmAssociation, setSwarmAssociation, removeSwarmAssociation, resolveTemplateSelector, templateName, swarmTemplates, setSwarmTemplate, removeSwarmTemplate, } from "./swarm.js";
|
|
21
21
|
import { schemaAlias } from "./app-definition.js";
|
|
22
22
|
import { unpin, pinDetails } from "./pins.js";
|
|
23
23
|
import { publicationSource } from "./publish-source.js";
|
|
@@ -71,43 +71,44 @@ export const processIO = {
|
|
|
71
71
|
},
|
|
72
72
|
};
|
|
73
73
|
const commands = {
|
|
74
|
-
|
|
75
|
-
"skills
|
|
74
|
+
daemon: "daemon [--swarm URL_OR_ALIAS]",
|
|
75
|
+
"skills list": "skills list [--refresh | --no-refresh]",
|
|
76
|
+
"skills sync": "skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--refresh | --no-refresh]",
|
|
76
77
|
doctor: "doctor [--fix [--yes]]",
|
|
77
78
|
profile: "profile [--name NAME] [--description TEXT]",
|
|
78
79
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
79
|
-
"swarm request": "swarm request
|
|
80
|
+
"swarm request": "swarm request URL_OR_ALIAS [--output FILE]",
|
|
80
81
|
"swarm export": "swarm export --output FILE",
|
|
81
82
|
"swarm approve": "swarm approve REQUEST_FILE [--again] --yes",
|
|
82
83
|
"swarm exclude": "swarm exclude MEMBER_PUBLIC_KEY --yes",
|
|
83
84
|
"swarm resume": "swarm resume",
|
|
84
85
|
"swarm profile": "swarm profile --address MULTIADDR",
|
|
85
|
-
"swarm status": "swarm status [--
|
|
86
|
-
"swarm members": "swarm members",
|
|
86
|
+
"swarm status": "swarm status [--refresh | --no-refresh]",
|
|
87
|
+
"swarm members": "swarm members [--refresh | --no-refresh]",
|
|
87
88
|
"swarm list": "swarm list",
|
|
88
|
-
"swarm
|
|
89
|
+
"swarm set": "swarm set ALIAS CONFIG_URL [--yes]",
|
|
89
90
|
"swarm use": "swarm use URL_OR_ALIAS",
|
|
90
91
|
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
91
92
|
"swarm update": "swarm update [--name TEXT] [--description TEXT]",
|
|
92
93
|
publish: "publish NAME SOURCE [--expect OLD_CID | --snapshot]",
|
|
93
|
-
get: "get REF [--raw] [--
|
|
94
|
-
search: "search QUERY [--all | --current] [--
|
|
94
|
+
get: "get REF [--raw] [--refresh | --no-refresh] [-o DIRECTORY]",
|
|
95
|
+
search: "search QUERY [--all | --current] [--refresh | --no-refresh]",
|
|
95
96
|
"templates render": "templates render TEMPLATE NAME [DIR] [OPTIONS]",
|
|
96
97
|
build: "build [SOURCE] [OPTIONS]",
|
|
97
98
|
"bundle build": "bundle build SOURCE [OPTIONS]",
|
|
98
99
|
"bundle inspect": "bundle inspect SOURCE",
|
|
99
100
|
"bundle import": "bundle import FILE.car",
|
|
100
|
-
exec: "exec [--log] [--
|
|
101
|
-
open: "open [--log] [--raw] [--
|
|
102
|
-
pin: "pin REF",
|
|
101
|
+
exec: "exec [--log] [--refresh | --no-refresh] APP [APP_ARGS...]",
|
|
102
|
+
open: "open [--log] [--raw] [--refresh | --no-refresh] CONTENT",
|
|
103
|
+
pin: "pin REF [--refresh | --no-refresh]",
|
|
103
104
|
unpin: "unpin REF",
|
|
104
105
|
"pin list": "pin list",
|
|
105
106
|
"pin show": "pin show REF",
|
|
106
107
|
"register list": "register list [--swarm URL_OR_ALIAS]",
|
|
107
108
|
"register set": "register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]",
|
|
108
109
|
"register remove": "register remove SCHEMA [--swarm URL_OR_ALIAS]...",
|
|
109
|
-
"templates list": "templates list [--
|
|
110
|
-
"templates show": "templates show NAME [--
|
|
110
|
+
"templates list": "templates list [--refresh | --no-refresh]",
|
|
111
|
+
"templates show": "templates show NAME [--refresh | --no-refresh]",
|
|
111
112
|
"templates set": "templates set NAME SOURCE [--expect OLD_TARGET_CID]",
|
|
112
113
|
"templates remove": "templates remove NAME --expect OLD_TARGET_CID",
|
|
113
114
|
"config get": "config get [KEY]",
|
|
@@ -131,10 +132,20 @@ const groups = {
|
|
|
131
132
|
history: "View and remove execution history",
|
|
132
133
|
};
|
|
133
134
|
const commandHelp = {
|
|
135
|
+
daemon: {
|
|
136
|
+
summary: "Manage existing private Swarm nodes in the foreground",
|
|
137
|
+
examples: ["ipab daemon", "ipab daemon --swarm work"],
|
|
138
|
+
notes: [
|
|
139
|
+
"Manages all registered Swarms independently, or only the explicitly selected --swarm; ignores the saved default.",
|
|
140
|
+
"Probes pivot candidates, refreshes approved profiles and retries with cooldown. Diagnostics go to stderr.",
|
|
141
|
+
"Ctrl-C / TERM drains operations and releases the device/state-dir lock; Kubo stays running. Run under your own supervisor if desired.",
|
|
142
|
+
"Role and relay candidate changes restart only the verified managed Kubo node.",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
134
145
|
"templates list": {
|
|
135
146
|
summary: "List templates under the selected Swarm Meta templatePath",
|
|
136
147
|
options: [
|
|
137
|
-
"--
|
|
148
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
138
149
|
],
|
|
139
150
|
examples: [
|
|
140
151
|
"ipab --swarm work templates list",
|
|
@@ -150,7 +161,7 @@ const commandHelp = {
|
|
|
150
161
|
"NAME Safe relative template Name; nested names are supported.",
|
|
151
162
|
],
|
|
152
163
|
options: [
|
|
153
|
-
"--
|
|
164
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
154
165
|
],
|
|
155
166
|
examples: ["ipab --swarm work templates show node"],
|
|
156
167
|
},
|
|
@@ -187,7 +198,7 @@ const commandHelp = {
|
|
|
187
198
|
"skills list": {
|
|
188
199
|
summary: "List typed Skills and local installation status from one Swarm",
|
|
189
200
|
options: [
|
|
190
|
-
"--
|
|
201
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
191
202
|
"Global --json Emit machine-readable names, exact payload CIDs and status.",
|
|
192
203
|
],
|
|
193
204
|
examples: ["ipab --swarm work skills list", "ipab --json skills list"],
|
|
@@ -205,7 +216,7 @@ const commandHelp = {
|
|
|
205
216
|
"--agent AGENT Repeatable globally supported agent ID; default is detected agents.",
|
|
206
217
|
"--dry-run Preview without invoking npx or changing installed Skills.",
|
|
207
218
|
"--yes Skip IPAB consent only; conflicts and local edits remain protected.",
|
|
208
|
-
"--
|
|
219
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
209
220
|
],
|
|
210
221
|
examples: [
|
|
211
222
|
"ipab --swarm work skills sync --dry-run",
|
|
@@ -280,11 +291,10 @@ const commandHelp = {
|
|
|
280
291
|
"swarm request": {
|
|
281
292
|
summary: "Save and export a signed self-contained membership Request",
|
|
282
293
|
examples: [
|
|
283
|
-
"ipab swarm request
|
|
284
|
-
"ipab swarm request CONFIG_URL --output request.json
|
|
294
|
+
"ipab swarm request work",
|
|
295
|
+
"ipab swarm request CONFIG_URL --output request.json",
|
|
285
296
|
],
|
|
286
297
|
options: [
|
|
287
|
-
"--alias ALIAS Pre-register the target for lazy onboarding.",
|
|
288
298
|
"--output FILE Export to a new file instead of stdout; never overwrites.",
|
|
289
299
|
],
|
|
290
300
|
notes: [
|
|
@@ -294,7 +304,7 @@ const commandHelp = {
|
|
|
294
304
|
"Retries export the exact saved Request without expiry or a new PeerID.",
|
|
295
305
|
"No Invite, Response file, password or Join. Next normal use fetches and decrypts the approved package.",
|
|
296
306
|
"Set your account-wide personal name with ipab profile --name NAME before requesting membership.",
|
|
297
|
-
"
|
|
307
|
+
"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.",
|
|
298
308
|
],
|
|
299
309
|
},
|
|
300
310
|
"swarm approve": {
|
|
@@ -338,24 +348,35 @@ const commandHelp = {
|
|
|
338
348
|
},
|
|
339
349
|
"swarm members": {
|
|
340
350
|
summary: "List every public member, including the Owner",
|
|
341
|
-
|
|
351
|
+
options: [
|
|
352
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
353
|
+
"--local Deprecated no-op; local daemon observations are always included.",
|
|
354
|
+
],
|
|
355
|
+
examples: [
|
|
356
|
+
"ipab --swarm work swarm members",
|
|
357
|
+
"ipab --json swarm members --refresh",
|
|
358
|
+
],
|
|
342
359
|
notes: [
|
|
343
|
-
"
|
|
360
|
+
"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.",
|
|
361
|
+
"PIVOT: - for ordinary members; selected, cooldown, unknown, self or candidate for declared Pivots. Selected means applied configuration, not connectivity.",
|
|
344
362
|
],
|
|
345
363
|
},
|
|
346
364
|
"swarm status": {
|
|
347
|
-
summary: "
|
|
365
|
+
summary: "Inspect cached Swarm directory, HEAD and local networking",
|
|
348
366
|
options: [
|
|
349
|
-
"--
|
|
367
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
368
|
+
"--local Deprecated no-op; never activates a node.",
|
|
350
369
|
],
|
|
351
370
|
examples: [
|
|
352
371
|
"ipab swarm status",
|
|
353
372
|
"ipab --swarm work swarm status",
|
|
354
|
-
"ipab --swarm work swarm status --
|
|
373
|
+
"ipab --swarm work swarm status --refresh",
|
|
355
374
|
],
|
|
356
375
|
notes: [
|
|
357
|
-
"
|
|
358
|
-
"
|
|
376
|
+
"Default: reuse the inspection cache, fetching public Variables if missing. Refresh verifies Config, Scope, members, Profiles and HEAD, not connectivity or State content.",
|
|
377
|
+
"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.",
|
|
378
|
+
"State content is explicitly unavailable in inspection; use get ipab:/// to obtain the State Bundle.",
|
|
379
|
+
"Local connectivity is not global availability; a relay connection does not guarantee content transfer.",
|
|
359
380
|
],
|
|
360
381
|
},
|
|
361
382
|
"swarm list": {
|
|
@@ -363,13 +384,19 @@ const commandHelp = {
|
|
|
363
384
|
examples: ["ipab swarm list", "ipab --json swarm list"],
|
|
364
385
|
notes: ["Local only; does not verify remote membership or refresh HEAD."],
|
|
365
386
|
},
|
|
366
|
-
"swarm
|
|
367
|
-
summary: "
|
|
387
|
+
"swarm set": {
|
|
388
|
+
summary: "Set a local alias for a swarm configuration URL",
|
|
368
389
|
options: [
|
|
369
|
-
"--
|
|
390
|
+
"--yes Authorize retargeting an existing alias without prompting.",
|
|
391
|
+
],
|
|
392
|
+
examples: [
|
|
393
|
+
"ipab swarm set work CONFIG_URL",
|
|
394
|
+
"ipab swarm set work OTHER_CONFIG_URL --yes",
|
|
370
395
|
],
|
|
371
|
-
examples: ["ipab swarm add CONFIG_URL --alias work"],
|
|
372
396
|
notes: [
|
|
397
|
+
"Local only; no network, account identity or approved membership required.",
|
|
398
|
+
"Setting the same mapping is idempotent. One alias per URL; a new alias for that URL replaces its old alias.",
|
|
399
|
+
"Retargeting an alias requires confirmation or --yes. Keeps the old URL registered without that alias; credentials, caches and the saved default URL are unchanged.",
|
|
373
400
|
"Not a membership grant. The first registration becomes the saved default only if none exists.",
|
|
374
401
|
],
|
|
375
402
|
},
|
|
@@ -409,13 +436,13 @@ const commandHelp = {
|
|
|
409
436
|
options: [
|
|
410
437
|
"--all Search all registered swarms; conflicts with --current and --swarm.",
|
|
411
438
|
"--current Explicitly select the default search scope; conflicts with --swarm.",
|
|
412
|
-
"--
|
|
413
|
-
"--no-
|
|
439
|
+
"--refresh Refresh HEAD for every swarm in the search scope.",
|
|
440
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
414
441
|
],
|
|
415
442
|
examples: [
|
|
416
443
|
"ipab search hello",
|
|
417
444
|
"ipab search hello --all",
|
|
418
|
-
"ipab --swarm work search hello --
|
|
445
|
+
"ipab --swarm work search hello --refresh",
|
|
419
446
|
],
|
|
420
447
|
notes: [
|
|
421
448
|
"Searches only --swarm or the saved current swarm by default. Use --all to search every registration.",
|
|
@@ -448,8 +475,8 @@ const commandHelp = {
|
|
|
448
475
|
summary: "Verify and unpack Bundle content without executing it",
|
|
449
476
|
options: [
|
|
450
477
|
"--raw Select the Artifact node instead of its value.",
|
|
451
|
-
"--
|
|
452
|
-
"--no-
|
|
478
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
479
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
453
480
|
"-o, --output DIRECTORY New or empty directory; defaults to a unique temporary directory.",
|
|
454
481
|
],
|
|
455
482
|
examples: [
|
|
@@ -490,7 +517,7 @@ const commandHelp = {
|
|
|
490
517
|
],
|
|
491
518
|
options: [
|
|
492
519
|
"--description TEXT Set the declared description parameter.",
|
|
493
|
-
"--
|
|
520
|
+
"--refresh / --no-refresh Refresh Swarm HEAD now / allow its valid cached snapshot.",
|
|
494
521
|
"--param KEY=VALUE Template parameter; repeatable. Strings are literal;",
|
|
495
522
|
" other parameter types use JSON.",
|
|
496
523
|
],
|
|
@@ -569,8 +596,8 @@ const commandHelp = {
|
|
|
569
596
|
],
|
|
570
597
|
options: [
|
|
571
598
|
"--log Record stdout/stderr; must precede APP. Requires history enabled.",
|
|
572
|
-
"--
|
|
573
|
-
"--no-
|
|
599
|
+
"--refresh Refresh the shared Name's swarm HEAD; must precede APP.",
|
|
600
|
+
"--no-refresh Override swarm.forceRefresh; must precede APP.",
|
|
574
601
|
],
|
|
575
602
|
examples: [
|
|
576
603
|
"ipab exec reader",
|
|
@@ -593,16 +620,17 @@ const commandHelp = {
|
|
|
593
620
|
options: [
|
|
594
621
|
"--log Record stdout/stderr; requires history enabled.",
|
|
595
622
|
"--raw Open the Artifact node rather than its value.",
|
|
596
|
-
"--
|
|
597
|
-
"--no-
|
|
623
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
624
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
598
625
|
],
|
|
599
626
|
examples: [
|
|
600
627
|
"ipab open CONTENT_CID",
|
|
601
|
-
"ipab open --log
|
|
602
|
-
"ipab open ipab:///
|
|
628
|
+
"ipab open --log --refresh ipab:///documents/readme",
|
|
629
|
+
"ipab open ipab:///",
|
|
603
630
|
],
|
|
604
631
|
notes: [
|
|
605
632
|
"Requires a saved registration and App support for the exact content type.",
|
|
633
|
+
"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.",
|
|
606
634
|
"Uses only the content URI's Swarm, otherwise --swarm, otherwise swarm.default. A selected Swarm is required.",
|
|
607
635
|
"A registered App's retrieval, compatibility or execution failure never triggers fallback.",
|
|
608
636
|
"Legacy User registrations are inactive and preserved in the state database's legacy_user_registrations table; review them before explicit Swarm registration.",
|
|
@@ -617,6 +645,9 @@ const commandHelp = {
|
|
|
617
645
|
arguments: [
|
|
618
646
|
"REF Exact Bundle CID or ipab://SWARM/NAME; no local content aliases.",
|
|
619
647
|
],
|
|
648
|
+
options: [
|
|
649
|
+
"--refresh / --no-refresh Refresh shared HEAD now / allow its valid cached snapshot.",
|
|
650
|
+
],
|
|
620
651
|
examples: [
|
|
621
652
|
"ipab pin APP_CID",
|
|
622
653
|
"ipab pin ipab://work/apps/reader",
|
|
@@ -820,7 +851,13 @@ ${footer}`;
|
|
|
820
851
|
return [
|
|
821
852
|
`${topic.summary}.\n\nUsage: ipab [GLOBAL_OPTIONS] ${usage}`,
|
|
822
853
|
...(topic.arguments ? [section("Arguments", topic.arguments)] : []),
|
|
823
|
-
...(topic.options
|
|
854
|
+
...(topic.options
|
|
855
|
+
? [
|
|
856
|
+
section("Options", topic.options.map((line) => line.startsWith("--refresh")
|
|
857
|
+
? `${line} Legacy aliases: --force/--no-force.`
|
|
858
|
+
: line)),
|
|
859
|
+
]
|
|
860
|
+
: []),
|
|
824
861
|
section("Examples", topic.examples),
|
|
825
862
|
...([
|
|
826
863
|
"swarm status",
|
|
@@ -867,8 +904,15 @@ function printable(text) {
|
|
|
867
904
|
}
|
|
868
905
|
export function formatSearchResults(matches) {
|
|
869
906
|
return matches.length
|
|
870
|
-
? matches
|
|
871
|
-
|
|
907
|
+
? alignedRows(matches.map((match) => [
|
|
908
|
+
match.alias ?? match.swarm,
|
|
909
|
+
match.name,
|
|
910
|
+
match.targetCid,
|
|
911
|
+
]))
|
|
912
|
+
.map((row, index) => {
|
|
913
|
+
const match = matches[index];
|
|
914
|
+
return `${row}\n ipab get ${formatNameReference(match.alias ?? match.swarm, match.name)}`;
|
|
915
|
+
})
|
|
872
916
|
.join("\n")
|
|
873
917
|
: "No matching Names.";
|
|
874
918
|
}
|
|
@@ -911,18 +955,17 @@ function storageBytes(bytes) {
|
|
|
911
955
|
? `${exact} bytes`
|
|
912
956
|
: `${scaled.toLocaleString("en-US", { maximumFractionDigits: 2 })} ${units[unit]} (${exact} bytes)`;
|
|
913
957
|
}
|
|
914
|
-
function
|
|
915
|
-
if (!rows.length)
|
|
916
|
-
return empty;
|
|
958
|
+
function alignedRows(rows) {
|
|
917
959
|
const cells = rows.map((row) => row.map(printable));
|
|
918
|
-
const widths =
|
|
919
|
-
return
|
|
920
|
-
.map((
|
|
921
|
-
.map((cell, column) => column === headers.length - 1
|
|
960
|
+
const widths = (cells[0] ?? []).map((_, column) => cells.reduce((width, row) => Math.max(width, stringWidth(row[column])), 0));
|
|
961
|
+
return cells.map((row) => row
|
|
962
|
+
.map((cell, column) => column === widths.length - 1
|
|
922
963
|
? cell
|
|
923
964
|
: cell.padEnd(cell.length + widths[column] - stringWidth(cell)))
|
|
924
|
-
.join(" "))
|
|
925
|
-
|
|
965
|
+
.join(" "));
|
|
966
|
+
}
|
|
967
|
+
function table(headers, rows, empty) {
|
|
968
|
+
return rows.length ? alignedRows([headers, ...rows]).join("\n") : empty;
|
|
926
969
|
}
|
|
927
970
|
function runDetails(record) {
|
|
928
971
|
const fields = [
|
|
@@ -953,6 +996,12 @@ function runDetails(record) {
|
|
|
953
996
|
fields.push(["Retention owner", record.retention.owner]);
|
|
954
997
|
return fields.map(([key, value]) => `${key}: ${printable(value)}`).join("\n");
|
|
955
998
|
}
|
|
999
|
+
function validateRefreshOptions(options) {
|
|
1000
|
+
const positive = ["refresh", "force"].find((key) => options[key]);
|
|
1001
|
+
const negative = ["no-refresh", "no-force"].find((key) => options[key]);
|
|
1002
|
+
if (positive && negative)
|
|
1003
|
+
syntax(`--${positive} and --${negative} are mutually exclusive.`);
|
|
1004
|
+
}
|
|
956
1005
|
async function closeStore(store, appExitCode) {
|
|
957
1006
|
try {
|
|
958
1007
|
await store?.close();
|
|
@@ -1030,14 +1079,13 @@ export function parse(argv) {
|
|
|
1030
1079
|
if (group === "exec") {
|
|
1031
1080
|
if (flags.json)
|
|
1032
1081
|
syntax("--json is not supported for exec/open.");
|
|
1033
|
-
while (["--log", "--force", "--no-force"].includes(tokens[0] ?? "")) {
|
|
1082
|
+
while (["--log", "--force", "--no-force", "--refresh", "--no-refresh"].includes(tokens[0] ?? "")) {
|
|
1034
1083
|
const option = tokens.shift().slice(2);
|
|
1035
1084
|
if (Object.hasOwn(result.options, option))
|
|
1036
1085
|
syntax(`Duplicate option --${option}.`);
|
|
1037
1086
|
result.options[option] = true;
|
|
1038
1087
|
}
|
|
1039
|
-
|
|
1040
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1088
|
+
validateRefreshOptions(result.options);
|
|
1041
1089
|
if (tokens[0] === "-h" || tokens[0] === "--help") {
|
|
1042
1090
|
result.help = true;
|
|
1043
1091
|
return result;
|
|
@@ -1054,6 +1102,7 @@ export function parse(argv) {
|
|
|
1054
1102
|
"get",
|
|
1055
1103
|
"search",
|
|
1056
1104
|
"doctor",
|
|
1105
|
+
"daemon",
|
|
1057
1106
|
"profile",
|
|
1058
1107
|
"unpin",
|
|
1059
1108
|
].includes(group)) {
|
|
@@ -1084,6 +1133,8 @@ export function parse(argv) {
|
|
|
1084
1133
|
}
|
|
1085
1134
|
else if (group === "open" && flags.json)
|
|
1086
1135
|
syntax("--json is not supported for exec/open.");
|
|
1136
|
+
if (result.path === "swarm add")
|
|
1137
|
+
syntax("swarm add was removed. Use ipab swarm set ALIAS CONFIG_URL for local naming, then ipab swarm request ALIAS to request membership.");
|
|
1087
1138
|
if (!commands[result.path])
|
|
1088
1139
|
syntax(`Unknown command "${result.path}".`);
|
|
1089
1140
|
if (group === "skills" && swarms.length > 1)
|
|
@@ -1128,9 +1179,9 @@ export function parse(argv) {
|
|
|
1128
1179
|
? ["all", "current", "force", "no-force"]
|
|
1129
1180
|
: result.path === "swarm approve"
|
|
1130
1181
|
? ["yes", "again"]
|
|
1131
|
-
:
|
|
1132
|
-
? ["local"]
|
|
1133
|
-
:
|
|
1182
|
+
: ["swarm status", "swarm members"].includes(result.path)
|
|
1183
|
+
? ["local", "force", "no-force"]
|
|
1184
|
+
: ["swarm exclude", "swarm set"].includes(result.path)
|
|
1134
1185
|
? ["yes"]
|
|
1135
1186
|
: result.path === "register set"
|
|
1136
1187
|
? ["replace"]
|
|
@@ -1138,42 +1189,44 @@ export function parse(argv) {
|
|
|
1138
1189
|
? ["yes"]
|
|
1139
1190
|
: result.path === "open"
|
|
1140
1191
|
? ["log", "raw", "force", "no-force"]
|
|
1141
|
-
:
|
|
1192
|
+
: result.path === "pin"
|
|
1193
|
+
? ["force", "no-force"]
|
|
1194
|
+
: [];
|
|
1195
|
+
if (booleans.includes("force"))
|
|
1196
|
+
booleans.push("refresh", "no-refresh");
|
|
1142
1197
|
const values = result.path === "swarm create"
|
|
1143
1198
|
? ["service", "resume", "name", "description", "alias"]
|
|
1144
|
-
: result.path === "swarm
|
|
1145
|
-
? ["
|
|
1146
|
-
: result.path === "swarm
|
|
1147
|
-
? ["
|
|
1148
|
-
: result.path === "swarm
|
|
1149
|
-
? ["
|
|
1150
|
-
: result.path === "swarm profile"
|
|
1151
|
-
? ["
|
|
1152
|
-
: result.path === "swarm
|
|
1153
|
-
? [
|
|
1154
|
-
:
|
|
1155
|
-
? []
|
|
1156
|
-
:
|
|
1157
|
-
? ["
|
|
1158
|
-
: result.path === "
|
|
1159
|
-
? ["
|
|
1160
|
-
: result.path === "
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
? [
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
]
|
|
1174
|
-
:
|
|
1175
|
-
? ["app", "status", "since", "until"]
|
|
1176
|
-
: [];
|
|
1199
|
+
: result.path === "swarm request"
|
|
1200
|
+
? ["output"]
|
|
1201
|
+
: result.path === "swarm export"
|
|
1202
|
+
? ["output"]
|
|
1203
|
+
: result.path === "swarm profile"
|
|
1204
|
+
? ["address"]
|
|
1205
|
+
: result.path === "swarm update" || result.path === "profile"
|
|
1206
|
+
? ["name", "description"]
|
|
1207
|
+
: result.path === "swarm approve"
|
|
1208
|
+
? []
|
|
1209
|
+
: ["publish", "templates set", "templates remove"].includes(result.path)
|
|
1210
|
+
? ["expect"]
|
|
1211
|
+
: result.path === "get"
|
|
1212
|
+
? ["output"]
|
|
1213
|
+
: result.path === "templates render"
|
|
1214
|
+
? ["description"]
|
|
1215
|
+
: result.path === "bundle build" ||
|
|
1216
|
+
result.path === "build"
|
|
1217
|
+
? ["output"]
|
|
1218
|
+
: result.path === "history list"
|
|
1219
|
+
? [
|
|
1220
|
+
"app",
|
|
1221
|
+
"status",
|
|
1222
|
+
"since",
|
|
1223
|
+
"until",
|
|
1224
|
+
"limit",
|
|
1225
|
+
"before",
|
|
1226
|
+
]
|
|
1227
|
+
: result.path === "history remove"
|
|
1228
|
+
? ["app", "status", "since", "until"]
|
|
1229
|
+
: [];
|
|
1177
1230
|
while (tokens.length) {
|
|
1178
1231
|
const value = tokens.shift();
|
|
1179
1232
|
if (result.path === "swarm exclude" &&
|
|
@@ -1182,6 +1235,15 @@ export function parse(argv) {
|
|
|
1182
1235
|
}
|
|
1183
1236
|
else if (value.startsWith("--") || value === "-o") {
|
|
1184
1237
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
1238
|
+
if (result.path === "daemon" && option === "swarm") {
|
|
1239
|
+
const input = tokens.shift();
|
|
1240
|
+
if (!input || input.startsWith("-"))
|
|
1241
|
+
syntax("--swarm needs a value.");
|
|
1242
|
+
if (flags.swarm !== undefined)
|
|
1243
|
+
syntax("daemon accepts --swarm at most once.");
|
|
1244
|
+
flags.swarm = input;
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1185
1247
|
if (result.path === "skills sync" && option === "agent") {
|
|
1186
1248
|
const input = tokens.shift();
|
|
1187
1249
|
if (!input || input.startsWith("-"))
|
|
@@ -1206,6 +1268,8 @@ export function parse(argv) {
|
|
|
1206
1268
|
(result.parameters ??= []).push(input);
|
|
1207
1269
|
continue;
|
|
1208
1270
|
}
|
|
1271
|
+
if (result.path === "swarm request" && option === "alias")
|
|
1272
|
+
syntax("swarm request --alias was removed. First run ipab swarm set ALIAS CONFIG_URL, then ipab swarm request ALIAS.");
|
|
1209
1273
|
if (Object.hasOwn(result.options, option))
|
|
1210
1274
|
syntax(`Duplicate option ${value}.`);
|
|
1211
1275
|
if (booleans.includes(option))
|
|
@@ -1229,8 +1293,7 @@ export function parse(argv) {
|
|
|
1229
1293
|
else
|
|
1230
1294
|
result.positional.push(value);
|
|
1231
1295
|
}
|
|
1232
|
-
|
|
1233
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1296
|
+
validateRefreshOptions(result.options);
|
|
1234
1297
|
if (result.path === "search" &&
|
|
1235
1298
|
result.options.current &&
|
|
1236
1299
|
flags.swarm !== undefined)
|
|
@@ -1243,6 +1306,7 @@ export function parse(argv) {
|
|
|
1243
1306
|
(result.registrySwarms?.length ?? 0) > 1)
|
|
1244
1307
|
syntax("register list accepts --swarm at most once. Select one Swarm or omit it to use the current Swarm.");
|
|
1245
1308
|
const counts = {
|
|
1309
|
+
daemon: [0, 0],
|
|
1246
1310
|
doctor: [0, 0],
|
|
1247
1311
|
"skills list": [0, 0],
|
|
1248
1312
|
"skills sync": [0, Number.MAX_SAFE_INTEGER],
|
|
@@ -1257,7 +1321,7 @@ export function parse(argv) {
|
|
|
1257
1321
|
"swarm status": [0, 0],
|
|
1258
1322
|
"swarm members": [0, 0],
|
|
1259
1323
|
"swarm list": [0, 0],
|
|
1260
|
-
"swarm
|
|
1324
|
+
"swarm set": [2, 2],
|
|
1261
1325
|
"swarm use": [1, 1],
|
|
1262
1326
|
"swarm remove": [1, 1],
|
|
1263
1327
|
"swarm update": [0, 0],
|
|
@@ -1421,8 +1485,12 @@ async function performCli(argv, io, env) {
|
|
|
1421
1485
|
return 0;
|
|
1422
1486
|
}
|
|
1423
1487
|
const items = effectiveConfig(state.config({
|
|
1424
|
-
includeSecrets: ![
|
|
1425
|
-
|
|
1488
|
+
includeSecrets: ![
|
|
1489
|
+
"swarm members",
|
|
1490
|
+
"profile",
|
|
1491
|
+
"swarm status",
|
|
1492
|
+
"swarm set",
|
|
1493
|
+
].includes(parsed.path),
|
|
1426
1494
|
}), parsed.flags, env, (reference) => state.resolveSwarm(reference));
|
|
1427
1495
|
const value = (key) => items.find((item) => item.key === key).value;
|
|
1428
1496
|
const emit = (result, human) => {
|
|
@@ -1449,9 +1517,10 @@ async function performCli(argv, io, env) {
|
|
|
1449
1517
|
stateDir: stateLocation(parsed.flags, env).path,
|
|
1450
1518
|
cacheTtl: Number(value("swarm.cacheTtl")),
|
|
1451
1519
|
listen: value("swarm.listen") === "loopback" ? "loopback" : "lan",
|
|
1452
|
-
|
|
1520
|
+
pivot: Boolean(value("swarm.pivot")),
|
|
1521
|
+
forceRefresh: parsed.options.refresh || parsed.options.force
|
|
1453
1522
|
? true
|
|
1454
|
-
: parsed.options["no-force"]
|
|
1523
|
+
: parsed.options["no-refresh"] || parsed.options["no-force"]
|
|
1455
1524
|
? false
|
|
1456
1525
|
: Boolean(value("swarm.forceRefresh")),
|
|
1457
1526
|
diagnostic: (text) => {
|
|
@@ -1666,7 +1735,10 @@ async function performCli(argv, io, env) {
|
|
|
1666
1735
|
alias: entry.alias,
|
|
1667
1736
|
})),
|
|
1668
1737
|
}, [
|
|
1669
|
-
...result.swarms.map((entry) =>
|
|
1738
|
+
...alignedRows(result.swarms.map((entry) => [
|
|
1739
|
+
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${entry.alias ?? entry.cid}`,
|
|
1740
|
+
entry.cid,
|
|
1741
|
+
])),
|
|
1670
1742
|
...(result.swarms.length ? [] : ["No registered Swarms."]),
|
|
1671
1743
|
...(result.effectiveCurrent === null
|
|
1672
1744
|
? ["Use ipab swarm use <alias> to select a default Swarm."]
|
|
@@ -1695,7 +1767,48 @@ async function performCli(argv, io, env) {
|
|
|
1695
1767
|
}, `Removed registration ${removed}. Credentials, content and remote membership are unchanged.`);
|
|
1696
1768
|
break;
|
|
1697
1769
|
}
|
|
1698
|
-
case "swarm
|
|
1770
|
+
case "swarm set": {
|
|
1771
|
+
swarmAlias(first);
|
|
1772
|
+
const cid = swarmUrl(second);
|
|
1773
|
+
const previous = state.swarms().find((entry) => entry.alias === first);
|
|
1774
|
+
if (previous && previous.cid !== cid) {
|
|
1775
|
+
io.err(`Swarm alias ${first}: ${previous.cid} -> ${cid}`);
|
|
1776
|
+
if (!parsed.options.yes &&
|
|
1777
|
+
(!io.tty ||
|
|
1778
|
+
!(await io.confirm(`Retarget local Swarm alias "${first}" from ${previous.cid} to ${cid}?`))))
|
|
1779
|
+
throw new HostError("Alias unchanged. Retargeting requires --yes or interactive confirmation.");
|
|
1780
|
+
}
|
|
1781
|
+
const entry = state.setSwarm(first, cid, previous?.cid ?? null);
|
|
1782
|
+
emit({
|
|
1783
|
+
configUrl: entry.cid,
|
|
1784
|
+
alias: entry.alias,
|
|
1785
|
+
savedCurrent: state.config({ includeSecrets: false })["swarm.default"] ?? null,
|
|
1786
|
+
}, `Set local swarm alias ${entry.alias} (${cid}).`);
|
|
1787
|
+
break;
|
|
1788
|
+
}
|
|
1789
|
+
case "daemon": {
|
|
1790
|
+
if (parsed.flags.json)
|
|
1791
|
+
syntax("--json is not supported for daemon; diagnostics are written to stderr.");
|
|
1792
|
+
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
1793
|
+
const controller = new AbortController();
|
|
1794
|
+
const interrupt = () => {
|
|
1795
|
+
controller.abort();
|
|
1796
|
+
};
|
|
1797
|
+
process.once("SIGINT", interrupt);
|
|
1798
|
+
process.once("SIGTERM", interrupt);
|
|
1799
|
+
try {
|
|
1800
|
+
await swarmDaemon(swarmContext(), parsed.flags.swarm === undefined ? undefined : requireSwarm(), controller.signal);
|
|
1801
|
+
}
|
|
1802
|
+
catch (cause) {
|
|
1803
|
+
if (!controller.signal.aborted)
|
|
1804
|
+
throw cause;
|
|
1805
|
+
}
|
|
1806
|
+
finally {
|
|
1807
|
+
process.removeListener("SIGINT", interrupt);
|
|
1808
|
+
process.removeListener("SIGTERM", interrupt);
|
|
1809
|
+
}
|
|
1810
|
+
break;
|
|
1811
|
+
}
|
|
1699
1812
|
case "swarm update":
|
|
1700
1813
|
case "search":
|
|
1701
1814
|
case "skills list":
|
|
@@ -1752,13 +1865,20 @@ async function performCli(argv, io, env) {
|
|
|
1752
1865
|
break;
|
|
1753
1866
|
}
|
|
1754
1867
|
if (parsed.path === "swarm members") {
|
|
1755
|
-
const result = await swarmMembers(context, requireSwarm());
|
|
1756
|
-
emit(result,
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
member
|
|
1760
|
-
|
|
1761
|
-
|
|
1868
|
+
const result = await swarmMembers(context, requireSwarm(), Boolean(parsed.options.refresh || parsed.options.force));
|
|
1869
|
+
emit(result, [
|
|
1870
|
+
`Directory: ${result.cache.source} (${result.cache.freshness}), observed ${result.cache.updatedAt}`,
|
|
1871
|
+
`Daemon: ${result.local.status}, observed ${result.local.updatedAt ?? "unknown"}; control-plane verified ${result.local.verifiedAt ?? "unknown"}`,
|
|
1872
|
+
table(["NAME", "DESCRIPTION", "ROLE", "PIVOT", "PUBLIC KEY"], result.members.map((member) => [
|
|
1873
|
+
member.name,
|
|
1874
|
+
member.description,
|
|
1875
|
+
member.role,
|
|
1876
|
+
member.pivot ? (member.localStatus ?? "candidate") : "-",
|
|
1877
|
+
member.publicKey,
|
|
1878
|
+
]), "No members."),
|
|
1879
|
+
].join("\n"));
|
|
1880
|
+
if (result.local.error)
|
|
1881
|
+
io.err(`Local Pivot observations (${result.local.status}): ${printable(result.local.error)}`);
|
|
1762
1882
|
break;
|
|
1763
1883
|
}
|
|
1764
1884
|
if (parsed.path === "swarm export") {
|
|
@@ -1802,20 +1922,6 @@ async function performCli(argv, io, env) {
|
|
|
1802
1922
|
emit(result, `Swarm: ${result.configUrl}\nName: ${printable(result.properties.name)}\nDescription: ${printable(result.properties.description)}\nHEAD ID: ${result.headId}\nConfig content CID: ${result.valueCid}`);
|
|
1803
1923
|
break;
|
|
1804
1924
|
}
|
|
1805
|
-
if (parsed.path === "swarm add") {
|
|
1806
|
-
const cid = state.resolveSwarm(first);
|
|
1807
|
-
await addSwarm(context, cid, typeof parsed.options.alias === "string"
|
|
1808
|
-
? parsed.options.alias
|
|
1809
|
-
: undefined);
|
|
1810
|
-
const entry = state.registeredSwarm(cid);
|
|
1811
|
-
emit({
|
|
1812
|
-
configUrl: entry.cid,
|
|
1813
|
-
alias: entry.alias,
|
|
1814
|
-
savedCurrent: state.config({ includeSecrets: false })["swarm.default"] ??
|
|
1815
|
-
null,
|
|
1816
|
-
}, `Registered swarm ${entry.alias ?? cid} (${cid}).`);
|
|
1817
|
-
break;
|
|
1818
|
-
}
|
|
1819
1925
|
if (parsed.path === "search") {
|
|
1820
1926
|
const registrations = state.swarms();
|
|
1821
1927
|
const scope = parsed.options.all
|
|
@@ -1833,10 +1939,7 @@ async function performCli(argv, io, env) {
|
|
|
1833
1939
|
}
|
|
1834
1940
|
if (parsed.path === "swarm status") {
|
|
1835
1941
|
const cid = requireSwarm();
|
|
1836
|
-
const
|
|
1837
|
-
const { head, config } = local
|
|
1838
|
-
? await swarmHeader(context, cid, true)
|
|
1839
|
-
: await sharedSwarmStatus(context, cid);
|
|
1942
|
+
const { head, config, networking, cache, state: contentState, } = await inspectSwarmStatus(context, cid, Boolean(parsed.options.refresh || parsed.options.force));
|
|
1840
1943
|
const fingerprint = await keyId(config.owner);
|
|
1841
1944
|
store = context.store;
|
|
1842
1945
|
emit({
|
|
@@ -1844,12 +1947,11 @@ async function performCli(argv, io, env) {
|
|
|
1844
1947
|
owner: config.owner,
|
|
1845
1948
|
ownerFingerprint: fingerprint,
|
|
1846
1949
|
epoch: config.epoch,
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
: {}),
|
|
1950
|
+
scopeId: config.scopeId,
|
|
1951
|
+
headId: config.headId,
|
|
1952
|
+
cache,
|
|
1953
|
+
state: contentState,
|
|
1954
|
+
networking,
|
|
1853
1955
|
root: head.root,
|
|
1854
1956
|
valueCid: head.cid,
|
|
1855
1957
|
properties: {
|
|
@@ -1858,6 +1960,7 @@ async function performCli(argv, io, env) {
|
|
|
1858
1960
|
},
|
|
1859
1961
|
}, [
|
|
1860
1962
|
"Swarm",
|
|
1963
|
+
` Directory: ${cache.source} (${cache.freshness}), observed ${cache.updatedAt}`,
|
|
1861
1964
|
` Name: ${printable(config.name)}`,
|
|
1862
1965
|
` Description: ${config.description ? printable(config.description) : "(none)"}`,
|
|
1863
1966
|
" Config URL:",
|
|
@@ -1866,21 +1969,59 @@ async function performCli(argv, io, env) {
|
|
|
1866
1969
|
"Identity",
|
|
1867
1970
|
" Owner fingerprint:",
|
|
1868
1971
|
` ${fingerprint}`,
|
|
1869
|
-
...(local
|
|
1870
|
-
? [
|
|
1871
|
-
" PeerID:",
|
|
1872
|
-
` ${context.node.peerId}`,
|
|
1873
|
-
"",
|
|
1874
|
-
"Local addresses",
|
|
1875
|
-
...context.node.addresses.map((address) => ` ${printable(address)}`),
|
|
1876
|
-
]
|
|
1877
|
-
: []),
|
|
1878
1972
|
"",
|
|
1879
1973
|
"Content",
|
|
1880
1974
|
" HEAD (publication root):",
|
|
1881
1975
|
` ${head.root}`,
|
|
1882
1976
|
" Content CID (HEAD value):",
|
|
1883
1977
|
` ${head.cid}`,
|
|
1978
|
+
` State: ${contentState.status}. ${contentState.error}`,
|
|
1979
|
+
"",
|
|
1980
|
+
"Local networking",
|
|
1981
|
+
` Daemon observations: ${networking.daemon.status}`,
|
|
1982
|
+
` Updated: ${networking.daemon.updatedAt ?? "unknown"}`,
|
|
1983
|
+
` Control-plane verified: ${networking.daemon.verifiedAt ?? "unknown"}`,
|
|
1984
|
+
...(networking.daemon.error
|
|
1985
|
+
? [` Observation error: ${printable(networking.daemon.error)}`]
|
|
1986
|
+
: []),
|
|
1987
|
+
` Connections observed: ${networking.connections.observedAt ?? "unknown"} (${networking.connections.freshness})`,
|
|
1988
|
+
...(networking.connections.error
|
|
1989
|
+
? [
|
|
1990
|
+
` Connection error: ${printable(networking.connections.error)}`,
|
|
1991
|
+
]
|
|
1992
|
+
: []),
|
|
1993
|
+
table([
|
|
1994
|
+
"PIVOT PEER ID",
|
|
1995
|
+
"LOCAL",
|
|
1996
|
+
"PROBE",
|
|
1997
|
+
"PROBED AT",
|
|
1998
|
+
"FAILURES",
|
|
1999
|
+
"RETRY AT",
|
|
2000
|
+
"CONNECTION",
|
|
2001
|
+
], networking.pivots.map((pivot) => [
|
|
2002
|
+
pivot.peerId,
|
|
2003
|
+
pivot.localStatus ?? "unknown",
|
|
2004
|
+
`${pivot.probe.result} (${pivot.probe.freshness})`,
|
|
2005
|
+
pivot.probe.at ?? "-",
|
|
2006
|
+
pivot.failures === null ? "-" : String(pivot.failures),
|
|
2007
|
+
pivot.retryAt ?? "-",
|
|
2008
|
+
pivot.connection.status,
|
|
2009
|
+
]), "No declared Pivots."),
|
|
2010
|
+
...networking.pivots.flatMap((pivot) => pivot.probe.error
|
|
2011
|
+
? [
|
|
2012
|
+
` ${pivot.peerId} probe error: ${printable(pivot.probe.error)}`,
|
|
2013
|
+
]
|
|
2014
|
+
: []),
|
|
2015
|
+
...(networking.connections.error
|
|
2016
|
+
? []
|
|
2017
|
+
: [
|
|
2018
|
+
table(["CONNECTED PEER ID", "TRANSPORT", "ADDRESS"], networking.connections.peers.map((peer) => [
|
|
2019
|
+
peer.peerId,
|
|
2020
|
+
peer.transport,
|
|
2021
|
+
peer.address,
|
|
2022
|
+
]), "No observed peer connections."),
|
|
2023
|
+
]),
|
|
2024
|
+
" Selected is configuration, not connection success. Relay connectivity does not guarantee content availability.",
|
|
1884
2025
|
].join("\n"));
|
|
1885
2026
|
break;
|
|
1886
2027
|
}
|
|
@@ -1947,10 +2088,7 @@ async function performCli(argv, io, env) {
|
|
|
1947
2088
|
});
|
|
1948
2089
|
}
|
|
1949
2090
|
else if (parsed.path === "swarm request") {
|
|
1950
|
-
const result = await requestMembership(context, first, {
|
|
1951
|
-
...(typeof parsed.options.alias === "string"
|
|
1952
|
-
? { alias: parsed.options.alias }
|
|
1953
|
-
: {}),
|
|
2091
|
+
const result = await requestMembership(context, state.resolveSwarm(first), {
|
|
1954
2092
|
...(typeof parsed.options.output === "string"
|
|
1955
2093
|
? { output: parsed.options.output }
|
|
1956
2094
|
: {}),
|