opencode-openai-codex-multi-auth 4.4.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 +37 -0
- package/README.md +89 -0
- package/assets/openai-codex-auth-config.schema.json +63 -0
- package/assets/opencode-logo-ornate-dark.svg +18 -0
- package/assets/readme-hero.svg +31 -0
- package/config/README.md +103 -0
- package/config/minimal-opencode.json +12 -0
- package/config/opencode-legacy.json +571 -0
- package/config/opencode-modern.json +239 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +564 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/accounts.d.ts +58 -0
- package/dist/lib/accounts.d.ts.map +1 -0
- package/dist/lib/accounts.js +405 -0
- package/dist/lib/accounts.js.map +1 -0
- package/dist/lib/auth/auth.d.ts +43 -0
- package/dist/lib/auth/auth.d.ts.map +1 -0
- package/dist/lib/auth/auth.js +163 -0
- package/dist/lib/auth/auth.js.map +1 -0
- package/dist/lib/auth/browser.d.ts +17 -0
- package/dist/lib/auth/browser.d.ts.map +1 -0
- package/dist/lib/auth/browser.js +76 -0
- package/dist/lib/auth/browser.js.map +1 -0
- package/dist/lib/auth/server.d.ts +10 -0
- package/dist/lib/auth/server.d.ts.map +1 -0
- package/dist/lib/auth/server.js +78 -0
- package/dist/lib/auth/server.js.map +1 -0
- package/dist/lib/cli.d.ts +8 -0
- package/dist/lib/cli.d.ts.map +1 -0
- package/dist/lib/cli.js +36 -0
- package/dist/lib/cli.js.map +1 -0
- package/dist/lib/config.d.ts +25 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +112 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/constants.d.ts +67 -0
- package/dist/lib/constants.d.ts.map +1 -0
- package/dist/lib/constants.js +67 -0
- package/dist/lib/constants.js.map +1 -0
- package/dist/lib/logger.d.ts +21 -0
- package/dist/lib/logger.d.ts.map +1 -0
- package/dist/lib/logger.js +77 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/oauth-success.html +712 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts +19 -0
- package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -0
- package/dist/lib/prompts/codex-opencode-bridge.js +152 -0
- package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -0
- package/dist/lib/prompts/codex.d.ts +28 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -0
- package/dist/lib/prompts/codex.js +248 -0
- package/dist/lib/prompts/codex.js.map +1 -0
- package/dist/lib/prompts/opencode-codex.d.ts +21 -0
- package/dist/lib/prompts/opencode-codex.d.ts.map +1 -0
- package/dist/lib/prompts/opencode-codex.js +91 -0
- package/dist/lib/prompts/opencode-codex.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +73 -0
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -0
- package/dist/lib/request/fetch-helpers.js +221 -0
- package/dist/lib/request/fetch-helpers.js.map +1 -0
- package/dist/lib/request/helpers/input-utils.d.ts +6 -0
- package/dist/lib/request/helpers/input-utils.d.ts.map +1 -0
- package/dist/lib/request/helpers/input-utils.js +174 -0
- package/dist/lib/request/helpers/input-utils.js.map +1 -0
- package/dist/lib/request/helpers/model-map.d.ts +28 -0
- package/dist/lib/request/helpers/model-map.d.ts.map +1 -0
- package/dist/lib/request/helpers/model-map.js +109 -0
- package/dist/lib/request/helpers/model-map.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts +93 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -0
- package/dist/lib/request/request-transformer.js +403 -0
- package/dist/lib/request/request-transformer.js.map +1 -0
- package/dist/lib/request/response-handler.d.ts +14 -0
- package/dist/lib/request/response-handler.d.ts.map +1 -0
- package/dist/lib/request/response-handler.js +88 -0
- package/dist/lib/request/response-handler.js.map +1 -0
- package/dist/lib/storage.d.ts +5 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/lib/storage.js +46 -0
- package/dist/lib/storage.js.map +1 -0
- package/dist/lib/types.d.ts +236 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/dist/lib/types.js +2 -0
- package/dist/lib/types.js.map +1 -0
- package/package.json +77 -0
- package/scripts/install-opencode-codex-auth.js +450 -0
- package/scripts/test-all-models.sh +259 -0
- package/scripts/validate-model-map.sh +97 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for the custom fetch implementation
|
|
3
|
+
* These functions break down the complex fetch logic into manageable, testable units
|
|
4
|
+
*/
|
|
5
|
+
import type { Auth } from "@opencode-ai/sdk";
|
|
6
|
+
import type { OpencodeClient } from "@opencode-ai/sdk";
|
|
7
|
+
import type { UserConfig, RequestBody } from "../types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Determines if the current auth token needs to be refreshed
|
|
10
|
+
* @param auth - Current authentication state
|
|
11
|
+
* @returns True if token is expired or invalid
|
|
12
|
+
*/
|
|
13
|
+
export declare function shouldRefreshToken(auth: Auth): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Refreshes the OAuth token and updates stored credentials
|
|
16
|
+
* @param currentAuth - Current auth state
|
|
17
|
+
* @param client - Opencode client for updating stored credentials
|
|
18
|
+
* @returns Updated auth (throws on failure)
|
|
19
|
+
*/
|
|
20
|
+
export declare function refreshAndUpdateToken(currentAuth: Auth, client: OpencodeClient): Promise<Auth>;
|
|
21
|
+
/**
|
|
22
|
+
* Extracts URL string from various request input types
|
|
23
|
+
* @param input - Request input (string, URL, or Request object)
|
|
24
|
+
* @returns URL string
|
|
25
|
+
*/
|
|
26
|
+
export declare function extractRequestUrl(input: Request | string | URL): string;
|
|
27
|
+
/**
|
|
28
|
+
* Rewrites OpenAI API URLs to Codex backend URLs
|
|
29
|
+
* @param url - Original URL
|
|
30
|
+
* @returns Rewritten URL for Codex backend
|
|
31
|
+
*/
|
|
32
|
+
export declare function rewriteUrlForCodex(url: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Transforms request body and logs the transformation
|
|
35
|
+
* Fetches model-specific Codex instructions based on the request model
|
|
36
|
+
*
|
|
37
|
+
* @param init - Request init options
|
|
38
|
+
* @param url - Request URL
|
|
39
|
+
* @param userConfig - User configuration
|
|
40
|
+
* @param codexMode - Enable CODEX_MODE (bridge prompt instead of tool remap)
|
|
41
|
+
* @returns Transformed body and updated init, or undefined if no body
|
|
42
|
+
*/
|
|
43
|
+
export declare function transformRequestForCodex(init: RequestInit | undefined, url: string, userConfig: UserConfig, codexMode?: boolean): Promise<{
|
|
44
|
+
body: RequestBody;
|
|
45
|
+
updatedInit: RequestInit;
|
|
46
|
+
} | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Creates headers for Codex API requests
|
|
49
|
+
* @param init - Request init options
|
|
50
|
+
* @param accountId - ChatGPT account ID
|
|
51
|
+
* @param accessToken - OAuth access token
|
|
52
|
+
* @returns Headers object with all required Codex headers
|
|
53
|
+
*/
|
|
54
|
+
export declare function createCodexHeaders(init: RequestInit | undefined, accountId: string, accessToken: string, opts?: {
|
|
55
|
+
model?: string;
|
|
56
|
+
promptCacheKey?: string;
|
|
57
|
+
}): Headers;
|
|
58
|
+
/**
|
|
59
|
+
* Handles error responses from the Codex API
|
|
60
|
+
* @param response - Error response from API
|
|
61
|
+
* @returns Original response or mapped retryable response
|
|
62
|
+
*/
|
|
63
|
+
export declare function handleErrorResponse(response: Response): Promise<Response>;
|
|
64
|
+
/**
|
|
65
|
+
* Handles successful responses from the Codex API
|
|
66
|
+
* Converts SSE to JSON for non-streaming requests (generateText)
|
|
67
|
+
* Passes through SSE for streaming requests (streamText)
|
|
68
|
+
* @param response - Success response from API
|
|
69
|
+
* @param isStreaming - Whether this is a streaming request (stream=true in body)
|
|
70
|
+
* @returns Processed response (SSE→JSON for non-streaming, stream for streaming)
|
|
71
|
+
*/
|
|
72
|
+
export declare function handleSuccessResponse(response: Response, isStreaming: boolean): Promise<Response>;
|
|
73
|
+
//# sourceMappingURL=fetch-helpers.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BAAsB,mBAAmB,CACrC,QAAQ,EAAE,QAAQ,GACnB,OAAO,CAAC,QAAQ,CAAC,CAUnB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,OAAO,GACrB,OAAO,CAAC,QAAQ,CAAC,CAcnB"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for the custom fetch implementation
|
|
3
|
+
* These functions break down the complex fetch logic into manageable, testable units
|
|
4
|
+
*/
|
|
5
|
+
import { refreshAccessToken } from "../auth/auth.js";
|
|
6
|
+
import { logRequest } from "../logger.js";
|
|
7
|
+
import { getCodexInstructions, getModelFamily } from "../prompts/codex.js";
|
|
8
|
+
import { transformRequestBody, normalizeModel } from "./request-transformer.js";
|
|
9
|
+
import { convertSseToJson, ensureContentType } from "./response-handler.js";
|
|
10
|
+
import { PLUGIN_NAME, HTTP_STATUS, OPENAI_HEADERS, OPENAI_HEADER_VALUES, URL_PATHS, ERROR_MESSAGES, LOG_STAGES, } from "../constants.js";
|
|
11
|
+
/**
|
|
12
|
+
* Determines if the current auth token needs to be refreshed
|
|
13
|
+
* @param auth - Current authentication state
|
|
14
|
+
* @returns True if token is expired or invalid
|
|
15
|
+
*/
|
|
16
|
+
export function shouldRefreshToken(auth) {
|
|
17
|
+
return auth.type !== "oauth" || !auth.access || auth.expires < Date.now();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Refreshes the OAuth token and updates stored credentials
|
|
21
|
+
* @param currentAuth - Current auth state
|
|
22
|
+
* @param client - Opencode client for updating stored credentials
|
|
23
|
+
* @returns Updated auth (throws on failure)
|
|
24
|
+
*/
|
|
25
|
+
export async function refreshAndUpdateToken(currentAuth, client) {
|
|
26
|
+
const refreshToken = currentAuth.type === "oauth" ? currentAuth.refresh : "";
|
|
27
|
+
const refreshResult = await refreshAccessToken(refreshToken);
|
|
28
|
+
if (refreshResult.type === "failed") {
|
|
29
|
+
throw new Error(ERROR_MESSAGES.TOKEN_REFRESH_FAILED);
|
|
30
|
+
}
|
|
31
|
+
// Update stored credentials
|
|
32
|
+
await client.auth.set({
|
|
33
|
+
path: { id: "openai" },
|
|
34
|
+
body: {
|
|
35
|
+
type: "oauth",
|
|
36
|
+
access: refreshResult.access,
|
|
37
|
+
refresh: refreshResult.refresh,
|
|
38
|
+
expires: refreshResult.expires,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
// Update current auth reference if it's OAuth type
|
|
42
|
+
if (currentAuth.type === "oauth") {
|
|
43
|
+
currentAuth.access = refreshResult.access;
|
|
44
|
+
currentAuth.refresh = refreshResult.refresh;
|
|
45
|
+
currentAuth.expires = refreshResult.expires;
|
|
46
|
+
}
|
|
47
|
+
return currentAuth;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Extracts URL string from various request input types
|
|
51
|
+
* @param input - Request input (string, URL, or Request object)
|
|
52
|
+
* @returns URL string
|
|
53
|
+
*/
|
|
54
|
+
export function extractRequestUrl(input) {
|
|
55
|
+
if (typeof input === "string")
|
|
56
|
+
return input;
|
|
57
|
+
if (input instanceof URL)
|
|
58
|
+
return input.toString();
|
|
59
|
+
return input.url;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Rewrites OpenAI API URLs to Codex backend URLs
|
|
63
|
+
* @param url - Original URL
|
|
64
|
+
* @returns Rewritten URL for Codex backend
|
|
65
|
+
*/
|
|
66
|
+
export function rewriteUrlForCodex(url) {
|
|
67
|
+
return url.replace(URL_PATHS.RESPONSES, URL_PATHS.CODEX_RESPONSES);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Transforms request body and logs the transformation
|
|
71
|
+
* Fetches model-specific Codex instructions based on the request model
|
|
72
|
+
*
|
|
73
|
+
* @param init - Request init options
|
|
74
|
+
* @param url - Request URL
|
|
75
|
+
* @param userConfig - User configuration
|
|
76
|
+
* @param codexMode - Enable CODEX_MODE (bridge prompt instead of tool remap)
|
|
77
|
+
* @returns Transformed body and updated init, or undefined if no body
|
|
78
|
+
*/
|
|
79
|
+
export async function transformRequestForCodex(init, url, userConfig, codexMode = true) {
|
|
80
|
+
if (!init?.body)
|
|
81
|
+
return undefined;
|
|
82
|
+
try {
|
|
83
|
+
const body = JSON.parse(init.body);
|
|
84
|
+
const originalModel = body.model;
|
|
85
|
+
// Normalize model first to determine which instructions to fetch
|
|
86
|
+
// This ensures we get the correct model-specific prompt
|
|
87
|
+
const normalizedModel = normalizeModel(originalModel);
|
|
88
|
+
const modelFamily = getModelFamily(normalizedModel);
|
|
89
|
+
// Log original request
|
|
90
|
+
logRequest(LOG_STAGES.BEFORE_TRANSFORM, {
|
|
91
|
+
url,
|
|
92
|
+
originalModel,
|
|
93
|
+
model: body.model,
|
|
94
|
+
hasTools: !!body.tools,
|
|
95
|
+
hasInput: !!body.input,
|
|
96
|
+
inputLength: body.input?.length,
|
|
97
|
+
codexMode,
|
|
98
|
+
body: body,
|
|
99
|
+
});
|
|
100
|
+
// Fetch model-specific Codex instructions (cached per model family)
|
|
101
|
+
const codexInstructions = await getCodexInstructions(normalizedModel);
|
|
102
|
+
// Transform request body
|
|
103
|
+
const transformedBody = await transformRequestBody(body, codexInstructions, userConfig, codexMode);
|
|
104
|
+
// Log transformed request
|
|
105
|
+
logRequest(LOG_STAGES.AFTER_TRANSFORM, {
|
|
106
|
+
url,
|
|
107
|
+
originalModel,
|
|
108
|
+
normalizedModel: transformedBody.model,
|
|
109
|
+
modelFamily,
|
|
110
|
+
hasTools: !!transformedBody.tools,
|
|
111
|
+
hasInput: !!transformedBody.input,
|
|
112
|
+
inputLength: transformedBody.input?.length,
|
|
113
|
+
reasoning: transformedBody.reasoning,
|
|
114
|
+
textVerbosity: transformedBody.text?.verbosity,
|
|
115
|
+
include: transformedBody.include,
|
|
116
|
+
body: transformedBody,
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
body: transformedBody,
|
|
120
|
+
updatedInit: { ...init, body: JSON.stringify(transformedBody) },
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
console.error(`[${PLUGIN_NAME}] ${ERROR_MESSAGES.REQUEST_PARSE_ERROR}:`, e);
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Creates headers for Codex API requests
|
|
130
|
+
* @param init - Request init options
|
|
131
|
+
* @param accountId - ChatGPT account ID
|
|
132
|
+
* @param accessToken - OAuth access token
|
|
133
|
+
* @returns Headers object with all required Codex headers
|
|
134
|
+
*/
|
|
135
|
+
export function createCodexHeaders(init, accountId, accessToken, opts) {
|
|
136
|
+
const headers = new Headers(init?.headers ?? {});
|
|
137
|
+
headers.delete("x-api-key"); // Remove any existing API key
|
|
138
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
139
|
+
headers.set(OPENAI_HEADERS.ACCOUNT_ID, accountId);
|
|
140
|
+
headers.set(OPENAI_HEADERS.BETA, OPENAI_HEADER_VALUES.BETA_RESPONSES);
|
|
141
|
+
headers.set(OPENAI_HEADERS.ORIGINATOR, OPENAI_HEADER_VALUES.ORIGINATOR_CODEX);
|
|
142
|
+
const cacheKey = opts?.promptCacheKey;
|
|
143
|
+
if (cacheKey) {
|
|
144
|
+
headers.set(OPENAI_HEADERS.CONVERSATION_ID, cacheKey);
|
|
145
|
+
headers.set(OPENAI_HEADERS.SESSION_ID, cacheKey);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
headers.delete(OPENAI_HEADERS.CONVERSATION_ID);
|
|
149
|
+
headers.delete(OPENAI_HEADERS.SESSION_ID);
|
|
150
|
+
}
|
|
151
|
+
headers.set("accept", "text/event-stream");
|
|
152
|
+
return headers;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Handles error responses from the Codex API
|
|
156
|
+
* @param response - Error response from API
|
|
157
|
+
* @returns Original response or mapped retryable response
|
|
158
|
+
*/
|
|
159
|
+
export async function handleErrorResponse(response) {
|
|
160
|
+
const mapped = await mapUsageLimit404(response);
|
|
161
|
+
const finalResponse = mapped ?? response;
|
|
162
|
+
logRequest(LOG_STAGES.ERROR_RESPONSE, {
|
|
163
|
+
status: finalResponse.status,
|
|
164
|
+
statusText: finalResponse.statusText,
|
|
165
|
+
});
|
|
166
|
+
return finalResponse;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Handles successful responses from the Codex API
|
|
170
|
+
* Converts SSE to JSON for non-streaming requests (generateText)
|
|
171
|
+
* Passes through SSE for streaming requests (streamText)
|
|
172
|
+
* @param response - Success response from API
|
|
173
|
+
* @param isStreaming - Whether this is a streaming request (stream=true in body)
|
|
174
|
+
* @returns Processed response (SSE→JSON for non-streaming, stream for streaming)
|
|
175
|
+
*/
|
|
176
|
+
export async function handleSuccessResponse(response, isStreaming) {
|
|
177
|
+
const responseHeaders = ensureContentType(response.headers);
|
|
178
|
+
// For non-streaming requests (generateText), convert SSE to JSON
|
|
179
|
+
if (!isStreaming) {
|
|
180
|
+
return await convertSseToJson(response, responseHeaders);
|
|
181
|
+
}
|
|
182
|
+
// For streaming requests (streamText), return stream as-is
|
|
183
|
+
return new Response(response.body, {
|
|
184
|
+
status: response.status,
|
|
185
|
+
statusText: response.statusText,
|
|
186
|
+
headers: responseHeaders,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
async function mapUsageLimit404(response) {
|
|
190
|
+
if (response.status !== HTTP_STATUS.NOT_FOUND)
|
|
191
|
+
return null;
|
|
192
|
+
const clone = response.clone();
|
|
193
|
+
let text = "";
|
|
194
|
+
try {
|
|
195
|
+
text = await clone.text();
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
text = "";
|
|
199
|
+
}
|
|
200
|
+
if (!text)
|
|
201
|
+
return null;
|
|
202
|
+
let code = "";
|
|
203
|
+
try {
|
|
204
|
+
const parsed = JSON.parse(text);
|
|
205
|
+
code = (parsed?.error?.code ?? parsed?.error?.type ?? "").toString();
|
|
206
|
+
}
|
|
207
|
+
catch {
|
|
208
|
+
code = "";
|
|
209
|
+
}
|
|
210
|
+
const haystack = `${code} ${text}`.toLowerCase();
|
|
211
|
+
if (!/usage_limit_reached|usage_not_included|rate_limit_exceeded|usage limit/i.test(haystack)) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
const headers = new Headers(response.headers);
|
|
215
|
+
return new Response(response.body, {
|
|
216
|
+
status: HTTP_STATUS.TOO_MANY_REQUESTS,
|
|
217
|
+
statusText: "Too Many Requests",
|
|
218
|
+
headers,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=fetch-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-helpers.js","sourceRoot":"","sources":["../../../lib/request/fetch-helpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,EACN,WAAW,EACX,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,UAAU,GACV,MAAM,iBAAiB,CAAC;AAEzB;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAU;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;AAC3E,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAA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";
|
|
2
|
+
export declare const getContentText: (item: InputItem) => string;
|
|
3
|
+
export declare function isOpenCodeSystemPrompt(item: InputItem, cachedPrompt: string | null): boolean;
|
|
4
|
+
export declare function filterOpenCodeSystemPromptsWithCachedPrompt(input: InputItem[] | undefined, cachedPrompt: string | null): InputItem[] | undefined;
|
|
5
|
+
export declare const normalizeOrphanedToolOutputs: (input: InputItem[]) => InputItem[];
|
|
6
|
+
//# sourceMappingURL=input-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-utils.d.ts","sourceRoot":"","sources":["../../../../lib/request/helpers/input-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAiBhD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,KAAG,MAWhD,CAAC;AA8BF,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,MAAM,GAAG,IAAI,GACzB,OAAO,CA6BT;AAED,wBAAgB,2CAA2C,CAC1D,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAC9B,YAAY,EAAE,MAAM,GAAG,IAAI,GACzB,SAAS,EAAE,GAAG,SAAS,CAkBzB;AA6DD,eAAO,MAAM,4BAA4B,GACxC,OAAO,SAAS,EAAE,KAChB,SAAS,EAiCX,CAAC"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
const OPENCODE_PROMPT_SIGNATURES = [
|
|
2
|
+
"you are a coding agent running in the opencode",
|
|
3
|
+
"you are opencode, an agent",
|
|
4
|
+
"you are opencode, an interactive cli agent",
|
|
5
|
+
"you are opencode, an interactive cli tool",
|
|
6
|
+
"you are opencode, the best coding agent on the planet",
|
|
7
|
+
].map((signature) => signature.toLowerCase());
|
|
8
|
+
const OPENCODE_CONTEXT_MARKERS = [
|
|
9
|
+
"here is some useful information about the environment you are running in:",
|
|
10
|
+
"<env>",
|
|
11
|
+
"instructions from:",
|
|
12
|
+
"<instructions>",
|
|
13
|
+
].map((marker) => marker.toLowerCase());
|
|
14
|
+
export const getContentText = (item) => {
|
|
15
|
+
if (typeof item.content === "string") {
|
|
16
|
+
return item.content;
|
|
17
|
+
}
|
|
18
|
+
if (Array.isArray(item.content)) {
|
|
19
|
+
return item.content
|
|
20
|
+
.filter((c) => c.type === "input_text" && c.text)
|
|
21
|
+
.map((c) => c.text)
|
|
22
|
+
.join("\n");
|
|
23
|
+
}
|
|
24
|
+
return "";
|
|
25
|
+
};
|
|
26
|
+
const replaceContentText = (item, contentText) => {
|
|
27
|
+
if (typeof item.content === "string") {
|
|
28
|
+
return { ...item, content: contentText };
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(item.content)) {
|
|
31
|
+
return {
|
|
32
|
+
...item,
|
|
33
|
+
content: [{ type: "input_text", text: contentText }],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return { ...item, content: contentText };
|
|
37
|
+
};
|
|
38
|
+
const extractOpenCodeContext = (contentText) => {
|
|
39
|
+
const lower = contentText.toLowerCase();
|
|
40
|
+
let earliestIndex = -1;
|
|
41
|
+
for (const marker of OPENCODE_CONTEXT_MARKERS) {
|
|
42
|
+
const index = lower.indexOf(marker);
|
|
43
|
+
if (index >= 0 && (earliestIndex === -1 || index < earliestIndex)) {
|
|
44
|
+
earliestIndex = index;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if (earliestIndex === -1)
|
|
48
|
+
return null;
|
|
49
|
+
return contentText.slice(earliestIndex).trimStart();
|
|
50
|
+
};
|
|
51
|
+
export function isOpenCodeSystemPrompt(item, cachedPrompt) {
|
|
52
|
+
const isSystemRole = item.role === "developer" || item.role === "system";
|
|
53
|
+
if (!isSystemRole)
|
|
54
|
+
return false;
|
|
55
|
+
const contentText = getContentText(item);
|
|
56
|
+
if (!contentText)
|
|
57
|
+
return false;
|
|
58
|
+
if (cachedPrompt) {
|
|
59
|
+
const contentTrimmed = contentText.trim();
|
|
60
|
+
const cachedTrimmed = cachedPrompt.trim();
|
|
61
|
+
if (contentTrimmed === cachedTrimmed) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (contentTrimmed.startsWith(cachedTrimmed)) {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
const contentPrefix = contentTrimmed.substring(0, 200);
|
|
68
|
+
const cachedPrefix = cachedTrimmed.substring(0, 200);
|
|
69
|
+
if (contentPrefix === cachedPrefix) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const normalized = contentText.trimStart().toLowerCase();
|
|
74
|
+
return OPENCODE_PROMPT_SIGNATURES.some((signature) => normalized.startsWith(signature));
|
|
75
|
+
}
|
|
76
|
+
export function filterOpenCodeSystemPromptsWithCachedPrompt(input, cachedPrompt) {
|
|
77
|
+
if (!Array.isArray(input))
|
|
78
|
+
return input;
|
|
79
|
+
return input.flatMap((item) => {
|
|
80
|
+
if (item.role === "user")
|
|
81
|
+
return [item];
|
|
82
|
+
if (!isOpenCodeSystemPrompt(item, cachedPrompt)) {
|
|
83
|
+
return [item];
|
|
84
|
+
}
|
|
85
|
+
const contentText = getContentText(item);
|
|
86
|
+
const preservedContext = extractOpenCodeContext(contentText);
|
|
87
|
+
if (preservedContext) {
|
|
88
|
+
return [replaceContentText(item, preservedContext)];
|
|
89
|
+
}
|
|
90
|
+
return [];
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
const getCallId = (item) => {
|
|
94
|
+
const rawCallId = item.call_id;
|
|
95
|
+
if (typeof rawCallId !== "string")
|
|
96
|
+
return null;
|
|
97
|
+
const trimmed = rawCallId.trim();
|
|
98
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
99
|
+
};
|
|
100
|
+
const convertOrphanedOutputToMessage = (item, callId) => {
|
|
101
|
+
const toolName = typeof item.name === "string"
|
|
102
|
+
? item.name
|
|
103
|
+
: "tool";
|
|
104
|
+
const labelCallId = callId ?? "unknown";
|
|
105
|
+
let text;
|
|
106
|
+
try {
|
|
107
|
+
const out = item.output;
|
|
108
|
+
text = typeof out === "string" ? out : JSON.stringify(out);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
text = String(item.output ?? "");
|
|
112
|
+
}
|
|
113
|
+
if (text.length > 16000) {
|
|
114
|
+
text = text.slice(0, 16000) + "\n...[truncated]";
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
type: "message",
|
|
118
|
+
role: "assistant",
|
|
119
|
+
content: `[Previous ${toolName} result; call_id=${labelCallId}]: ${text}`,
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
const collectCallIds = (input) => {
|
|
123
|
+
const functionCallIds = new Set();
|
|
124
|
+
const localShellCallIds = new Set();
|
|
125
|
+
const customToolCallIds = new Set();
|
|
126
|
+
for (const item of input) {
|
|
127
|
+
const callId = getCallId(item);
|
|
128
|
+
if (!callId)
|
|
129
|
+
continue;
|
|
130
|
+
switch (item.type) {
|
|
131
|
+
case "function_call":
|
|
132
|
+
functionCallIds.add(callId);
|
|
133
|
+
break;
|
|
134
|
+
case "local_shell_call":
|
|
135
|
+
localShellCallIds.add(callId);
|
|
136
|
+
break;
|
|
137
|
+
case "custom_tool_call":
|
|
138
|
+
customToolCallIds.add(callId);
|
|
139
|
+
break;
|
|
140
|
+
default:
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return { functionCallIds, localShellCallIds, customToolCallIds };
|
|
145
|
+
};
|
|
146
|
+
export const normalizeOrphanedToolOutputs = (input) => {
|
|
147
|
+
const { functionCallIds, localShellCallIds, customToolCallIds } = collectCallIds(input);
|
|
148
|
+
return input.map((item) => {
|
|
149
|
+
if (item.type === "function_call_output") {
|
|
150
|
+
const callId = getCallId(item);
|
|
151
|
+
const hasMatch = !!callId &&
|
|
152
|
+
(functionCallIds.has(callId) || localShellCallIds.has(callId));
|
|
153
|
+
if (!hasMatch) {
|
|
154
|
+
return convertOrphanedOutputToMessage(item, callId);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (item.type === "custom_tool_call_output") {
|
|
158
|
+
const callId = getCallId(item);
|
|
159
|
+
const hasMatch = !!callId && customToolCallIds.has(callId);
|
|
160
|
+
if (!hasMatch) {
|
|
161
|
+
return convertOrphanedOutputToMessage(item, callId);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (item.type === "local_shell_call_output") {
|
|
165
|
+
const callId = getCallId(item);
|
|
166
|
+
const hasMatch = !!callId && localShellCallIds.has(callId);
|
|
167
|
+
if (!hasMatch) {
|
|
168
|
+
return convertOrphanedOutputToMessage(item, callId);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
return item;
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
//# sourceMappingURL=input-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-utils.js","sourceRoot":"","sources":["../../../../lib/request/helpers/input-utils.ts"],"names":[],"mappings":"AAEA,MAAM,0BAA0B,GAAG;IAClC,gDAAgD;IAChD,4BAA4B;IAC5B,4CAA4C;IAC5C,2CAA2C;IAC3C,uDAAuD;CACvD,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC;AAE9C,MAAM,wBAAwB,GAAG;IAChC,2EAA2E;IAC3E,OAAO;IACP,oBAAoB;IACpB,gBAAgB;CAChB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAExC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAe,EAAU,EAAE;IACzD,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC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AAiB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACf,OAAO,8BAA8B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACrD,CAAC;QACF,CAAC;QAED,OAAO,IAAI,CAAC;IACb,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Configuration Map
|
|
3
|
+
*
|
|
4
|
+
* Maps model config IDs to their normalized API model names.
|
|
5
|
+
* Only includes exact config IDs that OpenCode will pass to the plugin.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Map of config model IDs to normalized API model names
|
|
9
|
+
*
|
|
10
|
+
* Key: The model ID as specified in opencode.json config
|
|
11
|
+
* Value: The normalized model name to send to the API
|
|
12
|
+
*/
|
|
13
|
+
export declare const MODEL_MAP: Record<string, string>;
|
|
14
|
+
/**
|
|
15
|
+
* Get normalized model name from config ID
|
|
16
|
+
*
|
|
17
|
+
* @param modelId - Model ID from config (e.g., "gpt-5.1-codex-low")
|
|
18
|
+
* @returns Normalized model name (e.g., "gpt-5.1-codex") or undefined if not found
|
|
19
|
+
*/
|
|
20
|
+
export declare function getNormalizedModel(modelId: string): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a model ID is in the model map
|
|
23
|
+
*
|
|
24
|
+
* @param modelId - Model ID to check
|
|
25
|
+
* @returns True if model is in the map
|
|
26
|
+
*/
|
|
27
|
+
export declare function isKnownModel(modelId: string): boolean;
|
|
28
|
+
//# sourceMappingURL=model-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-map.d.ts","sourceRoot":"","sources":["../../../../lib/request/helpers/model-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAyE5C,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAiBtE;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAErD"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model Configuration Map
|
|
3
|
+
*
|
|
4
|
+
* Maps model config IDs to their normalized API model names.
|
|
5
|
+
* Only includes exact config IDs that OpenCode will pass to the plugin.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Map of config model IDs to normalized API model names
|
|
9
|
+
*
|
|
10
|
+
* Key: The model ID as specified in opencode.json config
|
|
11
|
+
* Value: The normalized model name to send to the API
|
|
12
|
+
*/
|
|
13
|
+
export const MODEL_MAP = {
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// GPT-5.1 Codex Models
|
|
16
|
+
// ============================================================================
|
|
17
|
+
"gpt-5.1-codex": "gpt-5.1-codex",
|
|
18
|
+
"gpt-5.1-codex-low": "gpt-5.1-codex",
|
|
19
|
+
"gpt-5.1-codex-medium": "gpt-5.1-codex",
|
|
20
|
+
"gpt-5.1-codex-high": "gpt-5.1-codex",
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// GPT-5.1 Codex Max Models
|
|
23
|
+
// ============================================================================
|
|
24
|
+
"gpt-5.1-codex-max": "gpt-5.1-codex-max",
|
|
25
|
+
"gpt-5.1-codex-max-low": "gpt-5.1-codex-max",
|
|
26
|
+
"gpt-5.1-codex-max-medium": "gpt-5.1-codex-max",
|
|
27
|
+
"gpt-5.1-codex-max-high": "gpt-5.1-codex-max",
|
|
28
|
+
"gpt-5.1-codex-max-xhigh": "gpt-5.1-codex-max",
|
|
29
|
+
// ============================================================================
|
|
30
|
+
// GPT-5.2 Models (supports none/low/medium/high/xhigh per OpenAI API docs)
|
|
31
|
+
// ============================================================================
|
|
32
|
+
"gpt-5.2": "gpt-5.2",
|
|
33
|
+
"gpt-5.2-none": "gpt-5.2",
|
|
34
|
+
"gpt-5.2-low": "gpt-5.2",
|
|
35
|
+
"gpt-5.2-medium": "gpt-5.2",
|
|
36
|
+
"gpt-5.2-high": "gpt-5.2",
|
|
37
|
+
"gpt-5.2-xhigh": "gpt-5.2",
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// GPT-5.2 Codex Models (low/medium/high/xhigh)
|
|
40
|
+
// ============================================================================
|
|
41
|
+
"gpt-5.2-codex": "gpt-5.2-codex",
|
|
42
|
+
"gpt-5.2-codex-low": "gpt-5.2-codex",
|
|
43
|
+
"gpt-5.2-codex-medium": "gpt-5.2-codex",
|
|
44
|
+
"gpt-5.2-codex-high": "gpt-5.2-codex",
|
|
45
|
+
"gpt-5.2-codex-xhigh": "gpt-5.2-codex",
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// GPT-5.1 Codex Mini Models
|
|
48
|
+
// ============================================================================
|
|
49
|
+
"gpt-5.1-codex-mini": "gpt-5.1-codex-mini",
|
|
50
|
+
"gpt-5.1-codex-mini-medium": "gpt-5.1-codex-mini",
|
|
51
|
+
"gpt-5.1-codex-mini-high": "gpt-5.1-codex-mini",
|
|
52
|
+
// ============================================================================
|
|
53
|
+
// GPT-5.1 General Purpose Models (supports none/low/medium/high per OpenAI API docs)
|
|
54
|
+
// ============================================================================
|
|
55
|
+
"gpt-5.1": "gpt-5.1",
|
|
56
|
+
"gpt-5.1-none": "gpt-5.1",
|
|
57
|
+
"gpt-5.1-low": "gpt-5.1",
|
|
58
|
+
"gpt-5.1-medium": "gpt-5.1",
|
|
59
|
+
"gpt-5.1-high": "gpt-5.1",
|
|
60
|
+
"gpt-5.1-chat-latest": "gpt-5.1",
|
|
61
|
+
// ============================================================================
|
|
62
|
+
// GPT-5 Codex Models (LEGACY - maps to gpt-5.1-codex as gpt-5 is being phased out)
|
|
63
|
+
// ============================================================================
|
|
64
|
+
"gpt-5-codex": "gpt-5.1-codex",
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// GPT-5 Codex Mini Models (LEGACY - maps to gpt-5.1-codex-mini)
|
|
67
|
+
// ============================================================================
|
|
68
|
+
"codex-mini-latest": "gpt-5.1-codex-mini",
|
|
69
|
+
"gpt-5-codex-mini": "gpt-5.1-codex-mini",
|
|
70
|
+
"gpt-5-codex-mini-medium": "gpt-5.1-codex-mini",
|
|
71
|
+
"gpt-5-codex-mini-high": "gpt-5.1-codex-mini",
|
|
72
|
+
// ============================================================================
|
|
73
|
+
// GPT-5 General Purpose Models (LEGACY - maps to gpt-5.1 as gpt-5 is being phased out)
|
|
74
|
+
// ============================================================================
|
|
75
|
+
"gpt-5": "gpt-5.1",
|
|
76
|
+
"gpt-5-mini": "gpt-5.1",
|
|
77
|
+
"gpt-5-nano": "gpt-5.1",
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Get normalized model name from config ID
|
|
81
|
+
*
|
|
82
|
+
* @param modelId - Model ID from config (e.g., "gpt-5.1-codex-low")
|
|
83
|
+
* @returns Normalized model name (e.g., "gpt-5.1-codex") or undefined if not found
|
|
84
|
+
*/
|
|
85
|
+
export function getNormalizedModel(modelId) {
|
|
86
|
+
try {
|
|
87
|
+
// Try direct lookup first
|
|
88
|
+
if (MODEL_MAP[modelId]) {
|
|
89
|
+
return MODEL_MAP[modelId];
|
|
90
|
+
}
|
|
91
|
+
// Try case-insensitive lookup
|
|
92
|
+
const lowerModelId = modelId.toLowerCase();
|
|
93
|
+
const match = Object.keys(MODEL_MAP).find((key) => key.toLowerCase() === lowerModelId);
|
|
94
|
+
return match ? MODEL_MAP[match] : undefined;
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return undefined;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if a model ID is in the model map
|
|
102
|
+
*
|
|
103
|
+
* @param modelId - Model ID to check
|
|
104
|
+
* @returns True if model is in the map
|
|
105
|
+
*/
|
|
106
|
+
export function isKnownModel(modelId) {
|
|
107
|
+
return getNormalizedModel(modelId) !== undefined;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=model-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-map.js","sourceRoot":"","sources":["../../../../lib/request/helpers/model-map.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAA2B;IACjD,+EAA+E;IAC/E,uBAAuB;IACvB,+EAA+E;IAC9E,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,eAAe;IACpC,sBAAsB,EAAE,eAAe;IACvC,oBAAoB,EAAE,eAAe;IAErC,+EAA+E;IAC/E,2BAA2B;IAC3B,+EAA+E;IAC/E,mBAAmB,EAAE,mBAAmB;IACxC,uBAAuB,EAAE,mBAAmB;IAC5C,0BAA0B,EAAE,mBAAmB;IAC/C,wBAAwB,EAAE,mBAAmB;IAC7C,yBAAyB,EAAE,mBAAmB;IAE9C,+EAA+E;IAC/E,2EAA2E;IAC3E,+EAA+E;IAC/E,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,SAAS;IACzB,aAAa,EAAE,SAAS;IACxB,gBAAgB,EAAE,SAAS;IAC3B,cAAc,EAAE,SAAS;IACzB,eAAe,EAAE,SAAS;IAE1B,+EAA+E;IAC/E,+CAA+C;IAC/C,+EAA+E;IAC/E,eAAe,EAAE,eAAe;IAChC,mBAAmB,EAAE,eAAe;IACpC,sBAAsB,EAAE,eAAe;IACvC,oBAAoB,EAAE,eAAe;IACrC,qBAAqB,EAAE,eAAe;IAEtC,+EAA+E;IAC/E,4BAA4B;IAC5B,+EAA+E;IAC/E,oBAAoB,EAAE,oBAAoB;IAC1C,2BAA2B,EAAE,oBAAoB;IACjD,yBAAyB,EAAE,oBAAoB;IAE/C,+EAA+E;IAC/E,qFAAqF;IACrF,+EAA+E;IAC/E,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,SAAS;IACzB,a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