@forwardimpact/model 0.4.0 → 0.7.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/README.md +2 -2
- package/package.json +17 -15
- package/{lib → src}/agent.js +20 -22
- package/{lib → src}/derivation.js +6 -9
- package/{lib → src}/index.js +59 -17
- package/{lib → src}/interview.js +450 -21
- package/{lib → src}/job-cache.js +7 -7
- package/{lib → src}/matching.js +38 -28
- package/{lib → src}/modifiers.js +4 -4
- package/src/policies/composed.js +111 -0
- package/src/policies/filters.js +104 -0
- package/src/policies/index.js +128 -0
- package/src/policies/orderings.js +300 -0
- package/src/policies/predicates.js +177 -0
- package/src/policies/thresholds.js +160 -0
- package/src/profile.js +182 -0
- package/{lib → src}/progression.js +8 -13
- package/{lib → src}/toolkit.js +3 -3
- package/lib/profile.js +0 -262
- /package/{lib → src}/checklist.js +0 -0
- /package/{lib → src}/job.js +0 -0
package/src/profile.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unified Profile Derivation
|
|
3
|
+
*
|
|
4
|
+
* Shared functions for deriving skill and behaviour profiles for both
|
|
5
|
+
* human jobs and AI agents.
|
|
6
|
+
*
|
|
7
|
+
* - prepareBaseProfile() - full derivation with configurable options
|
|
8
|
+
* - prepareAgentProfile() - convenience wrapper with agent-specific filtering
|
|
9
|
+
*
|
|
10
|
+
* @see policies/predicates.js - Entry-level predicate functions
|
|
11
|
+
* @see policies/filters.js - Matrix-level filter functions
|
|
12
|
+
* @see policies/orderings.js - Comparator functions
|
|
13
|
+
* @see policies/composed.js - Composed policies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import {
|
|
17
|
+
deriveSkillMatrix,
|
|
18
|
+
deriveBehaviourProfile,
|
|
19
|
+
deriveResponsibilities,
|
|
20
|
+
} from "./derivation.js";
|
|
21
|
+
|
|
22
|
+
import {
|
|
23
|
+
isAgentEligible,
|
|
24
|
+
filterHighestLevel,
|
|
25
|
+
compareByLevelDesc,
|
|
26
|
+
compareByMaturityDesc,
|
|
27
|
+
} from "./policies/index.js";
|
|
28
|
+
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// Utility Functions
|
|
31
|
+
// =============================================================================
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Build set of capabilities with positive track modifiers
|
|
35
|
+
* @param {Object} track - Track definition
|
|
36
|
+
* @returns {Set<string>} Set of capability IDs with positive modifiers
|
|
37
|
+
*/
|
|
38
|
+
export function getPositiveTrackCapabilities(track) {
|
|
39
|
+
return new Set(
|
|
40
|
+
Object.entries(track.skillModifiers || {})
|
|
41
|
+
.filter(([_, modifier]) => modifier > 0)
|
|
42
|
+
.map(([capability]) => capability),
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// Profile Derivation
|
|
48
|
+
// =============================================================================
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} ProfileOptions
|
|
52
|
+
* @property {boolean} [excludeHumanOnly=false] - Filter out human-only skills
|
|
53
|
+
* @property {boolean} [keepHighestLevelOnly=false] - Keep only skills at the highest derived level
|
|
54
|
+
* @property {boolean} [sortByLevel=false] - Sort skills by level descending
|
|
55
|
+
* @property {boolean} [sortByMaturity=false] - Sort behaviours by maturity descending
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} BaseProfile
|
|
60
|
+
* @property {Array} skillMatrix - Derived skill matrix
|
|
61
|
+
* @property {Array} behaviourProfile - Derived behaviour profile
|
|
62
|
+
* @property {Array} derivedResponsibilities - Derived responsibilities (if capabilities provided)
|
|
63
|
+
* @property {Object} discipline - The discipline
|
|
64
|
+
* @property {Object} track - The track
|
|
65
|
+
* @property {Object} grade - The grade
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Prepare a base profile shared by jobs and agents
|
|
70
|
+
*
|
|
71
|
+
* This is the unified entry point for profile derivation. Both human jobs
|
|
72
|
+
* and AI agents use this function, with different options:
|
|
73
|
+
*
|
|
74
|
+
* - Human jobs: No filtering, default sorting by type
|
|
75
|
+
* - AI agents: Use prepareAgentProfile() for agent-specific filtering
|
|
76
|
+
*
|
|
77
|
+
* @param {Object} params
|
|
78
|
+
* @param {Object} params.discipline - The discipline
|
|
79
|
+
* @param {Object} params.track - The track
|
|
80
|
+
* @param {Object} params.grade - The grade
|
|
81
|
+
* @param {Array} params.skills - All available skills
|
|
82
|
+
* @param {Array} params.behaviours - All available behaviours
|
|
83
|
+
* @param {Array} [params.capabilities] - Optional capabilities for responsibility derivation
|
|
84
|
+
* @param {ProfileOptions} [params.options={}] - Filtering and sorting options
|
|
85
|
+
* @returns {BaseProfile} The prepared profile
|
|
86
|
+
*/
|
|
87
|
+
export function prepareBaseProfile({
|
|
88
|
+
discipline,
|
|
89
|
+
track,
|
|
90
|
+
grade,
|
|
91
|
+
skills,
|
|
92
|
+
behaviours,
|
|
93
|
+
capabilities,
|
|
94
|
+
options = {},
|
|
95
|
+
}) {
|
|
96
|
+
const {
|
|
97
|
+
excludeHumanOnly = false,
|
|
98
|
+
keepHighestLevelOnly = false,
|
|
99
|
+
sortByLevel = false,
|
|
100
|
+
sortByMaturity = false,
|
|
101
|
+
} = options;
|
|
102
|
+
|
|
103
|
+
// Core derivation
|
|
104
|
+
let skillMatrix = deriveSkillMatrix({ discipline, grade, track, skills });
|
|
105
|
+
let behaviourProfile = deriveBehaviourProfile({
|
|
106
|
+
discipline,
|
|
107
|
+
grade,
|
|
108
|
+
track,
|
|
109
|
+
behaviours,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Apply skill filters using policy functions
|
|
113
|
+
if (excludeHumanOnly) {
|
|
114
|
+
skillMatrix = skillMatrix.filter(isAgentEligible);
|
|
115
|
+
}
|
|
116
|
+
if (keepHighestLevelOnly) {
|
|
117
|
+
skillMatrix = filterHighestLevel(skillMatrix);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Apply sorting using policy comparators
|
|
121
|
+
if (sortByLevel) {
|
|
122
|
+
skillMatrix = [...skillMatrix].sort(compareByLevelDesc);
|
|
123
|
+
}
|
|
124
|
+
if (sortByMaturity) {
|
|
125
|
+
behaviourProfile = [...behaviourProfile].sort(compareByMaturityDesc);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Derive responsibilities if capabilities provided
|
|
129
|
+
let derivedResponsibilities = [];
|
|
130
|
+
if (capabilities && capabilities.length > 0) {
|
|
131
|
+
derivedResponsibilities = deriveResponsibilities({
|
|
132
|
+
skillMatrix,
|
|
133
|
+
capabilities,
|
|
134
|
+
track,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
skillMatrix,
|
|
140
|
+
behaviourProfile,
|
|
141
|
+
derivedResponsibilities,
|
|
142
|
+
discipline,
|
|
143
|
+
track,
|
|
144
|
+
grade,
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Prepare a profile optimized for agent generation
|
|
150
|
+
*
|
|
151
|
+
* Applies agent-specific filtering and sorting:
|
|
152
|
+
* - Excludes human-only skills
|
|
153
|
+
* - Keeps only skills at the highest derived level
|
|
154
|
+
* - Sorts skills by level descending
|
|
155
|
+
* - Sorts behaviours by maturity descending
|
|
156
|
+
*
|
|
157
|
+
* @param {Object} params - Same as prepareBaseProfile, without options
|
|
158
|
+
* @returns {BaseProfile} The prepared profile
|
|
159
|
+
*/
|
|
160
|
+
export function prepareAgentProfile({
|
|
161
|
+
discipline,
|
|
162
|
+
track,
|
|
163
|
+
grade,
|
|
164
|
+
skills,
|
|
165
|
+
behaviours,
|
|
166
|
+
capabilities,
|
|
167
|
+
}) {
|
|
168
|
+
return prepareBaseProfile({
|
|
169
|
+
discipline,
|
|
170
|
+
track,
|
|
171
|
+
grade,
|
|
172
|
+
skills,
|
|
173
|
+
behaviours,
|
|
174
|
+
capabilities,
|
|
175
|
+
options: {
|
|
176
|
+
excludeHumanOnly: true,
|
|
177
|
+
keepHighestLevelOnly: true,
|
|
178
|
+
sortByLevel: true,
|
|
179
|
+
sortByMaturity: true,
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
@@ -11,6 +11,10 @@ import {
|
|
|
11
11
|
getBehaviourMaturityIndex,
|
|
12
12
|
} from "@forwardimpact/schema/levels";
|
|
13
13
|
import { deriveJob, isValidJobCombination } from "./derivation.js";
|
|
14
|
+
import {
|
|
15
|
+
compareBySkillChange,
|
|
16
|
+
compareByBehaviourChange,
|
|
17
|
+
} from "./policies/orderings.js";
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* @typedef {Object} SkillChange
|
|
@@ -128,14 +132,8 @@ export function calculateSkillChanges(currentMatrix, targetMatrix) {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
131
|
-
// Sort
|
|
132
|
-
|
|
133
|
-
changes.sort((a, b) => {
|
|
134
|
-
if (b.change !== a.change) return b.change - a.change;
|
|
135
|
-
if (typeOrder[a.type] !== typeOrder[b.type])
|
|
136
|
-
return typeOrder[a.type] - typeOrder[b.type];
|
|
137
|
-
return a.name.localeCompare(b.name);
|
|
138
|
-
});
|
|
135
|
+
// Sort using policy comparator
|
|
136
|
+
changes.sort(compareBySkillChange);
|
|
139
137
|
|
|
140
138
|
return changes;
|
|
141
139
|
}
|
|
@@ -172,11 +170,8 @@ export function calculateBehaviourChanges(currentProfile, targetProfile) {
|
|
|
172
170
|
}
|
|
173
171
|
}
|
|
174
172
|
|
|
175
|
-
// Sort
|
|
176
|
-
changes.sort(
|
|
177
|
-
if (b.change !== a.change) return b.change - a.change;
|
|
178
|
-
return a.name.localeCompare(b.name);
|
|
179
|
-
});
|
|
173
|
+
// Sort using policy comparator
|
|
174
|
+
changes.sort(compareByBehaviourChange);
|
|
180
175
|
|
|
181
176
|
return changes;
|
|
182
177
|
}
|
package/{lib → src}/toolkit.js
RENAMED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* level contribute tools, ensuring focused toolkits for both jobs and agents.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { filterToolkitSkills } from "./policies/composed.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @typedef {Object} ToolkitEntry
|
|
@@ -30,8 +30,8 @@ import { filterByHighestLevel } from "./profile.js";
|
|
|
30
30
|
* @returns {ToolkitEntry[]} De-duplicated toolkit sorted by name
|
|
31
31
|
*/
|
|
32
32
|
export function deriveToolkit({ skillMatrix, skills }) {
|
|
33
|
-
// Filter to highest level skills only
|
|
34
|
-
const sourceMatrix =
|
|
33
|
+
// Filter to highest level skills only using policy
|
|
34
|
+
const sourceMatrix = filterToolkitSkills(skillMatrix);
|
|
35
35
|
|
|
36
36
|
// Build skill lookup map for O(1) access
|
|
37
37
|
const skillMap = new Map(skills.map((s) => [s.id, s]));
|
package/lib/profile.js
DELETED
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified Profile Derivation
|
|
3
|
-
*
|
|
4
|
-
* Shared functions for deriving skill and behaviour profiles for both
|
|
5
|
-
* human jobs and AI agents. This module provides:
|
|
6
|
-
*
|
|
7
|
-
* 1. Filtering functions - reusable filters for skills and behaviours
|
|
8
|
-
* 2. Sorting functions - sort by level/maturity for display
|
|
9
|
-
* 3. prepareBaseProfile() - shared profile derivation used by both job.js and agent.js
|
|
10
|
-
*
|
|
11
|
-
* The core derivation (deriveSkillMatrix, deriveBehaviourProfile) remains in
|
|
12
|
-
* derivation.js. This module adds post-processing for specific use cases.
|
|
13
|
-
*
|
|
14
|
-
* Agent filtering keeps only skills at the highest derived level. This ensures
|
|
15
|
-
* track modifiers are respected—a broad skill boosted by a +1 track modifier
|
|
16
|
-
* may reach the same level as primary skills and thus be included.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import {
|
|
20
|
-
SKILL_LEVEL_ORDER,
|
|
21
|
-
BEHAVIOUR_MATURITY_ORDER,
|
|
22
|
-
} from "@forwardimpact/schema/levels";
|
|
23
|
-
import {
|
|
24
|
-
deriveSkillMatrix,
|
|
25
|
-
deriveBehaviourProfile,
|
|
26
|
-
deriveResponsibilities,
|
|
27
|
-
} from "./derivation.js";
|
|
28
|
-
|
|
29
|
-
// =============================================================================
|
|
30
|
-
// Skill Filters
|
|
31
|
-
// =============================================================================
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Build set of capabilities with positive track modifiers
|
|
35
|
-
* @param {Object} track - Track definition
|
|
36
|
-
* @returns {Set<string>} Set of capability IDs with positive modifiers
|
|
37
|
-
*/
|
|
38
|
-
export function getPositiveTrackCapabilities(track) {
|
|
39
|
-
return new Set(
|
|
40
|
-
Object.entries(track.skillModifiers || {})
|
|
41
|
-
.filter(([_, modifier]) => modifier > 0)
|
|
42
|
-
.map(([capability]) => capability),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Filter out human-only skills
|
|
48
|
-
* Human-only skills are those requiring human presence/experience
|
|
49
|
-
* @param {Array} skillMatrix - Skill matrix entries
|
|
50
|
-
* @returns {Array} Filtered skill matrix
|
|
51
|
-
*/
|
|
52
|
-
export function filterHumanOnlySkills(skillMatrix) {
|
|
53
|
-
return skillMatrix.filter((entry) => !entry.isHumanOnly);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Filter skills to keep only those at the highest derived level
|
|
58
|
-
* After track modifiers are applied, some skills will be at higher levels
|
|
59
|
-
* than others. This filter keeps only the skills at the maximum level.
|
|
60
|
-
* @param {Array} skillMatrix - Skill matrix entries with derived levels
|
|
61
|
-
* @returns {Array} Filtered skill matrix containing only highest-level skills
|
|
62
|
-
*/
|
|
63
|
-
export function filterByHighestLevel(skillMatrix) {
|
|
64
|
-
if (skillMatrix.length === 0) return [];
|
|
65
|
-
|
|
66
|
-
// Find the highest level index in the matrix
|
|
67
|
-
const maxLevelIndex = Math.max(
|
|
68
|
-
...skillMatrix.map((entry) => SKILL_LEVEL_ORDER.indexOf(entry.level)),
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
// Keep only skills at that level
|
|
72
|
-
return skillMatrix.filter(
|
|
73
|
-
(entry) => SKILL_LEVEL_ORDER.indexOf(entry.level) === maxLevelIndex,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Apply agent-specific skill filters
|
|
79
|
-
* Filters to human-only skills and keeps only skills at the highest derived level.
|
|
80
|
-
* This approach respects track modifiers—a broad skill boosted to the same level
|
|
81
|
-
* as primary skills will be included.
|
|
82
|
-
* @param {Array} skillMatrix - Skill matrix entries with derived levels
|
|
83
|
-
* @returns {Array} Filtered skill matrix
|
|
84
|
-
*/
|
|
85
|
-
export function filterSkillsForAgent(skillMatrix) {
|
|
86
|
-
// First exclude human-only skills
|
|
87
|
-
const withoutHumanOnly = filterHumanOnlySkills(skillMatrix);
|
|
88
|
-
|
|
89
|
-
// Then keep only skills at the highest level
|
|
90
|
-
return filterByHighestLevel(withoutHumanOnly);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// =============================================================================
|
|
94
|
-
// Sorting Functions
|
|
95
|
-
// =============================================================================
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Sort skills by level (highest first)
|
|
99
|
-
* Used for agent profiles where top skills should appear first
|
|
100
|
-
* @param {Array} skillMatrix - Skill matrix entries
|
|
101
|
-
* @returns {Array} Sorted skill matrix (new array)
|
|
102
|
-
*/
|
|
103
|
-
export function sortByLevelDescending(skillMatrix) {
|
|
104
|
-
return [...skillMatrix].sort((a, b) => {
|
|
105
|
-
const aIndex = SKILL_LEVEL_ORDER.indexOf(a.level);
|
|
106
|
-
const bIndex = SKILL_LEVEL_ORDER.indexOf(b.level);
|
|
107
|
-
return bIndex - aIndex;
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Sort behaviours by maturity (highest first)
|
|
113
|
-
* Used for agent profiles where top behaviours should appear first
|
|
114
|
-
* @param {Array} behaviourProfile - Behaviour profile entries
|
|
115
|
-
* @returns {Array} Sorted behaviour profile (new array)
|
|
116
|
-
*/
|
|
117
|
-
export function sortByMaturityDescending(behaviourProfile) {
|
|
118
|
-
return [...behaviourProfile].sort((a, b) => {
|
|
119
|
-
const aIndex = BEHAVIOUR_MATURITY_ORDER.indexOf(a.maturity);
|
|
120
|
-
const bIndex = BEHAVIOUR_MATURITY_ORDER.indexOf(b.maturity);
|
|
121
|
-
return bIndex - aIndex;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// =============================================================================
|
|
126
|
-
// Profile Derivation
|
|
127
|
-
// =============================================================================
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* @typedef {Object} ProfileOptions
|
|
131
|
-
* @property {boolean} [excludeHumanOnly=false] - Filter out human-only skills
|
|
132
|
-
* @property {boolean} [keepHighestLevelOnly=false] - Keep only skills at the highest derived level
|
|
133
|
-
* @property {boolean} [sortByLevel=false] - Sort skills by level descending
|
|
134
|
-
* @property {boolean} [sortByMaturity=false] - Sort behaviours by maturity descending
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @typedef {Object} BaseProfile
|
|
139
|
-
* @property {Array} skillMatrix - Derived skill matrix
|
|
140
|
-
* @property {Array} behaviourProfile - Derived behaviour profile
|
|
141
|
-
* @property {Array} derivedResponsibilities - Derived responsibilities (if capabilities provided)
|
|
142
|
-
* @property {Object} discipline - The discipline
|
|
143
|
-
* @property {Object} track - The track
|
|
144
|
-
* @property {Object} grade - The grade
|
|
145
|
-
*/
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Prepare a base profile shared by jobs and agents
|
|
149
|
-
*
|
|
150
|
-
* This is the unified entry point for profile derivation. Both human jobs
|
|
151
|
-
* and AI agents use this function, with different options:
|
|
152
|
-
*
|
|
153
|
-
* - Human jobs: No filtering, default sorting by type
|
|
154
|
-
* - AI agents: Filter humanOnly, keep only highest-level skills, sort by level
|
|
155
|
-
*
|
|
156
|
-
* @param {Object} params
|
|
157
|
-
* @param {Object} params.discipline - The discipline
|
|
158
|
-
* @param {Object} params.track - The track
|
|
159
|
-
* @param {Object} params.grade - The grade
|
|
160
|
-
* @param {Array} params.skills - All available skills
|
|
161
|
-
* @param {Array} params.behaviours - All available behaviours
|
|
162
|
-
* @param {Array} [params.capabilities] - Optional capabilities for responsibility derivation
|
|
163
|
-
* @param {ProfileOptions} [params.options={}] - Filtering and sorting options
|
|
164
|
-
* @returns {BaseProfile} The prepared profile
|
|
165
|
-
*/
|
|
166
|
-
export function prepareBaseProfile({
|
|
167
|
-
discipline,
|
|
168
|
-
track,
|
|
169
|
-
grade,
|
|
170
|
-
skills,
|
|
171
|
-
behaviours,
|
|
172
|
-
capabilities,
|
|
173
|
-
options = {},
|
|
174
|
-
}) {
|
|
175
|
-
const {
|
|
176
|
-
excludeHumanOnly = false,
|
|
177
|
-
keepHighestLevelOnly = false,
|
|
178
|
-
sortByLevel = false,
|
|
179
|
-
sortByMaturity = false,
|
|
180
|
-
} = options;
|
|
181
|
-
|
|
182
|
-
// Core derivation
|
|
183
|
-
let skillMatrix = deriveSkillMatrix({ discipline, grade, track, skills });
|
|
184
|
-
let behaviourProfile = deriveBehaviourProfile({
|
|
185
|
-
discipline,
|
|
186
|
-
grade,
|
|
187
|
-
track,
|
|
188
|
-
behaviours,
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
// Apply skill filters
|
|
192
|
-
if (excludeHumanOnly) {
|
|
193
|
-
skillMatrix = filterHumanOnlySkills(skillMatrix);
|
|
194
|
-
}
|
|
195
|
-
if (keepHighestLevelOnly) {
|
|
196
|
-
skillMatrix = filterByHighestLevel(skillMatrix);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Apply sorting
|
|
200
|
-
if (sortByLevel) {
|
|
201
|
-
skillMatrix = sortByLevelDescending(skillMatrix);
|
|
202
|
-
}
|
|
203
|
-
if (sortByMaturity) {
|
|
204
|
-
behaviourProfile = sortByMaturityDescending(behaviourProfile);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// Derive responsibilities if capabilities provided
|
|
208
|
-
let derivedResponsibilities = [];
|
|
209
|
-
if (capabilities && capabilities.length > 0) {
|
|
210
|
-
derivedResponsibilities = deriveResponsibilities({
|
|
211
|
-
skillMatrix,
|
|
212
|
-
capabilities,
|
|
213
|
-
track,
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
skillMatrix,
|
|
219
|
-
behaviourProfile,
|
|
220
|
-
derivedResponsibilities,
|
|
221
|
-
discipline,
|
|
222
|
-
track,
|
|
223
|
-
grade,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Preset options for agent profile derivation
|
|
229
|
-
* Excludes human-only skills, keeps only skills at the highest derived level,
|
|
230
|
-
* and sorts by level/maturity descending
|
|
231
|
-
*/
|
|
232
|
-
export const AGENT_PROFILE_OPTIONS = {
|
|
233
|
-
excludeHumanOnly: true,
|
|
234
|
-
keepHighestLevelOnly: true,
|
|
235
|
-
sortByLevel: true,
|
|
236
|
-
sortByMaturity: true,
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Prepare a profile optimized for agent generation
|
|
241
|
-
* Convenience function that applies AGENT_PROFILE_OPTIONS
|
|
242
|
-
* @param {Object} params - Same as prepareBaseProfile, without options
|
|
243
|
-
* @returns {BaseProfile} The prepared profile
|
|
244
|
-
*/
|
|
245
|
-
export function prepareAgentProfile({
|
|
246
|
-
discipline,
|
|
247
|
-
track,
|
|
248
|
-
grade,
|
|
249
|
-
skills,
|
|
250
|
-
behaviours,
|
|
251
|
-
capabilities,
|
|
252
|
-
}) {
|
|
253
|
-
return prepareBaseProfile({
|
|
254
|
-
discipline,
|
|
255
|
-
track,
|
|
256
|
-
grade,
|
|
257
|
-
skills,
|
|
258
|
-
behaviours,
|
|
259
|
-
capabilities,
|
|
260
|
-
options: AGENT_PROFILE_OPTIONS,
|
|
261
|
-
});
|
|
262
|
-
}
|
|
File without changes
|
/package/{lib → src}/job.js
RENAMED
|
File without changes
|