@decibelsystems/tools 2.2.0-beta.0 → 3.1.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/CHANGELOG.md +226 -0
- package/dist/agentCommands.d.ts +0 -1
- package/dist/agentCommands.d.ts.map +1 -1
- package/dist/agentCommands.js +19 -8
- package/dist/agentCommands.js.map +1 -1
- package/dist/agentPresence.d.ts +82 -0
- package/dist/agentPresence.d.ts.map +1 -1
- package/dist/agentPresence.js +194 -26
- package/dist/agentPresence.js.map +1 -1
- package/dist/agentic/index.d.ts +18 -8
- package/dist/agentic/index.d.ts.map +1 -1
- package/dist/agentic/index.js +18 -144
- package/dist/agentic/index.js.map +1 -1
- package/dist/agentic/types.d.ts +106 -0
- package/dist/agentic/types.d.ts.map +1 -1
- package/dist/agentic/types.js +77 -1
- package/dist/agentic/types.js.map +1 -1
- package/dist/architectAdrs.d.ts +27 -3
- package/dist/architectAdrs.d.ts.map +1 -1
- package/dist/architectAdrs.js +92 -4
- package/dist/architectAdrs.js.map +1 -1
- package/dist/artifacts.d.ts +60 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +208 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/asks.d.ts +93 -0
- package/dist/asks.d.ts.map +1 -0
- package/dist/asks.js +383 -0
- package/dist/asks.js.map +1 -0
- package/dist/chat.d.ts +47 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +288 -0
- package/dist/chat.js.map +1 -0
- package/dist/client/transports.d.ts.map +1 -1
- package/dist/client/transports.js +13 -3
- package/dist/client/transports.js.map +1 -1
- package/dist/daemon.d.ts +33 -3
- package/dist/daemon.d.ts.map +1 -1
- package/dist/daemon.js +225 -52
- package/dist/daemon.js.map +1 -1
- package/dist/daemonConfig.d.ts +46 -0
- package/dist/daemonConfig.d.ts.map +1 -1
- package/dist/daemonConfig.js +57 -12
- package/dist/daemonConfig.js.map +1 -1
- package/dist/decibelPaths.d.ts.map +1 -1
- package/dist/decibelPaths.js +39 -6
- package/dist/decibelPaths.js.map +1 -1
- package/dist/domain/issue.d.ts +81 -0
- package/dist/domain/issue.d.ts.map +1 -0
- package/dist/domain/issue.js +106 -0
- package/dist/domain/issue.js.map +1 -0
- package/dist/domain/issueCodec.d.ts +39 -0
- package/dist/domain/issueCodec.d.ts.map +1 -0
- package/dist/domain/issueCodec.js +308 -0
- package/dist/domain/issueCodec.js.map +1 -0
- package/dist/domain/issueRepository.d.ts +124 -0
- package/dist/domain/issueRepository.d.ts.map +1 -0
- package/dist/domain/issueRepository.js +296 -0
- package/dist/domain/issueRepository.js.map +1 -0
- package/dist/domain/uid.d.ts +16 -0
- package/dist/domain/uid.d.ts.map +1 -0
- package/dist/domain/uid.js +43 -0
- package/dist/domain/uid.js.map +1 -0
- package/dist/facades/definitions.d.ts +0 -1
- package/dist/facades/definitions.d.ts.map +1 -1
- package/dist/facades/definitions.js +140 -116
- package/dist/facades/definitions.js.map +1 -1
- package/dist/facades/index.d.ts +2 -1
- package/dist/facades/index.d.ts.map +1 -1
- package/dist/facades/index.js +1 -1
- package/dist/facades/index.js.map +1 -1
- package/dist/facades/types.d.ts +17 -0
- package/dist/facades/types.d.ts.map +1 -1
- package/dist/hq/defineAgent.d.ts.map +1 -1
- package/dist/hq/defineAgent.js +7 -11
- package/dist/hq/defineAgent.js.map +1 -1
- package/dist/httpArgs.d.ts +11 -0
- package/dist/httpArgs.d.ts.map +1 -0
- package/dist/httpArgs.js +39 -0
- package/dist/httpArgs.js.map +1 -0
- package/dist/httpServer.d.ts +1 -12
- package/dist/httpServer.d.ts.map +1 -1
- package/dist/httpServer.js +298 -144
- package/dist/httpServer.js.map +1 -1
- package/dist/identity.d.ts +123 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +312 -0
- package/dist/identity.js.map +1 -0
- package/dist/kernel.d.ts +46 -1
- package/dist/kernel.d.ts.map +1 -1
- package/dist/kernel.js +334 -26
- package/dist/kernel.js.map +1 -1
- package/dist/killSwitch.d.ts +117 -0
- package/dist/killSwitch.d.ts.map +1 -0
- package/dist/killSwitch.js +161 -0
- package/dist/killSwitch.js.map +1 -0
- package/dist/lib/agent-services/assumptions.d.ts.map +1 -1
- package/dist/lib/agent-services/assumptions.js +8 -2
- package/dist/lib/agent-services/assumptions.js.map +1 -1
- package/dist/lib/atomicWrite.d.ts +49 -0
- package/dist/lib/atomicWrite.d.ts.map +1 -0
- package/dist/lib/atomicWrite.js +157 -0
- package/dist/lib/atomicWrite.js.map +1 -0
- package/dist/lib/envelope.d.ts +31 -0
- package/dist/lib/envelope.d.ts.map +1 -0
- package/dist/lib/envelope.js +80 -0
- package/dist/lib/envelope.js.map +1 -0
- package/dist/lib/fileLock.d.ts +38 -0
- package/dist/lib/fileLock.d.ts.map +1 -0
- package/dist/lib/fileLock.js +124 -0
- package/dist/lib/fileLock.js.map +1 -0
- package/dist/lib/recordIdAllocator.d.ts +102 -0
- package/dist/lib/recordIdAllocator.d.ts.map +1 -0
- package/dist/lib/recordIdAllocator.js +179 -0
- package/dist/lib/recordIdAllocator.js.map +1 -0
- package/dist/orgId.d.ts +23 -0
- package/dist/orgId.d.ts.map +1 -0
- package/dist/orgId.js +73 -0
- package/dist/orgId.js.map +1 -0
- package/dist/pairCli.d.ts +2 -0
- package/dist/pairCli.d.ts.map +1 -0
- package/dist/pairCli.js +97 -0
- package/dist/pairCli.js.map +1 -0
- package/dist/peerBroker.d.ts +40 -0
- package/dist/peerBroker.d.ts.map +1 -0
- package/dist/peerBroker.js +70 -0
- package/dist/peerBroker.js.map +1 -0
- package/dist/peerBrokerSupervisor.d.ts +21 -0
- package/dist/peerBrokerSupervisor.d.ts.map +1 -0
- package/dist/peerBrokerSupervisor.js +131 -0
- package/dist/peerBrokerSupervisor.js.map +1 -0
- package/dist/projectPaths.d.ts.map +1 -1
- package/dist/projectPaths.js +1 -19
- package/dist/projectPaths.js.map +1 -1
- package/dist/projectRegistry.d.ts +22 -0
- package/dist/projectRegistry.d.ts.map +1 -1
- package/dist/projectRegistry.js +69 -2
- package/dist/projectRegistry.js.map +1 -1
- package/dist/pty/boundary.d.ts +39 -0
- package/dist/pty/boundary.d.ts.map +1 -0
- package/dist/pty/boundary.js +100 -0
- package/dist/pty/boundary.js.map +1 -0
- package/dist/pty/errors.d.ts +6 -0
- package/dist/pty/errors.d.ts.map +1 -0
- package/dist/pty/errors.js +12 -0
- package/dist/pty/errors.js.map +1 -0
- package/dist/pty/fleet.d.ts +159 -0
- package/dist/pty/fleet.d.ts.map +1 -0
- package/dist/pty/fleet.js +543 -0
- package/dist/pty/fleet.js.map +1 -0
- package/dist/pty/launchProfile.d.ts +45 -0
- package/dist/pty/launchProfile.d.ts.map +1 -0
- package/dist/pty/launchProfile.js +149 -0
- package/dist/pty/launchProfile.js.map +1 -0
- package/dist/pty/openTerminal.d.ts +48 -0
- package/dist/pty/openTerminal.d.ts.map +1 -0
- package/dist/pty/openTerminal.js +185 -0
- package/dist/pty/openTerminal.js.map +1 -0
- package/dist/pty/pairDialog.d.ts +16 -0
- package/dist/pty/pairDialog.d.ts.map +1 -0
- package/dist/pty/pairDialog.js +121 -0
- package/dist/pty/pairDialog.js.map +1 -0
- package/dist/pty/pairing.d.ts +86 -0
- package/dist/pty/pairing.d.ts.map +1 -0
- package/dist/pty/pairing.js +351 -0
- package/dist/pty/pairing.js.map +1 -0
- package/dist/pty/routes.d.ts +49 -0
- package/dist/pty/routes.d.ts.map +1 -0
- package/dist/pty/routes.js +624 -0
- package/dist/pty/routes.js.map +1 -0
- package/dist/pty/sessions.d.ts +167 -0
- package/dist/pty/sessions.d.ts.map +1 -0
- package/dist/pty/sessions.js +513 -0
- package/dist/pty/sessions.js.map +1 -0
- package/dist/pty/tmux.d.ts +109 -0
- package/dist/pty/tmux.d.ts.map +1 -0
- package/dist/pty/tmux.js +271 -0
- package/dist/pty/tmux.js.map +1 -0
- package/dist/roster.d.ts +37 -0
- package/dist/roster.d.ts.map +1 -0
- package/dist/roster.js +126 -0
- package/dist/roster.js.map +1 -0
- package/dist/runtime/circuitBreaker.d.ts +95 -0
- package/dist/runtime/circuitBreaker.d.ts.map +1 -0
- package/dist/runtime/circuitBreaker.js +178 -0
- package/dist/runtime/circuitBreaker.js.map +1 -0
- package/dist/runtime/daemonMeta.d.ts +53 -0
- package/dist/runtime/daemonMeta.d.ts.map +1 -0
- package/dist/runtime/daemonMeta.js +121 -0
- package/dist/runtime/daemonMeta.js.map +1 -0
- package/dist/runtime/ensureRuntime.d.ts +103 -0
- package/dist/runtime/ensureRuntime.d.ts.map +1 -0
- package/dist/runtime/ensureRuntime.js +276 -0
- package/dist/runtime/ensureRuntime.js.map +1 -0
- package/dist/runtime/extensions.d.ts +57 -0
- package/dist/runtime/extensions.d.ts.map +1 -0
- package/dist/runtime/extensions.js +216 -0
- package/dist/runtime/extensions.js.map +1 -0
- package/dist/runtime/localHttp.d.ts +24 -0
- package/dist/runtime/localHttp.d.ts.map +1 -0
- package/dist/runtime/localHttp.js +84 -0
- package/dist/runtime/localHttp.js.map +1 -0
- package/dist/runtime/projectResolution.d.ts +29 -0
- package/dist/runtime/projectResolution.d.ts.map +1 -0
- package/dist/runtime/projectResolution.js +67 -0
- package/dist/runtime/projectResolution.js.map +1 -0
- package/dist/runtime/protocol.d.ts +62 -0
- package/dist/runtime/protocol.d.ts.map +1 -0
- package/dist/runtime/protocol.js +74 -0
- package/dist/runtime/protocol.js.map +1 -0
- package/dist/sentinelIssues.d.ts +42 -2
- package/dist/sentinelIssues.d.ts.map +1 -1
- package/dist/sentinelIssues.js +167 -65
- package/dist/sentinelIssues.js.map +1 -1
- package/dist/server.js +123 -15
- package/dist/server.js.map +1 -1
- package/dist/toolConfig.d.ts.map +1 -1
- package/dist/toolConfig.js +12 -0
- package/dist/toolConfig.js.map +1 -1
- package/dist/tools/agentic/agentQueue.d.ts.map +1 -1
- package/dist/tools/agentic/agentQueue.js +4 -0
- package/dist/tools/agentic/agentQueue.js.map +1 -1
- package/dist/tools/agentic/index.d.ts.map +1 -1
- package/dist/tools/agentic/index.js +28 -2
- package/dist/tools/agentic/index.js.map +1 -1
- package/dist/tools/architect/index.d.ts +1 -0
- package/dist/tools/architect/index.d.ts.map +1 -1
- package/dist/tools/architect/index.js +52 -3
- package/dist/tools/architect/index.js.map +1 -1
- package/dist/tools/architect.d.ts.map +1 -1
- package/dist/tools/architect.js +59 -8
- package/dist/tools/architect.js.map +1 -1
- package/dist/tools/artifacts.d.ts +5 -0
- package/dist/tools/artifacts.d.ts.map +1 -0
- package/dist/tools/artifacts.js +89 -0
- package/dist/tools/artifacts.js.map +1 -0
- package/dist/tools/asks.d.ts +6 -0
- package/dist/tools/asks.d.ts.map +1 -0
- package/dist/tools/asks.js +104 -0
- package/dist/tools/asks.js.map +1 -0
- package/dist/tools/context.d.ts +10 -5
- package/dist/tools/context.d.ts.map +1 -1
- package/dist/tools/context.js +45 -18
- package/dist/tools/context.js.map +1 -1
- package/dist/tools/coordinator/coordinator.d.ts.map +1 -1
- package/dist/tools/coordinator/coordinator.js +48 -19
- package/dist/tools/coordinator/coordinator.js.map +1 -1
- package/dist/tools/coordinator/index.d.ts +1 -0
- package/dist/tools/coordinator/index.d.ts.map +1 -1
- package/dist/tools/coordinator/index.js +42 -2
- package/dist/tools/coordinator/index.js.map +1 -1
- package/dist/tools/crit.d.ts +2 -1
- package/dist/tools/crit.d.ts.map +1 -1
- package/dist/tools/crit.js +19 -4
- package/dist/tools/crit.js.map +1 -1
- package/dist/tools/data-inspector.d.ts +1 -1
- package/dist/tools/data-inspector.d.ts.map +1 -1
- package/dist/tools/data-inspector.js +1 -1
- package/dist/tools/data-inspector.js.map +1 -1
- package/dist/tools/designer/index.d.ts.map +1 -1
- package/dist/tools/designer/index.js +4 -3
- package/dist/tools/designer/index.js.map +1 -1
- package/dist/tools/designer/lateral-tools.d.ts.map +1 -1
- package/dist/tools/designer/lateral-tools.js +4 -2
- package/dist/tools/designer/lateral-tools.js.map +1 -1
- package/dist/tools/designer.d.ts +2 -1
- package/dist/tools/designer.d.ts.map +1 -1
- package/dist/tools/designer.js +24 -12
- package/dist/tools/designer.js.map +1 -1
- package/dist/tools/dojo/index.d.ts.map +1 -1
- package/dist/tools/dojo/index.js +52 -3
- package/dist/tools/dojo/index.js.map +1 -1
- package/dist/tools/dojo.d.ts +65 -3
- package/dist/tools/dojo.d.ts.map +1 -1
- package/dist/tools/dojo.js +148 -23
- package/dist/tools/dojo.js.map +1 -1
- package/dist/tools/friction.d.ts.map +1 -1
- package/dist/tools/friction.js +16 -6
- package/dist/tools/friction.js.map +1 -1
- package/dist/tools/guardian.d.ts +7 -0
- package/dist/tools/guardian.d.ts.map +1 -1
- package/dist/tools/guardian.js +152 -11
- package/dist/tools/guardian.js.map +1 -1
- package/dist/tools/hygiene/oracle-hygiene.d.ts.map +1 -1
- package/dist/tools/hygiene/oracle-hygiene.js +8 -2
- package/dist/tools/hygiene/oracle-hygiene.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +33 -18
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/killswitch/index.d.ts +13 -0
- package/dist/tools/killswitch/index.d.ts.map +1 -0
- package/dist/tools/killswitch/index.js +138 -0
- package/dist/tools/killswitch/index.js.map +1 -0
- package/dist/tools/learnings.d.ts +2 -1
- package/dist/tools/learnings.d.ts.map +1 -1
- package/dist/tools/learnings.js +31 -15
- package/dist/tools/learnings.js.map +1 -1
- package/dist/tools/oracle/index.d.ts.map +1 -1
- package/dist/tools/oracle/index.js +8 -0
- package/dist/tools/oracle/index.js.map +1 -1
- package/dist/tools/oracle.d.ts +7 -0
- package/dist/tools/oracle.d.ts.map +1 -1
- package/dist/tools/oracle.js +41 -12
- package/dist/tools/oracle.js.map +1 -1
- package/dist/tools/policy.d.ts +2 -1
- package/dist/tools/policy.d.ts.map +1 -1
- package/dist/tools/policy.js +28 -9
- package/dist/tools/policy.js.map +1 -1
- package/dist/tools/postoffice/index.d.ts +10 -0
- package/dist/tools/postoffice/index.d.ts.map +1 -0
- package/dist/tools/postoffice/index.js +218 -0
- package/dist/tools/postoffice/index.js.map +1 -0
- package/dist/tools/postoffice.d.ts +78 -0
- package/dist/tools/postoffice.d.ts.map +1 -0
- package/dist/tools/postoffice.js +199 -0
- package/dist/tools/postoffice.js.map +1 -0
- package/dist/tools/provenance.d.ts +18 -2
- package/dist/tools/provenance.d.ts.map +1 -1
- package/dist/tools/provenance.js +68 -40
- package/dist/tools/provenance.js.map +1 -1
- package/dist/tools/registry/index.d.ts.map +1 -1
- package/dist/tools/registry/index.js +24 -0
- package/dist/tools/registry/index.js.map +1 -1
- package/dist/tools/sentinel/index.d.ts +1 -0
- package/dist/tools/sentinel/index.d.ts.map +1 -1
- package/dist/tools/sentinel/index.js +142 -6
- package/dist/tools/sentinel/index.js.map +1 -1
- package/dist/tools/sentinel.d.ts +152 -1
- package/dist/tools/sentinel.d.ts.map +1 -1
- package/dist/tools/sentinel.js +609 -328
- package/dist/tools/sentinel.js.map +1 -1
- package/dist/tools/shared/index.d.ts +2 -1
- package/dist/tools/shared/index.d.ts.map +1 -1
- package/dist/tools/shared/index.js +2 -1
- package/dist/tools/shared/index.js.map +1 -1
- package/dist/tools/shared/response.d.ts +24 -0
- package/dist/tools/shared/response.d.ts.map +1 -1
- package/dist/tools/shared/response.js +61 -7
- package/dist/tools/shared/response.js.map +1 -1
- package/dist/tools/shared/runTracker.d.ts +2 -0
- package/dist/tools/shared/runTracker.d.ts.map +1 -1
- package/dist/tools/shared/runTracker.js +38 -0
- package/dist/tools/shared/runTracker.js.map +1 -1
- package/dist/tools/shared/storeRead.d.ts +153 -0
- package/dist/tools/shared/storeRead.d.ts.map +1 -0
- package/dist/tools/shared/storeRead.js +242 -0
- package/dist/tools/shared/storeRead.js.map +1 -0
- package/dist/tools/swarm.d.ts +3 -1
- package/dist/tools/swarm.d.ts.map +1 -1
- package/dist/tools/swarm.js +6 -12
- package/dist/tools/swarm.js.map +1 -1
- package/dist/tools/testSpec.d.ts +3 -2
- package/dist/tools/testSpec.d.ts.map +1 -1
- package/dist/tools/testSpec.js +51 -14
- package/dist/tools/testSpec.js.map +1 -1
- package/dist/tools/vector.d.ts +33 -1
- package/dist/tools/vector.d.ts.map +1 -1
- package/dist/tools/vector.js +31 -5
- package/dist/tools/vector.js.map +1 -1
- package/dist/tools/voice/index.d.ts +1 -0
- package/dist/tools/voice/index.d.ts.map +1 -1
- package/dist/tools/voice/index.js +33 -2
- package/dist/tools/voice/index.js.map +1 -1
- package/dist/tools/voice.d.ts +48 -1
- package/dist/tools/voice.d.ts.map +1 -1
- package/dist/tools/voice.js +63 -3
- package/dist/tools/voice.js.map +1 -1
- package/dist/tools/zoom/index.d.ts +15 -0
- package/dist/tools/zoom/index.d.ts.map +1 -0
- package/dist/tools/zoom/index.js +174 -0
- package/dist/tools/zoom/index.js.map +1 -0
- package/dist/tools/zoom.d.ts +234 -0
- package/dist/tools/zoom.d.ts.map +1 -0
- package/dist/tools/zoom.js +627 -0
- package/dist/tools/zoom.js.map +1 -0
- package/dist/transports/bridge.d.ts +1 -1
- package/dist/transports/bridge.d.ts.map +1 -1
- package/dist/transports/bridge.js +4 -1
- package/dist/transports/bridge.js.map +1 -1
- package/dist/transports/http.d.ts +1 -1
- package/dist/transports/http.d.ts.map +1 -1
- package/dist/transports/http.js +3 -1
- package/dist/transports/http.js.map +1 -1
- package/dist/transports/index.d.ts +1 -0
- package/dist/transports/index.d.ts.map +1 -1
- package/dist/transports/index.js +1 -0
- package/dist/transports/index.js.map +1 -1
- package/dist/transports/mcp.d.ts +1 -1
- package/dist/transports/mcp.d.ts.map +1 -1
- package/dist/transports/mcp.js +9 -4
- package/dist/transports/mcp.js.map +1 -1
- package/dist/transports/stdio.d.ts +1 -1
- package/dist/transports/stdio.d.ts.map +1 -1
- package/dist/transports/stdio.js +2 -0
- package/dist/transports/stdio.js.map +1 -1
- package/dist/transports/thinStdio.d.ts +22 -0
- package/dist/transports/thinStdio.d.ts.map +1 -0
- package/dist/transports/thinStdio.js +218 -0
- package/dist/transports/thinStdio.js.map +1 -0
- package/dist/transports/types.d.ts +8 -1
- package/dist/transports/types.d.ts.map +1 -1
- package/dist/types/agent-services.d.ts +7 -0
- package/dist/types/agent-services.d.ts.map +1 -1
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +23 -0
- package/dist/version.js.map +1 -0
- package/package.json +20 -4
- package/templates/AGENT.md +3 -0
- package/templates/CLAUDE-decibel.md +11 -0
- package/templates/com.decibel.daemon.plist +6 -1
- package/dist/tools/deck.d.ts +0 -11
- package/dist/tools/deck.d.ts.map +0 -1
- package/dist/tools/deck.js +0 -1656
- package/dist/tools/deck.js.map +0 -1
- package/dist/tools/mother.d.ts +0 -11
- package/dist/tools/mother.d.ts.map +0 -1
- package/dist/tools/mother.js +0 -503
- package/dist/tools/mother.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -3
- package/dist/tools/registry.d.ts.map +0 -1
- package/dist/tools/registry.js +0 -189
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/senken.d.ts +0 -11
- package/dist/tools/senken.d.ts.map +0 -1
- package/dist/tools/senken.js +0 -482
- package/dist/tools/senken.js.map +0 -1
- package/dist/tools/terminal.d.ts +0 -17
- package/dist/tools/terminal.d.ts.map +0 -1
- package/dist/tools/terminal.js +0 -968
- package/dist/tools/terminal.js.map +0 -1
- package/dist/tools/toolsIndex.d.ts +0 -5
- package/dist/tools/toolsIndex.d.ts.map +0 -1
- package/dist/tools/toolsIndex.js +0 -37
- package/dist/tools/toolsIndex.js.map +0 -1
package/dist/identity.js
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Acting identity — EPIC-0040, ADR-0011
|
|
3
|
+
// ============================================================================
|
|
4
|
+
// Who made this write?
|
|
5
|
+
//
|
|
6
|
+
// Until now, nothing could answer that. X-User-Key was accepted at the HTTP
|
|
7
|
+
// boundary, threaded onto DispatchContext.userKey, and read by nobody
|
|
8
|
+
// (ISS-0163). provenance had the only real actor modelling in the tree, and it
|
|
9
|
+
// sat off to one side as an event log rather than as a field on the records
|
|
10
|
+
// themselves. So attribution was anecdotal: 251 provenance events, and the
|
|
11
|
+
// records they describe carry no author at all.
|
|
12
|
+
//
|
|
13
|
+
// This module is the single answer, for both transports. The rule from
|
|
14
|
+
// ADR-0011 is that there is ONE resolver with TWO sources, never two
|
|
15
|
+
// mechanisms:
|
|
16
|
+
//
|
|
17
|
+
// daemon (http) -> X-User-Key, a Supabase JWT, giving user:<uuid>
|
|
18
|
+
// stdio -> config / git / $USER, giving human:<name>
|
|
19
|
+
//
|
|
20
|
+
// The stdio half is not a fallback for the unusual case. It is the majority
|
|
21
|
+
// path: decibel-tools is registered as a stdio server, so every Claude Code
|
|
22
|
+
// session writes in its own process, where no HTTP header can exist. A design
|
|
23
|
+
// that only works in the daemon would miss nearly every write an agent makes.
|
|
24
|
+
//
|
|
25
|
+
// IDENTITY IS REFERENCED HERE AND RESOLVED IN HQ. Records store a prefixed id
|
|
26
|
+
// and never a display name, so renaming someone in the roster never has to
|
|
27
|
+
// rewrite history across fifteen repos. Rendering a name is the roster's job
|
|
28
|
+
// (hq.resolve_ids), and when the roster is unreachable an id renders as
|
|
29
|
+
// itself. That degradation is deliberate and is the reason the prefix carries
|
|
30
|
+
// the information about whether resolution is even possible.
|
|
31
|
+
// ============================================================================
|
|
32
|
+
import { AsyncLocalStorage } from 'async_hooks';
|
|
33
|
+
import { execSync } from 'child_process';
|
|
34
|
+
// ============================================================================
|
|
35
|
+
// The prefix vocabulary
|
|
36
|
+
// ============================================================================
|
|
37
|
+
// Agreed with the decibel-hq peer 2026-09-20 and pinned there as the shared
|
|
38
|
+
// contract. Two prefixes name a human, and the difference between them is the
|
|
39
|
+
// whole point rather than an inconsistency to be tidied away:
|
|
40
|
+
//
|
|
41
|
+
// human:<name> local. From git config or $USER. Always available, even
|
|
42
|
+
// with no account, no network and no HQ. Unresolvable by
|
|
43
|
+
// definition — there is nothing to resolve it against.
|
|
44
|
+
// user:<uuid> roster. An auth.users id. Resolvable, revocable, and
|
|
45
|
+
// stable across renames.
|
|
46
|
+
//
|
|
47
|
+
// A record is NEVER rewritten to upgrade a human: to a user:. The mapping
|
|
48
|
+
// lives in HQ (hq.identity_claims), so a local identity that is later claimed
|
|
49
|
+
// by a real account resolves correctly from then on without anything in git
|
|
50
|
+
// changing. History stays as it was written.
|
|
51
|
+
//
|
|
52
|
+
// This is not hypothetical tidiness. The actor ids actually on disk in this
|
|
53
|
+
// repo are already fragmented: `human:ben` and
|
|
54
|
+
// `human:mediareason <brottler@gmail.com>` are the same person, differing only
|
|
55
|
+
// by whether DECIBEL_ACTOR_ID happened to be set in that process.
|
|
56
|
+
/** Roster-resolvable prefixes. These are the only ones hq.resolve_ids knows. */
|
|
57
|
+
const ROSTER_PREFIXES = ['user', 'agent', 'team'];
|
|
58
|
+
// The prefix -> kind map. `claude:` and the system aliases are here because
|
|
59
|
+
// provenance has always accepted them and history contains them; dropping them
|
|
60
|
+
// would reclassify existing events.
|
|
61
|
+
const KIND_BY_PREFIX = {
|
|
62
|
+
user: 'user',
|
|
63
|
+
agent: 'agent',
|
|
64
|
+
team: 'team',
|
|
65
|
+
// A scope selector only (ADR-0014): it names the org a query is scoped to and
|
|
66
|
+
// is never an actor, an assignee or a team. HQ's resolve_ids does not know it,
|
|
67
|
+
// so it is not in ROSTER_PREFIXES.
|
|
68
|
+
org: 'org',
|
|
69
|
+
// An outside collaborator (a client) invited to one project in HQ
|
|
70
|
+
// (decibel-hq ADR-0015, tools ISS-0212). The value is the hq.project_grants
|
|
71
|
+
// id, NOT an auth uid: the grant exists from the moment Ben invites someone,
|
|
72
|
+
// before they ever sign in, and revoking it ends their access. HQ renders
|
|
73
|
+
// it from the grant's display_name; resolve_ids does not know it, so it is
|
|
74
|
+
// not a roster prefix.
|
|
75
|
+
guest: 'guest',
|
|
76
|
+
human: 'human',
|
|
77
|
+
ai: 'ai',
|
|
78
|
+
claude: 'ai',
|
|
79
|
+
system: 'system',
|
|
80
|
+
hook: 'system',
|
|
81
|
+
automation: 'system',
|
|
82
|
+
};
|
|
83
|
+
const ACTOR_TYPE_BY_KIND = {
|
|
84
|
+
user: 'human',
|
|
85
|
+
human: 'human',
|
|
86
|
+
agent: 'ai',
|
|
87
|
+
ai: 'ai',
|
|
88
|
+
system: 'system',
|
|
89
|
+
// A team is never an actor (see assertActor), but the map must be total so
|
|
90
|
+
// that a caller who classifies one anyway gets something rather than
|
|
91
|
+
// undefined. Reaching this value means a check was skipped upstream.
|
|
92
|
+
team: 'human',
|
|
93
|
+
// Same as team: never an actor (assertActor rejects it); present for totality.
|
|
94
|
+
org: 'human',
|
|
95
|
+
// A person outside the org. Answers asks, so it can stand as an actor.
|
|
96
|
+
guest: 'human',
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Split a prefixed id. Returns null for anything without a recognised prefix.
|
|
100
|
+
*
|
|
101
|
+
* Deliberately lenient about the VALUE: `human:mediareason <brottler@gmail.com>`
|
|
102
|
+
* is a real id in this repo's history — a git ident string, spaces, angle
|
|
103
|
+
* brackets, an embedded email and all. Nothing here may split, slugify or
|
|
104
|
+
* normalise it, because doing so would silently rewrite 202 existing events.
|
|
105
|
+
*/
|
|
106
|
+
export function parseIdentity(raw) {
|
|
107
|
+
if (typeof raw !== 'string')
|
|
108
|
+
return null;
|
|
109
|
+
const trimmed = raw.trim();
|
|
110
|
+
if (!trimmed)
|
|
111
|
+
return null;
|
|
112
|
+
const idx = trimmed.indexOf(':');
|
|
113
|
+
if (idx <= 0)
|
|
114
|
+
return null;
|
|
115
|
+
const prefix = trimmed.slice(0, idx).toLowerCase();
|
|
116
|
+
const value = trimmed.slice(idx + 1);
|
|
117
|
+
if (!value)
|
|
118
|
+
return null;
|
|
119
|
+
const kind = KIND_BY_PREFIX[prefix];
|
|
120
|
+
if (!kind)
|
|
121
|
+
return null;
|
|
122
|
+
return {
|
|
123
|
+
raw: trimmed,
|
|
124
|
+
prefix,
|
|
125
|
+
value,
|
|
126
|
+
kind,
|
|
127
|
+
resolvable: ROSTER_PREFIXES.includes(prefix),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The coarse actor type for an id. This is the canonical implementation —
|
|
132
|
+
* provenance's own classification defers to it so the two cannot drift.
|
|
133
|
+
*
|
|
134
|
+
* Unknown prefixes fall through to 'human', preserving the behaviour
|
|
135
|
+
* provenance has always had. That fall-through is safe ONLY because a `team:`
|
|
136
|
+
* id is rejected before it can reach an actor position; see assertActor.
|
|
137
|
+
*/
|
|
138
|
+
export function actorTypeOf(raw) {
|
|
139
|
+
const parsed = parseIdentity(raw);
|
|
140
|
+
if (!parsed)
|
|
141
|
+
return 'human';
|
|
142
|
+
return ACTOR_TYPE_BY_KIND[parsed.kind];
|
|
143
|
+
}
|
|
144
|
+
// ============================================================================
|
|
145
|
+
// Write-side validation
|
|
146
|
+
// ============================================================================
|
|
147
|
+
// Both rules below come from the pinned contract, and both are enforced by
|
|
148
|
+
// REJECTING rather than by reclassifying. A write that means something the
|
|
149
|
+
// system cannot represent should fail where it is made, not be quietly turned
|
|
150
|
+
// into a different write that happens to be representable.
|
|
151
|
+
/** Prefixes legal in an actor or assignee position: a person or an agent. */
|
|
152
|
+
const ACTOR_PREFIXES = new Set(['user', 'human', 'guest', 'agent', 'ai', 'claude', 'system', 'hook', 'automation']);
|
|
153
|
+
export class IdentityError extends Error {
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Assert that `raw` may stand where an actor or an assignee is expected.
|
|
157
|
+
*
|
|
158
|
+
* A `team:` id is specifically rejected here. Assigning to a team is what the
|
|
159
|
+
* `team` FIELD expresses; keeping assignee singular is what keeps a team a
|
|
160
|
+
* lens rather than an owner, which is Ben's decision in ADR-0011. Without this
|
|
161
|
+
* check, `team:<uuid>` would classify as 'human' through the fall-through in
|
|
162
|
+
* actorTypeOf and be recorded as a person.
|
|
163
|
+
*/
|
|
164
|
+
export function assertActor(raw) {
|
|
165
|
+
const parsed = parseIdentity(raw);
|
|
166
|
+
if (!parsed) {
|
|
167
|
+
throw new IdentityError(`"${raw}" is not a valid identity. Expected a prefixed id such as ` +
|
|
168
|
+
`user:<uuid>, agent:<uuid> or human:<name>.`);
|
|
169
|
+
}
|
|
170
|
+
if (parsed.kind === 'team') {
|
|
171
|
+
throw new IdentityError(`"${raw}" names a team, and a team cannot be an assignee. Put the team in the ` +
|
|
172
|
+
`\`team\` field instead — assignee is a single person or agent.`);
|
|
173
|
+
}
|
|
174
|
+
if (parsed.kind === 'org') {
|
|
175
|
+
throw new IdentityError(`"${raw}" names an org, and an org cannot be an actor or an assignee. An org ` +
|
|
176
|
+
`id only selects the scope of a query.`);
|
|
177
|
+
}
|
|
178
|
+
if (!ACTOR_PREFIXES.has(parsed.prefix)) {
|
|
179
|
+
throw new IdentityError(`"${raw}" is not valid in an assignee position.`);
|
|
180
|
+
}
|
|
181
|
+
return parsed;
|
|
182
|
+
}
|
|
183
|
+
/** Assert that `raw` may stand in a `team` field. Only `team:` ids qualify. */
|
|
184
|
+
export function assertTeam(raw) {
|
|
185
|
+
const parsed = parseIdentity(raw);
|
|
186
|
+
if (!parsed || parsed.kind !== 'team') {
|
|
187
|
+
throw new IdentityError(`"${raw}" is not a team id. Expected team:<uuid>. Team ids are minted by HQ; ` +
|
|
188
|
+
`a slug or a free-text name is not accepted, because it would have to be ` +
|
|
189
|
+
`migrated to a uuid later.`);
|
|
190
|
+
}
|
|
191
|
+
return parsed;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Read the `sub` claim out of a Supabase JWT without verifying it.
|
|
195
|
+
*
|
|
196
|
+
* Returns null on anything malformed. This must never throw: attribution is
|
|
197
|
+
* not worth failing a write over, and a caller with a broken token should end
|
|
198
|
+
* up attributed to their local identity rather than blocked.
|
|
199
|
+
*/
|
|
200
|
+
function subjectOfUnverifiedJwt(token) {
|
|
201
|
+
try {
|
|
202
|
+
const parts = token.split('.');
|
|
203
|
+
if (parts.length !== 3)
|
|
204
|
+
return null;
|
|
205
|
+
const json = Buffer.from(parts[1], 'base64url').toString('utf8');
|
|
206
|
+
const claims = JSON.parse(json);
|
|
207
|
+
return typeof claims.sub === 'string' && claims.sub ? claims.sub : null;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Memoised because resolveActingIdentity runs on EVERY dispatch, and this
|
|
214
|
+
// shells out twice. `undefined` means not yet looked up; `null` means looked
|
|
215
|
+
// up and absent — the distinction is what stops a machine without git config
|
|
216
|
+
// from paying for two failed execSync calls per tool call.
|
|
217
|
+
let gitUserCache;
|
|
218
|
+
/**
|
|
219
|
+
* The git identity as `name <email>`, or the bare name, or null.
|
|
220
|
+
*
|
|
221
|
+
* This is the canonical implementation; provenance defers to it so the two
|
|
222
|
+
* cannot drift. It is also why the ids on disk look the way they do — the
|
|
223
|
+
* angle-bracket form is a git ident string, not a handle, and parseIdentity
|
|
224
|
+
* preserves it verbatim for that reason.
|
|
225
|
+
*/
|
|
226
|
+
export function gitUserIdent() {
|
|
227
|
+
if (gitUserCache !== undefined)
|
|
228
|
+
return gitUserCache;
|
|
229
|
+
try {
|
|
230
|
+
const opts = { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] };
|
|
231
|
+
const name = execSync('git config user.name', opts).trim();
|
|
232
|
+
const email = execSync('git config user.email', opts).trim();
|
|
233
|
+
gitUserCache = name && email ? `${name} <${email}>` : name || null;
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
gitUserCache = null;
|
|
237
|
+
}
|
|
238
|
+
return gitUserCache;
|
|
239
|
+
}
|
|
240
|
+
/** Test seam: drop the memoised git identity. */
|
|
241
|
+
export function resetGitUserCache() {
|
|
242
|
+
gitUserCache = undefined;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* The acting identity for this call.
|
|
246
|
+
*
|
|
247
|
+
* Order: an explicit DECIBEL_ACTOR_ID always wins, because it is the only way
|
|
248
|
+
* an operator can state who they are; then the JWT; then git; then the OS
|
|
249
|
+
* user. The env var outranks the header deliberately — a machine configured to
|
|
250
|
+
* say who it is should not be overridden by whatever token a caller presents.
|
|
251
|
+
*/
|
|
252
|
+
export function resolveActingIdentity(ctx, sources = {}) {
|
|
253
|
+
const env = sources.env ?? process.env;
|
|
254
|
+
const explicit = env.DECIBEL_ACTOR_ID?.trim();
|
|
255
|
+
const explicitParsed = explicit ? parseIdentity(explicit) : null;
|
|
256
|
+
// A team or an org cannot act. Ignore such a value and fall through to the
|
|
257
|
+
// next source rather than recording a team or an org as the author.
|
|
258
|
+
const nonActor = explicitParsed?.kind === 'team' || explicitParsed?.kind === 'org';
|
|
259
|
+
if (explicit && !nonActor) {
|
|
260
|
+
if (explicitParsed)
|
|
261
|
+
return { id: explicitParsed.raw, parsed: explicitParsed, source: 'env', verified: false };
|
|
262
|
+
// An unprefixed DECIBEL_ACTOR_ID is a configuration mistake, not a reason
|
|
263
|
+
// to lose the operator's intent. Treat it as the local name they meant.
|
|
264
|
+
const coerced = parseIdentity(`human:${explicit}`);
|
|
265
|
+
return { id: coerced.raw, parsed: coerced, source: 'env', verified: false };
|
|
266
|
+
}
|
|
267
|
+
if (ctx?.userKey) {
|
|
268
|
+
const sub = subjectOfUnverifiedJwt(ctx.userKey);
|
|
269
|
+
if (sub) {
|
|
270
|
+
const parsed = parseIdentity(`user:${sub}`);
|
|
271
|
+
return { id: parsed.raw, parsed, source: 'header', verified: false };
|
|
272
|
+
}
|
|
273
|
+
// Fall through. A malformed token attributes to the local identity rather
|
|
274
|
+
// than to nobody, and rather than failing the write.
|
|
275
|
+
}
|
|
276
|
+
const gitUser = (sources.gitUser ?? gitUserIdent)();
|
|
277
|
+
if (gitUser) {
|
|
278
|
+
const parsed = parseIdentity(`human:${gitUser}`);
|
|
279
|
+
return { id: parsed.raw, parsed, source: 'git', verified: false };
|
|
280
|
+
}
|
|
281
|
+
const osUser = env.USER || env.USERNAME || 'unknown';
|
|
282
|
+
const parsed = parseIdentity(`human:${osUser}`);
|
|
283
|
+
return { id: parsed.raw, parsed, source: 'os', verified: false };
|
|
284
|
+
}
|
|
285
|
+
const storage = new AsyncLocalStorage();
|
|
286
|
+
/**
|
|
287
|
+
* Run `fn` with `identity` as the acting identity. Nested calls keep the
|
|
288
|
+
* outermost identity: a tool that dispatches another tool is still the same
|
|
289
|
+
* person acting, and re-deriving it inside would let a delegated call
|
|
290
|
+
* attribute itself to the daemon's local user.
|
|
291
|
+
*/
|
|
292
|
+
export function withIdentity(identity, fn) {
|
|
293
|
+
const existing = storage.getStore();
|
|
294
|
+
if (existing?.identity)
|
|
295
|
+
return fn();
|
|
296
|
+
return storage.run({ identity }, fn);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The acting identity for the current dispatch, if a scope is open.
|
|
300
|
+
*
|
|
301
|
+
* Returns undefined outside a scope rather than inventing an identity. A
|
|
302
|
+
* writer that gets undefined should omit the field, not guess — an absent
|
|
303
|
+
* author is honest, and a wrong one is not.
|
|
304
|
+
*/
|
|
305
|
+
export function currentIdentity() {
|
|
306
|
+
return storage.getStore()?.identity;
|
|
307
|
+
}
|
|
308
|
+
/** The id to stamp, or undefined outside a dispatch scope. */
|
|
309
|
+
export function currentActorId() {
|
|
310
|
+
return storage.getStore()?.identity?.id;
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wCAAwC;AACxC,+EAA+E;AAC/E,uBAAuB;AACvB,EAAE;AACF,4EAA4E;AAC5E,sEAAsE;AACtE,+EAA+E;AAC/E,4EAA4E;AAC5E,2EAA2E;AAC3E,gDAAgD;AAChD,EAAE;AACF,uEAAuE;AACvE,qEAAqE;AACrE,cAAc;AACd,EAAE;A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AO,CAAC,QAAQ,EAAE,CAAC;IACpC,IAAI,QAAQ,EAAE,QAAQ;QAAE,OAAO,EAAE,EAAE,CAAC;IACpC,OAAO,OAAO,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC;AACtC,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,EAAE,CAAC;AAC1C,CAAC"}
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ToolSpec, ToolResult } from './tools/types.js';
|
|
2
2
|
import type { FacadeSpec, DetailTier, McpToolDefinition } from './facades/types.js';
|
|
3
|
+
import { type CircuitSnapshot } from './runtime/circuitBreaker.js';
|
|
3
4
|
/**
|
|
4
5
|
* Optional context threaded through every dispatch call.
|
|
5
6
|
* This is plumbing, not policy — the kernel passes it to handlers
|
|
@@ -20,6 +21,15 @@ export interface DispatchContext {
|
|
|
20
21
|
allowedFacades?: string[];
|
|
21
22
|
/** License tier — when set, pro facades are rejected for 'core' tier */
|
|
22
23
|
tier?: 'core' | 'pro' | 'apps';
|
|
24
|
+
/**
|
|
25
|
+
* Which transport carried this call. Set by the adapter, never by the caller.
|
|
26
|
+
* 'http' rejects facades marked localOnly — see FacadeSpec.localOnly.
|
|
27
|
+
*
|
|
28
|
+
* Unset means stdio: a context arriving without a transport came from an
|
|
29
|
+
* in-process caller, and defaulting the ABSENT case to 'http' would break
|
|
30
|
+
* every existing direct kernel consumer. The HTTP adapters set it explicitly.
|
|
31
|
+
*/
|
|
32
|
+
transport?: 'stdio' | 'http';
|
|
23
33
|
/** Engagement mode: 'suggest' | 'curate' | 'compose' */
|
|
24
34
|
engagementMode?: string;
|
|
25
35
|
/** Identity of the calling user (Supabase access token / JWT, via X-User-Key) */
|
|
@@ -29,6 +39,22 @@ export interface DispatchContext {
|
|
|
29
39
|
/** Request correlation ID (crypto.randomUUID) — set by client, threaded through events */
|
|
30
40
|
requestId?: string;
|
|
31
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* What the last createKernel() call loaded, and what it refused. Surfaced on
|
|
44
|
+
* /health so a rejected extension is visible without reading the daemon log.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getExtensionDiagnostics(): {
|
|
47
|
+
loaded: Array<{
|
|
48
|
+
name: string;
|
|
49
|
+
version: string;
|
|
50
|
+
tier: string;
|
|
51
|
+
facades: string[];
|
|
52
|
+
}>;
|
|
53
|
+
rejected: Array<{
|
|
54
|
+
entry: string;
|
|
55
|
+
reason: string;
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
32
58
|
export interface DispatchEvent {
|
|
33
59
|
type: 'dispatch' | 'result' | 'error';
|
|
34
60
|
facade?: string;
|
|
@@ -54,6 +80,15 @@ export interface BatchResult {
|
|
|
54
80
|
action: string;
|
|
55
81
|
result?: ToolResult;
|
|
56
82
|
error?: string;
|
|
83
|
+
/**
|
|
84
|
+
* Machine-readable failure kind. Present only for STRUCTURAL failures — the
|
|
85
|
+
* call never ran because nothing by that name is registered. A call that ran
|
|
86
|
+
* and failed carries its failure in `result.isError` instead, which is a
|
|
87
|
+
* different thing and must stay distinguishable: "this facade does not exist
|
|
88
|
+
* here" and "this action returned an error" need different reactions from a
|
|
89
|
+
* caller, and only the first is a configuration problem.
|
|
90
|
+
*/
|
|
91
|
+
code?: 'UNKNOWN_FACADE';
|
|
57
92
|
duration_ms: number;
|
|
58
93
|
}
|
|
59
94
|
export interface ToolKernel {
|
|
@@ -81,11 +116,21 @@ export interface ToolKernel {
|
|
|
81
116
|
* Get MCP tool definitions for the tools/list response.
|
|
82
117
|
* Returns facade definitions filtered by detail tier.
|
|
83
118
|
*/
|
|
84
|
-
getMcpToolDefinitions(tier?: DetailTier
|
|
119
|
+
getMcpToolDefinitions(tier?: DetailTier, opts?: {
|
|
120
|
+
transport?: 'stdio' | 'http';
|
|
121
|
+
}): McpToolDefinition[];
|
|
85
122
|
/** Subscribe to dispatch events (dispatch, result, error) */
|
|
86
123
|
on(event: string, listener: (evt: DispatchEvent) => void): void;
|
|
87
124
|
/** Unsubscribe from dispatch events (for SSE cleanup) */
|
|
88
125
|
off(event: string, listener: (evt: DispatchEvent) => void): void;
|
|
126
|
+
/**
|
|
127
|
+
* Circuits that are open or accumulating faults, keyed by facade.
|
|
128
|
+
* Empty object means every facade is healthy. Surfaced on /health so a
|
|
129
|
+
* degraded dependency is visible without reading the dispatch log.
|
|
130
|
+
*/
|
|
131
|
+
circuitSnapshot(): Record<string, CircuitSnapshot>;
|
|
132
|
+
/** Force a circuit closed (operator escape hatch, and test hygiene). */
|
|
133
|
+
resetCircuit(key?: string): void;
|
|
89
134
|
/** Total internal tool count */
|
|
90
135
|
toolCount: number;
|
|
91
136
|
/** Total facade count */
|
package/dist/kernel.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kernel.d.ts","sourceRoot":"","sources":["../src/kernel.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAKpF,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAQ3F;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,C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