@oh-my-pi/pi-coding-agent 16.2.2 → 16.2.3
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 +49 -0
- package/dist/cli.js +3624 -3568
- package/dist/types/advisor/__tests__/config.test.d.ts +1 -0
- package/dist/types/advisor/advise-tool.d.ts +8 -4
- package/dist/types/advisor/config.d.ts +88 -0
- package/dist/types/advisor/index.d.ts +1 -0
- package/dist/types/advisor/transcript-recorder.d.ts +13 -2
- package/dist/types/advisor/watchdog.d.ts +20 -0
- package/dist/types/collab/guest.d.ts +29 -0
- package/dist/types/config/settings-schema.d.ts +81 -0
- package/dist/types/debug/log-viewer.d.ts +1 -0
- package/dist/types/debug/raw-sse.d.ts +1 -0
- package/dist/types/edit/hashline/diff.d.ts +0 -11
- package/dist/types/extensibility/tool-event-input.d.ts +7 -0
- package/dist/types/extensibility/utils.d.ts +12 -0
- package/dist/types/mcp/transports/index.d.ts +1 -0
- package/dist/types/mcp/transports/sse.d.ts +20 -0
- package/dist/types/modes/components/advisor-config.d.ts +59 -0
- package/dist/types/modes/components/index.d.ts +1 -0
- package/dist/types/modes/components/model-selector.d.ts +9 -1
- package/dist/types/modes/components/settings-selector.d.ts +1 -0
- package/dist/types/modes/components/status-line/component.d.ts +30 -1
- package/dist/types/modes/components/status-line/types.d.ts +13 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +10 -4
- package/dist/types/modes/skill-command.d.ts +32 -0
- package/dist/types/modes/types.d.ts +7 -2
- package/dist/types/session/agent-session.d.ts +58 -10
- package/dist/types/session/indexed-session-storage.d.ts +7 -1
- package/dist/types/session/messages.d.ts +26 -0
- package/dist/types/session/messages.test.d.ts +1 -0
- package/dist/types/session/session-entries.d.ts +31 -3
- package/dist/types/session/session-history-format.d.ts +6 -0
- package/dist/types/session/session-loader.d.ts +9 -1
- package/dist/types/session/session-manager.d.ts +6 -4
- package/dist/types/session/session-storage.d.ts +11 -0
- package/dist/types/session/session-title-slot.d.ts +19 -0
- package/dist/types/ssh/connection-manager.d.ts +47 -0
- package/dist/types/ssh/utils.d.ts +16 -0
- package/dist/types/task/executor.d.ts +3 -16
- package/dist/types/task/render.d.ts +0 -5
- package/dist/types/task/renderer.d.ts +13 -0
- package/dist/types/task/types.d.ts +16 -0
- package/dist/types/task/yield-assembly.d.ts +28 -0
- package/dist/types/tiny/text.d.ts +8 -0
- package/dist/types/tools/render-utils.d.ts +2 -0
- package/dist/types/tools/review.d.ts +6 -4
- package/dist/types/tools/ssh.d.ts +1 -1
- package/dist/types/tools/todo.d.ts +6 -0
- package/dist/types/tools/yield.d.ts +8 -3
- package/dist/types/utils/thinking-display.d.ts +4 -0
- package/package.json +12 -12
- package/src/advisor/__tests__/advisor.test.ts +242 -10
- package/src/advisor/__tests__/config.test.ts +173 -0
- package/src/advisor/advise-tool.ts +11 -6
- package/src/advisor/config.ts +256 -0
- package/src/advisor/index.ts +1 -0
- package/src/advisor/runtime.ts +12 -2
- package/src/advisor/transcript-recorder.ts +25 -2
- package/src/advisor/watchdog.ts +57 -31
- package/src/autoresearch/index.ts +7 -2
- package/src/cli/gc-cli.ts +17 -10
- package/src/collab/guest.ts +43 -7
- package/src/config/model-registry.ts +80 -18
- package/src/config/settings-schema.ts +77 -0
- package/src/debug/index.ts +32 -7
- package/src/debug/log-viewer.ts +111 -53
- package/src/debug/raw-sse.ts +68 -48
- package/src/discovery/codex.ts +13 -5
- package/src/edit/hashline/diff.ts +57 -4
- package/src/eval/js/shared/local-module-loader.ts +23 -1
- package/src/export/html/template.js +13 -7
- package/src/extensibility/extensions/loader.ts +5 -3
- package/src/extensibility/extensions/wrapper.ts +9 -3
- package/src/extensibility/hooks/loader.ts +3 -3
- package/src/extensibility/hooks/tool-wrapper.ts +13 -4
- package/src/extensibility/plugins/manager.ts +2 -1
- package/src/extensibility/tool-event-input.ts +23 -0
- package/src/extensibility/utils.ts +74 -0
- package/src/internal-urls/docs-index.generated.txt +1 -1
- package/src/mcp/client.ts +3 -1
- package/src/mcp/manager.ts +12 -5
- package/src/mcp/transports/index.ts +1 -0
- package/src/mcp/transports/sse.ts +377 -0
- package/src/memories/index.ts +15 -6
- package/src/modes/components/advisor-config.ts +555 -0
- package/src/modes/components/advisor-message.ts +9 -2
- package/src/modes/components/agent-hub.ts +9 -4
- package/src/modes/components/index.ts +2 -0
- package/src/modes/components/model-selector.ts +79 -48
- package/src/modes/components/settings-selector.ts +1 -0
- package/src/modes/components/status-line/component.ts +144 -5
- package/src/modes/components/status-line/segments.ts +46 -21
- package/src/modes/components/status-line/types.ts +13 -1
- package/src/modes/components/tool-execution.ts +47 -6
- package/src/modes/controllers/command-controller.ts +23 -2
- package/src/modes/controllers/event-controller.ts +106 -0
- package/src/modes/controllers/extension-ui-controller.ts +1 -1
- package/src/modes/controllers/input-controller.ts +61 -61
- package/src/modes/controllers/selector-controller.ts +100 -9
- package/src/modes/interactive-mode.ts +65 -5
- package/src/modes/skill-command.ts +116 -0
- package/src/modes/types.ts +7 -2
- package/src/modes/utils/ui-helpers.ts +41 -23
- package/src/prompts/agents/reviewer.md +11 -10
- package/src/prompts/review-custom-request.md +1 -2
- package/src/prompts/review-request.md +1 -2
- package/src/prompts/system/interrupted-thinking.md +7 -0
- package/src/prompts/system/recap-user.md +9 -0
- package/src/prompts/system/subagent-system-prompt.md +8 -5
- package/src/prompts/system/subagent-yield-reminder.md +6 -5
- package/src/prompts/system/system-prompt.md +0 -1
- package/src/prompts/tools/irc.md +2 -2
- package/src/prompts/tools/read.md +2 -2
- package/src/sdk.ts +28 -24
- package/src/session/agent-session.ts +867 -428
- package/src/session/indexed-session-storage.ts +86 -13
- package/src/session/messages.test.ts +125 -0
- package/src/session/messages.ts +172 -9
- package/src/session/redis-session-storage.ts +49 -2
- package/src/session/session-entries.ts +39 -2
- package/src/session/session-history-format.ts +29 -2
- package/src/session/session-listing.ts +54 -24
- package/src/session/session-loader.ts +66 -3
- package/src/session/session-manager.ts +113 -19
- package/src/session/session-persistence.ts +95 -1
- package/src/session/session-storage.ts +36 -0
- package/src/session/session-title-slot.ts +141 -0
- package/src/session/sql-session-storage.ts +71 -11
- package/src/slash-commands/builtin-registry.ts +16 -3
- package/src/ssh/__tests__/connection-manager-args.test.ts +123 -1
- package/src/ssh/__tests__/file-transfer-posix-guard.test.ts +55 -18
- package/src/ssh/connection-manager.ts +139 -12
- package/src/ssh/file-transfer.ts +23 -18
- package/src/ssh/ssh-executor.ts +2 -13
- package/src/ssh/utils.ts +19 -0
- package/src/task/executor.ts +21 -23
- package/src/task/render.ts +162 -20
- package/src/task/renderer.ts +14 -0
- package/src/task/types.ts +17 -0
- package/src/task/yield-assembly.ts +207 -0
- package/src/tiny/text.ts +23 -0
- package/src/tools/ask.ts +55 -4
- package/src/tools/render-utils.ts +2 -0
- package/src/tools/renderers.ts +8 -2
- package/src/tools/review.ts +17 -7
- package/src/tools/ssh.ts +8 -4
- package/src/tools/todo.ts +17 -1
- package/src/tools/yield.ts +140 -31
- package/src/utils/thinking-display.ts +15 -0
package/src/sdk.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { Component } from "@oh-my-pi/pi-tui";
|
|
|
19
19
|
import { $env, $flag, getAgentDir, getProjectDir, logger, postmortem, prompt, Snowflake } from "@oh-my-pi/pi-utils";
|
|
20
20
|
import { INTENT_FIELD } from "@oh-my-pi/pi-wire";
|
|
21
21
|
import {
|
|
22
|
-
|
|
22
|
+
discoverAdvisorConfigs,
|
|
23
23
|
discoverWatchdogFiles,
|
|
24
24
|
formatActiveRepoWatchdogPrompt,
|
|
25
25
|
formatAdvisorContextPrompt,
|
|
@@ -1158,6 +1158,8 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1158
1158
|
activeRepoContextPromise.catch(() => {});
|
|
1159
1159
|
const watchdogFilesPromise = logger.time("discoverWatchdogFiles", () => discoverWatchdogFiles(cwd, agentDir));
|
|
1160
1160
|
watchdogFilesPromise.catch(() => {});
|
|
1161
|
+
const advisorConfigsPromise = logger.time("discoverAdvisorConfigs", () => discoverAdvisorConfigs(cwd, agentDir));
|
|
1162
|
+
advisorConfigsPromise.catch(() => {});
|
|
1161
1163
|
const promptTemplatesPromise = options.promptTemplates
|
|
1162
1164
|
? Promise.resolve(options.promptTemplates)
|
|
1163
1165
|
: logger.time("discoverPromptTemplates", discoverPromptTemplates, cwd, agentDir);
|
|
@@ -1403,12 +1405,14 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
1403
1405
|
}
|
|
1404
1406
|
return result;
|
|
1405
1407
|
};
|
|
1406
|
-
const [contextFiles, resolvedWorkspaceTree, watchdogFiles, activeRepoContext] =
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1408
|
+
const [contextFiles, resolvedWorkspaceTree, watchdogFiles, activeRepoContext, discoveredAdvisors] =
|
|
1409
|
+
await Promise.all([
|
|
1410
|
+
contextFilesPromise,
|
|
1411
|
+
raceWithDeadline("buildWorkspaceTree", workspaceTreePromise),
|
|
1412
|
+
watchdogFilesPromise,
|
|
1413
|
+
activeRepoContextPromise,
|
|
1414
|
+
advisorConfigsPromise,
|
|
1415
|
+
]);
|
|
1412
1416
|
|
|
1413
1417
|
let agent: Agent;
|
|
1414
1418
|
let session!: AgentSession;
|
|
@@ -2633,34 +2637,32 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2633
2637
|
}
|
|
2634
2638
|
}
|
|
2635
2639
|
|
|
2636
|
-
//
|
|
2637
|
-
//
|
|
2638
|
-
//
|
|
2639
|
-
//
|
|
2640
|
-
//
|
|
2640
|
+
// Full toolset for the advisor, built unconditionally so it can be toggled at
|
|
2641
|
+
// runtime. Bound to a DISTINCT ToolSession (its own `-advisor` session id +
|
|
2642
|
+
// agent id) so the advisor's tool state — snapshot, seen-lines, conflict, and
|
|
2643
|
+
// summary caches, all keyed on session identity — stays isolated from the
|
|
2644
|
+
// primary, while edit/bash/write stay fully functional: the advisor is a full
|
|
2645
|
+
// agent and its config's `tools` selects which of these it actually gets
|
|
2646
|
+
// (defaulting to read/grep/glob).
|
|
2641
2647
|
const advisorToolSession: ToolSession = {
|
|
2642
2648
|
...toolSession,
|
|
2643
2649
|
get cwd() {
|
|
2644
2650
|
return sessionManager.getCwd();
|
|
2645
2651
|
},
|
|
2646
|
-
hasEditTool:
|
|
2652
|
+
hasEditTool: true,
|
|
2647
2653
|
requireYieldTool: false,
|
|
2648
|
-
conflictHistory: undefined,
|
|
2649
|
-
fileSnapshotStore: undefined,
|
|
2650
2654
|
getSessionId: () => {
|
|
2651
2655
|
const id = sessionManager.getSessionId?.();
|
|
2652
2656
|
return id ? `${id}-advisor` : null;
|
|
2653
2657
|
},
|
|
2654
2658
|
getAgentId: () => "advisor",
|
|
2655
2659
|
};
|
|
2656
|
-
const
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
);
|
|
2661
|
-
const
|
|
2662
|
-
.filter((tool): tool is Tool => tool != null)
|
|
2663
|
-
.map(wrapToolWithMetaNotice);
|
|
2660
|
+
const advisorToolBuilds: Array<Tool | null | Promise<Tool | null>> = [];
|
|
2661
|
+
for (const name in BUILTIN_TOOLS) {
|
|
2662
|
+
advisorToolBuilds.push(BUILTIN_TOOLS[name as keyof typeof BUILTIN_TOOLS](advisorToolSession));
|
|
2663
|
+
}
|
|
2664
|
+
const built = await Promise.all(advisorToolBuilds);
|
|
2665
|
+
const advisorTools: Tool[] = built.filter((tool): tool is Tool => tool != null).map(wrapToolWithMetaNotice);
|
|
2664
2666
|
|
|
2665
2667
|
const advisorWatchdogPrompts = [...watchdogFiles];
|
|
2666
2668
|
if (activeRepoContext) {
|
|
@@ -2677,6 +2679,8 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2677
2679
|
session = new AgentSession({
|
|
2678
2680
|
advisorWatchdogPrompt,
|
|
2679
2681
|
advisorContextPrompt,
|
|
2682
|
+
advisorSharedInstructions: discoveredAdvisors.sharedInstructions,
|
|
2683
|
+
advisorConfigs: discoveredAdvisors.advisors,
|
|
2680
2684
|
agent,
|
|
2681
2685
|
pruneToolDescriptions: inlineToolDescriptors,
|
|
2682
2686
|
thinkingLevel: autoThinking ? AUTO_THINKING : effectiveThinkingLevel,
|
|
@@ -2736,7 +2740,7 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|
|
2736
2740
|
agentKind,
|
|
2737
2741
|
providerSessionId: options.providerSessionId,
|
|
2738
2742
|
parentEvalSessionId: options.parentEvalSessionId,
|
|
2739
|
-
|
|
2743
|
+
advisorTools,
|
|
2740
2744
|
});
|
|
2741
2745
|
hasSession = true;
|
|
2742
2746
|
if (asyncJobManager) {
|