@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
@@ -1,251 +0,0 @@
1
- import { createRequire } from 'node:module';
2
- import {
3
- access,
4
- cp,
5
- mkdir,
6
- readFile,
7
- readdir,
8
- writeFile,
9
- } from 'node:fs/promises';
10
- import { dirname, join, relative } from 'node:path';
11
-
12
- async function referenceSource(
13
- workspaceRoot: string,
14
- path: string,
15
- ): Promise<string> {
16
- const local = join(workspaceRoot, path);
17
- try {
18
- await access(local);
19
- return local;
20
- } catch {
21
- /* Use installed SDK references. */
22
- }
23
- try {
24
- const require = createRequire(join(workspaceRoot, 'platform/package.json'));
25
- return join(dirname(require.resolve('@flowdular/sdk/package.json')), path);
26
- } catch {
27
- return local;
28
- }
29
- }
30
-
31
- /* A coding agent may only read inside its session workspace. Without the
32
- platform contracts it would either invent an architecture or stop, so every
33
- session gets a read-only copy of the contracts it must implement against and
34
- one complete example module. */
35
- const REFERENCE_SOURCES: readonly {
36
- readonly from: string;
37
- readonly to: string;
38
- }[] = [
39
- { from: 'packages/server/src', to: 'reference/packages/server/src' },
40
- {
41
- from: 'packages/client/src/contributions.ts',
42
- to: 'reference/packages/client/contributions.ts',
43
- },
44
- {
45
- from: 'packages/client/src/state.ts',
46
- to: 'reference/packages/client/state.ts',
47
- },
48
- {
49
- from: 'packages/contracts/src/index.ts',
50
- to: 'reference/packages/contracts/index.ts',
51
- },
52
- {
53
- from: 'packages/contracts/schemas',
54
- to: 'reference/packages/contracts/schemas',
55
- },
56
- { from: 'packages/ui/src/index.ts', to: 'reference/packages/ui/index.ts' },
57
- {
58
- from: 'packages/ui/src/components',
59
- to: 'reference/packages/ui/components',
60
- },
61
- {
62
- from: 'packages/ui/src/styles/components.css',
63
- to: 'reference/packages/ui/components.css',
64
- },
65
- /* Outside a modules/ path, so the workspace module walker never mistakes
66
- the example for a real module of this session. */
67
- { from: '.ai/references/catalog', to: 'reference/example-module' },
68
- { from: 'modules/profile', to: 'reference/adapter-module' },
69
- { from: 'modules/auth/src/index.ts', to: 'reference/auth-core/index.ts' },
70
- {
71
- from: 'modules/auth/src/acl/scopes.ts',
72
- to: 'reference/auth-core/scopes.ts',
73
- },
74
- {
75
- from: 'modules/auth/src/domain/types.ts',
76
- to: 'reference/auth-core/types.ts',
77
- },
78
- {
79
- from: 'modules/auth/src/server/index.ts',
80
- to: 'reference/auth-core/server.ts',
81
- },
82
- {
83
- from: 'modules/auth/src/server/composition.ts',
84
- to: 'reference/auth-core/composition.ts',
85
- },
86
- {
87
- from: 'modules/auth/src/services/auth-service.ts',
88
- to: 'reference/auth-core/auth-service.ts',
89
- },
90
- { from: 'AGENTS.md', to: 'reference/AGENTS.md' },
91
- { from: 'docs/design-system.md', to: 'reference/design-system.md' },
92
- { from: 'docs/agent-contract.md', to: 'reference/agent-contract.md' },
93
- { from: '.ai/skills', to: 'reference/skills' },
94
- ];
95
-
96
- export const SKILLS_DIRECTORY = '.ai/skills';
97
-
98
- const EXCLUDED = new Set(['node_modules', 'dist', '.turbo']);
99
-
100
- function readme(skills: readonly string[]): string {
101
- return `# Reference
102
-
103
- Read-only copies of the platform contracts this session must implement against.
104
- Never edit anything in this directory: it is not part of the module and it is
105
- not ejected.
106
-
107
- - packages/server: defineEndpoint, HTTP helpers, and the endpoint identity contract.
108
- - packages/client: the client contribution contract (createClientContribution, ModuleClientContext), shell slots, and shell state.
109
- - packages/contracts: module manifest, spec, and blueprint schemas.
110
- - packages/ui: every shared primitive and the ui-* class list.
111
- - example-module: a complete module, from ACL to client view, including src/platform.ts. Follow its shape.
112
- - adapter-module: the same shape on the @flowdular/sdk/database provider contract, with an async repository, dialect-explicit migrations and a lease-owning runtime. Follow it when the module stores data.
113
- - auth-core: the public surface of auth.core, including its scopes, the PlatformServerContext composition contract, and its service API.
114
- - AGENTS.md and design-system.md: the workspace rules that gates enforce.
115
- - agent-contract.md: detailed lookup reference, not required reading.
116
- - skills: read only the Task skill named in your Session instruction. Other files are available for later tasks, not for preloading.
117
-
118
- ## Skills
119
-
120
- ${skills.length > 0 ? skills.map((skill) => `- skills/${skill}/SKILL.md`).join('\n') : '- none available in this workspace'}
121
- `;
122
- }
123
-
124
- /* Skill names are the directories under .ai/skills that carry a SKILL.md. */
125
- export async function listSkills(
126
- workspaceRoot: string,
127
- ): Promise<readonly string[]> {
128
- let entries: readonly string[];
129
- try {
130
- entries = await readdir(
131
- await referenceSource(workspaceRoot, SKILLS_DIRECTORY),
132
- );
133
- } catch {
134
- return [];
135
- }
136
- const skills: string[] = [];
137
- for (const entry of [...entries].sort()) {
138
- try {
139
- await readFile(
140
- await referenceSource(
141
- workspaceRoot,
142
- join(SKILLS_DIRECTORY, entry, 'SKILL.md'),
143
- ),
144
- );
145
- skills.push(entry);
146
- } catch {
147
- continue;
148
- }
149
- }
150
- return skills;
151
- }
152
-
153
- export async function materializeReference(
154
- workspaceRoot: string,
155
- sessionWorkspace: string,
156
- ): Promise<readonly string[]> {
157
- for (const source of REFERENCE_SOURCES) {
158
- const target = join(sessionWorkspace, source.to);
159
- await mkdir(dirname(target), { recursive: true });
160
- const from = await referenceSource(workspaceRoot, source.from);
161
- await cp(from, target, {
162
- recursive: true,
163
- filter: (path) =>
164
- !relative(from, path)
165
- .split('/')
166
- .some((segment) => EXCLUDED.has(segment)),
167
- }).catch(() => undefined);
168
- }
169
- const skills = await listSkills(workspaceRoot);
170
- await writeFile(
171
- join(sessionWorkspace, 'reference/README.md'),
172
- readme(skills),
173
- 'utf8',
174
- );
175
- return skills;
176
- }
177
-
178
- /* Local coding agents auto-load a file from the working directory: claude
179
- reads CLAUDE.md, codex reads AGENTS.md. Neither is the role instruction,
180
- which the driver passes explicitly; they only point at the reference. */
181
- export async function writeAgentPointer(
182
- sessionWorkspace: string,
183
- fileName: 'CLAUDE.md' | 'AGENTS.md',
184
- roleName: string,
185
- skill?: string | null,
186
- ): Promise<void> {
187
- await writeFile(
188
- join(sessionWorkspace, fileName),
189
- [
190
- '# Sandbox session workspace',
191
- '',
192
- `You work here as ${roleName}. The role instruction you were started with is authoritative.`,
193
- '',
194
- skill
195
- ? `- Read only reference/skills/${skill}/SKILL.md for this task. Do not load other skills or the whole reference catalog.`
196
- : '- No matching task skill is installed. Do not load unrelated skills.',
197
- '- Write only inside your module directory under modules/, in the paths the instruction allows. Everything under reference/ is read-only.',
198
- '- End your final message with the HANDOFF line the instruction describes.',
199
- '',
200
- ].join('\n'),
201
- 'utf8',
202
- );
203
- }
204
-
205
- /* The module registry validates dependencies, so the session workspace carries
206
- the manifest of every enabled module. Only the draft modules have sources. */
207
- export async function materializeModuleGraph(
208
- workspaceRoot: string,
209
- sessionWorkspace: string,
210
- draftModuleIds: readonly string[],
211
- ): Promise<readonly string[]> {
212
- const drafts = new Set(draftModuleIds);
213
- const enabled: string[] = [];
214
- let entries: readonly string[] = [];
215
- try {
216
- entries = await readdir(join(workspaceRoot, 'modules'));
217
- } catch {
218
- return enabled;
219
- }
220
- for (const entry of entries) {
221
- const manifestPath = join(workspaceRoot, 'modules', entry, 'module.json');
222
- let manifest: { id?: string; cli?: unknown };
223
- try {
224
- manifest = JSON.parse(await readFile(manifestPath, 'utf8')) as {
225
- id?: string;
226
- };
227
- } catch {
228
- continue;
229
- }
230
- if (!manifest.id || drafts.has(manifest.id)) continue;
231
- const target = join(sessionWorkspace, 'modules', entry, 'module.json');
232
- await mkdir(dirname(target), { recursive: true });
233
- /* Only the dependency graph travels into a session. A CLI declaration
234
- would point at command files this workspace does not carry, so the
235
- capability goes with it. */
236
- const { cli: _cli, ...rest } = manifest as Record<string, unknown>;
237
- const graphManifest = {
238
- ...rest,
239
- capabilities: (
240
- (rest.capabilities as readonly string[] | undefined) ?? []
241
- ).filter((capability) => capability !== 'cli'),
242
- };
243
- await writeFile(
244
- target,
245
- `${JSON.stringify(graphManifest, null, '\t')}\n`,
246
- 'utf8',
247
- );
248
- enabled.push(manifest.id);
249
- }
250
- return enabled;
251
- }