@typed-assistant/builder 0.0.87 → 0.0.88

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @typed-assistant/builder
2
2
 
3
+ ## 0.0.88
4
+
5
+ ### Patch Changes
6
+
7
+ - Fire onProcessError when empty stream is detected in web server.
8
+
3
9
  ## 0.0.87
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed-assistant/builder",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "exports": {
5
5
  "./appProcess": "./src/appProcess.tsx",
6
6
  "./bunInstall": "./src/bunInstall.tsx",
@@ -347,6 +347,7 @@ export const startWebappServer = async ({
347
347
  })
348
348
 
349
349
  let emptyStringCount = 0
350
+ let outputStreamsEmptyCount = 0
350
351
 
351
352
  // eslint-disable-next-line no-constant-condition
352
353
  while (true) {
@@ -374,6 +375,12 @@ export const startWebappServer = async ({
374
375
  "Subprocess output streams ended; waiting for restart or new output",
375
376
  )
376
377
  await new Promise((resolve) => setTimeout(resolve, 1000))
378
+ outputStreamsEmptyCount += 1
379
+ const outputStreamsEmptyMessage = "Process output streams have ended"
380
+ if (outputStreamsEmptyCount === 10) {
381
+ onProcessError(outputStreamsEmptyMessage)
382
+ break
383
+ }
377
384
  continue
378
385
  }
379
386
 
@@ -385,14 +392,16 @@ export const startWebappServer = async ({
385
392
  }
386
393
  if (convertedMessage === "") {
387
394
  emptyStringCount += 1
388
- const emptyStringMessage =
389
- "Process is returning an empty string"
395
+ const emptyStringMessage = "Process is returning an empty string"
390
396
  if (emptyStringCount === 10) {
391
397
  onProcessError(emptyStringMessage)
398
+ break
392
399
  }
393
400
  subscribers.forEach((send) =>
394
- send("Process is returning an empty string. This was the last non-empty message:\n\n" +
395
- lastMessage),
401
+ send(
402
+ "Process is returning an empty string. This was the last non-empty message:\n\n" +
403
+ lastMessage,
404
+ ),
396
405
  )
397
406
  logger.fatal(
398
407
  {
@@ -428,13 +437,11 @@ const getLogsFromFile = async ({
428
437
  }) => {
429
438
  try {
430
439
  const parsedLimit = Number(limitProp)
431
- const limit = Number.isFinite(parsedLimit) && parsedLimit > 0
432
- ? parsedLimit
433
- : undefined
440
+ const limit =
441
+ Number.isFinite(parsedLimit) && parsedLimit > 0 ? parsedLimit : undefined
434
442
  const parsedOffset = Number(offsetProp)
435
- const offset = Number.isFinite(parsedOffset) && parsedOffset >= 0
436
- ? parsedOffset
437
- : 0
443
+ const offset =
444
+ Number.isFinite(parsedOffset) && parsedOffset >= 0 ? parsedOffset : 0
438
445
 
439
446
  const normalizedFilter = filter?.toLowerCase().trim()
440
447
 
@@ -450,7 +457,7 @@ const getLogsFromFile = async ({
450
457
  return result.concat({
451
458
  msg: e instanceof Error ? e.message : "Unknown parse error",
452
459
  level: levels.fatal,
453
- })
460
+ } as LogSchema)
454
461
  }
455
462
  }, [] as LogSchema[])
456
463