pi-ui-extend 0.1.34 → 0.1.36
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/README.md +20 -0
- package/dist/app/app.d.ts +1 -0
- package/dist/app/app.js +12 -2
- package/dist/app/commands/command-host.d.ts +1 -0
- package/dist/app/commands/command-model-actions.d.ts +1 -0
- package/dist/app/commands/command-model-actions.js +32 -0
- package/dist/app/commands/command-navigation-actions.js +3 -0
- package/dist/app/commands/command-session-actions.js +2 -0
- package/dist/app/constants.d.ts +2 -1
- package/dist/app/constants.js +6 -1
- package/dist/app/extensions/extension-actions-controller.d.ts +1 -0
- package/dist/app/extensions/extension-actions-controller.js +4 -0
- package/dist/app/input/input-controller.d.ts +5 -1
- package/dist/app/input/input-controller.js +122 -16
- package/dist/app/input/input-paste-handler.js +3 -1
- package/dist/app/input/terminal-edit-shortcuts.d.ts +21 -0
- package/dist/app/input/terminal-edit-shortcuts.js +92 -16
- package/dist/app/popup/popup-action-controller.d.ts +1 -0
- package/dist/app/popup/popup-action-controller.js +1 -0
- package/dist/app/rendering/conversation-entry-renderer.d.ts +1 -0
- package/dist/app/rendering/conversation-entry-renderer.js +1 -1
- package/dist/app/rendering/conversation-tool-renderer.d.ts +1 -0
- package/dist/app/rendering/conversation-tool-renderer.js +21 -0
- package/dist/app/rendering/conversation-viewport.d.ts +3 -0
- package/dist/app/rendering/conversation-viewport.js +41 -5
- package/dist/app/rendering/editor-layout-renderer.js +3 -2
- package/dist/app/rendering/editor-panels.js +27 -10
- package/dist/app/runtime.d.ts +1 -0
- package/dist/app/runtime.js +33 -14
- package/dist/app/session/session-event-controller.d.ts +7 -0
- package/dist/app/session/session-event-controller.js +78 -0
- package/dist/app/session/session-lifecycle-controller.d.ts +1 -0
- package/dist/app/session/session-lifecycle-controller.js +7 -0
- package/dist/app/session/tabs-controller.d.ts +1 -0
- package/dist/app/session/tabs-controller.js +4 -1
- package/dist/app/subagents/subagents-widget-controller.d.ts +10 -2
- package/dist/app/subagents/subagents-widget-controller.js +141 -70
- package/dist/app/terminal/terminal-controller.d.ts +10 -0
- package/dist/app/terminal/terminal-controller.js +91 -2
- package/dist/app/todo/todo-model.js +2 -0
- package/dist/app/todo/todo-widget-controller.d.ts +2 -0
- package/dist/app/todo/todo-widget-controller.js +17 -7
- package/dist/app/types.d.ts +4 -0
- package/dist/app/workspace/workspace-actions-controller.d.ts +1 -0
- package/dist/app/workspace/workspace-actions-controller.js +1 -0
- package/dist/bundled-extensions/question/tui.js +8 -1
- package/dist/bundled-extensions/session-title/index.js +65 -14
- package/dist/input-editor-files.js +23 -4
- package/dist/markdown-format.d.ts +4 -1
- package/dist/markdown-format.js +76 -9
- package/external/pi-tools-suite/README.md +71 -1
- package/external/pi-tools-suite/package.json +5 -5
- package/external/pi-tools-suite/src/async-subagents/commands.ts +12 -6
- package/external/pi-tools-suite/src/async-subagents/index.ts +133 -37
- package/external/pi-tools-suite/src/context-usage.ts +6 -1
- package/external/pi-tools-suite/src/dcp/commands.ts +3 -2
- package/external/pi-tools-suite/src/dcp/compress-tool.ts +9 -4
- package/external/pi-tools-suite/src/dcp/config.ts +142 -6
- package/external/pi-tools-suite/src/dcp/index.ts +20 -8
- package/external/pi-tools-suite/src/dcp/prompts.ts +17 -9
- package/external/pi-tools-suite/src/dcp/pruner-candidates.ts +59 -15
- package/external/pi-tools-suite/src/dcp/pruner-metadata.ts +6 -8
- package/external/pi-tools-suite/src/dcp/pruner-nudge.ts +3 -3
- package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +51 -1
- package/external/pi-tools-suite/src/glm-coding-discipline/index.ts +16 -11
- package/external/pi-tools-suite/src/model-tools/index.ts +24 -12
- package/external/pi-tools-suite/src/prompt-commands/index.ts +11 -2
- package/external/pi-tools-suite/src/telegram-mirror/index.ts +66 -27
- package/external/pi-tools-suite/src/todo/index.ts +87 -16
- package/external/pi-tools-suite/src/todo/state/store.ts +41 -10
- package/external/pi-tools-suite/src/todo/todo.ts +49 -6
- package/external/pi-tools-suite/src/tool-descriptions.ts +4 -4
- package/package.json +7 -5
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
16
|
+
import { resolve } from "node:path";
|
|
16
17
|
import { TODO_TOOL_DESCRIPTION } from "../tool-descriptions.js";
|
|
17
18
|
import {
|
|
18
19
|
disablePersistence,
|
|
@@ -25,7 +26,7 @@ import { AUTO_CLEAR_COMPLETED_MESSAGE, autoClearCompletedTodos } from "./state/a
|
|
|
25
26
|
import { replayFromBranch } from "./state/replay.js";
|
|
26
27
|
import { isTaskBlocked, selectTasksByStatus, selectTodoCounts } from "./state/selectors.js";
|
|
27
28
|
import { applyTaskMutation } from "./state/state-reducer.js";
|
|
28
|
-
import { commitState, getState, replaceState } from "./state/store.js";
|
|
29
|
+
import { activateStateScope, commitState, getState, replaceState } from "./state/store.js";
|
|
29
30
|
import { buildToolResult, formatContent } from "./tool/response-envelope.js";
|
|
30
31
|
import {
|
|
31
32
|
COMMAND_NAME,
|
|
@@ -75,7 +76,16 @@ const PERSIST_ARGUMENT_COMPLETIONS: CommandCompletion[] = [
|
|
|
75
76
|
];
|
|
76
77
|
|
|
77
78
|
interface TodoToolHooks {
|
|
78
|
-
|
|
79
|
+
prepareMutation?: (
|
|
80
|
+
state: ReturnType<typeof getState>,
|
|
81
|
+
ctx: ExtensionContext,
|
|
82
|
+
info: { action: TaskAction; params: TaskMutationParams },
|
|
83
|
+
) => TaskMutationParams | Promise<TaskMutationParams>;
|
|
84
|
+
afterCommit?: (
|
|
85
|
+
state: ReturnType<typeof getState>,
|
|
86
|
+
ctx: ExtensionContext,
|
|
87
|
+
info: { action: TaskAction; params: TaskMutationParams; committedState: ReturnType<typeof getState> },
|
|
88
|
+
) => void | Promise<void>;
|
|
79
89
|
}
|
|
80
90
|
|
|
81
91
|
interface TodoToolRegistrationOptions extends TodoToolHooks {
|
|
@@ -83,7 +93,7 @@ interface TodoToolRegistrationOptions extends TodoToolHooks {
|
|
|
83
93
|
promptGuidelines?: string[];
|
|
84
94
|
}
|
|
85
95
|
|
|
86
|
-
type TodoStateEventContext = { sessionManager?: { getSessionFile?: () => unknown } };
|
|
96
|
+
type TodoStateEventContext = { sessionManager?: { getSessionFile?: () => unknown; getSessionId?: () => unknown } };
|
|
87
97
|
type TodoStateEventEmitter = { events?: { emit?: (channel: string, data: unknown) => void } };
|
|
88
98
|
|
|
89
99
|
interface TodosCommandOptions {
|
|
@@ -183,14 +193,34 @@ function sessionFileFromContext(ctx: unknown): string | undefined {
|
|
|
183
193
|
return typeof sessionFile === "string" && sessionFile.trim() ? sessionFile : undefined;
|
|
184
194
|
}
|
|
185
195
|
|
|
196
|
+
function sessionIdFromContext(ctx: unknown): string | undefined {
|
|
197
|
+
const sessionId = (ctx as TodoStateEventContext | undefined)?.sessionManager?.getSessionId?.();
|
|
198
|
+
return typeof sessionId === "string" && sessionId.trim() ? sessionId : undefined;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function todoStateScopeFromContext(ctx: unknown): string | undefined {
|
|
202
|
+
const sessionFile = sessionFileFromContext(ctx);
|
|
203
|
+
if (sessionFile) return `file:${resolve(sessionFile)}`;
|
|
204
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
205
|
+
if (sessionId) return `id:${sessionId}`;
|
|
206
|
+
const cwd = (ctx as { cwd?: unknown } | undefined)?.cwd;
|
|
207
|
+
return typeof cwd === "string" && cwd.trim() ? `cwd:${resolve(cwd)}` : undefined;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function activateTodoStateScope(ctx: unknown): void {
|
|
211
|
+
activateStateScope(todoStateScopeFromContext(ctx));
|
|
212
|
+
}
|
|
213
|
+
|
|
186
214
|
export function publishTodoState(
|
|
187
215
|
pi: TodoStateEventEmitter,
|
|
188
216
|
ctx: unknown,
|
|
189
217
|
action: TaskAction = "list",
|
|
190
218
|
params: Record<string, unknown> = {},
|
|
191
219
|
): void {
|
|
220
|
+
activateTodoStateScope(ctx);
|
|
192
221
|
const state = getState();
|
|
193
222
|
const sessionFile = sessionFileFromContext(ctx);
|
|
223
|
+
const sessionId = sessionIdFromContext(ctx);
|
|
194
224
|
pi.events?.emit?.(TODO_STATE_EVENT, {
|
|
195
225
|
version: 1,
|
|
196
226
|
details: {
|
|
@@ -200,6 +230,7 @@ export function publishTodoState(
|
|
|
200
230
|
nextId: state.nextId,
|
|
201
231
|
},
|
|
202
232
|
...(sessionFile ? { sessionFile } : {}),
|
|
233
|
+
...(sessionId ? { sessionId } : {}),
|
|
203
234
|
checkedAt: Date.now(),
|
|
204
235
|
});
|
|
205
236
|
}
|
|
@@ -363,15 +394,24 @@ export function registerTodoTool(pi: ExtensionAPI, hooks: TodoToolRegistrationOp
|
|
|
363
394
|
parameters: TodoParamsSchema,
|
|
364
395
|
|
|
365
396
|
async execute(_toolCallId, params, _signal, _onUpdate, _ctx) {
|
|
366
|
-
|
|
397
|
+
activateTodoStateScope(_ctx);
|
|
398
|
+
const preparedParams = await hooks.prepareMutation?.(getState(), _ctx as ExtensionContext, {
|
|
399
|
+
action: params.action,
|
|
400
|
+
params: params as TaskMutationParams,
|
|
401
|
+
}) ?? params as TaskMutationParams;
|
|
402
|
+
const result = applyTaskMutation(getState(), params.action, preparedParams);
|
|
367
403
|
if (result.op.kind === "error") {
|
|
368
404
|
throw new Error(result.op.message);
|
|
369
405
|
}
|
|
370
406
|
const autoClear = autoClearCompletedTodos(result.state);
|
|
371
407
|
commitState(autoClear.state);
|
|
372
408
|
publishTodoState(pi as TodoStateEventEmitter, _ctx, params.action, params as Record<string, unknown>);
|
|
373
|
-
await hooks.afterCommit?.(
|
|
374
|
-
|
|
409
|
+
await hooks.afterCommit?.(result.state, _ctx as ExtensionContext, {
|
|
410
|
+
action: params.action,
|
|
411
|
+
params: preparedParams,
|
|
412
|
+
committedState: autoClear.state,
|
|
413
|
+
});
|
|
414
|
+
const toolResult = buildToolResult(params.action, preparedParams, autoClear.state, result.op);
|
|
375
415
|
if (!autoClear.cleared) return toolResult;
|
|
376
416
|
return {
|
|
377
417
|
...toolResult,
|
|
@@ -391,6 +431,7 @@ export function registerTodosCommand(pi: ExtensionAPI): void {
|
|
|
391
431
|
description: "Show todos on the current branch. Flags: --active, --ready, --blocked, --tree, --status <status>, --export [json|markdown]. Commands: persist on|off|clear|status, scope <id...>",
|
|
392
432
|
getArgumentCompletions: (prefix) => completeCommandArguments(String(prefix ?? ""), TODOS_ARGUMENT_COMPLETIONS),
|
|
393
433
|
handler: async (args, ctx) => {
|
|
434
|
+
activateTodoStateScope(ctx);
|
|
394
435
|
if (handlePersistCommand(args, ctx)) return;
|
|
395
436
|
if (handleScopeCommand(args, ctx, () => publishTodoState(pi as TodoStateEventEmitter, ctx))) return;
|
|
396
437
|
if (!ctx.hasUI) {
|
|
@@ -459,6 +500,7 @@ export function registerTodosCommand(pi: ExtensionAPI): void {
|
|
|
459
500
|
description: "Enable, disable, clear, or inspect project todo persistence. Args: on|off|clear|status.",
|
|
460
501
|
getArgumentCompletions: (prefix) => completeCommandArguments(String(prefix ?? ""), PERSIST_ARGUMENT_COMPLETIONS),
|
|
461
502
|
handler: async (args, ctx) => {
|
|
503
|
+
activateTodoStateScope(ctx);
|
|
462
504
|
handlePersistCommand(`persist ${getCommandText(args)}`, ctx);
|
|
463
505
|
},
|
|
464
506
|
});
|
|
@@ -466,6 +508,7 @@ export function registerTodosCommand(pi: ExtensionAPI): void {
|
|
|
466
508
|
pi.registerCommand(SCOPE_COMMAND_NAME, {
|
|
467
509
|
description: "Select todo ids to continue from a persisted plan; pending/in_progress items outside the scope become deferred.",
|
|
468
510
|
handler: async (args, ctx) => {
|
|
511
|
+
activateTodoStateScope(ctx);
|
|
469
512
|
handleScopeCommand(`scope ${getCommandText(args)}`, ctx, () => publishTodoState(pi as TodoStateEventEmitter, ctx));
|
|
470
513
|
},
|
|
471
514
|
});
|
|
@@ -27,10 +27,10 @@ export const COMPRESS_TOOL_DESCRIPTION: ToolDescription = {
|
|
|
27
27
|
name: "compress",
|
|
28
28
|
label: "Compress Context",
|
|
29
29
|
description: COMPRESS_RANGE_DESCRIPTION,
|
|
30
|
-
promptSnippet: "Compress closed conversation slices as steady context housekeeping;
|
|
30
|
+
promptSnippet: "Compress closed conversation slices as steady context housekeeping; before any new search/read/test/web lookup, compress older completed work unless exact raw text is still needed.",
|
|
31
31
|
promptGuidelines: [
|
|
32
|
-
"Treat completed implementation
|
|
33
|
-
"Do not carry large stale
|
|
32
|
+
"Treat completed implementation, verification, config/doc edits, answered exploration, dead ends, and log inspection as compression candidates immediately.",
|
|
33
|
+
"Do not carry large stale shell/read/repo/web outputs, diffs, or passing logs across task boundaries; summarize their actionable result instead.",
|
|
34
34
|
"Keep active, still-needed context raw; compress only closed ranges whose exact content is unlikely to be needed next.",
|
|
35
35
|
],
|
|
36
36
|
};
|
|
@@ -329,7 +329,7 @@ export const CODEX_ALIAS_TOOL_DESCRIPTIONS = {
|
|
|
329
329
|
shellCommand: {
|
|
330
330
|
name: "shell",
|
|
331
331
|
label: "shell",
|
|
332
|
-
description: "Run shell commands for builds, tests, package managers, git, and project CLIs.
|
|
332
|
+
description: "Run shell commands for builds, tests, package managers, git, and project CLIs. For long/verification output, redirect to a log and show only bounded tail on failure; summarize passing logs. Set workdir/cwd instead of cd; prefer read for simple file reads.",
|
|
333
333
|
},
|
|
334
334
|
applyPatch: {
|
|
335
335
|
name: "apply_patch",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-ui-extend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.36",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -43,12 +43,14 @@
|
|
|
43
43
|
"watch:pix": "npm run link:pix --silent && mise exec node@24.16.0 -- tsc -p tsconfig.json --watch --preserveWatchOutput --noEmitOnError",
|
|
44
44
|
"check": "mise exec node@24.16.0 -- npm run check:inner",
|
|
45
45
|
"precheck:inner": "npm run generate-schemas --silent",
|
|
46
|
-
"check:inner": "tsc --noEmit && npm run test:inner",
|
|
46
|
+
"check:inner": "npm run sync:sdk-pin:check --silent && tsc --noEmit && npm run test:inner",
|
|
47
47
|
"test": "mise exec node@24.16.0 -- npm run test:inner",
|
|
48
48
|
"test:inner": "node --import tsx --test \"tests/**/*.test.ts\"",
|
|
49
49
|
"test:tools-suite": "npm --prefix external/pi-tools-suite test",
|
|
50
50
|
"sync:pi-tools-suite": "node scripts/sync-pi-tools-suite.mjs",
|
|
51
51
|
"sync:pi-tools-suite:check": "node scripts/sync-pi-tools-suite.mjs --check",
|
|
52
|
+
"sync:sdk-pin": "node scripts/sync-sdk-pin.mjs",
|
|
53
|
+
"sync:sdk-pin:check": "node scripts/sync-sdk-pin.mjs --check",
|
|
52
54
|
"test:coverage": "mise exec node@24.16.0 -- node --import tsx --test --experimental-test-coverage --test-coverage-include=src/**/*.ts --test-coverage-exclude=src/main.ts --test-coverage-lines=95 --test-coverage-branches=80 --test-coverage-functions=95 \"tests/**/*.test.ts\"",
|
|
53
55
|
"update-sdk-references": "mise exec node@24.16.0 -- node .pi/skills/pi-sdk/scripts/update-references.mjs",
|
|
54
56
|
"prepack": "npm run generate-schemas --silent",
|
|
@@ -62,9 +64,9 @@
|
|
|
62
64
|
"prepublishOnly": "npm run check && npm run build:pix && npm run generate-schemas"
|
|
63
65
|
},
|
|
64
66
|
"dependencies": {
|
|
65
|
-
"@earendil-works/pi-ai": "0.79.
|
|
66
|
-
"@earendil-works/pi-coding-agent": "0.79.
|
|
67
|
-
"@earendil-works/pi-tui": "0.79.
|
|
67
|
+
"@earendil-works/pi-ai": "0.79.4",
|
|
68
|
+
"@earendil-works/pi-coding-agent": "0.79.4",
|
|
69
|
+
"@earendil-works/pi-tui": "0.79.4",
|
|
68
70
|
"@mariozechner/clipboard": "^0.3.9",
|
|
69
71
|
"jsonc-parser": "3.3.1",
|
|
70
72
|
"typebox": "1.1.38",
|