buckyos 0.7.119 → 0.7.121

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.
Files changed (44) hide show
  1. package/cli/README.md +24 -3
  2. package/cli/core/app.ts +28 -0
  3. package/cli/deno.json +2 -1
  4. package/cli/dist/cli.mjs +777 -169
  5. package/cli/dist/cli.mjs.map +1 -1
  6. package/cli/modules/app.ts +213 -94
  7. package/cli/modules/provision.ts +690 -0
  8. package/cli/runtime/host.ts +25 -2
  9. package/cli/runtime/host_deno.ts +4 -0
  10. package/cli/runtime/host_node.ts +4 -0
  11. package/cli/version.ts +1 -1
  12. package/dist/browser.cjs +1 -1
  13. package/dist/browser.mjs +124 -124
  14. package/dist/index.cjs +1 -1
  15. package/dist/index.mjs +124 -124
  16. package/dist/{ndm_proxy-c00bc561.mjs → ndm_proxy-8f547002.mjs} +113 -216
  17. package/dist/ndm_proxy-8f547002.mjs.map +1 -0
  18. package/dist/ndm_proxy-93a8869b.js +13 -0
  19. package/dist/ndm_proxy-93a8869b.js.map +1 -0
  20. package/dist/ndn_types-44c69036.js +2 -0
  21. package/dist/ndn_types-44c69036.js.map +1 -0
  22. package/dist/{ndn_types-f6c08d20.mjs → ndn_types-d768245f.mjs} +149 -39
  23. package/dist/ndn_types-d768245f.mjs.map +1 -0
  24. package/dist/node.cjs +1 -1
  25. package/dist/node.mjs +124 -124
  26. package/dist/provision.cjs +6 -6
  27. package/dist/provision.cjs.map +1 -1
  28. package/dist/provision.d.ts +2 -0
  29. package/dist/provision.d.ts.map +1 -1
  30. package/dist/provision.mjs +1084 -35
  31. package/dist/provision.mjs.map +1 -1
  32. package/dist/provision_activate.d.ts +146 -0
  33. package/dist/provision_activate.d.ts.map +1 -0
  34. package/dist/{tus_client-573066b3.mjs → tus_client-b1c35e8c.mjs} +2 -2
  35. package/dist/{tus_client-573066b3.mjs.map → tus_client-b1c35e8c.mjs.map} +1 -1
  36. package/dist/{tus_client-83ad0f4f.js → tus_client-d0798623.js} +2 -2
  37. package/dist/{tus_client-83ad0f4f.js.map → tus_client-d0798623.js.map} +1 -1
  38. package/package.json +1 -1
  39. package/dist/ndm_proxy-68354a89.js +0 -13
  40. package/dist/ndm_proxy-68354a89.js.map +0 -1
  41. package/dist/ndm_proxy-c00bc561.mjs.map +0 -1
  42. package/dist/ndn_types-859bbd48.js +0 -2
  43. package/dist/ndn_types-859bbd48.js.map +0 -1
  44. package/dist/ndn_types-f6c08d20.mjs.map +0 -1
package/cli/README.md CHANGED
@@ -42,6 +42,27 @@ node cli/launcher.mjs --non-interactive --yes pikg clean ./dapp_meta
42
42
  `pikg` consumes existing build output; it does not replace an App's Vite, Webpack, Cargo, or Docker
43
43
  build scripts. Set `SOURCE_DATE_EPOCH` for byte-reproducible Node/Deno PIKG builds.
44
44
 
45
+ ## Provision (first activation of an installed root)
46
+
47
+ `provision status|check|activate` initialise an installed, not yet activated BuckyOS root on this
48
+ machine (single OOD, `did:web`, no SN/BNS). They are local commands: no Zone session, no network, no
49
+ TaskManager. The activation itself is the SDK API exported from `buckyos/provision`
50
+ (`inspectActivationRoot`, `checkOfflineActivation`, `activateOfflineZone`); the module only adds
51
+ argv, host-policy checks, the hidden password prompt / secret `--input` field, confirmation and
52
+ output. See `doc/modules/provision.md` for the commit protocol and error codes.
53
+
54
+ ```bash
55
+ buckyos provision status --root /opt/buckyos
56
+ buckyos provision check --root /opt/buckyos --domain corp.example.com --owner-name admin \
57
+ --owner-key-backup /secure-backup/corp-owner.pem
58
+ buckyos --non-interactive --yes --input activation.json provision activate \
59
+ --root /opt/buckyos --owner-key-backup /secure-backup/corp-owner.pem
60
+ ```
61
+
62
+ The launcher grants filesystem permissions only for the `--root` and `--owner-key-backup` paths
63
+ given on the command line; `admin_password` is accepted only as the secret field of `--input` JSON
64
+ or from a terminal prompt.
65
+
45
66
  ## Policy and identity
46
67
 
47
68
  The developer policy grants the package root, cwd, Tool config, the read-only `~/.buckyos` and
@@ -55,9 +76,9 @@ developer-only `~/.buckycli` root, the Tool reads `system.dev_mode.get` from the
55
76
  requires a valid `BuckyOSDevConfig` with `enabled: true`. Automatic discovery tries `~/.buckyos`
