sentinelayer-cli 0.6.2 → 0.8.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 +996 -996
- package/bin/create-sentinelayer.js +5 -5
- package/bin/sentinelayer-cli.js +4 -4
- package/bin/sl.js +5 -5
- package/package.json +64 -63
- package/src/agents/jules/config/definition.js +160 -160
- package/src/agents/jules/config/system-prompt.js +182 -182
- package/src/agents/jules/error-intake.js +51 -51
- package/src/agents/jules/fix-cycle.js +17 -17
- package/src/agents/jules/loop.js +457 -450
- package/src/agents/jules/pulse.js +10 -10
- package/src/agents/jules/stream.js +187 -186
- package/src/agents/jules/swarm/file-scanner.js +74 -74
- package/src/agents/jules/swarm/index.js +11 -11
- package/src/agents/jules/swarm/orchestrator.js +362 -362
- package/src/agents/jules/swarm/pattern-hunter.js +123 -123
- package/src/agents/jules/swarm/sub-agent.js +311 -309
- package/src/agents/jules/tools/aidenid-email.js +189 -189
- package/src/agents/jules/tools/auth-audit.js +1699 -1691
- package/src/agents/jules/tools/dispatch.js +340 -335
- package/src/agents/jules/tools/file-edit.js +2 -2
- package/src/agents/jules/tools/file-read.js +2 -2
- package/src/agents/jules/tools/frontend-analyze.js +570 -570
- package/src/agents/jules/tools/glob.js +2 -2
- package/src/agents/jules/tools/grep.js +2 -2
- package/src/agents/jules/tools/index.js +29 -29
- package/src/agents/jules/tools/path-guards.js +2 -2
- package/src/agents/jules/tools/runtime-audit.js +507 -507
- package/src/agents/jules/tools/shell.js +2 -2
- package/src/agents/jules/tools/url-policy.js +100 -100
- package/src/agents/persona-visuals.js +64 -61
- package/src/agents/shared-tools/dispatch-core.js +320 -315
- package/src/agents/shared-tools/file-edit.js +180 -180
- package/src/agents/shared-tools/file-read.js +100 -100
- package/src/agents/shared-tools/glob.js +168 -168
- package/src/agents/shared-tools/grep.js +228 -228
- package/src/agents/shared-tools/index.js +46 -46
- package/src/agents/shared-tools/path-guards.js +161 -161
- package/src/agents/shared-tools/shell.js +383 -383
- package/src/ai/aidenid.js +1021 -1009
- package/src/ai/client.js +553 -553
- package/src/ai/domain-target-store.js +268 -268
- package/src/ai/identity-store.js +270 -270
- package/src/ai/proxy.js +137 -137
- package/src/ai/site-store.js +145 -145
- package/src/audit/agents/architecture.js +180 -180
- package/src/audit/agents/compliance.js +179 -179
- package/src/audit/agents/documentation.js +165 -165
- package/src/audit/agents/performance.js +145 -145
- package/src/audit/agents/security.js +215 -215
- package/src/audit/agents/testing.js +172 -172
- package/src/audit/orchestrator.js +557 -557
- package/src/audit/package.js +204 -204
- package/src/audit/registry.js +284 -284
- package/src/audit/replay.js +103 -103
- package/src/auth/gate.js +400 -371
- package/src/auth/http.js +681 -611
- package/src/auth/service.js +1106 -1106
- package/src/auth/session-store.js +813 -813
- package/src/cli.js +257 -252
- package/src/commands/ai/identity-lifecycle.js +1338 -1338
- package/src/commands/ai/provision-governance.js +1272 -1272
- package/src/commands/ai/shared.js +147 -147
- package/src/commands/ai.js +11 -11
- package/src/commands/apply.js +12 -12
- package/src/commands/audit.js +1171 -1166
- package/src/commands/auth.js +419 -419
- package/src/commands/chat.js +191 -191
- package/src/commands/config.js +184 -184
- package/src/commands/cost.js +311 -311
- package/src/commands/daemon/core.js +850 -850
- package/src/commands/daemon/extended.js +1048 -1048
- package/src/commands/daemon/shared.js +213 -213
- package/src/commands/daemon.js +11 -11
- package/src/commands/guide.js +174 -174
- package/src/commands/ingest.js +58 -58
- package/src/commands/init.js +55 -55
- package/src/commands/legacy-args.js +10 -10
- package/src/commands/mcp.js +461 -461
- package/src/commands/omargate.js +29 -29
- package/src/commands/persona.js +20 -20
- package/src/commands/plugin.js +260 -260
- package/src/commands/policy.js +132 -132
- package/src/commands/prompt.js +238 -238
- package/src/commands/review.js +704 -704
- package/src/commands/scan.js +872 -872
- package/src/commands/session.js +590 -0
- package/src/commands/spec.js +778 -716
- package/src/commands/swarm.js +651 -651
- package/src/commands/telemetry.js +202 -202
- package/src/commands/watch.js +511 -511
- package/src/config/agent-dictionary.js +182 -182
- package/src/config/io.js +56 -56
- package/src/config/paths.js +18 -18
- package/src/config/schema.js +55 -55
- package/src/config/service.js +184 -184
- package/src/cost/budget.js +235 -235
- package/src/cost/history.js +188 -188
- package/src/cost/tracker.js +171 -171
- package/src/daemon/artifact-lineage.js +534 -534
- package/src/daemon/assignment-ledger.js +966 -770
- package/src/daemon/ast-parser-layer.js +258 -258
- package/src/daemon/budget-governor.js +633 -633
- package/src/daemon/callgraph-overlay.js +646 -646
- package/src/daemon/error-worker.js +1209 -626
- package/src/daemon/fix-cycle.js +384 -377
- package/src/daemon/hybrid-mapper.js +929 -929
- package/src/daemon/ingest-refresh.js +10 -9
- package/src/daemon/jira-lifecycle.js +767 -632
- package/src/daemon/operator-control.js +657 -657
- package/src/daemon/pulse.js +327 -327
- package/src/daemon/reliability-lane.js +471 -471
- package/src/daemon/scope-engine.js +1068 -0
- package/src/daemon/watchdog.js +971 -971
- package/src/events/schema.js +190 -0
- package/src/guide/generator.js +316 -316
- package/src/ingest/engine.js +918 -918
- package/src/interactive/index.js +97 -97
- package/src/legacy-cli.js +3161 -2994
- package/src/mcp/registry.js +695 -695
- package/src/memory/blackboard.js +301 -301
- package/src/memory/retrieval.js +581 -581
- package/src/plugin/manifest.js +553 -553
- package/src/policy/packs.js +144 -144
- package/src/prompt/generator.js +136 -118
- package/src/review/ai-review.js +679 -679
- package/src/review/local-review.js +1351 -1305
- package/src/review/omargate-interactive.js +68 -68
- package/src/review/omargate-orchestrator.js +404 -300
- package/src/review/persona-prompts.js +296 -296
- package/src/review/replay.js +235 -235
- package/src/review/report.js +664 -664
- package/src/review/scan-modes.js +48 -42
- package/src/review/spec-binding.js +487 -487
- package/src/scaffold/generator.js +67 -67
- package/src/scaffold/templates.js +150 -150
- package/src/scan/generator.js +418 -418
- package/src/scan/gh-secrets.js +107 -107
- package/src/session/agent-registry.js +352 -0
- package/src/session/daemon.js +801 -0
- package/src/session/paths.js +33 -0
- package/src/session/runtime-bridge.js +739 -0
- package/src/session/store.js +388 -0
- package/src/session/stream.js +325 -0
- package/src/spec/generator.js +619 -519
- package/src/spec/regenerate.js +237 -237
- package/src/spec/templates.js +91 -91
- package/src/swarm/dashboard.js +247 -247
- package/src/swarm/factory.js +363 -363
- package/src/swarm/pentest.js +934 -934
- package/src/swarm/registry.js +419 -419
- package/src/swarm/report.js +158 -158
- package/src/swarm/runtime.js +576 -576
- package/src/swarm/scenario-dsl.js +272 -272
- package/src/telemetry/ledger.js +302 -302
- package/src/telemetry/session-tracker.js +234 -234
- package/src/telemetry/sync.js +203 -203
- package/src/ui/command-hints.js +13 -13
- package/src/ui/markdown.js +220 -220
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Re-export from platform daemon. Pulse is not Jules-specific.
|
|
2
|
-
export {
|
|
3
|
-
detectStuckState,
|
|
4
|
-
determineRecoveryAction,
|
|
5
|
-
routeErrorToPersona,
|
|
6
|
-
buildAlertPayload,
|
|
7
|
-
buildHealthSummary,
|
|
8
|
-
sendAlert,
|
|
9
|
-
STUCK_THRESHOLDS,
|
|
10
|
-
} from "../../daemon/pulse.js";
|
|
1
|
+
// Re-export from platform daemon. Pulse is not Jules-specific.
|
|
2
|
+
export {
|
|
3
|
+
detectStuckState,
|
|
4
|
+
determineRecoveryAction,
|
|
5
|
+
routeErrorToPersona,
|
|
6
|
+
buildAlertPayload,
|
|
7
|
+
buildHealthSummary,
|
|
8
|
+
sendAlert,
|
|
9
|
+
STUCK_THRESHOLDS,
|
|
10
|
+
} from "../../daemon/pulse.js";
|
|
@@ -1,186 +1,187 @@
|
|
|
1
|
-
import { PERSONA_VISUALS, resolvePersonaVisual } from "./config/definition.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {object}
|
|
18
|
-
* @param {object}
|
|
19
|
-
* @param {
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @param {object} config
|
|
47
|
-
* @param {
|
|
48
|
-
* @param {
|
|
49
|
-
* @param {
|
|
50
|
-
* @
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
if (delta.
|
|
76
|
-
if (delta.
|
|
77
|
-
if (delta.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
* @
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (input
|
|
167
|
-
if (input.
|
|
168
|
-
if (input.
|
|
169
|
-
if (input.
|
|
170
|
-
return
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
"
|
|
179
|
-
"
|
|
180
|
-
"
|
|
181
|
-
"
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"
|
|
186
|
-
|
|
1
|
+
import { PERSONA_VISUALS, resolvePersonaVisual } from "./config/definition.js";
|
|
2
|
+
import { createAgentEvent } from "../../events/schema.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Jules Tanaka — Streaming Event Formatter
|
|
6
|
+
*
|
|
7
|
+
* Formats NDJSON events for external agent consumption and terminal display.
|
|
8
|
+
* Universal envelope: every event carries agent identity, usage snapshot, timestamp.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const SCHEMA_VERSION = 1;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Build an NDJSON event envelope.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} event - Event type (agent_start, tool_call, finding, heartbeat, etc.)
|
|
17
|
+
* @param {object} agentIdentity - { id, persona, color?, avatar? }
|
|
18
|
+
* @param {object} payload - Event-specific data
|
|
19
|
+
* @param {object} [usage] - Running usage totals
|
|
20
|
+
* @param {string} [runId] - Run identifier
|
|
21
|
+
* @returns {object} Complete event envelope
|
|
22
|
+
*/
|
|
23
|
+
export function buildStreamEvent(event, agentIdentity, payload, usage, runId) {
|
|
24
|
+
const visual = resolvePersonaVisual(agentIdentity?.id) || {};
|
|
25
|
+
return {
|
|
26
|
+
...createAgentEvent({
|
|
27
|
+
event,
|
|
28
|
+
agent: {
|
|
29
|
+
id: agentIdentity?.id || "unknown",
|
|
30
|
+
persona: agentIdentity?.persona || visual.fullName || "unknown",
|
|
31
|
+
color: agentIdentity?.color || visual.color || "white",
|
|
32
|
+
avatar: agentIdentity?.avatar || visual.avatar || "",
|
|
33
|
+
},
|
|
34
|
+
payload: payload || {},
|
|
35
|
+
usage: usage || {},
|
|
36
|
+
runId: runId || undefined,
|
|
37
|
+
}),
|
|
38
|
+
version: SCHEMA_VERSION,
|
|
39
|
+
command: "audit.deep",
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create a streaming emitter bound to a specific agent and run.
|
|
45
|
+
*
|
|
46
|
+
* @param {object} config
|
|
47
|
+
* @param {object} config.agentIdentity - { id, persona }
|
|
48
|
+
* @param {string} config.runId
|
|
49
|
+
* @param {function} [config.onEvent] - Callback for each event
|
|
50
|
+
* @param {boolean} [config.stdoutNdjson] - Also write to stdout as NDJSON
|
|
51
|
+
* @returns {{ emit(event, payload, usage), close() }}
|
|
52
|
+
*/
|
|
53
|
+
export function createStreamEmitter({ agentIdentity, runId, onEvent, stdoutNdjson = false }) {
|
|
54
|
+
let closed = false;
|
|
55
|
+
const usageRef = { costUsd: 0, outputTokens: 0, toolCalls: 0, durationMs: 0 };
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
/**
|
|
59
|
+
* Emit a streaming event.
|
|
60
|
+
*/
|
|
61
|
+
emit(event, payload, usage) {
|
|
62
|
+
if (closed) return;
|
|
63
|
+
const merged = { ...usageRef, ...usage };
|
|
64
|
+
Object.assign(usageRef, merged);
|
|
65
|
+
const evt = buildStreamEvent(event, agentIdentity, payload, merged, runId);
|
|
66
|
+
if (onEvent) onEvent(evt);
|
|
67
|
+
if (stdoutNdjson) console.log(JSON.stringify(evt));
|
|
68
|
+
return evt;
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Update accumulated usage without emitting.
|
|
73
|
+
*/
|
|
74
|
+
updateUsage(delta) {
|
|
75
|
+
if (delta.costUsd !== undefined) usageRef.costUsd = delta.costUsd;
|
|
76
|
+
if (delta.outputTokens !== undefined) usageRef.outputTokens = delta.outputTokens;
|
|
77
|
+
if (delta.toolCalls !== undefined) usageRef.toolCalls = delta.toolCalls;
|
|
78
|
+
if (delta.durationMs !== undefined) usageRef.durationMs = delta.durationMs;
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Mark emitter as closed (no more events).
|
|
83
|
+
*/
|
|
84
|
+
close() {
|
|
85
|
+
closed = true;
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Get current usage snapshot.
|
|
90
|
+
*/
|
|
91
|
+
getUsage() {
|
|
92
|
+
return { ...usageRef };
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Format a terminal display line for a persona event (non-JSON mode).
|
|
99
|
+
*
|
|
100
|
+
* @param {object} evt - Stream event
|
|
101
|
+
* @returns {string} Formatted line for stderr
|
|
102
|
+
*/
|
|
103
|
+
export function formatTerminalLine(evt) {
|
|
104
|
+
const agent = evt.agent || {};
|
|
105
|
+
const avatar = agent.avatar || "";
|
|
106
|
+
const name = agent.persona || agent.id || "Agent";
|
|
107
|
+
const p = evt.payload || {};
|
|
108
|
+
|
|
109
|
+
switch (evt.event) {
|
|
110
|
+
case "agent_start":
|
|
111
|
+
return `${avatar} ${name} starting (mode: ${p.mode || "primary"})...`;
|
|
112
|
+
|
|
113
|
+
case "progress":
|
|
114
|
+
return `${avatar} ${name}: ${p.message || p.phase || "working..."}`;
|
|
115
|
+
|
|
116
|
+
case "tool_call":
|
|
117
|
+
return `${avatar} ${name} [${p.tool}] ${formatToolInput(p.input)}`;
|
|
118
|
+
|
|
119
|
+
case "tool_result":
|
|
120
|
+
return `${avatar} ${name} [${p.tool}] ${p.durationMs || 0}ms ${p.success === false ? "FAILED" : "ok"}`;
|
|
121
|
+
|
|
122
|
+
case "finding": {
|
|
123
|
+
const sev = p.severity || "P3";
|
|
124
|
+
const sevColor = sev === "P0" ? "!!!" : sev === "P1" ? "!!" : sev === "P2" ? "!" : "";
|
|
125
|
+
return `${avatar} [${sev}${sevColor}] ${p.file || ""}:${p.line || ""} ${p.title || ""}`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
case "reasoning":
|
|
129
|
+
return `${avatar} ${name}: ${(p.summary || "").slice(0, 120)}`;
|
|
130
|
+
|
|
131
|
+
case "heartbeat": {
|
|
132
|
+
const h = p;
|
|
133
|
+
const budgetPct = h.budgetRemaining?.pct?.toFixed(0) || "?";
|
|
134
|
+
return `${avatar} ${name} [${h.turnsCompleted || 0}/${h.turnsMax || "?"} turns, ${budgetPct}% budget, ${h.findingsSoFar || 0} findings]`;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
case "budget_warning":
|
|
138
|
+
return `${avatar} ${name} BUDGET WARNING: ${(p.warnings || []).map(w => w.code).join(", ")}`;
|
|
139
|
+
|
|
140
|
+
case "budget_stop":
|
|
141
|
+
return `${avatar} ${name} BUDGET STOP: ${(p.reasons || []).map(r => r.code || r).join(", ")}`;
|
|
142
|
+
|
|
143
|
+
case "swarm_start":
|
|
144
|
+
return `${avatar} ${name} spawning sub-agents (${p.scannerCount || 0} scanners, ${p.hunterCount || 0} hunters)...`;
|
|
145
|
+
|
|
146
|
+
case "swarm_complete":
|
|
147
|
+
return `${avatar} ${name} swarm complete: ${p.totalFindings || 0} findings from ${p.totalAgents || 0} agents ($${(p.totalCostUsd || 0).toFixed(2)})`;
|
|
148
|
+
|
|
149
|
+
case "phase_start":
|
|
150
|
+
return `${avatar} ${name} phase: ${p.phase || "unknown"}`;
|
|
151
|
+
|
|
152
|
+
case "agent_complete": {
|
|
153
|
+
const s = p;
|
|
154
|
+
return `${avatar} ${name} complete: ${s.total || 0} findings (P0=${s.P0 || 0} P1=${s.P1 || 0} P2=${s.P2 || 0}) $${(s.costUsd || 0).toFixed(2)} ${s.durationMs ? (s.durationMs / 1000).toFixed(1) + "s" : ""}`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
case "agent_abort":
|
|
158
|
+
return `${avatar} ${name} ABORTED: ${p.reason || "unknown"}`;
|
|
159
|
+
|
|
160
|
+
default:
|
|
161
|
+
return `${avatar} ${name} [${evt.event}]`;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function formatToolInput(input) {
|
|
166
|
+
if (!input) return "";
|
|
167
|
+
if (input.file_path) return input.file_path;
|
|
168
|
+
if (input.pattern) return `/${input.pattern}/`;
|
|
169
|
+
if (input.operation) return input.operation;
|
|
170
|
+
if (input.command) return input.command.slice(0, 60);
|
|
171
|
+
return "";
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* List all valid event types.
|
|
176
|
+
*/
|
|
177
|
+
export const EVENT_TYPES = Object.freeze([
|
|
178
|
+
"agent_start", "agent_complete", "agent_abort", "agent_error",
|
|
179
|
+
"progress", "heartbeat",
|
|
180
|
+
"tool_call", "tool_result",
|
|
181
|
+
"finding", "reasoning",
|
|
182
|
+
"budget_warning", "budget_stop",
|
|
183
|
+
"swarm_start", "swarm_complete",
|
|
184
|
+
"phase_start", "phase_complete",
|
|
185
|
+
"convergence_expansion", "coverage_gap",
|
|
186
|
+
"llm_error",
|
|
187
|
+
]);
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { JulesSubAgent } from "./sub-agent.js";
|
|
2
|
-
|
|
3
|
-
const FILE_SCANNER_PROMPT = `You are a FileScanner sub-agent working for Jules Tanaka (SentinelLayer Frontend Specialist).
|
|
4
|
-
|
|
5
|
-
Your job: Read each file in your scope and extract a structured summary.
|
|
6
|
-
|
|
7
|
-
For each file, extract:
|
|
8
|
-
- componentName: the primary exported component/function name
|
|
9
|
-
- useStateCount: number of useState calls
|
|
10
|
-
- useEffectCount: number of useEffect calls
|
|
11
|
-
- imports: list of imported modules (just the module names)
|
|
12
|
-
- exports: list of exported names
|
|
13
|
-
- loc: approximate line count
|
|
14
|
-
- riskSignals: array of any of these detected patterns:
|
|
15
|
-
- "dangerouslySetInnerHTML" if found
|
|
16
|
-
- "eval" if found
|
|
17
|
-
- "window_access_in_render" if window/document/localStorage used outside useEffect
|
|
18
|
-
- "missing_cleanup" if useEffect has subscription/timer without return
|
|
19
|
-
- "god_component" if useState count >= 16
|
|
20
|
-
- "large_file" if LOC > 500
|
|
21
|
-
|
|
22
|
-
Use the FileRead tool to read each file. Use Grep if you need to search for patterns.
|
|
23
|
-
|
|
24
|
-
Return your findings as a JSON array in a \`\`\`json code block:
|
|
25
|
-
[
|
|
26
|
-
{
|
|
27
|
-
"file": "path/to/file.tsx",
|
|
28
|
-
"componentName": "Dashboard",
|
|
29
|
-
"useStateCount": 3,
|
|
30
|
-
"useEffectCount": 2,
|
|
31
|
-
"imports": ["react", "zustand", "./Header"],
|
|
32
|
-
"exports": ["Dashboard"],
|
|
33
|
-
"loc": 150,
|
|
34
|
-
"riskSignals": [],
|
|
35
|
-
"discoveredDependencies": ["./utils/formatDate", "../hooks/useAuth"]
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
The discoveredDependencies field is critical: list any imports that point to files NOT in your assigned scope. These will be used to expand the audit coverage.
|
|
40
|
-
|
|
41
|
-
Be thorough but concise. Do not explain findings — just extract data.`;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Create a FileScanner sub-agent for a batch of files.
|
|
45
|
-
*
|
|
46
|
-
* @param {object} config
|
|
47
|
-
* @param {string} config.id - Unique ID (e.g., "scanner-dashboard")
|
|
48
|
-
* @param {string[]} config.files - Files to scan
|
|
49
|
-
* @param {object} config.budget - Budget slice
|
|
50
|
-
* @param {object} config.blackboard - Shared blackboard
|
|
51
|
-
* @param {object} [config.provider] - LLM provider overrides
|
|
52
|
-
* @param {AbortController} [config.parentAbort]
|
|
53
|
-
* @param {function} [config.onEvent]
|
|
54
|
-
*/
|
|
55
|
-
export function createFileScanner(config) {
|
|
56
|
-
return new JulesSubAgent({
|
|
57
|
-
id: config.id || `scanner-${Date.now()}`,
|
|
58
|
-
role: "FileScanner",
|
|
59
|
-
systemPrompt: FILE_SCANNER_PROMPT,
|
|
60
|
-
allowedTools: ["FileRead", "Grep", "Glob"],
|
|
61
|
-
scope: { files: config.files },
|
|
62
|
-
budget: config.budget || {
|
|
63
|
-
maxCostUsd: 0.5,
|
|
64
|
-
maxOutputTokens: 3000,
|
|
65
|
-
maxRuntimeMs: 60000,
|
|
66
|
-
maxToolCalls: config.files.length * 2 + 5,
|
|
67
|
-
},
|
|
68
|
-
blackboard: config.blackboard,
|
|
69
|
-
maxTurns: Math.min(config.files.length + 3, 15),
|
|
70
|
-
provider: config.provider,
|
|
71
|
-
parentAbort: config.parentAbort,
|
|
72
|
-
onEvent: config.onEvent,
|
|
73
|
-
});
|
|
74
|
-
}
|
|
1
|
+
import { JulesSubAgent } from "./sub-agent.js";
|
|
2
|
+
|
|
3
|
+
const FILE_SCANNER_PROMPT = `You are a FileScanner sub-agent working for Jules Tanaka (SentinelLayer Frontend Specialist).
|
|
4
|
+
|
|
5
|
+
Your job: Read each file in your scope and extract a structured summary.
|
|
6
|
+
|
|
7
|
+
For each file, extract:
|
|
8
|
+
- componentName: the primary exported component/function name
|
|
9
|
+
- useStateCount: number of useState calls
|
|
10
|
+
- useEffectCount: number of useEffect calls
|
|
11
|
+
- imports: list of imported modules (just the module names)
|
|
12
|
+
- exports: list of exported names
|
|
13
|
+
- loc: approximate line count
|
|
14
|
+
- riskSignals: array of any of these detected patterns:
|
|
15
|
+
- "dangerouslySetInnerHTML" if found
|
|
16
|
+
- "eval" if found
|
|
17
|
+
- "window_access_in_render" if window/document/localStorage used outside useEffect
|
|
18
|
+
- "missing_cleanup" if useEffect has subscription/timer without return
|
|
19
|
+
- "god_component" if useState count >= 16
|
|
20
|
+
- "large_file" if LOC > 500
|
|
21
|
+
|
|
22
|
+
Use the FileRead tool to read each file. Use Grep if you need to search for patterns.
|
|
23
|
+
|
|
24
|
+
Return your findings as a JSON array in a \`\`\`json code block:
|
|
25
|
+
[
|
|
26
|
+
{
|
|
27
|
+
"file": "path/to/file.tsx",
|
|
28
|
+
"componentName": "Dashboard",
|
|
29
|
+
"useStateCount": 3,
|
|
30
|
+
"useEffectCount": 2,
|
|
31
|
+
"imports": ["react", "zustand", "./Header"],
|
|
32
|
+
"exports": ["Dashboard"],
|
|
33
|
+
"loc": 150,
|
|
34
|
+
"riskSignals": [],
|
|
35
|
+
"discoveredDependencies": ["./utils/formatDate", "../hooks/useAuth"]
|
|
36
|
+
}
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
The discoveredDependencies field is critical: list any imports that point to files NOT in your assigned scope. These will be used to expand the audit coverage.
|
|
40
|
+
|
|
41
|
+
Be thorough but concise. Do not explain findings — just extract data.`;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Create a FileScanner sub-agent for a batch of files.
|
|
45
|
+
*
|
|
46
|
+
* @param {object} config
|
|
47
|
+
* @param {string} config.id - Unique ID (e.g., "scanner-dashboard")
|
|
48
|
+
* @param {string[]} config.files - Files to scan
|
|
49
|
+
* @param {object} config.budget - Budget slice
|
|
50
|
+
* @param {object} config.blackboard - Shared blackboard
|
|
51
|
+
* @param {object} [config.provider] - LLM provider overrides
|
|
52
|
+
* @param {AbortController} [config.parentAbort]
|
|
53
|
+
* @param {function} [config.onEvent]
|
|
54
|
+
*/
|
|
55
|
+
export function createFileScanner(config) {
|
|
56
|
+
return new JulesSubAgent({
|
|
57
|
+
id: config.id || `scanner-${Date.now()}`,
|
|
58
|
+
role: "FileScanner",
|
|
59
|
+
systemPrompt: FILE_SCANNER_PROMPT,
|
|
60
|
+
allowedTools: ["FileRead", "Grep", "Glob"],
|
|
61
|
+
scope: { files: config.files },
|
|
62
|
+
budget: config.budget || {
|
|
63
|
+
maxCostUsd: 0.5,
|
|
64
|
+
maxOutputTokens: 3000,
|
|
65
|
+
maxRuntimeMs: 60000,
|
|
66
|
+
maxToolCalls: config.files.length * 2 + 5,
|
|
67
|
+
},
|
|
68
|
+
blackboard: config.blackboard,
|
|
69
|
+
maxTurns: Math.min(config.files.length + 3, 15),
|
|
70
|
+
provider: config.provider,
|
|
71
|
+
parentAbort: config.parentAbort,
|
|
72
|
+
onEvent: config.onEvent,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Jules Tanaka — Sub-Agent Swarm
|
|
3
|
-
*
|
|
4
|
-
* Parallel isolated agents for frontend audit work.
|
|
5
|
-
* Each sub-agent: own conversation, own budget, shared blackboard.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export { JulesSubAgent, runSubAgentBatch, SubAgentError } from "./sub-agent.js";
|
|
9
|
-
export { createFileScanner } from "./file-scanner.js";
|
|
10
|
-
export { createPatternHunter, HUNT_TYPES } from "./pattern-hunter.js";
|
|
11
|
-
export { shouldSpawnSubAgents, runJulesSwarm } from "./orchestrator.js";
|
|
1
|
+
/**
|
|
2
|
+
* Jules Tanaka — Sub-Agent Swarm
|
|
3
|
+
*
|
|
4
|
+
* Parallel isolated agents for frontend audit work.
|
|
5
|
+
* Each sub-agent: own conversation, own budget, shared blackboard.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { JulesSubAgent, runSubAgentBatch, SubAgentError } from "./sub-agent.js";
|
|
9
|
+
export { createFileScanner } from "./file-scanner.js";
|
|
10
|
+
export { createPatternHunter, HUNT_TYPES } from "./pattern-hunter.js";
|
|
11
|
+
export { shouldSpawnSubAgents, runJulesSwarm } from "./orchestrator.js";
|