@docyrus/docyrus 0.0.19 → 0.0.21

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 (111) hide show
  1. package/agent-loader.js +37 -3
  2. package/agent-loader.js.map +2 -2
  3. package/main.js +498 -93
  4. package/main.js.map +4 -4
  5. package/package.json +14 -4
  6. package/resources/chrome-tools/browser-content.js +103 -0
  7. package/resources/chrome-tools/browser-cookies.js +35 -0
  8. package/resources/chrome-tools/browser-eval.js +53 -0
  9. package/resources/chrome-tools/browser-hn-scraper.js +108 -0
  10. package/resources/chrome-tools/browser-nav.js +44 -0
  11. package/resources/chrome-tools/browser-pick.js +162 -0
  12. package/resources/chrome-tools/browser-screenshot.js +34 -0
  13. package/resources/chrome-tools/browser-start.js +86 -0
  14. package/resources/pi-agent/extensions/answer.ts +532 -0
  15. package/resources/pi-agent/extensions/context.ts +578 -0
  16. package/resources/pi-agent/extensions/control.ts +1779 -0
  17. package/resources/pi-agent/extensions/diff.ts +218 -0
  18. package/resources/pi-agent/extensions/files.ts +199 -0
  19. package/resources/pi-agent/extensions/loop.ts +446 -0
  20. package/resources/pi-agent/extensions/multi-edit.ts +835 -0
  21. package/resources/pi-agent/extensions/notify.ts +88 -0
  22. package/resources/pi-agent/extensions/pi-mcp-adapter/CHANGELOG.md +192 -0
  23. package/resources/pi-agent/extensions/pi-mcp-adapter/LICENSE +21 -0
  24. package/resources/pi-agent/extensions/pi-mcp-adapter/README.md +296 -0
  25. package/resources/pi-agent/extensions/pi-mcp-adapter/app-bridge.bundle.js +67 -0
  26. package/resources/pi-agent/extensions/pi-mcp-adapter/cli.js +108 -0
  27. package/resources/pi-agent/extensions/pi-mcp-adapter/commands.ts +211 -0
  28. package/resources/pi-agent/extensions/pi-mcp-adapter/config.ts +227 -0
  29. package/resources/pi-agent/extensions/pi-mcp-adapter/consent-manager.ts +64 -0
  30. package/resources/pi-agent/extensions/pi-mcp-adapter/direct-tools.ts +301 -0
  31. package/resources/pi-agent/extensions/pi-mcp-adapter/errors.ts +219 -0
  32. package/resources/pi-agent/extensions/pi-mcp-adapter/glimpse-ui.ts +80 -0
  33. package/resources/pi-agent/extensions/pi-mcp-adapter/host-html-template.ts +427 -0
  34. package/resources/pi-agent/extensions/pi-mcp-adapter/index.ts +232 -0
  35. package/resources/pi-agent/extensions/pi-mcp-adapter/init.ts +319 -0
  36. package/resources/pi-agent/extensions/pi-mcp-adapter/lifecycle.ts +93 -0
  37. package/resources/pi-agent/extensions/pi-mcp-adapter/logger.ts +169 -0
  38. package/resources/pi-agent/extensions/pi-mcp-adapter/mcp-panel.ts +713 -0
  39. package/resources/pi-agent/extensions/pi-mcp-adapter/metadata-cache.ts +191 -0
  40. package/resources/pi-agent/extensions/pi-mcp-adapter/npx-resolver.ts +419 -0
  41. package/resources/pi-agent/extensions/pi-mcp-adapter/oauth-handler.ts +56 -0
  42. package/resources/pi-agent/extensions/pi-mcp-adapter/package.json +85 -0
  43. package/resources/pi-agent/extensions/pi-mcp-adapter/paths.ts +29 -0
  44. package/resources/pi-agent/extensions/pi-mcp-adapter/proxy-modes.ts +635 -0
  45. package/resources/pi-agent/extensions/pi-mcp-adapter/resource-tools.ts +17 -0
  46. package/resources/pi-agent/extensions/pi-mcp-adapter/server-manager.ts +330 -0
  47. package/resources/pi-agent/extensions/pi-mcp-adapter/state.ts +41 -0
  48. package/resources/pi-agent/extensions/pi-mcp-adapter/tool-metadata.ts +144 -0
  49. package/resources/pi-agent/extensions/pi-mcp-adapter/tool-registrar.ts +46 -0
  50. package/resources/pi-agent/extensions/pi-mcp-adapter/types.ts +367 -0
  51. package/resources/pi-agent/extensions/pi-mcp-adapter/ui-resource-handler.ts +145 -0
  52. package/resources/pi-agent/extensions/pi-mcp-adapter/ui-server.ts +623 -0
  53. package/resources/pi-agent/extensions/pi-mcp-adapter/ui-session.ts +384 -0
  54. package/resources/pi-agent/extensions/pi-mcp-adapter/ui-stream-types.ts +89 -0
  55. package/resources/pi-agent/extensions/pi-mcp-adapter/utils.ts +75 -0
  56. package/resources/pi-agent/extensions/prompt-editor.ts +1315 -0
  57. package/resources/pi-agent/extensions/prompt-url-widget.ts +158 -0
  58. package/resources/pi-agent/extensions/redraws.ts +24 -0
  59. package/resources/pi-agent/extensions/review.ts +2160 -0
  60. package/resources/pi-agent/extensions/todos.ts +2076 -0
  61. package/resources/pi-agent/extensions/tps.ts +47 -0
  62. package/resources/pi-agent/extensions/whimsical.ts +474 -0
  63. package/resources/pi-agent/prompts/coder-system.md +106 -0
  64. package/resources/pi-agent/skills/changelog-generator/SKILL.md +425 -0
  65. package/resources/pi-agent/skills/docyrus-chrome-devtools-cli/SKILL.md +80 -0
  66. package/resources/pi-agent/skills/docyrus-platform/SKILL.md +71 -0
  67. package/resources/pi-agent/skills/docyrus-platform/references/ai-capabilities.md +43 -0
  68. package/resources/pi-agent/skills/docyrus-platform/references/auth-and-multi-tenancy.md +35 -0
  69. package/resources/pi-agent/skills/docyrus-platform/references/automation-and-workflows.md +30 -0
  70. package/resources/pi-agent/skills/docyrus-platform/references/core-building-blocks.md +53 -0
  71. package/resources/pi-agent/skills/{docyrus-api-dev → docyrus-platform}/references/data-source-query-guide.md +32 -28
  72. package/resources/pi-agent/skills/docyrus-platform/references/developer-tools.md +28 -0
  73. package/resources/pi-agent/skills/docyrus-platform/references/docyrus-cli-usage.md +554 -0
  74. package/resources/pi-agent/skills/{docyrus-api-dev → docyrus-platform}/references/formula-design-guide-llm.md +15 -23
  75. package/resources/pi-agent/skills/docyrus-platform/references/integrations-and-events.md +60 -0
  76. package/resources/pi-agent/skills/docyrus-platform/references/platform-services.md +58 -0
  77. package/resources/pi-agent/skills/docyrus-platform/references/querying-and-data-operations.md +27 -0
  78. package/resources/pi-agent/prompts/coder-append-system.md +0 -19
  79. package/resources/pi-agent/skills/docyrus-ai/SKILL.md +0 -28
  80. package/resources/pi-agent/skills/docyrus-api-dev/SKILL.md +0 -161
  81. package/resources/pi-agent/skills/docyrus-api-dev/references/api-client.md +0 -349
  82. package/resources/pi-agent/skills/docyrus-api-dev/references/authentication.md +0 -238
  83. package/resources/pi-agent/skills/docyrus-api-dev/references/query-and-formulas.md +0 -592
  84. package/resources/pi-agent/skills/docyrus-api-doctor/SKILL.md +0 -70
  85. package/resources/pi-agent/skills/docyrus-api-doctor/references/checklist-details.md +0 -588
  86. package/resources/pi-agent/skills/docyrus-app-dev/SKILL.md +0 -159
  87. package/resources/pi-agent/skills/docyrus-app-dev/references/api-client-and-auth.md +0 -275
  88. package/resources/pi-agent/skills/docyrus-app-dev/references/collections-and-patterns.md +0 -352
  89. package/resources/pi-agent/skills/docyrus-app-dev/references/data-source-query-guide.md +0 -2059
  90. package/resources/pi-agent/skills/docyrus-app-dev/references/formula-design-guide-llm.md +0 -320
  91. package/resources/pi-agent/skills/docyrus-app-dev/references/query-guide.md +0 -525
  92. package/resources/pi-agent/skills/docyrus-app-ui-design/SKILL.md +0 -466
  93. package/resources/pi-agent/skills/docyrus-app-ui-design/references/component-selection-guide.md +0 -602
  94. package/resources/pi-agent/skills/docyrus-app-ui-design/references/icon-usage-guide.md +0 -463
  95. package/resources/pi-agent/skills/docyrus-app-ui-design/references/preferred-components-catalog.md +0 -242
  96. package/resources/pi-agent/skills/docyrus-apps/SKILL.md +0 -54
  97. package/resources/pi-agent/skills/docyrus-architect/SKILL.md +0 -174
  98. package/resources/pi-agent/skills/docyrus-architect/references/custom-query-guide.md +0 -410
  99. package/resources/pi-agent/skills/docyrus-architect/references/data-source-query-guide.md +0 -2059
  100. package/resources/pi-agent/skills/docyrus-architect/references/formula-design-guide-llm.md +0 -320
  101. package/resources/pi-agent/skills/docyrus-architect/references/formula-reference.md +0 -145
  102. package/resources/pi-agent/skills/docyrus-auth/SKILL.md +0 -100
  103. package/resources/pi-agent/skills/docyrus-cli-app/SKILL.md +0 -279
  104. package/resources/pi-agent/skills/docyrus-cli-app/references/cli-manifest.md +0 -532
  105. package/resources/pi-agent/skills/docyrus-cli-app/references/list-query-examples.md +0 -248
  106. package/resources/pi-agent/skills/docyrus-curl/SKILL.md +0 -32
  107. package/resources/pi-agent/skills/docyrus-discover/SKILL.md +0 -63
  108. package/resources/pi-agent/skills/docyrus-ds/SKILL.md +0 -95
  109. package/resources/pi-agent/skills/docyrus-env/SKILL.md +0 -21
  110. package/resources/pi-agent/skills/docyrus-studio/SKILL.md +0 -369
  111. package/resources/pi-agent/skills/docyrus-tui/SKILL.md +0 -15
