@flowdular/sdk 0.1.0 → 0.2.1

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 (175) hide show
  1. package/.ai/skills/test-hardening/SKILL.md +1 -1
  2. package/README.md +69 -12
  3. package/assets/flowdular-banner.png +0 -0
  4. package/modules/agents/package.json +1 -1
  5. package/modules/auth/package.json +1 -1
  6. package/modules/auth/src/client/AuthenticationCore.tsrx +3 -1
  7. package/modules/auth/src/server/endpoints.ts +3 -1
  8. package/modules/auth/src/server/runtime.ts +4 -0
  9. package/modules/automations/package.json +1 -1
  10. package/modules/automations-workflows-integration/package.json +1 -1
  11. package/modules/profile/package.json +1 -1
  12. package/modules/sandbox/package.json +1 -1
  13. package/modules/system/package.json +1 -1
  14. package/modules/users/package.json +1 -1
  15. package/modules/workflows/package.json +1 -1
  16. package/package.json +5 -13
  17. package/packages/ai-provider/package.json +1 -1
  18. package/packages/cli-protocol/package.json +1 -1
  19. package/packages/client/package.json +1 -1
  20. package/packages/client/src/routing.ts +39 -2
  21. package/packages/client/src/shell/BrandMark.tsrx +5 -1
  22. package/packages/client/src/shell/navigation.ts +3 -1
  23. package/packages/client/src/state.ts +6 -2
  24. package/packages/contracts/package.json +1 -1
  25. package/packages/contracts/schemas/project.schema.json +16 -42
  26. package/packages/database/package.json +1 -1
  27. package/packages/database-pglite/package.json +2 -2
  28. package/packages/database-pglite/src/driver.ts +21 -3
  29. package/packages/database-testing/package.json +1 -1
  30. package/packages/dev-console/package.json +1 -1
  31. package/packages/harness/package.json +1 -1
  32. package/packages/kernel/package.json +1 -1
  33. package/packages/server/package.json +1 -1
  34. package/packages/server/src/application-routes.ts +80 -8
  35. package/packages/server/src/index.ts +4 -1
  36. package/packages/server/src/web-html.ts +9 -5
  37. package/packages/server/src/web.ts +59 -7
  38. package/packages/ui/package.json +1 -1
  39. package/packages/coding-agent/package.json +0 -44
  40. package/packages/coding-agent/src/drivers/byok.ts +0 -322
  41. package/packages/coding-agent/src/drivers/claude-code.ts +0 -290
  42. package/packages/coding-agent/src/drivers/codex.ts +0 -281
  43. package/packages/coding-agent/src/index.ts +0 -56
  44. package/packages/coding-agent/src/registry.ts +0 -119
  45. package/packages/coding-agent/src/roles/contract.ts +0 -60
  46. package/packages/coding-agent/src/roles/defaults.ts +0 -134
  47. package/packages/coding-agent/src/roles/handoff.ts +0 -41
  48. package/packages/coding-agent/src/roles/registry.ts +0 -156
  49. package/packages/coding-agent/src/roles/skills.ts +0 -72
  50. package/packages/coding-agent/src/roles/sync.ts +0 -88
  51. package/packages/coding-agent/src/types.ts +0 -102
  52. package/packages/coding-agent/src/workspace.ts +0 -275
  53. package/packages/sandbox/README.md +0 -691
  54. package/packages/sandbox/bin/flowdular-sandbox.mjs +0 -393
  55. package/packages/sandbox/dist/client/assets/App-ClMOrpyg.js +0 -11
  56. package/packages/sandbox/dist/client/assets/PreviewHost-BHiHrfbQ.js +0 -1
  57. package/packages/sandbox/dist/client/assets/auto-buGEq6de.js +0 -3
  58. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  59. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  60. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  61. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  62. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  63. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  64. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  65. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  66. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  67. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  68. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  69. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  70. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  71. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  72. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  73. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  74. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  75. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  76. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  77. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  78. package/packages/sandbox/dist/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  79. package/packages/sandbox/dist/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  80. package/packages/sandbox/dist/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  81. package/packages/sandbox/dist/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  82. package/packages/sandbox/dist/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  83. package/packages/sandbox/dist/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  84. package/packages/sandbox/dist/client/assets/index-CvwhlQ87.js +0 -4
  85. package/packages/sandbox/dist/client/assets/styles-BPWaGf55.js +0 -3
  86. package/packages/sandbox/dist/client/assets/styles-Dx1_KOag.css +0 -1
  87. package/packages/sandbox/dist/client/favicon.svg +0 -1
  88. package/packages/sandbox/dist/server/assets/auto-CVGNYyb3.js +0 -12785
  89. package/packages/sandbox/dist/server/assets/chunk-DDJLRBDX-3OUNo51g.js +0 -4125
  90. package/packages/sandbox/dist/server/assets/nodefs-DVSI7kG0.js +0 -24
  91. package/packages/sandbox/dist/server/assets/opfs-ahp-D56iokt1.js +0 -388
  92. package/packages/sandbox/dist/server/assets/token-Bvaq7Anz.js +0 -55
  93. package/packages/sandbox/dist/server/assets/token-util-BqSvdIPQ.js +0 -3
  94. package/packages/sandbox/dist/server/assets/token-util-CktFFT4z.js +0 -494
  95. package/packages/sandbox/dist/server/entry.js +0 -91671
  96. package/packages/sandbox/dist/server/favicon.svg +0 -1
  97. package/packages/sandbox/dist/server/index.html +0 -161
  98. package/packages/sandbox/index.html +0 -159
  99. package/packages/sandbox/octane.config.ts +0 -36
  100. package/packages/sandbox/package.json +0 -83
  101. package/packages/sandbox/public/favicon.svg +0 -1
  102. package/packages/sandbox/public/og.png +0 -0
  103. package/packages/sandbox/src/App.tsrx +0 -924
  104. package/packages/sandbox/src/client/ApprovalHandoff.tsrx +0 -39
  105. package/packages/sandbox/src/client/ChatPane.tsrx +0 -694
  106. package/packages/sandbox/src/client/ConnectView.tsrx +0 -86
  107. package/packages/sandbox/src/client/DiffPane.tsrx +0 -150
  108. package/packages/sandbox/src/client/EjectModal.tsrx +0 -571
  109. package/packages/sandbox/src/client/GateResults.tsrx +0 -60
  110. package/packages/sandbox/src/client/GitHubSettingsModal.tsrx +0 -219
  111. package/packages/sandbox/src/client/NewSessionForm.tsrx +0 -214
  112. package/packages/sandbox/src/client/SessionBar.tsrx +0 -151
  113. package/packages/sandbox/src/client/SessionPicker.tsrx +0 -472
  114. package/packages/sandbox/src/client/SpecEditor.tsrx +0 -109
  115. package/packages/sandbox/src/client/SpecReviewCard.tsrx +0 -321
  116. package/packages/sandbox/src/client/WorkCard.tsrx +0 -128
  117. package/packages/sandbox/src/client/WorkbenchModal.tsrx +0 -161
  118. package/packages/sandbox/src/client/WorkspaceMenu.tsrx +0 -100
  119. package/packages/sandbox/src/client/api.ts +0 -797
  120. package/packages/sandbox/src/client/attachments.ts +0 -73
  121. package/packages/sandbox/src/client/dashboard.ts +0 -46
  122. package/packages/sandbox/src/client/github-settings.ts +0 -48
  123. package/packages/sandbox/src/client/highlight.ts +0 -105
  124. package/packages/sandbox/src/client/i18n.ts +0 -32
  125. package/packages/sandbox/src/client/locales/en.json +0 -466
  126. package/packages/sandbox/src/client/locales/pl.json +0 -466
  127. package/packages/sandbox/src/client/session-labels.ts +0 -77
  128. package/packages/sandbox/src/client/state.ts +0 -108
  129. package/packages/sandbox/src/index.ts +0 -10
  130. package/packages/sandbox/src/preview/PreviewHost.tsrx +0 -373
  131. package/packages/sandbox/src/preview/load-module.ts +0 -16
  132. package/packages/sandbox/src/server/attachments.ts +0 -308
  133. package/packages/sandbox/src/server/auto-review.ts +0 -181
  134. package/packages/sandbox/src/server/checkpoints.ts +0 -90
  135. package/packages/sandbox/src/server/config.ts +0 -460
  136. package/packages/sandbox/src/server/dashboard.ts +0 -245
  137. package/packages/sandbox/src/server/delivery/configuration.ts +0 -193
  138. package/packages/sandbox/src/server/delivery/git-pr.ts +0 -1473
  139. package/packages/sandbox/src/server/delivery/index.ts +0 -83
  140. package/packages/sandbox/src/server/delivery/local.ts +0 -151
  141. package/packages/sandbox/src/server/delivery/official-modules.ts +0 -516
  142. package/packages/sandbox/src/server/delivery/plan.ts +0 -218
  143. package/packages/sandbox/src/server/delivery/policies.ts +0 -239
  144. package/packages/sandbox/src/server/delivery/record.ts +0 -41
  145. package/packages/sandbox/src/server/delivery/steps.ts +0 -464
  146. package/packages/sandbox/src/server/delivery/types.ts +0 -158
  147. package/packages/sandbox/src/server/dependencies.ts +0 -88
  148. package/packages/sandbox/src/server/diff.ts +0 -230
  149. package/packages/sandbox/src/server/gates.ts +0 -388
  150. package/packages/sandbox/src/server/index.ts +0 -139
  151. package/packages/sandbox/src/server/path-guard.ts +0 -282
  152. package/packages/sandbox/src/server/planning.ts +0 -749
  153. package/packages/sandbox/src/server/platform-client.ts +0 -189
  154. package/packages/sandbox/src/server/preview-database-host.ts +0 -340
  155. package/packages/sandbox/src/server/preview-database-protocol.ts +0 -163
  156. package/packages/sandbox/src/server/preview-database-proxy.ts +0 -356
  157. package/packages/sandbox/src/server/preview-database.ts +0 -109
  158. package/packages/sandbox/src/server/preview-ipc.ts +0 -15
  159. package/packages/sandbox/src/server/preview-modules.ts +0 -83
  160. package/packages/sandbox/src/server/preview-revision.ts +0 -44
  161. package/packages/sandbox/src/server/preview-runtime.ts +0 -467
  162. package/packages/sandbox/src/server/preview-worker-manager.ts +0 -436
  163. package/packages/sandbox/src/server/preview-worker.ts +0 -168
  164. package/packages/sandbox/src/server/reference.ts +0 -251
  165. package/packages/sandbox/src/server/routes.ts +0 -2258
  166. package/packages/sandbox/src/server/runtime.ts +0 -188
  167. package/packages/sandbox/src/server/session-owner.ts +0 -23
  168. package/packages/sandbox/src/server/sessions.ts +0 -849
  169. package/packages/sandbox/src/server/spec.ts +0 -471
  170. package/packages/sandbox/src/server/turn-lifecycle.ts +0 -56
  171. package/packages/sandbox/src/server/turns.ts +0 -993
  172. package/packages/sandbox/src/server/workspace-install.ts +0 -266
  173. package/packages/sandbox/src/server/workspace-root.ts +0 -73
  174. package/packages/sandbox/src/styles.css +0 -1573
  175. package/packages/sandbox/vite.config.ts +0 -133
