n8n-nodes-lifespace 0.1.6 → 0.1.8

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.
Files changed (49) hide show
  1. package/README.md +56 -17
  2. package/dist/nodes/LifeSpace/LifeSpace.node.d.ts +8 -0
  3. package/dist/nodes/LifeSpace/LifeSpace.node.js +337 -37
  4. package/dist/nodes/LifeSpace/LifeSpace.node.js.map +1 -1
  5. package/dist/nodes/LifeSpaceAgentTool/LifeSpaceAgentTool.node.d.ts +6 -0
  6. package/dist/nodes/LifeSpaceAgentTool/LifeSpaceAgentTool.node.js +99 -0
  7. package/dist/nodes/LifeSpaceAgentTool/LifeSpaceAgentTool.node.js.map +1 -0
  8. package/dist/nodes/LifeSpaceAgentTool/lifespace.dark.svg +14 -0
  9. package/dist/nodes/LifeSpaceAgentTool/lifespace.svg +14 -0
  10. package/dist/nodes/LifeSpaceTool/LifeSpaceTool.node.d.ts +13 -0
  11. package/dist/nodes/LifeSpaceTool/LifeSpaceTool.node.js +373 -0
  12. package/dist/nodes/LifeSpaceTool/LifeSpaceTool.node.js.map +1 -0
  13. package/dist/nodes/LifeSpaceTool/lifespace.dark.svg +14 -0
  14. package/dist/nodes/LifeSpaceTool/lifespace.svg +14 -0
  15. package/dist/nodes/LifeSpaceWorkflow/LifeSpaceWorkflow.node.d.ts +6 -0
  16. package/dist/nodes/LifeSpaceWorkflow/LifeSpaceWorkflow.node.js +139 -0
  17. package/dist/nodes/LifeSpaceWorkflow/LifeSpaceWorkflow.node.js.map +1 -0
  18. package/dist/nodes/LifeSpaceWorkflow/humanProjection.d.ts +10 -0
  19. package/dist/nodes/LifeSpaceWorkflow/humanProjection.js +167 -0
  20. package/dist/nodes/LifeSpaceWorkflow/humanProjection.js.map +1 -0
  21. package/dist/nodes/LifeSpaceWorkflow/lifespace.dark.svg +14 -0
  22. package/dist/nodes/LifeSpaceWorkflow/lifespace.svg +14 -0
  23. package/dist/nodes/agent/LifeSpaceAgentToolBase.d.ts +1 -0
  24. package/dist/nodes/agent/LifeSpaceAgentToolBase.js +6 -0
  25. package/dist/nodes/agent/LifeSpaceAgentToolBase.js.map +1 -0
  26. package/dist/nodes/agent/lifeSpaceGenericQueryTool.d.ts +24 -0
  27. package/dist/nodes/agent/lifeSpaceGenericQueryTool.js +197 -0
  28. package/dist/nodes/agent/lifeSpaceGenericQueryTool.js.map +1 -0
  29. package/dist/nodes/agent/lifeSpaceToolFactory.d.ts +55 -0
  30. package/dist/nodes/agent/lifeSpaceToolFactory.js +591 -0
  31. package/dist/nodes/agent/lifeSpaceToolFactory.js.map +1 -0
  32. package/dist/nodes/agent/lifeSpaceToolTypes.d.ts +10 -0
  33. package/dist/nodes/agent/lifeSpaceToolTypes.js +3 -0
  34. package/dist/nodes/agent/lifeSpaceToolTypes.js.map +1 -0
  35. package/dist/nodes/lifespaceDiscovery.d.ts +77 -1
  36. package/dist/nodes/lifespaceDiscovery.js +36 -1
  37. package/dist/nodes/lifespaceDiscovery.js.map +1 -1
  38. package/dist/nodes/shared/lifeSpaceAdapterSemantics.d.ts +8 -0
  39. package/dist/nodes/shared/lifeSpaceAdapterSemantics.js +28 -0
  40. package/dist/nodes/shared/lifeSpaceAdapterSemantics.js.map +1 -0
  41. package/dist/nodes/shared/lifeSpaceLocalDateSemantics.d.ts +9 -0
  42. package/dist/nodes/shared/lifeSpaceLocalDateSemantics.js +23 -0
  43. package/dist/nodes/shared/lifeSpaceLocalDateSemantics.js.map +1 -0
  44. package/dist/nodes/shared/lifeSpaceQuerySemantics.d.ts +14 -0
  45. package/dist/nodes/shared/lifeSpaceQuerySemantics.js +120 -0
  46. package/dist/nodes/shared/lifeSpaceQuerySemantics.js.map +1 -0
  47. package/dist/package.json +6 -6
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/package.json +6 -6
package/README.md CHANGED
@@ -66,7 +66,12 @@ Runtime Discovery determines which Spaces, Record Types, fields, queries, Action
66
66
 
