@mindot/will 0.8.0 → 0.10.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 (142) hide show
  1. package/README.md +15 -11
  2. package/dist/index.d.ts +188 -141
  3. package/dist/index.js +6985 -3337
  4. package/dist/index.js.map +1 -1
  5. package/dist/surface/channels/discord.d.ts +177 -0
  6. package/dist/surface/channels/discord.js +394 -0
  7. package/dist/surface/channels/discord.js.map +1 -0
  8. package/dist/{channels → surface/channels}/whatsapp.d.ts +2 -2
  9. package/dist/{channels → surface/channels}/whatsapp.js +11 -5
  10. package/dist/surface/channels/whatsapp.js.map +1 -0
  11. package/dist/{cli.js → surface/cli.js} +5382 -1573
  12. package/dist/surface/cli.js.map +1 -0
  13. package/dist/{mcp → surface/mcp}/effectors.d.ts +1 -1
  14. package/dist/{mcp → surface/mcp}/effectors.js +10 -4
  15. package/dist/surface/mcp/effectors.js.map +1 -0
  16. package/dist/{will-cS6k4uiJ.d.ts → will-evj9_vrd.d.ts} +6658 -5078
  17. package/package.json +11 -12
  18. package/src/cognition/agency/consequence.ts +356 -1
  19. package/src/cognition/agency/conversation.aim.ts +292 -0
  20. package/src/cognition/agency/engines/action.selector.ts +142 -5
  21. package/src/cognition/agency/engines/affordance.synthesizer.ts +200 -7
  22. package/src/cognition/agency/engines/deliberation.engine.ts +76 -3
  23. package/src/cognition/agency/engines/motor.schema.executor.ts +509 -32
  24. package/src/cognition/agency/engines/reafference.engine.ts +160 -4
  25. package/src/cognition/agency/execution.primitives.ts +17 -4
  26. package/src/cognition/agency/proactive.communicator.ts +19 -3
  27. package/src/cognition/agency/reconcile.learning.ts +5 -4
  28. package/src/cognition/agency/restart.ts +66 -0
  29. package/src/cognition/agency/schemas/innate.ts +96 -1
  30. package/src/cognition/agency/schemas/repertoire.ts +19 -1
  31. package/src/cognition/agency/selection.scoring.ts +49 -0
  32. package/src/cognition/agency/settlement.ts +203 -0
  33. package/src/cognition/agency/types.ts +73 -1
  34. package/src/cognition/cache/composition.ts +232 -0
  35. package/src/cognition/cache/deliberation.cache.ts +219 -0
  36. package/src/cognition/cache/fingerprint.ts +120 -0
  37. package/src/cognition/cache/types.ts +105 -0
  38. package/src/cognition/config.mirror.entities.ts +108 -1
  39. package/src/cognition/event.schemas.ts +22 -8
  40. package/src/cognition/faculties/affective.blender.ts +21 -4
  41. package/src/cognition/faculties/autobiographical.narrator.ts +5 -10
  42. package/src/cognition/faculties/circadian.oscillator.ts +36 -7
  43. package/src/cognition/faculties/episodic.consolidator.ts +59 -3
  44. package/src/cognition/faculties/executive.engine/action.record.ts +129 -0
  45. package/src/cognition/faculties/executive.engine/commands.ts +189 -14
  46. package/src/cognition/faculties/executive.engine/context.ts +106 -46
  47. package/src/cognition/faculties/executive.engine/deliberate.reasoning.ts +1 -1
  48. package/src/cognition/faculties/executive.engine/engine.ts +714 -136
  49. package/src/cognition/faculties/executive.engine/escalation.buffer.ts +230 -45
  50. package/src/cognition/faculties/executive.engine/facet.supervisor.ts +320 -65
  51. package/src/cognition/faculties/executive.engine/facet.ts +81 -26
  52. package/src/cognition/faculties/executive.engine/gating.ts +14 -14
  53. package/src/cognition/faculties/executive.engine/parser.ts +120 -38
  54. package/src/cognition/faculties/executive.engine/prompt.factory.ts +331 -38
  55. package/src/cognition/faculties/executive.engine/types.ts +84 -12
  56. package/src/cognition/faculties/exteroception.ts +99 -98
  57. package/src/cognition/faculties/goal.manager.ts +144 -16
  58. package/src/cognition/faculties/known.entity.tracker.ts +287 -29
  59. package/src/cognition/faculties/moral.evaluator.ts +8 -3
  60. package/src/cognition/faculties/persona.consolidator.ts +141 -0
  61. package/src/cognition/faculties/planning.engine/engine.ts +4 -4
  62. package/src/cognition/faculties/planning.engine/plan.frontier.ts +1 -1
  63. package/src/cognition/faculties/reputation.tracker.ts +66 -2
  64. package/src/cognition/faculties/self.model.updater.ts +19 -12
  65. package/src/cognition/faculties/semantic.engine/integrator.ts +1 -1
  66. package/src/cognition/faculties/social.perception.ts +47 -3
  67. package/src/cognition/faculties/threat.evaluator.ts +7 -0
  68. package/src/cognition/faculties/working.memory.ts +16 -21
  69. package/src/cognition/identity.entity.ts +205 -0
  70. package/src/cognition/index.ts +7 -0
  71. package/src/cognition/instruction.handler.ts +1 -1
  72. package/src/cognition/memory/vector.adapter.ts +12 -3
  73. package/src/cognition/memory/vector.embedder.ts +45 -4
  74. package/src/cognition/percept.entity.ts +122 -0
  75. package/src/cognition/persona.prior.ts +6 -0
  76. package/src/cognition/sense.boundary.ts +176 -0
  77. package/src/cognition/senses/audition.engine/engine.ts +492 -53
  78. package/src/cognition/senses/base.sense.engine.ts +105 -7
  79. package/src/cognition/senses/index.ts +83 -13
  80. package/src/cognition/senses/provenance.ts +128 -0
  81. package/src/cognition/senses/somatosensation.engine.ts +117 -9
  82. package/src/cognition/social.identity.ts +296 -0
  83. package/src/cognition/utilities/token.tracker.ts +94 -10
  84. package/src/core/orchestrator.ts +51 -0
  85. package/src/index.ts +39 -5
  86. package/src/llm/gate.ts +48 -0
  87. package/src/llm/index.ts +127 -33
  88. package/src/llm/routing.ts +6 -0
  89. package/src/llm/summarizer.ts +1 -1
  90. package/src/llm/wire.contracts.ts +57 -0
  91. package/src/pma/index.ts +68 -54
  92. package/src/stem/assembly.audit.ts +1 -0
  93. package/src/stem/guards/identity.coherence.ts +1 -1
  94. package/src/stem/index.ts +171 -23
  95. package/src/stem/mind.ts +198 -57
  96. package/src/stem/policy/arbiter.ts +10 -0
  97. package/src/stem/profiles/built-in.ts +7 -0
  98. package/src/{profiles → stem/profiles}/companion.ts +1 -1
  99. package/src/{profiles → stem/profiles}/company-brain.ts +1 -1
  100. package/src/{profiles → stem/profiles}/customer-service.ts +1 -1
  101. package/src/{profiles → stem/profiles}/game-npc.ts +1 -1
  102. package/src/{profiles → stem/profiles}/index.ts +1 -1
  103. package/src/{profiles → stem/profiles}/smart-home.ts +1 -1
  104. package/src/stem/tracts/effector/escalation.lifecycle.ts +239 -0
  105. package/src/stem/tracts/effector/policy.enforcement.ts +261 -0
  106. package/src/stem/tracts/effector/types.ts +110 -0
  107. package/src/stem/tracts/effector.controller.ts +112 -401
  108. package/src/stem/tracts/outbox.controller.ts +30 -17
  109. package/src/stem/tracts/outbox.writer.ts +40 -2
  110. package/src/stem/tracts/sensory.controller.ts +6 -6
  111. package/src/stem/tracts/session.logger.ts +6 -1
  112. package/src/stem/tracts/transport/types.ts +20 -1
  113. package/src/stem/tracts/transport.controller.ts +33 -9
  114. package/src/surface/channels/discord.ts +609 -0
  115. package/src/{channels → surface/channels}/roster.ts +1 -1
  116. package/src/surface/channels/types.ts +136 -0
  117. package/src/{channels → surface/channels}/whatsapp.ts +22 -10
  118. package/src/{cli.ts → surface/cli.ts} +14 -9
  119. package/src/{host → surface/host}/boot.ts +3 -3
  120. package/src/{host → surface/host}/utterances.ts +2 -2
  121. package/src/{mcp → surface/mcp}/effectors.ts +19 -6
  122. package/src/{mcp → surface/mcp}/server.ts +19 -5
  123. package/src/{sdk → surface/sdk}/will.ts +194 -33
  124. package/src/{serve → surface/serve}/server.ts +11 -4
  125. package/src/types.ts +24 -3
  126. package/dist/channels/discord.d.ts +0 -69
  127. package/dist/channels/discord.js +0 -193
  128. package/dist/channels/discord.js.map +0 -1
  129. package/dist/channels/whatsapp.js.map +0 -1
  130. package/dist/cli.js.map +0 -1
  131. package/dist/mcp/effectors.js.map +0 -1
  132. package/src/channels/discord.ts +0 -214
  133. package/src/channels/types.ts +0 -46
  134. package/src/cognition/faculties/executive.engine/messages.ts +0 -102
  135. package/src/extensions/livestream.ext.ts +0 -570
  136. package/src/extensions/time.ext.ts +0 -339
  137. package/src/profiles/built-in.ts +0 -7
  138. package/src/runners/coherence.runner.ts +0 -49
  139. package/src/runners/outreach.runner.ts +0 -155
  140. package/src/runners/social.runner.ts +0 -179
  141. package/src/runners/thin-shim.runner.ts +0 -205
  142. /package/dist/{cli.d.ts → surface/cli.d.ts} +0 -0
