c0de-agent 1.9.0 → 1.10.0
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 +21 -7
- package/dist/cli/commands/acp.js +2 -0
- package/dist/cli/commands/chat.js +2 -0
- package/dist/cli/commands/config.js +8 -4
- package/dist/cli/commands/serve.d.ts +1 -0
- package/dist/cli/commands/serve.js +4 -1
- package/dist/cli/deps.d.ts +7 -5
- package/dist/cli/deps.js +23 -7
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +68 -37
- package/dist/cli/modes/print.d.ts +3 -1
- package/dist/cli/modes/print.js +21 -4
- package/dist/core/agent.js +3 -4
- package/dist/core/config.d.ts +18 -1
- package/dist/core/config.js +55 -7
- package/dist/core/loop.js +1 -1
- package/dist/core/workflows/discovery.d.ts +1 -1
- package/dist/core/workflows/index.d.ts +1 -1
- package/dist/db/schema.d.ts +17 -0
- package/dist/db/schema.js +3 -1
- package/dist/server/agent-manager.d.ts +15 -0
- package/dist/server/agent-manager.js +35 -11
- package/dist/server/app.js +2 -1
- package/dist/server/context.js +2 -0
- package/dist/server/middleware/cors.d.ts +11 -2
- package/dist/server/middleware/cors.js +15 -12
- package/dist/server/routes/chat.js +211 -150
- package/dist/server/routes/config.js +7 -3
- package/dist/server/routes/session.js +6 -2
- package/dist/server/routes/terminal.js +12 -0
- package/dist/server/routes/update.d.ts +1 -0
- package/dist/server/routes/update.js +11 -4
- package/dist/server/routes/workflows.js +2 -2
- package/dist/server/server.d.ts +24 -1
- package/dist/server/server.js +107 -26
- package/dist/server/types.d.ts +9 -1
- package/dist/session/branch.d.ts +10 -2
- package/dist/session/branch.js +98 -29
- package/dist/session/compaction.js +1 -0
- package/dist/session/context.d.ts +3 -2
- package/dist/session/context.js +36 -3
- package/dist/session/snapshot.d.ts +9 -3
- package/dist/session/snapshot.js +45 -4
- package/dist/session/squash.js +1 -0
- package/dist/session/types.d.ts +2 -0
- package/dist/shared/types/config.d.ts +7 -6
- package/dist/shared/utils/path.d.ts +2 -3
- package/dist/shared/utils/path.js +20 -4
- package/dist/tools/builtin/todo.js +5 -4
- package/dist/tools/index.d.ts +14 -3
- package/dist/tools/index.js +36 -14
- package/dist/update/index.d.ts +1 -1
- package/dist/update/index.js +1 -1
- package/dist/update/ipc.d.ts +32 -5
- package/dist/update/ipc.js +53 -7
- package/dist/update/updater.d.ts +7 -3
- package/dist/update/updater.js +14 -6
- package/dist/update/version.d.ts +6 -1
- package/dist/update/version.js +18 -3
- package/drizzle/0005_snapshot_mtime.sql +1 -0
- package/drizzle/meta/0005_snapshot.json +855 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -7
- package/dist/mcp/index.d.ts +0 -1
- package/dist/mcp/index.js +0 -3
package/dist/update/version.js
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
2
|
const DEFAULT_PACKAGE = 'c0de-agent';
|
|
3
3
|
const DEFAULT_VERSION = '0.1.0';
|
|
4
4
|
const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
5
|
+
/**
|
|
6
|
+
* 读取当前安装版本(package.json 的 version 字段)。
|
|
7
|
+
* src/dev 与 dist 两种布局下 `../../package.json` 都指向包根;读取失败回退常量。
|
|
8
|
+
*/
|
|
9
|
+
function getCurrentVersion() {
|
|
10
|
+
try {
|
|
11
|
+
const pkg = JSON.parse(readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'));
|
|
12
|
+
if (typeof pkg.version === 'string' && pkg.version.length > 0)
|
|
13
|
+
return pkg.version;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
// 打包布局异常:回退保守常量
|
|
17
|
+
}
|
|
18
|
+
return DEFAULT_VERSION;
|
|
19
|
+
}
|
|
5
20
|
/** 取 semver 的数值核心(去前导 v 与 prerelease)。 */
|
|
6
21
|
function semverCore(v) {
|
|
7
22
|
return (v.replace(/^v/, '').split('-')[0] ?? '').split('.').map(Number);
|
|
@@ -23,7 +38,7 @@ function compareSemver(a, b) {
|
|
|
23
38
|
/** 查询 npm registry 判断是否有新版本。网络/解析失败时返回 hasUpdate:false,绝不抛错。 */
|
|
24
39
|
async function checkForUpdate(opts = {}) {
|
|
25
40
|
const pkg = opts.packageName ?? DEFAULT_PACKAGE;
|
|
26
|
-
const current = opts.currentVersion ??
|
|
41
|
+
const current = opts.currentVersion ?? getCurrentVersion();
|
|
27
42
|
const registry = opts.registryUrl ?? DEFAULT_REGISTRY;
|
|
28
43
|
const fetchImpl = opts.fetchImpl ?? fetch;
|
|
29
44
|
const result = {
|
|
@@ -46,4 +61,4 @@ async function checkForUpdate(opts = {}) {
|
|
|
46
61
|
}
|
|
47
62
|
return result;
|
|
48
63
|
}
|
|
49
|
-
export { checkForUpdate, compareSemver };
|
|
64
|
+
export { checkForUpdate, compareSemver, getCurrentVersion };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "file_snapshots" ADD COLUMN "mtime_ms" bigint;
|