Skip to content

Commit 005cda4

Browse files
committed
Merge remote-tracking branch 'origin/dev' into lane/pr-8048b
2 parents 20cf7a0 + 60ac8ef commit 005cda4

61 files changed

Lines changed: 1469 additions & 173 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎docs-site/src/content/docs/guides/providers.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ The built-in Claude model seeds advertise text and image input for both `anthrop
9292
Explicit per-model input-modality overrides remain authoritative; unknown models are not assumed
9393
image-capable. This applies across integrations wherever the client's configuration supports image
9494
capability metadata: OpenClaw exports a declared `input` array, and Kimi Code exports
95-
`capabilities: ["image_in"]` only for image-capable models. OpenClaw omits `input` when no supported
96-
modalities are declared; Kimi omits `capabilities` for unknown or text-only models. Clients without
95+
`capabilities: ["image_in"]` only for image-capable models, adding `"thinking"` when the model
96+
declares an effort ladder. Kimi Code also receives that ladder as `support_efforts` (limited to
97+
`low`, `medium`, `high`, `xhigh` and `max`, in that order) and the declared default as
98+
`default_effort` when it is in the ladder. OpenClaw omits `input` when no supported modalities are
99+
declared; Kimi omits `capabilities` for models that declare neither image input nor an effort ladder. Clients without
97100
a supported capability field keep their existing configuration shape. After updating opencodex,
98101
regenerate or refresh the client configuration managed by opencodex to receive the updated metadata.
99102

‎docs-site/src/content/docs/guides/web-dashboard.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,14 @@ they have been synchronized. See
301301

302302
In **Connect → API Keys**, every row of the key table has its own delete button, which asks for confirmation in place. Clicking a key can show its full value with a **Copy** button only from an independently authorized session.
303303

304+
### Applying a Codex CLI update over HTTP
305+
306+
The CLI-update HTTP API has no dashboard job UI. Its apply route requires a current explicitly paired browser session on trusted loopback ingress, matching Origin and CSRF headers, and `confirmed: true`. Automatic local sign-in, a remembered admin session, an admin token or Tailscale sign-in alone cannot authorize this action.
307+
308+
For standalone local pairing, open the dashboard at its configured literal `http://127.0.0.1:<port>` or `http://[::1]:<port>` origin. Use the existing local pairing form in **Connect → API Keys** or Remote Link setup: run the displayed `ocx gui pair --origin "<browser-origin>"` command locally, then redeem its one-time code in that form. Pairing does not apply an update; a subsequent confirmed API request is still required. A server configured with hostname `localhost`, a wildcard bind, or a connected-client role cannot issue this local pairing authority. Remote pairing does not remove the apply route's trusted-loopback requirement.
309+
310+
Without an eligible HTTP pairing path, use `ocx system codex-cli-update plan` followed by `ocx system codex-cli-update apply --plan-id <32-hex> --yes` locally. This uses the same durable job owner without a GUI session. Pairing proves authority to write the protected configuration home, not human identity or protection from unrestricted same-user processes.
311+
304312
### Reading an existing API key
305313

306314
Showing a stored key's full value requires a dashboard session established by explicit pairing or

‎docs-site/src/content/docs/reference/adapters.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,8 @@ For Meta Responses at the exact `api.meta.ai` host, OpenCodex omits the unsuppor
274274
`output.encrypted_content` include requested by Codex Desktop. Meta otherwise rejects the
275275
request before inference. `reasoning.encrypted_content` and other include entries remain
276276
intact, so stateless reasoning replay is preserved. The same exact-entry normalization
277-
applies to xAI; unrelated Responses destinations keep their original include list.
277+
applies to xAI and to Kimi Code at its exact HTTPS Responses endpoint
278+
(`https://api.kimi.com/coding/v1/responses`); unrelated Responses destinations keep their original include list.
278279

279280
These request-shape fixes do not change account entitlements. Meta limits Muse Code
280281
subscription credentials to the Muse Code client; other clients require a separately

‎docs-site/src/content/docs/reference/configuration/server.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,9 @@ native compaction model.
806806

807807
OpenCodex changes only requests with explicit `request_kind: "compaction"` metadata whose
808808
`compaction.trigger` is one of the values you listed, sent to `/v1/responses/compact` or to
809-
`/v1/responses` with a `compaction_trigger` input item. Later conversation turns keep their
809+
`/v1/responses` with a `compaction_trigger` input item. With `codexClientCompaction` enabled,
810+
the local checkpoint prompt also matches when metadata specifies `compaction.implementation` as
811+
`"responses"`; it remains a normal text summary request. Later conversation turns keep their
810812
original routing and settings. Missing, malformed, or conflicting metadata does not activate the
811813
override, including on older clients without trigger metadata; when several copies of the
812814
metadata are supplied they must name the same trigger. WebSocket requests use each frame's

