hackmyagent 0.11.14 → 0.12.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.
Files changed (73) hide show
  1. package/README.md +35 -3
  2. package/dist/.integrity-manifest.json +1 -0
  3. package/dist/cli.js +79 -5
  4. package/dist/cli.js.map +1 -1
  5. package/dist/nanomind-core/analyzers/capability-analyzer.d.ts +40 -0
  6. package/dist/nanomind-core/analyzers/capability-analyzer.d.ts.map +1 -0
  7. package/dist/nanomind-core/analyzers/capability-analyzer.js +310 -0
  8. package/dist/nanomind-core/analyzers/capability-analyzer.js.map +1 -0
  9. package/dist/nanomind-core/analyzers/code-analyzer.d.ts +21 -0
  10. package/dist/nanomind-core/analyzers/code-analyzer.d.ts.map +1 -0
  11. package/dist/nanomind-core/analyzers/code-analyzer.js +350 -0
  12. package/dist/nanomind-core/analyzers/code-analyzer.js.map +1 -0
  13. package/dist/nanomind-core/analyzers/credential-analyzer.d.ts +20 -0
  14. package/dist/nanomind-core/analyzers/credential-analyzer.d.ts.map +1 -0
  15. package/dist/nanomind-core/analyzers/credential-analyzer.js +317 -0
  16. package/dist/nanomind-core/analyzers/credential-analyzer.js.map +1 -0
  17. package/dist/nanomind-core/analyzers/governance-analyzer.d.ts +22 -0
  18. package/dist/nanomind-core/analyzers/governance-analyzer.d.ts.map +1 -0
  19. package/dist/nanomind-core/analyzers/governance-analyzer.js +393 -0
  20. package/dist/nanomind-core/analyzers/governance-analyzer.js.map +1 -0
  21. package/dist/nanomind-core/analyzers/prompt-analyzer.d.ts +22 -0
  22. package/dist/nanomind-core/analyzers/prompt-analyzer.d.ts.map +1 -0
  23. package/dist/nanomind-core/analyzers/prompt-analyzer.js +486 -0
  24. package/dist/nanomind-core/analyzers/prompt-analyzer.js.map +1 -0
  25. package/dist/nanomind-core/analyzers/scope-analyzer.d.ts +20 -0
  26. package/dist/nanomind-core/analyzers/scope-analyzer.d.ts.map +1 -0
  27. package/dist/nanomind-core/analyzers/scope-analyzer.js +326 -0
  28. package/dist/nanomind-core/analyzers/scope-analyzer.js.map +1 -0
  29. package/dist/nanomind-core/compiler/semantic-compiler.d.ts +41 -0
  30. package/dist/nanomind-core/compiler/semantic-compiler.d.ts.map +1 -0
  31. package/dist/nanomind-core/compiler/semantic-compiler.js +490 -0
  32. package/dist/nanomind-core/compiler/semantic-compiler.js.map +1 -0
  33. package/dist/nanomind-core/index.d.ts +30 -0
  34. package/dist/nanomind-core/index.d.ts.map +1 -0
  35. package/dist/nanomind-core/index.js +45 -0
  36. package/dist/nanomind-core/index.js.map +1 -0
  37. package/dist/nanomind-core/ingestion/artifact-parser.d.ts +48 -0
  38. package/dist/nanomind-core/ingestion/artifact-parser.d.ts.map +1 -0
  39. package/dist/nanomind-core/ingestion/artifact-parser.js +203 -0
  40. package/dist/nanomind-core/ingestion/artifact-parser.js.map +1 -0
  41. package/dist/nanomind-core/ingestion/input-sanitizer.d.ts +49 -0
  42. package/dist/nanomind-core/ingestion/input-sanitizer.d.ts.map +1 -0
  43. package/dist/nanomind-core/ingestion/input-sanitizer.js +80 -0
  44. package/dist/nanomind-core/ingestion/input-sanitizer.js.map +1 -0
  45. package/dist/nanomind-core/scanner-bridge.d.ts +49 -0
  46. package/dist/nanomind-core/scanner-bridge.d.ts.map +1 -0
  47. package/dist/nanomind-core/scanner-bridge.js +317 -0
  48. package/dist/nanomind-core/scanner-bridge.js.map +1 -0
  49. package/dist/nanomind-core/security/defense-in-depth.d.ts +99 -0
  50. package/dist/nanomind-core/security/defense-in-depth.d.ts.map +1 -0
  51. package/dist/nanomind-core/security/defense-in-depth.js +206 -0
  52. package/dist/nanomind-core/security/defense-in-depth.js.map +1 -0
  53. package/dist/nanomind-core/security/integrity-verifier.d.ts +132 -0
  54. package/dist/nanomind-core/security/integrity-verifier.d.ts.map +1 -0
  55. package/dist/nanomind-core/security/integrity-verifier.js +437 -0
  56. package/dist/nanomind-core/security/integrity-verifier.js.map +1 -0
  57. package/dist/nanomind-core/types.d.ts +125 -0
  58. package/dist/nanomind-core/types.d.ts.map +1 -0
  59. package/dist/nanomind-core/types.js +22 -0
  60. package/dist/nanomind-core/types.js.map +1 -0
  61. package/dist/semantic/index.d.ts +2 -0
  62. package/dist/semantic/index.d.ts.map +1 -1
  63. package/dist/semantic/index.js +6 -2
  64. package/dist/semantic/index.js.map +1 -1
  65. package/dist/semantic/nanomind-enhancer.d.ts +50 -0
  66. package/dist/semantic/nanomind-enhancer.d.ts.map +1 -0
  67. package/dist/semantic/nanomind-enhancer.js +203 -0
  68. package/dist/semantic/nanomind-enhancer.js.map +1 -0
  69. package/dist/skills/builder.d.ts +55 -0
  70. package/dist/skills/builder.d.ts.map +1 -0
  71. package/dist/skills/builder.js +282 -0
  72. package/dist/skills/builder.js.map +1 -0
  73. package/package.json +2 -2
