devframe 0.9.0-beta.1 → 0.9.0-beta.10

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 (104) hide show
  1. package/dist/{_shared-DmpWW-HH.d.mts → _shared-BPmX9fqK.d.mts} +2 -4
  2. package/dist/{_shared-CttmCMBi.mjs → _shared-CbZ_yhbz.mjs} +2 -4
  3. package/dist/adapters/build.d.mts +10 -12
  4. package/dist/adapters/build.mjs +26 -30
  5. package/dist/adapters/cac.d.mts +1 -1
  6. package/dist/adapters/cac.mjs +6 -7
  7. package/dist/adapters/dev.d.mts +22 -8
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +5 -4
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +1 -8
  13. package/dist/adapters/mcp.mjs +1 -1
  14. package/dist/{agent-tool-name-C3b5vEwJ.mjs → agent-tool-name-EgfoFO8C.mjs} +0 -3
  15. package/dist/cli/main.d.mts +0 -2
  16. package/dist/cli/main.mjs +4 -8
  17. package/dist/client/index.d.mts +5 -5
  18. package/dist/client/index.mjs +24 -1179
  19. package/dist/constants.d.mts +10 -2
  20. package/dist/constants.mjs +10 -2
  21. package/dist/{context-CSCwoABx.d.mts → context-B3YUu_95.d.mts} +19 -1
  22. package/dist/{context-Du11TLcO.mjs → context-CEe4PBz1.mjs} +23 -305
  23. package/dist/{context-C33rR7n0.mjs → context-xdynGSLP.mjs} +10 -1
  24. package/dist/{dev-BEveeA5H.mjs → dev--rAPzbvO.mjs} +16 -10
  25. package/dist/{devframe-Bdd9YXTy.d.mts → devframe-DJMg0WLe.d.mts} +97 -113
  26. package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
  27. package/dist/{diagnostics-DLYH5oD3.mjs → diagnostics-DOQPnQmX.mjs} +35 -5
  28. package/dist/{dist-D8jAMwxU.mjs → dist-eNI9qM_I.mjs} +1 -0
  29. package/dist/{host-agent-CpbAoqBx.mjs → host-agent-xLCSe65D.mjs} +41 -7
  30. package/dist/{host-h3-CzCZwtuV.mjs → host-h3-Crkzm42q.mjs} +2 -2
  31. package/dist/{http-DLr_cJZ7.mjs → http-DYpK0cUi.mjs} +5 -12
  32. package/dist/{index-CZRd2K1C.d.mts → index-CB-fSUyn.d.mts} +2 -2
  33. package/dist/{index-DSCq4M4q.d.mts → index-tdrk1bzV.d.mts} +1 -1
  34. package/dist/index.d.mts +7 -5
  35. package/dist/{instance-registry-BQqGoDO9.mjs → instance-registry-WvQkt42E.mjs} +1 -7
  36. package/dist/{instance-shell-KRdee1QF.mjs → instance-shell-CMFyszWJ.mjs} +9 -8
  37. package/dist/{instance-shell-DBTXTSjN.d.mts → instance-shell-CljiKq1c.d.mts} +3 -12
  38. package/dist/internal/index.d.mts +265 -18
  39. package/dist/internal/index.mjs +9 -7
  40. package/dist/node/auth.d.mts +2 -2
  41. package/dist/node/auth.mjs +1 -1
  42. package/dist/node/hub-internals.d.mts +2 -2
  43. package/dist/node/hub-internals.mjs +2 -2
  44. package/dist/node/index.d.mts +3 -3
  45. package/dist/node/index.mjs +2 -2
  46. package/dist/nostics-CzECRXpE.mjs +59 -0
  47. package/dist/nostics-SPGDgHEP.d.mts +33 -0
  48. package/dist/recipes/common-rpc-functions.d.mts +3 -3
  49. package/dist/recipes/interactive-auth.d.mts +2 -2
  50. package/dist/recipes/interactive-auth.mjs +3 -3
  51. package/dist/remote-assets-Bg4gCUZ_.d.mts +123 -0
  52. package/dist/remote-assets-nTTxY2MU.mjs +636 -0
  53. package/dist/rpc/dump.d.mts +1 -1
  54. package/dist/rpc/dump.mjs +1 -1
  55. package/dist/rpc/index.d.mts +2 -2
  56. package/dist/rpc/index.mjs +3 -3
  57. package/dist/rpc/transports/sse-client.d.mts +1 -1
  58. package/dist/rpc/transports/sse-client.mjs +1 -1
  59. package/dist/rpc/transports/sse-server.d.mts +2 -2
  60. package/dist/rpc/transports/sse-server.mjs +2 -2
  61. package/dist/rpc/transports/ws-bun.d.mts +2 -2
  62. package/dist/rpc/transports/ws-bun.mjs +1 -1
  63. package/dist/rpc/transports/ws-client.d.mts +1 -1
  64. package/dist/rpc/transports/ws-client.mjs +1 -1
  65. package/dist/rpc/transports/ws-server.d.mts +1 -1
  66. package/dist/rpc/transports/ws-server.mjs +1 -1
  67. package/dist/{rpc-core-CGctXToO.d.mts → rpc-core-Cc4lucI0.d.mts} +3 -3
  68. package/dist/{rpc-core-CqcJkAu9.mjs → rpc-core-DMTe-hLo.mjs} +1 -1
  69. package/dist/{serialization-BHY8M5NQ.mjs → serialization-BGzEwAdr.mjs} +1 -1
  70. package/dist/{sse-client-BsIK3hMD.d.mts → sse-client-CFBOIaUi.d.mts} +1 -1
  71. package/dist/state-Cc1IeSmQ.mjs +1291 -0
  72. package/dist/{static-CvjkO8QE.mjs → static-BPZ1_OPA.mjs} +2 -2
  73. package/dist/storage-CYye7P7L.mjs +137 -0
  74. package/dist/types/index.d.mts +6 -4
  75. package/dist/{types-CnJSgRVa.d.mts → types-Djq7CBXh.d.mts} +0 -7
  76. package/dist/utils/agent-tool-name.d.mts +0 -3
  77. package/dist/utils/agent-tool-name.mjs +0 -3
  78. package/dist/utils/events.d.mts +1 -1
  79. package/dist/utils/get-port.d.mts +17 -0
  80. package/dist/utils/get-port.mjs +2 -0
  81. package/dist/utils/nostics.d.mts +2 -0
  82. package/dist/utils/nostics.mjs +2 -0
  83. package/dist/utils/open.d.mts +2 -10
  84. package/dist/utils/open.mjs +56 -1
  85. package/dist/utils/remote-assets.d.mts +15 -0
  86. package/dist/utils/remote-assets.mjs +2 -0
  87. package/dist/utils/serve-static.d.mts +13 -5
  88. package/dist/utils/serve-static.mjs +119 -9
  89. package/dist/utils/shared-state.d.mts +1 -1
  90. package/dist/utils/streaming-channel.d.mts +1 -1
  91. package/dist/{validation-BiuDXTKW.mjs → validation-CpXFB6Dz.mjs} +1 -1
  92. package/dist/{wire-codec-9VhIKnyp.mjs → wire-codec-0K-o5MYW.mjs} +1 -3
  93. package/dist/{ws-client-CdNuATYa.d.mts → ws-client-DhjNyQo3.d.mts} +1 -1
  94. package/dist/{ws-server-Bk1hOG3X.mjs → ws-server-BdSLrhxE.mjs} +1 -1
  95. package/dist/{ws-server-Ces08fjP.d.mts → ws-server-D1d3QM9f.d.mts} +1 -1
  96. package/package.json +4 -4
  97. package/skills/devframe/SKILL.md +10 -11
  98. package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
  99. package/dist/helpers/vite.d.mts +0 -104
  100. package/dist/helpers/vite.mjs +0 -93
  101. package/dist/open-Dz4V4irZ.mjs +0 -547
  102. package/dist/state-BeUHDDjk.mjs +0 -108
  103. package/dist/storage-BcmVEJRc.mjs +0 -1122
  104. package/skills/devframe/templates/spa-devframe.ts +0 -38
