@rolexjs/prototype 1.5.0-dev-20260309054045 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,125 +1,6 @@
1
- import { PrototypeData, PrototypeRepository } from '@rolexjs/core';
2
- import { Runtime, Structure, State } from '@rolexjs/system';
3
- import { IssueX, Issue, Comment } from 'issuexjs';
4
- import { ResourceX, Resource, RXM } from 'resourcexjs';
5
-
6
- /**
7
- * applyPrototype — apply a prototype's migrations incrementally.
8
- *
9
- * Pure function: receives data + storage + executor, no framework coupling.
10
- * Checks migration history, executes only unapplied migrations, records each.
11
- */
12
-
13
- /** Result of applying a prototype. */
14
- interface ApplyResult {
15
- prototypeId: string;
16
- applied: number;
17
- skipped: number;
18
- upToDate: boolean;
19
- }
20
- /**
21
- * Apply a prototype — execute unapplied migrations in version order.
22
- *
23
- * @param data - The prototype data structure with migrations
24
- * @param repo - Storage layer for migration history
25
- * @param direct - Executor for prototype instructions
26
- */
27
- declare function applyPrototype(data: PrototypeData, repo: PrototypeRepository, direct: (op: string, args: Record<string, unknown>) => Promise<unknown>): Promise<ApplyResult>;
28
-
29
- /**
30
- * Commands — platform-agnostic command implementations.
31
- *
32
- * Every RoleX command is a pure function of (Runtime, args) → CommandResult.
33
- * No platform-specific code — all I/O goes through injected interfaces.
34
- *
35
- * Usage:
36
- * const commands = createCommands({ rt, society, past, resolve, find, resourcex });
37
- * const result = commands["individual.born"]("Feature: Sean", "sean");
38
- */
39
-
40
- interface CommandResult {
41
- state: State;
42
- process: string;
43
- }
44
- interface CommandContext {
45
- rt: Runtime;
46
- society: Structure;
47
- past: Structure;
48
- resolve(id: string): Structure | Promise<Structure>;
49
- find(id: string): (Structure | null) | Promise<Structure | null>;
50
- resourcex?: ResourceX;
51
- issuex?: IssueX;
52
- prototype?: PrototypeRepository;
53
- direct?(locator: string, args?: Record<string, unknown>): Promise<unknown>;
54
- }
55
- /**
56
- * CommandResultMap — typed return type for every command.
57
- *
58
- * This is the source of truth for what each command returns.
59
- * Renderer and consumers use this to know the shape of each result.
60
- */
61
- interface CommandResultMap {
62
- "individual.born": CommandResult;
63
- "individual.retire": CommandResult;
64
- "individual.die": CommandResult;
65
- "individual.rehire": CommandResult;
66
- "individual.teach": CommandResult;
67
- "individual.train": CommandResult;
68
- "role.focus": CommandResult;
69
- "role.want": CommandResult;
70
- "role.plan": CommandResult;
71
- "role.todo": CommandResult;
72
- "role.finish": CommandResult;
73
- "role.complete": CommandResult;
74
- "role.abandon": CommandResult;
75
- "role.reflect": CommandResult;
76
- "role.realize": CommandResult;
77
- "role.master": CommandResult;
78
- "role.forget": CommandResult;
79
- "role.skill": string;
80
- "project.launch": CommandResult;
81
- "project.scope": CommandResult;
82
- "project.milestone": CommandResult;
83
- "project.achieve": CommandResult;
84
- "project.enroll": CommandResult;
85
- "project.remove": CommandResult;
86
- "project.deliver": CommandResult;
87
- "project.wiki": CommandResult;
88
- "project.archive": CommandResult;
89
- "org.found": CommandResult;
90
- "org.charter": CommandResult;
91
- "org.dissolve": CommandResult;
92
- "org.hire": CommandResult;
93
- "org.fire": CommandResult;
94
- "position.establish": CommandResult;
95
- "position.charge": CommandResult;
96
- "position.require": CommandResult;
97
- "position.abolish": CommandResult;
98
- "position.appoint": CommandResult;
99
- "position.dismiss": CommandResult;
100
- "census.list": CommandResult;
101
- "issue.publish": Issue;
102
- "issue.get": Issue | null;
103
- "issue.list": Issue[];
104
- "issue.update": Issue;
105
- "issue.close": Issue;
106
- "issue.reopen": Issue;
107
- "issue.assign": Issue;
108
- "issue.comment": Comment;
109
- "issue.comments": Comment[];
110
- "issue.label": Issue | null;
111
- "issue.unlabel": Issue | null;
112
- "resource.add": Resource;
113
- "resource.search": string[];
114
- "resource.has": boolean;
115
- "resource.info": Resource;
116
- "resource.remove": undefined;
117
- "resource.push": RXM;
118
- "resource.pull": undefined;
119
- "resource.clearCache": undefined;
120
- }
121
- type Commands = Record<string, (...args: any[]) => any>;
122
- declare function createCommands(ctx: CommandContext): Commands;
1
+ import { State, Runtime, Structure } from '@rolexjs/system';
2
+ import { IssueX } from 'issuexjs';
3
+ import { ResourceX } from 'resourcexjs';
123
4
 
