@zeyos/client 0.1.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.
Files changed (110) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +458 -0
  4. package/agents/README.md +66 -0
  5. package/agents/shared/business-app-benchmarks.md +111 -0
  6. package/agents/shared/zeyos-entity-map.md +142 -0
  7. package/agents/shared/zeyos-entity-reference.md +570 -0
  8. package/agents/shared/zeyos-query-patterns.md +89 -0
  9. package/agents/zeyos-account-intelligence/SKILL.md +34 -0
  10. package/agents/zeyos-account-intelligence/agents/openai.yaml +4 -0
  11. package/agents/zeyos-account-intelligence/references/workflows.md +84 -0
  12. package/agents/zeyos-billing-insights/SKILL.md +41 -0
  13. package/agents/zeyos-billing-insights/agents/openai.yaml +4 -0
  14. package/agents/zeyos-billing-insights/references/workflows.md +106 -0
  15. package/agents/zeyos-campaign-and-outreach/SKILL.md +44 -0
  16. package/agents/zeyos-campaign-and-outreach/agents/openai.yaml +4 -0
  17. package/agents/zeyos-campaign-and-outreach/references/workflows.md +100 -0
  18. package/agents/zeyos-collaboration-and-activity/SKILL.md +37 -0
  19. package/agents/zeyos-collaboration-and-activity/agents/openai.yaml +4 -0
  20. package/agents/zeyos-collaboration-and-activity/references/workflows.md +104 -0
  21. package/agents/zeyos-collections-and-dunning/SKILL.md +46 -0
  22. package/agents/zeyos-collections-and-dunning/agents/openai.yaml +4 -0
  23. package/agents/zeyos-collections-and-dunning/references/workflows.md +132 -0
  24. package/agents/zeyos-commerce-and-inventory/SKILL.md +38 -0
  25. package/agents/zeyos-commerce-and-inventory/agents/openai.yaml +4 -0
  26. package/agents/zeyos-commerce-and-inventory/references/workflows.md +101 -0
  27. package/agents/zeyos-mail-operations/SKILL.md +35 -0
  28. package/agents/zeyos-mail-operations/agents/openai.yaml +4 -0
  29. package/agents/zeyos-mail-operations/references/workflows.md +110 -0
  30. package/agents/zeyos-notes-and-sops/SKILL.md +31 -0
  31. package/agents/zeyos-notes-and-sops/agents/openai.yaml +4 -0
  32. package/agents/zeyos-notes-and-sops/references/workflows.md +85 -0
  33. package/agents/zeyos-platform-and-schema/SKILL.md +37 -0
  34. package/agents/zeyos-platform-and-schema/agents/openai.yaml +4 -0
  35. package/agents/zeyos-platform-and-schema/references/workflows.md +97 -0
  36. package/agents/zeyos-work-management/SKILL.md +45 -0
  37. package/agents/zeyos-work-management/agents/openai.yaml +4 -0
  38. package/agents/zeyos-work-management/references/workflows.md +148 -0
  39. package/docs/01-api-reference/01-data-retrieval.md +601 -0
  40. package/docs/01-api-reference/02-authentication.md +288 -0
  41. package/docs/01-api-reference/03-resources.md +270 -0
  42. package/docs/01-api-reference/04-schema.md +539 -0
  43. package/docs/01-api-reference/_category_.json +9 -0
  44. package/docs/02-javascript-client/01-getting-started.md +146 -0
  45. package/docs/02-javascript-client/02-authentication.md +287 -0
  46. package/docs/02-javascript-client/03-making-requests.md +572 -0
  47. package/docs/02-javascript-client/04-practical-guide.md +348 -0
  48. package/docs/02-javascript-client/_category_.json +9 -0
  49. package/docs/03-cli/01-getting-started.md +219 -0
  50. package/docs/03-cli/02-commands.md +407 -0
  51. package/docs/03-cli/03-configuration.md +220 -0
  52. package/docs/03-cli/_category_.json +9 -0
  53. package/docs/04-agent-workflows/00-coding-agents.md +35 -0
  54. package/docs/04-agent-workflows/01-agent-quickstart.md +147 -0
  55. package/docs/04-agent-workflows/02-agent-recipes.md +109 -0
  56. package/docs/04-agent-workflows/03-cli-coverage-and-escalation.md +65 -0
  57. package/docs/04-agent-workflows/_category_.json +9 -0
  58. package/docs/04-sample-apps/01-kanban.md +89 -0
  59. package/docs/04-sample-apps/02-crm.md +81 -0
  60. package/docs/04-sample-apps/03-dashboard.md +80 -0
  61. package/docs/04-sample-apps/_category_.json +9 -0
  62. package/docs/05-tutorials/00-application-developers.md +43 -0
  63. package/docs/05-tutorials/01-integration-architecture.md +60 -0
  64. package/docs/05-tutorials/02-build-your-own-zeyos-frontend.md +517 -0
  65. package/docs/05-tutorials/03-server-side-integrations.md +185 -0
  66. package/docs/05-tutorials/_category_.json +9 -0
  67. package/docs/intro.md +197 -0
  68. package/openapi/api.json +24308 -0
  69. package/openapi/auth.json +415 -0
  70. package/openapi/dbref.json +56223 -0
  71. package/openapi/oauth2.json +781 -0
  72. package/openapi/sdk.json +949 -0
  73. package/openapi/views.txt +642 -0
  74. package/package.json +49 -0
  75. package/samples/crm/README.md +28 -0
  76. package/samples/crm/index.html +327 -0
  77. package/samples/crm/js/api.js +208 -0
  78. package/samples/crm/js/auth.js +61 -0
  79. package/samples/crm/js/main.js +545 -0
  80. package/samples/crm/js/state.js +90 -0
  81. package/samples/crm/js/ui.js +51 -0
  82. package/samples/dashboard/README.md +28 -0
  83. package/samples/dashboard/index.html +280 -0
  84. package/samples/dashboard/js/api.js +197 -0
  85. package/samples/dashboard/js/auth.js +59 -0
  86. package/samples/dashboard/js/main.js +382 -0
  87. package/samples/dashboard/js/state.js +81 -0
  88. package/samples/dashboard/js/ui.js +48 -0
  89. package/samples/kanban/README.md +28 -0
  90. package/samples/kanban/index.html +263 -0
  91. package/samples/kanban/js/api.js +152 -0
  92. package/samples/kanban/js/auth.js +59 -0
  93. package/samples/kanban/js/constants.js +40 -0
  94. package/samples/kanban/js/kanban.js +246 -0
  95. package/samples/kanban/js/main.js +362 -0
  96. package/samples/kanban/js/modals.js +474 -0
  97. package/samples/kanban/js/settings.js +82 -0
  98. package/samples/kanban/js/state.js +118 -0
  99. package/samples/kanban/js/ui.js +49 -0
  100. package/scripts/generate-client.mjs +344 -0
  101. package/src/generated/operations.js +9772 -0
  102. package/src/generated/schema.js +8982 -0
  103. package/src/index.js +85 -0
  104. package/src/runtime/client.js +1208 -0
  105. package/src/runtime/error.js +29 -0
  106. package/src/runtime/http.js +174 -0
  107. package/src/runtime/request-shape.js +35 -0
  108. package/src/runtime/schema.js +206 -0
  109. package/src/runtime/suggest.js +74 -0
  110. package/src/runtime/token-store.js +105 -0
