@keb-org/consol 0.1.1 → 0.3.0

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": "@keb-org/consol",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Consol memory engine SDK: a local vault, a hosted vault client, and the Consol backend class",
5
5
  "keywords": [
6
6
  "mcp",
@@ -29,6 +29,9 @@
29
29
  "require": "./dist/index.js"
30
30
  }
31
31
  },
32
+ "bin": {
33
+ "consol-mcp": "dist/mcp.js"
34
+ },
32
35
  "files": [
33
36
  "dist"
34
37
  ],
@@ -37,24 +40,25 @@
37
40
  },
38
41
  "license": "MIT",
39
42
  "scripts": {
40
- "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && bun build src/index.ts --outfile dist/index.js --target node --format cjs && cp src/index.mjs dist/index.mjs && tsc --emitDeclarationOnly --pretty false",
43
+ "build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && bun build src/index.ts --outfile dist/index.js --target node --format cjs && bun build src/mcp.ts --outfile dist/mcp.js --target node --format cjs && cp src/index.mjs dist/index.mjs && tsc --emitDeclarationOnly --pretty false",
41
44
  "typecheck": "tsc --noEmit --pretty false",
42
- "test": "bun run build && bun test/pure.ts && node test/http.ts && node test/sdk.ts && tsc --noEmit --pretty false -p test",
43
- "test:offline": "bun run build && bun test/pure.ts && node test/http.ts && tsc --noEmit --pretty false -p test",
45
+ "test": "bun run build && bun test/pure.ts && node test/http.ts && node test/native.ts && node test/sdk.ts && tsc --noEmit --pretty false -p test",
46
+ "test:offline": "bun run build && bun test/pure.ts && node test/http.ts && node test/native.ts && tsc --noEmit --pretty false -p test",
44
47
  "test:consumers": "bun run build && bash consumers/run.sh"
45
48
  },
46
49
  "devDependencies": {
47
50
  "typescript": "5.3.3",
48
- "@types/node": "20.11.0"
51
+ "@types/node": "20.11.0",
52
+ "@modelcontextprotocol/server": "2.3.1"
49
53
  },
50
54
  "publishConfig": {
51
55
  "access": "public"
52
56
  },
53
57
  "optionalDependencies": {
54
- "@keb-org/consol-win32-x64": "0.1.1",
55
- "@keb-org/consol-darwin-arm64": "0.1.1",
56
- "@keb-org/consol-darwin-x64": "0.1.1",
57
- "@keb-org/consol-linux-x64": "0.1.1",
58
- "@keb-org/consol-linux-arm64": "0.1.1"
58
+ "@keb-org/consol-win32-x64": "0.3.0",
59
+ "@keb-org/consol-darwin-arm64": "0.3.0",
60
+ "@keb-org/consol-darwin-x64": "0.3.0",
61
+ "@keb-org/consol-linux-x64": "0.3.0",
62
+ "@keb-org/consol-linux-arm64": "0.3.0"
59
63
  }
60
64
  }
