acrylblends 1.3.1 → 1.3.2

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 (40) hide show
  1. package/legacy/README.md +4 -1
  2. package/legacy/agent/858de7a1ad0b/src/app.ts +289 -0
  3. package/legacy/agent/858de7a1ad0b/src/routes.ts +145 -0
  4. package/legacy/agent/b96ba6e3598a/src/app.ts +285 -0
  5. package/legacy/agent/b96ba6e3598a/src/routes.ts +145 -0
  6. package/legacy/agent/ecbc84f1c1e5/src/app.ts +291 -0
  7. package/legacy/agent/ecbc84f1c1e5/src/routes.ts +145 -0
  8. package/legacy/blank/2447ac6d5d24/src/app.ts +61 -0
  9. package/legacy/blank/387f7e25aaeb/src/app.ts +81 -0
  10. package/legacy/blank/5b9f10e1ba5e/src/app.ts +61 -0
  11. package/legacy/blank/5f6dd8910c50/src/app.ts +152 -0
  12. package/legacy/blank/5f6dd8910c50/src/routes.ts +75 -0
  13. package/legacy/blank/a7e8f539ffee/src/app.ts +160 -0
  14. package/legacy/blank/a7e8f539ffee/src/routes.ts +75 -0
  15. package/legacy/blank/bdb9735e013b/src/app.ts +61 -0
  16. package/legacy/blank/c3be1d735b1a/src/app.ts +61 -0
  17. package/legacy/blank/c3be1d735b1a/src/routes.ts +18 -0
  18. package/legacy/blank/e04303a7f8dd/src/app.ts +61 -0
  19. package/legacy/chat/5120c4a9fa61/src/app.ts +157 -0
  20. package/legacy/chat/5120c4a9fa61/src/routes.ts +29 -0
  21. package/legacy/chat/d4464dfb3b04/src/app.ts +165 -0
  22. package/legacy/chat/d4464dfb3b04/src/routes.ts +29 -0
  23. package/legacy/frozen.json +7 -0
  24. package/legacy/layouts.json +135 -45
  25. package/legacy/nodejs/9d59115118c7/src/app.ts +150 -0
  26. package/legacy/nodejs/9d59115118c7/src/routes.ts +59 -0
  27. package/legacy/nodejs/a6a340b4d3a6/src/app.ts +158 -0
  28. package/legacy/nodejs/a6a340b4d3a6/src/routes.ts +59 -0
  29. package/legacy/notes/fb43a1c5f3b4/src/app.ts +165 -0
  30. package/legacy/notes/fb43a1c5f3b4/src/routes.ts +21 -0
  31. package/legacy/notes/fc3fe7c749d2/src/app.ts +157 -0
  32. package/legacy/notes/fc3fe7c749d2/src/routes.ts +21 -0
  33. package/legacy/todo/164274ffcf7f/src/app.ts +145 -0
  34. package/legacy/todo/164274ffcf7f/src/todo.ts +137 -0
  35. package/package.json +1 -1
  36. /package/legacy/blank/{d6d371c9a65e → 2447ac6d5d24}/src/routes.ts +0 -0
  37. /package/legacy/blank/{5a91c558af22 → 387f7e25aaeb}/src/routes.ts +0 -0
  38. /package/legacy/blank/{b2cbb759c889 → 5b9f10e1ba5e}/src/routes.ts +0 -0
  39. /package/legacy/blank/{9c650cf52bf3 → bdb9735e013b}/src/routes.ts +0 -0
  40. /package/legacy/blank/{aea589283445 → e04303a7f8dd}/src/routes.ts +0 -0
@@ -5,7 +5,7 @@
5
5
  "version": "0.3.0",
6
6
  "layouts": {
7
7
  "agent": "c2f30958043b",
8
- "blank": "9c650cf52bf3",
8
+ "blank": "bdb9735e013b",
9
9
  "todo": "45694a8d9e15"
10
10
  }
11
11
  },
