@dorokuma/herdsman 0.13.6 → 0.14.1
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 +2 -2
- package/dist/src/agent-history/discovery.d.ts +47 -11
- package/dist/src/agent-history/discovery.d.ts.map +1 -1
- package/dist/src/agent-history/discovery.js +242 -468
- package/dist/src/agent-history/discovery.js.map +1 -1
- package/dist/src/agent-history/service.d.ts +4 -7
- package/dist/src/agent-history/service.d.ts.map +1 -1
- package/dist/src/agent-history/service.js +46 -30
- package/dist/src/agent-history/service.js.map +1 -1
- package/dist/src/daemon/agent-event-reconciler.js +6 -10
- package/dist/src/daemon/agent-event-reconciler.js.map +1 -1
- package/dist/src/daemon/herdr-session-watch-manager.js +2 -2
- package/dist/src/daemon/herdr-session-watch-manager.js.map +1 -1
- package/dist/src/daemon/observability-server.js +6 -6
- package/dist/src/daemon/observability-server.js.map +1 -1
- package/dist/src/db/agent-events.d.ts +2 -0
- package/dist/src/db/agent-events.d.ts.map +1 -1
- package/dist/src/db/agent-events.js +20 -0
- package/dist/src/db/agent-events.js.map +1 -1
- package/dist/src/db/agents.d.ts +0 -2
- package/dist/src/db/agents.d.ts.map +1 -1
- package/dist/src/db/agents.js +14 -57
- package/dist/src/db/agents.js.map +1 -1
- package/dist/src/herdr/pane-identity-resolver.d.ts +11 -0
- package/dist/src/herdr/pane-identity-resolver.d.ts.map +1 -1
- package/dist/src/herdr/pane-identity-resolver.js +27 -15
- package/dist/src/herdr/pane-identity-resolver.js.map +1 -1
- package/dist/src/herdr/session-list.d.ts.map +1 -1
- package/dist/src/herdr/session-list.js +4 -2
- package/dist/src/herdr/session-list.js.map +1 -1
- package/dist/src/observability/agent-context-service.d.ts +4 -10
- package/dist/src/observability/agent-context-service.d.ts.map +1 -1
- package/dist/src/observability/agent-context-service.js +37 -58
- package/dist/src/observability/agent-context-service.js.map +1 -1
- package/dist/src/observability/agent-index-service.d.ts.map +1 -1
- package/dist/src/observability/agent-index-service.js +19 -22
- package/dist/src/observability/agent-index-service.js.map +1 -1
- package/dist/src/observability/contracts.d.ts +1 -2
- package/dist/src/observability/contracts.d.ts.map +1 -1
- package/dist/src/observability/contracts.js.map +1 -1
- package/package.json +1 -1
- package/dist/src/agent-history/claude-reader.d.ts +0 -10
- package/dist/src/agent-history/claude-reader.d.ts.map +0 -1
- package/dist/src/agent-history/claude-reader.js +0 -90
- package/dist/src/agent-history/claude-reader.js.map +0 -1
- package/dist/src/agent-history/codex-reader.d.ts +0 -10
- package/dist/src/agent-history/codex-reader.d.ts.map +0 -1
- package/dist/src/agent-history/codex-reader.js +0 -119
- package/dist/src/agent-history/codex-reader.js.map +0 -1
- package/dist/src/agent-history/gemini-reader.d.ts +0 -10
- package/dist/src/agent-history/gemini-reader.d.ts.map +0 -1
- package/dist/src/agent-history/gemini-reader.js +0 -96
- package/dist/src/agent-history/gemini-reader.js.map +0 -1
- package/dist/src/agent-history/grok-reader.d.ts +0 -11
- package/dist/src/agent-history/grok-reader.d.ts.map +0 -1
- package/dist/src/agent-history/grok-reader.js +0 -54
- package/dist/src/agent-history/grok-reader.js.map +0 -1
- package/dist/src/agent-history/opencode-reader.d.ts +0 -10
- package/dist/src/agent-history/opencode-reader.d.ts.map +0 -1
- package/dist/src/agent-history/opencode-reader.js +0 -90
- package/dist/src/agent-history/opencode-reader.js.map +0 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Herdsman is a daemon-backed observability layer for coding agents running in Her
|
|
|
6
6
|
|
|
7
7
|
Herdr's `herdr agent read` reads terminal streams or scrollback. Herdsman instead reads agent session data so callers can retrieve work status, structured message excerpts, compact tool results, and unread outcomes without parsing terminal output. Herdsman is read-only; use the official Herdr CLI or skill for agent start, prompts, waits, pane operations, and terminal control.
|
|
8
8
|
|
|
9
|
-
Herdsman
|
|
9
|
+
Herdsman resolves each pane's session history from the session identifier Herdr reports for that pane, never by scanning agent directories. It supports exactly two agents, both through values Herdr itself reports. Pi panes normally get a session path straight from Herdr, and Herdsman reads that file; when the pi integration cannot read its own session file path it sends an id instead, which Herdsman does not resolve — a pi session file name cannot be derived from its id alone — so such a pane reports no history. Antigravity CLI (`agy`) panes report a conversation id, and because that id names the conversation's own database file, Herdsman resolves it to `<home>/.gemini/antigravity-cli/conversations/<id>.db`, and only for a single exact match. Every other agent reports no history, whether or not Herdr has an integration for it (`herdr integration install <agent>`): Herdsman deliberately does not resolve any other agent's session identifier and never reads any other agent's session store. When the official value cannot be resolved — the agent has no installed integration, an id has no derivation Herdsman can verify, or the file is missing or fails Herdsman's file-safety checks — Herdsman logs one warning and reports the pane without history rather than guessing.
|
|
10
10
|
|
|
11
11
|
## Development conventions
|
|
12
12
|
|
|
@@ -130,7 +130,7 @@ Set `filter_upstream_errors: false` to restore waking on every outcome. `HERDSMA
|
|
|
130
130
|
Install the optional plugin from the GitHub release tag:
|
|
131
131
|
|
|
132
132
|
```bash
|
|
133
|
-
herdr plugin install dorokuma/herdsman/packages/herdsman-herdr-plugin --ref v0.
|
|
133
|
+
herdr plugin install dorokuma/herdsman/packages/herdsman-herdr-plugin --ref v0.14.1 --yes
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
Use the release tag that matches the installed Herdsman CLI version.
|
|
@@ -1,23 +1,59 @@
|
|
|
1
1
|
import type { AgentHistoryRef, AgentSessionRef } from "../observability/contracts.js";
|
|
2
|
+
/**
|
|
3
|
+
* Herdsman supports session history for exactly two agents, by decision:
|
|
4
|
+
*
|
|
5
|
+
* 1. `pi` — Herdr's own integration reports the session file itself, so the
|
|
6
|
+
* official `agent_session.kind == "path"` value is used as-is after the
|
|
7
|
+
* file-safety gate (this is the generic path channel, not a pi-only branch).
|
|
8
|
+
* 2. `agy` — Herdr reports only `kind == "id"`, and an agy conversation id is
|
|
9
|
+
* the name of its own conversation database, so the id resolves to exactly
|
|
10
|
+
* one candidate:
|
|
11
|
+
* - `agy` -> `<home>/.gemini/antigravity-cli/conversations/<id>.db`
|
|
12
|
+
*
|
|
13
|
+
* Every other agent — whether or not Herdr has an integration for it — is
|
|
14
|
+
* deliberately not resolved: herdsman does not walk agent directories, rank
|
|
15
|
+
* candidates by mtime/cwd, match role directories from the terminal title, or
|
|
16
|
+
* pick "the newest plausible file". An unresolvable pane is an explicit failure:
|
|
17
|
+
* one `console.warn` naming the official values plus the derived candidate path,
|
|
18
|
+
* then `null`.
|
|
19
|
+
*/
|
|
2
20
|
export declare const ALLOWED_SESSION_ROOTS: readonly ["/tmp/herdr-role-sessions"];
|
|
3
|
-
export declare const DISCOVERY_RECENCY_GRACE_MS = 30000;
|
|
4
|
-
export declare const FALLBACK_DISCOVERY_RECENCY_GRACE_MS: number;
|
|
5
21
|
export type AgentHistoryLookupInput = {
|
|
6
22
|
agent: string | null;
|
|
7
23
|
agentSession: AgentSessionRef | null;
|
|
8
|
-
cwd: string | null;
|
|
9
|
-
foregroundCwd: string | null;
|
|
10
|
-
firstSeenAtMs?: number;
|
|
11
|
-
grokHome?: string;
|
|
12
24
|
herdrSessionName?: string;
|
|
13
25
|
homeDir?: string;
|
|
14
|
-
|
|
15
|
-
terminalTitle?: string | null;
|
|
26
|
+
paneId?: string | null;
|
|
16
27
|
};
|
|
17
|
-
export declare function
|
|
28
|
+
export declare function discoveryLookupKey(input: AgentHistoryLookupInput): string;
|
|
29
|
+
/**
|
|
30
|
+
* True while the very same official values are still inside their retry window,
|
|
31
|
+
* so callers can skip the lookup the pane would otherwise repeat every round.
|
|
32
|
+
*/
|
|
33
|
+
export declare function discoveryFailureFresh(input: AgentHistoryLookupInput, now?: number): boolean;
|
|
34
|
+
export declare function discoverAgentHistory(input: AgentHistoryLookupInput, options?: {
|
|
35
|
+
force?: boolean;
|
|
36
|
+
}): Promise<AgentHistoryRef | null>;
|
|
37
|
+
/**
|
|
38
|
+
* Maps an official `agent_session` to the reader that can read it. Only the two
|
|
39
|
+
* supported agents have a reader; everything else is `unknown`, which every
|
|
40
|
+
* reader rejects. `source` looks like `herdr:<agent>`, so segments are matched
|
|
41
|
+
* whole — `herdr:copilot` contains "pi" and must never be read as a pi session.
|
|
42
|
+
*/
|
|
18
43
|
export declare function historySourceFromSessionRef(ref: AgentSessionRef): AgentHistoryRef["source"];
|
|
19
44
|
export declare function safeAllowedSessionPath(value: string, homeDir?: string): string | null;
|
|
20
|
-
|
|
21
|
-
|
|
45
|
+
/**
|
|
46
|
+
* File-safety gate for an official session path reported by Herdr.
|
|
47
|
+
*
|
|
48
|
+
* Herdr only reports back the value an installed agent integration handed it
|
|
49
|
+
* (`pane.report_agent_session`), so the *root* of an official path is not
|
|
50
|
+
* guessed any more and is deliberately not whitelisted: pi keeps its sessions
|
|
51
|
+
* under its own agent home, and a fixed root list would silently reject those
|
|
52
|
+
* official values. What is still enforced is that herdsman only reads a regular,
|
|
53
|
+
* non-symlink file it owns and that no other principal can rewrite behind it.
|
|
54
|
+
* `safeAllowedSessionPath` keeps the root whitelist for the herdsman-pi
|
|
55
|
+
* registration protocol, where a pane claims a path itself.
|
|
56
|
+
*/
|
|
57
|
+
export declare function safeOfficialSessionPath(value: string): string | null;
|
|
22
58
|
export declare function sessionPathAllowedByShape(value: string, homeDir?: string): boolean;
|
|
23
59
|
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/agent-history/discovery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/agent-history/discovery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAErF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,qBAAqB,uCAAwC,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,eAAe,GAAG,IAAI,CAAC;IACrC,gBAAgB,CAAC,EA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