@yansigit/opencodex 2.33.0 → 2.35.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/README.md +3 -3
- package/gui/dist/assets/index-BjCaHxdz.js +112 -0
- package/gui/dist/assets/index-DLkXOXLC.css +1 -0
- package/gui/dist/index.html +2 -2
- package/package.json +1 -1
- package/src/adapters/anthropic.ts +79 -2
- package/src/adapters/command-code.ts +141 -23
- package/src/adapters/cursor/call-id.ts +44 -0
- package/src/adapters/cursor/checkpoint-store.ts +15 -10
- package/src/adapters/cursor/discovery.ts +60 -2
- package/src/adapters/cursor/effort-map.ts +79 -1
- package/src/adapters/cursor/envelope-echo.ts +162 -0
- package/src/adapters/cursor/live-models.ts +7 -2
- package/src/adapters/cursor/live-transport.ts +17 -1
- package/src/adapters/cursor/message-mapper.ts +4 -1
- package/src/adapters/cursor/native-exec-fs.ts +13 -12
- package/src/adapters/cursor/native-exec-network.ts +3 -5
- package/src/adapters/cursor/native-exec-policy.ts +47 -0
- package/src/adapters/cursor/native-exec-shell.ts +116 -31
- package/src/adapters/cursor/native-exec.ts +38 -10
- package/src/adapters/cursor/protobuf-events.ts +28 -2
- package/src/adapters/cursor/protobuf-request.ts +93 -41
- package/src/adapters/cursor/request-builder.ts +39 -10
- package/src/adapters/cursor/tool-definitions.ts +27 -3
- package/src/adapters/cursor/tool-result-normalize.ts +51 -6
- package/src/adapters/cursor/types.ts +23 -4
- package/src/adapters/cursor.ts +170 -29
- package/src/adapters/google-aistudio-parser.ts +49 -0
- package/src/adapters/google-antigravity-replay.ts +105 -25
- package/src/adapters/google-antigravity-wire.ts +5 -0
- package/src/adapters/google-errors.ts +41 -12
- package/src/adapters/google-http.ts +12 -11
- package/src/adapters/google.ts +219 -36
- package/src/adapters/image.ts +1 -1
- package/src/adapters/kiro-constants.ts +15 -0
- package/src/adapters/kiro-tools.ts +43 -15
- package/src/adapters/kiro.ts +54 -9
- package/src/adapters/openai-chat.ts +286 -242
- package/src/adapters/openai-responses.ts +335 -24
- package/src/adapters/run-turn-queue.ts +36 -1
- package/src/adapters/tool-catalog-nudge.ts +2 -2
- package/src/adapters/xai-tool-schema.ts +436 -0
- package/src/bridge.ts +67 -26
- package/src/chat/inbound.ts +29 -1
- package/src/chat/outbound.ts +15 -7
- package/src/claude/agents-inject.ts +8 -1
- package/src/claude/outbound.ts +10 -8
- package/src/cli/account-api.ts +27 -7
- package/src/cli/account-extended.ts +10 -3
- package/src/cli/account.ts +29 -5
- package/src/cli/alias.ts +66 -0
- package/src/cli/claude.ts +26 -1
- package/src/cli/dispatch.ts +13 -1
- package/src/cli/help.ts +1 -0
- package/src/cli/index.ts +6 -1
- package/src/cli/init.ts +1 -0
- package/src/cli/models-runtime.ts +95 -0
- package/src/cli/models.ts +13 -7
- package/src/cli/provider-runtime.ts +16 -2
- package/src/cli/registry.ts +6 -1
- package/src/cli/telemetry-commands.ts +25 -0
- package/src/cli/v2.ts +34 -10
- package/src/codex/account-pause.ts +2 -1
- package/src/codex/account-priority.ts +3 -2
- package/src/codex/app-server-processes.ts +80 -6
- package/src/codex/auth-api.ts +48 -8
- package/src/codex/auth-context.ts +21 -18
- package/src/codex/catalog/aggregation.ts +6 -0
- package/src/codex/catalog/model-metadata.ts +13 -1
- package/src/codex/catalog/native-models.ts +5 -2
- package/src/codex/catalog/parsing.ts +16 -0
- package/src/codex/catalog/provider-fetch.ts +20 -3
- package/src/codex/catalog/sync.ts +127 -2
- package/src/codex/catalog.ts +1 -1
- package/src/codex/codex-write-lock.ts +3 -1
- package/src/codex/convergence-types.ts +1 -1
- package/src/codex/convergence.ts +22 -2
- package/src/codex/desired-state.ts +2 -2
- package/src/codex/desktop-app-restart.ts +18 -5
- package/src/codex/inject-coordination.ts +83 -0
- package/src/codex/inject.ts +14 -1
- package/src/codex/log-guard/inspect.ts +22 -4
- package/src/codex/model-entitlements.ts +9 -2
- package/src/codex/prompt-layers.ts +371 -25
- package/src/codex/prompt-text-probe.ts +238 -0
- package/src/codex/quota.ts +123 -18
- package/src/codex/routing.ts +9 -0
- package/src/codex/subagent-model-fallback.ts +198 -27
- package/src/codex/transition-state.ts +107 -8
- package/src/combos/types.ts +10 -0
- package/src/compatibility/openai-responses.ts +33 -1
- package/src/config/autonomous-remediation.ts +21 -0
- package/src/config/provider-validation.ts +14 -0
- package/src/config/rebase-provenance.ts +68 -0
- package/src/config.ts +191 -17
- package/src/generated/compatibility-version.json +279 -159
- package/src/generated/model-metadata.ts +3 -0
- package/src/images/loop.ts +5 -4
- package/src/lab/conformance/fixtures/protocol-v1-cases.json +1 -1
- package/src/lab/fabric/producer-child.ts +1 -1
- package/src/lib/config-ownership.ts +20 -0
- package/src/lib/errors.ts +11 -2
- package/src/lib/package-tree-integrity.ts +101 -0
- package/src/oauth/aistudio-credentials.ts +65 -0
- package/src/oauth/aistudio-native-daemon.ts +116 -0
- package/src/oauth/aistudio-session-sync.ts +95 -0
- package/src/oauth/generic-account-failover.ts +231 -0
- package/src/oauth/google-aistudio-auth.ts +98 -0
- package/src/oauth/index.ts +57 -5
- package/src/oauth/key-providers.ts +18 -1
- package/src/oauth/kiro.ts +45 -0
- package/src/oauth/login-cli.ts +65 -1
- package/src/oauth/types.ts +15 -0
- package/src/providers/codex-capacity.ts +5 -2
- package/src/providers/command-code-efforts.ts +38 -6
- package/src/providers/context-cap.ts +4 -3
- package/src/providers/default-aliases.ts +65 -0
- package/src/providers/derive.ts +29 -1
- package/src/providers/fastwire.ts +7 -1
- package/src/providers/model-presets.ts +119 -0
- package/src/providers/new-model-policy.ts +146 -0
- package/src/providers/provider-id-rewrite.ts +2 -1
- package/src/providers/quota.ts +157 -46
- package/src/providers/registry.ts +184 -71
- package/src/providers/slug-codec.ts +52 -0
- package/src/responses/code-mode-helper-compat.ts +50 -0
- package/src/responses/custom-tool-compat.ts +34 -10
- package/src/responses/parser.ts +4 -0
- package/src/responses/schema.ts +5 -1
- package/src/responses/thought-signature-replay.ts +17 -0
- package/src/router.ts +43 -2
- package/src/routing/account-pool/cooldown.ts +8 -0
- package/src/routing/account-pool/index.ts +1 -0
- package/src/routing/analytics.ts +1 -0
- package/src/routing/quota.ts +10 -0
- package/src/server/auth-cors.ts +24 -0
- package/src/server/chat-completions.ts +26 -16
- package/src/server/chat-native-sse.ts +3 -3
- package/src/server/chat-native.ts +30 -11
- package/src/server/claude-messages.ts +1 -1
- package/src/server/effort-policy.ts +16 -0
- package/src/server/index.ts +180 -14
- package/src/server/lifecycle.ts +52 -1
- package/src/server/management/agent-settings-routes.ts +31 -15
- package/src/server/management/codex-prompt-routes.ts +570 -0
- package/src/server/management/combo-routes.ts +2 -1
- package/src/server/management/config-routes.ts +27 -9
- package/src/server/management/context.ts +9 -0
- package/src/server/management/logs-usage-routes.ts +11 -5
- package/src/server/management/model-routes.ts +266 -0
- package/src/server/management/oauth-account-routes.ts +13 -3
- package/src/server/management/provider-routes.ts +137 -3
- package/src/server/management/routing-profile-routes.ts +2 -2
- package/src/server/management-api.ts +2 -0
- package/src/server/port-reclaim.ts +19 -1
- package/src/server/relay-eager.ts +147 -20
- package/src/server/relay.ts +251 -19
- package/src/server/request-log-conversation.ts +33 -0
- package/src/server/request-log.ts +48 -21
- package/src/server/responses/collaboration.ts +42 -5
- package/src/server/responses/combo-stream-preflight.ts +10 -3
- package/src/server/responses/core.ts +575 -140
- package/src/server/responses/empty-completion-guard.ts +35 -0
- package/src/server/responses/fetch-helpers.ts +14 -6
- package/src/server/responses/input-admission.ts +3 -1
- package/src/server/responses/passthrough-error.ts +33 -9
- package/src/server/responses/policy-fallback.ts +1 -1
- package/src/server/responses/responses-field-backfill.ts +105 -13
- package/src/server/responses/ws-upstream.ts +35 -5
- package/src/server/responses-custom-tool-repair.ts +52 -7
- package/src/server/responses-terminal-repair.ts +25 -4
- package/src/server/sse-frame-buffer.ts +31 -4
- package/src/server/ws-bridge.ts +14 -2
- package/src/smoke/fingerprint-cache.ts +133 -0
- package/src/smoke/live-scenarios.ts +33 -0
- package/src/smoke/runner.ts +119 -0
- package/src/telemetry/dispatcher.ts +44 -0
- package/src/telemetry/fingerprint.ts +24 -0
- package/src/telemetry/hook.ts +43 -0
- package/src/telemetry/ledger.ts +54 -0
- package/src/telemetry/types.ts +23 -0
- package/src/types/config.ts +66 -14
- package/src/types/provider.ts +79 -1
- package/src/types/request.ts +18 -10
- package/src/types/tools.ts +30 -11
- package/src/types.ts +1 -0
- package/src/usage/command-code-manifest.ts +116 -0
- package/src/usage/cost.ts +2 -2
- package/src/usage/expected-prices.ts +126 -24
- package/src/usage/log.ts +18 -8
- package/src/usage/summary.ts +34 -12
- package/src/web-search/exa-executor.ts +40 -9
- package/src/web-search/index.ts +16 -8
- package/src/web-search/loop.ts +5 -4
- package/gui/dist/assets/index-DKLr4LTE.js +0 -102
- package/gui/dist/assets/index-DrSQdTRd.css +0 -1
package/src/adapters/kiro.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { decodeEventStream } from "../lib/eventstream-decoder";
|
|
2
2
|
import { estimateTokens } from "../lib/token-estimate";
|
|
3
3
|
import { debugProviderDiagnostic } from "../lib/debug";
|
|
4
|
-
import { resolveKiroApiRegion,
|
|
4
|
+
import { resolveKiroApiRegion, resolveKiroRequestProfile } from "../oauth/kiro";
|
|
5
5
|
import { KIRO_MODEL_CONTEXT_WINDOWS, normalizeKiroModelId } from "../providers/kiro-models";
|
|
6
6
|
import { modelRecordValue } from "../reasoning-effort";
|
|
7
7
|
import { parseKiroEvent } from "./kiro-events";
|
|
@@ -33,6 +33,7 @@ import type {
|
|
|
33
33
|
OcxTextContent,
|
|
34
34
|
OcxToolCall,
|
|
35
35
|
OcxToolResultMessage,
|
|
36
|
+
OcxTool,
|
|
36
37
|
OcxUsage,
|
|
37
38
|
} from "../types";
|
|
38
39
|
import type { ProviderAdapter } from "./base";
|
|
@@ -42,7 +43,7 @@ import { sniffImageDimensions } from "./anthropic-image-guard";
|
|
|
42
43
|
import { fetchKiroWithRetry, noteKiroTransientThrottle } from "./kiro-retry";
|
|
43
44
|
import { convertKiroToolContext } from "./kiro-tools";
|
|
44
45
|
import { identifyRoutedModel } from "./identity";
|
|
45
|
-
import { buildNonOpenAIToolCatalogNudgeFromNames } from "./tool-catalog-nudge";
|
|
46
|
+
import { buildNonOpenAIToolCatalogNudgeFromNames, isBareShellBridgeTool, isCodexCodeModeExecTool } from "./tool-catalog-nudge";
|
|
46
47
|
import {
|
|
47
48
|
KIRO_COMPLETION_INSTRUCTIONS,
|
|
48
49
|
KIRO_COMPLETION_RETRY_MESSAGE,
|
|
@@ -321,9 +322,23 @@ function validateKiroCapabilities(parsed: OcxParsedRequest): void {
|
|
|
321
322
|
if (parsed.options.serviceTier !== undefined) {
|
|
322
323
|
throw new Error("Kiro does not support service tiers");
|
|
323
324
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
// Structured output is a real contract Kiro cannot honour: the wire has no
|
|
326
|
+
// schema-constrained response mode, so a caller expecting parseable JSON would receive
|
|
327
|
+
// prose and fail downstream. Refuse it.
|
|
328
|
+
//
|
|
329
|
+
// The rest of the Responses `text` object is not that. `text.verbosity` is a length
|
|
330
|
+
// preference and `text.format: {type:"text"}` is ordinary prose — the default output
|
|
331
|
+
// mode, which no capability flag governs and every correct client may send. Testing
|
|
332
|
+
// `_rawBody.text !== undefined` refused those turns for the mere PRESENCE of the key,
|
|
333
|
+
// the same mistake db040e70f removed one condition earlier where a permissive
|
|
334
|
+
// `parallel_tool_calls` hint was read as a requirement.
|
|
335
|
+
//
|
|
336
|
+
// Nothing needs stripping the way openai-responses strips a no-op verbosity:
|
|
337
|
+
// buildKiroPayload composes conversationState field by field from `parsed` and never
|
|
338
|
+
// spreads `_rawBody`, so a tolerated control is dropped by construction. The test
|
|
339
|
+
// asserts that absence so it stays true.
|
|
340
|
+
if (parsed._structuredOutput) {
|
|
341
|
+
throw new Error("Kiro does not support Responses structured output");
|
|
327
342
|
}
|
|
328
343
|
}
|
|
329
344
|
|
|
@@ -460,9 +475,32 @@ export function buildKiroPayload(
|
|
|
460
475
|
// name for a tool that was never advertised and pollute the collision domain.
|
|
461
476
|
const advertisedAlias = new Map<string, string>();
|
|
462
477
|
for (const [alias, wireName] of registry.nameMap) advertisedAlias.set(wireName, alias);
|
|
478
|
+
// Code mode is decided on the EMITTED catalog, not the requested list.
|
|
479
|
+
//
|
|
480
|
+
// `freeform` only exists on the requested tool objects -- `kiroToolWireNames` has already
|
|
481
|
+
// reduced the emitted catalog to strings -- so the predicates must read the objects. But the
|
|
482
|
+
// SHAPE that matters is the one the model receives: the count/byte budget can drop a requested
|
|
483
|
+
// `exec_command` while `exec` survives, and scanning the requested list would then find a shell
|
|
484
|
+
// bridge the model cannot call and suppress code mode for a catalog that is code-mode-shaped.
|
|
485
|
+
// Intersecting the two keeps `tool_choice: "none"` and budget omission correct for free: both
|
|
486
|
+
// empty the emitted set, so nothing can be named.
|
|
487
|
+
const emittedToolNames = new Set(kiroToolWireNames(kiroTools));
|
|
488
|
+
const emittedAlias = (tool: OcxTool): string | undefined => {
|
|
489
|
+
const wireName = namespacedToolName(tool.namespace, tool.name);
|
|
490
|
+
// Read the recorded mapping; `registry.alias()` would REGISTER a name here.
|
|
491
|
+
const alias = advertisedAlias.get(wireName) ?? wireName;
|
|
492
|
+
return emittedToolNames.has(alias) ? alias : undefined;
|
|
493
|
+
};
|
|
494
|
+
const requestedTools = parsed.context.tools ?? [];
|
|
495
|
+
const emittedCodeModeExec = requestedTools.find(tool => isCodexCodeModeExecTool(tool) && emittedAlias(tool));
|
|
496
|
+
const emittedShellBridge = requestedTools.some(tool => isBareShellBridgeTool(tool) && emittedAlias(tool));
|
|
497
|
+
const codeModeExecName = emittedCodeModeExec && !emittedShellBridge
|
|
498
|
+
? emittedAlias(emittedCodeModeExec)
|
|
499
|
+
: undefined;
|
|
463
500
|
const toolCatalogNudge = buildNonOpenAIToolCatalogNudgeFromNames(
|
|
464
501
|
kiroToolWireNames(kiroTools),
|
|
465
502
|
name => advertisedAlias.get(name) ?? name,
|
|
503
|
+
codeModeExecName,
|
|
466
504
|
);
|
|
467
505
|
const boundedNudge = toolCatalogNudge ? boundedInjectedInstruction(toolCatalogNudge, injectedChars) : undefined;
|
|
468
506
|
if (boundedNudge) systemParts.push(boundedNudge);
|
|
@@ -1723,12 +1761,19 @@ export function createKiroAdapter(provider: OcxProviderConfig): ProviderAdapter
|
|
|
1723
1761
|
throw new Error("kiro token missing — run ocx login kiro");
|
|
1724
1762
|
}
|
|
1725
1763
|
const region = resolveKiroApiRegion(parsed._kiroAuthContext);
|
|
1726
|
-
|
|
1764
|
+
// Request-scoped: an AWS Builder ID account has no profile of its own and resolves to Kiro's
|
|
1765
|
+
// fixed service profile here, without that value ever becoming the account's stored identity.
|
|
1766
|
+
const requestProfile = resolveKiroRequestProfile(parsed._kiroAuthContext);
|
|
1767
|
+
const resolvedProfileArn = requestProfile.profileArn;
|
|
1727
1768
|
const isApiKey = provider.apiKey.trim().startsWith("ksk_");
|
|
1728
1769
|
const profileArn = isApiKey ? undefined : resolvedProfileArn;
|
|
1729
|
-
// Builder ID and Kiro API keys
|
|
1730
|
-
//
|
|
1731
|
-
|
|
1770
|
+
// Builder ID and Kiro API keys are accepted only on Kiro's CLI request path; enterprise
|
|
1771
|
+
// profiles retain the IDE-shaped request. Builder ID now carries a profile ARN, so a truthy
|
|
1772
|
+
// `profileArn` no longer implies "enterprise". The wire path reads the resolver's own verdict
|
|
1773
|
+
// rather than re-deriving it, so the accountless path — where the auth type comes from the
|
|
1774
|
+
// local import, not the request context — cannot send the fallback inside an IDE-shaped call.
|
|
1775
|
+
const isBuilderId = requestProfile.builderIdFallback;
|
|
1776
|
+
const wireClient: KiroWireClient = isApiKey || isBuilderId || !profileArn ? "cli" : "ide";
|
|
1732
1777
|
const fp = fingerprint().slice(0, 64);
|
|
1733
1778
|
const headers: Record<string, string> = wireClient === "cli" ? {
|
|
1734
1779
|
authorization: `Bearer ${provider.apiKey}`,
|