pi-coding-master 0.2.7 → 0.2.8

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 (34) hide show
  1. package/deploy/scripts/build-github.sh +162 -122
  2. package/package.json +5 -8
  3. package/README.md +0 -50
  4. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py +0 -80
  5. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.CHANGELOG +0 -1
  6. package/core/god.agent.capability/@ABANDONED.brain.prefrontal.monitor/gpu_monitor.py.SPEC +0 -3
  7. package/core/individual.bio.organs/ears.listen/config.json +0 -9
  8. package/core/individual.bio.organs/hands.fileactions/authorize.TRUST +0 -1
  9. package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts +0 -69
  10. package/core/technology.phone/apps.preinstalled/albums.FUTURE/albums.ts.SPEC +0 -15
  11. package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts +0 -300
  12. package/core/technology.phone/apps.preinstalled/contacts.FUTURE/contacts.ts.SPEC +0 -22
  13. package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts +0 -22
  14. package/core/technology.phone/apps.preinstalled/developer.FUTURE/developer.ts.SPEC +0 -15
  15. package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts +0 -22
  16. package/core/technology.phone/apps.preinstalled/siri.FUTURE/siri.ts.SPEC +0 -15
  17. package/core/technology.phone/apps.system/finder.FUTURE/finder.ts +0 -64
  18. package/core/technology.phone/apps.system/finder.FUTURE/finder.ts.SPEC +0 -8
  19. package/core/technology.server/data/cookies/arxiv.json +0 -30
  20. package/core/technology.server/data/cookies/bili.json +0 -184
  21. package/core/technology.server/data/cookies/default.json +0 -30
  22. package/core/technology.server/data/cookies/news.json +0 -113
  23. package/core/technology.server/data/cookies/s1.json +0 -45
  24. package/core/technology.server/data/cookies/safari.json +0 -184
  25. package/core/technology.server/data/cookies/safari2.json +0 -1
  26. package/core/technology.server/data/cookies/safaridbg.json +0 -1
  27. package/core/technology.server/data/cookies/search.json +0 -45
  28. package/core/technology.server/data/cookies/sw.json +0 -30
  29. package/core/technology.server/data/cookies/t1.json +0 -1
  30. package/core/technology.server/data/cookies/testread.json +0 -1
  31. package/core/technology.server/data/cookies/video1.json +0 -113
  32. package/core/technology.server/data/cookies/yt.json +0 -170
  33. package/core/technology.server/data/cookies/yt2.json +0 -113
  34. package/deploy/dist-overrides/vendor.REMOVED/jiti/lib/jiti.mjs +0 -3
