@ashx-j/lunr-dev 0.2.16-dev.9.1 → 0.2.19-dev.10.1
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/CHANGELOG.md +32 -1
- package/README.md +7 -1
- package/dist/builtin-extensions/ashxj-thinking.d.ts +1 -0
- package/dist/builtin-extensions/ashxj-thinking.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-thinking.js +44 -19
- package/dist/builtin-extensions/ashxj-thinking.js.map +1 -1
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +1 -0
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/builtin-extensions/lunr-computer-use.d.ts +3 -0
- package/dist/builtin-extensions/lunr-computer-use.d.ts.map +1 -0
- package/dist/builtin-extensions/lunr-computer-use.js +157 -0
- package/dist/builtin-extensions/lunr-computer-use.js.map +1 -0
- package/dist/builtin-extensions/pi-lsp-extension/src/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js +10 -3
- package/dist/builtin-extensions/pi-lsp-extension/src/index.js.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts +5 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js +26 -4
- package/dist/builtin-extensions/pi-lsp-extension/src/runtime.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/index.js +37 -27
- package/dist/builtin-extensions/pi-mcp-adapter/index.js.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts +6 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js +33 -8
- package/dist/builtin-extensions/pi-mcp-adapter/server-manager.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js +52 -23
- package/dist/builtin-extensions/pi-subagents/src/extension/index.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js +6 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js +5 -2
- package/dist/builtin-extensions/pi-subagents/src/runs/background/wait-tool.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts +10 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js +38 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/request-params.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js +3 -16
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js +2 -0
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/child-tools.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts +1 -0
- package/dist/builtin-extensions/pi-subagents/src/tui/render.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js +70 -30
- package/dist/builtin-extensions/pi-subagents/src/tui/render.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/index.js +103 -102
- package/dist/builtin-extensions/pi-web-access/index.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -1
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/computer-use/adapter.d.ts +23 -0
- package/dist/core/computer-use/adapter.d.ts.map +1 -0
- package/dist/core/computer-use/adapter.js +116 -0
- package/dist/core/computer-use/adapter.js.map +1 -0
- package/dist/core/computer-use/lease.d.ts +18 -0
- package/dist/core/computer-use/lease.d.ts.map +1 -0
- package/dist/core/computer-use/lease.js +129 -0
- package/dist/core/computer-use/lease.js.map +1 -0
- package/dist/core/computer-use/macos-runtime.d.ts +14 -0
- package/dist/core/computer-use/macos-runtime.d.ts.map +1 -0
- package/dist/core/computer-use/macos-runtime.js +148 -0
- package/dist/core/computer-use/macos-runtime.js.map +1 -0
- package/dist/core/computer-use/policy.d.ts +19 -0
- package/dist/core/computer-use/policy.d.ts.map +1 -0
- package/dist/core/computer-use/policy.js +66 -0
- package/dist/core/computer-use/policy.js.map +1 -0
- package/dist/core/computer-use/release.generated.d.ts +31 -0
- package/dist/core/computer-use/release.generated.d.ts.map +1 -0
- package/dist/core/computer-use/release.generated.js +36 -0
- package/dist/core/computer-use/release.generated.js.map +1 -0
- package/dist/core/computer-use/runtime.d.ts +13 -0
- package/dist/core/computer-use/runtime.d.ts.map +1 -0
- package/dist/core/computer-use/runtime.js +158 -0
- package/dist/core/computer-use/runtime.js.map +1 -0
- package/dist/core/computer-use/schemas.d.ts +88 -0
- package/dist/core/computer-use/schemas.d.ts.map +1 -0
- package/dist/core/computer-use/schemas.js +80 -0
- package/dist/core/computer-use/schemas.js.map +1 -0
- package/dist/core/computer-use/windows-desktop.d.ts +3 -0
- package/dist/core/computer-use/windows-desktop.d.ts.map +1 -0
- package/dist/core/computer-use/windows-desktop.js +48 -0
- package/dist/core/computer-use/windows-desktop.js.map +1 -0
- package/dist/core/computer-use/workflow.d.ts +24 -0
- package/dist/core/computer-use/workflow.d.ts.map +1 -0
- package/dist/core/computer-use/workflow.js +330 -0
- package/dist/core/computer-use/workflow.js.map +1 -0
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -2
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-runtime.d.ts +0 -3
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +1 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +1 -1
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permissions.d.ts +1 -1
- package/dist/core/permissions.d.ts.map +1 -1
- package/dist/core/permissions.js +23 -7
- package/dist/core/permissions.js.map +1 -1
- package/dist/core/plan-mode.d.ts.map +1 -1
- package/dist/core/plan-mode.js +9 -0
- package/dist/core/plan-mode.js.map +1 -1
- package/dist/core/rollback.d.ts.map +1 -1
- package/dist/core/rollback.js +13 -90
- package/dist/core/rollback.js.map +1 -1
- package/dist/core/session-manager.d.ts +0 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +21 -79
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +6 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +19 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/dev-cli.js +0 -0
- package/dist/gateway/agent-bridge.d.ts +6 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +23 -6
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +23 -7
- package/dist/gateway/cron.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +4 -2
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +23 -32
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/processes-selector.d.ts +2 -3
- package/dist/modes/interactive/components/processes-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/processes-selector.js +5 -10
- package/dist/modes/interactive/components/processes-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +4 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +18 -8
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/thinking-level-slash.d.ts +4 -0
- package/dist/modes/interactive/thinking-level-slash.d.ts.map +1 -0
- package/dist/modes/interactive/thinking-level-slash.js +23 -0
- package/dist/modes/interactive/thinking-level-slash.js.map +1 -0
- package/dist/node-runtime/adapter-AZMY335J.js +279 -0
- package/dist/node-runtime/{agent-session-services-IFJMSX7Z.js → agent-session-services-RSGP5GDN.js} +15 -12
- package/dist/node-runtime/{builtin-extensions-LYZ3BFWQ.js → builtin-extensions-7STLFW3A.js} +4 -3
- package/dist/node-runtime/chunk-2IDTZAG5.js +1415 -0
- package/dist/node-runtime/{chunk-7NBZ5P7I.js → chunk-4SJWFTUP.js} +1 -1
- package/dist/node-runtime/{chunk-AJX357CL.js → chunk-5NWQCSKR.js} +20 -1013
- package/dist/node-runtime/chunk-5OLJGVCB.js +68 -0
- package/dist/node-runtime/chunk-5Q45AVQG.js +108 -0
- package/dist/node-runtime/{chunk-TQNSPERU.js → chunk-5SQDLSZJ.js} +1 -1
- package/dist/node-runtime/{chunk-F4VQFJI2.js → chunk-6SPPH4FY.js} +4 -4
- package/dist/node-runtime/{chunk-PBC2Y6GS.js → chunk-6UB6NKA3.js} +29 -72
- package/dist/node-runtime/{chunk-A2KQXUJD.js → chunk-7AFOFSDY.js} +1 -1
- package/dist/node-runtime/chunk-BKAZ6BKX.js +2185 -0
- package/dist/node-runtime/{chunk-AHSTJBIB.js → chunk-EH2LJQPM.js} +4 -4
- package/dist/node-runtime/{chunk-N77MY65L.js → chunk-FLYMHKCS.js} +25 -25
- package/dist/node-runtime/{chunk-5P7PZMRU.js → chunk-HRS4HMDX.js} +1 -1
- package/dist/node-runtime/{chunk-IPA627GP.js → chunk-ISQDQIZN.js} +4 -4
- package/dist/node-runtime/{chunk-WJVFOIB5.js → chunk-J7QGQD45.js} +1 -1
- package/dist/node-runtime/{chunk-WOVTOV5P.js → chunk-JT6YCS5B.js} +29 -34
- package/dist/node-runtime/chunk-JZHEUQRL.js +180 -0
- package/dist/node-runtime/{chunk-ZKMFUD3Q.js → chunk-K72NVGUB.js} +3 -3
- package/dist/node-runtime/{chunk-ECD5L7YI.js → chunk-LCACDWHJ.js} +389 -15
- package/dist/node-runtime/{chunk-2QKLKMKC.js → chunk-LTXUQJI4.js} +1 -1
- package/dist/node-runtime/{chunk-MKKH27PH.js → chunk-LWJXTA6Z.js} +274 -2416
- package/dist/node-runtime/{chunk-EDBJNRSM.js → chunk-MGSB2C3M.js} +1 -1
- package/dist/node-runtime/{chunk-CDFZEWPU.js → chunk-MUMMMTW4.js} +6 -2
- package/dist/node-runtime/{chunk-YF63P5ZT.js → chunk-OTT6JMPU.js} +10 -67
- package/dist/node-runtime/{chunk-PGAJ5MO5.js → chunk-T5GM5BFH.js} +1 -1
- package/dist/node-runtime/{chunk-PCGNAY2O.js → chunk-TAP7QTUT.js} +38 -16
- package/dist/node-runtime/{chunk-4TLO4PO2.js → chunk-U6C7VTR5.js} +7 -1401
- package/dist/node-runtime/chunk-URD2SLIT.js +1019 -0
- package/dist/node-runtime/{chunk-QH42CDX3.js → chunk-W7S2REEG.js} +111 -84
- package/dist/node-runtime/{chunk-LZAW4ZX3.js → chunk-ZRDIMBEQ.js} +27 -9
- package/dist/node-runtime/{chunk-AD6VXAO7.js → chunk-ZSEZY3II.js} +5 -100
- package/dist/node-runtime/cli-runtime.js +1 -1
- package/dist/node-runtime/{command-L3LAHDIH.js → command-6UXQ6XZN.js} +1 -1
- package/dist/node-runtime/{commands-RL5YBW5I.js → commands-LGR5VT5X.js} +6 -4
- package/dist/node-runtime/{direct-tool-executor-JVDXTO7A.js → direct-tool-executor-TDJS7TBD.js} +9 -6
- package/dist/node-runtime/{export-html-KR26FOUZ.js → export-html-E4DT6ZJQ.js} +1 -1
- package/dist/node-runtime/{extract-XLQSJN4V.js → extract-IUCVZCWC.js} +2 -2
- package/dist/node-runtime/{gateway-X2TI5X7F.js → gateway-3OLC4GQN.js} +22 -367
- package/dist/node-runtime/{gemini-search-U7SUMPQA.js → gemini-search-NCIDF7NE.js} +1 -1
- package/dist/node-runtime/{gemini-url-context-PXWCBQHK.js → gemini-url-context-OKIN7AIP.js} +2 -2
- package/dist/node-runtime/image-resize-6ZPBFMWW.js +11 -0
- package/dist/node-runtime/index.js +53 -49
- package/dist/node-runtime/{init-NJV2T55N.js → init-EKE277AG.js} +6 -4
- package/dist/node-runtime/{interactive-mode-KOM35YF2.js → interactive-mode-S5M26CQ7.js} +20 -17
- package/dist/node-runtime/{interactive-view-U6OILKF3.js → interactive-view-N6F4KUIT.js} +3 -5
- package/dist/node-runtime/lunr-computer-use-4X3KUNF4.js +206 -0
- package/dist/node-runtime/{lunr-cron-YJ5UHYRD.js → lunr-cron-KKBOGAEF.js} +7 -1
- package/dist/node-runtime/main.js +24 -21
- package/dist/node-runtime/{mcp-auth-flow-QIXHW6QN.js → mcp-auth-flow-YL6RWPYG.js} +2 -1
- package/dist/node-runtime/{package-manager-cli-TZZHJCVI.js → package-manager-cli-C4EJOO5Q.js} +8 -6
- package/dist/node-runtime/{pi-mcp-adapter-QFB37AVN.js → pi-mcp-adapter-DPTJGAAL.js} +33 -27
- package/dist/node-runtime/{pi-subagents-7XJ4H53P.js → pi-subagents-VKCLYIBY.js} +103 -76
- package/dist/node-runtime/{pi-web-access-DPGAVKOA.js → pi-web-access-BV6DSZOP.js} +72 -69
- package/dist/node-runtime/{proxy-modes-HEEFK4KC.js → proxy-modes-R64LU6WZ.js} +12 -9
- package/dist/node-runtime/rpc-entry.js +24 -21
- package/dist/node-runtime/runtime-3SB5ATHQ.js +21 -0
- package/dist/node-runtime/{runtime-bridges-PPHNBFWL.js → runtime-bridges-UJ5WJJLN.js} +3 -3
- package/dist/node-runtime/{session-manager-MQNBYACL.js → session-manager-QEMZBMTM.js} +3 -5
- package/dist/node-runtime/{session-selector-5AZLJS6U.js → session-selector-URVJLOTK.js} +2 -2
- package/dist/node-runtime/{settings-manager-5LF2VQWC.js → settings-manager-K6IPIQTI.js} +3 -1
- package/dist/node-runtime/{src-Y7JSCK64.js → src-GPFAU3N6.js} +30 -10
- package/dist/node-runtime/{subagent-executor-5RNDEPIJ.js → subagent-executor-EFLTO32A.js} +39 -21
- package/dist/node-runtime/{update-cli-A253SZ7P.js → update-cli-I6OVDRPL.js} +3 -1
- package/dist/node-runtime/{video-extract-OYT5WKS5.js → video-extract-ETA5RA7U.js} +2 -2
- package/dist/node-runtime/workflow-SA34S4VX.js +325 -0
- package/dist/node-runtime/{youtube-extract-TQYKGFGS.js → youtube-extract-SRVGNN26.js} +2 -2
- package/dist/rpc.d.ts +3 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +18 -0
- package/dist/rpc.js.map +1 -0
- package/dist/startup/interactive-view.d.ts.map +1 -1
- package/dist/startup/interactive-view.js +1 -2
- package/dist/startup/interactive-view.js.map +1 -1
- package/docs/computer-use.md +277 -0
- package/docs/development.md +0 -32
- package/docs/features.md +2 -2
- package/docs/interactive-startup.md +10 -3
- package/docs/keybindings.md +2 -2
- package/docs/terminal-setup.md +1 -1
- package/docs/usage.md +1 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/install-lock/package-lock.json +3827 -0
- package/install-lock/package.json +18 -0
- package/native/computer-use/LICENSE.md +21 -0
- package/npm-shrinkwrap.json +3808 -0
- package/package.json +16 -10
- package/dist/startup/interactive-shell.d.ts +0 -55
- package/dist/startup/interactive-shell.d.ts.map +0 -1
- package/dist/startup/interactive-shell.js +0 -264
- package/dist/startup/interactive-shell.js.map +0 -1
- package/dist/node-runtime/{chunk-YSKSB3BJ.js → chunk-CH6OL6P2.js} +2 -2
- package/dist/node-runtime/{chunk-VSELYKWU.js → chunk-EHMBW7FA.js} +3 -3
|
@@ -210,20 +210,6 @@ function resolveProvider(requested, available, options) {
|
|
|
210
210
|
}
|
|
211
211
|
return provider;
|
|
212
212
|
}
|
|
213
|
-
const pendingFetches = new Map();
|
|
214
|
-
let sessionActive = false;
|
|
215
|
-
let sessionGeneration = 0;
|
|
216
|
-
let sessionAbort = new AbortController();
|
|
217
|
-
function assertActiveRequest(generation, signal) {
|
|
218
|
-
signal?.throwIfAborted();
|
|
219
|
-
if (generation !== sessionGeneration)
|
|
220
|
-
throw new Error("Web request cancelled: session changed");
|
|
221
|
-
}
|
|
222
|
-
let widgetVisible = false;
|
|
223
|
-
let widgetUnsubscribe = null;
|
|
224
|
-
const pendingCurates = new Map();
|
|
225
|
-
const activeCurators = new Map();
|
|
226
|
-
const glimpseWins = new Map();
|
|
227
213
|
const MAX_INLINE_CONTENT = 30000; // Content returned directly to agent
|
|
228
214
|
function stripThumbnails(results) {
|
|
229
215
|
return results.map(({ thumbnail, frames, ...rest }) => rest);
|
|
@@ -265,52 +251,6 @@ function formatFullResults(queryData) {
|
|
|
265
251
|
}
|
|
266
252
|
return output;
|
|
267
253
|
}
|
|
268
|
-
function abortPendingFetches() {
|
|
269
|
-
for (const controller of pendingFetches.values()) {
|
|
270
|
-
controller.abort();
|
|
271
|
-
}
|
|
272
|
-
pendingFetches.clear();
|
|
273
|
-
}
|
|
274
|
-
function closeCurator(callId) {
|
|
275
|
-
if (callId !== undefined) {
|
|
276
|
-
const win = glimpseWins.get(callId);
|
|
277
|
-
glimpseWins.delete(callId);
|
|
278
|
-
try {
|
|
279
|
-
win?.close();
|
|
280
|
-
}
|
|
281
|
-
catch { }
|
|
282
|
-
pendingCurates.get(callId)?.cancel("stale");
|
|
283
|
-
pendingCurates.delete(callId);
|
|
284
|
-
const curator = activeCurators.get(callId);
|
|
285
|
-
activeCurators.delete(callId);
|
|
286
|
-
try {
|
|
287
|
-
curator?.close();
|
|
288
|
-
}
|
|
289
|
-
catch { }
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
for (const win of glimpseWins.values()) {
|
|
293
|
-
try {
|
|
294
|
-
win.close();
|
|
295
|
-
}
|
|
296
|
-
catch { }
|
|
297
|
-
}
|
|
298
|
-
glimpseWins.clear();
|
|
299
|
-
for (const pc of pendingCurates.values()) {
|
|
300
|
-
try {
|
|
301
|
-
pc.cancel("stale");
|
|
302
|
-
}
|
|
303
|
-
catch { }
|
|
304
|
-
}
|
|
305
|
-
pendingCurates.clear();
|
|
306
|
-
for (const curator of activeCurators.values()) {
|
|
307
|
-
try {
|
|
308
|
-
curator.close();
|
|
309
|
-
}
|
|
310
|
-
catch { }
|
|
311
|
-
}
|
|
312
|
-
activeCurators.clear();
|
|
313
|
-
}
|
|
314
254
|
async function openInBrowser(pi, url) {
|
|
315
255
|
const plat = platform();
|
|
316
256
|
const result = plat === "darwin"
|
|
@@ -395,27 +335,6 @@ function extractDomain(url) {
|
|
|
395
335
|
return url;
|
|
396
336
|
}
|
|
397
337
|
}
|
|
398
|
-
function updateWidget(ctx) {
|
|
399
|
-
const theme = ctx.ui.theme;
|
|
400
|
-
const entries = activityMonitor.getEntries();
|
|
401
|
-
const lines = [];
|
|
402
|
-
lines.push(theme.fg("accent", "─── Web Search Activity " + "─".repeat(36)));
|
|
403
|
-
if (entries.length === 0) {
|
|
404
|
-
lines.push(theme.fg("muted", " No activity yet"));
|
|
405
|
-
}
|
|
406
|
-
else {
|
|
407
|
-
for (const e of entries) {
|
|
408
|
-
lines.push(" " + formatEntryLine(e, theme));
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
lines.push(theme.fg("accent", "─".repeat(60)));
|
|
412
|
-
const rateInfo = activityMonitor.getRateLimitInfo();
|
|
413
|
-
const resetMs = rateInfo.oldestTimestamp ? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now()) : 0;
|
|
414
|
-
const resetSec = Math.ceil(resetMs / 1000);
|
|
415
|
-
lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) +
|
|
416
|
-
(resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : ""));
|
|
417
|
-
ctx.ui.setWidget("web-activity", new Text(lines.join("\n"), 0, 0));
|
|
418
|
-
}
|
|
419
338
|
function formatEntryLine(entry, theme) {
|
|
420
339
|
const typeStr = entry.type === "api" ? "API" : "GET";
|
|
421
340
|
const target = entry.type === "api"
|
|
@@ -444,31 +363,113 @@ function formatEntryLine(entry, theme) {
|
|
|
444
363
|
}
|
|
445
364
|
return `${typeStr.padEnd(4)} ${target.padEnd(32)} ${statusStr.padStart(5)} ${duration.padStart(5)} ${indicator}`;
|
|
446
365
|
}
|
|
447
|
-
function handleSessionChange(ctx) {
|
|
448
|
-
sessionGeneration++;
|
|
449
|
-
sessionAbort.abort();
|
|
450
|
-
sessionAbort = new AbortController();
|
|
451
|
-
abortPendingFetches();
|
|
452
|
-
closeCurator();
|
|
453
|
-
runSessionCleanups();
|
|
454
|
-
sessionActive = true;
|
|
455
|
-
restoreFromSession(ctx);
|
|
456
|
-
// Unsubscribe before clear() to avoid callback with stale ctx
|
|
457
|
-
widgetUnsubscribe?.();
|
|
458
|
-
widgetUnsubscribe = null;
|
|
459
|
-
activityMonitor.clear();
|
|
460
|
-
if (widgetVisible) {
|
|
461
|
-
// Re-subscribe with new ctx
|
|
462
|
-
widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx));
|
|
463
|
-
updateWidget(ctx);
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
366
|
export default function (pi) {
|
|
467
367
|
const initConfig = loadConfigForExtensionInit();
|
|
468
368
|
const curateKey = initConfig.shortcuts?.curate || DEFAULT_SHORTCUTS.curate;
|
|
469
369
|
const activityKey = initConfig.shortcuts?.activity || DEFAULT_SHORTCUTS.activity;
|
|
370
|
+
const pendingFetches = new Map();
|
|
371
|
+
const pendingCurates = new Map();
|
|
372
|
+
const activeCurators = new Map();
|
|
373
|
+
const glimpseWins = new Map();
|
|
374
|
+
let sessionActive = false;
|
|
375
|
+
let widgetVisible = false;
|
|
376
|
+
let widgetUnsubscribe = null;
|
|
377
|
+
let sessionGeneration = 0;
|
|
378
|
+
let sessionAbort = new AbortController();
|
|
379
|
+
function abortPendingFetches() {
|
|
380
|
+
for (const controller of pendingFetches.values())
|
|
381
|
+
controller.abort();
|
|
382
|
+
pendingFetches.clear();
|
|
383
|
+
}
|
|
384
|
+
function closeCurator(callId) {
|
|
385
|
+
if (callId !== undefined) {
|
|
386
|
+
const win = glimpseWins.get(callId);
|
|
387
|
+
glimpseWins.delete(callId);
|
|
388
|
+
try {
|
|
389
|
+
win?.close();
|
|
390
|
+
}
|
|
391
|
+
catch { }
|
|
392
|
+
pendingCurates.get(callId)?.cancel("stale");
|
|
393
|
+
pendingCurates.delete(callId);
|
|
394
|
+
const curator = activeCurators.get(callId);
|
|
395
|
+
activeCurators.delete(callId);
|
|
396
|
+
try {
|
|
397
|
+
curator?.close();
|
|
398
|
+
}
|
|
399
|
+
catch { }
|
|
400
|
+
return;
|
|
401
|
+
}
|
|
402
|
+
for (const win of glimpseWins.values()) {
|
|
403
|
+
try {
|
|
404
|
+
win.close();
|
|
405
|
+
}
|
|
406
|
+
catch { }
|
|
407
|
+
}
|
|
408
|
+
glimpseWins.clear();
|
|
409
|
+
for (const pending of pendingCurates.values()) {
|
|
410
|
+
try {
|
|
411
|
+
pending.cancel("stale");
|
|
412
|
+
}
|
|
413
|
+
catch { }
|
|
414
|
+
}
|
|
415
|
+
pendingCurates.clear();
|
|
416
|
+
for (const curator of activeCurators.values()) {
|
|
417
|
+
try {
|
|
418
|
+
curator.close();
|
|
419
|
+
}
|
|
420
|
+
catch { }
|
|
421
|
+
}
|
|
422
|
+
activeCurators.clear();
|
|
423
|
+
}
|
|
424
|
+
function updateWidget(ctx) {
|
|
425
|
+
const theme = ctx.ui.theme;
|
|
426
|
+
const entries = activityMonitor.getEntries();
|
|
427
|
+
const lines = [];
|
|
428
|
+
lines.push(theme.fg("accent", "─── Web Search Activity " + "─".repeat(36)));
|
|
429
|
+
if (entries.length === 0) {
|
|
430
|
+
lines.push(theme.fg("muted", " No activity yet"));
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
for (const entry of entries)
|
|
434
|
+
lines.push(" " + formatEntryLine(entry, theme));
|
|
435
|
+
}
|
|
436
|
+
lines.push(theme.fg("accent", "─".repeat(60)));
|
|
437
|
+
const rateInfo = activityMonitor.getRateLimitInfo();
|
|
438
|
+
const resetMs = rateInfo.oldestTimestamp
|
|
439
|
+
? Math.max(0, rateInfo.oldestTimestamp + rateInfo.windowMs - Date.now())
|
|
440
|
+
: 0;
|
|
441
|
+
const resetSec = Math.ceil(resetMs / 1000);
|
|
442
|
+
lines.push(theme.fg("muted", `Rate: ${rateInfo.used}/${rateInfo.max}`) +
|
|
443
|
+
(resetMs > 0 ? theme.fg("dim", ` (resets in ${resetSec}s)`) : ""));
|
|
444
|
+
ctx.ui.setWidget("web-activity", new Text(lines.join("\n"), 0, 0));
|
|
445
|
+
}
|
|
446
|
+
function handleSessionChange(ctx) {
|
|
447
|
+
abortPendingFetches();
|
|
448
|
+
closeCurator();
|
|
449
|
+
runSessionCleanups();
|
|
450
|
+
sessionActive = true;
|
|
451
|
+
restoreFromSession(ctx);
|
|
452
|
+
widgetUnsubscribe?.();
|
|
453
|
+
widgetUnsubscribe = null;
|
|
454
|
+
activityMonitor.clear();
|
|
455
|
+
if (widgetVisible) {
|
|
456
|
+
widgetUnsubscribe = activityMonitor.onUpdate(() => updateWidget(ctx));
|
|
457
|
+
updateWidget(ctx);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
470
460
|
/** Populated on first summary/curator use so sync curator submit/cancel can build fallbacks. */
|
|
471
461
|
let warmSummaryReview = null;
|
|
462
|
+
function assertActiveRequest(generation, signal) {
|
|
463
|
+
signal?.throwIfAborted();
|
|
464
|
+
if (generation !== sessionGeneration)
|
|
465
|
+
throw new Error("Web request cancelled: session changed");
|
|
466
|
+
}
|
|
467
|
+
function startSession(ctx) {
|
|
468
|
+
sessionGeneration++;
|
|
469
|
+
sessionAbort.abort();
|
|
470
|
+
sessionAbort = new AbortController();
|
|
471
|
+
handleSessionChange(ctx);
|
|
472
|
+
}
|
|
472
473
|
async function ensureSummaryReview() {
|
|
473
474
|
if (!warmSummaryReview)
|
|
474
475
|
warmSummaryReview = await loadSummaryReview();
|
|
@@ -1123,8 +1124,8 @@ export default function (pi) {
|
|
|
1123
1124
|
}
|
|
1124
1125
|
},
|
|
1125
1126
|
});
|
|
1126
|
-
pi.on("session_start", async (_event, ctx) =>
|
|
1127
|
-
pi.on("session_tree", async (_event, ctx) =>
|
|
1127
|
+
pi.on("session_start", async (_event, ctx) => startSession(ctx));
|
|
1128
|
+
pi.on("session_tree", async (_event, ctx) => startSession(ctx));
|
|
1128
1129
|
pi.on("session_shutdown", () => {
|
|
1129
1130
|
sessionGeneration++;
|
|
1130
1131
|
sessionAbort.abort();
|