@yukino.js/yukino 0.0.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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +320 -0
  3. package/dist/acp-IVY5HZR4.js +14 -0
  4. package/dist/agent-QANDY7FO.js +4 -0
  5. package/dist/anthropic-6YLT4JZR.js +4 -0
  6. package/dist/bwrap-MLSZLWHD.js +4 -0
  7. package/dist/chunk-2LHY3FND.js +67 -0
  8. package/dist/chunk-3KKA6537.js +4 -0
  9. package/dist/chunk-3QL446GD.js +4 -0
  10. package/dist/chunk-4GE22WHI.js +4 -0
  11. package/dist/chunk-5VOCXSSX.js +5 -0
  12. package/dist/chunk-77W2UPS2.js +4 -0
  13. package/dist/chunk-7MKA3SHV.js +4 -0
  14. package/dist/chunk-AGSYLE4E.js +16 -0
  15. package/dist/chunk-CU3IISCC.js +4 -0
  16. package/dist/chunk-GYBJR2RB.js +65 -0
  17. package/dist/chunk-HLE7243Q.js +4 -0
  18. package/dist/chunk-HMZQYFYG.js +4 -0
  19. package/dist/chunk-JFKC4VCA.js +4 -0
  20. package/dist/chunk-K4BYVVW7.js +5 -0
  21. package/dist/chunk-KCMBAHWU.js +4 -0
  22. package/dist/chunk-L2BWSPCF.js +10 -0
  23. package/dist/chunk-MDPSQ6L7.js +44 -0
  24. package/dist/chunk-OFC2GD5K.js +4 -0
  25. package/dist/chunk-RAS3ORX3.js +164 -0
  26. package/dist/chunk-RCXKUD3Y.js +4 -0
  27. package/dist/chunk-SAJCBGHL.js +4 -0
  28. package/dist/chunk-SOO5OXX2.js +237 -0
  29. package/dist/chunk-T4O4GQVL.js +607 -0
  30. package/dist/chunk-UPNNYP7M.js +60 -0
  31. package/dist/chunk-VCIRD267.js +4 -0
  32. package/dist/chunk-VU3JWAJR.js +4 -0
  33. package/dist/chunk-VWUGGYUP.js +6 -0
  34. package/dist/chunk-XO7ITAWR.js +4 -0
  35. package/dist/devtools-YWVUN4HX.js +7 -0
  36. package/dist/esm-57CJEGGK.js +4 -0
  37. package/dist/esm-6L5BJ5GT.js +4 -0
  38. package/dist/esm-DIYJ5HX6.js +4 -0
  39. package/dist/esm-HW2JMFYC.js +4 -0
  40. package/dist/esm-RPR2GBJ2.js +4 -0
  41. package/dist/esm-YKAO4ES6.js +4 -0
  42. package/dist/esm-ZTIYTMTS.js +229 -0
  43. package/dist/getMachineId-bsd-E27XJQLX.js +4 -0
  44. package/dist/getMachineId-darwin-35UPAIXP.js +5 -0
  45. package/dist/getMachineId-linux-MKXIYT6A.js +4 -0
  46. package/dist/getMachineId-unsupported-ZXVGGFX2.js +4 -0
  47. package/dist/getMachineId-win-RNVIYJG5.js +4 -0
  48. package/dist/lib/agent-6FZX4P2Y.js +16 -0
  49. package/dist/lib/anthropic-IP23YZ3P.js +21 -0
  50. package/dist/lib/bwrap-2OL7VPSO.js +7 -0
  51. package/dist/lib/chunk-2VF3XTGH.js +3382 -0
  52. package/dist/lib/chunk-5DVQ64YL.js +619 -0
  53. package/dist/lib/chunk-5TGXH7BX.js +624 -0
  54. package/dist/lib/chunk-6OMQD7MK.js +591 -0
  55. package/dist/lib/chunk-AZRC67RW.js +512 -0
  56. package/dist/lib/chunk-F2YJG72O.js +150 -0
  57. package/dist/lib/chunk-FFM2LB4C.js +132 -0
  58. package/dist/lib/chunk-FLKB4BK7.js +50 -0
  59. package/dist/lib/chunk-I34MAQRE.js +255 -0
  60. package/dist/lib/chunk-KA6POJKI.js +889 -0
  61. package/dist/lib/chunk-MLKGABMK.js +9 -0
  62. package/dist/lib/chunk-O7ELJUEK.js +262 -0
  63. package/dist/lib/chunk-QYBQT2DM.js +655 -0
  64. package/dist/lib/chunk-YIWNQ7OA.js +47 -0
  65. package/dist/lib/index.d.ts +8581 -0
  66. package/dist/lib/index.js +15905 -0
  67. package/dist/lib/openai-EMJ6U4FW.js +15 -0
  68. package/dist/lib/permissions-KZ5ACZAX.js +19 -0
  69. package/dist/lib/providers-2CGZPBFI.js +9 -0
  70. package/dist/lib/sandbox-runtime-CCQ3X3SM.js +9 -0
  71. package/dist/lib/seatbelt-WO7YWKLR.js +7 -0
  72. package/dist/lib/tool-filter-CKHZUUBQ.js +21 -0
  73. package/dist/main.js +332 -0
  74. package/dist/node-634LOHDX.js +15 -0
  75. package/dist/openai-YXYO5OW6.js +34 -0
  76. package/dist/permissions-VCDMNX3L.js +4 -0
  77. package/dist/providers-HNMBGGW6.js +4 -0
  78. package/dist/sandbox-runtime-ELKAYRIL.js +4 -0
  79. package/dist/seatbelt-JOCANLYS.js +4 -0
  80. package/dist/server-ZHQILOBP.js +4 -0
  81. package/dist/src-43CPCEK2.js +12 -0
  82. package/dist/src-JBRNH4FA.js +4 -0
  83. package/dist/src-R4BSSIJJ.js +4 -0
  84. package/dist/src-X6JWWHHT.js +4 -0
  85. package/dist/tool-filter-BQZDV3TF.js +4 -0
  86. package/dist/turndown.es-NQ3KDXM7.js +83 -0
  87. package/package.json +146 -0
