opencode-codebuddy-external-auth 1.0.8 → 1.0.9

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.
Files changed (2) hide show
  1. package/dist/plugin.js +27 -10
  2. package/package.json +1 -1
package/dist/plugin.js CHANGED
@@ -53,14 +53,31 @@ function convertMessagesToPrompt(messages) {
53
53
  */
54
54
  function createOpenAIStreamResponse(text, model) {
55
55
  const encoder = new TextEncoder();
56
+ const id = `chatcmpl-${Date.now()}`;
57
+ const created = Math.floor(Date.now() / 1000);
56
58
  return new ReadableStream({
57
59
  start(controller) {
58
- // Send the content in a single chunk
59
- const chunk = {
60
- id: `chatcmpl-${Date.now()}`,
60
+ // First chunk with role
61
+ const roleChunk = {
62
+ id,
61
63
  object: "chat.completion.chunk",
62
- created: Math.floor(Date.now() / 1000),
63
- model: model,
64
+ created,
65
+ model,
66
+ choices: [
67
+ {
68
+ index: 0,
69
+ delta: { role: "assistant" },
70
+ finish_reason: null,
71
+ },
72
+ ],
73
+ };
74
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(roleChunk)}\n\n`));
75
+ // Content chunk
76
+ const contentChunk = {
77
+ id,
78
+ object: "chat.completion.chunk",
79
+ created,
80
+ model,
64
81
  choices: [
65
82
  {
66
83
  index: 0,
@@ -69,13 +86,13 @@ function createOpenAIStreamResponse(text, model) {
69
86
  },
70
87
  ],
71
88
  };
72
- controller.enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
73
- // Send done signal
89
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(contentChunk)}\n\n`));
90
+ // Done chunk
74
91
  const doneChunk = {
75
- id: `chatcmpl-${Date.now()}`,
92
+ id,
76
93
  object: "chat.completion.chunk",
77
- created: Math.floor(Date.now() / 1000),
78
- model: model,
94
+ created,
95
+ model,
79
96
  choices: [
80
97
  {
81
98
  index: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codebuddy-external-auth",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "OpenCode plugin for CodeBuddy External (IOA) authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",