@rolexjs/prototype 1.4.0-dev-20260305012717 → 1.4.0-dev-20260305032702
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 +139 -26
- package/dist/index.js +1734 -1553
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PrototypeData, PrototypeRepository } from '@rolexjs/core';
|
|
2
|
-
import {
|
|
3
|
-
import { IssueX } from 'issuexjs';
|
|
4
|
-
import { ResourceX } from 'resourcexjs';
|
|
2
|
+
import { Runtime, Structure, State } from '@rolexjs/system';
|
|
3
|
+
import { IssueX, Issue, Comment } from 'issuexjs';
|
|
4
|
+
import { ResourceX, Resource, RXM } from 'resourcexjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* applyPrototype — apply a prototype's migrations incrementally.
|
|
@@ -26,6 +26,101 @@ interface ApplyResult {
|
|
|
26
26
|
*/
|
|
27
27
|
declare function applyPrototype(data: PrototypeData, repo: PrototypeRepository, direct: (op: string, args: Record<string, unknown>) => Promise<unknown>): Promise<ApplyResult>;
|
|
28
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;
|
|
123
|
+
|
|
29
124
|
declare const processes: Record<string, string>;
|
|
30
125
|
declare const world: Record<string, string>;
|
|
31
126
|
|
|
@@ -79,6 +174,15 @@ interface InstructionDef {
|
|
|
79
174
|
/** Positional argument order — maps named args to method call positions. */
|
|
80
175
|
args: readonly ArgEntry[];
|
|
81
176
|
}
|
|
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
|
+
/** Whether the tool accepts additional unnamed parameters (e.g. use/direct). */
|
|
184
|
+
additionalProperties?: boolean;
|
|
185
|
+
}
|
|
82
186
|
|
|
83
187
|
/**
|
|
84
188
|
* Instruction set — schema definitions for all RoleX operations.
|
|
@@ -89,32 +193,41 @@ interface InstructionDef {
|
|
|
89
193
|
declare const instructions: Record<string, InstructionDef>;
|
|
90
194
|
|
|
91
195
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* Every RoleX operation is a pure function of (Runtime, args) → OpResult.
|
|
95
|
-
* No platform-specific code — all I/O goes through injected interfaces.
|
|
196
|
+
* Renderer — framework for rendering command results.
|
|
96
197
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
198
|
+
* Renderer interface and RendererRouter live here in prototype
|
|
199
|
+
* because this layer owns all command types and structures.
|
|
200
|
+
* Concrete renderers are registered by the upper layer (rolexjs).
|
|
100
201
|
*/
|
|
101
202
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
203
|
+
/** Renders a command result into a string (typically Markdown). */
|
|
204
|
+
interface Renderer {
|
|
205
|
+
render(command: string, result: CommandResult): string;
|
|
105
206
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
207
|
+
/**
|
|
208
|
+
* RendererRouter — routes commands to namespace-specific renderers.
|
|
209
|
+
*
|
|
210
|
+
* Registered renderers handle their namespace (e.g. "role" handles "role.want").
|
|
211
|
+
* Unregistered commands fall through to the default renderer (JSON serialization).
|
|
212
|
+
*/
|
|
213
|
+
declare class RendererRouter implements Renderer {
|
|
214
|
+
private readonly renderers;
|
|
215
|
+
/** Register a renderer for a command namespace. */
|
|
216
|
+
register(namespace: string, renderer: Renderer): this;
|
|
217
|
+
/** Route a command to the appropriate renderer. */
|
|
218
|
+
render(command: string, result: CommandResult): string;
|
|
116
219
|
}
|
|
117
|
-
type Ops = Record<string, (...args: any[]) => any>;
|
|
118
|
-
declare function createOps(ctx: OpsContext): Ops;
|
|
119
220
|
|
|
120
|
-
|
|
221
|
+
/**
|
|
222
|
+
* RoleX tool definitions — the single source of truth for all tool schemas.
|
|
223
|
+
*
|
|
224
|
+
* Channel-agnostic: MCP, CLI, REST, A2A each convert to their own format.
|
|
225
|
+
* Description for each tool comes from descriptions/processes via detail().
|
|
226
|
+
* This file only defines the parameter schema.
|
|
227
|
+
*/
|
|
228
|
+
|
|
229
|
+
/** Pre-assembled world instructions — the cognitive framework for AI roles. */
|
|
230
|
+
declare const worldInstructions: string;
|
|
231
|
+
declare const tools: ToolDef[];
|
|
232
|
+
|
|
233
|
+
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 };
|