@harperfast/harper 5.3.0-beta.3 → 5.3.0-beta.4
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/bin/cliOperations.ts +25 -3
- package/bin/run.ts +18 -0
- package/components/Application.ts +52 -78
- package/components/DESIGN.md +76 -3
- package/components/Scope.ts +10 -4
- package/components/anthropic/index.ts +10 -1
- package/components/bedrock/index.ts +10 -1
- package/components/componentLoader.ts +23 -14
- package/components/mcp/tools/operations.ts +3 -1
- package/components/ollama/index.ts +10 -1
- package/components/openai/index.ts +265 -18
- package/components/operations.js +40 -1
- package/config/configUtils.ts +3 -19
- package/dataLayer/DESIGN.md +29 -5
- package/dataLayer/harperBridge/ResourceBridge.ts +39 -3
- package/dataLayer/restoreMarker.ts +250 -14
- package/dataLayer/schema.ts +2 -7
- package/dataLayer/schemaDescribe.ts +10 -0
- package/dist/bin/cliOperations.js +28 -3
- package/dist/bin/cliOperations.js.map +1 -1
- package/dist/bin/run.js +19 -0
- package/dist/bin/run.js.map +1 -1
- package/dist/components/Application.d.ts +8 -2
- package/dist/components/Application.js +43 -69
- package/dist/components/Application.js.map +1 -1
- package/dist/components/Scope.d.ts +1 -1
- package/dist/components/Scope.js +9 -4
- package/dist/components/Scope.js.map +1 -1
- package/dist/components/anthropic/index.d.ts +0 -10
- package/dist/components/anthropic/index.js +9 -1
- package/dist/components/anthropic/index.js.map +1 -1
- package/dist/components/bedrock/index.d.ts +0 -12
- package/dist/components/bedrock/index.js +9 -1
- package/dist/components/bedrock/index.js.map +1 -1
- package/dist/components/componentLoader.js +23 -14
- package/dist/components/componentLoader.js.map +1 -1
- package/dist/components/mcp/tools/operations.js +1 -1
- package/dist/components/mcp/tools/operations.js.map +1 -1
- package/dist/components/ollama/index.d.ts +0 -13
- package/dist/components/ollama/index.js +9 -1
- package/dist/components/ollama/index.js.map +1 -1
- package/dist/components/openai/index.d.ts +11 -15
- package/dist/components/openai/index.js +224 -12
- package/dist/components/openai/index.js.map +1 -1
- package/dist/components/operations.d.ts +9 -0
- package/dist/components/operations.js +32 -2
- package/dist/components/operations.js.map +1 -1
- package/dist/config/configUtils.d.ts +1 -2
- package/dist/config/configUtils.js +7 -22
- package/dist/config/configUtils.js.map +1 -1
- package/dist/dataLayer/harperBridge/ResourceBridge.js +29 -2
- package/dist/dataLayer/harperBridge/ResourceBridge.js.map +1 -1
- package/dist/dataLayer/restoreMarker.d.ts +25 -3
- package/dist/dataLayer/restoreMarker.js +213 -13
- package/dist/dataLayer/restoreMarker.js.map +1 -1
- package/dist/dataLayer/schema.js +1 -4
- package/dist/dataLayer/schema.js.map +1 -1
- package/dist/dataLayer/schemaDescribe.js +10 -0
- package/dist/dataLayer/schemaDescribe.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/json/systemSchema.json +28 -0
- package/dist/resources/DatabaseTransaction.d.ts +21 -1
- package/dist/resources/DatabaseTransaction.js +147 -8
- package/dist/resources/DatabaseTransaction.js.map +1 -1
- package/dist/resources/PrimaryRocksDatabase.js +1 -1
- package/dist/resources/PrimaryRocksDatabase.js.map +1 -1
- package/dist/resources/Table.d.ts +31 -3
- package/dist/resources/Table.js +397 -79
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/auditStore.js +16 -10
- package/dist/resources/auditStore.js.map +1 -1
- package/dist/resources/blob.d.ts +1 -0
- package/dist/resources/blob.js +14 -5
- package/dist/resources/blob.js.map +1 -1
- package/dist/resources/branchDatabase.js +3 -3
- package/dist/resources/branchDatabase.js.map +1 -1
- package/dist/resources/databaseDropPreparation.d.ts +20 -0
- package/dist/resources/databaseDropPreparation.js +106 -0
- package/dist/resources/databaseDropPreparation.js.map +1 -0
- package/dist/resources/databases.d.ts +26 -21
- package/dist/resources/databases.js +1040 -204
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/derivedIndexRegistry.d.ts +23 -0
- package/dist/resources/derivedIndexRegistry.js +92 -0
- package/dist/resources/derivedIndexRegistry.js.map +1 -1
- package/dist/resources/derivedIndexRuntime.d.ts +10 -0
- package/dist/resources/derivedIndexRuntime.js +136 -25
- package/dist/resources/derivedIndexRuntime.js.map +1 -1
- package/dist/resources/derivedIndexes.d.ts +39 -0
- package/dist/resources/derivedIndexes.js +733 -0
- package/dist/resources/derivedIndexes.js.map +1 -0
- package/dist/resources/fullTextSchema.d.ts +8 -0
- package/dist/resources/fullTextSchema.js +42 -0
- package/dist/resources/fullTextSchema.js.map +1 -1
- package/dist/resources/fullTextSchemaLifecycle.d.ts +0 -5
- package/dist/resources/fullTextSchemaLifecycle.js +0 -9
- package/dist/resources/fullTextSchemaLifecycle.js.map +1 -1
- package/dist/resources/graphql.js +101 -9
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/indexes/hnswDerivedIndex.d.ts +0 -10
- package/dist/resources/indexes/hnswDerivedIndex.js +0 -230
- package/dist/resources/indexes/hnswDerivedIndex.js.map +1 -1
- package/dist/resources/indexes/nativeFullTextDerivedIndexLifecycle.d.ts +3 -0
- package/dist/resources/indexes/nativeFullTextDerivedIndexLifecycle.js +57 -8
- package/dist/resources/indexes/nativeFullTextDerivedIndexLifecycle.js.map +1 -1
- package/dist/resources/models/Models.d.ts +26 -3
- package/dist/resources/models/Models.js +256 -13
- package/dist/resources/models/Models.js.map +1 -1
- package/dist/resources/models/TestBackend.d.ts +3 -1
- package/dist/resources/models/TestBackend.js +35 -1
- package/dist/resources/models/TestBackend.js.map +1 -1
- package/dist/resources/models/analyticsTable.d.ts +2 -2
- package/dist/resources/models/analyticsTable.js +4 -2
- package/dist/resources/models/analyticsTable.js.map +1 -1
- package/dist/resources/models/backendHelpers.d.ts +24 -0
- package/dist/resources/models/backendHelpers.js +18 -1
- package/dist/resources/models/backendHelpers.js.map +1 -1
- package/dist/resources/models/backendRegistry.d.ts +10 -21
- package/dist/resources/models/backendRegistry.js +74 -18
- package/dist/resources/models/backendRegistry.js.map +1 -1
- package/dist/resources/models/bootstrap.d.ts +7 -0
- package/dist/resources/models/bootstrap.js +36 -4
- package/dist/resources/models/bootstrap.js.map +1 -1
- package/dist/resources/models/decideHook.d.ts +33 -0
- package/dist/resources/models/decideHook.js +105 -0
- package/dist/resources/models/decideHook.js.map +1 -0
- package/dist/resources/models/decision.d.ts +64 -0
- package/dist/resources/models/decision.js +507 -0
- package/dist/resources/models/decision.js.map +1 -0
- package/dist/resources/models/decisionStore.d.ts +134 -0
- package/dist/resources/models/decisionStore.js +350 -0
- package/dist/resources/models/decisionStore.js.map +1 -0
- package/dist/resources/models/embedHook.d.ts +66 -8
- package/dist/resources/models/embedHook.js +228 -61
- package/dist/resources/models/embedHook.js.map +1 -1
- package/dist/resources/models/generativeDecision.d.ts +58 -0
- package/dist/resources/models/generativeDecision.js +315 -0
- package/dist/resources/models/generativeDecision.js.map +1 -0
- package/dist/resources/models/types.d.ts +232 -4
- package/dist/security/authn/oidc/tokenExchange.js +3 -33
- package/dist/security/authn/oidc/tokenExchange.js.map +1 -1
- package/dist/security/authn/oidc/tokenUseTable.d.ts +9 -0
- package/dist/security/authn/oidc/tokenUseTable.js +28 -0
- package/dist/security/authn/oidc/tokenUseTable.js.map +1 -0
- package/dist/security/certificateVerification/certificateVerificationSource.d.ts +0 -1
- package/dist/security/certificateVerification/certificateVerificationSource.js +3 -3
- package/dist/security/certificateVerification/certificateVerificationSource.js.map +1 -1
- package/dist/security/certificateVerification/crlVerification.js +77 -165
- package/dist/security/certificateVerification/crlVerification.js.map +1 -1
- package/dist/security/certificateVerification/types.d.ts +0 -3
- package/dist/security/certificateVerification/verificationTables.d.ts +19 -0
- package/dist/security/certificateVerification/verificationTables.js +125 -0
- package/dist/security/certificateVerification/verificationTables.js.map +1 -0
- package/dist/security/certificateVerification/verificationUtils.d.ts +1 -1
- package/dist/security/certificateVerification/verificationUtils.js +6 -31
- package/dist/security/certificateVerification/verificationUtils.js.map +1 -1
- package/dist/security/jsLoader.d.ts +5 -0
- package/dist/security/jsLoader.js +8 -0
- package/dist/security/jsLoader.js.map +1 -1
- package/dist/server/Server.d.ts +1 -0
- package/dist/server/Server.js.map +1 -1
- package/dist/server/http.js +2 -2
- package/dist/server/http.js.map +1 -1
- package/dist/server/itc/serverHandlers.js +21 -2
- package/dist/server/itc/serverHandlers.js.map +1 -1
- package/dist/server/jobs/jobOwnership.d.ts +25 -0
- package/dist/server/jobs/jobOwnership.js +127 -0
- package/dist/server/jobs/jobOwnership.js.map +1 -0
- package/dist/server/jobs/jobProcess.js +9 -2
- package/dist/server/jobs/jobProcess.js.map +1 -1
- package/dist/server/jobs/jobs.js +18 -5
- package/dist/server/jobs/jobs.js.map +1 -1
- package/dist/server/loadRootComponents.js +10 -0
- package/dist/server/loadRootComponents.js.map +1 -1
- package/dist/server/serverHelpers/contentTypes.js +11 -1
- package/dist/server/serverHelpers/contentTypes.js.map +1 -1
- package/dist/server/serverHelpers/serverHandlers.js +12 -2
- package/dist/server/serverHelpers/serverHandlers.js.map +1 -1
- package/dist/server/threads/itc.d.ts +4 -1
- package/dist/server/threads/itc.js +29 -6
- package/dist/server/threads/itc.js.map +1 -1
- package/dist/server/threads/manageThreads.d.ts +12 -4
- package/dist/server/threads/manageThreads.js +241 -119
- package/dist/server/threads/manageThreads.js.map +1 -1
- package/dist/server/threads/threadServer.d.ts +1 -0
- package/dist/server/threads/threadServer.js +15 -1
- package/dist/server/threads/threadServer.js.map +1 -1
- package/dist/server/threads/windowsProcessTree.d.ts +91 -0
- package/dist/server/threads/windowsProcessTree.js +361 -0
- package/dist/server/threads/windowsProcessTree.js.map +1 -0
- package/dist/server/throttle.d.ts +1 -1
- package/dist/server/throttle.js +8 -1
- package/dist/server/throttle.js.map +1 -1
- package/dist/upgrade/directives/5-3-0.js +53 -46
- package/dist/upgrade/directives/5-3-0.js.map +1 -1
- package/dist/utility/errors/hdbError.d.ts +10 -1
- package/dist/utility/errors/hdbError.js +55 -11
- package/dist/utility/errors/hdbError.js.map +1 -1
- package/dist/utility/fsync.d.ts +2 -0
- package/dist/utility/fsync.js +20 -0
- package/dist/utility/fsync.js.map +1 -0
- package/dist/utility/globalSchema.d.ts +18 -0
- package/dist/utility/hdbTerms.d.ts +3 -0
- package/dist/utility/hdbTerms.js +3 -0
- package/dist/utility/hdbTerms.js.map +1 -1
- package/dist/utility/signalling.d.ts +7 -1
- package/dist/utility/signalling.js +27 -3
- package/dist/utility/signalling.js.map +1 -1
- package/dist/utility/when.d.ts +1 -0
- package/dist/utility/when.js +21 -0
- package/dist/utility/when.js.map +1 -1
- package/dist/validation/configValidator.js +30 -3
- package/dist/validation/configValidator.js.map +1 -1
- package/index.ts +13 -0
- package/json/systemSchema.json +28 -0
- package/npm-shrinkwrap.json +151 -55
- package/package.json +14 -13
- package/resources/DESIGN.md +80 -100
- package/resources/DatabaseTransaction.ts +157 -10
- package/resources/PrimaryRocksDatabase.ts +2 -2
- package/resources/Table.ts +494 -101
- package/resources/auditStore.ts +18 -10
- package/resources/blob.ts +13 -6
- package/resources/branchDatabase.ts +3 -3
- package/resources/databaseDropPreparation.ts +120 -0
- package/resources/databases.ts +1155 -205
- package/resources/derivedIndexRegistry.ts +122 -0
- package/resources/derivedIndexRuntime.ts +157 -30
- package/resources/derivedIndexes.ts +856 -0
- package/resources/fullTextSchema.ts +55 -0
- package/resources/fullTextSchemaLifecycle.ts +0 -15
- package/resources/graphql.ts +107 -12
- package/resources/indexes/DESIGN.md +7 -0
- package/resources/indexes/hnswDerivedIndex.ts +0 -260
- package/resources/indexes/nativeFullTextDerivedIndexLifecycle.ts +72 -9
- package/resources/models/DESIGN.md +39 -0
- package/resources/models/Models.ts +361 -18
- package/resources/models/TestBackend.ts +56 -1
- package/resources/models/analyticsTable.ts +6 -4
- package/resources/models/backendHelpers.ts +17 -0
- package/resources/models/backendRegistry.ts +76 -21
- package/resources/models/bootstrap.ts +57 -7
- package/resources/models/decideHook.ts +135 -0
- package/resources/models/decision.ts +505 -0
- package/resources/models/decisionStore.ts +419 -0
- package/resources/models/embedHook.ts +272 -55
- package/resources/models/generativeDecision.ts +459 -0
- package/resources/models/types.ts +231 -4
- package/security/DESIGN.md +22 -2
- package/security/authn/oidc/tokenExchange.ts +6 -34
- package/security/authn/oidc/tokenUseTable.ts +27 -0
- package/security/certificateVerification/certificateVerificationSource.ts +2 -3
- package/security/certificateVerification/crlVerification.ts +96 -174
- package/security/certificateVerification/types.ts +0 -3
- package/security/certificateVerification/verificationTables.ts +124 -0
- package/security/certificateVerification/verificationUtils.ts +8 -32
- package/security/jsLoader.ts +9 -1
- package/server/DESIGN.md +27 -1
- package/server/Server.ts +2 -1
- package/server/http.ts +4 -2
- package/server/itc/serverHandlers.js +29 -1
- package/server/jobs/jobOwnership.ts +89 -0
- package/server/jobs/jobProcess.ts +8 -2
- package/server/jobs/jobs.ts +15 -4
- package/server/loadRootComponents.js +11 -0
- package/server/serverHelpers/contentTypes.ts +13 -1
- package/server/serverHelpers/serverHandlers.js +11 -2
- package/server/threads/itc.js +32 -6
- package/server/threads/manageThreads.js +268 -122
- package/server/threads/threadServer.js +13 -1
- package/server/threads/windowsProcessTree.ts +409 -0
- package/server/throttle.ts +11 -1
- package/studio/web/assets/{Chat-CveGbxe6.js → Chat-Bq60AO-g.js} +1 -1
- package/studio/web/assets/{FloatingChat-IpCFgYWL.js → FloatingChat-D4560T0p.js} +3 -3
- package/studio/web/assets/{apiToken-CS8fFTgL.js → apiToken-BEvbFPMc.js} +1 -1
- package/studio/web/assets/{applications-D7F4Jopl.js → applications-CSUVTH4E.js} +1 -1
- package/studio/web/assets/{cssMode-Daw_oLPq.js → cssMode-DJyc9mHj.js} +1 -1
- package/studio/web/assets/{editor-B3Bs1zWX.js → editor-DDIsQfj6.js} +1 -1
- package/studio/web/assets/{html-CDaQwWiE.js → html-g1BJHxLy.js} +1 -1
- package/studio/web/assets/{htmlMode-Cb6emO4U.js → htmlMode-Vh5IglCQ.js} +1 -1
- package/studio/web/assets/{index-B4g2Fu_2.js → index-DGRAzvO4.js} +5 -5
- package/studio/web/assets/{index.lazy-NwhvF1q1.js → index.lazy-vgSic7et.js} +1 -1
- package/studio/web/assets/{javascript-2_86gB9Q.js → javascript-5VIolqf7.js} +1 -1
- package/studio/web/assets/{jsonMode-DX-i86uQ.js → jsonMode-DG4zQraI.js} +1 -1
- package/studio/web/assets/{languageServices-B85WN-Ej.js → languageServices-t5FBpX-i.js} +1 -1
- package/studio/web/assets/{lspLanguageFeatures-JCWHIsKg.js → lspLanguageFeatures-DgVnNPh-.js} +1 -1
- package/studio/web/assets/{notifications-D9ejzt52.js → notifications-BeWcX04m.js} +1 -1
- package/studio/web/assets/{notifications-B7hjKhai.js → notifications-DUGWrWoO.js} +1 -1
- package/studio/web/assets/{profile-D8B6No3F.js → profile-BvUEDBzW.js} +1 -1
- package/studio/web/assets/{regions-DFazIfTK.js → regions-CB-_2m7M.js} +1 -1
- package/studio/web/assets/{register-CwFLviLF.js → register-1w1Zr3b2.js} +2 -2
- package/studio/web/assets/{setComponentFile-VnJ80SSJ.js → setComponentFile-z4-qJCbA.js} +1 -1
- package/studio/web/assets/{setup-BYQxFy-C.js → setup-CS50uJ4x.js} +2 -2
- package/studio/web/assets/{status-Cn5XjmsL.js → status-CI0wOdOE.js} +1 -1
- package/studio/web/assets/{toggleHighContrast-g9xIh6TX.js → toggleHighContrast-BsAE4jPe.js} +1 -1
- package/studio/web/assets/{tsMode-EC-n0Wqc.js → tsMode-D83Gg3cq.js} +1 -1
- package/studio/web/assets/{typescript-DHmM9JCO.js → typescript-Dfp-GrNq.js} +1 -1
- package/studio/web/assets/{useEntityRestURL-BUdnVSVv.js → useEntityRestURL-BKetlINf.js} +1 -1
- package/studio/web/assets/{workers-BVl9bBB-.js → workers-CCvmDLH3.js} +1 -1
- package/studio/web/assets/{xml-C4_sqOkX.js → xml-06pZp00U.js} +1 -1
- package/studio/web/assets/{yaml-CVkbDqtW.js → yaml-iSnWMVlV.js} +1 -1
- package/studio/web/index.html +1 -1
- package/upgrade/directives/5-3-0.ts +61 -54
- package/utility/DESIGN.md +5 -1
- package/utility/errors/hdbError.ts +56 -8
- package/utility/fsync.ts +16 -0
- package/utility/hdbTerms.ts +3 -0
- package/utility/signalling.ts +33 -4
- package/utility/when.ts +22 -0
- package/validation/configValidator.ts +36 -7
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.WINDOWS_TREE_POLL_MS = exports.ROOT_SPAWN_ALLOWANCE_MS = void 0;
|
|
37
|
+
exports.queryWindowsProcessTable = queryWindowsProcessTable;
|
|
38
|
+
exports.parseProcessTable = parseProcessTable;
|
|
39
|
+
exports.findWindowsTreeRoot = findWindowsTreeRoot;
|
|
40
|
+
exports.selectWindowsProcessTree = selectWindowsProcessTree;
|
|
41
|
+
exports.taskkillInvocation = taskkillInvocation;
|
|
42
|
+
exports.runTaskkill = runTaskkill;
|
|
43
|
+
exports.confirmWindowsProcessTreeGone = confirmWindowsProcessTreeGone;
|
|
44
|
+
const node_child_process_1 = require("node:child_process");
|
|
45
|
+
const promises_1 = require("node:timers/promises");
|
|
46
|
+
const harperLogger = __importStar(require("../../utility/logging/harper_logger.js"));
|
|
47
|
+
// Date.now() and Win32_Process.CreationDate read the same system clock; this covers its resolution.
|
|
48
|
+
const CLOCK_SKEW_MS = 50;
|
|
49
|
+
// The root is created inside the `spawn` call, so the interval measured around that call is the
|
|
50
|
+
// exact bound on how much earlier than `rootKnownAt` it may have started. This is the fallback for a
|
|
51
|
+
// registration that carried no such interval: a stall between the two — an event loop pause, never
|
|
52
|
+
// a network hop.
|
|
53
|
+
exports.ROOT_SPAWN_ALLOWANCE_MS = 1_000;
|
|
54
|
+
exports.WINDOWS_TREE_POLL_MS = 25;
|
|
55
|
+
const WINDOWS_TREE_POLL_MAX_MS = 5_000;
|
|
56
|
+
const WINDOWS_TREE_WARNING_MS = 5_000;
|
|
57
|
+
const WINDOWS_TREE_WARNING_INTERVAL_MS = 60_000;
|
|
58
|
+
// Neither helper below is allowed to suspend the confirmation loop indefinitely. The loop itself is
|
|
59
|
+
// deliberately deadline-free (harper#2076: the preparation lock is never released on an unconfirmed
|
|
60
|
+
// tree), but that policy is about the DECISION, not about a single syscall: a `Get-CimInstance` or
|
|
61
|
+
// `taskkill` that never returns parks the loop before it can warn, so an operator sees a silent
|
|
62
|
+
// wedge instead of the 60 s "could not be queried" message the unknown state already produces.
|
|
63
|
+
// Bounding each invocation converts a hung helper into that same unknown, which keeps waiting.
|
|
64
|
+
const WINDOWS_TREE_HELPER_TIMEOUT_MS = 30_000;
|
|
65
|
+
// Exit 0 means the query ran and produced a table (possibly empty — an empty table is still a
|
|
66
|
+
// positive result, not "unknown"); exit 2 means the query itself failed (e.g. Get-CimInstance
|
|
67
|
+
// denied or WMI unavailable), which ErrorActionPreference=Stop plus the wrapping try/catch turns
|
|
68
|
+
// into that distinct code instead of a false-empty result, and `queryWindowsProcessTable` reads
|
|
69
|
+
// anything but 0 as "could not read the table" (null), never as "positively found nothing".
|
|
70
|
+
const PROCESS_TABLE_SCRIPT = "$ErrorActionPreference = 'Stop'; try { " +
|
|
71
|
+
'$rows = @(Get-CimInstance Win32_Process | ForEach-Object { [pscustomobject]@{ ' +
|
|
72
|
+
'pid = [int]$_.ProcessId; ppid = [int]$_.ParentProcessId; name = [string]$_.Name; ' +
|
|
73
|
+
'created = if ($_.CreationDate) { [DateTimeOffset]::new($_.CreationDate).ToUnixTimeMilliseconds() } else { $null } } }); ' +
|
|
74
|
+
'[Console]::Out.Write((ConvertTo-Json -Compress -InputObject $rows)); exit 0 ' +
|
|
75
|
+
'} catch { exit 2 }';
|
|
76
|
+
function queryWindowsProcessTable(timeoutMs = WINDOWS_TREE_HELPER_TIMEOUT_MS) {
|
|
77
|
+
return new Promise((resolve) => {
|
|
78
|
+
const query = (0, node_child_process_1.spawn)('powershell.exe', ['-NoLogo', '-NoProfile', '-NonInteractive', '-Command', PROCESS_TABLE_SCRIPT], {
|
|
79
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
80
|
+
windowsHide: true,
|
|
81
|
+
});
|
|
82
|
+
let output = '';
|
|
83
|
+
// utf8 so the decoder buffers a multi-byte character split across a chunk boundary — a
|
|
84
|
+
// process name has arbitrary Unicode — instead of coercing each half's raw bytes separately
|
|
85
|
+
query.stdout.setEncoding('utf8');
|
|
86
|
+
query.stdout.on('data', (chunk) => {
|
|
87
|
+
output += chunk;
|
|
88
|
+
});
|
|
89
|
+
const abandon = setTimeout(() => {
|
|
90
|
+
query.kill();
|
|
91
|
+
resolve(null); // unknown, exactly as an unreadable table: the caller keeps waiting
|
|
92
|
+
}, timeoutMs);
|
|
93
|
+
abandon.unref?.();
|
|
94
|
+
const settle = (value) => {
|
|
95
|
+
clearTimeout(abandon);
|
|
96
|
+
resolve(value);
|
|
97
|
+
};
|
|
98
|
+
query.once('close', (code) => settle(code === 0 ? parseProcessTable(output) : null));
|
|
99
|
+
query.once('error', () => settle(null));
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
function parseProcessTable(json) {
|
|
103
|
+
let rows;
|
|
104
|
+
try {
|
|
105
|
+
rows = JSON.parse(json.replace(/^\uFEFF/, ''));
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
if (rows === null || typeof rows !== 'object')
|
|
111
|
+
return null;
|
|
112
|
+
const table = [];
|
|
113
|
+
for (const row of Array.isArray(rows) ? rows : [rows]) {
|
|
114
|
+
const { pid, ppid, created, name } = (row ?? {});
|
|
115
|
+
if (!Number.isInteger(pid) || !Number.isInteger(ppid))
|
|
116
|
+
return null;
|
|
117
|
+
table.push({
|
|
118
|
+
pid: pid,
|
|
119
|
+
ppid: ppid,
|
|
120
|
+
created: Number.isFinite(created) ? created : null,
|
|
121
|
+
name: typeof name === 'string' ? name : undefined,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return table;
|
|
125
|
+
}
|
|
126
|
+
function findWindowsTreeRoot(table, identity) {
|
|
127
|
+
if (identity.rootExitedAt !== undefined)
|
|
128
|
+
return undefined;
|
|
129
|
+
const root = table.find((process) => process.pid === identity.rootPid);
|
|
130
|
+
if (!root || root.created === null)
|
|
131
|
+
return undefined;
|
|
132
|
+
// Once a scan has pinned the root's exact creation time, a later row at the same PID is ours only
|
|
133
|
+
// if it matches exactly — same as a remembered descendant (line ~223). Without that pin, a
|
|
134
|
+
// replacement created within the clock-skew window of `rootKnownAt` would otherwise pass the loose
|
|
135
|
+
// upper-bound check below, which only rules out a replacement created too late to be ours, not one
|
|
136
|
+
// created too early (the original having already exited and been recycled inside that window).
|
|
137
|
+
if (identity.rootCreatedAt !== undefined)
|
|
138
|
+
return root.created === identity.rootCreatedAt ? root : undefined;
|
|
139
|
+
if (root.created <= identity.rootKnownAt + CLOCK_SKEW_MS)
|
|
140
|
+
return root;
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* The processes in `table` that belong to the tree rooted at `identity.rootPid`. The root counts
|
|
145
|
+
* only while it still runs and is the process we spawned (created no later than we first knew
|
|
146
|
+
* it); a child counts only if it was created while its parent lived — after the root's own
|
|
147
|
+
* creation where that was observed, and before its exit — so nothing that merely inherited a
|
|
148
|
+
* recycled PID or ParentProcessId is included.
|
|
149
|
+
*/
|
|
150
|
+
function selectWindowsProcessTree(table, identity, now = Date.now()) {
|
|
151
|
+
const members = [];
|
|
152
|
+
const seen = new Set();
|
|
153
|
+
const root = findWindowsTreeRoot(table, identity);
|
|
154
|
+
// Only reserve the root's PID once it is verified as ours — once the root has exited, a live
|
|
155
|
+
// descendant that Windows hands that freed PID is a legitimate child of some other frontier
|
|
156
|
+
// member, and must still be reachable through the frontier walk below.
|
|
157
|
+
if (root) {
|
|
158
|
+
seen.add(identity.rootPid);
|
|
159
|
+
members.push(root);
|
|
160
|
+
}
|
|
161
|
+
const rootCreatedAt = root?.created ?? identity.rootCreatedAt;
|
|
162
|
+
// A row now holding `pid` that could not possibly be the member we are bounding — created after
|
|
163
|
+
// the latest moment a genuine one could have been — proves the PID was already recycled by then,
|
|
164
|
+
// tighter than a "gone" conclusion that only arrives once a scan stops observing the member at
|
|
165
|
+
// all (for a remembered descendant that can be a whole backed-off poll late; for the root, the
|
|
166
|
+
// scan that first fails to find it still uses this frontier before its exit is stamped —
|
|
167
|
+
// `confirmWindowsProcessTreeGone` below only latches `rootExitedAt` after this call returns).
|
|
168
|
+
// `oursNoLaterThan` for a descendant is its exact known creation time; for the root it is the
|
|
169
|
+
// latest creation `findWindowsTreeRoot` would still have accepted as ours, so a row this cannot
|
|
170
|
+
// exonerate is never treated as a false impostor of a root we simply haven't re-confirmed yet.
|
|
171
|
+
const impostorCreatedAt = (pid, oursNoLaterThan) => {
|
|
172
|
+
const impostor = table.find((process) => process.pid === pid && process.created !== null && process.created > oursNoLaterThan);
|
|
173
|
+
return impostor?.created;
|
|
174
|
+
};
|
|
175
|
+
let frontier = [
|
|
176
|
+
{
|
|
177
|
+
pid: identity.rootPid,
|
|
178
|
+
notBefore: rootCreatedAt === undefined || rootCreatedAt === null
|
|
179
|
+
? // our own clock against WMI's, so it carries the skew allowance
|
|
180
|
+
identity.rootKnownAt - (identity.rootStartedWithinMs ?? exports.ROOT_SPAWN_ALLOWANCE_MS) - CLOCK_SKEW_MS
|
|
181
|
+
: // WMI's clock against itself: a process created before the one whose PID it names as its
|
|
182
|
+
// parent was created by an earlier holder of that PID, so it is never ours
|
|
183
|
+
rootCreatedAt,
|
|
184
|
+
notAfter: Math.min(
|
|
185
|
+
// this bound is our own clock against WMI's, so it carries the skew allowance
|
|
186
|
+
(identity.rootExitedAt ?? now) + CLOCK_SKEW_MS,
|
|
187
|
+
// this one is WMI's clock against itself: the replacement's creation time is exactly when
|
|
188
|
+
// the PID stopped being ours, so anything it went on to create is a stranger's, not ours
|
|
189
|
+
(impostorCreatedAt(identity.rootPid, rootCreatedAt ?? identity.rootKnownAt + CLOCK_SKEW_MS) ?? Infinity) - 1),
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
// A member an earlier scan found is still one — by PID and creation time — after the parent
|
|
193
|
+
// that linked it to the root has exited and left no row to walk through; its children are
|
|
194
|
+
// bounded by its lifetime like any other member's, latched from the scan that first lost it.
|
|
195
|
+
for (const [pid, known] of identity.descendants ?? []) {
|
|
196
|
+
if (seen.has(pid))
|
|
197
|
+
continue;
|
|
198
|
+
const live = table.find((process) => process.pid === pid && process.created === known.created);
|
|
199
|
+
if (live) {
|
|
200
|
+
seen.add(pid);
|
|
201
|
+
members.push(live);
|
|
202
|
+
frontier.push({ pid, notBefore: known.created, notAfter: Infinity });
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
frontier.push({
|
|
206
|
+
pid,
|
|
207
|
+
notBefore: known.created,
|
|
208
|
+
notAfter: Math.min((known.exitedAt ?? now) + CLOCK_SKEW_MS, (impostorCreatedAt(pid, known.created) ?? Infinity) - 1),
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
while (frontier.length > 0) {
|
|
213
|
+
const next = [];
|
|
214
|
+
for (const parent of frontier) {
|
|
215
|
+
for (const process of table) {
|
|
216
|
+
if (process.ppid !== parent.pid || seen.has(process.pid) || process.created === null)
|
|
217
|
+
continue;
|
|
218
|
+
if (process.created < parent.notBefore || process.created > parent.notAfter)
|
|
219
|
+
continue;
|
|
220
|
+
seen.add(process.pid);
|
|
221
|
+
members.push(process);
|
|
222
|
+
next.push({ pid: process.pid, notBefore: process.created, notAfter: Infinity });
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
frontier = next;
|
|
226
|
+
}
|
|
227
|
+
return members;
|
|
228
|
+
}
|
|
229
|
+
// `CreateProcess` rejects a command line over 8191 characters, and the rejection surfaces as a
|
|
230
|
+
// spawn error this module deliberately absorbs — so a tree with enough orphans would be "killed"
|
|
231
|
+
// by a command that never ran, and the wait would never end. At ~11 characters per `/pid NNNNN`
|
|
232
|
+
// this is an order of magnitude inside the limit.
|
|
233
|
+
const TASKKILL_PIDS_PER_INVOCATION = 200;
|
|
234
|
+
/**
|
|
235
|
+
* The taskkill argument lists that terminate `members`: the whole tree through the root while the
|
|
236
|
+
* root itself is still ours — never also by descendant PID in the same round, since `/T` frees
|
|
237
|
+
* those PIDs before a second invocation could run — and otherwise every member by its own PID,
|
|
238
|
+
* which is safe only because the root's PID is then no longer ours to `/T`. Per-PID kills are
|
|
239
|
+
* batched, since one command line cannot name an unbounded number of them.
|
|
240
|
+
*/
|
|
241
|
+
function taskkillInvocation(members, rootPid) {
|
|
242
|
+
if (members.length === 0)
|
|
243
|
+
return null;
|
|
244
|
+
if (members.some((member) => member.pid === rootPid))
|
|
245
|
+
return [['/pid', String(rootPid), '/T', '/F']];
|
|
246
|
+
const invocations = [];
|
|
247
|
+
for (let i = 0; i < members.length; i += TASKKILL_PIDS_PER_INVOCATION) {
|
|
248
|
+
const batch = members.slice(i, i + TASKKILL_PIDS_PER_INVOCATION);
|
|
249
|
+
invocations.push(['/F', ...batch.flatMap((member) => ['/pid', String(member.pid)])]);
|
|
250
|
+
}
|
|
251
|
+
return invocations;
|
|
252
|
+
}
|
|
253
|
+
function runTaskkill(args, timeoutMs = WINDOWS_TREE_HELPER_TIMEOUT_MS) {
|
|
254
|
+
return new Promise((resolve) => {
|
|
255
|
+
const taskkill = (0, node_child_process_1.spawn)('taskkill', args, { stdio: 'ignore', windowsHide: true });
|
|
256
|
+
const abandon = setTimeout(() => {
|
|
257
|
+
taskkill.kill();
|
|
258
|
+
resolve(); // the next round reissues it; nothing here reads a kill as proof of anything
|
|
259
|
+
}, timeoutMs);
|
|
260
|
+
abandon.unref?.();
|
|
261
|
+
const settle = () => {
|
|
262
|
+
clearTimeout(abandon);
|
|
263
|
+
resolve();
|
|
264
|
+
};
|
|
265
|
+
taskkill.once('close', settle);
|
|
266
|
+
taskkill.once('error', settle);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
async function killWindowsProcesses(members, rootPid) {
|
|
270
|
+
for (const args of taskkillInvocation(members, rootPid) ?? [])
|
|
271
|
+
await runTaskkill(args);
|
|
272
|
+
}
|
|
273
|
+
function rememberDescendants(identity, members, scannedAt, root) {
|
|
274
|
+
const descendants = (identity.descendants ??= new Map());
|
|
275
|
+
for (const member of members) {
|
|
276
|
+
// Skip only the verified root row itself (its lifetime is tracked separately via
|
|
277
|
+
// rootCreatedAt/rootExitedAt) — not every member sharing its PID number. Once the root has
|
|
278
|
+
// exited, a live descendant that Windows hands that freed PID is a distinct incarnation,
|
|
279
|
+
// identified by its own (pid, created) pair, and must be remembered like any other descendant
|
|
280
|
+
// so a later scan can still find it and its own children.
|
|
281
|
+
if (member === root || member.created === null)
|
|
282
|
+
continue;
|
|
283
|
+
if (descendants.get(member.pid)?.created !== member.created)
|
|
284
|
+
descendants.set(member.pid, { created: member.created });
|
|
285
|
+
}
|
|
286
|
+
for (const [pid, known] of descendants) {
|
|
287
|
+
if (known.exitedAt !== undefined)
|
|
288
|
+
continue;
|
|
289
|
+
if (!members.some((member) => member.pid === pid && member.created === known.created))
|
|
290
|
+
known.exitedAt = scannedAt;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function describeMembers(members) {
|
|
294
|
+
return members
|
|
295
|
+
.map((member) => `${member.pid}${member.name ? ` (${member.name})` : ''} created ${member.created === null ? 'unknown' : new Date(member.created).toISOString()}`)
|
|
296
|
+
.join(', ');
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Terminate every remaining member of the tree and resolve once a scan positively finds none.
|
|
300
|
+
* There is deliberately no deadline: releasing a component's preparation lock while a descendant
|
|
301
|
+
* can still mutate its directory is less safe than keeping that deployment wedged for operator
|
|
302
|
+
* intervention — but the wait is logged, so a wedge names the process holding it, and the poll
|
|
303
|
+
* backs off so a wedge does not spin the process table query. A scan that cannot read the table
|
|
304
|
+
* (null) is unknown, not gone, and keeps the wait going.
|
|
305
|
+
*/
|
|
306
|
+
async function confirmWindowsProcessTreeGone(identity, options = {}) {
|
|
307
|
+
const scan = options.scan ?? queryWindowsProcessTable;
|
|
308
|
+
const kill = options.kill ?? killWindowsProcesses;
|
|
309
|
+
const now = options.now ?? Date.now;
|
|
310
|
+
const warn = options.warn ?? ((message) => harperLogger.warn(message));
|
|
311
|
+
const maxPollMs = options.maxPollMs ?? WINDOWS_TREE_POLL_MAX_MS;
|
|
312
|
+
let pollMs = options.pollMs ?? exports.WINDOWS_TREE_POLL_MS;
|
|
313
|
+
const label = options.label ?? `pid ${identity.rootPid}`;
|
|
314
|
+
const startedAt = now();
|
|
315
|
+
let nextWarningAt = startedAt + WINDOWS_TREE_WARNING_MS;
|
|
316
|
+
for (;;) {
|
|
317
|
+
const table = await scan();
|
|
318
|
+
let members = null;
|
|
319
|
+
let rootIdentityUnknown;
|
|
320
|
+
if (table !== null) {
|
|
321
|
+
const scannedAt = now();
|
|
322
|
+
const root = findWindowsTreeRoot(table, identity);
|
|
323
|
+
rootIdentityUnknown =
|
|
324
|
+
identity.rootExitedAt === undefined
|
|
325
|
+
? table.find((process) => process.pid === identity.rootPid && process.created === null)
|
|
326
|
+
: undefined;
|
|
327
|
+
if (rootIdentityUnknown) {
|
|
328
|
+
members = selectWindowsProcessTree(table, identity, scannedAt).filter((member) => identity.descendants?.get(member.pid)?.created === member.created);
|
|
329
|
+
}
|
|
330
|
+
else {
|
|
331
|
+
if (root && identity.rootCreatedAt === undefined)
|
|
332
|
+
identity.rootCreatedAt = root.created;
|
|
333
|
+
members = selectWindowsProcessTree(table, identity, scannedAt);
|
|
334
|
+
// The root's PID is reusable the moment it exits, so from the first scan that no longer finds
|
|
335
|
+
// it running as ours, nothing created later can be its child. Stamped after the scan: the
|
|
336
|
+
// snapshot may predate the stamp, and a bound that is late keeps waiting, which is the safe
|
|
337
|
+
// direction. The same goes for every other member.
|
|
338
|
+
if (!root && identity.rootExitedAt === undefined)
|
|
339
|
+
identity.rootExitedAt = scannedAt;
|
|
340
|
+
rememberDescendants(identity, members, scannedAt, root);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
if (!rootIdentityUnknown && members?.length === 0)
|
|
344
|
+
return;
|
|
345
|
+
if (members?.length)
|
|
346
|
+
await kill(members, identity.rootPid);
|
|
347
|
+
const time = now();
|
|
348
|
+
if (time >= nextWarningAt) {
|
|
349
|
+
warn(`Termination of the process tree of ${label} remains unconfirmed after ${Math.round(time - startedAt)}ms: ` +
|
|
350
|
+
(rootIdentityUnknown
|
|
351
|
+
? `root pid ${identity.rootPid} is held by ${rootIdentityUnknown.name ?? 'an unnamed process'} without a creation time`
|
|
352
|
+
: members
|
|
353
|
+
? `live members ${describeMembers(members)}`
|
|
354
|
+
: 'the Windows process table could not be queried'));
|
|
355
|
+
nextWarningAt = time + WINDOWS_TREE_WARNING_INTERVAL_MS;
|
|
356
|
+
}
|
|
357
|
+
await (0, promises_1.setTimeout)(pollMs);
|
|
358
|
+
pollMs = Math.min(pollMs * 2, maxPollMs);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=windowsProcessTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"windowsProcessTree.js","sourceRoot":"","sources":["../../../server/threads/windowsProcessTree.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqGA,4DA+BC;AAED,8CAoBC;AAED,kDAeC;AASD,4DAqFC;AAeD,gDASC;AAED,kCAeC;AA8CD,sEAwDC;AAxZD,2DAA2C;AAC3C,mDAA2D;AAC3D,qFAAuE;AAmEvE,oGAAoG;AACpG,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,gGAAgG;AAChG,qGAAqG;AACrG,mGAAmG;AACnG,iBAAiB;AACJ,QAAA,uBAAuB,GAAG,KAAK,CAAC;AAChC,QAAA,oBAAoB,GAAG,EAAE,CAAC;AACvC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,uBAAuB,GAAG,KAAK,CAAC;AACtC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAChD,oGAAoG;AACpG,oGAAoG;AACpG,mGAAmG;AACnG,gGAAgG;AAChG,+FAA+F;AAC/F,+FAA+F;AAC/F,MAAM,8BAA8B,GAAG,MAAM,CAAC;AAE9C,8FAA8F;AAC9F,8FAA8F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YACF,aAAa,GAAG,IAAI,GAAG,gCAAgC,CAAC;QACzD,CAAC;QACD,MAAM,IAAA,qBAAK,EAAC,MAAM,CAAC,CAAC;QACpB,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC;AACF,CAAC"}
|
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
* @param onLimitExceeded
|
|
5
5
|
* @param maxQueueTimeLimit
|
|
6
6
|
*/
|
|
7
|
-
export declare function throttle(fn: (...args: any) => any, onLimitExceeded?: (...args: any) => any, maxQueueTimeLimit?: number): (...args: any[]) => any;
|
|
7
|
+
export declare function throttle(fn: (...args: any) => any, onLimitExceeded?: (...args: any) => any, maxQueueTimeLimit?: number, name?: string): (...args: any[]) => any;
|
package/dist/server/throttle.js
CHANGED
|
@@ -8,6 +8,7 @@ const DEFAULT_MAX_QUEUE_TIME = 20_000; // 20 seconds
|
|
|
8
8
|
let lastWarning = 0;
|
|
9
9
|
const WARNING_INTERVAL = 30000;
|
|
10
10
|
const EVENT_QUEUE_MONITORING_INTERVAL = 3000;
|
|
11
|
+
const LIMIT_EXCEEDED_LOG_INTERVAL = 5000;
|
|
11
12
|
let lastEventQueueCheck = performance.now() + EVENT_QUEUE_MONITORING_INTERVAL;
|
|
12
13
|
let averageEventCycleTime = 0;
|
|
13
14
|
/**
|
|
@@ -16,12 +17,18 @@ let averageEventCycleTime = 0;
|
|
|
16
17
|
* @param onLimitExceeded
|
|
17
18
|
* @param maxQueueTimeLimit
|
|
18
19
|
*/
|
|
19
|
-
function throttle(fn, onLimitExceeded, maxQueueTimeLimit = DEFAULT_MAX_QUEUE_TIME) {
|
|
20
|
+
function throttle(fn, onLimitExceeded, maxQueueTimeLimit = DEFAULT_MAX_QUEUE_TIME, name) {
|
|
20
21
|
let queuedCalls;
|
|
22
|
+
let lastLimitExceededLog = -Infinity;
|
|
21
23
|
return function (...args) {
|
|
22
24
|
if (queuedCalls) {
|
|
23
25
|
// this is an estimate of the time an event will take to process, based on the average event cycle time and the queue depth
|
|
24
26
|
if (queuedCalls.length * averageEventCycleTime > maxQueueTimeLimit) {
|
|
27
|
+
const now = performance.now();
|
|
28
|
+
if (now - lastLimitExceededLog > LIMIT_EXCEEDED_LOG_INTERVAL) {
|
|
29
|
+
lastLimitExceededLog = now;
|
|
30
|
+
logger_ts_1.logger.warn?.(`Rejecting queued calls${name ? ` (${name})` : ''}: ${queuedCalls.length} already queued at ~${Math.round(averageEventCycleTime)}ms per event cycle, an estimated wait past the ${maxQueueTimeLimit}ms limit`);
|
|
31
|
+
}
|
|
25
32
|
return onLimitExceeded(...args);
|
|
26
33
|
}
|
|
27
34
|
return new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../server/throttle.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"throttle.js","sourceRoot":"","sources":["../../server/throttle.ts"],"names":[],"mappings":";;AAgBA,4BAsDC;AAtED,4DAAsD;AACtD,mDAA8D;AAC9D,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,sBAAsB,GAAG,MAAM,CAAC,CAAC,aAAa;AACpD,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAC/B,MAAM,+BAA+B,GAAG,IAAI,CAAC;AAC7C,MAAM,2BAA2B,GAAG,IAAI,CAAC;AACzC,IAAI,mBAAmB,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,+BAA+B,CAAC;AAC9E,IAAI,qBAAqB,GAAG,CAAC,CAAC;AAC9B;;;;;GAKG;AACH,SAAgB,QAAQ,CACvB,EAAyB,EACzB,eAAuC,EACvC,iBAAiB,GAAG,sBAAsB,EAC1C,IAAa;IAEb,IAAI,WAAkB,CAAC;IACvB,IAAI,oBAAoB,GAAG,CAAC,QAAQ,CAAC;IACrC,OAAO,UAAU,GAAG,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BAAmB,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;YACzC,CAAC;QACF,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -37,9 +37,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
// 5.3.0 — introduces system.hdb_oidc_trust and system.hdb_oidc_token_use for OIDC trusted
|
|
40
|
-
// publishing (#2171).
|
|
40
|
+
// publishing (#2171), and system.hdb_model_decisions and system.hdb_model_outcomes for durable
|
|
41
|
+
// decisions and their recorded outcomes (#2840).
|
|
41
42
|
//
|
|
42
|
-
// Fresh installs get
|
|
43
|
+
// Fresh installs get these tables from json/systemSchema.json; this covers existing installs, and the
|
|
44
|
+
// replay table's full shape is also declared on every boot (security/authn/oidc/tokenUseTable.ts). The
|
|
43
45
|
// version must match the release that ships the dependent operations — see 5-1-0.ts for what
|
|
44
46
|
// happens when it does not, and DESIGN.md "System table bootstrap" for the three touchpoints.
|
|
45
47
|
const databases_ts_1 = require("../../resources/databases.js");
|
|
@@ -48,50 +50,22 @@ const terms = __importStar(require("../../utility/hdbTerms.js"));
|
|
|
48
50
|
const initPaths = __importStar(require("../../dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js"));
|
|
49
51
|
const harperBridge_ts_1 = __importDefault(require("../../dataLayer/harperBridge/harperBridge.js"));
|
|
50
52
|
const harper_logger_ts_1 = __importDefault(require("../../utility/logging/harper_logger.js"));
|
|
53
|
+
const tokenUseTable_ts_1 = require("../../security/authn/oidc/tokenUseTable.js");
|
|
51
54
|
const OIDC_TRUST_TABLE = terms.SYSTEM_TABLE_NAMES.OIDC_TRUST_TABLE_NAME;
|
|
52
55
|
const OIDC_TOKEN_USE_TABLE = terms.SYSTEM_TABLE_NAMES.OIDC_TOKEN_USE_TABLE_NAME;
|
|
56
|
+
const MODEL_DECISIONS_TABLE = terms.SYSTEM_TABLE_NAMES.MODEL_DECISIONS_TABLE_NAME;
|
|
57
|
+
const MODEL_OUTCOMES_TABLE = terms.SYSTEM_TABLE_NAMES.MODEL_OUTCOMES_TABLE_NAME;
|
|
53
58
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* that question entirely rather than depending on how replication treats a row for an unknown table.
|
|
58
|
-
*
|
|
59
|
-
* Only the primary key is declared here. The `expiresAt` TTL attribute is not expressible through
|
|
60
|
-
* CreateTableObject, so tokenExchange.ts layers it on with an unconditional `table()` call — the
|
|
61
|
-
* same two-step hdb_certificate_cache uses.
|
|
62
|
-
*
|
|
63
|
-
* KNOWN LIMITATION, shared with hdb_certificate_cache rather than specific to this table: that
|
|
64
|
-
* second step runs on the exchange path, so a node that never performs an exchange — the passive
|
|
65
|
-
* members of a cluster, which is most of them when CI always targets one endpoint — has the table
|
|
66
|
-
* from this directive but never registers `expiresAt` locally. Replicated replay rows still land
|
|
67
|
-
* there (that is what `audit: true` buys) but get no eviction, so the table grows on exactly the
|
|
68
|
-
* nodes doing no work. Rows are small and bounded by exchange volume, so this is slow rather than
|
|
69
|
-
* dangerous. Fixing it properly means installing the TTL at system-table setup instead of on first
|
|
70
|
-
* use, which is a change to how every lazily-extended system table is provisioned — worth doing
|
|
71
|
-
* once, for both tables, rather than special-casing this one.
|
|
59
|
+
* Not skipped when the table exists: the node that upgrades second can already hold a copy its
|
|
60
|
+
* pre-upgrade replication handshake created from a peer, which carries attribute names but not the
|
|
61
|
+
* table's expiration.
|
|
72
62
|
*/
|
|
73
|
-
async function
|
|
74
|
-
if (databases_ts_1.databases.system?.[OIDC_TOKEN_USE_TABLE]) {
|
|
75
|
-
harper_logger_ts_1.default.info(`system.${OIDC_TOKEN_USE_TABLE}
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
harper_logger_ts_1.default.info(`Creating system.${OIDC_TOKEN_USE_TABLE} table for OIDC replay protection.`);
|
|
80
|
-
const CreateTableObject = require('../../dataLayer/CreateTableObject').default || require('../../dataLayer/CreateTableObject');
|
|
81
|
-
const schema = systemSchema_json_1.default[OIDC_TOKEN_USE_TABLE];
|
|
82
|
-
if (!schema) {
|
|
83
|
-
throw new Error(`systemSchema.${OIDC_TOKEN_USE_TABLE} is missing; cannot run 5.3.0 directive.`);
|
|
63
|
+
async function declareHdbOidcTokenUse() {
|
|
64
|
+
if (!databases_ts_1.databases.system?.[OIDC_TOKEN_USE_TABLE]) {
|
|
65
|
+
harper_logger_ts_1.default.info(`Creating system.${OIDC_TOKEN_USE_TABLE} table for OIDC replay protection.`);
|
|
66
|
+
initPaths.initSystemSchemaPaths(terms.SYSTEM_SCHEMA_NAME, OIDC_TOKEN_USE_TABLE);
|
|
84
67
|
}
|
|
85
|
-
|
|
86
|
-
const createTable = new CreateTableObject(terms.SYSTEM_SCHEMA_NAME, OIDC_TOKEN_USE_TABLE, schema.hash_attribute);
|
|
87
|
-
createTable.attributes = schema.attributes;
|
|
88
|
-
const primaryKeyAttribute = createTable.attributes.find(({ attribute }) => attribute === schema.hash_attribute);
|
|
89
|
-
if (primaryKeyAttribute)
|
|
90
|
-
primaryKeyAttribute.isPrimaryKey = true;
|
|
91
|
-
// Must match `"audit": true` in systemSchema.json — and here auditing is not cosmetic: it is the
|
|
92
|
-
// replication change feed, without which replay protection would be node-local.
|
|
93
|
-
createTable.audit = true;
|
|
94
|
-
await harperBridge_ts_1.default.createTable(OIDC_TOKEN_USE_TABLE, createTable);
|
|
68
|
+
(0, tokenUseTable_ts_1.declareTokenUseTable)();
|
|
95
69
|
await patchIsHashAttribute(OIDC_TOKEN_USE_TABLE);
|
|
96
70
|
}
|
|
97
71
|
async function createHdbOidcTrustIfMissing() {
|
|
@@ -122,9 +96,8 @@ async function createHdbOidcTrustIfMissing() {
|
|
|
122
96
|
*
|
|
123
97
|
* harperdb@4.x reads is_hash_attribute from __dbis__ to derive the LMDB DBI open flags; without it
|
|
124
98
|
* the DBI is opened with the opposite flags (DUPSORT set) and LMDB throws MDB_INCOMPATIBLE, breaking
|
|
125
|
-
* downgrade — the same guard 5-1-0.ts and 5-2-0.ts apply to their tables
|
|
126
|
-
*
|
|
127
|
-
* one would be a silent asymmetry rather than a decision. Idempotent: no-op when already set.
|
|
99
|
+
* downgrade — the same guard 5-1-0.ts and 5-2-0.ts apply to their tables, so every table here gets it.
|
|
100
|
+
* Idempotent: no-op when already set.
|
|
128
101
|
*/
|
|
129
102
|
async function patchIsHashAttribute(tableName) {
|
|
130
103
|
const systemTable = databases_ts_1.databases.system?.[tableName];
|
|
@@ -138,11 +111,45 @@ async function patchIsHashAttribute(tableName) {
|
|
|
138
111
|
await systemTable.dbisDB.put(dbiName, primaryAttr);
|
|
139
112
|
harper_logger_ts_1.default.info(`Patched system.${tableName} __dbis__ entry with is_hash_attribute=true for harperdb@4.x downgrade compatibility.`);
|
|
140
113
|
}
|
|
114
|
+
/** `audit: true` must match systemSchema.json: both decision tables replicate. */
|
|
115
|
+
async function createSystemTableIfMissing(tableName, purpose) {
|
|
116
|
+
if (databases_ts_1.databases.system?.[tableName]) {
|
|
117
|
+
harper_logger_ts_1.default.info(`system.${tableName} already exists; skipping create.`);
|
|
118
|
+
await patchIsHashAttribute(tableName);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
harper_logger_ts_1.default.info(`Creating system.${tableName} table for ${purpose}.`);
|
|
122
|
+
const CreateTableObject = require('../../dataLayer/CreateTableObject').default || require('../../dataLayer/CreateTableObject');
|
|
123
|
+
const schema = systemSchema_json_1.default[tableName];
|
|
124
|
+
if (!schema) {
|
|
125
|
+
throw new Error(`systemSchema.${tableName} is missing; cannot run 5.3.0 directive.`);
|
|
126
|
+
}
|
|
127
|
+
initPaths.initSystemSchemaPaths(terms.SYSTEM_SCHEMA_NAME, tableName);
|
|
128
|
+
const createTable = new CreateTableObject(terms.SYSTEM_SCHEMA_NAME, tableName, schema.hash_attribute);
|
|
129
|
+
createTable.attributes = schema.attributes;
|
|
130
|
+
const primaryKeyAttribute = createTable.attributes.find(({ attribute }) => attribute === schema.hash_attribute);
|
|
131
|
+
if (primaryKeyAttribute)
|
|
132
|
+
primaryKeyAttribute.isPrimaryKey = true;
|
|
133
|
+
createTable.audit = true;
|
|
134
|
+
await harperBridge_ts_1.default.createTable(tableName, createTable);
|
|
135
|
+
await patchIsHashAttribute(tableName);
|
|
136
|
+
}
|
|
137
|
+
async function createHdbModelDecisionsIfMissing() {
|
|
138
|
+
await createSystemTableIfMissing(MODEL_DECISIONS_TABLE, 'durable model decisions');
|
|
139
|
+
}
|
|
140
|
+
async function createHdbModelOutcomesIfMissing() {
|
|
141
|
+
await createSystemTableIfMissing(MODEL_OUTCOMES_TABLE, 'recorded decision outcomes');
|
|
142
|
+
}
|
|
141
143
|
const directive530 = {
|
|
142
144
|
version: '5.3.0',
|
|
143
|
-
description: 'create system.hdb_oidc_trust and system.hdb_oidc_token_use tables for OIDC trusted publishing',
|
|
145
|
+
description: 'create system.hdb_oidc_trust and system.hdb_oidc_token_use tables for OIDC trusted publishing, and system.hdb_model_decisions and system.hdb_model_outcomes for durable decisions',
|
|
144
146
|
sync_functions: [],
|
|
145
|
-
async_functions: [
|
|
147
|
+
async_functions: [
|
|
148
|
+
createHdbOidcTrustIfMissing,
|
|
149
|
+
declareHdbOidcTokenUse,
|
|
150
|
+
createHdbModelDecisionsIfMissing,
|
|
151
|
+
createHdbModelOutcomesIfMissing,
|
|
152
|
+
],
|
|
146
153
|
};
|
|
147
154
|
exports.default = [directive530];
|
|
148
155
|
//# sourceMappingURL=5-3-0.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"5-3-0.js","sourceRoot":"","sources":["../../../upgrade/directives/5-3-0.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,0FAA0F;AAC1F
|
|
1
|
+
{"version":3,"file":"5-3-0.js","sourceRoot":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CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC;IAChH,IAAI,mBAAmB;QAAE,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC;IACjE,WAAW,CAAC,KAAK,GAAG,IAAI,CAAC;IAEzB,MAAM,yBAAM,CAAC,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACjD,MAAM,oBAAoB,CAAC,SAAS,CAAC,CAAC;AACvC,CAAC;AAED,KAAK,UAAU,gCAAgC;IAC9C,MAAM,0BAA0B,CAAC,qBAAqB,EAAE,yBAAyB,CAAC,CAAC;AACpF,CAAC;AAED,KAAK,UAAU,+BAA+B;IAC7C,MAAM,0BAA0B,CAAC,oBAAoB,EAAE,4BAA4B,CAAC,CAAC;AACtF,CAAC;AAED,MAAM,YAAY,GAAG;IACpB,OAAO,EAAE,OAAO;IAChB,WAAW,EACV,mLAAmL;IACpL,cAAc,EAAE,EAA0B;IAC1C,eAAe,EAAE;QAChB,2BAA2B;QAC3B,sBAAsB;QACtB,gCAAgC;QAChC,+BAA+B;KACE;CAClC,CAAC;AAEF,kBAAe,CAAC,YAAY,CAAC,CAAC"}
|
|
@@ -11,7 +11,7 @@ export declare class HdbError extends Error {
|
|
|
11
11
|
logLevel: string;
|
|
12
12
|
/**
|
|
13
13
|
* @param {Error} errOrig - Error to be translated into HdbError. If manually throwing an error, pass `new Error()` to ensure stack trace is maintained
|
|
14
|
-
* @param {String} [httpMsg] - optional - response message that will be returned via the API
|
|
14
|
+
* @param {String|Object} [httpMsg] - optional - response message that will be returned via the API
|
|
15
15
|
* @param {Number} [httpCode] - optional - response status code that will be returned via the API
|
|
16
16
|
* @param {String} [logLevel] - optional - log level that will be used for logging of this error
|
|
17
17
|
* @param {String} [logMsg] - optional - log message that, if provided, will be logged at the `logLevel` above
|
|
@@ -32,6 +32,15 @@ export declare class DerivedIndexLagError extends ServerError {
|
|
|
32
32
|
retryable: boolean;
|
|
33
33
|
constructor(message: string);
|
|
34
34
|
}
|
|
35
|
+
/** Retryable admission failure while a database is draining writes for close, restore, or drop. */
|
|
36
|
+
export declare class DatabaseClosingError extends ServerError {
|
|
37
|
+
code: string;
|
|
38
|
+
retryable: boolean;
|
|
39
|
+
constructor(databaseName: string, retryable?: boolean);
|
|
40
|
+
}
|
|
41
|
+
export declare class DatabaseDrainTimeoutError extends DatabaseClosingError {
|
|
42
|
+
constructor(databaseName: string, timeoutMilliseconds: number);
|
|
43
|
+
}
|
|
35
44
|
/**
|
|
36
45
|
* Thrown when a query targets an attribute whose secondary index is still being (re)built. It is a
|
|
37
46
|
* distinct, retryable 503 so callers can tell a transient "index rebuilding" condition apart from a
|