@coseung2/opencodex 2.8.0-cs.16 → 2.8.0-cs.17
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/{index-BZGMtkmp.js → index-Ch-99jy3.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/base.ts +12 -0
- package/src/adapters/kiro-calibration.ts +83 -0
- package/src/adapters/kiro-constants.ts +11 -2
- package/src/adapters/kiro-errors.ts +11 -0
- package/src/adapters/kiro-events.ts +19 -1
- package/src/adapters/kiro-thinking.ts +18 -2
- package/src/adapters/kiro-tools.ts +12 -3
- package/src/adapters/kiro.ts +300 -78
- package/src/adapters/openai-chat.ts +1 -42
- package/src/adapters/openai-responses.ts +93 -14
- package/src/adapters/xai-schema-analysis.ts +78 -0
- package/src/adapters/xai-tool-schema.ts +274 -0
- package/src/adapters/xai-web-search.ts +138 -0
- package/src/bridge.ts +61 -6
- package/src/codex/catalog/effort.ts +4 -2
- package/src/codex/catalog/metadata.ts +38 -9
- package/src/codex/catalog/parsing.ts +17 -2
- package/src/codex/catalog/provider-fetch.ts +9 -3
- package/src/codex/catalog/sync.ts +8 -5
- package/src/codex/data/upstream-models.json +169 -0
- package/src/grok/inject.ts +1 -1
- package/src/lib/token-estimate.ts +42 -38
- package/src/lib/translator-budget.ts +34 -0
- package/src/oauth/index.ts +10 -4
- package/src/oauth/kiro.ts +71 -6
- package/src/oauth/store.ts +3 -1
- package/src/oauth/types.ts +4 -0
- package/src/providers/derive.ts +7 -5
- package/src/providers/opencode-go-transport.ts +18 -0
- package/src/providers/registry.ts +34 -10
- package/src/providers/xai-transport.ts +10 -0
- package/src/responses/compaction.ts +8 -1
- package/src/responses/namespace-aliases.ts +56 -0
- package/src/responses/parser.ts +12 -0
- package/src/responses/reasoning-envelope.ts +9 -1
- package/src/responses/snapshot-policy.ts +108 -0
- package/src/responses/state.ts +23 -10
- package/src/responses/turn-termination.ts +108 -0
- package/src/responses/xai-custom-tool-compat.ts +237 -0
- package/src/server/grok-responses-snapshot-repair.ts +338 -0
- package/src/server/index.ts +2 -1
- package/src/server/relay-eager.ts +1 -0
- package/src/server/responses/core.ts +173 -13
- package/src/server/responses-image-gen-repair.ts +2 -2
- package/src/server/sse-payload-rewrite.ts +20 -3
- package/src/types.ts +10 -1
- package/src/usage/cost.ts +0 -0
- package/src/usage/expected-prices.ts +7 -0
- package/vendor/ocx-notch/win32-x64/ocx-notch.exe +0 -0
|
@@ -75,6 +75,14 @@ export class KiroThinkingParser {
|
|
|
75
75
|
return [];
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
/** Release any partial tag/content carry when the owning stream stops early. */
|
|
79
|
+
dispose(): void {
|
|
80
|
+
this.replaceCarry("preBuffer", "");
|
|
81
|
+
this.replaceCarry("thinkingBuffer", "");
|
|
82
|
+
this.closeTag = "";
|
|
83
|
+
this.state = "streaming";
|
|
84
|
+
}
|
|
85
|
+
|
|
78
86
|
private drainThinking(): AdapterEvent[] {
|
|
79
87
|
const close = this.closeTag;
|
|
80
88
|
const idx = this.thinkingBuffer.indexOf(close);
|
|
@@ -89,8 +97,16 @@ export class KiroThinkingParser {
|
|
|
89
97
|
return events;
|
|
90
98
|
}
|
|
91
99
|
if (this.thinkingBuffer.length <= MAX_CLOSE_TAG) return [];
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
// Never split a surrogate pair at the send boundary: a lone high
|
|
101
|
+
// surrogate at the end of one delta encodes as U+FFFD. Move the cut one
|
|
102
|
+
// unit earlier so the whole pair stays in the carry.
|
|
103
|
+
let cut = this.thinkingBuffer.length - MAX_CLOSE_TAG;
|
|
104
|
+
if (cut > 0 && cut < this.thinkingBuffer.length) {
|
|
105
|
+
const atCut = this.thinkingBuffer.charCodeAt(cut - 1);
|
|
106
|
+
if (atCut >= 0xd800 && atCut <= 0xdbff) cut -= 1;
|
|
107
|
+
}
|
|
108
|
+
const send = this.thinkingBuffer.slice(0, cut);
|
|
109
|
+
this.replaceCarry("thinkingBuffer", this.thinkingBuffer.slice(cut));
|
|
94
110
|
return send ? [{ type: "reasoning_raw_delta", text: send }] : [];
|
|
95
111
|
}
|
|
96
112
|
}
|
|
@@ -103,7 +103,7 @@ function ensureRootObjectType(schema: unknown): Record<string, unknown> {
|
|
|
103
103
|
// Seed with the root's own properties/required so a schema like
|
|
104
104
|
// { type:"object", properties:{path}, required:["path"], oneOf:[...] } keeps them.
|
|
105
105
|
if (obj.properties && typeof obj.properties === "object") {
|
|
106
|
-
Object.assign(props,
|
|
106
|
+
Object.assign(props, sanitizeSchemaMap(obj.properties) as Record<string, unknown>);
|
|
107
107
|
}
|
|
108
108
|
if (Array.isArray(obj.required)) {
|
|
109
109
|
for (const r of obj.required) if (typeof r === "string") required.add(r);
|
|
@@ -118,7 +118,7 @@ function ensureRootObjectType(schema: unknown): Record<string, unknown> {
|
|
|
118
118
|
if (!variant || typeof variant !== "object" || Array.isArray(variant)) continue;
|
|
119
119
|
const v = variant as Record<string, unknown>;
|
|
120
120
|
if (v.properties && typeof v.properties === "object") {
|
|
121
|
-
Object.assign(props,
|
|
121
|
+
Object.assign(props, sanitizeSchemaMap(v.properties) as Record<string, unknown>);
|
|
122
122
|
}
|
|
123
123
|
if (mergeRequired && Array.isArray(v.required)) {
|
|
124
124
|
for (const r of v.required) if (typeof r === "string") required.add(r);
|
|
@@ -149,7 +149,16 @@ function toolDescriptionLimit(modelId: string): number {
|
|
|
149
149
|
function truncateDescription(description: string, limit: number): string {
|
|
150
150
|
if (description.length <= limit) return description;
|
|
151
151
|
if (limit <= 1) return description.slice(0, limit);
|
|
152
|
-
|
|
152
|
+
let end = limit - 1;
|
|
153
|
+
// Never end the kept text on a lone high surrogate; one step back keeps
|
|
154
|
+
// the whole pair out instead of a U+FFFD-producing half.
|
|
155
|
+
if (description.charCodeAt(end - 1) >= 0xd800 && description.charCodeAt(end - 1) <= 0xdbff) end -= 1;
|
|
156
|
+
return `${description.slice(0, end)}…`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Test-only: exercise the surrogate-safe description truncation directly. */
|
|
160
|
+
export function truncateDescriptionForTests(description: string, limit: number): string {
|
|
161
|
+
return truncateDescription(description, limit);
|
|
153
162
|
}
|
|
154
163
|
|
|
155
164
|
function serializedToolCatalogBytes(tools: readonly unknown[]): number {
|