@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.
- package/README.md +87 -81
- package/dist/config.d.ts +65 -0
- package/dist/config.js +75 -0
- package/dist/daemon.d.ts +26 -0
- package/dist/daemon.js +160 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +297 -0
- package/dist/pty.d.ts +12 -0
- package/dist/pty.js +56 -0
- package/package.json +15 -25
- package/dist/automations.d.ts +0 -4
- package/dist/automations.d.ts.map +0 -1
- package/dist/automations.js +0 -191
- package/dist/automations.js.map +0 -1
- package/dist/catalog.d.ts +0 -48
- package/dist/catalog.d.ts.map +0 -1
- package/dist/catalog.js +0 -51
- package/dist/catalog.js.map +0 -1
- package/dist/changes.d.ts +0 -4
- package/dist/changes.d.ts.map +0 -1
- package/dist/changes.js +0 -601
- package/dist/changes.js.map +0 -1
- package/dist/cron.d.ts +0 -43
- package/dist/cron.d.ts.map +0 -1
- package/dist/cron.js +0 -211
- package/dist/cron.js.map +0 -1
- package/dist/git.d.ts +0 -16
- package/dist/git.d.ts.map +0 -1
- package/dist/git.js +0 -126
- package/dist/git.js.map +0 -1
- package/dist/host.d.ts +0 -24
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -5850
- package/dist/host.js.map +0 -1
- package/dist/index.d.ts +0 -36
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -34
- package/dist/index.js.map +0 -1
- package/dist/listen.d.ts +0 -3
- package/dist/listen.d.ts.map +0 -1
- package/dist/listen.js +0 -183
- package/dist/listen.js.map +0 -1
- package/dist/paging.d.ts +0 -38
- package/dist/paging.d.ts.map +0 -1
- package/dist/paging.js +0 -53
- package/dist/paging.js.map +0 -1
- package/dist/paths.d.ts +0 -15
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -19
- package/dist/paths.js.map +0 -1
- package/dist/resources.d.ts +0 -122
- package/dist/resources.d.ts.map +0 -1
- package/dist/resources.js +0 -494
- package/dist/resources.js.map +0 -1
- package/dist/rpc.d.ts +0 -63
- package/dist/rpc.d.ts.map +0 -1
- package/dist/rpc.js +0 -208
- package/dist/rpc.js.map +0 -1
- package/dist/scheduled.d.ts +0 -48
- package/dist/scheduled.d.ts.map +0 -1
- package/dist/scheduled.js +0 -325
- package/dist/scheduled.js.map +0 -1
- package/dist/terminals.d.ts +0 -29
- package/dist/terminals.d.ts.map +0 -1
- package/dist/terminals.js +0 -346
- package/dist/terminals.js.map +0 -1
- package/dist/tools.d.ts +0 -18
- package/dist/tools.d.ts.map +0 -1
- package/dist/tools.js +0 -65
- package/dist/tools.js.map +0 -1
- package/dist/types/agent.d.ts +0 -245
- package/dist/types/agent.d.ts.map +0 -1
- package/dist/types/agent.js +0 -3
- package/dist/types/agent.js.map +0 -1
- package/dist/types/automations.d.ts +0 -164
- package/dist/types/automations.d.ts.map +0 -1
- package/dist/types/automations.js +0 -3
- package/dist/types/automations.js.map +0 -1
- package/dist/types/catalog.d.ts +0 -30
- package/dist/types/catalog.d.ts.map +0 -1
- package/dist/types/catalog.js +0 -3
- package/dist/types/catalog.js.map +0 -1
- package/dist/types/changes.d.ts +0 -272
- package/dist/types/changes.d.ts.map +0 -1
- package/dist/types/changes.js +0 -3
- package/dist/types/changes.js.map +0 -1
- package/dist/types/common.d.ts +0 -9
- package/dist/types/common.d.ts.map +0 -1
- package/dist/types/common.js +0 -3
- package/dist/types/common.js.map +0 -1
- package/dist/types/host.d.ts +0 -372
- package/dist/types/host.d.ts.map +0 -1
- package/dist/types/host.js +0 -3
- package/dist/types/host.js.map +0 -1
- package/dist/types/index.d.ts +0 -20
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -8
- package/dist/types/index.js.map +0 -1
- package/dist/types/listen.d.ts +0 -48
- package/dist/types/listen.d.ts.map +0 -1
- package/dist/types/listen.js +0 -3
- package/dist/types/listen.js.map +0 -1
- package/dist/types/paging.d.ts +0 -10
- package/dist/types/paging.d.ts.map +0 -1
- package/dist/types/paging.js +0 -3
- package/dist/types/paging.js.map +0 -1
- package/dist/types/probe.d.ts +0 -46
- package/dist/types/probe.d.ts.map +0 -1
- package/dist/types/probe.js +0 -3
- package/dist/types/probe.js.map +0 -1
- package/dist/types/resources.d.ts +0 -83
- package/dist/types/resources.d.ts.map +0 -1
- package/dist/types/resources.js +0 -3
- package/dist/types/resources.js.map +0 -1
- package/dist/types/rpc.d.ts +0 -65
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/rpc.js +0 -3
- package/dist/types/rpc.js.map +0 -1
- package/dist/types/session.d.ts +0 -395
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/session.js +0 -3
- package/dist/types/session.js.map +0 -1
- package/dist/types/terminals.d.ts +0 -131
- package/dist/types/terminals.d.ts.map +0 -1
- package/dist/types/terminals.js +0 -3
- package/dist/types/terminals.js.map +0 -1
- package/dist/types/wire.d.ts +0 -62
- package/dist/types/wire.d.ts.map +0 -1
- package/dist/types/wire.js +0 -13
- package/dist/types/wire.js.map +0 -1
- package/dist/types/worktrees.d.ts +0 -86
- package/dist/types/worktrees.d.ts.map +0 -1
- package/dist/types/worktrees.js +0 -3
- package/dist/types/worktrees.js.map +0 -1
- package/dist/worktrees.d.ts +0 -27
- package/dist/worktrees.d.ts.map +0 -1
- package/dist/worktrees.js +0 -152
- package/dist/worktrees.js.map +0 -1
- package/src/automations.ts +0 -204
- package/src/catalog.ts +0 -53
- package/src/changes.ts +0 -629
- package/src/cron.ts +0 -251
- package/src/git.ts +0 -132
- package/src/host.ts +0 -5947
- package/src/index.ts +0 -40
- package/src/listen.ts +0 -240
- package/src/paging.ts +0 -56
- package/src/paths.ts +0 -19
- package/src/resources.ts +0 -513
- package/src/rpc.ts +0 -222
- package/src/scheduled.ts +0 -369
- package/src/terminals.ts +0 -353
- package/src/tools.ts +0 -64
- package/src/types/agent.ts +0 -255
- package/src/types/automations.ts +0 -164
- package/src/types/catalog.ts +0 -26
- package/src/types/changes.ts +0 -266
- package/src/types/common.ts +0 -9
- package/src/types/host.ts +0 -386
- package/src/types/index.ts +0 -27
- package/src/types/listen.ts +0 -53
- package/src/types/paging.ts +0 -11
- package/src/types/probe.ts +0 -42
- package/src/types/resources.ts +0 -107
- package/src/types/rpc.ts +0 -68
- package/src/types/session.ts +0 -415
- package/src/types/terminals.ts +0 -133
- package/src/types/wire.ts +0 -69
- package/src/types/worktrees.ts +0 -91
- package/src/worktrees.ts +0 -162
package/dist/types/agent.d.ts
DELETED
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
/** An agent backend, and everything the host asks one for. */
|
|
2
|
-
import type { Turn } from '@microsoft/agent-host-protocol';
|
|
3
|
-
import type { Bag } from './common.js';
|
|
4
|
-
import type { WireTurn } from './wire.js';
|
|
5
|
-
import type { Emit, Session } from './session.js';
|
|
6
|
-
import type { ToolDefinition } from '@microsoft/agent-host-protocol';
|
|
7
|
-
import type { Offered } from './probe.js';
|
|
8
|
-
/**
|
|
9
|
-
* A tool the host contributes, with the session it was contributed to
|
|
10
|
-
* already bound.
|
|
11
|
-
*
|
|
12
|
-
* The host's `HostTool` takes a `ToolCall` saying where it was called from;
|
|
13
|
-
* by the time a backend sees one that is answered, so what is left is a
|
|
14
|
-
* definition to offer the model and a function to call.
|
|
15
|
-
*/
|
|
16
|
-
export interface BoundTool {
|
|
17
|
-
/** What the model is offered. `name` is the id it calls. */
|
|
18
|
-
definition: ToolDefinition;
|
|
19
|
-
/**
|
|
20
|
-
* What running it does. Absent for a tool a client runs - see `owner`.
|
|
21
|
-
*/
|
|
22
|
-
run?(input: Record<string, unknown>): Promise<string> | string;
|
|
23
|
-
/**
|
|
24
|
-
* The client that runs this one, when it is a client's rather than the host's.
|
|
25
|
-
*
|
|
26
|
-
* A client announces what it provides on `SessionActiveClient.tools`, and
|
|
27
|
-
* the protocol makes that client responsible for executing the call and
|
|
28
|
-
* dispatching its result. So there is nothing to run here: the backend
|
|
29
|
-
* offers the tool to the model, reports the call against that client, and
|
|
30
|
-
* waits for it to say what happened.
|
|
31
|
-
*/
|
|
32
|
-
owner?: string;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* One session a backend already has, before the host has named it.
|
|
36
|
-
*
|
|
37
|
-
* Deliberately not a `Summary`: the resource URI, the provider and the status
|
|
38
|
-
* bits are the host's to decide - `IsRead` and `IsArchived` in particular are
|
|
39
|
-
* kept per client and a backend has never heard of them.
|
|
40
|
-
*/
|
|
41
|
-
export interface Listed {
|
|
42
|
-
/** The backend's own id for it. The host serves it as `<provider>:/<id>`. */
|
|
43
|
-
id: string;
|
|
44
|
-
/** Display title. */
|
|
45
|
-
title: string;
|
|
46
|
-
/** ISO 8601 timestamp of creation. */
|
|
47
|
-
createdAt: string;
|
|
48
|
-
/** ISO 8601 timestamp of the last change. */
|
|
49
|
-
modifiedAt: string;
|
|
50
|
-
/** Directories the agent has tool access to, as `file://` URIs. */
|
|
51
|
-
workingDirectories: string[];
|
|
52
|
-
}
|
|
53
|
-
/** How the host asks a backend to start a session. */
|
|
54
|
-
export interface Start {
|
|
55
|
-
/** The session channel URI the client chose. */
|
|
56
|
-
uri: string;
|
|
57
|
-
/** The chat channel URI beneath it. */
|
|
58
|
-
chatUri: string;
|
|
59
|
-
/** Config values in force, by key: this agent's defaults with the client's on top. */
|
|
60
|
-
settings: Record<string, unknown>;
|
|
61
|
-
/**
|
|
62
|
-
* The directory the client asked the agent to work in, if it named one.
|
|
63
|
-
*
|
|
64
|
-
* A path, not a `file://` URI. Absent means the client named none and the
|
|
65
|
-
* backend picks. A backend that will not work there should throw saying so:
|
|
66
|
-
* a directory accepted and then ignored is a session running somewhere
|
|
67
|
-
* nobody asked for, and nothing on screen says which.
|
|
68
|
-
*/
|
|
69
|
-
workingDirectory?: string;
|
|
70
|
-
/** Directories beside it the agent may also work in. */
|
|
71
|
-
additional?: string[];
|
|
72
|
-
/**
|
|
73
|
-
* Tools the host contributes to this session, for the backend to offer.
|
|
74
|
-
*
|
|
75
|
-
* The host's own, not this backend's: a backend that cannot take tools from
|
|
76
|
-
* anywhere ignores them, and the host still reports them on the session so
|
|
77
|
-
* a client knows they exist.
|
|
78
|
-
*/
|
|
79
|
-
tools?: BoundTool[];
|
|
80
|
-
/** The config schema to report on the session channel. This agent's own. */
|
|
81
|
-
schema(): Bag;
|
|
82
|
-
/** What to report as customizations until the backend reports its own. */
|
|
83
|
-
seedCustomizations?: Bag[];
|
|
84
|
-
/** Where state actions go. The host routes them to the right channel. */
|
|
85
|
-
emit: Emit;
|
|
86
|
-
/** A session of this backend's to continue, rather than starting a new one. */
|
|
87
|
-
resume?: string;
|
|
88
|
-
/** The prompt to resume *at*, so a fork leaves the turns after it behind. */
|
|
89
|
-
forkAt?: string;
|
|
90
|
-
/**
|
|
91
|
-
* The chain entry to resume *at*, keeping the id the session already had.
|
|
92
|
-
*
|
|
93
|
-
* A truncation rather than a fork: the turns after that point are dropped
|
|
94
|
-
* and the conversation carries on as itself, which is what `chat/truncated`
|
|
95
|
-
* asks for.
|
|
96
|
-
*/
|
|
97
|
-
rewindAt?: string;
|
|
98
|
-
/** Context the first turn carries to the backend without showing it. */
|
|
99
|
-
context?: string;
|
|
100
|
-
/** Turns already known, so a resumed session does not open empty. */
|
|
101
|
-
seed?: Bag[];
|
|
102
|
-
/**
|
|
103
|
-
* A file a tool is about to change, and the same file once it has.
|
|
104
|
-
*
|
|
105
|
-
* Optional both ways: a backend that cannot see its own tools does not call
|
|
106
|
-
* it, and a host with no changeset source does not pass one.
|
|
107
|
-
*/
|
|
108
|
-
onFileEdit?(turnId: string, path: string, phase: 'before' | 'after'): void;
|
|
109
|
-
/** Called once the backend has reported what it can do. */
|
|
110
|
-
onHandshake?(): void;
|
|
111
|
-
/**
|
|
112
|
-
* Tokens for this backend's protected resources, by resource identifier.
|
|
113
|
-
*
|
|
114
|
-
* Only resources this agent advertised, and only what the connection
|
|
115
|
-
* asking for the session pushed - authentication is per connection, so a
|
|
116
|
-
* token one client offered is never spent on another's session. Absent for
|
|
117
|
-
* a session nobody asked for: an automation firing at nine in the morning
|
|
118
|
-
* has no connection behind it and runs on the daemon's own credentials.
|
|
119
|
-
*
|
|
120
|
-
* What to *do* with one is the backend's business. The host knows a token
|
|
121
|
-
* belongs to a resource and nothing else about it.
|
|
122
|
-
*/
|
|
123
|
-
credentials?: Record<string, string>;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* A backend the host can run sessions on.
|
|
127
|
-
*
|
|
128
|
-
* One host serves several. `provider` is what a client names in
|
|
129
|
-
* `createSession` and what every session of this kind reports, so it has to
|
|
130
|
-
* be unique across the agents a host was given.
|
|
131
|
-
*
|
|
132
|
-
* Everything but `provider`, `displayName`, `schema`, `defaults` and `create`
|
|
133
|
-
* is optional, and what is left out is a real answer rather than a gap: a
|
|
134
|
-
* backend with no `list` has no sessions to browse, one with no `probe`
|
|
135
|
-
* offers no models and no commands until a session of its own reports them.
|
|
136
|
-
*/
|
|
137
|
-
export interface Agent {
|
|
138
|
-
/** The id clients name. Unique among a host's agents. */
|
|
139
|
-
provider: string;
|
|
140
|
-
/** What a person reads instead of the id. */
|
|
141
|
-
displayName: string;
|
|
142
|
-
/** One line about what this backend is. */
|
|
143
|
-
description?: string;
|
|
144
|
-
/**
|
|
145
|
-
* What a second chat in one session can be made from.
|
|
146
|
-
*
|
|
147
|
-
* Multi-chat itself is the host's doing - a second chat is `create` called
|
|
148
|
-
* twice - but these two are the backend's: a fork continues a conversation
|
|
149
|
-
* from one of its turns, and a side chat starts a fresh one that knows what
|
|
150
|
-
* a turn elsewhere said. A backend that declares neither still gets several
|
|
151
|
-
* chats; it just cannot be asked to make one out of another.
|
|
152
|
-
*/
|
|
153
|
-
chats?: {
|
|
154
|
-
fork?: boolean;
|
|
155
|
-
sideChat?: boolean;
|
|
156
|
-
};
|
|
157
|
-
/**
|
|
158
|
-
* Whether a session of this backend can work in more than one directory.
|
|
159
|
-
*
|
|
160
|
-
* The first is the process root and never moves; the rest are its peers.
|
|
161
|
-
* A backend that leaves this out gets one directory per session, which is
|
|
162
|
-
* what a client is told when the capability is absent.
|
|
163
|
-
*/
|
|
164
|
-
multipleDirectories?: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* OAuth protected resources this backend can be given a token for.
|
|
167
|
-
*
|
|
168
|
-
* RFC 9728 metadata, served on `AgentInfo.protectedResources`, and the only
|
|
169
|
-
* thing that makes `authenticate` callable: the protocol says a client's
|
|
170
|
-
* `resource` MUST match one the server has itself advertised, so a host that
|
|
171
|
-
* advertises none can be sent no token at all.
|
|
172
|
-
*
|
|
173
|
-
* `required: false` on an entry is a backend saying it works without one -
|
|
174
|
-
* this daemon runs as whoever started it and inherits their credentials, so
|
|
175
|
-
* a token is an override rather than a precondition.
|
|
176
|
-
*/
|
|
177
|
-
protectedResources?: Bag[];
|
|
178
|
-
/**
|
|
179
|
-
* What a session of this kind can be told to do differently.
|
|
180
|
-
*
|
|
181
|
-
* A JSON-Schema-shaped `{ properties }`. Each property may carry `title`,
|
|
182
|
-
* `description`, `enum`, `enumLabels`, `enumDescriptions`, `default`,
|
|
183
|
-
* `sessionMutable` and `scope`.
|
|
184
|
-
*
|
|
185
|
-
* The last two are what the *host* reads, and they are the only two things
|
|
186
|
-
* it needs to know about a key it otherwise knows nothing about.
|
|
187
|
-
* `sessionMutable: false` is refused on a running session rather than
|
|
188
|
-
* accepted and dropped. `scope` is `'session'` - the default - for a key the
|
|
189
|
-
* chats of one session share, and `'chat'` for one each chat answers for
|
|
190
|
-
* itself: a permission mode is the session's, and a model is the chat's.
|
|
191
|
-
* `scope` is this library's, not the protocol's, whose config schema is
|
|
192
|
-
* deliberately generic and says nothing about either.
|
|
193
|
-
*
|
|
194
|
-
* Everything else is between the backend and whatever client draws it.
|
|
195
|
-
*
|
|
196
|
-
* One schema, used before a session exists and by every session that does.
|
|
197
|
-
* Two copies drift, and a composer then offers one set of controls on the
|
|
198
|
-
* new-session screen and a different set the moment a session opens.
|
|
199
|
-
*/
|
|
200
|
-
schema(): Bag;
|
|
201
|
-
/** What each schema key sits at when nothing has been chosen. */
|
|
202
|
-
defaults(): Record<string, unknown>;
|
|
203
|
-
/**
|
|
204
|
-
* What the backend offers, asked once at startup.
|
|
205
|
-
*
|
|
206
|
-
* Before any session exists, because that is when a client asks: the models
|
|
207
|
-
* to pick from and the commands behind a slash are what a composer needs to
|
|
208
|
-
* draw itself, and waiting for the first session means offering them only
|
|
209
|
-
* once the conversation has started.
|
|
210
|
-
*/
|
|
211
|
-
probe?(): Promise<Offered>;
|
|
212
|
-
/**
|
|
213
|
-
* The directories this backend will work in.
|
|
214
|
-
*
|
|
215
|
-
* The host's answer to "may this client read that file": a resource outside
|
|
216
|
-
* every backend's directories is refused, because a host that served the
|
|
217
|
-
* whole filesystem is one that anybody who can reach the port can read
|
|
218
|
-
* `~/.ssh` through.
|
|
219
|
-
*
|
|
220
|
-
* Left out means this backend claims no directories, and contributes
|
|
221
|
-
* nothing to what may be browsed.
|
|
222
|
-
*/
|
|
223
|
-
directories?(): string[];
|
|
224
|
-
/** Sessions this backend already has. Ordering is the host's business. */
|
|
225
|
-
list?(): Promise<Listed[]>;
|
|
226
|
-
/**
|
|
227
|
-
* One past session's turns, read without starting anything.
|
|
228
|
-
*
|
|
229
|
-
* What makes a catalogue row openable: the host serves it from here, and
|
|
230
|
-
* starts nothing until somebody sends a turn to it. Undefined means this
|
|
231
|
-
* backend has no such session.
|
|
232
|
-
*
|
|
233
|
-
* A `WireTurn` rather than a `Bag[]`: everything around the parts is checked
|
|
234
|
-
* here, and each part is checked where it is built - a part is assembled by
|
|
235
|
-
* mutation as an agent talks, so the literal is what can be held to a shape
|
|
236
|
-
* and the variable after it cannot. This was a `Bag[]`, and inside it a
|
|
237
|
-
* rebuilt transcript wrote a tool-call `status` that is not one of the
|
|
238
|
-
* seven, left off three fields the completed state requires, and gave its
|
|
239
|
-
* content blocks no `type`.
|
|
240
|
-
*/
|
|
241
|
-
transcript?(id: string): Promise<WireTurn<Turn>[] | undefined>;
|
|
242
|
-
/** Start one. */
|
|
243
|
-
create(start: Start): Session;
|
|
244
|
-
}
|
|
245
|
-
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAE9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,UAAU,EAAE,cAAc,CAAC;IAC3B;;OAEG;IACH,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC/D;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACrB,6EAA6E;IAC7E,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,kBAAkB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAED,sDAAsD;AACtD,MAAM,WAAW,KAAK;IACpB,gDAAgD;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,uCAAuC;IACvC,OAAO,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;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;IAE/C;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,GAAG,EAAE,CAAC;IAE3B;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,IAAI,GAAG,CAAC;IACd,iEAAiE;IACjE,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEpC;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3B;;;;;;;;;;OAUG;IACH,WAAW,CAAC,IAAI,MAAM,EAAE,CAAC;IAEzB,0EAA0E;IAC1E,IAAI,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IACH,UAAU,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,SAAS,CAAC,CAAC;IAE/D,iBAAiB;IACjB,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC;CAC/B"}
|
package/dist/types/agent.js
DELETED
package/dist/types/agent.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/types/agent.ts"],"names":[],"mappings":"AAAA,8DAA8D"}
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
/** Automations: a session started by a trigger rather than by a person. */
|
|
2
|
-
import type { AutomationOperation, SessionOriginKind } from '@microsoft/agent-host-protocol';
|
|
3
|
-
import type { Bag } from './common.js';
|
|
4
|
-
/**
|
|
5
|
-
* One automation, as the catalogue channel carries it.
|
|
6
|
-
*
|
|
7
|
-
* The definition is the client's - it wrote it and can patch it - and
|
|
8
|
-
* everything around it is the store's: when it will next fire, what it has
|
|
9
|
-
* done, and which of the three verbs may be used on it now.
|
|
10
|
-
*/
|
|
11
|
-
export interface Automation {
|
|
12
|
-
/** `ahp-automation:/<id>`. The channel a run is reported against names it. */
|
|
13
|
-
resource: string;
|
|
14
|
-
/** What the client asked for. Opaque here except for `enabled` and `title`. */
|
|
15
|
-
definition: Bag;
|
|
16
|
-
/** ISO 8601, when a schedule says it will fire next. Absent for one nothing will fire. */
|
|
17
|
-
nextRunAt?: string;
|
|
18
|
-
/** Newest first. A summary per run, not the runs themselves. */
|
|
19
|
-
runs: Bag[];
|
|
20
|
-
/** More runs than were sent, if there are. */
|
|
21
|
-
runsNextCursor?: string;
|
|
22
|
-
/** Which of `update`, `remove`, `run` this store will accept for it now. */
|
|
23
|
-
operations: `${AutomationOperation}`[];
|
|
24
|
-
createdAt: string;
|
|
25
|
-
modifiedAt: string;
|
|
26
|
-
}
|
|
27
|
-
/** One run of one automation. */
|
|
28
|
-
export interface AutomationRun {
|
|
29
|
-
/** `ahp-automation-run:/<id>`, which is also a channel a client may watch. */
|
|
30
|
-
resource: string;
|
|
31
|
-
/** The automation it is a run of. */
|
|
32
|
-
automation: string;
|
|
33
|
-
/** Why it started: somebody pressed it, or a trigger fired. */
|
|
34
|
-
origin: Bag;
|
|
35
|
-
/** `pending`, `running`, `completed`, `failed`, `cancelled`, and when each happened. */
|
|
36
|
-
lifecycle: Bag;
|
|
37
|
-
/** The sessions it started. Usually one. */
|
|
38
|
-
sessions: string[];
|
|
39
|
-
/** The one a client should open when it opens the run. */
|
|
40
|
-
primarySession?: string;
|
|
41
|
-
}
|
|
42
|
-
/** How a store asks the host to start a session, since only the host can. */
|
|
43
|
-
export interface StartSession {
|
|
44
|
-
/** The provider named in the automation's session template, or the default. */
|
|
45
|
-
provider?: string;
|
|
46
|
-
/** Where it should work. */
|
|
47
|
-
workingDirectory?: string;
|
|
48
|
-
/** Config values for the new session. */
|
|
49
|
-
config?: Record<string, unknown>;
|
|
50
|
-
/** The first message, which is what the automation is *for*. */
|
|
51
|
-
text: string;
|
|
52
|
-
/**
|
|
53
|
-
* The run this session will belong to.
|
|
54
|
-
*
|
|
55
|
-
* Passed down rather than looked up, because it becomes the session's own
|
|
56
|
-
* `origin` and a catalogue is where it is read: a session that started at
|
|
57
|
-
* nine with nobody at the keyboard is otherwise a row with no account of
|
|
58
|
-
* itself, sitting among rows somebody typed.
|
|
59
|
-
*/
|
|
60
|
-
origin?: {
|
|
61
|
-
kind: `${SessionOriginKind}`;
|
|
62
|
-
automation: string;
|
|
63
|
-
run: string;
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Where a host's automations come from.
|
|
68
|
-
*
|
|
69
|
-
* A port, like the filesystem and the shell, and for a reason of its own: an
|
|
70
|
-
* automation that fires on a schedule needs something holding a clock, and a
|
|
71
|
-
* host embedded in an editor already has one while a daemon on a box may
|
|
72
|
-
* deliberately have none. A host given no store advertises no automations
|
|
73
|
-
* channel and answers `-32601` for all three commands - which is a true answer
|
|
74
|
-
* rather than an empty screen.
|
|
75
|
-
*
|
|
76
|
-
* Deciding it is time is the store's business. `run` is called when a person
|
|
77
|
-
* presses Run or when a store holding a clock says one is due through
|
|
78
|
-
* `onDue` - so what a schedule means, and when it comes round, is behind this
|
|
79
|
-
* interface and not in front of it.
|
|
80
|
-
*/
|
|
81
|
-
export interface AutomationStore {
|
|
82
|
-
/** Every automation, for the catalogue channel's snapshot. */
|
|
83
|
-
list(): Automation[];
|
|
84
|
-
/** One, by resource URI. Undefined for one this store has never heard of. */
|
|
85
|
-
get(resource: string): Automation | undefined;
|
|
86
|
-
/**
|
|
87
|
-
* The *event* triggers this store understands.
|
|
88
|
-
*
|
|
89
|
-
* Only event triggers: a schedule trigger is protocol-defined, is never
|
|
90
|
-
* listed here, and may always be written - what a client learns from a host
|
|
91
|
-
* that will not fire one is the absent `nextRunAt`, not an absence here.
|
|
92
|
-
* Manual is not a trigger either; an empty trigger list on a definition is
|
|
93
|
-
* what manual-only means. So empty is a real answer, and the usual one.
|
|
94
|
-
*/
|
|
95
|
-
triggers(options: {
|
|
96
|
-
provider?: string;
|
|
97
|
-
workingDirectories?: string[];
|
|
98
|
-
}): Bag[];
|
|
99
|
-
/** Write one the client has just described. */
|
|
100
|
-
create(resource: string, definition: Bag): Automation;
|
|
101
|
-
/** Patch one. Absent keys are left alone, which is what a patch means. */
|
|
102
|
-
update(resource: string, changes: Bag): Automation | undefined;
|
|
103
|
-
/** Forget one, and everything it ever did. */
|
|
104
|
-
remove(resource: string): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Start a run.
|
|
107
|
-
*
|
|
108
|
-
* `start` is handed in rather than reached for: only the host can create a
|
|
109
|
-
* session, and a store that could would be a second thing that knows what a
|
|
110
|
-
* session is. It answers the session URI, and the store records it.
|
|
111
|
-
*/
|
|
112
|
-
run(resource: string, origin: Bag, start: (options: StartSession) => Promise<string>): Promise<AutomationRun | undefined>;
|
|
113
|
-
/** One run's own state, for the channel a client watches it on. */
|
|
114
|
-
runOf(resource: string): AutomationRun | undefined;
|
|
115
|
-
/** A page of an automation's runs, newest first. */
|
|
116
|
-
runs(resource: string, cursor?: string): {
|
|
117
|
-
items: Bag[];
|
|
118
|
-
nextCursor?: string;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Let go of a session a run was holding.
|
|
122
|
-
*
|
|
123
|
-
* Called when the session is disposed: a run keeps a list of URIs and a
|
|
124
|
-
* host that removed the session without saying so would leave a run
|
|
125
|
-
* pointing at a channel nobody can open. Removing the primary clears it,
|
|
126
|
-
* which is what the protocol says. Answers whether the set actually moved,
|
|
127
|
-
* so a URI a run never had is a no-op rather than an announcement.
|
|
128
|
-
*
|
|
129
|
-
* Optional, like everything else a store may not do: a store that keeps its
|
|
130
|
-
* runs immutable simply leaves it out.
|
|
131
|
-
*/
|
|
132
|
-
unlink?(run: string, session: string): boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Called when something in here moved, so the host can say so.
|
|
135
|
-
*
|
|
136
|
-
* The store owns the clock and the host owns the channels, so this is the
|
|
137
|
-
* only way an automation that fired on its own reaches anybody.
|
|
138
|
-
*/
|
|
139
|
-
onChanged?(observer: (event: {
|
|
140
|
-
automation?: string;
|
|
141
|
-
run?: string;
|
|
142
|
-
removed?: string;
|
|
143
|
-
}) => void): void;
|
|
144
|
-
/**
|
|
145
|
-
* Called when this store's clock says one is due.
|
|
146
|
-
*
|
|
147
|
-
* The counterpart of `run`, and the reason that method takes `start` rather
|
|
148
|
-
* than holding it: a store that fires on its own still cannot create a
|
|
149
|
-
* session, so it says *which* automation is due and with what origin, and
|
|
150
|
-
* the host - the only thing that knows what a session is - calls `run`. A
|
|
151
|
-
* store with no clock never calls this, and a host that never wired it is a
|
|
152
|
-
* host where nothing fires by itself.
|
|
153
|
-
*
|
|
154
|
-
* The origin is the store's because only it knows which trigger came round,
|
|
155
|
-
* which occurrence it was, and whether it is catching one up.
|
|
156
|
-
*/
|
|
157
|
-
onDue?(observer: (event: {
|
|
158
|
-
automation: string;
|
|
159
|
-
origin: Bag;
|
|
160
|
-
}) => void): void;
|
|
161
|
-
/** Let go of the clock, so a daemon shutting down is not held open by one. */
|
|
162
|
-
close?(): void;
|
|
163
|
-
}
|
|
164
|
-
//# sourceMappingURL=automations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automations.d.ts","sourceRoot":"","sources":["../../src/types/automations.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAE7F,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,8EAA8E;IAC9E,QAAQ,EAAE,MAAM,CAAC;IACjB,+EAA+E;IAC/E,UAAU,EAAE,GAAG,CAAC;IAChB,0FAA0F;IAC1F,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,IAAI,EAA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EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,GAAG,IAAI,CAAC;IAE7E,8EAA8E;IAC9E,KAAK,CAAC,IAAI,IAAI,CAAC;CAChB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"automations.js","sourceRoot":"","sources":["../../src/types/automations.ts"],"names":[],"mappings":"AAAA,2EAA2E"}
|
package/dist/types/catalog.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/** The session catalogue, as the root channel reports it. */
|
|
2
|
-
/** One row of the session list. */
|
|
3
|
-
export interface Summary {
|
|
4
|
-
/** The session's channel URI, `ahp-session:/<id>`. */
|
|
5
|
-
resource: string;
|
|
6
|
-
/** The agent backend that runs it. Always `claude` here. */
|
|
7
|
-
provider: string;
|
|
8
|
-
/** Display title: the host's own summary, or the first prompt. */
|
|
9
|
-
title: string;
|
|
10
|
-
/** `SessionStatus` bitset - activity in the low bits, client flags above. */
|
|
11
|
-
status: number;
|
|
12
|
-
/** ISO 8601 timestamp of creation. */
|
|
13
|
-
createdAt: string;
|
|
14
|
-
/** ISO 8601 timestamp of the last change. */
|
|
15
|
-
modifiedAt: string;
|
|
16
|
-
/** Directories the agent has tool access to, as `file://` URIs. */
|
|
17
|
-
workingDirectories: string[];
|
|
18
|
-
/**
|
|
19
|
-
* What started it, when it was not a person.
|
|
20
|
-
*
|
|
21
|
-
* Absent for a session somebody opened, which is what the protocol says
|
|
22
|
-
* absent means. Only automations set it.
|
|
23
|
-
*/
|
|
24
|
-
origin?: {
|
|
25
|
-
kind: 'automation';
|
|
26
|
-
automation: string;
|
|
27
|
-
run: string;
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/types/catalog.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,mCAAmC;AACnC,MAAM,WAAW,OAAO;IACtB,sDAAsD;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,6EAA6E;IAC7E,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;OAKG;IACH,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,YAAY,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAClE"}
|
package/dist/types/catalog.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/types/catalog.ts"],"names":[],"mappings":"AAAA,6DAA6D"}
|