0xkobold 0.0.1 → 0.0.3

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 CHANGED
@@ -64,15 +64,15 @@ npx 0xkobold start
64
64
 
65
65
  ```bash
66
66
  # Clone and install
67
- git clone https://github.com/yourusername/0xkobold.git
67
+ git clone https://github.com/moikapy/0xkobold.git
68
68
  cd 0xkobold
69
69
  bun install
70
70
 
71
71
  # Start Ollama (in another terminal)
72
72
  ollama run kimi-k2.5:cloud
73
73
 
74
- # Start the server
75
- bun run start
74
+ # Start the TUI
75
+ bun run tui
76
76
  ```
77
77
 
78
78
  ## Project Structure
@@ -150,37 +150,101 @@ const result = await agent.spawn('Research this topic');
150
150
 
151
151
  The `spawn_subagent` skill is built-in and lets agents create child agents automatically.
152
152
 
153
+ ## Ollama Cloud đŸŒŠī¸
154
+
155
+ 0xKobold now supports Ollama Cloud for access to larger models without running Ollama locally.
156
+
157
+ ### Setup Cloud Access
158
+
159
+ 1. Get your API key from [ollama.com/settings/keys](https://ollama.com/settings/keys)
160
+
161
+ 2. Login via the TUI:
162
+ ```
163
+ /login
164
+ # Select "Ollama Cloud"
165
+ # Paste your API key
166
+ ```
167
+
168
+ 3. Switch between modes:
169
+ ```
170
+ /ollama-mode cloud # Use cloud exclusively
171
+ /ollama-mode local # Use local Ollama
172
+ /ollama-mode auto # Auto-detect (default)
173
+ ```
174
+
175
+ ### Cloud Models Available
176
+
177
+ - **GPT-OSS 120B** - State-of-the-art open source
178
+ - **Qwen 2.5 72B/32B** - Alibaba's instruction-tuned model
179
+ - **DeepSeek R1 671B** - Reasoning-capable model
180
+ - **Llama 3.2** - Meta's latest open weights
181
+
182
+ ### Quick Commands
183
+
184
+ - `/ollama-mode` - Show current mode and status
185
+ - `/ollama-status` - Check cloud connection
186
+ - `/ollama-local` - Switch to local mode
187
+ - `/ollama-cloud` - Switch to cloud mode
188
+
189
+ Your API key is securely stored in `~/.0xkobold/auth.json` with 0600 permissions.
190
+
153
191
  ## Commands
154
192
 
155
193
  ```bash
156
- bun run start # Start server
157
- bun run tui # Start TUI
158
- bun run cli # CLI commands
194
+ # Global install (recommended)
195
+ npm install -g 0xkobold
196
+
197
+ # Interactive TUI (default)
198
+ 0xkobold
199
+ # or explicitly
200
+ 0xkobold tui
201
+
202
+ # Project mode (per-directory config)
203
+ 0xkobold local
204
+
205
+ # Gateway service
206
+ 0xkobold start # Start daemon
207
+ 0xkobold start -f # Start foreground
208
+ 0xkobold stop # Stop daemon
209
+ 0xkobold status # Check status
210
+ 0xkobold logs # View logs
211
+
212
+ # Using npx (no install)
213
+ npx 0xkobold
214
+ npx 0xkobold tui --local
159
215
  ```
160
216
 
161
217
  ## Configuration
162
218
 
163
- Config is stored in `~/.0xkobold/config.json5`:
219
+ Config is stored in `~/.config/kobold/kobold.json`:
164
220
 
165
- ```json5
221
+ ```json
166
222
  {
167
- agents: {
168
- default: {
169
- model: 'ollama/kimi-k2.5:cloud',
170
- capabilities: ['chat', 'code'],
171
- },
223
+ "meta": {
224
+ "version": "1.0.0"
172
225
  },
173
- gateway: {
174
- enabled: true,
175
- port: 18789,
226
+ "providers": {
227
+ "ollama": {
228
+ "enabled": true,
229
+ "model": "kimi-k2.5:cloud"
230
+ }
176
231
  },
177
- discord: {
178
- enabled: false,
179
- token: '${DISCORD_BOT_TOKEN}',
232
+ "gateway": {
233
+ "enabled": true,
234
+ "port": 18789
180
235
  },
236
+ "discord": {
237
+ "enabled": false,
238
+ "token": "${DISCORD_BOT_TOKEN}"
239
+ }
181
240
  }
182
241
  ```
183
242
 
243
+ Or use **Local Mode** for per-project configs:
244
+ ```bash
245
+ 0xkobold local # Creates/uses ./kobold.json in current directory
246
+ ```
247
+
184
248
  ## Architecture Differences from OpenClaw
185
249
 
186
250
  | Aspect | OpenClaw | 0xKobold |
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "0xkobold",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "Your digital familiar - a personal AI assistant that learns and evolves",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",
@@ -34,9 +34,9 @@
34
34
  "author": "0xKobold Team",
35
35
  "license": "MIT",
36
36
  "dependencies": {
37
- "@mariozechner/pi-agent-core": "0.56.2",
38
- "@mariozechner/pi-coding-agent": "0.56.2",
39
- "@mariozechner/pi-tui": "0.56.2",
37
+ "@mariozechner/pi-agent-core": "0.57.1",
38
+ "@mariozechner/pi-coding-agent": "0.57.1",
39
+ "@mariozechner/pi-tui": "0.57.1",
40
40
  "ajv": "^8.18.0",
41
41
  "blessed": "^0.1.81",
42
42
  "commander": "^11.1.0",
@@ -0,0 +1,449 @@
1
+ /**
2
+ * Extension Scaffold Extension
3
+ *
4
+ * Makes it easier to create new 0xKobold extensions by providing:
5
+ * - Command to scaffold new extensions
6
+ * - Template generators for common patterns
7
+ * - Type helpers and utilities
8
+ *
9
+ * Usage:
10
+ * /ext-scaffold my-extension "A cool extension that does things"
11
+ * Creates: src/extensions/core/my-extension.ts
12
+ */
13
+ import { existsSync, writeFileSync } from "fs";
14
+ import { resolve, dirname, basename } from "path";
15
+ // ═════════════════════════════════════════════════════════════════════════════
16
+ // TEMPLATES
17
+ // ═════════════════════════════════════════════════════════════════════════════
18
+ const EXTENSION_TEMPLATE = (name, description, author) => `/**
19
+ * ${description}
20
+ */
21
+
22
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
23
+
24
+ export default function ${toCamelCase(name)}Extension(pi: ExtensionAPI) {
25
+ // ═════════════════════════════════════════════════════════════════════════
26
+ // CONFIGURATION
27
+ // ═════════════════════════════════════════════════════════════════════════
28
+
29
+ const CONFIG = {
30
+ // Add your configuration here
31
+ };
32
+
33
+ // ═════════════════════════════════════════════════════════════════════════
34
+ // LIFECYCLE HOOKS
35
+ // ═════════════════════════════════════════════════════════════════════════
36
+
37
+ pi.on("session_start", async (event, ctx) => {
38
+ console.log("[${name}] Session started:", event.name);
39
+ });
40
+
41
+ pi.on("session_end", async (event) => {
42
+ console.log("[${name}] Session ended:", event.name);
43
+ });
44
+
45
+ pi.on("turn_start", async () => {
46
+ // Called at the start of each turn
47
+ });
48
+
49
+ pi.on("turn_end", async () => {
50
+ // Called at the end of each turn
51
+ });
52
+
53
+ // ═════════════════════════════════════════════════════════════════════════
54
+ // USER COMMANDS
55
+ // ═════════════════════════════════════════════════════════════════════════
56
+
57
+ pi.registerCommand("${name}", {
58
+ description: "${description}",
59
+ handler: async (args, ctx) => {
60
+ // Command implementation
61
+ ctx.ui?.notify?.("Command executed!", "info");
62
+ },
63
+ });
64
+
65
+ // ═════════════════════════════════════════════════════════════════════════
66
+ // AGENT TOOLS
67
+ // ═════════════════════════════════════════════════════════════════════════
68
+
69
+ pi.registerTool({
70
+ name: "${name.replace(/-/g, "_")}_tool",
71
+ label: "${name}_tool",
72
+ description: "A tool provided by the ${name} extension",
73
+ // @ts-ignore TSchema mismatch
74
+ parameters: {
75
+ type: "object",
76
+ properties: {
77
+ param1: {
78
+ type: "string",
79
+ description: "First parameter description",
80
+ },
81
+ },
82
+ required: ["param1"],
83
+ },
84
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
85
+ const { param1 } = params as { param1: string };
86
+
87
+ try {
88
+ // Tool implementation
89
+ const result = \`Processed: \${param1}\`;
90
+
91
+ return {
92
+ content: [{ type: "text", text: result }],
93
+ details: { success: true, param1 },
94
+ };
95
+ } catch (error) {
96
+ const errorMsg = error instanceof Error ? error.message : String(error);
97
+ return {
98
+ content: [{ type: "text", text: \`Error: \${errorMsg}\` }],
99
+ details: { success: false, error: errorMsg },
100
+ };
101
+ }
102
+ },
103
+ });
104
+
105
+ console.log("[${name}] Extension loaded - ${author}");
106
+ }
107
+ `;
108
+ const TOOL_ONLY_TEMPLATE = (name, description) => `/**
109
+ * ${description}
110
+ */
111
+
112
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
113
+
114
+ export default function ${toCamelCase(name)}Extension(pi: ExtensionAPI) {
115
+ // ═════════════════════════════════════════════════════════════════════════
116
+ // AGENT TOOLS
117
+ // ═════════════════════════════════════════════════════════════════════════
118
+
119
+ pi.registerTool({
120
+ name: "${name.replace(/-/g, "_")}",
121
+ label: "${name}",
122
+ description: "${description}",
123
+ // @ts-ignore TSchema mismatch
124
+ parameters: {
125
+ type: "object",
126
+ properties: {},
127
+ required: [],
128
+ },
129
+ async execute(_toolCallId, _params, _signal, _onUpdate, _ctx) {
130
+ return {
131
+ content: [{ type: "text", text: "Tool executed!" }],
132
+ details: { success: true },
133
+ };
134
+ },
135
+ });
136
+
137
+ console.log("[${name}] Tool extension loaded");
138
+ }
139
+ `;
140
+ const COMMAND_ONLY_TEMPLATE = (name, description) => `/**
141
+ * ${description}
142
+ */
143
+
144
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
145
+
146
+ export default function ${toCamelCase(name)}Extension(pi: ExtensionAPI) {
147
+ // ═════════════════════════════════════════════════════════════════════════
148
+ // USER COMMANDS
149
+ // ═════════════════════════════════════════════════════════════════════════
150
+
151
+ pi.registerCommand("${name}", {
152
+ description: "${description}",
153
+ handler: async (args, ctx) => {
154
+ ctx.ui?.notify?.("Command executed!", "info");
155
+ },
156
+ });
157
+
158
+ console.log("[${name}] Command extension loaded");
159
+ }
160
+ `;
161
+ // ═════════════════════════════════════════════════════════════════════════════
162
+ // UTILITY FUNCTIONS
163
+ // ═════════════════════════════════════════════════════════════════════════════
164
+ function toCamelCase(str) {
165
+ return str
166
+ .replace(/[-_]+(.)?/g, (_, char) => char ? char.toUpperCase() : "")
167
+ .replace(/^./, char => char.toLowerCase());
168
+ }
169
+ function toPascalCase(str) {
170
+ const camel = toCamelCase(str);
171
+ return camel.charAt(0).toUpperCase() + camel.slice(1);
172
+ }
173
+ function sanitizeFilename(name) {
174
+ return name
175
+ .toLowerCase()
176
+ .replace(/[^a-z0-9-]/g, "-")
177
+ .replace(/-+/g, "-")
178
+ .replace(/^-|-$/g, "");
179
+ }
180
+ // ═════════════════════════════════════════════════════════════════════════════
181
+ // EXTENSION LOADER
182
+ // ═════════════════════════════════════════════════════════════════════════════
183
+ export default function extensionScaffoldExtension(pi) {
184
+ // ═════════════════════════════════════════════════════════════════════════
185
+ // COMMANDS
186
+ // ═════════════════════════════════════════════════════════════════════════
187
+ pi.registerCommand("ext-scaffold", {
188
+ description: "Scaffold a new extension (usage: /ext-scaffold [name] [description] --type=full|tool|command)",
189
+ handler: async (args, ctx) => {
190
+ const parsed = parseArgs(args);
191
+ const { name, description, type } = parsed;
192
+ if (!name) {
193
+ ctx.ui?.notify?.("Usage: /ext-scaffold [name] [description] [--type=full|tool|command]\n" +
194
+ "Examples:\n" +
195
+ " /ext-scaffold my-tool \"Does something cool\"\n" +
196
+ " /ext-scaffold my-cmd \"A command\" --type=command", "warning");
197
+ return;
198
+ }
199
+ const safeName = sanitizeFilename(name);
200
+ const safeDesc = description || `Extension: ${safeName}`;
201
+ try {
202
+ // Determine target directory
203
+ // Try relative to current working directory first, then fall back
204
+ const possiblePaths = [
205
+ resolve(process.cwd(), "src", "extensions", "core"),
206
+ resolve(__dirname), // Current directory
207
+ resolve(dirname(__dirname), "core"), // Parent extensions/core
208
+ ];
209
+ let targetDir = possiblePaths.find(p => existsSync(dirname(p)));
210
+ if (!targetDir) {
211
+ targetDir = possiblePaths[1]; // Fallback to current
212
+ }
213
+ const filePath = resolve(targetDir, `${safeName}-extension.ts`);
214
+ if (existsSync(filePath)) {
215
+ ctx.ui?.notify?.(`Extension already exists: ${basename(filePath)}`, "warning");
216
+ return;
217
+ }
218
+ // Generate content based on type
219
+ let content;
220
+ const author = "0xKobold";
221
+ switch (type) {
222
+ case "tool":
223
+ content = TOOL_ONLY_TEMPLATE(safeName, safeDesc);
224
+ break;
225
+ case "command":
226
+ content = COMMAND_ONLY_TEMPLATE(safeName, safeDesc);
227
+ break;
228
+ case "full":
229
+ default:
230
+ content = EXTENSION_TEMPLATE(safeName, safeDesc, author);
231
+ break;
232
+ }
233
+ // Write file
234
+ writeFileSync(filePath, content, "utf-8");
235
+ ctx.ui?.notify?.(`✅ Created extension: ${basename(filePath)}\n` +
236
+ ` Location: ${filePath}\n` +
237
+ ` Type: ${type || "full"}\n\n` +
238
+ ` Next steps:\n` +
239
+ ` 1. Edit the file to implement your extension\n` +
240
+ ` 2. Restart 0xKobold to load it`, "info");
241
+ }
242
+ catch (error) {
243
+ const errorMsg = error instanceof Error ? error.message : String(error);
244
+ ctx.ui?.notify?.(`Error creating extension: ${errorMsg}`, "error");
245
+ }
246
+ },
247
+ });
248
+ pi.registerCommand("ext-list", {
249
+ description: "List all built-in extensions",
250
+ handler: async (_args, ctx) => {
251
+ try {
252
+ const { readdir } = await import("fs/promises");
253
+ const coreDir = resolve(__dirname);
254
+ const files = await readdir(coreDir);
255
+ const extensions = files
256
+ .filter(f => f.endsWith("-extension.ts"))
257
+ .map(f => f.replace("-extension.ts", ""))
258
+ .sort();
259
+ const list = extensions.map((ext, i) => ` ${i + 1}. ${ext}`).join("\n");
260
+ ctx.ui?.notify?.(`đŸ“Ļ Built-in Extensions (${extensions.length}):\n\n${list}`, "info");
261
+ }
262
+ catch (error) {
263
+ ctx.ui?.notify?.("Failed to list extensions", "error");
264
+ }
265
+ },
266
+ });
267
+ pi.registerCommand("ext-help", {
268
+ description: "Show extension development help",
269
+ handler: async (_args, ctx) => {
270
+ ctx.ui?.notify?.("📚 Extension Development Quick Reference:\n\n" +
271
+ "Commands:\n" +
272
+ " /ext-scaffold [name] [desc] [--type] Create new extension\n" +
273
+ " /ext-list List built-in extensions\n" +
274
+ " /ext-help Show this help\n\n" +
275
+ "Extension Types:\n" +
276
+ " --type=full Full extension (commands + tools + hooks) [default]\n" +
277
+ " --type=tool Tool-only extension\n" +
278
+ " --type=command Command-only extension\n\n" +
279
+ "Lifecycle Hooks:\n" +
280
+ " pi.on('session_start', ... ) When session begins\n" +
281
+ " pi.on('session_end', ... ) When session ends\n" +
282
+ " pi.on('turn_start', ... ) When agent turn starts\n" +
283
+ " pi.on('turn_end', ... ) When agent turn ends\n\n" +
284
+ "API:\n" +
285
+ " pi.registerCommand(name, { description, handler })\n" +
286
+ " pi.registerTool({ name, description, parameters, execute })\n" +
287
+ " pi.setSessionName(name), pi.getSessionName()\n" +
288
+ " ctx.ui.notify(message, type)", "info");
289
+ },
290
+ });
291
+ // ═════════════════════════════════════════════════════════════════════════
292
+ // AGENT TOOLS
293
+ // ═════════════════════════════════════════════════════════════════════════
294
+ pi.registerTool({
295
+ name: "create_extension",
296
+ label: "create_extension",
297
+ description: "Create a new extension scaffold. Use this when the user wants to create a new extension or when they say they want to extend functionality in a modular way.",
298
+ // @ts-ignore TSchema mismatch
299
+ parameters: {
300
+ type: "object",
301
+ properties: {
302
+ name: {
303
+ type: "string",
304
+ description: "Extension name (kebab-case, e.g., 'my-tool', 'image-processor')",
305
+ },
306
+ description: {
307
+ type: "string",
308
+ description: "Brief description of what the extension does",
309
+ },
310
+ type: {
311
+ type: "string",
312
+ enum: ["full", "tool", "command"],
313
+ description: "Extension template type",
314
+ default: "full",
315
+ },
316
+ },
317
+ required: ["name", "description"],
318
+ },
319
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
320
+ const { name, description, type = "full" } = params;
321
+ try {
322
+ const safeName = sanitizeFilename(name);
323
+ const coreDir = resolve(__dirname);
324
+ const filePath = resolve(coreDir, `${safeName}-extension.ts`);
325
+ if (existsSync(filePath)) {
326
+ return {
327
+ content: [{
328
+ type: "text",
329
+ text: `âš ī¸ Extension already exists: ${safeName}-extension.ts`
330
+ }],
331
+ details: { success: false, exists: true, path: filePath },
332
+ };
333
+ }
334
+ // Select template
335
+ let content;
336
+ const author = "0xKobold";
337
+ switch (type) {
338
+ case "tool":
339
+ content = TOOL_ONLY_TEMPLATE(safeName, description);
340
+ break;
341
+ case "command":
342
+ content = COMMAND_ONLY_TEMPLATE(safeName, description);
343
+ break;
344
+ default:
345
+ content = EXTENSION_TEMPLATE(safeName, description, author);
346
+ }
347
+ writeFileSync(filePath, content, "utf-8");
348
+ return {
349
+ content: [{
350
+ type: "text",
351
+ text: `✅ Created ${type} extension: ${safeName}-extension.ts\n\n` +
352
+ `The extension has been scaffolded with:\n` +
353
+ (type === "full" ?
354
+ ` - Lifecycle hooks (session_start, session_end, etc.)\n` +
355
+ ` - A command: /${safeName}\n` +
356
+ ` - A tool: ${safeName.replace(/-/g, "_")}_tool\n` :
357
+ type === "tool" ?
358
+ ` - A tool: ${safeName.replace(/-/g, "_")}\n` :
359
+ ` - A command: /${safeName}\n`) +
360
+ `\nFile location: ${filePath}\n\n` +
361
+ `Next steps:\n` +
362
+ `1. Edit the file to implement your logic\n` +
363
+ `2. Restart 0xKobold to load the extension`
364
+ }],
365
+ details: {
366
+ success: true,
367
+ name: safeName,
368
+ type,
369
+ path: filePath
370
+ },
371
+ };
372
+ }
373
+ catch (error) {
374
+ const errorMsg = error instanceof Error ? error.message : String(error);
375
+ return {
376
+ content: [{ type: "text", text: `❌ Error: ${errorMsg}` }],
377
+ details: { success: false, error: errorMsg },
378
+ };
379
+ }
380
+ },
381
+ });
382
+ pi.registerTool({
383
+ name: "list_extensions",
384
+ label: "list_extensions",
385
+ description: "List all available built-in extensions. Use this when the user wants to see what extensions are available.",
386
+ // @ts-ignore TSchema mismatch
387
+ parameters: {
388
+ type: "object",
389
+ properties: {},
390
+ },
391
+ async execute(_toolCallId, _params, _signal, _onUpdate, _ctx) {
392
+ try {
393
+ const { readdir, readFile } = await import("fs/promises");
394
+ const coreDir = resolve(__dirname);
395
+ const files = await readdir(coreDir);
396
+ const extensions = await Promise.all(files
397
+ .filter(f => f.endsWith("-extension.ts"))
398
+ .map(async (f) => {
399
+ const content = await readFile(resolve(coreDir, f), "utf-8");
400
+ const descMatch = content.match(/\\*\\s*([^\\n]+(?:does|provides|handles)[^\\n]*)/i);
401
+ return {
402
+ name: f.replace("-extension.ts", ""),
403
+ filename: f,
404
+ description: descMatch ? descMatch[1].trim() : "No description",
405
+ };
406
+ }));
407
+ const sorted = extensions.sort((a, b) => a.name.localeCompare(b.name));
408
+ const list = sorted.map(e => ` â€ĸ ${e.name}: ${e.description}`).join("\n");
409
+ return {
410
+ content: [{
411
+ type: "text",
412
+ text: `đŸ“Ļ Available Extensions (${sorted.length}):\n\n${list}`
413
+ }],
414
+ details: { success: true, count: sorted.length, extensions: sorted },
415
+ };
416
+ }
417
+ catch (error) {
418
+ const errorMsg = error instanceof Error ? error.message : String(error);
419
+ return {
420
+ content: [{ type: "text", text: `❌ Error: ${errorMsg}` }],
421
+ details: { success: false, error: errorMsg },
422
+ };
423
+ }
424
+ },
425
+ });
426
+ console.log("[ExtensionScaffold] Extension loaded - /ext-scaffold, /ext-list, /ext-help");
427
+ }
428
+ // ═════════════════════════════════════════════════════════════════════════════
429
+ // ARGUMENT PARSER
430
+ // ═════════════════════════════════════════════════════════════════════════════
431
+ function parseArgs(input) {
432
+ const parts = input.trim().split(/\\s+/);
433
+ // Find type flag
434
+ const typeIndex = parts.findIndex(p => p.startsWith("--type="));
435
+ let type = "full";
436
+ if (typeIndex !== -1) {
437
+ const typeValue = parts[typeIndex].replace("--type=", "").toLowerCase();
438
+ if (["full", "tool", "command"].includes(typeValue)) {
439
+ type = typeValue;
440
+ }
441
+ parts.splice(typeIndex, 1);
442
+ }
443
+ // First non-flag is name
444
+ const name = parts[0] || "";
445
+ // Everything else before type flag is description
446
+ const description = parts.slice(1).join(" ") || "";
447
+ return { name, description, type };
448
+ }
449
+ //# sourceMappingURL=extension-scaffold-extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension-scaffold-extension.js","sourceRoot":"","sources":["../../../../src/extensions/core/extension-scaffold-extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,UAAU,EAAa,aAAa,EAAE,MAAM,IAAI,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAElD,gFAAgF;AAChF,Y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