@vesk/agentic 0.2.11
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 -0
- package/dist/checkpoints.d.ts +155 -0
- package/dist/checkpoints.d.ts.map +1 -0
- package/dist/checkpoints.js +394 -0
- package/dist/config.d.ts +57 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +399 -0
- package/dist/context.d.ts +21 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +64 -0
- package/dist/dev-api.d.ts +85 -0
- package/dist/dev-api.d.ts.map +1 -0
- package/dist/dev-api.js +942 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/loop.d.ts +156 -0
- package/dist/loop.d.ts.map +1 -0
- package/dist/loop.js +178 -0
- package/dist/permissions.d.ts +14 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +74 -0
- package/dist/plugin.d.ts +38 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +28 -0
- package/dist/providers/anthropic.d.ts +13 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +100 -0
- package/dist/providers/google.d.ts +12 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +87 -0
- package/dist/providers/ollama.d.ts +11 -0
- package/dist/providers/ollama.d.ts.map +1 -0
- package/dist/providers/ollama.js +61 -0
- package/dist/providers/openai.d.ts +12 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +193 -0
- package/dist/providers/registry.d.ts +7 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +33 -0
- package/dist/providers/types.d.ts +28 -0
- package/dist/providers/types.d.ts.map +1 -0
- package/dist/providers/types.js +15 -0
- package/dist/slash.d.ts +18 -0
- package/dist/slash.d.ts.map +1 -0
- package/dist/slash.js +77 -0
- package/dist/tools/browser.d.ts +3 -0
- package/dist/tools/browser.d.ts.map +1 -0
- package/dist/tools/browser.js +289 -0
- package/dist/tools/command.d.ts +14 -0
- package/dist/tools/command.d.ts.map +1 -0
- package/dist/tools/command.js +55 -0
- package/dist/tools/fs.d.ts +10 -0
- package/dist/tools/fs.d.ts.map +1 -0
- package/dist/tools/fs.js +142 -0
- package/dist/tools/vesk.d.ts +22 -0
- package/dist/tools/vesk.d.ts.map +1 -0
- package/dist/tools/vesk.js +828 -0
- package/dist/tools/web.d.ts +3 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +111 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vesk/agentic — Vesk agentic plugin
|
|
3
|
+
*
|
|
4
|
+
* Zero-deps agent loop, provider abstraction, permissions, tools, checkpoints.
|
|
5
|
+
* Installable plugin — core Vesk ships with zero AI deps.
|
|
6
|
+
* @module agentic
|
|
7
|
+
*/
|
|
8
|
+
export { default } from './plugin.js';
|
|
9
|
+
export { default as agenticPlugin } from './plugin.js';
|
|
10
|
+
export type { AgenticOptions } from './plugin.js';
|
|
11
|
+
export { Agent, MaxStepsExceededError, defineTool } from './loop.js';
|
|
12
|
+
export type { AgentOptions, AgentResult, Provider, Tool, ToolCall, CompletionRequest, CompletionResponse } from './loop.js';
|
|
13
|
+
export { openAiProvider } from './providers/openai.js';
|
|
14
|
+
export { anthropicProvider } from './providers/anthropic.js';
|
|
15
|
+
export { googleProvider } from './providers/google.js';
|
|
16
|
+
export { ollamaProvider } from './providers/ollama.js';
|
|
17
|
+
export type { ProviderConfig, ProviderName } from './providers/types.js';
|
|
18
|
+
export { AgentCapabilityTable, DEFAULT_PERMISSIONS, filterToolsByPermissions, isToolAllowed } from './permissions.js';
|
|
19
|
+
export type { AgentMode, AgentCapability } from './permissions.js';
|
|
20
|
+
export { loadFrameworkKnowledge, loadProjectKnowledge, assembleSystemPrompt } from './context.js';
|
|
21
|
+
export { CheckpointManager } from './checkpoints.js';
|
|
22
|
+
export type { Checkpoint } from './checkpoints.js';
|
|
23
|
+
export { createAgentRouter } from './dev-api.js';
|
|
24
|
+
export type { AgentRouter, AgentRouterOptions } from './dev-api.js';
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAGlD,OAAO,EAAE,KAAK,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG5H,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGzE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtH,YAAY,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGnE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAClG,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,YAAY,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vesk/agentic — Vesk agentic plugin
|
|
3
|
+
*
|
|
4
|
+
* Zero-deps agent loop, provider abstraction, permissions, tools, checkpoints.
|
|
5
|
+
* Installable plugin — core Vesk ships with zero AI deps.
|
|
6
|
+
* @module agentic
|
|
7
|
+
*/
|
|
8
|
+
export { default } from './plugin.js';
|
|
9
|
+
export { default as agenticPlugin } from './plugin.js';
|
|
10
|
+
// Core loop (vendored @narimangardi/agent-loop)
|
|
11
|
+
export { Agent, MaxStepsExceededError, defineTool } from './loop.js';
|
|
12
|
+
// Providers (fetch-only, zero SDKs)
|
|
13
|
+
export { openAiProvider } from './providers/openai.js';
|
|
14
|
+
export { anthropicProvider } from './providers/anthropic.js';
|
|
15
|
+
export { googleProvider } from './providers/google.js';
|
|
16
|
+
export { ollamaProvider } from './providers/ollama.js';
|
|
17
|
+
// Permissions
|
|
18
|
+
export { AgentCapabilityTable, DEFAULT_PERMISSIONS, filterToolsByPermissions, isToolAllowed } from './permissions.js';
|
|
19
|
+
// Context & checkpoints
|
|
20
|
+
export { loadFrameworkKnowledge, loadProjectKnowledge, assembleSystemPrompt } from './context.js';
|
|
21
|
+
export { CheckpointManager } from './checkpoints.js';
|
|
22
|
+
// Dev API
|
|
23
|
+
export { createAgentRouter } from './dev-api.js';
|
package/dist/loop.d.ts
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vesk/agentic — zero-deps agent loop
|
|
3
|
+
*
|
|
4
|
+
* Cloned from @narimangardi/agent-loop@0.3.0 (MIT, 20.7kB, zero deps).
|
|
5
|
+
* MIT-compatible: credit to Nariman Gardi. Vesk owns this copy so
|
|
6
|
+
* @vesk/agentic stays dependency-free and not tied to external publish.
|
|
7
|
+
*
|
|
8
|
+
* The whole thing is one class: ask LLM, run tools, feed results back,
|
|
9
|
+
* repeat until answer or maxSteps. Bring your own Provider (fetch-only).
|
|
10
|
+
*/
|
|
11
|
+
export interface ToolCall {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
arguments: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export type Message = {
|
|
17
|
+
role: 'system';
|
|
18
|
+
content: string;
|
|
19
|
+
} | {
|
|
20
|
+
role: 'user';
|
|
21
|
+
content: string;
|
|
22
|
+
} | {
|
|
23
|
+
role: 'assistant';
|
|
24
|
+
content: string | null;
|
|
25
|
+
toolCalls?: ToolCall[];
|
|
26
|
+
} | {
|
|
27
|
+
role: 'tool';
|
|
28
|
+
toolCallId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
content: string;
|
|
31
|
+
};
|
|
32
|
+
export interface Tool<A extends Record<string, unknown> = Record<string, unknown>> {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
parameters: Record<string, unknown>;
|
|
36
|
+
execute(args: A): string | Promise<string>;
|
|
37
|
+
}
|
|
38
|
+
export interface ToolSpec {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
parameters: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface CompletionRequest {
|
|
44
|
+
messages: Message[];
|
|
45
|
+
tools: ToolSpec[];
|
|
46
|
+
}
|
|
47
|
+
export type CompletionResponse = {
|
|
48
|
+
kind: 'message';
|
|
49
|
+
content: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: 'tool_calls';
|
|
52
|
+
toolCalls: ToolCall[];
|
|
53
|
+
};
|
|
54
|
+
/** Provider-level streaming event (one per `completeStream` invocation). */
|
|
55
|
+
export type StreamEvent = {
|
|
56
|
+
kind: 'delta';
|
|
57
|
+
content: string;
|
|
58
|
+
} | {
|
|
59
|
+
kind: 'message';
|
|
60
|
+
content: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: 'tool_calls';
|
|
63
|
+
toolCalls: ToolCall[];
|
|
64
|
+
};
|
|
65
|
+
export interface Provider {
|
|
66
|
+
complete(request: CompletionRequest): Promise<CompletionResponse>;
|
|
67
|
+
completeStream?(request: CompletionRequest): AsyncIterable<StreamEvent>;
|
|
68
|
+
listModels?(options: {
|
|
69
|
+
apiKey?: string;
|
|
70
|
+
baseUrl?: string;
|
|
71
|
+
}): Promise<string[]>;
|
|
72
|
+
}
|
|
73
|
+
export interface AgentOptions {
|
|
74
|
+
provider: Provider;
|
|
75
|
+
tools?: Tool[];
|
|
76
|
+
system?: string;
|
|
77
|
+
/** Soft step budget. The agent finishes as soon as the model returns a plain
|
|
78
|
+
message; once `step` passes this budget without a final message it either
|
|
79
|
+
throws `MaxStepsExceededError` (when `autoExtend` is false) or keeps going
|
|
80
|
+
(when `autoExtend` is true). Default 10. */
|
|
81
|
+
maxSteps?: number;
|
|
82
|
+
/** When true, tool-calling steps beyond `maxSteps` are allowed to continue up
|
|
83
|
+
to `hardMaxSteps` instead of stopping, so multi-step tasks aren't cut off
|
|
84
|
+
prematurely while progress is being made. Default false. */
|
|
85
|
+
autoExtend?: boolean;
|
|
86
|
+
/** Absolute step ceiling used when `autoExtend` is true. Defaults to
|
|
87
|
+
`max(maxSteps * 4, maxSteps + 20)`. */
|
|
88
|
+
hardMaxSteps?: number;
|
|
89
|
+
onStep?: (step: number) => void | Promise<void>;
|
|
90
|
+
onToolCall?: (call: ToolCall) => void | Promise<void>;
|
|
91
|
+
onToolResult?: (call: ToolCall, output: string) => void | Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
/** Agent-level streaming event (`runStream`). */
|
|
94
|
+
export type AgentStreamEvent = {
|
|
95
|
+
type: 'user';
|
|
96
|
+
content: string;
|
|
97
|
+
} | {
|
|
98
|
+
type: 'step';
|
|
99
|
+
step: number;
|
|
100
|
+
budget: number;
|
|
101
|
+
} | {
|
|
102
|
+
type: 'assistant_start';
|
|
103
|
+
step: number;
|
|
104
|
+
} | {
|
|
105
|
+
type: 'text_delta';
|
|
106
|
+
content: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: 'assistant_end';
|
|
109
|
+
step: number;
|
|
110
|
+
content: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: 'tool_call';
|
|
113
|
+
step: number;
|
|
114
|
+
call: ToolCall;
|
|
115
|
+
} | {
|
|
116
|
+
type: 'tool_result';
|
|
117
|
+
step: number;
|
|
118
|
+
call: ToolCall;
|
|
119
|
+
output: string;
|
|
120
|
+
} | {
|
|
121
|
+
type: 'done';
|
|
122
|
+
result: AgentResult;
|
|
123
|
+
} | {
|
|
124
|
+
type: 'error';
|
|
125
|
+
message: string;
|
|
126
|
+
};
|
|
127
|
+
export interface AgentResult {
|
|
128
|
+
text: string;
|
|
129
|
+
steps: number;
|
|
130
|
+
messages: Message[];
|
|
131
|
+
}
|
|
132
|
+
export declare class MaxStepsExceededError extends Error {
|
|
133
|
+
readonly steps: number;
|
|
134
|
+
readonly messages: Message[];
|
|
135
|
+
constructor(steps: number, messages: Message[]);
|
|
136
|
+
}
|
|
137
|
+
export declare function defineTool<A extends Record<string, unknown> = Record<string, unknown>>(tool: Tool<A>): Tool<A>;
|
|
138
|
+
export declare class Agent {
|
|
139
|
+
private readonly provider;
|
|
140
|
+
private readonly tools;
|
|
141
|
+
private readonly toolSpecs;
|
|
142
|
+
private readonly system?;
|
|
143
|
+
private readonly maxSteps;
|
|
144
|
+
private readonly stepBudget;
|
|
145
|
+
private readonly onStep?;
|
|
146
|
+
private readonly onToolCall?;
|
|
147
|
+
private readonly onToolResult?;
|
|
148
|
+
constructor(options: AgentOptions);
|
|
149
|
+
run(prompt: string): Promise<AgentResult>;
|
|
150
|
+
/** Stream the agent run. Mirrors `run()` but yields progress events, including
|
|
151
|
+
text deltas as the model generates them (via `provider.completeStream` when
|
|
152
|
+
available; otherwise the final message is emitted as a single delta). */
|
|
153
|
+
runStream(prompt: string): AsyncGenerator<AgentStreamEvent>;
|
|
154
|
+
private runTool;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../src/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,OAAO,GACf;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAA;CAAE,GACrE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExE,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC/E,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW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k/agentic — zero-deps agent loop
|
|
3
|
+
*
|
|
4
|
+
* Cloned from @narimangardi/agent-loop@0.3.0 (MIT, 20.7kB, zero deps).
|
|
5
|
+
* MIT-compatible: credit to Nariman Gardi. Vesk owns this copy so
|
|
6
|
+
* @vesk/agentic stays dependency-free and not tied to external publish.
|
|
7
|
+
*
|
|
8
|
+
* The whole thing is one class: ask LLM, run tools, feed results back,
|
|
9
|
+
* repeat until answer or maxSteps. Bring your own Provider (fetch-only).
|
|
10
|
+
*/
|
|
11
|
+
export class MaxStepsExceededError extends Error {
|
|
12
|
+
steps;
|
|
13
|
+
messages;
|
|
14
|
+
constructor(steps, messages) {
|
|
15
|
+
super(`Agent did not finish within ${steps} steps`);
|
|
16
|
+
this.steps = steps;
|
|
17
|
+
this.messages = messages;
|
|
18
|
+
this.name = 'MaxStepsExceededError';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export function defineTool(tool) {
|
|
22
|
+
return tool;
|
|
23
|
+
}
|
|
24
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
25
|
+
// Agent
|
|
26
|
+
// ──────────────────────────────────────────────────────────────────────────────
|
|
27
|
+
export class Agent {
|
|
28
|
+
provider;
|
|
29
|
+
tools;
|
|
30
|
+
toolSpecs;
|
|
31
|
+
system;
|
|
32
|
+
maxSteps;
|
|
33
|
+
stepBudget;
|
|
34
|
+
onStep;
|
|
35
|
+
onToolCall;
|
|
36
|
+
onToolResult;
|
|
37
|
+
constructor(options) {
|
|
38
|
+
const tools = options.tools ?? [];
|
|
39
|
+
this.provider = options.provider;
|
|
40
|
+
this.tools = new Map(tools.map((t) => [t.name, t]));
|
|
41
|
+
this.toolSpecs = tools.map(({ name, description, parameters }) => ({ name, description, parameters }));
|
|
42
|
+
this.system = options.system;
|
|
43
|
+
const softMax = Math.max(1, Math.floor(options.maxSteps ?? 10));
|
|
44
|
+
this.maxSteps = softMax;
|
|
45
|
+
if (options.autoExtend) {
|
|
46
|
+
const hard = options.hardMaxSteps === undefined ? Math.max(softMax * 4, softMax + 20) : Math.max(softMax, Math.floor(options.hardMaxSteps));
|
|
47
|
+
this.stepBudget = Math.min(hard, 10000);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.stepBudget = softMax;
|
|
51
|
+
}
|
|
52
|
+
this.onStep = options.onStep;
|
|
53
|
+
this.onToolCall = options.onToolCall;
|
|
54
|
+
this.onToolResult = options.onToolResult;
|
|
55
|
+
}
|
|
56
|
+
async run(prompt) {
|
|
57
|
+
const messages = [];
|
|
58
|
+
if (this.system !== undefined)
|
|
59
|
+
messages.push({ role: 'system', content: this.system });
|
|
60
|
+
messages.push({ role: 'user', content: prompt });
|
|
61
|
+
for (let step = 1; step <= this.stepBudget; step++) {
|
|
62
|
+
await this.onStep?.(step);
|
|
63
|
+
const response = await this.provider.complete({ messages, tools: this.toolSpecs });
|
|
64
|
+
if (response.kind === 'message') {
|
|
65
|
+
messages.push({ role: 'assistant', content: response.content });
|
|
66
|
+
return { text: response.content, steps: step, messages };
|
|
67
|
+
}
|
|
68
|
+
messages.push({ role: 'assistant', content: null, toolCalls: response.toolCalls });
|
|
69
|
+
const results = await Promise.all(response.toolCalls.map(async (call) => {
|
|
70
|
+
await this.onToolCall?.(call);
|
|
71
|
+
return { call, output: await this.runTool(call) };
|
|
72
|
+
}));
|
|
73
|
+
for (const { call, output } of results) {
|
|
74
|
+
await this.onToolResult?.(call, output);
|
|
75
|
+
messages.push({ role: 'tool', toolCallId: call.id, name: call.name, content: output });
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
throw new MaxStepsExceededError(this.stepBudget, messages);
|
|
79
|
+
}
|
|
80
|
+
/** Stream the agent run. Mirrors `run()` but yields progress events, including
|
|
81
|
+
text deltas as the model generates them (via `provider.completeStream` when
|
|
82
|
+
available; otherwise the final message is emitted as a single delta). */
|
|
83
|
+
async *runStream(prompt) {
|
|
84
|
+
const messages = [];
|
|
85
|
+
if (this.system !== undefined)
|
|
86
|
+
messages.push({ role: 'system', content: this.system });
|
|
87
|
+
messages.push({ role: 'user', content: prompt });
|
|
88
|
+
yield { type: 'user', content: prompt };
|
|
89
|
+
for (let step = 1; step <= this.stepBudget; step++) {
|
|
90
|
+
yield { type: 'step', step, budget: this.stepBudget };
|
|
91
|
+
await this.onStep?.(step);
|
|
92
|
+
if (this.provider.completeStream) {
|
|
93
|
+
yield { type: 'assistant_start', step };
|
|
94
|
+
let content = '';
|
|
95
|
+
let term = { kind: 'message', content: '' };
|
|
96
|
+
try {
|
|
97
|
+
for await (const ev of this.provider.completeStream({ messages, tools: this.toolSpecs })) {
|
|
98
|
+
if (ev.kind === 'delta') {
|
|
99
|
+
content += ev.content;
|
|
100
|
+
yield { type: 'text_delta', content: ev.content };
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
term = ev;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
yield { type: 'error', message: e instanceof Error ? e.message : String(e) };
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (term.kind === 'message') {
|
|
112
|
+
messages.push({ role: 'assistant', content });
|
|
113
|
+
yield { type: 'assistant_end', step, content };
|
|
114
|
+
yield { type: 'done', result: { text: content, steps: step, messages } };
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const toolCalls = term.toolCalls ?? [];
|
|
118
|
+
if (toolCalls.length === 0) {
|
|
119
|
+
messages.push({ role: 'assistant', content });
|
|
120
|
+
yield { type: 'assistant_end', step, content };
|
|
121
|
+
yield { type: 'done', result: { text: content, steps: step, messages } };
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
messages.push({ role: 'assistant', content: null, toolCalls });
|
|
125
|
+
const results = await Promise.all(toolCalls.map(async (call) => {
|
|
126
|
+
await this.onToolCall?.(call);
|
|
127
|
+
return { call, output: await this.runTool(call) };
|
|
128
|
+
}));
|
|
129
|
+
for (const { call, output } of results) {
|
|
130
|
+
await this.onToolResult?.(call, output);
|
|
131
|
+
yield { type: 'tool_call', step, call };
|
|
132
|
+
yield { type: 'tool_result', step, call, output };
|
|
133
|
+
messages.push({ role: 'tool', toolCallId: call.id, name: call.name, content: output });
|
|
134
|
+
}
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
let response;
|
|
138
|
+
try {
|
|
139
|
+
response = await this.provider.complete({ messages, tools: this.toolSpecs });
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
yield { type: 'error', message: e instanceof Error ? e.message : String(e) };
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (response.kind === 'message') {
|
|
146
|
+
yield { type: 'assistant_start', step };
|
|
147
|
+
yield { type: 'text_delta', content: response.content };
|
|
148
|
+
messages.push({ role: 'assistant', content: response.content });
|
|
149
|
+
yield { type: 'assistant_end', step, content: response.content };
|
|
150
|
+
yield { type: 'done', result: { text: response.content, steps: step, messages } };
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
messages.push({ role: 'assistant', content: null, toolCalls: response.toolCalls });
|
|
154
|
+
const results = await Promise.all(response.toolCalls.map(async (call) => {
|
|
155
|
+
await this.onToolCall?.(call);
|
|
156
|
+
return { call, output: await this.runTool(call) };
|
|
157
|
+
}));
|
|
158
|
+
for (const { call, output } of results) {
|
|
159
|
+
await this.onToolResult?.(call, output);
|
|
160
|
+
yield { type: 'tool_call', step, call };
|
|
161
|
+
yield { type: 'tool_result', step, call, output };
|
|
162
|
+
messages.push({ role: 'tool', toolCallId: call.id, name: call.name, content: output });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
yield { type: 'error', message: `Agent did not finish within ${this.stepBudget} steps` };
|
|
166
|
+
}
|
|
167
|
+
async runTool(call) {
|
|
168
|
+
const tool = this.tools.get(call.name);
|
|
169
|
+
if (tool === undefined)
|
|
170
|
+
return `Error: unknown tool "${call.name}"`;
|
|
171
|
+
try {
|
|
172
|
+
return await tool.execute(call.arguments);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
return `Error: ${e instanceof Error ? e.message : String(e)}`;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from './loop.js';
|
|
2
|
+
export type AgentMode = 'explore' | 'debug' | 'agent';
|
|
3
|
+
export type AgentCapability = 'readFiles' | 'writeFiles' | 'deleteFiles' | 'executeCommands' | 'installPackages' | 'modifyConfig' | 'managePlugins' | 'runBuild' | 'runTests' | 'modifyAgentsMd' | 'createCheckpoint' | 'rollback';
|
|
4
|
+
export declare const DEFAULT_PERMISSIONS: Record<AgentMode, Set<AgentCapability>>;
|
|
5
|
+
export declare class AgentCapabilityTable {
|
|
6
|
+
readonly mode: AgentMode;
|
|
7
|
+
private caps;
|
|
8
|
+
constructor(mode: AgentMode, overrides?: Partial<Record<AgentCapability, boolean>>);
|
|
9
|
+
allows(cap: AgentCapability): boolean;
|
|
10
|
+
isToolAllowed(toolName: string): boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function filterToolsByPermissions(tools: Tool[], table: AgentCapabilityTable): Tool[];
|
|
13
|
+
export declare function isToolAllowed(toolName: string, table: AgentCapabilityTable): boolean;
|
|
14
|
+
//# sourceMappingURL=permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../src/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEtD,MAAM,MAAM,eAAe,GACvB,WAAW,GACX,YAAY,GACZ,aAAa,GACb,iBAAiB,GACjB,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,UAAU,GACV,gBAAgB,GAChB,kBAAkB,GAClB,UAAU,CAAC;AAmBf,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,eAAe,CAAC,CAIvE,CAAC;AAwBF,qBAAa,oBAAoB;IAC/B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,OAAO,CAAC,IAAI,CAAuB;gBAEvB,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;IAYlF,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO;IAIrC,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;CAKzC;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,oBAAoB,GAAG,IAAI,EAAE,CAE3F;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAEpF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const EXPLORE_CAPS = new Set(['readFiles']);
|
|
2
|
+
const DEBUG_CAPS = new Set(['readFiles', 'writeFiles', 'runBuild', 'runTests', 'createCheckpoint']);
|
|
3
|
+
const AGENT_CAPS = new Set([
|
|
4
|
+
'readFiles',
|
|
5
|
+
'writeFiles',
|
|
6
|
+
'deleteFiles',
|
|
7
|
+
'executeCommands',
|
|
8
|
+
'installPackages',
|
|
9
|
+
'modifyConfig',
|
|
10
|
+
'managePlugins',
|
|
11
|
+
'runBuild',
|
|
12
|
+
'runTests',
|
|
13
|
+
'modifyAgentsMd',
|
|
14
|
+
'createCheckpoint',
|
|
15
|
+
'rollback',
|
|
16
|
+
]);
|
|
17
|
+
export const DEFAULT_PERMISSIONS = {
|
|
18
|
+
explore: EXPLORE_CAPS,
|
|
19
|
+
debug: DEBUG_CAPS,
|
|
20
|
+
agent: AGENT_CAPS,
|
|
21
|
+
};
|
|
22
|
+
// Tool -> capability map (server-enforced)
|
|
23
|
+
const TOOL_CAP = {
|
|
24
|
+
'vesk.inspectProject': 'readFiles',
|
|
25
|
+
'vesk.inspectComponent': 'readFiles',
|
|
26
|
+
'vesk.readConfig': 'readFiles',
|
|
27
|
+
'vesk.updateConfig': 'modifyConfig',
|
|
28
|
+
'vesk.getDiagnostics': 'readFiles',
|
|
29
|
+
'vesk.getCompilerErrors': 'readFiles',
|
|
30
|
+
'vesk.runBuild': 'runBuild',
|
|
31
|
+
'vesk.runTests': 'runTests',
|
|
32
|
+
'vesk.installPlugin': 'installPackages',
|
|
33
|
+
'vesk.uninstallPlugin': 'installPackages',
|
|
34
|
+
'vesk.enablePlugin': 'managePlugins',
|
|
35
|
+
'vesk.disablePlugin': 'managePlugins',
|
|
36
|
+
'vesk.createCheckpoint': 'createCheckpoint',
|
|
37
|
+
'vesk.rollback': 'rollback',
|
|
38
|
+
'filesystem.read': 'readFiles',
|
|
39
|
+
'filesystem.write': 'writeFiles',
|
|
40
|
+
'filesystem.delete': 'deleteFiles',
|
|
41
|
+
'command.execute': 'executeCommands',
|
|
42
|
+
};
|
|
43
|
+
export class AgentCapabilityTable {
|
|
44
|
+
mode;
|
|
45
|
+
caps;
|
|
46
|
+
constructor(mode, overrides) {
|
|
47
|
+
this.mode = mode;
|
|
48
|
+
const base = new Set(DEFAULT_PERMISSIONS[mode]);
|
|
49
|
+
if (overrides) {
|
|
50
|
+
for (const [k, v] of Object.entries(overrides)) {
|
|
51
|
+
if (v)
|
|
52
|
+
base.add(k);
|
|
53
|
+
else
|
|
54
|
+
base.delete(k);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
this.caps = base;
|
|
58
|
+
}
|
|
59
|
+
allows(cap) {
|
|
60
|
+
return this.caps.has(cap);
|
|
61
|
+
}
|
|
62
|
+
isToolAllowed(toolName) {
|
|
63
|
+
const needed = TOOL_CAP[toolName];
|
|
64
|
+
if (!needed)
|
|
65
|
+
return true; // unknown tools — allow, but caller should validate
|
|
66
|
+
return this.allows(needed);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export function filterToolsByPermissions(tools, table) {
|
|
70
|
+
return tools.filter((t) => table.isToolAllowed(t.name));
|
|
71
|
+
}
|
|
72
|
+
export function isToolAllowed(toolName, table) {
|
|
73
|
+
return table.isToolAllowed(toolName);
|
|
74
|
+
}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vesk/agentic — Agentic AI plugin for Vesk.
|
|
3
|
+
*
|
|
4
|
+
* Zero-deps agent loop, provider abstraction, permissions, tools, checkpoints.
|
|
5
|
+
* Installable & toggleable: inactive ⇒ zero bundle/build cost. All AI
|
|
6
|
+
* machinery (provider/model/key, modes, permissions, context, tools,
|
|
7
|
+
* checkpoints) is owned by this plugin — core Vesk ships no agent runtime.
|
|
8
|
+
*
|
|
9
|
+
* @module agentic/plugin
|
|
10
|
+
*/
|
|
11
|
+
export interface AgenticOptions {
|
|
12
|
+
/** LLM provider. Default 'openai'. */
|
|
13
|
+
provider?: 'openai' | 'anthropic' | 'google' | 'ollama' | 'opencode' | 'opencode-go' | 'openrouter' | 'loopers' | 'custom';
|
|
14
|
+
/** Model name (e.g. gpt-4o-mini, claude-sonnet-4-6, gemini-2.0-flash, llama3.1). */
|
|
15
|
+
model?: string;
|
|
16
|
+
/** API key. Stored per-provider in the project `.env.local` as VK_{PROVIDER}_KEY — never commit to git. */
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
/** Custom base URL for OpenAI-compatible providers or self-hosted Ollama. */
|
|
19
|
+
baseUrl?: string;
|
|
20
|
+
/** Max tokens for completion. */
|
|
21
|
+
maxTokens?: number;
|
|
22
|
+
/** Default agent mode (capability-gated via Dev Server). Default 'explore'. */
|
|
23
|
+
mode?: 'explore' | 'debug' | 'agent';
|
|
24
|
+
/** Max agent loop steps. Default 10. */
|
|
25
|
+
maxSteps?: number;
|
|
26
|
+
}
|
|
27
|
+
type AgenticPlugin = {
|
|
28
|
+
name: string;
|
|
29
|
+
dependencies: Set<string>;
|
|
30
|
+
onBuildStart: () => Promise<void>;
|
|
31
|
+
onBuildEnd: () => Promise<void>;
|
|
32
|
+
onFileWatch: (filePath: string) => Promise<{
|
|
33
|
+
handled: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
export default function agenticPlugin(options?: AgenticOptions): AgenticPlugin;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,WAAW,cAAc;IAC7B,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,QAAQ,CAAC;IAC3H,oFAAoF;IACpF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2GAA2G;IAC3G,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;IACrC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAID,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,YAAY,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,WAAW,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;CAClE,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,OAAO,GAAE,cAAmB,GAAG,aAAa,CAoBjF"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @vesk/agentic — Agentic AI plugin for Vesk.
|
|
3
|
+
*
|
|
4
|
+
* Zero-deps agent loop, provider abstraction, permissions, tools, checkpoints.
|
|
5
|
+
* Installable & toggleable: inactive ⇒ zero bundle/build cost. All AI
|
|
6
|
+
* machinery (provider/model/key, modes, permissions, context, tools,
|
|
7
|
+
* checkpoints) is owned by this plugin — core Vesk ships no agent runtime.
|
|
8
|
+
*
|
|
9
|
+
* @module agentic/plugin
|
|
10
|
+
*/
|
|
11
|
+
export default function agenticPlugin(options = {}) {
|
|
12
|
+
void options;
|
|
13
|
+
return {
|
|
14
|
+
name: '@vesk/agentic',
|
|
15
|
+
dependencies: new Set(),
|
|
16
|
+
async onBuildStart() {
|
|
17
|
+
// No build-time transform: the agentic plugin is dev-server gated.
|
|
18
|
+
// Capabilities (agent, checkpoints) are served via the Dev Server API
|
|
19
|
+
// and rendered in the devtools AI panel when installed & active.
|
|
20
|
+
},
|
|
21
|
+
async onBuildEnd() {
|
|
22
|
+
// No-op: ensures validateConfig sees a recognized hook.
|
|
23
|
+
},
|
|
24
|
+
async onFileWatch(_filePath) {
|
|
25
|
+
return { handled: false };
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Provider } from '../loop.js';
|
|
2
|
+
export interface AnthropicOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
maxTokens?: number;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function listModels(options?: {
|
|
9
|
+
apiKey?: string;
|
|
10
|
+
baseUrl?: string;
|
|
11
|
+
}): Promise<string[]>;
|
|
12
|
+
export declare function anthropicProvider(options: AnthropicOptions): Provider;
|
|
13
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkD,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3F,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,wBAAsB,UAAU,CAAC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAmBvG;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,QAAQ,CAqCrE"}
|