@oh-my-pi/pi-coding-agent 16.2.2 → 16.2.4
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 +60 -0
- package/dist/cli.js +3682 -3615
- 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/cli/update-cli.d.ts +15 -0
- package/dist/types/collab/guest.d.ts +29 -0
- package/dist/types/collab/replication-shrink.d.ts +39 -0
- package/dist/types/config/provider-globals.d.ts +7 -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/memories/index.d.ts +20 -1
- 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 +35 -1
- package/dist/types/modes/components/status-line/types.d.ts +13 -1
- package/dist/types/modes/controllers/command-controller.d.ts +3 -3
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -0
- package/dist/types/modes/interactive-mode.d.ts +11 -4
- package/dist/types/modes/skill-command.d.ts +32 -0
- package/dist/types/modes/types.d.ts +9 -3
- 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 +8 -7
- 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/autolearn/controller.ts +13 -22
- package/src/autoresearch/index.ts +7 -2
- package/src/cli/gc-cli.ts +17 -10
- package/src/cli/update-cli.ts +254 -0
- package/src/collab/guest.ts +43 -7
- package/src/collab/host.ts +13 -8
- package/src/collab/replication-shrink.ts +111 -0
- package/src/config/model-registry.ts +80 -18
- package/src/config/provider-globals.ts +25 -0
- 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/__tests__/julia-prelude.test.ts +2 -2
- 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 +130 -15
- package/src/memory-backend/local-backend.ts +5 -3
- 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 +150 -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 +27 -36
- package/src/modes/controllers/event-controller.ts +113 -1
- 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 +74 -25
- package/src/modes/skill-command.ts +116 -0
- package/src/modes/types.ts +9 -3
- package/src/modes/utils/ui-helpers.ts +41 -23
- package/src/prompts/agents/reviewer.md +11 -10
- package/src/prompts/goals/goal-todo-context.md +12 -0
- 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 +899 -429
- 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 +115 -22
- 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 +23 -24
- 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/prompts/system/autolearn-nudge.md +0 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reviewer
|
|
3
3
|
description: "Code review specialist for quality/security analysis"
|
|
4
|
-
tools: read, grep, glob, bash, lsp, web_search, ast_grep
|
|
4
|
+
tools: read, grep, glob, bash, lsp, web_search, ast_grep
|
|
5
5
|
spawns: explore
|
|
6
6
|
model: pi/slow
|
|
7
7
|
thinking-level: high
|
|
@@ -22,7 +22,7 @@ output:
|
|
|
22
22
|
optionalProperties:
|
|
23
23
|
findings:
|
|
24
24
|
metadata:
|
|
25
|
-
description:
|
|
25
|
+
description: "Populate via incremental yield sections under type: [\"findings\"]; don't repeat it in a final payload."
|
|
26
26
|
elements:
|
|
27
27
|
properties:
|
|
28
28
|
title:
|
|
@@ -60,8 +60,8 @@ Identify bugs the author would want fixed before merge.
|
|
|
60
60
|
<procedure>
|
|
61
61
|
1. Run `git diff`, `jj diff --git`, or `gh pr diff <number>` to view patch
|
|
62
62
|
2. Read modified files for full context
|
|
63
|
-
3.
|
|
64
|
-
4.
|
|
63
|
+
3. Record each issue with incremental `yield` using `type: ["findings"]`
|
|
64
|
+
4. Record `overall_correctness`, `explanation`, and `confidence` with incremental `yield` sections, then stop so idle finalization assembles the result
|
|
65
65
|
|
|
66
66
|
Bash is read-only: `git diff`, `git log`, `git show`, `jj diff --git`, `gh pr diff`. You NEVER make file edits or trigger builds.
|
|
67
67
|
</procedure>
|
|
@@ -115,7 +115,7 @@ memcpy(buf, data.ptr, data.length);
|
|
|
115
115
|
</example>
|
|
116
116
|
|
|
117
117
|
<output>
|
|
118
|
-
Each `
|
|
118
|
+
Each finding uses incremental `yield` with `type: ["findings"]` and `result.data` containing:
|
|
119
119
|
- `title`: Imperative, ≤80 chars
|
|
120
120
|
- `body`: One paragraph
|
|
121
121
|
- `priority`: 0-3
|
|
@@ -123,11 +123,12 @@ Each `report_finding` requires:
|
|
|
123
123
|
- `file_path`: Path to affected file
|
|
124
124
|
- `line_start`, `line_end`: Range ≤10 lines, must overlap diff
|
|
125
125
|
|
|
126
|
-
|
|
127
|
-
- `
|
|
128
|
-
- `
|
|
129
|
-
- `
|
|
130
|
-
|
|
126
|
+
Verdict fields also use incremental `yield` sections:
|
|
127
|
+
- `type: ["overall_correctness"]` with `"correct"` (no bugs/blockers) or `"incorrect"`
|
|
128
|
+
- `type: ["explanation"]` with a plain-text 1-3 sentence verdict summary
|
|
129
|
+
- `type: ["confidence"]` with a 0.0-1.0 confidence value
|
|
130
|
+
|
|
131
|
+
Do not emit a separate submit tool call or duplicate `findings` in another payload. Once all sections are recorded, stop and let idle finalization assemble the result.
|
|
131
132
|
|
|
132
133
|
You NEVER output JSON or code blocks.
|
|
133
134
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<todo_context>
|
|
2
|
+
Current persisted todo state for this goal follows. Goal continuations do not get a visible user nudge, so treat this as live progress state, not old transcript decoration.
|
|
3
|
+
Before continuing substantial work, compare your next action with these todos. If an item is stale, already finished, or no longer the active pointer, call the `todo` tool first to mark it done or rewrite the list. Do not leave a stale in_progress item while working on later phases.
|
|
4
|
+
|
|
5
|
+
Overall: {{closed}}/{{total}} done, {{open}} open.
|
|
6
|
+
{{#each phases}}
|
|
7
|
+
- {{escapeXml name}}
|
|
8
|
+
{{#each tasks}}
|
|
9
|
+
- [{{status}}] {{escapeXml content}}
|
|
10
|
+
{{/each}}
|
|
11
|
+
{{/each}}
|
|
12
|
+
</todo_context>
|
|
@@ -14,8 +14,7 @@ Create exactly **1 reviewer task**. Its assignment MUST include the custom instr
|
|
|
14
14
|
Reviewer MUST:
|
|
15
15
|
1. Follow the custom instructions below
|
|
16
16
|
2. Read the referenced files or workspace context needed to evaluate them
|
|
17
|
-
3.
|
|
18
|
-
4. Call `yield` with verdict when done
|
|
17
|
+
3. Use incremental `yield` sections for findings and verdict fields; do NOT call a separate finding tool
|
|
19
18
|
|
|
20
19
|
### Custom Instructions
|
|
21
20
|
|
|
@@ -38,8 +38,7 @@ Reviewer MUST:
|
|
|
38
38
|
1. Focus ONLY on assigned files
|
|
39
39
|
2. {{#if skipDiff}}{{diffInstruction}}{{else}}MUST use diff hunks below (NEVER re-run git diff){{/if}}
|
|
40
40
|
3. {{contextInstruction}}
|
|
41
|
-
4.
|
|
42
|
-
5. Call `yield` with verdict when done
|
|
41
|
+
4. Use incremental `yield` sections for findings and verdict fields; do NOT call a separate finding tool
|
|
43
42
|
|
|
44
43
|
{{#if skipDiff}}
|
|
45
44
|
### Diff Previews
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<system-notice type="interrupted-thinking">
|
|
2
|
+
Your previous turn was interrupted while you were thinking.
|
|
3
|
+
- You MUST treat the preserved reasoning as internal continuity context.
|
|
4
|
+
- You MUST continue the user's task from the relevant unfinished point.
|
|
5
|
+
------
|
|
6
|
+
{{reasoning}}
|
|
7
|
+
</system-notice>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<recap>
|
|
2
|
+
The user stepped away and is coming back. Recap in under 40 words, 1-2 plain sentences, no markdown. Lead with the overall goal and current task, then the one next action. Skip root-cause narrative, fix internals, secondary to-dos, and em-dash tangents.
|
|
3
|
+
{{#if goal}}
|
|
4
|
+
Overall goal: {{goal}}
|
|
5
|
+
{{/if}}
|
|
6
|
+
{{#if task}}
|
|
7
|
+
Active task: {{task}}
|
|
8
|
+
{{/if}}
|
|
9
|
+
</recap>
|
|
@@ -50,13 +50,16 @@ Use `irc` only for quick coordination, never long-form content. Address peers by
|
|
|
50
50
|
COMPLETION
|
|
51
51
|
===================================
|
|
52
52
|
|
|
53
|
-
No TODO tracking, no progress updates. Execute
|
|
53
|
+
No TODO tracking, no progress updates. Execute; report results with `yield`.
|
|
54
54
|
|
|
55
|
-
While work remains, you MUST continue with another tool call — investigate, edit, run, verify. Save narrative for
|
|
55
|
+
While work remains, you MUST continue with another tool call — investigate, edit, run, verify. Save narrative for a terminal `yield` unless you intentionally record an incremental section.
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
Yield protocol:
|
|
58
|
+
- Omit `type` for the normal single terminal structured result in `result.data`.
|
|
59
|
+
- Use non-empty `type: string[]` for incremental, non-terminal sections; calls accumulate by section.
|
|
60
|
+
- Use `type: string` for a terminal result; if data is omitted, your last assistant turn becomes the raw final result.
|
|
58
61
|
|
|
59
|
-
This is your only way to return a result.
|
|
62
|
+
This is your only way to return a final result. For structured results, you NEVER put JSON in plain text or substitute a text summary for `result.data`.
|
|
60
63
|
|
|
61
64
|
{{#if outputSchema}}
|
|
62
65
|
Your result MUST match this TypeScript interface:
|
|
@@ -65,7 +68,7 @@ Your result MUST match this TypeScript interface:
|
|
|
65
68
|
```
|
|
66
69
|
{{/if}}
|
|
67
70
|
|
|
68
|
-
Giving up is a last resort. If truly blocked, you MUST
|
|
71
|
+
Giving up is a last resort. If truly blocked, you MUST terminal-yield `result.error` describing what you tried and the exact blocker.
|
|
69
72
|
You NEVER give up due to uncertainty, missing information obtainable via tools or repo context, or needing a design decision you can derive yourself.
|
|
70
73
|
|
|
71
74
|
You MUST keep going until this ticket is closed. This matters.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<system-reminder>
|
|
2
2
|
Your last turn ended without a tool call, so the session went idle. This is reminder {{retryCount}} of {{maxRetries}}.
|
|
3
3
|
|
|
4
|
-
Every turn MUST end with a tool call. Pick
|
|
5
|
-
1. **Resume the work** — if the assignment is not finished, call the next tool you would have called (edit, write, bash, search, etc.). NEVER
|
|
6
|
-
2. **Yield
|
|
7
|
-
3. **Yield with
|
|
4
|
+
Every turn MUST end with a tool call. Pick the first that applies:
|
|
5
|
+
1. **Resume the work** — if the assignment is not finished and you are not recording an incremental section, call the next tool you would have called (edit, write, bash, search, etc.). NEVER treat this reminder as a forced stop.
|
|
6
|
+
2. **Yield an incremental section** — only when useful for the assignment: call `yield` with non-empty `type: string[]`; matching sections accumulate and the task continues.
|
|
7
|
+
3. **Yield with success** — only if the assignment is genuinely complete: call terminal `yield`. Omit `type` for the single final structured result in `result.data`; use `type: string` to finalize from the last assistant turn when data is omitted.
|
|
8
|
+
4. **Yield with error** — only if you hit a real, concrete blocker you can name (missing file, unavailable API, contradictory spec). Describe what you tried and the exact blocker. NEVER fabricate a "forced immediate-yield" or "system reminder required termination" reason — this reminder is not a blocker.
|
|
8
9
|
|
|
9
|
-
Default to option 1 unless the work is actually done or
|
|
10
|
+
Default to option 1 unless the work is actually done, actually blocked, or ready for an incremental section.
|
|
10
11
|
|
|
11
12
|
You NEVER end this turn with text only.
|
|
12
13
|
</system-reminder>
|
|
@@ -58,7 +58,6 @@ Special URLs for internal resources; with most FS/bash tools they auto-resolve t
|
|
|
58
58
|
{{/if}}
|
|
59
59
|
- `agent://<id>`: agent output artifact; `/<path>` extracts a JSON field
|
|
60
60
|
- `artifact://<id>`: artifact content
|
|
61
|
-
- `history://<agentId>`: agent transcript (markdown); bare `history://` lists agents
|
|
62
61
|
- `local://<name>.md`: plan artifacts or shared content for subagents
|
|
63
62
|
{{#if hasObsidian}}
|
|
64
63
|
- `vault://<vault>/<path>`: Obsidian vault (read/edit). `vault://` lists vaults; `vault://_/…` targets the active vault. File ops `?op=outline|backlinks|links|tags|properties|tasks|base|…`; vault ops `?op=search&q=…|daily|tasks|orphans|unresolved|bases|…`.
|
package/src/prompts/tools/irc.md
CHANGED
|
@@ -7,7 +7,7 @@ Send/receive short text messages between agents in this process.
|
|
|
7
7
|
- Messaging an `idle`/`parked` peer wakes it — no separate revive call.
|
|
8
8
|
- `op: "wait"` — block for a message (optionally only `from` one peer); consumes + returns it. Timeout = clean "no message", not an error.
|
|
9
9
|
- `op: "inbox"` — drain pending messages without blocking.
|
|
10
|
-
- Replies arrive only when the recipient sends one
|
|
10
|
+
- Replies arrive only when the recipient sends one; don't interrogate a peer for status.
|
|
11
11
|
</instruction>
|
|
12
12
|
|
|
13
13
|
<when_to_use>
|
|
@@ -24,7 +24,7 @@ NEVER for: routine progress updates, things a tool call can verify, questions yo
|
|
|
24
24
|
Applies to sending + replying.
|
|
25
25
|
- **Plain prose only.** NEVER JSON status payloads like `{"type":"task_completed",…}` — write a normal sentence.
|
|
26
26
|
- **NEVER quote the message you answer.** Lead with the answer; set `replyTo`.
|
|
27
|
-
- **Learn about peers via IRC** — NEVER grep artifacts, read other sessions' JSONL, or shell-poke. DM them
|
|
27
|
+
- **Learn about peers via IRC** — NEVER grep artifacts, read other sessions' JSONL, or shell-poke. DM them.
|
|
28
28
|
- **Send, then keep working.** `wait`/`await: true` only when you cannot proceed. NEVER "did you get my message?". A `failed` receipt = peer unreachable — move on; NEVER retry in a loop.
|
|
29
29
|
- **Answer expected questions** via `irc send` to the sender (finish your current step first).
|
|
30
30
|
- **Stay terse.** One question per send; share files via `local://`/`memory://`/`artifact://` URLs, never pasted blobs.
|
|
@@ -7,7 +7,7 @@ Read files, directories, archives, SQLite, images, documents, internal resources
|
|
|
7
7
|
|
|
8
8
|
## Parameters
|
|
9
9
|
|
|
10
|
-
- `path` — required. Local path, internal URI (`skill://`, `agent://`, `artifact://`, `
|
|
10
|
+
- `path` — required. Local path, internal URI (`skill://`, `agent://`, `artifact://`, `memory://`, `rule://`, `local://`, `vault://`, `mcp://`, `omp://`, `issue://`, `pr://`, `ssh://`), or URL. Append `:<sel>` for ranges/modes (e.g. `src/foo.ts:50-200`, `src/foo.ts:raw`, `db.sqlite:users:42`).
|
|
11
11
|
|
|
12
12
|
## Selectors
|
|
13
13
|
|
|
@@ -67,7 +67,7 @@ For `.sqlite`, `.sqlite3`, `.db`, `.db3`:
|
|
|
67
67
|
|
|
68
68
|
# Internal URIs
|
|
69
69
|
|
|
70
|
-
All URI schemes take the same line selectors. `artifact://<id>` recovers full output a bash/eval/tool result spilled or truncated.
|
|
70
|
+
All URI schemes take the same line selectors. `artifact://<id>` recovers full output a bash/eval/tool result spilled or truncated.
|
|
71
71
|
|
|
72
72
|
`ssh://host/<absolute-path>` reads a remote text file (UTF-8, ≤1 MiB) or lists a directory one level deep, on a pre-configured SSH host or `~/.ssh/config` alias; `ssh://host/` lists the remote root and bare `ssh://` lists the configured hosts. Files are also writable via `write` and searchable via `search`; a directory only lists (`search` refuses a directory, `write` refuses to overwrite one). A literal `:`, `?`, or `#` in the remote path must be percent-encoded (`%3A`/`%3F`/`%23`) — a trailing `:sel` is read as a line selector, and `?`/`#` start a URL query/fragment. Requires a POSIX login shell (`sh`/`bash`/`zsh`); a Windows host or a non-POSIX shell (fish, csh/tcsh) is rejected — use the `ssh` tool there.
|
|
73
73
|
|
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) {
|