@stateforge-labs/herdr 0.0.0-stage → 0.3.0

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.
Files changed (171) hide show
  1. package/LICENSE +18 -0
  2. package/NOTICE.md +51 -0
  3. package/README.md +211 -2
  4. package/bin/herdr-drift.js +14 -0
  5. package/bin/herdr-skill.js +38 -0
  6. package/dist/admin.d.ts +2 -0
  7. package/dist/admin.js +3 -0
  8. package/dist/constants.d.ts +236 -0
  9. package/dist/constants.js +294 -0
  10. package/dist/core/backoff.d.ts +20 -0
  11. package/dist/core/backoff.js +53 -0
  12. package/dist/core/constants.d.ts +143 -0
  13. package/dist/core/constants.js +98 -0
  14. package/dist/core/errors.d.ts +35 -0
  15. package/dist/core/errors.js +16 -0
  16. package/dist/core/events.d.ts +42 -0
  17. package/dist/core/events.js +128 -0
  18. package/dist/core/kernel.d.ts +65 -0
  19. package/dist/core/kernel.js +138 -0
  20. package/dist/core/link.d.ts +47 -0
  21. package/dist/core/link.js +187 -0
  22. package/dist/core/test-kit/constants.d.ts +51 -0
  23. package/dist/core/test-kit/constants.js +43 -0
  24. package/dist/core/test-kit/fake-core.d.ts +61 -0
  25. package/dist/core/test-kit/fake-core.js +228 -0
  26. package/dist/core/test-kit/frames.d.ts +1 -0
  27. package/dist/core/test-kit/frames.js +480 -0
  28. package/dist/core/test-kit/setup-test.d.ts +18 -0
  29. package/dist/core/test-kit/setup-test.js +35 -0
  30. package/dist/core/wire.d.ts +85 -0
  31. package/dist/core/wire.js +199 -0
  32. package/dist/core-test-kit.d.ts +5 -0
  33. package/dist/core-test-kit.js +5 -0
  34. package/dist/core.d.ts +15 -0
  35. package/dist/core.js +12 -0
  36. package/dist/drift/cli.d.ts +22 -0
  37. package/dist/drift/cli.js +146 -0
  38. package/dist/drift/constants.d.ts +83 -0
  39. package/dist/drift/constants.js +73 -0
  40. package/dist/drift/diff.d.ts +7 -0
  41. package/dist/drift/diff.js +91 -0
  42. package/dist/drift/schema.d.ts +19 -0
  43. package/dist/drift/schema.js +190 -0
  44. package/dist/drift/types.d.ts +76 -0
  45. package/dist/drift/types.js +1 -0
  46. package/dist/drift.d.ts +5 -0
  47. package/dist/drift.js +6 -0
  48. package/dist/effect.d.ts +3 -0
  49. package/dist/effect.js +4 -0
  50. package/dist/herdr/client/connect.d.ts +5 -0
  51. package/dist/herdr/client/connect.js +81 -0
  52. package/dist/herdr/client/held.d.ts +54 -0
  53. package/dist/herdr/client/held.js +100 -0
  54. package/dist/herdr/client/long-poll.d.ts +33 -0
  55. package/dist/herdr/client/long-poll.js +66 -0
  56. package/dist/herdr/client/scoped.d.ts +45 -0
  57. package/dist/herdr/client/scoped.js +241 -0
  58. package/dist/herdr/client/streams.d.ts +9 -0
  59. package/dist/herdr/client/streams.js +40 -0
  60. package/dist/herdr/client/subscribe.d.ts +75 -0
  61. package/dist/herdr/client/subscribe.js +208 -0
  62. package/dist/herdr/client/types.d.ts +150 -0
  63. package/dist/herdr/client/types.js +1 -0
  64. package/dist/herdr/client/watch-pane-set.d.ts +34 -0
  65. package/dist/herdr/client/watch-pane-set.js +271 -0
  66. package/dist/herdr/client/watch.d.ts +117 -0
  67. package/dist/herdr/client/watch.js +138 -0
  68. package/dist/herdr/effect/to-tagged-error.d.ts +2 -0
  69. package/dist/herdr/effect/to-tagged-error.js +54 -0
  70. package/dist/herdr/effect/types.d.ts +51 -0
  71. package/dist/herdr/effect/types.js +26 -0
  72. package/dist/herdr/errors.d.ts +53 -0
  73. package/dist/herdr/errors.js +87 -0
  74. package/dist/herdr/generated/entries/admin.d.ts +2 -0
  75. package/dist/herdr/generated/entries/admin.js +5 -0
  76. package/dist/herdr/generated/entries/client.d.ts +2 -0
  77. package/dist/herdr/generated/entries/client.js +5 -0
  78. package/dist/herdr/generated/entries/held.d.ts +2 -0
  79. package/dist/herdr/generated/entries/held.js +5 -0
  80. package/dist/herdr/generated/entries/prompt.d.ts +2 -0
  81. package/dist/herdr/generated/entries/prompt.js +5 -0
  82. package/dist/herdr/generated/entries/read-only-content.d.ts +2 -0
  83. package/dist/herdr/generated/entries/read-only-content.js +5 -0
  84. package/dist/herdr/generated/entries/read-only.d.ts +2 -0
  85. package/dist/herdr/generated/entries/read-only.js +5 -0
  86. package/dist/herdr/generated/entry-methods.d.ts +9 -0
  87. package/dist/herdr/generated/entry-methods.js +17 -0
  88. package/dist/herdr/generated/errors.d.ts +4 -0
  89. package/dist/herdr/generated/errors.js +3 -0
  90. package/dist/herdr/generated/events.d.ts +274 -0
  91. package/dist/herdr/generated/events.js +3 -0
  92. package/dist/herdr/generated/index.d.ts +20 -0
  93. package/dist/herdr/generated/index.js +19 -0
  94. package/dist/herdr/generated/method-table.d.ts +615 -0
  95. package/dist/herdr/generated/method-table.js +106 -0
  96. package/dist/herdr/generated/names/agent-status.d.ts +10 -0
  97. package/dist/herdr/generated/names/agent-status.js +10 -0
  98. package/dist/herdr/generated/names/capability-class.d.ts +14 -0
  99. package/dist/herdr/generated/names/capability-class.js +15 -0
  100. package/dist/herdr/generated/names/event-kind.d.ts +31 -0
  101. package/dist/herdr/generated/names/event-kind.js +31 -0
  102. package/dist/herdr/generated/names/event-match-kind.d.ts +23 -0
  103. package/dist/herdr/generated/names/event-match-kind.js +24 -0
  104. package/dist/herdr/generated/names/index.d.ts +10 -0
  105. package/dist/herdr/generated/names/index.js +12 -0
  106. package/dist/herdr/generated/names/method.d.ts +209 -0
  107. package/dist/herdr/generated/names/method.js +209 -0
  108. package/dist/herdr/generated/names/result-tag.d.ts +68 -0
  109. package/dist/herdr/generated/names/result-tag.js +68 -0
  110. package/dist/herdr/generated/names/server-capability.d.ts +10 -0
  111. package/dist/herdr/generated/names/server-capability.js +11 -0
  112. package/dist/herdr/generated/names/subscription-event-kind.d.ts +8 -0
  113. package/dist/herdr/generated/names/subscription-event-kind.js +8 -0
  114. package/dist/herdr/generated/names/subscription-type.d.ts +31 -0
  115. package/dist/herdr/generated/names/subscription-type.js +32 -0
  116. package/dist/herdr/generated/names/token-name-pattern.d.ts +2 -0
  117. package/dist/herdr/generated/names/token-name-pattern.js +4 -0
  118. package/dist/herdr/generated/namespaces.d.ts +785 -0
  119. package/dist/herdr/generated/namespaces.js +3 -0
  120. package/dist/herdr/generated/overrides.d.ts +33 -0
  121. package/dist/herdr/generated/overrides.js +20 -0
  122. package/dist/herdr/generated/params.d.ts +799 -0
  123. package/dist/herdr/generated/params.js +3 -0
  124. package/dist/herdr/generated/preset-methods.d.ts +4 -0
  125. package/dist/herdr/generated/preset-methods.js +7 -0
  126. package/dist/herdr/generated/presets/sessions-reader.d.ts +2 -0
  127. package/dist/herdr/generated/presets/sessions-reader.js +5 -0
  128. package/dist/herdr/generated/results.d.ts +978 -0
  129. package/dist/herdr/generated/results.js +52 -0
  130. package/dist/herdr/generated/test-data/defaults.d.ts +739 -0
  131. package/dist/herdr/generated/test-data/defaults.js +741 -0
  132. package/dist/herdr/generated/test-data/shapes.d.ts +1325 -0
  133. package/dist/herdr/generated/test-data/shapes.js +2245 -0
  134. package/dist/herdr/test-kit/fake-herdr.d.ts +13 -0
  135. package/dist/herdr/test-kit/fake-herdr.js +216 -0
  136. package/dist/herdr/test-kit/fake-protocol.d.ts +107 -0
  137. package/dist/herdr/test-kit/fake-protocol.js +436 -0
  138. package/dist/herdr/test-kit/types.d.ts +88 -0
  139. package/dist/herdr/test-kit/types.js +1 -0
  140. package/dist/herdr/wire/codec.d.ts +36 -0
  141. package/dist/herdr/wire/codec.js +62 -0
  142. package/dist/herdr/wire/connection.d.ts +13 -0
  143. package/dist/herdr/wire/connection.js +65 -0
  144. package/dist/herdr/wire/dedicated.d.ts +2 -0
  145. package/dist/herdr/wire/dedicated.js +238 -0
  146. package/dist/herdr/wire/push-decoder.d.ts +2 -0
  147. package/dist/herdr/wire/push-decoder.js +40 -0
  148. package/dist/herdr/wire/rpc.d.ts +3 -0
  149. package/dist/herdr/wire/rpc.js +141 -0
  150. package/dist/herdr/wire/socket-path.d.ts +8 -0
  151. package/dist/herdr/wire/socket-path.js +23 -0
  152. package/dist/herdr/wire/types.d.ts +78 -0
  153. package/dist/herdr/wire/types.js +1 -0
  154. package/dist/index.d.ts +11 -0
  155. package/dist/index.js +7 -0
  156. package/dist/read-only.d.ts +5 -0
  157. package/dist/read-only.js +6 -0
  158. package/dist/schema.d.ts +5 -0
  159. package/dist/schema.js +6 -0
  160. package/dist/test-kit.d.ts +2 -0
  161. package/dist/test-kit.js +3 -0
  162. package/docs/api/events.md +43 -0
  163. package/docs/api/methods.md +232 -0
  164. package/package.json +112 -4
  165. package/schema/herdr-api.schema.json +10759 -0
  166. package/schema/herdr-version.json +5 -0
  167. package/skills/herdr-sdk/SKILL.md +75 -0
  168. package/skills/herdr-sdk/references/api-map.md +28 -0
  169. package/skills/herdr-sdk/references/errors.md +19 -0
  170. package/skills/herdr-sdk/references/recipes.md +171 -0
  171. package/skills/herdr-sdk/references/versions.md +7 -0
