@zeyos/client 0.1.0 → 0.2.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 (32) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/README.md +21 -4
  3. package/agents/README.md +16 -6
  4. package/agents/shared/zeyos-agent-operating-guide.md +112 -0
  5. package/agents/shared/zeyos-query-patterns.md +12 -1
  6. package/agents/zeyos/SKILL.md +95 -0
  7. package/agents/zeyos-account-intelligence/SKILL.md +1 -1
  8. package/agents/zeyos-account-intelligence/references/workflows.md +7 -0
  9. package/agents/zeyos-billing-insights/SKILL.md +6 -1
  10. package/agents/zeyos-billing-insights/references/workflows.md +32 -3
  11. package/agents/zeyos-campaign-and-outreach/SKILL.md +1 -1
  12. package/agents/zeyos-campaign-and-outreach/references/workflows.md +8 -0
  13. package/agents/zeyos-collaboration-and-activity/SKILL.md +1 -1
  14. package/agents/zeyos-collaboration-and-activity/references/workflows.md +9 -0
  15. package/agents/zeyos-collections-and-dunning/SKILL.md +1 -1
  16. package/agents/zeyos-commerce-and-inventory/SKILL.md +1 -1
  17. package/agents/zeyos-commerce-and-inventory/references/workflows.md +7 -0
  18. package/agents/zeyos-mail-operations/SKILL.md +1 -1
  19. package/agents/zeyos-notes-and-sops/SKILL.md +1 -1
  20. package/agents/zeyos-platform-and-schema/SKILL.md +1 -1
  21. package/agents/zeyos-platform-and-schema/references/workflows.md +8 -0
  22. package/agents/zeyos-work-management/SKILL.md +1 -1
  23. package/docs/02-javascript-client/01-getting-started.md +15 -0
  24. package/docs/03-cli/01-getting-started.md +10 -2
  25. package/docs/03-cli/02-commands.md +58 -6
  26. package/docs/04-agent-workflows/01-agent-quickstart.md +2 -1
  27. package/docs/intro.md +1 -1
  28. package/package.json +9 -3
  29. package/samples/missioncontrol/README.md +106 -0
  30. package/samples/missioncontrol/fetch-data.mjs +341 -0
  31. package/samples/missioncontrol/index.html +419 -0
  32. package/src/runtime/client.js +27 -0
@@ -65,6 +65,21 @@ The returned `client` object exposes:
65
65
  - **`client.auth`** -- Token management (`getTokenSet`, `setTokenSet`, `clearTokenSet`)
66
66
  - **`client.metadata`** -- Read-only info about the generated client (`generatedAt` timestamp, `services` array)
67
67
 
68
+ Alongside the `createZeyosClient` factory, the package exports a few named helpers and error types you can import directly:
69
+
70
+ ```js
71
+ import {
72
+ createZeyosClient,
73
+ MemoryTokenStore, // in-memory token store (or implement get()/set() yourself)
74
+ ZeyosApiError, // thrown on non-2xx responses
75
+ ZeyosValidationError, // thrown by pre-flight validation (validate: true)
76
+ normalizeListResult, // normalise a list response to { data, count? }
77
+ normalizeCountResult, // normalise a count response to a number
78
+ normalizeTokenSet, // normalise a raw token object to a TokenSet
79
+ tokenResponseToTokenSet, // map an OAuth token response to a TokenSet
80
+ } from '@zeyos/client';
81
+ ```
82
+
68
83
  ## Platform Configuration
69
84
 
70
85
  The `platform` option tells the client where your ZeyOS instance lives. There are three ways to specify it:
@@ -118,11 +118,12 @@ zeyos describe accounts --json
118
118
 
119
119
  ## Install Agent Skills
120
120
 
121
- If you are driving the CLI from a coding agent (Claude, Codex, …), install the bundled ZeyOS skill packs into your project so the agent picks up the right query conventions:
121
+ If you are driving the CLI from a coding agent (Claude Code, Codex, opencode, Factory Droid, pi, …), install the bundled ZeyOS skill packs so the agent picks up the right query conventions:
122
122
 
123
123
  ```bash
124
124
  zeyos skills list # see the available skills
125
- zeyos skills install # copy them into .claude/skills (or .codex)
125
+ zeyos skills install # interactive: pick an agent, then local vs. global
126
+ zeyos skills install --target claude --global # or skip the prompts with flags
126
127
  ```
127
128
 
