@lunnoa/client 1.3.0 → 1.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": "1.3.0",
3
+ "version": "1.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",
@@ -34,26 +34,23 @@
34
34
  "typecheck": "tsc --noEmit",
35
35
  "check:codegen-sample": "node --experimental-strip-types scripts/check-codegen-sample.ts && tsc --noEmit -p scripts/tsconfig.codegen-sample.json",
36
36
  "test:acceptance": "tsx scripts/acceptance-soak.ts",
37
+ "prepare": "node -e \"for (const d of ['.cursor/skills', '.claude/skills']) require('fs').cpSync('skills', d, { recursive: true, force: true })\"",
37
38
  "prepublishOnly": "pnpm run build",
38
39
  "release": "semantic-release"
39
40
  },
40
41
  "dependencies": {
42
+ "@ai-sdk/react": "^3.0.230",
41
43
  "ai": "^6.0.199"
42
44
  },
43
45
  "peerDependencies": {
44
- "@ai-sdk/react": "^3.0.0 || ^4.0.0",
45
46
  "react": "^18.0.0 || ^19.0.0"
46
47
  },
47
48
  "peerDependenciesMeta": {
48
49
  "react": {
49
50
  "optional": true
50
- },
51
- "@ai-sdk/react": {
52
- "optional": true
53
51
  }
54
52
  },