package/dist/stdio.d.ts DELETED
@@ -1,120 +0,0 @@
1
- import { type CallOptions, type Context, type Transport } from "./transport";
2
- import type { Reply } from "./types";
3
- /** Bound of the kept stderr tail and of any one line, in UTF-8 bytes. */
4
- export declare const STDERR_TAIL_BYTES = 4096;
5
- /** Any OpenAI-shaped `/embeddings` endpoint; without it recall stays lexical-only. */
6
- export interface EmbeddingOptions {
7
- url: string;
8
- /** Omit for endpoints that take no key. */
9
- apiKey?: string;
10
- model: string;
11
- dims?: number;
12
- queryPrefix?: string;
13
- batchSize?: number;
14
- timeoutMs?: number;
15
- }
16
- /** Jev advice (experimental). */
17
- export interface JevOptions {
18
- url?: string;
19
- apiKey?: string;
20
- model?: string;
21
- /** `false` turns automatic triage off. */
22
- auto?: boolean;
23
- }
24
- /**
25
- * What starts the `consol stdio` child. Options become the child's environment (never argv);
26
- * inherited CONSOL_* and RUST_LOG are stripped first and `env` is applied last.
27
- */
28
- export interface EngineOptions {
29
- /** Database URL: PostgreSQL with pgvector, or CockroachDB. Without it this process's `CONSOL_DB_URL` applies; the child needs one. */
30
- db?: string;
31
- embedding?: EmbeddingOptions;
32
- jev?: JevOptions;
33
- /** Explicit binary; otherwise CONSOL_BIN, the platform package, then PATH. */
34
- binaryPath?: string;
35
- env?: Record<string, string>;
36
- /** Default per-call deadline in ms (300000); 0 disables it. */
37
- timeoutMs?: number;
38
- /** Receives each child stderr line. Without it lines are only kept for error messages. */
39
- onLog?: (line: string) => void;
40
- }
41
- export declare function engineEnv(o: EngineOptions): Record<string, string>;
42
- export interface StdioOptions extends EngineOptions {
43
- /** `--vault PATH` or `--vault-root ROOT`. */
44
- location: ["--vault" | "--vault-root", string];
45
- /** After the ready line: create (first start only) or open this vault. A restart always opens. */
46
- boot?: {
47
- vault: string;
48
- create: boolean;
49
- };
50
- /** The SDK version the child's major.minor must match. */
51
- sdkVersion: string;
52
- }
53
- export interface BinaryResolution {
54
- path: string;
55
- attempts: string[];
56
- }
57
- /**
58
- * Explicit path authoritative (missing file fails here), then CONSOL_BIN authoritative, then the
59
- * platform package resolved relative to this SDK file, then PATH. CONSOL_BIN is read only here,
60
- * never sent to the child.
61
- */
62
- export declare function resolveBinary(explicit?: string): BinaryResolution;
63
- /** Child env: host minus ALL CONSOL_* and RUST_LOG, then options, then explicit env last. */
64
- export declare function childEnv(base?: Record<string, string>, extra?: Record<string, string>): Record<string, string>;
65
- /** The last STDERR_TAIL_BYTES bytes of `text`, cut on a character boundary. */
66
- export declare function lastBytes(text: string): string;
67
- /**
68
- * One `consol stdio` child speaking JSON lines (docs W-wire): a ready line, then `{id, op, ...}`
69
- * frames answered by `{id, reply}` lines in any order. Stdin EOF ends the child gracefully.
70
- */
71
- export declare class StdioTransport implements Transport {
72
- private readonly opts;
73
- private readonly attempts;
74
- private readonly binary;
75
- private readonly timeoutMs;
76
- private child;
77
- private reader;
78
- private generation;
79
- private nextId;
80
- private pending;
81
- private starting;
82
- /** After the first successful start, every restart opens the vault instead of creating it. */
83
- private started;
84
- private closed;
85
- private closing;
86
- private stderrTail;
87
- private stderrTailBytes;
88
- version: string | null;
89
- constructor(opts: StdioOptions);
90
- private decoder;
91
- private stderrPartial;
92
- private onStderr;
93
- private flushStderr;
94
- private pushLine;
95
- private tailText;
96
- /**
97
- * Idle children are unref'd so a forgotten close() never keeps Node or Bun alive. Only the process
98
- * handle toggles (its stdio is unref'd once at spawn): Bun cannot unref a stream again once ref'd.
99
- */
100
- private updateRef;
101
- private onDeath;
102
- /**
103
- * Final and idempotent: in-flight calls reject now, later calls with `closed`. Every close()
104
- * returns the same promise, settled once the child has exited.
105
- */
106
- close(): Promise<void>;
107
- private shutdown;
108
- /** Starts the child and waits for its ready line, unless one is running or starting already. */
109
- start(): Promise<void>;
110
- private spawn;
111
- private onLine;
112
- /** Waits for the answer to `id`, writing `frame` first unless it is null (the ready line). */
113
- private call;
114
- /** One frame; after a crash the next call starts the child once more. Never retried. */
115
- private send;
116
- /** Runs one envelope under `ctx`. The reply is returned untouched, tool errors included. */
117
- handle(body: unknown, ctx: Context, options?: CallOptions): Promise<Reply>;
118
- /** Create or open a vault by name; a refusal arrives as the reply's `vault_exists` / `vault_not_found`. */
119
- vaultOp(op: "create_vault" | "open_vault", vault: string, options?: CallOptions): Promise<Reply>;
120
- }