@lotics/cli 0.88.0 → 0.89.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.
- package/dist/render_page.js +100 -100
- package/dist/src/cli.js +162 -100
- package/dist/{client.d.ts → src/client.d.ts} +9 -1
- package/dist/src/package_content_types.d.ts +70 -0
- package/dist/src/package_content_types.js +12 -0
- package/package.json +2 -2
- package/dist/app_commands.d.ts +0 -401
- package/dist/app_commands.js +0 -1520
- package/dist/app_commands.test.d.ts +0 -1
- package/dist/app_commands.test.js +0 -898
- package/dist/app_workflow_check.d.ts +0 -77
- package/dist/app_workflow_check.js +0 -169
- package/dist/app_workflow_check.test.d.ts +0 -1
- package/dist/app_workflow_check.test.js +0 -166
- package/dist/args.d.ts +0 -42
- package/dist/args.js +0 -121
- package/dist/args.test.d.ts +0 -1
- package/dist/args.test.js +0 -88
- package/dist/child_env.d.ts +0 -13
- package/dist/child_env.js +0 -24
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -1095
- package/dist/cli_dispatch.test.d.ts +0 -1
- package/dist/cli_dispatch.test.js +0 -89
- package/dist/client.test.d.ts +0 -1
- package/dist/client.test.js +0 -47
- package/dist/config.d.ts +0 -124
- package/dist/config.js +0 -315
- package/dist/config.test.d.ts +0 -1
- package/dist/config.test.js +0 -319
- package/dist/dev/file_relay.d.ts +0 -39
- package/dist/dev/file_relay.js +0 -87
- package/dist/dev/file_relay.test.d.ts +0 -1
- package/dist/dev/file_relay.test.js +0 -87
- package/dist/dev/rpc_handler.d.ts +0 -21
- package/dist/dev/rpc_handler.js +0 -166
- package/dist/dev/rpc_handler.test.d.ts +0 -1
- package/dist/dev/rpc_handler.test.js +0 -107
- package/dist/dev/server.d.ts +0 -75
- package/dist/dev/server.js +0 -443
- package/dist/dev/upload_relay.d.ts +0 -36
- package/dist/dev/upload_relay.js +0 -61
- package/dist/dev/upload_relay.test.d.ts +0 -1
- package/dist/dev/upload_relay.test.js +0 -76
- package/dist/dev/wrapper_page.d.ts +0 -40
- package/dist/dev/wrapper_page.js +0 -335
- package/dist/docx.d.ts +0 -2
- package/dist/docx.js +0 -341
- package/dist/docx.test.d.ts +0 -1
- package/dist/docx.test.js +0 -145
- package/dist/file_command_io.d.ts +0 -12
- package/dist/file_command_io.js +0 -34
- package/dist/generate_app_agents_dts.d.ts +0 -16
- package/dist/generate_app_agents_dts.js +0 -62
- package/dist/generate_app_agents_dts.test.d.ts +0 -1
- package/dist/generate_app_agents_dts.test.js +0 -45
- package/dist/generate_app_fields.d.ts +0 -56
- package/dist/generate_app_fields.js +0 -148
- package/dist/generate_app_fields.test.d.ts +0 -1
- package/dist/generate_app_fields.test.js +0 -108
- package/dist/generate_app_queries_dts.d.ts +0 -21
- package/dist/generate_app_queries_dts.js +0 -57
- package/dist/generate_app_workflows_dts.d.ts +0 -39
- package/dist/generate_app_workflows_dts.js +0 -229
- package/dist/generate_app_workflows_dts.test.d.ts +0 -1
- package/dist/generate_app_workflows_dts.test.js +0 -109
- package/dist/generate_package_fields.d.ts +0 -49
- package/dist/generate_package_fields.js +0 -157
- package/dist/generate_package_fields.test.d.ts +0 -1
- package/dist/generate_package_fields.test.js +0 -59
- package/dist/inputs.d.ts +0 -38
- package/dist/inputs.js +0 -50
- package/dist/inputs.test.d.ts +0 -1
- package/dist/inputs.test.js +0 -89
- package/dist/preview.d.ts +0 -3
- package/dist/preview.js +0 -233
- package/dist/starter_template.d.ts +0 -64
- package/dist/starter_template.js +0 -753
- package/dist/starter_template.test.d.ts +0 -1
- package/dist/starter_template.test.js +0 -115
- package/dist/version.d.ts +0 -1
- package/dist/version.js +0 -6
- package/dist/xlsx.d.ts +0 -2
- package/dist/xlsx.js +0 -489
- package/dist/xlsx.test.d.ts +0 -1
- package/dist/xlsx.test.js +0 -131
- /package/dist/{client.js → src/client.js} +0 -0
package/dist/app_commands.d.ts
DELETED
|
@@ -1,401 +0,0 @@
|
|
|
1
|
-
import { LoticsClient } from "./client.js";
|
|
2
|
-
/**
|
|
3
|
-
* Resolve the latest published version of a package from the npm registry.
|
|
4
|
-
* Returns null on any failure (network error, 404, malformed payload) so
|
|
5
|
-
* callers can fall back to a static pin rather than crashing `app create`.
|
|
6
|
-
*
|
|
7
|
-
* 1.5s timeout — npm registry is fast when reachable; the fallback is fine
|
|
8
|
-
* the rare times it isn't, and we don't want to block scaffold on a hang.
|
|
9
|
-
*/
|
|
10
|
-
export declare function fetchLatestNpmVersion(packageName: string): Promise<string | null>;
|
|
11
|
-
/**
|
|
12
|
-
* Manifest declaration for one workflow alias:
|
|
13
|
-
* `"alias": { workflow_id, inputs?: { key: { type, … } }, outputs?: { key: { type, … } } }`
|
|
14
|
-
*
|
|
15
|
-
* When `inputs` is declared, the CLI codegen emits a typed `AppWorkflows[alias]`
|
|
16
|
-
* entry and the server validates payloads against it at execute time. When
|
|
17
|
-
* `outputs` is declared, codegen emits a typed `AppWorkflowResults[alias]` so the
|
|
18
|
-
* app reads a typed `result.data`. Omit either for workflows that take no typed
|
|
19
|
-
* inputs / return no structured data.
|
|
20
|
-
*/
|
|
21
|
-
export type AppWorkflowDeclaration = {
|
|
22
|
-
workflow_id: string;
|
|
23
|
-
inputs?: Record<string, unknown>;
|
|
24
|
-
outputs?: Record<string, unknown>;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Manifest declaration for one named query:
|
|
28
|
-
* `"alias": { ast, params?: { key: { type, … } } }`
|
|
29
|
-
*
|
|
30
|
-
* `ast` is a fixed query AST template; `params` declares the typed value
|
|
31
|
-
* holes (`{{params.<name>}}`) the app fills via `useQuery(alias, params)`.
|
|
32
|
-
* Custom-code apps never send a raw AST — this declaration is the contract.
|
|
33
|
-
*/
|
|
34
|
-
export type AppQueryDeclaration = {
|
|
35
|
-
ast: unknown;
|
|
36
|
-
params?: Record<string, unknown>;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Manifest declaration for one streaming agent:
|
|
40
|
-
* `"alias": { instructions, tool_names, model_id, inputs?, outputs? }`
|
|
41
|
-
*
|
|
42
|
-
* A read-only reflection of the live App row (`apps.agents`, owned by
|
|
43
|
-
* `set_app_agent` / `remove_app_agent`), refreshed by `lotics app pull` and used only to codegen
|
|
44
|
-
* `useAgentRun` typings. `inputs`/`outputs` drive the typed call site; the rest
|
|
45
|
-
* is carried for fidelity.
|
|
46
|
-
*/
|
|
47
|
-
export type AppAgentDeclaration = {
|
|
48
|
-
instructions?: string;
|
|
49
|
-
tool_names?: string[];
|
|
50
|
-
model_id?: string;
|
|
51
|
-
inputs?: Record<string, unknown>;
|
|
52
|
-
outputs?: Record<string, unknown>;
|
|
53
|
-
};
|
|
54
|
-
/**
|
|
55
|
-
* The `async function __workflow(...)` wrapper a workflow body sits inside —
|
|
56
|
-
* the SAME envelope the server compiles the body within at `set_app_workflow`
|
|
57
|
-
* verify time (GAP-59). Carried so a body that uses top-level `await` and ends
|
|
58
|
-
* with `return({...})` typechecks locally exactly as the server checks it. The
|
|
59
|
-
* server returns the canonical strings (`getAppWorkflowDts`); these are the
|
|
60
|
-
* offline fallback when the dts fetch fails so the file is still wrapped — a
|
|
61
|
-
* test pins them equal to the server's, so they can't drift.
|
|
62
|
-
*/
|
|
63
|
-
export declare const FALLBACK_ENVELOPE_PREFIX = "async function __workflow(): Promise<__WorkflowReturn | void> {\n";
|
|
64
|
-
export declare const FALLBACK_ENVELOPE_SUFFIX = "\n}";
|
|
65
|
-
export interface WorkflowEnvelope {
|
|
66
|
-
prefix: string;
|
|
67
|
-
suffix: string;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Write `.lotics/workflows/<alias>.globals.d.ts` = the server-generated ambient
|
|
71
|
-
* declarations the body typechecks against. Idempotent. Returns the path.
|
|
72
|
-
*/
|
|
73
|
-
export declare function writeWorkflowGlobals(projectDir: string, alias: string, dts: string): string;
|
|
74
|
-
/**
|
|
75
|
-
* Write `src/workflows/<alias>.ts` = header (triple-slash reference + comments)
|
|
76
|
-
* + the body wrapped in the `__workflow` envelope. Idempotent (a re-pull
|
|
77
|
-
* overwrites with the current server body). The raw `source` round-trips on
|
|
78
|
-
* `set` (the header + wrapper are stripped). Exported for direct unit testing —
|
|
79
|
-
* the surrounding pull shells out to `tar`/`npm`.
|
|
80
|
-
*/
|
|
81
|
-
export declare function writeWorkflowFile(projectDir: string, alias: string, source: string, envelope?: WorkflowEnvelope): string;
|
|
82
|
-
/**
|
|
83
|
-
* Strip the CLI bookkeeping back off a workflow body before pushing it: the
|
|
84
|
-
* triple-slash reference + the `//` header comments + the `export {};` marker +
|
|
85
|
-
* blank lines, then the `__workflow` envelope (the opening
|
|
86
|
-
* `async function __workflow(...) {` line and the matching trailing `}`). `set`
|
|
87
|
-
* sends ONLY the JS-subset body the author edited — the server stays the single
|
|
88
|
-
* verifier.
|
|
89
|
-
*
|
|
90
|
-
* The strip is anchored on the GENERATED bookkeeping, never on "the file happens
|
|
91
|
-
* to start with comments": the leading comment/marker/blank block is only peeled
|
|
92
|
-
* when it is immediately followed by the `__workflow` wrapper opener (the exact
|
|
93
|
-
* shape `writeWorkflowFile` produces). A hand-written, wrapper-LESS body whose
|
|
94
|
-
* first lines are comments therefore round-trips unchanged — its comments are
|
|
95
|
-
* real source, not bookkeeping, and must not be silently eaten.
|
|
96
|
-
*/
|
|
97
|
-
export declare function stripWorkflowHeader(content: string): string;
|
|
98
|
-
/** Run `tar` and resolve when it exits cleanly. Throws with stderr on failure. */
|
|
99
|
-
export declare function runTar(args: string[], cwd: string): Promise<void>;
|
|
100
|
-
/** Run `npm` (run/install/etc.) inheriting stdio so the user sees progress. */
|
|
101
|
-
export declare function runNpm(args: string[], cwd: string): Promise<void>;
|
|
102
|
-
/**
|
|
103
|
-
* Heal a pre-existing app's `tsconfig.json` so its generated types load and its
|
|
104
|
-
* `npm run typecheck` stays honest. Idempotent, run on every pull / codegen /
|
|
105
|
-
* deploy. Two things the current starter ships but an app SCAFFOLDED before those
|
|
106
|
-
* releases (or with a hand-written tsconfig) can lack:
|
|
107
|
-
*
|
|
108
|
-
* 1. `include`: a bare `.lotics` is rewritten to the recursive `LOTICS_INCLUDE_GLOB`.
|
|
109
|
-
* A bare dot-dir is skipped by TypeScript's include-glob walk, so the codegen'd
|
|
110
|
-
* `.d.ts` never enter the program — every `useQuery`/`useWorkflow`/`useAgentRun`
|
|
111
|
-
* param and result silently falls back to `unknown`.
|
|
112
|
-
* 2. `exclude`: the workflow-body globs — the bodies use the app's DOM lib (the
|
|
113
|
-
* server doesn't) and the per-alias ambient globals collide on `trigger`,
|
|
114
|
-
* poisoning typecheck. Checked separately by `lotics app workflow check`.
|
|
115
|
-
*
|
|
116
|
-
* A missing / unparseable tsconfig is a non-fatal warn (the caller still succeeds);
|
|
117
|
-
* the author fixes the config.
|
|
118
|
-
*/
|
|
119
|
-
export declare function ensureAppTsconfig(projectDir: string): void;
|
|
120
|
-
/**
|
|
121
|
-
* Write the three `.lotics/app_{workflows,queries,agents}.d.ts` companions from
|
|
122
|
-
* the manifest's maps, then heal the app's tsconfig so they actually load. Called
|
|
123
|
-
* from `app create / pull / dev / deploy / codegen`, so the augmented `AppWorkflows`
|
|
124
|
-
* / `AppQueries` / `AppAgents` types stay in sync with the manifest.
|
|
125
|
-
*
|
|
126
|
-
* The heal is at the write boundary on purpose: a `.d.ts` written but not loaded is
|
|
127
|
-
* useless (a bare `.lotics` include is skipped by TypeScript's include-glob walk and
|
|
128
|
-
* loads zero of them), so `ensureAppTsconfig` couples "wrote the types" with "the
|
|
129
|
-
* program can see them" — no caller can do one without the other.
|
|
130
|
-
*/
|
|
131
|
-
export declare function writeAppDts(projectDir: string, manifest: {
|
|
132
|
-
workflows?: Record<string, AppWorkflowDeclaration>;
|
|
133
|
-
queries?: Record<string, AppQueryDeclaration>;
|
|
134
|
-
agents?: Record<string, AppAgentDeclaration>;
|
|
135
|
-
}): string[];
|
|
136
|
-
/**
|
|
137
|
-
* `lotics app codegen [path]` — regenerate every `.lotics/` artifact from the
|
|
138
|
-
* manifest + workspace schema, WITHOUT a deploy. The `.d.ts` companions are
|
|
139
|
-
* always written (synchronous, no network). When a `client` is available, the
|
|
140
|
-
* runtime `app_fields.ts` is also regenerated — **branched on whether the app is
|
|
141
|
-
* a package installation** (`getApp().package_id` set): a **linked/published**
|
|
142
|
-
* app emits the BINDING-resolved form (`F`/`OPT`/`ROLE` resolved from the live
|
|
143
|
-
* binding at module load via `getAppBinding()`, so the source stays portable
|
|
144
|
-
* across every install), a **bespoke** app emits the baked form (this
|
|
145
|
-
* workspace's concrete `fld_…`/`opt_…` ids, from the live schema of the tables
|
|
146
|
-
* its queries reference + the allowlist). A network failure is non-fatal (warn,
|
|
147
|
-
* keep the last-generated file) — so codegen still does useful work offline,
|
|
148
|
-
* mirroring `app create`'s tolerance of an offline npm registry.
|
|
149
|
-
*/
|
|
150
|
-
export declare function appCodegen(args: {
|
|
151
|
-
projectDir?: string;
|
|
152
|
-
client?: LoticsClient;
|
|
153
|
-
}): Promise<void>;
|
|
154
|
-
/**
|
|
155
|
-
* Stamp the post-extraction manifest with server-authoritative meta. Called
|
|
156
|
-
* by `appPull` after the source archive lands on disk.
|
|
157
|
-
*
|
|
158
|
-
* Crucially, `workflows` is sourced from `app.workflows` (live DB state),
|
|
159
|
-
* NOT from whatever the extracted archive's package.json contains. The
|
|
160
|
-
* archive's embedded `lotics.workflows` is a frozen snapshot from deploy
|
|
161
|
-
* time and would silently overwrite any agent-authored bindings made via
|
|
162
|
-
* `set_app_workflow` since the last deploy. Exported for direct unit
|
|
163
|
-
* testing — the rest of `appPull` involves shelling out to `tar`/`npm`,
|
|
164
|
-
* which doesn't reward integration coverage.
|
|
165
|
-
*/
|
|
166
|
-
export declare function stampPulledManifest(projectDir: string, args: {
|
|
167
|
-
app_id: string;
|
|
168
|
-
workspace_id: string;
|
|
169
|
-
current_version_id: string;
|
|
170
|
-
version_number: number;
|
|
171
|
-
workflows: Record<string, AppWorkflowDeclaration>;
|
|
172
|
-
queries: Record<string, AppQueryDeclaration>;
|
|
173
|
-
agents: Record<string, AppAgentDeclaration>;
|
|
174
|
-
}): void;
|
|
175
|
-
/**
|
|
176
|
-
* A filesystem-safe SINGLE directory segment from an app's free-form display
|
|
177
|
-
* name, for the default create/pull target. App names may contain "/" (and
|
|
178
|
-
* other path-hostile characters); used verbatim as a directory, a name like
|
|
179
|
-
* "Nhập/Xuất Cont" splits into NESTED folders ("Nhập" → "Xuất Cont") — and a
|
|
180
|
-
* deploy then packages that nested copy into the source archive, so each later
|
|
181
|
-
* pull re-extracts and compounds it. Neutralize path separators + reserved
|
|
182
|
-
* characters to one segment, keeping spaces and unicode so the folder stays
|
|
183
|
-
* recognizable. An explicit `targetPath` still overrides this entirely.
|
|
184
|
-
*/
|
|
185
|
-
export declare function appDirName(name: string): string;
|
|
186
|
-
/**
|
|
187
|
-
* `lotics app create <name> [path]`
|
|
188
|
-
*
|
|
189
|
-
* Creates the app server-side, scaffolds a Vite+React+TS project locally
|
|
190
|
-
* from the embedded starter template, runs `npm install` + `npm run build`,
|
|
191
|
-
* then deploys the result as v1. After this returns, `lotics app deploy`
|
|
192
|
-
* works end-to-end on the same directory.
|
|
193
|
-
*
|
|
194
|
-
* Why scaffold + deploy rather than pull-from-server-starter: the deploy
|
|
195
|
-
* pipeline requires a built dist tree, and v1 doesn't run builds server-side.
|
|
196
|
-
* Doing the build locally on first create keeps the platform infrastructure
|
|
197
|
-
* minimal — the starter template is embedded in the CLI binary and bumps
|
|
198
|
-
* with CLI releases. (Server-side build is the v2 path.)
|
|
199
|
-
*/
|
|
200
|
-
export declare function appCreate(client: LoticsClient, args: {
|
|
201
|
-
name: string;
|
|
202
|
-
targetPath?: string;
|
|
203
|
-
}): Promise<void>;
|
|
204
|
-
/**
|
|
205
|
-
* `lotics app pull <app_id> [path]`
|
|
206
|
-
*
|
|
207
|
-
* Bootstraps a full local dev environment for an existing app:
|
|
208
|
-
* 1. Fetch the current version's source archive from R2 (presigned URL).
|
|
209
|
-
* 2. Extract into the target directory.
|
|
210
|
-
* 3. Stamp package.json's `lotics` field with app_id + version metadata,
|
|
211
|
-
* and the live `apps.workflows` map from the server (NOT the manifest
|
|
212
|
-
* embedded in the source archive — that's a frozen snapshot from deploy
|
|
213
|
-
* time and would silently overwrite any agent-authored bindings made via
|
|
214
|
-
* `set_app_workflow` since the last deploy).
|
|
215
|
-
* 4. Regenerate `.lotics/app_workflows.d.ts` from the live workflows so
|
|
216
|
-
* `useWorkflow<"alias">` is typed at pull time.
|
|
217
|
-
* 5. Run `npm install`.
|
|
218
|
-
*
|
|
219
|
-
* Runtime field/option id aliases (`.lotics/app_fields.ts`) are generated on
|
|
220
|
-
* demand by `lotics app codegen`, which fetches the workspace schema — pull
|
|
221
|
-
* leaves it to that command so a schema fetch never blocks the bootstrap.
|
|
222
|
-
*/
|
|
223
|
-
/**
|
|
224
|
-
* `lotics app subdomain <new>` — rename the current app's public address.
|
|
225
|
-
* The app_id comes from the local `package.json` manifest. The old
|
|
226
|
-
* `<slug>.lotics.app` stops resolving once the change lands.
|
|
227
|
-
*/
|
|
228
|
-
export declare function appSetSubdomain(client: LoticsClient, args: {
|
|
229
|
-
subdomain: string;
|
|
230
|
-
}): Promise<void>;
|
|
231
|
-
/**
|
|
232
|
-
* `lotics app rename <name>` — change the current app's display name (the
|
|
233
|
-
* launcher/title shown in the workspace). The app_id comes from the local
|
|
234
|
-
* `package.json` manifest. Wraps the `update_app` tool — the public address
|
|
235
|
-
* (`lotics app subdomain`) and the code (`lotics app deploy`) are unchanged.
|
|
236
|
-
*/
|
|
237
|
-
export declare function appRename(client: LoticsClient, args: {
|
|
238
|
-
name: string;
|
|
239
|
-
}): Promise<void>;
|
|
240
|
-
/**
|
|
241
|
-
* `lotics app versions [app_id]` — print the app's deploy history, newest
|
|
242
|
-
* first: version number, when, deployer, build status, and the `-m` message.
|
|
243
|
-
* With no `app_id`, reads it from the local `package.json` manifest (run inside
|
|
244
|
-
* the app dir); pass an explicit `app_id` to inspect any app without pulling it.
|
|
245
|
-
* The currently served version is marked with `*`. Admin-only server-side.
|
|
246
|
-
*/
|
|
247
|
-
export declare function appVersions(client: LoticsClient, args: {
|
|
248
|
-
app_id?: string;
|
|
249
|
-
limit?: number;
|
|
250
|
-
}): Promise<void>;
|
|
251
|
-
/**
|
|
252
|
-
* Where `lotics app pull <app_id>` lands when given NO explicit path. If the cwd
|
|
253
|
-
* IS already this app's own project (its manifest `app_id` matches), refresh in
|
|
254
|
-
* place — the documented `cd <app> && lotics app pull` flow. Otherwise a fresh
|
|
255
|
-
* clone goes to an `appDirName(name)` subdir. Without this, pulling from inside
|
|
256
|
-
* the app dropped a stray `./<name>/` subdir instead of refreshing the project.
|
|
257
|
-
*/
|
|
258
|
-
export declare function defaultPullTarget(appId: string, appName: string): string;
|
|
259
|
-
export declare function appPull(client: LoticsClient, args: {
|
|
260
|
-
app_id: string;
|
|
261
|
-
targetPath?: string;
|
|
262
|
-
}): Promise<void>;
|
|
263
|
-
/**
|
|
264
|
-
* Capabilities the source CALLS but the manifest does not DECLARE — each one
|
|
265
|
-
* silently 403s at runtime (GAP-29). Pure over the concatenated source text so
|
|
266
|
-
* it's unit-testable; the deploy warns (non-blocking) on a non-empty result.
|
|
267
|
-
*/
|
|
268
|
-
export declare function undeclaredCapabilities(sourceText: string, declared: Record<string, boolean | undefined> | undefined): string[];
|
|
269
|
-
/**
|
|
270
|
-
* `lotics app deploy [-m <message>]`
|
|
271
|
-
*
|
|
272
|
-
* Builds the project locally with `npm run build`, tars source + dist, and
|
|
273
|
-
* uploads to the deploy endpoint. The endpoint validates structure, stores
|
|
274
|
-
* both archives in R2, creates an app_versions row, and atomically advances
|
|
275
|
-
* the app's current_version pointer.
|
|
276
|
-
*/
|
|
277
|
-
export declare function appDeploy(client: LoticsClient, args: {
|
|
278
|
-
projectDir?: string;
|
|
279
|
-
message: string;
|
|
280
|
-
}): Promise<void>;
|
|
281
|
-
/**
|
|
282
|
-
* `lotics app dev [path] [--port=5174] [--vite-port=5173]`
|
|
283
|
-
*
|
|
284
|
-
* Local dev mode for iframe apps. Spawns Vite + a postMessage RPC forwarder
|
|
285
|
-
* that bridges the iframe's hooks (useQuery, useWorkflow) to api.lotics.ai
|
|
286
|
-
* using the CLI's stored API key. Wrapper
|
|
287
|
-
* iframe matches the production sandbox attributes exactly — null origin,
|
|
288
|
-
* allow-scripts — so prod-equivalent runtime behavior surfaces in dev.
|
|
289
|
-
*
|
|
290
|
-
* Lifecycle: Vite as a child process (HMR over WebSocket), HTTP server on a
|
|
291
|
-
* sibling port serving the wrapper HTML + the /_rpc dispatcher. SIGINT kills
|
|
292
|
-
* both cleanly.
|
|
293
|
-
*/
|
|
294
|
-
export declare function appDev(client: LoticsClient, args: {
|
|
295
|
-
projectDir?: string;
|
|
296
|
-
port?: number;
|
|
297
|
-
vitePort?: number;
|
|
298
|
-
}): Promise<void>;
|
|
299
|
-
/**
|
|
300
|
-
* `lotics app workflow run <alias> '<json>'` — execute a bound app workflow
|
|
301
|
-
* end-to-end against the live workspace. `app_id` comes from the local manifest
|
|
302
|
-
* (like deploy/dev), the alias must be bound server-side via `set_app_workflow`.
|
|
303
|
-
*
|
|
304
|
-
* The full `{ status, message, data, files, side_effects }` JSON prints to
|
|
305
|
-
* stdout (pipeable / assertable); a one-line human summary goes to stderr. A
|
|
306
|
-
* `status: "error"` envelope exits non-zero so a script can branch on it — the
|
|
307
|
-
* transport already normalizes a gateway/timeout failure into the same
|
|
308
|
-
* `{ status: "error" }` shape, so a failed run is never a thrown HTML body.
|
|
309
|
-
*
|
|
310
|
-
* `--print-created` (alias `--report-effects`) renders the honest post-run
|
|
311
|
-
* harvest (GAP-58): created records grouped by table, a paste-ready
|
|
312
|
-
* `delete_records` per table, and the mandatory caveat about what cannot be
|
|
313
|
-
* auto-undone. `--cleanup` (DEFAULT OFF) additionally runs the deletes for the
|
|
314
|
-
* harvested records ONLY — never files, external integrations, or notifications.
|
|
315
|
-
* Neither is a rollback; a rollback is structurally impossible here.
|
|
316
|
-
*/
|
|
317
|
-
export declare function appExecuteWorkflow(client: LoticsClient, args: {
|
|
318
|
-
alias: string;
|
|
319
|
-
inputs: Record<string, unknown>;
|
|
320
|
-
printCreated?: boolean;
|
|
321
|
-
cleanup?: boolean;
|
|
322
|
-
}): Promise<void>;
|
|
323
|
-
/**
|
|
324
|
-
* `lotics app workflow set <alias>` — push the edited `src/workflows/<alias>.ts`
|
|
325
|
-
* body to the server through `set_app_workflow` (the single author of
|
|
326
|
-
* `apps.workflows`). The body is read from disk (header stripped); the typed
|
|
327
|
-
* `inputs`/`outputs` schemas come from `package.json#lotics.workflows.<alias>`,
|
|
328
|
-
* so a pulled-then-edited app keeps its declared contract. The server re-verifies
|
|
329
|
-
* the body and echoes the bound `outputs` (declared, else DERIVED from
|
|
330
|
-
* `return({ data })`) — the same guarantee as calling `set_app_workflow` by hand,
|
|
331
|
-
* with no fetch/reconstruct/escape. Errors (missing file, unbound alias, verify
|
|
332
|
-
* failure) print to stderr and exit non-zero.
|
|
333
|
-
*
|
|
334
|
-
* This is a CLI convenience over the existing tool — `lotics app deploy` is still
|
|
335
|
-
* NOT an author of workflows; the single-author invariant holds.
|
|
336
|
-
*/
|
|
337
|
-
export declare function appWorkflowSet(client: LoticsClient, args: {
|
|
338
|
-
alias: string;
|
|
339
|
-
}): Promise<void>;
|
|
340
|
-
/**
|
|
341
|
-
* `lotics app query set <alias>` — push `package.json#lotics.queries.<alias>` to
|
|
342
|
-
* `apps.queries` through `set_app_query`, WITHOUT a deploy. The deploy-free inner
|
|
343
|
-
* loop for named queries, parallel to `lotics app workflow set` for workflows.
|
|
344
|
-
*
|
|
345
|
-
* The declaration (`{ ast, params? }`) is read from the manifest — the same map
|
|
346
|
-
* `useQuery` codegen reads and `lotics app deploy` syncs authoritatively. The
|
|
347
|
-
* server validates it exactly as a deploy does (alias identifier, workspace-only
|
|
348
|
-
* tables, resolvable fields, declared params). Because `apps.queries` is
|
|
349
|
-
* manifest-authoritative, the next `lotics app deploy` overwrites this from the
|
|
350
|
-
* manifest — so keep the manifest as the source of truth; this only skips the
|
|
351
|
-
* build/upload round-trip while iterating. Errors (unbound alias, validation
|
|
352
|
-
* failure) print to stderr and exit non-zero.
|
|
353
|
-
*/
|
|
354
|
-
export declare function appQuerySet(client: LoticsClient, args: {
|
|
355
|
-
alias: string;
|
|
356
|
-
}): Promise<void>;
|
|
357
|
-
/**
|
|
358
|
-
* `lotics app workflow pull` — rewrite every `src/workflows/<alias>.ts` from the
|
|
359
|
-
* server without a full `lotics app pull` (no source archive, no npm install).
|
|
360
|
-
* The alias set + bodies come from the live App row (the same source `app pull`
|
|
361
|
-
* uses); a legacy alias with no rendered source warns and is skipped.
|
|
362
|
-
*/
|
|
363
|
-
export declare function appWorkflowPull(client: LoticsClient): Promise<void>;
|
|
364
|
-
/**
|
|
365
|
-
* `lotics app workflow check [alias]` — local TypeScript type check of the
|
|
366
|
-
* editable workflow bodies, ONE isolated program per bound alias (GAP-59 fix).
|
|
367
|
-
*
|
|
368
|
-
* The dedicated `tsconfig.workflows.json` that GAP-59 first shipped compiled ALL
|
|
369
|
-
* aliases' bodies + per-alias ambient globals into a SINGLE program, so the N
|
|
370
|
-
* `declare const trigger: AppWorkflowTrigger` declarations (each with THAT
|
|
371
|
-
* alias's `app_workflow.inputs`) collided — tsc resolved one and every body
|
|
372
|
-
* checked `trigger.app_workflow.inputs` against the wrong alias. This command
|
|
373
|
-
* replaces that config: it builds a separate `ts.Program` per alias from exactly
|
|
374
|
-
* that alias's `{body, globals}` pair (mirroring the SERVER, which verifies one
|
|
375
|
-
* body at a time), so the ambient `trigger` is unambiguous and the verdict
|
|
376
|
-
* matches set-time. All aliases run in ONE process.
|
|
377
|
-
*
|
|
378
|
-
* `[alias]` checks one alias; omitted, checks every bound alias that has a body
|
|
379
|
-
* file. Exits non-zero if ANY alias has a type error. A bound alias with no body
|
|
380
|
-
* file yet (never pulled) is warned and skipped; an alias missing its globals
|
|
381
|
-
* file is an error (the body can't be checked without its types).
|
|
382
|
-
*/
|
|
383
|
-
export declare function appWorkflowCheck(args: {
|
|
384
|
-
alias?: string;
|
|
385
|
-
}): Promise<void>;
|
|
386
|
-
/**
|
|
387
|
-
* `lotics ui link <component> [--remove]` — add or remove the `@lotics/ui`
|
|
388
|
-
* dev-link alias in the app's `vite.config.ts`, so edits to the monorepo's
|
|
389
|
-
* `packages/ui/src` go live (HMR) without a publish round-trip. `component` is
|
|
390
|
-
* advisory only — the alias is package-wide (one subpath regex covers every
|
|
391
|
-
* import); it's validated to exist under `packages/ui/src` so a typo fails here.
|
|
392
|
-
*
|
|
393
|
-
* Idempotent: linking twice is a no-op; `--remove` strips the one inserted
|
|
394
|
-
* entry and leaves the rest of `resolve.alias` intact.
|
|
395
|
-
*/
|
|
396
|
-
export declare function appUiLink(args: {
|
|
397
|
-
projectDir?: string;
|
|
398
|
-
component: string;
|
|
399
|
-
remove?: boolean;
|
|
400
|
-
uiSrc?: string;
|
|
401
|
-
}): void;
|