@harperfast/harper 5.0.30 → 5.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -10
- package/agent/agent.ts +203 -0
- package/agent/loop.ts +205 -0
- package/agent/operations.ts +148 -0
- package/agent/session.ts +187 -0
- package/agent/tools/fsTools.ts +276 -0
- package/agent/tools/httpFetchTool.ts +112 -0
- package/agent/tools/scheduleTool.ts +68 -0
- package/agent/toolset.ts +43 -0
- package/agent/types.ts +85 -0
- package/bin/{BinObjects.js → BinObjects.ts} +4 -5
- package/bin/cliCredentials.ts +133 -0
- package/bin/cliOperations.ts +339 -0
- package/bin/copyDb.ts +10 -10
- package/bin/deployRenderer.ts +196 -0
- package/bin/{harper.js → harper.ts} +43 -19
- package/bin/{install.js → install.ts} +3 -3
- package/bin/lite.ts +2 -0
- package/bin/login.ts +134 -0
- package/bin/logout.ts +11 -0
- package/bin/mcp/client.ts +407 -0
- package/bin/mcp/doctor.ts +189 -0
- package/bin/mcp/index.ts +80 -0
- package/bin/mcp/options.ts +122 -0
- package/bin/mcp/printConfig.ts +89 -0
- package/bin/multipartBuilder.ts +74 -0
- package/bin/{restart.js → restart.ts} +27 -28
- package/bin/{run.js → run.ts} +41 -30
- package/bin/sseConsumer.ts +126 -0
- package/bin/{status.js → status.ts} +10 -10
- package/bin/{stop.js → stop.ts} +5 -5
- package/bin/upgrade.js +17 -24
- package/components/Application.ts +144 -18
- package/components/ApplicationScope.ts +2 -2
- package/components/ComponentV1.ts +2 -2
- package/components/EntryHandler.ts +159 -9
- package/components/OptionsWatcher.ts +75 -11
- package/components/Scope.ts +132 -18
- package/components/anthropic/index.ts +547 -0
- package/components/bedrock/index.ts +823 -0
- package/components/componentLoader.ts +64 -32
- package/components/deployLifecycle.ts +161 -0
- package/components/deploymentOperations.ts +173 -0
- package/components/deploymentRecorder.ts +427 -0
- package/components/deriveURLPath.ts +4 -4
- package/components/mcp/adapters/fastify.ts +87 -0
- package/components/mcp/adapters/harperHttp.ts +103 -0
- package/components/mcp/audit.ts +75 -0
- package/components/mcp/index.ts +134 -0
- package/components/mcp/jsonrpc.ts +134 -0
- package/components/mcp/lifecycle.ts +105 -0
- package/components/mcp/listChanged.ts +270 -0
- package/components/mcp/rateLimit.ts +217 -0
- package/components/mcp/resources.ts +607 -0
- package/components/mcp/session.ts +151 -0
- package/components/mcp/sessionRegistry.ts +140 -0
- package/components/mcp/toolRegistry.ts +294 -0
- package/components/mcp/tools/application.ts +761 -0
- package/components/mcp/tools/operations.ts +311 -0
- package/components/mcp/tools/schemas/derive.ts +356 -0
- package/components/mcp/tools/schemas/operationDescriptions.ts +241 -0
- package/components/mcp/tools/schemas/operations.ts +301 -0
- package/components/mcp/transport.ts +517 -0
- package/components/ollama/index.ts +316 -0
- package/components/openai/index.ts +563 -0
- package/components/operations.js +217 -60
- package/components/operationsValidation.js +12 -4
- package/components/packageComponent.ts +97 -29
- package/components/requestRestart.ts +17 -2
- package/components/status/crossThread.ts +14 -5
- package/components/status/errors.ts +1 -1
- package/config/RootConfigWatcher.ts +56 -2
- package/config/configUtils.js +29 -8
- package/config/harperConfigEnvVars.ts +1 -1
- package/config-root.schema.json +78 -4
- package/dataLayer/{CreateAttributeObject.js → CreateAttributeObject.ts} +4 -3
- package/dataLayer/{CreateTableObject.js → CreateTableObject.ts} +2 -1
- package/dataLayer/{DataLayerObjects.js → DataLayerObjects.ts} +17 -9
- package/dataLayer/{DeleteBeforeObject.js → DeleteBeforeObject.ts} +2 -1
- package/dataLayer/{DeleteObject.js → DeleteObject.ts} +3 -2
- package/dataLayer/{DropAttributeObject.js → DropAttributeObject.ts} +2 -1
- package/dataLayer/{GetBackupObject.js → GetBackupObject.ts} +3 -2
- package/dataLayer/{InsertObject.js → InsertObject.ts} +3 -2
- package/dataLayer/{ReadAuditLogObject.js → ReadAuditLogObject.ts} +3 -2
- package/dataLayer/{SQLSearch.js → SQLSearch.ts} +97 -43
- package/dataLayer/{SearchByConditionsObject.js → SearchByConditionsObject.ts} +5 -6
- package/dataLayer/{SearchByHashObject.js → SearchByHashObject.ts} +2 -1
- package/dataLayer/{SearchObject.js → SearchObject.ts} +2 -1
- package/dataLayer/{SqlSearchObject.js → SqlSearchObject.ts} +2 -1
- package/dataLayer/{UpdateObject.js → UpdateObject.ts} +3 -2
- package/dataLayer/{UpsertObject.js → UpsertObject.ts} +3 -2
- package/dataLayer/{bulkLoad.js → bulkLoad.ts} +40 -49
- package/dataLayer/{delete.js → delete.ts} +21 -26
- package/dataLayer/{export.js → export.ts} +22 -26
- package/dataLayer/{getBackup.js → getBackup.ts} +7 -9
- package/dataLayer/harperBridge/BridgeMethods.ts +102 -0
- package/dataLayer/harperBridge/ResourceBridge.ts +27 -26
- package/dataLayer/harperBridge/TableSizeObject.ts +1 -0
- package/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
- package/dataLayer/harperBridge/{harperBridge.js → harperBridge.ts} +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +8 -6
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +6 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +6 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +3 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +10 -8
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +4 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +6 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +2 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +3 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +5 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +6 -3
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.ts +1 -1
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
- package/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
- package/dataLayer/{hdbInfoController.js → hdbInfoController.ts} +20 -26
- package/dataLayer/{insert.js → insert.ts} +24 -24
- package/dataLayer/{readAuditLog.js → readAuditLog.ts} +8 -10
- package/dataLayer/{schema.js → schema.ts} +32 -44
- package/dataLayer/{schemaDescribe.js → schemaDescribe.ts} +23 -26
- package/dataLayer/{search.js → search.ts} +9 -15
- package/dataLayer/{transaction.js → transaction.ts} +2 -5
- package/dataLayer/{update.js → update.ts} +19 -22
- package/dist/agent/agent.d.ts +35 -0
- package/dist/agent/agent.js +175 -0
- package/dist/agent/agent.js.map +1 -0
- package/dist/agent/loop.d.ts +34 -0
- package/dist/agent/loop.js +176 -0
- package/dist/agent/loop.js.map +1 -0
- package/dist/agent/operations.d.ts +17 -0
- package/dist/agent/operations.js +137 -0
- package/dist/agent/operations.js.map +1 -0
- package/dist/agent/session.d.ts +36 -0
- package/dist/agent/session.js +182 -0
- package/dist/agent/session.js.map +1 -0
- package/dist/agent/tools/fsTools.d.ts +19 -0
- package/dist/agent/tools/fsTools.js +286 -0
- package/dist/agent/tools/fsTools.js.map +1 -0
- package/dist/agent/tools/httpFetchTool.d.ts +9 -0
- package/dist/agent/tools/httpFetchTool.js +116 -0
- package/dist/agent/tools/httpFetchTool.js.map +1 -0
- package/dist/agent/tools/scheduleTool.d.ts +22 -0
- package/dist/agent/tools/scheduleTool.js +54 -0
- package/dist/agent/tools/scheduleTool.js.map +1 -0
- package/dist/agent/toolset.d.ts +24 -0
- package/dist/agent/toolset.js +33 -0
- package/dist/agent/toolset.js.map +1 -0
- package/dist/agent/types.d.ts +75 -0
- package/dist/agent/types.js +10 -0
- package/dist/agent/types.js.map +1 -0
- package/dist/bin/BinObjects.d.ts +2 -2
- package/dist/bin/BinObjects.js +6 -3
- package/dist/bin/BinObjects.js.map +1 -1
- package/dist/bin/cliCredentials.d.ts +27 -0
- package/dist/bin/cliCredentials.js +130 -0
- package/dist/bin/cliCredentials.js.map +1 -0
- package/dist/bin/cliOperations.d.ts +7 -7
- package/dist/bin/cliOperations.js +251 -37
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/copyDb.js +16 -16
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/bin/deployRenderer.d.ts +47 -0
- package/dist/bin/deployRenderer.js +185 -0
- package/dist/bin/deployRenderer.js.map +1 -0
- package/dist/bin/harper.d.ts +2 -1
- package/dist/bin/harper.js +87 -26
- package/dist/bin/harper.js.map +1 -1
- package/dist/bin/install.d.ts +1 -1
- package/dist/bin/install.js +41 -4
- package/dist/bin/install.js.map +1 -1
- package/dist/bin/lite.js +3 -4
- package/dist/bin/lite.js.map +1 -1
- package/dist/bin/login.d.ts +4 -0
- package/dist/bin/login.js +123 -0
- package/dist/bin/login.js.map +1 -0
- package/dist/bin/logout.d.ts +4 -0
- package/dist/bin/logout.js +16 -0
- package/dist/bin/logout.js.map +1 -0
- package/dist/bin/mcp/client.d.ts +34 -0
- package/dist/bin/mcp/client.js +395 -0
- package/dist/bin/mcp/client.js.map +1 -0
- package/dist/bin/mcp/doctor.d.ts +11 -0
- package/dist/bin/mcp/doctor.js +193 -0
- package/dist/bin/mcp/doctor.js.map +1 -0
- package/dist/bin/mcp/index.d.ts +10 -0
- package/dist/bin/mcp/index.js +81 -0
- package/dist/bin/mcp/index.js.map +1 -0
- package/dist/bin/mcp/options.d.ts +33 -0
- package/dist/bin/mcp/options.js +113 -0
- package/dist/bin/mcp/options.js.map +1 -0
- package/dist/bin/mcp/printConfig.d.ts +14 -0
- package/dist/bin/mcp/printConfig.js +85 -0
- package/dist/bin/mcp/printConfig.js.map +1 -0
- package/dist/bin/multipartBuilder.d.ts +26 -0
- package/dist/bin/multipartBuilder.js +55 -0
- package/dist/bin/multipartBuilder.js.map +1 -0
- package/dist/bin/restart.d.ts +3 -2
- package/dist/bin/restart.js +82 -45
- package/dist/bin/restart.js.map +1 -1
- package/dist/bin/run.d.ts +13 -9
- package/dist/bin/run.js +111 -65
- package/dist/bin/run.js.map +1 -1
- package/dist/bin/sseConsumer.d.ts +24 -0
- package/dist/bin/sseConsumer.js +127 -0
- package/dist/bin/sseConsumer.js.map +1 -0
- package/dist/bin/status.d.ts +1 -1
- package/dist/bin/status.js +48 -11
- package/dist/bin/status.js.map +1 -1
- package/dist/bin/stop.d.ts +1 -1
- package/dist/bin/stop.js +43 -6
- package/dist/bin/stop.js.map +1 -1
- package/dist/bin/upgrade.js +14 -22
- package/dist/bin/upgrade.js.map +1 -1
- package/dist/components/Application.d.ts +29 -17
- package/dist/components/Application.js +134 -28
- package/dist/components/Application.js.map +1 -1
- package/dist/components/ApplicationScope.js +2 -2
- package/dist/components/ComponentV1.d.ts +1 -1
- package/dist/components/ComponentV1.js +5 -5
- package/dist/components/ComponentV1.js.map +1 -1
- package/dist/components/EntryHandler.d.ts +26 -3
- package/dist/components/EntryHandler.js +153 -13
- package/dist/components/EntryHandler.js.map +1 -1
- package/dist/components/OptionsWatcher.d.ts +7 -2
- package/dist/components/OptionsWatcher.js +72 -10
- package/dist/components/OptionsWatcher.js.map +1 -1
- package/dist/components/Scope.d.ts +11 -6
- package/dist/components/Scope.js +112 -12
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/anthropic/index.d.ts +40 -0
- package/dist/components/anthropic/index.js +428 -0
- package/dist/components/anthropic/index.js.map +1 -0
- package/dist/components/bedrock/index.d.ts +79 -0
- package/dist/components/bedrock/index.js +734 -0
- package/dist/components/bedrock/index.js.map +1 -0
- package/dist/components/componentLoader.d.ts +29 -0
- package/dist/components/componentLoader.js +65 -38
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/deployLifecycle.d.ts +39 -0
- package/dist/components/deployLifecycle.js +156 -0
- package/dist/components/deployLifecycle.js.map +1 -0
- package/dist/components/deploymentOperations.d.ts +19 -0
- package/dist/components/deploymentOperations.js +185 -0
- package/dist/components/deploymentOperations.js.map +1 -0
- package/dist/components/deploymentRecorder.d.ts +97 -0
- package/dist/components/deploymentRecorder.js +425 -0
- package/dist/components/deploymentRecorder.js.map +1 -0
- package/dist/components/deriveURLPath.d.ts +2 -2
- package/dist/components/deriveURLPath.js +2 -2
- package/dist/components/deriveURLPath.js.map +1 -1
- package/dist/components/mcp/adapters/fastify.d.ts +35 -0
- package/dist/components/mcp/adapters/fastify.js +66 -0
- package/dist/components/mcp/adapters/fastify.js.map +1 -0
- package/dist/components/mcp/adapters/harperHttp.d.ts +38 -0
- package/dist/components/mcp/adapters/harperHttp.js +78 -0
- package/dist/components/mcp/adapters/harperHttp.js.map +1 -0
- package/dist/components/mcp/audit.d.ts +27 -0
- package/dist/components/mcp/audit.js +73 -0
- package/dist/components/mcp/audit.js.map +1 -0
- package/dist/components/mcp/index.d.ts +47 -0
- package/dist/components/mcp/index.js +109 -0
- package/dist/components/mcp/index.js.map +1 -0
- package/dist/components/mcp/jsonrpc.d.ts +71 -0
- package/dist/components/mcp/jsonrpc.js +93 -0
- package/dist/components/mcp/jsonrpc.js.map +1 -0
- package/dist/components/mcp/lifecycle.d.ts +69 -0
- package/dist/components/mcp/lifecycle.js +79 -0
- package/dist/components/mcp/lifecycle.js.map +1 -0
- package/dist/components/mcp/listChanged.d.ts +24 -0
- package/dist/components/mcp/listChanged.js +257 -0
- package/dist/components/mcp/listChanged.js.map +1 -0
- package/dist/components/mcp/rateLimit.d.ts +25 -0
- package/dist/components/mcp/rateLimit.js +226 -0
- package/dist/components/mcp/rateLimit.js.map +1 -0
- package/dist/components/mcp/resources.d.ts +90 -0
- package/dist/components/mcp/resources.js +526 -0
- package/dist/components/mcp/resources.js.map +1 -0
- package/dist/components/mcp/session.d.ts +36 -0
- package/dist/components/mcp/session.js +170 -0
- package/dist/components/mcp/session.js.map +1 -0
- package/dist/components/mcp/sessionRegistry.d.ts +63 -0
- package/dist/components/mcp/sessionRegistry.js +124 -0
- package/dist/components/mcp/sessionRegistry.js.map +1 -0
- package/dist/components/mcp/toolRegistry.d.ts +151 -0
- package/dist/components/mcp/toolRegistry.js +177 -0
- package/dist/components/mcp/toolRegistry.js.map +1 -0
- package/dist/components/mcp/tools/application.d.ts +72 -0
- package/dist/components/mcp/tools/application.js +660 -0
- package/dist/components/mcp/tools/application.js.map +1 -0
- package/dist/components/mcp/tools/operations.d.ts +23 -0
- package/dist/components/mcp/tools/operations.js +331 -0
- package/dist/components/mcp/tools/operations.js.map +1 -0
- package/dist/components/mcp/tools/schemas/derive.d.ts +50 -0
- package/dist/components/mcp/tools/schemas/derive.js +291 -0
- package/dist/components/mcp/tools/schemas/derive.js.map +1 -0
- package/dist/components/mcp/tools/schemas/operationDescriptions.d.ts +32 -0
- package/dist/components/mcp/tools/schemas/operationDescriptions.js +179 -0
- package/dist/components/mcp/tools/schemas/operationDescriptions.js.map +1 -0
- package/dist/components/mcp/tools/schemas/operations.d.ts +27 -0
- package/dist/components/mcp/tools/schemas/operations.js +299 -0
- package/dist/components/mcp/tools/schemas/operations.js.map +1 -0
- package/dist/components/mcp/transport.d.ts +38 -0
- package/dist/components/mcp/transport.js +467 -0
- package/dist/components/mcp/transport.js.map +1 -0
- package/dist/components/ollama/index.d.ts +46 -0
- package/dist/components/ollama/index.js +239 -0
- package/dist/components/ollama/index.js.map +1 -0
- package/dist/components/openai/index.d.ts +51 -0
- package/dist/components/openai/index.js +475 -0
- package/dist/components/openai/index.js.map +1 -0
- package/dist/components/operations.d.ts +6 -6
- package/dist/components/operations.js +205 -52
- package/dist/components/operations.js.map +1 -1
- package/dist/components/operationsValidation.d.ts +2 -2
- package/dist/components/operationsValidation.js +13 -4
- package/dist/components/operationsValidation.js.map +1 -1
- package/dist/components/packageComponent.d.ts +28 -6
- package/dist/components/packageComponent.js +87 -26
- package/dist/components/packageComponent.js.map +1 -1
- package/dist/components/requestRestart.d.ts +1 -0
- package/dist/components/requestRestart.js +12 -1
- package/dist/components/requestRestart.js.map +1 -1
- package/dist/components/status/crossThread.d.ts +5 -1
- package/dist/components/status/crossThread.js +12 -5
- package/dist/components/status/crossThread.js.map +1 -1
- package/dist/components/status/errors.js +7 -7
- package/dist/config/RootConfigWatcher.d.ts +3 -0
- package/dist/config/RootConfigWatcher.js +52 -1
- package/dist/config/RootConfigWatcher.js.map +1 -1
- package/dist/config/configUtils.js +31 -8
- package/dist/config/configUtils.js.map +1 -1
- package/dist/config/harperConfigEnvVars.js +1 -1
- package/dist/config/harperConfigEnvVars.js.map +1 -1
- package/dist/dataLayer/CreateAttributeObject.d.ts +3 -7
- package/dist/dataLayer/CreateAttributeObject.js +4 -3
- package/dist/dataLayer/CreateAttributeObject.js.map +1 -1
- package/dist/dataLayer/CreateTableObject.d.ts +2 -4
- package/dist/dataLayer/CreateTableObject.js +2 -1
- package/dist/dataLayer/CreateTableObject.js.map +1 -1
- package/dist/dataLayer/DataLayerObjects.d.ts +17 -16
- package/dist/dataLayer/DataLayerObjects.js +19 -5
- package/dist/dataLayer/DataLayerObjects.js.map +1 -1
- package/dist/dataLayer/DeleteBeforeObject.d.ts +3 -5
- package/dist/dataLayer/DeleteBeforeObject.js +2 -1
- package/dist/dataLayer/DeleteBeforeObject.js.map +1 -1
- package/dist/dataLayer/DeleteObject.d.ts +3 -7
- package/dist/dataLayer/DeleteObject.js +4 -3
- package/dist/dataLayer/DeleteObject.js.map +1 -1
- package/dist/dataLayer/DropAttributeObject.d.ts +2 -4
- package/dist/dataLayer/DropAttributeObject.js +2 -1
- package/dist/dataLayer/DropAttributeObject.js.map +1 -1
- package/dist/dataLayer/GetBackupObject.d.ts +3 -5
- package/dist/dataLayer/GetBackupObject.js +4 -3
- package/dist/dataLayer/GetBackupObject.js.map +1 -1
- package/dist/dataLayer/InsertObject.d.ts +3 -8
- package/dist/dataLayer/InsertObject.js +4 -3
- package/dist/dataLayer/InsertObject.js.map +1 -1
- package/dist/dataLayer/ReadAuditLogObject.d.ts +3 -7
- package/dist/dataLayer/ReadAuditLogObject.js +4 -3
- package/dist/dataLayer/ReadAuditLogObject.js.map +1 -1
- package/dist/dataLayer/SQLSearch.d.ts +68 -38
- package/dist/dataLayer/SQLSearch.js +140 -78
- package/dist/dataLayer/SQLSearch.js.map +1 -1
- package/dist/dataLayer/SearchByConditionsObject.d.ts +10 -58
- package/dist/dataLayer/SearchByConditionsObject.js +5 -7
- package/dist/dataLayer/SearchByConditionsObject.js.map +1 -1
- package/dist/dataLayer/SearchByHashObject.d.ts +3 -6
- package/dist/dataLayer/SearchByHashObject.js +2 -1
- package/dist/dataLayer/SearchByHashObject.js.map +1 -1
- package/dist/dataLayer/SearchObject.d.ts +3 -12
- package/dist/dataLayer/SearchObject.js +2 -1
- package/dist/dataLayer/SearchObject.js.map +1 -1
- package/dist/dataLayer/SqlSearchObject.d.ts +2 -4
- package/dist/dataLayer/SqlSearchObject.js +2 -1
- package/dist/dataLayer/SqlSearchObject.js.map +1 -1
- package/dist/dataLayer/UpdateObject.d.ts +3 -7
- package/dist/dataLayer/UpdateObject.js +4 -3
- package/dist/dataLayer/UpdateObject.js.map +1 -1
- package/dist/dataLayer/UpsertObject.d.ts +3 -7
- package/dist/dataLayer/UpsertObject.js +4 -3
- package/dist/dataLayer/UpsertObject.js.map +1 -1
- package/dist/dataLayer/bulkLoad.d.ts +4 -4
- package/dist/dataLayer/bulkLoad.js +122 -88
- package/dist/dataLayer/bulkLoad.js.map +1 -1
- package/dist/dataLayer/delete.d.ts +10 -11
- package/dist/dataLayer/delete.js +74 -39
- package/dist/dataLayer/delete.js.map +1 -1
- package/dist/dataLayer/export.d.ts +8 -8
- package/dist/dataLayer/export.js +90 -55
- package/dist/dataLayer/export.js.map +1 -1
- package/dist/dataLayer/getBackup.d.ts +4 -3
- package/dist/dataLayer/getBackup.js +43 -11
- package/dist/dataLayer/getBackup.js.map +1 -1
- package/dist/dataLayer/harperBridge/BridgeMethods.d.ts +39 -21
- package/dist/dataLayer/harperBridge/BridgeMethods.js +41 -20
- package/dist/dataLayer/harperBridge/BridgeMethods.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.d.ts +2 -2
- package/dist/dataLayer/harperBridge/ResourceBridge.js +26 -25
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/TableSizeObject.d.ts +1 -0
- package/dist/dataLayer/harperBridge/TableSizeObject.js.map +1 -1
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.d.ts +4 -4
- package/dist/dataLayer/harperBridge/bridgeUtility/insertUpdateValidate.js +4 -4
- package/dist/dataLayer/harperBridge/harperBridge.d.ts +2 -3
- package/dist/dataLayer/harperBridge/harperBridge.js +38 -4
- package/dist/dataLayer/harperBridge/harperBridge.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js +7 -6
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateAttribute.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateRecords.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateSchema.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js +5 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbCreateTable.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteAuditLogsBefore.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDeleteRecords.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropAttribute.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropSchema.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbDropTable.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbFlush.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetBackup.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByHash.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbGetDataByValue.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbReadAuditLog.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js +8 -8
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByConditions.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.d.ts +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByHash.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbSearchByValue.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpdateRecords.js +3 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbMethods/lmdbUpsertRecords.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/LMDBCreateAttributeObject.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializeHashSearch.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCheckForNewAttributes.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js +5 -3
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbCreateTransactionsAuditEnvironment.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbGetTableSize.js +2 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.d.ts +1 -2
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js +4 -4
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbProcessRows.js.map +1 -1
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbSearch.js +5 -5
- package/dist/dataLayer/harperBridge/lmdbBridge/lmdbUtility/lmdbWriteTransaction.js +4 -4
- package/dist/dataLayer/hdbInfoController.d.ts +4 -8
- package/dist/dataLayer/hdbInfoController.js +66 -31
- package/dist/dataLayer/hdbInfoController.js.map +1 -1
- package/dist/dataLayer/insert.d.ts +14 -26
- package/dist/dataLayer/insert.js +63 -28
- package/dist/dataLayer/insert.js.map +1 -1
- package/dist/dataLayer/readAuditLog.d.ts +1 -3
- package/dist/dataLayer/readAuditLog.js +45 -13
- package/dist/dataLayer/readAuditLog.js.map +1 -1
- package/dist/dataLayer/schema.d.ts +10 -10
- package/dist/dataLayer/schema.js +124 -89
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.d.ts +4 -4
- package/dist/dataLayer/schemaDescribe.js +78 -41
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/dataLayer/search.d.ts +4 -4
- package/dist/dataLayer/search.js +12 -13
- package/dist/dataLayer/search.js.map +1 -1
- package/dist/dataLayer/transaction.d.ts +1 -1
- package/dist/dataLayer/transaction.js +3 -4
- package/dist/dataLayer/transaction.js.map +1 -1
- package/dist/dataLayer/update.d.ts +2 -8
- package/dist/dataLayer/update.js +53 -18
- package/dist/dataLayer/update.js.map +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/globals.js +1 -0
- package/dist/globals.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +65 -0
- package/dist/launchServiceScripts/launchHarperDB.d.ts +1 -0
- package/dist/launchServiceScripts/launchHarperDB.js +3 -0
- package/dist/launchServiceScripts/launchHarperDB.js.map +1 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js +3 -0
- package/dist/launchServiceScripts/utility/checkNodeVersion.js.map +1 -1
- package/dist/resources/DatabaseTransaction.d.ts +14 -6
- package/dist/resources/DatabaseTransaction.js +39 -15
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/ErrorResource.d.ts +1 -1
- package/dist/resources/ErrorResource.js +3 -1
- package/dist/resources/ErrorResource.js.map +1 -1
- package/dist/resources/LMDBTransaction.d.ts +10 -13
- package/dist/resources/LMDBTransaction.js +18 -7
- package/dist/resources/LMDBTransaction.js.map +1 -1
- package/dist/resources/RecordEncoder.d.ts +10 -12
- package/dist/resources/RecordEncoder.js +38 -38
- package/dist/resources/RecordEncoder.js.map +1 -1
- package/dist/resources/RequestTarget.d.ts +1 -0
- package/dist/resources/RequestTarget.js.map +1 -1
- package/dist/resources/Resource.d.ts +25 -5
- package/dist/resources/Resource.js +43 -10
- package/dist/resources/Resource.js.map +1 -1
- package/dist/resources/ResourceInterface.d.ts +24 -5
- package/dist/resources/ResourceInterface.js +20 -0
- package/dist/resources/ResourceInterface.js.map +1 -1
- package/dist/resources/Resources.d.ts +3 -4
- package/dist/resources/Resources.js +7 -6
- package/dist/resources/Resources.js.map +1 -1
- package/dist/resources/RocksIndexStore.js +3 -0
- package/dist/resources/RocksIndexStore.js.map +1 -1
- package/dist/resources/RocksTransactionLogStore.d.ts +1 -1
- package/dist/resources/RocksTransactionLogStore.js +10 -3
- package/dist/resources/RocksTransactionLogStore.js.map +1 -1
- package/dist/resources/Table.d.ts +76 -329
- package/dist/resources/Table.js +306 -116
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/analytics/metadata.d.ts +1 -0
- package/dist/resources/analytics/metadata.js +1 -0
- package/dist/resources/analytics/metadata.js.map +1 -1
- package/dist/resources/analytics/read.d.ts +8 -1
- package/dist/resources/analytics/read.js +69 -8
- package/dist/resources/analytics/read.js.map +1 -1
- package/dist/resources/analytics/write.d.ts +28 -0
- package/dist/resources/analytics/write.js +232 -20
- package/dist/resources/analytics/write.js.map +1 -1
- package/dist/resources/auditStore.d.ts +18 -13
- package/dist/resources/auditStore.js +16 -8
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/blob.d.ts +16 -27
- package/dist/resources/blob.js +8 -8
- package/dist/resources/blob.js.map +1 -1
- package/dist/resources/dataLoader.d.ts +1 -1
- package/dist/resources/dataLoader.js +13 -13
- package/dist/resources/databases.d.ts +17 -0
- package/dist/resources/databases.js +175 -59
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/graphql.d.ts +1 -7
- package/dist/resources/graphql.js +267 -173
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.d.ts +17 -1
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js +327 -59
- package/dist/resources/indexes/HierarchicalNavigableSmallWorld.js.map +1 -1
- package/dist/resources/indexes/vector.d.ts +1 -0
- package/dist/resources/indexes/vector.js +14 -0
- package/dist/resources/indexes/vector.js.map +1 -1
- package/dist/resources/jsonSchemaTypes.d.ts +60 -0
- package/dist/resources/jsonSchemaTypes.js +78 -0
- package/dist/resources/jsonSchemaTypes.js.map +1 -0
- package/dist/resources/loadEnv.d.ts +2 -5
- package/dist/resources/loadEnv.js +21 -18
- package/dist/resources/loadEnv.js.map +1 -1
- package/dist/resources/login.d.ts +2 -3
- package/dist/resources/login.js +5 -4
- package/dist/resources/login.js.map +1 -1
- package/dist/resources/models/Models.d.ts +45 -0
- package/dist/resources/models/Models.js +265 -0
- package/dist/resources/models/Models.js.map +1 -0
- package/dist/resources/models/TestBackend.d.ts +15 -0
- package/dist/resources/models/TestBackend.js +71 -0
- package/dist/resources/models/TestBackend.js.map +1 -0
- package/dist/resources/models/agentLoop.d.ts +125 -0
- package/dist/resources/models/agentLoop.js +746 -0
- package/dist/resources/models/agentLoop.js.map +1 -0
- package/dist/resources/models/analyticsTable.d.ts +65 -0
- package/dist/resources/models/analyticsTable.js +166 -0
- package/dist/resources/models/analyticsTable.js.map +1 -0
- package/dist/resources/models/backendHelpers.d.ts +57 -0
- package/dist/resources/models/backendHelpers.js +109 -0
- package/dist/resources/models/backendHelpers.js.map +1 -0
- package/dist/resources/models/backendRegistry.d.ts +36 -0
- package/dist/resources/models/backendRegistry.js +54 -0
- package/dist/resources/models/backendRegistry.js.map +1 -0
- package/dist/resources/models/bootstrap.d.ts +24 -0
- package/dist/resources/models/bootstrap.js +112 -0
- package/dist/resources/models/bootstrap.js.map +1 -0
- package/dist/resources/models/embedHook.d.ts +33 -0
- package/dist/resources/models/embedHook.js +127 -0
- package/dist/resources/models/embedHook.js.map +1 -0
- package/dist/resources/models/types.d.ts +301 -0
- package/dist/resources/models/types.js +11 -0
- package/dist/resources/models/types.js.map +1 -0
- package/dist/resources/openApi.js +74 -34
- package/dist/resources/openApi.js.map +1 -1
- package/dist/resources/replayLogs.js +7 -1
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/replayLogsGuards.d.ts +9 -0
- package/dist/resources/replayLogsGuards.js +47 -0
- package/dist/resources/replayLogsGuards.js.map +1 -1
- package/dist/resources/roles.d.ts +1 -7
- package/dist/resources/roles.js +67 -71
- package/dist/resources/roles.js.map +1 -1
- package/dist/resources/search.d.ts +18 -1
- package/dist/resources/search.js +349 -140
- package/dist/resources/search.js.map +1 -1
- package/dist/resources/tracked.d.ts +1 -1
- package/dist/resources/tracked.js +23 -15
- package/dist/resources/tracked.js.map +1 -1
- package/dist/resources/transaction.d.ts +1 -1
- package/dist/resources/transaction.js +1 -1
- package/dist/resources/transaction.js.map +1 -1
- package/dist/resources/transactionBroadcast.d.ts +1 -1
- package/dist/resources/transactionBroadcast.js.map +1 -1
- package/dist/security/auth.d.ts +1 -5
- package/dist/security/auth.js +34 -25
- package/dist/security/auth.js.map +1 -1
- package/dist/security/certificateVerification/crlVerification.js +7 -1
- package/dist/security/certificateVerification/crlVerification.js.map +1 -1
- package/dist/security/cryptoHash.d.ts +2 -2
- package/dist/security/cryptoHash.js +37 -5
- package/dist/security/cryptoHash.js.map +1 -1
- package/dist/security/data_objects/PermissionAttributeResponseObject.d.ts +3 -4
- package/dist/security/data_objects/PermissionAttributeResponseObject.js +4 -1
- package/dist/security/data_objects/PermissionAttributeResponseObject.js.map +1 -1
- package/dist/security/data_objects/PermissionResponseObject.d.ts +9 -9
- package/dist/security/data_objects/PermissionResponseObject.js +15 -8
- package/dist/security/data_objects/PermissionResponseObject.js.map +1 -1
- package/dist/security/data_objects/PermissionTableResponseObject.d.ts +5 -6
- package/dist/security/data_objects/PermissionTableResponseObject.js +6 -1
- package/dist/security/data_objects/PermissionTableResponseObject.js.map +1 -1
- package/dist/security/fastifyAuth.d.ts +2 -2
- package/dist/security/fastifyAuth.js +131 -22
- package/dist/security/fastifyAuth.js.map +1 -1
- package/dist/security/impersonation.js +15 -15
- package/dist/security/jsLoader.js +18 -5
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/security/keys.d.ts +45 -48
- package/dist/security/keys.js +160 -114
- package/dist/security/keys.js.map +1 -1
- package/dist/security/permissionsTranslator.js +2 -2
- package/dist/security/role.d.ts +5 -5
- package/dist/security/role.js +70 -35
- package/dist/security/role.js.map +1 -1
- package/dist/security/tokenAuthentication.d.ts +13 -0
- package/dist/security/tokenAuthentication.js +57 -27
- package/dist/security/tokenAuthentication.js.map +1 -1
- package/dist/security/user.js +74 -38
- package/dist/security/user.js.map +1 -1
- package/dist/server/DurableSubscriptionsSession.d.ts +4 -2
- package/dist/server/DurableSubscriptionsSession.js +71 -55
- package/dist/server/DurableSubscriptionsSession.js.map +1 -1
- package/dist/server/REST.d.ts +1 -8
- package/dist/server/REST.js +17 -16
- package/dist/server/REST.js.map +1 -1
- package/dist/server/Server.d.ts +23 -4
- package/dist/server/Server.js +1 -1
- package/dist/server/Server.js.map +1 -1
- package/dist/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
- package/dist/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
- package/dist/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
- package/dist/server/fastifyRoutes.d.ts +1 -4
- package/dist/server/fastifyRoutes.js +34 -30
- package/dist/server/fastifyRoutes.js.map +1 -1
- package/dist/server/graphqlQuerying.d.ts +1 -1
- package/dist/server/graphqlQuerying.js +8 -7
- package/dist/server/graphqlQuerying.js.map +1 -1
- package/dist/server/http.d.ts +9 -4
- package/dist/server/http.js +523 -47
- package/dist/server/http.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +66 -15
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/server/jobs/JobObject.d.ts +3 -3
- package/dist/server/jobs/JobObject.js +53 -7
- package/dist/server/jobs/JobObject.js.map +1 -1
- package/dist/server/jobs/jobProcess.js +64 -24
- package/dist/server/jobs/jobProcess.js.map +1 -1
- package/dist/server/jobs/jobRunner.d.ts +7 -6
- package/dist/server/jobs/jobRunner.js +68 -30
- package/dist/server/jobs/jobRunner.js.map +1 -1
- package/dist/server/jobs/jobs.d.ts +18 -7
- package/dist/server/jobs/jobs.js +93 -61
- package/dist/server/jobs/jobs.js.map +1 -1
- package/dist/server/loadRootComponents.js +1 -1
- package/dist/server/middlewareChain.d.ts +80 -0
- package/dist/server/middlewareChain.js +252 -0
- package/dist/server/middlewareChain.js.map +1 -0
- package/dist/server/mqtt.d.ts +1 -8
- package/dist/server/mqtt.js +22 -17
- package/dist/server/mqtt.js.map +1 -1
- package/dist/server/nodeName.js +46 -13
- package/dist/server/nodeName.js.map +1 -1
- package/dist/server/operationsServer.d.ts +2 -2
- package/dist/server/operationsServer.js +106 -33
- package/dist/server/operationsServer.js.map +1 -1
- package/dist/server/serverHelpers/Headers.d.ts +4 -4
- package/dist/server/serverHelpers/Headers.js +2 -0
- package/dist/server/serverHelpers/Headers.js.map +1 -1
- package/dist/server/serverHelpers/JSONStream.d.ts +7 -1
- package/dist/server/serverHelpers/JSONStream.js +12 -3
- package/dist/server/serverHelpers/JSONStream.js.map +1 -1
- package/dist/server/serverHelpers/Request.d.ts +106 -8
- package/dist/server/serverHelpers/Request.js +370 -9
- package/dist/server/serverHelpers/Request.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.d.ts +1 -1
- package/dist/server/serverHelpers/contentTypes.js +36 -7
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/multipartParser.d.ts +21 -0
- package/dist/server/serverHelpers/multipartParser.js +142 -0
- package/dist/server/serverHelpers/multipartParser.js.map +1 -0
- package/dist/server/serverHelpers/progressEmitter.d.ts +25 -0
- package/dist/server/serverHelpers/progressEmitter.js +103 -0
- package/dist/server/serverHelpers/progressEmitter.js.map +1 -0
- package/dist/server/serverHelpers/serverHandlers.d.ts +1 -1
- package/dist/server/serverHelpers/serverHandlers.js +38 -7
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
- package/dist/server/serverHelpers/serverUtilities.d.ts +4 -2
- package/dist/server/serverHelpers/serverUtilities.js +97 -93
- package/dist/server/serverHelpers/serverUtilities.js.map +1 -1
- package/dist/server/static.js +8 -5
- package/dist/server/static.js.map +1 -1
- package/dist/server/status/index.js +3 -3
- package/dist/server/storageReclamation.d.ts +10 -0
- package/dist/server/storageReclamation.js +68 -9
- package/dist/server/storageReclamation.js.map +1 -1
- package/dist/server/threads/itc.js +7 -4
- package/dist/server/threads/itc.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +1 -1
- package/dist/server/threads/manageThreads.js +110 -26
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/socketRouter.d.ts +0 -1
- package/dist/server/threads/socketRouter.js +8 -271
- package/dist/server/threads/socketRouter.js.map +1 -1
- package/dist/server/threads/threadServer.d.ts +1 -0
- package/dist/server/threads/threadServer.js +360 -118
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/server/threads/workerProcessGuard.d.ts +42 -0
- package/dist/server/threads/workerProcessGuard.js +114 -0
- package/dist/server/threads/workerProcessGuard.js.map +1 -0
- package/dist/server/throttle.js +17 -0
- package/dist/server/throttle.js.map +1 -1
- package/dist/sqlTranslator/SelectValidator.d.ts +21 -24
- package/dist/sqlTranslator/SelectValidator.js +86 -47
- package/dist/sqlTranslator/SelectValidator.js.map +1 -1
- package/dist/sqlTranslator/alasqlFunctionImporter.d.ts +6 -2
- package/dist/sqlTranslator/alasqlFunctionImporter.js +40 -3
- package/dist/sqlTranslator/alasqlFunctionImporter.js.map +1 -1
- package/dist/sqlTranslator/deleteTranslator.d.ts +4 -7
- package/dist/sqlTranslator/deleteTranslator.js +48 -14
- package/dist/sqlTranslator/deleteTranslator.js.map +1 -1
- package/dist/sqlTranslator/index.d.ts +10 -9
- package/dist/sqlTranslator/index.js +69 -30
- package/dist/sqlTranslator/index.js.map +1 -1
- package/dist/sqlTranslator/sql_statement_bucket.d.ts +10 -10
- package/dist/sqlTranslator/sql_statement_bucket.js +55 -13
- package/dist/sqlTranslator/sql_statement_bucket.js.map +1 -1
- package/dist/upgrade/UpgradeObjects.d.ts +2 -3
- package/dist/upgrade/UpgradeObjects.js +37 -4
- package/dist/upgrade/UpgradeObjects.js.map +1 -1
- package/dist/upgrade/directives/5-1-0.d.ts +6 -0
- package/dist/upgrade/directives/5-1-0.js +114 -0
- package/dist/upgrade/directives/5-1-0.js.map +1 -0
- package/dist/upgrade/directives/directivesController.d.ts +10 -10
- package/dist/upgrade/directives/directivesController.js +52 -11
- package/dist/upgrade/directives/directivesController.js.map +1 -1
- package/dist/upgrade/directivesManager.d.ts +1 -1
- package/dist/upgrade/directivesManager.js +53 -18
- package/dist/upgrade/directivesManager.js.map +1 -1
- package/dist/upgrade/upgradePrompt.d.ts +2 -8
- package/dist/upgrade/upgradePrompt.js +55 -60
- package/dist/upgrade/upgradePrompt.js.map +1 -1
- package/dist/upgrade/upgradeUtilities.d.ts +1 -1
- package/dist/upgrade/upgradeUtilities.js +37 -5
- package/dist/upgrade/upgradeUtilities.js.map +1 -1
- package/dist/utility/OperationFunctionCaller.d.ts +1 -1
- package/dist/utility/OperationFunctionCaller.js +45 -10
- package/dist/utility/OperationFunctionCaller.js.map +1 -1
- package/dist/utility/assignCmdEnvVariables.d.ts +1 -2
- package/dist/utility/assignCmdEnvVariables.js +8 -4
- package/dist/utility/assignCmdEnvVariables.js.map +1 -1
- package/dist/utility/common_utils.d.ts +80 -77
- package/dist/utility/common_utils.js +140 -79
- package/dist/utility/common_utils.js.map +1 -1
- package/dist/utility/environment/environmentManager.d.ts +12 -11
- package/dist/utility/environment/environmentManager.js +75 -29
- package/dist/utility/environment/environmentManager.js.map +1 -1
- package/dist/utility/environment/systemInformation.d.ts +4 -0
- package/dist/utility/environment/systemInformation.js +27 -16
- package/dist/utility/environment/systemInformation.js.map +1 -1
- package/dist/utility/errors/commonErrors.d.ts +192 -168
- package/dist/utility/errors/commonErrors.js +49 -18
- package/dist/utility/errors/commonErrors.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +37 -51
- package/dist/utility/errors/hdbError.js +65 -26
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/expandEnvVar.d.ts +61 -0
- package/dist/utility/expandEnvVar.js +113 -0
- package/dist/utility/expandEnvVar.js.map +1 -0
- package/dist/utility/functions/geo.js +2 -2
- package/dist/utility/functions/sql/alaSQLExtension.js +1 -1
- package/dist/utility/globalSchema.d.ts +13 -4
- package/dist/utility/globalSchema.js +14 -11
- package/dist/utility/globalSchema.js.map +1 -1
- package/dist/utility/hdbTerms.d.ts +54 -1
- package/dist/utility/hdbTerms.js +54 -1
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/install/checkJWTTokensExist.js +1 -1
- package/dist/utility/install/installer.d.ts +9 -12
- package/dist/utility/install/installer.js +117 -54
- package/dist/utility/install/installer.js.map +1 -1
- package/dist/utility/installation.js +3 -3
- package/dist/utility/lmdb/DBIDefinition.d.ts +4 -4
- package/dist/utility/lmdb/DBIDefinition.js +5 -1
- package/dist/utility/lmdb/DBIDefinition.js.map +1 -1
- package/dist/utility/lmdb/DeleteRecordsResponseObject.d.ts +3 -6
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/DeleteRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/InsertRecordsResponseObject.d.ts +3 -5
- package/dist/utility/lmdb/InsertRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/InsertRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/OpenDBIObject.d.ts +12 -15
- package/dist/utility/lmdb/OpenDBIObject.js +68 -6
- package/dist/utility/lmdb/OpenDBIObject.js.map +1 -1
- package/dist/utility/lmdb/OpenEnvironmentObject.d.ts +5 -8
- package/dist/utility/lmdb/OpenEnvironmentObject.js +52 -4
- package/dist/utility/lmdb/OpenEnvironmentObject.js.map +1 -1
- package/dist/utility/lmdb/UpdateRecordsResponseObject.d.ts +3 -6
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/UpdateRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/UpsertRecordsResponseObject.d.ts +3 -5
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js +2 -1
- package/dist/utility/lmdb/UpsertRecordsResponseObject.js.map +1 -1
- package/dist/utility/lmdb/cleanLMDBMap.d.ts +1 -1
- package/dist/utility/lmdb/cleanLMDBMap.js +44 -7
- package/dist/utility/lmdb/cleanLMDBMap.js.map +1 -1
- package/dist/utility/lmdb/commonUtility.d.ts +8 -9
- package/dist/utility/lmdb/commonUtility.js +46 -17
- package/dist/utility/lmdb/commonUtility.js.map +1 -1
- package/dist/utility/lmdb/deleteUtility.d.ts +2 -3
- package/dist/utility/lmdb/deleteUtility.js +51 -16
- package/dist/utility/lmdb/deleteUtility.js.map +1 -1
- package/dist/utility/lmdb/environmentUtility.d.ts +69 -36
- package/dist/utility/lmdb/environmentUtility.js +91 -51
- package/dist/utility/lmdb/environmentUtility.js.map +1 -1
- package/dist/utility/lmdb/searchCursorFunctions.d.ts +19 -19
- package/dist/utility/lmdb/searchCursorFunctions.js +46 -14
- package/dist/utility/lmdb/searchCursorFunctions.js.map +1 -1
- package/dist/utility/lmdb/searchUtility.d.ts +142 -73
- package/dist/utility/lmdb/searchUtility.js +91 -55
- package/dist/utility/lmdb/searchUtility.js.map +1 -1
- package/dist/utility/lmdb/terms.d.ts +34 -34
- package/dist/utility/lmdb/terms.js +12 -22
- package/dist/utility/lmdb/terms.js.map +1 -1
- package/dist/utility/lmdb/writeUtility.d.ts +3 -6
- package/dist/utility/lmdb/writeUtility.js +61 -28
- package/dist/utility/lmdb/writeUtility.js.map +1 -1
- package/dist/utility/logging/harper_logger.d.ts +87 -103
- package/dist/utility/logging/harper_logger.js +177 -82
- package/dist/utility/logging/harper_logger.js.map +1 -1
- package/dist/utility/logging/logRotator.d.ts +2 -10
- package/dist/utility/logging/logRotator.js +67 -32
- package/dist/utility/logging/logRotator.js.map +1 -1
- package/dist/utility/logging/logger.js +4 -4
- package/dist/utility/logging/readLog.d.ts +1 -1
- package/dist/utility/logging/readLog.js +54 -17
- package/dist/utility/logging/readLog.js.map +1 -1
- package/dist/utility/logging/transactionLog.d.ts +2 -2
- package/dist/utility/logging/transactionLog.js +51 -16
- package/dist/utility/logging/transactionLog.js.map +1 -1
- package/dist/utility/mount_hdb.d.ts +1 -2
- package/dist/utility/mount_hdb.js +54 -17
- package/dist/utility/mount_hdb.js.map +1 -1
- package/dist/utility/npmUtilities.d.ts +1 -1
- package/dist/utility/npmUtilities.js +54 -19
- package/dist/utility/npmUtilities.js.map +1 -1
- package/dist/utility/operation_authorization.d.ts +36 -9
- package/dist/utility/operation_authorization.js +135 -86
- package/dist/utility/operation_authorization.js.map +1 -1
- package/dist/utility/packageUtils.d.ts +0 -2
- package/dist/utility/packageUtils.js +7 -17
- package/dist/utility/packageUtils.js.map +1 -1
- package/dist/utility/password.js +2 -2
- package/dist/utility/processManagement/processManagement.js +2 -2
- package/dist/utility/processManagement/servicesConfig.js +1 -1
- package/dist/utility/signalling.d.ts +2 -2
- package/dist/utility/signalling.js +51 -16
- package/dist/utility/signalling.js.map +1 -1
- package/dist/utility/watcherFallback.d.ts +36 -0
- package/dist/utility/watcherFallback.js +73 -0
- package/dist/utility/watcherFallback.js.map +1 -0
- package/dist/validation/analyticsValidator.d.ts +1 -0
- package/dist/validation/analyticsValidator.js +80 -0
- package/dist/validation/analyticsValidator.js.map +1 -0
- package/dist/validation/bulkDeleteValidator.d.ts +1 -2
- package/dist/validation/bulkDeleteValidator.js +49 -11
- package/dist/validation/bulkDeleteValidator.js.map +1 -1
- package/dist/validation/check_permissions.d.ts +1 -2
- package/dist/validation/check_permissions.js +38 -3
- package/dist/validation/check_permissions.js.map +1 -1
- package/dist/validation/common_validators.d.ts +20 -20
- package/dist/validation/common_validators.js +62 -31
- package/dist/validation/common_validators.js.map +1 -1
- package/dist/validation/configValidator.d.ts +4 -4
- package/dist/validation/configValidator.js +189 -54
- package/dist/validation/configValidator.js.map +1 -1
- package/dist/validation/deleteValidator.d.ts +1 -2
- package/dist/validation/deleteValidator.js +49 -11
- package/dist/validation/deleteValidator.js.map +1 -1
- package/dist/validation/fileLoadValidator.d.ts +4 -4
- package/dist/validation/fileLoadValidator.js +67 -32
- package/dist/validation/fileLoadValidator.js.map +1 -1
- package/dist/validation/insertValidator.d.ts +1 -2
- package/dist/validation/insertValidator.js +48 -10
- package/dist/validation/insertValidator.js.map +1 -1
- package/dist/validation/installValidator.d.ts +2 -2
- package/dist/validation/installValidator.js +47 -10
- package/dist/validation/installValidator.js.map +1 -1
- package/dist/validation/readLogValidator.d.ts +1 -2
- package/dist/validation/readLogValidator.js +60 -22
- package/dist/validation/readLogValidator.js.map +1 -1
- package/dist/validation/role_validation.d.ts +3 -3
- package/dist/validation/role_validation.js +55 -19
- package/dist/validation/role_validation.js.map +1 -1
- package/dist/validation/schemaMetadataValidator.d.ts +3 -4
- package/dist/validation/schemaMetadataValidator.js +11 -12
- package/dist/validation/schemaMetadataValidator.js.map +1 -1
- package/dist/validation/searchValidator.d.ts +1 -2
- package/dist/validation/searchValidator.js +82 -43
- package/dist/validation/searchValidator.js.map +1 -1
- package/dist/validation/statusValidator.d.ts +1 -1
- package/dist/validation/transactionLogValidator.d.ts +3 -3
- package/dist/validation/transactionLogValidator.js +52 -17
- package/dist/validation/transactionLogValidator.js.map +1 -1
- package/dist/validation/user_validation.d.ts +3 -3
- package/dist/validation/user_validation.js +38 -6
- package/dist/validation/user_validation.js.map +1 -1
- package/dist/validation/validationWrapper.d.ts +3 -3
- package/dist/validation/validationWrapper.js +4 -5
- package/dist/validation/validationWrapper.js.map +1 -1
- package/index.ts +5 -0
- package/json/systemSchema.json +65 -0
- package/launchServiceScripts/utility/checkNodeVersion.js +2 -0
- package/package.json +38 -24
- package/resources/DESIGN.md +98 -0
- package/resources/DatabaseTransaction.ts +58 -30
- package/resources/ErrorResource.ts +2 -1
- package/resources/LMDBTransaction.ts +38 -29
- package/resources/RecordEncoder.ts +41 -39
- package/resources/RequestTarget.ts +2 -0
- package/resources/Resource.ts +96 -56
- package/resources/ResourceInterface.ts +44 -21
- package/resources/Resources.ts +8 -8
- package/resources/RocksIndexStore.ts +3 -0
- package/resources/RocksTransactionLogStore.ts +13 -4
- package/resources/Table.ts +440 -223
- package/resources/analytics/metadata.ts +1 -0
- package/resources/analytics/read.ts +99 -10
- package/resources/analytics/write.ts +240 -17
- package/resources/auditStore.ts +30 -19
- package/resources/blob.ts +53 -53
- package/resources/dataLoader.ts +4 -4
- package/resources/databases.ts +208 -74
- package/resources/graphql.ts +267 -165
- package/resources/indexes/HierarchicalNavigableSmallWorld.ts +310 -65
- package/resources/indexes/vector.ts +17 -0
- package/resources/jsonSchemaTypes.ts +102 -0
- package/resources/loadEnv.ts +21 -17
- package/resources/login.ts +5 -3
- package/resources/models/Models.ts +304 -0
- package/resources/models/TestBackend.ts +83 -0
- package/resources/models/agentLoop.ts +895 -0
- package/resources/models/analyticsTable.ts +199 -0
- package/resources/models/backendHelpers.ts +116 -0
- package/resources/models/backendRegistry.ts +66 -0
- package/resources/models/bootstrap.ts +135 -0
- package/resources/models/embedHook.ts +138 -0
- package/resources/models/types.ts +296 -0
- package/resources/openApi.ts +65 -31
- package/resources/replayLogs.ts +20 -9
- package/resources/replayLogsGuards.ts +45 -0
- package/resources/roles.ts +62 -67
- package/resources/search.ts +355 -135
- package/resources/tracked.ts +18 -9
- package/resources/transaction.ts +8 -8
- package/resources/transactionBroadcast.ts +3 -3
- package/schema.graphql +7 -0
- package/security/auth.ts +35 -26
- package/security/certificateVerification/crlVerification.ts +11 -4
- package/security/{cryptoHash.js → cryptoHash.ts} +3 -8
- package/security/data_objects/{PermissionAttributeResponseObject.js → PermissionAttributeResponseObject.ts} +4 -4
- package/security/data_objects/{PermissionResponseObject.js → PermissionResponseObject.ts} +12 -11
- package/security/data_objects/{PermissionTableResponseObject.js → PermissionTableResponseObject.ts} +6 -4
- package/security/{fastifyAuth.js → fastifyAuth.ts} +93 -20
- package/security/impersonation.ts +3 -3
- package/security/jsLoader.ts +22 -8
- package/security/{keys.js → keys.ts} +113 -121
- package/security/permissionsTranslator.js +2 -2
- package/security/{role.js → role.ts} +26 -33
- package/security/tokenAuthentication.ts +34 -7
- package/security/user.ts +26 -22
- package/server/DESIGN.md +139 -0
- package/server/DurableSubscriptionsSession.ts +67 -50
- package/server/REST.ts +120 -107
- package/server/Server.ts +31 -12
- package/server/fastifyRoutes/helpers/getCORSOptions.js +1 -1
- package/server/fastifyRoutes/helpers/getHeaderTimeoutConfig.js +1 -1
- package/server/fastifyRoutes/helpers/getServerOptions.js +1 -1
- package/server/fastifyRoutes.ts +37 -33
- package/server/graphqlQuerying.ts +6 -5
- package/server/http.ts +517 -26
- package/server/itc/serverHandlers.js +75 -14
- package/server/jobs/{JobObject.js → JobObject.ts} +13 -6
- package/server/jobs/{jobProcess.js → jobProcess.ts} +20 -16
- package/server/jobs/{jobRunner.js → jobRunner.ts} +20 -21
- package/server/jobs/{jobs.js → jobs.ts} +41 -44
- package/server/loadRootComponents.js +1 -1
- package/server/middlewareChain.ts +270 -0
- package/server/mqtt.ts +35 -26
- package/server/nodeName.ts +3 -1
- package/server/operationsServer.ts +85 -10
- package/server/serverHelpers/Headers.ts +10 -8
- package/server/serverHelpers/JSONStream.ts +15 -5
- package/server/serverHelpers/Request.ts +370 -13
- package/server/serverHelpers/contentTypes.ts +42 -11
- package/server/serverHelpers/multipartParser.ts +152 -0
- package/server/serverHelpers/progressEmitter.ts +110 -0
- package/server/serverHelpers/serverHandlers.js +43 -7
- package/server/serverHelpers/serverUtilities.ts +40 -30
- package/server/static.ts +9 -6
- package/server/status/index.ts +2 -2
- package/server/storageReclamation.ts +39 -2
- package/server/threads/itc.js +7 -4
- package/server/threads/manageThreads.js +100 -26
- package/server/threads/socketRouter.ts +12 -275
- package/server/threads/threadServer.js +345 -105
- package/server/threads/workerProcessGuard.ts +93 -0
- package/server/throttle.ts +18 -0
- package/sqlTranslator/{SelectValidator.js → SelectValidator.ts} +41 -49
- package/sqlTranslator/{alasqlFunctionImporter.js → alasqlFunctionImporter.ts} +5 -5
- package/sqlTranslator/{deleteTranslator.js → deleteTranslator.ts} +13 -18
- package/sqlTranslator/{index.js → index.ts} +30 -33
- package/sqlTranslator/{sql_statement_bucket.js → sql_statement_bucket.ts} +49 -20
- package/static/README.md +10 -9
- package/static/defaultConfig.yaml +0 -1
- package/studio/web/assets/{index-CybLScHg.js → index-Dqr9oVhe.js} +5 -5
- package/studio/web/assets/index-Dqr9oVhe.js.map +1 -0
- package/studio/web/assets/{index.lazy-DKx5-iXF.js → index.lazy-CpKcKb7M.js} +2 -2
- package/studio/web/assets/{index.lazy-DKx5-iXF.js.map → index.lazy-CpKcKb7M.js.map} +1 -1
- package/studio/web/assets/{profile-BOjes0Wl.js → profile-C1cujdsg.js} +2 -2
- package/studio/web/assets/{profile-BOjes0Wl.js.map → profile-C1cujdsg.js.map} +1 -1
- package/studio/web/assets/{status-EWKUIrjT.js → status-CTiIIQlY.js} +2 -2
- package/studio/web/assets/{status-EWKUIrjT.js.map → status-CTiIIQlY.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/upgrade/{UpgradeObjects.js → UpgradeObjects.ts} +3 -6
- package/upgrade/directives/5-1-0.ts +89 -0
- package/upgrade/directives/{directivesController.js → directivesController.ts} +16 -16
- package/upgrade/{directivesManager.js → directivesManager.ts} +7 -11
- package/upgrade/{upgradePrompt.js → upgradePrompt.ts} +6 -54
- package/upgrade/{upgradeUtilities.js → upgradeUtilities.ts} +3 -7
- package/utility/{OperationFunctionCaller.js → OperationFunctionCaller.ts} +7 -7
- package/utility/{assignCmdEnvVariables.js → assignCmdEnvVariables.ts} +6 -8
- package/utility/{common_utils.js → common_utils.ts} +113 -139
- package/utility/environment/{environmentManager.js → environmentManager.ts} +34 -33
- package/utility/environment/systemInformation.ts +18 -4
- package/utility/errors/{commonErrors.js → commonErrors.ts} +9 -9
- package/utility/errors/{hdbError.js → hdbError.ts} +39 -45
- package/utility/expandEnvVar.ts +110 -0
- package/utility/functions/geo.js +2 -2
- package/utility/functions/sql/alaSQLExtension.js +1 -1
- package/utility/globalSchema.ts +30 -0
- package/utility/hdbTerms.ts +54 -1
- package/utility/install/checkJWTTokensExist.js +1 -1
- package/utility/install/{installer.js → installer.ts} +66 -42
- package/utility/installation.ts +2 -2
- package/utility/lmdb/{DBIDefinition.js → DBIDefinition.ts} +4 -1
- package/utility/lmdb/{DeleteRecordsResponseObject.js → DeleteRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{InsertRecordsResponseObject.js → InsertRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/OpenDBIObject.ts +57 -0
- package/utility/lmdb/{OpenEnvironmentObject.js → OpenEnvironmentObject.ts} +19 -6
- package/utility/lmdb/{UpdateRecordsResponseObject.js → UpdateRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{UpsertRecordsResponseObject.js → UpsertRecordsResponseObject.ts} +2 -1
- package/utility/lmdb/{cleanLMDBMap.js → cleanLMDBMap.ts} +5 -5
- package/utility/lmdb/{commonUtility.js → commonUtility.ts} +13 -21
- package/utility/lmdb/{deleteUtility.js → deleteUtility.ts} +8 -12
- package/utility/lmdb/{environmentUtility.js → environmentUtility.ts} +43 -52
- package/utility/lmdb/{searchCursorFunctions.js → searchCursorFunctions.ts} +12 -26
- package/utility/lmdb/{searchUtility.js → searchUtility.ts} +75 -64
- package/utility/lmdb/{terms.js → terms.ts} +10 -23
- package/utility/lmdb/{writeUtility.js → writeUtility.ts} +37 -22
- package/utility/logging/{harper_logger.js → harper_logger.ts} +137 -90
- package/utility/logging/{logRotator.js → logRotator.ts} +15 -18
- package/utility/logging/logger.ts +1 -1
- package/utility/logging/{readLog.js → readLog.ts} +19 -19
- package/utility/logging/{transactionLog.js → transactionLog.ts} +10 -14
- package/utility/{mount_hdb.js → mount_hdb.ts} +15 -16
- package/utility/{npmUtilities.js → npmUtilities.ts} +14 -17
- package/utility/{operation_authorization.js → operation_authorization.ts} +173 -124
- package/utility/packageUtils.js +7 -16
- package/utility/password.ts +1 -1
- package/utility/processManagement/processManagement.js +2 -2
- package/utility/processManagement/servicesConfig.js +1 -1
- package/utility/{signalling.js → signalling.ts} +6 -11
- package/utility/watcherFallback.ts +74 -0
- package/validation/analyticsValidator.ts +44 -0
- package/validation/{bulkDeleteValidator.js → bulkDeleteValidator.ts} +5 -5
- package/validation/{check_permissions.js → check_permissions.ts} +3 -3
- package/validation/{common_validators.js → common_validators.ts} +12 -24
- package/validation/{configValidator.js → configValidator.ts} +114 -18
- package/validation/{deleteValidator.js → deleteValidator.ts} +5 -5
- package/validation/{fileLoadValidator.js → fileLoadValidator.ts} +12 -19
- package/validation/{insertValidator.js → insertValidator.ts} +5 -5
- package/validation/{installValidator.js → installValidator.ts} +8 -8
- package/validation/{readLogValidator.js → readLogValidator.ts} +10 -10
- package/validation/{role_validation.js → role_validation.ts} +26 -32
- package/validation/{schemaMetadataValidator.js → schemaMetadataValidator.ts} +5 -11
- package/validation/{searchValidator.js → searchValidator.ts} +12 -11
- package/validation/statusValidator.ts +1 -1
- package/validation/{transactionLogValidator.js → transactionLogValidator.ts} +4 -9
- package/validation/{user_validation.js → user_validation.ts} +4 -10
- package/validation/{validationWrapper.js → validationWrapper.ts} +3 -9
- package/bin/cliOperations.js +0 -159
- package/bin/lite.js +0 -5
- package/dataLayer/harperBridge/BridgeMethods.js +0 -85
- package/studio/web/assets/index-CybLScHg.js.map +0 -1
- package/utility/globalSchema.js +0 -35
- package/utility/lmdb/OpenDBIObject.js +0 -31
package/agent/session.ts
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in agent session storage. Backed by `system.hdb_agent_session` so
|
|
3
|
+
* transcripts and pending approvals survive restarts. The exported helpers
|
|
4
|
+
* are async to keep the surface uniform — once the underlying store gains
|
|
5
|
+
* non-blocking paths the call sites won't have to change.
|
|
6
|
+
*
|
|
7
|
+
* Intentionally separate from #511's `ConversationResource`: that primitive
|
|
8
|
+
* is app-facing (per-tenant, multi-user, user-defined schema) while this
|
|
9
|
+
* table is server-local and operator-owned.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { randomUUID } from 'node:crypto';
|
|
13
|
+
import { table } from '../resources/databases.ts';
|
|
14
|
+
import { SYSTEM_SCHEMA_NAME, SYSTEM_TABLE_NAMES } from '../utility/hdbTerms.ts';
|
|
15
|
+
import type { AgentMessage, AgentRunStatus, AgentSessionRow, ApprovalRequest } from './types.ts';
|
|
16
|
+
|
|
17
|
+
let cachedTable: any;
|
|
18
|
+
|
|
19
|
+
export function getAgentSessionTable(): any {
|
|
20
|
+
if (cachedTable) return cachedTable;
|
|
21
|
+
cachedTable = table({
|
|
22
|
+
table: SYSTEM_TABLE_NAMES.AGENT_SESSION_TABLE_NAME,
|
|
23
|
+
database: SYSTEM_SCHEMA_NAME,
|
|
24
|
+
audit: true,
|
|
25
|
+
trackDeletes: false,
|
|
26
|
+
attributes: [
|
|
27
|
+
{ name: 'session_id', isPrimaryKey: true },
|
|
28
|
+
{ name: 'user', type: 'string', indexed: true },
|
|
29
|
+
{ name: 'status', type: 'string', indexed: true },
|
|
30
|
+
{ name: 'messages' },
|
|
31
|
+
{ name: 'pendingApprovals' },
|
|
32
|
+
{ name: 'model', type: 'string' },
|
|
33
|
+
{ name: 'provider', type: 'string' },
|
|
34
|
+
{ name: 'createdAt', type: 'number', indexed: true },
|
|
35
|
+
{ name: 'updatedAt', type: 'number', indexed: true },
|
|
36
|
+
{ name: 'lastError', type: 'string' },
|
|
37
|
+
],
|
|
38
|
+
});
|
|
39
|
+
return cachedTable;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface CreateSessionOpts {
|
|
43
|
+
sessionId?: string;
|
|
44
|
+
user: string;
|
|
45
|
+
model?: string;
|
|
46
|
+
provider?: string;
|
|
47
|
+
initialMessage?: AgentMessage;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function createSession(opts: CreateSessionOpts): Promise<AgentSessionRow> {
|
|
51
|
+
const now = Date.now();
|
|
52
|
+
const row: AgentSessionRow = {
|
|
53
|
+
session_id: opts.sessionId ?? randomUUID(),
|
|
54
|
+
user: opts.user,
|
|
55
|
+
status: 'idle',
|
|
56
|
+
messages: opts.initialMessage ? [opts.initialMessage] : [],
|
|
57
|
+
pendingApprovals: [],
|
|
58
|
+
model: opts.model,
|
|
59
|
+
provider: opts.provider,
|
|
60
|
+
createdAt: now,
|
|
61
|
+
updatedAt: now,
|
|
62
|
+
};
|
|
63
|
+
await getAgentSessionTable().primaryStore.put(row.session_id, row);
|
|
64
|
+
return row;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export async function getSession(sessionId: string): Promise<AgentSessionRow | undefined> {
|
|
68
|
+
return getAgentSessionTable().primaryStore.get(sessionId);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export async function listSessions(opts: { limit?: number } = {}): Promise<AgentSessionRow[]> {
|
|
72
|
+
const limit = opts.limit ?? 100;
|
|
73
|
+
const out: AgentSessionRow[] = [];
|
|
74
|
+
for (const entry of getAgentSessionTable().primaryStore.getRange({ reverse: true, limit })) {
|
|
75
|
+
if (entry.value) out.push(entry.value as AgentSessionRow);
|
|
76
|
+
}
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Per-session mutation lock. Each row mutation is a read-modify-write against the table; without
|
|
82
|
+
* serialization, two concurrent mutations on the same session (e.g. the loop appending an assistant
|
|
83
|
+
* message while the operator resolves an approval) both read the same row and the second `put`
|
|
84
|
+
* clobbers the first — a lost update. This chains all mutations for a given session id so they
|
|
85
|
+
* apply sequentially. Reads (`getSession`/`listSessions`) intentionally don't take the lock.
|
|
86
|
+
*/
|
|
87
|
+
const sessionLocks = new Map<string, Promise<unknown>>();
|
|
88
|
+
|
|
89
|
+
function withSessionLock<T>(sessionId: string, fn: () => Promise<T>): Promise<T> {
|
|
90
|
+
const prev = (sessionLocks.get(sessionId) ?? Promise.resolve()).catch(() => {});
|
|
91
|
+
const result = prev.then(() => fn());
|
|
92
|
+
const tail = result.catch(() => {});
|
|
93
|
+
sessionLocks.set(sessionId, tail);
|
|
94
|
+
void tail.then(() => {
|
|
95
|
+
if (sessionLocks.get(sessionId) === tail) sessionLocks.delete(sessionId);
|
|
96
|
+
});
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function appendMessage(sessionId: string, message: AgentMessage): Promise<AgentSessionRow> {
|
|
101
|
+
return withSessionLock(sessionId, async () => {
|
|
102
|
+
const session = await requireSession(sessionId);
|
|
103
|
+
session.messages.push(message);
|
|
104
|
+
session.updatedAt = Date.now();
|
|
105
|
+
await getAgentSessionTable().primaryStore.put(sessionId, session);
|
|
106
|
+
return session;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export function setStatus(sessionId: string, status: AgentRunStatus, lastError?: string): Promise<AgentSessionRow> {
|
|
111
|
+
return withSessionLock(sessionId, async () => {
|
|
112
|
+
const session = await requireSession(sessionId);
|
|
113
|
+
session.status = status;
|
|
114
|
+
session.lastError = lastError;
|
|
115
|
+
session.updatedAt = Date.now();
|
|
116
|
+
await getAgentSessionTable().primaryStore.put(sessionId, session);
|
|
117
|
+
return session;
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function addPendingApproval(
|
|
122
|
+
sessionId: string,
|
|
123
|
+
approval: Omit<ApprovalRequest, 'id' | 'createdAt'>
|
|
124
|
+
): Promise<ApprovalRequest> {
|
|
125
|
+
return withSessionLock(sessionId, async () => {
|
|
126
|
+
const session = await requireSession(sessionId);
|
|
127
|
+
const entry: ApprovalRequest = { ...approval, id: randomUUID(), createdAt: Date.now() };
|
|
128
|
+
session.pendingApprovals.push(entry);
|
|
129
|
+
session.status = 'awaiting_approval';
|
|
130
|
+
session.updatedAt = Date.now();
|
|
131
|
+
await getAgentSessionTable().primaryStore.put(sessionId, session);
|
|
132
|
+
return entry;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function markApprovalConsumed(sessionId: string, approvalId: string): Promise<void> {
|
|
137
|
+
return withSessionLock(sessionId, async () => {
|
|
138
|
+
const session = await requireSession(sessionId);
|
|
139
|
+
const entry = session.pendingApprovals.find((a) => a.id === approvalId);
|
|
140
|
+
if (!entry) throw new Error(`No pending approval ${approvalId} on session ${sessionId}`);
|
|
141
|
+
if (!entry.resolved) throw new Error(`Approval ${approvalId} not yet resolved`);
|
|
142
|
+
if (entry.consumed) return;
|
|
143
|
+
entry.consumed = true;
|
|
144
|
+
session.updatedAt = Date.now();
|
|
145
|
+
await getAgentSessionTable().primaryStore.put(sessionId, session);
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function resolveApproval(sessionId: string, approvalId: string, approved: boolean): Promise<ApprovalRequest> {
|
|
150
|
+
return withSessionLock(sessionId, async () => {
|
|
151
|
+
const session = await requireSession(sessionId);
|
|
152
|
+
const entry = session.pendingApprovals.find((a) => a.id === approvalId);
|
|
153
|
+
if (!entry) throw new Error(`No pending approval ${approvalId} on session ${sessionId}`);
|
|
154
|
+
if (entry.resolved) throw new Error(`Approval ${approvalId} already resolved`);
|
|
155
|
+
entry.resolved = true;
|
|
156
|
+
entry.approved = approved;
|
|
157
|
+
entry.resolvedAt = Date.now();
|
|
158
|
+
// Either decision (approve or deny) returns the session to a resumable `idle` state so the
|
|
159
|
+
// loop can run again and deliver the resulting observation to the model. Operators who want
|
|
160
|
+
// to terminate the whole run should use `cancel_agent_run` instead of denying.
|
|
161
|
+
if (!session.pendingApprovals.some((a) => !a.resolved)) {
|
|
162
|
+
session.status = 'idle';
|
|
163
|
+
}
|
|
164
|
+
session.updatedAt = Date.now();
|
|
165
|
+
await getAgentSessionTable().primaryStore.put(sessionId, session);
|
|
166
|
+
return entry;
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function requireSession(sessionId: string): Promise<AgentSessionRow> {
|
|
171
|
+
const session = await getSession(sessionId);
|
|
172
|
+
if (!session) throw new Error(`No agent session ${sessionId}`);
|
|
173
|
+
return session;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Reset the cached table reference. Test-only seam; production code lets the
|
|
178
|
+
* lazy-getter initialize once per process.
|
|
179
|
+
*/
|
|
180
|
+
export function _resetForTests(): void {
|
|
181
|
+
cachedTable = undefined;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Inject a mock table accessor for unit tests. Pass `undefined` to restore the lazy default. */
|
|
185
|
+
export function _setTableForTests(mock: any): void {
|
|
186
|
+
cachedTable = mock;
|
|
187
|
+
}
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operator-only filesystem tools for the built-in agent (#626).
|
|
3
|
+
*
|
|
4
|
+
* Every path is resolved against the configured scopes (componentsRoot,
|
|
5
|
+
* logDir, configDir) and rejected if it escapes them. Writes are restricted
|
|
6
|
+
* to `componentsRoot` — `logDir` and `configDir` are observation-only so
|
|
7
|
+
* the agent can read logs and inspect config without rewriting either.
|
|
8
|
+
*
|
|
9
|
+
* Lifted in spirit from the external `harper-agent` CLI's file tools; the
|
|
10
|
+
* sandboxing rules are tightened here because the in-process agent can
|
|
11
|
+
* reach more of the filesystem than a remote CLI.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { readFile, writeFile, readdir, stat, mkdir, realpath, lstat, open } from 'node:fs/promises';
|
|
15
|
+
import { resolve, dirname, relative, sep, isAbsolute } from 'node:path';
|
|
16
|
+
import type { AgentTool, AgentToolContext, AgentScopes } from '../types.ts';
|
|
17
|
+
|
|
18
|
+
const MAX_READ_BYTES = 5 * 1024 * 1024; // 5 MiB
|
|
19
|
+
const MAX_WRITE_BYTES = 5 * 1024 * 1024;
|
|
20
|
+
const MAX_GREP_RESULTS = 500;
|
|
21
|
+
const MAX_PATTERN_LENGTH = 1000;
|
|
22
|
+
const DEFAULT_TAIL_LINES = 200;
|
|
23
|
+
const TAIL_READ_BYTES = 1 * 1024 * 1024; // 1 MiB — enough for thousands of normal log lines
|
|
24
|
+
|
|
25
|
+
type Access = 'read' | 'write';
|
|
26
|
+
|
|
27
|
+
async function resolveScoped(scopes: AgentScopes, path: string, access: Access): Promise<string> {
|
|
28
|
+
const absolute = resolve(path);
|
|
29
|
+
const candidates = [scopes.componentsRoot];
|
|
30
|
+
if (access === 'read') {
|
|
31
|
+
candidates.push(scopes.logDir, scopes.configDir);
|
|
32
|
+
}
|
|
33
|
+
// Reject a symlink leaf. `safeRealPath` resolves existing symlinks via `realpath` (so a link to
|
|
34
|
+
// an out-of-scope *existing* file is caught by the isInside check below) — but a link whose
|
|
35
|
+
// target does NOT exist makes `realpath` throw, and the fallback returns the link's own in-scope
|
|
36
|
+
// path. `writeFile`/`readFile` then follow the link out of scope. An explicit lstat closes that
|
|
37
|
+
// gap: a legitimate component/log/config file is never a symlink.
|
|
38
|
+
try {
|
|
39
|
+
const linkStat = await lstat(absolute);
|
|
40
|
+
if (linkStat.isSymbolicLink()) {
|
|
41
|
+
throw new Error(`Refusing to ${access} through a symlink: ${path}`);
|
|
42
|
+
}
|
|
43
|
+
} catch (err) {
|
|
44
|
+
// ENOENT (path doesn't exist yet — normal for a new-file write) is fine; rethrow anything else
|
|
45
|
+
// (including our own symlink rejection).
|
|
46
|
+
if ((err as NodeJS.ErrnoException)?.code !== 'ENOENT') throw err;
|
|
47
|
+
}
|
|
48
|
+
const realAbsolute = await safeRealPath(absolute);
|
|
49
|
+
for (const root of candidates) {
|
|
50
|
+
const realRoot = await safeRealPath(root);
|
|
51
|
+
if (isInside(realAbsolute, realRoot)) return realAbsolute;
|
|
52
|
+
}
|
|
53
|
+
throw new Error(`Path is outside the agent's ${access} scope: ${path}`);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function safeRealPath(p: string): Promise<string> {
|
|
57
|
+
try {
|
|
58
|
+
return await realpath(p);
|
|
59
|
+
} catch {
|
|
60
|
+
// Missing leaf is fine — resolve the deepest existing ancestor and join.
|
|
61
|
+
const parent = dirname(p);
|
|
62
|
+
if (parent === p) return p;
|
|
63
|
+
const parentReal = await safeRealPath(parent);
|
|
64
|
+
return resolve(parentReal, p.slice(parent.length + 1));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function isInside(child: string, parent: string): boolean {
|
|
69
|
+
const rel = relative(parent, child);
|
|
70
|
+
// On Windows, `path.relative` returns an absolute path when the two arguments are on
|
|
71
|
+
// different drive letters (e.g. C:\components vs D:\etc). Without this check the agent
|
|
72
|
+
// could escape its scope by naming a path on another drive.
|
|
73
|
+
if (isAbsolute(rel)) return false;
|
|
74
|
+
return rel === '' || (!rel.startsWith('..') && !rel.includes(`..${sep}`));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const readFileTool: AgentTool = {
|
|
78
|
+
def: {
|
|
79
|
+
name: 'read_file',
|
|
80
|
+
description: 'Read a UTF-8 text file within componentsRoot, logDir, or configDir.',
|
|
81
|
+
parameters: {
|
|
82
|
+
type: 'object',
|
|
83
|
+
properties: {
|
|
84
|
+
path: { type: 'string', description: 'Absolute filesystem path.' },
|
|
85
|
+
},
|
|
86
|
+
required: ['path'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
90
|
+
const path = await resolveScoped(ctx.scopes, args.path, 'read');
|
|
91
|
+
const st = await stat(path);
|
|
92
|
+
if (st.size > MAX_READ_BYTES) {
|
|
93
|
+
throw new Error(`File ${path} exceeds ${MAX_READ_BYTES}-byte read cap (size ${st.size})`);
|
|
94
|
+
}
|
|
95
|
+
const content = await readFile(path, 'utf8');
|
|
96
|
+
return { path, size: st.size, content };
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const writeFileTool: AgentTool = {
|
|
101
|
+
def: {
|
|
102
|
+
name: 'write_file',
|
|
103
|
+
description: 'Write a UTF-8 text file within componentsRoot. Creates parent directories as needed.',
|
|
104
|
+
parameters: {
|
|
105
|
+
type: 'object',
|
|
106
|
+
properties: {
|
|
107
|
+
path: { type: 'string', description: 'Absolute filesystem path under componentsRoot.' },
|
|
108
|
+
content: { type: 'string', description: 'UTF-8 file contents.' },
|
|
109
|
+
},
|
|
110
|
+
required: ['path', 'content'],
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
114
|
+
const content = String(args.content ?? '');
|
|
115
|
+
if (Buffer.byteLength(content, 'utf8') > MAX_WRITE_BYTES) {
|
|
116
|
+
throw new Error(`Write exceeds ${MAX_WRITE_BYTES}-byte cap`);
|
|
117
|
+
}
|
|
118
|
+
const path = await resolveScoped(ctx.scopes, args.path, 'write');
|
|
119
|
+
await mkdir(dirname(path), { recursive: true });
|
|
120
|
+
await writeFile(path, content, 'utf8');
|
|
121
|
+
return { path, bytesWritten: Buffer.byteLength(content, 'utf8') };
|
|
122
|
+
},
|
|
123
|
+
destructive: true,
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export const listDirTool: AgentTool = {
|
|
127
|
+
def: {
|
|
128
|
+
name: 'list_dir',
|
|
129
|
+
description: 'List the immediate entries in a directory within an allowed scope.',
|
|
130
|
+
parameters: {
|
|
131
|
+
type: 'object',
|
|
132
|
+
properties: {
|
|
133
|
+
path: { type: 'string', description: 'Absolute filesystem path.' },
|
|
134
|
+
},
|
|
135
|
+
required: ['path'],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
139
|
+
const path = await resolveScoped(ctx.scopes, args.path, 'read');
|
|
140
|
+
const entries = await readdir(path, { withFileTypes: true });
|
|
141
|
+
return {
|
|
142
|
+
path,
|
|
143
|
+
entries: entries.map((e) => ({
|
|
144
|
+
name: e.name,
|
|
145
|
+
kind: e.isDirectory() ? 'directory' : e.isFile() ? 'file' : 'other',
|
|
146
|
+
})),
|
|
147
|
+
};
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
export const grepFilesTool: AgentTool = {
|
|
152
|
+
def: {
|
|
153
|
+
name: 'grep_files',
|
|
154
|
+
description: 'Search recursively under a scoped directory for a regex pattern. Returns matched lines.',
|
|
155
|
+
parameters: {
|
|
156
|
+
type: 'object',
|
|
157
|
+
properties: {
|
|
158
|
+
root: { type: 'string', description: 'Directory to search under.' },
|
|
159
|
+
pattern: { type: 'string', description: 'JavaScript-compatible regular expression source.' },
|
|
160
|
+
flags: { type: 'string', description: 'Regex flags (default: "i").' },
|
|
161
|
+
maxResults: { type: 'integer', minimum: 1, maximum: MAX_GREP_RESULTS },
|
|
162
|
+
},
|
|
163
|
+
required: ['root', 'pattern'],
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
167
|
+
const root = await resolveScoped(ctx.scopes, args.root, 'read');
|
|
168
|
+
// Cap pattern length. A maliciously crafted regex (e.g. nested quantifiers) can backtrack
|
|
169
|
+
// catastrophically and block the main thread; JS has no native per-match timeout. The agent
|
|
170
|
+
// is super_user-gated so this is self-inflicted DoS rather than a privilege boundary, but a
|
|
171
|
+
// length cap removes the easiest footgun without a worker-thread regex sandbox.
|
|
172
|
+
const patternSource = String(args.pattern ?? '');
|
|
173
|
+
if (patternSource.length > MAX_PATTERN_LENGTH) {
|
|
174
|
+
throw new Error(`grep pattern exceeds ${MAX_PATTERN_LENGTH}-char cap`);
|
|
175
|
+
}
|
|
176
|
+
const pattern = new RegExp(patternSource, args.flags ?? 'i');
|
|
177
|
+
const cap = Math.min(args.maxResults ?? MAX_GREP_RESULTS, MAX_GREP_RESULTS);
|
|
178
|
+
const results: Array<{ path: string; line: number; text: string }> = [];
|
|
179
|
+
await walk(root, async (file) => {
|
|
180
|
+
if (results.length >= cap) return false;
|
|
181
|
+
// `stat` first so a multi-GB log or database file can't be slurped into memory by a
|
|
182
|
+
// well-formed grep request. Anything over the read cap is silently skipped.
|
|
183
|
+
let size = 0;
|
|
184
|
+
try {
|
|
185
|
+
const st = await stat(file);
|
|
186
|
+
size = st.size;
|
|
187
|
+
} catch {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
if (size > MAX_READ_BYTES) return true;
|
|
191
|
+
const text = await readFile(file, 'utf8').catch(() => '');
|
|
192
|
+
if (!text) return true;
|
|
193
|
+
const lines = text.split('\n');
|
|
194
|
+
for (let i = 0; i < lines.length; i++) {
|
|
195
|
+
if (results.length >= cap) return false;
|
|
196
|
+
if (pattern.test(lines[i])) results.push({ path: file, line: i + 1, text: lines[i] });
|
|
197
|
+
}
|
|
198
|
+
return true;
|
|
199
|
+
});
|
|
200
|
+
return { root, count: results.length, results };
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export const tailFileTool: AgentTool = {
|
|
205
|
+
def: {
|
|
206
|
+
name: 'tail_file',
|
|
207
|
+
description: 'Return the last N lines of a UTF-8 file. Useful for log tails.',
|
|
208
|
+
parameters: {
|
|
209
|
+
type: 'object',
|
|
210
|
+
properties: {
|
|
211
|
+
path: { type: 'string', description: 'Absolute filesystem path.' },
|
|
212
|
+
lines: { type: 'integer', minimum: 1, maximum: 5000 },
|
|
213
|
+
},
|
|
214
|
+
required: ['path'],
|
|
215
|
+
},
|
|
216
|
+
},
|
|
217
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
218
|
+
const path = await resolveScoped(ctx.scopes, args.path, 'read');
|
|
219
|
+
const wanted = Math.min(args.lines ?? DEFAULT_TAIL_LINES, 5000);
|
|
220
|
+
// Read only the trailing TAIL_READ_BYTES — a multi-GB log file otherwise OOMs the process.
|
|
221
|
+
const st = await stat(path);
|
|
222
|
+
const start = Math.max(0, st.size - TAIL_READ_BYTES);
|
|
223
|
+
const truncated = start > 0;
|
|
224
|
+
const fh = await open(path, 'r');
|
|
225
|
+
try {
|
|
226
|
+
const buf = Buffer.alloc(st.size - start);
|
|
227
|
+
await fh.read(buf, 0, buf.length, start);
|
|
228
|
+
const text = buf.toString('utf8');
|
|
229
|
+
const all = text.split('\n');
|
|
230
|
+
// `split('\n')` on a file ending with `\n` leaves a trailing empty entry — drop it so the
|
|
231
|
+
// "last N lines" the agent sees matches what a human reading the file would see.
|
|
232
|
+
if (all.length > 0 && all[all.length - 1] === '') all.pop();
|
|
233
|
+
// When we read from a mid-file offset the first "line" is almost certainly a partial
|
|
234
|
+
// fragment of a real line. Drop it so we don't hand the agent a misleading prefix.
|
|
235
|
+
if (truncated && all.length > 0) all.shift();
|
|
236
|
+
const sliceStart = Math.max(0, all.length - wanted);
|
|
237
|
+
return { path, lines: all.slice(sliceStart), truncated };
|
|
238
|
+
} finally {
|
|
239
|
+
await fh.close();
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const fsTools: AgentTool[] = [readFileTool, writeFileTool, listDirTool, grepFilesTool, tailFileTool];
|
|
245
|
+
|
|
246
|
+
async function walk(root: string, visit: (file: string) => Promise<boolean>): Promise<void> {
|
|
247
|
+
// Resolve the scope root once via realpath so the per-entry symlink check below has a
|
|
248
|
+
// stable comparison anchor; otherwise a symlink in the root itself could shift the anchor.
|
|
249
|
+
const realRoot = await safeRealPath(root);
|
|
250
|
+
const stack: string[] = [root];
|
|
251
|
+
while (stack.length) {
|
|
252
|
+
const dir = stack.pop()!;
|
|
253
|
+
let entries;
|
|
254
|
+
try {
|
|
255
|
+
entries = await readdir(dir, { withFileTypes: true });
|
|
256
|
+
} catch {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
for (const entry of entries) {
|
|
260
|
+
const full = resolve(dir, entry.name);
|
|
261
|
+
if (entry.isDirectory()) {
|
|
262
|
+
if (entry.name === 'node_modules' || entry.name === '.git') continue;
|
|
263
|
+
// Re-resolve via realpath so a symlinked directory pointing outside the scope is rejected.
|
|
264
|
+
// Without this, `componentsRoot/escape -> /etc` would let grep walk into /etc.
|
|
265
|
+
const realFull = await safeRealPath(full);
|
|
266
|
+
if (!isInside(realFull, realRoot)) continue;
|
|
267
|
+
stack.push(full);
|
|
268
|
+
} else if (entry.isFile()) {
|
|
269
|
+
const realFull = await safeRealPath(full);
|
|
270
|
+
if (!isInside(realFull, realRoot)) continue;
|
|
271
|
+
const proceed = await visit(full);
|
|
272
|
+
if (proceed === false) return;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `http_fetch` for the built-in agent (#626). Wraps the platform `fetch`
|
|
3
|
+
* with a size cap, an inactivity timeout, and a metadata/loopback blocklist
|
|
4
|
+
* so the agent can probe its own deployed components and pull lightweight
|
|
5
|
+
* web pages for context without becoming an SSRF vector against cloud
|
|
6
|
+
* instance-metadata endpoints or unrelated internal services.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { isIP } from 'node:net';
|
|
10
|
+
import type { AgentTool, AgentToolContext } from '../types.ts';
|
|
11
|
+
|
|
12
|
+
const MAX_BYTES = 2 * 1024 * 1024; // 2 MiB cap on response bodies
|
|
13
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
14
|
+
// Hard-blocked literal hosts. Cloud-metadata services live on these IPs and exposing them
|
|
15
|
+
// to a prompt-controlled fetch is a credential-leak vector. Loopback to the local Harper
|
|
16
|
+
// instance is allowed via `localhost`/`127.0.0.1` for self-testing — those are NOT blocked.
|
|
17
|
+
const BLOCKED_HOSTS = new Set([
|
|
18
|
+
'169.254.169.254', // AWS / GCP / Azure IMDS
|
|
19
|
+
'fd00:ec2::254', // AWS IMDSv2 IPv6
|
|
20
|
+
'metadata.google.internal',
|
|
21
|
+
'metadata.goog',
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
export const httpFetchTool: AgentTool = {
|
|
25
|
+
def: {
|
|
26
|
+
name: 'http_fetch',
|
|
27
|
+
description:
|
|
28
|
+
"Issue an HTTP request from the Harper server. Useful for hitting the agent's own components on localhost and pulling reference pages.",
|
|
29
|
+
parameters: {
|
|
30
|
+
type: 'object',
|
|
31
|
+
properties: {
|
|
32
|
+
url: { type: 'string', description: 'Absolute URL.' },
|
|
33
|
+
method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'HEAD'] },
|
|
34
|
+
headers: { type: 'object', additionalProperties: { type: 'string' } },
|
|
35
|
+
body: { type: 'string', description: 'Request body as a string (JSON or form-encoded).' },
|
|
36
|
+
timeoutMs: { type: 'integer', minimum: 1, maximum: 120_000 },
|
|
37
|
+
},
|
|
38
|
+
required: ['url'],
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
42
|
+
const url = String(args.url ?? '');
|
|
43
|
+
if (!/^https?:\/\//i.test(url)) throw new Error('http_fetch requires an http(s) URL');
|
|
44
|
+
let parsed: URL;
|
|
45
|
+
try {
|
|
46
|
+
parsed = new URL(url);
|
|
47
|
+
} catch {
|
|
48
|
+
throw new Error(`http_fetch could not parse URL: ${url}`);
|
|
49
|
+
}
|
|
50
|
+
const host = parsed.hostname.toLowerCase();
|
|
51
|
+
if (BLOCKED_HOSTS.has(host)) {
|
|
52
|
+
throw new Error(`http_fetch blocked by metadata-host policy: ${host}`);
|
|
53
|
+
}
|
|
54
|
+
// IPv4 link-local (169.254.0.0/16) covers IMDS variants beyond the canonical 169.254.169.254.
|
|
55
|
+
if (isIP(host) === 4 && host.startsWith('169.254.')) {
|
|
56
|
+
throw new Error(`http_fetch blocked by link-local policy: ${host}`);
|
|
57
|
+
}
|
|
58
|
+
const timeoutMs = Math.min(args.timeoutMs ?? DEFAULT_TIMEOUT_MS, 120_000);
|
|
59
|
+
const localAbort = new AbortController();
|
|
60
|
+
const timer = setTimeout(() => localAbort.abort(new Error(`http_fetch timed out after ${timeoutMs}ms`)), timeoutMs);
|
|
61
|
+
const signal = combineSignals(ctx.signal, localAbort.signal);
|
|
62
|
+
try {
|
|
63
|
+
const response = await fetch(url, {
|
|
64
|
+
method: args.method ?? 'GET',
|
|
65
|
+
headers: args.headers,
|
|
66
|
+
body: args.body,
|
|
67
|
+
signal,
|
|
68
|
+
});
|
|
69
|
+
const buffer = await readCapped(response, MAX_BYTES);
|
|
70
|
+
return {
|
|
71
|
+
status: response.status,
|
|
72
|
+
headers: Object.fromEntries(response.headers.entries()),
|
|
73
|
+
body: buffer.toString('utf8'),
|
|
74
|
+
truncated: buffer.length === MAX_BYTES,
|
|
75
|
+
};
|
|
76
|
+
} finally {
|
|
77
|
+
clearTimeout(timer);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
async function readCapped(response: Response, cap: number): Promise<Buffer> {
|
|
83
|
+
const reader = response.body?.getReader();
|
|
84
|
+
if (!reader) return Buffer.alloc(0);
|
|
85
|
+
const chunks: Buffer[] = [];
|
|
86
|
+
let total = 0;
|
|
87
|
+
while (total < cap) {
|
|
88
|
+
const { value, done } = await reader.read();
|
|
89
|
+
if (done) break;
|
|
90
|
+
const chunk = Buffer.from(value);
|
|
91
|
+
const room = cap - total;
|
|
92
|
+
if (chunk.length > room) {
|
|
93
|
+
chunks.push(chunk.subarray(0, room));
|
|
94
|
+
total += room;
|
|
95
|
+
await reader.cancel().catch(() => {});
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
chunks.push(chunk);
|
|
99
|
+
total += chunk.length;
|
|
100
|
+
}
|
|
101
|
+
return Buffer.concat(chunks, total);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function combineSignals(...signals: Array<AbortSignal | undefined>): AbortSignal | undefined {
|
|
105
|
+
const present = signals.filter((s): s is AbortSignal => Boolean(s));
|
|
106
|
+
if (present.length === 0) return undefined;
|
|
107
|
+
if (present.length === 1) return present[0];
|
|
108
|
+
// `AbortSignal.any` (Node 20+) manages listener cleanup internally; the manual
|
|
109
|
+
// `addEventListener` approach leaked listeners on `ctx.signal` for the lifetime of the agent
|
|
110
|
+
// run when a fetch completed normally.
|
|
111
|
+
return AbortSignal.any(present);
|
|
112
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `schedule_followup` for the built-in agent (#626).
|
|
3
|
+
*
|
|
4
|
+
* Lives on the main thread so it survives worker-thread restarts that happen
|
|
5
|
+
* on code reload. The followup callback is injected from the entry point —
|
|
6
|
+
* this module only schedules the timer and tracks pending entries.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { randomUUID } from 'node:crypto';
|
|
10
|
+
import type { AgentTool, AgentToolContext } from '../types.ts';
|
|
11
|
+
|
|
12
|
+
const MAX_DELAY_MS = 24 * 60 * 60 * 1000; // 24h
|
|
13
|
+
const MIN_DELAY_MS = 1_000;
|
|
14
|
+
|
|
15
|
+
export interface ScheduledFollowup {
|
|
16
|
+
id: string;
|
|
17
|
+
sessionId: string;
|
|
18
|
+
prompt: string;
|
|
19
|
+
fireAt: number;
|
|
20
|
+
timer: NodeJS.Timeout;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ScheduleToolDeps {
|
|
24
|
+
onFollowup: (sessionId: string, prompt: string) => Promise<void> | void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function buildScheduleTool(deps: ScheduleToolDeps): {
|
|
28
|
+
tool: AgentTool;
|
|
29
|
+
pending: Map<string, ScheduledFollowup>;
|
|
30
|
+
} {
|
|
31
|
+
const pending = new Map<string, ScheduledFollowup>();
|
|
32
|
+
const tool: AgentTool = {
|
|
33
|
+
def: {
|
|
34
|
+
name: 'schedule_followup',
|
|
35
|
+
description: 'Re-invoke the agent on the current session after the given delay with a new prompt.',
|
|
36
|
+
parameters: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
delayMs: { type: 'integer', minimum: MIN_DELAY_MS, maximum: MAX_DELAY_MS },
|
|
40
|
+
prompt: { type: 'string', description: 'Prompt the agent should re-enter on with.' },
|
|
41
|
+
},
|
|
42
|
+
required: ['delayMs', 'prompt'],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
handler: async (args: any, ctx: AgentToolContext) => {
|
|
46
|
+
const delay = Number(args.delayMs);
|
|
47
|
+
if (!Number.isFinite(delay) || delay < MIN_DELAY_MS || delay > MAX_DELAY_MS) {
|
|
48
|
+
throw new Error(`delayMs must be between ${MIN_DELAY_MS} and ${MAX_DELAY_MS}`);
|
|
49
|
+
}
|
|
50
|
+
const prompt = String(args.prompt ?? '').trim();
|
|
51
|
+
if (!prompt) throw new Error('prompt is required');
|
|
52
|
+
const id = randomUUID();
|
|
53
|
+
const fireAt = Date.now() + delay;
|
|
54
|
+
const timer = setTimeout(() => {
|
|
55
|
+
pending.delete(id);
|
|
56
|
+
Promise.resolve()
|
|
57
|
+
.then(() => deps.onFollowup(ctx.sessionId, prompt))
|
|
58
|
+
.catch(() => {
|
|
59
|
+
/* swallow — caller logs */
|
|
60
|
+
});
|
|
61
|
+
}, delay);
|
|
62
|
+
timer.unref?.();
|
|
63
|
+
pending.set(id, { id, sessionId: ctx.sessionId, prompt, fireAt, timer });
|
|
64
|
+
return { id, fireAt };
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
return { tool, pending };
|
|
68
|
+
}
|
package/agent/toolset.ts
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool composer for the built-in agent (#626).
|
|
3
|
+
*
|
|
4
|
+
* Operator-only tools (FS, schedule, fetch) are inline today. Once the
|
|
5
|
+
* unified MCP tool registry (#615) lands with the Operations (#617) and
|
|
6
|
+
* Application (#618) profiles, this is the seam where RBAC-filtered
|
|
7
|
+
* registry tools get folded in for the agent's configured user. The shape
|
|
8
|
+
* of {@link composeToolset} won't change — only the body gains a registry
|
|
9
|
+
* lookup.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { fsTools } from './tools/fsTools.ts';
|
|
13
|
+
import { httpFetchTool } from './tools/httpFetchTool.ts';
|
|
14
|
+
import { buildScheduleTool, type ScheduleToolDeps, type ScheduledFollowup } from './tools/scheduleTool.ts';
|
|
15
|
+
import type { AgentTool } from './types.ts';
|
|
16
|
+
|
|
17
|
+
export interface ComposeToolsetOpts extends ScheduleToolDeps {
|
|
18
|
+
/** When `false`, destructive tools are filtered out at composition time. */
|
|
19
|
+
allowDestructive?: boolean;
|
|
20
|
+
/** Operator-injected extras (tests, custom plugins). */
|
|
21
|
+
extraTools?: AgentTool[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ComposedToolset {
|
|
25
|
+
tools: AgentTool[];
|
|
26
|
+
scheduled: Map<string, ScheduledFollowup>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function composeToolset(opts: ComposeToolsetOpts): ComposedToolset {
|
|
30
|
+
const schedule = buildScheduleTool(opts);
|
|
31
|
+
const all: AgentTool[] = [...fsTools, httpFetchTool, schedule.tool, ...(opts.extraTools ?? [])];
|
|
32
|
+
const tools = opts.allowDestructive === false ? all.filter((t) => !t.destructive) : all;
|
|
33
|
+
return { tools, scheduled: schedule.pending };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function toolMapByName(tools: AgentTool[]): Map<string, AgentTool> {
|
|
37
|
+
const map = new Map<string, AgentTool>();
|
|
38
|
+
for (const tool of tools) {
|
|
39
|
+
if (map.has(tool.def.name)) throw new Error(`Duplicate tool registered: ${tool.def.name}`);
|
|
40
|
+
map.set(tool.def.name, tool);
|
|
41
|
+
}
|
|
42
|
+
return map;
|
|
43
|
+
}
|