devframe 0.9.11 → 0.9.13

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.
Files changed (55) hide show
  1. package/dist/adapters/build.d.mts +4 -5
  2. package/dist/adapters/build.mjs +2 -2
  3. package/dist/adapters/cac.d.mts +4 -4
  4. package/dist/adapters/cac.mjs +1 -1
  5. package/dist/adapters/dev.d.mts +4 -4
  6. package/dist/adapters/dev.mjs +1 -1
  7. package/dist/adapters/embedded.d.mts +3 -4
  8. package/dist/adapters/initiate.d.mts +7 -8
  9. package/dist/adapters/initiate.mjs +1 -1
  10. package/dist/adapters/mcp.d.mts +4 -4
  11. package/dist/adapters/mcp.mjs +9 -15
  12. package/dist/cli/main.d.mts +2 -3
  13. package/dist/client/index.d.mts +133 -35
  14. package/dist/client/index.mjs +231 -57
  15. package/dist/constants.d.mts +20 -21
  16. package/dist/{context-Bq27SDK-.mjs → context-Cdj9z9m2.mjs} +39 -21
  17. package/dist/{dev-B32EVw5w.mjs → dev-SPZzBTrH.mjs} +2 -2
  18. package/dist/in-page-channel/index.d.mts +75 -37
  19. package/dist/in-page-channel/index.mjs +56 -22
  20. package/dist/index.d.mts +4 -4
  21. package/dist/{instance-shell-BWh0JQuo.d.mts → instance-shell-BUyYrKlu.d.mts} +9 -2
  22. package/dist/{instance-shell-DvYCwrDy.mjs → instance-shell-xuu6jg51.mjs} +7 -2
  23. package/dist/internal/index.d.mts +12 -12
  24. package/dist/internal/index.mjs +1 -1
  25. package/dist/node/index.d.mts +5 -5
  26. package/dist/node/index.mjs +1 -1
  27. package/dist/nostics-DD6gsDZA.mjs +108 -0
  28. package/dist/recipes/common-rpc-functions.d.mts +6 -7
  29. package/dist/recipes/interactive-auth.d.mts +36 -11
  30. package/dist/recipes/interactive-auth.mjs +47 -4
  31. package/dist/rpc/client.d.mts +2 -3
  32. package/dist/rpc/dump.d.mts +16 -17
  33. package/dist/rpc/dump.mjs +1 -1
  34. package/dist/rpc/server.d.mts +2 -3
  35. package/dist/rpc/transports/sse-server.d.mts +4 -5
  36. package/dist/rpc/transports/ws-bun.d.mts +5 -6
  37. package/dist/rpc/transports/ws-deno.d.mts +4 -5
  38. package/dist/{shared-state-CaxB1q0h.mjs → shared-state-eQVYHNqA.mjs} +4 -1
  39. package/dist/utils/agent-tool-name.d.mts +2 -3
  40. package/dist/utils/colors.d.mts +4 -5
  41. package/dist/utils/crypto-token.d.mts +4 -5
  42. package/dist/utils/events.d.mts +2 -3
  43. package/dist/utils/hash.d.mts +2 -3
  44. package/dist/utils/launch-editor.d.mts +2 -3
  45. package/dist/utils/nanoid.d.mts +2 -3
  46. package/dist/utils/open.d.mts +2 -3
  47. package/dist/utils/remote-assets.d.mts +2 -3
  48. package/dist/utils/serve-static.d.mts +6 -7
  49. package/dist/utils/shared-state.mjs +1 -1
  50. package/dist/utils/simple-schema.d.mts +17 -18
  51. package/dist/utils/streaming-channel.mjs +4 -1
  52. package/dist/utils/structured-clone.d.mts +5 -6
  53. package/dist/utils/when.d.mts +6 -7
  54. package/dist/{write-BuLCrn9h.mjs → write-D2AJqVT8.mjs} +1 -1
  55. package/package.json +4 -4
