@noetic-tools/core 5.19.1 → 5.19.3
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/dist/adapters/openrouter.js +5 -0
- package/dist/builders/control-flow-builders.d.ts +15 -6
- package/dist/builders/control-flow-builders.js +8 -0
- package/dist/builders/decide-builders.d.ts +2 -5
- package/dist/builders/dynamic-workflow.d.ts +54 -2
- package/dist/builders/dynamic-workflow.js +247 -12
- package/dist/builders/every.d.ts +3 -3
- package/dist/builders/every.js +2 -1
- package/dist/builders/mcp-url-pattern.d.ts +13 -0
- package/dist/builders/mcp-url-pattern.js +85 -0
- package/dist/builders/provide-builder.d.ts +3 -2
- package/dist/builders/provide-builder.js +2 -1
- package/dist/builders/sequence.d.ts +14 -0
- package/dist/builders/sequence.js +103 -0
- package/dist/builders/spawn-builder.d.ts +3 -2
- package/dist/builders/spawn-builder.js +3 -2
- package/dist/builders/step-builders.d.ts +80 -1
- package/dist/builders/step-builders.js +115 -1
- package/dist/builders/verify-builder.d.ts +79 -0
- package/dist/builders/verify-builder.js +69 -0
- package/dist/builders/workflow-acp-grants.d.ts +42 -0
- package/dist/builders/workflow-acp-grants.js +224 -0
- package/dist/builders/workflow-child-nodes.d.ts +21 -0
- package/dist/builders/workflow-child-nodes.js +336 -0
- package/dist/builders/workflow-connection-nodes.d.ts +25 -0
- package/dist/builders/workflow-connection-nodes.js +198 -0
- package/dist/builders/workflow-connections.d.ts +90 -0
- package/dist/builders/workflow-connections.js +560 -0
- package/dist/builders/workflow-control-nodes.d.ts +13 -0
- package/dist/builders/workflow-control-nodes.js +213 -0
- package/dist/builders/workflow-hydrator.d.ts +56 -3
- package/dist/builders/workflow-hydrator.js +53 -520
- package/dist/builders/workflow-mcp-servers.d.ts +24 -0
- package/dist/builders/workflow-mcp-servers.js +220 -0
- package/dist/builders/workflow-verify.d.ts +19 -0
- package/dist/builders/workflow-verify.js +194 -0
- package/dist/conditions/conditions.d.ts +7 -5
- package/dist/conditions/conditions.js +7 -4
- package/dist/connections/blobs.d.ts +33 -0
- package/dist/connections/blobs.js +77 -0
- package/dist/connections/cron-schedule.d.ts +32 -0
- package/dist/connections/cron-schedule.js +213 -0
- package/dist/connections/durability.d.ts +65 -0
- package/dist/connections/durability.js +54 -0
- package/dist/connections/errors.d.ts +30 -0
- package/dist/connections/errors.js +100 -0
- package/dist/connections/event-stream.d.ts +24 -0
- package/dist/connections/event-stream.js +176 -0
- package/dist/connections/gates.d.ts +94 -0
- package/dist/connections/gates.js +271 -0
- package/dist/connections/glob.d.ts +10 -0
- package/dist/connections/glob.js +46 -0
- package/dist/connections/handle.d.ts +22 -0
- package/dist/connections/handle.js +84 -0
- package/dist/connections/harness-wiring.d.ts +52 -0
- package/dist/connections/harness-wiring.js +143 -0
- package/dist/connections/in-memory-connection.d.ts +147 -0
- package/dist/connections/in-memory-connection.js +593 -0
- package/dist/connections/index.d.ts +34 -0
- package/dist/connections/index.js +23 -0
- package/dist/connections/json-schema.d.ts +28 -0
- package/dist/connections/json-schema.js +338 -0
- package/dist/connections/model-tools.d.ts +46 -0
- package/dist/connections/model-tools.js +466 -0
- package/dist/connections/negotiation.d.ts +30 -0
- package/dist/connections/negotiation.js +159 -0
- package/dist/connections/policy.d.ts +21 -0
- package/dist/connections/policy.js +34 -0
- package/dist/connections/pool.d.ts +111 -0
- package/dist/connections/pool.js +339 -0
- package/dist/connections/refs.d.ts +74 -0
- package/dist/connections/refs.js +316 -0
- package/dist/connections/registry-types.d.ts +141 -0
- package/dist/connections/registry-types.js +14 -0
- package/dist/connections/registry.d.ts +125 -0
- package/dist/connections/registry.js +775 -0
- package/dist/connections/secrets.d.ts +59 -0
- package/dist/connections/secrets.js +153 -0
- package/dist/connections/settle.d.ts +9 -0
- package/dist/connections/settle.js +26 -0
- package/dist/connections/sources.d.ts +27 -0
- package/dist/connections/sources.js +300 -0
- package/dist/connections/triggers.d.ts +78 -0
- package/dist/connections/triggers.js +310 -0
- package/dist/connections/values.d.ts +26 -0
- package/dist/connections/values.js +93 -0
- package/dist/connections/views.d.ts +31 -0
- package/dist/connections/views.js +176 -0
- package/dist/expression/check.js +80 -1
- package/dist/expression/jsonata.d.ts +14 -4
- package/dist/expression/jsonata.js +27 -9
- package/dist/expression/step-outputs.d.ts +25 -0
- package/dist/expression/step-outputs.js +78 -0
- package/dist/harness/agent-harness.d.ts +69 -166
- package/dist/harness/agent-harness.js +170 -262
- package/dist/harness/call-span-collector.d.ts +33 -0
- package/dist/harness/call-span-collector.js +83 -0
- package/dist/harness/connection-gate.d.ts +78 -0
- package/dist/harness/connection-gate.js +170 -0
- package/dist/harness/deps/interpreter.d.ts +1 -0
- package/dist/harness/deps/interpreter.js +1 -0
- package/dist/harness/deps/runtime.d.ts +1 -1
- package/dist/harness/deps/types.d.ts +1 -1
- package/dist/harness/harness-options.d.ts +153 -0
- package/dist/harness/harness-options.js +36 -0
- package/dist/harness/harness-tracing.d.ts +16 -0
- package/dist/harness/harness-tracing.js +35 -0
- package/dist/harness/llm-client.d.ts +71 -0
- package/dist/harness/llm-client.js +218 -0
- package/dist/harness/model-call.d.ts +2 -7
- package/dist/harness/model-call.js +21 -549
- package/dist/harness/model-request.d.ts +42 -0
- package/dist/harness/model-request.js +159 -0
- package/dist/harness/model-stream.d.ts +39 -0
- package/dist/harness/model-stream.js +131 -0
- package/dist/harness/model-tool-round.d.ts +37 -0
- package/dist/harness/model-tool-round.js +197 -0
- package/dist/harness/spend.d.ts +2 -0
- package/dist/harness/spend.js +5 -1
- package/dist/index.d.ts +33 -8
- package/dist/index.js +18 -1
- package/dist/interpreter/connection-steps.d.ts +194 -0
- package/dist/interpreter/connection-steps.js +537 -0
- package/dist/interpreter/execute-action.d.ts +2 -8
- package/dist/interpreter/execute-action.js +3 -178
- package/dist/interpreter/execute-call.d.ts +19 -0
- package/dist/interpreter/execute-call.js +99 -0
- package/dist/interpreter/execute-control.d.ts +6 -1
- package/dist/interpreter/execute-control.js +14 -0
- package/dist/interpreter/execute-invoke-tool.d.ts +11 -0
- package/dist/interpreter/execute-invoke-tool.js +183 -0
- package/dist/interpreter/execute-verify.d.ts +21 -0
- package/dist/interpreter/execute-verify.js +391 -0
- package/dist/interpreter/execute-wait.d.ts +21 -0
- package/dist/interpreter/execute-wait.js +233 -0
- package/dist/interpreter/execute.js +24 -133
- package/dist/interpreter/step-kind-dispatch.d.ts +24 -0
- package/dist/interpreter/step-kind-dispatch.js +157 -0
- package/dist/interpreter/step-walk.d.ts +2 -0
- package/dist/interpreter/step-walk.js +24 -0
- package/dist/interpreter/verify-host.d.ts +40 -0
- package/dist/interpreter/verify-host.js +245 -0
- package/dist/runtime/durable/step-ledger.d.ts +31 -1
- package/dist/runtime/durable/step-ledger.js +87 -1
- package/dist/runtime/in-memory-artifact-store.d.ts +24 -0
- package/dist/runtime/in-memory-artifact-store.js +240 -0
- package/dist/schemas/workflow.d.ts +2 -2
- package/dist/schemas/workflow.js +1 -1
- package/dist/util/harness-internals.d.ts +25 -0
- package/dist/util/harness-internals.js +35 -0
- package/package.json +3 -3
- package/schema/noetic-workflow.schema.json +1309 -180
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How an `AgentHarness` holds its connections (spec 35 § Configuring
|
|
3
|
+
* connections, § Triggers; spec 08 § Connections and Triggers): the registry,
|
|
4
|
+
* the trigger runner, the connection view layers, and the gate hooks that
|
|
5
|
+
* route gate 5 through the harness's `beforeToolCall` layers and approver.
|
|
6
|
+
*
|
|
7
|
+
* Construction is synchronous and validates the configuration; providers
|
|
8
|
+
* connect and triggers start listening in `start()`.
|
|
9
|
+
*/
|
|
10
|
+
import { CONNECTION_EVENT_ITEM_TYPE, createMessage, frameworkCast, SteeringAction, } from '@noetic-tools/types';
|
|
11
|
+
import { emitFrameworkEvent, getBroadcaster } from '../runtime/broadcaster-utils.js';
|
|
12
|
+
import { buildConnectionTools } from './model-tools.js';
|
|
13
|
+
import { createConnectionRuntime } from './registry.js';
|
|
14
|
+
import { runEvery } from './settle.js';
|
|
15
|
+
import { TriggerRunner, validateTriggers } from './triggers.js';
|
|
16
|
+
import { connectionViewLayers } from './views.js';
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region Helpers
|
|
19
|
+
function deny(guidance) {
|
|
20
|
+
return {
|
|
21
|
+
action: SteeringAction.Deny,
|
|
22
|
+
guidance,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function gateHooks(harness) {
|
|
26
|
+
return {
|
|
27
|
+
async beforeCall(request) {
|
|
28
|
+
const layers = request.ctx?.layers;
|
|
29
|
+
if (!request.ctx || !layers || layers.length === 0) {
|
|
30
|
+
return {
|
|
31
|
+
action: SteeringAction.Allow,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return harness.beforeToolCall(layers, request.toolName, request.args, request.ctx, request.callId);
|
|
35
|
+
},
|
|
36
|
+
async approve(request) {
|
|
37
|
+
const approver = harness.config.approveToolCall;
|
|
38
|
+
if (!approver) {
|
|
39
|
+
return deny(`'${request.op}' on connection '${request.connection}' needs approval, but the harness has no approveToolCall`);
|
|
40
|
+
}
|
|
41
|
+
if (!request.ctx) {
|
|
42
|
+
return deny(`'${request.op}' needs approval, but the call has no context to ask from`);
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
return await approver({
|
|
46
|
+
toolName: request.toolName,
|
|
47
|
+
toolArgs: request.args,
|
|
48
|
+
callId: request.callId,
|
|
49
|
+
ctx: request.ctx,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
return deny(`approval failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function broadcast(options, event) {
|
|
59
|
+
const data = frameworkCast(event.data);
|
|
60
|
+
const own = event.ctx ? getBroadcaster(event.ctx) : undefined;
|
|
61
|
+
const targets = own
|
|
62
|
+
? [
|
|
63
|
+
own,
|
|
64
|
+
]
|
|
65
|
+
: [
|
|
66
|
+
...options.broadcasters(),
|
|
67
|
+
];
|
|
68
|
+
for (const broadcaster of targets) {
|
|
69
|
+
emitFrameworkEvent({
|
|
70
|
+
broadcaster,
|
|
71
|
+
agentName: options.harness.config.name,
|
|
72
|
+
eventType: event.type,
|
|
73
|
+
data,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async function deliverTurn(harness, delivery) {
|
|
78
|
+
const eventItem = frameworkCast({
|
|
79
|
+
type: CONNECTION_EVENT_ITEM_TYPE,
|
|
80
|
+
id: `connection-event-${delivery.messageId}`,
|
|
81
|
+
trigger: delivery.trigger,
|
|
82
|
+
event: delivery.event,
|
|
83
|
+
});
|
|
84
|
+
await harness.execute([
|
|
85
|
+
createMessage(delivery.input, 'user'),
|
|
86
|
+
eventItem,
|
|
87
|
+
], {
|
|
88
|
+
threadId: delivery.threadId,
|
|
89
|
+
messageId: delivery.messageId,
|
|
90
|
+
});
|
|
91
|
+
await harness.getAgentResponse({
|
|
92
|
+
threadId: delivery.threadId,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
//#region Public API
|
|
97
|
+
/**
|
|
98
|
+
* Builds a harness's connections from its options.
|
|
99
|
+
*
|
|
100
|
+
* @throws NoeticConfigError `CONNECTION_INVALID` for a malformed entry or trigger,
|
|
101
|
+
* `CONNECTION_UNKNOWN` for a trigger naming an unknown connection.
|
|
102
|
+
*/
|
|
103
|
+
export function createHarnessConnections(options) {
|
|
104
|
+
const registry = createConnectionRuntime({
|
|
105
|
+
connections: options.connections,
|
|
106
|
+
storage: options.storage,
|
|
107
|
+
artifacts: options.artifacts,
|
|
108
|
+
secrets: options.secrets,
|
|
109
|
+
hooks: gateHooks(options.harness),
|
|
110
|
+
onFrameworkEvent: (event) => broadcast(options, event),
|
|
111
|
+
});
|
|
112
|
+
const triggers = options.triggers ?? [];
|
|
113
|
+
validateTriggers(triggers, registry.names());
|
|
114
|
+
const runner = triggers.length > 0
|
|
115
|
+
? new TriggerRunner({
|
|
116
|
+
runtime: registry,
|
|
117
|
+
triggers,
|
|
118
|
+
storage: options.storage,
|
|
119
|
+
deliver: (delivery) => deliverTurn(options.harness, delivery),
|
|
120
|
+
})
|
|
121
|
+
: undefined;
|
|
122
|
+
const views = connectionViewLayers(registry);
|
|
123
|
+
let starting;
|
|
124
|
+
return {
|
|
125
|
+
registry,
|
|
126
|
+
views,
|
|
127
|
+
start() {
|
|
128
|
+
starting ??= (async () => {
|
|
129
|
+
await registry.start();
|
|
130
|
+
await runner?.start();
|
|
131
|
+
})();
|
|
132
|
+
return starting;
|
|
133
|
+
},
|
|
134
|
+
async close() {
|
|
135
|
+
await runEvery([
|
|
136
|
+
() => runner?.close(),
|
|
137
|
+
() => registry.close(),
|
|
138
|
+
]);
|
|
139
|
+
},
|
|
140
|
+
tools: () => buildConnectionTools(registry),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `createInMemoryConnection()` (spec 35 § The provider contract): the whole
|
|
3
|
+
* provider contract as scripted functions, events and tasks, for tests. Given
|
|
4
|
+
* `provision`, it also backs pools.
|
|
5
|
+
*
|
|
6
|
+
* It behaves as a conforming server would: `guarded` operations refuse with
|
|
7
|
+
* `guarded` until the harness confirms them, `once` operations return their
|
|
8
|
+
* original outcome for a repeated idempotency key and refuse the same key with
|
|
9
|
+
* different arguments as `conflict`, and durable events replay from a cursor.
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOptions, Connection, ConnectionErrorCode, ConnectionErrorPayload, ConnectionEventInfo, ConnectionEventInit, ConnectionIdentity, ConnectionInputRequest, ConnectionManifest, ConnectionOperationInfo, ConnectionProvider, ConnectionResourceInfo, ConnectionTaskState, ConnectionTaskStatus, Determinism, EventStream, EventStreamMessage, JsonSchemaObject, ListenRequest, SenseDescriptor } from '@noetic-tools/types';
|
|
12
|
+
/** What a scripted operation receives besides its arguments. */
|
|
13
|
+
export interface InMemoryCallContext {
|
|
14
|
+
readonly idempotencyKey: string;
|
|
15
|
+
readonly confirmed: boolean;
|
|
16
|
+
readonly signal: AbortSignal;
|
|
17
|
+
readonly connection: InMemoryConnection;
|
|
18
|
+
}
|
|
19
|
+
/** One step a scripted long operation reports before it finishes. */
|
|
20
|
+
export interface InMemoryTaskStep {
|
|
21
|
+
readonly state: Exclude<ConnectionTaskState, 'completed' | 'failed' | 'cancelled'>;
|
|
22
|
+
readonly message?: string;
|
|
23
|
+
readonly progress?: ConnectionTaskStatus['progress'];
|
|
24
|
+
/** For `input_required`: the question; the task waits for `respond`. */
|
|
25
|
+
readonly request?: ConnectionInputRequest;
|
|
26
|
+
}
|
|
27
|
+
/** A scripted operation. */
|
|
28
|
+
export interface InMemoryOperation extends Omit<ConnectionOperationInfo, 'name' | 'inputSchema'> {
|
|
29
|
+
/** Default `{ type: 'object' }`. */
|
|
30
|
+
readonly inputSchema?: JsonSchemaObject;
|
|
31
|
+
/**
|
|
32
|
+
* Produces the output. Throw `inMemoryRefusal(code, message)` to refuse. For a
|
|
33
|
+
* long operation, `answers` holds the replies to its questions by request id.
|
|
34
|
+
*/
|
|
35
|
+
readonly run?: (args: unknown, context: InMemoryCallContext & {
|
|
36
|
+
readonly answers: ReadonlyMap<string, unknown>;
|
|
37
|
+
}) => unknown;
|
|
38
|
+
/** Makes it a long operation: these steps are reported, then `run` produces the outcome. */
|
|
39
|
+
readonly task?: ReadonlyArray<InMemoryTaskStep>;
|
|
40
|
+
}
|
|
41
|
+
/** A scripted readable resource. */
|
|
42
|
+
export interface InMemoryResource extends Omit<ConnectionResourceInfo, 'name'> {
|
|
43
|
+
readonly read: () => unknown;
|
|
44
|
+
}
|
|
45
|
+
/** A scripted event type. `replay` defaults to `'durable'`. */
|
|
46
|
+
export interface InMemoryEventType extends Omit<ConnectionEventInfo, 'name' | 'replay'> {
|
|
47
|
+
readonly replay?: ConnectionEventInfo['replay'];
|
|
48
|
+
/** Server-side filter: whether an event matches a listener's `arguments`. */
|
|
49
|
+
readonly matches?: (args: Readonly<Record<string, unknown>>, payload: unknown) => boolean;
|
|
50
|
+
}
|
|
51
|
+
/** `createInMemoryConnection()` options. */
|
|
52
|
+
export interface InMemoryConnectionOptions {
|
|
53
|
+
readonly id?: string;
|
|
54
|
+
readonly surface?: string;
|
|
55
|
+
/**
|
|
56
|
+
* The identity instance (default: a fresh UUID per connection). A fixed one
|
|
57
|
+
* stands for the same thing surviving a reconnect, as a server reporting the
|
|
58
|
+
* same `noetic://identity` would.
|
|
59
|
+
*/
|
|
60
|
+
readonly instance?: string;
|
|
61
|
+
readonly epoch?: number;
|
|
62
|
+
readonly profiles?: Readonly<Record<string, string>>;
|
|
63
|
+
readonly extensions?: Readonly<Record<string, string>>;
|
|
64
|
+
readonly senses?: Readonly<Record<string, SenseDescriptor>>;
|
|
65
|
+
readonly determinism?: Determinism;
|
|
66
|
+
readonly setup?: JsonSchemaObject;
|
|
67
|
+
readonly operations?: Readonly<Record<string, InMemoryOperation>>;
|
|
68
|
+
readonly resources?: Readonly<Record<string, InMemoryResource>>;
|
|
69
|
+
readonly events?: Readonly<Record<string, InMemoryEventType>>;
|
|
70
|
+
/** Supports `reset()`. */
|
|
71
|
+
readonly reset?: () => void;
|
|
72
|
+
/**
|
|
73
|
+
* Makes the provider back a pool: called with each `setup`, returns the
|
|
74
|
+
* options of the fresh connection (default: these options).
|
|
75
|
+
*/
|
|
76
|
+
readonly provision?: (setup: Record<string, unknown>) => InMemoryConnectionOptions | undefined;
|
|
77
|
+
/** Makes `connect()` fail with this message. */
|
|
78
|
+
readonly failConnect?: string;
|
|
79
|
+
}
|
|
80
|
+
/** One call a scripted connection received. */
|
|
81
|
+
export interface InMemoryCallRecord {
|
|
82
|
+
readonly op: string;
|
|
83
|
+
readonly args: unknown;
|
|
84
|
+
readonly options: CallOptions;
|
|
85
|
+
}
|
|
86
|
+
/** A scripted connection, with controls for driving it from a test. */
|
|
87
|
+
export interface InMemoryConnection extends Connection {
|
|
88
|
+
readonly calls: ReadonlyArray<InMemoryCallRecord>;
|
|
89
|
+
readonly released: boolean;
|
|
90
|
+
/** The setup it was provisioned with (pools). */
|
|
91
|
+
readonly setupGiven?: Readonly<Record<string, unknown>>;
|
|
92
|
+
/** Delivers an event to every matching listener; returns it as delivered. */
|
|
93
|
+
emit(type: string, payload: unknown, options?: {
|
|
94
|
+
readonly id?: string;
|
|
95
|
+
readonly actionId?: string;
|
|
96
|
+
}): ConnectionEventInit;
|
|
97
|
+
/** Sends a gap to every listener of `type` (or all). */
|
|
98
|
+
gap(reason: string, type?: string): void;
|
|
99
|
+
/** Ends every listener's stream. */
|
|
100
|
+
terminate(reason: string): void;
|
|
101
|
+
/** Replaces the thing it drives: a new identity instance. */
|
|
102
|
+
replace(): ConnectionIdentity;
|
|
103
|
+
/** Changes the epoch only (a hot reload). */
|
|
104
|
+
bumpEpoch(): ConnectionIdentity;
|
|
105
|
+
/** Replaces its manifest parts and reports a manifest change. */
|
|
106
|
+
updateManifest(patch: Partial<Omit<ConnectionManifest, 'operations'>> & {
|
|
107
|
+
readonly operations?: Readonly<Record<string, InMemoryOperation>>;
|
|
108
|
+
}): void;
|
|
109
|
+
/** Drops it, as a server crash would. */
|
|
110
|
+
drop(reason: string): void;
|
|
111
|
+
}
|
|
112
|
+
/** The provider `createInMemoryConnection()` returns. */
|
|
113
|
+
export interface InMemoryConnectionProvider extends ConnectionProvider {
|
|
114
|
+
/** The connection `connect()` returns (replaced when a reconnect follows a drop). */
|
|
115
|
+
readonly connection: InMemoryConnection;
|
|
116
|
+
/** Every connection `provision()` made. */
|
|
117
|
+
readonly provisioned: ReadonlyArray<InMemoryConnection>;
|
|
118
|
+
/** How many times `connect()` was called. */
|
|
119
|
+
readonly connects: number;
|
|
120
|
+
}
|
|
121
|
+
/** One listener of a scripted or source event stream. */
|
|
122
|
+
export interface Listener {
|
|
123
|
+
readonly event: string;
|
|
124
|
+
readonly args: Readonly<Record<string, unknown>>;
|
|
125
|
+
push(message: EventStreamMessage): void;
|
|
126
|
+
end(): void;
|
|
127
|
+
}
|
|
128
|
+
/** An error a scripted operation throws to refuse, carrying the wire payload. */
|
|
129
|
+
export declare class InMemoryRefusal extends Error {
|
|
130
|
+
readonly payload: ConnectionErrorPayload;
|
|
131
|
+
constructor(payload: ConnectionErrorPayload);
|
|
132
|
+
}
|
|
133
|
+
/** Builds an `InMemoryRefusal` for a scripted operation to throw. */
|
|
134
|
+
export declare function inMemoryRefusal(code: ConnectionErrorCode, message: string, details?: Readonly<Record<string, unknown>>): InMemoryRefusal;
|
|
135
|
+
/** A listener-backed event stream: messages pushed to `listener` are iterated from `stream`. */
|
|
136
|
+
export declare function createListenerStream(listeners: Set<Listener>, request: ListenRequest, ready: {
|
|
137
|
+
cursor: string | null;
|
|
138
|
+
}): {
|
|
139
|
+
readonly stream: EventStream;
|
|
140
|
+
readonly listener: Listener;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* @public
|
|
144
|
+
* A scripted `ConnectionProvider` for tests: operations, reads, events and
|
|
145
|
+
* long operations as plain functions. With `provision`, it backs pools.
|
|
146
|
+
*/
|
|
147
|
+
export declare function createInMemoryConnection(options?: InMemoryConnectionOptions): InMemoryConnectionProvider;
|