@radheim/plugin 0.0.0-stage → 2.4.3
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 +19 -3
- package/dist/app.d.ts +5 -0
- package/dist/app.js +0 -0
- package/dist/effect/agent.d.ts +15 -0
- package/dist/effect/agent.js +0 -0
- package/dist/effect/aisdk.d.ts +20 -0
- package/dist/effect/aisdk.js +0 -0
- package/dist/effect/artifact.d.ts +42 -0
- package/dist/effect/artifact.js +0 -0
- package/dist/effect/command.d.ts +23 -0
- package/dist/effect/command.js +0 -0
- package/dist/effect/event.d.ts +9 -0
- package/dist/effect/event.js +0 -0
- package/dist/effect/index.d.ts +20 -0
- package/dist/effect/index.js +19 -0
- package/dist/effect/integration.d.ts +103 -0
- package/dist/effect/integration.js +3 -0
- package/dist/effect/mcp.d.ts +15 -0
- package/dist/effect/mcp.js +0 -0
- package/dist/effect/model.d.ts +29 -0
- package/dist/effect/model.js +0 -0
- package/dist/effect/permission.d.ts +30 -0
- package/dist/effect/permission.js +0 -0
- package/dist/effect/plugin.d.ts +69 -0
- package/dist/effect/plugin.js +3 -0
- package/dist/effect/provider.d.ts +34 -0
- package/dist/effect/provider.js +0 -0
- package/dist/effect/push.d.ts +52 -0
- package/dist/effect/push.js +0 -0
- package/dist/effect/reference.d.ts +14 -0
- package/dist/effect/reference.js +0 -0
- package/dist/effect/registration.d.ts +13 -0
- package/dist/effect/registration.js +0 -0
- package/dist/effect/rpc.d.ts +19 -0
- package/dist/effect/rpc.js +0 -0
- package/dist/effect/session.d.ts +217 -0
- package/dist/effect/session.js +0 -0
- package/dist/effect/shell.d.ts +14 -0
- package/dist/effect/shell.js +0 -0
- package/dist/effect/skill.d.ts +15 -0
- package/dist/effect/skill.js +1 -0
- package/dist/effect/storage.d.ts +8 -0
- package/dist/effect/storage.js +0 -0
- package/dist/effect/tool.d.ts +60 -0
- package/dist/effect/tool.js +1 -0
- package/dist/effect/vcs.d.ts +43 -0
- package/dist/effect/vcs.js +0 -0
- package/dist/effect/websearch.d.ts +20 -0
- package/dist/effect/websearch.js +0 -0
- package/dist/effect/worktree.d.ts +18 -0
- package/dist/effect/worktree.js +0 -0
- package/dist/gui/browser.d.ts +54 -0
- package/dist/gui/browser.js +3 -0
- package/dist/gui/context.d.ts +287 -0
- package/dist/gui/context.js +0 -0
- package/dist/gui/core.d.ts +581 -0
- package/dist/gui/core.js +86 -0
- package/dist/gui/declarations.d.ts +47 -0
- package/dist/gui/declarations.js +0 -0
- package/dist/gui/file.d.ts +122 -0
- package/dist/gui/file.js +7 -0
- package/dist/gui/host-apis.d.ts +2239 -0
- package/dist/gui/host-apis.js +0 -0
- package/dist/gui/icon-name.d.ts +2 -0
- package/dist/gui/icon-name.js +1 -0
- package/dist/gui/index.d.ts +7 -0
- package/dist/gui/index.js +6 -0
- package/dist/gui/internal.d.ts +44 -0
- package/dist/gui/internal.js +33 -0
- package/dist/gui/main.d.ts +279 -0
- package/dist/gui/main.js +20 -0
- package/dist/gui/modules.d.ts +15 -0
- package/dist/gui/modules.js +30 -0
- package/dist/gui/plugin.d.ts +87 -0
- package/dist/gui/plugin.js +9 -0
- package/dist/gui/reactive.d.ts +93 -0
- package/dist/gui/reactive.js +130 -0
- package/dist/gui/registries.d.ts +1045 -0
- package/dist/gui/registries.js +153 -0
- package/dist/gui/review.d.ts +74 -0
- package/dist/gui/review.js +3 -0
- package/dist/gui/scope.d.ts +64 -0
- package/dist/gui/scope.js +85 -0
- package/dist/gui/solid.d.ts +111 -0
- package/dist/gui/solid.js +74 -0
- package/dist/gui/vite.d.ts +24 -0
- package/dist/gui/vite.js +49 -0
- package/dist/host.d.ts +23 -0
- package/dist/host.js +65 -0
- package/dist/options.d.ts +1 -0
- package/dist/options.js +0 -0
- package/dist/permission.d.ts +22 -0
- package/dist/permission.js +12 -0
- package/dist/promise/adapter.d.ts +12 -0
- package/dist/promise/adapter.js +576 -0
- package/dist/promise/agent.d.ts +15 -0
- package/dist/promise/agent.js +0 -0
- package/dist/promise/aisdk.d.ts +20 -0
- package/dist/promise/aisdk.js +0 -0
- package/dist/promise/artifact.d.ts +49 -0
- package/dist/promise/artifact.js +0 -0
- package/dist/promise/command.d.ts +22 -0
- package/dist/promise/command.js +0 -0
- package/dist/promise/event.d.ts +7 -0
- package/dist/promise/event.js +0 -0
- package/dist/promise/index.d.ts +20 -0
- package/dist/promise/index.js +18 -0
- package/dist/promise/integration.d.ts +102 -0
- package/dist/promise/integration.js +3 -0
- package/dist/promise/mcp.d.ts +15 -0
- package/dist/promise/mcp.js +0 -0
- package/dist/promise/model.d.ts +29 -0
- package/dist/promise/model.js +0 -0
- package/dist/promise/permission.d.ts +29 -0
- package/dist/promise/permission.js +0 -0
- package/dist/promise/plugin.d.ts +70 -0
- package/dist/promise/plugin.js +3 -0
- package/dist/promise/provider.d.ts +34 -0
- package/dist/promise/provider.js +0 -0
- package/dist/promise/push.d.ts +50 -0
- package/dist/promise/push.js +0 -0
- package/dist/promise/reference.d.ts +13 -0
- package/dist/promise/reference.js +0 -0
- package/dist/promise/registration.d.ts +12 -0
- package/dist/promise/registration.js +0 -0
- package/dist/promise/rpc.d.ts +22 -0
- package/dist/promise/rpc.js +0 -0
- package/dist/promise/session.d.ts +217 -0
- package/dist/promise/session.js +0 -0
- package/dist/promise/shell.d.ts +14 -0
- package/dist/promise/shell.js +0 -0
- package/dist/promise/skill.d.ts +15 -0
- package/dist/promise/skill.js +0 -0
- package/dist/promise/storage.d.ts +8 -0
- package/dist/promise/storage.js +0 -0
- package/dist/promise/tool.d.ts +71 -0
- package/dist/promise/tool.js +2 -0
- package/dist/promise/vcs.d.ts +53 -0
- package/dist/promise/vcs.js +0 -0
- package/dist/promise/websearch.d.ts +21 -0
- package/dist/promise/websearch.js +0 -0
- package/dist/promise/worktree.d.ts +23 -0
- package/dist/promise/worktree.js +0 -0
- package/dist/rpc.d.ts +1 -0
- package/dist/rpc.js +1 -0
- package/dist/runtime-modules.d.ts +6 -0
- package/dist/runtime-modules.js +103 -0
- package/dist/runtime.d.ts +4 -0
- package/dist/runtime.js +46 -0
- package/dist/source.bun.d.ts +4 -0
- package/dist/source.bun.js +75 -0
- package/dist/source.d.ts +8 -0
- package/dist/source.js +59 -0
- package/dist/source.node.d.ts +5 -0
- package/dist/source.node.js +55 -0
- package/dist/source.package.d.ts +1 -0
- package/dist/source.package.js +15 -0
- package/dist/storage.d.ts +14 -0
- package/dist/storage.js +0 -0
- package/dist/tui/context.d.ts +500 -0
- package/dist/tui/context.js +0 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.js +2 -0
- package/dist/tui/plugin.d.ts +8 -0
- package/dist/tui/plugin.js +3 -0
- package/dist/tui/solid.d.ts +7 -0
- package/dist/tui/solid.js +16 -0
- package/dist/worktree.d.ts +18 -0
- package/dist/worktree.js +0 -0
- package/package.json +137 -4
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { ExperimentalSessionApi, SessionApi } from "@radheim/client/effect/api";
|
|
2
|
+
import type { GenerationOptionsFields, Message, SystemPart } from "@radheim/ai/effect";
|
|
3
|
+
import type { Agent } from "@radheim/schema/agent";
|
|
4
|
+
import type { Model } from "@radheim/schema/model";
|
|
5
|
+
import type { PromptInput } from "@radheim/schema/prompt-input";
|
|
6
|
+
import type { Session } from "@radheim/schema/session";
|
|
7
|
+
import type { SessionInbox } from "@radheim/schema/session-inbox";
|
|
8
|
+
import type { SessionError } from "@radheim/schema/session-error";
|
|
9
|
+
import type { SessionMessage } from "@radheim/schema/session-message";
|
|
10
|
+
import type { TokenUsage } from "@radheim/schema/token-usage";
|
|
11
|
+
import type { JsonSchema, Types } from "effect";
|
|
12
|
+
import type { ModelHooks } from "./registration.js";
|
|
13
|
+
export interface SessionPrompt {
|
|
14
|
+
readonly sessionID: Session.ID;
|
|
15
|
+
readonly messageID: SessionMessage.ID;
|
|
16
|
+
prompt: Types.DeepMutable<PromptInput.Prompt>;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
delivery: SessionInbox.Delivery;
|
|
19
|
+
}
|
|
20
|
+
/** Request overrides. Typed keys are generation settings; any other key is a provider option. */
|
|
21
|
+
export type SessionRequestOptions = Types.DeepMutable<GenerationOptionsFields> & Record<string, unknown>;
|
|
22
|
+
/** A request message. `metadata` is the stored Session message's metadata, for reading only; it is not sent to the model. */
|
|
23
|
+
export type SessionRequestMessage = Message & {
|
|
24
|
+
readonly metadata?: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
export interface SessionRequest {
|
|
27
|
+
readonly sessionID: Session.ID;
|
|
28
|
+
readonly model: Model.Ref;
|
|
29
|
+
/**
|
|
30
|
+
* The instructions part keeps each source's text in `metadata.experimental.instructions` as `{ key, text }`. It is
|
|
31
|
+
* not updated when a hook edits `text`. Experimental.
|
|
32
|
+
*/
|
|
33
|
+
system: Array<SystemPart>;
|
|
34
|
+
messages: Array<SessionRequestMessage>;
|
|
35
|
+
options: SessionRequestOptions;
|
|
36
|
+
}
|
|
37
|
+
export interface SessionContext extends SessionRequest {
|
|
38
|
+
readonly agent: Agent.ID;
|
|
39
|
+
tools: Record<string, {
|
|
40
|
+
description: string;
|
|
41
|
+
input: JsonSchema.JsonSchema;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
44
|
+
export interface SessionCompactionResult {
|
|
45
|
+
summary: string;
|
|
46
|
+
/** `native.messages`, when set, must be a provider replacement window; it replays instead of `summary`. */
|
|
47
|
+
native?: SessionMessage.Native;
|
|
48
|
+
metadata?: Record<string, unknown>;
|
|
49
|
+
tokens?: TokenUsage.Info;
|
|
50
|
+
}
|
|
51
|
+
export interface SessionCompaction extends SessionContext {
|
|
52
|
+
/** Set to use this compaction and skip the model request. */
|
|
53
|
+
result?: SessionCompactionResult;
|
|
54
|
+
}
|
|
55
|
+
export interface SessionGenerate extends SessionContext {
|
|
56
|
+
}
|
|
57
|
+
export interface SessionTitle extends SessionRequest {
|
|
58
|
+
/** Set to use this title and skip the model request. */
|
|
59
|
+
result?: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Why a Session request is being made. Auxiliary requests share the Session's
|
|
63
|
+
* hook identity but need to be told apart from the agent loop.
|
|
64
|
+
*/
|
|
65
|
+
export type SessionRequestKind = "primary" | "compaction" | "title" | "generate";
|
|
66
|
+
/**
|
|
67
|
+
* Runs whenever a Session resolves the model for a request, before anything is built for it. `model` starts as the
|
|
68
|
+
* Session's or agent's selection; change it to serve this request with another model from the same provider, including
|
|
69
|
+
* models hidden from the picker. The Session keeps its selection, and the request and its records use the new model.
|
|
70
|
+
* Router models such as GitHub Copilot's Auto use it. Experimental.
|
|
71
|
+
*/
|
|
72
|
+
export interface SessionModelResolve {
|
|
73
|
+
readonly sessionID: Session.ID;
|
|
74
|
+
readonly agent: Agent.ID;
|
|
75
|
+
readonly kind: SessionRequestKind;
|
|
76
|
+
model: Model.Ref;
|
|
77
|
+
}
|
|
78
|
+
export interface SessionModelRequest {
|
|
79
|
+
readonly sessionID: Session.ID;
|
|
80
|
+
readonly agent: Agent.ID;
|
|
81
|
+
readonly model: Model.Ref;
|
|
82
|
+
readonly kind: SessionRequestKind;
|
|
83
|
+
baseURL?: string;
|
|
84
|
+
headers: Record<string, string>;
|
|
85
|
+
}
|
|
86
|
+
export interface SessionHttpRequest {
|
|
87
|
+
readonly sessionID: Session.ID;
|
|
88
|
+
readonly agent: Agent.ID;
|
|
89
|
+
readonly model: Model.Ref;
|
|
90
|
+
readonly kind: SessionRequestKind;
|
|
91
|
+
request: Request;
|
|
92
|
+
response?: Response;
|
|
93
|
+
}
|
|
94
|
+
export interface SessionHttpResponse {
|
|
95
|
+
readonly sessionID: Session.ID;
|
|
96
|
+
readonly agent: Agent.ID;
|
|
97
|
+
readonly model: Model.Ref;
|
|
98
|
+
readonly kind: SessionRequestKind;
|
|
99
|
+
readonly request: Request;
|
|
100
|
+
response: Response;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Connection a WebSocket-backed request opens or reuses. Runs once per model call before the
|
|
104
|
+
* Session's socket is selected; changing `url` or `headers` reopens the socket. Experimental.
|
|
105
|
+
*/
|
|
106
|
+
export interface SessionWebSocketHandshake {
|
|
107
|
+
readonly sessionID: Session.ID;
|
|
108
|
+
readonly agent: Agent.ID;
|
|
109
|
+
readonly model: Model.Ref;
|
|
110
|
+
readonly kind: SessionRequestKind;
|
|
111
|
+
url: string;
|
|
112
|
+
headers: Record<string, string>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Outbound frame about to be written to the Session's socket, after the provider driver has built
|
|
116
|
+
* it. Replacing `frame` sends the replacement verbatim; the driver still tracks state from the
|
|
117
|
+
* provider's replies, so a rewrite that changes protocol meaning is on the plugin. Experimental.
|
|
118
|
+
*/
|
|
119
|
+
export interface SessionWebSocketSend {
|
|
120
|
+
readonly sessionID: Session.ID;
|
|
121
|
+
readonly agent: Agent.ID;
|
|
122
|
+
readonly model: Model.Ref;
|
|
123
|
+
readonly kind: SessionRequestKind;
|
|
124
|
+
frame: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Inbound frame read from the Session's socket, before the provider driver observes it. Replacing
|
|
128
|
+
* `frame` hands the replacement to the driver verbatim. Experimental.
|
|
129
|
+
*/
|
|
130
|
+
export interface SessionWebSocketReceive {
|
|
131
|
+
readonly sessionID: Session.ID;
|
|
132
|
+
readonly agent: Agent.ID;
|
|
133
|
+
readonly model: Model.Ref;
|
|
134
|
+
readonly kind: SessionRequestKind;
|
|
135
|
+
frame: string;
|
|
136
|
+
}
|
|
137
|
+
export type SessionRetryDecision = {
|
|
138
|
+
retry: false;
|
|
139
|
+
} | {
|
|
140
|
+
retry: true;
|
|
141
|
+
delay: number;
|
|
142
|
+
};
|
|
143
|
+
export interface SessionRetry {
|
|
144
|
+
readonly sessionID: Session.ID;
|
|
145
|
+
readonly agent: Agent.ID;
|
|
146
|
+
readonly model: Model.Ref;
|
|
147
|
+
readonly error: SessionError.Error;
|
|
148
|
+
readonly attempt: number;
|
|
149
|
+
decision: SessionRetryDecision;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Background work still running for the idle Session or one of its descendants. `sessionID` is
|
|
153
|
+
* the Session that owns the job: the idle Session itself, or a descendant such as a subagent child.
|
|
154
|
+
*/
|
|
155
|
+
export type SessionIdleBackground = {
|
|
156
|
+
readonly kind: "codemode";
|
|
157
|
+
readonly sessionID: Session.ID;
|
|
158
|
+
readonly jobID: string;
|
|
159
|
+
} | {
|
|
160
|
+
readonly kind: "shell";
|
|
161
|
+
readonly sessionID: Session.ID;
|
|
162
|
+
readonly shellID: string;
|
|
163
|
+
readonly command: string;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "subagent";
|
|
166
|
+
readonly sessionID: Session.ID;
|
|
167
|
+
readonly childSessionID: Session.ID;
|
|
168
|
+
readonly agent: string;
|
|
169
|
+
readonly description: string;
|
|
170
|
+
} | {
|
|
171
|
+
readonly kind: "image";
|
|
172
|
+
readonly sessionID: Session.ID;
|
|
173
|
+
readonly path: string;
|
|
174
|
+
readonly model: string;
|
|
175
|
+
} | {
|
|
176
|
+
readonly kind: "video";
|
|
177
|
+
readonly sessionID: Session.ID;
|
|
178
|
+
readonly path: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* Runs when a Session finishes model work and has no pending input, just before it goes idle.
|
|
182
|
+
* It does not run after interruption, failure, or control-only work such as a manual compaction.
|
|
183
|
+
* Input admitted by the hook, such as a synthetic message, runs in the same execution instead
|
|
184
|
+
* of the Session going idle.
|
|
185
|
+
*
|
|
186
|
+
* `background` lists work that is still running. When the Session's own shell or subagent finishes,
|
|
187
|
+
* its notice wakes the Session and the hook runs again, so a plugin that waits for that work can
|
|
188
|
+
* simply return. Work a descendant owns, such as a shell a subagent left running, wakes that
|
|
189
|
+
* descendant instead, so it is listed for information only. Notices admitted with `resume: false`,
|
|
190
|
+
* such as those recovered after a restart, wait for the next wake. Experimental.
|
|
191
|
+
*/
|
|
192
|
+
export interface SessionIdle {
|
|
193
|
+
readonly sessionID: Session.ID;
|
|
194
|
+
readonly background: ReadonlyArray<SessionIdleBackground>;
|
|
195
|
+
}
|
|
196
|
+
export interface SessionHooks {
|
|
197
|
+
readonly fork: {
|
|
198
|
+
readonly sessionID: Session.ID;
|
|
199
|
+
};
|
|
200
|
+
readonly prompt: SessionPrompt;
|
|
201
|
+
readonly context: SessionContext;
|
|
202
|
+
readonly compaction: SessionCompaction;
|
|
203
|
+
readonly generate: SessionGenerate;
|
|
204
|
+
readonly title: SessionTitle;
|
|
205
|
+
readonly "experimental.model.resolve": SessionModelResolve;
|
|
206
|
+
readonly "model.request": SessionModelRequest;
|
|
207
|
+
readonly "http.request": SessionHttpRequest;
|
|
208
|
+
readonly "http.response": SessionHttpResponse;
|
|
209
|
+
readonly "experimental.ws.handshake": SessionWebSocketHandshake;
|
|
210
|
+
readonly "experimental.ws.send": SessionWebSocketSend;
|
|
211
|
+
readonly "experimental.ws.receive": SessionWebSocketReceive;
|
|
212
|
+
readonly retry: SessionRetry;
|
|
213
|
+
readonly "experimental.idle": SessionIdle;
|
|
214
|
+
}
|
|
215
|
+
export type SessionDomain = Pick<SessionApi<unknown>, "list" | "create" | "get" | "remove" | "switchAgent" | "switchModel" | "prompt" | "generate" | "command" | "compact" | "synthetic" | "interrupt" | "update" | "move" | "context"> & Pick<ExperimentalSessionApi<unknown>, "wait" | "instructions"> & {
|
|
216
|
+
readonly hook: ModelHooks<SessionHooks>;
|
|
217
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Hooks } from "./registration.js";
|
|
2
|
+
export interface ShellCreateBefore {
|
|
3
|
+
command: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
timeout: number;
|
|
6
|
+
shell: string;
|
|
7
|
+
env: Record<string, string | undefined>;
|
|
8
|
+
}
|
|
9
|
+
export interface ShellHooks {
|
|
10
|
+
readonly "create.before": ShellCreateBefore;
|
|
11
|
+
}
|
|
12
|
+
export interface ShellDomain {
|
|
13
|
+
readonly hook: Hooks<ShellHooks>;
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SkillApi } from "@radheim/client/effect/api";
|
|
2
|
+
import { Skill } from "@radheim/schema/skill";
|
|
3
|
+
import type { Effect, Types } from "effect";
|
|
4
|
+
import type { Transform } from "./registration.js";
|
|
5
|
+
export interface SkillEditor {
|
|
6
|
+
list(): readonly Types.DeepMutable<Skill.Info>[];
|
|
7
|
+
get(id: string): Types.DeepMutable<Skill.Info> | undefined;
|
|
8
|
+
add(skill: Skill.Info): void;
|
|
9
|
+
update(id: string, update: (skill: Types.DeepMutable<Skill.Info>) => void): void;
|
|
10
|
+
remove(id: string): void;
|
|
11
|
+
}
|
|
12
|
+
export interface SkillDomain extends SkillApi<unknown> {
|
|
13
|
+
readonly transform: Transform<SkillEditor>;
|
|
14
|
+
readonly reload: () => Effect.Effect<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Skill } from "@radheim/schema/skill";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Effect, Schema } from "effect";
|
|
2
|
+
import type { StorageScanOptions, StorageScanResult } from "../storage.js";
|
|
3
|
+
export interface StorageDomain {
|
|
4
|
+
readonly get: (key: string) => Effect.Effect<Schema.Json | undefined>;
|
|
5
|
+
readonly set: (key: string, value: Schema.Json) => Effect.Effect<void>;
|
|
6
|
+
readonly remove: (key: string) => Effect.Effect<void>;
|
|
7
|
+
readonly scan: (options: StorageScanOptions) => Effect.Effect<StorageScanResult>;
|
|
8
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Tool } from "@radheim/schema/tool";
|
|
2
|
+
import type { Agent } from "@radheim/schema/agent";
|
|
3
|
+
import type { Session } from "@radheim/schema/session";
|
|
4
|
+
import type { SessionMessage } from "@radheim/schema/session-message";
|
|
5
|
+
import type { Effect, Types } from "effect";
|
|
6
|
+
import type { Hooks, Transform } from "./registration.js";
|
|
7
|
+
export interface ToolEditor {
|
|
8
|
+
list(): readonly (Tool.Info & {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
})[];
|
|
11
|
+
get(id: string): (Tool.Info & {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
}) | undefined;
|
|
14
|
+
namespace(namespace: Tool.Namespace): void;
|
|
15
|
+
add<Input extends Tool.ValueSchema<any>, Output extends Tool.ValueSchema<any> | undefined = undefined, CMInput extends Tool.ValueSchema<any> = Input, CMOutput extends Tool.ValueSchema<any> | undefined = Output>(tool: Tool.Info<Input, Output, CMInput, CMOutput>): void;
|
|
16
|
+
/** Updates an existing tool; missing IDs are ignored. */
|
|
17
|
+
update(id: string, update: (tool: Types.Mutable<Tool.Info>) => void): void;
|
|
18
|
+
remove(id: string): void;
|
|
19
|
+
}
|
|
20
|
+
export interface ToolHooks {
|
|
21
|
+
readonly "execute.before": {
|
|
22
|
+
tool: string;
|
|
23
|
+
readonly info?: Tool.Info;
|
|
24
|
+
readonly codemode: boolean;
|
|
25
|
+
readonly sessionID: Session.ID;
|
|
26
|
+
readonly agent: Agent.ID;
|
|
27
|
+
readonly messageID: SessionMessage.ID;
|
|
28
|
+
readonly id: Tool.CallID;
|
|
29
|
+
input: unknown;
|
|
30
|
+
};
|
|
31
|
+
readonly "execute.after": {
|
|
32
|
+
readonly tool: string;
|
|
33
|
+
readonly info?: Tool.Info;
|
|
34
|
+
readonly codemode: boolean;
|
|
35
|
+
readonly sessionID: Session.ID;
|
|
36
|
+
readonly agent: Agent.ID;
|
|
37
|
+
readonly messageID: SessionMessage.ID;
|
|
38
|
+
readonly id: Tool.CallID;
|
|
39
|
+
readonly input: unknown;
|
|
40
|
+
} & ({
|
|
41
|
+
readonly status: "completed";
|
|
42
|
+
result: Tool.Result;
|
|
43
|
+
} | {
|
|
44
|
+
readonly status: "error";
|
|
45
|
+
error: Tool.Error;
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export interface ToolFailures extends Record<keyof ToolHooks, unknown> {
|
|
49
|
+
readonly "execute.before": Tool.Error;
|
|
50
|
+
readonly "execute.after": never;
|
|
51
|
+
}
|
|
52
|
+
export interface ToolDomain {
|
|
53
|
+
readonly transform: Transform<ToolEditor>;
|
|
54
|
+
readonly reload: () => Effect.Effect<void>;
|
|
55
|
+
/** Currently registered tools, after every transform, keyed by effective name. */
|
|
56
|
+
readonly list: () => Effect.Effect<readonly (Tool.Info & {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
})[]>;
|
|
59
|
+
readonly hook: Hooks<ToolHooks, ToolFailures>;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Tool } from "@radheim/schema/tool";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { VcsApi } from "@radheim/client/effect/api";
|
|
2
|
+
import type { FileDiff } from "@radheim/schema/file-diff";
|
|
3
|
+
import type { Vcs } from "@radheim/schema/vcs";
|
|
4
|
+
import type { Effect } from "effect";
|
|
5
|
+
import type { Transform } from "./registration.js";
|
|
6
|
+
export interface VcsScope {
|
|
7
|
+
readonly directory: string;
|
|
8
|
+
readonly worktree: string;
|
|
9
|
+
readonly canonical: string;
|
|
10
|
+
readonly store?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VcsBranchesInput extends VcsScope {
|
|
13
|
+
readonly search?: string;
|
|
14
|
+
readonly limit?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface VcsDiffInput extends VcsScope {
|
|
17
|
+
readonly mode: Vcs.Mode;
|
|
18
|
+
readonly base?: string;
|
|
19
|
+
readonly context: number;
|
|
20
|
+
readonly maxOutputBytes: number;
|
|
21
|
+
readonly untracked?: Vcs.Untracked;
|
|
22
|
+
}
|
|
23
|
+
export interface VcsDefinition {
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly name: string;
|
|
26
|
+
readonly init?: (input: VcsScope) => Effect.Effect<void, unknown>;
|
|
27
|
+
readonly info: (input: VcsScope) => Effect.Effect<Vcs.Info, unknown>;
|
|
28
|
+
readonly base?: (input: VcsScope) => Effect.Effect<Vcs.Base | null, unknown>;
|
|
29
|
+
readonly branches: (input: VcsBranchesInput) => Effect.Effect<Vcs.BranchList, unknown>;
|
|
30
|
+
readonly status: (input: VcsScope) => Effect.Effect<readonly Vcs.FileStatus[], unknown>;
|
|
31
|
+
readonly diff: (input: VcsDiffInput) => Effect.Effect<readonly FileDiff.Info[], unknown>;
|
|
32
|
+
}
|
|
33
|
+
export interface VcsDomain extends Omit<VcsApi<unknown>, "init"> {
|
|
34
|
+
readonly transform: Transform<VcsEditor>;
|
|
35
|
+
readonly reload: () => Effect.Effect<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface VcsEditor {
|
|
38
|
+
add(definition: VcsDefinition): void;
|
|
39
|
+
readonly default: {
|
|
40
|
+
get(): string | undefined;
|
|
41
|
+
set(selection: string): void;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { WebSearch } from "@radheim/schema/websearch";
|
|
2
|
+
import type { WebSearchApi } from "@radheim/client/effect/api";
|
|
3
|
+
import type { Effect } from "effect";
|
|
4
|
+
import type { Transform } from "./registration.js";
|
|
5
|
+
export interface WebSearchDefinition {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly execute: (input: WebSearch.ProviderInput) => Effect.Effect<readonly WebSearch.Result[], unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface WebSearchDomain extends WebSearchApi<unknown> {
|
|
11
|
+
readonly transform: Transform<WebSearchEditor>;
|
|
12
|
+
readonly reload: () => Effect.Effect<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface WebSearchEditor {
|
|
15
|
+
add(definition: WebSearchDefinition): void;
|
|
16
|
+
readonly default: {
|
|
17
|
+
get(): string | false | undefined;
|
|
18
|
+
set(selection: string | false): void;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorktreeApi } from "@radheim/client/effect/api";
|
|
2
|
+
import type { Effect } from "effect";
|
|
3
|
+
import type { WorktreeCreateInput, WorktreeEntry, WorktreeRemoveInput, WorktreeResult } from "../worktree.js";
|
|
4
|
+
import type { Transform } from "./registration.js";
|
|
5
|
+
export interface WorktreeDefinition {
|
|
6
|
+
readonly id: string;
|
|
7
|
+
readonly create: (input: WorktreeCreateInput) => Effect.Effect<WorktreeResult, unknown>;
|
|
8
|
+
readonly remove: (input: WorktreeRemoveInput) => Effect.Effect<void, unknown>;
|
|
9
|
+
readonly list: (sourceDirectory: string) => Effect.Effect<readonly WorktreeEntry[], unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface WorktreeEditor {
|
|
12
|
+
/** Registers an implementation and selects it as the default. Later active registrations win. */
|
|
13
|
+
add(definition: WorktreeDefinition): void;
|
|
14
|
+
}
|
|
15
|
+
export interface WorktreeDomain extends WorktreeApi<unknown> {
|
|
16
|
+
readonly transform: Transform<WorktreeEditor>;
|
|
17
|
+
readonly reload: () => Effect.Effect<void>;
|
|
18
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Contract } from "./core.js";
|
|
2
|
+
import type { Brand } from "effect";
|
|
3
|
+
import type { SessionRef } from "./host-apis.js";
|
|
4
|
+
/** Experimental: an opaque close right, not an agent or layout tab ID. May change without compatibility guarantees. */
|
|
5
|
+
export type ExperimentalBrowserTab = string & Brand.Brand<"ExperimentalBrowserTab">;
|
|
6
|
+
/** What the built-in browser offers other plugins: a session's desktop browser pane. Read it with `ctx.use(Browser)`. */
|
|
7
|
+
export interface Browser {
|
|
8
|
+
/**
|
|
9
|
+
* The desktop browser pane exists for this session (the session is attached to a pane).
|
|
10
|
+
*
|
|
11
|
+
* @param session - The session to check.
|
|
12
|
+
* @returns True when the session has a pane.
|
|
13
|
+
*/
|
|
14
|
+
attached(session: SessionRef): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* A workspace file (relative path) or http(s) URL can open in the pane for this session.
|
|
17
|
+
*
|
|
18
|
+
* @param session - The session whose pane would open it.
|
|
19
|
+
* @param path - A workspace-relative file path or an http(s) URL; omit it to ask whether the pane can open anything.
|
|
20
|
+
* @returns True when `open` or `openFile` would succeed.
|
|
21
|
+
*/
|
|
22
|
+
canOpen(session: SessionRef, path?: string): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Opens an HTTP(S) page without embedded credentials. A file:// URL opens as a scoped preview only on the built-in local server and inside the session's workspace. Other file:// URLs are refused; use `openFile` for workspace files on non-built-in servers.
|
|
25
|
+
*
|
|
26
|
+
* @param session - The session whose pane opens it.
|
|
27
|
+
* @param url - The URL to open.
|
|
28
|
+
*/
|
|
29
|
+
open(session: SessionRef, url: string): void;
|
|
30
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
31
|
+
readonly experimental: {
|
|
32
|
+
/**
|
|
33
|
+
* Opens a new tab and returns an opaque handle for this plugin instance. Resolves once the tab exists, also while its page still loads or after its load failed, which the tab itself shows. Rejects if the pane is unavailable, the session is not on screen, or the address opened no page (as a download does), which leaves no tab.
|
|
34
|
+
* @param session - The session whose pane opens it.
|
|
35
|
+
* @param url - The URL to open.
|
|
36
|
+
*/
|
|
37
|
+
open(session: SessionRef, url: string): Promise<ExperimentalBrowserTab>;
|
|
38
|
+
/**
|
|
39
|
+
* Requests closure of the tab this instance opened. The handle survives session suspension and rebind, not a plugin or window restart or a takeover navigation.
|
|
40
|
+
* @returns True if closed now. False for unknown, foreign, revoked or already closed handles, or if beforeunload asks for confirmation. The person can still confirm or cancel in the pane.
|
|
41
|
+
* @param id - The handle returned by this plugin's `open`, not an agent or layout tab ID.
|
|
42
|
+
*/
|
|
43
|
+
close(id: ExperimentalBrowserTab): Promise<boolean>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Opens a workspace file as a browser tab. Local tabs display file: addresses and remote tabs display workspace: addresses. Check `canOpen(session, path)` first.
|
|
47
|
+
*
|
|
48
|
+
* @param session - The session whose pane opens it.
|
|
49
|
+
* @param path - The workspace-relative file path.
|
|
50
|
+
*/
|
|
51
|
+
openFile(session: SessionRef, path: string): void;
|
|
52
|
+
}
|
|
53
|
+
/** The browser plugin provides this on desktop. Inactive on web or while the plugin is off. */
|
|
54
|
+
export declare const Browser: Contract<Browser, "browser">;
|