@appaflytech/zeyrek-ai-mcp 0.0.24 → 0.0.26

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 (81) hide show
  1. package/.env.example +0 -15
  2. package/dist/config.js +0 -11
  3. package/dist/index.js +0 -2
  4. package/dist/knowledge/componentCatalog.js +25 -13
  5. package/dist/knowledge/componentEvents.js +6 -13
  6. package/dist/knowledge/normalize.js +17 -68
  7. package/dist/knowledge/rules.js +49 -137
  8. package/dist/knowledge/styleResolve.js +4 -50
  9. package/dist/knowledge/themeResolve.js +3 -3
  10. package/dist/observability/trace.js +1 -1
  11. package/dist/platform/diagnostics.js +4 -10
  12. package/dist/platform/domSummary.js +1 -1
  13. package/dist/platform/http.js +7 -23
  14. package/dist/platform/responses.js +2 -6
  15. package/dist/platform/{capture/capture.js → screenshot.js} +514 -52
  16. package/dist/platform/secrets.js +0 -9
  17. package/dist/platform/strictArguments.js +12 -68
  18. package/dist/platform/tokenVault.js +4 -187
  19. package/dist/resources/examples/workflow-http-step.json +2 -2
  20. package/dist/resources/guides/component.md +1 -6
  21. package/dist/resources/guides/expressions.md +2 -2
  22. package/dist/resources/guides/functions.md +1 -1
  23. package/dist/resources/guides/layout.md +7 -11
  24. package/dist/resources/guides/microfunction.md +28 -0
  25. package/dist/resources/guides/microservice.md +4 -10
  26. package/dist/resources/guides/middleware.md +1 -5
  27. package/dist/resources/guides/page.md +55 -215
  28. package/dist/resources/guides/theme.md +1 -4
  29. package/dist/resources/guides/translation.md +1 -1
  30. package/dist/resources/guides/workflow.md +9 -12
  31. package/dist/resources/schema-fingerprint.json +2 -2
  32. package/dist/resources/schemas/CreateWorkflowCommand.json +3 -0
  33. package/dist/resources/schemas/PreviewWorkflowCommand.json +3 -0
  34. package/dist/resources/schemas/StepDto.json +12 -9
  35. package/dist/resources/schemas/UpdateWorkflowCommand.json +3 -0
  36. package/dist/server.js +1 -3
  37. package/dist/tools/applications.js +3 -60
  38. package/dist/tools/components.js +10 -50
  39. package/dist/tools/datasources.js +1 -1
  40. package/dist/tools/designSchemaPatch.js +6 -16
  41. package/dist/tools/externalComponents.js +4 -25
  42. package/dist/tools/flows.js +6 -79
  43. package/dist/tools/layouts.js +12 -44
  44. package/dist/tools/microservices.js +10 -26
  45. package/dist/tools/pages.js +67 -303
  46. package/dist/tools/platformInfo.js +2 -6
  47. package/dist/tools/rows.js +1 -7
  48. package/dist/tools/schemaOps.js +1 -1
  49. package/dist/tools/screenWrite.js +5 -6
  50. package/dist/tools/screens.js +3 -90
  51. package/dist/tools/workflows.js +1 -1
  52. package/package.json +1 -1
  53. package/dist/knowledge/mobileComponentCatalog.js +0 -801
  54. package/dist/knowledge/mobileComponentEvents.js +0 -225
  55. package/dist/knowledge/platform/lint.js +0 -312
  56. package/dist/knowledge/platform/mobile.js +0 -78
  57. package/dist/knowledge/platform/mobileRules.js +0 -182
  58. package/dist/knowledge/platform/mobileTabs.js +0 -108
  59. package/dist/knowledge/platform/profile.js +0 -20
  60. package/dist/knowledge/platform/resolve.js +0 -122
  61. package/dist/knowledge/platform/web.js +0 -38
  62. package/dist/knowledge/styleResolveNative.js +0 -510
  63. package/dist/platform/argumentAliases.js +0 -128
  64. package/dist/platform/bodyFile.js +0 -103
  65. package/dist/platform/capture/actions.js +0 -333
  66. package/dist/platform/capture/browser.js +0 -1
  67. package/dist/platform/capture/console-log.js +0 -80
  68. package/dist/platform/capture/index.js +0 -11
  69. package/dist/platform/capture/readiness.js +0 -103
  70. package/dist/platform/capture/summary.js +0 -77
  71. package/dist/platform/capture/target.js +0 -5
  72. package/dist/platform/capture/targets/studio-mobile.js +0 -15
  73. package/dist/platform/capture/targets/studio-web.js +0 -5
  74. package/dist/platform/schemaReadMemory.js +0 -60
  75. package/dist/resources/examples/mobile-app-shell-drawer.json +0 -209
  76. package/dist/resources/examples/mobile-app-shell-stack.json +0 -123
  77. package/dist/resources/examples/mobile-app-shell-tab.json +0 -174
  78. package/dist/resources/examples/mobile-list-detail-form.json +0 -656
  79. package/dist/resources/guides/mobile.md +0 -419
  80. package/dist/tools/mobile.js +0 -203
  81. package/dist/tools/profileWrite.js +0 -45