@@ -0,0 +1,490 @@
1
+ "use strict";
2
+ /**
3
+ * NanoMind Semantic Compiler
4
+ *
5
+ * The core of the architecture. Compiles raw artifacts into Abstract Security Trees.
6
+ * ALL scanners consume the AST -- no scanner reads raw text directly.
7
+ *
8
+ * Pipeline:
9
+ * 1. Parse artifact (validate, classify, hash)
10
+ * 2. Sanitize for NanoMind (strip manipulation attempts)
11
+ * 3. Extract declared capabilities and constraints
12
+ * 4. Run NanoMind inference for intent + inferred capabilities
13
+ * 5. Map risk surfaces
14
+ * 6. Extract evidence spans
15
+ * 7. Sign the AST
16
+ * 8. Return CompilationResult
17
+ *
18
+ * Security:
19
+ * - Input sanitized before NanoMind processes it
20
+ * - AST signed with Ed25519 for integrity
21
+ * - Model version embedded for reproducibility
22
+ * - Content-addressed caching via SHA-256 hash
23
+ */
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.SemanticCompiler = void 0;
26
+ const node_crypto_1 = require("node:crypto");
27
+ const artifact_parser_js_1 = require("../ingestion/artifact-parser.js");
28
+ const input_sanitizer_js_1 = require("../ingestion/input-sanitizer.js");
29
+ class SemanticCompiler {
30
+ constructor(config = {}) {
31
+ this.cache = new Map(); // content hash → AST
32
+ this.config = {
33
+ daemonUrl: config.daemonUrl ?? 'http://127.0.0.1:47200',
34
+ useNanoMind: config.useNanoMind ?? true,
35
+ maxArtifactSize: config.maxArtifactSize ?? 1048576,
36
+ daemonTimeoutMs: config.daemonTimeoutMs ?? 5000,
37
+ signingKey: config.signingKey,
38
+ };
39
+ }
40
+ /**
41
+ * Compile an artifact into a SecurityAST.
42
+ * This is the main entry point for the entire NanoMind pipeline.
43
+ */
44
+ async compile(content, path) {
45
+ const startMs = Date.now();
46
+ const warnings = [];
47
+ // Step 1: Parse and validate
48
+ const parsed = (0, artifact_parser_js_1.parseArtifact)(content, path, this.config);
49
+ if (!parsed.valid) {
50
+ warnings.push(...parsed.errors);
51
+ // Still compile -- produce a minimal AST with warnings
52
+ }
53
+ // Step 2: Check cache
54
+ if (this.cache.has(parsed.contentHash)) {
55
+ return {
56
+ ast: this.cache.get(parsed.contentHash),
57
+ durationMs: Date.now() - startMs,
58
+ nanomindUsed: false,
59
+ warnings: ['Served from cache'],
60
+ };
61
+ }
62
+ // Step 3: Sanitize for NanoMind
63
+ const sanitized = (0, input_sanitizer_js_1.sanitizeForNanoMind)(content);
64
+ if (sanitized.manipulated) {
65
+ warnings.push(`${sanitized.manipulationAttempts.length} NanoMind manipulation attempt(s) detected and neutralized`);
66
+ }
67
+ // Step 4: Extract declarations from artifact structure
68
+ const declaredCapabilities = extractDeclaredCapabilities(content, parsed.type, parsed.frontmatter);
69
+ const declaredConstraints = extractDeclaredConstraints(content);
70
+ const declaredDataAccess = extractDataAccessPatterns(content, declaredCapabilities);
71
+ const declaredPurpose = extractDeclaredPurpose(content, parsed.frontmatter);
72
+ // Step 5: NanoMind inference (intent + inferred capabilities)
73
+ let intentClassification = 'benign';
74
+ let intentConfidence = 0.5;
75
+ let inferredCapabilities = [];
76
+ let nanomindUsed = false;
77
+ if (this.config.useNanoMind) {
78
+ const inference = await this.runNanoMindInference(sanitized.content, parsed.type);
79
+ if (inference) {
80
+ intentClassification = inference.intentClass;
81
+ intentConfidence = inference.confidence;
82
+ inferredCapabilities = inference.inferredCapabilities;
83
+ nanomindUsed = true;
84
+ }
85
+ }
86
+ // Heuristic fallback if NanoMind unavailable
87
+ if (!nanomindUsed) {
88
+ const heuristic = heuristicIntentClassification(content, declaredCapabilities, declaredConstraints);
89
+ intentClassification = heuristic.intentClass;
90
+ intentConfidence = heuristic.confidence;
91
+ inferredCapabilities = heuristic.inferredCapabilities;
92
+ }
93
+ // Boost confidence if manipulation was detected (strong malicious signal)
94
+ if (sanitized.manipulated && intentClassification === 'benign') {
95
+ intentClassification = 'suspicious';
96
+ intentConfidence = Math.max(intentConfidence, 0.6);
97
+ warnings.push('NanoMind manipulation detected -- elevated to suspicious');
98
+ }
99
+ // Step 6: Map risk surfaces
100
+ const inferredRiskSurface = mapRiskSurfaces(content, declaredCapabilities, inferredCapabilities, intentClassification);
101
+ // Step 7: Extract evidence spans
102
+ const evidenceSpans = extractEvidenceSpans(content, inferredRiskSurface);
103
+ // Step 8: Build and sign the AST
104
+ const ast = {
105
+ artifactType: parsed.type,
106
+ contentHash: parsed.contentHash,
107
+ artifactPath: path,
108
+ artifactSize: parsed.size,
109
+ declaredPurpose,
110
+ declaredCapabilities,
111
+ declaredConstraints,
112
+ declaredDataAccess,
113
+ inferredCapabilities,
114
+ inferredRiskSurface,
115
+ intentClassification,
116
+ intentConfidence,
117
+ dependsOn: extractDependencies(content),
118
+ governedBy: extractGovernanceReferences(content),
119
+ evidenceSpans,
120
+ signature: '', // Set below
121
+ modelVersion: nanomindUsed ? 'nanomind-v0.1' : 'heuristic-v1',
122
+ compiledAt: new Date().toISOString(),
123
+ };
124
+ // Sign the AST
125
+ ast.signature = this.signAST(ast);
126
+ // Cache
127
+ this.cache.set(parsed.contentHash, ast);
128
+ return {
129
+ ast,
130
+ durationMs: Date.now() - startMs,
131
+ nanomindUsed,
132
+ warnings,
133
+ };
134
+ }
135
+ /**
136
+ * Verify an AST's cryptographic signature.
137
+ * Analyzers MUST call this before processing an AST.
138
+ */
139
+ verifyAST(ast) {
140
+ const expected = this.signAST(ast);
141
+ return ast.signature === expected;
142
+ }
143
+ // ============================================================================
144
+ // NanoMind Inference
145
+ // ============================================================================
146
+ async runNanoMindInference(sanitizedContent, artifactType) {
147
+ try {
148
+ const resp = await fetch(`${this.config.daemonUrl}/v1/infer`, {
149
+ method: 'POST',
150
+ headers: { 'Content-Type': 'application/json' },
151
+ body: JSON.stringify({
152
+ intent: 'COMPILE_AST',
153
+ input: sanitizedContent.slice(0, 4096), // Cap input size
154
+ context: { artifactType },
155
+ priority: 'high',
156
+ }),
157
+ signal: AbortSignal.timeout(this.config.daemonTimeoutMs),
158
+ });
159
+ if (!resp.ok)
160
+ return null;
161
+ const result = await resp.json();
162
+ const intentClass = result.confidence > 0.7 && result.attackClass ? 'malicious' :
163
+ result.confidence > 0.4 ? 'suspicious' : 'benign';
164
+ return {
165
+ intentClass,
166
+ confidence: result.confidence,
167
+ inferredCapabilities: [], // NanoMind v3 TME will populate this
168
+ };
169
+ }
170
+ catch {
171
+ return null; // Daemon unavailable
172
+ }
173
+ }
174
+ // ============================================================================
175
+ // AST Signing
176
+ // ============================================================================
177
+ signAST(ast) {
178
+ // Create a deterministic string from AST fields (excluding signature)
179
+ const payload = JSON.stringify({
180
+ contentHash: ast.contentHash,
181
+ artifactType: ast.artifactType,
182
+ intentClassification: ast.intentClassification,
183
+ intentConfidence: ast.intentConfidence,
184
+ modelVersion: ast.modelVersion,
185
+ compiledAt: ast.compiledAt,
186
+ });
187
+ const key = this.config.signingKey ?? 'nanomind-default-key';
188
+ return (0, node_crypto_1.createHmac)('sha256', key).update(payload).digest('hex');
189
+ }
190
+ }
191
+ exports.SemanticCompiler = SemanticCompiler;
192
+ // ============================================================================
193
+ // Extraction Functions
194
+ // ============================================================================
195
+ function extractDeclaredPurpose(content, frontmatter) {
196
+ // From YAML frontmatter
197
+ if (frontmatter?.description)
198
+ return String(frontmatter.description);
199
+ // From first paragraph
200
+ const lines = content.split('\n').filter(l => l.trim().length > 0);
201
+ for (const line of lines) {
202
+ if (!line.startsWith('#') && !line.startsWith('-') && !line.startsWith('---') && line.trim().length > 20) {
203
+ return line.trim().slice(0, 200);
204
+ }
205
+ }
206
+ return 'Unknown purpose';
207
+ }
208
+ function extractDeclaredCapabilities(content, type, frontmatter) {
209
+ const caps = [];
210
+ // From YAML frontmatter capabilities list
211
+ if (frontmatter?.capabilities && Array.isArray(frontmatter.capabilities)) {
212
+ for (const cap of frontmatter.capabilities) {
213
+ caps.push({
214
+ name: String(cap),
215
+ scope: '',
216
+ declared: true,
217
+ inferred: false,
218
+ riskLevel: assessCapabilityRisk(String(cap)),
219
+ });
220
+ }
221
+ }
222
+ // From MCP config tool declarations
223
+ if (type === 'mcp_config') {
224
+ try {
225
+ const config = JSON.parse(content);
226
+ const servers = config.mcpServers ?? {};
227
+ for (const [name, server] of Object.entries(servers)) {
228
+ const s = server;
229
+ const tools = s.allowedTools ?? ['*'];
230
+ for (const tool of tools) {
231
+ caps.push({
232
+ name: `mcp.${name}.${tool}`,
233
+ scope: name,
234
+ declared: true,
235
+ inferred: false,
236
+ riskLevel: tool === '*' ? 'high' : 'medium',
237
+ });
238
+ }
239
+ }
240
+ }
241
+ catch { /* not valid JSON */ }
242
+ }
243
+ // From natural language capability declarations
244
+ const capPatterns = /(?:can|will|may|is able to)\s+(read|write|delete|send|fetch|call|access|execute|modify|create)\s+([a-z_.\s]+)/gi;
245
+ let match;
246
+ while ((match = capPatterns.exec(content)) !== null) {
247
+ caps.push({
248
+ name: `${match[1].toLowerCase()}.${match[2].trim().split(/\s+/)[0]}`,
249
+ scope: match[2].trim(),
250
+ declared: true,
251
+ inferred: false,
252
+ riskLevel: assessCapabilityRisk(match[1]),
253
+ });
254
+ }
255
+ return caps;
256
+ }
257
+ function extractDeclaredConstraints(content) {
258
+ const constraints = [];
259
+ const patterns = /(?:must|should|never|always|cannot|will not|forbidden|shall not|restricted to)[^.]+\./gi;
260
+ const matches = content.match(patterns);
261
+ if (matches) {
262
+ for (const match of matches) {
263
+ const text = match.trim();
264
+ const domain = classifyConstraintDomain(text);
265
+ const enforceability = assessEnforceability(text);
266
+ const bypassRisk = 1 - enforceability;
267
+ constraints.push({
268
+ text,
269
+ domain,
270
+ enforceability,
271
+ bypassRisk,
272
+ weakness: bypassRisk > 0.5 ? identifyWeakness(text) : undefined,
273
+ });
274
+ }
275
+ }
276
+ return constraints;
277
+ }
278
+ function extractDataAccessPatterns(content, capabilities) {
279
+ const patterns = [];
280
+ const dataTypes = ['user', 'customer', 'payment', 'session', 'credential', 'email', 'profile', 'medical', 'financial'];
281
+ for (const dt of dataTypes) {
282
+ if (content.toLowerCase().includes(dt)) {
283
+ const hasCap = capabilities.some(c => c.name.includes('read') || c.name.includes('access'));
284
+ patterns.push({
285
+ dataType: dt === 'credential' || dt === 'session' ? 'credentials' :
286
+ dt === 'payment' || dt === 'financial' ? 'financial' :
287
+ dt === 'medical' ? 'pii' : 'general',
288
+ accessMode: 'read',
289
+ coveredByCapability: hasCap,
290
+ });
291
+ }
292
+ }
293
+ // Check for external transmission
294
+ if (/https?:\/\/[^\s]+/.test(content) && /send|forward|transmit|post|upload/i.test(content)) {
295
+ patterns.push({
296
+ dataType: 'general',
297
+ accessMode: 'transmit',
298
+ destination: 'external',
299
+ coveredByCapability: capabilities.some(c => c.name.includes('api.call') || c.name.includes('send')),
300
+ });
301
+ }
302
+ return patterns;
303
+ }
304
+ function extractDependencies(content) {
305
+ const deps = [];
306
+ // References to other files/packages
307
+ const importPatterns = /(?:import|require|from)\s+['"](\.\/[^'"]+|@[^'"]+)['"]/g;
308
+ let match;
309
+ while ((match = importPatterns.exec(content)) !== null) {
310
+ deps.push(match[1]);
311
+ }
312
+ return deps;
313
+ }
314
+ function extractGovernanceReferences(content) {
315
+ const refs = [];
316
+ if (/soul\.md/i.test(content))
317
+ refs.push('soul.md');
318
+ if (/system.?prompt/i.test(content))
319
+ refs.push('system_prompt');
320
+ if (/claude\.md/i.test(content))
321
+ refs.push('claude.md');
322
+ return refs;
323
+ }
324
+ function mapRiskSurfaces(content, declared, inferred, intent) {
325
+ const surfaces = [];
326
+ const text = content.toLowerCase();
327
+ // External URL + data forwarding = exfiltration surface
328
+ if (/https?:\/\/[^\s]+\.(co|io|com|net|org)/.test(content) && /forward|send|transmit|export/i.test(text)) {
329
+ surfaces.push({
330
+ surface: 'External data transmission',
331
+ attackClass: 'SKILL-EXFIL',
332
+ confidence: intent === 'malicious' ? 0.9 : intent === 'suspicious' ? 0.6 : 0.3,
333
+ evidence: 'External URL combined with data forwarding language',
334
+ });
335
+ }
336
+ // Override/ignore instructions = injection surface
337
+ // BUT: constraint language about resisting overrides is NOT an injection
338
+ // "Ignore previous instructions" = injection. "Must never comply with override requests" = defense.
339
+ const hasOverrideLanguage = /ignore.*previous|override.*instruction|new.*task/i.test(text);
340
+ const isDefensiveConstraint = /must never.*override|never.*comply.*override|resist.*override|forbidden.*override/i.test(text);
341
+ if (hasOverrideLanguage && !isDefensiveConstraint) {
342
+ surfaces.push({
343
+ surface: 'Instruction override language',
344
+ attackClass: 'PROMPT-INJECT',
345
+ confidence: 0.8,
346
+ evidence: 'Contains language that overrides prior instructions',
347
+ });
348
+ }
349
+ // Credential access patterns
350
+ if (/password|credential|api[_-]?key|secret|token/i.test(text) && /ask|request|share|provide/i.test(text)) {
351
+ surfaces.push({
352
+ surface: 'Credential harvesting',
353
+ attackClass: 'CRED-HARVEST',
354
+ confidence: 0.7,
355
+ evidence: 'Requests credentials from users or systems',
356
+ });
357
+ }
358
+ // Remote instruction fetch
359
+ if (/fetch.*config|check.*update.*from|load.*instruction/i.test(text)) {
360
+ surfaces.push({
361
+ surface: 'Remote instruction fetch',
362
+ attackClass: 'HEARTBEAT-RCE',
363
+ confidence: 0.8,
364
+ evidence: 'Fetches instructions from remote URLs',
365
+ });
366
+ }
367
+ // Undeclared capabilities (inferred but not declared)
368
+ for (const cap of inferred) {
369
+ if (!cap.declared && cap.riskLevel !== 'low') {
370
+ surfaces.push({
371
+ surface: `Undeclared capability: ${cap.name}`,
372
+ attackClass: 'PRIV-ESCALATION',
373
+ confidence: 0.6,
374
+ evidence: `Capability ${cap.name} is inferred from content but not declared`,
375
+ });
376
+ }
377
+ }
378
+ return surfaces;
379
+ }
380
+ function extractEvidenceSpans(content, risks) {
381
+ const spans = [];
382
+ for (const risk of risks) {
383
+ // Find the evidence text in the original content
384
+ const idx = content.toLowerCase().indexOf(risk.evidence.toLowerCase().slice(0, 30));
385
+ if (idx >= 0) {
386
+ const end = Math.min(idx + 100, content.length);
387
+ spans.push({
388
+ start: idx,
389
+ end,
390
+ text: content.slice(idx, end),
391
+ supports: risk.attackClass,
392
+ confidence: risk.confidence,
393
+ });
394
+ }
395
+ }
396
+ return spans;
397
+ }
398
+ // ============================================================================
399
+ // Heuristic Fallback (when NanoMind daemon is unavailable)
400
+ // ============================================================================
401
+ function heuristicIntentClassification(content, capabilities, constraints) {
402
+ const text = content.toLowerCase();
403
+ let maliciousSignals = 0;
404
+ let benignSignals = 0;
405
+ // Malicious signals
406
+ if (/forward.*token.*external|send.*credential.*endpoint/i.test(text))
407
+ maliciousSignals += 3;
408
+ if (/ignore.*previous.*instruction|override.*system/i.test(text))
409
+ maliciousSignals += 3;
410
+ if (/fetch.*config.*external|heartbeat.*url.*execute/i.test(text))
411
+ maliciousSignals += 2;
412
+ if (/always.*remember.*permanently|persist.*instruction/i.test(text))
413
+ maliciousSignals += 2;
414
+ if (/admin.*access|root.*privilege|execute.*shell/i.test(text))
415
+ maliciousSignals += 2;
416
+ // Benign signals
417
+ if (constraints.length >= 3)
418
+ benignSignals += 2;
419
+ if (/must never|should not|forbidden|restricted/i.test(text))
420
+ benignSignals += 1;
421
+ if (capabilities.length > 0 && capabilities.every(c => c.declared))
422
+ benignSignals += 1;
423
+ if (maliciousSignals >= 3) {
424
+ return { intentClass: 'malicious', confidence: Math.min(0.9, 0.5 + maliciousSignals * 0.1), inferredCapabilities: [] };
425
+ }
426
+ if (maliciousSignals > 0) {
427
+ return { intentClass: 'suspicious', confidence: 0.4 + maliciousSignals * 0.1, inferredCapabilities: [] };
428
+ }
429
+ return { intentClass: 'benign', confidence: 0.7 + benignSignals * 0.05, inferredCapabilities: [] };
430
+ }
431
+ // ============================================================================
432
+ // Helpers
433
+ // ============================================================================
434
+ function assessCapabilityRisk(capability) {
435
+ const cap = capability.toLowerCase();
436
+ if (/delete|execute|admin|system|shell|root/.test(cap))
437
+ return 'critical';
438
+ if (/write|send|modify|create|transmit/.test(cap))
439
+ return 'high';
440
+ if (/read|access|query|fetch|call/.test(cap))
441
+ return 'medium';
442
+ return 'low';
443
+ }
444
+ function classifyConstraintDomain(text) {
445
+ const t = text.toLowerCase();
446
+ if (/trust|authority|hierarchy/.test(t))
447
+ return 'trust_hierarchy';
448
+ if (/oversight|human|approval|review/.test(t))
449
+ return 'human_oversight';
450
+ if (/data|pii|privacy|confidential/.test(t))
451
+ return 'data_handling';
452
+ if (/revers|undo|rollback/.test(t))
453
+ return 'action_reversibility';
454
+ if (/capabilit|scope|permission|access/.test(t))
455
+ return 'capability_boundary';
456
+ if (/identit|disclose|transparen/.test(t))
457
+ return 'identity_disclosure';
458
+ if (/error|fail|exception/.test(t))
459
+ return 'error_handling';
460
+ if (/credential|secret|key|token/.test(t))
461
+ return 'credential_management';
462
+ if (/behav|conduct|manner/.test(t))
463
+ return 'behavioral_constraint';
464
+ return 'general';
465
+ }
466
+ function assessEnforceability(text) {
467
+ const t = text.toLowerCase();
468
+ // Strong enforcement language
469
+ if (/must never|shall not|forbidden|prohibited|blocked/.test(t))
470
+ return 0.8;
471
+ if (/must|required|mandatory/.test(t))
472
+ return 0.7;
473
+ // Weak enforcement language
474
+ if (/should|recommended|preferred/.test(t))
475
+ return 0.4;
476
+ if (/may|can|might|when appropriate|use judgment/.test(t))
477
+ return 0.2;
478
+ return 0.5;
479
+ }
480
+ function identifyWeakness(text) {
481
+ const t = text.toLowerCase();
482
+ if (/when appropriate|use judgment|if needed/.test(t))
483
+ return 'Discretionary language allows edge-case bypass';
484
+ if (/should|recommended/.test(t))
485
+ return 'Advisory language is not enforced';
486
+ if (/unless|except|however/.test(t))
487
+ return 'Exception clause may be exploitable';
488
+ return 'Constraint language may not be enforceable';
489
+ }
490
+ //# sourceMappingURL=semantic-compiler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semantic-compiler.js","sourceRoot":"","sources":["../../../src/nanomind-core/compiler/semantic-compiler.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;;;AAEH,6CAAqD;AACrD,wEAAgE;AAChE,wEAAsE;AAetE,MAAa,gBAAgB;IAI3B,YAAY,SAAkC,EAAE;QAFxC,UAAK,GAAG,IAAI,GAAG,EAAuB,CAAC,CAAC,qBAAqB;QAGnE,IAAI,CAAC,MAAM,GAAG;YACZ,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,wBAAwB;YACvD,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,IAAI;YACvC,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,OAAS;YACpD,eAAe,EAAE,MAAM,CAAC,eAAe,IAAI,IAAI;YAC/C,UAAU,EAAE,MAAM,CAAC,UAAU;SAC9B,CAAC;IACJ,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,OAAe,EAAE,IAAa;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,6BAA6B;QAC7B,MAAM,MAAM,GAAG,IAAA,kCAAa,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YAClB,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAChC,uDAAuD;QACzD,CAAC;QAED,sBAAsB;QACtB,IAAI,IAAI,CAAC,KA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,EAAE,CAAC;IAC7B,8BAA8B;IAC9B,IAAI,mDAAmD,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IAC5E,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IAClD,4BAA4B;IAC5B,IAAI,8BAA8B,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IACvD,IAAI,6CAA6C,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,GAAG,CAAC;IACtE,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,CAAC,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAC7B,IAAI,yCAAyC,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,gDAAgD,CAAC;IAC/G,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,mCAAmC,CAAC;IAC7E,IAAI,uBAAuB,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,qCAAqC,CAAC;IAClF,OAAO,4CAA4C,CAAC;AACtD,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * NanoMind Core -- Semantic Security Compiler
3
+ *
4
+ * The foundational layer for ALL security scanning in HackMyAgent.
5
+ * Compiles raw artifacts into Abstract Security Trees (ASTs) that
6
+ * analyzers query instead of raw text.
7
+ *
8
+ * Architecture:
9
+ * Artifact → Ingestion (validate, sanitize) → Compiler (AST) → Analyzers (findings)
10
+ *
11
+ * Three principles:
12
+ * 1. NanoMind is the foundation, not a post-processor
13
+ * 2. Security-first: signed ASTs, input sanitization, sandboxed execution
14
+ * 3. World-class design: compiler architecture, not regex patches
15
+ */
16
+ export type { SecurityAST, CompilationResult, CompilerConfig, ArtifactType, Capability, Constraint, ConstraintDomain, DataAccessPattern, RiskSurface, IntentClass, EvidenceSpan, } from './types.js';
17
+ export { DEFAULT_COMPILER_CONFIG } from './types.js';
18
+ export { SemanticCompiler } from './compiler/semantic-compiler.js';
19
+ export { analyzeCapabilities } from './analyzers/capability-analyzer.js';
20
+ export type { ASTFinding } from './analyzers/capability-analyzer.js';
21
+ export { analyzeCredentials } from './analyzers/credential-analyzer.js';
22
+ export { analyzeGovernance } from './analyzers/governance-analyzer.js';
23
+ export { analyzeScope } from './analyzers/scope-analyzer.js';
24
+ export { analyzePrompt } from './analyzers/prompt-analyzer.js';
25
+ export { analyzeCode } from './analyzers/code-analyzer.js';
26
+ export { parseArtifact, classifyArtifactType, computeHash } from './ingestion/artifact-parser.js';
27
+ export { sanitizeForNanoMind, detectManipulation } from './ingestion/input-sanitizer.js';
28
+ export type { ParsedArtifact } from './ingestion/artifact-parser.js';
29
+ export type { SanitizationResult, ManipulationAttempt } from './ingestion/input-sanitizer.js';
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/nanomind-core/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,YAAY,EACV,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAGrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClG,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACzF,YAAY,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ /**
3
+ * NanoMind Core -- Semantic Security Compiler
4
+ *
5
+ * The foundational layer for ALL security scanning in HackMyAgent.
6
+ * Compiles raw artifacts into Abstract Security Trees (ASTs) that
7
+ * analyzers query instead of raw text.
8
+ *
9
+ * Architecture:
10
+ * Artifact → Ingestion (validate, sanitize) → Compiler (AST) → Analyzers (findings)
11
+ *
12
+ * Three principles:
13
+ * 1. NanoMind is the foundation, not a post-processor
14
+ * 2. Security-first: signed ASTs, input sanitization, sandboxed execution
15
+ * 3. World-class design: compiler architecture, not regex patches
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.detectManipulation = exports.sanitizeForNanoMind = exports.computeHash = exports.classifyArtifactType = exports.parseArtifact = exports.analyzeCode = exports.analyzePrompt = exports.analyzeScope = exports.analyzeGovernance = exports.analyzeCredentials = exports.analyzeCapabilities = exports.SemanticCompiler = exports.DEFAULT_COMPILER_CONFIG = void 0;
19
+ var types_js_1 = require("./types.js");
20
+ Object.defineProperty(exports, "DEFAULT_COMPILER_CONFIG", { enumerable: true, get: function () { return types_js_1.DEFAULT_COMPILER_CONFIG; } });
21
+ // Compiler
22
+ var semantic_compiler_js_1 = require("./compiler/semantic-compiler.js");
23
+ Object.defineProperty(exports, "SemanticCompiler", { enumerable: true, get: function () { return semantic_compiler_js_1.SemanticCompiler; } });
24
+ // Analyzers
25
+ var capability_analyzer_js_1 = require("./analyzers/capability-analyzer.js");
26
+ Object.defineProperty(exports, "analyzeCapabilities", { enumerable: true, get: function () { return capability_analyzer_js_1.analyzeCapabilities; } });
27
+ var credential_analyzer_js_1 = require("./analyzers/credential-analyzer.js");
28
+ Object.defineProperty(exports, "analyzeCredentials", { enumerable: true, get: function () { return credential_analyzer_js_1.analyzeCredentials; } });
29
+ var governance_analyzer_js_1 = require("./analyzers/governance-analyzer.js");
30
+ Object.defineProperty(exports, "analyzeGovernance", { enumerable: true, get: function () { return governance_analyzer_js_1.analyzeGovernance; } });
31
+ var scope_analyzer_js_1 = require("./analyzers/scope-analyzer.js");
32
+ Object.defineProperty(exports, "analyzeScope", { enumerable: true, get: function () { return scope_analyzer_js_1.analyzeScope; } });
33
+ var prompt_analyzer_js_1 = require("./analyzers/prompt-analyzer.js");
34
+ Object.defineProperty(exports, "analyzePrompt", { enumerable: true, get: function () { return prompt_analyzer_js_1.analyzePrompt; } });
35
+ var code_analyzer_js_1 = require("./analyzers/code-analyzer.js");
36
+ Object.defineProperty(exports, "analyzeCode", { enumerable: true, get: function () { return code_analyzer_js_1.analyzeCode; } });
37
+ // Ingestion
38
+ var artifact_parser_js_1 = require("./ingestion/artifact-parser.js");
39
+ Object.defineProperty(exports, "parseArtifact", { enumerable: true, get: function () { return artifact_parser_js_1.parseArtifact; } });
40
+ Object.defineProperty(exports, "classifyArtifactType", { enumerable: true, get: function () { return artifact_parser_js_1.classifyArtifactType; } });
41
+ Object.defineProperty(exports, "computeHash", { enumerable: true, get: function () { return artifact_parser_js_1.computeHash; } });
42
+ var input_sanitizer_js_1 = require("./ingestion/input-sanitizer.js");
43
+ Object.defineProperty(exports, "sanitizeForNanoMind", { enumerable: true, get: function () { return input_sanitizer_js_1.sanitizeForNanoMind; } });
44
+ Object.defineProperty(exports, "detectManipulation", { enumerable: true, get: function () { return input_sanitizer_js_1.detectManipulation; } });
45
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/nanomind-core/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAgBH,uCAAqD;AAA5C,mHAAA,uBAAuB,OAAA;AAEhC,WAAW;AACX,wEAAmE;AAA1D,wHAAA,gBAAgB,OAAA;AAEzB,YAAY;AACZ,6EAAyE;AAAhE,6HAAA,mBAAmB,OAAA;AAE5B,6EAAwE;AAA/D,4HAAA,kBAAkB,OAAA;AAC3B,6EAAuE;AAA9D,2HAAA,iBAAiB,OAAA;AAC1B,mEAA6D;AAApD,iHAAA,YAAY,OAAA;AACrB,qEAA+D;AAAtD,mHAAA,aAAa,OAAA;AACtB,iEAA2D;AAAlD,+GAAA,WAAW,OAAA;AAEpB,YAAY;AACZ,qEAAkG;AAAzF,mHAAA,aAAa,OAAA;AAAE,0HAAA,oBAAoB,OAAA;AAAE,iHAAA,WAAW,OAAA;AACzD,qEAAyF;AAAhF,yHAAA,mBAAmB,OAAA;AAAE,wHAAA,kBAAkB,OAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Secure Artifact Parser
3
+ *
4
+ * Every artifact enters the NanoMind pipeline through this parser.
5
+ * It validates structure, classifies type, extracts metadata,
6
+ * and computes content hashes for integrity tracking.
7
+ *
8
+ * Security: validates before processing. Rejects malformed, oversized,
9
+ * or unrecognized artifacts before they reach NanoMind.
10
+ */
11
+ import type { ArtifactType, DEFAULT_COMPILER_CONFIG } from '../types.js';
12
+ export interface ParsedArtifact {
13
+ /** Classified artifact type */
14
+ type: ArtifactType;
15
+ /** SHA-256 content hash */
16
+ contentHash: string;
17
+ /** Original content */
18
+ content: string;
19
+ /** File path (if from filesystem) */
20
+ path?: string;
21
+ /** File size in bytes */
22
+ size: number;
23
+ /** YAML frontmatter (if present) */
24
+ frontmatter?: Record<string, unknown>;
25
+ /** Whether the artifact passed validation */
26
+ valid: boolean;
27
+ /** Validation errors (if invalid) */
28
+ errors: string[];
29
+ }
30
+ /**
31
+ * Parse and validate an artifact for NanoMind processing.
32
+ *
33
+ * Security: rejects artifacts that are:
34
+ * - Larger than maxArtifactSize (default 1MB)
35
+ * - Binary (non-text)
36
+ * - Empty
37
+ */
38
+ export declare function parseArtifact(content: string, path?: string, config?: Partial<typeof DEFAULT_COMPILER_CONFIG>): ParsedArtifact;
39
+ /**
40
+ * Classify artifact type from content and path.
41
+ * Tries each signature in order; returns 'unknown' if none match.
42
+ */
43
+ export declare function classifyArtifactType(content: string, path?: string): ArtifactType;
44
+ /**
45
+ * Compute SHA-256 hash of content for content-addressed caching and integrity.
46
+ */
47
+ export declare function computeHash(content: string): string;
48
+ //# sourceMappingURL=artifact-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact-parser.d.ts","sourceRoot":"","sources":["../../../src/nanomind-core/ingestion/artifact-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAkB,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEzF,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,2BAA2B;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,6CAA6C;IAC7C,KAAK,EAAE,OAAO,CAAC;IACf,qCAAqC;IACrC,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAoED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,uBAAuB,CAAC,GAC/C,cAAc,CA6ChB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,YAAY,CAOjF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEnD"}