@powerhousedao/host-core 6.2.3-dev.58 → 6.2.3-dev.60

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/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
- import { C as probeHostsFolder, S as loadHost, _ as HostLoadError, a as RunnerHandle, b as findNonStaticValue, c as RunnerContext, d as RunnerVerb, f as getVerb, g as HostDefinition, h as validateHost, i as RunCompoundResult, l as RunnerError, m as resolveRunnerModule, n as CompoundWiring, o as runCompound, p as listVerbs, r as RunCompoundOptions, s as HostSchemaLike, t as CompoundMember, u as RunnerModule, v as HostsFolderStatus, x as lintHostImports, y as LoadedHost } from "./compound-9--OujO-.mjs";
1
+ import { C as probeHostsFolder, S as loadHost, _ as HostLoadError, a as RunnerHandle, b as findNonStaticValue, c as RunnerContext, d as RunnerVerb, f as getVerb, g as HostDefinition, h as validateHost, i as RunCompoundResult, l as RunnerError, m as resolveRunnerModule, n as CompoundWiring, o as runCompound, p as listVerbs, r as RunCompoundOptions, s as HostSchemaLike, t as CompoundMember, u as RunnerModule, v as HostsFolderStatus, x as lintHostImports, y as LoadedHost } from "./compound-C8P0kvPJ.mjs";
2
+ import { ContributionSource, Contributions, HostPlugin, HostPluginModule, MergedContribution, NormalizedPluginEntry, Observe, PluginEntry, PluginError, Provide, ResolvedPlugin, Transform, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook } from "./plugins.mjs";
2
3
  import { z } from "zod";
3
4
  import { PHConnectDefaultDrive, PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
4
5
  //#region src/connect-projection.d.ts
@@ -166,12 +167,26 @@ interface SwitchboardReactorProjection {
166
167
  }
167
168
  /** Project the reactor block onto the switchboard's env + options. */
168
169
  export declare function projectReactorToSwitchboard(reactor: ReactorConfig | undefined): SwitchboardReactorProjection;
170
+ /** The four reactor-client shapes a Connect host can select (mirrors the
171
+ * shared PHReactorClientMode; kept local to avoid an import cycle). */
172
+ type ReactorClientMode = "in-process" | "worker" | "remote" | "router";
173
+ /**
174
+ * Which reactor client the backend topology asks for:
175
+ * - local (in-process/worker) AND remote backends -> `router`
176
+ * - remote backend(s) only -> `remote`
177
+ * - a worker backend -> `worker`
178
+ * - anything else local -> `in-process`
179
+ * `undefined` when no backends are declared — the caller then keeps the
180
+ * legacy reactorWorker/multiReactor behaviour untouched.
181
+ */
182
+ export declare function reactorClientMode(reactor: ReactorConfig | undefined): ReactorClientMode | undefined;
169
183
  interface ConnectReactorProjection {
170
184
  /** Patch merged into the connect runtime config (connect.*). */
171
185
  connect: {
172
186
  reactor?: ReactorProtocol;
173
187
  instance?: {
174
188
  reactorWorker?: boolean;
189
+ reactorClient?: ReactorClientMode;
175
190
  };
176
191
  app?: {
177
192
  workflowsEnabled?: boolean;
@@ -179,7 +194,8 @@ interface ConnectReactorProjection {
179
194
  };
180
195
  }
181
196
  /** Project the reactor block onto the Connect runtime config: protocol →
182
- * connect.reactor (same shape), backend kind → instance.reactorWorker,
197
+ * connect.reactor (same shape), backend topology → instance.reactorWorker
198
+ * (legacy) + instance.reactorClient (the explicit 4-way selector),
183
199
  * workflows → app.workflowsEnabled. */
184
200
  export declare function projectReactorToConnect(reactor: ReactorConfig | undefined): ConnectReactorProjection;
185
201
  /**
@@ -305,6 +321,13 @@ export declare const reactorBackendSchema: z.ZodObject<{
305
321
  host: z.ZodOptional<z.ZodString>;
306
322
  url: z.ZodOptional<z.ZodString>;
307
323
  }, z.core.$strict>>;
324
+ projection: z.ZodOptional<z.ZodObject<{
325
+ enabled: z.ZodOptional<z.ZodBoolean>;
326
+ dbPoolSize: z.ZodOptional<z.ZodNumber>;
327
+ }, z.core.$strict>>;
328
+ executors: z.ZodOptional<z.ZodObject<{
329
+ numWorkers: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
330
+ }, z.core.$strict>>;
308
331
  }, z.core.$strict>;
309
332
  export declare const reactorSchema: z.ZodObject<{
310
333
  backends: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -335,12 +358,18 @@ export declare const reactorSchema: z.ZodObject<{
335
358
  host: z.ZodOptional<z.ZodString>;
336
359
  url: z.ZodOptional<z.ZodString>;
337
360
  }, z.core.$strict>>;
361
+ projection: z.ZodOptional<z.ZodObject<{
362
+ enabled: z.ZodOptional<z.ZodBoolean>;
363
+ dbPoolSize: z.ZodOptional<z.ZodNumber>;
364
+ }, z.core.$strict>>;
365
+ executors: z.ZodOptional<z.ZodObject<{
366
+ numWorkers: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
367
+ }, z.core.$strict>>;
338
368
  }, z.core.$strict>>>;
339
369
  placement: z.ZodOptional<z.ZodObject<{
340
370
  primary: z.ZodOptional<z.ZodString>;
341
371
  default: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
342
372
  }, z.core.$strict>>;
343
- workflows: z.ZodOptional<z.ZodBoolean>;
344
373
  protocol: z.ZodOptional<z.ZodObject<{
345
374
  featureFlags: z.ZodOptional<z.ZodObject<{
346
375
  documentDecisions: z.ZodOptional<z.ZodBoolean>;
@@ -357,6 +386,40 @@ export declare const reactorSchema: z.ZodObject<{
357
386
  refuse: "refuse";
358
387
  }>>;
359
388
  }, z.core.$strict>>;
389
+ /** DEPRECATED (dies in R2): workflows become a listed plugin — presence is
390
+ * activation. Kept parsing until the switchboard rewire lands. */
391
+ workflows: z.ZodOptional<z.ZodBoolean>;
392
+ renown: z.ZodOptional<z.ZodObject<{
393
+ url: z.ZodOptional<z.ZodString>;
394
+ networkId: z.ZodOptional<z.ZodString>;
395
+ chainId: z.ZodOptional<z.ZodNumber>;
396
+ }, z.core.$strict>>;
397
+ packages: z.ZodOptional<z.ZodObject<{
398
+ registryUrl: z.ZodOptional<z.ZodString>;
399
+ }, z.core.$strict>>;
400
+ namespace: z.ZodOptional<z.ZodString>;
401
+ auth: z.ZodOptional<z.ZodObject<{
402
+ enabled: z.ZodOptional<z.ZodBoolean>;
403
+ admins: z.ZodOptional<z.ZodArray<z.ZodString>>;
404
+ renown: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
405
+ }, z.core.$strict>>;
406
+ drives: z.ZodOptional<z.ZodArray<z.ZodObject<{
407
+ slug: z.ZodString;
408
+ id: z.ZodOptional<z.ZodString>;
409
+ projectHash: z.ZodOptional<z.ZodBoolean>;
410
+ name: z.ZodOptional<z.ZodString>;
411
+ icon: z.ZodOptional<z.ZodString>;
412
+ preferredEditor: z.ZodOptional<z.ZodString>;
413
+ sharingType: z.ZodOptional<z.ZodEnum<{
414
+ private: "private";
415
+ public: "public";
416
+ shared: "shared";
417
+ }>>;
418
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
419
+ remote: z.ZodOptional<z.ZodObject<{
420
+ url: z.ZodString;
421
+ }, z.core.$strict>>;
422
+ }, z.core.$strict>>>;
360
423
  }, z.core.$strict>;
361
424
  /** Common runner options every host.runner carries; runner modules extend it
362
425
  * loosely with their own process options. */
@@ -364,12 +427,22 @@ export declare const runnerBaseSchema: z.ZodObject<{
364
427
  module: z.ZodString;
365
428
  defaultVerb: z.ZodOptional<z.ZodString>;
366
429
  port: z.ZodOptional<z.ZodNumber>;
430
+ /** Bind address; each runner documents its default (0.0.0.0 for servers,
431
+ * localhost for vite dev, 127.0.0.1 for serve). */
432
+ host: z.ZodOptional<z.ZodString>;
433
+ /** THE COMPOSITION: the plugin entries this host boots with. Presence is
434
+ * activation; see plugins.ts for entry semantics. */
435
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
436
+ module: z.ZodString;
437
+ enabled: z.ZodOptional<z.ZodBoolean>;
438
+ verbs: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
439
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
440
+ }, z.core.$strict>]>>>;
367
441
  }, z.core.$loose>;
