@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.
- package/CHANGELOG.md +31 -0
- package/LICENSE +21 -0
- package/README.md +458 -0
- package/agents/README.md +66 -0
- package/agents/shared/business-app-benchmarks.md +111 -0
- package/agents/shared/zeyos-entity-map.md +142 -0
- package/agents/shared/zeyos-entity-reference.md +570 -0
- package/agents/shared/zeyos-query-patterns.md +89 -0
- package/agents/zeyos-account-intelligence/SKILL.md +34 -0
- package/agents/zeyos-account-intelligence/agents/openai.yaml +4 -0
- package/agents/zeyos-account-intelligence/references/workflows.md +84 -0
- package/agents/zeyos-billing-insights/SKILL.md +41 -0
- package/agents/zeyos-billing-insights/agents/openai.yaml +4 -0
- package/agents/zeyos-billing-insights/references/workflows.md +106 -0
- package/agents/zeyos-campaign-and-outreach/SKILL.md +44 -0
- package/agents/zeyos-campaign-and-outreach/agents/openai.yaml +4 -0
- package/agents/zeyos-campaign-and-outreach/references/workflows.md +100 -0
- package/agents/zeyos-collaboration-and-activity/SKILL.md +37 -0
- package/agents/zeyos-collaboration-and-activity/agents/openai.yaml +4 -0
- package/agents/zeyos-collaboration-and-activity/references/workflows.md +104 -0
- package/agents/zeyos-collections-and-dunning/SKILL.md +46 -0
- package/agents/zeyos-collections-and-dunning/agents/openai.yaml +4 -0
- package/agents/zeyos-collections-and-dunning/references/workflows.md +132 -0
- package/agents/zeyos-commerce-and-inventory/SKILL.md +38 -0
- package/agents/zeyos-commerce-and-inventory/agents/openai.yaml +4 -0
- package/agents/zeyos-commerce-and-inventory/references/workflows.md +101 -0
- package/agents/zeyos-mail-operations/SKILL.md +35 -0
- package/agents/zeyos-mail-operations/agents/openai.yaml +4 -0
- package/agents/zeyos-mail-operations/references/workflows.md +110 -0
- package/agents/zeyos-notes-and-sops/SKILL.md +31 -0
- package/agents/zeyos-notes-and-sops/agents/openai.yaml +4 -0
- package/agents/zeyos-notes-and-sops/references/workflows.md +85 -0
- package/agents/zeyos-platform-and-schema/SKILL.md +37 -0
- package/agents/zeyos-platform-and-schema/agents/openai.yaml +4 -0
- package/agents/zeyos-platform-and-schema/references/workflows.md +97 -0
- package/agents/zeyos-work-management/SKILL.md +45 -0
- package/agents/zeyos-work-management/agents/openai.yaml +4 -0
- package/agents/zeyos-work-management/references/workflows.md +148 -0
- package/docs/01-api-reference/01-data-retrieval.md +601 -0
- package/docs/01-api-reference/02-authentication.md +288 -0
- package/docs/01-api-reference/03-resources.md +270 -0
- package/docs/01-api-reference/04-schema.md +539 -0
- package/docs/01-api-reference/_category_.json +9 -0
- package/docs/02-javascript-client/01-getting-started.md +146 -0
- package/docs/02-javascript-client/02-authentication.md +287 -0
- package/docs/02-javascript-client/03-making-requests.md +572 -0
- package/docs/02-javascript-client/04-practical-guide.md +348 -0
- package/docs/02-javascript-client/_category_.json +9 -0
- package/docs/03-cli/01-getting-started.md +219 -0
- package/docs/03-cli/02-commands.md +407 -0
- package/docs/03-cli/03-configuration.md +220 -0
- package/docs/03-cli/_category_.json +9 -0
- package/docs/04-agent-workflows/00-coding-agents.md +35 -0
- package/docs/04-agent-workflows/01-agent-quickstart.md +147 -0
- package/docs/04-agent-workflows/02-agent-recipes.md +109 -0
- package/docs/04-agent-workflows/03-cli-coverage-and-escalation.md +65 -0
- package/docs/04-agent-workflows/_category_.json +9 -0
- package/docs/04-sample-apps/01-kanban.md +89 -0
- package/docs/04-sample-apps/02-crm.md +81 -0
- package/docs/04-sample-apps/03-dashboard.md +80 -0
- package/docs/04-sample-apps/_category_.json +9 -0
- package/docs/05-tutorials/00-application-developers.md +43 -0
- package/docs/05-tutorials/01-integration-architecture.md +60 -0
- package/docs/05-tutorials/02-build-your-own-zeyos-frontend.md +517 -0
- package/docs/05-tutorials/03-server-side-integrations.md +185 -0
- package/docs/05-tutorials/_category_.json +9 -0
- package/docs/intro.md +197 -0
- package/openapi/api.json +24308 -0
- package/openapi/auth.json +415 -0
- package/openapi/dbref.json +56223 -0
- package/openapi/oauth2.json +781 -0
- package/openapi/sdk.json +949 -0
- package/openapi/views.txt +642 -0
- package/package.json +49 -0
- package/samples/crm/README.md +28 -0
- package/samples/crm/index.html +327 -0
- package/samples/crm/js/api.js +208 -0
- package/samples/crm/js/auth.js +61 -0
- package/samples/crm/js/main.js +545 -0
- package/samples/crm/js/state.js +90 -0
- package/samples/crm/js/ui.js +51 -0
- package/samples/dashboard/README.md +28 -0
- package/samples/dashboard/index.html +280 -0
- package/samples/dashboard/js/api.js +197 -0
- package/samples/dashboard/js/auth.js +59 -0
- package/samples/dashboard/js/main.js +382 -0
- package/samples/dashboard/js/state.js +81 -0
- package/samples/dashboard/js/ui.js +48 -0
- package/samples/kanban/README.md +28 -0
- package/samples/kanban/index.html +263 -0
- package/samples/kanban/js/api.js +152 -0
- package/samples/kanban/js/auth.js +59 -0
- package/samples/kanban/js/constants.js +40 -0
- package/samples/kanban/js/kanban.js +246 -0
- package/samples/kanban/js/main.js +362 -0
- package/samples/kanban/js/modals.js +474 -0
- package/samples/kanban/js/settings.js +82 -0
- package/samples/kanban/js/state.js +118 -0
- package/samples/kanban/js/ui.js +49 -0
- package/scripts/generate-client.mjs +344 -0
- package/src/generated/operations.js +9772 -0
- package/src/generated/schema.js +8982 -0
- package/src/index.js +85 -0
- package/src/runtime/client.js +1208 -0
- package/src/runtime/error.js +29 -0
- package/src/runtime/http.js +174 -0
- package/src/runtime/request-shape.js +35 -0
- package/src/runtime/schema.js +206 -0
- package/src/runtime/suggest.js +74 -0
- package/src/runtime/token-store.js +105 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Collections And Dunning Workflows
|
|
2
|
+
|
|
3
|
+
## Primary Resources
|
|
4
|
+
|
|
5
|
+
The DB-table noun is not the operationId. Use the operationIds below with `@zeyos/client`
|
|
6
|
+
(`client.api.<operationId>(...)`); see [../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid) for the full mapping.
|
|
7
|
+
|
|
8
|
+
| Concept | dbref noun | list operationId | single-record operationIds |
|
|
9
|
+
|---------|------------|------------------|----------------------------|
|
|
10
|
+
| Accounts | `accounts` | `listAccounts` | `getAccount`, `createAccount`, `updateAccount`, `deleteAccount` |
|
|
11
|
+
| Transactions / invoices | `transactions` | `listTransactions` | `getTransaction`, `createTransaction`, `updateTransaction`, `deleteTransaction` |
|
|
12
|
+
| Payments | `payments` | `listPayments` | `getPayment`, `createPayment`, `updatePayment`, `deletePayment` |
|
|
13
|
+
| Dunning notices | `dunning` | `listDunningNotices` | `getDunningNotice`, `createDunningNotice`, `updateDunningNotice`, `deleteDunningNotice` |
|
|
14
|
+
| Dunning-to-transaction links | `dunning2transactions` | `listDunningToTransactions` | `getDunningToTransaction`, `createDunningToTransaction`, `deleteDunningToTransaction` |
|
|
15
|
+
|
|
16
|
+
Note: `dunning` is the **`DunningNotice`** entity (not `Dunning`), and `dunning2transactions`
|
|
17
|
+
is the `DunningToTransaction` junction. Calling `client.api.listDunning(...)` or
|
|
18
|
+
`client.api.listDunning2transactions(...)` will fail with "operation not found".
|
|
19
|
+
|
|
20
|
+
## Important Status Caution
|
|
21
|
+
|
|
22
|
+
- `transactions.status` is broad and mixes lifecycle states such as invoiced, partly paid, paid, cancelled, and closed.
|
|
23
|
+
- `payments` can point either to a `transaction` or directly to an `account`.
|
|
24
|
+
- Do not claim exact open balance from schema alone if the available payment records are only account-level and not transaction-linked.
|
|
25
|
+
- Do not invent multi-level dunning procedures if the instance only exposes `type`, `status`, `date`, and `duedate`.
|
|
26
|
+
|
|
27
|
+
## Pattern: Overdue Invoices For A Customer
|
|
28
|
+
|
|
29
|
+
Use this for prompts like:
|
|
30
|
+
|
|
31
|
+
- "Which invoices are overdue for customer XYZ?"
|
|
32
|
+
- "Show overdue receivables for ACME."
|
|
33
|
+
|
|
34
|
+
Recommended approach:
|
|
35
|
+
|
|
36
|
+
1. Resolve the account.
|
|
37
|
+
2. Query billing invoices from `transactions` for that account.
|
|
38
|
+
3. Filter by `type = 3` and `duedate < now`.
|
|
39
|
+
4. Exclude clearly cancelled records.
|
|
40
|
+
5. If the user asks whether they are already in collections, follow with `dunning2transactions` and `dunning`.
|
|
41
|
+
|
|
42
|
+
Client example:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
const overdueInvoices = await client.api.listTransactions({
|
|
46
|
+
fields: ['ID', 'transactionnum', 'account', 'date', 'duedate', 'status', 'netamount', 'currency'],
|
|
47
|
+
filters: {
|
|
48
|
+
account: accountId,
|
|
49
|
+
type: 3,
|
|
50
|
+
duedate: { '<': nowTs },
|
|
51
|
+
},
|
|
52
|
+
sort: ['+duedate'],
|
|
53
|
+
limit: 200,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Pattern: Open Dunning Notices And Covered Invoices
|
|
58
|
+
|
|
59
|
+
Use this for prompts like:
|
|
60
|
+
|
|
61
|
+
- "What dunning notices are still open?"
|
|
62
|
+
- "Which invoices are part of reminder notice 2025-004?"
|
|
63
|
+
|
|
64
|
+
Recommended approach:
|
|
65
|
+
|
|
66
|
+
1. Resolve the dunning record or account first.
|
|
67
|
+
2. Query `dunning` notices via `listDunningNotices` for active or recently relevant notices.
|
|
68
|
+
3. Query `dunning2transactions` via `listDunningToTransactions` for the linked transaction IDs.
|
|
69
|
+
4. Fetch the linked `transactions` to show invoice numbers, due dates, and values.
|
|
70
|
+
5. Present the result by dunning notice, then by covered invoice.
|
|
71
|
+
|
|
72
|
+
## Pattern: Account Collection Status
|
|
73
|
+
|
|
74
|
+
Use this for prompts like:
|
|
75
|
+
|
|
76
|
+
- "Show the payment gap for ACME and whether any invoices are already in dunning."
|
|
77
|
+
- "What is the current collection status for customer XYZ?"
|
|
78
|
+
|
|
79
|
+
Recommended approach:
|
|
80
|
+
|
|
81
|
+
1. Resolve the account.
|
|
82
|
+
2. Query invoice transactions for the account.
|
|
83
|
+
3. Query payments for the same account, and separately note which payments are directly tied to transactions.
|
|
84
|
+
4. Query dunning notices for the account.
|
|
85
|
+
5. Use `dunning2transactions` to mark which invoices are already in a reminder or notice flow.
|
|
86
|
+
6. Present:
|
|
87
|
+
- overdue invoices
|
|
88
|
+
- payments received
|
|
89
|
+
- invoices already in dunning
|
|
90
|
+
- invoices still overdue but not yet in dunning
|
|
91
|
+
|
|
92
|
+
## Pattern: Receivables Needing Follow-Up This Week
|
|
93
|
+
|
|
94
|
+
Use this for prompts like:
|
|
95
|
+
|
|
96
|
+
- "Which receivables need follow-up this week?"
|
|
97
|
+
- "What should collections work on next?"
|
|
98
|
+
|
|
99
|
+
Recommended approach:
|
|
100
|
+
|
|
101
|
+
1. Start from overdue invoices.
|
|
102
|
+
2. Split them into:
|
|
103
|
+
- already in dunning
|
|
104
|
+
- overdue without dunning
|
|
105
|
+
- near due date but not yet overdue
|
|
106
|
+
3. If open `actionsteps` exist on the same account or transaction, include them as the operational next-step layer.
|
|
107
|
+
4. Be explicit when the prioritization is heuristic rather than enforced by schema.
|
|
108
|
+
|
|
109
|
+
## Pattern: Next Collection Step
|
|
110
|
+
|
|
111
|
+
Use this for prompts like:
|
|
112
|
+
|
|
113
|
+
- "Which accounts should move to the next collection step?"
|
|
114
|
+
- "What should collections do next?"
|
|
115
|
+
|
|
116
|
+
Recommended approach:
|
|
117
|
+
|
|
118
|
+
1. Start from overdue invoices and current dunning notices.
|
|
119
|
+
2. Group by account.
|
|
120
|
+
3. Distinguish:
|
|
121
|
+
- overdue with no dunning yet
|
|
122
|
+
- reminder issued but still unpaid
|
|
123
|
+
- notice issued and still unpaid
|
|
124
|
+
4. If `assigneduser` or open `actionsteps` exist, use them as the operational ownership layer.
|
|
125
|
+
5. Present the recommendation as a heuristic next action unless the instance has a fully defined dunning procedure elsewhere.
|
|
126
|
+
|
|
127
|
+
## Common Failure Modes
|
|
128
|
+
|
|
129
|
+
- Treating invoice creation and cash receipt as the same thing.
|
|
130
|
+
- Assuming every payment can be allocated exactly to one invoice.
|
|
131
|
+
- Treating dunning state as visible from `transactions` without checking `dunning2transactions`.
|
|
132
|
+
- Ignoring credits when the user asks for net receivable exposure.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zeyos-commerce-and-inventory
|
|
3
|
+
description: Analyze ZeyOS items, pricing, price lists, supplier links, stock movement, storage, coupons, and related commerce entities. Use when asked about customer-specific pricing, item catalogs, stock availability, supplier sourcing, applicable price lists, or product and inventory questions that span items, prices, accounts, and stock transactions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeyOS Commerce And Inventory
|
|
7
|
+
|
|
8
|
+
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) and [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) when the request crosses pricing, accounts, and stock. Read [references/workflows.md](references/workflows.md) for commerce-specific query plans.
|
|
9
|
+
|
|
10
|
+
Typical prompts:
|
|
11
|
+
|
|
12
|
+
- "What price does customer XYZ get for item ABC?"
|
|
13
|
+
- "Which items are low on stock?"
|
|
14
|
+
- "Who are the suppliers for item ABC?"
|
|
15
|
+
- "Which price list applies to account ACME?"
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Resolve the item, account, price list, or storage first.
|
|
20
|
+
2. Distinguish catalog questions from pricing questions and stock questions.
|
|
21
|
+
3. Use:
|
|
22
|
+
- `items` for product identity
|
|
23
|
+
- `prices` and `pricelists` for effective commercial pricing
|
|
24
|
+
- `pricelists2accounts` for account-specific price-list assignment (operationId `listPriceListsToAccounts`; `pricelists` -> `listPriceLists`)
|
|
25
|
+
- `stocktransactions` and `storages` for inventory movement and location (`stocktransactions` -> `listStockTransactions`; these dbref nouns do not map naively — see [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid))
|
|
26
|
+
- `suppliers` for vendor sourcing
|
|
27
|
+
4. State whether a quoted price is:
|
|
28
|
+
- base item price
|
|
29
|
+
- price-list override
|
|
30
|
+
- customer-specific via price-list assignment
|
|
31
|
+
5. Treat stock answers as derived from movements unless the question explicitly asks for transaction history.
|
|
32
|
+
6. Keep procurement-side and billing-side price logic separate.
|
|
33
|
+
|
|
34
|
+
## Output Discipline
|
|
35
|
+
|
|
36
|
+
- Start with the resolved item/account/storage identity.
|
|
37
|
+
- Separate price determination from stock determination.
|
|
38
|
+
- Call out whether the answer came from item defaults, price lists, supplier pricing, or stock movements.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Commerce And Inventory Workflows
|
|
2
|
+
|
|
3
|
+
## Primary Resources
|
|
4
|
+
|
|
5
|
+
- `items`
|
|
6
|
+
- `prices`
|
|
7
|
+
- `pricelists`
|
|
8
|
+
- `pricelists2accounts`
|
|
9
|
+
- `stocktransactions`
|
|
10
|
+
- `storages`
|
|
11
|
+
- `suppliers`
|
|
12
|
+
- `relateditems`
|
|
13
|
+
- `components`
|
|
14
|
+
- `coupons`
|
|
15
|
+
- `couponcodes`
|
|
16
|
+
|
|
17
|
+
These are dbref nouns, not operationIds. Several diverge: `pricelists` -> `listPriceLists`,
|
|
18
|
+
`pricelists2accounts` -> `listPriceListsToAccounts`, `stocktransactions` -> `listStockTransactions`,
|
|
19
|
+
`relateditems` -> `listRelatedItems`, `couponcodes` -> `listCouponCodes`. See
|
|
20
|
+
[../../shared/zeyos-entity-reference.md](../../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid)
|
|
21
|
+
before calling `@zeyos/client`.
|
|
22
|
+
|
|
23
|
+
## Pattern: Effective Price For A Customer
|
|
24
|
+
|
|
25
|
+
Use this for prompts like:
|
|
26
|
+
|
|
27
|
+
- "What price does customer XYZ get for item ABC?"
|
|
28
|
+
- "Which price applies to ACME for this SKU?"
|
|
29
|
+
|
|
30
|
+
Recommended approach:
|
|
31
|
+
|
|
32
|
+
1. Resolve the account.
|
|
33
|
+
2. Resolve the item.
|
|
34
|
+
3. Query `pricelists2accounts` to find assigned price lists.
|
|
35
|
+
4. Query `prices` for the item across those price lists.
|
|
36
|
+
5. If no override exists, fall back to item default selling or purchase price depending on the commercial context.
|
|
37
|
+
|
|
38
|
+
Important caveat:
|
|
39
|
+
|
|
40
|
+
- `prices.price` may explicitly fall back to item defaults according to the schema. Say when that happened.
|
|
41
|
+
|
|
42
|
+
## Pattern: Low Stock Or Stock History
|
|
43
|
+
|
|
44
|
+
Use this for prompts like:
|
|
45
|
+
|
|
46
|
+
- "Which items are low on stock?"
|
|
47
|
+
- "Show stock movements for item ABC in the last month."
|
|
48
|
+
|
|
49
|
+
Recommended approach:
|
|
50
|
+
|
|
51
|
+
1. Resolve the item or storage scope.
|
|
52
|
+
2. Query `stocktransactions` in the relevant period.
|
|
53
|
+
3. Aggregate movement client-side for availability-style answers.
|
|
54
|
+
4. Keep the raw transaction list for audit-style answers.
|
|
55
|
+
|
|
56
|
+
## Pattern: Supplier Lookup
|
|
57
|
+
|
|
58
|
+
Use this for prompts like:
|
|
59
|
+
|
|
60
|
+
- "Who are the suppliers for item ABC?"
|
|
61
|
+
- "What supplier price do we have for this item?"
|
|
62
|
+
|
|
63
|
+
Recommended approach:
|
|
64
|
+
|
|
65
|
+
1. Resolve the item.
|
|
66
|
+
2. Query `suppliers` for that item.
|
|
67
|
+
3. Resolve supplier accounts to readable names if needed.
|
|
68
|
+
4. Present supplier price, minimum amount, and delivery time when available.
|
|
69
|
+
|
|
70
|
+
## Pattern: Price List Coverage
|
|
71
|
+
|
|
72
|
+
Use this for prompts like:
|
|
73
|
+
|
|
74
|
+
- "Which price list applies to ACME?"
|
|
75
|
+
- "Which accounts use price list Spring 2026?"
|
|
76
|
+
|
|
77
|
+
Recommended approach:
|
|
78
|
+
|
|
79
|
+
1. Resolve either the account or the price list first.
|
|
80
|
+
2. Query `pricelists2accounts`.
|
|
81
|
+
3. Join to `pricelists` or `accounts` for names and active dates.
|
|
82
|
+
|
|
83
|
+
## Pattern: Promotions And Coupon Codes
|
|
84
|
+
|
|
85
|
+
Use this for prompts like:
|
|
86
|
+
|
|
87
|
+
- "Which coupons are active right now?"
|
|
88
|
+
- "Which codes belong to coupon Spring Promo?"
|
|
89
|
+
|
|
90
|
+
Recommended approach:
|
|
91
|
+
|
|
92
|
+
1. Query `coupons` for active date windows and activity state.
|
|
93
|
+
2. Query `couponcodes` when the user needs concrete redeemable codes.
|
|
94
|
+
3. Keep generic promotion definitions separate from individual codes.
|
|
95
|
+
|
|
96
|
+
## Common Failure Modes
|
|
97
|
+
|
|
98
|
+
- Quoting a price without saying whether it is default or overridden.
|
|
99
|
+
- Mixing billing and procurement price logic.
|
|
100
|
+
- Reporting stock from one storage as if it were global inventory.
|
|
101
|
+
- Ignoring minimum quantities or supplier-specific constraints.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zeyos-mail-operations
|
|
3
|
+
description: Query, summarize, and draft ZeyOS email and message records. Use when asked to summarize recent customer mail, reconstruct threads, find inbox or draft messages, prepare reply drafts, or explain how messages connect to tickets, opportunities, and customer identities.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeyOS Mail Operations
|
|
7
|
+
|
|
8
|
+
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request crosses accounts, contacts, tickets, and messages. Read [references/workflows.md](references/workflows.md) for mail-specific correlation patterns.
|
|
9
|
+
|
|
10
|
+
Typical prompts:
|
|
11
|
+
|
|
12
|
+
- "Give me a summary of all recent mails from customer XYZ."
|
|
13
|
+
- "Which open tickets have unanswered customer emails?"
|
|
14
|
+
- "Draft a reply to the latest complaint from ACME."
|
|
15
|
+
- "Show me the conversation behind ticket 812."
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Resolve the business subject first:
|
|
20
|
+
- customer account
|
|
21
|
+
- contact or email address
|
|
22
|
+
- linked ticket or opportunity
|
|
23
|
+
2. Decide whether the user wants inbox analysis, thread reconstruction, or draft creation.
|
|
24
|
+
3. Query `messages` with a minimal field set first: sender, recipient, subject, date, mailbox, ticket, opportunity, reference, and message ID.
|
|
25
|
+
4. Pull message `text` only when you actually need a summary or draft context.
|
|
26
|
+
5. Group related mail using `reference`, `messageid`, and normalized subject.
|
|
27
|
+
6. If the request is about campaigns, mailing lists, participant coverage, or mailing performance, switch to `zeyos-campaign-and-outreach`.
|
|
28
|
+
7. Treat drafts as safe write targets. Treat sending as high risk and require explicit confirmation plus verified sender context.
|
|
29
|
+
8. Escalate to `@zeyos/client` when you need binary content, MIME expansion, or richer message correlation than the CLI can express cleanly.
|
|
30
|
+
|
|
31
|
+
## Output Discipline
|
|
32
|
+
|
|
33
|
+
- Report the resolved customer identity and the email addresses used for matching.
|
|
34
|
+
- Separate inbound, draft, and sent messages.
|
|
35
|
+
- Call out whether a thread match was direct by email address or inferred through ticket/opportunity context.
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Mail Operations Workflows
|
|
2
|
+
|
|
3
|
+
## Mailbox Values
|
|
4
|
+
|
|
5
|
+
- `0` = inbox
|
|
6
|
+
- `1` = drafts
|
|
7
|
+
- `2` = sent
|
|
8
|
+
- `5` = archive
|
|
9
|
+
- `6` = trash
|
|
10
|
+
- `7` = junk
|
|
11
|
+
|
|
12
|
+
## Key Constraint
|
|
13
|
+
|
|
14
|
+
The documented `messages` schema does not expose a direct `account` foreign key. Customer mail questions usually require one of these paths:
|
|
15
|
+
|
|
16
|
+
- resolve customer email addresses and match `sender_email` / `to_email`
|
|
17
|
+
- resolve linked tickets or opportunities and match `message.ticket` / `message.opportunity`
|
|
18
|
+
|
|
19
|
+
Mailing-list and campaign questions are different:
|
|
20
|
+
|
|
21
|
+
- `messages.mailinglist` links a message to a mailing list
|
|
22
|
+
- `mailingrecipients` links that message to `participants`
|
|
23
|
+
- deeper outreach analysis belongs in `zeyos-campaign-and-outreach`
|
|
24
|
+
|
|
25
|
+
## Pattern: Summarize Recent Mail From A Customer
|
|
26
|
+
|
|
27
|
+
Use this for prompts like:
|
|
28
|
+
|
|
29
|
+
- "Give me a summary of all recent mails from customer XYZ."
|
|
30
|
+
- "What has Acme sent us this week?"
|
|
31
|
+
|
|
32
|
+
Recommended approach:
|
|
33
|
+
|
|
34
|
+
1. Resolve the customer account.
|
|
35
|
+
2. Resolve related contacts and likely email addresses.
|
|
36
|
+
3. Query recent messages where `sender_email` or `to_email` matches those addresses.
|
|
37
|
+
4. Sort by descending `date`.
|
|
38
|
+
5. Pull `text` only for the matched subset you need to summarize.
|
|
39
|
+
6. Group by thread using `reference`, `messageid`, and subject.
|
|
40
|
+
|
|
41
|
+
Client example:
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
const recentMessages = await client.api.listMessages({
|
|
45
|
+
fields: ['ID', 'date', 'mailbox', 'subject', 'sender_email', 'to_email', 'ticket', 'reference', 'messageid', 'text'],
|
|
46
|
+
filters: {
|
|
47
|
+
sender_email: customerEmail,
|
|
48
|
+
date: { '>': cutoff },
|
|
49
|
+
},
|
|
50
|
+
sort: ['-date'],
|
|
51
|
+
limit: 100,
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
If more than one customer email exists, run one query per address or build a composite filter group.
|
|
56
|
+
|
|
57
|
+
## Pattern: Reconstruct A Thread
|
|
58
|
+
|
|
59
|
+
Use this for prompts like:
|
|
60
|
+
|
|
61
|
+
- "Show me the conversation behind ticket 812."
|
|
62
|
+
- "What happened in this email thread?"
|
|
63
|
+
|
|
64
|
+
Recommended approach:
|
|
65
|
+
|
|
66
|
+
1. Query messages linked to the ticket or opportunity if you have that ID.
|
|
67
|
+
2. Sort by ascending `date` for reading order.
|
|
68
|
+
3. Use `reference` and `messageid` to confirm direct reply relationships.
|
|
69
|
+
4. Use subject matching only as a fallback.
|
|
70
|
+
|
|
71
|
+
## Pattern: Find Unanswered Customer Mail
|
|
72
|
+
|
|
73
|
+
Use this for prompts like:
|
|
74
|
+
|
|
75
|
+
- "Which open tickets have unanswered customer emails?"
|
|
76
|
+
- "Show inbox messages from customers that still need a reply."
|
|
77
|
+
|
|
78
|
+
Recommended approach:
|
|
79
|
+
|
|
80
|
+
1. Start from recent inbox messages (`mailbox = 0`).
|
|
81
|
+
2. Limit to customer identities you can resolve through contacts or linked tickets.
|
|
82
|
+
3. Group by thread using `reference`, `messageid`, and subject.
|
|
83
|
+
4. Look for a later sent message (`mailbox = 2`) in the same thread.
|
|
84
|
+
5. Report unresolved threads and their linked tickets if available.
|
|
85
|
+
|
|
86
|
+
## Pattern: Draft A Reply
|
|
87
|
+
|
|
88
|
+
Use this for prompts like:
|
|
89
|
+
|
|
90
|
+
- "Draft a response to the latest mail from customer XYZ."
|
|
91
|
+
- "Prepare an answer but do not send it."
|
|
92
|
+
|
|
93
|
+
Recommended approach:
|
|
94
|
+
|
|
95
|
+
1. Summarize the relevant thread first.
|
|
96
|
+
2. Extract the action items, commitments, and unresolved questions.
|
|
97
|
+
3. Draft reply text separately from any ZeyOS mutation.
|
|
98
|
+
4. Create or update a draft message only if the user explicitly asks and the required sender context is known.
|
|
99
|
+
|
|
100
|
+
Important caveat:
|
|
101
|
+
|
|
102
|
+
- Creating a real draft may require more than subject and body. Inspect an existing draft or the instance-specific sending setup before writing message records.
|
|
103
|
+
- Never send email just because a user asked for a summary or a draft.
|
|
104
|
+
|
|
105
|
+
## Common Failure Modes
|
|
106
|
+
|
|
107
|
+
- Matching only on subject can merge unrelated threads.
|
|
108
|
+
- Matching only on company name misses messages from individual contacts.
|
|
109
|
+
- Messages may be linked to tickets or opportunities but not directly to accounts.
|
|
110
|
+
- Campaign mailings run through `mailinglists` and `mailingrecipients`, which is a different workflow from inbox thread analysis.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zeyos-notes-and-sops
|
|
3
|
+
description: Retrieve and summarize ZeyOS notes, SOPs, documents, and file-backed knowledge. Use when asked to find an internal procedure, summarize notes, locate the latest finalized operating document, inspect attachments, or explain whether knowledge lives in notes, documents, or files.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeyOS Notes And SOPs
|
|
7
|
+
|
|
8
|
+
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-map.md](../shared/zeyos-entity-map.md) when the request spans notes, documents, files, and related business records. Read [references/workflows.md](references/workflows.md) for knowledge-retrieval patterns.
|
|
9
|
+
|
|
10
|
+
Typical prompts:
|
|
11
|
+
|
|
12
|
+
- "Find the current escalation SOP for billing disputes."
|
|
13
|
+
- "Summarize our notes on failed invoice syncs."
|
|
14
|
+
- "Which finalized onboarding SOP changed last month?"
|
|
15
|
+
- "Which files are attached to this document?"
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Decide whether the user is asking for note text, a formal document, or an attachment.
|
|
20
|
+
2. Prefer `notes` when the question is about readable text.
|
|
21
|
+
3. Prefer `documents` when the question is about the official SOP artifact or finalized file.
|
|
22
|
+
4. Use `files` only when the request is explicitly about attachments or file inventory.
|
|
23
|
+
5. Prefer finalized material for SOP-style questions and say which status/date you used.
|
|
24
|
+
6. Do not claim to have read binary document content unless you actually fetched it through the appropriate path.
|
|
25
|
+
7. Present competing matches when names are similar or multiple revisions exist.
|
|
26
|
+
|
|
27
|
+
## Output Discipline
|
|
28
|
+
|
|
29
|
+
- State whether the answer came from a note, document, or attachment.
|
|
30
|
+
- Report the status and last-modified context for SOP-style answers.
|
|
31
|
+
- Call out when the documented schema does not expose direct business-record linkage.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Notes And SOP Workflows
|
|
2
|
+
|
|
3
|
+
## Resource Choice
|
|
4
|
+
|
|
5
|
+
Use `notes` when:
|
|
6
|
+
|
|
7
|
+
- the user wants text content to summarize
|
|
8
|
+
- the content is likely lightweight operational knowledge
|
|
9
|
+
|
|
10
|
+
Use `documents` when:
|
|
11
|
+
|
|
12
|
+
- the user wants the official or finalized SOP
|
|
13
|
+
- the artifact is file-like and may have filename or document number metadata
|
|
14
|
+
|
|
15
|
+
Use `files` when:
|
|
16
|
+
|
|
17
|
+
- the user asks for attachments
|
|
18
|
+
- you need to inspect what file objects are linked to a record or comment
|
|
19
|
+
|
|
20
|
+
## Pattern: Find The Current SOP
|
|
21
|
+
|
|
22
|
+
Use this for prompts like:
|
|
23
|
+
|
|
24
|
+
- "Find the current escalation SOP for billing disputes."
|
|
25
|
+
- "Which onboarding SOP is final right now?"
|
|
26
|
+
|
|
27
|
+
Recommended approach:
|
|
28
|
+
|
|
29
|
+
1. Search `documents` first with name- or filename-oriented filters plus final status where possible.
|
|
30
|
+
2. Search `notes` second if the SOP may live as text rather than a file artifact.
|
|
31
|
+
3. Prefer status `4` (`FINAL`) for both documents and notes when the user asks for the current or official process.
|
|
32
|
+
4. If multiple finals exist, sort by `lastmodified` and present the top candidates instead of guessing.
|
|
33
|
+
|
|
34
|
+
## Pattern: Summarize Internal Notes
|
|
35
|
+
|
|
36
|
+
Use this for prompts like:
|
|
37
|
+
|
|
38
|
+
- "Summarize the notes about the migration checklist."
|
|
39
|
+
- "What do our notes say about handling failed invoice syncs?"
|
|
40
|
+
|
|
41
|
+
Recommended approach:
|
|
42
|
+
|
|
43
|
+
1. Search `notes` by `name`, `assigneduser`, or broader text-oriented query terms.
|
|
44
|
+
2. Pull `text` only for the shortlisted notes.
|
|
45
|
+
3. Summarize common instructions, warnings, and unresolved items.
|
|
46
|
+
|
|
47
|
+
Important caveat:
|
|
48
|
+
|
|
49
|
+
- The documented note schema does not show direct account, project, or ticket foreign keys. Search may therefore be keyword-driven unless the instance stores those references in note names or text.
|
|
50
|
+
|
|
51
|
+
## Pattern: Retrieve A Formal File Or Attachment
|
|
52
|
+
|
|
53
|
+
Use this for prompts like:
|
|
54
|
+
|
|
55
|
+
- "Get me the attached SOP file."
|
|
56
|
+
- "Which files are attached to this record?"
|
|
57
|
+
|
|
58
|
+
Recommended approach:
|
|
59
|
+
|
|
60
|
+
1. Resolve the parent note, document, or record first.
|
|
61
|
+
2. Query `files` for attachments when the file inventory matters.
|
|
62
|
+
3. Escalate to `@zeyos/client` if you need binary expansion or file-body handling.
|
|
63
|
+
|
|
64
|
+
## Pattern: Compare Note Guidance Versus Formal SOP
|
|
65
|
+
|
|
66
|
+
Use this for prompts like:
|
|
67
|
+
|
|
68
|
+
- "Do our notes and the finalized SOP say the same thing?"
|
|
69
|
+
- "Is the current onboarding SOP aligned with the internal notes?"
|
|
70
|
+
|
|
71
|
+
Recommended approach:
|
|
72
|
+
|
|
73
|
+
1. Retrieve the likely final document candidate first.
|
|
74
|
+
2. Retrieve notes on the same topic second.
|
|
75
|
+
3. Compare:
|
|
76
|
+
- procedural steps
|
|
77
|
+
- warnings and exceptions
|
|
78
|
+
- revision freshness
|
|
79
|
+
4. Report conflicts explicitly instead of merging them into one synthetic answer.
|
|
80
|
+
|
|
81
|
+
## Common Failure Modes
|
|
82
|
+
|
|
83
|
+
- Claiming document text content without fetching the underlying binary.
|
|
84
|
+
- Mixing drafts, revisions, and finals into one answer without saying so.
|
|
85
|
+
- Assuming notes and documents have the same linkage model.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: zeyos-platform-and-schema
|
|
3
|
+
description: Inspect ZeyOS platform, schema, and admin-facing entities such as applications, resources, services, weblets, forks, groups, permissions, custom fields, custom objects, and generic record structures. Use when asked about application inventory, service hooks, UI modules, group permissions, custom schema, or how the extensibility model is wired.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ZeyOS Platform And Schema
|
|
7
|
+
|
|
8
|
+
Read [../shared/zeyos-query-patterns.md](../shared/zeyos-query-patterns.md) first. Read [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md) for the full source-backed model. Read [references/workflows.md](references/workflows.md) for platform/admin query plans.
|
|
9
|
+
|
|
10
|
+
Typical prompts:
|
|
11
|
+
|
|
12
|
+
- "Which custom fields exist on tickets?"
|
|
13
|
+
- "Which services run after ticket modification?"
|
|
14
|
+
- "Which groups grant access to application XYZ?"
|
|
15
|
+
- "Which weblets belong to application XYZ?"
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Decide whether the question is about:
|
|
20
|
+
- platform application inventory
|
|
21
|
+
- automation hooks and services
|
|
22
|
+
- UI surfaces and weblets
|
|
23
|
+
- access control
|
|
24
|
+
- schema extensibility
|
|
25
|
+
2. Resolve the application, group, entity, or custom field target first.
|
|
26
|
+
3. Use:
|
|
27
|
+
- `applications`, `resources`, `services`, `weblets`, `forks` for platform structure
|
|
28
|
+
- `groups`, `groups2users`, `permissions` for access control (`groups2users` -> `listGroupsToUsers` / `getGroupToUser`)
|
|
29
|
+
- `customfields`, `objects`, and extdata helper families for schema and custom data (`customfields` -> `listCustomFields`; `applicationassets` -> `listApplicationAssets`; these dbref nouns do not map naively — see [../shared/zeyos-entity-reference.md](../shared/zeyos-entity-reference.md#entity-noun-to-rest-operationid))
|
|
30
|
+
4. Treat `records`, `comments`, `files`, `channels`, `follows`, and `likes` as a collaboration layer. Switch to `zeyos-collaboration-and-activity` when the user asks for timeline or discussion behavior rather than platform structure.
|
|
31
|
+
5. Be explicit when the schema tells you structure but not the product convention.
|
|
32
|
+
|
|
33
|
+
## Output Discipline
|
|
34
|
+
|
|
35
|
+
- Separate confirmed schema facts from product-level inference.
|
|
36
|
+
- Report entity identifiers, activity states, and dependencies.
|
|
37
|
+
- Call out when a recommendation depends on instance-specific app conventions.
|