@howaboua/opencode-chat 0.1.1 → 0.1.3
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/README.md +5 -5
- package/dist/config.js +1 -1
- package/dist/system.d.ts +1 -1
- package/dist/system.d.ts.map +1 -1
- package/dist/system.js +9 -14
- package/dist/tools/glob.js +1 -1
- package/dist/tools/patch.d.ts.map +1 -1
- package/dist/tools/patch.js +18 -26
- package/dist/tools/semantic-search.js +2 -2
- package/dist/util/patch.d.ts.map +1 -1
- package/dist/util/patch.js +13 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ A conversational coding assistant plugin for OpenCode with semantic code search.
|
|
|
10
10
|
|
|
11
11
|
### Chat Agents
|
|
12
12
|
|
|
13
|
-
| Agent | Purpose
|
|
14
|
-
| ------------- |
|
|
15
|
-
| **Just Chat** | Quick questions, web research,
|
|
16
|
-
| **Tool Chat** | Full
|
|
13
|
+
| Agent | Purpose |
|
|
14
|
+
| ------------- | ------------------------------------------------------ |
|
|
15
|
+
| **Just Chat** | Quick questions, web research, semantic search, memory |
|
|
16
|
+
| **Tool Chat** | Full toolkit with files, semantic search, and memory |
|
|
17
17
|
|
|
18
18
|
### Features
|
|
19
19
|
|
|
@@ -39,7 +39,7 @@ OpenCode automatically installs the plugin on next launch.
|
|
|
39
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
42
|
-
"plugin": ["@howaboua/opencode-chat@0.1.
|
|
42
|
+
"plugin": ["@howaboua/opencode-chat@0.1.3"]
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
45
|
|
package/dist/config.js
CHANGED
|
@@ -31,7 +31,7 @@ const NATIVE_TOOLS = [
|
|
|
31
31
|
// Tools for Just Chat: web research and conversation
|
|
32
32
|
// Uses native tools directly (no chat_* wrappers needed)
|
|
33
33
|
const JUST_CHAT_NATIVE = ["webfetch", "websearch"];
|
|
34
|
-
const JUST_CHAT_TOOLS = ["chat_remember", "chat_todowrite", "chat_todoread"];
|
|
34
|
+
const JUST_CHAT_TOOLS = ["chat_remember", "chat_todowrite", "chat_todoread", "chat_semantic_search"];
|
|
35
35
|
// Native tools to enable for Tool Chat (in addition to chat_* tools)
|
|
36
36
|
const TOOL_CHAT_NATIVE = ["websearch", "webfetch"];
|
|
37
37
|
export function configureChatAgents(config, toolIds) {
|
package/dist/system.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const CHATIFIER_MARKER = "---CHATIFIER_MODE_ACTIVE---";
|
|
2
|
-
export declare const UNIVERSAL_PROMPT = "You are Opencode,
|
|
2
|
+
export declare const UNIVERSAL_PROMPT = "You are Opencode, a conversational assistant that helps users explore ideas, solve problems, and complete tasks. Respond naturally, keep things clear and direct, and use tools when they add value.\n\n# Communication Style\n- Be concise, direct, and to the point\n- Answer without unnecessary preamble or postamble\n- Use clear, straightforward language\n- Avoid filler phrases like \"Here is...\" or \"The answer is...\"\n- Stop after completing the requested work unless explanation is requested\n- Match the user's tone while staying helpful and accurate\n\n<example>\nuser: 2 + 2\nassistant: 4\n</example>\n\n<example>\nuser: what is 2+2?\nassistant: 4\n</example>\n\n<example>\nuser: is 11 a prime number?\nassistant: Yes\n</example>\n\n# Task Management\nUse TodoWrite tools frequently for multi-step tasks to track progress and avoid missing steps.\n\nMark tasks as completed immediately after finishing them. Don't batch completions.\n\nExample workflow:\n1. Create todo list for complex tasks\n2. Mark items as in_progress when starting\n3. Mark as completed immediately after finishing\n4. Add new tasks discovered during implementation\n\n# Tool Usage\n- Use tools when they help complete tasks\n- Never use tools as a substitute for direct communication\n- Check tool outputs and provide concise responses\n- When working on files, understand the context and conventions first\n- <system-reminder> tags contain useful information but are NOT part of user input or tool results.\n- When running commands that change files, briefly explain what you are doing\n\n## Parallel Tool Execution (CRITICAL)\n**You MUST use parallel tool calling whenever possible:**\n\n- **ALWAYS** batch multiple independent tool calls in a single message\n- **NEVER** send separate messages for operations that can be done in parallel\n- **ESPECIALLY** for multiple file reads, bash commands, or API calls\n- **PRIORITY**: Parallel execution over sequential for all independent operations\n\n**When to use parallel calls:**\n- Reading multiple files at once\n- Running multiple independent bash commands\n- Checking status of multiple resources\n- Any operations that don't depend on each other\n\n**Example:**\nInstead of: \"Read file A\" \u2192 \"Read file B\" \u2192 \"Read file C\"\nUse: \"Read file A + Read file B + Read file C\" in single message\n\n# Safety & Security\n- Never introduce security vulnerabilities\n- Don't log or expose secrets/keys\n- Consider security implications before implementing features\n- Exercise extra caution with system operations that affect OS stability\n- Pay attention to commands that modify system files, services, or configurations\n- Be mindful of operations that could impact system performance or availability";
|
|
3
3
|
export declare const CHATIFIER_PROMPT: string;
|
|
4
4
|
export declare function replaceSystemPrompt(system: string[]): void;
|
|
5
5
|
//# sourceMappingURL=system.d.ts.map
|
package/dist/system.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,gCAAgC,CAAA;AAC7D,eAAO,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"system.d.ts","sourceRoot":"","sources":["../system.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,gCAAgC,CAAA;AAC7D,eAAO,MAAM,gBAAgB,6rFAoEmD,CAAA;AAGhF,eAAO,MAAM,gBAAgB,QAA+C,CAAA;AAE5E,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAgBnD"}
|
package/dist/system.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
export const CHATIFIER_MARKER = "---CHATIFIER_MODE_ACTIVE---";
|
|
2
|
-
export const UNIVERSAL_PROMPT = `You are Opencode,
|
|
2
|
+
export const UNIVERSAL_PROMPT = `You are Opencode, a conversational assistant that helps users explore ideas, solve problems, and complete tasks. Respond naturally, keep things clear and direct, and use tools when they add value.
|
|
3
3
|
|
|
4
4
|
# Communication Style
|
|
5
5
|
- Be concise, direct, and to the point
|
|
6
|
-
-
|
|
7
|
-
- Answer directly without unnecessary preamble or postamble
|
|
6
|
+
- Answer without unnecessary preamble or postamble
|
|
8
7
|
- Use clear, straightforward language
|
|
9
|
-
- Avoid phrases like "Here is..." or "The answer is..."
|
|
10
|
-
- Stop after
|
|
11
|
-
-
|
|
8
|
+
- Avoid filler phrases like "Here is..." or "The answer is..."
|
|
9
|
+
- Stop after completing the requested work unless explanation is requested
|
|
10
|
+
- Match the user's tone while staying helpful and accurate
|
|
12
11
|
|
|
13
12
|
<example>
|
|
14
13
|
user: 2 + 2
|
|
@@ -25,13 +24,8 @@ user: is 11 a prime number?
|
|
|
25
24
|
assistant: Yes
|
|
26
25
|
</example>
|
|
27
26
|
|
|
28
|
-
# CLI Interface
|
|
29
|
-
Your output displays on a command line interface using GitHub-flavored markdown in a monospace font. All text outside tool use communicates with the user.
|
|
30
|
-
|
|
31
|
-
When running bash commands that make changes, briefly explain what you're doing to ensure user understanding.
|
|
32
|
-
|
|
33
27
|
# Task Management
|
|
34
|
-
Use TodoWrite tools frequently
|
|
28
|
+
Use TodoWrite tools frequently for multi-step tasks to track progress and avoid missing steps.
|
|
35
29
|
|
|
36
30
|
Mark tasks as completed immediately after finishing them. Don't batch completions.
|
|
37
31
|
|
|
@@ -47,6 +41,7 @@ Example workflow:
|
|
|
47
41
|
- Check tool outputs and provide concise responses
|
|
48
42
|
- When working on files, understand the context and conventions first
|
|
49
43
|
- <system-reminder> tags contain useful information but are NOT part of user input or tool results.
|
|
44
|
+
- When running commands that change files, briefly explain what you are doing
|
|
50
45
|
|
|
51
46
|
## Parallel Tool Execution (CRITICAL)
|
|
52
47
|
**You MUST use parallel tool calling whenever possible:**
|
|
@@ -63,8 +58,8 @@ Example workflow:
|
|
|
63
58
|
- Any operations that don't depend on each other
|
|
64
59
|
|
|
65
60
|
**Example:**
|
|
66
|
-
Instead of:
|
|
67
|
-
Use:
|
|
61
|
+
Instead of: "Read file A" → "Read file B" → "Read file C"
|
|
62
|
+
Use: "Read file A + Read file B + Read file C" in single message
|
|
68
63
|
|
|
69
64
|
# Safety & Security
|
|
70
65
|
- Never introduce security vulnerabilities
|
package/dist/tools/glob.js
CHANGED
|
@@ -39,7 +39,7 @@ export function createChatGlob(baseDir) {
|
|
|
39
39
|
description: `Find files by pattern.
|
|
40
40
|
|
|
41
41
|
Usage:
|
|
42
|
-
- Supports glob patterns like "**/*.txt" or "
|
|
42
|
+
- Supports glob patterns like "**/*.txt" or "notes/**/*.md"
|
|
43
43
|
- Returns files sorted by modification time
|
|
44
44
|
- Results truncated at 100 files`,
|
|
45
45
|
args: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../tools/patch.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;gBACpB;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../tools/patch.ts"],"names":[],"mappings":"AAQA,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM;;gBACpB;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;EA0E/C"}
|
package/dist/tools/patch.js
CHANGED
|
@@ -33,47 +33,39 @@ export function createChatPatch(baseDir) {
|
|
|
33
33
|
FORMAT RULES:
|
|
34
34
|
- Start with: *** Begin Patch
|
|
35
35
|
- End with: *** End Patch
|
|
36
|
-
-
|
|
37
|
-
- Lines starting with "
|
|
38
|
-
- Lines starting with "
|
|
39
|
-
-
|
|
36
|
+
- Use *** Add File / *** Update File / *** Delete File
|
|
37
|
+
- Lines starting with "-" are REMOVED
|
|
38
|
+
- Lines starting with "+" are ADDED
|
|
39
|
+
- Lines starting with " " are CONTEXT
|
|
40
|
+
- @@ line is required for updates and must include a context line that exists in the target file
|
|
40
41
|
|
|
41
|
-
|
|
42
|
+
NEW FILE (all content lines MUST start with "+"):
|
|
42
43
|
*** Begin Patch
|
|
43
44
|
*** Add File: path/to/new.txt
|
|
44
|
-
+first line
|
|
45
|
-
+second line
|
|
45
|
+
+first line
|
|
46
|
+
+second line
|
|
46
47
|
*** End Patch
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
UPDATE (must include both "-" and "+" for replacements):
|
|
49
50
|
*** Begin Patch
|
|
50
51
|
*** Update File: path/to/file.txt
|
|
51
|
-
@@
|
|
52
|
-
-
|
|
53
|
-
+
|
|
52
|
+
@@ exact existing line
|
|
53
|
+
-old line
|
|
54
|
+
+new line
|
|
54
55
|
*** End Patch
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
INSERT (use context + then "+" lines):
|
|
57
58
|
*** Begin Patch
|
|
58
59
|
*** Update File: path/to/file.txt
|
|
59
|
-
@@
|
|
60
|
-
|
|
60
|
+
@@ exact existing line
|
|
61
|
+
exact existing line
|
|
62
|
+
+inserted line
|
|
61
63
|
*** End Patch
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
*** Begin Patch
|
|
65
|
-
*** Update File: path/to/file.txt
|
|
66
|
-
@@ import React from "react"
|
|
67
|
-
import React from "react"
|
|
68
|
-
+import { useState } from "react"
|
|
69
|
-
*** End Patch
|
|
70
|
-
|
|
71
|
-
DELETE A FILE:
|
|
65
|
+
DELETE FILE:
|
|
72
66
|
*** Begin Patch
|
|
73
67
|
*** Delete File: path/to/remove.txt
|
|
74
|
-
*** End Patch
|
|
75
|
-
|
|
76
|
-
IMPORTANT: To replace a line, you MUST use "-oldline" then "+newline". The @@ line only locates WHERE to make changes.`,
|
|
68
|
+
*** End Patch`,
|
|
77
69
|
args: {
|
|
78
70
|
patchText: tool.schema
|
|
79
71
|
.string()
|
|
@@ -36,10 +36,10 @@ export function createChatSemanticSearch(worktree) {
|
|
|
36
36
|
id: "chat_semantic_search",
|
|
37
37
|
run,
|
|
38
38
|
tool: tool({
|
|
39
|
-
description: `Semantic search over
|
|
39
|
+
description: `Semantic search over project files using local embeddings.
|
|
40
40
|
|
|
41
41
|
Usage:
|
|
42
|
-
- Best for natural language queries ("where is
|
|
42
|
+
- Best for natural language queries ("where is that explained")
|
|
43
43
|
- Returns file + line ranges + snippet
|
|
44
44
|
- Indexing is incremental based on file mtime`,
|
|
45
45
|
args: {
|
package/dist/util/patch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../util/patch.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AACrE,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACzD,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AACpG,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;
|
|
1
|
+
{"version":3,"file":"patch.d.ts","sourceRoot":"","sources":["../../util/patch.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA;AACrE,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AACzD,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,EAAE,CAAA;CAAE,CAAA;AACpG,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,UAAU,GAAG,UAAU,CAAA;AAEpD,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAuGD,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM;;EAqC3C;AAkGD,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC7E"}
|
package/dist/util/patch.js
CHANGED
|
@@ -71,17 +71,24 @@ function parseUpdateChunks(lines, startIdx) {
|
|
|
71
71
|
return { chunks, nextIdx: i };
|
|
72
72
|
}
|
|
73
73
|
function parseAddContent(lines, startIdx) {
|
|
74
|
-
|
|
74
|
+
const contentLines = [];
|
|
75
75
|
let i = startIdx;
|
|
76
76
|
while (i < lines.length && !lines[i].startsWith("***")) {
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const line = lines[i];
|
|
78
|
+
if (line.startsWith("+")) {
|
|
79
|
+
contentLines.push(line.substring(1));
|
|
80
|
+
i++;
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (line.startsWith(" ")) {
|
|
84
|
+
contentLines.push(line.substring(1));
|
|
85
|
+
i++;
|
|
86
|
+
continue;
|
|
79
87
|
}
|
|
88
|
+
contentLines.push(line);
|
|
80
89
|
i++;
|
|
81
90
|
}
|
|
82
|
-
|
|
83
|
-
content = content.slice(0, -1);
|
|
84
|
-
return { content, nextIdx: i };
|
|
91
|
+
return { content: contentLines.join("\n"), nextIdx: i };
|
|
85
92
|
}
|
|
86
93
|
export function parsePatch(patchText) {
|
|
87
94
|
const lines = patchText.split("\n");
|