@rolexjs/prototype 1.4.0-dev-20260305004420 → 1.4.0-dev-20260305022714

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,7 +1,7 @@
1
1
  import { PrototypeData, PrototypeRepository } from '@rolexjs/core';
2
- import { State, Runtime, Structure } from '@rolexjs/system';
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": string;
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,15 @@ interface InstructionDef {
89
193
  declare const instructions: Record<string, InstructionDef>;
90
194
 
91
195
  /**
92
- * Opsplatform-agnostic operation implementations.
196
+ * RoleX tool definitions the single source of truth for all tool schemas.
93
197
  *
94
- * Every RoleX operation is a pure function of (Runtime, args) → OpResult.
95
- * No platform-specific code all I/O goes through injected interfaces.
96
- *
97
- * Usage:
98
- * const ops = createOps({ rt, society, past, resolve, find, resourcex });
99
- * const result = ops["individual.born"]("Feature: Sean", "sean");
198
+ * Channel-agnostic: MCP, CLI, REST, A2A each convert to their own format.
199
+ * Description for each tool comes from descriptions/processes via detail().
200
+ * This file only defines the parameter schema.
100
201
  */
101
202
 
102
- interface OpResult {
103
- state: State;
104
- process: string;
105
- }
106
- interface OpsContext {
107
- rt: Runtime;
108
- society: Structure;
109
- past: Structure;
110
- resolve(id: string): Structure | Promise<Structure>;
111
- find(id: string): (Structure | null) | Promise<Structure | null>;
112
- resourcex?: ResourceX;
113
- issuex?: IssueX;
114
- prototype?: PrototypeRepository;
115
- direct?(locator: string, args?: Record<string, unknown>): Promise<unknown>;
116
- }
117
- type Ops = Record<string, (...args: any[]) => any>;
118
- declare function createOps(ctx: OpsContext): Ops;
203
+ /** Pre-assembled world instructions — the cognitive framework for AI roles. */
204
+ declare const worldInstructions: string;
205
+ declare const tools: ToolDef[];
119
206
 
120
- export { type ApplyResult, type ArgEntry, type InstructionDef, type OpResult, type Ops, type OpsContext, type ParamDef, type ParamType, applyPrototype, createOps, directives, instructions, processes, toArgs, world };
207
+ export { type ApplyResult, type ArgEntry, type CommandContext, type CommandResult, type CommandResultMap, type Commands, type InstructionDef, type ParamDef, type ParamType, type ToolDef, applyPrototype, createCommands, directives, instructions, processes, toArgs, tools, world, worldInstructions };