Skip to content

Commit a7dce5a

Browse files
authored
Merge branch 'main' into agent/imessage-send-timeout
2 parents e8405e5 + 17625e5 commit a7dce5a

110 files changed

Lines changed: 6504 additions & 2926 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.

‎.github/workflows/ci.yml‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2278,11 +2278,18 @@ jobs:
22782278
# The i18n verify covers keys extracted from every ui/ source,
22792279
# not just ui/src/i18n; any ui-touching diff (run_ui_tests) or
22802280
# i18n-tooling diff must run it. oxlint always runs.
2281+
lint_args=(--threads=8)
2282+
if [ "$(nproc)" -lt 8 ]; then
2283+
# Fork PRs run on 4-core hosted runners with 16GB. Bound both
2284+
# the core process size and its threads so type-aware oxlint
2285+
# does not intermittently lose the runner under memory pressure.
2286+
lint_args=(--split-core --threads=1)
2287+
fi
22812288
if [ "$RUN_CONTROL_UI_I18N" = "true" ] || [ "$RUN_UI_TESTS" = "true" ]; then
2282-
pnpm lint --threads=8
2289+
pnpm lint "${lint_args[@]}"
22832290
else
22842291
echo "[skip] changed scope cannot affect control-UI i18n catalogs"
2285-
node scripts/run-oxlint-shards.mjs --threads=8
2292+
node scripts/run-oxlint-shards.mjs "${lint_args[@]}"
22862293
fi
22872294
if [ "$FORMAT_CHECK" = "true" ]; then
22882295
pnpm format:check

‎.github/workflows/openclaw-live-and-e2e-checks-reusable.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,6 +886,8 @@ jobs:
886886
runs-on: ${{ inputs.use_github_hosted_runners && 'ubuntu-24.04' || 'blacksmith-32vcpu-ubuntu-2404' }}
887887
timeout-minutes: ${{ inputs.release_test_profile == 'full' && 90 || 60 }}
888888
env:
889+
OPENCLAW_BUILD_PRIVATE_QA: "1"
890+
OPENCLAW_ENABLE_PRIVATE_QA_CLI: "1"
889891
OPENCLAW_VITEST_MAX_WORKERS: "2"
890892
steps:
891893
- name: Checkout selected ref

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ ad60ccc4fe9084d47f0477e02d9296bacad32f26d7456e2a84be8d25a53a25c2 module/boolean
2525
16dc9d32e8ca3ef78fc63e0fc4b20e6b943633e9572de1a49d24a880b6ffc66c module/channel-config-primitives
2626
c0f910ebfa3dbf283145fb1e3b9c016d03e853ef13e70402b09f3b9d9c2f4ab0 module/channel-config-schema
2727
2dd98659d9600e755f09ef00dd91c36692b8562ed3700461937e94f6cd1e640a module/channel-contract
28-
23fba2ab304d27b33fb8923e542741a03dd93b5b60cffc0337d89c46090ace95 module/channel-core
28+
6e7bb72d2fe65cd2541af6c057dba4faa5079f410f34e08fcb5348ab38e7a666 module/channel-core
2929
9a5aaf650f9242523bb57bdc2556c323ab64e55aa11e25e2685b73b23ee12534 module/channel-dm-policy
30-
fbf353eb38ae68d8ded3f2a60b432c7bb2c245d2ec7e7c9f53c6da19a0db0938 module/channel-entry-contract
30+
ba41c40956d6b4565605fa38c2d12f4b8471a0f8afe842798716b9032ee4d74a module/channel-entry-contract
3131
982f29a18e07228e3da82cae67d06ff38249592a29c2fd28f01f0d2016ff80d9 module/channel-feedback
3232
d645d24bcb7a5f68cc46c692ad0d1fbd19be0a99996f31e9479ce9cffce301c1 module/channel-inbound
3333
76bb7f531f3702c801e8fe7479e9e499f601fb361a4303afdcb45fc0da440e4b module/channel-inbound-debounce
@@ -58,7 +58,7 @@ eb4c757fe0086c1dbfa4c3f3caf3dcff0d3cab3924c608237f08f740a6ee5f59 module/command
5858
20f3f8042de53e4eee61b64de9102c8c202b9299e6a29235647a4729f70145f2 module/config-mutation
5959
189fa5a240cad0404cd281ad0a14a105a8f3231278d87b71cfbc4f96fb8e48ef module/config-runtime
6060
c1ea9510dfda047609a99d5d2cd1f1560f5d469a36e6b695766213d695c25b0f module/conversation-runtime
61-
8994adeb5aec2799c1a6d492f4f69db38ab15381038525666463580f520c5cfc module/core
61+
dea96213010cbc816345b1229534f1acb8b0bcfdbd7814c62eefc77030fa9cd8 module/core
6262
4af19d59c2f18674e7d7f7dc1b358b644dc707e6bd601dc47168bd9e4a669940 module/dedupe-runtime
6363
f70c93d28053ca2e8353e45e6515ce7acef188097c6117d1545965d0699c8004 module/device-bootstrap
6464
6215d3af5923bf5a616d73062534968b69f448e3e30adc64ae9caebdd1a46d71 module/diagnostic-runtime

