@lunnoa/client 2.3.0 → 2.5.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 +43 -1
- package/dist/index.cjs +171 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -6
- package/dist/index.d.ts +84 -6
- package/dist/index.js +170 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +43 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +71 -4
- package/dist/react.d.ts +71 -4
- package/dist/react.js +43 -1
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
- package/skills/lunnoa-client/SKILL.md +76 -2
- package/skills/lunnoa-solution-design/SKILL.md +8 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunnoa/client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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",
|
|
@@ -354,6 +354,7 @@ import {
|
|
|
354
354
|
defineAgent,
|
|
355
355
|
defineTrigger,
|
|
356
356
|
defineWorkflow,
|
|
357
|
+
ref,
|
|
357
358
|
} from '@lunnoa/client';
|
|
358
359
|
|
|
359
360
|
export const ping = defineWorkflow({
|
|
@@ -379,9 +380,22 @@ export const syncOrders = defineWorkflow({
|
|
|
379
380
|
}),
|
|
380
381
|
steps: [
|
|
381
382
|
{
|
|
383
|
+
key: 'order',
|
|
382
384
|
use: defineAction({
|
|
383
385
|
id: 'http_action_send-request',
|
|
384
|
-
input: {
|
|
386
|
+
input: {
|
|
387
|
+
method: 'GET',
|
|
388
|
+
url: `https://example.com/orders/${ref.trigger('invoiceId')}`,
|
|
389
|
+
},
|
|
390
|
+
}),
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
use: defineAction({
|
|
394
|
+
id: 'http_action_send-request',
|
|
395
|
+
input: {
|
|
396
|
+
method: 'GET',
|
|
397
|
+
url: `https://example.com/status/${ref.step('order', 'response', 'status')}`,
|
|
398
|
+
},
|
|
385
399
|
}),
|
|
386
400
|
},
|
|
387
401
|
],
|
|
@@ -417,6 +431,66 @@ One catalogue trigger per deployed workflow:
|
|
|
417
431
|
- **Any other trigger:** `id` from `apps get`, optional `connection`, and
|
|
418
432
|
`input` copied from that trigger's `inputConfig`. Do not invent ids.
|
|
419
433
|
|
|
434
|
+
### Passing data between steps
|
|
435
|
+
|
|
436
|
+
Wire step settings in code with `ref`. Do not leave them for the builder.
|
|
437
|
+
|
|
438
|
+
- `ref.trigger('caseId')`: a trigger output field. On Manually Run that is
|
|
439
|
+
one of the `inputs` ids. On a webhook it is the request shape
|
|
440
|
+
(`ref.trigger('body', 'caseId')`).
|
|
441
|
+
- `ref.step('load', 'rows', 0, 'status')`: an earlier step's output. Give
|
|
442
|
+
that step a `key: 'load'`. Array indexes are numbers.
|
|
443
|
+
- A `ref` is a plain string. Use it as a whole value, inside a template
|
|
444
|
+
string, or inside nested settings (`args: { case_id: ref.trigger('caseId') }`).
|
|
445
|
+
- On deploy the server swaps each `ref` for the real node id. The builder
|
|
446
|
+
shows it as a mapped field from that earlier node (top-level text fields
|
|
447
|
+
and lists; nested settings show the reference text). `runs.start` resolves
|
|
448
|
+
`ref.step` too, but it has no trigger, so `ref.trigger` fails there.
|
|
449
|
+
- `defineWorkflow` throws, and deploy returns 400, for an unknown key, a
|
|
450
|
+
reference to the same or a later step, a duplicate key, or a Manually Run
|
|
451
|
+
field missing from `inputs`.
|
|
452
|
+
- To find a step's output path, run it once (`actions.run` or
|
|
453
|
+
`runs.startAndWait`) and read that step's output in the execution.
|
|
454
|
+
- Give every step another step reads from a `key`. Keyed steps keep their
|
|
455
|
+
node id across deploys, so run history and builder mappings stay attached.
|
|
456
|
+
The trigger keeps its id while its type and settings stay the same.
|
|
457
|
+
|
|
458
|
+
### Branches (paths)
|
|
459
|
+
|
|
460
|
+
Put `paths` on the **last** step of a list. Steps after the branch go inside
|
|
461
|
+
each path. Paths do not merge back together.
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
const approval = defineAction({ id: 'flow-control_action_request-approval', input: { /* from tools get */ } });
|
|
465
|
+
const split = defineAction({ id: 'flow-control_action_conditional-paths' });
|
|
466
|
+
|
|
467
|
+
steps: [
|
|
468
|
+
{ key: 'review', use: approval, paths: [
|
|
469
|
+
{ label: 'Approved', steps: [{ key: 'apply', use: applyChange }] },
|
|
470
|
+
{ label: 'Rejected', steps: [{ use: notify, input: { text: ref.step('review', 'comment') } }] },
|
|
471
|
+
] },
|
|
472
|
+
]
|
|
473
|
+
|
|
474
|
+
// Conditional Paths: groups in `when` are OR-ed, conditions in a group AND-ed.
|
|
475
|
+
{ key: 'route', use: split, paths: [
|
|
476
|
+
{ label: 'Large', when: [[{ field: ref.step('load', 'amount'), condition: 'is_greater_than', value: '1000' }]], steps: [...] },
|
|
477
|
+
{ label: 'Other', steps: [...] }, // no `when`: always taken
|
|
478
|
+
] }
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
- `paths` works on Request Approval (at most two: approved first, then
|
|
482
|
+
rejected; labels `Approved` / `Rejected`), Conditional Paths (with `when`),
|
|
483
|
+
and Manually Decide Path (no `when`).
|
|
484
|
+
- `when` conditions: `field` is exactly one `ref.trigger` / `ref.step`.
|
|
485
|
+
`condition` is one of `PATH_CONDITIONS` (equals, contains, is_empty,
|
|
486
|
+
is_true, is_greater_than, is_less_than, matches_regex, is_in_the_past, ...).
|
|
487
|
+
`value` is text; omit it for exists / is_empty / is_true style conditions.
|
|
488
|
+
- Conditional Paths takes every path whose `when` matches. A path without
|
|
489
|
+
`when` always runs. For if/else, give the else path the opposite condition.
|
|
490
|
+
- Steps on a path can `ref.step` the branching step and earlier steps on
|
|
491
|
+
the same path, not steps on another path.
|
|
492
|
+
- `runs.start` rejects `paths`. Deploy, then execute the workflow.
|
|
493
|
+
|
|
420
494
|
Discover the catalogue **before** writing `defineAction` (do not guess ids):
|
|
421
495
|
|
|
422
496
|
```bash
|
|
@@ -592,7 +666,7 @@ with emails (capped; not Azure object IDs).
|
|
|
592
666
|
3. Call `discovery.enabledFeatures()` and hide unsupported areas.
|
|
593
667
|
4. Build forms/tables from `attributeSchema` / `customInputConfig` (or the generated types).
|
|
594
668
|
5. Render workflow progress from `executionPath`; handle `NEEDS_INPUT` with `submitInput`.
|
|
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()`).
|
|
669
|
+
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. Pass trigger inputs and earlier step outputs into step settings with `ref.trigger` / `ref.step` (key the source step). Branch with `paths` on Request Approval or Conditional Paths (last step only). Discover agent models via `npx @lunnoa/client ai-connections list --json` (or `aiConnections.list()`).
|
|
596
670
|
7. For Request Approval nodes, use `approvals.inbox` / `approvals.decide` (or `executions.submitApproval`).
|
|
597
671
|
8. Chat: stream via SSE, handle resume (reconnects) and stop, load history from the task.
|
|
598
672
|
9. Handle `LunnoaApiError`: 401 → re-auth; 403 → hide the capability; 429 → back off.
|
|
@@ -85,7 +85,8 @@ 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** (`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. |
|
|
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. Wire step settings to trigger fields and earlier steps with `ref.trigger` / `ref.step`. |
|
|
89
|
+
| Branches (approve / reject, if/else) | `defineWorkflow` with `paths` on Request Approval or Conditional Paths | Paths do not merge back. For steps shared after a branch, repeat them in each path or use the builder. A later code deploy replaces builder edits. |
|
|
89
90
|
| Reasoning + tools + conversation | **Agent** | Tools = workflows, actions, knowledge |
|
|
90
91
|
| Structured CRUD / portals | **Entities** + schemas | Codegen for typed accessors |
|
|
91
92
|
| Reference / lookup data | **Tables** | `tables.upsertBySlug`; workflows use the Tables Lookup action |
|
|
@@ -126,6 +127,10 @@ interrogation.
|
|
|
126
127
|
`deepseek-ai/DeepSeek-V4-Pro`). Client `defineAction` binds existing
|
|
127
128
|
catalogue actions; toolkit `createAction` is a different product
|
|
128
129
|
(in-platform apps).
|
|
130
|
+
4b. **Every step input has a source.** In the brief, list each step's settings
|
|
131
|
+
as a fixed value, "from trigger `caseId`", or "from step `load` →
|
|
132
|
+
`rows.0.status`". The build uses `ref.trigger` / `ref.step` for these, so
|
|
133
|
+
"connect it in the builder" is not a fallback for data wiring.
|
|
129
134
|
5. **Durable vs ephemeral:** experiments → `runs.start`; shared production
|
|
130
135
|
automation → CLI `workflows deploy` / `agents deploy` by slug.
|
|
131
136
|
6. **UI is headless.** `@lunnoa/client` has no design system. Optional React
|
|
@@ -146,6 +151,7 @@ interrogation.
|
|
|
146
151
|
- Designing a local LangChain loop instead of Lunnoa-hosted agents
|
|
147
152
|
- Hardcoding `model: 'gpt-4o'` without reading `ai-connections list`
|
|
148
153
|
- Inventing a trigger id, or expecting `runs.start` to save a webhook or schedule
|
|
154
|
+
- Leaving step inputs as "map it in the builder" when `ref.trigger` / `ref.step` covers it
|
|
149
155
|
|
|
150
156
|
---
|
|
151
157
|
|
|
@@ -174,7 +180,7 @@ can execute. Use this shape:
|
|
|
174
180
|
### Resources (every row says REUSED or CREATED)
|
|
175
181
|
| Kind | Slug / id | Reused / created | Notes |
|
|
176
182
|
|---|---|---|---|
|
|
177
|
-
| Workflow | … | … | steps / trigger |
|
|
183
|
+
| Workflow | … | … | steps (with keys) / trigger / each input's source |
|
|
178
184
|
| Agent | … | … | model, tools |
|
|
179
185
|
| Entity type | … | … | if portal CRUD |
|
|
180
186
|
| Table | … | … | reference / lookup data |
|