htm 0.0.20 → 0.0.30
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -0
- data/Rakefile +104 -18
- data/db/migrate/00001_enable_extensions.rb +9 -5
- data/db/migrate/00002_create_robots.rb +18 -6
- data/db/migrate/00003_create_file_sources.rb +30 -17
- data/db/migrate/00004_create_nodes.rb +60 -48
- data/db/migrate/00005_create_tags.rb +24 -12
- data/db/migrate/00006_create_node_tags.rb +28 -13
- data/db/migrate/00007_create_robot_nodes.rb +40 -26
- data/db/schema.sql +17 -1
- data/db/seeds.rb +33 -33
- data/docs/database/naming-convention.md +244 -0
- data/docs/database_rake_tasks.md +31 -0
- data/docs/development/rake-tasks.md +80 -35
- data/docs/guides/mcp-server.md +70 -1
- data/examples/.envrc +6 -0
- data/examples/.gitignore +2 -0
- data/examples/00_create_examples_db.rb +94 -0
- data/examples/{basic_usage.rb → 01_basic_usage.rb} +12 -16
- data/examples/{custom_llm_configuration.rb → 03_custom_llm_configuration.rb} +13 -3
- data/examples/{file_loader_usage.rb → 04_file_loader_usage.rb} +11 -14
- data/examples/{timeframe_demo.rb → 05_timeframe_demo.rb} +10 -3
- data/examples/{example_app → 06_example_app}/app.rb +15 -15
- data/examples/{cli_app → 07_cli_app}/htm_cli.rb +15 -22
- data/examples/08_sinatra_app/Gemfile.lock +241 -0
- data/examples/{sinatra_app → 08_sinatra_app}/app.rb +19 -18
- data/examples/{mcp_client.rb → 09_mcp_client.rb} +5 -8
- data/examples/{telemetry → 10_telemetry}/SETUP_README.md +1 -1
- data/examples/{telemetry → 10_telemetry}/demo.rb +14 -10
- data/examples/11_robot_groups/README.md +335 -0
- data/examples/{robot_groups → 11_robot_groups/lib}/robot_worker.rb +17 -3
- data/examples/{robot_groups → 11_robot_groups}/multi_process.rb +9 -9
- data/examples/{robot_groups → 11_robot_groups}/same_process.rb +9 -12
- data/examples/{rails_app → 12_rails_app}/Gemfile +3 -0
- data/examples/{rails_app → 12_rails_app}/Gemfile.lock +87 -58
- data/examples/{rails_app → 12_rails_app}/app/controllers/dashboard_controller.rb +10 -6
- data/examples/{rails_app → 12_rails_app}/app/controllers/files_controller.rb +5 -5
- data/examples/{rails_app → 12_rails_app}/app/controllers/memories_controller.rb +11 -7
- data/examples/{rails_app → 12_rails_app}/app/controllers/robots_controller.rb +8 -8
- data/examples/12_rails_app/app/controllers/tags_controller.rb +36 -0
- data/examples/{rails_app → 12_rails_app}/app/views/dashboard/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/files/new.html.erb +5 -2
- data/examples/{rails_app → 12_rails_app}/app/views/memories/_memory_card.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/deleted.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/edit.html.erb +3 -3
- data/examples/{rails_app → 12_rails_app}/app/views/memories/show.html.erb +4 -4
- data/examples/{rails_app → 12_rails_app}/app/views/robots/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/robots/show.html.erb +4 -4
- data/examples/{rails_app → 12_rails_app}/app/views/search/index.html.erb +1 -1
- data/examples/{rails_app → 12_rails_app}/app/views/tags/index.html.erb +2 -2
- data/examples/{rails_app → 12_rails_app}/app/views/tags/show.html.erb +1 -1
- data/examples/12_rails_app/config/initializers/htm.rb +7 -0
- data/examples/12_rails_app/config/initializers/rack.rb +5 -0
- data/examples/README.md +230 -211
- data/examples/examples_helper.rb +138 -0
- data/lib/htm/config/builder.rb +167 -0
- data/lib/htm/config/database.rb +317 -0
- data/lib/htm/config/defaults.yml +37 -9
- data/lib/htm/config/section.rb +74 -0
- data/lib/htm/config/validator.rb +83 -0
- data/lib/htm/config.rb +64 -360
- data/lib/htm/database.rb +85 -127
- data/lib/htm/errors.rb +14 -0
- data/lib/htm/integrations/sinatra.rb +13 -44
- data/lib/htm/jobs/generate_embedding_job.rb +3 -4
- data/lib/htm/jobs/generate_propositions_job.rb +4 -5
- data/lib/htm/jobs/generate_tags_job.rb +16 -15
- data/lib/htm/loaders/defaults_loader.rb +23 -0
- data/lib/htm/loaders/markdown_loader.rb +17 -15
- data/lib/htm/loaders/xdg_config_loader.rb +9 -9
- data/lib/htm/long_term_memory/fulltext_search.rb +14 -14
- data/lib/htm/long_term_memory/hybrid_search.rb +396 -229
- data/lib/htm/long_term_memory/node_operations.rb +24 -23
- data/lib/htm/long_term_memory/relevance_scorer.rb +23 -20
- data/lib/htm/long_term_memory/robot_operations.rb +4 -4
- data/lib/htm/long_term_memory/tag_operations.rb +91 -77
- data/lib/htm/long_term_memory/vector_search.rb +4 -5
- data/lib/htm/long_term_memory.rb +13 -13
- data/lib/htm/mcp/cli.rb +115 -8
- data/lib/htm/mcp/resources.rb +4 -3
- data/lib/htm/mcp/server.rb +5 -4
- data/lib/htm/mcp/tools.rb +37 -28
- data/lib/htm/migration.rb +72 -0
- data/lib/htm/models/file_source.rb +52 -31
- data/lib/htm/models/node.rb +224 -108
- data/lib/htm/models/node_tag.rb +49 -28
- data/lib/htm/models/robot.rb +38 -27
- data/lib/htm/models/robot_node.rb +63 -35
- data/lib/htm/models/tag.rb +126 -123
- data/lib/htm/observability.rb +45 -41
- data/lib/htm/proposition_service.rb +76 -7
- data/lib/htm/railtie.rb +2 -2
- data/lib/htm/robot_group.rb +30 -18
- data/lib/htm/sequel_config.rb +215 -0
- data/lib/htm/sql_builder.rb +14 -16
- data/lib/htm/tag_service.rb +78 -0
- data/lib/htm/tasks.rb +3 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +6 -5
- data/lib/htm.rb +26 -22
- data/lib/tasks/db.rake +0 -2
- data/lib/tasks/doc.rake +2 -2
- data/lib/tasks/files.rake +11 -18
- data/lib/tasks/htm.rake +190 -62
- data/lib/tasks/jobs.rake +179 -54
- data/lib/tasks/tags.rake +8 -13
- data/scripts/backfill_parent_tags.rb +376 -0
- data/scripts/normalize_plural_tags.rb +335 -0
- metadata +109 -80
- data/examples/rails_app/app/controllers/tags_controller.rb +0 -30
- data/examples/sinatra_app/Gemfile.lock +0 -166
- data/lib/htm/active_record_config.rb +0 -104
- /data/examples/{config_file_example → 02_config_file_example}/README.md +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/config/htm.local.yml +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/custom_config.yml +0 -0
- /data/examples/{config_file_example → 02_config_file_example}/show_config.rb +0 -0
- /data/examples/{example_app → 06_example_app}/Rakefile +0 -0
- /data/examples/{cli_app → 07_cli_app}/README.md +0 -0
- /data/examples/{sinatra_app → 08_sinatra_app}/Gemfile +0 -0
- /data/examples/{telemetry → 10_telemetry}/README.md +0 -0
- /data/examples/{telemetry → 10_telemetry}/grafana/dashboards/htm-metrics.json +0 -0
- /data/examples/{rails_app → 12_rails_app}/.gitignore +0 -0
- /data/examples/{rails_app → 12_rails_app}/Procfile.dev +0 -0
- /data/examples/{rails_app → 12_rails_app}/README.md +0 -0
- /data/examples/{rails_app → 12_rails_app}/Rakefile +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/application.css +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/assets/stylesheets/inter-font.css +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/controllers/application_controller.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/controllers/search_controller.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/application.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/application.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/javascript/controllers/index.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/files/index.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/files/show.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/layouts/application.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/memories/index.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/memories/new.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/robots/new.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/shared/_navbar.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/app/views/shared/_stat_card.html.erb +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/dev +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/rails +0 -0
- /data/examples/{rails_app → 12_rails_app}/bin/rake +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/application.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/boot.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/database.yml +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/environment.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/importmap.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/routes.rb +0 -0
- /data/examples/{rails_app → 12_rails_app}/config/tailwind.config.js +0 -0
- /data/examples/{rails_app → 12_rails_app}/config.ru +0 -0
- /data/examples/{rails_app → 12_rails_app}/log/.keep +0 -0
- /data/examples/{rails_app → 12_rails_app}/tmp/local_secret.txt +0 -0
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: htm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.30
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -24,21 +24,21 @@ dependencies:
|
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 1.5.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name:
|
|
27
|
+
name: sequel
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '0'
|
|
32
|
+
version: '5.0'
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: '0'
|
|
39
|
+
version: '5.0'
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name:
|
|
41
|
+
name: sequel_pg
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
|
44
44
|
- - ">="
|
|
@@ -191,6 +191,20 @@ dependencies:
|
|
|
191
191
|
- - "~>"
|
|
192
192
|
- !ruby/object:Gem::Version
|
|
193
193
|
version: '2.0'
|
|
194
|
+
- !ruby/object:Gem::Dependency
|
|
195
|
+
name: activesupport
|
|
196
|
+
requirement: !ruby/object:Gem::Requirement
|
|
197
|
+
requirements:
|
|
198
|
+
- - ">="
|
|
199
|
+
- !ruby/object:Gem::Version
|
|
200
|
+
version: '0'
|
|
201
|
+
type: :runtime
|
|
202
|
+
prerelease: false
|
|
203
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
204
|
+
requirements:
|
|
205
|
+
- - ">="
|
|
206
|
+
- !ruby/object:Gem::Version
|
|
207
|
+
version: '0'
|
|
194
208
|
- !ruby/object:Gem::Dependency
|
|
195
209
|
name: rake
|
|
196
210
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -437,6 +451,7 @@ files:
|
|
|
437
451
|
- docs/assets/js/mathjax.js
|
|
438
452
|
- docs/assets/videos/htm_video.mp4
|
|
439
453
|
- docs/database/README.md
|
|
454
|
+
- docs/database/naming-convention.md
|
|
440
455
|
- docs/database/public.file_sources.md
|
|
441
456
|
- docs/database/public.file_sources.svg
|
|
442
457
|
- docs/database/public.node_stats.md
|
|
@@ -515,85 +530,95 @@ files:
|
|
|
515
530
|
- docs/robots/why-robots.md
|
|
516
531
|
- docs/setup_local_database.md
|
|
517
532
|
- docs/using_rake_tasks_in_your_app.md
|
|
533
|
+
- examples/.envrc
|
|
534
|
+
- examples/.gitignore
|
|
535
|
+
- examples/00_create_examples_db.rb
|
|
536
|
+
- examples/01_basic_usage.rb
|
|
537
|
+
- examples/02_config_file_example/README.md
|
|
538
|
+
- examples/02_config_file_example/config/htm.local.yml
|
|
539
|
+
- examples/02_config_file_example/custom_config.yml
|
|
540
|
+
- examples/02_config_file_example/show_config.rb
|
|
541
|
+
- examples/03_custom_llm_configuration.rb
|
|
542
|
+
- examples/04_file_loader_usage.rb
|
|
543
|
+
- examples/05_timeframe_demo.rb
|
|
544
|
+
- examples/06_example_app/Rakefile
|
|
545
|
+
- examples/06_example_app/app.rb
|
|
546
|
+
- examples/07_cli_app/README.md
|
|
547
|
+
- examples/07_cli_app/htm_cli.rb
|
|
548
|
+
- examples/08_sinatra_app/Gemfile
|
|
549
|
+
- examples/08_sinatra_app/Gemfile.lock
|
|
550
|
+
- examples/08_sinatra_app/app.rb
|
|
551
|
+
- examples/09_mcp_client.rb
|
|
552
|
+
- examples/10_telemetry/README.md
|
|
553
|
+
- examples/10_telemetry/SETUP_README.md
|
|
554
|
+
- examples/10_telemetry/demo.rb
|
|
555
|
+
- examples/10_telemetry/grafana/dashboards/htm-metrics.json
|
|
556
|
+
- examples/11_robot_groups/README.md
|
|
557
|
+
- examples/11_robot_groups/lib/robot_worker.rb
|
|
558
|
+
- examples/11_robot_groups/multi_process.rb
|
|
559
|
+
- examples/11_robot_groups/same_process.rb
|
|
560
|
+
- examples/12_rails_app/.gitignore
|
|
561
|
+
- examples/12_rails_app/Gemfile
|
|
562
|
+
- examples/12_rails_app/Gemfile.lock
|
|
563
|
+
- examples/12_rails_app/Procfile.dev
|
|
564
|
+
- examples/12_rails_app/README.md
|
|
565
|
+
- examples/12_rails_app/Rakefile
|
|
566
|
+
- examples/12_rails_app/app/assets/stylesheets/application.css
|
|
567
|
+
- examples/12_rails_app/app/assets/stylesheets/inter-font.css
|
|
568
|
+
- examples/12_rails_app/app/controllers/application_controller.rb
|
|
569
|
+
- examples/12_rails_app/app/controllers/dashboard_controller.rb
|
|
570
|
+
- examples/12_rails_app/app/controllers/files_controller.rb
|
|
571
|
+
- examples/12_rails_app/app/controllers/memories_controller.rb
|
|
572
|
+
- examples/12_rails_app/app/controllers/robots_controller.rb
|
|
573
|
+
- examples/12_rails_app/app/controllers/search_controller.rb
|
|
574
|
+
- examples/12_rails_app/app/controllers/tags_controller.rb
|
|
575
|
+
- examples/12_rails_app/app/javascript/application.js
|
|
576
|
+
- examples/12_rails_app/app/javascript/controllers/application.js
|
|
577
|
+
- examples/12_rails_app/app/javascript/controllers/index.js
|
|
578
|
+
- examples/12_rails_app/app/views/dashboard/index.html.erb
|
|
579
|
+
- examples/12_rails_app/app/views/files/index.html.erb
|
|
580
|
+
- examples/12_rails_app/app/views/files/new.html.erb
|
|
581
|
+
- examples/12_rails_app/app/views/files/show.html.erb
|
|
582
|
+
- examples/12_rails_app/app/views/layouts/application.html.erb
|
|
583
|
+
- examples/12_rails_app/app/views/memories/_memory_card.html.erb
|
|
584
|
+
- examples/12_rails_app/app/views/memories/deleted.html.erb
|
|
585
|
+
- examples/12_rails_app/app/views/memories/edit.html.erb
|
|
586
|
+
- examples/12_rails_app/app/views/memories/index.html.erb
|
|
587
|
+
- examples/12_rails_app/app/views/memories/new.html.erb
|
|
588
|
+
- examples/12_rails_app/app/views/memories/show.html.erb
|
|
589
|
+
- examples/12_rails_app/app/views/robots/index.html.erb
|
|
590
|
+
- examples/12_rails_app/app/views/robots/new.html.erb
|
|
591
|
+
- examples/12_rails_app/app/views/robots/show.html.erb
|
|
592
|
+
- examples/12_rails_app/app/views/search/index.html.erb
|
|
593
|
+
- examples/12_rails_app/app/views/shared/_navbar.html.erb
|
|
594
|
+
- examples/12_rails_app/app/views/shared/_stat_card.html.erb
|
|
595
|
+
- examples/12_rails_app/app/views/tags/index.html.erb
|
|
596
|
+
- examples/12_rails_app/app/views/tags/show.html.erb
|
|
597
|
+
- examples/12_rails_app/bin/dev
|
|
598
|
+
- examples/12_rails_app/bin/rails
|
|
599
|
+
- examples/12_rails_app/bin/rake
|
|
600
|
+
- examples/12_rails_app/config.ru
|
|
601
|
+
- examples/12_rails_app/config/application.rb
|
|
602
|
+
- examples/12_rails_app/config/boot.rb
|
|
603
|
+
- examples/12_rails_app/config/database.yml
|
|
604
|
+
- examples/12_rails_app/config/environment.rb
|
|
605
|
+
- examples/12_rails_app/config/importmap.rb
|
|
606
|
+
- examples/12_rails_app/config/initializers/htm.rb
|
|
607
|
+
- examples/12_rails_app/config/initializers/rack.rb
|
|
608
|
+
- examples/12_rails_app/config/routes.rb
|
|
609
|
+
- examples/12_rails_app/config/tailwind.config.js
|
|
610
|
+
- examples/12_rails_app/log/.keep
|
|
611
|
+
- examples/12_rails_app/tmp/local_secret.txt
|
|
518
612
|
- examples/README.md
|
|
519
|
-
- examples/
|
|
520
|
-
- examples/cli_app/README.md
|
|
521
|
-
- examples/cli_app/htm_cli.rb
|
|
522
|
-
- examples/config_file_example/README.md
|
|
523
|
-
- examples/config_file_example/config/htm.local.yml
|
|
524
|
-
- examples/config_file_example/custom_config.yml
|
|
525
|
-
- examples/config_file_example/show_config.rb
|
|
526
|
-
- examples/custom_llm_configuration.rb
|
|
527
|
-
- examples/example_app/Rakefile
|
|
528
|
-
- examples/example_app/app.rb
|
|
529
|
-
- examples/file_loader_usage.rb
|
|
530
|
-
- examples/mcp_client.rb
|
|
531
|
-
- examples/rails_app/.gitignore
|
|
532
|
-
- examples/rails_app/Gemfile
|
|
533
|
-
- examples/rails_app/Gemfile.lock
|
|
534
|
-
- examples/rails_app/Procfile.dev
|
|
535
|
-
- examples/rails_app/README.md
|
|
536
|
-
- examples/rails_app/Rakefile
|
|
537
|
-
- examples/rails_app/app/assets/stylesheets/application.css
|
|
538
|
-
- examples/rails_app/app/assets/stylesheets/inter-font.css
|
|
539
|
-
- examples/rails_app/app/controllers/application_controller.rb
|
|
540
|
-
- examples/rails_app/app/controllers/dashboard_controller.rb
|
|
541
|
-
- examples/rails_app/app/controllers/files_controller.rb
|
|
542
|
-
- examples/rails_app/app/controllers/memories_controller.rb
|
|
543
|
-
- examples/rails_app/app/controllers/robots_controller.rb
|
|
544
|
-
- examples/rails_app/app/controllers/search_controller.rb
|
|
545
|
-
- examples/rails_app/app/controllers/tags_controller.rb
|
|
546
|
-
- examples/rails_app/app/javascript/application.js
|
|
547
|
-
- examples/rails_app/app/javascript/controllers/application.js
|
|
548
|
-
- examples/rails_app/app/javascript/controllers/index.js
|
|
549
|
-
- examples/rails_app/app/views/dashboard/index.html.erb
|
|
550
|
-
- examples/rails_app/app/views/files/index.html.erb
|
|
551
|
-
- examples/rails_app/app/views/files/new.html.erb
|
|
552
|
-
- examples/rails_app/app/views/files/show.html.erb
|
|
553
|
-
- examples/rails_app/app/views/layouts/application.html.erb
|
|
554
|
-
- examples/rails_app/app/views/memories/_memory_card.html.erb
|
|
555
|
-
- examples/rails_app/app/views/memories/deleted.html.erb
|
|
556
|
-
- examples/rails_app/app/views/memories/edit.html.erb
|
|
557
|
-
- examples/rails_app/app/views/memories/index.html.erb
|
|
558
|
-
- examples/rails_app/app/views/memories/new.html.erb
|
|
559
|
-
- examples/rails_app/app/views/memories/show.html.erb
|
|
560
|
-
- examples/rails_app/app/views/robots/index.html.erb
|
|
561
|
-
- examples/rails_app/app/views/robots/new.html.erb
|
|
562
|
-
- examples/rails_app/app/views/robots/show.html.erb
|
|
563
|
-
- examples/rails_app/app/views/search/index.html.erb
|
|
564
|
-
- examples/rails_app/app/views/shared/_navbar.html.erb
|
|
565
|
-
- examples/rails_app/app/views/shared/_stat_card.html.erb
|
|
566
|
-
- examples/rails_app/app/views/tags/index.html.erb
|
|
567
|
-
- examples/rails_app/app/views/tags/show.html.erb
|
|
568
|
-
- examples/rails_app/bin/dev
|
|
569
|
-
- examples/rails_app/bin/rails
|
|
570
|
-
- examples/rails_app/bin/rake
|
|
571
|
-
- examples/rails_app/config.ru
|
|
572
|
-
- examples/rails_app/config/application.rb
|
|
573
|
-
- examples/rails_app/config/boot.rb
|
|
574
|
-
- examples/rails_app/config/database.yml
|
|
575
|
-
- examples/rails_app/config/environment.rb
|
|
576
|
-
- examples/rails_app/config/importmap.rb
|
|
577
|
-
- examples/rails_app/config/routes.rb
|
|
578
|
-
- examples/rails_app/config/tailwind.config.js
|
|
579
|
-
- examples/rails_app/log/.keep
|
|
580
|
-
- examples/rails_app/tmp/local_secret.txt
|
|
581
|
-
- examples/robot_groups/multi_process.rb
|
|
582
|
-
- examples/robot_groups/robot_worker.rb
|
|
583
|
-
- examples/robot_groups/same_process.rb
|
|
584
|
-
- examples/sinatra_app/Gemfile
|
|
585
|
-
- examples/sinatra_app/Gemfile.lock
|
|
586
|
-
- examples/sinatra_app/app.rb
|
|
587
|
-
- examples/telemetry/README.md
|
|
588
|
-
- examples/telemetry/SETUP_README.md
|
|
589
|
-
- examples/telemetry/demo.rb
|
|
590
|
-
- examples/telemetry/grafana/dashboards/htm-metrics.json
|
|
591
|
-
- examples/timeframe_demo.rb
|
|
613
|
+
- examples/examples_helper.rb
|
|
592
614
|
- lib/htm.rb
|
|
593
|
-
- lib/htm/active_record_config.rb
|
|
594
615
|
- lib/htm/circuit_breaker.rb
|
|
595
616
|
- lib/htm/config.rb
|
|
617
|
+
- lib/htm/config/builder.rb
|
|
618
|
+
- lib/htm/config/database.rb
|
|
596
619
|
- lib/htm/config/defaults.yml
|
|
620
|
+
- lib/htm/config/section.rb
|
|
621
|
+
- lib/htm/config/validator.rb
|
|
597
622
|
- lib/htm/database.rb
|
|
598
623
|
- lib/htm/embedding_service.rb
|
|
599
624
|
- lib/htm/errors.rb
|
|
@@ -619,6 +644,7 @@ files:
|
|
|
619
644
|
- lib/htm/mcp/resources.rb
|
|
620
645
|
- lib/htm/mcp/server.rb
|
|
621
646
|
- lib/htm/mcp/tools.rb
|
|
647
|
+
- lib/htm/migration.rb
|
|
622
648
|
- lib/htm/models/file_source.rb
|
|
623
649
|
- lib/htm/models/node.rb
|
|
624
650
|
- lib/htm/models/node_tag.rb
|
|
@@ -630,6 +656,7 @@ files:
|
|
|
630
656
|
- lib/htm/query_cache.rb
|
|
631
657
|
- lib/htm/railtie.rb
|
|
632
658
|
- lib/htm/robot_group.rb
|
|
659
|
+
- lib/htm/sequel_config.rb
|
|
633
660
|
- lib/htm/sql_builder.rb
|
|
634
661
|
- lib/htm/tag_service.rb
|
|
635
662
|
- lib/htm/tasks.rb
|
|
@@ -647,7 +674,9 @@ files:
|
|
|
647
674
|
- lib/tasks/jobs.rake
|
|
648
675
|
- lib/tasks/tags.rake
|
|
649
676
|
- mkdocs.yml
|
|
677
|
+
- scripts/backfill_parent_tags.rb
|
|
650
678
|
- scripts/install_local_database.sh
|
|
679
|
+
- scripts/normalize_plural_tags.rb
|
|
651
680
|
homepage: https://github.com/madbomber/htm
|
|
652
681
|
licenses:
|
|
653
682
|
- MIT
|
|
@@ -669,7 +698,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
669
698
|
- !ruby/object:Gem::Version
|
|
670
699
|
version: '0'
|
|
671
700
|
requirements: []
|
|
672
|
-
rubygems_version: 4.0.
|
|
701
|
+
rubygems_version: 4.0.4
|
|
673
702
|
specification_version: 4
|
|
674
703
|
summary: Hierarchical Temporal Memory for LLM robots
|
|
675
704
|
test_files: []
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class TagsController < ApplicationController
|
|
4
|
-
def index
|
|
5
|
-
@view_type = params[:view] || 'list'
|
|
6
|
-
|
|
7
|
-
case @view_type
|
|
8
|
-
when 'tree'
|
|
9
|
-
@tree_string = HTM::Models::Tag.all.tree_string
|
|
10
|
-
@tree_svg = HTM::Models::Tag.all.tree_svg(title: 'HTM Tag Hierarchy')
|
|
11
|
-
when 'mermaid'
|
|
12
|
-
@tree_mermaid = HTM::Models::Tag.all.tree_mermaid
|
|
13
|
-
else
|
|
14
|
-
@tags = HTM::Models::Tag
|
|
15
|
-
.left_joins(:nodes)
|
|
16
|
-
.group('tags.id')
|
|
17
|
-
.select('tags.*, COUNT(nodes.id) as node_count')
|
|
18
|
-
.order(:name)
|
|
19
|
-
|
|
20
|
-
if params[:prefix].present?
|
|
21
|
-
@tags = @tags.where('tags.name LIKE ?', "#{params[:prefix]}%")
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def show
|
|
27
|
-
@tag = HTM::Models::Tag.find(params[:id])
|
|
28
|
-
@memories = @tag.nodes.active.includes(:tags).order(created_at: :desc)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ../..
|
|
3
|
-
specs:
|
|
4
|
-
htm (0.0.2)
|
|
5
|
-
activerecord
|
|
6
|
-
lru_redux
|
|
7
|
-
neighbor
|
|
8
|
-
pg (>= 1.5.0)
|
|
9
|
-
ruby_llm
|
|
10
|
-
tiktoken_ruby
|
|
11
|
-
|
|
12
|
-
GEM
|
|
13
|
-
remote: https://rubygems.org/
|
|
14
|
-
specs:
|
|
15
|
-
activemodel (8.1.1)
|
|
16
|
-
activesupport (= 8.1.1)
|
|
17
|
-
activerecord (8.1.1)
|
|
18
|
-
activemodel (= 8.1.1)
|
|
19
|
-
activesupport (= 8.1.1)
|
|
20
|
-
timeout (>= 0.4.0)
|
|
21
|
-
activesupport (8.1.1)
|
|
22
|
-
base64
|
|
23
|
-
bigdecimal
|
|
24
|
-
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
25
|
-
connection_pool (>= 2.2.5)
|
|
26
|
-
drb
|
|
27
|
-
i18n (>= 1.6, < 2)
|
|
28
|
-
json
|
|
29
|
-
logger (>= 1.4.2)
|
|
30
|
-
minitest (>= 5.1)
|
|
31
|
-
securerandom (>= 0.3)
|
|
32
|
-
tzinfo (~> 2.0, >= 2.0.5)
|
|
33
|
-
uri (>= 0.13.1)
|
|
34
|
-
base64 (0.3.0)
|
|
35
|
-
bigdecimal (3.3.1)
|
|
36
|
-
concurrent-ruby (1.3.5)
|
|
37
|
-
connection_pool (2.5.5)
|
|
38
|
-
drb (2.2.3)
|
|
39
|
-
event_stream_parser (1.0.0)
|
|
40
|
-
faraday (2.14.0)
|
|
41
|
-
faraday-net_http (>= 2.0, < 3.5)
|
|
42
|
-
json
|
|
43
|
-
logger
|
|
44
|
-
faraday-multipart (1.1.1)
|
|
45
|
-
multipart-post (~> 2.0)
|
|
46
|
-
faraday-net_http (3.4.2)
|
|
47
|
-
net-http (~> 0.5)
|
|
48
|
-
faraday-retry (2.3.2)
|
|
49
|
-
faraday (~> 2.0)
|
|
50
|
-
ffi (1.17.2-aarch64-linux-gnu)
|
|
51
|
-
ffi (1.17.2-aarch64-linux-musl)
|
|
52
|
-
ffi (1.17.2-arm-linux-gnu)
|
|
53
|
-
ffi (1.17.2-arm-linux-musl)
|
|
54
|
-
ffi (1.17.2-arm64-darwin)
|
|
55
|
-
ffi (1.17.2-x86_64-darwin)
|
|
56
|
-
ffi (1.17.2-x86_64-linux-gnu)
|
|
57
|
-
ffi (1.17.2-x86_64-linux-musl)
|
|
58
|
-
i18n (1.14.7)
|
|
59
|
-
concurrent-ruby (~> 1.0)
|
|
60
|
-
json (2.16.0)
|
|
61
|
-
listen (3.9.0)
|
|
62
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
63
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
|
64
|
-
logger (1.7.0)
|
|
65
|
-
lru_redux (1.1.0)
|
|
66
|
-
marcel (1.1.0)
|
|
67
|
-
minitest (5.26.2)
|
|
68
|
-
multi_json (1.17.0)
|
|
69
|
-
multipart-post (2.4.1)
|
|
70
|
-
mustermann (3.0.4)
|
|
71
|
-
ruby2_keywords (~> 0.0.1)
|
|
72
|
-
neighbor (0.6.0)
|
|
73
|
-
activerecord (>= 7.1)
|
|
74
|
-
net-http (0.8.0)
|
|
75
|
-
uri (>= 0.11.1)
|
|
76
|
-
nio4r (2.7.5)
|
|
77
|
-
pg (1.6.2)
|
|
78
|
-
pg (1.6.2-aarch64-linux)
|
|
79
|
-
pg (1.6.2-aarch64-linux-musl)
|
|
80
|
-
pg (1.6.2-arm64-darwin)
|
|
81
|
-
pg (1.6.2-x86_64-darwin)
|
|
82
|
-
pg (1.6.2-x86_64-linux)
|
|
83
|
-
pg (1.6.2-x86_64-linux-musl)
|
|
84
|
-
puma (6.6.1)
|
|
85
|
-
nio4r (~> 2.0)
|
|
86
|
-
rack (2.2.21)
|
|
87
|
-
rack-protection (3.2.0)
|
|
88
|
-
base64 (>= 0.1.0)
|
|
89
|
-
rack (~> 2.2, >= 2.2.4)
|
|
90
|
-
rb-fsevent (0.11.2)
|
|
91
|
-
rb-inotify (0.11.1)
|
|
92
|
-
ffi (~> 1.0)
|
|
93
|
-
redis (5.4.1)
|
|
94
|
-
redis-client (>= 0.22.0)
|
|
95
|
-
redis-client (0.26.1)
|
|
96
|
-
connection_pool
|
|
97
|
-
rerun (0.14.0)
|
|
98
|
-
listen (~> 3.0)
|
|
99
|
-
ruby2_keywords (0.0.5)
|
|
100
|
-
ruby_llm (1.9.1)
|
|
101
|
-
base64
|
|
102
|
-
event_stream_parser (~> 1)
|
|
103
|
-
faraday (>= 1.10.0)
|
|
104
|
-
faraday-multipart (>= 1)
|
|
105
|
-
faraday-net_http (>= 1)
|
|
106
|
-
faraday-retry (>= 1)
|
|
107
|
-
marcel (~> 1.0)
|
|
108
|
-
ruby_llm-schema (~> 0.2.1)
|
|
109
|
-
zeitwerk (~> 2)
|
|
110
|
-
ruby_llm-schema (0.2.5)
|
|
111
|
-
securerandom (0.4.1)
|
|
112
|
-
sidekiq (7.3.9)
|
|
113
|
-
base64
|
|
114
|
-
connection_pool (>= 2.3.0)
|
|
115
|
-
logger
|
|
116
|
-
rack (>= 2.2.4)
|
|
117
|
-
redis-client (>= 0.22.2)
|
|
118
|
-
sinatra (3.2.0)
|
|
119
|
-
mustermann (~> 3.0)
|
|
120
|
-
rack (~> 2.2, >= 2.2.4)
|
|
121
|
-
rack-protection (= 3.2.0)
|
|
122
|
-
tilt (~> 2.0)
|
|
123
|
-
sinatra-contrib (3.2.0)
|
|
124
|
-
multi_json (>= 0.0.2)
|
|
125
|
-
mustermann (~> 3.0)
|
|
126
|
-
rack-protection (= 3.2.0)
|
|
127
|
-
sinatra (= 3.2.0)
|
|
128
|
-
tilt (~> 2.0)
|
|
129
|
-
tiktoken_ruby (0.0.13-aarch64-linux)
|
|
130
|
-
tiktoken_ruby (0.0.13-arm-linux)
|
|
131
|
-
tiktoken_ruby (0.0.13-arm64-darwin)
|
|
132
|
-
tiktoken_ruby (0.0.13-x86_64-darwin)
|
|
133
|
-
tiktoken_ruby (0.0.13-x86_64-linux)
|
|
134
|
-
tiktoken_ruby (0.0.13-x86_64-linux-musl)
|
|
135
|
-
tilt (2.6.1)
|
|
136
|
-
timeout (0.4.4)
|
|
137
|
-
tzinfo (2.0.6)
|
|
138
|
-
concurrent-ruby (~> 1.0)
|
|
139
|
-
uri (1.1.1)
|
|
140
|
-
zeitwerk (2.7.3)
|
|
141
|
-
|
|
142
|
-
PLATFORMS
|
|
143
|
-
aarch64-linux
|
|
144
|
-
aarch64-linux-gnu
|
|
145
|
-
aarch64-linux-musl
|
|
146
|
-
arm-linux
|
|
147
|
-
arm-linux-gnu
|
|
148
|
-
arm-linux-musl
|
|
149
|
-
arm64-darwin
|
|
150
|
-
x86_64-darwin
|
|
151
|
-
x86_64-linux
|
|
152
|
-
x86_64-linux-gnu
|
|
153
|
-
x86_64-linux-musl
|
|
154
|
-
|
|
155
|
-
DEPENDENCIES
|
|
156
|
-
htm!
|
|
157
|
-
multi_json
|
|
158
|
-
puma (~> 6.0)
|
|
159
|
-
redis (~> 5.0)
|
|
160
|
-
rerun
|
|
161
|
-
sidekiq (~> 7.0)
|
|
162
|
-
sinatra (~> 3.0)
|
|
163
|
-
sinatra-contrib (~> 3.0)
|
|
164
|
-
|
|
165
|
-
BUNDLED WITH
|
|
166
|
-
2.7.2
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'active_record'
|
|
4
|
-
require 'pg'
|
|
5
|
-
require 'neighbor'
|
|
6
|
-
|
|
7
|
-
class HTM
|
|
8
|
-
# ActiveRecord database configuration and model loading
|
|
9
|
-
#
|
|
10
|
-
# Uses HTM::Config for database settings. Configuration can come from:
|
|
11
|
-
# - Environment variables (HTM_DATABASE__URL, HTM_DATABASE__HOST, etc.)
|
|
12
|
-
# - Programmatic configuration via HTM.configure
|
|
13
|
-
#
|
|
14
|
-
class ActiveRecordConfig
|
|
15
|
-
class << self
|
|
16
|
-
# Establish database connection from HTM::Config
|
|
17
|
-
def establish_connection!
|
|
18
|
-
config = load_database_config
|
|
19
|
-
|
|
20
|
-
ActiveRecord::Base.establish_connection(config)
|
|
21
|
-
|
|
22
|
-
# Set search path
|
|
23
|
-
ActiveRecord::Base.connection.execute("SET search_path TO public")
|
|
24
|
-
|
|
25
|
-
# Load models after connection is established
|
|
26
|
-
require_models
|
|
27
|
-
|
|
28
|
-
true
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
# Load database configuration from HTM::Config
|
|
32
|
-
#
|
|
33
|
-
# @return [Hash] ActiveRecord-compatible configuration hash
|
|
34
|
-
#
|
|
35
|
-
def load_database_config
|
|
36
|
-
HTM.config.database_config
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
# Check if connection is established and active
|
|
40
|
-
def connected?
|
|
41
|
-
return false unless defined?(ActiveRecord::Base)
|
|
42
|
-
return false unless ActiveRecord::Base.connection_handler.connection_pool_list.any?
|
|
43
|
-
|
|
44
|
-
ActiveRecord::Base.connected? && ActiveRecord::Base.connection.active?
|
|
45
|
-
rescue ActiveRecord::ConnectionNotDefined, ActiveRecord::ConnectionNotEstablished
|
|
46
|
-
false
|
|
47
|
-
rescue StandardError
|
|
48
|
-
false
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# Close all database connections
|
|
52
|
-
def disconnect!
|
|
53
|
-
ActiveRecord::Base.connection_pool.disconnect!
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Verify required extensions are available
|
|
57
|
-
def verify_extensions!
|
|
58
|
-
conn = ActiveRecord::Base.connection
|
|
59
|
-
|
|
60
|
-
required_extensions = {
|
|
61
|
-
'vector' => 'pgvector extension',
|
|
62
|
-
'pg_trgm' => 'PostgreSQL trigram extension'
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
missing = []
|
|
66
|
-
required_extensions.each do |ext, name|
|
|
67
|
-
result = conn.select_value(
|
|
68
|
-
"SELECT COUNT(*) FROM pg_extension WHERE extname = '#{ext}'"
|
|
69
|
-
)
|
|
70
|
-
missing << name if result.to_i.zero?
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
if missing.any?
|
|
74
|
-
raise "Missing required PostgreSQL extensions: #{missing.join(', ')}"
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
true
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Get connection pool statistics
|
|
81
|
-
def connection_stats
|
|
82
|
-
pool = ActiveRecord::Base.connection_pool
|
|
83
|
-
{
|
|
84
|
-
size: pool.size,
|
|
85
|
-
connections: pool.connections.size,
|
|
86
|
-
in_use: pool.connections.count(&:in_use?),
|
|
87
|
-
available: pool.connections.count { |c| !c.in_use? }
|
|
88
|
-
}
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
private
|
|
92
|
-
|
|
93
|
-
# Require all model files
|
|
94
|
-
def require_models
|
|
95
|
-
require_relative 'models/robot'
|
|
96
|
-
require_relative 'models/node'
|
|
97
|
-
require_relative 'models/robot_node'
|
|
98
|
-
require_relative 'models/tag'
|
|
99
|
-
require_relative 'models/node_tag'
|
|
100
|
-
require_relative 'models/file_source'
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
end
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|