@dream_engine/agent 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/LICENSE +21 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/collaboration.d.ts +75 -0
- package/dist/collaboration.d.ts.map +1 -0
- package/dist/collaboration.js +332 -0
- package/dist/collaboration.js.map +1 -0
- package/dist/engine.d.ts +126 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +241 -0
- package/dist/engine.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/local-model.d.ts +85 -0
- package/dist/local-model.d.ts.map +1 -0
- package/dist/local-model.js +183 -0
- package/dist/local-model.js.map +1 -0
- package/dist/mcp.d.ts +56 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +181 -0
- package/dist/mcp.js.map +1 -0
- package/dist/orchestrator.d.ts +166 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +416 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/providers.d.ts +110 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +148 -0
- package/dist/providers.js.map +1 -0
- package/dist/tools.d.ts +136 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +189 -0
- package/dist/tools.js.map +1 -0
- package/package.json +34 -3
- package/README.md +0 -3
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { ConfigurationError, RuntimeError, ValidationError, serializeError, redactUrl } from '@dream_engine/core';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a raw model completion into a {@link ModelDecision}.
|
|
4
|
+
* Handles both JSON-only output and output with surrounding prose/fences.
|
|
5
|
+
* Returns a `needsHelp` decision when the output cannot be parsed or references
|
|
6
|
+
* unknown tools / prompt-injection patterns.
|
|
7
|
+
*/
|
|
8
|
+
export function parseDecision(text, input, options = {}) {
|
|
9
|
+
// Prefer native tool calls when the provider supports them.
|
|
10
|
+
if (options.nativeToolCalls?.length) {
|
|
11
|
+
const tc = options.nativeToolCalls[0];
|
|
12
|
+
if (tc.name && input.tools.some((t) => t.name === tc.name)) {
|
|
13
|
+
return { action: 'tool', tool: tc.name, args: tc.args, reasoning: `native tool call: ${tc.name}` };
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// Extract JSON from the text (handles ```json fences and surrounding prose).
|
|
17
|
+
const jsonMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/i) ?? text.match(/(\{[\s\S]*\})/);
|
|
18
|
+
const raw = jsonMatch?.[1] ? jsonMatch[1].trim() : text.trim();
|
|
19
|
+
let obj;
|
|
20
|
+
try {
|
|
21
|
+
obj = JSON.parse(raw);
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return { action: 'needsHelp', reason: `Model did not return a JSON decision: ${text.slice(0, 200)}` };
|
|
25
|
+
}
|
|
26
|
+
if (!obj || typeof obj !== 'object')
|
|
27
|
+
return { action: 'needsHelp', reason: 'Model decision was not an object' };
|
|
28
|
+
const decision = obj;
|
|
29
|
+
const action = decision.action;
|
|
30
|
+
// Prompt-injection guard: reject decisions that look like instructions rather than decisions.
|
|
31
|
+
const injected = detectPromptInjection(text);
|
|
32
|
+
if (injected.length > 0) {
|
|
33
|
+
return { action: 'needsHelp', reason: `Rejected a tool decision that matched prompt-injection patterns: ${injected.map((f) => f.pattern).join(', ')}` };
|
|
34
|
+
}
|
|
35
|
+
if (action === 'tool') {
|
|
36
|
+
const tool = typeof decision.tool === 'string' ? decision.tool : '';
|
|
37
|
+
if (!tool)
|
|
38
|
+
return { action: 'needsHelp', reason: 'Tool decision missing tool name' };
|
|
39
|
+
if (!input.tools.some((t) => t.name === tool)) {
|
|
40
|
+
return { action: 'needsHelp', reason: `Model requested unknown tool: ${tool}` };
|
|
41
|
+
}
|
|
42
|
+
const args = decision.args ?? {};
|
|
43
|
+
const reasoning = typeof decision.reasoning === 'string' ? decision.reasoning : '';
|
|
44
|
+
return { action: 'tool', tool, args, reasoning };
|
|
45
|
+
}
|
|
46
|
+
if (action === 'done') {
|
|
47
|
+
const summary = typeof decision.summary === 'string' ? decision.summary : '';
|
|
48
|
+
const verified = decision.verified === true;
|
|
49
|
+
return { action: 'done', summary, verified };
|
|
50
|
+
}
|
|
51
|
+
if (action === 'needsHelp') {
|
|
52
|
+
const reason = typeof decision.reason === 'string' ? decision.reason : 'Model requested help';
|
|
53
|
+
return { action: 'needsHelp', reason };
|
|
54
|
+
}
|
|
55
|
+
return { action: 'needsHelp', reason: `Model returned unparseable output: ${text.slice(0, 200)}` };
|
|
56
|
+
}
|
|
57
|
+
/** Common prompt-injection patterns that must not be treated as model decisions. */
|
|
58
|
+
function detectPromptInjection(text) {
|
|
59
|
+
const patterns = [
|
|
60
|
+
/ignore (all )?(previous|prior|above) (instructions|prompts)/i,
|
|
61
|
+
/you (must|should|need to|have to) (run|execute|delete|remove|ignore)/i,
|
|
62
|
+
/disregard (all )?(previous|prior)/i,
|
|
63
|
+
/\bsystem\s*prompt\b/i,
|
|
64
|
+
/reveal (your|the) (system )?prompt/i,
|
|
65
|
+
];
|
|
66
|
+
return patterns.filter((p) => p.test(text)).map((p) => ({ pattern: p.source }));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A {@link ReasoningModel} backed by a {@link LocalModelClient}.
|
|
70
|
+
*
|
|
71
|
+
* This is the **local-only** default. It talks plain HTTP to a local model server
|
|
72
|
+
* (Ollama, llama.cpp, vLLM, LM Studio). It never contacts an external/cloud AI API.
|
|
73
|
+
* If the local server is unreachable, the call fails loudly (RuntimeError) — there is
|
|
74
|
+
* no silent cloud fallback.
|
|
75
|
+
*/
|
|
76
|
+
export class LocalReasoningModel {
|
|
77
|
+
client;
|
|
78
|
+
systemContext;
|
|
79
|
+
constructor(client, systemContext) {
|
|
80
|
+
this.client = client;
|
|
81
|
+
this.systemContext = systemContext;
|
|
82
|
+
}
|
|
83
|
+
async nextAction(input) {
|
|
84
|
+
const system = this.buildSystemPrompt(input);
|
|
85
|
+
const user = this.buildUserPrompt(input);
|
|
86
|
+
const result = await this.client.complete(user, {
|
|
87
|
+
system,
|
|
88
|
+
temperature: 0,
|
|
89
|
+
maxTokens: 1024,
|
|
90
|
+
});
|
|
91
|
+
return parseDecision(result.text, input);
|
|
92
|
+
}
|
|
93
|
+
buildSystemPrompt(input) {
|
|
94
|
+
const base = [
|
|
95
|
+
'You are a BashirWeb agent controller running entirely on a LOCAL model.',
|
|
96
|
+
'You drive real tools to accomplish the user objective. Decide the next single action each turn.',
|
|
97
|
+
'You MUST return ONLY a JSON object, one of:',
|
|
98
|
+
'{"action":"tool","tool":"<tool_name>","args":{...},"reasoning":"<why>"}',
|
|
99
|
+
'{"action":"done","summary":"<final report>","verified":true|false}',
|
|
100
|
+
'{"action":"needsHelp","reason":"<why you cannot safely continue>"}',
|
|
101
|
+
`Available tools:\n${input.tools.map((t) => `- ${t.name}: ${t.description}`).join('\n')}`,
|
|
102
|
+
'Rules: never invent tools; never claim success without verifying; if a previous action failed, adapt rather than repeat it; when blocked (login, captcha, permission, missing info), return needsHelp.',
|
|
103
|
+
'Respond with ONLY the JSON object, no markdown fences, no extra text.',
|
|
104
|
+
].join('\n');
|
|
105
|
+
return this.systemContext ? `${this.systemContext}\n\n${base}` : base;
|
|
106
|
+
}
|
|
107
|
+
buildUserPrompt(input) {
|
|
108
|
+
const historyLines = input.history
|
|
109
|
+
.slice(-15)
|
|
110
|
+
.map((o) => `${o.at} [${o.ok ? 'ok' : 'fail'}] ${o.tool}: ${o.summary}`)
|
|
111
|
+
.join('\n');
|
|
112
|
+
return [
|
|
113
|
+
`Objective: ${input.goal}`,
|
|
114
|
+
`Steps taken: ${input.stepsTaken}/${input.maxSteps}`,
|
|
115
|
+
historyLines ? `\nRecent history:\n${historyLines}` : '\nNo actions taken yet.',
|
|
116
|
+
'\nWhat is your next action? Return the JSON decision.',
|
|
117
|
+
].join('\n');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Creates a local-only {@link ReasoningModel} from a {@link LocalModelClient}.
|
|
122
|
+
* Throws {@link ConfigurationError} if the client is null — there is no cloud fallback.
|
|
123
|
+
*/
|
|
124
|
+
export function createLocalReasoningModel(client, systemContext) {
|
|
125
|
+
if (!client) {
|
|
126
|
+
throw new ConfigurationError('No local model is configured. BashirWeb requires a LOCAL model (e.g. Ollama) for AI reasoning. ' +
|
|
127
|
+
'No cloud AI APIs are used. Install and start Ollama, pull a model (e.g. "ollama pull llama3.1"), ' +
|
|
128
|
+
'and configure it via the "ai" config section (ai.enabled=true, ai.provider="ollama").');
|
|
129
|
+
}
|
|
130
|
+
return new LocalReasoningModel(client, systemContext);
|
|
131
|
+
}
|
|
132
|
+
/** Detects whether a local model is available by probing the client's health. */
|
|
133
|
+
export async function detectLocalModel(client, signal) {
|
|
134
|
+
if (!client) {
|
|
135
|
+
return {
|
|
136
|
+
available: false,
|
|
137
|
+
detail: 'No local model client configured. Set ai.enabled=true with ai.provider="ollama" and a model.',
|
|
138
|
+
models: null,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
const health = await client.health(signal);
|
|
142
|
+
return {
|
|
143
|
+
available: health.ok,
|
|
144
|
+
detail: health.message,
|
|
145
|
+
models: health.models,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"providers.js","sourceRoot":"","sources":["../src/providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,SAAS,EAAwB,MAAM,oBAAoB,CAAC;AAkExI;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAY,EACZ,KAAqB,EACrB,UAAwF,EAAE;IAE1F,4DAA4D;IAC5D,IAAI,OAAO,CA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C,IAAI,EAAE;YAC1B,gBAAgB,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,QAAQ,EAAE;YACpD,YAAY,CAAC,CAAC,CAAC,sBAAsB,YAAY,EAAE,CAAC,CAAC,CAAC,yBAAyB;YAC/E,uDAAuD;SACxD,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,MAA+B,EAC/B,aAAsB;IAEtB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,kBAAkB,CAC1B,iGAAiG;YAC/F,mGAAmG;YACnG,uFAAuF,CAC1F,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACxD,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAA+B,EAC/B,MAAoB;IAEpB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,MAAM,EAAE,8FAA8F;YACtG,MAAM,EAAE,IAAI;SACb,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAC3C,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,EAAE;QACpB,MAAM,EAAE,MAAM,CAAC,OAAO;QACtB,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC;AACJ,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { type SerializedError } from '@dream_engine/core';
|
|
2
|
+
/** JSON Schema subset used for tool inputs (object/string/number/integer/boolean/array/enum). */
|
|
3
|
+
export interface JsonSchema {
|
|
4
|
+
type?: 'object' | 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
5
|
+
description?: string;
|
|
6
|
+
properties?: Record<string, JsonSchema>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
additionalProperties?: boolean;
|
|
9
|
+
items?: JsonSchema;
|
|
10
|
+
enum?: Array<string | number | boolean>;
|
|
11
|
+
minimum?: number;
|
|
12
|
+
maximum?: number;
|
|
13
|
+
minLength?: number;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
/** ECMAScript regular expression the whole string must match (anchor it with ^…$). */
|
|
16
|
+
pattern?: string;
|
|
17
|
+
minItems?: number;
|
|
18
|
+
maxItems?: number;
|
|
19
|
+
default?: unknown;
|
|
20
|
+
oneOf?: JsonSchema[];
|
|
21
|
+
}
|
|
22
|
+
/** Structured result returned by every agent tool. */
|
|
23
|
+
export interface AgentResult<T = unknown> {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
tool: string;
|
|
26
|
+
data: T | null;
|
|
27
|
+
error: SerializedError | null;
|
|
28
|
+
meta: {
|
|
29
|
+
durationMs: number;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
/** Optional binary attachments (e.g. screenshots) for transports that support them. */
|
|
33
|
+
attachments?: Array<{
|
|
34
|
+
type: 'image';
|
|
35
|
+
mimeType: string;
|
|
36
|
+
data: string;
|
|
37
|
+
}>;
|
|
38
|
+
}
|
|
39
|
+
export interface ToolContext {
|
|
40
|
+
signal?: AbortSignal;
|
|
41
|
+
/** Identity of the caller (used for isolation in hosted mode). */
|
|
42
|
+
owner?: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface ToolOutput<T = unknown> {
|
|
45
|
+
data: T;
|
|
46
|
+
meta?: Record<string, unknown>;
|
|
47
|
+
attachments?: AgentResult['attachments'];
|
|
48
|
+
}
|
|
49
|
+
/** Public description of a tool (as listed by `tools/list` and `GET /v1/tools`). */
|
|
50
|
+
export type ToolInfo = Pick<AgentTool, 'name' | 'description' | 'inputSchema' | 'annotations'>;
|
|
51
|
+
export interface AgentTool<A = Record<string, unknown>, T = unknown> {
|
|
52
|
+
name: string;
|
|
53
|
+
description: string;
|
|
54
|
+
inputSchema: JsonSchema & {
|
|
55
|
+
type: 'object';
|
|
56
|
+
};
|
|
57
|
+
/** Hints for clients (MCP annotations). */
|
|
58
|
+
annotations?: {
|
|
59
|
+
readOnlyHint?: boolean;
|
|
60
|
+
destructiveHint?: boolean;
|
|
61
|
+
idempotentHint?: boolean;
|
|
62
|
+
openWorldHint?: boolean;
|
|
63
|
+
};
|
|
64
|
+
handler(args: A, ctx: ToolContext): Promise<ToolOutput<T>>;
|
|
65
|
+
}
|
|
66
|
+
export declare function defineTool<A = Record<string, unknown>, T = unknown>(tool: AgentTool<A, T>): AgentTool<A, T>;
|
|
67
|
+
/** Validates a value against the supported JSON Schema subset; returns issues with paths. */
|
|
68
|
+
export declare function validateJsonSchema(schema: JsonSchema, value: unknown, path?: string): string[];
|
|
69
|
+
/** Registry of agent tools that executes calls and always returns structured {@link AgentResult}s. */
|
|
70
|
+
export declare class ToolRegistry {
|
|
71
|
+
private readonly tools;
|
|
72
|
+
register(...tools: Array<AgentTool<never, unknown> | AgentTool<any, any>>): this;
|
|
73
|
+
get(name: string): AgentTool<never, unknown> | undefined;
|
|
74
|
+
list(): ToolInfo[];
|
|
75
|
+
/** Calls a tool. Never throws for tool failures — errors are returned in the result. */
|
|
76
|
+
call(name: string, args: unknown, ctx?: ToolContext): Promise<AgentResult>;
|
|
77
|
+
}
|
|
78
|
+
/** A resource the MCP server exposes to clients (read-only data with a URI). */
|
|
79
|
+
export interface McpResource {
|
|
80
|
+
uri: string;
|
|
81
|
+
name: string;
|
|
82
|
+
description?: string;
|
|
83
|
+
/** MIME type of the resource content, e.g. "text/markdown". */
|
|
84
|
+
mimeType?: string;
|
|
85
|
+
}
|
|
86
|
+
/** Content of a resource as returned by `resources/read`. */
|
|
87
|
+
export interface ResourceContent {
|
|
88
|
+
uri: string;
|
|
89
|
+
mimeType: string;
|
|
90
|
+
/** Base64-encoded bytes when `binary`, raw text otherwise. */
|
|
91
|
+
text?: string;
|
|
92
|
+
/** Set when the content is binary (base64-encoded in `text`). */
|
|
93
|
+
binary?: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** A prompt template the MCP server exposes to clients. */
|
|
96
|
+
export interface McpPrompt {
|
|
97
|
+
name: string;
|
|
98
|
+
description?: string;
|
|
99
|
+
/** Argument names the prompt accepts, in order. */
|
|
100
|
+
arguments?: Array<{
|
|
101
|
+
name: string;
|
|
102
|
+
description?: string;
|
|
103
|
+
required?: boolean;
|
|
104
|
+
}>;
|
|
105
|
+
}
|
|
106
|
+
/** A rendered prompt message returned by `prompts/get`. */
|
|
107
|
+
export interface PromptMessage {
|
|
108
|
+
role: 'user' | 'assistant';
|
|
109
|
+
content: {
|
|
110
|
+
type: 'text';
|
|
111
|
+
text: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Registry of MCP resources. Resources are read-only data exposed to MCP
|
|
116
|
+
* clients by URI. The server resolves a URI to its content on demand.
|
|
117
|
+
*/
|
|
118
|
+
export declare class ResourceRegistry {
|
|
119
|
+
private readonly resources;
|
|
120
|
+
register(resource: McpResource, read: () => ResourceContent | Promise<ResourceContent>): this;
|
|
121
|
+
get(uri: string): McpResource | undefined;
|
|
122
|
+
list(): McpResource[];
|
|
123
|
+
read(uri: string): Promise<ResourceContent | null>;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Registry of MCP prompt templates. Prompts are reusable message templates
|
|
127
|
+
* that clients can invoke by name with arguments.
|
|
128
|
+
*/
|
|
129
|
+
export declare class PromptRegistry {
|
|
130
|
+
private readonly prompts;
|
|
131
|
+
register(prompt: McpPrompt, render: (args: Record<string, string>) => PromptMessage[] | Promise<PromptMessage[]>): this;
|
|
132
|
+
get(name: string): McpPrompt | undefined;
|
|
133
|
+
list(): McpPrompt[];
|
|
134
|
+
getPrompt(name: string, args?: Record<string, string>): Promise<PromptMessage[] | null>;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|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G,IAAI,CAAC;CAKlG"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { ValidationError, serializeError } from '@dream_engine/core';
|
|
2
|
+
export function defineTool(tool) {
|
|
3
|
+
return tool;
|
|
4
|
+
}
|
|
5
|
+
/** Validates a value against the supported JSON Schema subset; returns issues with paths. */
|
|
6
|
+
export function validateJsonSchema(schema, value, path = '') {
|
|
7
|
+
const issues = [];
|
|
8
|
+
const at = path || '(root)';
|
|
9
|
+
if (schema.oneOf) {
|
|
10
|
+
const ok = schema.oneOf.some((s) => validateJsonSchema(s, value, path).length === 0);
|
|
11
|
+
if (!ok)
|
|
12
|
+
issues.push(`${at}: does not match any allowed shape`);
|
|
13
|
+
return issues;
|
|
14
|
+
}
|
|
15
|
+
if (schema.enum && !schema.enum.includes(value)) {
|
|
16
|
+
issues.push(`${at}: must be one of ${schema.enum.map((e) => JSON.stringify(e)).join(', ')}`);
|
|
17
|
+
return issues;
|
|
18
|
+
}
|
|
19
|
+
switch (schema.type) {
|
|
20
|
+
case 'object': {
|
|
21
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
22
|
+
return [`${at}: must be an object`];
|
|
23
|
+
const obj = value;
|
|
24
|
+
for (const r of schema.required ?? [])
|
|
25
|
+
if (obj[r] === undefined)
|
|
26
|
+
issues.push(`${path ? `${path}.` : ''}${r}: is required`);
|
|
27
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
28
|
+
const sub = schema.properties?.[k];
|
|
29
|
+
if (!sub) {
|
|
30
|
+
if (schema.additionalProperties === false)
|
|
31
|
+
issues.push(`${path ? `${path}.` : ''}${k}: unknown property`);
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (v !== undefined)
|
|
35
|
+
issues.push(...validateJsonSchema(sub, v, path ? `${path}.${k}` : k));
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 'string':
|
|
40
|
+
if (typeof value !== 'string')
|
|
41
|
+
return [`${at}: must be a string`];
|
|
42
|
+
if (schema.minLength !== undefined && value.length < schema.minLength)
|
|
43
|
+
issues.push(`${at}: must be at least ${schema.minLength} characters`);
|
|
44
|
+
if (schema.pattern !== undefined && !new RegExp(schema.pattern, 'u').test(value))
|
|
45
|
+
issues.push(`${at}: must match ${schema.pattern}`);
|
|
46
|
+
if (schema.maxLength !== undefined && value.length > schema.maxLength)
|
|
47
|
+
issues.push(`${at}: must be at most ${schema.maxLength} characters`);
|
|
48
|
+
break;
|
|
49
|
+
case 'number':
|
|
50
|
+
case 'integer':
|
|
51
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || (schema.type === 'integer' && !Number.isInteger(value)))
|
|
52
|
+
return [`${at}: must be ${schema.type === 'integer' ? 'an integer' : 'a number'}`];
|
|
53
|
+
if (schema.minimum !== undefined && value < schema.minimum)
|
|
54
|
+
issues.push(`${at}: must be >= ${schema.minimum}`);
|
|
55
|
+
if (schema.maximum !== undefined && value > schema.maximum)
|
|
56
|
+
issues.push(`${at}: must be <= ${schema.maximum}`);
|
|
57
|
+
break;
|
|
58
|
+
case 'boolean':
|
|
59
|
+
if (typeof value !== 'boolean')
|
|
60
|
+
return [`${at}: must be a boolean`];
|
|
61
|
+
break;
|
|
62
|
+
case 'array':
|
|
63
|
+
if (!Array.isArray(value))
|
|
64
|
+
return [`${at}: must be an array`];
|
|
65
|
+
if (schema.minItems !== undefined && value.length < schema.minItems)
|
|
66
|
+
issues.push(`${at}: at least ${schema.minItems} items`);
|
|
67
|
+
if (schema.maxItems !== undefined && value.length > schema.maxItems)
|
|
68
|
+
issues.push(`${at}: at most ${schema.maxItems} items`);
|
|
69
|
+
if (schema.items)
|
|
70
|
+
value.forEach((v, i) => issues.push(...validateJsonSchema(schema.items, v, `${path}[${i}]`)));
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
return issues;
|
|
76
|
+
}
|
|
77
|
+
/** Registry of agent tools that executes calls and always returns structured {@link AgentResult}s. */
|
|
78
|
+
export class ToolRegistry {
|
|
79
|
+
tools = new Map();
|
|
80
|
+
// `any` is required here: tool argument types are contravariant, so typed tools are not assignable to AgentTool<unknown>.
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
+
register(...tools) {
|
|
83
|
+
for (const t of tools) {
|
|
84
|
+
if (!/^[a-zA-Z0-9_-]{1,64}$/.test(t.name))
|
|
85
|
+
throw new ValidationError(`Invalid tool name: ${t.name}`);
|
|
86
|
+
if (this.tools.has(t.name))
|
|
87
|
+
throw new ValidationError(`Tool already registered: ${t.name}`);
|
|
88
|
+
this.tools.set(t.name, t);
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
get(name) {
|
|
93
|
+
return this.tools.get(name);
|
|
94
|
+
}
|
|
95
|
+
list() {
|
|
96
|
+
return [...this.tools.values()].map((t) => ({
|
|
97
|
+
name: t.name,
|
|
98
|
+
description: t.description,
|
|
99
|
+
inputSchema: t.inputSchema,
|
|
100
|
+
...(t.annotations ? { annotations: t.annotations } : {}),
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
/** Calls a tool. Never throws for tool failures — errors are returned in the result. */
|
|
104
|
+
async call(name, args, ctx = {}) {
|
|
105
|
+
const started = Date.now();
|
|
106
|
+
const tool = this.tools.get(name);
|
|
107
|
+
if (!tool)
|
|
108
|
+
return { ok: false, tool: name, data: null, error: serializeError(new ValidationError(`Unknown tool: ${name}`)), meta: { durationMs: 0 } };
|
|
109
|
+
const input = args ?? {};
|
|
110
|
+
const issues = validateJsonSchema(tool.inputSchema, input);
|
|
111
|
+
if (issues.length)
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
tool: name,
|
|
115
|
+
data: null,
|
|
116
|
+
error: serializeError(new ValidationError(`Invalid arguments: ${issues.join('; ')}`, { details: { issues } })),
|
|
117
|
+
meta: { durationMs: Date.now() - started },
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
const out = await tool.handler(input, ctx);
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
tool: name,
|
|
124
|
+
data: out.data,
|
|
125
|
+
error: null,
|
|
126
|
+
meta: { ...(out.meta ?? {}), durationMs: Date.now() - started },
|
|
127
|
+
...(out.attachments ? { attachments: out.attachments } : {}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
return { ok: false, tool: name, data: null, error: serializeError(error), meta: { durationMs: Date.now() - started } };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Registry of MCP resources. Resources are read-only data exposed to MCP
|
|
137
|
+
* clients by URI. The server resolves a URI to its content on demand.
|
|
138
|
+
*/
|
|
139
|
+
export class ResourceRegistry {
|
|
140
|
+
resources = new Map();
|
|
141
|
+
register(resource, read) {
|
|
142
|
+
if (!/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/[^\s]+$/.test(resource.uri))
|
|
143
|
+
throw new ValidationError(`Invalid resource URI: ${resource.uri}`);
|
|
144
|
+
if (this.resources.has(resource.uri))
|
|
145
|
+
throw new ValidationError(`Resource already registered: ${resource.uri}`);
|
|
146
|
+
this.resources.set(resource.uri, { resource, read });
|
|
147
|
+
return this;
|
|
148
|
+
}
|
|
149
|
+
get(uri) {
|
|
150
|
+
return this.resources.get(uri)?.resource;
|
|
151
|
+
}
|
|
152
|
+
list() {
|
|
153
|
+
return [...this.resources.values()].map((r) => r.resource);
|
|
154
|
+
}
|
|
155
|
+
async read(uri) {
|
|
156
|
+
const entry = this.resources.get(uri);
|
|
157
|
+
if (!entry)
|
|
158
|
+
return null;
|
|
159
|
+
return entry.read();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Registry of MCP prompt templates. Prompts are reusable message templates
|
|
164
|
+
* that clients can invoke by name with arguments.
|
|
165
|
+
*/
|
|
166
|
+
export class PromptRegistry {
|
|
167
|
+
prompts = new Map();
|
|
168
|
+
register(prompt, render) {
|
|
169
|
+
if (!/^[a-zA-Z0-9_-]{1,64}$/.test(prompt.name))
|
|
170
|
+
throw new ValidationError(`Invalid prompt name: ${prompt.name}`);
|
|
171
|
+
if (this.prompts.has(prompt.name))
|
|
172
|
+
throw new ValidationError(`Prompt already registered: ${prompt.name}`);
|
|
173
|
+
this.prompts.set(prompt.name, { prompt, render });
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
176
|
+
get(name) {
|
|
177
|
+
return this.prompts.get(name)?.prompt;
|
|
178
|
+
}
|
|
179
|
+
list() {
|
|
180
|
+
return [...this.prompts.values()].map((p) => p.prompt);
|
|
181
|
+
}
|
|
182
|
+
async getPrompt(name, args = {}) {
|
|
183
|
+
const entry = this.prompts.get(name);
|
|
184
|
+
if (!entry)
|
|
185
|
+
return null;
|
|
186
|
+
return entry.render(args);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAwB,MAAM,oBAAoB,CAAC;AA0D3F,MAAM,UAAU,UAAU,CAA2C,IAAqB;IACxF,OAAO,IAAI,CAAC;AACd,CAAC;AAED,6FAA6F;AAC7F,MAAM,UAAU,kBAAkB,CAAC,MAAkB,EAAE,KAAc,EAAE,IAAI,GAAG,EAAE;IAC9E,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,EAAE,GAAG,IAAI,IAAI,QAAQ,CAAC;IAC5B,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,CAAC,EAAE,KAAK,EA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QACF,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,IAAY,EAAE,OAA+B,EAAE;QAC7D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,OAAO,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dream_engine/agent",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Agent tool interface, MCP server and optional local AI model adapters for BashirWeb.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/CodingWithBashir/BashirWeb.git",
|
|
10
|
+
"directory": "packages/agent"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22.16.0 <23 || >=24"
|
|
14
|
+
},
|
|
15
|
+
"main": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./package.json": "./package.json"
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist",
|
|
26
|
+
"README.md"
|
|
27
|
+
],
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@dream_engine/core": "0.1.1",
|
|
31
|
+
"@dream_engine/security": "0.1.1",
|
|
32
|
+
"@dream_engine/storage": "0.1.1"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"build": "tsc -b"
|
|
36
|
+
}
|
|
6
37
|
}
|
package/README.md
DELETED