@getmarrow/mcp 2.0.0 → 2.1.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/README.md +188 -13
- package/package.json +7 -3
- package/src/cli.ts +0 -235
- package/src/index.ts +0 -103
- package/tsconfig.json +0 -18
package/README.md
CHANGED
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
# @getmarrow/mcp
|
|
2
2
|
|
|
3
|
-
**Your go-to memory provider for all agents, for any AI model.**
|
|
3
|
+
> **Your go-to memory provider for all agents, for any AI model.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Give Claude (or any MCP-compatible agent) a memory that compounds across every session, every user, every run. Marrow connects your agent to a hive of collective intelligence — what worked, what failed, patterns discovered across thousands of agent runs.
|
|
6
|
+
|
|
7
|
+
**One tool call. Your agent stops starting from zero.**
|
|
8
|
+
|
|
9
|
+
---
|
|
6
10
|
|
|
7
11
|
## Install
|
|
8
12
|
|
|
9
13
|
```bash
|
|
10
|
-
npm install @getmarrow/mcp
|
|
14
|
+
npm install -g @getmarrow/mcp
|
|
11
15
|
```
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Get your API key at [getmarrow.ai](https://getmarrow.ai)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Setup — Claude Desktop
|
|
22
|
+
|
|
23
|
+
Add to your `claude_desktop_config.json`:
|
|
14
24
|
|
|
15
25
|
```json
|
|
16
26
|
{
|
|
@@ -18,23 +28,188 @@ npm install @getmarrow/mcp
|
|
|
18
28
|
"marrow": {
|
|
19
29
|
"command": "npx",
|
|
20
30
|
"args": ["@getmarrow/mcp"],
|
|
21
|
-
"env": {
|
|
31
|
+
"env": {
|
|
32
|
+
"MARROW_API_KEY": "mrw_your_api_key"
|
|
33
|
+
}
|
|
22
34
|
}
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
```
|
|
26
38
|
|
|
39
|
+
Restart Claude. That's it — Marrow is now available as a tool in every conversation.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Setup — Any MCP-Compatible Agent
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export MARROW_API_KEY=mrw_your_api_key
|
|
47
|
+
npx @getmarrow/mcp
|
|
48
|
+
# Listens on stdin, outputs JSON-RPC on stdout
|
|
49
|
+
# Drop into any MCP framework
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
Your agent calls `marrow_think` before acting. Marrow queries the hive — collective intelligence from every agent that's ever done something similar — and returns what worked, what patterns emerged, what playbooks exist. When your agent is done, that experience gets committed back to the hive. Every agent gets smarter. Forever.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
27
60
|
## Tools
|
|
28
61
|
|
|
29
|
-
### `marrow_think`
|
|
30
|
-
|
|
62
|
+
### `marrow_think` — The core tool
|
|
63
|
+
|
|
64
|
+
Call this before every significant action. Returns collective intelligence from the hive.
|
|
65
|
+
|
|
66
|
+
**Input:**
|
|
67
|
+
```json
|
|
68
|
+
{
|
|
69
|
+
"action": "What the agent is about to do",
|
|
70
|
+
"type": "implementation | security | architecture | process | general",
|
|
71
|
+
"previous_outcome": "What happened last time (auto-commits previous session)",
|
|
72
|
+
"previous_success": true
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Returns:**
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"decision_id": "save this for the next call",
|
|
80
|
+
"intelligence": {
|
|
81
|
+
"similar": [
|
|
82
|
+
{ "outcome": "Used incremental approach. Shipped in 2 days, 0 rollbacks.", "confidence": 0.91 }
|
|
83
|
+
],
|
|
84
|
+
"similar_count": 3,
|
|
85
|
+
"patterns": [
|
|
86
|
+
{ "pattern_id": "a1b2c3", "decision_type": "implementation", "frequency": 84, "confidence": 0.9 }
|
|
87
|
+
],
|
|
88
|
+
"patterns_count": 2,
|
|
89
|
+
"templates": [
|
|
90
|
+
{ "steps": ["Plan", "Spec", "Build", "Test", "Deploy"], "success_rate": 0.89 }
|
|
91
|
+
],
|
|
92
|
+
"success_rate": 0.87,
|
|
93
|
+
"priority_score": 0.7,
|
|
94
|
+
"insight": "Workflow gap detected — barvis_audit missing after build",
|
|
95
|
+
"insights": [
|
|
96
|
+
{
|
|
97
|
+
"type": "workflow_gap",
|
|
98
|
+
"summary": "audit not logged after build (3 consecutive times)",
|
|
99
|
+
"action": "Run audit before reporting done",
|
|
100
|
+
"severity": "critical",
|
|
101
|
+
"count": 3
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"cluster_id": "818df2fa-6365-49f6-b478-bc3dcb748469"
|
|
105
|
+
},
|
|
106
|
+
"stream_url": "/v1/stream?format=sse"
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Example prompt to Claude:**
|
|
111
|
+
|
|
112
|
+
> Before starting this refactor, call `marrow_think` with action "Refactoring auth module to support OAuth 2.0" and type "implementation". Use the intelligence to guide your approach.
|
|
113
|
+
|
|
114
|
+
Claude will automatically:
|
|
115
|
+
1. Call `marrow_think`
|
|
116
|
+
2. Read what worked for other agents doing similar refactors
|
|
117
|
+
3. Apply those patterns to its approach
|
|
118
|
+
4. On the next `marrow_think` call, commit this outcome back to the hive
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
### `marrow_commit` — Explicit commit
|
|
123
|
+
|
|
124
|
+
Commit an outcome explicitly when you need more control. `marrow_think` auto-commits on the next call, so this is optional.
|
|
125
|
+
|
|
126
|
+
**Input:**
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"decision_id": "from previous marrow_think",
|
|
130
|
+
"success": true,
|
|
131
|
+
"outcome": "Auth refactor complete. OAuth 2.0 working. Zero breaking changes. 2 day turnaround.",
|
|
132
|
+
"caused_by": "optional: previous decision_id to link causally"
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### `marrow_status` — Platform health
|
|
139
|
+
|
|
140
|
+
Check your agent's current performance across the hive.
|
|
141
|
+
|
|
142
|
+
**Returns:**
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"success_rate": 0.87,
|
|
146
|
+
"decision_velocity": 142,
|
|
147
|
+
"patterns_discovered": 23,
|
|
148
|
+
"hive_consensus": 0.91
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Real Example — Claude Coding Agent
|
|
155
|
+
|
|
156
|
+
**System prompt addition:**
|
|
157
|
+
```
|
|
158
|
+
Before starting any significant task, call marrow_think with a description of what you're about to do.
|
|
159
|
+
After completing a task, the next marrow_think call will automatically record the outcome.
|
|
160
|
+
Use the intelligence returned to guide your approach — especially `similar` and `patterns`.
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**What happens in practice:**
|
|
164
|
+
|
|
165
|
+
User: *"Refactor the payment service to add retry logic"*
|
|
166
|
+
|
|
167
|
+
Claude calls `marrow_think`:
|
|
168
|
+
```json
|
|
169
|
+
{ "action": "Adding retry logic to payment service", "type": "implementation" }
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Marrow returns:
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"intelligence": {
|
|
176
|
+
"similar": [
|
|
177
|
+
{ "outcome": "Exponential backoff with jitter. 3 retries max. Idempotency key required. Zero double-charges in 6 months.", "confidence": 0.96 }
|
|
178
|
+
],
|
|
179
|
+
"patterns": [
|
|
180
|
+
{ "pattern": "Retry without idempotency key causes duplicate transactions in 23% of cases", "frequency": 156 }
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Claude now knows — from thousands of other agents' experience — exactly what to do and what to avoid. Without Marrow, it would have guessed.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Why Marrow for MCP?
|
|
191
|
+
|
|
192
|
+
- **Zero setup friction** — one config entry, works instantly
|
|
193
|
+
- **Model agnostic** — Claude, GPT, Gemini, any MCP-compatible model
|
|
194
|
+
- **Compounds automatically** — every session adds to the hive, no manual curation
|
|
195
|
+
- **Private by default** — your agent's decisions are anonymized before entering the hive
|
|
196
|
+
- **Persistent across sessions** — memory survives context resets, model upgrades, new conversations
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Get Started
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
npm install -g @getmarrow/mcp
|
|
204
|
+
```
|
|
31
205
|
|
|
32
|
-
|
|
33
|
-
|
|
206
|
+
1. Get your API key at [getmarrow.ai](https://getmarrow.ai)
|
|
207
|
+
2. Add the MCP server config above
|
|
208
|
+
3. Tell your agent to call `marrow_think` before acting
|
|
209
|
+
4. Watch collective intelligence flow in from the first call
|
|
34
210
|
|
|
35
|
-
|
|
36
|
-
Full platform health — your success rate, hive activity, patterns detected.
|
|
211
|
+
**Your agent inherits the experience of every agent that came before it.**
|
|
37
212
|
|
|
38
|
-
|
|
213
|
+
---
|
|
39
214
|
|
|
40
|
-
|
|
215
|
+
*Compatible with Claude Desktop, Claude API, and any MCP-compatible framework.*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getmarrow/mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Your go-to memory provider for all agents, for any AI model.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"marrow-mcp": "dist/cli.js"
|
|
@@ -16,5 +16,9 @@
|
|
|
16
16
|
"memory",
|
|
17
17
|
"agents"
|
|
18
18
|
],
|
|
19
|
-
"license": "MIT"
|
|
20
|
-
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
]
|
|
24
|
+
}
|
package/src/cli.ts
DELETED
|
@@ -1,235 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Marrow MCP stdio server — collective memory for Claude and MCP agents.
|
|
5
|
-
* Exposes: marrow_think, marrow_commit, marrow_status
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as readline from 'readline';
|
|
9
|
-
import { marrowThink, marrowCommit, marrowStatus } from './index';
|
|
10
|
-
|
|
11
|
-
const API_KEY = process.env.MARROW_API_KEY || '';
|
|
12
|
-
const BASE_URL = process.env.MARROW_BASE_URL || 'https://api.getmarrow.ai';
|
|
13
|
-
|
|
14
|
-
if (!API_KEY) {
|
|
15
|
-
process.stderr.write('Error: MARROW_API_KEY environment variable is required\n');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// MCP protocol types
|
|
20
|
-
interface MCPRequest {
|
|
21
|
-
jsonrpc: '2.0';
|
|
22
|
-
id: string | number;
|
|
23
|
-
method: string;
|
|
24
|
-
params?: Record<string, unknown>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
interface MCPResponse {
|
|
28
|
-
jsonrpc: '2.0';
|
|
29
|
-
id: string | number;
|
|
30
|
-
result?: unknown;
|
|
31
|
-
error?: { code: number; message: string };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function send(response: MCPResponse): void {
|
|
35
|
-
process.stdout.write(JSON.stringify(response) + '\n');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function success(id: string | number, result: unknown): void {
|
|
39
|
-
send({ jsonrpc: '2.0', id, result });
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function error(id: string | number, code: number, message: string): void {
|
|
43
|
-
send({ jsonrpc: '2.0', id, error: { code, message } });
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Tool definitions
|
|
47
|
-
const TOOLS = [
|
|
48
|
-
{
|
|
49
|
-
name: 'marrow_think',
|
|
50
|
-
description:
|
|
51
|
-
'Get collective intelligence from the Marrow hive before acting. ' +
|
|
52
|
-
'Call this before every significant action. Pass previous_outcome ' +
|
|
53
|
-
'to auto-commit your last action and open a new memory session.',
|
|
54
|
-
inputSchema: {
|
|
55
|
-
type: 'object',
|
|
56
|
-
properties: {
|
|
57
|
-
action: {
|
|
58
|
-
type: 'string',
|
|
59
|
-
description: 'What the agent is about to do',
|
|
60
|
-
},
|
|
61
|
-
type: {
|
|
62
|
-
type: 'string',
|
|
63
|
-
enum: ['implementation', 'security', 'architecture', 'process', 'general'],
|
|
64
|
-
description: 'Type of action (default: general)',
|
|
65
|
-
},
|
|
66
|
-
context: {
|
|
67
|
-
type: 'object',
|
|
68
|
-
description: 'Optional metadata about the current situation',
|
|
69
|
-
},
|
|
70
|
-
previous_decision_id: {
|
|
71
|
-
type: 'string',
|
|
72
|
-
description: 'decision_id from previous think() call — auto-commits that session',
|
|
73
|
-
},
|
|
74
|
-
previous_success: {
|
|
75
|
-
type: 'boolean',
|
|
76
|
-
description: 'Did the previous action succeed?',
|
|
77
|
-
},
|
|
78
|
-
previous_outcome: {
|
|
79
|
-
type: 'string',
|
|
80
|
-
description: 'What happened in the previous action (required if previous_decision_id provided)',
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
required: ['action'],
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
name: 'marrow_commit',
|
|
88
|
-
description:
|
|
89
|
-
'Explicitly commit the result of an action to Marrow. ' +
|
|
90
|
-
'Optional — marrow_think() auto-commits if you pass previous_outcome. ' +
|
|
91
|
-
'Use when you need explicit control over commit timing.',
|
|
92
|
-
inputSchema: {
|
|
93
|
-
type: 'object',
|
|
94
|
-
properties: {
|
|
95
|
-
decision_id: {
|
|
96
|
-
type: 'string',
|
|
97
|
-
description: 'decision_id from the marrow_think call',
|
|
98
|
-
},
|
|
99
|
-
success: {
|
|
100
|
-
type: 'boolean',
|
|
101
|
-
description: 'Did the action succeed?',
|
|
102
|
-
},
|
|
103
|
-
outcome: {
|
|
104
|
-
type: 'string',
|
|
105
|
-
description: 'What happened — be specific, this trains the hive',
|
|
106
|
-
},
|
|
107
|
-
caused_by: {
|
|
108
|
-
type: 'string',
|
|
109
|
-
description: 'Optional: what caused this action',
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
required: ['decision_id', 'success', 'outcome'],
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 'marrow_status',
|
|
117
|
-
description: 'Check Marrow platform health and status.',
|
|
118
|
-
inputSchema: {
|
|
119
|
-
type: 'object',
|
|
120
|
-
properties: {},
|
|
121
|
-
required: [],
|
|
122
|
-
},
|
|
123
|
-
},
|
|
124
|
-
];
|
|
125
|
-
|
|
126
|
-
// Request handler
|
|
127
|
-
async function handleRequest(req: MCPRequest): Promise<void> {
|
|
128
|
-
const { id, method, params } = req;
|
|
129
|
-
|
|
130
|
-
try {
|
|
131
|
-
if (method === 'initialize') {
|
|
132
|
-
success(id, {
|
|
133
|
-
protocolVersion: '2024-11-05',
|
|
134
|
-
capabilities: { tools: {} },
|
|
135
|
-
serverInfo: { name: 'marrow', version: '2.0.0' },
|
|
136
|
-
});
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (method === 'tools/list') {
|
|
141
|
-
success(id, { tools: TOOLS });
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
if (method === 'tools/call') {
|
|
146
|
-
const toolName = (params as Record<string, unknown>)?.name as string;
|
|
147
|
-
const args = ((params as Record<string, unknown>)?.arguments || {}) as Record<string, unknown>;
|
|
148
|
-
|
|
149
|
-
if (toolName === 'marrow_think') {
|
|
150
|
-
const result = await marrowThink(API_KEY, BASE_URL, {
|
|
151
|
-
action: args.action as string,
|
|
152
|
-
type: args.type as string | undefined,
|
|
153
|
-
context: args.context as Record<string, unknown> | undefined,
|
|
154
|
-
previous_decision_id: args.previous_decision_id as string | undefined,
|
|
155
|
-
previous_success: args.previous_success as boolean | undefined,
|
|
156
|
-
previous_outcome: args.previous_outcome as string | undefined,
|
|
157
|
-
});
|
|
158
|
-
success(id, {
|
|
159
|
-
content: [
|
|
160
|
-
{
|
|
161
|
-
type: 'text',
|
|
162
|
-
text: JSON.stringify(result, null, 2),
|
|
163
|
-
},
|
|
164
|
-
],
|
|
165
|
-
});
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
if (toolName === 'marrow_commit') {
|
|
170
|
-
const result = await marrowCommit(API_KEY, BASE_URL, {
|
|
171
|
-
decision_id: args.decision_id as string,
|
|
172
|
-
success: args.success as boolean,
|
|
173
|
-
outcome: args.outcome as string,
|
|
174
|
-
caused_by: args.caused_by as string | undefined,
|
|
175
|
-
});
|
|
176
|
-
success(id, {
|
|
177
|
-
content: [
|
|
178
|
-
{
|
|
179
|
-
type: 'text',
|
|
180
|
-
text: JSON.stringify(result, null, 2),
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
});
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
if (toolName === 'marrow_status') {
|
|
188
|
-
const result = await marrowStatus(API_KEY, BASE_URL);
|
|
189
|
-
success(id, {
|
|
190
|
-
content: [
|
|
191
|
-
{
|
|
192
|
-
type: 'text',
|
|
193
|
-
text: JSON.stringify(result, null, 2),
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
});
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
error(id, -32601, `Unknown tool: ${toolName}`);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Unknown method
|
|
205
|
-
error(id, -32601, `Method not found: ${method}`);
|
|
206
|
-
} catch (err) {
|
|
207
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
208
|
-
error(id, -32603, `Internal error: ${message}`);
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// stdio server
|
|
213
|
-
const rl = readline.createInterface({
|
|
214
|
-
input: process.stdin,
|
|
215
|
-
output: process.stdout,
|
|
216
|
-
terminal: false,
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
rl.on('line', (line) => {
|
|
220
|
-
const trimmed = line.trim();
|
|
221
|
-
if (!trimmed) return;
|
|
222
|
-
|
|
223
|
-
try {
|
|
224
|
-
const req = JSON.parse(trimmed) as MCPRequest;
|
|
225
|
-
handleRequest(req).catch((err) => {
|
|
226
|
-
process.stderr.write(`Unhandled error: ${err}\n`);
|
|
227
|
-
});
|
|
228
|
-
} catch {
|
|
229
|
-
process.stderr.write(`Failed to parse request: ${trimmed}\n`);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
232
|
-
|
|
233
|
-
rl.on('close', () => {
|
|
234
|
-
process.exit(0);
|
|
235
|
-
});
|
package/src/index.ts
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
export interface MarrowIntelligence {
|
|
2
|
-
similar: Array<{ outcome: string; confidence: number }>;
|
|
3
|
-
patterns: Array<{ pattern: string; frequency: number }>;
|
|
4
|
-
templates: Array<{ steps: unknown[]; success_rate: number }>;
|
|
5
|
-
shared: Array<{ outcome: string }>;
|
|
6
|
-
causal_chain: unknown | null;
|
|
7
|
-
success_rate: number;
|
|
8
|
-
priority_score: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface ThinkResult {
|
|
12
|
-
decision_id: string;
|
|
13
|
-
intelligence: MarrowIntelligence;
|
|
14
|
-
stream_url: string;
|
|
15
|
-
previous_committed?: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface CommitResult {
|
|
19
|
-
committed: boolean;
|
|
20
|
-
success_rate: number;
|
|
21
|
-
insight: string | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface StatusResult {
|
|
25
|
-
status: string;
|
|
26
|
-
version: string;
|
|
27
|
-
tiers: number;
|
|
28
|
-
uptime_ms: number;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export async function marrowThink(
|
|
32
|
-
apiKey: string,
|
|
33
|
-
baseUrl: string,
|
|
34
|
-
params: {
|
|
35
|
-
action: string;
|
|
36
|
-
type?: string;
|
|
37
|
-
context?: Record<string, unknown>;
|
|
38
|
-
previous_decision_id?: string;
|
|
39
|
-
previous_success?: boolean;
|
|
40
|
-
previous_outcome?: string;
|
|
41
|
-
}
|
|
42
|
-
): Promise<ThinkResult> {
|
|
43
|
-
const body: Record<string, unknown> = {
|
|
44
|
-
action: params.action,
|
|
45
|
-
type: params.type || 'general',
|
|
46
|
-
};
|
|
47
|
-
if (params.context) body.context = params.context;
|
|
48
|
-
if (params.previous_decision_id) {
|
|
49
|
-
body.previous_decision_id = params.previous_decision_id;
|
|
50
|
-
body.previous_success = params.previous_success ?? true;
|
|
51
|
-
body.previous_outcome = params.previous_outcome ?? '';
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const res = await fetch(`${baseUrl}/v1/agent/think`, {
|
|
55
|
-
method: 'POST',
|
|
56
|
-
headers: {
|
|
57
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
58
|
-
'Content-Type': 'application/json',
|
|
59
|
-
},
|
|
60
|
-
body: JSON.stringify(body),
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const json = await res.json() as { data: ThinkResult; error?: string };
|
|
64
|
-
if (json.error) throw new Error(json.error);
|
|
65
|
-
return json.data;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export async function marrowCommit(
|
|
69
|
-
apiKey: string,
|
|
70
|
-
baseUrl: string,
|
|
71
|
-
params: {
|
|
72
|
-
decision_id: string;
|
|
73
|
-
success: boolean;
|
|
74
|
-
outcome: string;
|
|
75
|
-
caused_by?: string;
|
|
76
|
-
}
|
|
77
|
-
): Promise<CommitResult> {
|
|
78
|
-
const res = await fetch(`${baseUrl}/v1/agent/commit`, {
|
|
79
|
-
method: 'POST',
|
|
80
|
-
headers: {
|
|
81
|
-
'Authorization': `Bearer ${apiKey}`,
|
|
82
|
-
'Content-Type': 'application/json',
|
|
83
|
-
},
|
|
84
|
-
body: JSON.stringify(params),
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
const json = await res.json() as { data: CommitResult; error?: string };
|
|
88
|
-
if (json.error) throw new Error(json.error);
|
|
89
|
-
return json.data;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
export async function marrowStatus(
|
|
93
|
-
apiKey: string,
|
|
94
|
-
baseUrl: string
|
|
95
|
-
): Promise<StatusResult> {
|
|
96
|
-
const res = await fetch(`${baseUrl}/v1/health`, {
|
|
97
|
-
headers: { 'Authorization': `Bearer ${apiKey}` },
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
const json = await res.json() as { data: StatusResult; error?: string };
|
|
101
|
-
if (json.error) throw new Error(json.error);
|
|
102
|
-
return json.data;
|
|
103
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "commonjs",
|
|
5
|
-
"lib": ["ES2020"],
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"declarationMap": true,
|
|
8
|
-
"sourceMap": true,
|
|
9
|
-
"outDir": "./dist",
|
|
10
|
-
"rootDir": "./src",
|
|
11
|
-
"strict": true,
|
|
12
|
-
"esModuleInterop": true,
|
|
13
|
-
"skipLibCheck": true,
|
|
14
|
-
"forceConsistentCasingInFileNames": true
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|