@lunnoa/client 2.1.0 → 2.3.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/README.md +3 -2
- package/dist/cli.js +201 -3
- package/dist/index.cjs +93 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +206 -5
- package/dist/index.d.ts +206 -5
- package/dist/index.js +90 -2
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +67 -2
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +164 -4
- package/dist/react.d.ts +164 -4
- package/dist/react.js +67 -2
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/skills/lunnoa-client/SKILL.md +61 -7
- package/skills/lunnoa-solution-design/SKILL.md +26 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunnoa/client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "TypeScript SDK for building applications on top of Lunnoa Automate — typed client for the Public API (agents, workflows, executions, entities, knowledge, queues), SSE agent chat streaming, and deployment-specific codegen",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -58,11 +58,15 @@ Run these before inventing resources or shipping UI code:
|
|
|
58
58
|
3. **Discover before inventing** — prefer the CLI (JSON for agents), then
|
|
59
59
|
the SDK: `npx @lunnoa/client tools list --json --for-agent`,
|
|
60
60
|
`tools get <actionId> --json`, `apps list`, `connections list`,
|
|
61
|
+
`ai-connections list --json`,
|
|
61
62
|
`agents|workflows|entity-types|tables list`, `tables get <slugOrId>`,
|
|
62
63
|
`features`.
|
|
63
64
|
SDK equivalents: `workflowApps.list()`, `agents.list`, `workflows.list`,
|
|
64
|
-
`entityTypes.list`, `tables.list`, `
|
|
65
|
-
|
|
65
|
+
`entityTypes.list`, `tables.list`, `aiConnections.list()`,
|
|
66
|
+
`discovery.enabledFeatures()`.
|
|
67
|
+
Do not invent catalogue action ids or model ids. `connections list` is
|
|
68
|
+
app connections (Gmail, HTTP). `ai-connections list` is the model
|
|
69
|
+
provider connection and the `models[].id` values `defineAgent` accepts.
|
|
66
70
|
4. **Run vs deploy** — Ad-hoc: `actions.run` / `runs.start` /
|
|
67
71
|
`workflows.execute`. Durable shared automation: CLI
|
|
68
72
|
`npx @lunnoa/client workflows|agents deploy`. Upsert is by slug
|
|
@@ -218,7 +222,8 @@ await lunnoa.tables.upsertBySlug({
|
|
|
218
222
|
- A workflow's manual-trigger input fields live on
|
|
219
223
|
`workflows.get(id, { expansion: ['triggerNode'] })` →
|
|
220
224
|
`triggerNode.value.customInputConfig` (each field: `id`, `label`,
|
|
221
|
-
`inputType`, `required`, `selectOptions`).
|
|
225
|
+
`inputType`, `required`, `selectOptions`). Declare them at deploy time
|
|
226
|
+
with `defineTrigger({ id: 'flow-control_trigger_manual', inputs })`.
|
|
222
227
|
- `workflowApps.list()` resolves `executionPath` step `appId`/`actionId`
|
|
223
228
|
pairs to human-readable names and icons.
|
|
224
229
|
|
|
@@ -347,11 +352,13 @@ Pure typed config (no network):
|
|
|
347
352
|
import {
|
|
348
353
|
defineAction,
|
|
349
354
|
defineAgent,
|
|
355
|
+
defineTrigger,
|
|
350
356
|
defineWorkflow,
|
|
351
357
|
} from '@lunnoa/client';
|
|
352
358
|
|
|
353
359
|
export const ping = defineWorkflow({
|
|
354
360
|
slug: 'ping',
|
|
361
|
+
// Omit trigger for Manually Run with no input fields.
|
|
355
362
|
steps: [
|
|
356
363
|
{
|
|
357
364
|
use: defineAction({
|
|
@@ -362,32 +369,77 @@ export const ping = defineWorkflow({
|
|
|
362
369
|
],
|
|
363
370
|
});
|
|
364
371
|
|
|
372
|
+
export const syncOrders = defineWorkflow({
|
|
373
|
+
slug: 'sync-orders',
|
|
374
|
+
trigger: defineTrigger({
|
|
375
|
+
id: 'flow-control_trigger_manual',
|
|
376
|
+
inputs: [
|
|
377
|
+
{ id: 'invoiceId', label: 'Invoice', inputType: 'text', required: true },
|
|
378
|
+
],
|
|
379
|
+
}),
|
|
380
|
+
steps: [
|
|
381
|
+
{
|
|
382
|
+
use: defineAction({
|
|
383
|
+
id: 'http_action_send-request',
|
|
384
|
+
input: { method: 'GET', url: 'https://example.com/orders' },
|
|
385
|
+
}),
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
});
|
|
389
|
+
|
|
365
390
|
export const triage = defineAgent({
|
|
366
391
|
slug: 'support-triage',
|
|
367
|
-
|
|
392
|
+
// models[].id from `npx @lunnoa/client ai-connections list --json`
|
|
393
|
+
model: 'deepseek-ai/DeepSeek-V4-Pro',
|
|
368
394
|
instructions: 'Triage mail. Be concise.',
|
|
369
395
|
tools: [defineAction({ id: 'http_action_send-request' })],
|
|
370
396
|
});
|
|
371
397
|
```
|
|
372
398
|
|
|
373
|
-
Ad-hoc multi-step run (one Execution, `source: SDK`)
|
|
399
|
+
Ad-hoc multi-step run (one Execution, `source: SDK`). `runs.start` sends
|
|
400
|
+
steps only. A `trigger` on the definition is ignored. Deploy to persist it.
|
|
374
401
|
|
|
375
402
|
```typescript
|
|
376
403
|
const result = await lunnoa.runs.start(ping);
|
|
377
404
|
// or lunnoa.runs.startAndWait(ping)
|
|
378
405
|
```
|
|
379
406
|
|
|
407
|
+
One catalogue trigger per deployed workflow:
|
|
408
|
+
|
|
409
|
+
- **Manually Run** (`flow-control_trigger_manual`): `inputs` is the caller
|
|
410
|
+
form. It is stored as `customInputConfig`. `workflows.execute(id, { invoiceId })`
|
|
411
|
+
passes those keys.
|
|
412
|
+
- **Listen for Webhook** (`flow-control_trigger_listen-for-webhook`):
|
|
413
|
+
`input: { method: 'POST' }` (`PUT` or `GET` too).
|
|
414
|
+
- **Recurring Schedule** (`flow-control_trigger_recurring-schedule`): `input`
|
|
415
|
+
from the catalogue (`start`, `rrule`). A schedule that cannot compute its
|
|
416
|
+
next run fails the deploy.
|
|
417
|
+
- **Any other trigger:** `id` from `apps get`, optional `connection`, and
|
|
418
|
+
`input` copied from that trigger's `inputConfig`. Do not invent ids.
|
|
419
|
+
|
|
380
420
|
Discover the catalogue **before** writing `defineAction` (do not guess ids):
|
|
381
421
|
|
|
382
422
|
```bash
|
|
383
423
|
npx @lunnoa/client tools list --json --for-agent
|
|
384
424
|
npx @lunnoa/client tools search email --json --for-agent
|
|
385
425
|
npx @lunnoa/client tools get http_action_send-request --json
|
|
426
|
+
npx @lunnoa/client apps get flow-control --json
|
|
386
427
|
npx @lunnoa/client connections list --app gmail --json
|
|
428
|
+
npx @lunnoa/client ai-connections list --json
|
|
387
429
|
```
|
|
388
430
|
|
|
389
431
|
`tools get` returns `inputConfig` / `inputFields` and a `defineAction` sketch.
|
|
390
|
-
`tools list` is compact; use `get` for the schema.
|
|
432
|
+
`tools list` is compact; use `get` for the schema. `apps get --json` returns
|
|
433
|
+
`triggers[]` with `triggerId`, `inputFields`, and a `defineTrigger` sketch.
|
|
434
|
+
`--json` is for coding agents. Do not invent trigger ids.
|
|
435
|
+
|
|
436
|
+
`ai-connections list` returns the AI connections this key can assign to an
|
|
437
|
+
agent. Set `defineAgent({ model })` to a `models[].id` from that JSON
|
|
438
|
+
(on Lunnoa LLMs that is a catalogue id such as
|
|
439
|
+
`deepseek-ai/DeepSeek-V4-Pro`). Omit `aiConnection` to
|
|
440
|
+
use the connection with `isDefault: true`. Pass
|
|
441
|
+
`defineAiConnection({ id })` only for a different connection. SDK:
|
|
442
|
+
`lunnoa.aiConnections.list()`.
|
|
391
443
|
|
|
392
444
|
Deploy to Automate UI (upsert by slug inside the workspace on the API key; prefer CLI):
|
|
393
445
|
|
|
@@ -442,6 +494,8 @@ for await (const chunk of stream) {
|
|
|
442
494
|
}
|
|
443
495
|
```
|
|
444
496
|
|
|
497
|
+
A turn from an app runs in **preview**: 10 model rounds, so the agent can call tools a few times and still send a final reply. The SDK sends `chatMode: 'preview'` for you. Do not pass `chatMode: 'builder'` from an app. That is the agent-editor interview: 4 rounds, and it stops a tool-using agent halfway. The workflow then fails with "Agent did not generate a response" even when a tool already saved the data. A workflow Message Agent step uses the same preview budget. For a job that chains many tool calls (read every record, then write a result), turn on **Long-horizon mode** on that agent in Lunnoa. That raises the budget to 50 rounds. `defineAgent` cannot set the switch, and a later deploy leaves it as you set it.
|
|
498
|
+
|
|
445
499
|
- **React apps:** prefer `useAgentChat` from `@lunnoa/client/react`, which wraps AI SDK `useChat` + `DefaultChatTransport`
|
|
446
500
|
pointed at
|
|
447
501
|
`${baseUrl}/api/agents/${agentId}/tasks/${taskId}/stream-message` with an
|
|
@@ -538,7 +592,7 @@ with emails (capped; not Azure object IDs).
|
|
|
538
592
|
3. Call `discovery.enabledFeatures()` and hide unsupported areas.
|
|
539
593
|
4. Build forms/tables from `attributeSchema` / `customInputConfig` (or the generated types).
|
|
540
594
|
5. Render workflow progress from `executionPath`; handle `NEEDS_INPUT` with `submitInput`.
|
|
541
|
-
6. For single-action calls, use `actions.run`; for linear multi-step, use `runs.start` / `defineWorkflow`. Deploy with `npx @lunnoa/client workflows|agents deploy`. Discover
|
|
595
|
+
6. For single-action calls, use `actions.run`; for linear multi-step, use `runs.start` / `defineWorkflow`. Deploy with `npx @lunnoa/client workflows|agents deploy`. Discover actions via `npx @lunnoa/client tools list|get|search` (or `workflowApps.list()`). Discover triggers via `apps get <appId> --json` and pass `defineTrigger` on `defineWorkflow` (omit it for Manually Run with no fields). `runs.start` does not save the trigger. Discover agent models via `npx @lunnoa/client ai-connections list --json` (or `aiConnections.list()`).
|
|
542
596
|
7. For Request Approval nodes, use `approvals.inbox` / `approvals.decide` (or `executions.submitApproval`).
|
|
543
597
|
8. Chat: stream via SSE, handle resume (reconnects) and stop, load history from the task.
|
|
544
598
|
9. Handle `LunnoaApiError`: 401 → re-auth; 403 → hide the capability; 429 → back off.
|
|
@@ -85,7 +85,7 @@ interrogation.
|
|
|
85
85
|
|---|---|---|
|
|
86
86
|
| One catalogue call | `actions.run` | One-step Execution (`source: SDK`) |
|
|
87
87
|
| Linear multi-step, experiment | `runs.start` / `defineWorkflow` then run | One Execution; optional later deploy |
|
|
88
|
-
| Reusable automation + triggers | Saved **Workflow** (
|
|
88
|
+
| Reusable automation + triggers | Saved **Workflow** (`defineWorkflow` + `defineTrigger`, or the UI) | Discover trigger ids with `apps get <appId> --json`. Omit `trigger` for Manually Run with no fields. `runs.start` ignores the trigger. |
|
|
89
89
|
| Reasoning + tools + conversation | **Agent** | Tools = workflows, actions, knowledge |
|
|
90
90
|
| Structured CRUD / portals | **Entities** + schemas | Codegen for typed accessors |
|
|
91
91
|
| Reference / lookup data | **Tables** | `tables.upsertBySlug`; workflows use the Tables Lookup action |
|
|
@@ -106,18 +106,31 @@ interrogation.
|
|
|
106
106
|
1. **Agents have no schedules or event triggers.** If something must run on a
|
|
107
107
|
cron or webhook, use a **Workflow** that messages the agent (or runs
|
|
108
108
|
actions). Do not invent an agent trigger.
|
|
109
|
-
2. **
|
|
109
|
+
2. **A tool-using agent gets 10 model rounds per turn** from an app or a
|
|
110
|
+
Message Agent step. That covers a handful of tool calls plus a final reply.
|
|
111
|
+
If the job chains many calls (read every record, then write), the brief must
|
|
112
|
+
say to turn on **Long-horizon mode** for that agent in Lunnoa (50 rounds).
|
|
113
|
+
Do not plan around `chatMode: 'builder'`; that is the editor interview and
|
|
114
|
+
stops after 4 rounds.
|
|
115
|
+
3. **Connections stay on Lunnoa.** Definitions only reference connection ids
|
|
110
116
|
(or omit for sole/default resolution). Never ask the partner to put OAuth
|
|
111
117
|
secrets in their app.
|
|
112
|
-
|
|
118
|
+
4. **Do not invent catalogue action, trigger, or model ids.** Discover actions with
|
|
113
119
|
`npx @lunnoa/client tools list|get|search --json` (or `workflowApps.list()`
|
|
114
|
-
/ codegen).
|
|
115
|
-
`
|
|
116
|
-
|
|
120
|
+
/ codegen). Discover triggers with `npx @lunnoa/client apps get <appId> --json`
|
|
121
|
+
and use `triggers[].triggerId` in `defineTrigger`. `input` is that trigger's
|
|
122
|
+
catalogue config. On Manually Run, `inputs` is the caller form
|
|
123
|
+
(`customInputConfig`). Discover models with
|
|
124
|
+
`npx @lunnoa/client ai-connections list --json` and use a returned
|
|
125
|
+
`models[].id` (Lunnoa LLMs uses catalogue ids such as
|
|
126
|
+
`deepseek-ai/DeepSeek-V4-Pro`). Client `defineAction` binds existing
|
|
127
|
+
catalogue actions; toolkit `createAction` is a different product
|
|
128
|
+
(in-platform apps).
|
|
129
|
+
5. **Durable vs ephemeral:** experiments → `runs.start`; shared production
|
|
117
130
|
automation → CLI `workflows deploy` / `agents deploy` by slug.
|
|
118
|
-
|
|
131
|
+
6. **UI is headless.** `@lunnoa/client` has no design system. Optional React
|
|
119
132
|
hooks in `@lunnoa/client/react`. Partners bring their own UI.
|
|
120
|
-
|
|
133
|
+
7. **Reuse before create.** Before proposing any new entity type, table,
|
|
121
134
|
workflow, or agent, run `npx @lunnoa/client entity-types list --json`,
|
|
122
135
|
`tables list --json`, `workflows list --json`, and `agents list --json`.
|
|
123
136
|
The build brief must state explicitly what is **reused** vs **created**.
|
|
@@ -125,11 +138,14 @@ interrogation.
|
|
|
125
138
|
### Common anti-patterns to reject
|
|
126
139
|
|
|
127
140
|
- Putting an agent on a schedule without a workflow wrapper
|
|
141
|
+
- Expecting an agent to loop tools indefinitely, or sending `chatMode: 'builder'` from an app (4 rounds, editor only)
|
|
128
142
|
- Building a fake multi-step “batch” as many unrelated `actions.run` calls
|
|
129
143
|
when the user wanted one Execution (use `runs.start` / workflow)
|
|
130
144
|
- Shipping `lna_` to the browser “just for the demo”
|
|
131
145
|
- Using `@lunnoa/toolkit` to build a customer portal
|
|
132
146
|
- Designing a local LangChain loop instead of Lunnoa-hosted agents
|
|
147
|
+
- Hardcoding `model: 'gpt-4o'` without reading `ai-connections list`
|
|
148
|
+
- Inventing a trigger id, or expecting `runs.start` to save a webhook or schedule
|
|
133
149
|
|
|
134
150
|
---
|
|
135
151
|
|
|
@@ -150,6 +166,8 @@ can execute. Use this shape:
|
|
|
150
166
|
|
|
151
167
|
### Discovery (run first)
|
|
152
168
|
- [ ] `npx @lunnoa/client tools list --json --for-agent` then `tools get <id>`
|
|
169
|
+
- [ ] `npx @lunnoa/client apps get <appId> --json` before `defineTrigger`
|
|
170
|
+
- [ ] `npx @lunnoa/client ai-connections list --json` before choosing an agent model
|
|
153
171
|
- [ ] agents / workflows / entity-types / tables list — reuse before create
|
|
154
172
|
- [ ] codegen — if building typed entity/workflow accessors
|
|
155
173
|
|