@cnstra/core 2.6.0 → 3.2.1
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/README.md +51 -35
- package/dist/CNS.d.ts +10 -3
- package/dist/CNS.d.ts.map +1 -1
- package/dist/CNSCollateral.d.ts +1 -0
- package/dist/CNSCollateral.d.ts.map +1 -1
- package/dist/CNSInstanceNeuronQueue.d.ts +2 -1
- package/dist/CNSInstanceNeuronQueue.d.ts.map +1 -1
- package/dist/CNSNetwork.d.ts +14 -6
- package/dist/CNSNetwork.d.ts.map +1 -1
- package/dist/CNSStimulation.d.ts +41 -41
- package/dist/CNSStimulation.d.ts.map +1 -1
- package/dist/createCNS.d.ts +4 -0
- package/dist/createCNS.d.ts.map +1 -0
- package/dist/factory/index.d.ts +37 -40
- package/dist/factory/index.d.ts.map +1 -1
- package/dist/index.cjs +534 -408
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +528 -401
- package/dist/index.js.map +1 -1
- package/dist/types/TCNSModalitySelection.d.ts +13 -0
- package/dist/types/TCNSModalitySelection.d.ts.map +1 -0
- package/dist/utils/CNSStimulationGate.d.ts +2 -2
- package/dist/utils/CNSStimulationGate.d.ts.map +1 -1
- package/dist/utils/cnsComposeModalityResponse.d.ts +2 -0
- package/dist/utils/cnsComposeModalityResponse.d.ts.map +1 -0
- package/dist/utils/cnsResolveModalityHandler.d.ts +4 -0
- package/dist/utils/cnsResolveModalityHandler.d.ts.map +1 -0
- package/package.json +5 -4
- package/dist/CNSStimulationContextStore.d.ts +0 -11
- package/dist/CNSStimulationContextStore.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -2,27 +2,33 @@
|
|
|
2
2
|
|
|
3
3
|
**Orchestration engine for TypeScript — deterministic, embeddable, in-memory.**
|
|
4
4
|
|
|
5
|
-
📚 **[Full Documentation →](https://cnstra.org/)** | [Quick Start](https://cnstra.org/docs/core/quick-start) | [API Reference](https://cnstra.org/docs/core/api) | [Recipes](https://cnstra.org/docs/recipes)
|
|
5
|
+
📚 **[Full Documentation →](https://cnstra.org/)** | [Quick Start](https://cnstra.org/docs/core/quick-start) | [API Reference](https://cnstra.org/docs/core/api) | [Recipes](https://cnstra.org/docs/recipes/saga)
|
|
6
6
|
|
|
7
7
|
## What is CNStra?
|
|
8
8
|
|
|
9
|
-
**CNStra** (Central Nervous System Orchestrator)
|
|
9
|
+
**CNStra** (Central Nervous System Orchestrator) is a library for control flow you can read, type-check, and resume.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
You wire your app's steps into a graph and start a run with a signal. CNStra walks that graph deterministically, one hop at a time — and every hop is visible while it runs and re-drivable after it fails. It's a library, not a service: no server, no broker, no database to stand up, and no third-party dependencies.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**Isolated units.** A neuron owns one responsibility. Change it and the compiler plus the graph show exactly what it affects — no hidden coupling to grep for, no subscriber you didn't wire yourself.
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
- **Signal** — what actually flows through a run.
|
|
15
|
+
**Typed, and exhaustive.** Signals travel on typed collaterals, and the compiler makes you handle every collateral you subscribe to. An incomplete flow doesn't build.
|
|
16
|
+
|
|
17
|
+
**Traceable and resumable.** Devtools show every hop of every run and let you retry one. `@cnstra/persist` records what a run still has left to do, so a process that dies halfway comes back with exactly the unfinished work — not with the whole flow replayed.
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
Which makes it a good fit for:
|
|
21
20
|
|
|
22
21
|
- **Jobs & workers**, **webhooks & integrations**, **ETL / pipelines**
|
|
23
22
|
- **Retries, timeouts, cancellation**, and **saga-style compensations**
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
### The four primitives
|
|
25
|
+
|
|
26
|
+
- **Collateral** — a typed channel; a signal is a payload sent on one.
|
|
27
|
+
- **Neuron** — a unit of logic with one or more dendrites.
|
|
28
|
+
- **Dendrite** — a handler that reacts to a collateral and returns the next signal.
|
|
29
|
+
- **Signal** — what actually flows through a run.
|
|
30
|
+
|
|
31
|
+
A dendrite's returned signal **is** the edge to the next neuron. That's the entire wiring model.
|
|
26
32
|
|
|
27
33
|
👉 **[Read the full documentation →](https://cnstra.org/)**
|
|
28
34
|
|
|
@@ -33,14 +39,14 @@ npm install @cnstra/core
|
|
|
33
39
|
```
|
|
34
40
|
|
|
35
41
|
```typescript
|
|
36
|
-
import { CNS,
|
|
42
|
+
import { CNS, cnsCollateral, cnsNeuron } from '@cnstra/core';
|
|
37
43
|
|
|
38
44
|
// Define collaterals (communication channels)
|
|
39
|
-
const userCreated =
|
|
40
|
-
const userRegistered =
|
|
45
|
+
const userCreated = cnsCollateral<{ id: string; name: string }>();
|
|
46
|
+
const userRegistered = cnsCollateral<{ userId: string; status: string }>();
|
|
41
47
|
|
|
42
48
|
// Create a neuron
|
|
43
|
-
const userService =
|
|
49
|
+
const userService = cnsNeuron({
|
|
44
50
|
userRegistered
|
|
45
51
|
})
|
|
46
52
|
.dendrite({
|
|
@@ -66,63 +72,73 @@ await stimulation.waitUntilComplete();
|
|
|
66
72
|
|
|
67
73
|
## Registry & Naming
|
|
68
74
|
|
|
69
|
-
`CNSPersistOptionsRegistry` maps object references to stable string names — used by devtools, MCP server, and persistence/resume patterns.
|
|
75
|
+
`CNSPersistOptionsRegistry` (from `@cnstra/persist`) maps object references to stable string names — used by devtools, MCP server, and persistence/resume patterns.
|
|
70
76
|
|
|
71
77
|
**Per-file registration (recommended):**
|
|
72
78
|
|
|
73
|
-
```ts
|
|
79
|
+
```ts file=registry.ts
|
|
74
80
|
// src/neurons/registry.ts
|
|
75
|
-
import { CNSPersistOptionsRegistry } from '@cnstra/
|
|
81
|
+
import { CNSPersistOptionsRegistry } from '@cnstra/persist';
|
|
76
82
|
export const registry = new CNSPersistOptionsRegistry();
|
|
83
|
+
```
|
|
77
84
|
|
|
85
|
+
```ts file=deck.ts
|
|
78
86
|
// src/neurons/deck.ts — each neuron registers itself
|
|
79
|
-
import {
|
|
87
|
+
import { cnsCollateral, cnsNeuron } from '@cnstra/core';
|
|
80
88
|
import { registry } from './registry';
|
|
81
89
|
|
|
82
|
-
const deckCreated =
|
|
83
|
-
const importStarted =
|
|
90
|
+
const deckCreated = cnsCollateral<{ deckId: string }>();
|
|
91
|
+
const importStarted = cnsCollateral<{ importId: string }>(); // external entry point
|
|
84
92
|
|
|
85
|
-
const deckNeuron =
|
|
86
|
-
.neuron({ deckCreated })
|
|
93
|
+
const deckNeuron = cnsNeuron({ deckCreated })
|
|
87
94
|
.bind({ importStarted }, {
|
|
88
95
|
importStarted: ({ importId }, axon) => axon.deckCreated.createSignal({ deckId: importId }),
|
|
89
96
|
});
|
|
90
97
|
|
|
91
98
|
registry
|
|
92
|
-
.register('deckNeuron', deckNeuron)
|
|
93
|
-
.
|
|
94
|
-
.registerCollateral('importStarted', importStarted); // standalone collateral (no neuron)
|
|
99
|
+
.register('deckNeuron', deckNeuron, { deckCreated: 'deck-created' }) // neuron + axon collaterals; default name 'deckNeuron.deckCreated'
|
|
100
|
+
.registerCollateral('importStarted', importStarted); // standalone cnsCollateral (no neuron)
|
|
95
101
|
```
|
|
96
102
|
|
|
97
103
|
**All at once (simple projects):**
|
|
98
104
|
|
|
105
|
+
```ts setup
|
|
106
|
+
import type { TCNSNeuron } from '@cnstra/types';
|
|
107
|
+
|
|
108
|
+
declare const deckNeuron: TCNSNeuron<any>;
|
|
109
|
+
declare const cardNeuron: TCNSNeuron<any>;
|
|
110
|
+
```
|
|
111
|
+
|
|
99
112
|
```ts
|
|
100
|
-
import {
|
|
113
|
+
import { CNSPersistOptionsRegistryFactory } from '@cnstra/persist';
|
|
101
114
|
|
|
102
|
-
export const registry =
|
|
115
|
+
export const registry = CNSPersistOptionsRegistryFactory.create({ deckNeuron, cardNeuron });
|
|
103
116
|
// explicit neuron name: { 'deck-neuron': deckNeuron }
|
|
104
117
|
// explicit collateral names: { 'deck-neuron': { neuron: deckNeuron, collaterals: { deckCreated: 'deck-created' } } }
|
|
118
|
+
// entry collaterals and modalities go in the same object; a nested object is a namespace: { decks: { deckNeuron } } → 'decks.deckNeuron'
|
|
105
119
|
```
|
|
106
120
|
|
|
107
|
-
**CNS + registry from one map:** if you're going to build both, `
|
|
121
|
+
**CNS + registry from one map:** if you're going to build both, `CNSFactory.create` from `@cnstra/factory` lists the
|
|
108
122
|
neuron set once and returns both — they derive from the same map, so the names can never
|
|
109
|
-
drift from the runtime graph. Accepts the same explicit-name syntax as `
|
|
123
|
+
drift from the runtime graph. Accepts the same explicit-name syntax as `CNSPersistOptionsRegistryFactory.create`.
|
|
110
124
|
|
|
111
125
|
```ts
|
|
112
|
-
import {
|
|
126
|
+
import { CNSFactory } from '@cnstra/factory';
|
|
113
127
|
|
|
114
|
-
const { cns, registry } =
|
|
128
|
+
const { cns, registry } = CNSFactory.create({ deckNeuron, cardNeuron });
|
|
115
129
|
// `cns` is the runtime engine; `registry` carries the names for devtools/mcp/persistence.
|
|
116
|
-
// Don't need naming/persistence?
|
|
130
|
+
// Don't need naming/persistence? `new CNS([deckNeuron, cardNeuron])`, or `createCNS(neuronFactories, dependencies)` when the neurons have dependencies.
|
|
117
131
|
```
|
|
118
132
|
|
|
133
|
+
**Neurons with dependencies (recommended):** write each neuron as a factory of its dependencies, in its own file, and build the CNS with `createCNS(neuronFactories, dependencies)`. Every factory gets the same dependencies, and TypeScript checks them against each factory's parameter. See [Dependencies](https://cnstra.org/docs/core/api#dependencies-a-store-a-database-a-clock).
|
|
134
|
+
|
|
119
135
|
## Documentation
|
|
120
136
|
|
|
121
137
|
- **[Quick Start Guide](https://cnstra.org/docs/core/quick-start)** — Get up and running in minutes
|
|
122
138
|
- **[API Reference](https://cnstra.org/docs/core/api)** — Complete API documentation
|
|
123
|
-
- **[Concepts](https://cnstra.org/docs/
|
|
124
|
-
- **[Recipes](https://cnstra.org/docs/recipes)** — Common patterns and use cases
|
|
125
|
-
- **[Advanced Topics](https://cnstra.org/docs/advanced)** — Performance,
|
|
139
|
+
- **[Concepts](https://cnstra.org/docs/concepts/basics)** — Neurons, collaterals, signals, and the CNS model (Central Neural Network of your app)
|
|
140
|
+
- **[Recipes](https://cnstra.org/docs/recipes/saga)** — Common patterns and use cases
|
|
141
|
+
- **[Advanced Topics](https://cnstra.org/docs/advanced/performance)** — Performance, integrations
|
|
126
142
|
|
|
127
143
|
---
|
|
128
144
|
|
package/dist/CNS.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { TCNSStimulationDrain } from '@cnstra/types';
|
|
|
11
11
|
import { TCNSNeuronActivationTask } from '@cnstra/types';
|
|
12
12
|
import { CNSNetwork } from './CNSNetwork';
|
|
13
13
|
import { ICNS } from '@cnstra/types';
|
|
14
|
-
export declare class CNS<TNeuron extends TCNSNeuron<any
|
|
14
|
+
export declare class CNS<TNeuron extends TCNSNeuron<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;
|
|
17
17
|
/**
|
|
@@ -31,23 +31,28 @@ export declare class CNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends
|
|
|
31
31
|
* Global batch-boundary listeners applied to every stimulation.
|
|
32
32
|
*/
|
|
33
33
|
private readonly globalDrainListeners;
|
|
34
|
+
private batchDepth;
|
|
35
|
+
private batchedDrains;
|
|
34
36
|
/**
|
|
35
37
|
* Shared, app/organism-wide value handed to every dendrite as `ctx.global`.
|
|
36
|
-
* Stored untyped (the type is baked into neurons via `
|
|
38
|
+
* Stored untyped (the type is baked into neurons via `cnsNeuronFactory().withGlobal<T>()`);
|
|
37
39
|
* CNS is just a passthrough carrier, so injecting it here never touches the hot path.
|
|
38
40
|
*/
|
|
39
41
|
readonly global?: unknown;
|
|
40
42
|
constructor(neurons: TNeuron[], options?: TCNSOptions | undefined, global?: unknown);
|
|
43
|
+
/** Push a listener onto a list; return an idempotent unsubscribe. */
|
|
44
|
+
private addListener;
|
|
41
45
|
addResponseListener(listener: (response: TCNSStimulationResponse) => void | Promise<void>): () => void;
|
|
42
46
|
/**
|
|
43
47
|
* Register a listener called once at the end of every synchronous turn of
|
|
44
|
-
* every stimulation - see {@link TCNSStimulationDrain}. This is how an
|
|
48
|
+
* every stimulation (inside `batch`, when the batch ends) - see {@link TCNSStimulationDrain}. This is how an
|
|
45
49
|
* integration (a state manager, an in-memory database) installs a single
|
|
46
50
|
* commit point for the whole organism instead of passing `onDrain` per call.
|
|
47
51
|
*
|
|
48
52
|
* Returns an unsubscribe function.
|
|
49
53
|
*/
|
|
50
54
|
addDrainListener(listener: (drain: TCNSStimulationDrain) => void): () => void;
|
|
55
|
+
batch<TResult>(run: () => TResult): TResult;
|
|
51
56
|
/**
|
|
52
57
|
* Fan a drain out to the local and global listeners, or return undefined when
|
|
53
58
|
* there are none so the stimulation can skip the boundary check entirely.
|
|
@@ -57,6 +62,8 @@ export declare class CNS<TNeuron extends TCNSNeuron<any, any>, TDendrite extends
|
|
|
57
62
|
*/
|
|
58
63
|
private wrapOnDrain;
|
|
59
64
|
private wrapOnResponse;
|
|
65
|
+
/** Build a stimulation (wired listeners, unseeded). Shared by stimulate/activate. */
|
|
66
|
+
private createStimulation;
|
|
60
67
|
stimulate(signalOrSignals: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[], options?: TCNSStimulationOptions<TCNSStimulationResponse>): CNSStimulation<TNeuron, TDendrite>;
|
|
61
68
|
/**
|
|
62
69
|
* Start a stimulation with activation tasks directly
|
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,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,O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AO;IAalD;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;IA0BnB,OAAO,CAAC,cAAc;IAiDtB,qFAAqF;IACrF,OAAO,CAAC,iBAAiB;IAYlB,SAAS,CACZ,eAAe,EACT,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACnC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,EAC3C,OAAO,CAAC,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,GAC1D,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC;IAMrC;;OAEG;IACI,QAAQ,CACX,KAAK,EAAE,wBAAwB,CAAC,OAAO,CAAC,EAAE,EAC1C,OAAO,CAAC,EAAE,sBAAsB,CAAC,uBAAuB,CAAC,GAC1D,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC;CAKxC"}
|
package/dist/CNSCollateral.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TCNSSignal } from '@cnstra/types';
|
|
2
2
|
import { ICNSCollateral } from '@cnstra/types';
|
|
3
3
|
export declare class CNSCollateral<TPayload> implements ICNSCollateral<TPayload> {
|
|
4
|
+
readonly index: number;
|
|
4
5
|
createSignal(): TCNSSignal<CNSCollateral<TPayload>>;
|
|
5
6
|
createSignal(payload: TPayload): TCNSSignal<CNSCollateral<TPayload>>;
|
|
6
7
|
}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAI/C,qBAAa,aAAa,CAAC,QAAQ,CAAE,YAAW,cAAc,CAAC,QAAQ,CAAC;IACpE,SAAgB,KAAK,SAAyB;IAE9C,YAAY,IAAI,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IACnD,YAAY,CAAC,OAAO,EAAE,QAAQ,GAAG,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;CAIvE"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare class CNSInstanceNeuronQueue<TNeuron extends {
|
|
2
|
+
readonly index: number;
|
|
2
3
|
concurrency?: number;
|
|
3
4
|
}> {
|
|
4
|
-
private readonly
|
|
5
|
+
private readonly gatesByNeuronIndex;
|
|
5
6
|
run(neuron: TNeuron, fn: () => (() => void) | Promise<() => void>): (() => void) | Promise<() => void>;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=CNSInstanceNeuronQueue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSInstanceNeuronQueue.d.ts","sourceRoot":"","sources":["../src/CNSInstanceNeuronQueue.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAsB,CAC/B,OAAO,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE;
|
|
1
|
+
{"version":3,"file":"CNSInstanceNeuronQueue.d.ts","sourceRoot":"","sources":["../src/CNSInstanceNeuronQueue.ts"],"names":[],"mappings":"AAAA,qBAAa,sBAAsB,CAC/B,OAAO,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE;IAEhE,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAoE;IAEvG,GAAG,CACC,MAAM,EAAE,OAAO,EACf,EAAE,EAAE,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC,GAC7C,CAAC,MAAM,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,IAAI,CAAC;CAmDxC"}
|
package/dist/CNSNetwork.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type { ICNSCollateral } from '@cnstra/types';
|
|
1
|
+
import type { ICNSCollateral, TCNSAfferentPath, TCNSModality } from '@cnstra/types';
|
|
2
2
|
import { TCNSNeuron } from '@cnstra/types';
|
|
3
3
|
import { TCNSSubscriber } from '@cnstra/types';
|
|
4
4
|
import { TCNSDendrite } from '@cnstra/types';
|
|
5
|
-
export declare class CNSNetwork<TNeuron extends TCNSNeuron<any
|
|
5
|
+
export declare class CNSNetwork<TNeuron extends TCNSNeuron<any>, TDendrite extends TCNSDendrite<any, any, any>> {
|
|
6
6
|
private readonly neurons;
|
|
7
7
|
/**
|
|
8
8
|
* Strongly Connected Components of the neuron graph.
|
|
9
9
|
* Each component is a set of neuron objects that can reach each other.
|
|
10
10
|
*
|
|
11
|
-
* Computed lazily on first access: the SCC machinery
|
|
12
|
-
*
|
|
11
|
+
* Computed lazily on first access: the SCC machinery only drives graph
|
|
12
|
+
* introspection (`getSCCSetByNeuron`, `canNeuronBeGuaranteedDone`), so a
|
|
13
|
+
* network that never inspects reachability never pays for it.
|
|
13
14
|
*/
|
|
14
15
|
private _stronglyConnectedComponents;
|
|
15
16
|
private sccBuilt;
|
|
@@ -30,11 +31,14 @@ export declare class CNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite
|
|
|
30
31
|
* Fast lookup: collateral -> list of (neuron, dendrite) subscribers.
|
|
31
32
|
* Built once at construction time.
|
|
32
33
|
*/
|
|
33
|
-
private
|
|
34
|
+
private subscribersByCollateralIndex;
|
|
35
|
+
private allSubscribersByCollateralIndex;
|
|
36
|
+
private modalityCollateralIndices;
|
|
37
|
+
private subscriberTablesByModalityIndex;
|
|
34
38
|
private parentNeuronByCollateral;
|
|
35
39
|
constructor(neurons: TNeuron[]);
|
|
36
40
|
/** Build the SCC analysis the first time anything needs it. */
|
|
37
|
-
private
|
|
41
|
+
private buildSccIndex;
|
|
38
42
|
/**
|
|
39
43
|
* Build the neuron graph where neurons are connected if one can stimulate the other.
|
|
40
44
|
*/
|
|
@@ -67,7 +71,11 @@ export declare class CNSNetwork<TNeuron extends TCNSNeuron<any, any>, TDendrite
|
|
|
67
71
|
* This is the core logic for safe context cleanup.
|
|
68
72
|
*/
|
|
69
73
|
canNeuronBeGuaranteedDone(neuron: TNeuron, activeSccCounts: Map<number, number>): boolean;
|
|
74
|
+
private describeNeuron;
|
|
75
|
+
private describeCollateral;
|
|
70
76
|
private buildIndexes;
|
|
77
|
+
getSubscriberTable(modality: TCNSModality | undefined, afferentPath: TCNSAfferentPath | undefined): TCNSSubscriber<TNeuron, TDendrite>[][];
|
|
78
|
+
private buildSubscriberTable;
|
|
71
79
|
getParentNeuronByCollateral(collateral: ICNSCollateral<unknown>): TNeuron | undefined;
|
|
72
80
|
getDendrites(): TDendrite[];
|
|
73
81
|
getCollaterals(): ICNSCollateral<unknown>[];
|
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,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"CNSNetwork.d.ts","sourceRoot":"","sources":["../src/CNSNetwork.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAK7C,qBAAa,UAAU,CACnB,OAAO,SAAS,UAAU,CAAC,GAAG,CAAC,EAC/B,SAAS,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,EA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zC,OAAO,CAAC,oBAAoB;IAgCrB,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;CAM1C"}
|
package/dist/CNSStimulation.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ICNSCollateral } from '@cnstra/types';
|
|
2
|
-
import { ICNSStimulationContextStore } from '@cnstra/types';
|
|
3
2
|
import { TCNSStimulationOptions } from '@cnstra/types';
|
|
4
3
|
import { TCNSNeuron } from '@cnstra/types';
|
|
5
4
|
import { TCNSDendrite } from '@cnstra/types';
|
|
@@ -7,14 +6,14 @@ import { TCNSSubscriber } from '@cnstra/types';
|
|
|
7
6
|
import { CNSInstanceNeuronQueue } from './CNSInstanceNeuronQueue';
|
|
8
7
|
import { TCNSSignal } from '@cnstra/types';
|
|
9
8
|
import { TCNSNeuronActivationTask } from '@cnstra/types';
|
|
9
|
+
import { TCNSContextStore } from '@cnstra/types';
|
|
10
10
|
import { CNS } from './CNS';
|
|
11
11
|
import { TCNSNeuronActivationTaskFailure } from '@cnstra/types';
|
|
12
12
|
import { TCNSStimulationResponse } from '@cnstra/types';
|
|
13
13
|
import { TCNSStimulationDrain } from '@cnstra/types';
|
|
14
|
-
export declare class CNSStimulation<TNeuron extends TCNSNeuron<any
|
|
14
|
+
export declare class CNSStimulation<TNeuron extends TCNSNeuron<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;
|
|
17
|
-
private ctxStore?;
|
|
18
17
|
private qItems?;
|
|
19
18
|
private qHead;
|
|
20
19
|
private qTail;
|
|
@@ -25,7 +24,11 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
25
24
|
private pumping;
|
|
26
25
|
private needsPump;
|
|
27
26
|
private turnDepth;
|
|
28
|
-
private readonly
|
|
27
|
+
private readonly neuronVisitCounts?;
|
|
28
|
+
private readonly subscribersByCollateralIndex;
|
|
29
|
+
/** Read on every dequeue; both are fixed for the life of the stimulation. */
|
|
30
|
+
private readonly concurrencyLimit;
|
|
31
|
+
private readonly abortSignal?;
|
|
29
32
|
private readonly instanceNeuronQueue;
|
|
30
33
|
private scheduledCount;
|
|
31
34
|
private reservedActivations;
|
|
@@ -49,17 +52,10 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
49
52
|
* stimulation with no drain listener pays only the turn depth counter.
|
|
50
53
|
*/
|
|
51
54
|
private readonly onDrain?;
|
|
52
|
-
/**
|
|
53
|
-
* Track active SCCs: SCC index -> count of active neurons in that SCC.
|
|
54
|
-
* Only allocated when context auto-cleanup is enabled.
|
|
55
|
-
*/
|
|
56
|
-
private readonly activeSccCounts?;
|
|
57
55
|
constructor(cns: CNS<TNeuron, TDendrite>, instanceNeuronQueue: CNSInstanceNeuronQueue<TNeuron>, options?: TCNSStimulationOptions<TCNSStimulationResponse> | undefined, onResponse?: (response: TCNSStimulationResponse) => void | Promise<void>, onDrain?: (drain: TCNSStimulationDrain) => void);
|
|
58
56
|
private pushFailedTask;
|
|
59
57
|
private finalizeResolve;
|
|
60
58
|
private finalizeReject;
|
|
61
|
-
/** Lazily-created neuron context store (see {@link ctxStore}). */
|
|
62
|
-
private get ctx();
|
|
63
59
|
private get canStartOperation();
|
|
64
60
|
private qResize;
|
|
65
61
|
private qDequeue;
|
|
@@ -85,18 +81,33 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
85
81
|
*/
|
|
86
82
|
private endTurn;
|
|
87
83
|
/**
|
|
88
|
-
* Activations that exist (or are reserved) but whose dendrite
|
|
89
|
-
* been invoked yet: sitting in the ring buffer, created and held in
|
|
84
|
+
* Activations that exist (or are reserved) but whose dendrite response has
|
|
85
|
+
* not been invoked yet: sitting in the ring buffer, created and held in
|
|
90
86
|
* pendingTasks, or reserved by an array fan-out mid-dispatch. Subscribers
|
|
91
87
|
* parked behind an async onResponse land here too - their body has not run.
|
|
92
88
|
*/
|
|
93
89
|
private get pendingActivations();
|
|
90
|
+
/**
|
|
91
|
+
* End the run because the machinery itself threw. Dendrite bodies never get
|
|
92
|
+
* here - runStarter catches those and records them as failed tasks; what
|
|
93
|
+
* lands here is a throw from dispatch, today the hop-limit guard in
|
|
94
|
+
* createSubscriberQueueItem. Nothing settles the counters after such a
|
|
95
|
+
* throw, so completion has to be forced: without it the stimulation neither
|
|
96
|
+
* resolves nor rejects, and a worker holds a job that never finishes and
|
|
97
|
+
* never fails.
|
|
98
|
+
*/
|
|
99
|
+
private endRunWithError;
|
|
94
100
|
private tryResolveCompleted;
|
|
95
101
|
waitUntilComplete(): Promise<void>;
|
|
96
102
|
/**
|
|
97
103
|
* Returns all current activation tasks: queued, active, and pending (scheduled but not yet enqueued)
|
|
98
104
|
*/
|
|
99
105
|
getAllActivationTasks(): TCNSNeuronActivationTask<TNeuron>[];
|
|
106
|
+
private getSubscribers;
|
|
107
|
+
private addPositionedTask;
|
|
108
|
+
private removePositionedTask;
|
|
109
|
+
private removeActiveTask;
|
|
110
|
+
private removePendingTask;
|
|
100
111
|
/**
|
|
101
112
|
* Returns all tasks that failed or were aborted
|
|
102
113
|
*/
|
|
@@ -107,44 +118,33 @@ export declare class CNSStimulation<TNeuron extends TCNSNeuron<any, any>, TDendr
|
|
|
107
118
|
* failed/aborted tasks. This is the set to persist for resume: re-activating
|
|
108
119
|
* it re-runs exactly the not-yet-done work. Safe to call at any point during
|
|
109
120
|
* a run (for progress) or after it fails.
|
|
121
|
+
*
|
|
122
|
+
* Each task appears exactly once. The two sources overlap: aborting marks
|
|
123
|
+
* every still-queued task as failed without dequeuing it, so a task sits in
|
|
124
|
+
* the ring buffer AND in failedTasks. Concatenating them blindly handed the
|
|
125
|
+
* broker a checkpoint with the whole queued frontier listed twice, and the
|
|
126
|
+
* resumed run re-executed every one of those tasks a second time - duplicate
|
|
127
|
+
* charges, emails and POSTs on every graceful shutdown.
|
|
110
128
|
*/
|
|
111
129
|
getOutstandingTasks(): TCNSNeuronActivationTask<TNeuron>[];
|
|
112
|
-
/**
|
|
113
|
-
* Get the context store for this stimulation
|
|
114
|
-
*/
|
|
115
|
-
getContext(): ICNSStimulationContextStore;
|
|
116
130
|
/**
|
|
117
131
|
* Enqueue activation tasks directly into the stimulation queue
|
|
118
132
|
*/
|
|
119
133
|
enqueueTasks(tasks: TCNSNeuronActivationTask<TNeuron>[]): void;
|
|
120
134
|
protected get concurrencyEnabled(): boolean;
|
|
121
|
-
protected get autoCleanupContextsEnabled(): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Mark a neuron as active (being processed)
|
|
124
|
-
*/
|
|
125
|
-
protected markNeuronActive(neuron: TNeuron): void;
|
|
126
|
-
/**
|
|
127
|
-
* Mark a neuron as inactive (finished processing)
|
|
128
|
-
*/
|
|
129
|
-
protected markNeuronInactive(neuron: TNeuron): void;
|
|
130
|
-
/**
|
|
131
|
-
* Increment the active count for the SCC containing this neuron
|
|
132
|
-
*/
|
|
133
|
-
private incrementSccCount;
|
|
134
|
-
/**
|
|
135
|
-
* Decrement the active count for the SCC containing this neuron
|
|
136
|
-
*/
|
|
137
|
-
private decrementSccCount;
|
|
138
|
-
/**
|
|
139
|
-
* Check if a neuron can be guaranteed not to be visited again
|
|
140
|
-
*/
|
|
141
|
-
protected canNeuronBeGuaranteedDone(neuron: TNeuron): boolean;
|
|
142
|
-
protected cleanupCtxIfNeeded(neuron: TNeuron): void;
|
|
143
135
|
protected createSubscriberQueueItem(subscriber: TCNSSubscriber<TNeuron, TDendrite>, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>): TCNSNeuronActivationTask<TNeuron>;
|
|
144
136
|
private executeActivationTask;
|
|
145
137
|
private runStarter;
|
|
146
|
-
protected processResponseOrResponses(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>, outputSignalOrSignals?: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[], error?: any): void;
|
|
147
|
-
|
|
138
|
+
protected processResponseOrResponses(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>, outputSignalOrSignals?: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[], error?: any, startedAt?: number, activationContext?: TCNSContextStore): void;
|
|
139
|
+
/**
|
|
140
|
+
* The one response an aborted run emits: no neuron, no signals, an empty
|
|
141
|
+
* queue. It exists so `queueLength === 0` — the completion condition every
|
|
142
|
+
* listener uses — is reached on the abort path too. Listener errors are
|
|
143
|
+
* swallowed: the run is already over and rejecting, and there is nothing
|
|
144
|
+
* left to fail.
|
|
145
|
+
*/
|
|
146
|
+
private emitAbortedResponse;
|
|
147
|
+
protected processResponse(emitter: TNeuron | undefined, inputSignal?: TCNSSignal<ICNSCollateral<unknown>>, outputSignal?: TCNSSignal<ICNSCollateral<unknown>>, error?: any, startedAt?: number, duration?: number, activationContext?: TCNSContextStore): void;
|
|
148
148
|
responseToSignal(signalOrSignals: TCNSSignal<ICNSCollateral<unknown>> | TCNSSignal<ICNSCollateral<unknown>>[]): void;
|
|
149
149
|
}
|
|
150
150
|
//# sourceMappingURL=CNSStimulation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CNSStimulation.d.ts","sourceRoot":"","sources":["../src/CNSStimulation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"CNSStimulation.d.ts","sourceRoot":"","sources":["../src/CNSStimulation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACp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U,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACnC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,EAC3C,KAAK,CAAC,EAAE,GAAG,EACX,SAAS,CAAC,EAAE,MAAM,EAKlB,iBAAiB,CAAC,EAAE,gBAAgB,GACrC,IAAI;IAgGP;;;;;;OAMG;IACH,OAAO,CAAC,mBAAmB;IA0B3B,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,EACX,SAAS,CAAC,EAAE,MAAM,EAClB,QAAQ,CAAC,EAAE,MAAM,EACjB,iBAAiB,CAAC,EAAE,gBAAgB,GACrC,IAAI;IAiKA,gBAAgB,CACnB,eAAe,EACT,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,GACnC,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,GAC5C,IAAI;CA0BV"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { TCNSNeuron, TCNSOptions } from '@cnstra/types';
|
|
2
|
+
import { CNS } from './CNS';
|
|
3
|
+
export declare const createCNS: <TDependencies>(neuronFactories: readonly ((dependencies: TDependencies) => TCNSNeuron<any>)[], dependencies: TDependencies, options?: TCNSOptions) => CNS<TCNSNeuron<any>>;
|
|
4
|
+
//# sourceMappingURL=createCNS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCNS.d.ts","sourceRoot":"","sources":["../src/createCNS.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,eAAO,MAAM,SAAS,GAAI,aAAa,EACnC,iBAAiB,SAAS,CAAC,CAAC,YAAY,EAAE,aAAa,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,EAC9E,cAAc,aAAa,EAC3B,UAAU,WAAW,KACtB,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAKrB,CAAC"}
|