@@ -1,103 +0,0 @@
1
- import { open, realpath } from 'node:fs/promises';
2
- import { constants } from 'node:fs';
3
- import { extname, resolve, sep } from 'node:path';
4
- import { z } from 'zod';
5
- import { PlatformApiError } from './errors.js';
6
- /**
7
- * g-08 (`plans/mobil-plantcare-acigi`): tanım yazan araçlar gövdeyi dosyadan alabilir. Koşuda en
8
- * büyük bağlam tasarrufu, ajanın kendi yazdığı "dosyadan MCP'ye" betiğinden geldi; o iş buraya
9
- * taşındı. Her aracın TEK gövde argümanı vardır ve dosyanın JSON'u o argümanın değeri olur. Dosya
10
- * SDK doğrulamasından ÖNCE okunur (`strictArguments.ts`), yani satır içi gövdeyle aynı şema ve aynı
11
- * yol — dosyadan gelen gövde hiçbir kontrolü atlamaz.
12
- */
13
- export const BODY_FILE_ARGUMENTS = {
14
- page_create: 'schema',
15
- page_update: 'schema',
16
- page_schema_patch: 'ops',
17
- flow_create: 'steps',
18
- flow_update: 'steps',
19
- flow_patch: 'operations',
20
- microservice_create: 'definition',
21
- microservice_update: 'definition',
22
- microservice_patch: 'operations',
23
- workflow_create: 'definition',
24
- workflow_update: 'definition',
25
- workflow_patch: 'operations'
26
- };
27
- /** `ops`/`operations` eşanlamlıdır (`microOps`); ikisinden biri satır içinde varsa gövde verilmiştir. */
28
- const synonyms = { ops: ['ops', 'operations'], operations: ['ops', 'operations'] };
29
- const maxBodyFileBytes = 5 * 1024 * 1024;
30
- export function bodyFileParam(argument) {
31
- return z.string().min(1).optional().describe(`'${argument}' yerine okunacak yerel .json dosyası (en çok 5 MB): gövde ajan bağlamından geçmez, gateway dosyayı okuyup '${argument}' olarak aynı doğrulamadan geçirir. '${argument}' ile birlikte verilemez. Yol gateway sürecinin çalışma dizininin ya da MCP_INPUT_DIR'in altında olmalı (sembolik bağ çözülür). Yanıtın bodyFile alanı hangi dosyanın okunduğunu söyler.`);
32
- }
33
- export async function loadBodyFile(tool, args, config) {
34
- const argument = BODY_FILE_ARGUMENTS[tool];
35
- if (!argument || !args || typeof args !== 'object' || Array.isArray(args))
36
- return { args };
37
- const { bodyFile, ...rest } = args;
38
- if (bodyFile === undefined)
39
- return { args };
40
- if (typeof bodyFile !== 'string' || bodyFile.length === 0)
41
- return { args };
42
- const inline = (synonyms[argument] ?? [argument]).filter(name => rest[name] !== undefined);
43
- if (inline.length > 0) {
44
- throw new PlatformApiError(`${tool}: bodyFile ile '${inline.join("', '")}' birlikte verilemez — gövde ya dosyadan ya satır içinden gelir. Birini kaldırın. İstek gönderilmedi.`, 400);
45
- }
46
- const absolute = resolve(bodyFile);
47
- if (extname(absolute).toLowerCase() !== '.json') {
48
- throw new PlatformApiError(`${tool}: bodyFile yalnız .json okur — verilen: ${absolute}. İstek gönderilmedi.`, 400);
49
- }
50
- let real;
51
- try {
52
- real = await realpath(absolute);
53
- }
54
- catch (error) {
55
- throw new PlatformApiError(`${tool}: bodyFile okunamadı — ${absolute} (${error instanceof Error ? error.message : String(error)}). Yol gateway sürecinin çalıştığı makineye göre çözülür.`, 400);
56
- }
57
- if (extname(real).toLowerCase() !== '.json') {
58
- throw new PlatformApiError(`${tool}: bodyFile'ın hedefi .json değil — ${real} (${absolute} bağının hedefi). İstek gönderilmedi.`, 400);
59
- }
60
- const roots = await Promise.all([process.cwd(), config.inputDirectory]
61
- .filter((root) => typeof root === 'string' && root.length > 0)
62
- .map(root => realpath(resolve(root)).catch(() => undefined)));
63
- const allowed = roots.some(root => root !== undefined && (real === root || real.startsWith(`${root}${sep}`)));
64
- if (!allowed) {
65
- throw new PlatformApiError(`${tool}: bodyFile izinli dizinlerin dışında — ${real}${real !== absolute ? ` (${absolute} bağının hedefi)` : ''}. Gateway yalnız çalışma dizininin (${process.cwd()}) ve .env'deki MCP_INPUT_DIR'in (${config.inputDirectory ?? 'tanımsız'}) altındaki dosyaları okur. İstek gönderilmedi.`, 400);
66
- }
67
- // Denetim ve okuma AYNI tutamaçtan: yol denetimden sonra değişse de okunan, denetlenen dosyadır.
68
- // O_NOFOLLOW son bileşenin sonradan bağa çevrilmesini, O_NONBLOCK `.json` adlı FIFO'nun çağrıyı
69
- // bekletmesini önler; boyut dosyanın büyüklüğüne değil okunan bayta bakar.
70
- let handle;
71
- try {
72
- handle = await open(real, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
73
- }
74
- catch (error) {
75
- throw new PlatformApiError(`${tool}: bodyFile açılamadı — ${real} (${error instanceof Error ? error.message : String(error)}). İstek gönderilmedi.`, 400);
76
- }
77
- let bytes;
78
- let text;
79
- try {
80
- const info = await handle.stat();
81
- if (!info.isFile()) {
82
- throw new PlatformApiError(`${tool}: bodyFile düzenli dosya değil — ${real}. İstek gönderilmedi.`, 400);
83
- }
84
- const buffer = Buffer.alloc(maxBodyFileBytes + 1);
85
- const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
86
- bytes = bytesRead;
87
- if (bytes > maxBodyFileBytes) {
88
- throw new PlatformApiError(`${tool}: bodyFile 5 MB sınırını aşıyor. Tanımı parçalara bölün — sayfa için page_schema_patch'e birden çok batch, akış için flow_patch. İstek gönderilmedi.`, 400);
89
- }
90
- text = buffer.subarray(0, bytes).toString('utf8');
91
- }
92
- finally {
93
- await handle.close();
94
- }
95
- let value;
96
- try {
97
- value = JSON.parse(text);
98
- }
99
- catch (error) {
100
- throw new PlatformApiError(`${tool}: bodyFile JSON değil — ${real} (${error instanceof Error ? error.message : String(error)}). İstek gönderilmedi.`, 400);
101
- }
102
- return { args: { ...rest, [argument]: value }, note: `${bodyFile} → ${argument} (${bytes} B)` };
103
- }
@@ -1,333 +0,0 @@
1
- import { INTERNAL_ROLE_SEPARATOR } from '../../knowledge/componentCatalog.js';
2
- import { studioWebTarget } from './targets/studio-web.js';
3
- /**
4
- * G-24 — gateway sayfayı kurabiliyor, okuyabiliyor ve çizdirebiliyordu ama üzerinde OLAY
5
- * TETİKLEYEMİYORDU: "filtre değişince veri yenileniyor" iddiası yalnız şema okumasıyla
6
- * kanıtlanabiliyordu. 09-05 koşusunda üç olay bağının ikisi şemada "bağlı" görünüp gerçekte
7
- * çalışmıyordu (form submit hiç doğmuyordu, `code` adımının gövdesi kaydedilmemişti) ve ikisi de
8
- * yalnız gerçek tıklamayla görüldü.
9
- *
10
- * Değer yazarken NATIVE setter kullanılır ve `input`+`change` olayları bubbles ile atılır: DOM
11
- * value'sunu düz atamak framework'ün duyduğu olayı üretmez, alan dolu görünür ama akış çalışmaz.
12
- * `resource` sayacı "istek gerçekten gitti mi" sorusunu cevaplar — koşuda kusuru kesinleştiren
13
- * gözlem tam olarak buydu (ağ kaydında hiç istek yoktu).
14
- */
15
- export function actionScript(action, captureTarget = studioWebTarget) {
16
- const selector = JSON.stringify(`[data-element-id="${String(action.target ?? '')}"]`);
17
- const value = JSON.stringify(action.value ?? '');
18
- // Tek tırnakla gömülür: seçiciler sabittir ve çift tırnak taşır; web betiğinin metni değişmesin.
19
- const optionSelector = `'${captureTarget.optionSelector}'`;
20
- // Seçeneklerin arandığı kök: web'de kutunun kabı (`scope`), mobilde belge (liste `Modal` katmanında).
21
- const optionRoot = captureTarget.optionsOutsideNode ? 'document' : 'scope';
22
- if (action.action === 'click') {
23
- return `(function () {
24
- var count = performance.getEntriesByType('resource').length;
25
- var node = document.querySelector(${selector});
26
- if (!node) return { found: false, applied: false, requests: count };
27
- var target = node.matches('button, a, [role="button"]') ? node : (node.querySelector('button, a, [role="button"]') || node);
28
- // S-2: sekme grubunun KÖKÜNE click, DOM sırasındaki ilk sekmeye gider ve "uygulandı" der —
29
- // ajan ikinci sekmeyi hiç seçemiyordu (2026-09-16 raporu madde 6). Sekme seçmek 'tab'in işi.
30
- if (target.closest && target.closest('[role="tablist"]') && !node.matches('[role="tab"]')) {
31
- return { found: true, applied: false, note: "hedef bir sekme grubu: click İLK sekmeye giderdi — sekme seçmek için { action: 'tab', target: '" + ${JSON.stringify(String(action.target ?? ''))} + "', value: '<sekme anahtarı ya da metni>' } kullanın", requests: count };
32
- }
33
- target.click();
34
- return { found: true, applied: true, requests: count };
35
- })()`;
36
- }
37
- // S-2 — sekme SEÇİLEMİYORDU: kimlik `<elementId>__tab-<key>` (frontend f-02) önce denenir,
38
- // runtime onu basmıyorsa görünen metinle eşlenir ve rapor hangisiyle eşlediğini söyler —
39
- // metin çeviriye bağlıdır, dil değişince kırılır.
40
- if (action.action === 'tab') {
41
- const roleSelector = JSON.stringify(`[data-element-id="${String(action.target ?? '')}__tab-${String(action.value ?? '')}"]`);
42
- return `(function () {
43
- var count = performance.getEntriesByType('resource').length;
44
- var root = document.querySelector(${selector});
45
- if (!root) return { found: false, applied: false, requests: count };
46
- var wanted = String(${value});
47
- var byRole = document.querySelector(${roleSelector});
48
- var buttons = Array.prototype.slice.call(root.querySelectorAll('[role="tab"]'));
49
- var byText = buttons.filter(function (button) { return (button.textContent || '').trim() === wanted; })[0]
50
- || buttons.filter(function (button) { return (button.textContent || '').trim().toLowerCase() === wanted.toLowerCase(); })[0];
51
- var target = byRole || byText;
52
-
53
- if (!target) {
54
- var names = buttons.map(function (button) { return (button.textContent || '').trim(); }).join(' · ');
55
- return { found: true, applied: false, optionsSeen: buttons.length, requests: count, note: buttons.length === 0
56
- ? "bu düğümde sekme yok (role=tab) — hedef gerçekten bir sekme grubu mu? page_schema_get ile tipe bakın"
57
- : "sekme bulunamadı: " + wanted + " — sekme ANAHTARINI ya da görünen metnini verin; görülenler: " + names };
58
- }
59
-
60
- if (target.disabled === true || target.getAttribute('aria-disabled') === 'true') {
61
- return { found: true, applied: false, note: "sekme devre dışı (disabled): " + wanted, requests: count };
62
- }
63
-
64
- target.click();
65
- return { found: true, applied: true, matchedBy: byRole ? 'role' : 'text', requests: count };
66
- })()`;
67
- }
68
- // S-3 — açılır kutuda seçim. 'set' ile aynı gövde; buradaki fark yalnız prop izi tutulmamasıdır
69
- // (seçim kutunun kendi değerini yazar, DOM'a elle yazılan bir değer yoktur).
70
- if (action.action === 'select') {
71
- return `(function () {
72
- var count = performance.getEntriesByType('resource').length;
73
- var node = document.querySelector(${selector});
74
- if (!node) return { found: false, applied: false, requests: count };
75
- var wanted = String(${value});
76
- var finish = function (result) { return result; };
77
-
78
- var combobox = node.querySelector('[role="combobox"], .ng-select__value-container, .ng-multiselect__value-container');
79
- if (combobox) {
80
- // Liste BU kutunun kabının içindedir. Sorgular belge kapsamlı kaldığında açık duran başka
81
- // bir kutunun (multiselect seçimden sonra kapanmıyor) seçeneğine tıklanabiliyordu ve adım
82
- // "uygulandı" diyordu; komşunun yükleme göstergesi de bu kutunun kararını blokluyordu (B-5).
83
- var scope = combobox.closest('.ng-select, .ng-multiselect') || node;
84
-
85
- combobox.click();
86
-
87
- return new Promise(function (resolve) {
88
- var waited = 0;
89
- var step = 100;
90
- var limit = 3000;
91
-
92
- var attempt = function () {
93
- var loading = scope.querySelector('.ng-select__loading, .ng-multiselect__loading');
94
- var options = Array.prototype.slice.call(${optionRoot}.querySelectorAll(${optionSelector}));
95
- var byValue = options.filter(function (option) { return option.getAttribute('data-value') === wanted; })[0];
96
- var byText = options.filter(function (option) { return (option.textContent || '').trim() === wanted; })[0];
97
- var match = byValue || byText;
98
-
99
- if (match) {
100
- var button = match.querySelector('button');
101
- // Seçilemeyen seçeneğe tıklamak hiçbir şey yapmaz; "uygulandı" demek yanlış olurdu (B-6).
102
- if (match.getAttribute('aria-disabled') === 'true' || (button && button.disabled)) {
103
- resolve(finish({ found: true, applied: false, optionsSeen: options.length, waitedMs: waited, requests: count, note: "seçenek devre dışı (aria-disabled): " + wanted }));
104
- return;
105
- }
106
-
107
- (button || match).click();
108
- resolve(finish({ found: true, applied: true, matchedBy: byValue ? 'value' : 'text', optionsSeen: options.length, waitedMs: waited, requests: count }));
109
- return;
110
- }
111
-
112
- var settled = !loading && (options.length > 0 || !!scope.querySelector('.ng-select__empty, .ng-multiselect__empty'));
113
-
114
- if (settled || waited >= limit) {
115
- var seen = options.slice(0, 10).map(function (option) { return (option.textContent || '').trim(); }).join(' · ');
116
- // Liste HİÇ açılmadıysa kusur sorguda değil kutunun kendisinde olabilir:
117
- // handleContainerClick kilitli/salt-okunur/yükleniyor kutuda erken döner.
118
- var locked = !scope.querySelector('.ng-select__list, .ng-multiselect__list');
119
- var note = options.length > 0
120
- ? "açılır kutuda bu değere karşılık gelen seçenek yok: " + wanted + " — görülen " + options.length + " seçenek: " + seen
121
- : locked
122
- ? "açılır kutu AÇILMADI (" + waited + " ms): kutu devre dışı, salt okunur ya da hâlâ yükleniyor olabilir — page_runtime_get ile isDisabled/isReadonly/isLoading prop'larına bakın"
123
- : "açılır kutu açıldı ama " + waited + " ms içinde hiç seçenek basılmadı — seçenekler bir sorgudan geliyorsa query_preview ile doğrulayın, yavaşsa önce bir wait adımı ekleyin";
124
- resolve(finish({ found: true, applied: false, optionsSeen: options.length, waitedMs: waited, requests: count, note: note }));
125
- return;
126
- }
127
-
128
- waited += step;
129
- setTimeout(attempt, step);
130
- };
131
-
132
- attempt();
133
- });
134
- }
135
- return { found: true, applied: false, note: "bu düğümde açılır kutu yok (role=combobox / .ng-select__value-container) — native alan için 'set', butona basmak için 'click' kullanın", requests: count };
136
- })()`;
137
- }
138
- // S-4 — form gönderme. Gönder butonu olmayan ya da Enter ile gönderilen form başsız
139
- // doğrulanamıyordu; `requestSubmit` formun kendi submit olayını doğduğu gibi doğurur.
140
- if (action.action === 'submit') {
141
- // Mobil hedefte ağaçta `<form>` yoktur: runtime köprüsü form düğümünün `submit` olayını
142
- // makineye iletir. Köprü düğümü tanımıyorsa (eski runtime, yanlış hedef) DOM yoluna düşülür.
143
- const bridge = captureTarget.submitBridge === undefined
144
- ? ''
145
- : `var bridge = window[${JSON.stringify(captureTarget.submitBridge)}];
146
- if (typeof bridge === 'function') {
147
- var bridged = bridge(${JSON.stringify(String(action.target ?? ''))});
148
- if (bridged && bridged.found) return { found: true, applied: bridged.applied === true, submitVia: 'bridge', requests: count, note: bridged.note };
149
- }
150
- `;
151
- return `(function () {
152
- var count = performance.getEntriesByType('resource').length;
153
- var node = document.querySelector(${selector});
154
- if (!node) return { found: false, applied: false, requests: count };
155
- ${bridge}var form = node.matches('form') ? node : (node.querySelector('form') || node.closest('form'));
156
-
157
- if (form) {
158
- if (typeof form.requestSubmit === 'function') {
159
- form.requestSubmit();
160
- return { found: true, applied: true, submitVia: 'requestSubmit', requests: count };
161
- }
162
-
163
- form.dispatchEvent(new Event('submit', { bubbles: true, cancelable: true }));
164
- return { found: true, applied: true, submitVia: 'dispatch', requests: count };
165
- }
166
-
167
- var button = node.querySelector('button[type="submit"]');
168
-
169
- if (button) {
170
- button.click();
171
- return { found: true, applied: true, submitVia: 'button', requests: count };
172
- }
173
-
174
- return { found: true, applied: false, note: "bu düğüm bir form değil ve içinde submit butonu da yok — form komponentinin elementId'sini hedefleyin", requests: count };
175
- })()`;
176
- }
177
- // G-09 — kanban kartı ve takvim etkinliği HTML5 DnD ile taşınır. Olaylar sentetik atılır ve
178
- // TEK DataTransfer'i paylaşır; koordinat bırakma hedefinin merkezidir, çünkü takvimin saat
179
- // kolonu bırakılan saati `clientY`'den hesaplar (slot hedefi o saatin ortasına düşer).
180
- // Playwright `dragTo` gerçek fare sürer ama ScreenshotPage bu yeteneği taşımaz; betik yolu
181
- // öteki eylemlerle aynı ölçüm döngüsünden (requests · flowRuns) geçer.
182
- if (action.action === 'drag') {
183
- const destination = JSON.stringify(`[data-element-id="${String(action.to ?? '')}"]`);
184
- const destinationName = JSON.stringify(String(action.to ?? ''));
185
- return `(function () {
186
- var count = performance.getEntriesByType('resource').length;
187
- var node = document.querySelector(${selector});
188
- if (!node) return { found: false, applied: false, requests: count };
189
- var drop = document.querySelector(${destination});
190
- if (!drop) return { found: false, applied: false, note: "sürükleme kaynağı bulundu ama bırakma hedefi ('to') sayfada yok: " + ${destinationName} + " — kanban kolonu <elementId>__col-<value>, takvim günü <elementId>__day-<yyyy-MM-dd>, saat dilimi <elementId>__slot-<yyyy-MM-dd>T<HH>", requests: count };
191
- if (node.getAttribute('draggable') !== 'true') return { found: true, applied: false, note: "kaynak sürüklenebilir değil (draggable != true) — kanban isDraggable ya da eventcalendar isEditable kapalı olabilir", requests: count };
192
- var transfer = new DataTransfer();
193
- var center = function (element) { var rect = element.getBoundingClientRect(); return { x: rect.left + rect.width / 2, y: rect.top + rect.height / 2 }; };
194
- var fire = function (element, type, at) { element.dispatchEvent(new DragEvent(type, { bubbles: true, cancelable: true, composed: true, dataTransfer: transfer, clientX: at.x, clientY: at.y })); };
195
- var from = center(node);
196
- var to = center(drop);
197
- fire(node, 'dragstart', from);
198
- fire(drop, 'dragenter', to);
199
- fire(drop, 'dragover', to);
200
- fire(drop, 'drop', to);
201
- fire(node, 'dragend', to);
202
- return { found: true, applied: true, requests: count };
203
- })()`;
204
- }
205
- const target = String(action.target ?? '');
206
- const root = rootElementId(target);
207
- // G-14 — `applied` yalnız "DOM'a yazıldı" demekti: tarih seçici olayı dinlemiyordu, kutu dolu
208
- // görünüyor, prop boş kalıyordu. Kökün prop parmak izi eylemden ÖNCE alınır; runActions
209
- // yerleşmeden sonra yeniden okuyup `propWritten`'ı çıkarır. Çok alanlı bileşenin kökünde tek
210
- // değer yoktur — ilk kutuya yazmak yarım değeri "uygulandı" diye raporluyordu, kök reddedilir.
211
- return `(function () {
212
- var count = performance.getEntriesByType('resource').length;
213
- var node = document.querySelector(${selector});
214
- if (!node) return { found: false, applied: false, requests: count };
215
- var wanted = String(${value});
216
- var propsBefore = ${runtimePropsScript(root)};
217
- var finish = function (result) { if (propsBefore !== undefined) result.propsBefore = propsBefore; return result; };
218
-
219
- if (${JSON.stringify(root === target)}) {
220
- var parts = Array.prototype.slice.call(node.querySelectorAll(${JSON.stringify(`[data-element-id^="${root}${INTERNAL_ROLE_SEPARATOR}"]`)}))
221
- .filter(function (part) { return part.querySelector('input, select, textarea'); })
222
- .map(function (part) { return part.getAttribute('data-element-id'); });
223
- if (parts.length > 1) return finish({ found: true, applied: false, note: "çok alanlı bileşen: kökte tek değer yok, değeri kutulardan birine yazın — " + parts.join(' · '), requests: count });
224
- }
225
-
226
- // Açılır kutu (dropdown / multi-select) NATIVE alan değildir: değeri yazmak hiçbir şey
227
- // yapmaz, seçeneğe TIKLANMASI gerekir. 'set' bu noktada 'select' fiiliyle AYNI yola girer —
228
- // iki kopya seçim mantığı tutulmaz.
229
-
230
- var combobox = node.querySelector('[role="combobox"], .ng-select__value-container, .ng-multiselect__value-container');
231
- if (combobox) {
232
- // Liste BU kutunun kabının içindedir. Sorgular belge kapsamlı kaldığında açık duran başka
233
- // bir kutunun (multiselect seçimden sonra kapanmıyor) seçeneğine tıklanabiliyordu ve adım
234
- // "uygulandı" diyordu; komşunun yükleme göstergesi de bu kutunun kararını blokluyordu (B-5).
235
- var scope = combobox.closest('.ng-select, .ng-multiselect') || node;
236
-
237
- combobox.click();
238
-
239
- return new Promise(function (resolve) {
240
- var waited = 0;
241
- var step = 100;
242
- var limit = 3000;
243
-
244
- var attempt = function () {
245
- var loading = scope.querySelector('.ng-select__loading, .ng-multiselect__loading');
246
- var options = Array.prototype.slice.call(${optionRoot}.querySelectorAll(${optionSelector}));
247
- var byValue = options.filter(function (option) { return option.getAttribute('data-value') === wanted; })[0];
248
- var byText = options.filter(function (option) { return (option.textContent || '').trim() === wanted; })[0];
249
- var match = byValue || byText;
250
-
251
- if (match) {
252
- var button = match.querySelector('button');
253
- // Seçilemeyen seçeneğe tıklamak hiçbir şey yapmaz; "uygulandı" demek yanlış olurdu (B-6).
254
- if (match.getAttribute('aria-disabled') === 'true' || (button && button.disabled)) {
255
- resolve(finish({ found: true, applied: false, optionsSeen: options.length, waitedMs: waited, requests: count, note: "seçenek devre dışı (aria-disabled): " + wanted }));
256
- return;
257
- }
258
-
259
- (button || match).click();
260
- resolve(finish({ found: true, applied: true, matchedBy: byValue ? 'value' : 'text', optionsSeen: options.length, waitedMs: waited, requests: count }));
261
- return;
262
- }
263
-
264
- var settled = !loading && (options.length > 0 || !!scope.querySelector('.ng-select__empty, .ng-multiselect__empty'));
265
-
266
- if (settled || waited >= limit) {
267
- var seen = options.slice(0, 10).map(function (option) { return (option.textContent || '').trim(); }).join(' · ');
268
- // Liste HİÇ açılmadıysa kusur sorguda değil kutunun kendisinde olabilir:
269
- // handleContainerClick kilitli/salt-okunur/yükleniyor kutuda erken döner.
270
- var locked = !scope.querySelector('.ng-select__list, .ng-multiselect__list');
271
- var note = options.length > 0
272
- ? "açılır kutuda bu değere karşılık gelen seçenek yok: " + wanted + " — görülen " + options.length + " seçenek: " + seen
273
- : locked
274
- ? "açılır kutu AÇILMADI (" + waited + " ms): kutu devre dışı, salt okunur ya da hâlâ yükleniyor olabilir — page_runtime_get ile isDisabled/isReadonly/isLoading prop'larına bakın"
275
- : "açılır kutu açıldı ama " + waited + " ms içinde hiç seçenek basılmadı — seçenekler bir sorgudan geliyorsa query_preview ile doğrulayın, yavaşsa önce bir wait adımı ekleyin";
276
- resolve(finish({ found: true, applied: false, optionsSeen: options.length, waitedMs: waited, requests: count, note: note }));
277
- return;
278
- }
279
-
280
- waited += step;
281
- setTimeout(attempt, step);
282
- };
283
-
284
- attempt();
285
- });
286
- }
287
-
288
- var field = node.matches('input, select, textarea') ? node : node.querySelector('input, select, textarea');
289
- if (!field) return finish({ found: true, applied: false, note: 'düğümde input/select/textarea yok — bu komponent native alan kullanmıyor olabilir, click ile deneyin', requests: count });
290
- var proto = field instanceof HTMLSelectElement ? HTMLSelectElement.prototype
291
- : (field instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLInputElement.prototype);
292
- if (field instanceof HTMLInputElement && (field.type === 'checkbox' || field.type === 'radio')) {
293
- var shouldCheck = wanted === 'true' || wanted === '1' || wanted === 'on';
294
- if (field.checked !== shouldCheck) field.click();
295
- return finish({ found: true, applied: true, requests: count });
296
- }
297
- var setter = Object.getOwnPropertyDescriptor(proto, 'value').set;
298
- setter.call(field, ${value});
299
- field.dispatchEvent(new Event('input', { bubbles: true }));
300
- field.dispatchEvent(new Event('change', { bubbles: true }));
301
- return finish({ found: true, applied: true, requests: count });
302
- })()`;
303
- }
304
- /** `rf_range__start` → `rf_range`: iç rol hedefinin prop'ları kök düğümde yaşar. */
305
- export function rootElementId(target) {
306
- const separator = target.indexOf(INTERNAL_ROLE_SEPARATOR);
307
- return separator > 0 ? target.slice(0, separator) : target;
308
- }
309
- /**
310
- * Düğümün runtime prop'larının parmak izi (`@ng-apps/flow` → flow-runtime-props.ts,
311
- * `window.__ngAppsReadProps`). `undefined` okuyucu yayınlanmıyor (eski runtime) ya da prop'lar
312
- * serileşmiyor; `null` hiçbir makine düğümü tanımıyor; dize karşılaştırılabilir iz.
313
- */
314
- export function runtimePropsScript(elementId) {
315
- return `(function () { /* runtimePropsSnapshot */
316
- var read = window.__ngAppsReadProps;
317
- if (typeof read !== 'function') return undefined;
318
- try { var props = read(${JSON.stringify(elementId)}); return props === null ? null : JSON.stringify(props); } catch (error) { return undefined; }
319
- })()`;
320
- }
321
- /**
322
- * Hangi sekme AÇIK? `tab` adımı tıklamanın işe yarayıp yaramadığını ancak bununla kanıtlar:
323
- * tıklama "uygulandı" dese de bileşen seçimi kendi `selected` prop'una yazmamış olabilir.
324
- * `undefined` düğüm yok, `null` sekme grubu var ama hiçbiri seçili değil.
325
- */
326
- export function activeTabScript(elementId) {
327
- return `(function () { /* activeTabSnapshot */
328
- var root = document.querySelector(${JSON.stringify(`[data-element-id="${elementId}"]`)});
329
- if (!root) return undefined;
330
- var active = root.querySelector('[role="tab"][aria-selected="true"]');
331
- return active ? String(active.textContent || '').replace(/\\s+/g, ' ').trim() : null;
332
- })()`;
333
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,80 +0,0 @@
1
- import { maskSecretText } from '../secrets.js';
2
- const bufferLimit = 20;
3
- const reportLimit = 5;
4
- const textLimit = 300;
5
- const stackLines = 5;
6
- const clip = (text) => (text.length > textLimit ? `${text.slice(0, textLimit - 1)}…` : text);
7
- /**
8
- * Çekim boyunca tarayıcı konsolunun hata/uyarı satırları ve yakalanmamış istisnalar. Koşuda sayfa
9
- * çizilmediğinde `page_screenshot` yalnız "runtime hiç render olmadı" diyordu; nedeni bulmak için
10
- * ajan kendi Playwright betiğini yazıp Studio paketinin sıkıştırılmış kaynağını okudu
11
- * (plans/mobil-plantcare-acigi g-06). Aynı metin tekrarlanırsa sayaç artar, satır eklenmez; metin
12
- * kırpılır ve kimlik parçaları maskelenir.
13
- */
14
- export function createPageConsoleLog() {
15
- const consoleRecords = [];
16
- const pageErrorRecords = [];
17
- return {
18
- onConsole(message) {
19
- const type = message.type();
20
- const level = type === 'error' ? 'error' : type === 'warning' ? 'warning' : undefined;
21
- if (!level)
22
- return;
23
- const text = clip(maskSecretText(message.text()));
24
- const existing = consoleRecords.find(record => record.level === level && record.text === text);
25
- if (existing)
26
- existing.count += 1;
27
- else if (consoleRecords.length < bufferLimit)
28
- consoleRecords.push({ level, text, count: 1 });
29
- },
30
- onPageError(error) {
31
- if (pageErrorRecords.length >= bufferLimit)
32
- return;
33
- const message = clip(maskSecretText(error instanceof Error ? `${error.name}: ${error.message}` : String(error)));
34
- const stack = error instanceof Error && error.stack
35
- ? maskSecretText(error.stack.split('\n').slice(1, stackLines + 1).map(line => line.trim()).join('\n'))
36
- : undefined;
37
- if (!pageErrorRecords.some(record => record.message === message))
38
- pageErrorRecords.push({ message, ...(stack ? { stack } : {}) });
39
- },
40
- /** Önce hatalar, sonra uyarılar; en çok beş kayıt. */
41
- consoleErrors() {
42
- return [...consoleRecords.filter(record => record.level === 'error'), ...consoleRecords.filter(record => record.level === 'warning')].slice(0, reportLimit);
43
- },
44
- pageErrors() {
45
- return pageErrorRecords.slice(0, reportLimit);
46
- }
47
- };
48
- }
49
- const failureLimit = 3;
50
- /**
51
- * Çizilemeyen sayfanın hata metnine eklenen nedenler: çöken düğümler, yakalanmamış istisnalar, konsol
52
- * hataları — bu sırayla, her birinden en çok üç; uyarılar eklenmez. Hiçbiri yoksa boş. Yalnız ilk neden
53
- * yazılırken sayfa istisnası React'in bileşeni adlandıran konsol satırını gizliyordu.
54
- */
55
- export function describePageFailure(log, renderErrors) {
56
- const crashed = renderErrors.slice(0, failureLimit).map(record => `${record.elementId ?? '?'} — ${record.message}`);
57
- const thrown = log.pageErrors().slice(0, failureLimit).map(record => `${record.message}${record.stack ? ` (${record.stack.split('\n')[0]})` : ''}`);
58
- const logged = log.consoleErrors().filter(record => record.level === 'error').slice(0, failureLimit).map(record => record.text);
59
- return [
60
- crashed.length ? ` Çöken düğüm: ${crashed.join('; ')}.` : '',
61
- thrown.length ? ` Sayfa istisnası: ${thrown.join('; ')}.` : '',
62
- logged.length ? ` Konsol hatası: ${logged.join('; ')}.` : ''
63
- ].join('');
64
- }
65
- /**
66
- * Mobil çizicinin hata sınırlarının bıraktığı işaretler (`data-ng-render-error`). Düğümün dış sınırı
67
- * (kancaları çöken düğüm) yer tutucuyu kendi kabuğunun dışında çizer ve kimliği işaretin üstünde taşır
68
- * (`data-ng-render-error-id`); taşımıyorsa en yakın kabuk düğümdür.
69
- */
70
- export const renderErrorsScript = "Array.from(document.querySelectorAll('[data-ng-render-error]')).slice(0, 20).map(function (el) { var own = el.getAttribute('data-ng-render-error-id'); var owner = own ? null : el.closest('[data-element-id]'); return { elementId: own || (owner ? owner.getAttribute('data-element-id') : undefined), message: el.getAttribute('data-ng-render-error') || '' }; })";
71
- export function parseRenderErrors(value) {
72
- if (!Array.isArray(value))
73
- return [];
74
- return value
75
- .filter((entry) => entry !== null && typeof entry === 'object')
76
- .map(entry => ({
77
- ...(typeof entry.elementId === 'string' ? { elementId: entry.elementId } : {}),
78
- message: clip(maskSecretText(typeof entry.message === 'string' ? entry.message : ''))
79
- }));
80
- }
@@ -1,11 +0,0 @@
1
- /**
2
- * Ekran görüntüsü çekirdeği (plans/mobil-uygulama-expo G3): tarayıcı sözleşmesi, hazırlık kararı,
3
- * etkileşim eylemleri, DOM özeti ve çekim döngüsü ayrı modüllerde; platforma göre değişen
4
- * kısım yakalama HEDEFİDİR (`target.ts`, `targets/*`).
5
- */
6
- export * from './browser.js';
7
- export * from './actions.js';
8
- export * from './summary.js';
9
- export * from './readiness.js';
10
- export * from './capture.js';
11
- export * from './console-log.js';
@@ -1,103 +0,0 @@
1
- /**
2
- * Kare ne zaman hazır? (G-30 → B-6, 2026-09-07)
3
- *
4
- * `delayMs` TAHMİNDİ; 09-05'te runtime koşan akış sayacını yayınlamaya başladı (`@ng-apps/flow`
5
- * → flow-runtime-errors.ts) ve bekleme "running sıfır, completed > 0" olunca bitiyordu. Bu şart
6
- * mount akışı OLMAYAN sayfada (giriş ekranı) hiç sağlanmaz; akış tetiklemeyen `set` eylemi de
7
- * `completed`'ı artırmaz. 09-06·2 koşusunda üç eylemli giriş denemesi bu yüzden 47 sn sürdü;
8
- * sentetik ölçümde sayfa 0.3 sn'de hazırken aynı çağrı 48 sn'ydi — süre sayfanın değil, bu
9
- * döngünün. Hazırlık artık TEK anlık görüntüden okunur: akış sayacı + Studio'nun yükleme
10
- * iskeleti (`ViewDetail.svelte` → `.view-detail > .bx--skeleton__placeholder`) + runtime
11
- * düğümleri (`[data-element-id]`) + hata/bulunamadı hâli + adres. Karar `decideReadiness`'ta.
12
- *
13
- * Yüklenmemiş kare ASLA dönmez: bütçe dolduğunda sayfa hâlâ hazır değilse çağrı hatayla düşer
14
- * (`captureUnready: true` teşhis kipi dışında). Bozuk sayfayı görmek istiyorsan hata mesajı
15
- * neyin görüldüğünü zaten söyler.
16
- */
17
- export const readinessScript = `(function () { /* readinessSnapshot */
18
- var activity = window.__ngAppsFlowActivity;
19
- return {
20
- activity: activity && typeof activity.running === 'number' && typeof activity.completed === 'number' ? { running: activity.running, completed: activity.completed } : null,
21
- runtimeNodes: document.querySelectorAll('[data-element-id]').length,
22
- skeleton: !!document.querySelector('.view-detail > .bx--skeleton__placeholder'),
23
- viewDetail: !!document.querySelector('.view-detail'),
24
- errorState: !!document.querySelector('.view-detail__error, .view-detail .error-page'),
25
- readyState: String(document.readyState),
26
- href: String(location.href)
27
- };
28
- })()`;
29
- /** Okunan değer gerçekten sayaç mı; değilse sayfa sayaç yayınlamıyordur (eski runtime). */
30
- export function isFlowActivity(activity) {
31
- if (!activity || typeof activity !== 'object')
32
- return false;
33
- const { running, completed } = activity;
34
- return typeof running === 'number' && typeof completed === 'number';
35
- }
36
- /** Tarayıcıdan dönen değer anlık görüntü mü; yönlendirme sırasında evaluate düşer ve undefined kalır. */
37
- export function parseReadiness(raw) {
38
- if (!raw || typeof raw !== 'object')
39
- return undefined;
40
- const value = raw;
41
- if (typeof value.runtimeNodes !== 'number' || typeof value.href !== 'string')
42
- return undefined;
43
- return {
44
- activity: isFlowActivity(value.activity) ? { running: value.activity.running, completed: value.activity.completed } : null,
45
- runtimeNodes: value.runtimeNodes,
46
- skeleton: value.skeleton === true,
47
- viewDetail: value.viewDetail === true,
48
- errorState: value.errorState === true,
49
- readyState: String(value.readyState ?? ''),
50
- href: value.href
51
- };
52
- }
53
- /** `/dev` ve `/view` aynı sayfadır (Studio `hooks.ts` reroute); yönlendirme kararı yalnız yoldan verilir. */
54
- export function runtimePath(url) {
55
- try {
56
- return new URL(url).pathname.replace(/^\/dev\//, '/view/').replace(/\/+$/, '');
57
- }
58
- catch {
59
- return url;
60
- }
61
- }
62
- /** "Hiç akış koşmadı" kararı için DOM'un kaç yoklama değişmemesi gerekir (~600 ms = eski settleMs). */
63
- const quietPolls = 5;
64
- /** Sayaç yayınlanmayan runtime'da tek kanıt DOM durulmasıdır; daha uzun beklenir (~1 sn). */
65
- const legacyQuietPolls = 8;
66
- /** Runtime dışına yönlendirme: hedef sayfanın kendi JS'i çizmeyi bitirsin (~1.5 sn). */
67
- const redirectQuietPolls = 12;
68
- /**
69
- * Tek anlık görüntüden "kare alınabilir" kararı; iki uçta da yanlış beklememek için tek yerde.
70
- * `quiet` görüntünün kaç yoklamadır değişmediğidir, `completedBefore` bu beklemenin başındaki
71
- * bitmiş akış sayısı (sayfa değiştiyse çağıran sıfırlar). İskelet görünüyorsa hiçbir karar yok.
72
- */
73
- export function decideReadiness(snapshot, quiet, completedBefore, baselineUrl) {
74
- if (snapshot.skeleton)
75
- return undefined;
76
- const { activity } = snapshot;
77
- const idle = activity !== null && activity.running === 0;
78
- if (idle && activity.completed > completedBefore && snapshot.runtimeNodes > 0)
79
- return 'ready';
80
- if (idle && snapshot.runtimeNodes > 0 && quiet >= quietPolls)
81
- return 'ready-no-flows';
82
- if (activity === null && snapshot.runtimeNodes > 0 && quiet >= legacyQuietPolls)
83
- return 'ready-no-counter';
84
- if (idle && snapshot.errorState && quiet >= quietPolls)
85
- return 'error';
86
- if (!snapshot.viewDetail && snapshot.readyState === 'complete' && baselineUrl !== undefined && runtimePath(snapshot.href) !== runtimePath(baselineUrl) && quiet >= redirectQuietPolls)
87
- return 'redirected';
88
- return undefined;
89
- }
90
- /** Hata mesajı için: bütçe dolduğunda sayfada NE görüldü. */
91
- export function describeUnready(readiness, apiNote) {
92
- const snapshot = readiness.snapshot;
93
- const suffix = apiNote === undefined ? '' : ` · ${apiNote}`;
94
- if (!snapshot)
95
- return `tarayıcı sayfayı hiç değerlendiremedi (sürekli yönlendirme ya da bağlam düştü)${suffix}`;
96
- if (snapshot.skeleton)
97
- return `sayfa hâlâ yükleme iskeletinde${suffix}`;
98
- if (snapshot.activity && snapshot.activity.running > 0)
99
- return `${snapshot.activity.running} akış hâlâ koşuyor (${snapshot.activity.completed} bitti)${suffix}`;
100
- if (snapshot.runtimeNodes === 0)
101
- return `runtime hiç render olmadı — data-element-id taşıyan düğüm yok${snapshot.viewDetail ? '' : ', .view-detail kabı da yok'}${suffix}`;
102
- return `sayfa durulmadı (${snapshot.runtimeNodes} düğüm, sayaç ${snapshot.activity ? `${snapshot.activity.running} koşan / ${snapshot.activity.completed} biten` : 'yok'})${suffix}`;
103
- }