@rolexjs/mcp-server 0.10.0 → 0.11.0-dev.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/dist/index.js CHANGED
@@ -1,417 +1,385 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
+ import { localPlatform } from "@rolexjs/local-platform";
4
5
  import { FastMCP } from "fastmcp";
6
+ import { createRoleX, detail } from "rolexjs";
5
7
  import { z } from "zod";
6
- import {
7
- Rolex,
8
- Organization,
9
- Position,
10
- INSTRUCTIONS,
11
- DESC_SOCIETY,
12
- DESC_DIRECTORY,
13
- DESC_ORGANIZATION,
14
- DESC_GROWUP,
15
- DESC_IDENTITY,
16
- DESC_FOCUS,
17
- DESC_WANT,
18
- DESC_PLAN,
19
- DESC_TODO,
20
- DESC_ACHIEVE,
21
- DESC_ABANDON,
22
- DESC_REFLECT,
23
- DESC_FINISH,
24
- renderFeatures,
25
- renderFeature,
26
- renderStatusBar,
27
- renderError,
28
- next,
29
- NEXT,
30
- nextHire,
31
- nextFinish,
32
- bootstrap
33
- } from "rolexjs";
34
- import { LocalPlatform } from "@rolexjs/local-platform";
35
- import { join } from "path";
36
- import { homedir } from "os";
37
- var DEFAULT_ROLEX_DIR = join(homedir(), ".rolex");
38
- var rolexDir = process.argv[2] || process.env.ROLEX_DIR || DEFAULT_ROLEX_DIR;
39
- var platform = new LocalPlatform(rolexDir);
40
- bootstrap(platform);
41
- var rolex = new Rolex(platform);
42
- var currentRole = null;
43
- var currentRoleName = "";
44
- var server = new FastMCP({
45
- name: "Rolex MCP Server",
46
- version: "0.2.0",
47
- instructions: INSTRUCTIONS
48
- });
49
- function requireRole() {
50
- if (!currentRole) {
51
- throw new Error("No active role. Call identity(roleId) first to activate a role.");
8
+
9
+ // src/instructions.ts
10
+ import { world } from "rolexjs";
11
+ var instructions = [
12
+ world["cognitive-priority"],
13
+ world["role-identity"],
14
+ world.execution,
15
+ world.cognition,
16
+ world.memory,
17
+ world.gherkin,
18
+ world.communication,
19
+ world["skill-system"],
20
+ world["state-origin"]
21
+ ].join("\n\n");
22
+
23
+ // src/render.ts
24
+ import { describe, hint, renderState } from "rolexjs";
25
+ function render(opts) {
26
+ const { process, name, result, cognitiveHint } = opts;
27
+ const lines = [];
28
+ lines.push(describe(process, name, result.state));
29
+ lines.push(hint(process));
30
+ if (cognitiveHint) {
31
+ lines.push(`I \u2192 ${cognitiveHint}`);
52
32
  }
53
- return currentRole;
33
+ lines.push("");
34
+ lines.push(renderState(result.state));
35
+ return lines.join("\n");
54
36
  }
55
- function requireNuwa() {
56
- if (!currentRole || currentRoleName !== "nuwa") {
57
- const who = currentRoleName || "none";
58
- return `Permission denied. Only nuwa can use this tool. Current role: ${who}`;
37
+
38
+ // src/state.ts
39
+ var McpState = class {
40
+ constructor(rolex2) {
41
+ this.rolex = rolex2;
59
42
  }
60
- return null;
61
- }
62
- function safeTool(toolName, fn) {
63
- return async (args) => {
64
- try {
65
- return await fn(args);
66
- } catch (error) {
67
- throw new Error(renderError(toolName, error));
43
+ activeRoleId = null;
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}"`);
68
72
  }
69
- };
70
- }
71
- server.addTool({
72
- name: "society",
73
- description: DESC_SOCIETY,
74
- parameters: z.object({
75
- operation: z.enum(["born", "found", "establish", "teach"]).describe("The society operation to perform"),
76
- name: z.string().optional().describe("Role name (born/teach), organization name (found), or position name (establish)"),
77
- source: z.string().optional().describe(
78
- "Gherkin feature source (born: persona, teach: knowledge, found: org description, establish: position duties)"
79
- ),
80
- parent: z.string().optional().describe("Parent organization name (for found with nesting)"),
81
- orgName: z.string().optional().describe("Organization name (for establish)"),
82
- roleId: z.string().optional().describe("Target role name for teach operation"),
83
- type: z.enum(["knowledge", "experience", "voice"]).optional().describe("Growth dimension for teach operation"),
84
- dimensionName: z.string().optional().describe("Name for the knowledge being taught (e.g. 'distributed-systems')")
85
- }),
86
- execute: safeTool(
87
- "society",
88
- async ({ operation, name, source, parent, orgName, roleId, type, dimensionName }) => {
89
- const denied = requireNuwa();
90
- if (denied) return denied;
91
- switch (operation) {
92
- case "born": {
93
- if (!name || !source) throw new Error("born requires: name, source");
94
- const feature = rolex.born(name, source);
95
- return next(`Role born: ${feature.name}`, NEXT.born);
96
- }
97
- case "found": {
98
- if (!name) throw new Error("found requires: name");
99
- rolex.found(name, source, parent);
100
- return next(`Organization founded: ${name}`, NEXT.found);
101
- }
102
- case "establish": {
103
- if (!name || !source || !orgName)
104
- throw new Error("establish requires: name, source, orgName");
105
- rolex.establish(name, source, orgName);
106
- return next(`Position established: ${name} in ${orgName}`, NEXT.establish);
107
- }
108
- case "teach": {
109
- if (!roleId || !type || !dimensionName || !source)
110
- throw new Error("teach requires: roleId, type, dimensionName, source");
111
- const feature = rolex.teach(roleId, type, dimensionName, source);
112
- return next(`Taught ${type}: ${feature.name}`, NEXT.teach);
113
- }
114
- default:
115
- throw new Error(`Unknown society operation: ${operation}`);
116
- }
73
+ }
74
+ consumeEncounters(ids) {
75
+ for (const id of ids) {
76
+ this.encounterIds.delete(id);
117
77
  }
118
- )
119
- });
120
- server.addTool({
121
- name: "directory",
122
- description: DESC_DIRECTORY,
123
- parameters: z.object({
124
- name: z.string().optional().describe("Role, organization, or position name to look up. If omitted, lists everything.")
125
- }),
126
- execute: safeTool("directory", async ({ name }) => {
127
- if (name) {
128
- const result = rolex.find(name);
129
- if (result instanceof Organization) {
130
- const info = result.info();
131
- const parentStr = info.parent ? ` (parent: ${info.parent})` : "";
132
- return `Organization: ${info.name}${parentStr}
133
- Members: ${info.members.length}
134
- Positions: ${info.positions.join(", ") || "none"}`;
135
- }
136
- if (result instanceof Position) {
137
- const info = result.info();
138
- return `Position: ${info.name} in ${info.org}
139
- State: ${info.state}
140
- Assigned: ${info.assignedRole || "none"}
141
- Duties: ${info.duties.length}`;
142
- }
143
- const features = result.identity();
144
- return renderFeatures(features);
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}"`);
145
85
  }
146
- const dir = rolex.directory();
147
- const lines = [];
148
- if (dir.organizations.length > 0) {
149
- for (const org of dir.organizations) {
150
- const parentStr = org.parent ? ` (parent: ${org.parent})` : "";
151
- lines.push(`Organization: ${org.name}${parentStr}`);
152
- if (org.positions.length > 0) {
153
- lines.push(" Positions:");
154
- for (const pos of org.positions) {
155
- const posInfo = platform.getPosition(pos, org.name);
156
- const holder = posInfo?.assignedRole ? ` \u2190 ${posInfo.assignedRole}` : " (vacant)";
157
- lines.push(` - ${pos}${holder}`);
158
- }
159
- }
160
- if (org.members.length > 0) {
161
- lines.push(" Members:");
162
- for (const member of org.members) {
163
- const role = dir.roles.find((r) => r.name === member);
164
- const state = role ? ` [${role.state}]` : "";
165
- const pos = role?.position ? ` \u2192 ${role.position}` : "";
166
- lines.push(` - ${member}${state}${pos}`);
167
- }
168
- }
169
- }
86
+ }
87
+ consumeExperiences(ids) {
88
+ for (const id of ids) {
89
+ this.experienceIds.delete(id);
170
90
  }
171
- const freeRoles = dir.roles.filter((r) => r.state === "free");
172
- if (freeRoles.length > 0) {
173
- if (lines.length > 0) lines.push("");
174
- lines.push("Free Roles:");
175
- for (const role of freeRoles) {
176
- lines.push(` - ${role.name}`);
91
+ }
92
+ // ================================================================
93
+ // Lookup
94
+ // ================================================================
95
+ findIndividual(roleId) {
96
+ return this.rolex.find(roleId) !== null;
97
+ }
98
+ // ================================================================
99
+ // Activation helpers
100
+ // ================================================================
101
+ /** Rehydrate ids from an activation projection. */
102
+ cacheFromActivation(state2) {
103
+ this.rehydrate(state2);
104
+ }
105
+ /** Walk the state tree and collect ids into the appropriate registries. */
106
+ rehydrate(node) {
107
+ if (node.id) {
108
+ switch (node.name) {
109
+ case "goal":
110
+ if (!this.focusedGoalId) this.focusedGoalId = node.id;
111
+ break;
112
+ case "encounter":
113
+ this.encounterIds.add(node.id);
114
+ break;
115
+ case "experience":
116
+ this.experienceIds.add(node.id);
117
+ break;
177
118
  }
178
119
  }
179
- return lines.join("\n") || "No roles or organizations found.";
180
- })
181
- });
182
- server.addTool({
183
- name: "organization",
184
- description: DESC_ORGANIZATION,
185
- parameters: z.object({
186
- operation: z.enum(["hire", "fire", "appoint", "dismiss"]).describe("The organization operation to perform"),
187
- name: z.string().describe("Role name to hire, fire, appoint, or dismiss"),
188
- position: z.string().optional().describe("Position name (for appoint)"),
189
- orgName: z.string().optional().describe("Target organization name (for hire, required when multiple organizations exist)")
190
- }),
191
- execute: safeTool("organization", async ({ operation, name, position, orgName: targetOrg }) => {
192
- const denied = requireNuwa();
193
- if (denied) return denied;
194
- const dir = rolex.directory();
195
- if (dir.organizations.length === 0) {
196
- throw new Error("No organization found. Call found() first.");
197
- }
198
- let orgName;
199
- if (operation === "hire") {
200
- if (targetOrg) {
201
- orgName = targetOrg;
202
- } else if (dir.organizations.length === 1) {
203
- orgName = dir.organizations[0].name;
204
- } else {
205
- const orgNames = dir.organizations.map((o) => o.name).join(", ");
206
- throw new Error(
207
- `Multiple organizations exist (${orgNames}). Specify orgName to indicate which one.`
208
- );
209
- }
210
- } else {
211
- const assignment = platform.getAssignment(name);
212
- orgName = assignment?.org ?? dir.organizations[0].name;
120
+ for (const child of node.children ?? []) {
121
+ this.rehydrate(child);
213
122
  }
214
- const org = rolex.find(orgName);
215
- switch (operation) {
216
- case "hire": {
217
- org.hire(name);
218
- return next(`Role hired: ${name} \u2192 ${orgName}`, nextHire(name));
219
- }
220
- case "fire": {
221
- org.fire(name);
222
- return next(`Role fired: ${name}`, NEXT.fire);
123
+ }
124
+ // ================================================================
125
+ // Cognitive hints — state-aware AI self-direction cues
126
+ // ================================================================
127
+ /** First-person, state-aware hint for the AI after an operation. */
128
+ cognitiveHint(process) {
129
+ switch (process) {
130
+ case "activate":
131
+ if (!this.focusedGoalId)
132
+ return "I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.";
133
+ return "I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.";
134
+ case "focus":
135
+ if (!this.focusedPlanId)
136
+ return "I have a goal but no plan. I should call `plan` to design how to achieve it.";
137
+ return "I have a plan. I should call `todo` to create tasks, or continue working.";
138
+ case "want":
139
+ return "Goal declared. I should call `plan` to design how to achieve it.";
140
+ case "plan":
141
+ return "Plan created. I should call `todo` to create concrete tasks.";
142
+ case "todo":
143
+ return "Task created. I can add more with `todo`, or start working and call `finish` when done.";
144
+ case "finish": {
145
+ const encCount = this.encounterIds.size;
146
+ if (encCount > 0 && !this.focusedGoalId)
147
+ return `Task finished. No more goals \u2014 I have ${encCount} encounter(s) to choose from for \`reflect\`, or \`want\` a new goal.`;
148
+ return "Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.";
223
149
  }
224
- case "appoint": {
225
- if (!position) throw new Error("appoint requires: name, position");
226
- org.appoint(name, position);
227
- return next(`Role appointed: ${name} \u2192 ${position}`, NEXT.appoint);
150
+ case "complete":
151
+ case "abandon": {
152
+ const encCount = this.encounterIds.size;
153
+ if (encCount > 0)
154
+ return `Plan closed. I have ${encCount} encounter(s) to choose from for \`reflect\`, or I can continue with other plans.`;
155
+ return "Plan closed. I can create a new `plan`, or `focus` on another goal.";
228
156
  }
229
- case "dismiss": {
230
- org.dismiss(name);
231
- return next(`Role dismissed: ${name}`, NEXT.dismiss);
157
+ case "reflect": {
158
+ const expCount = this.experienceIds.size;
159
+ if (expCount > 0)
160
+ return `Experience gained. I can \`realize\` principles or \`master\` procedures \u2014 ${expCount} experience(s) available.`;
161
+ return "Experience gained. I can `realize` a principle, `master` a procedure, or continue working.";
232
162
  }
163
+ case "realize":
164
+ return "Principle added to knowledge. I should continue working.";
165
+ case "master":
166
+ return "Procedure added to knowledge. I should continue working.";
233
167
  default:
234
- throw new Error(`Unknown organization operation: ${operation}`);
168
+ return null;
235
169
  }
236
- })
237
- });
238
- server.addTool({
239
- name: "identity",
240
- description: DESC_IDENTITY,
241
- parameters: z.object({
242
- roleId: z.string().describe("Role name (e.g. 'sean')")
243
- }),
244
- execute: safeTool("identity", async ({ roleId }) => {
245
- currentRole = rolex.role(roleId);
246
- currentRoleName = roleId;
247
- const features = currentRole.identity();
248
- const { current } = currentRole.focus();
249
- const assignment = platform.getAssignment(roleId);
250
- const statusBar = renderStatusBar(roleId, current, assignment?.org, assignment?.position);
251
- return `${statusBar}
170
+ }
171
+ };
252
172
 
253
- ${renderFeatures(features)}`;
254
- })
173
+ // src/index.ts
174
+ var rolex = createRoleX(localPlatform());
175
+ var state = new McpState(rolex);
176
+ var server = new FastMCP({
177
+ name: "rolex",
178
+ version: "0.11.0",
179
+ instructions
255
180
  });
181
+ function fmt(process, label, result) {
182
+ return render({
183
+ process,
184
+ name: label,
185
+ result,
186
+ cognitiveHint: state.cognitiveHint(process)
187
+ });
188
+ }
256
189
  server.addTool({
257
- name: "growup",
258
- description: DESC_GROWUP,
190
+ name: "activate",
191
+ description: detail("activate"),
259
192
  parameters: z.object({
260
- type: z.enum(["knowledge", "experience", "voice"]).describe(
261
- "Growth dimension: knowledge (what I know), experience (what I've lived), voice (how I'm perceived)"
262
- ),
263
- name: z.string().describe("Name for this growth (used as filename, e.g. 'distributed-systems')"),
264
- source: z.string().describe("Gherkin feature source text")
193
+ roleId: z.string().describe("Role name to activate")
265
194
  }),
266
- execute: safeTool("growup", async ({ type, name, source }) => {
267
- const role = requireRole();
268
- const feature = role.growup(type, name, source);
269
- return next(`Growth added (${type}): ${feature.name}`, NEXT.growup);
270
- })
195
+ execute: async ({ roleId }) => {
196
+ if (!state.findIndividual(roleId)) {
197
+ rolex.individual.born(void 0, roleId);
198
+ }
199
+ state.activeRoleId = roleId;
200
+ const result = await rolex.role.activate(roleId);
201
+ state.cacheFromActivation(result.state);
202
+ return fmt("activate", roleId, result);
203
+ }
271
204
  });
272
205
  server.addTool({
273
206
  name: "focus",
274
- description: DESC_FOCUS,
207
+ description: detail("focus"),
275
208
  parameters: z.object({
276
- name: z.string().optional().describe("Optional goal name to switch focus to")
209
+ id: z.string().optional().describe("Goal id to switch to. Omit to view current.")
277
210
  }),
278
- execute: safeTool("focus", async ({ name }) => {
279
- const role = requireRole();
280
- const { current, otherGoals } = role.focus(name);
281
- const assignment = platform.getAssignment(currentRoleName);
282
- const statusBar = renderStatusBar(
283
- currentRoleName,
284
- current,
285
- assignment?.org,
286
- assignment?.position
287
- );
288
- if (!current && otherGoals.length === 0)
289
- return `${statusBar}
290
-
291
- No active goal. Use want() to set a new goal.`;
292
- const parts = [statusBar];
293
- if (current) {
294
- parts.push(renderFeature(current));
295
- if (current.plan) {
296
- parts.push(renderFeature(current.plan));
297
- }
298
- for (const task of current.tasks) {
299
- parts.push(renderFeature(task));
300
- }
301
- }
302
- if (otherGoals.length > 0) {
303
- parts.push("Other active goals:");
304
- for (const g of otherGoals) {
305
- parts.push(` - ${g.name}`);
306
- }
211
+ execute: async ({ id }) => {
212
+ if (id) {
213
+ state.focusedGoalId = id;
214
+ state.focusedPlanId = null;
307
215
  }
308
- return parts.join("\n\n");
309
- })
216
+ const goalId = state.requireGoalId();
217
+ const result = rolex.role.focus(goalId);
218
+ return fmt("focus", id ?? "current goal", result);
219
+ }
310
220
  });
311
221
  server.addTool({
312
222
  name: "want",
313
- description: DESC_WANT,
223
+ description: detail("want"),
314
224
  parameters: z.object({
315
- name: z.string().describe("Goal name (used as directory name, e.g. 'local-platform')"),
316
- source: z.string().describe("Gherkin feature source text for the goal"),
317
- testable: z.boolean().optional().default(false).describe("Whether this goal's scenarios should become persistent automated verification")
225
+ id: z.string().describe("Goal id (used for focus/reference)"),
226
+ goal: z.string().describe("Gherkin Feature source describing the goal")
318
227
  }),
319
- execute: safeTool("want", async ({ name, source, testable }) => {
320
- const role = requireRole();
321
- const goal = role.want(name, source, testable);
322
- return next(`Goal created: ${goal.name}`, NEXT.want);
323
- })
228
+ execute: async ({ id, goal }) => {
229
+ const roleId = state.requireRoleId();
230
+ const result = rolex.role.want(roleId, goal, id);
231
+ state.focusedGoalId = id;
232
+ state.focusedPlanId = null;
233
+ return fmt("want", id, result);
234
+ }
324
235
  });
325
236
  server.addTool({
326
237
  name: "plan",
327
- description: DESC_PLAN,
238
+ description: detail("plan"),
328
239
  parameters: z.object({
329
- source: z.string().describe("Gherkin feature source text for the plan")
240
+ id: z.string().describe("Plan id \u2014 keywords from the plan content joined by hyphens"),
241
+ plan: z.string().describe("Gherkin Feature source describing the plan")
330
242
  }),
331
- execute: safeTool("plan", async ({ source }) => {
332
- const role = requireRole();
333
- const p = role.plan(source);
334
- return next(`Plan created: ${p.name}`, NEXT.plan);
335
- })
243
+ execute: async ({ id, plan }) => {
244
+ const goalId = state.requireGoalId();
245
+ const result = rolex.role.plan(goalId, plan, id);
246
+ state.focusedPlanId = id;
247
+ return fmt("plan", id, result);
248
+ }
336
249
  });
337
250
  server.addTool({
338
251
  name: "todo",
339
- description: DESC_TODO,
252
+ description: detail("todo"),
340
253
  parameters: z.object({
341
- name: z.string().describe("Task name (used as filename, e.g. 'implement-loader')"),
342
- source: z.string().describe("Gherkin feature source text for the task"),
343
- testable: z.boolean().optional().default(false).describe("Whether this task's scenarios should become unit or integration tests")
254
+ id: z.string().describe("Task id (used for finish/reference)"),
255
+ task: z.string().describe("Gherkin Feature source describing the task")
344
256
  }),
345
- execute: safeTool("todo", async ({ name, source, testable }) => {
346
- const role = requireRole();
347
- const task = role.todo(name, source, testable);
348
- return next(`Task created: ${task.name}`, NEXT.todo);
349
- })
257
+ execute: async ({ id, task }) => {
258
+ const planId = state.requirePlanId();
259
+ const result = rolex.role.todo(planId, task, id);
260
+ return fmt("todo", id, result);
261
+ }
350
262
  });
351
263
  server.addTool({
352
- name: "achieve",
353
- description: DESC_ACHIEVE,
264
+ name: "finish",
265
+ description: detail("finish"),
354
266
  parameters: z.object({
355
- experience: z.string().optional().describe(
356
- "Optional Gherkin feature source capturing what was learned \u2014 auto-saved as experience growup"
357
- )
267
+ id: z.string().describe("Task id to finish"),
268
+ encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
358
269
  }),
359
- execute: safeTool("achieve", async ({ experience }) => {
360
- const role = requireRole();
361
- role.achieve(experience);
362
- const msg = experience ? "Goal achieved. Experience captured." : "Goal achieved.";
363
- return next(msg, NEXT.achieve);
364
- })
270
+ execute: async ({ id, encounter }) => {
271
+ const roleId = state.requireRoleId();
272
+ const result = rolex.role.finish(id, roleId, encounter);
273
+ const encId = result.state.id ?? id;
274
+ state.addEncounter(encId);
275
+ return fmt("finish", id, result);
276
+ }
277
+ });
278
+ server.addTool({
279
+ name: "complete",
280
+ description: detail("complete"),
281
+ parameters: z.object({
282
+ id: z.string().optional().describe("Plan id to complete (defaults to focused plan)"),
283
+ encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
284
+ }),
285
+ execute: async ({ id, encounter }) => {
286
+ const roleId = state.requireRoleId();
287
+ const planId = id ?? state.requirePlanId();
288
+ const result = rolex.role.complete(planId, roleId, encounter);
289
+ const encId = result.state.id ?? planId;
290
+ state.addEncounter(encId);
291
+ if (state.focusedPlanId === planId) state.focusedPlanId = null;
292
+ return fmt("complete", planId, result);
293
+ }
365
294
  });
366
295
  server.addTool({
367
296
  name: "abandon",
368
- description: DESC_ABANDON,
297
+ description: detail("abandon"),
369
298
  parameters: z.object({
370
- experience: z.string().optional().describe(
371
- "Optional Gherkin feature source capturing what was learned \u2014 auto-saved as experience growup"
372
- )
299
+ id: z.string().optional().describe("Plan id to abandon (defaults to focused plan)"),
300
+ encounter: z.string().optional().describe("Optional Gherkin Feature describing what happened")
373
301
  }),
374
- execute: safeTool("abandon", async ({ experience }) => {
375
- const role = requireRole();
376
- role.abandon(experience);
377
- const msg = experience ? "Goal abandoned. Experience captured." : "Goal abandoned.";
378
- return next(msg, NEXT.abandon);
379
- })
302
+ execute: async ({ id, encounter }) => {
303
+ const roleId = state.requireRoleId();
304
+ const planId = id ?? state.requirePlanId();
305
+ const result = rolex.role.abandon(planId, roleId, encounter);
306
+ const encId = result.state.id ?? planId;
307
+ state.addEncounter(encId);
308
+ if (state.focusedPlanId === planId) state.focusedPlanId = null;
309
+ return fmt("abandon", planId, result);
310
+ }
380
311
  });
381
312
  server.addTool({
382
313
  name: "reflect",
383
- description: DESC_REFLECT,
314
+ description: detail("reflect"),
384
315
  parameters: z.object({
385
- experienceNames: z.array(z.string()).describe(
386
- "Names of experience files to distill (without .experience.identity.feature suffix)"
387
- ),
388
- knowledgeName: z.string().describe(
389
- "Name for the resulting knowledge (used as filename, e.g. 'authentication-principles')"
390
- ),
391
- knowledgeSource: z.string().describe("Gherkin feature source text for the knowledge")
316
+ ids: z.array(z.string()).describe("Encounter ids to reflect on (selective consumption)"),
317
+ id: z.string().describe("Experience id \u2014 keywords from the experience content joined by hyphens"),
318
+ experience: z.string().optional().describe("Gherkin Feature source for the experience")
392
319
  }),
393
- execute: safeTool("reflect", async ({ experienceNames, knowledgeName, knowledgeSource }) => {
394
- const role = requireRole();
395
- const feature = role.reflect(experienceNames, knowledgeName, knowledgeSource);
396
- return next(
397
- `Reflected: ${experienceNames.length} experience(s) \u2192 knowledge "${feature.name}"`,
398
- NEXT.reflect
399
- );
400
- })
320
+ execute: async ({ ids, id, experience }) => {
321
+ state.requireEncounterIds(ids);
322
+ const roleId = state.requireRoleId();
323
+ const result = rolex.role.reflect(ids[0], roleId, experience, id);
324
+ state.consumeEncounters(ids);
325
+ state.addExperience(id);
326
+ return fmt("reflect", id, result);
327
+ }
401
328
  });
402
329
  server.addTool({
403
- name: "finish",
404
- description: DESC_FINISH,
330
+ name: "realize",
331
+ description: detail("realize"),
332
+ parameters: z.object({
333
+ ids: z.array(z.string()).describe("Experience ids to distill into a principle"),
334
+ id: z.string().describe("Principle id \u2014 keywords from the principle content joined by hyphens"),
335
+ principle: z.string().optional().describe("Gherkin Feature source for the principle")
336
+ }),
337
+ execute: async ({ ids, id, principle }) => {
338
+ state.requireExperienceIds(ids);
339
+ const roleId = state.requireRoleId();
340
+ const result = rolex.role.realize(ids[0], roleId, principle, id);
341
+ state.consumeExperiences(ids);
342
+ return fmt("realize", id, result);
343
+ }
344
+ });
345
+ server.addTool({
346
+ name: "master",
347
+ description: detail("master"),
348
+ parameters: z.object({
349
+ ids: z.array(z.string()).describe("Experience ids to distill into a procedure"),
350
+ id: z.string().describe("Procedure id \u2014 keywords from the procedure content joined by hyphens"),
351
+ procedure: z.string().optional().describe("Gherkin Feature source for the procedure")
352
+ }),
353
+ execute: async ({ ids, id, procedure }) => {
354
+ state.requireExperienceIds(ids);
355
+ const roleId = state.requireRoleId();
356
+ const result = rolex.role.master(ids[0], roleId, procedure, id);
357
+ state.consumeExperiences(ids);
358
+ return fmt("master", id, result);
359
+ }
360
+ });
361
+ server.addTool({
362
+ name: "forget",
363
+ description: detail("forget"),
364
+ parameters: z.object({
365
+ id: z.string().describe("Id of the node to remove (principle, procedure, experience, encounter, etc.)")
366
+ }),
367
+ execute: async ({ id }) => {
368
+ const roleId = state.requireRoleId();
369
+ const result = await rolex.role.forget(id, roleId);
370
+ return fmt("forget", id, result);
371
+ }
372
+ });
373
+ server.addTool({
374
+ name: "skill",
375
+ description: detail("skill"),
405
376
  parameters: z.object({
406
- name: z.string().describe("Task name to mark as done")
377
+ locator: z.string().describe("ResourceX locator for the skill (e.g. deepractice/role-management)")
407
378
  }),
408
- execute: safeTool("finish", async ({ name }) => {
409
- const role = requireRole();
410
- role.finish(name);
411
- const { current } = role.focus();
412
- const remaining = current ? current.tasks.filter((t) => !t.tags?.some((tag) => tag.name === "@done")).length : -1;
413
- return next(`Task finished: ${name}`, remaining >= 0 ? nextFinish(remaining) : NEXT.achieve);
414
- })
379
+ execute: async ({ locator }) => {
380
+ const content = await rolex.role.skill(locator);
381
+ return content;
382
+ }
415
383
  });
416
384
  server.start({
417
385
  transportType: "stdio"
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @rolexjs/mcp-server\n *\n * MCP server for Rolex — Role-Driven Development.\n *\n * Three-entity architecture:\n * Role = WHO (identity, goals)\n * Organization = WHERE (structure, nesting)\n * Position = WHAT (duties, boundaries)\n *\n * Tools:\n * society — Admin: born, found, establish, teach\n * organization — Admin: hire, fire, appoint, dismiss\n * directory — Lookup: list all / find by name (all roles)\n * identity — Activate a role\n * growup/focus/want/plan/todo/achieve/abandon/finish — Role lifecycle\n *\n * Usage:\n * rolex-mcp [.rolex-dir]\n */\n\nimport { FastMCP } from \"fastmcp\";\nimport { z } from \"zod\";\nimport {\n Rolex,\n Organization,\n Role,\n Position,\n INSTRUCTIONS,\n DESC_SOCIETY,\n DESC_DIRECTORY,\n DESC_ORGANIZATION,\n DESC_GROWUP,\n DESC_IDENTITY,\n DESC_FOCUS,\n DESC_WANT,\n DESC_PLAN,\n DESC_TODO,\n DESC_ACHIEVE,\n DESC_ABANDON,\n DESC_REFLECT,\n DESC_FINISH,\n renderFeatures,\n renderFeature,\n renderStatusBar,\n renderError,\n next,\n NEXT,\n nextHire,\n nextFinish,\n bootstrap,\n} from \"rolexjs\";\nimport { LocalPlatform } from \"@rolexjs/local-platform\";\n\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\n\nconst DEFAULT_ROLEX_DIR = join(homedir(), \".rolex\");\nconst rolexDir = process.argv[2] || process.env.ROLEX_DIR || DEFAULT_ROLEX_DIR;\nconst platform = new LocalPlatform(rolexDir);\nbootstrap(platform);\nconst rolex = new Rolex(platform);\n\nlet currentRole: Role | null = null;\nlet currentRoleName: string = \"\";\n\nconst server = new FastMCP({\n name: \"Rolex MCP Server\",\n version: \"0.2.0\",\n instructions: INSTRUCTIONS,\n});\n\n// ========== Helpers ==========\n\nfunction requireRole(): Role {\n if (!currentRole) {\n throw new Error(\"No active role. Call identity(roleId) first to activate a role.\");\n }\n return currentRole;\n}\n\nfunction requireNuwa(): string | null {\n if (!currentRole || currentRoleName !== \"nuwa\") {\n const who = currentRoleName || \"none\";\n return `Permission denied. Only nuwa can use this tool. Current role: ${who}`;\n }\n return null;\n}\n\n/**\n * Wrap a tool execute function with unified error handling.\n * Catches errors and renders them as formatted markdown.\n */\nfunction safeTool<T>(\n toolName: string,\n fn: (args: T) => Promise<string>\n): (args: T) => Promise<string> {\n return async (args: T) => {\n try {\n return await fn(args);\n } catch (error) {\n throw new Error(renderError(toolName, error));\n }\n };\n}\n\n// ========== Society (folded) ==========\n\nserver.addTool({\n name: \"society\",\n description: DESC_SOCIETY,\n parameters: z.object({\n operation: z\n .enum([\"born\", \"found\", \"establish\", \"teach\"])\n .describe(\"The society operation to perform\"),\n name: z\n .string()\n .optional()\n .describe(\"Role name (born/teach), organization name (found), or position name (establish)\"),\n source: z\n .string()\n .optional()\n .describe(\n \"Gherkin feature source (born: persona, teach: knowledge, found: org description, establish: position duties)\"\n ),\n parent: z.string().optional().describe(\"Parent organization name (for found with nesting)\"),\n orgName: z.string().optional().describe(\"Organization name (for establish)\"),\n roleId: z.string().optional().describe(\"Target role name for teach operation\"),\n type: z\n .enum([\"knowledge\", \"experience\", \"voice\"])\n .optional()\n .describe(\"Growth dimension for teach operation\"),\n dimensionName: z\n .string()\n .optional()\n .describe(\"Name for the knowledge being taught (e.g. 'distributed-systems')\"),\n }),\n execute: safeTool(\n \"society\",\n async ({ operation, name, source, parent, orgName, roleId, type, dimensionName }) => {\n const denied = requireNuwa();\n if (denied) return denied;\n switch (operation) {\n case \"born\": {\n if (!name || !source) throw new Error(\"born requires: name, source\");\n const feature = rolex.born(name, source);\n return next(`Role born: ${feature.name}`, NEXT.born);\n }\n case \"found\": {\n if (!name) throw new Error(\"found requires: name\");\n rolex.found(name, source, parent);\n return next(`Organization founded: ${name}`, NEXT.found);\n }\n case \"establish\": {\n if (!name || !source || !orgName)\n throw new Error(\"establish requires: name, source, orgName\");\n rolex.establish(name, source, orgName);\n return next(`Position established: ${name} in ${orgName}`, NEXT.establish);\n }\n case \"teach\": {\n if (!roleId || !type || !dimensionName || !source)\n throw new Error(\"teach requires: roleId, type, dimensionName, source\");\n const feature = rolex.teach(roleId, type, dimensionName, source);\n return next(`Taught ${type}: ${feature.name}`, NEXT.teach);\n }\n default:\n throw new Error(`Unknown society operation: ${operation}`);\n }\n }\n ),\n});\n\n// ========== Directory (all roles) ==========\n\nserver.addTool({\n name: \"directory\",\n description: DESC_DIRECTORY,\n parameters: z.object({\n name: z\n .string()\n .optional()\n .describe(\"Role, organization, or position name to look up. If omitted, lists everything.\"),\n }),\n execute: safeTool(\"directory\", async ({ name }) => {\n if (name) {\n const result = rolex.find(name);\n if (result instanceof Organization) {\n const info = result.info();\n const parentStr = info.parent ? ` (parent: ${info.parent})` : \"\";\n return `Organization: ${info.name}${parentStr}\\nMembers: ${info.members.length}\\nPositions: ${info.positions.join(\", \") || \"none\"}`;\n }\n if (result instanceof Position) {\n const info = result.info();\n return `Position: ${info.name} in ${info.org}\\nState: ${info.state}\\nAssigned: ${info.assignedRole || \"none\"}\\nDuties: ${info.duties.length}`;\n }\n const features = (result as Role).identity();\n return renderFeatures(features);\n }\n\n const dir = rolex.directory();\n const lines: string[] = [];\n\n if (dir.organizations.length > 0) {\n for (const org of dir.organizations) {\n const parentStr = org.parent ? ` (parent: ${org.parent})` : \"\";\n lines.push(`Organization: ${org.name}${parentStr}`);\n\n if (org.positions.length > 0) {\n lines.push(\" Positions:\");\n for (const pos of org.positions) {\n const posInfo = platform.getPosition(pos, org.name);\n const holder = posInfo?.assignedRole ? ` ← ${posInfo.assignedRole}` : \" (vacant)\";\n lines.push(` - ${pos}${holder}`);\n }\n }\n\n if (org.members.length > 0) {\n lines.push(\" Members:\");\n for (const member of org.members) {\n const role = dir.roles.find((r) => r.name === member);\n const state = role ? ` [${role.state}]` : \"\";\n const pos = role?.position ? ` → ${role.position}` : \"\";\n lines.push(` - ${member}${state}${pos}`);\n }\n }\n }\n }\n\n const freeRoles = dir.roles.filter((r) => r.state === \"free\");\n if (freeRoles.length > 0) {\n if (lines.length > 0) lines.push(\"\");\n lines.push(\"Free Roles:\");\n for (const role of freeRoles) {\n lines.push(` - ${role.name}`);\n }\n }\n\n return lines.join(\"\\n\") || \"No roles or organizations found.\";\n }),\n});\n\n// ========== Organization (folded) ==========\n\nserver.addTool({\n name: \"organization\",\n description: DESC_ORGANIZATION,\n parameters: z.object({\n operation: z\n .enum([\"hire\", \"fire\", \"appoint\", \"dismiss\"])\n .describe(\"The organization operation to perform\"),\n name: z.string().describe(\"Role name to hire, fire, appoint, or dismiss\"),\n position: z.string().optional().describe(\"Position name (for appoint)\"),\n orgName: z\n .string()\n .optional()\n .describe(\"Target organization name (for hire, required when multiple organizations exist)\"),\n }),\n execute: safeTool(\"organization\", async ({ operation, name, position, orgName: targetOrg }) => {\n const denied = requireNuwa();\n if (denied) return denied;\n // Find the first org, or the org the role belongs to\n const dir = rolex.directory();\n if (dir.organizations.length === 0) {\n throw new Error(\"No organization found. Call found() first.\");\n }\n\n // Resolve target organization\n let orgName: string;\n if (operation === \"hire\") {\n if (targetOrg) {\n orgName = targetOrg;\n } else if (dir.organizations.length === 1) {\n orgName = dir.organizations[0].name;\n } else {\n const orgNames = dir.organizations.map((o) => o.name).join(\", \");\n throw new Error(\n `Multiple organizations exist (${orgNames}). Specify orgName to indicate which one.`\n );\n }\n } else {\n const assignment = platform.getAssignment(name);\n orgName = assignment?.org ?? dir.organizations[0].name;\n }\n\n const org = rolex.find(orgName) as Organization;\n\n switch (operation) {\n case \"hire\": {\n org.hire(name);\n return next(`Role hired: ${name} → ${orgName}`, nextHire(name));\n }\n case \"fire\": {\n org.fire(name);\n return next(`Role fired: ${name}`, NEXT.fire);\n }\n case \"appoint\": {\n if (!position) throw new Error(\"appoint requires: name, position\");\n org.appoint(name, position);\n return next(`Role appointed: ${name} → ${position}`, NEXT.appoint);\n }\n case \"dismiss\": {\n org.dismiss(name);\n return next(`Role dismissed: ${name}`, NEXT.dismiss);\n }\n default:\n throw new Error(`Unknown organization operation: ${operation}`);\n }\n }),\n});\n\n// ========== Role Activation ==========\n\nserver.addTool({\n name: \"identity\",\n description: DESC_IDENTITY,\n parameters: z.object({\n roleId: z.string().describe(\"Role name (e.g. 'sean')\"),\n }),\n execute: safeTool(\"identity\", async ({ roleId }) => {\n currentRole = rolex.role(roleId);\n currentRoleName = roleId;\n const features = currentRole.identity();\n const { current } = currentRole.focus();\n const assignment = platform.getAssignment(roleId);\n const statusBar = renderStatusBar(roleId, current, assignment?.org, assignment?.position);\n return `${statusBar}\\n\\n${renderFeatures(features)}`;\n }),\n});\n\n// ========== Role Tools ==========\n\nserver.addTool({\n name: \"growup\",\n description: DESC_GROWUP,\n parameters: z.object({\n type: z\n .enum([\"knowledge\", \"experience\", \"voice\"])\n .describe(\n \"Growth dimension: knowledge (what I know), experience (what I've lived), voice (how I'm perceived)\"\n ),\n name: z\n .string()\n .describe(\"Name for this growth (used as filename, e.g. 'distributed-systems')\"),\n source: z.string().describe(\"Gherkin feature source text\"),\n }),\n execute: safeTool(\"growup\", async ({ type, name, source }) => {\n const role = requireRole();\n const feature = role.growup(type, name, source);\n return next(`Growth added (${type}): ${feature.name}`, NEXT.growup);\n }),\n});\n\nserver.addTool({\n name: \"focus\",\n description: DESC_FOCUS,\n parameters: z.object({\n name: z.string().optional().describe(\"Optional goal name to switch focus to\"),\n }),\n execute: safeTool(\"focus\", async ({ name }) => {\n const role = requireRole();\n const { current, otherGoals } = role.focus(name);\n\n const assignment = platform.getAssignment(currentRoleName);\n const statusBar = renderStatusBar(\n currentRoleName,\n current,\n assignment?.org,\n assignment?.position\n );\n\n if (!current && otherGoals.length === 0)\n return `${statusBar}\\n\\nNo active goal. Use want() to set a new goal.`;\n\n const parts: string[] = [statusBar];\n\n if (current) {\n parts.push(renderFeature(current));\n if (current.plan) {\n parts.push(renderFeature(current.plan));\n }\n for (const task of current.tasks) {\n parts.push(renderFeature(task));\n }\n }\n\n if (otherGoals.length > 0) {\n parts.push(\"Other active goals:\");\n for (const g of otherGoals) {\n parts.push(` - ${g.name}`);\n }\n }\n\n return parts.join(\"\\n\\n\");\n }),\n});\n\nserver.addTool({\n name: \"want\",\n description: DESC_WANT,\n parameters: z.object({\n name: z.string().describe(\"Goal name (used as directory name, e.g. 'local-platform')\"),\n source: z.string().describe(\"Gherkin feature source text for the goal\"),\n testable: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Whether this goal's scenarios should become persistent automated verification\"),\n }),\n execute: safeTool(\"want\", async ({ name, source, testable }) => {\n const role = requireRole();\n const goal = role.want(name, source, testable);\n return next(`Goal created: ${goal.name}`, NEXT.want);\n }),\n});\n\nserver.addTool({\n name: \"plan\",\n description: DESC_PLAN,\n parameters: z.object({\n source: z.string().describe(\"Gherkin feature source text for the plan\"),\n }),\n execute: safeTool(\"plan\", async ({ source }) => {\n const role = requireRole();\n const p = role.plan(source);\n return next(`Plan created: ${p.name}`, NEXT.plan);\n }),\n});\n\nserver.addTool({\n name: \"todo\",\n description: DESC_TODO,\n parameters: z.object({\n name: z.string().describe(\"Task name (used as filename, e.g. 'implement-loader')\"),\n source: z.string().describe(\"Gherkin feature source text for the task\"),\n testable: z\n .boolean()\n .optional()\n .default(false)\n .describe(\"Whether this task's scenarios should become unit or integration tests\"),\n }),\n execute: safeTool(\"todo\", async ({ name, source, testable }) => {\n const role = requireRole();\n const task = role.todo(name, source, testable);\n return next(`Task created: ${task.name}`, NEXT.todo);\n }),\n});\n\nserver.addTool({\n name: \"achieve\",\n description: DESC_ACHIEVE,\n parameters: z.object({\n experience: z\n .string()\n .optional()\n .describe(\n \"Optional Gherkin feature source capturing what was learned — auto-saved as experience growup\"\n ),\n }),\n execute: safeTool(\"achieve\", async ({ experience }) => {\n const role = requireRole();\n role.achieve(experience);\n const msg = experience ? \"Goal achieved. Experience captured.\" : \"Goal achieved.\";\n return next(msg, NEXT.achieve);\n }),\n});\n\nserver.addTool({\n name: \"abandon\",\n description: DESC_ABANDON,\n parameters: z.object({\n experience: z\n .string()\n .optional()\n .describe(\n \"Optional Gherkin feature source capturing what was learned — auto-saved as experience growup\"\n ),\n }),\n execute: safeTool(\"abandon\", async ({ experience }) => {\n const role = requireRole();\n role.abandon(experience);\n const msg = experience ? \"Goal abandoned. Experience captured.\" : \"Goal abandoned.\";\n return next(msg, NEXT.abandon);\n }),\n});\n\nserver.addTool({\n name: \"reflect\",\n description: DESC_REFLECT,\n parameters: z.object({\n experienceNames: z\n .array(z.string())\n .describe(\n \"Names of experience files to distill (without .experience.identity.feature suffix)\"\n ),\n knowledgeName: z\n .string()\n .describe(\n \"Name for the resulting knowledge (used as filename, e.g. 'authentication-principles')\"\n ),\n knowledgeSource: z.string().describe(\"Gherkin feature source text for the knowledge\"),\n }),\n execute: safeTool(\"reflect\", async ({ experienceNames, knowledgeName, knowledgeSource }) => {\n const role = requireRole();\n const feature = role.reflect(experienceNames, knowledgeName, knowledgeSource);\n return next(\n `Reflected: ${experienceNames.length} experience(s) → knowledge \"${feature.name}\"`,\n NEXT.reflect\n );\n }),\n});\n\nserver.addTool({\n name: \"finish\",\n description: DESC_FINISH,\n parameters: z.object({\n name: z.string().describe(\"Task name to mark as done\"),\n }),\n execute: safeTool(\"finish\", async ({ name }) => {\n const role = requireRole();\n role.finish(name);\n\n // Dynamic hint: check remaining tasks\n const { current } = role.focus();\n const remaining = current\n ? current.tasks.filter((t) => !t.tags?.some((tag) => tag.name === \"@done\")).length\n : -1;\n return next(`Task finished: ${name}`, remaining >= 0 ? nextFinish(remaining) : NEXT.achieve);\n }),\n});\n\nserver.start({\n transportType: \"stdio\",\n});\n"],"mappings":";;;AAqBA,SAAS,eAAe;AACxB,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAE9B,SAAS,YAAY;AACrB,SAAS,eAAe;AAExB,IAAM,oBAAoB,KAAK,QAAQ,GAAG,QAAQ;AAClD,IAAM,WAAW,QAAQ,KAAK,CAAC,KAAK,QAAQ,IAAI,aAAa;AAC7D,IAAM,WAAW,IAAI,cAAc,QAAQ;AAC3C,UAAU,QAAQ;AAClB,IAAM,QAAQ,IAAI,MAAM,QAAQ;AAEhC,IAAI,cAA2B;AAC/B,IAAI,kBAA0B;AAE9B,IAAM,SAAS,IAAI,QAAQ;AAAA,EACzB,MAAM;AAAA,EACN,SAAS;AAAA,EACT,cAAc;AAChB,CAAC;AAID,SAAS,cAAoB;AAC3B,MAAI,CAAC,aAAa;AAChB,UAAM,IAAI,MAAM,iEAAiE;AAAA,EACnF;AACA,SAAO;AACT;AAEA,SAAS,cAA6B;AACpC,MAAI,CAAC,eAAe,oBAAoB,QAAQ;AAC9C,UAAM,MAAM,mBAAmB;AAC/B,WAAO,iEAAiE,GAAG;AAAA,EAC7E;AACA,SAAO;AACT;AAMA,SAAS,SACP,UACA,IAC8B;AAC9B,SAAO,OAAO,SAAY;AACxB,QA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,EAChB;AAAA,MACC;AAAA,IACF;AAAA,IACF,eAAe,EACZ,OAAO,EACP;AAAA,MACC;AAAA,IACF;AAAA,IACF,iBAAiB,EAAE,OAAO,EAAE,SAAS,+CAA+C;AAAA,EACtF,CAAC;AAAA,EACD,SAAS,SAAS,WAAW,OAAO,EAAE,iBAAiB,eAAe,gBAAgB,MAAM;AAC1F,UAAM,OAAO,YAAY;AACzB,UAAM,UAAU,KAAK,QAAQ,iBAAiB,eAAe,eAAe;AAC5E,WAAO;AAAA,MACL,cAAc,gBAAgB,MAAM,oCAA+B,QAAQ,IAAI;AAAA,MAC/E,KAAK;AAAA,IACP;AAAA,EACF,CAAC;AACH,CAAC;AAED,OAAO,QAAQ;AAAA,EACb,MAAM;AAAA,EACN,aAAa;AAAA,EACb,YAAY,EAAE,OAAO;AAAA,IACnB,MAAM,EAAE,OAAO,EAAE,SAAS,2BAA2B;AAAA,EACvD,CAAC;AAAA,EACD,SAAS,SAAS,UAAU,OAAO,EAAE,KAAK,MAAM;AAC9C,UAAM,OAAO,YAAY;AACzB,SAAK,OAAO,IAAI;AAGhB,UAAM,EAAE,QAAQ,IAAI,KAAK,MAAM;AAC/B,UAAM,YAAY,UACd,QAAQ,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,QAAQ,IAAI,SAAS,OAAO,CAAC,EAAE,SAC1E;AACJ,WAAO,KAAK,kBAAkB,IAAI,IAAI,aAAa,IAAI,WAAW,SAAS,IAAI,KAAK,OAAO;AAAA,EAC7F,CAAC;AACH,CAAC;AAED,OAAO,MAAM;AAAA,EACX,eAAe;AACjB,CAAC;","names":[]}
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.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 /** 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,Q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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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolexjs/mcp-server",
3
- "version": "0.10.0",
3
+ "version": "0.11.0-dev.0",
4
4
  "description": "MCP server for Rolex — expose RDD role management as MCP tools",
5
5
  "keywords": [
6
6
  "rolex",
@@ -41,8 +41,8 @@
41
41
  "clean": "rm -rf dist"
42
42
  },
43
43
  "dependencies": {
44
- "rolexjs": "^0.10.0",
45
- "@rolexjs/local-platform": "^0.10.0",
44
+ "rolexjs": "workspace:*",
45
+ "@rolexjs/local-platform": "workspace:*",
46
46
  "fastmcp": "^3.0.0",
47
47
  "zod": "^3.25.0"
48
48
  },