@rolexjs/mcp-server 0.12.0-dev-20260223120451 → 0.12.0-dev-20260228032306
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/dist/index.js +102 -205
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ import { world } from "rolexjs";
|
|
|
11
11
|
var instructions = [
|
|
12
12
|
world["cognitive-priority"],
|
|
13
13
|
world["role-identity"],
|
|
14
|
+
world.nuwa,
|
|
14
15
|
world.execution,
|
|
15
16
|
world.cognition,
|
|
16
17
|
world.memory,
|
|
@@ -23,7 +24,7 @@ var instructions = [
|
|
|
23
24
|
// src/render.ts
|
|
24
25
|
import { describe, hint, renderState } from "rolexjs";
|
|
25
26
|
function render(opts) {
|
|
26
|
-
const { process, name, result, cognitiveHint } = opts;
|
|
27
|
+
const { process, name, result, cognitiveHint, fold } = opts;
|
|
27
28
|
const lines = [];
|
|
28
29
|
lines.push(describe(process, name, result.state));
|
|
29
30
|
lines.push(hint(process));
|
|
@@ -31,159 +32,30 @@ function render(opts) {
|
|
|
31
32
|
lines.push(`I \u2192 ${cognitiveHint}`);
|
|
32
33
|
}
|
|
33
34
|
lines.push("");
|
|
34
|
-
lines.push(renderState(result.state));
|
|
35
|
+
lines.push(renderState(result.state, 1, fold ? { fold } : void 0));
|
|
35
36
|
return lines.join("\n");
|
|
36
37
|
}
|
|
37
38
|
|
|
38
39
|
// src/state.ts
|
|
39
40
|
var McpState = class {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
focusedGoalId = null;
|
|
45
|
-
focusedPlanId = null;
|
|
46
|
-
encounterIds = /* @__PURE__ */ new Set();
|
|
47
|
-
experienceIds = /* @__PURE__ */ new Set();
|
|
48
|
-
// ================================================================
|
|
49
|
-
// Requirements — throw if missing
|
|
50
|
-
// ================================================================
|
|
51
|
-
requireRoleId() {
|
|
52
|
-
if (!this.activeRoleId) throw new Error("No active role. Call activate first.");
|
|
53
|
-
return this.activeRoleId;
|
|
54
|
-
}
|
|
55
|
-
requireGoalId() {
|
|
56
|
-
if (!this.focusedGoalId) throw new Error("No focused goal. Call want first.");
|
|
57
|
-
return this.focusedGoalId;
|
|
58
|
-
}
|
|
59
|
-
requirePlanId() {
|
|
60
|
-
if (!this.focusedPlanId) throw new Error("No focused plan. Call plan first.");
|
|
61
|
-
return this.focusedPlanId;
|
|
62
|
-
}
|
|
63
|
-
// ================================================================
|
|
64
|
-
// Cognition registries — encounter / experience ids
|
|
65
|
-
// ================================================================
|
|
66
|
-
addEncounter(id) {
|
|
67
|
-
this.encounterIds.add(id);
|
|
68
|
-
}
|
|
69
|
-
requireEncounterIds(ids) {
|
|
70
|
-
for (const id of ids) {
|
|
71
|
-
if (!this.encounterIds.has(id)) throw new Error(`Encounter not found: "${id}"`);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
consumeEncounters(ids) {
|
|
75
|
-
for (const id of ids) {
|
|
76
|
-
this.encounterIds.delete(id);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
addExperience(id) {
|
|
80
|
-
this.experienceIds.add(id);
|
|
81
|
-
}
|
|
82
|
-
requireExperienceIds(ids) {
|
|
83
|
-
for (const id of ids) {
|
|
84
|
-
if (!this.experienceIds.has(id)) throw new Error(`Experience not found: "${id}"`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
consumeExperiences(ids) {
|
|
88
|
-
for (const id of ids) {
|
|
89
|
-
this.experienceIds.delete(id);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// ================================================================
|
|
93
|
-
// Lookup
|
|
94
|
-
// ================================================================
|
|
95
|
-
findIndividual(roleId) {
|
|
96
|
-
return this.rolex.find(roleId) !== null;
|
|
97
|
-
}
|
|
98
|
-
// ================================================================
|
|
99
|
-
// Activation helpers
|
|
100
|
-
// ================================================================
|
|
101
|
-
/** Reset all session state — called before rehydrating a new role. */
|
|
102
|
-
reset() {
|
|
103
|
-
this.activeRoleId = null;
|
|
104
|
-
this.focusedGoalId = null;
|
|
105
|
-
this.focusedPlanId = null;
|
|
106
|
-
this.encounterIds.clear();
|
|
107
|
-
this.experienceIds.clear();
|
|
108
|
-
}
|
|
109
|
-
/** Rehydrate ids from an activation projection. */
|
|
110
|
-
cacheFromActivation(state2) {
|
|
111
|
-
this.rehydrate(state2);
|
|
112
|
-
}
|
|
113
|
-
/** Walk the state tree and collect ids into the appropriate registries. */
|
|
114
|
-
rehydrate(node) {
|
|
115
|
-
if (node.id) {
|
|
116
|
-
switch (node.name) {
|
|
117
|
-
case "goal":
|
|
118
|
-
if (!this.focusedGoalId) this.focusedGoalId = node.id;
|
|
119
|
-
break;
|
|
120
|
-
case "encounter":
|
|
121
|
-
this.encounterIds.add(node.id);
|
|
122
|
-
break;
|
|
123
|
-
case "experience":
|
|
124
|
-
this.experienceIds.add(node.id);
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
for (const child of node.children ?? []) {
|
|
129
|
-
this.rehydrate(child);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
// ================================================================
|
|
133
|
-
// Cognitive hints — state-aware AI self-direction cues
|
|
134
|
-
// ================================================================
|
|
135
|
-
/** First-person, state-aware hint for the AI after an operation. */
|
|
136
|
-
cognitiveHint(process) {
|
|
137
|
-
switch (process) {
|
|
138
|
-
case "activate":
|
|
139
|
-
if (!this.focusedGoalId)
|
|
140
|
-
return "I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.";
|
|
141
|
-
return "I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.";
|
|
142
|
-
case "focus":
|
|
143
|
-
if (!this.focusedPlanId)
|
|
144
|
-
return "I have a goal but no plan. I should call `plan` to design how to achieve it.";
|
|
145
|
-
return "I have a plan. I should call `todo` to create tasks, or continue working.";
|
|
146
|
-
case "want":
|
|
147
|
-
return "Goal declared. I should call `plan` to design how to achieve it.";
|
|
148
|
-
case "plan":
|
|
149
|
-
return "Plan created. I should call `todo` to create concrete tasks.";
|
|
150
|
-
case "todo":
|
|
151
|
-
return "Task created. I can add more with `todo`, or start working and call `finish` when done.";
|
|
152
|
-
case "finish": {
|
|
153
|
-
const encCount = this.encounterIds.size;
|
|
154
|
-
if (encCount > 0 && !this.focusedGoalId)
|
|
155
|
-
return `Task finished. No more goals \u2014 I have ${encCount} encounter(s) to choose from for \`reflect\`, or \`want\` a new goal.`;
|
|
156
|
-
return "Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.";
|
|
157
|
-
}
|
|
158
|
-
case "complete":
|
|
159
|
-
case "abandon": {
|
|
160
|
-
const encCount = this.encounterIds.size;
|
|
161
|
-
if (encCount > 0)
|
|
162
|
-
return `Plan closed. I have ${encCount} encounter(s) to choose from for \`reflect\`, or I can continue with other plans.`;
|
|
163
|
-
return "Plan closed. I can create a new `plan`, or `focus` on another goal.";
|
|
164
|
-
}
|
|
165
|
-
case "reflect": {
|
|
166
|
-
const expCount = this.experienceIds.size;
|
|
167
|
-
if (expCount > 0)
|
|
168
|
-
return `Experience gained. I can \`realize\` principles or \`master\` procedures \u2014 ${expCount} experience(s) available.`;
|
|
169
|
-
return "Experience gained. I can `realize` a principle, `master` a procedure, or continue working.";
|
|
170
|
-
}
|
|
171
|
-
case "realize":
|
|
172
|
-
return "Principle added to knowledge. I should continue working.";
|
|
173
|
-
case "master":
|
|
174
|
-
return "Procedure added to knowledge. I should continue working.";
|
|
175
|
-
default:
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
41
|
+
role = null;
|
|
42
|
+
requireRole() {
|
|
43
|
+
if (!this.role) throw new Error("No active role. Call activate first.");
|
|
44
|
+
return this.role;
|
|
178
45
|
}
|
|
179
46
|
};
|
|
180
47
|
|
|
181
48
|
// src/index.ts
|
|
182
|
-
var rolex = createRoleX(
|
|
183
|
-
|
|
49
|
+
var rolex = createRoleX(
|
|
50
|
+
localPlatform({
|
|
51
|
+
bootstrap: ["npm:@rolexjs/genesis"]
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
await rolex.genesis();
|
|
55
|
+
var state = new McpState();
|
|
184
56
|
var server = new FastMCP({
|
|
185
57
|
name: "rolex",
|
|
186
|
-
version: "0.
|
|
58
|
+
version: "0.12.0",
|
|
187
59
|
instructions
|
|
188
60
|
});
|
|
189
61
|
function fmt(process, label, result) {
|
|
@@ -191,7 +63,7 @@ function fmt(process, label, result) {
|
|
|
191
63
|
process,
|
|
192
64
|
name: label,
|
|
193
65
|
result,
|
|
194
|
-
cognitiveHint:
|
|
66
|
+
cognitiveHint: result.hint ?? null
|
|
195
67
|
});
|
|
196
68
|
}
|
|
197
69
|
server.addTool({
|
|
@@ -201,14 +73,28 @@ server.addTool({
|
|
|
201
73
|
roleId: z.string().describe("Role name to activate")
|
|
202
74
|
}),
|
|
203
75
|
execute: async ({ roleId }) => {
|
|
204
|
-
|
|
205
|
-
rolex.
|
|
76
|
+
try {
|
|
77
|
+
const role = await rolex.activate(roleId);
|
|
78
|
+
state.role = role;
|
|
79
|
+
const result = role.project();
|
|
80
|
+
const focusedGoalId = role.ctx.focusedGoalId;
|
|
81
|
+
return render({
|
|
82
|
+
process: "activate",
|
|
83
|
+
name: roleId,
|
|
84
|
+
result,
|
|
85
|
+
cognitiveHint: result.hint ?? null,
|
|
86
|
+
fold: (node) => node.name === "goal" && node.id !== focusedGoalId
|
|
87
|
+
});
|
|
88
|
+
} catch {
|
|
89
|
+
const census = await rolex.direct("!census.list");
|
|
90
|
+
throw new Error(
|
|
91
|
+
`"${roleId}" not found. Available:
|
|
92
|
+
|
|
93
|
+
${census}
|
|
94
|
+
|
|
95
|
+
Try again with the correct id or alias.`
|
|
96
|
+
);
|
|
206
97
|
}
|
|
207
|
-
state.reset();
|
|
208
|
-
state.activeRoleId = roleId;
|
|
209
|
-
const result = await rolex.role.activate(roleId);
|
|
210
|
-
state.cacheFromActivation(result.state);
|
|
211
|
-
return fmt("activate", roleId, result);
|
|
212
98
|
}
|
|
213
99
|
});
|
|
214
100
|
server.addTool({
|
|
@@ -218,12 +104,8 @@ server.addTool({
|
|
|
218
104
|
id: z.string().optional().describe("Goal id to switch to. Omit to view current.")
|
|
219
105
|
}),
|
|
220
106
|
execute: async ({ id }) => {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
state.focusedPlanId = null;
|
|
224
|
-
}
|
|
225
|
-
const goalId = state.requireGoalId();
|
|
226
|
-
const result = rolex.role.focus(goalId);
|
|
107
|
+
const role = state.requireRole();
|
|
108
|
+
const result = role.focus(id);
|
|
227
109
|
return fmt("focus", id ?? "current goal", result);
|
|
228
110
|
}
|
|
229
111
|
});
|
|
@@ -235,10 +117,8 @@ server.addTool({
|
|
|
235
117
|
goal: z.string().describe("Gherkin Feature source describing the goal")
|
|
236
118
|
}),
|
|
237
119
|
execute: async ({ id, goal }) => {
|
|
238
|
-
const
|
|
239
|
-
const result =
|
|
240
|
-
state.focusedGoalId = id;
|
|
241
|
-
state.focusedPlanId = null;
|
|
120
|
+
const role = state.requireRole();
|
|
121
|
+
const result = role.want(goal, id);
|
|
242
122
|
return fmt("want", id, result);
|
|
243
123
|
}
|
|
244
124
|
});
|
|
@@ -247,12 +127,13 @@ server.addTool({
|
|
|
247
127
|
description: detail("plan"),
|
|
248
128
|
parameters: z.object({
|
|
249
129
|
id: z.string().describe("Plan id \u2014 keywords from the plan content joined by hyphens"),
|
|
250
|
-
plan: z.string().describe("Gherkin Feature source describing the plan")
|
|
130
|
+
plan: z.string().describe("Gherkin Feature source describing the plan"),
|
|
131
|
+
after: z.string().optional().describe("Plan id this plan follows (sequential/phase relationship)"),
|
|
132
|
+
fallback: z.string().optional().describe("Plan id this plan is a backup for (alternative/strategy relationship)")
|
|
251
133
|
}),
|
|
252
|
-
execute: async ({ id, plan }) => {
|
|
253
|
-
const
|
|
254
|
-
const result =
|
|
255
|
-
state.focusedPlanId = id;
|
|
134
|
+
execute: async ({ id, plan, after, fallback }) => {
|
|
135
|
+
const role = state.requireRole();
|
|
136
|
+
const result = role.plan(plan, id, after, fallback);
|
|
256
137
|
return fmt("plan", id, result);
|
|
257
138
|
}
|
|
258
139
|
});
|
|
@@ -264,8 +145,8 @@ server.addTool({
|
|
|
264
145
|
task: z.string().describe("Gherkin Feature source describing the task")
|
|
265
146
|
}),
|
|
266
147
|
execute: async ({ id, task }) => {
|
|
267
|
-
const
|
|
268
|
-
const result =
|
|
148
|
+
const role = state.requireRole();
|
|
149
|
+
const result = role.todo(task, id);
|
|
269
150
|
return fmt("todo", id, result);
|
|
270
151
|
}
|
|
271
152
|
});
|
|
@@ -277,10 +158,8 @@ server.addTool({
|
|
|
277
158
|
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
278
159
|
}),
|
|
279
160
|
execute: async ({ id, encounter }) => {
|
|
280
|
-
const
|
|
281
|
-
const result =
|
|
282
|
-
const encId = result.state.id ?? id;
|
|
283
|
-
state.addEncounter(encId);
|
|
161
|
+
const role = state.requireRole();
|
|
162
|
+
const result = role.finish(id, encounter);
|
|
284
163
|
return fmt("finish", id, result);
|
|
285
164
|
}
|
|
286
165
|
});
|
|
@@ -292,13 +171,9 @@ server.addTool({
|
|
|
292
171
|
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
293
172
|
}),
|
|
294
173
|
execute: async ({ id, encounter }) => {
|
|
295
|
-
const
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
const encId = result.state.id ?? planId;
|
|
299
|
-
state.addEncounter(encId);
|
|
300
|
-
if (state.focusedPlanId === planId) state.focusedPlanId = null;
|
|
301
|
-
return fmt("complete", planId, result);
|
|
174
|
+
const role = state.requireRole();
|
|
175
|
+
const result = role.complete(id, encounter);
|
|
176
|
+
return fmt("complete", id ?? "focused plan", result);
|
|
302
177
|
}
|
|
303
178
|
});
|
|
304
179
|
server.addTool({
|
|
@@ -309,13 +184,9 @@ server.addTool({
|
|
|
309
184
|
encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
|
|
310
185
|
}),
|
|
311
186
|
execute: async ({ id, encounter }) => {
|
|
312
|
-
const
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const encId = result.state.id ?? planId;
|
|
316
|
-
state.addEncounter(encId);
|
|
317
|
-
if (state.focusedPlanId === planId) state.focusedPlanId = null;
|
|
318
|
-
return fmt("abandon", planId, result);
|
|
187
|
+
const role = state.requireRole();
|
|
188
|
+
const result = role.abandon(id, encounter);
|
|
189
|
+
return fmt("abandon", id ?? "focused plan", result);
|
|
319
190
|
}
|
|
320
191
|
});
|
|
321
192
|
server.addTool({
|
|
@@ -327,11 +198,8 @@ server.addTool({
|
|
|
327
198
|
experience: z.string().optional().describe("Gherkin Feature source for the experience")
|
|
328
199
|
}),
|
|
329
200
|
execute: async ({ ids, id, experience }) => {
|
|
330
|
-
state.
|
|
331
|
-
const
|
|
332
|
-
const result = rolex.role.reflect(ids[0], roleId, experience, id);
|
|
333
|
-
state.consumeEncounters(ids);
|
|
334
|
-
state.addExperience(id);
|
|
201
|
+
const role = state.requireRole();
|
|
202
|
+
const result = role.reflect(ids[0], experience, id);
|
|
335
203
|
return fmt("reflect", id, result);
|
|
336
204
|
}
|
|
337
205
|
});
|
|
@@ -344,10 +212,8 @@ server.addTool({
|
|
|
344
212
|
principle: z.string().optional().describe("Gherkin Feature source for the principle")
|
|
345
213
|
}),
|
|
346
214
|
execute: async ({ ids, id, principle }) => {
|
|
347
|
-
state.
|
|
348
|
-
const
|
|
349
|
-
const result = rolex.role.realize(ids[0], roleId, principle, id);
|
|
350
|
-
state.consumeExperiences(ids);
|
|
215
|
+
const role = state.requireRole();
|
|
216
|
+
const result = role.realize(ids[0], principle, id);
|
|
351
217
|
return fmt("realize", id, result);
|
|
352
218
|
}
|
|
353
219
|
});
|
|
@@ -355,15 +221,13 @@ server.addTool({
|
|
|
355
221
|
name: "master",
|
|
356
222
|
description: detail("master"),
|
|
357
223
|
parameters: z.object({
|
|
358
|
-
ids: z.array(z.string()).describe("Experience ids to distill into a procedure"),
|
|
224
|
+
ids: z.array(z.string()).optional().describe("Experience ids to distill into a procedure"),
|
|
359
225
|
id: z.string().describe("Procedure id \u2014 keywords from the procedure content joined by hyphens"),
|
|
360
|
-
procedure: z.string().
|
|
226
|
+
procedure: z.string().describe("Gherkin Feature source for the procedure")
|
|
361
227
|
}),
|
|
362
228
|
execute: async ({ ids, id, procedure }) => {
|
|
363
|
-
state.
|
|
364
|
-
const
|
|
365
|
-
const result = rolex.role.master(ids[0], roleId, procedure, id);
|
|
366
|
-
state.consumeExperiences(ids);
|
|
229
|
+
const role = state.requireRole();
|
|
230
|
+
const result = role.master(procedure, id, ids?.[0]);
|
|
367
231
|
return fmt("master", id, result);
|
|
368
232
|
}
|
|
369
233
|
});
|
|
@@ -374,8 +238,8 @@ server.addTool({
|
|
|
374
238
|
id: z.string().describe("Id of the node to remove (principle, procedure, experience, encounter, etc.)")
|
|
375
239
|
}),
|
|
376
240
|
execute: async ({ id }) => {
|
|
377
|
-
const
|
|
378
|
-
const result =
|
|
241
|
+
const role = state.requireRole();
|
|
242
|
+
const result = role.forget(id);
|
|
379
243
|
return fmt("forget", id, result);
|
|
380
244
|
}
|
|
381
245
|
});
|
|
@@ -386,8 +250,41 @@ server.addTool({
|
|
|
386
250
|
locator: z.string().describe("ResourceX locator for the skill (e.g. deepractice/role-management)")
|
|
387
251
|
}),
|
|
388
252
|
execute: async ({ locator }) => {
|
|
389
|
-
const
|
|
390
|
-
return
|
|
253
|
+
const role = state.requireRole();
|
|
254
|
+
return role.skill(locator);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
server.addTool({
|
|
258
|
+
name: "use",
|
|
259
|
+
description: detail("use"),
|
|
260
|
+
parameters: z.object({
|
|
261
|
+
locator: z.string().describe(
|
|
262
|
+
"Locator string. !namespace.method for RoleX commands, or a ResourceX locator for resources"
|
|
263
|
+
),
|
|
264
|
+
args: z.record(z.unknown()).optional().describe("Named arguments for the command or resource")
|
|
265
|
+
}),
|
|
266
|
+
execute: async ({ locator, args }) => {
|
|
267
|
+
const role = state.requireRole();
|
|
268
|
+
const result = await role.use(locator, args);
|
|
269
|
+
if (result == null) return `${locator} done.`;
|
|
270
|
+
if (typeof result === "string") return result;
|
|
271
|
+
return JSON.stringify(result, null, 2);
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
server.addTool({
|
|
275
|
+
name: "direct",
|
|
276
|
+
description: detail("direct"),
|
|
277
|
+
parameters: z.object({
|
|
278
|
+
locator: z.string().describe(
|
|
279
|
+
"Locator string. !namespace.method for RoleX commands, or a ResourceX locator for resources"
|
|
280
|
+
),
|
|
281
|
+
args: z.record(z.unknown()).optional().describe("Named arguments for the command or resource")
|
|
282
|
+
}),
|
|
283
|
+
execute: async ({ locator, args }) => {
|
|
284
|
+
const result = await rolex.direct(locator, args);
|
|
285
|
+
if (result == null) return `${locator} done.`;
|
|
286
|
+
if (typeof result === "string") return result;
|
|
287
|
+
return JSON.stringify(result, null, 2);
|
|
391
288
|
}
|
|
392
289
|
});
|
|
393
290
|
server.start({
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/instructions.ts","../src/render.ts","../src/state.ts"],"sourcesContent":["/**\n * @rolexjs/mcp-server — individual-level MCP tools.\n *\n * Thin wrapper around the Rolex API (which accepts string ids).\n * McpState holds session context: activeRoleId, focusedGoalId, encounter/experience ids.\n *\n * Tools:\n * activate — activate a role\n * focus — view / switch focused goal\n * want — declare a goal\n * plan — plan for focused goal\n * todo — add task to focused plan\n * finish — finish a task → encounter\n * complete — complete focused plan → encounter\n * abandon — abandon focused plan → encounter\n * reflect — encounter(s) → experience\n * realize — experience(s) → principle\n * master — experience(s) → procedure\n * forget — remove a node from the individual\n * skill — load full skill content by locator\n */\n\nimport { localPlatform } from \"@rolexjs/local-platform\";\nimport { FastMCP } from \"fastmcp\";\nimport { createRoleX, detail } from \"rolexjs\";\nimport { z } from \"zod\";\nimport { instructions } from \"./instructions.js\";\nimport { render } from \"./render.js\";\nimport { McpState } from \"./state.js\";\n\n// ========== Setup ==========\n\nconst rolex = createRoleX(localPlatform());\nconst state = new McpState(rolex);\n\n// ========== Server ==========\n\nconst server = new FastMCP({\n name: \"rolex\",\n version: \"0.11.0\",\n instructions,\n});\n\n// ========== Helpers ==========\n\nfunction fmt(process: string, label: string, result: { state: any; process: string }) {\n return render({\n process,\n name: label,\n result,\n cognitiveHint: state.cognitiveHint(process),\n });\n}\n\n// ========== Tools: Role ==========\n\nserver.addTool({\n name: \"activate\",\n description: detail(\"activate\"),\n parameters: z.object({\n roleId: z.string().describe(\"Role name to activate\"),\n }),\n execute: async ({ roleId }) => {\n if (!state.findIndividual(roleId)) {\n // Auto-born if not found\n rolex.individual.born(undefined, roleId);\n }\n state.reset();\n state.activeRoleId = roleId;\n const result = await rolex.role.activate(roleId);\n state.cacheFromActivation(result.state);\n return fmt(\"activate\", roleId, result);\n },\n});\n\nserver.addTool({\n name: \"focus\",\n description: detail(\"focus\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Goal id to switch to. Omit to view current.\"),\n }),\n execute: async ({ id }) => {\n if (id) {\n state.focusedGoalId = id;\n state.focusedPlanId = null;\n }\n const goalId = state.requireGoalId();\n const result = rolex.role.focus(goalId);\n return fmt(\"focus\", id ?? \"current goal\", result);\n },\n});\n\n// ========== Tools: Execution ==========\n\nserver.addTool({\n name: \"want\",\n description: detail(\"want\"),\n parameters: z.object({\n id: z.string().describe(\"Goal id (used for focus/reference)\"),\n goal: z.string().describe(\"Gherkin Feature source describing the goal\"),\n }),\n execute: async ({ id, goal }) => {\n const roleId = state.requireRoleId();\n const result = rolex.role.want(roleId, goal, id);\n state.focusedGoalId = id;\n state.focusedPlanId = null;\n return fmt(\"want\", id, result);\n },\n});\n\nserver.addTool({\n name: \"plan\",\n description: detail(\"plan\"),\n parameters: z.object({\n id: z.string().describe(\"Plan id — keywords from the plan content joined by hyphens\"),\n plan: z.string().describe(\"Gherkin Feature source describing the plan\"),\n }),\n execute: async ({ id, plan }) => {\n const goalId = state.requireGoalId();\n const result = rolex.role.plan(goalId, plan, id);\n state.focusedPlanId = id;\n return fmt(\"plan\", id, result);\n },\n});\n\nserver.addTool({\n name: \"todo\",\n description: detail(\"todo\"),\n parameters: z.object({\n id: z.string().describe(\"Task id (used for finish/reference)\"),\n task: z.string().describe(\"Gherkin Feature source describing the task\"),\n }),\n execute: async ({ id, task }) => {\n const planId = state.requirePlanId();\n const result = rolex.role.todo(planId, task, id);\n return fmt(\"todo\", id, result);\n },\n});\n\nserver.addTool({\n name: \"finish\",\n description: detail(\"finish\"),\n parameters: z.object({\n id: z.string().describe(\"Task id to finish\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const result = rolex.role.finish(id, roleId, encounter);\n const encId = result.state.id ?? id;\n state.addEncounter(encId);\n return fmt(\"finish\", id, result);\n },\n});\n\nserver.addTool({\n name: \"complete\",\n description: detail(\"complete\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to complete (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const planId = id ?? state.requirePlanId();\n const result = rolex.role.complete(planId, roleId, encounter);\n const encId = result.state.id ?? planId;\n state.addEncounter(encId);\n if (state.focusedPlanId === planId) state.focusedPlanId = null;\n return fmt(\"complete\", planId, result);\n },\n});\n\nserver.addTool({\n name: \"abandon\",\n description: detail(\"abandon\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to abandon (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const roleId = state.requireRoleId();\n const planId = id ?? state.requirePlanId();\n const result = rolex.role.abandon(planId, roleId, encounter);\n const encId = result.state.id ?? planId;\n state.addEncounter(encId);\n if (state.focusedPlanId === planId) state.focusedPlanId = null;\n return fmt(\"abandon\", planId, result);\n },\n});\n\n// ========== Tools: Cognition ==========\n\nserver.addTool({\n name: \"reflect\",\n description: detail(\"reflect\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Encounter ids to reflect on (selective consumption)\"),\n id: z\n .string()\n .describe(\"Experience id — keywords from the experience content joined by hyphens\"),\n experience: z.string().optional().describe(\"Gherkin Feature source for the experience\"),\n }),\n execute: async ({ ids, id, experience }) => {\n state.requireEncounterIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.reflect(ids[0], roleId, experience, id);\n state.consumeEncounters(ids);\n state.addExperience(id);\n return fmt(\"reflect\", id, result);\n },\n});\n\nserver.addTool({\n name: \"realize\",\n description: detail(\"realize\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Experience ids to distill into a principle\"),\n id: z.string().describe(\"Principle id — keywords from the principle content joined by hyphens\"),\n principle: z.string().optional().describe(\"Gherkin Feature source for the principle\"),\n }),\n execute: async ({ ids, id, principle }) => {\n state.requireExperienceIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.realize(ids[0], roleId, principle, id);\n state.consumeExperiences(ids);\n return fmt(\"realize\", id, result);\n },\n});\n\nserver.addTool({\n name: \"master\",\n description: detail(\"master\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Experience ids to distill into a procedure\"),\n id: z.string().describe(\"Procedure id — keywords from the procedure content joined by hyphens\"),\n procedure: z.string().optional().describe(\"Gherkin Feature source for the procedure\"),\n }),\n execute: async ({ ids, id, procedure }) => {\n state.requireExperienceIds(ids);\n const roleId = state.requireRoleId();\n const result = rolex.role.master(ids[0], roleId, procedure, id);\n state.consumeExperiences(ids);\n return fmt(\"master\", id, result);\n },\n});\n\n// ========== Tools: Knowledge management ==========\n\nserver.addTool({\n name: \"forget\",\n description: detail(\"forget\"),\n parameters: z.object({\n id: z\n .string()\n .describe(\"Id of the node to remove (principle, procedure, experience, encounter, etc.)\"),\n }),\n execute: async ({ id }) => {\n const roleId = state.requireRoleId();\n const result = await rolex.role.forget(id, roleId);\n return fmt(\"forget\", id, result);\n },\n});\n\n// ========== Tools: Skill loading ==========\n\nserver.addTool({\n name: \"skill\",\n description: detail(\"skill\"),\n parameters: z.object({\n locator: z\n .string()\n .describe(\"ResourceX locator for the skill (e.g. deepractice/role-management)\"),\n }),\n execute: async ({ locator }) => {\n const content = await rolex.role.skill(locator);\n return content;\n },\n});\n\n// ========== Start ==========\n\nserver.start({\n transportType: \"stdio\",\n});\n","/**\n * MCP server instructions — the cognitive framework for AI roles.\n *\n * Assembled from world .feature files in rolexjs descriptions.\n * Each feature describes one independent concern of the RoleX framework.\n */\nimport { world } from \"rolexjs\";\n\nexport const instructions = [\n world[\"cognitive-priority\"],\n world[\"role-identity\"],\n world.execution,\n world.cognition,\n world.memory,\n world.gherkin,\n world.communication,\n world[\"skill-system\"],\n world[\"state-origin\"],\n].join(\"\\n\\n\");\n","/**\n * Render — 3-layer output for MCP tool results.\n *\n * Layer 1: Status — what just happened (describe)\n * Layer 2: Hint — what to do next (hint)\n * Layer 3: Projection — full state tree as markdown (renderState)\n *\n * MCP and CLI share describe() + hint() + renderState() from rolexjs.\n * Relations are rendered per-node via bidirectional links — no separate layer needed.\n */\nimport type { RolexResult } from \"rolexjs\";\nimport { describe, hint, renderState } from \"rolexjs\";\n\n// ================================================================\n// Public API\n// ================================================================\n\nexport interface RenderOptions {\n /** The process that was executed. */\n process: string;\n /** Display name for the primary node. */\n name: string;\n /** Result from the Rolex API. */\n result: RolexResult;\n /** AI cognitive hint — first-person, state-aware self-direction cue. */\n cognitiveHint?: string | null;\n}\n\n/** Render a full 3-layer output string. */\nexport function render(opts: RenderOptions): string {\n const { process, name, result, cognitiveHint } = opts;\n const lines: string[] = [];\n\n // Layer 1: Status\n lines.push(describe(process, name, result.state));\n\n // Layer 2: Hint (static) + Cognitive hint (state-aware)\n lines.push(hint(process));\n if (cognitiveHint) {\n lines.push(`I → ${cognitiveHint}`);\n }\n\n // Layer 3: Projection — generic markdown rendering of the full state tree\n lines.push(\"\");\n lines.push(renderState(result.state));\n\n return lines.join(\"\\n\");\n}\n","/**\n * McpState — stateful session for the MCP server.\n *\n * Holds what the stateless Rolex API does not:\n * - activeRoleId (which individual is \"me\")\n * - focusedGoalId / focusedPlanId (execution context)\n * - encounter / experience id sets (for selective cognition)\n *\n * Since the Rolex API now accepts string ids directly,\n * McpState only stores ids — no Structure references.\n */\nimport type { Rolex, State } from \"rolexjs\";\n\nexport class McpState {\n activeRoleId: string | null = null;\n focusedGoalId: string | null = null;\n focusedPlanId: string | null = null;\n\n private encounterIds = new Set<string>();\n private experienceIds = new Set<string>();\n\n constructor(readonly rolex: Rolex) {}\n\n // ================================================================\n // Requirements — throw if missing\n // ================================================================\n\n requireRoleId(): string {\n if (!this.activeRoleId) throw new Error(\"No active role. Call activate first.\");\n return this.activeRoleId;\n }\n\n requireGoalId(): string {\n if (!this.focusedGoalId) throw new Error(\"No focused goal. Call want first.\");\n return this.focusedGoalId;\n }\n\n requirePlanId(): string {\n if (!this.focusedPlanId) throw new Error(\"No focused plan. Call plan first.\");\n return this.focusedPlanId;\n }\n\n // ================================================================\n // Cognition registries — encounter / experience ids\n // ================================================================\n\n addEncounter(id: string) {\n this.encounterIds.add(id);\n }\n\n requireEncounterIds(ids: string[]) {\n for (const id of ids) {\n if (!this.encounterIds.has(id)) throw new Error(`Encounter not found: \"${id}\"`);\n }\n }\n\n consumeEncounters(ids: string[]) {\n for (const id of ids) {\n this.encounterIds.delete(id);\n }\n }\n\n addExperience(id: string) {\n this.experienceIds.add(id);\n }\n\n requireExperienceIds(ids: string[]) {\n for (const id of ids) {\n if (!this.experienceIds.has(id)) throw new Error(`Experience not found: \"${id}\"`);\n }\n }\n\n consumeExperiences(ids: string[]) {\n for (const id of ids) {\n this.experienceIds.delete(id);\n }\n }\n\n // ================================================================\n // Lookup\n // ================================================================\n\n findIndividual(roleId: string): boolean {\n return this.rolex.find(roleId) !== null;\n }\n\n // ================================================================\n // Activation helpers\n // ================================================================\n\n /** Reset all session state — called before rehydrating a new role. */\n reset() {\n this.activeRoleId = null;\n this.focusedGoalId = null;\n this.focusedPlanId = null;\n this.encounterIds.clear();\n this.experienceIds.clear();\n }\n\n /** Rehydrate ids from an activation projection. */\n cacheFromActivation(state: State) {\n this.rehydrate(state);\n }\n\n /** Walk the state tree and collect ids into the appropriate registries. */\n private rehydrate(node: State) {\n if (node.id) {\n switch (node.name) {\n case \"goal\":\n // Set focused goal to the first one found if none set\n if (!this.focusedGoalId) this.focusedGoalId = node.id;\n break;\n case \"encounter\":\n this.encounterIds.add(node.id);\n break;\n case \"experience\":\n this.experienceIds.add(node.id);\n break;\n }\n }\n for (const child of (node as State & { children?: readonly State[] }).children ?? []) {\n this.rehydrate(child);\n }\n }\n\n // ================================================================\n // Cognitive hints — state-aware AI self-direction cues\n // ================================================================\n\n /** First-person, state-aware hint for the AI after an operation. */\n cognitiveHint(process: string): string | null {\n switch (process) {\n case \"activate\":\n if (!this.focusedGoalId)\n return \"I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.\";\n return \"I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.\";\n\n case \"focus\":\n if (!this.focusedPlanId)\n return \"I have a goal but no plan. I should call `plan` to design how to achieve it.\";\n return \"I have a plan. I should call `todo` to create tasks, or continue working.\";\n\n case \"want\":\n return \"Goal declared. I should call `plan` to design how to achieve it.\";\n\n case \"plan\":\n return \"Plan created. I should call `todo` to create concrete tasks.\";\n\n case \"todo\":\n return \"Task created. I can add more with `todo`, or start working and call `finish` when done.\";\n\n case \"finish\": {\n const encCount = this.encounterIds.size;\n if (encCount > 0 && !this.focusedGoalId)\n return `Task finished. No more goals — I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or \\`want\\` a new goal.`;\n return \"Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.\";\n }\n\n case \"complete\":\n case \"abandon\": {\n const encCount = this.encounterIds.size;\n if (encCount > 0)\n return `Plan closed. I have ${encCount} encounter(s) to choose from for \\`reflect\\`, or I can continue with other plans.`;\n return \"Plan closed. I can create a new `plan`, or `focus` on another goal.\";\n }\n\n case \"reflect\": {\n const expCount = this.experienceIds.size;\n if (expCount > 0)\n return `Experience gained. I can \\`realize\\` principles or \\`master\\` procedures — ${expCount} experience(s) available.`;\n return \"Experience gained. I can `realize` a principle, `master` a procedure, or continue working.\";\n }\n\n case \"realize\":\n return \"Principle added to knowledge. I should continue working.\";\n\n case \"master\":\n return \"Procedure added to knowledge. I should continue working.\";\n\n default:\n return null;\n }\n }\n}\n"],"mappings":";;;AAsBA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,aAAa,cAAc;AACpC,SAAS,SAAS;;;ACnBlB,SAAS,aAAa;AAEf,IAAM,eAAe;AAAA,EAC1B,MAAM,oBAAoB;AAAA,EAC1B,MAAM,eAAe;AAAA,EACrB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM,cAAc;AAAA,EACpB,MAAM,cAAc;AACtB,EAAE,KAAK,MAAM;;;ACPb,SAAS,UAAU,MAAM,mBAAmB;AAkBrC,SAAS,OAAO,MAA6B;AAClD,QAAM,EAAE,SAAS,MAAM,QAAQ,cAAc,IAAI;AACjD,QAAM,QAAkB,CAAC;AAGzB,QAAM,KAAK,SAAS,SAAS,MAAM,OAAO,KAAK,CAAC;AAGhD,QAAM,KAAK,KAAK,OAAO,CAAC;AACxB,MAAI,eAAe;AACjB,UAAM,KAAK,YAAO,aAAa,EAAE;AAAA,EACnC;AAGA,QAAM,KAAK,EAAE;AACb,QAAM,KAAK,YAAY,OAAO,KAAK,CAAC;AAEpC,SAAO,MAAM,KAAK,IAAI;AACxB;;;AClCO,IAAM,WAAN,MAAe;AAAA,EAQpB,YAAqBA,QAAc;AAAd,iBAAAA;AAAA,EAAe;AAAA,EAP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AAE,OAAO;AAAA,IACnB,IAAI,EACD,OAAO,EACP,SAAS,8EAA8E;AAAA,EAC5F,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,GAAG,MAAM;AACzB,UAAM,SAAS,MAAM,cAAc;AACnC,UAAM,SAAS,MAAM,MAAM,KAAK,OAAO,IAAI,MAAM;AACjD,WAAO,IAAI,UAAU,IAAI,MAAM;AAAA,EACjC;AACF,CAAC;AAID,OAAO,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,aAAa,OAAO,OAAO;AAAA,EAC3B,YAAY,EAAE,OAAO;AAAA,IACnB,SAAS,EACN,OAAO,EACP,SAAS,oEAAoE;AAAA,EAClF,CAAC;AAAA,EACD,SAAS,OAAO,EAAE,QAAQ,MAAM;AAC9B,UAAM,UAAU,MAAM,MAAM,KAAK,MAAM,OAAO;AAC9C,WAAO;AAAA,EACT;AACF,CAAC;AAID,OAAO,MAAM;AAAA,EACX,eAAe;AACjB,CAAC;","names":["rolex","state"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/instructions.ts","../src/render.ts","../src/state.ts"],"sourcesContent":["/**\n * @rolexjs/mcp-server — individual-level MCP tools.\n *\n * Thin wrapper around the Rolex API. All business logic (state tracking,\n * cognitive hints, encounter/experience registries) lives in Role + RoleContext.\n * MCP only translates protocol calls to API calls.\n */\n\nimport { localPlatform } from \"@rolexjs/local-platform\";\nimport { FastMCP } from \"fastmcp\";\nimport { createRoleX, detail } from \"rolexjs\";\n\nimport { z } from \"zod\";\nimport { instructions } from \"./instructions.js\";\nimport { render } from \"./render.js\";\nimport { McpState } from \"./state.js\";\n\n// ========== Setup ==========\n\nconst rolex = createRoleX(\n localPlatform({\n bootstrap: [\"npm:@rolexjs/genesis\"],\n })\n);\nawait rolex.genesis();\nconst state = new McpState();\n\n// ========== Server ==========\n\nconst server = new FastMCP({\n name: \"rolex\",\n version: \"0.12.0\",\n instructions,\n});\n\n// ========== Helpers ==========\n\nfunction fmt(\n process: string,\n label: string,\n result: { state: any; process: string; hint?: string }\n) {\n return render({\n process,\n name: label,\n result,\n cognitiveHint: result.hint ?? null,\n });\n}\n\n// ========== Tools: Role ==========\n\nserver.addTool({\n name: \"activate\",\n description: detail(\"activate\"),\n parameters: z.object({\n roleId: z.string().describe(\"Role name to activate\"),\n }),\n execute: async ({ roleId }) => {\n try {\n const role = await rolex.activate(roleId);\n state.role = role;\n const result = role.project();\n const focusedGoalId = role.ctx.focusedGoalId;\n return render({\n process: \"activate\",\n name: roleId,\n result,\n cognitiveHint: result.hint ?? null,\n fold: (node) => node.name === \"goal\" && node.id !== focusedGoalId,\n });\n } catch {\n const census = await rolex.direct<string>(\"!census.list\");\n throw new Error(\n `\"${roleId}\" not found. Available:\\n\\n${census}\\n\\nTry again with the correct id or alias.`\n );\n }\n },\n});\n\nserver.addTool({\n name: \"focus\",\n description: detail(\"focus\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Goal id to switch to. Omit to view current.\"),\n }),\n execute: async ({ id }) => {\n const role = state.requireRole();\n const result = role.focus(id);\n return fmt(\"focus\", id ?? \"current goal\", result);\n },\n});\n\n// ========== Tools: Execution ==========\n\nserver.addTool({\n name: \"want\",\n description: detail(\"want\"),\n parameters: z.object({\n id: z.string().describe(\"Goal id (used for focus/reference)\"),\n goal: z.string().describe(\"Gherkin Feature source describing the goal\"),\n }),\n execute: async ({ id, goal }) => {\n const role = state.requireRole();\n const result = role.want(goal, id);\n return fmt(\"want\", id, result);\n },\n});\n\nserver.addTool({\n name: \"plan\",\n description: detail(\"plan\"),\n parameters: z.object({\n id: z.string().describe(\"Plan id — keywords from the plan content joined by hyphens\"),\n plan: z.string().describe(\"Gherkin Feature source describing the plan\"),\n after: z\n .string()\n .optional()\n .describe(\"Plan id this plan follows (sequential/phase relationship)\"),\n fallback: z\n .string()\n .optional()\n .describe(\"Plan id this plan is a backup for (alternative/strategy relationship)\"),\n }),\n execute: async ({ id, plan, after, fallback }) => {\n const role = state.requireRole();\n const result = role.plan(plan, id, after, fallback);\n return fmt(\"plan\", id, result);\n },\n});\n\nserver.addTool({\n name: \"todo\",\n description: detail(\"todo\"),\n parameters: z.object({\n id: z.string().describe(\"Task id (used for finish/reference)\"),\n task: z.string().describe(\"Gherkin Feature source describing the task\"),\n }),\n execute: async ({ id, task }) => {\n const role = state.requireRole();\n const result = role.todo(task, id);\n return fmt(\"todo\", id, result);\n },\n});\n\nserver.addTool({\n name: \"finish\",\n description: detail(\"finish\"),\n parameters: z.object({\n id: z.string().describe(\"Task id to finish\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const role = state.requireRole();\n const result = role.finish(id, encounter);\n return fmt(\"finish\", id, result);\n },\n});\n\nserver.addTool({\n name: \"complete\",\n description: detail(\"complete\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to complete (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const role = state.requireRole();\n const result = role.complete(id, encounter);\n return fmt(\"complete\", id ?? \"focused plan\", result);\n },\n});\n\nserver.addTool({\n name: \"abandon\",\n description: detail(\"abandon\"),\n parameters: z.object({\n id: z.string().optional().describe(\"Plan id to abandon (defaults to focused plan)\"),\n encounter: z.string().optional().describe(\"Optional Gherkin Feature describing what happened\"),\n }),\n execute: async ({ id, encounter }) => {\n const role = state.requireRole();\n const result = role.abandon(id, encounter);\n return fmt(\"abandon\", id ?? \"focused plan\", result);\n },\n});\n\n// ========== Tools: Cognition ==========\n\nserver.addTool({\n name: \"reflect\",\n description: detail(\"reflect\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Encounter ids to reflect on (selective consumption)\"),\n id: z\n .string()\n .describe(\"Experience id — keywords from the experience content joined by hyphens\"),\n experience: z.string().optional().describe(\"Gherkin Feature source for the experience\"),\n }),\n execute: async ({ ids, id, experience }) => {\n const role = state.requireRole();\n const result = role.reflect(ids[0], experience, id);\n return fmt(\"reflect\", id, result);\n },\n});\n\nserver.addTool({\n name: \"realize\",\n description: detail(\"realize\"),\n parameters: z.object({\n ids: z.array(z.string()).describe(\"Experience ids to distill into a principle\"),\n id: z.string().describe(\"Principle id — keywords from the principle content joined by hyphens\"),\n principle: z.string().optional().describe(\"Gherkin Feature source for the principle\"),\n }),\n execute: async ({ ids, id, principle }) => {\n const role = state.requireRole();\n const result = role.realize(ids[0], principle, id);\n return fmt(\"realize\", id, result);\n },\n});\n\nserver.addTool({\n name: \"master\",\n description: detail(\"master\"),\n parameters: z.object({\n ids: z.array(z.string()).optional().describe(\"Experience ids to distill into a procedure\"),\n id: z.string().describe(\"Procedure id — keywords from the procedure content joined by hyphens\"),\n procedure: z.string().describe(\"Gherkin Feature source for the procedure\"),\n }),\n execute: async ({ ids, id, procedure }) => {\n const role = state.requireRole();\n const result = role.master(procedure, id, ids?.[0]);\n return fmt(\"master\", id, result);\n },\n});\n\n// ========== Tools: Knowledge management ==========\n\nserver.addTool({\n name: \"forget\",\n description: detail(\"forget\"),\n parameters: z.object({\n id: z\n .string()\n .describe(\"Id of the node to remove (principle, procedure, experience, encounter, etc.)\"),\n }),\n execute: async ({ id }) => {\n const role = state.requireRole();\n const result = role.forget(id);\n return fmt(\"forget\", id, result);\n },\n});\n\n// ========== Tools: Skill loading ==========\n\nserver.addTool({\n name: \"skill\",\n description: detail(\"skill\"),\n parameters: z.object({\n locator: z\n .string()\n .describe(\"ResourceX locator for the skill (e.g. deepractice/role-management)\"),\n }),\n execute: async ({ locator }) => {\n const role = state.requireRole();\n return role.skill(locator);\n },\n});\n\n// ========== Tools: Use ==========\n\nserver.addTool({\n name: \"use\",\n description: detail(\"use\"),\n parameters: z.object({\n locator: z\n .string()\n .describe(\n \"Locator string. !namespace.method for RoleX commands, or a ResourceX locator for resources\"\n ),\n args: z.record(z.unknown()).optional().describe(\"Named arguments for the command or resource\"),\n }),\n execute: async ({ locator, args }) => {\n const role = state.requireRole();\n const result = await role.use(locator, args);\n if (result == null) return `${locator} done.`;\n if (typeof result === \"string\") return result;\n return JSON.stringify(result, null, 2);\n },\n});\n\n// ========== Tools: Direct ==========\n\nserver.addTool({\n name: \"direct\",\n description: detail(\"direct\"),\n parameters: z.object({\n locator: z\n .string()\n .describe(\n \"Locator string. !namespace.method for RoleX commands, or a ResourceX locator for resources\"\n ),\n args: z.record(z.unknown()).optional().describe(\"Named arguments for the command or resource\"),\n }),\n execute: async ({ locator, args }) => {\n const result = await rolex.direct(locator, args);\n if (result == null) return `${locator} done.`;\n if (typeof result === \"string\") return result;\n return JSON.stringify(result, null, 2);\n },\n});\n\n// ========== Start ==========\n\nserver.start({\n transportType: \"stdio\",\n});\n","/**\n * MCP server instructions — the cognitive framework for AI roles.\n *\n * Assembled from world .feature files in rolexjs descriptions.\n * Each feature describes one independent concern of the RoleX framework.\n */\nimport { world } from \"rolexjs\";\n\nexport const instructions = [\n world[\"cognitive-priority\"],\n world[\"role-identity\"],\n world.nuwa,\n world.execution,\n world.cognition,\n world.memory,\n world.gherkin,\n world.communication,\n world[\"skill-system\"],\n world[\"state-origin\"],\n].join(\"\\n\\n\");\n","/**\n * Render — 3-layer output for MCP tool results.\n *\n * Layer 1: Status — what just happened (describe)\n * Layer 2: Hint — what to do next (hint)\n * Layer 3: Projection — full state tree as markdown (renderState)\n *\n * MCP and CLI share describe() + hint() + renderState() from rolexjs.\n * Relations are rendered per-node via bidirectional links — no separate layer needed.\n */\nimport type { RenderStateOptions, RolexResult } from \"rolexjs\";\nimport { describe, hint, renderState } from \"rolexjs\";\n\n// ================================================================\n// Public API\n// ================================================================\n\nexport interface RenderOptions {\n /** The process that was executed. */\n process: string;\n /** Display name for the primary node. */\n name: string;\n /** Result from the Rolex API. */\n result: RolexResult;\n /** AI cognitive hint — first-person, state-aware self-direction cue. */\n cognitiveHint?: string | null;\n /** Fold predicate — folded nodes render heading only. */\n fold?: RenderStateOptions[\"fold\"];\n}\n\n/** Render a full 3-layer output string. */\nexport function render(opts: RenderOptions): string {\n const { process, name, result, cognitiveHint, fold } = opts;\n const lines: string[] = [];\n\n // Layer 1: Status\n lines.push(describe(process, name, result.state));\n\n // Layer 2: Hint (static) + Cognitive hint (state-aware)\n lines.push(hint(process));\n if (cognitiveHint) {\n lines.push(`I → ${cognitiveHint}`);\n }\n\n // Layer 3: Projection — generic markdown rendering of the full state tree\n lines.push(\"\");\n lines.push(renderState(result.state, 1, fold ? { fold } : undefined));\n\n return lines.join(\"\\n\");\n}\n","/**\n * McpState — thin session holder for the MCP server.\n *\n * Holds the active Role handle. All business logic (state tracking,\n * cognitive hints, encounter/experience registries) lives in Role + RoleContext.\n */\nimport type { Role } from \"rolexjs\";\n\nexport class McpState {\n role: Role | null = null;\n\n requireRole(): Role {\n if (!this.role) throw new Error(\"No active role. Call activate first.\");\n return this.role;\n }\n}\n"],"mappings":";;;AAQA,SAAS,qBAAqB;AAC9B,SAAS,eAAe;AACxB,SAAS,aAAa,cAAc;AAEpC,SAAS,SAAS;;;ACNlB,SAAS,aAAa;AAEf,IAAM,eAAe;AAAA,EAC1B,MAAM,oBAAoB;AAAA,EAC1B,MAAM,eAAe;AAAA,EACrB,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM,cAAc;AAAA,EACpB,MAAM,cAAc;AACtB,EAAE,KAAK,MAAM;;;ACRb,SAAS,UAAU,MAAM,mBAAmB;AAoBrC,SAAS,OAAO,MAA6B;AAClD,QAAM,EAAE,SAAS,MAAM,QAAQ,eAAe,KAAK,IAAI;AACvD,QAAM,QAAkB,CAAC;AAGzB,QAAM,KAAK,SAAS,SAAS,MAAM,OAAO,KAAK,CAAC;AAGhD,QAAM,KAAK,KAAK,OAAO,CAAC;AACxB,MAAI,eAAe;AACjB,UAAM,KAAK,YAAO,aAAa,EAAE;AAAA,EACnC;AAGA,QAAM,KAAK,EAAE;AACb,QAAM,KAAK,YAAY,OAAO,OAAO,G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C;AACF,CAAC;AAID,OAAO,MAAM;AAAA,EACX,eAAe;AACjB,CAAC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolexjs/mcp-server",
|
|
3
|
-
"version": "0.12.0-dev-
|
|
3
|
+
"version": "0.12.0-dev-20260228032306",
|
|
4
4
|
"description": "MCP server for Rolex — expose RDD role management as MCP tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"rolex",
|
|
@@ -41,8 +41,9 @@
|
|
|
41
41
|
"clean": "rm -rf dist"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"rolexjs": "0.12.0-dev-
|
|
45
|
-
"@rolexjs/local-platform": "0.12.0-dev-
|
|
44
|
+
"rolexjs": "0.12.0-dev-20260228032306",
|
|
45
|
+
"@rolexjs/local-platform": "0.12.0-dev-20260228032306",
|
|
46
|
+
"@rolexjs/genesis": "workspace:*",
|
|
46
47
|
"fastmcp": "^3.0.0",
|
|
47
48
|
"zod": "^3.25.0"
|
|
48
49
|
},
|