opencode-gemini-cli-oauth 1.1.11 → 1.1.13
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +3 -3
- package/dist/plugin.js.map +1 -1
- package/dist/storage/storage.d.ts +13 -13
- package/dist/storage/storage.d.ts.map +1 -1
- package/dist/storage/storage.js +34 -34
- package/dist/storage/storage.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Main entry point for the plugin
|
|
10
10
|
*/
|
|
11
|
-
export {
|
|
11
|
+
export { GeminiCLIOAuthPlugin, metadata } from './plugin.js';
|
|
12
12
|
export type { OAuthCredentials, GoogleAccount, AccountPoolEntry, AccountPool, PluginConfig, } from './types.js';
|
|
13
13
|
export { oauth } from './auth/oauth.js';
|
|
14
14
|
export { accountManager } from './auth/account-manager.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAGH,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAG7D,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* Main entry point for the plugin
|
|
10
10
|
*/
|
|
11
11
|
// Named export for OpenCode (following Antigravity pattern)
|
|
12
|
-
export {
|
|
12
|
+
export { GeminiCLIOAuthPlugin, metadata } from './plugin.js';
|
|
13
13
|
// Export utilities for advanced usage
|
|
14
14
|
export { oauth } from './auth/oauth.js';
|
|
15
15
|
export { accountManager } from './auth/account-manager.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AAEH,4DAA4D;AAC5D,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAW7D,sCAAsC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/plugin.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { PluginContext } from './types.js';
|
|
|
7
7
|
/**
|
|
8
8
|
* OpenCode Plugin for Gemini CLI OAuth Authentication
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export declare const GeminiCLIOAuthPlugin: ({ client, directory }: PluginContext) => Promise<{
|
|
11
11
|
auth: {
|
|
12
12
|
provider: string;
|
|
13
13
|
/**
|
package/dist/plugin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAC;AAK5D;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,YAAY,CAAC;AAK5D;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAU,uBAAuB,aAAa;;;QAOzE;;WAEG;0BACqB,GAAG,YAAY,MAAM;;yBAKtB,WAAW,GAAG,GAAG,SAAS,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC;;QAgChF;;WAEG;;;;;;;;;;;;;;;;;;;;EA6BR,CAAC;AAEF,eAAO,MAAM,QAAQ;;;;;;;;CAQpB,CAAC"}
|
package/dist/plugin.js
CHANGED
|
@@ -9,8 +9,8 @@ import { oauth } from './auth/oauth.js';
|
|
|
9
9
|
/**
|
|
10
10
|
* OpenCode Plugin for Gemini CLI OAuth Authentication
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
13
|
-
console.log('🚀 Loading Gemini CLI OAuth plugin (v1.1.
|
|
12
|
+
export const GeminiCLIOAuthPlugin = async ({ client, directory }) => {
|
|
13
|
+
console.log('🚀 Loading Gemini CLI OAuth plugin (v1.1.13)...');
|
|
14
14
|
return {
|
|
15
15
|
auth: {
|
|
16
16
|
provider: 'gemini-cli-oauth',
|
|
@@ -79,7 +79,7 @@ export default async function GeminiCLIOAuthPlugin({ client, directory }) {
|
|
|
79
79
|
]
|
|
80
80
|
},
|
|
81
81
|
};
|
|
82
|
-
}
|
|
82
|
+
};
|
|
83
83
|
export const metadata = {
|
|
84
84
|
name: 'opencode-gemini-cli-oauth',
|
|
85
85
|
version: '1.1.8',
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,0BAA0B;AAC1B,4CAA4C;AAE5C;;GAEG;AACH,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAGxC,0BAA0B;AAC1B,4CAA4C;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAiB,EAAE,EAAE;IACjF,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC;IAE/D,OAAO;QACL,IAAI,EAAE;YACJ,QAAQ,EAAE,kBAAkB;YAE5B;;eAEG;YACH,MAAM,EAAE,KAAK,EAAE,OAAY,EAAE,QAAgB,EAAE,EAAE;gBAC/C,OAAO;oBACL,MAAM,EAAE,8BAA8B;oBAEtC,0BAA0B;oBAC1B,KAAK,CAAC,KAAK,CAAC,KAAwB,EAAE,IAAkB;wBACtD,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,YAAY,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;wBAEjG,qCAAqC;wBACrC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,mCAAmC,CAAC,EAAE,CAAC;4BAC1D,OAAO,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;wBAC5B,CAAC;wBAED,IAAI,CAAC;4BACH,0CAA0C;4BAC1C,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE,CAAC;4BAE3C,8BAA8B;4BAC9B,MAAM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C7D,CAAC;4BACJ,CAAC;yBACF,CAAC;oBACJ,CAAC;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,2BAA2B;IACjC,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,8CAA8C;IAC3D,MAAM,EAAE,OAAO;IACf,cAAc,EAAE;QACd,QAAQ,EAAE,QAAQ;KACnB;CACF,CAAC"}
|
|
@@ -7,50 +7,50 @@ import type { OAuthCredentials, GoogleAccount, AccountPool, AccountPoolEntry } f
|
|
|
7
7
|
/**
|
|
8
8
|
* Storage manager for OAuth credentials and account pool
|
|
9
9
|
*/
|
|
10
|
-
export declare
|
|
10
|
+
export declare const StorageManager: {
|
|
11
11
|
/**
|
|
12
12
|
* Ensure storage directories exist
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
ensureDirectories(): Promise<void>;
|
|
15
15
|
/**
|
|
16
16
|
* Read OAuth credentials from Gemini CLI storage
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
readOAuthCredentials(): Promise<OAuthCredentials | null>;
|
|
19
19
|
/**
|
|
20
20
|
* Write OAuth credentials to Gemini CLI storage
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
writeOAuthCredentials(credentials: OAuthCredentials): Promise<void>;
|
|
23
23
|
/**
|
|
24
24
|
* Read Google accounts list from Gemini CLI
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
readGoogleAccounts(): Promise<GoogleAccount[]>;
|
|
27
27
|
/**
|
|
28
28
|
* Read account pool
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
readAccountPool(): Promise<AccountPool>;
|
|
31
31
|
/**
|
|
32
32
|
* Write account pool
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
writeAccountPool(pool: AccountPool): Promise<void>;
|
|
35
35
|
/**
|
|
36
36
|
* Update account in pool
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
updateAccountInPool(email: string, updates: Partial<AccountPoolEntry>): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* Add or update account in pool
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
upsertAccountInPool(entry: AccountPoolEntry): Promise<void>;
|
|
43
43
|
/**
|
|
44
44
|
* Remove account from pool
|
|
45
45
|
*/
|
|
46
|
-
|
|
46
|
+
removeAccountFromPool(email: string): Promise<void>;
|
|
47
47
|
/**
|
|
48
48
|
* Get current active account from pool
|
|
49
49
|
*/
|
|
50
|
-
|
|
50
|
+
getCurrentAccount(): Promise<AccountPoolEntry | null>;
|
|
51
51
|
/**
|
|
52
52
|
* Rotate to next account in pool
|
|
53
53
|
*/
|
|
54
|
-
|
|
55
|
-
}
|
|
54
|
+
rotateToNextAccount(): Promise<AccountPoolEntry | null>;
|
|
55
|
+
};
|
|
56
56
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB;;GAEG;AACH,eAAO,MAAM,cAAc;IACzB;;OAEG;yBACwB,OAAO,CAAC,IAAI,CAAC;IAKxC;;OAEG;4BAC2B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAY9D;;OAEG;uCACsC,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAKzE;;OAEG;0BACyB,OAAO,CAAC,aAAa,EAAE,CAAC;IAapD;;OAEG;uBACsB,OAAO,CAAC,WAAW,CAAC;IAY7C;;OAEG;2BAC0B,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxD;;OAEG;+BAEM,MAAM,WACJ,OAAO,CAAC,gBAAgB,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC;IAahB;;OAEG;+BAC8B,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAajE;;OAEG;iCACgC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzD;;OAEG;yBACwB,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAQ3D;;OAEG;2BAC0B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;CAW9D,CAAC"}
|
package/dist/storage/storage.js
CHANGED
|
@@ -8,18 +8,18 @@ import { OAUTH_CREDS_PATH, GOOGLE_ACCOUNTS_PATH, ACCOUNT_POOL_PATH, PLUGIN_STORA
|
|
|
8
8
|
/**
|
|
9
9
|
* Storage manager for OAuth credentials and account pool
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export const StorageManager = {
|
|
12
12
|
/**
|
|
13
13
|
* Ensure storage directories exist
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
async ensureDirectories() {
|
|
16
16
|
await fs.mkdir(GEMINI_DIR, { recursive: true });
|
|
17
17
|
await fs.mkdir(PLUGIN_STORAGE_DIR, { recursive: true });
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
19
|
/**
|
|
20
20
|
* Read OAuth credentials from Gemini CLI storage
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
async readOAuthCredentials() {
|
|
23
23
|
try {
|
|
24
24
|
const data = await fs.readFile(OAUTH_CREDS_PATH, 'utf-8');
|
|
25
25
|
return JSON.parse(data);
|
|
@@ -30,18 +30,18 @@ export class StorageManager {
|
|
|
30
30
|
}
|
|
31
31
|
throw error;
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
34
|
/**
|
|
35
35
|
* Write OAuth credentials to Gemini CLI storage
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
|
-
await
|
|
37
|
+
async writeOAuthCredentials(credentials) {
|
|
38
|
+
await StorageManager.ensureDirectories();
|
|
39
39
|
await fs.writeFile(OAUTH_CREDS_PATH, JSON.stringify(credentials, null, 2), 'utf-8');
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
41
|
/**
|
|
42
42
|
* Read Google accounts list from Gemini CLI
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
async readGoogleAccounts() {
|
|
45
45
|
try {
|
|
46
46
|
const data = await fs.readFile(GOOGLE_ACCOUNTS_PATH, 'utf-8');
|
|
47
47
|
const parsed = JSON.parse(data);
|
|
@@ -53,11 +53,11 @@ export class StorageManager {
|
|
|
53
53
|
}
|
|
54
54
|
throw error;
|
|
55
55
|
}
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
57
|
/**
|
|
58
58
|
* Read account pool
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
async readAccountPool() {
|
|
61
61
|
try {
|
|
62
62
|
const data = await fs.readFile(ACCOUNT_POOL_PATH, 'utf-8');
|
|
63
63
|
return JSON.parse(data);
|
|
@@ -68,33 +68,33 @@ export class StorageManager {
|
|
|
68
68
|
}
|
|
69
69
|
throw error;
|
|
70
70
|
}
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
72
|
/**
|
|
73
73
|
* Write account pool
|
|
74
74
|
*/
|
|
75
|
-
|
|
76
|
-
await
|
|
75
|
+
async writeAccountPool(pool) {
|
|
76
|
+
await StorageManager.ensureDirectories();
|
|
77
77
|
await fs.writeFile(ACCOUNT_POOL_PATH, JSON.stringify(pool, null, 2), 'utf-8');
|
|
78
|
-
}
|
|
78
|
+
},
|
|
79
79
|
/**
|
|
80
80
|
* Update account in pool
|
|
81
81
|
*/
|
|
82
|
-
|
|
83
|
-
const pool = await
|
|
82
|
+
async updateAccountInPool(email, updates) {
|
|
83
|
+
const pool = await StorageManager.readAccountPool();
|
|
84
84
|
const accountIndex = pool.accounts.findIndex((acc) => acc.email === email);
|
|
85
85
|
if (accountIndex >= 0) {
|
|
86
86
|
pool.accounts[accountIndex] = {
|
|
87
87
|
...pool.accounts[accountIndex],
|
|
88
88
|
...updates,
|
|
89
89
|
};
|
|
90
|
-
await
|
|
90
|
+
await StorageManager.writeAccountPool(pool);
|
|
91
91
|
}
|
|
92
|
-
}
|
|
92
|
+
},
|
|
93
93
|
/**
|
|
94
94
|
* Add or update account in pool
|
|
95
95
|
*/
|
|
96
|
-
|
|
97
|
-
const pool = await
|
|
96
|
+
async upsertAccountInPool(entry) {
|
|
97
|
+
const pool = await StorageManager.readAccountPool();
|
|
98
98
|
const accountIndex = pool.accounts.findIndex((acc) => acc.email === entry.email);
|
|
99
99
|
if (accountIndex >= 0) {
|
|
100
100
|
pool.accounts[accountIndex] = entry;
|
|
@@ -102,37 +102,37 @@ export class StorageManager {
|
|
|
102
102
|
else {
|
|
103
103
|
pool.accounts.push(entry);
|
|
104
104
|
}
|
|
105
|
-
await
|
|
106
|
-
}
|
|
105
|
+
await StorageManager.writeAccountPool(pool);
|
|
106
|
+
},
|
|
107
107
|
/**
|
|
108
108
|
* Remove account from pool
|
|
109
109
|
*/
|
|
110
|
-
|
|
111
|
-
const pool = await
|
|
110
|
+
async removeAccountFromPool(email) {
|
|
111
|
+
const pool = await StorageManager.readAccountPool();
|
|
112
112
|
pool.accounts = pool.accounts.filter((acc) => acc.email !== email);
|
|
113
|
-
await
|
|
114
|
-
}
|
|
113
|
+
await StorageManager.writeAccountPool(pool);
|
|
114
|
+
},
|
|
115
115
|
/**
|
|
116
116
|
* Get current active account from pool
|
|
117
117
|
*/
|
|
118
|
-
|
|
119
|
-
const pool = await
|
|
118
|
+
async getCurrentAccount() {
|
|
119
|
+
const pool = await StorageManager.readAccountPool();
|
|
120
120
|
if (pool.accounts.length === 0) {
|
|
121
121
|
return null;
|
|
122
122
|
}
|
|
123
123
|
return pool.accounts[pool.currentIndex] || pool.accounts[0];
|
|
124
|
-
}
|
|
124
|
+
},
|
|
125
125
|
/**
|
|
126
126
|
* Rotate to next account in pool
|
|
127
127
|
*/
|
|
128
|
-
|
|
129
|
-
const pool = await
|
|
128
|
+
async rotateToNextAccount() {
|
|
129
|
+
const pool = await StorageManager.readAccountPool();
|
|
130
130
|
if (pool.accounts.length === 0) {
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
pool.currentIndex = (pool.currentIndex + 1) % pool.accounts.length;
|
|
134
|
-
await
|
|
134
|
+
await StorageManager.writeAccountPool(pool);
|
|
135
135
|
return pool.accounts[pool.currentIndex];
|
|
136
136
|
}
|
|
137
|
-
}
|
|
137
|
+
};
|
|
138
138
|
//# sourceMappingURL=storage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,GACX,MAAM,iBAAiB,CAAC;AAQzB;;GAEG;AACH,MAAM,
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAElC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,UAAU,GACX,MAAM,iBAAiB,CAAC;AAQzB;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,KAAK,CAAC,iBAAiB;QACrB,MAAM,EAAE,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,EAAE,CAAC,KAAK,CAAC,kBAAk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