create-mercato-app 0.6.7-develop.6834.1.e76f4b8cbc → 0.6.7-develop.6842.1.8cd8a8883c

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 (75) hide show
  1. package/agentic/shared/ai/agentic.config.json +1 -0
  2. package/agentic/shared/ai/trackers/github.md +2 -1
  3. package/dist/agentic/guides/module-facts.json +110 -110
  4. package/dist/agentic/guides/modules/ai_assistant.md +1 -1
  5. package/dist/agentic/guides/modules/api_docs.md +1 -1
  6. package/dist/agentic/guides/modules/api_keys.md +1 -1
  7. package/dist/agentic/guides/modules/attachments.md +1 -1
  8. package/dist/agentic/guides/modules/audit_logs.md +1 -1
  9. package/dist/agentic/guides/modules/auth.md +1 -1
  10. package/dist/agentic/guides/modules/business_rules.md +1 -1
  11. package/dist/agentic/guides/modules/catalog.md +1 -1
  12. package/dist/agentic/guides/modules/channel_gmail.md +1 -1
  13. package/dist/agentic/guides/modules/channel_imap.md +1 -1
  14. package/dist/agentic/guides/modules/checkout.md +1 -1
  15. package/dist/agentic/guides/modules/communication_channels.md +1 -1
  16. package/dist/agentic/guides/modules/configs.md +1 -1
  17. package/dist/agentic/guides/modules/content.md +1 -1
  18. package/dist/agentic/guides/modules/currencies.md +1 -1
  19. package/dist/agentic/guides/modules/customer_accounts.md +1 -1
  20. package/dist/agentic/guides/modules/customers.md +1 -1
  21. package/dist/agentic/guides/modules/dashboards.md +1 -1
  22. package/dist/agentic/guides/modules/data_sync.md +1 -1
  23. package/dist/agentic/guides/modules/design_system.md +1 -1
  24. package/dist/agentic/guides/modules/dictionaries.md +1 -1
  25. package/dist/agentic/guides/modules/directory.md +1 -1
  26. package/dist/agentic/guides/modules/entities.md +1 -1
  27. package/dist/agentic/guides/modules/events.md +1 -1
  28. package/dist/agentic/guides/modules/feature_toggles.md +1 -1
  29. package/dist/agentic/guides/modules/gateway_stripe.md +1 -1
  30. package/dist/agentic/guides/modules/generators.md +1 -1
  31. package/dist/agentic/guides/modules/inbox_ops.md +1 -1
  32. package/dist/agentic/guides/modules/integrations.md +1 -1
  33. package/dist/agentic/guides/modules/messages.md +1 -1
  34. package/dist/agentic/guides/modules/notifications.md +1 -1
  35. package/dist/agentic/guides/modules/onboarding.md +1 -1
  36. package/dist/agentic/guides/modules/payment_gateways.md +1 -1
  37. package/dist/agentic/guides/modules/perspectives.md +1 -1
  38. package/dist/agentic/guides/modules/planner.md +1 -1
  39. package/dist/agentic/guides/modules/portal.md +1 -1
  40. package/dist/agentic/guides/modules/progress.md +1 -1
  41. package/dist/agentic/guides/modules/query_index.md +1 -1
  42. package/dist/agentic/guides/modules/record_locks.md +1 -1
  43. package/dist/agentic/guides/modules/resources.md +1 -1
  44. package/dist/agentic/guides/modules/sales.md +1 -1
  45. package/dist/agentic/guides/modules/scheduler.md +1 -1
  46. package/dist/agentic/guides/modules/search.md +1 -1
  47. package/dist/agentic/guides/modules/security.md +1 -1
  48. package/dist/agentic/guides/modules/shipping_carriers.md +1 -1
  49. package/dist/agentic/guides/modules/sso.md +1 -1
  50. package/dist/agentic/guides/modules/staff.md +1 -1
  51. package/dist/agentic/guides/modules/storage_s3.md +1 -1
  52. package/dist/agentic/guides/modules/sync_akeneo.md +1 -1
  53. package/dist/agentic/guides/modules/sync_excel.md +1 -1
  54. package/dist/agentic/guides/modules/system_status_overlays.md +1 -1
  55. package/dist/agentic/guides/modules/translations.md +1 -1
  56. package/dist/agentic/guides/modules/webhooks.md +1 -1
  57. package/dist/agentic/guides/modules/wms.md +1 -1
  58. package/dist/agentic/guides/modules/workflows.md +1 -1
  59. package/dist/agentic/guides/upstream/AGENTS.md +2 -1
  60. package/dist/agentic/guides/upstream/manifest.json +2 -2
  61. package/dist/agentic/shared/ai/agentic.config.json +1 -0
  62. package/dist/agentic/shared/ai/trackers/github.md +2 -1
  63. package/package.json +3 -3
  64. package/template/package.json.template +3 -3
  65. package/template/scripts/dev-memory-sampler.mjs +464 -0
  66. package/template/scripts/dev-runtime-log-policy.mjs +33 -0
  67. package/template/scripts/dev-runtime.mjs +2 -1
  68. package/template/src/i18n/de.json +4 -0
  69. package/template/src/i18n/en.json +4 -0
  70. package/template/src/i18n/es.json +4 -0
  71. package/template/src/i18n/ko.json +970 -0
  72. package/template/src/i18n/pl.json +4 -0
  73. package/template/src/lib/i18n/register-dictionary-loader.ts +2 -0
  74. package/template/src/modules/example/i18n/ko.json +481 -0
  75. package/template/src/modules/example_customers_sync/i18n/ko.json +11 -0
