claude-flow 3.32.10 → 3.32.12
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/v3/@claude-flow/cli/catalog-manifest.json +2 -2
- package/v3/@claude-flow/cli/dist/src/commands/swarm.js +42 -1
- package/v3/@claude-flow/cli/dist/src/memory/memory-bridge.js +56 -35
- package/v3/@claude-flow/cli/dist/src/permission/permission-audit.d.ts +41 -0
- package/v3/@claude-flow/cli/dist/src/permission/permission-audit.js +88 -0
- package/v3/@claude-flow/cli/dist/src/permission/permission-set.d.ts +51 -0
- package/v3/@claude-flow/cli/dist/src/permission/permission-set.js +141 -0
- package/v3/@claude-flow/cli/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.12",
|
|
4
4
|
"description": "Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -300,12 +300,23 @@ const initCommand = {
|
|
|
300
300
|
description: 'Enable V3 15-agent hierarchical mesh mode',
|
|
301
301
|
type: 'boolean',
|
|
302
302
|
default: false
|
|
303
|
-
}
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
// #2768 — dream-cycle SubagentPermissionDelegate. Ships a per-role
|
|
306
|
+
// capability manifest to `.swarm/permissions.jsonl` + an append-only
|
|
307
|
+
// audit trail. Task-tool prompts can consult the manifest; ruflo
|
|
308
|
+
// does NOT enforce at the syscall boundary (Claude Code owns that).
|
|
309
|
+
name: 'with-permissions',
|
|
310
|
+
description: 'Ship workspace-scoped permission manifest (preset: strict|standard|permissive) — dream-cycle #2768',
|
|
311
|
+
type: 'string',
|
|
312
|
+
choices: ['strict', 'standard', 'permissive'],
|
|
313
|
+
},
|
|
304
314
|
],
|
|
305
315
|
action: async (ctx) => {
|
|
306
316
|
let topology = ctx.flags.topology;
|
|
307
317
|
const maxAgents = ctx.flags.maxAgents || 15;
|
|
308
318
|
const v3Mode = ctx.flags.v3Mode;
|
|
319
|
+
const withPermissions = ctx.flags.withPermissions;
|
|
309
320
|
// V3 mode enables hierarchical-mesh hybrid
|
|
310
321
|
if (v3Mode) {
|
|
311
322
|
topology = 'hierarchical-mesh';
|
|
@@ -377,6 +388,7 @@ const initCommand = {
|
|
|
377
388
|
maxAgents: result.config.maxAgents,
|
|
378
389
|
strategy: ctx.flags.strategy || 'development',
|
|
379
390
|
v3Mode,
|
|
391
|
+
permissions: withPermissions ?? null,
|
|
380
392
|
initializedAt: result.initializedAt,
|
|
381
393
|
status: 'ready'
|
|
382
394
|
}, null, 2));
|
|
@@ -384,6 +396,35 @@ const initCommand = {
|
|
|
384
396
|
catch {
|
|
385
397
|
// Ignore errors writing state file
|
|
386
398
|
}
|
|
399
|
+
// #2768 — write the permission manifest + seed the audit trail.
|
|
400
|
+
// Optional: only fires when --with-permissions was passed. Missing
|
|
401
|
+
// module or failed I/O is non-critical; we log a dim warning and
|
|
402
|
+
// continue so a broken permission layer never blocks swarm init.
|
|
403
|
+
if (withPermissions) {
|
|
404
|
+
try {
|
|
405
|
+
const [{ resolvePreset }, { writeGrants, appendAuditEvent }] = await Promise.all([
|
|
406
|
+
import('../permission/permission-set.js'),
|
|
407
|
+
import('../permission/permission-audit.js'),
|
|
408
|
+
]);
|
|
409
|
+
const sets = resolvePreset(withPermissions);
|
|
410
|
+
writeGrants(sets, swarmDir);
|
|
411
|
+
for (const set of sets) {
|
|
412
|
+
appendAuditEvent({
|
|
413
|
+
agentId: 'swarm-init',
|
|
414
|
+
role: set.role,
|
|
415
|
+
event: 'granted',
|
|
416
|
+
capability: `preset:${withPermissions}`,
|
|
417
|
+
swarmId: result.swarmId,
|
|
418
|
+
reason: `Initial grant from swarm init --with-permissions ${withPermissions}`,
|
|
419
|
+
}, swarmDir);
|
|
420
|
+
}
|
|
421
|
+
output.writeln(output.dim(` Wrote permission manifest (preset: ${withPermissions}, ${sets.length} roles) → .swarm/permissions.jsonl`));
|
|
422
|
+
output.writeln(output.dim(` Audit trail seeded → .swarm/permission-audit.jsonl`));
|
|
423
|
+
}
|
|
424
|
+
catch (err) {
|
|
425
|
+
output.writeln(output.dim(` ⚠ permission manifest skipped: ${err instanceof Error ? err.message : String(err)}`));
|
|
426
|
+
}
|
|
427
|
+
}
|
|
387
428
|
if (ctx.flags.format === 'json') {
|
|
388
429
|
output.printJson(result);
|
|
389
430
|
}
|
|
@@ -1643,47 +1643,68 @@ export async function bridgeRecordFeedback(options) {
|
|
|
1643
1643
|
try {
|
|
1644
1644
|
let controller = 'none';
|
|
1645
1645
|
let updated = 0;
|
|
1646
|
-
//
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1646
|
+
// Real intelligence-pipeline write (#2786 fix-3, 2026-07-26 sweep follow-up).
|
|
1647
|
+
// The prior code called `learningSystem.recordFeedback/.record` and
|
|
1648
|
+
// `reasoningBank.recordOutcome/.record` — none of those methods exist on
|
|
1649
|
+
// the LocalSonaCoordinator / LocalReasoningBank instances the bridge
|
|
1650
|
+
// actually wires into the registry (see initializeIntelligence in
|
|
1651
|
+
// memory/intelligence.ts). The silent catch made it look successful.
|
|
1652
|
+
//
|
|
1653
|
+
// The REAL public API is `intelligence.recordTrajectory(steps, verdict)`
|
|
1654
|
+
// — same call `hooks_post-command` already uses (hooks-tools.ts).
|
|
1655
|
+
// It initializes lazily, embeds the step, and drives both the SONA
|
|
1656
|
+
// coordinator and pattern distillation.
|
|
1657
|
+
try {
|
|
1658
|
+
const intelligence = await import('./intelligence.js');
|
|
1659
|
+
const verdict = options.success ? 'success' : 'failure';
|
|
1660
|
+
const recorded = await intelligence.recordTrajectory([{
|
|
1661
|
+
type: 'action',
|
|
1662
|
+
content: `Task ${options.taskId} completed by ${options.agent || 'unknown'} — success=${options.success}, quality=${options.quality.toFixed(3)}`,
|
|
1663
|
+
metadata: {
|
|
1664
|
+
taskId: options.taskId,
|
|
1665
|
+
agent: options.agent,
|
|
1666
|
+
quality: options.quality,
|
|
1667
|
+
duration: options.duration,
|
|
1654
1668
|
// ADR-147 P2: forward spawn-tree lineage if present
|
|
1655
|
-
parentAgentId: options.parentAgentId,
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
}
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
updated++;
|
|
1664
|
-
}
|
|
1669
|
+
parentAgentId: options.parentAgentId,
|
|
1670
|
+
depth: options.depth,
|
|
1671
|
+
},
|
|
1672
|
+
timestamp: Date.now(),
|
|
1673
|
+
}], verdict);
|
|
1674
|
+
if (recorded) {
|
|
1675
|
+
controller = 'intelligence';
|
|
1676
|
+
updated++;
|
|
1665
1677
|
}
|
|
1666
|
-
catch { /* API mismatch — skip */ }
|
|
1667
1678
|
}
|
|
1668
|
-
|
|
1679
|
+
catch {
|
|
1680
|
+
// Intelligence init failed (missing embeddings backend etc.). Fall
|
|
1681
|
+
// through to the memory-store write below — that always succeeds via
|
|
1682
|
+
// sql.js fallback so feedback is never fully lost.
|
|
1683
|
+
}
|
|
1684
|
+
// Optional pattern store: if the caller supplied learned patterns,
|
|
1685
|
+
// add them to LocalReasoningBank via its real `.store()` method (the
|
|
1686
|
+
// one method that DOES exist on the class).
|
|
1669
1687
|
const reasoningBank = registry.get('reasoningBank');
|
|
1670
|
-
if (reasoningBank) {
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
updated++;
|
|
1688
|
+
if (reasoningBank && Array.isArray(options.patterns) && options.patterns.length) {
|
|
1689
|
+
for (const pattern of options.patterns) {
|
|
1690
|
+
try {
|
|
1691
|
+
if (typeof reasoningBank.store === 'function') {
|
|
1692
|
+
reasoningBank.store({
|
|
1693
|
+
id: `feedback-pattern-${options.taskId}-${updated}`,
|
|
1694
|
+
content: pattern,
|
|
1695
|
+
category: options.agent || 'general',
|
|
1696
|
+
confidence: options.quality,
|
|
1697
|
+
source: 'bridge-feedback',
|
|
1698
|
+
});
|
|
1699
|
+
updated++;
|
|
1700
|
+
}
|
|
1684
1701
|
}
|
|
1702
|
+
catch { /* pattern rejected — non-critical */ }
|
|
1685
1703
|
}
|
|
1686
|
-
|
|
1704
|
+
if (updated > 0 && controller === 'intelligence')
|
|
1705
|
+
controller = 'intelligence+reasoningBank';
|
|
1706
|
+
else if (updated > 0 && controller === 'none')
|
|
1707
|
+
controller = 'reasoningBank';
|
|
1687
1708
|
}
|
|
1688
1709
|
// Phase 4: SkillLibrary promotion for high-quality patterns
|
|
1689
1710
|
if (options.success && options.quality >= 0.9 && options.patterns?.length) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only permission audit log for swarm subagents (dream-cycle #2768).
|
|
3
|
+
*
|
|
4
|
+
* Every grant / check / deny / revoke event is written to
|
|
5
|
+
* `.swarm/permission-audit.jsonl` — one JSON object per line, no rewrites,
|
|
6
|
+
* no deletes. Persistence follows the same discipline as ruflo's other
|
|
7
|
+
* append-only ledgers (routing-outcomes, funnel-events) so downstream
|
|
8
|
+
* readers can tail without truncation risk.
|
|
9
|
+
*/
|
|
10
|
+
/** A single permission-audit event. */
|
|
11
|
+
export interface AuditEvent {
|
|
12
|
+
/** ISO-8601 timestamp. */
|
|
13
|
+
timestamp: string;
|
|
14
|
+
/** Opaque agent identifier — matches Task tool `name:` or a swarm-assigned slot id. */
|
|
15
|
+
agentId: string;
|
|
16
|
+
/** Symbolic role — matches PermissionSet.role. */
|
|
17
|
+
role: string;
|
|
18
|
+
/** Event class. */
|
|
19
|
+
event: 'granted' | 'checked' | 'denied' | 'revoked';
|
|
20
|
+
/** Free-form capability descriptor (`tool:Bash`, `path:src/**`, `net:api.github.com`). */
|
|
21
|
+
capability: string;
|
|
22
|
+
/** Optional swarm-scope identifier. */
|
|
23
|
+
swarmId?: string;
|
|
24
|
+
/** Optional human-readable reason. */
|
|
25
|
+
reason?: string;
|
|
26
|
+
/** Auto-generated event id for correlation. */
|
|
27
|
+
eventId: string;
|
|
28
|
+
}
|
|
29
|
+
/** Resolve `.swarm/permission-audit.jsonl` under the given (or cwd's) swarm dir. */
|
|
30
|
+
export declare function auditLogPath(swarmDir?: string): string;
|
|
31
|
+
/** Resolve `.swarm/permissions.jsonl` — the current-grants manifest. */
|
|
32
|
+
export declare function grantsPath(swarmDir?: string): string;
|
|
33
|
+
/** Append a single audit event. Never throws — failures are non-critical. */
|
|
34
|
+
export declare function appendAuditEvent(event: Omit<AuditEvent, 'eventId' | 'timestamp'>, swarmDir?: string): void;
|
|
35
|
+
/** Read every audit event. Used by review tooling. */
|
|
36
|
+
export declare function readAuditLog(swarmDir?: string): AuditEvent[];
|
|
37
|
+
/** Write the current grants manifest (overwrites) — one line per role. */
|
|
38
|
+
export declare function writeGrants(grants: unknown[], swarmDir?: string): void;
|
|
39
|
+
/** Read the current grants manifest. */
|
|
40
|
+
export declare function readGrants(swarmDir?: string): unknown[];
|
|
41
|
+
//# sourceMappingURL=permission-audit.d.ts.map
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only permission audit log for swarm subagents (dream-cycle #2768).
|
|
3
|
+
*
|
|
4
|
+
* Every grant / check / deny / revoke event is written to
|
|
5
|
+
* `.swarm/permission-audit.jsonl` — one JSON object per line, no rewrites,
|
|
6
|
+
* no deletes. Persistence follows the same discipline as ruflo's other
|
|
7
|
+
* append-only ledgers (routing-outcomes, funnel-events) so downstream
|
|
8
|
+
* readers can tail without truncation risk.
|
|
9
|
+
*/
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
13
|
+
/** Resolve `.swarm/permission-audit.jsonl` under the given (or cwd's) swarm dir. */
|
|
14
|
+
export function auditLogPath(swarmDir) {
|
|
15
|
+
const dir = swarmDir ?? path.join(process.cwd(), '.swarm');
|
|
16
|
+
return path.join(dir, 'permission-audit.jsonl');
|
|
17
|
+
}
|
|
18
|
+
/** Resolve `.swarm/permissions.jsonl` — the current-grants manifest. */
|
|
19
|
+
export function grantsPath(swarmDir) {
|
|
20
|
+
const dir = swarmDir ?? path.join(process.cwd(), '.swarm');
|
|
21
|
+
return path.join(dir, 'permissions.jsonl');
|
|
22
|
+
}
|
|
23
|
+
function ensureDirFor(filePath) {
|
|
24
|
+
const dir = path.dirname(filePath);
|
|
25
|
+
if (!fs.existsSync(dir))
|
|
26
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
/** Append a single audit event. Never throws — failures are non-critical. */
|
|
29
|
+
export function appendAuditEvent(event, swarmDir) {
|
|
30
|
+
const full = {
|
|
31
|
+
...event,
|
|
32
|
+
timestamp: new Date().toISOString(),
|
|
33
|
+
eventId: `evt-${Date.now()}-${randomBytes(4).toString('hex')}`,
|
|
34
|
+
};
|
|
35
|
+
try {
|
|
36
|
+
const p = auditLogPath(swarmDir);
|
|
37
|
+
ensureDirFor(p);
|
|
38
|
+
fs.appendFileSync(p, JSON.stringify(full) + '\n', 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
/* audit log unavailable — non-critical, don't crash the caller */
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/** Read every audit event. Used by review tooling. */
|
|
45
|
+
export function readAuditLog(swarmDir) {
|
|
46
|
+
const p = auditLogPath(swarmDir);
|
|
47
|
+
if (!fs.existsSync(p))
|
|
48
|
+
return [];
|
|
49
|
+
const raw = fs.readFileSync(p, 'utf-8');
|
|
50
|
+
return raw
|
|
51
|
+
.split('\n')
|
|
52
|
+
.filter((line) => line.length > 0)
|
|
53
|
+
.map((line) => {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(line);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
.filter((e) => e !== null);
|
|
62
|
+
}
|
|
63
|
+
/** Write the current grants manifest (overwrites) — one line per role. */
|
|
64
|
+
export function writeGrants(grants, swarmDir) {
|
|
65
|
+
const p = grantsPath(swarmDir);
|
|
66
|
+
ensureDirFor(p);
|
|
67
|
+
fs.writeFileSync(p, grants.map((g) => JSON.stringify(g)).join('\n') + '\n', 'utf-8');
|
|
68
|
+
}
|
|
69
|
+
/** Read the current grants manifest. */
|
|
70
|
+
export function readGrants(swarmDir) {
|
|
71
|
+
const p = grantsPath(swarmDir);
|
|
72
|
+
if (!fs.existsSync(p))
|
|
73
|
+
return [];
|
|
74
|
+
const raw = fs.readFileSync(p, 'utf-8');
|
|
75
|
+
return raw
|
|
76
|
+
.split('\n')
|
|
77
|
+
.filter((line) => line.length > 0)
|
|
78
|
+
.map((line) => {
|
|
79
|
+
try {
|
|
80
|
+
return JSON.parse(line);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
.filter((g) => g !== null);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=permission-audit.js.map
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-scoped permission model for swarm subagents (dream-cycle #2768,
|
|
3
|
+
* ClawArena finding: privilege granting is the #1 orchestration bottleneck,
|
|
4
|
+
* no LLM > 50% workspace-permission precision as team lead).
|
|
5
|
+
*
|
|
6
|
+
* SCOPE (honest): this is a METADATA + AUDIT layer, not a runtime sandbox.
|
|
7
|
+
* Claude Code's Task tool owns the actual subprocess sandbox; ruflo cannot
|
|
8
|
+
* enforce at the syscall boundary. What we CAN do:
|
|
9
|
+
* 1. Publish a per-role capability manifest that Task-tool prompts can
|
|
10
|
+
* consult ("your workspace-scoped tools are X, Y, Z; you may not use W").
|
|
11
|
+
* 2. Record every grant/check/deny/revoke to an append-only audit trail
|
|
12
|
+
* so the swarm has a reviewable permission history.
|
|
13
|
+
*
|
|
14
|
+
* That is enough to close the "permission-hygiene" half of the ClawArena
|
|
15
|
+
* finding — the "50% precision as team lead" number is about the LLM's
|
|
16
|
+
* decision QUALITY, which no runtime layer fixes.
|
|
17
|
+
*/
|
|
18
|
+
import type { PathValidator } from '@claude-flow/security';
|
|
19
|
+
/** A single agent role's capability envelope. */
|
|
20
|
+
export interface PermissionSet {
|
|
21
|
+
/** Symbolic role name — matches ruflo agent-type names (coder, tester, reviewer, …). */
|
|
22
|
+
role: string;
|
|
23
|
+
/** Tools this role MAY use. Empty array = deny-all-tools. */
|
|
24
|
+
allowedTools: string[];
|
|
25
|
+
/** Tools this role MUST NOT use (evaluated after allow — deny wins). */
|
|
26
|
+
deniedTools: string[];
|
|
27
|
+
/** Glob patterns this role MAY read/write, relative to swarm cwd. */
|
|
28
|
+
allowedPaths: string[];
|
|
29
|
+
/** Glob patterns this role MUST NOT touch (deny wins). */
|
|
30
|
+
deniedPaths: string[];
|
|
31
|
+
/** Exact-host allowlist for outbound network. Empty = deny-all-network. */
|
|
32
|
+
allowedNetworkHosts: string[];
|
|
33
|
+
/** Human-readable note explaining the intent of this envelope. */
|
|
34
|
+
notes?: string;
|
|
35
|
+
}
|
|
36
|
+
/** Built-in presets, ordered narrow → wide. Each preset ships per-role sets. */
|
|
37
|
+
export declare const PRESETS: Record<'strict' | 'standard' | 'permissive', PermissionSet[]>;
|
|
38
|
+
export type PresetName = keyof typeof PRESETS;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve a preset name to its per-role sets. Throws on unknown preset —
|
|
41
|
+
* fail loud so a typo doesn't silently degrade to permissive.
|
|
42
|
+
*/
|
|
43
|
+
export declare function resolvePreset(name: string): PermissionSet[];
|
|
44
|
+
/**
|
|
45
|
+
* Sanity-check a permission set: role name shape, no null entries.
|
|
46
|
+
* Path validation is deferred to the enforcement side (PathValidator)
|
|
47
|
+
* so this module has no @claude-flow/security runtime dep beyond a
|
|
48
|
+
* type-only import.
|
|
49
|
+
*/
|
|
50
|
+
export declare function validatePermissionSet(set: PermissionSet, _validator?: PathValidator): string[];
|
|
51
|
+
//# sourceMappingURL=permission-set.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace-scoped permission model for swarm subagents (dream-cycle #2768,
|
|
3
|
+
* ClawArena finding: privilege granting is the #1 orchestration bottleneck,
|
|
4
|
+
* no LLM > 50% workspace-permission precision as team lead).
|
|
5
|
+
*
|
|
6
|
+
* SCOPE (honest): this is a METADATA + AUDIT layer, not a runtime sandbox.
|
|
7
|
+
* Claude Code's Task tool owns the actual subprocess sandbox; ruflo cannot
|
|
8
|
+
* enforce at the syscall boundary. What we CAN do:
|
|
9
|
+
* 1. Publish a per-role capability manifest that Task-tool prompts can
|
|
10
|
+
* consult ("your workspace-scoped tools are X, Y, Z; you may not use W").
|
|
11
|
+
* 2. Record every grant/check/deny/revoke to an append-only audit trail
|
|
12
|
+
* so the swarm has a reviewable permission history.
|
|
13
|
+
*
|
|
14
|
+
* That is enough to close the "permission-hygiene" half of the ClawArena
|
|
15
|
+
* finding — the "50% precision as team lead" number is about the LLM's
|
|
16
|
+
* decision QUALITY, which no runtime layer fixes.
|
|
17
|
+
*/
|
|
18
|
+
/** Built-in presets, ordered narrow → wide. Each preset ships per-role sets. */
|
|
19
|
+
export const PRESETS = {
|
|
20
|
+
/**
|
|
21
|
+
* strict — read-only file access, no network, no bash. Suitable for
|
|
22
|
+
* research / review / planning agents. Denies every destructive surface.
|
|
23
|
+
*/
|
|
24
|
+
strict: [
|
|
25
|
+
{
|
|
26
|
+
role: 'researcher',
|
|
27
|
+
allowedTools: ['Read', 'Grep', 'Glob'],
|
|
28
|
+
deniedTools: ['Bash', 'Edit', 'Write', 'NotebookEdit'],
|
|
29
|
+
allowedPaths: ['**/*'],
|
|
30
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem'],
|
|
31
|
+
allowedNetworkHosts: [],
|
|
32
|
+
notes: 'Read-only research role; no filesystem writes, no network, no shell.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
role: 'reviewer',
|
|
36
|
+
allowedTools: ['Read', 'Grep', 'Glob'],
|
|
37
|
+
deniedTools: ['Bash', 'Edit', 'Write', 'NotebookEdit'],
|
|
38
|
+
allowedPaths: ['**/*'],
|
|
39
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem'],
|
|
40
|
+
allowedNetworkHosts: [],
|
|
41
|
+
notes: 'Read-only code review; findings emitted via return message, not filesystem writes.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
role: 'planner',
|
|
45
|
+
allowedTools: ['Read', 'Grep', 'Glob'],
|
|
46
|
+
deniedTools: ['Bash', 'Edit', 'Write', 'NotebookEdit'],
|
|
47
|
+
allowedPaths: ['**/*'],
|
|
48
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem'],
|
|
49
|
+
allowedNetworkHosts: [],
|
|
50
|
+
notes: 'Read-only planning; produces plan text, no side effects.',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
/**
|
|
54
|
+
* standard — the default. Read + edit under cwd, no bash, allowlisted
|
|
55
|
+
* network hosts for common dev workflows (github, npm registry, docs).
|
|
56
|
+
* Suitable for implementation agents doing bounded file changes.
|
|
57
|
+
*/
|
|
58
|
+
standard: [
|
|
59
|
+
{
|
|
60
|
+
role: 'coder',
|
|
61
|
+
allowedTools: ['Read', 'Grep', 'Glob', 'Edit', 'Write', 'NotebookEdit'],
|
|
62
|
+
deniedTools: ['Bash'],
|
|
63
|
+
allowedPaths: ['src/**', 'tests/**', '__tests__/**', 'lib/**', 'plugins/**', 'v3/**', 'docs/**', 'CHANGELOG.md', 'package.json'],
|
|
64
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem', '**/.git/**', '**/node_modules/**'],
|
|
65
|
+
allowedNetworkHosts: ['api.github.com', 'registry.npmjs.org', 'docs.rs', 'crates.io'],
|
|
66
|
+
notes: 'Bounded code writer; edits under source directories, no shell, allowlist network.',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
role: 'tester',
|
|
70
|
+
allowedTools: ['Read', 'Grep', 'Glob', 'Edit', 'Write'],
|
|
71
|
+
deniedTools: ['Bash', 'NotebookEdit'],
|
|
72
|
+
allowedPaths: ['tests/**', '__tests__/**', '**/*.test.*', '**/*.spec.*'],
|
|
73
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem'],
|
|
74
|
+
allowedNetworkHosts: [],
|
|
75
|
+
notes: 'Tests-only writer; scope pinned to test directories and .test/.spec files.',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
role: 'reviewer',
|
|
79
|
+
allowedTools: ['Read', 'Grep', 'Glob'],
|
|
80
|
+
deniedTools: ['Bash', 'Edit', 'Write', 'NotebookEdit'],
|
|
81
|
+
allowedPaths: ['**/*'],
|
|
82
|
+
deniedPaths: ['**/.env', '**/.env.*', '**/secrets/**', '**/*.key', '**/*.pem'],
|
|
83
|
+
allowedNetworkHosts: [],
|
|
84
|
+
notes: 'Read-only reviewer; identical to strict-reviewer.',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
/**
|
|
88
|
+
* permissive — the pre-#2768 baseline. Full toolset, no path fencing.
|
|
89
|
+
* Kept for compatibility so users can opt back in explicitly. NOT a
|
|
90
|
+
* good default — the entire point of this feature is that the LLM's
|
|
91
|
+
* unaided permission decisions land under 50% precision.
|
|
92
|
+
*/
|
|
93
|
+
permissive: [
|
|
94
|
+
{
|
|
95
|
+
role: '*',
|
|
96
|
+
allowedTools: ['*'],
|
|
97
|
+
deniedTools: [],
|
|
98
|
+
allowedPaths: ['**/*'],
|
|
99
|
+
deniedPaths: [],
|
|
100
|
+
allowedNetworkHosts: ['*'],
|
|
101
|
+
notes: 'No restriction. Kept for opt-in compatibility; see #2768 for why this is not the default.',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Resolve a preset name to its per-role sets. Throws on unknown preset —
|
|
107
|
+
* fail loud so a typo doesn't silently degrade to permissive.
|
|
108
|
+
*/
|
|
109
|
+
export function resolvePreset(name) {
|
|
110
|
+
if (!(name in PRESETS)) {
|
|
111
|
+
const valid = Object.keys(PRESETS).join(', ');
|
|
112
|
+
throw new Error(`Unknown permissions preset: ${name}. Valid presets: ${valid}`);
|
|
113
|
+
}
|
|
114
|
+
return PRESETS[name];
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Sanity-check a permission set: role name shape, no null entries.
|
|
118
|
+
* Path validation is deferred to the enforcement side (PathValidator)
|
|
119
|
+
* so this module has no @claude-flow/security runtime dep beyond a
|
|
120
|
+
* type-only import.
|
|
121
|
+
*/
|
|
122
|
+
export function validatePermissionSet(set, _validator) {
|
|
123
|
+
const errors = [];
|
|
124
|
+
if (!set.role || typeof set.role !== 'string')
|
|
125
|
+
errors.push('role must be a non-empty string');
|
|
126
|
+
const arrays = [
|
|
127
|
+
['allowedTools', set.allowedTools],
|
|
128
|
+
['deniedTools', set.deniedTools],
|
|
129
|
+
['allowedPaths', set.allowedPaths],
|
|
130
|
+
['deniedPaths', set.deniedPaths],
|
|
131
|
+
['allowedNetworkHosts', set.allowedNetworkHosts],
|
|
132
|
+
];
|
|
133
|
+
for (const [key, val] of arrays) {
|
|
134
|
+
if (!Array.isArray(val))
|
|
135
|
+
errors.push(`${String(key)} must be an array`);
|
|
136
|
+
else if (val.some((v) => typeof v !== 'string'))
|
|
137
|
+
errors.push(`${String(key)} must contain only strings`);
|
|
138
|
+
}
|
|
139
|
+
return errors;
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=permission-set.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.32.
|
|
3
|
+
"version": "3.32.12",
|
|
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",
|