@otto-code/protocol 0.5.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 +12 -0
- package/dist/agent-attention-notification.d.ts +41 -0
- package/dist/agent-attention-notification.js +140 -0
- package/dist/agent-labels.d.ts +7 -0
- package/dist/agent-labels.js +11 -0
- package/dist/agent-lifecycle.d.ts +3 -0
- package/dist/agent-lifecycle.js +8 -0
- package/dist/agent-personalities.d.ts +32 -0
- package/dist/agent-personalities.js +69 -0
- package/dist/agent-state-bucket.d.ts +14 -0
- package/dist/agent-state-bucket.js +41 -0
- package/dist/agent-title-limits.d.ts +2 -0
- package/dist/agent-title-limits.js +2 -0
- package/dist/agent-types.d.ts +479 -0
- package/dist/agent-types.js +22 -0
- package/dist/artifacts/rpc-schemas.d.ts +396 -0
- package/dist/artifacts/rpc-schemas.js +175 -0
- package/dist/artifacts/types.d.ts +166 -0
- package/dist/artifacts/types.js +73 -0
- package/dist/binary-frames/demux.d.ts +11 -0
- package/dist/binary-frames/demux.js +23 -0
- package/dist/binary-frames/file-transfer.d.ts +50 -0
- package/dist/binary-frames/file-transfer.js +107 -0
- package/dist/binary-frames/index.d.ts +4 -0
- package/dist/binary-frames/index.js +4 -0
- package/dist/binary-frames/terminal.d.ts +31 -0
- package/dist/binary-frames/terminal.js +99 -0
- package/dist/branch-slug.d.ts +14 -0
- package/dist/branch-slug.js +49 -0
- package/dist/browser-automation/capabilities.d.ts +7 -0
- package/dist/browser-automation/capabilities.js +31 -0
- package/dist/browser-automation/rpc-schemas.d.ts +1329 -0
- package/dist/browser-automation/rpc-schemas.js +555 -0
- package/dist/chat/rpc-schemas.d.ts +158 -0
- package/dist/chat/rpc-schemas.js +103 -0
- package/dist/chat/types.d.ts +30 -0
- package/dist/chat/types.js +22 -0
- package/dist/client-capabilities.d.ts +8 -0
- package/dist/client-capabilities.js +16 -0
- package/dist/connection-offer.d.ts +36 -0
- package/dist/connection-offer.js +53 -0
- package/dist/daemon-endpoints.d.ts +47 -0
- package/dist/daemon-endpoints.js +201 -0
- package/dist/default-personalities.d.ts +3 -0
- package/dist/default-personalities.js +127 -0
- package/dist/effort.d.ts +32 -0
- package/dist/effort.js +99 -0
- package/dist/error-utils.d.ts +11 -0
- package/dist/error-utils.js +27 -0
- package/dist/generated/validation/ws-outbound.aot.d.ts +2 -0
- package/dist/generated/validation/ws-outbound.aot.js +48755 -0
- package/dist/git-hosting.d.ts +21 -0
- package/dist/git-hosting.js +36 -0
- package/dist/git-remote.d.ts +18 -0
- package/dist/git-remote.js +84 -0
- package/dist/host-connection-schema.d.ts +11 -0
- package/dist/host-connection-schema.js +9 -0
- package/dist/literal-union.d.ts +2 -0
- package/dist/literal-union.js +2 -0
- package/dist/loop/rpc-schemas.d.ts +636 -0
- package/dist/loop/rpc-schemas.js +163 -0
- package/dist/messages.d.ts +38505 -0
- package/dist/messages.js +4719 -0
- package/dist/otto-config-schema.d.ts +136 -0
- package/dist/otto-config-schema.js +96 -0
- package/dist/path-utils.d.ts +2 -0
- package/dist/path-utils.js +16 -0
- package/dist/provider-config.d.ts +266 -0
- package/dist/provider-config.js +238 -0
- package/dist/provider-icon-names.d.ts +5 -0
- package/dist/provider-icon-names.js +52 -0
- package/dist/provider-manifest.d.ts +34 -0
- package/dist/provider-manifest.js +227 -0
- package/dist/schedule/cron-expression.d.ts +13 -0
- package/dist/schedule/cron-expression.js +97 -0
- package/dist/schedule/rpc-schemas.d.ts +667 -0
- package/dist/schedule/rpc-schemas.js +155 -0
- package/dist/schedule/types.d.ts +236 -0
- package/dist/schedule/types.js +84 -0
- package/dist/terminal-activity.d.ts +21 -0
- package/dist/terminal-activity.js +25 -0
- package/dist/terminal-input-mode.d.ts +26 -0
- package/dist/terminal-input-mode.js +151 -0
- package/dist/terminal-key-input.d.ts +13 -0
- package/dist/terminal-key-input.js +201 -0
- package/dist/terminal-profiles.d.ts +6 -0
- package/dist/terminal-profiles.js +28 -0
- package/dist/terminal-snapshot.d.ts +3 -0
- package/dist/terminal-snapshot.js +178 -0
- package/dist/terminal-stream-protocol.d.ts +2 -0
- package/dist/terminal-stream-protocol.js +2 -0
- package/dist/terminal-subscription-key.d.ts +2 -0
- package/dist/terminal-subscription-key.js +9 -0
- package/dist/tool-call-display.d.ts +11 -0
- package/dist/tool-call-display.js +135 -0
- package/dist/tool-name-normalization.d.ts +9 -0
- package/dist/tool-name-normalization.js +82 -0
- package/dist/validation/ws-outbound-schema-metadata.d.ts +7256 -0
- package/dist/validation/ws-outbound-schema-metadata.js +3 -0
- package/dist/validation/ws-outbound.d.ts +12 -0
- package/dist/validation/ws-outbound.js +8 -0
- package/package.json +42 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AgentProviderSchema } from "./provider-manifest.js";
|
|
3
|
+
const ProviderCommandDefaultSchema = z.object({
|
|
4
|
+
mode: z.literal("default"),
|
|
5
|
+
});
|
|
6
|
+
const ProviderCommandAppendSchema = z.object({
|
|
7
|
+
mode: z.literal("append"),
|
|
8
|
+
args: z.array(z.string()).optional(),
|
|
9
|
+
});
|
|
10
|
+
const ProviderCommandReplaceSchema = z.object({
|
|
11
|
+
mode: z.literal("replace"),
|
|
12
|
+
argv: z.array(z.string().min(1)).min(1),
|
|
13
|
+
});
|
|
14
|
+
export const ProviderCommandSchema = z.discriminatedUnion("mode", [
|
|
15
|
+
ProviderCommandDefaultSchema,
|
|
16
|
+
ProviderCommandAppendSchema,
|
|
17
|
+
ProviderCommandReplaceSchema,
|
|
18
|
+
]);
|
|
19
|
+
export const ProviderRuntimeSettingsSchema = z.object({
|
|
20
|
+
command: ProviderCommandSchema.optional(),
|
|
21
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
22
|
+
disallowedTools: z.array(z.string()).optional(),
|
|
23
|
+
});
|
|
24
|
+
const ProviderProfileThinkingOptionSchema = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
label: z.string(),
|
|
27
|
+
description: z.string().optional(),
|
|
28
|
+
isDefault: z.boolean().optional(),
|
|
29
|
+
});
|
|
30
|
+
export const ProviderProfileModelSchema = z.object({
|
|
31
|
+
id: z.string().min(1),
|
|
32
|
+
label: z.string().min(1),
|
|
33
|
+
description: z.string().optional(),
|
|
34
|
+
isDefault: z.boolean().optional(),
|
|
35
|
+
thinkingOptions: z.array(ProviderProfileThinkingOptionSchema).optional(),
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* Coarse categories for Otto's agent-facing tool catalog. Providers that receive
|
|
39
|
+
* Otto tools natively (see the openai-compat provider) can be scoped to a subset
|
|
40
|
+
* of these groups; omitting the selection means all groups. Kept deliberately
|
|
41
|
+
* coarse — users pick groups, not individual tools.
|
|
42
|
+
*/
|
|
43
|
+
export const OTTO_TOOL_GROUPS = [
|
|
44
|
+
"preview",
|
|
45
|
+
"browser",
|
|
46
|
+
"web",
|
|
47
|
+
"agents",
|
|
48
|
+
"terminals",
|
|
49
|
+
"schedules",
|
|
50
|
+
"artifacts",
|
|
51
|
+
"workspace",
|
|
52
|
+
];
|
|
53
|
+
/**
|
|
54
|
+
* Map a tool name to its group. Covers both Otto's catalog tools and the
|
|
55
|
+
* openai-compat builtin web tools (web_search/web_fetch → "web"). Unknown/
|
|
56
|
+
* lifecycle tools fall under "agents".
|
|
57
|
+
*/
|
|
58
|
+
export function ottoToolGroupForName(name) {
|
|
59
|
+
if (name.startsWith("preview_"))
|
|
60
|
+
return "preview";
|
|
61
|
+
if (name.startsWith("browser_"))
|
|
62
|
+
return "browser";
|
|
63
|
+
if (name === "web_search" || name === "web_fetch")
|
|
64
|
+
return "web";
|
|
65
|
+
if (name.includes("terminal"))
|
|
66
|
+
return "terminals";
|
|
67
|
+
if (name.includes("schedule") || name === "create_heartbeat")
|
|
68
|
+
return "schedules";
|
|
69
|
+
if (name.includes("artifact"))
|
|
70
|
+
return "artifacts";
|
|
71
|
+
if (name.includes("worktree") || name.includes("workspace"))
|
|
72
|
+
return "workspace";
|
|
73
|
+
return "agents";
|
|
74
|
+
}
|
|
75
|
+
const McpStdioServerConfigSchema = z.object({
|
|
76
|
+
type: z.literal("stdio"),
|
|
77
|
+
command: z.string(),
|
|
78
|
+
args: z.array(z.string()).optional(),
|
|
79
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
80
|
+
alwaysLoad: z.boolean().optional(),
|
|
81
|
+
});
|
|
82
|
+
const McpHttpServerConfigSchema = z.object({
|
|
83
|
+
type: z.literal("http"),
|
|
84
|
+
url: z.string(),
|
|
85
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
86
|
+
alwaysLoad: z.boolean().optional(),
|
|
87
|
+
});
|
|
88
|
+
const McpSseServerConfigSchema = z.object({
|
|
89
|
+
type: z.literal("sse"),
|
|
90
|
+
url: z.string(),
|
|
91
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
92
|
+
alwaysLoad: z.boolean().optional(),
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* Canonical MCP server config. Shared by AgentSessionConfig (per-agent servers
|
|
96
|
+
* sent at create time) and ProviderOverride (provider-level servers in the
|
|
97
|
+
* daemon config). stdio entries execute arbitrary commands as the daemon user —
|
|
98
|
+
* both sources sit behind existing trust boundaries (daemon-side config file,
|
|
99
|
+
* authenticated agent-create RPC).
|
|
100
|
+
*/
|
|
101
|
+
export const McpServerConfigSchema = z.discriminatedUnion("type", [
|
|
102
|
+
McpStdioServerConfigSchema,
|
|
103
|
+
McpHttpServerConfigSchema,
|
|
104
|
+
McpSseServerConfigSchema,
|
|
105
|
+
]);
|
|
106
|
+
/**
|
|
107
|
+
* How natively-hosted providers (openai-compat) gate MCP tool calls in
|
|
108
|
+
* acceptEdits mode. "always-ask" (the default) prompts for every MCP tool;
|
|
109
|
+
* "trust-read-only" auto-approves tools whose MCP readOnlyHint annotation is
|
|
110
|
+
* true. In default mode every MCP tool prompts regardless; plan mode never
|
|
111
|
+
* exposes MCP tools; bypassPermissions auto-approves everything.
|
|
112
|
+
*/
|
|
113
|
+
export const MCP_TOOL_PERMISSION_MODES = ["always-ask", "trust-read-only"];
|
|
114
|
+
/**
|
|
115
|
+
* Auto-compaction thresholds selectable for daemon-hosted compaction
|
|
116
|
+
* (openai-compat): percentage of the model's context window at which the
|
|
117
|
+
* conversation is compacted automatically.
|
|
118
|
+
*/
|
|
119
|
+
export const COMPACTION_THRESHOLD_PERCENTS = [50, 60, 70, 80, 90];
|
|
120
|
+
/**
|
|
121
|
+
* Compaction tuning for providers whose conversation the daemon owns
|
|
122
|
+
* (openai-compat). These set the provider-level defaults; the per-agent
|
|
123
|
+
* "Auto-compact" feature select overrides them at runtime.
|
|
124
|
+
*/
|
|
125
|
+
export const ProviderCompactionConfigSchema = z.object({
|
|
126
|
+
/** false disables auto-compaction by default for new agents (manual /compact stays). */
|
|
127
|
+
autoCompact: z.boolean().optional(),
|
|
128
|
+
/** Context-window percentage at which auto-compaction triggers. Default 80. */
|
|
129
|
+
thresholdPercent: z
|
|
130
|
+
.union([z.literal(50), z.literal(60), z.literal(70), z.literal(80), z.literal(90)])
|
|
131
|
+
.optional(),
|
|
132
|
+
/** Recent-conversation budget kept verbatim through compaction. Default 20000. */
|
|
133
|
+
keepRecentTokens: z.number().int().positive().optional(),
|
|
134
|
+
/**
|
|
135
|
+
* true hides the per-agent "Auto-compact" feature select in chats; agents
|
|
136
|
+
* always run with the provider-level default above (persisted per-agent
|
|
137
|
+
* values are ignored while hidden).
|
|
138
|
+
*/
|
|
139
|
+
hideSelector: z.boolean().optional(),
|
|
140
|
+
});
|
|
141
|
+
export const ProviderOverrideSchema = z.object({
|
|
142
|
+
extends: z.string().optional(),
|
|
143
|
+
label: z.string().optional(),
|
|
144
|
+
description: z.string().optional(),
|
|
145
|
+
command: z.array(z.string().min(1)).min(1).optional(),
|
|
146
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
147
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
148
|
+
models: z.array(ProviderProfileModelSchema).optional(),
|
|
149
|
+
additionalModels: z.array(ProviderProfileModelSchema).optional(),
|
|
150
|
+
disallowedTools: z.array(z.string()).optional(),
|
|
151
|
+
/**
|
|
152
|
+
* Which Otto tool groups to inject for this provider (natively-injected
|
|
153
|
+
* providers only). Omitted = all groups. Empty array = no Otto tools.
|
|
154
|
+
*/
|
|
155
|
+
ottoToolGroups: z.array(z.enum(OTTO_TOOL_GROUPS)).optional(),
|
|
156
|
+
/**
|
|
157
|
+
* MCP servers for providers whose tool loop the daemon hosts (openai-compat).
|
|
158
|
+
* Merged with any per-agent AgentSessionConfig.mcpServers; the per-agent
|
|
159
|
+
* entry wins on a server-name collision.
|
|
160
|
+
*/
|
|
161
|
+
mcpServers: z.record(z.string(), McpServerConfigSchema).optional(),
|
|
162
|
+
mcpToolPermissions: z.enum(MCP_TOOL_PERMISSION_MODES).optional(),
|
|
163
|
+
/**
|
|
164
|
+
* Compaction defaults for providers whose conversation the daemon owns
|
|
165
|
+
* (openai-compat). Per-agent feature values win over these.
|
|
166
|
+
*/
|
|
167
|
+
compaction: ProviderCompactionConfigSchema.optional(),
|
|
168
|
+
enabled: z.boolean().optional(),
|
|
169
|
+
order: z.number().optional(),
|
|
170
|
+
});
|
|
171
|
+
const BUILTIN_PROVIDER_IDS = ["claude", "codex", "copilot", "opencode", "pi", "omp"];
|
|
172
|
+
const PROVIDER_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
173
|
+
export const ProviderOverridesSchema = z
|
|
174
|
+
.record(z.string(), ProviderOverrideSchema)
|
|
175
|
+
.superRefine((providers, ctx) => {
|
|
176
|
+
const builtinProviderIdSet = new Set(BUILTIN_PROVIDER_IDS);
|
|
177
|
+
// "acp" spawns a generic ACP agent process; "openai-compatible" is served
|
|
178
|
+
// natively by the daemon against an OpenAI-compatible HTTP endpoint
|
|
179
|
+
// (LM Studio, Ollama, vLLM, ...) — no external binary involved.
|
|
180
|
+
const validExtendsValues = new Set([
|
|
181
|
+
...BUILTIN_PROVIDER_IDS,
|
|
182
|
+
"acp",
|
|
183
|
+
"openai-compatible",
|
|
184
|
+
]);
|
|
185
|
+
for (const [providerId, provider] of Object.entries(providers)) {
|
|
186
|
+
if (!PROVIDER_ID_PATTERN.test(providerId)) {
|
|
187
|
+
ctx.addIssue({
|
|
188
|
+
code: z.ZodIssueCode.custom,
|
|
189
|
+
path: [providerId],
|
|
190
|
+
message: `Provider ID "${providerId}" must match ${PROVIDER_ID_PATTERN}.`,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const isBuiltinProvider = builtinProviderIdSet.has(providerId);
|
|
194
|
+
if (!isBuiltinProvider && !provider.extends) {
|
|
195
|
+
ctx.addIssue({
|
|
196
|
+
code: z.ZodIssueCode.custom,
|
|
197
|
+
path: [providerId, "extends"],
|
|
198
|
+
message: `Custom provider "${providerId}" must declare extends.`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
if (!isBuiltinProvider && !provider.label) {
|
|
202
|
+
ctx.addIssue({
|
|
203
|
+
code: z.ZodIssueCode.custom,
|
|
204
|
+
path: [providerId, "label"],
|
|
205
|
+
message: `Custom provider "${providerId}" must declare label.`,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (provider.extends && !validExtendsValues.has(provider.extends)) {
|
|
209
|
+
ctx.addIssue({
|
|
210
|
+
code: z.ZodIssueCode.custom,
|
|
211
|
+
path: [providerId, "extends"],
|
|
212
|
+
message: `Provider "${providerId}" extends unknown provider "${provider.extends}".`,
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (provider.extends === "acp" && !provider.command) {
|
|
216
|
+
ctx.addIssue({
|
|
217
|
+
code: z.ZodIssueCode.custom,
|
|
218
|
+
path: [providerId, "command"],
|
|
219
|
+
message: `Provider "${providerId}" extending "acp" must declare command.`,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
export const AgentProviderRuntimeSettingsMapSchema = z
|
|
225
|
+
.record(z.string(), ProviderRuntimeSettingsSchema)
|
|
226
|
+
.superRefine((providers, ctx) => {
|
|
227
|
+
for (const providerId of Object.keys(providers)) {
|
|
228
|
+
const parsedProviderId = AgentProviderSchema.safeParse(providerId);
|
|
229
|
+
if (!parsedProviderId.success) {
|
|
230
|
+
ctx.addIssue({
|
|
231
|
+
code: z.ZodIssueCode.custom,
|
|
232
|
+
path: [providerId],
|
|
233
|
+
message: `Invalid agent provider "${providerId}".`,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
//# sourceMappingURL=provider-config.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const BUILTIN_PROVIDER_ICON_NAMES: string[];
|
|
2
|
+
export declare const ACP_PROVIDER_ICON_NAMES: string[];
|
|
3
|
+
export declare const TERMINAL_PROFILE_ICON_NAMES: string[];
|
|
4
|
+
export declare const KNOWN_PROVIDER_ICON_NAMES: string[];
|
|
5
|
+
//# sourceMappingURL=provider-icon-names.d.ts.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export const BUILTIN_PROVIDER_ICON_NAMES = [
|
|
2
|
+
"claude",
|
|
3
|
+
"codex",
|
|
4
|
+
"copilot",
|
|
5
|
+
"kiro",
|
|
6
|
+
"minimax",
|
|
7
|
+
"omp",
|
|
8
|
+
"opencode",
|
|
9
|
+
"pi",
|
|
10
|
+
];
|
|
11
|
+
export const ACP_PROVIDER_ICON_NAMES = [
|
|
12
|
+
"agoragentic-acp",
|
|
13
|
+
"amp-acp",
|
|
14
|
+
"auggie",
|
|
15
|
+
"autohand",
|
|
16
|
+
"cline",
|
|
17
|
+
"codebuddy-code",
|
|
18
|
+
"codewhale",
|
|
19
|
+
"cortex-code",
|
|
20
|
+
"corust-agent",
|
|
21
|
+
"crow-cli",
|
|
22
|
+
"cursor",
|
|
23
|
+
"deepagents",
|
|
24
|
+
"dimcode",
|
|
25
|
+
"dirac",
|
|
26
|
+
"factory-droid",
|
|
27
|
+
"fast-agent",
|
|
28
|
+
"gemini",
|
|
29
|
+
"glm-acp-agent",
|
|
30
|
+
"goose",
|
|
31
|
+
"grok",
|
|
32
|
+
"junie",
|
|
33
|
+
"kilo",
|
|
34
|
+
"kimi",
|
|
35
|
+
"minion-code",
|
|
36
|
+
"mistral-vibe",
|
|
37
|
+
"nova",
|
|
38
|
+
"poolside",
|
|
39
|
+
"qoder",
|
|
40
|
+
"qwen-code",
|
|
41
|
+
"sigit",
|
|
42
|
+
"stakpak",
|
|
43
|
+
"traecli",
|
|
44
|
+
"vtcode",
|
|
45
|
+
];
|
|
46
|
+
export const TERMINAL_PROFILE_ICON_NAMES = ["agy"];
|
|
47
|
+
export const KNOWN_PROVIDER_ICON_NAMES = [
|
|
48
|
+
...BUILTIN_PROVIDER_ICON_NAMES,
|
|
49
|
+
...ACP_PROVIDER_ICON_NAMES,
|
|
50
|
+
...TERMINAL_PROFILE_ICON_NAMES,
|
|
51
|
+
];
|
|
52
|
+
//# sourceMappingURL=provider-icon-names.js.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AgentMode } from "./agent-types.js";
|
|
3
|
+
export type AgentModeColorTier = "neutral" | "safe" | "moderate" | "dangerous" | "planning" | `#${string}`;
|
|
4
|
+
export type AgentModeIcon = string;
|
|
5
|
+
export interface AgentModeVisuals {
|
|
6
|
+
icon: AgentModeIcon;
|
|
7
|
+
colorTier: AgentModeColorTier;
|
|
8
|
+
}
|
|
9
|
+
export type AgentProviderModeDefinition = Omit<AgentMode, "icon" | "colorTier"> & AgentModeVisuals & {
|
|
10
|
+
isUnattended?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export interface AgentProviderDefinition {
|
|
13
|
+
id: string;
|
|
14
|
+
label: string;
|
|
15
|
+
description: string;
|
|
16
|
+
enabledByDefault?: boolean;
|
|
17
|
+
defaultModeId: string | null;
|
|
18
|
+
modes: AgentProviderModeDefinition[];
|
|
19
|
+
voice?: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
defaultModeId: string;
|
|
22
|
+
defaultModel?: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const AGENT_PROVIDER_DEFINITIONS: AgentProviderDefinition[];
|
|
26
|
+
export declare const DEV_AGENT_PROVIDER_DEFINITIONS: AgentProviderDefinition[];
|
|
27
|
+
export declare function getAgentProviderDefinition(provider: string, definitions?: AgentProviderDefinition[]): AgentProviderDefinition;
|
|
28
|
+
export declare const BUILTIN_PROVIDER_IDS: string[];
|
|
29
|
+
export declare const AGENT_PROVIDER_IDS: string[];
|
|
30
|
+
export declare const AgentProviderSchema: z.ZodString;
|
|
31
|
+
export declare function isValidAgentProvider(value: string, validIds?: Iterable<string>): boolean;
|
|
32
|
+
export declare function getUnattendedModeId(provider: string, definitions?: AgentProviderDefinition[]): string | undefined;
|
|
33
|
+
export declare function getModeVisuals(provider: string, modeId: string, definitions: AgentProviderDefinition[]): AgentModeVisuals | undefined;
|
|
34
|
+
//# sourceMappingURL=provider-manifest.d.ts.map
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const CLAUDE_MODES = [
|
|
3
|
+
{
|
|
4
|
+
id: "default",
|
|
5
|
+
label: "Always Ask",
|
|
6
|
+
description: "Prompts for permission the first time a tool is used",
|
|
7
|
+
icon: "ShieldQuestionMark",
|
|
8
|
+
colorTier: "neutral",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "acceptEdits",
|
|
12
|
+
label: "Accept File Edits",
|
|
13
|
+
description: "Automatically approves edit-focused tools without prompting",
|
|
14
|
+
icon: "ShieldPerson",
|
|
15
|
+
colorTier: "safe",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "plan",
|
|
19
|
+
label: "Plan Mode",
|
|
20
|
+
description: "Analyze the codebase without executing tools or edits",
|
|
21
|
+
icon: "ShieldToggle",
|
|
22
|
+
colorTier: "planning",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "auto",
|
|
26
|
+
label: "Auto mode",
|
|
27
|
+
description: "Uses a model classifier to review permission prompts automatically",
|
|
28
|
+
icon: "LocalPolice",
|
|
29
|
+
colorTier: "moderate",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "bypassPermissions",
|
|
33
|
+
label: "Bypass",
|
|
34
|
+
description: "Skip all permission prompts (use with caution)",
|
|
35
|
+
icon: "PrivacyTip",
|
|
36
|
+
colorTier: "dangerous",
|
|
37
|
+
isUnattended: true,
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
const CODEX_MODES = [
|
|
41
|
+
{
|
|
42
|
+
id: "auto",
|
|
43
|
+
label: "Default Permissions",
|
|
44
|
+
description: "Edit files and run commands with Codex's default approval flow.",
|
|
45
|
+
icon: "ShieldAlert",
|
|
46
|
+
colorTier: "moderate",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "auto-review",
|
|
50
|
+
label: "Auto-review",
|
|
51
|
+
description: "Same workspace-write permissions as Default, but eligible `on-request` approvals are routed through the auto-reviewer subagent.",
|
|
52
|
+
icon: "ShieldQuestionMark",
|
|
53
|
+
colorTier: "moderate",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "full-access",
|
|
57
|
+
label: "Full Access",
|
|
58
|
+
description: "Edit files, run commands, and access the network without additional prompts.",
|
|
59
|
+
icon: "ShieldAlert",
|
|
60
|
+
colorTier: "dangerous",
|
|
61
|
+
isUnattended: true,
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
const COPILOT_MODES = [
|
|
65
|
+
{
|
|
66
|
+
id: "https://agentclientprotocol.com/protocol/session-modes#agent",
|
|
67
|
+
label: "Agent",
|
|
68
|
+
description: "Default agent mode for conversational interactions",
|
|
69
|
+
icon: "ShieldAlert",
|
|
70
|
+
colorTier: "moderate",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "https://agentclientprotocol.com/protocol/session-modes#plan",
|
|
74
|
+
label: "Plan",
|
|
75
|
+
description: "Plan mode for creating and executing multi-step plans",
|
|
76
|
+
icon: "ShieldCheck",
|
|
77
|
+
colorTier: "planning",
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "allow-all",
|
|
81
|
+
label: "Allow All",
|
|
82
|
+
description: "Automatically approves all Copilot tool, path, and URL requests.",
|
|
83
|
+
icon: "ShieldOff",
|
|
84
|
+
colorTier: "dangerous",
|
|
85
|
+
isUnattended: true,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
const OPENCODE_MODES = [
|
|
89
|
+
{
|
|
90
|
+
id: "build",
|
|
91
|
+
label: "Build",
|
|
92
|
+
description: "Allows edits and tool execution for implementation work",
|
|
93
|
+
icon: "Bot",
|
|
94
|
+
colorTier: "moderate",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: "plan",
|
|
98
|
+
label: "Plan",
|
|
99
|
+
description: "Read-only planning mode that avoids file edits",
|
|
100
|
+
icon: "Bot",
|
|
101
|
+
colorTier: "planning",
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
const MOCK_LOAD_TEST_MODES = [
|
|
105
|
+
{
|
|
106
|
+
id: "load-test",
|
|
107
|
+
label: "Load Test",
|
|
108
|
+
description: "Streams repeated markdown, reasoning, and tool calls for app stress testing",
|
|
109
|
+
icon: "ShieldOff",
|
|
110
|
+
colorTier: "dangerous",
|
|
111
|
+
},
|
|
112
|
+
];
|
|
113
|
+
const MOCK_SLOW_MODES = [
|
|
114
|
+
{
|
|
115
|
+
id: "default",
|
|
116
|
+
label: "Default",
|
|
117
|
+
description: "Dev-only mode for the mock slow provider",
|
|
118
|
+
icon: "ShieldOff",
|
|
119
|
+
colorTier: "dangerous",
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
export const AGENT_PROVIDER_DEFINITIONS = [
|
|
123
|
+
{
|
|
124
|
+
id: "claude",
|
|
125
|
+
label: "Claude",
|
|
126
|
+
description: "Anthropic's multi-tool assistant with MCP support, streaming, and deep reasoning",
|
|
127
|
+
defaultModeId: "default",
|
|
128
|
+
modes: CLAUDE_MODES,
|
|
129
|
+
voice: {
|
|
130
|
+
enabled: true,
|
|
131
|
+
defaultModeId: "default",
|
|
132
|
+
defaultModel: "haiku",
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "codex",
|
|
137
|
+
label: "Codex",
|
|
138
|
+
description: "OpenAI's Codex workspace agent with sandbox controls and optional network access",
|
|
139
|
+
defaultModeId: "auto",
|
|
140
|
+
modes: CODEX_MODES,
|
|
141
|
+
voice: {
|
|
142
|
+
enabled: true,
|
|
143
|
+
defaultModeId: "auto",
|
|
144
|
+
defaultModel: "gpt-5.4-mini",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "copilot",
|
|
149
|
+
label: "Copilot",
|
|
150
|
+
description: "GitHub Copilot via Agent Client Protocol with dynamic modes and session support",
|
|
151
|
+
defaultModeId: "https://agentclientprotocol.com/protocol/session-modes#agent",
|
|
152
|
+
modes: COPILOT_MODES,
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "opencode",
|
|
156
|
+
label: "OpenCode",
|
|
157
|
+
description: "Open-source coding assistant with multi-provider model support",
|
|
158
|
+
defaultModeId: "build",
|
|
159
|
+
modes: OPENCODE_MODES,
|
|
160
|
+
voice: {
|
|
161
|
+
enabled: true,
|
|
162
|
+
defaultModeId: "build",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "pi",
|
|
167
|
+
label: "Pi",
|
|
168
|
+
description: "Minimal terminal-based coding agent with multi-provider LLM support",
|
|
169
|
+
defaultModeId: null,
|
|
170
|
+
modes: [],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
id: "omp",
|
|
174
|
+
label: "OMP",
|
|
175
|
+
description: "Pi-compatible coding agent distributed as Oh My Pi",
|
|
176
|
+
enabledByDefault: false,
|
|
177
|
+
defaultModeId: null,
|
|
178
|
+
modes: [],
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
export const DEV_AGENT_PROVIDER_DEFINITIONS = [
|
|
182
|
+
{
|
|
183
|
+
id: "mock",
|
|
184
|
+
label: "Mock Load Test",
|
|
185
|
+
description: "Development-only provider that emits synthetic agent traffic for performance tests",
|
|
186
|
+
defaultModeId: "load-test",
|
|
187
|
+
modes: MOCK_LOAD_TEST_MODES,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
id: "mock-slow",
|
|
191
|
+
label: "Mock Slow Provider",
|
|
192
|
+
description: "Dev-only: hangs during model discovery to test loading and timeout UI",
|
|
193
|
+
defaultModeId: "default",
|
|
194
|
+
modes: MOCK_SLOW_MODES,
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
export function getAgentProviderDefinition(provider, definitions = [
|
|
198
|
+
...AGENT_PROVIDER_DEFINITIONS,
|
|
199
|
+
...DEV_AGENT_PROVIDER_DEFINITIONS,
|
|
200
|
+
]) {
|
|
201
|
+
const definition = definitions.find((entry) => entry.id === provider);
|
|
202
|
+
if (!definition) {
|
|
203
|
+
throw new Error(`Unknown agent provider: ${provider}`);
|
|
204
|
+
}
|
|
205
|
+
return definition;
|
|
206
|
+
}
|
|
207
|
+
export const BUILTIN_PROVIDER_IDS = AGENT_PROVIDER_DEFINITIONS.map((d) => d.id);
|
|
208
|
+
export const AGENT_PROVIDER_IDS = BUILTIN_PROVIDER_IDS;
|
|
209
|
+
export const AgentProviderSchema = z.string();
|
|
210
|
+
export function isValidAgentProvider(value, validIds = BUILTIN_PROVIDER_IDS) {
|
|
211
|
+
return Array.isArray(validIds) ? validIds.includes(value) : new Set(validIds).has(value);
|
|
212
|
+
}
|
|
213
|
+
export function getUnattendedModeId(provider, definitions = [
|
|
214
|
+
...AGENT_PROVIDER_DEFINITIONS,
|
|
215
|
+
...DEV_AGENT_PROVIDER_DEFINITIONS,
|
|
216
|
+
]) {
|
|
217
|
+
const definition = definitions.find((entry) => entry.id === provider);
|
|
218
|
+
return definition?.modes.find((mode) => mode.isUnattended)?.id;
|
|
219
|
+
}
|
|
220
|
+
export function getModeVisuals(provider, modeId, definitions) {
|
|
221
|
+
const definition = definitions.find((entry) => entry.id === provider);
|
|
222
|
+
const mode = definition?.modes.find((m) => m.id === modeId);
|
|
223
|
+
if (!mode)
|
|
224
|
+
return undefined;
|
|
225
|
+
return { icon: mode.icon, colorTier: mode.colorTier };
|
|
226
|
+
}
|
|
227
|
+
//# sourceMappingURL=provider-manifest.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CronFieldMatcher {
|
|
2
|
+
matches(value: number): boolean;
|
|
3
|
+
}
|
|
4
|
+
export interface ParsedCronExpression {
|
|
5
|
+
minute: CronFieldMatcher;
|
|
6
|
+
hour: CronFieldMatcher;
|
|
7
|
+
dayOfMonth: CronFieldMatcher;
|
|
8
|
+
month: CronFieldMatcher;
|
|
9
|
+
dayOfWeek: CronFieldMatcher;
|
|
10
|
+
}
|
|
11
|
+
export declare function parseCronExpression(expression: string): ParsedCronExpression;
|
|
12
|
+
export declare function validateCronExpression(expression: string): string | null;
|
|
13
|
+
//# sourceMappingURL=cron-expression.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
const CRON_FIELD_BOUNDS = [
|
|
2
|
+
{ min: 0, max: 59, name: "minute" },
|
|
3
|
+
{ min: 0, max: 23, name: "hour" },
|
|
4
|
+
{ min: 1, max: 31, name: "day-of-month" },
|
|
5
|
+
{ min: 1, max: 12, name: "month" },
|
|
6
|
+
{ min: 0, max: 6, name: "day-of-week" },
|
|
7
|
+
];
|
|
8
|
+
function createRange(start, end, step) {
|
|
9
|
+
const values = [];
|
|
10
|
+
for (let value = start; value <= end; value += step) {
|
|
11
|
+
values.push(value);
|
|
12
|
+
}
|
|
13
|
+
return values;
|
|
14
|
+
}
|
|
15
|
+
function parseStepPart(part, bounds) {
|
|
16
|
+
const stepParts = part.split("/");
|
|
17
|
+
if (stepParts.length > 2) {
|
|
18
|
+
throw new Error(`Invalid cron ${bounds.name} step`);
|
|
19
|
+
}
|
|
20
|
+
const [base, stepSource] = stepParts;
|
|
21
|
+
const normalizedStep = stepSource?.trim();
|
|
22
|
+
const step = normalizedStep === undefined ? 1 : Number.parseInt(normalizedStep, 10);
|
|
23
|
+
if (!Number.isInteger(step) ||
|
|
24
|
+
step <= 0 ||
|
|
25
|
+
(normalizedStep !== undefined && String(step) !== normalizedStep)) {
|
|
26
|
+
throw new Error(`Invalid cron ${bounds.name} step`);
|
|
27
|
+
}
|
|
28
|
+
return { base, step };
|
|
29
|
+
}
|
|
30
|
+
function parseField(source, bounds) {
|
|
31
|
+
const trimmed = source.trim();
|
|
32
|
+
if (!trimmed) {
|
|
33
|
+
throw new Error(`Invalid cron ${bounds.name} field`);
|
|
34
|
+
}
|
|
35
|
+
const allowed = new Set();
|
|
36
|
+
for (const rawPart of trimmed.split(",")) {
|
|
37
|
+
const part = rawPart.trim();
|
|
38
|
+
if (!part) {
|
|
39
|
+
throw new Error(`Invalid cron ${bounds.name} field`);
|
|
40
|
+
}
|
|
41
|
+
const { base, step } = parseStepPart(part, bounds);
|
|
42
|
+
if (base === "*") {
|
|
43
|
+
for (const value of createRange(bounds.min, bounds.max, step)) {
|
|
44
|
+
allowed.add(value);
|
|
45
|
+
}
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const rangeMatch = base.match(/^(\d+)-(\d+)$/);
|
|
49
|
+
if (rangeMatch) {
|
|
50
|
+
const start = Number.parseInt(rangeMatch[1], 10);
|
|
51
|
+
const end = Number.parseInt(rangeMatch[2], 10);
|
|
52
|
+
if (start > end || start < bounds.min || end > bounds.max) {
|
|
53
|
+
throw new Error(`Invalid cron ${bounds.name} range`);
|
|
54
|
+
}
|
|
55
|
+
for (const value of createRange(start, end, step)) {
|
|
56
|
+
allowed.add(value);
|
|
57
|
+
}
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (!/^\d+$/.test(base)) {
|
|
61
|
+
throw new Error(`Invalid cron ${bounds.name} value`);
|
|
62
|
+
}
|
|
63
|
+
const value = Number.parseInt(base, 10);
|
|
64
|
+
if (!Number.isInteger(value) || value < bounds.min || value > bounds.max) {
|
|
65
|
+
throw new Error(`Invalid cron ${bounds.name} value`);
|
|
66
|
+
}
|
|
67
|
+
allowed.add(value);
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
matches(value) {
|
|
71
|
+
return allowed.has(value);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export function parseCronExpression(expression) {
|
|
76
|
+
const parts = expression.trim().split(/\s+/);
|
|
77
|
+
if (parts.length !== 5) {
|
|
78
|
+
throw new Error("Cron expressions must have 5 fields");
|
|
79
|
+
}
|
|
80
|
+
return {
|
|
81
|
+
minute: parseField(parts[0], CRON_FIELD_BOUNDS[0]),
|
|
82
|
+
hour: parseField(parts[1], CRON_FIELD_BOUNDS[1]),
|
|
83
|
+
dayOfMonth: parseField(parts[2], CRON_FIELD_BOUNDS[2]),
|
|
84
|
+
month: parseField(parts[3], CRON_FIELD_BOUNDS[3]),
|
|
85
|
+
dayOfWeek: parseField(parts[4], CRON_FIELD_BOUNDS[4]),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function validateCronExpression(expression) {
|
|
89
|
+
try {
|
|
90
|
+
parseCronExpression(expression);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return error instanceof Error ? error.message : "Invalid cron expression";
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=cron-expression.js.map
|