@bitkyc08/opencodex 2.100.6 → 2.100.7
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/gui/dist/assets/App-BfoDjNBU.js +65 -0
- package/gui/dist/assets/App-hklyKJR5.css +1 -0
- package/gui/dist/assets/{Tray-CVqm4S4W.js → Tray-BN6pxM_V.js} +1 -1
- package/gui/dist/assets/brand-mark-CDZQ-wa9.js +1 -0
- package/gui/dist/assets/index-B85uU8rK.css +2 -0
- package/gui/dist/assets/index-Bt9ze3XN.js +138 -0
- package/gui/dist/assets/{segment-thumb-features-COdzmORE.js → segment-thumb-features-BM5n8NMX.js} +1 -1
- package/gui/dist/classic/assets/App-D4cjNg2I.js +64 -0
- package/gui/dist/classic/assets/App-DSivR528.css +1 -0
- package/gui/dist/classic/assets/{Tray-BDlcOLDK.js → Tray-DTgGR7wt.js} +1 -1
- package/gui/dist/classic/assets/index-ALDeKRg9.js +138 -0
- package/gui/dist/classic/assets/usage-companion-chart-BC-Nos9Q.js +1 -0
- package/gui/dist/classic/index.html +1 -1
- package/gui/dist/index.html +2 -2
- package/package.json +2 -2
- package/src/adapters/coding-agent/process-tree.ts +30 -0
- package/src/adapters/coding-agent/profile.ts +1 -1
- package/src/adapters/coding-agent/turn.ts +2 -9
- package/src/adapters/command-code-decision-guard.ts +25 -0
- package/src/adapters/cursor/catalog.ts +14 -0
- package/src/adapters/cursor/effort-map.ts +3 -0
- package/src/adapters/google-usage.ts +28 -0
- package/src/adapters/google.ts +9 -26
- package/src/adapters/qoder/adapter.ts +197 -13
- package/src/adapters/registry.ts +13 -0
- package/src/adapters/step-cli/adapter.ts +401 -0
- package/src/adapters/step-cli/constants.ts +11 -0
- package/src/adapters/step-cli/conversation.ts +159 -0
- package/src/adapters/step-cli/env.ts +49 -0
- package/src/adapters/step-cli/errors.ts +76 -0
- package/src/adapters/step-cli/events.ts +227 -0
- package/src/adapters/step-cli/profiles.ts +134 -0
- package/src/adapters/step-cli/projection.ts +242 -0
- package/src/adapters/step-cli/registry.ts +181 -0
- package/src/adapters/step-cli/session-pool.ts +225 -0
- package/src/adapters/step-cli/session.ts +842 -0
- package/src/adapters/step-cli/stdio-frames.ts +330 -0
- package/src/adapters/step-cli/tool-bridge.ts +92 -0
- package/src/cli/claude.ts +5 -2
- package/src/client/link-management-relay.ts +11 -0
- package/src/client/machine-listener.ts +6 -2
- package/src/codex/account-label.ts +1 -1
- package/src/codex/catalog/gather-capture.ts +2 -1
- package/src/codex/catalog/metadata.ts +48 -2
- package/src/codex/catalog/model-hints.ts +19 -5
- package/src/codex/catalog/model-visibility.ts +4 -7
- package/src/codex/catalog/native-ultrafast.ts +8 -6
- package/src/generated/compatibility-version.json +137 -61
- package/src/generated/model-metadata.ts +1 -1
- package/src/lib/client-error-body.ts +2 -0
- package/src/lib/messages-error-body.ts +3 -1
- package/src/lib/optional-shutdown-hooks.ts +55 -5
- package/src/lib/process-control.ts +3 -2
- package/src/lib/shutdown-budget.ts +5 -0
- package/src/link/remote-platform.ts +24 -9
- package/src/link/ssh-argv.ts +8 -2
- package/src/link/ssh-runner.ts +15 -2
- package/src/oauth/m365-copilot-web-session.ts +28 -4
- package/src/protocols/dto.ts +24 -12
- package/src/protocols/settings.ts +20 -16
- package/src/protocols/shadow.ts +2 -3
- package/src/protocols/trace.ts +24 -2
- package/src/providers/command-code-decision-models.ts +65 -0
- package/src/providers/quota.ts +4 -4
- package/src/providers/registry/entries-core.ts +18 -7
- package/src/providers/registry/entries-extended.ts +41 -0
- package/src/providers/registry/model-seeds.ts +42 -0
- package/src/providers/resolved-model-policy-merge.ts +8 -0
- package/src/providers/resolved-model-policy.ts +185 -165
- package/src/providers/slug-codec.ts +5 -0
- package/src/server/chat-native-eligibility.ts +5 -0
- package/src/server/credential-recovery-attempt.ts +2 -2
- package/src/server/gemini-inbound.ts +15 -11
- package/src/server/gemini-native-catalog.ts +27 -2
- package/src/server/gemini-native-wire.ts +71 -6
- package/src/server/gemini-native.ts +129 -34
- package/src/server/index/gemini-routes.ts +6 -1
- package/src/server/lifecycle.ts +2 -1
- package/src/server/management/agent-settings-routes.ts +26 -28
- package/src/server/management/api-access.ts +5 -3
- package/src/server/management/protocol-routes.ts +3 -1
- package/src/server/management/protocol-settings-patch.ts +25 -10
- package/src/server/management/shared.ts +20 -5
- package/src/server/messages-native-eligibility.ts +4 -0
- package/src/server/messages-native-tool-guard.ts +18 -5
- package/src/server/request-log-generation-window.ts +7 -2
- package/src/server/responses/command-code-decision-refusal.ts +24 -0
- package/src/server/responses/compact.ts +2 -2
- package/src/server/responses/core-combo.ts +18 -3
- package/src/server/responses/core-pipeline.ts +6 -0
- package/src/server/responses/sidecar-execution.ts +10 -7
- package/src/types/config.ts +2 -0
- package/src/usage/expected-prices.ts +17 -0
- package/src/usage/telemetry-contract.ts +3 -0
- package/gui/dist/assets/App-BI8LQ7Qk.css +0 -1
- package/gui/dist/assets/App-CsZ1Gr7S.js +0 -60
- package/gui/dist/assets/brand-mark-BebhnAtV.js +0 -1
- package/gui/dist/assets/index-BtwVlpeQ.css +0 -2
- package/gui/dist/assets/index-CEeMegqE.js +0 -138
- package/gui/dist/classic/assets/App-BJgUWNJ8.js +0 -59
- package/gui/dist/classic/assets/App-CoiVLRW3.css +0 -1
- package/gui/dist/classic/assets/index-B9Jgli_W.js +0 -138
- package/gui/dist/classic/assets/usage-companion-chart-vbzDcND0.js +0 -1
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire codec for the Step Agent SDK stdio protocol (`step --sdk-stdio`).
|
|
3
|
+
*
|
|
4
|
+
* The transport is deliberately separated from the session so both halves stay testable without a
|
|
5
|
+
* process: this module owns framing and envelope validation, `session.ts` owns the process, request
|
|
6
|
+
* correlation and reverse-request dispatch.
|
|
7
|
+
*
|
|
8
|
+
* Framing is a 4-byte big-endian length prefix followed by UTF-8 JSON. This is NOT the same protocol
|
|
9
|
+
* as `step --mode rpc`, which is newline-delimited JSONL — mixing the two is the single easiest way
|
|
10
|
+
* to build a host that writes frames nobody answers.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const STEP_PROTOCOL_NAME = "step-agent-sdk" as const;
|
|
14
|
+
export const STEP_PROTOCOL_VERSION = 1 as const;
|
|
15
|
+
export const STEP_MAX_FRAME_BYTES = 8 * 1024 * 1024;
|
|
16
|
+
export const STEP_LENGTH_PREFIX_BYTES = 4;
|
|
17
|
+
|
|
18
|
+
/** The runtime rejects a length prefix below this; a smaller value can never carry `{}`. */
|
|
19
|
+
const STEP_MIN_FRAME_BYTES = 2;
|
|
20
|
+
|
|
21
|
+
export type StepFrameKind = "request" | "response" | "event";
|
|
22
|
+
|
|
23
|
+
export interface StepProtocolErrorPayload {
|
|
24
|
+
readonly code: string;
|
|
25
|
+
readonly message: string;
|
|
26
|
+
readonly retryable?: boolean;
|
|
27
|
+
readonly details?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface StepFrame {
|
|
31
|
+
readonly protocol: typeof STEP_PROTOCOL_NAME;
|
|
32
|
+
readonly version: number;
|
|
33
|
+
readonly kind: StepFrameKind;
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly method?: string;
|
|
36
|
+
readonly replyTo?: string;
|
|
37
|
+
readonly sessionId?: string;
|
|
38
|
+
readonly turnId?: string;
|
|
39
|
+
readonly sequence?: number;
|
|
40
|
+
readonly payload?: unknown;
|
|
41
|
+
readonly error?: StepProtocolErrorPayload;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type StepProtocolViolationCode =
|
|
45
|
+
| "PROTOCOL_VIOLATION"
|
|
46
|
+
| "FRAME_TOO_LARGE"
|
|
47
|
+
| "FRAME_TOO_SMALL"
|
|
48
|
+
| "INCOMPLETE_FRAME"
|
|
49
|
+
| "INVALID_UTF8"
|
|
50
|
+
| "INVALID_JSON";
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* A framing or envelope failure the host must surface rather than swallow.
|
|
54
|
+
*
|
|
55
|
+
* The Step runtime answers a malformed frame with nothing at all, so a peer that keeps writing
|
|
56
|
+
* after a decode failure waits forever. Callers turn this into a terminal error and tear the session
|
|
57
|
+
* down instead of retrying into silence.
|
|
58
|
+
*/
|
|
59
|
+
export class StepProtocolViolation extends Error {
|
|
60
|
+
readonly code: StepProtocolViolationCode;
|
|
61
|
+
|
|
62
|
+
constructor(message: string, code: StepProtocolViolationCode = "PROTOCOL_VIOLATION") {
|
|
63
|
+
super(message);
|
|
64
|
+
this.name = "StepProtocolViolation";
|
|
65
|
+
this.code = code;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const FRAME_KINDS: ReadonlySet<string> = new Set(["request", "response", "event"]);
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Runtime envelope guard.
|
|
73
|
+
*
|
|
74
|
+
* Unknown protocol versions pass deliberately: the runtime negotiates `initialize.protocolRange`,
|
|
75
|
+
* so a newer peer has to be able to offer a range before this host learns what it speaks.
|
|
76
|
+
*/
|
|
77
|
+
export function isStepFrame(value: unknown): value is StepFrame {
|
|
78
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
79
|
+
const frame = value as Record<string, unknown>;
|
|
80
|
+
if (
|
|
81
|
+
frame.protocol !== STEP_PROTOCOL_NAME ||
|
|
82
|
+
typeof frame.version !== "number" ||
|
|
83
|
+
!Number.isSafeInteger(frame.version) ||
|
|
84
|
+
frame.version < 1 ||
|
|
85
|
+
typeof frame.kind !== "string" ||
|
|
86
|
+
!FRAME_KINDS.has(frame.kind) ||
|
|
87
|
+
typeof frame.id !== "string" ||
|
|
88
|
+
frame.id.length === 0
|
|
89
|
+
) {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
if (frame.kind === "request" || frame.kind === "event") {
|
|
93
|
+
if (typeof frame.method !== "string" || frame.method.trim().length === 0) return false;
|
|
94
|
+
return (
|
|
95
|
+
frame.kind === "request" ||
|
|
96
|
+
(typeof frame.sequence === "number" &&
|
|
97
|
+
Number.isSafeInteger(frame.sequence) &&
|
|
98
|
+
frame.sequence >= 0)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
if (typeof frame.replyTo !== "string" || frame.replyTo.trim().length === 0) return false;
|
|
102
|
+
if (frame.payload !== undefined && frame.error !== undefined) return false;
|
|
103
|
+
return frame.error === undefined || isStepProtocolErrorPayload(frame.error);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isStepProtocolErrorPayload(value: unknown): value is StepProtocolErrorPayload {
|
|
107
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
108
|
+
const error = value as Record<string, unknown>;
|
|
109
|
+
return typeof error.code === "string" && typeof error.message === "string";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function assertMaxFrameBytes(value: number): void {
|
|
113
|
+
if (!Number.isSafeInteger(value) || value < 1 || value > STEP_MAX_FRAME_BYTES) {
|
|
114
|
+
throw new StepProtocolViolation("maxFrameBytes must be a positive bounded integer");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function assertEnvelope(frame: StepFrame): void {
|
|
119
|
+
// The ambiguous-response case is checked first so it keeps its own diagnostic: the generic guard
|
|
120
|
+
// below rejects it too, and reporting only that would send a caller looking for a malformed
|
|
121
|
+
// envelope instead of the contract violation they actually wrote.
|
|
122
|
+
if (frame.kind === "response" && frame.payload !== undefined && frame.error !== undefined) {
|
|
123
|
+
throw new StepProtocolViolation("response frame cannot contain both payload and error");
|
|
124
|
+
}
|
|
125
|
+
if (!isStepFrame(frame)) {
|
|
126
|
+
throw new StepProtocolViolation("frame is not a valid Step protocol envelope");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Encode one frame as a 4-byte big-endian length prefix followed by UTF-8 JSON. */
|
|
131
|
+
export function encodeStepFrame(frame: StepFrame, maxFrameBytes = STEP_MAX_FRAME_BYTES): Buffer {
|
|
132
|
+
assertMaxFrameBytes(maxFrameBytes);
|
|
133
|
+
assertEnvelope(frame);
|
|
134
|
+
|
|
135
|
+
let json: string;
|
|
136
|
+
try {
|
|
137
|
+
json = JSON.stringify(frame);
|
|
138
|
+
} catch (error) {
|
|
139
|
+
throw new StepProtocolViolation(
|
|
140
|
+
`frame payload could not be serialized: ${error instanceof Error ? error.message : String(error)}`,
|
|
141
|
+
"INVALID_JSON",
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
const payload = Buffer.from(json, "utf8");
|
|
145
|
+
if (payload.byteLength > maxFrameBytes) {
|
|
146
|
+
throw new StepProtocolViolation(
|
|
147
|
+
`outgoing frame exceeds max frame size (${payload.byteLength} > ${maxFrameBytes} bytes)`,
|
|
148
|
+
"FRAME_TOO_LARGE",
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
const result = Buffer.allocUnsafe(STEP_LENGTH_PREFIX_BYTES + payload.byteLength);
|
|
152
|
+
result.writeUInt32BE(payload.byteLength, 0);
|
|
153
|
+
payload.copy(result, STEP_LENGTH_PREFIX_BYTES);
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Incremental decoder for the peer side of the same protocol.
|
|
159
|
+
*
|
|
160
|
+
* Copies only the frame currently being assembled, so a caller may reuse or mutate the chunk it
|
|
161
|
+
* passed in once `push` returns. A length prefix that cannot be trusted throws immediately instead of
|
|
162
|
+
* allocating from an arbitrary 32-bit number.
|
|
163
|
+
*/
|
|
164
|
+
export class StepFrameDecoder {
|
|
165
|
+
readonly #maxFrameBytes: number;
|
|
166
|
+
readonly #prefix = Buffer.alloc(STEP_LENGTH_PREFIX_BYTES);
|
|
167
|
+
#prefixBytes = 0;
|
|
168
|
+
#payload: Buffer | undefined;
|
|
169
|
+
#payloadBytes = 0;
|
|
170
|
+
#expectedPayloadBytes: number | undefined;
|
|
171
|
+
#closed = false;
|
|
172
|
+
|
|
173
|
+
constructor(options?: { readonly maxFrameBytes?: number } | number) {
|
|
174
|
+
const maxFrameBytes = typeof options === "number" ? options : options?.maxFrameBytes;
|
|
175
|
+
assertMaxFrameBytes(maxFrameBytes ?? STEP_MAX_FRAME_BYTES);
|
|
176
|
+
this.#maxFrameBytes = maxFrameBytes ?? STEP_MAX_FRAME_BYTES;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
get hasPendingInput(): boolean {
|
|
180
|
+
return this.#prefixBytes > 0 || this.#expectedPayloadBytes !== undefined;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
get closed(): boolean {
|
|
184
|
+
return this.#closed;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
push(chunk: Uint8Array): StepFrame[] {
|
|
188
|
+
if (this.#closed) throw new StepProtocolViolation("frame decoder is closed");
|
|
189
|
+
if (!(chunk instanceof Uint8Array)) {
|
|
190
|
+
throw new StepProtocolViolation("frame decoder input must be a Uint8Array");
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const frames: StepFrame[] = [];
|
|
194
|
+
let offset = 0;
|
|
195
|
+
while (offset < chunk.byteLength) {
|
|
196
|
+
if (this.#expectedPayloadBytes === undefined) {
|
|
197
|
+
while (this.#prefixBytes < STEP_LENGTH_PREFIX_BYTES && offset < chunk.byteLength) {
|
|
198
|
+
this.#prefix[this.#prefixBytes] = chunk[offset];
|
|
199
|
+
this.#prefixBytes += 1;
|
|
200
|
+
offset += 1;
|
|
201
|
+
}
|
|
202
|
+
if (this.#prefixBytes < STEP_LENGTH_PREFIX_BYTES) break;
|
|
203
|
+
|
|
204
|
+
const length = this.#prefix.readUInt32BE(0);
|
|
205
|
+
if (length < STEP_MIN_FRAME_BYTES) {
|
|
206
|
+
this.#resetCurrentFrame();
|
|
207
|
+
// Its own message and code: reporting an undersized prefix as "exceeds max frame size" sends
|
|
208
|
+
// the operator looking at the ceiling when the real fault is a truncated or unframed stream.
|
|
209
|
+
throw new StepProtocolViolation(
|
|
210
|
+
`incoming frame is shorter than the smallest encodable frame (${length} < ${STEP_MIN_FRAME_BYTES} bytes)`,
|
|
211
|
+
"FRAME_TOO_SMALL",
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
if (length > this.#maxFrameBytes) {
|
|
215
|
+
this.#resetCurrentFrame();
|
|
216
|
+
throw new StepProtocolViolation(
|
|
217
|
+
`incoming frame exceeds max frame size (${length} > ${this.#maxFrameBytes} bytes)`,
|
|
218
|
+
"FRAME_TOO_LARGE",
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
this.#expectedPayloadBytes = length;
|
|
222
|
+
this.#payload = Buffer.allocUnsafe(length);
|
|
223
|
+
this.#payloadBytes = 0;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
const remainingInput = chunk.byteLength - offset;
|
|
227
|
+
const remainingPayload = this.#expectedPayloadBytes - this.#payloadBytes;
|
|
228
|
+
const copied = Math.min(remainingInput, remainingPayload);
|
|
229
|
+
this.#payload!.set(chunk.subarray(offset, offset + copied), this.#payloadBytes);
|
|
230
|
+
this.#payloadBytes += copied;
|
|
231
|
+
offset += copied;
|
|
232
|
+
if (this.#payloadBytes < this.#expectedPayloadBytes) break;
|
|
233
|
+
|
|
234
|
+
const payload = this.#payload!;
|
|
235
|
+
this.#resetCurrentFrame();
|
|
236
|
+
frames.push(this.#decode(payload));
|
|
237
|
+
}
|
|
238
|
+
return frames;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/** Signal EOF. A trailing prefix or half-read payload is a protocol violation. */
|
|
242
|
+
end(): void {
|
|
243
|
+
if (this.#closed) return;
|
|
244
|
+
if (this.hasPendingInput) {
|
|
245
|
+
const pending = this.#prefixBytes + this.#payloadBytes;
|
|
246
|
+
this.#resetCurrentFrame();
|
|
247
|
+
this.#closed = true;
|
|
248
|
+
throw new StepProtocolViolation(
|
|
249
|
+
`stream ended with ${pending} trailing bytes of a partial frame`,
|
|
250
|
+
"INCOMPLETE_FRAME",
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
this.#closed = true;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
#decode(payload: Buffer): StepFrame {
|
|
257
|
+
let text: string;
|
|
258
|
+
try {
|
|
259
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(payload);
|
|
260
|
+
} catch (error) {
|
|
261
|
+
throw new StepProtocolViolation(
|
|
262
|
+
`frame payload is not valid UTF-8: ${error instanceof Error ? error.message : String(error)}`,
|
|
263
|
+
"INVALID_UTF8",
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
let parsed: unknown;
|
|
268
|
+
try {
|
|
269
|
+
parsed = JSON.parse(text);
|
|
270
|
+
} catch (error) {
|
|
271
|
+
throw new StepProtocolViolation(
|
|
272
|
+
`frame payload is not valid JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
273
|
+
"INVALID_JSON",
|
|
274
|
+
);
|
|
275
|
+
}
|
|
276
|
+
if (!isStepFrame(parsed)) {
|
|
277
|
+
throw new StepProtocolViolation("frame payload is not a valid protocol envelope");
|
|
278
|
+
}
|
|
279
|
+
return parsed;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
#resetCurrentFrame(): void {
|
|
283
|
+
this.#prefixBytes = 0;
|
|
284
|
+
this.#payload = undefined;
|
|
285
|
+
this.#payloadBytes = 0;
|
|
286
|
+
this.#expectedPayloadBytes = undefined;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/** Build a `request` envelope for a peer-initiated call. */
|
|
291
|
+
export function stepRequest(id: string, method: string, payload?: unknown): StepFrame {
|
|
292
|
+
return {
|
|
293
|
+
protocol: STEP_PROTOCOL_NAME,
|
|
294
|
+
version: STEP_PROTOCOL_VERSION,
|
|
295
|
+
kind: "request",
|
|
296
|
+
id,
|
|
297
|
+
method,
|
|
298
|
+
...(payload === undefined ? {} : { payload }),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** Build a `response` envelope answering the frame with `replyTo`. */
|
|
303
|
+
export function stepResponse(replyTo: string, payload?: unknown, id?: string): StepFrame {
|
|
304
|
+
return {
|
|
305
|
+
protocol: STEP_PROTOCOL_NAME,
|
|
306
|
+
version: STEP_PROTOCOL_VERSION,
|
|
307
|
+
kind: "response",
|
|
308
|
+
id: id ?? `r_${replyTo}`,
|
|
309
|
+
replyTo,
|
|
310
|
+
...(payload === undefined ? {} : { payload }),
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/** Build a `response` envelope carrying a protocol error instead of a payload. */
|
|
315
|
+
export function stepErrorResponse(
|
|
316
|
+
replyTo: string,
|
|
317
|
+
code: string,
|
|
318
|
+
message: string,
|
|
319
|
+
retryable = false,
|
|
320
|
+
id?: string,
|
|
321
|
+
): StepFrame {
|
|
322
|
+
return {
|
|
323
|
+
protocol: STEP_PROTOCOL_NAME,
|
|
324
|
+
version: STEP_PROTOCOL_VERSION,
|
|
325
|
+
kind: "response",
|
|
326
|
+
id: id ?? `r_${replyTo}`,
|
|
327
|
+
replyTo,
|
|
328
|
+
error: { code, message, retryable },
|
|
329
|
+
};
|
|
330
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { buildCodingAgentToolCatalog, CodingAgentToolCatalogError } from "../coding-agent/tool-catalog";
|
|
2
|
+
import type { OcxParsedRequest } from "../../types";
|
|
3
|
+
import { STEP_CLI_TOOL_SERVER } from "./constants";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Namespace StepCode registers this proxy's tools under.
|
|
7
|
+
*
|
|
8
|
+
* Re-exported from `constants.ts` so the emitted wire names, the model-id projection and the tool
|
|
9
|
+
* bridge can never disagree about the prefix: two copies of "ocx" that drift apart would silently
|
|
10
|
+
* turn every captured call into an unresolvable name.
|
|
11
|
+
*/
|
|
12
|
+
export { STEP_CLI_TOOL_SERVER };
|
|
13
|
+
|
|
14
|
+
/** One declared SDK tool, exactly the descriptor shape `query.start.options.sdkTools` accepts. */
|
|
15
|
+
export interface StepSdkToolDescriptor {
|
|
16
|
+
readonly serverName: string;
|
|
17
|
+
readonly toolName: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly inputSchema: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A tool call the client owns, recovered from a `${serverName}__${toolName}` wire name. */
|
|
23
|
+
export interface StepCapturedToolCall {
|
|
24
|
+
/** Name the client originally declared, without the StepCode namespace prefix. */
|
|
25
|
+
readonly wireName: string;
|
|
26
|
+
/** Call id the client uses when it reports the result on the next request. */
|
|
27
|
+
readonly callId: string;
|
|
28
|
+
readonly input: Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class StepToolCatalogError extends Error {
|
|
32
|
+
constructor(message: string) {
|
|
33
|
+
super(message);
|
|
34
|
+
this.name = "StepToolCatalogError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Project the client's tool catalog into StepCode's `sdkTools` option.
|
|
40
|
+
*
|
|
41
|
+
* The client's tool schemas travel inline, which is the whole reason this family needs no capture
|
|
42
|
+
* MCP server: StepCode registers each descriptor as a real tool on the session and calls the peer
|
|
43
|
+
* back over stdio. Limits, name validation and tool_choice filtering are reused from the shared
|
|
44
|
+
* coding-agent catalog builder so a route cannot accept a catalog the sibling CLI routes reject.
|
|
45
|
+
*/
|
|
46
|
+
export function buildStepSdkTools(
|
|
47
|
+
parsed: OcxParsedRequest,
|
|
48
|
+
serverName: string = STEP_CLI_TOOL_SERVER,
|
|
49
|
+
): {
|
|
50
|
+
sdkTools: StepSdkToolDescriptor[];
|
|
51
|
+
/** `${serverName}__${toolName}` → the client's own tool name. */
|
|
52
|
+
emittedNameMap: Map<string, string>;
|
|
53
|
+
requireToolCall: boolean;
|
|
54
|
+
} {
|
|
55
|
+
let catalog: ReturnType<typeof buildCodingAgentToolCatalog>;
|
|
56
|
+
try {
|
|
57
|
+
catalog = buildCodingAgentToolCatalog(parsed, serverName);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if (!(error instanceof CodingAgentToolCatalogError)) throw error;
|
|
60
|
+
throw new StepToolCatalogError(error.message);
|
|
61
|
+
}
|
|
62
|
+
const emittedNameMap = new Map<string, string>();
|
|
63
|
+
const sdkTools = catalog.tools.map(tool => {
|
|
64
|
+
const emittedName = `${serverName}__${tool.name}`;
|
|
65
|
+
emittedNameMap.set(emittedName, tool.name);
|
|
66
|
+
return {
|
|
67
|
+
serverName,
|
|
68
|
+
toolName: tool.name,
|
|
69
|
+
description: tool.description,
|
|
70
|
+
inputSchema: tool.inputSchema,
|
|
71
|
+
} satisfies StepSdkToolDescriptor;
|
|
72
|
+
});
|
|
73
|
+
return { sdkTools, emittedNameMap, requireToolCall: catalog.requireToolCall };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Recover the client's tool name from a StepCode tool name.
|
|
78
|
+
*
|
|
79
|
+
* Returns undefined for anything this proxy did not declare — a StepCode built-in, a host MCP tool,
|
|
80
|
+
* or a malformed name. Callers must fail closed on undefined rather than forward the call, because a
|
|
81
|
+
* name that round-trips to nothing is a call the client can never satisfy.
|
|
82
|
+
*/
|
|
83
|
+
export function resolveStepToolName(
|
|
84
|
+
emittedName: string,
|
|
85
|
+
emittedNameMap: ReadonlyMap<string, string>,
|
|
86
|
+
): string | undefined {
|
|
87
|
+
const direct = emittedNameMap.get(emittedName);
|
|
88
|
+
if (direct) return direct;
|
|
89
|
+
const separator = emittedName.indexOf("__");
|
|
90
|
+
if (separator <= 0) return undefined;
|
|
91
|
+
return emittedNameMap.get(emittedName.slice(separator + 2));
|
|
92
|
+
}
|
package/src/cli/claude.ts
CHANGED
|
@@ -476,8 +476,11 @@ export async function fetchClaudeCodeState(config: OcxConfig, port: number, time
|
|
|
476
476
|
...(Array.isArray(body.forceAvailable) ? { forceAvailable: body.forceAvailable.filter(value => typeof value === "string") } : {}),
|
|
477
477
|
...(typeof body.enabled === "boolean" ? { enabled: body.enabled } : {}),
|
|
478
478
|
};
|
|
479
|
-
} catch {
|
|
480
|
-
|
|
479
|
+
} catch (error) {
|
|
480
|
+
const message = error instanceof Error && error.name === "TimeoutError"
|
|
481
|
+
? `Timed out after ${timeoutMs} ms while loading model context information`
|
|
482
|
+
: "Could not load model context information";
|
|
483
|
+
console.error(`⚠ ${message}. Automatic [1m] marking is skipped for this launch.`);
|
|
481
484
|
return { contextWindows: {} };
|
|
482
485
|
}
|
|
483
486
|
}
|
|
@@ -22,6 +22,17 @@ import {
|
|
|
22
22
|
|
|
23
23
|
export const LINK_CHILD_READ_ONLY = "link_child_read_only";
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* The one Home read a Child's local admin token may make through this relay (#8999): GOAT's passive
|
|
27
|
+
* `ocx.quota-pool/1` read. `pathname` is the parsed request path after the relay prefix, the same value
|
|
28
|
+
* the relay forwards, so a percent-encoded, doubled or case-varied spelling never matches. Everything
|
|
29
|
+
* else under the prefix stays a dashboard-session read, and the query still passes
|
|
30
|
+
* `linkManagementReadAllowed` in {@link relayLinkManagementRead}.
|
|
31
|
+
*/
|
|
32
|
+
export function linkChildAdminReadAllowed(method: string, pathname: string): boolean {
|
|
33
|
+
return (method === "GET" || method === "HEAD") && pathname === "/api/quota-pool";
|
|
34
|
+
}
|
|
35
|
+
|
|
25
36
|
export function linkChildRefusalResponse(homePhrase: string, linkId: string, operation: string): Response {
|
|
26
37
|
return Response.json({
|
|
27
38
|
error: linkChildManagementRefusal(homePhrase, linkId, operation),
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
} from "../lib/system-restart-contract";
|
|
47
47
|
import { linkRouteAllowed } from "../link/routes";
|
|
48
48
|
import { linkHomeName, linkHomePhrase } from "./link-home";
|
|
49
|
-
import { relayLinkManagementRead } from "./link-management-relay";
|
|
49
|
+
import { linkChildAdminReadAllowed, relayLinkManagementRead } from "./link-management-relay";
|
|
50
50
|
import type { ClientRestartAdmission } from "./runtime-restart";
|
|
51
51
|
import { clientRestartRollbackAction } from "./runtime-restart";
|
|
52
52
|
import { isLinkConnectionGeneration } from "../link/relay-auth";
|
|
@@ -275,7 +275,11 @@ export function startMachineListener(
|
|
|
275
275
|
}
|
|
276
276
|
const authError = requireManagementAuth(req, managementAuth, config);
|
|
277
277
|
if (authError) return authError;
|
|
278
|
-
|
|
278
|
+
// The dashboard session reads the whole relay table; the local admin token reads only the
|
|
279
|
+
// passive quota pool (#8999), which GOAT polls on every Child.
|
|
280
|
+
const principal = managementPrincipal(req, managementAuth, config);
|
|
281
|
+
if (principal !== "gui-session"
|
|
282
|
+
&& !(principal === "admin-token" && linkChildAdminReadAllowed(req.method, url.pathname.slice(prefix.length)))) {
|
|
279
283
|
return Response.json({ error: "opencodex machine GUI session required" }, { status: 401 });
|
|
280
284
|
}
|
|
281
285
|
const response = await relayLinkManagementRead(req, suffix, linkIngress, linkHomePhrase(connection, sidecarOrNull));
|
|
@@ -23,7 +23,7 @@ export const CODEX_ACCOUNT_LOG_LABEL_RE = /^p[a-f0-9]{6}$/;
|
|
|
23
23
|
*/
|
|
24
24
|
export const OAUTH_ACCOUNT_LOG_LABEL_RE = /^o[a-f0-9]{6}$/;
|
|
25
25
|
export const KEY_ACCOUNT_LOG_LABEL_RE = /^k[a-f0-9]{32}$/;
|
|
26
|
-
export
|
|
26
|
+
export { ACCOUNT_LOG_LABEL_RE } from "../usage/telemetry-contract";
|
|
27
27
|
|
|
28
28
|
/** Digest the request-owned configured selection, never serialize its key/reference. */
|
|
29
29
|
export function apiKeyAccountLogLabel(provider: string, selection: ProviderApiKeySelection | undefined): `k${string}` | undefined {
|
|
@@ -40,7 +40,7 @@ import { CODEX_REASONING_LEVELS, codexEffortRank, configuredReasoningEfforts, mo
|
|
|
40
40
|
import { isModelVisionSidecarConsumer } from "../../vision/eligibility";
|
|
41
41
|
import { getModelMetadata, getModelMetadataCaseInsensitive, listModelMetadata, resolveMetadataProvider, type ModelMetadata } from "../../generated/model-metadata";
|
|
42
42
|
import { enrichProviderFromRegistry, shouldCaseFoldMetadataModelId } from "../../providers/derive";
|
|
43
|
-
import { applyRegistryCapabilitySeedFill } from "./model-hints";
|
|
43
|
+
import { applyRegistryCapabilitySeedFill, captureCatalogModelPolicy } from "./model-hints";
|
|
44
44
|
import {
|
|
45
45
|
captureFastPolicyAuthority,
|
|
46
46
|
fastPolicyForModel,
|
|
@@ -392,6 +392,7 @@ export function captureProviderGather(
|
|
|
392
392
|
// explicit {}. enrichProviderFromRegistry already preserves/fills that contract; replacing it
|
|
393
393
|
// with the resolver's per-key registry fill would turn "no configured default" into a seed default.
|
|
394
394
|
const provider = recursivelyFreeze(enriched);
|
|
395
|
+
captureCatalogModelPolicy(name, provider);
|
|
395
396
|
const fastPolicyAuthority = captureFastPolicyAuthority(
|
|
396
397
|
name,
|
|
397
398
|
provider,
|
|
@@ -62,6 +62,7 @@ import {
|
|
|
62
62
|
SUPPORTED_NATIVE_OPENAI_SLUGS,
|
|
63
63
|
RETIRED_NATIVE_OPENAI_MODELS,
|
|
64
64
|
configuredNativeOpenAiModels,
|
|
65
|
+
configuredNativeOpenAiDisplayName,
|
|
65
66
|
discoveredNativeOpenAiModels,
|
|
66
67
|
discoveredNativeOpenAiRow,
|
|
67
68
|
hasNativeOpenAiCapabilityMetadata,
|
|
@@ -614,6 +615,13 @@ function upstreamNativeEntryForSlug(slug: string): RawEntry | undefined {
|
|
|
614
615
|
if (!presentation) return undefined; // an alias with no product identity must not ship a wrong one
|
|
615
616
|
alias.display_name = presentation.displayName;
|
|
616
617
|
alias.description = presentation.description;
|
|
618
|
+
neutralizeBorrowedInstructions(alias);
|
|
619
|
+
delete alias.availability_nux;
|
|
620
|
+
return alias;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/** A borrowed row must not claim the source model's identity in its instructions. */
|
|
624
|
+
function neutralizeBorrowedInstructions(alias: RawEntry): void {
|
|
617
625
|
if (typeof alias.base_instructions === "string") {
|
|
618
626
|
alias.base_instructions = neutralizeIdentity(alias.base_instructions);
|
|
619
627
|
}
|
|
@@ -626,8 +634,6 @@ function upstreamNativeEntryForSlug(slug: string): RawEntry | undefined {
|
|
|
626
634
|
};
|
|
627
635
|
}
|
|
628
636
|
}
|
|
629
|
-
delete alias.availability_nux;
|
|
630
|
-
return alias;
|
|
631
637
|
}
|
|
632
638
|
|
|
633
639
|
/** Account-specific grants and prompts are projected from entitlement evidence, never a shared row. */
|
|
@@ -731,12 +737,52 @@ export function shouldUpgradeToUpstreamEntry(entry: RawEntry): boolean {
|
|
|
731
737
|
if (typeof entry.slug !== "string" || !UPSTREAM_NATIVE_ENTRIES.has(entry.slug)) return false;
|
|
732
738
|
if (discoveredNativeOpenAiRow(entry.slug)) return true;
|
|
733
739
|
if (entry.display_name === entry.slug) return true;
|
|
740
|
+
if (isUnchangedHistoricalConfiguredFallback(entry)) return true;
|
|
734
741
|
// A row this project authored from a guess is not evidence of upstream truth, however genuine
|
|
735
742
|
// its display name looks. Replace it once, from the pin.
|
|
736
743
|
return SELF_AUTHORED_NATIVE_ROWS.has(entry.slug)
|
|
737
744
|
&& entry.display_name !== UPSTREAM_NATIVE_ENTRIES.get(entry.slug)?.display_name;
|
|
738
745
|
}
|
|
739
746
|
|
|
747
|
+
// Before a model had its own pinned row (GPT-6.2 until #8893), a providers.openai.models entry for
|
|
748
|
+
// it borrowed an older Sol row. Promote that fallback to the model's own pin only while every
|
|
749
|
+
// field still holds what the earlier build wrote, so any user edit keeps the row: borrowed fields
|
|
750
|
+
// must equal the template, and build-derived fields must hold the exact values those builds wrote
|
|
751
|
+
// (checked against rows generated at c320932c19^, the commit before GPT-6.2 was pinned).
|
|
752
|
+
const HISTORICAL_CONFIGURED_TEMPLATES = [NATIVE_GPT61_SOL_MODEL, NATIVE_GPT6_SOL_MODEL] as const;
|
|
753
|
+
const HISTORICAL_CONFIGURED_DESCRIPTION = /^OpenAI native model added through providers\.openai\.models; uses GPT-[0-9.]+-Sol capabilities\.$/;
|
|
754
|
+
const IDENTITY_FALLBACK_FIELDS: ReadonlySet<string> = new Set(["slug", "display_name", "description"]);
|
|
755
|
+
// A Map, so a persisted key such as `constructor` never resolves to an inherited property.
|
|
756
|
+
const HISTORICAL_DERIVED_FALLBACK_VALUES: ReadonlyMap<string, ReadonlyArray<unknown>> = new Map<string, ReadonlyArray<unknown>>([
|
|
757
|
+
["shell_type", ["unified_exec"]],
|
|
758
|
+
["effective_context_window_percent", [95]],
|
|
759
|
+
["opencodex_native_source_priority", [1]],
|
|
760
|
+
// 90% of the 272,000-token window configured natives received.
|
|
761
|
+
["auto_compact_token_limit", [244_800]],
|
|
762
|
+
// Written only when WebSockets were enabled, and then as the template's own value.
|
|
763
|
+
["prefer_websockets", [undefined, true]],
|
|
764
|
+
// Account prompts never reach a borrowed row.
|
|
765
|
+
["availability_nux", [undefined]],
|
|
766
|
+
]);
|
|
767
|
+
|
|
768
|
+
function isUnchangedHistoricalConfiguredFallback(entry: RawEntry): boolean {
|
|
769
|
+
const slug = entry.slug as string;
|
|
770
|
+
if (entry.display_name !== configuredNativeOpenAiDisplayName(slug)) return false;
|
|
771
|
+
if (typeof entry.description !== "string" || !HISTORICAL_CONFIGURED_DESCRIPTION.test(entry.description)) return false;
|
|
772
|
+
return HISTORICAL_CONFIGURED_TEMPLATES.some(template => {
|
|
773
|
+
// The projected template is what an earlier build copied, minus fields catalog rows never carry.
|
|
774
|
+
const borrowed = template === slug ? null : upstreamNativeEntry(template);
|
|
775
|
+
if (!borrowed) return false;
|
|
776
|
+
neutralizeBorrowedInstructions(borrowed);
|
|
777
|
+
const fields = new Set([...Object.keys(entry), ...Object.keys(borrowed)]);
|
|
778
|
+
return [...fields].every(field => {
|
|
779
|
+
if (IDENTITY_FALLBACK_FIELDS.has(field)) return true;
|
|
780
|
+
const derived = HISTORICAL_DERIVED_FALLBACK_VALUES.get(field);
|
|
781
|
+
return derived ? derived.includes(entry[field]) : Bun.deepEquals(entry[field], borrowed[field]);
|
|
782
|
+
});
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
|
|
740
786
|
export function nativeOpenAiSlugs(): string[] {
|
|
741
787
|
const live = catalogNativeSlugs();
|
|
742
788
|
const availableGated = cachedAvailableAccountGatedNativeModels();
|
|
@@ -94,7 +94,7 @@ import type { CatalogModel } from "./parsing";
|
|
|
94
94
|
import { disabledNativeSlugs, hasComboTargets, hasNativeOpenAiCapabilityMetadata, NATIVE_GPT56_MAX_INPUT_TOKENS, nativeContextLimits, nativeOpenAiCapabilityDisplayName, nativeDefaultReasoningEffort, nativeInputModalities, nativeOpenAiAutoCompactTokenLimit, nativeOpenAiContextWindow, nativeOpenAiMaxInputTokens, nativeOpenAiMaxOutputTokens, nativeOpenAiSlugs, nativeParallelToolCalls, nativeReasoningEfforts } from "./metadata";
|
|
95
95
|
import { deriveComboCatalogModel, normalizedOpenAiApiSignature, openAiApiCollisionWarnings, replaceLastComboCatalogOmissions, warnUncataloguedComboOnce } from "./aggregation";
|
|
96
96
|
import type { ComboCatalogOmission } from "./aggregation";
|
|
97
|
-
import { clampObservedModelLimits, resolveModelPolicy } from "../../providers/resolved-model-policy";
|
|
97
|
+
import { clampObservedModelLimits, prepareModelPolicy, resolveModelPolicy } from "../../providers/resolved-model-policy";
|
|
98
98
|
import { mapFill } from "../../providers/resolved-model-policy-merge";
|
|
99
99
|
import type { CatalogGatherProviderAuthEvidence } from "./filesystem-evidence";
|
|
100
100
|
import type {
|
|
@@ -270,6 +270,17 @@ export function withVisionSidecarInput(
|
|
|
270
270
|
: copyReasoningHintSource(model, { ...model, inputModalities: [...modalities, "image"] });
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
const capturedModelPolicies = new WeakMap<OcxProviderConfig, ReturnType<typeof prepareModelPolicy>>();
|
|
274
|
+
|
|
275
|
+
export function captureCatalogModelPolicy(name: string, provider: OcxProviderConfig): void {
|
|
276
|
+
capturedModelPolicies.set(provider, prepareModelPolicy({
|
|
277
|
+
providerName: name,
|
|
278
|
+
provider,
|
|
279
|
+
transportMatchedRegistry: false,
|
|
280
|
+
...(provider.authMode ? { effectiveAuth: { authMode: provider.authMode } } : {}),
|
|
281
|
+
}));
|
|
282
|
+
}
|
|
283
|
+
|
|
273
284
|
const reasoningHintSources = new WeakMap<CatalogModel, Partial<CatalogModel>>();
|
|
274
285
|
|
|
275
286
|
/** Forward discovery provenance only across transparent clones, never custom reasoning overrides. */
|
|
@@ -290,14 +301,17 @@ export function applyProviderConfigHints(
|
|
|
290
301
|
metadataConfigDir?: string,
|
|
291
302
|
includeVisionSidecar = true,
|
|
292
303
|
): CatalogModel {
|
|
293
|
-
const
|
|
294
|
-
providerName: name,
|
|
304
|
+
const modelInput = {
|
|
295
305
|
modelId: model.id,
|
|
306
|
+
modelCapabilities: prov.modelCapabilities?.[model.id],
|
|
307
|
+
...(effectiveAlias !== undefined ? { effectiveAlias } : {}),
|
|
308
|
+
};
|
|
309
|
+
const staticPolicy = capturedModelPolicies.get(prov)?.(modelInput) ?? resolveModelPolicy({
|
|
310
|
+
...modelInput,
|
|
311
|
+
providerName: name,
|
|
296
312
|
provider: prov,
|
|
297
313
|
transportMatchedRegistry: false,
|
|
298
|
-
modelCapabilities: prov.modelCapabilities?.[model.id],
|
|
299
314
|
...(prov.authMode ? { effectiveAuth: { authMode: prov.authMode } } : {}),
|
|
300
|
-
...(effectiveAlias !== undefined ? { effectiveAlias } : {}),
|
|
301
315
|
});
|
|
302
316
|
const displayName = configuredModelDisplayName(prov, model.id);
|
|
303
317
|
// The alias decision is resolved once at flight admission (captureProviderGather) and threaded
|
|
@@ -49,7 +49,7 @@ import { parseAntigravityAvailableModels, registerAntigravityDiscoveredWireModel
|
|
|
49
49
|
import { applyProviderContextCap, providerContextCap, resolveUnknownRoutedContextWindow } from "../../providers/context-cap";
|
|
50
50
|
import { clampAutoCompactTokenLimit } from "../../providers/auto-compact-budget";
|
|
51
51
|
import { effectiveModelAliases } from "../../providers/default-aliases";
|
|
52
|
-
import {
|
|
52
|
+
import { hasRoutedSlug, routedSlug, slugEquivalenceKey, slugsEquivalent } from "../../providers/slug-codec";
|
|
53
53
|
import { CODEX_GPT5_IDENTITY_LINE } from "../../adapters/identity";
|
|
54
54
|
import { filterCursorConfiguredModelsByLiveDiscovery } from "../../adapters/cursor/discovery";
|
|
55
55
|
import { fetchCursorUsableModels } from "../../adapters/cursor/live-models";
|
|
@@ -303,12 +303,9 @@ export function filterCatalogVisibleModels(
|
|
|
303
303
|
if (antigravityFamilyDisabled(config, m, models)) return false;
|
|
304
304
|
const nativeAlias = m.provider === COMBO_NAMESPACE && m.nativeAlias === true;
|
|
305
305
|
// disabledModels may be stored raw (canonical) or encoded (legacy UI writes).
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
if (m.alias !== undefined && stored === catalogModelSlug(m) && !nativeAlias) return false;
|
|
310
|
-
if (slugEquals(stored, m.provider, m.id)) return false;
|
|
311
|
-
}
|
|
306
|
+
// Keep both the public combo alias and the canonical combo/<id> exclusion.
|
|
307
|
+
if (m.alias !== undefined && !nativeAlias && disabled.has(catalogModelSlug(m))) return false;
|
|
308
|
+
if (hasRoutedSlug(disabled, m.provider, m.id)) return false;
|
|
312
309
|
const allow = allowByProvider.get(m.provider);
|
|
313
310
|
return !allow || allow.has(slugEquivalenceKey(routedSlug(m.provider, m.id)));
|
|
314
311
|
});
|