@tracehound/core 1.2.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026-2027 Erdem Arslan <me@erdem.work>
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -122,4 +122,4 @@ if (result.status === 'quarantined') {
122
122
 
123
123
  ## License
124
124
 
125
- Open-Core — this package is the open-source substrate of the Tracehound ecosystem. See the root [PRICING.md](../../docs/PRICING.md) for details on the commercial satellite packages.
125
+ Open-Core — this package is the open-source substrate of the Tracehound ecosystem.
@@ -1 +1 @@
1
- {"version":3,"file":"hound-ipc.d.ts","sourceRoot":"","sources":["../../src/core/hound-ipc.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,CAAA;AAEnD,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,CAAA;AAE7D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,QAAQ,CAAA;IACd,KAAK,EAAE,WAAW,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,mBAAmB,CAAA;AAEnE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;CACtB;AAgBD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAiB1D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CA8BhE;AAmBD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CA2BpE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,YAAY,CAqCrE;AAmBD;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG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AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAAA;IAElC;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAE9B;;OAEG;IACH,KAAK,IAAI,IAAI,CAAA;CACd;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CAqCnD"}
@@ -176,12 +176,20 @@ export function createMessageParser() {
176
176
  buffer = Buffer.concat([buffer, chunk]);
177
177
  const messages = [];
178
178
  // Parse all complete messages
179
- while (true) {
180
- const result = tryParseMessage(buffer);
181
- if (!result)
182
- break;
183
- messages.push(result.payload);
184
- buffer = buffer.subarray(result.bytesConsumed);
179
+ try {
180
+ while (true) {
181
+ const result = tryParseMessage(buffer);
182
+ if (!result)
183
+ break;
184
+ messages.push(result.payload);
185
+ buffer = buffer.subarray(result.bytesConsumed);
186
+ }
187
+ }
188
+ catch (error) {
189
+ // Safety invariant: malformed frames MUST NOT keep parser
190
+ // in a corrupted/amplifying buffered state.
191
+ buffer = Buffer.alloc(0);
192
+ throw error;
185
193
  }
186
194
  return messages;
187
195
  },
@@ -1 +1 @@
1
- {"version":3,"file":"hound-ipc.js","sourceRoot":"","sources":["../../src/core/hound-ipc.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAoCH,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,8CAA8C;AAC9C,MAAM,kBAAkB,GAAG,CAAC,CAAA;AAE5B,iCAAiC;AACjC,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAA;AAEpC,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,OAAoB;IAChD,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC1C,MAAM,MAAM,GAAG,aAAa,CAAC,MAAM,CAAA;IAEnC,IAAI,MAAM,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CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracehound/core",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Deterministic runtime security buffer for high-velocity APIs",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Erdem Arslan <me@erdem.work>",
@@ -49,6 +49,8 @@
49
49
  "test": "vitest run",
50
50
  "test:watch": "vitest",
51
51
  "lint": "tsc --noEmit",
52
- "clean": "rm -rf dist"
52
+ "clean": "rm -rf dist",
53
+ "test:fuzz:regression": "vitest run tests/fuzz/replay-corpus.test.ts",
54
+ "test:fuzz:assurance": "vitest run tests/fuzz/*.property.test.ts tests/fuzz/replay-corpus.test.ts"
53
55
  }
54
56
  }
@@ -1,14 +0,0 @@
1
- /**
2
- * Hound Process - Child process entry point.
3
- *
4
- * RFC-0000 REQUIREMENTS:
5
- * - Reads binary from stdin
6
- * - Writes status to stdout
7
- * - No dynamic require
8
- * - No config from parent
9
- * - Deterministic, single-purpose
10
- *
11
- * This script runs in an isolated child process.
12
- */
13
- export {};
14
- //# sourceMappingURL=hound-worker.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hound-worker.d.ts","sourceRoot":"","sources":["../../src/core/hound-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
@@ -1,112 +0,0 @@
1
- /**
2
- * Hound Process - Child process entry point.
3
- *
4
- * RFC-0000 REQUIREMENTS:
5
- * - Reads binary from stdin
6
- * - Writes status to stdout
7
- * - No dynamic require
8
- * - No config from parent
9
- * - Deterministic, single-purpose
10
- *
11
- * This script runs in an isolated child process.
12
- */
13
- import { createMessageParser, encodeHoundMessage } from './hound-ipc.js';
14
- // ─────────────────────────────────────────────────────────────────────────────
15
- // Constants
16
- // ─────────────────────────────────────────────────────────────────────────────
17
- /** Processing simulation delay (will be replaced with real logic) */
18
- const PROCESSING_DELAY_MS = 10;
19
- // ─────────────────────────────────────────────────────────────────────────────
20
- // State
21
- // ─────────────────────────────────────────────────────────────────────────────
22
- const parser = createMessageParser();
23
- let isProcessing = false;
24
- // ─────────────────────────────────────────────────────────────────────────────
25
- // Message Sending
26
- // ─────────────────────────────────────────────────────────────────────────────
27
- function sendStatus(state, errorMsg) {
28
- const message = { type: 'status', state };
29
- if (errorMsg) {
30
- message.error = errorMsg;
31
- }
32
- const encoded = encodeHoundMessage(message);
33
- process.stdout.write(encoded);
34
- }
35
- function sendMetrics(processingTime) {
36
- const memoryUsed = process.memoryUsage().heapUsed;
37
- const encoded = encodeHoundMessage({ type: 'metrics', processingTime, memoryUsed });
38
- process.stdout.write(encoded);
39
- }
40
- // ─────────────────────────────────────────────────────────────────────────────
41
- // Processing
42
- // ─────────────────────────────────────────────────────────────────────────────
43
- /**
44
- * Process evidence payload.
45
- *
46
- * Current implementation: simulation.
47
- * Future: actual evidence analysis.
48
- *
49
- * @param payload - Evidence bytes
50
- */
51
- async function processPayload(_payload) {
52
- if (isProcessing) {
53
- // Already processing - drop (single request at a time)
54
- return;
55
- }
56
- isProcessing = true;
57
- const startTime = Date.now();
58
- try {
59
- sendStatus('processing');
60
- // Simulate processing
61
- // TODO: Replace with actual evidence analysis
62
- await new Promise((resolve) => setTimeout(resolve, PROCESSING_DELAY_MS));
63
- const processingTime = Date.now() - startTime;
64
- sendMetrics(processingTime);
65
- sendStatus('complete');
66
- }
67
- catch (err) {
68
- const message = err instanceof Error ? err.message : 'Unknown error';
69
- sendStatus('error', message);
70
- }
71
- finally {
72
- isProcessing = false;
73
- }
74
- }
75
- // ─────────────────────────────────────────────────────────────────────────────
76
- // Stdin Handler
77
- // ─────────────────────────────────────────────────────────────────────────────
78
- process.stdin.on('data', (chunk) => {
79
- const messages = parser.feed(chunk);
80
- for (const payload of messages) {
81
- // Process each message
82
- processPayload(payload).catch((err) => {
83
- sendStatus('error', err instanceof Error ? err.message : 'Unknown error');
84
- });
85
- }
86
- });
87
- process.stdin.on('end', () => {
88
- // Parent closed stdin - exit gracefully
89
- process.exit(0);
90
- });
91
- process.stdin.on('error', (err) => {
92
- sendStatus('error', `stdin error: ${err.message}`);
93
- process.exit(1);
94
- });
95
- // ─────────────────────────────────────────────────────────────────────────────
96
- // Uncaught Exception Handler
97
- // ─────────────────────────────────────────────────────────────────────────────
98
- process.on('uncaughtException', (err) => {
99
- sendStatus('error', `uncaught: ${err.message}`);
100
- process.exit(1);
101
- });
102
- process.on('unhandledRejection', (reason) => {
103
- const message = reason instanceof Error ? reason.message : String(reason);
104
- sendStatus('error', `unhandled rejection: ${message}`);
105
- process.exit(1);
106
- });
107
- // ─────────────────────────────────────────────────────────────────────────────
108
- // Ready Signal
109
- // ─────────────────────────────────────────────────────────────────────────────
110
- // Signal that process is ready
111
- sendStatus('processing'); // Initial "ready" state (processing = idle, waiting)
112
- //# sourceMappingURL=hound-worker.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hound-worker.js","sourceRoot":"","sources":["../../src/core/hound-worker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAA2B,MAAM,gBAAgB,CAAA;AAEjG,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,qEAAqE;AACrE,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAE9B,gFAAgF;AAChF,QAAQ;AACR,gFAAgF;AAEhF,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAA;AACpC,IAAI,YAAY,GAAG,KAAK,CAAA;AAExB,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF,SAAS,UAAU,CAAC,KAA0C,EAAE,QAAiB;IAC/E,MAAM,OAAO,GAAuB,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;IAC7D,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAA;IAC1B,CAAC;IACD,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAC3C,OAAO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CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACzE,UAAU,CAAC,OAAO,EAAE,wBAAwB,OAAO,EAAE,CAAC,CAAA;IACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA;AAEF,gFAAgF;AAChF,eAAe;AACf,gFAAgF;AAEhF,+BAA+B;AAC/B,UAAU,CAAC,YAAY,CAAC,CAAA,CAAC,qDAAqD"}
@@ -1,128 +0,0 @@
1
- /**
2
- * License Manager - JWT-based license validation for commercial tiers.
3
- *
4
- * CRITICAL INVARIANTS:
5
- * - Soft Lock: Never crash or block production due to license issues
6
- * - Offline: Public key embedded, no network required
7
- * - Grace Period: 7 days tolerance for expired licenses
8
- */
9
- /**
10
- * License tiers.
11
- */
12
- export type LicenseTier = 'starter' | 'pro' | 'enterprise';
13
- /**
14
- * License validation status.
15
- */
16
- export type LicenseStatus = 'valid' | 'expired' | 'grace' | 'invalid' | 'none';
17
- /**
18
- * JWT payload for Tracehound licenses.
19
- */
20
- export interface LicensePayload {
21
- /** Licensee ID (customer identifier) */
22
- sub: string;
23
- /** Issuer (must be "tracehound.io") */
24
- iss: string;
25
- /** Audience (product identifier) */
26
- aud: string;
27
- /** Expiration timestamp (Unix seconds) */
28
- exp: number;
29
- /** Issued at timestamp (Unix seconds) */
30
- iat: number;
31
- /** License tier */
32
- tier: LicenseTier;
33
- /** Enabled features */
34
- features: string[];
35
- /**
36
- * Maximum concurrent instances allowed.
37
- * - Pro: 1 (single instance, trust-based)
38
- * - Enterprise: unlimited (-1) or specific count
39
- */
40
- maxInstances?: number;
41
- }
42
- /**
43
- * License validation result.
44
- */
45
- export interface LicenseValidationResult {
46
- /** Whether validation succeeded */
47
- valid: boolean;
48
- /** Resulting tier */
49
- tier: LicenseTier;
50
- /** Validation status */
51
- status: LicenseStatus;
52
- /** Error message if invalid */
53
- error?: string;
54
- /** Days until expiration (negative if expired) */
55
- daysRemaining?: number;
56
- }
57
- /**
58
- * License Manager configuration.
59
- */
60
- export interface LicenseManagerConfig {
61
- /** Public key for signature verification (PEM format) */
62
- publicKey: string;
63
- /** Expected issuer */
64
- issuer?: string;
65
- /** Expected audience */
66
- audience?: string;
67
- /** Grace period in days for expired licenses */
68
- gracePeriodDays?: number;
69
- }
70
- /**
71
- * License Manager interface.
72
- */
73
- export interface ILicenseManager {
74
- /**
75
- * Validate a license key.
76
- * @param key - JWT license key
77
- */
78
- validate(key: string): LicenseValidationResult;
79
- /**
80
- * Check if a feature is enabled.
81
- * @param feature - Feature name
82
- */
83
- isFeatureEnabled(feature: string): boolean;
84
- /**
85
- * Current license tier.
86
- */
87
- readonly tier: LicenseTier;
88
- /**
89
- * Current license status.
90
- */
91
- readonly status: LicenseStatus;
92
- /**
93
- * Current license payload (if valid).
94
- */
95
- readonly payload: LicensePayload | null;
96
- }
97
- /**
98
- * Features available per tier.
99
- */
100
- export declare const TIER_FEATURES: Record<LicenseTier, readonly string[]>;
101
- /**
102
- * License Manager implementation.
103
- */
104
- export declare class LicenseManager implements ILicenseManager {
105
- private readonly config;
106
- private _tier;
107
- private _status;
108
- private _payload;
109
- private _features;
110
- constructor(config: LicenseManagerConfig);
111
- get tier(): LicenseTier;
112
- get status(): LicenseStatus;
113
- get payload(): LicensePayload | null;
114
- validate(key: string): LicenseValidationResult;
115
- isFeatureEnabled(feature: string): boolean;
116
- private verifySignature;
117
- private decodePayload;
118
- private base64UrlDecode;
119
- private setCommunity;
120
- private setValid;
121
- }
122
- /**
123
- * Create a License Manager instance.
124
- *
125
- * @param config - License manager configuration
126
- */
127
- export declare function createLicenseManager(config: LicenseManagerConfig): ILicenseManager;
128
- //# sourceMappingURL=license-manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"license-manager.d.ts","sourceRoot":"","sources":["../../src/core/license-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH;;GAEG;AACH,MAAM,MAAM,WAAW,GA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G,OAAO,CAAA;IAE1C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAA;IAE9B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI,CAAA;CACxC;AAWD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAyBvD,CAAA;AAMV;;GAEG;AACH,qBAAa,cAAe,YAAW,eAAe;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,SAAS,CAA8C;gBAEnD,MAAM,EAAE,oBAAoB;IASxC,IAAI,IAAI,IAAI,WAAW,CAEtB;IAED,IAAI,MAAM,IAAI,aAAa,CAE1B;IAED,IAAI,OAAO,IAAI,cAAc,GAAG,IAAI,CAEnC;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB;IA6D9C,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAM1C,OAAO,CAAC,eAAe;IAcvB,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,YAAY;IAmBpB,OAAO,CAAC,QAAQ;CAoBjB;AAMD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,oBAAoB,GAAG,eAAe,CAElF"}
@@ -1,219 +0,0 @@
1
- /**
2
- * License Manager - JWT-based license validation for commercial tiers.
3
- *
4
- * CRITICAL INVARIANTS:
5
- * - Soft Lock: Never crash or block production due to license issues
6
- * - Offline: Public key embedded, no network required
7
- * - Grace Period: 7 days tolerance for expired licenses
8
- */
9
- import { createVerify } from 'node:crypto';
10
- // ─────────────────────────────────────────────────────────────────────────────
11
- // Constants
12
- // ─────────────────────────────────────────────────────────────────────────────
13
- const DEFAULT_ISSUER = 'tracehound.io';
14
- const DEFAULT_AUDIENCE = 'tracehound-core';
15
- const DEFAULT_GRACE_PERIOD_DAYS = 7;
16
- const MS_PER_DAY = 24 * 60 * 60 * 1000;
17
- /**
18
- * Features available per tier.
19
- */
20
- export const TIER_FEATURES = {
21
- starter: ['agent', 'quarantine', 'rate-limiter', 'watcher', 'scheduler'],
22
- pro: [
23
- 'agent',
24
- 'quarantine',
25
- 'rate-limiter',
26
- 'watcher',
27
- 'scheduler',
28
- 'cold-storage',
29
- 'notification-api',
30
- 'async-codec',
31
- ],
32
- enterprise: [
33
- 'agent',
34
- 'quarantine',
35
- 'rate-limiter',
36
- 'watcher',
37
- 'scheduler',
38
- 'cold-storage',
39
- 'notification-api',
40
- 'async-codec',
41
- 'redis',
42
- 'siem-export',
43
- 'compliance-reports',
44
- ],
45
- };
46
- // ─────────────────────────────────────────────────────────────────────────────
47
- // Implementation
48
- // ─────────────────────────────────────────────────────────────────────────────
49
- /**
50
- * License Manager implementation.
51
- */
52
- export class LicenseManager {
53
- config;
54
- _tier = 'starter';
55
- _status = 'none';
56
- _payload = null;
57
- _features = new Set(TIER_FEATURES.starter);
58
- constructor(config) {
59
- this.config = {
60
- publicKey: config.publicKey,
61
- issuer: config.issuer ?? DEFAULT_ISSUER,
62
- audience: config.audience ?? DEFAULT_AUDIENCE,
63
- gracePeriodDays: config.gracePeriodDays ?? DEFAULT_GRACE_PERIOD_DAYS,
64
- };
65
- }
66
- get tier() {
67
- return this._tier;
68
- }
69
- get status() {
70
- return this._status;
71
- }
72
- get payload() {
73
- return this._payload;
74
- }
75
- validate(key) {
76
- // Empty key = community mode
77
- if (!key || key.trim() === '') {
78
- return this.setCommunity('none');
79
- }
80
- try {
81
- // Parse JWT
82
- const parts = key.split('.');
83
- if (parts.length !== 3) {
84
- return this.setCommunity('invalid', 'Invalid JWT format');
85
- }
86
- const [headerB64, payloadB64, signatureB64] = parts;
87
- // Verify signature
88
- if (!this.verifySignature(headerB64, payloadB64, signatureB64)) {
89
- return this.setCommunity('invalid', 'Invalid signature');
90
- }
91
- // Decode payload
92
- const payload = this.decodePayload(payloadB64);
93
- if (!payload) {
94
- return this.setCommunity('invalid', 'Invalid payload');
95
- }
96
- // Validate issuer
97
- if (payload.iss !== this.config.issuer) {
98
- return this.setCommunity('invalid', `Invalid issuer: ${payload.iss}`);
99
- }
100
- // Validate audience
101
- if (payload.aud !== this.config.audience) {
102
- return this.setCommunity('invalid', `Invalid audience: ${payload.aud}`);
103
- }
104
- // Check expiration
105
- const now = Date.now();
106
- const expMs = payload.exp * 1000;
107
- const daysRemaining = Math.floor((expMs - now) / MS_PER_DAY);
108
- if (now > expMs) {
109
- // Expired - check grace period
110
- const daysSinceExpiry = Math.floor((now - expMs) / MS_PER_DAY);
111
- if (daysSinceExpiry <= this.config.gracePeriodDays) {
112
- // Grace period - still allow full features
113
- return this.setValid(payload, 'grace', daysRemaining);
114
- }
115
- else {
116
- // Beyond grace period - community mode
117
- return this.setCommunity('expired', 'License expired beyond grace period');
118
- }
119
- }
120
- // Valid license
121
- return this.setValid(payload, 'valid', daysRemaining);
122
- }
123
- catch (err) {
124
- const message = err instanceof Error ? err.message : 'Unknown error';
125
- return this.setCommunity('invalid', message);
126
- }
127
- }
128
- isFeatureEnabled(feature) {
129
- return this._features.has(feature);
130
- }
131
- // ─── Private Methods ─────────────────────────────────────────────────────────
132
- verifySignature(headerB64, payloadB64, signatureB64) {
133
- try {
134
- const signatureInput = `${headerB64}.${payloadB64}`;
135
- const signature = Buffer.from(this.base64UrlDecode(signatureB64), 'base64');
136
- const verifier = createVerify('RSA-SHA256');
137
- verifier.update(signatureInput);
138
- return verifier.verify(this.config.publicKey, signature);
139
- }
140
- catch {
141
- return false;
142
- }
143
- }
144
- decodePayload(payloadB64) {
145
- try {
146
- const json = Buffer.from(this.base64UrlDecode(payloadB64), 'base64').toString('utf8');
147
- const payload = JSON.parse(json);
148
- // Validate required fields
149
- if (typeof payload.sub !== 'string' ||
150
- typeof payload.iss !== 'string' ||
151
- typeof payload.aud !== 'string' ||
152
- typeof payload.exp !== 'number' ||
153
- typeof payload.iat !== 'number' ||
154
- typeof payload.tier !== 'string' ||
155
- !Array.isArray(payload.features)) {
156
- return null;
157
- }
158
- // Validate tier
159
- if (!['starter', 'pro', 'enterprise'].includes(payload.tier)) {
160
- return null;
161
- }
162
- return payload;
163
- }
164
- catch {
165
- return null;
166
- }
167
- }
168
- base64UrlDecode(str) {
169
- // Convert base64url to base64
170
- let base64 = str.replace(/-/g, '+').replace(/_/g, '/');
171
- // Add padding if needed
172
- const padding = 4 - (base64.length % 4);
173
- if (padding !== 4) {
174
- base64 += '='.repeat(padding);
175
- }
176
- return base64;
177
- }
178
- setCommunity(status, error) {
179
- this._tier = 'starter';
180
- this._status = status;
181
- this._payload = null;
182
- this._features = new Set(TIER_FEATURES.starter);
183
- const result = {
184
- valid: false,
185
- tier: 'starter',
186
- status,
187
- };
188
- if (error !== undefined) {
189
- result.error = error;
190
- }
191
- return result;
192
- }
193
- setValid(payload, status, daysRemaining) {
194
- this._tier = payload.tier;
195
- this._status = status;
196
- this._payload = payload;
197
- // Set features from tier + any additional from payload
198
- const tierFeatures = TIER_FEATURES[payload.tier] ?? TIER_FEATURES.starter;
199
- this._features = new Set([...tierFeatures, ...payload.features]);
200
- return {
201
- valid: true,
202
- tier: payload.tier,
203
- status,
204
- daysRemaining,
205
- };
206
- }
207
- }
208
- // ─────────────────────────────────────────────────────────────────────────────
209
- // Factory
210
- // ─────────────────────────────────────────────────────────────────────────────
211
- /**
212
- * Create a License Manager instance.
213
- *
214
- * @param config - License manager configuration
215
- */
216
- export function createLicenseManager(config) {
217
- return new LicenseManager(config);
218
- }
219
- //# sourceMappingURL=license-manager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"license-manager.js","sourceRoot":"","sources":["../../src/core/license-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,O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MAAyB,EACzB,aAAqB;QAErB,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,IAAI,CAAA;QACzB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAA;QACrB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;QAEvB,uDAAuD;QACvD,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,OAAO,CAAA;QACzE,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,YAAY,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;QAEhE,OAAO;YACL,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,MAAM;YACN,aAAa;SACd,CAAA;IACH,CAAC;CACF;AAED,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAA4B;IAC/D,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,CAAA;AACnC,CAAC"}
@@ -1,58 +0,0 @@
1
- /**
2
- * Tier-Aware Capacity Configuration
3
- *
4
- * Maps license tiers to HoundPool capacity constraints.
5
- * This enforces the pricing model's capacity-gating strategy.
6
- *
7
- * INVARIANT: Security features are identical across all tiers.
8
- * Only capacity (poolSize, memory, timeout) varies.
9
- */
10
- import type { HoundPoolConfig, PoolExhaustedAction } from './hound-pool.js';
11
- import type { LicenseTier } from './license-manager.js';
12
- /**
13
- * Capacity limits per tier.
14
- */
15
- export interface TierCapacityLimits {
16
- /** Max concurrent processes */
17
- poolSize: number;
18
- /** Max memory per process in MB */
19
- maxMemoryMB: number;
20
- /** Process timeout in ms */
21
- timeoutMs: number;
22
- /** Action when pool exhausted */
23
- onPoolExhausted: PoolExhaustedAction;
24
- /** Defer queue limit */
25
- deferQueueLimit: number;
26
- }
27
- /**
28
- * Tier capacity definitions.
29
- *
30
- * | Tier | Processes | Memory | Timeout |
31
- * |------------|-----------|--------|---------|
32
- * | Starter | 1 | 64MB | 5s |
33
- * | Pro | 8 | 512MB | 30s |
34
- * | Enterprise | 32 | 2048MB | 60s |
35
- */
36
- export declare const TIER_CAPACITY_LIMITS: Record<LicenseTier, TierCapacityLimits>;
37
- /**
38
- * Create tier-aware HoundPool configuration.
39
- *
40
- * @param tier - License tier
41
- * @param overrides - Optional overrides (Enterprise can customize)
42
- * @returns HoundPool configuration
43
- *
44
- * @example
45
- * ```ts
46
- * const config = createTierAwarePoolConfig('pro')
47
- * const pool = createHoundPool(config)
48
- * ```
49
- */
50
- export declare function createTierAwarePoolConfig(tier: LicenseTier, overrides?: Partial<HoundPoolConfig>): HoundPoolConfig;
51
- /**
52
- * Get capacity limits for a tier (read-only).
53
- *
54
- * @param tier - License tier
55
- * @returns Capacity limits
56
- */
57
- export declare function getTierCapacityLimits(tier: LicenseTier): Readonly<TierCapacityLimits>;
58
- //# sourceMappingURL=tier-capacity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tier-capacity.d.ts","sourceRoot":"","sources":["../../src/core/tier-capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAOvD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAA;IACnB,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,eAAe,EAAE,mBAAmB,CAAA;IACpC,wBAAwB;IACxB,eAAe,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,WAAW,EAAE,kBAAkB,CAsB/D,CAAA;AAMV;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,WAAW,EACjB,SAAS,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GACnC,eAAe,CAyBjB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAErF"}
@@ -1,89 +0,0 @@
1
- /**
2
- * Tier-Aware Capacity Configuration
3
- *
4
- * Maps license tiers to HoundPool capacity constraints.
5
- * This enforces the pricing model's capacity-gating strategy.
6
- *
7
- * INVARIANT: Security features are identical across all tiers.
8
- * Only capacity (poolSize, memory, timeout) varies.
9
- */
10
- /**
11
- * Tier capacity definitions.
12
- *
13
- * | Tier | Processes | Memory | Timeout |
14
- * |------------|-----------|--------|---------|
15
- * | Starter | 1 | 64MB | 5s |
16
- * | Pro | 8 | 512MB | 30s |
17
- * | Enterprise | 32 | 2048MB | 60s |
18
- */
19
- export const TIER_CAPACITY_LIMITS = {
20
- starter: {
21
- poolSize: 1,
22
- maxMemoryMB: 64,
23
- timeoutMs: 5_000,
24
- onPoolExhausted: 'drop',
25
- deferQueueLimit: 10,
26
- },
27
- pro: {
28
- poolSize: 8,
29
- maxMemoryMB: 512,
30
- timeoutMs: 30_000,
31
- onPoolExhausted: 'defer',
32
- deferQueueLimit: 100,
33
- },
34
- enterprise: {
35
- poolSize: 32,
36
- maxMemoryMB: 2048,
37
- timeoutMs: 60_000,
38
- onPoolExhausted: 'defer',
39
- deferQueueLimit: 1000,
40
- },
41
- };
42
- // ─────────────────────────────────────────────────────────────────────────────
43
- // Factory
44
- // ─────────────────────────────────────────────────────────────────────────────
45
- /**
46
- * Create tier-aware HoundPool configuration.
47
- *
48
- * @param tier - License tier
49
- * @param overrides - Optional overrides (Enterprise can customize)
50
- * @returns HoundPool configuration
51
- *
52
- * @example
53
- * ```ts
54
- * const config = createTierAwarePoolConfig('pro')
55
- * const pool = createHoundPool(config)
56
- * ```
57
- */
58
- export function createTierAwarePoolConfig(tier, overrides) {
59
- const limits = TIER_CAPACITY_LIMITS[tier];
60
- const processConstraints = {
61
- maxMemoryMB: limits.maxMemoryMB,
62
- networkAccess: false,
63
- fileSystemWrite: false,
64
- childSpawn: false,
65
- };
66
- const baseConfig = {
67
- poolSize: limits.poolSize,
68
- timeout: limits.timeoutMs,
69
- rotationJitterMs: 1000,
70
- onPoolExhausted: limits.onPoolExhausted,
71
- deferQueueLimit: limits.deferQueueLimit,
72
- processConstraints,
73
- };
74
- // Enterprise tier can override
75
- if (tier === 'enterprise' && overrides) {
76
- return { ...baseConfig, ...overrides };
77
- }
78
- return baseConfig;
79
- }
80
- /**
81
- * Get capacity limits for a tier (read-only).
82
- *
83
- * @param tier - License tier
84
- * @returns Capacity limits
85
- */
86
- export function getTierCapacityLimits(tier) {
87
- return TIER_CAPACITY_LIMITS[tier];
88
- }
89
- //# sourceMappingURL=tier-capacity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tier-capacity.js","sourceRoot":"","sources":["../../src/core/tier-capacity.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA0BH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,OAAO,EAAE;QACP,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,EAAE;QACf,SAAS,EAAE,KAAK;QAChB,eAAe,EAAE,MAAM;QACvB,eAAe,EAAE,EAAE;KACpB;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,GAAG;QAChB,SAAS,EAAE,MAAM;QACjB,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,GAAG;KACrB;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;QACZ,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,MAAM;QACjB,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,IAAI;KACtB;CACO,CAAA;AAEV,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF;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