@agimon-ai/po 0.0.0-alpha.47 → 0.0.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalog/index.json +54 -54
- package/dist/src/builders/server/mcpAppBuild.cjs +8 -1
- package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -1
- package/dist/src/builders/server/mcpAppBuild.mjs +8 -1
- package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -1
- package/dist/src/builders/server/runtime.cjs +9 -1
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +9 -1
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/package.json +21 -21
package/dist/catalog/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": 1,
|
|
3
3
|
"packages": {
|
|
4
4
|
"@agimon-ai/po": {
|
|
5
|
-
"version": "0.0.0-alpha.
|
|
5
|
+
"version": "0.0.0-alpha.49",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"@agimon-ai/po-approval",
|
|
8
8
|
"@agimon-ai/po-artifact",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
]
|
|
25
25
|
},
|
|
26
26
|
"@agimon-ai/po-approval": {
|
|
27
|
-
"version": "0.0.0-alpha.
|
|
27
|
+
"version": "0.0.0-alpha.48",
|
|
28
28
|
"dependencies": [
|
|
29
29
|
"@agimon-ai/po-core",
|
|
30
30
|
"@agimon-ai/po-web-components"
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"@agimon-ai/po-artifact": {
|
|
34
|
-
"version": "0.0.0-alpha.
|
|
34
|
+
"version": "0.0.0-alpha.47",
|
|
35
35
|
"dependencies": [
|
|
36
36
|
"@agimon-ai/po-core",
|
|
37
37
|
"@agimon-ai/po-web-components",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
]
|
|
40
40
|
},
|
|
41
41
|
"@agimon-ai/po-author": {
|
|
42
|
-
"version": "0.0.0-alpha.
|
|
42
|
+
"version": "0.0.0-alpha.48",
|
|
43
43
|
"dependencies": [
|
|
44
44
|
"@agimon-ai/po-artifact",
|
|
45
45
|
"@agimon-ai/po-core",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"@agimon-ai/po-autocompact": {
|
|
52
|
-
"version": "0.0.0-alpha.
|
|
52
|
+
"version": "0.0.0-alpha.48",
|
|
53
53
|
"dependencies": [
|
|
54
54
|
"@agimon-ai/po-artifact",
|
|
55
55
|
"@agimon-ai/po-config",
|
|
@@ -58,24 +58,24 @@
|
|
|
58
58
|
]
|
|
59
59
|
},
|
|
60
60
|
"@agimon-ai/po-autostop": {
|
|
61
|
-
"version": "0.0.0-alpha.
|
|
61
|
+
"version": "0.0.0-alpha.48",
|
|
62
62
|
"dependencies": [
|
|
63
63
|
"@agimon-ai/po-core"
|
|
64
64
|
]
|
|
65
65
|
},
|
|
66
66
|
"@agimon-ai/po-browse": {
|
|
67
|
-
"version": "0.0.1-alpha.
|
|
67
|
+
"version": "0.0.1-alpha.46",
|
|
68
68
|
"dependencies": [
|
|
69
69
|
"@agimon-ai/po-core",
|
|
70
70
|
"@agimon-ai/po-web-components"
|
|
71
71
|
]
|
|
72
72
|
},
|
|
73
73
|
"@agimon-ai/po-build": {
|
|
74
|
-
"version": "0.0.0-alpha.
|
|
74
|
+
"version": "0.0.0-alpha.48",
|
|
75
75
|
"dependencies": []
|
|
76
76
|
},
|
|
77
77
|
"@agimon-ai/po-cache": {
|
|
78
|
-
"version": "0.0.0-alpha.
|
|
78
|
+
"version": "0.0.0-alpha.48",
|
|
79
79
|
"dependencies": [
|
|
80
80
|
"@agimon-ai/po-config",
|
|
81
81
|
"@agimon-ai/po-core",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
]
|
|
84
84
|
},
|
|
85
85
|
"@agimon-ai/po-calendar": {
|
|
86
|
-
"version": "0.0.1-alpha.
|
|
86
|
+
"version": "0.0.1-alpha.7",
|
|
87
87
|
"dependencies": [
|
|
88
88
|
"@agimon-ai/po-config",
|
|
89
89
|
"@agimon-ai/po-core",
|
|
@@ -93,11 +93,11 @@
|
|
|
93
93
|
]
|
|
94
94
|
},
|
|
95
95
|
"@agimon-ai/po-claude-bridge": {
|
|
96
|
-
"version": "0.1.1-alpha.
|
|
96
|
+
"version": "0.1.1-alpha.28",
|
|
97
97
|
"dependencies": []
|
|
98
98
|
},
|
|
99
99
|
"@agimon-ai/po-codemode": {
|
|
100
|
-
"version": "0.0.1-alpha.
|
|
100
|
+
"version": "0.0.1-alpha.21",
|
|
101
101
|
"dependencies": [
|
|
102
102
|
"@agimon-ai/po-config",
|
|
103
103
|
"@agimon-ai/po-core",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
]
|
|
106
106
|
},
|
|
107
107
|
"@agimon-ai/po-computer-use": {
|
|
108
|
-
"version": "0.0.0-alpha.
|
|
108
|
+
"version": "0.0.0-alpha.48",
|
|
109
109
|
"dependencies": [
|
|
110
110
|
"@agimon-ai/po-config",
|
|
111
111
|
"@agimon-ai/po-core",
|
|
@@ -115,20 +115,20 @@
|
|
|
115
115
|
]
|
|
116
116
|
},
|
|
117
117
|
"@agimon-ai/po-config": {
|
|
118
|
-
"version": "0.0.0-alpha.
|
|
118
|
+
"version": "0.0.0-alpha.48",
|
|
119
119
|
"dependencies": [
|
|
120
120
|
"@agimon-ai/po-core",
|
|
121
121
|
"@agimon-ai/po-web-components"
|
|
122
122
|
]
|
|
123
123
|
},
|
|
124
124
|
"@agimon-ai/po-core": {
|
|
125
|
-
"version": "0.0.0-alpha.
|
|
125
|
+
"version": "0.0.0-alpha.48",
|
|
126
126
|
"dependencies": [
|
|
127
127
|
"@agimon-ai/po-web-security"
|
|
128
128
|
]
|
|
129
129
|
},
|
|
130
130
|
"@agimon-ai/po-domain": {
|
|
131
|
-
"version": "0.0.0-alpha.
|
|
131
|
+
"version": "0.0.0-alpha.48",
|
|
132
132
|
"dependencies": [
|
|
133
133
|
"@agimon-ai/po-config",
|
|
134
134
|
"@agimon-ai/po-core",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
]
|
|
137
137
|
},
|
|
138
138
|
"@agimon-ai/po-edit": {
|
|
139
|
-
"version": "0.0.0-alpha.
|
|
139
|
+
"version": "0.0.0-alpha.48",
|
|
140
140
|
"dependencies": [
|
|
141
141
|
"@agimon-ai/po-core",
|
|
142
142
|
"@agimon-ai/po-hashline",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
]
|
|
146
146
|
},
|
|
147
147
|
"@agimon-ai/po-file-edit": {
|
|
148
|
-
"version": "0.0.0-alpha.
|
|
148
|
+
"version": "0.0.0-alpha.48",
|
|
149
149
|
"dependencies": [
|
|
150
150
|
"@agimon-ai/po-config",
|
|
151
151
|
"@agimon-ai/po-core",
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
]
|
|
156
156
|
},
|
|
157
157
|
"@agimon-ai/po-git": {
|
|
158
|
-
"version": "0.0.0-alpha.
|
|
158
|
+
"version": "0.0.0-alpha.48",
|
|
159
159
|
"dependencies": [
|
|
160
160
|
"@agimon-ai/po-core",
|
|
161
161
|
"@agimon-ai/po-session",
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
]
|
|
165
165
|
},
|
|
166
166
|
"@agimon-ai/po-goal": {
|
|
167
|
-
"version": "0.0.0-alpha.
|
|
167
|
+
"version": "0.0.0-alpha.48",
|
|
168
168
|
"dependencies": [
|
|
169
169
|
"@agimon-ai/po-core",
|
|
170
170
|
"@agimon-ai/po-minor-mode",
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
]
|
|
174
174
|
},
|
|
175
175
|
"@agimon-ai/po-grep": {
|
|
176
|
-
"version": "0.0.0-alpha.
|
|
176
|
+
"version": "0.0.0-alpha.48",
|
|
177
177
|
"dependencies": [
|
|
178
178
|
"@agimon-ai/po-core",
|
|
179
179
|
"@agimon-ai/po-hashline",
|
|
@@ -182,11 +182,11 @@
|
|
|
182
182
|
]
|
|
183
183
|
},
|
|
184
184
|
"@agimon-ai/po-hashline": {
|
|
185
|
-
"version": "0.0.0-alpha.
|
|
185
|
+
"version": "0.0.0-alpha.48",
|
|
186
186
|
"dependencies": []
|
|
187
187
|
},
|
|
188
188
|
"@agimon-ai/po-help": {
|
|
189
|
-
"version": "0.0.0-alpha.
|
|
189
|
+
"version": "0.0.0-alpha.48",
|
|
190
190
|
"dependencies": [
|
|
191
191
|
"@agimon-ai/po-core",
|
|
192
192
|
"@agimon-ai/po-minor-mode",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
]
|
|
195
195
|
},
|
|
196
196
|
"@agimon-ai/po-image-gen": {
|
|
197
|
-
"version": "0.0.0-alpha.
|
|
197
|
+
"version": "0.0.0-alpha.47",
|
|
198
198
|
"dependencies": [
|
|
199
199
|
"@agimon-ai/po-core",
|
|
200
200
|
"@agimon-ai/po-web-components",
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
]
|
|
203
203
|
},
|
|
204
204
|
"@agimon-ai/po-log": {
|
|
205
|
-
"version": "0.0.0-alpha.
|
|
205
|
+
"version": "0.0.0-alpha.48",
|
|
206
206
|
"dependencies": [
|
|
207
207
|
"@agimon-ai/po-core",
|
|
208
208
|
"@agimon-ai/po-web-components",
|
|
@@ -210,7 +210,7 @@
|
|
|
210
210
|
]
|
|
211
211
|
},
|
|
212
212
|
"@agimon-ai/po-major-mode": {
|
|
213
|
-
"version": "0.0.0-alpha.
|
|
213
|
+
"version": "0.0.0-alpha.48",
|
|
214
214
|
"dependencies": [
|
|
215
215
|
"@agimon-ai/po-config",
|
|
216
216
|
"@agimon-ai/po-core",
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
]
|
|
219
219
|
},
|
|
220
220
|
"@agimon-ai/po-mcp": {
|
|
221
|
-
"version": "0.0.0-alpha.
|
|
221
|
+
"version": "0.0.0-alpha.48",
|
|
222
222
|
"dependencies": [
|
|
223
223
|
"@agimon-ai/po-config",
|
|
224
224
|
"@agimon-ai/po-core",
|
|
@@ -228,36 +228,36 @@
|
|
|
228
228
|
]
|
|
229
229
|
},
|
|
230
230
|
"@agimon-ai/po-mcp-proxy": {
|
|
231
|
-
"version": "0.0.1-alpha.
|
|
231
|
+
"version": "0.0.1-alpha.27",
|
|
232
232
|
"dependencies": []
|
|
233
233
|
},
|
|
234
234
|
"@agimon-ai/po-minor-mode": {
|
|
235
|
-
"version": "0.0.0-alpha.
|
|
235
|
+
"version": "0.0.0-alpha.48",
|
|
236
236
|
"dependencies": [
|
|
237
237
|
"@agimon-ai/po-core"
|
|
238
238
|
]
|
|
239
239
|
},
|
|
240
240
|
"@agimon-ai/po-model-guidance": {
|
|
241
|
-
"version": "0.0.0-alpha.
|
|
241
|
+
"version": "0.0.0-alpha.48",
|
|
242
242
|
"dependencies": [
|
|
243
243
|
"@agimon-ai/po-config",
|
|
244
244
|
"@agimon-ai/po-core"
|
|
245
245
|
]
|
|
246
246
|
},
|
|
247
247
|
"@agimon-ai/po-native-components": {
|
|
248
|
-
"version": "0.0.0-alpha.
|
|
248
|
+
"version": "0.0.0-alpha.48",
|
|
249
249
|
"dependencies": [
|
|
250
250
|
"@agimon-ai/po-web-components"
|
|
251
251
|
]
|
|
252
252
|
},
|
|
253
253
|
"@agimon-ai/po-notification": {
|
|
254
|
-
"version": "0.0.0-alpha.
|
|
254
|
+
"version": "0.0.0-alpha.48",
|
|
255
255
|
"dependencies": [
|
|
256
256
|
"@agimon-ai/po-core"
|
|
257
257
|
]
|
|
258
258
|
},
|
|
259
259
|
"@agimon-ai/po-plan": {
|
|
260
|
-
"version": "0.0.0-alpha.
|
|
260
|
+
"version": "0.0.0-alpha.48",
|
|
261
261
|
"dependencies": [
|
|
262
262
|
"@agimon-ai/po-config",
|
|
263
263
|
"@agimon-ai/po-core",
|
|
@@ -267,7 +267,7 @@
|
|
|
267
267
|
]
|
|
268
268
|
},
|
|
269
269
|
"@agimon-ai/po-profile": {
|
|
270
|
-
"version": "0.0.0-alpha.
|
|
270
|
+
"version": "0.0.0-alpha.48",
|
|
271
271
|
"dependencies": [
|
|
272
272
|
"@agimon-ai/po-config",
|
|
273
273
|
"@agimon-ai/po-core",
|
|
@@ -275,7 +275,7 @@
|
|
|
275
275
|
]
|
|
276
276
|
},
|
|
277
277
|
"@agimon-ai/po-prompt": {
|
|
278
|
-
"version": "0.0.0-alpha.
|
|
278
|
+
"version": "0.0.0-alpha.48",
|
|
279
279
|
"dependencies": [
|
|
280
280
|
"@agimon-ai/po-core",
|
|
281
281
|
"@agimon-ai/po-web-components",
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
]
|
|
284
284
|
},
|
|
285
285
|
"@agimon-ai/po-read": {
|
|
286
|
-
"version": "0.0.0-alpha.
|
|
286
|
+
"version": "0.0.0-alpha.48",
|
|
287
287
|
"dependencies": [
|
|
288
288
|
"@agimon-ai/po-config",
|
|
289
289
|
"@agimon-ai/po-core",
|
|
@@ -293,7 +293,7 @@
|
|
|
293
293
|
]
|
|
294
294
|
},
|
|
295
295
|
"@agimon-ai/po-runner": {
|
|
296
|
-
"version": "0.0.0-alpha.
|
|
296
|
+
"version": "0.0.0-alpha.48",
|
|
297
297
|
"dependencies": [
|
|
298
298
|
"@agimon-ai/po-core",
|
|
299
299
|
"@agimon-ai/po-ui",
|
|
@@ -302,13 +302,13 @@
|
|
|
302
302
|
]
|
|
303
303
|
},
|
|
304
304
|
"@agimon-ai/po-sandbox": {
|
|
305
|
-
"version": "0.0.0-alpha.
|
|
305
|
+
"version": "0.0.0-alpha.48",
|
|
306
306
|
"dependencies": [
|
|
307
307
|
"@agimon-ai/po-core"
|
|
308
308
|
]
|
|
309
309
|
},
|
|
310
310
|
"@agimon-ai/po-session": {
|
|
311
|
-
"version": "0.0.0-alpha.
|
|
311
|
+
"version": "0.0.0-alpha.48",
|
|
312
312
|
"dependencies": [
|
|
313
313
|
"@agimon-ai/po-config",
|
|
314
314
|
"@agimon-ai/po-core",
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
]
|
|
317
317
|
},
|
|
318
318
|
"@agimon-ai/po-skill": {
|
|
319
|
-
"version": "0.0.0-alpha.
|
|
319
|
+
"version": "0.0.0-alpha.48",
|
|
320
320
|
"dependencies": [
|
|
321
321
|
"@agimon-ai/po-config",
|
|
322
322
|
"@agimon-ai/po-core",
|
|
@@ -325,7 +325,7 @@
|
|
|
325
325
|
]
|
|
326
326
|
},
|
|
327
327
|
"@agimon-ai/po-style-system": {
|
|
328
|
-
"version": "0.0.0-alpha.
|
|
328
|
+
"version": "0.0.0-alpha.48",
|
|
329
329
|
"dependencies": [
|
|
330
330
|
"@agimon-ai/po-core",
|
|
331
331
|
"@agimon-ai/po-web-components",
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
]
|
|
334
334
|
},
|
|
335
335
|
"@agimon-ai/po-task": {
|
|
336
|
-
"version": "0.0.0-alpha.
|
|
336
|
+
"version": "0.0.0-alpha.48",
|
|
337
337
|
"dependencies": [
|
|
338
338
|
"@agimon-ai/po-core",
|
|
339
339
|
"@agimon-ai/po-ui",
|
|
@@ -341,7 +341,7 @@
|
|
|
341
341
|
]
|
|
342
342
|
},
|
|
343
343
|
"@agimon-ai/po-team": {
|
|
344
|
-
"version": "0.0.0-alpha.
|
|
344
|
+
"version": "0.0.0-alpha.48",
|
|
345
345
|
"dependencies": [
|
|
346
346
|
"@agimon-ai/po-cache",
|
|
347
347
|
"@agimon-ai/po-config",
|
|
@@ -353,7 +353,7 @@
|
|
|
353
353
|
]
|
|
354
354
|
},
|
|
355
355
|
"@agimon-ai/po-template-advanced": {
|
|
356
|
-
"version": "0.0.0-alpha.
|
|
356
|
+
"version": "0.0.0-alpha.48",
|
|
357
357
|
"dependencies": [
|
|
358
358
|
"@agimon-ai/po-core",
|
|
359
359
|
"@agimon-ai/po-web-components",
|
|
@@ -361,7 +361,7 @@
|
|
|
361
361
|
]
|
|
362
362
|
},
|
|
363
363
|
"@agimon-ai/po-template-elegant": {
|
|
364
|
-
"version": "0.0.0-alpha.
|
|
364
|
+
"version": "0.0.0-alpha.48",
|
|
365
365
|
"dependencies": [
|
|
366
366
|
"@agimon-ai/po-core",
|
|
367
367
|
"@agimon-ai/po-web-components",
|
|
@@ -369,7 +369,7 @@
|
|
|
369
369
|
]
|
|
370
370
|
},
|
|
371
371
|
"@agimon-ai/po-ui": {
|
|
372
|
-
"version": "0.0.0-alpha.
|
|
372
|
+
"version": "0.0.0-alpha.48",
|
|
373
373
|
"dependencies": [
|
|
374
374
|
"@agimon-ai/po-core",
|
|
375
375
|
"@agimon-ai/po-hashline",
|
|
@@ -378,7 +378,7 @@
|
|
|
378
378
|
]
|
|
379
379
|
},
|
|
380
380
|
"@agimon-ai/po-user-feedback": {
|
|
381
|
-
"version": "0.0.0-alpha.
|
|
381
|
+
"version": "0.0.0-alpha.48",
|
|
382
382
|
"dependencies": [
|
|
383
383
|
"@agimon-ai/po-core",
|
|
384
384
|
"@agimon-ai/po-minor-mode",
|
|
@@ -387,7 +387,7 @@
|
|
|
387
387
|
]
|
|
388
388
|
},
|
|
389
389
|
"@agimon-ai/po-vibe-lint": {
|
|
390
|
-
"version": "0.0.1-alpha.
|
|
390
|
+
"version": "0.0.1-alpha.17",
|
|
391
391
|
"dependencies": [
|
|
392
392
|
"@agimon-ai/po-config",
|
|
393
393
|
"@agimon-ai/po-core",
|
|
@@ -397,7 +397,7 @@
|
|
|
397
397
|
]
|
|
398
398
|
},
|
|
399
399
|
"@agimon-ai/po-voice": {
|
|
400
|
-
"version": "0.0.0-alpha.
|
|
400
|
+
"version": "0.0.0-alpha.48",
|
|
401
401
|
"dependencies": [
|
|
402
402
|
"@agimon-ai/po-config",
|
|
403
403
|
"@agimon-ai/po-core",
|
|
@@ -409,11 +409,11 @@
|
|
|
409
409
|
]
|
|
410
410
|
},
|
|
411
411
|
"@agimon-ai/po-web-components": {
|
|
412
|
-
"version": "0.0.0-alpha.
|
|
412
|
+
"version": "0.0.0-alpha.48",
|
|
413
413
|
"dependencies": []
|
|
414
414
|
},
|
|
415
415
|
"@agimon-ai/po-web-dashboard": {
|
|
416
|
-
"version": "0.0.0-alpha.
|
|
416
|
+
"version": "0.0.0-alpha.48",
|
|
417
417
|
"dependencies": [
|
|
418
418
|
"@agimon-ai/po-core",
|
|
419
419
|
"@agimon-ai/po-web-components",
|
|
@@ -421,18 +421,18 @@
|
|
|
421
421
|
]
|
|
422
422
|
},
|
|
423
423
|
"@agimon-ai/po-web-search": {
|
|
424
|
-
"version": "0.0.0-alpha.
|
|
424
|
+
"version": "0.0.0-alpha.47",
|
|
425
425
|
"dependencies": [
|
|
426
426
|
"@agimon-ai/po-core",
|
|
427
427
|
"@agimon-ai/po-web-components"
|
|
428
428
|
]
|
|
429
429
|
},
|
|
430
430
|
"@agimon-ai/po-web-security": {
|
|
431
|
-
"version": "0.0.0-alpha.
|
|
431
|
+
"version": "0.0.0-alpha.48",
|
|
432
432
|
"dependencies": []
|
|
433
433
|
},
|
|
434
434
|
"@agimon-ai/po-workflow": {
|
|
435
|
-
"version": "0.0.0-alpha.
|
|
435
|
+
"version": "0.0.0-alpha.48",
|
|
436
436
|
"dependencies": [
|
|
437
437
|
"@agimon-ai/po-core",
|
|
438
438
|
"@agimon-ai/po-ui",
|
|
@@ -46,14 +46,21 @@ async function mcpAppKey(candidates, inputs, files = (0, _agimon_ai_po_core_node
|
|
|
46
46
|
function mcpAppFile(poHome, key) {
|
|
47
47
|
return node_path.default.join(poHome, "build", "mcp-app", key, "index.html");
|
|
48
48
|
}
|
|
49
|
+
const loadedBuilds = /* @__PURE__ */ new Map();
|
|
49
50
|
async function loadedBuild(key, file, files) {
|
|
51
|
+
const cached = loadedBuilds.get(file);
|
|
52
|
+
if (cached !== void 0) return cached;
|
|
50
53
|
const html = (0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(file, _agimon_ai_po_core_platform.BACKGROUND_CONTEXT));
|
|
51
|
-
|
|
54
|
+
const build = {
|
|
52
55
|
key,
|
|
53
56
|
file,
|
|
54
57
|
html,
|
|
55
58
|
sha256: node_crypto.default.createHash("sha256").update(html).digest("hex")
|
|
56
59
|
};
|
|
60
|
+
loadedBuilds.set(file, build);
|
|
61
|
+
const [oldest] = loadedBuilds.keys();
|
|
62
|
+
if (loadedBuilds.size > 4 && oldest !== void 0) loadedBuilds.delete(oldest);
|
|
63
|
+
return build;
|
|
57
64
|
}
|
|
58
65
|
/** Reads sync's build without building. A missing HTML file returns only its expected key. */
|
|
59
66
|
async function readMcpAppBuild(input) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpAppBuild.cjs","names":["getOrThrow","BACKGROUND_CONTEXT","path","createNodePlatform","crypto","statSignature","snapshotFiles","mcpAppInputs","pathExists","bundleMcpApp"],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\n\nimport { bundleMcpApp, mcpAppInputs, type McpAppSource } from './mcpApp';\nimport type { McpPluginCandidate } from './mcpBundle';\nimport { snapshotFiles, statSignature } from './packageUrl';\n\nexport interface McpAppBuild {\n readonly key: string;\n readonly file: string;\n readonly html: string;\n readonly sha256: string;\n}\n\nexport interface McpAppBuildInput {\n readonly files?: FileSystem;\n readonly poHome: string;\n readonly candidates: readonly McpPluginCandidate[];\n /** Test seam; defaults to `bundleMcpApp`. */\n readonly bundle?: typeof bundleMcpApp;\n}\n\nasync function widgetSources(candidates: readonly McpPluginCandidate[], files: FileSystem): Promise<McpAppSource[]> {\n const sources: McpAppSource[] = [];\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const file = getOrThrow(await files.canonicalPath(path.resolve(root, declaration.ui.dist), BACKGROUND_CONTEXT));\n const relative = path.relative(root, file);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error(`MCP UI entry escapes package: ${declaration.packageName}`);\n sources.push({ file, widgets: declaration.ui.widgets });\n }\n return sources;\n}\n\n/** Content key over every widget package's files, so any source change moves it. */\nexport async function mcpAppKey(\n candidates: readonly McpPluginCandidate[],\n inputs?: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n const hash = crypto.createHash('sha256');\n let any = false;\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n any = true;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const entry = path.resolve(root, declaration.ui.dist);\n hash.update(`${declaration.packageName}\\0${root}\\0${declaration.ui.widgets.join(',')}\\0`);\n hash.update(await statSignature(root, await snapshotFiles(root, entry, files), files));\n hash.update('\\n');\n }\n if (!any) return undefined;\n for (const file of [...(inputs ?? (await mcpAppInputs())), import.meta.filename].sort()) {\n hash.update(`${file}\\0`);\n hash.update(\n crypto\n .createHash('sha256')\n .update(getOrThrow(await files.readBinaryFile(file, BACKGROUND_CONTEXT)))\n .digest(),\n );\n }\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction mcpAppFile(poHome: string, key: string): string {\n return path.join(poHome, 'build', 'mcp-app', key, 'index.html');\n}\n\nasync function loadedBuild(key: string, file: string, files: FileSystem): Promise<McpAppBuild> {\n const html = getOrThrow(await files.readTextFile(file, BACKGROUND_CONTEXT));\n return { key, file, html, sha256: crypto.createHash('sha256').update(html).digest('hex') };\n}\n\n/** Reads sync's build without building. A missing HTML file returns only its expected key. */\nexport async function readMcpAppBuild(\n input: Pick<McpAppBuildInput, 'poHome' | 'candidates' | 'files'>,\n): Promise<{ key: string; build?: McpAppBuild } | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n try {\n return { key, build: await loadedBuild(key, mcpAppFile(input.poHome, key), files) };\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'not_found') return { key };\n throw error;\n }\n}\n\n/** Builds into a temporary sibling and atomically publishes the immutable HTML. */\nexport async function ensureMcpAppBuild(input: McpAppBuildInput): Promise<McpAppBuild | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n const file = mcpAppFile(input.poHome, key);\n const directory = path.dirname(file);\n const parent = path.dirname(directory);\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) {\n getOrThrow(await files.createDir(parent, { recursive: true }, BACKGROUND_CONTEXT));\n const temporary = path.join(parent, `.${key}-${crypto.randomUUID()}`);\n getOrThrow(await files.createDir(temporary, undefined, BACKGROUND_CONTEXT));\n try {\n const built = await (input.bundle ?? bundleMcpApp)(await widgetSources(input.candidates, files), temporary);\n if (built === undefined) return undefined;\n getOrThrow(\n await files.writeFile(\n path.join(temporary, 'index.html'),\n getOrThrow(await files.readBinaryFile(path.join(temporary, built.file), BACKGROUND_CONTEXT)),\n BACKGROUND_CONTEXT,\n ),\n );\n try {\n getOrThrow(await files.renameFile(temporary, directory, BACKGROUND_CONTEXT));\n } catch (error) {\n // A concurrent build of the same key already published it.\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) throw error;\n }\n } finally {\n getOrThrow(await files.remove(temporary, { recursive: true, force: true }, BACKGROUND_CONTEXT));\n }\n }\n return loadedBuild(key, file, files);\n}\n"],"mappings":";;;;;;;;;;AAyBA,eAAe,cAAc,YAA2C,OAA4C;CAClH,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,EAAE,iBAAiB,YAAY;EACxC,IAAI,CAAC,YAAY,MAAM,YAAY,GAAG,QAAQ,WAAW,GAAG;EAC5D,MAAM,QAAA,GAA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GAAMO,4BAAAA,WAAAA,CAAW,OAAO,MAAMP,4BAAAA,kBAAkB,GAAI,MAAM;GAClE;EACF,UAAU;GACR,CAAA,GAAA,4BAAA,WAAA,CAAW,MAAM,MAAM,OAAO,WAAW;IAAE,WAAW;IAAM,OAAO;GAAK,GAAGA,4BAAAA,kBAAkB,CAAC;EAChG;CACF;CACA,OAAO,YAAY,KAAK,MAAM,KAAK;AACrC"}
|
|
1
|
+
{"version":3,"file":"mcpAppBuild.cjs","names":["getOrThrow","BACKGROUND_CONTEXT","path","createNodePlatform","crypto","statSignature","snapshotFiles","mcpAppInputs","pathExists","bundleMcpApp"],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\n\nimport { bundleMcpApp, mcpAppInputs, type McpAppSource } from './mcpApp';\nimport type { McpPluginCandidate } from './mcpBundle';\nimport { snapshotFiles, statSignature } from './packageUrl';\n\nexport interface McpAppBuild {\n readonly key: string;\n readonly file: string;\n readonly html: string;\n readonly sha256: string;\n}\n\nexport interface McpAppBuildInput {\n readonly files?: FileSystem;\n readonly poHome: string;\n readonly candidates: readonly McpPluginCandidate[];\n /** Test seam; defaults to `bundleMcpApp`. */\n readonly bundle?: typeof bundleMcpApp;\n}\n\nasync function widgetSources(candidates: readonly McpPluginCandidate[], files: FileSystem): Promise<McpAppSource[]> {\n const sources: McpAppSource[] = [];\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const file = getOrThrow(await files.canonicalPath(path.resolve(root, declaration.ui.dist), BACKGROUND_CONTEXT));\n const relative = path.relative(root, file);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error(`MCP UI entry escapes package: ${declaration.packageName}`);\n sources.push({ file, widgets: declaration.ui.widgets });\n }\n return sources;\n}\n\n/** Content key over every widget package's files, so any source change moves it. */\nexport async function mcpAppKey(\n candidates: readonly McpPluginCandidate[],\n inputs?: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n const hash = crypto.createHash('sha256');\n let any = false;\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n any = true;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const entry = path.resolve(root, declaration.ui.dist);\n hash.update(`${declaration.packageName}\\0${root}\\0${declaration.ui.widgets.join(',')}\\0`);\n hash.update(await statSignature(root, await snapshotFiles(root, entry, files), files));\n hash.update('\\n');\n }\n if (!any) return undefined;\n for (const file of [...(inputs ?? (await mcpAppInputs())), import.meta.filename].sort()) {\n hash.update(`${file}\\0`);\n hash.update(\n crypto\n .createHash('sha256')\n .update(getOrThrow(await files.readBinaryFile(file, BACKGROUND_CONTEXT)))\n .digest(),\n );\n }\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction mcpAppFile(poHome: string, key: string): string {\n return path.join(poHome, 'build', 'mcp-app', key, 'index.html');\n}\n\n// A published build never changes, so every session shares one copy of its HTML (about 1.7 MB).\n// Rebuilds publish new keys, so only the most recent few stay cached.\nconst loadedBuilds = new Map<string, McpAppBuild>();\n\nasync function loadedBuild(key: string, file: string, files: FileSystem): Promise<McpAppBuild> {\n const cached = loadedBuilds.get(file);\n if (cached !== undefined) return cached;\n const html = getOrThrow(await files.readTextFile(file, BACKGROUND_CONTEXT));\n const build = { key, file, html, sha256: crypto.createHash('sha256').update(html).digest('hex') };\n loadedBuilds.set(file, build);\n const [oldest] = loadedBuilds.keys();\n if (loadedBuilds.size > 4 && oldest !== undefined) loadedBuilds.delete(oldest);\n return build;\n}\n\n/** Reads sync's build without building. A missing HTML file returns only its expected key. */\nexport async function readMcpAppBuild(\n input: Pick<McpAppBuildInput, 'poHome' | 'candidates' | 'files'>,\n): Promise<{ key: string; build?: McpAppBuild } | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n try {\n return { key, build: await loadedBuild(key, mcpAppFile(input.poHome, key), files) };\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'not_found') return { key };\n throw error;\n }\n}\n\n/** Builds into a temporary sibling and atomically publishes the immutable HTML. */\nexport async function ensureMcpAppBuild(input: McpAppBuildInput): Promise<McpAppBuild | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n const file = mcpAppFile(input.poHome, key);\n const directory = path.dirname(file);\n const parent = path.dirname(directory);\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) {\n getOrThrow(await files.createDir(parent, { recursive: true }, BACKGROUND_CONTEXT));\n const temporary = path.join(parent, `.${key}-${crypto.randomUUID()}`);\n getOrThrow(await files.createDir(temporary, undefined, BACKGROUND_CONTEXT));\n try {\n const built = await (input.bundle ?? bundleMcpApp)(await widgetSources(input.candidates, files), temporary);\n if (built === undefined) return undefined;\n getOrThrow(\n await files.writeFile(\n path.join(temporary, 'index.html'),\n getOrThrow(await files.readBinaryFile(path.join(temporary, built.file), BACKGROUND_CONTEXT)),\n BACKGROUND_CONTEXT,\n ),\n );\n try {\n getOrThrow(await files.renameFile(temporary, directory, BACKGROUND_CONTEXT));\n } catch (error) {\n // A concurrent build of the same key already published it.\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) throw error;\n }\n } finally {\n getOrThrow(await files.remove(temporary, { recursive: true, force: true }, BACKGROUND_CONTEXT));\n }\n }\n return loadedBuild(key, file, files);\n}\n"],"mappings":";;;;;;;;;;AAyBA,eAAe,cAAc,YAA2C,OAA4C;CAClH,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,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4BAAA,WAAA,CACE,MAAM,MAAM,UACVP,UAAAA,QAAK,KAAK,WAAW,YAAY,IAAA,GACjCF,4BAAAA,WAAAA,CAAW,MAAM,MAAM,eAAeE,UAAAA,QAAK,KAAK,WAAW,MAAM,IAAI,GAAGD,4BAAAA,kBAAkB,CAAC,GAC3FA,4BAAAA,kBACF,CACF;GACA,IAAI;IACF,CAAA,GAAA,4BAAA,WAAA,CAAW,MAAM,MAAM,WAAW,WAAW,WAAWA,4BAAAA,kBAAkB,CAAC;GAC7E,SAAS,OAAO;IAEd,IAAI,CAAE,OAAA,GAAMO,4BAAAA,WAAAA,CAAW,OAAO,MAAMP,4BAAAA,kBAAkB,GAAI,MAAM;GAClE;EACF,UAAU;GACR,CAAA,GAAA,4BAAA,WAAA,CAAW,MAAM,MAAM,OAAO,WAAW;IAAE,WAAW;IAAM,OAAO;GAAK,GAAGA,4BAAAA,kBAAkB,CAAC;EAChG;CACF;CACA,OAAO,YAAY,KAAK,MAAM,KAAK;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpAppBuild.d.mts","names":[],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"mappings":";;;;iBAUiB;WACN;WACA;WACA;WACA;;iBAGM;WACN,QAAQ;WACR;WACA,qBAAqB;;WAErB,gBAAgB;;;
|
|
1
|
+
{"version":3,"file":"mcpAppBuild.d.mts","names":[],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"mappings":";;;;iBAUiB;WACN;WACA;WACA;WACA;;iBAGM;WACN,QAAQ;WACR;WACA,qBAAqB;;WAErB,gBAAgB;;;wBAkFL,kBAAkB,OAAO,mBAAmB,QAAQ"}
|
|
@@ -43,14 +43,21 @@ async function mcpAppKey(candidates, inputs, files = createNodePlatform().env(pr
|
|
|
43
43
|
function mcpAppFile(poHome, key) {
|
|
44
44
|
return path.join(poHome, "build", "mcp-app", key, "index.html");
|
|
45
45
|
}
|
|
46
|
+
const loadedBuilds = /* @__PURE__ */ new Map();
|
|
46
47
|
async function loadedBuild(key, file, files) {
|
|
48
|
+
const cached = loadedBuilds.get(file);
|
|
49
|
+
if (cached !== void 0) return cached;
|
|
47
50
|
const html = getOrThrow(await files.readTextFile(file, BACKGROUND_CONTEXT));
|
|
48
|
-
|
|
51
|
+
const build = {
|
|
49
52
|
key,
|
|
50
53
|
file,
|
|
51
54
|
html,
|
|
52
55
|
sha256: crypto.createHash("sha256").update(html).digest("hex")
|
|
53
56
|
};
|
|
57
|
+
loadedBuilds.set(file, build);
|
|
58
|
+
const [oldest] = loadedBuilds.keys();
|
|
59
|
+
if (loadedBuilds.size > 4 && oldest !== void 0) loadedBuilds.delete(oldest);
|
|
60
|
+
return build;
|
|
54
61
|
}
|
|
55
62
|
/** Reads sync's build without building. A missing HTML file returns only its expected key. */
|
|
56
63
|
async function readMcpAppBuild(input) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcpAppBuild.mjs","names":[],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\n\nimport { bundleMcpApp, mcpAppInputs, type McpAppSource } from './mcpApp';\nimport type { McpPluginCandidate } from './mcpBundle';\nimport { snapshotFiles, statSignature } from './packageUrl';\n\nexport interface McpAppBuild {\n readonly key: string;\n readonly file: string;\n readonly html: string;\n readonly sha256: string;\n}\n\nexport interface McpAppBuildInput {\n readonly files?: FileSystem;\n readonly poHome: string;\n readonly candidates: readonly McpPluginCandidate[];\n /** Test seam; defaults to `bundleMcpApp`. */\n readonly bundle?: typeof bundleMcpApp;\n}\n\nasync function widgetSources(candidates: readonly McpPluginCandidate[], files: FileSystem): Promise<McpAppSource[]> {\n const sources: McpAppSource[] = [];\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const file = getOrThrow(await files.canonicalPath(path.resolve(root, declaration.ui.dist), BACKGROUND_CONTEXT));\n const relative = path.relative(root, file);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error(`MCP UI entry escapes package: ${declaration.packageName}`);\n sources.push({ file, widgets: declaration.ui.widgets });\n }\n return sources;\n}\n\n/** Content key over every widget package's files, so any source change moves it. */\nexport async function mcpAppKey(\n candidates: readonly McpPluginCandidate[],\n inputs?: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n const hash = crypto.createHash('sha256');\n let any = false;\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n any = true;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const entry = path.resolve(root, declaration.ui.dist);\n hash.update(`${declaration.packageName}\\0${root}\\0${declaration.ui.widgets.join(',')}\\0`);\n hash.update(await statSignature(root, await snapshotFiles(root, entry, files), files));\n hash.update('\\n');\n }\n if (!any) return undefined;\n for (const file of [...(inputs ?? (await mcpAppInputs())), import.meta.filename].sort()) {\n hash.update(`${file}\\0`);\n hash.update(\n crypto\n .createHash('sha256')\n .update(getOrThrow(await files.readBinaryFile(file, BACKGROUND_CONTEXT)))\n .digest(),\n );\n }\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction mcpAppFile(poHome: string, key: string): string {\n return path.join(poHome, 'build', 'mcp-app', key, 'index.html');\n}\n\nasync function loadedBuild(key: string, file: string, files: FileSystem): Promise<McpAppBuild> {\n const html = getOrThrow(await files.readTextFile(file, BACKGROUND_CONTEXT));\n
|
|
1
|
+
{"version":3,"file":"mcpAppBuild.mjs","names":[],"sources":["../../../../src/builders/server/mcpAppBuild.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport path from 'node:path';\n\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow, pathExists } from '@agimon-ai/po-core/platform';\n\nimport { bundleMcpApp, mcpAppInputs, type McpAppSource } from './mcpApp';\nimport type { McpPluginCandidate } from './mcpBundle';\nimport { snapshotFiles, statSignature } from './packageUrl';\n\nexport interface McpAppBuild {\n readonly key: string;\n readonly file: string;\n readonly html: string;\n readonly sha256: string;\n}\n\nexport interface McpAppBuildInput {\n readonly files?: FileSystem;\n readonly poHome: string;\n readonly candidates: readonly McpPluginCandidate[];\n /** Test seam; defaults to `bundleMcpApp`. */\n readonly bundle?: typeof bundleMcpApp;\n}\n\nasync function widgetSources(candidates: readonly McpPluginCandidate[], files: FileSystem): Promise<McpAppSource[]> {\n const sources: McpAppSource[] = [];\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const file = getOrThrow(await files.canonicalPath(path.resolve(root, declaration.ui.dist), BACKGROUND_CONTEXT));\n const relative = path.relative(root, file);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative))\n throw new Error(`MCP UI entry escapes package: ${declaration.packageName}`);\n sources.push({ file, widgets: declaration.ui.widgets });\n }\n return sources;\n}\n\n/** Content key over every widget package's files, so any source change moves it. */\nexport async function mcpAppKey(\n candidates: readonly McpPluginCandidate[],\n inputs?: readonly string[],\n files: FileSystem = createNodePlatform().env(process.cwd()),\n): Promise<string | undefined> {\n const hash = crypto.createHash('sha256');\n let any = false;\n for (const { declaration } of candidates) {\n if (!declaration.ui || declaration.ui.widgets.length === 0) continue;\n any = true;\n const root = getOrThrow(await files.canonicalPath(declaration.packageDir, BACKGROUND_CONTEXT));\n const entry = path.resolve(root, declaration.ui.dist);\n hash.update(`${declaration.packageName}\\0${root}\\0${declaration.ui.widgets.join(',')}\\0`);\n hash.update(await statSignature(root, await snapshotFiles(root, entry, files), files));\n hash.update('\\n');\n }\n if (!any) return undefined;\n for (const file of [...(inputs ?? (await mcpAppInputs())), import.meta.filename].sort()) {\n hash.update(`${file}\\0`);\n hash.update(\n crypto\n .createHash('sha256')\n .update(getOrThrow(await files.readBinaryFile(file, BACKGROUND_CONTEXT)))\n .digest(),\n );\n }\n return hash.digest('hex').slice(0, 32);\n}\n\nfunction mcpAppFile(poHome: string, key: string): string {\n return path.join(poHome, 'build', 'mcp-app', key, 'index.html');\n}\n\n// A published build never changes, so every session shares one copy of its HTML (about 1.7 MB).\n// Rebuilds publish new keys, so only the most recent few stay cached.\nconst loadedBuilds = new Map<string, McpAppBuild>();\n\nasync function loadedBuild(key: string, file: string, files: FileSystem): Promise<McpAppBuild> {\n const cached = loadedBuilds.get(file);\n if (cached !== undefined) return cached;\n const html = getOrThrow(await files.readTextFile(file, BACKGROUND_CONTEXT));\n const build = { key, file, html, sha256: crypto.createHash('sha256').update(html).digest('hex') };\n loadedBuilds.set(file, build);\n const [oldest] = loadedBuilds.keys();\n if (loadedBuilds.size > 4 && oldest !== undefined) loadedBuilds.delete(oldest);\n return build;\n}\n\n/** Reads sync's build without building. A missing HTML file returns only its expected key. */\nexport async function readMcpAppBuild(\n input: Pick<McpAppBuildInput, 'poHome' | 'candidates' | 'files'>,\n): Promise<{ key: string; build?: McpAppBuild } | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n try {\n return { key, build: await loadedBuild(key, mcpAppFile(input.poHome, key), files) };\n } catch (error) {\n if (error instanceof Error && 'code' in error && error.code === 'not_found') return { key };\n throw error;\n }\n}\n\n/** Builds into a temporary sibling and atomically publishes the immutable HTML. */\nexport async function ensureMcpAppBuild(input: McpAppBuildInput): Promise<McpAppBuild | undefined> {\n const files = input.files ?? createNodePlatform().env(input.poHome);\n const key = await mcpAppKey(input.candidates, undefined, files);\n if (key === undefined) return undefined;\n const file = mcpAppFile(input.poHome, key);\n const directory = path.dirname(file);\n const parent = path.dirname(directory);\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) {\n getOrThrow(await files.createDir(parent, { recursive: true }, BACKGROUND_CONTEXT));\n const temporary = path.join(parent, `.${key}-${crypto.randomUUID()}`);\n getOrThrow(await files.createDir(temporary, undefined, BACKGROUND_CONTEXT));\n try {\n const built = await (input.bundle ?? bundleMcpApp)(await widgetSources(input.candidates, files), temporary);\n if (built === undefined) return undefined;\n getOrThrow(\n await files.writeFile(\n path.join(temporary, 'index.html'),\n getOrThrow(await files.readBinaryFile(path.join(temporary, built.file), BACKGROUND_CONTEXT)),\n BACKGROUND_CONTEXT,\n ),\n );\n try {\n getOrThrow(await files.renameFile(temporary, directory, BACKGROUND_CONTEXT));\n } catch (error) {\n // A concurrent build of the same key already published it.\n if (!(await pathExists(files, file, BACKGROUND_CONTEXT))) throw error;\n }\n } finally {\n getOrThrow(await files.remove(temporary, { recursive: true, force: true }, BACKGROUND_CONTEXT));\n }\n }\n return loadedBuild(key, file, files);\n}\n"],"mappings":";;;;;;;AAyBA,eAAe,cAAc,YAA2C,OAA4C;CAClH,MAAM,UAA0B,CAAC;CACjC,KAAK,MAAM,EAAE,iBAAiB,YAAY;EACxC,IAAI,CAAC,YAAY,MAAM,YAAY,GAAG,QAAQ,WAAW,GAAG;EAC5D,MAAM,OAAO,WAAW,MAAM,MAAM,cAAc,YAAY,YAAY,kBAAkB,CAAC;EAC7F,MAAM,OAAO,WAAW,MAAM,MAAM,cAAc,KAAK,QAAQ,MAAM,YAAY,GAAG,IAAI,GAAG,kBAAkB,CAAC;EAC9G,MAAM,WAAW,KAAK,SAAS,MAAM,IAAI;EACzC,IAAI,aAAa,QAAQ,SAAS,WAAW,KAAK,KAAK,KAAK,KAAK,KAAK,WAAW,QAAQ,GACvF,MAAM,IAAI,MAAM,iCAAiC,YAAY,aAAa;EAC5E,QAAQ,KAAK;GAAE;GAAM,SAAS,YAAY,GAAG;EAAQ,CAAC;CACxD;CAC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Q,IAAI,IAAI,GAAG,OAAO,WAAW,GAAG;EACpE,WAAW,MAAM,MAAM,UAAU,WAAW,KAAA,GAAW,kBAAkB,CAAC;EAC1E,IAAI;GACF,MAAM,QAAQ,OAAO,MAAM,UAAU,aAAA,CAAc,MAAM,cAAc,MAAM,YAAY,KAAK,GAAG,SAAS;GAC1G,IAAI,UAAU,KAAA,GAAW,OAAO,KAAA;GAChC,WACE,MAAM,MAAM,UACV,KAAK,KAAK,WAAW,YAAY,GACjC,WAAW,MAAM,MAAM,eAAe,KAAK,KAAK,WAAW,MAAM,IAAI,GAAG,kBAAkB,CAAC,GAC3F,kBACF,CACF;GACA,IAAI;IACF,WAAW,MAAM,MAAM,WAAW,WAAW,WAAW,kBAAkB,CAAC;GAC7E,SAAS,OAAO;IAEd,IAAI,CAAE,MAAM,WAAW,OAAO,MAAM,kBAAkB,GAAI,MAAM;GAClE;EACF,UAAU;GACR,WAAW,MAAM,MAAM,OAAO,WAAW;IAAE,WAAW;IAAM,OAAO;GAAK,GAAG,kBAAkB,CAAC;EAChG;CACF;CACA,OAAO,YAAY,KAAK,MAAM,KAAK;AACrC"}
|
|
@@ -239,6 +239,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
239
239
|
}
|
|
240
240
|
const sandboxes = (0, _agimon_ai_po_core_workspaceSandboxes.createWorkspaceSandboxRegistry)();
|
|
241
241
|
const servedWorkspaces = /* @__PURE__ */ new Set();
|
|
242
|
+
const failedAdmissions = /* @__PURE__ */ new Map();
|
|
242
243
|
const openSessions = (0, _agimon_ai_po_core_history.createOpenSessionRegistry)({
|
|
243
244
|
directory: serverDirectory,
|
|
244
245
|
onNotice: notice
|
|
@@ -1332,6 +1333,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1332
1333
|
resolveRepository: (requestedId) => requestedId === id ? root : void 0
|
|
1333
1334
|
}, bundle.packages);
|
|
1334
1335
|
servedWorkspaces.add(id);
|
|
1336
|
+
failedAdmissions.delete(id);
|
|
1335
1337
|
bundler.commitScope(`workspace:${id}`, root, "workspace", bundle.entries, takeFailedPackages(`workspace:${id}`, bundle.packages));
|
|
1336
1338
|
try {
|
|
1337
1339
|
await refreshWebBuild();
|
|
@@ -1364,7 +1366,7 @@ async function runServerRuntime(options, runtime) {
|
|
|
1364
1366
|
if (!wasRemembered) {
|
|
1365
1367
|
await hub.removeWorkspace(id);
|
|
1366
1368
|
workspaces.remove(id);
|
|
1367
|
-
}
|
|
1369
|
+
} else if (!servedWorkspaces.has(id)) failedAdmissions.set(id, root);
|
|
1368
1370
|
throw error;
|
|
1369
1371
|
} finally {
|
|
1370
1372
|
admissions.delete(id);
|
|
@@ -1765,6 +1767,12 @@ async function runServerRuntime(options, runtime) {
|
|
|
1765
1767
|
workspaceId: workspace.id
|
|
1766
1768
|
});
|
|
1767
1769
|
}
|
|
1770
|
+
const retries = new Map(failedAdmissions);
|
|
1771
|
+
failedAdmissions.clear();
|
|
1772
|
+
for (const [id, root] of retries) {
|
|
1773
|
+
if (!workspaces.list().some((workspace) => workspace.id === id)) continue;
|
|
1774
|
+
await admitWorkspace(root).catch((error) => notice(`Workspace '${root}' is still unavailable and retries at the next check: ${errorMessage(error)}`));
|
|
1775
|
+
}
|
|
1768
1776
|
telemetry.recordEvent("po_server.scope_check", {
|
|
1769
1777
|
source,
|
|
1770
1778
|
roots,
|