@corenel/harness 0.2.0 → 0.4.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/dist/acp/agentMap.d.ts +34 -0
- package/dist/acp/agentMap.d.ts.map +1 -0
- package/dist/acp/agentMap.js +110 -0
- package/dist/acp/agentMap.js.map +1 -0
- package/dist/acp/index.d.ts +4 -0
- package/dist/acp/index.d.ts.map +1 -0
- package/dist/acp/index.js +6 -0
- package/dist/acp/index.js.map +1 -0
- package/dist/acp/policyMap.d.ts +55 -0
- package/dist/acp/policyMap.d.ts.map +1 -0
- package/dist/acp/policyMap.js +121 -0
- package/dist/acp/policyMap.js.map +1 -0
- package/dist/acp/types.d.ts +41 -0
- package/dist/acp/types.d.ts.map +1 -0
- package/dist/acp/types.js +14 -0
- package/dist/acp/types.js.map +1 -0
- package/dist/api/backend.d.ts +39 -0
- package/dist/api/backend.d.ts.map +1 -0
- package/dist/api/backend.js +126 -0
- package/dist/api/backend.js.map +1 -0
- package/dist/api/client.d.ts +95 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +212 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/fileMirrorSource.d.ts +24 -0
- package/dist/api/fileMirrorSource.d.ts.map +1 -0
- package/dist/api/fileMirrorSource.js +59 -0
- package/dist/api/fileMirrorSource.js.map +1 -0
- package/dist/api/mirror.d.ts +102 -0
- package/dist/api/mirror.d.ts.map +1 -0
- package/dist/api/mirror.js +204 -0
- package/dist/api/mirror.js.map +1 -0
- package/dist/api/mirrorScheduler.d.ts +56 -0
- package/dist/api/mirrorScheduler.d.ts.map +1 -0
- package/dist/api/mirrorScheduler.js +167 -0
- package/dist/api/mirrorScheduler.js.map +1 -0
- package/dist/compression.d.ts +15 -1
- package/dist/compression.d.ts.map +1 -1
- package/dist/compression.js +32 -1
- package/dist/compression.js.map +1 -1
- package/dist/core/loop.d.ts +12 -0
- package/dist/core/loop.d.ts.map +1 -1
- package/dist/core/loop.js +138 -14
- package/dist/core/loop.js.map +1 -1
- package/dist/core/spawn.d.ts +54 -0
- package/dist/core/spawn.d.ts.map +1 -0
- package/dist/core/spawn.js +58 -0
- package/dist/core/spawn.js.map +1 -0
- package/dist/dag/executeNode.js +2 -2
- package/dist/fileSchema.js +1 -1
- package/dist/guardrail/guardrail.js +1 -1
- package/dist/guardrail/index.js +7 -7
- package/dist/guardrail/permission-service.js +1 -1
- package/dist/guardrail/serialize.js +1 -1
- package/dist/guardrail/store.js +2 -2
- package/dist/install/lockfile.d.ts +79 -0
- package/dist/install/lockfile.d.ts.map +1 -0
- package/dist/install/lockfile.js +155 -0
- package/dist/install/lockfile.js.map +1 -0
- package/dist/install/store.d.ts +13 -0
- package/dist/install/store.d.ts.map +1 -0
- package/dist/install/store.js +38 -0
- package/dist/install/store.js.map +1 -0
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +6 -1
- package/dist/log.js.map +1 -1
- package/dist/prompts/config.js +2 -2
- package/dist/prompts/host.d.ts +4 -0
- package/dist/prompts/host.d.ts.map +1 -1
- package/dist/prompts/host.js.map +1 -1
- package/dist/prompts/index.d.ts.map +1 -1
- package/dist/prompts/index.js +13 -6
- package/dist/prompts/index.js.map +1 -1
- package/dist/prompts/library/defaults.generated.js +2 -2
- package/dist/prompts/library/defaults.generated.js.map +1 -1
- package/dist/prompts/library/index.js +1 -1
- package/dist/providers/contextWindow.d.ts +19 -0
- package/dist/providers/contextWindow.d.ts.map +1 -0
- package/dist/providers/contextWindow.js +68 -0
- package/dist/providers/contextWindow.js.map +1 -0
- package/dist/providers/gateway.d.ts +3 -0
- package/dist/providers/gateway.d.ts.map +1 -1
- package/dist/providers/gateway.js +4 -1
- package/dist/providers/gateway.js.map +1 -1
- package/dist/sessions/apiLeaseStore.d.ts +10 -0
- package/dist/sessions/apiLeaseStore.d.ts.map +1 -0
- package/dist/sessions/apiLeaseStore.js +41 -0
- package/dist/sessions/apiLeaseStore.js.map +1 -0
- package/dist/sessions/blobGc.d.ts +62 -0
- package/dist/sessions/blobGc.d.ts.map +1 -0
- package/dist/sessions/blobGc.js +154 -0
- package/dist/sessions/blobGc.js.map +1 -0
- package/dist/sessions/fileRecallStore.js +1 -1
- package/dist/sessions/fileSessionStore.js +1 -1
- package/dist/sessions/head.d.ts +90 -0
- package/dist/sessions/head.d.ts.map +1 -0
- package/dist/sessions/head.js +82 -0
- package/dist/sessions/head.js.map +1 -0
- package/dist/sessions/inflight.d.ts +58 -0
- package/dist/sessions/inflight.d.ts.map +1 -0
- package/dist/sessions/inflight.js +0 -0
- package/dist/sessions/inflight.js.map +1 -0
- package/dist/sessions/lease.d.ts +59 -0
- package/dist/sessions/lease.d.ts.map +1 -0
- package/dist/sessions/lease.js +115 -0
- package/dist/sessions/lease.js.map +1 -0
- package/dist/sessions/leaseStore.d.ts +46 -0
- package/dist/sessions/leaseStore.d.ts.map +1 -0
- package/dist/sessions/leaseStore.js +58 -0
- package/dist/sessions/leaseStore.js.map +1 -0
- package/dist/sessions/timeline.d.ts +134 -0
- package/dist/sessions/timeline.d.ts.map +1 -0
- package/dist/sessions/timeline.js +127 -0
- package/dist/sessions/timeline.js.map +1 -0
- package/dist/sidecar/host.d.ts +241 -5
- package/dist/sidecar/host.d.ts.map +1 -1
- package/dist/sidecar/host.js +630 -5
- package/dist/sidecar/host.js.map +1 -1
- package/dist/sidecar/server.d.ts +124 -2
- package/dist/sidecar/server.d.ts.map +1 -1
- package/dist/sidecar/server.js +620 -9
- package/dist/sidecar/server.js.map +1 -1
- package/dist/sidecar/wsChannel.d.ts +4 -0
- package/dist/sidecar/wsChannel.d.ts.map +1 -0
- package/dist/sidecar/wsChannel.js +62 -0
- package/dist/sidecar/wsChannel.js.map +1 -0
- package/dist/skills.js +2 -2
- package/dist/snapshot/effects.d.ts +69 -0
- package/dist/snapshot/effects.d.ts.map +1 -0
- package/dist/snapshot/effects.js +67 -0
- package/dist/snapshot/effects.js.map +1 -0
- package/dist/snapshot/manifest.d.ts +73 -0
- package/dist/snapshot/manifest.d.ts.map +1 -0
- package/dist/snapshot/manifest.js +141 -0
- package/dist/snapshot/manifest.js.map +1 -0
- package/dist/snapshot/tree.d.ts +62 -0
- package/dist/snapshot/tree.d.ts.map +1 -0
- package/dist/snapshot/tree.js +147 -0
- package/dist/snapshot/tree.js.map +1 -0
- package/dist/tools/builtins.d.ts.map +1 -1
- package/dist/tools/builtins.js +67 -8
- package/dist/tools/builtins.js.map +1 -1
- package/dist/tools/callAgent.d.ts +16 -0
- package/dist/tools/callAgent.d.ts.map +1 -0
- package/dist/tools/callAgent.js +53 -0
- package/dist/tools/callAgent.js.map +1 -0
- package/dist/tools/files.d.ts +10 -0
- package/dist/tools/files.d.ts.map +1 -1
- package/dist/tools/files.js +159 -8
- package/dist/tools/files.js.map +1 -1
- package/dist/tools/http.js +1 -1
- package/dist/tools/namespaces.d.ts +1 -1
- package/dist/tools/namespaces.d.ts.map +1 -1
- package/dist/tools/namespaces.js +40 -2
- package/dist/tools/namespaces.js.map +1 -1
- package/dist/tools/procs.d.ts +18 -0
- package/dist/tools/procs.d.ts.map +1 -0
- package/dist/tools/procs.js +281 -0
- package/dist/tools/procs.js.map +1 -0
- package/dist/tools/todo.d.ts.map +1 -1
- package/dist/tools/todo.js +12 -0
- package/dist/tools/todo.js.map +1 -1
- package/package.json +18 -7
package/dist/sidecar/host.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AgentTool, IMemoryProvider, IKeyValueStore, ISearchProvider, ISessionStore, PermissionRequest, AskQuestion, AskAnswers, AgentEvent, PermissionDecision } from '@corenel/protocol';
|
|
1
|
+
import type { AgentTool, IMemoryProvider, IKeyValueStore, ISearchProvider, ISessionStore, PermissionRequest, AskQuestion, AskAnswers, AgentEvent, PermissionDecision, DaemonRunActivity, DaemonRegistration, ProcInfo, RunRecordInfo, SessionInfo, SessionRepoSpec, SessionSnapshotInfo } from '@corenel/protocol';
|
|
2
2
|
import type { FileService } from '@corenel/protocol';
|
|
3
|
-
import { type SidecarChannel, type SidecarInfo } from '@corenel/protocol';
|
|
3
|
+
import { type SidecarChannel, type SidecarInfo, type AcpPromptPart, type AcpModeInfo, type AcpStartOptions } from '@corenel/protocol';
|
|
4
4
|
/** The host's live capabilities a connected sidecar may proxy into. Only the ones
|
|
5
5
|
* provided are reachable; a proxy call to a missing one is rejected. */
|
|
6
6
|
export interface HostProviders {
|
|
@@ -23,6 +23,13 @@ export interface SidecarHostOptions {
|
|
|
23
23
|
/** The host's dot-dir name (e.g. '.corenel', '.prompd'), sent informationally in
|
|
24
24
|
* `hello` so the sidecar knows it for future workspace-state features. */
|
|
25
25
|
stateDir?: string;
|
|
26
|
+
/** The sidecar's working-directory set changed (a client added one). Carries the
|
|
27
|
+
* COMPLETE set, which REPLACES what the host holds -- never append. Fires on any
|
|
28
|
+
* connected client's add, not just this one's, so two browsers stay in agreement. */
|
|
29
|
+
onRoots?: (s: {
|
|
30
|
+
root: string;
|
|
31
|
+
roots: string[];
|
|
32
|
+
}) => void;
|
|
26
33
|
/** This client's durable identity, sent in `hello` so the sidecar can record
|
|
27
34
|
* who connected (routing Slice-2 sync). Additive: omitting them just means the
|
|
28
35
|
* sidecar records no host entry for this connection. */
|
|
@@ -54,6 +61,35 @@ export interface SidecarHostOptions {
|
|
|
54
61
|
decision: PermissionDecision;
|
|
55
62
|
by: 'client' | 'timeout' | 'unattended';
|
|
56
63
|
}) => void;
|
|
64
|
+
/** A daemon-side run started (no `endedAt`) or settled. Broadcast to every
|
|
65
|
+
* connected client, like a permission ask: a trigger-fired run has nobody
|
|
66
|
+
* watching, so this is the ONLY way a browser learns it happened. */
|
|
67
|
+
onRunActivity?: (activity: DaemonRunActivity) => void;
|
|
68
|
+
/** The COMPLETE set of agents the daemon will fire. Replaces the receiver's
|
|
69
|
+
* previous set - never merge, or an agent deleted on the daemon would live
|
|
70
|
+
* forever in a client that was connected when it went. */
|
|
71
|
+
onRegistrations?: (list: DaemonRegistration[]) => void;
|
|
72
|
+
}
|
|
73
|
+
/** What a caller wants to hear about one process. Both handlers are optional:
|
|
74
|
+
* a client that only wants to know when a build finishes should not have to
|
|
75
|
+
* accept its output. */
|
|
76
|
+
/** What a caller wants to hear about one session. Both optional: a client that
|
|
77
|
+
* only wants metrics should not have to accept logs. */
|
|
78
|
+
export interface SessionWatcher {
|
|
79
|
+
onMetrics?: (sample: unknown) => void;
|
|
80
|
+
onLog?: (line: string) => void;
|
|
81
|
+
}
|
|
82
|
+
export interface ProcWatcher {
|
|
83
|
+
onOut?: (chunk: {
|
|
84
|
+
seq: number;
|
|
85
|
+
stream: 'out' | 'err';
|
|
86
|
+
text: string;
|
|
87
|
+
}) => void;
|
|
88
|
+
/** Fires exactly once, then the watcher is dropped. */
|
|
89
|
+
onExit?: (end: {
|
|
90
|
+
code: number | null;
|
|
91
|
+
signal?: string;
|
|
92
|
+
}) => void;
|
|
57
93
|
}
|
|
58
94
|
export declare class SidecarHost {
|
|
59
95
|
private readonly ch;
|
|
@@ -64,25 +100,184 @@ export declare class SidecarHost {
|
|
|
64
100
|
private readonly httpPending;
|
|
65
101
|
private runSeq;
|
|
66
102
|
private readonly runPending;
|
|
103
|
+
private acpSeq;
|
|
104
|
+
private readonly acpPending;
|
|
67
105
|
private syncSeq;
|
|
68
106
|
private readonly syncPending;
|
|
107
|
+
private rootsSeq;
|
|
108
|
+
private readonly rootsPending;
|
|
109
|
+
private procSeq;
|
|
110
|
+
private readonly procPending;
|
|
111
|
+
/** Watchers by procId, NOT by request id: a process outlives the request that
|
|
112
|
+
* spawned it, and the same process can be watched by a spawn and later by a
|
|
113
|
+
* reattach. Keyed by the only durable identity there is. */
|
|
114
|
+
private readonly procWatchers;
|
|
115
|
+
private sessionSeq;
|
|
116
|
+
private readonly sessionPending;
|
|
117
|
+
/** Per-session stream handlers, keyed by session because a session outlives
|
|
118
|
+
* the request that started watching it. */
|
|
119
|
+
private readonly sessionWatchers;
|
|
69
120
|
private features;
|
|
70
121
|
private info;
|
|
71
122
|
private readonly imported;
|
|
72
123
|
private welcome;
|
|
73
124
|
constructor(opts: SidecarHostOptions);
|
|
74
125
|
/** Authenticate, then import the sidecar's tools. Resolves with their names,
|
|
75
|
-
* or rejects if the sidecar denies the token / protocol.
|
|
76
|
-
|
|
126
|
+
* or rejects if the sidecar denies the token / protocol.
|
|
127
|
+
*
|
|
128
|
+
* `timeoutMs`, when given, rejects the connection if no `welcome`/`denied`
|
|
129
|
+
* ever arrives -- a handshake that silently never completes (a peer that
|
|
130
|
+
* accepts the socket but never answers `hello`, e.g. something other than a
|
|
131
|
+
* SidecarServer on the other end) would otherwise hang this promise
|
|
132
|
+
* forever, with nothing to debug. Omit it to keep the old unbounded
|
|
133
|
+
* behavior (every existing caller relies on that default). */
|
|
134
|
+
connect(timeoutMs?: number): Promise<string[]>;
|
|
77
135
|
/** Drop the connection: unregister imported tools and fail anything in flight. */
|
|
78
136
|
disconnect(reason?: string): void;
|
|
79
137
|
private onMessage;
|
|
80
138
|
/** Whether the connected sidecar advertised the loopback HTTP proxy. */
|
|
81
139
|
supportsHttpProxy(): boolean;
|
|
140
|
+
/** Everything the sidecar advertised. A copy — the internal list must not be
|
|
141
|
+
* mutable from outside. For surfaces that SHOW capabilities; code that DEPENDS
|
|
142
|
+
* on one should use the specific supportsX() so the feature name lives here. */
|
|
143
|
+
advertisedFeatures(): string[];
|
|
82
144
|
/** Whether the connected sidecar advertised a wired crew runner — i.e. it can
|
|
83
145
|
* actually fire daemon-tier triggers (schedule/continuous/self-directed) on its
|
|
84
146
|
* own clock, not just serve tools. */
|
|
85
147
|
supportsRunner(): boolean;
|
|
148
|
+
/** True when the daemon was started with --acp and can proxy an external
|
|
149
|
+
* agent. A client must check this before offering the surface: a daemon
|
|
150
|
+
* without it answers acp-start with an error. */
|
|
151
|
+
supportsAcp(): boolean;
|
|
152
|
+
/** True when the daemon can run long-lived processes - i.e. the operator
|
|
153
|
+
* allowed shell. A client MUST check this before offering the surface: a
|
|
154
|
+
* daemon without it answers every proc message with an error. */
|
|
155
|
+
supportsProcs(): boolean;
|
|
156
|
+
/** Start a long-running command on the sidecar and stream its output.
|
|
157
|
+
*
|
|
158
|
+
* This is the counterpart to the one-shot `sidecar_shell_exec` tool, not a
|
|
159
|
+
* replacement: use the tool when you want the result of something that
|
|
160
|
+
* finishes, and this when you want to WATCH something that may not.
|
|
161
|
+
*
|
|
162
|
+
* The returned promise settles on the spawn, not on the exit - the process is
|
|
163
|
+
* still running when it resolves. `watch` keeps receiving output until
|
|
164
|
+
* `onExit`, which fires exactly once.
|
|
165
|
+
*/
|
|
166
|
+
procSpawn(command: string, watch?: ProcWatcher, opts?: {
|
|
167
|
+
cwd?: string;
|
|
168
|
+
root?: string;
|
|
169
|
+
label?: string;
|
|
170
|
+
}): Promise<ProcInfo>;
|
|
171
|
+
/** Re-attach to a process the daemon is already running - after a reload, or
|
|
172
|
+
* from a second tab. `sinceSeq` is the last chunk this client already has, so
|
|
173
|
+
* the replay is exactly the rest; omit it to replay the whole buffered tail.
|
|
174
|
+
*
|
|
175
|
+
* `truncated` in the result means the daemon's tail no longer reaches back to
|
|
176
|
+
* where you were: there is a GAP, and a UI that renders the replay as if it
|
|
177
|
+
* were continuous would be lying about what the process printed. */
|
|
178
|
+
procAttach(procId: string, watch?: ProcWatcher, sinceSeq?: number): Promise<{
|
|
179
|
+
proc: ProcInfo;
|
|
180
|
+
truncated: boolean;
|
|
181
|
+
}>;
|
|
182
|
+
/** Everything the daemon is running, or recently ran. Called on attach: a
|
|
183
|
+
* process nobody can see is worse than one that died. */
|
|
184
|
+
procList(): Promise<ProcInfo[]>;
|
|
185
|
+
/** Write to a running process's stdin. */
|
|
186
|
+
procInput(procId: string, text: string): Promise<void>;
|
|
187
|
+
/** Stop a process. Idempotent on the daemon side. */
|
|
188
|
+
procKill(procId: string): Promise<void>;
|
|
189
|
+
/** Stop receiving a process's output without stopping the process. */
|
|
190
|
+
procUnwatch(procId: string, watch: ProcWatcher): void;
|
|
191
|
+
private addProcWatcher;
|
|
192
|
+
/** True when the daemon runs sessions at all. A client MUST check this before
|
|
193
|
+
* offering the surface: a daemon without it answers every session message
|
|
194
|
+
* with an error. */
|
|
195
|
+
supportsSessions(): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* Whether the OPERATOR allowed run transcripts to be kept at all.
|
|
198
|
+
*
|
|
199
|
+
* False means no run on this daemon can be recorded however it asks, so a
|
|
200
|
+
* surface must not offer the choice — a control that cannot be honoured is
|
|
201
|
+
* worse than an absent one. True does NOT mean recording is on: each run
|
|
202
|
+
* still opts in (`run(..., { keepTranscript: true })`).
|
|
203
|
+
*/
|
|
204
|
+
supportsKeepTranscripts(): boolean;
|
|
205
|
+
/** Every session the daemon knows about. */
|
|
206
|
+
sessionList(): Promise<SessionInfo[]>;
|
|
207
|
+
/**
|
|
208
|
+
* Create a session on a directory, or FROM a repository.
|
|
209
|
+
*
|
|
210
|
+
* Exactly one of `workdir` and `repo`. With `repo` the daemon clones on its
|
|
211
|
+
* own host, using its own git credentials, and mounts the result — which is
|
|
212
|
+
* why the caller cannot name the directory: it does not exist yet. The
|
|
213
|
+
* returned SessionInfo carries `source` with the resolved commit.
|
|
214
|
+
*/
|
|
215
|
+
sessionCreate(spec: {
|
|
216
|
+
workdir?: string;
|
|
217
|
+
repo?: SessionRepoSpec;
|
|
218
|
+
owner?: string;
|
|
219
|
+
fromSnapshot?: string;
|
|
220
|
+
}): Promise<SessionInfo>;
|
|
221
|
+
/**
|
|
222
|
+
* Whether this daemon can create a session FROM a repository.
|
|
223
|
+
*
|
|
224
|
+
* False means the operator declared no `--clone-under` directory, so there is
|
|
225
|
+
* nowhere a checkout could be written and the option must not be offered.
|
|
226
|
+
*/
|
|
227
|
+
supportsSessionClone(): boolean;
|
|
228
|
+
/**
|
|
229
|
+
* Pause a session, and learn whether it actually drained.
|
|
230
|
+
*
|
|
231
|
+
* `drained: false` means work was STILL RUNNING when the wait gave up. A
|
|
232
|
+
* caller about to capture needs that: it is the difference between a snapshot
|
|
233
|
+
* and a torn one.
|
|
234
|
+
*/
|
|
235
|
+
sessionPause(sessionId: string, drainMs?: number): Promise<{
|
|
236
|
+
drained: boolean;
|
|
237
|
+
remaining: string[];
|
|
238
|
+
}>;
|
|
239
|
+
sessionResume(sessionId: string): Promise<void>;
|
|
240
|
+
sessionDestroy(sessionId: string): Promise<void>;
|
|
241
|
+
sessionCommit(sessionId: string, name?: string): Promise<SessionSnapshotInfo>;
|
|
242
|
+
/**
|
|
243
|
+
* One agent's finished runs, newest first, as the DAEMON recorded them.
|
|
244
|
+
*
|
|
245
|
+
* The durable counterpart to the live `run-activity` broadcasts: those say
|
|
246
|
+
* what is happening while this browser is attached and are lost on
|
|
247
|
+
* disconnect, this says what happened at all. Scoped to this client by the
|
|
248
|
+
* daemon, from the identity the connection authenticated with.
|
|
249
|
+
*
|
|
250
|
+
* An empty list means no record, which a caller renders rather than treats
|
|
251
|
+
* as an error — a daemon that keeps none is a normal daemon.
|
|
252
|
+
*/
|
|
253
|
+
runHistory(agent: string, limit?: number): Promise<RunRecordInfo[]>;
|
|
254
|
+
/**
|
|
255
|
+
* One run's kept events, as the daemon stored them.
|
|
256
|
+
*
|
|
257
|
+
* Empty means the words were never kept — the default, since transcripts are
|
|
258
|
+
* opt-in. A caller decides what to show from `RunRecordInfo.transcript`,
|
|
259
|
+
* which says whether there was ever anything to fetch.
|
|
260
|
+
*/
|
|
261
|
+
runTranscript(agent: string, runId: string): Promise<unknown[]>;
|
|
262
|
+
/** Every capture this daemon could restore from, newest first.
|
|
263
|
+
*
|
|
264
|
+
* An empty list is a real answer — a daemon whose backend cannot capture has
|
|
265
|
+
* nothing to restore from — so a caller uses the length to decide whether to
|
|
266
|
+
* offer the choice, not to detect a failure. */
|
|
267
|
+
sessionSnapshots(): Promise<SessionSnapshotInfo[]>;
|
|
268
|
+
/** Usage against the snapshot refuse-at-budget ceiling, BEFORE a capture
|
|
269
|
+
* ever hits it. `budgetBytes: 0` means the daemon's backend reports no
|
|
270
|
+
* budget at all (no capture capability) — a caller renders that as
|
|
271
|
+
* "not applicable", not as zero headroom. */
|
|
272
|
+
sessionSnapshotUsage(): Promise<{
|
|
273
|
+
usedBytes: number;
|
|
274
|
+
budgetBytes: number;
|
|
275
|
+
count: number;
|
|
276
|
+
}>;
|
|
277
|
+
/** Start receiving a session's metrics and logs. */
|
|
278
|
+
sessionWatch(sessionId: string, watch: SessionWatcher): Promise<void>;
|
|
279
|
+
sessionUnwatch(sessionId: string): Promise<void>;
|
|
280
|
+
private sessionCall;
|
|
86
281
|
/** The sidecar's advertised self-description (root/platform), or {} if it sent
|
|
87
282
|
* none. Valid only after connect() resolves. */
|
|
88
283
|
sidecarInfo(): SidecarInfo;
|
|
@@ -99,11 +294,40 @@ export declare class SidecarHost {
|
|
|
99
294
|
* `onEvent` as they arrive. Resolves once the run completes (`run-done`) with
|
|
100
295
|
* the daemon-assigned runId, final text, and stop reason; rejects on
|
|
101
296
|
* `run-error` or if the connection drops while the run is in flight. */
|
|
102
|
-
run(agent: string, input: string, onEvent: (e: AgentEvent) => void
|
|
297
|
+
run(agent: string, input: string, onEvent: (e: AgentEvent) => void, opts?: {
|
|
298
|
+
sessionId?: string;
|
|
299
|
+
/** Ask the daemon to KEEP this run's words. A request inside the
|
|
300
|
+
* operator's boundary: a daemon that did not permit transcripts keeps
|
|
301
|
+
* nothing regardless, so this can only ever narrow, never widen. Check
|
|
302
|
+
* `supportsKeepTranscripts()` before offering the choice. */
|
|
303
|
+
keepTranscript?: boolean;
|
|
304
|
+
}): Promise<{
|
|
103
305
|
runId: string;
|
|
104
306
|
text: string;
|
|
105
307
|
stopReason: string;
|
|
106
308
|
}>;
|
|
309
|
+
/** Start a proxied external ACP agent on the sidecar. The returned promise
|
|
310
|
+
* settles on the handshake; `onUpdate` keeps receiving the agent's stream for
|
|
311
|
+
* the life of the session. Permission asks do NOT come through here — they use
|
|
312
|
+
* the existing permission-ask broadcast, the same path a crew run uses. */
|
|
313
|
+
acpStart(target: string, onUpdate: (update: unknown) => void, opts?: AcpStartOptions): Promise<{
|
|
314
|
+
runId: string;
|
|
315
|
+
sessionId: string;
|
|
316
|
+
agent: string;
|
|
317
|
+
modes?: AcpModeInfo[];
|
|
318
|
+
currentModeId?: string;
|
|
319
|
+
resumed?: boolean;
|
|
320
|
+
}>;
|
|
321
|
+
/** Send one turn to the proxied agent. */
|
|
322
|
+
acpPrompt(text: string, content?: readonly AcpPromptPart[]): Promise<{
|
|
323
|
+
stopReason: string;
|
|
324
|
+
}>;
|
|
325
|
+
/** Switch the proxied agent's mode. Rejects when it does not offer that mode. */
|
|
326
|
+
acpSetMode(modeId: string): Promise<{
|
|
327
|
+
modeId: string;
|
|
328
|
+
}>;
|
|
329
|
+
/** Interrupt the current turn. Fire-and-forget, like cancel in ACP itself. */
|
|
330
|
+
acpCancel(): void;
|
|
107
331
|
/** Answer an outstanding permission ask. Fire-and-forget over the wire — the
|
|
108
332
|
* actual drop of the prompt is driven by the server's `permission-resolved`
|
|
109
333
|
* broadcast (`onPermissionResolved`), not by this call returning. */
|
|
@@ -118,6 +342,18 @@ export declare class SidecarHost {
|
|
|
118
342
|
* confining `path` to definition, non-state paths BEFORE calling this --
|
|
119
343
|
* this method has no opinion on what `path` is. */
|
|
120
344
|
hostSyncDelete(path: string): Promise<void>;
|
|
345
|
+
/** True when the operator started the sidecar with --allow-add-under, so a client
|
|
346
|
+
* may add a working directory this session. Feature-detected from the welcome --
|
|
347
|
+
* an older sidecar simply never advertises it. */
|
|
348
|
+
canAddRoots(): boolean;
|
|
349
|
+
/** Directory NAMES under `path`, or the declared areas themselves when `path` is
|
|
350
|
+
* omitted. Names only: never files, contents or stats. Rejects with the sidecar's
|
|
351
|
+
* message (e.g. outside every allowed area). */
|
|
352
|
+
browseRoots(path?: string): Promise<string[]>;
|
|
353
|
+
/** Promote `path` to a working directory for the rest of the session. Resolves on
|
|
354
|
+
* acceptance -- the resulting set arrives separately via `onRoots`, broadcast to
|
|
355
|
+
* every connected client -- and rejects with the sidecar's refusal message. */
|
|
356
|
+
addRoot(path: string): Promise<void>;
|
|
121
357
|
private invoke;
|
|
122
358
|
/** Answer a sidecar's proxy-provider call from the host's live store. The
|
|
123
359
|
* allowlist (HOST_METHODS) is the least-privilege boundary — a sidecar can
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../sidecar/host.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAC1E,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAC3E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAEL,KAAK,cAAc,EAAsC,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../sidecar/host.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAC1E,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,kBAAkB,EACjH,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,eAAe,EAAE,mBAAmB,EAC3E,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAEL,KAAK,cAAc,EAAsC,KAAK,WAAW,EAAE,KAAK,aAAa,EAC7F,KAAK,WAAW,EAAE,KAAK,eAAe,EACvC,MAAM,mBAAmB,CAAC;AAE3B;wEACwE;AACxE,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,aAA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