55
53
  "devDependencies": {
56
- "@ai-sdk/react": "^3.0.230",
57
54
  "@semantic-release/changelog": "^6.0.3",
58
55
  "@semantic-release/git": "^10.0.1",
59
56
  "@semantic-release/github": "^12.0.0",
@@ -57,9 +57,10 @@ Run these before inventing resources or shipping UI code:
57
57
  3. **Discover before inventing** — prefer the CLI (JSON for agents), then
58
58
  the SDK: `npx @lunnoa/client tools list --json --for-agent`,
59
59
  `tools get <actionId> --json`, `apps list`, `connections list`,
60
- `agents|workflows|entity-types|projects list`, `features`.
60
+ `agents|workflows|entity-types|tables|projects list`, `tables get <slugOrId>`,
61
+ `features`.
61
62
  SDK equivalents: `workflowApps.list()`, `agents.list`, `workflows.list`,
62
- `entityTypes.list`, `discovery.enabledFeatures()`.
63
+ `entityTypes.list`, `tables.list`, `discovery.enabledFeatures()`.
63
64
  Do not invent catalogue action ids.
64
65
  4. **Run vs deploy** — Ad-hoc: `actions.run` / `runs.start` /
65
66
  `workflows.execute`. Durable shared automation: CLI
@@ -141,12 +142,12 @@ const { user, status, login, logout, verify2faLogin } = useLunnoaAuth();
141
142
  const lunnoa = useLunnoaClient(); // same client for entities / actions / chat
142
143
  const { progress } = useExecutionProgress(executionId);
143
144
  const { waiting, pendingInput, submitInput } = useNeedsInput(progress);
144
- const { messages, send, stop, taskId } = useAgentChat(agentId); // peer: @ai-sdk/react
145
+ const { messages, send, stop, taskId } = useAgentChat(agentId);
145
146
  const { items, decide } = useApprovalsInbox({ pollIntervalMs: 15_000 });
146
147
  const { data, setPage } = useEntityList({ objectTypeSlug: 'invoice' });
147
148
  ```
148
149
 
149
- Peers: `react` ≥ 18 for `/react`; `@ai-sdk/react` only for `useAgentChat`.
150
+ Peer: `react` ≥ 18 for `/react`. `@ai-sdk/react` ships with the SDK (no extra install).
150
151
  Errors are `LunnoaApiError` with `.status`, `.body`, `.isUnauthorized`,
151
152
  `.isForbidden`, `.isRateLimited`. A 403 means the key's role or the
152
153
  deployment's licence edition does not cover the endpoint.
@@ -193,8 +194,20 @@ const workflows = await lunnoa.workflows.list({ expansion: ['description', 'isAc
193
194
  const entityTypes = await lunnoa.entityTypes.list({
194
195
  expansion: ['attributeSchema', 'stateSchema'],
195
196
  });
197
+
198
+ // Tables: small reference / lookup data (list omits rows; get includes them)
199
+ const tables = await lunnoa.tables.list();
200
+ const costCentres = await lunnoa.tables.getBySlug('cost_centres'); // or tables.get(id)
201
+ await lunnoa.tables.upsertBySlug({
202
+ slug: 'cost_centres',
203
+ columns: [{ key: 'code' }, { key: 'owner' }],
204
+ rows: [{ code: 'CC-100', owner: 'Finance' }],
205
+ }); // managedByCode defaults to true; omitted columns/rows are kept
196
206
  ```
197
207
 
208
+ - Use a **Table** for slowly changing reference data under ~10k rows; anything
209
+ that grows per transaction (invoice, ticket, case) is an **entity**.
210
+
198
211
  - `attributeSchema.sections[].fields[]` defines each entity field: `id`
199
212
  (attribute key), `label`, `type` (`text`, `number`, `currency`, `date`,
200
213
  `dropdown` with `config.options`, `boolean`, ...), `required`. Build forms
@@ -430,8 +443,7 @@ for await (const chunk of stream) {
430
443
  }
431
444
  ```
432
445
 
433
- - **React apps:** prefer `useAgentChat` from `@lunnoa/client/react` (optional
434
- peer `@ai-sdk/react`), which wraps AI SDK `useChat` + `DefaultChatTransport`
446
+ - **React apps:** prefer `useAgentChat` from `@lunnoa/client/react`, which wraps AI SDK `useChat` + `DefaultChatTransport`
435
447
  pointed at
436
448
  `${baseUrl}/api/agents/${agentId}/tasks/${taskId}/stream-message` with an
437
449
  `Authorization` header. You can also wire `useChat` yourself. Use
@@ -4,7 +4,7 @@ description: >-
4
4
  Acts as a Lunnoa business analyst / solution designer for vibecoders and
5
5
  partners. Interviews the human about triggers, actors, data, HITL, and
6
6
  integrations; maps intent to Lunnoa primitives (actions, workflows, agents,
7
- entities, approvals, queues); produces a short build brief; then hands off
7
+ entities, tables, approvals, queues); produces a short build brief; then hands off
8
8
  to the lunnoa-client skill for implementation. Use when requirements are
9
9
  unclear, the user asks what to build on Lunnoa, how to design a workflow or
10
10
  agent, whether to use an agent vs workflow, or before writing @lunnoa/client
@@ -50,6 +50,7 @@ interrogation.
50
50
  ### Data and knowledge
51
51
 
52
52
  - Structured business records (invoice, order, ticket) → **Entities**
53
+ - Small reference / lookup data (cost centres, price list) → **Tables**
53
54
  - Free-form conversation / reasoning → **Agent** chat
54
55
  - Documents / notebooks the model should search → **Knowledge**
55
56
  - Transient run output only → Executions / Tasks
@@ -86,9 +87,19 @@ interrogation.
86
87
  | Reusable automation + triggers | Saved **Workflow** (UI or CLI deploy) | Schedules/webhooks live on workflows |
87
88
  | Reasoning + tools + conversation | **Agent** | Tools = workflows, actions, knowledge |
88
89
  | Structured CRUD / portals | **Entities** + schemas | Codegen for typed accessors |
90
+ | Reference / lookup data | **Tables** | `tables.upsertBySlug`; workflows use the Tables Lookup action |
89
91
  | Human review inbox | **Approvals** | |
90
92
  | Assigned human work items | **Queues** | |
91
93
 
94
+ ### Objects (entities) vs Tables
95
+
96
+ - **Object (entity)** = a business record with identity and lifecycle
97
+ (invoice, ticket, case): states and state history, linked to
98
+ executions / agents / queues, has a business key, grows with transactions.
99
+ - **Table** = small, slowly changing reference data (cost-centre mapping,
100
+ price list, country codes), under ~10k rows (rows live in one JSON blob).
101
+ - Anything that grows per transaction is an **Object**, never a Table.
102
+
92
103
  ### Hard product rules (enforce these)
93
104
 
94
105
  1. **Agents have no schedules or event triggers.** If something must run on a
@@ -105,6 +116,10 @@ interrogation.
105
116
  automation → CLI `workflows deploy` / `agents deploy` by slug.
106
117
  5. **UI is headless.** `@lunnoa/client` has no design system. Optional React
107
118
  hooks in `@lunnoa/client/react`. Partners bring their own UI.
119
+ 6. **Reuse before create.** Before proposing any new entity type, table,
120
+ workflow, or agent, run `npx @lunnoa/client entity-types list --json`,
121
+ `tables list --json`, `workflows list --json`, and `agents list --json`.
122
+ The build brief must state explicitly what is **reused** vs **created**.
108
123
 
109
124
  ### Common anti-patterns to reject
110
125
 
@@ -134,15 +149,16 @@ can execute. Use this shape:
134
149
 
135
150
  ### Discovery (run first)
136
151
  - [ ] `npx @lunnoa/client tools list --json --for-agent` then `tools get <id>`
137
- - [ ] agents / workflows / entity-types / projects list — reuse before create
152
+ - [ ] agents / workflows / entity-types / tables / projects list — reuse before create
138
153
  - [ ] codegen — if building typed entity/workflow accessors
139
154
 
140
- ### Resources
141
- | Kind | Slug / id | Create or reuse | Notes |
155
+ ### Resources (every row says REUSED or CREATED)
156
+ | Kind | Slug / id | Reused / created | Notes |
142
157
  |---|---|---|---|
143
158
  | Workflow | … | … | steps / trigger |
144
159
  | Agent | … | … | model, tools |
145
160
  | Entity type | … | … | if portal CRUD |
161
+ | Table | … | … | reference / lookup data |
146
162
  | Knowledge | … | … | if RAG |
147
163
 
148
164
  ### Runtime paths