@@ -6,8 +6,8 @@ import { EventHandler, H3 } from "h3";
6
6
  * What the static-serving engine accepts: a local directory, or a resolved
7
7
  * {@link RemoteAssetsStore} back-proxy (from `devframe/utils/remote-assets`).
8
8
  */
9
- type ServableAssets = string | RemoteAssetsStore;
10
- interface ServeStaticOptions {
9
+ export type ServableAssets = string | RemoteAssetsStore;
10
+ export interface ServeStaticOptions {
11
11
  /** Default: `['index.html']`. */
12
12
  indexNames?: string[];
13
13
  /** SPA fallback to `indexNames[0]` on miss. Default: `true`. */
@@ -24,7 +24,7 @@ interface ServeStaticOptions {
24
24
  * file extension falls back to `<dir>/index.html` so client-side routing
25
25
  * works.
26
26
  */
27
- declare function serveStaticHandler(source: ServableAssets, options?: ServeStaticOptions): EventHandler;
27
+ export declare function serveStaticHandler(source: ServableAssets, options?: ServeStaticOptions): EventHandler;
28
28
  /**
29
29
  * Mount {@link serveStaticHandler} on an h3 app at `base`.
30
30
  *
@@ -32,7 +32,7 @@ declare function serveStaticHandler(source: ServableAssets, options?: ServeStati
32
32
  * from `event.url.pathname`, so the file resolver sees paths relative to
33
33
  * `dir`.
34
34
  */
35
- declare function mountStaticHandler(app: H3, base: string, source: ServableAssets, options?: ServeStaticOptions): void;
35
+ export declare function mountStaticHandler(app: H3, base: string, source: ServableAssets, options?: ServeStaticOptions): void;
36
36
  /**
37
37
  * Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
38
38
  *
@@ -40,6 +40,5 @@ declare function mountStaticHandler(app: H3, base: string, source: ServableAsset
40
40
  * Connect stack; avoids forcing the host package to depend on h3 just to
41
41
  * adapt an event handler back into Node middleware.
42
42
  */
43
- declare function serveStaticNodeMiddleware(source: ServableAssets, options?: ServeStaticOptions): (req: IncomingMessage, res: ServerResponse, next?: (err?: Error) => void) => void;
44
- //#endregion
45
- export { ServableAssets, ServeStaticOptions, mountStaticHandler, serveStaticHandler, serveStaticNodeMiddleware };
43
+ export declare function serveStaticNodeMiddleware(source: ServableAssets, options?: ServeStaticOptions): (req: IncomingMessage, res: ServerResponse, next?: (err?: Error) => void) => void;
44
+ //#endregion
@@ -1,2 +1,2 @@
1
- import { t as createSharedState } from "../shared-state-CaxB1q0h.mjs";
1
+ import { t as createSharedState } from "../shared-state-eQVYHNqA.mjs";
2
2
  export { createSharedState };
@@ -32,7 +32,7 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
32
32
  * standard `~standard` prop so the CLI-flags adapter can introspect the
33
33
  * schema kind without importing any validator.
34
34
  */
35
- interface SimpleSchema<Input, Output = Input> extends StandardSchemaV1<Input, Output> {
35
+ export interface SimpleSchema<Input, Output = Input> extends StandardSchemaV1<Input, Output> {
36
36
  /** Schema kind marker, e.g. `'string'`, `'boolean'`, `'optional'`. */
37
37
  readonly type: string;
38
38
  /** Inner schema for wrapper kinds (`optional` / `nullable`). */
@@ -41,25 +41,25 @@ interface SimpleSchema<Input, Output = Input> extends StandardSchemaV1<Input, Ou
41
41
  readonly description?: string;
42
42
  }
43
43
  /** Any string. */
44
- declare function string(): SimpleSchema<string>;
44
+ export declare function string(): SimpleSchema<string>;
45
45
  /** A finite number (rejects `NaN`). */
46
- declare function number(): SimpleSchema<number>;
46
+ export declare function number(): SimpleSchema<number>;
47
47
  /** A boolean. */
48
- declare function boolean(): SimpleSchema<boolean>;
48
+ export declare function boolean(): SimpleSchema<boolean>;
49
49
  /** `undefined`, mirroring valibot's `void`. */
50
- declare function voidType(): SimpleSchema<void>;
50
+ export declare function voidType(): SimpleSchema<void>;
51
51
  /** `null`. */
52
- declare function nullType(): SimpleSchema<null>;
52
+ export declare function nullType(): SimpleSchema<null>;
53
53
  /** One of a fixed set of literal values. */
54
- declare function picklist<const T extends readonly (string | number | boolean)[]>(values: T): SimpleSchema<T[number]>;
54
+ export declare function picklist<const T extends readonly (string | number | boolean)[]>(values: T): SimpleSchema<T[number]>;
55
55
  /** A single literal value (string / number / boolean). */
56
- declare function literal<const T extends string | number | boolean>(value: T): SimpleSchema<T>;
56
+ export declare function literal<const T extends string | number | boolean>(value: T): SimpleSchema<T>;
57
57
  /** A value matching any one of the given schemas. */
58
- declare function union<const T extends readonly StandardSchemaV1[]>(options: T): SimpleSchema<StandardSchemaV1.InferInput<T[number]>, StandardSchemaV1.InferOutput<T[number]>>;
58
+ export declare function union<const T extends readonly StandardSchemaV1[]>(options: T): SimpleSchema<StandardSchemaV1.InferInput<T[number]>, StandardSchemaV1.InferOutput<T[number]>>;
59
59
  /** A record with string keys whose values each satisfy the value schema. */
60
- declare function record<V extends StandardSchemaV1>(_key: StandardSchemaV1, value: V): SimpleSchema<Record<string, StandardSchemaV1.InferInput<V>>, Record<string, StandardSchemaV1.InferOutput<V>>>;
60
+ export declare function record<V extends StandardSchemaV1>(_key: StandardSchemaV1, value: V): SimpleSchema<Record<string, StandardSchemaV1.InferInput<V>>, Record<string, StandardSchemaV1.InferOutput<V>>>;
61
61
  /** An array whose every element satisfies the item schema. */
62
- declare function array<T extends StandardSchemaV1>(item: T): SimpleSchema<StandardSchemaV1.InferInput<T>[], StandardSchemaV1.InferOutput<T>[]>;
62
+ export declare function array<T extends StandardSchemaV1>(item: T): SimpleSchema<StandardSchemaV1.InferInput<T>[], StandardSchemaV1.InferOutput<T>[]>;
63
63
  /** Flatten an intersection into a single object literal for readable types. */
64
64
  type Prettify<T> = { [K in keyof T]: T[K]; } & {};
65
65
  /**
@@ -70,19 +70,19 @@ type Prettify<T> = { [K in keyof T]: T[K]; } & {};
70
70
  type InferField<T extends StandardSchemaV1, Mode extends 'input' | 'output'> = Mode extends 'input' ? StandardSchemaV1.InferInput<T> : StandardSchemaV1.InferOutput<T>;
71
71
  type InferObject<T extends Record<string, StandardSchemaV1>, Mode extends 'input' | 'output'> = Prettify<{ [K in keyof T as undefined extends InferField<T[K], Mode> ? never : K]: InferField<T[K], Mode>; } & { [K in keyof T as undefined extends InferField<T[K], Mode> ? K : never]?: InferField<T[K], Mode>; }>;
72
72
  /** An object whose known keys each satisfy their schema (extra keys are kept). */
73
- declare function object<T extends Record<string, StandardSchemaV1>>(shape: T): SimpleSchema<InferObject<T, 'input'>, InferObject<T, 'output'>>;
73
+ export declare function object<T extends Record<string, StandardSchemaV1>>(shape: T): SimpleSchema<InferObject<T, 'input'>, InferObject<T, 'output'>>;
74
74
  /** Allow `undefined` in addition to the inner schema. */
75
- declare function optional<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | undefined, StandardSchemaV1.InferOutput<T> | undefined>;
75
+ export declare function optional<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | undefined, StandardSchemaV1.InferOutput<T> | undefined>;
76
76
  /** Allow `null` in addition to the inner schema. */
77
- declare function nullable<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | null, StandardSchemaV1.InferOutput<T> | null>;
77
+ export declare function nullable<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | null, StandardSchemaV1.InferOutput<T> | null>;
78
78
  /** Attach a human-readable description (used for CLI option help). */
79
- declare function describe<T extends SimpleSchema<any, any>>(schema: T, description: string): T;
79
+ export declare function describe<T extends SimpleSchema<any, any>>(schema: T, description: string): T;
80
80
  /**
81
81
  * Grouped access to every builder: `s.string()`, `s.object({ ... })`,
82
82
  * `s.void()`, etc. Handy for a valibot-like `import { s } from
83
83
  * 'devframe/utils/simple-schema'` call site.
84
84
  */
85
- declare const s: {
85
+ export declare const s: {
86
86
  readonly string: typeof string;
87
87
  readonly number: typeof number;
88
88
  readonly boolean: typeof boolean;
@@ -98,5 +98,4 @@ declare const s: {
98
98
  readonly nullable: typeof nullable;
99
99
  readonly describe: typeof describe;
100
100
  };
101
- //#endregion
102
- export { SimpleSchema, array, boolean, describe, literal, nullType, nullable, number, object, optional, picklist, record, s, string, union, voidType };
101
+ //#endregion
@@ -26,7 +26,10 @@ function createStreamSink(options = {}) {
26
26
  seq: lastSeq,
27
27
  chunk
28
28
  });
29
- if (buffer.length > replayWindow) buffer.splice(0, buffer.length - replayWindow);
29
+ if (buffer.length > replayWindow) {
30
+ if (buffer.length - replayWindow === 1) buffer.shift();
31
+ else buffer.splice(0, buffer.length - replayWindow);
32
+ }
30
33
  }
31
34
  events.emit("chunk", lastSeq, chunk);
32
35
  }
@@ -3,19 +3,18 @@
3
3
  * Serialize a structured-cloneable value (`Map`, `Set`, `Date`, `BigInt`,
4
4
  * cycles, class instances, …) into a JSON-safe records array.
5
5
  */
6
- declare function structuredCloneSerialize(value: unknown): unknown[];
6
+ export declare function structuredCloneSerialize(value: unknown): unknown[];
7
7
  /**
8
8
  * Inverse of {@link structuredCloneSerialize}.
9
9
  */
10
- declare function structuredCloneDeserialize<T = unknown>(value: unknown[]): T;
10
+ export declare function structuredCloneDeserialize<T = unknown>(value: unknown[]): T;
11
11
  /**
12
12
  * Serialize a structured-cloneable value to a single string. Equivalent
13
13
  * to `JSON.stringify(structuredCloneSerialize(value))`.
14
14
  */
15
- declare function structuredCloneStringify(value: unknown): string;
15
+ export declare function structuredCloneStringify(value: unknown): string;
16
16
  /**
17
17
  * Inverse of {@link structuredCloneStringify}.
18
18
  */
19
- declare function structuredCloneParse<T = unknown>(value: string): T;
20
- //#endregion
21
- export { structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify };
19
+ export declare function structuredCloneParse<T = unknown>(value: string): T;
20
+ //#endregion
@@ -16,7 +16,7 @@ import { WhenExpression as WhenExpression$1 } from "whenexpr";
16
16
  * `&&`, `||`, `+`, `-`, `*`, `/`, `%`. Parentheses, number and string literals
17
17
  * are also supported.
18
18
  */
19
- interface WhenContext {
19
+ export interface WhenContext {
20
20
  clientType: 'embedded' | 'standalone';
21
21
  dockOpen: boolean;
22
22
  paletteOpen: boolean;
@@ -29,9 +29,9 @@ interface WhenContext {
29
29
  * helpers to surface unknown context keys and syntax errors as TypeScript
30
30
  * errors at the call site.
31
31
  */
32
- type WhenExpression<T, S extends string> = WhenExpression$1<T, S>;
32
+ export type WhenExpression<T, S extends string> = WhenExpression$1<T, S>;
33
33
  /** Options for `evaluateWhen`. */
34
- interface EvaluateWhenOptions {
34
+ export interface EvaluateWhenOptions {
35
35
  /**
36
36
  * Throw when the expression references a context key that does not exist.
37
37
  *
@@ -45,11 +45,10 @@ interface EvaluateWhenOptions {
45
45
  * @example
46
46
  * evaluateWhen('dockOpen && clientType == embedded', ctx)
47
47
  */
48
- declare function evaluateWhen<T extends object, const E extends string>(expression: E & WhenExpression$1<T, E>, context: T, options?: EvaluateWhenOptions): boolean;
48
+ export declare function evaluateWhen<T extends object, const E extends string>(expression: E & WhenExpression$1<T, E>, context: T, options?: EvaluateWhenOptions): boolean;
49
49
  /**
50
50
  * Resolve a context value by key. Supports namespaced keys with `.` or `:`
51
51
  * separators. Returns `undefined` for unknown keys.
52
52
  */
53
- declare function resolveContextValue<T extends Record<string, unknown>>(key: string, context: T): unknown;
54
- //#endregion
55
- export { EvaluateWhenOptions, WhenContext, WhenExpression, evaluateWhen, resolveContextValue };
53
+ export declare function resolveContextValue<T extends Record<string, unknown>>(key: string, context: T): unknown;
54
+ //#endregion
@@ -62,7 +62,7 @@ var Queue = class {
62
62
  }
63
63
  };
64
64
  //#endregion
65
- //#region ../../node_modules/.pnpm/p-limit@7.3.1/node_modules/p-limit/index.js
65
+ //#region ../../node_modules/.pnpm/p-limit@7.3.2/node_modules/p-limit/index.js
66
66
  function pLimit(concurrency) {
67
67
  let rejectOnClear = false;
68
68
  if (typeof concurrency === "object") ({concurrency, rejectOnClear = false} = concurrency);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "0.9.11",
4
+ "version": "0.9.13",
5
5
  "description": "Framework for building one portable devtool integration that runs in any viewer.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -92,7 +92,7 @@
92
92
  "@standard-schema/spec": "^1.1.0",
93
93
  "birpc": "^4.2.0",
94
94
  "crossws": "^0.4.12",
95
- "h3": "^2.0.1-rc.29",
95
+ "h3": "^2.0.1-rc.31",
96
96
  "mrmime": "^2.0.1",
97
97
  "nostics": "^1.2.0",
98
98
  "pathe": "^2.0.3",
@@ -107,11 +107,11 @@
107
107
  "mlly": "^1.8.2",
108
108
  "obug": "^2.1.4",
109
109
  "ohash": "^2.0.12",
110
- "p-limit": "^7.3.1",
110
+ "p-limit": "^7.3.2",
111
111
  "perfect-debounce": "^2.1.0",
112
112
  "structured-clone-es": "^2.0.1",
113
113
  "tinyglobby": "^0.2.17",
114
- "tsdown": "^0.22.14",
114
+ "tsdown": "^0.23.0",
115
115
  "ua-parser-modern": "^0.1.1",
116
116
  "valibot": "^1.4.2",
117
117
  "whenexpr": "^0.1.2",