@namzu/sdk 0.4.3 → 0.4.4
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 +36 -0
- package/dist/bridge/tools/connector/adapter.d.ts +2 -2
- package/dist/bus/index.d.ts +3 -1
- package/dist/bus/index.d.ts.map +1 -1
- package/dist/bus/index.js +18 -11
- package/dist/bus/index.js.map +1 -1
- package/dist/config/runtime.d.ts +28 -28
- package/dist/probe/context.d.ts +8 -0
- package/dist/probe/context.d.ts.map +1 -0
- package/dist/probe/context.js +7 -0
- package/dist/probe/context.js.map +1 -0
- package/dist/probe/errors.d.ts +12 -0
- package/dist/probe/errors.d.ts.map +1 -0
- package/dist/probe/errors.js +21 -0
- package/dist/probe/errors.js.map +1 -0
- package/dist/probe/index.d.ts +5 -0
- package/dist/probe/index.d.ts.map +1 -0
- package/dist/probe/index.js +4 -0
- package/dist/probe/index.js.map +1 -0
- package/dist/probe/registry.d.ts +24 -0
- package/dist/probe/registry.d.ts.map +1 -0
- package/dist/probe/registry.js +228 -0
- package/dist/probe/registry.js.map +1 -0
- package/dist/probe/registry.test.d.ts +7 -0
- package/dist/probe/registry.test.d.ts.map +1 -0
- package/dist/probe/registry.test.js +310 -0
- package/dist/probe/registry.test.js.map +1 -0
- package/dist/provider/instrumentation.d.ts +9 -0
- package/dist/provider/instrumentation.d.ts.map +1 -0
- package/dist/provider/instrumentation.js +104 -0
- package/dist/provider/instrumentation.js.map +1 -0
- package/dist/provider/instrumentation.test.d.ts +2 -0
- package/dist/provider/instrumentation.test.d.ts.map +1 -0
- package/dist/provider/instrumentation.test.js +152 -0
- package/dist/provider/instrumentation.test.js.map +1 -0
- package/dist/public-runtime.d.ts +5 -0
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +4 -0
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +3 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/runtime/query/events.d.ts +3 -1
- package/dist/runtime/query/events.d.ts.map +1 -1
- package/dist/runtime/query/events.js +6 -1
- package/dist/runtime/query/events.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +3 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +30 -1
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/types/bus/index.d.ts +46 -2
- package/dist/types/bus/index.d.ts.map +1 -1
- package/dist/types/doctor/check.d.ts +41 -0
- package/dist/types/doctor/check.d.ts.map +1 -0
- package/dist/types/doctor/check.js +2 -0
- package/dist/types/doctor/check.js.map +1 -0
- package/dist/types/doctor/index.d.ts +2 -0
- package/dist/types/doctor/index.d.ts.map +1 -0
- package/dist/types/doctor/index.js +2 -0
- package/dist/types/doctor/index.js.map +1 -0
- package/dist/types/probe/event-kind.d.ts +6 -0
- package/dist/types/probe/event-kind.d.ts.map +1 -0
- package/dist/types/probe/event-kind.js +2 -0
- package/dist/types/probe/event-kind.js.map +1 -0
- package/dist/types/probe/event-of.d.ts +5 -0
- package/dist/types/probe/event-of.d.ts.map +1 -0
- package/dist/types/probe/event-of.js +2 -0
- package/dist/types/probe/event-of.js.map +1 -0
- package/dist/types/probe/index.d.ts +4 -0
- package/dist/types/probe/index.d.ts.map +1 -0
- package/dist/types/probe/index.js +2 -0
- package/dist/types/probe/index.js.map +1 -0
- package/dist/types/probe/registry.d.ts +27 -0
- package/dist/types/probe/registry.d.ts.map +1 -0
- package/dist/types/probe/registry.js +2 -0
- package/dist/types/probe/registry.js.map +1 -0
- package/dist/vault/instrumentation.d.ts +11 -0
- package/dist/vault/instrumentation.d.ts.map +1 -0
- package/dist/vault/instrumentation.js +32 -0
- package/dist/vault/instrumentation.js.map +1 -0
- package/dist/vault/instrumentation.test.d.ts +2 -0
- package/dist/vault/instrumentation.test.d.ts.map +1 -0
- package/dist/vault/instrumentation.test.js +80 -0
- package/dist/vault/instrumentation.test.js.map +1 -0
- package/package.json +1 -1
- package/src/bus/index.ts +21 -10
- package/src/probe/context.ts +14 -0
- package/src/probe/errors.ts +27 -0
- package/src/probe/index.ts +4 -0
- package/src/probe/registry.test.ts +480 -0
- package/src/probe/registry.ts +276 -0
- package/src/provider/instrumentation.test.ts +192 -0
- package/src/provider/instrumentation.ts +139 -0
- package/src/public-runtime.ts +17 -0
- package/src/public-types.ts +3 -0
- package/src/runtime/query/events.ts +6 -1
- package/src/runtime/query/executor.ts +34 -0
- package/src/types/bus/index.ts +54 -2
- package/src/types/doctor/check.ts +53 -0
- package/src/types/doctor/index.ts +9 -0
- package/src/types/probe/event-kind.ts +8 -0
- package/src/types/probe/event-of.ts +3 -0
- package/src/types/probe/index.ts +11 -0
- package/src/types/probe/registry.ts +36 -0
- package/src/vault/instrumentation.test.ts +98 -0
- package/src/vault/instrumentation.ts +56 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ffe516c: Probe layer (typed observation + narrow veto) over AgentBus + RunEvent stream — ses_007 phases 0–3.
|
|
8
|
+
|
|
9
|
+
Public surface additions:
|
|
10
|
+
|
|
11
|
+
- **Typed probe observation.** `probe.on(kind | kind[], handler, opts?)` registers a typed handler scoped to one or more event kinds. `probe.onAny(handler, opts?)` is the catch-all tier preserving legacy `AgentBus.on` semantics. Options: `{ where, priority, name, override }`. Events are frozen at the registry boundary; throws are isolated per probe.
|
|
12
|
+
- **Narrow veto on tool execution.** `probe.veto('tool_executing', handler, opts?)` registers a veto handler. Handler returns `'allow' | 'deny' | { action: 'deny', reason }`. `VetoableEventKind = 'tool_executing'` in v1 (additive minor adds more kinds later). First-deny wins by ascending priority; subsequent veto handlers still fire for audit. Tool executor short-circuits before `tools.execute(...)` on deny: returns a synthetic tool failure carrying `ProbeVetoError.message` so the LLM sees a normal tool-call failure with the probe name + reason.
|
|
13
|
+
- **5 new bus event variants.** `provider_call_start`, `provider_call_completed`, `provider_call_failed`, `vault_lookup`, `sandbox_decision`. Joined to the existing `AgentBusEvent` discriminated union. Snake_case real discriminants — no rename pass on existing events.
|
|
14
|
+
- **Opt-in instrumentation wrappers.** `wrapProviderWithProbes(provider, opts?)` returns an `LLMProvider` that emits `provider_call_*` around every `chat`/`chatStream` call (correlated by a `pcall_${string}` callId, with optional usage telemetry). `wrapVaultWithProbes(vault, opts?)` emits `vault_lookup` on every `retrieve()`; the secret value is never included in the event payload (covered by a "no leakage" test).
|
|
15
|
+
- **First-time public exposure of bus event types.** `AgentBusEvent`, `AgentBusEventListener`, `CircuitBreakerSnapshot`, `FileLock`, etc. were already reachable via `AgentBus.on(listener)` at runtime but couldn't be statically typed by consumers. Now in `public-types.ts`. Pre-existing duplicate `LockId` declaration in `types/bus/` was deduplicated to a re-export from `types/ids/` in passing.
|
|
16
|
+
- **Replay-aware probe context.** `ProbeContext.isReplay: boolean` flag wired through `buildProbeContext({ runId?, isReplay? })` so probes that bill or call external services can opt out on replayed runs (`ctx.isReplay === true`). Replay-execution wiring lands in a future session; the accessor is ready.
|
|
17
|
+
|
|
18
|
+
Integration:
|
|
19
|
+
|
|
20
|
+
- `AgentBus.emit` dispatches through `ProbeRegistry` first (typed-priority probes → legacy `bus.on` listeners → `onAny` catch-all). Existing `bus.on(listener)` consumers see every event in unchanged relative order.
|
|
21
|
+
- `EventTranslator.emitEvent` dispatches every `RunEvent` through the same registry before the existing pendingEvents push + persist flow.
|
|
22
|
+
- `ToolExecutor.executeSingle` calls `probes.queryVeto({type: 'tool_executing', ...})` immediately after the existing `tool_executing` emit, before `tools.execute(...)`.
|
|
23
|
+
|
|
24
|
+
Not yet wired (follow-up commits):
|
|
25
|
+
|
|
26
|
+
- Per-run probes via `createRun({ probes: [...] })` — the registry has the foundation; createRun plumbing lands in a follow-up.
|
|
27
|
+
- `wrapProviderWithProbes` / `wrapVaultWithProbes` are opt-in helpers; the SDK's own `ProviderRegistry` does not auto-wrap registered providers yet.
|
|
28
|
+
- `sandbox_decision` ships as a type only; emit site lands when a real sandbox provider exists (current `LocalSandboxProvider` is a stub).
|
|
29
|
+
|
|
30
|
+
Public surface delta: `380 → 392` runtime keys (verified against the regenerated baseline). Net new symbols added by this changeset:
|
|
31
|
+
|
|
32
|
+
- `probe`, `ProbeRegistry`, `createProbeRegistry`, `buildProbeContext`, `ProbeNameCollisionError`, `ProbeVetoError`
|
|
33
|
+
- `wrapProviderWithProbes`, `wrapVaultWithProbes`
|
|
34
|
+
|
|
35
|
+
Non-runtime (types-only) additions: `ProbeEventKind`, `ProbeEventOf<K>`, `ProbeContext`, `ProbeHandler<K>`, `ProbeOptions<K>`, `Unsubscribe`, `VetoableEventKind`, `VetoDecision`, `VetoHandler<K>`, `VetoOutcome`, `DoctorStatus`, `DoctorCategory`, `DoctorCheck`, `DoctorCheckContext`, `DoctorCheckResult`, `DoctorCheckRecord`, `DoctorReport`, `ProviderCallId`, `ProviderCallUsage`, `SandboxDecisionAction`, plus first-time exposure of all `AgentBusEvent` shape types.
|
|
36
|
+
|
|
37
|
+
Doctor types ship in this release; the runtime registry + CLI command land in a subsequent ses_007 patch.
|
|
38
|
+
|
|
3
39
|
## 0.4.3
|
|
4
40
|
|
|
5
41
|
### Patch Changes
|
|
@@ -12,13 +12,13 @@ declare const ConnectorRouterInputSchema: z.ZodObject<{
|
|
|
12
12
|
method: z.ZodString;
|
|
13
13
|
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
|
-
method: string;
|
|
16
15
|
input: Record<string, unknown>;
|
|
16
|
+
method: string;
|
|
17
17
|
connectorId: string;
|
|
18
18
|
instanceId: string;
|
|
19
19
|
}, {
|
|
20
|
-
method: string;
|
|
21
20
|
input: Record<string, unknown>;
|
|
21
|
+
method: string;
|
|
22
22
|
connectorId: string;
|
|
23
23
|
instanceId: string;
|
|
24
24
|
}>;
|
package/dist/bus/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ProbeRegistry } from '../probe/registry.js';
|
|
1
2
|
import type { AgentBusEventListener } from '../types/bus/index.js';
|
|
2
3
|
import type { RunId } from '../types/ids/index.js';
|
|
3
4
|
import type { Logger } from '../utils/logger.js';
|
|
@@ -19,7 +20,8 @@ export declare class AgentBus {
|
|
|
19
20
|
private readonly listeners;
|
|
20
21
|
private readonly log;
|
|
21
22
|
private readonly config;
|
|
22
|
-
|
|
23
|
+
private readonly probes;
|
|
24
|
+
constructor(log: Logger, config?: Partial<AgentBusConfig>, probeRegistry?: ProbeRegistry);
|
|
23
25
|
on(listener: AgentBusEventListener): () => void;
|
|
24
26
|
private emit;
|
|
25
27
|
cleanupAgent(runId: RunId): void;
|
package/dist/bus/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bus/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bus/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,aAAa,EAAiC,MAAM,sBAAsB,CAAA;AACxF,OAAO,KAAK,EAAiB,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AACjF,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEhD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAErD,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,aAAa,EAAE,MAAM,CAAA;IACrB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;IACxB,uBAAuB,E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from '../constants/bus/index.js';
|
|
2
|
+
import { buildProbeContext } from '../probe/context.js';
|
|
3
|
+
import { probe as defaultProbeRegistry } from '../probe/registry.js';
|
|
2
4
|
import { CircuitBreaker } from './breaker.js';
|
|
3
5
|
import { FileLockManager } from './lock.js';
|
|
4
6
|
import { EditOwnershipTracker } from './ownership.js';
|
|
@@ -17,9 +19,12 @@ export class AgentBus {
|
|
|
17
19
|
listeners = new Set();
|
|
18
20
|
log;
|
|
19
21
|
config;
|
|
20
|
-
|
|
22
|
+
probes;
|
|
23
|
+
constructor(log, config = {}, probeRegistry = defaultProbeRegistry) {
|
|
21
24
|
this.config = { ...DEFAULT_AGENT_BUS_CONFIG, ...config };
|
|
22
25
|
this.log = log.child({ component: 'AgentBus' });
|
|
26
|
+
this.probes = probeRegistry;
|
|
27
|
+
this.probes.setLogger(log);
|
|
23
28
|
const emitFn = (event) => this.emit(event);
|
|
24
29
|
this.locks = new FileLockManager(this.log, emitFn, {
|
|
25
30
|
lockTimeoutMs: this.config.lockTimeoutMs,
|
|
@@ -36,17 +41,19 @@ export class AgentBus {
|
|
|
36
41
|
};
|
|
37
42
|
}
|
|
38
43
|
emit(event) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
this.probes.dispatch(event, buildProbeContext(), () => {
|
|
45
|
+
for (const listener of this.listeners) {
|
|
46
|
+
try {
|
|
47
|
+
listener(event);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
this.log.error('event listener threw', {
|
|
51
|
+
eventType: event.type,
|
|
52
|
+
error: error instanceof Error ? error.message : String(error),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
42
55
|
}
|
|
43
|
-
|
|
44
|
-
this.log.error('event listener threw', {
|
|
45
|
-
eventType: event.type,
|
|
46
|
-
error: error instanceof Error ? error.message : String(error),
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
56
|
+
});
|
|
50
57
|
}
|
|
51
58
|
cleanupAgent(runId) {
|
|
52
59
|
this.log.info('cleaning up agent resources', { runId });
|
package/dist/bus/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,EACvB,2BAA2B,GAC3B,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bus/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iCAAiC,EACjC,gCAAgC,EAChC,+BAA+B,EAC/B,uBAAuB,EACvB,2BAA2B,GAC3B,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAsB,KAAK,IAAI,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAKxF,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AAWrD,MAAM,wBAAwB,GAAmB;IAChD,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,uBAAuB;IACtC,oBAAoB,EAAE,+BAA+B;IACrD,gBAAgB,EAAE,2BAA2B;IAC7C,uBAAuB,EAAE,iCAAiC;IAC1D,qBAAqB,EAAE,gCAAgC;CACvD,CAAA;AAED,MAAM,OAAO,QAAQ;IACX,KAAK,CAAiB;IACtB,SAAS,CAAsB;IAC/B,OAAO,CAAgB;IAEf,SAAS,GAA+B,IAAI,GAAG,EAAE,CAAA;IACjD,GAAG,CAAQ;IACX,MAAM,CAAgB;IACtB,MAAM,CAAe;IAEtC,YACC,GAAW,EACX,SAAkC,EAAE,EACpC,gBAA+B,oBAAoB;QAEnD,IAAI,CAAC,MAAM,GAAG,EAAE,GAAG,wBAAwB,EAAE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"}
|
package/dist/config/runtime.d.ts
CHANGED
|
@@ -294,6 +294,20 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
294
294
|
tokenBudget: number;
|
|
295
295
|
maxResponseTokens: number;
|
|
296
296
|
maxIterations: number;
|
|
297
|
+
sandbox?: {
|
|
298
|
+
enabled: boolean;
|
|
299
|
+
provider: "local";
|
|
300
|
+
timeoutMs: number;
|
|
301
|
+
memoryLimitMb: number;
|
|
302
|
+
maxProcesses: number;
|
|
303
|
+
cleanupOnDestroy: boolean;
|
|
304
|
+
} | undefined;
|
|
305
|
+
plugins?: {
|
|
306
|
+
enabled: boolean;
|
|
307
|
+
autoDiscovery: boolean;
|
|
308
|
+
allowedScopes: ("user" | "project")[];
|
|
309
|
+
hookTimeoutMs: number;
|
|
310
|
+
} | undefined;
|
|
297
311
|
taskRouter?: {
|
|
298
312
|
default?: string | null | undefined;
|
|
299
313
|
compaction?: string | null | undefined;
|
|
@@ -315,20 +329,6 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
315
329
|
enabled: boolean;
|
|
316
330
|
strategy: "auto" | "disabled";
|
|
317
331
|
} | undefined;
|
|
318
|
-
plugins?: {
|
|
319
|
-
enabled: boolean;
|
|
320
|
-
autoDiscovery: boolean;
|
|
321
|
-
allowedScopes: ("user" | "project")[];
|
|
322
|
-
hookTimeoutMs: number;
|
|
323
|
-
} | undefined;
|
|
324
|
-
sandbox?: {
|
|
325
|
-
enabled: boolean;
|
|
326
|
-
provider: "local";
|
|
327
|
-
timeoutMs: number;
|
|
328
|
-
memoryLimitMb: number;
|
|
329
|
-
maxProcesses: number;
|
|
330
|
-
cleanupOnDestroy: boolean;
|
|
331
|
-
} | undefined;
|
|
332
332
|
}, {
|
|
333
333
|
timeoutMs?: number | undefined;
|
|
334
334
|
compaction?: {
|
|
@@ -351,6 +351,20 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
351
351
|
temperature?: number | undefined;
|
|
352
352
|
tokenBudget?: number | undefined;
|
|
353
353
|
maxResponseTokens?: number | undefined;
|
|
354
|
+
sandbox?: {
|
|
355
|
+
enabled?: boolean | undefined;
|
|
356
|
+
provider?: "local" | undefined;
|
|
357
|
+
timeoutMs?: number | undefined;
|
|
358
|
+
memoryLimitMb?: number | undefined;
|
|
359
|
+
maxProcesses?: number | undefined;
|
|
360
|
+
cleanupOnDestroy?: boolean | undefined;
|
|
361
|
+
} | undefined;
|
|
362
|
+
plugins?: {
|
|
363
|
+
enabled?: boolean | undefined;
|
|
364
|
+
autoDiscovery?: boolean | undefined;
|
|
365
|
+
allowedScopes?: ("user" | "project")[] | undefined;
|
|
366
|
+
hookTimeoutMs?: number | undefined;
|
|
367
|
+
} | undefined;
|
|
354
368
|
maxIterations?: number | undefined;
|
|
355
369
|
taskRouter?: {
|
|
356
370
|
default?: string | null | undefined;
|
|
@@ -373,20 +387,6 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
373
387
|
enabled?: boolean | undefined;
|
|
374
388
|
strategy?: "auto" | "disabled" | undefined;
|
|
375
389
|
} | undefined;
|
|
376
|
-
plugins?: {
|
|
377
|
-
enabled?: boolean | undefined;
|
|
378
|
-
autoDiscovery?: boolean | undefined;
|
|
379
|
-
allowedScopes?: ("user" | "project")[] | undefined;
|
|
380
|
-
hookTimeoutMs?: number | undefined;
|
|
381
|
-
} | undefined;
|
|
382
|
-
sandbox?: {
|
|
383
|
-
enabled?: boolean | undefined;
|
|
384
|
-
provider?: "local" | undefined;
|
|
385
|
-
timeoutMs?: number | undefined;
|
|
386
|
-
memoryLimitMb?: number | undefined;
|
|
387
|
-
maxProcesses?: number | undefined;
|
|
388
|
-
cleanupOnDestroy?: boolean | undefined;
|
|
389
|
-
} | undefined;
|
|
390
390
|
}>;
|
|
391
391
|
export type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
|
|
392
392
|
export declare const RUNTIME_DEFAULTS: Readonly<RuntimeConfig>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RunId } from '../types/ids/index.js';
|
|
2
|
+
import type { ProbeContext } from '../types/probe/index.js';
|
|
3
|
+
export interface ProbeContextInput {
|
|
4
|
+
readonly runId?: RunId;
|
|
5
|
+
readonly isReplay?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function buildProbeContext(input?: ProbeContextInput): ProbeContext;
|
|
8
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/probe/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D,MAAM,WAAW,iBAAiB;IACjC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,iBAAsB,GAAG,YAAY,CAK7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/probe/context.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,iBAAiB,CAAC,QAA2B,EAAE;IAC9D,OAAO,MAAM,CAAC,MAAM,CAAC;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,KAAK;KACjC,CAAC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VetoableEventKind } from '../types/probe/index.js';
|
|
2
|
+
export declare class ProbeNameCollisionError extends Error {
|
|
3
|
+
readonly probeName: string;
|
|
4
|
+
constructor(probeName: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class ProbeVetoError extends Error {
|
|
7
|
+
readonly probeName: string;
|
|
8
|
+
readonly reason: string;
|
|
9
|
+
readonly eventKind: VetoableEventKind;
|
|
10
|
+
constructor(probeName: string, reason: string, eventKind: VetoableEventKind);
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/probe/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAEhE,qBAAa,uBAAwB,SAAQ,KAAK;IACjD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;gBAEd,SAAS,EAAE,MAAM;CAO7B;AAED,qBAAa,cAAe,SAAQ,KAAK;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAA;gBAEzB,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB;CAO3E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export class ProbeNameCollisionError extends Error {
|
|
2
|
+
probeName;
|
|
3
|
+
constructor(probeName) {
|
|
4
|
+
super(`Probe name "${probeName}" is already registered. Pass { override: true } to replace, or pick a different name.`);
|
|
5
|
+
this.name = 'ProbeNameCollisionError';
|
|
6
|
+
this.probeName = probeName;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
export class ProbeVetoError extends Error {
|
|
10
|
+
probeName;
|
|
11
|
+
reason;
|
|
12
|
+
eventKind;
|
|
13
|
+
constructor(probeName, reason, eventKind) {
|
|
14
|
+
super(`Operation denied by probe "${probeName}" on ${eventKind}: ${reason}`);
|
|
15
|
+
this.name = 'ProbeVetoError';
|
|
16
|
+
this.probeName = probeName;
|
|
17
|
+
this.reason = reason;
|
|
18
|
+
this.eventKind = eventKind;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/probe/errors.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IACxC,SAAS,CAAQ;IAE1B,YAAY,SAAiB;QAC5B,KAAK,CACJ,eAAe,SAAS,wFAAwF,CAChH,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAA;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC3B,CAAC;CACD;AAED,MAAM,OAAO,cAAe,SAAQ,KAAK;IAC/B,SAAS,CAAQ;IACjB,MAAM,CAAQ;IACd,SAAS,CAAmB;IAErC,YAAY,SAAiB,EAAE,MAAc,EAAE,SAA4B;QAC1E,KAAK,CAAC,8BAA8B,SAAS,QAAQ,SAAS,KAAK,MAAM,EAAE,CAAC,CAAA;QAC5E,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAA;QAC5B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC3B,CAAC;CACD"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ProbeNameCollisionError, ProbeVetoError } from './errors.js';
|
|
2
|
+
export { buildProbeContext } from './context.js';
|
|
3
|
+
export type { ProbeContextInput } from './context.js';
|
|
4
|
+
export { ProbeRegistry, createProbeRegistry, probe } from './registry.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/probe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAChD,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/probe/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProbeContext, ProbeEvent, ProbeEventKind, ProbeEventOf, ProbeHandler, ProbeOptions, Unsubscribe, VetoHandler, VetoOutcome, VetoableEventKind } from '../types/probe/index.js';
|
|
2
|
+
import type { Logger } from '../utils/logger.js';
|
|
3
|
+
export declare class ProbeRegistry {
|
|
4
|
+
private readonly typedByKind;
|
|
5
|
+
private readonly vetoByKind;
|
|
6
|
+
private readonly catchAll;
|
|
7
|
+
private readonly byName;
|
|
8
|
+
private nextId;
|
|
9
|
+
private log?;
|
|
10
|
+
setLogger(log: Logger): void;
|
|
11
|
+
on<K extends ProbeEventKind>(kind: K | readonly K[], handler: ProbeHandler<K>, opts?: ProbeOptions<K>): Unsubscribe;
|
|
12
|
+
onAny(handler: (event: ProbeEvent, ctx: ProbeContext) => void, opts?: ProbeOptions): Unsubscribe;
|
|
13
|
+
dispatch(event: ProbeEvent, ctx: ProbeContext, betweenTier?: () => void): void;
|
|
14
|
+
veto<K extends VetoableEventKind>(kind: K, handler: VetoHandler<K>, opts?: ProbeOptions<K>): Unsubscribe;
|
|
15
|
+
queryVeto<K extends VetoableEventKind>(event: ProbeEventOf<K>, ctx: ProbeContext): VetoOutcome;
|
|
16
|
+
clear(): void;
|
|
17
|
+
private runTier;
|
|
18
|
+
private makeEntry;
|
|
19
|
+
private removeAnywhere;
|
|
20
|
+
private logThrow;
|
|
21
|
+
}
|
|
22
|
+
export declare const probe: ProbeRegistry;
|
|
23
|
+
export declare function createProbeRegistry(): ProbeRegistry;
|
|
24
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/probe/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EACZ,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EAEX,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAoEhD,qBAAa,aAAa;IACzB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+C;IAC3E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAiD;IAC5E,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;IACxE,OAAO,CAAC,MAAM,CAAI;IAClB,OAAO,CAAC,GAAG,CAAC,CAAQ;IAEpB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI5B,EAAE,CAAC,CAAC,SAAS,cAAc,EAC1B,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,EACtB,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,IAAI,GAAE,YAAY,CAAC,CAAC,CAAM,GACxB,WAAW;IAyBd,KAAK,CACJ,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,KAAK,IAAI,EACvD,IAAI,GAAE,YAAiB,GACrB,WAAW;IASd,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,YAAY,EAAE,WAAW,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;IAa9E,IAAI,CAAC,CAAC,SAAS,iBAAiB,EAC/B,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,EACvB,IAAI,GAAE,YAAY,CAAC,CAAC,CAAM,GACxB,WAAW;IAgCd,SAAS,CAAC,CAAC,SAAS,iBAAiB,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,YAAY,GAAG,WAAW;IA6B9F,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,SAAS;IAwBjB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,QAAQ;CAQhB;AAED,eAAO,MAAM,KAAK,EAAE,aAAmC,CAAA;AAEvD,wBAAgB,mBAAmB,IAAI,aAAa,CAEnD"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { ProbeNameCollisionError } from './errors.js';
|
|
2
|
+
function compareVeto(a, b) {
|
|
3
|
+
if (a.priority !== b.priority)
|
|
4
|
+
return a.priority - b.priority;
|
|
5
|
+
return a.id - b.id;
|
|
6
|
+
}
|
|
7
|
+
function insertSortedVeto(list, entry) {
|
|
8
|
+
let lo = 0;
|
|
9
|
+
let hi = list.length;
|
|
10
|
+
while (lo < hi) {
|
|
11
|
+
const mid = (lo + hi) >>> 1;
|
|
12
|
+
if (compareVeto(list[mid], entry) <= 0)
|
|
13
|
+
lo = mid + 1;
|
|
14
|
+
else
|
|
15
|
+
hi = mid;
|
|
16
|
+
}
|
|
17
|
+
list.splice(lo, 0, entry);
|
|
18
|
+
}
|
|
19
|
+
function removeVeto(list, entry) {
|
|
20
|
+
const idx = list.indexOf(entry);
|
|
21
|
+
if (idx >= 0)
|
|
22
|
+
list.splice(idx, 1);
|
|
23
|
+
}
|
|
24
|
+
function normalizeDecision(decision) {
|
|
25
|
+
if (decision === 'allow')
|
|
26
|
+
return { allow: true };
|
|
27
|
+
if (decision === 'deny')
|
|
28
|
+
return { allow: false };
|
|
29
|
+
return { allow: false, reason: decision.reason };
|
|
30
|
+
}
|
|
31
|
+
function compareEntries(a, b) {
|
|
32
|
+
if (a.priority !== b.priority)
|
|
33
|
+
return a.priority - b.priority;
|
|
34
|
+
return a.id - b.id;
|
|
35
|
+
}
|
|
36
|
+
function insertSorted(list, entry) {
|
|
37
|
+
let lo = 0;
|
|
38
|
+
let hi = list.length;
|
|
39
|
+
while (lo < hi) {
|
|
40
|
+
const mid = (lo + hi) >>> 1;
|
|
41
|
+
if (compareEntries(list[mid], entry) <= 0)
|
|
42
|
+
lo = mid + 1;
|
|
43
|
+
else
|
|
44
|
+
hi = mid;
|
|
45
|
+
}
|
|
46
|
+
list.splice(lo, 0, entry);
|
|
47
|
+
}
|
|
48
|
+
function removeEntry(list, entry) {
|
|
49
|
+
const idx = list.indexOf(entry);
|
|
50
|
+
if (idx >= 0)
|
|
51
|
+
list.splice(idx, 1);
|
|
52
|
+
}
|
|
53
|
+
export class ProbeRegistry {
|
|
54
|
+
typedByKind = new Map();
|
|
55
|
+
vetoByKind = new Map();
|
|
56
|
+
catchAll = [];
|
|
57
|
+
byName = new Map();
|
|
58
|
+
nextId = 1;
|
|
59
|
+
log;
|
|
60
|
+
setLogger(log) {
|
|
61
|
+
this.log = log.child({ component: 'ProbeRegistry' });
|
|
62
|
+
}
|
|
63
|
+
on(kind, handler, opts = {}) {
|
|
64
|
+
const kinds = Array.isArray(kind) ? kind : [kind];
|
|
65
|
+
const entry = this.makeEntry(handler, opts);
|
|
66
|
+
for (const k of kinds) {
|
|
67
|
+
let bucket = this.typedByKind.get(k);
|
|
68
|
+
if (!bucket) {
|
|
69
|
+
bucket = [];
|
|
70
|
+
this.typedByKind.set(k, bucket);
|
|
71
|
+
}
|
|
72
|
+
insertSorted(bucket, entry);
|
|
73
|
+
}
|
|
74
|
+
return () => {
|
|
75
|
+
for (const k of kinds) {
|
|
76
|
+
const bucket = this.typedByKind.get(k);
|
|
77
|
+
if (bucket)
|
|
78
|
+
removeEntry(bucket, entry);
|
|
79
|
+
}
|
|
80
|
+
if (entry.name)
|
|
81
|
+
this.byName.delete(entry.name);
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
onAny(handler, opts = {}) {
|
|
85
|
+
const entry = this.makeEntry(handler, opts);
|
|
86
|
+
insertSorted(this.catchAll, entry);
|
|
87
|
+
return () => {
|
|
88
|
+
removeEntry(this.catchAll, entry);
|
|
89
|
+
if (entry.name)
|
|
90
|
+
this.byName.delete(entry.name);
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
dispatch(event, ctx, betweenTier) {
|
|
94
|
+
const frozen = Object.isFrozen(event) ? event : Object.freeze(event);
|
|
95
|
+
this.runTier(this.typedByKind.get(frozen.type) ?? [], frozen, ctx);
|
|
96
|
+
if (betweenTier) {
|
|
97
|
+
try {
|
|
98
|
+
betweenTier();
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
this.logThrow('between-tier', frozen.type, error);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.runTier(this.catchAll, frozen, ctx);
|
|
105
|
+
}
|
|
106
|
+
veto(kind, handler, opts = {}) {
|
|
107
|
+
if (opts.name !== undefined) {
|
|
108
|
+
const existing = this.byName.get(opts.name);
|
|
109
|
+
if (existing && !opts.override) {
|
|
110
|
+
throw new ProbeNameCollisionError(opts.name);
|
|
111
|
+
}
|
|
112
|
+
if (existing && opts.override)
|
|
113
|
+
this.removeAnywhere(existing);
|
|
114
|
+
}
|
|
115
|
+
const entry = {
|
|
116
|
+
id: this.nextId++,
|
|
117
|
+
name: opts.name,
|
|
118
|
+
priority: opts.priority ?? 0,
|
|
119
|
+
handler: handler,
|
|
120
|
+
where: opts.where,
|
|
121
|
+
};
|
|
122
|
+
let bucket = this.vetoByKind.get(kind);
|
|
123
|
+
if (!bucket) {
|
|
124
|
+
bucket = [];
|
|
125
|
+
this.vetoByKind.set(kind, bucket);
|
|
126
|
+
}
|
|
127
|
+
insertSortedVeto(bucket, entry);
|
|
128
|
+
if (entry.name)
|
|
129
|
+
this.byName.set(entry.name, entry);
|
|
130
|
+
return () => {
|
|
131
|
+
const list = this.vetoByKind.get(kind);
|
|
132
|
+
if (list)
|
|
133
|
+
removeVeto(list, entry);
|
|
134
|
+
if (entry.name)
|
|
135
|
+
this.byName.delete(entry.name);
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
queryVeto(event, ctx) {
|
|
139
|
+
const wide = event;
|
|
140
|
+
const frozen = Object.isFrozen(wide) ? wide : Object.freeze(wide);
|
|
141
|
+
const bucket = this.vetoByKind.get(frozen.type);
|
|
142
|
+
if (!bucket || bucket.length === 0)
|
|
143
|
+
return { action: 'allow' };
|
|
144
|
+
let firstDeny;
|
|
145
|
+
for (const entry of bucket) {
|
|
146
|
+
if (entry.where && !entry.where(frozen))
|
|
147
|
+
continue;
|
|
148
|
+
let decision;
|
|
149
|
+
try {
|
|
150
|
+
decision = entry.handler(frozen, ctx);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
this.logThrow(entry.name ?? 'unnamed', frozen.type, error);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
const normalized = normalizeDecision(decision);
|
|
157
|
+
if (!normalized.allow && firstDeny === undefined) {
|
|
158
|
+
firstDeny = {
|
|
159
|
+
action: 'deny',
|
|
160
|
+
probeName: entry.name,
|
|
161
|
+
reason: normalized.reason,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return firstDeny ?? { action: 'allow' };
|
|
166
|
+
}
|
|
167
|
+
clear() {
|
|
168
|
+
this.typedByKind.clear();
|
|
169
|
+
this.vetoByKind.clear();
|
|
170
|
+
this.catchAll.length = 0;
|
|
171
|
+
this.byName.clear();
|
|
172
|
+
}
|
|
173
|
+
runTier(entries, event, ctx) {
|
|
174
|
+
for (const entry of entries) {
|
|
175
|
+
if (entry.where && !entry.where(event))
|
|
176
|
+
continue;
|
|
177
|
+
try {
|
|
178
|
+
entry.handler(event, ctx);
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
this.logThrow(entry.name ?? 'unnamed', event.type, error);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
makeEntry(handler, opts) {
|
|
186
|
+
if (opts.name !== undefined) {
|
|
187
|
+
const existing = this.byName.get(opts.name);
|
|
188
|
+
if (existing && !opts.override) {
|
|
189
|
+
throw new ProbeNameCollisionError(opts.name);
|
|
190
|
+
}
|
|
191
|
+
if (existing && opts.override)
|
|
192
|
+
this.removeAnywhere(existing);
|
|
193
|
+
}
|
|
194
|
+
const entry = {
|
|
195
|
+
id: this.nextId++,
|
|
196
|
+
name: opts.name,
|
|
197
|
+
priority: opts.priority ?? 0,
|
|
198
|
+
handler,
|
|
199
|
+
where: opts.where,
|
|
200
|
+
};
|
|
201
|
+
if (entry.name)
|
|
202
|
+
this.byName.set(entry.name, entry);
|
|
203
|
+
return entry;
|
|
204
|
+
}
|
|
205
|
+
removeAnywhere(entry) {
|
|
206
|
+
for (const bucket of this.typedByKind.values())
|
|
207
|
+
removeEntry(bucket, entry);
|
|
208
|
+
removeEntry(this.catchAll, entry);
|
|
209
|
+
for (const bucket of this.vetoByKind.values())
|
|
210
|
+
removeVeto(bucket, entry);
|
|
211
|
+
if (entry.name)
|
|
212
|
+
this.byName.delete(entry.name);
|
|
213
|
+
}
|
|
214
|
+
logThrow(probeName, eventType, error) {
|
|
215
|
+
if (!this.log)
|
|
216
|
+
return;
|
|
217
|
+
this.log.error('probe handler threw', {
|
|
218
|
+
probeName,
|
|
219
|
+
eventType,
|
|
220
|
+
error: error instanceof Error ? error.message : String(error),
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
export const probe = new ProbeRegistry();
|
|
225
|
+
export function createProbeRegistry() {
|
|
226
|
+
return new ProbeRegistry();
|
|
227
|
+
}
|
|
228
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version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AK,CAAC,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QAClD,OAAO,KAAK,CAAA;IACb,CAAC;IAEO,cAAc,CAAC,KAA6B;QACnD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE;YAAE,WAAW,CAAC,MAAM,EAAE,KAAmB,CAAC,CAAA;QACxF,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAmB,CAAC,CAAA;QAC/C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;YAAE,UAAU,CAAC,MAAM,EAAE,KAAkB,CAAC,CAAA;QACrF,IAAI,KAAK,CAAC,IAAI;YAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC/C,CAAC;IAEO,QAAQ,CAAC,SAAiB,EAAE,SAAiB,EAAE,KAAc;QACpE,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,OAAM;QACrB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB,EAAE;YACrC,SAAS;YACT,SAAS;YACT,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC7D,CAAC,CAAA;IACH,CAAC;CACD;AAED,MAAM,CAAC,MAAM,KAAK,GAAkB,IAAI,aAAa,EAAE,CAAA;AAEvD,MAAM,UAAU,mBAAmB;IAClC,OAAO,IAAI,aAAa,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ratified §9 of docs.local/sessions/ses_007-probe-and-doctor/design.md.
|
|
3
|
+
* These tests pin the contract documented there — not an internal
|
|
4
|
+
* implementation detail. If the semantics change, update §9 first.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=registry.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.test.d.ts","sourceRoot":"","sources":["../../src/probe/registry.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|