@lunnoa/client 2.3.0 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunnoa/client",
3
- "version": "2.3.0",
3
+ "version": "2.4.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: { method: 'GET', url: 'https://example.com/orders' },
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,30 @@ 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
+
420
458
  Discover the catalogue **before** writing `defineAction` (do not guess ids):
421
459
 
422
460
  ```bash
@@ -592,7 +630,7 @@ with emails (capped; not Azure object IDs).
592
630
  3. Call `discovery.enabledFeatures()` and hide unsupported areas.
593
631
  4. Build forms/tables from `attributeSchema` / `customInputConfig` (or the generated types).
594
632
  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()`).
633
+ 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). Discover agent models via `npx @lunnoa/client ai-connections list --json` (or `aiConnections.list()`).
596
634
  7. For Request Approval nodes, use `approvals.inbox` / `approvals.decide` (or `executions.submitApproval`).
597
635
  8. Chat: stream via SSE, handle resume (reconnects) and stop, load history from the task.
598
636
  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) | Builder in Lunnoa | Code deploys build straight lines only. 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 |