@cnstra/core 2.5.0 → 2.6.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/CNS.d.ts +11 -11
- package/dist/CNS.d.ts.map +1 -1
- package/dist/CNSCollateral.d.ts +2 -2
- package/dist/CNSCollateral.d.ts.map +1 -1
- package/dist/CNSNetwork.d.ts +7 -7
- package/dist/CNSNetwork.d.ts.map +1 -1
- package/dist/CNSStimulation.d.ts +23 -15
- package/dist/CNSStimulation.d.ts.map +1 -1
- package/dist/CNSStimulationContextStore.d.ts +1 -1
- package/dist/CNSStimulationContextStore.d.ts.map +1 -1
- package/dist/factory/index.d.ts +26 -82
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/index.cjs +24 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -93
- package/dist/index.js.map +1 -1
- package/dist/utils/CNSStimulationGate.d.ts +7 -7
- package/dist/utils/CNSStimulationGate.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist/CNSPersistOptionsRegistry.d.ts +0 -28
- package/dist/CNSPersistOptionsRegistry.d.ts.map +0 -1
- package/dist/interfaces/ICNS.d.ts +0 -27
- package/dist/interfaces/ICNS.d.ts.map +0 -1
- package/dist/interfaces/ICNSCollateral.d.ts +0 -6
- package/dist/interfaces/ICNSCollateral.d.ts.map +0 -1
- package/dist/interfaces/ICNSStimulationContextStore.d.ts +0 -8
- package/dist/interfaces/ICNSStimulationContextStore.d.ts.map +0 -1
- package/dist/types/TCNSAfferentPath.d.ts +0 -4
- package/dist/types/TCNSAfferentPath.d.ts.map +0 -1
- package/dist/types/TCNSAxon.d.ts +0 -26
- package/dist/types/TCNSAxon.d.ts.map +0 -1
- package/dist/types/TCNSDendrite.d.ts +0 -9
- package/dist/types/TCNSDendrite.d.ts.map +0 -1
- package/dist/types/TCNSHandlerContext.d.ts +0 -24
- package/dist/types/TCNSHandlerContext.d.ts.map +0 -1
- package/dist/types/TCNSLocalContextValueStore.d.ts +0 -6
- package/dist/types/TCNSLocalContextValueStore.d.ts.map +0 -1
- package/dist/types/TCNSModality.d.ts +0 -5
- package/dist/types/TCNSModality.d.ts.map +0 -1
- package/dist/types/TCNSNeuron.d.ts +0 -12
- package/dist/types/TCNSNeuron.d.ts.map +0 -1
- package/dist/types/TCNSNeuronActivationTask.d.ts +0 -8
- package/dist/types/TCNSNeuronActivationTask.d.ts.map +0 -1
- package/dist/types/TCNSNeuronActivationTaskFailure.d.ts +0 -7
- package/dist/types/TCNSNeuronActivationTaskFailure.d.ts.map +0 -1
- package/dist/types/TCNSNeuronResponseReturn.d.ts +0 -9
- package/dist/types/TCNSNeuronResponseReturn.d.ts.map +0 -1
- package/dist/types/TCNSOptions.d.ts +0 -11
- package/dist/types/TCNSOptions.d.ts.map +0 -1
- package/dist/types/TCNSPersist.d.ts +0 -16
- package/dist/types/TCNSPersist.d.ts.map +0 -1
- package/dist/types/TCNSSignal.d.ts +0 -6
- package/dist/types/TCNSSignal.d.ts.map +0 -1
- package/dist/types/TCNSStimulationDrain.d.ts +0 -37
- package/dist/types/TCNSStimulationDrain.d.ts.map +0 -1
- package/dist/types/TCNSStimulationOptions.d.ts +0 -32
- package/dist/types/TCNSStimulationOptions.d.ts.map +0 -1
- package/dist/types/TCNSStimulationQueueItem.d.ts +0 -11
- package/dist/types/TCNSStimulationQueueItem.d.ts.map +0 -1
- package/dist/types/TCNSStimulationResponse.d.ts +0 -57
- package/dist/types/TCNSStimulationResponse.d.ts.map +0 -1
- package/dist/types/TCNSStimulationSerializedContextValue.d.ts +0 -4
- package/dist/types/TCNSStimulationSerializedContextValue.d.ts.map +0 -1
- package/dist/types/TCNSSubscriber.d.ts +0 -7
- package/dist/types/TCNSSubscriber.d.ts.map +0 -1
package/dist/CNS.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ICNSCollateral } from '@cnstra/types';
|
|
2
|
+
import { TCNSNeuron } from '@cnstra/types';
|
|
3
|
+
import { TCNSDendrite } from '@cnstra/types';
|
|
4
|
+
import { TCNSOptions } from '@cnstra/types';
|
|
5
|
+
import { TCNSStimulationOptions } from '@cnstra/types';
|
|
5
6
|
import { CNSStimulation } from './CNSStimulation';
|
|
6
|
-
import { TCNSSignal } from '
|
|
7
|
+
import { TCNSSignal } from '@cnstra/types';
|
|
7
8
|
import { CNSInstanceNeuronQueue } from './CNSInstanceNeuronQueue';
|
|
8
|
-
import { TCNSStimulationResponse } from '
|
|
9
|
-
import { TCNSStimulationDrain } from '
|
|
10
|
-
import { TCNSNeuronActivationTask } from '
|
|
9
|
+
import { TCNSStimulationResponse } from '@cnstra/types';
|
|
10
|
+
import { TCNSStimulationDrain } from '@cnstra/types';
|
|
11
|
+
import { TCNSNeuronActivationTask } from '@cnstra/types';
|
|
11
12
|
import { CNSNetwork } from './CNSNetwork';
|
|
12
|
-
import { ICNS } from '
|
|
13
|
-
import { CNSCollateral } from './CNSCollateral';
|
|
13
|
+
import { ICNS } from '@cnstra/types';
|
|
14
14
|
export declare class CNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any> = TCNSDendrite<any, any, any>> implements ICNS<TNeuron, TDendrite> {
|
|
15
15
|
protected readonly neurons: TNeuron[];
|
|
16
16
|
readonly options?: TCNSOptions | undefined;
|
|
@@ -57,7 +57,7 @@ export declare class CNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends
|
|
|
57
57
|
*/
|
|
58
58
|
private wrapOnDrain;
|
|
59
59
|
private wrapOnResponse;
|
|
60
|
-
stimulate(signalOrSignals: TCNSSignal<
|
|
60
|
+
stimulate(signalOrSignals: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[], options?: TCNSStimulationOptions<TCNSStimulationResponse>): CNSStimulation<TNeuron, TDendrite>;
|
|
61
61
|
/**
|
|
62
62
|
* Start a stimulation with activation tasks directly
|
|
63
63
|
*/
|
package/dist/CNS.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNS.d.ts","sourceRoot":"","sources":["../src/CNS.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CNS.d.ts","sourceRoot":"","sources":["../src/CNS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAErC,qBAAa,GAAG,CACZ,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAC7E,YAAW,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC;IAoC7B,SAAS,CAAC,QAAQ,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
|
|
1
|
-
import { TCNSSignal } from '
|
|
2
|
-
import { ICNSCollateral } from '
|
|
1
|
+
import { TCNSSignal } from '@cnstra/types';
|
|
2
|
+
import { ICNSCollateral } from '@cnstra/types';
|
|
3
3
|
export declare class CNSCollateral<TPayload> implements ICNSCollateral<TPayload> {
|
|
4
4
|
createSignal(): TCNSSignal<CNSCollateral<TPayload>>;
|
|
5
5
|
createSignal(payload: TPayload): TCNSSignal<CNSCollateral<TPayload>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSCollateral.d.ts","sourceRoot":"","sources":["../src/CNSCollateral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CNSCollateral.d.ts","sourceRoot":"","sources":["../src/CNSCollateral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qBAAa,aAAa,CAAC,QAAQ,CAAE,YAAW,cAAc,CAAC,QAAQ,CAAC;IACpE,YAAY,IAAI,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnD,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CAIvE"}
|
package/dist/CNSNetwork.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { ICNSCollateral } from '@cnstra/types';
|
|
2
|
+
import { TCNSNeuron } from '@cnstra/types';
|
|
3
|
+
import { TCNSSubscriber } from '@cnstra/types';
|
|
4
|
+
import { TCNSDendrite } from '@cnstra/types';
|
|
5
5
|
export declare class CNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any>> {
|
|
6
6
|
private readonly neurons;
|
|
7
7
|
/**
|
|
@@ -68,9 +68,9 @@ export declare class CNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite
|
|
|
68
68
|
*/
|
|
69
69
|
canNeuronBeGuaranteedDone(neuron: TNeuron, activeSccCounts: Map<number, number>): boolean;
|
|
70
70
|
private buildIndexes;
|
|
71
|
-
getParentNeuronByCollateral(collateral:
|
|
71
|
+
getParentNeuronByCollateral(collateral: ICNSCollateral<unknown>): TNeuron | undefined;
|
|
72
72
|
getDendrites(): TDendrite[];
|
|
73
|
-
getCollaterals():
|
|
74
|
-
getSubscribers(collateral:
|
|
73
|
+
getCollaterals(): ICNSCollateral<unknown>[];
|
|
74
|
+
getSubscribers(collateral: ICNSCollateral<unknown>): TCNSSubscriber<TNeuron, TDendrite>[];
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=CNSNetwork.d.ts.map
|
package/dist/CNSNetwork.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSNetwork.d.ts","sourceRoot":"","sources":["../src/CNSNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CNSNetwork.d.ts","sourceRoot":"","sources":["../src/CNSNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,qBAAa,UAAU,CACnB,OAAO,SAAS,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EACpC,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IA2CjC,OAAO,CAAC,QAAQ,CAAC,OAAO;IAzCpC;;;;;;OAMG;IACH,OAAO,CAAC,4BAA4B,CAAsB;IAC1D,OAAO,CAAC,QAAQ,CAAS;IAEzB,IAAW,2BAA2B,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAGvD;IAED;;OAEG;IACH,OAAO,CAAC,WAAW,CAA8B;IAEjD;;OAEG;IACH,OAAO,CAAC,MAAM,CAAuC;IAErD;;OAEG;IACH,OAAO,CAAC,YAAY,CAAuC;IAE3D;;;OAGG;IACH,OAAO,CAAC,QAAQ,CAGZ;IAEJ,OAAO,CAAC,wBAAwB,CAA+C;gBAElD,OAAO,EAAE,OAAO,EAAE;IAM/C,+DAA+D;IAC/D,OAAO,CAAC,SAAS;IAMjB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAiCxB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAqEhB;;OAEG;IACH,OAAO,CAAC,WAAW;IA6BnB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAmDzB;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,EAAE,OAAO;IASxC;;OAEG;IACI,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS;IAK/D;;;OAGG;IACI,yBAAyB,CAC5B,MAAM,EAAE,OAAO,EACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,OAAO;IA6BV,OAAO,CAAC,YAAY;IAsBb,2BAA2B,CAAC,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC;IAM/D,YAAY;IAaZ,cAAc;IAUd,cAAc,CACjB,UAAU,EAAE,cAAc,CAAC,OAAO,CAAC,GACpC,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;CAG1C"}
|
package/dist/CNSStimulation.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import type { ICNSCollateral } from '@cnstra/types';
|
|
2
|
+
import { ICNSStimulationContextStore } from '@cnstra/types';
|
|
3
|
+
import { TCNSStimulationOptions } from '@cnstra/types';
|
|
4
|
+
import { TCNSNeuron } from '@cnstra/types';
|
|
5
|
+
import { TCNSDendrite } from '@cnstra/types';
|
|
6
|
+
import { TCNSSubscriber } from '@cnstra/types';
|
|
6
7
|
import { CNSInstanceNeuronQueue } from './CNSInstanceNeuronQueue';
|
|
7
|
-
import { TCNSSignal } from '
|
|
8
|
-
import { TCNSNeuronActivationTask } from '
|
|
8
|
+
import { TCNSSignal } from '@cnstra/types';
|
|
9
|
+
import { TCNSNeuronActivationTask } from '@cnstra/types';
|
|
9
10
|
import { CNS } from './CNS';
|
|
10
|
-
import { TCNSNeuronActivationTaskFailure } from '
|
|
11
|
-
import { TCNSStimulationResponse } from '
|
|
12
|
-
import { TCNSStimulationDrain } from '
|
|
13
|
-
import { CNSCollateral } from './CNSCollateral';
|
|
11
|
+
import { TCNSNeuronActivationTaskFailure } from '@cnstra/types';
|
|
12
|
+
import { TCNSStimulationResponse } from '@cnstra/types';
|
|
13
|
+
import { TCNSStimulationDrain } from '@cnstra/types';
|
|
14
14
|
export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendrite extends TCNSDendrite<any, any, any> = TCNSDendrite<any, any, any>> {
|
|
15
15
|
readonly cns: CNS<TNeuron, TDendrite>;
|
|
16
16
|
readonly options?: TCNSStimulationOptions<TCNSStimulationResponse> | undefined;
|
|
@@ -101,6 +101,14 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
101
101
|
* Returns all tasks that failed or were aborted
|
|
102
102
|
*/
|
|
103
103
|
getFailedTasks(): Array<TCNSNeuronActivationTaskFailure<TNeuron>>;
|
|
104
|
+
/**
|
|
105
|
+
* The current outstanding frontier — every task that has not completed:
|
|
106
|
+
* queued, active, and pending (awaiting an async onResponse), plus any
|
|
107
|
+
* failed/aborted tasks. This is the set to persist for resume: re-activating
|
|
108
|
+
* it re-runs exactly the not-yet-done work. Safe to call at any point during
|
|
109
|
+
* a run (for progress) or after it fails.
|
|
110
|
+
*/
|
|
111
|
+
getOutstandingTasks(): TCNSNeuronActivationTask<TNeuron>[];
|
|
104
112
|
/**
|
|
105
113
|
* Get the context store for this stimulation
|
|
106
114
|
*/
|
|
@@ -132,11 +140,11 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
132
140
|
*/
|
|
133
141
|
protected canNeuronBeGuaranteedDone(neuron: TNeuron): boolean;
|
|
134
142
|
protected cleanupCtxIfNeeded(neuron: TNeuron): void;
|
|
135
|
-
protected createSubscriberQueueItem(subscriber: TCNSSubscriber<TNeuron, TDendrite>, inputSignal?: TCNSSignal<
|
|
143
|
+
protected createSubscriberQueueItem(subscriber: TCNSSubscriber<TNeuron, TDendrite>, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>): TCNSNeuronActivationTask<TNeuron>;
|
|
136
144
|
private executeActivationTask;
|
|
137
145
|
private runStarter;
|
|
138
|
-
protected processResponseOrResponses(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<
|
|
139
|
-
protected processResponse(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<
|
|
140
|
-
responseToSignal(signalOrSignals: TCNSSignal<
|
|
146
|
+
protected processResponseOrResponses(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>, outputSignalOrSignals?: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[], error?: any): void;
|
|
147
|
+
protected processResponse(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>, outputSignal?: TCNSSignal<ICNSCollateral<unknown>>, error?: any): void;
|
|
148
|
+
responseToSignal(signalOrSignals: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[]): void;
|
|
141
149
|
}
|
|
142
150
|
//# sourceMappingURL=CNSStimulation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSStimulation.d.ts","sourceRoot":"","sources":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GAAG,OAAO;IAS7D,SAAS,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAUnD,SAAS,CAAC,yBAAyB,CAC/B,UAAU,EAAE,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,EAC9C,WAAW,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IA6BrD,OAAO,CAAC,qBAAqB;IAqE7B,OAAO,CAAC,UAAU;IAgJlB,SAAS,CAAC,0BAA0B,CAChC,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,WAAW,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACjD,qBAAqB,CAAC,EAChB,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACnC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,EAC3C,KAAK,CAAC,EAAE,GAAG,GACZ,IAAI;IA6CP,SAAS,CAAC,eAAe,CACrB,OAAO,EAAE,OAAO,GAAG,SAAS,EAC5B,WAAW,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EACjD,YAAY,CAAC,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAClD,KAAK,CAAC,EAAE,GAAG,GACZ,IAAI;IAsJA,gBAAgB,CACnB,eAAe,EACT,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACnC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,GAC5C,IAAI;CA0BV"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ICNSStimulationContextStore } from '
|
|
1
|
+
import { ICNSStimulationContextStore } from '@cnstra/types';
|
|
2
2
|
export declare class CNSStimulationContextStore implements ICNSStimulationContextStore {
|
|
3
3
|
private ctx?;
|
|
4
4
|
constructor(ctx?: Map<object, unknown>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSStimulationContextStore.d.ts","sourceRoot":"","sources":["../src/CNSStimulationContextStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"CNSStimulationContextStore.d.ts","sourceRoot":"","sources":["../src/CNSStimulationContextStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAE5D,qBAAa,0BAA2B,YAAW,2BAA2B;IAG1E,OAAO,CAAC,GAAG,CAAC,CAAuB;gBAEvB,GAAG,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAItC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAItC,MAAM,IAAI,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAI9B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAM1C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;CAG5B"}
|
package/dist/factory/index.d.ts
CHANGED
|
@@ -1,67 +1,64 @@
|
|
|
1
|
-
import { CNS } from '../CNS';
|
|
2
1
|
import { CNSCollateral } from '../CNSCollateral';
|
|
3
|
-
import {
|
|
4
|
-
import { TCNSAxon } from '
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { TCNSModality } from '../types/TCNSModality';
|
|
11
|
-
import { TCNSAfferentPath } from '../types/TCNSAfferentPath';
|
|
2
|
+
import type { ICNSCollateral } from '@cnstra/types';
|
|
3
|
+
import { TCNSAxon } from '@cnstra/types';
|
|
4
|
+
import { TCNSDendrite } from '@cnstra/types';
|
|
5
|
+
import { TCNSHandlerContext } from '@cnstra/types';
|
|
6
|
+
import { TNCNeuronResponseReturn } from '@cnstra/types';
|
|
7
|
+
import { TCNSModality } from '@cnstra/types';
|
|
8
|
+
import { TCNSAfferentPath } from '@cnstra/types';
|
|
12
9
|
export declare const collateral: <TPayload = undefined>() => CNSCollateral<TPayload>;
|
|
13
|
-
type CollateralPayloadUnion<TCollaterals extends readonly
|
|
14
|
-
[K in keyof TCollaterals]: TCollaterals[K] extends
|
|
10
|
+
type CollateralPayloadUnion<TCollaterals extends readonly ICNSCollateral<unknown>[]> = {
|
|
11
|
+
[K in keyof TCollaterals]: TCollaterals[K] extends ICNSCollateral<infer P> ? P : never;
|
|
15
12
|
}[number];
|
|
16
13
|
type InterNeuronAPI<TContextValue, TAxonType extends TCNSAxon = TCNSAxon, TGlobal = unknown> = {
|
|
17
14
|
axon: TAxonType;
|
|
18
15
|
concurrency?: number;
|
|
19
16
|
maxDuration?: number;
|
|
20
|
-
dendrites: TCNSDendrite<TContextValue,
|
|
17
|
+
dendrites: TCNSDendrite<TContextValue, ICNSCollateral<unknown>, TAxonType, TGlobal>[];
|
|
21
18
|
setConcurrency: (n: number | undefined) => InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
22
19
|
setMaxDuration: (ms: number | undefined) => InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
23
|
-
bind: <TFollowAxon extends Record<string,
|
|
20
|
+
bind: <TFollowAxon extends Record<string, ICNSCollateral<unknown>>>(axon: TFollowAxon, dendrites: {
|
|
24
21
|
[K in keyof TFollowAxon]: TCNSDendrite<TContextValue, TFollowAxon[K], TAxonType, TGlobal> | TCNSDendrite<TContextValue, TFollowAxon[K], TAxonType, TGlobal>['response'];
|
|
25
22
|
}) => InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
26
23
|
dendrite: {
|
|
27
|
-
<TSenderCollateral extends
|
|
24
|
+
<TSenderCollateral extends ICNSCollateral<unknown>>(s: {
|
|
28
25
|
collateral: TSenderCollateral;
|
|
29
|
-
response: (payload: TSenderCollateral extends
|
|
26
|
+
response: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TNCNeuronResponseReturn<TAxonType>;
|
|
30
27
|
}): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
31
28
|
<TCollaterals extends readonly [
|
|
32
|
-
|
|
33
|
-
...
|
|
29
|
+
ICNSCollateral<unknown>,
|
|
30
|
+
...ICNSCollateral<unknown>[]
|
|
34
31
|
]>(s: {
|
|
35
32
|
collateral: TCollaterals;
|
|
36
33
|
response: (payload: CollateralPayloadUnion<TCollaterals>, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TNCNeuronResponseReturn<TAxonType>;
|
|
37
34
|
}): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
38
35
|
<TPayloadUnion>(s: {
|
|
39
|
-
collateral:
|
|
36
|
+
collateral: ICNSCollateral<unknown>[];
|
|
40
37
|
response: (payload: TPayloadUnion, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TNCNeuronResponseReturn<TAxonType>;
|
|
41
38
|
}): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
42
|
-
(s: TCNSDendrite<TContextValue,
|
|
39
|
+
(s: TCNSDendrite<TContextValue, ICNSCollateral<unknown>, TAxonType, TGlobal>): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
43
40
|
};
|
|
44
41
|
modalityDendrite: {
|
|
45
|
-
<TSenderCollateral extends
|
|
42
|
+
<TSenderCollateral extends ICNSCollateral<unknown>, TResult>(s: {
|
|
46
43
|
collateral: TSenderCollateral;
|
|
47
44
|
modality: TCNSModality;
|
|
48
|
-
afferentPaths?: Map<TCNSAfferentPath, (payload: TSenderCollateral extends
|
|
49
|
-
default?: (payload: TSenderCollateral extends
|
|
45
|
+
afferentPaths?: Map<TCNSAfferentPath, (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TResult | Promise<TResult>>;
|
|
46
|
+
default?: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TResult | Promise<TResult>;
|
|
50
47
|
output: (result: TResult, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TNCNeuronResponseReturn<TAxonType>;
|
|
51
48
|
}): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
52
|
-
<TSenderCollateral extends
|
|
49
|
+
<TSenderCollateral extends ICNSCollateral<unknown>, TResult>(s: {
|
|
53
50
|
collateral: TSenderCollateral;
|
|
54
51
|
modalities: Array<{
|
|
55
52
|
modality: TCNSModality;
|
|
56
|
-
afferentPaths?: Map<TCNSAfferentPath, (payload: TSenderCollateral extends
|
|
57
|
-
default?: (payload: TSenderCollateral extends
|
|
53
|
+
afferentPaths?: Map<TCNSAfferentPath, (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TResult | Promise<TResult>>;
|
|
54
|
+
default?: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TResult | Promise<TResult>;
|
|
58
55
|
}>;
|
|
59
|
-
default?: (payload: TSenderCollateral extends
|
|
56
|
+
default?: (payload: TSenderCollateral extends ICNSCollateral<infer P> ? P : never, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TResult | Promise<TResult>;
|
|
60
57
|
output: (result: TResult, axon: TAxonType, ctx: TCNSHandlerContext<TContextValue, TGlobal>) => TNCNeuronResponseReturn<TAxonType>;
|
|
61
58
|
}): InterNeuronAPI<TContextValue, TAxonType, TGlobal>;
|
|
62
59
|
};
|
|
63
60
|
};
|
|
64
|
-
export declare const neuron: <TContextValue, TProvidedAxon extends Record<string,
|
|
61
|
+
export declare const neuron: <TContextValue, TProvidedAxon extends Record<string, ICNSCollateral<unknown>>, TGlobal = unknown>(axon: TProvidedAxon) => InterNeuronAPI<TContextValue, TCNSAxon<TProvidedAxon>, TGlobal>;
|
|
65
62
|
/**
|
|
66
63
|
* A composable neuron factory. Each `.withX<T>()` returns a *new typed view* of
|
|
67
64
|
* the same underlying builder (the layers are type-only — zero runtime cost, no
|
|
@@ -92,7 +89,7 @@ export type TNeuronFactory<TContextValue, TExt = unknown> = {
|
|
|
92
89
|
withGlobal: <T>() => TNeuronFactory<TContextValue, TExt & {
|
|
93
90
|
global: T;
|
|
94
91
|
}>;
|
|
95
|
-
neuron: <TProvidedAxon extends Record<string,
|
|
92
|
+
neuron: <TProvidedAxon extends Record<string, ICNSCollateral<unknown>>>(axon: TProvidedAxon) => InterNeuronAPI<TContextValue, TCNSAxon<TProvidedAxon>, TExt>;
|
|
96
93
|
};
|
|
97
94
|
export declare const neuronFactory: <TContextValue = undefined, TExt = unknown>() => TNeuronFactory<TContextValue, TExt>;
|
|
98
95
|
/** Sugar: `neuronFactory().withCtx<T>()`. Still exposes `.neuron`, so existing usage is unchanged. */
|
|
@@ -103,58 +100,5 @@ export declare const withGlobal: <T>() => TNeuronFactory<undefined, {
|
|
|
103
100
|
}>;
|
|
104
101
|
export declare const afferentPath: (parentAfferentPath?: TCNSAfferentPath) => TCNSAfferentPath;
|
|
105
102
|
export declare const modality: (afferentPaths: Record<string | number, TCNSAfferentPath>) => TCNSModality;
|
|
106
|
-
type CNSRegistryValue<N extends TCNSNeuron<any, any>> = N | (N extends TCNSNeuron<any, infer TAxon> ? {
|
|
107
|
-
neuron: N;
|
|
108
|
-
collaterals?: {
|
|
109
|
-
[K in keyof TAxon]?: string;
|
|
110
|
-
};
|
|
111
|
-
} : never);
|
|
112
|
-
/**
|
|
113
|
-
* Creates a CNSPersistOptionsRegistry from a plain object of named neurons.
|
|
114
|
-
* All axon collaterals are registered automatically.
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* // Auto names from JS identifiers:
|
|
118
|
-
* export const registry = createPersistRegistry({ deckNeuron, cardNeuron });
|
|
119
|
-
*
|
|
120
|
-
* // Explicit neuron name:
|
|
121
|
-
* export const registry = createPersistRegistry({ 'deck-neuron': deckNeuron });
|
|
122
|
-
*
|
|
123
|
-
* // Explicit collateral names (keys are type-checked against the neuron's axon):
|
|
124
|
-
* export const registry = createPersistRegistry({
|
|
125
|
-
* 'deck-neuron': { neuron: deckNeuron, collaterals: { deckCreated: 'deck-created' } }
|
|
126
|
-
* });
|
|
127
|
-
*/
|
|
128
|
-
export declare const createPersistRegistry: <TMap extends Record<string, TCNSNeuron<any, any>>>(namedNeurons: { [K in keyof TMap]: CNSRegistryValue<TMap[K]>; }) => CNSPersistOptionsRegistry;
|
|
129
|
-
/**
|
|
130
|
-
* Creates a CNS and its CNSPersistOptionsRegistry from a single plain object of
|
|
131
|
-
* named neurons, so the neuron set is listed exactly once.
|
|
132
|
-
*
|
|
133
|
-
* `cns` is the runtime engine; `registry` carries the names used by devtools,
|
|
134
|
-
* mcp and persistence. Both derive from the same map, so they can never drift.
|
|
135
|
-
* If you don't need naming/persistence, just use `new CNS([...])` directly —
|
|
136
|
-
* this factory is purely additive.
|
|
137
|
-
*
|
|
138
|
-
* @example
|
|
139
|
-
* const { cns, registry } = createCNS({
|
|
140
|
-
* task: createTaskNeuron(store),
|
|
141
|
-
* comment: createCommentNeuron(store),
|
|
142
|
-
* });
|
|
143
|
-
*
|
|
144
|
-
* // Explicit names / collateral names work exactly like createPersistRegistry:
|
|
145
|
-
* const { cns, registry } = createCNS({
|
|
146
|
-
* 'task-neuron': { neuron: taskNeuron, collaterals: { taskCreated: 'task-created' } },
|
|
147
|
-
* });
|
|
148
|
-
*
|
|
149
|
-
* // Inject the shared `global` once — it surfaces as `ctx.global` in every neuron
|
|
150
|
-
* // (type it once via `neuronFactory().withGlobal<T>()`). Swappable per instance:
|
|
151
|
-
* const { cns } = createCNS(map, { global: { store, now, newId } });
|
|
152
|
-
*/
|
|
153
|
-
export declare const createCNS: <TMap extends Record<string, TCNSNeuron<any, any>>, TGlobal = undefined>(namedNeurons: { [K in keyof TMap]: CNSRegistryValue<TMap[K]>; }, options?: TCNSOptions & {
|
|
154
|
-
global?: TGlobal;
|
|
155
|
-
}) => {
|
|
156
|
-
cns: CNS<TCNSNeuron<any, any>>;
|
|
157
|
-
registry: CNSPersistOptionsRegistry;
|
|
158
|
-
};
|
|
159
103
|
export {};
|
|
160
104
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/factory/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,eAAO,MAAM,UAAU,GAAI,QAAQ,GAAG,SAAS,8BACd,CAAC;AAKlC,KAAK,sBAAsB,CACvB,YAAY,SAAS,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,IACvD;KACC,CAAC,IAAI,MAAM,YAAY,GAAG,YAAY,CAAC,CAAC,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GACpE,CAAC,GACD,KAAK;CACd,CAAC,MAAM,CAAC,CAAC;AAEV,KAAK,cAAc,CACf,aAAa,EACb,SAAS,SAAS,QAAQ,GAAG,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,aAAa,KAClB,cAAc,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,CAAC,CAAC;CACrE,CAAC;AAEF,eAAO,MAAM,aAAa,GACtB,aAAa,GAAG,SAAS,EACzB,IAAI,GAAG,OAAO,OACb,cAAc,CAAC,aAAa,EAAE,IAAI,CAUtC,CAAC;AAEF,sGAAsG;AACtG,eAAO,MAAM,OAAO,GAAI,aAAa,OAAK,cAAc,CAAC,aAAa,CACpC,CAAC;AAEnC,gDAAgD;AAChD,eAAO,MAAM,UAAU,GAAI,CAAC,OAAK,cAAc,CAAC,SAAS,EAAE;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,CAC3B,CAAC;AAE9C,eAAO,MAAM,YAAY,GACrB,qBAAqB,gBAAgB,KACtC,gBAMF,CAAC;AAEF,eAAO,MAAM,QAAQ,GACjB,eAAe,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,gBAAgB,CAAC,KACzD,YAIF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -39,6 +39,13 @@ var CNSDendriteContext = class {
|
|
|
39
39
|
get global() {
|
|
40
40
|
return this.cns.global;
|
|
41
41
|
}
|
|
42
|
+
// The caller-supplied per-stimulation context (`stimulate(sig, {stimulationContext})`),
|
|
43
|
+
// the same value on every hop — the environment-agnostic way to correlate logs to a
|
|
44
|
+
// run (pass `{ stimulationId, attemptNumber }`). Prototype getter like `global`:
|
|
45
|
+
// zero extra allocation, read only where a handler reaches for it.
|
|
46
|
+
get stimulationContext() {
|
|
47
|
+
return this.stimulation.options?.stimulationContext;
|
|
48
|
+
}
|
|
42
49
|
get() {
|
|
43
50
|
return this.stimulation.getContext().get(this.neuron);
|
|
44
51
|
}
|
|
@@ -50,7 +57,7 @@ var CNSDendriteContext = class {
|
|
|
50
57
|
}
|
|
51
58
|
};
|
|
52
59
|
var CNSStimulationResponseImpl = class {
|
|
53
|
-
constructor(stimulation, store, inputSignal, outputSignal, queueLength, pendingActivations, activeActivations, hops, error) {
|
|
60
|
+
constructor(stimulation, store, inputSignal, outputSignal, queueLength, pendingActivations, activeActivations, hops, error, neuron2) {
|
|
54
61
|
this.stimulation = stimulation;
|
|
55
62
|
this.store = store;
|
|
56
63
|
this.inputSignal = inputSignal;
|
|
@@ -60,6 +67,7 @@ var CNSStimulationResponseImpl = class {
|
|
|
60
67
|
this.activeActivations = activeActivations;
|
|
61
68
|
this.hops = hops;
|
|
62
69
|
this.error = error;
|
|
70
|
+
this.neuron = neuron2;
|
|
63
71
|
}
|
|
64
72
|
get contextValue() {
|
|
65
73
|
return this.store ? this.store.getAll() : /* @__PURE__ */ new Map();
|
|
@@ -333,6 +341,19 @@ var CNSStimulation = class {
|
|
|
333
341
|
getFailedTasks() {
|
|
334
342
|
return this.failedTasks ? [...this.failedTasks] : [];
|
|
335
343
|
}
|
|
344
|
+
/**
|
|
345
|
+
* The current outstanding frontier — every task that has not completed:
|
|
346
|
+
* queued, active, and pending (awaiting an async onResponse), plus any
|
|
347
|
+
* failed/aborted tasks. This is the set to persist for resume: re-activating
|
|
348
|
+
* it re-runs exactly the not-yet-done work. Safe to call at any point during
|
|
349
|
+
* a run (for progress) or after it fails.
|
|
350
|
+
*/
|
|
351
|
+
getOutstandingTasks() {
|
|
352
|
+
return [
|
|
353
|
+
...this.getAllActivationTasks(),
|
|
354
|
+
...this.getFailedTasks().map((f) => f.task)
|
|
355
|
+
];
|
|
356
|
+
}
|
|
336
357
|
/**
|
|
337
358
|
* Get the context store for this stimulation
|
|
338
359
|
*/
|
|
@@ -664,7 +685,8 @@ var CNSStimulation = class {
|
|
|
664
685
|
this.pendingActivations,
|
|
665
686
|
this.activeOperations,
|
|
666
687
|
this.options?.maxNeuronHops && emitter ? this.neuronVisitMap?.get(emitter) ?? 0 : void 0,
|
|
667
|
-
error
|
|
688
|
+
error,
|
|
689
|
+
emitter
|
|
668
690
|
)
|
|
669
691
|
);
|
|
670
692
|
} catch (e) {
|
|
@@ -1213,72 +1235,6 @@ var CNS = class {
|
|
|
1213
1235
|
}
|
|
1214
1236
|
};
|
|
1215
1237
|
|
|
1216
|
-
// src/CNSPersistOptionsRegistry.ts
|
|
1217
|
-
var CNSPersistOptionsRegistry = class {
|
|
1218
|
-
constructor() {
|
|
1219
|
-
this.neurons = /* @__PURE__ */ new Map();
|
|
1220
|
-
this.neuronNames = /* @__PURE__ */ new WeakMap();
|
|
1221
|
-
this.collaterals = /* @__PURE__ */ new Map();
|
|
1222
|
-
this.stimulations = /* @__PURE__ */ new Map();
|
|
1223
|
-
}
|
|
1224
|
-
addNeuron(neuron2, options) {
|
|
1225
|
-
this.neurons.set(options.name, neuron2);
|
|
1226
|
-
this.neuronNames.set(neuron2, options.name);
|
|
1227
|
-
}
|
|
1228
|
-
getNeuron(name) {
|
|
1229
|
-
return this.neurons.get(name);
|
|
1230
|
-
}
|
|
1231
|
-
getNeuronName(neuron2) {
|
|
1232
|
-
return this.neuronNames.get(neuron2);
|
|
1233
|
-
}
|
|
1234
|
-
getNamedNeurons() {
|
|
1235
|
-
return this.neurons;
|
|
1236
|
-
}
|
|
1237
|
-
getCollateralName(collateral2) {
|
|
1238
|
-
for (const [name, col] of this.collaterals) {
|
|
1239
|
-
if (col === collateral2) return name;
|
|
1240
|
-
}
|
|
1241
|
-
return void 0;
|
|
1242
|
-
}
|
|
1243
|
-
removeNeuron(name) {
|
|
1244
|
-
const neuron2 = this.neurons.get(name);
|
|
1245
|
-
if (neuron2) this.neuronNames.delete(neuron2);
|
|
1246
|
-
this.neurons.delete(name);
|
|
1247
|
-
}
|
|
1248
|
-
addCollateral(collateral2, options) {
|
|
1249
|
-
this.collaterals.set(options.name, collateral2);
|
|
1250
|
-
}
|
|
1251
|
-
getCollateral(name) {
|
|
1252
|
-
return this.collaterals.get(name);
|
|
1253
|
-
}
|
|
1254
|
-
removeCollateral(name) {
|
|
1255
|
-
this.collaterals.delete(name);
|
|
1256
|
-
}
|
|
1257
|
-
addStimulation(stimulation, options) {
|
|
1258
|
-
this.stimulations.set(options.stimulationId, stimulation);
|
|
1259
|
-
}
|
|
1260
|
-
getStimulation(stimulationId) {
|
|
1261
|
-
return this.stimulations.get(stimulationId);
|
|
1262
|
-
}
|
|
1263
|
-
removeStimulation(stimulationId) {
|
|
1264
|
-
this.stimulations.delete(stimulationId);
|
|
1265
|
-
}
|
|
1266
|
-
register(name, neuron2, collateralNames) {
|
|
1267
|
-
this.addNeuron(neuron2, { name, neuron: neuron2 });
|
|
1268
|
-
for (const [key, col] of Object.entries(neuron2.axon)) {
|
|
1269
|
-
this.addCollateral(col, {
|
|
1270
|
-
name: collateralNames?.[key] ?? key,
|
|
1271
|
-
collateral: col
|
|
1272
|
-
});
|
|
1273
|
-
}
|
|
1274
|
-
return this;
|
|
1275
|
-
}
|
|
1276
|
-
registerCollateral(name, collateral2) {
|
|
1277
|
-
this.addCollateral(collateral2, { name, collateral: collateral2 });
|
|
1278
|
-
return this;
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
|
-
|
|
1282
1238
|
// src/CNSCollateral.ts
|
|
1283
1239
|
var CNSCollateral = class {
|
|
1284
1240
|
createSignal(payload) {
|
|
@@ -1481,40 +1437,13 @@ var modality = (afferentPaths) => {
|
|
|
1481
1437
|
afferentPaths
|
|
1482
1438
|
};
|
|
1483
1439
|
};
|
|
1484
|
-
var createPersistRegistry = (namedNeurons) => {
|
|
1485
|
-
const registry = new CNSPersistOptionsRegistry();
|
|
1486
|
-
for (const [name, entry] of Object.entries(namedNeurons)) {
|
|
1487
|
-
const isEntry = "neuron" in entry && !("axon" in entry);
|
|
1488
|
-
const neuron2 = isEntry ? entry.neuron : entry;
|
|
1489
|
-
const colNames = isEntry ? entry.collaterals ?? {} : {};
|
|
1490
|
-
registry.addNeuron(neuron2, { name, neuron: neuron2 });
|
|
1491
|
-
for (const [key, col] of Object.entries(neuron2.axon)) {
|
|
1492
|
-
registry.addCollateral(col, {
|
|
1493
|
-
name: colNames[key] ?? key,
|
|
1494
|
-
collateral: col
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
return registry;
|
|
1499
|
-
};
|
|
1500
|
-
var createCNS = (namedNeurons, options) => {
|
|
1501
|
-
const neurons = Object.values(namedNeurons).map(
|
|
1502
|
-
(entry) => entry && typeof entry === "object" && "neuron" in entry ? entry.neuron : entry
|
|
1503
|
-
);
|
|
1504
|
-
const cns = new CNS(neurons, options, options?.global);
|
|
1505
|
-
const registry = createPersistRegistry(namedNeurons);
|
|
1506
|
-
return { cns, registry };
|
|
1507
|
-
};
|
|
1508
1440
|
|
|
1509
1441
|
exports.CNS = CNS;
|
|
1510
1442
|
exports.CNSCollateral = CNSCollateral;
|
|
1511
|
-
exports.CNSPersistOptionsRegistry = CNSPersistOptionsRegistry;
|
|
1512
1443
|
exports.CNSStimulationContextStore = CNSStimulationContextStore;
|
|
1513
1444
|
exports.CNSStimulationGate = CNSStimulationGate;
|
|
1514
1445
|
exports.afferentPath = afferentPath;
|
|
1515
1446
|
exports.collateral = collateral;
|
|
1516
|
-
exports.createCNS = createCNS;
|
|
1517
|
-
exports.createPersistRegistry = createPersistRegistry;
|
|
1518
1447
|
exports.modality = modality;
|
|
1519
1448
|
exports.neuron = neuron;
|
|
1520
1449
|
exports.neuronFactory = neuronFactory;
|