@lunnoa/client 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunnoa/client",
3
- "version": "2.4.0",
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",
@@ -455,6 +455,42 @@ Wire step settings in code with `ref`. Do not leave them for the builder.
455
455
  node id across deploys, so run history and builder mappings stay attached.
456
456
  The trigger keeps its id while its type and settings stay the same.
457
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
+
458
494
  Discover the catalogue **before** writing `defineAction` (do not guess ids):
459
495
 
460
496
  ```bash
@@ -630,7 +666,7 @@ with emails (capped; not Azure object IDs).
630
666
  3. Call `discovery.enabledFeatures()` and hide unsupported areas.
631
667
  4. Build forms/tables from `attributeSchema` / `customInputConfig` (or the generated types).
632
668
  5. Render workflow progress from `executionPath`; handle `NEEDS_INPUT` with `submitInput`.
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()`).
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()`).
634
670
  7. For Request Approval nodes, use `approvals.inbox` / `approvals.decide` (or `executions.submitApproval`).
635
671
  8. Chat: stream via SSE, handle resume (reconnects) and stop, load history from the task.
636
672
  9. Handle `LunnoaApiError`: 401 → re-auth; 403 → hide the capability; 429 → back off.
@@ -86,7 +86,7 @@ interrogation.
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
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
+ | 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. |
90
90
  | Reasoning + tools + conversation | **Agent** | Tools = workflows, actions, knowledge |
91
91
  | Structured CRUD / portals | **Entities** + schemas | Codegen for typed accessors |
92
92
  | Reference / lookup data | **Tables** | `tables.upsertBySlug`; workflows use the Tables Lookup action |