@gobing-ai/ts-llm-jsonl-importer 0.5.4 → 0.5.7
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/dist/redaction.d.ts.map +1 -1
- package/dist/redaction.js +19 -2
- package/dist/schema-sql.d.ts +1 -1
- package/dist/schema-sql.js +1 -1
- package/package.json +4 -4
- package/src/redaction.ts +22 -2
- package/src/schema-sql.ts +1 -1
package/dist/redaction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,qFAAqF;AACrF,eAAO,MAAM,uBAAuB,EAAE,SAAS,aAAa,
|
|
1
|
+
{"version":3,"file":"redaction.d.ts","sourceRoot":"","sources":["../src/redaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAEzD,qFAAqF;AACrF,eAAO,MAAM,uBAAuB,EAAE,SAAS,aAAa,EAwC3D,CAAC;AAUF,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,GAAE,SAAS,aAAa,EAA4B,GAAG,OAAO,CAgB9G;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,OAAO,SAAS,UAAU,EACnD,MAAM,EAAE,OAAO,EACf,KAAK,GAAE,SAAS,aAAa,EAA4B,GAC1D,OAAO,CAET"}
|
package/dist/redaction.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/** Default redaction rules for common token, key, and email shapes in agent logs. */
|
|
2
2
|
export const DEFAULT_REDACTION_RULES = [
|
|
3
3
|
{
|
|
4
|
+
// Task 0086 R5: vendor-specific token shapes. The underscore form
|
|
5
|
+
// deliberately requires a live/test infix — a bare sk_/pk_ prefix would
|
|
6
|
+
// redact DB identifiers like pk_customer_orders_id in code snippets.
|
|
4
7
|
name: 'api-key',
|
|
5
|
-
pattern: /\b(?:sk|pk|ghp|github_pat|xox[baprs])-[-_a-zA-Z0-9]{12,}\b/g,
|
|
8
|
+
pattern: /\b(?:(?:sk|pk|ghp|github_pat|xox[baprs])-[-_a-zA-Z0-9]{12,}|(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,})\b/g,
|
|
9
|
+
replacement: '[REDACTED:token]',
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: 'github-token',
|
|
13
|
+
pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g,
|
|
6
14
|
replacement: '[REDACTED:token]',
|
|
7
15
|
},
|
|
8
16
|
{
|
|
@@ -31,6 +39,12 @@ export const DEFAULT_REDACTION_RULES = [
|
|
|
31
39
|
replacement: '[REDACTED:bearer]',
|
|
32
40
|
},
|
|
33
41
|
];
|
|
42
|
+
/**
|
|
43
|
+
* Keys whose string values are secrets regardless of shape (task 0086 R5).
|
|
44
|
+
* Anchored so usage-analytics keys (tokens_used, token_count, max_tokens) are
|
|
45
|
+
* NOT redacted — those appear in LLM usage records.
|
|
46
|
+
*/
|
|
47
|
+
const SECRET_KEY = /^(?:api[_-]?key|apikey|api[_-]?secret|token|access[_-]?token|refresh[_-]?token|auth[_-]?token|secret|secret[_-]?key|client[_-]?secret|private[_-]?key|session[_-]?token|password|passwd|authorization)$/i;
|
|
34
48
|
/** Redact supported scalar and composite JSON values recursively. */
|
|
35
49
|
export function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
|
|
36
50
|
if (typeof value === 'string') {
|
|
@@ -40,7 +54,10 @@ export function redactValue(value, rules = DEFAULT_REDACTION_RULES) {
|
|
|
40
54
|
return value.map((entry) => redactValue(entry, rules));
|
|
41
55
|
}
|
|
42
56
|
if (value !== null && typeof value === 'object') {
|
|
43
|
-
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
57
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => [
|
|
58
|
+
key,
|
|
59
|
+
SECRET_KEY.test(key) && typeof entry === 'string' ? '[REDACTED:secret]' : redactValue(entry, rules),
|
|
60
|
+
]));
|
|
44
61
|
}
|
|
45
62
|
return value;
|
|
46
63
|
}
|
package/dist/schema-sql.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Guaranteed to match the package version; a bump-or-fail test enforces that
|
|
5
5
|
* any modification to HISTORY_IMPORT_SCHEMA_SQL must be accompanied by a version bump.
|
|
6
6
|
*/
|
|
7
|
-
export declare const HISTORY_IMPORT_SCHEMA_VERSION = "0.5.
|
|
7
|
+
export declare const HISTORY_IMPORT_SCHEMA_VERSION = "0.5.7";
|
|
8
8
|
/**
|
|
9
9
|
* DDL string that creates the history import checkpoint, ledger, and typed contract tables.
|
|
10
10
|
*
|
package/dist/schema-sql.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Guaranteed to match the package version; a bump-or-fail test enforces that
|
|
5
5
|
* any modification to HISTORY_IMPORT_SCHEMA_SQL must be accompanied by a version bump.
|
|
6
6
|
*/
|
|
7
|
-
export const HISTORY_IMPORT_SCHEMA_VERSION = '0.5.
|
|
7
|
+
export const HISTORY_IMPORT_SCHEMA_VERSION = '0.5.7';
|
|
8
8
|
/**
|
|
9
9
|
* DDL string that creates the history import checkpoint, ledger, and typed contract tables.
|
|
10
10
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-llm-jsonl-importer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
4
4
|
"description": "@gobing-ai/ts-llm-jsonl-importer — Generic JSONL importer for LLM agent history files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-llm-jsonl-importer-v<version> && git push --tags' && exit 1"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@gobing-ai/ts-db": "^0.5.
|
|
51
|
-
"@gobing-ai/ts-runtime": "^0.5.
|
|
52
|
-
"@gobing-ai/ts-utils": "^0.5.
|
|
50
|
+
"@gobing-ai/ts-db": "^0.5.7",
|
|
51
|
+
"@gobing-ai/ts-runtime": "^0.5.7",
|
|
52
|
+
"@gobing-ai/ts-utils": "^0.5.7",
|
|
53
53
|
"zod": "^4.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
package/src/redaction.ts
CHANGED
|
@@ -3,8 +3,17 @@ import type { JsonObject, RedactionRule } from './types';
|
|
|
3
3
|
/** Default redaction rules for common token, key, and email shapes in agent logs. */
|
|
4
4
|
export const DEFAULT_REDACTION_RULES: readonly RedactionRule[] = [
|
|
5
5
|
{
|
|
6
|
+
// Task 0086 R5: vendor-specific token shapes. The underscore form
|
|
7
|
+
// deliberately requires a live/test infix — a bare sk_/pk_ prefix would
|
|
8
|
+
// redact DB identifiers like pk_customer_orders_id in code snippets.
|
|
6
9
|
name: 'api-key',
|
|
7
|
-
pattern:
|
|
10
|
+
pattern:
|
|
11
|
+
/\b(?:(?:sk|pk|ghp|github_pat|xox[baprs])-[-_a-zA-Z0-9]{12,}|(?:sk|pk|rk)_(?:live|test)_[A-Za-z0-9]{10,})\b/g,
|
|
12
|
+
replacement: '[REDACTED:token]',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'github-token',
|
|
16
|
+
pattern: /\b(?:gh[pousr]_[A-Za-z0-9]{20,}|github_pat_[A-Za-z0-9_]{20,})\b/g,
|
|
8
17
|
replacement: '[REDACTED:token]',
|
|
9
18
|
},
|
|
10
19
|
{
|
|
@@ -34,6 +43,14 @@ export const DEFAULT_REDACTION_RULES: readonly RedactionRule[] = [
|
|
|
34
43
|
},
|
|
35
44
|
];
|
|
36
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Keys whose string values are secrets regardless of shape (task 0086 R5).
|
|
48
|
+
* Anchored so usage-analytics keys (tokens_used, token_count, max_tokens) are
|
|
49
|
+
* NOT redacted — those appear in LLM usage records.
|
|
50
|
+
*/
|
|
51
|
+
const SECRET_KEY =
|
|
52
|
+
/^(?:api[_-]?key|apikey|api[_-]?secret|token|access[_-]?token|refresh[_-]?token|auth[_-]?token|secret|secret[_-]?key|client[_-]?secret|private[_-]?key|session[_-]?token|password|passwd|authorization)$/i;
|
|
53
|
+
|
|
37
54
|
/** Redact supported scalar and composite JSON values recursively. */
|
|
38
55
|
export function redactValue(value: unknown, rules: readonly RedactionRule[] = DEFAULT_REDACTION_RULES): unknown {
|
|
39
56
|
if (typeof value === 'string') {
|
|
@@ -44,7 +61,10 @@ export function redactValue(value: unknown, rules: readonly RedactionRule[] = DE
|
|
|
44
61
|
}
|
|
45
62
|
if (value !== null && typeof value === 'object') {
|
|
46
63
|
return Object.fromEntries(
|
|
47
|
-
Object.entries(value as JsonObject).map(([key, entry]) => [
|
|
64
|
+
Object.entries(value as JsonObject).map(([key, entry]) => [
|
|
65
|
+
key,
|
|
66
|
+
SECRET_KEY.test(key) && typeof entry === 'string' ? '[REDACTED:secret]' : redactValue(entry, rules),
|
|
67
|
+
]),
|
|
48
68
|
);
|
|
49
69
|
}
|
|
50
70
|
return value;
|
package/src/schema-sql.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Guaranteed to match the package version; a bump-or-fail test enforces that
|
|
5
5
|
* any modification to HISTORY_IMPORT_SCHEMA_SQL must be accompanied by a version bump.
|
|
6
6
|
*/
|
|
7
|
-
export const HISTORY_IMPORT_SCHEMA_VERSION = '0.5.
|
|
7
|
+
export const HISTORY_IMPORT_SCHEMA_VERSION = '0.5.7';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* DDL string that creates the history import checkpoint, ledger, and typed contract tables.
|