@flowdular/sandbox 0.2.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.
Files changed (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +696 -0
  3. package/bin/flowdular-sandbox.mjs +394 -0
  4. package/bin/register-types.mjs +53 -0
  5. package/dist/client/assets/App-ClMOrpyg.js +11 -0
  6. package/dist/client/assets/PreviewHost-BHiHrfbQ.js +1 -0
  7. package/dist/client/assets/auto-buGEq6de.js +3 -0
  8. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  9. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  10. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  11. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  12. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  13. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  14. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  15. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  16. package/dist/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  17. package/dist/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  18. package/dist/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  19. package/dist/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  20. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  21. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  22. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  23. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  24. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  25. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  26. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  27. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  28. package/dist/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  29. package/dist/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  30. package/dist/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  31. package/dist/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  32. package/dist/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  33. package/dist/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  34. package/dist/client/assets/index-CvwhlQ87.js +4 -0
  35. package/dist/client/assets/styles-BPWaGf55.js +3 -0
  36. package/dist/client/assets/styles-Dx1_KOag.css +1 -0
  37. package/dist/client/favicon.svg +1 -0
  38. package/dist/server/assets/auto-CVGNYyb3.js +12785 -0
  39. package/dist/server/assets/chunk-DDJLRBDX-3OUNo51g.js +4125 -0
  40. package/dist/server/assets/nodefs-DVSI7kG0.js +24 -0
  41. package/dist/server/assets/opfs-ahp-D56iokt1.js +388 -0
  42. package/dist/server/assets/token-Bvaq7Anz.js +55 -0
  43. package/dist/server/assets/token-util-BqSvdIPQ.js +3 -0
  44. package/dist/server/assets/token-util-CktFFT4z.js +494 -0
  45. package/dist/server/entry.js +91671 -0
  46. package/dist/server/favicon.svg +1 -0
  47. package/dist/server/index.html +161 -0
  48. package/index.html +159 -0
  49. package/internal/coding-agent/package.json +44 -0
  50. package/internal/coding-agent/src/drivers/byok.ts +322 -0
  51. package/internal/coding-agent/src/drivers/claude-code.ts +290 -0
  52. package/internal/coding-agent/src/drivers/codex.ts +281 -0
  53. package/internal/coding-agent/src/index.ts +56 -0
  54. package/internal/coding-agent/src/registry.ts +119 -0
  55. package/internal/coding-agent/src/roles/contract.ts +60 -0
  56. package/internal/coding-agent/src/roles/defaults.ts +134 -0
  57. package/internal/coding-agent/src/roles/handoff.ts +41 -0
  58. package/internal/coding-agent/src/roles/registry.ts +156 -0
  59. package/internal/coding-agent/src/roles/skills.ts +72 -0
  60. package/internal/coding-agent/src/roles/sync.ts +88 -0
  61. package/internal/coding-agent/src/types.ts +102 -0
  62. package/internal/coding-agent/src/workspace.ts +275 -0
  63. package/octane.config.ts +36 -0
  64. package/package.json +68 -0
  65. package/public/favicon.svg +1 -0
  66. package/public/og.png +0 -0
  67. package/src/App.tsrx +924 -0
  68. package/src/client/ApprovalHandoff.tsrx +39 -0
  69. package/src/client/ChatPane.tsrx +694 -0
  70. package/src/client/ConnectView.tsrx +86 -0
  71. package/src/client/DiffPane.tsrx +150 -0
  72. package/src/client/EjectModal.tsrx +571 -0
  73. package/src/client/GateResults.tsrx +60 -0
  74. package/src/client/GitHubSettingsModal.tsrx +219 -0
  75. package/src/client/NewSessionForm.tsrx +214 -0
  76. package/src/client/SessionBar.tsrx +151 -0
  77. package/src/client/SessionPicker.tsrx +472 -0
  78. package/src/client/SpecEditor.tsrx +109 -0
  79. package/src/client/SpecReviewCard.tsrx +321 -0
  80. package/src/client/WorkCard.tsrx +128 -0
  81. package/src/client/WorkbenchModal.tsrx +161 -0
  82. package/src/client/WorkspaceMenu.tsrx +100 -0
  83. package/src/client/api.ts +797 -0
  84. package/src/client/attachments.ts +73 -0
  85. package/src/client/dashboard.ts +46 -0
  86. package/src/client/github-settings.ts +48 -0
  87. package/src/client/highlight.ts +105 -0
  88. package/src/client/i18n.ts +32 -0
  89. package/src/client/locales/en.json +466 -0
  90. package/src/client/locales/pl.json +466 -0
  91. package/src/client/session-labels.ts +77 -0
  92. package/src/client/state.ts +108 -0
  93. package/src/index.ts +10 -0
  94. package/src/preview/PreviewHost.tsrx +373 -0
  95. package/src/preview/load-module.ts +16 -0
  96. package/src/server/attachments.ts +308 -0
  97. package/src/server/auto-review.ts +181 -0
  98. package/src/server/checkpoints.ts +90 -0
  99. package/src/server/config.ts +460 -0
  100. package/src/server/dashboard.ts +245 -0
  101. package/src/server/delivery/configuration.ts +193 -0
  102. package/src/server/delivery/git-pr.ts +1473 -0
  103. package/src/server/delivery/index.ts +83 -0
  104. package/src/server/delivery/local.ts +151 -0
  105. package/src/server/delivery/official-modules.ts +516 -0
  106. package/src/server/delivery/plan.ts +218 -0
  107. package/src/server/delivery/policies.ts +239 -0
  108. package/src/server/delivery/record.ts +41 -0
  109. package/src/server/delivery/steps.ts +464 -0
  110. package/src/server/delivery/types.ts +158 -0
  111. package/src/server/dependencies.ts +88 -0
  112. package/src/server/diff.ts +230 -0
  113. package/src/server/gates.ts +388 -0
  114. package/src/server/index.ts +139 -0
  115. package/src/server/path-guard.ts +282 -0
  116. package/src/server/planning.ts +749 -0
  117. package/src/server/platform-client.ts +189 -0
  118. package/src/server/preview-database-host.ts +340 -0
  119. package/src/server/preview-database-protocol.ts +163 -0
  120. package/src/server/preview-database-proxy.ts +356 -0
  121. package/src/server/preview-database.ts +109 -0
  122. package/src/server/preview-ipc.ts +15 -0
  123. package/src/server/preview-modules.ts +83 -0
  124. package/src/server/preview-revision.ts +44 -0
  125. package/src/server/preview-runtime.ts +467 -0
  126. package/src/server/preview-worker-manager.ts +477 -0
  127. package/src/server/preview-worker.ts +168 -0
  128. package/src/server/reference.ts +251 -0
  129. package/src/server/routes.ts +2258 -0
  130. package/src/server/runtime.ts +188 -0
  131. package/src/server/session-owner.ts +23 -0
  132. package/src/server/sessions.ts +849 -0
  133. package/src/server/spec.ts +471 -0
  134. package/src/server/turn-lifecycle.ts +56 -0
  135. package/src/server/turns.ts +993 -0
  136. package/src/server/workspace-install.ts +266 -0
  137. package/src/server/workspace-root.ts +73 -0
  138. package/src/styles.css +1573 -0
  139. package/vite.config.ts +134 -0
@@ -0,0 +1,83 @@
1
+ import { createOfficialModulesDeliveryTarget } from './official-modules.ts';
2
+ import { SandboxSetupError } from '../workspace-root.ts';
3
+ import { createGitPullRequestDeliveryTarget } from './git-pr.ts';
4
+ import { createLocalDeliveryTarget } from './local.ts';
5
+ import type { DeliveryTarget, EjectTarget } from './types.ts';
6
+
7
+ const TARGETS: Readonly<Record<EjectTarget, () => DeliveryTarget>> = {
8
+ workspace: createLocalDeliveryTarget,
9
+ 'git-pr': createGitPullRequestDeliveryTarget,
10
+ 'official-modules': createOfficialModulesDeliveryTarget,
11
+ };
12
+
13
+ export function isEjectTarget(value: string): value is EjectTarget {
14
+ return Object.hasOwn(TARGETS, value);
15
+ }
16
+
17
+ export function assertEjectTarget(value: string): EjectTarget {
18
+ if (!isEjectTarget(value)) {
19
+ throw new SandboxSetupError(
20
+ 'EJECT_TARGET_UNSUPPORTED',
21
+ `The ${value} eject target is not implemented in this sandbox yet. Use workspace, git-pr or official-modules.`,
22
+ );
23
+ }
24
+ return value;
25
+ }
26
+
27
+ /* The request names where the delivery should land; this is the only place
28
+ that knows which implementation answers for it. */
29
+ export function resolveDeliveryTarget(target: string): DeliveryTarget {
30
+ return TARGETS[assertEjectTarget(target)]();
31
+ }
32
+
33
+ export {
34
+ DEFAULT_DELIVERY_CONFIGURATION,
35
+ readDeliveryConfiguration,
36
+ resolveDeliveryConfiguration,
37
+ } from './configuration.ts';
38
+ export type {
39
+ DeliveryConfiguration,
40
+ GitDeliveryConfiguration,
41
+ } from './configuration.ts';
42
+ export { createGitPullRequestDeliveryTarget } from './git-pr.ts';
43
+ export {
44
+ loadPathOwnership,
45
+ loadTaskBudgets,
46
+ matchesPath,
47
+ ownerOf,
48
+ parsePolicyYaml,
49
+ } from './policies.ts';
50
+ export type { PathOwnership, TaskBudgets } from './policies.ts';
51
+ export { createLocalDeliveryTarget } from './local.ts';
52
+ export { readDeliveryRecord, writeDeliveryRecord } from './record.ts';
53
+ export type { DeliveryRecord } from './record.ts';
54
+ export {
55
+ DeliveryError,
56
+ assertGatesPassed,
57
+ listModuleFiles,
58
+ newPackages,
59
+ planModuleFiles,
60
+ spawnCommand,
61
+ } from './steps.ts';
62
+ export type {
63
+ CommandOptions,
64
+ CommandResult,
65
+ CommandRunner,
66
+ StepResult,
67
+ } from './steps.ts';
68
+ export type {
69
+ DeliveryAvailability,
70
+ DeliveryBudget,
71
+ DeliveryContext,
72
+ DeliveryEmit,
73
+ DeliveryGuardrails,
74
+ DeliveryModulePlan,
75
+ DeliveryOutcome,
76
+ DeliveryPlan,
77
+ DeliveryProvider,
78
+ DeliveryStepResult,
79
+ DeliveryTarget,
80
+ DeliveryTargetId,
81
+ EjectTarget,
82
+ GitDeliveryPlan,
83
+ } from './types.ts';
@@ -0,0 +1,151 @@
1
+ import { sessionPaths } from '../sessions.ts';
2
+ import {
3
+ GATES,
4
+ assertEjectCapability,
5
+ countDeliveredFiles,
6
+ planSessionModules,
7
+ } from './plan.ts';
8
+ import {
9
+ buildWorkspace,
10
+ createStepRecorder,
11
+ enableModule,
12
+ installWorkspace,
13
+ runDeliveryGates,
14
+ stageModules,
15
+ syncModuleScopes,
16
+ verifyPlatform,
17
+ } from './steps.ts';
18
+ import type { DeliveryTarget } from './types.ts';
19
+
20
+ const LOOPBACK_HOSTS = new Set(['127.0.0.1', 'localhost', '[::1]', '::1']);
21
+
22
+ function isLocalPlatform(platformUrl: string): boolean {
23
+ try {
24
+ return LOOPBACK_HOSTS.has(new URL(platformUrl).hostname);
25
+ } catch {
26
+ return false;
27
+ }
28
+ }
29
+
30
+ /* Today's delivery: the module lands in modules/ of this workspace and joins
31
+ the platform through the CLI capabilities a human would run. */
32
+ export function createLocalDeliveryTarget(): DeliveryTarget {
33
+ return {
34
+ id: 'local',
35
+
36
+ available: async () => ({ available: true, reason: null }),
37
+
38
+ plan: async (context) => {
39
+ assertEjectCapability(context);
40
+ const modules = await planSessionModules(context);
41
+ const primary = modules[0]!;
42
+ const platformLocal = isLocalPlatform(context.platformUrl);
43
+ return {
44
+ target: 'workspace',
45
+ deliveredBy: 'local',
46
+ moduleId: primary.id,
47
+ targetPath: primary.targetPath,
48
+ files: primary.files,
49
+ overwrites: primary.overwrites,
50
+ removes: primary.removes,
51
+ newPackages: primary.newPackages,
52
+ enable: primary.enable,
53
+ modules,
54
+ changedFiles: countDeliveredFiles(modules),
55
+ gates: [...GATES],
56
+ platformLocal,
57
+ restartRequired: true,
58
+ notes: [
59
+ platformLocal
60
+ ? 'The connected application runs on this machine from this workspace. Restart it after the delivery so it loads the new composition and runs the new migrations.'
61
+ : 'The connected application runs elsewhere. Deploy this workspace for the change to reach it; the sync-scopes step only updated the local database.',
62
+ ],
63
+ applied: false,
64
+ };
65
+ },
66
+
67
+ apply: async (context, plan, emit) => {
68
+ assertEjectCapability(context);
69
+ const paths = sessionPaths(
70
+ context.workspaceRoot,
71
+ context.session.id,
72
+ context.session.moduleSuffix,
73
+ );
74
+ const { steps, record } = createStepRecorder(emit);
75
+ const gates = await runDeliveryGates(context, plan.gates, emit);
76
+ const { copied, removed } = await stageModules(
77
+ paths,
78
+ context.workspaceRoot,
79
+ plan.modules,
80
+ emit,
81
+ );
82
+
83
+ emit('install.started', {});
84
+ record(
85
+ 'install',
86
+ await installWorkspace(context.commands, context.workspaceRoot),
87
+ );
88
+
89
+ let enabled = false;
90
+ for (const module of plan.modules) {
91
+ if (!module.enable) continue;
92
+ emit('enable.started', { moduleId: module.id });
93
+ record(
94
+ 'enable',
95
+ await enableModule(
96
+ context.commands,
97
+ context.workspaceRoot,
98
+ module.id,
99
+ ),
100
+ );
101
+ enabled = true;
102
+ }
103
+
104
+ for (const module of plan.modules) {
105
+ emit('scopes.started', { moduleId: module.id });
106
+ record(
107
+ 'scopes',
108
+ await syncModuleScopes(
109
+ context.commands,
110
+ context.workspaceRoot,
111
+ module.id,
112
+ ),
113
+ );
114
+ }
115
+
116
+ /* The modules now live in the platform composition, so the platform
117
+ itself has to still typecheck. */
118
+ emit('verify.started', {});
119
+ record(
120
+ 'verify',
121
+ await verifyPlatform(context.commands, context.workspaceRoot),
122
+ );
123
+
124
+ if (context.build === true) {
125
+ emit('build.started', {});
126
+ record(
127
+ 'build',
128
+ await buildWorkspace(context.commands, context.workspaceRoot),
129
+ );
130
+ }
131
+
132
+ if (plan.restartRequired) {
133
+ emit('restart.required', {
134
+ platformLocal: plan.platformLocal,
135
+ note: plan.notes[0] ?? '',
136
+ });
137
+ }
138
+
139
+ return {
140
+ moduleId: plan.moduleId,
141
+ targetPath: plan.targetPath,
142
+ files: copied,
143
+ removed,
144
+ enabled,
145
+ gates,
146
+ steps,
147
+ restartRequired: plan.restartRequired,
148
+ };
149
+ },
150
+ };
151
+ }