@itssimplereally/opencode-kimicode-auth 0.1.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/LICENSE +22 -0
- package/README.md +87 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/src/constants.d.ts +69 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +207 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/kimi/oauth.d.ts +64 -0
- package/dist/src/kimi/oauth.d.ts.map +1 -0
- package/dist/src/kimi/oauth.js +130 -0
- package/dist/src/kimi/oauth.js.map +1 -0
- package/dist/src/plugin/accounts.d.ts +167 -0
- package/dist/src/plugin/accounts.d.ts.map +1 -0
- package/dist/src/plugin/accounts.js +843 -0
- package/dist/src/plugin/accounts.js.map +1 -0
- package/dist/src/plugin/auth.d.ts +13 -0
- package/dist/src/plugin/auth.d.ts.map +1 -0
- package/dist/src/plugin/auth.js +26 -0
- package/dist/src/plugin/auth.js.map +1 -0
- package/dist/src/plugin/cache.d.ts +14 -0
- package/dist/src/plugin/cache.d.ts.map +1 -0
- package/dist/src/plugin/cache.js +56 -0
- package/dist/src/plugin/cache.js.map +1 -0
- package/dist/src/plugin/cli.d.ts +21 -0
- package/dist/src/plugin/cli.d.ts.map +1 -0
- package/dist/src/plugin/cli.js +98 -0
- package/dist/src/plugin/cli.js.map +1 -0
- package/dist/src/plugin/config/index.d.ts +16 -0
- package/dist/src/plugin/config/index.d.ts.map +1 -0
- package/dist/src/plugin/config/index.js +16 -0
- package/dist/src/plugin/config/index.js.map +1 -0
- package/dist/src/plugin/config/loader.d.ts +36 -0
- package/dist/src/plugin/config/loader.d.ts.map +1 -0
- package/dist/src/plugin/config/loader.js +182 -0
- package/dist/src/plugin/config/loader.js.map +1 -0
- package/dist/src/plugin/config/models.d.ts +18 -0
- package/dist/src/plugin/config/models.d.ts.map +1 -0
- package/dist/src/plugin/config/models.js +26 -0
- package/dist/src/plugin/config/models.js.map +1 -0
- package/dist/src/plugin/config/schema.d.ts +107 -0
- package/dist/src/plugin/config/schema.d.ts.map +1 -0
- package/dist/src/plugin/config/schema.js +282 -0
- package/dist/src/plugin/config/schema.js.map +1 -0
- package/dist/src/plugin/config/updater.d.ts +55 -0
- package/dist/src/plugin/config/updater.d.ts.map +1 -0
- package/dist/src/plugin/config/updater.js +154 -0
- package/dist/src/plugin/config/updater.js.map +1 -0
- package/dist/src/plugin/debug.d.ts +92 -0
- package/dist/src/plugin/debug.d.ts.map +1 -0
- package/dist/src/plugin/debug.js +406 -0
- package/dist/src/plugin/debug.js.map +1 -0
- package/dist/src/plugin/errors.d.ts +28 -0
- package/dist/src/plugin/errors.d.ts.map +1 -0
- package/dist/src/plugin/errors.js +42 -0
- package/dist/src/plugin/errors.js.map +1 -0
- package/dist/src/plugin/fingerprint.d.ts +41 -0
- package/dist/src/plugin/fingerprint.d.ts.map +1 -0
- package/dist/src/plugin/fingerprint.js +94 -0
- package/dist/src/plugin/fingerprint.js.map +1 -0
- package/dist/src/plugin/logger.d.ts +54 -0
- package/dist/src/plugin/logger.d.ts.map +1 -0
- package/dist/src/plugin/logger.js +120 -0
- package/dist/src/plugin/logger.js.map +1 -0
- package/dist/src/plugin/recovery/constants.d.ts +26 -0
- package/dist/src/plugin/recovery/constants.d.ts.map +1 -0
- package/dist/src/plugin/recovery/constants.js +47 -0
- package/dist/src/plugin/recovery/constants.js.map +1 -0
- package/dist/src/plugin/recovery/index.d.ts +16 -0
- package/dist/src/plugin/recovery/index.d.ts.map +1 -0
- package/dist/src/plugin/recovery/index.js +16 -0
- package/dist/src/plugin/recovery/index.js.map +1 -0
- package/dist/src/plugin/recovery/storage.d.ts +24 -0
- package/dist/src/plugin/recovery/storage.d.ts.map +1 -0
- package/dist/src/plugin/recovery/storage.js +354 -0
- package/dist/src/plugin/recovery/storage.js.map +1 -0
- package/dist/src/plugin/recovery/types.d.ts +116 -0
- package/dist/src/plugin/recovery/types.d.ts.map +1 -0
- package/dist/src/plugin/recovery/types.js +6 -0
- package/dist/src/plugin/recovery/types.js.map +1 -0
- package/dist/src/plugin/recovery.d.ts +63 -0
- package/dist/src/plugin/recovery.d.ts.map +1 -0
- package/dist/src/plugin/recovery.js +331 -0
- package/dist/src/plugin/recovery.js.map +1 -0
- package/dist/src/plugin/refresh-queue.d.ts +101 -0
- package/dist/src/plugin/refresh-queue.d.ts.map +1 -0
- package/dist/src/plugin/refresh-queue.js +248 -0
- package/dist/src/plugin/refresh-queue.js.map +1 -0
- package/dist/src/plugin/rotation.d.ts +169 -0
- package/dist/src/plugin/rotation.d.ts.map +1 -0
- package/dist/src/plugin/rotation.js +328 -0
- package/dist/src/plugin/rotation.js.map +1 -0
- package/dist/src/plugin/storage.d.ts +90 -0
- package/dist/src/plugin/storage.d.ts.map +1 -0
- package/dist/src/plugin/storage.js +450 -0
- package/dist/src/plugin/storage.js.map +1 -0
- package/dist/src/plugin/token.d.ts +19 -0
- package/dist/src/plugin/token.d.ts.map +1 -0
- package/dist/src/plugin/token.js +112 -0
- package/dist/src/plugin/token.js.map +1 -0
- package/dist/src/plugin/types.d.ts +97 -0
- package/dist/src/plugin/types.d.ts.map +1 -0
- package/dist/src/plugin/types.js +1 -0
- package/dist/src/plugin/types.js.map +1 -0
- package/dist/src/plugin/version.d.ts +14 -0
- package/dist/src/plugin/version.d.ts.map +1 -0
- package/dist/src/plugin/version.js +20 -0
- package/dist/src/plugin/version.js.map +1 -0
- package/dist/src/plugin.d.ts +5 -0
- package/dist/src/plugin.d.ts.map +1 -0
- package/dist/src/plugin.js +1077 -0
- package/dist/src/plugin.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Identity Module
|
|
3
|
+
*
|
|
4
|
+
* Generates unique device identifiers for Kimi Code API requests.
|
|
5
|
+
* Used for device fingerprinting in X-Msh-Device-Id headers.
|
|
6
|
+
*/
|
|
7
|
+
import * as crypto from "node:crypto";
|
|
8
|
+
/** Maximum number of fingerprint versions to keep per account */
|
|
9
|
+
export const MAX_FINGERPRINT_HISTORY = 5;
|
|
10
|
+
function isFiniteNumber(value) {
|
|
11
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
12
|
+
}
|
|
13
|
+
function normalizeDeviceIdToHex32(value) {
|
|
14
|
+
const trimmed = value.trim().toLowerCase();
|
|
15
|
+
if (/^[0-9a-f]{32}$/.test(trimmed)) {
|
|
16
|
+
return trimmed;
|
|
17
|
+
}
|
|
18
|
+
// Allow legacy UUID v4 strings and normalize to kimi-cli style (uuid4().hex).
|
|
19
|
+
if (/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(trimmed)) {
|
|
20
|
+
const hex = trimmed.replace(/-/g, "");
|
|
21
|
+
return /^[0-9a-f]{32}$/.test(hex) ? hex : null;
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
function generateDeviceIdHex32() {
|
|
26
|
+
// Prefer randomUUID when available, but always normalize to 32 lowercase hex chars.
|
|
27
|
+
try {
|
|
28
|
+
const uuid = crypto.randomUUID();
|
|
29
|
+
const normalized = normalizeDeviceIdToHex32(uuid);
|
|
30
|
+
if (normalized)
|
|
31
|
+
return normalized;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// ignore
|
|
35
|
+
}
|
|
36
|
+
return crypto.randomBytes(16).toString("hex");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generate a device identity with a unique device ID.
|
|
40
|
+
*/
|
|
41
|
+
export function generateFingerprint() {
|
|
42
|
+
return {
|
|
43
|
+
// kimi-cli uses uuid4().hex (32 lowercase hex chars, no dashes).
|
|
44
|
+
deviceId: generateDeviceIdHex32(),
|
|
45
|
+
createdAt: Date.now(),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Best-effort coercion of stored fingerprints.
|
|
50
|
+
* Keeps existing device ids when valid, normalizes legacy UUIDs, and regenerates when missing/corrupt.
|
|
51
|
+
*/
|
|
52
|
+
export function coerceFingerprint(value) {
|
|
53
|
+
const now = Date.now();
|
|
54
|
+
if (!value || typeof value !== "object") {
|
|
55
|
+
return generateFingerprint();
|
|
56
|
+
}
|
|
57
|
+
const v = value;
|
|
58
|
+
const deviceIdCandidate = typeof v.deviceId === "string"
|
|
59
|
+
? v.deviceId
|
|
60
|
+
: typeof v.device_id === "string"
|
|
61
|
+
? v.device_id
|
|
62
|
+
: "";
|
|
63
|
+
const normalized = deviceIdCandidate ? normalizeDeviceIdToHex32(deviceIdCandidate) : null;
|
|
64
|
+
const createdAtCandidate = isFiniteNumber(v.createdAt) ? v.createdAt : isFiniteNumber(v.created_at) ? v.created_at : now;
|
|
65
|
+
if (normalized) {
|
|
66
|
+
return { deviceId: normalized, createdAt: createdAtCandidate };
|
|
67
|
+
}
|
|
68
|
+
// Missing/invalid device id: regenerate.
|
|
69
|
+
return { deviceId: generateDeviceIdHex32(), createdAt: createdAtCandidate };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Session-level fingerprint instance.
|
|
73
|
+
* Generated once at module load, persists for the lifetime of the process.
|
|
74
|
+
*/
|
|
75
|
+
let sessionFingerprint = null;
|
|
76
|
+
/**
|
|
77
|
+
* Get or create the session fingerprint.
|
|
78
|
+
* Returns the same fingerprint for all calls within a session.
|
|
79
|
+
*/
|
|
80
|
+
export function getSessionFingerprint() {
|
|
81
|
+
if (!sessionFingerprint) {
|
|
82
|
+
sessionFingerprint = generateFingerprint();
|
|
83
|
+
}
|
|
84
|
+
return sessionFingerprint;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Regenerate the session fingerprint.
|
|
88
|
+
* Call this to get a fresh identity (e.g., after rate limiting).
|
|
89
|
+
*/
|
|
90
|
+
export function regenerateSessionFingerprint() {
|
|
91
|
+
sessionFingerprint = generateFingerprint();
|
|
92
|
+
return sessionFingerprint;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../../src/plugin/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAiBtC,iEAAiE;AACjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAEzC,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,wBAAwB,CAAC,KAAa;IAC7C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC3C,IAAI,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,8EAA8E;IAC9E,IAAI,gEAAgE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACnF,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,qBAAqB;IAC5B,oFAAoF;IACpF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;QACjC,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,UAAU;YAAE,OAAO,UAAU,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC;QACP,SAAS;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,EAAE,qBAAqB,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;AAC9E,CAAC;AAED;;;GAGG;AACH,IAAI,kBAAkB,GAAuB,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACxB,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B;IAC1C,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;IAC3C,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Logger for KimiCode Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides TUI-integrated logging that is silent by default.
|
|
5
|
+
* Logs are only visible when:
|
|
6
|
+
* 1. TUI client is available (logs to app log panel)
|
|
7
|
+
* 2. OPENCODE_KIMICODE_CONSOLE_LOG=1 is set (logs to console)
|
|
8
|
+
*
|
|
9
|
+
* Ported from opencode-google-kimicode-auth/src/plugin/logger.ts
|
|
10
|
+
*/
|
|
11
|
+
import type { PluginClient } from "./types";
|
|
12
|
+
type LogLevel = "debug" | "info" | "warn" | "error";
|
|
13
|
+
export interface Logger {
|
|
14
|
+
debug(message: string, extra?: Record<string, unknown>): void;
|
|
15
|
+
info(message: string, extra?: Record<string, unknown>): void;
|
|
16
|
+
warn(message: string, extra?: Record<string, unknown>): void;
|
|
17
|
+
error(message: string, extra?: Record<string, unknown>): void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Initialize the logger with the plugin client.
|
|
21
|
+
* Must be called during plugin initialization to enable TUI logging.
|
|
22
|
+
*/
|
|
23
|
+
export declare function initLogger(client: PluginClient): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get the current client (for testing or advanced usage).
|
|
26
|
+
*/
|
|
27
|
+
export declare function getLoggerClient(): PluginClient | null;
|
|
28
|
+
/**
|
|
29
|
+
* Create a logger instance for a specific module.
|
|
30
|
+
*
|
|
31
|
+
* @param module - The module name (e.g., "refresh-queue", "transform.claude")
|
|
32
|
+
* @returns Logger instance with debug, info, warn, error methods
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const log = createLogger("refresh-queue");
|
|
37
|
+
* log.debug("Checking tokens", { count: 5 });
|
|
38
|
+
* log.warn("Token expired", { accountIndex: 0 });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function createLogger(module: string): Logger;
|
|
42
|
+
/**
|
|
43
|
+
* Print a message to the console with KimiCode prefix.
|
|
44
|
+
* Only outputs when OPENCODE_KIMICODE_CONSOLE_LOG=1 is set.
|
|
45
|
+
*
|
|
46
|
+
* Use this for standalone messages that don't belong to a specific module.
|
|
47
|
+
*
|
|
48
|
+
* @param level - Log level
|
|
49
|
+
* @param message - Message to print
|
|
50
|
+
* @param extra - Optional extra data
|
|
51
|
+
*/
|
|
52
|
+
export declare function printKimiCodeConsole(level: LogLevel, message: string, extra?: unknown): void;
|
|
53
|
+
export {};
|
|
54
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/plugin/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAKpD,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC9D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAC7D,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC/D;AAYD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAErD;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,GAAG,IAAI,CAErD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CA0CnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO,GACd,IAAI,CAsBN"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured Logger for KimiCode Plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides TUI-integrated logging that is silent by default.
|
|
5
|
+
* Logs are only visible when:
|
|
6
|
+
* 1. TUI client is available (logs to app log panel)
|
|
7
|
+
* 2. OPENCODE_KIMICODE_CONSOLE_LOG=1 is set (logs to console)
|
|
8
|
+
*
|
|
9
|
+
* Ported from opencode-google-kimicode-auth/src/plugin/logger.ts
|
|
10
|
+
*/
|
|
11
|
+
const ENV_CONSOLE_LOG = "OPENCODE_KIMICODE_CONSOLE_LOG";
|
|
12
|
+
const KIMICODE_CONSOLE_PREFIX = "[KimiCode]";
|
|
13
|
+
let _client = null;
|
|
14
|
+
/**
|
|
15
|
+
* Check if console logging is enabled via environment variable.
|
|
16
|
+
*/
|
|
17
|
+
function isConsoleLogEnabled() {
|
|
18
|
+
const val = process.env[ENV_CONSOLE_LOG];
|
|
19
|
+
return val === "1" || val?.toLowerCase() === "true";
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the logger with the plugin client.
|
|
23
|
+
* Must be called during plugin initialization to enable TUI logging.
|
|
24
|
+
*/
|
|
25
|
+
export function initLogger(client) {
|
|
26
|
+
_client = client;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get the current client (for testing or advanced usage).
|
|
30
|
+
*/
|
|
31
|
+
export function getLoggerClient() {
|
|
32
|
+
return _client;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Create a logger instance for a specific module.
|
|
36
|
+
*
|
|
37
|
+
* @param module - The module name (e.g., "refresh-queue", "transform.claude")
|
|
38
|
+
* @returns Logger instance with debug, info, warn, error methods
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const log = createLogger("refresh-queue");
|
|
43
|
+
* log.debug("Checking tokens", { count: 5 });
|
|
44
|
+
* log.warn("Token expired", { accountIndex: 0 });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function createLogger(module) {
|
|
48
|
+
const service = `kimicode.${module}`;
|
|
49
|
+
const log = (level, message, extra) => {
|
|
50
|
+
// Try TUI logging first
|
|
51
|
+
const app = _client?.app;
|
|
52
|
+
if (app && typeof app.log === "function") {
|
|
53
|
+
app
|
|
54
|
+
.log({
|
|
55
|
+
body: { service, level, message, extra },
|
|
56
|
+
})
|
|
57
|
+
.catch(() => {
|
|
58
|
+
// Silently ignore logging errors
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else if (isConsoleLogEnabled()) {
|
|
62
|
+
// Fallback to console if env var is set
|
|
63
|
+
const prefix = `[${service}]`;
|
|
64
|
+
const args = extra ? [prefix, message, extra] : [prefix, message];
|
|
65
|
+
switch (level) {
|
|
66
|
+
case "debug":
|
|
67
|
+
console.debug(...args);
|
|
68
|
+
break;
|
|
69
|
+
case "info":
|
|
70
|
+
console.info(...args);
|
|
71
|
+
break;
|
|
72
|
+
case "warn":
|
|
73
|
+
console.warn(...args);
|
|
74
|
+
break;
|
|
75
|
+
case "error":
|
|
76
|
+
console.error(...args);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// If neither TUI nor console logging is enabled, log is silently discarded
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
debug: (message, extra) => log("debug", message, extra),
|
|
84
|
+
info: (message, extra) => log("info", message, extra),
|
|
85
|
+
warn: (message, extra) => log("warn", message, extra),
|
|
86
|
+
error: (message, extra) => log("error", message, extra),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Print a message to the console with KimiCode prefix.
|
|
91
|
+
* Only outputs when OPENCODE_KIMICODE_CONSOLE_LOG=1 is set.
|
|
92
|
+
*
|
|
93
|
+
* Use this for standalone messages that don't belong to a specific module.
|
|
94
|
+
*
|
|
95
|
+
* @param level - Log level
|
|
96
|
+
* @param message - Message to print
|
|
97
|
+
* @param extra - Optional extra data
|
|
98
|
+
*/
|
|
99
|
+
export function printKimiCodeConsole(level, message, extra) {
|
|
100
|
+
if (!isConsoleLogEnabled()) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const prefixedMessage = `${KIMICODE_CONSOLE_PREFIX} ${message}`;
|
|
104
|
+
const args = extra === undefined ? [prefixedMessage] : [prefixedMessage, extra];
|
|
105
|
+
switch (level) {
|
|
106
|
+
case "debug":
|
|
107
|
+
console.debug(...args);
|
|
108
|
+
break;
|
|
109
|
+
case "info":
|
|
110
|
+
console.info(...args);
|
|
111
|
+
break;
|
|
112
|
+
case "warn":
|
|
113
|
+
console.warn(...args);
|
|
114
|
+
break;
|
|
115
|
+
case "error":
|
|
116
|
+
console.error(...args);
|
|
117
|
+
break;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=logger.js.map
|
|
@@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AAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAEhF,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACvB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACtB,MAAM;QACR,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;YACvB,MAAM;IACV,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for session recovery storage paths.
|
|
3
|
+
*
|
|
4
|
+
* Based on oh-my-opencode/src/hooks/session-recovery/constants.ts
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get the XDG config directory for OpenCode config.
|
|
8
|
+
* Falls back to ~/.config on Linux/Mac, or APPDATA on Windows.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getXdgConfig(): string;
|
|
11
|
+
/**
|
|
12
|
+
* Get the OpenCode config directory.
|
|
13
|
+
* Default: ~/.config/opencode
|
|
14
|
+
*/
|
|
15
|
+
export declare function getOpencodeConfigDir(): string;
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Kept for backwards-compatibility with upstream naming.
|
|
18
|
+
*/
|
|
19
|
+
export declare const getAntigravityConfigDir: typeof getOpencodeConfigDir;
|
|
20
|
+
export declare const OPENCODE_STORAGE: string;
|
|
21
|
+
export declare const MESSAGE_STORAGE: string;
|
|
22
|
+
export declare const PART_STORAGE: string;
|
|
23
|
+
export declare const THINKING_TYPES: Set<string>;
|
|
24
|
+
export declare const META_TYPES: Set<string>;
|
|
25
|
+
export declare const CONTENT_TYPES: Set<string>;
|
|
26
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/plugin/recovery/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH;;;GAGG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAQrC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,6BAAuB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,QAA4C,CAAC;AAC1E,eAAO,MAAM,eAAe,QAAoC,CAAC;AACjE,eAAO,MAAM,YAAY,QAAiC,CAAC;AAE3D,eAAO,MAAM,cAAc,aAA0D,CAAC;AACtF,eAAO,MAAM,UAAU,aAAyC,CAAC;AACjE,eAAO,MAAM,aAAa,aAAuD,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Constants for session recovery storage paths.
|
|
3
|
+
*
|
|
4
|
+
* Based on oh-my-opencode/src/hooks/session-recovery/constants.ts
|
|
5
|
+
*/
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { homedir } from "node:os";
|
|
8
|
+
/**
|
|
9
|
+
* Get the XDG data directory for OpenCode storage.
|
|
10
|
+
* Falls back to ~/.local/share on Linux/Mac, or APPDATA on Windows.
|
|
11
|
+
*/
|
|
12
|
+
function getXdgData() {
|
|
13
|
+
const platform = process.platform;
|
|
14
|
+
if (platform === "win32") {
|
|
15
|
+
return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
16
|
+
}
|
|
17
|
+
return process.env.XDG_DATA_HOME || join(homedir(), ".local", "share");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get the XDG config directory for OpenCode config.
|
|
21
|
+
* Falls back to ~/.config on Linux/Mac, or APPDATA on Windows.
|
|
22
|
+
*/
|
|
23
|
+
export function getXdgConfig() {
|
|
24
|
+
const platform = process.platform;
|
|
25
|
+
if (platform === "win32") {
|
|
26
|
+
return process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
27
|
+
}
|
|
28
|
+
return process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the OpenCode config directory.
|
|
32
|
+
* Default: ~/.config/opencode
|
|
33
|
+
*/
|
|
34
|
+
export function getOpencodeConfigDir() {
|
|
35
|
+
return join(getXdgConfig(), "opencode");
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated Kept for backwards-compatibility with upstream naming.
|
|
39
|
+
*/
|
|
40
|
+
export const getAntigravityConfigDir = getOpencodeConfigDir;
|
|
41
|
+
export const OPENCODE_STORAGE = join(getXdgData(), "opencode", "storage");
|
|
42
|
+
export const MESSAGE_STORAGE = join(OPENCODE_STORAGE, "message");
|
|
43
|
+
export const PART_STORAGE = join(OPENCODE_STORAGE, "part");
|
|
44
|
+
export const THINKING_TYPES = new Set(["thinking", "redacted_thinking", "reasoning"]);
|
|
45
|
+
export const META_TYPES = new Set(["step-start", "step-finish"]);
|
|
46
|
+
export const CONTENT_TYPES = new Set(["text", "tool", "tool_use", "tool_result"]);
|
|
47
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/plugin/recovery/constants.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;GAGG;AACH,SAAS,UAAU;IACjB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI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I,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session recovery module for opencode-kimicode-auth.
|
|
3
|
+
*
|
|
4
|
+
* Provides recovery from:
|
|
5
|
+
* - tool_result_missing: Interrupted tool executions (provider-agnostic)
|
|
6
|
+
* - thinking_block_order: Corrupted thinking blocks (Claude/Anthropic-specific; no-op for Kimi)
|
|
7
|
+
* - thinking_disabled_violation: Thinking in non-thinking model (Claude/Anthropic-specific; no-op for Kimi)
|
|
8
|
+
*
|
|
9
|
+
* Note: Kimi uses OpenAI-compatible error formats. The thinking_* patterns will never
|
|
10
|
+
* match Kimi errors but are retained for completeness. To add Kimi-specific recovery,
|
|
11
|
+
* extend detectErrorType() in recovery.ts with Kimi error patterns.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export * from "./constants";
|
|
15
|
+
export * from "./storage";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/plugin/recovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Session recovery module for opencode-kimicode-auth.
|
|
3
|
+
*
|
|
4
|
+
* Provides recovery from:
|
|
5
|
+
* - tool_result_missing: Interrupted tool executions (provider-agnostic)
|
|
6
|
+
* - thinking_block_order: Corrupted thinking blocks (Claude/Anthropic-specific; no-op for Kimi)
|
|
7
|
+
* - thinking_disabled_violation: Thinking in non-thinking model (Claude/Anthropic-specific; no-op for Kimi)
|
|
8
|
+
*
|
|
9
|
+
* Note: Kimi uses OpenAI-compatible error formats. The thinking_* patterns will never
|
|
10
|
+
* match Kimi errors but are retained for completeness. To add Kimi-specific recovery,
|
|
11
|
+
* extend detectErrorType() in recovery.ts with Kimi error patterns.
|
|
12
|
+
*/
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export * from "./constants";
|
|
15
|
+
export * from "./storage";
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/plugin/recovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage utilities for reading OpenCode's session data.
|
|
3
|
+
*
|
|
4
|
+
* Based on oh-my-opencode/src/hooks/session-recovery/storage.ts
|
|
5
|
+
*/
|
|
6
|
+
import type { StoredMessageMeta, StoredPart } from "./types";
|
|
7
|
+
export declare function generatePartId(): string;
|
|
8
|
+
export declare function getMessageDir(sessionID: string): string;
|
|
9
|
+
export declare function readMessages(sessionID: string): StoredMessageMeta[];
|
|
10
|
+
export declare function readParts(messageID: string): StoredPart[];
|
|
11
|
+
export declare function hasContent(part: StoredPart): boolean;
|
|
12
|
+
export declare function messageHasContent(messageID: string): boolean;
|
|
13
|
+
export declare function injectTextPart(sessionID: string, messageID: string, text: string): boolean;
|
|
14
|
+
export declare function findMessagesWithThinkingBlocks(sessionID: string): string[];
|
|
15
|
+
export declare function findMessagesWithThinkingOnly(sessionID: string): string[];
|
|
16
|
+
export declare function findMessagesWithOrphanThinking(sessionID: string): string[];
|
|
17
|
+
export declare function prependThinkingPart(sessionID: string, messageID: string): boolean;
|
|
18
|
+
export declare function stripThinkingParts(messageID: string): boolean;
|
|
19
|
+
export declare function findEmptyMessages(sessionID: string): string[];
|
|
20
|
+
export declare function findEmptyMessageByIndex(sessionID: string, targetIndex: number): string | null;
|
|
21
|
+
export declare function findMessageByIndexNeedingThinking(sessionID: string, targetIndex: number): string | null;
|
|
22
|
+
export declare function replaceEmptyTextParts(messageID: string, replacementText: string): boolean;
|
|
23
|
+
export declare function findMessagesWithEmptyTextParts(sessionID: string): string[];
|
|
24
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../src/plugin/recovery/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAkB,MAAM,SAAS,CAAC;AAM7E,wBAAgB,cAAc,IAAI,MAAM,CAIvC;AAMD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAqBvD;AAMD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAyBnE;AAMD,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAoBzD;AAMD,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAkBpD;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAG5D;AAMD,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAuB1F;AAMD,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAe1E;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBxE;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CAwB1E;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAuBjF;AAED,wBAAgB,kBAAkB,CAA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