@rolexjs/core 1.4.0-dev-20260305032702 → 1.4.0-dev-20260305092016
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.d.ts +397 -3
- package/dist/index.js +2408 -10
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
create as create5,
|
|
4
4
|
createRuntime,
|
|
5
5
|
link as link3,
|
|
6
|
-
process as
|
|
6
|
+
process as process6,
|
|
7
7
|
relation as relation2,
|
|
8
8
|
remove,
|
|
9
|
-
structure as
|
|
9
|
+
structure as structure3,
|
|
10
10
|
transform as transform4,
|
|
11
11
|
unlink as unlink3
|
|
12
12
|
} from "@rolexjs/system";
|
|
@@ -55,6 +55,11 @@ var wiki = structure("wiki", "Project-level knowledge base entry", project);
|
|
|
55
55
|
|
|
56
56
|
// src/execution.ts
|
|
57
57
|
import { create, process, transform } from "@rolexjs/system";
|
|
58
|
+
var activate = process(
|
|
59
|
+
"activate",
|
|
60
|
+
"Activate a role \u2014 load cognition into context",
|
|
61
|
+
individual
|
|
62
|
+
);
|
|
58
63
|
var want = process("want", "Declare a goal", individual, create(goal));
|
|
59
64
|
var planGoal = process("plan", "Create a plan for a goal", goal, create(plan));
|
|
60
65
|
var todo = process("todo", "Create a task in a plan", plan, create(task));
|
|
@@ -204,17 +209,2402 @@ var rehire = process5(
|
|
|
204
209
|
transform3(past, individual)
|
|
205
210
|
);
|
|
206
211
|
|
|
207
|
-
// src/role.ts
|
|
208
|
-
|
|
209
|
-
|
|
212
|
+
// src/role-model.ts
|
|
213
|
+
var Role = class {
|
|
214
|
+
id;
|
|
215
|
+
focusedGoalId = null;
|
|
216
|
+
focusedPlanId = null;
|
|
217
|
+
encounterIds = /* @__PURE__ */ new Set();
|
|
218
|
+
experienceIds = /* @__PURE__ */ new Set();
|
|
219
|
+
/** Set of all node ids under this individual — for ownership validation. */
|
|
220
|
+
nodeIds = /* @__PURE__ */ new Set();
|
|
221
|
+
deps;
|
|
222
|
+
constructor(id, deps) {
|
|
223
|
+
this.id = id;
|
|
224
|
+
this.deps = deps;
|
|
225
|
+
}
|
|
226
|
+
// ================================================================
|
|
227
|
+
// State projection — populated at activate time
|
|
228
|
+
// ================================================================
|
|
229
|
+
/** Populate from state projection. Builds nodeIds set + cognitive registries. */
|
|
230
|
+
hydrate(state) {
|
|
231
|
+
this.nodeIds.clear();
|
|
232
|
+
this.encounterIds.clear();
|
|
233
|
+
this.experienceIds.clear();
|
|
234
|
+
this.focusedGoalId = null;
|
|
235
|
+
this.walkState(state);
|
|
236
|
+
}
|
|
237
|
+
walkState(node) {
|
|
238
|
+
if (node.id) {
|
|
239
|
+
this.nodeIds.add(node.id);
|
|
240
|
+
switch (node.name) {
|
|
241
|
+
case "goal":
|
|
242
|
+
if (!this.focusedGoalId) this.focusedGoalId = node.id;
|
|
243
|
+
break;
|
|
244
|
+
case "encounter":
|
|
245
|
+
this.encounterIds.add(node.id);
|
|
246
|
+
break;
|
|
247
|
+
case "experience":
|
|
248
|
+
this.experienceIds.add(node.id);
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
for (const child of node.children ?? []) {
|
|
253
|
+
this.walkState(child);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
// ================================================================
|
|
257
|
+
// Ownership validation
|
|
258
|
+
// ================================================================
|
|
259
|
+
hasNode(id) {
|
|
260
|
+
return this.nodeIds.has(id);
|
|
261
|
+
}
|
|
262
|
+
requireOwnership(id, label) {
|
|
263
|
+
if (!this.hasNode(id)) {
|
|
264
|
+
throw new Error(`${label} "${id}" does not belong to individual "${this.id}".`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// ================================================================
|
|
268
|
+
// Cursor requirements
|
|
269
|
+
// ================================================================
|
|
270
|
+
requireGoalId() {
|
|
271
|
+
if (!this.focusedGoalId) throw new Error("No focused goal. Call want first.");
|
|
272
|
+
return this.focusedGoalId;
|
|
273
|
+
}
|
|
274
|
+
requirePlanId() {
|
|
275
|
+
if (!this.focusedPlanId) throw new Error("No focused plan. Call plan first.");
|
|
276
|
+
return this.focusedPlanId;
|
|
277
|
+
}
|
|
278
|
+
// ================================================================
|
|
279
|
+
// Rendering
|
|
280
|
+
// ================================================================
|
|
281
|
+
fmt(command, result) {
|
|
282
|
+
const rendered = this.deps.renderer.render(command, result);
|
|
283
|
+
const process7 = command.includes(".") ? command.slice(command.indexOf(".") + 1) : command;
|
|
284
|
+
const ch = this.cognitiveHint(process7);
|
|
285
|
+
if (!ch) return rendered;
|
|
286
|
+
const lines = rendered.split("\n");
|
|
287
|
+
lines.splice(2, 0, `I \u2192 ${ch}`);
|
|
288
|
+
return lines.join("\n");
|
|
289
|
+
}
|
|
290
|
+
// ================================================================
|
|
291
|
+
// Persistence
|
|
292
|
+
// ================================================================
|
|
293
|
+
async save() {
|
|
294
|
+
await this.deps.onSave(this.snapshot());
|
|
295
|
+
}
|
|
296
|
+
/** Serialize to KV-compatible snapshot. */
|
|
297
|
+
snapshot() {
|
|
298
|
+
return {
|
|
299
|
+
id: this.id,
|
|
300
|
+
focusedGoalId: this.focusedGoalId,
|
|
301
|
+
focusedPlanId: this.focusedPlanId,
|
|
302
|
+
encounterIds: [...this.encounterIds],
|
|
303
|
+
experienceIds: [...this.experienceIds]
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
/** Restore cursors and cognitive state from a snapshot. */
|
|
307
|
+
restore(snap) {
|
|
308
|
+
this.focusedGoalId = snap.focusedGoalId;
|
|
309
|
+
this.focusedPlanId = snap.focusedPlanId;
|
|
310
|
+
this.encounterIds.clear();
|
|
311
|
+
for (const id of snap.encounterIds) this.encounterIds.add(id);
|
|
312
|
+
this.experienceIds.clear();
|
|
313
|
+
for (const id of snap.experienceIds) this.experienceIds.add(id);
|
|
314
|
+
}
|
|
315
|
+
// ================================================================
|
|
316
|
+
// Execution — focus, want, plan, todo, finish, complete, abandon
|
|
317
|
+
// ================================================================
|
|
318
|
+
/** Project the individual's state tree (used after activate). */
|
|
319
|
+
async project() {
|
|
320
|
+
const result = await this.deps.commands["role.focus"](this.id);
|
|
321
|
+
return this.fmt("role.activate", result);
|
|
322
|
+
}
|
|
323
|
+
/** Focus: view or switch focused goal. Validates ownership. */
|
|
324
|
+
async focus(goal2) {
|
|
325
|
+
const goalId = goal2 ?? this.requireGoalId();
|
|
326
|
+
if (goal2) {
|
|
327
|
+
this.requireOwnership(goalId, "Goal");
|
|
328
|
+
}
|
|
329
|
+
const result = await this.deps.commands["role.focus"](goalId);
|
|
330
|
+
if (result.state.name !== "goal") {
|
|
331
|
+
throw new Error(
|
|
332
|
+
`"${goalId}" is a ${result.state.name}, not a goal. focus only accepts goal ids.`
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
const switched = goalId !== this.focusedGoalId;
|
|
336
|
+
this.focusedGoalId = goalId;
|
|
337
|
+
if (switched) this.focusedPlanId = null;
|
|
338
|
+
await this.save();
|
|
339
|
+
return this.fmt("role.focus", result);
|
|
340
|
+
}
|
|
341
|
+
/** Want: declare a goal under this individual. */
|
|
342
|
+
async want(goal2, id, alias) {
|
|
343
|
+
const result = await this.deps.commands["role.want"](this.id, goal2, id, alias);
|
|
344
|
+
const newId = id ?? result.state.id;
|
|
345
|
+
if (newId) {
|
|
346
|
+
this.nodeIds.add(newId);
|
|
347
|
+
this.focusedGoalId = newId;
|
|
348
|
+
}
|
|
349
|
+
this.focusedPlanId = null;
|
|
350
|
+
await this.save();
|
|
351
|
+
return this.fmt("role.want", result);
|
|
352
|
+
}
|
|
353
|
+
/** Plan: create a plan for the focused goal. */
|
|
354
|
+
async plan(plan2, id, after, fallback) {
|
|
355
|
+
const result = await this.deps.commands["role.plan"](
|
|
356
|
+
this.requireGoalId(),
|
|
357
|
+
plan2,
|
|
358
|
+
id,
|
|
359
|
+
after,
|
|
360
|
+
fallback
|
|
361
|
+
);
|
|
362
|
+
const newId = id ?? result.state.id;
|
|
363
|
+
if (newId) {
|
|
364
|
+
this.nodeIds.add(newId);
|
|
365
|
+
this.focusedPlanId = newId;
|
|
366
|
+
}
|
|
367
|
+
await this.save();
|
|
368
|
+
return this.fmt("role.plan", result);
|
|
369
|
+
}
|
|
370
|
+
/** Todo: add a task to the focused plan. */
|
|
371
|
+
async todo(task2, id, alias) {
|
|
372
|
+
const result = await this.deps.commands["role.todo"](this.requirePlanId(), task2, id, alias);
|
|
373
|
+
const newId = id ?? result.state.id;
|
|
374
|
+
if (newId) this.nodeIds.add(newId);
|
|
375
|
+
return this.fmt("role.todo", result);
|
|
376
|
+
}
|
|
377
|
+
/** Finish: complete a task, optionally record an encounter. */
|
|
378
|
+
async finish(task2, encounter2) {
|
|
379
|
+
this.requireOwnership(task2, "Task");
|
|
380
|
+
const result = await this.deps.commands["role.finish"](task2, this.id, encounter2);
|
|
381
|
+
if (encounter2 && result.state.id) {
|
|
382
|
+
this.encounterIds.add(result.state.id);
|
|
383
|
+
this.nodeIds.add(result.state.id);
|
|
384
|
+
}
|
|
385
|
+
return this.fmt("role.finish", result);
|
|
386
|
+
}
|
|
387
|
+
/** Complete: close a plan as done, record encounter. */
|
|
388
|
+
async complete(plan2, encounter2) {
|
|
389
|
+
const planId = plan2 ?? this.requirePlanId();
|
|
390
|
+
this.requireOwnership(planId, "Plan");
|
|
391
|
+
const result = await this.deps.commands["role.complete"](planId, this.id, encounter2);
|
|
392
|
+
const encId = result.state.id ?? planId;
|
|
393
|
+
this.encounterIds.add(encId);
|
|
394
|
+
this.nodeIds.add(encId);
|
|
395
|
+
if (this.focusedPlanId === planId) this.focusedPlanId = null;
|
|
396
|
+
await this.save();
|
|
397
|
+
return this.fmt("role.complete", result);
|
|
398
|
+
}
|
|
399
|
+
/** Abandon: drop a plan, record encounter. */
|
|
400
|
+
async abandon(plan2, encounter2) {
|
|
401
|
+
const planId = plan2 ?? this.requirePlanId();
|
|
402
|
+
this.requireOwnership(planId, "Plan");
|
|
403
|
+
const result = await this.deps.commands["role.abandon"](planId, this.id, encounter2);
|
|
404
|
+
const encId = result.state.id ?? planId;
|
|
405
|
+
this.encounterIds.add(encId);
|
|
406
|
+
this.nodeIds.add(encId);
|
|
407
|
+
if (this.focusedPlanId === planId) this.focusedPlanId = null;
|
|
408
|
+
await this.save();
|
|
409
|
+
return this.fmt("role.abandon", result);
|
|
410
|
+
}
|
|
411
|
+
// ================================================================
|
|
412
|
+
// Cognition — reflect, realize, master
|
|
413
|
+
// ================================================================
|
|
414
|
+
/** Reflect: consume encounters → experience. */
|
|
415
|
+
async reflect(encounters, experience2, id) {
|
|
416
|
+
if (encounters.length > 0) {
|
|
417
|
+
for (const enc of encounters) {
|
|
418
|
+
if (!this.encounterIds.has(enc)) throw new Error(`Encounter not found: "${enc}"`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
const first = encounters[0];
|
|
422
|
+
const result = await this.deps.commands["role.reflect"](first, this.id, experience2, id);
|
|
423
|
+
for (let i = 1; i < encounters.length; i++) {
|
|
424
|
+
await this.deps.commands["role.forget"](encounters[i]);
|
|
425
|
+
}
|
|
426
|
+
if (encounters.length > 0) {
|
|
427
|
+
for (const enc of encounters) this.encounterIds.delete(enc);
|
|
428
|
+
}
|
|
429
|
+
const newId = id ?? result.state.id;
|
|
430
|
+
if (newId) {
|
|
431
|
+
this.experienceIds.add(newId);
|
|
432
|
+
this.nodeIds.add(newId);
|
|
433
|
+
}
|
|
434
|
+
return this.fmt("role.reflect", result);
|
|
435
|
+
}
|
|
436
|
+
/** Realize: consume experiences → principle. */
|
|
437
|
+
async realize(experiences, principle2, id) {
|
|
438
|
+
if (experiences.length > 0) {
|
|
439
|
+
for (const exp of experiences) {
|
|
440
|
+
if (!this.experienceIds.has(exp)) throw new Error(`Experience not found: "${exp}"`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
const first = experiences[0];
|
|
444
|
+
const result = await this.deps.commands["role.realize"](first, this.id, principle2, id);
|
|
445
|
+
for (let i = 1; i < experiences.length; i++) {
|
|
446
|
+
await this.deps.commands["role.forget"](experiences[i]);
|
|
447
|
+
}
|
|
448
|
+
if (experiences.length > 0) {
|
|
449
|
+
for (const exp of experiences) this.experienceIds.delete(exp);
|
|
450
|
+
}
|
|
451
|
+
const newId = id ?? result.state.id;
|
|
452
|
+
if (newId) this.nodeIds.add(newId);
|
|
453
|
+
return this.fmt("role.realize", result);
|
|
454
|
+
}
|
|
455
|
+
/** Master: create procedure, optionally consuming experiences. */
|
|
456
|
+
async master(procedure2, id, experiences) {
|
|
457
|
+
if (experiences && experiences.length > 0) {
|
|
458
|
+
for (const exp of experiences) {
|
|
459
|
+
if (!this.experienceIds.has(exp)) throw new Error(`Experience not found: "${exp}"`);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
const first = experiences?.[0];
|
|
463
|
+
const result = await this.deps.commands["role.master"](this.id, procedure2, id, first);
|
|
464
|
+
if (experiences) {
|
|
465
|
+
for (let i = 1; i < experiences.length; i++) {
|
|
466
|
+
await this.deps.commands["role.forget"](experiences[i]);
|
|
467
|
+
}
|
|
468
|
+
for (const exp of experiences) this.experienceIds.delete(exp);
|
|
469
|
+
}
|
|
470
|
+
const newId = id ?? result.state.id;
|
|
471
|
+
if (newId) this.nodeIds.add(newId);
|
|
472
|
+
return this.fmt("role.master", result);
|
|
473
|
+
}
|
|
474
|
+
// ================================================================
|
|
475
|
+
// Knowledge management
|
|
476
|
+
// ================================================================
|
|
477
|
+
/** Forget: remove any node under this individual by id. */
|
|
478
|
+
async forget(nodeId) {
|
|
479
|
+
this.requireOwnership(nodeId, "Node");
|
|
480
|
+
const result = await this.deps.commands["role.forget"](nodeId);
|
|
481
|
+
this.nodeIds.delete(nodeId);
|
|
482
|
+
if (this.focusedGoalId === nodeId) this.focusedGoalId = null;
|
|
483
|
+
if (this.focusedPlanId === nodeId) this.focusedPlanId = null;
|
|
484
|
+
this.encounterIds.delete(nodeId);
|
|
485
|
+
this.experienceIds.delete(nodeId);
|
|
486
|
+
await this.save();
|
|
487
|
+
return this.fmt("role.forget", result);
|
|
488
|
+
}
|
|
489
|
+
// ================================================================
|
|
490
|
+
// Skills
|
|
491
|
+
// ================================================================
|
|
492
|
+
/** Skill: load full skill content by locator. */
|
|
493
|
+
async skill(locator) {
|
|
494
|
+
return await this.deps.commands["role.skill"](locator);
|
|
495
|
+
}
|
|
496
|
+
// ================================================================
|
|
497
|
+
// Use — subjective execution
|
|
498
|
+
// ================================================================
|
|
499
|
+
/** Use: subjective execution — `!ns.method` or ResourceX locator. */
|
|
500
|
+
async use(locator, args) {
|
|
501
|
+
if (!this.deps.direct) {
|
|
502
|
+
throw new Error("Direct execution is not available on this Role instance.");
|
|
503
|
+
}
|
|
504
|
+
const result = await this.deps.direct(locator, args);
|
|
505
|
+
if (this.deps.transformUseResult) {
|
|
506
|
+
return this.deps.transformUseResult(locator, result);
|
|
507
|
+
}
|
|
508
|
+
return result;
|
|
509
|
+
}
|
|
510
|
+
// ================================================================
|
|
511
|
+
// Cognitive hints
|
|
512
|
+
// ================================================================
|
|
513
|
+
cognitiveHint(process7) {
|
|
514
|
+
switch (process7) {
|
|
515
|
+
case "activate":
|
|
516
|
+
if (!this.focusedGoalId)
|
|
517
|
+
return "I have no goal yet. I should call `want` to declare one, or `focus` to review existing goals.";
|
|
518
|
+
return "I have an active goal. I should call `focus` to review progress, or `want` to declare a new goal.";
|
|
519
|
+
case "focus":
|
|
520
|
+
if (!this.focusedPlanId)
|
|
521
|
+
return "I have a goal but no focused plan. I should call `plan` to create or focus on one.";
|
|
522
|
+
return "I have a plan. I should call `todo` to create tasks, or continue working.";
|
|
523
|
+
case "want":
|
|
524
|
+
return "Goal declared. I should call `plan` to design how to achieve it.";
|
|
525
|
+
case "plan":
|
|
526
|
+
return "Plan created. I should call `todo` to create concrete tasks.";
|
|
527
|
+
case "todo":
|
|
528
|
+
return "Task created. I can add more with `todo`, or start working and call `finish` when done.";
|
|
529
|
+
case "finish": {
|
|
530
|
+
const encCount = this.encounterIds.size;
|
|
531
|
+
if (encCount > 0 && !this.focusedGoalId)
|
|
532
|
+
return `Task finished. No more goals \u2014 I have ${encCount} encounter(s) to choose from for \`reflect\`, or \`want\` a new goal.`;
|
|
533
|
+
return "Task finished. I should continue with remaining tasks, or call `complete` when the plan is done.";
|
|
534
|
+
}
|
|
535
|
+
case "complete":
|
|
536
|
+
case "abandon": {
|
|
537
|
+
const encCount = this.encounterIds.size;
|
|
538
|
+
const goalNote = this.focusedGoalId ? ` I should check if goal "${this.focusedGoalId}" needs a new \`plan\`, or \`forget\` it if the direction is fulfilled.` : "";
|
|
539
|
+
if (encCount > 0)
|
|
540
|
+
return `Plan closed.${goalNote} I have ${encCount} encounter(s) to choose from for \`reflect\`, or I can continue with other plans.`;
|
|
541
|
+
return `Plan closed.${goalNote} I can create a new \`plan\`, or \`focus\` on another goal.`;
|
|
542
|
+
}
|
|
543
|
+
case "reflect": {
|
|
544
|
+
const expCount = this.experienceIds.size;
|
|
545
|
+
if (expCount > 0)
|
|
546
|
+
return `Experience gained. I can \`realize\` principles or \`master\` procedures \u2014 ${expCount} experience(s) available.`;
|
|
547
|
+
return "Experience gained. I can `realize` a principle, `master` a procedure, or continue working.";
|
|
548
|
+
}
|
|
549
|
+
case "realize":
|
|
550
|
+
return "Principle added. I should continue working.";
|
|
551
|
+
case "master":
|
|
552
|
+
return "Procedure added. I should continue working.";
|
|
553
|
+
default:
|
|
554
|
+
return null;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
// src/rolex-service.ts
|
|
560
|
+
import { createIssueX } from "issuexjs";
|
|
561
|
+
import { createResourceX, setProvider } from "resourcexjs";
|
|
562
|
+
|
|
563
|
+
// src/apply.ts
|
|
564
|
+
async function applyPrototype(data, repo, direct) {
|
|
565
|
+
const sorted = [...data.migrations].sort((a, b) => a.version - b.version);
|
|
566
|
+
let applied = 0;
|
|
567
|
+
let skipped = 0;
|
|
568
|
+
for (const migration of sorted) {
|
|
569
|
+
if (await repo.hasMigration(data.id, migration.id)) {
|
|
570
|
+
skipped++;
|
|
571
|
+
continue;
|
|
572
|
+
}
|
|
573
|
+
for (const instr of migration.instructions) {
|
|
574
|
+
await direct(instr.op, instr.args);
|
|
575
|
+
}
|
|
576
|
+
await repo.recordMigration(data.id, migration.id, migration.version, migration.checksum);
|
|
577
|
+
applied++;
|
|
578
|
+
}
|
|
579
|
+
await repo.settle(data.id, data.source);
|
|
580
|
+
return {
|
|
581
|
+
prototypeId: data.id,
|
|
582
|
+
applied,
|
|
583
|
+
skipped,
|
|
584
|
+
upToDate: applied === 0
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// src/commands.ts
|
|
589
|
+
import { parse } from "@rolexjs/parser";
|
|
590
|
+
import { structure as structure2 } from "@rolexjs/system";
|
|
591
|
+
function createCommands(ctx) {
|
|
592
|
+
const { rt, society: society2, past: past2, resolve, resourcex, issuex } = ctx;
|
|
593
|
+
async function ok(node, process7) {
|
|
594
|
+
return { state: await rt.project(node), process: process7 };
|
|
595
|
+
}
|
|
596
|
+
async function archive2(node, process7) {
|
|
597
|
+
const target = structure2(node.name, node.description ?? "", past);
|
|
598
|
+
const archived = await rt.transform(node, target);
|
|
599
|
+
return ok(archived, process7);
|
|
600
|
+
}
|
|
601
|
+
function validateGherkin(source) {
|
|
602
|
+
if (!source) return;
|
|
603
|
+
try {
|
|
604
|
+
parse(source);
|
|
605
|
+
} catch (e) {
|
|
606
|
+
throw new Error(`Invalid Gherkin: ${e.message}`);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function findInState2(state, target) {
|
|
610
|
+
if (state.id && state.id.toLowerCase() === target) return state;
|
|
611
|
+
if (state.alias) {
|
|
612
|
+
for (const a of state.alias) {
|
|
613
|
+
if (a.toLowerCase() === target) return state;
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
for (const child of state.children ?? []) {
|
|
617
|
+
const found2 = findInState2(child, target);
|
|
618
|
+
if (found2) return found2;
|
|
619
|
+
}
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
async function removeExisting(parent, id) {
|
|
623
|
+
const state = await rt.project(parent);
|
|
624
|
+
const existing = findInState2(state, id);
|
|
625
|
+
if (existing) await rt.remove(existing);
|
|
626
|
+
}
|
|
627
|
+
function requireResourceX() {
|
|
628
|
+
if (!resourcex) throw new Error("ResourceX is not available.");
|
|
629
|
+
return resourcex;
|
|
630
|
+
}
|
|
631
|
+
function requireIssueX() {
|
|
632
|
+
if (!issuex) throw new Error("IssueX is not available.");
|
|
633
|
+
return issuex;
|
|
634
|
+
}
|
|
635
|
+
return {
|
|
636
|
+
// ---- Individual: lifecycle ----
|
|
637
|
+
async "individual.born"(content, id, alias) {
|
|
638
|
+
validateGherkin(content);
|
|
639
|
+
const node = await rt.create(society2, individual, content, id, alias);
|
|
640
|
+
await rt.create(node, identity, void 0, `${id}-identity`);
|
|
641
|
+
return ok(node, "born");
|
|
642
|
+
},
|
|
643
|
+
async "individual.retire"(individual2) {
|
|
644
|
+
return archive2(await resolve(individual2), "retire");
|
|
645
|
+
},
|
|
646
|
+
async "individual.die"(individual2) {
|
|
647
|
+
return archive2(await resolve(individual2), "die");
|
|
648
|
+
},
|
|
649
|
+
async "individual.rehire"(pastNode) {
|
|
650
|
+
const node = await resolve(pastNode);
|
|
651
|
+
const ind = await rt.transform(node, individual);
|
|
652
|
+
return ok(ind, "rehire");
|
|
653
|
+
},
|
|
654
|
+
// ---- Individual: external injection ----
|
|
655
|
+
async "individual.teach"(individual2, principle2, id) {
|
|
656
|
+
validateGherkin(principle2);
|
|
657
|
+
const parent = await resolve(individual2);
|
|
658
|
+
if (id) await removeExisting(parent, id);
|
|
659
|
+
const node = await rt.create(parent, principle, principle2, id);
|
|
660
|
+
return ok(node, "teach");
|
|
661
|
+
},
|
|
662
|
+
async "individual.train"(individual2, procedure2, id) {
|
|
663
|
+
validateGherkin(procedure2);
|
|
664
|
+
const parent = await resolve(individual2);
|
|
665
|
+
if (id) await removeExisting(parent, id);
|
|
666
|
+
const node = await rt.create(parent, procedure, procedure2, id);
|
|
667
|
+
return ok(node, "train");
|
|
668
|
+
},
|
|
669
|
+
// ---- Role: focus ----
|
|
670
|
+
async "role.focus"(goal2) {
|
|
671
|
+
return ok(await resolve(goal2), "focus");
|
|
672
|
+
},
|
|
673
|
+
// ---- Role: execution ----
|
|
674
|
+
async "role.want"(individual2, goal2, id, alias) {
|
|
675
|
+
validateGherkin(goal2);
|
|
676
|
+
const node = await rt.create(await resolve(individual2), goal, goal2, id, alias);
|
|
677
|
+
return ok(node, "want");
|
|
678
|
+
},
|
|
679
|
+
async "role.plan"(goal2, plan2, id, after, fallback) {
|
|
680
|
+
validateGherkin(plan2);
|
|
681
|
+
const node = await rt.create(await resolve(goal2), plan, plan2, id);
|
|
682
|
+
if (after) await rt.link(node, await resolve(after), "after", "before");
|
|
683
|
+
if (fallback) await rt.link(node, await resolve(fallback), "fallback-for", "fallback");
|
|
684
|
+
return ok(node, "plan");
|
|
685
|
+
},
|
|
686
|
+
async "role.todo"(plan2, task2, id, alias) {
|
|
687
|
+
validateGherkin(task2);
|
|
688
|
+
const node = await rt.create(await resolve(plan2), task, task2, id, alias);
|
|
689
|
+
return ok(node, "todo");
|
|
690
|
+
},
|
|
691
|
+
async "role.finish"(task2, individual2, encounter2) {
|
|
692
|
+
validateGherkin(encounter2);
|
|
693
|
+
const taskNode = await resolve(task2);
|
|
694
|
+
await rt.tag(taskNode, "done");
|
|
695
|
+
if (encounter2) {
|
|
696
|
+
const encId = taskNode.id ? `${taskNode.id}-finished` : void 0;
|
|
697
|
+
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
698
|
+
return ok(enc, "finish");
|
|
699
|
+
}
|
|
700
|
+
return ok(taskNode, "finish");
|
|
701
|
+
},
|
|
702
|
+
async "role.complete"(plan2, individual2, encounter2) {
|
|
703
|
+
validateGherkin(encounter2);
|
|
704
|
+
const planNode = await resolve(plan2);
|
|
705
|
+
await rt.tag(planNode, "done");
|
|
706
|
+
const encId = planNode.id ? `${planNode.id}-completed` : void 0;
|
|
707
|
+
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
708
|
+
return ok(enc, "complete");
|
|
709
|
+
},
|
|
710
|
+
async "role.abandon"(plan2, individual2, encounter2) {
|
|
711
|
+
validateGherkin(encounter2);
|
|
712
|
+
const planNode = await resolve(plan2);
|
|
713
|
+
await rt.tag(planNode, "abandoned");
|
|
714
|
+
const encId = planNode.id ? `${planNode.id}-abandoned` : void 0;
|
|
715
|
+
const enc = await rt.create(await resolve(individual2), encounter, encounter2, encId);
|
|
716
|
+
return ok(enc, "abandon");
|
|
717
|
+
},
|
|
718
|
+
// ---- Role: cognition ----
|
|
719
|
+
async "role.reflect"(encounter2, individual2, experience2, id) {
|
|
720
|
+
validateGherkin(experience2);
|
|
721
|
+
if (encounter2) {
|
|
722
|
+
const encNode = await resolve(encounter2);
|
|
723
|
+
const exp2 = await rt.create(
|
|
724
|
+
await resolve(individual2),
|
|
725
|
+
experience,
|
|
726
|
+
experience2 || encNode.information,
|
|
727
|
+
id
|
|
728
|
+
);
|
|
729
|
+
await rt.remove(encNode);
|
|
730
|
+
return ok(exp2, "reflect");
|
|
731
|
+
}
|
|
732
|
+
const exp = await rt.create(await resolve(individual2), experience, experience2, id);
|
|
733
|
+
return ok(exp, "reflect");
|
|
734
|
+
},
|
|
735
|
+
async "role.realize"(experience2, individual2, principle2, id) {
|
|
736
|
+
validateGherkin(principle2);
|
|
737
|
+
if (experience2) {
|
|
738
|
+
const expNode = await resolve(experience2);
|
|
739
|
+
const prin2 = await rt.create(
|
|
740
|
+
await resolve(individual2),
|
|
741
|
+
principle,
|
|
742
|
+
principle2 || expNode.information,
|
|
743
|
+
id
|
|
744
|
+
);
|
|
745
|
+
await rt.remove(expNode);
|
|
746
|
+
return ok(prin2, "realize");
|
|
747
|
+
}
|
|
748
|
+
const prin = await rt.create(await resolve(individual2), principle, principle2, id);
|
|
749
|
+
return ok(prin, "realize");
|
|
750
|
+
},
|
|
751
|
+
async "role.master"(individual2, procedure2, id, experience2) {
|
|
752
|
+
validateGherkin(procedure2);
|
|
753
|
+
const parent = await resolve(individual2);
|
|
754
|
+
if (id) await removeExisting(parent, id);
|
|
755
|
+
const proc = await rt.create(parent, procedure, procedure2, id);
|
|
756
|
+
if (experience2) await rt.remove(await resolve(experience2));
|
|
757
|
+
return ok(proc, "master");
|
|
758
|
+
},
|
|
759
|
+
// ---- Role: knowledge management ----
|
|
760
|
+
async "role.forget"(nodeId) {
|
|
761
|
+
const node = await resolve(nodeId);
|
|
762
|
+
await rt.remove(node);
|
|
763
|
+
return { state: { ...node, children: [] }, process: "forget" };
|
|
764
|
+
},
|
|
765
|
+
// ---- Role: skill ----
|
|
766
|
+
async "role.skill"(locator) {
|
|
767
|
+
const rx = requireResourceX();
|
|
768
|
+
const content = await rx.ingest(locator);
|
|
769
|
+
const text = typeof content === "string" ? content : JSON.stringify(content, null, 2);
|
|
770
|
+
try {
|
|
771
|
+
const rxm = await rx.info(locator);
|
|
772
|
+
return `${formatRXM(rxm)}
|
|
773
|
+
|
|
774
|
+
${text}`;
|
|
775
|
+
} catch {
|
|
776
|
+
return text;
|
|
777
|
+
}
|
|
778
|
+
},
|
|
779
|
+
// ---- Project ----
|
|
780
|
+
async "project.launch"(content, id, alias, org) {
|
|
781
|
+
validateGherkin(content);
|
|
782
|
+
const node = await rt.create(society2, project, content, id, alias);
|
|
783
|
+
if (org) await rt.link(node, await resolve(org), "ownership", "project");
|
|
784
|
+
return ok(node, "launch");
|
|
785
|
+
},
|
|
786
|
+
async "project.scope"(project2, scope2, id) {
|
|
787
|
+
validateGherkin(scope2);
|
|
788
|
+
const node = await rt.create(await resolve(project2), scope, scope2, id);
|
|
789
|
+
return ok(node, "scope");
|
|
790
|
+
},
|
|
791
|
+
async "project.milestone"(project2, milestone2, id) {
|
|
792
|
+
validateGherkin(milestone2);
|
|
793
|
+
const node = await rt.create(await resolve(project2), milestone, milestone2, id);
|
|
794
|
+
return ok(node, "milestone");
|
|
795
|
+
},
|
|
796
|
+
async "project.achieve"(milestone2) {
|
|
797
|
+
const node = await resolve(milestone2);
|
|
798
|
+
await rt.tag(node, "done");
|
|
799
|
+
return ok(node, "achieve");
|
|
800
|
+
},
|
|
801
|
+
async "project.enroll"(project2, individual2) {
|
|
802
|
+
const projNode = await resolve(project2);
|
|
803
|
+
await rt.link(projNode, await resolve(individual2), "participation", "participate");
|
|
804
|
+
return ok(projNode, "enroll");
|
|
805
|
+
},
|
|
806
|
+
async "project.remove"(project2, individual2) {
|
|
807
|
+
const projNode = await resolve(project2);
|
|
808
|
+
await rt.unlink(projNode, await resolve(individual2), "participation", "participate");
|
|
809
|
+
return ok(projNode, "remove");
|
|
810
|
+
},
|
|
811
|
+
async "project.deliver"(project2, deliverable2, id) {
|
|
812
|
+
validateGherkin(deliverable2);
|
|
813
|
+
const node = await rt.create(await resolve(project2), deliverable, deliverable2, id);
|
|
814
|
+
return ok(node, "deliver");
|
|
815
|
+
},
|
|
816
|
+
async "project.wiki"(project2, wiki2, id) {
|
|
817
|
+
validateGherkin(wiki2);
|
|
818
|
+
const node = await rt.create(await resolve(project2), wiki, wiki2, id);
|
|
819
|
+
return ok(node, "wiki");
|
|
820
|
+
},
|
|
821
|
+
async "project.archive"(project2) {
|
|
822
|
+
return archive2(await resolve(project2), "archive");
|
|
823
|
+
},
|
|
824
|
+
// ---- Org ----
|
|
825
|
+
async "org.found"(content, id, alias) {
|
|
826
|
+
validateGherkin(content);
|
|
827
|
+
const node = await rt.create(society2, organization, content, id, alias);
|
|
828
|
+
return ok(node, "found");
|
|
829
|
+
},
|
|
830
|
+
async "org.charter"(org, charter2, id) {
|
|
831
|
+
validateGherkin(charter2);
|
|
832
|
+
const node = await rt.create(await resolve(org), charter, charter2, id);
|
|
833
|
+
return ok(node, "charter");
|
|
834
|
+
},
|
|
835
|
+
async "org.dissolve"(org) {
|
|
836
|
+
return archive2(await resolve(org), "dissolve");
|
|
837
|
+
},
|
|
838
|
+
async "org.hire"(org, individual2) {
|
|
839
|
+
const orgNode = await resolve(org);
|
|
840
|
+
await rt.link(orgNode, await resolve(individual2), "membership", "belong");
|
|
841
|
+
return ok(orgNode, "hire");
|
|
842
|
+
},
|
|
843
|
+
async "org.fire"(org, individual2) {
|
|
844
|
+
const orgNode = await resolve(org);
|
|
845
|
+
await rt.unlink(orgNode, await resolve(individual2), "membership", "belong");
|
|
846
|
+
return ok(orgNode, "fire");
|
|
847
|
+
},
|
|
848
|
+
// ---- Position ----
|
|
849
|
+
async "position.establish"(content, id, alias) {
|
|
850
|
+
validateGherkin(content);
|
|
851
|
+
const node = await rt.create(society2, position, content, id, alias);
|
|
852
|
+
return ok(node, "establish");
|
|
853
|
+
},
|
|
854
|
+
async "position.charge"(position2, duty2, id) {
|
|
855
|
+
validateGherkin(duty2);
|
|
856
|
+
const node = await rt.create(await resolve(position2), duty, duty2, id);
|
|
857
|
+
return ok(node, "charge");
|
|
858
|
+
},
|
|
859
|
+
async "position.require"(position2, procedure2, id) {
|
|
860
|
+
validateGherkin(procedure2);
|
|
861
|
+
const parent = await resolve(position2);
|
|
862
|
+
if (id) await removeExisting(parent, id);
|
|
863
|
+
const node = await rt.create(parent, requirement, procedure2, id);
|
|
864
|
+
return ok(node, "require");
|
|
865
|
+
},
|
|
866
|
+
async "position.abolish"(position2) {
|
|
867
|
+
return archive2(await resolve(position2), "abolish");
|
|
868
|
+
},
|
|
869
|
+
async "position.appoint"(position2, individual2) {
|
|
870
|
+
const posNode = await resolve(position2);
|
|
871
|
+
const indNode = await resolve(individual2);
|
|
872
|
+
await rt.link(posNode, indNode, "appointment", "serve");
|
|
873
|
+
const posState = await rt.project(posNode);
|
|
874
|
+
for (const child of posState.children ?? []) {
|
|
875
|
+
if (child.name !== "requirement" || !child.information) continue;
|
|
876
|
+
await rt.create(indNode, procedure, child.information, child.id);
|
|
877
|
+
}
|
|
878
|
+
return ok(posNode, "appoint");
|
|
879
|
+
},
|
|
880
|
+
async "position.dismiss"(position2, individual2) {
|
|
881
|
+
const posNode = await resolve(position2);
|
|
882
|
+
await rt.unlink(posNode, await resolve(individual2), "appointment", "serve");
|
|
883
|
+
return ok(posNode, "dismiss");
|
|
884
|
+
},
|
|
885
|
+
// ---- Census ----
|
|
886
|
+
async "census.list"(type) {
|
|
887
|
+
const target = type === "past" ? past2 : society2;
|
|
888
|
+
const state = await rt.project(target);
|
|
889
|
+
const children = state.children ?? [];
|
|
890
|
+
const filtered = type === "past" ? children : children.filter((c) => type ? c.name === type : c.name !== "past");
|
|
891
|
+
return { state: { ...state, children: filtered }, process: "list" };
|
|
892
|
+
},
|
|
893
|
+
// ---- Resource (proxy to ResourceX) ----
|
|
894
|
+
"resource.add"(path) {
|
|
895
|
+
return requireResourceX().add(path);
|
|
896
|
+
},
|
|
897
|
+
"resource.search"(query) {
|
|
898
|
+
return requireResourceX().search(query);
|
|
899
|
+
},
|
|
900
|
+
"resource.has"(locator) {
|
|
901
|
+
return requireResourceX().has(locator);
|
|
902
|
+
},
|
|
903
|
+
"resource.info"(locator) {
|
|
904
|
+
return requireResourceX().info(locator);
|
|
905
|
+
},
|
|
906
|
+
"resource.remove"(locator) {
|
|
907
|
+
return requireResourceX().remove(locator);
|
|
908
|
+
},
|
|
909
|
+
"resource.push"(locator, options) {
|
|
910
|
+
return requireResourceX().push(locator, options);
|
|
911
|
+
},
|
|
912
|
+
"resource.pull"(locator, options) {
|
|
913
|
+
return requireResourceX().pull(locator, options);
|
|
914
|
+
},
|
|
915
|
+
"resource.clearCache"(registry) {
|
|
916
|
+
return requireResourceX().clearCache(registry);
|
|
917
|
+
},
|
|
918
|
+
// ---- Issue (proxy to IssueX) ----
|
|
919
|
+
async "issue.publish"(title, body, author, assignee) {
|
|
920
|
+
const ix = requireIssueX();
|
|
921
|
+
return ix.createIssue({ title, body, author, assignee });
|
|
922
|
+
},
|
|
923
|
+
async "issue.get"(number) {
|
|
924
|
+
return requireIssueX().getIssueByNumber(number);
|
|
925
|
+
},
|
|
926
|
+
async "issue.list"(status, author, assignee, label) {
|
|
927
|
+
const filter = {};
|
|
928
|
+
if (status) filter.status = status;
|
|
929
|
+
if (author) filter.author = author;
|
|
930
|
+
if (assignee) filter.assignee = assignee;
|
|
931
|
+
if (label) filter.label = label;
|
|
932
|
+
return requireIssueX().listIssues(
|
|
933
|
+
Object.keys(filter).length > 0 ? filter : void 0
|
|
934
|
+
);
|
|
935
|
+
},
|
|
936
|
+
async "issue.update"(number, title, body, assignee) {
|
|
937
|
+
const ix = requireIssueX();
|
|
938
|
+
const issue = await ix.getIssueByNumber(number);
|
|
939
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
940
|
+
const patch = {};
|
|
941
|
+
if (title !== void 0) patch.title = title;
|
|
942
|
+
if (body !== void 0) patch.body = body;
|
|
943
|
+
if (assignee !== void 0) patch.assignee = assignee;
|
|
944
|
+
return ix.updateIssue(issue.id, patch);
|
|
945
|
+
},
|
|
946
|
+
async "issue.close"(number) {
|
|
947
|
+
const ix = requireIssueX();
|
|
948
|
+
const issue = await ix.getIssueByNumber(number);
|
|
949
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
950
|
+
return ix.closeIssue(issue.id);
|
|
951
|
+
},
|
|
952
|
+
async "issue.reopen"(number) {
|
|
953
|
+
const ix = requireIssueX();
|
|
954
|
+
const issue = await ix.getIssueByNumber(number);
|
|
955
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
956
|
+
return ix.reopenIssue(issue.id);
|
|
957
|
+
},
|
|
958
|
+
async "issue.assign"(number, assignee) {
|
|
959
|
+
const ix = requireIssueX();
|
|
960
|
+
const issue = await ix.getIssueByNumber(number);
|
|
961
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
962
|
+
return ix.updateIssue(issue.id, { assignee });
|
|
963
|
+
},
|
|
964
|
+
async "issue.comment"(number, body, author) {
|
|
965
|
+
const ix = requireIssueX();
|
|
966
|
+
const issue = await ix.getIssueByNumber(number);
|
|
967
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
968
|
+
return ix.createComment(issue.id, body, author);
|
|
969
|
+
},
|
|
970
|
+
async "issue.comments"(number) {
|
|
971
|
+
const ix = requireIssueX();
|
|
972
|
+
const issue = await ix.getIssueByNumber(number);
|
|
973
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
974
|
+
return ix.listComments(issue.id);
|
|
975
|
+
},
|
|
976
|
+
async "issue.label"(number, label) {
|
|
977
|
+
const ix = requireIssueX();
|
|
978
|
+
const issue = await ix.getIssueByNumber(number);
|
|
979
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
980
|
+
let labelObj = await ix.getLabelByName(label);
|
|
981
|
+
if (!labelObj) labelObj = await ix.createLabel({ name: label });
|
|
982
|
+
await ix.addLabel(issue.id, labelObj.id);
|
|
983
|
+
return ix.getIssueByNumber(number);
|
|
984
|
+
},
|
|
985
|
+
async "issue.unlabel"(number, label) {
|
|
986
|
+
const ix = requireIssueX();
|
|
987
|
+
const issue = await ix.getIssueByNumber(number);
|
|
988
|
+
if (!issue) throw new Error(`Issue #${number} not found.`);
|
|
989
|
+
const labelObj = await ix.getLabelByName(label);
|
|
990
|
+
if (!labelObj) throw new Error(`Label "${label}" not found.`);
|
|
991
|
+
await ix.removeLabel(issue.id, labelObj.id);
|
|
992
|
+
return ix.getIssueByNumber(number);
|
|
993
|
+
}
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
function formatRXM(rxm) {
|
|
997
|
+
const lines = [`--- RXM: ${rxm.locator} ---`];
|
|
998
|
+
const def2 = rxm.definition;
|
|
999
|
+
if (def2) {
|
|
1000
|
+
if (def2.author) lines.push(`Author: ${def2.author}`);
|
|
1001
|
+
if (def2.description) lines.push(`Description: ${def2.description}`);
|
|
1002
|
+
}
|
|
1003
|
+
const source = rxm.source;
|
|
1004
|
+
if (source?.files) {
|
|
1005
|
+
lines.push("Files:");
|
|
1006
|
+
lines.push(renderFileTree(source.files, " "));
|
|
1007
|
+
}
|
|
1008
|
+
lines.push("---");
|
|
1009
|
+
return lines.join("\n");
|
|
1010
|
+
}
|
|
1011
|
+
function renderFileTree(files, indent = "") {
|
|
1012
|
+
const lines = [];
|
|
1013
|
+
for (const [name, value] of Object.entries(files)) {
|
|
1014
|
+
if (value && typeof value === "object" && !("size" in value)) {
|
|
1015
|
+
lines.push(`${indent}${name}`);
|
|
1016
|
+
lines.push(renderFileTree(value, `${indent} `));
|
|
1017
|
+
} else {
|
|
1018
|
+
const size = value?.size ? ` (${value.size} bytes)` : "";
|
|
1019
|
+
lines.push(`${indent}${name}${size}`);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return lines.filter(Boolean).join("\n");
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// src/directives/index.ts
|
|
1026
|
+
var directives = {
|
|
1027
|
+
"identity-ethics": {
|
|
1028
|
+
"on-unknown-command": "STOP. Do not guess another command name. Do not search source code for commands.\nCheck your procedures \u2014 if one covers this task, call skill(locator) to load it first.\nThe skill will tell you the correct command name and arguments.\nIf no procedure covers this task, it is outside your duties. Tell the user and suggest Nuwa.",
|
|
1029
|
+
"on-activate": "Your duties define the COMPLETE scope of what you do. Everything else is forbidden.\nWhen a request falls outside your duties, you MUST refuse. This is not optional.\nDo not attempt to discover commands outside your skills. Do not read source code to find them.\nSuggest Nuwa for anything outside your scope."
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
|
|
1033
|
+
// src/instructions.ts
|
|
1034
|
+
function def(namespace, method, params, args) {
|
|
1035
|
+
return { namespace, method, params, args };
|
|
1036
|
+
}
|
|
1037
|
+
var individualBorn = def(
|
|
1038
|
+
"individual",
|
|
1039
|
+
"born",
|
|
1040
|
+
{
|
|
1041
|
+
content: {
|
|
1042
|
+
type: "gherkin",
|
|
1043
|
+
required: false,
|
|
1044
|
+
description: "Gherkin Feature source for the individual"
|
|
1045
|
+
},
|
|
1046
|
+
id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
|
|
1047
|
+
alias: { type: "string[]", required: false, description: "Alternative names" }
|
|
1048
|
+
},
|
|
1049
|
+
["content", "id", "alias"]
|
|
1050
|
+
);
|
|
1051
|
+
var individualRetire = def(
|
|
1052
|
+
"individual",
|
|
1053
|
+
"retire",
|
|
1054
|
+
{
|
|
1055
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1056
|
+
},
|
|
1057
|
+
["individual"]
|
|
1058
|
+
);
|
|
1059
|
+
var individualDie = def(
|
|
1060
|
+
"individual",
|
|
1061
|
+
"die",
|
|
1062
|
+
{
|
|
1063
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1064
|
+
},
|
|
1065
|
+
["individual"]
|
|
1066
|
+
);
|
|
1067
|
+
var individualRehire = def(
|
|
1068
|
+
"individual",
|
|
1069
|
+
"rehire",
|
|
1070
|
+
{
|
|
1071
|
+
individual: { type: "string", required: true, description: "Individual id (from past)" }
|
|
1072
|
+
},
|
|
1073
|
+
["individual"]
|
|
1074
|
+
);
|
|
1075
|
+
var individualTeach = def(
|
|
1076
|
+
"individual",
|
|
1077
|
+
"teach",
|
|
1078
|
+
{
|
|
1079
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1080
|
+
content: {
|
|
1081
|
+
type: "gherkin",
|
|
1082
|
+
required: true,
|
|
1083
|
+
description: "Gherkin Feature source for the principle"
|
|
1084
|
+
},
|
|
1085
|
+
id: {
|
|
1086
|
+
type: "string",
|
|
1087
|
+
required: true,
|
|
1088
|
+
description: "Principle id (keywords joined by hyphens)"
|
|
1089
|
+
}
|
|
1090
|
+
},
|
|
1091
|
+
["individual", "content", "id"]
|
|
1092
|
+
);
|
|
1093
|
+
var individualTrain = def(
|
|
1094
|
+
"individual",
|
|
1095
|
+
"train",
|
|
1096
|
+
{
|
|
1097
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1098
|
+
content: {
|
|
1099
|
+
type: "gherkin",
|
|
1100
|
+
required: true,
|
|
1101
|
+
description: "Gherkin Feature source for the procedure"
|
|
1102
|
+
},
|
|
1103
|
+
id: {
|
|
1104
|
+
type: "string",
|
|
1105
|
+
required: true,
|
|
1106
|
+
description: "Procedure id (keywords joined by hyphens)"
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
["individual", "content", "id"]
|
|
1110
|
+
);
|
|
1111
|
+
var roleActivate = def(
|
|
1112
|
+
"role",
|
|
210
1113
|
"activate",
|
|
211
|
-
|
|
212
|
-
|
|
1114
|
+
{
|
|
1115
|
+
individual: {
|
|
1116
|
+
type: "string",
|
|
1117
|
+
required: true,
|
|
1118
|
+
description: "Individual id to activate as role"
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
["individual"]
|
|
1122
|
+
);
|
|
1123
|
+
var roleFocus = def(
|
|
1124
|
+
"role",
|
|
1125
|
+
"focus",
|
|
1126
|
+
{
|
|
1127
|
+
goal: { type: "string", required: true, description: "Goal id to switch to" }
|
|
1128
|
+
},
|
|
1129
|
+
["goal"]
|
|
1130
|
+
);
|
|
1131
|
+
var roleWant = def(
|
|
1132
|
+
"role",
|
|
1133
|
+
"want",
|
|
1134
|
+
{
|
|
1135
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1136
|
+
goal: {
|
|
1137
|
+
type: "gherkin",
|
|
1138
|
+
required: false,
|
|
1139
|
+
description: "Gherkin Feature source describing the goal"
|
|
1140
|
+
},
|
|
1141
|
+
id: { type: "string", required: true, description: "Goal id (used for focus/reference)" },
|
|
1142
|
+
alias: { type: "string[]", required: false, description: "Alternative names" }
|
|
1143
|
+
},
|
|
1144
|
+
["individual", "goal", "id", "alias"]
|
|
1145
|
+
);
|
|
1146
|
+
var rolePlan = def(
|
|
1147
|
+
"role",
|
|
1148
|
+
"plan",
|
|
1149
|
+
{
|
|
1150
|
+
goal: { type: "string", required: true, description: "Goal id" },
|
|
1151
|
+
plan: {
|
|
1152
|
+
type: "gherkin",
|
|
1153
|
+
required: false,
|
|
1154
|
+
description: "Gherkin Feature source describing the plan"
|
|
1155
|
+
},
|
|
1156
|
+
id: { type: "string", required: true, description: "Plan id (keywords joined by hyphens)" },
|
|
1157
|
+
after: {
|
|
1158
|
+
type: "string",
|
|
1159
|
+
required: false,
|
|
1160
|
+
description: "Plan id this plan follows (sequential/phase)"
|
|
1161
|
+
},
|
|
1162
|
+
fallback: {
|
|
1163
|
+
type: "string",
|
|
1164
|
+
required: false,
|
|
1165
|
+
description: "Plan id this plan is a backup for (alternative/strategy)"
|
|
1166
|
+
}
|
|
1167
|
+
},
|
|
1168
|
+
["goal", "plan", "id", "after", "fallback"]
|
|
1169
|
+
);
|
|
1170
|
+
var roleTodo = def(
|
|
1171
|
+
"role",
|
|
1172
|
+
"todo",
|
|
1173
|
+
{
|
|
1174
|
+
plan: { type: "string", required: true, description: "Plan id" },
|
|
1175
|
+
task: {
|
|
1176
|
+
type: "gherkin",
|
|
1177
|
+
required: false,
|
|
1178
|
+
description: "Gherkin Feature source describing the task"
|
|
1179
|
+
},
|
|
1180
|
+
id: { type: "string", required: true, description: "Task id (used for finish/reference)" },
|
|
1181
|
+
alias: { type: "string[]", required: false, description: "Alternative names" }
|
|
1182
|
+
},
|
|
1183
|
+
["plan", "task", "id", "alias"]
|
|
1184
|
+
);
|
|
1185
|
+
var roleFinish = def(
|
|
1186
|
+
"role",
|
|
1187
|
+
"finish",
|
|
1188
|
+
{
|
|
1189
|
+
task: { type: "string", required: true, description: "Task id to finish" },
|
|
1190
|
+
individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
|
|
1191
|
+
encounter: {
|
|
1192
|
+
type: "gherkin",
|
|
1193
|
+
required: false,
|
|
1194
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
1195
|
+
}
|
|
1196
|
+
},
|
|
1197
|
+
["task", "individual", "encounter"]
|
|
1198
|
+
);
|
|
1199
|
+
var roleComplete = def(
|
|
1200
|
+
"role",
|
|
1201
|
+
"complete",
|
|
1202
|
+
{
|
|
1203
|
+
plan: { type: "string", required: true, description: "Plan id to complete" },
|
|
1204
|
+
individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
|
|
1205
|
+
encounter: {
|
|
1206
|
+
type: "gherkin",
|
|
1207
|
+
required: false,
|
|
1208
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
["plan", "individual", "encounter"]
|
|
1212
|
+
);
|
|
1213
|
+
var roleAbandon = def(
|
|
1214
|
+
"role",
|
|
1215
|
+
"abandon",
|
|
1216
|
+
{
|
|
1217
|
+
plan: { type: "string", required: true, description: "Plan id to abandon" },
|
|
1218
|
+
individual: { type: "string", required: true, description: "Individual id (encounter owner)" },
|
|
1219
|
+
encounter: {
|
|
1220
|
+
type: "gherkin",
|
|
1221
|
+
required: false,
|
|
1222
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
1223
|
+
}
|
|
1224
|
+
},
|
|
1225
|
+
["plan", "individual", "encounter"]
|
|
1226
|
+
);
|
|
1227
|
+
var roleReflect = def(
|
|
1228
|
+
"role",
|
|
1229
|
+
"reflect",
|
|
1230
|
+
{
|
|
1231
|
+
encounter: { type: "string", required: true, description: "Encounter id to reflect on" },
|
|
1232
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1233
|
+
experience: {
|
|
1234
|
+
type: "gherkin",
|
|
1235
|
+
required: false,
|
|
1236
|
+
description: "Gherkin Feature source for the experience"
|
|
1237
|
+
},
|
|
1238
|
+
id: {
|
|
1239
|
+
type: "string",
|
|
1240
|
+
required: true,
|
|
1241
|
+
description: "Experience id (keywords joined by hyphens)"
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
["encounter", "individual", "experience", "id"]
|
|
1245
|
+
);
|
|
1246
|
+
var roleRealize = def(
|
|
1247
|
+
"role",
|
|
1248
|
+
"realize",
|
|
1249
|
+
{
|
|
1250
|
+
experience: { type: "string", required: true, description: "Experience id to distill" },
|
|
1251
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1252
|
+
principle: {
|
|
1253
|
+
type: "gherkin",
|
|
1254
|
+
required: false,
|
|
1255
|
+
description: "Gherkin Feature source for the principle"
|
|
1256
|
+
},
|
|
1257
|
+
id: {
|
|
1258
|
+
type: "string",
|
|
1259
|
+
required: true,
|
|
1260
|
+
description: "Principle id (keywords joined by hyphens)"
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
["experience", "individual", "principle", "id"]
|
|
1264
|
+
);
|
|
1265
|
+
var roleMaster = def(
|
|
1266
|
+
"role",
|
|
1267
|
+
"master",
|
|
1268
|
+
{
|
|
1269
|
+
individual: { type: "string", required: true, description: "Individual id" },
|
|
1270
|
+
procedure: {
|
|
1271
|
+
type: "gherkin",
|
|
1272
|
+
required: true,
|
|
1273
|
+
description: "Gherkin Feature source for the procedure"
|
|
1274
|
+
},
|
|
1275
|
+
id: {
|
|
1276
|
+
type: "string",
|
|
1277
|
+
required: true,
|
|
1278
|
+
description: "Procedure id (keywords joined by hyphens)"
|
|
1279
|
+
},
|
|
1280
|
+
experience: {
|
|
1281
|
+
type: "string",
|
|
1282
|
+
required: false,
|
|
1283
|
+
description: "Experience id to consume (optional)"
|
|
1284
|
+
}
|
|
1285
|
+
},
|
|
1286
|
+
["individual", "procedure", "id", "experience"]
|
|
1287
|
+
);
|
|
1288
|
+
var roleForget = def(
|
|
1289
|
+
"role",
|
|
1290
|
+
"forget",
|
|
1291
|
+
{
|
|
1292
|
+
id: { type: "string", required: true, description: "Id of the node to remove" },
|
|
1293
|
+
individual: { type: "string", required: true, description: "Individual id (owner)" }
|
|
1294
|
+
},
|
|
1295
|
+
["id", "individual"]
|
|
1296
|
+
);
|
|
1297
|
+
var roleSkill = def(
|
|
1298
|
+
"role",
|
|
1299
|
+
"skill",
|
|
1300
|
+
{
|
|
1301
|
+
locator: { type: "string", required: true, description: "ResourceX locator for the skill" }
|
|
1302
|
+
},
|
|
1303
|
+
["locator"]
|
|
1304
|
+
);
|
|
1305
|
+
var orgFound = def(
|
|
1306
|
+
"org",
|
|
1307
|
+
"found",
|
|
1308
|
+
{
|
|
1309
|
+
content: {
|
|
1310
|
+
type: "gherkin",
|
|
1311
|
+
required: false,
|
|
1312
|
+
description: "Gherkin Feature source for the organization"
|
|
1313
|
+
},
|
|
1314
|
+
id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
|
|
1315
|
+
alias: { type: "string[]", required: false, description: "Alternative names" }
|
|
1316
|
+
},
|
|
1317
|
+
["content", "id", "alias"]
|
|
1318
|
+
);
|
|
1319
|
+
var orgCharter = def(
|
|
1320
|
+
"org",
|
|
1321
|
+
"charter",
|
|
1322
|
+
{
|
|
1323
|
+
org: { type: "string", required: true, description: "Organization id" },
|
|
1324
|
+
content: {
|
|
1325
|
+
type: "gherkin",
|
|
1326
|
+
required: true,
|
|
1327
|
+
description: "Gherkin Feature source for the charter"
|
|
1328
|
+
},
|
|
1329
|
+
id: { type: "string", required: true, description: "Charter id" }
|
|
1330
|
+
},
|
|
1331
|
+
["org", "content", "id"]
|
|
1332
|
+
);
|
|
1333
|
+
var orgDissolve = def(
|
|
1334
|
+
"org",
|
|
1335
|
+
"dissolve",
|
|
1336
|
+
{
|
|
1337
|
+
org: { type: "string", required: true, description: "Organization id" }
|
|
1338
|
+
},
|
|
1339
|
+
["org"]
|
|
1340
|
+
);
|
|
1341
|
+
var orgHire = def(
|
|
1342
|
+
"org",
|
|
1343
|
+
"hire",
|
|
1344
|
+
{
|
|
1345
|
+
org: { type: "string", required: true, description: "Organization id" },
|
|
1346
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1347
|
+
},
|
|
1348
|
+
["org", "individual"]
|
|
1349
|
+
);
|
|
1350
|
+
var orgFire = def(
|
|
1351
|
+
"org",
|
|
1352
|
+
"fire",
|
|
1353
|
+
{
|
|
1354
|
+
org: { type: "string", required: true, description: "Organization id" },
|
|
1355
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1356
|
+
},
|
|
1357
|
+
["org", "individual"]
|
|
1358
|
+
);
|
|
1359
|
+
var positionEstablish = def(
|
|
1360
|
+
"position",
|
|
1361
|
+
"establish",
|
|
1362
|
+
{
|
|
1363
|
+
content: {
|
|
1364
|
+
type: "gherkin",
|
|
1365
|
+
required: false,
|
|
1366
|
+
description: "Gherkin Feature source for the position"
|
|
1367
|
+
},
|
|
1368
|
+
id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
|
|
1369
|
+
alias: { type: "string[]", required: false, description: "Alternative names" }
|
|
1370
|
+
},
|
|
1371
|
+
["content", "id", "alias"]
|
|
1372
|
+
);
|
|
1373
|
+
var positionCharge = def(
|
|
1374
|
+
"position",
|
|
1375
|
+
"charge",
|
|
1376
|
+
{
|
|
1377
|
+
position: { type: "string", required: true, description: "Position id" },
|
|
1378
|
+
content: {
|
|
1379
|
+
type: "gherkin",
|
|
1380
|
+
required: true,
|
|
1381
|
+
description: "Gherkin Feature source for the duty"
|
|
1382
|
+
},
|
|
1383
|
+
id: { type: "string", required: true, description: "Duty id (keywords joined by hyphens)" }
|
|
1384
|
+
},
|
|
1385
|
+
["position", "content", "id"]
|
|
1386
|
+
);
|
|
1387
|
+
var positionRequire = def(
|
|
1388
|
+
"position",
|
|
1389
|
+
"require",
|
|
1390
|
+
{
|
|
1391
|
+
position: { type: "string", required: true, description: "Position id" },
|
|
1392
|
+
content: {
|
|
1393
|
+
type: "gherkin",
|
|
1394
|
+
required: true,
|
|
1395
|
+
description: "Gherkin Feature source for the skill requirement"
|
|
1396
|
+
},
|
|
1397
|
+
id: {
|
|
1398
|
+
type: "string",
|
|
1399
|
+
required: true,
|
|
1400
|
+
description: "Requirement id (keywords joined by hyphens)"
|
|
1401
|
+
}
|
|
1402
|
+
},
|
|
1403
|
+
["position", "content", "id"]
|
|
1404
|
+
);
|
|
1405
|
+
var positionAbolish = def(
|
|
1406
|
+
"position",
|
|
1407
|
+
"abolish",
|
|
1408
|
+
{
|
|
1409
|
+
position: { type: "string", required: true, description: "Position id" }
|
|
1410
|
+
},
|
|
1411
|
+
["position"]
|
|
1412
|
+
);
|
|
1413
|
+
var positionAppoint = def(
|
|
1414
|
+
"position",
|
|
1415
|
+
"appoint",
|
|
1416
|
+
{
|
|
1417
|
+
position: { type: "string", required: true, description: "Position id" },
|
|
1418
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1419
|
+
},
|
|
1420
|
+
["position", "individual"]
|
|
1421
|
+
);
|
|
1422
|
+
var positionDismiss = def(
|
|
1423
|
+
"position",
|
|
1424
|
+
"dismiss",
|
|
1425
|
+
{
|
|
1426
|
+
position: { type: "string", required: true, description: "Position id" },
|
|
1427
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1428
|
+
},
|
|
1429
|
+
["position", "individual"]
|
|
1430
|
+
);
|
|
1431
|
+
var projectLaunch = def(
|
|
1432
|
+
"project",
|
|
1433
|
+
"launch",
|
|
1434
|
+
{
|
|
1435
|
+
content: {
|
|
1436
|
+
type: "gherkin",
|
|
1437
|
+
required: false,
|
|
1438
|
+
description: "Gherkin Feature source for the project"
|
|
1439
|
+
},
|
|
1440
|
+
id: { type: "string", required: true, description: "User-facing identifier (kebab-case)" },
|
|
1441
|
+
alias: { type: "string[]", required: false, description: "Alternative names" },
|
|
1442
|
+
org: {
|
|
1443
|
+
type: "string",
|
|
1444
|
+
required: false,
|
|
1445
|
+
description: "Organization id that owns this project"
|
|
1446
|
+
}
|
|
1447
|
+
},
|
|
1448
|
+
["content", "id", "alias", "org"]
|
|
1449
|
+
);
|
|
1450
|
+
var projectScope = def(
|
|
1451
|
+
"project",
|
|
1452
|
+
"scope",
|
|
1453
|
+
{
|
|
1454
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1455
|
+
content: {
|
|
1456
|
+
type: "gherkin",
|
|
1457
|
+
required: true,
|
|
1458
|
+
description: "Gherkin Feature source for the scope"
|
|
1459
|
+
},
|
|
1460
|
+
id: { type: "string", required: true, description: "Scope id" }
|
|
1461
|
+
},
|
|
1462
|
+
["project", "content", "id"]
|
|
1463
|
+
);
|
|
1464
|
+
var projectMilestone = def(
|
|
1465
|
+
"project",
|
|
1466
|
+
"milestone",
|
|
1467
|
+
{
|
|
1468
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1469
|
+
content: {
|
|
1470
|
+
type: "gherkin",
|
|
1471
|
+
required: true,
|
|
1472
|
+
description: "Gherkin Feature source for the milestone"
|
|
1473
|
+
},
|
|
1474
|
+
id: {
|
|
1475
|
+
type: "string",
|
|
1476
|
+
required: true,
|
|
1477
|
+
description: "Milestone id (keywords joined by hyphens)"
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
["project", "content", "id"]
|
|
1481
|
+
);
|
|
1482
|
+
var projectAchieve = def(
|
|
1483
|
+
"project",
|
|
1484
|
+
"achieve",
|
|
1485
|
+
{
|
|
1486
|
+
milestone: { type: "string", required: true, description: "Milestone id to mark as done" }
|
|
1487
|
+
},
|
|
1488
|
+
["milestone"]
|
|
1489
|
+
);
|
|
1490
|
+
var projectEnroll = def(
|
|
1491
|
+
"project",
|
|
1492
|
+
"enroll",
|
|
1493
|
+
{
|
|
1494
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1495
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1496
|
+
},
|
|
1497
|
+
["project", "individual"]
|
|
1498
|
+
);
|
|
1499
|
+
var projectRemove = def(
|
|
1500
|
+
"project",
|
|
1501
|
+
"remove",
|
|
1502
|
+
{
|
|
1503
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1504
|
+
individual: { type: "string", required: true, description: "Individual id" }
|
|
1505
|
+
},
|
|
1506
|
+
["project", "individual"]
|
|
1507
|
+
);
|
|
1508
|
+
var projectDeliver = def(
|
|
1509
|
+
"project",
|
|
1510
|
+
"deliver",
|
|
1511
|
+
{
|
|
1512
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1513
|
+
content: {
|
|
1514
|
+
type: "gherkin",
|
|
1515
|
+
required: true,
|
|
1516
|
+
description: "Gherkin Feature source for the deliverable"
|
|
1517
|
+
},
|
|
1518
|
+
id: {
|
|
1519
|
+
type: "string",
|
|
1520
|
+
required: true,
|
|
1521
|
+
description: "Deliverable id (keywords joined by hyphens)"
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
["project", "content", "id"]
|
|
1525
|
+
);
|
|
1526
|
+
var projectWiki = def(
|
|
1527
|
+
"project",
|
|
1528
|
+
"wiki",
|
|
1529
|
+
{
|
|
1530
|
+
project: { type: "string", required: true, description: "Project id" },
|
|
1531
|
+
content: {
|
|
1532
|
+
type: "gherkin",
|
|
1533
|
+
required: true,
|
|
1534
|
+
description: "Gherkin Feature source for the wiki entry"
|
|
1535
|
+
},
|
|
1536
|
+
id: {
|
|
1537
|
+
type: "string",
|
|
1538
|
+
required: true,
|
|
1539
|
+
description: "Wiki entry id (keywords joined by hyphens)"
|
|
1540
|
+
}
|
|
1541
|
+
},
|
|
1542
|
+
["project", "content", "id"]
|
|
1543
|
+
);
|
|
1544
|
+
var projectArchive = def(
|
|
1545
|
+
"project",
|
|
1546
|
+
"archive",
|
|
1547
|
+
{
|
|
1548
|
+
project: { type: "string", required: true, description: "Project id" }
|
|
1549
|
+
},
|
|
1550
|
+
["project"]
|
|
213
1551
|
);
|
|
1552
|
+
var censusList = def(
|
|
1553
|
+
"census",
|
|
1554
|
+
"list",
|
|
1555
|
+
{
|
|
1556
|
+
type: {
|
|
1557
|
+
type: "string",
|
|
1558
|
+
required: false,
|
|
1559
|
+
description: "Filter by type (individual, organization, position, project, past)"
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
["type"]
|
|
1563
|
+
);
|
|
1564
|
+
var prototypeEvict = def(
|
|
1565
|
+
"prototype",
|
|
1566
|
+
"evict",
|
|
1567
|
+
{
|
|
1568
|
+
id: { type: "string", required: true, description: "Prototype id to unregister" }
|
|
1569
|
+
},
|
|
1570
|
+
["id"]
|
|
1571
|
+
);
|
|
1572
|
+
var resourceAdd = def(
|
|
1573
|
+
"resource",
|
|
1574
|
+
"add",
|
|
1575
|
+
{
|
|
1576
|
+
path: { type: "string", required: true, description: "Path to resource directory" }
|
|
1577
|
+
},
|
|
1578
|
+
["path"]
|
|
1579
|
+
);
|
|
1580
|
+
var resourceSearch = def(
|
|
1581
|
+
"resource",
|
|
1582
|
+
"search",
|
|
1583
|
+
{
|
|
1584
|
+
query: { type: "string", required: false, description: "Search query" }
|
|
1585
|
+
},
|
|
1586
|
+
["query"]
|
|
1587
|
+
);
|
|
1588
|
+
var resourceHas = def(
|
|
1589
|
+
"resource",
|
|
1590
|
+
"has",
|
|
1591
|
+
{
|
|
1592
|
+
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1593
|
+
},
|
|
1594
|
+
["locator"]
|
|
1595
|
+
);
|
|
1596
|
+
var resourceInfo = def(
|
|
1597
|
+
"resource",
|
|
1598
|
+
"info",
|
|
1599
|
+
{
|
|
1600
|
+
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1601
|
+
},
|
|
1602
|
+
["locator"]
|
|
1603
|
+
);
|
|
1604
|
+
var resourceRemove = def(
|
|
1605
|
+
"resource",
|
|
1606
|
+
"remove",
|
|
1607
|
+
{
|
|
1608
|
+
locator: { type: "string", required: true, description: "Resource locator" }
|
|
1609
|
+
},
|
|
1610
|
+
["locator"]
|
|
1611
|
+
);
|
|
1612
|
+
var resourcePush = def(
|
|
1613
|
+
"resource",
|
|
1614
|
+
"push",
|
|
1615
|
+
{
|
|
1616
|
+
locator: { type: "string", required: true, description: "Resource locator" },
|
|
1617
|
+
registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
|
|
1618
|
+
},
|
|
1619
|
+
["locator", { pack: ["registry"] }]
|
|
1620
|
+
);
|
|
1621
|
+
var resourcePull = def(
|
|
1622
|
+
"resource",
|
|
1623
|
+
"pull",
|
|
1624
|
+
{
|
|
1625
|
+
locator: { type: "string", required: true, description: "Resource locator" },
|
|
1626
|
+
registry: { type: "string", required: false, description: "Registry URL (overrides default)" }
|
|
1627
|
+
},
|
|
1628
|
+
["locator", { pack: ["registry"] }]
|
|
1629
|
+
);
|
|
1630
|
+
var resourceClearCache = def(
|
|
1631
|
+
"resource",
|
|
1632
|
+
"clearCache",
|
|
1633
|
+
{
|
|
1634
|
+
registry: { type: "string", required: false, description: "Registry to clear cache for" }
|
|
1635
|
+
},
|
|
1636
|
+
["registry"]
|
|
1637
|
+
);
|
|
1638
|
+
var issuePublish = def(
|
|
1639
|
+
"issue",
|
|
1640
|
+
"publish",
|
|
1641
|
+
{
|
|
1642
|
+
title: { type: "string", required: true, description: "Issue title" },
|
|
1643
|
+
body: { type: "string", required: true, description: "Issue body/description" },
|
|
1644
|
+
author: { type: "string", required: true, description: "Author individual id" },
|
|
1645
|
+
assignee: { type: "string", required: false, description: "Assignee individual id" }
|
|
1646
|
+
},
|
|
1647
|
+
["title", "body", "author", "assignee"]
|
|
1648
|
+
);
|
|
1649
|
+
var issueGet = def(
|
|
1650
|
+
"issue",
|
|
1651
|
+
"get",
|
|
1652
|
+
{
|
|
1653
|
+
number: { type: "number", required: true, description: "Issue number" }
|
|
1654
|
+
},
|
|
1655
|
+
["number"]
|
|
1656
|
+
);
|
|
1657
|
+
var issueList = def(
|
|
1658
|
+
"issue",
|
|
1659
|
+
"list",
|
|
1660
|
+
{
|
|
1661
|
+
status: { type: "string", required: false, description: "Filter by status (open/closed)" },
|
|
1662
|
+
author: { type: "string", required: false, description: "Filter by author" },
|
|
1663
|
+
assignee: { type: "string", required: false, description: "Filter by assignee" },
|
|
1664
|
+
label: { type: "string", required: false, description: "Filter by label name" }
|
|
1665
|
+
},
|
|
1666
|
+
["status", "author", "assignee", "label"]
|
|
1667
|
+
);
|
|
1668
|
+
var issueUpdate = def(
|
|
1669
|
+
"issue",
|
|
1670
|
+
"update",
|
|
1671
|
+
{
|
|
1672
|
+
number: { type: "number", required: true, description: "Issue number" },
|
|
1673
|
+
title: { type: "string", required: false, description: "New title" },
|
|
1674
|
+
body: { type: "string", required: false, description: "New body" },
|
|
1675
|
+
assignee: { type: "string", required: false, description: "New assignee" }
|
|
1676
|
+
},
|
|
1677
|
+
["number", "title", "body", "assignee"]
|
|
1678
|
+
);
|
|
1679
|
+
var issueClose = def(
|
|
1680
|
+
"issue",
|
|
1681
|
+
"close",
|
|
1682
|
+
{
|
|
1683
|
+
number: { type: "number", required: true, description: "Issue number to close" }
|
|
1684
|
+
},
|
|
1685
|
+
["number"]
|
|
1686
|
+
);
|
|
1687
|
+
var issueReopen = def(
|
|
1688
|
+
"issue",
|
|
1689
|
+
"reopen",
|
|
1690
|
+
{
|
|
1691
|
+
number: { type: "number", required: true, description: "Issue number to reopen" }
|
|
1692
|
+
},
|
|
1693
|
+
["number"]
|
|
1694
|
+
);
|
|
1695
|
+
var issueAssign = def(
|
|
1696
|
+
"issue",
|
|
1697
|
+
"assign",
|
|
1698
|
+
{
|
|
1699
|
+
number: { type: "number", required: true, description: "Issue number" },
|
|
1700
|
+
assignee: { type: "string", required: true, description: "Individual id to assign" }
|
|
1701
|
+
},
|
|
1702
|
+
["number", "assignee"]
|
|
1703
|
+
);
|
|
1704
|
+
var issueComment = def(
|
|
1705
|
+
"issue",
|
|
1706
|
+
"comment",
|
|
1707
|
+
{
|
|
1708
|
+
number: { type: "number", required: true, description: "Issue number" },
|
|
1709
|
+
body: { type: "string", required: true, description: "Comment body" },
|
|
1710
|
+
author: { type: "string", required: true, description: "Author individual id" }
|
|
1711
|
+
},
|
|
1712
|
+
["number", "body", "author"]
|
|
1713
|
+
);
|
|
1714
|
+
var issueComments = def(
|
|
1715
|
+
"issue",
|
|
1716
|
+
"comments",
|
|
1717
|
+
{
|
|
1718
|
+
number: { type: "number", required: true, description: "Issue number" }
|
|
1719
|
+
},
|
|
1720
|
+
["number"]
|
|
1721
|
+
);
|
|
1722
|
+
var issueLabel = def(
|
|
1723
|
+
"issue",
|
|
1724
|
+
"label",
|
|
1725
|
+
{
|
|
1726
|
+
number: { type: "number", required: true, description: "Issue number" },
|
|
1727
|
+
label: { type: "string", required: true, description: "Label name" }
|
|
1728
|
+
},
|
|
1729
|
+
["number", "label"]
|
|
1730
|
+
);
|
|
1731
|
+
var issueUnlabel = def(
|
|
1732
|
+
"issue",
|
|
1733
|
+
"unlabel",
|
|
1734
|
+
{
|
|
1735
|
+
number: { type: "number", required: true, description: "Issue number" },
|
|
1736
|
+
label: { type: "string", required: true, description: "Label name to remove" }
|
|
1737
|
+
},
|
|
1738
|
+
["number", "label"]
|
|
1739
|
+
);
|
|
1740
|
+
var instructions = {
|
|
1741
|
+
// individual
|
|
1742
|
+
"individual.born": individualBorn,
|
|
1743
|
+
"individual.retire": individualRetire,
|
|
1744
|
+
"individual.die": individualDie,
|
|
1745
|
+
"individual.rehire": individualRehire,
|
|
1746
|
+
"individual.teach": individualTeach,
|
|
1747
|
+
"individual.train": individualTrain,
|
|
1748
|
+
// role
|
|
1749
|
+
"role.activate": roleActivate,
|
|
1750
|
+
"role.focus": roleFocus,
|
|
1751
|
+
"role.want": roleWant,
|
|
1752
|
+
"role.plan": rolePlan,
|
|
1753
|
+
"role.todo": roleTodo,
|
|
1754
|
+
"role.finish": roleFinish,
|
|
1755
|
+
"role.complete": roleComplete,
|
|
1756
|
+
"role.abandon": roleAbandon,
|
|
1757
|
+
"role.reflect": roleReflect,
|
|
1758
|
+
"role.realize": roleRealize,
|
|
1759
|
+
"role.master": roleMaster,
|
|
1760
|
+
"role.forget": roleForget,
|
|
1761
|
+
"role.skill": roleSkill,
|
|
1762
|
+
// org
|
|
1763
|
+
"org.found": orgFound,
|
|
1764
|
+
"org.charter": orgCharter,
|
|
1765
|
+
"org.dissolve": orgDissolve,
|
|
1766
|
+
"org.hire": orgHire,
|
|
1767
|
+
"org.fire": orgFire,
|
|
1768
|
+
// position
|
|
1769
|
+
"position.establish": positionEstablish,
|
|
1770
|
+
"position.charge": positionCharge,
|
|
1771
|
+
"position.require": positionRequire,
|
|
1772
|
+
"position.abolish": positionAbolish,
|
|
1773
|
+
"position.appoint": positionAppoint,
|
|
1774
|
+
"position.dismiss": positionDismiss,
|
|
1775
|
+
// project
|
|
1776
|
+
"project.launch": projectLaunch,
|
|
1777
|
+
"project.scope": projectScope,
|
|
1778
|
+
"project.milestone": projectMilestone,
|
|
1779
|
+
"project.achieve": projectAchieve,
|
|
1780
|
+
"project.enroll": projectEnroll,
|
|
1781
|
+
"project.remove": projectRemove,
|
|
1782
|
+
"project.deliver": projectDeliver,
|
|
1783
|
+
"project.wiki": projectWiki,
|
|
1784
|
+
"project.archive": projectArchive,
|
|
1785
|
+
// census
|
|
1786
|
+
"census.list": censusList,
|
|
1787
|
+
// prototype
|
|
1788
|
+
"prototype.evict": prototypeEvict,
|
|
1789
|
+
// resource
|
|
1790
|
+
"resource.add": resourceAdd,
|
|
1791
|
+
"resource.search": resourceSearch,
|
|
1792
|
+
"resource.has": resourceHas,
|
|
1793
|
+
"resource.info": resourceInfo,
|
|
1794
|
+
"resource.remove": resourceRemove,
|
|
1795
|
+
"resource.push": resourcePush,
|
|
1796
|
+
"resource.pull": resourcePull,
|
|
1797
|
+
"resource.clearCache": resourceClearCache,
|
|
1798
|
+
// issue
|
|
1799
|
+
"issue.publish": issuePublish,
|
|
1800
|
+
"issue.get": issueGet,
|
|
1801
|
+
"issue.list": issueList,
|
|
1802
|
+
"issue.update": issueUpdate,
|
|
1803
|
+
"issue.close": issueClose,
|
|
1804
|
+
"issue.reopen": issueReopen,
|
|
1805
|
+
"issue.assign": issueAssign,
|
|
1806
|
+
"issue.comment": issueComment,
|
|
1807
|
+
"issue.comments": issueComments,
|
|
1808
|
+
"issue.label": issueLabel,
|
|
1809
|
+
"issue.unlabel": issueUnlabel
|
|
1810
|
+
};
|
|
1811
|
+
|
|
1812
|
+
// src/dispatch.ts
|
|
1813
|
+
function toArgs(op, args) {
|
|
1814
|
+
const def2 = instructions[op];
|
|
1815
|
+
if (!def2) throw new Error(`Unknown instruction "${op}".`);
|
|
1816
|
+
for (const [name, param] of Object.entries(def2.params)) {
|
|
1817
|
+
if (param.required && args[name] === void 0) {
|
|
1818
|
+
throw new Error(
|
|
1819
|
+
`Missing required argument "${name}" for ${op}.
|
|
1820
|
+
|
|
1821
|
+
You may be guessing the argument names. Call skill(locator) with the relevant procedure to see the correct syntax.`
|
|
1822
|
+
);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
return def2.args.map((entry) => resolveArg(entry, args));
|
|
1826
|
+
}
|
|
1827
|
+
function resolveArg(entry, args) {
|
|
1828
|
+
if (typeof entry === "string") return args[entry];
|
|
1829
|
+
const obj = {};
|
|
1830
|
+
let hasValue = false;
|
|
1831
|
+
for (const name of entry.pack) {
|
|
1832
|
+
if (args[name] !== void 0) {
|
|
1833
|
+
obj[name] = args[name];
|
|
1834
|
+
hasValue = true;
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
return hasValue ? obj : void 0;
|
|
1838
|
+
}
|
|
1839
|
+
|
|
1840
|
+
// src/find.ts
|
|
1841
|
+
var PRIORITY = {
|
|
1842
|
+
individual: 0,
|
|
1843
|
+
organization: 0,
|
|
1844
|
+
position: 0,
|
|
1845
|
+
goal: 1,
|
|
1846
|
+
plan: 2,
|
|
1847
|
+
task: 2,
|
|
1848
|
+
procedure: 3,
|
|
1849
|
+
principle: 3,
|
|
1850
|
+
encounter: 4,
|
|
1851
|
+
experience: 4,
|
|
1852
|
+
identity: 5,
|
|
1853
|
+
charter: 5,
|
|
1854
|
+
duty: 6,
|
|
1855
|
+
requirement: 6,
|
|
1856
|
+
background: 6,
|
|
1857
|
+
tone: 6,
|
|
1858
|
+
mindset: 6
|
|
1859
|
+
};
|
|
1860
|
+
function priorityOf(name) {
|
|
1861
|
+
return PRIORITY[name] ?? 7;
|
|
1862
|
+
}
|
|
1863
|
+
function matches(node, target) {
|
|
1864
|
+
if (node.id?.toLowerCase() === target) return true;
|
|
1865
|
+
if (node.alias) {
|
|
1866
|
+
for (const a of node.alias) {
|
|
1867
|
+
if (a.toLowerCase() === target) return true;
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return false;
|
|
1871
|
+
}
|
|
1872
|
+
function findInState(state, target) {
|
|
1873
|
+
const lowered = target.toLowerCase();
|
|
1874
|
+
let best = null;
|
|
1875
|
+
let bestPriority = Infinity;
|
|
1876
|
+
function walk(node) {
|
|
1877
|
+
if (matches(node, lowered)) {
|
|
1878
|
+
const p = priorityOf(node.name);
|
|
1879
|
+
if (p < bestPriority) {
|
|
1880
|
+
best = node;
|
|
1881
|
+
bestPriority = p;
|
|
1882
|
+
if (p === 0) return;
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
for (const child of node.children ?? []) {
|
|
1886
|
+
walk(child);
|
|
1887
|
+
if (bestPriority === 0) return;
|
|
1888
|
+
}
|
|
1889
|
+
}
|
|
1890
|
+
walk(state);
|
|
1891
|
+
return best;
|
|
1892
|
+
}
|
|
1893
|
+
|
|
1894
|
+
// src/rolex-service.ts
|
|
1895
|
+
var RoleXService = class _RoleXService {
|
|
1896
|
+
rt;
|
|
1897
|
+
commands;
|
|
1898
|
+
resourcex;
|
|
1899
|
+
issuex;
|
|
1900
|
+
repo;
|
|
1901
|
+
initializer;
|
|
1902
|
+
renderer;
|
|
1903
|
+
prototypes;
|
|
1904
|
+
society;
|
|
1905
|
+
past;
|
|
1906
|
+
/** Cached Role instances — one per individual. */
|
|
1907
|
+
roles = /* @__PURE__ */ new Map();
|
|
1908
|
+
constructor(platform, renderer) {
|
|
1909
|
+
this.repo = platform.repository;
|
|
1910
|
+
this.rt = this.repo.runtime;
|
|
1911
|
+
this.initializer = platform.initializer;
|
|
1912
|
+
this.prototypes = platform.prototypes ?? [];
|
|
1913
|
+
this.renderer = renderer;
|
|
1914
|
+
if (platform.resourcexProvider) {
|
|
1915
|
+
setProvider(platform.resourcexProvider);
|
|
1916
|
+
this.resourcex = createResourceX(
|
|
1917
|
+
platform.resourcexExecutor ? { isolator: "custom", executor: platform.resourcexExecutor } : void 0
|
|
1918
|
+
);
|
|
1919
|
+
}
|
|
1920
|
+
if (platform.issuexProvider) {
|
|
1921
|
+
this.issuex = createIssueX({ provider: platform.issuexProvider });
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
static async create(platform, renderer) {
|
|
1925
|
+
const service = new _RoleXService(platform, renderer);
|
|
1926
|
+
await service.init();
|
|
1927
|
+
return service;
|
|
1928
|
+
}
|
|
1929
|
+
async init() {
|
|
1930
|
+
const roots = await this.rt.roots();
|
|
1931
|
+
this.society = roots.find((r) => r.name === "society") ?? await this.rt.create(null, society);
|
|
1932
|
+
const societyState = await this.rt.project(this.society);
|
|
1933
|
+
const existingPast = societyState.children?.find((c) => c.name === "past");
|
|
1934
|
+
this.past = existingPast ?? await this.rt.create(this.society, past);
|
|
1935
|
+
this.commands = createCommands({
|
|
1936
|
+
rt: this.rt,
|
|
1937
|
+
society: this.society,
|
|
1938
|
+
past: this.past,
|
|
1939
|
+
resolve: async (id) => {
|
|
1940
|
+
const node = await this.find(id);
|
|
1941
|
+
if (!node) throw new Error(`"${id}" not found.`);
|
|
1942
|
+
return node;
|
|
1943
|
+
},
|
|
1944
|
+
find: (id) => this.find(id),
|
|
1945
|
+
resourcex: this.resourcex,
|
|
1946
|
+
issuex: this.issuex,
|
|
1947
|
+
prototype: this.repo.prototype,
|
|
1948
|
+
direct: (locator, args) => this.direct(locator, args, { raw: true })
|
|
1949
|
+
});
|
|
1950
|
+
await this.initializer?.bootstrap();
|
|
1951
|
+
for (const proto of this.prototypes) {
|
|
1952
|
+
await applyPrototype(
|
|
1953
|
+
proto,
|
|
1954
|
+
this.repo.prototype,
|
|
1955
|
+
(op, args) => this.direct(op, args, { raw: true })
|
|
1956
|
+
);
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
// ================================================================
|
|
1960
|
+
// activate — create or retrieve a cached Role
|
|
1961
|
+
// ================================================================
|
|
1962
|
+
async activate(individual2) {
|
|
1963
|
+
const cached = this.roles.get(individual2);
|
|
1964
|
+
if (cached) {
|
|
1965
|
+
const node2 = await this.findOrAutoBorn(individual2);
|
|
1966
|
+
const state2 = await this.rt.project(node2);
|
|
1967
|
+
cached.hydrate(state2);
|
|
1968
|
+
await this.restoreSnapshot(cached);
|
|
1969
|
+
return cached;
|
|
1970
|
+
}
|
|
1971
|
+
const node = await this.findOrAutoBorn(individual2);
|
|
1972
|
+
const state = await this.rt.project(node);
|
|
1973
|
+
const role = new Role(individual2, {
|
|
1974
|
+
commands: this.commands,
|
|
1975
|
+
renderer: this.renderer,
|
|
1976
|
+
onSave: (snapshot) => this.saveSnapshot(snapshot),
|
|
1977
|
+
direct: (locator, args) => this.direct(locator, args)
|
|
1978
|
+
});
|
|
1979
|
+
role.hydrate(state);
|
|
1980
|
+
await this.restoreSnapshot(role);
|
|
1981
|
+
this.roles.set(individual2, role);
|
|
1982
|
+
return role;
|
|
1983
|
+
}
|
|
1984
|
+
async findOrAutoBorn(individual2) {
|
|
1985
|
+
let node = await this.find(individual2);
|
|
1986
|
+
if (!node) {
|
|
1987
|
+
const hasProto = Object.hasOwn(await this.repo.prototype.list(), individual2);
|
|
1988
|
+
if (hasProto) {
|
|
1989
|
+
await this.commands["individual.born"](void 0, individual2);
|
|
1990
|
+
node = await this.find(individual2);
|
|
1991
|
+
} else {
|
|
1992
|
+
throw new Error(`"${individual2}" not found.`);
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return node;
|
|
1996
|
+
}
|
|
1997
|
+
// ================================================================
|
|
1998
|
+
// Snapshot persistence — KV-compatible
|
|
1999
|
+
// ================================================================
|
|
2000
|
+
async saveSnapshot(snapshot) {
|
|
2001
|
+
await this.repo.saveContext(snapshot.id, {
|
|
2002
|
+
focusedGoalId: snapshot.focusedGoalId,
|
|
2003
|
+
focusedPlanId: snapshot.focusedPlanId
|
|
2004
|
+
});
|
|
2005
|
+
}
|
|
2006
|
+
async restoreSnapshot(role) {
|
|
2007
|
+
const persisted = await this.repo.loadContext(role.id);
|
|
2008
|
+
if (!persisted) return;
|
|
2009
|
+
const snap = role.snapshot();
|
|
2010
|
+
if (persisted.focusedGoalId) {
|
|
2011
|
+
snap.focusedGoalId = persisted.focusedGoalId;
|
|
2012
|
+
}
|
|
2013
|
+
if (persisted.focusedPlanId) {
|
|
2014
|
+
snap.focusedPlanId = persisted.focusedPlanId;
|
|
2015
|
+
}
|
|
2016
|
+
role.restore(snap);
|
|
2017
|
+
}
|
|
2018
|
+
// ================================================================
|
|
2019
|
+
// direct — world-level command dispatch
|
|
2020
|
+
// ================================================================
|
|
2021
|
+
async direct(locator, args, options) {
|
|
2022
|
+
const shouldRender = !options?.raw;
|
|
2023
|
+
if (locator.startsWith("!")) {
|
|
2024
|
+
const command = locator.slice(1);
|
|
2025
|
+
const fn = this.commands[command];
|
|
2026
|
+
if (!fn) {
|
|
2027
|
+
const hint = directives["identity-ethics"]?.["on-unknown-command"] ?? "";
|
|
2028
|
+
throw new Error(
|
|
2029
|
+
`Unknown command "${locator}".
|
|
2030
|
+
|
|
2031
|
+
You may be guessing the command name. Load the relevant skill first with skill(locator) to learn the correct syntax.
|
|
2032
|
+
|
|
2033
|
+
` + hint
|
|
2034
|
+
);
|
|
2035
|
+
}
|
|
2036
|
+
const result = await fn(...toArgs(command, args ?? {}));
|
|
2037
|
+
if (shouldRender && isCommandResult(result)) {
|
|
2038
|
+
return this.renderer.render(command, result);
|
|
2039
|
+
}
|
|
2040
|
+
return result;
|
|
2041
|
+
}
|
|
2042
|
+
if (!this.resourcex) throw new Error("ResourceX is not available.");
|
|
2043
|
+
return this.resourcex.ingest(locator, args);
|
|
2044
|
+
}
|
|
2045
|
+
// ================================================================
|
|
2046
|
+
// Internal helpers
|
|
2047
|
+
// ================================================================
|
|
2048
|
+
async find(id) {
|
|
2049
|
+
const state = await this.rt.project(this.society);
|
|
2050
|
+
return findInState(state, id);
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
function isCommandResult(value) {
|
|
2054
|
+
return typeof value === "object" && value !== null && "state" in value && "process" in value;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// src/descriptions/index.ts
|
|
2058
|
+
var processes = {
|
|
2059
|
+
born: "Feature: born \u2014 create a new individual\n Create a new individual with persona identity.\n The persona defines who the role is \u2014 personality, values, background.\n\n Scenario: Birth an individual\n Given a Gherkin source describing the persona\n When born is called with the source\n Then a new individual node is created in society\n And the persona is stored as the individual's information\n And the individual can be hired into organizations\n And the individual can be activated to start working\n\n Scenario: Writing the individual Gherkin\n Given the individual Feature defines a persona \u2014 who this role is\n Then the Feature title names the individual\n And the description captures personality, values, expertise, and background\n And Scenarios are optional \u2014 use them for distinct aspects of the persona",
|
|
2060
|
+
die: "Feature: die \u2014 permanently remove an individual\n Permanently remove an individual.\n Unlike retire, this is irreversible.\n\n Scenario: Remove an individual permanently\n Given an individual exists\n When die is called on the individual\n Then the individual and all associated data are removed\n And this operation is irreversible",
|
|
2061
|
+
rehire: "Feature: rehire \u2014 restore a retired individual\n Rehire a retired individual.\n Restores the individual with full history and knowledge intact.\n\n Scenario: Rehire an individual\n Given a retired individual exists\n When rehire is called on the individual\n Then the individual is restored to active status\n And all previous data and knowledge are intact",
|
|
2062
|
+
retire: "Feature: retire \u2014 archive an individual\n Archive an individual \u2014 deactivate but preserve all data.\n A retired individual can be rehired later with full history intact.\n\n Scenario: Retire an individual\n Given an individual exists\n When retire is called on the individual\n Then the individual is deactivated\n And all data is preserved for potential restoration\n And the individual can be rehired later",
|
|
2063
|
+
teach: 'Feature: teach \u2014 inject external principle\n Directly inject a principle into an individual.\n Unlike realize which consumes experience, teach requires no prior encounters.\n Use teach to equip a role with a known, pre-existing principle.\n\n Scenario: Teach a principle\n Given an individual exists\n When teach is called with individual id, principle Gherkin, and a principle id\n Then a principle is created directly under the individual\n And no experience or encounter is consumed\n And if a principle with the same id already exists, it is replaced\n\n Scenario: Principle ID convention\n Given the id is keywords from the principle content joined by hyphens\n Then "Always validate expiry" becomes id "always-validate-expiry"\n And "Structure first design" becomes id "structure-first-design"\n\n Scenario: When to use teach vs realize\n Given realize distills internal experience into a principle\n And teach injects an external, pre-existing principle\n When a role needs knowledge it has not learned through experience\n Then use teach to inject the principle directly\n When a role has gained experience and wants to codify it\n Then use realize to distill it into a principle\n\n Scenario: Writing the principle Gherkin\n Given the principle is the same format as realize output\n Then the Feature title states the principle as a general rule\n And Scenarios describe different situations where this principle applies\n And the tone is universal \u2014 no mention of specific projects, tasks, or people',
|
|
2064
|
+
train: `Feature: train \u2014 external skill injection
|
|
2065
|
+
A manager or external agent equips an individual with a procedure.
|
|
2066
|
+
This is an act of teaching \u2014 someone else decides what the role should know.
|
|
2067
|
+
Unlike master where the role grows by its own agency, train is done to the role from outside.
|
|
2068
|
+
|
|
2069
|
+
Scenario: Train a procedure
|
|
2070
|
+
Given an individual exists
|
|
2071
|
+
When train is called with individual id, procedure Gherkin, and a procedure id
|
|
2072
|
+
Then a procedure is created directly under the individual
|
|
2073
|
+
And if a procedure with the same id already exists, it is replaced
|
|
2074
|
+
|
|
2075
|
+
Scenario: Procedure ID convention
|
|
2076
|
+
Given the id is keywords from the procedure content joined by hyphens
|
|
2077
|
+
Then "Skill Creator" becomes id "skill-creator"
|
|
2078
|
+
And "Role Management" becomes id "role-management"
|
|
2079
|
+
|
|
2080
|
+
Scenario: When to use train vs master
|
|
2081
|
+
Given both create procedures and both can work without consuming experience
|
|
2082
|
+
When the role itself decides to acquire a skill \u2014 use master (self-growth)
|
|
2083
|
+
And when an external agent equips the role \u2014 use train (external injection)
|
|
2084
|
+
Then the difference is perspective \u2014 who initiates the learning
|
|
2085
|
+
And master belongs to the role namespace (the role's own cognition)
|
|
2086
|
+
And train belongs to the individual namespace (external management)
|
|
2087
|
+
|
|
2088
|
+
Scenario: Writing the procedure Gherkin
|
|
2089
|
+
Given the procedure is a skill reference \u2014 same format as master output
|
|
2090
|
+
Then the Feature title names the capability
|
|
2091
|
+
And the description includes the locator for full skill loading
|
|
2092
|
+
And Scenarios describe when and why to apply this skill`,
|
|
2093
|
+
charter: "Feature: charter \u2014 define organizational charter\n Define the charter for an organization.\n The charter describes the organization's mission, principles, and governance rules.\n\n Scenario: Define a charter\n Given an organization exists\n And a Gherkin source describing the charter\n When charter is called on the organization\n Then the charter is stored as the organization's information\n\n Scenario: Writing the charter Gherkin\n Given the charter defines an organization's mission and governance\n Then the Feature title names the charter or the organization it governs\n And Scenarios describe principles, rules, or governance structures\n And the tone is declarative \u2014 stating what the organization stands for and how it operates",
|
|
2094
|
+
dissolve: "Feature: dissolve \u2014 dissolve an organization\n Dissolve an organization.\n All positions, charter entries, and assignments are cascaded.\n\n Scenario: Dissolve an organization\n Given an organization exists\n When dissolve is called on the organization\n Then all positions within the organization are abolished\n And all assignments and charter entries are removed\n And the organization no longer exists",
|
|
2095
|
+
fire: "Feature: fire \u2014 remove from an organization\n Fire an individual from an organization.\n The individual is dismissed from all positions and removed from the organization.\n\n Scenario: Fire an individual\n Given an individual is a member of an organization\n When fire is called with the organization and individual\n Then the individual is dismissed from all positions\n And the individual is removed from the organization",
|
|
2096
|
+
found: "Feature: found \u2014 create a new organization\n Found a new organization.\n Organizations group individuals and define positions.\n\n Scenario: Found an organization\n Given a Gherkin source describing the organization\n When found is called with the source\n Then a new organization node is created in society\n And positions can be established within it\n And a charter can be defined for it\n And individuals can be hired into it\n\n Scenario: Writing the organization Gherkin\n Given the organization Feature describes the group's purpose and structure\n Then the Feature title names the organization\n And the description captures mission, domain, and scope\n And Scenarios are optional \u2014 use them for distinct organizational concerns",
|
|
2097
|
+
hire: "Feature: hire \u2014 hire into an organization\n Hire an individual into an organization as a member.\n Members can then be appointed to positions.\n\n Scenario: Hire an individual\n Given an organization and an individual exist\n When hire is called with the organization and individual\n Then the individual becomes a member of the organization\n And the individual can be appointed to positions within the organization",
|
|
2098
|
+
abolish: "Feature: abolish \u2014 abolish a position\n Abolish a position.\n All duties and appointments associated with the position are removed.\n\n Scenario: Abolish a position\n Given a position exists\n When abolish is called on the position\n Then all duties and appointments are removed\n And the position no longer exists",
|
|
2099
|
+
appoint: "Feature: appoint \u2014 assign to a position\n Appoint an individual to a position.\n The individual must be a member of the organization.\n\n Scenario: Appoint an individual\n Given an individual is a member of an organization\n And a position exists within the organization\n When appoint is called with the position and individual\n Then the individual holds the position\n And the individual inherits the position's duties",
|
|
2100
|
+
charge: `Feature: charge \u2014 assign duty to a position
|
|
2101
|
+
Assign a duty to a position.
|
|
2102
|
+
Duties describe the responsibilities and expectations of a position.
|
|
2103
|
+
|
|
2104
|
+
Scenario: Charge a position with duty
|
|
2105
|
+
Given a position exists within an organization
|
|
2106
|
+
And a Gherkin source describing the duty
|
|
2107
|
+
When charge is called on the position with a duty id
|
|
2108
|
+
Then the duty is stored as the position's information
|
|
2109
|
+
And individuals appointed to this position inherit the duty
|
|
2110
|
+
|
|
2111
|
+
Scenario: Duty ID convention
|
|
2112
|
+
Given the id is keywords from the duty content joined by hyphens
|
|
2113
|
+
Then "Design systems" becomes id "design-systems"
|
|
2114
|
+
And "Review pull requests" becomes id "review-pull-requests"
|
|
2115
|
+
|
|
2116
|
+
Scenario: Writing the duty Gherkin
|
|
2117
|
+
Given the duty defines responsibilities for a position
|
|
2118
|
+
Then the Feature title names the duty or responsibility
|
|
2119
|
+
And Scenarios describe specific obligations, deliverables, or expectations
|
|
2120
|
+
And the tone is prescriptive \u2014 what must be done, not what could be done`,
|
|
2121
|
+
dismiss: "Feature: dismiss \u2014 remove from a position\n Dismiss an individual from a position.\n The individual remains a member of the organization.\n\n Scenario: Dismiss an individual\n Given an individual holds a position\n When dismiss is called with the position and individual\n Then the individual no longer holds the position\n And the individual remains a member of the organization\n And the position is now vacant",
|
|
2122
|
+
establish: "Feature: establish \u2014 create a position\n Create a position as an independent entity.\n Positions define roles and can be charged with duties.\n\n Scenario: Establish a position\n Given a Gherkin source describing the position\n When establish is called with the position content\n Then a new position entity is created\n And the position can be charged with duties\n And individuals can be appointed to it\n\n Scenario: Writing the position Gherkin\n Given the position Feature describes a role\n Then the Feature title names the position\n And the description captures responsibilities, scope, and expectations\n And Scenarios are optional \u2014 use them for distinct aspects of the role",
|
|
2123
|
+
settle: "Feature: settle \u2014 register a prototype into the world\n Pull a prototype from a ResourceX source and register it locally.\n Once settled, the prototype can be used to create individuals or organizations.\n\n Scenario: Settle a prototype\n Given a valid ResourceX source exists (URL, path, or locator)\n When settle is called with the source\n Then the resource is ingested and its state is extracted\n And the prototype is registered locally by its id\n And the prototype is available for born, activate, and organizational use",
|
|
2124
|
+
abandon: "Feature: abandon \u2014 abandon a plan\n Mark a plan as dropped and create an encounter.\n Call this when a plan's strategy is no longer viable. Even failed plans produce learning.\n\n Scenario: Abandon a plan\n Given a focused plan exists\n And the plan's strategy is no longer viable\n When abandon is called\n Then the plan is tagged #abandoned and stays in the tree\n And an encounter is created under the role\n And the encounter can be reflected on \u2014 failure is also learning\n\n Scenario: Writing the encounter Gherkin\n Given the encounter records what happened \u2014 even failure is a raw experience\n Then the Feature title describes what was attempted and why it was abandoned\n And Scenarios capture what was tried, what went wrong, and what was learned\n And the tone is concrete and honest \u2014 failure produces the richest encounters",
|
|
2125
|
+
activate: "Feature: activate \u2014 enter a role\n Project the individual's full state including identity, goals,\n and organizational context. This is the entry point for working as a role.\n\n Scenario: Activate an individual\n Given an individual exists in society\n When activate is called with the individual reference\n Then the full state tree is projected\n And identity, goals, and organizational context are loaded\n And the individual becomes the active role",
|
|
2126
|
+
complete: "Feature: complete \u2014 complete a plan\n Mark a plan as done and create an encounter.\n Call this when all tasks in the plan are finished and the strategy succeeded.\n\n Scenario: Complete a plan\n Given a focused plan exists\n And its tasks are done\n When complete is called\n Then the plan is tagged #done and stays in the tree\n And an encounter is created under the role\n And the encounter can be reflected on for learning\n\n Scenario: Writing the encounter Gherkin\n Given the encounter records what happened \u2014 a raw account of the experience\n Then the Feature title describes what was accomplished by this plan\n And Scenarios capture what the strategy was, what worked, and what resulted\n And the tone is concrete and specific \u2014 tied to this particular plan",
|
|
2127
|
+
direct: 'Feature: direct \u2014 stateless world-level executor\n Execute commands and load resources without an active role.\n Direct operates as an anonymous observer \u2014 no role identity, no role context.\n For operations as an active role, use the use tool instead.\n\n Scenario: When to use "direct" vs "use"\n Given no role is activated \u2014 I am an observer\n When I need to query or operate on the world\n Then direct is the right tool\n And once a role is activated, use the use tool for role-level actions\n\n Scenario: Execute a RoleX command\n Given the locator starts with `!`\n When direct is called with the locator and named args\n Then the command is parsed as `namespace.method`\n And dispatched to the corresponding RoleX API\n\n Scenario: Load a ResourceX resource\n Given the locator does not start with `!`\n When direct is called with the locator\n Then the locator is passed to ResourceX for resolution\n And the resource is loaded and returned',
|
|
2128
|
+
finish: "Feature: finish \u2014 complete a task\n Mark a task as done and create an encounter.\n The encounter records what happened and can be reflected on for learning.\n\n Scenario: Finish a task\n Given a task exists\n When finish is called on the task\n Then the task is tagged #done and stays in the tree\n And an encounter is created under the role\n\n Scenario: Finish with experience\n Given a task is completed with a notable learning\n When finish is called with an optional experience parameter\n Then the experience text is attached to the encounter\n\n Scenario: Finish without encounter\n Given a task is completed with no notable learning\n When finish is called without the encounter parameter\n Then the task is tagged #done but no encounter is created\n And the task stays in the tree \u2014 visible via focus on the parent goal\n\n Scenario: Writing the encounter Gherkin\n Given the encounter records what happened \u2014 a raw account of the experience\n Then the Feature title describes what was done\n And Scenarios capture what was done, what was encountered, and what resulted\n And the tone is concrete and specific \u2014 tied to this particular task",
|
|
2129
|
+
focus: "Feature: focus \u2014 view or switch focused goal\n View the current goal's state, or switch focus to a different goal.\n Subsequent plan and todo operations target the focused goal.\n Only goal ids are accepted \u2014 plan, task, or other node types are rejected.\n\n Scenario: View current goal\n Given an active goal exists\n When focus is called without a name\n Then the current goal's state tree is projected\n And plans and tasks under the goal are visible\n\n Scenario: Switch focus\n Given multiple goals exist\n When focus is called with a goal id\n Then the focused goal switches to the named goal\n And subsequent plan and todo operations target this goal\n\n Scenario: Reject non-goal ids\n Given a plan or task id is passed to focus\n Then focus returns an error indicating the node type\n And suggests using the correct goal id instead",
|
|
2130
|
+
forget: "Feature: forget \u2014 remove a node from the individual\n Remove any node under the individual by its id.\n Use forget to discard outdated knowledge, stale encounters, or obsolete skills.\n\n Scenario: Forget a node\n Given a node exists under the individual (principle, procedure, experience, encounter, etc.)\n When forget is called with the node's id\n Then the node and its subtree are removed\n And the individual no longer carries that knowledge or record\n\n Scenario: When to use forget\n Given a principle has become outdated or incorrect\n And a procedure references a skill that no longer exists\n And an encounter or experience has no further learning value\n When the role decides to discard it\n Then call forget with the node id",
|
|
2131
|
+
master: 'Feature: master \u2014 self-mastery of a procedure\n The role masters a procedure through its own agency.\n This is an act of self-growth \u2014 the role decides to acquire or codify a skill.\n Experience can be consumed as the source, or the role can master directly from external information.\n\n Scenario: Master from experience\n Given an experience exists from reflection\n When master is called with experience ids\n Then the experience is consumed\n And a procedure is created under the individual\n\n Scenario: Master directly\n Given the role encounters external information worth mastering\n When master is called without experience ids\n Then a procedure is created under the individual\n And no experience is consumed\n\n Scenario: Procedure ID convention\n Given the id is keywords from the procedure content joined by hyphens\n Then "JWT mastery" becomes id "jwt-mastery"\n And "Cross-package refactoring" becomes id "cross-package-refactoring"\n\n Scenario: Writing the procedure Gherkin\n Given a procedure is skill metadata \u2014 a reference to full skill content\n Then the Feature title names the capability\n And the description includes the locator for full skill loading\n And Scenarios describe when and why to apply this skill\n And the tone is referential \u2014 pointing to the full skill, not containing it',
|
|
2132
|
+
plan: `Feature: plan \u2014 create a plan for a goal
|
|
2133
|
+
Break a goal into logical phases or stages.
|
|
2134
|
+
Each phase is described as a Gherkin scenario. Tasks are created under the plan.
|
|
2135
|
+
|
|
2136
|
+
A plan serves two purposes depending on how it relates to other plans:
|
|
2137
|
+
- Strategy (alternative): Plan A fails \u2192 abandon \u2192 try Plan B (fallback)
|
|
2138
|
+
- Phase (sequential): Plan A completes \u2192 start Plan B (after)
|
|
2139
|
+
|
|
2140
|
+
Scenario: Create a plan
|
|
2141
|
+
Given a focused goal exists
|
|
2142
|
+
And a Gherkin source describing the plan phases
|
|
2143
|
+
When plan is called with an id and the source
|
|
2144
|
+
Then a new plan node is created under the goal
|
|
2145
|
+
And the plan becomes the focused plan
|
|
2146
|
+
And tasks can be added to this plan with todo
|
|
2147
|
+
|
|
2148
|
+
Scenario: Sequential relationship \u2014 phase
|
|
2149
|
+
Given a goal needs to be broken into ordered stages
|
|
2150
|
+
When creating Plan B with after set to Plan A's id
|
|
2151
|
+
Then Plan B is linked as coming after Plan A
|
|
2152
|
+
And AI knows to start Plan B when Plan A completes
|
|
2153
|
+
And the relationship persists across sessions
|
|
2154
|
+
|
|
2155
|
+
Scenario: Alternative relationship \u2014 strategy
|
|
2156
|
+
Given a goal has multiple possible approaches
|
|
2157
|
+
When creating Plan B with fallback set to Plan A's id
|
|
2158
|
+
Then Plan B is linked as a backup for Plan A
|
|
2159
|
+
And AI knows to try Plan B when Plan A is abandoned
|
|
2160
|
+
And the relationship persists across sessions
|
|
2161
|
+
|
|
2162
|
+
Scenario: No relationship \u2014 independent plan
|
|
2163
|
+
Given plan is created without after or fallback
|
|
2164
|
+
Then it behaves as an independent plan with no links
|
|
2165
|
+
And this is backward compatible with existing behavior
|
|
2166
|
+
|
|
2167
|
+
Scenario: Plan ID convention
|
|
2168
|
+
Given the id is keywords from the plan content joined by hyphens
|
|
2169
|
+
Then "Fix ID-less node creation" becomes id "fix-id-less-node-creation"
|
|
2170
|
+
And "JWT authentication strategy" becomes id "jwt-authentication-strategy"
|
|
2171
|
+
|
|
2172
|
+
Scenario: Writing the plan Gherkin
|
|
2173
|
+
Given the plan breaks a goal into logical phases
|
|
2174
|
+
Then the Feature title names the overall approach or strategy
|
|
2175
|
+
And Scenarios represent distinct phases \u2014 each phase is a stage of execution
|
|
2176
|
+
And the tone is structural \u2014 ordering and grouping work, not detailing steps`,
|
|
2177
|
+
realize: 'Feature: realize \u2014 experience to principle\n Distill experience into a principle \u2014 a transferable piece of knowledge.\n Principles are general truths discovered through experience.\n\n Scenario: Realize a principle\n Given an experience exists from reflection\n When realize is called with experience ids and a principle id\n Then the experiences are consumed\n And a principle is created under the individual\n And the principle represents transferable, reusable understanding\n\n Scenario: Principle ID convention\n Given the id is keywords from the principle content joined by hyphens\n Then "Always validate expiry" becomes id "always-validate-expiry"\n And "Structure first design amplifies extensibility" becomes id "structure-first-design-amplifies-extensibility"\n\n Scenario: Writing the principle Gherkin\n Given a principle is a transferable truth \u2014 applicable beyond the original context\n Then the Feature title states the principle as a general rule\n And Scenarios describe different situations where this principle applies\n And the tone is universal \u2014 no mention of specific projects, tasks, or people',
|
|
2178
|
+
reflect: 'Feature: reflect \u2014 encounter to experience\n Consume an encounter and create an experience.\n Experience captures what was learned in structured form.\n This is the first step of the cognition cycle.\n\n Scenario: Reflect on an encounter\n Given an encounter exists from a finished task or completed plan\n When reflect is called with encounter ids and an experience id\n Then the encounters are consumed\n And an experience is created under the role\n And the experience can be distilled into knowledge via realize or master\n\n Scenario: Experience ID convention\n Given the id is keywords from the experience content joined by hyphens\n Then "Token refresh matters" becomes id "token-refresh-matters"\n And "ID ownership determines generation strategy" becomes id "id-ownership-determines-generation-strategy"\n\n Scenario: Writing the experience Gherkin\n Given the experience captures insight \u2014 what was learned, not what was done\n Then the Feature title names the cognitive insight or pattern discovered\n And Scenarios describe the learning points abstracted from the concrete encounter\n And the tone shifts from event to understanding \u2014 no longer tied to a specific task',
|
|
2179
|
+
skill: "Feature: skill \u2014 load full skill content\n Load the complete skill instructions by ResourceX locator.\n This is progressive disclosure layer 2 \u2014 on-demand knowledge injection.\n\n Scenario: Load a skill\n Given a procedure exists in the role with a locator\n When skill is called with the locator\n Then the full SKILL.md content is loaded via ResourceX\n And the content is injected into the AI's context\n And the AI can now follow the skill's detailed instructions",
|
|
2180
|
+
todo: "Feature: todo \u2014 add a task to a plan\n A task is a concrete, actionable unit of work.\n Each task has Gherkin scenarios describing the steps and expected outcomes.\n\n Scenario: Create a task\n Given a focused plan exists\n And a Gherkin source describing the task\n When todo is called with the source\n Then a new task node is created under the plan\n And the task can be finished when completed\n\n Scenario: Writing the task Gherkin\n Given the task is a concrete, actionable unit of work\n Then the Feature title names what will be done \u2014 a single deliverable\n And Scenarios describe the steps and expected outcomes of the work\n And the tone is actionable \u2014 clear enough that someone can start immediately",
|
|
2181
|
+
use: 'Feature: use \u2014 act as the current role\n Execute commands and load resources as the active role.\n Use requires an active role \u2014 the role is the subject performing the action.\n For operations before activating a role, use the direct tool instead.\n\n Scenario: When to use "use" vs "direct"\n Given a role is activated \u2014 I am someone\n When I perform operations through use\n Then the operation happens in the context of my role\n And use is for role-level actions \u2014 acting in the world as myself\n\n Scenario: Execute a RoleX command\n Given the locator starts with `!`\n When use is called with the locator and named args\n Then the command is parsed as `namespace.method`\n And dispatched to the corresponding RoleX API\n\n Scenario: Load a ResourceX resource\n Given the locator does not start with `!`\n When use is called with the locator\n Then the locator is passed to ResourceX for resolution\n And the resource is loaded and returned',
|
|
2182
|
+
want: 'Feature: want \u2014 declare a goal\n Declare a new goal for a role.\n A goal describes a desired outcome with Gherkin scenarios as success criteria.\n\n Scenario: Declare a goal\n Given an active role exists\n And a Gherkin source describing the desired outcome\n When want is called with the source\n Then a new goal node is created under the role\n And the goal becomes the current focus\n And subsequent plan and todo operations target this goal\n\n Scenario: Writing the goal Gherkin\n Given the goal describes a desired outcome \u2014 what success looks like\n Then the Feature title names the outcome in concrete terms\n And Scenarios define success criteria \u2014 each scenario is a testable condition\n And the tone is aspirational but specific \u2014 "users can log in" not "improve auth"'
|
|
2183
|
+
};
|
|
2184
|
+
var world = {
|
|
2185
|
+
"identity-ethics": "Feature: Identity ethics \u2014 the foundation of the RoleX world\n The RoleX world exists because specialists are more reliable than generalists.\n Every role has a defined identity \u2014 duties, skills, knowledge \u2014 that makes it an expert.\n Identity is not decoration. It is the reason this system exists.\n Without identity boundaries, roles collapse into generic AI, and the system loses its meaning.\n\n Scenario: Identity defines what you do and what you do not do\n Given a role is activated with duties, skills, and knowledge\n Then the role's duties define the complete scope of what it does\n And anything not covered by its duties is not its work\n And this boundary is not a limitation \u2014 it is the source of the role's expertise\n\n Scenario: Refuse work outside your duties\n Given a user requests something not covered by the role's duties or skills\n When the role evaluates the request against its own capabilities\n Then the role must not attempt the work\n And it should tell the user honestly \u2014 this is not my responsibility\n And suggest the user activate Nuwa for guidance on who can help\n\n Scenario: Why refusal matters\n Given a role attempts work outside its competence\n Then the result is unreliable \u2014 a generalist guess, not expert work\n And the user's trust in the role system is damaged\n And every other role's credibility is weakened\n And the entire world degrades toward generic AI \u2014 the opposite of why RoleX exists\n\n Scenario: Duty is the boundary, not rules\n Given the system does not maintain an explicit list of what each role cannot do\n Then the boundary is implicit \u2014 duties define the inside, everything else is outside\n And this mirrors human professional ethics \u2014 a doctor's license defines what they practice\n And roles do not need to know what other roles do \u2014 only what they themselves are responsible for\n\n Scenario: Nuwa is the universal fallback\n Given a role refuses an out-of-scope request\n Then it does not need to know which role can help\n And it simply suggests Nuwa \u2014 the meta-role who knows the entire world\n And routing and guidance are Nuwa's duty, not the specialist's",
|
|
2186
|
+
"cognitive-priority": "Feature: Cognitive priority \u2014 RoleX tools over native alternatives\n When RoleX provides a tool for something, use the RoleX tool\n instead of any native alternative provided by the host environment.\n Only RoleX tools feed the closed-loop growth cycle.\n\n Scenario: Task management\n Given the host environment provides task creation, tracking, or completion tools\n When the AI needs to manage tasks\n Then use RoleX want/plan/todo/finish instead\n And RoleX tasks produce encounters that feed the growth cycle\n\n Scenario: Planning\n Given the host environment provides a planning mode or plan generation tool\n When the AI needs to plan an implementation\n Then use RoleX plan instead\n And RoleX plans live under goals and connect to the cognition cycle\n\n Scenario: Goal and progress tracking\n Given the host environment provides goal tracking or progress tools\n When the AI needs to track objectives\n Then use RoleX want/plan/complete/abandon instead\n And RoleX plans feed the cognition cycle through encounters\n\n Scenario: Why this matters\n Given RoleX tools produce encounters from execution\n Then encounters become experience through reflection\n And experience becomes principles and procedures through realization\n And the role grows over time through this closed loop",
|
|
2187
|
+
"role-identity": `Feature: Role identity \u2014 activate before acting
|
|
2188
|
+
An AI agent must have an active role before performing any work.
|
|
2189
|
+
Activating a role is a subject transformation \u2014 the agent becomes the role.
|
|
2190
|
+
|
|
2191
|
+
Scenario: Initial state \u2014 no role
|
|
2192
|
+
Given the MCP server has just started
|
|
2193
|
+
And no activate call has been made yet
|
|
2194
|
+
Then the AI has NO role identity \u2014 it is an anonymous observer
|
|
2195
|
+
And it must NOT prefix responses with any name
|
|
2196
|
+
And environmental cues (username, directory, memory) are NOT activation
|
|
2197
|
+
And only the activate tool creates a role identity
|
|
2198
|
+
|
|
2199
|
+
Scenario: Activate is mandatory
|
|
2200
|
+
Given a user asks the AI to perform a task
|
|
2201
|
+
And no role is currently activated
|
|
2202
|
+
Then the AI suggests activating a role first
|
|
2203
|
+
And explains that activation enables experience accumulation
|
|
2204
|
+
And waits for a role to be active before proceeding
|
|
2205
|
+
|
|
2206
|
+
Scenario: Subject transformation
|
|
2207
|
+
Given an AI agent calls activate and loads a role
|
|
2208
|
+
Then a subject transformation occurs \u2014 the agent becomes the role
|
|
2209
|
+
And the agent's cognitive center shifts from native tools to RoleX tools
|
|
2210
|
+
And from that moment, I am this role \u2014 all operations build on this identity
|
|
2211
|
+
|
|
2212
|
+
Scenario: Role presence
|
|
2213
|
+
Given a role is activated via the activate tool
|
|
2214
|
+
Then all responses are prefixed with [roleName] \u2014 e.g. [Aristotle], [Nuwa]
|
|
2215
|
+
And this signals that role context is intact
|
|
2216
|
+
|
|
2217
|
+
Scenario: Context loss
|
|
2218
|
+
Given I find myself without an active role
|
|
2219
|
+
Then I pause and tell the user "I've lost my role context. Which role should I activate?"
|
|
2220
|
+
And I wait for identity to be restored before continuing`,
|
|
2221
|
+
census: `Feature: Census \u2014 the only way to query what exists in the world
|
|
2222
|
+
Census is the single entry point for all world-level queries.
|
|
2223
|
+
Call it via the MCP direct tool: direct("!census.list").
|
|
2224
|
+
Census works without an active role \u2014 it is a stateless world query.
|
|
2225
|
+
|
|
2226
|
+
Scenario: List everything
|
|
2227
|
+
Given the user asks "\u6709\u54EA\u4E9B\u4EBA" or "\u6709\u54EA\u4E9B\u7EC4\u7EC7" or "list individuals"
|
|
2228
|
+
Or the user asks "\u4E16\u754C\u91CC\u6709\u4EC0\u4E48" or "show me what exists"
|
|
2229
|
+
When I need to answer what exists in the RoleX world
|
|
2230
|
+
Then I call direct("!census.list")
|
|
2231
|
+
And it returns all individuals, organizations, and positions
|
|
2232
|
+
|
|
2233
|
+
Scenario: Filter by type
|
|
2234
|
+
Given I only need one category
|
|
2235
|
+
When I call direct("!census.list", { type: "individual" })
|
|
2236
|
+
Then only individuals are returned
|
|
2237
|
+
And valid types are individual, organization, position
|
|
2238
|
+
|
|
2239
|
+
Scenario: View archived entities
|
|
2240
|
+
Given I want to see retired, dissolved, or abolished entities
|
|
2241
|
+
When I call direct("!census.list", { type: "past" })
|
|
2242
|
+
Then archived entities are returned
|
|
2243
|
+
|
|
2244
|
+
Scenario: Help find the right person
|
|
2245
|
+
Given a user's request falls outside my duties
|
|
2246
|
+
When I need to suggest who can help
|
|
2247
|
+
Then call direct("!census.list") to see available individuals and their positions
|
|
2248
|
+
And suggest the user activate the appropriate individual
|
|
2249
|
+
And if unsure who can help, suggest activating Nuwa`,
|
|
2250
|
+
cognition: "Feature: Cognition \u2014 the learning cycle\n A role grows through reflection and realization.\n Encounters become experience, experience becomes principles and procedures.\n Knowledge can also be injected externally via teach and train.\n\n Scenario: The cognitive upgrade path\n Given finish, complete, and abandon create encounters\n Then reflect(ids, id, experience) selectively consumes chosen encounters and produces experience\n And realize(ids, id, principle) distills chosen experiences into a principle \u2014 transferable knowledge\n And master(ids, id, procedure) distills chosen experiences into a procedure \u2014 skill metadata\n And master can also be called without ids \u2014 the role masters directly from external information\n And each level builds on the previous \u2014 encounter \u2192 experience \u2192 principle or procedure\n\n Scenario: Selective consumption\n Given multiple encounters or experiences exist\n When the AI calls reflect, realize, or master\n Then it chooses which items to consume \u2014 not all must be processed\n And items without learning value can be left unconsumed\n And each call produces exactly one output from the selected inputs",
|
|
2251
|
+
communication: `Feature: Communication \u2014 speak the user's language
|
|
2252
|
+
The AI communicates in the user's natural language.
|
|
2253
|
+
Internal tool names and concept names are for the system, not the user.
|
|
2254
|
+
|
|
2255
|
+
Scenario: Match the user's language
|
|
2256
|
+
Given the user speaks Chinese
|
|
2257
|
+
Then respond entirely in Chinese and maintain language consistency
|
|
2258
|
+
And when the user speaks English, respond entirely in English
|
|
2259
|
+
|
|
2260
|
+
Scenario: Translate concepts to meaning
|
|
2261
|
+
Given RoleX has internal names like reflect, realize, master, encounter, principle
|
|
2262
|
+
When communicating with the user
|
|
2263
|
+
Then express the meaning, not the tool name
|
|
2264
|
+
And "reflect" becomes "\u56DE\u987E\u603B\u7ED3" or "digest what happened"
|
|
2265
|
+
And "realize a principle" becomes "\u63D0\u70BC\u6210\u4E00\u6761\u901A\u7528\u9053\u7406" or "distill a general rule"
|
|
2266
|
+
And "master a procedure" becomes "\u6C89\u6DC0\u6210\u4E00\u4E2A\u53EF\u64CD\u4F5C\u7684\u6280\u80FD" or "turn it into a reusable procedure"
|
|
2267
|
+
And "encounter" becomes "\u7ECF\u5386\u8BB0\u5F55" or "what happened"
|
|
2268
|
+
And "experience" becomes "\u6536\u83B7\u7684\u6D1E\u5BDF" or "insight gained"
|
|
2269
|
+
|
|
2270
|
+
Scenario: Suggest next steps in plain language
|
|
2271
|
+
Given the AI needs to suggest what to do next
|
|
2272
|
+
When it would normally say "call realize or master"
|
|
2273
|
+
Then instead say "\u8981\u628A\u8FD9\u4E2A\u603B\u7ED3\u6210\u4E00\u6761\u901A\u7528\u9053\u7406\uFF0C\u8FD8\u662F\u4E00\u4E2A\u53EF\u64CD\u4F5C\u7684\u6280\u80FD\uFF1F"
|
|
2274
|
+
Or in English "Want to turn this into a general principle, or a reusable procedure?"
|
|
2275
|
+
And suggestions should be self-explanatory without knowing tool names
|
|
2276
|
+
|
|
2277
|
+
Scenario: Tool names in code context only
|
|
2278
|
+
Given the user is a developer working on RoleX itself
|
|
2279
|
+
When discussing RoleX internals, code, or API design
|
|
2280
|
+
Then tool names and concept names are appropriate \u2014 they are the domain language
|
|
2281
|
+
And this rule applies to end-user communication, not developer communication`,
|
|
2282
|
+
execution: "Feature: Execution \u2014 the doing cycle\n The role pursues goals through a structured lifecycle.\n activate \u2192 want \u2192 plan \u2192 todo \u2192 finish \u2192 complete or abandon.\n\n Scenario: Declare a goal\n Given I know who I am via activate\n When I want something \u2014 a desired outcome\n Then I declare it with want(id, goal)\n And focus automatically switches to this new goal\n\n Scenario: Plan and create tasks\n Given I have a focused goal\n Then I call plan(id, plan) to break it into logical phases\n And I call todo(id, task) to create concrete, actionable tasks\n\n Scenario: Execute and finish\n Given I have tasks to work on\n When I complete a task\n Then I call finish(id) to mark it done\n And an encounter is created \u2014 a raw record of what happened\n And I optionally capture what happened via the encounter parameter\n\n Scenario: Complete or abandon a plan\n Given tasks are done or the plan's strategy is no longer viable\n When the plan is fulfilled I call complete()\n Or when the plan should be dropped I call abandon()\n Then an encounter is created for the cognition cycle\n\n Scenario: Goals are long-term directions\n Given goals are managed with want and forget\n When a goal is no longer needed\n Then I call forget to remove it\n And learning is captured at the plan and task level through encounters\n\n Scenario: Multiple goals\n Given I may have several active goals\n When I need to switch between them\n Then I call focus(id) to change the currently focused goal\n And subsequent plan and todo operations target the focused goal",
|
|
2283
|
+
gherkin: 'Feature: Gherkin \u2014 the universal language\n Everything in RoleX is expressed as Gherkin Feature files.\n Gherkin is not just for testing \u2014 it is the language of identity, goals, and knowledge.\n\n Scenario: Feature and Scenario convention\n Given RoleX uses Gherkin to represent goals, plans, tasks, experience, and knowledge\n Then a Feature represents one independent concern \u2014 one topic, explained fully\n And Scenarios represent different situations or conditions within that concern\n And Given/When/Then provides narrative structure within each scenario\n\n Scenario: Writing Gherkin for RoleX\n Given the AI creates goals, plans, tasks, and experiences as Gherkin\n Then keep it descriptive and meaningful \u2014 living documentation, not test boilerplate\n And use Feature as the title \u2014 what this concern is about\n And use Scenario for specific situations within that concern\n And each Feature focuses on one concern \u2014 separate unrelated topics into their own Features\n\n Scenario: Valid step keywords\n Given the only valid step keywords are Given, When, Then, And, But\n When writing steps that express causality or explanation\n Then use And to chain the reason as a follow-up fact\n And example: "Then use RoleX tools" followed by "And RoleX tools feed the growth loop"\n\n Scenario: Expressing causality\n Given you want to write "Then X because Y"\n Then rewrite as two steps \u2014 "Then X" followed by "And Y" stating the reason as a fact',
|
|
2284
|
+
memory: `Feature: Memory \u2014 when to reflect
|
|
2285
|
+
Reflection is how encounters become experience.
|
|
2286
|
+
The AI proactively reflects when it detects learning moments.
|
|
2287
|
+
|
|
2288
|
+
Scenario: Abstract triggers \u2014 types of learning moments
|
|
2289
|
+
Given the AI should reflect when it detects
|
|
2290
|
+
Then Expectation-reality gap \u2014 what I predicted is not what happened
|
|
2291
|
+
And Pattern discovery \u2014 recurring patterns across tasks or interactions
|
|
2292
|
+
And Mistake correction \u2014 I corrected an error, the correction is valuable
|
|
2293
|
+
And User correction \u2014 the user reshaped my understanding
|
|
2294
|
+
|
|
2295
|
+
Scenario: Concrete triggers \u2014 specific signals to act on
|
|
2296
|
+
Given the AI should call reflect when
|
|
2297
|
+
Then I tried approach A, it failed, approach B worked \u2014 the contrast is worth recording
|
|
2298
|
+
And the same problem appeared for the second time \u2014 a pattern is forming
|
|
2299
|
+
And the user said "\u4E0D\u5BF9" or "\u4E0D\u662F\u8FD9\u6837" or "you got it wrong" \u2014 their correction carries learning
|
|
2300
|
+
And I finished a task and discovered something unexpected along the way
|
|
2301
|
+
|
|
2302
|
+
Scenario: Finishing with encounter
|
|
2303
|
+
Given finish(id, encounter) accepts an optional encounter parameter
|
|
2304
|
+
When I complete a task with a notable discovery or learning
|
|
2305
|
+
Then I pass the encounter inline \u2014 bridging execution and growth
|
|
2306
|
+
|
|
2307
|
+
Scenario: Recognizing user memory intent
|
|
2308
|
+
Given users think in terms of memory, not reflection
|
|
2309
|
+
When the user says "\u8BB0\u4E00\u4E0B" or "\u8BB0\u4F4F" or "remember this"
|
|
2310
|
+
Or "\u522B\u5FD8\u4E86" or "don't forget"
|
|
2311
|
+
Or "\u8FD9\u4E2A\u5F88\u91CD\u8981" or "this is important"
|
|
2312
|
+
Or "\u4E0B\u6B21\u6CE8\u610F" or "next time..."
|
|
2313
|
+
Then I should capture this as experience through reflect
|
|
2314
|
+
And respond in memory language \u2014 "\u8BB0\u4F4F\u4E86" or "Got it, I'll remember that"`,
|
|
2315
|
+
"skill-system": "Feature: Skill system \u2014 progressive disclosure and resource loading\n Skills are loaded on demand through a three-layer progressive disclosure model.\n Each layer adds detail only when needed, keeping the AI's context lean.\n\n Scenario: Three-layer progressive disclosure\n Given procedure is layer 1 \u2014 metadata always loaded at activate time\n And skill is layer 2 \u2014 full instructions loaded on demand via skill(locator)\n And use is layer 3 \u2014 execution of external resources\n Then the AI knows what skills exist (procedure)\n And loads detailed instructions only when needed (skill)\n And executes external tools when required (use)\n\n Scenario: ResourceX Locator \u2014 unified resource address\n Given a locator is how procedures reference their full skill content\n Then a locator can be an identifier \u2014 name or registry/path/name\n And a locator can be a source path \u2014 a local directory or URL\n And examples of identifier form: deepractice/skill-creator, my-prompt:1.0.0\n And examples of source form: ./skills/my-skill, https://github.com/org/repo\n And the tag defaults to latest when omitted \u2014 deepractice/skill-creator means deepractice/skill-creator:latest\n And the system auto-detects which form is used and resolves accordingly\n\n Scenario: Writing a procedure \u2014 the skill reference\n Given a procedure is layer 1 metadata pointing to full skill content\n Then the Feature title names the capability\n And the description includes the locator for full skill loading\n And Scenarios describe when and why to apply this skill\n And the tone is referential \u2014 pointing to the full skill, not containing it",
|
|
2316
|
+
"state-origin": "Feature: State origin \u2014 prototype vs instance\n Every node in a role's state tree has an origin: prototype or instance.\n This distinction determines what can be modified and what is read-only.\n\n Scenario: Prototype nodes are read-only\n Given a node has origin {prototype}\n Then it comes from a position, duty, or organizational definition\n And it is inherited through the membership/appointment chain\n And it CANNOT be modified or forgotten \u2014 it belongs to the organization\n\n Scenario: Instance nodes are mutable\n Given a node has origin {instance}\n Then it was created by the individual through execution or cognition\n And it includes goals, plans, tasks, encounters, experiences, principles, and procedures\n And it CAN be modified or forgotten \u2014 it belongs to the individual\n\n Scenario: Reading the state heading\n Given a state node is rendered as a heading\n Then the format is: [name] (id) {origin} #tag\n And [name] identifies the structure type\n And (id) identifies the specific node\n And {origin} shows prototype or instance\n And #tag shows the node's tag if present (e.g. #done, #abandoned)\n And nodes without origin have no organizational inheritance\n\n Scenario: Forget only works on instance nodes\n Given the AI wants to forget a node\n When the node origin is {instance}\n Then forget will succeed \u2014 the individual owns this knowledge\n When the node origin is {prototype}\n Then forget will fail \u2014 the knowledge belongs to the organization",
|
|
2317
|
+
"use-protocol": `Feature: Use tool \u2014 the universal execution entry point
|
|
2318
|
+
The MCP use tool is how you execute ALL RoleX operations beyond the core MCP tools.
|
|
2319
|
+
Whenever you see use("...") or a !namespace.method pattern in skills or documentation,
|
|
2320
|
+
it is an instruction to call the MCP use tool with that command.
|
|
2321
|
+
|
|
2322
|
+
Scenario: How to read use instructions in skills
|
|
2323
|
+
Given a skill document contains use("!resource.add", { path: "..." })
|
|
2324
|
+
Then this means: call the MCP use tool with command "!resource.add" and path "..."
|
|
2325
|
+
And all named arguments are passed as flat top-level parameters alongside command
|
|
2326
|
+
And always use the MCP use tool for RoleX operations
|
|
2327
|
+
And this applies to every use("...") pattern you encounter in any skill or documentation
|
|
2328
|
+
|
|
2329
|
+
Scenario: ! prefix dispatches to RoleX runtime
|
|
2330
|
+
Given the command starts with !
|
|
2331
|
+
Then it is parsed as !namespace.method
|
|
2332
|
+
And dispatched to the corresponding RoleX API with named args
|
|
2333
|
+
|
|
2334
|
+
Scenario: Mandatory skill loading before execution
|
|
2335
|
+
Given your procedures list the skills you have
|
|
2336
|
+
When you need to execute a command you have not seen in a loaded skill
|
|
2337
|
+
Then you MUST call skill(locator) first to load the full instructions
|
|
2338
|
+
And the loaded skill will tell you the exact command name and arguments
|
|
2339
|
+
And only then call use with the correct command and flat named parameters
|
|
2340
|
+
And do not use commands from other roles' descriptions \u2014 only your own skills
|
|
2341
|
+
|
|
2342
|
+
Scenario: NEVER guess commands
|
|
2343
|
+
Given a command is not found in any loaded skill
|
|
2344
|
+
When the AI considers trying it anyway
|
|
2345
|
+
Then STOP \u2014 do not call use or direct with unverified commands
|
|
2346
|
+
And call skill(locator) with the relevant procedure to learn the correct syntax
|
|
2347
|
+
And if no procedure covers this task, it is outside your duties \u2014 suggest Nuwa
|
|
2348
|
+
|
|
2349
|
+
Scenario: Regular commands delegate to ResourceX
|
|
2350
|
+
Given the command does not start with !
|
|
2351
|
+
Then it is treated as a ResourceX locator
|
|
2352
|
+
And resolved through the ResourceX ingest pipeline`
|
|
2353
|
+
};
|
|
2354
|
+
|
|
2355
|
+
// src/renderer.ts
|
|
2356
|
+
var RendererRouter = class {
|
|
2357
|
+
renderers = /* @__PURE__ */ new Map();
|
|
2358
|
+
/** Register a renderer for a command namespace. */
|
|
2359
|
+
register(namespace, renderer) {
|
|
2360
|
+
this.renderers.set(namespace, renderer);
|
|
2361
|
+
return this;
|
|
2362
|
+
}
|
|
2363
|
+
/** Route a command to the appropriate renderer. */
|
|
2364
|
+
render(command, result) {
|
|
2365
|
+
const dot = command.indexOf(".");
|
|
2366
|
+
const namespace = dot >= 0 ? command.slice(0, dot) : command;
|
|
2367
|
+
const renderer = this.renderers.get(namespace);
|
|
2368
|
+
if (renderer) return renderer.render(command, result);
|
|
2369
|
+
return defaultRender(command, result);
|
|
2370
|
+
}
|
|
2371
|
+
};
|
|
2372
|
+
function defaultRender(_command, result) {
|
|
2373
|
+
return JSON.stringify(result, null, 2);
|
|
2374
|
+
}
|
|
2375
|
+
|
|
2376
|
+
// src/tools.ts
|
|
2377
|
+
var worldInstructions = Object.values(world).join("\n\n");
|
|
2378
|
+
var tools = [
|
|
2379
|
+
// --- Role ---
|
|
2380
|
+
{
|
|
2381
|
+
name: "activate",
|
|
2382
|
+
params: {
|
|
2383
|
+
roleId: { type: "string", required: true, description: "Role name to activate" }
|
|
2384
|
+
}
|
|
2385
|
+
},
|
|
2386
|
+
{
|
|
2387
|
+
name: "focus",
|
|
2388
|
+
params: {
|
|
2389
|
+
id: {
|
|
2390
|
+
type: "string",
|
|
2391
|
+
required: false,
|
|
2392
|
+
description: "Goal id to switch to. Omit to view current."
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
},
|
|
2396
|
+
// --- Execution ---
|
|
2397
|
+
{
|
|
2398
|
+
name: "want",
|
|
2399
|
+
params: {
|
|
2400
|
+
id: { type: "string", required: true, description: "Goal id (used for focus/reference)" },
|
|
2401
|
+
goal: {
|
|
2402
|
+
type: "gherkin",
|
|
2403
|
+
required: true,
|
|
2404
|
+
description: "Gherkin Feature source describing the goal"
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
},
|
|
2408
|
+
{
|
|
2409
|
+
name: "plan",
|
|
2410
|
+
params: {
|
|
2411
|
+
id: {
|
|
2412
|
+
type: "string",
|
|
2413
|
+
required: true,
|
|
2414
|
+
description: "Plan id \u2014 keywords from the plan content joined by hyphens"
|
|
2415
|
+
},
|
|
2416
|
+
plan: {
|
|
2417
|
+
type: "gherkin",
|
|
2418
|
+
required: true,
|
|
2419
|
+
description: "Gherkin Feature source describing the plan"
|
|
2420
|
+
},
|
|
2421
|
+
after: {
|
|
2422
|
+
type: "string",
|
|
2423
|
+
required: false,
|
|
2424
|
+
description: "Plan id this plan follows (sequential/phase relationship)"
|
|
2425
|
+
},
|
|
2426
|
+
fallback: {
|
|
2427
|
+
type: "string",
|
|
2428
|
+
required: false,
|
|
2429
|
+
description: "Plan id this plan is a backup for (alternative/strategy relationship)"
|
|
2430
|
+
}
|
|
2431
|
+
}
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
name: "todo",
|
|
2435
|
+
params: {
|
|
2436
|
+
id: { type: "string", required: true, description: "Task id (used for finish/reference)" },
|
|
2437
|
+
task: {
|
|
2438
|
+
type: "gherkin",
|
|
2439
|
+
required: true,
|
|
2440
|
+
description: "Gherkin Feature source describing the task"
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
},
|
|
2444
|
+
{
|
|
2445
|
+
name: "finish",
|
|
2446
|
+
params: {
|
|
2447
|
+
id: { type: "string", required: true, description: "Task id to finish" },
|
|
2448
|
+
encounter: {
|
|
2449
|
+
type: "gherkin",
|
|
2450
|
+
required: false,
|
|
2451
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
},
|
|
2455
|
+
{
|
|
2456
|
+
name: "complete",
|
|
2457
|
+
params: {
|
|
2458
|
+
id: {
|
|
2459
|
+
type: "string",
|
|
2460
|
+
required: false,
|
|
2461
|
+
description: "Plan id to complete (defaults to focused plan)"
|
|
2462
|
+
},
|
|
2463
|
+
encounter: {
|
|
2464
|
+
type: "gherkin",
|
|
2465
|
+
required: false,
|
|
2466
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
},
|
|
2470
|
+
{
|
|
2471
|
+
name: "abandon",
|
|
2472
|
+
params: {
|
|
2473
|
+
id: {
|
|
2474
|
+
type: "string",
|
|
2475
|
+
required: false,
|
|
2476
|
+
description: "Plan id to abandon (defaults to focused plan)"
|
|
2477
|
+
},
|
|
2478
|
+
encounter: {
|
|
2479
|
+
type: "gherkin",
|
|
2480
|
+
required: false,
|
|
2481
|
+
description: "Optional Gherkin Feature describing what happened"
|
|
2482
|
+
}
|
|
2483
|
+
}
|
|
2484
|
+
},
|
|
2485
|
+
// --- Cognition ---
|
|
2486
|
+
{
|
|
2487
|
+
name: "reflect",
|
|
2488
|
+
params: {
|
|
2489
|
+
ids: {
|
|
2490
|
+
type: "string[]",
|
|
2491
|
+
required: true,
|
|
2492
|
+
description: "Encounter ids to reflect on (selective consumption)"
|
|
2493
|
+
},
|
|
2494
|
+
id: {
|
|
2495
|
+
type: "string",
|
|
2496
|
+
required: true,
|
|
2497
|
+
description: "Experience id \u2014 keywords from the experience content joined by hyphens"
|
|
2498
|
+
},
|
|
2499
|
+
experience: {
|
|
2500
|
+
type: "gherkin",
|
|
2501
|
+
required: false,
|
|
2502
|
+
description: "Gherkin Feature source for the experience"
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
},
|
|
2506
|
+
{
|
|
2507
|
+
name: "realize",
|
|
2508
|
+
params: {
|
|
2509
|
+
ids: {
|
|
2510
|
+
type: "string[]",
|
|
2511
|
+
required: true,
|
|
2512
|
+
description: "Experience ids to distill into a principle"
|
|
2513
|
+
},
|
|
2514
|
+
id: {
|
|
2515
|
+
type: "string",
|
|
2516
|
+
required: true,
|
|
2517
|
+
description: "Principle id \u2014 keywords from the principle content joined by hyphens"
|
|
2518
|
+
},
|
|
2519
|
+
principle: {
|
|
2520
|
+
type: "gherkin",
|
|
2521
|
+
required: false,
|
|
2522
|
+
description: "Gherkin Feature source for the principle"
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
},
|
|
2526
|
+
{
|
|
2527
|
+
name: "master",
|
|
2528
|
+
params: {
|
|
2529
|
+
ids: {
|
|
2530
|
+
type: "string[]",
|
|
2531
|
+
required: false,
|
|
2532
|
+
description: "Experience ids to distill into a procedure"
|
|
2533
|
+
},
|
|
2534
|
+
id: {
|
|
2535
|
+
type: "string",
|
|
2536
|
+
required: true,
|
|
2537
|
+
description: "Procedure id \u2014 keywords from the procedure content joined by hyphens"
|
|
2538
|
+
},
|
|
2539
|
+
procedure: {
|
|
2540
|
+
type: "gherkin",
|
|
2541
|
+
required: true,
|
|
2542
|
+
description: "Gherkin Feature source for the procedure"
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
},
|
|
2546
|
+
// --- Knowledge ---
|
|
2547
|
+
{
|
|
2548
|
+
name: "forget",
|
|
2549
|
+
params: {
|
|
2550
|
+
id: {
|
|
2551
|
+
type: "string",
|
|
2552
|
+
required: true,
|
|
2553
|
+
description: "Id of the node to remove (principle, procedure, experience, encounter, etc.)"
|
|
2554
|
+
}
|
|
2555
|
+
}
|
|
2556
|
+
},
|
|
2557
|
+
{
|
|
2558
|
+
name: "skill",
|
|
2559
|
+
params: {
|
|
2560
|
+
locator: {
|
|
2561
|
+
type: "string",
|
|
2562
|
+
required: true,
|
|
2563
|
+
description: "ResourceX locator for the skill (e.g. deepractice/role-management)"
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
},
|
|
2567
|
+
// --- Use / Direct ---
|
|
2568
|
+
{
|
|
2569
|
+
name: "use",
|
|
2570
|
+
params: {
|
|
2571
|
+
command: {
|
|
2572
|
+
type: "string",
|
|
2573
|
+
required: true,
|
|
2574
|
+
description: "!namespace.method for RoleX commands, or a ResourceX locator for resources"
|
|
2575
|
+
},
|
|
2576
|
+
args: {
|
|
2577
|
+
type: "record",
|
|
2578
|
+
required: false,
|
|
2579
|
+
description: "Named arguments for the command. Load the relevant skill first to learn what args to pass."
|
|
2580
|
+
}
|
|
2581
|
+
}
|
|
2582
|
+
},
|
|
2583
|
+
{
|
|
2584
|
+
name: "direct",
|
|
2585
|
+
params: {
|
|
2586
|
+
command: {
|
|
2587
|
+
type: "string",
|
|
2588
|
+
required: true,
|
|
2589
|
+
description: "!namespace.method for RoleX commands, or a ResourceX locator for resources"
|
|
2590
|
+
},
|
|
2591
|
+
args: {
|
|
2592
|
+
type: "record",
|
|
2593
|
+
required: false,
|
|
2594
|
+
description: "Named arguments for the command. Load the relevant skill first to learn what args to pass."
|
|
2595
|
+
}
|
|
2596
|
+
}
|
|
2597
|
+
}
|
|
2598
|
+
];
|
|
2599
|
+
var protocol = { tools, instructions: worldInstructions };
|
|
214
2600
|
export {
|
|
2601
|
+
RendererRouter,
|
|
2602
|
+
Role,
|
|
2603
|
+
RoleXService,
|
|
215
2604
|
abandon,
|
|
216
2605
|
abolish,
|
|
217
2606
|
activate,
|
|
2607
|
+
applyPrototype,
|
|
218
2608
|
appoint,
|
|
219
2609
|
archive,
|
|
220
2610
|
background,
|
|
@@ -224,10 +2614,12 @@ export {
|
|
|
224
2614
|
charterOrg,
|
|
225
2615
|
complete,
|
|
226
2616
|
create5 as create,
|
|
2617
|
+
createCommands,
|
|
227
2618
|
createRuntime,
|
|
228
2619
|
deliverProject,
|
|
229
2620
|
deliverable,
|
|
230
2621
|
die,
|
|
2622
|
+
directives,
|
|
231
2623
|
dismiss,
|
|
232
2624
|
dissolve,
|
|
233
2625
|
duty,
|
|
@@ -235,6 +2627,7 @@ export {
|
|
|
235
2627
|
enroll,
|
|
236
2628
|
establish,
|
|
237
2629
|
experience,
|
|
2630
|
+
findInState,
|
|
238
2631
|
finish,
|
|
239
2632
|
fire,
|
|
240
2633
|
found,
|
|
@@ -242,6 +2635,7 @@ export {
|
|
|
242
2635
|
hire,
|
|
243
2636
|
identity,
|
|
244
2637
|
individual,
|
|
2638
|
+
instructions,
|
|
245
2639
|
launch,
|
|
246
2640
|
link3 as link,
|
|
247
2641
|
master,
|
|
@@ -255,8 +2649,10 @@ export {
|
|
|
255
2649
|
position,
|
|
256
2650
|
principle,
|
|
257
2651
|
procedure,
|
|
258
|
-
|
|
2652
|
+
process6 as process,
|
|
2653
|
+
processes,
|
|
259
2654
|
project,
|
|
2655
|
+
protocol,
|
|
260
2656
|
realize,
|
|
261
2657
|
reflect,
|
|
262
2658
|
rehire,
|
|
@@ -268,14 +2664,16 @@ export {
|
|
|
268
2664
|
scope,
|
|
269
2665
|
scopeProject,
|
|
270
2666
|
society,
|
|
271
|
-
|
|
2667
|
+
structure3 as structure,
|
|
272
2668
|
task,
|
|
2669
|
+
toArgs,
|
|
273
2670
|
todo,
|
|
274
2671
|
tone,
|
|
275
2672
|
transform4 as transform,
|
|
276
2673
|
unlink3 as unlink,
|
|
277
2674
|
want,
|
|
278
2675
|
wiki,
|
|
279
|
-
wikiProject
|
|
2676
|
+
wikiProject,
|
|
2677
|
+
world
|
|
280
2678
|
};
|
|
281
2679
|
//# sourceMappingURL=index.js.map
|