@demicodes/provider-openai-api 0.7.0 → 0.7.2

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/dist/index.d.mts CHANGED
@@ -25,6 +25,13 @@ interface OpenAIApiRequestOptions {
25
25
  maxRetries?: number;
26
26
  streamOptions?: Record<string, unknown> | null;
27
27
  extraBody?: Record<string, unknown>;
28
+ /**
29
+ * Emit `status: 'completed'` on replayed assistant messages. Gateways that validate
30
+ * input against the full Responses item schema require it — Volcengine Ark rejects the
31
+ * item with `missing input.status` — while relay bridges reject it as an unknown
32
+ * parameter, so it stays off unless the provider opts in.
33
+ */
34
+ replayAssistantStatus?: boolean;
28
35
  }
29
36
  type OpenAIApiWireApi = 'responses' | 'chat-completions';
30
37
  interface OpenAIApiProviderOptions {
package/dist/index.mjs CHANGED
@@ -266,7 +266,7 @@ function createOpenAIApiProvider(options = {}) {
266
266
  function buildOpenAIResponsesBody(request, options) {
267
267
  const body = {
268
268
  model: request.modelId,
269
- input: request.items.flatMap((item, index) => inferenceItemToOpenAIResponseInput(item, index)),
269
+ input: request.items.flatMap((item, index) => inferenceItemToOpenAIResponseInput(item, index, options)),
270
270
  stream: true,
271
271
  store: false,
272
272
  include: ["reasoning.encrypted_content"],
@@ -630,7 +630,7 @@ function* flushOpenAIToolCalls(toolCalls) {
630
630
  }
631
631
  toolCalls.clear();
632
632
  }
633
- function inferenceItemToOpenAIResponseInput(item, index) {
633
+ function inferenceItemToOpenAIResponseInput(item, index, options) {
634
634
  switch (item.type) {
635
635
  case "user_message":
636
636
  case "user_steer": return [{
@@ -640,6 +640,7 @@ function inferenceItemToOpenAIResponseInput(item, index) {
640
640
  case "assistant_text": return [{
641
641
  type: "message",
642
642
  role: "assistant",
643
+ ...options?.replayAssistantStatus ? { status: "completed" } : {},
643
644
  content: [{
644
645
  type: "output_text",
645
646
  text: item.text,
@@ -726,9 +727,10 @@ function thinkingToOpenAIReasoning(thinking) {
726
727
  summary: "auto"
727
728
  };
728
729
  if (thinking.effort === "none") return { effort: "none" };
730
+ if (thinking.summary === "off") return { effort: thinking.effort };
729
731
  return {
730
732
  effort: thinking.effort,
731
- summary: thinking.summary && thinking.summary !== "off" ? thinking.summary : "auto"
733
+ summary: thinking.summary ?? "auto"
732
734
  };
733
735
  }
734
736
  function splitOpenAIResponseToolUseId(toolUseId) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@demicodes/provider-openai-api",
3
3
  "description": "OpenAI API provider adapter for Demi.",
4
- "version": "0.7.0",
4
+ "version": "0.7.2",
5
5
  "private": false,
6
6
  "type": "module",
7
7
  "exports": {
@@ -11,9 +11,9 @@
11
11
  }
12
12
  },
13
13
  "dependencies": {
14
- "@demicodes/core": "^0.7.0",
15
- "@demicodes/provider": "^0.7.0",
16
- "@demicodes/utils": "^0.7.0"
14
+ "@demicodes/core": "^0.7.2",
15
+ "@demicodes/provider": "^0.7.2",
16
+ "@demicodes/utils": "^0.7.2"
17
17
  },
18
18
  "license": "Apache-2.0",
19
19
  "main": "./dist/index.mjs",