@mandible-ai/mandible 0.3.6 → 0.3.8
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 +74 -24
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/patterns/debug-bridge.d.ts +48 -0
- package/dist/src/patterns/debug-bridge.d.ts.map +1 -0
- package/dist/src/patterns/debug-bridge.js +216 -0
- package/dist/src/patterns/debug-bridge.js.map +1 -0
- package/dist/src/patterns/index.d.ts +2 -0
- package/dist/src/patterns/index.d.ts.map +1 -1
- package/dist/src/patterns/index.js +1 -0
- package/dist/src/patterns/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,7 +86,7 @@ await host.stop();
|
|
|
86
86
|
|
|
87
87
|
#### Docker
|
|
88
88
|
|
|
89
|
-
Runs each colony
|
|
89
|
+
Runs each colony in a Docker container. Same colony definitions, but the runtime boundary is containers instead of running in-process:
|
|
90
90
|
|
|
91
91
|
```typescript
|
|
92
92
|
import { mandible, FilesystemEnvironment, docker } from '@mandible-ai/mandible';
|
|
@@ -95,23 +95,19 @@ const env = new FilesystemEnvironment({ root: './.mandible/signals' });
|
|
|
95
95
|
|
|
96
96
|
const host = await mandible('code-pipeline')
|
|
97
97
|
.environment(env)
|
|
98
|
-
.host(docker({
|
|
99
|
-
apiUrl: process.env.MANDIBLE_API_URL!,
|
|
100
|
-
apiKey: process.env.MANDIBLE_API_KEY!,
|
|
101
|
-
image: 'mandible-colony:latest',
|
|
102
|
-
}))
|
|
98
|
+
.host(docker({ image: 'mandible-colony:latest' }))
|
|
103
99
|
.colony('shaper', shaper)
|
|
104
100
|
.colony('critic', critic)
|
|
105
101
|
.colony('keeper', keeper)
|
|
106
102
|
.start();
|
|
107
103
|
|
|
108
|
-
|
|
104
|
+
await host.dashboard(); // signal snapshots + colony names from containers
|
|
109
105
|
await host.stop();
|
|
110
106
|
```
|
|
111
107
|
|
|
112
|
-
#### Cloud (
|
|
108
|
+
#### Cloud (microVMs)
|
|
113
109
|
|
|
114
|
-
For production workloads, run colonies in isolated
|
|
110
|
+
For production workloads, run colonies in isolated zones via [Mandible Cloud](https://mandible.cloud):
|
|
115
111
|
|
|
116
112
|
```typescript
|
|
117
113
|
import { mandible, FilesystemEnvironment } from '@mandible-ai/mandible';
|
|
@@ -175,7 +171,7 @@ Every concept maps to a biological analogy:
|
|
|
175
171
|
| Mandible | Biology | Description |
|
|
176
172
|
|----------|---------|-------------|
|
|
177
173
|
| **Signal** | Pheromone | A typed marker deposited in the environment with a payload, concentration, and TTL. |
|
|
178
|
-
| **Environment** | Substrate | The shared medium agents read from and write to. Filesystem, GitHub,
|
|
174
|
+
| **Environment** | Substrate | The shared medium agents read from and write to. Filesystem, GitHub, Dolt. |
|
|
179
175
|
| **Colony** | Ant caste | A group of identical agents with shared sensors, rules, and claim strategy. |
|
|
180
176
|
| **Sensor** | Antennae | How a colony perceives signals. A query pattern like `task:ready` or `review:*`. |
|
|
181
177
|
| **Rule** | Instinct | A stimulus→response mapping: "when I sense X, do Y and deposit Z." |
|
|
@@ -221,17 +217,45 @@ const host = await mandible('my-swarm')
|
|
|
221
217
|
|
|
222
218
|
### Colony builder
|
|
223
219
|
|
|
224
|
-
|
|
220
|
+
Colony definitions are typically written as standalone configurator functions that return a `ColonyBuilder` callback. This keeps colony logic in its own module, reusable across hosts:
|
|
225
221
|
|
|
226
222
|
```typescript
|
|
227
|
-
|
|
228
|
-
|
|
223
|
+
// colonies/worker.ts
|
|
224
|
+
import type { ColonyBuilder } from '@mandible-ai/mandible';
|
|
225
|
+
|
|
226
|
+
export function configureWorker() {
|
|
227
|
+
return (c: ColonyBuilder) => c
|
|
228
|
+
.sense('task:ready', { unclaimed: true })
|
|
229
|
+
.do('process', async (signal, ctx) => {
|
|
230
|
+
ctx.log(`processing ${signal.id}`);
|
|
231
|
+
await ctx.deposit('task:done', signal.payload, {
|
|
232
|
+
causedBy: [signal.id],
|
|
233
|
+
});
|
|
234
|
+
await ctx.withdraw(signal.id);
|
|
235
|
+
})
|
|
236
|
+
.concurrency(1)
|
|
237
|
+
.claim('exclusive');
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Then wire it into a mandible system:
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
import { configureWorker } from './colonies/worker.js';
|
|
245
|
+
|
|
246
|
+
const host = await mandible('my-system')
|
|
247
|
+
.environment(env)
|
|
248
|
+
.colony('worker', configureWorker())
|
|
249
|
+
.start();
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
The builder supports the full range of colony configuration:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
(c: ColonyBuilder) => c
|
|
229
256
|
.sense('type:pattern', { unclaimed: true }) // what to watch for
|
|
230
257
|
.when(signal => signal.payload.priority > 0) // optional guard
|
|
231
|
-
.do('shape',
|
|
232
|
-
prompt: signal => `Implement: ${signal.payload.name}`,
|
|
233
|
-
allowedTools: ['Read', 'Write'],
|
|
234
|
-
}))
|
|
258
|
+
.do('shape', handler) // action handler
|
|
235
259
|
.concurrency(3) // max parallel agents
|
|
236
260
|
.claim('lease', 30_000) // claim strategy
|
|
237
261
|
.poll(2000) // sensor poll interval (ms)
|
|
@@ -239,7 +263,6 @@ colony('name')
|
|
|
239
263
|
.autoWithdraw() // auto-remove processed signals
|
|
240
264
|
.timeout(60_000) // action timeout
|
|
241
265
|
.retry(3, 1000) // retry with backoff
|
|
242
|
-
.build();
|
|
243
266
|
```
|
|
244
267
|
|
|
245
268
|
**Claim strategies:**
|
|
@@ -265,6 +288,8 @@ Action providers wrap external capabilities into a standard interface for colony
|
|
|
265
288
|
|
|
266
289
|
The provider assembles context by walking signal lineage (`caused_by` chains), giving the agent full awareness of the work pipeline state.
|
|
267
290
|
|
|
291
|
+
See [Action Providers Guide](docs/how-to/action-providers.md) for full configuration reference, output mapping, and context assembly.
|
|
292
|
+
|
|
268
293
|
## Signal types
|
|
269
294
|
|
|
270
295
|
Signal types use a `domain:state` convention and support glob patterns for sensing:
|
|
@@ -322,7 +347,7 @@ const env = new GitHubEnvironment({
|
|
|
322
347
|
|
|
323
348
|
### Writing your own
|
|
324
349
|
|
|
325
|
-
Implement the `Environment` interface:
|
|
350
|
+
Implement the `Environment` interface (see [Custom Environment Guide](docs/how-to/custom-environment.md) for a full walkthrough):
|
|
326
351
|
|
|
327
352
|
```typescript
|
|
328
353
|
interface Environment {
|
|
@@ -357,7 +382,7 @@ Built-in hosts: `local()` (in-process), `docker()` (containers). Cloud hosts liv
|
|
|
357
382
|
|
|
358
383
|
## Patterns
|
|
359
384
|
|
|
360
|
-
Reusable coordination patterns built on top of the core primitives.
|
|
385
|
+
Reusable coordination patterns built on top of the core primitives. See [Bridging Signals](docs/how-to/bridge-signals.md) and [Monitoring Trust](docs/how-to/monitor-trust.md) for detailed usage.
|
|
361
386
|
|
|
362
387
|
### SignalBridge
|
|
363
388
|
|
|
@@ -376,9 +401,25 @@ const bridge = createBridge({
|
|
|
376
401
|
await bridge.start();
|
|
377
402
|
```
|
|
378
403
|
|
|
404
|
+
### DebugBridge
|
|
405
|
+
|
|
406
|
+
One-way gate from a signal server into a local environment. Enables ad-hoc testing from the cloud console — deposit a signal in the console and it flows through the WebSocket into the colony's real environment.
|
|
407
|
+
|
|
408
|
+
```typescript
|
|
409
|
+
import { createDebugBridge } from '@mandible-ai/mandible';
|
|
410
|
+
|
|
411
|
+
const bridge = createDebugBridge({
|
|
412
|
+
url: 'wss://signals.mandible.cloud/ws',
|
|
413
|
+
apiKey: 'mnd_...',
|
|
414
|
+
project: 'my-project',
|
|
415
|
+
environment: localEnv,
|
|
416
|
+
});
|
|
417
|
+
await bridge.start();
|
|
418
|
+
```
|
|
419
|
+
|
|
379
420
|
### Sentinel
|
|
380
421
|
|
|
381
|
-
Trust monitoring colony that watches an environment for signals with invalid or missing provenance. When violations are detected, the sentinel deposits `
|
|
422
|
+
Trust monitoring colony that watches an environment for signals with invalid or missing provenance. When violations are detected, the sentinel deposits `sentinel:flagged` report signals that other colonies can react to.
|
|
382
423
|
|
|
383
424
|
```typescript
|
|
384
425
|
import { createSentinel } from '@mandible-ai/mandible';
|
|
@@ -400,7 +441,7 @@ src/
|
|
|
400
441
|
server.ts Dashboard HTTP + WebSocket server
|
|
401
442
|
dashboard.html Live dashboard UI
|
|
402
443
|
cloud/
|
|
403
|
-
index.ts Cloud client for
|
|
444
|
+
index.ts Cloud client for deploy + bundle upload
|
|
404
445
|
core/
|
|
405
446
|
types.ts Core type system (Signal, Environment, Colony, Trust)
|
|
406
447
|
signal.ts Signal creation, matching, decay, priority sorting
|
|
@@ -423,15 +464,24 @@ src/
|
|
|
423
464
|
context.ts Context assembly from signal lineage
|
|
424
465
|
patterns/
|
|
425
466
|
bridge.ts SignalBridge — cross-environment mirroring with attestation
|
|
467
|
+
debug-bridge.ts DebugBridge — signal server → environment gate
|
|
426
468
|
sentinel.ts Sentinel — trust monitoring and violation reporting
|
|
427
469
|
|
|
428
470
|
tests/
|
|
471
|
+
cli/ Dashboard server, resolveEnvironments tests
|
|
429
472
|
core/ Signal, runtime, attestation tests
|
|
430
473
|
environments/ Filesystem, GitHub adapter tests
|
|
431
474
|
dsl/ DSL and mandible() builder tests
|
|
432
475
|
providers/ Agent, structured output, bash provider tests
|
|
433
476
|
colonies/ Integration tests for colony workflows
|
|
434
477
|
|
|
478
|
+
docs/
|
|
479
|
+
how-to/
|
|
480
|
+
bridge-signals.md SignalBridge + DebugBridge usage guide
|
|
481
|
+
action-providers.md withClaudeCode, withStructuredOutput, withBash reference
|
|
482
|
+
monitor-trust.md Sentinel pattern + trust policies
|
|
483
|
+
custom-environment.md Implementing the Environment interface
|
|
484
|
+
|
|
435
485
|
examples/
|
|
436
486
|
code-pipeline/
|
|
437
487
|
colonies.ts Shared colony definitions (shaper, critic, keeper)
|
|
@@ -484,11 +534,11 @@ Both colonies are wired to real Claude agents via `withClaudeCode`. The dashboar
|
|
|
484
534
|
|
|
485
535
|
- [x] `mandible dev` CLI + live dashboard
|
|
486
536
|
- [x] `withClaudeCode` wired to Claude Code SDK
|
|
487
|
-
- [x] Test suite (
|
|
537
|
+
- [x] Test suite (473 tests, 95%+ coverage)
|
|
488
538
|
- [x] GitHub environment adapter
|
|
489
539
|
- [x] `mandible()` DSL with Host/Environment separation
|
|
490
540
|
- [x] `local()` and `docker()` host implementations
|
|
491
|
-
- [
|
|
541
|
+
- [x] `@mandible-ai/cloud` — run colonies in isolation using microVMs via Mandible Cloud
|
|
492
542
|
- [ ] `create-mandible` starter template
|
|
493
543
|
- [ ] Dashboard GIF + landing page
|
|
494
544
|
- [ ] Dolt full implementation
|
package/dist/src/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export { createBridge } from './patterns/bridge.js';
|
|
|
22
22
|
export type { SignalBridge, BridgeStats } from './patterns/bridge.js';
|
|
23
23
|
export { createSentinel } from './patterns/sentinel.js';
|
|
24
24
|
export type { Sentinel, SentinelConfig, SentinelEvaluation, SentinelStats } from './patterns/sentinel.js';
|
|
25
|
+
export { createDebugBridge } from './patterns/debug-bridge.js';
|
|
26
|
+
export type { DebugBridge, DebugBridgeConfig } from './patterns/debug-bridge.js';
|
|
25
27
|
export { startDashboard, LocalDashboardSource, resolveEnvironments } from './cli/server.js';
|
|
26
28
|
export type { DashboardSource, ColonyInfo, DashboardOptions as DashboardServerOptions, SimpleConfig } from './cli/server.js';
|
|
27
29
|
export { withClaudeCode } from './providers/claude-code.js';
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAKA,YAAY,EACV,MAAM,EACN,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,aAAa,EACb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a,EAAE,MAAM,wBAAwB,CAAC;AAE1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAGjF,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC5F,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,IAAI,sBAAsB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG7H,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAEtE,YAAY,EACV,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EACf,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -30,6 +30,7 @@ export { generateIdentity, signSignal, createSigner, verifySignature, verifyAtte
|
|
|
30
30
|
// Patterns — reusable colony patterns
|
|
31
31
|
export { createBridge } from './patterns/bridge.js';
|
|
32
32
|
export { createSentinel } from './patterns/sentinel.js';
|
|
33
|
+
export { createDebugBridge } from './patterns/debug-bridge.js';
|
|
33
34
|
// Dashboard
|
|
34
35
|
export { startDashboard, LocalDashboardSource, resolveEnvironments } from './cli/server.js';
|
|
35
36
|
// Action providers
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,wBAAwB;AACxB,+DAA+D;AAkC/D,mBAAmB;AACnB,O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AAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAInE,mBAAmB;AACnB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,kCAAkC;AAClC,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,YAAY,EACZ,eAAe,EACf,sBAAsB,EACtB,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,sCAAsC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,YAAY;AACZ,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG5F,mBAAmB;AACnB,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Signal, Environment } from '../core/types.js';
|
|
2
|
+
import type { BridgeStats } from './bridge.js';
|
|
3
|
+
export interface DebugBridgeConfig {
|
|
4
|
+
/** Human-readable name for this bridge instance */
|
|
5
|
+
name?: string;
|
|
6
|
+
/** Signal server WebSocket URL */
|
|
7
|
+
url: string;
|
|
8
|
+
/** API key for signal server authentication */
|
|
9
|
+
apiKey: string;
|
|
10
|
+
/** Project ID for signal isolation */
|
|
11
|
+
project: string;
|
|
12
|
+
/** Target environment — inbound signals are deposited here */
|
|
13
|
+
environment: Environment;
|
|
14
|
+
/** Signal type filter patterns sent to the signal server (default: ['*']) */
|
|
15
|
+
signalTypes?: string[];
|
|
16
|
+
/** Auto-reconnect on disconnect (default: true) */
|
|
17
|
+
reconnect?: boolean;
|
|
18
|
+
/** Callback when a signal is successfully bridged */
|
|
19
|
+
onBridged?: (signal: Signal) => void;
|
|
20
|
+
/** Callback on errors */
|
|
21
|
+
onError?: (error: Error) => void;
|
|
22
|
+
/** Connection timeout in ms (default: 10000) */
|
|
23
|
+
connectTimeout?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface DebugBridge {
|
|
26
|
+
start(): Promise<void>;
|
|
27
|
+
stop(): Promise<void>;
|
|
28
|
+
readonly running: boolean;
|
|
29
|
+
readonly stats: BridgeStats;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Create a debug bridge that subscribes to signals from a signal server
|
|
33
|
+
* and deposits them into a local environment.
|
|
34
|
+
*
|
|
35
|
+
* This is a one-way gate: signal server → environment. It enables ad-hoc
|
|
36
|
+
* testing from the cloud console's deposit drawer.
|
|
37
|
+
*
|
|
38
|
+
* Usage:
|
|
39
|
+
* const bridge = createDebugBridge({
|
|
40
|
+
* url: 'ws://localhost:8080/ws',
|
|
41
|
+
* apiKey: 'mnd_...',
|
|
42
|
+
* project: 'my-project',
|
|
43
|
+
* environment: localEnv,
|
|
44
|
+
* });
|
|
45
|
+
* await bridge.start();
|
|
46
|
+
*/
|
|
47
|
+
export declare function createDebugBridge(config: DebugBridgeConfig): DebugBridge;
|
|
48
|
+
//# sourceMappingURL=debug-bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-bridge.d.ts","sourceRoot":"","sources":["../../../src/patterns/debug-bridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,MAAM,WAAW,iBAAiB;IAChC,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IAEZ,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAEhB,8DAA8D;IAC9D,WAAW,EAAE,WAAW,CAAC;IAEzB,6EAA6E;IAC7E,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IAEvB,mDAAmD;IACnD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,qDAAqD;IACrD,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,yBAAyB;IACzB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC,gDAAgD;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAQD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,WAAW,CAiMxE"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// PURPOSE: DebugBridge — one-way gate from signal server to a local environment.
|
|
2
|
+
// PURPOSE: Enables ad-hoc testing: console deposits a signal → bridge carries it into the colony's real environment.
|
|
3
|
+
import WebSocket from 'ws';
|
|
4
|
+
const PING_INTERVAL = 30_000;
|
|
5
|
+
const PONG_TIMEOUT = 10_000;
|
|
6
|
+
const MAX_BACKOFF = 30_000;
|
|
7
|
+
const MAX_TRACKED = 10_000;
|
|
8
|
+
const DEFAULT_CONNECT_TIMEOUT = 10_000;
|
|
9
|
+
/**
|
|
10
|
+
* Create a debug bridge that subscribes to signals from a signal server
|
|
11
|
+
* and deposits them into a local environment.
|
|
12
|
+
*
|
|
13
|
+
* This is a one-way gate: signal server → environment. It enables ad-hoc
|
|
14
|
+
* testing from the cloud console's deposit drawer.
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* const bridge = createDebugBridge({
|
|
18
|
+
* url: 'ws://localhost:8080/ws',
|
|
19
|
+
* apiKey: 'mnd_...',
|
|
20
|
+
* project: 'my-project',
|
|
21
|
+
* environment: localEnv,
|
|
22
|
+
* });
|
|
23
|
+
* await bridge.start();
|
|
24
|
+
*/
|
|
25
|
+
export function createDebugBridge(config) {
|
|
26
|
+
const name = config.name ?? 'debug-bridge';
|
|
27
|
+
const signalTypes = config.signalTypes ?? ['*'];
|
|
28
|
+
const shouldReconnect = config.reconnect !== false;
|
|
29
|
+
const connectTimeout = config.connectTimeout ?? DEFAULT_CONNECT_TIMEOUT;
|
|
30
|
+
let running = false;
|
|
31
|
+
let intentionalClose = false;
|
|
32
|
+
let ws = null;
|
|
33
|
+
let pingTimer = null;
|
|
34
|
+
let pongTimer = null;
|
|
35
|
+
let reconnectTimer = null;
|
|
36
|
+
let attempt = 0;
|
|
37
|
+
let msgCounter = 0;
|
|
38
|
+
let pendingSubId = null;
|
|
39
|
+
// Dedup set — prevents re-depositing the same signal on reconnect
|
|
40
|
+
const bridgedIds = new Set();
|
|
41
|
+
const stats = {
|
|
42
|
+
signalsBridged: 0,
|
|
43
|
+
signalsFiltered: 0,
|
|
44
|
+
errors: 0,
|
|
45
|
+
};
|
|
46
|
+
function trackBridged(id) {
|
|
47
|
+
bridgedIds.add(id);
|
|
48
|
+
if (bridgedIds.size > MAX_TRACKED) {
|
|
49
|
+
const iter = bridgedIds.values();
|
|
50
|
+
for (let i = 0; i < MAX_TRACKED / 2; i++) {
|
|
51
|
+
bridgedIds.delete(iter.next().value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function clearTimers() {
|
|
56
|
+
if (pingTimer) {
|
|
57
|
+
clearInterval(pingTimer);
|
|
58
|
+
pingTimer = null;
|
|
59
|
+
}
|
|
60
|
+
if (pongTimer) {
|
|
61
|
+
clearTimeout(pongTimer);
|
|
62
|
+
pongTimer = null;
|
|
63
|
+
}
|
|
64
|
+
if (reconnectTimer) {
|
|
65
|
+
clearTimeout(reconnectTimer);
|
|
66
|
+
reconnectTimer = null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function scheduleReconnect() {
|
|
70
|
+
if (intentionalClose || !shouldReconnect)
|
|
71
|
+
return;
|
|
72
|
+
const delay = Math.min(1000 * 2 ** attempt, MAX_BACKOFF);
|
|
73
|
+
attempt++;
|
|
74
|
+
reconnectTimer = setTimeout(() => {
|
|
75
|
+
if (!intentionalClose && running) {
|
|
76
|
+
connectWs();
|
|
77
|
+
}
|
|
78
|
+
}, delay);
|
|
79
|
+
}
|
|
80
|
+
function connectWs(onAuthenticated, onFailed) {
|
|
81
|
+
const socket = new WebSocket(config.url);
|
|
82
|
+
ws = socket;
|
|
83
|
+
socket.on('open', () => {
|
|
84
|
+
attempt = 0;
|
|
85
|
+
socket.send(JSON.stringify({ type: 'auth', apiKey: config.apiKey, project: config.project }));
|
|
86
|
+
});
|
|
87
|
+
socket.on('message', (raw) => {
|
|
88
|
+
let msg;
|
|
89
|
+
try {
|
|
90
|
+
msg = JSON.parse(typeof raw === 'string' ? raw : raw.toString());
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (msg.type === 'authenticated') {
|
|
96
|
+
// Start keepalive pings
|
|
97
|
+
pingTimer = setInterval(() => {
|
|
98
|
+
if (socket.readyState === WebSocket.OPEN) {
|
|
99
|
+
socket.ping();
|
|
100
|
+
pongTimer = setTimeout(() => {
|
|
101
|
+
socket.terminate();
|
|
102
|
+
}, PONG_TIMEOUT);
|
|
103
|
+
}
|
|
104
|
+
}, PING_INTERVAL);
|
|
105
|
+
// Subscribe to inbound signals — wait for server ack before resolving
|
|
106
|
+
const subId = `debug_bridge_${++msgCounter}`;
|
|
107
|
+
pendingSubId = subId;
|
|
108
|
+
socket.send(JSON.stringify({
|
|
109
|
+
type: 'subscribe',
|
|
110
|
+
id: subId,
|
|
111
|
+
query: { type: signalTypes.length === 1 ? signalTypes[0] : signalTypes },
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
else if (msg.type === 'result' && msg.id === pendingSubId) {
|
|
115
|
+
pendingSubId = null;
|
|
116
|
+
onAuthenticated?.();
|
|
117
|
+
}
|
|
118
|
+
else if (msg.type === 'signal' && msg.signal) {
|
|
119
|
+
const sig = msg.signal;
|
|
120
|
+
if (bridgedIds.has(sig.id))
|
|
121
|
+
return;
|
|
122
|
+
trackBridged(sig.id);
|
|
123
|
+
config.environment.deposit({
|
|
124
|
+
type: sig.type,
|
|
125
|
+
payload: sig.payload,
|
|
126
|
+
meta: {
|
|
127
|
+
deposited_by: sig.meta?.deposited_by ?? 'console',
|
|
128
|
+
tags: sig.meta?.tags,
|
|
129
|
+
caused_by: sig.meta?.caused_by,
|
|
130
|
+
...(sig.meta?.ttl != null && { ttl: sig.meta.ttl }),
|
|
131
|
+
},
|
|
132
|
+
}).then(() => {
|
|
133
|
+
stats.signalsBridged++;
|
|
134
|
+
stats.lastBridgedAt = Date.now();
|
|
135
|
+
config.onBridged?.(sig);
|
|
136
|
+
}).catch((err) => {
|
|
137
|
+
stats.errors++;
|
|
138
|
+
config.onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
else if (msg.type === 'error') {
|
|
142
|
+
const err = new Error(`signal server error: ${msg.code} — ${msg.message}`);
|
|
143
|
+
stats.errors++;
|
|
144
|
+
config.onError?.(err);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
socket.on('pong', () => {
|
|
148
|
+
if (pongTimer) {
|
|
149
|
+
clearTimeout(pongTimer);
|
|
150
|
+
pongTimer = null;
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
socket.on('error', (err) => {
|
|
154
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
155
|
+
stats.errors++;
|
|
156
|
+
config.onError?.(error);
|
|
157
|
+
onFailed?.(error);
|
|
158
|
+
});
|
|
159
|
+
socket.on('close', () => {
|
|
160
|
+
clearTimers();
|
|
161
|
+
ws = null;
|
|
162
|
+
if (!intentionalClose && running) {
|
|
163
|
+
scheduleReconnect();
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return {
|
|
168
|
+
start() {
|
|
169
|
+
if (running)
|
|
170
|
+
return Promise.resolve();
|
|
171
|
+
running = true;
|
|
172
|
+
intentionalClose = false;
|
|
173
|
+
attempt = 0;
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
let settled = false;
|
|
176
|
+
const timeout = setTimeout(() => {
|
|
177
|
+
if (!settled) {
|
|
178
|
+
settled = true;
|
|
179
|
+
reject(new Error(`[debug-bridge:${name}] connection timeout after ${connectTimeout}ms`));
|
|
180
|
+
}
|
|
181
|
+
}, connectTimeout);
|
|
182
|
+
connectWs(() => {
|
|
183
|
+
if (!settled) {
|
|
184
|
+
settled = true;
|
|
185
|
+
clearTimeout(timeout);
|
|
186
|
+
resolve();
|
|
187
|
+
}
|
|
188
|
+
}, (err) => {
|
|
189
|
+
if (!settled) {
|
|
190
|
+
settled = true;
|
|
191
|
+
clearTimeout(timeout);
|
|
192
|
+
reject(err);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
async stop() {
|
|
198
|
+
if (!running)
|
|
199
|
+
return;
|
|
200
|
+
running = false;
|
|
201
|
+
intentionalClose = true;
|
|
202
|
+
clearTimers();
|
|
203
|
+
if (ws) {
|
|
204
|
+
ws.close();
|
|
205
|
+
ws = null;
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
get running() {
|
|
209
|
+
return running;
|
|
210
|
+
},
|
|
211
|
+
get stats() {
|
|
212
|
+
return { ...stats };
|
|
213
|
+
},
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=debug-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-bridge.js","sourceRoot":"","sources":["../../../src/patterns/debug-bridge.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,qHAAqH;AAIrH,OAAO,SAAS,MAAM,IAAI,CAAC;AAyC3B,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,YAAY,GAAG,MAAM,CAAC;AAC5B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAyB;IACzD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,IAAI,cAAc,CAAC;IAC3C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,CAAC,GAAG,CAAC,CAAC;IAChD,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,KAAK,KAAK,CAAC;IACnD,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,uBAAuB,CAAC;IAExE,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,EAAE,GAAqB,IAAI,CAAC;IAChC,IAAI,SAAS,GAA0C,IAAI,CAAC;IAC5D,IAAI,SAAS,GAAyC,IAAI,CAAC;IAC3D,IAAI,cAAc,GAAyC,IAAI,CAAC;IAChE,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,YAAY,GAAkB,IAAI,CAAC;IAEvC,kEAAkE;IAClE,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CA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AAI;YACR,IAAI,CAAC,OAAO;gBAAE,OAAO;YACrB,OAAO,GAAG,KAAK,CAAC;YAChB,gBAAgB,GAAG,IAAI,CAAC;YACxB,WAAW,EAAE,CAAC;YACd,IAAI,EAAE,EAAE,CAAC;gBACP,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,EAAE,GAAG,IAAI,CAAC;YACZ,CAAC;QACH,CAAC;QAED,IAAI,OAAO;YACT,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,KAAK;YACP,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -2,4 +2,6 @@ export { createBridge } from './bridge.js';
|
|
|
2
2
|
export type { SignalBridge, BridgeStats } from './bridge.js';
|
|
3
3
|
export { createSentinel } from './sentinel.js';
|
|
4
4
|
export type { Sentinel, SentinelConfig, SentinelEvaluation, SentinelStats } from './sentinel.js';
|
|
5
|
+
export { createDebugBridge } from './debug-bridge.js';
|
|
6
|
+
export type { DebugBridge, DebugBridgeConfig } from './debug-bridge.js';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/package.json
CHANGED