@serkanalgur/opencodev2-slim 2.2.0 → 2.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serkanalgur/opencodev2-slim",
3
- "version": "2.2.0",
3
+ "version": "2.2.1",
4
4
  "description": "Smart context management plugin for OpenCode v2 - semantic compression, cost-aware pruning, adaptive thresholds",
5
5
  "keywords": [
6
6
  "opencode",
package/src/index.ts CHANGED
@@ -279,7 +279,7 @@ export default Plugin.define({
279
279
  required: ["focus"],
280
280
  additionalProperties: false,
281
281
  },
282
- options: { codemode: true },
282
+ options: { codemode: false },
283
283
  execute: async (input, context) => {
284
284
  const args = input as {
285
285
  focus: string
@@ -425,7 +425,7 @@ export default Plugin.define({
425
425
  properties: {},
426
426
  additionalProperties: false,
427
427
  },
428
- options: { codemode: true },
428
+ options: { codemode: false },
429
429
  execute: async (_input, context) => {
430
430
  const sessionId = context.sessionID
431
431
  const config = getConfig(sessionId)
package/src/tui.tsx CHANGED
@@ -270,6 +270,16 @@ export default Plugin.define({
270
270
  description: "What to compress (e.g., 'old exploration')",
271
271
  required: false,
272
272
  },
273
+ {
274
+ name: "mode",
275
+ description: "Compression mode: auto, range, or topic",
276
+ required: false,
277
+ },
278
+ {
279
+ name: "keepRecent",
280
+ description: "Number of recent messages to keep (default: 5)",
281
+ required: false,
282
+ },
273
283
  ],
274
284
  },
275
285
  enabled: true,
@@ -293,18 +303,39 @@ export default Plugin.define({
293
303
  try {
294
304
  const args = (input as any) || {}
295
305
  const focus = args.focus || "user-requested compression"
306
+ const mode = args.mode || "auto"
307
+ const keepRecent = args.keepRecent ?? 5
308
+
309
+ // Measure current state first
310
+ const real = await measureSession(context, sessionID)
311
+
312
+ const statusLine = real
313
+ ? `${real.tokens.toLocaleString()} tokens (${real.usagePercent}% of ${real.contextLimit.toLocaleString()})`
314
+ : "unknown"
315
+
316
+ const text = [
317
+ `**Slim Compress**`,
318
+ ``,
319
+ `**Current state:** ${statusLine}`,
320
+ ``,
321
+ `Ready to compress with:`,
322
+ `- **Focus:** ${focus}`,
323
+ `- **Mode:** ${mode}`,
324
+ `- **Keep recent:** ${keepRecent} messages`,
325
+ ``,
326
+ `> The assistant will now call the compress tool.`,
327
+ `> Or type: \`compress({ focus: "${focus}", mode: "${mode}", keepRecent: ${keepRecent} })\``,
328
+ ].join("\n")
296
329
 
297
- // Inject a synthetic message asking the assistant to compress.
298
- const prompt = `Please call the compress tool now with: compress({ focus: "${focus}", mode: "auto" })`
299
330
  await context.client.session.synthetic({
300
331
  sessionID,
301
- text: prompt,
332
+ text,
302
333
  description: "slim-compress",
303
334
  })
304
335
 
305
336
  context.ui.toast.show({
306
337
  title: "Slim Compress",
307
- message: `Compression requested: "${focus}". The assistant will process it on the next turn.`,
338
+ message: `Compression ready: "${focus}". Assistant will process it.`,
308
339
  variant: "success",
309
340
  duration: 3000,
310
341
  })