@rolexjs/core 0.1.0 → 0.3.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,190 +1,197 @@
1
- import { RXR, Registry } from "resourcexjs";
2
- /**
3
- * RoleX Core Types
4
- * @rolexjs/core
5
- */
6
- /**
7
- * Rendered Role object
8
- */
9
- interface RenderedRole {
10
- /** Final rendered complete prompt */
11
- readonly prompt: string;
12
- /** Personality section */
13
- readonly personality: string;
14
- /** Principle section */
15
- readonly principle: string;
16
- /** Knowledge section */
17
- readonly knowledge: string;
1
+ import { Scenario as Scenario$1, Feature as Feature$1 } from '@cucumber/messages';
2
+
3
+ /**
4
+ * Scenario — A unit of behavior within a Feature.
5
+ *
6
+ * Extends Gherkin's Scenario with verifiability marking.
7
+ * Verifiable scenarios become persistent test cases.
8
+ * Non-verifiable scenarios are one-time acceptance criteria.
9
+ */
10
+
11
+ /**
12
+ * A Gherkin Scenario enriched with verification metadata.
13
+ */
14
+ interface Scenario extends Scenario$1 {
15
+ readonly verifiable: boolean;
18
16
  }
19
- /**
20
- * Thought sub-tag types
21
- */
22
- type ThoughtSubTag = "exploration" | "reasoning" | "challenge" | "plan";
23
- /**
24
- * Execution sub-tag types
25
- */
26
- type ExecutionSubTag = "process" | "constraint" | "rule" | "guideline" | "criteria";
27
- /**
28
- * Parsed Thought content
29
- */
30
- interface ParsedThought {
31
- readonly exploration?: string;
32
- readonly reasoning?: string;
33
- readonly challenge?: string;
34
- readonly plan?: string;
17
+
18
+ /**
19
+ * Feature — The atomic unit in the RDD model.
20
+ *
21
+ * Extends Gherkin's Feature with RDD dimension classification
22
+ * and explicit Scenario relationship.
23
+ */
24
+
25
+ /**
26
+ * A Gherkin Feature enriched with RDD semantics.
27
+ */
28
+ interface Feature extends Feature$1 {
29
+ readonly type: "persona" | "knowledge" | "experience" | "voice" | "goal" | "plan" | "task";
30
+ readonly scenarios: Scenario[];
35
31
  }
36
- /**
37
- * Parsed Execution content
38
- */
39
- interface ParsedExecution {
40
- readonly process?: string;
41
- readonly constraint?: string;
42
- readonly rule?: string;
43
- readonly guideline?: string;
44
- readonly criteria?: string;
32
+
33
+ /**
34
+ * Identity — The role's complete self.
35
+ *
36
+ * NOT a Feature itself — it is a container that wraps
37
+ * multiple Features (*.identity.feature files).
38
+ * Always loaded, independent of any goal.
39
+ */
40
+
41
+ /**
42
+ * The identity foundation of a role. Wraps many Features.
43
+ */
44
+ interface Identity {
45
+ readonly features: Feature[];
45
46
  }
46
- /**
47
- * Resource resolver function type
48
- */
49
- type ResourceResolver = (src: string) => Promise<string>;
50
- /**
51
- * Load and render a Role from RXR
52
- *
53
- * @param rxr - Role resource (RXL + RXM + RXC)
54
- * @param registry - Registry instance (for resolving ARP rxr:// references)
55
- * @returns Rendered Role object
56
- *
57
- * @example
58
- * ```typescript
59
- * const registry = createRegistry();
60
- * const rxr = await registry.get('localhost/my.role@1.0.0');
61
- * const role = await loadRole(rxr, registry);
62
- * console.log(role.prompt);
63
- * ```
64
- */
65
- declare function loadRole(rxr: RXR, registry: Registry): Promise<RenderedRole>;
66
- import { ResourceType } from "resourcexjs";
67
- /**
68
- * Role resource type for ResourceX integration
69
- *
70
- * @example
71
- * ```typescript
72
- * import { createRegistry } from 'resourcexjs';
73
- * import { roleType } from '@rolexjs/core';
74
- *
75
- * const registry = createRegistry();
76
- * registry.supportType(roleType);
77
- *
78
- * const resource = await registry.resolve('deepractice.dev/nuwa.role@1.0.0');
79
- * const role = await resource.execute();
80
- * console.log(role.prompt);
81
- * ```
82
- */
83
- declare const roleType: ResourceType<void, RenderedRole>;
84
- /**
85
- * RoleX Error Classes
86
- * @rolexjs/core
87
- */
88
- /**
89
- * Base error class for all RoleX errors
90
- */
91
- declare class RoleXError extends Error {
92
- constructor(message: string, options?: ErrorOptions);
47
+
48
+ /**
49
+ * Goal — The driver of action.
50
+ *
51
+ * A Goal IS-A Feature with type='goal'.
52
+ * Dynamic and phase-specific. What the role wants to achieve.
53
+ * Expressed as *.goal.feature files.
54
+ */
55
+
56
+ /**
57
+ * A goal that a role wants to achieve in a given phase.
58
+ */
59
+ interface Goal extends Feature {
60
+ readonly type: "goal";
93
61
  }
94
- /**
95
- * Error thrown when role loading fails
96
- */
97
- declare class RoleLoadError extends RoleXError {
98
- readonly locator?: string;
99
- constructor(message: string, locator?: string);
62
+
63
+ /**
64
+ * Role — The primary organizing unit in RDD.
65
+ *
66
+ * Every role operates through dimensions:
67
+ * Identity → Goal → Plan → Task/Skill
68
+ *
69
+ * Identity is static (always present).
70
+ * Goals are dynamic (change per phase).
71
+ */
72
+
73
+ /**
74
+ * A role in the RDD (Role-Driven Development) model.
75
+ */
76
+ interface Role {
77
+ readonly name: string;
78
+ readonly identity: Identity;
79
+ readonly goals: Goal[];
100
80
  }
101
- /**
102
- * Error thrown when resource resolution fails
103
- */
104
- declare class ResourceResolveError extends RoleXError {
105
- readonly src?: string;
106
- constructor(message: string, src?: string);
81
+
82
+ /**
83
+ * Plan — The bridge between goal and execution.
84
+ *
85
+ * A Plan IS-A Feature with type='plan'.
86
+ * Expressed as *.plan.feature files.
87
+ */
88
+
89
+ /**
90
+ * A plan that decomposes a goal into executable tasks.
91
+ */
92
+ interface Plan extends Feature {
93
+ readonly type: "plan";
107
94
  }
108
- /**
109
- * Error thrown when DPML parsing fails
110
- */
111
- declare class DPMLParseError extends RoleXError {
112
- constructor(message: string);
95
+
96
+ /**
97
+ * Task — Concrete unit of work within a plan.
98
+ *
99
+ * A Task IS-A Feature with type='task'.
100
+ * Expressed as *.task.feature files.
101
+ */
102
+
103
+ /**
104
+ * A concrete unit of work.
105
+ */
106
+ interface Task extends Feature {
107
+ readonly type: "task";
108
+ }
109
+
110
+ /**
111
+ * Skill — Execution capability for a task.
112
+ *
113
+ * Compatible with existing skill systems:
114
+ * Claude Code skills, ResourceX resources, MCP tools, etc.
115
+ */
116
+ /**
117
+ * A capability that a role uses to execute a task.
118
+ */
119
+ interface Skill {
120
+ /** Skill identifier, e.g. "commit", "bdd", "dev-flow" */
121
+ readonly name: string;
122
+ /** Reference to the concrete implementation: skill path, resource locator, tool URI */
123
+ readonly reference: string;
113
124
  }
114
- import { Schema } from "dpml";
115
- /**
116
- * RoleX schema collection
117
- */
118
- interface RoleSchemas {
119
- readonly role: Schema;
120
- readonly thought: Schema;
121
- readonly execution: Schema;
122
- readonly knowledge: Schema;
125
+
126
+ /**
127
+ * Platform The abstraction layer for role storage.
128
+ *
129
+ * Defines how roles are loaded and persisted.
130
+ * LocalPlatform uses the filesystem (.rolex/ directories).
131
+ * Future platforms could use databases, cloud storage, etc.
132
+ *
133
+ * All methods are stateless — role name is passed per call.
134
+ */
135
+
136
+ /**
137
+ * Role entry in the organization.
138
+ */
139
+ interface RoleEntry {
140
+ readonly name: string;
141
+ readonly team: string;
123
142
  }
124
- import { Schema as Schema2 } from "dpml";
125
- /**
126
- * Create all RoleX schemas
127
- *
128
- * Role structure:
129
- * <role>
130
- * <personality>...</personality>
131
- * <principle>...</principle>
132
- * <knowledge>...</knowledge>
133
- * </role>
134
- */
135
- declare function defineRoleSchemas(): RoleSchemas;
136
- declare const roleSchema: Schema2;
137
- declare const thoughtSchema: Schema2;
138
- declare const executionSchema: Schema2;
139
- declare const knowledgeSchema: Schema2;
140
- /**
141
- * Transformer input interface (compatible with dpml 0.3.0)
142
- */
143
- interface TransformInput {
144
- document: {
145
- rootNode: unknown
146
- nodesById?: Map<string, unknown>
147
- metadata?: Record<string, unknown>
148
- };
149
- isValid?: boolean;
150
- validation?: {
151
- isValid: boolean
152
- errors: unknown[]
153
- warnings: unknown[]
154
- };
155
- resources?: unknown[];
143
+ /**
144
+ * Organization structure.
145
+ */
146
+ interface Organization {
147
+ readonly name: string;
148
+ readonly roles: RoleEntry[];
149
+ }
150
+ /**
151
+ * Society directory — all known roles and organizations.
152
+ */
153
+ interface Directory {
154
+ readonly roles: readonly RoleEntry[];
155
+ readonly organizations: readonly {
156
+ readonly name: string;
157
+ }[];
156
158
  }
157
159
  /**
158
- * Role transformer type
159
- */
160
- interface RoleTransformer {
161
- name: string;
162
- description?: string;
163
- transform(input: TransformInput): RenderedRole;
160
+ * Platform interface — abstracts role storage and retrieval.
161
+ * All methods are stateless — role name identifies the target role.
162
+ */
163
+ interface Platform {
164
+ /** Found an organization */
165
+ found(name: string): void;
166
+ /** Get the organization structure (teams + roles) */
167
+ organization(): Organization;
168
+ /** Create a new role with its persona */
169
+ born(name: string, source: string): Feature;
170
+ /** Hire a role into the organization — establish CAS link */
171
+ hire(name: string): void;
172
+ /** Fire a role from the organization — remove CAS link */
173
+ fire(name: string): void;
174
+ /** Load all identity features for a role */
175
+ identity(roleId: string): Feature[];
176
+ /** Add a growth dimension to a role's identity */
177
+ growup(roleId: string, type: "knowledge" | "experience" | "voice", name: string, source: string): Feature;
178
+ /** Find the current active goal for a role (with plan + tasks context) */
179
+ activeGoal(roleId: string): (Goal & {
180
+ plan: Plan | null;
181
+ tasks: Task[];
182
+ }) | null;
183
+ /** Create a new goal from Gherkin source */
184
+ createGoal(roleId: string, name: string, source: string, testable?: boolean): Goal;
185
+ /** Create a plan for the current active goal */
186
+ createPlan(roleId: string, source: string): Plan;
187
+ /** Create a task for the current active goal */
188
+ createTask(roleId: string, name: string, source: string, testable?: boolean): Task;
189
+ /** Mark the current active goal as done, optionally with experience reflection */
190
+ completeGoal(roleId: string, experience?: string): void;
191
+ /** Abandon the current active goal, optionally with experience reflection */
192
+ abandonGoal(roleId: string, experience?: string): void;
193
+ /** Mark a task as done */
194
+ completeTask(roleId: string, name: string): void;
164
195
  }
165
- import { Transformer } from "dpml";
166
- /**
167
- * Role Transformer
168
- * Transforms DPML role document into RenderedRole
169
- */
170
- declare const roleTransformer: Transformer<{
171
- document: {
172
- rootNode: unknown
173
- }
174
- }, RenderedRole>;
175
- import { Registry as Registry2 } from "resourcexjs";
176
- /**
177
- * Create a resource resolver function
178
- *
179
- * @param registry - Registry instance (required for RxrTransport)
180
- * @returns Resource resolver function that accepts ARP URLs
181
- *
182
- * @example
183
- * ```typescript
184
- * const resolver = createResourceResolver(registry);
185
- * const content = await resolver('arp:text:rxr://localhost/my.role@1.0.0/thought/first.thought.md');
186
- * ```
187
- */
188
- declare function createResourceResolver(registry: Registry2): ResourceResolver;
189
- declare const VERSION: string;
190
- export { thoughtSchema, roleType, roleTransformer, roleSchema, loadRole, knowledgeSchema, executionSchema, defineRoleSchemas, createResourceResolver, VERSION, ThoughtSubTag, RoleXError, RoleTransformer, RoleSchemas, RoleLoadError, ResourceResolver, ResourceResolveError, RenderedRole, ParsedThought, ParsedExecution, ExecutionSubTag, DPMLParseError };
196
+
197
+ export type { Directory, Feature, Goal, Identity, Organization, Plan, Platform, Role, RoleEntry, Scenario, Skill, Task };