claude-flow 3.75.1 → 3.75.3
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/node_modules/@claude-flow/plugin-agent-federation/package.json +16 -4
- package/node_modules/@claude-flow/security/README.md +43 -0
- package/node_modules/@claude-flow/security/dist/input-validator.d.ts +3 -3
- package/node_modules/@claude-flow/security/package.json +23 -0
- package/package.json +2 -2
- package/v3/@claude-flow/cli/catalog-manifest.json +2 -2
- package/v3/@claude-flow/cli/dist/src/init/helper-companions.js +64 -2
- package/v3/@claude-flow/cli/dist/src/mcp-tools/task-tools.js +5 -0
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.d.ts +10 -3
- package/v3/@claude-flow/cli/dist/src/transfer/store/download.js +33 -16
- package/v3/@claude-flow/cli/package.json +4 -4
- package/v3/@claude-flow/shared/README.md +39 -0
- package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +114 -1516
- package/v3/@claude-flow/shared/dist/core/config/schema.js +4 -4
- package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +2 -2
- package/v3/@claude-flow/shared/dist/core/config/validator.js +17 -3
- package/v3/@claude-flow/shared/package.json +25 -4
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
"name": "@claude-flow/plugin-agent-federation",
|
|
3
3
|
"version": "1.0.7",
|
|
4
4
|
"description": "Cross-installation agent federation with zero-trust security, PII-gated data flow, and compliance-grade audit trails.",
|
|
5
|
-
"homepage": "https://
|
|
5
|
+
"homepage": "https://ruv.io",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ruvnet/ruflo.git",
|
|
9
|
+
"directory": "v3/@claude-flow/plugin-agent-federation"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/ruvnet/ruflo/issues"
|
|
13
|
+
},
|
|
6
14
|
"type": "module",
|
|
7
15
|
"main": "dist/index.js",
|
|
8
16
|
"types": "dist/index.d.ts",
|
|
@@ -33,11 +41,15 @@
|
|
|
33
41
|
"keywords": [
|
|
34
42
|
"federation",
|
|
35
43
|
"multi-agent",
|
|
36
|
-
"
|
|
44
|
+
"ai-agents",
|
|
45
|
+
"zero-trust",
|
|
37
46
|
"pii",
|
|
38
47
|
"security",
|
|
39
|
-
"audit",
|
|
40
|
-
"compliance"
|
|
48
|
+
"audit-trail",
|
|
49
|
+
"compliance",
|
|
50
|
+
"claude-flow-plugin",
|
|
51
|
+
"claude-flow",
|
|
52
|
+
"ruflo"
|
|
41
53
|
],
|
|
42
54
|
"author": "Claude Flow Team",
|
|
43
55
|
"license": "MIT",
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/ruvnet/ruflo/main/docs/assets/readme/packages/security-boundary-quickstart.svg" alt="@claude-flow/security quickstart: a valid email passes, an invalid one is rejected with a ZodError, a bcrypt hash verifies, and a 48-character API key is generated." width="100%"></p>
|
|
2
|
+
|
|
1
3
|
# @claude-flow/security
|
|
2
4
|
|
|
5
|
+
**Security primitives for the system boundary of an agent app:** validate input, hash passwords, generate credentials, and block command injection and path traversal.
|
|
6
|
+
|
|
3
7
|
[](https://www.npmjs.com/package/@claude-flow/security)
|
|
4
8
|
[](https://www.npmjs.com/package/@claude-flow/security)
|
|
5
9
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -24,6 +28,45 @@
|
|
|
24
28
|
npm install @claude-flow/security
|
|
25
29
|
```
|
|
26
30
|
|
|
31
|
+
<!-- weaver:seo:quickstart -->
|
|
32
|
+
## Supported environments
|
|
33
|
+
|
|
34
|
+
- Node.js, ESM (`import`). The quickstart below was run on Node 22 (Linux x64).
|
|
35
|
+
- Pure JavaScript dependencies (`bcryptjs`, `zod`, `@noble/ed25519`). No native build step.
|
|
36
|
+
- Works standalone. The Ruflo CLI (`@claude-flow/cli`) isn't required.
|
|
37
|
+
|
|
38
|
+
## Quickstart (verified)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install @claude-flow/security
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// quickstart.mjs
|
|
46
|
+
import { InputValidator, EmailSchema, PasswordHasher, createCredentialGenerator } from '@claude-flow/security';
|
|
47
|
+
|
|
48
|
+
console.log('email ok:', InputValidator.validate(EmailSchema, 'user@example.com'));
|
|
49
|
+
try { InputValidator.validate(EmailSchema, 'not-an-email'); } catch (e) { console.log('rejected:', e.constructor.name); }
|
|
50
|
+
|
|
51
|
+
const hasher = new PasswordHasher({ rounds: 12 });
|
|
52
|
+
const hash = await hasher.hash('CorrectHorseBatteryStaple9');
|
|
53
|
+
console.log('hash prefix:', hash.slice(0, 7), 'verify:', await hasher.verify('CorrectHorseBatteryStaple9', hash));
|
|
54
|
+
|
|
55
|
+
const apiKey = createCredentialGenerator().generateApiKey('ck_live_');
|
|
56
|
+
console.log('api key prefix:', apiKey.key.slice(0, 8), 'length:', apiKey.key.length);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Expected output (`node quickstart.mjs`, @claude-flow/security 3.0.7):
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
email ok: user@example.com
|
|
63
|
+
rejected: ZodError
|
|
64
|
+
hash prefix: $2b$12$ verify: true
|
|
65
|
+
api key prefix: ck_live_ length: 48
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**Next:** add prompt-injection and jailbreak detection for LLM input with [`@claude-flow/aidefence`](https://www.npmjs.com/package/@claude-flow/aidefence).
|
|
69
|
+
|
|
27
70
|
## Standalone use (without the Ruflo CLI)
|
|
28
71
|
|
|
29
72
|
This is a plain library — every primitive (`PasswordHasher`,
|
|
@@ -243,10 +243,10 @@ export declare const TaskInputSchema: z.ZodObject<{
|
|
|
243
243
|
"project-coordinator": "project-coordinator";
|
|
244
244
|
}>;
|
|
245
245
|
priority: z.ZodOptional<z.ZodEnum<{
|
|
246
|
-
critical: "critical";
|
|
247
|
-
high: "high";
|
|
248
|
-
medium: "medium";
|
|
249
246
|
low: "low";
|
|
247
|
+
medium: "medium";
|
|
248
|
+
high: "high";
|
|
249
|
+
critical: "critical";
|
|
250
250
|
}>>;
|
|
251
251
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
252
252
|
}, z.core.$strip>;
|
|
@@ -3,6 +3,29 @@
|
|
|
3
3
|
"version": "3.0.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Security module - CVE fixes, input validation, path security",
|
|
6
|
+
"homepage": "https://ruv.io",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/ruvnet/ruflo.git",
|
|
10
|
+
"directory": "v3/@claude-flow/security"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ruvnet/ruflo/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"security",
|
|
17
|
+
"input-validation",
|
|
18
|
+
"path-traversal",
|
|
19
|
+
"command-injection",
|
|
20
|
+
"password-hashing",
|
|
21
|
+
"bcrypt",
|
|
22
|
+
"credential-management",
|
|
23
|
+
"zod",
|
|
24
|
+
"ai-agents",
|
|
25
|
+
"claude-flow",
|
|
26
|
+
"ruflo",
|
|
27
|
+
"typescript"
|
|
28
|
+
],
|
|
6
29
|
"main": "dist/index.js",
|
|
7
30
|
"types": "dist/index.d.ts",
|
|
8
31
|
"files": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.75.
|
|
3
|
+
"version": "3.75.3",
|
|
4
4
|
"workspaces": [
|
|
5
5
|
"v3/@claude-flow/codex",
|
|
6
6
|
"v3/@claude-flow/mcp",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"@claude-flow/neural": "3.0.3",
|
|
76
76
|
"@claude-flow/plugin-agent-federation": "1.0.7",
|
|
77
77
|
"@claude-flow/security": "3.0.7",
|
|
78
|
-
"@claude-flow/shared": "3.0.
|
|
78
|
+
"@claude-flow/shared": "3.0.8",
|
|
79
79
|
"@electron/asar": "^4.3.1",
|
|
80
80
|
"@iarna/toml": "^2.2.5",
|
|
81
81
|
"@noble/ed25519": "2.3.0",
|
|
@@ -12,9 +12,40 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import * as fs from 'fs';
|
|
14
14
|
import * as path from 'path';
|
|
15
|
+
import { randomUUID } from 'node:crypto';
|
|
15
16
|
export const COMMONJS_COMPANION_HELPERS = ['session.cjs', 'memory.cjs'];
|
|
17
|
+
/** Missing is distinct from unreadable, a symlink (including dangling), or another file type. */
|
|
18
|
+
function companionState(target) {
|
|
19
|
+
try {
|
|
20
|
+
const stat = fs.lstatSync(target);
|
|
21
|
+
return stat.isFile() && !stat.isSymbolicLink() ? 'regular' : 'unsafe';
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return error.code === 'ENOENT' ? 'missing' : 'unsafe';
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** The project/user root can itself be an alias; its helper directories may not be links. */
|
|
28
|
+
function safeHelpersDirectory(helpersDir) {
|
|
29
|
+
try {
|
|
30
|
+
for (const directory of [path.dirname(helpersDir), helpersDir]) {
|
|
31
|
+
const stat = fs.lstatSync(directory);
|
|
32
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
16
41
|
export async function ensureCommonJsCompanions(helpersDir, force = false) {
|
|
17
|
-
|
|
42
|
+
helpersDir = path.resolve(helpersDir);
|
|
43
|
+
if (!safeHelpersDirectory(helpersDir))
|
|
44
|
+
return [];
|
|
45
|
+
const missing = COMMONJS_COMPANION_HELPERS.filter((name) => {
|
|
46
|
+
const state = companionState(path.join(helpersDir, name));
|
|
47
|
+
return state === 'missing' || (force && state === 'regular');
|
|
48
|
+
});
|
|
18
49
|
if (missing.length === 0)
|
|
19
50
|
return [];
|
|
20
51
|
const gen = await import('./helpers-generator.js');
|
|
@@ -24,11 +55,42 @@ export async function ensureCommonJsCompanions(helpersDir, force = false) {
|
|
|
24
55
|
};
|
|
25
56
|
const written = [];
|
|
26
57
|
for (const name of missing) {
|
|
58
|
+
const target = path.join(helpersDir, name);
|
|
59
|
+
const temporary = path.join(helpersDir, `.${name}.${randomUUID()}.tmp`);
|
|
60
|
+
let created = false;
|
|
27
61
|
try {
|
|
28
|
-
|
|
62
|
+
// The import above yields: recheck before writing, and again before publication.
|
|
63
|
+
if (!safeHelpersDirectory(helpersDir))
|
|
64
|
+
continue;
|
|
65
|
+
const state = companionState(target);
|
|
66
|
+
if (state === 'unsafe' || (!force && state === 'regular'))
|
|
67
|
+
continue;
|
|
68
|
+
const descriptor = fs.openSync(temporary, 'wx', 0o755);
|
|
69
|
+
created = true;
|
|
70
|
+
try {
|
|
71
|
+
fs.writeFileSync(descriptor, content[name](), { encoding: 'utf-8' });
|
|
72
|
+
fs.fchmodSync(descriptor, 0o755);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
fs.closeSync(descriptor);
|
|
76
|
+
}
|
|
77
|
+
if (!safeHelpersDirectory(helpersDir))
|
|
78
|
+
continue;
|
|
79
|
+
const finalState = companionState(target);
|
|
80
|
+
if (finalState === 'unsafe' || (!force && finalState === 'regular'))
|
|
81
|
+
continue;
|
|
82
|
+
fs.renameSync(temporary, target);
|
|
29
83
|
written.push(name);
|
|
30
84
|
}
|
|
31
85
|
catch { /* best-effort: hook-handler degrades gracefully without it */ }
|
|
86
|
+
finally {
|
|
87
|
+
if (created) {
|
|
88
|
+
try {
|
|
89
|
+
fs.unlinkSync(temporary);
|
|
90
|
+
}
|
|
91
|
+
catch { /* renamed or already removed */ }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
32
94
|
}
|
|
33
95
|
return written;
|
|
34
96
|
}
|
|
@@ -392,6 +392,11 @@ export const taskTools = [
|
|
|
392
392
|
if (newStatus === 'in_progress' && !task.startedAt) {
|
|
393
393
|
task.startedAt = new Date().toISOString();
|
|
394
394
|
}
|
|
395
|
+
// Reopening a finished task (completed/failed/cancelled -> pending/in_progress) makes it unfinished
|
|
396
|
+
// again, so it must not keep reporting the completedAt of the run that was undone.
|
|
397
|
+
if (newStatus === 'pending' || newStatus === 'in_progress') {
|
|
398
|
+
task.completedAt = null;
|
|
399
|
+
}
|
|
395
400
|
// A finished task frees its workers, as task_complete and task_cancel do; otherwise a worker
|
|
396
401
|
// whose task was finished through task_update stays `busy` forever, and a later task_complete
|
|
397
402
|
// returns early because the status already reads completed.
|
|
@@ -46,9 +46,16 @@ export declare class PatternDownloader {
|
|
|
46
46
|
*/
|
|
47
47
|
private verifySignature;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
49
|
+
* Resolve the Ed25519 public key a pattern's signature must verify against
|
|
50
|
+
* (#4750). Returns whether the key is *pinned* (came from the operator's
|
|
51
|
+
* config.trustedRegistryPublicKeys) or merely the entry's own self-declared
|
|
52
|
+
* publicKey. Callers that enforce verification must treat a self-declared key
|
|
53
|
+
* as untrusted: otherwise a malicious registry entry can sign its own content
|
|
54
|
+
* with its own key and pass (the exact gap #4750 was filed to close).
|
|
55
|
+
*/
|
|
56
|
+
private resolveVerificationKey;
|
|
57
|
+
/**
|
|
58
|
+
* Thin wrapper kept for callers that only need a usable key.
|
|
52
59
|
*/
|
|
53
60
|
private resolveTrustedPublicKey;
|
|
54
61
|
/**
|
|
@@ -76,11 +76,21 @@ export class PatternDownloader {
|
|
|
76
76
|
console.log(`[Download] Checksum verified!`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
// Verify signature
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
//
|
|
83
|
-
|
|
79
|
+
// Verify the signature (#4750). A signature that does not verify against
|
|
80
|
+
// the resolved key is refused rather than written. When requireVerification
|
|
81
|
+
// is on, verification must be backed by a *pinned* key: a self-declared
|
|
82
|
+
// pattern.publicKey is not trusted, so an entry that supplies its own key
|
|
83
|
+
// is refused rather than allowed to self-sign.
|
|
84
|
+
const { key: trustedKey, pinned } = this.resolveVerificationKey(pattern);
|
|
85
|
+
if (this.config.requireVerification && !pinned) {
|
|
86
|
+
console.warn(`[Download] requireVerification is on but no trusted (pinned) key is configured for ${pattern.id}; refusing self-declared key. Configure StoreConfig.trustedRegistryPublicKeys to download this pattern, or disable requireVerification.`);
|
|
87
|
+
return {
|
|
88
|
+
success: false,
|
|
89
|
+
pattern,
|
|
90
|
+
verified: false,
|
|
91
|
+
size: content.length,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
84
94
|
if (pattern.signature && trustedKey) {
|
|
85
95
|
const sigVerified = await verifyEd25519(content, pattern.signature, trustedKey);
|
|
86
96
|
if (!sigVerified) {
|
|
@@ -93,6 +103,7 @@ export class PatternDownloader {
|
|
|
93
103
|
};
|
|
94
104
|
}
|
|
95
105
|
console.log(`[Download] Signature verified!`);
|
|
106
|
+
verified = true;
|
|
96
107
|
}
|
|
97
108
|
else if (this.config.requireVerification) {
|
|
98
109
|
console.warn(`[Download] No verifiable signature and requireVerification is on, not writing the pattern.`);
|
|
@@ -288,32 +299,38 @@ export class PatternDownloader {
|
|
|
288
299
|
}
|
|
289
300
|
}
|
|
290
301
|
/**
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
302
|
+
* Resolve the Ed25519 public key a pattern's signature must verify against
|
|
303
|
+
* (#4750). Returns whether the key is *pinned* (came from the operator's
|
|
304
|
+
* config.trustedRegistryPublicKeys) or merely the entry's own self-declared
|
|
305
|
+
* publicKey. Callers that enforce verification must treat a self-declared key
|
|
306
|
+
* as untrusted: otherwise a malicious registry entry can sign its own content
|
|
307
|
+
* with its own key and pass (the exact gap #4750 was filed to close).
|
|
294
308
|
*/
|
|
295
|
-
|
|
296
|
-
// Prefer an explicitly configured trusted key (keyed by registry name /
|
|
297
|
-
// IPNS name). Otherwise fall back to the entry's own declared public key,
|
|
298
|
-
// which is only acceptable when it is a well-formed ed25519 key.
|
|
309
|
+
resolveVerificationKey(pattern) {
|
|
299
310
|
const trusted = this.config.trustedRegistryPublicKeys;
|
|
300
311
|
if (trusted) {
|
|
301
312
|
const candidates = [pattern.author?.id, pattern.source, pattern.id].filter(Boolean);
|
|
302
313
|
for (const key of candidates) {
|
|
303
314
|
const pinned = trusted[key];
|
|
304
315
|
if (pinned && pinned.startsWith('ed25519:')) {
|
|
305
|
-
return pinned;
|
|
316
|
+
return { key: pinned, pinned: true };
|
|
306
317
|
}
|
|
307
318
|
}
|
|
308
319
|
// Any configured key also matches a pattern that declares the same key.
|
|
309
320
|
if (pattern.publicKey && Object.values(trusted).includes(pattern.publicKey)) {
|
|
310
|
-
return pattern.publicKey;
|
|
321
|
+
return { key: pattern.publicKey, pinned: true };
|
|
311
322
|
}
|
|
312
323
|
}
|
|
313
324
|
if (pattern.publicKey && pattern.publicKey.startsWith('ed25519:')) {
|
|
314
|
-
return pattern.publicKey;
|
|
325
|
+
return { key: pattern.publicKey, pinned: false };
|
|
315
326
|
}
|
|
316
|
-
return null;
|
|
327
|
+
return { key: null, pinned: false };
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Thin wrapper kept for callers that only need a usable key.
|
|
331
|
+
*/
|
|
332
|
+
resolveTrustedPublicKey(pattern) {
|
|
333
|
+
return this.resolveVerificationKey(pattern).key;
|
|
317
334
|
}
|
|
318
335
|
/**
|
|
319
336
|
* Sanitize a pattern's name/version and assert the resulting path stays inside
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.75.
|
|
3
|
+
"version": "3.75.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@claude-flow/neural": "3.0.3",
|
|
108
108
|
"@claude-flow/plugin-agent-federation": "1.0.7",
|
|
109
109
|
"@claude-flow/security": "3.0.7",
|
|
110
|
-
"@claude-flow/shared": "3.0.
|
|
110
|
+
"@claude-flow/shared": "3.0.8",
|
|
111
111
|
"@iarna/toml": "^2.2.5",
|
|
112
112
|
"@metaharness/darwin": "~0.13.0",
|
|
113
113
|
"@noble/ed25519": "2.3.0",
|
|
@@ -130,12 +130,12 @@
|
|
|
130
130
|
"ws": "^8.21.0",
|
|
131
131
|
"yaml": "^2.8.0",
|
|
132
132
|
"zod": "^3.22.0",
|
|
133
|
-
"@claude-flow/memory": "3.3.
|
|
133
|
+
"@claude-flow/memory": "3.3.1"
|
|
134
134
|
},
|
|
135
135
|
"optionalDependencies": {
|
|
136
136
|
"@agntcy/slim-bindings": "2.1.1",
|
|
137
137
|
"@claude-flow/aidefence": "3.2.1",
|
|
138
|
-
"@claude-flow/memory": "3.3.
|
|
138
|
+
"@claude-flow/memory": "3.3.1",
|
|
139
139
|
"@metaharness/flywheel": "~0.1.10",
|
|
140
140
|
"@metaharness/radio": "~0.1.0",
|
|
141
141
|
"@metaharness/turn-credit": "~0.1.0",
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @claude-flow/shared
|
|
2
2
|
|
|
3
|
+
<!-- adr-356:quickstart:start -->
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
**@claude-flow/shared** — Shared types, Zod config schemas and validators, the event bus and resilience helpers that the other `@claude-flow` packages build on.
|
|
7
|
+
|
|
8
|
+
**Supported environments:** Node.js 20+ · ESM · Linux, macOS, Windows (pure JavaScript)
|
|
9
|
+
|
|
10
|
+
## Quickstart
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @claude-flow/shared
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
import { validateAgentConfig } from '@claude-flow/shared';
|
|
18
|
+
|
|
19
|
+
const ok = validateAgentConfig({ id: 'coder-1', name: 'Coder', type: 'coder' });
|
|
20
|
+
console.log(ok.success, ok.data.maxConcurrentTasks, ok.data.priority);
|
|
21
|
+
|
|
22
|
+
const bad = validateAgentConfig({ id: 'coder-1', name: 'Coder', type: 'coder', priority: 500 });
|
|
23
|
+
console.log(bad.success, bad.errors.map((e) => `${e.path}: ${e.code}`).join(', '));
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Expected output:
|
|
27
|
+
|
|
28
|
+
```text
|
|
29
|
+
true 5 50
|
|
30
|
+
false priority: too_big
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Next: [`@claude-flow/hooks`](https://www.npmjs.com/package/@claude-flow/hooks) builds its lifecycle hooks on these types.
|
|
34
|
+
<!-- adr-356:quickstart:end -->
|
|
35
|
+
|
|
3
36
|
[](https://www.npmjs.com/package/@claude-flow/shared)
|
|
4
37
|
[](https://www.npmjs.com/package/@claude-flow/shared)
|
|
5
38
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -321,3 +354,9 @@ This package is a dependency of all other @claude-flow modules:
|
|
|
321
354
|
## License
|
|
322
355
|
|
|
323
356
|
MIT
|
|
357
|
+
|
|
358
|
+
<!-- adr-356:footer:start -->
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
Built by [rUv](https://ruv.io) · [ruv.io](https://ruv.io) · [Source](https://github.com/ruvnet/ruflo/tree/main/v3/@claude-flow/shared)
|
|
362
|
+
<!-- adr-356:footer:end -->
|