@agimon-ai/po 0.0.0-alpha.37 → 0.0.0-alpha.39
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 +58 -56
- package/dist/src/builders/native/index.cjs +3 -1
- package/dist/src/builders/native/index.cjs.map +1 -1
- package/dist/src/builders/native/index.d.mts.map +1 -1
- package/dist/src/builders/native/index.mjs +3 -1
- package/dist/src/builders/native/index.mjs.map +1 -1
- package/dist/src/builders/server/logSink.cjs +11 -9
- package/dist/src/builders/server/logSink.cjs.map +1 -1
- package/dist/src/builders/server/logSink.mjs +11 -9
- package/dist/src/builders/server/logSink.mjs.map +1 -1
- package/dist/src/builders/server/nativePush.cjs +82 -6
- package/dist/src/builders/server/nativePush.cjs.map +1 -1
- package/dist/src/builders/server/nativePush.mjs +83 -7
- package/dist/src/builders/server/nativePush.mjs.map +1 -1
- package/dist/src/builders/server/runtime.cjs +59 -4
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +61 -6
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/package.json +25 -25
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.39",
|
|
6
6
|
"dependencies": [
|
|
7
7
|
"@agimon-ai/po-artifact",
|
|
8
8
|
"@agimon-ai/po-autostop",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"@agimon-ai/po-artifact": {
|
|
26
|
-
"version": "0.0.0-alpha.
|
|
26
|
+
"version": "0.0.0-alpha.37",
|
|
27
27
|
"dependencies": [
|
|
28
28
|
"@agimon-ai/po-core",
|
|
29
29
|
"@agimon-ai/po-web-components",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
]
|
|
32
32
|
},
|
|
33
33
|
"@agimon-ai/po-author": {
|
|
34
|
-
"version": "0.0.0-alpha.
|
|
34
|
+
"version": "0.0.0-alpha.38",
|
|
35
35
|
"dependencies": [
|
|
36
36
|
"@agimon-ai/po-artifact",
|
|
37
37
|
"@agimon-ai/po-core",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"@agimon-ai/po-autocompact": {
|
|
44
|
-
"version": "0.0.0-alpha.
|
|
44
|
+
"version": "0.0.0-alpha.38",
|
|
45
45
|
"dependencies": [
|
|
46
46
|
"@agimon-ai/po-artifact",
|
|
47
47
|
"@agimon-ai/po-config",
|
|
@@ -49,24 +49,24 @@
|
|
|
49
49
|
]
|
|
50
50
|
},
|
|
51
51
|
"@agimon-ai/po-autostop": {
|
|
52
|
-
"version": "0.0.0-alpha.
|
|
52
|
+
"version": "0.0.0-alpha.38",
|
|
53
53
|
"dependencies": [
|
|
54
54
|
"@agimon-ai/po-core"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
57
|
"@agimon-ai/po-browse": {
|
|
58
|
-
"version": "0.0.1-alpha.
|
|
58
|
+
"version": "0.0.1-alpha.36",
|
|
59
59
|
"dependencies": [
|
|
60
60
|
"@agimon-ai/po-core",
|
|
61
61
|
"@agimon-ai/po-web-components"
|
|
62
62
|
]
|
|
63
63
|
},
|
|
64
64
|
"@agimon-ai/po-build": {
|
|
65
|
-
"version": "0.0.0-alpha.
|
|
65
|
+
"version": "0.0.0-alpha.38",
|
|
66
66
|
"dependencies": []
|
|
67
67
|
},
|
|
68
68
|
"@agimon-ai/po-cache": {
|
|
69
|
-
"version": "0.0.0-alpha.
|
|
69
|
+
"version": "0.0.0-alpha.38",
|
|
70
70
|
"dependencies": [
|
|
71
71
|
"@agimon-ai/po-config",
|
|
72
72
|
"@agimon-ai/po-core",
|
|
@@ -74,11 +74,11 @@
|
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
76
|
"@agimon-ai/po-claude-bridge": {
|
|
77
|
-
"version": "0.1.1-alpha.
|
|
77
|
+
"version": "0.1.1-alpha.18",
|
|
78
78
|
"dependencies": []
|
|
79
79
|
},
|
|
80
80
|
"@agimon-ai/po-codemode": {
|
|
81
|
-
"version": "0.0.1-alpha.
|
|
81
|
+
"version": "0.0.1-alpha.11",
|
|
82
82
|
"dependencies": [
|
|
83
83
|
"@agimon-ai/po-config",
|
|
84
84
|
"@agimon-ai/po-core",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
]
|
|
87
87
|
},
|
|
88
88
|
"@agimon-ai/po-computer-use": {
|
|
89
|
-
"version": "0.0.0-alpha.
|
|
89
|
+
"version": "0.0.0-alpha.38",
|
|
90
90
|
"dependencies": [
|
|
91
91
|
"@agimon-ai/po-config",
|
|
92
92
|
"@agimon-ai/po-core",
|
|
@@ -96,20 +96,20 @@
|
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
98
|
"@agimon-ai/po-config": {
|
|
99
|
-
"version": "0.0.0-alpha.
|
|
99
|
+
"version": "0.0.0-alpha.38",
|
|
100
100
|
"dependencies": [
|
|
101
101
|
"@agimon-ai/po-core",
|
|
102
102
|
"@agimon-ai/po-web-components"
|
|
103
103
|
]
|
|
104
104
|
},
|
|
105
105
|
"@agimon-ai/po-core": {
|
|
106
|
-
"version": "0.0.0-alpha.
|
|
106
|
+
"version": "0.0.0-alpha.38",
|
|
107
107
|
"dependencies": [
|
|
108
108
|
"@agimon-ai/po-web-security"
|
|
109
109
|
]
|
|
110
110
|
},
|
|
111
111
|
"@agimon-ai/po-domain": {
|
|
112
|
-
"version": "0.0.0-alpha.
|
|
112
|
+
"version": "0.0.0-alpha.38",
|
|
113
113
|
"dependencies": [
|
|
114
114
|
"@agimon-ai/po-config",
|
|
115
115
|
"@agimon-ai/po-core",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
]
|
|
118
118
|
},
|
|
119
119
|
"@agimon-ai/po-dynamic-workflow": {
|
|
120
|
-
"version": "0.0.1-alpha.
|
|
120
|
+
"version": "0.0.1-alpha.6",
|
|
121
121
|
"dependencies": [
|
|
122
122
|
"@agimon-ai/po-core",
|
|
123
123
|
"@agimon-ai/po-native-components",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
]
|
|
126
126
|
},
|
|
127
127
|
"@agimon-ai/po-edit": {
|
|
128
|
-
"version": "0.0.0-alpha.
|
|
128
|
+
"version": "0.0.0-alpha.38",
|
|
129
129
|
"dependencies": [
|
|
130
130
|
"@agimon-ai/po-core",
|
|
131
131
|
"@agimon-ai/po-hashline",
|
|
@@ -134,7 +134,7 @@
|
|
|
134
134
|
]
|
|
135
135
|
},
|
|
136
136
|
"@agimon-ai/po-file-edit": {
|
|
137
|
-
"version": "0.0.0-alpha.
|
|
137
|
+
"version": "0.0.0-alpha.38",
|
|
138
138
|
"dependencies": [
|
|
139
139
|
"@agimon-ai/po-config",
|
|
140
140
|
"@agimon-ai/po-core",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
]
|
|
145
145
|
},
|
|
146
146
|
"@agimon-ai/po-git": {
|
|
147
|
-
"version": "0.0.0-alpha.
|
|
147
|
+
"version": "0.0.0-alpha.38",
|
|
148
148
|
"dependencies": [
|
|
149
149
|
"@agimon-ai/po-core",
|
|
150
150
|
"@agimon-ai/po-session",
|
|
@@ -153,7 +153,7 @@
|
|
|
153
153
|
]
|
|
154
154
|
},
|
|
155
155
|
"@agimon-ai/po-goal": {
|
|
156
|
-
"version": "0.0.0-alpha.
|
|
156
|
+
"version": "0.0.0-alpha.38",
|
|
157
157
|
"dependencies": [
|
|
158
158
|
"@agimon-ai/po-core",
|
|
159
159
|
"@agimon-ai/po-minor-mode",
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
]
|
|
163
163
|
},
|
|
164
164
|
"@agimon-ai/po-grep": {
|
|
165
|
-
"version": "0.0.0-alpha.
|
|
165
|
+
"version": "0.0.0-alpha.38",
|
|
166
166
|
"dependencies": [
|
|
167
167
|
"@agimon-ai/po-core",
|
|
168
168
|
"@agimon-ai/po-hashline",
|
|
@@ -171,11 +171,11 @@
|
|
|
171
171
|
]
|
|
172
172
|
},
|
|
173
173
|
"@agimon-ai/po-hashline": {
|
|
174
|
-
"version": "0.0.0-alpha.
|
|
174
|
+
"version": "0.0.0-alpha.38",
|
|
175
175
|
"dependencies": []
|
|
176
176
|
},
|
|
177
177
|
"@agimon-ai/po-help": {
|
|
178
|
-
"version": "0.0.0-alpha.
|
|
178
|
+
"version": "0.0.0-alpha.38",
|
|
179
179
|
"dependencies": [
|
|
180
180
|
"@agimon-ai/po-core",
|
|
181
181
|
"@agimon-ai/po-minor-mode",
|
|
@@ -183,14 +183,14 @@
|
|
|
183
183
|
]
|
|
184
184
|
},
|
|
185
185
|
"@agimon-ai/po-hook": {
|
|
186
|
-
"version": "0.0.0-alpha.
|
|
186
|
+
"version": "0.0.0-alpha.38",
|
|
187
187
|
"dependencies": [
|
|
188
188
|
"@agimon-ai/po-config",
|
|
189
189
|
"@agimon-ai/po-core"
|
|
190
190
|
]
|
|
191
191
|
},
|
|
192
192
|
"@agimon-ai/po-image-gen": {
|
|
193
|
-
"version": "0.0.0-alpha.
|
|
193
|
+
"version": "0.0.0-alpha.37",
|
|
194
194
|
"dependencies": [
|
|
195
195
|
"@agimon-ai/po-core",
|
|
196
196
|
"@agimon-ai/po-web-components",
|
|
@@ -198,7 +198,7 @@
|
|
|
198
198
|
]
|
|
199
199
|
},
|
|
200
200
|
"@agimon-ai/po-log": {
|
|
201
|
-
"version": "0.0.0-alpha.
|
|
201
|
+
"version": "0.0.0-alpha.38",
|
|
202
202
|
"dependencies": [
|
|
203
203
|
"@agimon-ai/po-core",
|
|
204
204
|
"@agimon-ai/po-web-components",
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
]
|
|
207
207
|
},
|
|
208
208
|
"@agimon-ai/po-loop": {
|
|
209
|
-
"version": "0.0.0-alpha.
|
|
209
|
+
"version": "0.0.0-alpha.38",
|
|
210
210
|
"dependencies": [
|
|
211
211
|
"@agimon-ai/po-core",
|
|
212
212
|
"@agimon-ai/po-minor-mode",
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
]
|
|
216
216
|
},
|
|
217
217
|
"@agimon-ai/po-major-mode": {
|
|
218
|
-
"version": "0.0.0-alpha.
|
|
218
|
+
"version": "0.0.0-alpha.38",
|
|
219
219
|
"dependencies": [
|
|
220
220
|
"@agimon-ai/po-config",
|
|
221
221
|
"@agimon-ai/po-core",
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
]
|
|
224
224
|
},
|
|
225
225
|
"@agimon-ai/po-mcp": {
|
|
226
|
-
"version": "0.0.0-alpha.
|
|
226
|
+
"version": "0.0.0-alpha.38",
|
|
227
227
|
"dependencies": [
|
|
228
228
|
"@agimon-ai/po-config",
|
|
229
229
|
"@agimon-ai/po-core",
|
|
@@ -233,36 +233,36 @@
|
|
|
233
233
|
]
|
|
234
234
|
},
|
|
235
235
|
"@agimon-ai/po-mcp-proxy": {
|
|
236
|
-
"version": "0.0.1-alpha.
|
|
236
|
+
"version": "0.0.1-alpha.17",
|
|
237
237
|
"dependencies": []
|
|
238
238
|
},
|
|
239
239
|
"@agimon-ai/po-minor-mode": {
|
|
240
|
-
"version": "0.0.0-alpha.
|
|
240
|
+
"version": "0.0.0-alpha.38",
|
|
241
241
|
"dependencies": [
|
|
242
242
|
"@agimon-ai/po-core"
|
|
243
243
|
]
|
|
244
244
|
},
|
|
245
245
|
"@agimon-ai/po-model-guidance": {
|
|
246
|
-
"version": "0.0.0-alpha.
|
|
246
|
+
"version": "0.0.0-alpha.38",
|
|
247
247
|
"dependencies": [
|
|
248
248
|
"@agimon-ai/po-config",
|
|
249
249
|
"@agimon-ai/po-core"
|
|
250
250
|
]
|
|
251
251
|
},
|
|
252
252
|
"@agimon-ai/po-native-components": {
|
|
253
|
-
"version": "0.0.0-alpha.
|
|
253
|
+
"version": "0.0.0-alpha.38",
|
|
254
254
|
"dependencies": [
|
|
255
255
|
"@agimon-ai/po-web-components"
|
|
256
256
|
]
|
|
257
257
|
},
|
|
258
258
|
"@agimon-ai/po-notification": {
|
|
259
|
-
"version": "0.0.0-alpha.
|
|
259
|
+
"version": "0.0.0-alpha.38",
|
|
260
260
|
"dependencies": [
|
|
261
261
|
"@agimon-ai/po-core"
|
|
262
262
|
]
|
|
263
263
|
},
|
|
264
264
|
"@agimon-ai/po-plan": {
|
|
265
|
-
"version": "0.0.0-alpha.
|
|
265
|
+
"version": "0.0.0-alpha.38",
|
|
266
266
|
"dependencies": [
|
|
267
267
|
"@agimon-ai/po-config",
|
|
268
268
|
"@agimon-ai/po-core",
|
|
@@ -272,7 +272,7 @@
|
|
|
272
272
|
]
|
|
273
273
|
},
|
|
274
274
|
"@agimon-ai/po-profile": {
|
|
275
|
-
"version": "0.0.0-alpha.
|
|
275
|
+
"version": "0.0.0-alpha.38",
|
|
276
276
|
"dependencies": [
|
|
277
277
|
"@agimon-ai/po-config",
|
|
278
278
|
"@agimon-ai/po-core",
|
|
@@ -280,7 +280,7 @@
|
|
|
280
280
|
]
|
|
281
281
|
},
|
|
282
282
|
"@agimon-ai/po-prompt": {
|
|
283
|
-
"version": "0.0.0-alpha.
|
|
283
|
+
"version": "0.0.0-alpha.38",
|
|
284
284
|
"dependencies": [
|
|
285
285
|
"@agimon-ai/po-core",
|
|
286
286
|
"@agimon-ai/po-web-components",
|
|
@@ -288,7 +288,7 @@
|
|
|
288
288
|
]
|
|
289
289
|
},
|
|
290
290
|
"@agimon-ai/po-read": {
|
|
291
|
-
"version": "0.0.0-alpha.
|
|
291
|
+
"version": "0.0.0-alpha.38",
|
|
292
292
|
"dependencies": [
|
|
293
293
|
"@agimon-ai/po-config",
|
|
294
294
|
"@agimon-ai/po-core",
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
]
|
|
299
299
|
},
|
|
300
300
|
"@agimon-ai/po-runner": {
|
|
301
|
-
"version": "0.0.0-alpha.
|
|
301
|
+
"version": "0.0.0-alpha.38",
|
|
302
302
|
"dependencies": [
|
|
303
303
|
"@agimon-ai/po-core",
|
|
304
304
|
"@agimon-ai/po-ui",
|
|
@@ -307,19 +307,21 @@
|
|
|
307
307
|
]
|
|
308
308
|
},
|
|
309
309
|
"@agimon-ai/po-sandbox": {
|
|
310
|
-
"version": "0.0.0-alpha.
|
|
310
|
+
"version": "0.0.0-alpha.38",
|
|
311
311
|
"dependencies": [
|
|
312
312
|
"@agimon-ai/po-core"
|
|
313
313
|
]
|
|
314
314
|
},
|
|
315
315
|
"@agimon-ai/po-session": {
|
|
316
|
-
"version": "0.0.0-alpha.
|
|
316
|
+
"version": "0.0.0-alpha.38",
|
|
317
317
|
"dependencies": [
|
|
318
|
-
"@agimon-ai/po-
|
|
318
|
+
"@agimon-ai/po-config",
|
|
319
|
+
"@agimon-ai/po-core",
|
|
320
|
+
"@agimon-ai/po-web-security"
|
|
319
321
|
]
|
|
320
322
|
},
|
|
321
323
|
"@agimon-ai/po-skill": {
|
|
322
|
-
"version": "0.0.0-alpha.
|
|
324
|
+
"version": "0.0.0-alpha.38",
|
|
323
325
|
"dependencies": [
|
|
324
326
|
"@agimon-ai/po-config",
|
|
325
327
|
"@agimon-ai/po-core",
|
|
@@ -328,7 +330,7 @@
|
|
|
328
330
|
]
|
|
329
331
|
},
|
|
330
332
|
"@agimon-ai/po-style-system": {
|
|
331
|
-
"version": "0.0.0-alpha.
|
|
333
|
+
"version": "0.0.0-alpha.38",
|
|
332
334
|
"dependencies": [
|
|
333
335
|
"@agimon-ai/po-core",
|
|
334
336
|
"@agimon-ai/po-web-components",
|
|
@@ -336,7 +338,7 @@
|
|
|
336
338
|
]
|
|
337
339
|
},
|
|
338
340
|
"@agimon-ai/po-task": {
|
|
339
|
-
"version": "0.0.0-alpha.
|
|
341
|
+
"version": "0.0.0-alpha.38",
|
|
340
342
|
"dependencies": [
|
|
341
343
|
"@agimon-ai/po-core",
|
|
342
344
|
"@agimon-ai/po-ui",
|
|
@@ -344,7 +346,7 @@
|
|
|
344
346
|
]
|
|
345
347
|
},
|
|
346
348
|
"@agimon-ai/po-team": {
|
|
347
|
-
"version": "0.0.0-alpha.
|
|
349
|
+
"version": "0.0.0-alpha.38",
|
|
348
350
|
"dependencies": [
|
|
349
351
|
"@agimon-ai/po-cache",
|
|
350
352
|
"@agimon-ai/po-config",
|
|
@@ -356,7 +358,7 @@
|
|
|
356
358
|
]
|
|
357
359
|
},
|
|
358
360
|
"@agimon-ai/po-template-advanced": {
|
|
359
|
-
"version": "0.0.0-alpha.
|
|
361
|
+
"version": "0.0.0-alpha.38",
|
|
360
362
|
"dependencies": [
|
|
361
363
|
"@agimon-ai/po-core",
|
|
362
364
|
"@agimon-ai/po-web-components",
|
|
@@ -364,7 +366,7 @@
|
|
|
364
366
|
]
|
|
365
367
|
},
|
|
366
368
|
"@agimon-ai/po-template-elegant": {
|
|
367
|
-
"version": "0.0.0-alpha.
|
|
369
|
+
"version": "0.0.0-alpha.38",
|
|
368
370
|
"dependencies": [
|
|
369
371
|
"@agimon-ai/po-core",
|
|
370
372
|
"@agimon-ai/po-web-components",
|
|
@@ -372,7 +374,7 @@
|
|
|
372
374
|
]
|
|
373
375
|
},
|
|
374
376
|
"@agimon-ai/po-ui": {
|
|
375
|
-
"version": "0.0.0-alpha.
|
|
377
|
+
"version": "0.0.0-alpha.38",
|
|
376
378
|
"dependencies": [
|
|
377
379
|
"@agimon-ai/po-core",
|
|
378
380
|
"@agimon-ai/po-hashline",
|
|
@@ -381,7 +383,7 @@
|
|
|
381
383
|
]
|
|
382
384
|
},
|
|
383
385
|
"@agimon-ai/po-user-feedback": {
|
|
384
|
-
"version": "0.0.0-alpha.
|
|
386
|
+
"version": "0.0.0-alpha.38",
|
|
385
387
|
"dependencies": [
|
|
386
388
|
"@agimon-ai/po-core",
|
|
387
389
|
"@agimon-ai/po-minor-mode",
|
|
@@ -390,7 +392,7 @@
|
|
|
390
392
|
]
|
|
391
393
|
},
|
|
392
394
|
"@agimon-ai/po-vibe-lint": {
|
|
393
|
-
"version": "0.0.1-alpha.
|
|
395
|
+
"version": "0.0.1-alpha.7",
|
|
394
396
|
"dependencies": [
|
|
395
397
|
"@agimon-ai/po-config",
|
|
396
398
|
"@agimon-ai/po-core",
|
|
@@ -400,7 +402,7 @@
|
|
|
400
402
|
]
|
|
401
403
|
},
|
|
402
404
|
"@agimon-ai/po-voice": {
|
|
403
|
-
"version": "0.0.0-alpha.
|
|
405
|
+
"version": "0.0.0-alpha.38",
|
|
404
406
|
"dependencies": [
|
|
405
407
|
"@agimon-ai/po-config",
|
|
406
408
|
"@agimon-ai/po-core",
|
|
@@ -412,11 +414,11 @@
|
|
|
412
414
|
]
|
|
413
415
|
},
|
|
414
416
|
"@agimon-ai/po-web-components": {
|
|
415
|
-
"version": "0.0.0-alpha.
|
|
417
|
+
"version": "0.0.0-alpha.38",
|
|
416
418
|
"dependencies": []
|
|
417
419
|
},
|
|
418
420
|
"@agimon-ai/po-web-dashboard": {
|
|
419
|
-
"version": "0.0.0-alpha.
|
|
421
|
+
"version": "0.0.0-alpha.38",
|
|
420
422
|
"dependencies": [
|
|
421
423
|
"@agimon-ai/po-core",
|
|
422
424
|
"@agimon-ai/po-web-components",
|
|
@@ -424,18 +426,18 @@
|
|
|
424
426
|
]
|
|
425
427
|
},
|
|
426
428
|
"@agimon-ai/po-web-search": {
|
|
427
|
-
"version": "0.0.0-alpha.
|
|
429
|
+
"version": "0.0.0-alpha.37",
|
|
428
430
|
"dependencies": [
|
|
429
431
|
"@agimon-ai/po-core",
|
|
430
432
|
"@agimon-ai/po-web-components"
|
|
431
433
|
]
|
|
432
434
|
},
|
|
433
435
|
"@agimon-ai/po-web-security": {
|
|
434
|
-
"version": "0.0.0-alpha.
|
|
436
|
+
"version": "0.0.0-alpha.38",
|
|
435
437
|
"dependencies": []
|
|
436
438
|
},
|
|
437
439
|
"@agimon-ai/po-workflow": {
|
|
438
|
-
"version": "0.0.0-alpha.
|
|
440
|
+
"version": "0.0.0-alpha.38",
|
|
439
441
|
"dependencies": [
|
|
440
442
|
"@agimon-ai/po-core",
|
|
441
443
|
"@agimon-ai/po-minor-mode",
|
|
@@ -73,10 +73,12 @@ function readNativeAppBuild(poHome, platform) {
|
|
|
73
73
|
if (typeof record.key !== "string" || !/^[a-f0-9]{64}$/u.test(record.key)) return void 0;
|
|
74
74
|
const directory = node_path.default.join(poHome, "build", "app", platform, record.key);
|
|
75
75
|
const descriptor = JSON.parse(node_fs.default.readFileSync(node_path.default.join(directory, _agimon_ai_po_web_security.APP_DESCRIPTOR_PATH), "utf8"));
|
|
76
|
+
if (descriptor.builtAt !== void 0 && (typeof descriptor.builtAt !== "number" || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)) return void 0;
|
|
76
77
|
return typeof descriptor.fingerprint === "string" ? {
|
|
77
78
|
key: record.key,
|
|
78
79
|
directory,
|
|
79
|
-
fingerprint: descriptor.fingerprint
|
|
80
|
+
fingerprint: descriptor.fingerprint,
|
|
81
|
+
...descriptor.builtAt === void 0 ? {} : { builtAt: descriptor.builtAt }
|
|
80
82
|
} : void 0;
|
|
81
83
|
} catch {
|
|
82
84
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["NATIVE_HOST_MODULE_IDS","path","scanWebPlugins","globalBuildKey","readBuildJson","fs","APP_DESCRIPTOR_PATH","NATIVE_COMPOSITION_MAX_BYTES","NATIVE_ENTRY_PATH","singleFlightBuild","buildKeyDirectory","mountWebPluginIds"],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport type { GlobalNativeBuild, NativeAppBuild } from '@agimon-ai/po-core/webCompositions';\nimport { APP_DESCRIPTOR_PATH, NATIVE_COMPOSITION_MAX_BYTES, NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\nimport { rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The one global native composition: every package's `poNative` client bundled into a single\n * CommonJS file the po-native shell evaluates against its own host modules.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so the bundle only joins\n * those files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-1';\nconst ENTRY_FILE = 'entry.mjs';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalNativeBuild(input: GlobalNativeBuildInput): ResolvedGlobalNativeBuild {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n key = globalBuildKey(GLOBAL_NATIVE_BUILD_FORMAT, undefined, plugins);\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return { status: 'resolved', plugins, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\nfunction readBuildRecord(directory: string): GlobalNativeBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalNativeBuildRecord(poHome: string, key: string): GlobalNativeBuildRecord | undefined {\n return readBuildRecord(path.join(poHome, 'build', 'native', key));\n}\n\n/** The platforms `po sync` exports an over-the-air app bundle for. */\nexport const NATIVE_APP_PLATFORMS = ['ios', 'android'] as const;\n\n/**\n * The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`\n * names once the export is complete. Undefined when there is none. Never builds.\n */\nexport function readNativeAppBuild(poHome: string, platform: string): NativeAppBuild | undefined {\n try {\n const record = JSON.parse(fs.readFileSync(path.join(poHome, 'build', `app-${platform}.json`), 'utf8')) as {\n key?: unknown;\n };\n if (typeof record.key !== 'string' || !/^[a-f0-9]{64}$/u.test(record.key)) return undefined;\n const directory = path.join(poHome, 'build', 'app', platform, record.key);\n const descriptor = JSON.parse(fs.readFileSync(path.join(directory, APP_DESCRIPTOR_PATH), 'utf8')) as {\n fingerprint?: unknown;\n };\n return typeof descriptor.fingerprint === 'string'\n ? { key: record.key, directory, fingerprint: descriptor.fingerprint }\n : undefined;\n } catch {\n // Never exported here (an installed Po, not a source checkout), or pruned: nothing to offer.\n return undefined;\n }\n}\n\n/** The generated entry: each plugin's `nativePlugin` export, in install order. */\nfunction renderEntry(plugins: readonly DeclaredWebPlugin[]): string {\n const lines = plugins.map(\n (plugin, index) =>\n `import { nativePlugin as pN${String(index)} } from ${JSON.stringify(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry)))};`,\n );\n lines.push(`export const plugins = [${plugins.map((_, index) => `pN${String(index)}`).join(', ')}];`, '');\n return lines.join('\\n');\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** Bundles the plugins into `<outDir>/plugins/composition.js`: CommonJS, one file, host modules external. */\nasync function bundleNativeComposition(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<void> {\n const entryFile = path.join(outDir, ENTRY_FILE);\n fs.writeFileSync(entryFile, renderEntry(plugins));\n try {\n const bundle = await rolldown({\n input: entryFile,\n cwd: outDir,\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source)) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n },\n ],\n });\n try {\n const { output } = await bundle.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk')\n throw new Error(\n `The native composition must be exactly one file; the build produced ${String(output.length)}.`,\n );\n const bytes = Buffer.byteLength(chunk.code);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native composition is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n fs.mkdirSync(pluginsDirectory, { recursive: true });\n fs.writeFileSync(path.join(pluginsDirectory, NATIVE_ENTRY_PATH.replace(/^\\//, '')), chunk.code);\n } finally {\n await bundle.close();\n }\n } finally {\n fs.rmSync(entryFile, { force: true });\n }\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/composition.js`, built in a temporary\n * directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n await bundleNativeComposition(plugins, temporary, notice);\n return {\n key,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,6BA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,gBAAgB,SAAS,SAAS,MAAM,KAAA,IAAY,YAAY;EAAW,KAAK,SAAS;CAAI;AAChH;;;;;;;AAQA,eAAsB,wBAAwB,OAAiE;CAC7G,MAAM,SAAS,MAAM,mBAAyB,CAAC;CAC/C,MAAM,WAAW,yBAAyB,KAAK;CAC/C,IAAI,SAAS,WAAW,YAAY,OAAO;CAC3C,MAAM,EAAE,SAAS,KAAK,YAAY,cAAc;CAChD,MAAM,WAAW,gBAAgB,SAAS;CAC1C,IAAI,aAAa,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAU,OAAO;CAAS;CACvE,OAAOC,cAAAA,kBAAkB,KAAK,YAA8C;EAC1E,IAAI;GACF,MAAMC,cAAAA,kBAAkB,YAAY,KAAK,WAAW,OAAO,cAAc;IACvE,MAAM,wBAAwB,SAAS,WAAW,MAAM;IACxD,OAAO;KACL;KACA,SAAS,QAAQ,KAAK,EAAE,UAAU,YAAY,cAAc;MAAE;MAAU;MAAY;KAAO,EAAE;IAC/F;GACF,CAAC;GACD,MAAM,QAAQ,gBAAgB,SAAS;GACvC,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,qBAAqB,IAAI,oBAAoB;GACtF,OAAO;IAAE,QAAQ;IAAS;GAAM;EAClC,SAAS,OAAO;GACd,OAAO;IAAE,QAAQ;IAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE;EAC5F;CACF,CAAC;AACH;;AAGA,MAAa,uBACXC,cAAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["NATIVE_HOST_MODULE_IDS","path","scanWebPlugins","globalBuildKey","readBuildJson","fs","APP_DESCRIPTOR_PATH","NATIVE_COMPOSITION_MAX_BYTES","NATIVE_ENTRY_PATH","singleFlightBuild","buildKeyDirectory","mountWebPluginIds"],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport type { GlobalNativeBuild, NativeAppBuild } from '@agimon-ai/po-core/webCompositions';\nimport { APP_DESCRIPTOR_PATH, NATIVE_COMPOSITION_MAX_BYTES, NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\nimport { rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The one global native composition: every package's `poNative` client bundled into a single\n * CommonJS file the po-native shell evaluates against its own host modules.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so the bundle only joins\n * those files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-1';\nconst ENTRY_FILE = 'entry.mjs';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalNativeBuild(input: GlobalNativeBuildInput): ResolvedGlobalNativeBuild {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n key = globalBuildKey(GLOBAL_NATIVE_BUILD_FORMAT, undefined, plugins);\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return { status: 'resolved', plugins, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\nfunction readBuildRecord(directory: string): GlobalNativeBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalNativeBuildRecord(poHome: string, key: string): GlobalNativeBuildRecord | undefined {\n return readBuildRecord(path.join(poHome, 'build', 'native', key));\n}\n\n/** The platforms `po sync` exports an over-the-air app bundle for. */\nexport const NATIVE_APP_PLATFORMS = ['ios', 'android'] as const;\n\n/**\n * The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`\n * names once the export is complete. Undefined when there is none. Never builds.\n */\nexport function readNativeAppBuild(poHome: string, platform: string): NativeAppBuild | undefined {\n try {\n const record = JSON.parse(fs.readFileSync(path.join(poHome, 'build', `app-${platform}.json`), 'utf8')) as {\n key?: unknown;\n };\n if (typeof record.key !== 'string' || !/^[a-f0-9]{64}$/u.test(record.key)) return undefined;\n const directory = path.join(poHome, 'build', 'app', platform, record.key);\n const descriptor = JSON.parse(fs.readFileSync(path.join(directory, APP_DESCRIPTOR_PATH), 'utf8')) as {\n fingerprint?: unknown;\n builtAt?: unknown;\n };\n if (\n descriptor.builtAt !== undefined &&\n (typeof descriptor.builtAt !== 'number' || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)\n )\n return undefined;\n return typeof descriptor.fingerprint === 'string'\n ? {\n key: record.key,\n directory,\n fingerprint: descriptor.fingerprint,\n ...(descriptor.builtAt === undefined ? {} : { builtAt: descriptor.builtAt }),\n }\n : undefined;\n } catch {\n // Never exported here (an installed Po, not a source checkout), or pruned: nothing to offer.\n return undefined;\n }\n}\n\n/** The generated entry: each plugin's `nativePlugin` export, in install order. */\nfunction renderEntry(plugins: readonly DeclaredWebPlugin[]): string {\n const lines = plugins.map(\n (plugin, index) =>\n `import { nativePlugin as pN${String(index)} } from ${JSON.stringify(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry)))};`,\n );\n lines.push(`export const plugins = [${plugins.map((_, index) => `pN${String(index)}`).join(', ')}];`, '');\n return lines.join('\\n');\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** Bundles the plugins into `<outDir>/plugins/composition.js`: CommonJS, one file, host modules external. */\nasync function bundleNativeComposition(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<void> {\n const entryFile = path.join(outDir, ENTRY_FILE);\n fs.writeFileSync(entryFile, renderEntry(plugins));\n try {\n const bundle = await rolldown({\n input: entryFile,\n cwd: outDir,\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source)) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n },\n ],\n });\n try {\n const { output } = await bundle.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk')\n throw new Error(\n `The native composition must be exactly one file; the build produced ${String(output.length)}.`,\n );\n const bytes = Buffer.byteLength(chunk.code);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native composition is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n fs.mkdirSync(pluginsDirectory, { recursive: true });\n fs.writeFileSync(path.join(pluginsDirectory, NATIVE_ENTRY_PATH.replace(/^\\//, '')), chunk.code);\n } finally {\n await bundle.close();\n }\n } finally {\n fs.rmSync(entryFile, { force: true });\n }\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/composition.js`, built in a temporary\n * directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n await bundleNativeComposition(plugins, temporary, notice);\n return {\n key,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,6BAA6B;AACnC,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,eAAoC,IAAI,IAAIA,0BAAAA,sBAAsB;;AAgCxE,SAAS,yBAAyB,OAA0D;CAC1F,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,YAAY,KAAK,SAASC,UAAAA,QAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;CAC3F,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,UAAUC,sBAAAA,eAAe,KAAA,GAAW,aAAa,MAAM,mBAAyB,CAAC,IAAI,UAAU;EAC/F,IAAI,QAAQ,WAAW,GACrB,OAAO;GAAE,QAAQ;GAAW,QAAQ;EAA0E;EAChH,MAAMC,cAAAA,eAAe,4BAA4B,KAAA,GAAW,OAAO;CACrE,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ;GAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAAE;CAC5F;CACA,MAAM,aAAaF,UAAAA,QAAK,KAAK,MAAM,QAAQ,SAAS,QAAQ;CAC5D,OAAO;EAAE,QAAQ;EAAY;EAAS;EAAK;EAAY,WAAWA,UAAAA,QAAK,KAAK,YAAY,GAAG;CAAE;AAC/F;AAEA,SAAS,gBAAgB,WAAwD;CAC/E,MAAM,SAASG,cAAAA,cAAiE,SAAS;CACzF,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;C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AAA,GAAW,MAAM,IAAI,MAAM,qBAAqB,IAAI,oBAAoB;GACtF,OAAO;IAAE,QAAQ;IAAS;GAAM;EAClC,SAAS,OAAO;GACd,OAAO;IAAE,QAAQ;IAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE;EAC5F;CACF,CAAC;AACH;;AAGA,MAAa,uBACXC,cAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/native/index.ts"],"mappings":";;;iBA4BiB,gCAAgC;EAC/C;IAAW;IAAkB;IAAoB;;;iBAGlC;;EAEf;;EAEA;EACA,YAAY;;YAGF;EACN;EAA4B,OAAO;;EACnC;EAAmB;;EACnB;EAAkB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/native/index.ts"],"mappings":";;;iBA4BiB,gCAAgC;EAC/C;IAAW;IAAkB;IAAoB;;;iBAGlC;;EAEf;;EAEA;EACA,YAAY;;YAGF;EACN;EAA4B,OAAO;;EACnC;EAAmB;;EACnB;EAAkB;;;;;;;;wBAkKF,wBAAwB,OAAO,yBAAyB,QAAQ"}
|
|
@@ -70,10 +70,12 @@ function readNativeAppBuild(poHome, platform) {
|
|
|
70
70
|
if (typeof record.key !== "string" || !/^[a-f0-9]{64}$/u.test(record.key)) return void 0;
|
|
71
71
|
const directory = path.join(poHome, "build", "app", platform, record.key);
|
|
72
72
|
const descriptor = JSON.parse(fs.readFileSync(path.join(directory, APP_DESCRIPTOR_PATH), "utf8"));
|
|
73
|
+
if (descriptor.builtAt !== void 0 && (typeof descriptor.builtAt !== "number" || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)) return void 0;
|
|
73
74
|
return typeof descriptor.fingerprint === "string" ? {
|
|
74
75
|
key: record.key,
|
|
75
76
|
directory,
|
|
76
|
-
fingerprint: descriptor.fingerprint
|
|
77
|
+
fingerprint: descriptor.fingerprint,
|
|
78
|
+
...descriptor.builtAt === void 0 ? {} : { builtAt: descriptor.builtAt }
|
|
77
79
|
} : void 0;
|
|
78
80
|
} catch {
|
|
79
81
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport type { GlobalNativeBuild, NativeAppBuild } from '@agimon-ai/po-core/webCompositions';\nimport { APP_DESCRIPTOR_PATH, NATIVE_COMPOSITION_MAX_BYTES, NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\nimport { rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The one global native composition: every package's `poNative` client bundled into a single\n * CommonJS file the po-native shell evaluates against its own host modules.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so the bundle only joins\n * those files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-1';\nconst ENTRY_FILE = 'entry.mjs';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalNativeBuild(input: GlobalNativeBuildInput): ResolvedGlobalNativeBuild {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n key = globalBuildKey(GLOBAL_NATIVE_BUILD_FORMAT, undefined, plugins);\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return { status: 'resolved', plugins, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\nfunction readBuildRecord(directory: string): GlobalNativeBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalNativeBuildRecord(poHome: string, key: string): GlobalNativeBuildRecord | undefined {\n return readBuildRecord(path.join(poHome, 'build', 'native', key));\n}\n\n/** The platforms `po sync` exports an over-the-air app bundle for. */\nexport const NATIVE_APP_PLATFORMS = ['ios', 'android'] as const;\n\n/**\n * The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`\n * names once the export is complete. Undefined when there is none. Never builds.\n */\nexport function readNativeAppBuild(poHome: string, platform: string): NativeAppBuild | undefined {\n try {\n const record = JSON.parse(fs.readFileSync(path.join(poHome, 'build', `app-${platform}.json`), 'utf8')) as {\n key?: unknown;\n };\n if (typeof record.key !== 'string' || !/^[a-f0-9]{64}$/u.test(record.key)) return undefined;\n const directory = path.join(poHome, 'build', 'app', platform, record.key);\n const descriptor = JSON.parse(fs.readFileSync(path.join(directory, APP_DESCRIPTOR_PATH), 'utf8')) as {\n fingerprint?: unknown;\n };\n return typeof descriptor.fingerprint === 'string'\n ? { key: record.key, directory, fingerprint: descriptor.fingerprint }\n : undefined;\n } catch {\n // Never exported here (an installed Po, not a source checkout), or pruned: nothing to offer.\n return undefined;\n }\n}\n\n/** The generated entry: each plugin's `nativePlugin` export, in install order. */\nfunction renderEntry(plugins: readonly DeclaredWebPlugin[]): string {\n const lines = plugins.map(\n (plugin, index) =>\n `import { nativePlugin as pN${String(index)} } from ${JSON.stringify(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry)))};`,\n );\n lines.push(`export const plugins = [${plugins.map((_, index) => `pN${String(index)}`).join(', ')}];`, '');\n return lines.join('\\n');\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** Bundles the plugins into `<outDir>/plugins/composition.js`: CommonJS, one file, host modules external. */\nasync function bundleNativeComposition(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<void> {\n const entryFile = path.join(outDir, ENTRY_FILE);\n fs.writeFileSync(entryFile, renderEntry(plugins));\n try {\n const bundle = await rolldown({\n input: entryFile,\n cwd: outDir,\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source)) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n },\n ],\n });\n try {\n const { output } = await bundle.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk')\n throw new Error(\n `The native composition must be exactly one file; the build produced ${String(output.length)}.`,\n );\n const bytes = Buffer.byteLength(chunk.code);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native composition is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n fs.mkdirSync(pluginsDirectory, { recursive: true });\n fs.writeFileSync(path.join(pluginsDirectory, NATIVE_ENTRY_PATH.replace(/^\\//, '')), chunk.code);\n } finally {\n await bundle.close();\n }\n } finally {\n fs.rmSync(entryFile, { force: true });\n }\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/composition.js`, built in a temporary\n * directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n await bundleNativeComposition(plugins, temporary, notice);\n return {\n key,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAM,6BAA6B;AACnC,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,eAAoC,IAAI,IAAI,sBAAsB;;AAgCxE,SAAS,yBAAyB,OAA0D;CAC1F,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,YAAY,KAAK,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;CAC3F,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,UAAU,eAAe,KAAA,GAAW,aAAa,MAAM,mBAAyB,CAAC,IAAI,UAAU;EAC/F,IAAI,QAAQ,WAAW,GACrB,OAAO;GAAE,QAAQ;GAAW,QAAQ;EAA0E;EAChH,MAAM,eAAe,4BAA4B,KAAA,GAAW,OAAO;CACrE,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ;GAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAAE;CAC5F;CACA,MAAM,aAAa,KAAK,KAAK,MAAM,QAAQ,SAAS,QAAQ;CAC5D,OAAO;EAAE,QAAQ;EAAY;EAAS;EAAK;EAAY,WAAW,KAAK,KAAK,YAAY,GAAG;CAAE;AAC/F;AAEA,SAAS,gBAAgB,WAAwD;CAC/E,MAAM,SAAS,cAAiE,SAAS;CACzF,IAAI,W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U;EACR,GAAG,OAAO,WAAW,EAAE,OAAO,KAAK,CAAC;CACtC;AACF;;AAGA,SAAgB,4BACd,OAIuC;CACvC,MAAM,WAAW,yBAAyB,KAAK;CAC/C,IAAI,SAAS,WAAW,YAAY,OAAO;CAC3C,OAAO;EAAE,QAAQ,gBAAgB,SAAS,SAAS,MAAM,KAAA,IAAY,YAAY;EAAW,KAAK,SAAS;CAAI;AAChH;;;;;;;AAQA,eAAsB,wBAAwB,OAAiE;CAC7G,MAAM,SAAS,MAAM,mBAAyB,CAAC;CAC/C,MAAM,WAAW,yBAAyB,KAAK;CAC/C,IAAI,SAAS,WAAW,YAAY,OAAO;CAC3C,MAAM,EAAE,SAAS,KAAK,YAAY,cAAc;CAChD,MAAM,WAAW,gBAAgB,SAAS;CAC1C,IAAI,aAAa,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAU,OAAO;CAAS;CACvE,OAAO,kBAAkB,KAAK,YAA8C;EAC1E,IAAI;GACF,MAAM,kBAAkB,YAAY,KAAK,WAAW,OAAO,cAAc;IACvE,MAAM,wBAAwB,SAAS,WAAW,MAAM;IACxD,OAAO;KACL;KACA,SAAS,QAAQ,KAAK,EAAE,UAAU,YAAY,cAAc;MAAE;MAAU;MAAY;KAAO,EAAE;IAC/F;GACF,CAAC;GACD,MAAM,QAAQ,gBAAgB,SAAS;GACvC,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,qBAAqB,IAAI,oBAAoB;GACtF,OAAO;IAAE,QAAQ;IAAS;GAAM;EAClC,SAAS,OAAO;GACd,OAAO;IAAE,QAAQ;IAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE;EAC5F;CACF,CAAC;AACH;;AAGA,MAAa,uBACX"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport type { GlobalNativeBuild, NativeAppBuild } from '@agimon-ai/po-core/webCompositions';\nimport { APP_DESCRIPTOR_PATH, NATIVE_COMPOSITION_MAX_BYTES, NATIVE_ENTRY_PATH } from '@agimon-ai/po-web-security';\nimport { rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The one global native composition: every package's `poNative` client bundled into a single\n * CommonJS file the po-native shell evaluates against its own host modules.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so the bundle only joins\n * those files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-1';\nconst ENTRY_FILE = 'entry.mjs';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nfunction resolveGlobalNativeBuild(input: GlobalNativeBuildInput): ResolvedGlobalNativeBuild {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n key = globalBuildKey(GLOBAL_NATIVE_BUILD_FORMAT, undefined, plugins);\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return { status: 'resolved', plugins, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\nfunction readBuildRecord(directory: string): GlobalNativeBuildRecord | undefined {\n const record = readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport function readGlobalNativeBuildRecord(poHome: string, key: string): GlobalNativeBuildRecord | undefined {\n return readBuildRecord(path.join(poHome, 'build', 'native', key));\n}\n\n/** The platforms `po sync` exports an over-the-air app bundle for. */\nexport const NATIVE_APP_PLATFORMS = ['ios', 'android'] as const;\n\n/**\n * The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`\n * names once the export is complete. Undefined when there is none. Never builds.\n */\nexport function readNativeAppBuild(poHome: string, platform: string): NativeAppBuild | undefined {\n try {\n const record = JSON.parse(fs.readFileSync(path.join(poHome, 'build', `app-${platform}.json`), 'utf8')) as {\n key?: unknown;\n };\n if (typeof record.key !== 'string' || !/^[a-f0-9]{64}$/u.test(record.key)) return undefined;\n const directory = path.join(poHome, 'build', 'app', platform, record.key);\n const descriptor = JSON.parse(fs.readFileSync(path.join(directory, APP_DESCRIPTOR_PATH), 'utf8')) as {\n fingerprint?: unknown;\n builtAt?: unknown;\n };\n if (\n descriptor.builtAt !== undefined &&\n (typeof descriptor.builtAt !== 'number' || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)\n )\n return undefined;\n return typeof descriptor.fingerprint === 'string'\n ? {\n key: record.key,\n directory,\n fingerprint: descriptor.fingerprint,\n ...(descriptor.builtAt === undefined ? {} : { builtAt: descriptor.builtAt }),\n }\n : undefined;\n } catch {\n // Never exported here (an installed Po, not a source checkout), or pruned: nothing to offer.\n return undefined;\n }\n}\n\n/** The generated entry: each plugin's `nativePlugin` export, in install order. */\nfunction renderEntry(plugins: readonly DeclaredWebPlugin[]): string {\n const lines = plugins.map(\n (plugin, index) =>\n `import { nativePlugin as pN${String(index)} } from ${JSON.stringify(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry)))};`,\n );\n lines.push(`export const plugins = [${plugins.map((_, index) => `pN${String(index)}`).join(', ')}];`, '');\n return lines.join('\\n');\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** Bundles the plugins into `<outDir>/plugins/composition.js`: CommonJS, one file, host modules external. */\nasync function bundleNativeComposition(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<void> {\n const entryFile = path.join(outDir, ENTRY_FILE);\n fs.writeFileSync(entryFile, renderEntry(plugins));\n try {\n const bundle = await rolldown({\n input: entryFile,\n cwd: outDir,\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source)) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n },\n ],\n });\n try {\n const { output } = await bundle.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk')\n throw new Error(\n `The native composition must be exactly one file; the build produced ${String(output.length)}.`,\n );\n const bytes = Buffer.byteLength(chunk.code);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native composition is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n fs.mkdirSync(pluginsDirectory, { recursive: true });\n fs.writeFileSync(path.join(pluginsDirectory, NATIVE_ENTRY_PATH.replace(/^\\//, '')), chunk.code);\n } finally {\n await bundle.close();\n }\n } finally {\n fs.rmSync(entryFile, { force: true });\n }\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n):\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string } {\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return { status: readBuildRecord(resolved.directory) === undefined ? 'missing' : 'current', key: resolved.key };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/composition.js`, built in a temporary\n * directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory } = resolved;\n const existing = readBuildRecord(directory);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n await bundleNativeComposition(plugins, temporary, notice);\n return {\n key,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = readBuildRecord(directory);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;AAsBA,MAAM,6BAA6B;AACnC,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,eAAoC,IAAI,IAAI,sBAAsB;;AAgCxE,SAAS,yBAAyB,OAA0D;CAC1F,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,YAAY,KAAK,SAAS,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;CAC3F,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,UAAU,eAAe,KAAA,GAAW,aAAa,MAAM,mBAAyB,CAAC,IAAI,UAAU;EAC/F,IAAI,QAAQ,WAAW,GACrB,OAAO;GAAE,QAAQ;GAAW,QAAQ;EAA0E;EAChH,MAAM,eAAe,4BAA4B,KAAA,GAAW,OAAO;CACrE,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ;GAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAAE;CAC5F;CACA,MAAM,aAAa,KAAK,KAAK,MAAM,QAAQ,SAAS,QAAQ;CAC5D,OAAO;EAAE,QAAQ;EAAY;EAAS;EAAK;EAAY,WAAW,KAAK,KAAK,YAAY,GAAG;CAAE;AAC/F;AAEA,SAAS,gBAAgB,WAAwD;CAC/E,MAAM,SAAS,cAAiE,SAAS;CACzF,IAAI,WAAW,KAAA,GAAW,OAAO,KAAA;CACjC,OAAO;EAAE,GAAG;EAAQ,kBAAkB,KAAK,KAAK,WAAW,iBAAiB;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