@cnstra/types 0.1.0 → 0.2.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/index.d.mts +25 -53
- package/dist/index.d.ts +25 -53
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.mts
CHANGED
|
@@ -42,41 +42,24 @@ type TCNSAxon<TCollaterals extends Record<string, ICNSCollateral<unknown>> = Rec
|
|
|
42
42
|
*
|
|
43
43
|
* Signals route by collateral object identity (not by name).
|
|
44
44
|
*/
|
|
45
|
-
type
|
|
45
|
+
type TCNSNeuronResponseReturn<TAxon extends TCNSAxon> = Promise<TCNSSignal<TAxon[keyof TAxon]>> | TCNSSignal<TAxon[keyof TAxon]> | Promise<TCNSSignal<TAxon[keyof TAxon]>[]> | TCNSSignal<TAxon[keyof TAxon]>[] | Promise<void> | void;
|
|
46
46
|
|
|
47
|
-
type
|
|
48
|
-
get: () => TContextValue | undefined;
|
|
49
|
-
set: (value: TContextValue) => void;
|
|
50
|
-
delete: () => void;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
type TCNSNeuron<TContextValue, TAxonType extends TCNSAxon = TCNSAxon> = {
|
|
47
|
+
type TCNSNeuron<TAxonType extends TCNSAxon = TCNSAxon> = {
|
|
54
48
|
axon: TAxonType;
|
|
55
49
|
/** Optional per-neuron concurrency limit. If undefined or <= 0, no limit is applied. */
|
|
56
50
|
concurrency?: number;
|
|
57
51
|
/** Optional per-neuron max processing duration in milliseconds. */
|
|
58
52
|
maxDuration?: number;
|
|
59
|
-
dendrites: TCNSDendrite<
|
|
53
|
+
dendrites: TCNSDendrite<ICNSCollateral<unknown>, TAxonType, any>[];
|
|
60
54
|
};
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
autoCleanupContexts?: boolean;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
interface ICNSStimulationContextStore {
|
|
74
|
-
get: (key: object) => unknown;
|
|
75
|
-
set: (key: object, value: unknown) => void;
|
|
76
|
-
getAll: () => Map<object, unknown>;
|
|
77
|
-
setAll: (values: Map<object, unknown>) => void;
|
|
78
|
-
delete: (key: object) => void;
|
|
79
|
-
}
|
|
56
|
+
/**
|
|
57
|
+
* Options bag for `new CNS(...)`. Currently empty — the former
|
|
58
|
+
* `autoCleanupContexts` flag was removed together with the per-neuron mutable
|
|
59
|
+
* context store. Kept as a named type so the constructor signature and future
|
|
60
|
+
* engine-level options have a stable home.
|
|
61
|
+
*/
|
|
62
|
+
type TCNSOptions = Record<never, never>;
|
|
80
63
|
|
|
81
64
|
type TCNSModality = {
|
|
82
65
|
afferentPaths: Record<string | number, TCNSAfferentPath>;
|
|
@@ -100,7 +83,7 @@ type TCNSNeuronActivationTaskFailure<TNeuron extends object = object> = {
|
|
|
100
83
|
* `CNSStimulation` class in `@cnstra/core` implements it; internal enqueue/dispatch
|
|
101
84
|
* methods are intentionally not part of the public interface.
|
|
102
85
|
*/
|
|
103
|
-
interface ICNSStimulation<TNeuron extends TCNSNeuron<any
|
|
86
|
+
interface ICNSStimulation<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
104
87
|
/** Resolves when the run completes; rejects on failed tasks / abort. */
|
|
105
88
|
waitUntilComplete(): Promise<void>;
|
|
106
89
|
/** All activation tasks seen this run. */
|
|
@@ -112,8 +95,6 @@ interface ICNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendrite extend
|
|
|
112
95
|
* pending) plus failed/aborted ones. The set to persist for resume.
|
|
113
96
|
*/
|
|
114
97
|
getOutstandingTasks(): TCNSNeuronActivationTask<TNeuron>[];
|
|
115
|
-
/** The per-neuron context store for this run. */
|
|
116
|
-
getContext(): ICNSStimulationContextStore;
|
|
117
98
|
}
|
|
118
99
|
|
|
119
100
|
/**
|
|
@@ -173,7 +154,6 @@ type TCNSStimulationOptions<TResponse, TStimulationContext extends Object = {}>
|
|
|
173
154
|
*/
|
|
174
155
|
onDrain?: (drain: TCNSStimulationDrain) => void;
|
|
175
156
|
abortSignal?: AbortSignal;
|
|
176
|
-
ctx?: ICNSStimulationContextStore;
|
|
177
157
|
concurrency?: number;
|
|
178
158
|
modality?: TCNSModality;
|
|
179
159
|
afferentPath?: TCNSAfferentPath;
|
|
@@ -185,7 +165,6 @@ type TCNSStimulationResponse<TInputCollateral extends ICNSCollateral<unknown> =
|
|
|
185
165
|
outputSignal?: TCNSSignal<TOutputCollateral>;
|
|
186
166
|
modality?: TCNSModality;
|
|
187
167
|
afferentPath?: TCNSAfferentPath;
|
|
188
|
-
contextValue: Map<object, unknown>;
|
|
189
168
|
/**
|
|
190
169
|
* Every activation this stimulation still owns, in any state:
|
|
191
170
|
* `pendingActivations + activeActivations`.
|
|
@@ -234,12 +213,12 @@ type TCNSStimulationResponse<TInputCollateral extends ICNSCollateral<unknown> =
|
|
|
234
213
|
* task's neuron reliably — including for sink/failed tasks that have no output
|
|
235
214
|
* collateral to trace an owner from.
|
|
236
215
|
*/
|
|
237
|
-
neuron?: TCNSNeuron<any
|
|
216
|
+
neuron?: TCNSNeuron<any>;
|
|
238
217
|
error?: Error;
|
|
239
218
|
hops?: number;
|
|
240
219
|
};
|
|
241
220
|
|
|
242
|
-
type TCNSSubscriber<TNeuron extends TCNSNeuron<any
|
|
221
|
+
type TCNSSubscriber<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any>> = {
|
|
243
222
|
neuron: TNeuron;
|
|
244
223
|
dendrite: TDendrite;
|
|
245
224
|
};
|
|
@@ -248,7 +227,7 @@ type TCNSSubscriber<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNS
|
|
|
248
227
|
* The public contract of the compiled neuron network, exposed on `ICNS.network`.
|
|
249
228
|
* The concrete `CNSNetwork` class in `@cnstra/core` implements it.
|
|
250
229
|
*/
|
|
251
|
-
interface ICNSNetwork<TNeuron extends TCNSNeuron<any
|
|
230
|
+
interface ICNSNetwork<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
252
231
|
readonly stronglyConnectedComponents: Set<TNeuron>[];
|
|
253
232
|
getSCCSetByNeuron(neuron: TNeuron): Set<TNeuron> | undefined;
|
|
254
233
|
getSccIndexByNeuron(neuron: TNeuron): number | undefined;
|
|
@@ -259,7 +238,7 @@ interface ICNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TC
|
|
|
259
238
|
getSubscribers(collateral: ICNSCollateral<unknown>): TCNSSubscriber<TNeuron, TDendrite>[];
|
|
260
239
|
}
|
|
261
240
|
|
|
262
|
-
interface ICNS<TNeuron extends TCNSNeuron<any
|
|
241
|
+
interface ICNS<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
263
242
|
options?: TCNSOptions;
|
|
264
243
|
network: ICNSNetwork<TNeuron, TDendrite>;
|
|
265
244
|
/**
|
|
@@ -278,7 +257,8 @@ interface ICNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendr
|
|
|
278
257
|
* Resume a run from a set of activation tasks (e.g. an outstanding frontier
|
|
279
258
|
* hydrated from persisted progress, or `getFailedTasks()` for a partial
|
|
280
259
|
* retry). Unlike {@link stimulate}, no entry signal is derived — the given
|
|
281
|
-
* tasks are enqueued directly.
|
|
260
|
+
* tasks are enqueued directly. Each task carries its own input signal (with
|
|
261
|
+
* payload), so re-driving the frontier needs no extra state.
|
|
282
262
|
*/
|
|
283
263
|
activate(tasks: TCNSNeuronActivationTask<TNeuron>[], options?: TCNSStimulationOptions<TCNSStimulationResponse>): ICNSStimulation<TNeuron, TDendrite>;
|
|
284
264
|
}
|
|
@@ -288,8 +268,10 @@ interface ICNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendr
|
|
|
288
268
|
* lives here. Factory layers add their own fields via the `TExt` extension
|
|
289
269
|
* (see {@link TCNSHandlerContext}), so the base stays clean for neurons that
|
|
290
270
|
* don't opt into anything.
|
|
271
|
+
*
|
|
272
|
+
* Internal building block for {@link TCNSHandlerContext} — not part of the public API.
|
|
291
273
|
*/
|
|
292
|
-
type TCNSHandlerContextBase
|
|
274
|
+
type TCNSHandlerContextBase = {
|
|
293
275
|
abortSignal?: AbortSignal;
|
|
294
276
|
cns?: ICNS<any, any>;
|
|
295
277
|
stimulation?: any;
|
|
@@ -312,15 +294,15 @@ type TCNSHandlerContextBase<TContextValue> = TCNSLocalContextValueStore<TContext
|
|
|
312
294
|
* The handler signature stays `(payload, axon, ctx)` no matter how many layers
|
|
313
295
|
* you stack; each layer widens the type of `ctx`, never the argument list.
|
|
314
296
|
*/
|
|
315
|
-
type TCNSHandlerContext<
|
|
297
|
+
type TCNSHandlerContext<TExt = unknown> = TCNSHandlerContextBase & TExt;
|
|
316
298
|
|
|
317
|
-
type TCNSDendrite<
|
|
299
|
+
type TCNSDendrite<TSenderCollateral extends ICNSCollateral<unknown>, TAxonType extends TCNSAxon, TExt = unknown> = {
|
|
318
300
|
collateral: TSenderCollateral;
|
|
319
|
-
response: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<
|
|
301
|
+
response: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TExt>) => TCNSNeuronResponseReturn<TAxonType>;
|
|
320
302
|
};
|
|
321
303
|
|
|
322
304
|
type CNSCollateralLike = ICNSCollateral<unknown>;
|
|
323
|
-
type TCNSNeuronPersistOptions<TNeuron extends TCNSNeuron<
|
|
305
|
+
type TCNSNeuronPersistOptions<TNeuron extends TCNSNeuron<any> = TCNSNeuron<any>> = {
|
|
324
306
|
name: string;
|
|
325
307
|
neuron: TNeuron;
|
|
326
308
|
};
|
|
@@ -332,14 +314,4 @@ type TCNSStimulationPersistOptions = {
|
|
|
332
314
|
stimulationId: string;
|
|
333
315
|
};
|
|
334
316
|
|
|
335
|
-
type
|
|
336
|
-
neuron: TNeuron;
|
|
337
|
-
subscriber: TCNSSubscriber<TNeuron, TDendrite>;
|
|
338
|
-
inputSignal?: TCNSSignal<TInputCollateral>;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
type TCNSStimulationSerializedContextValue = {
|
|
342
|
-
[key: string]: unknown;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
export type { ICNS, ICNSCollateral, ICNSNetwork, ICNSStimulation, ICNSStimulationContextStore, TCNSAfferentPath, TCNSAxon, TCNSCollateralPersistOptions, TCNSDendrite, TCNSHandlerContext, TCNSHandlerContextBase, TCNSLocalContextValueStore, TCNSModality, TCNSNeuron, TCNSNeuronActivationTask, TCNSNeuronActivationTaskFailure, TCNSNeuronPersistOptions, TCNSOptions, TCNSSignal, TCNSStimulationDrain, TCNSStimulationOptions, TCNSStimulationPersistOptions, TCNSStimulationQueueItem, TCNSStimulationResponse, TCNSStimulationSerializedContextValue, TCNSSubscriber, TNCNeuronResponseReturn };
|
|
317
|
+
export type { ICNS, ICNSCollateral, ICNSNetwork, ICNSStimulation, TCNSAfferentPath, TCNSAxon, TCNSCollateralPersistOptions, TCNSDendrite, TCNSHandlerContext, TCNSModality, TCNSNeuron, TCNSNeuronActivationTask, TCNSNeuronActivationTaskFailure, TCNSNeuronPersistOptions, TCNSNeuronResponseReturn, TCNSOptions, TCNSSignal, TCNSStimulationDrain, TCNSStimulationOptions, TCNSStimulationPersistOptions, TCNSStimulationResponse, TCNSSubscriber };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,41 +42,24 @@ type TCNSAxon<TCollaterals extends Record<string, ICNSCollateral<unknown>> = Rec
|
|
|
42
42
|
*
|
|
43
43
|
* Signals route by collateral object identity (not by name).
|
|
44
44
|
*/
|
|
45
|
-
type
|
|
45
|
+
type TCNSNeuronResponseReturn<TAxon extends TCNSAxon> = Promise<TCNSSignal<TAxon[keyof TAxon]>> | TCNSSignal<TAxon[keyof TAxon]> | Promise<TCNSSignal<TAxon[keyof TAxon]>[]> | TCNSSignal<TAxon[keyof TAxon]>[] | Promise<void> | void;
|
|
46
46
|
|
|
47
|
-
type
|
|
48
|
-
get: () => TContextValue | undefined;
|
|
49
|
-
set: (value: TContextValue) => void;
|
|
50
|
-
delete: () => void;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
type TCNSNeuron<TContextValue, TAxonType extends TCNSAxon = TCNSAxon> = {
|
|
47
|
+
type TCNSNeuron<TAxonType extends TCNSAxon = TCNSAxon> = {
|
|
54
48
|
axon: TAxonType;
|
|
55
49
|
/** Optional per-neuron concurrency limit. If undefined or <= 0, no limit is applied. */
|
|
56
50
|
concurrency?: number;
|
|
57
51
|
/** Optional per-neuron max processing duration in milliseconds. */
|
|
58
52
|
maxDuration?: number;
|
|
59
|
-
dendrites: TCNSDendrite<
|
|
53
|
+
dendrites: TCNSDendrite<ICNSCollateral<unknown>, TAxonType, any>[];
|
|
60
54
|
};
|
|
61
55
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
*/
|
|
70
|
-
autoCleanupContexts?: boolean;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
interface ICNSStimulationContextStore {
|
|
74
|
-
get: (key: object) => unknown;
|
|
75
|
-
set: (key: object, value: unknown) => void;
|
|
76
|
-
getAll: () => Map<object, unknown>;
|
|
77
|
-
setAll: (values: Map<object, unknown>) => void;
|
|
78
|
-
delete: (key: object) => void;
|
|
79
|
-
}
|
|
56
|
+
/**
|
|
57
|
+
* Options bag for `new CNS(...)`. Currently empty — the former
|
|
58
|
+
* `autoCleanupContexts` flag was removed together with the per-neuron mutable
|
|
59
|
+
* context store. Kept as a named type so the constructor signature and future
|
|
60
|
+
* engine-level options have a stable home.
|
|
61
|
+
*/
|
|
62
|
+
type TCNSOptions = Record<never, never>;
|
|
80
63
|
|
|
81
64
|
type TCNSModality = {
|
|
82
65
|
afferentPaths: Record<string | number, TCNSAfferentPath>;
|
|
@@ -100,7 +83,7 @@ type TCNSNeuronActivationTaskFailure<TNeuron extends object = object> = {
|
|
|
100
83
|
* `CNSStimulation` class in `@cnstra/core` implements it; internal enqueue/dispatch
|
|
101
84
|
* methods are intentionally not part of the public interface.
|
|
102
85
|
*/
|
|
103
|
-
interface ICNSStimulation<TNeuron extends TCNSNeuron<any
|
|
86
|
+
interface ICNSStimulation<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
104
87
|
/** Resolves when the run completes; rejects on failed tasks / abort. */
|
|
105
88
|
waitUntilComplete(): Promise<void>;
|
|
106
89
|
/** All activation tasks seen this run. */
|
|
@@ -112,8 +95,6 @@ interface ICNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendrite extend
|
|
|
112
95
|
* pending) plus failed/aborted ones. The set to persist for resume.
|
|
113
96
|
*/
|
|
114
97
|
getOutstandingTasks(): TCNSNeuronActivationTask<TNeuron>[];
|
|
115
|
-
/** The per-neuron context store for this run. */
|
|
116
|
-
getContext(): ICNSStimulationContextStore;
|
|
117
98
|
}
|
|
118
99
|
|
|
119
100
|
/**
|
|
@@ -173,7 +154,6 @@ type TCNSStimulationOptions<TResponse, TStimulationContext extends Object = {}>
|
|
|
173
154
|
*/
|
|
174
155
|
onDrain?: (drain: TCNSStimulationDrain) => void;
|
|
175
156
|
abortSignal?: AbortSignal;
|
|
176
|
-
ctx?: ICNSStimulationContextStore;
|
|
177
157
|
concurrency?: number;
|
|
178
158
|
modality?: TCNSModality;
|
|
179
159
|
afferentPath?: TCNSAfferentPath;
|
|
@@ -185,7 +165,6 @@ type TCNSStimulationResponse<TInputCollateral extends ICNSCollateral<unknown> =
|
|
|
185
165
|
outputSignal?: TCNSSignal<TOutputCollateral>;
|
|
186
166
|
modality?: TCNSModality;
|
|
187
167
|
afferentPath?: TCNSAfferentPath;
|
|
188
|
-
contextValue: Map<object, unknown>;
|
|
189
168
|
/**
|
|
190
169
|
* Every activation this stimulation still owns, in any state:
|
|
191
170
|
* `pendingActivations + activeActivations`.
|
|
@@ -234,12 +213,12 @@ type TCNSStimulationResponse<TInputCollateral extends ICNSCollateral<unknown> =
|
|
|
234
213
|
* task's neuron reliably — including for sink/failed tasks that have no output
|
|
235
214
|
* collateral to trace an owner from.
|
|
236
215
|
*/
|
|
237
|
-
neuron?: TCNSNeuron<any
|
|
216
|
+
neuron?: TCNSNeuron<any>;
|
|
238
217
|
error?: Error;
|
|
239
218
|
hops?: number;
|
|
240
219
|
};
|
|
241
220
|
|
|
242
|
-
type TCNSSubscriber<TNeuron extends TCNSNeuron<any
|
|
221
|
+
type TCNSSubscriber<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any>> = {
|
|
243
222
|
neuron: TNeuron;
|
|
244
223
|
dendrite: TDendrite;
|
|
245
224
|
};
|
|
@@ -248,7 +227,7 @@ type TCNSSubscriber<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNS
|
|
|
248
227
|
* The public contract of the compiled neuron network, exposed on `ICNS.network`.
|
|
249
228
|
* The concrete `CNSNetwork` class in `@cnstra/core` implements it.
|
|
250
229
|
*/
|
|
251
|
-
interface ICNSNetwork<TNeuron extends TCNSNeuron<any
|
|
230
|
+
interface ICNSNetwork<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
252
231
|
readonly stronglyConnectedComponents: Set<TNeuron>[];
|
|
253
232
|
getSCCSetByNeuron(neuron: TNeuron): Set<TNeuron> | undefined;
|
|
254
233
|
getSccIndexByNeuron(neuron: TNeuron): number | undefined;
|
|
@@ -259,7 +238,7 @@ interface ICNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TC
|
|
|
259
238
|
getSubscribers(collateral: ICNSCollateral<unknown>): TCNSSubscriber<TNeuron, TDendrite>[];
|
|
260
239
|
}
|
|
261
240
|
|
|
262
|
-
interface ICNS<TNeuron extends TCNSNeuron<any
|
|
241
|
+
interface ICNS<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any> = TCNSDendrite<any, any>> {
|
|
263
242
|
options?: TCNSOptions;
|
|
264
243
|
network: ICNSNetwork<TNeuron, TDendrite>;
|
|
265
244
|
/**
|
|
@@ -278,7 +257,8 @@ interface ICNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendr
|
|
|
278
257
|
* Resume a run from a set of activation tasks (e.g. an outstanding frontier
|
|
279
258
|
* hydrated from persisted progress, or `getFailedTasks()` for a partial
|
|
280
259
|
* retry). Unlike {@link stimulate}, no entry signal is derived — the given
|
|
281
|
-
* tasks are enqueued directly.
|
|
260
|
+
* tasks are enqueued directly. Each task carries its own input signal (with
|
|
261
|
+
* payload), so re-driving the frontier needs no extra state.
|
|
282
262
|
*/
|
|
283
263
|
activate(tasks: TCNSNeuronActivationTask<TNeuron>[], options?: TCNSStimulationOptions<TCNSStimulationResponse>): ICNSStimulation<TNeuron, TDendrite>;
|
|
284
264
|
}
|
|
@@ -288,8 +268,10 @@ interface ICNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendr
|
|
|
288
268
|
* lives here. Factory layers add their own fields via the `TExt` extension
|
|
289
269
|
* (see {@link TCNSHandlerContext}), so the base stays clean for neurons that
|
|
290
270
|
* don't opt into anything.
|
|
271
|
+
*
|
|
272
|
+
* Internal building block for {@link TCNSHandlerContext} — not part of the public API.
|
|
291
273
|
*/
|
|
292
|
-
type TCNSHandlerContextBase
|
|
274
|
+
type TCNSHandlerContextBase = {
|
|
293
275
|
abortSignal?: AbortSignal;
|
|
294
276
|
cns?: ICNS<any, any>;
|
|
295
277
|
stimulation?: any;
|
|
@@ -312,15 +294,15 @@ type TCNSHandlerContextBase<TContextValue> = TCNSLocalContextValueStore<TContext
|
|
|
312
294
|
* The handler signature stays `(payload, axon, ctx)` no matter how many layers
|
|
313
295
|
* you stack; each layer widens the type of `ctx`, never the argument list.
|
|
314
296
|
*/
|
|
315
|
-
type TCNSHandlerContext<
|
|
297
|
+
type TCNSHandlerContext<TExt = unknown> = TCNSHandlerContextBase & TExt;
|
|
316
298
|
|
|
317
|
-
type TCNSDendrite<
|
|
299
|
+
type TCNSDendrite<TSenderCollateral extends ICNSCollateral<unknown>, TAxonType extends TCNSAxon, TExt = unknown> = {
|
|
318
300
|
collateral: TSenderCollateral;
|
|
319
|
-
response: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<
|
|
301
|
+
response: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TExt>) => TCNSNeuronResponseReturn<TAxonType>;
|
|
320
302
|
};
|
|
321
303
|
|
|
322
304
|
type CNSCollateralLike = ICNSCollateral<unknown>;
|
|
323
|
-
type TCNSNeuronPersistOptions<TNeuron extends TCNSNeuron<
|
|
305
|
+
type TCNSNeuronPersistOptions<TNeuron extends TCNSNeuron<any> = TCNSNeuron<any>> = {
|
|
324
306
|
name: string;
|
|
325
307
|
neuron: TNeuron;
|
|
326
308
|
};
|
|
@@ -332,14 +314,4 @@ type TCNSStimulationPersistOptions = {
|
|
|
332
314
|
stimulationId: string;
|
|
333
315
|
};
|
|
334
316
|
|
|
335
|
-
type
|
|
336
|
-
neuron: TNeuron;
|
|
337
|
-
subscriber: TCNSSubscriber<TNeuron, TDendrite>;
|
|
338
|
-
inputSignal?: TCNSSignal<TInputCollateral>;
|
|
339
|
-
};
|
|
340
|
-
|
|
341
|
-
type TCNSStimulationSerializedContextValue = {
|
|
342
|
-
[key: string]: unknown;
|
|
343
|
-
};
|
|
344
|
-
|
|
345
|
-
export type { ICNS, ICNSCollateral, ICNSNetwork, ICNSStimulation, ICNSStimulationContextStore, TCNSAfferentPath, TCNSAxon, TCNSCollateralPersistOptions, TCNSDendrite, TCNSHandlerContext, TCNSHandlerContextBase, TCNSLocalContextValueStore, TCNSModality, TCNSNeuron, TCNSNeuronActivationTask, TCNSNeuronActivationTaskFailure, TCNSNeuronPersistOptions, TCNSOptions, TCNSSignal, TCNSStimulationDrain, TCNSStimulationOptions, TCNSStimulationPersistOptions, TCNSStimulationQueueItem, TCNSStimulationResponse, TCNSStimulationSerializedContextValue, TCNSSubscriber, TNCNeuronResponseReturn };
|
|
317
|
+
export type { ICNS, ICNSCollateral, ICNSNetwork, ICNSStimulation, TCNSAfferentPath, TCNSAxon, TCNSCollateralPersistOptions, TCNSDendrite, TCNSHandlerContext, TCNSModality, TCNSNeuron, TCNSNeuronActivationTask, TCNSNeuronActivationTaskFailure, TCNSNeuronPersistOptions, TCNSNeuronResponseReturn, TCNSOptions, TCNSSignal, TCNSStimulationDrain, TCNSStimulationOptions, TCNSStimulationPersistOptions, TCNSStimulationResponse, TCNSSubscriber };
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types/TCNSAfferentPath\";\nexport * from \"./types/TCNSAxon\";\nexport * from \"./types/TCNSDendrite\";\nexport * from \"./types/TCNSHandlerContext\";\nexport * from \"./types/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export * from \"./types/TCNSAfferentPath\";\nexport * from \"./types/TCNSAxon\";\nexport * from \"./types/TCNSDendrite\";\nexport * from \"./types/TCNSHandlerContext\";\nexport * from \"./types/TCNSModality\";\nexport * from \"./types/TCNSNeuron\";\nexport * from \"./types/TCNSNeuronActivationTask\";\nexport * from \"./types/TCNSNeuronActivationTaskFailure\";\nexport * from \"./types/TCNSNeuronResponseReturn\";\nexport * from \"./types/TCNSOptions\";\nexport * from \"./types/TCNSPersist\";\nexport * from \"./types/TCNSSignal\";\nexport * from \"./types/TCNSStimulationDrain\";\nexport * from \"./types/TCNSStimulationOptions\";\nexport * from \"./types/TCNSStimulationResponse\";\nexport * from \"./types/TCNSSubscriber\";\nexport * from \"./interfaces/ICNS\";\nexport * from \"./interfaces/ICNSCollateral\";\nexport * from \"./interfaces/ICNSNetwork\";\nexport * from \"./interfaces/ICNSStimulation\";\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cnstra/types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared TypeScript contract for CNStra: signals, tasks, axons, neuron/collateral/stimulation/network interfaces. Zero runtime — the base package core and integrations build on.",
|
|
5
5
|
"keywords": ["cnstra", "types", "contract", "interfaces"],
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"sideEffects": false,
|
|
17
17
|
"files": ["dist"],
|
|
18
18
|
"scripts": {
|
|
19
|
+
"prepublishOnly": "node ../../scripts/check-drift.mjs --gate",
|
|
19
20
|
"build": "tsup",
|
|
20
21
|
"test:types": "tsc --noEmit",
|
|
21
22
|
"clean": "rm -rf dist"
|