@appaflytech/zeyrek-ai-mcp 0.0.58 → 0.0.59
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.
- package/dist/platform/bodyFile.js +26 -1
- package/dist/platform/responses.js +2 -1
- package/dist/platform/strictArguments.js +7 -4
- package/dist/resources/guides/microfunction.md +8 -0
- package/dist/resources/guides/microservice.md +3 -1
- package/dist/tools/microfunctions.js +58 -8
- package/dist/tools/microservices.js +8 -1
- package/dist/tools/platformInfo.js +1 -1
- package/package.json +1 -1
|
@@ -98,7 +98,7 @@ async function allowedRoots(config) {
|
|
|
98
98
|
* reddedilir. Bu pencereyi DARALTIR, kapatmaz — iki denetim arasında geri çevrilen bir bağ yine görülmez; tam çözüm
|
|
99
99
|
* (`openat2` RESOLVE_BENEATH) Node'da yoktur. Okunan bayt yine de açılan tutamaçtan gelir.
|
|
100
100
|
*/
|
|
101
|
-
async function readGuardedFile(tool, label, absolute, extensions, maxBytes, roots, config) {
|
|
101
|
+
async function readGuardedFile(tool, label, absolute, extensions, maxBytes, roots, config, tooLarge) {
|
|
102
102
|
const accepted = extensions.join(', ');
|
|
103
103
|
if (!extensions.includes(extname(absolute).toLowerCase())) {
|
|
104
104
|
throw new PlatformApiError(`${tool}: ${label} yalnız ${accepted} okur — verilen: ${absolute}. İstek gönderilmedi.`, 400);
|
|
@@ -145,6 +145,8 @@ async function readGuardedFile(tool, label, absolute, extensions, maxBytes, root
|
|
|
145
145
|
bytesRead += chunk.bytesRead;
|
|
146
146
|
}
|
|
147
147
|
if (bytesRead > maxBytes) {
|
|
148
|
+
if (tooLarge)
|
|
149
|
+
throw new PlatformApiError(`${tool}: ${label} ${tooLarge} İstek gönderilmedi.`, 400);
|
|
148
150
|
throw new PlatformApiError(maxBytes === maxBodyFileBytes
|
|
149
151
|
? `${tool}: ${label} 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.`
|
|
150
152
|
: `${tool}: ${label} ${maxBytes / (1024 * 1024)} MB sınırını aşıyor — ${real}. Kodu birden çok dosyaya bölün. İstek gönderilmedi.`, 400);
|
|
@@ -258,3 +260,26 @@ async function includeFiles(tool, value, folder, bodyBytes, roots, config) {
|
|
|
258
260
|
}
|
|
259
261
|
return { value: replaceInclusions(value, '', texts), files };
|
|
260
262
|
}
|
|
263
|
+
/**
|
|
264
|
+
* 2026-10-30, QM SAML girişi (ADR 0027): inline microfunction kodu dosyadan okunur. Paketlenmiş `saml-dogrula`
|
|
265
|
+
* 433 KB'tı; satır içi `code` onu bütünüyle ajan bağlamından geçirirdi. Dosya JSON değil ham kaynaktır (`.js` /
|
|
266
|
+
* `.py`) ve backend'in `MaxInlineCodeBytes` sınırı (`MicrofunctionOptions.cs`, 524288) burada da denetlenir.
|
|
267
|
+
*/
|
|
268
|
+
export const CODE_FILE_TOOLS = new Set(['microfunction_create', 'microfunction_update']);
|
|
269
|
+
const maxCodeFileBytes = 524288;
|
|
270
|
+
export function codeFileParam() {
|
|
271
|
+
return z.string().min(1).optional().describe("'code' yerine okunacak yerel kaynak dosyası (.js ya da .py, en çok 512 KB — backend MaxInlineCodeBytes): kod ajan bağlamından geçmez, gateway dosyanın metnini 'code' olarak gönderir. 'code' 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 codeFile alanı hangi dosyanın okunduğunu söyler.");
|
|
272
|
+
}
|
|
273
|
+
export async function loadCodeFile(tool, args, config) {
|
|
274
|
+
if (!CODE_FILE_TOOLS.has(tool) || !args || typeof args !== 'object' || Array.isArray(args))
|
|
275
|
+
return { args };
|
|
276
|
+
const { codeFile, ...rest } = args;
|
|
277
|
+
if (typeof codeFile !== 'string' || codeFile.length === 0)
|
|
278
|
+
return { args };
|
|
279
|
+
if (rest.code !== undefined) {
|
|
280
|
+
throw new PlatformApiError(`${tool}: codeFile ile 'code' birlikte verilemez — kod ya dosyadan ya satır içinden gelir. Birini kaldırın. İstek gönderilmedi.`, 400);
|
|
281
|
+
}
|
|
282
|
+
const base = config.inputDirectory ? resolve(config.inputDirectory) : process.cwd();
|
|
283
|
+
const code = await readGuardedFile(tool, 'codeFile', resolve(base, codeFile), ['.js', '.py'], maxCodeFileBytes, await allowedRoots(config), config, "512 KB inline sınırını (backend MaxInlineCodeBytes) aşıyor. Paketi küçültün (minify, yinelenen bağımlılık) ya da sourceKind: 'archive' ile zip'i Studio'dan yükleyin.");
|
|
284
|
+
return { args: { ...rest, code: code.buffer.toString('utf8') }, note: `${code.real} → code (${code.buffer.length} B)` };
|
|
285
|
+
}
|
|
@@ -193,7 +193,8 @@ export function toolResult(payload, config, expectFailure) {
|
|
|
193
193
|
...(Object.keys(tokenRefs).length > 0 ? { tokenRefs, tokenRefNote: `Maskelenen JWT'ler gateway içinde tutuldu; bu referansları microservice_execute / microservice_debug / page_runtime_get / page_screenshot 'asUser' alanına verebilirsiniz (${tokenTtlMinutes()} dk geçerli; kompleks projede referans access_session_create'ten gelir). Jetonun kendisi yanıta ve günlüğe hiç girmez.` } : {}),
|
|
194
194
|
...(truncated ? { truncated: true, truncationNote: 'Liste, yanıt boyutu sınırı nedeniyle kırpıldı; sayfalama ya da daha dar filtre kullanın.' } : {}),
|
|
195
195
|
...(argumentNotes().aliasesApplied.length > 0 ? { aliasesApplied: argumentNotes().aliasesApplied } : {}),
|
|
196
|
-
...(argumentNotes().bodyFile ? { bodyFile: argumentNotes().bodyFile } : {})
|
|
196
|
+
...(argumentNotes().bodyFile ? { bodyFile: argumentNotes().bodyFile } : {}),
|
|
197
|
+
...(argumentNotes().codeFile ? { codeFile: argumentNotes().codeFile } : {})
|
|
197
198
|
};
|
|
198
199
|
return {
|
|
199
200
|
content: [{ type: 'text', text: JSON.stringify(enriched) }],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { diagnosticsParam, runWithDiagnostics } from './diagnostics.js';
|
|
3
3
|
import { applyArgumentAliases, closestArgument, runWithArgumentNotes } from './argumentAliases.js';
|
|
4
|
-
import { BODY_FILE_ARGUMENTS, bodyFileParam, loadBodyFile } from './bodyFile.js';
|
|
4
|
+
import { BODY_FILE_ARGUMENTS, CODE_FILE_TOOLS, bodyFileParam, codeFileParam, loadBodyFile, loadCodeFile } from './bodyFile.js';
|
|
5
5
|
import { PlatformApiError } from './errors.js';
|
|
6
6
|
import { logError } from '../observability/trace.js';
|
|
7
7
|
/** Doğrulanmış argümanlara takılan çeviri notları (`ArgumentNotes`); JSON'a ve platform isteğine girmez. */
|
|
@@ -46,15 +46,17 @@ export function rejectUnknownArguments(server, platform) {
|
|
|
46
46
|
const validate = validator.validateToolInput.bind(server);
|
|
47
47
|
validator.validateToolInput = async (tool, args, name) => {
|
|
48
48
|
try {
|
|
49
|
-
const
|
|
49
|
+
const body = await loadBodyFile(name, args, platform.config);
|
|
50
|
+
const code = await loadCodeFile(name, body.args, platform.config);
|
|
51
|
+
const loaded = { args: code.args, note: body.note };
|
|
50
52
|
const requiredBody = requiredBodies.get(name);
|
|
51
53
|
if (requiredBody && loaded.args?.[requiredBody] === undefined) {
|
|
52
54
|
throw new PlatformApiError(`${name}: '${requiredBody}' zorunlu — satır içinde ya da bodyFile ile (.json dosyası) verin. İstek gönderilmedi.`, 400);
|
|
53
55
|
}
|
|
54
56
|
const { args: aliased, applied } = await applyArgumentAliases(name, loaded.args, { platform, shape: tool.inputSchema?.shape ?? {} });
|
|
55
57
|
const parsed = await validate(tool, aliased, name);
|
|
56
|
-
const notes = { aliasesApplied: applied, ...(loaded.note ? { bodyFile: loaded.note } : {}) };
|
|
57
|
-
return (applied.length > 0 || loaded.note) && parsed && typeof parsed === 'object' ? Object.assign(parsed, { [ARGUMENT_NOTES]: notes }) : parsed;
|
|
58
|
+
const notes = { aliasesApplied: applied, ...(loaded.note ? { bodyFile: loaded.note } : {}), ...(code.note ? { codeFile: code.note } : {}) };
|
|
59
|
+
return (applied.length > 0 || loaded.note || code.note) && parsed && typeof parsed === 'object' ? Object.assign(parsed, { [ARGUMENT_NOTES]: notes }) : parsed;
|
|
58
60
|
}
|
|
59
61
|
catch (error) {
|
|
60
62
|
// Doğrulamadan önceki çeviri (dosya, takma ad) `handle`'ın dışında koşar: hata burada günlüğe yazılır.
|
|
@@ -81,6 +83,7 @@ export function rejectUnknownArguments(server, platform) {
|
|
|
81
83
|
const shape = {
|
|
82
84
|
...config.inputSchema,
|
|
83
85
|
...(bodyArgument && bodySchema ? { [bodyArgument]: bodySchema.optional(), bodyFile: bodyFileParam(bodyArgument) } : {}),
|
|
86
|
+
...(CODE_FILE_TOOLS.has(name) ? { codeFile: codeFileParam() } : {}),
|
|
84
87
|
...(exposesDiagnostics ? { diagnostics: diagnosticsParam } : {})
|
|
85
88
|
};
|
|
86
89
|
const invoke = (args, extra) => {
|
|
@@ -279,6 +279,14 @@ Paketler zip'teki `requirements.txt` / `package.json`'a yazılır ve Built-In ya
|
|
|
279
279
|
- **Tek parça zip yükleme ve indirme MCP'de yok:** zip'in içeriği dosya düzeyinde okunur ve yazılır
|
|
280
280
|
(§Zip kaynağı). Zip'in tamamı platform ucunda okunabilir durumdadır
|
|
281
281
|
(`GET /{proje}/microfunctions/{id}/archive`, `application/zip`) ve Studio'dan indirilir.
|
|
282
|
+
- **Büyük kod dosyadan verilir:** `microfunction_create` / `microfunction_update` `codeFile` ile `.js` / `.py` dosyasını
|
|
283
|
+
okur (inline sınırı **512 KB**, `MaxInlineCodeBytes`) ve metnini `code` olarak gönderir — kod ajan bağlamından geçmez; `code` ile birlikte verilemez. Yazma yanıtı kodu geri
|
|
284
|
+
getirmez (uzunluk + SHA-256 özeti); `microfunction_get` / `_list` 64 KB üstü kodu aynı özete indirir — yerel paketle
|
|
285
|
+
karşılaştırmak için özeti kullanın.
|
|
286
|
+
- **Ortam değişkeni başka kayıttan kopyalanır:** `environmentFrom: <microfunction id>` kaynağın değişkenlerini gateway'de
|
|
287
|
+
kopyalar, değerler yanıtta `***` döner; `environmentVariables` aynı anahtarda kazanır. **Güncellemede değişkenleri
|
|
288
|
+
korumanın yolu budur** (`environmentFrom` = kaydın kendi id'si): PUT gövdesinde `environmentVariables` yoksa platform
|
|
289
|
+
hepsini siler.
|
|
282
290
|
- `timeoutSeconds` ve `memoryMb` komutta non-nullable int'tir: **göndermezseniz 0 gider ve platform
|
|
283
291
|
422 döner.** Gateway değer uydurmaz, eksikliği çağrıdan önce söyler (MF-001, block; ürün
|
|
284
292
|
varsayılanları 30 / 256). Aynı kural provider ↔ `runtimeId` eşleşmesini, inline kaynakta `code`
|
|
@@ -124,7 +124,9 @@ servis formunda görünür ve `microservice_get` outline görünümünde geri ok
|
|
|
124
124
|
adım adım executionItems ağacı döner. Zamanlanmış (`schedule-job`) uçta sıra farklıdır:
|
|
125
125
|
`workflow_preview` → `microservice_debug` → `microservice_schedule_control` `trigger` →
|
|
126
126
|
`microservice_job_history`; geçmişteki `completed` başarı kanıtı DEĞİLDİR (§Zamanlanmış işin
|
|
127
|
-
gerçek sonucunu görmek).
|
|
127
|
+
gerçek sonucunu görmek). **`microservice_debug` production'da kapalıdır** (adım izi giriş
|
|
128
|
+
istemeden okunur; platform 404 döner, gateway isteği göndermez): debug development'ta ya da
|
|
129
|
+
dalda yapılır, production'da `microservice_execute` + `microservice_job_history` kalır.
|
|
128
130
|
Çağrı parametrelerini (sorgu parametresi, filtre değeri) üst düzey `parameters: { ad: değer }`
|
|
129
131
|
ile ver; gateway GET'te query-string'e, POST/PUT'ta gövdeye koyar. Değeri NULL bağlanan query
|
|
130
132
|
parametresini debug yanıtı `unboundParameters` ile söyler — ağaçta o satırın `value` anahtarı
|
|
@@ -4,7 +4,9 @@ import { unmappedMembers, withUnmappedMembers } from '../knowledge/schemaGuard.j
|
|
|
4
4
|
import { evaluatePolicy, enforcePolicy, attachFindings } from '../knowledge/policy.js';
|
|
5
5
|
import { policyRules, microfunctionArchiveEntrypointFindings } from '../knowledge/rules.js';
|
|
6
6
|
import { handle } from '../platform/responses.js';
|
|
7
|
+
import { PlatformApiError } from '../platform/errors.js';
|
|
7
8
|
import { z } from 'zod';
|
|
9
|
+
import { createHash } from 'node:crypto';
|
|
8
10
|
const policyOverrideParam = z.boolean().optional()
|
|
9
11
|
.describe("true: politika block bulgularını warn'a indirir (bilinçli istisna; yanıtta işaretlenir)");
|
|
10
12
|
const behaviorParam = z.enum(['primitive', 'object', 'array']);
|
|
@@ -29,6 +31,7 @@ const definitionInput = {
|
|
|
29
31
|
timeoutSeconds: z.number().int().min(1).max(900).optional().describe("Fonksiyon bütçesi; varsayılan 30. Built-In üst sınırı 300, Lambda 900. Bütçe dolarsa çağrı MicrofunctionInvocationTimeoutException ile step'in fail dalına düşer"),
|
|
30
32
|
memoryMb: z.number().int().min(128).max(3008).optional().describe("Varsayılan 256. Built-In'de yalnız kaydedilir (küme environment limiti geçerlidir); Lambda'da gerçekten uygulanır"),
|
|
31
33
|
environmentVariables: environmentVariablesParam.optional(),
|
|
34
|
+
environmentFrom: guid.optional().describe("Ortam değişkenlerini bu microfunction'dan kopyalar: gateway kaynağı okur, değerler ajan bağlamından geçmez ve yanıtta '***' döner. environmentVariables ile birlikte verilirse aynı anahtarda environmentVariables kazanır. GÜNCELLEMEDE değişkenleri korumak için kaydın kendi id'sini verin: PUT gövdesinde environmentVariables yoksa platform hepsini siler (Microfunction.cs, environmentVariables ?? [])"),
|
|
32
35
|
dependencies: z.string().optional().describe("Inline kaynağın dış paketleri, SATIR BAŞINA BİR PAKET (≤ 16 KB; boş ve '#' satırları yorum). python: requirements.txt satırı olduğu gibi — 'pillow==11.1.0', 'requests>=2.32'; pip seçeneği ('-r', '--index-url', '-e') YASAK. node: 'ad@aralık' — 'sharp@^0.33.0', '@scope/ad@1.2', aralıksız 'dayjs' → latest. Built-In'de yayın paketleri Fission builder'da kurar: yayın build süresince (5 dk'ya kadar) 'publishing' kalır, kurulum düşerse publish-failed ve publishError'da build günlüğünün son 4 KB'ı. aws-lambda'da KURULMAZ (MF-007) — paketler zip'te gelmeli. archive kaynağında yok sayılır (manifest zip'te). Built-In Python 3.13, Node 22 (Lambda'daki sürümlerle aynı); C uzantılı paketler (Pillow gibi) hazır wheel'den kurulur"),
|
|
33
36
|
testArguments: z.string().optional().describe("Studio Test call'unun kayıtlı argüman metni (≤ 64 KB, MicrofunctionTestArgumentsTooLarge); olduğu gibi saklanır, JSON geçerliliği DENETLENMEZ ve koşuma girmez. update TAM GÖVDEDİR: verilmezse kayıtlı metin silinir — önce microfunction_get'ten alın. Kaydetmek revision'ı artırır (yayındaki kayıt hasUnpublishedChanges: true olur)"),
|
|
34
37
|
publish: z.boolean().optional().describe("true: kayıt açıldıktan/güncellendikten sonra aynı çağrıda yayın istenir ('Kaydet ve yayınla'). Yayın ASENKRONDUR — çağrı status: 'publishing' döner; sonucu microfunction_get ile izleyin (published | publish-failed + publishError)")
|
|
@@ -48,6 +51,51 @@ const runtimeInput = {
|
|
|
48
51
|
secretAccessKey: z.string().min(1).describe("AWS secret access key. Kayıt düz metin tutulur; platform DTO'da maskeler (**** + son 4), gateway bu tool'ların yanıtında değeri tümüyle '***' yapar"),
|
|
49
52
|
roleArn: z.string().optional().describe("Lambda execution rolü: arn:aws:iam::<12 hane>:role/<ad>. Rolü müşteri oluşturur; fonksiyon bu rolle koşar")
|
|
50
53
|
};
|
|
54
|
+
// 2026-10-30, QM SAML girişi (ADR 0027): kayıtlı bir anahtarı (OIDC_SECRET_KEY) ikinci bir microfunction'a taşımak değeri çağrıya
|
|
55
|
+
// düz yazmayı gerektiriyordu; güncellemede de PUT gövdesi değişkensizse platform hepsini siliyor. Kopya gateway'de yapılır ve
|
|
56
|
+
// yanıttaki değerler maskelenir — değer ne çağrıya ne yanıta girer.
|
|
57
|
+
async function withEnvironmentFrom(platform, project, environment, body, sourceId) {
|
|
58
|
+
if (!sourceId)
|
|
59
|
+
return body;
|
|
60
|
+
let source;
|
|
61
|
+
try {
|
|
62
|
+
source = await platform.tenant('GET', project, `/microfunctions/${sourceId}`, { environment });
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw new PlatformApiError(`environmentFrom (${sourceId}) okunamadı: ${error instanceof Error ? error.message : String(error)}. Kaynak kayıt bu projede ve bu ortamda olmalı (microfunction_list). İstek gönderilmedi.`, 400);
|
|
66
|
+
}
|
|
67
|
+
const record = source?.data ?? source;
|
|
68
|
+
const copied = record?.environmentVariables;
|
|
69
|
+
const variables = copied && typeof copied === 'object' && !Array.isArray(copied) ? copied : {};
|
|
70
|
+
return { ...body, environmentVariables: { ...variables, ...body.environmentVariables } };
|
|
71
|
+
}
|
|
72
|
+
// 2026-10-30 canlı koşu: platform yazılan kaydı `code` ile birlikte döndürüyor; codeFile ile gönderilen 433 KB'lık saml-dogrula
|
|
73
|
+
// yanıtta 283 bin karakter olarak geri geldi. Yazmada kod hiç yansıtılmaz (çağıran onu gönderdi); okumada 64 KB üstü kod özetlenir.
|
|
74
|
+
const codeSummaryBytes = 64 * 1024;
|
|
75
|
+
function summarizeCode(value, always) {
|
|
76
|
+
if (!value || typeof value !== 'object')
|
|
77
|
+
return value;
|
|
78
|
+
if (Array.isArray(value))
|
|
79
|
+
return value.map(item => summarizeCode(item, always));
|
|
80
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
81
|
+
if (key !== 'code' || typeof entry !== 'string')
|
|
82
|
+
return [key, summarizeCode(entry, always)];
|
|
83
|
+
const bytes = Buffer.byteLength(entry, 'utf8');
|
|
84
|
+
if (!always && bytes <= codeSummaryBytes)
|
|
85
|
+
return [key, entry];
|
|
86
|
+
return [key, `[kod yanıtta gösterilmez: ${bytes} bayt, sha256 ${createHash('sha256').update(entry, 'utf8').digest('hex')}]`];
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
function maskEnvironmentValues(value, active) {
|
|
90
|
+
if (!active || !value || typeof value !== 'object')
|
|
91
|
+
return value;
|
|
92
|
+
if (Array.isArray(value))
|
|
93
|
+
return value.map(item => maskEnvironmentValues(item, active));
|
|
94
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key,
|
|
95
|
+
key === 'environmentVariables' && entry && typeof entry === 'object' && !Array.isArray(entry)
|
|
96
|
+
? Object.fromEntries(Object.keys(entry).map(name => [name, '***']))
|
|
97
|
+
: maskEnvironmentValues(entry, active)]));
|
|
98
|
+
}
|
|
51
99
|
export function registerMicrofunctionTools(server, platform) {
|
|
52
100
|
const config = platform.config;
|
|
53
101
|
server.registerTool('microfunction_list', {
|
|
@@ -61,35 +109,37 @@ export function registerMicrofunctionTools(server, platform) {
|
|
|
61
109
|
...pagingParams
|
|
62
110
|
},
|
|
63
111
|
annotations: readOnly
|
|
64
|
-
}, handle(config, ({ project, environment, status, searchTerm, pageIndex, pageLength, order, isDescending }) => platform.tenant('GET', project, '/microfunctions', {
|
|
112
|
+
}, handle(config, async ({ project, environment, status, searchTerm, pageIndex, pageLength, order, isDescending }) => summarizeCode(await platform.tenant('GET', project, '/microfunctions', {
|
|
65
113
|
environment,
|
|
66
114
|
query: { status, searchTerm, pageIndex: pageIndex ?? 0, pageLength: pageLength ?? 200, order, isDescending }
|
|
67
|
-
})));
|
|
115
|
+
}), false)));
|
|
68
116
|
server.registerTool('microfunction_get', {
|
|
69
117
|
title: 'Microfunction getir',
|
|
70
|
-
description: "Tek bir microfunction'ın tanımını ve yayın durumunu getirir: status, revision/publishedRevision, hasUnpublishedChanges (kayıt yayında ama üstüne yazılmış), publishError, parameterScheme/returnScheme. Yayın asenkron olduğu için 'publishing' durumunda birkaç saniye arayla tekrar çağırın.",
|
|
118
|
+
description: "Tek bir microfunction'ın tanımını ve yayın durumunu getirir: status, revision/publishedRevision, hasUnpublishedChanges (kayıt yayında ama üstüne yazılmış), publishError, parameterScheme/returnScheme. Yayın asenkron olduğu için 'publishing' durumunda birkaç saniye arayla tekrar çağırın. 64 KB üstü kod yanıtta uzunluk ve SHA-256 özetine indirilir; yerel paketle karşılaştırmak için özeti kullanın.",
|
|
71
119
|
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
72
120
|
annotations: readOnly
|
|
73
|
-
}, handle(config, ({ project, environment, id }) => platform.tenant('GET', project, `/microfunctions/${id}`, { environment })));
|
|
121
|
+
}, handle(config, async ({ project, environment, id }) => summarizeCode(await platform.tenant('GET', project, `/microfunctions/${id}`, { environment }), false)));
|
|
74
122
|
server.registerTool('microfunction_create', {
|
|
75
123
|
title: 'Microfunction tanımla',
|
|
76
124
|
description: "Yeni microfunction kaydeder. Kayıt DRAFT doğar; yayına almadan hiçbir workflow step'i onu koşturamaz (publish: true ile aynı çağrıda yayın isteyebilirsiniz). Yayın adımı kodu runtime'a kurar ve bir 'probe' çağrısıyla duman testi yapar: sözdizimi/import hatası yayın anında publish-failed olur, koşumda değil. Protokol ve sınırlar: platform_guide('microfunction'). " + constraintSummary('CreateMicrofunctionCommand'),
|
|
77
125
|
inputSchema: { project: projectParam, environment: environmentParam, ...definitionInput, policyOverride: policyOverrideParam },
|
|
78
126
|
annotations: writes
|
|
79
|
-
}, handle(config, async ({ project, environment, policyOverride, ...
|
|
127
|
+
}, handle(config, async ({ project, environment, policyOverride, environmentFrom, ...input }) => {
|
|
128
|
+
const body = await withEnvironmentFrom(platform, project, environment, input, environmentFrom);
|
|
80
129
|
const findings = enforcePolicy(evaluatePolicy(config, policyRules, 'microfunction', body, { operation: 'create' }, policyOverride));
|
|
81
130
|
const drift = unmappedMembers('CreateMicrofunctionCommand', body);
|
|
82
|
-
return attachFindings(withUnmappedMembers(await platform.tenant('POST', project, '/microfunctions', { environment, body }), drift), findings);
|
|
131
|
+
return summarizeCode(maskEnvironmentValues(attachFindings(withUnmappedMembers(await platform.tenant('POST', project, '/microfunctions', { environment, body }), drift), findings), environmentFrom !== undefined), true);
|
|
83
132
|
}));
|
|
84
133
|
server.registerTool('microfunction_update', {
|
|
85
134
|
title: 'Microfunction güncelle',
|
|
86
135
|
description: "Microfunction'ın TAMAMINI değiştirir (PUT — değiştirmediğiniz alanları da gönderin; önce microfunction_get). Her güncelleme revision'ı artırır: yayındaki kayıt güncellenirse runtime ESKİ sürümü koşmaya devam eder ve kayıt hasUnpublishedChanges: true olur — yeni kodu canlıya almak için publish: true verin ya da microfunction_publish çağırın. PROVIDER YAYINDAYKEN DEĞİŞMEZ: bir kez yayınlanmış kaydın provider'ını değiştiren PUT 400 döner (MicrofunctionProviderChangeNotAllowedException) — kaydı silip yeniden oluşturun. " + constraintSummary('UpdateMicrofunctionCommand'),
|
|
87
136
|
inputSchema: { project: projectParam, environment: environmentParam, id: guid, ...definitionInput, policyOverride: policyOverrideParam },
|
|
88
137
|
annotations: updates
|
|
89
|
-
}, handle(config, async ({ project, environment, id, policyOverride, ...
|
|
138
|
+
}, handle(config, async ({ project, environment, id, policyOverride, environmentFrom, ...input }) => {
|
|
139
|
+
const body = await withEnvironmentFrom(platform, project, environment, input, environmentFrom);
|
|
90
140
|
const findings = enforcePolicy(evaluatePolicy(config, policyRules, 'microfunction', body, { operation: 'update' }, policyOverride));
|
|
91
141
|
const drift = unmappedMembers('UpdateMicrofunctionCommand', body);
|
|
92
|
-
return attachFindings(withUnmappedMembers(await platform.tenant('PUT', project, `/microfunctions/${id}`, { environment, body }), drift), findings);
|
|
142
|
+
return summarizeCode(maskEnvironmentValues(attachFindings(withUnmappedMembers(await platform.tenant('PUT', project, `/microfunctions/${id}`, { environment, body }), drift), findings), environmentFrom !== undefined), true);
|
|
93
143
|
}));
|
|
94
144
|
server.registerTool('microfunction_publish', {
|
|
95
145
|
title: 'Microfunction yayınla',
|
|
@@ -478,10 +478,17 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
478
478
|
}));
|
|
479
479
|
server.registerTool('microservice_debug', {
|
|
480
480
|
title: 'Microservice debug',
|
|
481
|
-
description: "Microservice'i debug modunda çalıştırır; yanıtta adım adım executionItems ağacı döner (her adımın girdi/çıktısı). executionItems YALNIZ ucun kendi adımlarını kapsar — ucun ÖNÜNDE koşan middleware'ler ayrıca 'middlewares' alanında adım özetiyle listelenir (09-04 Y-04). Değeri NULL bağlanan query parametreleri 'unboundParameters' alanında adıyla listelenir (ağaçta bu satırların value anahtarı görünmez). Preview semantiğiyle koşar: tek transaction + sonunda rollback, kalıcı satır yazmaz. httpStatus akışın kendi sonucudur (4xx/5xx'te runtimeErrors eklenir); ağaç düğümlerinde hata bayrağı YOKTUR — patlayan adımın output'u boştur, hata gövdesi hata dalındaki response adımının çıktısındadır. Zamanlanmış (schedule-job) uçlar da slug yoluyla debug edilir (method: 'POST', parametresiz): job geçmişi hatayı yalnız mesaj olarak yazar, adım adım girdi/çıktı burada görülür (platform_guide('microservice') §Zamanlanmış işin gerçek sonucunu görmek). Kompleks projede kullanıcı gözü asUserId (parolasız) ya da asUser ile verilir ve yanıta 'accessDecision' eklenir: { decision: allow | deny | not-enforced | unknown, mode, code?, permission?, reason, next } — 401/403'ün erişim kararından mı geldiğini ve sıradaki adımı söyler.",
|
|
481
|
+
description: "Microservice'i debug modunda çalıştırır; yanıtta adım adım executionItems ağacı döner (her adımın girdi/çıktısı). PRODUCTION'DA KAPALIDIR: istek gönderilmez, development'ta ya da dalda debug edin. executionItems YALNIZ ucun kendi adımlarını kapsar — ucun ÖNÜNDE koşan middleware'ler ayrıca 'middlewares' alanında adım özetiyle listelenir (09-04 Y-04). Değeri NULL bağlanan query parametreleri 'unboundParameters' alanında adıyla listelenir (ağaçta bu satırların value anahtarı görünmez). Preview semantiğiyle koşar: tek transaction + sonunda rollback, kalıcı satır yazmaz. httpStatus akışın kendi sonucudur (4xx/5xx'te runtimeErrors eklenir); ağaç düğümlerinde hata bayrağı YOKTUR — patlayan adımın output'u boştur, hata gövdesi hata dalındaki response adımının çıktısındadır. Zamanlanmış (schedule-job) uçlar da slug yoluyla debug edilir (method: 'POST', parametresiz): job geçmişi hatayı yalnız mesaj olarak yazar, adım adım girdi/çıktı burada görülür (platform_guide('microservice') §Zamanlanmış işin gerçek sonucunu görmek). Kompleks projede kullanıcı gözü asUserId (parolasız) ya da asUser ile verilir ve yanıta 'accessDecision' eklenir: { decision: allow | deny | not-enforced | unknown, mode, code?, permission?, reason, next } — 401/403'ün erişim kararından mı geldiğini ve sıradaki adımı söyler.",
|
|
482
482
|
inputSchema: executeInput,
|
|
483
483
|
annotations: writes
|
|
484
484
|
}, handle(config, async ({ project, environment, application, microservice, method, routeParams, query, body, parameters, headers, anonymous, asUser, asUserId, cookies, language }) => {
|
|
485
|
+
// Debug rotası [AllowAnonymous]'tır ve adım izini (girdi/çıktı, okunan sırlar dahil) döner;
|
|
486
|
+
// backend production'da 404 verir (DebugMicroserviceCommand, 2026-10-28). Gateway isteği
|
|
487
|
+
// göndermeden durur: o backend dağıtılmadan önce de iz production'dan okunmaz ve ara katmanlar
|
|
488
|
+
// ile dış çağrılar (http adımı, AD bind) koşmaz.
|
|
489
|
+
if (platform.resolveEnvironment(environment) === 'production') {
|
|
490
|
+
throw new PlatformApiError("microservice_debug: debug production'da kapalı — adım izi giriş istemeden okunabildiği için platform bu rotayı production'da reddeder; istek gönderilmedi. Akışı development'ta ya da bir dalda debug edin. Production'da sonucu microservice_execute ile, zamanlanmış işin hatasını microservice_job_history ile görün.", 400);
|
|
491
|
+
}
|
|
485
492
|
const notes = [];
|
|
486
493
|
const eye = await impersonationHeaders(platform, 'microservice_debug', project, environment, { asUserId, asUser, anonymous, ownAuthorization: hasAuthorization(headers) }, { runtime: true });
|
|
487
494
|
const member = anonymous === true ? asUser : await resolveIdentity(asUser, platform, project, environment);
|
|
@@ -103,7 +103,7 @@ export function registerPlatformTools(server, platform) {
|
|
|
103
103
|
'Modülün iş kuralları rehberini döner. Bir modülde İLK yazma işleminden önce ilgili rehberi okuyun:',
|
|
104
104
|
...guides.map(name => `- ${name}${guideRouting[name] ? `: ${guideRouting[name]}` : ''}`),
|
|
105
105
|
"Büyük rehberler (page ~120 KB) section'sız çağrıda TAM METİN DÖNMEZ: giriş + bölüm listesi (outline) döner, truncated: true olur. Gövdeyi section ile bölüm bölüm alın.",
|
|
106
|
-
"Büyük gövdeyi (sayfa şeması, akış adımları, uç/workflow tanımı, patch op'ları) dosyaya yazıp bodyFile ile verin: gövde bağlamınızdan geçmez, satır içiyle aynı doğrulamadan geçer (page_*/flow_*/microservice_*/workflow_* create/update/patch). Uzun kod alanı ayrı dosyada durabilir: gövdede { \"$file\": \"./adim.js\" } o dosyanın METNİYLE değişir (çalıştırılmaz; yol bodyFile'ın klasörüne göre, GW-013). microservice_execute yanıt başlıkları varsayılan kısadır; ucun kendi başlığı için includeHeaders:'all'.",
|
|
106
|
+
"Büyük gövdeyi (sayfa şeması, akış adımları, uç/workflow tanımı, patch op'ları) dosyaya yazıp bodyFile ile verin: gövde bağlamınızdan geçmez, satır içiyle aynı doğrulamadan geçer (page_*/flow_*/microservice_*/workflow_* create/update/patch); microfunction kodu codeFile ile (.js/.py). Uzun kod alanı ayrı dosyada durabilir: gövdede { \"$file\": \"./adim.js\" } o dosyanın METNİYLE değişir (çalıştırılmaz; yol bodyFile'ın klasörüne göre, GW-013). microservice_execute yanıt başlıkları varsayılan kısadır; ucun kendi başlığı için includeHeaders:'all'.",
|
|
107
107
|
"Örnek gövdeler ve kural katalogları (ngapps://examples/<ad>, ngapps://rules/<ad>) istemci MCP resource okuyamıyorsa da bu araçla okunur: platform_guide({ resource: 'ngapps://rules/connect-data' }) — guide verilmez; dizin için 'ngapps://examples/index'."
|
|
108
108
|
].join('\n');
|
|
109
109
|
server.registerTool('platform_whoami', {
|
package/package.json
CHANGED