368
442
  /** A compound's children map (mutually exclusive with `reactor` — the XOR is
369
443
  * structural, enforced by the loader; schemas validate each side's shape). */
370
444
  export declare const childrenSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
371
445
  host: z.ZodString;
372
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
373
446
  runner: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
374
447
  config: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
375
448
  reactor: z.ZodOptional<z.ZodObject<{
@@ -401,12 +474,18 @@ export declare const childrenSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
401
474
  host: z.ZodOptional<z.ZodString>;
402
475
  url: z.ZodOptional<z.ZodString>;
403
476
  }, z.core.$strict>>;
477
+ projection: z.ZodOptional<z.ZodObject<{
478
+ enabled: z.ZodOptional<z.ZodBoolean>;
479
+ dbPoolSize: z.ZodOptional<z.ZodNumber>;
480
+ }, z.core.$strict>>;
481
+ executors: z.ZodOptional<z.ZodObject<{
482
+ numWorkers: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
483
+ }, z.core.$strict>>;
404
484
  }, z.core.$strict>>>;
405
485
  placement: z.ZodOptional<z.ZodObject<{
406
486
  primary: z.ZodOptional<z.ZodString>;
407
487
  default: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
408
488
  }, z.core.$strict>>;
409
- workflows: z.ZodOptional<z.ZodBoolean>;
410
489
  protocol: z.ZodOptional<z.ZodObject<{
411
490
  featureFlags: z.ZodOptional<z.ZodObject<{
412
491
  documentDecisions: z.ZodOptional<z.ZodBoolean>;
@@ -423,6 +502,40 @@ export declare const childrenSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
423
502
  refuse: "refuse";
424
503
  }>>;
425
504
  }, z.core.$strict>>;