@@ -0,0 +1,570 @@
1
+ # ZeyOS Entity Reference For Agents
2
+
3
+ This file is optimized for coding agents. It is derived from:
4
+
5
+ - [../../openapi/dbref.json](../../openapi/dbref.json)
6
+ - [../../openapi/api.json](../../openapi/api.json)
7
+
8
+ Current source snapshot:
9
+
10
+ - `dbref.json`: 357 entities total
11
+ - `dbref.json`: 312 tables and 45 views
12
+ - `api.json`: 64 listable API resources under the public REST surface
13
+ - `api.json`: `config` and `settings` are API endpoints, but not `dbref.json` entities
14
+
15
+ Use this file when you need to understand what an entity is for before building a query plan.
16
+
17
+ ## Source Note: `filter` vs `filters`
18
+
19
+ Do not treat the spelling as universally settled.
20
+
21
+ - `openapi/api.json` documents the list request body field as `filter`.
22
+ - The repo CLI accepts `--filter` but serializes the JSON into `body.filters`.
23
+ - The repo client examples consistently use `filters`.
24
+
25
+ Agent rule:
26
+
27
+ - For `@zeyos/client`, follow repo convention and use `filters`.
28
+ - For CLI, use the documented `--filter` flag.
29
+ - For raw REST/OpenAPI examples, mention that the spec documents `filter` and verify behavior against the target instance before hardcoding one spelling as universally correct.
30
+
31
+ ## Entity Noun to REST operationId
32
+
33
+ The DB-table noun (from `dbref.json`, also the REST URL path segment) is **not** the
34
+ operationId. The `@zeyos/client` methods and the names you reason about are CamelCase
35
+ compound operationIds, and several diverge from a naive "capitalize + pluralize the noun".
36
+
37
+ **Agent rule: when calling `@zeyos/client` (`client.api.<operationId>(...)`) or constructing
38
+ CLI resource names, use the operationIds below, not the raw `dbref.json` table noun.** Building
39
+ `client.api.listDunning(...)` or `zeyos list dunning` from the noun will fail with
40
+ "operation not found".
41
+
42
+ ### The regular rule (most entities)
43
+
44
+ For most entities the operationIds follow this pattern, where `<Plural>` is the CamelCase plural
45
+ and `<Singular>` is the CamelCase singular:
46
+
47
+ - `list<Plural>`, `get<Singular>`, `create<Singular>`, `update<Singular>`, `delete<Singular>`, `exists<Singular>`
48
+
49
+ Example (`accounts`): `listAccounts`, `getAccount`, `createAccount`, `updateAccount`, `deleteAccount`, `existsAccount`.
50
+
51
+ Entities that follow the regular rule directly (lowercase noun, single English word): `accounts`,
52
+ `addresses`, `applications`*, `appointments`, `associations`, `campaigns`, `channels`, `comments`,
53
+ `components`, `contacts`, `contracts`, `coupons`, `devices`, `documents`, `events`, `files`,
54
+ `follows`, `forks`*, `groups`*, `invitations`, `items`, `ledgers`, `likes`, `links`, `messages`,
55
+ `notes`, `objects`, `opportunities`, `participants`, `payments`, `permissions`*, `prices`,
56
+ `projects`, `records`, `resources`*, `services`*, `storages`, `suppliers`, `tasks`, `tickets`,
57
+ `transactions`, `users`*, `weblets`*.
58
+
59
+ `*` = read-only entity: only `list*`, `get*`, and `exists*` exist (no create/update/delete).
60
+
61
+ ### Exceptions (verify these — the noun does NOT map naively)
62
+
63
+ Every operationId below was verified to exist in `src/generated/operations.js`. Junction tables
64
+ (`X2Y`) become `XToY` (CamelCase, with the **left** side often re-pluralized). Some entities are
65
+ renamed entirely (`dunning` -> `DunningNotice`), and several are compound words that must keep their
66
+ internal capitalization (e.g. `MailingLists`, not `Mailinglists`).
67
+
68
+ | dbref noun | list | get | create | update | delete | exists | Notes |
69
+ |------------|------|-----|--------|--------|--------|--------|-------|
70
+ | `actionsteps` | `listActionSteps` | `getActionStep` | `createActionStep` | `updateActionStep` | `deleteActionStep` | `existsActionStep` | Compound `ActionStep` |
71
+ | `applicationassets` | `listApplicationAssets` | `getApplicationAsset` | — | — | — | `existsApplicationAsset` | Read-only; compound |
72
+ | `binfiles` | `listBinFiles` | — | — | — | — | — | **List-only.** `BinFiles` |
73
+ | `categories` | `listCategorys` | `getCategory` | `createCategory` | `updateCategory` | `deleteCategory` | `existsCategory` | List op is `listCategorys` (sic — no irregular plural); singular ops use `Category` |
74
+ | `contacts2contacts` | `listContactsToContacts` | `getContactToContact` | `createContactToContact` | `updateContactToContact` | `deleteContactToContact` | `existsContactToContact` | Junction `X2Y` -> `XToY` |
75
+ | `couponcodes` | `listCouponCodes` | `getCouponCode` | `createCouponCode` | `updateCouponCode` | `deleteCouponCode` | `existsCouponCode` | Compound `CouponCode` |
76
+ | `customfields` | `listCustomFields` | `getCustomField` | — | — | — | `existsCustomField` | Read-only; compound |
77
+ | `davservers` | `listDAVServers` | `getDAVServer` | `createDAVServer` | `updateDAVServer` | `deleteDAVServer` | `existsDAVServer` | Acronym uppercased: `DAVServer` |
78
+ | `dunning` | `listDunningNotices` | `getDunningNotice` | `createDunningNotice` | `updateDunningNotice` | `deleteDunningNotice` | `existsDunningNotice` | Entity is **`DunningNotice`**, not `Dunning` |
79
+ | `dunning2transactions` | `listDunningToTransactions` | `getDunningToTransaction` | `createDunningToTransaction` | `updateDunningToTransaction` | `deleteDunningToTransaction` | `existsDunningToTransaction` | Junction `dunning2transactions` -> `DunningToTransaction(s)` |
80
+ | `entities2channels` | `listEntitiesToChannels` | `getEntityToChannel` | `createEntityToChannel` | `updateEntityToChannel` | `deleteEntityToChannel` | `existsEntityToChannel` | Junction; singular re-singularized to `EntityToChannel` |
81
+ | `feedservers` | `listFeedServers` | `getFeedServer` | `createFeedServer` | `updateFeedServer` | `deleteFeedServer` | `existsFeedServer` | Compound `FeedServer` |
82
+ | `groups2users` | `listGroupsToUsers` | `getGroupToUser` | — | — | — | `existsGroupToUser` | Read-only junction `X2Y` -> `XToY` |
83
+ | `mailinglists` | `listMailingLists` | `getMailingList` | `createMailingList` | `updateMailingList` | `deleteMailingList` | `existsMailingList` | Compound `MailingList` |
84
+ | `mailingrecipients` | `listMailingRecipients` | `getMailingRecipient` | `createMailingRecipient` | `updateMailingRecipient` | `deleteMailingRecipient` | `existsMailingRecipients` | Compound; **exists op is plural** `existsMailingRecipients` (sic) |
85
+ | `mailservers` | `listMailServers` | `getMailServer` | `createMailServer` | `updateMailServer` | `deleteMailServer` | `existsMailServer` | Compound `MailServer` |
86
+ | `messagereads` | `listMessageReads` | `getMessageRead` | `createMessageRead` | `updateMessageRead` | `deleteMessageRead` | `existsMessageRead` | Compound `MessageRead` |
87
+ | `pricelists` | `listPriceLists` | `getPriceList` | `createPriceList` | `updatePriceList` | `deletePriceList` | `existsPriceList` | Compound `PriceList` |
88
+ | `pricelists2accounts` | `listPriceListsToAccounts` | `getPriceListToAccount` | `createPriceListToAccount` | `updatePriceListToAccount` | `deletePriceListToAccount` | `existsPriceListToAccount` | Junction; compound on both sides |
89
+ | `relateditems` | `listRelatedItems` | `getRelatedItem` | `createRelatedItem` | `updateRelatedItem` | `deleteRelatedItem` | `existsRelatedItem` | Compound `RelatedItem` |
90
+ | `stocktransactions` | `listStockTransactions` | `getStockTransaction` | `createStockTransaction` | `updateStockTransaction` | `deleteStockTransaction` | `existsStockTransaction` | Compound `StockTransaction` |
91
+
92
+ When in doubt, look up the operationId in `src/generated/operations.js` (or `openapi/api.json`) rather
93
+ than constructing it from the noun.
94
+
95
+ ## API-Backed Entities
96
+
97
+ These are the 64 entities that have direct list endpoints in `api.json`.
98
+
99
+ ### CRM, Customer, and Relationship Entities
100
+
101
+ | Entity | Purpose | Agent relevance |
102
+ |------|---------|-----------------|
103
+ | `accounts` | Customer, supplier, prospect, or employee master records | Resolve customers, suppliers, and account-level ownership |
104
+ | `contacts` | People linked to accounts | Resolve human contacts and email addresses |
105
+ | `addresses` | Additional address records linked to accounts or contacts | Find customer delivery or contact location details |
106
+ | `contacts2contacts` | Contact-to-contact relationships | Trace person-to-person links |
107
+ | `opportunities` | Sales pipeline and deal records | Revenue forecasting and pre-sales analysis |
108
+ | `campaigns` | Marketing or outreach campaigns | Attribution and participant targeting |
109
+ | `contracts` | Long-lived commercial agreements | Billing-cycle and subscription-style reasoning |
110
+ | `participants` | Contacts enrolled in campaigns or mailing lists | Audience and outreach analysis |
111
+ | `mailinglists` | Mailing list definitions | Bulk communication grouping |
112
+
113
+ ### Work, Delivery, and Calendar Entities
114
+
115
+ | Entity | Purpose | Agent relevance |
116
+ |------|---------|-----------------|
117
+ | `tickets` | Support or service work items | Backlog, SLA, customer issue tracking |
118
+ | `tasks` | Actionable delivery work | Assignee workload and execution detail |
119
+ | `actionsteps` | Cross-record follow-up work items with assignee, due date, status, and effort | Track operational next steps below or alongside tasks and tickets |
120
+ | `projects` | Top-level initiatives | Initiative state and work grouping |
121
+ | `appointments` | Calendar appointments | Meeting and schedule queries |
122
+ | `invitations` | Appointment invitations | Attendance and invite state |
123
+ | `events` | Generic event records attached to entities | Timeline or activity display |
124
+
125
+ ### Messaging, Knowledge, and Collaboration Entities
126
+
127
+ | Entity | Purpose | Agent relevance |
128
+ |------|---------|-----------------|
129
+ | `messages` | Email and message records | Inbox summaries, draft preparation, thread reconstruction |
130
+ | `mailingrecipients` | Recipient records for a message | Audit mail recipients beyond the primary `to` field |
131
+ | `messagereads` | Read-tracking records for messages | Detect whether users opened a message |
132
+ | `notes` | Text-centric internal knowledge items | SOP summaries and operational notes |
133
+ | `documents` | Formal file-like business documents | Final SOPs, policies, controlled artifacts |
134
+ | `files` | Attachments linked to a record or comment | Attachment lookup and file inventory |
135
+ | `comments` | Record-linked comments | Discussion and audit context |
136
+ | `channels` | Collaboration or distribution channels | Group records into shared streams; practical business meaning should be confirmed |
137
+ | `entities2channels` | Junction between records and channels | Determine which records belong to which channels |
138
+ | `follows` | Follow/watch subscriptions on entities | Track who follows a record |
139
+ | `likes` | Lightweight positive reactions on records | Lightweight engagement signal |
140
+ | `records` | Generic feed and discussion records with entity/index references | Activity, posting, and collaboration wrapper for comments, likes, files, and channels |
141
+
142
+ ### Billing, Payments, and Collections Entities
143
+
144
+ | Entity | Purpose | Agent relevance |
145
+ |------|---------|-----------------|
146
+ | `transactions` | Billing, procurement, or production business transactions | Invoice totals, revenue-like metrics, line-item analysis |
147
+ | `payments` | Cash movement records | Cash received, settlement, payment history |
148
+ | `ledgers` | Payment ledger definitions | Ledger-scoped payment analysis |
149
+ | `dunning` | Collection or dunning notices | Overdue collection workflows |
150
+ | `dunning2transactions` | Dunning-to-transaction junction | Trace which invoices are part of a dunning process |
151
+
152
+ ### Inventory, Pricing, and Commerce Entities
153
+
154
+ | Entity | Purpose | Agent relevance |
155
+ |------|---------|-----------------|
156
+ | `items` | Product and service catalog entries | Price, SKU, and product mix analysis |
157
+ | `categories` | Category definitions | Organize items or related commerce objects |
158
+ | `components` | Item-to-item composition records | BOM or kit-like breakdowns |
159
+ | `relateditems` | Related product links | Cross-sell, substitute, or accessory logic |
160
+ | `stocktransactions` | Inventory movements | Stock flow and location history |
161
+ | `storages` | Inventory storage locations | Warehouse and storage analysis |
162
+ | `suppliers` | Supplier-to-item links | Procurement sourcing and vendor pricing |
163
+ | `pricelists` | Price list definitions | Segment or channel pricing |
164
+ | `pricelists2accounts` | Account-to-price-list assignments | Determine which pricing applies to a customer |
165
+ | `prices` | Item prices within a price list | Effective sell price and discounts |
166
+ | `coupons` | Coupon definitions | Promotion logic |
167
+ | `couponcodes` | Codes under a coupon definition | Redeemable campaign-style coupon values |
168
+
169
+ ### Platform, Extensibility, Admin, and Dev Entities
170
+
171
+ | Entity | Purpose | Agent relevance |
172
+ |------|---------|-----------------|
173
+ | `users` | System users | Resolve assignees and ownership |
174
+ | `groups` | User groups | Access control and team grouping |
175
+ | `groups2users` | Group membership junction | Resolve team membership |
176
+ | `permissions` | Group-level permission grants | Access and authorization analysis |
177
+ | `applications` | Application definitions | Dev/admin surface, app inventory |
178
+ | `applicationassets` | Assets linked to an application | App packaging and static resources |
179
+ | `resources` | Named resources linked to an application or standalone | Dev/admin runtime surface; likely asset/resource registry |
180
+ | `services` | Hook, timing, or remote-call services | Automation and lifecycle hook inventory |
181
+ | `weblets` | UI modules with view/type metadata | Embedded or detached UI component inventory |
182
+ | `forks` | Module/fork definitions with identifiers and module names | Platform modularization and ownership boundaries |
183
+ | `customfields` | Custom field definitions | Understand extdata and dynamic schema |
184
+ | `objects` | Custom object records with arbitrary JSON payloads | Custom domain data not covered by core entities |
185
+ | `links` | Link records with name and description | Generic linkage surface; exact business role should be confirmed |
186
+ | `davservers` | DAV server definitions | Calendar/contact sync infrastructure |
187
+ | `feedservers` | Feed server definitions | Feed ingestion infrastructure |
188
+ | `binfiles` | Binary file storage records | Underlying binary payload access |
189
+ | `associations` | Generic cross-entity relation records with metadata | Flexible graph-style linking when typed FKs do not exist |
190
+ | `devices` | Inventory device records | Hardware or device inventory tracking |
191
+ | `mailservers` | Mail server definitions | Messaging infrastructure and account routing |
192
+
193
+ ## Non-API Entity Families And Helper Structures
194
+
195
+ These entities exist in `dbref.json` but are not listed as top-level list resources in `api.json`. Agents should understand them as storage helpers, views, metadata, or internal runtime tables.
196
+
197
+ ### Extdata Helper Families
198
+
199
+ Purpose:
200
+
201
+ - support indexed custom-field storage
202
+ - separate regular, numeric, empty, and zero-like extdata states
203
+ - materialize query-friendly views over custom data
204
+
205
+ Family members are defined for these 40 base entities:
206
+
207
+ `accounts`, `actionsteps`, `applications`, `appointments`, `campaigns`, `channels`, `contacts`, `contracts`, `couponcodes`, `coupons`, `customfields`, `davservers`, `devices`, `documents`, `dunning`, `feedservers`, `forks`, `groups`, `items`, `ledgers`, `links`, `mailinglists`, `mailservers`, `messages`, `notes`, `objects`, `opportunities`, `participants`, `payments`, `pricelists`, `projects`, `resources`, `services`, `stocktransactions`, `storages`, `tasks`, `tickets`, `transactions`, `users`, `weblets`
208
+
209
+ Families:
210
+
211
+ - `extdataempty_*`
212
+ - `extdatanumeric_*`
213
+ - `extdataregular_*`
214
+ - `extdatazero_*`
215
+ - `extdatavalues_*`
216
+
217
+ Exact entity names:
218
+
219
+ ```text
220
+ extdataempty_accounts
221
+ extdataempty_actionsteps
222
+ extdataempty_applications
223
+ extdataempty_appointments
224
+ extdataempty_campaigns
225
+ extdataempty_channels
226
+ extdataempty_contacts
227
+ extdataempty_contracts
228
+ extdataempty_couponcodes
229
+ extdataempty_coupons
230
+ extdataempty_customfields
231
+ extdataempty_davservers
232
+ extdataempty_devices
233
+ extdataempty_documents
234
+ extdataempty_dunning
235
+ extdataempty_feedservers
236
+ extdataempty_forks
237
+ extdataempty_groups
238
+ extdataempty_items
239
+ extdataempty_ledgers
240
+ extdataempty_links
241
+ extdataempty_mailinglists
242
+ extdataempty_mailservers
243
+ extdataempty_messages
244
+ extdataempty_notes
245
+ extdataempty_objects
246
+ extdataempty_opportunities
247
+ extdataempty_participants
248
+ extdataempty_payments
249
+ extdataempty_pricelists
250
+ extdataempty_projects
251
+ extdataempty_resources
252
+ extdataempty_services
253
+ extdataempty_stocktransactions
254
+ extdataempty_storages
255
+ extdataempty_tasks
256
+ extdataempty_tickets
257
+ extdataempty_transactions
258
+ extdataempty_users
259
+ extdataempty_weblets
260
+ extdatanumeric_accounts
261
+ extdatanumeric_actionsteps
262
+ extdatanumeric_applications
263
+ extdatanumeric_appointments
264
+ extdatanumeric_campaigns
265
+ extdatanumeric_channels
266
+ extdatanumeric_contacts
267
+ extdatanumeric_contracts
268
+ extdatanumeric_couponcodes
269
+ extdatanumeric_coupons
270
+ extdatanumeric_customfields
271
+ extdatanumeric_davservers
272
+ extdatanumeric_devices
273
+ extdatanumeric_documents
274
+ extdatanumeric_dunning
275
+ extdatanumeric_feedservers
276
+ extdatanumeric_forks
277
+ extdatanumeric_groups
278
+ extdatanumeric_items
279
+ extdatanumeric_ledgers
280
+ extdatanumeric_links
281
+ extdatanumeric_mailinglists
282
+ extdatanumeric_mailservers
283
+ extdatanumeric_messages
284
+ extdatanumeric_notes
285
+ extdatanumeric_objects
286
+ extdatanumeric_opportunities
287
+ extdatanumeric_participants
288
+ extdatanumeric_payments
289
+ extdatanumeric_pricelists
290
+ extdatanumeric_projects
291
+ extdatanumeric_resources
292
+ extdatanumeric_services
293
+ extdatanumeric_stocktransactions
294
+ extdatanumeric_storages
295
+ extdatanumeric_tasks
296
+ extdatanumeric_tickets
297
+ extdatanumeric_transactions
298
+ extdatanumeric_users
299
+ extdatanumeric_weblets
300
+ extdataregular_accounts
301
+ extdataregular_actionsteps
302
+ extdataregular_applications
303
+ extdataregular_appointments
304
+ extdataregular_campaigns
305
+ extdataregular_channels
306
+ extdataregular_contacts
307
+ extdataregular_contracts
308
+ extdataregular_couponcodes
309
+ extdataregular_coupons
310
+ extdataregular_customfields
311
+ extdataregular_davservers
312
+ extdataregular_devices
313
+ extdataregular_documents
314
+ extdataregular_dunning
315
+ extdataregular_feedservers
316
+ extdataregular_forks
317
+ extdataregular_groups
318
+ extdataregular_items
319
+ extdataregular_ledgers
320
+ extdataregular_links
321
+ extdataregular_mailinglists
322
+ extdataregular_mailservers
323
+ extdataregular_messages
324
+ extdataregular_notes
325
+ extdataregular_objects
326
+ extdataregular_opportunities
327
+ extdataregular_participants
328
+ extdataregular_payments
329
+ extdataregular_pricelists
330
+ extdataregular_projects
331
+ extdataregular_resources
332
+ extdataregular_services
333
+ extdataregular_stocktransactions
334
+ extdataregular_storages
335
+ extdataregular_tasks
336
+ extdataregular_tickets
337
+ extdataregular_transactions
338
+ extdataregular_users
339
+ extdataregular_weblets
340
+ extdatavalues_accounts
341
+ extdatavalues_actionsteps
342
+ extdatavalues_applications
343
+ extdatavalues_appointments
344
+ extdatavalues_campaigns
345
+ extdatavalues_channels
346
+ extdatavalues_contacts
347
+ extdatavalues_contracts
348
+ extdatavalues_couponcodes
349
+ extdatavalues_coupons
350
+ extdatavalues_customfields
351
+ extdatavalues_davservers
352
+ extdatavalues_devices
353
+ extdatavalues_documents
354
+ extdatavalues_dunning
355
+ extdatavalues_feedservers
356
+ extdatavalues_forks
357
+ extdatavalues_groups
358
+ extdatavalues_items
359
+ extdatavalues_ledgers
360
+ extdatavalues_links
361
+ extdatavalues_mailinglists
362
+ extdatavalues_mailservers
363
+ extdatavalues_messages
364
+ extdatavalues_notes
365
+ extdatavalues_objects
366
+ extdatavalues_opportunities
367
+ extdatavalues_participants
368
+ extdatavalues_payments
369
+ extdatavalues_pricelists
370
+ extdatavalues_projects
371
+ extdatavalues_resources
372
+ extdatavalues_services
373
+ extdatavalues_stocktransactions
374
+ extdatavalues_storages
375
+ extdatavalues_tasks
376
+ extdatavalues_tickets
377
+ extdatavalues_transactions
378
+ extdatavalues_users
379
+ extdatavalues_weblets
380
+ extdatazero_accounts
381
+ extdatazero_actionsteps
382
+ extdatazero_applications
383
+ extdatazero_appointments
384
+ extdatazero_campaigns
385
+ extdatazero_channels
386
+ extdatazero_contacts
387
+ extdatazero_contracts
388
+ extdatazero_couponcodes
389
+ extdatazero_coupons
390
+ extdatazero_customfields
391
+ extdatazero_davservers
392
+ extdatazero_devices
393
+ extdatazero_documents
394
+ extdatazero_dunning
395
+ extdatazero_feedservers
396
+ extdatazero_forks
397
+ extdatazero_groups
398
+ extdatazero_items
399
+ extdatazero_ledgers
400
+ extdatazero_links
401
+ extdatazero_mailinglists
402
+ extdatazero_mailservers
403
+ extdatazero_messages
404
+ extdatazero_notes
405
+ extdatazero_objects
406
+ extdatazero_opportunities
407
+ extdatazero_participants
408
+ extdatazero_payments
409
+ extdatazero_pricelists
410
+ extdatazero_projects
411
+ extdatazero_resources
412
+ extdatazero_services
413
+ extdatazero_stocktransactions
414
+ extdatazero_storages
415
+ extdatazero_tasks
416
+ extdatazero_tickets
417
+ extdatazero_transactions
418
+ extdatazero_users
419
+ extdatazero_weblets
420
+ ```
421
+
422
+ Global extdata support objects:
423
+
424
+ - `extdata`
425
+ - `extdatafields`
426
+ - `extdatavalues`
427
+
428
+ ### Tagging Structures
429
+
430
+ Purpose:
431
+
432
+ - provide global tag names and per-entity tag assignments
433
+
434
+ Global objects:
435
+
436
+ - `tagnames`
437
+ - `tags`
438
+ - `tagrels`
439
+
440
+ Per-entity tag relation tables exist for these 37 base entities:
441
+
442
+ `accounts`, `actionsteps`, `applications`, `appointments`, `campaigns`, `channels`, `contacts`, `contracts`, `coupons`, `customfields`, `davservers`, `devices`, `documents`, `dunning`, `feedservers`, `forks`, `groups`, `items`, `ledgers`, `links`, `mailinglists`, `mailservers`, `messages`, `notes`, `objects`, `opportunities`, `payments`, `pricelists`, `projects`, `resources`, `services`, `storages`, `tasks`, `tickets`, `transactions`, `users`, `weblets`
443
+
444
+ Exact entity names:
445
+
446
+ ```text
447
+ tagrels_accounts
448
+ tagrels_actionsteps
449
+ tagrels_applications
450
+ tagrels_appointments
451
+ tagrels_campaigns
452
+ tagrels_channels
453
+ tagrels_contacts
454
+ tagrels_contracts
455
+ tagrels_coupons
456
+ tagrels_customfields
457
+ tagrels_davservers
458
+ tagrels_devices
459
+ tagrels_documents
460
+ tagrels_dunning
461
+ tagrels_feedservers
462
+ tagrels_forks
463
+ tagrels_groups
464
+ tagrels_items
465
+ tagrels_ledgers
466
+ tagrels_links
467
+ tagrels_mailinglists
468
+ tagrels_mailservers
469
+ tagrels_messages
470
+ tagrels_notes
471
+ tagrels_objects
472
+ tagrels_opportunities
473
+ tagrels_payments
474
+ tagrels_pricelists
475
+ tagrels_projects
476
+ tagrels_resources
477
+ tagrels_services
478
+ tagrels_storages
479
+ tagrels_tasks
480
+ tagrels_tickets
481
+ tagrels_transactions
482
+ tagrels_users
483
+ tagrels_weblets
484
+ ```
485
+
486
+ ### Static Metadata Tables
487
+
488
+ Purpose:
489
+
490
+ - provide reference dictionaries for geography, currencies, languages, taxonomies, modules, time zones, and units
491
+
492
+ Entities:
493
+
494
+ `meta_cities`, `meta_countries`, `meta_countries_borders`, `meta_countries_languages`, `meta_countries_names`, `meta_currencies`, `meta_currencies_names`, `meta_languages`, `meta_languages_names`, `meta_modules`, `meta_modules_names`, `meta_postalcodes`, `meta_regions`, `meta_regions_names`, `meta_states`, `meta_subregions`, `meta_subregions_names`, `meta_taxonomy_cn`, `meta_taxonomy_cn_names`, `meta_taxonomy_cpv`, `meta_taxonomy_cpv_names`, `meta_taxonomy_google`, `meta_taxonomy_google_names`, `meta_taxonomy_gpc`, `meta_taxonomy_gpc_names`, `meta_taxonomy_hts`, `meta_taxonomy_hts_names`, `meta_taxonomy_unspsc`, `meta_taxonomy_unspsc_names`, `meta_timezones`, `meta_timezones_offsets`, `meta_tlds`, `meta_units`
495
+
496
+ ### Versioning, Mapping, and Sync Tables
497
+
498
+ Purpose:
499
+
500
+ - store binary version history, protocol mappings, or sync identifiers
501
+
502
+ Entities:
503
+
504
+ - `documentversions`
505
+ - `enhancementversions`
506
+ - `feedids`
507
+ - `imapids`
508
+ - `davids`
509
+
510
+ ### Runtime, Audit, Session, and Personalization Tables
511
+
512
+ Purpose:
513
+
514
+ - store usage, authentication, imports, recently viewed records, saved views, and user-specific UI state
515
+
516
+ Entities:
517
+
518
+ - `cpu`
519
+ - `cpucollector`
520
+ - `imports`
521
+ - `logins`
522
+ - `notifications`
523
+ - `numcounters`
524
+ - `recent`
525
+ - `tokens`
526
+ - `usagestats`
527
+ - `userfields`
528
+ - `userfilters`
529
+ - `views`
530
+
531
+ ## Agent Query Priority
532
+
533
+ Use this priority order when deciding what to read first:
534
+
535
+ 1. Core business entities such as `accounts`, `contacts`, `tickets`, `tasks`, `projects`, `messages`, `notes`, `documents`, `transactions`, and `payments`
536
+ 2. Junction entities such as `mailingrecipients`, `pricelists2accounts`, `dunning2transactions`, `groups2users`, `entities2channels` (note: these have diverging operationIds — see [Entity Noun to REST operationId](#entity-noun-to-rest-operationid))
537
+ 3. Platform and extensibility entities such as `customfields`, `objects`, `applications`, `services`, `weblets`, `forks`
538
+ 4. Internal helper families such as `extdata*`, `tagrels*`, `meta_*`, and runtime tables
539
+
540
+ ## High-Value Use Cases By Entity Cluster
541
+
542
+ - Customer 360: `accounts`, `contacts`, `addresses`, `tickets`, `transactions`, `payments`, `messages`
543
+ - Work routing: `users`, `tasks`, `tickets`, `projects`, `actionsteps`
544
+ - Customer mail summaries: `accounts`, `contacts`, `messages`, `mailingrecipients`, `tickets`
545
+ - Revenue and collections: `transactions`, `payments`, `ledgers`, `dunning`, `dunning2transactions`
546
+ - Campaign and outreach execution: `campaigns`, `mailinglists`, `participants`, `messages`, `mailingrecipients`, `messagereads`
547
+ - Knowledge retrieval: `notes`, `documents`, `files`, `comments`
548
+ - Pricing and stock: `items`, `prices`, `pricelists`, `pricelists2accounts`, `stocktransactions`, `storages`, `suppliers`
549
+ - Collaboration and activity feeds: `records`, `comments`, `files`, `channels`, `entities2channels`, `follows`, `likes`, `events`
550
+ - Platform and schema: `applications`, `resources`, `services`, `weblets`, `forks`, `groups`, `groups2users`, `permissions`, `customfields`, `objects`
551
+
552
+ ## Benchmark-Backed Agent Defaults
553
+
554
+ Use these defaults unless the target instance clearly behaves differently:
555
+
556
+ - `actionsteps`: record-bound activities or follow-ups
557
+ - `records`, `comments`, `files`, and `events`: user-facing timeline/feed layer
558
+ - `channels` and `entities2channels`: collaboration spaces and record-to-channel links
559
+ - `follows`: watcher/subscription state
560
+ - `likes`: lightweight engagement signal
561
+ - `dunning`: collection-stage object, not the receivable itself
562
+
563
+ ## Open Product-Semantics Questions
564
+
565
+ These are structurally understandable from the schema, but their business meaning is still partly product-specific:
566
+
567
+ - `links`: what business object does a link usually represent in your instance?
568
+ - `records`, `comments`, `follows`, `likes`, and `events`: how important is this collaboration layer in real customer deployments?
569
+ - `channels` and `entities2channels`: are they widely used as collaboration rooms, or only in selected app modules?
570
+ - `forks`, `resources`, `services`, and `weblets`: should these stay low-priority platform/admin surfaces for agents, or are they intended to be queried by external coding agents regularly?
@@ -0,0 +1,89 @@
1
+ # ZeyOS Query Patterns
2
+
3
+ Use this file as the default operating playbook before answering any business question against ZeyOS.
4
+
5
+ For the full source-backed inventory, read [zeyos-entity-reference.md](./zeyos-entity-reference.md).
6
+ For cross-platform benchmark guidance, read [business-app-benchmarks.md](./business-app-benchmarks.md).
7
+
8
+ ## Default Execution Order
9
+
10
+ 1. Resolve the business nouns in the prompt into concrete ZeyOS entities.
11
+ 2. Resolve human labels to IDs before querying related records.
12
+ 3. Normalize the time window into Unix timestamps in seconds.
13
+ 4. Choose the primary resource first. Do not join across domains until the primary record set is clear.
14
+ 5. Choose the interface:
15
+ - Use the CLI for registry-backed CRUD and straightforward list/get/count flows.
16
+ - Use `@zeyos/client` when you need unsupported resources, `expand`, binary access, richer request control, or multi-step correlation logic.
17
+ 6. Query only the fields needed for the next decision.
18
+ 7. Run follow-up queries only for relationships that affect the answer.
19
+ 8. State assumptions and ambiguities in the final answer.
20
+
21
+ ## Common Guardrails
22
+
23
+ - Discover before guessing: `zeyos describe <resource>` (or `client.schema.describe(resource)`) lists a resource's fields, types, foreign keys, and enum values; both run offline. `zeyos describe`, `create`, `update`, and `list` all accept singular, plural, or aliased resource names (`ticket`/`tickets`/`invoice`). Pre-check a call with `client.schema.validate(operationId, input)` — it flags unknown fields (with suggestions), `filter` vs `filters`, invalid enum values, and missing required create fields. An unknown operation name rejects with a "did you mean …?" suggestion.
24
+ - Creating accounts requires `currency` (e.g. `"EUR"`): the column is NOT NULL with no DB default, so a create that omits it fails with an opaque HTTP 500 even though the OpenAPI spec does not mark it required. `validate('createAccount', …)` now catches this; supply a currency code. (The spec carries no required-field metadata at all, so unknown required fields can still surface only as a server-side 500 — when a create 500s, suspect a missing NOT-NULL column.)
25
+ - Use `visibility: 0` on resources that expose a `visibility` field, unless the user explicitly wants archived or deleted records.
26
+ - Treat list operations as `POST` queries.
27
+ - Treat `filter` versus `filters` as a source inconsistency, not a universal rule:
28
+ - `api.json` documents `filter`
29
+ - repo client and sample code use `filters`
30
+ - the CLI exposes `--filter` but writes `filters` internally
31
+ - Use `body: { ... }` for PATCH updates that also pass `ID`.
32
+ - Treat `extdata` and `expand` as different features:
33
+ - `extdata` exposes custom fields
34
+ - `expand` inlines JSON or binary columns
35
+ - For a "how many?" question, count server-side: `zeyos count <resource>` on the CLI, or pass `count: true` to the list call on the client (e.g. `client.api.listItems({ filters: { visibility: 0 }, count: true })`). Never use `list` + array length. `zeyos list` defaults to `--limit 50` (the client default is 1000), so counting listed rows silently returns the page size, not the total. In `--json` mode the only truncation signal is a stderr "Showing X–Y of TOTAL" hint.
36
+ - Treat `count: true` responses defensively because wrappers vary across resources and client layers.
37
+ - Confirm delete, send, revoke, or bulk-update actions before executing them unless the workflow is already explicitly automated.
38
+
39
+ ## Benchmark-Backed Semantic Defaults
40
+
41
+ Use these defaults unless the target instance clearly behaves differently:
42
+
43
+ - `projects`, `tickets`, and `tasks` are governed work objects.
44
+ - `actionsteps` are record-bound follow-up activities:
45
+ - use them for next promises, reminders, and collector or account follow-ups
46
+ - do not automatically inflate them into full project tasks
47
+ - `records`, `comments`, `files`, and `events` form a record timeline or activity feed:
48
+ - use them when the user asks "what happened on this account/project/ticket?"
49
+ - do not treat them as mere infrastructure if there is evidence of user-facing activity
50
+ - `channels` and `entities2channels` are collaboration spaces or record-to-channel sharing links:
51
+ - prefer this interpretation over pure categorization unless the instance says otherwise
52
+ - `follows` and `likes` are attention and engagement signals, not access-control objects.
53
+ - `dunning` is a stage in a collections process, not the receivable itself:
54
+ - separate invoice exposure from collection stage and next action
55
+ - `links` should stay low-priority until the instance proves they represent a meaningful business domain rather than a generic URL store.
56
+
57
+ ## Default Resolution Patterns
58
+
59
+ - Resolve a user with `users.name` or `users.email` first.
60
+ - Resolve a customer with `accounts.customernum`, `accounts.lastname`, `accounts.firstname`, then `contacts.email` or contact name if needed.
61
+ - Resolve a project with `projects.projectnum` or `projects.name`.
62
+ - Resolve a ticket with `tickets.ticketnum` or `tickets.name`.
63
+ - Resolve a task with `tasks.tasknum` or `tasks.name`.
64
+ - Resolve a transaction with `transactions.transactionnum`.
65
+ - Resolve a note or document with `name`, `documentnum`, `filename`, and status.
66
+
67
+ ## Time Windows
68
+
69
+ - ZeyOS timestamps are Unix seconds, not milliseconds.
70
+ - Use `date` for business-effective dates such as invoice date or message date.
71
+ - Use `lastmodified` for recent activity or change tracking.
72
+ - For phrases like "this year", anchor to the current calendar year unless the user asks for fiscal logic.
73
+
74
+ ## Answering Discipline
75
+
76
+ - Separate facts from inference.
77
+ - When the schema does not encode the business concept directly, explain the proxy.
78
+ - When an answer mixes governed work, activity feed, and collaboration spaces, label those layers separately.
79
+ - If a query depends on an unstated metric definition, ask or make the assumption explicit.
80
+
81
+ ## Escalation Checklist
82
+
83
+ Escalate from the CLI to `@zeyos/client` when you need any of the following:
84
+
85
+ - unsupported resources or operations
86
+ - `expand` or binary-file access
87
+ - client-side aggregation after multiple list calls
88
+ - more careful response normalization
89
+ - raw request control or custom retries