@tomradex/plugin-sdk 0.2.0 → 0.2.16
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 +1 -1
- package/dist/cli-hooks.d.ts +8 -0
- package/dist/cli-hooks.js +27 -0
- package/dist/contract.d.ts +292 -9
- package/dist/exports.d.ts +10 -0
- package/dist/exports.js +73 -0
- package/dist/im-markdown.d.ts +10 -0
- package/dist/im-markdown.js +257 -0
- package/dist/im.d.ts +319 -0
- package/dist/im.js +55 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.js +9 -1
- package/dist/language.d.ts +48 -0
- package/dist/language.js +62 -0
- package/dist/manifest.d.ts +78 -10
- package/dist/manifest.js +80 -13
- package/dist/models.d.ts +219 -0
- package/dist/models.js +2 -0
- package/dist/terminals.d.ts +72 -0
- package/dist/terminals.js +2 -0
- package/dist/web-search.d.ts +54 -0
- package/dist/web-search.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { Disposer } from "./contract.js";
|
|
2
|
+
/** SDK 0.2.10. Whether herdr can hand over a live terminal, and the command that fixes it when it cannot. */
|
|
3
|
+
export type TerminalBridgeState = {
|
|
4
|
+
state: "ready";
|
|
5
|
+
version: string;
|
|
6
|
+
} | {
|
|
7
|
+
state: "unsupported";
|
|
8
|
+
} | {
|
|
9
|
+
state: "notInstalled";
|
|
10
|
+
} | {
|
|
11
|
+
state: "notRunning";
|
|
12
|
+
version: string;
|
|
13
|
+
} | {
|
|
14
|
+
state: "tooOld";
|
|
15
|
+
version: string;
|
|
16
|
+
need: string;
|
|
17
|
+
fix: string;
|
|
18
|
+
} | {
|
|
19
|
+
state: "stale";
|
|
20
|
+
version: string;
|
|
21
|
+
server: string;
|
|
22
|
+
fix: string;
|
|
23
|
+
};
|
|
24
|
+
/** One picture of the terminal: ANSI bytes that paint it — the whole viewport when `full`, else only the cells that changed. */
|
|
25
|
+
export interface TerminalFrame {
|
|
26
|
+
seq: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
full: boolean;
|
|
30
|
+
bytes: Uint8Array;
|
|
31
|
+
}
|
|
32
|
+
/** A live terminal of a herdr pane. The frames repaint the viewport only: scrolling back is asked for with `scroll`. */
|
|
33
|
+
export interface TerminalHandle {
|
|
34
|
+
readonly paneId: string;
|
|
35
|
+
readonly mode: "control" | "observe";
|
|
36
|
+
onFrame(listener: (frame: TerminalFrame) => void): Disposer;
|
|
37
|
+
/** Once, when the stream ends: herdr's reason, or what it said when it would not attach. */
|
|
38
|
+
onClose(listener: (reason: string | null) => void): Disposer;
|
|
39
|
+
/** Keys and pastes; a controller's only — an observer's input is dropped. */
|
|
40
|
+
input(data: string | Uint8Array): void;
|
|
41
|
+
resize(cols: number, rows: number): void;
|
|
42
|
+
scroll(scroll: {
|
|
43
|
+
direction: "up" | "down";
|
|
44
|
+
lines: number;
|
|
45
|
+
column?: number;
|
|
46
|
+
row?: number;
|
|
47
|
+
modifiers?: number;
|
|
48
|
+
}): void;
|
|
49
|
+
mouse(mouse: {
|
|
50
|
+
action: "down" | "up" | "drag" | "move";
|
|
51
|
+
button?: "left" | "middle" | "right" | "none";
|
|
52
|
+
column: number;
|
|
53
|
+
row: number;
|
|
54
|
+
modifiers?: number;
|
|
55
|
+
}): void;
|
|
56
|
+
/** Detach: the pane keeps running in herdr. Also done for every terminal the plugin left open when it unloads. */
|
|
57
|
+
close(): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* SDK 0.2.10. Terminals of the herdr panes code sessions run in, through the
|
|
61
|
+
* app: a plugin neither reaches herdr's socket nor starts its CLI itself.
|
|
62
|
+
*/
|
|
63
|
+
export interface TerminalsApi {
|
|
64
|
+
state(): Promise<TerminalBridgeState>;
|
|
65
|
+
/** `control` (the default) takes input and size from any other owner; `observe` watches beside others. Rejects when `state()` is not ready. */
|
|
66
|
+
open(paneId: string, opts: {
|
|
67
|
+
mode?: "control" | "observe";
|
|
68
|
+
cols: number;
|
|
69
|
+
rows: number;
|
|
70
|
+
}): Promise<TerminalHandle>;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=terminals.d.ts.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Disposer } from "./contract.js";
|
|
2
|
+
type Maybe<T> = T | Promise<T>;
|
|
3
|
+
/** SDK 0.2.9. What the agent's `web_search` asks for; defaults are filled in before a provider sees it. */
|
|
4
|
+
export interface WebSearchRequest {
|
|
5
|
+
query: string;
|
|
6
|
+
maxResults: number;
|
|
7
|
+
topic: "general" | "news";
|
|
8
|
+
timeRange?: "day" | "week" | "month" | "year";
|
|
9
|
+
includeDomains?: string[];
|
|
10
|
+
excludeDomains?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface WebSearchHit {
|
|
13
|
+
title: string;
|
|
14
|
+
url: string;
|
|
15
|
+
/** An excerpt, not the page. */
|
|
16
|
+
content: string;
|
|
17
|
+
published?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface WebReadRequest {
|
|
20
|
+
urls: string[];
|
|
21
|
+
/** Keep only the passages relevant to this. */
|
|
22
|
+
query?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WebReadResponse {
|
|
25
|
+
pages: {
|
|
26
|
+
url: string;
|
|
27
|
+
content: string;
|
|
28
|
+
}[];
|
|
29
|
+
failed: {
|
|
30
|
+
url: string;
|
|
31
|
+
error: string;
|
|
32
|
+
}[];
|
|
33
|
+
}
|
|
34
|
+
/** One search backend, as the app's own providers are: the first registered one that is available answers. */
|
|
35
|
+
export interface WebSearchProviderSpec {
|
|
36
|
+
/** Namespaced like every id a plugin registers. */
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
/** Why it cannot answer yet (no API key, say), or null when it can. Called often and synchronously: keep it cheap. The agent reads it as the tool's error. */
|
|
40
|
+
unavailable(): string | null;
|
|
41
|
+
search(request: WebSearchRequest, signal: AbortSignal): Maybe<{
|
|
42
|
+
results: WebSearchHit[];
|
|
43
|
+
}>;
|
|
44
|
+
/** Pages as Markdown. Without it, `web_fetch` is left to another provider. */
|
|
45
|
+
read?(request: WebReadRequest, signal: AbortSignal): Maybe<WebReadResponse>;
|
|
46
|
+
/** The settings pane where the person sets it up: the plugin's own section id, or an app pane such as "assistant" (models). */
|
|
47
|
+
settings?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface WebSearchApi {
|
|
50
|
+
/** Answers the agent's `web_search` (and `web_fetch`, with `read`) until disposed or the plugin unloads. */
|
|
51
|
+
register(provider: WebSearchProviderSpec): Promise<Disposer>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=web-search.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tomradex/plugin-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "Haoyuan Tang",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"dist"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tomradex/domain": "0.2.
|
|
32
|
+
"@tomradex/domain": "0.2.16",
|
|
33
33
|
"zod": "^4.4.3"
|
|
34
34
|
}
|
|
35
35
|
}
|