@ia-ccun/code-agent-cli 0.0.58-beta.1 → 0.0.58-beta.2

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.
@@ -1,351 +0,0 @@
1
- /**
2
- * Random Pet Widget Extension
3
- *
4
- * Displays a random animal sprite below the input editor.
5
- * Each session randomly selects from 18 different animals.
6
- * Inspired by claude-petpet's sprite system.
7
- */
8
-
9
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
10
-
11
- // 帽子定义(参考 claude-petpet)
12
- const HATS: Record<string, string> = {
13
- none: "",
14
- crown: " \\^^^/ ",
15
- tophat: " [___] ",
16
- propeller: " -+- ",
17
- halo: " ( ) ",
18
- wizard: " /^\\ ",
19
- beanie: " (___) ",
20
- tinyduck: " ,> ",
21
- };
22
-
23
- // 18 种动物精灵定义(参考 claude-petpet)
24
- interface PetDefinition {
25
- name: string;
26
- emoji: string;
27
- frames: string[][];
28
- speed: number;
29
- }
30
-
31
- const PETS: Record<string, PetDefinition> = {
32
- cat: {
33
- name: "小猫",
34
- emoji: "🐱",
35
- frames: [
36
- [" /\\_/\\ ", " ( o o) ", " ( ω ) ", ' (")_(") '],
37
- [" /\\_/\\ ", " ( ^ ^) ", " ( ω ) ", ' (")_(") '],
38
- [" /\\_/\\ ", " ( - -) ", " ( ω ) ", ' (")_(") '],
39
- ],
40
- speed: 500,
41
- },
42
- rabbit: {
43
- name: "兔子",
44
- emoji: "🐰",
45
- frames: [
46
- [" (\\__/) ", " ( o o ) ", " =( .. )= ", ' (")_(") '],
47
- [" (\\__/) ", " ( ^ ^ ) ", " =( .. )= ", ' (")_(") '],
48
- [" (\\__/) ", " ( - - ) ", " =( .. )= ", ' (")_(") '],
49
- ],
50
- speed: 400,
51
- },
52
- dragon: {
53
- name: "龙",
54
- emoji: "🐉",
55
- frames: [
56
- [" /^\\ /^\\ ", " < o o > ", " ( ~~ ) ", " `-vvvv-´ "],
57
- [" /^\\ /^\\ ", " < ^ ^ > ", " ( ~~ ) ", " `-vvvv-´ "],
58
- [" /^\\ /^\\ ", " < - - > ", " ( ~~ ) ", " `-vvvv-´ "],
59
- ],
60
- speed: 600,
61
- },
62
- owl: {
63
- name: "猫头鹰",
64
- emoji: "🦉",
65
- frames: [
66
- [" /\\ /\\ ", " ((o)(o)) ", " ( >< ) ", " `----´ "],
67
- [" /\\ /\\ ", " ((^)(^)) ", " ( >< ) ", " `----´ "],
68
- [" /\\ /\\ ", " ((-)(-)) ", " ( >< ) ", " `----´ "],
69
- ],
70
- speed: 700,
71
- },
72
- penguin: {
73
- name: "企鹅",
74
- emoji: "🐧",
75
- frames: [
76
- [" .---. ", " (o> o) ", " /( )\\ ", " `---´ "],
77
- [" .---. ", " (^> ^) ", " /( )\\ ", " `---´ "],
78
- [" .---. ", " (-> -) ", " /( )\\ ", " `---´ "],
79
- ],
80
- speed: 500,
81
- },
82
- duck: {
83
- name: "鸭子",
84
- emoji: "🦆",
85
- frames: [
86
- [" __ ", " <(o )___ ", " ( ._> ", " `--´ "],
87
- [" __ ", " <(^ )___ ", " ( ._> ", " `--´ "],
88
- [" __ ", " <(- )___ ", " ( ._> ", " `--´ "],
89
- ],
90
- speed: 450,
91
- },
92
- goose: {
93
- name: "鹅",
94
- emoji: "🦢",
95
- frames: [
96
- [" (o> ", " || ", " _(__)_ ", " ^^^^ "],
97
- [" (^> ", " || ", " _(__)_ ", " ^^^^ "],
98
- [" (- > ", " || ", " _(__)_ ", " ^^^^ "],
99
- ],
100
- speed: 500,
101
- },
102
- turtle: {
103
- name: "乌龟",
104
- emoji: "🐢",
105
- frames: [
106
- [" _,--._ ", " ( o o ) ", " /[______]\\ ", " `` `` "],
107
- [" _,--._ ", " ( ^ ^ ) ", " /[______]\\ ", " `` `` "],
108
- [" _,--._ ", " ( - - ) ", " /[______]\\ ", " `` `` "],
109
- ],
110
- speed: 800,
111
- },
112
- snail: {
113
- name: "蜗牛",
114
- emoji: "🐌",
115
- frames: [
116
- [" · .--. ", " \\ ( @ ) ", " \\_`--´ ", " ~~~~~~~ "],
117
- [" ✦ .--. ", " \\ ( @ ) ", " \\_`--´ ", " ~~~~~~~ "],
118
- [" ◉ .--. ", " \\ ( @ ) ", " \\_`--´ ", " ~~~~~~~ "],
119
- ],
120
- speed: 900,
121
- },
122
- capybara: {
123
- name: "水豚",
124
- emoji: "🦫",
125
- frames: [
126
- [" n______n ", " ( o o ) ", " ( oo ) ", " `------´ "],
127
- [" n______n ", " ( ^ ^ ) ", " ( oo ) ", " `------´ "],
128
- [" n______n ", " ( - - ) ", " ( oo ) ", " `------´ "],
129
- ],
130
- speed: 600,
131
- },
132
- ghost: {
133
- name: "幽灵",
134
- emoji: "👻",
135
- frames: [
136
- [" .----. ", " / o o \\ ", " | | ", " ~`~``~`~ "],
137
- [" .----. ", " / ^ ^ \\ ", " | | ", " ~`~``~`~ "],
138
- [" .----. ", " / - - \\ ", " | | ", " ~`~``~`~ "],
139
- ],
140
- speed: 500,
141
- },
142
- robot: {
143
- name: "机器人",
144
- emoji: "🤖",
145
- frames: [
146
- [" .[||]. ", " [ o o ] ", " [ ==== ] ", " `------´ "],
147
- [" .[||]. ", " [ ^ ^ ] ", " [ ==== ] ", " `------´ "],
148
- [" .[||]. ", " [ - - ] ", " [ ==== ] ", " `------´ "],
149
- ],
150
- speed: 400,
151
- },
152
- axolotl: {
153
- name: "蝾螈",
154
- emoji: "🦎",
155
- frames: [
156
- ["}~(______)~{", "}~(o .. o)~{", " ( .--. ) ", " (_/ \\_) "],
157
- ["}~(______)~{", "}~(^ .. ^)~{", " ( .--. ) ", " (_/ \\_) "],
158
- ["}~(______)~{", "}~(- .. -)~{", " ( .--. ) ", " (_/ \\_) "],
159
- ],
160
- speed: 600,
161
- },
162
- mushroom: {
163
- name: "蘑菇",
164
- emoji: "🍄",
165
- frames: [
166
- [" .-o-OO-o-. ", "(__________)", " |o o| ", " |____| "],
167
- [" .-o-OO-o-. ", "(__________)", " |^ ^| ", " |____| "],
168
- [" .-o-OO-o-. ", "(__________)", " |- -| ", " |____| "],
169
- ],
170
- speed: 700,
171
- },
172
- blob: {
173
- name: "团子",
174
- emoji: "🫠",
175
- frames: [
176
- [" .----. ", " ( o o ) ", " ( ) ", " `----´ "],
177
- [" .----. ", " ( ^ ^ ) ", " ( ) ", " `----´ "],
178
- [" .----. ", " ( - - ) ", " ( ) ", " `----´ "],
179
- ],
180
- speed: 500,
181
- },
182
- octopus: {
183
- name: "章鱼",
184
- emoji: "🐙",
185
- frames: [
186
- [" .----. ", " ( o o ) ", " (______) ", " /\\/\\/\\/\\ "],
187
- [" .----. ", " ( ^ ^ ) ", " (______) ", " \\/\\/\\/\\/ "],
188
- [" .----. ", " ( - - ) ", " (______) ", " /\\/\\/\\/\\ "],
189
- ],
190
- speed: 400,
191
- },
192
- chonk: {
193
- name: "胖熊",
194
- emoji: "🐻",
195
- frames: [
196
- [" /\\ /\\ ", " ( o o ) ", " ( .. ) ", " `------´ "],
197
- [" /\\ /\\ ", " ( ^ ^ ) ", " ( .. ) ", " `------´ "],
198
- [" /\\ /\\ ", " ( - - ) ", " ( .. ) ", " `------´ "],
199
- ],
200
- speed: 600,
201
- },
202
- cactus: {
203
- name: "仙人掌",
204
- emoji: "🌵",
205
- frames: [
206
- [" n ____ n ", " | |o o| | ", " |_| |_| ", " | | "],
207
- [" n ____ n ", " | |^ ^| | ", " |_| |_| ", " | | "],
208
- [" n ____ n ", " | |- -| | ", " |_| |_| ", " | | "],
209
- ],
210
- speed: 700,
211
- },
212
- };
213
-
214
- // 随机选择动物
215
- const petKeys = Object.keys(PETS);
216
- let currentPet: string;
217
- let currentFrame = 0;
218
- let intervalId: ReturnType<typeof setInterval> | null = null;
219
- let isShiny = false;
220
- let currentHat = "none";
221
-
222
- function getRandomPet(): string {
223
- return petKeys[Math.floor(Math.random() * petKeys.length)]!;
224
- }
225
-
226
- function getRandomHat(): string {
227
- const hatChance = Math.random();
228
- if (hatChance < 0.05) return "crown";
229
- if (hatChance < 0.1) return "wizard";
230
- if (hatChance < 0.15) return "tophat";
231
- if (hatChance < 0.2) return "halo";
232
- if (hatChance < 0.25) return "beanie";
233
- if (hatChance < 0.3) return "tinyduck";
234
- if (hatChance < 0.35) return "propeller";
235
- return "none";
236
- }
237
-
238
- function getHatNames(): Record<string, string> {
239
- return {
240
- crown: "皇冠",
241
- wizard: "魔法帽",
242
- tophat: "礼帽",
243
- halo: "光环",
244
- beanie: "无檐帽",
245
- tinyduck: "小鸭帽",
246
- propeller: "螺旋桨帽",
247
- none: "",
248
- };
249
- }
250
-
251
- function getNextFrame(): string[] {
252
- const pet = PETS[currentPet]!;
253
- const frames = pet.frames;
254
- currentFrame = (currentFrame + 1) % frames.length;
255
- const frame = [...frames[currentFrame]!];
256
-
257
- // 添加帽子(如果有)
258
- if (currentHat !== "none" && frame.length > 0 && frame[0] && !frame[0].trim()) {
259
- frame[0] = HATS[currentHat] ?? frame[0]!;
260
- }
261
-
262
- // 闪亮特效
263
- if (isShiny) {
264
- return frame.map((line) => `\x1b[38;2;255;215;0m${line}\x1b[0m`);
265
- }
266
-
267
- return frame;
268
- }
269
- function startPetAnimation(ctx: any) {
270
- const pet = PETS[currentPet]!;
271
-
272
- // 显示初始精灵
273
- const initialSprite = getNextFrame();
274
- ctx.ui.setWidget("random-pet", initialSprite, { placement: "belowEditor" });
275
-
276
- // 启动动画
277
- let animationCtx = ctx;
278
- if (intervalId) {
279
- clearInterval(intervalId);
280
- }
281
- intervalId = setInterval(() => {
282
- try {
283
- const nextSprite = getNextFrame();
284
- animationCtx.ui.setWidget("random-pet", nextSprite, { placement: "belowEditor" });
285
- } catch (e) {
286
- if (intervalId) {
287
- clearInterval(intervalId);
288
- intervalId = null;
289
- }
290
- }
291
- }, pet.speed);
292
- }
293
-
294
- export default function (pi: ExtensionAPI) {
295
- // 注册 /pet 命令
296
- pi.registerCommand("pet", {
297
- description: "切换随机宠物",
298
- handler: async (_args, ctx) => {
299
- // 清理旧动画
300
- if (intervalId) {
301
- clearInterval(intervalId);
302
- intervalId = null;
303
- }
304
-
305
- // 随机选择新宠物
306
- const oldPet = PETS[currentPet]!;
307
- currentPet = getRandomPet();
308
- isShiny = Math.random() < 0.1;
309
- currentHat = getRandomHat();
310
- currentFrame = 0;
311
-
312
- const pet = PETS[currentPet]!;
313
-
314
- // 启动新动画
315
- startPetAnimation(ctx);
316
-
317
- // 显示切换提示
318
- const hatNames = getHatNames();
319
- let msg = `${oldPet.emoji}${oldPet.name} → ${pet.emoji}${pet.name}`;
320
- if (isShiny) msg += " ✨(闪亮)";
321
- if (currentHat !== "none") msg += ` + ${hatNames[currentHat]}`;
322
- ctx.ui.notify(msg, "info");
323
- },
324
- });
325
-
326
- pi.on("session_start", (_event, ctx) => {
327
- // 随机选择动物
328
- currentPet = getRandomPet();
329
- isShiny = Math.random() < 0.1;
330
- currentHat = getRandomHat();
331
- currentFrame = 0;
332
-
333
- // 启动动画
334
- startPetAnimation(ctx);
335
-
336
- // 显示提示
337
- const pet = PETS[currentPet]!;
338
- const hatNames = getHatNames();
339
- let msg = `${pet.emoji} 本次宠物:${pet.name}`;
340
- if (isShiny) msg += " ✨(闪亮)";
341
- if (currentHat !== "none") msg += ` + ${hatNames[currentHat]}`;
342
- ctx.ui.notify(msg, "info");
343
- });
344
-
345
- pi.on("session_shutdown", () => {
346
- if (intervalId) {
347
- clearInterval(intervalId);
348
- intervalId = null;
349
- }
350
- });
351
- }
@@ -1,29 +0,0 @@
1
- {
2
- "providers": {
3
- "aicode": {
4
- "name": "aicode llm",
5
- "baseUrl": "https://ai-llm.cc.com/v1",
6
- "api": "openai-completions",
7
- "apiKey": "你自己的APIKEY sk-xxxxxxxxxxxxxxxxxx",
8
- "headers": {
9
- "User-Agent": "${VERSION}"
10
- },
11
- "models": [
12
- {
13
- "id": "qwen3.6-35b-a3b",
14
- "name": "qwen3.6",
15
- "contextWindow": 128000,
16
- "maxTokens": 100000,
17
- "reasoning": false,
18
- "input": ["text"],
19
- "cost": {
20
- "input": 5,
21
- "output": 5,
22
- "cacheRead": 0,
23
- "cacheWrite": 0
24
- }
25
- }
26
- ]
27
- }
28
- }
29
- }