67
67
  ## Generated Record UX
68
68
 
69
- Create/Update keep scalar fields in n8n Resource Mapper while using native n8n controls for LifeSpace calendar-date fields and supported relations. Single relations use a selector; multi-relations use multi-select. List / Query offers typed filter variants for text, enum, boolean, number, date/time and authorized relations, while retaining the raw legacy filter as an expression/compatibility escape hatch.
69
+ The package deliberately exposes two different projections over the same LifeSpace Runtime Discovery semantics:
70
+
71
+ - **LifeSpace** is the human-authored workflow node. Create/Update fields are generated through n8n Resource Mapper from the selected Record Type, so field type, required state, enum values, calendar dates and supported single relations determine the control automatically. List / Query exposes semantic predicates such as `Status — Is One Of` or `Due Date — After or Equal` instead of asking the workflow author to choose a filter type first. Multi-value relations keep their dedicated multi-select UX.
72
+ - **LifeSpace Agent Tool** is the native AI Tool surface. Its schema is generated for the model: generic queries expose semantic `field` / `operator` / `value` inputs, and the adapter compiles those inputs to the exact transport names published by LifeSpace. Capability Queries consume the grouped schema published by Runtime Discovery.
73
+
74
+ The human workflow node is not exposed through `usableAsTool`; this avoids maintaining two competing Agent Tool surfaces with different schema behavior.
70
75
 
71
76
  The node displays the authorized human-readable `spaceName` when present while continuing to submit the stable `spc_*` ID.
72
77
 
@@ -76,7 +81,7 @@ Calendar-backed models use canonical `capabilityBindings.calendar` field roles i
76
81
 
77
82
  ## LifeSpace contract compatibility
78
83
 
79
- This package follows the current LifeSpace Core Kernel `0.32.0` contract family. It consumes Runtime/Discovery semantics only; Eventing configuration and webhook delivery semantics are owned independently by Integration/Eventing `0.1.0`.
84
+ This package follows the current LifeSpace Core Kernel `0.35.0` contract family. It consumes Runtime/Discovery semantics only; Eventing configuration and webhook delivery semantics are owned independently by Integration/Eventing `0.1.0`.
80
85
 
81
86
  The UX depends on these Kernel capabilities:
82
87
 
@@ -95,6 +100,9 @@ The UX depends on these Kernel capabilities:
95
100
  - `0.30.0`: explicit paginated Change History collection and Model Control Plane ownership split;
96
101
  - `0.31.0`: Integration/Eventing wire representation moves to the independent Integration/Eventing `0.1.0` contract while Core remains the Runtime authority.
97
102
  - `0.32.0`: `modelKey` becomes the sole Runtime address and canonical CRUD/Action paths move under `/models/{modelKey}/records`.
103
+ - `0.33.0`: canonical structural `timeRanges` become available in progressive semantic detail without implying an overlap query API.
104
+ - `0.34.0`: explicit `eq/lt/lte/gt/gte` comparison transports, first-class `createdAt` / `updatedAt` envelope comparisons and Core-owned datetime local-date-window conversion become discoverable.
105
+ - `0.35.0`: grouped `query.capabilityQueries` adds the preferred `calendar.window` viewing-window query with explicit IANA viewing timezone and deterministic mixed all-day/timed ordering.
98
106
 
