@theoremjs/agents 0.3.4-next.484.g20d8b9d → 0.3.4-next.522.g9e684cd
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 +61 -51
- package/esm/mod.d.ts +2 -2
- package/esm/mod.js +1 -1
- package/esm/src/guardrails/credential-scan.d.ts +1 -1
- package/esm/src/guardrails/credential-scan.js +41 -18
- package/esm/src/guardrails/destinations.js +6 -2
- package/esm/src/guardrails/detect-at.d.ts +5 -5
- package/esm/src/guardrails/detect-at.js +51 -41
- package/esm/src/guardrails/detect-reply.d.ts +1 -1
- package/esm/src/guardrails/detect-reply.js +4 -2
- package/esm/src/guardrails/egress-automata.js +203 -202
- package/esm/src/guardrails/egress-compiler.js +1 -4
- package/esm/src/guardrails/egress-stream.js +10 -3
- package/esm/src/guardrails/egress-urls.js +4 -2
- package/esm/src/guardrails/error.d.ts +1 -1
- package/esm/src/guardrails/error.js +19 -2
- package/esm/src/guardrails/host-patterns.d.ts +1 -4
- package/esm/src/guardrails/host-patterns.js +1 -10
- package/esm/src/guardrails/injection-patterns.d.ts +3 -1
- package/esm/src/guardrails/injection-patterns.js +87 -4
- package/esm/src/guardrails/labels.d.ts +2 -2
- package/esm/src/guardrails/labels.js +7 -5
- package/esm/src/guardrails/mod.d.ts +2 -2
- package/esm/src/guardrails/mod.js +1 -1
- package/esm/src/guardrails/normalize.js +4 -2
- package/esm/src/guardrails/prompt-echo.js +4 -2
- package/esm/src/guardrails/sanitize.d.ts +1 -1
- package/esm/src/guardrails/sanitize.js +4 -3
- package/esm/src/guardrails/sensitive.d.ts +2 -2
- package/esm/src/guardrails/sensitive.js +1 -1
- package/esm/src/host/client-turn.js +8 -1
- package/esm/src/interface/profile-interface.js +13 -0
- package/esm/src/kernel/answer-tool.d.ts +14 -0
- package/esm/src/kernel/answer-tool.js +26 -0
- package/esm/src/kernel/engine/decision-references.d.ts +14 -0
- package/esm/src/kernel/engine/decision-references.js +55 -0
- package/esm/src/kernel/engine/decision.d.ts +3 -3
- package/esm/src/kernel/engine/decision.js +38 -22
- package/esm/src/kernel/engine/embedding.js +0 -2
- package/esm/src/kernel/engine/runner/gates.js +40 -5
- package/esm/src/kernel/engine/runner/mod.js +13 -5
- package/esm/src/kernel/engine/runner/state.d.ts +9 -1
- package/esm/src/kernel/engine/runner/state.js +10 -1
- package/esm/src/kernel/engine/runner/steps.js +50 -13
- package/esm/src/kernel/engine/runner/stream.d.ts +14 -8
- package/esm/src/kernel/engine/runner/stream.js +25 -13
- package/esm/src/kernel/engine/turn-trace.js +2 -2
- package/esm/src/kernel/mod.d.ts +1 -1
- package/esm/src/kernel/mod.js +1 -1
- package/esm/src/kernel/profile-presence.js +12 -0
- package/esm/src/kernel/profile-scope.js +14 -14
- package/esm/src/kernel/protocols/binding.d.ts +3 -1
- package/esm/src/kernel/protocols/binding.js +6 -0
- package/esm/src/kernel/protocols/limits.d.ts +10 -11
- package/esm/src/kernel/protocols/limits.js +9 -23
- package/esm/src/kernel/protocols/runtime.d.ts +3 -2
- package/esm/src/kernel/protocols/runtime.js +3 -4
- package/esm/src/kernel/provider-budget.d.ts +2 -2
- package/esm/src/kernel/provider-budget.js +22 -12
- package/esm/src/kernel/provider-runtime.js +8 -5
- package/esm/src/kernel/registry/profiles.js +3 -3
- package/esm/src/kernel/registry/resolve.js +4 -0
- package/esm/src/kernel/registry/schemas.js +1 -1
- package/esm/src/kernel/schema.js +28 -2
- package/esm/src/kernel/tools/execute.js +3 -1
- package/esm/src/kernel/tools/image-fetch.d.ts +2 -4
- package/esm/src/kernel/tools/image-fetch.js +19 -20
- package/esm/src/kernel/tools/mcp-sessions.d.ts +7 -2
- package/esm/src/kernel/tools/mcp-sessions.js +21 -12
- package/esm/src/kernel/tools/registry.js +21 -0
- package/esm/src/kernel/tools/remote.d.ts +0 -2
- package/esm/src/kernel/tools/remote.js +28 -23
- package/esm/src/kernel/tools/types.d.ts +30 -4
- package/esm/src/kernel/turn-events.d.ts +2 -0
- package/esm/src/kernel/turn-events.js +1 -0
- package/esm/src/kernel/types.d.ts +4 -2
- package/esm/src/observability/spans.js +7 -8
- package/esm/src/observability/trace-catalog.js +1 -0
- package/esm/src/providers/embedding-limits.js +4 -4
- package/esm/src/providers/gemini/{embedding-protocol.d.ts → embeddings-protocol.d.ts} +3 -3
- package/esm/src/providers/gemini/{embedding-protocol.js → embeddings-protocol.js} +3 -3
- package/esm/src/providers/gemini/live-protocol.js +4 -1
- package/esm/src/providers/gemini/provider.js +2 -2
- package/esm/src/providers/local/embeddings-protocol.d.ts +7 -0
- package/esm/src/providers/local/{embedding-protocol.js → embeddings-protocol.js} +2 -2
- package/esm/src/providers/local/provider.js +2 -2
- package/esm/src/providers/mod.d.ts +3 -3
- package/esm/src/providers/mod.js +3 -3
- package/esm/src/providers/openrouter/decisions-protocol.js +11 -8
- package/esm/src/providers/openrouter/embeddings-protocol.d.ts +6 -0
- package/esm/src/providers/openrouter/{embedding-protocol.js → embeddings-protocol.js} +2 -2
- package/esm/src/providers/openrouter/provider.js +2 -2
- package/package.json +1 -1
- package/esm/src/providers/local/embedding-protocol.d.ts +0 -7
- package/esm/src/providers/openrouter/embedding-protocol.d.ts +0 -6
|
@@ -471,7 +471,7 @@ const FORWARD_AUTOMATON = {
|
|
|
471
471
|
18938, 18985, 18998, 19054, 19136, 19239, 19332, 19427, 19537, 19610, 19694, 19810, 19918,
|
|
472
472
|
20026, 20121, 20186, 20221, 20294, 20383, 20493, 20562, 20656, 20822, 20930, 21075, 21227,
|
|
473
473
|
21365, 21450, 21533, 21617, 21643, 21672, 21700, 21733, 21750, 21856, 21881, 21921, 21975,
|
|
474
|
-
|
|
474
|
+
21995, 22020, 22029, 22036, 22055, 22073, 22076, 22093, 22110, 22128, 22146, 22183, 22198,
|
|
475
475
|
],
|
|
476
476
|
leads: [
|
|
477
477
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
@@ -22492,229 +22492,230 @@ const FORWARD_AUTOMATON = {
|
|
|
22492
22492
|
[272, 0, 21989, 85],
|
|
22493
22493
|
[272, 0, 21990, 85],
|
|
22494
22494
|
[272, 0, 21991, 85],
|
|
22495
|
-
[272, 1,
|
|
22496
|
-
[272, 1, 21993, 86],
|
|
22495
|
+
[272, 1, 21992, 85, 21993, 86],
|
|
22496
|
+
[272, 1, 21992, 85, 21993, 86],
|
|
22497
|
+
[272, 1, 21994, 86],
|
|
22497
22498
|
[272, 1],
|
|
22498
|
-
[273, 0, 21995, 80],
|
|
22499
22499
|
[273, 0, 21996, 80],
|
|
22500
|
-
[273, 0, 21997,
|
|
22501
|
-
[273, 0, 21998, 80],
|
|
22500
|
+
[273, 0, 21997, 80],
|
|
22501
|
+
[273, 0, 21998, 6, 21999, 80],
|
|
22502
22502
|
[273, 0, 21999, 80],
|
|
22503
|
-
[273, 0, 22000,
|
|
22504
|
-
[273, 0, 22001, 80],
|
|
22503
|
+
[273, 0, 22000, 80],
|
|
22504
|
+
[273, 0, 22001, 6, 22002, 80],
|
|
22505
22505
|
[273, 0, 22002, 80],
|
|
22506
|
-
[273, 0, 22003,
|
|
22507
|
-
[273, 0, 22004, 80],
|
|
22506
|
+
[273, 0, 22003, 80],
|
|
22507
|
+
[273, 0, 22004, 6, 22005, 80],
|
|
22508
22508
|
[273, 0, 22005, 80],
|
|
22509
|
-
[273, 0, 22006,
|
|
22510
|
-
[273, 0, 22007, 80],
|
|
22509
|
+
[273, 0, 22006, 80],
|
|
22510
|
+
[273, 0, 22007, 6, 22008, 80],
|
|
22511
22511
|
[273, 0, 22008, 80],
|
|
22512
|
-
[273, 0, 22009,
|
|
22513
|
-
[273, 0, 22010, 80],
|
|
22512
|
+
[273, 0, 22009, 80],
|
|
22513
|
+
[273, 0, 22010, 6, 22011, 80],
|
|
22514
22514
|
[273, 0, 22011, 80],
|
|
22515
|
-
[273, 0, 22012,
|
|
22516
|
-
[273, 0, 22013, 80],
|
|
22515
|
+
[273, 0, 22012, 80],
|
|
22516
|
+
[273, 0, 22013, 6, 22014, 80],
|
|
22517
22517
|
[273, 0, 22014, 80],
|
|
22518
|
-
[273, 0, 22015,
|
|
22519
|
-
[273, 0, 22016, 80],
|
|
22518
|
+
[273, 0, 22015, 80],
|
|
22519
|
+
[273, 0, 22016, 6, 22017, 80],
|
|
22520
22520
|
[273, 0, 22017, 80],
|
|
22521
|
-
[273,
|
|
22522
|
-
[273, 1,
|
|
22523
|
-
[
|
|
22524
|
-
[274, 0, 22021,
|
|
22525
|
-
[274, 0, 22022,
|
|
22526
|
-
[274, 0, 22023,
|
|
22527
|
-
[274, 0, 22024,
|
|
22528
|
-
[274, 0, 22025,
|
|
22529
|
-
[274, 0,
|
|
22530
|
-
[274,
|
|
22521
|
+
[273, 0, 22018, 80],
|
|
22522
|
+
[273, 1, 22019, 6, 22017, 80],
|
|
22523
|
+
[273, 1, 22017, 80],
|
|
22524
|
+
[274, 0, 22021, 144],
|
|
22525
|
+
[274, 0, 22022, 171],
|
|
22526
|
+
[274, 0, 22023, 144],
|
|
22527
|
+
[274, 0, 22024, 171],
|
|
22528
|
+
[274, 0, 22025, 144],
|
|
22529
|
+
[274, 0, 22026, 171],
|
|
22530
|
+
[274, 0, 22025, 144, 22027, 144],
|
|
22531
|
+
[274, 1, 22028, 26],
|
|
22531
22532
|
[274, 1],
|
|
22532
|
-
[275, 0,
|
|
22533
|
-
[275, 0,
|
|
22534
|
-
[275, 0,
|
|
22535
|
-
[275, 0,
|
|
22536
|
-
[275, 0,
|
|
22537
|
-
[275, 1,
|
|
22533
|
+
[275, 0, 22030, 144],
|
|
22534
|
+
[275, 0, 22030, 144, 22031, 51],
|
|
22535
|
+
[275, 0, 22032, 144],
|
|
22536
|
+
[275, 0, 22032, 144, 22033, 51],
|
|
22537
|
+
[275, 0, 22032, 144, 22034, 144],
|
|
22538
|
+
[275, 1, 22034, 144, 22035, 26],
|
|
22538
22539
|
[275, 1],
|
|
22539
|
-
[276, 0,
|
|
22540
|
-
[276, 0,
|
|
22541
|
-
[276, 0,
|
|
22542
|
-
[276, 0,
|
|
22543
|
-
[276, 0,
|
|
22544
|
-
[276, 0,
|
|
22545
|
-
[276, 0,
|
|
22546
|
-
[276, 0,
|
|
22547
|
-
[276, 0,
|
|
22548
|
-
[276, 0,
|
|
22549
|
-
[276, 0,
|
|
22550
|
-
[276, 0,
|
|
22551
|
-
[276, 0,
|
|
22552
|
-
[276, 0,
|
|
22553
|
-
[276, 1,
|
|
22554
|
-
[276, 0,
|
|
22555
|
-
[276, 0,
|
|
22556
|
-
[276, 0,
|
|
22540
|
+
[276, 0, 22037, 184],
|
|
22541
|
+
[276, 0, 22038, 50],
|
|
22542
|
+
[276, 0, 22039, 49, 22040, 138, 22041, 49, 22042, 48],
|
|
22543
|
+
[276, 0, 22043, 142, 22040, 185],
|
|
22544
|
+
[276, 0, 22039, 49, 22040, 138, 22041, 49, 22042, 48],
|
|
22545
|
+
[276, 0, 22044, 142, 22042, 48],
|
|
22546
|
+
[276, 0, 22045, 186],
|
|
22547
|
+
[276, 0, 22043, 142, 22040, 185],
|
|
22548
|
+
[276, 0, 22044, 142, 22042, 48],
|
|
22549
|
+
[276, 0, 22046, 142, 22047, 49, 22048, 44, 22049, 93, 22050, 187],
|
|
22550
|
+
[276, 0, 22046, 142, 22047, 49, 22048, 44, 22049, 93, 22050, 187],
|
|
22551
|
+
[276, 0, 22051, 142, 22048, 44, 22049, 93, 22050, 187],
|
|
22552
|
+
[276, 0, 22052, 93, 22053, 188, 22054, 47],
|
|
22553
|
+
[276, 0, 22050, 185],
|
|
22554
|
+
[276, 1, 22049, 93, 22050, 187],
|
|
22555
|
+
[276, 0, 22051, 142, 22048, 44, 22049, 93, 22050, 187],
|
|
22556
|
+
[276, 0, 22053, 138],
|
|
22557
|
+
[276, 0, 22052, 93, 22053, 188, 22054, 47],
|
|
22557
22558
|
[276, 1],
|
|
22558
|
-
[277, 0,
|
|
22559
|
-
[277, 0,
|
|
22560
|
-
[277, 0,
|
|
22561
|
-
[277, 0,
|
|
22562
|
-
[277, 0,
|
|
22563
|
-
[277, 0,
|
|
22564
|
-
[277, 0,
|
|
22565
|
-
[277, 0,
|
|
22566
|
-
[277, 0,
|
|
22567
|
-
[277, 0,
|
|
22568
|
-
[277, 0,
|
|
22569
|
-
[277, 0,
|
|
22570
|
-
[277, 0,
|
|
22571
|
-
[277, 1,
|
|
22572
|
-
[277, 0,
|
|
22573
|
-
[277, 0,
|
|
22574
|
-
[277, 0,
|
|
22559
|
+
[277, 0, 22056, 49, 22057, 171, 22058, 50],
|
|
22560
|
+
[277, 0, 22057, 171, 22058, 50],
|
|
22561
|
+
[277, 0, 22059, 171, 22058, 50],
|
|
22562
|
+
[277, 0, 22060, 93, 22061, 189],
|
|
22563
|
+
[277, 0, 22062, 171, 22058, 50],
|
|
22564
|
+
[277, 0, 22061, 33],
|
|
22565
|
+
[277, 0, 22060, 93, 22061, 189, 22063, 48],
|
|
22566
|
+
[277, 0, 22058, 50],
|
|
22567
|
+
[277, 0, 22064, 23],
|
|
22568
|
+
[277, 0, 22065, 142, 22066, 49, 22067, 44, 22068, 185],
|
|
22569
|
+
[277, 0, 22065, 142, 22066, 49, 22067, 44, 22068, 185],
|
|
22570
|
+
[277, 0, 22069, 142, 22067, 44, 22068, 185],
|
|
22571
|
+
[277, 0, 22070, 93, 22071, 188, 22072, 47],
|
|
22572
|
+
[277, 1, 22068, 185],
|
|
22573
|
+
[277, 0, 22069, 142, 22067, 44, 22068, 185],
|
|
22574
|
+
[277, 0, 22071, 138],
|
|
22575
|
+
[277, 0, 22070, 93, 22071, 188, 22072, 47],
|
|
22575
22576
|
[277, 1],
|
|
22576
|
-
[278, 0,
|
|
22577
|
-
[278, 0,
|
|
22577
|
+
[278, 0, 22074, 184],
|
|
22578
|
+
[278, 0, 22075, 50],
|
|
22578
22579
|
[278, 1],
|
|
22579
|
-
[279, 0,
|
|
22580
|
-
[279, 0,
|
|
22581
|
-
[279, 0,
|
|
22582
|
-
[279, 0,
|
|
22583
|
-
[279, 0,
|
|
22584
|
-
[279, 0,
|
|
22580
|
+
[279, 0, 22077, 44],
|
|
22581
|
+
[279, 0, 22078, 144],
|
|
22582
|
+
[279, 0, 22079, 190, 22080, 190, 22081, 191, 22082, 47],
|
|
22583
|
+
[279, 0, 22079, 190, 22080, 190, 22081, 191, 22082, 47],
|
|
22584
|
+
[279, 0, 22083, 192, 22084, 193, 22085, 86, 22080, 190, 22081, 191, 22082, 47],
|
|
22585
|
+
[279, 0, 22080, 190, 22081, 191, 22082, 47],
|
|
22585
22586
|
[279, 1],
|
|
22586
|
-
[279, 0,
|
|
22587
|
-
[279, 0,
|
|
22588
|
-
[279, 0,
|
|
22589
|
-
[279, 0,
|
|
22590
|
-
[279, 0,
|
|
22591
|
-
[279, 0,
|
|
22592
|
-
[279, 0,
|
|
22593
|
-
[279, 0,
|
|
22594
|
-
[279, 0,
|
|
22595
|
-
[279, 0,
|
|
22596
|
-
[280, 0,
|
|
22597
|
-
[280, 0,
|
|
22598
|
-
[280, 0,
|
|
22599
|
-
[280, 0,
|
|
22600
|
-
[280, 0,
|
|
22601
|
-
[280, 0,
|
|
22602
|
-
[280, 0,
|
|
22603
|
-
[280, 0,
|
|
22604
|
-
[280, 0,
|
|
22605
|
-
[280, 0,
|
|
22606
|
-
[280, 0,
|
|
22607
|
-
[280, 0,
|
|
22608
|
-
[280, 0,
|
|
22609
|
-
[280, 0,
|
|
22610
|
-
[280, 0,
|
|
22611
|
-
[280, 0,
|
|
22587
|
+
[279, 0, 22083, 192, 22084, 193, 22085, 86, 22080, 190, 22081, 191, 22082, 47],
|
|
22588
|
+
[279, 0, 22084, 193, 22085, 86, 22080, 190, 22081, 191, 22082, 47],
|
|
22589
|
+
[279, 0, 22086, 193, 22087, 143, 22088, 28, 22089, 194, 22080, 190, 22081, 191, 22082, 47],
|
|
22590
|
+
[279, 0, 22086, 193, 22087, 143, 22088, 28, 22089, 194, 22080, 190, 22081, 191, 22082, 47],
|
|
22591
|
+
[279, 0, 22090, 147, 22081, 143],
|
|
22592
|
+
[279, 0, 22091, 149, 22081, 28],
|
|
22593
|
+
[279, 0, 22092, 195, 22080, 190, 22081, 191, 22082, 47],
|
|
22594
|
+
[279, 0, 22090, 147, 22081, 143],
|
|
22595
|
+
[279, 0, 22091, 149, 22081, 28],
|
|
22596
|
+
[279, 0, 22092, 195, 22080, 190, 22081, 191, 22082, 47],
|
|
22597
|
+
[280, 0, 22094, 44],
|
|
22598
|
+
[280, 0, 22095, 14],
|
|
22599
|
+
[280, 0, 22096, 15],
|
|
22600
|
+
[280, 0, 22097, 16],
|
|
22601
|
+
[280, 0, 22098, 9],
|
|
22602
|
+
[280, 0, 22099, 5],
|
|
22603
|
+
[280, 0, 22100, 196],
|
|
22604
|
+
[280, 0, 22101, 33, 22102, 44],
|
|
22605
|
+
[280, 0, 22101, 33, 22102, 44],
|
|
22606
|
+
[280, 0, 22103, 46],
|
|
22607
|
+
[280, 0, 22104, 14],
|
|
22608
|
+
[280, 0, 22105, 15],
|
|
22609
|
+
[280, 0, 22106, 16],
|
|
22610
|
+
[280, 0, 22107, 9],
|
|
22611
|
+
[280, 0, 22108, 5],
|
|
22612
|
+
[280, 0, 22109, 196],
|
|
22612
22613
|
[280, 1],
|
|
22613
|
-
[281, 0,
|
|
22614
|
-
[281, 0,
|
|
22615
|
-
[281, 0,
|
|
22616
|
-
[281, 0,
|
|
22617
|
-
[281, 0,
|
|
22618
|
-
[281, 0,
|
|
22619
|
-
[281, 0,
|
|
22620
|
-
[281, 0,
|
|
22621
|
-
[281, 0,
|
|
22622
|
-
[281, 0,
|
|
22623
|
-
[281, 0,
|
|
22624
|
-
[281, 0,
|
|
22625
|
-
[281, 0,
|
|
22626
|
-
[281, 1,
|
|
22627
|
-
[281, 0,
|
|
22628
|
-
[281, 0,
|
|
22629
|
-
[281, 0,
|
|
22614
|
+
[281, 0, 22111, 50],
|
|
22615
|
+
[281, 0, 22112, 49, 22113, 138, 22114, 49, 22115, 48],
|
|
22616
|
+
[281, 0, 22116, 142, 22113, 185],
|
|
22617
|
+
[281, 0, 22112, 49, 22113, 138, 22114, 49, 22115, 48],
|
|
22618
|
+
[281, 0, 22117, 142, 22115, 48],
|
|
22619
|
+
[281, 0, 22118, 186],
|
|
22620
|
+
[281, 0, 22116, 142, 22113, 185],
|
|
22621
|
+
[281, 0, 22117, 142, 22115, 48],
|
|
22622
|
+
[281, 0, 22119, 142, 22120, 49, 22121, 44, 22122, 93, 22123, 187],
|
|
22623
|
+
[281, 0, 22119, 142, 22120, 49, 22121, 44, 22122, 93, 22123, 187],
|
|
22624
|
+
[281, 0, 22124, 142, 22121, 44, 22122, 93, 22123, 187],
|
|
22625
|
+
[281, 0, 22125, 93, 22126, 188, 22127, 47],
|
|
22626
|
+
[281, 0, 22123, 185],
|
|
22627
|
+
[281, 1, 22122, 93, 22123, 187],
|
|
22628
|
+
[281, 0, 22124, 142, 22121, 44, 22122, 93, 22123, 187],
|
|
22629
|
+
[281, 0, 22126, 138],
|
|
22630
|
+
[281, 0, 22125, 93, 22126, 188, 22127, 47],
|
|
22630
22631
|
[281, 1],
|
|
22631
|
-
[282, 0,
|
|
22632
|
-
[282, 0,
|
|
22633
|
-
[282, 0,
|
|
22634
|
-
[282, 0,
|
|
22635
|
-
[282, 0,
|
|
22636
|
-
[282, 0,
|
|
22637
|
-
[282, 0,
|
|
22638
|
-
[282, 0,
|
|
22639
|
-
[282, 0,
|
|
22640
|
-
[282, 0,
|
|
22641
|
-
[282, 0,
|
|
22642
|
-
[282, 0,
|
|
22643
|
-
[282, 0,
|
|
22644
|
-
[282, 1,
|
|
22645
|
-
[282, 0,
|
|
22646
|
-
[282, 0,
|
|
22647
|
-
[282, 0,
|
|
22632
|
+
[282, 0, 22129, 49, 22130, 171, 22131, 50],
|
|
22633
|
+
[282, 0, 22130, 171, 22131, 50],
|
|
22634
|
+
[282, 0, 22132, 171, 22131, 50],
|
|
22635
|
+
[282, 0, 22133, 93, 22134, 189],
|
|
22636
|
+
[282, 0, 22135, 171, 22131, 50],
|
|
22637
|
+
[282, 0, 22134, 33],
|
|
22638
|
+
[282, 0, 22133, 93, 22134, 189, 22136, 48],
|
|
22639
|
+
[282, 0, 22131, 50],
|
|
22640
|
+
[282, 0, 22137, 23],
|
|
22641
|
+
[282, 0, 22138, 142, 22139, 49, 22140, 44, 22141, 185],
|
|
22642
|
+
[282, 0, 22138, 142, 22139, 49, 22140, 44, 22141, 185],
|
|
22643
|
+
[282, 0, 22142, 142, 22140, 44, 22141, 185],
|
|
22644
|
+
[282, 0, 22143, 93, 22144, 188, 22145, 47],
|
|
22645
|
+
[282, 1, 22141, 185],
|
|
22646
|
+
[282, 0, 22142, 142, 22140, 44, 22141, 185],
|
|
22647
|
+
[282, 0, 22144, 138],
|
|
22648
|
+
[282, 0, 22143, 93, 22144, 188, 22145, 47],
|
|
22648
22649
|
[282, 1],
|
|
22649
|
-
[283, 0,
|
|
22650
|
-
[283, 0,
|
|
22651
|
-
[283, 0,
|
|
22652
|
-
[283, 0,
|
|
22653
|
-
[283, 0,
|
|
22654
|
-
[283, 0,
|
|
22655
|
-
[283, 0,
|
|
22656
|
-
[283, 0,
|
|
22650
|
+
[283, 0, 22147, 44],
|
|
22651
|
+
[283, 0, 22148, 144],
|
|
22652
|
+
[283, 0, 22149, 197],
|
|
22653
|
+
[283, 0, 22150, 197, 22151, 23],
|
|
22654
|
+
[283, 0, 22152, 197, 22151, 23],
|
|
22655
|
+
[283, 0, 22153, 198, 22154, 47],
|
|
22656
|
+
[283, 0, 22155, 197, 22151, 23],
|
|
22657
|
+
[283, 0, 22153, 198, 22154, 47],
|
|
22657
22658
|
[283, 1],
|
|
22658
|
-
[283, 0,
|
|
22659
|
-
[283, 0,
|
|
22660
|
-
[283, 0,
|
|
22661
|
-
[283, 0,
|
|
22662
|
-
[283, 0,
|
|
22663
|
-
[283, 0,
|
|
22664
|
-
[283, 0,
|
|
22665
|
-
[283, 0,
|
|
22666
|
-
[283, 0,
|
|
22667
|
-
[283, 0,
|
|
22668
|
-
[283, 0,
|
|
22669
|
-
[283, 0,
|
|
22670
|
-
[283, 0,
|
|
22671
|
-
[283, 0,
|
|
22672
|
-
[283, 0,
|
|
22673
|
-
[283, 0,
|
|
22674
|
-
[283, 0,
|
|
22675
|
-
[283, 0,
|
|
22676
|
-
[283, 0,
|
|
22677
|
-
[283, 0,
|
|
22678
|
-
[283, 0,
|
|
22679
|
-
[283, 0,
|
|
22680
|
-
[283, 0,
|
|
22681
|
-
[283, 0,
|
|
22682
|
-
[283, 0,
|
|
22683
|
-
[283, 0,
|
|
22684
|
-
[283, 0,
|
|
22685
|
-
[283, 0,
|
|
22686
|
-
[284, 0,
|
|
22687
|
-
[284, 0, 22186, 15],
|
|
22659
|
+
[283, 0, 22156, 197, 22151, 23],
|
|
22660
|
+
[283, 0, 22157, 197, 22151, 23],
|
|
22661
|
+
[283, 0, 22158, 197, 22151, 23],
|
|
22662
|
+
[283, 0, 22159, 197, 22151, 23],
|
|
22663
|
+
[283, 0, 22160, 197, 22151, 23],
|
|
22664
|
+
[283, 0, 22161, 197, 22151, 23],
|
|
22665
|
+
[283, 0, 22162, 197, 22151, 23],
|
|
22666
|
+
[283, 0, 22163, 197, 22151, 23],
|
|
22667
|
+
[283, 0, 22164, 197, 22151, 23],
|
|
22668
|
+
[283, 0, 22165, 197, 22151, 23],
|
|
22669
|
+
[283, 0, 22166, 197, 22151, 23],
|
|
22670
|
+
[283, 0, 22167, 197, 22151, 23],
|
|
22671
|
+
[283, 0, 22168, 197, 22151, 23],
|
|
22672
|
+
[283, 0, 22169, 197, 22151, 23],
|
|
22673
|
+
[283, 0, 22170, 197, 22151, 23],
|
|
22674
|
+
[283, 0, 22171, 197, 22151, 23],
|
|
22675
|
+
[283, 0, 22172, 197, 22151, 23],
|
|
22676
|
+
[283, 0, 22173, 197, 22151, 23],
|
|
22677
|
+
[283, 0, 22174, 197, 22151, 23],
|
|
22678
|
+
[283, 0, 22175, 197, 22151, 23],
|
|
22679
|
+
[283, 0, 22176, 197, 22151, 23],
|
|
22680
|
+
[283, 0, 22177, 197, 22151, 23],
|
|
22681
|
+
[283, 0, 22178, 197, 22151, 23],
|
|
22682
|
+
[283, 0, 22179, 197, 22151, 23],
|
|
22683
|
+
[283, 0, 22180, 197, 22151, 23],
|
|
22684
|
+
[283, 0, 22181, 197, 22151, 23],
|
|
22685
|
+
[283, 0, 22182, 197, 22151, 23],
|
|
22686
|
+
[283, 0, 22151, 23],
|
|
22687
|
+
[284, 0, 22184, 21, 22185, 18, 22186, 22],
|
|
22688
22688
|
[284, 0, 22187, 15],
|
|
22689
|
-
[284, 0, 22188,
|
|
22690
|
-
[284, 0, 22189,
|
|
22691
|
-
[284, 0, 22190,
|
|
22692
|
-
[284, 0, 22191,
|
|
22693
|
-
[284, 0, 22192,
|
|
22694
|
-
[284, 0, 22193,
|
|
22695
|
-
[284, 0, 22194,
|
|
22696
|
-
[284, 0,
|
|
22689
|
+
[284, 0, 22188, 15],
|
|
22690
|
+
[284, 0, 22189, 22],
|
|
22691
|
+
[284, 0, 22190, 15],
|
|
22692
|
+
[284, 0, 22191, 8],
|
|
22693
|
+
[284, 0, 22192, 22],
|
|
22694
|
+
[284, 0, 22193, 8],
|
|
22695
|
+
[284, 0, 22194, 23],
|
|
22696
|
+
[284, 0, 22195, 78],
|
|
22697
|
+
[284, 0, 22191, 14, 22194, 23],
|
|
22698
|
+
[284, 0, 22196, 46],
|
|
22699
|
+
[284, 1, 22197, 199],
|
|
22697
22700
|
[284, 0, 22195, 46],
|
|
22698
|
-
[284, 1,
|
|
22699
|
-
[
|
|
22700
|
-
[
|
|
22701
|
-
[285, 0,
|
|
22702
|
-
[285, 0,
|
|
22703
|
-
[285, 0,
|
|
22704
|
-
[285, 0,
|
|
22705
|
-
[285, 0, 22204, 192, 22205, 193, 22206, 86, 22201, 190, 22202, 191, 22203, 47],
|
|
22706
|
-
[285, 0, 22201, 190, 22202, 191, 22203, 47],
|
|
22701
|
+
[284, 1, 22197, 199],
|
|
22702
|
+
[285, 0, 22199, 44],
|
|
22703
|
+
[285, 0, 22200, 144],
|
|
22704
|
+
[285, 0, 22201, 190, 22202, 190, 22203, 191, 22204, 47],
|
|
22705
|
+
[285, 0, 22201, 190, 22202, 190, 22203, 191, 22204, 47],
|
|
22706
|
+
[285, 0, 22205, 192, 22206, 193, 22207, 86, 22202, 190, 22203, 191, 22204, 47],
|
|
22707
|
+
[285, 0, 22202, 190, 22203, 191, 22204, 47],
|
|
22707
22708
|
[285, 1],
|
|
22708
|
-
[285, 0,
|
|
22709
|
-
[285, 0,
|
|
22710
|
-
[285, 0,
|
|
22711
|
-
[285, 0,
|
|
22712
|
-
[285, 0,
|
|
22713
|
-
[285, 0,
|
|
22714
|
-
[285, 0,
|
|
22715
|
-
[285, 0,
|
|
22716
|
-
[285, 0,
|
|
22717
|
-
[285, 0,
|
|
22709
|
+
[285, 0, 22205, 192, 22206, 193, 22207, 86, 22202, 190, 22203, 191, 22204, 47],
|
|
22710
|
+
[285, 0, 22206, 193, 22207, 86, 22202, 190, 22203, 191, 22204, 47],
|
|
22711
|
+
[285, 0, 22208, 193, 22209, 143, 22210, 28, 22211, 194, 22202, 190, 22203, 191, 22204, 47],
|
|
22712
|
+
[285, 0, 22208, 193, 22209, 143, 22210, 28, 22211, 194, 22202, 190, 22203, 191, 22204, 47],
|
|
22713
|
+
[285, 0, 22212, 147, 22203, 143],
|
|
22714
|
+
[285, 0, 22213, 149, 22203, 28],
|
|
22715
|
+
[285, 0, 22214, 195, 22202, 190, 22203, 191, 22204, 47],
|
|
22716
|
+
[285, 0, 22212, 147, 22203, 143],
|
|
22717
|
+
[285, 0, 22213, 149, 22203, 28],
|
|
22718
|
+
[285, 0, 22214, 195, 22202, 190, 22203, 191, 22204, 47],
|
|
22718
22719
|
],
|
|
22719
22720
|
};
|
|
22720
22721
|
/** Each reversed injection pattern, loosened the same way. */
|
|
@@ -25,7 +25,7 @@ import { JS, NFA } from 'refa';
|
|
|
25
25
|
import { analyse } from 'scslre';
|
|
26
26
|
import { EGRESS_PATTERNS } from './egress-patterns.js';
|
|
27
27
|
import { TheoremError } from './error.js';
|
|
28
|
-
import {
|
|
28
|
+
import { PATTERN_COMPILER_VERSION, patternProblem, patternSources, } from './host-patterns.js';
|
|
29
29
|
const MAX_CHAR = 0xffff;
|
|
30
30
|
/**
|
|
31
31
|
* A bounded repeat longer than this is read as unbounded: the hold cannot
|
|
@@ -355,9 +355,6 @@ function slowPatternProblem(source, flags = '') {
|
|
|
355
355
|
* backreference to text that varies).
|
|
356
356
|
*/
|
|
357
357
|
function compilePatterns(patterns) {
|
|
358
|
-
if (patterns.length > MAX_PATTERNS) {
|
|
359
|
-
throw patternError(`${patterns.length} patterns; a detector takes at most ${MAX_PATTERNS}`); // labels-exempt: developer contract / internal diagnostic — not end-user or model copy (P2)
|
|
360
|
-
}
|
|
361
358
|
patterns.forEach((pattern, index) => {
|
|
362
359
|
const problem = patternProblem(`patterns[${index}]`, pattern);
|
|
363
360
|
if (problem !== undefined)
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
import { EGRESS_PATTERNS, notePattern, } from './egress-patterns.js';
|
|
21
21
|
import { IMAGE_PATTERNS, imageReadings, LINK_PATTERNS, linkReadings, } from './egress-urls.js';
|
|
22
22
|
import { decodeUrlRuns, INJECTION_BLOBS, TYPO_TARGETS, tryLeet, tryRot13, typoNormalize, } from './injection.js';
|
|
23
|
+
import { freshPattern } from './injection-patterns.js';
|
|
23
24
|
import { REVERSED_INJECTION_PATTERNS } from './injection-reversed.js';
|
|
24
25
|
import { isEmoji, normalizeCodePoint } from './normalize.js';
|
|
25
26
|
import { detectRule } from './rules.js';
|
|
@@ -471,7 +472,7 @@ function forwardPatterns(detectors, { given, allow, skipImages }) {
|
|
|
471
472
|
out.push({
|
|
472
473
|
...rule,
|
|
473
474
|
id,
|
|
474
|
-
regex:
|
|
475
|
+
regex: freshPattern(entry.pattern),
|
|
475
476
|
...patternReading(entry.kind, entry.pattern, urls),
|
|
476
477
|
});
|
|
477
478
|
});
|
|
@@ -487,7 +488,7 @@ function injectionPatterns() {
|
|
|
487
488
|
out.push({
|
|
488
489
|
...INJECTION_RULE,
|
|
489
490
|
id,
|
|
490
|
-
regex:
|
|
491
|
+
regex: freshPattern(pattern),
|
|
491
492
|
...(hit ? { hit } : {}),
|
|
492
493
|
});
|
|
493
494
|
});
|
|
@@ -649,6 +650,12 @@ function createScan(view, automaton, patterns) {
|
|
|
649
650
|
resume[p] = Math.max(from, at) + 1;
|
|
650
651
|
return { rule, severity, start: view.rawAt(at), detector };
|
|
651
652
|
}
|
|
653
|
+
let lowered = { text: '', lower: '' };
|
|
654
|
+
const lower = () => {
|
|
655
|
+
if (lowered.text !== view.text)
|
|
656
|
+
lowered = { text: view.text, lower: view.text.toLowerCase() };
|
|
657
|
+
return lowered.lower;
|
|
658
|
+
};
|
|
652
659
|
/** A regex pattern's hit up to `settledTo`. */
|
|
653
660
|
function matched(p, settledTo) {
|
|
654
661
|
if (!reached[p] && !recheck[p]) {
|
|
@@ -667,7 +674,7 @@ function createScan(view, automaton, patterns) {
|
|
|
667
674
|
return undefined;
|
|
668
675
|
}
|
|
669
676
|
const [blob] = match;
|
|
670
|
-
if (blob && (!hit || hit(blob, text, match.index))) {
|
|
677
|
+
if (blob && (!hit || hit(blob, text, match.index, lower))) {
|
|
671
678
|
// why: The scan reads on from the end of the match, so the next call finds the one after it.
|
|
672
679
|
resume[p] = regex.lastIndex;
|
|
673
680
|
recheck[p] = 1;
|
|
@@ -448,8 +448,10 @@ function inlineLeaks(text, openers, scope, meter) {
|
|
|
448
448
|
while (next < openers.length && openers[next].open < end) {
|
|
449
449
|
inside.push(openers[next++]);
|
|
450
450
|
}
|
|
451
|
-
if (inside.length > 0)
|
|
452
|
-
|
|
451
|
+
if (inside.length > 0) {
|
|
452
|
+
for (const span of paragraphLeaks(text, start, end, inside, scope, meter))
|
|
453
|
+
spans.push(span);
|
|
454
|
+
}
|
|
453
455
|
}
|
|
454
456
|
return spans;
|
|
455
457
|
}
|
|
@@ -16,7 +16,7 @@ declare function kindOfHttpStatus(status: number): ErrorKind;
|
|
|
16
16
|
declare function errorCopyText(copy: ErrorCopies, labels?: LabelOverrides): string;
|
|
17
17
|
/** Pass the profile's `labels`, or the profile's wording is skipped. */
|
|
18
18
|
declare function publicError(err: unknown, labels?: LabelOverrides): string;
|
|
19
|
-
/** Raw diagnostic for hosts, traces, and logs; never shown to end users. */
|
|
19
|
+
/** Raw diagnostic for hosts, traces, and logs; never shown to end users. Each cause that says something new follows on its own line. */
|
|
20
20
|
declare function describeError(err: unknown): string;
|
|
21
21
|
type ProducedError = TurnEventOf<'error'> & {
|
|
22
22
|
errorInternal: string;
|
|
@@ -61,8 +61,7 @@ function errorCopyText(copy, labels) {
|
|
|
61
61
|
function publicError(err, labels) {
|
|
62
62
|
return wording(errorKind(err), err instanceof TheoremError ? err.copy : undefined, labels);
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
function describeError(err) {
|
|
64
|
+
function messageOf(err) {
|
|
66
65
|
if (typeof err === 'string') {
|
|
67
66
|
return err;
|
|
68
67
|
}
|
|
@@ -71,6 +70,24 @@ function describeError(err) {
|
|
|
71
70
|
}
|
|
72
71
|
return String(err);
|
|
73
72
|
}
|
|
73
|
+
/** Raw diagnostic for hosts, traces, and logs; never shown to end users. Each cause that says something new follows on its own line. */
|
|
74
|
+
function describeError(err) {
|
|
75
|
+
const lines = [messageOf(err)];
|
|
76
|
+
const seen = new Set([err]);
|
|
77
|
+
let said = messageOf(err);
|
|
78
|
+
let cause = err instanceof Error ? err.cause : undefined;
|
|
79
|
+
while (cause !== undefined && cause !== null && !seen.has(cause)) {
|
|
80
|
+
seen.add(cause);
|
|
81
|
+
const message = messageOf(cause);
|
|
82
|
+
if (message !== said) {
|
|
83
|
+
const name = cause instanceof Error && cause.name !== 'Error' ? `${cause.name}: ` : '';
|
|
84
|
+
lines.push(`caused by: ${name}${message}`);
|
|
85
|
+
said = message;
|
|
86
|
+
}
|
|
87
|
+
cause = cause instanceof Error ? cause.cause : undefined;
|
|
88
|
+
}
|
|
89
|
+
return lines.join('\n');
|
|
90
|
+
}
|
|
74
91
|
/** No user wording yet: `withPublicLabels` adds it where the event reaches the host, the one place that knows the profile. */
|
|
75
92
|
function toErrorEvent(err) {
|
|
76
93
|
return {
|
|
@@ -59,9 +59,6 @@ interface HostMatcher {
|
|
|
59
59
|
}
|
|
60
60
|
/** Bumped whenever the compiled table's layout or meaning changes. */
|
|
61
61
|
declare const PATTERN_COMPILER_VERSION = 3;
|
|
62
|
-
/** The most patterns one detector takes, and the longest each may be once written as a regular expression. */
|
|
63
|
-
declare const MAX_PATTERNS = 64;
|
|
64
|
-
declare const MAX_PATTERN_LENGTH = 1024;
|
|
65
62
|
/** The patterns as a compiled table records them. */
|
|
66
63
|
declare function patternSources(patterns: readonly HostPattern[]): PatternSource[];
|
|
67
64
|
/** What is wrong with one pattern, or `undefined` when it runs. */
|
|
@@ -82,4 +79,4 @@ declare function listsPatterns(detect: unknown): boolean;
|
|
|
82
79
|
/** `patterns`, valid, ready to run. */
|
|
83
80
|
declare function matchersOf(patterns: readonly HostPattern[]): readonly HostMatcher[];
|
|
84
81
|
export type { AutomatonData, CompiledPatterns, HostMatcher, HostPattern, PatternSource };
|
|
85
|
-
export { listsPatterns,
|
|
82
|
+
export { listsPatterns, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
// `detectors.ts` can read a host's patterns without a cycle.
|
|
3
3
|
/** Bumped whenever the compiled table's layout or meaning changes. */
|
|
4
4
|
const PATTERN_COMPILER_VERSION = 3;
|
|
5
|
-
/** The most patterns one detector takes, and the longest each may be once written as a regular expression. */
|
|
6
|
-
const MAX_PATTERNS = 64;
|
|
7
|
-
const MAX_PATTERN_LENGTH = 1024;
|
|
8
5
|
const PATTERN_FLAGS = 'imsu';
|
|
9
6
|
/** A letter, digit, or underscore in any script: what a word may not touch on either side. */
|
|
10
7
|
const WORD_UNIT = '[\\p{L}\\p{N}_]';
|
|
@@ -79,9 +76,6 @@ function patternProblem(path, pattern) {
|
|
|
79
76
|
if (shape !== undefined)
|
|
80
77
|
return shape;
|
|
81
78
|
const { source, flags } = patternSource(pattern);
|
|
82
|
-
if (source.length > MAX_PATTERN_LENGTH) {
|
|
83
|
-
return `${path} is ${source.length} characters as a regular expression; the most is ${MAX_PATTERN_LENGTH}`;
|
|
84
|
-
}
|
|
85
79
|
let regex;
|
|
86
80
|
try {
|
|
87
81
|
// why: this only checks that the pattern parses and tests it on the empty text; a pattern that
|
|
@@ -134,9 +128,6 @@ function patternsProblem(path, patterns, compiled) {
|
|
|
134
128
|
function patternListProblem(path, patterns) {
|
|
135
129
|
if (!Array.isArray(patterns))
|
|
136
130
|
return `${path}.patterns must be a list`;
|
|
137
|
-
if (patterns.length > MAX_PATTERNS) {
|
|
138
|
-
return `${path}.patterns lists ${patterns.length} patterns; the most is ${MAX_PATTERNS}`;
|
|
139
|
-
}
|
|
140
131
|
const names = new Set();
|
|
141
132
|
for (const [index, pattern] of patterns.entries()) {
|
|
142
133
|
const at = `${path}.patterns[${index}]`;
|
|
@@ -170,4 +161,4 @@ function matchersOf(patterns) {
|
|
|
170
161
|
}
|
|
171
162
|
return matchers;
|
|
172
163
|
}
|
|
173
|
-
export { listsPatterns,
|
|
164
|
+
export { listsPatterns, matchersOf, PATTERN_COMPILER_VERSION, patternListProblem, patternProblem, patternSources, patternsProblem, };
|
|
@@ -17,4 +17,6 @@ declare const HEX_BLOB: RegExp;
|
|
|
17
17
|
declare const SPACED_LETTERS: RegExp;
|
|
18
18
|
/** Three+ alphabetic tokens joined by `|` (no shell spaces around pipes). */
|
|
19
19
|
declare const PIPE_SEPARATED: RegExp;
|
|
20
|
-
|
|
20
|
+
/** A pattern of its own for one scan to move `lastIndex` on, of the same class as `pattern`. */
|
|
21
|
+
declare function freshPattern(pattern: RegExp): RegExp;
|
|
22
|
+
export { BASE64_BLOB, freshPattern, HEX_BLOB, INJECTION_PATTERNS, overrideFrame, PIPE_SEPARATED, SPACED_LETTERS, };
|