@@ -13,7 +13,7 @@
13
13
  "version": "0.4.0",
14
14
  "layouts": {
15
15
  "agent": "2e790da977b2",
16
- "blank": "aea589283445",
16
+ "blank": "e04303a7f8dd",
17
17
  "todo": "02e613b3625c"
18
18
  }
19
19
  },
@@ -21,7 +21,7 @@
21
21
  "version": "0.4.1",
22
22
  "layouts": {
23
23
  "agent": "2e790da977b2",
24
- "blank": "aea589283445",
24
+ "blank": "e04303a7f8dd",
25
25
  "todo": "5923d3a6099f"
26
26
  }
27
27
  },
@@ -29,7 +29,7 @@
29
29
  "version": "0.5.0",
30
30
  "layouts": {
31
31
  "agent": "157ce3db1112",
32
- "blank": "b2cbb759c889",
32
+ "blank": "5b9f10e1ba5e",
33
33
  "todo": "8e64211312f3"
34
34
  }
35
35
  },
@@ -37,7 +37,7 @@
37
37
  "version": "0.5.1",
38
38
  "layouts": {
39
39
  "agent": "157ce3db1112",
40
- "blank": "b2cbb759c889",
40
+ "blank": "5b9f10e1ba5e",
41
41
  "todo": "8e64211312f3"
42
42
  }
43
43
  },
@@ -45,7 +45,7 @@
45
45
  "version": "0.6.0",
46
46
  "layouts": {
47
47
  "agent": "157ce3db1112",
48
- "blank": "b2cbb759c889",
48
+ "blank": "5b9f10e1ba5e",
49
49
  "todo": "8e64211312f3"
50
50
  }
51
51
  },
@@ -53,7 +53,7 @@
53
53
  "version": "0.6.1",
54
54
  "layouts": {
55
55
  "agent": "157ce3db1112",
56
- "blank": "b2cbb759c889",
56
+ "blank": "5b9f10e1ba5e",
57
57
  "todo": "8e64211312f3"
58
58
  }
59
59
  },
@@ -61,7 +61,7 @@
61
61
  "version": "0.6.2",
62
62
  "layouts": {
63
63
  "agent": "157ce3db1112",
64
- "blank": "b2cbb759c889",
64
+ "blank": "5b9f10e1ba5e",
65
65
  "todo": "8e64211312f3"
66
66
  }
67
67
  },
@@ -69,7 +69,7 @@
69
69
  "version": "0.6.3",
70
70
  "layouts": {
71
71
  "agent": "157ce3db1112",
72
- "blank": "b2cbb759c889",
72
+ "blank": "5b9f10e1ba5e",
73
73
  "todo": "8e64211312f3"
74
74
  }
75
75
  },
@@ -77,7 +77,7 @@
77
77
  "version": "0.6.4",
78
78
  "layouts": {
79
79
  "agent": "157ce3db1112",
80
- "blank": "b2cbb759c889",
80
+ "blank": "5b9f10e1ba5e",
81
81
  "todo": "8e64211312f3"
82
82
  }
83
83
  },
@@ -85,7 +85,7 @@
85
85
  "version": "0.7.0",
86
86
  "layouts": {
87
87
  "agent": "157ce3db1112",
88
- "blank": "d6d371c9a65e",
88
+ "blank": "2447ac6d5d24",
89
89
  "todo": "8e64211312f3"
90
90
  }
91
91
  },
@@ -93,7 +93,7 @@
93
93
  "version": "0.7.1",
94
94
  "layouts": {
95
95
  "agent": "157ce3db1112",
96
- "blank": "d6d371c9a65e",
96
+ "blank": "2447ac6d5d24",
97
97
  "todo": "8e64211312f3"
98
98
  }
99
99
  },
@@ -101,7 +101,7 @@
101
101
  "version": "0.7.2",
102
102
  "layouts": {
103
103
  "agent": "157ce3db1112",
104
- "blank": "d6d371c9a65e",
104
+ "blank": "2447ac6d5d24",
105
105
  "todo": "8e64211312f3"
106
106
  }
