@ashx-j/lunr 0.2.8 → 0.2.9
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/ashxj-spinners.d.ts +7 -0
- package/dist/builtin-extensions/ashxj-spinners.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-spinners.js +40 -3
- package/dist/builtin-extensions/ashxj-spinners.js.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.d.ts +4 -0
- package/dist/builtin-extensions/ashxj-tui.d.ts.map +1 -1
- package/dist/builtin-extensions/ashxj-tui.js +44 -0
- package/dist/builtin-extensions/ashxj-tui.js.map +1 -1
- package/dist/builtin-extensions/lunr-behavior.d.ts +2 -1
- package/dist/builtin-extensions/lunr-behavior.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-behavior.js +26 -14
- package/dist/builtin-extensions/lunr-behavior.js.map +1 -1
- package/dist/builtin-extensions/lunr-todos.d.ts +4 -7
- package/dist/builtin-extensions/lunr-todos.d.ts.map +1 -1
- package/dist/builtin-extensions/lunr-todos.js +18 -10
- package/dist/builtin-extensions/lunr-todos.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.js +3 -3
- package/dist/builtin-extensions/pi-subagents/src/agents/agent-management.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 +2 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/schemas.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts +2 -2
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js +3 -4
- package/dist/builtin-extensions/pi-subagents/src/extension/tool-description.js.map +1 -1
- 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 +6 -18
- package/dist/builtin-extensions/pi-subagents/src/runs/foreground/subagent-executor.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js +13 -5
- package/dist/builtin-extensions/pi-subagents/src/runs/shared/model-fallback.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.d.ts +21 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.d.ts.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.js +22 -0
- package/dist/builtin-extensions/pi-subagents/src/shared/lunr-child-context.js.map +1 -0
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js +2 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/prompt-workflows.js.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js +10 -18
- package/dist/builtin-extensions/pi-subagents/src/slash/slash-commands.js.map +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.d.ts.map +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.js +1 -1
- package/dist/builtin-extensions/pi-web-access/render-search-error.js.map +1 -1
- package/dist/catalog/models.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/update-cli.d.ts +16 -0
- package/dist/cli/update-cli.d.ts.map +1 -0
- package/dist/cli/update-cli.js +83 -0
- package/dist/cli/update-cli.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/core/behavior-preset.d.ts +60 -0
- package/dist/core/behavior-preset.d.ts.map +1 -0
- package/dist/core/behavior-preset.js +257 -0
- package/dist/core/behavior-preset.js.map +1 -0
- package/dist/core/customize.d.ts +3 -0
- package/dist/core/customize.d.ts.map +1 -1
- package/dist/core/customize.js +9 -0
- package/dist/core/customize.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +12 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +70 -5
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +2 -2
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-tiers.d.ts +9 -0
- package/dist/core/model-tiers.d.ts.map +1 -1
- package/dist/core/model-tiers.js +16 -0
- package/dist/core/model-tiers.js.map +1 -1
- package/dist/core/settings-manager.d.ts +23 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +66 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +1 -3
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/update-check.d.ts +32 -0
- package/dist/core/update-check.d.ts.map +1 -0
- package/dist/core/update-check.js +112 -0
- package/dist/core/update-check.js.map +1 -0
- package/dist/core/usage-service.d.ts +24 -1
- package/dist/core/usage-service.d.ts.map +1 -1
- package/dist/core/usage-service.js +91 -14
- package/dist/core/usage-service.js.map +1 -1
- package/dist/gateway/agent-bridge.d.ts.map +1 -1
- package/dist/gateway/agent-bridge.js +5 -1
- package/dist/gateway/agent-bridge.js.map +1 -1
- package/dist/gateway/cron.d.ts.map +1 -1
- package/dist/gateway/cron.js +5 -1
- package/dist/gateway/cron.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +13 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +4 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +68 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +13 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +157 -10
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +4 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +82 -3
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/keybindings.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/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
|
@@ -6,12 +6,14 @@ import * as crypto from "node:crypto";
|
|
|
6
6
|
import * as fs from "node:fs";
|
|
7
7
|
import * as os from "node:os";
|
|
8
8
|
import * as path from "node:path";
|
|
9
|
+
import { getSupportedThinkingLevels, } from "@ashx-j/lunr-ai/compat";
|
|
9
10
|
import { CombinedAutocompleteProvider, Container, fuzzyFilter, isFocusable, Markdown, matchesKey, ProcessTerminal, Spacer, setKeybindings, Text, TruncatedText, TUI, visibleWidth, } from "@ashx-j/lunr-tui";
|
|
10
11
|
import chalk from "chalk";
|
|
11
12
|
import { spawn, spawnSync } from "child_process";
|
|
12
13
|
import { APP_NAME, APP_TITLE, appendDebugLog, CONFIG_DIR_NAME, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
13
14
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
14
15
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
16
|
+
import { applyBehaviorPreset, reconcileBehaviorPreset } from "../../core/behavior-preset.js";
|
|
15
17
|
import { CACHE_TTL_MS, collectCacheMisses, computeCacheWaste, detectCacheMiss, } from "../../core/cache-stats.js";
|
|
16
18
|
import { formatCatalogRefreshSummary } from "../../core/catalog-merge.js";
|
|
17
19
|
import { computeContextBreakdown } from "../../core/context-breakdown.js";
|
|
@@ -26,6 +28,8 @@ import { isValidProviderBaseUrl, parseModelIds, slugifyProviderId, upsertCustomP
|
|
|
26
28
|
import { defaultModelPerProvider, findExactModelReferenceMatch, resolveModelScope } from "../../core/model-resolver.js";
|
|
27
29
|
import { refreshModelCandidatesForInit } from "../../core/model-runtime.js";
|
|
28
30
|
import { getModelTiersBridge } from "../../core/model-tiers.js";
|
|
31
|
+
import { checkForUpdate, markUpdateNotified } from "../../core/update-check.js";
|
|
32
|
+
import { getUsageServiceBridge } from "../../core/usage-service.js";
|
|
29
33
|
import { registerPermissionModeBridge } from "../../core/permission-mode.js";
|
|
30
34
|
import { nextModeForGoal, registerPermissionModeControlBridge } from "../../core/permission-mode-control.js";
|
|
31
35
|
import { AUTO_MODE_ADDENDUM, getPermissionMode, nextPermissionMode, registerApprovalHandler, resetPermissions, restorePermissionModeAfterPlan, setPermissionMode, } from "../../core/permissions.js";
|
|
@@ -589,6 +593,8 @@ export class InteractiveMode {
|
|
|
589
593
|
this.ui.start();
|
|
590
594
|
this.isInitialized = true;
|
|
591
595
|
time("ui.start");
|
|
596
|
+
void this.maybeNotifyCliUpdate();
|
|
597
|
+
this.startPlanUsagePolling();
|
|
592
598
|
// lunr: register the permission approval dialog handler so manual mode can prompt.
|
|
593
599
|
registerApprovalHandler(async (req) => {
|
|
594
600
|
// lunr: auto-activated agent swarms get their own dialog; on approval the
|
|
@@ -665,6 +671,38 @@ export class InteractiveMode {
|
|
|
665
671
|
await this.deferredBuiltinAttachPromise;
|
|
666
672
|
}
|
|
667
673
|
}
|
|
674
|
+
planUsageTimer;
|
|
675
|
+
startPlanUsagePolling() {
|
|
676
|
+
const bridge = getUsageServiceBridge();
|
|
677
|
+
if (!bridge)
|
|
678
|
+
return;
|
|
679
|
+
bridge.setOnUpdate(() => this.ui.requestRender());
|
|
680
|
+
const tick = () => {
|
|
681
|
+
const provider = this.session.model?.provider;
|
|
682
|
+
if (provider)
|
|
683
|
+
bridge.prefetch(provider);
|
|
684
|
+
};
|
|
685
|
+
tick();
|
|
686
|
+
this.planUsageTimer = setInterval(tick, 60_000);
|
|
687
|
+
this.planUsageTimer.unref?.();
|
|
688
|
+
}
|
|
689
|
+
/** Background npm version check. Never blocks first paint. Workspace installs skip. */
|
|
690
|
+
async maybeNotifyCliUpdate() {
|
|
691
|
+
try {
|
|
692
|
+
const result = await checkForUpdate({
|
|
693
|
+
currentVersion: VERSION,
|
|
694
|
+
agentDir: getAgentDir(),
|
|
695
|
+
offline: process.env.PI_OFFLINE === "1",
|
|
696
|
+
});
|
|
697
|
+
if (!result?.notice)
|
|
698
|
+
return;
|
|
699
|
+
this.showStatus(result.notice);
|
|
700
|
+
markUpdateNotified(getAgentDir(), result.latest);
|
|
701
|
+
}
|
|
702
|
+
catch {
|
|
703
|
+
// Version check is best-effort.
|
|
704
|
+
}
|
|
705
|
+
}
|
|
668
706
|
/**
|
|
669
707
|
* Update terminal title with session name and cwd.
|
|
670
708
|
*/
|
|
@@ -2117,7 +2155,7 @@ export class InteractiveMode {
|
|
|
2117
2155
|
// Global debug handler on TUI (works regardless of focus)
|
|
2118
2156
|
this.ui.onDebug = () => this.handleDebugCommand();
|
|
2119
2157
|
this.defaultEditor.onAction("app.model.select", () => void this.showModelSelector());
|
|
2120
|
-
|
|
2158
|
+
// lunr: tool/thinking expand is per-item click; ctrl+o is not bound (tree filter still uses ctrl+o).
|
|
2121
2159
|
this.defaultEditor.onAction("app.thinking.toggle", () => this.toggleThinkingBlockVisibility());
|
|
2122
2160
|
this.defaultEditor.onAction("app.editor.external", () => this.openExternalEditor());
|
|
2123
2161
|
this.defaultEditor.onAction("app.message.copy", () => void this.handleCopyCommand());
|
|
@@ -3194,6 +3232,11 @@ export class InteractiveMode {
|
|
|
3194
3232
|
return;
|
|
3195
3233
|
this.isShuttingDown = true;
|
|
3196
3234
|
this.stopSmoothStreaming();
|
|
3235
|
+
if (this.planUsageTimer) {
|
|
3236
|
+
clearInterval(this.planUsageTimer);
|
|
3237
|
+
this.planUsageTimer = undefined;
|
|
3238
|
+
}
|
|
3239
|
+
getUsageServiceBridge()?.setOnUpdate(undefined);
|
|
3197
3240
|
// Keep signal handlers registered until terminal cleanup has completed.
|
|
3198
3241
|
// `signal-exit` checks the listener list during the same SIGTERM/SIGHUP
|
|
3199
3242
|
// dispatch and re-sends the signal if only its own listeners remain.
|
|
@@ -3801,6 +3844,7 @@ export class InteractiveMode {
|
|
|
3801
3844
|
showTerminalProgress: this.settingsManager.getShowTerminalProgress(),
|
|
3802
3845
|
modelTiers: this.settingsManager.getModelTiers(),
|
|
3803
3846
|
memoryCharCap: this.settingsManager.getMemoryCharCap(),
|
|
3847
|
+
behaviorPreset: reconcileBehaviorPreset(this.settingsManager),
|
|
3804
3848
|
searchCurator: getSearchCuratorSetting(),
|
|
3805
3849
|
// lunr: TUI customize settings
|
|
3806
3850
|
gutterRail: this.settingsManager.getGutterRail(),
|
|
@@ -3810,6 +3854,10 @@ export class InteractiveMode {
|
|
|
3810
3854
|
footerContext: this.settingsManager.getFooterContext(),
|
|
3811
3855
|
footerTokens: this.settingsManager.getFooterTokens(),
|
|
3812
3856
|
footerStatuses: this.settingsManager.getFooterStatuses(),
|
|
3857
|
+
footerGit: this.settingsManager.getFooterGit(),
|
|
3858
|
+
footerPlan: this.settingsManager.getFooterPlan(),
|
|
3859
|
+
footerPlanBar: this.settingsManager.getFooterPlanBar(),
|
|
3860
|
+
planUsageWindow: this.settingsManager.getPlanUsageWindow(),
|
|
3813
3861
|
defaultPermissionMode: this.settingsManager.getDefaultPermissionMode(),
|
|
3814
3862
|
rollbackEnabled: this.settingsManager.getRollbackEnabled(),
|
|
3815
3863
|
rollbackTurns: this.settingsManager.getRollbackTurns(),
|
|
@@ -3973,9 +4021,28 @@ export class InteractiveMode {
|
|
|
3973
4021
|
onModelTierModelChange: (tier, model) => {
|
|
3974
4022
|
this.settingsManager.setTierModel(tier, model);
|
|
3975
4023
|
},
|
|
4024
|
+
onModelTierThinkingChange: (tier, level) => {
|
|
4025
|
+
this.settingsManager.setTierThinking(tier, level);
|
|
4026
|
+
},
|
|
4027
|
+
getTierThinkingLevels: (tier) => {
|
|
4028
|
+
const model = this.resolveModelReference(this.settingsManager.getTierModel(tier));
|
|
4029
|
+
if (model)
|
|
4030
|
+
return getSupportedThinkingLevels(model);
|
|
4031
|
+
return this.session.getAvailableThinkingLevels();
|
|
4032
|
+
},
|
|
3976
4033
|
onMemoryCharCapChange: (cap) => {
|
|
3977
4034
|
this.settingsManager.setMemoryCharCap(cap);
|
|
3978
4035
|
},
|
|
4036
|
+
onBehaviorPresetChange: (preset) => {
|
|
4037
|
+
const result = applyBehaviorPreset(this.settingsManager, preset, getAgentDir(), {
|
|
4038
|
+
overwrite: true,
|
|
4039
|
+
});
|
|
4040
|
+
if (result.ok) {
|
|
4041
|
+
this.showStatus(preset === "custom"
|
|
4042
|
+
? "Behavior preset: custom (file is source of truth)"
|
|
4043
|
+
: `Behavior preset: ${preset}`);
|
|
4044
|
+
}
|
|
4045
|
+
},
|
|
3979
4046
|
onSearchCuratorChange: (setting) => {
|
|
3980
4047
|
if (!setSearchCuratorSetting(setting)) {
|
|
3981
4048
|
this.showError("pi-web-access is not loaded; curator setting unavailable.");
|
|
@@ -4003,6 +4070,18 @@ export class InteractiveMode {
|
|
|
4003
4070
|
onFooterStatusesChange: (enabled) => {
|
|
4004
4071
|
this.settingsManager.setFooterStatuses(enabled);
|
|
4005
4072
|
},
|
|
4073
|
+
onFooterGitChange: (enabled) => {
|
|
4074
|
+
this.settingsManager.setFooterGit(enabled);
|
|
4075
|
+
},
|
|
4076
|
+
onFooterPlanChange: (enabled) => {
|
|
4077
|
+
this.settingsManager.setFooterPlan(enabled);
|
|
4078
|
+
},
|
|
4079
|
+
onFooterPlanBarChange: (enabled) => {
|
|
4080
|
+
this.settingsManager.setFooterPlanBar(enabled);
|
|
4081
|
+
},
|
|
4082
|
+
onPlanUsageWindowChange: (window) => {
|
|
4083
|
+
this.settingsManager.setPlanUsageWindow(window);
|
|
4084
|
+
},
|
|
4006
4085
|
onDefaultPermissionModeChange: (mode) => {
|
|
4007
4086
|
this.settingsManager.setDefaultPermissionMode(mode);
|
|
4008
4087
|
},
|
|
@@ -6419,7 +6498,7 @@ export class InteractiveMode {
|
|
|
6419
6498
|
const cyclePermissionMode = this.getAppKeyDisplay("app.mode.cycle");
|
|
6420
6499
|
const cycleModelForward = this.getAppKeyDisplay("app.model.cycleForward");
|
|
6421
6500
|
const selectModel = this.getAppKeyDisplay("app.model.select");
|
|
6422
|
-
const expandTools =
|
|
6501
|
+
const expandTools = "click";
|
|
6423
6502
|
const toggleThinking = this.getAppKeyDisplay("app.thinking.toggle");
|
|
6424
6503
|
const externalEditor = this.getAppKeyDisplay("app.editor.external");
|
|
6425
6504
|
const cycleModelBackward = this.getAppKeyDisplay("app.model.cycleBackward");
|
|
@@ -6464,7 +6543,7 @@ export class InteractiveMode {
|
|
|
6464
6543
|
| \`${cyclePermissionMode}\` | Cycle permission mode |
|
|
6465
6544
|
${cycleThinkingLevel ? `| \`${cycleThinkingLevel}\` | Cycle thinking level |\n` : ""}| \`${cycleModelForward}\` / \`${cycleModelBackward}\` | Cycle models |
|
|
6466
6545
|
| \`${selectModel}\` | Open model selector |
|
|
6467
|
-
| \`${expandTools}\` |
|
|
6546
|
+
| \`${expandTools}\` | Expand or collapse a thinking/tool card |
|
|
6468
6547
|
| \`${toggleThinking}\` | Toggle thinking block visibility |
|
|
6469
6548
|
| \`${externalEditor}\` | Edit message in external editor |
|
|
6470
6549
|
| \`${copyMessage}\` | Copy last assistant message |
|