128
129
  See the [Commands Reference](./02-commands.md#skills) for details.
@@ -142,6 +143,13 @@ zeyos list tickets --filter '{"status":1,"priority":3}'
142
143
  zeyos count tickets --filter '{"status":1}'
143
144
  ```
144
145
 
146
+ For larger filters, store the JSON in a file and use `--filter-file`:
147
+
148
+ ```bash
149
+ zeyos list tickets --filter-file ./filters/open-tickets.json --json
150
+ zeyos count tickets --filter-file ./filters/open-tickets.json --json
151
+ ```
152
+
145
153
  For normal operational views, include `visibility: 0`:
146
154
 
147
155
  ```bash
@@ -113,6 +113,7 @@ zeyos list <resource> [options]
113
113
  |--------|-------------|
114
114
  | `--fields <fields>` | Field selection — comma-separated, JSON object, or JSON array (see below) |
115
115
  | `--filter <json>` | Filter criteria — JSON object |
116
+ | `--filter-file <path>` | Read filter criteria from a JSON file |
116
117
  | `--sort <fields>` | Sort fields, comma-separated (prefix `+` asc, `-` desc) |
117
118
  | `--limit <n>` | Maximum records to return (default: `50`) |
118
119
  | `--offset <n>` | Skip the first n records |
@@ -140,6 +141,9 @@ zeyos list tickets
140
141
  # Custom filters
141
142
  zeyos list tickets --filter '{"status":1,"priority":3}'
142
143
 
144
+ # Custom filters from a file
145
+ zeyos list tickets --filter-file ./filters/open-tickets.json
146
+
143
147
  # Specify fields with aliases
144
148
  zeyos list accounts --fields '{"Name":"lastname","City":"contact.city"}'
145
149
 
@@ -179,6 +183,7 @@ zeyos count <resource> [options]
179
183
  | Option | Description |
180
184
  |--------|-------------|
181
185
  | `--filter <json>` | Filter criteria — JSON object |
186
+ | `--filter-file <path>` | Read filter criteria from a JSON file |
182
187
  | `--json` | Output as `{"count": N}` |
183
188
  | `--yaml` | YAML output |
184
189
 
@@ -193,6 +198,9 @@ zeyos count tickets
193
198
  zeyos count tickets --filter '{"status":1}'
194
199
  # → 12
195
200
 
201
+ # Filtered count using a JSON file
202
+ zeyos count tickets --filter-file ./filters/open-tickets.json
203
+
196
204
  # JSON output for scripting
197
205
  zeyos count accounts --json
198
206
  # → {"count": 156}
@@ -261,6 +269,7 @@ zeyos create <resource> [--data <json>] [--field value ...]
261
269
  | Option | Description |
262
270
  |--------|-------------|
263
271
  | `--data <json>` | Complete record as a JSON string |
272
+ | `--data-file <path>` | Read the complete record from a JSON file |
264
273
  | `--<field> <value>` | Set individual field (any unknown flag becomes a field) |
265
274
 
266
275
  **Examples:**
@@ -269,6 +278,9 @@ zeyos create <resource> [--data <json>] [--field value ...]
269
278
  # Using --data JSON
270
279
  zeyos create ticket --data '{"name":"Fix login bug","status":0,"priority":3}'
271
280
 
281
+ # Using a JSON file
282
+ zeyos create ticket --data-file ./ticket.json
283
+
272
284
  # Using individual field flags
273
285
  zeyos create ticket --name "Fix login bug" --status 0 --priority 3
274
286
 
@@ -301,6 +313,9 @@ zeyos update <resource> <id> [--data <json>] [--field value ...]
301
313
  # Using --data JSON
302
314
  zeyos update ticket 42 --data '{"status":4}'
303
315
 
316
+ # Using a JSON file
317
+ zeyos update ticket 42 --data-file ./ticket-update.json
318
+
304
319
  # Using field flags
305
320
  zeyos update ticket 42 --status 4 --priority 2
306
321
 
@@ -368,9 +383,22 @@ Foreign keys are shown as `→ <table>`, and enum fields list their valid values
368
383
 
369
384
  ---
370
385
 
386
+ ## doctor
387
+
388
+ Check local CLI readiness for coding agents. This runs offline and never prints tokens or client secrets.
389
+
390
+ ```bash
391
+ zeyos doctor agent
392
+ zeyos doctor agent --json
393
+ ```
394
+
395
+ The report includes the CLI version, configured base URL and instance, whether auth values are present through environment/local/global config, and whether the curated resource registry can be loaded.
396
+
397
+ ---
398
+
371
399
  ## skills
372
400
 
373
- Discover and install the bundled ZeyOS agent skill packs into the local project, so a coding agent (Claude, Codex, …) operates against ZeyOS with the right conventions out of the box.
401
+ Discover and install the bundled ZeyOS agent skill packs into any coding agent, so the agent (Claude Code, Codex, opencode, Factory Droid, pi, …) operates against ZeyOS with the right conventions out of the box.
374
402
 
375
403
  ```
376
404
  # List the bundled skills
@@ -379,19 +407,43 @@ zeyos skills list
379
407
  # Print a skill's instructions
380
408
  zeyos skills show zeyos-work-management
381
409
 
382
- # Install all skills (or named ones) into the project
410
+ # Install interactive: pick a coding agent, then local vs. global
383
411
  zeyos skills install
384
- zeyos skills install zeyos-billing-insights --target claude
412
+
413
+ # Install non-interactively with flags
414
+ zeyos skills install --target claude --global # all projects
415
+ zeyos skills install --target opencode --local # this project only
416
+ zeyos skills install zeyos-billing-insights -y # one skill, defaults
417
+ zeyos skills install --dir ./vendor/skills # any directory
385
418
  ```
386
419
 
420
+ Run bare, `install` prints the ZeyOS banner and prompts for **(a)** which coding agent to target and **(b)** whether to install for this project or globally for every project. Pass `--target` and/or `--global`/`--local` to skip the matching prompt; pass `-y`/`--yes` (or pipe non-interactively) to skip all prompts and use flags plus sensible defaults.
421
+
387
422
  Options for `install`:
388
423
 
389
424
  | Option | Description |
390
425
  |--------|-------------|
391
- | `--target claude\|codex` | Where to install (default: auto-detect, fallback `.claude/skills`) |
426
+ | `--target <agent>` | Coding agent: `claude`, `codex`, `opencode`, `droid`, `pi`, `agents` (prompted when omitted; otherwise auto-detected) |
427
+ | `--global` | Install into the agent's home directory (all projects) |
428
+ | `--local` | Install into the current project (default) |
429
+ | `--dir <path>` | Install into an explicit directory (overrides `--target`) |
392
430
  | `--force` | Overwrite existing skill folders |
393
-
394
- Skills are copied into `<target>/skills/<name>/`, with the shared reference files installed alongside (`<target>/skills/shared/`) so the skills' `../shared/…` links resolve.
431
+ | `-y`, `--yes` | Skip prompts and use flags / sensible defaults |
432
+ | `--no-logo` | Don't print the ZeyOS banner |
433
+ | `--json` / `--yaml` | Print a machine-readable install summary (also silences the banner) |
434
+
435
+ Per-agent skill directories:
436
+
437
+ | Agent | `--local` | `--global` |
438
+ |-------|-----------|------------|
439
+ | `claude` | `.claude/skills/` | `~/.claude/skills/` |
440
+ | `codex` | `.codex/skills/` | `~/.codex/skills/` |
441
+ | `opencode` | `.opencode/skills/` | `~/.config/opencode/skills/` |
442
+ | `droid` | `.factory/skills/` | `~/.factory/skills/` |
443
+ | `pi` | `.pi/skills/` | `~/.pi/agent/skills/` |
444
+ | `agents` | `.agents/skills/` | `~/.agents/skills/` |
445
+
446
+ Skills are copied into `<dir>/<name>/`, with the shared reference files installed alongside (`<dir>/shared/`) so the skills' `../shared/…` links resolve.
395
447
 
396
448
  ---
397
449
 
@@ -29,7 +29,8 @@ Before doing real work, install the bundled skill packs so the agent picks up Ze
29
29
 
30
30
  ```bash
31
31
  zeyos skills list # see what's available
32
- zeyos skills install # install all into .claude/skills (or .codex)
32
+ zeyos skills install # interactive: pick an agent (claude, codex, opencode, droid, pi…), then local/global
33
+ zeyos skills install --target claude --global -y # or non-interactively with flags
33
34
  ```
34
35
 
35
36
  This is the recommended entry point for an agent: the skills encode how to resolve names to IDs, which resource to query first, and how to escalate from the CLI to `@zeyos/client`.
package/docs/intro.md CHANGED
@@ -88,7 +88,7 @@ Across the CLI, JavaScript client, and sample applications, the same operational
88
88
 
89
89
  - Prefer `filters` in JavaScript client code for compatibility across scalar and foreign-key fields.
90
90
  - Include `visibility: 0` unless you intentionally want archived or deleted records.
91
- - Use an explicit `body` object for updates that also pass a path parameter such as `ID`.
91
+ - For updates, pass changed fields alongside the `ID` directly (`{ ID, status }`) or wrap them in an explicit `body` object (`{ ID, body: { status } }`) — both work; the explicit `body` is only needed to disambiguate a payload field that collides with a reserved control key.
92
92
  - Treat `extdata` and `expand` as separate features:
93
93
  - `extdata` includes custom fields
94
94
  - `expand` inlines JSON or binary columns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeyos/client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Dependency-light JavaScript client for ZeyOS OpenAPI services",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -31,7 +31,12 @@
31
31
  "scripts/generate-client.mjs",
32
32
  "openapi",
33
33
  "docs",
34
- "samples",
34
+ "samples/crm",
35
+ "samples/dashboard",
36
+ "samples/kanban",
37
+ "samples/missioncontrol/README.md",
38
+ "samples/missioncontrol/fetch-data.mjs",
39
+ "samples/missioncontrol/index.html",
35
40
  "agents",
36
41
  "README.md",
37
42
  "CHANGELOG.md",
@@ -44,6 +49,7 @@
44
49
  "generate": "node scripts/generate-client.mjs",
45
50
  "test": "node scripts/test.mjs",
46
51
  "test:cli-integration": "node --test cli/test/integration.mjs",
47
- "test:agent-protocol": "node test/agent-protocol/harness/run.mjs"
52
+ "test:agent-protocol": "node test/agent-protocol/harness/run.mjs",
53
+ "test:agent-loop": "node test/agent-protocol/harness/loop.mjs"
48
54
  }