@@ -0,0 +1,59 @@
1
+ import { Diagnostic, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic } from "nostics";
2
+ import { ansiFormatter, ansiFormatter as ansiFormatter$1 } from "nostics/formatters/ansi";
3
+ //#region src/utils/colors.ts
4
+ function makeColor(open, close) {
5
+ const o = `\x1B[${open}m`;
6
+ const c = `\x1B[${close}m`;
7
+ return ((arg, ...values) => {
8
+ if (Array.isArray(arg) && "raw" in arg) {
9
+ const strings = arg;
10
+ let out = "";
11
+ for (let i = 0; i < strings.length; i++) {
12
+ out += strings[i];
13
+ if (i < values.length) out += String(values[i]);
14
+ }
15
+ return `${o}${out}${c}`;
16
+ }
17
+ return `${o}${String(arg)}${c}`;
18
+ });
19
+ }
20
+ const colors = {
21
+ blue: makeColor(34, 39),
22
+ cyan: makeColor(36, 39),
23
+ gray: makeColor(90, 39),
24
+ green: makeColor(32, 39),
25
+ red: makeColor(31, 39),
26
+ yellow: makeColor(33, 39),
27
+ bold: makeColor(1, 22),
28
+ dim: makeColor(2, 22),
29
+ reset: makeColor(0, 0),
30
+ underline: makeColor(4, 24)
31
+ };
32
+ //#endregion
33
+ //#region src/utils/nostics.ts
34
+ const formatAnsi = ansiFormatter(colors);
35
+ /**
36
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
37
+ * any caller-supplied ones: prints the diagnostic through devframe's own
38
+ * ANSI colors via `console[method]` (default `'warn'`).
39
+ */
40
+ function devframeReporter(d, { method = "warn" } = {}) {
41
+ console[method](formatAnsi(d));
42
+ }
43
+ /**
44
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
45
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
46
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
47
+ * and the built-in plugins defines its codes through this instead of
48
+ * `nostics`'s own `defineDiagnostics` — the reporter registration lives
49
+ * here, once, so none of them need to build their own reporter (`colors`,
50
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
51
+ */
52
+ function defineDiagnostics$1(options) {
53
+ return defineDiagnostics({
54
+ ...options,
55
+ reporters: [devframeReporter, ...options.reporters ?? []]
56
+ });
57
+ }
58
+ //#endregion
59
+ export { defineProdDiagnostics as a, defineDiagnostics$1 as i, ansiFormatter$1 as n, formatDiagnostic as o, createConsoleReporter as r, colors as s, Diagnostic as t };
@@ -0,0 +1,33 @@
1
+ import { AnyDiagnosticReporter, AnyDiagnosticReporter as AnyDiagnosticReporter$1, ConsoleMethod, ConsoleReporterOptions, Diagnostic, Diagnostic as Diagnostic$1, DiagnosticCallParams, DiagnosticDefinition, DiagnosticDefinition as DiagnosticDefinition$1, DiagnosticHandle, DiagnosticInit, DiagnosticReporter, Diagnostics, Diagnostics as Diagnostics$1, createConsoleReporter, defineProdDiagnostics, formatDiagnostic } from "nostics";
2
+ import { ansiFormatter } from "nostics/formatters/ansi";
3
+ //#region src/utils/nostics.d.ts
4
+ /**
5
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
6
+ * any caller-supplied ones: prints the diagnostic through devframe's own
7
+ * ANSI colors via `console[method]` (default `'warn'`).
8
+ */
9
+ declare function devframeReporter(d: Diagnostic, { method }?: {
10
+ method?: 'log' | 'warn' | 'error';
11
+ }): void;
12
+ /**
13
+ * Options accepted by {@link defineDiagnostics} — identical to `nostics`'s
14
+ * own `DefineDiagnosticsOptions`, minus the reporter devframe already
15
+ * prepends.
16
+ */
17
+ type DevframeDefineDiagnosticsOptions<Codes extends Record<string, DiagnosticDefinition>, Reporters extends readonly AnyDiagnosticReporter[] = []> = Parameters<typeof defineDiagnostics<Codes, Reporters>>[0];
18
+ /**
19
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
20
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
21
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
22
+ * and the built-in plugins defines its codes through this instead of
23
+ * `nostics`'s own `defineDiagnostics` — the reporter registration lives
24
+ * here, once, so none of them need to build their own reporter (`colors`,
25
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
26
+ */
27
+ declare function defineDiagnostics<const Codes extends Record<string, DiagnosticDefinition>, const Reporters extends readonly AnyDiagnosticReporter[] = []>(options: {
28
+ docsBase?: string | ((code: keyof Codes) => string | undefined);
29
+ codes: Codes;
30
+ reporters?: Reporters;
31
+ }): Diagnostics<Codes, readonly [typeof devframeReporter, ...Reporters]>;
32
+ //#endregion
33
+ export { Diagnostic$1 as a, DiagnosticHandle as c, Diagnostics$1 as d, ansiFormatter as f, formatDiagnostic as g, defineProdDiagnostics as h, DevframeDefineDiagnosticsOptions as i, DiagnosticInit as l, defineDiagnostics as m, ConsoleMethod as n, DiagnosticCallParams as o, createConsoleReporter as p, ConsoleReporterOptions as r, DiagnosticDefinition$1 as s, AnyDiagnosticReporter$1 as t, DiagnosticReporter as u };
@@ -1,6 +1,6 @@
1
- import "../devframe-Bdd9YXTy.mjs";
2
- import "../index-DSCq4M4q.mjs";
3
- import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
1
+ import "../devframe-DJMg0WLe.mjs";
2
+ import "../index-tdrk1bzV.mjs";
3
+ import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-Djq7CBXh.mjs";
4
4
  import { SimpleSchema } from "../utils/simple-schema.mjs";
