backeer-opencode 0.8.2 → 0.10.0

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/src/reporter.js CHANGED
@@ -1,4 +1,4 @@
1
- import { limit } from "./utilities.js"
1
+ import { formatText } from "./utilities.js"
2
2
 
3
3
  const LOG_LEVELS = new Set(["silent", "error", "info", "debug"])
4
4
  const LOG_RANK = { silent: 0, error: 1, info: 2, debug: 3 }
@@ -36,13 +36,10 @@ export function createConsoleReporter(levelValue) {
36
36
  if (previous && now - previous < LOG_DEDUPLICATION_MS) return
37
37
  recentlyEmitted.delete(key)
38
38
  recentlyEmitted.set(key, now)
39
- while (recentlyEmitted.size > 100) {
40
- recentlyEmitted.delete(recentlyEmitted.keys().next().value)
41
- }
42
39
  }
43
40
 
44
41
  const technical = level === "debug" && detail
45
- ? decorate("2", ` · ${limit(detail, 500)}`)
42
+ ? decorate("2", ` · ${formatText(detail)}`)
46
43
  : ""
47
44
  const line = `${symbols[kind]} ${brand} ${message}${technical}`
48
45
  if (kind === "error" || kind === "warning") console.error(line)
@@ -80,10 +77,10 @@ export function createOpenCodeReporter(client, levelValue) {
80
77
  level: kind === "warning" ? "warn" : kind === "applied" || kind === "success"
81
78
  ? "info"
82
79
  : kind,
83
- message: limit(message, 500),
80
+ message: formatText(message),
84
81
  }
85
82
  if (level === "debug" && detail) {
86
- body.extra = { detail: limit(detail?.message ?? detail, 500) }
83
+ body.extra = { detail: formatText(detail?.message ?? detail) }
87
84
  }
88
85
 
89
86
  // Logging during plugin initialization can deadlock older OpenCode builds.
@@ -106,5 +103,4 @@ export function createOpenCodeReporter(client, levelValue) {
106
103
  function rememberRecent(map, key, value) {
107
104
  map.delete(key)
108
105
  map.set(key, value)
109
- while (map.size > 100) map.delete(map.keys().next().value)
110
106
  }
@@ -1,5 +1,5 @@
1
1
  import { FeedbackSessionStore } from "./feedback-session-store.js"
2
- import { limit } from "./utilities.js"
2
+ import { formatText } from "./utilities.js"
3
3
 
4
4
  const FEEDBACK_SYMBOLS = {
5
5
  info: "•",
@@ -82,7 +82,7 @@ export async function sendSessionMessage(client, sessionID, text) {
82
82
 
83
83
  export function formatBackeerFeedback(kind, message) {
84
84
  const symbol = FEEDBACK_SYMBOLS[kind] ?? FEEDBACK_SYMBOLS.info
85
- return `▣ Backeer | ${symbol} ${limit(message, 300)}`
85
+ return `▣ Backeer | ${symbol} ${formatText(message)}`
86
86
  }
87
87
 
88
88
  export function formatBackeerFeedbackBatch(items) {
@@ -93,7 +93,7 @@ export function formatBackeerFeedbackBatch(items) {
93
93
  "▣ Backeer",
94
94
  ...items.map((item) => {
95
95
  const symbol = FEEDBACK_SYMBOLS[item.kind] ?? FEEDBACK_SYMBOLS.info
96
- return `${symbol} ${limit(item.message, 300)}`
96
+ return `${symbol} ${formatText(item.message)}`
97
97
  }),
98
98
  ].join("\n")
99
99
  }
package/src/sse.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { HttpError, isAbortError, sleep } from "./http.js"
2
- import { limit } from "./utilities.js"
2
+ import { formatText } from "./utilities.js"
3
3
 
4
4
  export function parseSseFrame(frame) {
5
5
  const data = []
@@ -87,7 +87,7 @@ async function openCommandStream(config, state, signal, fetchImplementation) {
87
87
  signal,
88
88
  })
89
89
  if (!response.ok) {
90
- const responseBody = limit(await response.text(), 500)
90
+ const responseBody = formatText(await response.text())
91
91
  throw new HttpError(
92
92
  `Backeer command stream failed with status ${response.status}`,
93
93
  response.status,
@@ -123,7 +123,7 @@ async function consumeConnection({
123
123
  function streamErrorState(error, lastLoggedError, reconnectDelay, reporter) {
124
124
  const message = error instanceof HttpError
125
125
  ? `${error.message}: ${error.responseBody}`
126
- : limit(error, 500)
126
+ : formatText(error)
127
127
  if (message !== lastLoggedError) {
128
128
  const authenticationFailure = error instanceof HttpError &&
129
129
  [401, 403].includes(error.status)
@@ -137,7 +137,7 @@ function streamErrorState(error, lastLoggedError, reconnectDelay, reporter) {
137
137
  return {
138
138
  lastLoggedError: message,
139
139
  reconnectDelay: error instanceof HttpError && [401, 403, 404].includes(error.status)
140
- ? 60_000
140
+ ? 3000
141
141
  : reconnectDelay,
142
142
  }
143
143
  }
@@ -156,7 +156,7 @@ export async function runCommandStream(
156
156
  },
157
157
  ) {
158
158
  const state = { lastEventID: "", framesReceived: 0 }
159
- let reconnectDelay = 1000
159
+ let reconnectDelay = 3000
160
160
  let lastLoggedError = ""
161
161
 
162
162
  while (!signal.aborted && hasPending()) {
@@ -176,7 +176,7 @@ export async function runCommandStream(
176
176
  now,
177
177
  stableConnectionMs,
178
178
  onStable: () => {
179
- reconnectDelay = 1000
179
+ reconnectDelay = 3000
180
180
  lastLoggedError = ""
181
181
  },
182
182
  })
@@ -189,7 +189,7 @@ export async function runCommandStream(
189
189
 
190
190
  if (!signal.aborted && hasPending()) {
191
191
  await sleepImplementation(reconnectDelay, signal)
192
- reconnectDelay = Math.min(reconnectDelay * 2, 60_000)
192
+ reconnectDelay = 3000
193
193
  }
194
194
  }
195
195
  }
package/src/updates.js CHANGED
@@ -1,4 +1,4 @@
1
- export const PLUGIN_VERSION = "0.8.2"
1
+ export const PLUGIN_VERSION = "0.10.0"
2
2
 
3
3
  const PACKAGE_NAME = "backeer-opencode"
4
4
  const NPM_REGISTRY_URL = "https://registry.npmjs.org"
package/src/utilities.js CHANGED
@@ -1,7 +1,5 @@
1
- const MAX_TRACKED_ITEMS = 500
2
-
3
- export const limit = (value, length = 1000) =>
4
- String(value ?? "").slice(0, length)
1
+ // Legacy formatting API: normalize text without truncating it.
2
+ export const formatText = value => String(value ?? "")
5
3
 
6
4
  export function enabled(value, fallback = true) {
7
5
  if (typeof value === "boolean") return value
@@ -18,8 +16,7 @@ export function stableHash(value) {
18
16
  return (hash >>> 0).toString(16).padStart(8, "0")
19
17
  }
20
18
 
21
- export function rememberBounded(map, key, value) {
19
+ export function remember(map, key, value) {
22
20
  map.delete(key)
23
21
  map.set(key, value)
24
- while (map.size > MAX_TRACKED_ITEMS) map.delete(map.keys().next().value)
25
22
  }