dsh-edge 0.16.0 → 0.17.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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Installer runtime catalog. Providers mirror the Worker's
3
+ * `src/runtime-provider.ts` catalog; a runtime mode is one deployable wrangler
4
+ * environment whose bindings enable a set of providers. Plan gating, labels,
5
+ * and the expected public shell all derive from the providers a mode enables.
6
+ */
7
+
8
+ export const RUNTIME_PROVIDERS = Object.freeze({
9
+ direct: Object.freeze({
10
+ id: 'direct',
11
+ capabilities: Object.freeze(['bash']),
12
+ plan: 'free',
13
+ shell: 'just-bash-direct',
14
+ }),
15
+ 'dynamic-worker': Object.freeze({
16
+ id: 'dynamic-worker',
17
+ capabilities: Object.freeze(['bash', 'coding']),
18
+ plan: 'paid',
19
+ shell: 'just-bash-isolated',
20
+ }),
21
+ })
22
+
23
+ const RUNTIME_MODE_DEFINITIONS = Object.freeze({
24
+ direct: {
25
+ environment: '',
26
+ providers: ['direct'],
27
+ label: 'Free — Direct Shell',
28
+ hint: 'recommended; runs on Workers Free',
29
+ },
30
+ isolated: {
31
+ environment: 'isolated',
32
+ providers: ['dynamic-worker'],
33
+ label: 'Isolated — Dynamic Worker',
34
+ hint: 'requires Workers Paid (starting at $5/month); adds workflow and run_code',
35
+ },
36
+ })
37
+
38
+ export const RUNTIME_MODES = Object.freeze(Object.fromEntries(
39
+ Object.entries(RUNTIME_MODE_DEFINITIONS).map(([mode, definition]) => {
40
+ const providers = definition.providers.map(id => RUNTIME_PROVIDERS[id])
41
+ const bash = providers.find(provider => provider.capabilities.includes('bash'))
42
+ if (bash === undefined) throw new Error(`Runtime mode ${mode} has no bash provider.`)
43
+ return [mode, Object.freeze({
44
+ environment: definition.environment,
45
+ expectedShell: bash.shell,
46
+ label: definition.label,
47
+ hint: definition.hint,
48
+ paid: providers.some(provider => provider.plan === 'paid'),
49
+ providers: Object.freeze([...definition.providers]),
50
+ })]
51
+ }),
52
+ ))
53
+
54
+ /** The installer's runtime choices, Free modes first. */
55
+ export function runtimeModeChoices() {
56
+ return Object.entries(RUNTIME_MODES).map(([value, mode]) => ({
57
+ value,
58
+ label: mode.label,
59
+ hint: mode.hint,
60
+ }))
61
+ }
62
+
63
+ /** Whether `mode` names a deployable runtime mode. */
64
+ export function isRuntimeMode(mode) {
65
+ return typeof mode === 'string' && Object.hasOwn(RUNTIME_MODES, mode)
66
+ }
@@ -59,6 +59,8 @@ export function verifyPacked(input) {
59
59
  name.startsWith('@deepseek-ai/')
60
60
  || name === '@cloudflare/computer'
61
61
  || name === 'just-bash'
62
+ || name === 'acorn'
63
+ || name === 'sucrase'
62
64
  ))
63
65
  if (sourceRuntimeDependency !== undefined) {
64
66
  throw new Error(`packed dsh-edge still installs bundled source dependency ${sourceRuntimeDependency}`)