@fleetagent/pi-coding-agent 0.0.1 → 0.0.2
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 +16 -0
- package/dist/core/agent-session.d.ts +5 -5
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +8 -11
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +2 -2
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +1 -1
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -3
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +5 -5
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +15 -8
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +1 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/pi-agent.d.ts +5 -3
- package/dist/core/pi-agent.d.ts.map +1 -1
- package/dist/core/pi-agent.js +64 -18
- package/dist/core/pi-agent.js.map +1 -1
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -1
- package/dist/core/session/in-memory-session-manager.js +5 -7
- package/dist/core/session/in-memory-session-manager.js.map +1 -1
- package/dist/core/session/in-memory-session.d.ts +3 -1
- package/dist/core/session/in-memory-session.d.ts.map +1 -1
- package/dist/core/session/in-memory-session.js +5 -2
- package/dist/core/session/in-memory-session.js.map +1 -1
- package/dist/core/session/index.d.ts +2 -2
- package/dist/core/session/index.d.ts.map +1 -1
- package/dist/core/session/index.js.map +1 -1
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
- package/dist/core/session/jsonl-helpers.js +4 -4
- package/dist/core/session/jsonl-helpers.js.map +1 -1
- package/dist/core/session/local-session-manager.d.ts.map +1 -1
- package/dist/core/session/local-session-manager.js +12 -11
- package/dist/core/session/local-session-manager.js.map +1 -1
- package/dist/core/session/local-session.d.ts +3 -1
- package/dist/core/session/local-session.d.ts.map +1 -1
- package/dist/core/session/local-session.js +7 -2
- package/dist/core/session/local-session.js.map +1 -1
- package/dist/core/session/remote-session-client.d.ts +6 -1
- package/dist/core/session/remote-session-client.d.ts.map +1 -1
- package/dist/core/session/remote-session-client.js.map +1 -1
- package/dist/core/session/remote-session-manager.d.ts.map +1 -1
- package/dist/core/session/remote-session-manager.js +28 -7
- package/dist/core/session/remote-session-manager.js.map +1 -1
- package/dist/core/session/remote-session.d.ts +3 -0
- package/dist/core/session/remote-session.d.ts.map +1 -1
- package/dist/core/session/remote-session.js +4 -1
- package/dist/core/session/remote-session.js.map +1 -1
- package/dist/core/session/session.d.ts +9 -3
- package/dist/core/session/session.d.ts.map +1 -1
- package/dist/core/session/session.js +64 -10
- package/dist/core/session/session.js.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.d.ts +6 -14
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.js +8 -34
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.d.ts +14 -14
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.js +153 -162
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -1
- package/dist/core/session/stores/remote-session-store.d.ts +4 -6
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/remote-session-store.js +18 -30
- package/dist/core/session/stores/remote-session-store.js.map +1 -1
- package/dist/core/session/stores/session-store.d.ts +1 -15
- package/dist/core/session/stores/session-store.d.ts.map +1 -1
- package/dist/core/session/stores/session-store.js.map +1 -1
- package/dist/core/session-cwd.d.ts +2 -2
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +5 -5
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +39 -37
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/docs/extensions.md +35 -32
- package/docs/index.md +1 -1
- package/docs/sdk.md +2 -0
- package/docs/session-format.md +21 -21
- package/docs/sessions.md +2 -2
- package/docs/tui.md +1 -1
- package/examples/README.md +3 -0
- package/examples/extensions/README.md +1 -1
- package/examples/extensions/auto-commit-on-exit.ts +1 -1
- package/examples/extensions/bookmark.ts +3 -3
- package/examples/extensions/confirm-destructive.ts +1 -1
- package/examples/extensions/custom-compaction.ts +1 -1
- package/examples/extensions/custom-footer.ts +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/git-checkpoint.ts +1 -1
- package/examples/extensions/handoff.ts +2 -2
- package/examples/extensions/plan-mode/index.ts +1 -1
- package/examples/extensions/preset.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/summarize.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +1 -1
- package/examples/extensions/todo.ts +1 -1
- package/examples/extensions/tools.ts +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/remote-session-server/README.md +66 -0
- package/examples/remote-session-server/server.ts +359 -0
- package/examples/sdk/11-sessions.ts +3 -3
- package/examples/sdk/13-session-runtime.ts +6 -6
- package/npm-shrinkwrap.json +12 -12
- package/package.json +4 -4
|
@@ -196,7 +196,7 @@ export class InteractiveMode {
|
|
|
196
196
|
get agent() {
|
|
197
197
|
return this.session.agent;
|
|
198
198
|
}
|
|
199
|
-
get
|
|
199
|
+
get activeSession() {
|
|
200
200
|
return this.session.session;
|
|
201
201
|
}
|
|
202
202
|
get settingsManager() {
|
|
@@ -231,7 +231,7 @@ export class InteractiveMode {
|
|
|
231
231
|
this.editor = this.defaultEditor;
|
|
232
232
|
this.editorContainer = new Container();
|
|
233
233
|
this.editorContainer.addChild(this.editor);
|
|
234
|
-
this.footerDataProvider = new FooterDataProvider(this.
|
|
234
|
+
this.footerDataProvider = new FooterDataProvider(this.activeSession.getCwd());
|
|
235
235
|
this.footer = new FooterComponent(this.session, this.footerDataProvider);
|
|
236
236
|
this.footer.setAutoCompactEnabled(this.session.autoCompactionEnabled);
|
|
237
237
|
// Load hide thinking block setting
|
|
@@ -340,7 +340,7 @@ export class InteractiveMode {
|
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
return new CombinedAutocompleteProvider([...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList], this.
|
|
343
|
+
return new CombinedAutocompleteProvider([...slashCommands, ...templateCommands, ...extensionCommands, ...skillCommandList], this.activeSession.getCwd(), this.fdPath);
|
|
344
344
|
}
|
|
345
345
|
setupAutocompleteProvider() {
|
|
346
346
|
let provider = this.createBaseAutocompleteProvider();
|
|
@@ -485,8 +485,8 @@ export class InteractiveMode {
|
|
|
485
485
|
* Update terminal title with session name and cwd.
|
|
486
486
|
*/
|
|
487
487
|
updateTerminalTitle() {
|
|
488
|
-
const cwdBasename = path.basename(this.
|
|
489
|
-
const sessionName = this.
|
|
488
|
+
const cwdBasename = path.basename(this.activeSession.getCwd());
|
|
489
|
+
const sessionName = this.activeSession.getSessionName();
|
|
490
490
|
if (sessionName) {
|
|
491
491
|
this.ui.terminal.setTitle(`${APP_TITLE} - ${sessionName} - ${cwdBasename}`);
|
|
492
492
|
}
|
|
@@ -570,7 +570,7 @@ export class InteractiveMode {
|
|
|
570
570
|
}
|
|
571
571
|
try {
|
|
572
572
|
const packageManager = new DefaultPackageManager({
|
|
573
|
-
cwd: this.
|
|
573
|
+
cwd: this.activeSession.getCwd(),
|
|
574
574
|
agentDir: getAgentDir(),
|
|
575
575
|
settingsManager: this.settingsManager,
|
|
576
576
|
});
|
|
@@ -688,7 +688,7 @@ export class InteractiveMode {
|
|
|
688
688
|
return result;
|
|
689
689
|
}
|
|
690
690
|
formatContextPath(p) {
|
|
691
|
-
const cwd = path.resolve(this.
|
|
691
|
+
const cwd = path.resolve(this.activeSession.getCwd());
|
|
692
692
|
const absolutePath = path.isAbsolute(p) ? path.resolve(p) : path.resolve(cwd, p);
|
|
693
693
|
const relativePath = getCwdRelativePath(absolutePath, cwd);
|
|
694
694
|
if (relativePath !== undefined) {
|
|
@@ -1188,7 +1188,7 @@ export class InteractiveMode {
|
|
|
1188
1188
|
applyRuntimeSettings() {
|
|
1189
1189
|
this.footer.setSession(this.session);
|
|
1190
1190
|
this.footer.setAutoCompactEnabled(this.session.autoCompactionEnabled);
|
|
1191
|
-
this.footerDataProvider.setCwd(this.
|
|
1191
|
+
this.footerDataProvider.setCwd(this.activeSession.getCwd());
|
|
1192
1192
|
this.hideThinkingBlock = this.settingsManager.getHideThinkingBlock();
|
|
1193
1193
|
this.ui.setShowHardwareCursor(this.settingsManager.getShowHardwareCursor());
|
|
1194
1194
|
this.ui.setClearOnShrink(this.settingsManager.getClearOnShrink());
|
|
@@ -1244,8 +1244,8 @@ export class InteractiveMode {
|
|
|
1244
1244
|
const createContext = () => ({
|
|
1245
1245
|
ui: this.createExtensionUIContext(),
|
|
1246
1246
|
hasUI: true,
|
|
1247
|
-
cwd: this.
|
|
1248
|
-
|
|
1247
|
+
cwd: this.activeSession.getCwd(),
|
|
1248
|
+
session: this.activeSession,
|
|
1249
1249
|
modelRegistry: this.session.modelRegistry,
|
|
1250
1250
|
model: this.session.model,
|
|
1251
1251
|
isIdle: () => !this.session.isStreaming,
|
|
@@ -2209,7 +2209,7 @@ export class InteractiveMode {
|
|
|
2209
2209
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
2210
2210
|
showImages: this.settingsManager.getShowImages(),
|
|
2211
2211
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2212
|
-
}, this.getRegisteredToolDefinition(content.name), this.ui, this.
|
|
2212
|
+
}, this.getRegisteredToolDefinition(content.name), this.ui, this.activeSession.getCwd());
|
|
2213
2213
|
component.setExpanded(this.toolOutputExpanded);
|
|
2214
2214
|
this.chatContainer.addChild(component);
|
|
2215
2215
|
this.pendingTools.set(content.id, component);
|
|
@@ -2270,7 +2270,7 @@ export class InteractiveMode {
|
|
|
2270
2270
|
component = new ToolExecutionComponent(event.toolName, event.toolCallId, event.args, {
|
|
2271
2271
|
showImages: this.settingsManager.getShowImages(),
|
|
2272
2272
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2273
|
-
}, this.getRegisteredToolDefinition(event.toolName), this.ui, this.
|
|
2273
|
+
}, this.getRegisteredToolDefinition(event.toolName), this.ui, this.activeSession.getCwd());
|
|
2274
2274
|
component.setExpanded(this.toolOutputExpanded);
|
|
2275
2275
|
this.chatContainer.addChild(component);
|
|
2276
2276
|
this.pendingTools.set(event.toolCallId, component);
|
|
@@ -2549,7 +2549,7 @@ export class InteractiveMode {
|
|
|
2549
2549
|
const component = new ToolExecutionComponent(content.name, content.id, content.arguments, {
|
|
2550
2550
|
showImages: this.settingsManager.getShowImages(),
|
|
2551
2551
|
imageWidthCells: this.settingsManager.getImageWidthCells(),
|
|
2552
|
-
}, this.getRegisteredToolDefinition(content.name), this.ui, this.
|
|
2552
|
+
}, this.getRegisteredToolDefinition(content.name), this.ui, this.activeSession.getCwd());
|
|
2553
2553
|
component.setExpanded(this.toolOutputExpanded);
|
|
2554
2554
|
this.chatContainer.addChild(component);
|
|
2555
2555
|
if (message.stopReason === "aborted" || message.stopReason === "error") {
|
|
@@ -2592,13 +2592,13 @@ export class InteractiveMode {
|
|
|
2592
2592
|
}
|
|
2593
2593
|
renderInitialMessages() {
|
|
2594
2594
|
// Get aligned messages and entries from session context
|
|
2595
|
-
const context = this.
|
|
2595
|
+
const context = this.activeSession.buildSessionContext();
|
|
2596
2596
|
this.renderSessionContext(context, {
|
|
2597
2597
|
updateFooter: true,
|
|
2598
2598
|
populateHistory: true,
|
|
2599
2599
|
});
|
|
2600
2600
|
// Show compaction info if session was compacted
|
|
2601
|
-
const allEntries = this.
|
|
2601
|
+
const allEntries = this.activeSession.getEntries();
|
|
2602
2602
|
const compactionCount = allEntries.filter((e) => e.type === "compaction").length;
|
|
2603
2603
|
if (compactionCount > 0) {
|
|
2604
2604
|
const times = compactionCount === 1 ? "1 time" : `${compactionCount} times`;
|
|
@@ -2615,7 +2615,7 @@ export class InteractiveMode {
|
|
|
2615
2615
|
}
|
|
2616
2616
|
rebuildChatFromMessages() {
|
|
2617
2617
|
this.chatContainer.clear();
|
|
2618
|
-
const context = this.
|
|
2618
|
+
const context = this.activeSession.buildSessionContext();
|
|
2619
2619
|
this.renderSessionContext(context);
|
|
2620
2620
|
}
|
|
2621
2621
|
// =========================================================================
|
|
@@ -3515,7 +3515,7 @@ export class InteractiveMode {
|
|
|
3515
3515
|
});
|
|
3516
3516
|
}
|
|
3517
3517
|
async handleCloneCommand() {
|
|
3518
|
-
const leafId = this.
|
|
3518
|
+
const leafId = this.activeSession.getLeafId();
|
|
3519
3519
|
if (!leafId) {
|
|
3520
3520
|
this.showStatus("Nothing to clone yet");
|
|
3521
3521
|
return;
|
|
@@ -3535,8 +3535,8 @@ export class InteractiveMode {
|
|
|
3535
3535
|
}
|
|
3536
3536
|
}
|
|
3537
3537
|
showTreeSelector(initialSelectedId) {
|
|
3538
|
-
const tree = this.
|
|
3539
|
-
const realLeafId = this.
|
|
3538
|
+
const tree = this.activeSession.getTree();
|
|
3539
|
+
const realLeafId = this.activeSession.getLeafId();
|
|
3540
3540
|
const initialFilterMode = this.settingsManager.getTreeFilterMode();
|
|
3541
3541
|
if (tree.length === 0) {
|
|
3542
3542
|
this.showStatus("No entries in session");
|
|
@@ -3630,7 +3630,7 @@ export class InteractiveMode {
|
|
|
3630
3630
|
done();
|
|
3631
3631
|
this.ui.requestRender();
|
|
3632
3632
|
}, (entryId, label) => {
|
|
3633
|
-
this.
|
|
3633
|
+
this.activeSession.appendLabelChange(entryId, label);
|
|
3634
3634
|
this.ui.requestRender();
|
|
3635
3635
|
}, initialSelectedId, initialFilterMode);
|
|
3636
3636
|
return { component: selector, focus: selector };
|
|
@@ -3638,10 +3638,18 @@ export class InteractiveMode {
|
|
|
3638
3638
|
}
|
|
3639
3639
|
showSessionSelector() {
|
|
3640
3640
|
this.showSelector((done) => {
|
|
3641
|
-
const
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3641
|
+
const activeSessionReference = this.activeSession.getSessionReference();
|
|
3642
|
+
const isRemoteSession = activeSessionReference?.startsWith("remote:") ?? false;
|
|
3643
|
+
const renameSession = isRemoteSession
|
|
3644
|
+
? undefined
|
|
3645
|
+
: async (sessionFilePath, nextName) => {
|
|
3646
|
+
const next = (nextName ?? "").trim();
|
|
3647
|
+
if (!next)
|
|
3648
|
+
return;
|
|
3649
|
+
const mgr = new LocalSessionManager({ cwd: process.cwd() }).openReference(sessionFilePath);
|
|
3650
|
+
mgr.appendSessionInfo(next);
|
|
3651
|
+
};
|
|
3652
|
+
const selector = new SessionSelectorComponent((onProgress) => this.runtimeHost.listSessions(onProgress), (onProgress) => this.runtimeHost.listAllSessions(onProgress), async (sessionPath) => {
|
|
3645
3653
|
done();
|
|
3646
3654
|
await this.handleResumeSession(sessionPath);
|
|
3647
3655
|
}, () => {
|
|
@@ -3650,16 +3658,10 @@ export class InteractiveMode {
|
|
|
3650
3658
|
}, () => {
|
|
3651
3659
|
void this.shutdown();
|
|
3652
3660
|
}, () => this.ui.requestRender(), {
|
|
3653
|
-
renameSession
|
|
3654
|
-
|
|
3655
|
-
if (!next)
|
|
3656
|
-
return;
|
|
3657
|
-
const mgr = new LocalSessionManager({ cwd: process.cwd() }).openReference(sessionFilePath);
|
|
3658
|
-
mgr.appendSessionInfo(next);
|
|
3659
|
-
},
|
|
3660
|
-
showRenameHint: true,
|
|
3661
|
+
renameSession,
|
|
3662
|
+
showRenameHint: !isRemoteSession,
|
|
3661
3663
|
keybindings: this.keybindings,
|
|
3662
|
-
},
|
|
3664
|
+
}, activeSessionReference);
|
|
3663
3665
|
return { component: selector, focus: selector };
|
|
3664
3666
|
});
|
|
3665
3667
|
}
|
|
@@ -4291,7 +4293,7 @@ export class InteractiveMode {
|
|
|
4291
4293
|
handleNameCommand(text) {
|
|
4292
4294
|
const name = text.replace(/^\/name\s*/, "").trim();
|
|
4293
4295
|
if (!name) {
|
|
4294
|
-
const currentName = this.
|
|
4296
|
+
const currentName = this.activeSession.getSessionName();
|
|
4295
4297
|
if (currentName) {
|
|
4296
4298
|
this.chatContainer.addChild(new Spacer(1));
|
|
4297
4299
|
this.chatContainer.addChild(new Text(theme.fg("dim", `Session name: ${currentName}`), 1, 0));
|
|
@@ -4309,7 +4311,7 @@ export class InteractiveMode {
|
|
|
4309
4311
|
}
|
|
4310
4312
|
handleSessionCommand() {
|
|
4311
4313
|
const stats = this.session.getSessionStats();
|
|
4312
|
-
const sessionName = this.
|
|
4314
|
+
const sessionName = this.activeSession.getSessionName();
|
|
4313
4315
|
let info = `${theme.bold("Session Info")}\n\n`;
|
|
4314
4316
|
if (sessionName) {
|
|
4315
4317
|
info += `${theme.fg("dim", "Name:")} ${sessionName}\n`;
|
|
@@ -4552,7 +4554,7 @@ export class InteractiveMode {
|
|
|
4552
4554
|
type: "user_bash",
|
|
4553
4555
|
command,
|
|
4554
4556
|
excludeFromContext,
|
|
4555
|
-
cwd: this.
|
|
4557
|
+
cwd: this.activeSession.getCwd(),
|
|
4556
4558
|
});
|
|
4557
4559
|
// If extension returned a full result, use it directly
|
|
4558
4560
|
if (eventResult?.result) {
|
|
@@ -4611,7 +4613,7 @@ export class InteractiveMode {
|
|
|
4611
4613
|
this.ui.requestRender();
|
|
4612
4614
|
}
|
|
4613
4615
|
async handleCompactCommand(customInstructions) {
|
|
4614
|
-
const entries = this.
|
|
4616
|
+
const entries = this.activeSession.getEntries();
|
|
4615
4617
|
const messageCount = entries.filter((e) => e.type === "message").length;
|
|
4616
4618
|
if (messageCount < 2) {
|
|
4617
4619
|
this.showWarning("Nothing to compact (no messages yet)");
|