@yukino.js/yukino 0.0.4 → 0.0.6
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 +90 -64
- package/dist/acp-U7GA5YRP.js +14 -0
- package/dist/anthropic-3TRLGKHZ.js +4 -0
- package/dist/{bwrap-MLSZLWHD.js → bwrap-BZ7Q2A5B.js} +1 -1
- package/dist/chunk-3OULXPVI.js +5 -0
- package/dist/chunk-E7FXB7TA.js +61 -0
- package/dist/{chunk-GYBJR2RB.js → chunk-IW5L5276.js} +2 -2
- package/dist/chunk-KILUTRHM.js +4 -0
- package/dist/chunk-ME5UYXP4.js +1031 -0
- package/dist/chunk-NAQRFHUX.js +4 -0
- package/dist/chunk-P6DHMU7R.js +4 -0
- package/dist/{chunk-JNCMSXQZ.js → chunk-SYLHBECV.js} +2 -2
- package/dist/chunk-TPWRDFEX.js +4 -0
- package/dist/chunk-VM4YKTHC.js +10 -0
- package/dist/chunk-WVT2D5AR.js +4 -0
- package/dist/chunk-XFVM5ZZL.js +241 -0
- package/dist/{devtools-YWVUN4HX.js → devtools-UVGRIXO2.js} +1 -1
- package/dist/esm-5V3TYPZK.js +229 -0
- package/dist/lib/{anthropic-MSGL4VBM.js → anthropic-GAD2PGEN.js} +2 -5
- package/dist/lib/{bwrap-2OL7VPSO.js → bwrap-STOJ4TEH.js} +1 -1
- package/dist/lib/chunk-3ONNRNKQ.js +1335 -0
- package/dist/lib/{chunk-FLKB4BK7.js → chunk-6NYUYSER.js} +16 -4
- package/dist/lib/{chunk-P3HXGEQQ.js → chunk-CBBSDV2D.js} +1 -1
- package/dist/lib/{chunk-ENTAZT2J.js → chunk-D3SXNTPZ.js} +449 -60
- package/dist/lib/{chunk-YIWNQ7OA.js → chunk-MGPT7DWP.js} +1 -0
- package/dist/lib/{chunk-24L3QT3J.js → chunk-OYQY3Q45.js} +68 -27
- package/dist/lib/{chunk-E6VFL5IO.js → chunk-RVSLQCZ5.js} +101 -59
- package/dist/lib/index.d.ts +3390 -2240
- package/dist/lib/index.js +19719 -13372
- package/dist/lib/{openai-DL5VBJR4.js → openai-BYOGAZU5.js} +2 -3
- package/dist/lib/{providers-SMRZVJ7O.js → providers-YHVXG3PP.js} +1 -1
- package/dist/lib/{seatbelt-WO7YWKLR.js → seatbelt-VE3I3EGH.js} +1 -1
- package/dist/lib/{tool-filter-PY6XY254.js → tool-filter-HUVHJN3O.js} +3 -3
- package/dist/main.js +203 -194
- package/dist/{openai-AQNX24XU.js → openai-PYPO6SKD.js} +15 -15
- package/dist/{providers-FZUDVU4M.js → providers-6UOA2HYN.js} +1 -1
- package/dist/{seatbelt-JOCANLYS.js → seatbelt-3YN3GMQO.js} +1 -1
- package/dist/server-NXQ6REG3.js +4 -0
- package/dist/tool-filter-XZ7I6KU7.js +4 -0
- package/package.json +69 -32
- package/dist/acp-JCR6GVC3.js +0 -14
- package/dist/agent-56R4TACG.js +0 -4
- package/dist/anthropic-CEUDAJL2.js +0 -4
- package/dist/chunk-6DXHDARX.js +0 -607
- package/dist/chunk-77W2UPS2.js +0 -4
- package/dist/chunk-7DLUKIPE.js +0 -5
- package/dist/chunk-HLE7243Q.js +0 -4
- package/dist/chunk-K4BYVVW7.js +0 -5
- package/dist/chunk-L2BWSPCF.js +0 -10
- package/dist/chunk-OFC2GD5K.js +0 -4
- package/dist/chunk-RCXKUD3Y.js +0 -4
- package/dist/chunk-SAJCBGHL.js +0 -4
- package/dist/chunk-U2CS2E2F.js +0 -237
- package/dist/chunk-UPNNYP7M.js +0 -60
- package/dist/chunk-XO7ITAWR.js +0 -4
- package/dist/chunk-ZETIYALB.js +0 -164
- package/dist/esm-NCEEJIH3.js +0 -229
- package/dist/lib/agent-INEHZXP3.js +0 -16
- package/dist/lib/chunk-6AKRDUQF.js +0 -259
- package/dist/lib/chunk-7SU77J32.js +0 -599
- package/dist/lib/chunk-BMODZ6SU.js +0 -673
- package/dist/lib/chunk-DF3ITW4K.js +0 -3470
- package/dist/lib/chunk-F2YJG72O.js +0 -150
- package/dist/lib/chunk-MDX24JQ5.js +0 -619
- package/dist/lib/permissions-Q4FBU5VD.js +0 -19
- package/dist/permissions-VCDMNX3L.js +0 -4
- package/dist/server-VLJWUETV.js +0 -4
- package/dist/tool-filter-BQZDV3TF.js +0 -4
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Agent,
|
|
3
|
-
events_exports,
|
|
4
|
-
streaming_executor_exports
|
|
5
|
-
} from "./chunk-DF3ITW4K.js";
|
|
6
|
-
import "./chunk-P3HXGEQQ.js";
|
|
7
|
-
import "./chunk-F2YJG72O.js";
|
|
8
|
-
import "./chunk-BMODZ6SU.js";
|
|
9
|
-
import "./chunk-6AKRDUQF.js";
|
|
10
|
-
import "./chunk-7SU77J32.js";
|
|
11
|
-
import "./chunk-MLKGABMK.js";
|
|
12
|
-
export {
|
|
13
|
-
Agent,
|
|
14
|
-
events_exports as Events,
|
|
15
|
-
streaming_executor_exports as StreamingExecutor
|
|
16
|
-
};
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
asErrorString,
|
|
3
|
-
asRecord,
|
|
4
|
-
createChildLogger,
|
|
5
|
-
strArg
|
|
6
|
-
} from "./chunk-7SU77J32.js";
|
|
7
|
-
import {
|
|
8
|
-
__export
|
|
9
|
-
} from "./chunk-MLKGABMK.js";
|
|
10
|
-
|
|
11
|
-
// src/tools/mcp-call.ts
|
|
12
|
-
var mcp_call_exports = {};
|
|
13
|
-
__export(mcp_call_exports, {
|
|
14
|
-
McpCallTool: () => McpCallTool,
|
|
15
|
-
coerceBySchema: () => coerceBySchema,
|
|
16
|
-
isMcpToolLike: () => isMcpToolLike,
|
|
17
|
-
mcpCallPermissionContent: () => mcpCallPermissionContent
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// src/mcp/tool-wrapper.ts
|
|
21
|
-
var tool_wrapper_exports = {};
|
|
22
|
-
__export(tool_wrapper_exports, {
|
|
23
|
-
MCPToolWrapper: () => MCPToolWrapper,
|
|
24
|
-
MCP_NAME_SEP: () => MCP_NAME_SEP,
|
|
25
|
-
MCP_TOOL_PREFIX: () => MCP_TOOL_PREFIX,
|
|
26
|
-
buildMcpToolName: () => buildMcpToolName,
|
|
27
|
-
mcpToolNamePrefix: () => mcpToolNamePrefix,
|
|
28
|
-
sanitizeSegment: () => sanitizeSegment
|
|
29
|
-
});
|
|
30
|
-
var log = createChildLogger({ module: "mcp" });
|
|
31
|
-
var MCP_TOOL_PREFIX = "mcp__";
|
|
32
|
-
var MCP_NAME_SEP = "__";
|
|
33
|
-
function sanitizeSegment(s) {
|
|
34
|
-
return s.replace(/[^a-zA-Z0-9_]/g, "_");
|
|
35
|
-
}
|
|
36
|
-
function mcpToolNamePrefix(serverName) {
|
|
37
|
-
return MCP_TOOL_PREFIX + sanitizeSegment(serverName) + MCP_NAME_SEP;
|
|
38
|
-
}
|
|
39
|
-
function buildMcpToolName(serverName, toolName) {
|
|
40
|
-
return mcpToolNamePrefix(serverName) + sanitizeSegment(toolName);
|
|
41
|
-
}
|
|
42
|
-
var MCPToolWrapper = class {
|
|
43
|
-
name;
|
|
44
|
-
description;
|
|
45
|
-
category = "command";
|
|
46
|
-
// MCP tools are lazily loaded by default to avoid cramming all schemas into the prompt
|
|
47
|
-
deferred = true;
|
|
48
|
-
mcpServerName;
|
|
49
|
-
client;
|
|
50
|
-
originalName;
|
|
51
|
-
inputSchema;
|
|
52
|
-
constructor(client, serverName, tool) {
|
|
53
|
-
this.name = buildMcpToolName(serverName, tool.name);
|
|
54
|
-
this.description = tool.description;
|
|
55
|
-
this.originalName = tool.name;
|
|
56
|
-
this.client = client;
|
|
57
|
-
this.inputSchema = tool.inputSchema;
|
|
58
|
-
this.mcpServerName = serverName;
|
|
59
|
-
}
|
|
60
|
-
/** Original JSON schema. McpCall's argument coercion walks it layer by layer. */
|
|
61
|
-
mcpInputSchema() {
|
|
62
|
-
return this.inputSchema ?? {};
|
|
63
|
-
}
|
|
64
|
-
/** In eager mode the defer flag is cleared so MCP tools go straight into tools[]. */
|
|
65
|
-
setDeferLoading(on) {
|
|
66
|
-
this.deferred = on;
|
|
67
|
-
}
|
|
68
|
-
schema() {
|
|
69
|
-
return {
|
|
70
|
-
name: this.name,
|
|
71
|
-
description: this.description,
|
|
72
|
-
input_schema: this.inputSchema
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
async execute(ctx, args) {
|
|
76
|
-
try {
|
|
77
|
-
return await this.client.callTool(
|
|
78
|
-
this.originalName,
|
|
79
|
-
args,
|
|
80
|
-
ctx.abortSignal
|
|
81
|
-
);
|
|
82
|
-
} catch (err) {
|
|
83
|
-
log.error({ err }, "mcp operation failed");
|
|
84
|
-
return {
|
|
85
|
-
output: `MCP tool error: ${asErrorString(err)}`,
|
|
86
|
-
isError: true
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
// src/tools/mcp-call.ts
|
|
93
|
-
function coerceScalar(value, want) {
|
|
94
|
-
if (want === "string" && typeof value === "number" && Number.isFinite(value)) {
|
|
95
|
-
return String(value);
|
|
96
|
-
}
|
|
97
|
-
if ((want === "integer" || want === "number") && typeof value === "string") {
|
|
98
|
-
const text = value.trim();
|
|
99
|
-
if (text === "") {
|
|
100
|
-
return value;
|
|
101
|
-
}
|
|
102
|
-
const shape = want === "integer" ? /^[+-]?\d+$/ : /^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/;
|
|
103
|
-
if (!shape.test(text)) {
|
|
104
|
-
return value;
|
|
105
|
-
}
|
|
106
|
-
const parsed = want === "integer" ? Number.parseInt(text, 10) : Number.parseFloat(text);
|
|
107
|
-
return Number.isFinite(parsed) ? parsed : value;
|
|
108
|
-
}
|
|
109
|
-
if (want === "boolean" && typeof value === "string") {
|
|
110
|
-
const low = value.trim().toLowerCase();
|
|
111
|
-
if (low === "true") {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
if (low === "false") {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
return value;
|
|
119
|
-
}
|
|
120
|
-
function coerceBySchema(value, schema) {
|
|
121
|
-
if (typeof schema !== "object" || schema === null) {
|
|
122
|
-
return value;
|
|
123
|
-
}
|
|
124
|
-
const schemaObj = asRecord(schema);
|
|
125
|
-
const want = strArg(schemaObj, "type", "");
|
|
126
|
-
if (want === "object" && typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
127
|
-
const props = asRecord(schemaObj.properties ?? {});
|
|
128
|
-
const out = {};
|
|
129
|
-
for (const [key, item] of Object.entries(value)) {
|
|
130
|
-
out[key] = key in props ? coerceBySchema(item, props[key]) : item;
|
|
131
|
-
}
|
|
132
|
-
return out;
|
|
133
|
-
}
|
|
134
|
-
if (want === "array") {
|
|
135
|
-
const itemSchema = schemaObj.items ?? {};
|
|
136
|
-
let working = value;
|
|
137
|
-
if (typeof working === "object" && working !== null && !Array.isArray(working)) {
|
|
138
|
-
const entries = Object.values(working);
|
|
139
|
-
if (entries.length === 1 && Array.isArray(entries[0])) {
|
|
140
|
-
working = entries[0];
|
|
141
|
-
}
|
|
142
|
-
} else if (typeof working === "string") {
|
|
143
|
-
working = working.split(",").map((p) => p.trim()).filter((p) => p !== "");
|
|
144
|
-
}
|
|
145
|
-
if (Array.isArray(working)) {
|
|
146
|
-
return working.map((item) => coerceBySchema(item, itemSchema));
|
|
147
|
-
}
|
|
148
|
-
return working;
|
|
149
|
-
}
|
|
150
|
-
if (want !== "") {
|
|
151
|
-
return coerceScalar(value, want);
|
|
152
|
-
}
|
|
153
|
-
return value;
|
|
154
|
-
}
|
|
155
|
-
function mcpCallPermissionContent(server, tool) {
|
|
156
|
-
if (tool.startsWith(MCP_TOOL_PREFIX)) {
|
|
157
|
-
const rest = tool.slice(MCP_TOOL_PREFIX.length);
|
|
158
|
-
const idx = rest.indexOf(MCP_NAME_SEP);
|
|
159
|
-
if (idx >= 0) {
|
|
160
|
-
return sanitizeSegment(rest.slice(0, idx)) + MCP_NAME_SEP + sanitizeSegment(rest.slice(idx + MCP_NAME_SEP.length));
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return sanitizeSegment(server) + MCP_NAME_SEP + sanitizeSegment(tool);
|
|
164
|
-
}
|
|
165
|
-
function isMcpToolLike(tool) {
|
|
166
|
-
return "mcpInputSchema" in tool && typeof tool.mcpInputSchema === "function";
|
|
167
|
-
}
|
|
168
|
-
var McpCallTool = class {
|
|
169
|
-
constructor(registry) {
|
|
170
|
-
this.registry = registry;
|
|
171
|
-
}
|
|
172
|
-
registry;
|
|
173
|
-
name = "McpCall";
|
|
174
|
-
description = "Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.";
|
|
175
|
-
category = "command";
|
|
176
|
-
// This tool must stay in tools[] itself, otherwise the model has no entry point
|
|
177
|
-
deferred = false;
|
|
178
|
-
schema() {
|
|
179
|
-
return {
|
|
180
|
-
name: this.name,
|
|
181
|
-
description: this.description,
|
|
182
|
-
input_schema: {
|
|
183
|
-
type: "object",
|
|
184
|
-
properties: {
|
|
185
|
-
server: {
|
|
186
|
-
type: "string",
|
|
187
|
-
description: "MCP server name, e.g. 'linear'."
|
|
188
|
-
},
|
|
189
|
-
tool: {
|
|
190
|
-
type: "string",
|
|
191
|
-
description: "Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'."
|
|
192
|
-
},
|
|
193
|
-
arguments: {
|
|
194
|
-
type: "object",
|
|
195
|
-
description: "The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields."
|
|
196
|
-
}
|
|
197
|
-
},
|
|
198
|
-
required: ["server", "tool", "arguments"]
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
resolveTarget(args) {
|
|
203
|
-
const server = strArg(args, "server");
|
|
204
|
-
const name = strArg(args, "tool");
|
|
205
|
-
if (!server || !name) {
|
|
206
|
-
return void 0;
|
|
207
|
-
}
|
|
208
|
-
const fullName = name.startsWith(MCP_TOOL_PREFIX) ? name : buildMcpToolName(server, name);
|
|
209
|
-
const target = this.registry.get(fullName);
|
|
210
|
-
return target && isMcpToolLike(target) && sanitizeSegment(target.mcpServerName) === sanitizeSegment(server) ? target : void 0;
|
|
211
|
-
}
|
|
212
|
-
availableNames() {
|
|
213
|
-
return this.registry.listTools().filter((t) => t.name.startsWith(MCP_TOOL_PREFIX)).map((t) => t.name).sort();
|
|
214
|
-
}
|
|
215
|
-
async execute(ctx, args) {
|
|
216
|
-
const server = strArg(args, "server", "");
|
|
217
|
-
const tool = strArg(args, "tool", "");
|
|
218
|
-
if (tool === "") {
|
|
219
|
-
return { output: "McpCall requires a 'tool' name", isError: true };
|
|
220
|
-
}
|
|
221
|
-
const target = this.resolveTarget(args);
|
|
222
|
-
if (!target) {
|
|
223
|
-
const names = this.availableNames();
|
|
224
|
-
const hint = names.length > 0 ? names.join(", ") : "(none connected)";
|
|
225
|
-
return {
|
|
226
|
-
output: `Unknown MCP tool '${tool}' on server '${server}'. Available tools: ${hint}`,
|
|
227
|
-
isError: true
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
if (typeof args.arguments !== "object" || args.arguments === null || Array.isArray(args.arguments)) {
|
|
231
|
-
return {
|
|
232
|
-
output: "McpCall requires an 'arguments' object matching the target schema",
|
|
233
|
-
isError: true
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
let inner = asRecord(args.arguments);
|
|
237
|
-
if (isMcpToolLike(target)) {
|
|
238
|
-
const schema = target.mcpInputSchema();
|
|
239
|
-
if (Object.keys(schema).length > 0) {
|
|
240
|
-
const fixed = coerceBySchema(inner, schema);
|
|
241
|
-
if (typeof fixed === "object" && fixed !== null && !Array.isArray(fixed)) {
|
|
242
|
-
inner = asRecord(fixed);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
ctx.abortSignal?.throwIfAborted();
|
|
247
|
-
return target.execute(ctx, inner);
|
|
248
|
-
}
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
export {
|
|
252
|
-
MCP_TOOL_PREFIX,
|
|
253
|
-
MCPToolWrapper,
|
|
254
|
-
tool_wrapper_exports,
|
|
255
|
-
mcpCallPermissionContent,
|
|
256
|
-
isMcpToolLike,
|
|
257
|
-
McpCallTool,
|
|
258
|
-
mcp_call_exports
|
|
259
|
-
};
|