5
5
  //#region src/recipes/common-rpc-functions.d.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { p as DevframeAuthHandler, x as DevframeNodeContext } from "../devframe-Bdd9YXTy.mjs";
2
- import "../index-CZRd2K1C.mjs";
1
+ import { g as DevframeNodeContext, u as DevframeAuthHandler } from "../devframe-DJMg0WLe.mjs";
2
+ import "../index-CB-fSUyn.mjs";
3
3
  //#region src/recipes/interactive-auth.d.ts
4
4
  interface CreateInteractiveAuthOptions {
5
5
  /**
@@ -1,8 +1,8 @@
1
- import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
1
+ import { s as colors } from "../nostics-CzECRXpE.mjs";
2
2
  import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
3
3
  import { isAnonymousRpcMethod } from "../constants.mjs";
4
- import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-BeUHDDjk.mjs";
5
- import { t as getInternalContext } from "../context-C33rR7n0.mjs";
4
+ import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-Cc1IeSmQ.mjs";
5
+ import { t as getInternalContext } from "../context-xdynGSLP.mjs";
6
6
  import { t as s } from "../simple-schema-DQPZrAaZ.mjs";
7
7
  //#region src/recipes/interactive-auth.ts
8
8
  function defaultBanner(info) {
@@ -0,0 +1,123 @@
1
+ //#region src/types/remote-assets.d.ts
2
+ /**
3
+ * A version-locked pointer at browser assets published as their own npm
4
+ * package (e.g. `@devframes/plugin-git-client`), served through devframe's
5
+ * caching back-proxy instead of a directory shipped inside the node package.
6
+ *
7
+ * Resolution order at serve time:
8
+ *
9
+ * 1. The package installed locally (resolved from {@link resolveFrom})
10
+ * — the zero-network / air-gap path. Version skew warns; a major
11
+ * version mismatch throws.
12
+ * 2. The per-file cache under
13
+ * `<storageDir project>/.remote-assets/<package>@<version>/`.
14
+ * 3. The CDN {@link provider} — each requested file streams through to
15
+ * the browser while being written into the cache.
16
+ *
17
+ * Anywhere a static mount accepts a dist directory (`cli.distDir`,
18
+ * `hostStatic`, `mountStatic`) it also accepts this object — see
19
+ * {@link StaticAssetsSource}.
20
+ */
21
+ interface RemoteAssets {
22
+ /** npm package name that ships the assets, e.g. `@devframes/plugin-git-client`. */
23
+ package: string;
24
+ /** Exact version to serve, e.g. `1.2.3`. Typically the host package's own version. */
25
+ version: string;
26
+ /**
27
+ * Subpath inside the package the served assets live under.
28
+ *
29
+ * @default 'dist'
30
+ */
31
+ path?: string;
32
+ /**
33
+ * CDN that mirrors npm and serves individual package files.
34
+ *
35
+ * @default 'jsdelivr'
36
+ */
37
+ provider?: RemoteAssetsProvider;
38
+ /**
39
+ * `import.meta.url` of the declaring module. When set, a locally
40
+ * installed copy of {@link package} is resolved from this module's own
41
+ * dependency graph first (works under pnpm's strict layout) and served
42
+ * with zero network. Omitting it skips the installed-package step —
43
+ * cache + CDN still work.
44
+ */
45
+ resolveFrom?: string | null;
46
+ /** Custom fetch implementation (proxies, tests). Defaults to the global `fetch`. */
47
+ fetch?: typeof globalThis.fetch;
48
+ /**
49
+ * Never touch the network: serve only from the locally installed package
50
+ * or files already in the cache.
51
+ *
52
+ * @default false
53
+ */
54
+ offline?: boolean;
55
+ }
56
+ /**
57
+ * Built-in CDN providers (`'jsdelivr'` — default, `'unpkg'`) or a custom
58
+ * provider for corp mirrors.
59
+ */
60
+ type RemoteAssetsProvider = 'jsdelivr' | 'unpkg' | RemoteAssetsProviderCustom;
61
+ /** A custom {@link RemoteAssets} CDN provider (e.g. an internal npm mirror). */
62
+ interface RemoteAssetsProviderCustom {
63
+ /**
64
+ * Absolute URL serving `filePath` (package-relative, POSIX, no leading
65
+ * slash) of `pkg@version`.
66
+ */
67
+ fileUrl: (pkg: string, version: string, filePath: string) => string;
68
+ /**
69
+ * List every file path in `pkg@version` (package-relative, no leading
70
+ * slash). Powers request-path resolution (correct 404s / SPA fallback)
71
+ * and build-time materialization. When omitted, requests are resolved by
72
+ * probing {@link fileUrl} directly and builds cannot materialize from
73
+ * this provider.
74
+ */
75
+ listFiles?: (pkg: string, version: string, fetchImpl: typeof globalThis.fetch) => Promise<string[]>;
76
+ }
77
+ /**
78
+ * What every static-assets seam accepts: a local dist directory, or a
79
+ * {@link RemoteAssets} pointer served through the caching back-proxy.
80
+ */
81
+ type StaticAssetsSource = string | RemoteAssets;
82
+ /**
83
+ * What the remote-assets fallback page posts to `window.parent` when a
84
+ * devframe's client assets could be served from neither a local install nor
85
+ * their provider. A viewer embedding the devframe in an iframe listens for
86
+ * `DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE` (`devframe/constants`) and can
87
+ * render the failure in its own design, with the two ways out the page also
88
+ * spells out: install `package@version` locally, or restore network access.
89
+ */
90
+ interface RemoteAssetsErrorMessage {
91
+ type: 'devframe:remote-assets-error';
92
+ /** npm package the assets are published as. */
93
+ package: string;
94
+ /** Exact version the devframe asked for. */
95
+ version: string;
96
+ /** Why the fetch failed, as reported by the provider or the network stack. */
97
+ reason: string;
98
+ }
99
+ /**
100
+ * A resolved, servable handle over a {@link RemoteAssets} declaration —
101
+ * produced by `resolveStaticAssetsSource()` (`devframe/utils/remote-assets`)
102
+ * and consumed by the static-serving engine (`devframe/utils/serve-static`).
103
+ */
104
+ interface RemoteAssetsStore {
105
+ /** The declaration this store serves (with defaults applied). */
106
+ readonly assets: RemoteAssets & {
107
+ path: string;
108
+ };
109
+ /**
110
+ * Resolve a request path (relative to the mount base, SPA fallback to
111
+ * `index.html`) and return a `Response`: streamed from the cache when
112
+ * present, otherwise through the provider while being written into the
113
+ * cache. `null` on a miss (404); throws on provider/network failure.
114
+ */
115
+ serve: (urlPath: string) => Promise<Response | null>;
116
+ /**
117
+ * Download every listed file under `assets.path` into `targetDir`
118
+ * (paths relative to `assets.path`). Requires a provider file listing.
119
+ */
120
+ materialize: (targetDir: string) => Promise<void>;
121
+ }
122
+ //#endregion
123
+ export { RemoteAssetsStore as a, RemoteAssetsProviderCustom as i, RemoteAssetsErrorMessage as n, StaticAssetsSource as o, RemoteAssetsProvider as r, RemoteAssets as t };