@intx/hub-sessions 0.2.2 → 0.4.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/README.md +3 -5
- package/dist/agent-repo.d.ts +23 -7
- package/dist/agent-repo.js +19 -6
- package/dist/agent-state-kind.js +18 -63
- package/dist/asset-service.d.ts +1 -20
- package/dist/asset-service.js +19 -97
- package/dist/committed-source-tree.d.ts +10 -0
- package/dist/committed-source-tree.js +35 -0
- package/dist/credential-push.d.ts +52 -7
- package/dist/credential-push.js +178 -22
- package/dist/event-collector-registry.d.ts +3 -2
- package/dist/event-collector-registry.js +42 -13
- package/dist/event-collector.d.ts +12 -2
- package/dist/event-collector.js +45 -4
- package/dist/hub-session-lookups.d.ts +125 -7
- package/dist/hub-session-lookups.js +541 -86
- package/dist/hub-session-orchestrator.d.ts +2 -3
- package/dist/hub-session-orchestrator.js +22 -56
- package/dist/index.d.ts +19 -9
- package/dist/index.js +16 -7
- package/dist/reconciliation-scheduler.d.ts +14 -0
- package/dist/reconciliation-scheduler.js +55 -0
- package/dist/repo-store/index.d.ts +2 -1
- package/dist/repo-store/index.js +1 -0
- package/dist/repo-store/store.d.ts +1 -1
- package/dist/repo-store/store.js +138 -1
- package/dist/repo-store/subscribe-kind.d.ts +6 -3
- package/dist/repo-store/subscribe-kind.js +42 -77
- package/dist/repo-store/types.d.ts +94 -6
- package/dist/repo-store/user-principal-gate.d.ts +26 -0
- package/dist/repo-store/user-principal-gate.js +78 -0
- package/dist/session-service.d.ts +252 -126
- package/dist/session-service.js +851 -624
- package/dist/sidecar-allocation/capability-policy.d.ts +27 -0
- package/dist/sidecar-allocation/capability-policy.js +124 -0
- package/dist/sidecar-allocation/contracts.d.ts +101 -0
- package/dist/sidecar-allocation/contracts.js +26 -0
- package/dist/sidecar-allocation/index.d.ts +5 -0
- package/dist/sidecar-allocation/index.js +4 -0
- package/dist/sidecar-allocation/operation.d.ts +10 -0
- package/dist/sidecar-allocation/operation.js +54 -0
- package/dist/sidecar-allocation/plugin-registry.d.ts +24 -0
- package/dist/sidecar-allocation/plugin-registry.js +61 -0
- package/dist/sidecar-allocation/reconciler.d.ts +54 -0
- package/dist/sidecar-allocation/reconciler.js +825 -0
- package/dist/skill-kind.js +12 -62
- package/dist/substrate.d.ts +3 -3
- package/dist/substrate.js +1 -1
- package/dist/workflow-allocation-service.d.ts +64 -0
- package/dist/workflow-allocation-service.js +554 -0
- package/dist/workflow-closure-resolution.d.ts +106 -0
- package/dist/workflow-closure-resolution.js +123 -0
- package/dist/workflow-definition-ensure.d.ts +24 -0
- package/dist/workflow-definition-ensure.js +75 -0
- package/dist/workflow-dispatch-service.d.ts +42 -0
- package/dist/workflow-dispatch-service.js +209 -0
- package/dist/workflow-dispatch-settlement.d.ts +29 -0
- package/dist/workflow-dispatch-settlement.js +140 -0
- package/dist/workflow-kind.d.ts +29 -1
- package/dist/workflow-kind.js +143 -139
- package/dist/workflow-probe-gate.d.ts +286 -0
- package/dist/workflow-probe-gate.js +382 -0
- package/dist/workflow-run-kind.d.ts +239 -32
- package/dist/workflow-run-kind.js +874 -188
- package/dist/workflow-run-reader.d.ts +1 -1
- package/dist/workflow-run-reader.js +3 -7
- package/dist/workflow-run-restore.d.ts +16 -0
- package/dist/workflow-run-restore.js +30 -0
- package/dist/workflow-source-closure.d.ts +35 -0
- package/dist/workflow-source-closure.js +342 -0
- package/dist/workflow-source-pins.d.ts +8 -0
- package/dist/workflow-source-pins.js +14 -0
- package/dist/ws/index.d.ts +3 -3
- package/dist/ws/index.js +2 -2
- package/dist/ws/pending-tracker.d.ts +93 -0
- package/dist/ws/pending-tracker.js +132 -0
- package/dist/ws/sidecar-events.d.ts +139 -37
- package/dist/ws/sidecar-events.js +2 -2
- package/dist/ws/sidecar-handler.d.ts +218 -60
- package/dist/ws/sidecar-handler.js +1713 -732
- package/dist/ws/sidecar-handler.test-helpers.d.ts +38 -0
- package/dist/ws/sidecar-handler.test-helpers.js +95 -0
- package/dist/ws/sidecar-token-authenticator.d.ts +3 -1
- package/dist/ws/sidecar-token-authenticator.js +78 -7
- package/package.json +14 -13
- package/dist/available-skills-stanza.d.ts +0 -21
- package/dist/available-skills-stanza.js +0 -32
|
@@ -1,8 +1,34 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { GrantWalkSnapshot } from "@intx/types";
|
|
2
|
+
import { type AgentDeployFrame, type HubFrame, type RepoId, type RunGrantsFrame, type CredentialDelivery, type WorkflowSourceAssetMount, type WorkflowProjectionDefinition } from "@intx/types/sidecar";
|
|
2
3
|
import type { ConnectorThreadState, HarnessConfig, InferenceSource } from "@intx/types/runtime";
|
|
4
|
+
import type { SidecarCredentialIdentity } from "../sidecar-allocation/contracts.js";
|
|
5
|
+
import type { ToolPackageManifest } from "@intx/types/tool-packages";
|
|
6
|
+
import type { WorkflowDefinitionSource } from "@intx/types/workflow-sources";
|
|
3
7
|
import { type SidecarEventEmitter, type SidecarLookups } from "./sidecar-events.js";
|
|
8
|
+
import { type WsHandle } from "./pending-tracker.js";
|
|
9
|
+
/**
|
|
10
|
+
* A deploy-frame send failure, tagged with whether the `agent.deploy` frame
|
|
11
|
+
* reached the wire. `frameSent: false` means the send was refused before
|
|
12
|
+
* `conn.send` (a guard failed, or the send threw synchronously) -- the deploy
|
|
13
|
+
* provably never started, so a caller may safely roll back anything it staged.
|
|
14
|
+
* `frameSent: true` means the frame was sent and the failure came afterward (ack
|
|
15
|
+
* timeout, sidecar disconnect), so the sidecar may hold a live agent.
|
|
16
|
+
*/
|
|
17
|
+
export interface DeployFrameFailure extends Error {
|
|
18
|
+
readonly frameSent: boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare function isDeployFrameFailure(err: unknown): err is DeployFrameFailure;
|
|
21
|
+
/**
|
|
22
|
+
* Identity validation failed or remained pending at the connection deadline.
|
|
23
|
+
* Readiness is unknown: the worker may be healthy behind the lookup, so
|
|
24
|
+
* callers must retry rather than treat this as a missed connection deadline.
|
|
25
|
+
*/
|
|
26
|
+
export declare class SidecarIdentityValidationError extends Error {
|
|
27
|
+
constructor(allocationId: string, generation: number, cause?: unknown);
|
|
28
|
+
}
|
|
4
29
|
export type SidecarConnection = {
|
|
5
30
|
sidecarId: string;
|
|
31
|
+
identity: SidecarAuthIdentity;
|
|
6
32
|
agentAddresses: Set<string>;
|
|
7
33
|
workflowAddresses: Set<string>;
|
|
8
34
|
send(frame: HubFrame): void;
|
|
@@ -20,15 +46,105 @@ export type SendPackOptions = {
|
|
|
20
46
|
* Override the `repoId` emitted on the wire. The agent-state flow
|
|
21
47
|
* defaults to `{ kind: "agent-state", id: agentAddress }`; asset
|
|
22
48
|
* packs must pass the SOURCE asset's id so audit can correlate the
|
|
23
|
-
* pack back to its hub-side origin.
|
|
49
|
+
* pack back to its hub-side origin. Workflow-run restoration uses a
|
|
50
|
+
* dedicated allocation-bound sender that supplies its derived repo id.
|
|
24
51
|
*/
|
|
25
52
|
repoId?: RepoId;
|
|
26
53
|
};
|
|
54
|
+
/**
|
|
55
|
+
* Everything a `sendProbe` caller supplies to populate the outbound
|
|
56
|
+
* `workflow.probe.request` frame: where the definition's bytes come from, the
|
|
57
|
+
* frozen dependency closure the hub already resolved, and the
|
|
58
|
+
* `interchange.workflow` entry-module path whose evaluation produces the
|
|
59
|
+
* `WorkflowDefinition`. The `requestId` is minted inside `sendProbe`, not
|
|
60
|
+
* supplied here.
|
|
61
|
+
*/
|
|
62
|
+
export type SendProbeArgs = {
|
|
63
|
+
source: WorkflowDefinitionSource;
|
|
64
|
+
closure: ToolPackageManifest;
|
|
65
|
+
entry: string;
|
|
66
|
+
/** Hub assets a `kind:"asset"` closure entry reads from, delivered inline. */
|
|
67
|
+
assets?: WorkflowSourceAssetMount[];
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The payload a `sendProbe` promise resolves with, lifted off the sidecar's
|
|
71
|
+
* `workflow.probe.result` frame: the inert needs-surface projection of the
|
|
72
|
+
* probed workflow, the inert grant set derived from it, the un-flattened grant
|
|
73
|
+
* walk snapshot the set is derived from, and the projection's content hash.
|
|
74
|
+
*/
|
|
75
|
+
export type WorkflowProbeResult = {
|
|
76
|
+
projection: WorkflowProjectionDefinition;
|
|
77
|
+
grants: string[];
|
|
78
|
+
grantWalkSnapshot: GrantWalkSnapshot;
|
|
79
|
+
wireHash: string;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* The result of a run-address sender's deploy, reported to the router once the
|
|
83
|
+
* deploy's key write is durable. `recorded` carries the sender's now-persisted
|
|
84
|
+
* public key and wakes the sender's parked pre-ack mail for redelivery;
|
|
85
|
+
* `failed` carries a failure reason and drains that mail to
|
|
86
|
+
* `mail.outbound.undelivered`. Modeled as a discriminated result so a settle is
|
|
87
|
+
* unambiguous about which side of the deploy it reports.
|
|
88
|
+
*/
|
|
89
|
+
export type SenderDeploySettledOutcome = {
|
|
90
|
+
recorded: string;
|
|
91
|
+
} | {
|
|
92
|
+
failed: string;
|
|
93
|
+
};
|
|
94
|
+
export type AllocatedSenderDeployAttempt = AllocatedSidecarTarget & {
|
|
95
|
+
readonly leaseId: string;
|
|
96
|
+
};
|
|
27
97
|
export type SidecarRouter = {
|
|
28
98
|
handleOpen(ws: WsHandle): void;
|
|
29
99
|
handleMessage(ws: WsHandle, data: string): void;
|
|
30
100
|
handleClose(ws: WsHandle): void;
|
|
31
|
-
routeMail(agentAddress: string, rawMessage: string
|
|
101
|
+
routeMail(agentAddress: string, rawMessage: string, authenticatedSender: string, messageId?: string, runGrants?: {
|
|
102
|
+
runId: string;
|
|
103
|
+
stepGrants: RunGrantsFrame["stepGrants"];
|
|
104
|
+
senderIdentities?: RunGrantsFrame["senderIdentities"];
|
|
105
|
+
}): boolean;
|
|
106
|
+
/**
|
|
107
|
+
* Deliver a run's authorization grants to the sidecar hosting the named
|
|
108
|
+
* deployment-level mail address, ahead of the trigger mail that starts the
|
|
109
|
+
* run. Routes through the same per-address channel as `routeMail`: over the
|
|
110
|
+
* live connection when the deployment is connected, and into the disconnect
|
|
111
|
+
* queue when the deployment dropped in the window before its first
|
|
112
|
+
* reconnect (while its address is still on `agentAddresses`) -- so grants
|
|
113
|
+
* are queued for a disconnected deployment exactly when the trigger mail is,
|
|
114
|
+
* and ride the same reconnect flush. After an authenticated reconnect the
|
|
115
|
+
* address moves to `workflowAddresses`, which carries no queue (that
|
|
116
|
+
* generation's in-flight state is reconstructed sidecar-locally); a
|
|
117
|
+
* `run.grants` then has no queue to ride and this returns `false`. Returns
|
|
118
|
+
* `false` whenever the address is unroutable; the caller keeps any stable-run
|
|
119
|
+
* grant reservation so a later first-delivery attempt reuses it.
|
|
120
|
+
*
|
|
121
|
+
* `senderIdentities` co-delivers the run's authorized senders' resolved keys
|
|
122
|
+
* on the same barrier as the grant, so a recipient that caches from this
|
|
123
|
+
* frame binds each sender address to the hub-vouched key. The caller passes
|
|
124
|
+
* `undefined` when there is no sender to co-deliver (a standing-grant refresh)
|
|
125
|
+
* or the sender has no resolvable key; a null key is never carried.
|
|
126
|
+
*/
|
|
127
|
+
sendRunGrants(agentAddress: string, runId: string, stepGrants: RunGrantsFrame["stepGrants"], senderIdentities: RunGrantsFrame["senderIdentities"]): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Report that a run-address sender's deploy has settled, driving any mail the
|
|
130
|
+
* sender parked while its public key was not yet recorded. A `recorded`
|
|
131
|
+
* outcome wakes the parked mail and re-drives its delivery now that the key
|
|
132
|
+
* co-delivers; a `failed` outcome drains it to `mail.outbound.undelivered`.
|
|
133
|
+
* Allocated callbacks name their exact attempt; recovery may settle the
|
|
134
|
+
* previous attempt by generation after claiming its reconciliation lease.
|
|
135
|
+
* An address-only settlement belongs to a non-allocated deployment and cannot
|
|
136
|
+
* settle an allocated attempt. Stale or repeated settlements are no-ops.
|
|
137
|
+
*/
|
|
138
|
+
noteSenderDeploySettled(sender: string | AllocatedSidecarTarget | AllocatedSenderDeployAttempt, outcome: SenderDeploySettledOutcome): void;
|
|
139
|
+
/**
|
|
140
|
+
* Mark a run-address sender's ALLOCATED deploy as mid-flight, before the deploy
|
|
141
|
+
* emit and its anchor-key update. An allocated run records its key later than
|
|
142
|
+
* the deploy ack clears `pendingDeploys`, so this marker covers the allocated
|
|
143
|
+
* pre-ack window that `pendingDeploys` alone under-covers. `noteSenderDeploySettled`
|
|
144
|
+
* clears it only when the durable outcome is known. Cancellation leaves it
|
|
145
|
+
* pending for recovery, so a lost publication response cannot discard mail.
|
|
146
|
+
*/
|
|
147
|
+
noteSenderDeployStarted(address: string, attempt: AllocatedSenderDeployAttempt): void;
|
|
32
148
|
/**
|
|
33
149
|
* Returns the current connector-thread state for the named agent, or
|
|
34
150
|
* `null` if the agent has no active connector thread (or if the
|
|
@@ -39,47 +155,9 @@ export type SidecarRouter = {
|
|
|
39
155
|
* default the calling path uses.
|
|
40
156
|
*/
|
|
41
157
|
getConnectorState(agentAddress: string): ConnectorThreadState | null;
|
|
42
|
-
/**
|
|
43
|
-
* Send an `agent.deploy` frame to the sidecar. When `workflow` is
|
|
44
|
-
* supplied, the frame carries the multi-step deploy projection
|
|
45
|
-
* (workflow definition plus per-step source pins); the sidecar's
|
|
46
|
-
* deploy router routes it to the workflow deploy path. The sole
|
|
47
|
-
* caller supplies `workflow` on every deploy; per-step provisioning
|
|
48
|
-
* uses `sendProvisionStep`.
|
|
49
|
-
*
|
|
50
|
-
* The returned promise resolves with the supervisor's principal
|
|
51
|
-
* public key (hex-encoded Ed25519) carried on `agent.deploy.ack`.
|
|
52
|
-
* The legacy callers that ignore the return value continue to work
|
|
53
|
-
* unchanged.
|
|
54
|
-
*/
|
|
55
|
-
sendAgentDeploy(agentAddress: string, config: HarnessConfig, workflow?: AgentDeployFrame["workflow"]): Promise<{
|
|
56
|
-
publicKey: string;
|
|
57
|
-
}>;
|
|
58
158
|
sendAgentUndeploy(agentAddress: string, reason: string): Promise<void>;
|
|
59
159
|
sendSourcesUpdate(agentAddress: string, sources: InferenceSource[], defaultSource: string): Promise<void>;
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Bind a per-step workflow-substrate address to a sidecar for the staging
|
|
63
|
-
* window of a multi-step deploy, so `sendPack` can route the step's deploy
|
|
64
|
-
* and asset packs before the deployment-level frame spawns the child. The
|
|
65
|
-
* address enters the keyless `workflowAddresses` routing set; call
|
|
66
|
-
* `unbindStepRoute` once the step's packs land. Throws if no sidecar is
|
|
67
|
-
* available.
|
|
68
|
-
*/
|
|
69
|
-
bindStepRoute(stepAddress: string): void;
|
|
70
|
-
/**
|
|
71
|
-
* Remove a per-step route bound by `bindStepRoute`. Idempotent: an unbound
|
|
72
|
-
* address is a no-op.
|
|
73
|
-
*/
|
|
74
|
-
unbindStepRoute(stepAddress: string): void;
|
|
75
|
-
/**
|
|
76
|
-
* Provision one step of a multi-step deploy on the sidecar WITHOUT
|
|
77
|
-
* spawning: the sidecar initializes the step's agent-state repo and
|
|
78
|
-
* records the hub key so the follow-up deploy pack applies and verifies.
|
|
79
|
-
* The step address must already be bound via `bindStepRoute`. Resolves
|
|
80
|
-
* once the sidecar acks, so the caller can then deliver the deploy pack.
|
|
81
|
-
*/
|
|
82
|
-
sendProvisionStep(agentAddress: string, config: HarnessConfig): Promise<void>;
|
|
160
|
+
sendCredentialsUpdate(agentAddress: string, delivery: CredentialDelivery, revoke?: string[]): Promise<void>;
|
|
83
161
|
sendSyncRequest(agentAddress: string): void;
|
|
84
162
|
/**
|
|
85
163
|
* Deliver a workflow-run signal to the sidecar that hosts the named
|
|
@@ -137,9 +215,66 @@ export type SidecarRouter = {
|
|
|
137
215
|
* principal (e.g. an operator user) can be added as an additional arm
|
|
138
216
|
* without changing existing consumers.
|
|
139
217
|
*/
|
|
140
|
-
export type SidecarAuthIdentity =
|
|
141
|
-
|
|
142
|
-
|
|
218
|
+
export type SidecarAuthIdentity = SidecarCredentialIdentity;
|
|
219
|
+
export type AllocatedSidecarTarget = {
|
|
220
|
+
readonly allocationId: string;
|
|
221
|
+
readonly generation: number;
|
|
222
|
+
};
|
|
223
|
+
export type SidecarAllocationRouter = {
|
|
224
|
+
/** Advance the in-memory trust boundary before provisioning a generation. */
|
|
225
|
+
fenceAllocation(allocationId: string, generation: number): void;
|
|
226
|
+
/**
|
|
227
|
+
* Remove an exact generation's fence after its durable owner becomes
|
|
228
|
+
* terminal. Durable identity validation rejects later stale reconnects.
|
|
229
|
+
*/
|
|
230
|
+
retireAllocation(target: AllocatedSidecarTarget): void;
|
|
231
|
+
/**
|
|
232
|
+
* Resolve once the exact authenticated allocation generation is connected.
|
|
233
|
+
* Throws `SidecarIdentityValidationError` when readiness cannot be
|
|
234
|
+
* determined; only confirmed absence surfaces as a connection timeout.
|
|
235
|
+
* `onValidation` observes notification lookups that may outlive this wait.
|
|
236
|
+
*/
|
|
237
|
+
waitForAllocatedSidecar(target: AllocatedSidecarTarget, timeoutMs: number, onValidation?: (validation: Promise<boolean>) => void): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Check exact allocated readiness without parking a reconciliation worker.
|
|
240
|
+
* Throws `SidecarIdentityValidationError` when identity validation fails;
|
|
241
|
+
* `false` means the worker is confirmed absent or stale.
|
|
242
|
+
*/
|
|
243
|
+
isAllocatedSidecarReady(target: AllocatedSidecarTarget): Promise<boolean>;
|
|
244
|
+
/** Check for an active supervisor, throwing when identity validation fails. */
|
|
245
|
+
isAllocatedWorkflowActive(target: AllocatedSidecarTarget): Promise<boolean>;
|
|
246
|
+
/** Probe a workflow on the exact provisioned allocation generation. */
|
|
247
|
+
sendProbeToAllocation(target: AllocatedSidecarTarget, args: SendProbeArgs): Promise<WorkflowProbeResult>;
|
|
248
|
+
/** Close an exact provisioned connection before changing its durable owner. */
|
|
249
|
+
disconnectAllocation(target: AllocatedSidecarTarget): void;
|
|
250
|
+
sendAgentDeployToAllocation(target: AllocatedSidecarTarget, agentAddress: string, config: HarnessConfig, workflow?: AgentDeployFrame["workflow"], signal?: AbortSignal, beforeSend?: () => Promise<void>): Promise<{
|
|
251
|
+
publicKey: string;
|
|
252
|
+
}>;
|
|
253
|
+
sendPackToAllocation(target: AllocatedSidecarTarget, agentAddress: string, pack: Uint8Array, ref: string, commitSha: string, options?: SendPackOptions): Promise<void>;
|
|
254
|
+
/**
|
|
255
|
+
* Restore one Hub-authoritative workflow-run ref onto the exact allocation
|
|
256
|
+
* generation before its deployment address is routed or supervisor spawned.
|
|
257
|
+
*/
|
|
258
|
+
sendWorkflowRunPackToAllocation(target: AllocatedSidecarTarget, agentAddress: string, pack: Uint8Array, ref: string, commitSha: string, signal?: AbortSignal): Promise<void>;
|
|
259
|
+
bindAllocatedStepRoute(target: AllocatedSidecarTarget, stepAddress: string): Promise<void>;
|
|
260
|
+
unbindAllocatedStepRoute(target: AllocatedSidecarTarget, stepAddress: string): void;
|
|
261
|
+
sendProvisionStepToAllocation(target: AllocatedSidecarTarget, agentAddress: string, config: HarnessConfig): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* Deliver one durable workflow trigger to the exact allocation generation.
|
|
264
|
+
* Grants and mail are written to the same websocket in FIFO order. The
|
|
265
|
+
* returned promise proves only that both frames were sent; the sidecar's
|
|
266
|
+
* durable-inbox acknowledgement is surfaced separately through
|
|
267
|
+
* `mail.inbound.acknowledged`.
|
|
268
|
+
*/
|
|
269
|
+
sendWorkflowRunDispatchToAllocation(target: AllocatedSidecarTarget, agentAddress: string, runId: string, stepGrants: RunGrantsFrame["stepGrants"], rawMessage: string, authenticatedSender: string, messageId: string, signal?: AbortSignal): Promise<void>;
|
|
270
|
+
/** Deliver an idempotent signal to the exact provisioned generation. */
|
|
271
|
+
sendSignalDeliverToAllocation(target: AllocatedSidecarTarget, opts: {
|
|
272
|
+
agentAddress: string;
|
|
273
|
+
runId: string;
|
|
274
|
+
signalName: string;
|
|
275
|
+
signalId: string;
|
|
276
|
+
payload: unknown;
|
|
277
|
+
}, signal?: AbortSignal): Promise<void>;
|
|
143
278
|
};
|
|
144
279
|
/**
|
|
145
280
|
* Resolves the credentials a sidecar presents on the handshake to a
|
|
@@ -161,24 +296,47 @@ export type SidecarRouterConfig = {
|
|
|
161
296
|
* identity. Required: without it a connection could route on an
|
|
162
297
|
* unverified frame claim. Return null to reject the handshake. */
|
|
163
298
|
authenticateSidecar: SidecarAuthenticator;
|
|
164
|
-
|
|
299
|
+
/** Revalidate durable identity at registration and routing boundaries. */
|
|
300
|
+
validateSidecarIdentity: (identity: SidecarAuthIdentity, use: "registration" | "readiness" | "routing") => Promise<boolean>;
|
|
301
|
+
/** Timeout for a `sendProbe` round-trip. A probe materializes a workflow's
|
|
302
|
+
* dependency closure and evaluates it on the sidecar, so it can run longer
|
|
303
|
+
* than a routine `sendRequest`; it gets its own timeout rather than sharing
|
|
304
|
+
* the request timeout. */
|
|
305
|
+
probeTimeoutMs?: number;
|
|
165
306
|
disconnectQueueMaxSize?: number;
|
|
166
307
|
disconnectQueueTTLMs?: number;
|
|
167
308
|
pingTimeoutMs?: number;
|
|
168
|
-
/**
|
|
169
|
-
*
|
|
170
|
-
|
|
309
|
+
/** Interval between redelivery attempts of a connected-window `mail.inbound`
|
|
310
|
+
* the sidecar has not yet acknowledged with `mail.inbound.ack`. */
|
|
311
|
+
mailAckRetryIntervalMs?: number;
|
|
312
|
+
/**
|
|
313
|
+
* Arms the mail-redelivery retry and the connection-liveness timers, and
|
|
314
|
+
* returns each one's canceller. Defaults to the global timer, which is what
|
|
315
|
+
* production wants.
|
|
171
316
|
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
317
|
+
* The intervals beside it say how long until something should happen; this
|
|
318
|
+
* says what makes it happen. With only the intervals injectable, a test had
|
|
319
|
+
* to shorten one and then sleep past it, which turns an assertion about
|
|
320
|
+
* WHETHER something happened into a bet on how much the machine got through
|
|
321
|
+
* -- and, for the liveness deadline, on a pause landing inside a window
|
|
322
|
+
* rather than past it.
|
|
323
|
+
*
|
|
324
|
+
* REQUIRED of the returned canceller: calling it more than once must be
|
|
325
|
+
* harmless. A pending-mail entry outlives a disconnect, so the disconnect
|
|
326
|
+
* path cancels its retry and a later reconnect can cancel the same one
|
|
327
|
+
* again. `clearTimeout` on an already-cleared timer is a no-op, which is
|
|
328
|
+
* what makes the default satisfy this; a substitute must arrange the same,
|
|
329
|
+
* typically by flipping a flag.
|
|
330
|
+
*/
|
|
331
|
+
scheduleTimeout?: (handler: () => void, ms: number) => () => void;
|
|
332
|
+
/** Maximum redelivery attempts before the hub stops retrying an un-acked
|
|
333
|
+
* connected-window `mail.inbound`. Bounds the retry so a sidecar that never
|
|
334
|
+
* acks does not accumulate an unbounded timer per delivery. */
|
|
335
|
+
mailAckMaxRetries?: number;
|
|
336
|
+
/** Query handlers the wire layer issues during frame processing. */
|
|
178
337
|
lookups?: SidecarLookups;
|
|
179
338
|
};
|
|
180
|
-
export type WsHandle
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
export declare function createSidecarRouter(config: SidecarRouterConfig): SidecarRouter;
|
|
339
|
+
export type { WsHandle };
|
|
340
|
+
export declare const DEFAULT_PROBE_TIMEOUT_MS = 60000;
|
|
341
|
+
export declare const MAX_RESYNC_SENDER_ADDRESSES = 2048;
|
|
342
|
+
export declare function createSidecarRouter(config: SidecarRouterConfig): SidecarRouter & SidecarAllocationRouter;
|