@vscode/component-explorer-cli 0.2.1-18 → 0.2.1-180
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 +130 -12
- package/dist/WorktreePool.d.ts +5 -4
- package/dist/WorktreePool.d.ts.map +1 -1
- package/dist/WorktreePool.js +3 -3
- package/dist/WorktreePool.js.map +1 -1
- package/dist/_virtual/_build-info.js +1 -1
- package/dist/browserPage.d.ts +55 -1
- package/dist/browserPage.d.ts.map +1 -1
- package/dist/browserPage.js +103 -7
- package/dist/browserPage.js.map +1 -1
- package/dist/browserPage.test.d.ts +2 -0
- package/dist/browserPage.test.d.ts.map +1 -0
- package/dist/commands/acceptCommand.d.ts +1 -1
- package/dist/commands/acceptCommand.d.ts.map +1 -1
- package/dist/commands/acceptCommand.js +21 -14
- package/dist/commands/acceptCommand.js.map +1 -1
- package/dist/commands/checkStabilityCommand.d.ts +2 -0
- package/dist/commands/checkStabilityCommand.d.ts.map +1 -1
- package/dist/commands/checkStabilityCommand.js +25 -8
- package/dist/commands/checkStabilityCommand.js.map +1 -1
- package/dist/commands/compareCommand.d.ts +1 -1
- package/dist/commands/compareCommand.d.ts.map +1 -1
- package/dist/commands/compareCommand.js +31 -22
- package/dist/commands/compareCommand.js.map +1 -1
- package/dist/commands/inputArg.d.ts +33 -0
- package/dist/commands/inputArg.d.ts.map +1 -0
- package/dist/commands/inputArg.js +103 -0
- package/dist/commands/inputArg.js.map +1 -0
- package/dist/commands/mcpCommand.d.ts.map +1 -1
- package/dist/commands/mcpCommand.js +18 -12
- package/dist/commands/mcpCommand.js.map +1 -1
- package/dist/commands/renderCommand.d.ts +10 -1
- package/dist/commands/renderCommand.d.ts.map +1 -1
- package/dist/commands/renderCommand.js +390 -61
- package/dist/commands/renderCommand.js.map +1 -1
- package/dist/commands/renderCommand.test.d.ts +2 -0
- package/dist/commands/renderCommand.test.d.ts.map +1 -0
- package/dist/commands/serveCommand.d.ts +4 -1
- package/dist/commands/serveCommand.d.ts.map +1 -1
- package/dist/commands/serveCommand.js +105 -36
- package/dist/commands/serveCommand.js.map +1 -1
- package/dist/commands/serviceDiffCommitsCommand.d.ts.map +1 -1
- package/dist/commands/serviceDiffCommitsCommand.js +10 -9
- package/dist/commands/serviceDiffCommitsCommand.js.map +1 -1
- package/dist/commands/watchCommand.d.ts +1 -0
- package/dist/commands/watchCommand.d.ts.map +1 -1
- package/dist/commands/watchCommand.js +31 -20
- package/dist/commands/watchCommand.js.map +1 -1
- package/dist/comparison.d.ts +4 -3
- package/dist/comparison.d.ts.map +1 -1
- package/dist/comparison.js +17 -14
- package/dist/comparison.js.map +1 -1
- package/dist/component-explorer-config.schema.json +55 -2
- package/dist/componentExplorer.d.ts +110 -12
- package/dist/componentExplorer.d.ts.map +1 -1
- package/dist/componentExplorer.js +177 -24
- package/dist/componentExplorer.js.map +1 -1
- package/dist/config.d.ts +33 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +64 -27
- package/dist/config.js.map +1 -1
- package/dist/coverage.d.ts +64 -0
- package/dist/coverage.d.ts.map +1 -0
- package/dist/coverage.js +212 -0
- package/dist/coverage.js.map +1 -0
- package/dist/daemon/DaemonService.d.ts +5 -199
- package/dist/daemon/DaemonService.d.ts.map +1 -1
- package/dist/daemon/DaemonService.js +248 -300
- package/dist/daemon/DaemonService.js.map +1 -1
- package/dist/daemon/approvalStore.d.ts +2 -1
- package/dist/daemon/approvalStore.d.ts.map +1 -1
- package/dist/daemon/approvalStore.js +4 -3
- package/dist/daemon/approvalStore.js.map +1 -1
- package/dist/daemon/client.d.ts +76 -5
- package/dist/daemon/client.d.ts.map +1 -1
- package/dist/daemon/daemonRpc.test.d.ts +2 -0
- package/dist/daemon/daemonRpc.test.d.ts.map +1 -0
- package/dist/daemon/endpointServer.d.ts +4 -0
- package/dist/daemon/endpointServer.d.ts.map +1 -0
- package/dist/daemon/endpointServer.js +24 -0
- package/dist/daemon/endpointServer.js.map +1 -0
- package/dist/daemon/inProcessClient.d.ts +3 -9
- package/dist/daemon/inProcessClient.d.ts.map +1 -1
- package/dist/daemon/inProcessClient.js +29 -30
- package/dist/daemon/inProcessClient.js.map +1 -1
- package/dist/daemon/lifecycle.d.ts +5 -5
- package/dist/daemon/lifecycle.d.ts.map +1 -1
- package/dist/daemon/lifecycle.js +4 -3
- package/dist/daemon/lifecycle.js.map +1 -1
- package/dist/daemon/pipeClient.d.ts +2 -3
- package/dist/daemon/pipeClient.d.ts.map +1 -1
- package/dist/daemon/pipeClient.js +93 -194
- package/dist/daemon/pipeClient.js.map +1 -1
- package/dist/daemon/pipeName.d.ts +3 -3
- package/dist/daemon/pipeName.d.ts.map +1 -1
- package/dist/daemon/pipeName.js +6 -5
- package/dist/daemon/pipeName.js.map +1 -1
- package/dist/daemon/pipeServer.d.ts +2 -2
- package/dist/daemon/pipeServer.d.ts.map +1 -1
- package/dist/daemon/pipeServer.js +79 -70
- package/dist/daemon/pipeServer.js.map +1 -1
- package/dist/daemon/registerDaemonConnection.d.ts +7 -0
- package/dist/daemon/registerDaemonConnection.d.ts.map +1 -0
- package/dist/daemon/registerDaemonConnection.js +37 -0
- package/dist/daemon/registerDaemonConnection.js.map +1 -0
- package/dist/daemon/transports.test.d.ts +2 -0
- package/dist/daemon/transports.test.d.ts.map +1 -0
- package/dist/daemon/types.d.ts +1655 -8
- package/dist/daemon/types.d.ts.map +1 -1
- package/dist/daemon/types.js +4 -0
- package/dist/daemon/types.js.map +1 -0
- package/dist/daemon/version.d.ts +1 -5
- package/dist/daemon/version.d.ts.map +1 -1
- package/dist/daemon/version.js +3 -7
- package/dist/daemon/version.js.map +1 -1
- package/dist/dependencyInstaller.d.ts +2 -1
- package/dist/dependencyInstaller.d.ts.map +1 -1
- package/dist/dependencyInstaller.js +4 -4
- package/dist/dependencyInstaller.js.map +1 -1
- package/dist/explorerSession.d.ts +5 -1
- package/dist/explorerSession.d.ts.map +1 -1
- package/dist/explorerSession.js +24 -7
- package/dist/explorerSession.js.map +1 -1
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/inspectionHost-BA6ZmC_P.js +2523 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/inspectionHost-BA6ZmC_P.js.map +1 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/src-DYVSK_tz.js +1871 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/src-DYVSK_tz.js.map +1 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/webSocketTransport-Ct4OIdG9.js +220 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/chunks/webSocketTransport-Ct4OIdG9.js.map +1 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/node.js +721 -0
- package/dist/external/linkrpc/typescript/packages/linkrpc/dist/node.js.map +1 -0
- package/dist/git/gitCommitResolver.d.ts +2 -1
- package/dist/git/gitCommitResolver.d.ts.map +1 -1
- package/dist/git/gitCommitResolver.js +8 -8
- package/dist/git/gitCommitResolver.js.map +1 -1
- package/dist/git/gitIndexResolver.d.ts +2 -1
- package/dist/git/gitIndexResolver.d.ts.map +1 -1
- package/dist/git/gitIndexResolver.js +7 -7
- package/dist/git/gitIndexResolver.js.map +1 -1
- package/dist/git/gitService.d.ts +5 -4
- package/dist/git/gitService.d.ts.map +1 -1
- package/dist/git/gitService.js.map +1 -1
- package/dist/git/gitUtils.d.ts +6 -5
- package/dist/git/gitUtils.d.ts.map +1 -1
- package/dist/git/gitUtils.js +5 -4
- package/dist/git/gitUtils.js.map +1 -1
- package/dist/git/gitWorktreeManager.d.ts +15 -14
- package/dist/git/gitWorktreeManager.d.ts.map +1 -1
- package/dist/git/gitWorktreeManager.js +10 -11
- package/dist/git/gitWorktreeManager.js.map +1 -1
- package/dist/git/testUtils.d.ts +2 -1
- package/dist/git/testUtils.d.ts.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/js-component-explorer/packages/common/dist/daemonRpc.js +165 -0
- package/dist/js-component-explorer/packages/common/dist/daemonRpc.js.map +1 -0
- package/dist/js-component-explorer/packages/common/dist/explorerUrl.js +21 -0
- package/dist/js-component-explorer/packages/common/dist/explorerUrl.js.map +1 -0
- package/dist/js-component-explorer/packages/common/dist/renderManifest.js +68 -0
- package/dist/js-component-explorer/packages/common/dist/renderManifest.js.map +1 -0
- package/dist/js-component-explorer/packages/semver/dist/index.js.map +1 -0
- package/dist/manifest.schema.json +44 -16
- package/dist/mcp/DaemonAccessor.d.ts +2 -3
- package/dist/mcp/DaemonAccessor.d.ts.map +1 -1
- package/dist/mcp/McpServer.d.ts +1 -1
- package/dist/mcp/McpServer.d.ts.map +1 -1
- package/dist/mcp/McpServer.js +252 -159
- package/dist/mcp/McpServer.js.map +1 -1
- package/dist/path.d.ts +30 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +78 -0
- package/dist/path.js.map +1 -0
- package/dist/processTree.d.ts +6 -1
- package/dist/processTree.d.ts.map +1 -1
- package/dist/processTree.js +48 -5
- package/dist/processTree.js.map +1 -1
- package/dist/renderManifest.d.ts +70 -5
- package/dist/renderManifest.js +1 -1
- package/dist/server/httpServer.d.ts +1 -1
- package/dist/server/httpServer.d.ts.map +1 -1
- package/dist/server/httpServer.js +4 -8
- package/dist/server/httpServer.js.map +1 -1
- package/dist/server/serverConfig.d.ts +23 -8
- package/dist/server/serverConfig.d.ts.map +1 -1
- package/dist/server/serverConfig.js +11 -18
- package/dist/server/serverConfig.js.map +1 -1
- package/dist/server/viteServer.d.ts +16 -3
- package/dist/server/viteServer.d.ts.map +1 -1
- package/dist/server/viteServer.js +86 -5
- package/dist/server/viteServer.js.map +1 -1
- package/dist/storage.d.ts +2 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/utils.d.ts +3 -30
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +4 -24
- package/dist/utils.js.map +1 -1
- package/dist/visualCache.d.ts +2 -1
- package/dist/visualCache.d.ts.map +1 -1
- package/dist/visualCache.js +4 -3
- package/dist/visualCache.js.map +1 -1
- package/dist/viteProjectRef.d.ts +4 -12
- package/dist/viteProjectRef.d.ts.map +1 -1
- package/dist/viteProjectRef.js +9 -17
- package/dist/viteProjectRef.js.map +1 -1
- package/dist/vscode-observables/observables/dist/disposables.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/base.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/debugName.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/index.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +1 -0
- package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/logging/debugGetDependencyGraph.js +1 -1
- package/dist/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/logging/logging.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +1 -0
- package/dist/{external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js → vscode-observables/observables/dist/observableInternal/reactions/createEffect.js} +9 -5
- package/dist/vscode-observables/observables/dist/observableInternal/reactions/createEffect.js.map +1 -0
- package/dist/{external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js → vscode-observables/observables/dist/observableInternal/reactions/createEffectImpl.js} +1 -1
- package/dist/vscode-observables/observables/dist/observableInternal/reactions/createEffectImpl.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/transaction.js.map +1 -0
- package/dist/vscode-observables/observables/dist/observableInternal/utils/utils.js.map +1 -0
- package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/utils/utilsCancellation.js +2 -2
- package/dist/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js.map +1 -0
- package/package.json +18 -15
- package/dist/commands/artifactCommand.d.ts +0 -14
- package/dist/commands/artifactCommand.d.ts.map +0 -1
- package/dist/external/vscode-observables/observables/dist/disposables.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/base.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/commonFacade/deps.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugLocation.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/debugName.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/index.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/consoleObservableLogger.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/debugGetDependencyGraph.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/logging/logging.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/baseObservable.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derived.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/derivedImpl.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableFromEvent.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/observables/observableValue.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorun.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/reactions/autorunImpl.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/transaction.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utils.js.map +0 -1
- package/dist/external/vscode-observables/observables/dist/observableInternal/utils/utilsCancellation.js.map +0 -1
- package/dist/formatValue.js +0 -96
- package/dist/formatValue.js.map +0 -1
- package/dist/packages/common/dist/renderManifest.js +0 -46
- package/dist/packages/common/dist/renderManifest.js.map +0 -1
- package/dist/packages/semver/dist/index.js.map +0 -1
- package/dist/packages/simple-api/dist/chunk-FJ7AVNQE.js +0 -138
- package/dist/packages/simple-api/dist/chunk-FJ7AVNQE.js.map +0 -1
- package/dist/packages/simple-api/dist/chunk-TTRCY65Z.js +0 -27
- package/dist/packages/simple-api/dist/chunk-TTRCY65Z.js.map +0 -1
- package/dist/packages/simple-api/dist/chunk-WNXMRXWV.js +0 -28
- package/dist/packages/simple-api/dist/chunk-WNXMRXWV.js.map +0 -1
- package/dist/packages/simple-api/dist/express.js +0 -104
- package/dist/packages/simple-api/dist/express.js.map +0 -1
- /package/dist/{packages → js-component-explorer/packages}/semver/dist/index.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/disposables.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/base.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/commonFacade/deps.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/debugLocation.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/debugName.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/index.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/logging/consoleObservableLogger.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/logging/logging.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/observables/baseObservable.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/observables/derived.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/observables/derivedImpl.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/observables/observableFromEvent.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/observables/observableValue.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/transaction.js +0 -0
- /package/dist/{external/vscode-observables → vscode-observables}/observables/dist/observableInternal/utils/utils.js +0 -0
package/dist/daemon/types.d.ts
CHANGED
|
@@ -1,12 +1,1659 @@
|
|
|
1
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
2
|
+
import { $ZodType, output } from 'zod/v4/core';
|
|
3
|
+
import * as zod_mini from 'zod/mini';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
//#region src/protocol/jsonValue.d.ts
|
|
1
7
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
8
|
+
* The JSON value lattice. Anything the wire can carry.
|
|
9
|
+
*
|
|
10
|
+
* Object values are `JsonValue | undefined` so `undefined`-valued fields
|
|
11
|
+
* may be present in source and are simply omitted at canonicalisation
|
|
12
|
+
* time (rather than serialised as `null`).
|
|
4
13
|
*/
|
|
5
|
-
|
|
14
|
+
type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
15
|
+
[key: string]: JsonValue | undefined;
|
|
16
|
+
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/protocol/jsonRpc.d.ts
|
|
19
|
+
type RequestId = number | string;
|
|
20
|
+
interface JsonRpcRequest<TParams = JsonValue> {
|
|
21
|
+
jsonrpc: "2.0";
|
|
22
|
+
id: RequestId;
|
|
23
|
+
method: string;
|
|
24
|
+
params?: TParams;
|
|
25
|
+
}
|
|
26
|
+
interface JsonRpcNotification<TParams = JsonValue> {
|
|
27
|
+
jsonrpc: "2.0";
|
|
28
|
+
method: string;
|
|
29
|
+
params?: TParams;
|
|
30
|
+
}
|
|
31
|
+
interface JsonRpcSuccess {
|
|
32
|
+
jsonrpc: "2.0";
|
|
33
|
+
id: RequestId | null;
|
|
34
|
+
result: JsonValue;
|
|
35
|
+
}
|
|
36
|
+
interface JsonRpcError {
|
|
37
|
+
jsonrpc: "2.0";
|
|
38
|
+
id: RequestId | null;
|
|
39
|
+
error: {
|
|
40
|
+
code: number;
|
|
41
|
+
message: string;
|
|
42
|
+
data?: JsonValue;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
type JsonRpcResponse = JsonRpcSuccess | JsonRpcError;
|
|
46
|
+
type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/schema/linkRpcJsonSchema.d.ts
|
|
49
|
+
type LinkRpcJsonSchema = true | false | NullSchema | BooleanSchema | NumberSchema | IntegerSchema | StringSchema | ConstSchema | EnumSchema | ArraySchema | TupleSchema | ObjectSchema | UnionSchema | OneOfSchema | RefSchema;
|
|
50
|
+
interface SchemaBase {
|
|
51
|
+
[key: `x-${string}`]: unknown;
|
|
52
|
+
title?: string;
|
|
53
|
+
description?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Additional draft 2020-12 constraints that refine (never replace) this
|
|
56
|
+
* node. This extension is non-normative for LinkRPC identity; use
|
|
57
|
+
* {@link materializeJsonSchema} when exporting to a general validator.
|
|
58
|
+
*/
|
|
59
|
+
"x-json-schema"?: boolean | Record<string, unknown>;
|
|
60
|
+
}
|
|
61
|
+
interface NullSchema extends SchemaBase {
|
|
62
|
+
type: "null";
|
|
63
|
+
}
|
|
64
|
+
interface BooleanSchema extends SchemaBase {
|
|
65
|
+
type: "boolean";
|
|
66
|
+
}
|
|
67
|
+
interface NumberSchema extends SchemaBase {
|
|
68
|
+
type: "number";
|
|
69
|
+
/** Opaque well-known refinement tag, e.g. "float32", "percentage". */
|
|
70
|
+
format?: string;
|
|
71
|
+
}
|
|
72
|
+
interface IntegerSchema extends SchemaBase {
|
|
73
|
+
type: "integer";
|
|
74
|
+
/** Opaque well-known refinement tag, e.g. "int32", "uint8", "unix-time". */
|
|
75
|
+
format?: string;
|
|
76
|
+
}
|
|
77
|
+
interface StringSchema extends SchemaBase {
|
|
78
|
+
type: "string";
|
|
79
|
+
/** Opaque well-known refinement tag, e.g. "email", "uri", "uuid", "date-time". */
|
|
80
|
+
format?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Single literal value. */
|
|
83
|
+
interface ConstSchema extends SchemaBase {
|
|
84
|
+
const: JsonValue;
|
|
85
|
+
}
|
|
86
|
+
/** Finite set of literal values. */
|
|
87
|
+
interface EnumSchema extends SchemaBase {
|
|
88
|
+
enum: JsonValue[];
|
|
89
|
+
}
|
|
90
|
+
/** Homogeneous array. */
|
|
91
|
+
interface ArraySchema extends SchemaBase {
|
|
92
|
+
type: "array";
|
|
93
|
+
items: LinkRpcJsonSchema;
|
|
94
|
+
}
|
|
95
|
+
/** Fixed-length head plus optional rest element type. */
|
|
96
|
+
interface TupleSchema extends SchemaBase {
|
|
97
|
+
type: "array";
|
|
98
|
+
prefixItems: LinkRpcJsonSchema[];
|
|
99
|
+
/** `false` => exact length; schema => typed rest; omitted => exact length. */
|
|
100
|
+
items?: LinkRpcJsonSchema | false;
|
|
101
|
+
}
|
|
102
|
+
interface ObjectSchema extends SchemaBase {
|
|
103
|
+
type: "object";
|
|
104
|
+
properties: Record<string, LinkRpcJsonSchema>;
|
|
105
|
+
/** Names of required properties. Must all be keys of `properties`. */
|
|
106
|
+
required?: string[];
|
|
107
|
+
/** `false` => closed; schema => value type for unknown keys. */
|
|
108
|
+
additionalProperties: LinkRpcJsonSchema | false;
|
|
109
|
+
}
|
|
110
|
+
/** Untagged union. Assignability distributes over branches. */
|
|
111
|
+
interface UnionSchema extends SchemaBase {
|
|
112
|
+
anyOf: LinkRpcJsonSchema[];
|
|
113
|
+
}
|
|
6
114
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
115
|
+
* Tagged-or-disjoint union (`oneOf`). Structurally treated the same as
|
|
116
|
+
* `UnionSchema` for assignability; the distinction is preserved so the
|
|
117
|
+
* wire schema faithfully reflects whether the source was a
|
|
118
|
+
* discriminated union (e.g. Zod's `z.discriminatedUnion`) or a plain
|
|
119
|
+
* union.
|
|
120
|
+
*
|
|
121
|
+
* `discriminator`, when present, is a pure consumer hint: it names the
|
|
122
|
+
* property that branches dispatch on. Every branch SHOULD be an object
|
|
123
|
+
* with that property set to a distinct `const` value, but the subset
|
|
124
|
+
* does not enforce this — broken discriminators are tolerated.
|
|
9
125
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
126
|
+
interface OneOfSchema extends SchemaBase {
|
|
127
|
+
oneOf: LinkRpcJsonSchema[];
|
|
128
|
+
discriminator?: DiscriminatorSchema;
|
|
129
|
+
}
|
|
130
|
+
interface DiscriminatorSchema {
|
|
131
|
+
propertyName: string;
|
|
132
|
+
}
|
|
133
|
+
/** Reference to a named entry in `SvcInterfaceSchema.components.schemas`. */
|
|
134
|
+
interface RefSchema extends SchemaBase {
|
|
135
|
+
/** JSON Pointer, restricted to "#/components/schemas/<name>". */
|
|
136
|
+
$ref: string;
|
|
137
|
+
}
|
|
138
|
+
//#endregion
|
|
139
|
+
//#region src/schema/linkRpcInterfaceSchema.d.ts
|
|
140
|
+
/**
|
|
141
|
+
* Minimal interface schema for linkrpc. A strict subset of OpenRPC 1.x:
|
|
142
|
+
* identity & addressing live in linkrpc, so this format only describes the
|
|
143
|
+
* contract of a single interface (methods + reusable JSON Schemas).
|
|
144
|
+
*/
|
|
145
|
+
interface LinkRpcInterfaceSchema {
|
|
146
|
+
[key: `x-${string}`]: unknown;
|
|
147
|
+
/** Stable interface id, e.g. "de.hediet.notification-target". */
|
|
148
|
+
id: string;
|
|
149
|
+
/**
|
|
150
|
+
* Content hash of the normalized schema. Pairs with `id` to form `id@hash`.
|
|
151
|
+
* Normalization: serialize this object with `hash` omitted, object keys
|
|
152
|
+
* sorted recursively, and no insignificant whitespace; hash the bytes.
|
|
153
|
+
*/
|
|
154
|
+
hash: string;
|
|
155
|
+
/**
|
|
156
|
+
* Normative human description (GitHub-flavored markdown). Part of the
|
|
157
|
+
* interface hash — changing `description` is a contract change. Use it
|
|
158
|
+
* for the canonical purpose / semantics of the interface.
|
|
159
|
+
*/
|
|
160
|
+
description?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Non-normative implementation notes (markdown). Stripped from the hash,
|
|
163
|
+
* so editing `comment` never changes the interface identity. Use it for
|
|
164
|
+
* rationale, changelog notes, examples, etc.
|
|
165
|
+
*/
|
|
166
|
+
comment?: string;
|
|
167
|
+
/** Non-normative discovery labels, excluded from the interface hash. */
|
|
168
|
+
tags?: string[];
|
|
169
|
+
/** Methods keyed by local member name. */
|
|
170
|
+
methods: Record<string, MethodSchema>;
|
|
171
|
+
/** Reusable schema definitions, referenced via `#/components/schemas/<name>`. */
|
|
172
|
+
components?: {
|
|
173
|
+
schemas?: Record<string, LinkRpcJsonSchema>;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface MethodSchema {
|
|
177
|
+
[key: `x-${string}`]: unknown;
|
|
178
|
+
/** Schema for the user params object. */
|
|
179
|
+
params: LinkRpcJsonSchema;
|
|
180
|
+
/** Result schema. Omit to declare a notification-only method. */
|
|
181
|
+
result?: LinkRpcJsonSchema;
|
|
182
|
+
/**
|
|
183
|
+
* Schema for client-emitted stream messages (`$stream::send` from
|
|
184
|
+
* caller to callee) on an in-flight call. Absent means the client
|
|
185
|
+
* may not stream on this method.
|
|
186
|
+
*/
|
|
187
|
+
clientStream?: LinkRpcJsonSchema;
|
|
188
|
+
/**
|
|
189
|
+
* Schema for server-emitted stream messages (`$stream::send` from
|
|
190
|
+
* callee to caller) on an in-flight call. Absent means the server
|
|
191
|
+
* may not stream on this method.
|
|
192
|
+
*/
|
|
193
|
+
serverStream?: LinkRpcJsonSchema;
|
|
194
|
+
/** Raw codes are exclusive; named and legacy declarations may form a union per code. */
|
|
195
|
+
errors?: ErrorSchema[];
|
|
196
|
+
summary?: string;
|
|
197
|
+
/**
|
|
198
|
+
* Normative description of this method's contract (markdown). Part of
|
|
199
|
+
* the interface hash — changing it is a contract change.
|
|
200
|
+
*/
|
|
201
|
+
description?: string;
|
|
202
|
+
/** Non-normative implementation notes. Stripped from the hash. */
|
|
203
|
+
comment?: string;
|
|
204
|
+
deprecated?: boolean;
|
|
205
|
+
/**
|
|
206
|
+
* Behavioral claims about this method. All flags default to `false`;
|
|
207
|
+
* setting one is always a positive refinement of the contract.
|
|
208
|
+
* Part of the interface hash — these are normative claims callers
|
|
209
|
+
* may rely on, so changing them is a contract change.
|
|
210
|
+
*/
|
|
211
|
+
annotations?: MemberAnnotations;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Behavioral claims about a method. Every flag is a positive assertion
|
|
215
|
+
* (default `false` ≡ "no claim"); setting one strengthens the contract
|
|
216
|
+
* the caller may rely on.
|
|
217
|
+
*
|
|
218
|
+
* These are normative — they are included in the interface hash.
|
|
219
|
+
*/
|
|
220
|
+
interface MemberAnnotations {
|
|
221
|
+
/**
|
|
222
|
+
* The method does not modify any observable state on the callee
|
|
223
|
+
* (or anywhere reachable from it). Pure query.
|
|
224
|
+
*
|
|
225
|
+
* Implies `idempotent` and `reversible` (a no-op has nothing to
|
|
226
|
+
* undo and repeats trivially).
|
|
227
|
+
*/
|
|
228
|
+
readOnly?: boolean;
|
|
229
|
+
/**
|
|
230
|
+
* Calling N times with the same params has the same observable effect
|
|
231
|
+
* as calling once. Safe to retry on transport failure.
|
|
232
|
+
*/
|
|
233
|
+
idempotent?: boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Effects of this method are reversible — the caller (or operator)
|
|
236
|
+
* can undo them with a follow-up call. Implies the method is not
|
|
237
|
+
* `dangerous`.
|
|
238
|
+
*/
|
|
239
|
+
reversible?: boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Calling this method is expensive (slow, costly, or rate-limited).
|
|
242
|
+
* Callers should avoid unnecessary invocations and may want to
|
|
243
|
+
* confirm / batch.
|
|
244
|
+
*/
|
|
245
|
+
expensive?: boolean;
|
|
246
|
+
/**
|
|
247
|
+
* Method has irreversible or destructive effects (data loss, money
|
|
248
|
+
* spent, message sent, etc.). UIs should require confirmation.
|
|
249
|
+
*/
|
|
250
|
+
dangerous?: boolean;
|
|
251
|
+
}
|
|
252
|
+
type ErrorSchema = LegacyErrorSchema | RawErrorSchema;
|
|
253
|
+
interface RawErrorSchema {
|
|
254
|
+
code: number;
|
|
255
|
+
/** Schema of the wire body { message, data? }, excluding the outer code. */
|
|
256
|
+
schema: LinkRpcJsonSchema;
|
|
257
|
+
type?: never;
|
|
258
|
+
message?: never;
|
|
259
|
+
data?: never;
|
|
260
|
+
}
|
|
261
|
+
interface LegacyErrorSchema {
|
|
262
|
+
schema?: never;
|
|
263
|
+
/** Named error discriminator in `error.data.type`. Absent for legacy numeric errors. */
|
|
264
|
+
type?: string;
|
|
265
|
+
/** JSON-RPC error code. -32768..-32000 and LinkRPC cancellation code -32800 are reserved. */
|
|
266
|
+
code: number;
|
|
267
|
+
message: string;
|
|
268
|
+
/** Payload schema: `error.data.data` for named errors, `error.data` for legacy errors. */
|
|
269
|
+
data?: LinkRpcJsonSchema;
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/connection/rpcFailure.d.ts
|
|
273
|
+
declare const rpcFailureBrand: unique symbol;
|
|
274
|
+
/** A nominal failure wrapper: successful application objects can never collide with it. */
|
|
275
|
+
declare class RpcFailure<E> {
|
|
276
|
+
readonly error: E;
|
|
277
|
+
readonly [rpcFailureBrand] = true;
|
|
278
|
+
constructor(error: E);
|
|
279
|
+
}
|
|
280
|
+
type Result$1<T, E = never> = T | RpcFailure<E>;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/schema/applicationErrorBrand.d.ts
|
|
283
|
+
declare const applicationErrorBrand: unique symbol;
|
|
284
|
+
//#endregion
|
|
285
|
+
//#region src/schema/memberTypes.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* The schema type linkrpc accepts everywhere: the zod *core* base shared by
|
|
288
|
+
* both classic `zod` and `zod/mini`. Typing against it (instead of classic
|
|
289
|
+
* `z.ZodType`) lets callers author interfaces with either flavour — classic
|
|
290
|
+
* for ergonomics, mini for minimal bundle size — while linkrpc's own internal
|
|
291
|
+
* interfaces use mini. `O` is the validated output type.
|
|
292
|
+
*/
|
|
293
|
+
type Schema<O = unknown> = $ZodType<O>;
|
|
294
|
+
/**
|
|
295
|
+
* Marker base for a typed method member. Carries enough metadata to:
|
|
296
|
+
* - validate / parse params at runtime (via the zod schemas),
|
|
297
|
+
* - emit a JSON schema for reflection,
|
|
298
|
+
* - propagate TS types up to the interface definition.
|
|
299
|
+
*/
|
|
300
|
+
type MemberType = RequestType<any, any, any, any, any, any, any> | NotificationType<any>;
|
|
301
|
+
type ApplicationErrorValue<TCode extends number = number, TMessage extends string = string, TData = never, TType extends string | undefined = undefined> = {
|
|
302
|
+
readonly kind: 'application';
|
|
303
|
+
readonly code: TCode;
|
|
304
|
+
readonly message: TMessage;
|
|
305
|
+
} & ([TData] extends [never] ? {
|
|
306
|
+
readonly data?: never;
|
|
307
|
+
} : {
|
|
308
|
+
readonly data: TData;
|
|
309
|
+
}) & (TType extends string ? {
|
|
310
|
+
readonly type: TType;
|
|
311
|
+
} : {
|
|
312
|
+
readonly type?: never;
|
|
313
|
+
});
|
|
314
|
+
type CreatedApplicationErrorValue<TCode extends number = number, TMessage extends string = string, TData = never, TType extends string | undefined = undefined> = ApplicationErrorValue<TCode, TMessage, TData, TType> & {
|
|
315
|
+
readonly [applicationErrorBrand]: true;
|
|
316
|
+
readonly kind: 'application';
|
|
317
|
+
readonly code: TCode;
|
|
318
|
+
readonly message: TMessage;
|
|
319
|
+
readonly data?: TData;
|
|
320
|
+
readonly type?: TType;
|
|
321
|
+
};
|
|
322
|
+
interface ApplicationErrorDescriptor<TCode extends number = number, TMessage extends string = string, TData = never, TType extends string | undefined = undefined> {
|
|
323
|
+
readonly code: TCode;
|
|
324
|
+
readonly message: TMessage;
|
|
325
|
+
readonly dataSchema?: Schema<TData>;
|
|
326
|
+
readonly type: TType;
|
|
327
|
+
/** Match a validated application payload or its failure wrapper. */
|
|
328
|
+
is(value: RpcFailure<unknown>): value is RpcFailure<ApplicationErrorValue<TCode, string, TData, TType>>;
|
|
329
|
+
is(value: {
|
|
330
|
+
readonly kind: 'application';
|
|
331
|
+
}): value is ApplicationErrorValue<TCode, string, TData, TType>;
|
|
332
|
+
is(value: unknown): value is ApplicationErrorValue<TCode, string, TData, TType> | RpcFailure<ApplicationErrorValue<TCode, string, TData, TType>>;
|
|
333
|
+
readonly create: [TData] extends [never] ? () => CreatedApplicationErrorValue<TCode, TMessage, TData, TType> : (data: TData) => CreatedApplicationErrorValue<TCode, TMessage, TData, TType>;
|
|
334
|
+
}
|
|
335
|
+
interface ApplicationErrorDescriptorBase {
|
|
336
|
+
readonly type?: string;
|
|
337
|
+
readonly code: number;
|
|
338
|
+
readonly message?: string;
|
|
339
|
+
readonly bodySchema?: Schema;
|
|
340
|
+
readonly dataSchema?: Schema<any>;
|
|
341
|
+
readonly create: (...args: any[]) => {
|
|
342
|
+
readonly kind: 'application';
|
|
343
|
+
readonly code: number;
|
|
344
|
+
readonly message: string;
|
|
345
|
+
readonly data?: unknown;
|
|
346
|
+
readonly type?: string;
|
|
347
|
+
readonly [applicationErrorBrand]: true;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
type ApplicationErrorOf<T> = T extends RpcErrorDescriptor<infer C, infer B> ? CreatedRpcErrorValue<C, B> : T extends ApplicationErrorDescriptor<infer C, infer M, infer D, infer N> ? CreatedApplicationErrorValue<C, M, D, N> : never;
|
|
351
|
+
type PublicApplicationErrorOf<T> = 0 extends (1 & T) ? never : T extends {
|
|
352
|
+
readonly [rawErrorBrand]: true;
|
|
353
|
+
} ? Omit<T, typeof applicationErrorBrand | typeof rawErrorBrand> : T extends CreatedApplicationErrorValue<infer C, infer M, infer D, infer N> ? ApplicationErrorValue<C, N extends string ? string : M, D, N> : never;
|
|
354
|
+
type DeclaredApplicationErrorOf<T> = 0 extends (1 & T) ? never : Extract<T, ReturnType<ApplicationErrorDescriptorBase['create']>>;
|
|
355
|
+
type ApplicationErrorsOf<T extends readonly ApplicationErrorDescriptorBase[]> = ApplicationErrorOf<T[number]>;
|
|
356
|
+
declare const rawErrorBrand: unique symbol;
|
|
357
|
+
type RpcErrorBody = {
|
|
358
|
+
readonly message: string;
|
|
359
|
+
readonly data?: unknown;
|
|
360
|
+
};
|
|
361
|
+
type RpcErrorValue<C extends number, B extends RpcErrorBody> = B & {
|
|
362
|
+
readonly kind: 'application';
|
|
363
|
+
readonly code: C;
|
|
364
|
+
readonly type?: never;
|
|
365
|
+
};
|
|
366
|
+
type CreatedRpcErrorValue<C extends number, B extends RpcErrorBody> = RpcErrorValue<C, B> & {
|
|
367
|
+
readonly [applicationErrorBrand]: true;
|
|
368
|
+
readonly [rawErrorBrand]: true;
|
|
369
|
+
};
|
|
370
|
+
interface RpcErrorDescriptor<C extends number = number, B extends RpcErrorBody = RpcErrorBody> {
|
|
371
|
+
readonly code: C;
|
|
372
|
+
readonly bodySchema: Schema<B>;
|
|
373
|
+
readonly type?: never;
|
|
374
|
+
readonly message?: never;
|
|
375
|
+
readonly dataSchema?: never;
|
|
376
|
+
create(body: B): CreatedRpcErrorValue<C, B>;
|
|
377
|
+
is(value: RpcFailure<unknown>): value is RpcFailure<RpcErrorValue<C, B>>;
|
|
378
|
+
is(value: {
|
|
379
|
+
readonly kind: 'application';
|
|
380
|
+
}): value is RpcErrorValue<C, B>;
|
|
381
|
+
is(value: unknown): value is RpcErrorValue<C, B> | RpcFailure<RpcErrorValue<C, B>>;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Optional documentation for a method member.
|
|
385
|
+
*
|
|
386
|
+
* - `description` is the **normative** contract of the method (included in the
|
|
387
|
+
* interface hash — changing it changes `schemaHash`).
|
|
388
|
+
* - `comment` is non-normative implementation notes (stripped from the hash).
|
|
389
|
+
* - `annotations` are normative behavioral claims (e.g. `readOnly`,
|
|
390
|
+
* `idempotent`); included in the hash.
|
|
391
|
+
*/
|
|
392
|
+
interface MemberDocs {
|
|
393
|
+
description?: string;
|
|
394
|
+
comment?: string;
|
|
395
|
+
annotations?: MemberAnnotations;
|
|
396
|
+
}
|
|
397
|
+
declare class RequestType<TParams = unknown, TResult = void, TError = void, TClientStream = never, TServerStream = never, TErrors extends readonly ApplicationErrorDescriptorBase[] = readonly ApplicationErrorDescriptorBase[], TLegacyError = TError> {
|
|
398
|
+
readonly paramsSchema: Schema<TParams>;
|
|
399
|
+
readonly resultSchema: Schema<TResult>;
|
|
400
|
+
readonly errorSchema: Schema<TLegacyError>;
|
|
401
|
+
readonly docs: MemberDocs;
|
|
402
|
+
/**
|
|
403
|
+
* Schema for stream messages the **client** may emit on an
|
|
404
|
+
* in-flight call (e.g. cancellation, input). `undefined` means
|
|
405
|
+
* the client may not stream on this method.
|
|
406
|
+
*/
|
|
407
|
+
readonly clientStreamSchema?: Schema<TClientStream> | undefined;
|
|
408
|
+
/**
|
|
409
|
+
* Schema for stream messages the **server** may emit while
|
|
410
|
+
* handling an in-flight call (e.g. progress, partial results).
|
|
411
|
+
* `undefined` means the server may not stream on this method.
|
|
412
|
+
*/
|
|
413
|
+
readonly serverStreamSchema?: Schema<TServerStream> | undefined;
|
|
414
|
+
/** Checked application errors explicitly declared with `.withErrors()`. */
|
|
415
|
+
readonly applicationErrors: TErrors;
|
|
416
|
+
readonly kind: "request";
|
|
417
|
+
constructor(paramsSchema: Schema<TParams>, resultSchema: Schema<TResult>, errorSchema: Schema<TLegacyError>, docs?: MemberDocs,
|
|
418
|
+
/**
|
|
419
|
+
* Schema for stream messages the **client** may emit on an
|
|
420
|
+
* in-flight call (e.g. cancellation, input). `undefined` means
|
|
421
|
+
* the client may not stream on this method.
|
|
422
|
+
*/
|
|
423
|
+
clientStreamSchema?: Schema<TClientStream> | undefined,
|
|
424
|
+
/**
|
|
425
|
+
* Schema for stream messages the **server** may emit while
|
|
426
|
+
* handling an in-flight call (e.g. progress, partial results).
|
|
427
|
+
* `undefined` means the server may not stream on this method.
|
|
428
|
+
*/
|
|
429
|
+
serverStreamSchema?: Schema<TServerStream> | undefined,
|
|
430
|
+
/** Checked application errors explicitly declared with `.withErrors()`. */
|
|
431
|
+
applicationErrors?: TErrors);
|
|
432
|
+
/** Declared checked errors, retained as a tuple for generated-contract consumers. */
|
|
433
|
+
readonly errors: TErrors;
|
|
434
|
+
/** Phantom field — typed-only, do not access at runtime. */
|
|
435
|
+
readonly _params: TParams;
|
|
436
|
+
readonly _result: TResult;
|
|
437
|
+
readonly _error: TError;
|
|
438
|
+
readonly _clientStream: TClientStream;
|
|
439
|
+
readonly _serverStream: TServerStream;
|
|
440
|
+
/**
|
|
441
|
+
* Return a copy of this request type with stream payload schemas
|
|
442
|
+
* attached. Pass `undefined` for either direction to leave it
|
|
443
|
+
* closed.
|
|
444
|
+
* `NoInfer` keeps a contextual MemberMap's `any` stream slots from
|
|
445
|
+
* widening undeclared directions; only the supplied schemas infer payloads.
|
|
446
|
+
*/
|
|
447
|
+
withStream<TClient = TClientStream, TServer = TServerStream>(opts: {
|
|
448
|
+
client?: Schema<TClient>;
|
|
449
|
+
server?: Schema<TServer>;
|
|
450
|
+
}): RequestType<TParams, TResult, TError, NoInfer<TClient>, NoInfer<TServer>, TErrors, TLegacyError>;
|
|
451
|
+
/**
|
|
452
|
+
* Return a copy with an explicit, typed set of checked application errors.
|
|
453
|
+
* The legacy third `requestType` schema remains accepted for compatibility,
|
|
454
|
+
* but does not opt a method into checked errors.
|
|
455
|
+
*/
|
|
456
|
+
withErrors<const TErrors extends readonly ApplicationErrorDescriptorBase[]>(errors: TErrors): RequestType<TParams, TResult, ApplicationErrorsOf<TErrors>, TClientStream, TServerStream, TErrors, TLegacyError>;
|
|
457
|
+
}
|
|
458
|
+
declare class NotificationType<TParams = unknown> {
|
|
459
|
+
readonly paramsSchema: Schema<TParams>;
|
|
460
|
+
readonly docs: MemberDocs;
|
|
461
|
+
readonly kind: "notification";
|
|
462
|
+
constructor(paramsSchema: Schema<TParams>, docs?: MemberDocs);
|
|
463
|
+
readonly _params: TParams;
|
|
464
|
+
}
|
|
465
|
+
interface SchemaParameterReference<TName extends string = string> {
|
|
466
|
+
readonly $parameter: TName;
|
|
467
|
+
}
|
|
468
|
+
type NonRecursiveJsonSchema = Exclude<LinkRpcJsonSchema, ArraySchema | TupleSchema | ObjectSchema | UnionSchema | OneOfSchema>;
|
|
469
|
+
type InterfaceTemplateJsonSchema<TParameter extends string = string> = NonRecursiveJsonSchema | SchemaParameterReference<TParameter> | (Omit<ArraySchema, "items"> & {
|
|
470
|
+
readonly items: InterfaceTemplateJsonSchema<TParameter>;
|
|
471
|
+
}) | (Omit<TupleSchema, "prefixItems" | "items"> & {
|
|
472
|
+
readonly prefixItems: readonly InterfaceTemplateJsonSchema<TParameter>[];
|
|
473
|
+
readonly items?: InterfaceTemplateJsonSchema<TParameter> | false;
|
|
474
|
+
}) | (Omit<ObjectSchema, "properties" | "additionalProperties"> & {
|
|
475
|
+
readonly properties: Readonly<Record<string, InterfaceTemplateJsonSchema<TParameter>>>;
|
|
476
|
+
readonly additionalProperties: InterfaceTemplateJsonSchema<TParameter> | false;
|
|
477
|
+
}) | (Omit<UnionSchema, "anyOf"> & {
|
|
478
|
+
readonly anyOf: readonly InterfaceTemplateJsonSchema<TParameter>[];
|
|
479
|
+
}) | (Omit<OneOfSchema, "oneOf"> & {
|
|
480
|
+
readonly oneOf: readonly InterfaceTemplateJsonSchema<TParameter>[];
|
|
481
|
+
});
|
|
482
|
+
type InterfaceTemplateMethodSchema<TParameter extends string = string> = Omit<MethodSchema, "params" | "result" | "clientStream" | "serverStream" | "errors"> & {
|
|
483
|
+
readonly params: InterfaceTemplateJsonSchema<TParameter>;
|
|
484
|
+
readonly result?: InterfaceTemplateJsonSchema<TParameter>;
|
|
485
|
+
readonly clientStream?: InterfaceTemplateJsonSchema<TParameter>;
|
|
486
|
+
readonly serverStream?: InterfaceTemplateJsonSchema<TParameter>;
|
|
487
|
+
readonly errors?: readonly InterfaceTemplateErrorSchema<TParameter>[];
|
|
488
|
+
};
|
|
489
|
+
type InterfaceTemplateErrorSchema<TParameter extends string = string> = {
|
|
490
|
+
readonly code: number;
|
|
491
|
+
readonly schema: InterfaceTemplateJsonSchema<TParameter>;
|
|
492
|
+
readonly type?: never;
|
|
493
|
+
readonly message?: never;
|
|
494
|
+
readonly data?: never;
|
|
495
|
+
} | {
|
|
496
|
+
readonly schema?: never;
|
|
497
|
+
readonly type?: string;
|
|
498
|
+
readonly code: number;
|
|
499
|
+
readonly message: string;
|
|
500
|
+
readonly data?: InterfaceTemplateJsonSchema<TParameter>;
|
|
501
|
+
};
|
|
502
|
+
interface InterfaceTemplateSchema<TParameter extends string = string> {
|
|
503
|
+
readonly id: string;
|
|
504
|
+
/** Non-normative discovery labels contributed when this template is instantiated. */
|
|
505
|
+
readonly tags?: readonly string[];
|
|
506
|
+
readonly parameters: readonly TParameter[];
|
|
507
|
+
readonly methods: Readonly<Record<string, InterfaceTemplateMethodSchema<TParameter>>>;
|
|
508
|
+
readonly components?: {
|
|
509
|
+
readonly schemas?: Readonly<Record<string, InterfaceTemplateJsonSchema<TParameter>>>;
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
interface InterfaceTemplateArgument {
|
|
513
|
+
readonly schema: LinkRpcJsonSchema;
|
|
514
|
+
readonly components?: {
|
|
515
|
+
readonly schemas?: Readonly<Record<string, LinkRpcJsonSchema>>;
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
interface InterfaceTemplateInstance {
|
|
519
|
+
readonly name: string;
|
|
520
|
+
readonly template: string;
|
|
521
|
+
readonly members: Readonly<Record<string, string>>;
|
|
522
|
+
readonly arguments: Readonly<Record<string, InterfaceTemplateArgument>>;
|
|
523
|
+
}
|
|
524
|
+
interface MappedInterfaceTemplate {
|
|
525
|
+
readonly template: InterfaceTemplateSchema;
|
|
526
|
+
readonly schema: Omit<InterfaceTemplateInstance, "name">;
|
|
527
|
+
}
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/schema/validationIssue.d.ts
|
|
530
|
+
interface JsonSchemaValidationIssue {
|
|
531
|
+
readonly path: string;
|
|
532
|
+
readonly message: string;
|
|
533
|
+
}
|
|
534
|
+
//#endregion
|
|
535
|
+
//#region src/connection/nonCompliantServerError.d.ts
|
|
536
|
+
/** JSON Pointer diagnostics relative to the original wire error. */
|
|
537
|
+
type RpcValidationIssue = JsonSchemaValidationIssue;
|
|
538
|
+
declare class NonCompliantServerError extends Error {
|
|
539
|
+
readonly original: JsonRpcError['error'];
|
|
540
|
+
readonly issues: readonly RpcValidationIssue[];
|
|
541
|
+
readonly kind: "nonCompliantServer";
|
|
542
|
+
constructor(original: JsonRpcError['error'], issues: readonly RpcValidationIssue[]);
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
//#region src/schema/interfaceTemplateGroup.d.ts
|
|
546
|
+
/** Local authoring marker. Never serialized into the wire contract. */
|
|
547
|
+
declare const interfaceTemplateGroup: unique symbol;
|
|
548
|
+
interface InterfaceTemplateGroup<M extends Record<string, MemberType> = Record<string, MemberType>, Mapping extends Record<keyof M, string> | undefined = Record<keyof M, string> | undefined> {
|
|
549
|
+
readonly [interfaceTemplateGroup]: true;
|
|
550
|
+
readonly members: M;
|
|
551
|
+
readonly template: InterfaceTemplateSchema;
|
|
552
|
+
readonly arguments: Readonly<Record<string, InterfaceTemplateArgument>>;
|
|
553
|
+
readonly mapping: Mapping;
|
|
554
|
+
}
|
|
555
|
+
//#endregion
|
|
556
|
+
//#region src/connection/interfaceDefinition.d.ts
|
|
557
|
+
/**
|
|
558
|
+
* Per-call stream API handed to a request handler as its third argument.
|
|
559
|
+
* Allows the handler to consume {@link STREAM_METHOD} notifications
|
|
560
|
+
* emitted by the caller (`onMessage`) and emit stream notifications to
|
|
561
|
+
* the caller (`send`) while the request is in flight.
|
|
562
|
+
*
|
|
563
|
+
* Members are typed by the originating method's
|
|
564
|
+
* {@link RequestType.clientStreamSchema} / `serverStreamSchema`.
|
|
565
|
+
* Streams whose schema is `undefined` make the corresponding member
|
|
566
|
+
* effectively unusable: `send` is typed `(payload: never) => void` and
|
|
567
|
+
* the registered `onMessage` listener can never fire because the
|
|
568
|
+
* receiver-side validator rejects the wire payload.
|
|
569
|
+
*/
|
|
570
|
+
interface StreamApi<TClient = unknown, TServer = unknown> {
|
|
571
|
+
/** Emit a server→client stream message. */
|
|
572
|
+
send(payload: TServer): Promise<void>;
|
|
573
|
+
/**
|
|
574
|
+
* Register a listener for client→server stream messages on this
|
|
575
|
+
* request. Calling twice replaces the previous listener.
|
|
576
|
+
*/
|
|
577
|
+
onMessage(listener: (payload: TClient) => void): void;
|
|
578
|
+
/**
|
|
579
|
+
* Liveness probe toward the caller: resolves once the caller
|
|
580
|
+
* acknowledges with a matching pong, rejects if the call settles
|
|
581
|
+
* first. Independent of the channel's automatic keepalive ping.
|
|
582
|
+
*/
|
|
583
|
+
ping(): Promise<void>;
|
|
584
|
+
/**
|
|
585
|
+
* Aborts when the caller cancels this in-flight request, or when the
|
|
586
|
+
* hub cancels it on the caller's behalf (caller disconnect / idle
|
|
587
|
+
* timeout). Observe it to stop work early and settle the request
|
|
588
|
+
* (e.g. `signal.throwIfAborted()`), which surfaces as a `cancelled`
|
|
589
|
+
* error to the caller.
|
|
590
|
+
*/
|
|
591
|
+
readonly signal: AbortSignal;
|
|
592
|
+
}
|
|
593
|
+
interface InterfaceInfo {
|
|
594
|
+
id: string;
|
|
595
|
+
/** Non-normative discovery labels; do not affect interface identity. */
|
|
596
|
+
tags?: readonly string[];
|
|
597
|
+
/**
|
|
598
|
+
* Normative description of the interface (markdown). Part of the
|
|
599
|
+
* interface hash — changing it is a contract change.
|
|
600
|
+
*/
|
|
601
|
+
description?: string;
|
|
602
|
+
/** Non-normative implementation notes. Stripped from the hash. */
|
|
603
|
+
comment?: string;
|
|
604
|
+
/**
|
|
605
|
+
* Optional expected content hash (see `computeInterfaceHash`). When
|
|
606
|
+
* set, {@link InterfaceDefinition}'s constructor verifies that the
|
|
607
|
+
* computed {@link InterfaceDefinition.schemaHash} matches and throws
|
|
608
|
+
* otherwise — a guard against silent contract drift when the wire
|
|
609
|
+
* shape changes but a pinned hash was not updated.
|
|
610
|
+
*/
|
|
611
|
+
hash?: string;
|
|
612
|
+
}
|
|
613
|
+
type MemberMap = Record<string, MemberType>;
|
|
614
|
+
type InterfaceDeclarations = Record<string, MemberType | InterfaceTemplateGroup>;
|
|
615
|
+
/** Stable wire identity of one member in an interface definition. */
|
|
616
|
+
interface InterfaceMemberRef<TName extends string = string> {
|
|
617
|
+
readonly interfaceId: string;
|
|
618
|
+
readonly interfaceHash: string;
|
|
619
|
+
readonly member: TName;
|
|
620
|
+
}
|
|
621
|
+
type InterfaceMemberRefMap<TMembers extends MemberMap> = { readonly [K in keyof TMembers & string]: InterfaceMemberRef<K>; };
|
|
622
|
+
/**
|
|
623
|
+
* Per-call options accepted by a streaming-enabled client method. Currently
|
|
624
|
+
* only `onMessage` for consuming server→client stream notifications; the
|
|
625
|
+
* caller addresses client→server stream messages via the returned
|
|
626
|
+
* {@link StreamingCall}.
|
|
627
|
+
*/
|
|
628
|
+
interface StreamCallOptions<TServer> {
|
|
629
|
+
/** Listener for server→client stream messages on this in-flight call. */
|
|
630
|
+
onMessage?: (payload: TServer) => void;
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Return shape of a streaming-enabled client method. Behaves as a
|
|
634
|
+
* `Promise<TResult>` for the final response, and exposes `send` for
|
|
635
|
+
* emitting client→server stream messages on the in-flight call. The
|
|
636
|
+
* wire request id is also exposed (resolved once the request has
|
|
637
|
+
* been allocated).
|
|
638
|
+
*
|
|
639
|
+
* For methods whose interface schema declares no client stream
|
|
640
|
+
* (`TClient = never`), `send` is typed `(payload: never) => Promise<void>`
|
|
641
|
+
* and is effectively uncallable — matching the runtime behavior, where
|
|
642
|
+
* the receiver would drop client-emitted stream messages anyway.
|
|
643
|
+
*/
|
|
644
|
+
interface StreamingCall<TResult, TClient> extends Promise<TResult> {
|
|
645
|
+
/** Resolves to the wire request id once the call has been sent. */
|
|
646
|
+
readonly requestId: Promise<RequestId>;
|
|
647
|
+
/** Emit a client→server stream message on this in-flight call. */
|
|
648
|
+
send(payload: TClient): Promise<void>;
|
|
649
|
+
/**
|
|
650
|
+
* Ask the callee to abort this in-flight call. Advisory: the call
|
|
651
|
+
* settles via its normal response (typically a `cancelled` error).
|
|
652
|
+
* `reason` is an open-set diagnostic string (see `StreamControlReason`).
|
|
653
|
+
*/
|
|
654
|
+
cancel(reason?: string): Promise<void>;
|
|
655
|
+
/**
|
|
656
|
+
* Stop tracking this call locally. This does not notify the callee; call
|
|
657
|
+
* {@link cancel} first when remote work should also be cancelled.
|
|
658
|
+
*/
|
|
659
|
+
dispose?(reason?: string): void;
|
|
660
|
+
/**
|
|
661
|
+
* Liveness probe toward the callee: resolves once the callee
|
|
662
|
+
* acknowledges with a matching pong, rejects if the call settles
|
|
663
|
+
* first. Independent of the channel's automatic keepalive ping.
|
|
664
|
+
*/
|
|
665
|
+
ping(): Promise<void>;
|
|
666
|
+
}
|
|
667
|
+
interface RemoteRpcError {
|
|
668
|
+
readonly kind: 'remote';
|
|
669
|
+
readonly code: number;
|
|
670
|
+
readonly message: string;
|
|
671
|
+
readonly data?: JsonValue;
|
|
672
|
+
}
|
|
673
|
+
interface LocalRpcError {
|
|
674
|
+
readonly kind: 'local';
|
|
675
|
+
readonly cause: unknown;
|
|
676
|
+
}
|
|
677
|
+
interface TransportRpcError {
|
|
678
|
+
readonly kind: 'transport';
|
|
679
|
+
readonly cause: unknown;
|
|
680
|
+
}
|
|
681
|
+
type GenericRpcError = RemoteRpcError | LocalRpcError | TransportRpcError | NonCompliantServerError;
|
|
682
|
+
type RpcCallError<E = never> = {
|
|
683
|
+
readonly kind: 'application';
|
|
684
|
+
readonly error: E;
|
|
685
|
+
} | {
|
|
686
|
+
readonly kind: 'generic';
|
|
687
|
+
readonly error: GenericRpcError;
|
|
688
|
+
};
|
|
689
|
+
type CheckedCallResult<TResult, TApplicationError = never> = {
|
|
690
|
+
readonly ok: true;
|
|
691
|
+
readonly value: TResult;
|
|
692
|
+
} | {
|
|
693
|
+
readonly ok: false;
|
|
694
|
+
readonly error: TApplicationError | GenericRpcError;
|
|
695
|
+
};
|
|
696
|
+
interface CheckedCall<TResult, TApplicationError = never> extends Promise<Result$1<TResult, TApplicationError>> {
|
|
697
|
+
/**
|
|
698
|
+
* @deprecated Use getResultClient() for values that include generic errors.
|
|
699
|
+
*/
|
|
700
|
+
result(): Promise<CheckedCallResult<TResult, TApplicationError>>;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* `true` iff at least one stream direction is declared (either client or
|
|
704
|
+
* server stream schema present). Used by {@link InterfaceClient} to pick
|
|
705
|
+
* between the plain `Promise<R>` shape and the {@link StreamingCall}
|
|
706
|
+
* shape per method.
|
|
707
|
+
*/
|
|
708
|
+
type _HasStream<TClient, TServer> = [TClient] extends [never] ? ([TServer] extends [never] ? false : true) : true;
|
|
709
|
+
type ClientCall<TResult, TApplicationError> = [TApplicationError] extends [never] ? Promise<TResult> : CheckedCall<TResult, TApplicationError>;
|
|
710
|
+
type ClientResult<R, E> = [E] extends [never] ? R : Result$1<R, E>;
|
|
711
|
+
/**
|
|
712
|
+
* Compile-time TypeScript shape of an interface — useful for typed
|
|
713
|
+
* client/server implementations on top of the runtime definition.
|
|
714
|
+
*
|
|
715
|
+
* Methods whose `RequestType` declares stream payloads via
|
|
716
|
+
* `.withStream({ client, server })` return a {@link StreamingCall}
|
|
717
|
+
* augmented with `send`; all others return a plain `Promise<TResult>`.
|
|
718
|
+
*
|
|
719
|
+
* @example
|
|
720
|
+
* type Client = InterfaceClient<typeof myInterface>;
|
|
721
|
+
* // => { bar(p: {...}): Promise<string>; foo(p: {...}): void; }
|
|
722
|
+
*/
|
|
723
|
+
type InterfaceClientMember<TMember> = TMember extends RequestType<infer P, infer R, infer E, infer TC, infer TS, any, any> ? (_HasStream<TC, TS> extends true ? (params: P, opts?: StreamCallOptions<TS>) => StreamingCall<ClientResult<R, PublicApplicationErrorOf<E>>, TC> & ClientCall<R, PublicApplicationErrorOf<E>> : (params: P) => ClientCall<R, PublicApplicationErrorOf<E>>) : TMember extends NotificationType<infer P> ? (params: P) => void : never;
|
|
724
|
+
type MembersClient<M extends MemberMap> = { [K in keyof M]: InterfaceClientMember<M[K]>; };
|
|
725
|
+
/** A reusable consumer's client shape, independent of instance name or wire mapping. */
|
|
726
|
+
type InterfaceTemplateClient<T extends InterfaceTemplateGroup> = MembersClient<T['members']>;
|
|
727
|
+
type DeclarationClient<M> = M extends InterfaceTemplateGroup ? InterfaceTemplateClient<M> : InterfaceClientMember<M>;
|
|
728
|
+
type InterfaceClient<TDef extends InterfaceDefinition<any>> = { [K in keyof TDef['_declarations']]: DeclarationClient<TDef['_declarations'][K]>; };
|
|
729
|
+
type InterfaceResultClientMember<TMember> = TMember extends RequestType<infer P, infer R, infer E, infer TC, infer TS, any, any> ? _HasStream<TC, TS> extends true ? (params: P, opts?: StreamCallOptions<TS>) => StreamingCall<Result$1<R, RpcCallError<PublicApplicationErrorOf<E>>>, TC> : (params: P) => Promise<Result$1<R, RpcCallError<PublicApplicationErrorOf<E>>>> : TMember extends NotificationType<infer P> ? (params: P) => void : never;
|
|
730
|
+
type MembersResultClient<M extends MemberMap> = { [K in keyof M]: InterfaceResultClientMember<M[K]>; };
|
|
731
|
+
/** Result-client counterpart of {@link InterfaceTemplateClient}. */
|
|
732
|
+
type InterfaceTemplateResultClient<T extends InterfaceTemplateGroup> = MembersResultClient<T['members']>;
|
|
733
|
+
/** Every request returns failures as values, including methods with no declared errors. */
|
|
734
|
+
type DeclarationResultClient<M> = M extends InterfaceTemplateGroup ? InterfaceTemplateResultClient<M> : InterfaceResultClientMember<M>;
|
|
735
|
+
type InterfaceResultClient<TDef extends InterfaceDefinition<any>> = { [K in keyof TDef['_declarations']]: DeclarationResultClient<TDef['_declarations'][K]>; };
|
|
736
|
+
/**
|
|
737
|
+
* Compile-time shape of a server implementation for an interface — used by
|
|
738
|
+
* `LinkRpcConnection.register`. Request handlers may return synchronously or
|
|
739
|
+
* via a promise; notification handlers return void.
|
|
740
|
+
*
|
|
741
|
+
* `TCtx` is the call-context type carried by the hosting connection — see
|
|
742
|
+
* `LinkRpcConnection<TCtx>`. For the default connection (`TCtx = undefined`)
|
|
743
|
+
* handlers may take a single params arg; for ctx-aware connections (e.g.
|
|
744
|
+
* the hub's self connection) they may take a second `ctx` arg of the
|
|
745
|
+
* concrete type. A 1-arg handler remains assignable where a 2-arg handler
|
|
746
|
+
* is expected, so existing handlers compile unchanged.
|
|
747
|
+
*/
|
|
748
|
+
type InterfaceHandler<TMember, TCtx> = TMember extends RequestType<infer P, infer R, infer E, infer TC, infer TS, any, any> ? (params: P, ctx: TCtx, stream: StreamApi<TC, TS>) => R | DeclaredApplicationErrorOf<E> | Promise<R | DeclaredApplicationErrorOf<E>> : TMember extends NotificationType<infer P> ? (params: P, ctx: TCtx) => void | Promise<void> : never;
|
|
749
|
+
type DeclarationHandler<M, TCtx> = M extends InterfaceTemplateGroup ? { [K in keyof M['members']]: InterfaceHandler<M['members'][K], TCtx>; } : InterfaceHandler<M, TCtx>;
|
|
750
|
+
type KnownKeys<T> = keyof { [K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: unknown; };
|
|
751
|
+
type InterfaceHandlers<TDef extends InterfaceDefinition<any>, TCtx = undefined> = { [K in keyof TDef['_declarations']]: DeclarationHandler<TDef['_declarations'][K], TCtx>; } & { [K in Exclude<KnownKeys<TDef['members']>, keyof TDef['_declarations']>]?: K extends keyof Object ? Object[K] : never; };
|
|
752
|
+
/**
|
|
753
|
+
* Options accepted by {@link InterfaceDefinition}'s constructor.
|
|
754
|
+
*
|
|
755
|
+
* `frozenSchema` lets callers supply an externally-authored
|
|
756
|
+
* `LinkRpcInterfaceSchema` (e.g. produced by codegen or, in the faker, by an
|
|
757
|
+
* LLM at runtime) verbatim. When set, `toSchema()` returns that document
|
|
758
|
+
* (with `hash` overlaid) and `schemaHash` is computed from it — the
|
|
759
|
+
* `members` map is used only for runtime dispatch (param/result
|
|
760
|
+
* validation, stream routing) and is no longer the source of truth for
|
|
761
|
+
* the wire shape.
|
|
762
|
+
*/
|
|
763
|
+
interface InterfaceAuthoringOptions {
|
|
764
|
+
/** Checked structural instances; implementations remain in connection.register(). */
|
|
765
|
+
readonly templates?: Readonly<Record<string, MappedInterfaceTemplate>>;
|
|
766
|
+
}
|
|
767
|
+
interface InterfaceDefinitionOpts extends InterfaceAuthoringOptions {
|
|
768
|
+
frozenSchema?: LinkRpcInterfaceSchema;
|
|
769
|
+
}
|
|
770
|
+
declare class InterfaceDefinition<TMembers extends MemberMap, TDeclarations extends InterfaceDeclarations = TMembers> {
|
|
771
|
+
readonly info: InterfaceInfo;
|
|
772
|
+
readonly members: TMembers;
|
|
773
|
+
/** Compile-time authoring shape shared by clients and handlers; wire members remain flat. */
|
|
774
|
+
readonly _declarations: TDeclarations;
|
|
775
|
+
/** Typed wire references for capability and access-request construction. */
|
|
776
|
+
readonly ref: InterfaceMemberRefMap<TMembers>;
|
|
777
|
+
constructor(info: InterfaceInfo, members: TMembers, opts?: InterfaceDefinitionOpts);
|
|
778
|
+
/** @internal Materialize authored groups using the existing wire call functions verbatim. */
|
|
779
|
+
nestClient(client: Record<string, unknown>): Record<string, unknown>;
|
|
780
|
+
/** Validate grouped implementations atomically, then lower them to wire handlers. */
|
|
781
|
+
flattenHandlers(handlers: unknown): Record<string, unknown>;
|
|
782
|
+
/** Content hash of this interface (see `computeInterfaceHash`). */
|
|
783
|
+
get schemaHash(): string;
|
|
784
|
+
/** Lower the definition to a wire-format `LinkRpcInterfaceSchema`, hash filled in. */
|
|
785
|
+
toSchema(): LinkRpcInterfaceSchema;
|
|
786
|
+
}
|
|
787
|
+
//#endregion
|
|
788
|
+
//#region src/transport/messageTransport.d.ts
|
|
789
|
+
interface IMessageTransport<TIncoming = JsonRpcMessage, TOutgoing = JsonRpcMessage> {
|
|
790
|
+
send(message: TOutgoing): void | Promise<void>;
|
|
791
|
+
/**
|
|
792
|
+
* Sets the listener for incoming messages. Setting `undefined` detaches.
|
|
793
|
+
* The transport buffers messages received before a listener is attached
|
|
794
|
+
* and delivers them the next tick when one is set.
|
|
795
|
+
* Forgetting to set a listener will cause the queue to leak.
|
|
796
|
+
*/
|
|
797
|
+
setListener(listener: ((message: TIncoming) => void) | undefined): void;
|
|
798
|
+
dispose(): void;
|
|
799
|
+
}
|
|
800
|
+
//#endregion
|
|
801
|
+
//#region src/connection/channel.d.ts
|
|
802
|
+
declare class Channel<TInCtx = undefined, TOutCtx = undefined> {
|
|
803
|
+
readonly sender: IRequestSender<TOutCtx>;
|
|
804
|
+
private readonly _setHandler;
|
|
805
|
+
private readonly _setWireObserver?;
|
|
806
|
+
constructor(sender: IRequestSender<TOutCtx>, _setHandler: (h: IRequestHandler<TInCtx> | undefined) => void, _setWireObserver?: ((observer: WireMessageObserver | undefined) => void) | undefined);
|
|
807
|
+
/** Bind the inbound request/notification handler. May be called before or after construction of {@link LinkRpcConnection}. */
|
|
808
|
+
setRequestHandler(handler: IRequestHandler<TInCtx> | undefined): void;
|
|
809
|
+
/**
|
|
810
|
+
* Install the endpoint inspection observer at the JSON-RPC wire boundary.
|
|
811
|
+
* Intended for {@link LinkRpcConnection}; ordinary consumers should use the
|
|
812
|
+
* public `hubrpc.traffic` service instead.
|
|
813
|
+
*/
|
|
814
|
+
setWireMessageObserver(observer: WireMessageObserver | undefined): void;
|
|
815
|
+
/**
|
|
816
|
+
* Compose this channel with a sender-side decorator (typically the
|
|
817
|
+
* signing layer). The decorator wraps {@link sender} only; the
|
|
818
|
+
* {@link setRequestHandler} binding is shared with the original channel
|
|
819
|
+
* so the receive side is bound exactly once regardless of decoration depth.
|
|
820
|
+
*/
|
|
821
|
+
withSender<TNewOutCtx>(decorate: (raw: IRequestSender<TOutCtx>) => IRequestSender<TNewOutCtx>): Channel<TInCtx, TNewOutCtx>;
|
|
822
|
+
}
|
|
823
|
+
type WireMessageDirection = 'inbound' | 'outbound';
|
|
824
|
+
type WireMessageObserver = (direction: WireMessageDirection, message: JsonRpcMessage) => void;
|
|
825
|
+
interface IRequestHandler<TInCtx = undefined> {
|
|
826
|
+
handleRequest(call: IncomingCall<TInCtx>): Promise<Result>;
|
|
827
|
+
handleNotification(call: IncomingCall<TInCtx>): void;
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Inbound call observed by an {@link IRequestHandler}. `TInCtx` is the
|
|
831
|
+
* per-call out-of-band context the transport attached on the receiving
|
|
832
|
+
* side (e.g. the hub stamps `Participant` on overlay-bound messages).
|
|
833
|
+
* For wire transports it's `undefined`.
|
|
834
|
+
*/
|
|
835
|
+
interface IncomingCall<TInCtx = undefined> {
|
|
836
|
+
method: string;
|
|
837
|
+
params: JsonValue | undefined;
|
|
838
|
+
/** Out-of-band context attached by the transport, if any. */
|
|
839
|
+
context: TInCtx;
|
|
840
|
+
/**
|
|
841
|
+
* Per-call streaming handle. Both directions live on this object,
|
|
842
|
+
* scoped to the request's lifetime. The inbound listener is auto-
|
|
843
|
+
* detached when the handler's response settles. For notifications
|
|
844
|
+
* (no request id) the handle is a no-op stub.
|
|
845
|
+
*/
|
|
846
|
+
stream: IncomingStream;
|
|
847
|
+
/**
|
|
848
|
+
* Aborts when the caller cancels this in-flight request (a
|
|
849
|
+
* `toCallee` `cancel` control), or when the hub cancels it on the
|
|
850
|
+
* caller's behalf (caller disconnect / idle timeout). The handler
|
|
851
|
+
* should observe this and settle promptly — typically by throwing,
|
|
852
|
+
* which surfaces as a `cancelled` error response. For notifications
|
|
853
|
+
* this never aborts.
|
|
854
|
+
*/
|
|
855
|
+
signal: AbortSignal;
|
|
856
|
+
}
|
|
857
|
+
/**
|
|
858
|
+
* Per-call streaming handle attached to {@link IncomingCall.stream}.
|
|
859
|
+
* Scoped to a single in-flight request; the channel automatically
|
|
860
|
+
* detaches the inbound listener when the handler's response settles.
|
|
861
|
+
*
|
|
862
|
+
* For notifications (which have no request id), `requestId` is
|
|
863
|
+
* `undefined`, `send` is a no-op, and `onMessage` is a no-op.
|
|
864
|
+
*/
|
|
865
|
+
interface IncomingStream {
|
|
866
|
+
/** Emit a server→client stream notification correlated with this call. */
|
|
867
|
+
send(payload: JsonValue): Promise<void>;
|
|
868
|
+
/**
|
|
869
|
+
* Register a listener for client→server stream messages correlated
|
|
870
|
+
* with this call. Pass `undefined` to detach. Replaces any prior
|
|
871
|
+
* listener. The channel detaches the listener automatically when
|
|
872
|
+
* the handler's response settles.
|
|
873
|
+
*/
|
|
874
|
+
onMessage(listener: ((payload: JsonValue) => void) | undefined): void;
|
|
875
|
+
/**
|
|
876
|
+
* Liveness probe toward the caller: emit a `toCaller` ping and
|
|
877
|
+
* resolve once the caller's `pong` (matching nonce) returns. Rejects
|
|
878
|
+
* if the request settles first. Independent of the channel's
|
|
879
|
+
* automatic keepalive ping.
|
|
880
|
+
*/
|
|
881
|
+
ping(): Promise<void>;
|
|
882
|
+
}
|
|
883
|
+
type Result = {
|
|
884
|
+
result: JsonValue;
|
|
885
|
+
} | {
|
|
886
|
+
error: {
|
|
887
|
+
code: number;
|
|
888
|
+
message: string;
|
|
889
|
+
data?: JsonValue;
|
|
890
|
+
};
|
|
891
|
+
};
|
|
892
|
+
/**
|
|
893
|
+
* What callers use to send. The {@link Channel} factory binds an
|
|
894
|
+
* {@link IRequestHandler} at construction (immutable for the channel's
|
|
895
|
+
* lifetime) and hands the caller back an `IRequestSender`.
|
|
896
|
+
*
|
|
897
|
+
* `TOutCtx` is the per-call context bag this sender understands. For
|
|
898
|
+
* the base {@link JsonRpcChannel} it's `undefined` (the channel
|
|
899
|
+
* doesn't read any overrides). Decorators like `SigningSender`
|
|
900
|
+
* parametrise it on their own ctx shape.
|
|
901
|
+
*/
|
|
902
|
+
interface IRequestSender<TOutCtx = undefined> {
|
|
903
|
+
sendRequest(method: string, params: JsonValue | undefined, opts?: SendOpts<TOutCtx>): Promise<JsonValue>;
|
|
904
|
+
sendNotification(method: string, params: JsonValue | undefined, opts?: SendOpts<TOutCtx>): Promise<void>;
|
|
905
|
+
/**
|
|
906
|
+
* Issue a request that participates in the streaming sub-protocol.
|
|
907
|
+
* Returns synchronously with the wire request id, the result
|
|
908
|
+
* promise, and a `send` for emitting client→server stream messages.
|
|
909
|
+
*/
|
|
910
|
+
sendRequestWithStream(method: string, params: JsonValue | undefined, opts?: StreamSendOpts<TOutCtx>): RawStreamingCall;
|
|
911
|
+
close(): void;
|
|
912
|
+
}
|
|
913
|
+
/**
|
|
914
|
+
* Handle for a request issued via
|
|
915
|
+
* {@link IRequestSender.sendRequestWithStream}. `send` emits
|
|
916
|
+
* client→server stream messages correlated with this call. `result`
|
|
917
|
+
* resolves with the call's response.
|
|
918
|
+
*/
|
|
919
|
+
interface RawStreamingCall {
|
|
920
|
+
readonly result: Promise<JsonValue>;
|
|
921
|
+
/** Emit a client→server (`toCallee`) stream message correlated with this call. */
|
|
922
|
+
send(payload: JsonValue): void;
|
|
923
|
+
/**
|
|
924
|
+
* Ask the callee to abort this in-flight request (a `toCallee`
|
|
925
|
+
* `cancel` control). Advisory: the request settles via its normal
|
|
926
|
+
* response (typically a `cancelled` error). `reason` is an open-set
|
|
927
|
+
* diagnostic string (see `StreamControlReason`).
|
|
928
|
+
*/
|
|
929
|
+
cancel(reason?: string): void;
|
|
930
|
+
/**
|
|
931
|
+
* Stop tracking this request locally and reject {@link result}. This does
|
|
932
|
+
* not notify the callee; call {@link cancel} first when remote work should
|
|
933
|
+
* also be cancelled. Safe to call after the request has already settled.
|
|
934
|
+
*/
|
|
935
|
+
dispose?(reason?: string): void;
|
|
936
|
+
/**
|
|
937
|
+
* Liveness probe toward the callee: emit a `toCallee` ping and
|
|
938
|
+
* resolve once the callee's `pong` (matching nonce) returns. Rejects
|
|
939
|
+
* if the request settles first. Independent of the channel's
|
|
940
|
+
* automatic keepalive ping.
|
|
941
|
+
*/
|
|
942
|
+
ping(): Promise<void>;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Per-send options.
|
|
946
|
+
*
|
|
947
|
+
* `interfaceHash` is interface-level call metadata: the schema hash of
|
|
948
|
+
* the interface a typed proxy is calling. It is independent of
|
|
949
|
+
* `TOutCtx` — the connection stamps it from the interface definition,
|
|
950
|
+
* the base {@link JsonRpcChannel} ignores it, and signing decorators
|
|
951
|
+
* bake it into the `$hubrpc` envelope.
|
|
952
|
+
*
|
|
953
|
+
* `ctx` is the sender's `TOutCtx`-typed override / extension bag for
|
|
954
|
+
* per-call decorator overrides (e.g. `signerOverride`, `capsOverride`).
|
|
955
|
+
* The base {@link JsonRpcChannel} ignores `ctx` entirely; decorators
|
|
956
|
+
* like `SigningSender` interpret it.
|
|
957
|
+
*/
|
|
958
|
+
interface SendOpts<TOutCtx = undefined> {
|
|
959
|
+
readonly ctx?: TOutCtx;
|
|
960
|
+
/** Interface schema hash for this call (interface-level metadata). */
|
|
961
|
+
readonly interfaceHash?: string;
|
|
962
|
+
}
|
|
963
|
+
interface StreamSendOpts<TOutCtx = undefined> extends SendOpts<TOutCtx> {
|
|
964
|
+
readonly onStreamMessage?: (payload: JsonValue) => void;
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Type of incoming messages on the channel's transport. With
|
|
968
|
+
* `TInCtx = undefined` (default) this is just `JsonRpcMessage`. With a
|
|
969
|
+
* concrete `TInCtx`, the transport carries a `context` field alongside
|
|
970
|
+
* the message — out-of-band, never sent over a wire, set by the
|
|
971
|
+
* in-process producer.
|
|
972
|
+
*/
|
|
973
|
+
type MessageWithCtx<TInCtx> = [TInCtx] extends [undefined] ? JsonRpcMessage : JsonRpcMessage & {
|
|
974
|
+
context: TInCtx;
|
|
975
|
+
};
|
|
976
|
+
declare const zParticipantDescriptorSource: zod_mini.ZodMiniObject<{
|
|
977
|
+
source: zod_mini.ZodMiniEnum<{
|
|
978
|
+
self: "self";
|
|
979
|
+
attacher: "attacher";
|
|
980
|
+
}>;
|
|
981
|
+
descriptor: zod_mini.ZodMiniObject<{
|
|
982
|
+
type: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
983
|
+
label: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
984
|
+
processId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniNumber<number>>;
|
|
985
|
+
processType: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
986
|
+
nodeStatusServiceId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
987
|
+
metadata: zod_mini.ZodMiniOptional<zod_mini.ZodMiniRecord<zod_mini.ZodMiniString<string>, zod_mini.ZodMiniUnion<readonly [zod_mini.ZodMiniString<string>, zod_mini.ZodMiniNumber<number>, zod_mini.ZodMiniBoolean<boolean>]>>>;
|
|
988
|
+
}, zod_v4_core.$strip>;
|
|
989
|
+
}, zod_v4_core.$strip>;
|
|
990
|
+
type ParticipantDescriptorSource = output<typeof zParticipantDescriptorSource>;
|
|
991
|
+
declare const zTrafficTransitEvent: zod_mini.ZodMiniObject<{
|
|
992
|
+
type: zod_mini.ZodMiniLiteral<"transit">;
|
|
993
|
+
timeMs: zod_mini.ZodMiniNumber<number>;
|
|
994
|
+
nodeId: zod_mini.ZodMiniString<string>;
|
|
995
|
+
in: zod_mini.ZodMiniOptional<zod_mini.ZodMiniObject<{
|
|
996
|
+
edgeId: zod_mini.ZodMiniString<string>;
|
|
997
|
+
portId: zod_mini.ZodMiniString<string>;
|
|
998
|
+
requestId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniUnion<readonly [zod_mini.ZodMiniNumber<number>, zod_mini.ZodMiniString<string>]>>;
|
|
999
|
+
}, zod_v4_core.$strip>>;
|
|
1000
|
+
out: zod_mini.ZodMiniOptional<zod_mini.ZodMiniObject<{
|
|
1001
|
+
edgeId: zod_mini.ZodMiniString<string>;
|
|
1002
|
+
portId: zod_mini.ZodMiniString<string>;
|
|
1003
|
+
requestId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniUnion<readonly [zod_mini.ZodMiniNumber<number>, zod_mini.ZodMiniString<string>]>>;
|
|
1004
|
+
}, zod_v4_core.$strip>>;
|
|
1005
|
+
disposition: zod_mini.ZodMiniEnum<{
|
|
1006
|
+
forwarded: "forwarded";
|
|
1007
|
+
consumed: "consumed";
|
|
1008
|
+
dropped: "dropped";
|
|
1009
|
+
unroutable: "unroutable";
|
|
1010
|
+
}>;
|
|
1011
|
+
kind: zod_mini.ZodMiniEnum<{
|
|
1012
|
+
request: "request";
|
|
1013
|
+
notification: "notification";
|
|
1014
|
+
response: "response";
|
|
1015
|
+
stream: "stream";
|
|
1016
|
+
}>;
|
|
1017
|
+
method: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
1018
|
+
params: zod_mini.ZodMiniOptional<zod_mini.ZodMiniUnknown>;
|
|
1019
|
+
result: zod_mini.ZodMiniOptional<zod_mini.ZodMiniUnknown>;
|
|
1020
|
+
error: zod_mini.ZodMiniOptional<zod_mini.ZodMiniObject<{
|
|
1021
|
+
code: zod_mini.ZodMiniNumber<number>;
|
|
1022
|
+
message: zod_mini.ZodMiniString<string>;
|
|
1023
|
+
data: zod_mini.ZodMiniOptional<zod_mini.ZodMiniUnknown>;
|
|
1024
|
+
}, zod_v4_core.$strip>>;
|
|
1025
|
+
}, zod_v4_core.$strip>;
|
|
1026
|
+
type TrafficTransitEvent = output<typeof zTrafficTransitEvent>;
|
|
1027
|
+
//#endregion
|
|
1028
|
+
//#region src/inspection/node.interfaces.d.ts
|
|
1029
|
+
declare const zNodeInfo: zod_mini.ZodMiniObject<{
|
|
1030
|
+
nodeId: zod_mini.ZodMiniString<string>;
|
|
1031
|
+
portId: zod_mini.ZodMiniString<string>;
|
|
1032
|
+
descriptors: zod_mini.ZodMiniOptional<zod_mini.ZodMiniArray<zod_mini.ZodMiniObject<{
|
|
1033
|
+
source: zod_mini.ZodMiniEnum<{
|
|
1034
|
+
self: "self";
|
|
1035
|
+
attacher: "attacher";
|
|
1036
|
+
}>;
|
|
1037
|
+
descriptor: zod_mini.ZodMiniObject<{
|
|
1038
|
+
type: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
1039
|
+
label: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
1040
|
+
processId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniNumber<number>>;
|
|
1041
|
+
processType: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
1042
|
+
nodeStatusServiceId: zod_mini.ZodMiniOptional<zod_mini.ZodMiniString<string>>;
|
|
1043
|
+
metadata: zod_mini.ZodMiniOptional<zod_mini.ZodMiniRecord<zod_mini.ZodMiniString<string>, zod_mini.ZodMiniUnion<readonly [zod_mini.ZodMiniString<string>, zod_mini.ZodMiniNumber<number>, zod_mini.ZodMiniBoolean<boolean>]>>>;
|
|
1044
|
+
}, zod_v4_core.$strip>;
|
|
1045
|
+
}, zod_v4_core.$strip>>>;
|
|
1046
|
+
}, zod_v4_core.$strip>;
|
|
1047
|
+
type NodeInfo = output<typeof zNodeInfo>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Generates unique topology-correlation labels, not security identities.
|
|
1050
|
+
* Custom generators must avoid collisions across nodes and ports. Tests can
|
|
1051
|
+
* supply an independent deterministic sequence for each participant.
|
|
1052
|
+
*/
|
|
1053
|
+
type TopologyIdGenerator = (kind: 'node' | 'port') => string;
|
|
1054
|
+
//#endregion
|
|
1055
|
+
//#region src/connection/bareInterfaceTarget.d.ts
|
|
1056
|
+
/** A metadata-free foreign-protocol interface and its wire-method prefix. */
|
|
1057
|
+
interface BareInterfaceTarget<TDef extends InterfaceDefinition<any>> {
|
|
1058
|
+
readonly mode: 'bare';
|
|
1059
|
+
readonly interface: TDef;
|
|
1060
|
+
readonly prefix: string;
|
|
1061
|
+
}
|
|
1062
|
+
//#endregion
|
|
1063
|
+
//#region src/connection/interfaceTarget.d.ts
|
|
1064
|
+
/** A qualified LinkRPC route. An empty serviceId addresses the root interface. */
|
|
1065
|
+
interface QualifiedInterfaceTarget<TDef extends InterfaceDefinition<any>> {
|
|
1066
|
+
readonly mode: 'qualified';
|
|
1067
|
+
readonly interface: TDef;
|
|
1068
|
+
readonly serviceId: string;
|
|
1069
|
+
}
|
|
1070
|
+
/** The peer's preset form-1 route, retaining LinkRPC metadata and streaming. */
|
|
1071
|
+
interface DefaultInterfaceTarget<TDef extends InterfaceDefinition<any>> {
|
|
1072
|
+
readonly mode: 'default';
|
|
1073
|
+
readonly interface: TDef;
|
|
1074
|
+
}
|
|
1075
|
+
type InterfaceTarget<TDef extends InterfaceDefinition<any>> = QualifiedInterfaceTarget<TDef> | DefaultInterfaceTarget<TDef> | BareInterfaceTarget<TDef>;
|
|
1076
|
+
/** One OR-set. The set is satisfied by holding *any one* of its principals. */
|
|
1077
|
+
declare const zRootPrincipalSet: zod_mini.ZodMiniArray<zod_mini.ZodMiniObject<{
|
|
1078
|
+
principal: zod_mini.ZodMiniString<string>;
|
|
1079
|
+
transitive: zod_mini.ZodMiniOptional<zod_mini.ZodMiniBoolean<boolean>>;
|
|
1080
|
+
}, zod_v4_core.$strip>>;
|
|
1081
|
+
type RootPrincipalSet = output<typeof zRootPrincipalSet>;
|
|
1082
|
+
//#endregion
|
|
1083
|
+
//#region src/connection/linkRpcConnection.d.ts
|
|
1084
|
+
interface LinkRpcConnectionOptions {
|
|
1085
|
+
/** Topology node/port ID generator. Defaults to cryptographic randomness. */
|
|
1086
|
+
readonly generateTopologyId?: TopologyIdGenerator;
|
|
1087
|
+
/**
|
|
1088
|
+
* Validate parameters passed through typed interface clients before sending
|
|
1089
|
+
* them. Enabled by default. Disable only when interoperating with a peer
|
|
1090
|
+
* whose accepted wire shape intentionally differs from the local schema.
|
|
1091
|
+
*/
|
|
1092
|
+
readonly validateOutboundParams?: boolean;
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* High-level linkrpc connection. Layers method-name routing and zod-driven
|
|
1096
|
+
* validation on top of a plain JSON-RPC channel.
|
|
1097
|
+
*
|
|
1098
|
+
* Typed proxies built by this class merely forward each call's
|
|
1099
|
+
* `interfaceHash` hint to the channel so the signer stamps it into the
|
|
1100
|
+
* `$hubrpc` envelope.
|
|
1101
|
+
*
|
|
1102
|
+
* `TInCtx` is the per-call out-of-band context the connection's transport
|
|
1103
|
+
* carries. Default `undefined` covers cross-process and ordinary in-process
|
|
1104
|
+
* transports. The hub's self/overlay connections instantiate with a
|
|
1105
|
+
* concrete `TInCtx` (e.g. `Participant`) so handlers can see who originated
|
|
1106
|
+
* the call.
|
|
1107
|
+
*
|
|
1108
|
+
* `TOutCtx` is the per-call override / extension bag the outbound sender
|
|
1109
|
+
* understands (see {@link SendOpts.ctx}). It only ever flows into the
|
|
1110
|
+
* sender as input, so it is a contravariant type parameter. Default `any`
|
|
1111
|
+
* keeps the bare `LinkRpcConnection` a valid supertype for holders that do
|
|
1112
|
+
* not care about the outbound ctx; pass a concrete shape (e.g.
|
|
1113
|
+
* `SigningCallCtx`) to get precise {@link get} typing. The connection
|
|
1114
|
+
* itself is agnostic to its contents — it merely forwards the `ctx`
|
|
1115
|
+
* defaults supplied to {@link get}.
|
|
1116
|
+
*/
|
|
1117
|
+
declare class LinkRpcConnection<TInCtx = any, TOutCtx = any> {
|
|
1118
|
+
/**
|
|
1119
|
+
* Convenience: build a {@link JsonRpcChannel} `Channel` from the
|
|
1120
|
+
* given transport and wrap it in an `LinkRpcConnection`. Use this
|
|
1121
|
+
* when you have a transport at hand and don't need a decorator
|
|
1122
|
+
* stack (e.g. signing).
|
|
1123
|
+
*/
|
|
1124
|
+
static fromTransport<TInCtx = undefined>(transport: IMessageTransport<MessageWithCtx<TInCtx>, JsonRpcMessage>, options?: LinkRpcConnectionOptions): LinkRpcConnection<TInCtx>;
|
|
1125
|
+
/** Underlying JSON-RPC sender — useful for callers that need raw access (e.g. to call hub-served methods that bypass the interface registry). */
|
|
1126
|
+
readonly channel: IRequestSender<TOutCtx>;
|
|
1127
|
+
/** key = `${serviceId ?? ""}::${interfaceId}` */
|
|
1128
|
+
private readonly _registry;
|
|
1129
|
+
/** Descriptions for services that have been registered with a `serviceDescription`. */
|
|
1130
|
+
private readonly _serviceDescriptions;
|
|
1131
|
+
/** Root-node-id requirement sets recorded per serviceId. */
|
|
1132
|
+
private readonly _serviceRootPrincipalSets;
|
|
1133
|
+
private readonly _directoryWatchers;
|
|
1134
|
+
private readonly _directoryListeners;
|
|
1135
|
+
private _inspection;
|
|
1136
|
+
private _inspectionHost;
|
|
1137
|
+
private readonly _serviceInspectionRegistrations;
|
|
1138
|
+
private readonly _wireObservers;
|
|
1139
|
+
private readonly _closeListeners;
|
|
1140
|
+
private _closed;
|
|
1141
|
+
private readonly _wireChannel;
|
|
1142
|
+
private readonly _validateOutboundParams;
|
|
1143
|
+
/** Bare-method bindings, keyed by their exact wire prefix. */
|
|
1144
|
+
private readonly _bareBindings;
|
|
1145
|
+
private readonly _generateTopologyId;
|
|
1146
|
+
/**
|
|
1147
|
+
* Construct from a {@link Channel} (binds the inbound handler and uses
|
|
1148
|
+
* `channel.sender` for outbound calls) or from a bare
|
|
1149
|
+
* {@link IRequestSender} (send-only — no inbound handler is registered,
|
|
1150
|
+
* useful for bootstrap flows like `createManagedIdentity`).
|
|
1151
|
+
*/
|
|
1152
|
+
constructor(channel: Channel<TInCtx, TOutCtx> | IRequestSender<TOutCtx>, options?: LinkRpcConnectionOptions);
|
|
1153
|
+
/** Get a typed client using a bundled qualified, default, or bare route. */
|
|
1154
|
+
get<TDef extends InterfaceDefinition<any>>(target: InterfaceTarget<TDef>): InterfaceClient<TDef>;
|
|
1155
|
+
/** Get a typed client for `iface`, routed to the implicit (root) service. */
|
|
1156
|
+
get<TDef extends InterfaceDefinition<any>>(iface: TDef, opts?: GetOptions<TOutCtx>): InterfaceClient<TDef>;
|
|
1157
|
+
private _getClient;
|
|
1158
|
+
/**
|
|
1159
|
+
* Get a typed client that emits foreign-protocol bare method names.
|
|
1160
|
+
* Unlike {@link get}, these calls carry no LinkRPC interface metadata.
|
|
1161
|
+
*/
|
|
1162
|
+
getBare<TDef extends InterfaceDefinition<any>>(iface: TDef, opts?: BareGetOptions): InterfaceClient<TDef>;
|
|
1163
|
+
private _buildBareClient;
|
|
1164
|
+
/** Return request failures as values for a bundled qualified, default, or bare route. */
|
|
1165
|
+
getResultClient<TDef extends InterfaceDefinition<any>>(target: InterfaceTarget<TDef>): InterfaceResultClient<TDef>;
|
|
1166
|
+
/** Return application and generic request failures as values instead of throwing. */
|
|
1167
|
+
getResultClient<TDef extends InterfaceDefinition<any>>(iface: TDef, opts?: GetOptions<TOutCtx>): InterfaceResultClient<TDef>;
|
|
1168
|
+
/** Get a service-scoped handle; all interfaces obtained from it route via `serviceId` (form 3). */
|
|
1169
|
+
service(serviceId: string): ServiceHandle<TInCtx, TOutCtx>;
|
|
1170
|
+
/** Register handlers, adding preset routing when passed a default or bare target. */
|
|
1171
|
+
register<TDef extends InterfaceDefinition<any>>(ifaceOrTarget: TDef | InterfaceTarget<TDef>, handlers: InterfaceHandlers<TDef, TInCtx>, opts?: RegisterOptions): InterfaceRegistration;
|
|
1172
|
+
/** Register inspection contracts without recursively enabling service inspection. */
|
|
1173
|
+
registerInspection<TDef extends InterfaceDefinition<any>>(iface: TDef, handlers: InterfaceHandlers<TDef, TInCtx>, opts?: RegisterOptions): InterfaceRegistration;
|
|
1174
|
+
/** Observe this connection without replacing another inspection scope's observer. */
|
|
1175
|
+
observeWireMessages(observer: WireMessageObserver): InterfaceRegistration;
|
|
1176
|
+
onDidClose(listener: () => void): InterfaceRegistration;
|
|
1177
|
+
private _register;
|
|
1178
|
+
/** Snapshot of every interface currently registered on this connection. */
|
|
1179
|
+
listRegisteredInterfaces(): readonly {
|
|
1180
|
+
readonly serviceId: string;
|
|
1181
|
+
readonly interfaceId: string;
|
|
1182
|
+
readonly interfaceHash: string;
|
|
1183
|
+
readonly tags?: readonly string[];
|
|
1184
|
+
readonly serviceDescription?: string;
|
|
1185
|
+
readonly rootPrincipalSets?: readonly RootPrincipalSet[];
|
|
1186
|
+
}[];
|
|
1187
|
+
/** Subscribe to coarse local directory changes; listeners must re-list. */
|
|
1188
|
+
onDidChangeDirectory(listener: () => void): () => void;
|
|
1189
|
+
/**
|
|
1190
|
+
* Look up a registered interface definition by id (and optional content
|
|
1191
|
+
* hash). Returns `undefined` if no registered interface matches.
|
|
1192
|
+
*/
|
|
1193
|
+
findRegisteredInterface(interfaceId: string, hash?: string): InterfaceDefinition<any> | undefined;
|
|
1194
|
+
/**
|
|
1195
|
+
* Register the three linkrpc reflection interfaces (`defaults`,
|
|
1196
|
+
* `directory`, `schemas`), backed by this connection's live registry.
|
|
1197
|
+
*
|
|
1198
|
+
* By default they live under the root service (form-2 reachable as
|
|
1199
|
+
* `hubrpc.directory::list`). Pass `serviceId` to additionally mount
|
|
1200
|
+
* them under a specific service — useful for participants that live
|
|
1201
|
+
* behind a hub, so callers can reach reflection via form-3
|
|
1202
|
+
* `<serviceId>::hubrpc.directory::list`.
|
|
1203
|
+
*
|
|
1204
|
+
* Idempotent: re-registering the same `(serviceId, interfaceId)` pair
|
|
1205
|
+
* is a no-op.
|
|
1206
|
+
*/
|
|
1207
|
+
enableReflection(opts?: {
|
|
1208
|
+
serviceId?: string;
|
|
1209
|
+
}): InterfaceRegistration;
|
|
1210
|
+
private _notifyDirectoryWatchers;
|
|
1211
|
+
/**
|
|
1212
|
+
* Enable the root `hubrpc.node::getNodeId` topology-bootstrap service.
|
|
1213
|
+
*
|
|
1214
|
+
* The generated ids are stable while this registration is active. They are
|
|
1215
|
+
* unauthenticated correlation labels only; callers must not use them for
|
|
1216
|
+
* identity, capability, or authorization decisions.
|
|
1217
|
+
*/
|
|
1218
|
+
enableInspection(descriptors?: readonly ParticipantDescriptorSource[]): InspectionRegistration;
|
|
1219
|
+
/** Number of active endpoint traffic stream subscribers. */
|
|
1220
|
+
get trafficObserverCount(): number;
|
|
1221
|
+
close(): void;
|
|
1222
|
+
private _buildClient;
|
|
1223
|
+
private _validateOutboundParamsFor;
|
|
1224
|
+
private _handleRequest;
|
|
1225
|
+
private _buildStreamApi;
|
|
1226
|
+
private _handleNotification;
|
|
1227
|
+
private _parseRouted;
|
|
1228
|
+
private _installServiceInspection;
|
|
1229
|
+
private _removeServiceInspection;
|
|
1230
|
+
private _hasBusinessServiceRegistration;
|
|
1231
|
+
}
|
|
1232
|
+
/**
|
|
1233
|
+
* Options when obtaining a typed client for an interface.
|
|
1234
|
+
*
|
|
1235
|
+
* - `serviceId`: route to a specific service (form 3). Omit for form 2
|
|
1236
|
+
* (implicit / root service on the connection).
|
|
1237
|
+
* - any `TOutCtx` property: a per-client default merged into the `ctx`
|
|
1238
|
+
* of every call issued through the returned proxy (e.g.
|
|
1239
|
+
* `signerOverride`, `capsOverride` for a signing channel). The
|
|
1240
|
+
* connection forwards these verbatim; it does not interpret them.
|
|
1241
|
+
*
|
|
1242
|
+
* Schema-version pinning travels as interface-level call metadata
|
|
1243
|
+
* ({@link SendOpts.interfaceHash}); the typed proxy stamps
|
|
1244
|
+
* `iface.schemaHash` automatically, independent of `TOutCtx`.
|
|
1245
|
+
*/
|
|
1246
|
+
type GetOptions<TOutCtx = undefined> = {
|
|
1247
|
+
serviceId?: string;
|
|
1248
|
+
} & Partial<TOutCtx>;
|
|
1249
|
+
/** Options for a metadata-free, bare-method typed client. */
|
|
1250
|
+
interface BareGetOptions {
|
|
1251
|
+
prefix?: string;
|
|
1252
|
+
}
|
|
1253
|
+
interface RegisterOptions {
|
|
1254
|
+
/**
|
|
1255
|
+
* If set, this interface is mounted under this service id (form 3).
|
|
1256
|
+
*/
|
|
1257
|
+
serviceId?: string;
|
|
1258
|
+
/**
|
|
1259
|
+
* Optional human description recorded for `serviceId` and surfaced
|
|
1260
|
+
* through `hubrpc.directory::list`. Requires `serviceId`. The first
|
|
1261
|
+
* registration's description wins; any later registration that
|
|
1262
|
+
* supplies a *different* non-undefined description throws.
|
|
1263
|
+
*/
|
|
1264
|
+
serviceDescription?: string;
|
|
1265
|
+
/**
|
|
1266
|
+
* Root node ids required to access `serviceId`, in CNF (AND of OR-sets):
|
|
1267
|
+
* the caller must satisfy **every** set, and a set is satisfied by **any
|
|
1268
|
+
* one** of its node ids. Surfaced through `hubrpc.directory::list`.
|
|
1269
|
+
* Requires `serviceId`. Recorded per service; a later registration that
|
|
1270
|
+
* supplies a *different* value for the same `serviceId` throws.
|
|
1271
|
+
*/
|
|
1272
|
+
rootPrincipalSets?: readonly RootPrincipalSet[];
|
|
1273
|
+
}
|
|
1274
|
+
/** A live interface registration. Disposing it removes dispatch and reflection state. */
|
|
1275
|
+
interface InterfaceRegistration {
|
|
1276
|
+
/** Remove this exact registration. Idempotent. */
|
|
1277
|
+
dispose(): void;
|
|
1278
|
+
}
|
|
1279
|
+
/** Generated topology identity and its live root-interface registration. */
|
|
1280
|
+
interface InspectionRegistration extends InterfaceRegistration, NodeInfo {
|
|
1281
|
+
/**
|
|
1282
|
+
* Observe this endpoint's full-payload traffic in-process. Watch-control
|
|
1283
|
+
* flows are tracked even when no public observations are active.
|
|
1284
|
+
*/
|
|
1285
|
+
observeTraffic(observer: (transit: TrafficTransitEvent) => void): InterfaceRegistration;
|
|
1286
|
+
}
|
|
1287
|
+
/** Service-scoped handle returned by `connection.service(id)`. */
|
|
1288
|
+
declare class ServiceHandle<TInCtx = undefined, TOutCtx = undefined> {
|
|
1289
|
+
private readonly _connection;
|
|
1290
|
+
private readonly _serviceId;
|
|
1291
|
+
constructor(_connection: LinkRpcConnection<TInCtx, TOutCtx>, _serviceId: string);
|
|
1292
|
+
getResultClient<TDef extends InterfaceDefinition<any>>(iface: TDef, opts?: Partial<TOutCtx>): InterfaceResultClient<TDef>;
|
|
1293
|
+
get<TDef extends InterfaceDefinition<any>>(iface: TDef, opts?: Partial<TOutCtx>): InterfaceClient<TDef>;
|
|
1294
|
+
register<TDef extends InterfaceDefinition<any>>(ifaceOrTarget: TDef | BareInterfaceTarget<TDef>, handlers: InterfaceHandlers<TDef, TInCtx>, opts?: Omit<RegisterOptions, 'serviceId'>): InterfaceRegistration;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
declare const sessionInfo: z.ZodUnion<readonly [z.ZodObject<{
|
|
1298
|
+
name: z.ZodString;
|
|
1299
|
+
sourceKind: z.ZodEnum<{
|
|
1300
|
+
current: "current";
|
|
1301
|
+
worktree: "worktree";
|
|
1302
|
+
}>;
|
|
1303
|
+
isLoading: z.ZodLiteral<true>;
|
|
1304
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1305
|
+
name: z.ZodString;
|
|
1306
|
+
sourceKind: z.ZodEnum<{
|
|
1307
|
+
current: "current";
|
|
1308
|
+
worktree: "worktree";
|
|
1309
|
+
}>;
|
|
1310
|
+
isLoading: z.ZodOptional<z.ZodLiteral<false>>;
|
|
1311
|
+
serverUrl: z.ZodString;
|
|
1312
|
+
sourceTreeId: z.ZodString;
|
|
1313
|
+
worktreePath: z.ZodOptional<z.ZodString>;
|
|
1314
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1315
|
+
}, z.core.$strip>]>;
|
|
1316
|
+
declare const daemonEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
1317
|
+
type: z.ZodLiteral<"source-change">;
|
|
1318
|
+
sessionName: z.ZodString;
|
|
1319
|
+
sourceTreeId: z.ZodString;
|
|
1320
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1321
|
+
type: z.ZodLiteral<"ref-change">;
|
|
1322
|
+
sessionName: z.ZodString;
|
|
1323
|
+
newCommit: z.ZodString;
|
|
1324
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1325
|
+
type: z.ZodLiteral<"session-change">;
|
|
1326
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
1327
|
+
type: z.ZodLiteral<"log">;
|
|
1328
|
+
level: z.ZodEnum<{
|
|
1329
|
+
info: "info";
|
|
1330
|
+
debug: "debug";
|
|
1331
|
+
trace: "trace";
|
|
1332
|
+
}>;
|
|
1333
|
+
message: z.ZodString;
|
|
1334
|
+
}, z.core.$strip>], "type">;
|
|
1335
|
+
type DaemonEvent = z.infer<typeof daemonEventSchema>;
|
|
1336
|
+
type SessionInfo = z.infer<typeof sessionInfo>;
|
|
1337
|
+
declare function createDaemonMethods(connection: LinkRpcConnection): {
|
|
1338
|
+
fixtures: {
|
|
1339
|
+
list: (params: {
|
|
1340
|
+
sessionName: string;
|
|
1341
|
+
sourceTreeId: string;
|
|
1342
|
+
}) => Promise<{
|
|
1343
|
+
fixtures: {
|
|
1344
|
+
fixtureId: string;
|
|
1345
|
+
fixtureName: string;
|
|
1346
|
+
groupPath: string[];
|
|
1347
|
+
background: "light" | "dark";
|
|
1348
|
+
labels: readonly string[];
|
|
1349
|
+
expectedVisualDescriptions: readonly string[];
|
|
1350
|
+
inputSchema?: unknown;
|
|
1351
|
+
}[];
|
|
1352
|
+
loadError?: string | undefined;
|
|
1353
|
+
}>;
|
|
1354
|
+
};
|
|
1355
|
+
screenshots: {
|
|
1356
|
+
take: (params: {
|
|
1357
|
+
fixtureId: string;
|
|
1358
|
+
sourceTreeId: string;
|
|
1359
|
+
sessionName: string;
|
|
1360
|
+
includeImage?: boolean | undefined;
|
|
1361
|
+
stabilityCheck?: boolean | undefined;
|
|
1362
|
+
reloadBeforeRender?: boolean | undefined;
|
|
1363
|
+
input?: unknown;
|
|
1364
|
+
disposeAfter?: boolean | undefined;
|
|
1365
|
+
}) => Promise<{
|
|
1366
|
+
hasError: boolean;
|
|
1367
|
+
sourceTreeId: string;
|
|
1368
|
+
hash?: string | undefined;
|
|
1369
|
+
image?: string | undefined;
|
|
1370
|
+
error?: {
|
|
1371
|
+
message: string;
|
|
1372
|
+
stack?: string | undefined;
|
|
1373
|
+
} | undefined;
|
|
1374
|
+
events?: {
|
|
1375
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1376
|
+
message: string;
|
|
1377
|
+
stack?: string | undefined;
|
|
1378
|
+
}[] | undefined;
|
|
1379
|
+
output?: unknown;
|
|
1380
|
+
isStable?: boolean | undefined;
|
|
1381
|
+
stabilityScreenshots?: {
|
|
1382
|
+
hash: string;
|
|
1383
|
+
delayMs: number;
|
|
1384
|
+
image?: string | undefined;
|
|
1385
|
+
}[] | undefined;
|
|
1386
|
+
previousDispose?: {
|
|
1387
|
+
hasError: boolean;
|
|
1388
|
+
errors: readonly {
|
|
1389
|
+
message: string;
|
|
1390
|
+
stack?: string | undefined;
|
|
1391
|
+
}[];
|
|
1392
|
+
events: readonly {
|
|
1393
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1394
|
+
message: string;
|
|
1395
|
+
stack?: string | undefined;
|
|
1396
|
+
}[];
|
|
1397
|
+
} | undefined;
|
|
1398
|
+
currentDispose?: {
|
|
1399
|
+
hasError: boolean;
|
|
1400
|
+
errors: readonly {
|
|
1401
|
+
message: string;
|
|
1402
|
+
stack?: string | undefined;
|
|
1403
|
+
}[];
|
|
1404
|
+
events: readonly {
|
|
1405
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1406
|
+
message: string;
|
|
1407
|
+
stack?: string | undefined;
|
|
1408
|
+
}[];
|
|
1409
|
+
} | undefined;
|
|
1410
|
+
}>;
|
|
1411
|
+
takeBatch: (params: {
|
|
1412
|
+
fixtureIds: string[];
|
|
1413
|
+
sourceTreeId: string;
|
|
1414
|
+
sessionName: string;
|
|
1415
|
+
includeImages?: boolean | undefined;
|
|
1416
|
+
reloadBetweenFixtures?: boolean | undefined;
|
|
1417
|
+
input?: unknown;
|
|
1418
|
+
}) => Promise<{
|
|
1419
|
+
sourceTreeId: string;
|
|
1420
|
+
screenshots: {
|
|
1421
|
+
hasError: boolean;
|
|
1422
|
+
fixtureId: string;
|
|
1423
|
+
hash?: string | undefined;
|
|
1424
|
+
image?: string | undefined;
|
|
1425
|
+
error?: {
|
|
1426
|
+
message: string;
|
|
1427
|
+
stack?: string | undefined;
|
|
1428
|
+
} | undefined;
|
|
1429
|
+
events?: {
|
|
1430
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1431
|
+
message: string;
|
|
1432
|
+
stack?: string | undefined;
|
|
1433
|
+
}[] | undefined;
|
|
1434
|
+
output?: unknown;
|
|
1435
|
+
}[];
|
|
1436
|
+
}>;
|
|
1437
|
+
compare: (params: {
|
|
1438
|
+
fixtureId: string;
|
|
1439
|
+
baselineSessionName: string;
|
|
1440
|
+
baselineSourceTreeId: string;
|
|
1441
|
+
currentSessionName: string;
|
|
1442
|
+
currentSourceTreeId: string;
|
|
1443
|
+
includeImages?: boolean | undefined;
|
|
1444
|
+
}) => Promise<{
|
|
1445
|
+
match: boolean;
|
|
1446
|
+
baselineHasError: boolean;
|
|
1447
|
+
currentHasError: boolean;
|
|
1448
|
+
baselineHash?: string | undefined;
|
|
1449
|
+
currentHash?: string | undefined;
|
|
1450
|
+
baselineImage?: string | undefined;
|
|
1451
|
+
currentImage?: string | undefined;
|
|
1452
|
+
baselineError?: {
|
|
1453
|
+
message: string;
|
|
1454
|
+
stack?: string | undefined;
|
|
1455
|
+
} | undefined;
|
|
1456
|
+
baselineEvents?: {
|
|
1457
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1458
|
+
message: string;
|
|
1459
|
+
stack?: string | undefined;
|
|
1460
|
+
}[] | undefined;
|
|
1461
|
+
baselineOutput?: unknown;
|
|
1462
|
+
currentError?: {
|
|
1463
|
+
message: string;
|
|
1464
|
+
stack?: string | undefined;
|
|
1465
|
+
} | undefined;
|
|
1466
|
+
currentEvents?: {
|
|
1467
|
+
type: "console.error" | "console.warn" | "console.log" | "window.error" | "window.unhandledrejection";
|
|
1468
|
+
message: string;
|
|
1469
|
+
stack?: string | undefined;
|
|
1470
|
+
}[] | undefined;
|
|
1471
|
+
currentOutput?: unknown;
|
|
1472
|
+
labels?: readonly string[] | undefined;
|
|
1473
|
+
labelsBefore?: readonly string[] | undefined;
|
|
1474
|
+
approval?: {
|
|
1475
|
+
fixtureId: string;
|
|
1476
|
+
originalHash: string;
|
|
1477
|
+
modifiedHash: string;
|
|
1478
|
+
comment: string;
|
|
1479
|
+
approvedAt: string;
|
|
1480
|
+
} | undefined;
|
|
1481
|
+
}>;
|
|
1482
|
+
};
|
|
1483
|
+
approvals: {
|
|
1484
|
+
approve: (params: {
|
|
1485
|
+
fixtureId: string;
|
|
1486
|
+
originalHash: string;
|
|
1487
|
+
modifiedHash: string;
|
|
1488
|
+
comment: string;
|
|
1489
|
+
}) => Promise<void>;
|
|
1490
|
+
revoke: (params: {
|
|
1491
|
+
fixtureId: string;
|
|
1492
|
+
originalHash: string;
|
|
1493
|
+
modifiedHash: string;
|
|
1494
|
+
}) => Promise<void>;
|
|
1495
|
+
list: (params: {
|
|
1496
|
+
fixtureId?: string | undefined;
|
|
1497
|
+
}) => Promise<{
|
|
1498
|
+
fixtureId: string;
|
|
1499
|
+
originalHash: string;
|
|
1500
|
+
modifiedHash: string;
|
|
1501
|
+
comment: string;
|
|
1502
|
+
approvedAt: string;
|
|
1503
|
+
}[]>;
|
|
1504
|
+
lookup: (params: {
|
|
1505
|
+
fixtureId: string;
|
|
1506
|
+
originalHash: string;
|
|
1507
|
+
modifiedHash: string;
|
|
1508
|
+
}) => Promise<{
|
|
1509
|
+
fixtureId: string;
|
|
1510
|
+
originalHash: string;
|
|
1511
|
+
modifiedHash: string;
|
|
1512
|
+
comment: string;
|
|
1513
|
+
approvedAt: string;
|
|
1514
|
+
} | null>;
|
|
1515
|
+
};
|
|
1516
|
+
visualReview: {
|
|
1517
|
+
getStatus: (params: {
|
|
1518
|
+
fixtureId: string;
|
|
1519
|
+
expectedVisualDescriptions: string[];
|
|
1520
|
+
screenshotHash: string;
|
|
1521
|
+
}) => Promise<"no-expectations" | {
|
|
1522
|
+
expectedVisualDescriptions: readonly string[];
|
|
1523
|
+
status: "approved" | "needs-review";
|
|
1524
|
+
approval?: {
|
|
1525
|
+
approvedAt: string;
|
|
1526
|
+
comment: string;
|
|
1527
|
+
} | undefined;
|
|
1528
|
+
}>;
|
|
1529
|
+
approve: (params: {
|
|
1530
|
+
fixtureId: string;
|
|
1531
|
+
expectedVisualDescriptions: string[];
|
|
1532
|
+
screenshotHash: string;
|
|
1533
|
+
comment: string;
|
|
1534
|
+
}) => Promise<void>;
|
|
1535
|
+
};
|
|
1536
|
+
evaluate: (params: {
|
|
1537
|
+
sessionName: string;
|
|
1538
|
+
sourceTreeId: string;
|
|
1539
|
+
expression: string;
|
|
1540
|
+
fixtureId?: string | undefined;
|
|
1541
|
+
}) => Promise<{
|
|
1542
|
+
result: unknown;
|
|
1543
|
+
}>;
|
|
1544
|
+
setBrowserVisibility: (params: {
|
|
1545
|
+
visible: boolean;
|
|
1546
|
+
}) => Promise<{
|
|
1547
|
+
visible: boolean;
|
|
1548
|
+
}>;
|
|
1549
|
+
events: (params: Record<string, never>, opts?: StreamCallOptions<NoInfer<{
|
|
1550
|
+
type: "source-change";
|
|
1551
|
+
sessionName: string;
|
|
1552
|
+
sourceTreeId: string;
|
|
1553
|
+
} | {
|
|
1554
|
+
type: "ref-change";
|
|
1555
|
+
sessionName: string;
|
|
1556
|
+
newCommit: string;
|
|
1557
|
+
} | {
|
|
1558
|
+
type: "session-change";
|
|
1559
|
+
} | {
|
|
1560
|
+
type: "log";
|
|
1561
|
+
level: "info" | "debug" | "trace";
|
|
1562
|
+
message: string;
|
|
1563
|
+
}>> | undefined) => StreamingCall<void, never> & Promise<void>;
|
|
1564
|
+
sessions: (params: Record<string, never>) => Promise<({
|
|
1565
|
+
name: string;
|
|
1566
|
+
sourceKind: "current" | "worktree";
|
|
1567
|
+
isLoading: true;
|
|
1568
|
+
} | {
|
|
1569
|
+
name: string;
|
|
1570
|
+
sourceKind: "current" | "worktree";
|
|
1571
|
+
serverUrl: string;
|
|
1572
|
+
sourceTreeId: string;
|
|
1573
|
+
isLoading?: false | undefined;
|
|
1574
|
+
worktreePath?: string | undefined;
|
|
1575
|
+
ref?: string | undefined;
|
|
1576
|
+
})[]>;
|
|
1577
|
+
restartSession: (params: {
|
|
1578
|
+
sessionName: string;
|
|
1579
|
+
}) => Promise<({
|
|
1580
|
+
name: string;
|
|
1581
|
+
sourceKind: "current" | "worktree";
|
|
1582
|
+
isLoading: true;
|
|
1583
|
+
} | {
|
|
1584
|
+
name: string;
|
|
1585
|
+
sourceKind: "current" | "worktree";
|
|
1586
|
+
serverUrl: string;
|
|
1587
|
+
sourceTreeId: string;
|
|
1588
|
+
isLoading?: false | undefined;
|
|
1589
|
+
worktreePath?: string | undefined;
|
|
1590
|
+
ref?: string | undefined;
|
|
1591
|
+
})[]>;
|
|
1592
|
+
openSession: (params: {
|
|
1593
|
+
name: string;
|
|
1594
|
+
ref: string;
|
|
1595
|
+
}) => Promise<{
|
|
1596
|
+
sessions: ({
|
|
1597
|
+
name: string;
|
|
1598
|
+
sourceKind: "current" | "worktree";
|
|
1599
|
+
isLoading: true;
|
|
1600
|
+
} | {
|
|
1601
|
+
name: string;
|
|
1602
|
+
sourceKind: "current" | "worktree";
|
|
1603
|
+
serverUrl: string;
|
|
1604
|
+
sourceTreeId: string;
|
|
1605
|
+
isLoading?: false | undefined;
|
|
1606
|
+
worktreePath?: string | undefined;
|
|
1607
|
+
ref?: string | undefined;
|
|
1608
|
+
})[];
|
|
1609
|
+
} | {
|
|
1610
|
+
error: string;
|
|
1611
|
+
}>;
|
|
1612
|
+
closeSession: (params: {
|
|
1613
|
+
name: string;
|
|
1614
|
+
}) => Promise<{
|
|
1615
|
+
sessions: ({
|
|
1616
|
+
name: string;
|
|
1617
|
+
sourceKind: "current" | "worktree";
|
|
1618
|
+
isLoading: true;
|
|
1619
|
+
} | {
|
|
1620
|
+
name: string;
|
|
1621
|
+
sourceKind: "current" | "worktree";
|
|
1622
|
+
serverUrl: string;
|
|
1623
|
+
sourceTreeId: string;
|
|
1624
|
+
isLoading?: false | undefined;
|
|
1625
|
+
worktreePath?: string | undefined;
|
|
1626
|
+
ref?: string | undefined;
|
|
1627
|
+
})[];
|
|
1628
|
+
} | {
|
|
1629
|
+
error: string;
|
|
1630
|
+
}>;
|
|
1631
|
+
updateSessionRef: (params: {
|
|
1632
|
+
name: string;
|
|
1633
|
+
ref: string;
|
|
1634
|
+
}) => Promise<{
|
|
1635
|
+
sessions: ({
|
|
1636
|
+
name: string;
|
|
1637
|
+
sourceKind: "current" | "worktree";
|
|
1638
|
+
isLoading: true;
|
|
1639
|
+
} | {
|
|
1640
|
+
name: string;
|
|
1641
|
+
sourceKind: "current" | "worktree";
|
|
1642
|
+
serverUrl: string;
|
|
1643
|
+
sourceTreeId: string;
|
|
1644
|
+
isLoading?: false | undefined;
|
|
1645
|
+
worktreePath?: string | undefined;
|
|
1646
|
+
ref?: string | undefined;
|
|
1647
|
+
})[];
|
|
1648
|
+
} | {
|
|
1649
|
+
error: string;
|
|
1650
|
+
}>;
|
|
1651
|
+
shutdown: (params: Record<string, never>) => Promise<void>;
|
|
1652
|
+
};
|
|
1653
|
+
type DaemonMethods = ReturnType<typeof createDaemonMethods>;
|
|
1654
|
+
interface DaemonClient {
|
|
1655
|
+
readonly methods: DaemonMethods;
|
|
1656
|
+
dispose(): void;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
export type { DaemonClient, DaemonEvent, DaemonMethods, SessionInfo };
|