@@ -0,0 +1,464 @@
1
+ import { execFile } from 'node:child_process'
2
+ import fs from 'node:fs'
3
+ import path from 'node:path'
4
+ import { promisify } from 'node:util'
5
+
6
+ const execFileAsync = promisify(execFile)
7
+
8
+ export const DEFAULT_MEMORY_TRACE_OUT_DIR = path.join('.mercato', 'dev-rss')
9
+ export const DEFAULT_MEMORY_TRACE_INTERVAL_MS = 1_000
10
+ export const DEFAULT_PROFILE_INTERVAL_MS = 2_000
11
+ export const TOP_PROCESS_LIMIT = 20
12
+
13
+ export function parsePsOutput(stdout) {
14
+ const processes = []
15
+ const lines = String(stdout ?? '').split('\n')
16
+ for (const line of lines) {
17
+ const trimmed = line.trim()
18
+ if (trimmed.length === 0) continue
19
+ const match = trimmed.match(/^(\d+)\s+(\d+)\s+(\d+)(?:\s+(.+))?$/)
20
+ if (!match) continue
21
+ const pid = Number(match[1])
22
+ const ppid = Number(match[2])
23
+ const rssKb = Number(match[3])
24
+ const command = (match[4] ?? '').trim()
25
+ if (!Number.isFinite(pid) || !Number.isFinite(ppid) || !Number.isFinite(rssKb)) continue
26
+ processes.push({ pid, ppid, rssKb, command })
27
+ }
28
+ return processes
29
+ }
30
+
31
+ export function walkTree(processes, rootPid) {
32
+ const byPpid = new Map()
33
+ for (const proc of processes) {
34
+ const list = byPpid.get(proc.ppid) ?? []
35
+ list.push(proc)
36
+ byPpid.set(proc.ppid, list)
37
+ }
38
+
39
+ const root = processes.find((p) => p.pid === rootPid)
40
+ if (!root) return []
41
+
42
+ const result = [root]
43
+ const queue = [root.pid]
44
+ const seen = new Set([root.pid])
45
+ while (queue.length > 0) {
46
+ const next = queue.shift()
47
+ const children = byPpid.get(next) ?? []
48
+ for (const child of children) {
49
+ if (seen.has(child.pid)) continue
50
+ seen.add(child.pid)
51
+ result.push(child)
52
+ queue.push(child.pid)
53
+ }
54
+ }
55
+ return result
56
+ }
57
+
58
+ export function classifyProcessCommand(command) {
59
+ const raw = String(command ?? '')
60
+ const normalized = raw.toLowerCase()
61
+
62
+ if (
63
+ normalized.includes('queue:worker')
64
+ || normalized.includes('worker for queue')
65
+ || normalized.includes('lazy-supervisor')
66
+ ) {
67
+ return 'worker'
68
+ }
69
+ if (
70
+ normalized.includes('scheduler:start')
71
+ || normalized.includes('scheduler polling')
72
+ || normalized.includes('lazy-scheduler')
73
+ ) {
74
+ return 'scheduler'
75
+ }
76
+ if (
77
+ normalized.includes('watch-packages.mjs')
78
+ || normalized.includes('watch.mjs')
79
+ || (normalized.includes('turbo') && normalized.includes('run') && normalized.includes('watch'))
80
+ || normalized.includes('yarn watch:packages')
81
+ ) {
82
+ return 'package-watcher'
83
+ }
84
+ if (
85
+ normalized.includes('generate watch')
86
+ || normalized.includes('generate:watch')
87
+ || normalized.includes('in-process-generate-watcher')
88
+ || normalized.includes('mercato generate')
89
+ ) {
90
+ return 'generate-watch'
91
+ }
92
+ if (
93
+ normalized.includes('next dev')
94
+ || normalized.includes('next-server')
95
+ || normalized.includes('turbopack')
96
+ || normalized.includes('server dev')
97
+ || normalized.includes('mercato server dev')
98
+ ) {
99
+ return 'next-turbopack'
100
+ }
101
+ if (
102
+ normalized.includes('scripts/dev.mjs')
103
+ || normalized.includes('dev-ephemeral')
104
+ || normalized.includes('yarn dev')
105
+ || normalized.includes('yarn workspace @open-mercato/app dev')
106
+ ) {
107
+ return 'dev-orchestrator'
108
+ }
109
+
110
+ return 'other'
111
+ }
112
+
113
+ export function kbToMb(kb) {
114
+ return Math.round((kb / 1024) * 100) / 100
115
+ }
116
+
117
+ export function bytesToMb(bytes) {
118
+ return Math.round((bytes / 1024 / 1024) * 100) / 100
119
+ }
120
+
121
+ function readIntegerFile(filePath) {
122
+ try {
123
+ const raw = fs.readFileSync(filePath, 'utf8').trim()
124
+ if (!raw || raw === 'max') return null
125
+ const parsed = Number(raw)
126
+ return Number.isFinite(parsed) && parsed >= 0 ? parsed : null
127
+ } catch {
128
+ return null
129
+ }
130
+ }
131
+
132
+ export function readCgroupMemory(cgroupRoot = '/sys/fs/cgroup') {
133
+ if (process.platform !== 'linux') return null
134
+
135
+ const currentBytes = readIntegerFile(path.join(cgroupRoot, 'memory.current'))
136
+ ?? readIntegerFile(path.join(cgroupRoot, 'memory', 'memory.usage_in_bytes'))
137
+ const peakBytes = readIntegerFile(path.join(cgroupRoot, 'memory.peak'))
138
+ ?? readIntegerFile(path.join(cgroupRoot, 'memory', 'memory.max_usage_in_bytes'))
139
+
140
+ if (currentBytes == null && peakBytes == null) return null
141
+ return {
142
+ currentBytes,
143
+ currentMb: currentBytes == null ? null : bytesToMb(currentBytes),
144
+ peakBytes,
145
+ peakMb: peakBytes == null ? null : bytesToMb(peakBytes),
146
+ source: 'cgroup',
147
+ }
148
+ }
149
+
150
+ async function runPsSnapshot(execFileImpl = execFileAsync) {
151
+ const { stdout } = await execFileImpl('ps', ['-A', '-o', 'pid=,ppid=,rss=,args='], {
152
+ maxBuffer: 16 * 1024 * 1024,
153
+ })
154
+ return parsePsOutput(stdout)
155
+ }
156
+
157
+ export async function sampleProcessTreeMemory(rootPid, options = {}) {
158
+ if (!Number.isInteger(rootPid) || rootPid <= 0) return null
159
+ if (process.platform === 'win32') return null
160
+
161
+ const processes = options.processes ?? await runPsSnapshot(options.execFile)
162
+ const tree = walkTree(processes, rootPid)
163
+ if (tree.length === 0) return null
164
+
165
+ const sampleProcesses = tree.map((p) => {
166
+ const rssMb = kbToMb(p.rssKb)
167
+ const processClass = classifyProcessCommand(p.command)
168
+ return {
169
+ pid: p.pid,
170
+ ppid: p.ppid,
171
+ rssMb,
172
+ rssBytes: p.rssKb * 1024,
173
+ processClass,
174
+ command: p.command.length > 240 ? `${p.command.slice(0, 240)}...` : p.command,
175
+ }
176
+ })
177
+
178
+ const processClassTotals = {}
179
+ for (const proc of sampleProcesses) {
180
+ const entry = processClassTotals[proc.processClass] ?? { rssMb: 0, rssBytes: 0, processCount: 0 }
181
+ entry.rssMb = Math.round((entry.rssMb + proc.rssMb) * 100) / 100
182
+ entry.rssBytes += proc.rssBytes
183
+ entry.processCount += 1
184
+ processClassTotals[proc.processClass] = entry
185
+ }
186
+
187
+ const totalRssMb = Math.round(sampleProcesses.reduce((acc, p) => acc + p.rssMb, 0) * 100) / 100
188
+ const topProcesses = sampleProcesses
189
+ .slice()
190
+ .sort((a, b) => b.rssMb - a.rssMb)
191
+ .slice(0, TOP_PROCESS_LIMIT)
192
+ const dominantProcessClass = Object.entries(processClassTotals)
193
+ .sort(([, a], [, b]) => b.rssMb - a.rssMb)[0]?.[0] ?? null
194
+
195
+ return {
196
+ timestamp: new Date().toISOString(),
197
+ totalRssMb,
198
+ totalRssBytes: Math.round(totalRssMb * 1024 * 1024),
199
+ processCount: sampleProcesses.length,
200
+ processClassTotals,
201
+ dominantProcessClass,
202
+ topProcesses,
203
+ processes: sampleProcesses,
204
+ cgroup: options.includeCgroup === false ? null : readCgroupMemory(options.cgroupRoot),
205
+ }
206
+ }
207
+
208
+ export function findNearestMarkers(markers, timestamp) {
209
+ if (!Array.isArray(markers) || markers.length === 0 || typeof timestamp !== 'string') {
210
+ return { before: null, after: null }
211
+ }
212
+ const target = Date.parse(timestamp)
213
+ if (!Number.isFinite(target)) return { before: null, after: null }
214
+
215
+ let before = null
216
+ let after = null
217
+ for (const marker of markers) {
218
+ const markerTime = Date.parse(marker?.timestamp)
219
+ if (!Number.isFinite(markerTime)) continue
220
+ if (markerTime <= target && (!before || markerTime > Date.parse(before.timestamp))) {
221
+ before = marker
222
+ }
223
+ if (markerTime >= target && (!after || markerTime < Date.parse(after.timestamp))) {
224
+ after = marker
225
+ }
226
+ }
227
+ return { before, after }
228
+ }
229
+
230
+ export function summarizeMemorySamples(samples, markers = []) {
231
+ if (!Array.isArray(samples) || samples.length === 0) {
232
+ return {
233
+ peakTotalMb: 0,
234
+ meanTotalMb: 0,
235
+ peakTopProcesses: [],
236
+ peakDominantProcessClass: null,
237
+ peakTimestamp: null,
238
+ peakNearestMarkers: { before: null, after: null },
239
+ peakCgroup: null,
240
+ sampleCount: 0,
241
+ }
242
+ }
243
+
244
+ let peakSample = samples[0]
245
+ let totalSum = 0
246
+ for (const sample of samples) {
247
+ if (sample.totalRssMb > peakSample.totalRssMb) {
248
+ peakSample = sample
249
+ }
250
+ totalSum += sample.totalRssMb
251
+ }
252
+
253
+ const peakTopProcesses = (peakSample.topProcesses ?? peakSample.processes ?? [])
254
+ .slice()
255
+ .sort((a, b) => b.rssMb - a.rssMb)
256
+ .slice(0, TOP_PROCESS_LIMIT)
257
+
258
+ return {
259
+ peakTotalMb: Math.round(peakSample.totalRssMb * 100) / 100,
260
+ meanTotalMb: Math.round((totalSum / samples.length) * 100) / 100,
261
+ peakTimestamp: peakSample.timestamp,
262
+ peakTopProcesses,
263
+ peakDominantProcessClass: peakSample.dominantProcessClass ?? peakTopProcesses[0]?.processClass ?? null,
264
+ peakProcessClassTotals: peakSample.processClassTotals ?? {},
265
+ peakNearestMarkers: findNearestMarkers(markers, peakSample.timestamp),
266
+ peakCgroup: peakSample.cgroup ?? null,
267
+ sampleCount: samples.length,
268
+ }
269
+ }
270
+
271
+ export function createMemoryMarker(type, label, details = {}) {
272
+ return {
273
+ timestamp: new Date().toISOString(),
274
+ type,
275
+ label,
276
+ details,
277
+ }
278
+ }
279
+
280
+ function stripAnsi(value) {
281
+ return String(value ?? '').replace(/\u001B\[[0-9;?]*[ -/]*[@-~]/g, '')
282
+ }
283
+
284
+ export function inferDevMemoryMarkerFromLine(line) {
285
+ const plain = stripAnsi(line).trim()
286
+ if (!plain) return null
287
+
288
+ if (/Building workspace packages/.test(plain) && !/^✅/.test(plain)) {
289
+ return createMemoryMarker('package-build:start', 'Building workspace packages')
290
+ }
291
+ if (/Building workspace packages/.test(plain) && /^✅/.test(plain)) {
292
+ return createMemoryMarker('package-build:end', 'Building workspace packages')
293
+ }
294
+ if (/Generating app artifacts|Greenfield generate artifacts/.test(plain) && !/^✅/.test(plain)) {
295
+ return createMemoryMarker('generate:start', 'Generating app artifacts')
296
+ }
297
+ if (/Generating app artifacts|Greenfield generate artifacts/.test(plain) && /^✅/.test(plain)) {
298
+ return createMemoryMarker('generate:end', 'Generating app artifacts')
299
+ }
300
+ if (/Watching workspace packages/.test(plain)) {
301
+ return createMemoryMarker('package-watch:start', 'Watching workspace packages')
302
+ }
303
+ if (/Starting app runtime|Starting app server|Running server:dev/.test(plain)) {
304
+ return createMemoryMarker('app-runtime:start', 'Starting app runtime')
305
+ }
306
+ if (/^✓ Ready in /.test(plain) || /Runtime ready in /.test(plain)) {
307
+ return createMemoryMarker('next:ready', 'Next runtime ready', { line: plain })
308
+ }
309
+ if (/Precompiling \/login/.test(plain)) {
310
+ return createMemoryMarker('warmup:start', 'Warmup started', { line: plain })
311
+ }
312
+ if (/Warmed \/login/.test(plain)) {
313
+ return createMemoryMarker('warmup:route', 'Warmed /login', { line: plain })
314
+ }
315
+ if (/Warmed POST \/api\/auth\/login/.test(plain)) {
316
+ return createMemoryMarker('warmup:route', 'Warmed POST /api/auth/login', { line: plain })
317
+ }
318
+ if (/Warmed authenticated \/backend/.test(plain)) {
319
+ return createMemoryMarker('warmup:route', 'Warmed /backend', { line: plain })
320
+ }
321
+ if (/Login flow and backend warmed/.test(plain)) {
322
+ return createMemoryMarker('warmup:end', 'Warmup completed', { line: plain })
323
+ }
324
+ if (/Warmup failed|Warmup incomplete/.test(plain)) {
325
+ return createMemoryMarker('warmup:failure', 'Warmup failed', { line: plain })
326
+ }
327
+ const compiling = plain.match(/^(?:○|◌|🛠️)\s*Compiling\s+(.+?)(?:\s+\.\.\.)?$/)
328
+ if (compiling) {
329
+ return createMemoryMarker('route-compile:start', `Compiling ${compiling[1].trim()}`, { route: compiling[1].trim() })
330
+ }
331
+ const compiled = plain.match(/(?:^✓|⚡)\s*Compiled(?:\s+(.+?))?\s+in\s+(.+)$/)
332
+ if (compiled) {
333
+ return createMemoryMarker('route-compile:end', `Compiled${compiled[1] ? ` ${compiled[1].trim()}` : ''}`, {
334
+ route: compiled[1]?.trim() ?? null,
335
+ duration: compiled[2]?.trim() ?? null,
336
+ })
337
+ }
338
+ const requestWithCompile = plain.match(/^(GET|POST|PUT|PATCH|DELETE|HEAD|OPTIONS)\s+(\S+)\s+\d{3}\s+in\s+.+\((.+)\)$/)
339
+ if (requestWithCompile && /compile:|render:/.test(requestWithCompile[3])) {
340
+ return createMemoryMarker('route-request:timed', `${requestWithCompile[1]} ${requestWithCompile[2]}`, {
341
+ method: requestWithCompile[1],
342
+ route: requestWithCompile[2],
343
+ timing: requestWithCompile[3],
344
+ })
345
+ }
346
+
347
+ return null
348
+ }
349
+
350
+ export function isEnabledEnvFlag(value) {
351
+ if (typeof value !== 'string') return false
352
+ return ['1', 'true', 'yes', 'on'].includes(value.trim().toLowerCase())
353
+ }
354
+
355
+ export function resolveMemoryTraceIntervalMs(env = process.env, fallback = DEFAULT_MEMORY_TRACE_INTERVAL_MS) {
356
+ const raw = env.OM_DEV_MEMORY_TRACE_INTERVAL_MS
357
+ if (typeof raw !== 'string' || raw.trim() === '') return fallback
358
+ const parsed = Number.parseInt(raw.trim(), 10)
359
+ return Number.isFinite(parsed) && parsed >= 250 ? parsed : fallback
360
+ }
361
+
362
+ export function createMemoryTraceSession(options = {}) {
363
+ const rootPid = options.rootPid
364
+ const label = options.label ?? `live-${new Date().toISOString().replace(/[:.]/g, '-')}`
365
+ const outDir = options.outDir ?? DEFAULT_MEMORY_TRACE_OUT_DIR
366
+ const intervalMs = options.intervalMs ?? DEFAULT_MEMORY_TRACE_INTERVAL_MS
367
+ const samples = []
368
+ const markers = []
369
+ let interval = null
370
+ let sampling = null
371
+ let startedAt = null
372
+ let finishedAt = null
373
+ let stopped = false
374
+ let finalReport = null
375
+ let ndjsonPath = null
376
+ let summaryPath = null
377
+
378
+ const writeEvent = (event) => {
379
+ if (!ndjsonPath) return
380
+ fs.appendFileSync(ndjsonPath, `${JSON.stringify(event)}\n`)
381
+ }
382
+
383
+ const sample = async () => {
384
+ if (sampling) return sampling
385
+ sampling = (async () => {
386
+ const next = await sampleProcessTreeMemory(rootPid, {
387
+ includeCgroup: options.includeCgroup,
388
+ cgroupRoot: options.cgroupRoot,
389
+ })
390
+ if (!next) return null
391
+ samples.push(next)
392
+ writeEvent({ kind: 'sample', sample: next })
393
+ options.onSample?.(next, summarizeMemorySamples(samples, markers))
394
+ return next
395
+ })().finally(() => {
396
+ sampling = null
397
+ })
398
+ return sampling
399
+ }
400
+
401
+ return {
402
+ get label() {
403
+ return label
404
+ },
405
+ get paths() {
406
+ return { ndjsonPath, summaryPath }
407
+ },
408
+ get samples() {
409
+ return samples.slice()
410
+ },
411
+ get markers() {
412
+ return markers.slice()
413
+ },
414
+ start() {
415
+ if (startedAt) return
416
+ if (!Number.isInteger(rootPid) || rootPid <= 0 || process.platform === 'win32') return
417
+ fs.mkdirSync(outDir, { recursive: true })
418
+ startedAt = new Date().toISOString()
419
+ ndjsonPath = path.join(outDir, `${label}.ndjson`)
420
+ summaryPath = path.join(outDir, `${label}.json`)
421
+ writeEvent({ kind: 'start', startedAt, rootPid, intervalMs })
422
+ void sample()
423
+ interval = setInterval(() => {
424
+ void sample()
425
+ }, intervalMs)
426
+ interval.unref?.()
427
+ },
428
+ mark(type, markerLabel, details = {}) {
429
+ if (!startedAt) return null
430
+ const marker = createMemoryMarker(type, markerLabel, details)
431
+ markers.push(marker)
432
+ writeEvent({ kind: 'marker', marker })
433
+ return marker
434
+ },
435
+ async stop() {
436
+ if (stopped) return finalReport
437
+ stopped = true
438
+ if (interval) {
439
+ clearInterval(interval)
440
+ interval = null
441
+ }
442
+ if (sampling) {
443
+ await sampling.catch(() => null)
444
+ }
445
+ if (!startedAt) return null
446
+ finishedAt = new Date().toISOString()
447
+ finalReport = {
448
+ label,
449
+ rootPid,
450
+ intervalMs,
451
+ startedAt,
452
+ finishedAt,
453
+ samples,
454
+ markers,
455
+ summary: summarizeMemorySamples(samples, markers),
456
+ }
457
+ if (summaryPath) {
458
+ fs.writeFileSync(summaryPath, `${JSON.stringify(finalReport, null, 2)}\n`)
459
+ }
460
+ writeEvent({ kind: 'stop', finishedAt, summary: finalReport.summary })
461
+ return finalReport
462
+ },
463
+ }
464
+ }
@@ -8,6 +8,39 @@ export function stripStructuredLogPrefix(line) {
8
8
  return line.replace(STRUCTURED_PRETTY_LOG_PREFIX, '')
9
9
  }
10
10
 
11
+ // Client console output forwarded by the browser log bridge. It describes the
12
+ // page, not the dev runtime, so a handled client-side warning must never latch
13
+ // the runtime failure state or force the compact view open.
14
+ const BROWSER_FORWARDED_LOG_PREFIX = '[browser]'
15
+ const STACK_FRAME_PATTERN = /^at\s+\S/
16
+ const STRUCTURED_PRETTY_NON_ERROR_PREFIX = /^\d{2}:\d{2}:\d{2}\.\d{3}\s+(?:DEBUG|INFO|WARN)\s+/
17
+
18
+ export function isBrowserForwardedLogLine(line) {
19
+ if (typeof line !== 'string') return false
20
+ return stripStructuredLogPrefix(line.trim()).startsWith(BROWSER_FORWARDED_LOG_PREFIX)
21
+ }
22
+
23
+ // Stack frames only ever follow a header line, and that header is what decides
24
+ // whether the block is a failure. Frames matched on their own text produce false
25
+ // positives, because module paths and function names routinely contain "failed".
26
+ export function isStackFrameLine(line) {
27
+ if (typeof line !== 'string') return false
28
+ return STACK_FRAME_PATTERN.test(line.trim())
29
+ }
30
+
31
+ // The structured logger already encodes severity; trust the level over a
32
+ // substring match on the message.
33
+ export function isStructuredNonErrorLogLine(line) {
34
+ if (typeof line !== 'string') return false
35
+ return STRUCTURED_PRETTY_NON_ERROR_PREFIX.test(line.trim())
36
+ }
37
+
38
+ export function isNonRuntimeFailureLine(line) {
39
+ return isBrowserForwardedLogLine(line)
40
+ || isStackFrameLine(line)
41
+ || isStructuredNonErrorLogLine(line)
42
+ }
43
+
11
44
  const KMS_VAULT_FALLBACK_MESSAGE_PATTERN = /^\[shared:kms\] (?:Vault (?:read|write) (?:error|failed)\b|Vault write CAS conflict\b|No tenant DEK found in Vault\b|Failed to store tenant DEK in Vault\b)/
12
45
 
13
46
  export function isIgnorableDerivedKeyWarningLine(line) {
@@ -7,6 +7,7 @@ import {
7
7
  createRuntimeFailureLatch,
8
8
  createRuntimeNoiseFilter,
9
9
  formatChildExitStatus,
10
+ isNonRuntimeFailureLine,
10
11
  isStatelessRuntimeNoiseLine,
11
12
  resolveChildExitCode,
12
13
  resolveUnexpectedExitCode,
@@ -597,7 +598,7 @@ function looksLikeWarningLine(line) {
597
598
  }
598
599
 
599
600
  function looksLikeFailure(line) {
600
- if (isStatelessRuntimeNoiseLine(line) || looksLikeWarningLine(line)) return false
601
+ if (isStatelessRuntimeNoiseLine(line) || looksLikeWarningLine(line) || isNonRuntimeFailureLine(line)) return false
601
602
 
602
603
  return /^error\b/i.test(line)
603
604
  || /^Error:/i.test(line)
@@ -94,6 +94,7 @@
94
94
  "backend.nav.security": "Sicherheit",
95
95
  "backend.selectModule": "Wähle ein Modul im Backend aus.",
96
96
  "backend.title": "Backend",
97
+ "billing.details.title": "Abrechnungsdetails",
97
98
  "bodyPlaceholder": "Enter details",
98
99
  "cancel": "Cancel",
99
100
  "catalog.errors.conversionNotFound": "Unit conversion not found.",
@@ -118,6 +119,7 @@
118
119
  "common.language": "Sprache",
119
120
  "common.languages.english": "Englisch",
120
121
  "common.languages.german": "Deutsch",
122
+ "common.languages.korean": "Koreanisch",
121
123
  "common.languages.polish": "Polnisch",
122
124
  "common.languages.spanish": "Spanisch",
123
125
  "common.no": "Nein",
@@ -554,6 +556,8 @@
554
556
  "organizationSwitcher.loading": "Wird geladen…",
555
557
  "organizationSwitcher.manage": "Verwalten",
556
558
  "organizationSwitcher.tenantLabel": "Mandant",
559
+ "products.edit.title": "Produkt bearbeiten",
560
+ "profile.title": "Profil",
557
561
  "resources.messageObjects.resource.title": "Resource",
558
562
  "rules.nav.group": "Geschäftsregeln",
559
563
  "rules.nav.logs": "Protokolle",
@@ -94,6 +94,7 @@
94
94
  "backend.nav.security": "Security",
95
95
  "backend.selectModule": "Select a module in the backend.",
96
96
  "backend.title": "Backend",
97
+ "billing.details.title": "Billing details",
97
98
  "bodyPlaceholder": "Enter details",
98
99
  "cancel": "Cancel",
99
100
  "catalog.errors.conversionNotFound": "Unit conversion not found.",
@@ -118,6 +119,7 @@
118
119
  "common.language": "Language",
119
120
  "common.languages.english": "English",
120
121
  "common.languages.german": "Deutsch",
122
+ "common.languages.korean": "Korean",
121
123
  "common.languages.polish": "Polski",
122
124
  "common.languages.spanish": "Español",
123
125
  "common.no": "No",
@@ -554,6 +556,8 @@
554
556
  "organizationSwitcher.loading": "Loading…",
555
557
  "organizationSwitcher.manage": "Manage",
556
558
  "organizationSwitcher.tenantLabel": "Tenant",
559
+ "products.edit.title": "Edit product",
560
+ "profile.title": "Profile",
557
561
  "resources.messageObjects.resource.title": "Resource",
558
562
  "rules.nav.group": "Business Rules",
559
563
  "rules.nav.logs": "Logs",
@@ -94,6 +94,7 @@
94
94
  "backend.nav.security": "Seguridad",
95
95
  "backend.selectModule": "Selecciona un módulo en el panel.",
96
96
  "backend.title": "Panel de administración",
97
+ "billing.details.title": "Datos de facturación",
97
98
  "bodyPlaceholder": "Enter details",
98
99
  "cancel": "Cancel",
99
100
  "catalog.errors.conversionNotFound": "Unit conversion not found.",
@@ -118,6 +119,7 @@
118
119
  "common.language": "Idioma",
119
120
  "common.languages.english": "Inglés",
120
121
  "common.languages.german": "Alemán",
122
+ "common.languages.korean": "Coreano",
121
123
  "common.languages.polish": "Polaco",
122
124
  "common.languages.spanish": "Español",
123
125
  "common.no": "No",
@@ -554,6 +556,8 @@
554
556
  "organizationSwitcher.loading": "Cargando…",
555
557
  "organizationSwitcher.manage": "Administrar",
556
558
  "organizationSwitcher.tenantLabel": "Tenant",
559
+ "products.edit.title": "Editar producto",
560
+ "profile.title": "Perfil",
557
561
  "resources.messageObjects.resource.title": "Resource",
558
562
  "rules.nav.group": "Reglas de negocio",
559
563
  "rules.nav.logs": "Registros",