@eddyskywalker/dsh-chatgpt-subscription 0.1.35 → 0.1.37

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/lib/index.js CHANGED
@@ -187,16 +187,19 @@ function resolveCodexModel(model, preferences) {
187
187
  //#region src/host/adapter.ts
188
188
  const RETRY_POLICY = resolveRetryPolicy({
189
189
  mode: "normal",
190
- maxRetries: 2,
190
+ maxRetries: 3,
191
191
  retryableCodes: [
192
192
  "RATE_LIMIT",
193
193
  "SERVER_ERROR",
194
- "NETWORK"
194
+ "SERVER",
195
+ "NETWORK",
196
+ "TIMEOUT",
197
+ "TRANSPORT"
195
198
  ],
196
199
  backoff: {
197
- initialDelayMs: 1e3,
198
- maxDelayMs: 1e4,
199
- jitterRatio: .15
200
+ initialDelayMs: 1500,
201
+ maxDelayMs: 15e3,
202
+ jitterRatio: .2
200
203
  }
201
204
  }, "dsh-chatgpt-subscription.retry");
202
205
  var CodexChatGptAdapter = class extends LlmAdapter {
@@ -1917,9 +1920,9 @@ async function* parseResponsesStream(response, signal, hiddenSandboxControls = /
1917
1920
  if (tool === void 0) {
1918
1921
  tool = {
1919
1922
  index: nextIndex++,
1920
- id: string(item?.call_id) ?? string(event.call_id) ?? `call_${key}`,
1923
+ id: acceptIdentity(`call_${key}`, item?.call_id ?? event.call_id),
1921
1924
  itemId,
1922
- name: string(item?.name) ?? string(event.name) ?? "",
1925
+ name: acceptIdentity("", item?.name ?? event.name),
1923
1926
  arguments: "",
1924
1927
  started: false
1925
1928
  };
@@ -1978,8 +1981,8 @@ async function* parseResponsesStream(response, signal, hiddenSandboxControls = /
1978
1981
  if (item !== null && type === "response.output_item.done") replayOutput.push(structuredClone(item));
1979
1982
  if (string(item?.type) !== "function_call") return;
1980
1983
  const tool = toolFor(event, item ?? void 0);
1981
- tool.id = string(item?.call_id) ?? tool.id;
1982
- tool.name = string(item?.name) ?? tool.name;
1984
+ tool.id = acceptIdentity(tool.id, item?.call_id);
1985
+ tool.name = acceptIdentity(tool.name, item?.name);
1983
1986
  const initial = string(item?.arguments) ?? "";
1984
1987
  if (!tool.started) {
1985
1988
  tool.started = true;
@@ -2001,6 +2004,8 @@ async function* parseResponsesStream(response, signal, hiddenSandboxControls = /
2001
2004
  }
2002
2005
  if (type === "response.function_call_arguments.delta") {
2003
2006
  const tool = toolFor(event);
2007
+ tool.id = acceptIdentity(tool.id, event.call_id);
2008
+ tool.name = acceptIdentity(tool.name, event.name);
2004
2009
  const delta = string(event.delta) ?? "";
2005
2010
  if (!tool.started) {
2006
2011
  tool.started = true;
@@ -2022,6 +2027,8 @@ async function* parseResponsesStream(response, signal, hiddenSandboxControls = /
2022
2027
  }
2023
2028
  if (type === "response.function_call_arguments.done") {
2024
2029
  const tool = toolFor(event);
2030
+ tool.id = acceptIdentity(tool.id, event.call_id);
2031
+ tool.name = acceptIdentity(tool.name, event.name);
2025
2032
  const finalArguments = string(event.arguments);
2026
2033
  if (finalArguments !== void 0) tool.arguments = finalArguments;
2027
2034
  return;
@@ -2036,7 +2043,10 @@ async function* parseResponsesStream(response, signal, hiddenSandboxControls = /
2036
2043
  }
2037
2044
  if (type === "response.failed" || type === "error") {
2038
2045
  const error = record$1(event.error) ?? record$1(record$1(event.response)?.error);
2039
- throw new LlmError(string(error?.message) ?? "Codex generation failed.", string(error?.code) ?? "PROVIDER_ERROR");
2046
+ const message = string(error?.message) ?? "Codex generation failed.";
2047
+ const rawCode = string(error?.code)?.toLowerCase();
2048
+ const isOverload = message.toLowerCase().includes("overload") || message.toLowerCase().includes("server error") || rawCode === "server_error" || rawCode === "service_unavailable" || rawCode === "internal_error";
2049
+ throw new LlmError(message, message.toLowerCase().includes("rate limit") || rawCode === "rate_limit" ? "RATE_LIMIT" : isOverload ? "SERVER_ERROR" : string(error?.code)?.toUpperCase() ?? "PROVIDER_ERROR");
2040
2050
  }
2041
2051
  };
2042
2052
  try {
@@ -2207,6 +2217,9 @@ function number(value) {
2207
2217
  const parsed = Number(value);
2208
2218
  return Number.isFinite(parsed) ? parsed : void 0;
2209
2219
  }
2220
+ function acceptIdentity(current, incoming) {
2221
+ return typeof incoming === "string" && incoming.length > 0 ? incoming : current;
2222
+ }
2210
2223
  //#endregion
2211
2224
  //#region src/host/usage-service.ts
2212
2225
  const EMPTY_USAGE = {
@@ -1 +1 @@
1
- {"version":3,"file":"responses-client.d.ts","sourceRoot":"","sources":["../../../src/host/responses-client.ts"],"names":[],"mappings":"AAQA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,WAAW,EAEjB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAwD,KAAK,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAEvH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE,KAAK,SAAS,GAAG,OAAO,KAAK,CAAA;AAK7B,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,SAAS,CAAA;IACnB,cAAc,CAAC,EAAE,oBAAoB,CAAA;IACrC,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAA;IACjC,eAAe,CAAC,EAAE,MAAM,oBAAoB,GAAG,IAAI,CAAA;IACnD,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAA;CACzB;AAED,qBAAa,eAAe;IAOxB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAP9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAW;IACnC,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAGrB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,W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AAO,CAAC,QAAQ,CAAC,oBAAoB,CAAY;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAmC;IACnE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAGrB,KAAK,EAAE,YAAY,EACnB,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,WAAW,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,EAChH,OAAO,GAAE,sBAA2B;IAStC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAE9C,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,aAAa,CAAC,WAAW,CAAC;YAkBrD,IAAI;YAYJ,OAAO;CAsBtB;AAWD,wBAAuB,oBAAoB,CACzC,QAAQ,EAAE,QAAQ,EAClB,MAAM,CAAC,EAAE,WAAW,EACpB,qBAAqB,GAAE,WAAW,CAAC,MAAM,CAAa,GACrD,aAAa,CAAC,WAAW,CAAC,CAsO5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eddyskywalker/dsh-chatgpt-subscription",
3
- "version": "0.1.35",
3
+ "version": "0.1.37",
4
4
  "description": "DSH provider plugin for Codex access through a ChatGPT subscription.",
5
5
  "author": {
6
6
  "name": "eddyskywalker",
@@ -61,40 +61,40 @@
61
61
  "peerDependencies": {
62
62
  "@deepseek-ai/cordis": "^4.0.2",
63
63
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
64
- "@deepseek-ai/dsh-attachment": "^0.1.1-rc.2",
65
- "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2",
66
- "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
67
- "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
68
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
69
- "@deepseek-ai/dsh-client-ui-model-selection": "^0.1.1-rc.2",
70
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2",
71
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
72
- "@deepseek-ai/dsh-client-ui-tool": "^0.1.1-rc.2",
73
- "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.2",
74
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
75
- "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
76
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
77
- "@deepseek-ai/dsh-web": "^0.1.1-rc.2",
64
+ "@deepseek-ai/dsh-attachment": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
65
+ "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
66
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
67
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
68
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
69
+ "@deepseek-ai/dsh-client-ui-model-selection": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
70
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
71
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
72
+ "@deepseek-ai/dsh-client-ui-tool": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
73
+ "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
74
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
75
+ "@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
76
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
77
+ "@deepseek-ai/dsh-web": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
78
78
  "@deepseek-ai/schemastery": "^3.18.2",
79
79
  "react": "^18.2.0"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@deepseek-ai/cordis": "^4.0.2",
83
83
  "@deepseek-ai/cordis-plugin-loader": "^1.0.3",
84
- "@deepseek-ai/dsh-attachment": "^0.1.1-rc.2",
85
- "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2",
86
- "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2",
87
- "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2",
88
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2",
89
- "@deepseek-ai/dsh-client-ui-model-selection": "^0.1.1-rc.2",
90
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2",
91
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2",
92
- "@deepseek-ai/dsh-client-ui-tool": "^0.1.1-rc.2",
93
- "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.2",
94
- "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
95
- "@deepseek-ai/dsh-settings": "^0.1.1-rc.2",
96
- "@deepseek-ai/dsh-tools": "^0.1.1-rc.2",
97
- "@deepseek-ai/dsh-web": "^0.1.1-rc.2",
84
+ "@deepseek-ai/dsh-attachment": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
85
+ "@deepseek-ai/dsh-client-connection": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
86
+ "@deepseek-ai/dsh-client-locale": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
87
+ "@deepseek-ai/dsh-client-runtime": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
88
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
89
+ "@deepseek-ai/dsh-client-ui-model-selection": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
90
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
91
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
92
+ "@deepseek-ai/dsh-client-ui-tool": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
93
+ "@deepseek-ai/dsh-host-webserver": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
94
+ "@deepseek-ai/dsh-llm": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
95
+ "@deepseek-ai/dsh-settings": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
96
+ "@deepseek-ai/dsh-tools": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
97
+ "@deepseek-ai/dsh-web": "^0.1.1-rc.2 || ^0.1.2-alpha.5 || ^0.1.2",
98
98
  "@deepseek-ai/schemastery": "^3.18.2",
99
99
  "@types/node": "^22.20.0",
100
100
  "@types/react": "~18.3.1",