@lark-codem/codem-cli 0.1.281-dev.100104602537.0.gd02b8a3 → 0.1.281-dev.100104624968.0.g09ca961
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/auth/index.js +32 -7
- package/package.json +8 -8
- package/profile/runtime-logs.js +1 -0
package/auth/index.js
CHANGED
|
@@ -1304,6 +1304,7 @@ var init_runtime_logs = __esm(() => {
|
|
|
1304
1304
|
"device_id",
|
|
1305
1305
|
"operation",
|
|
1306
1306
|
"foreground_error_code",
|
|
1307
|
+
"syscall",
|
|
1307
1308
|
"operation_id",
|
|
1308
1309
|
"entrypoint",
|
|
1309
1310
|
"workflow_launch_id",
|
|
@@ -2912,7 +2913,7 @@ var package_default;
|
|
|
2912
2913
|
var init_package = __esm(() => {
|
|
2913
2914
|
package_default = {
|
|
2914
2915
|
name: "@lark-codem/codem-cli",
|
|
2915
|
-
version: "0.1.281-dev.
|
|
2916
|
+
version: "0.1.281-dev.100104624968.0.g09ca961",
|
|
2916
2917
|
codemServiceManagementProtocol: 3,
|
|
2917
2918
|
private: true,
|
|
2918
2919
|
type: "module",
|
|
@@ -2953,7 +2954,7 @@ var init_package = __esm(() => {
|
|
|
2953
2954
|
dependencies: {
|
|
2954
2955
|
"@byted-meego/codem-interaction-protocol": "0.1.43",
|
|
2955
2956
|
"@byted-meego/codem-shared": "0.1.65",
|
|
2956
|
-
"@byted-meego/sync": "1.2.0-meego-ai.
|
|
2957
|
+
"@byted-meego/sync": "1.2.0-meego-ai.10",
|
|
2957
2958
|
"@lark-codem/codem-core": "latest",
|
|
2958
2959
|
"@lark-codem/lark-cli": "0.1.6-test.20261129.1",
|
|
2959
2960
|
"@opentelemetry/api": "^1.9.0",
|
|
@@ -2972,7 +2973,7 @@ var init_package = __esm(() => {
|
|
|
2972
2973
|
},
|
|
2973
2974
|
devDependencies: {
|
|
2974
2975
|
"@babel/parser": "7.29.7",
|
|
2975
|
-
"@byted/frontier-web-sdk": "1.
|
|
2976
|
+
"@byted/frontier-web-sdk": "1.29.0",
|
|
2976
2977
|
"@types/node": "^26.1.1",
|
|
2977
2978
|
"@types/ws": "^8.18.2",
|
|
2978
2979
|
"node-gyp": "11.5.0",
|
|
@@ -4091,7 +4092,7 @@ var init_config_store = __esm(() => {
|
|
|
4091
4092
|
]);
|
|
4092
4093
|
});
|
|
4093
4094
|
|
|
4094
|
-
// ../../../../private/var/folders/_s/49z7f68d2gs0fspglqt5021w0000h1/T/codem-auth-sdk-build-
|
|
4095
|
+
// ../../../../private/var/folders/_s/49z7f68d2gs0fspglqt5021w0000h1/T/codem-auth-sdk-build-0fpa7A/node_modules/lossless-json/lib/umd/lossless-json.js
|
|
4095
4096
|
var require_lossless_json = __commonJS((exports, module) => {
|
|
4096
4097
|
(function(t, e) {
|
|
4097
4098
|
typeof exports == "object" && typeof module != "undefined" ? e(exports) : typeof define == "function" && define.amd ? define(["exports"], e) : e((t = typeof globalThis != "undefined" ? globalThis : t || self).LosslessJSON = {});
|
|
@@ -4646,6 +4647,7 @@ class OAuthReloginRequiredError extends Error {
|
|
|
4646
4647
|
}
|
|
4647
4648
|
class OAuthTokenManager {
|
|
4648
4649
|
#refreshPromise = null;
|
|
4650
|
+
#unpersisted = null;
|
|
4649
4651
|
constructor({
|
|
4650
4652
|
configStore,
|
|
4651
4653
|
serverApi,
|
|
@@ -4732,7 +4734,21 @@ class OAuthTokenManager {
|
|
|
4732
4734
|
}
|
|
4733
4735
|
}
|
|
4734
4736
|
const recovering = recovery === "retry_required";
|
|
4735
|
-
|
|
4737
|
+
let previous = recovering ? await this.configStore.resumeOAuthRotation() : await this.configStore.getOAuthTokenSnapshot();
|
|
4738
|
+
if (this.#unpersisted) {
|
|
4739
|
+
if (!previous?.refreshToken || previous.refreshToken !== this.#unpersisted.replacedRefreshToken) {
|
|
4740
|
+
this.#unpersisted = null;
|
|
4741
|
+
} else {
|
|
4742
|
+
const cachedToken = this.#unpersisted.token;
|
|
4743
|
+
try {
|
|
4744
|
+
const saved = await this.configStore.updateAuthOAuth(cachedToken);
|
|
4745
|
+
this.#unpersisted = null;
|
|
4746
|
+
previous = saved?.auth?.oauth ?? cachedToken;
|
|
4747
|
+
} catch {
|
|
4748
|
+
previous = cachedToken;
|
|
4749
|
+
}
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4736
4752
|
if (!previous?.refreshToken) {
|
|
4737
4753
|
debugLog("oauth.refresh.skip", {
|
|
4738
4754
|
reason: "missing_refresh_token",
|
|
@@ -4841,6 +4857,7 @@ class OAuthTokenManager {
|
|
|
4841
4857
|
persisted: false
|
|
4842
4858
|
}, { env: this.env, logger: this.logger });
|
|
4843
4859
|
(this.logger?.warn ?? console.warn)?.(`[oauth] 刷新到的新 token 落盘失败(${error?.message ?? "unknown error"}):` + (journaled ? "重启后可从 legacy journal 恢复。" : "恢复持久化前请勿重启,重启后可能需要重新登录。") + "请检查磁盘空间与 ~/.codem 的写权限。");
|
|
4860
|
+
this.#unpersisted = { replacedRefreshToken: previous.refreshToken, token: refreshedOAuth };
|
|
4844
4861
|
return {
|
|
4845
4862
|
refreshed: true,
|
|
4846
4863
|
status: "refreshed_unpersisted",
|
|
@@ -4848,6 +4865,7 @@ class OAuthTokenManager {
|
|
|
4848
4865
|
persistError: error
|
|
4849
4866
|
};
|
|
4850
4867
|
}
|
|
4868
|
+
this.#unpersisted = null;
|
|
4851
4869
|
debugLog("oauth.refresh.persisted", {
|
|
4852
4870
|
tokenChanged: previous.userAccessToken !== config.auth.oauth?.userAccessToken,
|
|
4853
4871
|
refreshTokenChanged: previous.refreshToken !== config.auth.oauth?.refreshToken,
|
|
@@ -4907,6 +4925,7 @@ class OAuthTokenManager {
|
|
|
4907
4925
|
}
|
|
4908
4926
|
async#reloginResult(failureCode, { throwOnRelogin, clear }) {
|
|
4909
4927
|
if (clear) {
|
|
4928
|
+
this.#unpersisted = null;
|
|
4910
4929
|
await this.configStore.clearAuthOAuth();
|
|
4911
4930
|
}
|
|
4912
4931
|
if (throwOnRelogin) {
|
|
@@ -5280,7 +5299,10 @@ class ServerApi {
|
|
|
5280
5299
|
headers
|
|
5281
5300
|
});
|
|
5282
5301
|
if (result?.BaseResp !== undefined && result.BaseResp?.StatusCode !== 0) {
|
|
5283
|
-
throw new Error("Realtime connection authorization rejected")
|
|
5302
|
+
throw Object.assign(new Error("Realtime connection authorization rejected"), {
|
|
5303
|
+
code: result.BaseResp?.StatusCode,
|
|
5304
|
+
businessCode: result.BaseResp?.StatusCode
|
|
5305
|
+
});
|
|
5284
5306
|
}
|
|
5285
5307
|
return result;
|
|
5286
5308
|
}
|
|
@@ -5299,7 +5321,10 @@ class ServerApi {
|
|
|
5299
5321
|
headers: { Authorization: `Bearer ${resourceToken}` }
|
|
5300
5322
|
});
|
|
5301
5323
|
if (result?.BaseResp !== undefined && result.BaseResp?.StatusCode !== 0) {
|
|
5302
|
-
throw new Error("Personal sandbox connection authorization rejected")
|
|
5324
|
+
throw Object.assign(new Error("Personal sandbox connection authorization rejected"), {
|
|
5325
|
+
code: result.BaseResp?.StatusCode,
|
|
5326
|
+
businessCode: result.BaseResp?.StatusCode
|
|
5327
|
+
});
|
|
5303
5328
|
}
|
|
5304
5329
|
return result;
|
|
5305
5330
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lark-codem/codem-cli",
|
|
3
|
-
"version": "0.1.281-dev.
|
|
3
|
+
"version": "0.1.281-dev.100104624968.0.g09ca961",
|
|
4
4
|
"codemServiceManagementProtocol": 3,
|
|
5
5
|
"codemSharedRuntime": 2,
|
|
6
6
|
"codemProfileProtocol": 1,
|
|
@@ -32,17 +32,17 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@lark-codem/codem-core": "0.8.98-dev.
|
|
35
|
+
"@lark-codem/codem-core": "0.8.98-dev.100104624968.0.g4e292f0",
|
|
36
36
|
"zod": "3.25.76",
|
|
37
37
|
"@lark-codem/lark-cli": "0.1.6-test.20261129.1"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@lark-codem/codem-cli-darwin-arm64": "0.1.281-dev.
|
|
41
|
-
"@lark-codem/codem-cli-darwin-x64": "0.1.281-dev.
|
|
42
|
-
"@lark-codem/codem-cli-linux-arm64": "0.1.281-dev.
|
|
43
|
-
"@lark-codem/codem-cli-linux-x64": "0.1.281-dev.
|
|
44
|
-
"@lark-codem/codem-cli-win32-arm64": "0.1.281-dev.
|
|
45
|
-
"@lark-codem/codem-cli-win32-x64": "0.1.281-dev.
|
|
40
|
+
"@lark-codem/codem-cli-darwin-arm64": "0.1.281-dev.100104624968.0.g09ca961",
|
|
41
|
+
"@lark-codem/codem-cli-darwin-x64": "0.1.281-dev.100104624968.0.g09ca961",
|
|
42
|
+
"@lark-codem/codem-cli-linux-arm64": "0.1.281-dev.100104624968.0.g09ca961",
|
|
43
|
+
"@lark-codem/codem-cli-linux-x64": "0.1.281-dev.100104624968.0.g09ca961",
|
|
44
|
+
"@lark-codem/codem-cli-win32-arm64": "0.1.281-dev.100104624968.0.g09ca961",
|
|
45
|
+
"@lark-codem/codem-cli-win32-x64": "0.1.281-dev.100104624968.0.g09ca961"
|
|
46
46
|
},
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18"
|
package/profile/runtime-logs.js
CHANGED
|
@@ -99,6 +99,7 @@ const STRING_FIELDS = new Set([
|
|
|
99
99
|
"terminal_event", "event_type", "actor_type", "source", "trigger", "hook_id", "hook_event",
|
|
100
100
|
"target_version", "cli_version", "core_version", "version", "previous_state", "state",
|
|
101
101
|
"failure_kind", "failure_impact", "failure_type", "failure_subtype", "failure_code", "failure_status", "delay_source", "mode", "provider", "name", "termination", "interaction_id", "interaction_kind", "owner_state", "artifact_id", "resource_type", "delivery_mode", "host", "scheme", "tool_call_id", "tool_name", "background_task_id", "model", "artifact_kind", "codem_user_id", "device_id", "operation", "foreground_error_code",
|
|
102
|
+
"syscall",
|
|
102
103
|
"operation_id", "entrypoint", "workflow_launch_id", "runtime_client_instance_id", "connection_instance_id", "lease_epoch",
|
|
103
104
|
"load_id", "refresh_id", "registry_snapshot_id", "capability_key", "capability_type",
|
|
104
105
|
"component_type", "publisher_type", "capability_source", "installation_mode",
|