devframe 0.1.19 → 0.1.20
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 +2 -2
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +9 -6
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/kit.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +6 -3
- package/dist/adapters/vite.d.mts +1 -1
- package/dist/adapters/vite.mjs +1 -1
- package/dist/client/index.d.mts +42 -6
- package/dist/client/index.mjs +1673 -2
- package/dist/constants.d.mts +1 -1
- package/dist/{context-BsNZMCnr.mjs → context-BfvbAyGk.mjs} +428 -40
- package/dist/{dev-Djy5hbgs.mjs → dev-B8i_CBlQ.mjs} +6 -5
- package/dist/{devtool-CIqONpYU.d.mts → devtool-Bm6zZAw5.d.mts} +365 -27
- package/dist/host-h3-BMvrFzIJ.mjs +24 -0
- package/dist/{index-BwrLhNmz.d.mts → index-BCo03GEF.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/node/index.d.mts +44 -7
- package/dist/node/index.mjs +5 -5
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +3 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{rpc-D7LxIh8t.mjs → rpc-INbWfHoX.mjs} +1 -1
- package/dist/{serialization-BN2ZQEE9.mjs → serialization-DwKi05Pn.mjs} +1 -1
- package/dist/{server-CaUeMcAh.d.mts → server-DksyT-um.d.mts} +1 -1
- package/dist/{server-DrBxa6ZV.mjs → server-qRRM8t3v.mjs} +27 -2
- package/dist/{static-dump-cyGfMmRf.mjs → static-dump-C1aVSwxY.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/shared-state.d.mts +2 -2
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/state.d.mts +2 -1
- package/dist/utils/state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +2 -0
- package/dist/utils/streaming-channel.mjs +255 -0
- package/dist/utils/when.d.mts +1 -1
- package/dist/{ws-client-DOYwYluO.d.mts → ws-client-DQySVfF_.d.mts} +1 -1
- package/dist/{ws-server-DHMeNOY_.d.mts → ws-server-VQqESKAs.d.mts} +13 -1
- package/package.json +9 -17
- package/skills/devframe/README.md +13 -0
- package/skills/devframe/SKILL.md +452 -0
- package/skills/devframe/templates/counter-devtool.ts +29 -0
- package/skills/devframe/templates/spa-devtool.ts +33 -0
- package/skills/devframe/templates/vite-client.ts +11 -0
- package/dist/client-C6w_NshP.mjs +0 -1569
- package/dist/helpers/nuxt/index.d.mts +0 -46
- package/dist/helpers/nuxt/index.mjs +0 -58
- package/dist/helpers/nuxt/runtime/plugin.client.d.mts +0 -8
- package/dist/helpers/nuxt/runtime/plugin.client.mjs +0 -12
- package/dist/host-h3-w3c0t8ZO.mjs +0 -18
- package/dist/immer-HjMAm3b6.mjs +0 -894
- /package/dist/{_shared-BcPXmcjq.mjs → _shared-S-Ujqz_L.mjs} +0 -0
- /package/dist/{main-CuGOfqoX.mjs → main-DpINGndA.mjs} +0 -0
- /package/dist/{open-JfacLHs0.mjs → open-BtOOEldu.mjs} +0 -0
- /package/dist/{transports-DSV5_5QM.mjs → transports-BPUzHhI2.mjs} +0 -0
- /package/dist/{types-gWbe-b2R.d.mts → types-ag029cAe.d.mts} +0 -0
- /package/dist/{when-BAE663Hv.d.mts → when-aBBXAEh5.d.mts} +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { g as RpcFunctionsCollectorBase } from "./index-
|
|
2
|
-
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { g as RpcFunctionsCollectorBase } from "./index-BCo03GEF.mjs";
|
|
2
|
+
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-VQqESKAs.mjs";
|
|
3
3
|
import { Logger, createLogger, defineDiagnostics } from "logs-sdk";
|
|
4
4
|
import { BirpcReturn } from "birpc";
|
|
5
|
+
import { Objectish, Patch, Patch as SharedStatePatch } from "immer";
|
|
5
6
|
import { CAC } from "cac";
|
|
6
7
|
import { GenericSchema, InferOutput } from "valibot";
|
|
7
8
|
import { ChildProcess } from "node:child_process";
|
|
@@ -666,6 +667,23 @@ interface DevToolsHost {
|
|
|
666
667
|
* reasonable value.
|
|
667
668
|
*/
|
|
668
669
|
resolveOrigin: () => string;
|
|
670
|
+
/**
|
|
671
|
+
* Resolve a directory the host owns for persisted devtools state.
|
|
672
|
+
* Each host picks its own app-name namespace so storage doesn't
|
|
673
|
+
* collide between, say, the Vite host (`.vite/devtools`) and a
|
|
674
|
+
* standalone CLI host (`.<appName>/devtools`).
|
|
675
|
+
*
|
|
676
|
+
* - `workspace` — per-project state (settings, caches). Typically
|
|
677
|
+
* under `${workspaceRoot}/node_modules/.<appName>/devtools/`.
|
|
678
|
+
* - `global` — per-user state (auth tokens, machine-wide
|
|
679
|
+
* preferences). Typically under
|
|
680
|
+
* `${homedir()}/.<appName>/devtools/`.
|
|
681
|
+
*
|
|
682
|
+
* Implementations should ensure the directory exists or be safe to
|
|
683
|
+
* pass to a downstream `createStorage(...)` call that creates it
|
|
684
|
+
* lazily.
|
|
685
|
+
*/
|
|
686
|
+
getStorageDir: (scope: 'workspace' | 'global') => string;
|
|
669
687
|
}
|
|
670
688
|
//#endregion
|
|
671
689
|
//#region src/types/messages.d.ts
|
|
@@ -833,11 +851,105 @@ type DevToolsLogsHost = DevToolsMessagesHost;
|
|
|
833
851
|
/**
|
|
834
852
|
* To be extended
|
|
835
853
|
*/
|
|
836
|
-
interface DevToolsRpcClientFunctions {
|
|
854
|
+
interface DevToolsRpcClientFunctions {
|
|
855
|
+
/**
|
|
856
|
+
* Streaming chunk pushed from server to subscribed clients. Wired by
|
|
857
|
+
* `RpcStreamingHost`; do not register manually.
|
|
858
|
+
*
|
|
859
|
+
* @internal
|
|
860
|
+
*/
|
|
861
|
+
'devframe:streaming:chunk': (channel: string, id: string, seq: number, chunk: any) => Promise<void>;
|
|
862
|
+
/**
|
|
863
|
+
* Streaming terminator pushed from server to subscribed clients. Wired by
|
|
864
|
+
* `RpcStreamingHost`; do not register manually.
|
|
865
|
+
*
|
|
866
|
+
* @internal
|
|
867
|
+
*/
|
|
868
|
+
'devframe:streaming:end': (channel: string, id: string, error?: {
|
|
869
|
+
name: string;
|
|
870
|
+
message: string;
|
|
871
|
+
}) => Promise<void>;
|
|
872
|
+
/**
|
|
873
|
+
* Server→client cancel for an in-flight upload. Wired by
|
|
874
|
+
* `RpcStreamingHost`; do not register manually.
|
|
875
|
+
*
|
|
876
|
+
* @internal
|
|
877
|
+
*/
|
|
878
|
+
'devframe:streaming:upload-cancel': (channel: string, id: string) => Promise<void>;
|
|
879
|
+
}
|
|
837
880
|
/**
|
|
838
881
|
* To be extended
|
|
839
882
|
*/
|
|
840
|
-
interface DevToolsRpcServerFunctions {
|
|
883
|
+
interface DevToolsRpcServerFunctions {
|
|
884
|
+
/**
|
|
885
|
+
* Subscribe a client to a shared-state key. Wired by
|
|
886
|
+
* `RpcSharedStateHost`; do not register manually.
|
|
887
|
+
*
|
|
888
|
+
* @internal
|
|
889
|
+
*/
|
|
890
|
+
'devframe:rpc:server-state:subscribe': (key: string) => Promise<void>;
|
|
891
|
+
/**
|
|
892
|
+
* Read the current value for a shared-state key. Wired by
|
|
893
|
+
* `RpcSharedStateHost`; do not register manually.
|
|
894
|
+
*
|
|
895
|
+
* @internal
|
|
896
|
+
*/
|
|
897
|
+
'devframe:rpc:server-state:get': (key: string) => Promise<any>;
|
|
898
|
+
/**
|
|
899
|
+
* Replace a shared-state value (from the client). Wired by
|
|
900
|
+
* `RpcSharedStateHost`; do not register manually.
|
|
901
|
+
*
|
|
902
|
+
* @internal
|
|
903
|
+
*/
|
|
904
|
+
'devframe:rpc:server-state:set': (key: string, value: any, syncId: string) => Promise<void>;
|
|
905
|
+
/**
|
|
906
|
+
* Apply a patch to a shared-state value (from the client). Wired by
|
|
907
|
+
* `RpcSharedStateHost`; do not register manually.
|
|
908
|
+
*
|
|
909
|
+
* @internal
|
|
910
|
+
*/
|
|
911
|
+
'devframe:rpc:server-state:patch': (key: string, patches: any[], syncId: string) => Promise<void>;
|
|
912
|
+
/**
|
|
913
|
+
* Client→server streaming subscription with optional replay cursor.
|
|
914
|
+
* Wired by `RpcStreamingHost`; do not register manually.
|
|
915
|
+
*
|
|
916
|
+
* @internal
|
|
917
|
+
*/
|
|
918
|
+
'devframe:streaming:subscribe': (channel: string, id: string, opts?: {
|
|
919
|
+
afterSeq?: number;
|
|
920
|
+
}) => Promise<void>;
|
|
921
|
+
/**
|
|
922
|
+
* Client→server streaming unsubscribe. Wired by `RpcStreamingHost`;
|
|
923
|
+
* do not register manually.
|
|
924
|
+
*
|
|
925
|
+
* @internal
|
|
926
|
+
*/
|
|
927
|
+
'devframe:streaming:unsubscribe': (channel: string, id: string) => Promise<void>;
|
|
928
|
+
/**
|
|
929
|
+
* Client→server streaming cancellation request. Wired by
|
|
930
|
+
* `RpcStreamingHost`; do not register manually.
|
|
931
|
+
*
|
|
932
|
+
* @internal
|
|
933
|
+
*/
|
|
934
|
+
'devframe:streaming:cancel': (channel: string, id: string) => Promise<void>;
|
|
935
|
+
/**
|
|
936
|
+
* Client→server upload chunk. Wired by `RpcStreamingHost`; do not
|
|
937
|
+
* register manually.
|
|
938
|
+
*
|
|
939
|
+
* @internal
|
|
940
|
+
*/
|
|
941
|
+
'devframe:streaming:upload-chunk': (channel: string, id: string, seq: number, chunk: any) => Promise<void>;
|
|
942
|
+
/**
|
|
943
|
+
* Client→server upload terminator. Wired by `RpcStreamingHost`; do not
|
|
944
|
+
* register manually.
|
|
945
|
+
*
|
|
946
|
+
* @internal
|
|
947
|
+
*/
|
|
948
|
+
'devframe:streaming:upload-end': (channel: string, id: string, error?: {
|
|
949
|
+
name: string;
|
|
950
|
+
message: string;
|
|
951
|
+
}) => Promise<void>;
|
|
952
|
+
}
|
|
841
953
|
/**
|
|
842
954
|
* To be extended
|
|
843
955
|
*/
|
|
@@ -855,16 +967,10 @@ interface DevToolsDocksUserSettings {
|
|
|
855
967
|
}
|
|
856
968
|
//#endregion
|
|
857
969
|
//#region src/types/terminals.d.ts
|
|
858
|
-
interface DevToolsTerminalSessionStreamChunkEvent {
|
|
859
|
-
id: string;
|
|
860
|
-
chunks: string[];
|
|
861
|
-
ts: number;
|
|
862
|
-
}
|
|
863
970
|
interface DevToolsTerminalHost {
|
|
864
971
|
readonly sessions: Map<string, DevToolsTerminalSession>;
|
|
865
972
|
readonly events: EventEmitter<{
|
|
866
973
|
'terminal:session:updated': (session: DevToolsTerminalSession) => void;
|
|
867
|
-
'terminal:session:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => void;
|
|
868
974
|
}>;
|
|
869
975
|
register: (session: DevToolsTerminalSession) => DevToolsTerminalSession;
|
|
870
976
|
update: (session: DevToolsTerminalSession) => void;
|
|
@@ -922,21 +1028,6 @@ interface DevToolsViewHost {
|
|
|
922
1028
|
hostStatic: (baseUrl: string, distDir: string) => void;
|
|
923
1029
|
}
|
|
924
1030
|
//#endregion
|
|
925
|
-
//#region ../../../node_modules/.pnpm/immer@11.1.4/node_modules/immer/dist/immer.d.ts
|
|
926
|
-
interface Patch {
|
|
927
|
-
op: "replace" | "remove" | "add";
|
|
928
|
-
path: (string | number)[];
|
|
929
|
-
value?: any;
|
|
930
|
-
}
|
|
931
|
-
type Objectish = AnyObject | AnyArray | AnyMap | AnySet;
|
|
932
|
-
type AnyObject = {
|
|
933
|
-
[key: string]: any;
|
|
934
|
-
};
|
|
935
|
-
type AnyArray = Array<any>;
|
|
936
|
-
type AnySet = Set<any>;
|
|
937
|
-
type AnyMap = Map<any, any>;
|
|
938
|
-
/** Returns true if the given value is an Immer draft */
|
|
939
|
-
//#endregion
|
|
940
1031
|
//#region src/utils/shared-state.d.ts
|
|
941
1032
|
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
942
1033
|
type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
@@ -986,6 +1077,128 @@ interface SharedStateOptions<T> {
|
|
|
986
1077
|
}
|
|
987
1078
|
declare function createSharedState<T extends Objectish>(options: SharedStateOptions<T>): SharedState<T>;
|
|
988
1079
|
//#endregion
|
|
1080
|
+
//#region src/utils/streaming-channel.d.ts
|
|
1081
|
+
/**
|
|
1082
|
+
* Serialized error shape sent over the wire when a stream ends with a failure.
|
|
1083
|
+
* Stays JSON-safe so the strict-JSON encoder can carry it without coercion.
|
|
1084
|
+
*/
|
|
1085
|
+
interface StreamErrorPayload {
|
|
1086
|
+
name: string;
|
|
1087
|
+
message: string;
|
|
1088
|
+
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Single buffered chunk in the server-side ring buffer.
|
|
1091
|
+
*
|
|
1092
|
+
* Sequence numbers start at 1 and increment per write. Subscribers track
|
|
1093
|
+
* `lastSeenSeq` and ask for `afterSeq` on resubscribe so the server can
|
|
1094
|
+
* replay any chunks the client missed during a brief disconnect.
|
|
1095
|
+
*/
|
|
1096
|
+
interface BufferedChunk<T> {
|
|
1097
|
+
seq: number;
|
|
1098
|
+
chunk: T;
|
|
1099
|
+
}
|
|
1100
|
+
interface StreamSinkEvents<T> {
|
|
1101
|
+
/** Fired for each `write()`. The RPC layer subscribes and broadcasts. */
|
|
1102
|
+
chunk: (seq: number, chunk: T) => void;
|
|
1103
|
+
/** Terminal — fired exactly once per sink lifetime. */
|
|
1104
|
+
end: (error?: StreamErrorPayload) => void;
|
|
1105
|
+
}
|
|
1106
|
+
interface CreateStreamSinkOptions {
|
|
1107
|
+
id?: string;
|
|
1108
|
+
/**
|
|
1109
|
+
* Size of the per-stream ring buffer kept for replay-on-resubscribe.
|
|
1110
|
+
* `0` (default) disables replay.
|
|
1111
|
+
*/
|
|
1112
|
+
replayWindow?: number;
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* Server-side producer handle. Two equivalent surfaces share one piece of
|
|
1116
|
+
* state: the imperative `write/error/close` triple, and a `WritableStream<T>`
|
|
1117
|
+
* for `pipeTo`-style consumption.
|
|
1118
|
+
*/
|
|
1119
|
+
interface StreamSink<T> {
|
|
1120
|
+
/** Stable id used by clients to subscribe. */
|
|
1121
|
+
readonly id: string;
|
|
1122
|
+
/**
|
|
1123
|
+
* Aborts when the consumer cancels (server-side) or when the transport
|
|
1124
|
+
* loses every subscriber. Producers should poll `signal.aborted` and exit
|
|
1125
|
+
* cleanly.
|
|
1126
|
+
*/
|
|
1127
|
+
readonly signal: AbortSignal;
|
|
1128
|
+
/** `true` after `close()` / `error()`. Further writes throw. */
|
|
1129
|
+
readonly closed: boolean;
|
|
1130
|
+
/** Last allocated sequence number. `0` until the first write. */
|
|
1131
|
+
readonly lastSeq: number;
|
|
1132
|
+
write: (chunk: T) => void;
|
|
1133
|
+
error: (reason: unknown) => void;
|
|
1134
|
+
close: () => void;
|
|
1135
|
+
/** External-cancel path. Aborts the signal so handlers can short-circuit. */
|
|
1136
|
+
abort: (reason?: unknown) => void;
|
|
1137
|
+
/** `WritableStream<T>` adapter — same in-memory state as the imperative API. */
|
|
1138
|
+
readonly writable: WritableStream<T>;
|
|
1139
|
+
/**
|
|
1140
|
+
* Internal — RPC layer subscribes to receive chunk/end notifications.
|
|
1141
|
+
* Not part of the public contract; do not call directly.
|
|
1142
|
+
*
|
|
1143
|
+
* @internal
|
|
1144
|
+
*/
|
|
1145
|
+
readonly events: EventEmitter<StreamSinkEvents<T>>;
|
|
1146
|
+
/**
|
|
1147
|
+
* Internal — replay buffer. RPC layer reads on (re)subscribe to feed
|
|
1148
|
+
* missed chunks before going live.
|
|
1149
|
+
*
|
|
1150
|
+
* @internal
|
|
1151
|
+
*/
|
|
1152
|
+
readonly buffer: ReadonlyArray<BufferedChunk<T>>;
|
|
1153
|
+
}
|
|
1154
|
+
interface CreateStreamReaderOptions {
|
|
1155
|
+
id?: string;
|
|
1156
|
+
/**
|
|
1157
|
+
* Maximum number of buffered chunks held client-side while the consumer
|
|
1158
|
+
* isn't draining. On overflow, the oldest chunk is dropped.
|
|
1159
|
+
*/
|
|
1160
|
+
highWaterMark?: number;
|
|
1161
|
+
/**
|
|
1162
|
+
* Called when the chunk queue overflows the high-water mark. The RPC
|
|
1163
|
+
* layer wires this to a coded warning; the primitive itself is
|
|
1164
|
+
* RPC-agnostic.
|
|
1165
|
+
*/
|
|
1166
|
+
onOverflow?: (dropped: number) => void;
|
|
1167
|
+
/** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */
|
|
1168
|
+
onCancel?: () => void;
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)
|
|
1172
|
+
* and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they
|
|
1173
|
+
* share a single internal queue, so concurrent draining will race.
|
|
1174
|
+
*/
|
|
1175
|
+
interface StreamReader<T> extends AsyncIterable<T> {
|
|
1176
|
+
readonly id: string;
|
|
1177
|
+
readonly cancelled: boolean;
|
|
1178
|
+
readonly done: boolean;
|
|
1179
|
+
/** Highest `seq` observed. Used for replay on reconnect. */
|
|
1180
|
+
readonly lastSeenSeq: number;
|
|
1181
|
+
/** `ReadableStream<T>` adapter for `pipeTo`-style consumption. */
|
|
1182
|
+
readonly readable: ReadableStream<T>;
|
|
1183
|
+
cancel: () => void;
|
|
1184
|
+
/** @internal */
|
|
1185
|
+
_push: (seq: number, chunk: T) => void;
|
|
1186
|
+
/** @internal */
|
|
1187
|
+
_end: (error?: StreamErrorPayload) => void;
|
|
1188
|
+
}
|
|
1189
|
+
/**
|
|
1190
|
+
* Build a server-side stream sink. RPC-agnostic — the RPC host wires
|
|
1191
|
+
* `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay
|
|
1192
|
+
* for late or reconnecting subscribers.
|
|
1193
|
+
*/
|
|
1194
|
+
declare function createStreamSink<T>(options?: CreateStreamSinkOptions): StreamSink<T>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Build a client-side stream reader. RPC-agnostic — the RPC host calls
|
|
1197
|
+
* `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the
|
|
1198
|
+
* terminal frame. Consumers iterate with `for await` or pipe `readable`.
|
|
1199
|
+
*/
|
|
1200
|
+
declare function createStreamReader<T>(options?: CreateStreamReaderOptions): StreamReader<T>;
|
|
1201
|
+
//#endregion
|
|
989
1202
|
//#region src/types/rpc.d.ts
|
|
990
1203
|
interface DevToolsNodeRpcSession {
|
|
991
1204
|
meta: DevToolsNodeRpcSessionMeta;
|
|
@@ -1019,6 +1232,13 @@ type RpcFunctionsHost = RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, De
|
|
|
1019
1232
|
* The shared state host
|
|
1020
1233
|
*/
|
|
1021
1234
|
sharedState: RpcSharedStateHost;
|
|
1235
|
+
/**
|
|
1236
|
+
* The streaming channel host. Provides per-channel `start()` /
|
|
1237
|
+
* `pipeFrom()` producers; clients consume via `rpc.streaming.subscribe()`.
|
|
1238
|
+
*
|
|
1239
|
+
* @see RpcStreamingHost
|
|
1240
|
+
*/
|
|
1241
|
+
streaming: RpcStreamingHost;
|
|
1022
1242
|
};
|
|
1023
1243
|
interface RpcSharedStateGetOptions<T> {
|
|
1024
1244
|
sharedState?: SharedState<T>;
|
|
@@ -1035,6 +1255,109 @@ interface RpcSharedStateHost {
|
|
|
1035
1255
|
*/
|
|
1036
1256
|
onKeyAdded: (fn: (key: string) => void) => () => void;
|
|
1037
1257
|
}
|
|
1258
|
+
/**
|
|
1259
|
+
* Options for `RpcStreamingHost.create()`.
|
|
1260
|
+
*/
|
|
1261
|
+
interface RpcStreamingChannelOptions {
|
|
1262
|
+
/**
|
|
1263
|
+
* Size of the per-stream ring buffer kept on the server for
|
|
1264
|
+
* replay-on-resubscribe. `0` (default) disables replay; on reconnect
|
|
1265
|
+
* the consumer only sees chunks that arrive after subscribing.
|
|
1266
|
+
*
|
|
1267
|
+
* The buffer is per stream id, not per channel — each `channel.start()`
|
|
1268
|
+
* gets its own.
|
|
1269
|
+
*/
|
|
1270
|
+
replayWindow?: number;
|
|
1271
|
+
/**
|
|
1272
|
+
* Milliseconds a closed stream is retained on the server after its
|
|
1273
|
+
* last subscriber leaves (or if no subscriber ever arrived). During
|
|
1274
|
+
* this window, late subscribers can still join and replay the buffer
|
|
1275
|
+
* + receive the `end` frame.
|
|
1276
|
+
*
|
|
1277
|
+
* Defaults to `30_000` (30 s) when `replayWindow > 0`, else `0`
|
|
1278
|
+
* (immediate free). Set to `0` to opt out, or higher for longer
|
|
1279
|
+
* post-mortem replay.
|
|
1280
|
+
*/
|
|
1281
|
+
closedStreamRetention?: number;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* Channel handle returned by `ctx.rpc.streaming.create(name, opts)`. A
|
|
1285
|
+
* channel owns a wire namespace; calling `start()` produces individual
|
|
1286
|
+
* streams keyed by id.
|
|
1287
|
+
*
|
|
1288
|
+
* @see {@link https://devfra.me/guide/streaming Streaming guide}
|
|
1289
|
+
*/
|
|
1290
|
+
interface RpcStreamingChannel<T = unknown> {
|
|
1291
|
+
/** Channel name as registered with `ctx.rpc.streaming.create()`. */
|
|
1292
|
+
readonly name: string;
|
|
1293
|
+
/**
|
|
1294
|
+
* Start a new stream. Returns a server-side sink with both an imperative
|
|
1295
|
+
* (`write` / `close` / `error`) surface and a `WritableStream<T>` for
|
|
1296
|
+
* `pipeTo` consumption. The sink's `signal` aborts when every subscriber
|
|
1297
|
+
* disconnects or cancels.
|
|
1298
|
+
*/
|
|
1299
|
+
start: (opts?: {
|
|
1300
|
+
id?: string;
|
|
1301
|
+
}) => StreamSink<T>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Convenience: start a stream and pipe a `ReadableStream<T>` into it.
|
|
1304
|
+
* The pipe uses `sink.signal` so cancellation propagates upstream.
|
|
1305
|
+
*
|
|
1306
|
+
* Node-stream interop: convert a `Readable` with `Readable.toWeb(node)`
|
|
1307
|
+
* before passing it here.
|
|
1308
|
+
*/
|
|
1309
|
+
pipeFrom: (readable: ReadableStream<T>, opts?: {
|
|
1310
|
+
id?: string;
|
|
1311
|
+
}) => Promise<StreamSink<T>>;
|
|
1312
|
+
/** Look up an active stream by id. Returns `undefined` if none. */
|
|
1313
|
+
get: (id: string) => StreamSink<T> | undefined;
|
|
1314
|
+
/** All active outbound stream ids on this channel. */
|
|
1315
|
+
ids: () => string[];
|
|
1316
|
+
/**
|
|
1317
|
+
* Open an inbound stream — the server side of a client-to-server
|
|
1318
|
+
* upload. Allocates an id, returns a `StreamReader<T>` that fills as
|
|
1319
|
+
* the client writes chunks. Typical pattern is to call this from an
|
|
1320
|
+
* action handler, kick off background processing, and return the id
|
|
1321
|
+
* so the caller can start uploading:
|
|
1322
|
+
*
|
|
1323
|
+
* ```ts
|
|
1324
|
+
* handler: async () => {
|
|
1325
|
+
* const reader = channel.openInbound()
|
|
1326
|
+
* ;(async () => {
|
|
1327
|
+
* for await (const chunk of reader) processChunk(chunk)
|
|
1328
|
+
* })()
|
|
1329
|
+
* return { uploadId: reader.id }
|
|
1330
|
+
* }
|
|
1331
|
+
* ```
|
|
1332
|
+
*
|
|
1333
|
+
* Calling `reader.cancel()` on the server sends an `upload-cancel` to
|
|
1334
|
+
* the uploading client, which aborts its sink.
|
|
1335
|
+
*/
|
|
1336
|
+
openInbound: (opts?: {
|
|
1337
|
+
id?: string;
|
|
1338
|
+
}) => StreamReader<T>;
|
|
1339
|
+
}
|
|
1340
|
+
/**
|
|
1341
|
+
* Server-side streaming host. Lives on `ctx.rpc.streaming` alongside
|
|
1342
|
+
* `ctx.rpc.sharedState`. Each named channel owns its own stream registry
|
|
1343
|
+
* and wire namespace.
|
|
1344
|
+
*/
|
|
1345
|
+
interface RpcStreamingHost {
|
|
1346
|
+
/**
|
|
1347
|
+
* Register a streaming channel. Names follow the `<plugin-id>:<channel>`
|
|
1348
|
+
* convention (e.g. `'my-devtool:chat-stream'`). Throws `DF0032` if the
|
|
1349
|
+
* name is already taken.
|
|
1350
|
+
*/
|
|
1351
|
+
create: <T = unknown>(name: string, opts?: RpcStreamingChannelOptions) => RpcStreamingChannel<T>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Adapters call this when a session disconnects so the host can drop
|
|
1354
|
+
* subscribers and abort orphaned streams. Most users do not need this;
|
|
1355
|
+
* it's wired by `startHttpAndWs` automatically.
|
|
1356
|
+
*
|
|
1357
|
+
* @internal
|
|
1358
|
+
*/
|
|
1359
|
+
_onSessionDisconnected: (meta: DevToolsNodeRpcSessionMeta) => void;
|
|
1360
|
+
}
|
|
1038
1361
|
//#endregion
|
|
1039
1362
|
//#region src/types/context.d.ts
|
|
1040
1363
|
interface DevToolsCapabilities {
|
|
@@ -1044,9 +1367,24 @@ interface DevToolsCapabilities {
|
|
|
1044
1367
|
interface DevToolsNodeContext {
|
|
1045
1368
|
readonly workspaceRoot: string;
|
|
1046
1369
|
readonly cwd: string;
|
|
1370
|
+
/**
|
|
1371
|
+
* Lifecycle distinction surfaced to plugin authors:
|
|
1372
|
+
*
|
|
1373
|
+
* - `'dev'` — long-running, interactive session. Connections come and
|
|
1374
|
+
* go; broadcasts and shared-state mutations are debounced
|
|
1375
|
+
* to keep the UI responsive.
|
|
1376
|
+
* - `'build'` — one-shot batch run. The context is set up, the devtool
|
|
1377
|
+
* collects what it needs, and a snapshot is written. No
|
|
1378
|
+
* live UI, no WS server.
|
|
1379
|
+
*
|
|
1380
|
+
* Names are inherited from Vite's serve/build dichotomy but the meaning
|
|
1381
|
+
* is general: the same distinction applies to any tool that runs in
|
|
1382
|
+
* either an interactive or a static-output mode.
|
|
1383
|
+
*/
|
|
1047
1384
|
readonly mode: 'dev' | 'build';
|
|
1048
1385
|
/**
|
|
1049
|
-
* Host runtime abstraction — exposes `mountStatic` / `resolveOrigin
|
|
1386
|
+
* Host runtime abstraction — exposes `mountStatic` / `resolveOrigin` /
|
|
1387
|
+
* `getStorageDir`.
|
|
1050
1388
|
*/
|
|
1051
1389
|
host: DevToolsHost;
|
|
1052
1390
|
rpc: RpcFunctionsHost;
|
|
@@ -1235,4 +1573,4 @@ interface DevtoolDefinition {
|
|
|
1235
1573
|
}
|
|
1236
1574
|
declare function defineDevtool(d: DevtoolDefinition): DevtoolDefinition;
|
|
1237
1575
|
//#endregion
|
|
1238
|
-
export {
|
|
1576
|
+
export { DevToolsRpcServerFunctions as $, AgentManifest as $t, createStreamSink as A, DevToolsViewCustomRender as At, createSharedState as B, DevToolsDiagnosticsHost as Bt, CreateStreamReaderOptions as C, DevToolsDockEntryBase as Ct, StreamSink as D, DevToolsDockUserEntry as Dt, StreamReader as E, DevToolsDockHost as Et, ImmutableSet as F, JsonRenderElement as Ft, DevToolsChildProcessExecuteOptions as G, DevToolsCommandHandle as Gt, EntriesToObject as H, DevToolsClientCommand as Ht, SharedState as I, JsonRenderSpec as It, DevToolsTerminalSession as J, DevToolsCommandsHost as Jt, DevToolsChildProcessTerminalSession as K, DevToolsCommandKeybinding as Kt, SharedStateEvents as L, JsonRenderer as Lt, ImmutableArray as M, DevToolsViewJsonRender as Mt, ImmutableMap as N, DevToolsViewLauncher as Nt, StreamSinkEvents as O, DevToolsViewAction as Ot, ImmutableObject as P, DevToolsViewLauncherStatus as Pt, DevToolsRpcClientFunctions as Q, AgentHandle as Qt, SharedStateOptions as R, RemoteDockOptions as Rt, BufferedChunk as S, DevToolsDockEntry as St, StreamErrorPayload as T, DevToolsDockEntryIcon as Tt, PartialWithoutId as U, DevToolsCommandBase as Ut, DevToolsViewHost as V, DevToolsDiagnosticsLogger as Vt, Thenable as W, DevToolsCommandEntry as Wt, DevToolsTerminalStatus as X, DevToolsServerCommandEntry as Xt, DevToolsTerminalSessionBase as Y, DevToolsCommandsHostEvents as Yt, DevToolsDocksUserSettings as Z, DevToolsServerCommandInput as Zt, RpcSharedStateGetOptions as _, DevToolsMessagesClient as _t, DevtoolRuntime as a, DevToolsAgentHost as an, DevToolsLogFilePosition as at, RpcStreamingChannelOptions as b, ClientScriptEntry as bt, defineDevtool as c, EventUnsubscribe as cn, DevToolsLogsClient as ct, DevToolsNodeContext as d, InferCliFlags as dn, DevToolsMessageEntry as dt, AgentResource as en, DevToolsRpcSharedStates as et, DevToolsNodeUtils as f, defineCliFlags as fn, DevToolsMessageEntryFrom as ft, RpcFunctionsHost as g, DevToolsMessageLevel as gt, RpcBroadcastOptions as h, DevToolsMessageHandle as ht, DevtoolDeploymentKind as i, AgentToolInput as in, DevToolsLogEntryInput as it, Immutable as j, DevToolsViewIframe as jt, createStreamReader as k, DevToolsViewBuiltin as kt, ConnectionMeta as l, EventsMap as ln, DevToolsLogsHost as lt, DevToolsNodeRpcSession as m, DevToolsMessageFilePosition as mt, DevtoolCliOptions as n, AgentResourceInput as nn, DevToolsLogEntry as nt, DevtoolSetupInfo as o, DevToolsAgentHostEvents as on, DevToolsLogHandle as ot, RemoteConnectionInfo as p, parseCliFlags as pn, DevToolsMessageEntryInput as pt, DevToolsTerminalHost as q, DevToolsCommandShortcutOverrides as qt, DevtoolDefinition as r, AgentTool as rn, DevToolsLogEntryFrom as rt, DevtoolSpaOptions as s, EventEmitter as sn, DevToolsLogLevel as st, DevtoolBrowserContext as t, AgentResourceContent as tn, DevToolsLogElementPosition as tt, DevToolsCapabilities as u, CliFlagsSchema as un, DevToolsMessageElementPosition as ut, RpcSharedStateHost as v, DevToolsMessagesHost as vt, CreateStreamSinkOptions as w, DevToolsDockEntryCategory as wt, RpcStreamingHost as x, DevToolsDockEntriesGrouped as xt, RpcStreamingChannel as y, DevToolsHost as yt, SharedStatePatch as z, DevToolsDiagnosticsDefinition as zt };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { join } from "pathe";
|
|
2
|
+
import process from "node:process";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
//#region src/node/host-h3.ts
|
|
5
|
+
/**
|
|
6
|
+
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
7
|
+
*/
|
|
8
|
+
function createH3DevToolsHost(options) {
|
|
9
|
+
const workspaceRoot = options.workspaceRoot ?? process.cwd();
|
|
10
|
+
return {
|
|
11
|
+
mountStatic(base, distDir) {
|
|
12
|
+
return options.mount?.(base, distDir);
|
|
13
|
+
},
|
|
14
|
+
resolveOrigin() {
|
|
15
|
+
return options.origin;
|
|
16
|
+
},
|
|
17
|
+
getStorageDir(scope) {
|
|
18
|
+
const namespace = `.${options.appName}/devtools`;
|
|
19
|
+
return scope === "workspace" ? join(workspaceRoot, "node_modules", namespace) : join(homedir(), namespace);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createH3DevToolsHost as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RpcReturnSchema, S as RpcFunctionsCollector, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, x as RpcFunctionType } from "./types-
|
|
1
|
+
import { C as RpcReturnSchema, S as RpcFunctionsCollector, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, x as RpcFunctionType } from "./types-ag029cAe.mjs";
|
|
2
2
|
import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
|
|
3
3
|
|
|
4
4
|
//#region src/rpc/cache.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { C as RpcReturnSchema, h as RpcFunctionDefinition, i as RpcArgsSchema, m as RpcFunctionAgentOptions, x as RpcFunctionType } from "./types-
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { $ as DevToolsRpcServerFunctions, $t as AgentManifest, At as DevToolsViewCustomRender, Bt as DevToolsDiagnosticsHost, Ct as DevToolsDockEntryBase, Dt as DevToolsDockUserEntry, Et as DevToolsDockHost, Ft as JsonRenderElement, G as DevToolsChildProcessExecuteOptions, Gt as DevToolsCommandHandle, H as EntriesToObject, Ht as DevToolsClientCommand, It as JsonRenderSpec, J as DevToolsTerminalSession, Jt as DevToolsCommandsHost, K as DevToolsChildProcessTerminalSession, Kt as DevToolsCommandKeybinding, Lt as JsonRenderer, Mt as DevToolsViewJsonRender, Nt as DevToolsViewLauncher, Ot as DevToolsViewAction, Pt as DevToolsViewLauncherStatus, Q as DevToolsRpcClientFunctions, Qt as AgentHandle, Rt as RemoteDockOptions, St as DevToolsDockEntry, Tt as DevToolsDockEntryIcon, U as PartialWithoutId, Ut as DevToolsCommandBase, V as DevToolsViewHost, Vt as DevToolsDiagnosticsLogger, W as Thenable, Wt as DevToolsCommandEntry, X as DevToolsTerminalStatus, Xt as DevToolsServerCommandEntry, Y as DevToolsTerminalSessionBase, Yt as DevToolsCommandsHostEvents, Z as DevToolsDocksUserSettings, Zt as DevToolsServerCommandInput, _ as RpcSharedStateGetOptions, _t as DevToolsMessagesClient, a as DevtoolRuntime, an as DevToolsAgentHost, at as DevToolsLogFilePosition, b as RpcStreamingChannelOptions, bt as ClientScriptEntry, c as defineDevtool, cn as EventUnsubscribe, ct as DevToolsLogsClient, d as DevToolsNodeContext, dt as DevToolsMessageEntry, en as AgentResource, et as DevToolsRpcSharedStates, f as DevToolsNodeUtils, ft as DevToolsMessageEntryFrom, g as RpcFunctionsHost, gt as DevToolsMessageLevel, h as RpcBroadcastOptions, ht as DevToolsMessageHandle, i as DevtoolDeploymentKind, in as AgentToolInput, it as DevToolsLogEntryInput, jt as DevToolsViewIframe, kt as DevToolsViewBuiltin, l as ConnectionMeta, ln as EventsMap, lt as DevToolsLogsHost, m as DevToolsNodeRpcSession, mt as DevToolsMessageFilePosition, n as DevtoolCliOptions, nn as AgentResourceInput, nt as DevToolsLogEntry, o as DevtoolSetupInfo, on as DevToolsAgentHostEvents, ot as DevToolsLogHandle, p as RemoteConnectionInfo, pt as DevToolsMessageEntryInput, q as DevToolsTerminalHost, qt as DevToolsCommandShortcutOverrides, r as DevtoolDefinition, rn as AgentTool, rt as DevToolsLogEntryFrom, s as DevtoolSpaOptions, sn as EventEmitter, st as DevToolsLogLevel, t as DevtoolBrowserContext, tn as AgentResourceContent, tt as DevToolsLogElementPosition, u as DevToolsCapabilities, ut as DevToolsMessageElementPosition, v as RpcSharedStateHost, vt as DevToolsMessagesHost, wt as DevToolsDockEntryCategory, x as RpcStreamingHost, xt as DevToolsDockEntriesGrouped, y as RpcStreamingChannel, yt as DevToolsHost, zt as DevToolsDiagnosticsDefinition } from "./devtool-Bm6zZAw5.mjs";
|
|
2
|
+
import { C as RpcReturnSchema, h as RpcFunctionDefinition, i as RpcArgsSchema, m as RpcFunctionAgentOptions, x as RpcFunctionType } from "./types-ag029cAe.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-VQqESKAs.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>;
|
|
7
7
|
declare function defineCommand(command: DevToolsServerCommandInput): DevToolsServerCommandInput;
|
|
8
8
|
declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ClientScriptEntry, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsChildProcessExecuteOptions, DevToolsChildProcessTerminalSession, DevToolsClientCommand, DevToolsCommandBase, DevToolsCommandEntry, DevToolsCommandHandle, DevToolsCommandKeybinding, DevToolsCommandShortcutOverrides, DevToolsCommandsHost, DevToolsCommandsHostEvents, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsDockEntriesGrouped, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockEntryCategory, DevToolsDockEntryIcon, DevToolsDockHost, DevToolsDockUserEntry, DevToolsDocksUserSettings, DevToolsHost, DevToolsLogElementPosition, DevToolsLogEntry, DevToolsLogEntryFrom, DevToolsLogEntryInput, DevToolsLogFilePosition, DevToolsLogHandle, DevToolsLogLevel, DevToolsLogsClient, DevToolsLogsHost, DevToolsMessageElementPosition, DevToolsMessageEntry, DevToolsMessageEntryFrom, DevToolsMessageEntryInput, DevToolsMessageFilePosition, DevToolsMessageHandle, DevToolsMessageLevel, DevToolsMessagesClient, DevToolsMessagesHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsNodeUtils, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsServerCommandEntry, DevToolsServerCommandInput, DevToolsTerminalHost, DevToolsTerminalSession, DevToolsTerminalSessionBase,
|
|
10
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ClientScriptEntry, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsChildProcessExecuteOptions, DevToolsChildProcessTerminalSession, DevToolsClientCommand, DevToolsCommandBase, DevToolsCommandEntry, DevToolsCommandHandle, DevToolsCommandKeybinding, DevToolsCommandShortcutOverrides, DevToolsCommandsHost, DevToolsCommandsHostEvents, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsDockEntriesGrouped, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockEntryCategory, DevToolsDockEntryIcon, DevToolsDockHost, DevToolsDockUserEntry, DevToolsDocksUserSettings, DevToolsHost, DevToolsLogElementPosition, DevToolsLogEntry, DevToolsLogEntryFrom, DevToolsLogEntryInput, DevToolsLogFilePosition, DevToolsLogHandle, DevToolsLogLevel, DevToolsLogsClient, DevToolsLogsHost, DevToolsMessageElementPosition, DevToolsMessageEntry, DevToolsMessageEntryFrom, DevToolsMessageEntryInput, DevToolsMessageFilePosition, DevToolsMessageHandle, DevToolsMessageLevel, DevToolsMessagesClient, DevToolsMessagesHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsNodeUtils, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsServerCommandEntry, DevToolsServerCommandInput, DevToolsTerminalHost, DevToolsTerminalSession, DevToolsTerminalSessionBase, DevToolsTerminalStatus, DevToolsViewAction, DevToolsViewBuiltin, DevToolsViewCustomRender, DevToolsViewHost, DevToolsViewIframe, DevToolsViewJsonRender, DevToolsViewLauncher, DevToolsViewLauncherStatus, DevtoolBrowserContext, DevtoolCliOptions, DevtoolDefinition, DevtoolDeploymentKind, DevtoolRuntime, DevtoolSetupInfo, DevtoolSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineCommand, defineDevtool, defineJsonRenderSpec, defineRpcFunction };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as RpcFunctionsCollectorBase } from "../index-
|
|
3
|
-
import { g as RpcFunctionDefinitionAny } from "../types-
|
|
4
|
-
import {
|
|
1
|
+
import { $ as DevToolsRpcServerFunctions, $t as AgentManifest, Bt as DevToolsDiagnosticsHost$1, Dt as DevToolsDockUserEntry, Et as DevToolsDockHost$1, G as DevToolsChildProcessExecuteOptions, Gt as DevToolsCommandHandle, I as SharedState, J as DevToolsTerminalSession, Jt as DevToolsCommandsHost$1, K as DevToolsChildProcessTerminalSession, Q as DevToolsRpcClientFunctions, Qt as AgentHandle, St as DevToolsDockEntry, U as PartialWithoutId, V as DevToolsViewHost$1, Vt as DevToolsDiagnosticsLogger, Xt as DevToolsServerCommandEntry, Y as DevToolsTerminalSessionBase, Z as DevToolsDocksUserSettings, Zt as DevToolsServerCommandInput, an as DevToolsAgentHost$1, bt as ClientScriptEntry, d as DevToolsNodeContext, dt as DevToolsMessageEntry, en as AgentResource, g as RpcFunctionsHost$1, h as RpcBroadcastOptions, ht as DevToolsMessageHandle, in as AgentToolInput, m as DevToolsNodeRpcSession, nn as AgentResourceInput, on as DevToolsAgentHostEvents, pt as DevToolsMessageEntryInput, q as DevToolsTerminalHost$1, rn as AgentTool, sn as EventEmitter, tn as AgentResourceContent, v as RpcSharedStateHost, vt as DevToolsMessagesHost$1, x as RpcStreamingHost, yt as DevToolsHost } from "../devtool-Bm6zZAw5.mjs";
|
|
2
|
+
import { g as RpcFunctionsCollectorBase } from "../index-BCo03GEF.mjs";
|
|
3
|
+
import { g as RpcFunctionDefinitionAny } from "../types-ag029cAe.mjs";
|
|
4
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-VQqESKAs.mjs";
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-DksyT-um.mjs";
|
|
5
6
|
import { createLogger, defineDiagnostics } from "logs-sdk";
|
|
6
7
|
import { BirpcGroup } from "birpc";
|
|
7
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -215,6 +216,15 @@ declare class RpcFunctionsHost extends RpcFunctionsCollectorBase<DevToolsRpcServ
|
|
|
215
216
|
_asyncStorage: AsyncLocalStorage<DevToolsNodeRpcSession>;
|
|
216
217
|
constructor(context: DevToolsNodeContext);
|
|
217
218
|
sharedState: RpcSharedStateHost;
|
|
219
|
+
streaming: RpcStreamingHost;
|
|
220
|
+
/**
|
|
221
|
+
* Adapters call this from their WS `onDisconnected` hook so downstream
|
|
222
|
+
* hosts (streaming, …) can free per-session state. Public-ish because
|
|
223
|
+
* tests / custom adapters may want to mirror it.
|
|
224
|
+
*
|
|
225
|
+
* @internal
|
|
226
|
+
*/
|
|
227
|
+
_emitSessionDisconnected(meta: DevToolsNodeRpcSessionMeta): void;
|
|
218
228
|
invokeLocal<T extends keyof DevToolsRpcServerFunctions, Args extends Parameters<DevToolsRpcServerFunctions[T]>>(method: T, ...args: Args): Promise<Awaited<ReturnType<DevToolsRpcServerFunctions[T]>>>;
|
|
219
229
|
broadcast<T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>): Promise<void>;
|
|
220
230
|
getCurrentRpcSession(): DevToolsNodeRpcSession | undefined;
|
|
@@ -235,11 +245,22 @@ interface CreateH3DevToolsHostOptions {
|
|
|
235
245
|
* the CLI isn't running, so the default is a no-op.
|
|
236
246
|
*/
|
|
237
247
|
mount?: (base: string, distDir: string) => void | Promise<void>;
|
|
248
|
+
/**
|
|
249
|
+
* Namespace for storage paths returned by `getStorageDir`. Workspace
|
|
250
|
+
* state lives under `${workspaceRoot}/node_modules/.<appName>/devtools/`
|
|
251
|
+
* and global state under `${homedir()}/.<appName>/devtools/`. Pick the
|
|
252
|
+
* devtool's id (or another stable, filesystem-safe identifier) so the
|
|
253
|
+
* standalone host doesn't collide with other tools' storage.
|
|
254
|
+
*/
|
|
255
|
+
appName: string;
|
|
256
|
+
/**
|
|
257
|
+
* Workspace root used as the parent of the per-project storage
|
|
258
|
+
* directory. Defaults to `process.cwd()`.
|
|
259
|
+
*/
|
|
260
|
+
workspaceRoot?: string;
|
|
238
261
|
}
|
|
239
262
|
/**
|
|
240
263
|
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
241
|
-
* This commit adds the shell; the CLI adapter in commit 5 wires it up
|
|
242
|
-
* with a real h3 app and sirv handler.
|
|
243
264
|
*/
|
|
244
265
|
declare function createH3DevToolsHost(options: CreateH3DevToolsHostOptions): DevToolsHost;
|
|
245
266
|
//#endregion
|
|
@@ -272,7 +293,14 @@ declare class DevToolsTerminalHost implements DevToolsTerminalHost$1 {
|
|
|
272
293
|
readonly sessions: DevToolsTerminalHost$1['sessions'];
|
|
273
294
|
readonly events: DevToolsTerminalHost$1['events'];
|
|
274
295
|
private _boundStreams;
|
|
296
|
+
private _channel?;
|
|
275
297
|
constructor(context: DevToolsNodeContext);
|
|
298
|
+
/**
|
|
299
|
+
* Lazily acquire the streaming channel — `context.rpc` isn't assigned
|
|
300
|
+
* until after every host is constructed, so we can't grab it in the
|
|
301
|
+
* constructor.
|
|
302
|
+
*/
|
|
303
|
+
private getStreamingChannel;
|
|
276
304
|
register(session: DevToolsTerminalSession): DevToolsTerminalSession;
|
|
277
305
|
update(patch: PartialWithoutId<DevToolsTerminalSession>): void;
|
|
278
306
|
remove(session: DevToolsTerminalSession): void;
|
|
@@ -297,6 +325,15 @@ declare class DevToolsViewHost implements DevToolsViewHost$1 {
|
|
|
297
325
|
//#region src/node/rpc-shared-state.d.ts
|
|
298
326
|
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSharedStateHost;
|
|
299
327
|
//#endregion
|
|
328
|
+
//#region src/node/rpc-streaming.d.ts
|
|
329
|
+
/**
|
|
330
|
+
* Build the server-side streaming host. Mirrors the layout of
|
|
331
|
+
* `createRpcSharedStateServerHost` — registers a fixed set of internal
|
|
332
|
+
* RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
|
|
333
|
+
* state lives in a `Map<channelName, ChannelState>`.
|
|
334
|
+
*/
|
|
335
|
+
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost$1): RpcStreamingHost;
|
|
336
|
+
//#endregion
|
|
300
337
|
//#region src/node/static-dump.d.ts
|
|
301
338
|
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
302
339
|
interface StaticRpcDumpManifestStaticEntry {
|
|
@@ -341,4 +378,4 @@ declare function createStorage<T extends object>(options: CreateStorageOptions<T
|
|
|
341
378
|
declare function isObject(value: unknown): value is Record<string, any>;
|
|
342
379
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
343
380
|
//#endregion
|
|
344
|
-
export { ContextUtils, CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsCommandsHost, DevToolsDiagnosticsHost, DevToolsDockHost, DevToolsInternalContext, DevToolsMessagesHost, DevToolsTerminalHost, DevToolsViewHost, InternalAnonymousAuthStorage, PendingAuthRequest, RemoteTokenRecord, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
|
|
381
|
+
export { ContextUtils, CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsCommandsHost, DevToolsDiagnosticsHost, DevToolsDockHost, DevToolsInternalContext, DevToolsMessagesHost, DevToolsTerminalHost, DevToolsViewHost, InternalAnonymousAuthStorage, PendingAuthRequest, RemoteTokenRecord, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
|