@loomcli/core 0.1.1 → 0.3.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.
Files changed (57) hide show
  1. package/dist/application.d.ts +73 -28
  2. package/dist/application.js +334 -99
  3. package/dist/chain.d.ts +68 -0
  4. package/dist/chain.js +372 -0
  5. package/dist/command.d.ts +201 -46
  6. package/dist/command.js +713 -57
  7. package/dist/environment.d.ts +22 -0
  8. package/dist/environment.js +1 -0
  9. package/dist/errors.d.ts +31 -51
  10. package/dist/errors.js +58 -90
  11. package/dist/extension.d.ts +99 -0
  12. package/dist/extension.js +330 -0
  13. package/dist/facts.d.ts +39 -0
  14. package/dist/facts.js +95 -0
  15. package/dist/globals.d.ts +49 -28
  16. package/dist/globals.js +104 -58
  17. package/dist/glyphs.generated.d.ts +464 -0
  18. package/dist/glyphs.generated.js +491 -0
  19. package/dist/host.js +2 -1
  20. package/dist/index.d.ts +21 -6
  21. package/dist/index.js +7 -2
  22. package/dist/inspect.d.ts +69 -12
  23. package/dist/inspect.js +83 -26
  24. package/dist/lanes.d.ts +26 -0
  25. package/dist/lanes.js +45 -0
  26. package/dist/options.d.ts +7 -0
  27. package/dist/options.js +9 -0
  28. package/dist/output.d.ts +93 -15
  29. package/dist/output.js +307 -34
  30. package/dist/plugin.d.ts +132 -0
  31. package/dist/plugin.js +278 -0
  32. package/dist/rendering.d.ts +21 -0
  33. package/dist/rendering.js +72 -0
  34. package/dist/sequence.d.ts +41 -0
  35. package/dist/sequence.js +225 -0
  36. package/dist/signals.d.ts +52 -0
  37. package/dist/signals.js +85 -0
  38. package/dist/style-ansi.d.ts +13 -0
  39. package/dist/style-ansi.js +306 -0
  40. package/dist/style-layout.d.ts +29 -0
  41. package/dist/style-layout.js +228 -0
  42. package/dist/style-resolve.d.ts +6 -0
  43. package/dist/style-resolve.js +26 -0
  44. package/dist/style-state.d.ts +14 -0
  45. package/dist/style-state.js +179 -0
  46. package/dist/style-wire.d.ts +31 -0
  47. package/dist/style-wire.js +201 -0
  48. package/dist/style.d.ts +86 -0
  49. package/dist/style.js +201 -0
  50. package/dist/theme.d.ts +3 -0
  51. package/dist/theme.js +22 -0
  52. package/dist/types.d.ts +222 -26
  53. package/dist/validation.d.ts +12 -3
  54. package/dist/validation.js +34 -17
  55. package/dist/view.d.ts +180 -0
  56. package/dist/view.js +307 -0
  57. package/package.json +2 -1
package/dist/command.d.ts CHANGED
@@ -1,6 +1,11 @@
1
- import type { BuiltGlobals, GlobalOptions } from './globals.js';
1
+ import type { RegisteredGlobals } from './environment.js';
2
+ import type { DescriptorRegistry, ExtensionRecords, ExtensionValue } from './extension.js';
3
+ import type { BuiltGlobals, GlobalsState } from './globals.js';
2
4
  import { compileOptions } from './options.js';
3
- import type { Action, ArgumentConfig, ArgumentValue, declaredTypes, DeclaredTypes, DefaultConstraint, GlobalNameConstraint, Host, MultipleConstraint, NameConstraint, OptionConfig, OptionValue, Out, ValidateOmittedConstraint } from './types.js';
5
+ import type { OptionValues } from './options.js';
6
+ import type { BuiltPlugin, PluginBuild } from './plugin.js';
7
+ import type { ContextualStyle } from './style.js';
8
+ import type { Action, ActionChannel, ArgumentConfig, ArgumentValue, declaredTypes, DeclaredResult, DeclaredTypes, DefaultConstraint, GlobalNameConstraint, Host, MultipleConstraint, NameConstraint, OpenResult, OptionConfig, OptionValue, Out, Request, ResultBinding, ResultViews, ResultViewsOf, RowViews, ValidateOmittedConstraint } from './types.js';
4
9
  import type { ArgumentInput, DefaultValues, InputDeclaration, OptionInput, ValidatedInputs } from './validation.js';