505
+ /** DEPRECATED (dies in R2): workflows become a listed plugin — presence is
506
+ * activation. Kept parsing until the switchboard rewire lands. */
507
+ workflows: z.ZodOptional<z.ZodBoolean>;
508
+ renown: z.ZodOptional<z.ZodObject<{
509
+ url: z.ZodOptional<z.ZodString>;
510
+ networkId: z.ZodOptional<z.ZodString>;
511
+ chainId: z.ZodOptional<z.ZodNumber>;
512
+ }, z.core.$strict>>;
513
+ packages: z.ZodOptional<z.ZodObject<{
514
+ registryUrl: z.ZodOptional<z.ZodString>;
515
+ }, z.core.$strict>>;
516
+ namespace: z.ZodOptional<z.ZodString>;
517
+ auth: z.ZodOptional<z.ZodObject<{
518
+ enabled: z.ZodOptional<z.ZodBoolean>;
519
+ admins: z.ZodOptional<z.ZodArray<z.ZodString>>;
520
+ renown: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
521
+ }, z.core.$strict>>;
522
+ drives: z.ZodOptional<z.ZodArray<z.ZodObject<{
523
+ slug: z.ZodString;
524
+ id: z.ZodOptional<z.ZodString>;
525
+ projectHash: z.ZodOptional<z.ZodBoolean>;
526
+ name: z.ZodOptional<z.ZodString>;
527
+ icon: z.ZodOptional<z.ZodString>;
528
+ preferredEditor: z.ZodOptional<z.ZodString>;
529
+ sharingType: z.ZodOptional<z.ZodEnum<{
530
+ private: "private";
531
+ public: "public";
532
+ shared: "shared";
533
+ }>>;
534
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
535
+ remote: z.ZodOptional<z.ZodObject<{
536
+ url: z.ZodString;
537
+ }, z.core.$strict>>;
538
+ }, z.core.$strict>>>;
426
539
  }, z.core.$strict>>;
427
540
  }, z.core.$strict>>;
428
541
  /** Composed generic host shapes — the basis for the emitted editor schemas
@@ -434,6 +547,17 @@ export declare const reactorHostSchema: z.ZodObject<{
434
547
  module: z.ZodString;
435
548
  defaultVerb: z.ZodOptional<z.ZodString>;
436
549
  port: z.ZodOptional<z.ZodNumber>;
550
+ /** Bind address; each runner documents its default (0.0.0.0 for servers,
551
+ * localhost for vite dev, 127.0.0.1 for serve). */
552
+ host: z.ZodOptional<z.ZodString>;
553
+ /** THE COMPOSITION: the plugin entries this host boots with. Presence is
554
+ * activation; see plugins.ts for entry semantics. */
555
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
556
+ module: z.ZodString;
557
+ enabled: z.ZodOptional<z.ZodBoolean>;
558
+ verbs: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
559
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
560
+ }, z.core.$strict>]>>>;
437
561
  }, z.core.$loose>;
438
562
  config: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
439
563
  profile: z.ZodOptional<z.ZodObject<{
@@ -471,12 +595,18 @@ export declare const reactorHostSchema: z.ZodObject<{
471
595
  host: z.ZodOptional<z.ZodString>;
472
596
  url: z.ZodOptional<z.ZodString>;
473
597
  }, z.core.$strict>>;
598
+ projection: z.ZodOptional<z.ZodObject<{
599
+ enabled: z.ZodOptional<z.ZodBoolean>;
600
+ dbPoolSize: z.ZodOptional<z.ZodNumber>;
601
+ }, z.core.$strict>>;
602
+ executors: z.ZodOptional<z.ZodObject<{
603
+ numWorkers: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
604
+ }, z.core.$strict>>;
474
605
  }, z.core.$strict>>>;
475
606
  placement: z.ZodOptional<z.ZodObject<{
476
607
  primary: z.ZodOptional<z.ZodString>;
477
608
  default: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
478
609
  }, z.core.$strict>>;
479
- workflows: z.ZodOptional<z.ZodBoolean>;
480
610
  protocol: z.ZodOptional<z.ZodObject<{
481
611
  featureFlags: z.ZodOptional<z.ZodObject<{
482
612
  documentDecisions: z.ZodOptional<z.ZodBoolean>;
@@ -493,6 +623,40 @@ export declare const reactorHostSchema: z.ZodObject<{
493
623
  refuse: "refuse";
494
624
  }>>;
495
625
  }, z.core.$strict>>;
626
+ /** DEPRECATED (dies in R2): workflows become a listed plugin — presence is
627
+ * activation. Kept parsing until the switchboard rewire lands. */
628
+ workflows: z.ZodOptional<z.ZodBoolean>;
629
+ renown: z.ZodOptional<z.ZodObject<{
630
+ url: z.ZodOptional<z.ZodString>;
631
+ networkId: z.ZodOptional<z.ZodString>;
632
+ chainId: z.ZodOptional<z.ZodNumber>;
633
+ }, z.core.$strict>>;
634
+ packages: z.ZodOptional<z.ZodObject<{
635
+ registryUrl: z.ZodOptional<z.ZodString>;
636
+ }, z.core.$strict>>;
637
+ namespace: z.ZodOptional<z.ZodString>;
638
+ auth: z.ZodOptional<z.ZodObject<{
639
+ enabled: z.ZodOptional<z.ZodBoolean>;
640
+ admins: z.ZodOptional<z.ZodArray<z.ZodString>>;
641
+ renown: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
642
+ }, z.core.$strict>>;
643
+ drives: z.ZodOptional<z.ZodArray<z.ZodObject<{
644
+ slug: z.ZodString;
645
+ id: z.ZodOptional<z.ZodString>;
646
+ projectHash: z.ZodOptional<z.ZodBoolean>;
647
+ name: z.ZodOptional<z.ZodString>;
648
+ icon: z.ZodOptional<z.ZodString>;
649
+ preferredEditor: z.ZodOptional<z.ZodString>;
650
+ sharingType: z.ZodOptional<z.ZodEnum<{
651
+ private: "private";
652
+ public: "public";
653
+ shared: "shared";
654
+ }>>;
655
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
656
+ remote: z.ZodOptional<z.ZodObject<{
657
+ url: z.ZodString;
658
+ }, z.core.$strict>>;
659
+ }, z.core.$strict>>>;
496
660
  }, z.core.$strict>>;