@@ -0,0 +1,138 @@
1
+ // Role: watch(): a subscription that reconnects with backoff and forwards frames until the caller stops.
2
+ // Informs HERDR-ADR-0017, HERDR-ADR-0007, HERDR-ADR-0016, plan 3.6; merged by HERDR-ADR-0021 from types.ts, default-sleep.ts, sleep-or-abort.ts, merge-signals.ts, forward-frames.ts, subscription-specs.ts, backoff.ts, watch-cycle.ts, watch.ts.
3
+ import { WatchKind, Backoff, GLOBAL_SUBSCRIPTION_TYPES } from '../../constants.js';
4
+ import { setTimeout as delay } from 'node:timers/promises';
5
+ import { createReplayBuffer } from './watch-pane-set.js';
6
+ export const defaultSleep = async function defaultSleep(ms, signal) {
7
+ try {
8
+ await delay(ms, undefined, { signal });
9
+ }
10
+ catch (error) {
11
+ // The abort is the answer: the caller checks the signal and stops. Any other failure is real.
12
+ if (!signal.aborted) {
13
+ throw error;
14
+ }
15
+ }
16
+ };
17
+ export async function sleepOrAbort(sleep, ms, signal) {
18
+ try {
19
+ await sleep(ms, signal);
20
+ }
21
+ catch (error) {
22
+ // The abort is the answer: the caller checks the signal and stops. Any other failure is real.
23
+ if (!signal.aborted) {
24
+ throw error;
25
+ }
26
+ }
27
+ }
28
+ // AbortSignal.any is on every target (Node >= 22.18, Bun); a missing parent just returns the own signal.
29
+ export function linkSignal(own, parent) {
30
+ return parent === undefined ? own : AbortSignal.any([own, parent]);
31
+ }
32
+ export async function forwardFrames(subscription, accept) {
33
+ for await (const frame of subscription) {
34
+ if (!accept(frame)) {
35
+ return;
36
+ }
37
+ }
38
+ }
39
+ // Every type given here is a bare member of Subscription (no pane_id, no match): the callers pass GLOBAL_SUBSCRIPTION_TYPES
40
+ // and PANE_LIFECYCLE_SUBSCRIPTION_TYPES, and the watch tests assert each spec has only its type.
41
+ export function bareSpecs(types) {
42
+ return types.map((type) => ({ type }));
43
+ }
44
+ const DEFAULT_POLICY = {
45
+ initialMs: Backoff.InitialMs,
46
+ maxMs: Backoff.MaxMs,
47
+ factor: Backoff.Factor,
48
+ stableResetMs: Backoff.StableResetMs,
49
+ };
50
+ export function resolveBackoff(partial) {
51
+ return { ...DEFAULT_POLICY, ...partial };
52
+ }
53
+ // Delay before attempt number `attempt` (0 is the first retry): InitialMs * Factor^attempt, capped at MaxMs.
54
+ export function nextDelayMs(policy, attempt) {
55
+ return Math.min(policy.initialMs * policy.factor ** attempt, policy.maxMs);
56
+ }
57
+ // The clock is injected so tests move time instead of waiting for it. A cycle up for at least StableResetMs resets the attempt count.
58
+ export function createBackoffState(policy, now) {
59
+ let attempt = 0;
60
+ let startedAt = now();
61
+ return {
62
+ startCycle() {
63
+ startedAt = now();
64
+ },
65
+ delayAfterFailure() {
66
+ if (now() - startedAt >= policy.stableResetMs) {
67
+ attempt = 0;
68
+ }
69
+ const delay = nextDelayMs(policy, attempt);
70
+ attempt += 1;
71
+ return delay;
72
+ },
73
+ };
74
+ }
75
+ // Returns normally when the subscription ends without failing (close, abort, or the client closed). Throws when the cycle
76
+ // failed (subscribe rejected, the snapshot rejected, or the subscription failed); the caller resubscribes after the backoff.
77
+ export async function* runCycle(input) {
78
+ const { subscribe, specs, options, signal } = input;
79
+ const subscription = await subscribe(specs, { signal, queue: options.queue, onUnknown: options.onUnknown });
80
+ const buffer = createReplayBuffer(options.queue);
81
+ const endOnAbort = () => buffer.end();
82
+ signal.addEventListener('abort', endOnAbort, { once: true });
83
+ void forwardFrames(subscription, (frame) => buffer.push(frame)).then(() => buffer.end(), (error) => buffer.fail(error));
84
+ try {
85
+ const snapshot = await options.snapshot(signal);
86
+ if (signal.aborted) {
87
+ return;
88
+ }
89
+ yield { kind: WatchKind.Live, snapshot };
90
+ for (;;) {
91
+ const next = await buffer.take();
92
+ if (next.done === true || signal.aborted) {
93
+ return;
94
+ }
95
+ yield { kind: WatchKind.Frame, frame: next.value };
96
+ }
97
+ }
98
+ finally {
99
+ signal.removeEventListener('abort', endOnAbort);
100
+ subscription.close();
101
+ }
102
+ }
103
+ const DEFAULT_SPECS = bareSpecs(GLOBAL_SUBSCRIPTION_TYPES);
104
+ export const createWatch = (subscribe) => createWatchWithClock(subscribe, Date.now);
105
+ // The clock is a parameter so the backoff reset (a cycle up for stableResetMs) is tested with a fake clock. The client uses Date.now.
106
+ export function createWatchWithClock(subscribe, now) {
107
+ return function watch(options) {
108
+ const controller = new AbortController();
109
+ const signal = linkSignal(controller.signal, options.signal);
110
+ return {
111
+ close() {
112
+ controller.abort();
113
+ },
114
+ [Symbol.asyncIterator]() {
115
+ return watchLoop(subscribe, options, signal, now);
116
+ },
117
+ };
118
+ };
119
+ }
120
+ // Repeats cycles until one ends normally. A failure sleeps the backoff delay (unless the signal already aborted) and tries again.
121
+ async function* watchLoop(subscribe, options, signal, now) {
122
+ const backoff = createBackoffState(resolveBackoff(options.backoff), now);
123
+ const sleep = options.sleep ?? defaultSleep;
124
+ const specs = options.subscriptions ?? DEFAULT_SPECS;
125
+ while (!signal.aborted) {
126
+ backoff.startCycle();
127
+ try {
128
+ yield* runCycle({ subscribe, specs, options, signal });
129
+ return;
130
+ }
131
+ catch {
132
+ if (signal.aborted) {
133
+ return;
134
+ }
135
+ await sleepOrAbort(sleep, backoff.delayAfterFailure(), signal);
136
+ }
137
+ }
138
+ }
@@ -0,0 +1,2 @@
1
+ import type { ToTaggedError } from './types.js';
2
+ export declare const toTaggedError: ToTaggedError;
@@ -0,0 +1,54 @@
1
+ // Role: maps a Promise-core error to its Effect tagged error. S0 returns plain objects that match the shapes in effect/types.ts; S1 (after A1) builds the Data.TaggedError classes instead.
2
+ // Informs HERDR-ADR-0004 (Effect as a wrapper over the Promise core) and plan 3.7 (error table); contract in effect/types.ts (ToTaggedError).
3
+ import { EffectErrorTag, EffectFallbackMessage } from '../../constants.js';
4
+ import { HerdrError, HerdrTransportError, ProtocolMismatchError, SubscriptionEnded, UnsupportedByServerError, } from '../errors.js';
5
+ // A server refusal keeps its method, code and message.
6
+ function refused(error) {
7
+ return { _tag: EffectErrorTag.Refused, method: error.method, code: error.code, message: error.message };
8
+ }
9
+ // A transport failure keeps its timeout flag and the original error as cause.
10
+ function transportFailure(error) {
11
+ return { _tag: EffectErrorTag.Unavailable, message: error.message, cause: error, isTimeout: error.isTimeout };
12
+ }
13
+ // A protocol mismatch keeps both protocol numbers.
14
+ function protocolMismatch(error) {
15
+ return {
16
+ _tag: EffectErrorTag.ProtocolMismatch,
17
+ message: error.message,
18
+ expected: error.expected,
19
+ actual: error.actual,
20
+ };
21
+ }
22
+ // A missing server capability keeps the method and the capability that was missing.
23
+ function unsupported(error) {
24
+ return {
25
+ _tag: EffectErrorTag.Unsupported,
26
+ message: error.message,
27
+ method: error.method,
28
+ capability: error.capability,
29
+ };
30
+ }
31
+ // An ended subscription is unavailable, not a timeout; the original error is the cause.
32
+ function subscriptionEnded(error) {
33
+ return { _tag: EffectErrorTag.Unavailable, message: error.message, cause: error, isTimeout: false };
34
+ }
35
+ // Anything else is unavailable with the value as cause; its message is used when it has one.
36
+ function unknownFailure(value) {
37
+ const message = value instanceof Error && value.message ? value.message : EffectFallbackMessage.UnknownError;
38
+ return { _tag: EffectErrorTag.Unavailable, message, cause: value, isTimeout: false };
39
+ }
40
+ // Dispatch order follows the table in effect/types.ts; the first matching class wins.
41
+ function mapError(error) {
42
+ if (error instanceof HerdrError)
43
+ return refused(error);
44
+ if (error instanceof HerdrTransportError)
45
+ return transportFailure(error);
46
+ if (error instanceof ProtocolMismatchError)
47
+ return protocolMismatch(error);
48
+ if (error instanceof UnsupportedByServerError)
49
+ return unsupported(error);
50
+ if (error instanceof SubscriptionEnded)
51
+ return subscriptionEnded(error);
52
+ return unknownFailure(error);
53
+ }
54
+ export const toTaggedError = (error) => mapError(error);
@@ -0,0 +1,51 @@
1
+ import type { EffectErrorTag, ProtocolPolicy } from '../../constants.js';
2
+ import type { Method, ServerCapability } from '../generated/index.js';
3
+ import type { EnvMap } from '../wire/socket-path.js';
4
+ import type { OnCall, UnknownFrame } from '../wire/types.js';
5
+ /** Options of every Herdr layer. timeoutMs is required: no default timeout, the composition root decides (plan 3.7). */
6
+ export interface HerdrLayerOptions {
7
+ readonly socketPath?: string | undefined;
8
+ readonly timeoutMs: number;
9
+ readonly protocolPolicy?: ProtocolPolicy | undefined;
10
+ readonly onCall?: OnCall | undefined;
11
+ /** Same rule as ConnectOptions.onUnknown (client hook first, then any per-call hook). */
12
+ readonly onUnknown?: ((frame: UnknownFrame) => void) | undefined;
13
+ /** Same as ConnectOptions.env; tests pass their own. */
14
+ readonly env?: EnvMap | undefined;
15
+ }
16
+ /**
17
+ * Fields of each tagged error (plan 3.7 table). Every shape has
18
+ * `message` (Data.TaggedError provides it; it is the Promise error's message), so toolResult reads it without a cast.
19
+ */
20
+ export interface HerdrRefusedShape {
21
+ readonly _tag: typeof EffectErrorTag.Refused;
22
+ readonly method: string;
23
+ readonly code: string;
24
+ readonly message: string;
25
+ }
26
+ export interface HerdrUnavailableShape {
27
+ readonly _tag: typeof EffectErrorTag.Unavailable;
28
+ readonly message: string;
29
+ readonly cause: unknown;
30
+ readonly isTimeout: boolean;
31
+ }
32
+ export interface ProtocolMismatchShape {
33
+ readonly _tag: typeof EffectErrorTag.ProtocolMismatch;
34
+ readonly message: string;
35
+ readonly expected: number;
36
+ readonly actual: number;
37
+ }
38
+ export interface HerdrUnsupportedShape {
39
+ readonly _tag: typeof EffectErrorTag.Unsupported;
40
+ readonly message: string;
41
+ readonly method: Method;
42
+ readonly capability: ServerCapability;
43
+ }
44
+ /** Every error an Effect herdr call can fail with. P6a's Data.TaggedError classes satisfy these shapes structurally. */
45
+ export type HerdrTaggedError = HerdrRefusedShape | HerdrUnavailableShape | ProtocolMismatchShape | HerdrUnsupportedShape;
46
+ /**
47
+ * Maps a Promise-core error to its tagged error: HerdrError -> HerdrRefused; HerdrTransportError and SubscriptionEnded
48
+ * -> HerdrUnavailable; ProtocolMismatchError -> ProtocolMismatch; UnsupportedByServerError -> HerdrUnsupported;
49
+ * anything else -> HerdrUnavailable with the value as cause. Implemented by effect/to-tagged-error.ts (P6a).
50
+ */
51
+ export type ToTaggedError = (error: unknown) => HerdrTaggedError;
@@ -0,0 +1,26 @@
1
+ export {};
2
+ /*
3
+ * LOCKED IN PROSE, TYPED IN AMENDMENT A1 (P6a builds exactly this; it may not change it):
4
+ *
5
+ * - Services (Context tags): `Herdr`, `HerdrReadOnly`, `HerdrPrompt`, `HerdrAdmin`, with service shapes
6
+ * `EffectNamespaces<ClientNamespaces | ReadOnlyNamespaces | PromptNamespaces | AdminNamespaces>`: the generated namespace
7
+ * type with every `(params, options?) => Promise<R>` leaf mapped to `(params, options?) => Effect<R, HerdrTaggedError>`,
8
+ * built by one runtime wrapper over the Promise tree (plan 3.7: no second decoder).
9
+ * - Base members of every service: `capabilities: ClientCapabilities` and `serverInfo: ServerInfo` (plain values, read
10
+ * from the Promise client). No `close`: the layer's scope closes the client (Layer.scoped + acquireRelease).
11
+ * - Streams: `events.subscribe(specs, options?: SubscribeOptions)` maps to `Stream<DecodedFrame, HerdrTaggedError>`;
12
+ * `watch(options: EffectWatchOptions<S, E>)` to `Stream<WatchChange<S>, HerdrTaggedError | E>`, where
13
+ * `EffectWatchOptions<S, E>` is `WatchOptions<S>` with `snapshot: Effect<S, E>` (an Effect, not a Promise function; the
14
+ * wrapper runs it with Effect.runPromise and the watch abort signal) and without `signal` (fiber interruption ends it).
15
+ * `hold()` maps to `Effect<HeldConnection, HerdrTaggedError, Scope>` (closed with the scope).
16
+ * - Layers: `Herdr.layer(options: HerdrLayerOptions)`, `Herdr.layerReadOnly(options: HerdrLayerOptions & ReadOnlyOptions)`,
17
+ * `Herdr.layerPrompt(options: HerdrLayerOptions)`, `Herdr.layerAdmin(options: HerdrLayerOptions)`; each
18
+ * `Layer<Service, ProtocolMismatch | HerdrUnavailable>` (connect runs in the layer). onUnknown and env are layer options.
19
+ * - `watchPaneSet(herdr: EffectNamespaces<ReadOnlyNamespaces>, options?: WatchPaneSetOptions): Stream<PaneSetChange, HerdrTaggedError>`,
20
+ * a wrapper over client/watch watchPaneSet (P4b). It adapts the service to a PaneSetSource with one bridge:
21
+ * `pane.list` = `(params) => Effect.runPromise(herdr.pane.list(params))` and `events.subscribe` taken from the Promise
22
+ * client the layer holds (the service keeps a private reference to it; no second subscribe implementation).
23
+ * - Fiber interruption destroys the connection (rpc signal, subscription close, held close).
24
+ * - Stubs: A1 also creates `src/herdr/effect/services.ts` exporting the four tags (declared) and the four layers as typed
25
+ * stubs that throw NotImplementedError (Lane.P6a), so a test layer can import the tags the day A1 lands.
26
+ */
@@ -0,0 +1,53 @@
1
+ import type { Lane } from '../constants.js';
2
+ import type { ErrorBody, Method, ServerCapability } from './generated/index.js';
3
+ export declare class HerdrError extends Error {
4
+ readonly name: string;
5
+ readonly code: string;
6
+ readonly method: string;
7
+ readonly body: ErrorBody;
8
+ constructor(method: string, body: ErrorBody);
9
+ static from(method: string, body: ErrorBody): HerdrError;
10
+ }
11
+ export interface TransportErrorOptions {
12
+ cause?: unknown;
13
+ isTimeout?: boolean;
14
+ }
15
+ export declare class HerdrTransportError extends Error {
16
+ readonly name: string;
17
+ readonly isTimeout: boolean;
18
+ constructor(message: string, options?: TransportErrorOptions);
19
+ }
20
+ export declare class ProtocolMismatchError extends Error {
21
+ readonly name: string;
22
+ readonly expected: number;
23
+ readonly actual: number;
24
+ constructor(expected: number, actual: number);
25
+ }
26
+ export declare class UnsupportedByServerError extends Error {
27
+ readonly name: string;
28
+ readonly method: Method;
29
+ readonly capability: ServerCapability;
30
+ constructor(method: Method, capability: ServerCapability);
31
+ }
32
+ export declare class UnsupportedWatchError extends TypeError {
33
+ readonly name: string;
34
+ constructor(message: string);
35
+ }
36
+ export declare class SubscriptionEnded extends Error {
37
+ readonly name: string;
38
+ readonly method: Method;
39
+ constructor(method: Method, options?: {
40
+ cause?: unknown;
41
+ });
42
+ }
43
+ export declare class NotImplementedError extends Error {
44
+ readonly name: string;
45
+ readonly what: string;
46
+ readonly lane: Lane;
47
+ constructor(what: string, lane: Lane);
48
+ }
49
+ export declare function notImplemented(what: string, lane: Lane): never;
50
+ export declare class MalformedSchemaError extends Error {
51
+ readonly name: string;
52
+ constructor(message: string);
53
+ }
@@ -0,0 +1,87 @@
1
+ // Role: every error the herdr server client and its tools throw: a server refusal, a transport failure, a protocol mismatch, a capability the server lacks, an ended subscription, an unsupported watch, a malformed schema and a not-yet-implemented stub. Messages and names come from src/constants.ts.
2
+ // Informs HERDR-ADR-0017, HERDR-ADR-0003, HERDR-ADR-0016, plan 3.1, HERDR-ADR-0009; merged by HERDR-ADR-0021 from errors.ts, not-implemented.ts, malformed-schema-error.ts.
3
+ import { ErrorName, ErrorText } from '../constants.js';
4
+ // A server error envelope: the call reached herdr and herdr refused it.
5
+ export class HerdrError extends Error {
6
+ name = ErrorName.Herdr;
7
+ code;
8
+ method;
9
+ body;
10
+ constructor(method, body) {
11
+ super(ErrorText.Refused(method, body.message, body.code));
12
+ this.code = body.code;
13
+ this.method = method;
14
+ this.body = body;
15
+ }
16
+ static from(method, body) {
17
+ return new HerdrError(method, body);
18
+ }
19
+ }
20
+ // The call never got a usable answer: connect, timeout, abort, socket or malformed line.
21
+ export class HerdrTransportError extends Error {
22
+ name = ErrorName.Transport;
23
+ isTimeout;
24
+ constructor(message, options = {}) {
25
+ super(message, { cause: options.cause });
26
+ this.isTimeout = options.isTimeout ?? false;
27
+ }
28
+ }
29
+ // The server speaks another protocol than the one this library was generated for.
30
+ export class ProtocolMismatchError extends Error {
31
+ name = ErrorName.ProtocolMismatch;
32
+ expected;
33
+ actual;
34
+ constructor(expected, actual) {
35
+ super(ErrorText.ProtocolMismatch(expected, actual));
36
+ this.expected = expected;
37
+ this.actual = actual;
38
+ }
39
+ }
40
+ // A method needs a server capability that the server did not advertise; nothing was sent.
41
+ export class UnsupportedByServerError extends Error {
42
+ name = ErrorName.UnsupportedByServer;
43
+ method;
44
+ capability;
45
+ constructor(method, capability) {
46
+ super(ErrorText.Unsupported(method, capability));
47
+ this.method = method;
48
+ this.capability = capability;
49
+ }
50
+ }
51
+ // A caller asked watchPaneSet for a per-pane type it cannot follow yet (pane.output_matched, open issue 8). A TypeError: an argument error, not a wire error.
52
+ export class UnsupportedWatchError extends TypeError {
53
+ name = ErrorName.UnsupportedWatch;
54
+ constructor(message) {
55
+ super(message);
56
+ }
57
+ }
58
+ // The server closed a subscription connection (or it failed after the ack). Mapped to HerdrUnavailable in /effect (plan 3.7).
59
+ export class SubscriptionEnded extends Error {
60
+ name = ErrorName.SubscriptionEnded;
61
+ method;
62
+ constructor(method, options = {}) {
63
+ super(ErrorText.SubscriptionEnded(method), { cause: options.cause });
64
+ this.method = method;
65
+ }
66
+ }
67
+ // A contract function whose lane has not landed yet. Never thrown by finished code.
68
+ export class NotImplementedError extends Error {
69
+ name = ErrorName.NotImplemented;
70
+ what;
71
+ lane;
72
+ constructor(what, lane) {
73
+ super(ErrorText.NotImplemented(what, lane));
74
+ this.what = what;
75
+ this.lane = lane;
76
+ }
77
+ }
78
+ // Stub body: `return notImplemented('connectReadOnly', Lane.P2b)`.
79
+ export function notImplemented(what, lane) {
80
+ throw new NotImplementedError(what, lane);
81
+ }
82
+ export class MalformedSchemaError extends Error {
83
+ name = ErrorName.MalformedSchema;
84
+ constructor(message) {
85
+ super(message);
86
+ }
87
+ }
@@ -0,0 +1,2 @@
1
+ /** Method names of the admin entry point, sorted. */
2
+ export declare const ADMIN_METHODS: readonly ["agent.explain", "agent.focus", "agent.get", "agent.list", "agent.prompt", "agent.read", "agent.rename", "agent.send_keys", "agent.start", "agent.view.clear", "agent.view.set", "agent.wait", "command.invoke", "events.subscribe", "events.wait", "integration.install", "integration.list", "integration.uninstall", "layout.apply", "layout.export", "layout.set_split_ratio", "notification.show", "pane.clear", "pane.clear_agent_authority", "pane.close", "pane.copy_motion", "pane.copy_search", "pane.current", "pane.edges", "pane.edit_scrollback", "pane.focus", "pane.focus_direction", "pane.get", "pane.input.set", "pane.layout", "pane.link.activate", "pane.link.resolve", "pane.list", "pane.move", "pane.neighbor", "pane.process_info", "pane.read", "pane.release_agent", "pane.rename", "pane.report_agent", "pane.report_agent_session", "pane.report_metadata", "pane.resize", "pane.scroll", "pane.selection.read", "pane.send_input", "pane.send_keys", "pane.send_text", "pane.split", "pane.swap", "pane.wait_for_output", "pane.zoom", "ping", "plugin.action.invoke", "plugin.action.list", "plugin.disable", "plugin.enable", "plugin.link", "plugin.list", "plugin.log.list", "plugin.pane.close", "plugin.pane.focus", "plugin.pane.open", "plugin.unlink", "popup.close", "product_announcement.dismiss", "release_notes.dismiss", "server.agent_manifests", "server.live_handoff", "server.reload_agent_manifests", "server.reload_config", "server.stop", "session.snapshot", "tab.close", "tab.create", "tab.focus", "tab.get", "tab.list", "tab.move", "tab.rename", "workspace.close", "workspace.create", "workspace.focus", "workspace.get", "workspace.list", "workspace.move", "workspace.move_block", "workspace.rename", "workspace.report_metadata", "worktree.create", "worktree.list", "worktree.open", "worktree.remove"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodAgentExplain, MethodAgentFocus, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodAgentRead, MethodAgentRename, MethodAgentSendKeys, MethodAgentStart, MethodAgentViewClear, MethodAgentViewSet, MethodAgentWait, MethodCommandInvoke, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationInstall, MethodIntegrationList, MethodIntegrationUninstall, MethodLayoutApply, MethodLayoutExport, MethodLayoutSetSplitRatio, MethodNotificationShow, MethodPaneClear, MethodPaneClearAgentAuthority, MethodPaneClose, MethodPaneCopyMotion, MethodPaneCopySearch, MethodPaneCurrent, MethodPaneEdges, MethodPaneEditScrollback, MethodPaneFocus, MethodPaneFocusDirection, MethodPaneGet, MethodPaneInputSet, MethodPaneLayout, MethodPaneLinkActivate, MethodPaneLinkResolve, MethodPaneList, MethodPaneMove, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneReleaseAgent, MethodPaneRename, MethodPaneReportAgent, MethodPaneReportAgentSession, MethodPaneReportMetadata, MethodPaneResize, MethodPaneScroll, MethodPaneSelectionRead, MethodPaneSendInput, MethodPaneSendKeys, MethodPaneSendText, MethodPaneSplit, MethodPaneSwap, MethodPaneWaitForOutput, MethodPaneZoom, MethodPing, MethodPluginActionInvoke, MethodPluginActionList, MethodPluginDisable, MethodPluginEnable, MethodPluginLink, MethodPluginList, MethodPluginLogList, MethodPluginPaneClose, MethodPluginPaneFocus, MethodPluginPaneOpen, MethodPluginUnlink, MethodPopupClose, MethodProductAnnouncementDismiss, MethodReleaseNotesDismiss, MethodServerAgentManifests, MethodServerLiveHandoff, MethodServerReloadAgentManifests, MethodServerReloadConfig, MethodServerStop, MethodSessionSnapshot, MethodTabClose, MethodTabCreate, MethodTabFocus, MethodTabGet, MethodTabList, MethodTabMove, MethodTabRename, MethodWorkspaceClose, MethodWorkspaceCreate, MethodWorkspaceFocus, MethodWorkspaceGet, MethodWorkspaceList, MethodWorkspaceMove, MethodWorkspaceMoveBlock, MethodWorkspaceRename, MethodWorkspaceReportMetadata, MethodWorktreeCreate, MethodWorktreeList, MethodWorktreeOpen, MethodWorktreeRemove } from '../names/method.js';
4
+ /** Method names of the admin entry point, sorted. */
5
+ export const ADMIN_METHODS = [MethodAgentExplain, MethodAgentFocus, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodAgentRead, MethodAgentRename, MethodAgentSendKeys, MethodAgentStart, MethodAgentViewClear, MethodAgentViewSet, MethodAgentWait, MethodCommandInvoke, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationInstall, MethodIntegrationList, MethodIntegrationUninstall, MethodLayoutApply, MethodLayoutExport, MethodLayoutSetSplitRatio, MethodNotificationShow, MethodPaneClear, MethodPaneClearAgentAuthority, MethodPaneClose, MethodPaneCopyMotion, MethodPaneCopySearch, MethodPaneCurrent, MethodPaneEdges, MethodPaneEditScrollback, MethodPaneFocus, MethodPaneFocusDirection, MethodPaneGet, MethodPaneInputSet, MethodPaneLayout, MethodPaneLinkActivate, MethodPaneLinkResolve, MethodPaneList, MethodPaneMove, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneReleaseAgent, MethodPaneRename, MethodPaneReportAgent, MethodPaneReportAgentSession, MethodPaneReportMetadata, MethodPaneResize, MethodPaneScroll, MethodPaneSelectionRead, MethodPaneSendInput, MethodPaneSendKeys, MethodPaneSendText, MethodPaneSplit, MethodPaneSwap, MethodPaneWaitForOutput, MethodPaneZoom, MethodPing, MethodPluginActionInvoke, MethodPluginActionList, MethodPluginDisable, MethodPluginEnable, MethodPluginLink, MethodPluginList, MethodPluginLogList, MethodPluginPaneClose, MethodPluginPaneFocus, MethodPluginPaneOpen, MethodPluginUnlink, MethodPopupClose, MethodProductAnnouncementDismiss, MethodReleaseNotesDismiss, MethodServerAgentManifests, MethodServerLiveHandoff, MethodServerReloadAgentManifests, MethodServerReloadConfig, MethodServerStop, MethodSessionSnapshot, MethodTabClose, MethodTabCreate, MethodTabFocus, MethodTabGet, MethodTabList, MethodTabMove, MethodTabRename, MethodWorkspaceClose, MethodWorkspaceCreate, MethodWorkspaceFocus, MethodWorkspaceGet, MethodWorkspaceList, MethodWorkspaceMove, MethodWorkspaceMoveBlock, MethodWorkspaceRename, MethodWorkspaceReportMetadata, MethodWorktreeCreate, MethodWorktreeList, MethodWorktreeOpen, MethodWorktreeRemove];
@@ -0,0 +1,2 @@
1
+ /** Method names of the client entry point, sorted. */
2
+ export declare const CLIENT_METHODS: readonly ["agent.explain", "agent.focus", "agent.get", "agent.list", "agent.prompt", "agent.read", "agent.rename", "agent.send_keys", "agent.view.clear", "agent.view.set", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.apply", "layout.export", "layout.set_split_ratio", "notification.show", "pane.clear", "pane.clear_agent_authority", "pane.copy_motion", "pane.copy_search", "pane.current", "pane.edges", "pane.focus", "pane.focus_direction", "pane.get", "pane.input.set", "pane.layout", "pane.link.resolve", "pane.list", "pane.move", "pane.neighbor", "pane.process_info", "pane.read", "pane.release_agent", "pane.rename", "pane.report_agent", "pane.report_agent_session", "pane.report_metadata", "pane.resize", "pane.scroll", "pane.selection.read", "pane.send_input", "pane.send_keys", "pane.send_text", "pane.split", "pane.swap", "pane.wait_for_output", "pane.zoom", "ping", "plugin.action.list", "plugin.disable", "plugin.list", "plugin.log.list", "plugin.pane.focus", "product_announcement.dismiss", "release_notes.dismiss", "server.agent_manifests", "session.snapshot", "tab.create", "tab.focus", "tab.get", "tab.list", "tab.move", "tab.rename", "workspace.create", "workspace.focus", "workspace.get", "workspace.list", "workspace.move", "workspace.move_block", "workspace.rename", "workspace.report_metadata", "worktree.create", "worktree.list", "worktree.open"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodAgentExplain, MethodAgentFocus, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodAgentRead, MethodAgentRename, MethodAgentSendKeys, MethodAgentViewClear, MethodAgentViewSet, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutApply, MethodLayoutExport, MethodLayoutSetSplitRatio, MethodNotificationShow, MethodPaneClear, MethodPaneClearAgentAuthority, MethodPaneCopyMotion, MethodPaneCopySearch, MethodPaneCurrent, MethodPaneEdges, MethodPaneFocus, MethodPaneFocusDirection, MethodPaneGet, MethodPaneInputSet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneMove, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneReleaseAgent, MethodPaneRename, MethodPaneReportAgent, MethodPaneReportAgentSession, MethodPaneReportMetadata, MethodPaneResize, MethodPaneScroll, MethodPaneSelectionRead, MethodPaneSendInput, MethodPaneSendKeys, MethodPaneSendText, MethodPaneSplit, MethodPaneSwap, MethodPaneWaitForOutput, MethodPaneZoom, MethodPing, MethodPluginActionList, MethodPluginDisable, MethodPluginList, MethodPluginLogList, MethodPluginPaneFocus, MethodProductAnnouncementDismiss, MethodReleaseNotesDismiss, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabCreate, MethodTabFocus, MethodTabGet, MethodTabList, MethodTabMove, MethodTabRename, MethodWorkspaceCreate, MethodWorkspaceFocus, MethodWorkspaceGet, MethodWorkspaceList, MethodWorkspaceMove, MethodWorkspaceMoveBlock, MethodWorkspaceRename, MethodWorkspaceReportMetadata, MethodWorktreeCreate, MethodWorktreeList, MethodWorktreeOpen } from '../names/method.js';
4
+ /** Method names of the client entry point, sorted. */
5
+ export const CLIENT_METHODS = [MethodAgentExplain, MethodAgentFocus, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodAgentRead, MethodAgentRename, MethodAgentSendKeys, MethodAgentViewClear, MethodAgentViewSet, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutApply, MethodLayoutExport, MethodLayoutSetSplitRatio, MethodNotificationShow, MethodPaneClear, MethodPaneClearAgentAuthority, MethodPaneCopyMotion, MethodPaneCopySearch, MethodPaneCurrent, MethodPaneEdges, MethodPaneFocus, MethodPaneFocusDirection, MethodPaneGet, MethodPaneInputSet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneMove, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneReleaseAgent, MethodPaneRename, MethodPaneReportAgent, MethodPaneReportAgentSession, MethodPaneReportMetadata, MethodPaneResize, MethodPaneScroll, MethodPaneSelectionRead, MethodPaneSendInput, MethodPaneSendKeys, MethodPaneSendText, MethodPaneSplit, MethodPaneSwap, MethodPaneWaitForOutput, MethodPaneZoom, MethodPing, MethodPluginActionList, MethodPluginDisable, MethodPluginList, MethodPluginLogList, MethodPluginPaneFocus, MethodProductAnnouncementDismiss, MethodReleaseNotesDismiss, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabCreate, MethodTabFocus, MethodTabGet, MethodTabList, MethodTabMove, MethodTabRename, MethodWorkspaceCreate, MethodWorkspaceFocus, MethodWorkspaceGet, MethodWorkspaceList, MethodWorkspaceMove, MethodWorkspaceMoveBlock, MethodWorkspaceRename, MethodWorkspaceReportMetadata, MethodWorktreeCreate, MethodWorktreeList, MethodWorktreeOpen];
@@ -0,0 +1,2 @@
1
+ /** Method names of the held entry point, sorted. */
2
+ export declare const HELD_METHODS: readonly ["client.window_title.clear", "client.window_title.set", "client_shell.surface.set", "server.ssh_agent.register"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodClientWindowTitleClear, MethodClientWindowTitleSet, MethodClientShellSurfaceSet, MethodServerSshAgentRegister } from '../names/method.js';
4
+ /** Method names of the held entry point, sorted. */
5
+ export const HELD_METHODS = [MethodClientWindowTitleClear, MethodClientWindowTitleSet, MethodClientShellSurfaceSet, MethodServerSshAgentRegister];
@@ -0,0 +1,2 @@
1
+ /** Method names of the prompt entry point, sorted. */
2
+ export declare const PROMPT_METHODS: readonly ["agent.explain", "agent.get", "agent.list", "agent.prompt", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList } from '../names/method.js';
4
+ /** Method names of the prompt entry point, sorted. */
5
+ export const PROMPT_METHODS = [MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentPrompt, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList];
@@ -0,0 +1,2 @@
1
+ /** Method names of the readOnlyContent entry point, sorted. */
2
+ export declare const READ_ONLY_CONTENT_METHODS: readonly ["agent.explain", "agent.get", "agent.list", "agent.read", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "pane.read", "pane.selection.read", "pane.wait_for_output", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentRead, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneSelectionRead, MethodPaneWaitForOutput, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList } from '../names/method.js';
4
+ /** Method names of the readOnlyContent entry point, sorted. */
5
+ export const READ_ONLY_CONTENT_METHODS = [MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentRead, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneRead, MethodPaneSelectionRead, MethodPaneWaitForOutput, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList];
@@ -0,0 +1,2 @@
1
+ /** Method names of the readOnly entry point, sorted. */
2
+ export declare const READ_ONLY_METHODS: readonly ["agent.explain", "agent.get", "agent.list", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "pane.wait_for_output", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
@@ -0,0 +1,5 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneWaitForOutput, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList } from '../names/method.js';
4
+ /** Method names of the readOnly entry point, sorted. */
5
+ export const READ_ONLY_METHODS = [MethodAgentExplain, MethodAgentGet, MethodAgentList, MethodAgentWait, MethodEventsSubscribe, MethodEventsWait, MethodIntegrationList, MethodLayoutExport, MethodPaneCurrent, MethodPaneEdges, MethodPaneGet, MethodPaneLayout, MethodPaneLinkResolve, MethodPaneList, MethodPaneNeighbor, MethodPaneProcessInfo, MethodPaneWaitForOutput, MethodPing, MethodPluginActionList, MethodPluginList, MethodPluginLogList, MethodServerAgentManifests, MethodSessionSnapshot, MethodTabGet, MethodTabList, MethodWorkspaceGet, MethodWorkspaceList, MethodWorktreeList];
@@ -0,0 +1,9 @@
1
+ /** Method names per entry point, sorted; the class sets are in tools/gen/capabilities.ts. */
2
+ export declare const ENTRY_METHODS: {
3
+ readonly readOnly: readonly ["agent.explain", "agent.get", "agent.list", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "pane.wait_for_output", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
4
+ readonly readOnlyContent: readonly ["agent.explain", "agent.get", "agent.list", "agent.read", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "pane.read", "pane.selection.read", "pane.wait_for_output", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
5
+ readonly prompt: readonly ["agent.explain", "agent.get", "agent.list", "agent.prompt", "integration.list", "layout.export", "pane.current", "pane.edges", "pane.get", "pane.layout", "pane.link.resolve", "pane.list", "pane.neighbor", "pane.process_info", "ping", "plugin.action.list", "plugin.list", "plugin.log.list", "server.agent_manifests", "session.snapshot", "tab.get", "tab.list", "workspace.get", "workspace.list", "worktree.list"];
6
+ readonly client: readonly ["agent.explain", "agent.focus", "agent.get", "agent.list", "agent.prompt", "agent.read", "agent.rename", "agent.send_keys", "agent.view.clear", "agent.view.set", "agent.wait", "events.subscribe", "events.wait", "integration.list", "layout.apply", "layout.export", "layout.set_split_ratio", "notification.show", "pane.clear", "pane.clear_agent_authority", "pane.copy_motion", "pane.copy_search", "pane.current", "pane.edges", "pane.focus", "pane.focus_direction", "pane.get", "pane.input.set", "pane.layout", "pane.link.resolve", "pane.list", "pane.move", "pane.neighbor", "pane.process_info", "pane.read", "pane.release_agent", "pane.rename", "pane.report_agent", "pane.report_agent_session", "pane.report_metadata", "pane.resize", "pane.scroll", "pane.selection.read", "pane.send_input", "pane.send_keys", "pane.send_text", "pane.split", "pane.swap", "pane.wait_for_output", "pane.zoom", "ping", "plugin.action.list", "plugin.disable", "plugin.list", "plugin.log.list", "plugin.pane.focus", "product_announcement.dismiss", "release_notes.dismiss", "server.agent_manifests", "session.snapshot", "tab.create", "tab.focus", "tab.get", "tab.list", "tab.move", "tab.rename", "workspace.create", "workspace.focus", "workspace.get", "workspace.list", "workspace.move", "workspace.move_block", "workspace.rename", "workspace.report_metadata", "worktree.create", "worktree.list", "worktree.open"];
7
+ readonly admin: readonly ["agent.explain", "agent.focus", "agent.get", "agent.list", "agent.prompt", "agent.read", "agent.rename", "agent.send_keys", "agent.start", "agent.view.clear", "agent.view.set", "agent.wait", "command.invoke", "events.subscribe", "events.wait", "integration.install", "integration.list", "integration.uninstall", "layout.apply", "layout.export", "layout.set_split_ratio", "notification.show", "pane.clear", "pane.clear_agent_authority", "pane.close", "pane.copy_motion", "pane.copy_search", "pane.current", "pane.edges", "pane.edit_scrollback", "pane.focus", "pane.focus_direction", "pane.get", "pane.input.set", "pane.layout", "pane.link.activate", "pane.link.resolve", "pane.list", "pane.move", "pane.neighbor", "pane.process_info", "pane.read", "pane.release_agent", "pane.rename", "pane.report_agent", "pane.report_agent_session", "pane.report_metadata", "pane.resize", "pane.scroll", "pane.selection.read", "pane.send_input", "pane.send_keys", "pane.send_text", "pane.split", "pane.swap", "pane.wait_for_output", "pane.zoom", "ping", "plugin.action.invoke", "plugin.action.list", "plugin.disable", "plugin.enable", "plugin.link", "plugin.list", "plugin.log.list", "plugin.pane.close", "plugin.pane.focus", "plugin.pane.open", "plugin.unlink", "popup.close", "product_announcement.dismiss", "release_notes.dismiss", "server.agent_manifests", "server.live_handoff", "server.reload_agent_manifests", "server.reload_config", "server.stop", "session.snapshot", "tab.close", "tab.create", "tab.focus", "tab.get", "tab.list", "tab.move", "tab.rename", "workspace.close", "workspace.create", "workspace.focus", "workspace.get", "workspace.list", "workspace.move", "workspace.move_block", "workspace.rename", "workspace.report_metadata", "worktree.create", "worktree.list", "worktree.open", "worktree.remove"];
8
+ readonly held: readonly ["client.window_title.clear", "client.window_title.set", "client_shell.surface.set", "server.ssh_agent.register"];
9
+ };
@@ -0,0 +1,17 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ import { READ_ONLY_METHODS } from './entries/read-only.js';
4
+ import { READ_ONLY_CONTENT_METHODS } from './entries/read-only-content.js';
5
+ import { PROMPT_METHODS } from './entries/prompt.js';
6
+ import { CLIENT_METHODS } from './entries/client.js';
7
+ import { ADMIN_METHODS } from './entries/admin.js';
8
+ import { HELD_METHODS } from './entries/held.js';
9
+ /** Method names per entry point, sorted; the class sets are in tools/gen/capabilities.ts. */
10
+ export const ENTRY_METHODS = {
11
+ "readOnly": READ_ONLY_METHODS,
12
+ "readOnlyContent": READ_ONLY_CONTENT_METHODS,
13
+ "prompt": PROMPT_METHODS,
14
+ "client": CLIENT_METHODS,
15
+ "admin": ADMIN_METHODS,
16
+ "held": HELD_METHODS,
17
+ };
@@ -0,0 +1,4 @@
1
+ export type ErrorBody = {
2
+ "code": string;
3
+ "message": string;
4
+ };
@@ -0,0 +1,3 @@
1
+ // GENERATED by tools/gen/ from schema/herdr-api.schema.json. Do not edit.
2
+ // herdr protocol 22, schema_version 1.
3
+ export {};