5
10
  /** One positional slot: the declaration it fills and whether it takes the remaining tokens. */
6
11
  export interface ArgumentSlot {
@@ -9,13 +14,16 @@ export interface ArgumentSlot {
9
14
  variadic: boolean;
10
15
  }
11
16
  export interface DispatchInput {
17
+ style: ContextualStyle;
12
18
  host: Host;
13
- out: Out;
19
+ /** The action's channel, whose `results` accepts whatever the routed declaration named. */
20
+ out: Out<OpenResult>;
14
21
  passthrough: string[];
22
+ signal: AbortSignal;
15
23
  values: ValidatedInputs;
16
24
  }
17
25
  /**
18
- * One child a bare token reaches, under its canonical name or one of its hidden aliases.
26
+ * One child a bare token reaches, under its canonical name or one of its aliases.
19
27
  * `name` repeats the key `children` holds, because `BuiltCommand.name` is `string | null` for the
20
28
  * root and the routed path a child extends holds strings alone.
21
29
  */
@@ -26,39 +34,53 @@ export interface RoutedChild {
26
34
  /**
27
35
  * A group registers no action, so its `dispatch` is `undefined` and selection rejects it.
28
36
  * `children` is keyed by canonical name, so every candidate list and every walk of the graph reads
29
- * it, and `routes` adds the hidden aliases, so routing alone resolves them.
37
+ * it, and `routes` adds the aliases, so routing alone resolves them.
30
38
  */
31
39
  export interface BuiltCommand {
32
40
  aliases: readonly string[];
33
41
  arguments: readonly ArgumentSlot[];
34
42
  children: ReadonlyMap<string, BuiltCommand>;
43
+ deprecated: string | undefined;
44
+ description: string | undefined;
35
45
  dispatch: ((input: DispatchInput) => unknown) | undefined;
46
+ extensions: Readonly<Record<string, unknown>>;
47
+ hidden: boolean;
36
48
  inputs: readonly InputDeclaration[];
37
49
  name: string | null;
38
50
  options: ReturnType<typeof compileOptions>;
51
+ /** The result the Command declares, or nothing where it declares none. */
52
+ /** The built declaration is the shape the write site reads, so the channel carries it. */
53
+ result: DeclaredResult | undefined;
39
54
  routes: ReadonlyMap<string, RoutedChild>;
40
55
  }
41
56
  /** Phantom key. It marks a Command value, so only a Command can be attached as a child. */
42
57
  export declare const commandValue: unique symbol;
43
58
  /**
44
- * Every authoring call a Command can publish. A Command's type state is a subset of these names,
59
+ * The input, alias, child, and action calls a Command can publish. Its type state is a subset,
45
60
  * and each call removes the names it invalidates. A Command attaches children at any depth, so
46
61
  * `command()` belongs to every Command and to the unnamed root alike.
47
62
  */
48
- export type CommandMethod = 'action' | 'alias' | 'argument' | 'command' | 'option';
63
+ export type CommandMethod = 'action' | 'alias' | 'argument' | 'command' | 'option' | 'result' | 'rows';
49
64
  /** One Command declares arguments or attaches children, so the first call removes the other. */
50
65
  export type AfterArgument<State> = Exclude<State, 'command'>;
51
66
  /** The same rule read from the other side. */
52
67
  export type AfterCommand<State> = Exclude<State, 'argument'>;
53
- /** The action is the last declaration call, so no declaration call survives it. */
68
+ /** One Command declares one result, so either call removes both. */
69
+ export type AfterResult<State> = Exclude<State, 'result' | 'rows'>;
70
+ /** Registering the action closes input, alias, child, and further action declarations. */
54
71
  export type AfterAction = never;
55
- /** A declaration made after the action, kept in authoring order so build reports the first. */
72
+ /** A declaration made after its authoring phase closed; build reports the first in call order. */
56
73
  type LateDeclaration = {
57
74
  alias: string;
58
75
  kind: 'alias';
76
+ } | {
77
+ name: string;
78
+ kind: 'global';
59
79
  } | {
60
80
  child: object;
61
81
  kind: 'child';
82
+ } | {
83
+ kind: 'result';
62
84
  } | {
63
85
  input: InputDeclaration;
64
86
  kind: 'input';
@@ -68,8 +90,8 @@ type LateDeclaration = {
68
90
  * which the types reject and a JavaScript author can still write, reports as the call it is.
69
91
  */
70
92
  type AliasDeclaration = readonly string[];
71
- /** The attachable shape of a Command, without its inferred declaration types. */
72
- interface AttachedCommand {
93
+ /** The private handle one graph node is built through, without its inferred declaration types. */
94
+ interface CommandNodeHandle {
73
95
  readonly name: string | null;
74
96
  build(context: BuildContext): BuiltCommand;
75
97
  }
@@ -81,63 +103,149 @@ interface AttachedCommand {
81
103
  * owner is the parent whose attachment the walk meets first.
82
104
  */
83
105
  interface BuildContext {
106
+ descriptors: DescriptorRegistry;
107
+ extensions: ExtensionRecords;
84
108
  globals: BuiltGlobals;
85
- owners: Map<AttachedCommand, string | null>;
109
+ owners: Map<CommandNodeHandle, string | null>;
110
+ /** The route from the root to the Command being built, which a lifecycle hook reads. */
111
+ path: readonly string[];
112
+ /** The installed plugins in installation order, whose hooks run over every Command. */
113
+ plugins: readonly BuiltPlugin[];
86
114
  }
87
115
  /**
88
116
  * Everything one Command declaration holds. The transitions below copy it with fields replaced, and
89
117
  * the Command and Application builders share them, so one declaration call has one implementation.
90
- * Absent globals stay `undefined`, so every declaration without globals agrees on identity.
91
118
  */
119
+ /**
120
+ * One call of the results lane, in the order it was made. A `result()` or `rows()` call declares
121
+ * the unit, and a `views()` call reshapes the views of whichever declaration it follows.
122
+ * Each record arrives unexamined, because build owns every rule the lane carries.
123
+ */
124
+ export type ResultCall = {
125
+ kind: 'value' | 'rows';
126
+ views: unknown;
127
+ } | {
128
+ default: unknown;
129
+ kind: 'views';
130
+ views: unknown;
131
+ };
92
132
  export interface CommandState<Args, Options, Globals> {
93
- actions: readonly Action<Args, Globals & Options>[];
133
+ /**
134
+ * The registered actions, with the declared result erased. An action is stored under the widest
135
+ * result, so a handler typed from its own declaration stores here and the channel that carries
136
+ * the result is built for it at dispatch.
137
+ */
138
+ actions: readonly Action<Args, Globals & Options, OpenResult>[];
94
139
  aliases: readonly AliasDeclaration[];
95
140
  bind: (values: ValidatedInputs) => {
96
141
  args: Args;
97
142
  options: Options;
98
143
  };
99
144
  children: readonly object[];
100
- globals: GlobalOptions<Globals> | undefined;
145
+ deprecated: unknown;
146
+ description: unknown;
147
+ extensions: readonly unknown[];
148
+ hidden: unknown;
101
149
  inputs: readonly InputDeclaration[];
102
150
  late: readonly LateDeclaration[];
103
151
  name: string | null;
152
+ options: unknown;
153
+ results: readonly ResultCall[];
104
154
  }
105
- /** The state every declaration starts from. The unnamed root and each named Command share it. */
106
- export declare function freshState<Globals>(name: string | null, globals: GlobalOptions<Globals> | undefined): CommandState<{}, {}, Globals>;
155
+ /**
156
+ * The state every declaration starts from. The unnamed root and each named Command share it.
157
+ * The declaration values arrive captured, because a later change to the options object the author
158
+ * passed changes nothing the declaration holds.
159
+ */
160
+ export declare function freshState<Globals>(declaration: {
161
+ deprecated: unknown;
162
+ description: unknown;
163
+ extensions: unknown;
164
+ hidden: unknown;
165
+ name: string | null;
166
+ options: unknown;
167
+ }): CommandState<{}, {}, Globals>;
107
168
  /** The declared value joins `args` under its literal name, typed by its own config. */
108
169
  export declare function declareArgument<Args, Options, Globals, Name extends string, Config extends ArgumentConfig>(state: CommandState<Args, Options, Globals>, input: ArgumentInput<Name, Config>): CommandState<Args & Record<Name, ArgumentValue<Config>>, Options, Globals>;
109
170
  /** The declared value joins `options` under its literal name, typed by its own config. */
110
171
  export declare function declareOption<Args, Options, Globals, Name extends string, Config extends OptionConfig>(state: CommandState<Args, Options, Globals>, input: OptionInput<Name, Config>): CommandState<Args, Options & Record<Name, OptionValue<Config>>, Globals>;
172
+ /** Globals close when composition starts; retain late calls for the shared build-order check. */
173
+ export declare function recordGlobalOption<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, name: string): CommandState<Args, Options, Globals>;
111
174
  /** One call's names stay one group, so the empty call the types reject still reports as one. */
112
175
  export declare function declareAlias<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, names: AliasDeclaration): CommandState<Args, Options, Globals>;
113
- export declare function declareAction<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, handler: Action<Args, Globals & Options>): CommandState<Args, Options, Globals>;
176
+ /** Extension layers remain open after inputs and the action have been fixed. */
177
+ export declare function declareExtensions<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, values: readonly ExtensionValue<'command'>[]): CommandState<Args, Options, Globals>;
178
+ /**
179
+ * The handler is typed against the result its own declaration carries, and the state holds one
180
+ * list for every declaration, so the context each handler receives is read back at the call.
181
+ */
182
+ export declare function declareAction<Args, Options, Globals, Result>(state: CommandState<Args, Options, Globals>, handler: Action<Args, Globals & Options, Result>): CommandState<Args, Options, Globals>;
183
+ /** The result declaration, which closes both result calls and reports lateness like the rest. */
184
+ export declare function declareResult<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, kind: 'value' | 'rows', declaration: unknown): CommandState<Args, Options, Globals>;
185
+ /** A `views()` call reshapes views and closes nothing, so it is never a late declaration. */
186
+ export declare function declareResultViews<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, replacements: unknown, options: unknown): CommandState<Args, Options, Globals>;
114
187
  /** Attaching is a declaration call too, so the receiver keeps the children it already had. */
