@polygraph/claude-plugin 0.5.3 → 0.5.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.
|
@@ -59,10 +59,8 @@ Child agent <id> is done.
|
|
|
59
59
|
**Repo:** <repoFullName>
|
|
60
60
|
**Delegation id:** <id>
|
|
61
61
|
**Status:** <status>
|
|
62
|
-
|
|
63
|
-
Read the result with show_agent (id: "<id>").
|
|
64
62
|
```
|
|
65
63
|
|
|
66
64
|
For `input-required` or `permission-required`, replace "is done." with "needs attention." and keep everything else identical.
|
|
67
65
|
|
|
68
|
-
Do not summarize, quote, or describe the child's work. Do not include log lines. The main agent reads the result itself via `show_agent
|
|
66
|
+
Do not summarize, quote, or describe the child's work. Do not include log lines. The main agent reads the result itself via `show_agent`, and chooses how to read it. Never tell it which call to make.
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
// holds selectedUrl, used to build the session URL.
|
|
21
21
|
//
|
|
22
22
|
// Outside a Polygraph session (no matching sidecar) the hook is a silent no-op.
|
|
23
|
+
// Speculative captures (implicit session context, not explicit Polygraph sessions)
|
|
24
|
+
// are also treated as no-op and not injected as context.
|
|
23
25
|
|
|
24
26
|
import {
|
|
25
27
|
appendFileSync,
|
|
@@ -94,7 +96,9 @@ function sessionsRoot(root) {
|
|
|
94
96
|
|
|
95
97
|
// Scan the immediate subdirectories of `baseDir`; for each, `candidatePath`
|
|
96
98
|
// maps the subdirectory name to a candidate sidecar file. Returns the first
|
|
97
|
-
// parsed match, or null.
|
|
99
|
+
// parsed match that is not a speculative sidecar, or null.
|
|
100
|
+
// Speculative sidecars (target === 'speculative') are skipped; only regular
|
|
101
|
+
// sidecars (target === 'regular' or missing target) are returned.
|
|
98
102
|
function scanForSidecar(baseDir, candidatePath) {
|
|
99
103
|
if (!existsSync(baseDir)) return null;
|
|
100
104
|
|
|
@@ -109,7 +113,13 @@ function scanForSidecar(baseDir, candidatePath) {
|
|
|
109
113
|
if (!entry.isDirectory()) continue;
|
|
110
114
|
const candidate = candidatePath(entry.name);
|
|
111
115
|
if (existsSync(candidate)) {
|
|
112
|
-
|
|
116
|
+
const sidecar = readJson(candidate);
|
|
117
|
+
if (sidecar) {
|
|
118
|
+
// Skip speculative sidecars; only return regular ones (missing or 'regular' target).
|
|
119
|
+
if (sidecar.target !== 'speculative') {
|
|
120
|
+
return sidecar;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
return null;
|
|
@@ -118,7 +128,7 @@ function scanForSidecar(baseDir, candidatePath) {
|
|
|
118
128
|
// Find the sidecar that maps an agent session id to a Polygraph session.
|
|
119
129
|
// Checks the new per-session layout first, then falls back to the legacy
|
|
120
130
|
// shared sidecars directory. Returns the parsed sidecar object, or null when
|
|
121
|
-
// none matches.
|
|
131
|
+
// none matches or only speculative sidecars are found.
|
|
122
132
|
export function findSidecar(agentSessionId, root = polygraphRoot()) {
|
|
123
133
|
if (!agentSessionId) return null;
|
|
124
134
|
|
package/package.json
CHANGED
|
@@ -97,7 +97,7 @@ show_agent(sessionId: "<sessionId>", id: "<id>")
|
|
|
97
97
|
|
|
98
98
|
One-off unwaited reads like this are cheap and expected inline. It is the *waiting* that belongs in a subagent, not the reading.
|
|
99
99
|
|
|
100
|
-
When several pollers have exited, a **batch read** collects their results in one unwaited call: pass the list of ids and correlate each result by its delegation id.
|
|
100
|
+
When several pollers have exited, a **batch read** collects their results in one unwaited call: pass the list of ids and correlate each result by its delegation id. Batch when you spawned children together and have nothing to do until they all finish. Read one at a time when you act on each result as it lands, or only one child is in flight.
|
|
101
101
|
|
|
102
102
|
## When the result is not enough
|
|
103
103
|
|