107
107
  },
@@ -109,7 +109,7 @@
109
109
  "version": "0.7.3",
110
110
  "layouts": {
111
111
  "agent": "157ce3db1112",
112
- "blank": "d6d371c9a65e",
112
+ "blank": "2447ac6d5d24",
113
113
  "todo": "8e64211312f3"
114
114
  }
115
115
  },
@@ -117,7 +117,7 @@
117
117
  "version": "0.7.4",
118
118
  "layouts": {
119
119
  "agent": "157ce3db1112",
120
- "blank": "d6d371c9a65e",
120
+ "blank": "2447ac6d5d24",
121
121
  "todo": "8e64211312f3"
122
122
  }
123
123
  },
@@ -125,7 +125,7 @@
125
125
  "version": "0.7.5",
126
126
  "layouts": {
127
127
  "agent": "157ce3db1112",
128
- "blank": "d6d371c9a65e",
128
+ "blank": "2447ac6d5d24",
129
129
  "todo": "8e64211312f3"
130
130
  }
131
131
  },
@@ -133,7 +133,7 @@
133
133
  "version": "0.7.6",
134
134
  "layouts": {
135
135
  "agent": "157ce3db1112",
136
- "blank": "d6d371c9a65e",
136
+ "blank": "2447ac6d5d24",
137
137
  "todo": "8e64211312f3"
138
138
  }
139
139
  },
@@ -141,7 +141,7 @@
141
141
  "version": "0.7.7",
142
142
  "layouts": {
143
143
  "agent": "157ce3db1112",
144
- "blank": "d6d371c9a65e",
144
+ "blank": "2447ac6d5d24",
145
145
  "todo": "8e64211312f3"
146
146
  }
147
147
  },
@@ -149,7 +149,7 @@
149
149
  "version": "0.7.8",
