@ashx-j/lunr 0.1.5 → 0.1.7
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/builtin-extensions/index.d.ts +13 -4
- package/dist/builtin-extensions/index.d.ts.map +1 -1
- package/dist/builtin-extensions/index.js +33 -27
- package/dist/builtin-extensions/index.js.map +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +1 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/catalog/models.json +1 -1
- package/dist/catalog/providers/cerebras.json +1 -1
- package/dist/catalog/providers/cloudflare-ai-gateway.json +1 -1
- package/dist/catalog/providers/cloudflare-workers-ai.json +1 -1
- package/dist/catalog/providers/openrouter.json +1 -1
- package/dist/catalog/providers/vercel-ai-gateway.json +1 -1
- package/dist/catalog/publication.json +3 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +9 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +74 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/host-static.d.ts +2 -0
- package/dist/core/extensions/host-static.d.ts.map +1 -0
- package/dist/core/extensions/host-static.js +15 -0
- package/dist/core/extensions/host-static.js.map +1 -0
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +10 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +75 -34
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +12 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +2 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/model-runtime.d.ts +3 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +2 -2
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/official-catalog.d.ts.map +1 -1
- package/dist/core/official-catalog.js +11 -4
- package/dist/core/official-catalog.js.map +1 -1
- package/dist/core/package-manager.d.ts +3 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +38 -8
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resource-loader.d.ts +6 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +40 -8
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/timings.d.ts +1 -0
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js +6 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +2 -2
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +2 -2
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts +8 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +84 -20
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +3 -0
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +77 -23
- package/dist/modes/interactive/interactive-mode.js.map +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/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/package.json +4 -4
|
@@ -320,6 +320,8 @@ export class InteractiveMode {
|
|
|
320
320
|
options;
|
|
321
321
|
autoTrustOnReloadCwd;
|
|
322
322
|
themeController;
|
|
323
|
+
deferredBuiltinsAttached = false;
|
|
324
|
+
deferredBuiltinAttachPromise;
|
|
323
325
|
// Convenience accessors
|
|
324
326
|
get session() {
|
|
325
327
|
return this.runtimeHost.session;
|
|
@@ -625,11 +627,15 @@ export class InteractiveMode {
|
|
|
625
627
|
this.headerContainer.addChild(this.builtInHeader);
|
|
626
628
|
}
|
|
627
629
|
this.ui.requestRender();
|
|
628
|
-
//
|
|
630
|
+
// Light extensions first so resources are shown before messages. Deferred
|
|
631
|
+
// MCP/LSP/web/intercom attach in the background so the editor is usable.
|
|
629
632
|
await this.rebindCurrentSession();
|
|
630
633
|
time("rebindCurrentSession");
|
|
631
|
-
// Render initial messages AFTER showing loaded resources
|
|
632
634
|
this.renderInitialMessages();
|
|
635
|
+
this.deferredBuiltinAttachPromise = this.attachDeferredBuiltinExtensions();
|
|
636
|
+
void this.deferredBuiltinAttachPromise.then(() => {
|
|
637
|
+
time("attachDeferredBuiltins");
|
|
638
|
+
});
|
|
633
639
|
// Set up theme file watcher
|
|
634
640
|
onThemeChange(() => {
|
|
635
641
|
this.ui.invalidate();
|
|
@@ -640,9 +646,16 @@ export class InteractiveMode {
|
|
|
640
646
|
this.footerDataProvider.onBranchChange(() => {
|
|
641
647
|
this.ui.requestRender();
|
|
642
648
|
});
|
|
643
|
-
//
|
|
644
|
-
|
|
645
|
-
|
|
649
|
+
// Cache-only footer snapshot. Do not hold time-to-type on it.
|
|
650
|
+
void this.updateAvailableProviderCount().then(() => {
|
|
651
|
+
time("updateAvailableProviderCount");
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
/** Wait until deferred builtins have attached (or were skipped). */
|
|
655
|
+
async waitForDeferredBuiltins() {
|
|
656
|
+
if (this.deferredBuiltinAttachPromise) {
|
|
657
|
+
await this.deferredBuiltinAttachPromise;
|
|
658
|
+
}
|
|
646
659
|
}
|
|
647
660
|
/**
|
|
648
661
|
* Update terminal title with session name and cwd.
|
|
@@ -662,7 +675,9 @@ export class InteractiveMode {
|
|
|
662
675
|
* Initializes the UI, shows warnings, processes initial messages, and starts the interactive loop.
|
|
663
676
|
*/
|
|
664
677
|
async run() {
|
|
665
|
-
|
|
678
|
+
if (!this.isInitialized) {
|
|
679
|
+
await this.init();
|
|
680
|
+
}
|
|
666
681
|
// Check tmux keyboard setup asynchronously
|
|
667
682
|
this.checkTmuxKeyboardSetup().then((warning) => {
|
|
668
683
|
if (warning) {
|
|
@@ -685,7 +700,7 @@ export class InteractiveMode {
|
|
|
685
700
|
// Process initial messages
|
|
686
701
|
if (initialMessage) {
|
|
687
702
|
try {
|
|
688
|
-
await this.
|
|
703
|
+
await this.promptAfterDeferredBuiltins(initialMessage, { images: initialImages });
|
|
689
704
|
}
|
|
690
705
|
catch (error) {
|
|
691
706
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -695,7 +710,7 @@ export class InteractiveMode {
|
|
|
695
710
|
if (initialMessages) {
|
|
696
711
|
for (const message of initialMessages) {
|
|
697
712
|
try {
|
|
698
|
-
await this.
|
|
713
|
+
await this.promptAfterDeferredBuiltins(message);
|
|
699
714
|
}
|
|
700
715
|
catch (error) {
|
|
701
716
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -707,7 +722,7 @@ export class InteractiveMode {
|
|
|
707
722
|
while (true) {
|
|
708
723
|
const userInput = await this.getUserInput();
|
|
709
724
|
try {
|
|
710
|
-
await this.
|
|
725
|
+
await this.promptAfterDeferredBuiltins(userInput);
|
|
711
726
|
}
|
|
712
727
|
catch (error) {
|
|
713
728
|
const errorMessage = error instanceof Error ? error.message : "Unknown error occurred";
|
|
@@ -1200,6 +1215,42 @@ export class InteractiveMode {
|
|
|
1200
1215
|
/**
|
|
1201
1216
|
* Initialize the extension system with TUI-based UI context.
|
|
1202
1217
|
*/
|
|
1218
|
+
async awaitDeferredBuiltinsForPrompt() {
|
|
1219
|
+
await this.waitForDeferredBuiltins();
|
|
1220
|
+
}
|
|
1221
|
+
async promptAfterDeferredBuiltins(text, options) {
|
|
1222
|
+
await this.awaitDeferredBuiltinsForPrompt();
|
|
1223
|
+
await this.session.prompt(text, options);
|
|
1224
|
+
}
|
|
1225
|
+
async sendUserMessageAfterDeferredBuiltins(text) {
|
|
1226
|
+
await this.awaitDeferredBuiltinsForPrompt();
|
|
1227
|
+
await this.session.sendUserMessage(text);
|
|
1228
|
+
}
|
|
1229
|
+
async attachDeferredBuiltinExtensions() {
|
|
1230
|
+
if (this.deferredBuiltinsAttached || !this.options.deferredBuiltinFactories) {
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
this.setExtensionStatus("deferred-builtins", "loading tools…");
|
|
1234
|
+
try {
|
|
1235
|
+
const factories = await this.options.deferredBuiltinFactories();
|
|
1236
|
+
this.deferredBuiltinsAttached = true;
|
|
1237
|
+
if (factories.length === 0)
|
|
1238
|
+
return;
|
|
1239
|
+
this.options.onDeferredBuiltinsAttached?.(factories);
|
|
1240
|
+
await this.session.attachInlineExtensions(factories);
|
|
1241
|
+
this.setupAutocompleteProvider();
|
|
1242
|
+
this.setupExtensionShortcuts(this.session.extensionRunner);
|
|
1243
|
+
this.showLoadedResources({ force: false, showDiagnosticsWhenQuiet: true });
|
|
1244
|
+
}
|
|
1245
|
+
catch (error) {
|
|
1246
|
+
this.deferredBuiltinsAttached = false;
|
|
1247
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1248
|
+
this.showError(`Failed to load deferred extensions: ${message}`);
|
|
1249
|
+
}
|
|
1250
|
+
finally {
|
|
1251
|
+
this.setExtensionStatus("deferred-builtins", undefined);
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1203
1254
|
async bindCurrentSessionExtensions() {
|
|
1204
1255
|
const uiContext = this.createExtensionUIContext();
|
|
1205
1256
|
await this.session.bindExtensions({
|
|
@@ -1312,6 +1363,7 @@ export class InteractiveMode {
|
|
|
1312
1363
|
return bootRows;
|
|
1313
1364
|
}
|
|
1314
1365
|
async rebindCurrentSession(options = {}) {
|
|
1366
|
+
await this.waitForDeferredBuiltins();
|
|
1315
1367
|
this.unsubscribe?.();
|
|
1316
1368
|
this.unsubscribe = undefined;
|
|
1317
1369
|
this.applyRuntimeSettings();
|
|
@@ -1328,7 +1380,7 @@ export class InteractiveMode {
|
|
|
1328
1380
|
await this.bindCurrentSessionExtensions();
|
|
1329
1381
|
this.subscribeToAgent();
|
|
1330
1382
|
}
|
|
1331
|
-
|
|
1383
|
+
void this.updateAvailableProviderCount();
|
|
1332
1384
|
this.updateEditorBorderColor();
|
|
1333
1385
|
this.updateTerminalTitle();
|
|
1334
1386
|
}
|
|
@@ -2359,7 +2411,7 @@ export class InteractiveMode {
|
|
|
2359
2411
|
if (this.isExtensionCommand(text)) {
|
|
2360
2412
|
this.editor.addToHistory?.(text);
|
|
2361
2413
|
this.editor.setText("");
|
|
2362
|
-
await this.
|
|
2414
|
+
await this.promptAfterDeferredBuiltins(text);
|
|
2363
2415
|
}
|
|
2364
2416
|
else {
|
|
2365
2417
|
this.queueCompactionMessage(text, "steer");
|
|
@@ -2371,7 +2423,7 @@ export class InteractiveMode {
|
|
|
2371
2423
|
if (this.session.isStreaming) {
|
|
2372
2424
|
this.editor.addToHistory?.(text);
|
|
2373
2425
|
this.editor.setText("");
|
|
2374
|
-
await this.
|
|
2426
|
+
await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "steer" });
|
|
2375
2427
|
this.updatePendingMessagesDisplay();
|
|
2376
2428
|
this.ui.requestRender();
|
|
2377
2429
|
return;
|
|
@@ -3255,7 +3307,7 @@ export class InteractiveMode {
|
|
|
3255
3307
|
if (this.isExtensionCommand(text)) {
|
|
3256
3308
|
this.editor.addToHistory?.(text);
|
|
3257
3309
|
this.editor.setText("");
|
|
3258
|
-
await this.
|
|
3310
|
+
await this.promptAfterDeferredBuiltins(text);
|
|
3259
3311
|
}
|
|
3260
3312
|
else {
|
|
3261
3313
|
this.queueCompactionMessage(text, "followUp");
|
|
@@ -3267,7 +3319,7 @@ export class InteractiveMode {
|
|
|
3267
3319
|
if (this.session.isStreaming) {
|
|
3268
3320
|
this.editor.addToHistory?.(text);
|
|
3269
3321
|
this.editor.setText("");
|
|
3270
|
-
await this.
|
|
3322
|
+
await this.promptAfterDeferredBuiltins(text, { streamingBehavior: "followUp" });
|
|
3271
3323
|
this.updatePendingMessagesDisplay();
|
|
3272
3324
|
this.ui.requestRender();
|
|
3273
3325
|
}
|
|
@@ -3544,7 +3596,7 @@ export class InteractiveMode {
|
|
|
3544
3596
|
// When retry is pending, queue messages for the retry turn
|
|
3545
3597
|
for (const message of queuedMessages) {
|
|
3546
3598
|
if (this.isExtensionCommand(message.text)) {
|
|
3547
|
-
await this.
|
|
3599
|
+
await this.promptAfterDeferredBuiltins(message.text);
|
|
3548
3600
|
}
|
|
3549
3601
|
else if (message.mode === "followUp") {
|
|
3550
3602
|
await this.session.followUp(message.text);
|
|
@@ -3561,7 +3613,7 @@ export class InteractiveMode {
|
|
|
3561
3613
|
if (firstPromptIndex === -1) {
|
|
3562
3614
|
// All extension commands - execute them all
|
|
3563
3615
|
for (const message of queuedMessages) {
|
|
3564
|
-
await this.
|
|
3616
|
+
await this.promptAfterDeferredBuiltins(message.text);
|
|
3565
3617
|
}
|
|
3566
3618
|
return;
|
|
3567
3619
|
}
|
|
@@ -3570,16 +3622,16 @@ export class InteractiveMode {
|
|
|
3570
3622
|
const firstPrompt = queuedMessages[firstPromptIndex];
|
|
3571
3623
|
const rest = queuedMessages.slice(firstPromptIndex + 1);
|
|
3572
3624
|
for (const message of preCommands) {
|
|
3573
|
-
await this.
|
|
3625
|
+
await this.promptAfterDeferredBuiltins(message.text);
|
|
3574
3626
|
}
|
|
3575
3627
|
// Send first prompt (starts streaming)
|
|
3576
|
-
const promptPromise = this.
|
|
3628
|
+
const promptPromise = this.promptAfterDeferredBuiltins(firstPrompt.text).catch((error) => {
|
|
3577
3629
|
restoreQueue(error);
|
|
3578
3630
|
});
|
|
3579
3631
|
// Queue remaining messages
|
|
3580
3632
|
for (const message of rest) {
|
|
3581
3633
|
if (this.isExtensionCommand(message.text)) {
|
|
3582
|
-
await this.
|
|
3634
|
+
await this.promptAfterDeferredBuiltins(message.text);
|
|
3583
3635
|
}
|
|
3584
3636
|
else if (message.mode === "followUp") {
|
|
3585
3637
|
await this.session.followUp(message.text);
|
|
@@ -5265,7 +5317,7 @@ export class InteractiveMode {
|
|
|
5265
5317
|
return;
|
|
5266
5318
|
}
|
|
5267
5319
|
}
|
|
5268
|
-
await this.
|
|
5320
|
+
await this.sendUserMessageAfterDeferredBuiltins(prompt);
|
|
5269
5321
|
this.showStatus("AGENTS.md is being generated — run /reload when it finishes to load it into context.");
|
|
5270
5322
|
}
|
|
5271
5323
|
async handleSwarmCommand(task) {
|
|
@@ -5284,7 +5336,7 @@ export class InteractiveMode {
|
|
|
5284
5336
|
}
|
|
5285
5337
|
this.swarmMode = true;
|
|
5286
5338
|
this.setExtensionStatus("swarm", "swarm ● active");
|
|
5287
|
-
await this.
|
|
5339
|
+
await this.sendUserMessageAfterDeferredBuiltins(buildSwarmPrompt(task));
|
|
5288
5340
|
}
|
|
5289
5341
|
async handleResearchCommand(args) {
|
|
5290
5342
|
const usage = "Usage: /research [--depth N] [--breadth N] <question> — deep research with cited sources. depth: reflection rounds (1-4, default 2); breadth: subtopics per round (1-8, default 4).";
|
|
@@ -5332,7 +5384,7 @@ export class InteractiveMode {
|
|
|
5332
5384
|
}
|
|
5333
5385
|
this.researchMode = true;
|
|
5334
5386
|
this.setExtensionStatus("research", "research ● active");
|
|
5335
|
-
await this.
|
|
5387
|
+
await this.sendUserMessageAfterDeferredBuiltins(buildResearchPrompt(question, depth, breadth));
|
|
5336
5388
|
}
|
|
5337
5389
|
// lunr: /undo persists the rewind by forking the session to just before the
|
|
5338
5390
|
// last user message (same fork mechanism /rollback uses, but WITHOUT touching files).
|
|
@@ -5965,7 +6017,7 @@ export class InteractiveMode {
|
|
|
5965
6017
|
else {
|
|
5966
6018
|
this.applyPermissionMode("plan");
|
|
5967
6019
|
}
|
|
5968
|
-
await this.
|
|
6020
|
+
await this.sendUserMessageAfterDeferredBuiltins(args);
|
|
5969
6021
|
return;
|
|
5970
6022
|
}
|
|
5971
6023
|
const next = sub === "" ? !inPlan : sub === "on";
|
|
@@ -6366,6 +6418,8 @@ ${cycleThinkingLevel ? `| \`${cycleThinkingLevel}\` | Cycle thinking level |\n`
|
|
|
6366
6418
|
async handleClearCommand() {
|
|
6367
6419
|
this.clearStatusIndicator();
|
|
6368
6420
|
this.ui.setChatScroll(0);
|
|
6421
|
+
// Deferred factories must be on builtinRoster before /new rebuilds the runtime.
|
|
6422
|
+
await this.waitForDeferredBuiltins();
|
|
6369
6423
|
// lunr: preserve the in-flight model across /new so a /model switch survives.
|
|
6370
6424
|
const previousModel = this.session.model;
|
|
6371
6425
|
try {
|