minecodex 1.2.2 → 2.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.
- package/README.md +9 -3
- package/features/images/README.md +16 -98
- package/features/images/codex-feature.json +6 -23
- package/features/images/src/library-prompt-page.mjs +239 -0
- package/features/model-slider/THIRD_PARTY_NOTICES.md +1 -1
- package/features/notes/DESIGN.md +66 -0
- package/features/notes/README.md +18 -99
- package/features/notes/assets/icons/book-open-nav.svg +15 -0
- package/features/notes/assets/icons/book-open.svg +16 -0
- package/features/notes/assets/native-emojis.json +1 -0
- package/features/notes/assets/native-prompt-icons.json +28 -0
- package/features/notes/codex-feature.json +12 -70
- package/features/notes/src/main.mjs +2 -2
- package/features/notes/src/product.mjs +287 -613
- package/features/notes/src/prompt-schema.mjs +117 -0
- package/features/notes/src/quick-prompts-page.mjs +1559 -0
- package/features/notes/src/quick-prompts-server.mjs +167 -0
- package/features/session-status/DESIGN.md +11 -3
- package/features/session-status/README.md +8 -4
- package/features/session-status/src/session-status.mjs +272 -25
- package/features/sidebar-focus/DESIGN.md +16 -0
- package/features/sidebar-focus/codex-feature.json +20 -0
- package/features/sidebar-focus/src/sidebar-focus.mjs +134 -0
- package/features/sidebar-focus/vendor/lucide-LICENSE +43 -0
- package/features/unread-inbox/DESIGN.md +36 -0
- package/features/unread-inbox/codex-feature.json +20 -0
- package/features/unread-inbox/src/unread-inbox.mjs +446 -0
- package/features/usage-meter/DESIGN.md +49 -0
- package/features/usage-meter/README.md +18 -0
- package/features/usage-meter/codex-feature.json +13 -0
- package/features/usage-meter/src/usage-meter.mjs +200 -0
- package/package.json +17 -5
- package/packages/cli/src/config.mjs +4 -1
- package/packages/cli/src/control-server.mjs +2 -2
- package/packages/runtime-host/src/codex-injection.mjs +38 -3
- package/packages/runtime-host/src/codex-runtime.mjs +41 -20
- package/packages/runtime-host/src/feature-registry.mjs +1 -0
- package/packages/runtime-host/src/session-status-reader.mjs +40 -16
- package/features/notes/assets/icons/circle.svg +0 -15
- package/features/notes/assets/icons/ellipsis.svg +0 -17
- package/features/notes/assets/icons/external-link.svg +0 -17
- package/features/notes/assets/icons/list-todo.svg +0 -19
- package/features/notes/assets/icons/message-square-quote.svg +0 -17
- package/features/notes/assets/icons/paperclip.svg +0 -15
- package/features/notes/assets/icons/star-off.svg +0 -17
- package/features/notes/assets/icons/star.svg +0 -15
- package/features/notes/assets/icons/sticky-note.svg +0 -16
- package/features/notes/assets/icons/trash-2.svg +0 -19
- package/features/notes/src/http-server.mjs +0 -580
- package/features/notes/web/app.js +0 -1202
- package/features/notes/web/codex-artifact-document.svg +0 -1
- package/features/notes/web/codex-attachment.svg +0 -1
- package/features/notes/web/codex-build.svg +0 -1
- package/features/notes/web/codex-code.svg +0 -1
- package/features/notes/web/codex-cplusplus.svg +0 -1
- package/features/notes/web/codex-css.svg +0 -1
- package/features/notes/web/codex-document.svg +0 -1
- package/features/notes/web/codex-file.svg +0 -1
- package/features/notes/web/codex-folder.svg +0 -1
- package/features/notes/web/codex-hashes.svg +0 -1
- package/features/notes/web/codex-html.svg +0 -1
- package/features/notes/web/codex-image.svg +0 -1
- package/features/notes/web/codex-java.svg +0 -1
- package/features/notes/web/codex-javascript.svg +0 -1
- package/features/notes/web/codex-json.svg +0 -1
- package/features/notes/web/codex-notebook.svg +0 -1
- package/features/notes/web/codex-pdf.svg +0 -1
- package/features/notes/web/codex-pencil.svg +0 -3
- package/features/notes/web/codex-php.svg +0 -1
- package/features/notes/web/codex-plus.svg +0 -3
- package/features/notes/web/codex-presentation.svg +0 -1
- package/features/notes/web/codex-python.svg +0 -1
- package/features/notes/web/codex-react.svg +0 -1
- package/features/notes/web/codex-rust.svg +0 -1
- package/features/notes/web/codex-shell.svg +0 -1
- package/features/notes/web/codex-skill.svg +0 -1
- package/features/notes/web/codex-spreadsheet.svg +0 -1
- package/features/notes/web/codex-task.svg +0 -3
- package/features/notes/web/codex-terminal.svg +0 -1
- package/features/notes/web/codex-toml.svg +0 -1
- package/features/notes/web/codex-typescript.svg +0 -1
- package/features/notes/web/codex-view-all.svg +0 -3
- package/features/notes/web/file-icons.mjs +0 -68
- package/features/notes/web/i18n.mjs +0 -237
- package/features/notes/web/index.html +0 -15
- package/features/notes/web/styles.css +0 -1155
- package/features/notes/web/todo-drag.mjs +0 -18
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// 迁移只涉及提示词;不读取、清理或删除历史 Todo / Files 数据。
|
|
2
|
+
export function migratePromptSchema(db) {
|
|
3
|
+
db.exec(`
|
|
4
|
+
CREATE TABLE IF NOT EXISTS metadata (
|
|
5
|
+
key TEXT PRIMARY KEY,
|
|
6
|
+
value INTEGER NOT NULL
|
|
7
|
+
) STRICT;
|
|
8
|
+
INSERT OR IGNORE INTO metadata (key, value) VALUES ('revision', 0);
|
|
9
|
+
|
|
10
|
+
`);
|
|
11
|
+
|
|
12
|
+
const hasLegacyNotes = Boolean(
|
|
13
|
+
db
|
|
14
|
+
.prepare(
|
|
15
|
+
`
|
|
16
|
+
SELECT 1 FROM sqlite_schema WHERE type = 'table' AND name = 'notes'
|
|
17
|
+
`,
|
|
18
|
+
)
|
|
19
|
+
.get(),
|
|
20
|
+
);
|
|
21
|
+
const hasPrompts = Boolean(
|
|
22
|
+
db
|
|
23
|
+
.prepare(
|
|
24
|
+
`
|
|
25
|
+
SELECT 1 FROM sqlite_schema WHERE type = 'table' AND name = 'prompts'
|
|
26
|
+
`,
|
|
27
|
+
)
|
|
28
|
+
.get(),
|
|
29
|
+
);
|
|
30
|
+
if (hasLegacyNotes && hasPrompts) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
"Both legacy notes and prompts tables exist; refusing an ambiguous Prompt migration",
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
if (hasLegacyNotes) {
|
|
36
|
+
db.exec("BEGIN IMMEDIATE");
|
|
37
|
+
try {
|
|
38
|
+
db.exec(`
|
|
39
|
+
ALTER TABLE notes RENAME TO prompts;
|
|
40
|
+
ALTER TABLE prompts RENAME COLUMN pinned TO starred;
|
|
41
|
+
DROP INDEX IF EXISTS notes_display_order;
|
|
42
|
+
`);
|
|
43
|
+
db.exec("COMMIT");
|
|
44
|
+
} catch (error) {
|
|
45
|
+
db.exec("ROLLBACK");
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
db.exec(`
|
|
51
|
+
CREATE TABLE IF NOT EXISTS prompts (
|
|
52
|
+
id TEXT PRIMARY KEY,
|
|
53
|
+
title TEXT NOT NULL DEFAULT '',
|
|
54
|
+
body TEXT NOT NULL,
|
|
55
|
+
starred INTEGER NOT NULL DEFAULT 0 CHECK (starred IN (0, 1)),
|
|
56
|
+
created_at INTEGER NOT NULL,
|
|
57
|
+
updated_at INTEGER NOT NULL,
|
|
58
|
+
last_used_at INTEGER NOT NULL
|
|
59
|
+
) STRICT;
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
`);
|
|
63
|
+
db.exec(`
|
|
64
|
+
CREATE TABLE IF NOT EXISTS prompt_categories (
|
|
65
|
+
id TEXT PRIMARY KEY, name TEXT NOT NULL, icon TEXT NOT NULL,
|
|
66
|
+
color TEXT NOT NULL, sort_order INTEGER NOT NULL
|
|
67
|
+
) STRICT;
|
|
68
|
+
`);
|
|
69
|
+
// 只增加字段,旧提示词与历史 Todo / Files 保留;不推断过去的调用次数。
|
|
70
|
+
const columns = new Set(
|
|
71
|
+
db
|
|
72
|
+
.prepare("PRAGMA table_info(prompts)")
|
|
73
|
+
.all()
|
|
74
|
+
.map((row) => row.name),
|
|
75
|
+
);
|
|
76
|
+
for (const [name, type] of Object.entries({
|
|
77
|
+
category_id: "TEXT REFERENCES prompt_categories(id) ON DELETE SET NULL",
|
|
78
|
+
emoji: "TEXT NOT NULL DEFAULT ''",
|
|
79
|
+
sort_order: "INTEGER NOT NULL DEFAULT 0",
|
|
80
|
+
use_count: "INTEGER NOT NULL DEFAULT 0",
|
|
81
|
+
called_at: "INTEGER",
|
|
82
|
+
})) {
|
|
83
|
+
if (!columns.has(name))
|
|
84
|
+
db.exec(`ALTER TABLE prompts ADD COLUMN ${name} ${type}`);
|
|
85
|
+
}
|
|
86
|
+
if (
|
|
87
|
+
!db
|
|
88
|
+
.prepare("SELECT 1 FROM metadata WHERE key = 'prompt_categories_seeded'")
|
|
89
|
+
.get()
|
|
90
|
+
) {
|
|
91
|
+
const defaults = [
|
|
92
|
+
["image", "生图", "palette", "purple"],
|
|
93
|
+
["code", "编程", "terminal", "blue"],
|
|
94
|
+
["writing", "文案", "writing", "orange"],
|
|
95
|
+
["research", "研究", "flask", "green"],
|
|
96
|
+
["translation", "翻译", "globe", "pink"],
|
|
97
|
+
["productivity", "效率", "logs", "black"],
|
|
98
|
+
];
|
|
99
|
+
db.exec("BEGIN IMMEDIATE");
|
|
100
|
+
try {
|
|
101
|
+
defaults.forEach(([id, name, icon, color], index) =>
|
|
102
|
+
db
|
|
103
|
+
.prepare(
|
|
104
|
+
"INSERT OR IGNORE INTO prompt_categories VALUES (?, ?, ?, ?, ?)",
|
|
105
|
+
)
|
|
106
|
+
.run(id, name, icon, color, index),
|
|
107
|
+
);
|
|
108
|
+
db.prepare(
|
|
109
|
+
"INSERT INTO metadata VALUES ('prompt_categories_seeded', 1)",
|
|
110
|
+
).run();
|
|
111
|
+
db.exec("COMMIT");
|
|
112
|
+
} catch (error) {
|
|
113
|
+
db.exec("ROLLBACK");
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|