@appaflytech/zeyrek-ai-mcp 0.0.23 → 0.0.24

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 (47) hide show
  1. package/.env.example +15 -0
  2. package/dist/config.js +9 -0
  3. package/dist/index.js +2 -0
  4. package/dist/knowledge/componentCatalog.js +1 -1
  5. package/dist/knowledge/mobileComponentCatalog.js +231 -58
  6. package/dist/knowledge/mobileComponentEvents.js +118 -3
  7. package/dist/knowledge/normalize.js +16 -6
  8. package/dist/knowledge/platform/lint.js +110 -3
  9. package/dist/knowledge/platform/mobileRules.js +64 -8
  10. package/dist/knowledge/rules.js +56 -7
  11. package/dist/knowledge/styleResolve.js +49 -3
  12. package/dist/knowledge/styleResolveNative.js +104 -4
  13. package/dist/observability/trace.js +1 -1
  14. package/dist/platform/argumentAliases.js +128 -0
  15. package/dist/platform/bodyFile.js +103 -0
  16. package/dist/platform/capture/capture.js +29 -5
  17. package/dist/platform/capture/console-log.js +80 -0
  18. package/dist/platform/capture/index.js +1 -0
  19. package/dist/platform/diagnostics.js +10 -4
  20. package/dist/platform/http.js +23 -7
  21. package/dist/platform/responses.js +6 -2
  22. package/dist/platform/schemaReadMemory.js +60 -0
  23. package/dist/platform/secrets.js +9 -0
  24. package/dist/platform/strictArguments.js +68 -12
  25. package/dist/platform/tokenVault.js +187 -4
  26. package/dist/resources/guides/expressions.md +1 -1
  27. package/dist/resources/guides/microservice.md +9 -2
  28. package/dist/resources/guides/middleware.md +5 -1
  29. package/dist/resources/guides/mobile.md +150 -14
  30. package/dist/resources/guides/page.md +146 -39
  31. package/dist/resources/guides/theme.md +4 -1
  32. package/dist/resources/guides/workflow.md +7 -1
  33. package/dist/resources/schema-fingerprint.json +2 -2
  34. package/dist/server.js +1 -1
  35. package/dist/tools/datasources.js +1 -1
  36. package/dist/tools/designSchemaPatch.js +4 -3
  37. package/dist/tools/externalComponents.js +1 -1
  38. package/dist/tools/flows.js +70 -4
  39. package/dist/tools/layouts.js +5 -5
  40. package/dist/tools/microservices.js +26 -10
  41. package/dist/tools/pages.js +192 -36
  42. package/dist/tools/platformInfo.js +4 -1
  43. package/dist/tools/rows.js +7 -1
  44. package/dist/tools/schemaOps.js +1 -1
  45. package/dist/tools/screenWrite.js +4 -3
  46. package/dist/tools/screens.js +81 -0
  47. package/package.json +1 -1
@@ -9,6 +9,81 @@ export const schemaParam = z.array(z.record(z.unknown()))
9
9
  export const eventsParam = z.array(z.record(z.unknown()))
10
10
  .describe("Sayfa/layout düzeyi olaylar: [{ name, value }] — value bir flow id'sidir");
11
11
  export const modeParam = z.enum(['summary', 'subtree', 'full']).optional().describe("summary (varsayılan): yalnız id/elementId/name/type ağacı — hedef bulmak için bunu kullanın. subtree: componentId ile tek alt ağaç. full: tüm şema.");