package/README.md CHANGED
@@ -36,7 +36,7 @@ Embed it six ways — [**SDK facade**](#the-will-sdk-facade--recommended) (Node/
36
36
  | Personality: a prompt string | Five-factor trait model that *develops* — traits self-tune from experience and carry a learned baseline across restarts |
37
37
  | No self-improvement | A closing metacognition loop — introspection writes back into the engine apparatus (accommodation), bounded and surprise-gated |
38
38
  | Token blowout at tick 600 | Context windowing — rolling summariser + isolated conversation threads |
39
- | Fire-and-forget actions | Bidirectional effector ack loop — the host confirms execution; the result feeds back as a percept |
39
+ | Fire-and-forget actions | Bidirectional effector ack loop — the host confirms execution; the result feeds back through reafference |
40
40
  | Fixed effector catalog | Learning agency pipeline — actions are *found in the situation*, enacted, and proceduralised into composite skills via reafference |
41
41
  | No identity across restarts | A portable, eval-verified mind artifact (PMA) — psychology **and** learned competence, with a measured reconstruction-fidelity score |
42
42
 
@@ -141,9 +141,11 @@ WILL_IDENTITY="I am Aria — curious, dry-witted, fond of this server's people."
141
141
  ANTHROPIC_API_KEY=sk-ant-… npx -y @mindot/will discord
142
142
  ```
143
143
 
144
- No command prefix, no forced replies. It perceives the rooms it can see (salience-scored — perceiving costs no LLM call), **decides for itself when to speak** (silence is a valid outcome), learns people's names as *learned* knowledge (`discord:<userId>` is one entity across servers), keeps each channel as its own conversation thread, and **can message first** — proactive utterances route to the addressee's last shared channel, then their DM, then `WILL_DISCORD_HOME_CHANNEL`. On shutdown it hibernates to its PMA and returns as the same self, still knowing everyone.
144
+ No command prefix, no forced replies. It perceives the rooms it can see (salience-scored — perceiving costs no LLM call), **decides for itself when to speak** (silence is a valid outcome, written as `[NO_MESSAGE]` and recorded rather than sent), learns people's names as *learned* knowledge, keeps each channel as its own conversation thread, and **can message first**. On shutdown it hibernates to its PMA and returns as the same self, still knowing everyone.
145
145
 
146
- Scope it with `WILL_DISCORD_CHANNELS` (id allowlist) and `WILL_DISCORD_MENTION_ONLY` for busy servers. The bridge grants no tools it is a mouth and ears, not hands; abilities stay explicit (effectors / MCP). Setup + SDK embedding (`import { connectDiscord } from '@mindot/will/discord'`): [docs/channels/discord.md](docs/channels/discord.md) · runnable: [`examples/discord.ts`](examples/discord.ts).
146
+ Someone the Will meets is a **referent**, not an address: `discord:<userId>` becomes an alias onto an anchor, so the same person met in a server, a DM, and on WhatsApp is one entity rather than three. The rooms they are reachable in hang off that anchor as handles carrying the circumstances — private or shared, and when they last *answered* there so the mind picks where to say something from evidence about where this person actually replies. `WILL_DISCORD_HOME_CHANNEL` and the roster chain (last shared channel → DM → home) remain the bridge's fallback for when it has nothing to go on.
147
+
148
+ Scope it with `WILL_DISCORD_CHANNELS` (id allowlist) and `WILL_DISCORD_MENTION_ONLY` for busy servers. The bridge answers one innate act and grants nothing else: when the Will **inspects** a room it is already in, Discord replies with what that room is for, what it sits under, and how many are in it — a count, never a roster, because people are met rather than listed. The answer arrives as a *percept* it perceives and judges, not as a value written into it. Everything beyond that stays explicit (effectors / MCP). Setup + SDK embedding (`import { connectDiscord } from '@mindot/will/discord'`): [docs/channels/discord.md](docs/channels/discord.md) · runnable: [`examples/discord.ts`](examples/discord.ts).
147
149
 
148
150
  ### The MCP server — a persistent mind in Claude Desktop / Claude Code
149
151
 
@@ -246,7 +248,7 @@ manager.addTickListener(willId, (snapshot, tick, outbox, invocations) => {
246
248
  })
247
249
 
248
250
  // Speak to the Will. The reply arrives on a later tick via the listener above.
249
- await manager.ingestText(willId, {
251
+ await manager.senseText(willId, {
250
252
  kind: 'text',
251
253
  entityId: 'alice',
252
254
  content: 'How are you feeling about the night shift?',
@@ -254,13 +256,13 @@ await manager.ingestText(willId, {
254
256
  })
255
257
  ```
256
258
 
257
- There is **no synchronous reply** — `ingestText` returns immediately; the Will answers when it has reasoned. Subscribe to the tick listener *before* (or right after) sending, and treat the outbox as the single source of outbound messages and effector calls.
259
+ There is **no synchronous reply** — `senseText` returns immediately; the Will answers when it has reasoned. Subscribe to the tick listener *before* (or right after) sending, and treat the outbox as the single source of outbound messages and effector calls.
258
260
 
259
261
  ---
260
262
 
261
263
  ## Architecture
262
264
 
263
- > **Visual map:** [`docs/graphs/`](docs/graphs/) holds twenty-one architecture graphs — the cognitive stories (memory, executive & facets, agency, audition, body & affect, meta-cognition, the executive ⇄ agency seam, planning & goals, social cognition, proactive communication, competence, the two persona channels), the machinery (the deterministic tick, the simulation core, the cognitive bus & wiring, one LLM call end-to-end, transports, the stem's tracts), the edges (host surfaces, the PMA lifecycle), and the [whole composition](docs/graphs/composition.svg). One palette across all of them: violet is always memory, amber executive, green agency. Regenerate with `bun docs/graphs/generate.ts`.
265
+ > **Visual map:** [`docs/graphs/`](docs/graphs/) holds twenty-eight architecture graphs — the cognitive stories (memory, executive & facets, agency, audition, body & affect, meta-cognition, the executive ⇄ agency seam, planning & goals, social cognition, proactive communication, competence, the two persona channels), the loops that close on the world (exafference, policy reafference and its joint RFC, the answered loop, identity vs route, the signal boundary), the machinery (the deterministic tick, the simulation core, the cognitive bus & wiring, one LLM call end-to-end, model routing, transports, the stem's tracts), the edges (host surfaces, the PMA lifecycle), and the [whole composition](docs/graphs/composition.svg). One palette across all of them: violet is always memory, amber executive, green agency. Regenerate with `bun docs/graphs/generate.ts`.
264
266
 
265
267
  ![Will — the whole composition](docs/graphs/composition.svg)
266
268
 
@@ -329,6 +331,8 @@ A plan does **not** dispatch steps to an executor down a parallel channel. It pr
329
331
 
330
332
  A Will does not own a catalog of effectors it looks up. Capability is a **relation between a body-in-a-state and a world-as-perceived**, not a row in a table. So the Will **finds actions in the situation**: perception synthesises a field of *affordances*, a biased competition selects one, the executor enacts it, and the outcome (reafference) updates competence.
331
333
 
334
+ Which is why there is a **sense boundary**. Cognition and world share one entity map, so the outward senses have to be told where the mind ends — otherwise it perceives its own bookkeeping as world events and the situation it finds actions in is made of itself. The mind's own types are enumerable (it knows its anatomy); the world's are not, so everything undeclared is world by default and a host can introduce anything. An engine that writes about the mind says so with `writes`; see [`src/cognition/sense.boundary.ts`](src/cognition/sense.boundary.ts).
335
+
332
336
  ```
333
337
  senses → percepts
334
338
  → AffordanceSynthesizer affordance field (no LLM · attention-gated)
@@ -362,14 +366,14 @@ registerProfile({
362
366
  manager.addTickListener(willId, (snap, tick, outbox, invocations) => {
363
367
  for (const inv of invocations) {
364
368
  const result = world.execute(inv) // YOUR world runs the action
365
- manager.confirmEffectorExecution(willId, inv.decisionRecordId, {
369
+ manager.confirmEffectorExecution(willId, inv.intentId, {
366
370
  success: result.ok, description: result.summary, metrics: result.metrics,
367
371
  })
368
372
  }
369
373
  })
370
374
  ```
371
375
 
372
- The acked outcome returns as an `effector.result` percept and feeds the agency learning loop — so the Will gets *better* at your effectors over time, and that learned competence travels in the PMA. (Today external effectors are objectless: the host resolves the target. Per-effector cost/preconditions and entity-targeting are on the roadmap.)
376
+ The acked outcome returns as an `action.outcome` the ReafferenceEngine reconciles against what the Will expected, and feeds the agency learning loop — so the Will gets *better* at your effectors over time, and that learned competence travels in the PMA. (Today external effectors are objectless: the host resolves the target. Per-effector cost/preconditions and entity-targeting are on the roadmap.)
373
377
 
374
378
  ### Senses
375
379
 
@@ -398,7 +402,7 @@ When a Will decides to communicate or invoke an external effector, the result go
398
402
  - **`outbox`** — `OutboxMessage[]` — text/speech bubbles to deliver. Each has `deliveryStatus: 'pending' | 'delivered' | 'failed'`.
399
403
  - **`pendingEffectorInvocations`** — `EffectorInvocation[]` — structured action requests, each carrying a correlation handle.
400
404
 
401
- The host closes the reafference loop by confirming back — which writes an `effector.result` percept into Exteroception, so the Will *learns what happened*:
405
+ The host closes the reafference loop by confirming back — which writes an `action.outcome` the ReafferenceEngine reconciles, so the Will *learns what happened*:
402
406
 
403
407
  ```typescript
404
408
  manager.confirmMessageDelivery(willId, messageId, true)
@@ -641,7 +645,7 @@ await manager.archiveWill(willId) // stops tick loop, persists final snapshot
641
645
  // Every tick — drain outbox + effector invocations, push to SSE/WS clients
642
646
  const unsub = manager.addTickListener(willId, (snapshot, tick, outbox, invocations) => {
643
647
  for (const msg of outbox) pushToClient(msg) // .id .content .effectorName .targetEntityId .deliveryStatus
644
- for (const inv of invocations) dispatchToWorld(inv) // .decisionRecordId ← correlation handle
648
+ for (const inv of invocations) dispatchToWorld(inv) // .intentId ← correlation handle
645
649
  })
646
650
 
647
651
  // Fine-grained simulation events (goal.formed, belief.updated, emotion.spike, …)
@@ -696,7 +700,7 @@ manager.loadPMA(willId, pma)
696
700
  const report = await manager.runPMAEval(willId, { behavioral: true })
697
701
 
698
702
  // Senses — route external input through the sense engines
699
- await manager.ingestText(willId, { kind: 'text', entityId, content, speakerName })
703
+ await manager.senseText(willId, { kind: 'text', entityId, content, speakerName })
700
704
  manager.getSenseEngineStatus(willId) // five domains; audition active
701
705
 
702
706
  // Health & recovery
package/dist/index.d.ts CHANGED
@@ -1,143 +1,5 @@
1
- import { O as OutboundEnvelope, A as AckResult, a as ExternalTransport, I as InboundEnvelope, T as TransportStatus, S as SimulationContext, b as SeededPRNG, c as SimulationEntity, d as Timestamp, e as SimulationEvent, f as StateManager, g as Tick, h as SimulationState, R as RestoreOptions, i as StateCommands, j as ReasoningFootprint, k as ReadonlySimulationState, C as ConflictReport, l as ConflictStrategy, m as ConflictResolution } from './will-cS6k4uiJ.js';
2
- export { n as AckEnvelope, o as ActionRequest, p as ActionResult, q as ActionSelector, r as ActivityEnvelope, s as ActivityEvent, t as ActivityEventHandler, u as AestheticEvaluator, v as AestheticEvaluatorConfig, w as AffectiveBlender, x as AffectiveBlenderConfig, y as AffordanceSynthesizer, z as AsyncEngine, B as AsyncEngineConfig, D as AttachmentEvaluator, F as AttachmentEvaluatorConfig, G as AttentionAllocator, H as AttentionAllocatorConfig, J as AuditionEngine, K as AutobiographicalNarrator, L as AutobiographicalNarratorConfig, M as BACKGROUND_DEMAND, N as BehavioralProbeResult, P as BiasDetector, Q as BiasDetectorConfig, U as BunStorageAdapter, V as ChunkEnvelope, X as CircadianConfig, Y as CircadianOscillator, Z as ClockConfig, _ as Cognition, $ as CognitiveHealth, a0 as ConfidenceCalibrator, a1 as ConfidenceCalibratorConfig, a2 as Coordinates, a3 as CreateWillOptions, a4 as DefaultEventBus, a5 as DefaultMetricCollector, a6 as DefaultOrchestrator, a7 as DefaultReplayRecorder, a8 as DefaultReplaySession, a9 as DefaultScenario, aa as DefaultSerializer, ab as DefaultSimulation, ac as DefaultSimulationClock, ad as DefaultStateManager, ae as DefaultVectorMemoryAdapter, af as DeliberationEngine, ag as DeltaEncoder, ah as DeltaSnapshot, ai as DreamSimulator, aj as DreamSimulatorConfig, ak as Duration, al as ESCALATION_DEMAND, am as EffectorDeclaration, an as EffectorEntry, E as EffectorHandler, ao as EffectorResult, ap as EffectorSpec, aq as EmbeddingProvider, ar as EmpathySimulator, as as EmpathySimulatorConfig, at as EnergyRegulator, au as EnergyRegulatorConfig, av as EngineRegistry, aw as EngineResult, ax as Envelope, ay as EpisodicConsolidator, az as EpisodicConsolidatorConfig, aA as EventBus, aB as EventBusConfig, aC as EventFilter, aD as EventHandler, aE as EventPayload, aF as ExecutiveEngine, aG as ExecutiveEngineConfig, aH as Exteroception, aI as ExteroceptionConfig, aJ as ForgettingCurve, aK as ForgettingCurveConfig, aL as FrustrationEvaluator, aM as FrustrationEvaluatorConfig, aN as GoalManager, aO as GoalManagerConfig, aP as GustationEngine, aQ as InboundMessageEnvelope, aR as InboundPerceptEnvelope, aS as InhibitionController, aT as InhibitionControllerConfig, aU as Interoception, aV as InteroceptionConfig, aW as IntrospectionEngine, aX as IntrospectionEngineConfig, aY as KNOWN_PROVIDERS, aZ as KnownEntityTracker, a_ as KnownEntityTrackerConfig, a$ as KnownProvider, b0 as LLMCallMeta, b1 as LLMCompletionRecord, b2 as LLMCompletionSink, b3 as LLMProvider, b4 as LLMWire, b5 as LossEvaluator, b6 as LossEvaluatorConfig, b7 as MessageEnvelope, b8 as MetricCollector, b9 as MetricPoint, ba as MinimalContext, bb as MockEmbedder, bc as ModelPrice, bd as ModelRoute, be as ModelRouter, bf as MoralEvaluator, bg as MoralEvaluatorConfig, bh as MotorSchemaExecutor, bi as NULL_ROUTER, bj as NoveltyDetector, bk as NoveltyDetectorConfig, bl as OlfactionEngine, bm as OpenAICompatibleEmbedder, bn as Orchestrator, bo as OrchestratorConfig, bp as OutboxMessage, bq as PMABehavioral, br as PMABelief, bs as PMAEmotionalBaseline, bt as PMAEvalHarness, bu as PMAGoal, bv as PMAIdentity, bw as PMAProbe, bx as PMASnapshot, by as PerceptEnvelope, bz as PersonaConsolidator, bA as PersonaConsolidatorConfig, bB as PlanningEngine, bC as PlanningEngineConfig, bD as PriceTable, bE as ProviderCredential, bF as ReafferenceEngine, bG as ReconstructionFidelityReport, bH as ReconstructionFidelityScores, bI as RecordUsageInput, bJ as ReplayComparison, bK as ReplayConfig, bL as ReplayDifference, bM as ReplayManager, bN as ReplayMetadata, bO as ReplayRecord, bP as ReplayRecorder, bQ as ReplaySession, bR as ReplyEnvelope, bS as ReputationTracker, bT as ReputationTrackerConfig, bU as RewardEvaluator, bV as RewardEvaluatorConfig, bW as RoutingRule, bX as Scenario, bY as ScenarioConfig, bZ as ScenarioValidationResult, b_ as SchemaPrecondition, b$ as SelfModelUpdater, c0 as SelfModelUpdaterConfig, c1 as SemanticIntegrator, c2 as SemanticIntegratorConfig, c3 as SensoryInput, c4 as SerializationConfig, c5 as SerializationFormat, c6 as SerializedEntity, c7 as SerializedState, c8 as Serializer, c9 as SessionLogEnvelope, ca as Simulation, cb as SimulationClock, cc as SimulationConfig, cd as SimulationEngine, ce as SimulationEventBase, cf as SimulationEventListener, cg as SleepPressureConfig, ch as SleepPressureRegulator, ci as SocialPerception, cj as SocialPerceptionConfig, ck as SomatosensationEngine, cl as SpacedRepetition, cm as SpacedRepetitionConfig, cn as StateSnapshot, co as Stimulus, cp as StorageAdapter, cq as StressRegulator, cr as StressRegulatorConfig, cs as TableRouter, ct as TaskSwitcher, cu as TaskSwitcherConfig, cv as TextMessage, cw as TheoryOfMind, cx as TheoryOfMindConfig, cy as ThreatEvaluator, cz as ThreatEvaluatorConfig, cA as TickListener, cB as TokenLedgerRecord, cC as TokenReportEnvelope, cD as TokenTracker, cE as TokenTrackerConfig, cF as TokenUsage, cG as VectorIndex, cH as VectorMemoryAdapter, cI as VectorMemoryConfig, cJ as VectorQueryFilter, cK as VectorQueryResult, cL as VectorRecord, cM as VisionEngine, cN as VoiceChunk, W as Will, cO as WillAffect, cP as WillConfig, cQ as WillEffectorAct, cR as WillInstance, cS as WillMessage, cT as WillStateSummary, cU as WillStatus, cV as WillStem, cW as WillSummary, cX as WorkingMemory, cY as WorkingMemoryConfig, cZ as WorldEntity, c_ as WorldInterface, c$ as assembleMind, d0 as chainRouters, d1 as clearCompletionRecorder, d2 as defaultBaseFor, d3 as effectorInvocation, d4 as effectorInvocationEnvelope, d5 as getCompletionRecorder, d6 as isNullRouter, d7 as knownWireFor, d8 as resolvePricing, d9 as setCompletionRecorder } from './will-cS6k4uiJ.js';
3
-
4
- /** Decides how emit() resolves an ack for a given envelope. Default: acked via callback. */
5
- type AckPolicy = (env: OutboundEnvelope) => AckResult;
6
- declare class LoopbackTransport implements ExternalTransport {
7
- /** Every envelope passed to emit(), in order — inspect in tests. */
8
- readonly sent: OutboundEnvelope[];
9
- private _connected;
10
- private _ackPolicy;
11
- private readonly _inboundHandlers;
12
- private readonly _statusHandlers;
13
- constructor(ackPolicy?: AckPolicy);
14
- get connected(): boolean;
15
- emit(env: OutboundEnvelope): Promise<AckResult>;
16
- onInbound(handler: (env: InboundEnvelope) => void): () => void;
17
- onStatus(handler: (s: TransportStatus) => void): () => void;
18
- close(): void;
19
- /** Simulate the peer sending an inbound envelope to the Will. */
20
- injectInbound(env: InboundEnvelope): void;
21
- /** Flip connection state and notify status handlers. */
22
- setConnected(connected: boolean): void;
23
- /** Swap the ack policy mid-test (e.g. to simulate timeouts then recovery). */
24
- setAckPolicy(policy: AckPolicy): void;
25
- /** Convenience: only the envelopes on a given channel. */
26
- sentOn<T extends OutboundEnvelope['channel']>(channel: T): Extract<OutboundEnvelope, {
27
- channel: T;
28
- }>[];
29
- }
30
-
31
- /** Minimal surface of a socket.io client we depend on — keeps us decoupled from the dep's types. */
32
- interface SocketLike {
33
- connected: boolean;
34
- on(event: string, handler: (...args: any[]) => void): void;
35
- emit(event: string, payload: unknown, ack?: (response: unknown) => void): void;
36
- disconnect(): void;
37
- }
38
- interface SocketIoTransportOptions {
39
- /** socket.io server URL (e.g. wss://host or http://host:port). */
40
- url: string;
41
- /** This Will's id — sent as auth + routing key. */
42
- willId: string;
43
- /** Optional auth token sent in the socket.io handshake. */
44
- token?: string;
45
- /** Default ack timeout for emit() in ms. Default 5000. */
46
- ackTimeoutMs?: number;
47
- /**
48
- * Override the socket factory — inject a fake in tests, or customize the
49
- * socket.io connection. When omitted, `socket.io-client` is dynamically
50
- * imported and `io(url, { auth })` is called.
51
- */
52
- socketFactory?: (url: string, opts: {
53
- auth: {
54
- willId: string;
55
- token?: string;
56
- };
57
- }) => SocketLike | Promise<SocketLike>;
58
- }
59
- declare class SocketIoTransport implements ExternalTransport {
60
- private readonly _opts;
61
- private _socket;
62
- private _connecting;
63
- private _seq;
64
- private readonly _inboundHandlers;
65
- private readonly _statusHandlers;
66
- constructor(_opts: SocketIoTransportOptions);
67
- get connected(): boolean;
68
- emit(env: OutboundEnvelope, opts?: {
69
- ackTimeoutMs?: number;
70
- }): Promise<AckResult>;
71
- onInbound(handler: (env: InboundEnvelope) => void): () => void;
72
- onStatus(handler: (s: TransportStatus) => void): () => void;
73
- close(): void;
74
- private _ensureSocket;
75
- private _connect;
76
- private _defaultFactory;
77
- /** Attach socket.io event handlers that feed the inbound + status streams. */
78
- private _wire;
79
- private _emitInbound;
80
- private _notifyStatus;
81
- private _deliveryAck;
82
- private _resultAck;
83
- }
84
-
85
- /** Channels a consumer can filter on (any OutboundEnvelope channel, or '*'). */
86
- type StreamChannel = OutboundEnvelope['channel'] | '*';
87
- type OutboundListener = (env: OutboundEnvelope) => void;
88
- declare class StreamTransport implements ExternalTransport {
89
- readonly willId: string;
90
- private _connected;
91
- private readonly _outbound;
92
- private readonly _outboundByCh;
93
- private readonly _inboundHandlers;
94
- private readonly _statusHandlers;
95
- constructor(willId?: string);
96
- get connected(): boolean;
97
- /**
98
- * Deliver an outbound envelope to subscribers. In-process and synchronous, so
99
- * it resolves immediately (`via: 'event'`) — there is no remote peer to ack.
100
- * A listener that throws is isolated; it can never break the tick loop.
101
- */
102
- emit(env: OutboundEnvelope): Promise<AckResult>;
103
- /** Subscribe to every outbound envelope. Returns an unsubscribe function. */
104
- subscribe(listener: OutboundListener): () => void;
105
- /**
106
- * Subscribe to a single channel (e.g. `'token_report'`, `'session_log'`,
107
- * `'reply'`) or `'*'` for all. Returns an unsubscribe function.
108
- */
109
- on(channel: StreamChannel, listener: OutboundListener): () => void;
110
- /**
111
- * Inject an inbound envelope (message, percept, ack) into the Will. The stem
112
- * enqueues it onto the tick-stamped InboundQueue and applies it deterministically
113
- * on tick — this method itself never touches simulation state.
114
- */
115
- injectInbound(env: InboundEnvelope): void;
116
- onInbound(handler: (env: InboundEnvelope) => void): () => void;
117
- onStatus(handler: (s: TransportStatus) => void): () => void;
118
- /** Notify status subscribers (e.g. flip to 'disconnected' in a test). */
119
- setStatus(status: TransportStatus): void;
120
- close(): void;
121
- /** Total active outbound listeners (diagnostics/tests). */
122
- get listenerCount(): number;
123
- private _dispatch;
124
- }
125
- /**
126
- * Whether producers should ALSO write their telemetry to local files.
127
- *
128
- * Files are a development convenience only. In production the stream/transport is
129
- * the single source of truth and the consumer owns persistence.
130
- *
131
- * - `WILL_FILE_LOGS=true|1|false|0` — explicit override (wins).
132
- * - otherwise: on when `NODE_ENV` is neither `production` nor `test`.
133
- */
134
- declare function fileLoggingEnabled(): boolean;
135
-
136
- /**
137
- * Number of ticks an undelivered outbox message survives before it is
138
- * expired. Override via WILL_OUTBOX_TTL_TICKS. Default: 100 ticks.
139
- */
140
- declare const OUTBOX_TTL_TICKS: number;
1
+ import { S as SimulationContext, a as SeededPRNG, b as SimulationEntity, T as Timestamp, c as SimulationEvent, d as StateManager, e as Tick, f as SimulationState, R as RestoreOptions, g as StateCommands, h as ReasoningFootprint, i as ReadonlySimulationState, C as ConflictReport, j as ConflictStrategy, k as ConflictResolution, O as OutboundEnvelope, A as AckResult, l as ExternalTransport, I as InboundEnvelope, m as TransportStatus, P as PolicyDecision, D as DenialFinality, n as PolicyArbiter, o as PolicyInvocation, V as Verdict } from './will-evj9_vrd.js';
2
+ export { p as AckEnvelope, q as ActionRequest, r as ActionResult, s as ActionSelector, t as ActivityEnvelope, u as ActivityEvent, v as ActivityEventHandler, w as AestheticEvaluator, x as AestheticEvaluatorConfig, y as AffectiveBlender, z as AffectiveBlenderConfig, B as AffordanceSynthesizer, F as AsyncEngine, G as AsyncEngineConfig, H as AttachmentEvaluator, J as AttachmentEvaluatorConfig, K as AttentionAllocator, L as AttentionAllocatorConfig, M as AuditionEngine, N as AutobiographicalNarrator, Q as AutobiographicalNarratorConfig, U as BACKGROUND_DEMAND, X as BehavioralProbeResult, Y as BiasDetector, Z as BiasDetectorConfig, _ as BunStorageAdapter, $ as ChunkEnvelope, a0 as CircadianConfig, a1 as CircadianOscillator, a2 as ClockConfig, a3 as Cognition, a4 as CognitiveHealth, a5 as ConfidenceCalibrator, a6 as ConfidenceCalibratorConfig, a7 as Coordinates, a8 as CreateWillOptions, a9 as DefaultEventBus, aa as DefaultMetricCollector, ab as DefaultOrchestrator, ac as DefaultReplayRecorder, ad as DefaultReplaySession, ae as DefaultScenario, af as DefaultSerializer, ag as DefaultSimulation, ah as DefaultSimulationClock, ai as DefaultStateManager, aj as DefaultVectorMemoryAdapter, ak as DeliberationEngine, al as DeltaEncoder, am as DeltaSnapshot, an as DreamSimulator, ao as DreamSimulatorConfig, ap as Duration, aq as ESCALATION_DEMAND, ar as EffectorDeclaration, as as EffectorEntry, E as EffectorHandler, at as EffectorResult, au as EffectorSpec, av as EmbeddingProvider, aw as EmpathySimulator, ax as EmpathySimulatorConfig, ay as EnergyRegulator, az as EnergyRegulatorConfig, aA as EngineRegistry, aB as EngineResult, aC as Envelope, aD as EpisodicConsolidator, aE as EpisodicConsolidatorConfig, aF as EventBus, aG as EventBusConfig, aH as EventFilter, aI as EventHandler, aJ as EventPayload, aK as ExecutiveEngine, aL as ExecutiveEngineConfig, aM as Exteroception, aN as ExteroceptionConfig, aO as ForgettingCurve, aP as ForgettingCurveConfig, aQ as FrustrationEvaluator, aR as FrustrationEvaluatorConfig, aS as GoalManager, aT as GoalManagerConfig, aU as GustationEngine, aV as InboundMessageEnvelope, aW as InboundPerceptEnvelope, aX as InhibitionController, aY as InhibitionControllerConfig, aZ as Interoception, a_ as InteroceptionConfig, a$ as IntrospectionEngine, b0 as IntrospectionEngineConfig, b1 as KNOWN_PROVIDERS, b2 as KnownEntityTracker, b3 as KnownEntityTrackerConfig, b4 as KnownProvider, b5 as LLMCallMeta, b6 as LLMCompletionRecord, b7 as LLMCompletionSink, b8 as LLMProvider, b9 as LLMWire, ba as LossEvaluator, bb as LossEvaluatorConfig, bc as MessageEnvelope, bd as MetricCollector, be as MetricPoint, bf as MinimalContext, bg as MockEmbedder, bh as ModelPrice, bi as ModelRoute, bj as ModelRouter, bk as MoralEvaluator, bl as MoralEvaluatorConfig, bm as MotorSchemaExecutor, bn as NULL_ARBITER, bo as NULL_ROUTER, bp as NoveltyDetector, bq as NoveltyDetectorConfig, br as OlfactionEngine, bs as OpenAICompatibleEmbedder, bt as Orchestrator, bu as OrchestratorConfig, bv as OutboxMessage, bw as PMABehavioral, bx as PMABelief, by as PMAEmotionalBaseline, bz as PMAEvalHarness, bA as PMAGoal, bB as PMAIdentity, bC as PMAProbe, bD as PMASnapshot, bE as PerceptEnvelope, bF as PersonaConsolidator, bG as PersonaConsolidatorConfig, bH as PlanningEngine, bI as PlanningEngineConfig, bJ as PolicyCounterfactual, bK as PriceTable, bL as ProviderCredential, bM as ReafferenceEngine, bN as ReconstructionFidelityReport, bO as ReconstructionFidelityScores, bP as RecordUsageInput, bQ as ReplayComparison, bR as ReplayConfig, bS as ReplayDifference, bT as ReplayManager, bU as ReplayMetadata, bV as ReplayRecord, bW as ReplayRecorder, bX as ReplaySession, bY as ReplyEnvelope, bZ as ReputationTracker, b_ as ReputationTrackerConfig, b$ as RewardEvaluator, c0 as RewardEvaluatorConfig, c1 as RoutingRule, c2 as Scenario, c3 as ScenarioConfig, c4 as ScenarioValidationResult, c5 as SchemaPrecondition, c6 as SelfModelUpdater, c7 as SelfModelUpdaterConfig, c8 as SemanticIntegrator, c9 as SemanticIntegratorConfig, ca as SensoryInput, cb as SensorySignal, cc as SerializationConfig, cd as SerializationFormat, ce as SerializedEntity, cf as SerializedState, cg as Serializer, ch as SessionLogEnvelope, ci as SignalProvenance, cj as Simulation, ck as SimulationClock, cl as SimulationConfig, cm as SimulationEngine, cn as SimulationEventBase, co as SimulationEventListener, cp as SleepPressureConfig, cq as SleepPressureRegulator, cr as SocialPerception, cs as SocialPerceptionConfig, ct as SomatosensationEngine, cu as SpacedRepetition, cv as SpacedRepetitionConfig, cw as StateSnapshot, cx as Stimulus, cy as StorageAdapter, cz as StressRegulator, cA as StressRegulatorConfig, cB as TableRouter, cC as TaskSwitcher, cD as TaskSwitcherConfig, cE as TextMessage, cF as TheoryOfMind, cG as TheoryOfMindConfig, cH as ThreatEvaluator, cI as ThreatEvaluatorConfig, cJ as TickListener, cK as TokenLedgerRecord, cL as TokenReportEnvelope, cM as TokenTracker, cN as TokenTrackerConfig, cO as TokenUsage, cP as Transduced, cQ as VectorIndex, cR as VectorMemoryAdapter, cS as VectorMemoryConfig, cT as VectorQueryFilter, cU as VectorQueryResult, cV as VectorRecord, cW as VisionEngine, cX as VoiceChunk, W as Will, cY as WillAffect, cZ as WillConfig, c_ as WillEffectorAct, c$ as WillInstance, d0 as WillMessage, d1 as WillStateSummary, d2 as WillStatus, d3 as WillStem, d4 as WillSummary, d5 as WorkingMemory, d6 as WorkingMemoryConfig, d7 as WorldEntity, d8 as WorldInterface, d9 as asFinality, da as asProvenance, db as assembleMind, dc as chainRouters, dd as clearCompletionRecorder, de as defaultBaseFor, df as effectorInvocation, dg as effectorInvocationEnvelope, dh as finalityOf, di as getCompletionRecorder, dj as isNullArbiter, dk as isNullRouter, dl as knownWireFor, dm as resolvePricing, dn as setCompletionRecorder } from './will-evj9_vrd.js';
141
3
 
142
4
  /**
143
5
  * Creates a Mulberry32 PRNG from the given seed.
@@ -416,6 +278,144 @@ declare class ConflictDetector {
416
278
  private _merge;
417
279
  }
418
280
 
281
+ /** Decides how emit() resolves an ack for a given envelope. Default: acked via callback. */
282
+ type AckPolicy = (env: OutboundEnvelope) => AckResult;
283
+ declare class LoopbackTransport implements ExternalTransport {
284
+ /** Every envelope passed to emit(), in order — inspect in tests. */
285
+ readonly sent: OutboundEnvelope[];
286
+ private _connected;
287
+ private _ackPolicy;
288
+ private readonly _inboundHandlers;
289
+ private readonly _statusHandlers;
290
+ constructor(ackPolicy?: AckPolicy);
291
+ get connected(): boolean;
292
+ emit(env: OutboundEnvelope): Promise<AckResult>;
293
+ onInbound(handler: (env: InboundEnvelope) => void): () => void;
294
+ onStatus(handler: (s: TransportStatus) => void): () => void;
295
+ close(): void;
296
+ /** Simulate the peer sending an inbound envelope to the Will. */
297
+ injectInbound(env: InboundEnvelope): void;
298
+ /** Flip connection state and notify status handlers. */
299
+ setConnected(connected: boolean): void;
300
+ /** Swap the ack policy mid-test (e.g. to simulate timeouts then recovery). */
301
+ setAckPolicy(policy: AckPolicy): void;
302
+ /** Convenience: only the envelopes on a given channel. */
303
+ sentOn<T extends OutboundEnvelope['channel']>(channel: T): Extract<OutboundEnvelope, {
304
+ channel: T;
305
+ }>[];
306
+ }
307
+
308
+ /** Minimal surface of a socket.io client we depend on — keeps us decoupled from the dep's types. */
309
+ interface SocketLike {
310
+ connected: boolean;
311
+ on(event: string, handler: (...args: any[]) => void): void;
312
+ emit(event: string, payload: unknown, ack?: (response: unknown) => void): void;
313
+ disconnect(): void;
314
+ }
315
+ interface SocketIoTransportOptions {
316
+ /** socket.io server URL (e.g. wss://host or http://host:port). */
317
+ url: string;
318
+ /** This Will's id — sent as auth + routing key. */
319
+ willId: string;
320
+ /** Optional auth token sent in the socket.io handshake. */
321
+ token?: string;
322
+ /** Default ack timeout for emit() in ms. Default 5000. */
323
+ ackTimeoutMs?: number;
324
+ /**
325
+ * Override the socket factory — inject a fake in tests, or customize the
326
+ * socket.io connection. When omitted, `socket.io-client` is dynamically
327
+ * imported and `io(url, { auth })` is called.
328
+ */
329
+ socketFactory?: (url: string, opts: {
330
+ auth: {
331
+ willId: string;
332
+ token?: string;
333
+ };
334
+ }) => SocketLike | Promise<SocketLike>;
335
+ }
336
+ declare class SocketIoTransport implements ExternalTransport {
337
+ private readonly _opts;
338
+ private _socket;
339
+ private _connecting;
340
+ private _seq;
341
+ private readonly _inboundHandlers;
342
+ private readonly _statusHandlers;
343
+ constructor(_opts: SocketIoTransportOptions);
344
+ get connected(): boolean;
345
+ emit(env: OutboundEnvelope, opts?: {
346
+ ackTimeoutMs?: number;
347
+ }): Promise<AckResult>;
348
+ onInbound(handler: (env: InboundEnvelope) => void): () => void;
349
+ onStatus(handler: (s: TransportStatus) => void): () => void;
350
+ close(): void;
351
+ private _ensureSocket;
352
+ private _connect;
353
+ private _defaultFactory;
354
+ /** Attach socket.io event handlers that feed the inbound + status streams. */
355
+ private _wire;
356
+ private _emitInbound;
357
+ private _notifyStatus;
358
+ private _deliveryAck;
359
+ private _resultAck;
360
+ }
361
+
362
+ /** Channels a consumer can filter on (any OutboundEnvelope channel, or '*'). */
363
+ type StreamChannel = OutboundEnvelope['channel'] | '*';
364
+ type OutboundListener = (env: OutboundEnvelope) => void;
365
+ declare class StreamTransport implements ExternalTransport {
366
+ readonly willId: string;
367
+ private _connected;
368
+ private readonly _outbound;
369
+ private readonly _outboundByCh;
370
+ private readonly _inboundHandlers;
371
+ private readonly _statusHandlers;
372
+ constructor(willId?: string);
373
+ get connected(): boolean;
374
+ /**
375
+ * Deliver an outbound envelope to subscribers. In-process and synchronous, so
376
+ * it resolves immediately (`via: 'event'`) — there is no remote peer to ack.
377
+ * A listener that throws is isolated; it can never break the tick loop.
378
+ */
379
+ emit(env: OutboundEnvelope): Promise<AckResult>;
380
+ /** Subscribe to every outbound envelope. Returns an unsubscribe function. */
381
+ subscribe(listener: OutboundListener): () => void;
382
+ /**
383
+ * Subscribe to a single channel (e.g. `'token_report'`, `'session_log'`,
384
+ * `'reply'`) or `'*'` for all. Returns an unsubscribe function.
385
+ */
386
+ on(channel: StreamChannel, listener: OutboundListener): () => void;
387
+ /**
388
+ * Inject an inbound envelope (message, percept, ack) into the Will. The stem
389
+ * enqueues it onto the tick-stamped InboundQueue and applies it deterministically
390
+ * on tick — this method itself never touches simulation state.
391
+ */
392
+ injectInbound(env: InboundEnvelope): void;
393
+ onInbound(handler: (env: InboundEnvelope) => void): () => void;
394
+ onStatus(handler: (s: TransportStatus) => void): () => void;
395
+ /** Notify status subscribers (e.g. flip to 'disconnected' in a test). */
396
+ setStatus(status: TransportStatus): void;
397
+ close(): void;
398
+ /** Total active outbound listeners (diagnostics/tests). */
399
+ get listenerCount(): number;
400
+ private _dispatch;
401
+ }
402
+ /**
403
+ * Whether producers should ALSO write their telemetry to local files.
404
+ *
405
+ * Files are a development convenience only. In production the stream/transport is
406
+ * the single source of truth and the consumer owns persistence.
407
+ *
408
+ * - `WILL_FILE_LOGS=true|1|false|0` — explicit override (wins).
409
+ * - otherwise: on when `NODE_ENV` is neither `production` nor `test`.
410
+ */
411
+ declare function fileLoggingEnabled(): boolean;
412
+
413
+ /**
414
+ * Number of ticks an undelivered outbox message survives before it is
415
+ * expired. Override via WILL_OUTBOX_TTL_TICKS. Default: 100 ticks.
416
+ */
417
+ declare const OUTBOX_TTL_TICKS: number;
418
+
419
419
  interface WorldProfile {
420
420
  id: string;
421
421
  name: string;
@@ -433,4 +433,51 @@ declare function resolveProfile(id: string): WorldProfile | undefined;
433
433
  /** List all registered profile ids. */
434
434
  declare function listProfiles(): string[];
435
435
 
436
- export { type AckPolicy, AckResult, ConflictDetector, ConflictReport, ConflictResolution, ConflictStrategy, ConsistentHashRouter, ConsoleLogger, type CrossShardQuery, type CrossShardResult, type CrossShardTransport, DefaultPartitionRouter, type DeliveryGuarantee, type DistributedEvent, type DistributedNode, type DistributedNodeConfig, DistributedOrchestrator, DistributedStateManager, ExternalTransport, InboundEnvelope, LocalTransport, type Logger, LoopbackTransport, OUTBOX_TTL_TICKS, OutboundEnvelope, type OutboundListener, type PartitionRouter, ReasoningFootprint, RestoreOptions, type ShardConfig, type ShardStrategy, SilentLogger, SimulationContext, SimulationEntity, SimulationEvent, SimulationState, SocketIoTransport, type SocketIoTransportOptions, type SocketLike, StateManager, type StreamChannel, StreamTransport, Tick, Timestamp, TransportStatus, type WorldProfile, createContext, createPRNG, fileLoggingEnabled, getLogger, listProfiles, logger, resetLogger, resolveProfile, setLogger };
436
+ /** A bound on one parameter. Checked in declaration order: max, min, equals, oneOf. */
437
+ interface ParamConstraint {
438
+ max?: number;
439
+ min?: number;
440
+ equals?: unknown;
441
+ oneOf?: readonly unknown[];
442
+ }
443
+ /**
444
+ * One rule. `schema`/`target` scope it (omitted ⇒ matches any); the FIRST rule
445
+ * whose scope matches decides, so order is policy.
446
+ *
447
+ * `require` is meaningful with `decision: 'allow'` only: the scope matched, and
448
+ * these constraints must hold for the allow to stand. A violation flips the
449
+ * verdict to deny — carrying the counterfactual — with finality 'parameter',
450
+ * because the ability itself was permitted and only these arguments were not.
451
+ *
452
+ * A rule with `decision: 'deny'` and no `require` is a flat class-level ban;
453
+ * it reports finality 'class' unless told otherwise.
454
+ */
455
+ interface PolicyRule {
456
+ schema?: string;
457
+ target?: string;
458
+ decision: PolicyDecision;
459
+ require?: Record<string, ParamConstraint>;
460
+ reasonCode?: string;
461
+ finality?: DenialFinality;
462
+ }
463
+ interface RuleTableOptions {
464
+ rules: readonly PolicyRule[];
465
+ /**
466
+ * The verdict when NO rule matches. Required — deliberately not defaulted.
467
+ * A policy component that silently defaults open is a trap; make the posture
468
+ * an explicit decision at the call site. 'deny' is fail-closed and is the
469
+ * right choice once a rule set is complete.
470
+ */
471
+ fallthrough: PolicyDecision;
472
+ /** Recorded with every verdict for audit. Defaults to 'rule-table'. */
473
+ name?: string;
474
+ }
475
+ declare class RuleTableArbiter implements PolicyArbiter {
476
+ readonly name: string;
477
+ private readonly _rules;
478
+ private readonly _fallthrough;
479
+ constructor(opts: RuleTableOptions);
480
+ evaluate(invocation: PolicyInvocation): Verdict;
481
+ }
482
+
483
+ export { type AckPolicy, AckResult, ConflictDetector, ConflictReport, ConflictResolution, ConflictStrategy, ConsistentHashRouter, ConsoleLogger, type CrossShardQuery, type CrossShardResult, type CrossShardTransport, DefaultPartitionRouter, type DeliveryGuarantee, DenialFinality, type DistributedEvent, type DistributedNode, type DistributedNodeConfig, DistributedOrchestrator, DistributedStateManager, ExternalTransport, InboundEnvelope, LocalTransport, type Logger, LoopbackTransport, OUTBOX_TTL_TICKS, OutboundEnvelope, type OutboundListener, type ParamConstraint, type PartitionRouter, PolicyArbiter, PolicyDecision, PolicyInvocation, type PolicyRule, ReasoningFootprint, RestoreOptions, RuleTableArbiter, type RuleTableOptions, type ShardConfig, type ShardStrategy, SilentLogger, SimulationContext, SimulationEntity, SimulationEvent, SimulationState, SocketIoTransport, type SocketIoTransportOptions, type SocketLike, StateManager, type StreamChannel, StreamTransport, Tick, Timestamp, TransportStatus, Verdict, type WorldProfile, createContext, createPRNG, fileLoggingEnabled, getLogger, listProfiles, logger, resetLogger, resolveProfile, setLogger };