@powerhousedao/clint 6.3.0-dev.9 → 6.4.0-next.0
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/build-DZIv63eB.mjs +77 -0
- package/dist/build-DZIv63eB.mjs.map +1 -0
- package/dist/{build-skills-BnqGyuCH.mjs → build-skills-BNEOn-cl.mjs} +15 -6
- package/dist/build-skills-BNEOn-cl.mjs.map +1 -0
- package/dist/dist--xzirmg-.mjs +655 -0
- package/dist/dist--xzirmg-.mjs.map +1 -0
- package/dist/glob-CGjvhxgW.mjs +48 -0
- package/dist/glob-CGjvhxgW.mjs.map +1 -0
- package/dist/index-C3-HSfKb.d.mts +389 -0
- package/dist/index-C3-HSfKb.d.mts.map +1 -0
- package/dist/index.d.mts +55 -303
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7 -8
- package/dist/integrations/mastra/index.d.mts +248 -0
- package/dist/integrations/mastra/index.d.mts.map +1 -0
- package/dist/integrations/mastra/index.mjs +509 -0
- package/dist/integrations/mastra/index.mjs.map +1 -0
- package/dist/integrations/powerhouse/index.d.mts +4 -0
- package/dist/integrations/powerhouse/index.mjs +3 -0
- package/dist/markdown-BUeGwhbR.mjs +1588 -0
- package/dist/markdown-BUeGwhbR.mjs.map +1 -0
- package/dist/powerhouse-BDnj7kqd.mjs +1922 -0
- package/dist/powerhouse-BDnj7kqd.mjs.map +1 -0
- package/dist/{proxy-BFR8GScT.mjs → proxy-ji3EHzLn.mjs} +128 -28
- package/dist/proxy-ji3EHzLn.mjs.map +1 -0
- package/dist/remote-reactor-BQzq4yfO.mjs +69 -0
- package/dist/remote-reactor-BQzq4yfO.mjs.map +1 -0
- package/dist/{start-b7Mn2cxB.mjs → repl-Czb7u0x_.mjs} +6 -29
- package/dist/repl-Czb7u0x_.mjs.map +1 -0
- package/dist/runners/cli-runner.d.mts +339 -0
- package/dist/runners/cli-runner.d.mts.map +1 -0
- package/dist/runners/cli-runner.mjs +324 -0
- package/dist/runners/cli-runner.mjs.map +1 -0
- package/dist/runners/mastra-runner.d.mts +5 -3
- package/dist/runners/mastra-runner.d.mts.map +1 -1
- package/dist/runners/mastra-runner.mjs +10 -60
- package/dist/runners/mastra-runner.mjs.map +1 -1
- package/dist/runners/proxy-runner.d.mts +281 -0
- package/dist/runners/proxy-runner.d.mts.map +1 -0
- package/dist/runners/proxy-runner.mjs +91 -0
- package/dist/runners/proxy-runner.mjs.map +1 -0
- package/dist/schema-BEKAZGyT.mjs +47 -0
- package/dist/schema-BEKAZGyT.mjs.map +1 -0
- package/dist/{src-BebNN3xc.mjs → src-BehwgLP6.mjs} +395 -1481
- package/dist/src-BehwgLP6.mjs.map +1 -0
- package/dist/start-BHn9LIyX.mjs +37 -0
- package/dist/start-BHn9LIyX.mjs.map +1 -0
- package/dist/store-CxqB-OrX.mjs +101 -0
- package/dist/store-CxqB-OrX.mjs.map +1 -0
- package/dist/{stream-DVuufwIj.mjs → stream-BguHx7vC.mjs} +4 -2
- package/dist/{stream-DVuufwIj.mjs.map → stream-BguHx7vC.mjs.map} +1 -1
- package/dist/testing/index.d.mts +81 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +131 -0
- package/dist/testing/index.mjs.map +1 -0
- package/dist/{types-CRkoD-Mm.d.mts → types-CF6GuPJd.d.mts} +241 -261
- package/dist/types-CF6GuPJd.d.mts.map +1 -0
- package/dist/types-CbHJ-ZnH.d.mts +60 -0
- package/dist/types-CbHJ-ZnH.d.mts.map +1 -0
- package/package.json +44 -25
- package/dist/build-skills-BnqGyuCH.mjs.map +0 -1
- package/dist/dist-CUltriBW.mjs +0 -1628
- package/dist/dist-CUltriBW.mjs.map +0 -1
- package/dist/drive-Bu9zoFrO.mjs +0 -85
- package/dist/drive-Bu9zoFrO.mjs.map +0 -1
- package/dist/esm-C1DOsF1a.mjs +0 -13140
- package/dist/esm-C1DOsF1a.mjs.map +0 -1
- package/dist/events-BnwGFTjv.mjs +0 -237
- package/dist/events-BnwGFTjv.mjs.map +0 -1
- package/dist/folders-BYO1Wqqb.mjs +0 -256
- package/dist/folders-BYO1Wqqb.mjs.map +0 -1
- package/dist/local-signer-EFzJV3bn.mjs +0 -128
- package/dist/local-signer-EFzJV3bn.mjs.map +0 -1
- package/dist/markdown-D-sP2zw_.mjs +0 -275
- package/dist/markdown-D-sP2zw_.mjs.map +0 -1
- package/dist/proxy-BFR8GScT.mjs.map +0 -1
- package/dist/proxy-routes-DP3ztsnS.mjs +0 -215
- package/dist/proxy-routes-DP3ztsnS.mjs.map +0 -1
- package/dist/reactor-C9VIUX1H.mjs +0 -51
- package/dist/reactor-C9VIUX1H.mjs.map +0 -1
- package/dist/runners/clint-runner.d.mts +0 -398
- package/dist/runners/clint-runner.d.mts.map +0 -1
- package/dist/runners/clint-runner.mjs +0 -519
- package/dist/runners/clint-runner.mjs.map +0 -1
- package/dist/services-9E-r0nWl.mjs +0 -999
- package/dist/services-9E-r0nWl.mjs.map +0 -1
- package/dist/src-BebNN3xc.mjs.map +0 -1
- package/dist/start-b7Mn2cxB.mjs.map +0 -1
- package/dist/subscriptions-CfiflAsI.mjs +0 -38
- package/dist/subscriptions-CfiflAsI.mjs.map +0 -1
- package/dist/switchboard-CyvOavqL.mjs +0 -57
- package/dist/switchboard-CyvOavqL.mjs.map +0 -1
- package/dist/types-CRkoD-Mm.d.mts.map +0 -1
|
@@ -1,74 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AttachmentHash, AttachmentRef, AttachmentRef as AttachmentRef$1, DocumentChangeEvent, IReactorClient, JobInfo, PagedResults, PagingOptions, SearchFilter, ViewFilter } from "@powerhousedao/reactor";
|
|
3
|
-
import "@powerhousedao/shared/document-model";
|
|
4
|
-
import { Action, DocumentModelModule, PHBaseState, PHDocument } from "document-model";
|
|
5
|
-
|
|
6
|
-
interface ProxyRoute {
|
|
7
|
-
/** URL path prefix matched against incoming requests (e.g. '/switchboard/graphql'). */
|
|
8
|
-
prefix: string;
|
|
9
|
-
/**
|
|
10
|
-
* Upstream target URL (e.g. new URL('http://localhost:4001/graphql')).
|
|
11
|
-
* Optional only for pure redirect routes (`redirectTo` set).
|
|
12
|
-
*/
|
|
13
|
-
upstream?: URL;
|
|
14
|
-
/** Whether WebSocket upgrade should be forwarded on this route. */
|
|
15
|
-
ws: boolean;
|
|
16
|
-
/** Origin label for route management (e.g. 'switchboard', 'service:my-svc'). */
|
|
17
|
-
source: string;
|
|
18
|
-
/**
|
|
19
|
-
* When set, matching requests get a 302 to this location instead of being
|
|
20
|
-
* proxied. No upstream connection is made.
|
|
21
|
-
*/
|
|
22
|
-
redirectTo?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Match the prefix exactly rather than as a `startsWith` prefix. Exact
|
|
25
|
-
* routes are matched before prefix routes so a `'/'` redirect can coexist
|
|
26
|
-
* with a `'/'` catch-all without shadowing longer prefixes.
|
|
27
|
-
*/
|
|
28
|
-
exact?: boolean;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Endpoint types that imply WebSocket transport. Websites need upgrades
|
|
32
|
-
* forwarded for dev-server HMR sockets (Vite connects on the page's own
|
|
33
|
-
* origin/path).
|
|
34
|
-
*/
|
|
35
|
-
declare function isWsEndpointType(type: EndpointType): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Relative-prefix route specs for a Powerhouse Switchboard, usable as
|
|
38
|
-
* `ServiceDefinition.proxyRoutes` specs (mounted under `/{serviceId}/`).
|
|
39
|
-
* The MCP route is included only when `mcpUrl` is provided.
|
|
40
|
-
*/
|
|
41
|
-
declare function buildSwitchboardRouteSpecs(switchboardUrl: string, mcpUrl?: string, basePrefix?: string): Array<ServiceProxyRouteSpec & {
|
|
42
|
-
upstream: URL;
|
|
43
|
-
}>;
|
|
44
|
-
/**
|
|
45
|
-
* Absolute proxy routes for the embedded Switchboard, mounted under
|
|
46
|
-
* `/switchboard` with source `'switchboard'`. The MCP route is included
|
|
47
|
-
* only when `mcpUrl` is provided.
|
|
48
|
-
*/
|
|
49
|
-
declare function buildSwitchboardRoutes(switchboardUrl: string, mcpUrl?: string): Array<ProxyRoute & {
|
|
50
|
-
upstream: URL;
|
|
51
|
-
}>;
|
|
52
|
-
/** A (serviceId, captureName) pair identifying the proxy-root website. */
|
|
53
|
-
interface ProxyRootCapture {
|
|
54
|
-
serviceId: string;
|
|
55
|
-
captureName: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Proxy mount prefix for a service route: `/{serviceId}/{name}`. Single
|
|
59
|
-
* owner of the convention used for capture routes and for mounting
|
|
60
|
-
* `ServiceDefinition.proxyRoutes` specs.
|
|
61
|
-
*/
|
|
62
|
-
declare function captureRoutePrefix(serviceId: string, captureName: string): string;
|
|
63
|
-
/**
|
|
64
|
-
* Build proxy routes from a service definition's readiness captures and its
|
|
65
|
-
* `proxyRoutes` hook. Only captures with announceable endpoint types produce
|
|
66
|
-
* routes; hook specs are mounted under `/{serviceId}/`.
|
|
67
|
-
*/
|
|
68
|
-
declare function buildServiceRoutes(def: ServiceDefinition, instance: ServiceInstanceStatus, implicitRoot?: ProxyRootCapture, log?: {
|
|
69
|
-
warn(msg: string): void;
|
|
70
|
-
}): ProxyRoute[];
|
|
71
|
-
//#endregion
|
|
3
|
+
import { DocumentModelModule, ISigner } from "@powerhousedao/shared/document-model";
|
|
4
|
+
import { Action, DocumentModelModule as DocumentModelModule$1, PHBaseState, PHDocument } from "document-model";
|
|
5
|
+
import { BearerTokenProvider } from "@powerhousedao/reactor-browser/graphql-client";
|
|
72
6
|
//#region src/core/project-scanner.d.ts
|
|
73
7
|
/**
|
|
74
8
|
* Common project indicator files/dirs. When any of these exist in a folder
|
|
@@ -178,6 +112,8 @@ interface PhClintEvents<R extends DocumentRegistry = AnyRegistry> {
|
|
|
178
112
|
"powerhouse:document:deleted": {
|
|
179
113
|
documentId: string;
|
|
180
114
|
};
|
|
115
|
+
/** The agent's signer can now sign (see `ReactorContext.writes`). */
|
|
116
|
+
"powerhouse:writes:ready": Record<string, never>;
|
|
181
117
|
}
|
|
182
118
|
/**
|
|
183
119
|
* Overloaded emit function: typed for framework-emitted events, fallback
|
|
@@ -212,32 +148,18 @@ interface CommandContext<TConfig = Record<string, unknown>, R extends DocumentRe
|
|
|
212
148
|
routine?: Routine;
|
|
213
149
|
processes?: ProcessManager;
|
|
214
150
|
services?: ServiceManager;
|
|
215
|
-
/** Embedded reverse proxy, when `proxyEnabled`. */
|
|
216
|
-
proxy?: {
|
|
217
|
-
/** Public base URL of the proxy (e.g. 'http://localhost:8090'). */
|
|
218
|
-
url: string;
|
|
219
|
-
port: number;
|
|
220
|
-
/** Current route table snapshot. */
|
|
221
|
-
routes(): ReadonlyArray<{
|
|
222
|
-
prefix: string;
|
|
223
|
-
upstream?: string;
|
|
224
|
-
ws: boolean;
|
|
225
|
-
source: string;
|
|
226
|
-
redirectTo?: string;
|
|
227
|
-
exact?: boolean;
|
|
228
|
-
}>;
|
|
229
|
-
/**
|
|
230
|
-
* Register a proxy route at runtime — used by embedding CLIs to add
|
|
231
|
-
* redirects or announce extra endpoints once a service is ready.
|
|
232
|
-
*/
|
|
233
|
-
addRoute(route: ProxyRoute): void;
|
|
234
|
-
};
|
|
235
151
|
emit?: EmitFn<R>;
|
|
236
152
|
on?: OnFn<R>;
|
|
237
153
|
/** Folder operations on the agent's personal drive. Available when a personal drive is configured. */
|
|
238
154
|
folders?: FolderOperations;
|
|
239
155
|
/** Lazy reactor accessor — returns the ReactorContext or undefined if not configured. */
|
|
240
156
|
reactor?: () => Promise<ReactorContext<R> | undefined>;
|
|
157
|
+
/**
|
|
158
|
+
* True when the run's reactor is the one `RunOptions.reactor` supplies (a
|
|
159
|
+
* host runner's attach to a switchboard): `reactor()` then reaches that
|
|
160
|
+
* switchboard, in a one-shot command too.
|
|
161
|
+
*/
|
|
162
|
+
reactorAttached?: boolean;
|
|
241
163
|
/** Lazy agent accessor — returns the AgentProvider or undefined if not configured. */
|
|
242
164
|
agent?: () => Promise<AgentProvider | undefined>;
|
|
243
165
|
/**
|
|
@@ -530,15 +452,6 @@ type EndpointType = "other" | "api-mcp" | "api-rest" | "api-graphql" | "website"
|
|
|
530
452
|
interface CaptureDefinition {
|
|
531
453
|
group: number;
|
|
532
454
|
type?: EndpointType;
|
|
533
|
-
/**
|
|
534
|
-
* Claim the proxy's `/` catch-all for this website endpoint. Only honored
|
|
535
|
-
* on `website`-type captures. Exactly one capture across all services
|
|
536
|
-
* should set this — the primary SPA whose root-relative asset requests
|
|
537
|
-
* must resolve at the proxy root. Other `website` captures are routed
|
|
538
|
-
* under `/{serviceId}/{captureName}` and must serve themselves under that
|
|
539
|
-
* base path.
|
|
540
|
-
*/
|
|
541
|
-
proxyRoot?: boolean;
|
|
542
455
|
}
|
|
543
456
|
/**
|
|
544
457
|
* A named readiness pattern for multi-pattern readiness detection.
|
|
@@ -635,43 +548,21 @@ interface ServiceBuildContext<TConfig = Record<string, unknown>> {
|
|
|
635
548
|
params?: Record<string, unknown>;
|
|
636
549
|
/** Resolved CLI config. */
|
|
637
550
|
config: TConfig;
|
|
638
|
-
/** Embedded-proxy mount info derived from `config.proxyPublicUrl`. */
|
|
639
|
-
proxy: {
|
|
640
|
-
/** Validated public URL, trailing slashes stripped. Undefined when unset/invalid. */
|
|
641
|
-
publicUrl?: string;
|
|
642
|
-
/** Mount base path: '' at root, else leading-slash no-trailing-slash ('/myagent'). */
|
|
643
|
-
basePath: string;
|
|
644
|
-
};
|
|
645
551
|
}
|
|
646
552
|
/**
|
|
647
|
-
*
|
|
648
|
-
*
|
|
649
|
-
*
|
|
650
|
-
* re-wired for instances adopted at boot).
|
|
553
|
+
* Definition for a long-running background service: a shell `command`, or a
|
|
554
|
+
* host run (`run`). Services are child processes of the CLI: they never
|
|
555
|
+
* outlive the process that started them.
|
|
651
556
|
*/
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
upstream: string | URL;
|
|
656
|
-
ws?: boolean;
|
|
657
|
-
}
|
|
658
|
-
/**
|
|
659
|
-
* Definition for a long-running background service.
|
|
660
|
-
* Services are spawned as detached processes that survive CLI exit.
|
|
661
|
-
*/
|
|
662
|
-
interface ServiceDefinition<TConfig = Record<string, unknown>> {
|
|
557
|
+
type ServiceDefinition<TConfig = Record<string, unknown>> = CommandServiceDefinition<TConfig> | HostServiceDefinition<TConfig>;
|
|
558
|
+
/** What both forms of {@link ServiceDefinition} have. */
|
|
559
|
+
interface ServiceDefinitionBase<TConfig = Record<string, unknown>> {
|
|
663
560
|
id: string;
|
|
664
561
|
/** Display name for this service. Defaults to slugToTitle(id) when omitted. */
|
|
665
562
|
name?: string;
|
|
666
563
|
/** Human-readable description of the service. */
|
|
667
564
|
description?: string;
|
|
668
|
-
command: string | ((ctx: ServiceBuildContext<TConfig>) => string);
|
|
669
565
|
env?: (ctx: ServiceBuildContext<TConfig>) => Record<string, string>;
|
|
670
|
-
/**
|
|
671
|
-
* Proxy routes derived from a ready instance's endpoints, mounted under
|
|
672
|
-
* `/{serviceId}/`. Invalid specs (bad upstream URL) are skipped.
|
|
673
|
-
*/
|
|
674
|
-
proxyRoutes?: (instance: ServiceInstanceStatus) => ServiceProxyRouteSpec[];
|
|
675
566
|
/** Zod schema for typed start parameters (merged into start command flags). */
|
|
676
567
|
paramsSchema?: import("zod").ZodType;
|
|
677
568
|
/** Maximum concurrent instances (default 1). */
|
|
@@ -683,10 +574,6 @@ interface ServiceDefinition<TConfig = Record<string, unknown>> {
|
|
|
683
574
|
*/
|
|
684
575
|
preflight?: PreflightCheck<TConfig>[];
|
|
685
576
|
readiness?: ReadinessConfig;
|
|
686
|
-
shutdown?: {
|
|
687
|
-
signal: NodeJS.Signals;
|
|
688
|
-
timeout: number;
|
|
689
|
-
};
|
|
690
577
|
restart?: {
|
|
691
578
|
enabled: boolean;
|
|
692
579
|
maxRetries: number;
|
|
@@ -695,6 +582,55 @@ interface ServiceDefinition<TConfig = Record<string, unknown>> {
|
|
|
695
582
|
/** Project scanner for auto-discovery. Enables `{id}-ls` command and panel integration. */
|
|
696
583
|
projectScanner?: ProjectScanner;
|
|
697
584
|
}
|
|
585
|
+
/** A service that runs a shell command, ready when its output matches `readiness`. */
|
|
586
|
+
interface CommandServiceDefinition<TConfig = Record<string, unknown>> extends ServiceDefinitionBase<TConfig> {
|
|
587
|
+
command: string | ((ctx: ServiceBuildContext<TConfig>) => string);
|
|
588
|
+
shutdown?: {
|
|
589
|
+
signal: NodeJS.Signals;
|
|
590
|
+
timeout: number;
|
|
591
|
+
};
|
|
592
|
+
run?: never;
|
|
593
|
+
endpoints?: never;
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* A service that is a host run: `ph run <host> [verb] [-- argv]` in the
|
|
597
|
+
* start's cwd, through host-core's `spawnHost`, with the project as its data
|
|
598
|
+
* dir (its stores and `.ph/run` record are the project's own). The child's
|
|
599
|
+
* output goes to the service log. It is ready once its run record is live,
|
|
600
|
+
* within `readiness.timeout` (patterns and `wait` do not apply), and its
|
|
601
|
+
* endpoints are `endpoints(record)`. A stop ends its stdin, which it takes as
|
|
602
|
+
* a stop request; its process tree is killed only when it has not exited
|
|
603
|
+
* after `shutdown.timeout` (default 30 s).
|
|
604
|
+
*/
|
|
605
|
+
interface HostServiceDefinition<TConfig = Record<string, unknown>> extends ServiceDefinitionBase<TConfig> {
|
|
606
|
+
run: ServiceHostRun;
|
|
607
|
+
/** The endpoints a ready instance reports, read from its run record. A
|
|
608
|
+
* throw fails the start, naming what the record lacks. */
|
|
609
|
+
endpoints?: (record: import("@powerhousedao/host-core").RunRecord) => Record<string, {
|
|
610
|
+
url: string;
|
|
611
|
+
type?: EndpointType;
|
|
612
|
+
}>;
|
|
613
|
+
/** No signal: the stop is the end of its stdin. */
|
|
614
|
+
shutdown?: {
|
|
615
|
+
timeout: number;
|
|
616
|
+
signal?: never;
|
|
617
|
+
};
|
|
618
|
+
command?: never;
|
|
619
|
+
}
|
|
620
|
+
/** What {@link HostServiceDefinition} runs. */
|
|
621
|
+
interface ServiceHostRun {
|
|
622
|
+
/** The host: its folder under the project's `hosts/`, or `<package>/<host>`
|
|
623
|
+
* for one an installed package supplies. */
|
|
624
|
+
host: string;
|
|
625
|
+
/** Absent: the host's default verb. A one-shot verb writes no run record
|
|
626
|
+
* and is refused. */
|
|
627
|
+
verb?: string;
|
|
628
|
+
/** The runner's arguments, after `--`. */
|
|
629
|
+
argv?: readonly string[];
|
|
630
|
+
/** Merged into the child's env, under `env(ctx)`. It may not set
|
|
631
|
+
* PH_USER_DATA_DIR: the data dir is the project. */
|
|
632
|
+
env?: Record<string, string>;
|
|
633
|
+
}
|
|
698
634
|
/**
|
|
699
635
|
* Options for starting a service instance.
|
|
700
636
|
*/
|
|
@@ -735,11 +671,17 @@ interface ServiceStatus {
|
|
|
735
671
|
restartAttempt?: number;
|
|
736
672
|
}
|
|
737
673
|
/**
|
|
738
|
-
* Manager for long-running background services.
|
|
674
|
+
* Manager for long-running background services. A manager reports, stops
|
|
675
|
+
* and restarts only the instances it started; one recorded by another
|
|
676
|
+
* process (or left over from an earlier run) is never adopted.
|
|
739
677
|
*/
|
|
740
678
|
interface ServiceManager {
|
|
741
679
|
start(id: string, opts?: ServiceStartOptions): Promise<string>;
|
|
742
680
|
stop(id: string, instanceId?: string): Promise<void>;
|
|
681
|
+
/** Stop every instance this manager started (the CLI runtime's teardown
|
|
682
|
+
* calls it). Instances still running when the process ends are killed
|
|
683
|
+
* anyway; this is the graceful path. */
|
|
684
|
+
stopAll(): Promise<void>;
|
|
743
685
|
list(serviceId?: string): ServiceInstanceStatus[];
|
|
744
686
|
/** Get the static definition for a service. */
|
|
745
687
|
getDefinition(id: string): ServiceDefinition | undefined;
|
|
@@ -860,9 +802,14 @@ interface WrapRegistry {
|
|
|
860
802
|
/**
|
|
861
803
|
* Wraps each agent tool's execute function. Implementations must forward
|
|
862
804
|
* every invocation argument — Mastra invokes `execute(args, toolContext)`.
|
|
805
|
+
*
|
|
806
|
+
* Any tool fits as it is, a Mastra `Tool` included: `execute` may be
|
|
807
|
+
* absent (Mastra's is optional, so an implementation returns such a tool
|
|
808
|
+
* unwrapped), and it is declared as a method so an `execute` with typed
|
|
809
|
+
* arguments fits as well.
|
|
863
810
|
*/
|
|
864
811
|
tool<T extends {
|
|
865
|
-
execute
|
|
812
|
+
execute?(...args: unknown[]): unknown;
|
|
866
813
|
}>(name: string, tool: T): T;
|
|
867
814
|
/** Wraps a routine iteration body. */
|
|
868
815
|
routineIteration<R>(attrs: {
|
|
@@ -1003,12 +950,6 @@ interface CliMetadata {
|
|
|
1003
950
|
interface CliOptions<TSchema extends z.ZodType = z.ZodType<Record<string, unknown>>, TSecrets extends z.ZodType = z.ZodType<Record<string, unknown>>> {
|
|
1004
951
|
name: string;
|
|
1005
952
|
version: string;
|
|
1006
|
-
/**
|
|
1007
|
-
* Absolute path to the CLI package root (the directory containing package.json).
|
|
1008
|
-
* Used by the framework to resolve sibling packages (e.g. the `-app` Reactor Package)
|
|
1009
|
-
* and auto-detect Connect assets. Typically set to `CLI_ROOT` from config.ts.
|
|
1010
|
-
*/
|
|
1011
|
-
root?: string;
|
|
1012
953
|
description: Resolvable<string, z.infer<TSchema> & z.infer<TSecrets>>;
|
|
1013
954
|
commands: Command<any, any, any>[];
|
|
1014
955
|
configSchema?: TSchema;
|
|
@@ -1016,8 +957,8 @@ interface CliOptions<TSchema extends z.ZodType = z.ZodType<Record<string, unknow
|
|
|
1016
957
|
secretsSchema?: TSecrets;
|
|
1017
958
|
interactive?: InteractiveConfig<z.infer<TSchema> & z.infer<TSecrets>>;
|
|
1018
959
|
/**
|
|
1019
|
-
* Builds the bearer-token handler for the
|
|
1020
|
-
*
|
|
960
|
+
* Builds the bearer-token handler for the switchboard's HTTP attachment
|
|
961
|
+
* routes (`/attachments/*`). Called once after config resolves,
|
|
1021
962
|
* with the workdir + resolved config; the returned handler mints a token per
|
|
1022
963
|
* call (or undefined when none is available). The framework has no identity
|
|
1023
964
|
* of its own, so the host CLI supplies this — without it, attachment
|
|
@@ -1050,25 +991,6 @@ interface CliOptions<TSchema extends z.ZodType = z.ZodType<Record<string, unknow
|
|
|
1050
991
|
* When set, skills are available as CLI commands and auto-installed on first run.
|
|
1051
992
|
*/
|
|
1052
993
|
prompts?: PromptsConfig;
|
|
1053
|
-
/**
|
|
1054
|
-
* When true, an embedded reverse proxy is started that exposes all service
|
|
1055
|
-
* endpoints through a single port. Config fields `proxyPort` and `proxyHost`
|
|
1056
|
-
* are auto-injected into the config schema.
|
|
1057
|
-
*/
|
|
1058
|
-
proxyEnabled?: boolean;
|
|
1059
|
-
/**
|
|
1060
|
-
* Extra proxy routes registered at startup, alongside the service-derived
|
|
1061
|
-
* ones. For in-process HTTP servers on fixed ports (e.g. a trigger-owned
|
|
1062
|
-
* API) that the ServiceManager doesn't know about. Requires `proxyEnabled`.
|
|
1063
|
-
*/
|
|
1064
|
-
proxyRoutes?: Array<{
|
|
1065
|
-
/** URL path prefix matched against incoming requests (e.g. '/preview'). */
|
|
1066
|
-
prefix: string;
|
|
1067
|
-
/** Upstream target URL (e.g. 'http://127.0.0.1:5180'). */
|
|
1068
|
-
upstream: string;
|
|
1069
|
-
/** Forward WebSocket upgrades on this route. */
|
|
1070
|
-
ws?: boolean;
|
|
1071
|
-
}>;
|
|
1072
994
|
/**
|
|
1073
995
|
* Lifecycle hooks registered with this CLI. Each hook may contribute a
|
|
1074
996
|
* config schema fragment (merged into the effective schema, so its fields
|
|
@@ -1100,7 +1022,38 @@ interface RunOptions {
|
|
|
1100
1022
|
configFile?: string;
|
|
1101
1023
|
/** Override log verbosity. Default: 'info'. */
|
|
1102
1024
|
logLevel?: LogLevel;
|
|
1025
|
+
/**
|
|
1026
|
+
* The reactor for this run, in place of the one `configureReactor` set:
|
|
1027
|
+
* called lazily, like that configuration's `create`, with the setup
|
|
1028
|
+
* context and that configuration (undefined when the CLI set none). A
|
|
1029
|
+
* host runner (`@powerhousedao/clint/cli-runner`) attaches a remote
|
|
1030
|
+
* switchboard here.
|
|
1031
|
+
*/
|
|
1032
|
+
reactor?: RunReactor;
|
|
1033
|
+
/**
|
|
1034
|
+
* Called once when the CLI keeps running (interactive, or serving its
|
|
1035
|
+
* routine), before it starts anything for that; never for a one-shot
|
|
1036
|
+
* command. A host runner writes its run record here. A rejection ends the
|
|
1037
|
+
* run: its message on stderr, exit code 1.
|
|
1038
|
+
*/
|
|
1039
|
+
onServe?: () => void | Promise<void>;
|
|
1040
|
+
/**
|
|
1041
|
+
* Stops a run that keeps going as SIGINT or SIGTERM would: the headless
|
|
1042
|
+
* keep-alive and the ink shell end, and the CLI tears down. An abort
|
|
1043
|
+
* before then takes effect once it is serving. The line-based shell
|
|
1044
|
+
* (`-i` on a pipe) and a command in flight do not listen.
|
|
1045
|
+
*/
|
|
1046
|
+
signal?: AbortSignal;
|
|
1047
|
+
/**
|
|
1048
|
+
* The members of the compound this CLI is the foreground member of, as
|
|
1049
|
+
* service instances next to its own services (`context.services`): the
|
|
1050
|
+
* panel and the log calls show them; start and stop refuse, since the
|
|
1051
|
+
* compound owns their life.
|
|
1052
|
+
*/
|
|
1053
|
+
members?: () => readonly import("@powerhousedao/host-core").MemberStatus[];
|
|
1103
1054
|
}
|
|
1055
|
+
/** See `RunOptions.reactor`. */
|
|
1056
|
+
type RunReactor = (setup: ReactorSetupContext, configured: ReactorConfiguration | undefined) => Promise<ReactorContext>;
|
|
1104
1057
|
/**
|
|
1105
1058
|
* Environment variable mapping for a config field.
|
|
1106
1059
|
*/
|
|
@@ -1517,14 +1470,14 @@ interface TypedReactorClient<R extends DocumentRegistry> extends Omit<IReactorCl
|
|
|
1517
1470
|
find<T extends keyof R & string = keyof R & string>(search: Omit<SearchFilter, "documentTypes"> & {
|
|
1518
1471
|
documentTypes?: T[];
|
|
1519
1472
|
}, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<R[T]["document"]>>;
|
|
1520
|
-
getDocumentModelModule<T extends keyof R & string>(documentType: T): Promise<DocumentModelModule<R[T]["state"]>>;
|
|
1473
|
+
getDocumentModelModule<T extends keyof R & string>(documentType: T): Promise<DocumentModelModule$1<R[T]["state"]>>;
|
|
1521
1474
|
create<T extends keyof R & string = keyof R & string>(document: R[T]["document"], parentIdentifier?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1522
1475
|
createEmpty<T extends keyof R & string>(documentModelType: T, options?: CreateDocumentOptions, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1523
1476
|
createDocumentInDrive<T extends keyof R & string = keyof R & string>(driveId: string, document: R[T]["document"], parentFolder?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1524
1477
|
execute<T extends keyof R & string = keyof R & string>(documentIdentifier: string, branch: string, actions: Array<R[T]["actions"]>, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1525
1478
|
executeAsync<T extends keyof R & string = keyof R & string>(documentIdentifier: string, branch: string, actions: Array<R[T]["actions"]>, signal?: AbortSignal): Promise<JobInfo>;
|
|
1526
1479
|
rename<T extends keyof R & string = keyof R & string>(documentIdentifier: string, name: string, branch?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1527
|
-
addRelationship<T extends keyof R & string = keyof R & string>(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1480
|
+
addRelationship<T extends keyof R & string = keyof R & string>(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1528
1481
|
removeRelationship<T extends keyof R & string = keyof R & string>(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<R[T]["document"]>;
|
|
1529
1482
|
moveRelationship<T extends keyof R & string = keyof R & string>(sourceParentIdentifier: string, targetParentIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<{
|
|
1530
1483
|
source: R[T]["document"];
|
|
@@ -1538,31 +1491,6 @@ interface TypedReactorClient<R extends DocumentRegistry> extends Omit<IReactorCl
|
|
|
1538
1491
|
interface TypedDocumentChangeEvent<R extends DocumentRegistry, T extends keyof R & string = keyof R & string> extends Omit<DocumentChangeEvent, "documents"> {
|
|
1539
1492
|
documents: Array<R[T]["document"]>;
|
|
1540
1493
|
}
|
|
1541
|
-
/**
|
|
1542
|
-
* Structural type for the ReactorClientModule returned by
|
|
1543
|
-
* @powerhousedao/reactor's ReactorClientBuilder.buildModule().
|
|
1544
|
-
*
|
|
1545
|
-
* Used as the boundary type between buildReactor() and its consumers
|
|
1546
|
-
* (ensureDrive, startSwitchboard, buildDefaultReactor). The actual module
|
|
1547
|
-
* has additional properties; this captures the subset ph-clint uses.
|
|
1548
|
-
*
|
|
1549
|
-
* Imported via `import type` — zero runtime coupling.
|
|
1550
|
-
*/
|
|
1551
|
-
interface ReactorClientModule {
|
|
1552
|
-
client: IReactorClient;
|
|
1553
|
-
reactor: {
|
|
1554
|
-
kill(): {
|
|
1555
|
-
completed: Promise<void>;
|
|
1556
|
-
};
|
|
1557
|
-
findByType(documentType: string): Promise<{
|
|
1558
|
-
results?: Array<{
|
|
1559
|
-
header: {
|
|
1560
|
-
id: string;
|
|
1561
|
-
};
|
|
1562
|
-
}>;
|
|
1563
|
-
} | undefined>;
|
|
1564
|
-
};
|
|
1565
|
-
}
|
|
1566
1494
|
/**
|
|
1567
1495
|
* A drive managed by the reactor. Each drive has a role:
|
|
1568
1496
|
* - `personal` — the agent's own workspace drive
|
|
@@ -1575,8 +1503,6 @@ interface DriveEntry {
|
|
|
1575
1503
|
name: string;
|
|
1576
1504
|
/** Role: 'personal' = agent's own workspace, 'watched' = observed from elsewhere. */
|
|
1577
1505
|
role: "personal" | "watched";
|
|
1578
|
-
/** For watched remote drives: the Switchboard URL to sync from. */
|
|
1579
|
-
remoteUrl?: string;
|
|
1580
1506
|
}
|
|
1581
1507
|
/**
|
|
1582
1508
|
* An entry in a drive folder listing — either a folder node or a document node.
|
|
@@ -1628,26 +1554,52 @@ interface ReactorContext<R extends DocumentRegistry = AnyRegistry> {
|
|
|
1628
1554
|
drives?: DriveEntry[];
|
|
1629
1555
|
/** The personal drive ID (first drive with role 'personal'). */
|
|
1630
1556
|
personalDriveId?: string;
|
|
1631
|
-
/**
|
|
1557
|
+
/** The switchboard's GraphQL URL (e.g. http://localhost:4001/graphql). */
|
|
1632
1558
|
switchboardUrl?: string;
|
|
1633
|
-
/**
|
|
1559
|
+
/** The default drive's URL on the switchboard (e.g. http://localhost:4001/d/{driveId}). */
|
|
1634
1560
|
driveUrl?: string;
|
|
1635
|
-
/** Phase 2: Switchboard MCP URL (e.g. http://localhost:4001/mcp). */
|
|
1636
|
-
mcpUrl?: string;
|
|
1637
|
-
/** Phase 3: Connect web UI URL (e.g. http://localhost:3000). */
|
|
1638
|
-
connectUrl?: string;
|
|
1639
1561
|
/**
|
|
1640
1562
|
* Switchboard-provided attachment service. Constructed externally
|
|
1641
1563
|
* (switchboard owns createRemoteAttachmentService) and passed in via
|
|
1642
|
-
* ReactorSetupContext.attachments
|
|
1643
|
-
*
|
|
1564
|
+
* ReactorSetupContext.attachments; a remote attach that is passed none
|
|
1565
|
+
* builds one for the switchboard it attached to. Upload and read sites
|
|
1566
|
+
* reach it here. Undefined when no attachment service is wired.
|
|
1644
1567
|
*/
|
|
1645
1568
|
attachments?: IAttachmentService;
|
|
1646
|
-
/**
|
|
1647
|
-
|
|
1569
|
+
/**
|
|
1570
|
+
* Whether the agent may write a document right now (see
|
|
1571
|
+
* `createReactorWrites`). Triggers that write on the agent's behalf skip a
|
|
1572
|
+
* document this refuses and look again on `powerhouse:writes:ready`.
|
|
1573
|
+
*/
|
|
1574
|
+
writes?: ReactorWrites;
|
|
1648
1575
|
/** Teardown — called by the framework on CLI exit. */
|
|
1649
1576
|
shutdown(): Promise<void>;
|
|
1650
1577
|
}
|
|
1578
|
+
/** See `ReactorContext.writes`. */
|
|
1579
|
+
interface ReactorWrites {
|
|
1580
|
+
/** The agent's signer can sign as a user. */
|
|
1581
|
+
ready(): boolean;
|
|
1582
|
+
/** The agent may write this document now (its policy, readiness and the host's rules). */
|
|
1583
|
+
canWrite(document: {
|
|
1584
|
+
header: {
|
|
1585
|
+
id: string;
|
|
1586
|
+
documentType?: string;
|
|
1587
|
+
protocolVersions?: Record<string, number> | null;
|
|
1588
|
+
};
|
|
1589
|
+
}): boolean;
|
|
1590
|
+
}
|
|
1591
|
+
/**
|
|
1592
|
+
* What `ensureDrive` and a `DriveConfig.resolveId` call on a client. Both an
|
|
1593
|
+
* `IReactorClient` (in-process or remote) and a Cli's `ReactorContext.client`
|
|
1594
|
+
* fit it as they are: the typed client is the same object, and these
|
|
1595
|
+
* members read any document as a plain `PHDocument`.
|
|
1596
|
+
*/
|
|
1597
|
+
interface EnsureDriveClient {
|
|
1598
|
+
get(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<PHDocument>;
|
|
1599
|
+
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
1600
|
+
newDocument: IReactorClient["newDocument"];
|
|
1601
|
+
write: Pick<IReactorClient["write"], "create">;
|
|
1602
|
+
}
|
|
1651
1603
|
/**
|
|
1652
1604
|
* Drive configuration for the Powerhouse integration.
|
|
1653
1605
|
*/
|
|
@@ -1663,6 +1615,23 @@ interface DriveConfig {
|
|
|
1663
1615
|
* drive in. Stored on `header.meta.preferredEditor` at creation time. Has
|
|
1664
1616
|
* no effect on drives that already exist. */
|
|
1665
1617
|
preferredEditor?: string;
|
|
1618
|
+
/**
|
|
1619
|
+
* Resolve the drive's id before anything else (for example from a pointer
|
|
1620
|
+
* the host keeps for a drive whose id it cannot fix in advance). An id that
|
|
1621
|
+
* resolves wins; undefined falls through to `id` and the name match. It
|
|
1622
|
+
* gets the client `ensureDrive` was given.
|
|
1623
|
+
*/
|
|
1624
|
+
resolveId?: (client: EnsureDriveClient) => Promise<string | undefined>;
|
|
1625
|
+
/** Match an existing drive by name when no id resolves. Default: true. */
|
|
1626
|
+
matchByName?: boolean;
|
|
1627
|
+
/**
|
|
1628
|
+
* Whether the drive may be created now. When this returns false and no
|
|
1629
|
+
* drive resolves, none is created: the reactor starts without it (its id
|
|
1630
|
+
* is '') and the host creates it later.
|
|
1631
|
+
*/
|
|
1632
|
+
canCreate?: () => boolean;
|
|
1633
|
+
/** Called with the id of a drive that was just created. */
|
|
1634
|
+
onCreated?: (id: string) => Promise<void> | void;
|
|
1666
1635
|
}
|
|
1667
1636
|
/**
|
|
1668
1637
|
* Subscription configuration — filters which document changes
|
|
@@ -1672,51 +1641,6 @@ interface SubscriptionConfig<R extends DocumentRegistry = AnyRegistry> {
|
|
|
1672
1641
|
/** Filter by document type(s). */
|
|
1673
1642
|
documentTypes?: Array<keyof R & string>;
|
|
1674
1643
|
}
|
|
1675
|
-
/**
|
|
1676
|
-
* Switchboard (Phase 2) configuration.
|
|
1677
|
-
*/
|
|
1678
|
-
interface SwitchboardConfig {
|
|
1679
|
-
/** Enable Switchboard. Default: false. */
|
|
1680
|
-
enabled: boolean;
|
|
1681
|
-
/** Hostname/IP to bind to. Default: 'localhost'. */
|
|
1682
|
-
host?: string;
|
|
1683
|
-
/** HTTP port. Default: derived from CLI name via hash. */
|
|
1684
|
-
port?: number;
|
|
1685
|
-
/** Number of ports to scan starting from `port`. Default: 1. */
|
|
1686
|
-
portRange?: number;
|
|
1687
|
-
/** Service label for preflight messages. Default: '{cliName}-api'. */
|
|
1688
|
-
name?: string;
|
|
1689
|
-
/**
|
|
1690
|
-
* Registry URL forwarded to the switchboard's `HttpPackageLoader`. When
|
|
1691
|
-
* set, the `Packages` GraphQL subgraph is registered (install/uninstall
|
|
1692
|
-
* mutations) and dynamic package resolution is enabled.
|
|
1693
|
-
*/
|
|
1694
|
-
registryUrl?: string;
|
|
1695
|
-
}
|
|
1696
|
-
/**
|
|
1697
|
-
* Connect UI (Phase 3) configuration.
|
|
1698
|
-
*/
|
|
1699
|
-
interface ConnectConfig {
|
|
1700
|
-
/** Enable Connect. Default: false. */
|
|
1701
|
-
enabled: boolean;
|
|
1702
|
-
/** HTTP port. Default: derived from CLI name via hash. */
|
|
1703
|
-
port?: number;
|
|
1704
|
-
/** Number of ports to scan starting from `port`. Default: 1. */
|
|
1705
|
-
portRange?: number;
|
|
1706
|
-
/** Working directory for `ph connect` (must be a Reactor Package project). */
|
|
1707
|
-
workdir?: string;
|
|
1708
|
-
/** Service ID for ServiceManager. Default: '{cliName}-studio'. */
|
|
1709
|
-
name?: string;
|
|
1710
|
-
/** Path to pre-built Connect static assets. When set, serves via static file server instead of Vite dev server. */
|
|
1711
|
-
assetsDir?: string;
|
|
1712
|
-
precompress?: boolean;
|
|
1713
|
-
/**
|
|
1714
|
-
* Package registry URL forwarded to Connect via
|
|
1715
|
-
* `PH_CONNECT_PACKAGES_REGISTRY`. The vite config reads this to resolve
|
|
1716
|
-
* Powerhouse packages for in-browser dynamic imports.
|
|
1717
|
-
*/
|
|
1718
|
-
registryUrl?: string;
|
|
1719
|
-
}
|
|
1720
1644
|
/**
|
|
1721
1645
|
* Context passed to the reactor factory in configureReactor().
|
|
1722
1646
|
* Provides core infrastructure the factory needs to build the reactor.
|
|
@@ -1734,37 +1658,93 @@ interface ReactorSetupContext<R extends DocumentRegistry = AnyRegistry> {
|
|
|
1734
1658
|
workspace: WorkdirStore;
|
|
1735
1659
|
emit?: EmitFn<R>;
|
|
1736
1660
|
on?: OnFn<R>;
|
|
1737
|
-
/** Switchboard config — passed by the framework so create() can set enableSync. */
|
|
1738
|
-
switchboard?: SwitchboardConfig;
|
|
1739
1661
|
/**
|
|
1740
1662
|
* Switchboard-provided attachment service to thread through to ReactorContext.
|
|
1741
1663
|
* The service is constructed externally (switchboard owns createRemoteAttachmentService)
|
|
1742
1664
|
* and relayed here so the create() factory can place it on the returned context.
|
|
1743
1665
|
*/
|
|
1744
1666
|
attachments?: IAttachmentService;
|
|
1667
|
+
/**
|
|
1668
|
+
* Mints the bearer for a switchboard's `/attachments/*` routes, from
|
|
1669
|
+
* `CliOptions.attachmentJwtHandler`. A remote attach without `attachments`
|
|
1670
|
+
* builds its attachment service with it, else with the remote's
|
|
1671
|
+
* `tokenProvider`.
|
|
1672
|
+
*/
|
|
1673
|
+
attachmentJwtHandler?: (url: string) => Promise<string | undefined>;
|
|
1745
1674
|
}
|
|
1746
1675
|
/**
|
|
1747
1676
|
* Configuration for configureReactor().
|
|
1748
1677
|
* The `create` factory is called lazily on first reactor() access.
|
|
1749
1678
|
*/
|
|
1750
1679
|
interface ReactorConfiguration<R extends DocumentRegistry = AnyRegistry> {
|
|
1751
|
-
/**
|
|
1680
|
+
/**
|
|
1681
|
+
* Factory that builds and returns a ReactorContext, when no host runner
|
|
1682
|
+
* attaches the CLI to a switchboard (a test fake, a custom client, or an
|
|
1683
|
+
* error naming how to run the CLI).
|
|
1684
|
+
*/
|
|
1752
1685
|
create: (ctx: ReactorSetupContext<R>) => Promise<ReactorContext<R>>;
|
|
1753
|
-
/**
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1686
|
+
/**
|
|
1687
|
+
* What the reactor holds when a host runner attaches it to a remote
|
|
1688
|
+
* switchboard instead of calling `create` (see `RunOptions.reactor`):
|
|
1689
|
+
* read by `attachDefaultReactor`, never by `create`. A function is called
|
|
1690
|
+
* with the setup context at attach time, for what depends on the workdir
|
|
1691
|
+
* or the config (an identity, a token).
|
|
1692
|
+
*/
|
|
1693
|
+
remote?: RemoteReactorSource<R>;
|
|
1694
|
+
}
|
|
1695
|
+
/** `ReactorConfiguration.remote`: the config, or how to build it at attach. */
|
|
1696
|
+
type RemoteReactorSource<R extends DocumentRegistry = AnyRegistry> = RemoteReactorConfig<R> | ((setup: ReactorSetupContext<R>) => RemoteReactorConfig<R> | Promise<RemoteReactorConfig<R>>);
|
|
1697
|
+
/**
|
|
1698
|
+
* What a CLI's reactor holds on a remote switchboard: the models its client
|
|
1699
|
+
* signs and reduces with, the drives to find or create there, the changes
|
|
1700
|
+
* to bridge to the event bus, and who it writes as. No drive: the drive the
|
|
1701
|
+
* address names. No signer: writes go out unsigned and the switchboard signs
|
|
1702
|
+
* them with its own key.
|
|
1703
|
+
*/
|
|
1704
|
+
interface RemoteReactorConfig<R extends DocumentRegistry = AnyRegistry> {
|
|
1705
|
+
/** Any model module fits, as for the reactor and its clients. */
|
|
1706
|
+
documentModels?: readonly DocumentModelModule$1<any>[];
|
|
1707
|
+
/** Single drive (sugar for drives: [{ ...drive, role: 'personal' }]). */
|
|
1708
|
+
drive?: DriveConfig;
|
|
1709
|
+
/** First 'personal' drive = personalDriveId = driveId. */
|
|
1710
|
+
drives?: Array<DriveConfig & {
|
|
1711
|
+
role: "personal" | "watched";
|
|
1712
|
+
}>;
|
|
1713
|
+
subscriptions?: SubscriptionConfig<R>;
|
|
1714
|
+
/**
|
|
1715
|
+
* Signs the actions the client pushes, read on every write (see
|
|
1716
|
+
* `createReactorWrites`): a signer whose `user` is set later, by a
|
|
1717
|
+
* sign-in, takes effect without a new attach.
|
|
1718
|
+
*
|
|
1719
|
+
* Limit: while the signer has no user, every push is refused with
|
|
1720
|
+
* `SignerNotReadyError`, a write to a legacy document included, whatever
|
|
1721
|
+
* `legacyDocuments` says. The client asks for its signer before it knows
|
|
1722
|
+
* which document it writes, so the resolver cannot pass a legacy write
|
|
1723
|
+
* through unsigned. Give a signer only where the documents written are
|
|
1724
|
+
* v2, or once its user is known.
|
|
1725
|
+
*/
|
|
1726
|
+
signer?: ISigner;
|
|
1727
|
+
/** The bearer per request, for an authenticated switchboard. */
|
|
1728
|
+
tokenProvider?: BearerTokenProvider;
|
|
1729
|
+
/**
|
|
1730
|
+
* Subscribe to changes of the signer's user; returns an unsubscribe
|
|
1731
|
+
* function. On each change the realtime socket reconnects with the
|
|
1732
|
+
* current bearer, and `powerhouse:writes:ready` is emitted when writes
|
|
1733
|
+
* become possible.
|
|
1734
|
+
*/
|
|
1735
|
+
onSignerChange?: (listener: () => void) => () => void;
|
|
1736
|
+
/** See `WriteRules.legacyDocuments` (`writes.canWrite`). Default: `sign-when-ready`. */
|
|
1737
|
+
legacyDocuments?: "refuse" | "sign-when-ready";
|
|
1738
|
+
/** Which documents the agent acts on by itself (`writes.canWrite`). */
|
|
1739
|
+
accepts?: (document: {
|
|
1740
|
+
header: {
|
|
1741
|
+
id: string;
|
|
1742
|
+
documentType?: string;
|
|
1743
|
+
protocolVersions?: Record<string, number> | null;
|
|
1744
|
+
};
|
|
1745
|
+
}) => boolean;
|
|
1766
1746
|
}
|
|
1767
1747
|
//#endregion
|
|
1768
|
-
export {
|
|
1748
|
+
export { LogLevel as $, AgentStreamOptions as A, SkillConfig as At, CommandServiceDefinition as B, WorkdirStore as Bt, ReserveAttachmentOptions as C, ServiceDefinition as Ct, AgentPromptInput as D, ServiceManager as Dt, AgentProfileConfig as E, ServiceInstanceStatus as Et, Cli as F, ToolResultChunk as Ft, ErrorChunk as G, scanProjects as Gt, CoreContext as H, SkillInfo as Ht, CliMetadata as I, Trigger as It, InferConfig as J, EventBus as K, CliOptions as L, TriggerContext as Lt, BootstrapOptions as M, TextDeltaChunk as Mt, BootstrapResult as N, ToolCallChunk as Nt, AgentProvider as O, ServiceStartOptions as Ot, CaptureDefinition as P, ToolOutputChunk as Pt, LifecycleInitContext as Q, Command as R, TriggerOptions as Rt, IAttachmentService as S, ServiceBuildContext as St, AgentLoader as T, ServiceHostRun as Tt, EmitFn as U, readSkills as Ut, ConfigEnvVar as V, WrapRegistry as Vt, EndpointType as W, PROJECT_INDICATORS as Wt, LifecycleHandle as X, InteractiveConfig as Y, LifecycleHook as Z, TypedDocumentChangeEvent as _, Routine as _t, DriveEntry as a, PreflightResult as at, AttachmentResponse as b, RunOptions as bt, FolderOperations as c, ProcessRunOptions as ct, ReactorSetupContext as d, PromptConfig as dt, Logger as et, ReactorWrites as f, PromptsConfig as ft, SubscriptionConfig as g, ResolvedInteractiveConfig as gt, RemoteReactorSource as h, Resolvable as ht, DriveConfig as i, PreflightContext as it, BootTimings as j, StreamChunk as jt, AgentSetupContext as k, ServiceStatus as kt, ReactorConfiguration as l, ProjectScanResult as lt, RemoteReactorConfig as m, ReadinessPattern as mt, AttachmentRef$1 as n, PhClintEvents as nt, EnsureDriveClient as o, ProcessHandle as ot, RegistryEntry as p, ReadinessConfig as pt, HostServiceDefinition as q, DocumentRegistry as r, PreflightCheck as rt, FolderEntry as s, ProcessManager as st, AnyRegistry as t, OnFn as tt, ReactorContext as u, ProjectScanner as ut, TypedReactorClient as v, RoutineConfig as vt, AgentContentPart as w, ServiceDefinitionBase as wt, AttachmentUploadResult as x, RunReactor as xt, AttachmentHeader as y, RoutineStatus as yt, CommandContext as z, WorkItem as zt };
|
|
1769
1749
|
export {};
|
|
1770
|
-
//# sourceMappingURL=types-
|
|
1750
|
+
//# sourceMappingURL=types-CF6GuPJd.d.mts.map
|