@appaflytech/zeyrek-ai-mcp 0.0.7 → 0.0.9

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 (54) hide show
  1. package/README.md +27 -21
  2. package/dist/config.js +2 -0
  3. package/dist/knowledge/backendConstraints.js +3 -0
  4. package/dist/knowledge/componentCatalog.js +172 -33
  5. package/dist/knowledge/componentEvents.js +35 -4
  6. package/dist/knowledge/errorPath.js +1 -1
  7. package/dist/knowledge/normalize.js +474 -23
  8. package/dist/knowledge/propTypes.js +5 -4
  9. package/dist/knowledge/rules.js +113 -6
  10. package/dist/knowledge/styleResolve.js +52 -5
  11. package/dist/knowledge/themeResolve.js +936 -0
  12. package/dist/knowledge/themeRules.js +221 -0
  13. package/dist/knowledge/themeSchema.js +335 -0
  14. package/dist/platform/domSummary.js +144 -0
  15. package/dist/platform/http.js +10 -2
  16. package/dist/platform/screenshot.js +492 -29
  17. package/dist/platform/screenshotMemory.js +55 -0
  18. package/dist/platform/strictArguments.js +32 -0
  19. package/dist/platform/writeDiff.js +6 -3
  20. package/dist/resources/examples/layout-app-shell.json +1 -1
  21. package/dist/resources/examples/page-sign-in.json +1 -1
  22. package/dist/resources/examples/theme-brand.json +162 -0
  23. package/dist/resources/guides/component.md +8 -2
  24. package/dist/resources/guides/expressions.md +6 -0
  25. package/dist/resources/guides/getting-started.md +6 -0
  26. package/dist/resources/guides/layout.md +36 -26
  27. package/dist/resources/guides/microservice.md +160 -6
  28. package/dist/resources/guides/page.md +165 -59
  29. package/dist/resources/guides/theme.md +210 -0
  30. package/dist/resources/guides/translation.md +13 -10
  31. package/dist/resources/guides/workflow.md +141 -7
  32. package/dist/resources/schema-fingerprint.json +2 -2
  33. package/dist/resources/schemas/CreateMicroserviceCommand.json +4 -1
  34. package/dist/resources/schemas/CreateWorkflowCommand.json +4 -1
  35. package/dist/resources/schemas/PreviewMicroserviceCommand.json +4 -1
  36. package/dist/resources/schemas/PreviewWorkflowCommand.json +4 -1
  37. package/dist/resources/schemas/StepDto.json +4 -1
  38. package/dist/resources/schemas/UpdateMicroserviceCommand.json +4 -1
  39. package/dist/resources/schemas/UpdateWorkflowCommand.json +4 -1
  40. package/dist/server.js +52 -42
  41. package/dist/tools/components.js +8 -0
  42. package/dist/tools/designSchemaPatch.js +152 -0
  43. package/dist/tools/flows.js +24 -21
  44. package/dist/tools/layouts.js +8 -8
  45. package/dist/tools/microservices.js +74 -10
  46. package/dist/tools/pages.js +275 -332
  47. package/dist/tools/projects.js +66 -9
  48. package/dist/tools/queries.js +72 -6
  49. package/dist/tools/schemaOps.js +280 -0
  50. package/dist/tools/screenWrite.js +2 -1
  51. package/dist/tools/screens.js +0 -7
  52. package/dist/tools/themes.js +163 -0
  53. package/dist/tools/workflows.js +10 -6
  54. package/package.json +1 -1
