@llmguard/opencode 0.0.0-stage → 0.1.1
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 +53 -2
- package/bin/darwin-amd64/helper +0 -0
- package/bin/darwin-arm64/helper +0 -0
- package/bin/linux-amd64/helper +0 -0
- package/bin/linux-arm64/helper +0 -0
- package/bin/manifest.json +51 -0
- package/bin/windows-amd64/helper.exe +0 -0
- package/bin/windows-arm64/helper.exe +0 -0
- package/bridge/client.d.ts +55 -0
- package/bridge/client.js +425 -0
- package/bridge/framing.d.ts +19 -0
- package/bridge/framing.js +110 -0
- package/bridge/process.d.ts +38 -0
- package/bridge/process.js +378 -0
- package/bridge/protocol.d.ts +184 -0
- package/bridge/protocol.js +683 -0
- package/connection-catalog.d.ts +69 -0
- package/connection-catalog.js +287 -0
- package/connections-tui.d.ts +11 -0
- package/connections-tui.js +394 -0
- package/demasking.d.ts +2 -0
- package/demasking.js +445 -0
- package/gui-experimental.cjs +33 -0
- package/hook-trace.d.ts +2 -0
- package/hook-trace.js +35 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/licenses/Go-LICENSE +27 -0
- package/messages.d.ts +230 -0
- package/messages.js +231 -0
- package/native/index.d.ts +1 -0
- package/native/index.js +1 -0
- package/native/tui.d.ts +1 -0
- package/native/tui.js +1 -0
- package/package.json +47 -4
- package/plugin-runtime.d.ts +3 -0
- package/plugin-runtime.js +3 -0
- package/plugin-settings.d.ts +77 -0
- package/plugin-settings.js +487 -0
- package/plugin.d.ts +41 -0
- package/plugin.js +10 -0
- package/response-diagnostics.d.ts +13 -0
- package/response-diagnostics.js +142 -0
- package/runtime/attachments.d.ts +4 -0
- package/runtime/attachments.js +19 -0
- package/runtime/errors.d.ts +18 -0
- package/runtime/errors.js +26 -0
- package/runtime/json.d.ts +14 -0
- package/runtime/json.js +243 -0
- package/runtime/limits.d.ts +2 -0
- package/runtime/limits.js +3 -0
- package/runtime/native-edit.d.ts +14 -0
- package/runtime/native-edit.js +73 -0
- package/runtime/runtime.d.ts +43 -0
- package/runtime/runtime.js +345 -0
- package/runtime/session-state.d.ts +13 -0
- package/runtime/session-state.js +73 -0
- package/runtime/text-layout.d.ts +9 -0
- package/runtime/text-layout.js +47 -0
- package/server.d.ts +1 -0
- package/server.js +1 -0
- package/settings-rpc.d.ts +511 -0
- package/settings-rpc.js +197 -0
- package/tui-messages.d.ts +1 -0
- package/tui-messages.js +84 -0
- package/tui.d.ts +17 -0
- package/tui.js +427 -0
- package/v1/hooks.d.ts +81 -0
- package/v1/hooks.js +97 -0
- package/v1/projection.d.ts +32 -0
- package/v1/projection.js +217 -0
- package/v1.d.ts +2 -0
- package/v1.js +2 -0
- package/v2/projection.d.ts +36 -0
- package/v2/projection.js +374 -0
- package/v2/server.d.ts +6 -0
- package/v2/server.js +633 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export declare const protocol: 1;
|
|
2
|
+
export declare const maxFrame: number;
|
|
3
|
+
export declare const maxProjection: number;
|
|
4
|
+
export declare const maxAttachments = 128;
|
|
5
|
+
export declare const maxAttachmentBytes: number;
|
|
6
|
+
export declare const maxBudgetMS = 180250;
|
|
7
|
+
export declare const limits: {
|
|
8
|
+
readonly max_frame_bytes: number;
|
|
9
|
+
readonly max_active_checks: 16;
|
|
10
|
+
readonly max_pending: 32;
|
|
11
|
+
readonly max_writer_queue_bytes: number;
|
|
12
|
+
readonly max_check_budget_ms: 180250;
|
|
13
|
+
};
|
|
14
|
+
export declare const methods: readonly ["hello", "connection.validate", "connection.configure", "connection.test", "operation.check", "operation.cancel", "attachments.policy", "attachments.configure", "route.lease", "ping", "shutdown"];
|
|
15
|
+
export type Method = (typeof methods)[number];
|
|
16
|
+
export declare const profiles: readonly ["v1.model.messages", "v1.model.system", "v1.tool.before", "v2.model.context", "v2.model.compaction", "v2.model.generate", "v2.model.title", "v2.tool.before", "tool.after.observe"];
|
|
17
|
+
export type Profile = (typeof profiles)[number];
|
|
18
|
+
export declare const errorCodes: readonly ["invalid_envelope", "unsupported_version", "unsupported_protocol", "unknown_method", "invalid_params", "not_configured", "stale_generation", "resource_exhausted", "cancelled", "timeout", "guard_error", "invalid_state", "shutting_down", "internal_error"];
|
|
19
|
+
export type ErrorCode = (typeof errorCodes)[number];
|
|
20
|
+
export type Failure = {
|
|
21
|
+
code: ErrorCode;
|
|
22
|
+
http_status?: number;
|
|
23
|
+
};
|
|
24
|
+
export declare class ProtocolError extends Error {
|
|
25
|
+
readonly code: ErrorCode;
|
|
26
|
+
constructor(code: ErrorCode);
|
|
27
|
+
}
|
|
28
|
+
export type Decision = "allow" | "deny" | "transform";
|
|
29
|
+
export type ConnectionParams = {
|
|
30
|
+
origin: string;
|
|
31
|
+
project_sid: string;
|
|
32
|
+
token: string;
|
|
33
|
+
allow_loopback_http: boolean;
|
|
34
|
+
timeout_ms: number;
|
|
35
|
+
};
|
|
36
|
+
export type LayoutItem = {
|
|
37
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
38
|
+
kind: "context" | "history" | "current_prompt";
|
|
39
|
+
};
|
|
40
|
+
export type AttachmentParam = {
|
|
41
|
+
media_type?: string;
|
|
42
|
+
data_b64?: string;
|
|
43
|
+
uninspectable?: "url" | "file_id" | "unsupported_source";
|
|
44
|
+
layout?: LayoutItem;
|
|
45
|
+
};
|
|
46
|
+
export type AttachmentPolicy = {
|
|
47
|
+
inspect: boolean;
|
|
48
|
+
allow_uninspectable: boolean;
|
|
49
|
+
source: "default" | "file" | "env";
|
|
50
|
+
damaged: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type CheckParams = {
|
|
53
|
+
cwd?: string | null;
|
|
54
|
+
generation: number;
|
|
55
|
+
profile: Profile;
|
|
56
|
+
session_id?: string | null;
|
|
57
|
+
call_id?: string | null;
|
|
58
|
+
tool_name?: string | null;
|
|
59
|
+
projected_json_b64: string;
|
|
60
|
+
layout?: LayoutItem[];
|
|
61
|
+
attachments?: AttachmentParam[];
|
|
62
|
+
model?: string;
|
|
63
|
+
budget_ms: number;
|
|
64
|
+
route_path?: string;
|
|
65
|
+
};
|
|
66
|
+
export type CheckResult = {
|
|
67
|
+
authorization: "allow" | "transformed" | "blocked" | "observed";
|
|
68
|
+
check_code: string;
|
|
69
|
+
decision: Decision | null;
|
|
70
|
+
reason_code: string;
|
|
71
|
+
block_message?: string;
|
|
72
|
+
request_id: string;
|
|
73
|
+
operation_id: string;
|
|
74
|
+
generation: number;
|
|
75
|
+
prepared_json_b64: string | null;
|
|
76
|
+
bindings: {
|
|
77
|
+
token: string;
|
|
78
|
+
original: string;
|
|
79
|
+
}[];
|
|
80
|
+
attachment_replacements?: {
|
|
81
|
+
index: number;
|
|
82
|
+
data_b64: string;
|
|
83
|
+
}[];
|
|
84
|
+
local_route?: boolean;
|
|
85
|
+
route_lease?: string;
|
|
86
|
+
};
|
|
87
|
+
export type AttachmentReplacement = {
|
|
88
|
+
index: number;
|
|
89
|
+
data: Buffer;
|
|
90
|
+
};
|
|
91
|
+
export interface Params {
|
|
92
|
+
hello: {
|
|
93
|
+
protocols: number[];
|
|
94
|
+
required_features: string[];
|
|
95
|
+
};
|
|
96
|
+
"connection.validate": ConnectionParams;
|
|
97
|
+
"connection.configure": ConnectionParams;
|
|
98
|
+
"connection.test": {
|
|
99
|
+
generation: number;
|
|
100
|
+
budget_ms: number;
|
|
101
|
+
};
|
|
102
|
+
"operation.check": CheckParams;
|
|
103
|
+
"operation.cancel": {
|
|
104
|
+
target: string;
|
|
105
|
+
};
|
|
106
|
+
"attachments.policy": Record<string, never>;
|
|
107
|
+
"attachments.configure": {
|
|
108
|
+
file_inspection: "off" | "inspect";
|
|
109
|
+
uninspectable_files: "block" | "allow";
|
|
110
|
+
};
|
|
111
|
+
"route.lease": {
|
|
112
|
+
generation: number;
|
|
113
|
+
session_id: string;
|
|
114
|
+
lease_token: string;
|
|
115
|
+
action: "renew" | "release";
|
|
116
|
+
budget_ms: number;
|
|
117
|
+
};
|
|
118
|
+
ping: Record<string, never>;
|
|
119
|
+
shutdown: Record<string, never>;
|
|
120
|
+
}
|
|
121
|
+
export interface Results {
|
|
122
|
+
hello: {
|
|
123
|
+
protocol: number;
|
|
124
|
+
epoch: string;
|
|
125
|
+
limits: typeof limits;
|
|
126
|
+
features: string[];
|
|
127
|
+
};
|
|
128
|
+
"connection.validate": {
|
|
129
|
+
valid: boolean;
|
|
130
|
+
code?: ErrorCode;
|
|
131
|
+
};
|
|
132
|
+
"connection.configure": {
|
|
133
|
+
generation: number;
|
|
134
|
+
};
|
|
135
|
+
"connection.test": {
|
|
136
|
+
connected: boolean;
|
|
137
|
+
check_code: string;
|
|
138
|
+
decision: Decision | null;
|
|
139
|
+
};
|
|
140
|
+
"operation.check": CheckResult;
|
|
141
|
+
"operation.cancel": {
|
|
142
|
+
acknowledged: boolean;
|
|
143
|
+
};
|
|
144
|
+
"attachments.policy": AttachmentPolicy;
|
|
145
|
+
"attachments.configure": AttachmentPolicy;
|
|
146
|
+
"route.lease": {
|
|
147
|
+
valid_for_ms: number;
|
|
148
|
+
};
|
|
149
|
+
ping: {
|
|
150
|
+
ready: boolean;
|
|
151
|
+
};
|
|
152
|
+
shutdown: {
|
|
153
|
+
accepted: boolean;
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
export type Request = {
|
|
157
|
+
[M in Method]: {
|
|
158
|
+
v: 1;
|
|
159
|
+
kind: "request";
|
|
160
|
+
id: string;
|
|
161
|
+
epoch: string;
|
|
162
|
+
method: M;
|
|
163
|
+
params: Params[M];
|
|
164
|
+
};
|
|
165
|
+
}[Method];
|
|
166
|
+
export type Envelope = Request | {
|
|
167
|
+
v: 1;
|
|
168
|
+
kind: "response";
|
|
169
|
+
id: string;
|
|
170
|
+
epoch: string;
|
|
171
|
+
ok: true;
|
|
172
|
+
result: unknown;
|
|
173
|
+
} | {
|
|
174
|
+
v: 1;
|
|
175
|
+
kind: "response";
|
|
176
|
+
id: string;
|
|
177
|
+
epoch: string;
|
|
178
|
+
ok: false;
|
|
179
|
+
error: Failure;
|
|
180
|
+
};
|
|
181
|
+
export declare function decodeParams<M extends Method>(method: M, value: unknown): Params[M];
|
|
182
|
+
export declare function decodeResult<M extends Method>(method: M, value: unknown): Results[M];
|
|
183
|
+
export declare function decodeEnvelope(raw: Uint8Array): Envelope;
|
|
184
|
+
export declare function strictJSON(raw: Uint8Array): unknown;
|