@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 +186 -179
- package/dist/index.js +1 -63584
- package/dist/index.js.map +1 -20
- package/package.json +5 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,190 +1,197 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
*
|
|
29
|
-
*/
|
|
30
|
-
interface
|
|
31
|
-
|
|
32
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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
|
-
*
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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
|
-
|
|
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 };
|