@@ -0,0 +1,144 @@
1
+ /**
2
+ * NE GÖRÜNÜYOR — resimsiz.
3
+ *
4
+ * 2026-09-16 raporu: bir koşuda 58 PNG okundu ve bağlam maliyetinin %67'si buydu; tek bir tam
5
+ * sayfa karesi 800 bin karakter. Karelerin çoğunda aranan şey TEK bir olguydu — "kart göründü mü,
6
+ * tablo doldu mu, hata var mı". Bu modül o soruyu satır satır metinle cevaplar: "problem_card
7
+ * (card) · GİZLİ" 200 karakterdir.
8
+ *
9
+ * Katman saftır: tarayıcıdan gelen anlık görüntüyü doğrular ve biçimler. Toplama işi
10
+ * `screenshot.ts` `domSummaryScript`'te, sunum `pages.ts`'te.
11
+ */
12
+ function text(value) {
13
+ return typeof value === 'string' && value.length > 0 ? value : undefined;
14
+ }
15
+ function parseNode(raw) {
16
+ if (!raw || typeof raw !== 'object')
17
+ return undefined;
18
+ const value = raw;
19
+ if (typeof value.elementId !== 'string' || value.elementId.length === 0)
20
+ return undefined;
21
+ const errors = Array.isArray(value.errors)
22
+ ? value.errors.filter((entry) => typeof entry === 'string')
23
+ : undefined;
24
+ return {
25
+ elementId: value.elementId,
26
+ ...(text(value.type) === undefined ? {} : { type: String(value.type) }),
27
+ visible: value.visible === true,
28
+ inViewport: value.inViewport === true,
29
+ ...(text(value.text) === undefined ? {} : { text: String(value.text) }),
30
+ ...(typeof value.rows === 'number' && Number.isFinite(value.rows) ? { rows: value.rows } : {}),
31
+ ...(text(value.activeTab) === undefined ? {} : { activeTab: String(value.activeTab) }),
32
+ ...(text(value.value) === undefined ? {} : { value: String(value.value) }),
33
+ ...(value.empty === true ? { empty: true } : {}),
34
+ ...(errors && errors.length > 0 ? { errors } : {})
35
+ };
36
+ }
37
+ /** Tarayıcıdan dönen değer gerçekten özet mi; `parseReadiness` ile aynı karar kalıbı. */
38
+ export function parseDomSummary(raw) {
39
+ if (!raw || typeof raw !== 'object')
40
+ return undefined;
41
+ const value = raw;
42
+ if (!Array.isArray(value.nodes))
43
+ return undefined;
44
+ const messages = Array.isArray(value.messages)
45
+ ? value.messages
46
+ .map(entry => (entry && typeof entry === 'object' ? entry : undefined))
47
+ .filter((entry) => entry !== undefined)
48
+ .map(entry => ({ kind: String(entry.kind ?? 'message'), text: String(entry.text ?? '') }))
49
+ .filter(entry => entry.text.length > 0)
50
+ : [];
51
+ return {
52
+ nodes: value.nodes.map(parseNode).filter((node) => node !== undefined),
53
+ messages,
54
+ truncated: value.truncated === true,
55
+ typed: value.typed === true
56
+ };
57
+ }
58
+ export function summaryStats(summary) {
59
+ return {
60
+ nodes: summary.nodes.length,
61
+ hidden: summary.nodes.filter(node => !node.visible).length,
62
+ empty: summary.nodes.filter(node => node.empty === true).length,
63
+ errors: summary.nodes.reduce((total, node) => total + (node.errors?.length ?? 0), 0),
64
+ messages: summary.messages.length
65
+ };
66
+ }
67
+ /**
68
+ * Compact kip: düğüm başına TEK satır. Ajan bu satırı okuyup kareyi hiç açmadan karar verebilmeli,
69
+ * o yüzden sıra sabit ve alan adları kısa: kimlik (tip) · görünürlük · metin · sayımlar.
70
+ */
71
+ export function summaryLines(summary) {
72
+ const stats = summaryStats(summary);
73
+ const head = `nodes ${stats.nodes} · hidden ${stats.hidden} · empty ${stats.empty} · errors ${stats.errors} · messages ${stats.messages}`;
74
+ const body = summary.nodes.map(node => {
75
+ const parts = [node.type === undefined ? node.elementId : `${node.elementId} (${node.type})`];
76
+ parts.push(node.visible ? (node.inViewport ? 'visible' : 'ekran dışı') : 'GİZLİ');
77
+ if (node.text !== undefined)
78
+ parts.push(`"${node.text}"`);
79
+ if (node.rows !== undefined)
80
+ parts.push(`rows=${node.rows}`);
81
+ if (node.activeTab !== undefined)
82
+ parts.push(`tab=${node.activeTab}`);
83
+ if (node.value !== undefined)
84
+ parts.push(`value=${node.value}`);
85
+ if (node.empty === true)
86
+ parts.push('BOŞ');
87
+ if (node.errors !== undefined)
88
+ parts.push(`errors=${node.errors.length}`);
89
+ return parts.join(' · ');
90
+ });
91
+ const tail = summary.messages.map(message => `! ${message.kind}: ${message.text}`);
92
+ return [head, ...body, ...tail];
93
+ }
94
+ const COMPARED = ['visible', 'inViewport', 'text', 'rows', 'activeTab', 'value', 'empty'];
95
+ /**
96
+ * `errors` METİNLE karşılaştırılır, sayıyla değil: "Ad zorunludur" → "E-posta geçersiz"
97
+ * değişiminde sayı 1→1 kalıyor, fark boş çıkıyor ve yanıt "yapısal bir değişiklik yok" diyordu
98
+ * (B-9). Mesajın kendisi doğrulamanın konusu olabilir.
99
+ */
100
+ function fieldValue(node, field) {
101
+ if (field === 'errors')
102
+ return node.errors === undefined ? undefined : node.errors.join(' · ');
103
+ return node[field];
104
+ }
105
+ /**
106
+ * "Önceki kareye göre ne değişti" — S-7. Fark PİKSEL değil DOM düzeyindedir: ajan aynı sayfayı
107
+ * yeniden koştururken 150 bin karakterlik kareyi tekrar okumak yerine bu listeyi okur.
108
+ */
109
+ export function diffSummaries(previous, next) {
110
+ const before = new Map(previous.nodes.map(node => [node.elementId, node]));
111
+ const after = new Map(next.nodes.map(node => [node.elementId, node]));
112
+ const changed = [];
113
+ let unchanged = 0;
114
+ for (const [elementId, node] of after) {
115
+ const old = before.get(elementId);
116
+ if (old === undefined)
117
+ continue;
118
+ const fields = [...COMPARED, 'errors'].filter(field => fieldValue(old, field) !== fieldValue(node, field));
119
+ if (fields.length === 0) {
120
+ unchanged += 1;
121
+ continue;
122
+ }
123
+ for (const field of fields) {
124
+ changed.push({
125
+ elementId,
126
+ field,
127
+ ...(fieldValue(old, field) === undefined ? {} : { from: fieldValue(old, field) }),
128
+ ...(fieldValue(node, field) === undefined ? {} : { to: fieldValue(node, field) })
129
+ });
130
+ }
131
+ }
132
+ const previousMessages = previous.messages.map(message => message.text);
133
+ const nextMessages = next.messages.map(message => message.text);
134
+ return {
135
+ added: [...after.keys()].filter(elementId => !before.has(elementId)),
136
+ removed: [...before.keys()].filter(elementId => !after.has(elementId)),
137
+ changed,
138
+ messages: {
139
+ added: nextMessages.filter(text => !previousMessages.includes(text)),
140
+ removed: previousMessages.filter(text => !nextMessages.includes(text))
141
+ },
142
+ unchanged
143
+ };
144
+ }
@@ -42,8 +42,16 @@ function appendQuery(url, query) {
42
42
  if (value === undefined || value === null || value === '')
43
43
  continue;
44
44
  if (Array.isArray(value)) {
45
- for (const entry of value)
46
- url.searchParams.append(key, String(entry));
45
+ if (value.some(entry => entry !== null && typeof entry === 'object')) {
46
+ url.searchParams.append(key, JSON.stringify(value));
47
+ }
48
+ else {
49
+ for (const entry of value)
50
+ url.searchParams.append(key, String(entry));
51
+ }
52
+ }
53
+ else if (typeof value === 'object') {
54
+ url.searchParams.append(key, JSON.stringify(value));
47
55
  }
48
56
  else {
49
57
  url.searchParams.append(key, String(value));