@dyyz1993/pi-coding-agent 0.74.14 → 0.74.15
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 +7 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +5 -4
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +7 -4
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +1 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +43 -41
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/package.json +4 -4
|
@@ -12,6 +12,7 @@ import { spawn, spawnSync } from "child_process";
|
|
|
12
12
|
import { APP_NAME, APP_TITLE, getAgentDir, getAuthPath, getDebugLogPath, getDocsPath, getShareViewerUrl, VERSION, } from "../../config.js";
|
|
13
13
|
import { parseSkillBlock } from "../../core/agent-session.js";
|
|
14
14
|
import { SessionImportFileNotFoundError } from "../../core/agent-session-runtime.js";
|
|
15
|
+
import { resolveProjectIdentity, getSessionDataDir, getProjectDataDir, getCwdDataDir, getGlobalDataDir } from "../../core/storage.js";
|
|
15
16
|
import { FooterDataProvider } from "../../core/footer-data-provider.js";
|
|
16
17
|
import { KeybindingsManager } from "../../core/keybindings.js";
|
|
17
18
|
import { createCompactionSummaryMessage } from "../../core/messages.js";
|
|
@@ -1225,51 +1226,52 @@ export class InteractiveMode {
|
|
|
1225
1226
|
if (shortcuts.size === 0)
|
|
1226
1227
|
return;
|
|
1227
1228
|
// Create a context for shortcut handlers
|
|
1228
|
-
const createContext = () =>
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
this.
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1229
|
+
const createContext = (extName) => {
|
|
1230
|
+
const projectRoot = resolveProjectIdentity(this.sessionManager.getCwd());
|
|
1231
|
+
return {
|
|
1232
|
+
ui: this.createExtensionUIContext(),
|
|
1233
|
+
hasUI: true,
|
|
1234
|
+
cwd: this.sessionManager.getCwd(),
|
|
1235
|
+
sessionManager: this.sessionManager,
|
|
1236
|
+
modelRegistry: this.session.modelRegistry,
|
|
1237
|
+
model: this.session.model,
|
|
1238
|
+
isIdle: () => !this.session.isStreaming,
|
|
1239
|
+
signal: this.session.agent.signal,
|
|
1240
|
+
abort: () => this.session.abort(),
|
|
1241
|
+
hasPendingMessages: () => this.session.pendingMessageCount > 0,
|
|
1242
|
+
shutdown: () => {
|
|
1243
|
+
this.shutdownRequested = true;
|
|
1244
|
+
},
|
|
1245
|
+
getContextUsage: () => this.session.getContextUsage(),
|
|
1246
|
+
compact: (options) => {
|
|
1247
|
+
void (async () => {
|
|
1248
|
+
try {
|
|
1249
|
+
const result = await this.session.compact(options?.customInstructions);
|
|
1250
|
+
options?.onComplete?.(result);
|
|
1251
|
+
}
|
|
1252
|
+
catch (error) {
|
|
1253
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
1254
|
+
options?.onError?.(err);
|
|
1255
|
+
}
|
|
1256
|
+
})();
|
|
1257
|
+
},
|
|
1258
|
+
getSystemPrompt: () => this.session.systemPrompt,
|
|
1259
|
+
extensionName: extName,
|
|
1260
|
+
projectRoot,
|
|
1261
|
+
sessionDataDir: getSessionDataDir(this.sessionManager.getSessionDir(), this.sessionManager.getSessionId(), extName),
|
|
1262
|
+
projectDataDir: getProjectDataDir(projectRoot, extName),
|
|
1263
|
+
cwdDataDir: getCwdDataDir(this.sessionManager.getCwd(), extName),
|
|
1264
|
+
globalDataDir: getGlobalDataDir(extName),
|
|
1265
|
+
sessionSignal: AbortSignal.abort(),
|
|
1266
|
+
respondUI: () => { },
|
|
1267
|
+
fileSnapshotManager: this.session.fileSnapshotManager,
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1266
1270
|
// Set up the extension shortcut handler on the default editor
|
|
1267
1271
|
this.defaultEditor.onExtensionShortcut = (data) => {
|
|
1268
1272
|
for (const [shortcutStr, shortcut] of shortcuts) {
|
|
1269
|
-
// Cast to KeyId - extension shortcuts use the same format
|
|
1270
1273
|
if (matchesKey(data, shortcutStr)) {
|
|
1271
|
-
|
|
1272
|
-
Promise.resolve(shortcut.handler(createContext())).catch((err) => {
|
|
1274
|
+
Promise.resolve(shortcut.handler(createContext(shortcut.extensionName))).catch((err) => {
|
|
1273
1275
|
this.showError(`Shortcut handler error: ${err instanceof Error ? err.message : String(err)}`);
|
|
1274
1276
|
});
|
|
1275
1277
|
return true;
|