pi-web-ui 0.106.0 → 0.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/CHANGELOG.md +41 -1
  2. package/README.zh-TW.md +2 -2
  3. package/dist/server/agent-service.js +32 -16
  4. package/dist/server/client-state.js +2 -2
  5. package/dist/server/dsh/dsh-agent-service.js +15 -10
  6. package/dist/server/durable/durable-agent-service.js +153 -0
  7. package/dist/server/durable/durable-capabilities.js +11 -0
  8. package/dist/server/durable/durable-driver.js +481 -0
  9. package/dist/server/durable/durable-loader.js +38 -0
  10. package/dist/server/durable/durable-models.js +283 -0
  11. package/dist/server/durable/durable-storage.js +42 -0
  12. package/dist/server/durable/durable-tools.js +45 -0
  13. package/dist/server/durable/index.js +8 -0
  14. package/dist/server/engine-capabilities.js +20 -1
  15. package/dist/server/engine-probe.js +156 -8
  16. package/dist/server/global-loader.js +335 -0
  17. package/dist/server/index.js +127 -17
  18. package/dist/server/managed.js +2 -0
  19. package/dist/server/marker-service.js +5 -19
  20. package/dist/server/markers/index.js +1 -3
  21. package/dist/server/model-resolver.js +91 -3
  22. package/dist/server/plugins.js +18 -1
  23. package/dist/server/sdk-origin.js +2 -2
  24. package/dist/server/serialize.js +1 -1
  25. package/dist/server/tool-manager.js +3 -19
  26. package/dist/server/universal/driver-base.js +4 -0
  27. package/dist/server/universal/drivers/claude-code.js +3 -2
  28. package/dist/server/universal/universal-service.js +19 -2
  29. package/dist/server/universal/universal-session.js +61 -7
  30. package/dist/server/update-check.js +20 -8
  31. package/package.json +1 -1
  32. package/plugins/catalog.json +13 -2
  33. package/themes/dark-teal.css +0 -1
  34. package/themes/flow-light.css +1085 -0
  35. package/themes/flow.css +1094 -0
  36. package/themes/wallpaper-flow.css +1158 -0
  37. package/themes/wallpaper-obsidian.css +50 -0
  38. package/themes/zhujian-dark.css +0 -7
  39. package/themes/zhujian.css +0 -7
  40. package/themes/zhupi-dark.css +0 -7
  41. package/themes/zhupi.css +0 -7
  42. package/web/dist/assets/{TerminalPanel-CfxKLDW9.js → TerminalPanel-BnViyTlx.js} +2 -2
  43. package/web/dist/assets/index-cCRCYMwT.css +1 -0
  44. package/web/dist/assets/index-fH5vhkAE.js +690 -0
  45. package/web/dist/index.html +2 -2
  46. package/web/dist/sw.js +1 -1
  47. package/web/dist/assets/index-BtcP6BDk.css +0 -1
  48. package/web/dist/assets/index-XVtCzcHR.js +0 -690