115
188
  export declare function attachChild<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, child: object): CommandState<Args, Options, Globals>;
116
189
  /** Validates one declaration against the shared globals table and compiles it for dispatch. */
117
190
  export declare function buildCommand<Args, Options, Globals>(state: CommandState<Args, Options, Globals>, context: BuildContext): BuiltCommand;
118
- /** The globals table and the owners record each compile once per invocation and the whole graph shares them. */
119
- export declare function buildGraph<Args, Options, Globals>(root: CommandState<Args, Options, Globals>): {
191
+ /** One built graph: the shared globals table, the root Command, and the facts each node carries. */
192
+ export interface BuiltGraph {
193
+ extensions: ExtensionRecords;
120
194
  globals: BuiltGlobals;
121
195
  root: BuiltCommand;
122
- };
123
- export declare class CommandBuilder<Args, Options, Globals, State extends CommandMethod = CommandMethod> {
196
+ }
197
+ /** The globals table and the owners record each compile once per invocation and the whole graph shares them. */
198
+ export declare function buildGraph<Args, Options, Globals>(root: CommandState<Args, Options, Globals>, globals: GlobalsState<Globals>, install: PluginBuild & {
199
+ plugins: readonly BuiltPlugin[];
200
+ }): BuiltGraph;
201
+ export declare class CommandBuilder<Args, Options, Globals, State extends CommandMethod = CommandMethod, Result = unknown> {
124
202
  #private;
125
203
  readonly [commandValue]: true;
126
- readonly [declaredTypes]: DeclaredTypes<Args, Options, Globals>;
204
+ readonly [declaredTypes]: DeclaredTypes<Args, Options, Globals, Result>;
127
205
  constructor(state: CommandState<Args, Options, Globals>);
128
206
  get name(): string | null;
129
- argument<const Name extends string, const Config extends ArgumentConfig>(name: Name, config: Config & NameConstraint<Name> & NoInfer<DefaultConstraint<Config>> & NoInfer<ValidateOmittedConstraint<Config>>): Command<Args & Record<Name, ArgumentValue<Config>>, Options, Globals, AfterArgument<State>>;
130
- option<const Name extends string, const Config extends OptionConfig>(name: Name, config: Config & NameConstraint<Name> & GlobalNameConstraint<Name, Globals> & NoInfer<DefaultConstraint<Config>> & NoInfer<MultipleConstraint<Config>> & NoInfer<ValidateOmittedConstraint<Config>>): Command<Args, Options & Record<Name, OptionValue<Config>>, Globals, State>;
207
+ argument<const Name extends string, const Config extends ArgumentConfig>(name: Name, config: Config & NameConstraint<Name> & NoInfer<DefaultConstraint<Config>> & NoInfer<ValidateOmittedConstraint<Config>>): Command<Args & Record<Name, ArgumentValue<Config>>, Options, Globals, AfterArgument<State>, Result>;
208
+ option<const Name extends string, const Config extends OptionConfig>(name: Name, config: Config & NameConstraint<Name> & GlobalNameConstraint<Name, Globals> & NoInfer<DefaultConstraint<Config>> & NoInfer<MultipleConstraint<Config>> & NoInfer<ValidateOmittedConstraint<Config>>): Command<Args, Options & Record<Name, OptionValue<Config>>, Globals, State, Result>;
131
209
  /**
132
- * Hidden aliases are other bare tokens that route to this Command. They invalidate no call, and
133
- * the tuple rest parameter rejects a call that names none.
210
+ * Aliases are other bare tokens that route to this Command. They invalidate no call, and the
211
+ * tuple rest parameter rejects a call that names none.
134
212
  */
135
- alias(...names: [string, ...string[]]): Command<Args, Options, Globals, State>;
213
+ alias(...names: [string, ...string[]]): Command<Args, Options, Globals, State, Result>;
136
214
  /** A child arrives in any type state, because its own action is the call that finished it. */
137
- command(child: Command<unknown, unknown, Globals>): Command<Args, Options, Globals, AfterCommand<State>>;
138
- /** The action is the last declaration call, so the value it returns publishes `AfterAction`. */
139
- action(handler: Action<Args, Globals & Options>): Command<Args, Options, Globals>;
215
+ command<const Child extends Command<unknown, unknown, Globals>>(child: Child & NoInfer<AttachmentConstraint<Globals, Child>>): Command<Args, Options, Globals, AfterCommand<State>, Result>;
216
+ /**
217
+ * The value this Command produces for its consumer. The type argument is stated by the author,
218
+ * so the views record states no type of its own and an omitted argument names none either.
219
+ */
220
+ result<Value>(declaration: {
221
+ views: ResultViews<NoInfer<Value>>;
222
+ }): Command<Args, Options, Globals, AfterResult<State>, {
223
+ kind: 'value';
224
+ value: Value;
225
+ }>;
226
+ /** The same declaration over a sequence, whose type argument is one row. */
227
+ rows<Row>(declaration: {
228
+ views: RowViews<NoInfer<Row>>;
229
+ }): Command<Args, Options, Globals, AfterResult<State>, {
230
+ kind: 'rows';
231
+ row: Row;
232
+ }>;
233
+ /**
234
+ * Views after the fact. It merges by key, so an existing name is replaced in place and a new one
235
+ * is appended, and `default` names the key core renders when nothing selects another.
236
+ */
237
+ views(replacements: ResultViewsOf<Result>, options?: {
238
+ default?: string;
239
+ }): Command<Args, Options, Globals, State, Result>;
240
+ /** The action closes input authoring; `extend()` remains outside this state transition. */
241
+ action(handler: Action<Args, Globals & Options, Result>): Command<Args, Options, Globals, AfterAction, Result>;
242
+ extend(...values: readonly ExtensionValue<'command'>[]): Command<Args, Options, Globals, State, Result>;
140
243
  build(context: BuildContext): BuiltCommand;
244
+ /**
245
+ * The same runtime value in the state the calling method's return type names. Each call states
246
+ * its own transition, and the declared result travels with it unless the call replaces it.
247
+ */
248
+ private derive;
141
249
  }
142
250
  /**
143
251
  * The authoring surface of a Command in one type state. Every call returns a new declaration value,
@@ -146,12 +254,31 @@ export declare class CommandBuilder<Args, Options, Globals, State extends Comman
146
254
  * calls a value still offers. It defaults to the state after `action()`, which publishes the fewest
147
255
  * calls, so `Command<A, O, G>` accepts a Command in any state, a finished one included.
148
256
  */
149
- export type Command<Args = {}, Options = {}, Globals = {}, State extends CommandMethod = AfterAction> = Pick<CommandBuilder<Args, Options, Globals, State>, typeof commandValue | typeof declaredTypes | State>;
150
- interface CommandConstructor {
151
- new (name: string): Command<{}, {}, {}, CommandMethod>;
152
- new <Globals>(name: string, globals: GlobalOptions<Globals>): Command<{}, {}, Globals, CommandMethod>;
257
+ export type Command<Args = {}, Options = {}, Globals = {}, State extends CommandMethod = AfterAction, Result = unknown> = Pick<CommandBuilder<Args, Options, Globals, State, Result>, typeof commandValue | typeof declaredTypes | 'extend' | State | ResultMethod<Result>>;
258
+ /**
259
+ * `views()` is published in every state on a declaration that carries a result, and on none that
260
+ * carries none. It is a key of the picked surface rather than a member of the state union, because
261
+ * the state union answers the calls a declaration closes and this one closes nothing.
262
+ */
263
+ export type ResultMethod<Result> = unknown extends Result ? never : 'views';
264
+ /**
265
+ * The core facts and initial extension values a named Command carries.
266
+ */
267
+ export interface CommandOptions {
268
+ description?: string;
269
+ hidden?: boolean;
270
+ deprecated?: string;
271
+ extensions?: readonly ExtensionValue<'command'>[];
153
272
  }
154
- /** The public constructor requires a name and narrows the globals type to the supplied value. */
273
+ /** Collect every union member's known local keys before testing for a global collision. */
274
+ type LocalKeys<Child> = Child extends {
275
+ readonly [declaredTypes]: {
276
+ options: infer Options;
277
+ };
278
+ } ? keyof Options : never;
279
+ export type AttachmentConstraint<Globals, Child> = Extract<keyof Globals, LocalKeys<Child>> extends never ? unknown : never;
280
+ type CommandConstructor = new (name: string, options?: CommandOptions) => Command<{}, {}, RegisteredGlobals, CommandMethod>;
281
+ /** The public constructor takes a name and one options object, as the Application does. */
155
282
  export declare const Command: CommandConstructor;
156
283
  /** Every declaration in the graph, so defaults are validated before any token is read. */
157
284
  export declare function collectInputs(command: BuiltCommand): InputDeclaration[];
@@ -161,16 +288,44 @@ export declare function route(root: BuiltCommand, tokens: readonly string[]): {
161
288
  path: string[];
162
289
  tokens: string[];
163
290
  };
164
- /** Consumes globals, routes to a Command, then validates globals and locals in one pass. */
165
- export declare function selectCommand(graph: {
166
- globals: BuiltGlobals;
167
- root: BuiltCommand;
168
- }, invocation: {
291
+ /** One invocation after the pre-scan and routing, which the middleware chain runs on top of. */
292
+ export interface RoutedInvocation {
293
+ command: BuiltCommand;
294
+ path: readonly string[];
295
+ scan: OptionValues;
296
+ tokens: readonly string[];
297
+ }
298
+ /** Consumes the globals table, then routes the remaining bare tokens to a Command. */
299
+ export declare function routeInvocation(graph: BuiltGraph, argv: readonly string[]): RoutedInvocation;
300
+ /** What one invocation reaches the middleware chain with. */
301
+ export interface DispatchInvocation {
302
+ /** The channel the action receives, which the results lane builds from the routed node. */
303
+ channel: (binding: ResultBinding) => ActionChannel;
169
304
  defaults: DefaultValues;
170
305
  host: Host;
171
- }): Promise<{
172
- dispatch: (input: DispatchInput) => unknown;
173
- passthrough: string[];
174
- values: ValidatedInputs;
175
- }>;
306
+ signal: AbortSignal;
307
+ style: ContextualStyle;
308
+ }
309
+ /**
310
+ * One invocation prepared ahead of the middleware chain. `'ready'` carries the request a middleware
311
+ * reads and the call that dispatches; `'held'` carries the fault this phase found, which core
312
+ * raises at the dispatch boundary and never before, so a takeover swallows it. `result` is what the
313
+ * routed Command declared, whose views a middleware selects among, on either shape.
314
+ */
315
+ export type Prepared = {
316
+ result: DeclaredResult | undefined;
317
+ } & ({
318
+ dispatch: (view: string | null) => Promise<void>;
319
+ kind: 'ready';
320
+ request: Request;
321
+ } | {
322
+ fault: unknown;
323
+ kind: 'held';
324
+ request: null;
325
+ });
326
+ /**
327
+ * Prepares one dispatch ahead of the middleware chain and holds whatever fault it found, so a
328
+ * middleware reads the request before the action runs and a takeover never observes the fault.
329
+ */
330
+ export declare function prepareDispatch(graph: BuiltGraph, routed: RoutedInvocation, invocation: DispatchInvocation): Promise<Prepared>;
176
331
  export {};