56
77
  first and consults developer mode only if no operations identity succeeds; the combined search is
57
78
  limited to eight usable candidates. An explicitly selected identity is tried once. Rotation occurs
58
- only during session creation and only for
59
- `IDENTITY_KIND_NOT_ACCEPTED` or `AUTHENTICATION_REJECTED`; timeouts, network errors, capability
60
- mismatches and RBAC denial never rotate. Private keys and tokens are never shown.
79
+ only during session creation and only for `IDENTITY_KIND_NOT_ACCEPTED` or `AUTHENTICATION_REJECTED`;
80
+ timeouts, network errors, capability mismatches and RBAC denial never rotate. Private keys and
81
+ tokens are never shown.
61
82
 
62
83
  ## Verification
63
84
 
package/cli/core/app.ts CHANGED
@@ -33,6 +33,7 @@ import { type AppModuleDependencies, createAppModule } from '../modules/app.ts'
33
33
  import { createDiagnosticModule, type DiagnosticModuleDependencies } from '../modules/diagnostic.ts'
34
34
  import { createLogModule, type LogModuleDependencies } from '../modules/log.ts'
35
35
  import { createTaskModule } from '../modules/task.ts'
36
+ import { createProvisionModule, type ProvisionModuleDependencies } from '../modules/provision.ts'
36
37
  import {
37
38
  distributionManifestView,
38
39
  getHost,
@@ -68,6 +69,7 @@ export interface ApplicationDependencies {
68
69
  app?: AppModuleDependencies
69
70
  log?: LogModuleDependencies
70
71
  diagnostic?: DiagnosticModuleDependencies
72
+ provision?: ProvisionModuleDependencies
71
73
  }
72
74
 
73
75
  export class BuckyOSToolApplication {
@@ -91,6 +93,7 @@ export class BuckyOSToolApplication {
91
93
  dependencies.app,
92
94
  dependencies.log,
93
95
  dependencies.diagnostic,
96
+ dependencies.provision,
94
97
  )
95
98
  this.#environment = dependencies.environment ?? readEnvironment()
96
99
  this.#cwd = dependencies.cwd ?? getHost().cwd()
@@ -180,6 +183,7 @@ export class BuckyOSToolApplication {
180
183
  await this.#stdio.stdout(`${commandHelp(this.registry, command)}\n`)
181
184
  return EXIT_SUCCESS
182
185
  }
186
+ if (command.execution === 'local') assertNoSessionOptions(invocation.global, command)
183
187
  const setup = await this.#resolveForCommand(command, invocation.global)
184
188
  const inputObject = invocation.global.input
185
189
  ? await this.#readInputObject(invocation.global.input)
@@ -456,6 +460,7 @@ export function createRegistry(
456
460
  appDependencies?: AppModuleDependencies,
457
461
  logDependencies?: LogModuleDependencies,
458
462
  diagnosticDependencies?: DiagnosticModuleDependencies,
463
+ provisionDependencies?: ProvisionModuleDependencies,
459
464
  ): CommandRegistry {
460
465
  const registry = new CommandRegistry()
461
466
  for (const module of createCoreModules(registry)) registry.register(module)
@@ -467,9 +472,32 @@ export function createRegistry(
467
472
  registry.register(createTaskModule())
468
473
  registry.register(createLogModule(logDependencies))
469
474
  registry.register(createDiagnosticModule(diagnosticDependencies))
475
+ registry.register(createProvisionModule(provisionDependencies))
470
476
  return registry
471
477
  }
472
478
 
479
+ // Commands that declare execution=local run without a Zone, profile, identity,
480
+ // or network; online-only session options must not silently retarget them.
481
+ function assertNoSessionOptions(global: GlobalOptions, command: RegisteredCommand): void {
482
+ for (
483
+ const [name, value] of [
484
+ ['profile', global.profile],
485
+ ['zone', global.zone],
486
+ ['endpoint', global.endpoint],
487
+ ['identity', global.identity],
488
+ ['session-token', global.sessionToken],
489
+ ['session-token-file', global.sessionTokenFile],
490
+ ] as const
491
+ ) {
492
+ if (value !== undefined) {
493
+ throw new UsageError(
494
+ 'ARGUMENT_CONFLICT',
495
+ `--${name} cannot be combined with the local command ${command.module} ${command.verb}`,
496
+ )
497
+ }
498
+ }
499
+ }
500
+
473
501
  const unavailableClients: ServiceClientRegistry = {
474
502
  call: () => Promise.reject(new ToolError('INTERNAL_ERROR', 'service clients are unavailable', 9)),
475
503
  }
package/cli/deno.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "imports": {
3
3
  "buckyos": "../dist/node.mjs",
4
- "buckyos/node": "../dist/node.mjs"
4
+ "buckyos/node": "../dist/node.mjs",
5
+ "buckyos/provision": "../dist/provision.mjs"
5
6
  },
6
7
  "tasks": {
7
8
  "run": "deno run --allow-net --allow-read --allow-write --allow-run=docker --allow-env system_launcher.ts",