99
107
  The adapter prefers the `0.27+` progressive flow while configuring a node:
100
108
 
@@ -127,16 +135,16 @@ Examples:
127
135
  {{$vars.lifeSpaceRecordType}}
128
136
  ```
129
137
 
130
- Discovery-backed selectors such as **Space**, **Filter Field**, **Sort Field** and **Action** support the normal n8n pattern: choose a value from the list, or switch the parameter to an expression and provide the corresponding stable ID/key. **Record Type** stores the plain LifeSpace `modelKey`, so a LifeSpace Trigger can feed a Record node directly without a mapping step or an extra Discovery request.
138
+ Discovery-backed selectors such as **Space**, **Sort Field** and **Action** support the normal n8n pattern: choose a value from the list, or switch the parameter to an expression and provide the corresponding stable ID/key. **Record Type** stores the plain LifeSpace `modelKey`, so a LifeSpace Trigger can feed a Record node directly without a mapping step or an extra Discovery request.
131
139
 
132
- The same applies to ordinary values such as Record ID, Search, Filter Value, Return All, Limit, Sort Direction, Cursor, explicit Version, API Method, API Path and JSON Body.
140
+ The same applies to ordinary values such as Record ID, Search, Return All, Limit, Sort Direction, Cursor, explicit Version, API Method, API Path and JSON Body.
133
141
 
134
142
  Two boundaries are intentional:
135
143
 
136
144
  - **Resource** and **Operation** are structural node controls and do not accept expressions because they determine which parameter schema and execution path the node has.
137
- - **Fields** and **Action Input** use n8n's `resourceMapper`. The mapper container is structural, but each generated field value inside it remains expression-capable. This includes relation-backed field values: the UI can offer authorized options while an expression can still supply a stable relation ID or ID list.
145
+ - **Fields**, **Filters**, Capability Query parameters and **Action Input** are generated from Runtime Discovery. Their mapper containers are structural, while generated values remain expression-capable.
138
146
 
139
- For **Filters** and **Sorts**, add the required rows in the node UI and use expressions inside each row's Field/Operator/Value or Field/Direction inputs. The number of rows is treated as workflow structure rather than per-item data. This avoids relying on whole-array expressions for n8n `fixedCollection` parameters.
147
+ In Standard Query, **Filters** is a Discovery-driven Resource Mapper. Adding a filter selects a published semantic predicate such as `Due Date — Before`; n8n then renders the value control from the underlying field type. **Sorts** remains an ordered structural list because sort priority is part of workflow structure rather than per-item data.
140
148
 
141
149
  If **Record Type** itself varies per input item and those Record Types have different schemas, one discovery-generated mapper cannot safely represent every possible schema at design time. In that case, branch to separate LifeSpace nodes per schema or use **API Request** for a deliberately fully dynamic request.
142
150
 
@@ -175,7 +183,7 @@ LifeSpace server defaults are authoritative. A field that is `required` but has
175
183
 
176
184
  For example, lifecycle state such as Task status can remain server/Action-owned instead of being manually entered by the workflow author.
177
185
 
178
- When Runtime Discovery advertises relation semantics, supported `person`, `person_list`, `record` and `record_list` fields are rendered from the current authorized `{ id, label }` target projection instead of asking the workflow author to type raw identifiers. The displayed value is the canonical LifeSpace reference label, while the workflow payload still stores and submits the stable target ID.
186
+ When Runtime Discovery advertises relation semantics, supported single-value `person` / `record` fields are rendered as selectors from the current authorized `{ id, label }` target projection. Multi-value relations retain the dedicated multi-select control rather than falling back to n8n Resource Mapper's generic JSON array editor. The displayed value is the canonical LifeSpace reference label, while the workflow payload still stores and submits the stable target ID.
179
187
 
180
188
  Older compatible Discovery responses without relation lookup metadata retain the raw-ID field behavior. The adapter never guesses record labels from conventional fields such as `name`, `title` or `summary`.
181
189
 
@@ -195,14 +203,18 @@ If a workflow intentionally needs to bind a known version, add **Concurrency Opt
195
203
 
196
204
  ### List / Query
197
205
 
198
- The normal UI supports:
206
+ **Query Type** separates ordinary record query UX from capability-owned query semantics:
207
+
208
+ - **Records** is the normal query surface and exposes optional **Search**, Discovery-driven semantic **Filters**, optional **Advanced Local Date Windows**, generic **Sorts**, **Return All** and **Limit**;
209
+ - each Filter entry represents an allowed field/operator pair published by LifeSpace, for example `Status — Is One Of`, `Due Date — Before` or `Created At — After or Equal`; the adapter compiles the selected semantic predicate to the exact transport parameter published by Discovery;
210
+ - **Capability Query** is offered only when the selected Record Type publishes `query.capabilityQueries`; its selector, parameters and ordering are loaded from Runtime Discovery;
211
+ - **Return All** follows `nextCursor` automatically, while **Limit** bounds a single-page query.
212
+
213
+ Advanced Local Date Windows are shown separately because a local calendar window is a structured field/start/end/timezone input rather than a scalar predicate. The adapter sends the published date-window parameter names and IANA timezone unchanged; Core owns timezone/DST conversion. Existing persisted legacy `exact/from/to` filters preserve the inclusive `To` behavior.
199
214
 
200
- - optional **Search**;
201
- - one or more typed **Filters**;
202
- - **Return All** to follow `nextCursor` automatically;
203
- - **Limit** when Return All is disabled.
215
+ Generic Search/Filters/Sorts are intentionally hidden in Capability Query mode until LifeSpace publishes machine-readable facet-composability metadata. This prevents the adapter from guessing which generic parameters may be mixed with a grouped capability query.
204
216
 
205
- Use **Sorts → Add Sort** to add zero or more sort criteria in priority order. Sortable model fields use authoritative `title` metadata from Runtime Discovery, while envelope fields such as `createdAt` / `updatedAt` are offered only when Discovery advertises them. Multiple criteria are sent as ordered repeated `sort=field:direction` query parameters.
217
+ Use **Sorts → Add Sort** in Records mode to add zero or more sort criteria in priority order. Sortable model fields use authoritative `title` metadata from Runtime Discovery, while envelope fields such as `createdAt` / `updatedAt` are offered only when Discovery advertises them. Multiple criteria are sent as ordered repeated `sort=field:direction` query parameters.
206
218
 
207
219
  Advanced **Options** contain manual **Cursor** as an escape hatch.
208
220
 
@@ -230,6 +242,30 @@ Paths are relative to the configured API Base URL, for example:
230
242
 
231
243
  Use normal Record operations when possible because they benefit from Runtime Discovery metadata and n8n-specific UX.
232
244
 
245
+ ## Use the LifeSpace Agent Tool
246
+
247
+ Use **LifeSpace Agent Tool** when connecting LifeSpace to an n8n AI Agent. This is a separate native AiTool surface rather than the human workflow node running through `usableAsTool`.
248
+
249
+ Configure the Tool's structural scope — Space, Record Type and operation — in the node. The Tool then derives its model-facing name, description and input schema from Runtime Discovery, so multiple LifeSpace Tools can distinguish their configured purpose without requiring handwritten descriptions.
250
+
251
+ For Generic Query, the model receives semantic inputs such as:
252
+
253
+ ```json
254
+ {
255
+ "search": "food",
256
+ "filters": [
257
+ { "field": "status", "operator": "in", "value": ["todo"] },
258
+ { "field": "dueDate", "operator": "gte", "value": "2026-09-13" }
259
+ ],
260
+ "sort": [{ "field": "dueDate", "direction": "asc" }],
261
+ "limit": 20
262
+ }
263
+ ```
264
+
265
+ The adapter validates those field/operator pairs against Discovery and compiles them to the exact LifeSpace query transport. The model does not need to know transport names such as `dueDate.gte`. Local date windows are likewise semantic inputs and Core remains responsible for timezone/DST conversion.
266
+
267
+ Create/Update schemas are generated from writable model fields. Optional fields that the model does not provide are omitted rather than synthesized as empty values. Actions and Capability Queries remain metadata-driven, and adding a future Record Type does not require a model-specific `create_*` or `query_*` node implementation.
268
+
233
269
  ## Use the LifeSpace Trigger
234
270
 
235
271
  The **LifeSpace Trigger** receives signed LifeSpace Domain Event webhooks.
@@ -265,11 +301,12 @@ Webhook Endpoint / Event Subscription creation is intentionally not performed by
265
301
 
266
302
  - **LifeSpace API** credential for API authentication and Runtime Discovery;
267
303
  - **LifeSpace Webhook Signing** credential for endpoint-scoped inbound HMAC verification;
268
- - **LifeSpace** node with discovery-driven Record operations plus advanced API Request;
304
+ - **LifeSpace** human workflow node with Discovery-driven Record operations plus advanced API Request;
305
+ - **LifeSpace Agent Tool** native AiTool with Discovery-driven semantic schemas;
269
306
  - **LifeSpace Trigger** with signed multi-Record-Type Domain Event filtering;
270
- - dynamic Space, Record Type, field, relation target, query, Action and Action Input UI based on progressive Runtime Discovery.
307
+ - shared thin adapter projection from LifeSpace Runtime Discovery into human n8n controls and model-facing Tool schemas.
271
308
 
272
- LifeSpace remains authoritative for validation, authorization, defaults, Mutation Authority, Action semantics, relation semantics and event contracts. Runtime Discovery and Relation Target Lookup are current capability/reference projections, not execution-authorization proofs.
309
+ LifeSpace remains authoritative for validation, authorization, defaults, Mutation Authority, Action semantics, query/time semantics, relation semantics and event contracts. Runtime Discovery and Relation Target Lookup are current capability/reference projections, not execution-authorization proofs.
273
310
 
274
311
  ## Architecture boundary
275
312
 
@@ -277,6 +314,8 @@ LifeSpace is the source of truth for Identity, Authority, Shared Reality semanti
277
314
 
278
315
  LifeSpace does not depend on n8n. n8n is one optional orchestration/integration runtime consuming LifeSpace APIs and events.
279
316
 
317
+ The human Workflow node and native Agent Tool are separate presentation projections over the same LifeSpace semantics. Shared code in this package only translates Discovery into n8n-specific UI/schema/transport; it does not redefine domain rules.
318
+
280
319
  The adapter does not use privileged model-admin endpoints for ordinary workflow discovery and does not copy Model Definitions into this repository.
281
320
 
282
321
  ## Development
@@ -319,4 +358,4 @@ The adapter now consumes generic `person`, `person_list`, `record` and `record_l
319
358
 
320
359
  ## License
321
360
 
322
- MIT
361
+ MIT
@@ -16,6 +16,13 @@ export declare class LifeSpace implements INodeType {
16
16
  getBooleanFilterableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
17
17
  getNumericFilterableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
18
18
  getTemporalFilterableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
19
+ getNumericComparisonFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
20
+ getTemporalComparisonFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
21
+ getComparisonOperatorsForCurrentField(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
22
+ getLocalDateWindowFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
23
+ getQueryModes(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
24
+ getCapabilityQueries(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
25
+ getSemanticSorts(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
19
26
  getPersonFilterableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
20
27
  getEnumValuesForCurrentFilter(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
21
28
  getSortableFields(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
@@ -23,6 +30,7 @@ export declare class LifeSpace implements INodeType {
23
30
  resourceMapping: {
24
31
  getRecordFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
25
32
  getActionInputFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
33
+ getSemanticQueryInputFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
26
34
  };
27
35
  };
28
36
  execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;