@hop-top/kit 0.5.0-alpha.2 → 0.5.0-alpha.4
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/CHANGELOG.md +60 -0
- package/LICENSE +1 -1
- package/README.md +48 -480
- package/dist/{aim-CTp-kJW2.d.ts → aim-DZHwwiIc.d.ts} +1 -1
- package/dist/aim.d.ts +1 -1
- package/dist/aim.js +13 -414
- package/dist/{alias-dhhr08Ei.d.ts → alias-BOj0-VAr.d.ts} +1 -1
- package/dist/alias.d.ts +1 -1
- package/dist/alias.js +18 -206
- package/dist/{api-miiso81x.d.ts → api-DAexsu2H.d.ts} +1 -1
- package/dist/api.d.ts +1 -1
- package/dist/api.js +10 -164
- package/dist/auth.js +6 -40
- package/dist/chunk-3FIKGFKI.js +54 -0
- package/dist/chunk-4UE5TCMQ.js +104 -0
- package/dist/chunk-6HFAEZ52.js +29 -0
- package/dist/chunk-6SVOHNIC.js +17 -0
- package/dist/chunk-72XZWQX7.js +504 -0
- package/dist/chunk-ABQSE7AI.js +513 -0
- package/dist/chunk-BDNNPRX6.js +41 -0
- package/dist/chunk-BRNEKPWX.js +37 -0
- package/dist/chunk-CSJWB6D3.js +151 -0
- package/dist/chunk-GGWJRWWA.js +309 -0
- package/dist/chunk-IQXEISMC.js +142 -0
- package/dist/chunk-JTMPNXVQ.js +1491 -0
- package/dist/chunk-KVG7YCTS.js +115 -0
- package/dist/chunk-L23O2FFE.js +51 -0
- package/dist/chunk-MQXYDYRD.js +968 -0
- package/dist/chunk-MUIQVU6E.js +251 -0
- package/dist/chunk-POR5L2DG.js +247 -0
- package/dist/chunk-PSFYJGDG.js +1445 -0
- package/dist/chunk-QJVSKKRQ.js +369 -0
- package/dist/chunk-QPUCXQXT.js +67 -0
- package/dist/chunk-R5U7XKVJ.js +16 -0
- package/dist/chunk-S45UHXQF.js +182 -0
- package/dist/chunk-T46YPHKN.js +669 -0
- package/dist/chunk-UIOOOK6M.js +334 -0
- package/dist/chunk-UKZIAQA7.js +26 -0
- package/dist/chunk-WBVO43HU.js +355 -0
- package/dist/chunk-WTYDHXPW.js +574 -0
- package/dist/chunk-WUOAQVOA.js +86 -0
- package/dist/chunk-WWUKGJB5.js +90 -0
- package/dist/chunk-YGYQUFGY.js +219 -0
- package/dist/chunk-YOBAUCVN.js +583 -0
- package/dist/{cli-DgOEOsPB.d.ts → cli-8rfITnv4.d.ts} +13 -4
- package/dist/cli.d.ts +4 -3
- package/dist/cli.js +50 -1056
- package/dist/{config-BUY7_W2n.d.ts → config-Bm9fBXch.d.ts} +35 -4
- package/dist/config.d.ts +1 -1
- package/dist/config.js +6 -78
- package/dist/errcorrect.js +8 -68
- package/dist/error-Do8Qji43.d.ts +231 -0
- package/dist/id/index.d.ts +1 -1
- package/dist/id/index.js +14 -65
- package/dist/{index-MLrRDvEG.d.ts → index-B-pqGHhU.d.ts} +113 -19
- package/dist/{index--C7Mtsmm.d.ts → index-DEyjGoo2.d.ts} +1 -1
- package/dist/{index-QSffbLnj.d.ts → index-VLDcI5NF.d.ts} +3 -2
- package/dist/index.d.ts +18 -13
- package/dist/index.js +40 -5792
- package/dist/llm-DYuR7_uX.d.ts +1069 -0
- package/dist/llm-anthropic-Cd_I2xXB.d.ts +67 -0
- package/dist/llm-anthropic.d.ts +2 -0
- package/dist/llm-anthropic.js +13 -0
- package/dist/llm-openai-DyFrucmV.d.ts +87 -0
- package/dist/llm-openai.d.ts +2 -0
- package/dist/llm-openai.js +19 -0
- package/dist/llm.d.ts +1 -1
- package/dist/llm.js +101 -356
- package/dist/mcp/index.d.ts +2 -1
- package/dist/mcp/index.js +155 -1453
- package/dist/{netpolicy-asvCfwi8.d.ts → netpolicy-Brx5XZUB.d.ts} +16 -3
- package/dist/netpolicy.d.ts +1 -1
- package/dist/netpolicy.js +25 -118
- package/dist/{output-VFFLqor9.d.ts → output-CjZWmL8s.d.ts} +29 -130
- package/dist/output.d.ts +2 -1
- package/dist/output.js +137 -958
- package/dist/progress.js +6 -55
- package/dist/provenance.js +6 -31
- package/dist/routellm-B0nv59mH.d.ts +111 -0
- package/dist/routellm.d.ts +2 -2
- package/dist/routellm.js +13 -255
- package/dist/{rpc-D5xLEf8V.d.ts → rpc-D31Lg0Kc.d.ts} +1 -1
- package/dist/rpc.d.ts +2 -2
- package/dist/rpc.js +4 -98
- package/dist/safety.js +6 -43
- package/dist/scope.js +20 -377
- package/dist/serve-D8yWMrTc.d.ts +646 -0
- package/dist/serve.d.ts +3 -0
- package/dist/serve.js +75 -0
- package/dist/sqlstore.js +6 -39
- package/dist/stream.js +8 -51
- package/dist/telemetry/index.js +24 -608
- package/dist/tui/index.d.ts +5 -4
- package/dist/tui/index.js +17 -373
- package/dist/upgrade.js +6 -114
- package/dist/xdg.js +14 -128
- package/package.json +135 -25
- package/src/README.md +15 -0
- package/src/cli.test.ts +56 -1
- package/src/cli.ts +24 -4
- package/src/completion-values.test.ts +10 -10
- package/src/compliance.test.ts +196 -2
- package/src/compliance.ts +440 -20
- package/src/config.test.ts +187 -1
- package/src/config.ts +173 -7
- package/src/gen/crud_pb.ts +7 -7
- package/src/id/README.md +38 -0
- package/src/id/contract.test.ts +1 -1
- package/src/id/index.test.ts +1 -1
- package/src/id/index.ts +3 -2
- package/src/index.test.ts +12 -0
- package/src/index.ts +3 -0
- package/src/llm-anthropic.conformance.test.ts +1135 -0
- package/src/llm-anthropic.test.ts +152 -0
- package/src/llm-anthropic.ts +940 -0
- package/src/llm-choice-hermetic.test.ts +335 -0
- package/src/llm-config.test.ts +232 -0
- package/src/llm-config.ts +106 -0
- package/src/llm-endpoint.ts +254 -0
- package/src/llm-error.ts +17 -0
- package/src/llm-errors.ts +152 -0
- package/src/llm-file.ts +126 -0
- package/src/llm-http.ts +317 -0
- package/src/llm-keys.ts +167 -0
- package/src/llm-media.conformance.test.ts +87 -0
- package/src/llm-media.test.ts +279 -0
- package/src/llm-media.ts +322 -0
- package/src/llm-openai.conformance.test.ts +407 -0
- package/src/llm-openai.test.ts +510 -0
- package/src/llm-openai.ts +708 -0
- package/src/llm-payload.ts +155 -0
- package/src/llm-quote.ts +46 -0
- package/src/llm-routellm.conformance.test.ts +44 -0
- package/src/llm-toolnames.conformance.test.ts +112 -0
- package/src/llm-toolnames.test.ts +132 -0
- package/src/llm-toolnames.ts +298 -0
- package/src/llm-uri.ts +99 -0
- package/src/llm.test.ts +43 -15
- package/src/llm.toolcall.test.ts +175 -0
- package/src/llm.ts +602 -190
- package/src/mcp/README.md +57 -0
- package/src/mcp/conformance.test.ts +24 -3
- package/src/mcp/dispatch.ts +4 -4
- package/src/mcp/identity.test.ts +166 -0
- package/src/mcp/identity.ts +72 -0
- package/src/mcp/index.ts +6 -0
- package/src/mcp/legacy.ts +21 -8
- package/src/mcp/mcp.test.ts +14 -4
- package/src/mcp/modern-confirm.ts +1 -1
- package/src/mcp/modern.ts +12 -11
- package/src/mcp/tasks.ts +1 -1
- package/src/mcp/types.ts +80 -8
- package/src/netpolicy.test.ts +78 -0
- package/src/netpolicy.ts +28 -3
- package/src/output/README.md +46 -0
- package/src/output/builtins.ts +5 -5
- package/src/output/error.ts +167 -1
- package/src/output/formatters/README.md +50 -0
- package/src/output.ts +26 -1
- package/src/published-types.test.ts +115 -0
- package/src/routellm.test.ts +209 -28
- package/src/routellm.toolcall.test.ts +521 -0
- package/src/routellm.ts +213 -177
- package/src/router/README.md +44 -0
- package/src/router/server.test.ts +41 -0
- package/src/router/server.ts +11 -0
- package/src/safety.test.ts +19 -9
- package/src/scope-defaults.json +29 -29
- package/src/serve.test.ts +1257 -0
- package/src/serve.ts +1665 -0
- package/src/telemetry/README.md +48 -0
- package/src/telemetry/client.ts +5 -5
- package/src/toolspec.test.ts +2 -2
- package/src/triton/README.md +34 -0
- package/src/tui/README.md +42 -0
- package/src/wizard.test.ts +7 -7
- package/test/llm/conformance-helpers.ts +100 -0
- package/test/output/dispatch.test.ts +1 -2
- package/test/output/error.test.ts +38 -2
- package/test/output/smoke-capture.ts +2 -2
- package/test/output/smoke.test.ts +2 -2
- package/test/output/taxonomy-contract.test.ts +148 -0
- package/test/setup-env.ts +16 -0
- package/tsconfig.json +3 -1
- package/tsconfig.test.json +10 -0
- package/vitest.config.ts +9 -0
- package/dist/llm-B5XUWH8T.d.ts +0 -231
- package/dist/routellm-PGSt2D1y.d.ts +0 -75
|
@@ -0,0 +1,646 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { C as CliError, a as CODE_TRANSIENT } from './error-Do8Qji43.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @module serve
|
|
6
|
+
* @package @hop-top/kit
|
|
7
|
+
*
|
|
8
|
+
* Serve hierarchy and service lifecycle — the TypeScript port of the
|
|
9
|
+
* contract in `docs/contracts/serve-lifecycle.md`, §"Cross-language
|
|
10
|
+
* parity".
|
|
11
|
+
*
|
|
12
|
+
* `<tool> serve` supervises every configured and enabled service;
|
|
13
|
+
* `<tool> serve <service>` selects exactly one and overrides aggregate
|
|
14
|
+
* enablement. Both forms share one lifecycle implementation, so a
|
|
15
|
+
* service started by the selector observes the same readiness,
|
|
16
|
+
* shutdown, and exit semantics as the same service started by the
|
|
17
|
+
* supervisor.
|
|
18
|
+
*
|
|
19
|
+
* The Go reference is `go/console/serve`. This module mirrors the
|
|
20
|
+
* behavior the contract makes cross-language, and deliberately does
|
|
21
|
+
* not mirror what the contract rules out — there is no REST/OpenAPI
|
|
22
|
+
* projection, no socket service, no command-tree reflection, and no
|
|
23
|
+
* permission/provenance/audit surface here, because those depend on
|
|
24
|
+
* Go-only machinery.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createCLI } from '@hop-top/kit/cli';
|
|
29
|
+
* import { ServiceRegistry, registerServe } from '@hop-top/kit/serve';
|
|
30
|
+
*
|
|
31
|
+
* const registry = new ServiceRegistry();
|
|
32
|
+
* registry.register({
|
|
33
|
+
* name: 'api',
|
|
34
|
+
* async start(signal, ready) {
|
|
35
|
+
* ready();
|
|
36
|
+
* await new Promise<void>(r => signal.addEventListener('abort', () => r(), { once: true }));
|
|
37
|
+
* },
|
|
38
|
+
* ready: () => true,
|
|
39
|
+
* async stop() {},
|
|
40
|
+
* });
|
|
41
|
+
*
|
|
42
|
+
* const { program } = createCLI({ name: 'mytool', version: '1.0.0', description: 'My tool' });
|
|
43
|
+
* registerServe(program, { registry, configs: { api: { enabled: true } } });
|
|
44
|
+
* program.parse();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Service identifier grammar: lowercase ASCII, digits, and internal
|
|
50
|
+
* hyphens. An identifier is a CLI word, a config key segment, and an
|
|
51
|
+
* event payload value at once, which is why the grammar is contract
|
|
52
|
+
* rather than a local convention.
|
|
53
|
+
*/
|
|
54
|
+
declare const NAME_PATTERN: RegExp;
|
|
55
|
+
/**
|
|
56
|
+
* Names reserved for selector vocabulary. Registering one would make
|
|
57
|
+
* `serve <name>` ambiguous with a future aggregate form, and is why
|
|
58
|
+
* `--list` is a flag rather than a `serve list` child.
|
|
59
|
+
*/
|
|
60
|
+
declare const RESERVED_NAMES: readonly string[];
|
|
61
|
+
/** Reports whether `name` is one of the reserved selector words. */
|
|
62
|
+
declare function isReservedName(name: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Validates a service identifier, returning an error message or
|
|
65
|
+
* `null`. Mirrors Go's `serve.ValidateName`.
|
|
66
|
+
*/
|
|
67
|
+
declare function validateName(name: string): string | null;
|
|
68
|
+
/**
|
|
69
|
+
* One long-running thing a tool can serve.
|
|
70
|
+
*
|
|
71
|
+
* The four required capabilities are the contract's minimum: a name, a
|
|
72
|
+
* start that runs until aborted or failed, a readiness report, and a
|
|
73
|
+
* stop. Go expresses them as an interface; here they are properties on
|
|
74
|
+
* a plain object, which the contract explicitly permits — what is
|
|
75
|
+
* fixed is the capability set and each one's behavior, not a method
|
|
76
|
+
* table.
|
|
77
|
+
*/
|
|
78
|
+
interface Service {
|
|
79
|
+
/**
|
|
80
|
+
* Stable service identifier. Must satisfy {@link validateName} and
|
|
81
|
+
* must not change across releases: renaming one is a breaking change
|
|
82
|
+
* to the command surface, the config file, and any subscriber.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Begins serving. Resolves when `signal` aborts (a clean stop) and
|
|
87
|
+
* rejects when the service fails.
|
|
88
|
+
*
|
|
89
|
+
* `ready` must be called exactly once, after every acquisition that
|
|
90
|
+
* can fail deterministically has succeeded — the listener bound, the
|
|
91
|
+
* file created, the subscription attached. Calling it more than once
|
|
92
|
+
* is ignored rather than an error; the supervisor reports ready at
|
|
93
|
+
* most once per start either way.
|
|
94
|
+
*/
|
|
95
|
+
start(signal: AbortSignal, ready: () => void): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the service is currently accepting work. Readiness, not
|
|
98
|
+
* liveness: a ready service may be idle, and may later fail.
|
|
99
|
+
*/
|
|
100
|
+
ready(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Drains in-flight work and releases resources. The supervisor
|
|
103
|
+
* bounds it by the stop timeout and abandons a stop that exceeds it,
|
|
104
|
+
* so an implementation must respect `signal` rather than assume it
|
|
105
|
+
* will be allowed to finish.
|
|
106
|
+
*/
|
|
107
|
+
stop(signal: AbortSignal): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Optional configuration gate — the second of the three validation
|
|
110
|
+
* gates. Returns an error message, or `null` when the resolved
|
|
111
|
+
* configuration is complete and usable.
|
|
112
|
+
*/
|
|
113
|
+
validate?(): string | null;
|
|
114
|
+
/**
|
|
115
|
+
* Optional ordering declaration. Start order is topological over
|
|
116
|
+
* these, ties broken by registration order; stop order is the exact
|
|
117
|
+
* reverse of the order services actually started.
|
|
118
|
+
*/
|
|
119
|
+
dependsOn?(): string[];
|
|
120
|
+
/**
|
|
121
|
+
* Optional address declaration. Read once the service reports ready
|
|
122
|
+
* and carried into the readiness event, so an operator learns where
|
|
123
|
+
* the service actually bound — including a port the kernel picked
|
|
124
|
+
* for a wildcard address, which configuration cannot reveal.
|
|
125
|
+
*/
|
|
126
|
+
addr?(): string;
|
|
127
|
+
/**
|
|
128
|
+
* Optional policy declaration: the `kit/side-effect` and
|
|
129
|
+
* `kit/network` classes, in that order. A service that omits it is
|
|
130
|
+
* unclassified and passes the policy gate.
|
|
131
|
+
*/
|
|
132
|
+
class?(): [sideEffect: string, network: string];
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* The third validation gate. A service whose declared class the gate
|
|
136
|
+
* denies is refused at `UNAUTHORIZED`, exit 5.
|
|
137
|
+
*
|
|
138
|
+
* The contract requires the gate, not Go's YAML-driven
|
|
139
|
+
* side-effect × network table: a two-argument predicate satisfies it.
|
|
140
|
+
* A registry with no gate passes every service, because a tool that
|
|
141
|
+
* has wired no policy has expressed no restriction.
|
|
142
|
+
*/
|
|
143
|
+
interface PolicyGate {
|
|
144
|
+
allow(sideEffect: string, network: string): {
|
|
145
|
+
ok: boolean;
|
|
146
|
+
reason?: string;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Thrown when a registration is rejected at construction time.
|
|
151
|
+
*
|
|
152
|
+
* A duplicate name or an invalid one is a wiring bug in the tool's
|
|
153
|
+
* entry point, not a runtime condition: it surfaces on the first run
|
|
154
|
+
* rather than at the first `serve`, and there is no last-writer-wins
|
|
155
|
+
* path. Go panics; throwing is this port's equivalent. What the
|
|
156
|
+
* contract forbids is letting execution survive it as a warning.
|
|
157
|
+
*/
|
|
158
|
+
declare class ServiceRegistrationError extends Error {
|
|
159
|
+
constructor(message: string);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The seam kit-owned and adopter-owned services register into. A tool
|
|
163
|
+
* builds one before the root command parses; the supervisor reads it.
|
|
164
|
+
*/
|
|
165
|
+
declare class ServiceRegistry {
|
|
166
|
+
private readonly byName;
|
|
167
|
+
private readonly order;
|
|
168
|
+
/**
|
|
169
|
+
* Adds `svc` under its name.
|
|
170
|
+
*
|
|
171
|
+
* Throws on an invalid name and on a duplicate. An adopter
|
|
172
|
+
* deliberately replacing a kit-shipped service calls
|
|
173
|
+
* {@link ServiceRegistry.override} instead — the documented escape
|
|
174
|
+
* hatch, and the only path that accepts a duplicate name.
|
|
175
|
+
*/
|
|
176
|
+
register(svc: Service): void;
|
|
177
|
+
/**
|
|
178
|
+
* Registers `svc`, replacing any service already under its name and
|
|
179
|
+
* keeping that name's original position in {@link list}.
|
|
180
|
+
*
|
|
181
|
+
* Still throws on an invalid name: override lifts the collision
|
|
182
|
+
* rule, not the grammar.
|
|
183
|
+
*/
|
|
184
|
+
override(svc: Service): void;
|
|
185
|
+
/** The service registered under `name`, if any. */
|
|
186
|
+
lookup(name: string): Service | undefined;
|
|
187
|
+
/** Every registered identifier, in registration order. */
|
|
188
|
+
names(): string[];
|
|
189
|
+
/** Every registered service, in registration order. */
|
|
190
|
+
list(): Service[];
|
|
191
|
+
/** Number of registered services. */
|
|
192
|
+
get size(): number;
|
|
193
|
+
}
|
|
194
|
+
/** Default budget from start to readiness. `services.<name>.ready_timeout`. */
|
|
195
|
+
declare const DEFAULT_READY_TIMEOUT_MS = 30000;
|
|
196
|
+
/** Default budget for one stop. `services.<name>.stop_timeout`. */
|
|
197
|
+
declare const DEFAULT_STOP_TIMEOUT_MS = 30000;
|
|
198
|
+
/** Default total shutdown budget. `services.shutdown_timeout`. */
|
|
199
|
+
declare const DEFAULT_SHUTDOWN_TIMEOUT_MS = 60000;
|
|
200
|
+
/**
|
|
201
|
+
* The resolved `services.<name>` block for one service. Only the
|
|
202
|
+
* lifecycle keys are modeled; service-specific keys live in the same
|
|
203
|
+
* block and are read by the service itself.
|
|
204
|
+
*/
|
|
205
|
+
interface ServiceConfig {
|
|
206
|
+
/**
|
|
207
|
+
* `services.<name>.enabled`. Decides whether the supervisor form
|
|
208
|
+
* starts this service. Defaults to `false`: a service that starts
|
|
209
|
+
* listening because a dependency upgrade added it to the registry is
|
|
210
|
+
* an unrequested open port.
|
|
211
|
+
*/
|
|
212
|
+
enabled?: boolean;
|
|
213
|
+
/** `services.<name>.ready_timeout`, in milliseconds. */
|
|
214
|
+
readyTimeoutMs?: number;
|
|
215
|
+
/** `services.<name>.stop_timeout`, in milliseconds. */
|
|
216
|
+
stopTimeoutMs?: number;
|
|
217
|
+
}
|
|
218
|
+
/** The supervisor's answer to "one service failed while others run". */
|
|
219
|
+
type FailurePolicy = 'fail-fast' | 'isolate';
|
|
220
|
+
/** `services.failure_policy` default. */
|
|
221
|
+
declare const DEFAULT_FAILURE_POLICY: FailurePolicy;
|
|
222
|
+
/** Reports whether `p` is a declared failure policy. */
|
|
223
|
+
declare function isFailurePolicy(p: string): p is FailurePolicy;
|
|
224
|
+
/** The supervisor-scoped half of the `services` block. */
|
|
225
|
+
interface SupervisorConfig {
|
|
226
|
+
failurePolicy?: FailurePolicy;
|
|
227
|
+
shutdownTimeoutMs?: number;
|
|
228
|
+
}
|
|
229
|
+
/** The kinds of ending a serve run can have. */
|
|
230
|
+
type LifecycleOutcome = 'clean-stop' | 'invalid-selection' | 'config-invalid' | 'no-services' | 'unknown-service' | 'policy-denied' | 'start-failed' | 'runtime-crash' | 'shutdown-timeout';
|
|
231
|
+
/**
|
|
232
|
+
* Process exit code for `o`. An outcome with no table row is treated
|
|
233
|
+
* as a generic failure rather than a success, so a kind added without
|
|
234
|
+
* a row fails loudly instead of silently exiting 0.
|
|
235
|
+
*/
|
|
236
|
+
declare function exitCodeFor(o: LifecycleOutcome): number;
|
|
237
|
+
/** The `CODE_*` string for `o`, for the rendered error envelope. */
|
|
238
|
+
declare function codeFor(o: LifecycleOutcome): string;
|
|
239
|
+
/** Whether `o` exits non-zero. */
|
|
240
|
+
declare function isFailure(o: LifecycleOutcome): boolean;
|
|
241
|
+
/**
|
|
242
|
+
* The outcome the process should exit on given everything observed.
|
|
243
|
+
*
|
|
244
|
+
* "Worst" is severity, not exit-code magnitude: any failure beats a
|
|
245
|
+
* clean stop, and among failures the first observed wins, because it
|
|
246
|
+
* is the one that explains the rest. Under `isolate` a process may
|
|
247
|
+
* survive several failures, and the exit code must reflect the worst
|
|
248
|
+
* outcome across the whole run rather than the last one.
|
|
249
|
+
*/
|
|
250
|
+
declare function worstOutcome(observed: readonly LifecycleOutcome[]): LifecycleOutcome;
|
|
251
|
+
/** A parsed `serve` invocation. */
|
|
252
|
+
interface ResolveRequest {
|
|
253
|
+
/**
|
|
254
|
+
* Positional arguments after the `serve` word. Empty is the
|
|
255
|
+
* supervisor form, exactly one the selector form, two or more a
|
|
256
|
+
* usage error.
|
|
257
|
+
*/
|
|
258
|
+
args: readonly string[];
|
|
259
|
+
/**
|
|
260
|
+
* Resolved `services.<name>` block per service. A service with no
|
|
261
|
+
* entry is not configured, and the supervisor form skips it.
|
|
262
|
+
*/
|
|
263
|
+
configs?: Readonly<Record<string, ServiceConfig>>;
|
|
264
|
+
/** The third validation gate. Omitted passes everything. */
|
|
265
|
+
policy?: PolicyGate;
|
|
266
|
+
}
|
|
267
|
+
/** The result of resolving a request against a registry. */
|
|
268
|
+
interface ResolveOutcome {
|
|
269
|
+
/** Identifiers to run, in registration order. Empty when `error` is set. */
|
|
270
|
+
selected: string[];
|
|
271
|
+
/**
|
|
272
|
+
* True when the selector form was used. Under it `selected` holds
|
|
273
|
+
* exactly one name and aggregate enablement was overridden rather
|
|
274
|
+
* than consulted.
|
|
275
|
+
*/
|
|
276
|
+
explicit: boolean;
|
|
277
|
+
/**
|
|
278
|
+
* Configured-but-disabled services the supervisor form passed over.
|
|
279
|
+
* Skipping is not an error and must not affect the exit code.
|
|
280
|
+
*/
|
|
281
|
+
skipped: string[];
|
|
282
|
+
/** The refusal, already carrying its code and exit code. */
|
|
283
|
+
error?: CliError;
|
|
284
|
+
/** The outcome the refusal corresponds to. */
|
|
285
|
+
outcome?: LifecycleOutcome;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Turns a `serve` invocation into a runnable set, applying the
|
|
289
|
+
* hierarchy and the override rule. Pure: nothing is started, nothing
|
|
290
|
+
* binds, nothing is written.
|
|
291
|
+
*
|
|
292
|
+
* Selector form runs the named service **even when
|
|
293
|
+
* `services.<name>.enabled` is false**, provided all three gates pass
|
|
294
|
+
* in order — registration, then configuration, then policy.
|
|
295
|
+
* Enablement is not a gate there: an operator naming a service on the
|
|
296
|
+
* command line has already made the decision the flag exists to
|
|
297
|
+
* automate.
|
|
298
|
+
*
|
|
299
|
+
* Supervisor form runs every service that is both configured and
|
|
300
|
+
* enabled, in registration order, skipping a disabled one silently.
|
|
301
|
+
* Resolving to zero services is a usage error, not a clean exit: a
|
|
302
|
+
* process that exits 0 without listening is indistinguishable from a
|
|
303
|
+
* successful start to systemd or a container runtime.
|
|
304
|
+
*/
|
|
305
|
+
declare function resolve(registry: ServiceRegistry, req: ResolveRequest): ResolveOutcome;
|
|
306
|
+
/**
|
|
307
|
+
* `selected` in topological order over the optional `dependsOn`
|
|
308
|
+
* declarations, ties broken by the order in `selected` (which
|
|
309
|
+
* {@link resolve} returns in registration order).
|
|
310
|
+
*
|
|
311
|
+
* A dependency naming a service outside `selected` is ignored rather
|
|
312
|
+
* than an error: under the selector form exactly one service runs, and
|
|
313
|
+
* its dependencies are the operator's business, not a reason to refuse
|
|
314
|
+
* a deliberate single-service start.
|
|
315
|
+
*
|
|
316
|
+
* A dependency cycle throws, in the same class as a name collision: it
|
|
317
|
+
* is a wiring bug that can only be fixed by editing the registrations,
|
|
318
|
+
* and there is no order the supervisor could pick that would be right.
|
|
319
|
+
*/
|
|
320
|
+
declare function startOrder(registry: ServiceRegistry, selected: readonly string[]): string[];
|
|
321
|
+
/** The 2-segment source.category prefix serve events publish under. */
|
|
322
|
+
declare const DEFAULT_TOPIC_PREFIX = "kit.serve";
|
|
323
|
+
/** Action segments. A bare `ready` does not validate; do not use one. */
|
|
324
|
+
declare const ACTION_STARTED = "started";
|
|
325
|
+
declare const ACTION_READY_REPORTED = "ready_reported";
|
|
326
|
+
declare const ACTION_FAILED = "failed";
|
|
327
|
+
declare const ACTION_STOPPED = "stopped";
|
|
328
|
+
/**
|
|
329
|
+
* Object segments. The service identifier travels in the payload, not
|
|
330
|
+
* the topic, so subscribers are not forced to re-bind when a tool
|
|
331
|
+
* gains a service.
|
|
332
|
+
*/
|
|
333
|
+
declare const OBJECT_SERVICE = "service";
|
|
334
|
+
declare const OBJECT_SUPERVISOR = "supervisor";
|
|
335
|
+
/**
|
|
336
|
+
* The conformant topic set for `prefix`, keyed `<object>.<action>`.
|
|
337
|
+
* These strings are contract: a subscriber is written against them and
|
|
338
|
+
* does not know which language published.
|
|
339
|
+
*/
|
|
340
|
+
declare function defaultTopics(prefix?: string): Record<string, string>;
|
|
341
|
+
/** The body of every serve lifecycle event. */
|
|
342
|
+
interface EventPayload {
|
|
343
|
+
/** Service the event concerns. Absent for supervisor-scoped events. */
|
|
344
|
+
service?: string;
|
|
345
|
+
/** Failure text for a `failed` event. Never in the topic. */
|
|
346
|
+
error?: string;
|
|
347
|
+
/** Why, for events that have a reason. */
|
|
348
|
+
reason?: string;
|
|
349
|
+
/** Milliseconds since the supervisor began the run. */
|
|
350
|
+
elapsed_ms: number;
|
|
351
|
+
/** Where the service accepts work, on `ready_reported` only. */
|
|
352
|
+
address?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* The narrow slice of a bus the supervisor needs. Omitting one means
|
|
356
|
+
* events are not published; the log counterpart still runs, so a tool
|
|
357
|
+
* with no bus still produces an operator-legible startup trace.
|
|
358
|
+
*/
|
|
359
|
+
interface Publisher {
|
|
360
|
+
publish(event: {
|
|
361
|
+
topic: string;
|
|
362
|
+
source: string;
|
|
363
|
+
payload: EventPayload;
|
|
364
|
+
}): void;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* The narrow slice of a structured logger the supervisor needs. It
|
|
368
|
+
* matches the shape `@hop-top/kit/log` returns, so a kit logger
|
|
369
|
+
* satisfies it without an adapter.
|
|
370
|
+
*/
|
|
371
|
+
interface ServeLogger {
|
|
372
|
+
info(msg: string, ...keyvals: unknown[]): void;
|
|
373
|
+
error(msg: string, ...keyvals: unknown[]): void;
|
|
374
|
+
}
|
|
375
|
+
/** What one supervised run produced. */
|
|
376
|
+
interface RunResult {
|
|
377
|
+
/** The worst outcome observed, which is what the process exits on. */
|
|
378
|
+
outcome: LifecycleOutcome;
|
|
379
|
+
/** The rendered failure carrying code and exit code; absent on a clean stop. */
|
|
380
|
+
error?: CliError;
|
|
381
|
+
/** Identifiers whose start was invoked, in invocation order. */
|
|
382
|
+
started: string[];
|
|
383
|
+
/** Identifiers that reported ready, in report order. */
|
|
384
|
+
ready: string[];
|
|
385
|
+
/** Identifier to the error it failed with. */
|
|
386
|
+
failed: Record<string, string>;
|
|
387
|
+
/** The process exit code for this run. */
|
|
388
|
+
exitCode: number;
|
|
389
|
+
}
|
|
390
|
+
/** Options for {@link Supervisor}. */
|
|
391
|
+
interface SupervisorOptions {
|
|
392
|
+
config?: SupervisorConfig;
|
|
393
|
+
publisher?: Publisher;
|
|
394
|
+
logger?: ServeLogger;
|
|
395
|
+
topics?: Record<string, string>;
|
|
396
|
+
eventSource?: string;
|
|
397
|
+
/** Replaces the notion of elapsed time. Tests use it; production does not. */
|
|
398
|
+
now?: () => number;
|
|
399
|
+
/**
|
|
400
|
+
* Aborts the drain. A second signal fires this, so an operator can
|
|
401
|
+
* escalate without reaching for SIGKILL.
|
|
402
|
+
*/
|
|
403
|
+
escalate?: AbortSignal;
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Runs a resolved set of services under one lifecycle: ordered start,
|
|
407
|
+
* per-service readiness, policy-driven reaction to failure, and
|
|
408
|
+
* ordered stop bounded by the configured budgets.
|
|
409
|
+
*
|
|
410
|
+
* A Supervisor holds no module-level state, so two can run
|
|
411
|
+
* concurrently in one process — which is exactly what a test does.
|
|
412
|
+
*/
|
|
413
|
+
declare class Supervisor {
|
|
414
|
+
private readonly registry;
|
|
415
|
+
private readonly failurePolicy;
|
|
416
|
+
private readonly shutdownTimeoutMs;
|
|
417
|
+
private readonly emitter;
|
|
418
|
+
private readonly now;
|
|
419
|
+
private readonly escalate?;
|
|
420
|
+
constructor(registry: ServiceRegistry, opts?: SupervisorOptions);
|
|
421
|
+
/**
|
|
422
|
+
* Starts every service in `selected`, waits for the run to end, and
|
|
423
|
+
* stops everything in reverse start order.
|
|
424
|
+
*
|
|
425
|
+
* The run ends when `signal` aborts (the clean path: a signal, or
|
|
426
|
+
* the caller's own shutdown), when a failure trips the failure
|
|
427
|
+
* policy, or when every started service has returned. Run always
|
|
428
|
+
* performs the ordered stop before returning, so a caller never has
|
|
429
|
+
* to clean up after it.
|
|
430
|
+
*
|
|
431
|
+
* `selected` is normally {@link ResolveOutcome.selected}; run does
|
|
432
|
+
* not re-resolve and does not consult enablement, because the
|
|
433
|
+
* decision the caller already made is the one to honor.
|
|
434
|
+
*/
|
|
435
|
+
run(signal: AbortSignal, selected: readonly string[], configs?: Readonly<Record<string, ServiceConfig>>): Promise<RunResult>;
|
|
436
|
+
/**
|
|
437
|
+
* Starts each service in order, waiting for each to report ready
|
|
438
|
+
* (or fail, or exhaust its budget) before starting the next.
|
|
439
|
+
*
|
|
440
|
+
* Serial start is what makes `dependsOn` mean anything: a dependent
|
|
441
|
+
* must not begin acquiring before its dependency is accepting work.
|
|
442
|
+
* Returns true when a start failure short-circuits the sequence.
|
|
443
|
+
*/
|
|
444
|
+
private startAll;
|
|
445
|
+
/**
|
|
446
|
+
* Blocks until `name` reports ready, fails, or exhausts its
|
|
447
|
+
* readiness budget. A service that has not reported ready within the
|
|
448
|
+
* budget is a start failure.
|
|
449
|
+
*/
|
|
450
|
+
private awaitReady;
|
|
451
|
+
/**
|
|
452
|
+
* Publishes the supervisor-scoped readiness event once every started
|
|
453
|
+
* service is ready.
|
|
454
|
+
*/
|
|
455
|
+
private emitAggregateReady;
|
|
456
|
+
/**
|
|
457
|
+
* Blocks while the services run. Returns when the run signal aborts,
|
|
458
|
+
* when the failure policy trips, or when the last running service
|
|
459
|
+
* has exited.
|
|
460
|
+
*/
|
|
461
|
+
private await_;
|
|
462
|
+
/**
|
|
463
|
+
* Invokes stop in the exact reverse of the order services actually
|
|
464
|
+
* started, one at a time, so a dependent is always fully stopped
|
|
465
|
+
* before its dependency.
|
|
466
|
+
*
|
|
467
|
+
* Each stop is bounded by that service's budget. One that exceeds it
|
|
468
|
+
* is abandoned — logged, emitted as failed, and the supervisor
|
|
469
|
+
* proceeds to the next rather than blocking the whole shutdown on
|
|
470
|
+
* one straggler. Exceeding the total budget ends the sequence with
|
|
471
|
+
* `shutdown-timeout`.
|
|
472
|
+
*/
|
|
473
|
+
private stopAll;
|
|
474
|
+
/** Bounds one stop by its budget and by whatever remains of the total. */
|
|
475
|
+
private stopOne;
|
|
476
|
+
private addrOf;
|
|
477
|
+
/** Assembles the result from everything the run observed. */
|
|
478
|
+
private finish;
|
|
479
|
+
}
|
|
480
|
+
/**
|
|
481
|
+
* Holds the Node event loop open for as long as a run is live.
|
|
482
|
+
*
|
|
483
|
+
* Neither a `process.on(signal)` listener nor an `AbortSignal` listener
|
|
484
|
+
* refs the loop: a supervisor whose services are all parked on their
|
|
485
|
+
* abort signal has no referenced handle, and Node exits 0 the moment
|
|
486
|
+
* the synchronous part of `run` yields. That is the failure the
|
|
487
|
+
* contract's zero-services rule exists to prevent, arriving by another
|
|
488
|
+
* route — a process that exits 0 without listening is
|
|
489
|
+
* indistinguishable from a successful start to systemd or a container
|
|
490
|
+
* runtime.
|
|
491
|
+
*
|
|
492
|
+
* A long referenced interval is the cheapest handle that survives every
|
|
493
|
+
* platform; it is cleared the moment the run ends, so it never delays
|
|
494
|
+
* an exit.
|
|
495
|
+
*/
|
|
496
|
+
declare class LoopKeepAlive {
|
|
497
|
+
private handle?;
|
|
498
|
+
hold(): void;
|
|
499
|
+
release(): void;
|
|
500
|
+
/**
|
|
501
|
+
* Whether a referenced handle is currently held.
|
|
502
|
+
*
|
|
503
|
+
* Node's `process._getActiveHandles()` does not report timers, so
|
|
504
|
+
* this is the only honest way to observe the property that matters.
|
|
505
|
+
*/
|
|
506
|
+
get held(): boolean;
|
|
507
|
+
}
|
|
508
|
+
/** The signals the supervisor listens for. SIGKILL is not catchable. */
|
|
509
|
+
declare const SHUTDOWN_SIGNALS: readonly NodeJS.Signals[];
|
|
510
|
+
/**
|
|
511
|
+
* A signal handler pair: `signal` aborts on the first SIGINT/SIGTERM,
|
|
512
|
+
* `escalate` on a second of either kind.
|
|
513
|
+
*
|
|
514
|
+
* The first signal begins graceful shutdown; a second aborts the
|
|
515
|
+
* drain, so an operator can escalate without reaching for SIGKILL.
|
|
516
|
+
* `stop` removes the process listeners and must be called, or the
|
|
517
|
+
* handlers outlive the run.
|
|
518
|
+
*/
|
|
519
|
+
declare function signalController(): {
|
|
520
|
+
signal: AbortSignal;
|
|
521
|
+
escalate: AbortSignal;
|
|
522
|
+
stop: () => void;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Applies `--enable` / `--disable` on top of the resolved
|
|
526
|
+
* `services.<name>` blocks, returning a new map.
|
|
527
|
+
*
|
|
528
|
+
* An unconfigured service becomes configured the moment an operator
|
|
529
|
+
* names it in `--enable`: the flag is the aggregate equivalent of the
|
|
530
|
+
* selector's override rule. `--disable` on a configured service clears
|
|
531
|
+
* its enablement so the supervisor form skips it silently; on an
|
|
532
|
+
* unconfigured service it is a no-op. Enable wins over disable for the
|
|
533
|
+
* same name — the affirmative act is the more specific one.
|
|
534
|
+
*/
|
|
535
|
+
declare function applyEnableDisable(configs: Readonly<Record<string, ServiceConfig>>, enable: readonly string[], disable: readonly string[]): Record<string, ServiceConfig>;
|
|
536
|
+
/**
|
|
537
|
+
* Applies `--ready-timeout` / `--stop-timeout` across every resolved
|
|
538
|
+
* service, returning a new map. The flags map onto the per-service
|
|
539
|
+
* keys, so a flag set on the supervisor form applies the same budget
|
|
540
|
+
* to every member of the set — which is what an operator tuning a
|
|
541
|
+
* whole process, rather than one service, is asking for.
|
|
542
|
+
*/
|
|
543
|
+
declare function applyTimeoutOverrides(configs: Readonly<Record<string, ServiceConfig>>, readyTimeoutMs?: number, stopTimeoutMs?: number): Record<string, ServiceConfig>;
|
|
544
|
+
/**
|
|
545
|
+
* Parses a duration flag value into milliseconds, or `null` when it
|
|
546
|
+
* does not parse. Accepts Go's value+unit sequence (`30s`, `1m30s`,
|
|
547
|
+
* `500ms`) and a bare number, read as seconds the way the config keys
|
|
548
|
+
* are. The spelling accepted here is not contract; the flag names are.
|
|
549
|
+
*/
|
|
550
|
+
declare function parseDurationMs(raw: string): number | null;
|
|
551
|
+
/** Options for {@link registerServe}. */
|
|
552
|
+
interface RegisterServeOptions {
|
|
553
|
+
/** The seam services were registered into. */
|
|
554
|
+
registry: ServiceRegistry;
|
|
555
|
+
/** Resolved `services.<name>` blocks, keyed by identifier. */
|
|
556
|
+
configs?: Readonly<Record<string, ServiceConfig>>;
|
|
557
|
+
/** The supervisor-scoped half of the `services` block. */
|
|
558
|
+
config?: SupervisorConfig;
|
|
559
|
+
/** The third validation gate. */
|
|
560
|
+
policy?: PolicyGate;
|
|
561
|
+
publisher?: Publisher;
|
|
562
|
+
logger?: ServeLogger;
|
|
563
|
+
/** Where `--list` writes. Defaults to `process.stdout`. */
|
|
564
|
+
stdout?: {
|
|
565
|
+
write(s: string): unknown;
|
|
566
|
+
};
|
|
567
|
+
/**
|
|
568
|
+
* Called with the run's exit code instead of exiting the process.
|
|
569
|
+
* Tests supply one; production omits it and the command sets
|
|
570
|
+
* `process.exitCode`.
|
|
571
|
+
*/
|
|
572
|
+
onExit?: (code: number, error?: CliError) => void;
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Mounts the kit-owned `serve` command on `program`.
|
|
576
|
+
*
|
|
577
|
+
* With no positional argument it is the supervisor over every
|
|
578
|
+
* configured and enabled service; with exactly one it is the selector,
|
|
579
|
+
* which overrides aggregate enablement. Two or more is a usage error
|
|
580
|
+
* at exit 2 — the arity refusal is owned here rather than left to
|
|
581
|
+
* commander, whose own excess-argument error exits 1.
|
|
582
|
+
*
|
|
583
|
+
* The inspection form is the `--list` flag, not a `list` child:
|
|
584
|
+
* `list` is reserved selector vocabulary, so a `serve list` child
|
|
585
|
+
* would be indistinguishable from the selector form naming a service
|
|
586
|
+
* called `list`.
|
|
587
|
+
*/
|
|
588
|
+
declare function registerServe(program: Command, opts: RegisterServeOptions): Command;
|
|
589
|
+
|
|
590
|
+
declare const serve_ACTION_FAILED: typeof ACTION_FAILED;
|
|
591
|
+
declare const serve_ACTION_READY_REPORTED: typeof ACTION_READY_REPORTED;
|
|
592
|
+
declare const serve_ACTION_STARTED: typeof ACTION_STARTED;
|
|
593
|
+
declare const serve_ACTION_STOPPED: typeof ACTION_STOPPED;
|
|
594
|
+
declare const serve_CODE_TRANSIENT: typeof CODE_TRANSIENT;
|
|
595
|
+
declare const serve_DEFAULT_FAILURE_POLICY: typeof DEFAULT_FAILURE_POLICY;
|
|
596
|
+
declare const serve_DEFAULT_READY_TIMEOUT_MS: typeof DEFAULT_READY_TIMEOUT_MS;
|
|
597
|
+
declare const serve_DEFAULT_SHUTDOWN_TIMEOUT_MS: typeof DEFAULT_SHUTDOWN_TIMEOUT_MS;
|
|
598
|
+
declare const serve_DEFAULT_STOP_TIMEOUT_MS: typeof DEFAULT_STOP_TIMEOUT_MS;
|
|
599
|
+
declare const serve_DEFAULT_TOPIC_PREFIX: typeof DEFAULT_TOPIC_PREFIX;
|
|
600
|
+
type serve_EventPayload = EventPayload;
|
|
601
|
+
type serve_FailurePolicy = FailurePolicy;
|
|
602
|
+
type serve_LifecycleOutcome = LifecycleOutcome;
|
|
603
|
+
type serve_LoopKeepAlive = LoopKeepAlive;
|
|
604
|
+
declare const serve_LoopKeepAlive: typeof LoopKeepAlive;
|
|
605
|
+
declare const serve_NAME_PATTERN: typeof NAME_PATTERN;
|
|
606
|
+
declare const serve_OBJECT_SERVICE: typeof OBJECT_SERVICE;
|
|
607
|
+
declare const serve_OBJECT_SUPERVISOR: typeof OBJECT_SUPERVISOR;
|
|
608
|
+
type serve_PolicyGate = PolicyGate;
|
|
609
|
+
type serve_Publisher = Publisher;
|
|
610
|
+
declare const serve_RESERVED_NAMES: typeof RESERVED_NAMES;
|
|
611
|
+
type serve_RegisterServeOptions = RegisterServeOptions;
|
|
612
|
+
type serve_ResolveOutcome = ResolveOutcome;
|
|
613
|
+
type serve_ResolveRequest = ResolveRequest;
|
|
614
|
+
type serve_RunResult = RunResult;
|
|
615
|
+
declare const serve_SHUTDOWN_SIGNALS: typeof SHUTDOWN_SIGNALS;
|
|
616
|
+
type serve_ServeLogger = ServeLogger;
|
|
617
|
+
type serve_Service = Service;
|
|
618
|
+
type serve_ServiceConfig = ServiceConfig;
|
|
619
|
+
type serve_ServiceRegistrationError = ServiceRegistrationError;
|
|
620
|
+
declare const serve_ServiceRegistrationError: typeof ServiceRegistrationError;
|
|
621
|
+
type serve_ServiceRegistry = ServiceRegistry;
|
|
622
|
+
declare const serve_ServiceRegistry: typeof ServiceRegistry;
|
|
623
|
+
type serve_Supervisor = Supervisor;
|
|
624
|
+
declare const serve_Supervisor: typeof Supervisor;
|
|
625
|
+
type serve_SupervisorConfig = SupervisorConfig;
|
|
626
|
+
type serve_SupervisorOptions = SupervisorOptions;
|
|
627
|
+
declare const serve_applyEnableDisable: typeof applyEnableDisable;
|
|
628
|
+
declare const serve_applyTimeoutOverrides: typeof applyTimeoutOverrides;
|
|
629
|
+
declare const serve_codeFor: typeof codeFor;
|
|
630
|
+
declare const serve_defaultTopics: typeof defaultTopics;
|
|
631
|
+
declare const serve_exitCodeFor: typeof exitCodeFor;
|
|
632
|
+
declare const serve_isFailure: typeof isFailure;
|
|
633
|
+
declare const serve_isFailurePolicy: typeof isFailurePolicy;
|
|
634
|
+
declare const serve_isReservedName: typeof isReservedName;
|
|
635
|
+
declare const serve_parseDurationMs: typeof parseDurationMs;
|
|
636
|
+
declare const serve_registerServe: typeof registerServe;
|
|
637
|
+
declare const serve_resolve: typeof resolve;
|
|
638
|
+
declare const serve_signalController: typeof signalController;
|
|
639
|
+
declare const serve_startOrder: typeof startOrder;
|
|
640
|
+
declare const serve_validateName: typeof validateName;
|
|
641
|
+
declare const serve_worstOutcome: typeof worstOutcome;
|
|
642
|
+
declare namespace serve {
|
|
643
|
+
export { serve_ACTION_FAILED as ACTION_FAILED, serve_ACTION_READY_REPORTED as ACTION_READY_REPORTED, serve_ACTION_STARTED as ACTION_STARTED, serve_ACTION_STOPPED as ACTION_STOPPED, serve_CODE_TRANSIENT as CODE_TRANSIENT, serve_DEFAULT_FAILURE_POLICY as DEFAULT_FAILURE_POLICY, serve_DEFAULT_READY_TIMEOUT_MS as DEFAULT_READY_TIMEOUT_MS, serve_DEFAULT_SHUTDOWN_TIMEOUT_MS as DEFAULT_SHUTDOWN_TIMEOUT_MS, serve_DEFAULT_STOP_TIMEOUT_MS as DEFAULT_STOP_TIMEOUT_MS, serve_DEFAULT_TOPIC_PREFIX as DEFAULT_TOPIC_PREFIX, type serve_EventPayload as EventPayload, type serve_FailurePolicy as FailurePolicy, type serve_LifecycleOutcome as LifecycleOutcome, serve_LoopKeepAlive as LoopKeepAlive, serve_NAME_PATTERN as NAME_PATTERN, serve_OBJECT_SERVICE as OBJECT_SERVICE, serve_OBJECT_SUPERVISOR as OBJECT_SUPERVISOR, type serve_PolicyGate as PolicyGate, type serve_Publisher as Publisher, serve_RESERVED_NAMES as RESERVED_NAMES, type serve_RegisterServeOptions as RegisterServeOptions, type serve_ResolveOutcome as ResolveOutcome, type serve_ResolveRequest as ResolveRequest, type serve_RunResult as RunResult, serve_SHUTDOWN_SIGNALS as SHUTDOWN_SIGNALS, type serve_ServeLogger as ServeLogger, type serve_Service as Service, type serve_ServiceConfig as ServiceConfig, serve_ServiceRegistrationError as ServiceRegistrationError, serve_ServiceRegistry as ServiceRegistry, serve_Supervisor as Supervisor, type serve_SupervisorConfig as SupervisorConfig, type serve_SupervisorOptions as SupervisorOptions, serve_applyEnableDisable as applyEnableDisable, serve_applyTimeoutOverrides as applyTimeoutOverrides, serve_codeFor as codeFor, serve_defaultTopics as defaultTopics, serve_exitCodeFor as exitCodeFor, serve_isFailure as isFailure, serve_isFailurePolicy as isFailurePolicy, serve_isReservedName as isReservedName, serve_parseDurationMs as parseDurationMs, serve_registerServe as registerServe, serve_resolve as resolve, serve_signalController as signalController, serve_startOrder as startOrder, serve_validateName as validateName, serve_worstOutcome as worstOutcome };
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
export { ACTION_FAILED as A, defaultTopics as B, exitCodeFor as C, DEFAULT_FAILURE_POLICY as D, type EventPayload as E, type FailurePolicy as F, isFailure as G, isFailurePolicy as H, isReservedName as I, parseDurationMs as J, registerServe as K, type LifecycleOutcome as L, resolve as M, NAME_PATTERN as N, OBJECT_SERVICE as O, type PolicyGate as P, signalController as Q, RESERVED_NAMES as R, SHUTDOWN_SIGNALS as S, startOrder as T, validateName as U, worstOutcome as V, ACTION_READY_REPORTED as a, ACTION_STARTED as b, ACTION_STOPPED as c, DEFAULT_READY_TIMEOUT_MS as d, DEFAULT_SHUTDOWN_TIMEOUT_MS as e, DEFAULT_STOP_TIMEOUT_MS as f, DEFAULT_TOPIC_PREFIX as g, LoopKeepAlive as h, OBJECT_SUPERVISOR as i, type Publisher as j, type RegisterServeOptions as k, type ResolveOutcome as l, type ResolveRequest as m, type RunResult as n, type ServeLogger as o, type Service as p, type ServiceConfig as q, ServiceRegistrationError as r, serve as s, ServiceRegistry as t, Supervisor as u, type SupervisorConfig as v, type SupervisorOptions as w, applyEnableDisable as x, applyTimeoutOverrides as y, codeFor as z };
|
package/dist/serve.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import 'commander';
|
|
2
|
+
export { a as CODE_TRANSIENT } from './error-Do8Qji43.js';
|
|
3
|
+
export { A as ACTION_FAILED, a as ACTION_READY_REPORTED, b as ACTION_STARTED, c as ACTION_STOPPED, D as DEFAULT_FAILURE_POLICY, d as DEFAULT_READY_TIMEOUT_MS, e as DEFAULT_SHUTDOWN_TIMEOUT_MS, f as DEFAULT_STOP_TIMEOUT_MS, g as DEFAULT_TOPIC_PREFIX, E as EventPayload, F as FailurePolicy, L as LifecycleOutcome, h as LoopKeepAlive, N as NAME_PATTERN, O as OBJECT_SERVICE, i as OBJECT_SUPERVISOR, P as PolicyGate, j as Publisher, R as RESERVED_NAMES, k as RegisterServeOptions, l as ResolveOutcome, m as ResolveRequest, n as RunResult, S as SHUTDOWN_SIGNALS, o as ServeLogger, p as Service, q as ServiceConfig, r as ServiceRegistrationError, t as ServiceRegistry, u as Supervisor, v as SupervisorConfig, w as SupervisorOptions, x as applyEnableDisable, y as applyTimeoutOverrides, z as codeFor, B as defaultTopics, C as exitCodeFor, G as isFailure, H as isFailurePolicy, I as isReservedName, J as parseDurationMs, K as registerServe, M as resolve, Q as signalController, T as startOrder, U as validateName, V as worstOutcome } from './serve-D8yWMrTc.js';
|