fix(daemon): propagate plugin ack payloads and route entries correctly
- CommandAck spreads the plugin payload so sessionId/results reach callers
- /sessions/:sid/entries relays workspace.query{kind:entries} (was session.entries)
- scripts/e2e: daemon -> headless nvim -> real pi prompt -> history, verified end-to-end
This commit is contained in:
1 parent
18e3e0ab4e
commit
2e5d6d5006
5 files changed
+152
-2
No files matched your search
@@ -28,7 +28,7 @@ export interface PluginConnection {
|
||||
command(
|
||||
cmd: { id: string; sessionId?: string; method: string; params?: Record<string, unknown>; clientRequestId?: string },
|
||||
timeoutMs?: number,
|
||||
): Promise<{ seq?: number; disposition?: string }>;
|
||||
): Promise<{ seq?: number; disposition?: string } & Record<string, unknown>>;
|
||||
subscribe(sessionId: string): void;
|
||||
unsubscribe(sessionId: string): void;
|
||||
/** Last snapshot received for a session (render cache, may be undefined). */
|
||||
|
||||
+4
-1
@@ -187,7 +187,10 @@ export function createApp(deps: AppDeps): Hono<Env> {
|
||||
if (before !== undefined) params.before = before;
|
||||
const limit = Number(c.req.query("limit"));
|
||||
if (Number.isFinite(limit) && limit > 0) params.limit = Math.min(500, Math.floor(limit));
|
||||
const ack = await router.relaySessionQuery(c.req.param("sid"), "session.entries", params);
|
||||
const ack = await router.relaySessionQuery(c.req.param("sid"), "workspace.query", {
|
||||
...params,
|
||||
kind: "entries",
|
||||
});
|
||||
return json(200, ack);
|
||||
});
|
||||
|
||||
|
||||
@@ -60,6 +60,8 @@ export interface CommandRequest {
|
||||
export interface CommandAck {
|
||||
seq?: number;
|
||||
disposition?: string;
|
||||
/** Command result fields (the plugin's `ack.payload`), spread for callers. */
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
interface PendingCommand {
|
||||
@@ -355,6 +357,7 @@ export class PluginSocketConnection implements PluginConnection {
|
||||
clearTimeout(pending.timer);
|
||||
const disposition = asString(payload.disposition);
|
||||
pending.resolve({
|
||||
...payload,
|
||||
...(seq === undefined ? {} : { seq }),
|
||||
...(disposition === undefined ? {} : { disposition }),
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user