150
150
  "layouts": {
151
151
  "agent": "71fb54a5a942",
152
- "blank": "5a91c558af22",
152
+ "blank": "c3be1d735b1a",
153
153
  "chat": "7076cc821e2c",
154
154
  "nodejs": "b1bd9462496c",
155
155
  "notes": "6cab2d09747c",
@@ -160,7 +160,7 @@
160
160
  "version": "0.8.0",
161
161
  "layouts": {
162
162
  "agent": "b5ef3c786ae4",
163
- "blank": "5a91c558af22",
163
+ "blank": "387f7e25aaeb",
164
164
  "chat": "f20ad9a51b06",
165
165
  "nodejs": "1d477f37aaf4",
166
166
  "notes": "7ca2dfed623a",
@@ -171,7 +171,7 @@
171
171
  "version": "0.8.1",
172
172
  "layouts": {
173
173
  "agent": "b5ef3c786ae4",
174
- "blank": "5a91c558af22",
174
+ "blank": "387f7e25aaeb",
175
175
  "chat": "a9a9ab44c58e",
176
176
  "nodejs": "d5bab75076ef",
177
177
  "notes": "4edc36949c15",
@@ -182,7 +182,7 @@
182
182
  "version": "0.9.0",
183
183
  "layouts": {
184
184
  "agent": "b5ef3c786ae4",
185
- "blank": "5a91c558af22",
185
+ "blank": "387f7e25aaeb",
186
186
  "chat": "a9a9ab44c58e",
187
187
  "nodejs": "d5bab75076ef",
188
188
  "notes": "4edc36949c15",
@@ -193,7 +193,7 @@
193
193
  "version": "0.9.0-next.1",
194
194
  "layouts": {
195
195
  "agent": "b5ef3c786ae4",
196
- "blank": "5a91c558af22",
196
+ "blank": "387f7e25aaeb",
197
197
  "chat": "a9a9ab44c58e",
198
198
  "nodejs": "d5bab75076ef",
199
199
  "notes": "4edc36949c15",
@@ -204,7 +204,7 @@
204
204
  "version": "0.9.1",
205
205
  "layouts": {
206
206
  "agent": "b5ef3c786ae4",
207
- "blank": "5a91c558af22",
207
+ "blank": "387f7e25aaeb",
208
208
  "chat": "a9a9ab44c58e",
209
209
  "nodejs": "d5bab75076ef",
210
210
  "notes": "4edc36949c15",
@@ -215,7 +215,7 @@
215
215
  "version": "0.9.2",
216
216
  "layouts": {
217
217
  "agent": "b5ef3c786ae4",
218
- "blank": "5a91c558af22",
218
+ "blank": "387f7e25aaeb",
219
219
  "chat": "a9a9ab44c58e",
220
220
  "nodejs": "d5bab75076ef",
221
221
  "notes": "4edc36949c15",
@@ -226,7 +226,7 @@
226
226
  "version": "0.10.0",
227
227
  "layouts": {
228
228
  "agent": "b5ef3c786ae4",
229
- "blank": "5a91c558af22",
229
+ "blank": "387f7e25aaeb",
230
230
  "chat": "a9a9ab44c58e",
231
231
  "nodejs": "d5bab75076ef",
232
232
  "notes": "4edc36949c15",
@@ -237,7 +237,7 @@
237
237
  "version": "0.11.0",
238
238
  "layouts": {
239
239
  "agent": "b5ef3c786ae4",
240
- "blank": "5a91c558af22",
240
+ "blank": "387f7e25aaeb",
241
241
  "chat": "a9a9ab44c58e",
242
242
  "nodejs": "d5bab75076ef",
243
243
  "notes": "4edc36949c15",
@@ -248,7 +248,7 @@
248
248
  "version": "1.0.0",
249
249
  "layouts": {
250
250
  "agent": "b5ef3c786ae4",
251
- "blank": "5a91c558af22",
251
+ "blank": "387f7e25aaeb",
252
252
  "chat": "a9a9ab44c58e",
253
253
  "nodejs": "d5bab75076ef",
254
254
  "notes": "4edc36949c15",
@@ -259,7 +259,7 @@
259
259
  "version": "1.0.0-rc.1",
260
260
  "layouts": {
261
261
  "agent": "b5ef3c786ae4",
262
- "blank": "5a91c558af22",
262
+ "blank": "387f7e25aaeb",
263
263
  "chat": "a9a9ab44c58e",
264
264
  "nodejs": "d5bab75076ef",
265
265
  "notes": "4edc36949c15",
@@ -270,7 +270,7 @@
270
270
  "version": "1.0.1",
271
271
  "layouts": {
272
272
  "agent": "6a5fb9c15c53",
273
- "blank": "5a91c558af22",
273
+ "blank": "387f7e25aaeb",
274
274
  "chat": "a9a9ab44c58e",
275
275
  "nodejs": "d5bab75076ef",
276
276
  "notes": "4edc36949c15",
@@ -281,7 +281,7 @@
281
281
  "version": "1.0.2",
282
282
  "layouts": {
283
283
  "agent": "6a5fb9c15c53",
284
- "blank": "5a91c558af22",
284
+ "blank": "387f7e25aaeb",
285
285
  "chat": "7dbe6d5170df",
286
286
  "nodejs": "d5bab75076ef",
287
287
  "notes": "4edc36949c15",
@@ -292,7 +292,7 @@
292
292
  "version": "1.0.3",
293
293
  "layouts": {
294
294
  "agent": "6a5fb9c15c53",
295
- "blank": "5a91c558af22",
295
+ "blank": "387f7e25aaeb",
296
296
  "chat": "7dbe6d5170df",
297
297
  "nodejs": "d5bab75076ef",
298
298
  "notes": "4edc36949c15",
@@ -303,7 +303,7 @@
303
303
  "version": "1.0.4",
304
304
  "layouts": {
305
305
  "agent": "6a5fb9c15c53",
306
- "blank": "5a91c558af22",
306
+ "blank": "387f7e25aaeb",
307
307
  "chat": "7dbe6d5170df",
308
308
  "nodejs": "d5bab75076ef",
309
309
  "notes": "4edc36949c15",
@@ -314,7 +314,7 @@
314
314
  "version": "1.0.5",
315
315
  "layouts": {
316
316
  "agent": "24c681a00fca",
317
- "blank": "5a91c558af22",
317
+ "blank": "387f7e25aaeb",
318
318
  "chat": "7dbe6d5170df",
319
319
  "nodejs": "d5bab75076ef",
320
320
  "notes": "4edc36949c15",
@@ -325,7 +325,7 @@
325
325
  "version": "1.0.6",
326
326
  "layouts": {
327
327
  "agent": "24c681a00fca",
328
- "blank": "5a91c558af22",
328
+ "blank": "387f7e25aaeb",
329
329
  "chat": "7dbe6d5170df",
330
330
  "nodejs": "d5bab75076ef",
331
331
  "notes": "4edc36949c15",
@@ -336,7 +336,7 @@
336
336
  "version": "1.0.7",
337
337
  "layouts": {
338
338
  "agent": "6307045545dc",
339
- "blank": "5a91c558af22",
339
+ "blank": "387f7e25aaeb",
340
340
  "chat": "7dbe6d5170df",
341
341
  "nodejs": "d5bab75076ef",
342
342
  "notes": "4edc36949c15",
@@ -347,7 +347,7 @@
347
347
  "version": "1.0.8",
348
348
  "layouts": {
349
349
  "agent": "74ece148269c",
350
- "blank": "5a91c558af22",
350
+ "blank": "387f7e25aaeb",
351
351
  "chat": "7dbe6d5170df",
352
352
  "nodejs": "d5bab75076ef",
353
353
  "notes": "4edc36949c15",
@@ -358,7 +358,7 @@
358
358
  "version": "1.0.9",
359
359
  "layouts": {
360
360
  "agent": "74ece148269c",
361
- "blank": "5a91c558af22",
361
+ "blank": "387f7e25aaeb",
362
362
  "chat": "7dbe6d5170df",
363
363
  "nodejs": "d5bab75076ef",
364
364
  "notes": "4edc36949c15",
@@ -369,7 +369,7 @@
369
369
  "version": "1.0.10",
370
370
  "layouts": {
371
371
  "agent": "74ece148269c",
372
- "blank": "5a91c558af22",
372
+ "blank": "387f7e25aaeb",
373
373
  "chat": "7dbe6d5170df",
374
374
  "nodejs": "d5bab75076ef",
375
375
  "notes": "4edc36949c15",
@@ -380,12 +380,45 @@
380
380
  "version": "1.1.0",
381
381
  "layouts": {
382
382
  "agent": "855359304707",
383
- "blank": "5a91c558af22",
383
+ "blank": "387f7e25aaeb",
384
384
  "chat": "7dbe6d5170df",
385
385
  "nodejs": "d5bab75076ef",
386
386
  "notes": "4edc36949c15",
387
387
  "todo": "849a18d66dc1"
388
388
  }
389
+ },
390
+ {
391
+ "version": "1.2.0",
392
+ "layouts": {
393
+ "agent": "b96ba6e3598a",
394
+ "blank": "5f6dd8910c50",
395
+ "chat": "5120c4a9fa61",
396
+ "nodejs": "9d59115118c7",
397
+ "notes": "fc3fe7c749d2",
398
+ "todo": "164274ffcf7f"
399
+ }
400
+ },
401
+ {
402
+ "version": "1.3.0",
403
+ "layouts": {
404
+ "agent": "858de7a1ad0b",
405
+ "blank": "5f6dd8910c50",
406
+ "chat": "5120c4a9fa61",
407
+ "nodejs": "9d59115118c7",
408
+ "notes": "fc3fe7c749d2",
409
+ "todo": "164274ffcf7f"
410
+ }
411
+ },
412
+ {
413
+ "version": "1.3.1",
414
+ "layouts": {
415
+ "agent": "ecbc84f1c1e5",
416
+ "blank": "a7e8f539ffee",
417
+ "chat": "d4464dfb3b04",
418
+ "nodejs": "a6a340b4d3a6",
419
+ "notes": "fb43a1c5f3b4",
420
+ "todo": "164274ffcf7f"
421
+ }
389
422
  }
390
423
  ],
391
424
  "templates": {
@@ -429,22 +462,51 @@
429
462
  "855359304707": [
430
463
  "src/app.ts",
431
464
  "src/routes.ts"
465
+ ],
466
+ "b96ba6e3598a": [
467
+ "src/app.ts",
468
+ "src/routes.ts"
469
+ ],
470
+ "858de7a1ad0b": [
471
+ "src/app.ts",
472
+ "src/routes.ts"
473
+ ],
474
+ "ecbc84f1c1e5": [
475
+ "src/app.ts",
476
+ "src/routes.ts"
432
477
  ]
433
478
  },
434
479
  "blank": {
435
- "9c650cf52bf3": [
480
+ "bdb9735e013b": [
481
+ "src/app.ts",
482
+ "src/routes.ts"
483
+ ],
484
+ "e04303a7f8dd": [
485
+ "src/app.ts",
486
+ "src/routes.ts"
487
+ ],
488
+ "5b9f10e1ba5e": [
489
+ "src/app.ts",
436
490
  "src/routes.ts"
437
491
  ],
438
- "aea589283445": [
492
+ "2447ac6d5d24": [
493
+ "src/app.ts",
439
494
  "src/routes.ts"
440
495
  ],
441
- "b2cbb759c889": [
496
+ "c3be1d735b1a": [
497
+ "src/app.ts",
442
498
  "src/routes.ts"
443
499
  ],
444
- "d6d371c9a65e": [
500
+ "387f7e25aaeb": [
501
+ "src/app.ts",
445
502
  "src/routes.ts"
446
503
  ],
447
- "5a91c558af22": [
504
+ "5f6dd8910c50": [
505
+ "src/app.ts",
506
+ "src/routes.ts"
507
+ ],
508
+ "a7e8f539ffee": [
509
+ "src/app.ts",
448
510
  "src/routes.ts"
449
511
  ]
450
512
  },
@@ -464,6 +526,14 @@
464
526
  "7dbe6d5170df": [
465
527
  "src/app.ts",
466
528
  "src/routes.ts"
529
+ ],
530
+ "5120c4a9fa61": [
531
+ "src/app.ts",
532
+ "src/routes.ts"
533
+ ],
534
+ "d4464dfb3b04": [
535
+ "src/app.ts",
536
+ "src/routes.ts"
467
537
  ]
468
538
  },
469
539
  "nodejs": {
@@ -478,6 +548,14 @@
478
548
  "d5bab75076ef": [
479
549
  "src/app.ts",
480
550
  "src/routes.ts"
551
+ ],
552
+ "9d59115118c7": [
553
+ "src/app.ts",
554
+ "src/routes.ts"
555
+ ],
556
+ "a6a340b4d3a6": [
557
+ "src/app.ts",
558
+ "src/routes.ts"
481
559
  ]
482
560
  },
483
561
  "notes": {
@@ -492,6 +570,14 @@
492
570
  "4edc36949c15": [
493
571
  "src/app.ts",
494
572
  "src/routes.ts"
573
+ ],
574
+ "fc3fe7c749d2": [
575
+ "src/app.ts",
576
+ "src/routes.ts"
577
+ ],
578
+ "fb43a1c5f3b4": [
579
+ "src/app.ts",
580
+ "src/routes.ts"
495
581
  ]
496
582
  },
497
583
  "todo": {
@@ -518,6 +604,10 @@
518
604
  "849a18d66dc1": [
519
605
  "src/app.ts",
520
606
  "src/todo.ts"
607
+ ],
608
+ "164274ffcf7f": [
609
+ "src/app.ts",
610
+ "src/todo.ts"
521
611
  ]
522
612
  }
523
613
  }
@@ -0,0 +1,150 @@
1
+ import { join } from 'node:path'
2
+ import { fileURLToPath } from 'node:url'
3
+ import { Context, type Fiber } from '@deepseek-ai/cordis'
4
+ import * as door from '../plugins/acryl-door/src/index.ts'
5
+ import * as nodeServer from '../plugins/acryl-node-server/src/index.ts'
6
+ import * as router from '../plugins/acryl-router/src/index.ts'
7
+ import { extensions } from '../plugins/extensions/index.ts'
8
+ import { type AppInstance, instance } from '../plugins/instance/index.ts'
9
+ import {
10
+ appPluginNames,
11
+ blueprintsIn,
12
+ compose,
13
+ loadAppPlugins,
14
+ loadManifest,
15
+ type ParameterValue,
16
+ } from '../plugins/manifest/index.ts'
17
+ import { doorEnabled } from './door.ts'
18
+ import { FRAME_MOUNT_PREFIX, routes } from './routes.ts'
19
+
20
+ /** The plugins this app's code provides. `blend.yaml` chooses, orders and configures them, and adds the app's own plugins from `plugins/` by name. */
21
+ export const registry = {
22
+ 'acryl-router': router,
23
+ 'acryl-node-server': nodeServer,
24
+ 'acryl-door': door,
25
+ extensions,
26
+ routes,
27
+ }
28
+
29
+ const projectRoot = fileURLToPath(new URL('..', import.meta.url))
30
+
31
+ /** The manifest next to this app's source. */
32
+ export const MANIFEST = join(projectRoot, 'blend.yaml')
33
+ /** The app's plugins: the library copies `registry` imports, and the app's own plugins (a feature each), which `blend.yaml` mounts by their folder name. */
34
+ const PLUGINS_DIR = join(projectRoot, 'plugins')
35
+
36
+ /**
37
+ * The app's manifest, resolved. A Blend finds its Blueprint in `blueprints/<id>.yaml`; an app that is itself a Blueprint never looks.
38
+ * `createApp` and the tests read it the same way.
39
+ */
40
+ export function readManifest(values?: Readonly<Record<string, ParameterValue>>) {
41
+ return loadManifest(MANIFEST, {
42
+ known: [...Object.keys(registry), ...appPluginNames(PLUGINS_DIR)],
43
+ getBlueprint: blueprintsIn(join(projectRoot, 'blueprints')),
44
+ ...(values ? { values } : {}),
45
+ })
46
+ }
47
+
48
+ /** The manifest without some rows: without its server (and so its door) the app is reached in process, through `root.router.request`; the door is also left out in production. */
49
+ function without<M extends { plugins: readonly { use: string }[] }>(
50
+ manifest: M,
51
+ ...uses: string[]
52
+ ): M {
53
+ return {
54
+ ...manifest,
55
+ plugins: manifest.plugins.map((row) =>
56
+ uses.includes(row.use) ? { ...row, disabled: true } : row,
57
+ ),
58
+ }
59
+ }
60
+
61
+ export interface App {
62
+ readonly root: Context
63
+ /** The address the server listens on; empty when the app was made with `listen: false`. */
64
+ readonly url: string
65
+ stop(): Promise<void>
66
+ }
67
+
68
+ export interface AppOptions {
69
+ readonly values?: Readonly<Record<string, ParameterValue>>
70
+ /** The path the app is mounted at; absent on its own server, where it keeps the root, and {@link FRAME_MOUNT_PREFIX} in the frame. */
71
+ readonly prefix?: string
72
+ /** Start the HTTP server (default). Tests pass `false` and call `app.root.router.request(path)`: it needs no port, so it also runs where a sandbox forbids listening. */
73
+ readonly listen?: boolean
74
+ }
75
+
76
+ /** The rows the frame host provides: the app contributes only the plugins that are its own. */
77
+ const HOST_ROWS = [
78
+ 'instance',
79
+ 'acryl-router',
80
+ 'acryl-node-server',
81
+ 'acryl-web-server',
82
+ 'acryl-page',
83
+ 'manifest',
84
+ 'save',
85
+ 'acryl-door',
86
+ ]
87
+
88
+ /**
89
+ * The app's rows, composed into `ctx`: the app's own server calls this from `createApp`, and the generated frame layer mounts it as one row, so the frame
90
+ * runs the app exactly as the app's own server does (same rows, same order, same config). `host: true` leaves the infrastructure rows to the frame host,
91
+ * which is where the door lives too, and mounts the app at {@link FRAME_MOUNT_PREFIX}.
92
+ */
93
+ export async function composeInto(
94
+ ctx: Context,
95
+ chosen: AppInstance,
96
+ options: AppOptions & { readonly host?: boolean } = {},
97
+ ): Promise<Fiber[]> {
98
+ const read = readManifest(options.values)
99
+ const own = options.host !== true && options.listen !== false
100
+ // The frame host mounts the app under its own prefix; the app's own server keeps the root.
101
+ const prefix = options.prefix ?? (options.host === true ? FRAME_MOUNT_PREFIX : undefined)
102
+ // Rows left out: the server (and the door, which needs it) when the app is reached in process or inside the frame host; the door when it is switched
103
+ // off.
104
+ const leaveOut = new Set<string>(options.host === true ? HOST_ROWS : [])
105
+ if (!own) leaveOut.add('acryl-node-server').add('acryl-door')
106
+ if (!doorEnabled()) leaveOut.add('acryl-door')
107
+ const manifest = without(read, ...leaveOut)
108
+ // The rows that name one of the app's own plugin folders (a feature: plugins/<name>/ and its row) rather than a registry import. Each one that runs
109
+ // is imported here; all of them, off or on, belong to their row, so the extensions row never starts them a second time.
110
+ const ownRows = [
111
+ ...new Set(read.plugins.map((row) => row.use).filter((use) => !Object.hasOwn(registry, use))),
112
+ ]
113
+ const ownPlugins = await loadAppPlugins(
114
+ PLUGINS_DIR,
115
+ ownRows.filter((use) => manifest.plugins.some((row) => row.use === use && !row.disabled)),
116
+ )
117
+ return compose(
118
+ ctx,
119
+ manifest,
120
+ { ...registry, ...ownPlugins },
121
+ {
122
+ // The routes row mounts the pages (and the client modules) at the prefix the frame host chose.
123
+ routes: { ...(prefix === undefined ? {} : { prefix }) },
124
+ // The app's own plugins live in plugins/, next to the plugins copied from the library (plugins/library.json lists those, so they are not installed twice).
125
+ // In production they start read-only from where they are deployed: the app keeps its features, and nothing can be installed while it runs.
126
+ extensions: {
127
+ ...(process.env.NODE_ENV === 'production' ? { readOnly: true } : {}),
128
+ sources: [{ dir: PLUGINS_DIR, trust: 'install' }],
129
+ rows: ownRows,
130
+ },
131
+ // Only the app's own server listens; the frame host owns the server and its port.
132
+ ...(own ? { server: { port: chosen.port.start, scan: chosen.port.scan ? 20 : 0 } } : {}),
133
+ },
134
+ )
135
+ }
136
+
137
+ /** The app: `instance` first (where it lives, chosen at run time), then the manifest's rows in order. */
138
+ export async function createApp(chosen: AppInstance, options: AppOptions = {}): Promise<App> {
139
+ const root = new Context()
140
+ const first = root.plugin(instance, chosen)
141
+ await first.await()
142
+ const fibers: Fiber[] = [first, ...(await composeInto(root, chosen, options))]
143
+ return {
144
+ root,
145
+ url: options.listen === false ? '' : root.nodeServer.url,
146
+ async stop() {
147
+ for (const fiber of [...fibers].reverse()) await fiber.dispose()
148
+ },
149
+ }
150
+ }