htm 0.0.32 → 0.1.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.
- checksums.yaml +4 -4
- data/.architecture/decisions/adrs/005-rag-based-retrieval-with-hybrid-search.md +4 -0
- data/.architecture/decisions/adrs/017-bitemporal-event-time.md +78 -0
- data/.architecture/decisions/adrs/018-memory-timelines-and-node-links.md +64 -0
- data/.architecture/decisions/adrs/019-epistemic-status.md +66 -0
- data/.claude.json +11 -0
- data/.envrc +9 -7
- data/.irbrc +14 -14
- data/.reek.yml +104 -0
- data/.rubocop.yml +0 -11
- data/.ruby-version +1 -0
- data/CHANGELOG.md +160 -98
- data/README.md +22 -17
- data/SETUP.md +49 -46
- data/_typos.toml +17 -0
- data/bin/htm +18 -0
- data/db/migrate/00010_convert_embedding_to_sparsevec.rb +47 -0
- data/db/migrate/00011_strip_frontmatter_from_chunks.rb +66 -0
- data/db/migrate/00012_add_event_time_to_nodes.rb +110 -0
- data/db/migrate/00013_create_node_links.rb +158 -0
- data/db/migrate/00014_add_epistemic_status.rb +110 -0
- data/db/schema.sql +238 -7
- data/db/seed_data/README.md +11 -11
- data/db/seeds.rb +11 -11
- data/docs/api/database.md +8 -8
- data/docs/api/embedding-service.md +138 -262
- data/docs/api/htm.md +128 -12
- data/docs/api/index.md +8 -8
- data/docs/api/long-term-memory.md +8 -19
- data/docs/api/working-memory.md +34 -46
- data/docs/api/yard/HTM/Admin/Console.md +53 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands/Console.md +38 -0
- data/docs/api/yard/HTM/Admin/DatabaseCommands.md +127 -0
- data/docs/api/yard/HTM/Admin/EnrichCommands.md +85 -0
- data/docs/api/yard/HTM/Admin/Error.md +9 -0
- data/docs/api/yard/HTM/Admin/FileCommands/Console.md +50 -0
- data/docs/api/yard/HTM/Admin/FileCommands.md +83 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Base.md +17 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Edit.md +74 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/Search.md +77 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/TagSearch.md +46 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands/WorkingMemory.md +36 -0
- data/docs/api/yard/HTM/Admin/MemoryCommands.md +67 -0
- data/docs/api/yard/HTM/Admin/TagCommands/Console.md +48 -0
- data/docs/api/yard/HTM/Admin/TagCommands.md +105 -0
- data/docs/api/yard/HTM/Admin/TagGraph.md +149 -0
- data/docs/api/yard/HTM/Admin/YardDocs.md +60 -0
- data/docs/api/yard/HTM/Admin.md +102 -0
- data/docs/api/yard/HTM/AuthorizationError.md +6 -6
- data/docs/api/yard/HTM/CLI/ConfigFile.md +40 -0
- data/docs/api/yard/HTM/CLI/Db.md +63 -0
- data/docs/api/yard/HTM/CLI/Enrich.md +39 -0
- data/docs/api/yard/HTM/CLI/ErrorSuggestion.md +56 -0
- data/docs/api/yard/HTM/CLI/Files.md +36 -0
- data/docs/api/yard/HTM/CLI/Group/ClassMethods.md +11 -0
- data/docs/api/yard/HTM/CLI/Group.md +13 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand/ClassMethods.md +20 -0
- data/docs/api/yard/HTM/CLI/MemoryCommand.md +9 -0
- data/docs/api/yard/HTM/CLI/Robots.md +31 -0
- data/docs/api/yard/HTM/CLI/Support.md +9 -0
- data/docs/api/yard/HTM/CLI/Tags.md +57 -0
- data/docs/api/yard/HTM/CLI/WorkingMemory.md +24 -0
- data/docs/api/yard/HTM/CLI.md +84 -0
- data/docs/api/yard/HTM/CircuitBreaker/Guarded.md +29 -0
- data/docs/api/yard/HTM/CircuitBreaker/Settings.md +21 -0
- data/docs/api/yard/HTM/CircuitBreaker/Status.md +42 -0
- data/docs/api/yard/HTM/CircuitBreaker.md +54 -49
- data/docs/api/yard/HTM/CircuitBreakerOpenError.md +9 -9
- data/docs/api/yard/HTM/Config/Builder.md +87 -0
- data/docs/api/yard/HTM/Config/Coercion.md +59 -0
- data/docs/api/yard/HTM/Config/Database.md +102 -0
- data/docs/api/yard/HTM/Config/Readers.md +30 -0
- data/docs/api/yard/HTM/Config/RubyLlmSettings.md +32 -0
- data/docs/api/yard/HTM/Config/Validator.md +59 -0
- data/docs/api/yard/HTM/Config.md +224 -105
- data/docs/api/yard/HTM/ConfigurationError.md +20 -0
- data/docs/api/yard/HTM/Confirmation.md +22 -0
- data/docs/api/yard/HTM/Database/Connection.md +26 -0
- data/docs/api/yard/HTM/Database/Migrations.md +32 -0
- data/docs/api/yard/HTM/Database/Report.md +26 -0
- data/docs/api/yard/HTM/Database/SchemaFile.md +52 -0
- data/docs/api/yard/HTM/Database/Teardown.md +15 -0
- data/docs/api/yard/HTM/Database.md +58 -70
- data/docs/api/yard/HTM/DatabaseDocs.md +67 -0
- data/docs/api/yard/HTM/DatabaseError.md +6 -6
- data/docs/api/yard/HTM/Deletion.md +32 -0
- data/docs/api/yard/HTM/EmbeddingError.md +6 -6
- data/docs/api/yard/HTM/EmbeddingService.md +37 -38
- data/docs/api/yard/HTM/Epistemics.md +135 -0
- data/docs/api/yard/HTM/Error.md +6 -6
- data/docs/api/yard/HTM/EventTime.md +110 -0
- data/docs/api/yard/HTM/FileMemory.md +76 -0
- data/docs/api/yard/HTM/InputValidator.md +82 -0
- data/docs/api/yard/HTM/JobAdapter/Job.md +26 -0
- data/docs/api/yard/HTM/JobAdapter.md +35 -16
- data/docs/api/yard/HTM/Jobs/FailureLogging.md +14 -0
- data/docs/api/yard/HTM/Jobs/GenerateEmbeddingJob.md +16 -0
- data/docs/api/yard/HTM/Jobs/GeneratePropositionsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/GenerateRelationshipsJob.md +26 -0
- data/docs/api/yard/HTM/Jobs/GenerateTagsJob.md +17 -0
- data/docs/api/yard/HTM/Jobs/LlmCallTimer.md +58 -0
- data/docs/api/yard/HTM/Jobs/NodeLookup.md +14 -0
- data/docs/api/yard/HTM/Jobs.md +13 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync/Chunk.md +22 -0
- data/docs/api/yard/HTM/Loaders/ChunkSync.md +50 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Coalescer.md +24 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Packer.md +20 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker/Splitter.md +18 -0
- data/docs/api/yard/HTM/Loaders/MarkdownChunker.md +83 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader/Document.md +43 -0
- data/docs/api/yard/HTM/Loaders/MarkdownLoader.md +62 -0
- data/docs/api/yard/HTM/Loaders.md +5 -0
- data/docs/api/yard/HTM/LongTermMemory/FulltextSearch.md +36 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfMerger.md +25 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfRows.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Query.md +79 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql/Source.md +45 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/RrfSql.md +11 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch/TagDepth.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/HybridSearch.md +52 -0
- data/docs/api/yard/HTM/LongTermMemory/NodeOperations.md +95 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/HierarchicalJaccard.md +58 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer/TagSearch.md +27 -0
- data/docs/api/yard/HTM/LongTermMemory/RelevanceScorer.md +81 -0
- data/docs/api/yard/HTM/LongTermMemory/RobotOperations.md +22 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/ExpiringValue.md +24 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations/TagMatchSql.md +40 -0
- data/docs/api/yard/HTM/LongTermMemory/TagOperations.md +129 -0
- data/docs/api/yard/HTM/LongTermMemory/VectorSearch.md +30 -0
- data/docs/api/yard/HTM/LongTermMemory.md +279 -31
- data/docs/api/yard/HTM/MCP/AssembleContextTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ClearGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ClearWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfigResource.md +12 -0
- data/docs/api/yard/HTM/MCP/ConfirmTool.md +12 -0
- data/docs/api/yard/HTM/MCP/CreateGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/EnrichPendingTool.md +16 -0
- data/docs/api/yard/HTM/MCP/ExtractPropositionsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FailoverTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FileInfoTool.md +13 -0
- data/docs/api/yard/HTM/MCP/FileSourcesResource.md +12 -0
- data/docs/api/yard/HTM/MCP/FileSupport.md +7 -0
- data/docs/api/yard/HTM/MCP/FindByTopicTool.md +12 -0
- data/docs/api/yard/HTM/MCP/FirstMentionTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetContentTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ForgetTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupStatusTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetGroupWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GetWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRecallTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupRememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/GroupSession.md +23 -0
- data/docs/api/yard/HTM/MCP/JoinGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LeaveGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/ListGroupsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListRobotsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ListTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/LoadDirectoryTool.md +13 -0
- data/docs/api/yard/HTM/MCP/LoadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/MemoryStatsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/PopularTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PromoteRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/PurgeDeletedTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RecallTool.md +16 -0
- data/docs/api/yard/HTM/MCP/RecentMemoriesResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RelatedNodesTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RememberTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RestoreTool.md +12 -0
- data/docs/api/yard/HTM/MCP/RobotGroupsResource.md +13 -0
- data/docs/api/yard/HTM/MCP/RobotTeamsStatusTool.md +13 -0
- data/docs/api/yard/HTM/MCP/RunRobotTeamsTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SearchByTagsTool.md +16 -0
- data/docs/api/yard/HTM/MCP/SearchTagsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Server.md +37 -0
- data/docs/api/yard/HTM/MCP/Session.md +32 -0
- data/docs/api/yard/HTM/MCP/SetRobotTool.md +12 -0
- data/docs/api/yard/HTM/MCP/ShutdownGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/StartupPromptResource.md +16 -0
- data/docs/api/yard/HTM/MCP/StatsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/SyncFilesTool.md +13 -0
- data/docs/api/yard/HTM/MCP/SyncGroupTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagHierarchyResource.md +16 -0
- data/docs/api/yard/HTM/MCP/TagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TagTreeTool.md +22 -0
- data/docs/api/yard/HTM/MCP/TeamNames.md +7 -0
- data/docs/api/yard/HTM/MCP/TimelineTool.md +12 -0
- data/docs/api/yard/HTM/MCP/Tool.md +24 -0
- data/docs/api/yard/HTM/MCP/ToolSupport.md +17 -0
- data/docs/api/yard/HTM/MCP/TopicRelationshipsTool.md +12 -0
- data/docs/api/yard/HTM/MCP/TransferWorkingMemoryTool.md +12 -0
- data/docs/api/yard/HTM/MCP/UnloadFileTool.md +13 -0
- data/docs/api/yard/HTM/MCP/UntagNodeTool.md +12 -0
- data/docs/api/yard/HTM/MCP.md +30 -0
- data/docs/api/yard/HTM/Migration.md +44 -0
- data/docs/api/yard/HTM/Models/FileSource.md +66 -0
- data/docs/api/yard/HTM/Models/Node/Scopes.md +74 -0
- data/docs/api/yard/HTM/Models/Node/SoftDeletion.md +22 -0
- data/docs/api/yard/HTM/Models/Node/VectorSimilarity.md +28 -0
- data/docs/api/yard/HTM/Models/Node.md +113 -0
- data/docs/api/yard/HTM/Models/NodeLink.md +65 -0
- data/docs/api/yard/HTM/Models/NodeRelationship.md +31 -0
- data/docs/api/yard/HTM/Models/NodeTag.md +38 -0
- data/docs/api/yard/HTM/Models/Robot.md +50 -0
- data/docs/api/yard/HTM/Models/RobotNode.md +35 -0
- data/docs/api/yard/HTM/Models/Tag/Scopes.md +32 -0
- data/docs/api/yard/HTM/Models/Tag.md +112 -0
- data/docs/api/yard/HTM/Models.md +5 -0
- data/docs/api/yard/HTM/NodeEnrichment.md +36 -0
- data/docs/api/yard/HTM/NodeView.md +113 -0
- data/docs/api/yard/HTM/NotFoundError.md +6 -5
- data/docs/api/yard/HTM/Observability.md +58 -40
- data/docs/api/yard/HTM/PropositionError.md +6 -6
- data/docs/api/yard/HTM/PropositionService.md +63 -29
- data/docs/api/yard/HTM/QueryCache/KeyNormalizer.md +25 -0
- data/docs/api/yard/HTM/QueryCache/NullStore.md +19 -0
- data/docs/api/yard/HTM/QueryCache/Store.md +43 -0
- data/docs/api/yard/HTM/QueryCache.md +41 -46
- data/docs/api/yard/HTM/QueryTimeoutError.md +9 -8
- data/docs/api/yard/HTM/Railtie.md +11 -7
- data/docs/api/yard/HTM/RecallQuery.md +111 -0
- data/docs/api/yard/HTM/ResourceExhaustedError.md +6 -6
- data/docs/api/yard/HTM/RobotGroup/CacheSync.md +35 -0
- data/docs/api/yard/HTM/RobotGroup/Membership.md +96 -0
- data/docs/api/yard/HTM/RobotGroup/TransferOptions.md +14 -0
- data/docs/api/yard/HTM/RobotGroup/WorkingMemoryLedger.md +65 -0
- data/docs/api/yard/HTM/RobotGroup.md +116 -360
- data/docs/api/yard/HTM/Robots/Actions/TagMove.md +31 -0
- data/docs/api/yard/HTM/Robots/Actions.md +153 -0
- data/docs/api/yard/HTM/Robots/Neighbors.md +20 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Idler.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor/Roster.md +26 -0
- data/docs/api/yard/HTM/Robots/Supervisor.md +42 -0
- data/docs/api/yard/HTM/Robots/Team.md +60 -0
- data/docs/api/yard/HTM/Robots/Teams/Archivist.md +43 -0
- data/docs/api/yard/HTM/Robots/Teams/Consolidator.md +29 -0
- data/docs/api/yard/HTM/Robots/Teams/ContradictionDetector.md +33 -0
- data/docs/api/yard/HTM/Robots/Teams/TagCurator.md +37 -0
- data/docs/api/yard/HTM/Robots/Teams.md +5 -0
- data/docs/api/yard/HTM/Robots/Tools/ArchiveNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Base.md +16 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeNodes.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/MergeTags.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/Pass.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/RecordConflict.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools/SupersedeNode.md +12 -0
- data/docs/api/yard/HTM/Robots/Tools.md +14 -0
- data/docs/api/yard/HTM/Robots.md +72 -0
- data/docs/api/yard/HTM/SearchFilters.md +82 -0
- data/docs/api/yard/HTM/SequelConfig.md +97 -0
- data/docs/api/yard/HTM/Settings.md +39 -0
- data/docs/api/yard/HTM/Sinatra/Helpers.md +37 -0
- data/docs/api/yard/HTM/Sinatra/Middleware.md +29 -0
- data/docs/api/yard/HTM/Sinatra.md +44 -0
- data/docs/api/yard/HTM/SqlBuilder/Sparsevec.md +69 -0
- data/docs/api/yard/HTM/SqlBuilder.md +62 -75
- data/docs/api/yard/HTM/StartupPrompt.md +45 -0
- data/docs/api/yard/HTM/TagError.md +6 -6
- data/docs/api/yard/HTM/TagService.md +100 -37
- data/docs/api/yard/HTM/TagTree/Branch.md +43 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer/Layout.md +51 -0
- data/docs/api/yard/HTM/TagTree/SvgRenderer.md +25 -0
- data/docs/api/yard/HTM/TagTree.md +65 -0
- data/docs/api/yard/HTM/Telemetry/NullInstrument.md +12 -9
- data/docs/api/yard/HTM/Telemetry/NullMeter.md +17 -9
- data/docs/api/yard/HTM/Telemetry.md +53 -50
- data/docs/api/yard/HTM/Timeframe/Result.md +13 -16
- data/docs/api/yard/HTM/Timeframe.md +17 -20
- data/docs/api/yard/HTM/TimeframeExtractor/Patterns.md +18 -0
- data/docs/api/yard/HTM/TimeframeExtractor/Result.md +13 -16
- data/docs/api/yard/HTM/TimeframeExtractor.md +27 -16
- data/docs/api/yard/HTM/Timeline.md +113 -0
- data/docs/api/yard/HTM/ValidationError.md +6 -5
- data/docs/api/yard/HTM/Workflows/RememberWorkflow/NodeState.md +73 -0
- data/docs/api/yard/HTM/Workflows/RememberWorkflow.md +80 -0
- data/docs/api/yard/HTM/Workflows.md +5 -0
- data/docs/api/yard/HTM/WorkingMemory/Entry.md +67 -0
- data/docs/api/yard/HTM/WorkingMemory/Store.md +54 -0
- data/docs/api/yard/HTM/WorkingMemory.md +113 -87
- data/docs/api/yard/HTM/WorkingMemoryChannel/Subscribers.md +28 -0
- data/docs/api/yard/HTM/WorkingMemoryChannel.md +108 -102
- data/docs/api/yard/HTM.md +483 -5
- data/docs/api/yard/README.md +211 -0
- data/docs/api/yard/Sinatra/Base.md +30 -0
- data/docs/api/yard/Sinatra.md +7 -0
- data/docs/api/yard/index.csv +1834 -181
- data/docs/api/yard-reference.md +228 -9
- data/docs/architecture/adrs/005-rag-retrieval.md +3 -0
- data/docs/architecture/adrs/index.md +1 -1
- data/docs/architecture/index.md +2 -2
- data/docs/architecture/overview.md +3 -3
- data/docs/assets/images/project-structure.svg +2 -2
- data/docs/database/INDEX.md +113 -0
- data/docs/database/README.md +60 -176
- data/docs/database/file_sources.md +51 -0
- data/docs/database/file_sources.svg +120 -0
- data/docs/database/naming-convention.md +12 -12
- data/docs/database/node_links.md +65 -0
- data/docs/database/node_links.svg +171 -0
- data/docs/database/node_relationships.md +62 -0
- data/docs/database/node_relationships.svg +124 -0
- data/docs/database/node_tags.md +50 -0
- data/docs/database/node_tags.svg +125 -0
- data/docs/database/nodes.md +120 -0
- data/docs/database/nodes.svg +394 -0
- data/docs/database/robot_nodes.md +57 -0
- data/docs/database/robot_nodes.svg +155 -0
- data/docs/database/robots.md +40 -0
- data/docs/database/robots.svg +131 -0
- data/docs/database/schema.svg +384 -275
- data/docs/database/schema_migrations.md +19 -0
- data/docs/database/schema_migrations.svg +31 -0
- data/docs/database/tags.md +47 -0
- data/docs/database/tags.svg +90 -0
- data/docs/development/asgard-tasks.md +114 -0
- data/docs/development/contributing.md +6 -6
- data/docs/development/index.md +15 -17
- data/docs/development/schema.md +43 -14
- data/docs/development/setup.md +60 -70
- data/docs/development/testing.md +57 -65
- data/docs/examples/basic-usage.md +9 -9
- data/docs/examples/config-files.md +8 -8
- data/docs/examples/file-loading.md +12 -12
- data/docs/examples/index.md +15 -8
- data/docs/examples/llm-configuration.md +13 -9
- data/docs/examples/mcp-client.md +61 -59
- data/docs/examples/rails-integration.md +5 -4
- data/docs/examples/sinatra-integration.md +5 -4
- data/docs/examples/standalone-app.md +17 -16
- data/docs/getting-started/index.md +3 -3
- data/docs/getting-started/installation.md +76 -83
- data/docs/getting-started/quick-start.md +24 -22
- data/docs/guides/adding-memories.md +14 -3
- data/docs/guides/cli.md +458 -0
- data/docs/guides/configuration.md +72 -37
- data/docs/guides/epistemic-status.md +138 -0
- data/docs/guides/event-time.md +106 -0
- data/docs/guides/file-loading.md +26 -22
- data/docs/guides/getting-started.md +21 -17
- data/docs/guides/long-term-memory.md +1 -1
- data/docs/guides/mcp-server.md +416 -173
- data/docs/guides/propositions.md +18 -29
- data/docs/guides/recalling-memories.md +22 -7
- data/docs/guides/robot-teams.md +96 -0
- data/docs/guides/search-strategies.md +10 -7
- data/docs/guides/tags.md +19 -19
- data/docs/guides/timeline.md +106 -0
- data/docs/index.md +7 -7
- data/docs/llms.txt +35 -0
- data/docs/multi_framework_support.md +13 -13
- data/docs/robots/robot-groups.md +9 -9
- data/docs/robots/two-tier-memory.md +13 -26
- data/docs/setup_local_database.md +33 -31
- data/examples/00_create_examples_db.rb +20 -7
- data/examples/01_basic_usage.rb +20 -18
- data/examples/02_config_file_example/README.md +13 -12
- data/examples/02_config_file_example/config/htm.local.yml +8 -8
- data/examples/02_config_file_example/show_config.rb +3 -4
- data/examples/03_custom_llm_configuration.rb +12 -12
- data/examples/04_file_loader_usage.rb +15 -21
- data/examples/05_timeframe_demo.rb +282 -234
- data/examples/06_example_app/.loki +36 -0
- data/examples/06_example_app/app.rb +21 -33
- data/examples/07_cli_app/README.md +18 -18
- data/examples/07_cli_app/htm_cli.rb +25 -19
- data/examples/08_sinatra_app/Gemfile +1 -0
- data/examples/08_sinatra_app/Gemfile.lock +101 -67
- data/examples/08_sinatra_app/app.rb +64 -62
- data/examples/09_mcp_client.rb +92 -119
- data/examples/10_telemetry/README.md +3 -3
- data/examples/10_telemetry/SETUP_README.md +2 -2
- data/examples/10_telemetry/demo.rb +5 -5
- data/examples/11_robot_groups/README.md +5 -4
- data/examples/11_robot_groups/lib/robot_worker.rb +0 -5
- data/examples/11_robot_groups/multi_process.rb +5 -4
- data/examples/11_robot_groups/same_process.rb +18 -17
- data/examples/12_rails_app/Gemfile +1 -1
- data/examples/12_rails_app/Gemfile.lock +146 -97
- data/examples/12_rails_app/README.md +21 -17
- data/examples/12_rails_app/app/controllers/chats_controller.rb +33 -63
- data/examples/12_rails_app/app/controllers/memories_controller.rb +7 -1
- data/examples/12_rails_app/app/controllers/messages_controller.rb +21 -58
- data/examples/12_rails_app/app/controllers/search_controller.rb +7 -2
- data/examples/12_rails_app/app/models/chat.rb +0 -33
- data/examples/12_rails_app/app/models/message.rb +0 -2
- data/examples/12_rails_app/app/views/chats/show.html.erb +2 -2
- data/examples/12_rails_app/app/views/files/new.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/_memory_card.html.erb +1 -1
- data/examples/12_rails_app/app/views/memories/new.html.erb +12 -0
- data/examples/12_rails_app/app/views/memories/show.html.erb +13 -0
- data/examples/12_rails_app/app/views/search/index.html.erb +18 -2
- data/examples/12_rails_app/config/initializers/ruby_llm.rb +11 -15
- data/examples/12_rails_app/db/migrate/20261205061932_create_ruby_llm_records.rb +160 -0
- data/examples/12_rails_app/db/migrate/20261205061933_create_chats.rb +13 -0
- data/examples/12_rails_app/db/migrate/20261205061934_create_messages.rb +23 -0
- data/examples/12_rails_app/db/schema.rb +163 -20
- data/examples/README.md +53 -44
- data/examples/examples_helper.rb +29 -5
- data/htm.gemspec +68 -0
- data/lib/htm/admin/database_commands.rb +454 -0
- data/lib/htm/admin/enrich_commands.rb +209 -0
- data/lib/htm/admin/file_commands.rb +323 -0
- data/lib/htm/admin/memory_commands/edit.rb +157 -0
- data/lib/htm/admin/memory_commands/search.rb +178 -0
- data/lib/htm/admin/memory_commands/tag_search.rb +98 -0
- data/lib/htm/admin/memory_commands/text.rb +164 -0
- data/lib/htm/admin/memory_commands/working_memory.rb +71 -0
- data/lib/htm/admin/memory_commands.rb +179 -0
- data/lib/htm/admin/tag_commands.rb +352 -0
- data/lib/htm/admin/tag_graph.rb +290 -0
- data/lib/htm/admin/templates/tag_graph.html +295 -0
- data/lib/htm/admin/yard_docs.rb +206 -0
- data/lib/htm/admin.rb +253 -0
- data/lib/htm/circuit_breaker.rb +142 -68
- data/lib/htm/class_methods.rb +136 -0
- data/lib/htm/cli/config_file.rb +86 -0
- data/lib/htm/cli/db.rb +77 -0
- data/lib/htm/cli/enrich.rb +44 -0
- data/lib/htm/cli/environment.rb +74 -0
- data/lib/htm/cli/error_suggestion.rb +97 -0
- data/lib/htm/cli/files.rb +41 -0
- data/lib/htm/cli/group.rb +32 -0
- data/lib/htm/cli/memory.rb +320 -0
- data/lib/htm/cli/memory_command.rb +71 -0
- data/lib/htm/cli/robots.rb +71 -0
- data/lib/htm/cli/support.rb +46 -0
- data/lib/htm/cli/tags.rb +103 -0
- data/lib/htm/cli/working_memory.rb +41 -0
- data/lib/htm/cli.rb +75 -0
- data/lib/htm/config/builder.rb +99 -68
- data/lib/htm/config/coercion.rb +91 -0
- data/lib/htm/config/database.rb +81 -52
- data/lib/htm/config/defaults.yml +52 -16
- data/lib/htm/config/readers.rb +85 -0
- data/lib/htm/config/ruby_llm_settings.rb +58 -0
- data/lib/htm/config/validator.rb +45 -26
- data/lib/htm/config.rb +112 -297
- data/lib/htm/database.rb +305 -396
- data/lib/htm/database_docs.rb +149 -0
- data/lib/htm/embedding_service.rb +26 -66
- data/lib/htm/epistemics.rb +254 -0
- data/lib/htm/errors.rb +4 -4
- data/lib/htm/event_time.rb +201 -0
- data/lib/htm/file_memory.rb +106 -0
- data/lib/htm/input_validator.rb +158 -0
- data/lib/htm/integrations/sinatra.rb +43 -31
- data/lib/htm/job_adapter.rb +78 -83
- data/lib/htm/jobs/failure_logging.rb +49 -0
- data/lib/htm/jobs/generate_embedding_job.rb +21 -28
- data/lib/htm/jobs/generate_propositions_job.rb +56 -28
- data/lib/htm/jobs/generate_relationships_job.rb +28 -24
- data/lib/htm/jobs/generate_tags_job.rb +32 -37
- data/lib/htm/jobs/llm_call_timer.rb +53 -0
- data/lib/htm/jobs/node_lookup.rb +27 -0
- data/lib/htm/knowledge_memory.rb +153 -0
- data/lib/htm/loaders/chunk_sync.rb +168 -0
- data/lib/htm/loaders/markdown_chunker.rb +207 -36
- data/lib/htm/loaders/markdown_loader.rb +76 -120
- data/lib/htm/long_term_memory/fulltext_search.rb +15 -36
- data/lib/htm/long_term_memory/hybrid_search.rb +471 -544
- data/lib/htm/long_term_memory/node_operations.rb +110 -81
- data/lib/htm/long_term_memory/relevance_scorer.rb +232 -237
- data/lib/htm/long_term_memory/tag_operations.rb +201 -130
- data/lib/htm/long_term_memory/vector_search.rb +33 -61
- data/lib/htm/long_term_memory.rb +5 -17
- data/lib/htm/mcp/file_tools.rb +190 -0
- data/lib/htm/mcp/group_tools.rb +223 -233
- data/lib/htm/mcp/node_tools.rb +350 -0
- data/lib/htm/mcp/resources.rb +102 -28
- data/lib/htm/mcp/robot_team_tools.rb +119 -0
- data/lib/htm/mcp/server.rb +26 -14
- data/lib/htm/mcp/tag_tools.rb +130 -0
- data/lib/htm/mcp/tool.rb +40 -0
- data/lib/htm/mcp/tool_support.rb +88 -0
- data/lib/htm/mcp/tools.rb +232 -283
- data/lib/htm/models/file_source.rb +35 -20
- data/lib/htm/models/node.rb +287 -193
- data/lib/htm/models/node_link.rb +97 -0
- data/lib/htm/models/node_relationship.rb +3 -2
- data/lib/htm/models/node_tag.rb +22 -2
- data/lib/htm/models/robot.rb +4 -8
- data/lib/htm/models/robot_node.rb +5 -2
- data/lib/htm/models/tag.rb +53 -207
- data/lib/htm/node_enrichment.rb +75 -0
- data/lib/htm/node_view.rb +295 -0
- data/lib/htm/observability.rb +114 -98
- data/lib/htm/proposition_service.rb +38 -74
- data/lib/htm/query_cache.rb +145 -91
- data/lib/htm/railtie.rb +3 -7
- data/lib/htm/request_options.rb +149 -0
- data/lib/htm/robot_group/cache_sync.rb +69 -0
- data/lib/htm/robot_group/membership.rb +147 -0
- data/lib/htm/robot_group/working_memory_ledger.rb +111 -0
- data/lib/htm/robot_group.rb +128 -521
- data/lib/htm/robots/actions.rb +371 -0
- data/lib/htm/robots/neighbors.rb +63 -0
- data/lib/htm/robots/node_brief.rb +49 -0
- data/lib/htm/robots/supervisor.rb +140 -0
- data/lib/htm/robots/team.rb +124 -0
- data/lib/htm/robots/teams/archivist.rb +88 -0
- data/lib/htm/robots/teams/consolidator.rb +52 -0
- data/lib/htm/robots/teams/contradiction_detector.rb +67 -0
- data/lib/htm/robots/teams/tag_curator.rb +75 -0
- data/lib/htm/robots/tools.rb +127 -0
- data/lib/htm/robots.rb +125 -0
- data/lib/htm/search_filters.rb +116 -0
- data/lib/htm/sequel_config.rb +95 -59
- data/lib/htm/sql_builder.rb +162 -53
- data/lib/htm/startup_prompt.rb +73 -0
- data/lib/htm/tag_service.rb +104 -109
- data/lib/htm/tag_tree.rb +206 -0
- data/lib/htm/telemetry.rb +15 -16
- data/lib/htm/timeframe.rb +27 -9
- data/lib/htm/timeframe_extractor.rb +77 -55
- data/lib/htm/timeline.rb +230 -0
- data/lib/htm/version.rb +1 -1
- data/lib/htm/workflows/remember_workflow.rb +145 -136
- data/lib/htm/working_memory/entry.rb +53 -0
- data/lib/htm/working_memory/store.rb +97 -0
- data/lib/htm/working_memory.rb +137 -139
- data/lib/htm/working_memory_channel.rb +90 -40
- data/lib/htm.rb +177 -501
- data/mkdocs.yml +100 -23
- data/scripts/install_local_database.sh +7 -6
- metadata +1032 -594
- data/.tbls.yml +0 -31
- data/Rakefile +0 -240
- data/bin/htm_mcp +0 -27
- data/docs/api/yard/HTM/ActiveRecordConfig.md +0 -29
- data/docs/api/yard/HTM/ConfigSection.md +0 -28
- data/docs/database/public.file_sources.md +0 -42
- data/docs/database/public.file_sources.svg +0 -219
- data/docs/database/public.node_stats.md +0 -48
- data/docs/database/public.node_stats.svg +0 -41
- data/docs/database/public.node_tags.md +0 -41
- data/docs/database/public.node_tags.svg +0 -251
- data/docs/database/public.nodes.md +0 -61
- data/docs/database/public.nodes.svg +0 -283
- data/docs/database/public.nodes_tags.md +0 -39
- data/docs/database/public.nodes_tags.svg +0 -112
- data/docs/database/public.ontology_structure.md +0 -48
- data/docs/database/public.ontology_structure.svg +0 -38
- data/docs/database/public.operations_log.md +0 -42
- data/docs/database/public.operations_log.svg +0 -130
- data/docs/database/public.relationships.md +0 -39
- data/docs/database/public.relationships.svg +0 -41
- data/docs/database/public.robot_activity.md +0 -46
- data/docs/database/public.robot_activity.svg +0 -35
- data/docs/database/public.robot_nodes.md +0 -48
- data/docs/database/public.robot_nodes.svg +0 -251
- data/docs/database/public.robots.md +0 -34
- data/docs/database/public.robots.svg +0 -165
- data/docs/database/public.schema_migrations.md +0 -29
- data/docs/database/public.schema_migrations.svg +0 -26
- data/docs/database/public.tags.md +0 -38
- data/docs/database/public.tags.svg +0 -147
- data/docs/database/public.topic_relationships.md +0 -45
- data/docs/database/public.topic_relationships.svg +0 -32
- data/docs/database/schema.json +0 -1814
- data/docs/database_rake_tasks.md +0 -345
- data/docs/development/rake-tasks.md +0 -1113
- data/docs/using_rake_tasks_in_your_app.md +0 -383
- data/examples/06_example_app/Rakefile +0 -71
- data/examples/12_rails_app/app/models/model.rb +0 -5
- data/examples/12_rails_app/app/models/tool_call.rb +0 -5
- data/examples/12_rails_app/db/migrate/20250124000001_create_ruby_llm_tables.rb +0 -34
- data/examples/12_rails_app/db/migrate/20250124000002_create_models_table.rb +0 -28
- data/lib/htm/mcp/cli.rb +0 -583
- data/lib/htm/tasks.rb +0 -79
- data/lib/tasks/db.rake +0 -15
- data/lib/tasks/doc.rake +0 -301
- data/lib/tasks/files.rake +0 -285
- data/lib/tasks/htm.rake +0 -703
- data/lib/tasks/jobs.rake +0 -429
- data/lib/tasks/tags.rake +0 -184
- data/scripts/backfill_parent_tags.rb +0 -376
- data/scripts/normalize_plural_tags.rb +0 -335
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Module HTM::Admin::MemoryCommands <a id="module-HTM-Admin-MemoryCommands"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/memory_commands.rb, lib/htm/admin/memory_commands/edit.rb, lib/htm/admin/memory_commands/search.rb, lib/htm/admin/memory_commands/tag_search.rb, lib/htm/admin/memory_commands/working_memory.rb |
|
|
6
|
+
|
|
7
|
+
The commands that work on memory itself from the command line: recall,
|
|
8
|
+
remember, show, forget, restore, tag, the working memory and tag searches (htm
|
|
9
|
+
recall, htm remember, htm wm ..., htm tags search, ...).
|
|
10
|
+
|
|
11
|
+
The module functions parse command-line input; the Console classes under it
|
|
12
|
+
run the commands against a terminal and a robot's memory and print text, or
|
|
13
|
+
JSON with json: true.
|
|
14
|
+
|
|
15
|
+
## Constants
|
|
16
|
+
### `DEFAULT_ROBOT` <a id="constant-DEFAULT_ROBOT"></a> <a id="DEFAULT_ROBOT-constant"></a>
|
|
17
|
+
The robot the command line remembers and recalls as, unless --robot or
|
|
18
|
+
HTM_ROBOT_NAME names another
|
|
19
|
+
|
|
20
|
+
### `PREVIEW_LENGTH` <a id="constant-PREVIEW_LENGTH"></a> <a id="PREVIEW_LENGTH-constant"></a>
|
|
21
|
+
Characters of content a result shows unless --full
|
|
22
|
+
|
|
23
|
+
## Public Class Methods
|
|
24
|
+
### `cutoff(days:, before: nil)` <a id="method-c-cutoff"></a> <a id="cutoff-class_method"></a>
|
|
25
|
+
- **`@raise`** [ArgumentError] for an unparseable +before+
|
|
26
|
+
- **`@return`** [Time] the purge cutoff: +before+ (ISO8601) when given, else +days+ ago
|
|
27
|
+
|
|
28
|
+
### `id_list(ids)` <a id="method-c-id_list"></a> <a id="id_list-class_method"></a>
|
|
29
|
+
"#12, #15"
|
|
30
|
+
|
|
31
|
+
### `json_value(text)` <a id="method-c-json_value"></a> <a id="json_value-class_method"></a>
|
|
32
|
+
Not documented.
|
|
33
|
+
|
|
34
|
+
### `knowledge(status, confidence)` <a id="method-c-knowledge"></a> <a id="knowledge-class_method"></a>
|
|
35
|
+
How a memory is known, as printed: "stated", "inferred 0.60"; nil without a
|
|
36
|
+
status
|
|
37
|
+
|
|
38
|
+
### `log_to_stderr!(level = Logger::WARN)` <a id="method-c-log_to_stderr-21"></a> <a id="log_to_stderr!-class_method"></a>
|
|
39
|
+
Send HTM's and RubyLLM's logging to $stderr so it never mixes with a command's
|
|
40
|
+
output: warnings only unless `level` says otherwise
|
|
41
|
+
|
|
42
|
+
### `parse_metadata(pairs)` <a id="method-c-parse_metadata"></a> <a id="parse_metadata-class_method"></a>
|
|
43
|
+
Metadata from --metadata key:value pairs. A value that reads as JSON (2, true,
|
|
44
|
+
null, "x", [1]) becomes that value, so it matches the type stored in the node;
|
|
45
|
+
anything else stays a string.
|
|
46
|
+
- **`@param`** `pairs` [Hash{String => String}, nil]
|
|
47
|
+
- **`@return`** [Hash{String => Object}]
|
|
48
|
+
|
|
49
|
+
### `plural(count, noun)` <a id="method-c-plural"></a> <a id="plural-class_method"></a>
|
|
50
|
+
- **`@return`** [String] "3 nodes", "1 node"
|
|
51
|
+
|
|
52
|
+
### `preview(content, length = PREVIEW_LENGTH)` <a id="method-c-preview"></a> <a id="preview-class_method"></a>
|
|
53
|
+
- **`@return`** [String] +content+ on one line, cut to +length+ characters
|
|
54
|
+
|
|
55
|
+
### `read_input(input)` <a id="method-c-read_input"></a> <a id="read_input-class_method"></a>
|
|
56
|
+
Not documented.
|
|
57
|
+
|
|
58
|
+
### `read_text(words, input: $stdin)` <a id="method-c-read_text"></a> <a id="read_text-class_method"></a>
|
|
59
|
+
The text a command works on: its words joined by spaces, or `input` (stdin)
|
|
60
|
+
when there are none or the only one is "-"
|
|
61
|
+
- **`@raise`** [HTM::Admin::Error] when there is no text
|
|
62
|
+
|
|
63
|
+
### `robot_name(name = nil)` <a id="method-c-robot_name"></a> <a id="robot_name-class_method"></a>
|
|
64
|
+
- **`@return`** [String] +name+, else HTM_ROBOT_NAME, else DEFAULT_ROBOT
|
|
65
|
+
|
|
66
|
+
### `short_time(iso)` <a id="method-c-short_time"></a> <a id="short_time-class_method"></a>
|
|
67
|
+
- **`@return`** [String] an ISO8601 time as "YYYY-MM-DD HH:MM", or "-"
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Class HTM::Admin::TagCommands::Console <a id="class-HTM-Admin-TagCommands-Console"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | Admin::Console |
|
|
6
|
+
| **Defined in** | lib/htm/admin/tag_commands.rb |
|
|
7
|
+
|
|
8
|
+
The `htm tags ...` commands, reporting to `out`
|
|
9
|
+
|
|
10
|
+
**`@example`**
|
|
11
|
+
```ruby
|
|
12
|
+
HTM::Admin::TagCommands::Console.new(out: StringIO.new).tree("ai")
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Constants
|
|
16
|
+
### `RESTORE_STEPS` <a id="constant-RESTORE_STEPS"></a> <a id="RESTORE_STEPS-constant"></a>
|
|
17
|
+
restore_plurals' step by its apply: flag; anything else lists the repairs only
|
|
18
|
+
|
|
19
|
+
## Public Instance Methods
|
|
20
|
+
### `cleanup(now: Time.now)` <a id="method-i-cleanup"></a> <a id="cleanup-instance_method"></a>
|
|
21
|
+
Soft delete stale node_tags rows and orphaned tags, after confirmation
|
|
22
|
+
- **`@return`** [Hash, nil] { node_tags:, tags: } soft-deleted, nil when nothing was done
|
|
23
|
+
|
|
24
|
+
### `export(prefix = nil, dir: '.')` <a id="method-i-export"></a> <a id="export-instance_method"></a>
|
|
25
|
+
Write tags.txt, tags.md and tags.svg into `dir`
|
|
26
|
+
- **`@return`** [Array<String>, nil] the files written
|
|
27
|
+
|
|
28
|
+
### `mermaid(prefix = nil, path: 'tags.md')` <a id="method-i-mermaid"></a> <a id="mermaid-instance_method"></a>
|
|
29
|
+
Write the tags as a Mermaid flowchart to `path`
|
|
30
|
+
|
|
31
|
+
### `rebuild()` <a id="method-i-rebuild"></a> <a id="rebuild-instance_method"></a>
|
|
32
|
+
Delete every tag and extract them again for every node, after confirmation
|
|
33
|
+
- **`@return`** [Hash, nil] { ok:, failed: }, nil when aborted
|
|
34
|
+
|
|
35
|
+
### `restore_plurals(prefix = nil, apply: nil)` <a id="method-i-restore_plurals"></a> <a id="restore_plurals-instance_method"></a>
|
|
36
|
+
List the tags the old normalizer mangled; with `apply`, rename each (subtree
|
|
37
|
+
included) to its restored name, merging into it if it already exists. Renames
|
|
38
|
+
are soft deletes plus relinks, as merge_tags.
|
|
39
|
+
- **`@param`** `prefix` [String, nil] only tags under this prefix
|
|
40
|
+
- **`@param`** `apply` [Boolean, nil] rename the tags instead of only listing them
|
|
41
|
+
- **`@return`** [Array<Array(String, String)>] the repairs found
|
|
42
|
+
|
|
43
|
+
### `svg(prefix = nil, path: 'tags.svg')` <a id="method-i-svg"></a> <a id="svg-instance_method"></a>
|
|
44
|
+
Write the tags as an SVG diagram to `path`
|
|
45
|
+
|
|
46
|
+
### `tree(prefix = nil)` <a id="method-i-tree"></a> <a id="tree-instance_method"></a>
|
|
47
|
+
Print the tag tree
|
|
48
|
+
- **`@return`** [Integer, nil] tags printed, nil when there are none
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Module HTM::Admin::TagCommands <a id="module-HTM-Admin-TagCommands"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/tag_commands.rb |
|
|
6
|
+
|
|
7
|
+
The `htm tags ...` commands: show, export, rebuild, clean up and repair the
|
|
8
|
+
tag hierarchy
|
|
9
|
+
|
|
10
|
+
The module functions are the task entry points and the helpers that print
|
|
11
|
+
nothing; Console runs the commands against a given terminal.
|
|
12
|
+
|
|
13
|
+
## Constants
|
|
14
|
+
### `KEEP_SINGULAR` <a id="constant-KEEP_SINGULAR"></a> <a id="KEEP_SINGULAR-constant"></a>
|
|
15
|
+
Singular forms the skip-list rule must not pluralize back: each is a word of
|
|
16
|
+
its own (async-http is not a mangled async-https)
|
|
17
|
+
|
|
18
|
+
## Public Class Methods
|
|
19
|
+
### `cleanup()` <a id="method-c-cleanup"></a> <a id="cleanup-class_method"></a>
|
|
20
|
+
Soft delete stale node_tags rows and orphaned tags, after confirmation (see
|
|
21
|
+
Console#cleanup)
|
|
22
|
+
|
|
23
|
+
### `clear_tags()` <a id="method-c-clear_tags"></a> <a id="clear_tags-class_method"></a>
|
|
24
|
+
Delete every node-tag association and every tag
|
|
25
|
+
- **`@return`** [Array(Integer, Integer)] node_tags and tags rows deleted
|
|
26
|
+
|
|
27
|
+
### `export(prefix = nil)` <a id="method-c-export"></a> <a id="export-class_method"></a>
|
|
28
|
+
Write tags.txt, tags.md and tags.svg (see Console#export)
|
|
29
|
+
|
|
30
|
+
### `export_files(tags, prefix, count)` <a id="method-c-export_files"></a> <a id="export_files-class_method"></a>
|
|
31
|
+
The files export writes
|
|
32
|
+
- **`@return`** [Hash{String => Array(String, String)}] file name => [content, label]
|
|
33
|
+
|
|
34
|
+
### `mermaid(prefix = nil)` <a id="method-c-mermaid"></a> <a id="mermaid-class_method"></a>
|
|
35
|
+
Write the tags as a Mermaid flowchart to tags.md (see Console#mermaid)
|
|
36
|
+
|
|
37
|
+
### `plural_repairs(prefix = nil)` <a id="method-c-plural_repairs"></a> <a id="plural_repairs-class_method"></a>
|
|
38
|
+
Every active tag whose name the old normalizer mangled, shortest first so a
|
|
39
|
+
parent is renamed (taking its subtree) before its children
|
|
40
|
+
- **`@param`** `prefix` [String, nil] only tags under this prefix
|
|
41
|
+
- **`@return`** [Array<Array(String, String)>] [old name, restored name] pairs
|
|
42
|
+
|
|
43
|
+
### `prefix_note(prefix)` <a id="method-c-prefix_note"></a> <a id="prefix_note-class_method"></a>
|
|
44
|
+
- **`@return`** [String] " (prefix: x)" or ""
|
|
45
|
+
|
|
46
|
+
### `rebuild()` <a id="method-c-rebuild"></a> <a id="rebuild-class_method"></a>
|
|
47
|
+
Delete every tag and extract them again for every node, after confirmation
|
|
48
|
+
(see Console#rebuild)
|
|
49
|
+
|
|
50
|
+
### `rebuild_plan(node_count)` <a id="method-c-rebuild_plan"></a> <a id="rebuild_plan-class_method"></a>
|
|
51
|
+
What rebuild will do, for the confirmation prompt
|
|
52
|
+
- **`@return`** [Array<String>]
|
|
53
|
+
|
|
54
|
+
### `restore_plural(from, into)` <a id="method-c-restore_plural"></a> <a id="restore_plural-class_method"></a>
|
|
55
|
+
Rename tag `from` (subtree included) to `into`, merging into it if it already
|
|
56
|
+
exists. A rename is a soft delete plus relinks, as merge_tags.
|
|
57
|
+
- **`@return`** [Boolean] whether +from+ was renamed; false when it is gone
|
|
58
|
+
(moved already with its parent)
|
|
59
|
+
|
|
60
|
+
### `restore_plurals(prefix = nil, apply: nil)` <a id="method-c-restore_plurals"></a> <a id="restore_plurals-class_method"></a>
|
|
61
|
+
List, or with `apply` rename, the tags the old normalizer mangled (see
|
|
62
|
+
Console#restore_plurals)
|
|
63
|
+
|
|
64
|
+
### `restored_plural_level(level, keep)` <a id="method-c-restored_plural_level"></a> <a id="restored_plural_level-class_method"></a>
|
|
65
|
+
- **`@return`** [String] +level+ with its "s" back, or +level+ unchanged
|
|
66
|
+
|
|
67
|
+
### `restored_plural_name(name, contents)` <a id="method-c-restored_plural_name"></a> <a id="restored_plural_name-class_method"></a>
|
|
68
|
+
The name `name` had before the old normalizer trimmed a trailing "s" from a
|
|
69
|
+
level that is a name or a fixed plural. A level is restored when its plural
|
|
70
|
+
is:
|
|
71
|
+
* a name the tag's own nodes spell as one (AlchemyCMS, state_machines)
|
|
72
|
+
* something with an ending no plural has (cms, js, aas)
|
|
73
|
+
* a skip-list word as the last part of a hyphenated level (ruby-on-rails,
|
|
74
|
+
civil-rights), or an OS or *ops name (chromeos, mlops)
|
|
75
|
+
- **`@param`** `name` [String] tag name
|
|
76
|
+
- **`@param`** `contents` [Array<String>] content of the nodes carrying the tag
|
|
77
|
+
- **`@return`** [String] the restored name, or +name+ when nothing was trimmed
|
|
78
|
+
|
|
79
|
+
### `scope(prefix = nil)` <a id="method-c-scope"></a> <a id="scope-class_method"></a>
|
|
80
|
+
- **`@return`** [Sequel::Dataset] tags under +prefix+, or every tag when nil
|
|
81
|
+
|
|
82
|
+
### `skip_list_plural?(level)` <a id="method-c-skip_list_plural-3F"></a> <a id="skip_list_plural?-class_method"></a>
|
|
83
|
+
- **`@return`** [Boolean] whether +level+ is a skip-list word with its "s" trimmed
|
|
84
|
+
|
|
85
|
+
### `soft_delete_all(targets, counts, now)` <a id="method-c-soft_delete_all"></a> <a id="soft_delete_all-class_method"></a>
|
|
86
|
+
Soft delete the rows of each dataset of `targets` that `counts` says has any
|
|
87
|
+
- **`@param`** `targets` [Hash{Symbol => Sequel::Dataset}]
|
|
88
|
+
- **`@param`** `counts` [Hash{Symbol => Integer}] rows per target
|
|
89
|
+
- **`@param`** `now` [Time] the deleted_at stamp
|
|
90
|
+
- **`@return`** [Hash{Symbol => Integer}] rows soft-deleted per target
|
|
91
|
+
|
|
92
|
+
### `stale_node_tags()` <a id="method-c-stale_node_tags"></a> <a id="stale_node_tags-class_method"></a>
|
|
93
|
+
- **`@return`** [Sequel::Dataset] active node_tags rows whose node is soft-deleted or missing
|
|
94
|
+
|
|
95
|
+
### `svg(prefix = nil)` <a id="method-c-svg"></a> <a id="svg-class_method"></a>
|
|
96
|
+
Write the tags as an SVG diagram to tags.svg (see Console#svg)
|
|
97
|
+
|
|
98
|
+
### `title(prefix)` <a id="method-c-title"></a> <a id="title-class_method"></a>
|
|
99
|
+
- **`@return`** [String] the title for an SVG of +prefix+'s tags
|
|
100
|
+
|
|
101
|
+
### `tree(prefix = nil)` <a id="method-c-tree"></a> <a id="tree-class_method"></a>
|
|
102
|
+
Print the tag tree (see Console#tree)
|
|
103
|
+
|
|
104
|
+
### `tree_text(tags, prefix, count)` <a id="method-c-tree_text"></a> <a id="tree_text-class_method"></a>
|
|
105
|
+
- **`@return`** [String] the tag tree as text, with a heading and a total
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Module HTM::Admin::TagGraph <a id="module-HTM-Admin-TagGraph"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/tag_graph.rb |
|
|
6
|
+
|
|
7
|
+
`htm tags graph`: write an interactive force-directed graph of the nodes under
|
|
8
|
+
a tag prefix and the tag co-occurrence links between them (node_relationships,
|
|
9
|
+
written by GenerateRelationshipsJob) as one HTML file. The data and d3 are
|
|
10
|
+
embedded, so the file opens from disk.
|
|
11
|
+
|
|
12
|
+
Reading the database (graph_data) is kept apart from shaping the data (build,
|
|
13
|
+
branch_of, source_of, source_info) and writing the page (render), so each can
|
|
14
|
+
be tested on its own.
|
|
15
|
+
|
|
16
|
+
**`@example`**
|
|
17
|
+
```ruby
|
|
18
|
+
HTM::Admin::TagGraph.write("medicine", path: "medicine.html")
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Constants
|
|
22
|
+
### `CONTENT_CHARS` <a id="constant-CONTENT_CHARS"></a> <a id="CONTENT_CHARS-constant"></a>
|
|
23
|
+
Not documented.
|
|
24
|
+
|
|
25
|
+
### `D3_URL` <a id="constant-D3_URL"></a> <a id="D3_URL-constant"></a>
|
|
26
|
+
Not documented.
|
|
27
|
+
|
|
28
|
+
### `DEFAULT_PATH` <a id="constant-DEFAULT_PATH"></a> <a id="DEFAULT_PATH-constant"></a>
|
|
29
|
+
Not documented.
|
|
30
|
+
|
|
31
|
+
### `FALLBACK_BRANCH` <a id="constant-FALLBACK_BRANCH"></a> <a id="FALLBACK_BRANCH-constant"></a>
|
|
32
|
+
Not documented.
|
|
33
|
+
|
|
34
|
+
### `TEMPLATE` <a id="constant-TEMPLATE"></a> <a id="TEMPLATE-constant"></a>
|
|
35
|
+
Not documented.
|
|
36
|
+
|
|
37
|
+
## Public Class Methods
|
|
38
|
+
### `branch_of(tags, prefix)` <a id="method-c-branch_of"></a> <a id="branch_of-class_method"></a>
|
|
39
|
+
The branch a node sits in: the level just below `prefix` (the root level when
|
|
40
|
+
nil) that most of its tags pass through
|
|
41
|
+
- **`@param`** `tags` [Array<String>]
|
|
42
|
+
- **`@param`** `prefix` [String, nil]
|
|
43
|
+
- **`@return`** [String] the branch, or "general" when no tag goes below +prefix+
|
|
44
|
+
|
|
45
|
+
**`@example`**
|
|
46
|
+
```ruby
|
|
47
|
+
branch_of(%w[medicine medicine:genetics medicine:genetics:gata1], "medicine") # => "genetics"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### `build(rows, prefix: nil)` <a id="method-c-build"></a> <a id="build-class_method"></a>
|
|
51
|
+
Shape the rows graph_data reads into the page's data
|
|
52
|
+
- **`@param`** `rows` [Hash] graph_data's rows:
|
|
53
|
+
- nodes [Array<Hash>] rows with :id, :content, :source_id
|
|
54
|
+
- tags [Hash{Integer => Array<String>}]
|
|
55
|
+
- edges [Array<Array>] [source_id, target_id, weight]
|
|
56
|
+
- parents [Hash{Integer => Hash}] see parent_rows
|
|
57
|
+
- sources [Array<Hash>] file_sources rows
|
|
58
|
+
- **`@param`** `prefix` [String, nil]
|
|
59
|
+
- **`@return`** [Hash] { meta:, branches:, sources:, nodes:, edges: }
|
|
60
|
+
|
|
61
|
+
### `database_name()` <a id="method-c-database_name"></a> <a id="database_name-class_method"></a>
|
|
62
|
+
- **`@return`** [String] the connected database's name
|
|
63
|
+
|
|
64
|
+
### `default_title(prefix)` <a id="method-c-default_title"></a> <a id="default_title-class_method"></a>
|
|
65
|
+
- **`@return`** [String] "HTM memory graph: medicine" or "HTM memory graph"
|
|
66
|
+
|
|
67
|
+
### `download_d3_library(out: $stdout)` <a id="method-c-download_d3_library"></a> <a id="download_d3_library-class_method"></a>
|
|
68
|
+
Download d3 so the page works offline
|
|
69
|
+
- **`@return`** [String, nil] the library source, nil when it cannot be fetched
|
|
70
|
+
|
|
71
|
+
### `graph_data(prefix)` <a id="method-c-graph_data"></a> <a id="graph_data-class_method"></a>
|
|
72
|
+
Read the nodes under `prefix`, their tags, their sources and the links between
|
|
73
|
+
them
|
|
74
|
+
- **`@return`** [Hash] { nodes:, tags:, edges:, sources:, parents: } as plain rows
|
|
75
|
+
|
|
76
|
+
### `graph_node(row, rows, source_rows, prefix)` <a id="method-c-graph_node"></a> <a id="graph_node-class_method"></a>
|
|
77
|
+
One node as the page draws it
|
|
78
|
+
- **`@param`** `row` [Hash] nodes row with :id, :content, :epistemic_status, :source_id
|
|
79
|
+
- **`@param`** `rows` [Hash] graph_data's rows (for :tags and :parents)
|
|
80
|
+
- **`@param`** `source_rows` [Hash{Integer => Hash}] file_sources rows by id
|
|
81
|
+
- **`@param`** `prefix` [String, nil]
|
|
82
|
+
- **`@return`** [Hash] { id:, c: content, p: proposition?, s: source id, b: branch, t: tags }
|
|
83
|
+
|
|
84
|
+
### `lineage(rows)` <a id="method-c-lineage"></a> <a id="lineage-class_method"></a>
|
|
85
|
+
- **`@param`** `rows` [Array<Hash>] node rows with :id, :source_id
|
|
86
|
+
- **`@return`** [Hash{Integer => Hash}] id => { source_id:, parent: } for each row
|
|
87
|
+
|
|
88
|
+
### `missing_parents(links, known)` <a id="method-c-missing_parents"></a> <a id="missing_parents-class_method"></a>
|
|
89
|
+
- **`@param`** `links` [Array<Hash>] { source_id:, parent: } values of lineage
|
|
90
|
+
- **`@param`** `known` [Hash{Integer => Hash}] the lineage read so far
|
|
91
|
+
- **`@return`** [Array<Integer>] the parents +links+ name that +known+ lacks
|
|
92
|
+
|
|
93
|
+
### `node_tags(ids)` <a id="method-c-node_tags"></a> <a id="node_tags-class_method"></a>
|
|
94
|
+
- **`@return`** [Hash{Integer => Array<String>}] live tag names per node id
|
|
95
|
+
|
|
96
|
+
### `parent_rows(nodes, max_depth: 5)` <a id="method-c-parent_rows"></a> <a id="parent_rows-class_method"></a>
|
|
97
|
+
The source_id and parent of each node a proposition descends from that is not
|
|
98
|
+
itself in the graph, so propositions find their file
|
|
99
|
+
- **`@param`** `nodes` [Array<Hash>] rows with :id, :source_id
|
|
100
|
+
- **`@param`** `max_depth` [Integer] generations followed; proposition chains
|
|
101
|
+
are one level deep, so the cap only guards against cycles
|
|
102
|
+
- **`@return`** [Hash{Integer => Hash}] id => { source_id:, parent: }
|
|
103
|
+
|
|
104
|
+
### `proposition?(row)` <a id="method-c-proposition-3F"></a> <a id="proposition?-class_method"></a>
|
|
105
|
+
- **`@return`** [Boolean] whether a nodes row is a proposition (extracted, not a file chunk)
|
|
106
|
+
|
|
107
|
+
### `ranked(values)` <a id="method-c-ranked"></a> <a id="ranked-class_method"></a>
|
|
108
|
+
- **`@return`** [Array<String>] the distinct values, most frequent first (ties by name)
|
|
109
|
+
|
|
110
|
+
### `render(data, title:, database:, d3_js: nil, generated: Time.now)` <a id="method-c-render"></a> <a id="render-class_method"></a>
|
|
111
|
+
Fill the page template
|
|
112
|
+
- **`@param`** `data` [Hash] from build
|
|
113
|
+
- **`@param`** `title` [String]
|
|
114
|
+
- **`@param`** `database` [String]
|
|
115
|
+
- **`@param`** `d3_js` [String, nil] d3 source to embed; nil links the CDN copy
|
|
116
|
+
- **`@param`** `generated` [Time]
|
|
117
|
+
- **`@return`** [String] the HTML page
|
|
118
|
+
|
|
119
|
+
### `source_info(row)` <a id="method-c-source_info"></a> <a id="source_info-class_method"></a>
|
|
120
|
+
How the page names and links a file source, from its frontmatter
|
|
121
|
+
- **`@param`** `row` [Hash] file_sources row with :id, :file_path, :frontmatter
|
|
122
|
+
- **`@return`** [Hash] { id:, title:, url:, detail: }
|
|
123
|
+
|
|
124
|
+
### `source_node_ids(ids)` <a id="method-c-source_node_ids"></a> <a id="source_node_ids-class_method"></a>
|
|
125
|
+
- **`@param`** `ids` [Array<Integer>] node ids
|
|
126
|
+
- **`@return`** [Hash{Integer => Integer}] node id => the node it was derived from
|
|
127
|
+
|
|
128
|
+
### `source_of(id, parents)` <a id="method-c-source_of"></a> <a id="source_of-class_method"></a>
|
|
129
|
+
The file a node came from: its own source, or the source of the node it was
|
|
130
|
+
extracted from (propositions)
|
|
131
|
+
- **`@param`** `id` [Integer]
|
|
132
|
+
- **`@param`** `parents` [Hash{Integer => Hash}] id => { source_id:, parent: }
|
|
133
|
+
- **`@return`** [Integer, nil] file_sources id
|
|
134
|
+
|
|
135
|
+
### `tag_scope(prefix)` <a id="method-c-tag_scope"></a> <a id="tag_scope-class_method"></a>
|
|
136
|
+
- **`@return`** [Sequel::Dataset] live tags named +prefix+ or under it (all live tags when nil)
|
|
137
|
+
|
|
138
|
+
### `write(prefix = nil, path: DEFAULT_PATH, title: nil, d3_js: :fetch, out: $stdout)` <a id="method-c-write"></a> <a id="write-class_method"></a>
|
|
139
|
+
Write the graph page for the nodes under `prefix` (every tagged node when nil)
|
|
140
|
+
- **`@param`** `prefix` [String, nil] Tag prefix, e.g. "medicine"
|
|
141
|
+
- **`@param`** `path` [String] Output file
|
|
142
|
+
- **`@param`** `title` [String, nil] Page title; defaults to one naming the prefix
|
|
143
|
+
- **`@param`** `d3_js` [String, nil, Symbol] d3 source to embed; :fetch downloads it,
|
|
144
|
+
nil links the CDN copy instead (the page then needs a connection)
|
|
145
|
+
- **`@param`** `out` [IO]
|
|
146
|
+
- **`@return`** [String, nil] the path written, nil when no node matched
|
|
147
|
+
|
|
148
|
+
### `written_summary(path, data)` <a id="method-c-written_summary"></a> <a id="written_summary-class_method"></a>
|
|
149
|
+
- **`@return`** [Array<String>] the lines write reports once +data+ is written to +path+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Module HTM::Admin::YardDocs <a id="module-HTM-Admin-YardDocs"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin/yard_docs.rb |
|
|
6
|
+
|
|
7
|
+
HTM's own YARD API reference (docs/api/yard), as Markdown for MkDocs: the
|
|
8
|
+
logic behind `asgard doc yard`, `doc fix_anchors` and `doc clean`
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `DESCRIPTIONS` <a id="constant-DESCRIPTIONS"></a> <a id="DESCRIPTIONS-constant"></a>
|
|
12
|
+
Descriptions for the classes listed on the index page
|
|
13
|
+
|
|
14
|
+
### `INDEX_PAGE` <a id="constant-INDEX_PAGE"></a> <a id="INDEX_PAGE-constant"></a>
|
|
15
|
+
Not documented.
|
|
16
|
+
|
|
17
|
+
### `OUTPUT_DIR` <a id="constant-OUTPUT_DIR"></a> <a id="OUTPUT_DIR-constant"></a>
|
|
18
|
+
Not documented.
|
|
19
|
+
|
|
20
|
+
### `YARD_OPTIONS` <a id="constant-YARD_OPTIONS"></a> <a id="YARD_OPTIONS-constant"></a>
|
|
21
|
+
Not documented.
|
|
22
|
+
|
|
23
|
+
### `YARD_TAGS` <a id="constant-YARD_TAGS"></a> <a id="YARD_TAGS-constant"></a>
|
|
24
|
+
YARD tags escaped so pymdownx.magiclink does not link them as @mentions
|
|
25
|
+
|
|
26
|
+
## Public Class Methods
|
|
27
|
+
### `anchor_fixes()` <a id="method-c-anchor_fixes"></a> <a id="anchor_fixes-class_method"></a>
|
|
28
|
+
The heading-anchor rewrites fix_content applies, in order
|
|
29
|
+
- **`@return`** [Array<Array(Regexp, String)>] [pattern, gsub replacement]
|
|
30
|
+
|
|
31
|
+
### `build(output_dir: OUTPUT_DIR, index_path: INDEX_PAGE, out: $stdout, runner: method(:system))` <a id="method-c-build"></a> <a id="build-class_method"></a>
|
|
32
|
+
Run YARD into `output_dir`, then fix it up for MkDocs and write the index page
|
|
33
|
+
- **`@return`** [Hash, nil] fix_anchors' totals, nil when YARD failed
|
|
34
|
+
|
|
35
|
+
### `classes(output_dir = OUTPUT_DIR)` <a id="method-c-classes"></a> <a id="classes-class_method"></a>
|
|
36
|
+
Class pages YARD wrote under `output_dir`, as [name, description, link]
|
|
37
|
+
- **`@return`** [Array<Array(String, String, String)>]
|
|
38
|
+
|
|
39
|
+
### `clean(paths = [OUTPUT_DIR, ".yardoc", INDEX_PAGE], out: $stdout)` <a id="method-c-clean"></a> <a id="clean-class_method"></a>
|
|
40
|
+
Remove the generated YARD output
|
|
41
|
+
- **`@return`** [Array<String>] the paths removed
|
|
42
|
+
|
|
43
|
+
### `fix_anchors(output_dir = OUTPUT_DIR)` <a id="method-c-fix_anchors"></a> <a id="fix_anchors-class_method"></a>
|
|
44
|
+
Apply fix_content to every page under `output_dir`
|
|
45
|
+
- **`@return`** [Hash] { files:, anchors:, tags: } changed
|
|
46
|
+
|
|
47
|
+
### `fix_content(content)` <a id="method-c-fix_content"></a> <a id="fix_content-class_method"></a>
|
|
48
|
+
Rewrite YARD's Markdown for MkDocs: heading anchors become attribute lists
|
|
49
|
+
("## m() [](#a)" -> "## m() {: #a }") and **@tag** becomes **`@tag`**
|
|
50
|
+
- **`@param`** `content` [String] One YARD Markdown page
|
|
51
|
+
- **`@return`** [Array(String, Integer, Integer)] new content, anchors fixed, tags escaped
|
|
52
|
+
|
|
53
|
+
### `fix_notes(totals)` <a id="method-c-fix_notes"></a> <a id="fix_notes-class_method"></a>
|
|
54
|
+
- **`@return`** [Array<String>] build's report on what fix_anchors changed, when it changed anything
|
|
55
|
+
|
|
56
|
+
### `index_page(classes)` <a id="method-c-index_page"></a> <a id="index_page-class_method"></a>
|
|
57
|
+
- **`@return`** [String] the MkDocs page listing +classes+
|
|
58
|
+
|
|
59
|
+
### `yard_command(output_dir = OUTPUT_DIR)` <a id="method-c-yard_command"></a> <a id="yard_command-class_method"></a>
|
|
60
|
+
- **`@return`** [String] the `yard doc` command line writing into +output_dir+
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Module HTM::Admin <a id="module-HTM-Admin"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/admin.rb, lib/htm/admin/tag_graph.rb, lib/htm/admin/yard_docs.rb, lib/htm/admin/tag_commands.rb, lib/htm/admin/file_commands.rb, lib/htm/admin/enrich_commands.rb, lib/htm/admin/memory_commands.rb, lib/htm/admin/database_commands.rb, lib/htm/admin/memory_commands/edit.rb, lib/htm/admin/memory_commands/search.rb, lib/htm/admin/memory_commands/tag_search.rb, lib/htm/admin/memory_commands/working_memory.rb |
|
|
6
|
+
|
|
7
|
+
Operational commands behind the htm command line (lib/htm/cli/*.rb).
|
|
8
|
+
|
|
9
|
+
Each command is a thin wrapper that parses its arguments and calls one method
|
|
10
|
+
here. The methods write their report to `out` and read any confirmation from
|
|
11
|
+
`input`, so they run the same from the command line, a console or a test.
|
|
12
|
+
|
|
13
|
+
**`@example`**
|
|
14
|
+
```ruby
|
|
15
|
+
require "htm/admin"
|
|
16
|
+
HTM::Admin::DatabaseCommands.stats
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Constants
|
|
20
|
+
### `PROGRESS_FORMAT` <a id="constant-PROGRESS_FORMAT"></a> <a id="PROGRESS_FORMAT-constant"></a>
|
|
21
|
+
Not documented.
|
|
22
|
+
|
|
23
|
+
## Public Class Methods
|
|
24
|
+
### `aborted(out)` <a id="method-c-aborted"></a> <a id="aborted-class_method"></a>
|
|
25
|
+
Report an aborted command
|
|
26
|
+
- **`@param`** `out` [IO]
|
|
27
|
+
- **`@return`** [nil]
|
|
28
|
+
|
|
29
|
+
### `cancelled(out)` <a id="method-c-cancelled"></a> <a id="cancelled-class_method"></a>
|
|
30
|
+
Report a cancelled command
|
|
31
|
+
- **`@param`** `out` [IO]
|
|
32
|
+
- **`@return`** [nil]
|
|
33
|
+
|
|
34
|
+
### `confirmed?(prompt, input: $stdin, out: $stdout)` <a id="method-c-confirmed-3F"></a> <a id="confirmed?-class_method"></a>
|
|
35
|
+
Print `prompt` and read one line; true only when the answer is "yes"
|
|
36
|
+
- **`@param`** `prompt` [String]
|
|
37
|
+
- **`@param`** `input` [IO] Where the answer is read from
|
|
38
|
+
- **`@param`** `out` [IO] Where the prompt is written
|
|
39
|
+
- **`@return`** [Boolean]
|
|
40
|
+
|
|
41
|
+
### `connect!()` <a id="method-c-connect-21"></a> <a id="connect!-class_method"></a>
|
|
42
|
+
Connect to the configured HTM database (no-op when already connected)
|
|
43
|
+
|
|
44
|
+
### `each_by_id(dataset, batch_size: 100)` <a id="method-c-each_by_id"></a> <a id="each_by_id-class_method"></a>
|
|
45
|
+
Yield each record of `dataset` in id order, fetching `batch_size` at a time by
|
|
46
|
+
keyset (id > last id seen).
|
|
47
|
+
|
|
48
|
+
Not Sequel's paged_each: that holds one transaction open for the whole loop,
|
|
49
|
+
so hours of LLM enrichment stayed uncommitted (and rolled back on any crash).
|
|
50
|
+
Keyset paging also survives a block that removes records from `dataset`
|
|
51
|
+
(filling in the very column it filters on), which OFFSET paging would skip.
|
|
52
|
+
- **`@param`** `dataset` [Sequel::Dataset] a dataset of rows with an +id+ column
|
|
53
|
+
- **`@param`** `batch_size` [Integer]
|
|
54
|
+
- **`@return`** [void]
|
|
55
|
+
- **`@yieldparam`** `record` [Sequel::Model]
|
|
56
|
+
|
|
57
|
+
### `each_with_progress(dataset, title, out: $stdout)` <a id="method-c-each_with_progress"></a> <a id="each_with_progress-class_method"></a>
|
|
58
|
+
Yield each record of `dataset` under a ruby-progressbar bar with an ETA. A
|
|
59
|
+
record whose block raises is counted as failed and logged on the bar; the rest
|
|
60
|
+
carry on. Each record's changes commit as the block finishes them (see
|
|
61
|
+
each_by_id).
|
|
62
|
+
- **`@param`** `dataset` [Sequel::Dataset]
|
|
63
|
+
- **`@param`** `title` [String] Progress bar title
|
|
64
|
+
- **`@param`** `out` [IO]
|
|
65
|
+
- **`@return`** [Hash] { ok: Integer, failed: Integer }
|
|
66
|
+
- **`@yieldparam`** `record` [Sequel::Model]
|
|
67
|
+
- **`@yieldparam`** `bar` [ProgressBar::Base] For warnings (bar.log)
|
|
68
|
+
|
|
69
|
+
### `embed!(node)` <a id="method-c-embed-21"></a> <a id="embed!-class_method"></a>
|
|
70
|
+
Generate and store `node`'s embedding
|
|
71
|
+
- **`@param`** `node` [HTM::Models::Node]
|
|
72
|
+
- **`@return`** [HTM::Models::Node]
|
|
73
|
+
|
|
74
|
+
### `extract_propositions!(node, robot, warn: ->(_message) {})` <a id="method-c-extract_propositions-21"></a> <a id="extract_propositions!-class_method"></a>
|
|
75
|
+
Extract `node`'s propositions and store each as a proposition node linked to
|
|
76
|
+
`robot`, with its own embedding. An embedding failure is reported through
|
|
77
|
+
`warn` and does not stop the rest.
|
|
78
|
+
- **`@param`** `node` [HTM::Models::Node] The source node
|
|
79
|
+
- **`@param`** `robot` [HTM::Models::Robot] Robot the proposition nodes are linked to
|
|
80
|
+
- **`@param`** `warn` [#call] Receives a warning message
|
|
81
|
+
- **`@return`** [Integer] Proposition nodes created
|
|
82
|
+
|
|
83
|
+
### `percentage(part, whole)` <a id="method-c-percentage"></a> <a id="percentage-class_method"></a>
|
|
84
|
+
- **`@return`** [Float, Integer] +part+ as a percentage of +whole+ (one decimal), 0 when +whole+ is zero
|
|
85
|
+
|
|
86
|
+
### `print_counts(title, counts, out: $stdout)` <a id="method-c-print_counts"></a> <a id="print_counts-class_method"></a>
|
|
87
|
+
Print `title`, then one indented "Label: value" line per entry of `counts`
|
|
88
|
+
- **`@param`** `title` [String]
|
|
89
|
+
- **`@param`** `counts` [Hash{String => Object}] label => value, printed in order
|
|
90
|
+
- **`@param`** `out` [IO]
|
|
91
|
+
- **`@return`** [void]
|
|
92
|
+
|
|
93
|
+
### `proposition_robot(name)` <a id="method-c-proposition_robot"></a> <a id="proposition_robot-class_method"></a>
|
|
94
|
+
The robot proposition nodes are linked to: the first robot, or a new one named
|
|
95
|
+
`name`
|
|
96
|
+
|
|
97
|
+
### `say(out, line)` <a id="method-c-say"></a> <a id="say-class_method"></a>
|
|
98
|
+
Write `line` to `out`
|
|
99
|
+
- **`@return`** [nil]
|
|
100
|
+
|
|
101
|
+
### `time_ago(time, now: Time.now)` <a id="method-c-time_ago"></a> <a id="time_ago-class_method"></a>
|
|
102
|
+
- **`@return`** [String] How long before +now+ +time+ was, e.g. "3 hours ago"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# Class HTM::AuthorizationError <a id="class-HTM-AuthorizationError"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Inherits** | [HTM::Error](Error.md) |
|
|
6
|
+
| **Defined in** | lib/htm/errors.rb |
|
|
4
7
|
|
|
5
8
|
Raised when an operation is not authorized
|
|
6
9
|
|
|
7
10
|
Reserved for future multi-tenant scenarios where access control may restrict
|
|
8
11
|
certain operations.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Module HTM::CLI::ConfigFile <a id="module-HTM-CLI-ConfigFile"></a>
|
|
2
|
+
|
|
3
|
+
| | |
|
|
4
|
+
| --- | --- |
|
|
5
|
+
| **Defined in** | lib/htm/cli/config_file.rb |
|
|
6
|
+
|
|
7
|
+
Applies a YAML config file (the -c/--config option) to HTM.config: its
|
|
8
|
+
defaults section merged with the current environment's section.
|
|
9
|
+
|
|
10
|
+
## Constants
|
|
11
|
+
### `SECTIONS` <a id="constant-SECTIONS"></a> <a id="SECTIONS-constant"></a>
|
|
12
|
+
Nested config sections a config file may set
|
|
13
|
+
|
|
14
|
+
## Public Class Methods
|
|
15
|
+
### `apply(config)` <a id="method-c-apply"></a> <a id="apply-class_method"></a>
|
|
16
|
+
Not documented.
|
|
17
|
+
|
|
18
|
+
### `apply_scalars(htm_config, config)` <a id="method-c-apply_scalars"></a> <a id="apply_scalars-class_method"></a>
|
|
19
|
+
Top-level settings: week_start, connection_timeout and log_level when given,
|
|
20
|
+
telemetry_enabled when not nil (false turns it off)
|
|
21
|
+
|
|
22
|
+
### `apply_section(htm_config, name, values)` <a id="method-c-apply_section"></a> <a id="apply_section-class_method"></a>
|
|
23
|
+
Not documented.
|
|
24
|
+
|
|
25
|
+
### `assign_values(target, values)` <a id="method-c-assign_values"></a> <a id="assign_values-class_method"></a>
|
|
26
|
+
Call target.key = value for each non-nil value
|
|
27
|
+
|
|
28
|
+
### `deep_merge(base, override)` <a id="method-c-deep_merge"></a> <a id="deep_merge-class_method"></a>
|
|
29
|
+
Not documented.
|
|
30
|
+
|
|
31
|
+
### `for_env(data, env)` <a id="method-c-for_env"></a> <a id="for_env-class_method"></a>
|
|
32
|
+
The defaults section merged with the environment's overrides
|
|
33
|
+
|
|
34
|
+
### `load(path)` <a id="method-c-load"></a> <a id="load-class_method"></a>
|
|
35
|
+
Apply the file at `path` once; later calls with the same path do nothing
|
|
36
|
+
- **`@param`** `path` [String]
|
|
37
|
+
- **`@return`** [void]
|
|
38
|
+
|
|
39
|
+
### `read(path)` <a id="method-c-read"></a> <a id="read-class_method"></a>
|
|
40
|
+
A YAML config file as a symbol-keyed hash (empty when the file is)
|