opencodekit 0.19.2 → 0.19.4
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.js +1 -1
- package/dist/template/.opencode/context/git-context.md +32 -0
- package/dist/template/.opencode/dcp-prompts/defaults/README.md +40 -0
- package/dist/template/.opencode/dcp-prompts/defaults/compress-message.md +42 -0
- package/dist/template/.opencode/dcp-prompts/defaults/compress-range.md +59 -0
- package/dist/template/.opencode/dcp-prompts/defaults/context-limit-nudge.md +21 -0
- package/dist/template/.opencode/dcp-prompts/defaults/iteration-nudge.md +5 -0
- package/dist/template/.opencode/dcp-prompts/defaults/system.md +44 -0
- package/dist/template/.opencode/dcp-prompts/defaults/turn-nudge.md +8 -0
- package/dist/template/.opencode/dcp-prompts/overrides/compress-message.md +71 -0
- package/dist/template/.opencode/dcp.jsonc +100 -81
- package/dist/template/.opencode/memory.db +0 -0
- package/dist/template/.opencode/memory.db-shm +0 -0
- package/dist/template/.opencode/memory.db-wal +0 -0
- package/dist/template/.opencode/opencode.json +1685 -1683
- package/dist/template/.opencode/opencodex-fast.jsonc +3 -0
- package/dist/template/.opencode/package.json +1 -1
- package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-chat-language-model.ts +12 -12
- package/dist/template/.opencode/skill/compaction/SKILL.md +69 -2
- package/package.json +1 -1
- package/dist/template/.opencode/memory.db.corrupt.1774156595899 +0 -0
- package/dist/template/.opencode/memory.db.corrupt.1774156595899-shm +0 -0
- package/dist/template/.opencode/memory.db.corrupt.1774156595899-wal +0 -0
package/dist/template/.opencode/plugin/sdk/copilot/chat/openai-compatible-chat-language-model.ts
CHANGED
|
@@ -9,22 +9,22 @@ import {
|
|
|
9
9
|
type SharedV2ProviderMetadata,
|
|
10
10
|
} from "@ai-sdk/provider";
|
|
11
11
|
import {
|
|
12
|
-
type FetchFunction,
|
|
13
|
-
type ParseResult,
|
|
14
|
-
type ResponseHandler,
|
|
15
12
|
combineHeaders,
|
|
16
13
|
createEventSourceResponseHandler,
|
|
17
14
|
createJsonErrorResponseHandler,
|
|
18
15
|
createJsonResponseHandler,
|
|
16
|
+
type FetchFunction,
|
|
19
17
|
generateId,
|
|
20
18
|
isParsableJson,
|
|
19
|
+
type ParseResult,
|
|
21
20
|
parseProviderOptions,
|
|
22
21
|
postJsonToApi,
|
|
22
|
+
type ResponseHandler,
|
|
23
23
|
} from "@ai-sdk/provider-utils";
|
|
24
24
|
import { z } from "zod/v4";
|
|
25
25
|
import {
|
|
26
|
-
type ProviderErrorStructure,
|
|
27
26
|
defaultOpenAICompatibleErrorStructure,
|
|
27
|
+
type ProviderErrorStructure,
|
|
28
28
|
} from "../openai-compatible-error.js";
|
|
29
29
|
import { convertToOpenAICompatibleChatMessages } from "./convert-to-openai-compatible-chat-messages.js";
|
|
30
30
|
import { getResponseMetadata } from "./get-response-metadata.js";
|
|
@@ -482,15 +482,15 @@ export class OpenAICompatibleChatLanguageModel implements LanguageModelV2 {
|
|
|
482
482
|
const delta = choice.delta;
|
|
483
483
|
|
|
484
484
|
// Capture reasoning_opaque for Copilot multi-turn reasoning
|
|
485
|
+
// Claude models can send multiple reasoning_opaque delta chunks
|
|
486
|
+
// during streaming (especially with parallel tool calls).
|
|
487
|
+
// Concatenate them instead of throwing — same pattern as content/arguments.
|
|
488
|
+
// See: https://github.com/anomalyco/opencode/issues/17011
|
|
485
489
|
if (delta.reasoning_opaque) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
"Multiple reasoning_opaque values received in a single response. Only one thinking part per response is supported.",
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
reasoningOpaque = delta.reasoning_opaque;
|
|
490
|
+
reasoningOpaque =
|
|
491
|
+
reasoningOpaque != null
|
|
492
|
+
? reasoningOpaque + delta.reasoning_opaque
|
|
493
|
+
: delta.reasoning_opaque;
|
|
494
494
|
}
|
|
495
495
|
|
|
496
496
|
// enqueue reasoning before text deltas (Copilot uses reasoning_text):
|
|
@@ -19,7 +19,6 @@ dependencies: []
|
|
|
19
19
|
|
|
20
20
|
- Short sessions with low context usage where no compaction is needed.
|
|
21
21
|
|
|
22
|
-
|
|
23
22
|
## Overview
|
|
24
23
|
|
|
25
24
|
**Compaction = Summarization + Preservation + Continuity**
|
|
@@ -53,7 +52,6 @@ Pay attention to these signals:
|
|
|
53
52
|
|
|
54
53
|
Compress completed conversation phases into dense summaries. This is the primary DCP instrument in the installed beta.
|
|
55
54
|
|
|
56
|
-
|
|
57
55
|
Compress completed conversation phases into dense summaries.
|
|
58
56
|
|
|
59
57
|
```
|
|
@@ -267,6 +265,75 @@ This project uses `@tarquinen/opencode-dcp` for always-on context management (in
|
|
|
267
265
|
- **DCP plugin**: Context budget rules, tool guidance, prunable-tools list, nudges (always present via system prompt)
|
|
268
266
|
- **Compaction plugin** (`.opencode/plugin/compaction.ts`): Session continuity, beads state, handoff recovery, post-compaction protocol (fires during compaction events only)
|
|
269
267
|
|
|
268
|
+
**Custom prompts (enabled):**
|
|
269
|
+
|
|
270
|
+
DCP custom prompts are enabled (`experimental.customPrompts: true`). Override files live at `.opencode/dcp-prompts/overrides/`:
|
|
271
|
+
|
|
272
|
+
- `compress-message.md` — 9-section structured summary format (Primary Request, Key Technical Concepts, Files/Code, Errors/Fixes, Problem Solving, User Messages, Pending Tasks, Current Work, Next Step)
|
|
273
|
+
|
|
274
|
+
Override precedence: project (`.opencode/dcp-prompts/overrides/`) > config dir > global (`~/.config/opencode/dcp-prompts/overrides/`).
|
|
275
|
+
|
|
276
|
+
## Post-Compaction Restoration Protocol
|
|
277
|
+
|
|
278
|
+
**Critical:** After any compaction (server-side or DCP compress), you lose raw file content and active context. Immediately restore:
|
|
279
|
+
|
|
280
|
+
### Step 1: Re-read Active Files (max 5)
|
|
281
|
+
|
|
282
|
+
Re-read the files you were actively editing before compaction. Prioritize by recency — most recently modified first. Cap at 5 files, use offset/limit to read only the sections you need (~200 lines each).
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
After compaction, if you were editing src/auth.ts:
|
|
286
|
+
read({ filePath: "src/auth.ts", offset: 30, limit: 50 })
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**Why:** The Write/Edit tool requires a prior Read in the same session (`FileTime.assert()`). Without re-reading, your next edit attempt will fail.
|
|
290
|
+
|
|
291
|
+
### Step 2: Restore Active Skill Context
|
|
292
|
+
|
|
293
|
+
If you were using a skill before compaction, re-load it:
|
|
294
|
+
|
|
295
|
+
```typescript
|
|
296
|
+
skill({ name: "<active-skill>" });
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Skills are prompt-injected — compaction drops them. Re-load to restore the workflow.
|
|
300
|
+
|
|
301
|
+
### Step 3: Check Todo State
|
|
302
|
+
|
|
303
|
+
Review your TodoWrite list to re-establish task tracking:
|
|
304
|
+
|
|
305
|
+
```
|
|
306
|
+
- What was in_progress?
|
|
307
|
+
- What was pending?
|
|
308
|
+
- What was completed?
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Step 4: Verify Git Position
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
git branch --show-current
|
|
315
|
+
git status --short
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Confirms you're on the right branch and shows any uncommitted changes.
|
|
319
|
+
|
|
320
|
+
### Step 5: Scan Memory for Context
|
|
321
|
+
|
|
322
|
+
If the compaction was heavy (>50% reduction), check memory for recent observations:
|
|
323
|
+
|
|
324
|
+
```typescript
|
|
325
|
+
memory - search({ query: "<current task keywords>", limit: 3 });
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### Why This Protocol Exists
|
|
329
|
+
|
|
330
|
+
Compaction strips raw file content, tool outputs, and skill prompts. Without restoration:
|
|
331
|
+
|
|
332
|
+
- File edits fail (`FileTime.assert` — no prior read)
|
|
333
|
+
- Line-number precision is lost (you're guessing, not citing)
|
|
334
|
+
- Skill workflows are inactive (no prompt injection)
|
|
335
|
+
- Task tracking is disconnected (todos lost in compressed summary)
|
|
336
|
+
|
|
270
337
|
## Anti-Patterns
|
|
271
338
|
|
|
272
339
|
### ❌ Premature Compaction
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
File without changes
|