@x12i/openrouter-runtime 2.1.0 → 2.2.1
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 +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -63,7 +63,7 @@ You can still pass an explicit `logger` to override the console logger.
|
|
|
63
63
|
|
|
64
64
|
`agentId` is optional. When it is set, OpenRouter's activity log shows it in the **App** column. The runtime sends that value as `X-Title` and `X-OpenRouter-Title`, after `defaultHeaders`, so it wins over `appAttribution.appName` for that call. `appAttribution.siteUrl` is still sent as `HTTP-Referer` when set. Omit `agentId` when you do not have one.
|
|
65
65
|
|
|
66
|
-
`metadata` is optional. String, number, and boolean values, plus `agentId`, are stored as one record on the request `metadata` object: `m.0`, `m.1`, and so on. Read it back with `decodeProviderMetadata
|
|
66
|
+
`metadata` is optional. String, number, and boolean values, plus `agentId`, are stored as one record on the request `metadata` object: `m.0`, `m.1`, and so on. Read it back with `decodeProviderMetadata` (wire object or its JSON string, such as Cloudflare `cf-aig-metadata`). The original `metadata` object is still copied onto the normalized response. Objects and arrays are not stored in the record. The record must fit in 16 pieces of 256 characters.
|
|
67
67
|
|
|
68
68
|
```ts
|
|
69
69
|
await runtime.run({
|
package/dist/index.cjs
CHANGED
|
@@ -20,15 +20,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
METADATA_NORMALIZATION_MAP: () => import_provider_metadata2.METADATA_NORMALIZATION_MAP,
|
|
23
24
|
OPENROUTER_METADATA_LIMITS: () => OPENROUTER_METADATA_LIMITS,
|
|
24
25
|
OpenRouterHttpError: () => OpenRouterHttpError,
|
|
25
26
|
RuntimeConfigError: () => RuntimeConfigError,
|
|
26
27
|
buildOpenRouterServerTools: () => buildOpenRouterServerTools,
|
|
28
|
+
canonicalMetadataKey: () => import_provider_metadata2.canonicalMetadataKey,
|
|
27
29
|
compileRuntimeRequest: () => compileRuntimeRequest,
|
|
28
30
|
createConsoleLogger: () => createConsoleLogger,
|
|
29
31
|
createOpenRouterRuntime: () => createOpenRouterRuntime,
|
|
30
32
|
decodeProviderMetadata: () => decodeProviderMetadata,
|
|
31
33
|
isRuntimeLoggingEnabled: () => isRuntimeLoggingEnabled,
|
|
34
|
+
normalizeMetadata: () => import_provider_metadata2.normalizeMetadata,
|
|
32
35
|
packProviderRecord: () => packProviderRecord,
|
|
33
36
|
toProviderMetadata: () => toProviderMetadata
|
|
34
37
|
});
|
|
@@ -931,6 +934,7 @@ function buildSubagentTool(policy, fallbackReasoning) {
|
|
|
931
934
|
|
|
932
935
|
// src/utils/provider-metadata.ts
|
|
933
936
|
var import_provider_metadata = require("@x12i/provider-metadata");
|
|
937
|
+
var import_provider_metadata2 = require("@x12i/provider-metadata");
|
|
934
938
|
var OPENROUTER_METADATA_LIMITS = {
|
|
935
939
|
maxPairs: 16,
|
|
936
940
|
maxKeyLength: 64,
|
|
@@ -1903,15 +1907,18 @@ function operatorHintFor(code) {
|
|
|
1903
1907
|
}
|
|
1904
1908
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1905
1909
|
0 && (module.exports = {
|
|
1910
|
+
METADATA_NORMALIZATION_MAP,
|
|
1906
1911
|
OPENROUTER_METADATA_LIMITS,
|
|
1907
1912
|
OpenRouterHttpError,
|
|
1908
1913
|
RuntimeConfigError,
|
|
1909
1914
|
buildOpenRouterServerTools,
|
|
1915
|
+
canonicalMetadataKey,
|
|
1910
1916
|
compileRuntimeRequest,
|
|
1911
1917
|
createConsoleLogger,
|
|
1912
1918
|
createOpenRouterRuntime,
|
|
1913
1919
|
decodeProviderMetadata,
|
|
1914
1920
|
isRuntimeLoggingEnabled,
|
|
1921
|
+
normalizeMetadata,
|
|
1915
1922
|
packProviderRecord,
|
|
1916
1923
|
toProviderMetadata
|
|
1917
1924
|
});
|