@flowdular/sandbox 0.2.8 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/bin/flowdular-sandbox.mjs +35 -1
- package/internal/coding-agent/src/index.ts +6 -1
- package/internal/coding-agent/src/roles/defaults.ts +5 -1
- package/internal/coding-agent/src/roles/skills.ts +42 -6
- package/internal/coding-agent/src/workspace.ts +4 -0
- package/package.json +3 -3
- package/src/App.tsrx +46 -0
- package/src/client/ChatPane.tsrx +73 -12
- package/src/client/PendingQuestionsCard.tsrx +193 -0
- package/src/client/api.ts +55 -23
- package/src/client/locales/en.json +11 -0
- package/src/client/locales/pl.json +11 -0
- package/src/client/state.ts +21 -0
- package/src/server/preview-runtime.ts +58 -6
- package/src/server/preview-worker-manager.ts +1 -0
- package/src/server/preview-worker.ts +6 -3
- package/src/server/questions.ts +356 -0
- package/src/server/reference.ts +27 -1
- package/src/server/routes.ts +70 -0
- package/src/server/sessions.ts +7 -0
- package/src/server/turns.ts +44 -2
- package/src/server/workspace-install.ts +19 -30
|
@@ -4,6 +4,7 @@ import { access, cp, readFile, readdir, writeFile } from 'node:fs/promises';
|
|
|
4
4
|
import { dirname, join } from 'node:path';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
6
6
|
import type { SessionModule } from './sessions.ts';
|
|
7
|
+
import { parseDocument } from 'yaml';
|
|
7
8
|
|
|
8
9
|
export interface InstallResult {
|
|
9
10
|
readonly ran: boolean;
|
|
@@ -36,10 +37,6 @@ async function packageName(directory: string): Promise<string | null> {
|
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
function yamlString(value: string): string {
|
|
40
|
-
return `'${value.replace(/'/g, "''")}'`;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
40
|
/* A session workspace is a pnpm workspace of its own: the draft modules are its
|
|
44
41
|
projects, every other workspace package is linked to the live checkout, and
|
|
45
42
|
the host lockfile seeds the resolution so the session installs exactly the
|
|
@@ -57,7 +54,7 @@ export async function materializeSessionWorkspace(options: {
|
|
|
57
54
|
);
|
|
58
55
|
if (name) draft.add(name);
|
|
59
56
|
}
|
|
60
|
-
const overrides: string
|
|
57
|
+
const overrides: Record<string, string> = {};
|
|
61
58
|
for (const group of ['packages', 'modules']) {
|
|
62
59
|
let entries: readonly string[] = [];
|
|
63
60
|
try {
|
|
@@ -69,9 +66,7 @@ export async function materializeSessionWorkspace(options: {
|
|
|
69
66
|
const directory = join(options.workspaceRoot, group, entry);
|
|
70
67
|
const name = await packageName(directory);
|
|
71
68
|
if (!name || draft.has(name)) continue;
|
|
72
|
-
overrides
|
|
73
|
-
` ${yamlString(name)}: ${yamlString(`link:${directory}`)}`,
|
|
74
|
-
);
|
|
69
|
+
overrides[name] = `link:${directory}`;
|
|
75
70
|
}
|
|
76
71
|
}
|
|
77
72
|
|
|
@@ -89,7 +84,7 @@ export async function materializeSessionWorkspace(options: {
|
|
|
89
84
|
if (typeof sdk.version !== 'string')
|
|
90
85
|
throw new Error('Invalid installed SDK version.');
|
|
91
86
|
sdkVersion = sdk.version;
|
|
92
|
-
overrides
|
|
87
|
+
overrides['@flowdular/sdk'] = `link:${sdkRoot}`;
|
|
93
88
|
} catch (error) {
|
|
94
89
|
if (
|
|
95
90
|
!['MODULE_NOT_FOUND', 'ERR_PACKAGE_PATH_NOT_EXPORTED'].includes(
|
|
@@ -132,29 +127,23 @@ export async function materializeSessionWorkspace(options: {
|
|
|
132
127
|
join(options.workspaceRoot, 'pnpm-workspace.yaml'),
|
|
133
128
|
'utf8',
|
|
134
129
|
).catch(() => '');
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
|
|
130
|
+
// Edit YAML structurally so lists, custom package globs and host overrides
|
|
131
|
+
// cannot spill into an unrelated setting when a top-level key is replaced.
|
|
132
|
+
const workspaceDocument = parseDocument(hostWorkspace);
|
|
133
|
+
if (workspaceDocument.errors.length > 0) throw workspaceDocument.errors[0];
|
|
134
|
+
workspaceDocument.set('packages', ['modules/*']);
|
|
135
|
+
workspaceDocument.set('allowUnusedPatches', true);
|
|
136
|
+
for (const name of draft) {
|
|
137
|
+
if (workspaceDocument.hasIn(['overrides', name])) {
|
|
138
|
+
workspaceDocument.deleteIn(['overrides', name]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
for (const [name, target] of Object.entries(overrides)) {
|
|
142
|
+
workspaceDocument.setIn(['overrides', name], target);
|
|
143
|
+
}
|
|
144
144
|
await writeFile(
|
|
145
145
|
join(options.sessionWorkspace, 'pnpm-workspace.yaml'),
|
|
146
|
-
|
|
147
|
-
'packages:',
|
|
148
|
-
' - modules/*',
|
|
149
|
-
/* Host patches travel along even when no draft depends on the patched
|
|
150
|
-
package; pnpm must not treat that as an error. */
|
|
151
|
-
'allowUnusedPatches: true',
|
|
152
|
-
carried,
|
|
153
|
-
'overrides:',
|
|
154
|
-
...overrides,
|
|
155
|
-
]
|
|
156
|
-
.filter(Boolean)
|
|
157
|
-
.join('\n')}\n`,
|
|
146
|
+
workspaceDocument.toString(),
|
|
158
147
|
'utf8',
|
|
159
148
|
);
|
|
160
149
|
for (const shared of ['pnpm-lock.yaml', 'patches']) {
|