49
55
  }
@@ -0,0 +1,106 @@
1
+ # Mission Control
2
+
3
+ A team-performance dashboard for an IT consultancy running on ZeyOS — built on
4
+ the [`@zeyos/client`](../../README.md) library. It answers the managing
5
+ director's question: **who is actually working, and where is there untapped
6
+ capacity?**
7
+
8
+ A dark "mission control" view: a velocity KPI row, a 13-week throughput trend,
9
+ a team-capacity strip, and a searchable/sortable/filterable grid of per-employee
10
+ activity cards (click one for a per-type digest + contribution graph).
11
+
12
+ ## What it shows
13
+
14
+ 1. **Velocity** — tickets opened vs closed in the window, net flow, average /
15
+ median / p90 **cycle time** (open → close), open backlog (with overdue), and
16
+ total **hours booked**. A 13-week **throughput trend** of opened vs closed.
17
+ 2. **Activity card per employee** — open tickets, open tasks, tickets closed,
18
+ hours booked, a weekly-hours sparkline, team/location tags, a **capacity
19
+ badge** (Overloaded / Balanced / Available / Idle / Former), and **last
20
+ activity** (the most recent time entry) — flagged red when it's **older than
21
+ 7 days**. Hover "last activity" to see the engineer's **last 10 time entries**
22
+ (date · type · customer · ticket · hours).
23
+ 3. **Per-employee digest** (click a card) — **booked hours stacked by
24
+ `extdata.type`** (Weekly / Monthly), and a **GitHub-style contribution graph**
25
+ of their time-entry activity over the last 53 weeks.
26
+
27
+ Filters: search by name, **filter by team / department / location** (group
28
+ membership), capacity chips (Engaged / Spare capacity / Inactive >7d /
29
+ Overloaded / All), and sort by activity, hours, throughput, workload, cycle,
30
+ overdue, or least-recent.
31
+
32
+ The **Team capacity** strip and the *Spare capacity* filter surface the
33
+ "untapped resources": active engineers running light or with no load at all,
34
+ contrasted with the overloaded ones — the clearest place to rebalance work.
35
+
36
+ ## Run it
37
+
38
+ ```bash
39
+ # 1. Authenticate once (if you haven't already)
40
+ zeyos login --base-url https://zeyos.cms-it.de/dev
41
+
42
+ # 2. Pull live data into data.js (read-only; reuses your CLI credentials)
43
+ node samples/missioncontrol/fetch-data.mjs # 90-day window
44
+ node samples/missioncontrol/fetch-data.mjs --days 180 # custom window
45
+
46
+ # 3. Open the dashboard
47
+ # Either open index.html directly, or serve the folder:
48
+ python3 -m http.server 8765 --directory samples/missioncontrol
49
+ # → http://localhost:8765
50
+ ```
51
+
52
+ `fetch-data.mjs` writes `data.js` (a `window.MISSION_DATA = …` assignment) so
53
+ `index.html` works straight from disk — no server, no CORS, no token pasting.
54
+ Re-run the fetcher to refresh; the page is otherwise a static, dependency-free
55
+ single file (hand-rolled CSS + inline-SVG charts).
56
+
57
+ ## How it works
58
+
59
+ `fetch-data.mjs` reads the credentials `zeyos login` stored
60
+ (`.zeyos/auth.json` or `~/.config/zeyos/credentials.json`), builds an
61
+ auto-refreshing client with `createZeyosClient`, and issues a handful of
62
+ **read-only** `list` queries (tickets, `actionsteps`, tasks, groups), then
63
+ aggregates them client-side (ZeyOS has no server-side group-by). It never writes
64
+ to ZeyOS.
65
+
66
+ ### Metric definitions (so the numbers are reproducible)
67
+
68
+ | Metric | Definition |
69
+ |--------|------------|
70
+ | **Time entry** | an `actionsteps` row with `status IN [1, 3]` (COMPLETED + BOOKED), attributed to an engineer via **`assigneduser`** (`owneruser` is unused here). `effort` is in **minutes**. |
71
+ | **Last activity** | the engineer's most recent time-entry `date`; **stale** (red ⚠) when it's >7 days before the "as of" date. |
72
+ | **Type** | `extdata.type` of each time entry (Intern / Auftrag / Consulting / Wartung / …), selected on `list` via the `extdata.type` field. Top 6 are charted; the rest roll into *Other*. |
73
+ | **Closed / done** | tickets with `status IN [9, 11]` — COMPLETED + BOOKED (BOOKED, completed & billed, is the dominant terminal state). |
74
+ | **Open backlog** | `status IN [0, 1, 2, 4, 6, 7]` — started/accepted/active but not done. |
75
+ | **Opened in window** | tickets whose indexed `date` falls in the window. |
76
+ | **Cycle time** | `lastmodified − creationdate` for tickets closed in the window (a proxy for the close timestamp, which ZeyOS does not store separately). |
77
+ | **Capacity** | relative to the engaged-and-active cohort: *overloaded* (top-quintile workload or ≥3 overdue), *available* (low workload **and** below-median throughput), *idle* (active user, zero load), *balanced* (else), *former* (deactivated user with leftover assignments). |
78
+ | **Team / location** | the engineer's **group memberships** (see below). |
79
+
80
+ ### Notes & limitations
81
+
82
+ - **Department/location = groups.** ZeyOS *defines* custom fields
83
+ `users.department`/`users.location`/`users.team`, but the API returns
84
+ *"Extension data not available for users"* — they can't be read. The org
85
+ structure instead lives in **group membership** (e.g. `Developers`,
86
+ `Services`, `Technik`, `Berlin`, `Bayern`, `Nordrhein-Westfalen`), which is
87
+ what the team/location filter uses.
88
+ - **`extdata` only lists via dot-fields.** Custom fields aren't returned by a
89
+ plain `list` (or `extdata=1`); they must be selected explicitly, e.g.
90
+ `fields: ['…','extdata.type']` (returned as `extdata_type`). On single records
91
+ `getTicket(…, { query:{ extdata:1 } })` returns them under an `extdata` object.
92
+ - **Corrupt time-entry dates.** Many `actionsteps` have far-future `date` values
93
+ (year 2099+); the fetcher bounds queries to `date ≤ now` to exclude them.
94
+ - **"As of" anchoring.** Windows are measured back from the latest activity in
95
+ the data, not wall-clock today — so a frozen/dev snapshot still produces
96
+ meaningful windows (and the 7-day staleness check is relative to it). The
97
+ anchor date is shown in the header.
98
+ - **`date`, not `creationdate`, for windows.** `creationdate`/`lastmodified` are
99
+ unindexed on `tickets`; range-scanning them can time out (HTTP 503). The
100
+ indexed `date` column is used for opened-in-window queries.
101
+ - **Roles aren't distinguished.** Every active user is included; a salesperson
102
+ with no tickets shows as *Idle*. Use the team filter / search to focus on a
103
+ delivery team.
104
+
105
+ > `data.js` / `data.json` are generated and contain real names from your
106
+ > instance — they are git-ignored. Commit only the source.