@ahpd/server 0.1.0 → 0.2.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 (170) hide show
  1. package/README.md +87 -81
  2. package/dist/config.d.ts +65 -0
  3. package/dist/config.js +75 -0
  4. package/dist/daemon.d.ts +26 -0
  5. package/dist/daemon.js +160 -0
  6. package/dist/main.d.ts +2 -0
  7. package/dist/main.js +297 -0
  8. package/dist/pty.d.ts +12 -0
  9. package/dist/pty.js +56 -0
  10. package/package.json +15 -25
  11. package/dist/automations.d.ts +0 -4
  12. package/dist/automations.d.ts.map +0 -1
  13. package/dist/automations.js +0 -191
  14. package/dist/automations.js.map +0 -1
  15. package/dist/catalog.d.ts +0 -48
  16. package/dist/catalog.d.ts.map +0 -1
  17. package/dist/catalog.js +0 -51
  18. package/dist/catalog.js.map +0 -1
  19. package/dist/changes.d.ts +0 -4
  20. package/dist/changes.d.ts.map +0 -1
  21. package/dist/changes.js +0 -601
  22. package/dist/changes.js.map +0 -1
  23. package/dist/cron.d.ts +0 -43
  24. package/dist/cron.d.ts.map +0 -1
  25. package/dist/cron.js +0 -211
  26. package/dist/cron.js.map +0 -1
  27. package/dist/git.d.ts +0 -16
  28. package/dist/git.d.ts.map +0 -1
  29. package/dist/git.js +0 -126
  30. package/dist/git.js.map +0 -1
  31. package/dist/host.d.ts +0 -24
  32. package/dist/host.d.ts.map +0 -1
  33. package/dist/host.js +0 -5850
  34. package/dist/host.js.map +0 -1
  35. package/dist/index.d.ts +0 -36
  36. package/dist/index.d.ts.map +0 -1
  37. package/dist/index.js +0 -34
  38. package/dist/index.js.map +0 -1
  39. package/dist/listen.d.ts +0 -3
  40. package/dist/listen.d.ts.map +0 -1
  41. package/dist/listen.js +0 -183
  42. package/dist/listen.js.map +0 -1
  43. package/dist/paging.d.ts +0 -38
  44. package/dist/paging.d.ts.map +0 -1
  45. package/dist/paging.js +0 -53
  46. package/dist/paging.js.map +0 -1
  47. package/dist/paths.d.ts +0 -15
  48. package/dist/paths.d.ts.map +0 -1
  49. package/dist/paths.js +0 -19
  50. package/dist/paths.js.map +0 -1
  51. package/dist/resources.d.ts +0 -122
  52. package/dist/resources.d.ts.map +0 -1
  53. package/dist/resources.js +0 -494
  54. package/dist/resources.js.map +0 -1
  55. package/dist/rpc.d.ts +0 -63
  56. package/dist/rpc.d.ts.map +0 -1
  57. package/dist/rpc.js +0 -208
  58. package/dist/rpc.js.map +0 -1
  59. package/dist/scheduled.d.ts +0 -48
  60. package/dist/scheduled.d.ts.map +0 -1
  61. package/dist/scheduled.js +0 -325
  62. package/dist/scheduled.js.map +0 -1
  63. package/dist/terminals.d.ts +0 -29
  64. package/dist/terminals.d.ts.map +0 -1
  65. package/dist/terminals.js +0 -346
  66. package/dist/terminals.js.map +0 -1
  67. package/dist/tools.d.ts +0 -18
  68. package/dist/tools.d.ts.map +0 -1
  69. package/dist/tools.js +0 -65
  70. package/dist/tools.js.map +0 -1
  71. package/dist/types/agent.d.ts +0 -245
  72. package/dist/types/agent.d.ts.map +0 -1
  73. package/dist/types/agent.js +0 -3
  74. package/dist/types/agent.js.map +0 -1
  75. package/dist/types/automations.d.ts +0 -164
  76. package/dist/types/automations.d.ts.map +0 -1
  77. package/dist/types/automations.js +0 -3
  78. package/dist/types/automations.js.map +0 -1
  79. package/dist/types/catalog.d.ts +0 -30
  80. package/dist/types/catalog.d.ts.map +0 -1
  81. package/dist/types/catalog.js +0 -3
  82. package/dist/types/catalog.js.map +0 -1
  83. package/dist/types/changes.d.ts +0 -272
  84. package/dist/types/changes.d.ts.map +0 -1
  85. package/dist/types/changes.js +0 -3
  86. package/dist/types/changes.js.map +0 -1
  87. package/dist/types/common.d.ts +0 -9
  88. package/dist/types/common.d.ts.map +0 -1
  89. package/dist/types/common.js +0 -3
  90. package/dist/types/common.js.map +0 -1
  91. package/dist/types/host.d.ts +0 -372
  92. package/dist/types/host.d.ts.map +0 -1
  93. package/dist/types/host.js +0 -3
  94. package/dist/types/host.js.map +0 -1
  95. package/dist/types/index.d.ts +0 -20
  96. package/dist/types/index.d.ts.map +0 -1
  97. package/dist/types/index.js +0 -8
  98. package/dist/types/index.js.map +0 -1
  99. package/dist/types/listen.d.ts +0 -48
  100. package/dist/types/listen.d.ts.map +0 -1
  101. package/dist/types/listen.js +0 -3
  102. package/dist/types/listen.js.map +0 -1
  103. package/dist/types/paging.d.ts +0 -10
  104. package/dist/types/paging.d.ts.map +0 -1
  105. package/dist/types/paging.js +0 -3
  106. package/dist/types/paging.js.map +0 -1
  107. package/dist/types/probe.d.ts +0 -46
  108. package/dist/types/probe.d.ts.map +0 -1
  109. package/dist/types/probe.js +0 -3
  110. package/dist/types/probe.js.map +0 -1
  111. package/dist/types/resources.d.ts +0 -83
  112. package/dist/types/resources.d.ts.map +0 -1
  113. package/dist/types/resources.js +0 -3
  114. package/dist/types/resources.js.map +0 -1
  115. package/dist/types/rpc.d.ts +0 -65
  116. package/dist/types/rpc.d.ts.map +0 -1
  117. package/dist/types/rpc.js +0 -3
  118. package/dist/types/rpc.js.map +0 -1
  119. package/dist/types/session.d.ts +0 -395
  120. package/dist/types/session.d.ts.map +0 -1
  121. package/dist/types/session.js +0 -3
  122. package/dist/types/session.js.map +0 -1
  123. package/dist/types/terminals.d.ts +0 -131
  124. package/dist/types/terminals.d.ts.map +0 -1
  125. package/dist/types/terminals.js +0 -3
  126. package/dist/types/terminals.js.map +0 -1
  127. package/dist/types/wire.d.ts +0 -62
  128. package/dist/types/wire.d.ts.map +0 -1
  129. package/dist/types/wire.js +0 -13
  130. package/dist/types/wire.js.map +0 -1
  131. package/dist/types/worktrees.d.ts +0 -86
  132. package/dist/types/worktrees.d.ts.map +0 -1
  133. package/dist/types/worktrees.js +0 -3
  134. package/dist/types/worktrees.js.map +0 -1
  135. package/dist/worktrees.d.ts +0 -27
  136. package/dist/worktrees.d.ts.map +0 -1
  137. package/dist/worktrees.js +0 -152
  138. package/dist/worktrees.js.map +0 -1
  139. package/src/automations.ts +0 -204
  140. package/src/catalog.ts +0 -53
  141. package/src/changes.ts +0 -629
  142. package/src/cron.ts +0 -251
  143. package/src/git.ts +0 -132
  144. package/src/host.ts +0 -5947
  145. package/src/index.ts +0 -40
  146. package/src/listen.ts +0 -240
  147. package/src/paging.ts +0 -56
  148. package/src/paths.ts +0 -19
  149. package/src/resources.ts +0 -513
  150. package/src/rpc.ts +0 -222
  151. package/src/scheduled.ts +0 -369
  152. package/src/terminals.ts +0 -353
  153. package/src/tools.ts +0 -64
  154. package/src/types/agent.ts +0 -255
  155. package/src/types/automations.ts +0 -164
  156. package/src/types/catalog.ts +0 -26
  157. package/src/types/changes.ts +0 -266
  158. package/src/types/common.ts +0 -9
  159. package/src/types/host.ts +0 -386
  160. package/src/types/index.ts +0 -27
  161. package/src/types/listen.ts +0 -53
  162. package/src/types/paging.ts +0 -11
  163. package/src/types/probe.ts +0 -42
  164. package/src/types/resources.ts +0 -107
  165. package/src/types/rpc.ts +0 -68
  166. package/src/types/session.ts +0 -415
  167. package/src/types/terminals.ts +0 -133
  168. package/src/types/wire.ts +0 -69
  169. package/src/types/worktrees.ts +0 -91
  170. package/src/worktrees.ts +0 -162
