@oh-my-pi/pi-coding-agent 14.9.3 → 14.9.5
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 +44 -0
- package/package.json +7 -7
- package/src/async/job-manager.ts +66 -9
- package/src/capability/rule.ts +20 -0
- package/src/config/model-registry.ts +13 -0
- package/src/config/model-resolver.ts +8 -2
- package/src/config/settings-schema.ts +1 -1
- package/src/edit/index.ts +8 -0
- package/src/edit/renderer.ts +6 -1
- package/src/edit/streaming.ts +53 -2
- package/src/eval/js/context-manager.ts +1 -38
- package/src/eval/js/prelude.txt +0 -2
- package/src/eval/py/executor.ts +24 -8
- package/src/eval/py/index.ts +1 -0
- package/src/eval/py/prelude.py +11 -80
- package/src/export/html/template.css +12 -0
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +20 -2
- package/src/extensibility/plugins/loader.ts +31 -6
- package/src/extensibility/skills.ts +20 -0
- package/src/internal-urls/agent-protocol.ts +63 -52
- package/src/internal-urls/artifact-protocol.ts +51 -51
- package/src/internal-urls/docs-index.generated.ts +33 -1
- package/src/internal-urls/index.ts +6 -19
- package/src/internal-urls/local-protocol.ts +49 -7
- package/src/internal-urls/mcp-protocol.ts +2 -8
- package/src/internal-urls/memory-protocol.ts +89 -59
- package/src/internal-urls/router.ts +38 -22
- package/src/internal-urls/rule-protocol.ts +2 -20
- package/src/internal-urls/skill-protocol.ts +4 -27
- package/src/main.ts +1 -1
- package/src/mcp/manager.ts +17 -0
- package/src/modes/components/session-observer-overlay.ts +2 -2
- package/src/modes/components/tool-execution.ts +6 -0
- package/src/modes/components/tree-selector.ts +4 -0
- package/src/modes/controllers/event-controller.ts +23 -2
- package/src/modes/controllers/mcp-command-controller.ts +7 -10
- package/src/modes/interactive-mode.ts +2 -2
- package/src/modes/theme/theme.ts +27 -27
- package/src/modes/types.ts +1 -1
- package/src/modes/utils/ui-helpers.ts +14 -9
- package/src/prompts/commands/orchestrate.md +1 -0
- package/src/prompts/system/project-prompt.md +10 -2
- package/src/prompts/system/subagent-system-prompt.md +8 -8
- package/src/prompts/system/system-prompt.md +13 -7
- package/src/prompts/tools/ask.md +0 -1
- package/src/prompts/tools/bash.md +0 -10
- package/src/prompts/tools/eval.md +1 -3
- package/src/prompts/tools/github.md +6 -5
- package/src/prompts/tools/hashline.md +1 -0
- package/src/prompts/tools/job.md +14 -6
- package/src/prompts/tools/task.md +20 -3
- package/src/registry/agent-registry.ts +2 -1
- package/src/sdk.ts +87 -89
- package/src/session/agent-session.ts +58 -20
- package/src/session/artifacts.ts +7 -4
- package/src/session/session-manager.ts +30 -1
- package/src/ssh/connection-manager.ts +32 -16
- package/src/ssh/sshfs-mount.ts +10 -7
- package/src/system-prompt.ts +0 -5
- package/src/task/executor.ts +14 -2
- package/src/task/index.ts +19 -5
- package/src/tool-discovery/tool-index.ts +21 -8
- package/src/tools/ast-edit.ts +3 -2
- package/src/tools/ast-grep.ts +3 -2
- package/src/tools/bash.ts +15 -9
- package/src/tools/browser/tab-supervisor.ts +12 -2
- package/src/tools/eval.ts +48 -10
- package/src/tools/fetch.ts +1 -1
- package/src/tools/gh.ts +140 -4
- package/src/tools/index.ts +12 -11
- package/src/tools/job.ts +48 -12
- package/src/tools/read.ts +5 -4
- package/src/tools/search.ts +3 -2
- package/src/tools/todo-write.ts +1 -1
- package/src/web/scrapers/mastodon.ts +1 -1
- package/src/web/scrapers/repology.ts +7 -7
- package/src/internal-urls/jobs-protocol.ts +0 -120
- package/src/prompts/system/now-prompt.md +0 -7
package/src/eval/py/prelude.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
if "__omp_prelude_loaded__" not in globals():
|
|
4
4
|
__omp_prelude_loaded__ = True
|
|
5
5
|
from pathlib import Path
|
|
6
|
-
import os, json
|
|
6
|
+
import os, json
|
|
7
7
|
from IPython.display import display as _ipy_display, JSON
|
|
8
8
|
|
|
9
9
|
_PRESENTABLE_REPRS = (
|
|
@@ -79,79 +79,6 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
79
79
|
f.write(content)
|
|
80
80
|
_emit_status("append", path=str(p), chars=len(content))
|
|
81
81
|
return p
|
|
82
|
-
class ShellResult:
|
|
83
|
-
"""Result from shell command execution."""
|
|
84
|
-
__slots__ = ("args", "stdout", "stderr", "returncode")
|
|
85
|
-
def __init__(self, args: str, stdout: str, stderr: str, returncode: int):
|
|
86
|
-
self.args = args
|
|
87
|
-
self.stdout = stdout
|
|
88
|
-
self.stderr = stderr
|
|
89
|
-
self.returncode = returncode
|
|
90
|
-
|
|
91
|
-
@property
|
|
92
|
-
def code(self) -> int:
|
|
93
|
-
return self.returncode
|
|
94
|
-
|
|
95
|
-
@property
|
|
96
|
-
def exit_code(self) -> int:
|
|
97
|
-
return self.returncode
|
|
98
|
-
|
|
99
|
-
def check_returncode(self) -> None:
|
|
100
|
-
if self.returncode != 0:
|
|
101
|
-
raise subprocess.CalledProcessError(
|
|
102
|
-
self.returncode, self.args, output=self.stdout, stderr=self.stderr
|
|
103
|
-
)
|
|
104
|
-
|
|
105
|
-
def __repr__(self):
|
|
106
|
-
if self.returncode == 0:
|
|
107
|
-
return ""
|
|
108
|
-
return f"exit code {self.returncode}"
|
|
109
|
-
|
|
110
|
-
def __bool__(self):
|
|
111
|
-
return self.returncode == 0
|
|
112
|
-
|
|
113
|
-
def _make_shell_result(proc: subprocess.CompletedProcess[str], cmd: str) -> ShellResult:
|
|
114
|
-
"""Create ShellResult and emit status."""
|
|
115
|
-
output = proc.stdout + proc.stderr if proc.stderr else proc.stdout
|
|
116
|
-
_emit_status("sh", cmd=cmd[:80], code=proc.returncode, output=output[:500])
|
|
117
|
-
return ShellResult(cmd, proc.stdout, proc.stderr, proc.returncode)
|
|
118
|
-
|
|
119
|
-
import signal as _signal
|
|
120
|
-
|
|
121
|
-
def _run_with_interrupt(args: list[str], cwd: str | None, timeout: int | None, cmd: str) -> ShellResult:
|
|
122
|
-
"""Run subprocess with proper interrupt handling."""
|
|
123
|
-
proc = subprocess.Popen(
|
|
124
|
-
args,
|
|
125
|
-
cwd=cwd,
|
|
126
|
-
stdout=subprocess.PIPE,
|
|
127
|
-
stderr=subprocess.PIPE,
|
|
128
|
-
text=True,
|
|
129
|
-
start_new_session=True,
|
|
130
|
-
)
|
|
131
|
-
try:
|
|
132
|
-
stdout, stderr = proc.communicate(timeout=timeout)
|
|
133
|
-
except KeyboardInterrupt:
|
|
134
|
-
os.killpg(proc.pid, _signal.SIGINT)
|
|
135
|
-
try:
|
|
136
|
-
stdout, stderr = proc.communicate(timeout=2)
|
|
137
|
-
except subprocess.TimeoutExpired:
|
|
138
|
-
os.killpg(proc.pid, _signal.SIGKILL)
|
|
139
|
-
stdout, stderr = proc.communicate()
|
|
140
|
-
result = subprocess.CompletedProcess(args, -_signal.SIGINT, stdout, stderr)
|
|
141
|
-
return _make_shell_result(result, cmd)
|
|
142
|
-
except subprocess.TimeoutExpired:
|
|
143
|
-
os.killpg(proc.pid, _signal.SIGKILL)
|
|
144
|
-
stdout, stderr = proc.communicate()
|
|
145
|
-
result = subprocess.CompletedProcess(args, -_signal.SIGKILL, stdout, stderr)
|
|
146
|
-
return _make_shell_result(result, cmd)
|
|
147
|
-
result = subprocess.CompletedProcess(args, proc.returncode, stdout, stderr)
|
|
148
|
-
return _make_shell_result(result, cmd)
|
|
149
|
-
|
|
150
|
-
def run(cmd: str, *, cwd: str | Path | None = None, timeout: int | None = None) -> ShellResult:
|
|
151
|
-
"""Run a shell command. Returns ShellResult with stdout/stderr and returncode/exit_code fields."""
|
|
152
|
-
shell_path = shutil.which("bash") or shutil.which("sh") or "/bin/sh"
|
|
153
|
-
args = [shell_path, "-c", cmd]
|
|
154
|
-
return _run_with_interrupt(args, str(cwd) if cwd else None, timeout, cmd)
|
|
155
82
|
|
|
156
83
|
def sort(text: str, *, reverse: bool = False, unique: bool = False) -> str:
|
|
157
84
|
"""Sort lines of text."""
|
|
@@ -268,12 +195,16 @@ if "__omp_prelude_loaded__" not in globals():
|
|
|
268
195
|
output('explore_0', offset=10, limit=20) # Lines 10-29
|
|
269
196
|
output('explore_0', 'reviewer_1') # Read multiple outputs
|
|
270
197
|
"""
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
198
|
+
# Prefer PI_ARTIFACTS_DIR so subagents resolve through the parent's
|
|
199
|
+
# shared artifacts dir; fall back to deriving from PI_SESSION_FILE
|
|
200
|
+
# for legacy callers / top-level sessions where the two coincide.
|
|
201
|
+
artifacts_dir = os.environ.get("PI_ARTIFACTS_DIR")
|
|
202
|
+
if not artifacts_dir:
|
|
203
|
+
session_file = os.environ.get("PI_SESSION_FILE")
|
|
204
|
+
if not session_file:
|
|
205
|
+
_emit_status("output", error="No session file available")
|
|
206
|
+
raise RuntimeError("No session - output artifacts unavailable")
|
|
207
|
+
artifacts_dir = session_file.rsplit(".", 1)[0] # Strip .jsonl extension
|
|
277
208
|
if not Path(artifacts_dir).exists():
|
|
278
209
|
_emit_status("output", error="Artifacts directory not found", path=artifacts_dir)
|
|
279
210
|
raise RuntimeError(f"No artifacts directory found: {artifacts_dir}")
|
|
@@ -179,6 +179,10 @@
|
|
|
179
179
|
color: var(--accent);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
.tree-role-developer {
|
|
183
|
+
color: var(--dim);
|
|
184
|
+
}
|
|
185
|
+
|
|
182
186
|
.tree-role-assistant {
|
|
183
187
|
color: var(--success);
|
|
184
188
|
}
|
|
@@ -316,6 +320,14 @@
|
|
|
316
320
|
position: relative;
|
|
317
321
|
}
|
|
318
322
|
|
|
323
|
+
.user-message.developer-message {
|
|
324
|
+
opacity: 0.7;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.user-message.developer-message .markdown-content {
|
|
328
|
+
color: var(--dim);
|
|
329
|
+
}
|
|
330
|
+
|
|
319
331
|
.assistant-message {
|
|
320
332
|
padding: 0;
|
|
321
333
|
position: relative;
|