@tshu-w/pi-agents 0.2.2 → 0.4.0
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 +84 -0
- package/README.md +2 -1
- package/bin/pd.mjs +23 -3
- package/docs/HOSTS.md +2 -0
- package/docs/PROGRAM.md +17 -28
- package/docs/SPEC.md +28 -39
- package/package.json +3 -2
- package/src/agents/agents.ts +126 -82
- package/src/agents/registry.ts +69 -17
- package/src/agents/tool.ts +31 -87
- package/src/host/client.mjs +38 -5
- package/src/index.ts +7 -4
- package/src/main-agent.md +6 -0
- package/src/main-agent.ts +47 -0
- package/src/output.ts +0 -18
- package/src/programs/execute.ts +25 -5
- package/src/programs/loadout.ts +14 -19
- package/src/programs/programs.ts +39 -115
- package/src/programs/scope.ts +1 -1
- package/src/programs/tool.ts +16 -12
- package/src/roots/guard.mjs +5 -0
- package/src/roots/paths.mjs +1 -0
- package/src/ui/message.ts +41 -7
- package/src/ui/panel.ts +25 -40
- package/src/ui/viewer.ts +278 -152
- package/src/workbench.mjs +10 -6
package/src/workbench.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { join } from 'node:path';
|
|
|
8
8
|
import { pathToFileURL } from 'node:url';
|
|
9
9
|
import { styleText } from 'node:util';
|
|
10
10
|
import { setTimeout as delay } from 'node:timers/promises';
|
|
11
|
-
import { alive, attach, listHosts, settledHosts, startHost } from './host/client.mjs';
|
|
11
|
+
import { alive, attach, drain, listHosts, settledHosts, startHost } from './host/client.mjs';
|
|
12
12
|
import { detachKey, detachMatcher } from './host/keys.mjs';
|
|
13
13
|
import { piPackage } from './pi.mjs';
|
|
14
14
|
import { ensureDaemon, sendViaDaemon } from './daemon/client.mjs';
|
|
@@ -351,7 +351,8 @@ export async function workbench({ pi: executable, paths, sessionDir }) {
|
|
|
351
351
|
async function attachTo(socket) {
|
|
352
352
|
ui.stop();
|
|
353
353
|
let result;
|
|
354
|
-
|
|
354
|
+
// The list reads the terminal again at once, and skips late key releases itself.
|
|
355
|
+
try { result = await attach(socket, { isDetach, drainInput: false }); }
|
|
355
356
|
finally {
|
|
356
357
|
process.stdout.write(ALT_SCREEN);
|
|
357
358
|
ui.start();
|
|
@@ -551,9 +552,8 @@ export async function workbench({ pi: executable, paths, sessionDir }) {
|
|
|
551
552
|
fold();
|
|
552
553
|
summarize('branch summary');
|
|
553
554
|
} else if (message.role === 'custom') {
|
|
554
|
-
const from = message.customType === 'pi-agents' ? message.details?.sender?.name ?? message.details?.sender?.id : undefined;
|
|
555
555
|
fold();
|
|
556
|
-
summarize(
|
|
556
|
+
summarize(`${message.customType} message`);
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
fold();
|
|
@@ -623,10 +623,14 @@ export async function workbench({ pi: executable, paths, sessionDir }) {
|
|
|
623
623
|
if (quitting) return;
|
|
624
624
|
quitting = true;
|
|
625
625
|
stream?.close();
|
|
626
|
-
// Late key releases would otherwise leak into the shell, as Pi avoids on exit.
|
|
627
626
|
themeSync.disableAutoSync();
|
|
628
|
-
await terminal.drainInput(1000);
|
|
629
627
|
ui.stop();
|
|
628
|
+
// Late key releases would otherwise leak into the shell, as when detaching from a Session.
|
|
629
|
+
process.stdin.setRawMode(true);
|
|
630
|
+
process.stdin.resume();
|
|
631
|
+
await drain(process.stdin, process.stdout);
|
|
632
|
+
process.stdin.setRawMode(false);
|
|
633
|
+
process.stdin.pause();
|
|
630
634
|
process.stdout.write(`${MAIN_SCREEN}${styleText('dim', 'Sessions keep running. To reopen:')} pd agents\n`);
|
|
631
635
|
finish();
|
|
632
636
|
}
|