@ipab/cli 0.1.0-rc.7 → 0.1.0-rc.9
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 +70 -30
- 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/bundled-skills.d.ts +14 -0
- package/dist/bundled-skills.d.ts.map +1 -0
- package/dist/bundled-skills.js +34 -0
- package/dist/bundled-skills.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +309 -157
- 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/daemon.d.ts +4 -0
- package/dist/daemon.d.ts.map +1 -0
- package/dist/daemon.js +200 -0
- package/dist/daemon.js.map +1 -0
- package/dist/doctor.d.ts +2 -0
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +18 -4
- package/dist/doctor.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/skill-source.d.ts +4 -0
- package/dist/skill-source.d.ts.map +1 -1
- package/dist/skill-source.js +14 -2
- package/dist/skill-source.js.map +1 -1
- package/dist/skills.d.ts +18 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +137 -39
- package/dist/skills.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 +10 -4
- 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 +121 -6
- package/dist/swarm.d.ts.map +1 -1
- package/dist/swarm.js +672 -81
- 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/bundled-skills.ts +60 -0
- package/src/cli.ts +398 -195
- package/src/config.ts +12 -4
- package/src/context.ts +15 -2
- package/src/daemon.ts +237 -0
- package/src/doctor.ts +42 -5
- 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/skill-source.ts +16 -2
- package/src/skills.ts +195 -53
- 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 +8 -3
- package/src/swarm-meta.ts +15 -34
- package/src/swarm-observations.ts +374 -0
- package/src/swarm.ts +953 -92
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,
|
|
@@ -43,9 +45,11 @@ import { initApp } from "./app-authoring.js";
|
|
|
43
45
|
import { assembleBundle } from "./assembly.js";
|
|
44
46
|
import { getBundle } from "./get.js";
|
|
45
47
|
import { doctorDevice, doctorText } from "./doctor.js";
|
|
48
|
+
import { ensureDaemon, serveDaemon } from "./daemon.js";
|
|
46
49
|
import { keyId } from "@ipab/bundle/pointer/crypto";
|
|
47
50
|
import {
|
|
48
51
|
createSwarm,
|
|
52
|
+
swarmDaemon,
|
|
49
53
|
requestMembership,
|
|
50
54
|
approveMembership,
|
|
51
55
|
exportRequest,
|
|
@@ -55,12 +59,10 @@ import {
|
|
|
55
59
|
accountProfile,
|
|
56
60
|
updateAccountProfile,
|
|
57
61
|
swarmMembers,
|
|
62
|
+
inspectSwarmStatus,
|
|
58
63
|
verifiedRequest,
|
|
59
64
|
verifiedRequestStream,
|
|
60
65
|
membershipRequestSummary,
|
|
61
|
-
swarmHeader,
|
|
62
|
-
sharedSwarmStatus,
|
|
63
|
-
addSwarm,
|
|
64
66
|
updateSwarm,
|
|
65
67
|
searchNames,
|
|
66
68
|
formatNameReference,
|
|
@@ -155,36 +157,37 @@ export const processIO: IO = {
|
|
|
155
157
|
},
|
|
156
158
|
};
|
|
157
159
|
const commands: Record<string, string> = {
|
|
158
|
-
|
|
160
|
+
daemon: "daemon [--swarm URL_OR_ALIAS]",
|
|
161
|
+
"skills list": "skills list [--refresh | --no-refresh]",
|
|
159
162
|
"skills sync":
|
|
160
|
-
"skills sync [NAMES...] [--agent AGENT]... [--dry-run] [--yes] [--
|
|
163
|
+
"skills sync [NAMES...] [--agent AGENT]... [--override-existing] [--dry-run] [--yes] [--refresh | --no-refresh]",
|
|
161
164
|
doctor: "doctor [--fix [--yes]]",
|
|
162
165
|
profile: "profile [--name NAME] [--description TEXT]",
|
|
163
166
|
"swarm create": "swarm create [--service URL] [--resume OPERATION]",
|
|
164
|
-
"swarm request": "swarm request
|
|
167
|
+
"swarm request": "swarm request URL_OR_ALIAS [--output FILE]",
|
|
165
168
|
"swarm export": "swarm export --output FILE",
|
|
166
169
|
"swarm approve": "swarm approve REQUEST_FILE [--again] --yes",
|
|
167
170
|
"swarm exclude": "swarm exclude MEMBER_PUBLIC_KEY --yes",
|
|
168
171
|
"swarm resume": "swarm resume",
|
|
169
172
|
"swarm profile": "swarm profile --address MULTIADDR",
|
|
170
|
-
"swarm status": "swarm status [--
|
|
171
|
-
"swarm members": "swarm members",
|
|
173
|
+
"swarm status": "swarm status [--refresh | --no-refresh]",
|
|
174
|
+
"swarm members": "swarm members [--refresh | --no-refresh]",
|
|
172
175
|
"swarm list": "swarm list",
|
|
173
|
-
"swarm
|
|
176
|
+
"swarm set": "swarm set ALIAS CONFIG_URL [--yes]",
|
|
174
177
|
"swarm use": "swarm use URL_OR_ALIAS",
|
|
175
178
|
"swarm remove": "swarm remove URL_OR_ALIAS",
|
|
176
179
|
"swarm update": "swarm update [--name TEXT] [--description TEXT]",
|
|
177
180
|
publish: "publish NAME SOURCE [--expect OLD_CID | --snapshot]",
|
|
178
|
-
get: "get REF [--raw] [--
|
|
179
|
-
search: "search QUERY [--all | --current] [--
|
|
181
|
+
get: "get REF [--raw] [--refresh | --no-refresh] [-o DIRECTORY]",
|
|
182
|
+
search: "search QUERY [--all | --current] [--refresh | --no-refresh]",
|
|
180
183
|
"templates render": "templates render TEMPLATE NAME [DIR] [OPTIONS]",
|
|
181
184
|
build: "build [SOURCE] [OPTIONS]",
|
|
182
185
|
"bundle build": "bundle build SOURCE [OPTIONS]",
|
|
183
186
|
"bundle inspect": "bundle inspect SOURCE",
|
|
184
187
|
"bundle import": "bundle import FILE.car",
|
|
185
|
-
exec: "exec [--log] [--
|
|
186
|
-
open: "open [--log] [--raw] [--
|
|
187
|
-
pin: "pin REF",
|
|
188
|
+
exec: "exec [--log] [--refresh | --no-refresh] APP [APP_ARGS...]",
|
|
189
|
+
open: "open [--log] [--raw] [--refresh | --no-refresh] CONTENT",
|
|
190
|
+
pin: "pin REF [--refresh | --no-refresh]",
|
|
188
191
|
unpin: "unpin REF",
|
|
189
192
|
"pin list": "pin list",
|
|
190
193
|
"pin show": "pin show REF",
|
|
@@ -192,8 +195,8 @@ const commands: Record<string, string> = {
|
|
|
192
195
|
"register set":
|
|
193
196
|
"register set SCHEMA APP [--swarm URL_OR_ALIAS]... [--replace]",
|
|
194
197
|
"register remove": "register remove SCHEMA [--swarm URL_OR_ALIAS]...",
|
|
195
|
-
"templates list": "templates list [--
|
|
196
|
-
"templates show": "templates show NAME [--
|
|
198
|
+
"templates list": "templates list [--refresh | --no-refresh]",
|
|
199
|
+
"templates show": "templates show NAME [--refresh | --no-refresh]",
|
|
197
200
|
"templates set": "templates set NAME SOURCE [--expect OLD_TARGET_CID]",
|
|
198
201
|
"templates remove": "templates remove NAME --expect OLD_TARGET_CID",
|
|
199
202
|
"config get": "config get [KEY]",
|
|
@@ -228,10 +231,21 @@ const commandHelp: Record<
|
|
|
228
231
|
notes?: string[];
|
|
229
232
|
}
|
|
230
233
|
> = {
|
|
234
|
+
daemon: {
|
|
235
|
+
summary: "Manage existing private Swarm nodes in the foreground",
|
|
236
|
+
examples: ["ipab daemon", "ipab daemon --swarm work"],
|
|
237
|
+
notes: [
|
|
238
|
+
"Manages all registered Swarms independently, or only the explicitly selected --swarm; ignores the saved default.",
|
|
239
|
+
"Probes pivot candidates, refreshes approved profiles and retries with cooldown. Diagnostics go to stderr.",
|
|
240
|
+
"Swarm network operations start one background daemon on demand per state-dir; local commands, doctor and status/members inspections do not. No OS startup service is installed.",
|
|
241
|
+
"Ctrl-C / TERM drains foreground operations and releases the device/state-dir lock; Kubo stays running. An existing background daemon already owns this lock.",
|
|
242
|
+
"Role and relay candidate changes restart only the verified managed Kubo node.",
|
|
243
|
+
],
|
|
244
|
+
},
|
|
231
245
|
"templates list": {
|
|
232
246
|
summary: "List templates under the selected Swarm Meta templatePath",
|
|
233
247
|
options: [
|
|
234
|
-
"--
|
|
248
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
235
249
|
],
|
|
236
250
|
examples: [
|
|
237
251
|
"ipab --swarm work templates list",
|
|
@@ -247,7 +261,7 @@ const commandHelp: Record<
|
|
|
247
261
|
"NAME Safe relative template Name; nested names are supported.",
|
|
248
262
|
],
|
|
249
263
|
options: [
|
|
250
|
-
"--
|
|
264
|
+
"--refresh / --no-refresh Refresh HEAD now / allow a valid cached snapshot.",
|
|
251
265
|
],
|
|
252
266
|
examples: ["ipab --swarm work templates show node"],
|
|
253
267
|
},
|
|
@@ -285,7 +299,7 @@ const commandHelp: Record<
|
|
|
285
299
|
"skills list": {
|
|
286
300
|
summary: "List typed Skills and local installation status from one Swarm",
|
|
287
301
|
options: [
|
|
288
|
-
"--
|
|
302
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
289
303
|
"Global --json Emit machine-readable names, exact payload CIDs and status.",
|
|
290
304
|
],
|
|
291
305
|
examples: ["ipab --swarm work skills list", "ipab --json skills list"],
|
|
@@ -301,10 +315,11 @@ const commandHelp: Record<
|
|
|
301
315
|
"NAMES Install identities, e.g. ipab code-review, or full shared Names such as ipab/skills/ipab. Resolved from one verified snapshot; omit for all Skills.",
|
|
302
316
|
],
|
|
303
317
|
options: [
|
|
304
|
-
"--agent AGENT Repeatable globally supported agent ID; default is
|
|
318
|
+
"--agent AGENT Repeatable globally supported agent ID; default is universal (~/.agents/skills).",
|
|
319
|
+
"--override-existing Replace non-IPAB-managed Skills and local edits at selected targets.",
|
|
305
320
|
"--dry-run Preview without invoking npx or changing installed Skills.",
|
|
306
|
-
"--yes Skip IPAB consent only;
|
|
307
|
-
"--
|
|
321
|
+
"--yes Skip IPAB consent only; does not imply --override-existing.",
|
|
322
|
+
"--refresh / --no-refresh Refresh HEAD now / reuse a valid verified snapshot.",
|
|
308
323
|
],
|
|
309
324
|
examples: [
|
|
310
325
|
"ipab --swarm work skills sync --dry-run",
|
|
@@ -314,7 +329,7 @@ const commandHelp: Record<
|
|
|
314
329
|
"Global installs only, through official skills@1.9.1 with --copy. Requires Node >=22.20.0.",
|
|
315
330
|
"Non-interactive execution requires --yes. Installer version, source, paths and agents are shown first.",
|
|
316
331
|
"No Skill hooks/scripts run. The trusted installer is not sandboxed. Telemetry and remote audits are disabled.",
|
|
317
|
-
"Non-IPAB installs
|
|
332
|
+
"Non-IPAB installs and local edits require --override-existing. Cross-Swarm collisions and symlink/junction aliases remain protected. Removed sources are reported, not deleted.",
|
|
318
333
|
"Partial failures report individual results, preserve pending attribution and exit nonzero; retry the same sync.",
|
|
319
334
|
],
|
|
320
335
|
},
|
|
@@ -350,7 +365,8 @@ const commandHelp: Record<
|
|
|
350
365
|
"--yes Authorize planned repairs without prompting; requires --fix.",
|
|
351
366
|
],
|
|
352
367
|
notes: [
|
|
353
|
-
"Always checks local state/configuration, managed Kubo, HOME identity, local Swarm registry and
|
|
368
|
+
"Always checks local state/configuration, managed Kubo, HOME identity, local Swarm registry, compatible updates and the CLI-bundled IPAB Skill for detected Agents.",
|
|
369
|
+
"--fix also installs/updates the bundled IPAB Skill globally using the pinned official installer, without joining a Swarm. Custom content and Swarm-managed Skills are never overwritten.",
|
|
354
370
|
"Inspection never creates state, locks, credentials or caches. Official release metadata may be queried; unavailable updates are not claimed current.",
|
|
355
371
|
"Healthy current components are reused without download or confirmation. Fixed protected archive cache is automatic.",
|
|
356
372
|
"Unverified existing Kubo: --fix may download/cache its exact-version official archive for byte comparison only; never execute it to authenticate itself or overwrite a mismatch.",
|
|
@@ -380,11 +396,10 @@ const commandHelp: Record<
|
|
|
380
396
|
"swarm request": {
|
|
381
397
|
summary: "Save and export a signed self-contained membership Request",
|
|
382
398
|
examples: [
|
|
383
|
-
"ipab swarm request
|
|
384
|
-
"ipab swarm request CONFIG_URL --output request.json
|
|
399
|
+
"ipab swarm request work",
|
|
400
|
+
"ipab swarm request CONFIG_URL --output request.json",
|
|
385
401
|
],
|
|
386
402
|
options: [
|
|
387
|
-
"--alias ALIAS Pre-register the target for lazy onboarding.",
|
|
388
403
|
"--output FILE Export to a new file instead of stdout; never overwrites.",
|
|
389
404
|
],
|
|
390
405
|
notes: [
|
|
@@ -394,7 +409,7 @@ const commandHelp: Record<
|
|
|
394
409
|
"Retries export the exact saved Request without expiry or a new PeerID.",
|
|
395
410
|
"No Invite, Response file, password or Join. Next normal use fetches and decrypts the approved package.",
|
|
396
411
|
"Set your account-wide personal name with ipab profile --name NAME before requesting membership.",
|
|
397
|
-
"
|
|
412
|
+
"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
413
|
],
|
|
399
414
|
},
|
|
400
415
|
"swarm approve": {
|
|
@@ -438,24 +453,35 @@ const commandHelp: Record<
|
|
|
438
453
|
},
|
|
439
454
|
"swarm members": {
|
|
440
455
|
summary: "List every public member, including the Owner",
|
|
441
|
-
|
|
456
|
+
options: [
|
|
457
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
458
|
+
"--local Deprecated no-op; local daemon observations are always included.",
|
|
459
|
+
],
|
|
460
|
+
examples: [
|
|
461
|
+
"ipab --swarm work swarm members",
|
|
462
|
+
"ipab --json swarm members --refresh",
|
|
463
|
+
],
|
|
442
464
|
notes: [
|
|
443
|
-
"
|
|
465
|
+
"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.",
|
|
466
|
+
"PIVOT: - for ordinary members; selected, cooldown, unknown, self or candidate for declared Pivots. Selected means applied configuration, not connectivity.",
|
|
444
467
|
],
|
|
445
468
|
},
|
|
446
469
|
"swarm status": {
|
|
447
|
-
summary: "
|
|
470
|
+
summary: "Inspect cached Swarm directory, HEAD and local networking",
|
|
448
471
|
options: [
|
|
449
|
-
"--
|
|
472
|
+
"--refresh / --no-refresh Fetch public Variables now / reuse the saved inspection, fetching if missing.",
|
|
473
|
+
"--local Deprecated no-op; never activates a node.",
|
|
450
474
|
],
|
|
451
475
|
examples: [
|
|
452
476
|
"ipab swarm status",
|
|
453
477
|
"ipab --swarm work swarm status",
|
|
454
|
-
"ipab --swarm work swarm status --
|
|
478
|
+
"ipab --swarm work swarm status --refresh",
|
|
455
479
|
],
|
|
456
480
|
notes: [
|
|
457
|
-
"
|
|
458
|
-
"
|
|
481
|
+
"Default: reuse the inspection cache, fetching public Variables if missing. Refresh verifies Config, Scope, members, Profiles and HEAD, not connectivity or State content.",
|
|
482
|
+
"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.",
|
|
483
|
+
"State content is explicitly unavailable in inspection; use get ipab:/// to obtain the State Bundle.",
|
|
484
|
+
"Local connectivity is not global availability; a relay connection does not guarantee content transfer.",
|
|
459
485
|
],
|
|
460
486
|
},
|
|
461
487
|
"swarm list": {
|
|
@@ -463,13 +489,19 @@ const commandHelp: Record<
|
|
|
463
489
|
examples: ["ipab swarm list", "ipab --json swarm list"],
|
|
464
490
|
notes: ["Local only; does not verify remote membership or refresh HEAD."],
|
|
465
491
|
},
|
|
466
|
-
"swarm
|
|
467
|
-
summary: "
|
|
492
|
+
"swarm set": {
|
|
493
|
+
summary: "Set a local alias for a swarm configuration URL",
|
|
468
494
|
options: [
|
|
469
|
-
"--
|
|
495
|
+
"--yes Authorize retargeting an existing alias without prompting.",
|
|
496
|
+
],
|
|
497
|
+
examples: [
|
|
498
|
+
"ipab swarm set work CONFIG_URL",
|
|
499
|
+
"ipab swarm set work OTHER_CONFIG_URL --yes",
|
|
470
500
|
],
|
|
471
|
-
examples: ["ipab swarm add CONFIG_URL --alias work"],
|
|
472
501
|
notes: [
|
|
502
|
+
"Local only; no network, account identity or approved membership required.",
|
|
503
|
+
"Setting the same mapping is idempotent. One alias per URL; a new alias for that URL replaces its old alias.",
|
|
504
|
+
"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
505
|
"Not a membership grant. The first registration becomes the saved default only if none exists.",
|
|
474
506
|
],
|
|
475
507
|
},
|
|
@@ -509,13 +541,13 @@ const commandHelp: Record<
|
|
|
509
541
|
options: [
|
|
510
542
|
"--all Search all registered swarms; conflicts with --current and --swarm.",
|
|
511
543
|
"--current Explicitly select the default search scope; conflicts with --swarm.",
|
|
512
|
-
"--
|
|
513
|
-
"--no-
|
|
544
|
+
"--refresh Refresh HEAD for every swarm in the search scope.",
|
|
545
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
514
546
|
],
|
|
515
547
|
examples: [
|
|
516
548
|
"ipab search hello",
|
|
517
549
|
"ipab search hello --all",
|
|
518
|
-
"ipab --swarm work search hello --
|
|
550
|
+
"ipab --swarm work search hello --refresh",
|
|
519
551
|
],
|
|
520
552
|
notes: [
|
|
521
553
|
"Searches only --swarm or the saved current swarm by default. Use --all to search every registration.",
|
|
@@ -548,8 +580,8 @@ const commandHelp: Record<
|
|
|
548
580
|
summary: "Verify and unpack Bundle content without executing it",
|
|
549
581
|
options: [
|
|
550
582
|
"--raw Select the Artifact node instead of its value.",
|
|
551
|
-
"--
|
|
552
|
-
"--no-
|
|
583
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
584
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
553
585
|
"-o, --output DIRECTORY New or empty directory; defaults to a unique temporary directory.",
|
|
554
586
|
],
|
|
555
587
|
examples: [
|
|
@@ -590,7 +622,7 @@ const commandHelp: Record<
|
|
|
590
622
|
],
|
|
591
623
|
options: [
|
|
592
624
|
"--description TEXT Set the declared description parameter.",
|
|
593
|
-
"--
|
|
625
|
+
"--refresh / --no-refresh Refresh Swarm HEAD now / allow its valid cached snapshot.",
|
|
594
626
|
"--param KEY=VALUE Template parameter; repeatable. Strings are literal;",
|
|
595
627
|
" other parameter types use JSON.",
|
|
596
628
|
],
|
|
@@ -669,8 +701,8 @@ const commandHelp: Record<
|
|
|
669
701
|
],
|
|
670
702
|
options: [
|
|
671
703
|
"--log Record stdout/stderr; must precede APP. Requires history enabled.",
|
|
672
|
-
"--
|
|
673
|
-
"--no-
|
|
704
|
+
"--refresh Refresh the shared Name's swarm HEAD; must precede APP.",
|
|
705
|
+
"--no-refresh Override swarm.forceRefresh; must precede APP.",
|
|
674
706
|
],
|
|
675
707
|
examples: [
|
|
676
708
|
"ipab exec reader",
|
|
@@ -693,16 +725,17 @@ const commandHelp: Record<
|
|
|
693
725
|
options: [
|
|
694
726
|
"--log Record stdout/stderr; requires history enabled.",
|
|
695
727
|
"--raw Open the Artifact node rather than its value.",
|
|
696
|
-
"--
|
|
697
|
-
"--no-
|
|
728
|
+
"--refresh Refresh the shared Name's swarm HEAD.",
|
|
729
|
+
"--no-refresh Override swarm.forceRefresh and use valid cached headers.",
|
|
698
730
|
],
|
|
699
731
|
examples: [
|
|
700
732
|
"ipab open CONTENT_CID",
|
|
701
|
-
"ipab open --log
|
|
702
|
-
"ipab open ipab:///
|
|
733
|
+
"ipab open --log --refresh ipab:///documents/readme",
|
|
734
|
+
"ipab open ipab:///",
|
|
703
735
|
],
|
|
704
736
|
notes: [
|
|
705
737
|
"Requires a saved registration and App support for the exact content type.",
|
|
738
|
+
"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
739
|
"Uses only the content URI's Swarm, otherwise --swarm, otherwise swarm.default. A selected Swarm is required.",
|
|
707
740
|
"A registered App's retrieval, compatibility or execution failure never triggers fallback.",
|
|
708
741
|
"Legacy User registrations are inactive and preserved in the state database's legacy_user_registrations table; review them before explicit Swarm registration.",
|
|
@@ -717,6 +750,9 @@ const commandHelp: Record<
|
|
|
717
750
|
arguments: [
|
|
718
751
|
"REF Exact Bundle CID or ipab://SWARM/NAME; no local content aliases.",
|
|
719
752
|
],
|
|
753
|
+
options: [
|
|
754
|
+
"--refresh / --no-refresh Refresh shared HEAD now / allow its valid cached snapshot.",
|
|
755
|
+
],
|
|
720
756
|
examples: [
|
|
721
757
|
"ipab pin APP_CID",
|
|
722
758
|
"ipab pin ipab://work/apps/reader",
|
|
@@ -923,7 +959,18 @@ ${footer}`;
|
|
|
923
959
|
return [
|
|
924
960
|
`${topic.summary}.\n\nUsage: ipab [GLOBAL_OPTIONS] ${usage}`,
|
|
925
961
|
...(topic.arguments ? [section("Arguments", topic.arguments)] : []),
|
|
926
|
-
...(topic.options
|
|
962
|
+
...(topic.options
|
|
963
|
+
? [
|
|
964
|
+
section(
|
|
965
|
+
"Options",
|
|
966
|
+
topic.options.map((line) =>
|
|
967
|
+
line.startsWith("--refresh")
|
|
968
|
+
? `${line} Legacy aliases: --force/--no-force.`
|
|
969
|
+
: line,
|
|
970
|
+
),
|
|
971
|
+
),
|
|
972
|
+
]
|
|
973
|
+
: []),
|
|
927
974
|
section("Examples", topic.examples),
|
|
928
975
|
...([
|
|
929
976
|
"swarm status",
|
|
@@ -976,11 +1023,17 @@ export function formatSearchResults(
|
|
|
976
1023
|
matches: Awaited<ReturnType<typeof searchNames>>["matches"],
|
|
977
1024
|
): string {
|
|
978
1025
|
return matches.length
|
|
979
|
-
?
|
|
980
|
-
.map(
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1026
|
+
? alignedRows(
|
|
1027
|
+
matches.map((match) => [
|
|
1028
|
+
match.alias ?? match.swarm,
|
|
1029
|
+
match.name,
|
|
1030
|
+
match.targetCid,
|
|
1031
|
+
]),
|
|
1032
|
+
)
|
|
1033
|
+
.map((row, index) => {
|
|
1034
|
+
const match = matches[index]!;
|
|
1035
|
+
return `${row}\n ipab get ${formatNameReference(match.alias ?? match.swarm, match.name)}`;
|
|
1036
|
+
})
|
|
984
1037
|
.join("\n")
|
|
985
1038
|
: "No matching Names.";
|
|
986
1039
|
}
|
|
@@ -1027,26 +1080,24 @@ function storageBytes(bytes: number): string {
|
|
|
1027
1080
|
: `${scaled.toLocaleString("en-US", { maximumFractionDigits: 2 })} ${units[unit]} (${exact} bytes)`;
|
|
1028
1081
|
}
|
|
1029
1082
|
|
|
1030
|
-
function
|
|
1031
|
-
if (!rows.length) return empty;
|
|
1083
|
+
function alignedRows(rows: string[][]): string[] {
|
|
1032
1084
|
const cells = rows.map((row) => row.map(printable));
|
|
1033
|
-
const widths =
|
|
1034
|
-
cells.reduce(
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1085
|
+
const widths = (cells[0] ?? []).map((_, column) =>
|
|
1086
|
+
cells.reduce((width, row) => Math.max(width, stringWidth(row[column]!)), 0),
|
|
1087
|
+
);
|
|
1088
|
+
return cells.map((row) =>
|
|
1089
|
+
row
|
|
1090
|
+
.map((cell, column) =>
|
|
1091
|
+
column === widths.length - 1
|
|
1092
|
+
? cell
|
|
1093
|
+
: cell.padEnd(cell.length + widths[column]! - stringWidth(cell)),
|
|
1094
|
+
)
|
|
1095
|
+
.join(" "),
|
|
1038
1096
|
);
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
column === headers.length - 1
|
|
1044
|
-
? cell
|
|
1045
|
-
: cell.padEnd(cell.length + widths[column]! - stringWidth(cell)),
|
|
1046
|
-
)
|
|
1047
|
-
.join(" "),
|
|
1048
|
-
)
|
|
1049
|
-
.join("\n");
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
function table(headers: string[], rows: string[][], empty: string): string {
|
|
1100
|
+
return rows.length ? alignedRows([headers, ...rows]).join("\n") : empty;
|
|
1050
1101
|
}
|
|
1051
1102
|
|
|
1052
1103
|
function runDetails(record: RunRecord): string {
|
|
@@ -1091,6 +1142,12 @@ interface Parsed {
|
|
|
1091
1142
|
help: boolean;
|
|
1092
1143
|
version: boolean;
|
|
1093
1144
|
}
|
|
1145
|
+
function validateRefreshOptions(options: Parsed["options"]): void {
|
|
1146
|
+
const positive = ["refresh", "force"].find((key) => options[key]);
|
|
1147
|
+
const negative = ["no-refresh", "no-force"].find((key) => options[key]);
|
|
1148
|
+
if (positive && negative)
|
|
1149
|
+
syntax(`--${positive} and --${negative} are mutually exclusive.`);
|
|
1150
|
+
}
|
|
1094
1151
|
|
|
1095
1152
|
async function closeStore(
|
|
1096
1153
|
store: IpfsStore | undefined,
|
|
@@ -1174,14 +1231,17 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1174
1231
|
if (!group) return result;
|
|
1175
1232
|
if (group === "exec") {
|
|
1176
1233
|
if (flags.json) syntax("--json is not supported for exec/open.");
|
|
1177
|
-
while (
|
|
1234
|
+
while (
|
|
1235
|
+
["--log", "--force", "--no-force", "--refresh", "--no-refresh"].includes(
|
|
1236
|
+
tokens[0] ?? "",
|
|
1237
|
+
)
|
|
1238
|
+
) {
|
|
1178
1239
|
const option = tokens.shift()!.slice(2);
|
|
1179
1240
|
if (Object.hasOwn(result.options, option))
|
|
1180
1241
|
syntax(`Duplicate option --${option}.`);
|
|
1181
1242
|
result.options[option] = true;
|
|
1182
1243
|
}
|
|
1183
|
-
|
|
1184
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1244
|
+
validateRefreshOptions(result.options);
|
|
1185
1245
|
if (tokens[0] === "-h" || tokens[0] === "--help") {
|
|
1186
1246
|
result.help = true;
|
|
1187
1247
|
return result;
|
|
@@ -1199,6 +1259,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1199
1259
|
"get",
|
|
1200
1260
|
"search",
|
|
1201
1261
|
"doctor",
|
|
1262
|
+
"daemon",
|
|
1202
1263
|
"profile",
|
|
1203
1264
|
"unpin",
|
|
1204
1265
|
].includes(group)
|
|
@@ -1230,6 +1291,10 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1230
1291
|
} else result.path = `${group} ${tokens.shift()!}`;
|
|
1231
1292
|
} else if (group === "open" && flags.json)
|
|
1232
1293
|
syntax("--json is not supported for exec/open.");
|
|
1294
|
+
if (result.path === "swarm add")
|
|
1295
|
+
syntax(
|
|
1296
|
+
"swarm add was removed. Use ipab swarm set ALIAS CONFIG_URL for local naming, then ipab swarm request ALIAS to request membership.",
|
|
1297
|
+
);
|
|
1233
1298
|
if (!commands[result.path]) syntax(`Unknown command "${result.path}".`);
|
|
1234
1299
|
if (group === "skills" && swarms.length > 1)
|
|
1235
1300
|
syntax(
|
|
@@ -1252,7 +1317,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1252
1317
|
);
|
|
1253
1318
|
const booleans = result.path.startsWith("skills ")
|
|
1254
1319
|
? result.path === "skills sync"
|
|
1255
|
-
? ["dry-run", "yes", "force", "no-force"]
|
|
1320
|
+
? ["dry-run", "yes", "override-existing", "force", "no-force"]
|
|
1256
1321
|
: ["force", "no-force"]
|
|
1257
1322
|
: result.path === "doctor"
|
|
1258
1323
|
? ["fix", "yes"]
|
|
@@ -1277,9 +1342,9 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1277
1342
|
? ["all", "current", "force", "no-force"]
|
|
1278
1343
|
: result.path === "swarm approve"
|
|
1279
1344
|
? ["yes", "again"]
|
|
1280
|
-
:
|
|
1281
|
-
? ["local"]
|
|
1282
|
-
:
|
|
1345
|
+
: ["swarm status", "swarm members"].includes(result.path)
|
|
1346
|
+
? ["local", "force", "no-force"]
|
|
1347
|
+
: ["swarm exclude", "swarm set"].includes(result.path)
|
|
1283
1348
|
? ["yes"]
|
|
1284
1349
|
: result.path === "register set"
|
|
1285
1350
|
? ["replace"]
|
|
@@ -1287,45 +1352,46 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1287
1352
|
? ["yes"]
|
|
1288
1353
|
: result.path === "open"
|
|
1289
1354
|
? ["log", "raw", "force", "no-force"]
|
|
1290
|
-
:
|
|
1355
|
+
: result.path === "pin"
|
|
1356
|
+
? ["force", "no-force"]
|
|
1357
|
+
: [];
|
|
1358
|
+
if (booleans.includes("force")) booleans.push("refresh", "no-refresh");
|
|
1291
1359
|
const values =
|
|
1292
1360
|
result.path === "swarm create"
|
|
1293
1361
|
? ["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
|
-
: [];
|
|
1362
|
+
: result.path === "swarm request"
|
|
1363
|
+
? ["output"]
|
|
1364
|
+
: result.path === "swarm export"
|
|
1365
|
+
? ["output"]
|
|
1366
|
+
: result.path === "swarm profile"
|
|
1367
|
+
? ["address"]
|
|
1368
|
+
: result.path === "swarm update" || result.path === "profile"
|
|
1369
|
+
? ["name", "description"]
|
|
1370
|
+
: result.path === "swarm approve"
|
|
1371
|
+
? []
|
|
1372
|
+
: ["publish", "templates set", "templates remove"].includes(
|
|
1373
|
+
result.path,
|
|
1374
|
+
)
|
|
1375
|
+
? ["expect"]
|
|
1376
|
+
: result.path === "get"
|
|
1377
|
+
? ["output"]
|
|
1378
|
+
: result.path === "templates render"
|
|
1379
|
+
? ["description"]
|
|
1380
|
+
: result.path === "bundle build" ||
|
|
1381
|
+
result.path === "build"
|
|
1382
|
+
? ["output"]
|
|
1383
|
+
: result.path === "history list"
|
|
1384
|
+
? [
|
|
1385
|
+
"app",
|
|
1386
|
+
"status",
|
|
1387
|
+
"since",
|
|
1388
|
+
"until",
|
|
1389
|
+
"limit",
|
|
1390
|
+
"before",
|
|
1391
|
+
]
|
|
1392
|
+
: result.path === "history remove"
|
|
1393
|
+
? ["app", "status", "since", "until"]
|
|
1394
|
+
: [];
|
|
1329
1395
|
while (tokens.length) {
|
|
1330
1396
|
const value = tokens.shift()!;
|
|
1331
1397
|
if (
|
|
@@ -1335,6 +1401,14 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1335
1401
|
result.positional.push(value);
|
|
1336
1402
|
} else if (value.startsWith("--") || value === "-o") {
|
|
1337
1403
|
const option = value === "-o" ? "output" : value.slice(2);
|
|
1404
|
+
if (result.path === "daemon" && option === "swarm") {
|
|
1405
|
+
const input = tokens.shift();
|
|
1406
|
+
if (!input || input.startsWith("-")) syntax("--swarm needs a value.");
|
|
1407
|
+
if (flags.swarm !== undefined)
|
|
1408
|
+
syntax("daemon accepts --swarm at most once.");
|
|
1409
|
+
flags.swarm = input;
|
|
1410
|
+
continue;
|
|
1411
|
+
}
|
|
1338
1412
|
if (result.path === "skills sync" && option === "agent") {
|
|
1339
1413
|
const input = tokens.shift();
|
|
1340
1414
|
if (!input || input.startsWith("-")) syntax("--agent needs a value.");
|
|
@@ -1359,6 +1433,10 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1359
1433
|
(result.parameters ??= []).push(input);
|
|
1360
1434
|
continue;
|
|
1361
1435
|
}
|
|
1436
|
+
if (result.path === "swarm request" && option === "alias")
|
|
1437
|
+
syntax(
|
|
1438
|
+
"swarm request --alias was removed. First run ipab swarm set ALIAS CONFIG_URL, then ipab swarm request ALIAS.",
|
|
1439
|
+
);
|
|
1362
1440
|
if (Object.hasOwn(result.options, option))
|
|
1363
1441
|
syntax(`Duplicate option ${value}.`);
|
|
1364
1442
|
if (booleans.includes(option)) result.options[option] = true;
|
|
@@ -1385,8 +1463,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1385
1463
|
else syntax(`Unknown option "${value}".`);
|
|
1386
1464
|
} else result.positional.push(value);
|
|
1387
1465
|
}
|
|
1388
|
-
|
|
1389
|
-
syntax("--force and --no-force are mutually exclusive.");
|
|
1466
|
+
validateRefreshOptions(result.options);
|
|
1390
1467
|
if (
|
|
1391
1468
|
result.path === "search" &&
|
|
1392
1469
|
result.options.current &&
|
|
@@ -1407,6 +1484,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1407
1484
|
"register list accepts --swarm at most once. Select one Swarm or omit it to use the current Swarm.",
|
|
1408
1485
|
);
|
|
1409
1486
|
const counts: Record<string, [number, number]> = {
|
|
1487
|
+
daemon: [0, 0],
|
|
1410
1488
|
doctor: [0, 0],
|
|
1411
1489
|
"skills list": [0, 0],
|
|
1412
1490
|
"skills sync": [0, Number.MAX_SAFE_INTEGER],
|
|
@@ -1421,7 +1499,7 @@ export function parse(argv: readonly string[]): Parsed {
|
|
|
1421
1499
|
"swarm status": [0, 0],
|
|
1422
1500
|
"swarm members": [0, 0],
|
|
1423
1501
|
"swarm list": [0, 0],
|
|
1424
|
-
"swarm
|
|
1502
|
+
"swarm set": [2, 2],
|
|
1425
1503
|
"swarm use": [1, 1],
|
|
1426
1504
|
"swarm remove": [1, 1],
|
|
1427
1505
|
"swarm update": [0, 0],
|
|
@@ -1627,9 +1705,12 @@ async function performCli(
|
|
|
1627
1705
|
}
|
|
1628
1706
|
const items = effectiveConfig(
|
|
1629
1707
|
state.config({
|
|
1630
|
-
includeSecrets:
|
|
1631
|
-
|
|
1632
|
-
|
|
1708
|
+
includeSecrets: ![
|
|
1709
|
+
"swarm members",
|
|
1710
|
+
"profile",
|
|
1711
|
+
"swarm status",
|
|
1712
|
+
"swarm set",
|
|
1713
|
+
].includes(parsed.path),
|
|
1633
1714
|
}),
|
|
1634
1715
|
parsed.flags,
|
|
1635
1716
|
env,
|
|
@@ -1664,11 +1745,31 @@ async function performCli(
|
|
|
1664
1745
|
stateDir: stateLocation(parsed.flags, env).path,
|
|
1665
1746
|
cacheTtl: Number(value("swarm.cacheTtl")),
|
|
1666
1747
|
listen: value("swarm.listen") === "loopback" ? "loopback" : "lan",
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1748
|
+
pivot: Boolean(value("swarm.pivot")),
|
|
1749
|
+
...(parsed.path === "daemon"
|
|
1750
|
+
? {
|
|
1751
|
+
daemonReady: () =>
|
|
1752
|
+
serveDaemon(
|
|
1753
|
+
stateLocation(parsed.flags, env).path,
|
|
1754
|
+
parsed.flags.swarm === undefined ? undefined : requireSwarm(),
|
|
1755
|
+
),
|
|
1756
|
+
}
|
|
1757
|
+
: {
|
|
1758
|
+
ensureDaemon: () =>
|
|
1759
|
+
ensureDaemon(
|
|
1760
|
+
stateLocation(parsed.flags, env).path,
|
|
1761
|
+
env,
|
|
1762
|
+
(text) => {
|
|
1763
|
+
io.err(text);
|
|
1764
|
+
},
|
|
1765
|
+
),
|
|
1766
|
+
}),
|
|
1767
|
+
forceRefresh:
|
|
1768
|
+
parsed.options.refresh || parsed.options.force
|
|
1769
|
+
? true
|
|
1770
|
+
: parsed.options["no-refresh"] || parsed.options["no-force"]
|
|
1771
|
+
? false
|
|
1772
|
+
: Boolean(value("swarm.forceRefresh")),
|
|
1672
1773
|
diagnostic: (text) => {
|
|
1673
1774
|
io.err(text);
|
|
1674
1775
|
},
|
|
@@ -1975,9 +2076,11 @@ async function performCli(
|
|
|
1975
2076
|
})),
|
|
1976
2077
|
},
|
|
1977
2078
|
[
|
|
1978
|
-
...
|
|
1979
|
-
(entry) =>
|
|
1980
|
-
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${
|
|
2079
|
+
...alignedRows(
|
|
2080
|
+
result.swarms.map((entry) => [
|
|
2081
|
+
`${entry.cid === result.effectiveCurrent ? "*" : " "} ${entry.alias ?? entry.cid}`,
|
|
2082
|
+
entry.cid,
|
|
2083
|
+
]),
|
|
1981
2084
|
),
|
|
1982
2085
|
...(result.swarms.length ? [] : ["No registered Swarms."]),
|
|
1983
2086
|
...(result.effectiveCurrent === null
|
|
@@ -2014,7 +2117,61 @@ async function performCli(
|
|
|
2014
2117
|
);
|
|
2015
2118
|
break;
|
|
2016
2119
|
}
|
|
2017
|
-
case "swarm
|
|
2120
|
+
case "swarm set": {
|
|
2121
|
+
swarmAlias(first!);
|
|
2122
|
+
const cid = swarmUrl(second!);
|
|
2123
|
+
const previous = state.swarms().find((entry) => entry.alias === first);
|
|
2124
|
+
if (previous && previous.cid !== cid) {
|
|
2125
|
+
io.err(`Swarm alias ${first}: ${previous.cid} -> ${cid}`);
|
|
2126
|
+
if (
|
|
2127
|
+
!parsed.options.yes &&
|
|
2128
|
+
(!io.tty ||
|
|
2129
|
+
!(await io.confirm(
|
|
2130
|
+
`Retarget local Swarm alias "${first}" from ${previous.cid} to ${cid}?`,
|
|
2131
|
+
)))
|
|
2132
|
+
)
|
|
2133
|
+
throw new HostError(
|
|
2134
|
+
"Alias unchanged. Retargeting requires --yes or interactive confirmation.",
|
|
2135
|
+
);
|
|
2136
|
+
}
|
|
2137
|
+
const entry = state.setSwarm(first!, cid, previous?.cid ?? null);
|
|
2138
|
+
emit(
|
|
2139
|
+
{
|
|
2140
|
+
configUrl: entry.cid,
|
|
2141
|
+
alias: entry.alias,
|
|
2142
|
+
savedCurrent:
|
|
2143
|
+
state.config({ includeSecrets: false })["swarm.default"] ?? null,
|
|
2144
|
+
},
|
|
2145
|
+
`Set local swarm alias ${entry.alias} (${cid}).`,
|
|
2146
|
+
);
|
|
2147
|
+
break;
|
|
2148
|
+
}
|
|
2149
|
+
case "daemon": {
|
|
2150
|
+
if (parsed.flags.json)
|
|
2151
|
+
syntax(
|
|
2152
|
+
"--json is not supported for daemon; diagnostics are written to stderr.",
|
|
2153
|
+
);
|
|
2154
|
+
store = new IpfsStore(await storeConfiguration(value("store.gateway")));
|
|
2155
|
+
const controller = new AbortController();
|
|
2156
|
+
const interrupt = () => {
|
|
2157
|
+
controller.abort();
|
|
2158
|
+
};
|
|
2159
|
+
process.once("SIGINT", interrupt);
|
|
2160
|
+
process.once("SIGTERM", interrupt);
|
|
2161
|
+
try {
|
|
2162
|
+
await swarmDaemon(
|
|
2163
|
+
swarmContext(),
|
|
2164
|
+
parsed.flags.swarm === undefined ? undefined : requireSwarm(),
|
|
2165
|
+
controller.signal,
|
|
2166
|
+
);
|
|
2167
|
+
} catch (cause) {
|
|
2168
|
+
if (!controller.signal.aborted) throw cause;
|
|
2169
|
+
} finally {
|
|
2170
|
+
process.removeListener("SIGINT", interrupt);
|
|
2171
|
+
process.removeListener("SIGTERM", interrupt);
|
|
2172
|
+
}
|
|
2173
|
+
break;
|
|
2174
|
+
}
|
|
2018
2175
|
case "swarm update":
|
|
2019
2176
|
case "search":
|
|
2020
2177
|
case "skills list":
|
|
@@ -2039,6 +2196,7 @@ async function performCli(
|
|
|
2039
2196
|
sync: parsed.path === "skills sync",
|
|
2040
2197
|
names: parsed.positional,
|
|
2041
2198
|
agents: parsed.agents ?? [],
|
|
2199
|
+
overrideExisting: Boolean(parsed.options["override-existing"]),
|
|
2042
2200
|
dryRun: Boolean(parsed.options["dry-run"]),
|
|
2043
2201
|
yes: Boolean(parsed.options.yes),
|
|
2044
2202
|
tty: io.tty,
|
|
@@ -2090,20 +2248,33 @@ async function performCli(
|
|
|
2090
2248
|
break;
|
|
2091
2249
|
}
|
|
2092
2250
|
if (parsed.path === "swarm members") {
|
|
2093
|
-
const result = await swarmMembers(
|
|
2251
|
+
const result = await swarmMembers(
|
|
2252
|
+
context,
|
|
2253
|
+
requireSwarm(),
|
|
2254
|
+
Boolean(parsed.options.refresh || parsed.options.force),
|
|
2255
|
+
);
|
|
2094
2256
|
emit(
|
|
2095
2257
|
result,
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
result.
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
member
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2258
|
+
[
|
|
2259
|
+
`Directory: ${result.cache.source} (${result.cache.freshness}), observed ${result.cache.updatedAt}`,
|
|
2260
|
+
`Daemon: ${result.local.status}, observed ${result.local.updatedAt ?? "unknown"}; control-plane verified ${result.local.verifiedAt ?? "unknown"}`,
|
|
2261
|
+
table(
|
|
2262
|
+
["NAME", "DESCRIPTION", "ROLE", "PIVOT", "PUBLIC KEY"],
|
|
2263
|
+
result.members.map((member) => [
|
|
2264
|
+
member.name,
|
|
2265
|
+
member.description,
|
|
2266
|
+
member.role,
|
|
2267
|
+
member.pivot ? (member.localStatus ?? "candidate") : "-",
|
|
2268
|
+
member.publicKey,
|
|
2269
|
+
]),
|
|
2270
|
+
"No members.",
|
|
2271
|
+
),
|
|
2272
|
+
].join("\n"),
|
|
2106
2273
|
);
|
|
2274
|
+
if (result.local.error)
|
|
2275
|
+
io.err(
|
|
2276
|
+
`Local Pivot observations (${result.local.status}): ${printable(result.local.error)}`,
|
|
2277
|
+
);
|
|
2107
2278
|
break;
|
|
2108
2279
|
}
|
|
2109
2280
|
if (parsed.path === "swarm export") {
|
|
@@ -2160,28 +2331,6 @@ async function performCli(
|
|
|
2160
2331
|
);
|
|
2161
2332
|
break;
|
|
2162
2333
|
}
|
|
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
2334
|
if (parsed.path === "search") {
|
|
2186
2335
|
const registrations = state.swarms();
|
|
2187
2336
|
const scope = parsed.options.all
|
|
@@ -2200,10 +2349,17 @@ async function performCli(
|
|
|
2200
2349
|
}
|
|
2201
2350
|
if (parsed.path === "swarm status") {
|
|
2202
2351
|
const cid = requireSwarm();
|
|
2203
|
-
const
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2352
|
+
const {
|
|
2353
|
+
head,
|
|
2354
|
+
config,
|
|
2355
|
+
networking,
|
|
2356
|
+
cache,
|
|
2357
|
+
state: contentState,
|
|
2358
|
+
} = await inspectSwarmStatus(
|
|
2359
|
+
context,
|
|
2360
|
+
cid,
|
|
2361
|
+
Boolean(parsed.options.refresh || parsed.options.force),
|
|
2362
|
+
);
|
|
2207
2363
|
const fingerprint = await keyId(config.owner);
|
|
2208
2364
|
store = context.store;
|
|
2209
2365
|
emit(
|
|
@@ -2212,12 +2368,11 @@ async function performCli(
|
|
|
2212
2368
|
owner: config.owner,
|
|
2213
2369
|
ownerFingerprint: fingerprint,
|
|
2214
2370
|
epoch: config.epoch,
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
: {}),
|
|
2371
|
+
scopeId: config.scopeId,
|
|
2372
|
+
headId: config.headId,
|
|
2373
|
+
cache,
|
|
2374
|
+
state: contentState,
|
|
2375
|
+
networking,
|
|
2221
2376
|
root: head.root,
|
|
2222
2377
|
valueCid: head.cid,
|
|
2223
2378
|
properties: {
|
|
@@ -2227,6 +2382,7 @@ async function performCli(
|
|
|
2227
2382
|
},
|
|
2228
2383
|
[
|
|
2229
2384
|
"Swarm",
|
|
2385
|
+
` Directory: ${cache.source} (${cache.freshness}), observed ${cache.updatedAt}`,
|
|
2230
2386
|
` Name: ${printable(config.name)}`,
|
|
2231
2387
|
` Description: ${config.description ? printable(config.description) : "(none)"}`,
|
|
2232
2388
|
" Config URL:",
|
|
@@ -2235,23 +2391,69 @@ async function performCli(
|
|
|
2235
2391
|
"Identity",
|
|
2236
2392
|
" Owner fingerprint:",
|
|
2237
2393
|
` ${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
2394
|
"",
|
|
2250
2395
|
"Content",
|
|
2251
2396
|
" HEAD (publication root):",
|
|
2252
2397
|
` ${head.root}`,
|
|
2253
2398
|
" Content CID (HEAD value):",
|
|
2254
2399
|
` ${head.cid}`,
|
|
2400
|
+
` State: ${contentState.status}. ${contentState.error}`,
|
|
2401
|
+
"",
|
|
2402
|
+
"Local networking",
|
|
2403
|
+
` Daemon observations: ${networking.daemon.status}`,
|
|
2404
|
+
` Updated: ${networking.daemon.updatedAt ?? "unknown"}`,
|
|
2405
|
+
` Control-plane verified: ${networking.daemon.verifiedAt ?? "unknown"}`,
|
|
2406
|
+
...(networking.daemon.error
|
|
2407
|
+
? [` Observation error: ${printable(networking.daemon.error)}`]
|
|
2408
|
+
: []),
|
|
2409
|
+
` Connections observed: ${networking.connections.observedAt ?? "unknown"} (${networking.connections.freshness})`,
|
|
2410
|
+
...(networking.connections.error
|
|
2411
|
+
? [
|
|
2412
|
+
` Connection error: ${printable(networking.connections.error)}`,
|
|
2413
|
+
]
|
|
2414
|
+
: []),
|
|
2415
|
+
table(
|
|
2416
|
+
[
|
|
2417
|
+
"PIVOT PEER ID",
|
|
2418
|
+
"LOCAL",
|
|
2419
|
+
"PROBE",
|
|
2420
|
+
"PROBED AT",
|
|
2421
|
+
"FAILURES",
|
|
2422
|
+
"RETRY AT",
|
|
2423
|
+
"CONNECTION",
|
|
2424
|
+
],
|
|
2425
|
+
networking.pivots.map((pivot) => [
|
|
2426
|
+
pivot.peerId,
|
|
2427
|
+
pivot.localStatus ?? "unknown",
|
|
2428
|
+
`${pivot.probe.result} (${pivot.probe.freshness})`,
|
|
2429
|
+
pivot.probe.at ?? "-",
|
|
2430
|
+
pivot.failures === null ? "-" : String(pivot.failures),
|
|
2431
|
+
pivot.retryAt ?? "-",
|
|
2432
|
+
pivot.connection.status,
|
|
2433
|
+
]),
|
|
2434
|
+
"No declared Pivots.",
|
|
2435
|
+
),
|
|
2436
|
+
...networking.pivots.flatMap((pivot) =>
|
|
2437
|
+
pivot.probe.error
|
|
2438
|
+
? [
|
|
2439
|
+
` ${pivot.peerId} probe error: ${printable(pivot.probe.error)}`,
|
|
2440
|
+
]
|
|
2441
|
+
: [],
|
|
2442
|
+
),
|
|
2443
|
+
...(networking.connections.error
|
|
2444
|
+
? []
|
|
2445
|
+
: [
|
|
2446
|
+
table(
|
|
2447
|
+
["CONNECTED PEER ID", "TRANSPORT", "ADDRESS"],
|
|
2448
|
+
networking.connections.peers.map((peer) => [
|
|
2449
|
+
peer.peerId,
|
|
2450
|
+
peer.transport,
|
|
2451
|
+
peer.address,
|
|
2452
|
+
]),
|
|
2453
|
+
"No observed peer connections.",
|
|
2454
|
+
),
|
|
2455
|
+
]),
|
|
2456
|
+
" Selected is configuration, not connection success. Relay connectivity does not guarantee content availability.",
|
|
2255
2457
|
].join("\n"),
|
|
2256
2458
|
);
|
|
2257
2459
|
break;
|
|
@@ -2332,14 +2534,15 @@ async function performCli(
|
|
|
2332
2534
|
: {}),
|
|
2333
2535
|
});
|
|
2334
2536
|
} else if (parsed.path === "swarm request") {
|
|
2335
|
-
const result = await requestMembership(
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2537
|
+
const result = await requestMembership(
|
|
2538
|
+
context,
|
|
2539
|
+
state.resolveSwarm(first!),
|
|
2540
|
+
{
|
|
2541
|
+
...(typeof parsed.options.output === "string"
|
|
2542
|
+
? { output: parsed.options.output }
|
|
2543
|
+
: {}),
|
|
2544
|
+
},
|
|
2545
|
+
);
|
|
2343
2546
|
store = context.store;
|
|
2344
2547
|
io.err(
|
|
2345
2548
|
`Owner fingerprint: ${result.ownerFingerprint}\nVerify this fingerprint through an independent trusted channel before manually sending the Request file to the Owner.`,
|