@lunnoa/client 2.2.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 +2 -2
- package/dist/cli.js +136 -1
- package/dist/index.cjs +72 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -2
- package/dist/index.d.ts +99 -2
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +46 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +93 -0
- package/dist/react.d.ts +93 -0
- package/dist/react.js +46 -0
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/skills/lunnoa-client/SKILL.md +42 -4
- package/skills/lunnoa-solution-design/SKILL.md +8 -3
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",
|
|
@@ -222,7 +222,8 @@ await lunnoa.tables.upsertBySlug({
|
|
|
222
222
|
- A workflow's manual-trigger input fields live on
|
|
223
223
|
`workflows.get(id, { expansion: ['triggerNode'] })` →
|
|
224
224
|
`triggerNode.value.customInputConfig` (each field: `id`, `label`,
|
|
225
|
-
`inputType`, `required`, `selectOptions`).
|
|
225
|
+
`inputType`, `required`, `selectOptions`). Declare them at deploy time
|
|
226
|
+
with `defineTrigger({ id: 'flow-control_trigger_manual', inputs })`.
|
|
226
227
|
- `workflowApps.list()` resolves `executionPath` step `appId`/`actionId`
|
|
227
228
|
pairs to human-readable names and icons.
|
|
228
229
|
|
|
@@ -351,11 +352,13 @@ Pure typed config (no network):
|
|
|
351
352
|
import {
|
|
352
353
|
defineAction,
|
|
353
354
|
defineAgent,
|
|
355
|
+
defineTrigger,
|
|
354
356
|
defineWorkflow,
|
|
355
357
|
} from '@lunnoa/client';
|
|
356
358
|
|
|
357
359
|
export const ping = defineWorkflow({
|
|
358
360
|
slug: 'ping',
|
|
361
|
+
// Omit trigger for Manually Run with no input fields.
|
|
359
362
|
steps: [
|
|
360
363
|
{
|
|
361
364
|
use: defineAction({
|
|
@@ -366,6 +369,24 @@ export const ping = defineWorkflow({
|
|
|
366
369
|
],
|
|
367
370
|
});
|
|
368
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
|
+
|
|
369
390
|
export const triage = defineAgent({
|
|
370
391
|
slug: 'support-triage',
|
|
371
392
|
// models[].id from `npx @lunnoa/client ai-connections list --json`
|
|
@@ -375,25 +396,42 @@ export const triage = defineAgent({
|
|
|
375
396
|
});
|
|
376
397
|
```
|
|
377
398
|
|
|
378
|
-
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.
|
|
379
401
|
|
|
380
402
|
```typescript
|
|
381
403
|
const result = await lunnoa.runs.start(ping);
|
|
382
404
|
// or lunnoa.runs.startAndWait(ping)
|
|
383
405
|
```
|
|
384
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
|
+
|
|
385
420
|
Discover the catalogue **before** writing `defineAction` (do not guess ids):
|
|
386
421
|
|
|
387
422
|
```bash
|
|
388
423
|
npx @lunnoa/client tools list --json --for-agent
|
|
389
424
|
npx @lunnoa/client tools search email --json --for-agent
|
|
390
425
|
npx @lunnoa/client tools get http_action_send-request --json
|
|
426
|
+
npx @lunnoa/client apps get flow-control --json
|
|
391
427
|
npx @lunnoa/client connections list --app gmail --json
|
|
392
428
|
npx @lunnoa/client ai-connections list --json
|
|
393
429
|
```
|
|
394
430
|
|
|
395
431
|
`tools get` returns `inputConfig` / `inputFields` and a `defineAction` sketch.
|
|
396
|
-
`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.
|
|
397
435
|
|
|
398
436
|
`ai-connections list` returns the AI connections this key can assign to an
|
|
399
437
|
agent. Set `defineAgent({ model })` to a `models[].id` from that JSON
|
|
@@ -554,7 +592,7 @@ with emails (capped; not Azure object IDs).
|
|
|
554
592
|
3. Call `discovery.enabledFeatures()` and hide unsupported areas.
|
|
555
593
|
4. Build forms/tables from `attributeSchema` / `customInputConfig` (or the generated types).
|
|
556
594
|
5. Render workflow progress from `executionPath`; handle `NEEDS_INPUT` with `submitInput`.
|
|
557
|
-
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()`).
|
|
558
596
|
7. For Request Approval nodes, use `approvals.inbox` / `approvals.decide` (or `executions.submitApproval`).
|
|
559
597
|
8. Chat: stream via SSE, handle resume (reconnects) and stop, load history from the task.
|
|
560
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 |
|
|
@@ -115,9 +115,12 @@ interrogation.
|
|
|
115
115
|
3. **Connections stay on Lunnoa.** Definitions only reference connection ids
|
|
116
116
|
(or omit for sole/default resolution). Never ask the partner to put OAuth
|
|
117
117
|
secrets in their app.
|
|
118
|
-
4. **Do not invent catalogue
|
|
118
|
+
4. **Do not invent catalogue action, trigger, or model ids.** Discover actions with
|
|
119
119
|
`npx @lunnoa/client tools list|get|search --json` (or `workflowApps.list()`
|
|
120
|
-
/ codegen). Discover
|
|
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
|
|
121
124
|
`npx @lunnoa/client ai-connections list --json` and use a returned
|
|
122
125
|
`models[].id` (Lunnoa LLMs uses catalogue ids such as
|
|
123
126
|
`deepseek-ai/DeepSeek-V4-Pro`). Client `defineAction` binds existing
|
|
@@ -142,6 +145,7 @@ interrogation.
|
|
|
142
145
|
- Using `@lunnoa/toolkit` to build a customer portal
|
|
143
146
|
- Designing a local LangChain loop instead of Lunnoa-hosted agents
|
|
144
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
|
|
145
149
|
|
|
146
150
|
---
|
|
147
151
|
|
|
@@ -162,6 +166,7 @@ can execute. Use this shape:
|
|
|
162
166
|
|
|
163
167
|
### Discovery (run first)
|
|
164
168
|
- [ ] `npx @lunnoa/client tools list --json --for-agent` then `tools get <id>`
|
|
169
|
+
- [ ] `npx @lunnoa/client apps get <appId> --json` before `defineTrigger`
|
|
165
170
|
- [ ] `npx @lunnoa/client ai-connections list --json` before choosing an agent model
|
|
166
171
|
- [ ] agents / workflows / entity-types / tables list — reuse before create
|
|
167
172
|
- [ ] codegen — if building typed entity/workflow accessors
|