@superpanel-sdk/runtime 0.0.1-internal.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 (169) hide show
  1. package/README.md +35 -0
  2. package/bin/superpanel-sdk-runtime.mjs +22 -0
  3. package/dist/builder/codegen/emit.d.ts +17 -0
  4. package/dist/builder/codegen/emit.js +143 -0
  5. package/dist/builder/codegen/generate.d.ts +21 -0
  6. package/dist/builder/codegen/generate.js +90 -0
  7. package/dist/builder/compile/compile-agenda.d.ts +15 -0
  8. package/dist/builder/compile/compile-agenda.js +59 -0
  9. package/dist/builder/compile/compile-sequence.d.ts +24 -0
  10. package/dist/builder/compile/compile-sequence.js +121 -0
  11. package/dist/builder/compile/function-code.d.ts +6 -0
  12. package/dist/builder/compile/function-code.js +30 -0
  13. package/dist/builder/compile/registry.d.ts +13 -0
  14. package/dist/builder/compile/registry.js +42 -0
  15. package/dist/builder/load.d.ts +22 -0
  16. package/dist/builder/load.js +169 -0
  17. package/dist/builder/merge.d.ts +4 -0
  18. package/dist/builder/merge.js +19 -0
  19. package/dist/builder/paths.d.ts +10 -0
  20. package/dist/builder/paths.js +22 -0
  21. package/dist/builder/types.d.ts +31 -0
  22. package/dist/builder/types.js +2 -0
  23. package/dist/cli/compile/index.d.ts +4 -0
  24. package/dist/cli/compile/index.js +11 -0
  25. package/dist/cli/index.d.ts +3 -0
  26. package/dist/cli/index.js +64 -0
  27. package/dist/cli/serve/index.d.ts +9 -0
  28. package/dist/cli/serve/index.js +340 -0
  29. package/dist/cli/type-gen/index.d.ts +5 -0
  30. package/dist/cli/type-gen/index.js +90 -0
  31. package/dist/compute-host/compute-host.d.ts +38 -0
  32. package/dist/compute-host/compute-host.js +45 -0
  33. package/dist/compute-host/index.d.ts +5 -0
  34. package/dist/compute-host/index.js +3 -0
  35. package/dist/compute-host/source-compute-host.d.ts +29 -0
  36. package/dist/compute-host/source-compute-host.js +72 -0
  37. package/dist/core/context/account-fields.d.ts +12 -0
  38. package/dist/core/context/account-fields.js +2 -0
  39. package/dist/core/context/contact.d.ts +60 -0
  40. package/dist/core/context/contact.js +34 -0
  41. package/dist/core/context/db.d.ts +69 -0
  42. package/dist/core/context/db.js +44 -0
  43. package/dist/core/context/docusign.d.ts +134 -0
  44. package/dist/core/context/docusign.js +108 -0
  45. package/dist/core/context/env.d.ts +9 -0
  46. package/dist/core/context/env.js +19 -0
  47. package/dist/core/context/filevine.d.ts +323 -0
  48. package/dist/core/context/filevine.js +254 -0
  49. package/dist/core/context/http.d.ts +9 -0
  50. package/dist/core/context/http.js +4 -0
  51. package/dist/core/context/hubspot.d.ts +250 -0
  52. package/dist/core/context/hubspot.js +191 -0
  53. package/dist/core/context/platform-registry.d.ts +67 -0
  54. package/dist/core/context/platform-registry.js +11 -0
  55. package/dist/core/context/platform.d.ts +33 -0
  56. package/dist/core/context/platform.js +2 -0
  57. package/dist/core/context/twilio.d.ts +50 -0
  58. package/dist/core/context/twilio.js +42 -0
  59. package/dist/core/context/types.d.ts +87 -0
  60. package/dist/core/context/types.js +9 -0
  61. package/dist/core/functions/define/case-context.d.ts +14 -0
  62. package/dist/core/functions/define/case-context.js +15 -0
  63. package/dist/core/functions/define/compute.d.ts +7 -0
  64. package/dist/core/functions/define/compute.js +17 -0
  65. package/dist/core/functions/define/custom.d.ts +4 -0
  66. package/dist/core/functions/define/custom.js +8 -0
  67. package/dist/core/functions/define/system.d.ts +7 -0
  68. package/dist/core/functions/define/system.js +12 -0
  69. package/dist/core/functions/func-ref.d.ts +16 -0
  70. package/dist/core/functions/func-ref.js +20 -0
  71. package/dist/core/functions/types.d.ts +78 -0
  72. package/dist/core/functions/types.js +5 -0
  73. package/dist/core/slot/compile-schema.d.ts +24 -0
  74. package/dist/core/slot/compile-schema.js +336 -0
  75. package/dist/core/slot/deps.d.ts +15 -0
  76. package/dist/core/slot/deps.js +88 -0
  77. package/dist/core/slot/derived.d.ts +32 -0
  78. package/dist/core/slot/derived.js +115 -0
  79. package/dist/core/slot/field.d.ts +36 -0
  80. package/dist/core/slot/field.js +97 -0
  81. package/dist/core/slot/id-ref.d.ts +4 -0
  82. package/dist/core/slot/id-ref.js +15 -0
  83. package/dist/core/slot/index.d.ts +15 -0
  84. package/dist/core/slot/index.js +14 -0
  85. package/dist/core/slot/path.d.ts +18 -0
  86. package/dist/core/slot/path.js +22 -0
  87. package/dist/core/slot/row.d.ts +22 -0
  88. package/dist/core/slot/row.js +54 -0
  89. package/dist/core/slot/schema.d.ts +102 -0
  90. package/dist/core/slot/schema.js +17 -0
  91. package/dist/core/slot/sf-schema.d.ts +23 -0
  92. package/dist/core/slot/sf-schema.js +125 -0
  93. package/dist/core/slot/sf-validate.d.ts +14 -0
  94. package/dist/core/slot/sf-validate.js +132 -0
  95. package/dist/core/slot/snapshot.d.ts +18 -0
  96. package/dist/core/slot/snapshot.js +138 -0
  97. package/dist/core/slot/types.d.ts +144 -0
  98. package/dist/core/slot/types.js +2 -0
  99. package/dist/core/slot/value.d.ts +9 -0
  100. package/dist/core/slot/value.js +97 -0
  101. package/dist/core/slot/write.d.ts +41 -0
  102. package/dist/core/slot/write.js +319 -0
  103. package/dist/core/stage/builders.d.ts +36 -0
  104. package/dist/core/stage/builders.js +28 -0
  105. package/dist/core/stage/condition.d.ts +17 -0
  106. package/dist/core/stage/condition.js +198 -0
  107. package/dist/core/stage/drive.d.ts +43 -0
  108. package/dist/core/stage/drive.js +77 -0
  109. package/dist/core/stage/finish-when.d.ts +20 -0
  110. package/dist/core/stage/finish-when.js +82 -0
  111. package/dist/core/stage/flatten.d.ts +27 -0
  112. package/dist/core/stage/flatten.js +464 -0
  113. package/dist/core/stage/index.d.ts +11 -0
  114. package/dist/core/stage/index.js +10 -0
  115. package/dist/core/stage/simulate.d.ts +24 -0
  116. package/dist/core/stage/simulate.js +33 -0
  117. package/dist/core/stage/transfer-fields.d.ts +14 -0
  118. package/dist/core/stage/transfer-fields.js +88 -0
  119. package/dist/core/stage/types.d.ts +177 -0
  120. package/dist/core/stage/types.js +2 -0
  121. package/dist/core/stage/validate.d.ts +11 -0
  122. package/dist/core/stage/validate.js +226 -0
  123. package/dist/core/stage/walk.d.ts +34 -0
  124. package/dist/core/stage/walk.js +96 -0
  125. package/dist/dev-overlay/protocol.d.ts +53 -0
  126. package/dist/dev-overlay/protocol.js +21 -0
  127. package/dist/fn-context/build-context.d.ts +11 -0
  128. package/dist/fn-context/build-context.js +21 -0
  129. package/dist/fn-context/fake/empty-api.d.ts +9 -0
  130. package/dist/fn-context/fake/empty-api.js +50 -0
  131. package/dist/fn-context/fake/index.d.ts +12 -0
  132. package/dist/fn-context/fake/index.js +22 -0
  133. package/dist/fn-context/index.d.ts +9 -0
  134. package/dist/fn-context/index.js +8 -0
  135. package/dist/fn-context/log.d.ts +8 -0
  136. package/dist/fn-context/log.js +29 -0
  137. package/dist/fn-context/make-ctx.d.ts +9 -0
  138. package/dist/fn-context/make-ctx.js +51 -0
  139. package/dist/fn-context/rpc/errors.d.ts +25 -0
  140. package/dist/fn-context/rpc/errors.js +23 -0
  141. package/dist/fn-context/rpc/index.d.ts +10 -0
  142. package/dist/fn-context/rpc/index.js +9 -0
  143. package/dist/fn-context/rpc/integration/index.d.ts +51 -0
  144. package/dist/fn-context/rpc/integration/index.js +19 -0
  145. package/dist/fn-context/rpc/integration/list-bindings.d.ts +21 -0
  146. package/dist/fn-context/rpc/integration/list-bindings.js +18 -0
  147. package/dist/fn-context/rpc/log.d.ts +36 -0
  148. package/dist/fn-context/rpc/log.js +16 -0
  149. package/dist/fn-context/rpc/platform.d.ts +28 -0
  150. package/dist/fn-context/rpc/platform.js +15 -0
  151. package/dist/fn-context/rpc/request-id.d.ts +5 -0
  152. package/dist/fn-context/rpc/request-id.js +13 -0
  153. package/dist/fn-context/rpc/trpc-client.d.ts +7 -0
  154. package/dist/fn-context/rpc/trpc-client.js +109 -0
  155. package/dist/fn-context/rpc/trpc-init.d.ts +17 -0
  156. package/dist/fn-context/rpc/trpc-init.js +17 -0
  157. package/dist/fn-context/rpc/trpc-router-factory.d.ts +84 -0
  158. package/dist/fn-context/rpc/trpc-router-factory.js +9 -0
  159. package/dist/fn-context/types.d.ts +17 -0
  160. package/dist/fn-context/types.js +2 -0
  161. package/dist/index.d.ts +47 -0
  162. package/dist/index.js +34 -0
  163. package/dist/voice-service/actions.d.ts +20 -0
  164. package/dist/voice-service/actions.js +2 -0
  165. package/dist/voice-service/index.d.ts +3 -0
  166. package/dist/voice-service/index.js +3 -0
  167. package/dist/voice-service/types.d.ts +1010 -0
  168. package/dist/voice-service/types.js +16 -0
  169. package/package.json +55 -0