@@ -1,164 +0,0 @@
1
- /** Automations: a session started by a trigger rather than by a person. */
2
-
3
- import type { AutomationOperation, SessionOriginKind } from '@microsoft/agent-host-protocol';
4
-
5
- import type { Bag } from './common.js';
6
-
7
- /**
8
- * One automation, as the catalogue channel carries it.
9
- *
10
- * The definition is the client's - it wrote it and can patch it - and
11
- * everything around it is the store's: when it will next fire, what it has
12
- * done, and which of the three verbs may be used on it now.
13
- */
14
- export interface Automation {
15
- /** `ahp-automation:/<id>`. The channel a run is reported against names it. */
16
- resource: string;
17
- /** What the client asked for. Opaque here except for `enabled` and `title`. */
18
- definition: Bag;
19
- /** ISO 8601, when a schedule says it will fire next. Absent for one nothing will fire. */
20
- nextRunAt?: string;
21
- /** Newest first. A summary per run, not the runs themselves. */
22
- runs: Bag[];
23
- /** More runs than were sent, if there are. */
24
- runsNextCursor?: string;
25
- /** Which of `update`, `remove`, `run` this store will accept for it now. */
26
- operations: `${AutomationOperation}`[];
27
- createdAt: string;
28
- modifiedAt: string;
29
- }
30
-
31
- /** One run of one automation. */
32
- export interface AutomationRun {
33
- /** `ahp-automation-run:/<id>`, which is also a channel a client may watch. */
34
- resource: string;
35
- /** The automation it is a run of. */
36
- automation: string;
37
- /** Why it started: somebody pressed it, or a trigger fired. */
38
- origin: Bag;
39
- /** `pending`, `running`, `completed`, `failed`, `cancelled`, and when each happened. */
40
- lifecycle: Bag;
41
- /** The sessions it started. Usually one. */
42
- sessions: string[];
43
- /** The one a client should open when it opens the run. */
44
- primarySession?: string;
45
- }
46
-
47
- /** How a store asks the host to start a session, since only the host can. */
48
- export interface StartSession {
49
- /** The provider named in the automation's session template, or the default. */
50
- provider?: string;
51
- /** Where it should work. */
52
- workingDirectory?: string;
53
- /** Config values for the new session. */
54
- config?: Record<string, unknown>;
55
- /** The first message, which is what the automation is *for*. */
56
- text: string;
57
- /**
58
- * The run this session will belong to.
59
- *
60
- * Passed down rather than looked up, because it becomes the session's own
61
- * `origin` and a catalogue is where it is read: a session that started at
62
- * nine with nobody at the keyboard is otherwise a row with no account of
63
- * itself, sitting among rows somebody typed.
64
- */
65
- origin?: { kind: `${SessionOriginKind}`; automation: string; run: string };
66
- }
67
-
68
- /**
69
- * Where a host's automations come from.
70
- *
71
- * A port, like the filesystem and the shell, and for a reason of its own: an
72
- * automation that fires on a schedule needs something holding a clock, and a
73
- * host embedded in an editor already has one while a daemon on a box may
74
- * deliberately have none. A host given no store advertises no automations
75
- * channel and answers `-32601` for all three commands - which is a true answer
76
- * rather than an empty screen.
77
- *
78
- * Deciding it is time is the store's business. `run` is called when a person
79
- * presses Run or when a store holding a clock says one is due through
80
- * `onDue` - so what a schedule means, and when it comes round, is behind this
81
- * interface and not in front of it.
82
- */
83
- export interface AutomationStore {
84
- /** Every automation, for the catalogue channel's snapshot. */
85
- list(): Automation[];
86
- /** One, by resource URI. Undefined for one this store has never heard of. */
87
- get(resource: string): Automation | undefined;
88
-
89
- /**
90
- * The *event* triggers this store understands.
91
- *
92
- * Only event triggers: a schedule trigger is protocol-defined, is never
93
- * listed here, and may always be written - what a client learns from a host
94
- * that will not fire one is the absent `nextRunAt`, not an absence here.
95
- * Manual is not a trigger either; an empty trigger list on a definition is
96
- * what manual-only means. So empty is a real answer, and the usual one.
97
- */
98
- triggers(options: { provider?: string; workingDirectories?: string[] }): Bag[];
99
-
100
- /** Write one the client has just described. */
101
- create(resource: string, definition: Bag): Automation;
102
- /** Patch one. Absent keys are left alone, which is what a patch means. */
103
- update(resource: string, changes: Bag): Automation | undefined;
104
- /** Forget one, and everything it ever did. */
105
- remove(resource: string): boolean;
106
-
107
- /**
108
- * Start a run.
109
- *
110
- * `start` is handed in rather than reached for: only the host can create a
111
- * session, and a store that could would be a second thing that knows what a
112
- * session is. It answers the session URI, and the store records it.
113
- */
114
- run(
115
- resource: string,
116
- origin: Bag,
117
- start: (options: StartSession) => Promise<string>,
118
- ): Promise<AutomationRun | undefined>;
119
-
120
- /** One run's own state, for the channel a client watches it on. */
121
- runOf(resource: string): AutomationRun | undefined;
122
- /** A page of an automation's runs, newest first. */
123
- runs(resource: string, cursor?: string): { items: Bag[]; nextCursor?: string };
124
-
125
- /**
126
- * Let go of a session a run was holding.
127
- *
128
- * Called when the session is disposed: a run keeps a list of URIs and a
129
- * host that removed the session without saying so would leave a run
130
- * pointing at a channel nobody can open. Removing the primary clears it,
131
- * which is what the protocol says. Answers whether the set actually moved,
132
- * so a URI a run never had is a no-op rather than an announcement.
133
- *
134
- * Optional, like everything else a store may not do: a store that keeps its
135
- * runs immutable simply leaves it out.
136
- */
137
- unlink?(run: string, session: string): boolean;
138
-
139
- /**
140
- * Called when something in here moved, so the host can say so.
141
- *
142
- * The store owns the clock and the host owns the channels, so this is the
143
- * only way an automation that fired on its own reaches anybody.
144
- */
145
- onChanged?(observer: (event: { automation?: string; run?: string; removed?: string }) => void): void;
146
-
147
- /**
148
- * Called when this store's clock says one is due.
149
- *
150
- * The counterpart of `run`, and the reason that method takes `start` rather
151
- * than holding it: a store that fires on its own still cannot create a
152
- * session, so it says *which* automation is due and with what origin, and
153
- * the host - the only thing that knows what a session is - calls `run`. A
154
- * store with no clock never calls this, and a host that never wired it is a
155
- * host where nothing fires by itself.
156
- *
157
- * The origin is the store's because only it knows which trigger came round,
158
- * which occurrence it was, and whether it is catching one up.
159
- */
160
- onDue?(observer: (event: { automation: string; origin: Bag }) => void): void;
161
-
162
- /** Let go of the clock, so a daemon shutting down is not held open by one. */
163
- close?(): void;
164
- }
@@ -1,26 +0,0 @@
1
- /** The session catalogue, as the root channel reports it. */
2
-
3
- /** One row of the session list. */
4
- export interface Summary {
5
- /** The session's channel URI, `ahp-session:/<id>`. */
6
- resource: string;
7
- /** The agent backend that runs it. Always `claude` here. */
8
- provider: string;
9
- /** Display title: the host's own summary, or the first prompt. */
10
- title: string;
11
- /** `SessionStatus` bitset - activity in the low bits, client flags above. */
12
- status: number;
13
- /** ISO 8601 timestamp of creation. */
14
- createdAt: string;
15
- /** ISO 8601 timestamp of the last change. */
16
- modifiedAt: string;
17
- /** Directories the agent has tool access to, as `file://` URIs. */
18
- workingDirectories: string[];
19
- /**
20
- * What started it, when it was not a person.
21
- *
22
- * Absent for a session somebody opened, which is what the protocol says
23
- * absent means. Only automations set it.
24
- */
25
- origin?: { kind: 'automation'; automation: string; run: string };
26
- }
@@ -1,266 +0,0 @@
1
- /** What a session changed, as the protocol's changeset channel carries it. */
2
-
3
- import type {
4
- ChangesetOperationScope as Scope,
5
- ChangesetOperationTargetKind as TargetKind,
6
- ChangesetStatus,
7
- } from '@microsoft/agent-host-protocol';
8
-
9
- /** A pointer to content the state tree does not carry. */
10
- export interface ContentRef {
11
- uri: string;
12
- sizeHint?: number;
13
- contentType?: string;
14
- }
15
-
16
- /**
17
- * One file, on both sides of the change.
18
- *
19
- * `before` absent is a creation and `after` absent a deletion, which is how
20
- * the protocol says both rather than carrying a status word for them.
21
- */
22
- export interface FileEdit {
23
- before?: { uri: string; content: ContentRef };
24
- after?: { uri: string; content: ContentRef };
25
- diff?: { added?: number; removed?: number };
26
- }
27
-
28
- /** One row of a changeset. `id` is stable within it. */
29
- export interface ChangesetFile {
30
- id: string;
31
- edit: FileEdit;
32
- reviewed?: boolean;
33
- }
34
-
35
- /** What a client subscribed to a changeset URI is looking at. */
36
- export interface ChangesetState {
37
- /**
38
- * Where the computation is, in the protocol's own three words.
39
- *
40
- * Taken from `ChangesetStatus` rather than written out. This port said
41
- * `computing | complete | error` for the life of the project and the
42
- * protocol says `computing | ready | error`, so every changeset ever served
43
- * carried a status word no client could recognise - and nothing caught it,
44
- * because a hand-copied union is checked against nothing.
45
- */
46
- status: `${ChangesetStatus}`;
47
- files: ChangesetFile[];
48
- }
49
-
50
- /** The roll-up a catalogue row carries, so a list needs no subscription. */
51
- export interface ChangesSummary {
52
- files?: number;
53
- additions?: number;
54
- deletions?: number;
55
- }
56
-
57
- /**
58
- * One scope of change a directory can be asked about.
59
- *
60
- * The protocol nests changesets under the session's own URI - `uncommitted`,
61
- * `session`, `turn/<id>` - so a scope is the last part and the host composes
62
- * the rest. Keeping it that way round means a source never has to know what a
63
- * session is called.
64
- */
65
- export interface ChangesetScope {
66
- /** The path segment, e.g. `uncommitted`. */
67
- id: string;
68
- /** What a client shows, e.g. `Uncommitted Changes`. */
69
- label: string;
70
- description?: string;
71
- /**
72
- * What kind of changeset this is, so a client can group and sort without
73
- * parsing the URI. The protocol names `session`, `branch`, `uncommitted`,
74
- * `turn` and `compare-turns`, and says a client should fall back sensibly
75
- * on one it does not know.
76
- */
77
- changeKind: string;
78
- /**
79
- * Whether files in this changeset can be marked reviewed.
80
- *
81
- * A presence flag on the catalogue entry, which is what lets a client decide
82
- * whether to draw the checkbox *before* it subscribes to anything. Review is
83
- * not an operation: the client dispatches `changeset/filesReviewChanged` and
84
- * the server keeps the flag.
85
- */
86
- reviewable?: boolean;
87
- }
88
-
89
- /**
90
- * Where an operation may be invoked.
91
- *
92
- * The protocol's three: the whole changeset, one file in it, or a line range
93
- * within one file. A source declares which it accepts and the host refuses an
94
- * invocation whose target is not among them.
95
- */
96
- export type ChangesetOperationScope = `${Scope}`;
97
-
98
- /** The file, or the lines of it, an operation was pointed at. */
99
- export interface ChangesetOperationTarget {
100
- kind: `${TargetKind}`;
101
- /** The `ChangesetFile.id` of the row, which is a `file://` URI. */
102
- resource: string;
103
- /** Which side of the edit, where an operation can act on either. */
104
- side?: 'before' | 'after';
105
- /** Present iff `kind` is `range`. Lines are 1-based, as the protocol has them. */
106
- range?: { startLine: number; startColumn?: number; endLine: number; endColumn?: number };
107
- }
108
-
109
- /**
110
- * A verb a client may run against a changeset.
111
- *
112
- * Server-advertised, and that is the whole access model: `invokeChangesetOperation`
113
- * carries an `operationId` that must match one this source already offered for
114
- * this scope, so a client can ask for nothing that was not put in front of it.
115
- *
116
- * There is no `status` here because status is not the source's. Whether an
117
- * operation is disabled depends on whether the session is mid-turn, and whether
118
- * it is running depends on an invocation in flight - both of which the host
119
- * knows and a source does not.
120
- */
121
- export interface ChangesetOperation {
122
- /** Stable within the changeset, and what an invocation names. */
123
- id: string;
124
- /** The button. */
125
- label: string;
126
- /** Longer text, for a tooltip. */
127
- description?: string;
128
- /** The targets this operation accepts. */
129
- scopes: ChangesetOperationScope[];
130
- /**
131
- * The question to ask before running it.
132
- *
133
- * Its presence is also how the protocol says "this is destructive": a client
134
- * MUST show it, and SHOULD style the affirmative button as a warning.
135
- */
136
- confirmation?: string;
137
- /** A hint, e.g. `git-commit` or `discard`. */
138
- icon?: string;
139
- /** Operations sharing one are drawn together. */
140
- group?: string;
141
- /**
142
- * Whether running it writes to the working tree.
143
- *
144
- * What the host gates on: an operation that writes needs a write grant on the
145
- * resource, negotiated through `resourceRequest`, and is refused with `-32009`
146
- * until one is held. Declared here rather than inferred from the id, because
147
- * the host cannot know what a source's verbs do.
148
- */
149
- writes?: boolean;
150
- }
151
-
152
- /** One invocation, as the host hands it to the source. */
153
- export interface ChangesetOperationRequest {
154
- dir: string;
155
- session: string;
156
- /** The scope segment, e.g. `uncommitted` or `turn/abc`. */
157
- scope: string;
158
- operationId: string;
159
- /** Absent for a changeset-scoped operation. */
160
- target?: ChangesetOperationTarget;
161
- /**
162
- * What the session is called, offered as a commit subject.
163
- *
164
- * The host's to know and not this source's: a changeset is a set of files and
165
- * a session is a conversation, and the sentence somebody would write on a
166
- * commit is in the second one.
167
- */
168
- subject?: string;
169
- }
170
-
171
- /** What an invocation says for itself. Thrown errors are the failure path. */
172
- export interface ChangesetOperationResult {
173
- /** One line for the client to show. */
174
- message?: string;
175
- /**
176
- * Something to open afterwards, when the operation produced one.
177
- *
178
- * A `ContentRef` - a URI, a size hint, a content type - and whether the
179
- * client should open it in a browser rather than inline. A pull request a
180
- * commit-and-push produced is the case this exists for: the operation
181
- * succeeded, and the useful thing about it is a page somewhere.
182
- */
183
- followUp?: {
184
- content: { uri: string; sizeHint?: number; contentType?: string; nonce?: string };
185
- external?: boolean;
186
- };
187
- }
188
-
189
- /**
190
- * Where a host's file changes come from.
191
- *
192
- * A port, like the filesystem and the shell, and for the sharpest version of
193
- * the same reason: a diff comes from `git`, which is a binary that may not be
194
- * installed, against a directory that may not be a repository. A host given
195
- * none advertises no changesets, which is a true answer rather than an empty
196
- * screen.
197
- */
198
- export interface ChangesetSource {
199
- /**
200
- * Which scopes can be answered here. Empty for a directory that has none.
201
- *
202
- * `session` is passed because two of the protocol's scopes are a session's
203
- * rather than a directory's - what *this conversation* changed is not what
204
- * the working tree looks like, and a directory with three sessions in it has
205
- * three different answers.
206
- */
207
- scopes(dir: string, session: string): ChangesetScope[];
208
- /** The state behind one of them. */
209
- state(dir: string, session: string, scope: string): Promise<ChangesetState | undefined>;
210
- /** The roll-up for a catalogue row, cheap enough to ask per row. */
211
- summary(dir: string): ChangesSummary | undefined;
212
- /**
213
- * Content behind a ref this source minted.
214
- *
215
- * The `before` side of an edit is not a file on disk - it is what the file
216
- * used to be - so it cannot be served by the filesystem port. Undefined for
217
- * a URI this source does not own, which is how the host knows to try the
218
- * filesystem instead.
219
- */
220
- read?(uri: string): Promise<{ data: string; encoding: string } | undefined>;
221
- /** Look again, answering whether anything moved. */
222
- refresh?(dir: string): Promise<boolean>;
223
- /**
224
- * Mark files reviewed, or clear them.
225
- *
226
- * A person's bookkeeping about a diff they are reading, not a change to
227
- * anything on disk - which is why it is the one thing here a client may
228
- * write. Answers whether anything moved, so an idempotent toggle tells
229
- * nobody about a state it already had.
230
- */
231
- review?(dir: string, session: string, scope: string, files: string[], reviewed: boolean): boolean;
232
- /**
233
- * A file an agent is about to change, and the same file once it has.
234
- *
235
- * What makes a *turn's* changeset the turn's. Git can only ever say what a
236
- * working tree looks like now, so a turn asked about later would be handed
237
- * every turn after it as well; capturing both sides as the tool runs is the
238
- * only way the answer stays the turn's own.
239
- *
240
- * Reading the file is this source's business - it is the thing here that
241
- * has a filesystem - and the session only says which one and when.
242
- */
243
- observe?(dir: string, session: string, turnId: string, path: string, phase: 'before' | 'after'): void;
244
- /**
245
- * The verbs this source offers on one scope, in the order to draw them.
246
- *
247
- * Asked per scope because the answer differs by scope: the working tree can
248
- * be committed and a turn cannot, and what a turn changed can be put back
249
- * because both sides of every file in it were captured.
250
- *
251
- * Empty is a real answer and the one to give for a scope with nothing to do
252
- * to it. A source with no method at all advertises none anywhere, which is
253
- * what a host serving a directory it may not write looks like.
254
- */
255
- operations?(dir: string, session: string, scope: string): ChangesetOperation[];
256
- /**
257
- * Run one.
258
- *
259
- * The host has already checked that `operationId` is among what this source
260
- * offered for this scope, that the target's kind is one the operation
261
- * accepts, and that a write grant is held where the operation says it writes.
262
- * What is left is doing it, and throwing if it did not work - the protocol
263
- * signals failure by rejecting the request, not by a field on the result.
264
- */
265
- invoke?(request: ChangesetOperationRequest): Promise<ChangesetOperationResult>;
266
- }
@@ -1,9 +0,0 @@
1
- /** Shapes shared by more than one channel. */
2
-
3
- /**
4
- * An object with no declared shape.
5
- *
6
- * Used for JSON arriving off the wire and for the agent SDK's frames, both of
7
- * which are read field by field rather than trusted as a type.
8
- */
9
- export type Bag = Record<string, unknown>;