@@ -18,7 +18,7 @@ when: A module has few or tautological tests, a bug escaped the suite, or a revi
18
18
 
19
19
  - `tests/module.test.ts` (one file per module today; more files are fine). `tsconfig.json` includes `src/**/*` and `tests/**/*.ts`, so a test file is `.ts`; `.tsrx` components are not compiled by vitest here. Testable client logic (formatting, filtering, mapping, state transitions) goes into a `.ts` helper next to the view and is imported by the test.
20
20
  - Runner: `vitest run` (`pnpm --filter @flowdular/module-<dir> test`). In the sandbox the `tests` gate runs `vitest run --passWithNoTests` inside the module directory, so a module with no tests passes the gate. Treat an empty or trivial suite as a defect, not a pass.
21
- - Pinned: vitest 4.1.10, typescript 5.9.3, `@types/node` 24.13.3 (`.ai/references/catalog/package.json`).
21
+ - New modules use vitest 4.1.11, typescript 5.9.3 and `@types/node` 24.13.3. The catalog reference is an immutable older release; use the current scaffold dependency versions for new code.
22
22
 
23
23
  ## 2. Repositories on an embedded PostgreSQL
24
24
 
package/README.md CHANGED
@@ -1,24 +1,81 @@
1
+ [![Flowdular: Build your business platform](https://cdn.jsdelivr.net/npm/@flowdular/sdk@latest/assets/flowdular-banner.png)](https://flowdular.com)
2
+
1
3
  # Flowdular SDK
2
4
 
3
- One npm package for the Flowdular platform. Import the surface you need:
5
+ [![npm version](https://img.shields.io/npm/v/@flowdular/sdk?color=f59e0b)](https://www.npmjs.com/package/@flowdular/sdk)
6
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D22.22.2-339933?logo=nodedotjs&logoColor=white)](https://nodejs.org/)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/Flowdular/flowdular/blob/main/LICENSE)
8
+
9
+ The shared foundation for Flowdular applications: server APIs, client integration, UI components, databases, agents and bundled core modules. Build business modules against one SDK with explicit imports for each part of the platform.
10
+
11
+ ## Start a new application
12
+
13
+ Use Node.js **22.22.2 or newer**. The generated workspace uses pnpm.
14
+
15
+ ```sh
16
+ npm create flowdular@latest my-app
17
+ cd my-app
18
+ pnpm flowdular doctor
19
+ ```
20
+
21
+ The generator configures the SDK and the Flowdular/Octane build toolchain. To add the SDK to an existing compatible workspace, install it in the package that imports it:
22
+
23
+ ```sh
24
+ pnpm add @flowdular/sdk
25
+ ```
26
+
27
+ ## Import what you need
4
28
 
5
29
  ```ts
30
+ // Server-side module code
6
31
  import { defineEndpoint } from '@flowdular/sdk/server';
7
32
  import type { ModuleManifest } from '@flowdular/sdk/contracts';
33
+ ```
34
+
35
+ ```ts
36
+ // Client-side module code
8
37
  import { Button } from '@flowdular/sdk/ui';
9
38
  import '@flowdular/sdk/ui/styles';
10
39
  ```
11
40
 
12
- Exports include `client`, `server`, `ui`, `contracts`, `kernel`, `database`,
13
- `database-pglite`, `database-testing`, `harness`, `ai-provider`, `coding-agent`,
14
- `cli-protocol`, `dev-console`, `sandbox` and `modules/<name>` for bundled core modules.
15
- Subpaths retain their own exports, such as `modules/auth/server` and `client/i18n`.
16
- There is no root barrel importing server code into browser entrypoints.
41
+ The SDK ships TypeScript and TSRX source for the Flowdular/Octane toolchain. It has no root import. Keep server and database imports in server code; use client and UI entrypoints in browser code.
42
+
43
+ ## What's included
44
+
45
+ | Area | Import paths |
46
+ | --------------------------------------- | ---------------------------------------------------------------- |
47
+ | Module contracts and runtime | `@flowdular/sdk/contracts`, `@flowdular/sdk/kernel` |
48
+ | HTTP endpoints | `@flowdular/sdk/server` |
49
+ | Client integration and translations | `@flowdular/sdk/client`, `@flowdular/sdk/client/i18n` |
50
+ | Shared UI and styles | `@flowdular/sdk/ui`, `@flowdular/sdk/ui/styles` |
51
+ | Database contracts and local PostgreSQL | `@flowdular/sdk/database`, `@flowdular/sdk/database-pglite` |
52
+ | Database test helpers | `@flowdular/sdk/database-testing` |
53
+ | Agents and providers | `@flowdular/sdk/harness`, `@flowdular/sdk/ai-provider` |
54
+ | Development APIs | `@flowdular/sdk/dev-console`, `@flowdular/sdk/cli-protocol` |
55
+ | Bundled core modules | `@flowdular/sdk/modules/<name>`, including `modules/auth/server` |
56
+
57
+ Business modules are distributed as source archives through [Official Modules](https://github.com/Flowdular/official-modules). Installing an archive and enabling a module are separate CLI actions.
58
+
59
+ The coding sandbox is a separate application distributed as `@flowdular/sandbox`.
60
+ Launch it with `npx @flowdular/sandbox` from your application directory. It depends
61
+ on the SDK; installing the SDK alone does not install the sandbox application or
62
+ its launcher. The SDK's `modules/sandbox` export is the platform access/grant
63
+ module, not the coding application.
64
+
65
+ ## Build a module
66
+
67
+ Use explicit permissions for endpoints, tenant-bound database access and the shared UI components. Run the generated workspace's checks before delivery:
68
+
69
+ ```sh
70
+ pnpm verify
71
+ ```
72
+
73
+ See the [module guide](https://github.com/Flowdular/flowdular/blob/main/docs/modules.md), [database adapters](https://github.com/Flowdular/flowdular/blob/main/docs/database-adapters.md) and [design system](https://github.com/Flowdular/flowdular/blob/main/docs/design-system.md).
74
+
75
+ ## Packages and support
17
76
 
18
- The SDK ships TypeScript and TSRX source for the Flowdular/Octane build toolchain.
19
- Create a configured workspace with `npm create flowdular@latest my-app`.
20
- The CLI is published separately as `flowdular`.
77
+ - [flowdular](https://www.npmjs.com/package/flowdular): workspace CLI.
78
+ - [create-flowdular](https://www.npmjs.com/package/create-flowdular): application generator.
79
+ - [Documentation](https://github.com/Flowdular/flowdular/tree/main/docs) · [Source and issues](https://github.com/Flowdular/flowdular) · [Website](https://flowdular.com)
21
80
 
22
- Source packages remain separate private workspaces in the repository. Release
23
- assembly copies the declared members, rewrites internal imports to SDK subpaths,
24
- and exposes their original entrypoints. Only the assembled SDK is published.
81
+ Licensed under MIT. Repository documentation and source require repository access while the repositories are private.
Binary file
@@ -31,7 +31,7 @@
31
31
  "@tsrx/typescript-plugin": "0.3.120",
32
32
  "@types/node": "24.13.3",
33
33
  "typescript": "5.9.3",
34
- "vitest": "4.1.10"
34
+ "vitest": "4.1.11"
35
35
  },
36
36
  "license": "MIT",
37
37
  "repository": {
@@ -36,7 +36,7 @@
36
36
  "@types/node": "24.13.3",
37
37
  "@types/pg": "8.23.1",
38
38
  "typescript": "5.9.3",
39
- "vitest": "4.1.10"
39
+ "vitest": "4.1.11"
40
40
  },
41
41
  "license": "MIT",
42
42
  "repository": {
@@ -348,7 +348,9 @@ function AuthenticationForm(props: AuthenticationFormProps) @{
348
348
  />
349
349
  </FormField>
350
350
  <p class="auth-slug-preview">
351
- {t('auth.signup.workspace.address') + ' ' + applicationPath() + '/'}
351
+ {t('auth.signup.workspace.address') + ' ' +
352
+ applicationPath() +
353
+ '/'}
352
354
  <b>
353
355
  {workspaceSlug || t('auth.signup.workspace.placeholder')}
354
356
  </b>
@@ -369,7 +369,9 @@ export function createAuthRoutes(runtime: AuthRuntime): readonly ServerRoute[] {
369
369
  headers.append('set-cookie', expiredState);
370
370
  return new Response(null, { status: 302, headers });
371
371
  }
372
- const headers = new Headers({ location: '/app' });
372
+ const headers = new Headers({
373
+ location: runtime.applicationPath ?? '/app',
374
+ });
373
375
  headers.append(
374
376
  'set-cookie',
375
377
  sessionCookie(issued.token, runtime.cookie),
@@ -1,3 +1,4 @@
1
+ import { validateApplicationPath } from '@flowdular/sdk/server';
1
2
  import { readFileSync } from 'node:fs';
2
3
  import { resolve } from 'node:path';
3
4
  import type { Middleware } from '@octanejs/app-core';
@@ -76,6 +77,7 @@ export interface AuthRuntimeEnvironmentOptions {
76
77
  readonly mailDelivery?: AuthMailDelivery;
77
78
  readonly mfaEncryptionKey?: string;
78
79
  readonly publicBaseUrl?: string;
80
+ readonly applicationPath?: string;
79
81
  readonly oidcProviders?: readonly OidcProvider[];
80
82
  readonly production?: boolean;
81
83
  readonly contentSecurityPolicy?: string | null;
@@ -104,6 +106,7 @@ export interface AuthRuntime {
104
106
  readonly workspaceRoot: string | null;
105
107
  readonly oidcProviders: readonly OidcProvider[];
106
108
  readonly publicBaseUrl: string | null;
109
+ readonly applicationPath?: string;
107
110
  /* Resolves once the schema is migrated and the leases are held. Concurrent
108
111
  first callers await the same initialization. */
109
112
  service(): Promise<AuthService>;
@@ -667,6 +670,7 @@ export function createAuthRuntime(options: AuthRuntimeOptions): AuthRuntime {
667
670
  workspaceRoot: options.workspaceRoot ?? null,
668
671
  oidcProviders: options.oidcProviders ?? [],
669
672
  publicBaseUrl: options.publicBaseUrl ?? null,
673
+ applicationPath: validateApplicationPath(options.applicationPath ?? '/app'),
670
674
  service,
671
675
  async authorizeAgentToolAccess(tenantId, actor) {
672
676
  const identity = normalizeActor(actor);
@@ -30,7 +30,7 @@
30
30
  "@tsrx/typescript-plugin": "0.3.120",
31
31
  "@types/node": "24.13.3",
32
32
  "typescript": "5.9.3",
33
- "vitest": "4.1.10"
33
+ "vitest": "4.1.11"
34
34
  },
35
35
  "license": "MIT",
36
36
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "devDependencies": {
24
24
  "@types/node": "24.13.3",
25
25
  "typescript": "5.9.3",
26
- "vitest": "4.1.10"
26
+ "vitest": "4.1.11"
27
27
  },
28
28
  "license": "MIT",
29
29
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "@tsrx/typescript-plugin": "0.3.120",
31
31
  "@types/node": "24.13.3",
32
32
  "typescript": "5.9.3",
33
- "vitest": "4.1.10"
33
+ "vitest": "4.1.11"
34
34
  },
35
35
  "license": "MIT",
36
36
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "@tsrx/typescript-plugin": "0.3.120",
32
32
  "@types/node": "24.13.3",
33
33
  "typescript": "5.9.3",
34
- "vitest": "4.1.10"
34
+ "vitest": "4.1.11"
35
35
  },
36
36
  "license": "MIT",
37
37
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "@tsrx/typescript-plugin": "0.3.120",
32
32
  "@types/node": "24.13.3",
33
33
  "typescript": "5.9.3",
34
- "vitest": "4.1.10"
34
+ "vitest": "4.1.11"
35
35
  },
36
36
  "license": "MIT",
37
37
  "repository": {
@@ -29,7 +29,7 @@
29
29
  "@tsrx/typescript-plugin": "0.3.120",
30
30
  "@types/node": "24.13.3",
31
31
  "typescript": "5.9.3",
32
- "vitest": "4.1.10"
32
+ "vitest": "4.1.11"
33
33
  },
34
34
  "license": "MIT",
35
35
  "repository": {
@@ -30,7 +30,7 @@
30
30
  "@tsrx/typescript-plugin": "0.3.120",
31
31
  "@types/node": "24.13.3",
32
32
  "typescript": "5.9.3",
33
- "vitest": "4.1.10"
33
+ "vitest": "4.1.11"
34
34
  },
35
35
  "license": "MIT",
36
36
  "repository": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowdular/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "Flowdular platform SDK: server, client, UI, data, agents and core modules through separate exports.",
6
6
  "license": "MIT",
@@ -22,7 +22,6 @@
22
22
  "./ui/styles": "./packages/ui/src/styles/index.css",
23
23
  "./database": "./packages/database/src/index.ts",
24
24
  "./database/postgresql": "./packages/database/src/postgresql.ts",
25
- "./coding-agent": "./packages/coding-agent/src/index.ts",
26
25
  "./database-testing": "./packages/database-testing/src/index.ts",
27
26
  "./database-testing/vitest": "./packages/database-testing/src/vitest-preset.ts",
28
27
  "./ai-provider": "./packages/ai-provider/src/index.ts",
@@ -38,8 +37,6 @@
38
37
  "./harness/tool-adapters": "./packages/harness/src/tool-adapters.ts",
39
38
  "./harness/catalog": "./packages/harness/src/catalog.ts",
40
39
  "./harness/schema": "./packages/harness/schemas/task-packet.schema.json",
41
- "./sandbox": "./packages/sandbox/src/index.ts",
42
- "./sandbox/server": "./packages/sandbox/src/server/index.ts",
43
40
  "./database-pglite": "./packages/database-pglite/src/index.ts",
44
41
  "./dev-console": "./packages/dev-console/src/index.mjs",
45
42
  "./client": "./packages/client/src/index.ts",
@@ -101,8 +98,6 @@
101
98
  "@octanejs/tanstack-table": "0.1.51",
102
99
  "chart.js": "^4.5.1",
103
100
  "octane": "0.1.51",
104
- "ai": "7.0.85",
105
- "yaml": "2.9.0",
106
101
  "pg": "8.23.0",
107
102
  "@types/pg": "8.23.1",
108
103
  "@ai-sdk/anthropic": "4.0.46",
@@ -110,16 +105,13 @@
110
105
  "@ai-sdk/gateway": "4.0.69",
111
106
  "@ai-sdk/openai": "4.0.52",
112
107
  "@ai-sdk/openai-compatible": "3.0.41",
108
+ "ai": "7.0.85",
113
109
  "@octanejs/app-core": "0.0.47",
110
+ "@electric-sql/pglite": "0.5.8",
114
111
  "@octanejs/seo": "0.0.38",
115
- "@octanejs/vite-plugin": "0.1.51",
116
112
  "segment-state": "0.2.0",
117
- "vite": "8.2.2",
118
- "@electric-sql/pglite": "0.5.8",
119
113
  "semver": "7.7.4",
120
- "@types/semver": "7.7.1"
121
- },
122
- "bin": {
123
- "flowdular-sandbox": "./packages/sandbox/bin/flowdular-sandbox.mjs"
114
+ "@types/semver": "7.7.1",
115
+ "yaml": "2.9.0"
124
116
  }
125
117
  }
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "typescript": "5.9.3",
24
- "vitest": "4.1.10"
24
+ "vitest": "4.1.11"
25
25
  },
26
26
  "license": "MIT",
27
27
  "repository": {
@@ -15,7 +15,7 @@
15
15
  "devDependencies": {
16
16
  "@types/node": "24.13.3",
17
17
  "typescript": "5.9.3",
18
- "vitest": "4.1.10"
18
+ "vitest": "4.1.11"
19
19
  },
20
20
  "license": "MIT",
21
21
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "devDependencies": {
22
22
  "@tsrx/typescript-plugin": "0.3.120",
23
23
  "typescript": "5.9.3",
24
- "vitest": "4.1.10"
24
+ "vitest": "4.1.11"
25
25
  },
26
26
  "license": "MIT",
27
27
  "repository": {
@@ -2,8 +2,45 @@ let basePath = '/app';
2
2
 
3
3
  /** Installation-wide value emitted by the CLI, never a request/tenant setting. */
4
4
  export function configureApplicationRouting(path: string): void {
5
- if (!/^\/[a-z][a-z0-9-]*$/.test(path) || ['auth', 'api', 'sites', 'sign-in', 'sign-up', 'forgot-password', 'reset-password', 'accept-invitation'].includes(path.slice(1))) throw new Error('Invalid application path.');
5
+ if (
6
+ path.length > 64 ||
7
+ !/^\/[a-z][a-z0-9-]*$/.test(path) ||
8
+ [
9
+ 'setup',
10
+ 'health',
11
+ 'ready',
12
+ 'assets',
13
+ 'auth',
14
+ 'api',
15
+ 'sites',
16
+ 'sign-in',
17
+ 'sign-up',
18
+ 'forgot-password',
19
+ 'reset-password',
20
+ 'accept-invitation',
21
+ ].includes(path.slice(1))
22
+ )
23
+ throw new Error('Invalid application path.');
6
24
  basePath = path;
7
25
  }
8
26
 
9
- export function applicationPath(): string { return basePath; }
27
+ export function applicationPath(): string {
28
+ return basePath;
29
+ }
30
+
31
+ /** Select the server's installation setting during SSR and browser hydration. */
32
+ export function configureApplicationFromPage(
33
+ props: { readonly state?: Map<string, unknown> } | undefined,
34
+ fallback = '/app',
35
+ ): void {
36
+ let path = props?.state?.get('flowdular.application.path');
37
+ if (path === undefined && typeof document !== 'undefined') {
38
+ const data = document.getElementById(
39
+ 'flowdular-application-data',
40
+ )?.textContent;
41
+ if (data) path = JSON.parse(data);
42
+ }
43
+ if (path !== undefined && typeof path !== 'string')
44
+ throw new Error('Invalid application path.');
45
+ configureApplicationRouting(path ?? fallback);
46
+ }
@@ -3,7 +3,11 @@ import { BrandMark } from '@flowdular/sdk/ui';
3
3
  import { t } from '../i18n/runtime.ts';
4
4
 
5
5
  export function SidebarBrand() @{
6
- <a class="sidebar__home" href={applicationPath()} aria-label={t('shell.brand.home')}>
6
+ <a
7
+ class="sidebar__home"
8
+ href={applicationPath()}
9
+ aria-label={t('shell.brand.home')}
10
+ >
7
11
  <BrandMark size={22} />
8
12
  <span class="sidebar__wordmark">Flowdular</span>
9
13
  </a>
@@ -62,7 +62,9 @@ export function viewHref(
62
62
  viewId: ShellView,
63
63
  workspaceSlug?: string | null,
64
64
  ): string {
65
- const base = workspaceSlug ? applicationPath() + '/' + workspaceSlug : applicationPath();
65
+ const base = workspaceSlug
66
+ ? applicationPath() + '/' + workspaceSlug
67
+ : applicationPath();
66
68
  if (viewId === 'overview') return base;
67
69
  return base + '/' + viewId;
68
70
  }
@@ -20,7 +20,11 @@ export function toggleNavigationGroup(
20
20
  export function shellViewFromUrl(value: string): ShellView {
21
21
  const pathname = new URL(value, 'https://flowdular.local').pathname;
22
22
  const segments = pathname.split('/').filter(Boolean);
23
- return ((segments[0] === applicationPath().slice(1) || segments[0] === 'app') ? segments[2] : segments[0]) ?? 'overview';
23
+ return (
24
+ (segments[0] === applicationPath().slice(1) || segments[0] === 'app'
25
+ ? segments[2]
26
+ : segments[0]) ?? 'overview'
27
+ );
24
28
  }
25
29
 
26
30
  /* Canonical workspace URLs live below /app. Slug-first and view-only links are
@@ -31,7 +35,7 @@ export function shellLocationFromUrl(
31
35
  ): ShellLocation {
32
36
  const pathname = new URL(value, 'https://flowdular.local').pathname;
33
37
  const segments = pathname.split('/').filter(Boolean);
34
- if ((segments[0] === applicationPath().slice(1) || segments[0] === 'app')) {
38
+ if (segments[0] === applicationPath().slice(1) || segments[0] === 'app') {
35
39
  const workspace = segments[1];
36
40
  if (workspace !== undefined && knownWorkspaceSlugs.includes(workspace)) {
37
41
  return { workspaceSlug: workspace, view: segments[2] ?? 'overview' };
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "typescript": "5.9.3",
16
- "vitest": "4.1.10"
16
+ "vitest": "4.1.11"
17
17
  },
18
18
  "license": "MIT",
19
19
  "repository": {
@@ -25,10 +25,7 @@
25
25
  "specs": {
26
26
  "type": "object",
27
27
  "additionalProperties": false,
28
- "required": [
29
- "platformRoot",
30
- "moduleDirectory"
31
- ],
28
+ "required": ["platformRoot", "moduleDirectory"],
32
29
  "properties": {
33
30
  "platformRoot": {
34
31
  "type": "string",
@@ -43,10 +40,7 @@
43
40
  "modules": {
44
41
  "type": "object",
45
42
  "additionalProperties": false,
46
- "required": [
47
- "roots",
48
- "enabled"
49
- ],
43
+ "required": ["roots", "enabled"],
50
44
  "properties": {
51
45
  "roots": {
52
46
  "type": "array",
@@ -79,11 +73,7 @@
79
73
  "agent": {
80
74
  "type": "object",
81
75
  "additionalProperties": false,
82
- "required": [
83
- "policy",
84
- "blueprints",
85
- "modelRouting"
86
- ],
76
+ "required": ["policy", "blueprints", "modelRouting"],
87
77
  "properties": {
88
78
  "policy": {
89
79
  "type": "string",
@@ -135,17 +125,10 @@
135
125
  "$ref": "#/$defs/gitName"
136
126
  },
137
127
  "provider": {
138
- "enum": [
139
- "github",
140
- "none"
141
- ]
128
+ "enum": ["github", "none"]
142
129
  },
143
130
  "mode": {
144
- "enum": [
145
- "auto",
146
- "direct",
147
- "fork"
148
- ]
131
+ "enum": ["auto", "direct", "fork"]
149
132
  },
150
133
  "forkOwner": {
151
134
  "$ref": "#/$defs/githubAccount"
@@ -171,9 +154,7 @@
171
154
  "web": {
172
155
  "type": "object",
173
156
  "additionalProperties": false,
174
- "required": [
175
- "mounts"
176
- ],
157
+ "required": ["mounts"],
177
158
  "properties": {
178
159
  "mounts": {
179
160
  "type": "array",
@@ -181,13 +162,7 @@
181
162
  "items": {
182
163
  "type": "object",
183
164
  "additionalProperties": false,
184
- "required": [
185
- "id",
186
- "moduleId",
187
- "surfaceId",
188
- "path",
189
- "tenantId"
190
- ],
165
+ "required": ["id", "moduleId", "surfaceId", "path", "tenantId"],
191
166
  "properties": {
192
167
  "id": {
193
168
  "type": "string",
@@ -222,9 +197,7 @@
222
197
  "application": {
223
198
  "type": "object",
224
199
  "additionalProperties": false,
225
- "required": [
226
- "path"
227
- ],
200
+ "required": ["path"],
228
201
  "properties": {
229
202
  "path": {
230
203
  "type": "string",
@@ -238,20 +211,21 @@
238
211
  "/sign-up",
239
212
  "/forgot-password",
240
213
  "/reset-password",
241
- "/accept-invitation"
214
+ "/accept-invitation",
215
+ "/setup",
216
+ "/health",
217
+ "/ready",
218
+ "/assets"
242
219
  ]
243
- }
220
+ },
221
+ "maxLength": 64
244
222
  }
245
223
  }
246
224
  }
247
225
  },
248
226
  "$defs": {
249
227
  "deliveryTarget": {
250
- "enum": [
251
- "workspace",
252
- "git-pr",
253
- "official-modules"
254
- ]
228
+ "enum": ["workspace", "git-pr", "official-modules"]
255
229
  },
256
230
  "gitName": {
257
231
  "type": "string",
@@ -18,7 +18,7 @@
18
18
  "@flowdular/database-testing": "workspace:*",
19
19
  "@types/node": "24.13.3",
20
20
  "typescript": "5.9.3",
21
- "vitest": "4.1.10"
21
+ "vitest": "4.1.11"
22
22
  },
23
23
  "license": "MIT",
24
24
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowdular/database-pglite",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -17,7 +17,7 @@
17
17
  "@flowdular/database-testing": "workspace:*",
18
18
  "@types/node": "24.13.3",
19
19
  "typescript": "5.9.3",
20
- "vitest": "4.1.10"
20
+ "vitest": "4.1.11"
21
21
  },
22
22
  "license": "MIT",
23
23
  "repository": {
@@ -81,22 +81,40 @@ export function createPgliteCluster(
81
81
  const close = (): Promise<void> => {
82
82
  closePromise ??= (async () => {
83
83
  if (!databasePromise) return;
84
- const instance = await databasePromise;
84
+ // A failed initialization has no database to close; its caller already
85
+ // received the original error. Do not replace it during disposal.
86
+ const instance = await databasePromise.catch(() => undefined);
85
87
  databasePromise = undefined;
86
- await instance.close();
88
+ await instance?.close();
87
89
  })();
88
90
  return closePromise;
89
91
  };
90
92
 
91
93
  const database = async (): Promise<PGlite> => {
92
94
  databasePromise ??= (async () => {
95
+ if (options.dataDirectory) {
96
+ const { mkdir } = await import('node:fs/promises');
97
+ await mkdir(options.dataDirectory, { recursive: true, mode: 0o700 });
98
+ }
93
99
  const created = options.dataDirectory
94
100
  ? await PGlite.create({
95
101
  dataDir: options.dataDirectory,
96
102
  parsers: SERVER_PARSERS,
97
103
  })
98
104
  : await PGlite.create({ parsers: SERVER_PARSERS });
99
- if (options.bootstrap) await created.exec(options.bootstrap);
105
+ try {
106
+ if (options.bootstrap) await created.exec(options.bootstrap);
107
+ } catch (error) {
108
+ try {
109
+ await created.close();
110
+ } catch (closeError) {
111
+ throw new AggregateError(
112
+ [error, closeError],
113
+ 'PGlite bootstrap failed and cleanup also failed.',
114
+ );
115
+ }
116
+ throw error;
117
+ }
100
118
  return created;
101
119
  })();
102
120
  return databasePromise;
@@ -19,7 +19,7 @@
19
19
  "devDependencies": {
20
20
  "@types/node": "24.13.3",
21
21
  "typescript": "5.9.3",
22
- "vitest": "4.1.10"
22
+ "vitest": "4.1.11"
23
23
  },
24
24
  "license": "MIT",
25
25
  "repository": {