@mathew-macharia/black-mamba 1.0.2 → 1.0.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/.env.example +7 -8
- package/index.js +38 -19
- package/package.json +1 -1
- package/src/accounts.js +83 -24
- package/src/completions.js +149 -0
- package/src/config.js +1 -9
- package/src/deepseek/classify.js +13 -13
- package/src/deepseek/client.js +24 -23
- package/src/errors.js +0 -11
- package/src/{server/http.js → http.js} +16 -50
- package/src/{server/pacing.js → pacing.js} +1 -1
- package/src/{pi/prompt.js → prompt.js} +67 -46
- package/src/{pi/request.js → request.js} +4 -42
- package/src/{pi/response.js → response.js} +4 -21
- package/docs/accounts.md +0 -37
- package/docs/config.md +0 -40
- package/docs/http.md +0 -171
- package/docs/install.md +0 -68
- package/docs/mapping.md +0 -11
- package/docs/overview.md +0 -25
- package/src/deepseek/auth-cli.js +0 -119
- package/src/pi/messages.js +0 -130
- package/src/server/completions.js +0 -214
- package/src/session/graph.js +0 -182
- package/src/session/planner.js +0 -177
- package/src/session/store.js +0 -100
- package/src/utils/hash.js +0 -27
- /package/src/{utils/sanitize.js → sanitize.js} +0 -0
- /package/src/{utils/tokens.js → tokens.js} +0 -0
- /package/src/{pi/tool-calls.js → tool-calls.js} +0 -0
package/src/utils/hash.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import crypto from "node:crypto";
|
|
2
|
-
|
|
3
|
-
export function sha256Hex(input) {
|
|
4
|
-
return crypto.createHash("sha256").update(input, "utf8").digest("hex");
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
/** Short (16 hex chars) digest used for fingerprints that are compared, never used as a key. */
|
|
8
|
-
export function shortHash(input) {
|
|
9
|
-
return sha256Hex(input).slice(0, 16);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/** Deterministic JSON: object keys sorted recursively so semantically equal values hash equally. */
|
|
13
|
-
export function canonicalJson(value) {
|
|
14
|
-
return JSON.stringify(sortKeys(value));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function sortKeys(value) {
|
|
18
|
-
if (Array.isArray(value)) return value.map(sortKeys);
|
|
19
|
-
if (value && typeof value === "object") {
|
|
20
|
-
const out = {};
|
|
21
|
-
for (const key of Object.keys(value).sort()) {
|
|
22
|
-
out[key] = sortKeys(value[key]);
|
|
23
|
-
}
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
return value;
|
|
27
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|