12
+ /**
13
+ * Şema ağacındaki TÜM düğümler (kök + iç içe çocuklar); page_get, page_create özeti, page_update
14
+ * ve page_schema_get aynı sayımı kullanır. Parçalı okumanın `deferred` yer tutucuları düğüm değildir.
15
+ */
16
+ export function countSchemaNodes(nodes) {
17
+ return (nodes ?? []).reduce((total, node) => node.deferred === true ? total : total + 1 + countSchemaNodes(node.children), 0);
18
+ }
19
+ function schemaNodeKey(node) {
20
+ return typeof node.elementId === 'string' ? node.elementId : String(node.id);
21
+ }
22
+ function schemaNodeKeys(nodes) {
23
+ return (nodes ?? []).flatMap(node => [schemaNodeKey(node), ...schemaNodeKeys(node.children)]);
24
+ }
25
+ /** `stored` ağacında olup `sent` ağacında olmayan düğümlerin elementId'leri, ön-sırayla (PAGE-037). */
26
+ export function missingElementIds(stored, sent) {
27
+ const kept = new Set(schemaNodeKeys(sent));
28
+ return schemaNodeKeys(stored).filter(key => !kept.has(key));
29
+ }
30
+ /**
31
+ * ZM-28: şemayı her biri `budgetChars` karakteri (JSON uzunluğu, `shrink` ile aynı ölçü) aşmayan
32
+ * parçalara böler. Ön-sıra ve deterministik: alt ağacı sığan düğüm BÜTÜN alınır, sığmayan kabuk olarak
33
+ * yazılır ve çocuklarına inilir; parçaların birleşimi orijinal şemanın birebir aynısıdır.
34
+ */
35
+ export function splitSchemaIntoParts(schema, budgetChars) {
36
+ const parts = [];
37
+ let current = [];
38
+ let currentChars = 2;
39
+ const place = (item, chars) => {
40
+ if (current.length > 0 && currentChars + 1 + chars > budgetChars) {
41
+ parts.push(current);
42
+ current = [];
43
+ currentChars = 2;
44
+ }
45
+ currentChars += (current.length > 0 ? 1 : 0) + chars;
46
+ current.push(item);
47
+ };
48
+ const visit = (node, parentElementId, index) => {
49
+ const whole = { parentElementId, index, node };
50
+ const wholeChars = JSON.stringify(whole).length;
51
+ if (2 + wholeChars <= budgetChars) {
52
+ place(whole, wholeChars);
53
+ return;
54
+ }
55
+ const children = Array.isArray(node.children) ? node.children : [];
56
+ const shell = {
57
+ parentElementId,
58
+ index,
59
+ node: { ...node, children: children.map(child => ({ elementId: schemaNodeKey(child), deferred: true })) }
60
+ };
61
+ const shellChars = JSON.stringify(shell).length;
62
+ if (children.length === 0 || 2 + shellChars > budgetChars) {
63
+ throw new PlatformApiError(`'${schemaNodeKey(node)}' (${String(node.type)}) düğümünün kendi gövdesi ${children.length === 0 ? wholeChars : shellChars} karakter; parça bütçesi ${budgetChars} karakter olduğu için tek düğüm bile bir yanıta sığmıyor. Düğümün büyük prop'unu page_schema_patch (replace_prop) ile küçültün ya da parçalara bölün; sonra cursor:'0' ile yeniden okuyun.`, 400);
64
+ }
65
+ place(shell, shellChars);
66
+ children.forEach((child, childIndex) => visit(child, schemaNodeKey(node), childIndex));
67
+ };
68
+ schema.forEach((node, index) => visit(node, null, index));
69
+ if (current.length > 0 || parts.length === 0)
70
+ parts.push(current);
71
+ return parts;
72
+ }
73
+ /** Opak parçalı okuma cursor'ı: sürüm değişince eski cursor reddedilir. */
74
+ export function encodeSchemaCursor(version, partIndex) {
75
+ return `${version}:${partIndex}`;
76
+ }
77
+ /** `'0'` sürümsüz ilk parçadır; `<sürüm>:<parça>` sürümü taşır. Çözülemeyen cursor `undefined`. */
78
+ export function decodeSchemaCursor(cursor) {
79
+ if (/^\d+$/.test(cursor))
80
+ return { partIndex: Number(cursor) };
81
+ const separator = cursor.lastIndexOf(':');
82
+ const partIndex = cursor.slice(separator + 1);
83
+ if (separator < 0 || !/^\d+$/.test(partIndex))
84
+ return undefined;
85
+ return { version: cursor.slice(0, separator), partIndex: Number(partIndex) };
86
+ }
12
87
  /**
13
88
  * Ağacı yalnız kimlik alanlarına indirger; hedef aramak için okunur boyutta tutar.
14
89
  * `styleSource` verilirse (undefined DEĞİLSE) her düğüme efektif stil raporu da
@@ -102,6 +177,11 @@ export function flowPath(host, applicationId, hostId, flowId) {
102
177
  : `/components/${applicationId}/${hostId}/flows`;
103
178
  return flowId ? `${root}/${flowId}` : root;
104
179
  }
180
+ /**
181
+ * Sayfa PUT gövdesi okunan sayfadan kurulur ve o sayfanın sürümünü `baseVersion` olarak taşır:
182
+ * platform sürümsüz sayfa PUT'unu reddeder (`plans/mobil-plantcare-acigi` b-05, K11). Gövde
183
+ * okunduğu andaki sayfanın üstüne yazar; ajanın planladığı sürümü `page_update` kendisi koyar.
184
+ */
105
185
  export function pageUpdateBody(page, overrides = {}) {
106
186
  const layout = (page.layout ?? {});
107
187
  return {
@@ -116,6 +196,7 @@ export function pageUpdateBody(page, overrides = {}) {
116
196
  middlewareIds: page.middlewareIds ?? [],
117
197
  roleIds: Array.isArray(page.roleIds) ? page.roleIds : identifiers(page.roles),
118
198
  layoutId: page.layoutId ?? layout.id ?? null,
199
+ baseVersion: page.version === undefined || page.version === null ? undefined : String(page.version),
119
200
  ...overrides
120
201
  };
121
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appaflytech/zeyrek-ai-mcp",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "Zeyrek (NgApps) platform APIs as MCP tools — data, logic and Studio design surface in one gateway",
6
6
  "license": "UNLICENSED",