@@ -0,0 +1,22 @@
1
+ import { type CaseContextViewFn } from '../core/functions/define/case-context.js';
2
+ import type { FuncMap } from '../core/functions/types.js';
3
+ import type { CompanySchema, SequenceSlots } from '../core/slot/schema.js';
4
+ /** Sequence ids that have a slots.ts / slots/index.ts module. */
5
+ export declare function listSequenceIds(repoRoot: string): string[];
6
+ export declare function loadCompanySchema(schemaPath: string): Promise<CompanySchema>;
7
+ export declare function loadSequenceSlots(slotsPath: string): Promise<SequenceSlots>;
8
+ /**
9
+ * Load sequence `functions` map from functions.ts or functions/index.ts.
10
+ * Accepts named `functions` or default export FuncMap.
11
+ */
12
+ export declare function loadSequenceFunctions(functionsPath: string): Promise<FuncMap>;
13
+ /**
14
+ * Load optional `caseContextView` from view.ts / view/index.ts.
15
+ */
16
+ export declare function loadSequenceCaseContextView(viewPath: string): Promise<CaseContextViewFn>;
17
+ /**
18
+ * Load optional sequence agendas from agendas.ts / agendas/index.ts.
19
+ * Missing module → null (compile produces an empty agendas map).
20
+ */
21
+ export declare function loadSequenceAgendas(agendasPath: string): Promise<unknown>;
22
+ //# sourceMappingURL=load.d.ts.map
@@ -0,0 +1,169 @@
1
+ import { existsSync, readdirSync, statSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { resolveCaseContextViewFn } from '../core/functions/define/case-context.js';
5
+ import { isAgendaTree, isSequenceAgendas } from '../core/stage/flatten.js';
6
+ import { findTsModule } from './paths.js';
7
+ async function importModule(filePath) {
8
+ const href = pathToFileURL(filePath).href;
9
+ // Cache-bust so --watch reloads edited TS modules.
10
+ const mod = await import(`${href}?t=${Date.now()}`);
11
+ return mod;
12
+ }
13
+ function isFuncMap(value) {
14
+ if (value == null || typeof value !== 'object' || Array.isArray(value)) {
15
+ return false;
16
+ }
17
+ for (const entry of Object.values(value)) {
18
+ if (entry == null || typeof entry !== 'object' || Array.isArray(entry)) {
19
+ return false;
20
+ }
21
+ const kind = entry.kind;
22
+ if (kind !== 'compute' && kind !== 'boolCompute' && kind !== 'custom' && kind !== 'system') {
23
+ return false;
24
+ }
25
+ }
26
+ return true;
27
+ }
28
+ function isPlainObject(value) {
29
+ return value != null && typeof value === 'object' && !Array.isArray(value);
30
+ }
31
+ function looksLikeTable(value) {
32
+ return isPlainObject(value) && isPlainObject(value.fields);
33
+ }
34
+ function isCompanySchema(value) {
35
+ if (!isPlainObject(value))
36
+ return false;
37
+ const entries = Object.values(value);
38
+ return entries.length > 0 && entries.every(looksLikeTable);
39
+ }
40
+ function isSequenceSlots(value) {
41
+ return isPlainObject(value) && looksLikeTable(value.session);
42
+ }
43
+ /**
44
+ * Resolve the config object from a dynamically imported module.
45
+ *
46
+ * Accepted authoring styles (first match wins):
47
+ * 1. Named export — `export const slots = { session, … }`
48
+ * 2. Default export is the config
49
+ * 3. Default export is a bag that holds a named key
50
+ */
51
+ function pickExport(mod, names, label, isConfig) {
52
+ for (const name of names) {
53
+ if (Object.hasOwn(mod, name) && isConfig(mod[name])) {
54
+ return mod[name];
55
+ }
56
+ }
57
+ const defaultExport = Object.hasOwn(mod, 'default') ? mod.default : undefined;
58
+ if (isConfig(defaultExport)) {
59
+ return defaultExport;
60
+ }
61
+ if (isPlainObject(defaultExport)) {
62
+ for (const name of names) {
63
+ if (Object.hasOwn(defaultExport, name) && isConfig(defaultExport[name])) {
64
+ return defaultExport[name];
65
+ }
66
+ }
67
+ }
68
+ throw new Error(`Could not find ${label} export (${names.join(' | ')}) in module`);
69
+ }
70
+ /** Sequence ids that have a slots.ts / slots/index.ts module. */
71
+ export function listSequenceIds(repoRoot) {
72
+ const sequencesDir = path.join(repoRoot, 'sequences');
73
+ if (!existsSync(sequencesDir)) {
74
+ return [];
75
+ }
76
+ return readdirSync(sequencesDir)
77
+ .filter((name) => {
78
+ try {
79
+ return (statSync(path.join(sequencesDir, name)).isDirectory() &&
80
+ findTsModule(path.join(sequencesDir, name), 'slots') !== undefined);
81
+ }
82
+ catch {
83
+ return false;
84
+ }
85
+ })
86
+ .sort();
87
+ }
88
+ export async function loadCompanySchema(schemaPath) {
89
+ const mod = await importModule(schemaPath);
90
+ return pickExport(mod, ['companySchema', 'schema'], 'company schema', isCompanySchema);
91
+ }
92
+ export async function loadSequenceSlots(slotsPath) {
93
+ const mod = await importModule(slotsPath);
94
+ return pickExport(mod, ['slots'], 'sequence slots', isSequenceSlots);
95
+ }
96
+ /**
97
+ * Load sequence `functions` map from functions.ts or functions/index.ts.
98
+ * Accepts named `functions` or default export FuncMap.
99
+ */
100
+ export async function loadSequenceFunctions(functionsPath) {
101
+ const mod = await importModule(functionsPath);
102
+ if (Object.hasOwn(mod, 'functions') && isFuncMap(mod.functions)) {
103
+ return mod.functions;
104
+ }
105
+ const defaultExport = Object.hasOwn(mod, 'default') ? mod.default : undefined;
106
+ if (isFuncMap(defaultExport)) {
107
+ return defaultExport;
108
+ }
109
+ if (defaultExport != null && typeof defaultExport === 'object' && !Array.isArray(defaultExport)) {
110
+ const bag = defaultExport;
111
+ if (Object.hasOwn(bag, 'functions') && isFuncMap(bag.functions)) {
112
+ return bag.functions;
113
+ }
114
+ }
115
+ throw new Error(`Could not find functions export (functions | default) as a FuncMap in ${functionsPath}`);
116
+ }
117
+ /**
118
+ * Load optional `caseContextView` from view.ts / view/index.ts.
119
+ */
120
+ export async function loadSequenceCaseContextView(viewPath) {
121
+ const mod = await importModule(viewPath);
122
+ const fromNamed = resolveCaseContextViewFn(mod.caseContextView);
123
+ if (fromNamed)
124
+ return fromNamed;
125
+ const defaultExport = Object.hasOwn(mod, 'default') ? mod.default : undefined;
126
+ const fromDefault = resolveCaseContextViewFn(defaultExport);
127
+ if (fromDefault)
128
+ return fromDefault;
129
+ if (defaultExport != null && typeof defaultExport === 'object' && !Array.isArray(defaultExport)) {
130
+ const fromBag = resolveCaseContextViewFn(defaultExport.caseContextView);
131
+ if (fromBag)
132
+ return fromBag;
133
+ }
134
+ throw new Error(`Could not find caseContextView export (caseContextView | default) as a function in ${viewPath}`);
135
+ }
136
+ function isAgendasExport(value) {
137
+ if (value == null)
138
+ return false;
139
+ if (isSequenceAgendas(value) || isAgendaTree(value))
140
+ return true;
141
+ if (Array.isArray(value) && value.length > 0 && value.every(isAgendaTree))
142
+ return true;
143
+ if (typeof value === 'object' && !Array.isArray(value)) {
144
+ const values = Object.values(value);
145
+ return values.length > 0 && values.every(isAgendaTree);
146
+ }
147
+ return false;
148
+ }
149
+ /**
150
+ * Load optional sequence agendas from agendas.ts / agendas/index.ts.
151
+ * Missing module → null (compile produces an empty agendas map).
152
+ */
153
+ export async function loadSequenceAgendas(agendasPath) {
154
+ const mod = await importModule(agendasPath);
155
+ if (Object.hasOwn(mod, 'agendas') && isAgendasExport(mod.agendas)) {
156
+ return mod.agendas;
157
+ }
158
+ const defaultExport = Object.hasOwn(mod, 'default') ? mod.default : undefined;
159
+ if (isAgendasExport(defaultExport))
160
+ return defaultExport;
161
+ if (defaultExport != null && typeof defaultExport === 'object' && !Array.isArray(defaultExport)) {
162
+ const bag = defaultExport;
163
+ if (Object.hasOwn(bag, 'agendas') && isAgendasExport(bag.agendas)) {
164
+ return bag.agendas;
165
+ }
166
+ }
167
+ throw new Error(`Could not find agendas export (agendas | default) in ${agendasPath}`);
168
+ }
169
+ //# sourceMappingURL=load.js.map
@@ -0,0 +1,4 @@
1
+ import type { CompanySchema, EffectiveSchema, SequenceSlots } from '../core/slot/schema.js';
2
+ /** Merge company schema + sequence slots view into effective schema for codegen. */
3
+ export declare function mergeEffectiveSchema(company: CompanySchema, sequenceSlots: SequenceSlots): EffectiveSchema;
4
+ //# sourceMappingURL=merge.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { compileSlotSchema, toEffectiveSchema } from '../core/slot/compile-schema.js';
2
+ /** Merge company schema + sequence slots view into effective schema for codegen. */
3
+ export function mergeEffectiveSchema(company, sequenceSlots) {
4
+ const { schema, validation } = compileSlotSchema(company, sequenceSlots);
5
+ if (!validation.ok) {
6
+ const fatal = validation.issues.filter((i) => i.code === 'unknown-table' ||
7
+ i.code === 'unknown-field' ||
8
+ i.code === 'unknown-ref-table' ||
9
+ i.code === 'invalid-id-field' ||
10
+ i.code === 'missing-id-field' ||
11
+ i.code === 'id-cannot-ref' ||
12
+ i.code === 'reserved-table-name');
13
+ if (fatal.length > 0) {
14
+ throw new Error(fatal.map((i) => i.message).join('; '));
15
+ }
16
+ }
17
+ return toEffectiveSchema(schema);
18
+ }
19
+ //# sourceMappingURL=merge.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A TS module may live as `<dir>/<name>.ts` or `<dir>/<name>/index.ts`.
3
+ * File form is preferred when both exist.
4
+ */
5
+ export declare function tsModuleCandidates(dir: string, name: string): string[];
6
+ /** Return the first existing candidate, or `undefined` if none exist. */
7
+ export declare function findTsModule(dir: string, name: string): string | undefined;
8
+ /** Return the first existing candidate, or throw with `missingMessage`. */
9
+ export declare function resolveTsModule(dir: string, name: string, missingMessage: string): string;
10
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1,22 @@
1
+ import { existsSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ /**
4
+ * A TS module may live as `<dir>/<name>.ts` or `<dir>/<name>/index.ts`.
5
+ * File form is preferred when both exist.
6
+ */
7
+ export function tsModuleCandidates(dir, name) {
8
+ return [path.join(dir, `${name}.ts`), path.join(dir, name, 'index.ts')];
9
+ }
10
+ /** Return the first existing candidate, or `undefined` if none exist. */
11
+ export function findTsModule(dir, name) {
12
+ return tsModuleCandidates(dir, name).find((candidate) => existsSync(candidate));
13
+ }
14
+ /** Return the first existing candidate, or throw with `missingMessage`. */
15
+ export function resolveTsModule(dir, name, missingMessage) {
16
+ const found = findTsModule(dir, name);
17
+ if (!found) {
18
+ throw new Error(missingMessage);
19
+ }
20
+ return found;
21
+ }
22
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1,31 @@
1
+ import type { CaseContextViewRegistryEntry, FunctionRegistry } from '../core/functions/types.js';
2
+ import type { CompanySchema, EffectiveSchema } from '../core/slot/schema.js';
3
+ import type { CompiledSlotSchema } from '../core/slot/types.js';
4
+ import type { CompiledAgenda } from '../core/stage/types.js';
5
+ /**
6
+ * Compiled sequence artifact (Manual §9 subset; grows over time).
7
+ * Omitted for now: paramsDefaults, schedulers, caseManual.
8
+ *
9
+ * Published builds include per-fn `code`. Local serve overlay uses the same
10
+ * type but omits `code` — functions run on the laptop via WebSocket.
11
+ */
12
+ export type SequenceBuild = {
13
+ sequenceId: string;
14
+ sha: string;
15
+ engineVersion: string;
16
+ compiledAt: string;
17
+ companySchemaSnapshot: CompanySchema;
18
+ /** SlotEngine runtime schema (tables + derivedOrder / reverseDeps). */
19
+ schema: CompiledSlotSchema;
20
+ effectiveSchema: EffectiveSchema;
21
+ /** Per-function registry. `code` omitted on local overlay. */
22
+ functions: FunctionRegistry;
23
+ /**
24
+ * Optional CaseContext projector. `null` when sequence has no view.ts
25
+ * (functions receive Slots / identity CaseContext).
26
+ */
27
+ caseContextView: CaseContextViewRegistryEntry | null;
28
+ /** Flattened agendas keyed by agenda id. Empty when the sequence has no agendas module. */
29
+ agendas: Record<string, CompiledAgenda>;
30
+ };
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,4 @@
1
+ export declare function runCompile(repoRoot: string, options?: {
2
+ sequenceId?: string;
3
+ }): Promise<void>;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,11 @@
1
+ import path from 'node:path';
2
+ import { compileAll } from '../../builder/compile/compile-sequence.js';
3
+ export async function runCompile(repoRoot, options = {}) {
4
+ const results = await compileAll(repoRoot, {
5
+ sequenceIds: options.sequenceId ? [options.sequenceId] : undefined,
6
+ });
7
+ for (const result of results) {
8
+ console.log(`wrote ${path.relative(repoRoot, result.outPath)}`);
9
+ }
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs';
3
+ import path from 'node:path';
4
+ import { Command } from 'commander';
5
+ import { runCompile } from './compile/index.js';
6
+ import { runServe } from './serve/index.js';
7
+ import { runTypeGen } from './type-gen/index.js';
8
+ function loadCwdEnv() {
9
+ const file = path.join(process.cwd(), '.env');
10
+ if (!existsSync(file))
11
+ return;
12
+ process.loadEnvFile(file);
13
+ }
14
+ const program = new Command();
15
+ program
16
+ .name('superpanel-sdk-runtime')
17
+ .description('Company-repo tooling: type generation and sequence compile')
18
+ .showHelpAfterError()
19
+ .configureHelp({ sortSubcommands: true });
20
+ program
21
+ .command('type:gen')
22
+ .description('Regenerate TypeScript types under sequences/<id>/__gen/')
23
+ .option('--watch', 'Regenerate when schema or sequence sources change')
24
+ .option('--check', 'Exit 1 if any generated file is stale')
25
+ .action(async (options) => {
26
+ await runTypeGen(process.cwd(), {
27
+ watchMode: Boolean(options.watch),
28
+ checkMode: Boolean(options.check),
29
+ });
30
+ });
31
+ program
32
+ .command('compile')
33
+ .description('Write sequences/<id>/build/sequence-build.json')
34
+ .option('--sequence <id>', 'Compile a single sequence (default: all with slots)')
35
+ .action(async (options) => {
36
+ await runCompile(process.cwd(), { sequenceId: options.sequence });
37
+ });
38
+ program
39
+ .command('serve')
40
+ .description('Watch local sequences and overlay them onto a backend over WebSocket')
41
+ .option('--url <url>', 'Backend host or overlay WebSocket URL (env SUPERPANEL_SDK_BACKEND_URL)')
42
+ .option('--api-key <key>', 'Company API key (env SUPERPANEL_SDK_API_KEY)')
43
+ .option('--company <id>', 'Company id (env SUPERPANEL_SDK_COMPANY_ID)')
44
+ .option('--sequence <id>', 'Serve a single sequence (default: all with slots)')
45
+ .action(async (options) => {
46
+ await runServe(process.cwd(), {
47
+ url: options.url,
48
+ apiKey: options.apiKey,
49
+ companyId: options.company,
50
+ sequenceIds: options.sequence ? [options.sequence] : undefined,
51
+ });
52
+ });
53
+ async function main() {
54
+ loadCwdEnv();
55
+ try {
56
+ await program.parseAsync(process.argv);
57
+ }
58
+ catch (error) {
59
+ console.error(error instanceof Error ? error.message : error);
60
+ process.exit(1);
61
+ }
62
+ }
63
+ void main();
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,9 @@
1
+ export type ServeOptions = {
2
+ url?: string;
3
+ apiKey?: string;
4
+ companyId?: string;
5
+ sequenceIds?: string[];
6
+ };
7
+ export declare function overlayWebSocketUrl(raw: string): string;
8
+ export declare function runServe(repoRoot: string, options?: ServeOptions): Promise<void>;
9
+ //# sourceMappingURL=index.d.ts.map