@grantx/fleet-core 0.1.3 → 0.1.4
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/package.json +1 -1
- package/src/config.js +20 -3
- package/src/index.js +1 -1
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -50,11 +50,18 @@ function findConfigFile(dir) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* Valid team IDs. Used by init.js and validated here.
|
|
54
|
+
*/
|
|
55
|
+
export const VALID_TEAM_IDS = ['grantx-ml', 'grantx-data', 'grantx-fullstack', 'grantx-skunkworks'];
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Validate config schema. Supports version 1 and 2.
|
|
59
|
+
* v1: original schema (auto-generated agents)
|
|
60
|
+
* v2: rich agents with identity, domains, frozenDecisions, repos, slack
|
|
54
61
|
*/
|
|
55
62
|
function validate(config, filePath) {
|
|
56
|
-
if (config.version !== 1) {
|
|
57
|
-
throw new Error(`${filePath}: unsupported version ${config.version} (expected 1)`);
|
|
63
|
+
if (config.version !== 1 && config.version !== 2) {
|
|
64
|
+
throw new Error(`${filePath}: unsupported version ${config.version} (expected 1 or 2)`);
|
|
58
65
|
}
|
|
59
66
|
if (!config.teamId || typeof config.teamId !== 'string') {
|
|
60
67
|
throw new Error(`${filePath}: teamId is required (string)`);
|
|
@@ -79,6 +86,16 @@ function validate(config, filePath) {
|
|
|
79
86
|
throw new Error(`${filePath}: agent "${agent.name}" must have a role (string)`);
|
|
80
87
|
}
|
|
81
88
|
}
|
|
89
|
+
|
|
90
|
+
// v2-specific: repos and slack are optional arrays/objects — validate shape if present
|
|
91
|
+
if (config.repos && !Array.isArray(config.repos)) {
|
|
92
|
+
throw new Error(`${filePath}: repos must be an array`);
|
|
93
|
+
}
|
|
94
|
+
if (config.slack) {
|
|
95
|
+
if (config.slack.botToken && typeof config.slack.botToken !== 'string') {
|
|
96
|
+
throw new Error(`${filePath}: slack.botToken must be a string`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
/**
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @grantx/fleet-core — shared engine for the fleet plugin
|
|
2
2
|
// Cross-platform, config-driven, no hardcoded Grantx references.
|
|
3
3
|
|
|
4
|
-
export { loadConfig, getAgentRoster, getConductor, getWorkerAgents } from './config.js';
|
|
4
|
+
export { loadConfig, getAgentRoster, getConductor, getWorkerAgents, VALID_TEAM_IDS } from './config.js';
|
|
5
5
|
export { AgentPool } from './agent-runner.js';
|
|
6
6
|
export { ConductorRunner, parseDispatchBlock } from './conductor-runner.js';
|
|
7
7
|
export { SmartDispatcher } from './smart-dispatcher.js';
|