497
661
  }, z.core.$loose>;
498
662
  export declare const compoundHostSchema: z.ZodObject<{
@@ -501,10 +665,20 @@ export declare const compoundHostSchema: z.ZodObject<{
501
665
  module: z.ZodString;
502
666
  defaultVerb: z.ZodOptional<z.ZodString>;
503
667
  port: z.ZodOptional<z.ZodNumber>;
668
+ /** Bind address; each runner documents its default (0.0.0.0 for servers,
669
+ * localhost for vite dev, 127.0.0.1 for serve). */
670
+ host: z.ZodOptional<z.ZodString>;
671
+ /** THE COMPOSITION: the plugin entries this host boots with. Presence is
672
+ * activation; see plugins.ts for entry semantics. */
673
+ plugins: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
674
+ module: z.ZodString;
675
+ enabled: z.ZodOptional<z.ZodBoolean>;
676
+ verbs: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"*">, z.ZodArray<z.ZodString>]>>;
677
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
678
+ }, z.core.$strict>]>>>;
504
679
  }, z.core.$loose>;
505
680
  children: z.ZodRecord<z.ZodString, z.ZodObject<{
506
681
  host: z.ZodString;
507
- plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
508
682
  runner: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
509
683
  config: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
510
684
  reactor: z.ZodOptional<z.ZodObject<{
@@ -536,12 +710,18 @@ export declare const compoundHostSchema: z.ZodObject<{
536
710
  host: z.ZodOptional<z.ZodString>;
537
711
  url: z.ZodOptional<z.ZodString>;
538
712
  }, z.core.$strict>>;
713
+ projection: z.ZodOptional<z.ZodObject<{
714
+ enabled: z.ZodOptional<z.ZodBoolean>;
715
+ dbPoolSize: z.ZodOptional<z.ZodNumber>;
716
+ }, z.core.$strict>>;
717
+ executors: z.ZodOptional<z.ZodObject<{
718
+ numWorkers: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"auto">]>>;
719
+ }, z.core.$strict>>;
539
720
  }, z.core.$strict>>>;
540
721
  placement: z.ZodOptional<z.ZodObject<{
541
722
  primary: z.ZodOptional<z.ZodString>;
542
723
  default: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
543
724
  }, z.core.$strict>>;
544
- workflows: z.ZodOptional<z.ZodBoolean>;
545
725
  protocol: z.ZodOptional<z.ZodObject<{
546
726
  featureFlags: z.ZodOptional<z.ZodObject<{
547
727
  documentDecisions: z.ZodOptional<z.ZodBoolean>;
@@ -558,6 +738,40 @@ export declare const compoundHostSchema: z.ZodObject<{
558
738
  refuse: "refuse";
559
739
  }>>;
560
740
  }, z.core.$strict>>;
741
+ /** DEPRECATED (dies in R2): workflows become a listed plugin — presence is
742
+ * activation. Kept parsing until the switchboard rewire lands. */
743
+ workflows: z.ZodOptional<z.ZodBoolean>;
744
+ renown: z.ZodOptional<z.ZodObject<{
745
+ url: z.ZodOptional<z.ZodString>;
746
+ networkId: z.ZodOptional<z.ZodString>;
747
+ chainId: z.ZodOptional<z.ZodNumber>;
748
+ }, z.core.$strict>>;
749
+ packages: z.ZodOptional<z.ZodObject<{
750
+ registryUrl: z.ZodOptional<z.ZodString>;
751
+ }, z.core.$strict>>;
752
+ namespace: z.ZodOptional<z.ZodString>;
753
+ auth: z.ZodOptional<z.ZodObject<{
754
+ enabled: z.ZodOptional<z.ZodBoolean>;
755
+ admins: z.ZodOptional<z.ZodArray<z.ZodString>>;
756
+ renown: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
757
+ }, z.core.$strict>>;
758
+ drives: z.ZodOptional<z.ZodArray<z.ZodObject<{
759
+ slug: z.ZodString;
760
+ id: z.ZodOptional<z.ZodString>;
761
+ projectHash: z.ZodOptional<z.ZodBoolean>;
762
+ name: z.ZodOptional<z.ZodString>;
763
+ icon: z.ZodOptional<z.ZodString>;
764
+ preferredEditor: z.ZodOptional<z.ZodString>;
765
+ sharingType: z.ZodOptional<z.ZodEnum<{
766
+ private: "private";
767
+ public: "public";
768
+ shared: "shared";
769
+ }>>;
770
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
771
+ remote: z.ZodOptional<z.ZodObject<{
772
+ url: z.ZodString;
773
+ }, z.core.$strict>>;
774
+ }, z.core.$strict>>>;
561
775
  }, z.core.$strict>>;
562
776
  }, z.core.$strict>>;
563
777
  config: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