‎scripts/test-layout/layout-responses.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"responses-native-output-identity.test.ts": "responses",
23
"graceful-max-output-tokens.test.ts": "responses",
34
"graceful-max-output-tokens-exclusions.test.ts": "responses",
45
"advisor-web-search.test.ts": "advisor",

‎scripts/test-layout/layout.json‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"codex-config-preservation.test.ts": "codex-integration",
9595
"codex-credits.test.ts": "codex-integration",
9696
"codex-credits-settings.test.ts": "codex-integration",
97-
"codex-credits-probes.test.ts": "codex-integration",
97+
"codex-credits-probes.test.ts": "codex-integration", "pool-monthly-window-retirement.test.ts": "codex-integration",
9898
"codex-credits-after-limit.test.ts": "codex-integration",
9999
"codex-pool-credit-policy.test.ts": "codex-integration", "codex-credit-retry-after.test.ts": "codex-integration", "codex-credit-scoped-retry.test.ts": "codex-integration",
100100
"codex-sidecar-credit-policy.test.ts": "codex-integration",
@@ -461,7 +461,7 @@
461461
"claude-native-passthrough.test.ts": "claude-integration",
462462
"claude-native-rate-limit-headers.test.ts": "claude-integration",
463463
"claude-outbound.test.ts": "claude-integration",
464-
"claude-prompt-too-long.test.ts": "claude-integration",
464+
"claude-prompt-too-long.test.ts": "claude-integration", "claude-uncoded-context-overflow.test.ts": "claude-integration",
465465
"claude-shell-hook.test.ts": "claude-integration",
466466
"claude-sidecar-override.test.ts": "claude-integration",
467467
"claude-source-envelope.test.ts": "claude-integration",
@@ -541,7 +541,7 @@
541541
"cli-version-skew.test.ts": "cli",
542542
"client-config-export-new-clients.test.ts": "config",
543543
"client-config-export.test.ts": "config",
544-
"client-config-new-clients.test.ts": "config",
544+
"client-config-new-clients.test.ts": "config", "client-config-kimi-efforts.test.ts": "config",
545545
"client-injection-guard.test.ts": "codex-integration",
546546
"cli-link-child.test.ts": "cli",
547547
"cline-pass-deepseek-v4-tool-replay.test.ts": "providers",
@@ -1330,11 +1330,11 @@
13301330
"ocx-launcher-desktop-handoff.test.ts": "cli", "cli-path-diagnostics.test.ts": "cli",
13311331
"ocx-launcher-source.test.ts": "cli",
13321332
"ocx-run.test.ts": "cli",
1333-
"ollama-native-parser.test.ts": "providers/ollama", "ollama-native-reasoning-wire.test.ts": "providers/ollama", "ollama-native-structured-output.test.ts": "providers/ollama", "ollama-native-tool-continuations.test.ts": "providers/ollama",
1333+
"ollama-native-parser.test.ts": "providers/ollama", "ollama-native-cached-usage.test.ts": "providers/ollama", "ollama-native-reasoning-wire.test.ts": "providers/ollama", "ollama-native-structured-output.test.ts": "providers/ollama", "ollama-native-tool-continuations.test.ts": "providers/ollama",
13341334
"ollama-native-v4.test.ts": "providers/ollama", "ollama-native-scaling.test.ts": "providers/ollama", "ollama-native.test.ts": "providers/ollama", "ollama-show-enrichment-v7.test.ts": "providers/ollama", "ollama-show-enrichment.test.ts": "providers/ollama",
13351335
"ollama-show-ignore-abort.test.ts": "providers/ollama",
13361336
"opaque-blob-wrapped-rejection.test.ts": "responses", "openai-api-virtual-models.test.ts": "adapters/openai", "openai-chat-bounded-tool-names.test.ts": "adapters/openai", "openai-chat-dangling-toolcalls.test.ts": "adapters/openai",
1337-
"openai-chat-developer-position.test.ts": "adapters/openai", "openai-chat-eof.test.ts": "adapters/openai", "openai-chat-hardening.test.ts": "adapters/openai", "openai-empty-assistant-history.test.ts": "adapters/openai", "openai-chat-image-normalization.test.ts": "adapters/openai",
1337+
"openai-chat-developer-position.test.ts": "adapters/openai", "openai-chat-eof.test.ts": "adapters/openai", "openai-chat-hardening.test.ts": "adapters/openai", "openai-empty-assistant-history.test.ts": "adapters/openai", "kimi-coding-output-include.test.ts": "providers", "openai-chat-image-normalization.test.ts": "adapters/openai",
13381338
"openai-chat-inline-think-tags.test.ts": "adapters/openai", "openai-chat-invalid-tool-call-diagnostics.test.ts": "adapters/openai", "openai-chat-mistral-content.test.ts": "adapters/openai", "openai-chat-model-suffix.test.ts": "adapters/openai", "openai-chat-native-policy.test.ts": "adapters/openai",
13391339
"openai-chat-parallel-stream.test.ts": "adapters/openai", "openai-chat-path-override.test.ts": "adapters/openai", "openai-chat-qwen38-leading-system.test.ts": "adapters/openai", "openai-chat-reasoning-wire-policy.test.ts": "adapters/openai",
13401340
"openai-chat-sanitization-review-regressions.test.ts": "adapters/openai", "openai-chat-serialized-tool-call-content.test.ts": "adapters/openai", "openai-chat-serialized-tool-call-hold-bound.test.ts": "adapters/openai", "openai-chat-serialized-tool-call-think.test.ts": "adapters/openai",
@@ -1537,7 +1537,7 @@
15371537
"responses-code-mode-patch-compile.test.ts": "responses",
15381538
"responses-code-mode-shell-compile.test.ts": "responses",
15391539
"responses-compact-handoff-admission.test.ts": "responses",
1540-
"responses-compaction-override.test.ts": "responses",
1540+
"responses-compaction-override.test.ts": "responses", "local-checkpoint-routing.test.ts": "responses",
15411541
"responses-compaction-policy-identity.test.ts": "responses",
15421542
"responses-compaction-http-isolation.test.ts": "responses", "responses-compaction-routing.test.ts": "responses",
15431543
"native-compaction-gateway.test.ts": "responses", "native-compaction-gateway-policy.test.ts": "responses", "native-compaction-provenance.test.ts": "responses", "native-compaction-oauth.test.ts": "responses", "native-compaction-gateway-credentials.test.ts": "responses", "responses-compaction.test.ts": "responses",

