lua-cli 3.12.1 → 3.13.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/logs.api.service.d.ts +6 -3
- package/dist/api/logs.api.service.d.ts.map +1 -1
- package/dist/api/logs.api.service.js +5 -4
- package/dist/api/logs.api.service.js.map +1 -1
- package/dist/cli/command-definitions.d.ts.map +1 -1
- package/dist/cli/command-definitions.js +24 -2
- package/dist/cli/command-definitions.js.map +1 -1
- package/dist/commands/channels.d.ts.map +1 -1
- package/dist/commands/channels.js +2 -11
- package/dist/commands/channels.js.map +1 -1
- package/dist/commands/chat-log-probe.d.ts +59 -0
- package/dist/commands/chat-log-probe.d.ts.map +1 -0
- package/dist/commands/chat-log-probe.js +91 -0
- package/dist/commands/chat-log-probe.js.map +1 -0
- package/dist/commands/chat.d.ts.map +1 -1
- package/dist/commands/chat.js +134 -28
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/compile.d.ts +7 -0
- package/dist/commands/compile.d.ts.map +1 -1
- package/dist/commands/compile.js +32 -2
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/completion.d.ts.map +1 -1
- package/dist/commands/completion.js +7 -8
- package/dist/commands/completion.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +108 -23
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/devices.d.ts.map +1 -1
- package/dist/commands/devices.js +3 -2
- package/dist/commands/devices.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +43 -20
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/features.d.ts.map +1 -1
- package/dist/commands/features.js +2 -12
- package/dist/commands/features.js.map +1 -1
- package/dist/commands/governance.d.ts.map +1 -1
- package/dist/commands/governance.js +4 -8
- package/dist/commands/governance.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +12 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/integrations.d.ts.map +1 -1
- package/dist/commands/integrations.js +4 -2
- package/dist/commands/integrations.js.map +1 -1
- package/dist/commands/jobs.d.ts.map +1 -1
- package/dist/commands/jobs.js +61 -23
- package/dist/commands/jobs.js.map +1 -1
- package/dist/commands/log-tip.d.ts +79 -0
- package/dist/commands/log-tip.d.ts.map +1 -0
- package/dist/commands/log-tip.js +91 -0
- package/dist/commands/log-tip.js.map +1 -0
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +97 -136
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/marketplace.d.ts.map +1 -1
- package/dist/commands/marketplace.js +14 -25
- package/dist/commands/marketplace.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +17 -19
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/models.d.ts.map +1 -1
- package/dist/commands/models.js +2 -1
- package/dist/commands/models.js.map +1 -1
- package/dist/commands/persona.d.ts.map +1 -1
- package/dist/commands/persona.js +4 -30
- package/dist/commands/persona.js.map +1 -1
- package/dist/commands/postprocessors.d.ts.map +1 -1
- package/dist/commands/postprocessors.js +43 -17
- package/dist/commands/postprocessors.js.map +1 -1
- package/dist/commands/preprocessors.d.ts.map +1 -1
- package/dist/commands/preprocessors.js +43 -17
- package/dist/commands/preprocessors.js.map +1 -1
- package/dist/commands/production.d.ts.map +1 -1
- package/dist/commands/production.js +2 -12
- package/dist/commands/production.js.map +1 -1
- package/dist/commands/push-helpers.d.ts +42 -0
- package/dist/commands/push-helpers.d.ts.map +1 -0
- package/dist/commands/push-helpers.js +48 -0
- package/dist/commands/push-helpers.js.map +1 -0
- package/dist/commands/push.d.ts +2 -0
- package/dist/commands/push.d.ts.map +1 -1
- package/dist/commands/push.js +269 -54
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/pushBackup.d.ts.map +1 -1
- package/dist/commands/pushBackup.js +7 -1
- package/dist/commands/pushBackup.js.map +1 -1
- package/dist/commands/resources.d.ts.map +1 -1
- package/dist/commands/resources.js +2 -12
- package/dist/commands/resources.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +51 -36
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/status.d.ts +14 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +734 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +37 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/telemetry.d.ts.map +1 -1
- package/dist/commands/telemetry.js +4 -0
- package/dist/commands/telemetry.js.map +1 -1
- package/dist/commands/test-output.helpers.d.ts +24 -0
- package/dist/commands/test-output.helpers.d.ts.map +1 -0
- package/dist/commands/test-output.helpers.js +62 -0
- package/dist/commands/test-output.helpers.js.map +1 -0
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +236 -76
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +34 -21
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/compiler/agent-traverser.d.ts +50 -14
- package/dist/compiler/agent-traverser.d.ts.map +1 -1
- package/dist/compiler/agent-traverser.js +191 -86
- package/dist/compiler/agent-traverser.js.map +1 -1
- package/dist/compiler/compiler.d.ts +32 -0
- package/dist/compiler/compiler.d.ts.map +1 -1
- package/dist/compiler/compiler.js +143 -18
- package/dist/compiler/compiler.js.map +1 -1
- package/dist/compiler/index.d.ts +1 -1
- package/dist/compiler/index.d.ts.map +1 -1
- package/dist/compiler/index.js +1 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/compiler/plugins/base.d.ts +21 -0
- package/dist/compiler/plugins/base.d.ts.map +1 -1
- package/dist/compiler/plugins/base.js +10 -0
- package/dist/compiler/plugins/base.js.map +1 -1
- package/dist/compiler/plugins/skill.plugin.d.ts +35 -9
- package/dist/compiler/plugins/skill.plugin.d.ts.map +1 -1
- package/dist/compiler/plugins/skill.plugin.js +131 -84
- package/dist/compiler/plugins/skill.plugin.js.map +1 -1
- package/dist/compiler/types.d.ts +33 -0
- package/dist/compiler/types.d.ts.map +1 -1
- package/dist/compiler/types.js.map +1 -1
- package/dist/compiler/utils/ast-helpers.d.ts +1 -16
- package/dist/compiler/utils/ast-helpers.d.ts.map +1 -1
- package/dist/compiler/utils/ast-helpers.js +2 -31
- package/dist/compiler/utils/ast-helpers.js.map +1 -1
- package/dist/compiler/utils/common.d.ts +14 -0
- package/dist/compiler/utils/common.d.ts.map +1 -1
- package/dist/compiler/utils/common.js +38 -0
- package/dist/compiler/utils/common.js.map +1 -1
- package/dist/compiler/utils/path-resolver.d.ts +67 -10
- package/dist/compiler/utils/path-resolver.d.ts.map +1 -1
- package/dist/compiler/utils/path-resolver.js +120 -24
- package/dist/compiler/utils/path-resolver.js.map +1 -1
- package/dist/compiler/utils/reference-resolver.d.ts +196 -0
- package/dist/compiler/utils/reference-resolver.d.ts.map +1 -0
- package/dist/compiler/utils/reference-resolver.js +1030 -0
- package/dist/compiler/utils/reference-resolver.js.map +1 -0
- package/dist/compiler/utils/schema-converter.d.ts +25 -0
- package/dist/compiler/utils/schema-converter.d.ts.map +1 -1
- package/dist/compiler/utils/schema-converter.js +83 -4
- package/dist/compiler/utils/schema-converter.js.map +1 -1
- package/dist/compiler/utils/workspace.d.ts +35 -0
- package/dist/compiler/utils/workspace.d.ts.map +1 -0
- package/dist/compiler/utils/workspace.js +121 -0
- package/dist/compiler/utils/workspace.js.map +1 -0
- package/dist/compiler/utils/zod-runtime.mjs +5334 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interfaces/backup.d.ts +19 -1
- package/dist/interfaces/backup.d.ts.map +1 -1
- package/dist/interfaces/chat.d.ts +2 -2
- package/dist/interfaces/chat.d.ts.map +1 -1
- package/dist/interfaces/logs.d.ts +7 -4
- package/dist/interfaces/logs.d.ts.map +1 -1
- package/dist/primitives/base.handler.d.ts +10 -0
- package/dist/primitives/base.handler.d.ts.map +1 -1
- package/dist/primitives/base.handler.js +73 -44
- package/dist/primitives/base.handler.js.map +1 -1
- package/dist/primitives/job.handler.d.ts +5 -0
- package/dist/primitives/job.handler.d.ts.map +1 -1
- package/dist/primitives/job.handler.js +9 -0
- package/dist/primitives/job.handler.js.map +1 -1
- package/dist/primitives/webhook.handler.d.ts +2 -1
- package/dist/primitives/webhook.handler.d.ts.map +1 -1
- package/dist/primitives/webhook.handler.js +7 -1
- package/dist/primitives/webhook.handler.js.map +1 -1
- package/dist/services/auth.d.ts +8 -0
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +19 -0
- package/dist/services/auth.js.map +1 -1
- package/dist/services/sandbox.service.d.ts.map +1 -1
- package/dist/services/sandbox.service.js +6 -2
- package/dist/services/sandbox.service.js.map +1 -1
- package/dist/utils/aliases.d.ts +7 -0
- package/dist/utils/aliases.d.ts.map +1 -0
- package/dist/utils/aliases.js +457 -0
- package/dist/utils/aliases.js.map +1 -0
- package/dist/utils/backup-helpers.d.ts +24 -0
- package/dist/utils/backup-helpers.d.ts.map +1 -1
- package/dist/utils/backup-helpers.js +94 -8
- package/dist/utils/backup-helpers.js.map +1 -1
- package/dist/utils/chat-attachments.d.ts +15 -0
- package/dist/utils/chat-attachments.d.ts.map +1 -0
- package/dist/utils/chat-attachments.js +116 -0
- package/dist/utils/chat-attachments.js.map +1 -0
- package/dist/utils/cli.d.ts +24 -6
- package/dist/utils/cli.d.ts.map +1 -1
- package/dist/utils/cli.js +23 -9
- package/dist/utils/cli.js.map +1 -1
- package/dist/utils/hints.d.ts +81 -0
- package/dist/utils/hints.d.ts.map +1 -0
- package/dist/utils/hints.js +83 -0
- package/dist/utils/hints.js.map +1 -0
- package/dist/utils/suggest.d.ts +3 -0
- package/dist/utils/suggest.d.ts.map +1 -0
- package/dist/utils/suggest.js +34 -0
- package/dist/utils/suggest.js.map +1 -0
- package/dist/utils/write-info.d.ts +9 -0
- package/dist/utils/write-info.d.ts.map +1 -0
- package/dist/utils/write-info.js +11 -0
- package/dist/utils/write-info.js.map +1 -0
- package/docs/README.md +1 -1
- package/node_modules/@lua/shared-types/dist/index.d.mts +64 -2
- package/node_modules/@lua/shared-types/dist/index.d.ts +64 -2
- package/node_modules/@lua/shared-types/dist/index.js +27 -0
- package/node_modules/@lua/shared-types/dist/index.mjs +24 -0
- package/node_modules/@lua/shared-types/src/channel.type.ts +1 -0
- package/node_modules/@lua/shared-types/src/client-tools.types.ts +47 -0
- package/node_modules/@lua/shared-types/src/index.ts +2 -0
- package/node_modules/@lua/shared-types/src/vm-execution-log.types.ts +41 -0
- package/package.json +10 -6
- package/scripts/build-vendor.mjs +53 -0
- package/scripts/vendor-entry.mjs +11 -0
- package/template/examples/skills/tools/CustomDataTool.ts +1 -5
- package/template/examples/skills/tools/PremiumFeatureTool.ts +18 -18
- package/template/package.json +1 -1
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-action hint primitives (LUA-180).
|
|
3
|
+
*
|
|
4
|
+
* Pure module (no `import.meta.url`, no analytics) so it's directly testable
|
|
5
|
+
* via ts-jest. {@link ./cli.ts} re-exports these for back-compat with
|
|
6
|
+
* existing call sites.
|
|
7
|
+
*
|
|
8
|
+
* The goal: every push/deploy/chat/sync/compile/test surface ends with a
|
|
9
|
+
* one-line hint at the optimal next command — primarily `lua logs --type X`.
|
|
10
|
+
* Users (especially LLM builders running `lua chat -m "test"`) should never
|
|
11
|
+
* have to guess what to run next.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Returns true when post-action hints should be silently suppressed.
|
|
15
|
+
* Honors the `LUA_NO_HINTS` env var (any truthy value disables hints).
|
|
16
|
+
*
|
|
17
|
+
* Used by both {@link writeTip}/{@link writeNextStep} and the
|
|
18
|
+
* `withErrorHandling` `onError` hook so users can opt out of all hint noise
|
|
19
|
+
* with a single env var.
|
|
20
|
+
*/
|
|
21
|
+
export declare function hintsDisabled(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Render a free-form tip line. Format: `✨ Tip: <message>`.
|
|
24
|
+
*
|
|
25
|
+
* Honors {@link hintsDisabled} (LUA_NO_HINTS=1 silently no-ops). For tips
|
|
26
|
+
* that point at a specific follow-up command, prefer {@link writeNextStep}
|
|
27
|
+
* which renders the command in backticks with a consistent verb.
|
|
28
|
+
*/
|
|
29
|
+
export declare function writeTip(message: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Options for {@link writeNextStep}.
|
|
32
|
+
*/
|
|
33
|
+
export interface NextStepOptions {
|
|
34
|
+
/**
|
|
35
|
+
* The follow-up command to surface, e.g. `"lua logs --type skill --limit 10"`.
|
|
36
|
+
* Rendered in backticks.
|
|
37
|
+
*/
|
|
38
|
+
command: string;
|
|
39
|
+
/**
|
|
40
|
+
* Optional rationale appended after the command. A trailing period is added
|
|
41
|
+
* automatically if missing, e.g.
|
|
42
|
+
* rationale: "to inspect runtime behavior"
|
|
43
|
+
* → `✨ Tip: run \`<cmd>\` to inspect runtime behavior.`
|
|
44
|
+
*/
|
|
45
|
+
rationale?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Controls icon and label.
|
|
48
|
+
* - `success` (default) → `✨ Tip: run \`<cmd>\` ...`
|
|
49
|
+
* - `error` → `💡 Diagnose: run \`<cmd>\` ...`
|
|
50
|
+
* - `partial` → `⚠️ Diagnose: run \`<cmd>\` ...`
|
|
51
|
+
*/
|
|
52
|
+
when?: 'success' | 'error' | 'partial';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Render a "what to do next" hint pointing at a specific CLI command.
|
|
56
|
+
* Used after every push/deploy/chat/sync/compile/test action to make
|
|
57
|
+
* the optimal next command obvious to users and AI builders.
|
|
58
|
+
*
|
|
59
|
+
* Honors {@link hintsDisabled} (LUA_NO_HINTS=1 silently no-ops).
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeNextStep(opts: NextStepOptions): void;
|
|
62
|
+
export interface HintBlockLine {
|
|
63
|
+
label: string;
|
|
64
|
+
command: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Render a multi-line contextual hint block.
|
|
68
|
+
* Used when the optimal next action involves a sequence of commands or
|
|
69
|
+
* when a single-line hint would be too narrow (e.g., deploy-then-test).
|
|
70
|
+
*
|
|
71
|
+
* Output format:
|
|
72
|
+
* ✨ <headline>
|
|
73
|
+
* <label> <command>
|
|
74
|
+
* <label> <command>
|
|
75
|
+
*/
|
|
76
|
+
export declare function writeHintBlock(opts: {
|
|
77
|
+
headline: string;
|
|
78
|
+
lines: HintBlockLine[];
|
|
79
|
+
when?: 'success' | 'error' | 'partial';
|
|
80
|
+
}): void;
|
|
81
|
+
//# sourceMappingURL=hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.d.ts","sourceRoot":"","sources":["../../src/utils/hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAGvC;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG9C;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;CACxC;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAUzD;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,aAAa,EAAE,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;CACxC,GAAG,IAAI,CAcP"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-action hint primitives (LUA-180).
|
|
3
|
+
*
|
|
4
|
+
* Pure module (no `import.meta.url`, no analytics) so it's directly testable
|
|
5
|
+
* via ts-jest. {@link ./cli.ts} re-exports these for back-compat with
|
|
6
|
+
* existing call sites.
|
|
7
|
+
*
|
|
8
|
+
* The goal: every push/deploy/chat/sync/compile/test surface ends with a
|
|
9
|
+
* one-line hint at the optimal next command — primarily `lua logs --type X`.
|
|
10
|
+
* Users (especially LLM builders running `lua chat -m "test"`) should never
|
|
11
|
+
* have to guess what to run next.
|
|
12
|
+
*/
|
|
13
|
+
import { writeInfo } from './write-info.js';
|
|
14
|
+
/**
|
|
15
|
+
* Returns true when post-action hints should be silently suppressed.
|
|
16
|
+
* Honors the `LUA_NO_HINTS` env var (any truthy value disables hints).
|
|
17
|
+
*
|
|
18
|
+
* Used by both {@link writeTip}/{@link writeNextStep} and the
|
|
19
|
+
* `withErrorHandling` `onError` hook so users can opt out of all hint noise
|
|
20
|
+
* with a single env var.
|
|
21
|
+
*/
|
|
22
|
+
export function hintsDisabled() {
|
|
23
|
+
const v = process.env.LUA_NO_HINTS;
|
|
24
|
+
return v === '1' || v === 'true' || v === 'yes';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Render a free-form tip line. Format: `✨ Tip: <message>`.
|
|
28
|
+
*
|
|
29
|
+
* Honors {@link hintsDisabled} (LUA_NO_HINTS=1 silently no-ops). For tips
|
|
30
|
+
* that point at a specific follow-up command, prefer {@link writeNextStep}
|
|
31
|
+
* which renders the command in backticks with a consistent verb.
|
|
32
|
+
*/
|
|
33
|
+
export function writeTip(message) {
|
|
34
|
+
if (hintsDisabled())
|
|
35
|
+
return;
|
|
36
|
+
writeInfo(`✨ Tip: ${message}`);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Render a "what to do next" hint pointing at a specific CLI command.
|
|
40
|
+
* Used after every push/deploy/chat/sync/compile/test action to make
|
|
41
|
+
* the optimal next command obvious to users and AI builders.
|
|
42
|
+
*
|
|
43
|
+
* Honors {@link hintsDisabled} (LUA_NO_HINTS=1 silently no-ops).
|
|
44
|
+
*/
|
|
45
|
+
export function writeNextStep(opts) {
|
|
46
|
+
if (hintsDisabled())
|
|
47
|
+
return;
|
|
48
|
+
const when = opts.when ?? 'success';
|
|
49
|
+
const icon = when === 'error' ? '💡' : when === 'partial' ? '⚠️ ' : '✨';
|
|
50
|
+
const label = when === 'success' ? 'Tip' : 'Diagnose';
|
|
51
|
+
const rationale = opts.rationale?.trim();
|
|
52
|
+
const tail = rationale
|
|
53
|
+
? ` ${rationale}${/[.!?]$/.test(rationale) ? '' : '.'}`
|
|
54
|
+
: '';
|
|
55
|
+
writeInfo(`${icon} ${label}: run \`${opts.command}\`${tail}`);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Render a multi-line contextual hint block.
|
|
59
|
+
* Used when the optimal next action involves a sequence of commands or
|
|
60
|
+
* when a single-line hint would be too narrow (e.g., deploy-then-test).
|
|
61
|
+
*
|
|
62
|
+
* Output format:
|
|
63
|
+
* ✨ <headline>
|
|
64
|
+
* <label> <command>
|
|
65
|
+
* <label> <command>
|
|
66
|
+
*/
|
|
67
|
+
export function writeHintBlock(opts) {
|
|
68
|
+
if (hintsDisabled())
|
|
69
|
+
return;
|
|
70
|
+
const validLines = opts.lines.filter(l => l.command && l.command.trim().length > 0);
|
|
71
|
+
const when = opts.when ?? 'success';
|
|
72
|
+
const icon = when === 'error' ? '💡' : when === 'partial' ? '⚠️ ' : '✨';
|
|
73
|
+
if (validLines.length === 0) {
|
|
74
|
+
writeInfo(`${icon} ${opts.headline}`);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
writeInfo(`${icon} ${opts.headline}`);
|
|
78
|
+
const maxLabelLen = Math.max(...validLines.map(l => l.label.length));
|
|
79
|
+
for (const { label, command } of validLines) {
|
|
80
|
+
writeInfo(` ${label.padEnd(maxLabelLen)} \`${command}\``);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=hints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hints.js","sourceRoot":"","sources":["../../src/utils/hints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACnC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,CAAC;AAClD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,IAAI,aAAa,EAAE;QAAE,OAAO;IAC5B,SAAS,CAAC,UAAU,OAAO,EAAE,CAAC,CAAC;AACjC,CAAC;AA2BD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,IAAqB;IACjD,IAAI,aAAa,EAAE;QAAE,OAAO;IAC5B,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,SAAS;QACpB,CAAC,CAAC,IAAI,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE;QACvD,CAAC,CAAC,EAAE,CAAC;IACP,SAAS,CAAC,GAAG,IAAI,IAAI,KAAK,WAAW,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC,CAAC;AAChE,CAAC;AAOD;;;;;;;;;GASG;AACH,MAAM,UAAU,cAAc,CAAC,IAI9B;IACC,IAAI,aAAa,EAAE;QAAE,OAAO;IAC5B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpF,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,SAAS,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtC,OAAO;IACT,CAAC;IACD,SAAS,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,KAAK,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,UAAU,EAAE,CAAC;QAC5C,SAAS,CAAC,MAAM,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,OAAO,IAAI,CAAC,CAAC;IAC/D,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.d.ts","sourceRoot":"","sources":["../../src/utils/suggest.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAaxD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAcjF"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function levenshtein(a, b) {
|
|
2
|
+
const m = a.length, n = b.length;
|
|
3
|
+
const dp = Array.from({ length: m + 1 }, () => Array(n + 1).fill(0));
|
|
4
|
+
for (let i = 0; i <= m; i++)
|
|
5
|
+
dp[i][0] = i;
|
|
6
|
+
for (let j = 0; j <= n; j++)
|
|
7
|
+
dp[0][j] = j;
|
|
8
|
+
for (let i = 1; i <= m; i++) {
|
|
9
|
+
for (let j = 1; j <= n; j++) {
|
|
10
|
+
dp[i][j] = a[i - 1] === b[j - 1]
|
|
11
|
+
? dp[i - 1][j - 1]
|
|
12
|
+
: 1 + Math.min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return dp[m][n];
|
|
16
|
+
}
|
|
17
|
+
export function suggestClosest(input, candidates) {
|
|
18
|
+
const lower = input.toLowerCase();
|
|
19
|
+
let best = null;
|
|
20
|
+
let bestDist = Infinity;
|
|
21
|
+
for (const c of candidates) {
|
|
22
|
+
const dist = levenshtein(lower, c.toLowerCase());
|
|
23
|
+
if (dist < bestDist) {
|
|
24
|
+
bestDist = dist;
|
|
25
|
+
best = c;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!best || bestDist > 6)
|
|
29
|
+
return null;
|
|
30
|
+
if (bestDist >= (lower.length + best.length + 1) * 0.4)
|
|
31
|
+
return null;
|
|
32
|
+
return best;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=suggest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../../src/utils/suggest.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,CAAS,EAAE,CAAS;IAC9C,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,MAAM,EAAE,GAAe,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACjF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;QAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAC9B,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;gBAClB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,UAAoB;IAChE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,IAAI,QAAQ,GAAG,QAAQ,CAAC;IACxB,KAAK,MAAM,CAAC,IAAI,UAAU,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;QACjD,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YACpB,QAAQ,GAAG,IAAI,CAAC;YAChB,IAAI,GAAG,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IACD,IAAI,CAAC,IAAI,IAAI,QAAQ,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,GAAG;QAAE,OAAO,IAAI,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure stdout writer (extracted so {@link ./hints.ts} stays importable in
|
|
3
|
+
* tests — `cli.ts` itself uses `import.meta.url` which ts-jest can't compile).
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the existing `writeInfo` from `./cli.ts`: clears the current
|
|
6
|
+
* progress line via `\r\x1b[K` and writes `<message>\n`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function writeInfo(message: string): void;
|
|
9
|
+
//# sourceMappingURL=write-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-info.d.ts","sourceRoot":"","sources":["../../src/utils/write-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE/C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure stdout writer (extracted so {@link ./hints.ts} stays importable in
|
|
3
|
+
* tests — `cli.ts` itself uses `import.meta.url` which ts-jest can't compile).
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the existing `writeInfo` from `./cli.ts`: clears the current
|
|
6
|
+
* progress line via `\r\x1b[K` and writes `<message>\n`.
|
|
7
|
+
*/
|
|
8
|
+
export function writeInfo(message) {
|
|
9
|
+
process.stdout.write('\r\x1b[K' + message + '\n');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=write-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"write-info.js","sourceRoot":"","sources":["../../src/utils/write-info.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;AACpD,CAAC"}
|
package/docs/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Lua CLI - Complete API Documentation
|
|
2
2
|
|
|
3
|
-
Welcome to the comprehensive API documentation for lua-cli v3.
|
|
3
|
+
Welcome to the comprehensive API documentation for lua-cli v3.13.0. This guide covers every API, class, and function exported by the package.
|
|
4
4
|
|
|
5
5
|
## 📚 Documentation Index
|
|
6
6
|
|
|
@@ -5,7 +5,7 @@ import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserCon
|
|
|
5
5
|
* Represents the communication channel through which a request originated.
|
|
6
6
|
* Known channels are typed as string literals, unrecognized channels are unknown.
|
|
7
7
|
*/
|
|
8
|
-
type Channel = 'web' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
|
|
8
|
+
type Channel = 'web' | 'meeting' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* MIME types supported by Unstructured.io for document text extraction.
|
|
@@ -337,6 +337,50 @@ interface CachedDeviceTriggerDefinition {
|
|
|
337
337
|
env: Record<string, string>;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Client-Injected Tools
|
|
342
|
+
*
|
|
343
|
+
* Lets a chat client (Lua Desktop, custom front-ends, future surfaces) declare
|
|
344
|
+
* tools that the agent can call but the *client* renders/handles. Mirrors the
|
|
345
|
+
* pattern used by Claude Code, OpenAI Apps SDK, and Anthropic's MCP — the
|
|
346
|
+
* surface the user sees gets to add capabilities to the agent without changing
|
|
347
|
+
* the agent itself.
|
|
348
|
+
*
|
|
349
|
+
* Tool calls flow through Mastra's existing `tool-call` stream chunks; the
|
|
350
|
+
* server registers the tool with a no-op `execute` (returns `{ ok: true,
|
|
351
|
+
* clientHandled: true }`) so the model sees a clean ack and can continue. The
|
|
352
|
+
* actual rendering / side-effect happens on the client when it sees the
|
|
353
|
+
* tool-call chunk.
|
|
354
|
+
*
|
|
355
|
+
* Tool names are namespaced server-side as `client__<name>` to avoid collisions
|
|
356
|
+
* with built-in tools (skills, MCP, devices, voice). Same pattern as device
|
|
357
|
+
* tools (`device__<name>__<command>`).
|
|
358
|
+
*/
|
|
359
|
+
interface ClientToolDef {
|
|
360
|
+
/** Unprefixed tool name as the client refers to it (e.g. "create_artifact"). Server prefixes with `client__`. */
|
|
361
|
+
name: string;
|
|
362
|
+
/** Human/LLM-readable description of when to call this tool. */
|
|
363
|
+
description: string;
|
|
364
|
+
/**
|
|
365
|
+
* JSON Schema for the tool's input. Hydrated server-side into a Zod schema
|
|
366
|
+
* via the shared `jsonSchemaToZod` util. Same subset supported as device
|
|
367
|
+
* tools — object with string/number/boolean/array properties, `required`,
|
|
368
|
+
* `default`, `description`, `enum`.
|
|
369
|
+
*/
|
|
370
|
+
parameters: Record<string, unknown>;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Server-side prefix for client tool names. Keeps client tools from
|
|
374
|
+
* shadowing skills, MCP tools, devices (`device__`), or voice tools.
|
|
375
|
+
*/
|
|
376
|
+
declare const CLIENT_TOOL_PREFIX = "client__";
|
|
377
|
+
/**
|
|
378
|
+
* Maximum number of client tools accepted per request. Keeps the model's
|
|
379
|
+
* tool list bounded — at this many tools the model starts losing precision
|
|
380
|
+
* picking the right one anyway.
|
|
381
|
+
*/
|
|
382
|
+
declare const CLIENT_TOOLS_MAX = 20;
|
|
383
|
+
|
|
340
384
|
/**
|
|
341
385
|
* Shared type definitions for the model registry.
|
|
342
386
|
*
|
|
@@ -396,4 +440,22 @@ interface GovernanceConfig {
|
|
|
396
440
|
*/
|
|
397
441
|
declare function buildDefaultPersona(agentName: string): string;
|
|
398
442
|
|
|
399
|
-
|
|
443
|
+
declare const AGENT_LOG_SOURCES: readonly ["skill", "job", "webhook", "preprocessor", "postprocessor", "user_message", "agent_response", "agent_error", "runtime", "mcp", "rag", "device", "device-trigger"];
|
|
444
|
+
type AgentLogSource = (typeof AGENT_LOG_SOURCES)[number];
|
|
445
|
+
interface AgentLogMetadata {
|
|
446
|
+
userId?: string;
|
|
447
|
+
agentId?: string;
|
|
448
|
+
/** Agent runtime / conversation thread ID for distributed tracing */
|
|
449
|
+
runId?: string;
|
|
450
|
+
logSource?: AgentLogSource;
|
|
451
|
+
/** The ID of the source entity (skillId, jobId, webhookId, etc.) */
|
|
452
|
+
primitiveId?: string;
|
|
453
|
+
/** The display name of the source entity */
|
|
454
|
+
primitiveName?: string;
|
|
455
|
+
toolId?: string;
|
|
456
|
+
toolName?: string;
|
|
457
|
+
/** Messaging channel: 'whatsapp', 'slack', 'email', etc. */
|
|
458
|
+
channel?: string;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona };
|
|
@@ -5,7 +5,7 @@ import { FinishReason, LanguageModelUsage, ReasoningOutput, CallWarning, UserCon
|
|
|
5
5
|
* Represents the communication channel through which a request originated.
|
|
6
6
|
* Known channels are typed as string literals, unrecognized channels are unknown.
|
|
7
7
|
*/
|
|
8
|
-
type Channel = 'web' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
|
|
8
|
+
type Channel = 'web' | 'meeting' | 'whatsapp' | 'facebook' | 'instagram' | 'slack' | 'teams' | 'messagebird' | 'front' | 'api' | 'dev' | 'email' | 'rcs' | 'sms' | 'mms' | 'device' | string;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* MIME types supported by Unstructured.io for document text extraction.
|
|
@@ -337,6 +337,50 @@ interface CachedDeviceTriggerDefinition {
|
|
|
337
337
|
env: Record<string, string>;
|
|
338
338
|
}
|
|
339
339
|
|
|
340
|
+
/**
|
|
341
|
+
* Client-Injected Tools
|
|
342
|
+
*
|
|
343
|
+
* Lets a chat client (Lua Desktop, custom front-ends, future surfaces) declare
|
|
344
|
+
* tools that the agent can call but the *client* renders/handles. Mirrors the
|
|
345
|
+
* pattern used by Claude Code, OpenAI Apps SDK, and Anthropic's MCP — the
|
|
346
|
+
* surface the user sees gets to add capabilities to the agent without changing
|
|
347
|
+
* the agent itself.
|
|
348
|
+
*
|
|
349
|
+
* Tool calls flow through Mastra's existing `tool-call` stream chunks; the
|
|
350
|
+
* server registers the tool with a no-op `execute` (returns `{ ok: true,
|
|
351
|
+
* clientHandled: true }`) so the model sees a clean ack and can continue. The
|
|
352
|
+
* actual rendering / side-effect happens on the client when it sees the
|
|
353
|
+
* tool-call chunk.
|
|
354
|
+
*
|
|
355
|
+
* Tool names are namespaced server-side as `client__<name>` to avoid collisions
|
|
356
|
+
* with built-in tools (skills, MCP, devices, voice). Same pattern as device
|
|
357
|
+
* tools (`device__<name>__<command>`).
|
|
358
|
+
*/
|
|
359
|
+
interface ClientToolDef {
|
|
360
|
+
/** Unprefixed tool name as the client refers to it (e.g. "create_artifact"). Server prefixes with `client__`. */
|
|
361
|
+
name: string;
|
|
362
|
+
/** Human/LLM-readable description of when to call this tool. */
|
|
363
|
+
description: string;
|
|
364
|
+
/**
|
|
365
|
+
* JSON Schema for the tool's input. Hydrated server-side into a Zod schema
|
|
366
|
+
* via the shared `jsonSchemaToZod` util. Same subset supported as device
|
|
367
|
+
* tools — object with string/number/boolean/array properties, `required`,
|
|
368
|
+
* `default`, `description`, `enum`.
|
|
369
|
+
*/
|
|
370
|
+
parameters: Record<string, unknown>;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Server-side prefix for client tool names. Keeps client tools from
|
|
374
|
+
* shadowing skills, MCP tools, devices (`device__`), or voice tools.
|
|
375
|
+
*/
|
|
376
|
+
declare const CLIENT_TOOL_PREFIX = "client__";
|
|
377
|
+
/**
|
|
378
|
+
* Maximum number of client tools accepted per request. Keeps the model's
|
|
379
|
+
* tool list bounded — at this many tools the model starts losing precision
|
|
380
|
+
* picking the right one anyway.
|
|
381
|
+
*/
|
|
382
|
+
declare const CLIENT_TOOLS_MAX = 20;
|
|
383
|
+
|
|
340
384
|
/**
|
|
341
385
|
* Shared type definitions for the model registry.
|
|
342
386
|
*
|
|
@@ -396,4 +440,22 @@ interface GovernanceConfig {
|
|
|
396
440
|
*/
|
|
397
441
|
declare function buildDefaultPersona(agentName: string): string;
|
|
398
442
|
|
|
399
|
-
|
|
443
|
+
declare const AGENT_LOG_SOURCES: readonly ["skill", "job", "webhook", "preprocessor", "postprocessor", "user_message", "agent_response", "agent_error", "runtime", "mcp", "rag", "device", "device-trigger"];
|
|
444
|
+
type AgentLogSource = (typeof AGENT_LOG_SOURCES)[number];
|
|
445
|
+
interface AgentLogMetadata {
|
|
446
|
+
userId?: string;
|
|
447
|
+
agentId?: string;
|
|
448
|
+
/** Agent runtime / conversation thread ID for distributed tracing */
|
|
449
|
+
runId?: string;
|
|
450
|
+
logSource?: AgentLogSource;
|
|
451
|
+
/** The ID of the source entity (skillId, jobId, webhookId, etc.) */
|
|
452
|
+
primitiveId?: string;
|
|
453
|
+
/** The display name of the source entity */
|
|
454
|
+
primitiveName?: string;
|
|
455
|
+
toolId?: string;
|
|
456
|
+
toolName?: string;
|
|
457
|
+
/** Messaging channel: 'whatsapp', 'slack', 'email', etc. */
|
|
458
|
+
channel?: string;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
export { AGENT_LOG_SOURCES, type AgentInvocationInput, type AgentInvocationOutput, type AgentLogMetadata, type AgentLogSource, type AiGenerateInput, type AiGenerateOutput, type AiGenerateSource, type AiGenerateToolCall, type AiGenerateToolResult, type ApprovedModelDef, type BatchingConfig, CLIENT_TOOLS_MAX, CLIENT_TOOL_PREFIX, type CachedDeviceCommand, type CachedDeviceDefinition, type CachedDeviceTrigger, type CachedDeviceTriggerDefinition, type Channel, type ClientToolDef, type CommandHashData, type CommandState, type CommandStreamEntry, type DeviceCommandDefinition, type DeviceCommandMessage, type DeviceInfo, type DeviceResponseMessage, type DeviceStatus, type DeviceTriggerAckMessage, type DeviceTriggerMessage, type GovernanceConfig, REQUIRED_ENUMS, REQUIRED_NESTED_APIS, REQUIRED_PLATFORM_APIS, REQUIRED_PRIMITIVE_SHIMS, REQUIRED_UTILITIES, type ResponseStreamEntry, type TriggerStreamEntry, UNSTRUCTURED_SUPPORTED_MEDIA_TYPES, aiGenerateInputFromSimplified, buildDefaultPersona };
|
|
@@ -20,6 +20,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AGENT_LOG_SOURCES: () => AGENT_LOG_SOURCES,
|
|
24
|
+
CLIENT_TOOLS_MAX: () => CLIENT_TOOLS_MAX,
|
|
25
|
+
CLIENT_TOOL_PREFIX: () => CLIENT_TOOL_PREFIX,
|
|
23
26
|
REQUIRED_ENUMS: () => REQUIRED_ENUMS,
|
|
24
27
|
REQUIRED_NESTED_APIS: () => REQUIRED_NESTED_APIS,
|
|
25
28
|
REQUIRED_PLATFORM_APIS: () => REQUIRED_PLATFORM_APIS,
|
|
@@ -208,6 +211,10 @@ var REQUIRED_UTILITIES = [
|
|
|
208
211
|
"env"
|
|
209
212
|
];
|
|
210
213
|
|
|
214
|
+
// src/client-tools.types.ts
|
|
215
|
+
var CLIENT_TOOL_PREFIX = "client__";
|
|
216
|
+
var CLIENT_TOOLS_MAX = 20;
|
|
217
|
+
|
|
211
218
|
// src/persona-defaults.ts
|
|
212
219
|
var AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
213
220
|
var DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
@@ -260,8 +267,28 @@ function buildDefaultPersona(agentName) {
|
|
|
260
267
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
261
268
|
}
|
|
262
269
|
__name(buildDefaultPersona, "buildDefaultPersona");
|
|
270
|
+
|
|
271
|
+
// src/vm-execution-log.types.ts
|
|
272
|
+
var AGENT_LOG_SOURCES = [
|
|
273
|
+
"skill",
|
|
274
|
+
"job",
|
|
275
|
+
"webhook",
|
|
276
|
+
"preprocessor",
|
|
277
|
+
"postprocessor",
|
|
278
|
+
"user_message",
|
|
279
|
+
"agent_response",
|
|
280
|
+
"agent_error",
|
|
281
|
+
"runtime",
|
|
282
|
+
"mcp",
|
|
283
|
+
"rag",
|
|
284
|
+
"device",
|
|
285
|
+
"device-trigger"
|
|
286
|
+
];
|
|
263
287
|
// Annotate the CommonJS export names for ESM import in node:
|
|
264
288
|
0 && (module.exports = {
|
|
289
|
+
AGENT_LOG_SOURCES,
|
|
290
|
+
CLIENT_TOOLS_MAX,
|
|
291
|
+
CLIENT_TOOL_PREFIX,
|
|
265
292
|
REQUIRED_ENUMS,
|
|
266
293
|
REQUIRED_NESTED_APIS,
|
|
267
294
|
REQUIRED_PLATFORM_APIS,
|
|
@@ -178,6 +178,10 @@ var REQUIRED_UTILITIES = [
|
|
|
178
178
|
"env"
|
|
179
179
|
];
|
|
180
180
|
|
|
181
|
+
// src/client-tools.types.ts
|
|
182
|
+
var CLIENT_TOOL_PREFIX = "client__";
|
|
183
|
+
var CLIENT_TOOLS_MAX = 20;
|
|
184
|
+
|
|
181
185
|
// src/persona-defaults.ts
|
|
182
186
|
var AGENT_NAME_TOKEN = "[Your Agent Name]";
|
|
183
187
|
var DEFAULT_PERSONA_GUIDE = `# ${AGENT_NAME_TOKEN} - Persona
|
|
@@ -230,7 +234,27 @@ function buildDefaultPersona(agentName) {
|
|
|
230
234
|
return DEFAULT_PERSONA_GUIDE.replace(AGENT_NAME_TOKEN, () => agentName || "My Agent");
|
|
231
235
|
}
|
|
232
236
|
__name(buildDefaultPersona, "buildDefaultPersona");
|
|
237
|
+
|
|
238
|
+
// src/vm-execution-log.types.ts
|
|
239
|
+
var AGENT_LOG_SOURCES = [
|
|
240
|
+
"skill",
|
|
241
|
+
"job",
|
|
242
|
+
"webhook",
|
|
243
|
+
"preprocessor",
|
|
244
|
+
"postprocessor",
|
|
245
|
+
"user_message",
|
|
246
|
+
"agent_response",
|
|
247
|
+
"agent_error",
|
|
248
|
+
"runtime",
|
|
249
|
+
"mcp",
|
|
250
|
+
"rag",
|
|
251
|
+
"device",
|
|
252
|
+
"device-trigger"
|
|
253
|
+
];
|
|
233
254
|
export {
|
|
255
|
+
AGENT_LOG_SOURCES,
|
|
256
|
+
CLIENT_TOOLS_MAX,
|
|
257
|
+
CLIENT_TOOL_PREFIX,
|
|
234
258
|
REQUIRED_ENUMS,
|
|
235
259
|
REQUIRED_NESTED_APIS,
|
|
236
260
|
REQUIRED_PLATFORM_APIS,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client-Injected Tools
|
|
3
|
+
*
|
|
4
|
+
* Lets a chat client (Lua Desktop, custom front-ends, future surfaces) declare
|
|
5
|
+
* tools that the agent can call but the *client* renders/handles. Mirrors the
|
|
6
|
+
* pattern used by Claude Code, OpenAI Apps SDK, and Anthropic's MCP — the
|
|
7
|
+
* surface the user sees gets to add capabilities to the agent without changing
|
|
8
|
+
* the agent itself.
|
|
9
|
+
*
|
|
10
|
+
* Tool calls flow through Mastra's existing `tool-call` stream chunks; the
|
|
11
|
+
* server registers the tool with a no-op `execute` (returns `{ ok: true,
|
|
12
|
+
* clientHandled: true }`) so the model sees a clean ack and can continue. The
|
|
13
|
+
* actual rendering / side-effect happens on the client when it sees the
|
|
14
|
+
* tool-call chunk.
|
|
15
|
+
*
|
|
16
|
+
* Tool names are namespaced server-side as `client__<name>` to avoid collisions
|
|
17
|
+
* with built-in tools (skills, MCP, devices, voice). Same pattern as device
|
|
18
|
+
* tools (`device__<name>__<command>`).
|
|
19
|
+
*/
|
|
20
|
+
export interface ClientToolDef {
|
|
21
|
+
/** Unprefixed tool name as the client refers to it (e.g. "create_artifact"). Server prefixes with `client__`. */
|
|
22
|
+
name: string;
|
|
23
|
+
|
|
24
|
+
/** Human/LLM-readable description of when to call this tool. */
|
|
25
|
+
description: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* JSON Schema for the tool's input. Hydrated server-side into a Zod schema
|
|
29
|
+
* via the shared `jsonSchemaToZod` util. Same subset supported as device
|
|
30
|
+
* tools — object with string/number/boolean/array properties, `required`,
|
|
31
|
+
* `default`, `description`, `enum`.
|
|
32
|
+
*/
|
|
33
|
+
parameters: Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Server-side prefix for client tool names. Keeps client tools from
|
|
38
|
+
* shadowing skills, MCP tools, devices (`device__`), or voice tools.
|
|
39
|
+
*/
|
|
40
|
+
export const CLIENT_TOOL_PREFIX = 'client__';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Maximum number of client tools accepted per request. Keeps the model's
|
|
44
|
+
* tool list bounded — at this many tools the model starts losing precision
|
|
45
|
+
* picking the right one anyway.
|
|
46
|
+
*/
|
|
47
|
+
export const CLIENT_TOOLS_MAX = 20;
|
|
@@ -5,6 +5,8 @@ export * from './ai-generate.utils';
|
|
|
5
5
|
export * from './agent-invocation.types';
|
|
6
6
|
export * from './sandbox-contract';
|
|
7
7
|
export * from './device.types';
|
|
8
|
+
export * from './client-tools.types';
|
|
8
9
|
export * from './model-registry';
|
|
9
10
|
export * from './agent-config.types';
|
|
10
11
|
export * from './persona-defaults';
|
|
12
|
+
export * from './vm-execution-log.types';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// ─── Canonical log-source enum ────────────────────────────────────────────────
|
|
2
|
+
// Single source of truth for all `logSource` values written to the
|
|
3
|
+
// `vmExecutionLogs` collection. Every consumer (lua-core, lua-api, lua-cli,
|
|
4
|
+
// lua-web) must import from here — never define the union inline elsewhere.
|
|
5
|
+
//
|
|
6
|
+
// NOTE: This lives in shared-types (not shared-schemas) so that lightweight
|
|
7
|
+
// consumers such as lua-cli can import it without pulling in Mongoose schemas.
|
|
8
|
+
|
|
9
|
+
export const AGENT_LOG_SOURCES = [
|
|
10
|
+
'skill', // User-defined skill executions
|
|
11
|
+
'job', // Scheduled job executions
|
|
12
|
+
'webhook', // HTTP webhook endpoint executions
|
|
13
|
+
'preprocessor', // Message preprocessor executions
|
|
14
|
+
'postprocessor', // Response postprocessor executions
|
|
15
|
+
'user_message', // Incoming user messages
|
|
16
|
+
'agent_response', // Outgoing agent responses
|
|
17
|
+
'agent_error', // Chat pipeline errors (billing, validation, LLM failures)
|
|
18
|
+
'runtime', // Agent runtime / LLM SDK / MCP transport / framework-level logs
|
|
19
|
+
'mcp', // MCP tool executions
|
|
20
|
+
'rag', // RAG knowledge-base search executions
|
|
21
|
+
'device', // Device command executions
|
|
22
|
+
'device-trigger', // Device trigger handler executions
|
|
23
|
+
] as const;
|
|
24
|
+
|
|
25
|
+
export type AgentLogSource = (typeof AGENT_LOG_SOURCES)[number];
|
|
26
|
+
|
|
27
|
+
export interface AgentLogMetadata {
|
|
28
|
+
userId?: string;
|
|
29
|
+
agentId?: string;
|
|
30
|
+
/** Agent runtime / conversation thread ID for distributed tracing */
|
|
31
|
+
runId?: string;
|
|
32
|
+
logSource?: AgentLogSource;
|
|
33
|
+
/** The ID of the source entity (skillId, jobId, webhookId, etc.) */
|
|
34
|
+
primitiveId?: string;
|
|
35
|
+
/** The display name of the source entity */
|
|
36
|
+
primitiveName?: string;
|
|
37
|
+
toolId?: string;
|
|
38
|
+
toolName?: string;
|
|
39
|
+
/** Messaging channel: 'whatsapp', 'slack', 'email', etc. */
|
|
40
|
+
channel?: string;
|
|
41
|
+
}
|