124
5
  declare const processes: Record<string, string>;
125
6
  declare const world: Record<string, string>;
@@ -174,13 +55,6 @@ interface InstructionDef {
174
55
  /** Positional argument order — maps named args to method call positions. */
175
56
  args: readonly ArgEntry[];
176
57
  }
177
- /** RoleX tool definition — schema for a top-level tool (activate, want, use, etc.). */
178
- interface ToolDef {
179
- /** Tool name (e.g. "activate", "use"). */
180
- name: string;
181
- /** Parameter definitions — keyed by param name. */
182
- params: Record<string, ParamDef>;
183
- }
184
58
 
185
59
  /**
186
60
  * Instruction set — schema definitions for all RoleX operations.
@@ -191,41 +65,36 @@ interface ToolDef {
191
65
  declare const instructions: Record<string, InstructionDef>;
192
66
 
193
67
  /**
194
- * Rendererframework for rendering command results.
68
+ * Opsplatform-agnostic operation implementations.
195
69
  *
196
- * Renderer interface and RendererRouter live here in prototype
197
- * because this layer owns all command types and structures.
198
- * Concrete renderers are registered by the upper layer (rolexjs).
70
+ * Every RoleX operation is a pure function of (Runtime, args) → OpResult.
71
+ * No platform-specific code all I/O goes through injected interfaces.
72
+ *
73
+ * Usage:
74
+ * const ops = createOps({ rt, society, past, resolve, find, resourcex });
75
+ * const result = ops["individual.born"]("Feature: Sean", "sean");
199
76
  */
200
77
 
201
- /** Renders a command result into a string (typically Markdown). */
202
- interface Renderer {
203
- render(command: string, result: CommandResult): string;
78
+ interface OpResult {
79
+ state: State;
80
+ process: string;
204
81
  }
205
- /**
206
- * RendererRouter — routes commands to namespace-specific renderers.
207
- *
208
- * Registered renderers handle their namespace (e.g. "role" handles "role.want").
209
- * Unregistered commands fall through to the default renderer (JSON serialization).
210
- */
211
- declare class RendererRouter implements Renderer {
212
- private readonly renderers;
213
- /** Register a renderer for a command namespace. */
214
- register(namespace: string, renderer: Renderer): this;
215
- /** Route a command to the appropriate renderer. */
216
- render(command: string, result: CommandResult): string;
82
+ interface OpsContext {
83
+ rt: Runtime;
84
+ society: Structure;
85
+ past: Structure;
86
+ resolve(id: string): Structure | Promise<Structure>;
87
+ find(id: string): (Structure | null) | Promise<Structure | null>;
88
+ resourcex?: ResourceX;
89
+ issuex?: IssueX;
90
+ prototype?: {
91
+ settle(id: string, source: string): void;
92
+ evict(id: string): void;
93
+ list(): Record<string, string>;
94
+ };
95
+ direct?(locator: string, args?: Record<string, unknown>): Promise<unknown>;
217
96
  }
97
+ type Ops = Record<string, (...args: any[]) => any>;
98
+ declare function createOps(ctx: OpsContext): Ops;
218
99
 
219
- /**
220
- * RoleX tool definitions — the single source of truth for all tool schemas.
221
- *
222
- * Channel-agnostic: MCP, CLI, REST, A2A each convert to their own format.
223
- * Description for each tool comes from descriptions/processes via detail().
224
- * This file only defines the parameter schema.
225
- */
226
-
227
- /** Pre-assembled world instructions — the cognitive framework for AI roles. */
228
- declare const worldInstructions: string;
229
- declare const tools: ToolDef[];
230
-
231
- export { type ApplyResult, type ArgEntry, type CommandContext, type CommandResult, type CommandResultMap, type Commands, type InstructionDef, type ParamDef, type ParamType, type Renderer, RendererRouter, type ToolDef, applyPrototype, createCommands, directives, instructions, processes, toArgs, tools, world, worldInstructions };
100
+ export { type ArgEntry, type InstructionDef, type OpResult, type Ops, type OpsContext, type ParamDef, type ParamType, createOps, directives, instructions, processes, toArgs, world };