@@ -0,0 +1,481 @@
1
+ /**
2
+ * durable-driver.ts — Pi Durable 独立智能体驱动(继承 BaseAgentDriver)。
3
+ *
4
+ * 职责:
5
+ * 1. 动态加载 @earendil-works/pi-durable 核心包及 SQLite 持久化仓储;
6
+ * 2. 将用户输入转化为事务性提交(conversation.submit),向 AgentEventSink 发射思考、正文与工具事件;
7
+ * 3. 具备任务图(Task Graph)级联中断与崩溃自愈(harness.resume());
8
+ * 4. 当宿主尚未安装核心包时,向用户友好呈现安装引导与状态提示。
9
+ */
10
+ import { BaseAgentDriver } from "../universal/driver-base.js";
11
+ import { openDurableStorage } from "./durable-storage.js";
12
+ import { setupDurableRegistry } from "./durable-tools.js";
13
+ import { listGlobalAvailableModels, setupDurableModels, resolveDurableModelChoice, } from "./durable-models.js";
14
+ import { loadDurableModule, loadDurablePeerModule, probeDurableInstallation } from "./durable-loader.js";
15
+ export class DurableAgentDriver extends BaseAgentDriver {
16
+ id = "durable";
17
+ name = "Pi Durable Agent";
18
+ capabilities = {
19
+ supportsTreeFork: true,
20
+ supportsHistoryEdit: true,
21
+ supportsToolPromptOverride: false,
22
+ supportsModelSwitch: true,
23
+ supportsThinkingLevels: true,
24
+ supportsAskUser: true,
25
+ supportsSubagents: true,
26
+ };
27
+ dataDir;
28
+ agentDir;
29
+ currentModelId;
30
+ cachedModels = [];
31
+ aborted = false;
32
+ // Pi Durable 动态模块与运行时单例
33
+ durableModule = null;
34
+ storage = null;
35
+ harness = null;
36
+ backgroundContext = null;
37
+ initPromise = null;
38
+ initError = null;
39
+ currentConversationId = null;
40
+ activeWatch = null;
41
+ currentRunningConv = null;
42
+ constructor(cwd, opts) {
43
+ super(cwd);
44
+ this.dataDir = opts?.dataDir ?? process.cwd();
45
+ this.agentDir = opts?.agentDir;
46
+ }
47
+ /**
48
+ * 初始化 Pi Durable 运行环境(按需异步单例)。
49
+ */
50
+ async ensureInitialized() {
51
+ if (this.initPromise)
52
+ return this.initPromise;
53
+ this.initPromise = (async () => {
54
+ try {
55
+ // 1. 动态加载 Chord 上下文(支持全局 node_modules 自动发现)
56
+ const chordModule = await loadDurablePeerModule("@earendil-works/chord", "context").catch(() => null);
57
+ this.backgroundContext = chordModule?.BACKGROUND_CONTEXT ?? {};
58
+ // 2. 动态加载 Durable 核心模块(支持本地/全局安装包自动发现)
59
+ this.durableModule = await loadDurableModule().catch(() => null);
60
+ if (!this.durableModule || typeof this.durableModule.Harness?.open !== "function") {
61
+ this.initError = "@earendil-works/pi-durable 尚未安装或入口未找到";
62
+ return;
63
+ }
64
+ // 3. 打开持久化存储(SQLite WAL 优先)
65
+ const { storage } = await openDurableStorage(this.dataDir, this.cwd);
66
+ this.storage = storage;
67
+ // 4. 装配工具与扩展注册表
68
+ const { registry } = await setupDurableRegistry(this.cwd);
69
+ // 5. 继承全局模型配置(读取 models.json、auth.json 并装配 Providers)
70
+ const models = await setupDurableModels(this.agentDir);
71
+ // 6. 动态加载本地执行环境(支撑 read/write/edit/bash 等官方编码工具)
72
+ const envModule = await loadDurableModule("env/node").catch(() => null);
73
+ const envFactory = envModule?.NodeExecutionEnv
74
+ ? ({ cwd: callCwd }) => new envModule.NodeExecutionEnv({ cwd: callCwd || this.cwd })
75
+ : undefined;
76
+ // 7. 开启 Harness
77
+ this.harness = await this.durableModule.Harness.open(storage, {
78
+ models,
79
+ registry,
80
+ ...(envFactory ? { env: envFactory } : {}),
81
+ }, this.backgroundContext);
82
+ // 8. ⭐ 崩溃自愈:调度未完成的长任务续跑
83
+ if (typeof this.harness.resume === "function") {
84
+ this.harness.resume();
85
+ }
86
+ // 8. 预热模型名录并确定缺省活动模型
87
+ if (this.cachedModels.length === 0) {
88
+ await this.listModels().catch(() => []);
89
+ }
90
+ if (!this.currentModelId) {
91
+ const defaultChoice = resolveDurableModelChoice(undefined, this.cachedModels, this.agentDir);
92
+ if (defaultChoice) {
93
+ this.currentModelId = `${defaultChoice.provider}/${defaultChoice.modelId}`;
94
+ }
95
+ }
96
+ }
97
+ catch (err) {
98
+ this.initError = err?.message || String(err);
99
+ }
100
+ })();
101
+ return this.initPromise;
102
+ }
103
+ async createSession() {
104
+ await this.ensureInitialized();
105
+ if (this.harness && typeof this.harness.createConversation === "function") {
106
+ try {
107
+ const modelChoice = resolveDurableModelChoice(this.currentModelId, this.cachedModels, this.agentDir);
108
+ const agentOpts = modelChoice ? { agent: { model: modelChoice } } : {};
109
+ const conv = await this.harness.createConversation({
110
+ ownership: { kind: "ownerless" },
111
+ ...agentOpts,
112
+ }, this.backgroundContext);
113
+ const sid = String(conv?.id ?? `durable-${Date.now()}`);
114
+ this.currentConversationId = sid;
115
+ return sid;
116
+ }
117
+ catch {
118
+ /* fallback */
119
+ }
120
+ }
121
+ const fallbackId = `durable-${Date.now()}`;
122
+ this.currentConversationId = fallbackId;
123
+ return fallbackId;
124
+ }
125
+ async resumeSession(sessionId) {
126
+ await this.ensureInitialized();
127
+ this.currentConversationId = sessionId;
128
+ const numericId = Number(sessionId);
129
+ if (Number.isSafeInteger(numericId) &&
130
+ numericId > 0 &&
131
+ this.harness &&
132
+ typeof this.harness.conversation === "function") {
133
+ try {
134
+ await this.harness.conversation(numericId, this.backgroundContext);
135
+ }
136
+ catch {
137
+ /* fallback */
138
+ }
139
+ }
140
+ }
141
+ async forkSession(sessionId, atEntryId) {
142
+ await this.ensureInitialized();
143
+ if (!this.harness || typeof this.harness.conversation !== "function") {
144
+ return `durable-${Date.now()}`;
145
+ }
146
+ const numericId = Number(sessionId);
147
+ if (!Number.isSafeInteger(numericId) || numericId <= 0) {
148
+ return `durable-${Date.now()}`;
149
+ }
150
+ try {
151
+ const parentConv = await this.harness.conversation(numericId, this.backgroundContext);
152
+ if (parentConv && typeof parentConv.fork === "function") {
153
+ const modelChoice = resolveDurableModelChoice(this.currentModelId, this.cachedModels, this.agentDir);
154
+ const agentOpts = modelChoice ? { agent: { model: modelChoice } } : {};
155
+ const forked = await parentConv.fork(atEntryId, {
156
+ ownership: { kind: "ownerless" },
157
+ ...agentOpts,
158
+ }, this.backgroundContext);
159
+ const forkedId = String(forked?.id ?? `durable-${Date.now()}`);
160
+ this.currentConversationId = forkedId;
161
+ return forkedId;
162
+ }
163
+ }
164
+ catch {
165
+ /* fallback */
166
+ }
167
+ return `durable-${Date.now()}`;
168
+ }
169
+ async sendPrompt(prompt, _attachments, sink) {
170
+ this.aborted = false;
171
+ await this.ensureInitialized();
172
+ // 如果未安装 @earendil-works/pi-durable,安全返回引导提示
173
+ if (!this.harness || this.initError) {
174
+ sink.onTextDelta("【Pi Durable 引擎就绪检查】\n\n" +
175
+ "当前宿主环境尚未安装或加载 `@earendil-works/pi-durable` 核心运行时包。\n\n" +
176
+ "请在终端中执行以下命令进行全局安装:\n" +
177
+ "```bash\n" +
178
+ "npm i -g @earendil-works/pi-durable\n" +
179
+ "```\n" +
180
+ "安装完成后,刷新浏览器标签页即可直接启用基于 SQLite/WAL 事务化检查点与自愈的 Durable 智能体会话。");
181
+ sink.onTurnComplete({
182
+ costUSD: 0,
183
+ contextTokens: 0,
184
+ model: "pi-durable-pending",
185
+ });
186
+ return;
187
+ }
188
+ try {
189
+ // 获取当前活动会话或工作区根会话
190
+ const modelChoice = resolveDurableModelChoice(this.currentModelId, this.cachedModels, this.agentDir);
191
+ const agentOpts = modelChoice ? { agent: { model: modelChoice } } : undefined;
192
+ let targetConv = null;
193
+ const numericId = this.currentConversationId ? Number(this.currentConversationId) : NaN;
194
+ if (Number.isSafeInteger(numericId) &&
195
+ numericId > 0 &&
196
+ this.harness &&
197
+ typeof this.harness.conversation === "function") {
198
+ targetConv = await this.harness.conversation(numericId, this.backgroundContext).catch(() => null);
199
+ }
200
+ if (!targetConv) {
201
+ targetConv = await this.harness.root(this.backgroundContext, agentOpts);
202
+ }
203
+ if (this.aborted)
204
+ return;
205
+ // 若指定了模型选择,确保目标会话已应用最新模型配置
206
+ if (modelChoice && typeof targetConv.configure === "function") {
207
+ try {
208
+ await targetConv.configure({ model: modelChoice }, this.backgroundContext);
209
+ }
210
+ catch {
211
+ /* best effort */
212
+ }
213
+ }
214
+ this.currentRunningConv = targetConv;
215
+ // 启动 Durable 反应式实时流 (LiveDoc / entries / tools 增量监听)
216
+ let emittedTextLen = 0;
217
+ let emittedThinkingLen = 0;
218
+ const startedToolCalls = new Set();
219
+ const finishedToolCalls = new Set();
220
+ let watch = null;
221
+ if (typeof targetConv.watch === "function") {
222
+ try {
223
+ watch = await targetConv.watch(this.backgroundContext);
224
+ this.activeWatch = watch;
225
+ watch.start((value) => {
226
+ if (this.aborted)
227
+ return;
228
+ const live = value?.docs?.["pi.live"];
229
+ if (!live)
230
+ return;
231
+ // 1. 实时流式捕获思考与正文内容
232
+ const genMessage = live.generation?.message;
233
+ if (genMessage?.content && Array.isArray(genMessage.content)) {
234
+ for (const block of genMessage.content) {
235
+ if (block.type === "thinking" && typeof block.thinking === "string") {
236
+ const delta = block.thinking.slice(emittedThinkingLen);
237
+ if (delta) {
238
+ emittedThinkingLen = block.thinking.length;
239
+ sink.onThinkingDelta(delta);
240
+ }
241
+ }
242
+ else if (block.type === "text" && typeof block.text === "string") {
243
+ const delta = block.text.slice(emittedTextLen);
244
+ if (delta) {
245
+ emittedTextLen = block.text.length;
246
+ sink.onTextDelta(delta);
247
+ }
248
+ }
249
+ }
250
+ }
251
+ // 2. 实时流式捕获任务图中的工具槽位执行状态
252
+ const toolSlots = live.tools || live.nestedTools;
253
+ if (Array.isArray(toolSlots)) {
254
+ for (const slot of toolSlots) {
255
+ if (!slot || !slot.callId)
256
+ continue;
257
+ const callId = String(slot.callId);
258
+ // 工具开始运行:发射 onToolStart
259
+ if (!startedToolCalls.has(callId) && (slot.status === "running" || slot.status === "done")) {
260
+ startedToolCalls.add(callId);
261
+ sink.onToolStart?.(callId, slot.name || slot.tool || "tool", slot.input ?? {});
262
+ }
263
+ // 工具执行结束:发射 onToolEnd
264
+ if (startedToolCalls.has(callId) &&
265
+ !finishedToolCalls.has(callId) &&
266
+ (slot.status === "done" || slot.status === "error")) {
267
+ finishedToolCalls.add(callId);
268
+ const outputText = typeof slot.output === "string"
269
+ ? slot.output
270
+ : slot.output
271
+ ? JSON.stringify(slot.output, null, 2)
272
+ : "";
273
+ sink.onToolEnd?.(callId, {
274
+ output: outputText,
275
+ error: slot.error ? String(slot.error) : undefined,
276
+ });
277
+ }
278
+ }
279
+ }
280
+ });
281
+ }
282
+ catch {
283
+ /* watch 启动失败安全回退到等待模式 */
284
+ }
285
+ }
286
+ // 提交任务到 Durable 引擎
287
+ const submission = await targetConv.submit({
288
+ type: "input",
289
+ content: prompt,
290
+ }, this.backgroundContext);
291
+ // 等待提交执行结果
292
+ const settled = await submission.wait(this.backgroundContext);
293
+ if (this.aborted)
294
+ return;
295
+ let finalUsage = undefined;
296
+ if (settled.status === "done") {
297
+ // 当 answer 为已持久化的 entryId (数字) 时,从存储核对并补发未完全覆写的残余文本与元数据
298
+ if (typeof settled.answer === "number" && this.storage && typeof this.storage.entry === "function") {
299
+ try {
300
+ const entryData = await this.storage.entry(settled.answer);
301
+ const modelTurn = entryData?.entry?.model?.[0];
302
+ finalUsage = modelTurn?.usage;
303
+ if (modelTurn?.content && Array.isArray(modelTurn.content)) {
304
+ for (const block of modelTurn.content) {
305
+ if (block.type === "thinking" && typeof block.thinking === "string") {
306
+ const delta = block.thinking.slice(emittedThinkingLen);
307
+ if (delta) {
308
+ emittedThinkingLen = block.thinking.length;
309
+ sink.onThinkingDelta(delta);
310
+ }
311
+ }
312
+ else if (block.type === "text" && typeof block.text === "string") {
313
+ const delta = block.text.slice(emittedTextLen);
314
+ if (delta) {
315
+ emittedTextLen = block.text.length;
316
+ sink.onTextDelta(delta);
317
+ }
318
+ }
319
+ }
320
+ }
321
+ }
322
+ catch {
323
+ /* fallback */
324
+ }
325
+ }
326
+ // 若流式期间未发射出正文且 answer 为文本或对象,进行最终保底输出
327
+ if (emittedTextLen === 0 && settled.answer) {
328
+ const text = typeof settled.answer === "string" ? settled.answer : JSON.stringify(settled.answer);
329
+ sink.onTextDelta(text);
330
+ }
331
+ }
332
+ else if (settled.status === "unanswered") {
333
+ const detail = settled.detail ? ` (${settled.detail})` : "";
334
+ sink.onTextDelta(`[Durable 任务未完成: ${settled.reason ?? "未知原因"}${detail}]`);
335
+ }
336
+ sink.onTurnComplete({
337
+ costUSD: finalUsage?.cost?.total ?? 0,
338
+ contextTokens: finalUsage?.totalTokens ?? 100,
339
+ model: this.currentModelId || "pi-durable",
340
+ usage: finalUsage
341
+ ? {
342
+ inputTokens: finalUsage.input,
343
+ outputTokens: finalUsage.output,
344
+ cacheReadTokens: finalUsage.cacheRead,
345
+ cacheWriteTokens: finalUsage.cacheWrite,
346
+ costUSD: finalUsage.cost?.total,
347
+ }
348
+ : undefined,
349
+ });
350
+ }
351
+ catch (err) {
352
+ if (this.aborted)
353
+ return;
354
+ const causeMsg = err?.cause?.message ? ` (${err.cause.message})` : "";
355
+ sink.onTextDelta(`[Pi Durable 运行时执行错误]: ${err?.message || String(err)}${causeMsg}`);
356
+ // 若底层会话已损坏,及时重置句柄以便下一次请求自动重连自愈
357
+ if (err?.name === "SessionFailed" || String(err?.message).includes("Session failed")) {
358
+ this.harness = null;
359
+ this.initPromise = null;
360
+ }
361
+ sink.onTurnComplete({
362
+ costUSD: 0,
363
+ contextTokens: 0,
364
+ model: "pi-durable-error",
365
+ });
366
+ }
367
+ finally {
368
+ if (this.activeWatch) {
369
+ try {
370
+ await this.activeWatch.stop();
371
+ }
372
+ catch {
373
+ /* ignore */
374
+ }
375
+ this.activeWatch = null;
376
+ }
377
+ this.currentRunningConv = null;
378
+ }
379
+ }
380
+ async abort() {
381
+ this.aborted = true;
382
+ if (this.activeWatch) {
383
+ try {
384
+ this.activeWatch.cancel();
385
+ }
386
+ catch {
387
+ /* ignore */
388
+ }
389
+ this.activeWatch = null;
390
+ }
391
+ if (this.currentRunningConv && typeof this.currentRunningConv.abort === "function") {
392
+ try {
393
+ await this.currentRunningConv.abort(this.backgroundContext);
394
+ }
395
+ catch {
396
+ /* best effort */
397
+ }
398
+ }
399
+ else if (this.harness && typeof this.harness.root === "function") {
400
+ try {
401
+ const root = await this.harness.root(this.backgroundContext);
402
+ if (root && typeof root.abort === "function") {
403
+ await root.abort(this.backgroundContext);
404
+ }
405
+ }
406
+ catch {
407
+ /* best effort */
408
+ }
409
+ }
410
+ }
411
+ dispose() {
412
+ this.aborted = true;
413
+ if (this.harness && typeof this.harness.close === "function") {
414
+ try {
415
+ this.harness.close(this.backgroundContext);
416
+ }
417
+ catch {
418
+ /* ignore */
419
+ }
420
+ this.harness = null;
421
+ }
422
+ }
423
+ async listModels() {
424
+ try {
425
+ this.cachedModels = await listGlobalAvailableModels(this.cwd, this.agentDir);
426
+ if (this.cachedModels.length > 0) {
427
+ return this.cachedModels.map((m) => ({
428
+ id: m.id,
429
+ name: m.name,
430
+ }));
431
+ }
432
+ }
433
+ catch {
434
+ /* best effort */
435
+ }
436
+ return [
437
+ { id: "openai/gpt-4o", name: "GPT-4o" },
438
+ { id: "anthropic/claude-3-7-sonnet", name: "Claude 3.7 Sonnet" },
439
+ ];
440
+ }
441
+ async setModel(modelId) {
442
+ this.currentModelId = modelId;
443
+ if (this.harness && this.currentConversationId) {
444
+ const numericId = Number(this.currentConversationId);
445
+ if (Number.isSafeInteger(numericId) && numericId > 0 && typeof this.harness.conversation === "function") {
446
+ try {
447
+ const conv = await this.harness.conversation(numericId, this.backgroundContext);
448
+ if (conv && typeof conv.configure === "function") {
449
+ const choice = resolveDurableModelChoice(modelId, this.cachedModels, this.agentDir);
450
+ if (choice) {
451
+ await conv.configure({ model: choice }, this.backgroundContext);
452
+ }
453
+ }
454
+ }
455
+ catch {
456
+ /* best effort */
457
+ }
458
+ }
459
+ }
460
+ }
461
+ async getSlashCommands() {
462
+ return [
463
+ {
464
+ name: "durable-status",
465
+ description: "查看 Pi Durable 存储与任务图状态",
466
+ descriptionEn: "Check Pi Durable storage and task graph status",
467
+ source: "builtin",
468
+ },
469
+ ];
470
+ }
471
+ async execSlashCommand(name, _args, context) {
472
+ if (name === "durable-status") {
473
+ const statusText = this.harness
474
+ ? "Pi Durable 引擎状态正常运行中(存储就绪,任务调度器已激活)。"
475
+ : `Pi Durable 尚未装配: ${this.initError ?? "未就绪"}`;
476
+ context?.emitNotice?.("info", statusText, statusText);
477
+ return true;
478
+ }
479
+ return false;
480
+ }
481
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * durable-loader.ts — Pi Durable 运行环境加载门面(基于 server/global-loader.ts)。
3
+ *
4
+ * 统一委托给通用全局加载器,消除代码冗余。
5
+ */
6
+ import { dynamicImportGlobalPackage, probeGlobalPackage, resolvePackageRoot, resolvePackageEntryFile, } from "../global-loader.js";
7
+ const DURABLE_PKG = "@earendil-works/pi-durable";
8
+ /**
9
+ * 解析并定位 @earendil-works/pi-durable 包的物理安装根目录。
10
+ */
11
+ export function findDurablePackageRoot(forceRefresh = false) {
12
+ return resolvePackageRoot(DURABLE_PKG, { refresh: forceRefresh });
13
+ }
14
+ /**
15
+ * 探测 Pi Durable 引擎的安装元数据(包版本号与物理路径)。
16
+ */
17
+ export function probeDurableInstallation(forceRefresh = false) {
18
+ return probeGlobalPackage(DURABLE_PKG, { refresh: forceRefresh });
19
+ }
20
+ /**
21
+ * 动态加载 @earendil-works/pi-durable 核心模块或其子路径模块。
22
+ * @param subpath 子路径标识,如 ""(主包)、"tools"、"storage/sqlite/node"、"storage/memory"
23
+ */
24
+ export async function loadDurableModule(subpath = "") {
25
+ return dynamicImportGlobalPackage(DURABLE_PKG, subpath);
26
+ }
27
+ /**
28
+ * 动态加载关联的 @earendil-works/* 兄弟包(如 chord/context、pi-ai/models)。
29
+ */
30
+ export async function loadDurablePeerModule(packageName, subpath = "") {
31
+ try {
32
+ return await dynamicImportGlobalPackage(packageName, subpath);
33
+ }
34
+ catch {
35
+ return null;
36
+ }
37
+ }
38
+ export { resolvePackageEntryFile };