@oka-core/reason 0.2.1 → 0.2.9

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 ADDED
@@ -0,0 +1,59 @@
1
+ # @oka-core/reason
2
+
3
+ MCP server for institutional knowledge capture, consolidation, and retrieval.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add @oka-core/reason
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Add to your MCP client configuration:
14
+
15
+ ```json
16
+ {
17
+ "mcpServers": {
18
+ "reason": {
19
+ "command": "npx",
20
+ "args": ["-y", "@oka-core/reason"]
21
+ }
22
+ }
23
+ }
24
+ ```
25
+
26
+ ## Tools
27
+
28
+ ### Write
29
+
30
+ - **observe** — Record a learning or observation
31
+ - **decision** — Record an architectural decision
32
+ - **deviation** — Record a deviation from established patterns
33
+ - **done** — Mark a task as complete with summary
34
+ - **consolidate** — Trigger knowledge consolidation
35
+
36
+ ### Read
37
+
38
+ - **explore** — Explore learnings by area
39
+ - **context** — Get contextual knowledge for a task
40
+ - **patterns** — Get recurring patterns
41
+ - **learnings** — List recent learnings
42
+ - **decisions** — List architectural decisions
43
+ - **priorities** — Get current priorities
44
+ - **suggest** — Get AI-powered suggestions
45
+ - **backlog** — View AI-generated backlog items
46
+ - **semantic_search** — Search by meaning using embeddings
47
+
48
+ ### Auth
49
+
50
+ - **login** — Authenticate via browser
51
+ - **whoami** — Check authentication status
52
+
53
+ ## Requirements
54
+
55
+ - Node.js >= 20
56
+
57
+ ## License
58
+
59
+ UNLICENSED
package/dist/client.js CHANGED
@@ -187,7 +187,7 @@ export class OkaClient {
187
187
  * POST /api/reasoning/consolidate
188
188
  */
189
189
  async triggerConsolidation(req) {
190
- return this.post("/api/reasoning/consolidate", req);
190
+ return this.post("/api/reasoning/consolidate", req, 120_000);
191
191
  }
192
192
  // ─── HTTP helpers ───────────────────────────────────────────────
193
193
  authHeaders() {
@@ -233,9 +233,9 @@ export class OkaClient {
233
233
  clearTimeout(timer);
234
234
  }
235
235
  }
236
- async post(path, body) {
236
+ async post(path, body, timeout) {
237
237
  const controller = new AbortController();
238
- const timer = setTimeout(() => controller.abort(), this.timeout);
238
+ const timer = setTimeout(() => controller.abort(), timeout ?? this.timeout);
239
239
  try {
240
240
  const response = await fetch(`${this.apiUrl}${path}`, {
241
241
  method: "POST",
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
2
3
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
5
  import { OkaClient } from "./client.js";
@@ -8,9 +9,11 @@ import { registerAuthTools } from "./tools/auth.js";
8
9
  import { loadEnvFile } from "./auth.js";
9
10
  // Load .env from the project root (cwd), env vars take precedence
10
11
  loadEnvFile(process.cwd());
12
+ const require = createRequire(import.meta.url);
13
+ const { version } = require("../package.json");
11
14
  const server = new McpServer({
12
15
  name: "@oka-core/reason",
13
- version: "0.3.0",
16
+ version,
14
17
  });
15
18
  // Client resolves credentials lazily on each request — no restart needed
16
19
  // after login or credential changes.
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,cAAc,CAAC;AAoEtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA2nB5E"}
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EACV,SAAS,EAGV,MAAM,cAAc,CAAC;AAoEtB;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA6nB5E"}
@@ -275,8 +275,7 @@ export function registerReadTools(server, client) {
275
275
  server.tool("suggest", "Get ranked task priorities based on accumulated reasoning", {
276
276
  repo: z.string().describe("Repository identifier"),
277
277
  backlog: z
278
- .array(z.string())
279
- .min(1)
278
+ .preprocess((v) => (typeof v === "string" ? JSON.parse(v) : v), z.array(z.string()).min(1))
280
279
  .describe("List of backlog items to prioritize"),
281
280
  }, async (params) => {
282
281
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAgJ7E"}
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CAoK7E"}
@@ -19,7 +19,12 @@ export function registerWriteTools(server, client) {
19
19
  }, async (params) => {
20
20
  await client.ingest({ event_type: "decision", payload: params });
21
21
  return {
22
- content: [{ type: "text", text: "Decision recorded." }],
22
+ content: [
23
+ {
24
+ type: "text",
25
+ text: `Decision recorded: ${params.description} (confidence: ${params.confidence})`,
26
+ },
27
+ ],
23
28
  };
24
29
  });
25
30
  server.tool("explore", "Record an area the agent explored and what was found", {
@@ -33,7 +38,12 @@ export function registerWriteTools(server, client) {
33
38
  }, async (params) => {
34
39
  await client.ingest({ event_type: "exploration", payload: params });
35
40
  return {
36
- content: [{ type: "text", text: "Exploration recorded." }],
41
+ content: [
42
+ {
43
+ type: "text",
44
+ text: `Exploration recorded: ${params.area} (relevance: ${params.relevance_score})`,
45
+ },
46
+ ],
37
47
  };
38
48
  });
39
49
  server.tool("deviation", "Record when the agent deviated from the original plan", {
@@ -43,7 +53,12 @@ export function registerWriteTools(server, client) {
43
53
  }, async (params) => {
44
54
  await client.ingest({ event_type: "deviation", payload: params });
45
55
  return {
46
- content: [{ type: "text", text: "Deviation recorded." }],
56
+ content: [
57
+ {
58
+ type: "text",
59
+ text: `Deviation recorded: planned "${params.planned_action}" → actual "${params.actual_action}"`,
60
+ },
61
+ ],
47
62
  };
48
63
  });
49
64
  server.tool("done", "Record task completion with outcome and quality signals", {
@@ -62,7 +77,12 @@ export function registerWriteTools(server, client) {
62
77
  }, async (params) => {
63
78
  await client.ingest({ event_type: "completion", payload: params });
64
79
  return {
65
- content: [{ type: "text", text: "Completion recorded." }],
80
+ content: [
81
+ {
82
+ type: "text",
83
+ text: `Completion recorded: ${params.task_id} → ${params.outcome}`,
84
+ },
85
+ ],
66
86
  };
67
87
  });
68
88
  // ─── observe (general-purpose) ─────────────────────────────────
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oka-core/reason",
3
- "version": "0.2.1",
4
- "description": "MCP server for Oka Reason — institutional knowledge, semantic search, and consolidation",
3
+ "version": "0.2.9",
4
+ "description": "MCP server for institutional knowledge capture, semantic search, and consolidation",
5
5
  "private": false,
6
6
  "publishConfig": {
7
7
  "access": "restricted"
@@ -28,6 +28,15 @@
28
28
  "dist",
29
29
  "README.md"
30
30
  ],
31
+ "scripts": {
32
+ "build": "tsc",
33
+ "check-types": "tsc --noEmit",
34
+ "prepublishOnly": "npm run build",
35
+ "test": "vitest run",
36
+ "test:watch": "vitest",
37
+ "lint": "echo 'lint ok'",
38
+ "typecheck": "tsc --noEmit"
39
+ },
31
40
  "keywords": [
32
41
  "mcp",
33
42
  "reasoning",
@@ -41,6 +50,7 @@
41
50
  "url": "https://github.com/datacircuits/agentic.git",
42
51
  "directory": "packages/reason"
43
52
  },
53
+ "homepage": "https://reason.oka.so",
44
54
  "engines": {
45
55
  "node": ">=20"
46
56
  },
@@ -51,14 +61,6 @@
51
61
  "devDependencies": {
52
62
  "typescript": "^5.5.0",
53
63
  "vitest": "^2.0.0",
54
- "@oka/typescript-config": "0.0.0"
55
- },
56
- "scripts": {
57
- "build": "tsc",
58
- "check-types": "tsc --noEmit",
59
- "test": "vitest run",
60
- "test:watch": "vitest",
61
- "lint": "echo 'lint ok'",
62
- "typecheck": "tsc --noEmit"
64
+ "@oka/typescript-config": "workspace:*"
63
65
  }
64
- }
66
+ }