‎skills/ocx/references/01_surface_observe-system.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ Drives no management route.
437437
| `--request-id` | string | Optional stable retry key. |
438438
| `--json` | boolean | Emit the public job status. |
439439

440-
- Local counterpart of POST /api/codex/cli-update/apply: invokes the same durable job owner with --yes confirmation; HTTP admission separately requires a trusted loopback GUI session.
440+
- Local counterpart of POST /api/codex/cli-update/apply: invokes the same durable job owner with --yes confirmation; HTTP admission separately requires a current paired dashboard session on trusted loopback ingress, matching origin, CSRF and confirmed: true.
441+
- Standalone HTTP pairing requires the configured literal 127.0.0.1 or ::1 origin; localhost aliases, wildcard binds and connected-client roles use the local CLI --yes path instead.
441442
- Admission is stored under the protected current-user config root before the installer can run.
442443
- Exit 0 requires an applied job; refused, not_applied, ambiguous and pending duplicate jobs exit 1, including with --json.
443444
- Only POSIX npm-global managed installs are currently supported; Windows, shims and other managers remain refused.

‎src/adapters/ollama-native.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,17 @@ function usageFromNative(value: JsonRecord | undefined): OcxUsage | undefined {
641641
const input = isFiniteNonNegativeInteger(value.prompt_eval_count) ? value.prompt_eval_count : undefined;
642642
const output = isFiniteNonNegativeInteger(value.eval_count) ? value.eval_count : undefined;
643643
if (input === undefined && output === undefined) return undefined;
644-
return { inputTokens: input ?? 0, outputTokens: output ?? 0 };
644+
// Ollama reports prompt_eval_cached_count as the cached subset of prompt_eval_count (api/types.go;
645+
// its CLI prints prompt_eval_count - cached as the uncached share), which is OCX's cache-read
646+
// convention. Omitted means unknown, so no cache field is invented; a count that exceeds the
647+
// prompt is not a subset and is ignored rather than clamped (#8101).
648+
const cached = input !== undefined && isFiniteNonNegativeInteger(value.prompt_eval_cached_count)
649+
&& value.prompt_eval_cached_count <= input ? value.prompt_eval_cached_count : undefined;
650+
return {
651+
inputTokens: input ?? 0,
652+
outputTokens: output ?? 0,
653+
...(cached !== undefined ? { cachedInputTokens: cached, cacheReadInputTokens: cached } : {}),
654+
};
645655
}
646656

