@mathew-macharia/black-mamba 1.0.1 → 1.0.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 +1 -1
- package/docs/config.md +1 -1
- package/docs/install.md +1 -4
- package/package.json +1 -1
- package/src/config.js +3 -1
- package/src/deepseek/sha3_wasm_bg.wasm +0 -0
- package/src/pi/prompt.js +17 -2
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Requires Node.js 18 or newer.
|
|
|
8
8
|
npm install -g @mathew-macharia/black-mamba
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Run `bm` in the folder that holds your data. That folder is where it reads `accounts
|
|
11
|
+
Run `bm` in the folder that holds your data. That folder is where it reads `accounts/` and `.env`. The proof-of-work file `sha3_wasm_bg.wasm` ships inside the package.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
accounts/<name>/api-key.txt
|
package/docs/config.md
CHANGED
|
@@ -37,4 +37,4 @@ Set to `1` or `true` to enable the logger's debug method. Any other value leaves
|
|
|
37
37
|
|
|
38
38
|
DeepSeek web origin. Default `https://chat.deepseek.com`. Trailing slashes are removed. Login, chat create, the proof-of-work challenge, and completion are called under this origin at `/api/v0/users/current`, `/api/v0/chat_session/create`, `/api/v0/chat/create_pow_challenge`, and `/api/v0/chat/completion`.
|
|
39
39
|
|
|
40
|
-
The proof-of-work
|
|
40
|
+
The proof-of-work file `sha3_wasm_bg.wasm` lives in `src/deepseek/` and is published with `src`. If that installed file is missing, startup downloads it from DeepSeek's static file host and saves it there. That download URL does not follow `DEEPSEEK_BASE_URL`.
|
package/docs/install.md
CHANGED
|
@@ -6,12 +6,11 @@ Requires Node.js 18 or newer.
|
|
|
6
6
|
npm install -g @mathew-macharia/black-mamba
|
|
7
7
|
```
|
|
8
8
|
|
|
9
|
-
The command is `bm`. Run it in the directory that holds your data. That working directory (`process.cwd()`) is where `bm` reads `accounts
|
|
9
|
+
The command is `bm`. Run it in the directory that holds your data. That working directory (`process.cwd()`) is where `bm` reads `accounts/` and `.env`. The proof-of-work file `sha3_wasm_bg.wasm` is installed with the package.
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
<data-directory>/
|
|
13
13
|
.env optional
|
|
14
|
-
sha3_wasm_bg.wasm created on first start if missing
|
|
15
14
|
accounts/
|
|
16
15
|
<name>/
|
|
17
16
|
api-key.txt
|
|
@@ -36,8 +35,6 @@ From the data directory:
|
|
|
36
35
|
bm
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
If `sha3_wasm_bg.wasm` is missing from that directory, startup downloads it and saves it there. The terminal shows two `[WASM]` lines: one when the download starts, and one when the file is saved.
|
|
40
|
-
|
|
41
38
|
When the server is up, stdout has:
|
|
42
39
|
|
|
43
40
|
```
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import "dotenv/config";
|
|
4
4
|
import path from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
5
6
|
|
|
7
|
+
const SRC_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
6
8
|
const ROOT_DIR = process.cwd();
|
|
7
9
|
|
|
8
10
|
function readNumber(raw, fallback) {
|
|
@@ -38,7 +40,7 @@ export function loadConfig(env = process.env, rootDir = ROOT_DIR) {
|
|
|
38
40
|
chatCompletionUrl: `${deepseekBaseUrl}/api/v0/chat/completion`,
|
|
39
41
|
powTargetPath: "/api/v0/chat/completion",
|
|
40
42
|
wasmUrl: "https://fe-static.deepseek.com/chat/static/sha3_wasm_bg.7b9ca65ddd.wasm",
|
|
41
|
-
wasmPath: path.join(
|
|
43
|
+
wasmPath: path.join(SRC_DIR, "deepseek", "sha3_wasm_bg.wasm"),
|
|
42
44
|
healthCheckIntervalMs: 30 * 60 * 1000,
|
|
43
45
|
estimatedWafTtlMs: 4 * 24 * 60 * 60 * 1000,
|
|
44
46
|
estimatedSessionTtlMs: 30 * 24 * 60 * 60 * 1000,
|
|
Binary file
|
package/src/pi/prompt.js
CHANGED
|
@@ -19,12 +19,19 @@ function primaryToolExample(tools) {
|
|
|
19
19
|
|
|
20
20
|
function toolCallRules(tools) {
|
|
21
21
|
const { primaryTool, exampleParam } = primaryToolExample(tools);
|
|
22
|
-
return `1. You do not have direct terminal, shell, or file system access. To inspect files, run commands, or edit code, you request execution by emitting a DSML block:
|
|
22
|
+
return `1. You do not have direct terminal, shell, or file system access. To inspect files, run commands, or edit code, you request execution by emitting a DSML block. The format must match exactly like this:
|
|
23
23
|
<|DSML|tool_calls>
|
|
24
24
|
<|DSML|invoke name="${primaryTool}">
|
|
25
25
|
<|DSML|parameter ${exampleParam}</|DSML|parameter>
|
|
26
26
|
</|DSML|invoke>
|
|
27
27
|
</|DSML|tool_calls>
|
|
28
|
+
|
|
29
|
+
Explanation:
|
|
30
|
+
<|DSML|tool_calls> opens the block.
|
|
31
|
+
<|DSML|invoke name="${primaryTool}"> names the tool. ${primaryTool} is the tool name.
|
|
32
|
+
<|DSML|parameter name="..." string="true"> holds the value, and </|DSML|parameter> closes it.
|
|
33
|
+
</|DSML|invoke> then </|DSML|tool_calls> close the block.
|
|
34
|
+
|
|
28
35
|
2. Output EXACTLY ONE DSML block at the end of your response and end your turn immediately. Pi will execute it locally on the user's machine and return the result in a DSML result block.
|
|
29
36
|
3. Tool requests must strictly use the DSML block. Do not format tool calls with any other syntax.
|
|
30
37
|
4. If the user request does not require any tools, respond directly in normal text.`;
|
|
@@ -78,7 +85,15 @@ Pi is connected to chat.deepseek and sends and listens to https://chat.deepseek.
|
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
export function formatToolTurnDirective(_tools = []) {
|
|
81
|
-
return
|
|
88
|
+
return `[Tool output received from user's machine. To take another action, output a DSML block and end turn. If complete, respond directly to the user.]
|
|
89
|
+
|
|
90
|
+
REMINDER: When calling a tool, four tags must be there, in this order:
|
|
91
|
+
|
|
92
|
+
<|DSML|tool_calls>
|
|
93
|
+
<|DSML|invoke name="TOOL">
|
|
94
|
+
<|DSML|parameter name="PARAM" string="true">VALUE</|DSML|parameter>
|
|
95
|
+
</|DSML|invoke>
|
|
96
|
+
</|DSML|tool_calls>`;
|
|
82
97
|
}
|
|
83
98
|
|
|
84
99
|
export const USER_TOOL_REMINDER =
|