lua-cli 3.39.3 → 3.40.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/dist/api-exports.d.ts +434 -23
- package/dist/api-exports.js +1727 -525
- package/dist/api-exports.js.map +1 -1
- package/dist/index.js +1538 -158
- package/dist/index.js.map +1 -1
- package/dist/voice/test/index.d.ts +16 -5
- package/dist/workflow-builder.d.ts +52 -1
- package/dist/workflow-builder.js +1069 -259
- package/dist/workflow-builder.js.map +1 -1
- package/docs/API_REFERENCE.md +115 -45
- package/docs/api/Agents.md +111 -0
- package/docs/workflows/schedule-health.md +77 -0
- package/docs/workflows/schedules.md +6 -2
- package/package.json +6 -4
- package/template/package.json +1 -1
package/dist/api-exports.d.ts
CHANGED
|
@@ -44,18 +44,6 @@ declare interface AgentInvocationEffects {
|
|
|
44
44
|
blocker?: TaskRunBlocker;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
/**
|
|
48
|
-
* Wire-format input for sandbox `Agents.invoke` / `POST /chat/generate/:agentId`
|
|
49
|
-
* when triggered programmatically by another agent/skill/tool.
|
|
50
|
-
*
|
|
51
|
-
* Intentionally a narrow, safe subset of the public `ChatMessageDto` — omits
|
|
52
|
-
* sandbox-only overrides (`skillOverride`, `preprocessorOverride`, etc.),
|
|
53
|
-
* navigation hints, and persona override.
|
|
54
|
-
*
|
|
55
|
-
* Either `prompt` or `messages` must be provided. When `prompt` is given, it is
|
|
56
|
-
* converted into a single `{ role: 'user', content: [{ type: 'text', text: prompt }] }`
|
|
57
|
-
* message downstream.
|
|
58
|
-
*/
|
|
59
47
|
declare interface AgentInvocationInput {
|
|
60
48
|
/** Shortcut: plain-text prompt. Mutually exclusive with `messages`. */
|
|
61
49
|
prompt?: string;
|
|
@@ -364,6 +352,87 @@ export declare interface AgentsApi {
|
|
|
364
352
|
* ```
|
|
365
353
|
*/
|
|
366
354
|
invoke(targetAgentId: string, input: AgentInvocationInput): Promise<AgentInvocationOutput>;
|
|
355
|
+
/** Agents of your organization, with the supervision actions you hold on each. */
|
|
356
|
+
list(): Promise<SupervisedAgentSummary[]>;
|
|
357
|
+
/** One agent of your organization. */
|
|
358
|
+
get(agentId: string): Promise<SupervisedAgentSummary & {
|
|
359
|
+
personaVersion?: number;
|
|
360
|
+
}>;
|
|
361
|
+
/** Recent execution logs of a supervised agent (`supervision:observe`). No user ids; message bodies only with `supervision:observe-content`. */
|
|
362
|
+
logs(agentId: string, opts?: {
|
|
363
|
+
since?: string | number;
|
|
364
|
+
limit?: number;
|
|
365
|
+
level?: 'debug' | 'info' | 'warn' | 'error';
|
|
366
|
+
logSource?: string;
|
|
367
|
+
}): Promise<SupervisionLogRow[]>;
|
|
368
|
+
/** Workflow run metadata (no inputs/outputs) (`supervision:observe`). */
|
|
369
|
+
runs(agentId: string): {
|
|
370
|
+
list(opts?: {
|
|
371
|
+
limit?: number;
|
|
372
|
+
status?: string;
|
|
373
|
+
workflowId?: string;
|
|
374
|
+
}): Promise<SupervisionRunSummary[]>;
|
|
375
|
+
get(runId: string): Promise<SupervisionRunSummary>;
|
|
376
|
+
};
|
|
377
|
+
/** Read-only Data — only the collections the org admin named on the grant (`supervision:observe`). */
|
|
378
|
+
data(agentId: string): {
|
|
379
|
+
get(collection: string, entryId: string): Promise<unknown>;
|
|
380
|
+
query(collection: string, filter?: Record<string, unknown>, opts?: {
|
|
381
|
+
page?: number;
|
|
382
|
+
limit?: number;
|
|
383
|
+
}): Promise<unknown>;
|
|
384
|
+
};
|
|
385
|
+
versions(agentId: string): {
|
|
386
|
+
list(opts?: {
|
|
387
|
+
limit?: number;
|
|
388
|
+
}): Promise<unknown>;
|
|
389
|
+
get(version: number): Promise<unknown>;
|
|
390
|
+
diff(from: number, to: number): Promise<unknown>;
|
|
391
|
+
/** Chat staged `version` (`supervision:preview`). No tools run unless `toolScope.skillIds` allowlists them. */
|
|
392
|
+
preview(version: number, prompt: string, opts?: {
|
|
393
|
+
toolScope?: {
|
|
394
|
+
skillIds?: string[];
|
|
395
|
+
};
|
|
396
|
+
}): Promise<{
|
|
397
|
+
version: number;
|
|
398
|
+
text: string;
|
|
399
|
+
toolsUsed: string[];
|
|
400
|
+
finishReason?: string;
|
|
401
|
+
}>;
|
|
402
|
+
/**
|
|
403
|
+
* Make `version` live (`supervision:release`; only from a workflow step whose workflow the grant names).
|
|
404
|
+
* Compare-and-swap: refused (409 `PROMOTE_CONFLICT`) unless `expectActive` is the live version.
|
|
405
|
+
*/
|
|
406
|
+
promote(version: number, opts: {
|
|
407
|
+
expectActive: number | null;
|
|
408
|
+
}): Promise<unknown>;
|
|
409
|
+
};
|
|
410
|
+
persona(agentId: string): {
|
|
411
|
+
versions(): Promise<unknown>;
|
|
412
|
+
/** Serve persona `version` (`supervision:release`). CAS on the served persona version. */
|
|
413
|
+
activate(version: number, opts: {
|
|
414
|
+
expectActive: number | null;
|
|
415
|
+
}): Promise<unknown>;
|
|
416
|
+
};
|
|
417
|
+
/** The source backup (`supervision:observe`). */
|
|
418
|
+
source(agentId: string): {
|
|
419
|
+
list(): Promise<{
|
|
420
|
+
files: {
|
|
421
|
+
path: string;
|
|
422
|
+
size?: number;
|
|
423
|
+
}[];
|
|
424
|
+
}>;
|
|
425
|
+
get(path: string): Promise<{
|
|
426
|
+
path: string;
|
|
427
|
+
content: string;
|
|
428
|
+
}>;
|
|
429
|
+
};
|
|
430
|
+
/** Environment variable NAMES only — values are never returned (`supervision:observe`). */
|
|
431
|
+
env(agentId: string): {
|
|
432
|
+
keys(): Promise<{
|
|
433
|
+
keys: string[];
|
|
434
|
+
}>;
|
|
435
|
+
};
|
|
367
436
|
}
|
|
368
437
|
|
|
369
438
|
export declare interface AgentStepOptions {
|
|
@@ -396,6 +465,22 @@ export declare interface AgentStepOptions {
|
|
|
396
465
|
*/
|
|
397
466
|
maxMessages?: number;
|
|
398
467
|
maxInputTokens?: number;
|
|
468
|
+
/**
|
|
469
|
+
* Claude Code plugins a tier:'job' coding turn loads (EM-WS3). Platform allowlist only — today
|
|
470
|
+
* `'lua-agent-builder'` (the lua-cli playbooks). Needs the claude-code harness (an Anthropic model) and the `shell`
|
|
471
|
+
* job tool; the turn then reaches the Lua API through a platform proxy pinned to THIS workflow's agent that allows
|
|
472
|
+
* staging only (compile, push of skills/jobs/webhooks/triggers/processors/backup, `version create`, status, logs)
|
|
473
|
+
* and refuses every deploy, promote, publish, activate, env, chat and runtime call.
|
|
474
|
+
*/
|
|
475
|
+
plugins?: WorkflowJobPluginId[];
|
|
476
|
+
/**
|
|
477
|
+
* EM-WS3: pin a plugin step's Lua-API proxy (and its key) to ANOTHER agent instead of this workflow's own. Legal only
|
|
478
|
+
* beside `plugins`. Refused at run time (`target_not_granted`) unless the platform's plugin-target switch is on AND
|
|
479
|
+
* this workflow's agent holds a `supervision:act` or `supervision:release` grant on the target.
|
|
480
|
+
*/
|
|
481
|
+
target?: {
|
|
482
|
+
agentId: string;
|
|
483
|
+
};
|
|
399
484
|
/**
|
|
400
485
|
* What this step DOES: `classify` | `extract` | `transform` | `draft` | `research` | `reason` | `code` |
|
|
401
486
|
* `judge`. On a PUSHED definition it must come with a `model` — a static `taskClass` with none is refused
|
|
@@ -1913,7 +1998,9 @@ export declare function defineDeviceTrigger(config: LuaDeviceTriggerConfig): Lua
|
|
|
1913
1998
|
* });
|
|
1914
1999
|
* ```
|
|
1915
2000
|
*/
|
|
1916
|
-
export declare function defineTrigger<
|
|
2001
|
+
export declare function defineTrigger<S extends ZodType = ZodType<any>>(config: Omit<LuaTriggerConfig<z.infer<S>>, 'inputSchema'> & {
|
|
2002
|
+
inputSchema?: S;
|
|
2003
|
+
}): LuaTrigger<z.infer<S>>;
|
|
1917
2004
|
|
|
1918
2005
|
/**
|
|
1919
2006
|
* Function-style LuaVoice definition. Equivalent to `new LuaVoice(config)`,
|
|
@@ -1927,6 +2014,37 @@ export declare function defineTrigger<T = any>(config: LuaTriggerConfig<T>): Lua
|
|
|
1927
2014
|
*/
|
|
1928
2015
|
export declare function defineVoice(config: LuaVoiceConfig): LuaVoice;
|
|
1929
2016
|
|
|
2017
|
+
/**
|
|
2018
|
+
* Define a web app on the agent.
|
|
2019
|
+
*
|
|
2020
|
+
* @example
|
|
2021
|
+
* ```typescript
|
|
2022
|
+
* import { defineWebApp, route, json } from 'lua-cli';
|
|
2023
|
+
* import { z } from 'zod';
|
|
2024
|
+
*
|
|
2025
|
+
* export default defineWebApp({
|
|
2026
|
+
* name: 'ops-dashboard',
|
|
2027
|
+
* description: 'Open tickets per shop',
|
|
2028
|
+
* pages: { root: './web', nav: [{ path: '/', label: 'Overview' }] },
|
|
2029
|
+
* routes: {
|
|
2030
|
+
* 'GET /tickets': route({
|
|
2031
|
+
* query: z.object({ status: z.enum(['open', 'closed']).default('open') }),
|
|
2032
|
+
* handler: async ({ query }) => ({ items: (await Data.get('tickets', { filter: { status: query.status } })).data }),
|
|
2033
|
+
* }),
|
|
2034
|
+
* 'POST /tickets/:id/close': route({
|
|
2035
|
+
* params: z.object({ id: z.string() }),
|
|
2036
|
+
* body: z.object({ note: z.string().max(500) }),
|
|
2037
|
+
* handler: async ({ params, body, auth }) => {
|
|
2038
|
+
* await Data.patch('tickets', params.id, { set: { status: 'closed', closedBy: auth.userId, note: body.note } });
|
|
2039
|
+
* return json(undefined, 204);
|
|
2040
|
+
* },
|
|
2041
|
+
* }),
|
|
2042
|
+
* },
|
|
2043
|
+
* });
|
|
2044
|
+
* ```
|
|
2045
|
+
*/
|
|
2046
|
+
export declare function defineWebApp(config: LuaWebAppConfig): LuaWebApp;
|
|
2047
|
+
|
|
1930
2048
|
export declare function defineWorkflow(cfg: LuaWorkflowConfig, build: (wf: LuaWorkflowBuilder) => LuaWorkflow): LuaWorkflow;
|
|
1931
2049
|
|
|
1932
2050
|
/**
|
|
@@ -2414,8 +2532,8 @@ declare abstract class HttpClient {
|
|
|
2414
2532
|
* Use this only when a successful response contains a one-time secret that
|
|
2415
2533
|
* cannot be recovered after an ambiguous network or server failure.
|
|
2416
2534
|
*/
|
|
2417
|
-
protected httpPostOnce<T>(url: string, data?: any, headers?: Record<string, string
|
|
2418
|
-
protected httpPostCoreDrainRetry<T>(url: string, data?: any, headers?: Record<string, string
|
|
2535
|
+
protected httpPostOnce<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
|
|
2536
|
+
protected httpPostCoreDrainRetry<T>(url: string, data?: any, headers?: Record<string, string>, overrides?: RequestOverrides): Promise<ApiResponse<T>>;
|
|
2419
2537
|
/**
|
|
2420
2538
|
* Performs an HTTP PUT request
|
|
2421
2539
|
* @param url - The relative URL path to request (will be appended to baseUrl)
|
|
@@ -2647,6 +2765,26 @@ export declare interface IntegrationsApi {
|
|
|
2647
2765
|
passthrough(integrationType: string, request: IntegrationPassthroughRequest): Promise<IntegrationPassthroughResponse>;
|
|
2648
2766
|
}
|
|
2649
2767
|
|
|
2768
|
+
/**
|
|
2769
|
+
* Who invoked this turn, when another agent created it through `Agents.invoke`.
|
|
2770
|
+
* Verified server-side from the invocation token; never caller-supplied.
|
|
2771
|
+
*
|
|
2772
|
+
* Treat any turn that carries `invokedBy` as agent-initiated: a mutating tool
|
|
2773
|
+
* should refuse it unless `supervisor` is true (the caller holds `supervision:act`
|
|
2774
|
+
* on this agent) and the tool's own supervisor allowlist admits the change. A
|
|
2775
|
+
* `delegatedUserId` NEVER grants owner rights.
|
|
2776
|
+
*/
|
|
2777
|
+
export declare interface InvokedBy {
|
|
2778
|
+
/** The calling agent's id. */
|
|
2779
|
+
agentId: string;
|
|
2780
|
+
/** True only when an org admin granted the caller `supervision:act` on this agent. */
|
|
2781
|
+
supervisor: boolean;
|
|
2782
|
+
/** The caller's supervision scopes on this agent (e.g. `supervision:act`); `[]` on preview turns. */
|
|
2783
|
+
scopes: string[];
|
|
2784
|
+
/** Set when the caller passed `input.userId` to `Agents.invoke` (a delegated turn). */
|
|
2785
|
+
delegatedUserId?: string;
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2650
2788
|
/**
|
|
2651
2789
|
* Job with versions array
|
|
2652
2790
|
* Matches JobDto and job.schema.ts
|
|
@@ -3125,6 +3263,11 @@ declare interface JobVersion {
|
|
|
3125
3263
|
metadata?: Record<string, any>;
|
|
3126
3264
|
}
|
|
3127
3265
|
|
|
3266
|
+
/**
|
|
3267
|
+
* Build a JSON `Response`. `json(undefined, 204)` answers with no body.
|
|
3268
|
+
*/
|
|
3269
|
+
export declare function json(data: unknown, status?: number, headers?: Record<string, string>): Response;
|
|
3270
|
+
|
|
3128
3271
|
export { JsonSchema }
|
|
3129
3272
|
|
|
3130
3273
|
export { KnowledgeBindingSpec }
|
|
@@ -3394,6 +3537,9 @@ export declare interface LuaAgentConfig {
|
|
|
3394
3537
|
*/
|
|
3395
3538
|
export declare type LuaAgentModel = string | ((request: LuaRequest) => string | Promise<string>);
|
|
3396
3539
|
|
|
3540
|
+
/** The signed-in person a route runs for (never an API key, never anonymous). */
|
|
3541
|
+
export declare type LuaAuth = WebRouteAuth;
|
|
3542
|
+
|
|
3397
3543
|
/**
|
|
3398
3544
|
* LuaDevice class — represents an external device that an agent can communicate with.
|
|
3399
3545
|
*
|
|
@@ -3586,6 +3732,7 @@ export declare class LuaJob {
|
|
|
3586
3732
|
private readonly timeout;
|
|
3587
3733
|
private readonly retry?;
|
|
3588
3734
|
private readonly metadata?;
|
|
3735
|
+
private readonly health?;
|
|
3589
3736
|
private readonly executeFunction;
|
|
3590
3737
|
/**
|
|
3591
3738
|
* Creates a new LuaJob instance.
|
|
@@ -3627,6 +3774,10 @@ export declare class LuaJob {
|
|
|
3627
3774
|
* Gets the job metadata.
|
|
3628
3775
|
*/
|
|
3629
3776
|
getMetadata(): Record<string, any> | undefined;
|
|
3777
|
+
/**
|
|
3778
|
+
* Gets the schedule-health declaration (EM-WS10), if any.
|
|
3779
|
+
*/
|
|
3780
|
+
getHealth(): ScheduleHealthConfig | undefined;
|
|
3630
3781
|
/**
|
|
3631
3782
|
* Executes the job with the provided job instance.
|
|
3632
3783
|
* @param job - Job instance with metadata and context
|
|
@@ -3664,6 +3815,16 @@ export declare interface LuaJobConfig {
|
|
|
3664
3815
|
* Sent to server and accessible during execution.
|
|
3665
3816
|
*/
|
|
3666
3817
|
metadata?: Record<string, any>;
|
|
3818
|
+
/**
|
|
3819
|
+
* Schedule health — a dead-man for this job, watched by the platform. The job's owner (its creator, else the
|
|
3820
|
+
* org admins) gets ONE notice per incident — inbox card plus `notify` ('app' push, 'email', or 'emailApp', the
|
|
3821
|
+
* default) — when, while the job is active:
|
|
3822
|
+
* - `maxSilenceMinutes` (5..43200): no run has completed successfully for that long (needs a recurring schedule);
|
|
3823
|
+
* - `alertAfterConsecutiveFailures` (1..50): that many runs failed in a row;
|
|
3824
|
+
* and the notice resolves in place when the job is healthy again. Every transition is also an agent log line, so
|
|
3825
|
+
* a log drain routes it to Better Stack / Datadog. Takes effect when the version is published.
|
|
3826
|
+
*/
|
|
3827
|
+
health?: ScheduleHealthConfig;
|
|
3667
3828
|
}
|
|
3668
3829
|
|
|
3669
3830
|
/**
|
|
@@ -3825,6 +3986,12 @@ export declare interface LuaRequest {
|
|
|
3825
3986
|
* current speaker. Undefined on 1:1 turns and on non-chat executions.
|
|
3826
3987
|
*/
|
|
3827
3988
|
conversation?: ConversationRef;
|
|
3989
|
+
/**
|
|
3990
|
+
* Present only when ANOTHER agent created this turn via `Agents.invoke`
|
|
3991
|
+
* (absent on user, channel, job, webhook and self-invoked turns, and offline in
|
|
3992
|
+
* `lua test`). Read it defensively — older runtimes do not set it.
|
|
3993
|
+
*/
|
|
3994
|
+
invokedBy?: InvokedBy;
|
|
3828
3995
|
}
|
|
3829
3996
|
|
|
3830
3997
|
/**
|
|
@@ -4074,7 +4241,9 @@ export declare interface LuaTriggerConfig<T = any> {
|
|
|
4074
4241
|
* compiler carries it into the trigger version as declared metadata.
|
|
4075
4242
|
* `input` maps the trigger context to the tool's arguments and runs in the
|
|
4076
4243
|
* same server-side slot sandbox (15s budget shared with verify/filter) —
|
|
4077
|
-
* it
|
|
4244
|
+
* it CAN call platform APIs (Data, Products, Baskets, Orders, User, AI,
|
|
4245
|
+
* Agents, Jobs, …), same as a tool or webhook, since all three build their
|
|
4246
|
+
* VM context through the same sandbox factory. Omit `input` to execute with `{}`.
|
|
4078
4247
|
*
|
|
4079
4248
|
* Declaring BOTH `tool` and `transform` runs the tool; the transform is
|
|
4080
4249
|
* ignored (the compiler warns). Approval-gated tools are refused server-
|
|
@@ -4124,8 +4293,8 @@ export declare class LuaVoice {
|
|
|
4124
4293
|
readonly name: string;
|
|
4125
4294
|
readonly description?: string;
|
|
4126
4295
|
readonly llm: LuaVoiceModelInput;
|
|
4127
|
-
readonly stt
|
|
4128
|
-
readonly tts
|
|
4296
|
+
readonly stt?: LuaVoiceModelInput;
|
|
4297
|
+
readonly tts?: LuaVoiceModelInput;
|
|
4129
4298
|
readonly vad: LuaVoiceConfig_2['vad'];
|
|
4130
4299
|
readonly vadOptions: LuaVoiceConfig_2['vadOptions'];
|
|
4131
4300
|
readonly turnDetection: LuaVoiceConfig_2['turnDetection'];
|
|
@@ -4152,11 +4321,22 @@ export declare class LuaVoice {
|
|
|
4152
4321
|
* pass either a string descriptor or a plugin class instance. The wire schema
|
|
4153
4322
|
* (validated server-side) is the discriminated union in `@lua/shared-types`;
|
|
4154
4323
|
* the compiler is what bridges the two.
|
|
4155
|
-
|
|
4156
|
-
|
|
4324
|
+
*
|
|
4325
|
+
* `stt`/`tts` are unconditionally optional here at the type level — a
|
|
4326
|
+
* realtime `llm` legitimately omits both. The realtime-vs-cascaded
|
|
4327
|
+
* requirement (cascaded needs both) is enforced by the compiler's zod
|
|
4328
|
+
* `superRefine` in `@lua/shared-types`, not by this type. `name` is
|
|
4329
|
+
* deliberately required here (unlike `@lua/shared-types`'s wire schema,
|
|
4330
|
+
* which leaves it optional for its own unrelated server-side
|
|
4331
|
+
* placeholder-name use case) since the `LuaVoice` constructor throws
|
|
4332
|
+
* without it and a nameless voice is otherwise silently dropped from the
|
|
4333
|
+
* compiled manifest.
|
|
4334
|
+
*/
|
|
4335
|
+
export declare interface LuaVoiceConfig extends Omit<LuaVoiceConfig_2, 'llm' | 'stt' | 'tts' | 'name'> {
|
|
4336
|
+
name: string;
|
|
4157
4337
|
llm: LuaVoiceModelInput;
|
|
4158
|
-
stt
|
|
4159
|
-
tts
|
|
4338
|
+
stt?: LuaVoiceModelInput;
|
|
4339
|
+
tts?: LuaVoiceModelInput;
|
|
4160
4340
|
/** Optional human-readable description (surfaced in manifest + admin listings). */
|
|
4161
4341
|
description?: string;
|
|
4162
4342
|
/** Voice-only tools, in addition to skills attached to the owning agent. */
|
|
@@ -5088,6 +5268,37 @@ export declare interface LuaVoiceTurnContext {
|
|
|
5088
5268
|
}): void;
|
|
5089
5269
|
}
|
|
5090
5270
|
|
|
5271
|
+
/**
|
|
5272
|
+
* Lua Web App — the class form of `defineWebApp` (consistent with
|
|
5273
|
+
* `LuaTrigger` / `defineTrigger`). Validates the definition eagerly so a
|
|
5274
|
+
* mistake fails at `lua compile`, not at first request.
|
|
5275
|
+
*/
|
|
5276
|
+
export declare class LuaWebApp {
|
|
5277
|
+
private readonly config;
|
|
5278
|
+
constructor(config: LuaWebAppConfig);
|
|
5279
|
+
getName(): string;
|
|
5280
|
+
getDescription(): string | undefined;
|
|
5281
|
+
getPages(): WebAppPages;
|
|
5282
|
+
getBranding(): WebAppBranding | undefined;
|
|
5283
|
+
getRoutes(): Record<string, RouteDefinition<any, any, any>>;
|
|
5284
|
+
getFetch(): LuaWebAppConfig['fetch'];
|
|
5285
|
+
getConfig(): LuaWebAppConfig;
|
|
5286
|
+
}
|
|
5287
|
+
|
|
5288
|
+
export declare interface LuaWebAppConfig {
|
|
5289
|
+
/** URL-safe name: `^[a-z][a-z0-9-]*$`. The app's identifier on the agent. */
|
|
5290
|
+
name: string;
|
|
5291
|
+
description?: string;
|
|
5292
|
+
pages: WebAppPages;
|
|
5293
|
+
branding?: WebAppBranding;
|
|
5294
|
+
/** Typed route handlers keyed by `'<METHOD> /<path>'`. */
|
|
5295
|
+
routes?: Record<string, RouteDefinition<any, any, any>>;
|
|
5296
|
+
/** Escape hatch: a Web-standard `fetch` handler (Hono, itty-router, …) for
|
|
5297
|
+
* paths no route matches. Apps that use only `fetch` forgo manifest-driven
|
|
5298
|
+
* route access and the typed client. */
|
|
5299
|
+
fetch?: (request: Request) => Promise<Response> | Response;
|
|
5300
|
+
}
|
|
5301
|
+
|
|
5091
5302
|
/**
|
|
5092
5303
|
* Lua Webhook class.
|
|
5093
5304
|
* Main class for building webhooks with validated inputs.
|
|
@@ -5255,7 +5466,9 @@ export declare type LuaWorkflowBuildCode = 'duplicate-step-id' | 'unknown-step-r
|
|
|
5255
5466
|
* verdict (deferred for an inherit child, 03 §3.1 table). Kept for one minor so a consumer switching on the union still
|
|
5256
5467
|
* compiles; removed in the next.
|
|
5257
5468
|
*/
|
|
5258
|
-
| 'workspace-not-declared' | 'workspace-inherit-without-parent-workspace' | 'workspace-inherit-conflict' | 'harness-requires-job-tier' | 'max-turns-requires-job-tier' | 'max-turns-invalid'
|
|
5469
|
+
| 'workspace-not-declared' | 'workspace-inherit-without-parent-workspace' | 'workspace-inherit-conflict' | 'harness-requires-job-tier' | 'max-turns-requires-job-tier' | 'max-turns-invalid'
|
|
5470
|
+
/** EM-WS3: a step's `plugins` outside the allowlist, repeated, or off the Job tier. */
|
|
5471
|
+
| 'plugins-invalid' | 'cap-exceeded' | 'chunk-size-invalid' | 'rate-limit-invalid' | 'backoff-invalid' | 'loop-interval-out-of-range' | 'mapping-placement' | 'container-arm-empty'
|
|
5259
5472
|
/**
|
|
5260
5473
|
* @deprecated LUA-684 — the builder no longer throws it: an `approval` / `waitForSignal` IS a container arm
|
|
5261
5474
|
* (`parallel(['approve', …])`). Where the engine cannot run one — a `loop` body, the step of a `[map, step]`
|
|
@@ -5361,6 +5574,18 @@ export declare interface LuaWorkflowConfig {
|
|
|
5361
5574
|
backfillOnEnable?: {
|
|
5362
5575
|
maxOccurrences?: number;
|
|
5363
5576
|
};
|
|
5577
|
+
/**
|
|
5578
|
+
* Schedule health — a dead-man for this schedule, watched by the platform (no heartbeat service to wire up).
|
|
5579
|
+
* The agent's owner (the schedule's creator, else the org admins) gets ONE notice per incident — inbox card plus
|
|
5580
|
+
* `notify` ('app' push, 'email', or 'emailApp', the default) — when, while the schedule is active:
|
|
5581
|
+
* - `maxSilenceMinutes` (5..43200): no scheduled run has COMPLETED successfully for that long;
|
|
5582
|
+
* - `alertAfterConsecutiveFailures` (1..3): that many scheduled runs failed in a row (the platform turns a
|
|
5583
|
+
* schedule off after 3, which always alerts);
|
|
5584
|
+
* and the notice resolves in place when the schedule is healthy again. Every transition is also an agent log
|
|
5585
|
+
* line (`lua logs`), so a log drain routes it to Better Stack / Datadog. Needs `schedule`; silence needs a
|
|
5586
|
+
* recurring one. See docs/workflows/schedule-health.md.
|
|
5587
|
+
*/
|
|
5588
|
+
health?: ScheduleHealthConfig;
|
|
5364
5589
|
/** Literal JSON passed as run input on every scheduled fire; must validate against `inputSchema` (P0-5e). */
|
|
5365
5590
|
scheduleInput?: Record<string, unknown>;
|
|
5366
5591
|
goal?: WorkflowGoalEnvelope;
|
|
@@ -5413,6 +5638,8 @@ export { MapDescriptor }
|
|
|
5413
5638
|
export declare interface MCPServerBaseConfig {
|
|
5414
5639
|
/** Unique identifier for this MCP server */
|
|
5415
5640
|
name: string;
|
|
5641
|
+
/** Optional description of this MCP server */
|
|
5642
|
+
description?: string;
|
|
5416
5643
|
/** Optional timeout in milliseconds (default: 60000) */
|
|
5417
5644
|
timeout?: number;
|
|
5418
5645
|
}
|
|
@@ -6397,6 +6624,12 @@ declare interface PushJobVersionDTO {
|
|
|
6397
6624
|
code?: string;
|
|
6398
6625
|
codeS3Hash?: string;
|
|
6399
6626
|
metadata?: Record<string, any>;
|
|
6627
|
+
/** EM-WS10 — `LuaJob({ health })`; sent only when declared. */
|
|
6628
|
+
health?: {
|
|
6629
|
+
maxSilenceMinutes?: number;
|
|
6630
|
+
alertAfterConsecutiveFailures?: number;
|
|
6631
|
+
notify?: 'app' | 'email' | 'emailApp';
|
|
6632
|
+
};
|
|
6400
6633
|
}
|
|
6401
6634
|
|
|
6402
6635
|
/**
|
|
@@ -6468,11 +6701,69 @@ declare type ResumeStepResult = {
|
|
|
6468
6701
|
* `maxBackoffSeconds` (default 3600) only meaningful with 'exponential' (`backoff-invalid` otherwise). */
|
|
6469
6702
|
export declare type RetryPolicy = WorkflowRetryPolicy;
|
|
6470
6703
|
|
|
6704
|
+
/**
|
|
6705
|
+
* Declare a route. Identity at runtime; exists so the compiler can see the
|
|
6706
|
+
* schemas and the handler, and so `RouteContext` is inferred from them.
|
|
6707
|
+
*/
|
|
6708
|
+
export declare function route<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown>(def: RouteDefinition<P, Q, B>): RouteDefinition<P, Q, B>;
|
|
6709
|
+
|
|
6710
|
+
/** What a route handler receives. `params`, `query` and `body` are already
|
|
6711
|
+
* validated by the route's schemas when those are declared. */
|
|
6712
|
+
export declare interface RouteContext<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown> {
|
|
6713
|
+
params: P;
|
|
6714
|
+
query: Q;
|
|
6715
|
+
body: B;
|
|
6716
|
+
/** Lower-cased, allow-listed request headers. */
|
|
6717
|
+
headers: Record<string, string>;
|
|
6718
|
+
method: WebRouteMethod;
|
|
6719
|
+
path: string;
|
|
6720
|
+
/** The matched route key. */
|
|
6721
|
+
route?: string;
|
|
6722
|
+
auth: LuaAuth;
|
|
6723
|
+
app: WebRouteApp;
|
|
6724
|
+
/** The Web `Request` the gateway received, for handlers that want it. */
|
|
6725
|
+
request: Request;
|
|
6726
|
+
}
|
|
6727
|
+
|
|
6728
|
+
export declare interface RouteDefinition<P = Record<string, string>, Q = Record<string, string | string[]>, B = unknown> {
|
|
6729
|
+
description?: string;
|
|
6730
|
+
/** Zod schema for path parameters; a failure answers 400 `VALIDATION`. */
|
|
6731
|
+
params?: ZodType<P>;
|
|
6732
|
+
/** Zod schema for query parameters; a failure answers 400 `VALIDATION`. */
|
|
6733
|
+
query?: ZodType<Q>;
|
|
6734
|
+
/** Zod schema for the request body; a failure answers 400 `VALIDATION`. */
|
|
6735
|
+
body?: ZodType<B>;
|
|
6736
|
+
/** Response schemas by status, for the typed client (not enforced at runtime). */
|
|
6737
|
+
responses?: Record<number, ZodType>;
|
|
6738
|
+
handler: (ctx: RouteContext<P, Q, B>) => Promise<RouteHandlerResult> | RouteHandlerResult;
|
|
6739
|
+
}
|
|
6740
|
+
|
|
6741
|
+
/** A handler returns a Web `Response`, `undefined` (→ 204) or any JSON value (→ 200). */
|
|
6742
|
+
export declare type RouteHandlerResult = Response | undefined | unknown;
|
|
6743
|
+
|
|
6471
6744
|
export declare const rows: (s: LuaWorkflowStep<any, any, any> | string, path: string, page: {
|
|
6472
6745
|
offset: number;
|
|
6473
6746
|
limit: number;
|
|
6474
6747
|
}) => MapDescriptor;
|
|
6475
6748
|
|
|
6749
|
+
/** Where an incident notice goes beyond the inbox card (which always lands). */
|
|
6750
|
+
declare const SCHEDULE_HEALTH_NOTIFY_CHANNELS: readonly ["app", "email", "emailApp"];
|
|
6751
|
+
|
|
6752
|
+
/** The declaration an author writes. At least one threshold is required. */
|
|
6753
|
+
declare interface ScheduleHealthConfig {
|
|
6754
|
+
/** Alert when no scheduled run has completed successfully for this many minutes (5..43200). */
|
|
6755
|
+
maxSilenceMinutes?: number;
|
|
6756
|
+
/**
|
|
6757
|
+
* Alert when this many scheduled runs in a row failed. Workflows and agent tasks are parked by the
|
|
6758
|
+
* platform after 3 consecutive failures, so for them the value is 1..3; code jobs accept 1..50.
|
|
6759
|
+
*/
|
|
6760
|
+
alertAfterConsecutiveFailures?: number;
|
|
6761
|
+
/** Out-of-inbox routing for the notice: 'app' (push), 'email', or 'emailApp' (both). Default 'emailApp'. */
|
|
6762
|
+
notify?: ScheduleHealthNotify;
|
|
6763
|
+
}
|
|
6764
|
+
|
|
6765
|
+
declare type ScheduleHealthNotify = (typeof SCHEDULE_HEALTH_NOTIFY_CHANNELS)[number];
|
|
6766
|
+
|
|
6476
6767
|
/**
|
|
6477
6768
|
* Additive field on primitive publish responses. When the agent is under
|
|
6478
6769
|
* versioning the server performs a scoped promote and returns the newly
|
|
@@ -6613,6 +6904,35 @@ export declare interface StepPathRef<TOut> {
|
|
|
6613
6904
|
/** An inline step object, or a string naming an entry declared by an `agentStep`/`specialistStep`/`toolStep`/`map` call in the same chain (03 §3.2.0). */
|
|
6614
6905
|
export declare type StepRef = LuaWorkflowStep<any, any, any> | string;
|
|
6615
6906
|
|
|
6907
|
+
declare interface SupervisedAgentSummary {
|
|
6908
|
+
agentId: string;
|
|
6909
|
+
name?: string;
|
|
6910
|
+
/** The supervision actions the CALLER holds on this agent (explicit grant rows only). */
|
|
6911
|
+
actions: string[];
|
|
6912
|
+
}
|
|
6913
|
+
|
|
6914
|
+
declare interface SupervisionLogRow {
|
|
6915
|
+
timestamp: string | number | Date;
|
|
6916
|
+
level?: string;
|
|
6917
|
+
/** Present only when the caller holds `supervision:observe-content` on the target. */
|
|
6918
|
+
message?: string;
|
|
6919
|
+
logSource?: string;
|
|
6920
|
+
primitiveName?: string;
|
|
6921
|
+
toolName?: string;
|
|
6922
|
+
}
|
|
6923
|
+
|
|
6924
|
+
declare interface SupervisionRunSummary {
|
|
6925
|
+
runId: string;
|
|
6926
|
+
workflowId?: string;
|
|
6927
|
+
workflowName?: string;
|
|
6928
|
+
status: string;
|
|
6929
|
+
reason?: string;
|
|
6930
|
+
trigger?: string;
|
|
6931
|
+
createdAt?: number;
|
|
6932
|
+
startedAt?: number;
|
|
6933
|
+
completedAt?: number;
|
|
6934
|
+
}
|
|
6935
|
+
|
|
6616
6936
|
/**
|
|
6617
6937
|
* Why an unattended run could not finish, reported by the agent itself instead
|
|
6618
6938
|
* of being guessed from its prose. The platform — not the agent — writes every
|
|
@@ -7320,6 +7640,60 @@ export declare interface WaitForSignalOptions {
|
|
|
7320
7640
|
acceptedSources?: Array<'webhook' | 'api' | 'user' | 'agent'>;
|
|
7321
7641
|
}
|
|
7322
7642
|
|
|
7643
|
+
/**
|
|
7644
|
+
* Per-app additions to the gateway's strict Content-Security-Policy
|
|
7645
|
+
* (`defineWebApp({ pages: { csp } })`, PRD 7.10.11). This camelCase shape is
|
|
7646
|
+
* what lua-cli writes, what `webAppVersion.csp` stores and what the gateway
|
|
7647
|
+
* reads; the gateway alone maps each key to its directive (`scriptSrc` →
|
|
7648
|
+
* `script-src`, …). A key outside this list is ignored by the gateway.
|
|
7649
|
+
*/
|
|
7650
|
+
declare const WEB_APP_CSP_KEYS: readonly ["scriptSrc", "styleSrc", "imgSrc", "connectSrc", "fontSrc", "frameSrc", "workerSrc"];
|
|
7651
|
+
|
|
7652
|
+
export declare const WEB_APP_NAME_PATTERN: RegExp;
|
|
7653
|
+
|
|
7654
|
+
declare const WEB_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
7655
|
+
|
|
7656
|
+
/** `defineWebApp({ branding })`, as lua-cli writes it and the version stores it. */
|
|
7657
|
+
export declare interface WebAppBranding {
|
|
7658
|
+
/** Display name in the shells; defaults to the app name. */
|
|
7659
|
+
name?: string;
|
|
7660
|
+
/** Path to a logo inside the pages project, shipped as an asset. */
|
|
7661
|
+
logo?: string;
|
|
7662
|
+
/** Accent color (any CSS color; OKLCH preferred). */
|
|
7663
|
+
accent?: string;
|
|
7664
|
+
}
|
|
7665
|
+
|
|
7666
|
+
/** Per-app additions to the gateway's strict Content-Security-Policy (PRD 7.10.11),
|
|
7667
|
+
* in the one camelCase shape lua-cli stores and the gateway reads. */
|
|
7668
|
+
export declare type WebAppCsp = WebAppCsp_2;
|
|
7669
|
+
|
|
7670
|
+
declare type WebAppCsp_2 = Partial<Record<WebAppCspKey, string[]>>;
|
|
7671
|
+
|
|
7672
|
+
declare type WebAppCspKey = (typeof WEB_APP_CSP_KEYS)[number];
|
|
7673
|
+
|
|
7674
|
+
/** One navigation entry of a web app (`defineWebApp({ pages: { nav } })`): drives the
|
|
7675
|
+
* app's nav rail and the shells' Apps tile. Written by lua-cli, stored on the version. */
|
|
7676
|
+
export declare interface WebAppNavItem {
|
|
7677
|
+
/** Client route path inside the app, e.g. `/tickets`. */
|
|
7678
|
+
path: string;
|
|
7679
|
+
label: string;
|
|
7680
|
+
/** An icon name from the design system's curated set. */
|
|
7681
|
+
icon?: string;
|
|
7682
|
+
}
|
|
7683
|
+
|
|
7684
|
+
export declare interface WebAppPages {
|
|
7685
|
+
/** The Vite project directory, relative to the app definition (usually `./web`). */
|
|
7686
|
+
root: string;
|
|
7687
|
+
/** Serve the entry HTML for every non-asset path (client-side routing). Default true. */
|
|
7688
|
+
spa?: boolean;
|
|
7689
|
+
/** Navigation the app and the shells agree on; drives the app's nav rail and the Apps hub tile. */
|
|
7690
|
+
nav?: WebAppNavItem[];
|
|
7691
|
+
csp?: WebAppCsp;
|
|
7692
|
+
}
|
|
7693
|
+
|
|
7694
|
+
/** Route keys are `'<METHOD> /<path>'`, e.g. `'POST /tickets/:id/close'`. */
|
|
7695
|
+
export declare type WebAppRouteKey = `${WebRouteMethod} /${string}`;
|
|
7696
|
+
|
|
7323
7697
|
/**
|
|
7324
7698
|
* Webhook request information from channel integrations.
|
|
7325
7699
|
* Contains the raw webhook payload from the channel provider.
|
|
@@ -7329,6 +7703,40 @@ export declare interface WebhookRequest {
|
|
|
7329
7703
|
payload: any;
|
|
7330
7704
|
}
|
|
7331
7705
|
|
|
7706
|
+
/** The app the handler belongs to, for `ctx.app` and log correlation. */
|
|
7707
|
+
declare interface WebRouteApp {
|
|
7708
|
+
id: string;
|
|
7709
|
+
name: string;
|
|
7710
|
+
version: string;
|
|
7711
|
+
/** Monotonic deployment ordinal of the app version being executed. */
|
|
7712
|
+
deployment: number;
|
|
7713
|
+
/** The app origin, e.g. `https://ops-dashboard-7f3a.apps.heylua.ai`; the
|
|
7714
|
+
* wrapper builds the Web `Request` URL against it. */
|
|
7715
|
+
origin: string;
|
|
7716
|
+
/** True for preview/sandbox deployments (reserved; always false in the MVP). */
|
|
7717
|
+
preview: boolean;
|
|
7718
|
+
}
|
|
7719
|
+
|
|
7720
|
+
/** The caller, as the gateway resolved it. Mirrors the shells' principal:
|
|
7721
|
+
* a first-party Lua session, never an API key, never anonymous. `roles` and
|
|
7722
|
+
* `scopes` are the effective ones on the app's agent target. */
|
|
7723
|
+
declare interface WebRouteAuth {
|
|
7724
|
+
userId: string;
|
|
7725
|
+
orgId: string;
|
|
7726
|
+
agentId: string;
|
|
7727
|
+
subjectType: 'user';
|
|
7728
|
+
credentialType: 'firstPartySession';
|
|
7729
|
+
sessionId?: string;
|
|
7730
|
+
roles: string[];
|
|
7731
|
+
scopes: string[];
|
|
7732
|
+
name?: string;
|
|
7733
|
+
email?: string;
|
|
7734
|
+
/** ISO timestamp the session token expires at, when known. */
|
|
7735
|
+
expiresAt?: string;
|
|
7736
|
+
}
|
|
7737
|
+
|
|
7738
|
+
declare type WebRouteMethod = (typeof WEB_ROUTE_METHODS)[number];
|
|
7739
|
+
|
|
7332
7740
|
/** Body of POST /developer/agents/:agentId/channels/whatsapp/reaction */
|
|
7333
7741
|
export declare interface WhatsAppReactionSendInput {
|
|
7334
7742
|
to: {
|
|
@@ -7626,6 +8034,9 @@ export declare type WorkflowJobHarness = WorkflowJobHarness_2;
|
|
|
7626
8034
|
|
|
7627
8035
|
declare type WorkflowJobHarness_2 = (typeof WORKFLOW_JOB_HARNESSES)[number];
|
|
7628
8036
|
|
|
8037
|
+
/** EM-WS3: the Job-tier plugin allowlist — a structural twin of the registry's id, parity-checked below. */
|
|
8038
|
+
declare type WorkflowJobPluginId = 'lua-agent-builder';
|
|
8039
|
+
|
|
7629
8040
|
declare type WorkflowJobResources = (typeof WORKFLOW_JOB_RESOURCES)[number];
|
|
7630
8041
|
|
|
7631
8042
|
export declare type WorkflowJobToolId = 'shell' | 'read' | 'write' | 'edit' | 'glob' | 'grep' | 'git' | 'gh' | 'fetch' | 'ripwire';
|