647657
function stopReasonFromNative(value: unknown): string | undefined {

‎src/adapters/openai-responses/empty-assistant.ts‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,23 @@ function isEmptyAssistantMessage(item: unknown): boolean {
1616
return item.content === "" || (Array.isArray(item.content) && item.content.every(isEmptyTextPart));
1717
}
1818

19+
/** Exactly Kimi Code's native Responses endpoint; lookalike hosts and other Kimi paths do not match. */
20+
export function isKimiCodingResponsesUrl(responseUrl: string): boolean {
21+
let url: URL;
22+
try { url = new URL(responseUrl); } catch { return false; }
23+
return url.hostname === "api.kimi.com" && /^\/coding\/v1\/responses\/?$/.test(url.pathname);
24+
}
25+
26+
/** The same endpoint over HTTPS on the default port only, for request rewrites scoped to Kimi Code itself. */
27+
export function isKimiCodingResponsesHttpsUrl(responseUrl: string): boolean {
28+
if (!isKimiCodingResponsesUrl(responseUrl)) return false;
29+
const url = new URL(responseUrl);
30+
return url.protocol === "https:" && url.port === "";
31+
}
32+
1933
/** Kimi Code rejects content-empty assistant messages even on its native Responses endpoint. */
2034
export function stripKimiEmptyAssistantMessages(body: unknown, responseUrl: string): unknown {
21-
let url: URL;
22-
try { url = new URL(responseUrl); } catch { return body; }
23-
if (url.hostname !== "api.kimi.com" || !/^\/coding\/v1\/responses\/?$/.test(url.pathname)) return body;
35+
if (!isKimiCodingResponsesUrl(responseUrl)) return body;
2436
if (!isPlainObject(body) || !Array.isArray(body.input)) return body;
2537
const referencedIds = new Set<string>();
2638
for (const item of body.input) {

‎src/adapters/openai-responses/passthrough.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ import { observeOutbound } from "../../usage/cache-diagnostic";
5757
import { normalizeMuseToolCatalog } from "./muse-tool-catalog";
5858
import { normalizeMuseToolChoice } from "./muse-tool-choice";
5959
import { declaresHostedWebSearch, projectHostedSearchHistory, renderCompactionSearchHistoryItems } from "./compaction-search-history";
60-
import { stripKimiEmptyAssistantMessages } from "./empty-assistant";
60+
import { isKimiCodingResponsesHttpsUrl, stripKimiEmptyAssistantMessages } from "./empty-assistant";
6161
import { normalizeOpenGatewayResponsesInput } from "./opengateway-input";
6262

6363
/**
@@ -358,12 +358,13 @@ export function createResponsesPassthroughAdapter(provider: OcxProviderConfig):
358358
// OpenCode Go speaks the same dialect, which the final model id and URL identify.
359359
outBody = normalizeXaiResponsesWebSearch(outBody, provider, { modelId: parsed.modelId, responseUrl: url });
360360
outBody = injectXaiResponsesXSearch(outBody, provider, parsed._replayPrefixLen);
361-
// xAI, Meta and Azure answer 400 for `output.encrypted_content` instead of ignoring it;
362-
// Codex Desktop asks for it on every turn (#7878).
361+
// xAI, Meta, Azure and Kimi Code (#8075) answer 400 for `output.encrypted_content`
362+
// instead of ignoring it; Codex Desktop asks for it on every turn (#7878).
363363
// Azure also rejects this exact include entry, including on plain Responses routes.
364364
const isAzureResponses = provider.adapter === "azure" || provider.adapter === "azure-openai"
365365
|| new URL(url).hostname.toLowerCase().endsWith(".openai.azure.com");
366-
if (isXaiResponsesDestination(provider) || isMetaAiResponsesDestination(url) || isAzureResponses) {
366+
if (isXaiResponsesDestination(provider) || isMetaAiResponsesDestination(url) || isAzureResponses
367+
|| isKimiCodingResponsesHttpsUrl(url)) {
367368
outBody = stripUnsupportedOutputInclude(outBody);
368369
}
369370
// xAI and explicitly classified compatible gateways reject these OpenAI web_search

0 commit comments

Comments
 (0)