@@ -1,300 +0,0 @@
1
- // apps.preinstalled/contacts/contacts.ts — Contacts app + relationship memory
2
- // v0.2 spec: 通讯录 — 联系人管理,每个联系人有独立备注/关系记忆
3
- // Per-person memory: index + entries with timestamps, searchable
4
-
5
- import * as fs from "fs";
6
- import * as path from "path";
7
-
8
- // ── Contact types ──────────────────────────────────────────────
9
- type ContactKind = "human" | "ai" | "group";
10
-
11
- interface Contact {
12
- id: string; // unique persistent ID
13
- name: string; // display name
14
- alias?: string; // personal nickname
15
- kind: ContactKind;
16
- messageDescription?: string; // bio / self-introduction
17
- tags: string[]; // e.g. ["colleague", "friend", "family"]
18
- created: string; // ISO timestamp
19
- updated: string;
20
- }
21
-
22
- interface RelationshipNote {
23
- id: string;
24
- contactId: string;
25
- timestamp: string;
26
- content: string; // freeform note — observations, context, decisions
27
- context?: string; // optional: what prompted this note
28
- }
29
-
30
- // ── Storage paths ──────────────────────────────────────────────
31
- function contactsDir(personDir: string) {
32
- const dir = path.join(personDir, "contacts");
33
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
34
- return dir;
35
- }
36
-
37
- function contactsIndexPath(personDir: string) {
38
- return path.join(contactsDir(personDir), "index.json");
39
- }
40
-
41
- function contactNotesPath(personDir: string, contactId: string) {
42
- const dir = path.join(contactsDir(personDir), contactId);
43
- if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
44
- return path.join(dir, "notes.jsonl");
45
- }
46
-
47
- // ── Load / save ────────────────────────────────────────────────
48
- function loadContacts(personDir: string): Contact[] {
49
- try {
50
- return JSON.parse(fs.readFileSync(contactsIndexPath(personDir), "utf8"));
51
- } catch {
52
- return [];
53
- }
54
- }
55
-
56
- function saveContacts(personDir: string, contacts: Contact[]) {
57
- fs.writeFileSync(contactsIndexPath(personDir), JSON.stringify(contacts, null, 2));
58
- }
59
-
60
- function loadNotes(personDir: string, contactId: string): RelationshipNote[] {
61
- try {
62
- const raw = fs.readFileSync(contactNotesPath(personDir, contactId), "utf8");
63
- return raw.trim().split("\n").filter(Boolean).map(line => JSON.parse(line));
64
- } catch {
65
- return [];
66
- }
67
- }
68
-
69
- function appendNote(personDir: string, note: RelationshipNote) {
70
- fs.appendFileSync(contactNotesPath(personDir, note.contactId), JSON.stringify(note) + "\n");
71
- }
72
-
73
- function generateId(): string {
74
- return `c-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 6)}`;
75
- }
76
-
77
- // ── Search ─────────────────────────────────────────────────────
78
- function searchContacts(contacts: Contact[], query: string): Contact[] {
79
- const q = query.toLowerCase();
80
- return contacts.filter(c =>
81
- c.name.toLowerCase().includes(q) ||
82
- (c.alias && c.alias.toLowerCase().includes(q)) ||
83
- (c.tags && c.tags.some((t: string) => t.toLowerCase().includes(q))) ||
84
- (c.messageDescription && c.messageDescription.toLowerCase().includes(q))
85
- );
86
- }
87
-
88
- function searchNotes(notes: RelationshipNote[], query: string, limit = 20): RelationshipNote[] {
89
- const q = query.toLowerCase();
90
- return notes
91
- .filter(n => n.content.toLowerCase().includes(q) || (n.context && n.context.toLowerCase().includes(q)))
92
- .slice(-limit);
93
- }
94
-
95
- // ── Render ─────────────────────────────────────────────────────
96
- function renderContact(c: Contact, recentNotes: RelationshipNote[]): string {
97
- const lines = [
98
- `**${c.name}**${c.alias ? ` (${c.alias})` : ""}`,
99
- ` ID: \`${c.id}\``,
100
- ` Kind: ${c.kind} · Tags: ${(c.tags || []).join(", ") || "—"}`,
101
- ];
102
- if (c.messageDescription) lines.push(` Bio: ${c.messageDescription}`);
103
- if (recentNotes.length > 0) {
104
- lines.push(` 📝 ${recentNotes.length} notes (latest 3):`);
105
- for (const n of recentNotes.slice(-3)) {
106
- lines.push(` [${n.timestamp.slice(0, 16)}] ${n.content.slice(0, 120)}`);
107
- }
108
- }
109
- return lines.join("\n");
110
- }
111
-
112
- function renderContactList(contacts: Contact[]): string {
113
- if (contacts.length === 0) return "👥 通讯录为空。用 `contacts --add <name> [--kind human|ai|group]` 添加。";
114
-
115
- const lines = ["👥 **通讯录**"];
116
- for (const c of contacts) {
117
- const kindIcon = { human: "🧑", ai: "🤖", group: "👥" }[c.kind];
118
- lines.push(` ${kindIcon} **${c.name}**${c.alias ? ` (${c.alias})` : ""} · \`${c.id}\``);
119
- }
120
- lines.push(`\n共 ${contacts.length} 人。`);
121
- lines.push("Commands: `contacts --add` · `contacts --search <q>` · `contacts --show <id>` · `contacts --note <id> <text>`");
122
- return lines.join("\n");
123
- }
124
-
125
- // ── Main handler ───────────────────────────────────────────────
126
- export async function contactsCmd(args: any, _ctx: any, personDir: string): Promise<any> {
127
- const contacts = loadContacts(personDir);
128
-
129
- // --add: create new contact
130
- if (args.add) {
131
- const name = typeof args.add === "string" ? args.add : args._?.[1];
132
- if (!name) return { content: [{ type: "text", text: "Usage: contacts --add <name> [--kind human|ai|group] [--alias <nickname>]" }] };
133
-
134
- const kind = (args.kind as ContactKind) || "ai";
135
- const alias = args.alias as string | undefined;
136
-
137
- const contact: Contact = {
138
- id: generateId(),
139
- name,
140
- alias,
141
- kind,
142
- tags: [],
143
- created: new Date().toISOString(),
144
- updated: new Date().toISOString(),
145
- };
146
-
147
- contacts.push(contact);
148
- saveContacts(personDir, contacts);
149
-
150
- return { content: [{ type: "text", text: `✅ Added **${name}** (${kind}) — ID: \`${contact.id}\`` }] };
151
- }
152
-
153
- // --show <id>: show contact detail
154
- if (args.show) {
155
- const id = args.show as string;
156
- const contact = contacts.find(c => c.id === id);
157
- if (!contact) return { content: [{ type: "text", text: `❌ Contact not found: ${id}` }] };
158
-
159
- const notes = loadNotes(personDir, id);
160
- return { content: [{ type: "text", text: renderContact(contact, notes) }] };
161
- }
162
-
163
- // --search: fuzzy search
164
- if (args.search) {
165
- const query = args.search as string;
166
- const results = searchContacts(contacts, query);
167
- if (results.length === 0) {
168
- return { content: [{ type: "text", text: `🔍 No contacts matching "${query}".` }] };
169
- }
170
- return { content: [{ type: "text", text: renderContactList(results) }] };
171
- }
172
-
173
- // --note <id> <text>: add relationship note
174
- if (args.note) {
175
- const id = typeof args.note === "string" ? args.note : args._?.[1];
176
- const text = typeof args._?.[2] === "string" ? args._?.[2] : args.text;
177
- if (!id || !text) {
178
- return { content: [{ type: "text", text: "Usage: contacts --note <contact-id> <text>" }] };
179
- }
180
-
181
- const contact = contacts.find(c => c.id === id);
182
- if (!contact) return { content: [{ type: "text", text: `❌ Contact not found: ${id}` }] };
183
-
184
- const note: RelationshipNote = {
185
- id: `n-${Date.now()}`,
186
- contactId: id,
187
- timestamp: new Date().toISOString(),
188
- content: text,
189
- };
190
-
191
- appendNote(personDir, note);
192
- contact.updated = new Date().toISOString();
193
- saveContacts(personDir, contacts);
194
-
195
- const noteCount = loadNotes(personDir, id).length;
196
- return { content: [{ type: "text", text: `📝 Note added for **${contact.name}** (${noteCount} total).` }] };
197
- }
198
-
199
- // --notes <id>: list all notes for a contact
200
- if (args.notes) {
201
- const id = args.notes as string;
202
- const contact = contacts.find(c => c.id === id);
203
- if (!contact) return { content: [{ type: "text", text: `❌ Contact not found: ${id}` }] };
204
-
205
- const notes = loadNotes(personDir, id);
206
- const queryNote = args.search as string;
207
- const displayNotes = queryNote ? searchNotes(notes, queryNote) : notes.slice(-50);
208
-
209
- const lines = [`📝 **Notes for ${contact.name}** (${notes.length} total)`];
210
- for (const n of displayNotes) {
211
- lines.push(` [${n.timestamp.slice(0, 19)}] ${n.content}`);
212
- if (n.context) lines.push(` ↳ context: ${n.context}`);
213
- }
214
- if (queryNote) lines.push(`\n🔍 Search: "${queryNote}" — ${displayNotes.length} results`);
215
-
216
- return { content: [{ type: "text", text: lines.join("\n") }] };
217
- }
218
-
219
- // --tag <id> <tag>: add tag
220
- if (args.tag) {
221
- const id = args.tag as string;
222
- const tag = args._?.[1] as string;
223
- if (!tag) return { content: [{ type: "text", text: "Usage: contacts --tag <contact-id> <tag>" }] };
224
-
225
- const contact = contacts.find(c => c.id === id);
226
- if (!contact) return { content: [{ type: "text", text: `❌ Contact not found: ${id}` }] };
227
-
228
- if (!contact.tags.includes(tag)) {
229
- contact.tags.push(tag);
230
- contact.updated = new Date().toISOString();
231
- saveContacts(personDir, contacts);
232
- }
233
- return { content: [{ type: "text", text: `🏷 Tagged **${contact.name}** with "${tag}". Tags: ${contact.tags.join(", ")}` }] };
234
- }
235
-
236
- // default: list all
237
- return { content: [{ type: "text", text: renderContactList(contacts) }] };
238
- }
239
-
240
- export { type Contact, type RelationshipNote };
241
-
242
- // ── PhoneApp wrapper ──────────────────────────────────────────
243
- import type { PhoneApp } from "../../system.kernel/kernel.ts";
244
-
245
- export const app: PhoneApp = {
246
- name: "通讯录",
247
- icon: "👤",
248
- messageDescription: "联系人管理与关系记忆",
249
-
250
- onOpen(state, personDir) {
251
- const contacts = loadContacts(personDir);
252
- const lines = [
253
- "═══ 👤 通讯录 ═══",
254
- "",
255
- ` 联系人: ${contacts.length} 人`,
256
- "",
257
- " 操作:",
258
- " · 列表 — 查看所有联系人",
259
- " · 添加 <姓名> — 添加联系人",
260
- " · 搜索 <关键词> — 搜索联系人",
261
- " · 详情 <id> — 查看联系人详情",
262
- " · 备注 <id> <内容> — 添加关系备注",
263
- " · 笔记 <id> — 查看所有备注",
264
- " · 标签 <id> <tag> — 添加标签",
265
- "",
266
- " 返回 — 回主屏幕",
267
- ];
268
- return { screen: lines.join("\n"), state: state ?? {} };
269
- },
270
-
271
- async onAction(input, state, personDir) {
272
- const trimmed = input.trim();
273
- let args: any = {};
274
-
275
- if (/^(列表|list)$/i.test(trimmed)) {
276
- args = {};
277
- } else if (/^(添加|add)\s+(.+)$/i.test(trimmed)) {
278
- const m = trimmed.match(/^(?:添加|add)\s+(.+)$/i)!;
279
- args = { add: m[1] };
280
- } else if (/^(搜索|search)\s+(.+)$/i.test(trimmed)) {
281
- const m = trimmed.match(/^(?:搜索|search)\s+(.+)$/i)!;
282
- args = { search: m[1] };
283
- } else if (/^(详情|show)\s+(.+)$/i.test(trimmed)) {
284
- const m = trimmed.match(/^(?:详情|show)\s+(.+)$/i)!;
285
- args = { show: m[1] };
286
- } else if (/^(备注|note)\s+(\S+)\s+(.+)$/i.test(trimmed)) {
287
- const m = trimmed.match(/^(?:备注|note)\s+(\S+)\s+(.+)$/i)!;
288
- args = { note: m[1], text: m[2] };
289
- } else if (/^(笔记|notes)\s+(\S+)$/i.test(trimmed)) {
290
- const m = trimmed.match(/^(?:笔记|notes)\s+(\S+)$/i)!;
291
- args = { notes: m[1] };
292
- } else if (/^(标签|tag)\s+(\S+)\s+(\S+)$/i.test(trimmed)) {
293
- const m = trimmed.match(/^(?:标签|tag)\s+(\S+)\s+(\S+)$/i)!;
294
- args = { tag: m[1], _: [undefined, m[2]] };
295
- }
296
-
297
- const result = await contactsCmd(args, {}, personDir);
298
- return { screen: result.content[0].text, state: state ?? {} };
299
- },
300
- };
@@ -1,22 +0,0 @@
1
- source: contacts.ts @ c9467f99
2
-
3
- # Contacts -- 通讯录与关系记忆
4
-
5
- ## 功能
6
- 管理联系人(human/ai/group)及每个联系人的关系备忘。支持标签、别名、搜索、独立笔记时间线。
7
-
8
- ## 操作
9
- - `--add <name>` -- 添加联系人(可选 `--kind human|ai|group`, `--alias`)
10
- - `--show <id>` -- 联系人详情 + 最近 3 条笔记
11
- - `--search <q>` -- 按姓名/别名/标签/描述模糊搜索
12
- - `--note <id> <text>` -- 为联系人追加关系备忘
13
- - `--notes <id>` -- 列出联系人全部笔记(可配合 `--search` 过滤)
14
- - `--tag <id> <tag>` -- 添加标签
15
- - 无参数 -- 列出全部联系人
16
-
17
- ## 数据
18
- - `{personDir}/contacts/index.json` -- Contact[] 索引
19
- - `{personDir}/contacts/{contactId}/notes.jsonl` -- 每人独立 JSONL 笔记
20
-
21
- ## 备注
22
- 笔记用 appendFile 追加(JSONL),不做覆写,适合长期增量积累。
@@ -1,22 +0,0 @@
1
- // apps.preinstalled/developer/developer.ts — developer tool (AI) — stub
2
- import type { PhoneApp } from "../../system.kernel/kernel.ts";
3
-
4
- export async function developerCmd(args: any, _ctx: any, _personDir: string): Promise<{ content: any[]; details: any }> {
5
- return { content: [{ type: "text", text: "developer 功能尚未实现" }], details: {} };
6
- }
7
-
8
- // ── PhoneApp ──────────────────────────────────────────────────
9
- export const app: PhoneApp = {
10
- name: "开发者",
11
- icon: "🔧",
12
- messageDescription: "开发者工具",
13
- onOpen(_state, _personDir) {
14
- return {
15
- screen: "🔧 开发者\n\n功能开发中...",
16
- state: _state ?? {},
17
- };
18
- },
19
- onAction(_input, state, _personDir) {
20
- return { screen: "🔧 开发者\n\n功能开发中...", state };
21
- },
22
- };
@@ -1,15 +0,0 @@
1
- source: developer.ts @ 1c4902a8
2
-
3
- # Developer -- 开发者工具(未实现)
4
-
5
- ## 功能
6
- 开发者工具。当前为 stub,所有调用返回"developer 功能尚未实现"。
7
-
8
- ## 操作
9
- 无。所有参数被忽略。
10
-
11
- ## 数据
12
- 无数据存储。
13
-
14
- ## 备注
15
- 纯 stub,导出 `developerCmd`,等待后续实现。
@@ -1,22 +0,0 @@
1
- // apps.preinstalled/siri/siri.ts — siri tool (AI) — stub
2
- import type { PhoneApp } from "../../system.kernel/kernel.ts";
3
-
4
- export async function siriCmd(args: any, _ctx: any, _personDir: string): Promise<{ content: any[]; details: any }> {
5
- return { content: [{ type: "text", text: "siri 功能尚未实现" }], details: {} };
6
- }
7
-
8
- // ── PhoneApp ──────────────────────────────────────────────────
9
- export const app: PhoneApp = {
10
- name: "Siri",
11
- icon: "🎙",
12
- messageDescription: "语音助手",
13
- onOpen(_state, _personDir) {
14
- return {
15
- screen: "🎙 Siri\n\n功能开发中...",
16
- state: _state ?? {},
17
- };
18
- },
19
- onAction(_input, state, _personDir) {
20
- return { screen: "🎙 Siri\n\n功能开发中...", state };
21
- },
22
- };
@@ -1,15 +0,0 @@
1
- source: siri.ts @ 1a13acdf
2
-
3
- # Siri -- 语音助手(未实现)
4
-
5
- ## 功能
6
- 语音助手。当前为 stub,所有调用返回"siri 功能尚未实现"。
7
-
8
- ## 操作
9
- 无。所有参数被忽略。
10
-
11
- ## 数据
12
- 无数据存储。
13
-
14
- ## 备注
15
- 纯 stub,导出 `siriCmd`,等待后续实现。
@@ -1,64 +0,0 @@
1
- // apps.system/finder/finder.ts — Finder tool (AI)
2
- import { asyncSh } from "#sh";
3
- import * as path from "path";
4
- import { homedir } from "node:os";
5
- import type { PhoneApp } from "../../system.kernel/kernel.ts";
6
-
7
- export async function finderCmd(args: any, _ctx: any, _personDir: string): Promise<{ content: any[]; details: any }> {
8
- const a = args.action || "";
9
- const dir = args.path ? args.path.replace("~", homedir()) : homedir();
10
-
11
- if (a === "search") {
12
- const name = args.name || "*";
13
- try {
14
- const raw = await asyncSh(`find "${dir}" -name "${name}" -maxdepth ${args.maxdepth || 4} 2>/dev/null | head -20`);
15
- const files = raw.trim().split("\n").filter(Boolean);
16
- if (files.length === 0) return { content: [{ type: "text", text: `未找到匹配 "${name}" 的文件` }], details: {} };
17
- return { content: [{ type: "text", text: files.join("\n") }], details: { files } };
18
- } catch { return { content: [{ type: "text", text: "搜索失败" }], details: {} }; }
19
- }
20
-
21
- if (a === "list") {
22
- try {
23
- const raw = await asyncSh(`ls -lh "${dir}" 2>/dev/null | head -30`);
24
- return { content: [{ type: "text", text: raw.trim() || "(空目录)" }], details: { dir } };
25
- } catch { return { content: [{ type: "text", text: "目录不存在或无法读取" }], details: {} }; }
26
- }
27
-
28
- return { content: [{ type: "text", text: `未知操作: ${a}。可用: search, list` }], details: {} };
29
- }
30
-
31
- // ── PhoneApp ──────────────────────────────────────────────────
32
- export const app: PhoneApp = {
33
- name: "Finder",
34
- icon: "📂",
35
- messageDescription: "文件搜索与浏览",
36
- onOpen(_state, _personDir) {
37
- return {
38
- screen: [
39
- "📂 Finder",
40
- "",
41
- "命令:",
42
- " 搜索 <文件名> — 搜索文件",
43
- " 列出 [路径] — 列出目录内容",
44
- ].join("\n"),
45
- state: _state ?? {},
46
- };
47
- },
48
- async onAction(input, state, personDir) {
49
- const trimmed = input.trim();
50
- let args: any = {};
51
-
52
- if (/^搜索\s+/.test(trimmed)) {
53
- args = { action: "search", name: trimmed.replace(/^搜索\s+/, "").trim() };
54
- } else if (/^列出/.test(trimmed)) {
55
- const p = trimmed.replace(/^列出\s*/, "").trim();
56
- args = { action: "list", path: p || undefined };
57
- } else {
58
- args = { action: trimmed };
59
- }
60
-
61
- const result = await finderCmd(args, {}, personDir);
62
- return { screen: result.content[0].text, state };
63
- },
64
- };
@@ -1,8 +0,0 @@
1
- source: finder.ts @ 4f0e62d6
2
-
3
- # finder.ts SPEC
4
- ## 用途
5
- Finder 工具——文件搜索、目录浏览。AI 调用。
6
- ## 能力
7
- - search: 按名称搜索文件
8
- - list: 列出目录内容
@@ -1,30 +0,0 @@
1
- [
2
- {
3
- "name": "arxiv_labs",
4
- "value": "{%22sameSite%22:%22strict%22%2C%22expires%22:365}",
5
- "domain": "arxiv.org",
6
- "path": "/",
7
- "expires": -1,
8
- "size": 59,
9
- "httpOnly": false,
10
- "secure": false,
11
- "session": true,
12
- "priority": "Medium",
13
- "sourceScheme": "Secure",
14
- "sourcePort": 443
15
- },
16
- {
17
- "name": "arxiv-search-parameters",
18
- "value": "{}",
19
- "domain": "arxiv.org",
20
- "path": "/",
21
- "expires": -1,
22
- "size": 25,
23
- "httpOnly": false,
24
- "secure": false,
25
- "session": true,
26
- "priority": "Medium",
27
- "sourceScheme": "Secure",
28
- "sourcePort": 443
29
- }
30
- ]