brustjs 0.1.64-alpha → 0.1.65-alpha
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/README.md +6 -0
- package/package.json +7 -7
- package/runtime/ai/actions.ts +271 -0
- package/runtime/ai/index.ts +90 -0
- package/runtime/ai/manifest.ts +68 -0
- package/runtime/ai/navigate.ts +157 -0
- package/runtime/ai/pages.ts +49 -0
- package/runtime/ai/refs.ts +87 -0
- package/runtime/ai/struct.ts +168 -0
- package/runtime/cli/build.ts +43 -4
- package/runtime/cli/dev.ts +6 -1
- package/runtime/cli/help.ts +8 -0
- package/runtime/cli/native-routes-emit.ts +33 -9
- package/runtime/config.ts +3 -0
- package/runtime/generator.ts +14 -0
- package/runtime/index.js +52 -52
- package/runtime/index.ts +88 -3
- package/runtime/islands/build.ts +42 -1
- package/runtime/md/emit.ts +5 -1
- package/runtime/render/inject-ai-client.ts +38 -0
- package/runtime/render/stream.ts +9 -3
- package/types/ai/manifest.d.ts +17 -0
- package/types/cli/native-routes-emit.d.ts +5 -1
- package/types/config.d.ts +2 -0
- package/types/generator.d.ts +5 -0
- package/types/index.d.ts +2 -0
- package/types/islands/build.d.ts +9 -0
- package/types/md/emit.d.ts +3 -0
- package/types/render/inject-ai-client.d.ts +6 -0
package/runtime/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('brustjs-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('brustjs-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.1.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
80
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('brustjs-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('brustjs-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.1.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
96
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('brustjs-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('brustjs-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.1.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
117
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('brustjs-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('brustjs-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.1.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
133
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('brustjs-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('brustjs-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.1.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
150
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('brustjs-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('brustjs-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.1.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
166
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('brustjs-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('brustjs-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.1.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
185
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('brustjs-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('brustjs-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.1.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
201
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('brustjs-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('brustjs-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.1.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
217
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('brustjs-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('brustjs-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.1.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
237
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('brustjs-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('brustjs-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.1.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
253
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('brustjs-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('brustjs-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.1.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
274
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('brustjs-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('brustjs-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.1.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
290
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('brustjs-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('brustjs-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.1.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
308
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('brustjs-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('brustjs-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.1.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
324
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('brustjs-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('brustjs-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.1.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
342
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('brustjs-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('brustjs-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.1.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
358
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('brustjs-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('brustjs-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.1.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
376
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('brustjs-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('brustjs-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.1.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
392
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('brustjs-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('brustjs-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.1.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
410
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('brustjs-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('brustjs-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.1.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
426
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('brustjs-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('brustjs-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.1.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
443
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('brustjs-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('brustjs-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.1.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
459
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('brustjs-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('brustjs-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.1.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
479
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('brustjs-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('brustjs-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.1.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
495
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('brustjs-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('brustjs-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.1.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.
|
|
511
|
+
if (bindingPackageVersion !== '0.1.65-alpha' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.1.65-alpha but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
package/runtime/index.ts
CHANGED
|
@@ -189,6 +189,56 @@ async function readManifestFromPath(
|
|
|
189
189
|
return parsed as import('./mcp/manifest.ts').McpManifest
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
+
function createAiInternalRoutes(paths: {
|
|
193
|
+
manifestPath: string
|
|
194
|
+
runtimePath: string
|
|
195
|
+
}): import('./routes.ts').FlatRoute[] {
|
|
196
|
+
const manifestHandler: import('./routes.ts').Middleware = async () => {
|
|
197
|
+
const file = Bun.file(paths.manifestPath)
|
|
198
|
+
if (!(await file.exists())) {
|
|
199
|
+
return {
|
|
200
|
+
status: 404,
|
|
201
|
+
body: 'not found',
|
|
202
|
+
contentType: 'text/plain; charset=utf-8',
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return {
|
|
206
|
+
status: 200,
|
|
207
|
+
body: await file.text(),
|
|
208
|
+
contentType: 'application/json; charset=utf-8',
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const runtimeHandler: import('./routes.ts').Middleware = async () => {
|
|
212
|
+
const file = Bun.file(paths.runtimePath)
|
|
213
|
+
if (!(await file.exists())) {
|
|
214
|
+
return {
|
|
215
|
+
status: 404,
|
|
216
|
+
body: 'not found',
|
|
217
|
+
contentType: 'text/plain; charset=utf-8',
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
status: 200,
|
|
222
|
+
body: await file.text(),
|
|
223
|
+
contentType: 'text/javascript; charset=utf-8',
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return [
|
|
227
|
+
{
|
|
228
|
+
fullPath: '/_brust/ai/manifest.json',
|
|
229
|
+
chain: [{} as any],
|
|
230
|
+
middleware: [manifestHandler],
|
|
231
|
+
shellId: 'S:ai-manifest',
|
|
232
|
+
} as import('./routes.ts').FlatRoute,
|
|
233
|
+
{
|
|
234
|
+
fullPath: '/_brust/ai.js',
|
|
235
|
+
chain: [{} as any],
|
|
236
|
+
middleware: [runtimeHandler],
|
|
237
|
+
shellId: 'S:ai-runtime',
|
|
238
|
+
} as import('./routes.ts').FlatRoute,
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
|
|
192
242
|
export const brust = {
|
|
193
243
|
async serve(opts: ServeOptions): Promise<void> {
|
|
194
244
|
// Fail fast on a bad CORS config BEFORE touching native state (Rust
|
|
@@ -442,6 +492,8 @@ export const brust = {
|
|
|
442
492
|
/** Optional global CORS policy — see {@link CorsOptions}. Threaded to
|
|
443
493
|
* serve() like `actionPrefix`. */
|
|
444
494
|
cors?: CorsOptions
|
|
495
|
+
/** AI runtime toggle. Dev mode enables it automatically. */
|
|
496
|
+
ai?: boolean
|
|
445
497
|
/** Overrides merged into the underlying `serve()` call (main thread). */
|
|
446
498
|
serve?: Partial<Omit<ServeOptions, 'entry' | 'actions' | 'mcp'>>
|
|
447
499
|
/** Per-worker SAB size in bytes. Default 256 KB. */
|
|
@@ -461,6 +513,7 @@ export const brust = {
|
|
|
461
513
|
const scanRoot = opts.scanRoot ?? path.dirname(fileURLToPath(opts.entry))
|
|
462
514
|
|
|
463
515
|
const dev = opts.dev === true || process.env.BRUST_DEV === '1'
|
|
516
|
+
const aiEnabled = dev || opts.ai === true || process.env.BRUST_AI === '1'
|
|
464
517
|
// Unify the `dev: true` option with the BRUST_DEV env signal. The dev
|
|
465
518
|
// coordinator/watcher (which calls worker-registry spawnAll() on hot reload)
|
|
466
519
|
// keys off this `dev` variable, but serve()'s registerInitialPool — plus
|
|
@@ -472,6 +525,16 @@ export const brust = {
|
|
|
472
525
|
// registerInitialPool"). Set it here, before serve() spawns workers, so they
|
|
473
526
|
// inherit it via baseEnv.
|
|
474
527
|
if (dev) process.env.BRUST_DEV = '1'
|
|
528
|
+
if (aiEnabled) process.env.BRUST_AI = '1'
|
|
529
|
+
const aiManifestPath = prebuilt
|
|
530
|
+
? path.join(distDir!, '.brust', 'ai-manifest.json')
|
|
531
|
+
: path.resolve(process.cwd(), '.brust', 'ai-manifest.json')
|
|
532
|
+
const aiRuntimePath = prebuilt
|
|
533
|
+
? path.join(distDir!, 'islands', 'ai.js')
|
|
534
|
+
: path.resolve(process.cwd(), '.brust', 'islands', 'ai.js')
|
|
535
|
+
const aiInternalRoutes = aiEnabled
|
|
536
|
+
? createAiInternalRoutes({ manifestPath: aiManifestPath, runtimePath: aiRuntimePath })
|
|
537
|
+
: []
|
|
475
538
|
let routes = opts.routes
|
|
476
539
|
if (dev) {
|
|
477
540
|
const { createDevWsRoute } = await import('./dev/ws-channel.ts')
|
|
@@ -484,6 +547,9 @@ export const brust = {
|
|
|
484
547
|
]
|
|
485
548
|
configureDevClientSnippet(buildDevClientTag())
|
|
486
549
|
}
|
|
550
|
+
if (aiInternalRoutes.length > 0) {
|
|
551
|
+
routes = [...routes, ...aiInternalRoutes]
|
|
552
|
+
}
|
|
487
553
|
{
|
|
488
554
|
const { configureActionPrefixSnippet } = await import('./render/inject-action-prefix.ts')
|
|
489
555
|
const ap = opts.actionPrefix
|
|
@@ -544,6 +610,10 @@ export const brust = {
|
|
|
544
610
|
(r.chain[r.chain.length - 1] as { __mdSource?: unknown } | undefined)?.__mdSource !==
|
|
545
611
|
undefined,
|
|
546
612
|
)
|
|
613
|
+
if (!prebuilt) {
|
|
614
|
+
const { extractAiManifest, writeManifest } = await import('./ai/manifest.ts')
|
|
615
|
+
await writeManifest(process.cwd(), extractAiManifest(opts.routes))
|
|
616
|
+
}
|
|
547
617
|
|
|
548
618
|
// Component CSS pipeline. Build the manifest + capture the loader plugin
|
|
549
619
|
// BEFORE buildIslands and pass it EXPLICITLY below (global Bun.plugin()
|
|
@@ -627,6 +697,7 @@ export const brust = {
|
|
|
627
697
|
flatRoutes: opts.routes,
|
|
628
698
|
outDir: path.resolve(process.cwd(), '.brust/jinja'),
|
|
629
699
|
withDevClient: dev,
|
|
700
|
+
aiEnabled,
|
|
630
701
|
manifestDirs: [path.resolve(process.cwd(), '.brust')],
|
|
631
702
|
}))
|
|
632
703
|
} catch (err) {
|
|
@@ -644,10 +715,12 @@ export const brust = {
|
|
|
644
715
|
const { scanIslandChunks, buildIslands: build } = await import('./islands/build.ts')
|
|
645
716
|
const islandMap = scanIslandChunks(routesPath, mdIslands)
|
|
646
717
|
let islandsDir: string | undefined
|
|
647
|
-
if (islandMap.size > 0) {
|
|
718
|
+
if (islandMap.size > 0 || aiEnabled) {
|
|
648
719
|
const islands = await build(islandMap, { plugins: cssBuildPlugins })
|
|
649
720
|
islandsDir = islands.outDir
|
|
650
|
-
console.log(
|
|
721
|
+
console.log(
|
|
722
|
+
`[brust] main: built ${islands.islandCount} island chunk(s)${aiEnabled ? ' + ai runtime' : ''}`,
|
|
723
|
+
)
|
|
651
724
|
}
|
|
652
725
|
// Directive runtime bundle (Spec B) — build AFTER islands (buildIslands
|
|
653
726
|
// rm -rf's its outDir) into the SAME dir so a native page's _directives.js
|
|
@@ -662,6 +735,11 @@ export const brust = {
|
|
|
662
735
|
console.log(`[brust] main: built directive runtime (${res.count} component(s))`)
|
|
663
736
|
}
|
|
664
737
|
if (islandsDir) this.configureIslandsDir(islandsDir)
|
|
738
|
+
} else if (aiEnabled) {
|
|
739
|
+
const { buildIslands: build } = await import('./islands/build.ts')
|
|
740
|
+
const islands = await build(new Map(), { plugins: cssBuildPlugins })
|
|
741
|
+
this.configureIslandsDir(islands.outDir)
|
|
742
|
+
console.log('[brust] main: built 0 island chunk(s) + ai runtime')
|
|
665
743
|
}
|
|
666
744
|
}
|
|
667
745
|
|
|
@@ -860,6 +938,7 @@ export const brust = {
|
|
|
860
938
|
flatRoutes: opts.routes,
|
|
861
939
|
outDir: pathModule.resolve(process.cwd(), '.brust/jinja'),
|
|
862
940
|
withDevClient: true,
|
|
941
|
+
aiEnabled,
|
|
863
942
|
manifestDirs: [pathModule.resolve(process.cwd(), '.brust')],
|
|
864
943
|
}))
|
|
865
944
|
} catch (err) {
|
|
@@ -867,7 +946,7 @@ export const brust = {
|
|
|
867
946
|
}
|
|
868
947
|
}
|
|
869
948
|
const islandMap = scanIslandChunks(routesPath, mdIslands)
|
|
870
|
-
if (islandMap.size > 0) {
|
|
949
|
+
if (islandMap.size > 0 || aiEnabled) {
|
|
871
950
|
await buildIslands(islandMap)
|
|
872
951
|
}
|
|
873
952
|
// Spec B: rebuild the directive bundle after islands (which rm -rf's
|
|
@@ -879,6 +958,9 @@ export const brust = {
|
|
|
879
958
|
outDir: pathModule.join(process.cwd(), '.brust', 'islands'),
|
|
880
959
|
})
|
|
881
960
|
}
|
|
961
|
+
} else if (aiEnabled) {
|
|
962
|
+
const { buildIslands } = await import('./islands/build.ts')
|
|
963
|
+
await buildIslands(new Map())
|
|
882
964
|
}
|
|
883
965
|
},
|
|
884
966
|
buildComponentCss: async () => {
|
|
@@ -981,6 +1063,9 @@ export const brust = {
|
|
|
981
1063
|
...opts.routes,
|
|
982
1064
|
]
|
|
983
1065
|
}
|
|
1066
|
+
if (aiInternalRoutes.length > 0) {
|
|
1067
|
+
workerRoutes = [...workerRoutes, ...aiInternalRoutes]
|
|
1068
|
+
}
|
|
984
1069
|
{
|
|
985
1070
|
const { configureActionPrefixSnippet } = await import('./render/inject-action-prefix.ts')
|
|
986
1071
|
const ap = opts.actionPrefix
|
package/runtime/islands/build.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs'
|
|
1
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
2
2
|
import { mkdir, rm, writeFile } from 'node:fs/promises'
|
|
3
3
|
import { isAbsolute, relative, resolve } from 'node:path'
|
|
4
4
|
import type { BunPlugin } from 'bun'
|
|
@@ -26,6 +26,15 @@ export interface BuildIslandsOptions {
|
|
|
26
26
|
plugins?: BunPlugin[]
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export interface BuildAiRuntimeOptions {
|
|
30
|
+
/** Override the output directory. Default: `<cwd>/.brust/islands`. */
|
|
31
|
+
outDir?: string
|
|
32
|
+
/** Override the browser entry file. Default: `runtime/ai/index.ts`. */
|
|
33
|
+
entryFile?: string
|
|
34
|
+
/** Build plugins passed straight to `Bun.build` for the AI runtime chunk. */
|
|
35
|
+
plugins?: BunPlugin[]
|
|
36
|
+
}
|
|
37
|
+
|
|
29
38
|
/** Scan a routes entry file for `<Island component={X} />` usage and derive the
|
|
30
39
|
* island chunk list (componentName → absolute source path). Replaces the old
|
|
31
40
|
* static config-file lookup — the chunk set is derived from source.
|
|
@@ -198,9 +207,41 @@ export async function buildIslands(
|
|
|
198
207
|
const bootstrapSrc = resolve(import.meta.dir, 'bootstrap.ts')
|
|
199
208
|
await buildOne([bootstrapSrc], outDir, '_bootstrap.js', externals)
|
|
200
209
|
|
|
210
|
+
// 5. AI browser runtime. The task-owned entry is optional in this worktree;
|
|
211
|
+
// missing source is a soft skip so island-only builds keep working.
|
|
212
|
+
if (process.env.BRUST_AI === '1' || process.env.BRUST_DEV === '1') {
|
|
213
|
+
await buildAiRuntime({ outDir, plugins })
|
|
214
|
+
}
|
|
215
|
+
|
|
201
216
|
return { outDir, islandCount: count, chunks }
|
|
202
217
|
}
|
|
203
218
|
|
|
219
|
+
export async function buildAiRuntime(options: BuildAiRuntimeOptions = {}): Promise<string | null> {
|
|
220
|
+
const outDir = options.outDir
|
|
221
|
+
? isAbsolute(options.outDir)
|
|
222
|
+
? options.outDir
|
|
223
|
+
: resolve(process.cwd(), options.outDir)
|
|
224
|
+
: resolve(process.cwd(), '.brust/islands')
|
|
225
|
+
await mkdir(outDir, { recursive: true })
|
|
226
|
+
const entryFile = options.entryFile
|
|
227
|
+
? isAbsolute(options.entryFile)
|
|
228
|
+
? options.entryFile
|
|
229
|
+
: resolve(process.cwd(), options.entryFile)
|
|
230
|
+
: resolve(import.meta.dir, '../ai/index.ts')
|
|
231
|
+
if (!existsSync(entryFile)) {
|
|
232
|
+
console.warn(`[brust] ai runtime skipped (missing ${relative(process.cwd(), entryFile)})`)
|
|
233
|
+
return null
|
|
234
|
+
}
|
|
235
|
+
await buildOne(
|
|
236
|
+
[entryFile],
|
|
237
|
+
outDir,
|
|
238
|
+
'ai.js',
|
|
239
|
+
['react', 'react/jsx-runtime', 'react-dom/client'],
|
|
240
|
+
options.plugins ?? [],
|
|
241
|
+
)
|
|
242
|
+
return resolve(outDir, 'ai.js')
|
|
243
|
+
}
|
|
244
|
+
|
|
204
245
|
export async function buildOne(
|
|
205
246
|
entrypoints: string[],
|
|
206
247
|
outdir: string,
|
package/runtime/md/emit.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
|
|
14
14
|
import path from 'node:path'
|
|
15
|
-
import { insertGeneratorMeta, resolveGenerator } from '../generator.ts'
|
|
15
|
+
import { injectAiScriptIntoTemplate, insertGeneratorMeta, resolveGenerator } from '../generator.ts'
|
|
16
16
|
import {
|
|
17
17
|
bakeDirectivesIfUsed,
|
|
18
18
|
buildChainWrapperSource,
|
|
@@ -66,6 +66,9 @@ export interface MdEmitOpts {
|
|
|
66
66
|
* BRUST_DEV injection — md pages render Rust-side and never pass through the
|
|
67
67
|
* React renderer's dev-client injection). */
|
|
68
68
|
withDevClient?: boolean
|
|
69
|
+
/** Bake the AI runtime tag into document-style md templates. Fragments skip
|
|
70
|
+
* the injection entirely. */
|
|
71
|
+
aiEnabled?: boolean
|
|
69
72
|
/** What to do when a route's md file no longer exists on disk (deleted after
|
|
70
73
|
* the route table was built). emitMdTemplates serves BOTH `brust build` and
|
|
71
74
|
* the dev re-emit, and the two must diverge here:
|
|
@@ -400,6 +403,7 @@ export async function emitMdTemplates(opts: MdEmitOpts): Promise<{
|
|
|
400
403
|
}
|
|
401
404
|
final = bakeDirectivesIfUsed(final, hasDirectives)
|
|
402
405
|
if (opts.withDevClient) final = injectDevClientIntoTemplate(final)
|
|
406
|
+
if (!opts.withDevClient && opts.aiEnabled) final = injectAiScriptIntoTemplate(final)
|
|
403
407
|
writeFileSync(outPath, final)
|
|
404
408
|
}
|
|
405
409
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const ENC = new TextEncoder()
|
|
2
|
+
|
|
3
|
+
/** Splice `snippet` into `body` immediately before the first `</head>`
|
|
4
|
+
* (case-insensitive on the four ASCII letters only). Returns the original body
|
|
5
|
+
* untouched if `snippet` is null/empty or if `</head>` is absent.
|
|
6
|
+
*
|
|
7
|
+
* AI pages are document-only: fragment templates skip this injection entirely. */
|
|
8
|
+
export function injectAiClient(body: Uint8Array, snippet: string | null): Uint8Array {
|
|
9
|
+
if (!snippet) return body
|
|
10
|
+
const pos = findHeadCloseTag(body)
|
|
11
|
+
if (pos < 0) return body
|
|
12
|
+
const tagBytes = ENC.encode(snippet)
|
|
13
|
+
const out = new Uint8Array(body.length + tagBytes.length)
|
|
14
|
+
out.set(body.subarray(0, pos), 0)
|
|
15
|
+
out.set(tagBytes, pos)
|
|
16
|
+
out.set(body.subarray(pos), pos + tagBytes.length)
|
|
17
|
+
return out
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function findHeadCloseTag(body: Uint8Array): number {
|
|
21
|
+
const LT = 0x3c,
|
|
22
|
+
SL = 0x2f,
|
|
23
|
+
GT = 0x3e
|
|
24
|
+
for (let i = 0, max = body.length - 6; i < max; i++) {
|
|
25
|
+
if (body[i] !== LT || body[i + 1] !== SL) continue
|
|
26
|
+
if (!isLetter(body[i + 2], 0x48)) continue
|
|
27
|
+
if (!isLetter(body[i + 3], 0x45)) continue
|
|
28
|
+
if (!isLetter(body[i + 4], 0x41)) continue
|
|
29
|
+
if (!isLetter(body[i + 5], 0x44)) continue
|
|
30
|
+
if (body[i + 6] !== GT) continue
|
|
31
|
+
return i
|
|
32
|
+
}
|
|
33
|
+
return -1
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isLetter(b: number, u: number): boolean {
|
|
37
|
+
return b === u || b === (u | 0x20)
|
|
38
|
+
}
|
package/runtime/render/stream.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Writable } from 'node:stream'
|
|
|
7
7
|
import { IslandUsedContext, createIslandUsedBox } from '../islands/island.tsx'
|
|
8
8
|
import { ISLANDS_IMPORTMAP_AND_BOOTSTRAP } from '../islands/importmap.ts'
|
|
9
9
|
import { injectCssLink } from './inject-css-link.ts'
|
|
10
|
+
import { injectAiClient } from './inject-ai-client.ts'
|
|
10
11
|
import { getCssHrefs, getCssHrefsForRoute } from '../css.ts'
|
|
11
12
|
import { injectDevClient } from './inject-dev-client.ts'
|
|
12
13
|
import { injectActionPrefix, getActionPrefixSnippet } from './inject-action-prefix.ts'
|
|
@@ -14,6 +15,7 @@ import { injectBrustStore, buildStoreScripts } from './inject-store.ts'
|
|
|
14
15
|
import { getDevClientSnippet } from '../dev/inject.ts'
|
|
15
16
|
import { getGeneratorMeta, injectGeneratorMeta } from './inject-generator.ts'
|
|
16
17
|
import { injectShellMeta, shellMetaTag } from './inject-shell-meta.ts'
|
|
18
|
+
import { aiScriptTag } from '../generator.ts'
|
|
17
19
|
|
|
18
20
|
export interface RenderBranchStreamingArgs {
|
|
19
21
|
element: ReactNode
|
|
@@ -184,6 +186,7 @@ export function renderBranchStreaming(args: RenderBranchStreamingArgs): Promise<
|
|
|
184
186
|
body = injectGeneratorMeta(body, getGeneratorMeta())
|
|
185
187
|
body = injectShellMeta(body, args.shellId ?? '')
|
|
186
188
|
body = injectDevClient(body, getDevClientSnippet())
|
|
189
|
+
body = injectAiClient(body, process.env.BRUST_AI === '1' ? aiScriptTag() : null)
|
|
187
190
|
body = injectActionPrefix(body, getActionPrefixSnippet())
|
|
188
191
|
body = injectBrustStore(body, args.storeSnapshot ?? null)
|
|
189
192
|
const meta = makeMeta({
|
|
@@ -246,6 +249,7 @@ export function renderBranchStreaming(args: RenderBranchStreamingArgs): Promise<
|
|
|
246
249
|
.map((h) => `<link rel="stylesheet" href="${h}">`)
|
|
247
250
|
.join('')
|
|
248
251
|
const devTag = getDevClientSnippet() ?? ''
|
|
252
|
+
const aiTag = process.env.BRUST_AI === '1' ? aiScriptTag() : ''
|
|
249
253
|
const prefixTag = getActionPrefixSnippet() ?? ''
|
|
250
254
|
const storeTag = buildStoreScripts(args.storeSnapshot ?? null)
|
|
251
255
|
const genTag = getGeneratorMeta() ?? ''
|
|
@@ -253,6 +257,7 @@ export function renderBranchStreaming(args: RenderBranchStreamingArgs): Promise<
|
|
|
253
257
|
if (
|
|
254
258
|
linkTagsStr.length > 0 ||
|
|
255
259
|
devTag.length > 0 ||
|
|
260
|
+
aiTag.length > 0 ||
|
|
256
261
|
prefixTag.length > 0 ||
|
|
257
262
|
storeTag.length > 0 ||
|
|
258
263
|
genTag.length > 0 ||
|
|
@@ -261,9 +266,10 @@ export function renderBranchStreaming(args: RenderBranchStreamingArgs): Promise<
|
|
|
261
266
|
const prepend = encoder.encode(
|
|
262
267
|
genTag + shellTag + linkTagsStr + prefixTag + devTag + storeTag,
|
|
263
268
|
)
|
|
264
|
-
const out = new Uint8Array(
|
|
265
|
-
out.set(
|
|
266
|
-
out.set(
|
|
269
|
+
const out = new Uint8Array(prepend.length + aiTag.length + flushed.length)
|
|
270
|
+
out.set(prepend, 0)
|
|
271
|
+
out.set(encoder.encode(aiTag), prepend.length)
|
|
272
|
+
out.set(flushed, prepend.length + aiTag.length)
|
|
267
273
|
flushed = out
|
|
268
274
|
}
|
|
269
275
|
const meta = makeMeta({ status: successStatus, streaming: true, headers: extraHeaders })
|