‎docs/plugins/sdk-entrypoints.md‎

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ export default definePluginEntry({
170170

171171
Wraps `definePluginEntry` with channel-specific wiring: it automatically
172172
calls `api.registerChannel({ plugin })`, exposes an optional root-help CLI
173-
metadata seam, and gates `registerFull` on registration mode.
173+
metadata seam, and gates capability and full-runtime callbacks on registration
174+
mode.
174175

175176
```typescript
176177
import { defineChannelPluginEntry } from "openclaw/plugin-sdk/channel-core";
@@ -187,19 +188,23 @@ export default defineChannelPluginEntry({
187188
registerFull(api) {
188189
api.registerGatewayMethod(/* ... */);
189190
},
191+
registerCapabilities(api) {
192+
api.registerTranscriptSourceProvider(/* ... */);
193+
},
190194
});
191195
```
192196

193-
| Field | Type | Required | Default |
194-
| --------------------- | ---------------------------------------------------------------- | -------- | ------------------- |
195-
| `id` | `string` | Yes | - |
196-
| `name` | `string` | Yes | - |
197-
| `description` | `string` | Yes | - |
198-
| `plugin` | `ChannelPlugin` | Yes | - |
199-
| `configSchema` | `OpenClawPluginConfigSchema \| () => OpenClawPluginConfigSchema` | No | Empty object schema |
200-
| `setRuntime` | `(runtime: PluginRuntime) => void` | No | - |
201-
| `registerCliMetadata` | `(api: OpenClawPluginApi) => void` | No | - |
202-
| `registerFull` | `(api: OpenClawPluginApi) => void` | No | - |
197+
| Field | Type | Required | Default |
198+
| ---------------------- | ---------------------------------------------------------------- | -------- | ------------------- |
199+
| `id` | `string` | Yes | - |
200+
| `name` | `string` | Yes | - |
201+
| `description` | `string` | Yes | - |
202+
| `plugin` | `ChannelPlugin` | Yes | - |
203+
| `configSchema` | `OpenClawPluginConfigSchema \| () => OpenClawPluginConfigSchema` | No | Empty object schema |
204+
| `setRuntime` | `(runtime: PluginRuntime) => void` | No | - |
205+
| `registerCliMetadata` | `(api: OpenClawPluginApi) => void` | No | - |
206+
| `registerFull` | `(api: OpenClawPluginApi) => void` | No | - |
207+
| `registerCapabilities` | `(api: OpenClawPluginApi) => void` | No | - |
203208

204209
Callbacks run per registration mode (full table under
205210
[Registration mode](#registration-mode)):
@@ -214,10 +219,13 @@ Callbacks run per registration mode (full table under
214219
plugin loads.
215220
- `registerFull` runs only for `"full"` and `"tool-discovery"`. For
216221
`"tool-discovery"` it runs _instead of_ channel registration: OpenClaw
217-
skips `registerChannel`/`setRuntime` entirely and calls only
218-
`registerFull`, so any provider/tool registration your channel needs for
219-
standalone tool discovery or execution must live there, not behind normal
220-
channel setup.
222+
skips `registerChannel`/`setRuntime` entirely and calls the full-runtime
223+
callback followed by the capability callback. Keep tool registration in
224+
`registerFull` and capability providers in `registerCapabilities`.
225+
- `registerCapabilities` runs for `"discovery"`, `"full"`, and
226+
`"tool-discovery"`. Register inert advertised providers here so read-only
227+
capability discovery can find them without starting sockets, clients,
228+
workers, or services.
221229
- Discovery registration is non-activating, not import-free: OpenClaw may
222230
evaluate the trusted plugin entry and channel plugin module to build the
223231
snapshot. Keep top-level imports side-effect-free and put sockets,
@@ -327,14 +335,14 @@ full activation.
327335

328336
`api.registrationMode` tells your plugin how it was loaded:
329337

330-
| Mode | When | What to register |
331-
| ------------------ | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
332-
| `"full"` | Normal gateway startup | Everything |
333-
| `"discovery"` | Read-only capability discovery | Channel registration plus static CLI descriptors; entry code may load, but skip sockets, workers, clients, and services |
334-
| `"tool-discovery"` | Scoped load to list or run specific plugins' tools | Capability/tool registration only; no channel activation |
335-
| `"setup-only"` | Disabled/unconfigured channel | Channel registration only |
336-
| `"setup-runtime"` | Setup flow with runtime available | Channel registration plus only the lightweight runtime needed before the full entry loads |
337-
| `"cli-metadata"` | Root help / CLI metadata capture | CLI descriptors only |
338+
| Mode | When | What to register |
339+
| ------------------ | -------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
340+
| `"full"` | Normal gateway startup | Everything |
341+
| `"discovery"` | Read-only capability discovery | Channel registration, static CLI descriptors, and inert providers; skip sockets, workers, clients, and services |
342+
| `"tool-discovery"` | Scoped load to list or run specific plugins' tools | Capability/tool registration only; no channel activation |
343+
| `"setup-only"` | Disabled/unconfigured channel | Channel registration only |
344+
| `"setup-runtime"` | Setup flow with runtime available | Channel registration plus only the lightweight runtime needed before the full entry loads |
345+
| `"cli-metadata"` | Root help / CLI metadata capture | CLI descriptors only |
338346

339347
`defineChannelPluginEntry` handles this split automatically. If you use
340348
`definePluginEntry` directly for a channel, check mode yourself and remember

‎docs/plugins/sdk-subpaths.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Use `isLoopbackHost(host)` when a plugin must accept only the local machine. It
337337
| `plugin-sdk/speech-settings` | Lightweight TTS config resolution and normalization primitives without provider registries or synthesis runtime |
338338
| `plugin-sdk/realtime-transcription` | Private-local after July 2026; Realtime transcription provider types, registry helpers, and shared WebSocket session helper |
339339
| `plugin-sdk/realtime-bootstrap-context` | Private-local after July 2026; Realtime profile bootstrap helper for bounded `IDENTITY.md`, `USER.md`, and `SOUL.md` context injection |
340-
| `plugin-sdk/realtime-voice` | Private-local after July 2026; Realtime voice provider types, registry helpers, shared audio-energy/speech-onset gates, and realtime voice behavior helpers, including the transport-independent session harness and output activity tracking |
340+
| `plugin-sdk/realtime-voice` | Private-local after July 2026; Realtime voice provider types, registry helpers, shared audio-energy/speech-onset gates, and realtime voice behavior helpers, including the transport-independent session harness and output activity tracking. For official runtime consumers, sender-auth contract revision 1 forwards ingress-authenticated `senderId` and `senderIsOwner` unchanged; ingress owns authentication, and consumers requiring the handoff must fail closed on other revisions. |
341341
| `plugin-sdk/meeting-runtime` | Browser-meeting session runtime, realtime audio engines/transports, `MeetingPlatformAdapter`, browser/node control, agent-consult, voice-call delegation, setup checks, and SoX command helpers |
342342
| `plugin-sdk/image-generation` | Private-local after July 2026; Image generation provider types plus image asset/data URL helpers and the OpenAI-compatible image provider builder |
343343
| `plugin-sdk/image-generation-core` | Private-local after July 2026; Shared image-generation types, failover, auth, and registry helpers |

‎extensions/anthropic/index.test.ts‎

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Anthropic tests cover index plugin behavior.
2+
import { calculateCost, type Usage } from "openclaw/plugin-sdk/llm";
23
import type {
34
ProviderResolveDynamicModelContext,
45
ProviderRuntimeModel,
@@ -859,6 +860,70 @@ describe("anthropic provider replay hooks", () => {
859860
expect(normalized?.cost).toEqual((resolved as ProviderRuntimeModel).cost);
860861
});
861862

863+
it.each(["claude-sonnet-5", "claude-opus-5"])(
864+
"uses operator-configured %s pricing for assistant usage",
865+
async (modelId) => {
866+
const provider = await registerSingleProviderPlugin(anthropicPlugin);
867+
const configuredCost = { input: 777, output: 888, cacheRead: 999, cacheWrite: 666 };
868+
const config: NonNullable<ProviderResolveDynamicModelContext["config"]> = {
869+
models: {
870+
providers: {
871+
anthropic: {
872+
baseUrl: "https://api.anthropic.com",
873+
models: [
874+
{
875+
id: modelId,
876+
name: modelId,
877+
reasoning: true,
878+
input: ["text", "image"],
879+
cost: configuredCost,
880+
contextWindow: 1_000_000,
881+
maxTokens: 128_000,
882+
},
883+
],
884+
},
885+
},
886+
},
887+
};
888+
const discoveredModel = provider.resolveDynamicModel?.({
889+
config,
890+
provider: "anthropic",
891+
modelId,
892+
modelRegistry: createModelRegistry([]),
893+
} as ProviderResolveDynamicModelContext);
894+
expect(discoveredModel).toBeDefined();
895+
896+
const configuredModel = {
897+
...(discoveredModel as ProviderRuntimeModel),
898+
cost: configuredCost,
899+
};
900+
const resolvedModel =
901+
provider.normalizeResolvedModel?.({
902+
config,
903+
provider: "anthropic",
904+
modelId,
905+
model: configuredModel,
906+
} as never) ?? configuredModel;
907+
const usage: Usage = {
908+
input: 1_000,
909+
output: 1_000,
910+
cacheRead: 1_000,
911+
cacheWrite: 1_000,
912+
totalTokens: 4_000,
913+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },
914+
};
915+
916+
calculateCost(resolvedModel as Parameters<typeof calculateCost>[0], usage);
917+
918+
expect(resolvedModel.cost).toEqual(configuredCost);
919+
expect(usage.cost.input).toBeCloseTo(0.777);
920+
expect(usage.cost.output).toBeCloseTo(0.888);
921+
expect(usage.cost.cacheRead).toBeCloseTo(0.999);
922+
expect(usage.cost.cacheWrite).toBeCloseTo(0.666);
923+
expect(usage.cost.total).toBeCloseTo(3.33);
924+
},
925+
);
926+
862927
it("resolves Claude Mythos 5 with its direct-only mandatory-adaptive contract", async () => {
863928
const provider = await registerSingleProviderPlugin(anthropicPlugin);
864929
const resolved = provider.resolveDynamicModel?.({

‎extensions/anthropic/register.runtime.ts‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,10 +631,11 @@ function supportsAnthropicNativeMaxEffort(modelId: string): boolean {
631631
return supportsClaudeNativeMaxEffort({ id: modelId }) || isAnthropicMythosPreviewModel(modelId);
632632
}
633633

634-
function hasConfiguredModelContextOverride(
634+
function hasConfiguredModelOverride(
635635
config: ProviderNormalizeResolvedModelContext["config"],
636636
provider: string,
637637
modelId: string,
638+
override: "context" | "cost",
638639
): boolean {
639640
const providers = config?.models?.providers;
640641
if (!providers || typeof providers !== "object") {
@@ -657,8 +658,10 @@ function hasConfiguredModelContextOverride(
657658
continue;
658659
}
659660
if (
660-
(typeof model?.contextTokens === "number" && model.contextTokens > 0) ||
661-
(typeof model?.contextWindow === "number" && model.contextWindow > 0)
661+
override === "cost"
662+
? model?.cost !== undefined
663+
: (typeof model?.contextTokens === "number" && model.contextTokens > 0) ||
664+
(typeof model?.contextWindow === "number" && model.contextWindow > 0)
662665
) {
663666
return true;
664667
}
@@ -681,7 +684,7 @@ function applyAnthropicFixedContextWindow(params: {
681684
if (fixedContextWindow === undefined) {
682685
return undefined;
683686
}
684-
if (hasConfiguredModelContextOverride(params.config, params.provider, params.modelId)) {
687+
if (hasConfiguredModelOverride(params.config, params.provider, params.modelId, "context")) {
685688
return undefined;
686689
}
687690
const exactContextWindow = isAnthropicExact1MClaude5Model(params.contractModelId);
@@ -878,8 +881,10 @@ function normalizeAnthropicResolvedModel(
878881
contractModelId,
879882
model: thinkingLevelModel,
880883
}) ?? thinkingLevelModel;
884+
// Provider catalog defaults must not replace explicit operator pricing.
881885
const pricingModel =
882-
normalizeLowercaseStringOrEmpty(ctx.provider) === PROVIDER_ID
886+
normalizeLowercaseStringOrEmpty(ctx.provider) === PROVIDER_ID &&
887+
!hasConfiguredModelOverride(ctx.config, ctx.provider, ctx.modelId, "cost")
883888
? (applyAnthropicOpus5Cost({
884889
modelId: contractModelId,
885890
model: contextWindowModel,

‎extensions/browser/src/browser/client-fetch.attach-only.e2e.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ describe("browser client fetch attachOnly diagnostics", () => {
5555
hung: {
5656
cdpUrl: `http://127.0.0.1:${port}`,
5757
attachOnly: true,
58-
color: "#00AA00",
5958
},
6059
},
6160
},

‎extensions/discord/index.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export default defineBundledChannelEntry({
2424
registerFull(api) {
2525
registerDiscordActivities(api);
2626
registerDiscordSubagentHooks(api);
27+
},
28+
registerCapabilities(api) {
2729
api.registerTranscriptSourceProvider(discordVoiceTranscriptsSourceProvider);
2830
},
2931
});

0 commit comments

Comments
 (0)