@@ -1,410 +0,0 @@
1
- # Custom Query MCP Tools Guide
2
-
3
- Reference for managing and executing custom queries through Docyrus Architect MCP tools.
4
-
5
- Custom queries are saved SQL templates (stored per tenant) that support Handlebars templating and runtime filters.
6
-
7
- ---
8
-
9
- ## Table of Contents
10
-
11
- 1. [Overview](#overview)
12
- 2. [Tools Summary](#tools-summary)
13
- 3. [Custom Query Structure](#custom-query-structure)
14
- 4. [Handlebars Templating](#handlebars-templating)
15
- 5. [Tool Reference](#tool-reference)
16
- 6. [Filter Definitions](#filter-definitions)
17
- 7. [Runtime Filters](#runtime-filters)
18
- 8. [Simulation Mode](#simulation-mode)
19
- 9. [Complete Examples](#complete-examples)
20
-
21
- ---
22
-
23
- ## Overview
24
-
25
- The custom query toolset supports full lifecycle operations and execution:
26
-
27
- - CRUD operations: list, get, create, update, delete
28
- - Execution: run with runtime filters, pagination offset, and simulate mode
29
-
30
- Use these tools when a user wants reusable SQL reports, dashboards, or advanced analysis that is difficult to express with `query_data_source` alone.
31
-
32
- ---
33
-
34
- ## Tools Summary
35
-
36
- | Tool | Description | Read-Only | Destructive |
37
- |---|---|---|---|
38
- | `get_custom_queries` | List all non-archived custom queries | Yes | No |
39
- | `get_custom_query_by_id` | Get full details of a custom query | Yes | No |
40
- | `create_custom_query` | Create a new custom query | No | No |
41
- | `update_custom_query` | Update an existing custom query | No | No |
42
- | `delete_custom_query` | Soft-delete (archive) a custom query | No | Yes |
43
- | `run_custom_query` | Execute a custom query | Yes | No |
44
-
45
- ---
46
-
47
- ## Custom Query Structure
48
-
49
- | Property | Type | Required | Description |
50
- |---|---|---|---|
51
- | `name` | `string` | Yes | Display name |
52
- | `description` | `string \| null` | No | Human-readable description |
53
- | `query` | `string` | Yes | SQL template with Handlebars syntax |
54
- | `filters` | `array \| null` | No | Filter field definitions for runtime filtering |
55
-
56
- ---
57
-
58
- ## Handlebars Templating
59
-
60
- Custom query SQL templates can use runtime variables and helper functions.
61
-
62
- ### Available Template Variables
63
-
64
- | Variable | Description |
65
- |---|---|
66
- | `{{TENANT_ID}}` | Current tenant UUID |
67
- | `{{TENANT_SCHEMA}}` | Tenant schema name (for table references) |
68
- | `{{USER_ID}}` | Current user UUID |
69
- | `{{USER_EMAIL}}` | Current user email |
70
- | `{{USER_FIRSTNAME}}` | Current user first name |
71
- | `{{USER_LASTNAME}}` | Current user last name |
72
- | `{{USER_FULLNAME}}` | Current user full name |
73
-
74
- ### `filter` Helper
75
-
76
- Use the helper to convert runtime filter rules into SQL predicates.
77
-
78
- Syntax:
79
-
80
- ```handlebars
81
- {{filter FILTERS.field_slug column_expression}}
82
- ```
83
-
84
- - `FILTERS.field_slug`: filter slug declared in custom query `filters`
85
- - `column_expression`: SQL expression to filter
86
-
87
- Example:
88
-
89
- ```sql
90
- SELECT id, name, amount, created_on
91
- FROM {{TENANT_SCHEMA}}.crm_account
92
- WHERE tenant_id = '{{TENANT_ID}}'
93
- AND {{filter FILTERS.status status}}
94
- AND {{filter FILTERS.created_on created_on}}
95
- AND {{filter FILTERS.amount (crm_account."data"->>'0192919d-c16d-7c8b-848e-6069d3205395')::numeric}}
96
- ```
97
-
98
- If no runtime value is provided for a rule, the helper resolves to `1=1` so the filter stays optional.
99
-
100
- ### JSONB Data Field Expressions
101
-
102
- For simple data sources using JSONB custom fields:
103
-
104
- ```sql
105
- (table_alias."data"->>'field-uuid')::type
106
- ```
107
-
108
- ---
109
-
110
- ## Tool Reference
111
-
112
- ### `get_custom_queries`
113
-
114
- List all non-archived custom queries for the current tenant.
115
-
116
- Input: none
117
-
118
- Output shape:
119
-
120
- ```json
121
- {
122
- "queries": [
123
- {
124
- "id": "uuid-string",
125
- "name": "Monthly Sales Report",
126
- "description": "Aggregated sales by month and category"
127
- }
128
- ]
129
- }
130
- ```
131
-
132
- ### `get_custom_query_by_id`
133
-
134
- Get full definition of one query.
135
-
136
- Input:
137
-
138
- | Parameter | Type | Required | Description |
139
- |---|---|---|---|
140
- | `queryId` | `string` | Yes | Query UUID |
141
-
142
- Output shape:
143
-
144
- ```json
145
- {
146
- "id": "uuid-string",
147
- "name": "Monthly Sales Report",
148
- "description": "Aggregated sales by month and category",
149
- "query": "SELECT ... FROM {{TENANT_SCHEMA}}.shop_order WHERE ...",
150
- "filters": []
151
- }
152
- ```
153
-
154
- ### `create_custom_query`
155
-
156
- Create a new custom query template.
157
-
158
- Input:
159
-
160
- | Parameter | Type | Required | Description |
161
- |---|---|---|---|
162
- | `name` | `string` | Yes | Display name |
163
- | `description` | `string \| null` | No | Description |
164
- | `query` | `string` | Yes | SQL template with Handlebars syntax |
165
- | `filters` | `array \| null` | No | Filter field definitions |
166
-
167
- Output shape:
168
-
169
- ```json
170
- {
171
- "id": "newly-created-uuid",
172
- "name": "Monthly Sales Report"
173
- }
174
- ```
175
-
176
- ### `update_custom_query`
177
-
178
- Update an existing custom query. Omitted fields are unchanged.
179
-
180
- Input:
181
-
182
- | Parameter | Type | Required | Description |
183
- |---|---|---|---|
184
- | `queryId` | `string` | Yes | Query UUID |
185
- | `name` | `string \| null` | No | New name |
186
- | `description` | `string \| null` | No | New description |
187
- | `query` | `string \| null` | No | New SQL template |
188
- | `filters` | `array \| null` | No | New filter definitions |
189
-
190
- Output shape:
191
-
192
- ```json
193
- {
194
- "success": true
195
- }
196
- ```
197
-
198
- ### `delete_custom_query`
199
-
200
- Soft-delete (archive) a custom query.
201
-
202
- Input:
203
-
204
- | Parameter | Type | Required | Description |
205
- |---|---|---|---|
206
- | `queryId` | `string` | Yes | Query UUID |
207
-
208
- Output shape:
209
-
210
- ```json
211
- {
212
- "success": true
213
- }
214
- ```
215
-
216
- ### `run_custom_query`
217
-
218
- Execute a saved query with runtime options.
219
-
220
- Input:
221
-
222
- | Parameter | Type | Required | Description |
223
- |---|---|---|---|
224
- | `queryId` | `string` | Yes | Query UUID |
225
- | `offset` | `number \| null` | No | Rows to skip (default 0) |
226
- | `filters` | `object \| null` | No | Runtime filters |
227
- | `simulate` | `boolean` | No | If true, return explain plan instead of records |
228
-
229
- Output shape:
230
-
231
- ```json
232
- {
233
- "data": [],
234
- "meta": {
235
- "count": 0,
236
- "compiledQuery": "SELECT ... LIMIT 50000 OFFSET 0"
237
- }
238
- }
239
- ```
240
-
241
- Execution constraints:
242
-
243
- - Max rows: 50,000
244
- - Timeout: 15 seconds for normal run
245
- - Timeout: 30 seconds for `simulate: true`
246
-
247
- ---
248
-
249
- ## Filter Definitions
250
-
251
- Filter definitions are saved with the custom query and exposed to runtime filtering/UI:
252
-
253
- ```json
254
- {
255
- "slug": "created_on",
256
- "name": "Created Date",
257
- "type": "field-dateTime"
258
- }
259
- ```
260
-
261
- | Property | Type | Required | Description |
262
- |---|---|---|---|
263
- | `slug` | `string` | Yes | Identifier used by `FILTERS.slug` |
264
- | `name` | `string` | Yes | Display label |
265
- | `type` | `string` | Yes | Field type controlling operator options |
266
-
267
- ---
268
-
269
- ## Runtime Filters
270
-
271
- `run_custom_query` accepts a filter group payload:
272
-
273
- ```json
274
- {
275
- "filters": {
276
- "rules": [
277
- { "field": "created_on", "operator": "last_30_days", "value": null },
278
- { "field": "status", "operator": "=", "value": "active" }
279
- ],
280
- "combinator": "and",
281
- "not": false
282
- }
283
- }
284
- ```
285
-
286
- Rule properties:
287
-
288
- | Property | Type | Required | Description |
289
- |---|---|---|---|
290
- | `field` | `string` | Yes | Filter slug, matching custom query definition |
291
- | `operator` | `string` | Yes | Filter operator |
292
- | `value` | `any \| null` | No | Value (optional for shortcut operators) |
293
- | `filterType` | `string` | No | Type hint for value casting |
294
-
295
- Supported operator categories:
296
-
297
- - Comparison: `=`, `!=`, `<>`, `>`, `<`, `>=`, `<=`, `between`
298
- - Text: `like`, `not like`, `starts with`, `ends with`, `contains`
299
- - Collection: `in`, `not in`, `contains any`, `contains all`
300
- - Null/empty: `empty`, `not empty`, `null`, `not null`
301
- - Boolean: `true`, `false`
302
- - Date shortcuts: `today`, `yesterday`, `last_7_days`, `last_30_days`, `this_week`, `this_month`, `this_year`, `last_month`, `next_30_days`
303
- - Dynamic date: `x_days_ago`, `x_days_later`, `in_last_x_days`, `in_next_x_days`
304
- - User/team: `active_user`, `not_active_user`, `in_active_user_scope`, `in_role`, `in_team`, `in_active_user_team`
305
-
306
- For the full operator list and behavior details, read [data-source-query-guide.md](./data-source-query-guide.md#filter-operators-reference).
307
-
308
- ---
309
-
310
- ## Simulation Mode
311
-
312
- Set `simulate: true` in `run_custom_query` to execute:
313
-
314
- ```sql
315
- EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON)
316
- ```
317
-
318
- Use this mode to:
319
-
320
- - debug performance
321
- - detect sequential scans and costly joins
322
- - verify query behavior before fetching large data
323
-
324
- Example:
325
-
326
- ```json
327
- {
328
- "queryId": "query-uuid",
329
- "simulate": true
330
- }
331
- ```
332
-
333
- Typical response metadata includes `meta.explained` with plan details.
334
-
335
- ---
336
-
337
- ## Complete Examples
338
-
339
- ### Example 1: Create and Run Monthly Sales
340
-
341
- Create:
342
-
343
- ```json
344
- {
345
- "name": "Sales by Month",
346
- "description": "Monthly sales aggregation with optional filters",
347
- "query": "SELECT to_char(o.created_on, 'YYYY-MM') as month, COUNT(*) as order_count, SUM(o.amount) as total_amount FROM {{TENANT_SCHEMA}}.shop_order o WHERE o.tenant_data_source_id = 'ds-uuid' AND {{filter FILTERS.created_on o.created_on}} AND {{filter FILTERS.status o.status}} GROUP BY to_char(o.created_on, 'YYYY-MM') ORDER BY month DESC",
348
- "filters": [
349
- { "slug": "created_on", "name": "Order Date", "type": "field-dateTime" },
350
- { "slug": "status", "name": "Order Status", "type": "field-select" }
351
- ]
352
- }
353
- ```
354
-
355
- Run:
356
-
357
- ```json
358
- {
359
- "queryId": "created-query-uuid",
360
- "filters": {
361
- "rules": [
362
- { "field": "created_on", "operator": "this_year", "value": null },
363
- { "field": "status", "operator": "!=", "value": "cancelled" }
364
- ],
365
- "combinator": "and",
366
- "not": false
367
- }
368
- }
369
- ```
370
-
371
- ### Example 2: Simulate Before Running
372
-
373
- ```json
374
- {
375
- "queryId": "complex-query-uuid",
376
- "simulate": true,
377
- "filters": {
378
- "rules": [
379
- { "field": "created_on", "operator": "this_year", "value": null }
380
- ],
381
- "combinator": "and",
382
- "not": false
383
- }
384
- }
385
- ```
386
-
387
- Then fetch records:
388
-
389
- ```json
390
- {
391
- "queryId": "complex-query-uuid",
392
- "simulate": false,
393
- "offset": 0
394
- }
395
- ```
396
-
397
- ### Example 3: JSONB Custom Field Filtering
398
-
399
- ```json
400
- {
401
- "name": "CRM Pipeline Report",
402
- "description": "Deal pipeline with JSONB custom field access",
403
- "query": "SELECT r.id, r.name, (r.\"data\"->>'0192919d-c16d-7c8b-848e-6069d3205395')::numeric as deal_amount, r.\"data\"->>'019291a2-b8e4-7f3a-9c2d-4a1b3c5d7e8f' as stage, r.created_on FROM {{TENANT_SCHEMA}}.tenant_record r WHERE r.tenant_data_source_id = 'deal-ds-uuid' AND {{filter FILTERS.deal_amount (r.\"data\"->>'0192919d-c16d-7c8b-848e-6069d3205395')::numeric}} AND {{filter FILTERS.stage r.\"data\"->>'019291a2-b8e4-7f3a-9c2d-4a1b3c5d7e8f'}} ORDER BY deal_amount DESC",
404
- "filters": [
405
- { "slug": "deal_amount", "name": "Deal Amount", "type": "field-number" },
406
- { "slug": "stage", "name": "Stage", "type": "field-select" }
407
- ]
408
- }
409
- ```
410
-