@@ -0,0 +1,9 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __export = (target, all) => {
3
+ for (var name in all)
4
+ __defProp(target, name, { get: all[name], enumerable: true });
5
+ };
6
+
7
+ export {
8
+ __export
9
+ };
@@ -0,0 +1,262 @@
1
+ import {
2
+ __export
3
+ } from "./chunk-MLKGABMK.js";
4
+
5
+ // src/subagent/tool-filter.ts
6
+ var tool_filter_exports = {};
7
+ __export(tool_filter_exports, {
8
+ ASYNC_AGENT_ALLOWED_TOOLS: () => ASYNC_AGENT_ALLOWED_TOOLS,
9
+ CUSTOM_AGENT_DISALLOWED_TOOLS: () => CUSTOM_AGENT_DISALLOWED_TOOLS,
10
+ FORK_QUERY_SOURCE: () => FORK_QUERY_SOURCE,
11
+ MAIN_AGENT_ONLY_TOOLS: () => MAIN_AGENT_ONLY_TOOLS,
12
+ SUBAGENT_DISALLOWED_TOOLS: () => SUBAGENT_DISALLOWED_TOOLS,
13
+ TEAMMATE_DISALLOWED_TOOLS: () => TEAMMATE_DISALLOWED_TOOLS,
14
+ cloneRegistryForFork: () => cloneRegistryForFork,
15
+ filterToolsForAgent: () => filterToolsForAgent
16
+ });
17
+
18
+ // src/tools/registry.ts
19
+ var registry_exports = {};
20
+ __export(registry_exports, {
21
+ ToolRegistry: () => ToolRegistry
22
+ });
23
+ var ToolRegistry = class {
24
+ tools = /* @__PURE__ */ new Map();
25
+ discovered = /* @__PURE__ */ new Set();
26
+ /**
27
+ * How MCP tools are loaded, written by mcp/strategy after connecting to the
28
+ * server. ToolSearch relies on it to decide what to return, and the client
29
+ * relies on it to decide whether to send defer_loading. It stays eager when
30
+ * there is no MCP, which behaves the same as no deferral.
31
+ */
32
+ mcpLoadingMode = "eager";
33
+ /**
34
+ * Whether to expose the search and dispatch tools to the model is computed once
35
+ * by applyMode in mcp/strategy at session start. It is not recomputed each turn
36
+ * based on "are there still deferred tools": tools may be disabled at runtime,
37
+ * and recomputing would drop one from tools[] mid-session — that's an array
38
+ * change, which breaks the cache prefix just the same.
39
+ */
40
+ exposeToolSearch = false;
41
+ exposeMcpCall = false;
42
+ register(tool) {
43
+ this.tools.set(tool.name, tool);
44
+ }
45
+ /**
46
+ * Removes a tool and forgets its discovery state, so a re-registered tool
47
+ * with the same name starts deferred again. Used by /mcp reload to drop
48
+ * tools of servers that disappeared from the config.
49
+ */
50
+ unregister(name) {
51
+ this.tools.delete(name);
52
+ this.discovered.delete(name);
53
+ }
54
+ get(name) {
55
+ return this.tools.get(name);
56
+ }
57
+ listTools() {
58
+ return [...this.tools.values()];
59
+ }
60
+ getAllSchemas(protocol, filter) {
61
+ const resolvedProtocol = protocol ?? "anthropic";
62
+ const isOpenAI = resolvedProtocol === "openai" || resolvedProtocol === "openai-compat";
63
+ const native = this.mcpLoadingMode === "native" && !isOpenAI;
64
+ const schemas = [];
65
+ for (const tool of this.tools.values()) {
66
+ if (filter && !filter(tool.name)) {
67
+ continue;
68
+ }
69
+ if (tool.name === "ToolSearch" && !this.exposeToolSearch || tool.name === "McpCall" && !this.exposeMcpCall) {
70
+ continue;
71
+ }
72
+ const deferred = Boolean(tool.deferred) && !this.discovered.has(tool.name);
73
+ if (deferred && !native) {
74
+ continue;
75
+ }
76
+ const s = tool.schema();
77
+ if (resolvedProtocol === "openai") {
78
+ schemas.push({
79
+ strict: s.strict ?? false,
80
+ type: "function",
81
+ name: s.name,
82
+ description: s.description,
83
+ parameters: s.input_schema
84
+ });
85
+ } else if (resolvedProtocol === "openai-compat") {
86
+ schemas.push({
87
+ type: "function",
88
+ function: {
89
+ name: s.name,
90
+ description: s.description,
91
+ parameters: s.input_schema,
92
+ strict: s.strict ?? false
93
+ }
94
+ });
95
+ } else {
96
+ schemas.push({ ...s, type: "custom", ...deferred ? { defer_loading: true } : {} });
97
+ }
98
+ }
99
+ return schemas;
100
+ }
101
+ /**
102
+ * Names of deferred tools not yet discovered, in lexicographic order.
103
+ *
104
+ * Sorting is not cosmetic: callers compare this list to detect pool changes;
105
+ * unstable ordering would produce different text for the same set of tools
106
+ * and break the comparison.
107
+ */
108
+ getDeferredToolNames() {
109
+ const names = [];
110
+ for (const tool of this.tools.values()) {
111
+ if (tool.deferred && !this.discovered.has(tool.name)) {
112
+ names.push(tool.name);
113
+ }
114
+ }
115
+ return names.sort();
116
+ }
117
+ getDeferredTools() {
118
+ return [...this.tools.values()].filter((t) => t.deferred && !this.discovered.has(t.name));
119
+ }
120
+ searchDeferred(query, maxResults = 5) {
121
+ const lower = query.toLowerCase();
122
+ const matches = [];
123
+ for (const tool of this.tools.values()) {
124
+ if (!tool.deferred || this.discovered.has(tool.name)) {
125
+ continue;
126
+ }
127
+ if (tool.name.toLowerCase().includes(lower) || tool.description.toLowerCase().includes(lower)) {
128
+ matches.push(tool);
129
+ if (matches.length >= maxResults) {
130
+ break;
131
+ }
132
+ }
133
+ }
134
+ return matches;
135
+ }
136
+ findDeferredByNames(names) {
137
+ const lowerMap = /* @__PURE__ */ new Map();
138
+ for (const [name, tool] of this.tools) {
139
+ lowerMap.set(name.toLowerCase(), tool);
140
+ }
141
+ return names.map((n) => lowerMap.get(n.toLowerCase())).filter((t) => t?.deferred ?? false);
142
+ }
143
+ markDiscovered(name) {
144
+ this.discovered.add(name);
145
+ }
146
+ isDiscovered(name) {
147
+ return this.discovered.has(name);
148
+ }
149
+ };
150
+
151
+ // src/subagent/tool-filter.ts
152
+ var MAIN_AGENT_ONLY_TOOLS = /* @__PURE__ */ new Set([
153
+ "ComputerUse",
154
+ "AskUserQuestion",
155
+ "ExitPlanMode"
156
+ ]);
157
+ var SUBAGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
158
+ ...MAIN_AGENT_ONLY_TOOLS,
159
+ "Agent",
160
+ // Prevents recursive spawning of subagents
161
+ "TaskStop"
162
+ ]);
163
+ var TEAMMATE_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
164
+ "TeamCreate",
165
+ "TeamDelete"
166
+ ]);
167
+ var CUSTOM_AGENT_DISALLOWED_TOOLS = /* @__PURE__ */ new Set([
168
+ "ExitPlanMode",
169
+ "Agent",
170
+ "AskUserQuestion",
171
+ "TaskStop"
172
+ ]);
173
+ var ASYNC_AGENT_ALLOWED_TOOLS = /* @__PURE__ */ new Set([
174
+ "ReadFile",
175
+ // "WebSearch",
176
+ "Grep",
177
+ "Glob",
178
+ "Bash",
179
+ "PowerShell",
180
+ "EditFile",
181
+ "WriteFile",
182
+ "LoadSkill",
183
+ "SyntheticOutput",
184
+ "ToolSearch",
185
+ "EnterWorktree",
186
+ "ExitWorktree",
187
+ // ToolSearch only reads out schemas; actual invocation relies on McpCall.
188
+ // The two must be allowed together, or the subagent sees tools but cannot call them
189
+ "McpCall"
190
+ ]);
191
+ function isMCPTool(name) {
192
+ return name.startsWith("mcp__");
193
+ }
194
+ function filterToolsForAgent(registry, allowedTools, disallowedTools, isAsync, isCustom = false) {
195
+ const disallowed = new Set(disallowedTools ?? []);
196
+ const allowed = new Set(allowedTools ?? []);
197
+ const hasWhitelist = allowed.size > 0 && !(allowed.size === 1 && allowed.has("*"));
198
+ const filtered = new ToolRegistry();
199
+ filtered.mcpLoadingMode = registry.mcpLoadingMode;
200
+ for (const tool of registry.listTools()) {
201
+ const name = tool.name;
202
+ if (isMCPTool(name)) {
203
+ if (!disallowed.has(name) && (!hasWhitelist || allowed.has(name))) {
204
+ filtered.register(tool);
205
+ }
206
+ continue;
207
+ }
208
+ if (SUBAGENT_DISALLOWED_TOOLS.has(name)) {
209
+ continue;
210
+ }
211
+ if (isCustom && CUSTOM_AGENT_DISALLOWED_TOOLS.has(name)) {
212
+ continue;
213
+ }
214
+ if (isAsync && !ASYNC_AGENT_ALLOWED_TOOLS.has(name)) {
215
+ continue;
216
+ }
217
+ if (disallowed.has(name)) {
218
+ continue;
219
+ }
220
+ if (hasWhitelist && !allowed.has(name)) {
221
+ continue;
222
+ }
223
+ filtered.register(tool);
224
+ }
225
+ return filtered;
226
+ }
227
+ var FORK_QUERY_SOURCE = "agent:builtin:fork";
228
+ function cloneRegistryForFork(registry) {
229
+ const forked = new ToolRegistry();
230
+ forked.mcpLoadingMode = registry.mcpLoadingMode;
231
+ for (const tool of registry.listTools()) {
232
+ if (MAIN_AGENT_ONLY_TOOLS.has(tool.name)) {
233
+ continue;
234
+ }
235
+ if (tool.name === "Agent" && "querySource" in tool) {
236
+ const clone = Object.create(
237
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
238
+ Object.getPrototypeOf(tool),
239
+ Object.getOwnPropertyDescriptors(tool)
240
+ );
241
+ clone.querySource = FORK_QUERY_SOURCE;
242
+ forked.register(clone);
243
+ } else {
244
+ forked.register(tool);
245
+ }
246
+ }
247
+ return forked;
248
+ }
249
+
250
+ export {
251
+ ToolRegistry,
252
+ registry_exports,
253
+ MAIN_AGENT_ONLY_TOOLS,
254
+ SUBAGENT_DISALLOWED_TOOLS,
255
+ TEAMMATE_DISALLOWED_TOOLS,
256
+ CUSTOM_AGENT_DISALLOWED_TOOLS,
257
+ ASYNC_AGENT_ALLOWED_TOOLS,
258
+ filterToolsForAgent,
259
+ FORK_QUERY_SOURCE,
260
+ cloneRegistryForFork,
261
+ tool_filter_exports
262
+ };