@@ -573,6 +787,115 @@ export declare const compoundHostSchema: z.ZodObject<{
573
787
  * them, per the runtime-config-schema pattern. */
574
788
  export declare function emittedHostSchemas(): Record<string, unknown>;
575
789
  //#endregion
576
- export { type CompoundMember, type CompoundWiring, type ConnectReactorProjection, type DriveProjectionInput, type HostDefinition, HostLoadError, type HostSchemaLike, type HostsFolderStatus, type LoadedHost, type ProjectedDescriptor, type ReactorBackend, type ReactorConfig, type ReactorProtocol, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerContext, RunnerError, type RunnerHandle, type RunnerModule, type RunnerVerb, type SwitchboardReactorProjection, findNonStaticValue, getVerb, lintHostImports, listVerbs, loadHost, probeHostsFolder, resolveRunnerModule, runCompound, validateHost };
790
+ //#region src/plugins-resolve.d.ts
791
+ /**
792
+ * Resolve host.js plugin entries into live plugins for one host boot:
793
+ * verb-filter → module resolution from the project tree (default condition,
794
+ * like runners) → factory/object contract → config validation → appliesTo.
795
+ */
796
+ export declare function resolveHostPlugins<THooks = Record<string, unknown>>(projectRoot: string, hostType: string, verb: string, entries: readonly PluginEntry[], where: string): Promise<ResolvedPlugin<THooks>[]>;
797
+ //#endregion
798
+ //#region src/drives.d.ts
799
+ /**
800
+ * R1 — core drive declarations. A reactor without drives is not a running
801
+ * reactor, so declaring + seeding them is HOST RUNTIME work (not a plugin):
802
+ * onReactorReady → idempotent slug-keyed seeding → onDrivesReady. Plugins
803
+ * CONTRIBUTE declarations into the same merged list (Contributions.drives);
804
+ * `--explain drives` prints the merged set with provenance.
805
+ *
806
+ * Field semantics (union of the three existing creation sites — vetra,
807
+ * preview, workflows — plus Connect's PHConnectDefaultDrive):
808
+ * - slug: the SEEDING KEY (idempotence); id optional (stable identity),
809
+ * projectHash derives both from the project path (generateProjectDriveId
810
+ * semantics: `${slug}-${sha256(projectPath).slice(0, 8)}`).
811
+ * - preferredEditor: binds the drive to its drive app — stored at
812
+ * header.meta.preferredEditor; Connect config's `app` is the legacy alias.
813
+ * - remote.url: an attachment to a drive served elsewhere (Connect default
814
+ * drives, switchboard remoteDrives); local fields are ignored for remotes.
815
+ */
816
+ export declare const driveDeclarationSchema: z.ZodObject<{
817
+ slug: z.ZodString;
818
+ id: z.ZodOptional<z.ZodString>;
819
+ /** Derive id (and the served slug) from the project path, like
820
+ * generateProjectDriveId — same ids classic `ph vetra` produces. */
821
+ projectHash: z.ZodOptional<z.ZodBoolean>;
822
+ name: z.ZodOptional<z.ZodString>;
823
+ icon: z.ZodOptional<z.ZodString>;
824
+ preferredEditor: z.ZodOptional<z.ZodString>;
825
+ sharingType: z.ZodOptional<z.ZodEnum<{
826
+ private: "private";
827
+ public: "public";
828
+ shared: "shared";
829
+ }>>;
830
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
831
+ remote: z.ZodOptional<z.ZodObject<{
832
+ url: z.ZodString;
833
+ }, z.core.$strict>>;
834
+ }, z.core.$strict>;
835
+ type DriveDeclaration = z.infer<typeof driveDeclarationSchema>;
836
+ export declare const drivesSchema: z.ZodArray<z.ZodObject<{
837
+ slug: z.ZodString;
838
+ id: z.ZodOptional<z.ZodString>;
839
+ /** Derive id (and the served slug) from the project path, like
840
+ * generateProjectDriveId — same ids classic `ph vetra` produces. */
841
+ projectHash: z.ZodOptional<z.ZodBoolean>;
842
+ name: z.ZodOptional<z.ZodString>;
843
+ icon: z.ZodOptional<z.ZodString>;
844
+ preferredEditor: z.ZodOptional<z.ZodString>;
845
+ sharingType: z.ZodOptional<z.ZodEnum<{
846
+ private: "private";
847
+ public: "public";
848
+ shared: "shared";
849
+ }>>;
850
+ availableOffline: z.ZodOptional<z.ZodBoolean>;
851
+ remote: z.ZodOptional<z.ZodObject<{
852
+ url: z.ZodString;
853
+ }, z.core.$strict>>;
854
+ }, z.core.$strict>>;
855
+ export declare function projectDriveId(projectRoot: string, slug: string): string;
856
+ interface ResolvedDrive {
857
+ kind: "local" | "remote";
858
+ id: string;
859
+ slug: string;
860
+ name: string;
861
+ icon?: string;
862
+ preferredEditor?: string;
863
+ sharingType: "public" | "private" | "shared";
864
+ availableOffline: boolean;
865
+ remoteUrl?: string;
866
+ }
867
+ export declare function resolveDriveDeclaration(projectRoot: string, decl: DriveDeclaration): ResolvedDrive;
868
+ /** The minimal client surface the seeder needs — runners adapt their reactor
869
+ * clients (IReactorClient, addDefaultDrive-style helpers) onto it. */
870
+ interface DriveSeederClient {
871
+ /** Return the existing drive's id for a slug, or undefined. */
872
+ findDriveBySlug(slug: string): Promise<string | undefined>;
873
+ /** Create a local drive; preferredEditor lands on header.meta. */
874
+ createDrive(drive: ResolvedDrive): Promise<void>;
875
+ /** Attach a remote drive by URL (idempotent on the client side). */
876
+ attachRemoteDrive(url: string): Promise<void>;
877
+ }
878
+ interface SeedResult {
879
+ created: string[];
880
+ existing: string[];
881
+ attached: string[];
882
+ }
883
+ /** Idempotent, slug-keyed: an existing slug is left untouched (never
884
+ * recreated, never mutated — preserveStrategy refinements live here later). */
885
+ export declare function seedDrives(client: DriveSeederClient, drives: readonly ResolvedDrive[]): Promise<SeedResult>;
886
+ interface DrivePlanEntry {
887
+ drive: ResolvedDrive;
888
+ /** "host" for host.js declarations; a plugin name for contributions. */
889
+ source: string;
890
+ }
891
+ /** Merge host-declared drives with plugin contributions, slug-keyed — the
892
+ * host file wins on conflicts (it is the most explicit source). */
893
+ export declare function mergeDrivePlan(projectRoot: string, hostDeclared: readonly DriveDeclaration[], contributed: readonly {
894
+ declaration: DriveDeclaration;
895
+ source: string;
896
+ }[]): DrivePlanEntry[];
897
+ export declare function explainDrivePlan(plan: readonly DrivePlanEntry[]): string;
898
+ //#endregion
899
+ export { type CompoundMember, type CompoundWiring, type ConnectReactorProjection, type ContributionSource, type Contributions, type DriveDeclaration, type DrivePlanEntry, type DriveProjectionInput, type DriveSeederClient, type HostDefinition, HostLoadError, type HostPlugin, type HostPluginModule, type HostSchemaLike, type HostsFolderStatus, type LoadedHost, type MergedContribution, type NormalizedPluginEntry, type Observe, type PluginEntry, PluginError, type ProjectedDescriptor, type Provide, type ReactorBackend, type ReactorClientMode, type ReactorConfig, type ReactorProtocol, type ResolvedDrive, type ResolvedPlugin, type RunCompoundOptions, type RunCompoundResult, type RunProbe, type RunRecord, type RunRecordMember, type RunnerContext, RunnerError, type RunnerHandle, type RunnerModule, type RunnerVerb, type SeedResult, type SwitchboardReactorProjection, type Transform, entryActiveForVerb, findNonStaticValue, getVerb, hostTypeSatisfies, lintHostImports, listVerbs, loadHost, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, probeHostsFolder, registerHostType, resolveOrder, resolveRunnerModule, runCompound, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook, validateHost };
577
900
  export {};
578
901
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/connect-projection.ts","../src/run-record.ts","../src/placeholders.ts","../src/reactor-config.ts","../src/backend-projection.ts","../src/host-schemas.ts"],"mappings":";;;;;;;;;;;wBA+BgB,sBACX,QAAQ,4BACV;;;;;;;;wBAqBa,eAAe,kBAAkB;UAahC;;;EAGf;;EAEA,0BAA0B;;EAE1B;;;;;;;;wBASc,yBACd,OAAO,uBACN,KAAK;;;;;;;;;;UC3ES;EACf;EACA;;UAGe;EACf;EACA;EACA;EACA;EACA,SAAS,eAAe;;EAExB,QAAQ;;KAGE;EACN;;EACA;EAAiB,QAAQ;;EACzB;EAAgB,QAAQ;;EACxB;EAAmB,QAAQ;;wBAMjB,cACd,oBACA,mBACC;wBAUa,eAAe,oBAAoB,QAAQ;wBAM3C,eAAe,oBAAoB;wBAQnC,WAAW;;;;;;;;;;wBAmBX,SACd,oBACA,kBACA,sBACC;;;;;;;;;;wBC5Ea,mBACd,qBACA,MAAK;;;wBASS,4BAA4B,GAAG,OAAO,GAAG,mBAAmB;;;;;;;;;;;KCXhE;UAEK;EACf;EACA;EACA;;UAGe;EACf;EACA;;EAEA;;UAGe;EACf;EACA;;UAGe;EACf,OAAO;EACP,UAAU;EACV;IAAc;;EACd,WAAW;EACX,SAAS;;;UAIM;EACf;IACE;IACA;IACA;IACA;;EAEF;EACA;;UAGe;EACf,WAAW,eAAe;EAC1B;IACE;IACA,UAAU;;EAEZ;EACA,WAAW;;;;wBAKG,eACd,SAAS,4BACR;;;wBA2Ba,YACd,UAAU,8BACT;UAiBc;;EAEf,KAAK;;EAEL;IAAW;;;;wBAIG,4BACd,SAAS,4BACR;UAkBc;;EAEf;IACE,UAAU;IACV;MAAa;;IACb;MAAQ;;;;;;;wBAOI,wBACd,SAAS,4BACR;;;;;;;;wBAoBa,0BACd,UAAU,6BACV,KAAK,oCACL;;;;;;;;;;;;;;KC5JU;EACN;;EACA;;EACA;EAAc;;UAEH;EACf;EACA;EACA,UAAU;EACV;IAAa;IAAiB;IAAkB;;EAChD;IACE;IACA;IACA;IACA;;EAEF;IAAW;;;;;;wBAgCG,oBACd,cACA,SAAS,gBACT,WAAW,kBACV;;;wBA2Ba,sBACd,SAAS,4BACR;;;;;;;wBAsBa,yBACd,SAAS;;wBAWK,kBACd,SAAS;;;;;;;;;;qBC5HE,eAAa,EAAA,YAAA,EAAA;;;;;GAOb,EAAA,KAAA;qBAEA,uBAAqB,EAAA;;;;;;;;;;;;;;;GAWhC,EAAA,KAAA;qBAEW,sBAAoB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuB/B,EAAA,KAAA;qBAEW,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUxB,EAAA,KAAA;;;qBAIW,kBAAgB,EAAA;;;;GAI3B,EAAA,KAAA;;;qBAIW,gBAAc,EAAA,UAAA,EAAA,WAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAS1B,EAAA,KAAA;;;;qBAKY,mBAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM5B,EAAA,KAAA;qBAEW,oBAAkB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAM7B,EAAA,KAAA;;;;wBAOc,sBAAsB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/connect-projection.ts","../src/run-record.ts","../src/placeholders.ts","../src/reactor-config.ts","../src/backend-projection.ts","../src/host-schemas.ts","../src/plugins-resolve.ts","../src/drives.ts"],"mappings":"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"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,9 @@
1
- import { A as rebaseDriveUrl, C as HostLoadError, D as probeHostsFolder, E as loadHost, O as mergeDefaultDrives, S as validateHost, T as lintHostImports, _ as writeRunRecord, a as reactorBackendSchema, b as listVerbs, c as reactorSchema, d as defaultUserDataDir, f as resolveUserDataPlaceholders, g as readRunRecord, h as probeRun, i as profileSchema, k as projectDrivesIntoConnect, l as runnerBaseSchema, m as isPidAlive, n as compoundHostSchema, o as reactorHostSchema, p as clearRunRecord, r as emittedHostSchemas, s as reactorProtocolSchema, t as childrenSchema, u as runCompound, v as RunnerError, w as findNonStaticValue, x as resolveRunnerModule, y as getVerb } from "./host-schemas-C_MLcYX6.mjs";
1
+ import { A as HostLoadError, C as readRunRecord, D as listVerbs, E as getVerb, F as mergeDefaultDrives, I as projectDrivesIntoConnect, L as rebaseDriveUrl, M as lintHostImports, N as loadHost, O as resolveRunnerModule, P as probeHostsFolder, S as probeRun, T as RunnerError, _ as runCompound, a as reactorBackendSchema, b as clearRunRecord, c as reactorSchema, d as drivesSchema, f as explainDrivePlan, g as seedDrives, h as resolveDriveDeclaration, i as profileSchema, j as findNonStaticValue, k as validateHost, l as runnerBaseSchema, m as projectDriveId, n as compoundHostSchema, o as reactorHostSchema, p as mergeDrivePlan, r as emittedHostSchemas, s as reactorProtocolSchema, t as childrenSchema, u as driveDeclarationSchema, v as defaultUserDataDir, w as writeRunRecord, x as isPidAlive, y as resolveUserDataPlaceholders } from "./host-schemas-CL_wFpY7.mjs";
2
+ import { PluginError, entryActiveForVerb, hostTypeSatisfies, mergeContributions, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, registerHostType, resolveOrder, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook } from "./plugins.mjs";
3
+ import { createRequire } from "node:module";
4
+ import path from "node:path";
5
+ import { pathToFileURL } from "node:url";
6
+ import { z } from "zod";
2
7
  //#region src/backend-projection.ts
3
8
  function projectStorage(name, storage) {
4
9
  switch (storage.kind) {
@@ -110,14 +115,44 @@ function projectReactorToSwitchboard(reactor) {
110
115
  options
111
116
  };
112
117
  }
118
+ const LOCAL_BACKEND_KINDS = /* @__PURE__ */ new Set([
119
+ "in-process",
120
+ "worker",
121
+ void 0
122
+ ]);
123
+ /**
124
+ * Which reactor client the backend topology asks for:
125
+ * - local (in-process/worker) AND remote backends -> `router`
126
+ * - remote backend(s) only -> `remote`
127
+ * - a worker backend -> `worker`
128
+ * - anything else local -> `in-process`
129
+ * `undefined` when no backends are declared — the caller then keeps the
130
+ * legacy reactorWorker/multiReactor behaviour untouched.
131
+ */
132
+ function reactorClientMode(reactor) {
133
+ const backends = reactor?.backends;
134
+ if (!backends) return void 0;
135
+ const kinds = Object.values(backends).map((b) => b.kind);
136
+ if (kinds.length === 0) return void 0;
137
+ const hasLocal = kinds.some((k) => LOCAL_BACKEND_KINDS.has(k));
138
+ const hasRemote = kinds.some((k) => k === "remote");
139
+ if (hasLocal && hasRemote) return "router";
140
+ if (hasRemote) return "remote";
141
+ return primaryBackend(reactor)?.kind === "worker" ? "worker" : "in-process";
142
+ }
113
143
  /** Project the reactor block onto the Connect runtime config: protocol →
114
- * connect.reactor (same shape), backend kind → instance.reactorWorker,
144
+ * connect.reactor (same shape), backend topology → instance.reactorWorker
145
+ * (legacy) + instance.reactorClient (the explicit 4-way selector),
115
146
  * workflows → app.workflowsEnabled. */
116
147
  function projectReactorToConnect(reactor) {
117
148
  const connect = {};
118
149
  if (reactor?.protocol) connect.reactor = reactor.protocol;
119
150
  const backend = primaryBackend(reactor);
120
- if (backend?.kind !== void 0) connect.instance = { reactorWorker: backend.kind === "worker" };
151
+ const mode = reactorClientMode(reactor);
152
+ if (backend?.kind !== void 0 || mode !== void 0) connect.instance = {
153
+ ...backend?.kind !== void 0 ? { reactorWorker: backend.kind === "worker" } : {},
154
+ ...mode !== void 0 ? { reactorClient: mode } : {}
155
+ };
121
156
  if (reactor?.workflows !== void 0) connect.app = { workflowsEnabled: reactor.workflows };
122
157
  return { connect };
123
158
  }
@@ -137,6 +172,54 @@ function assertProtocolConsistency(protocol, env, hostFile = "the host file") {
137
172
  }
138
173
  }
139
174
  //#endregion
140
- export { HostLoadError, RunnerError, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, childrenSchema, clearRunRecord, compoundHostSchema, defaultUserDataDir, emittedHostSchemas, findNonStaticValue, getVerb, isPidAlive, isStructuralMultiReactor, lintHostImports, listVerbs, loadHost, mergeDefaultDrives, primaryBackend, probeHostsFolder, probeRun, profileSchema, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolEnv, reactorBackendSchema, reactorHostSchema, reactorProtocolSchema, reactorSchema, readRunRecord, rebaseDriveUrl, remoteBackendUrls, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runnerBaseSchema, validateHost, writeRunRecord };
175
+ //#region src/plugins-resolve.ts
176
+ /**
177
+ * NODE-ONLY plugin resolution (split from plugins.ts so the pure runner core
178
+ * stays browser-safe for ConnectCore — R3). Resolves host.js entries from the
179
+ * PROJECT dependency tree, exactly like runner modules.
180
+ */
181
+ function isHostPluginShape(value) {
182
+ return value !== null && typeof value === "object" && typeof value.name === "string";
183
+ }
184
+ /**
185
+ * Resolve host.js plugin entries into live plugins for one host boot:
186
+ * verb-filter → module resolution from the project tree (default condition,
187
+ * like runners) → factory/object contract → config validation → appliesTo.
188
+ */
189
+ async function resolveHostPlugins(projectRoot, hostType, verb, entries, where) {
190
+ const normalized = normalizePluginEntries(entries, where);
191
+ const projectRequire = createRequire(pathToFileURL(path.join(projectRoot, "package.json")).href);
192
+ const resolved = [];
193
+ for (const entry of normalized) {
194
+ if (!entryActiveForVerb(entry, verb)) continue;
195
+ let file;
196
+ try {
197
+ file = projectRequire.resolve(entry.module);
198
+ } catch {
199
+ throw new PluginError(`${where}: cannot resolve plugin "${entry.module}" from ${projectRoot}.`, "Plugins resolve from the project dependency tree, exactly like runner modules.");
200
+ }
201
+ const exported = (await import(pathToFileURL(file).href)).default;
202
+ let plugin;
203
+ if (typeof exported === "function") plugin = exported(entry.config);
204
+ else if (isHostPluginShape(exported)) {
205
+ if (Object.keys(entry.config).length > 0 && !exported.configSchema) throw new PluginError(`${where}: plugin "${entry.module}" takes no config, but the entry passes one.`);
206
+ plugin = exported;
207
+ } else throw new PluginError(`${where}: "${entry.module}" does not default-export a plugin object or factory.`, "Export `{ name, hooks?, contributions? }` or `(config) => plugin`.");
208
+ if (plugin.configSchema) {
209
+ const parsed = plugin.configSchema.safeParse(entry.config);
210
+ if (!parsed.success) throw new PluginError(`${where}: config for plugin "${plugin.name}" is invalid:\n` + z.prettifyError(parsed.error));
211
+ }
212
+ const appliesTo = plugin.appliesTo ?? "reactor";
213
+ if (!hostTypeSatisfies(hostType, appliesTo)) throw new PluginError(`${where}: plugin "${plugin.name}" applies to "${appliesTo}" hosts, but this host is "${hostType}".`);
214
+ resolved.push({
215
+ entry,
216
+ plugin,
217
+ provenance: "dependency"
218
+ });
219
+ }
220
+ return resolved;
221
+ }
222
+ //#endregion
223
+ export { HostLoadError, PluginError, RunnerError, assertProtocolConsistency, backendToDescriptor, backendsToDescriptors, childrenSchema, clearRunRecord, compoundHostSchema, defaultUserDataDir, driveDeclarationSchema, drivesSchema, emittedHostSchemas, entryActiveForVerb, explainDrivePlan, findNonStaticValue, getVerb, hostTypeSatisfies, isPidAlive, isStructuralMultiReactor, lintHostImports, listVerbs, loadHost, mergeContributions, mergeDefaultDrives, mergeDrivePlan, normalizePluginEntries, normalizePluginEntry, pluginEntrySchema, primaryBackend, probeHostsFolder, probeRun, profileSchema, projectDriveId, projectDrivesIntoConnect, projectReactorToConnect, projectReactorToSwitchboard, protocolEnv, reactorBackendSchema, reactorClientMode, reactorHostSchema, reactorProtocolSchema, reactorSchema, readRunRecord, rebaseDriveUrl, registerHostType, remoteBackendUrls, resolveDriveDeclaration, resolveHostPlugins, resolveOrder, resolveRunnerModule, resolveUserDataPlaceholders, runCompound, runObserveHook, runObserveHookSequential, runProvideHook, runTransformHook, runnerBaseSchema, seedDrives, validateHost, writeRunRecord };
141
224
 
142
225
  //# sourceMappingURL=index.mjs.map