@pcircle/footprint 1.1.0 → 1.2.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/README.md +165 -12
- package/SKILL.md +72 -15
- package/dist/src/analyzers/content-analyzer.d.ts +20 -0
- package/dist/src/analyzers/content-analyzer.d.ts.map +1 -0
- package/dist/src/analyzers/content-analyzer.js +169 -0
- package/dist/src/analyzers/content-analyzer.js.map +1 -0
- package/dist/src/index.d.ts +38 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +243 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/crypto/decrypt.d.ts.map +1 -0
- package/dist/{lib → src/lib}/crypto/decrypt.js +4 -0
- package/dist/src/lib/crypto/decrypt.js.map +1 -0
- package/dist/src/lib/crypto/encrypt.d.ts.map +1 -0
- package/dist/src/lib/crypto/encrypt.js.map +1 -0
- package/dist/{lib → src/lib}/crypto/index.d.ts +1 -1
- package/dist/src/lib/crypto/index.d.ts.map +1 -0
- package/dist/{lib → src/lib}/crypto/index.js +1 -1
- package/dist/src/lib/crypto/index.js.map +1 -0
- package/dist/{lib → src/lib}/crypto/key-derivation.d.ts +17 -3
- package/dist/src/lib/crypto/key-derivation.d.ts.map +1 -0
- package/dist/{lib → src/lib}/crypto/key-derivation.js +44 -3
- package/dist/src/lib/crypto/key-derivation.js.map +1 -0
- package/dist/src/lib/crypto/types.d.ts.map +1 -0
- package/dist/src/lib/crypto/types.js.map +1 -0
- package/dist/src/lib/errors/base-error.d.ts +15 -0
- package/dist/src/lib/errors/base-error.d.ts.map +1 -0
- package/dist/src/lib/errors/base-error.js +34 -0
- package/dist/src/lib/errors/base-error.js.map +1 -0
- package/dist/src/lib/errors/crypto-error.d.ts +29 -0
- package/dist/src/lib/errors/crypto-error.d.ts.map +1 -0
- package/dist/src/lib/errors/crypto-error.js +43 -0
- package/dist/src/lib/errors/crypto-error.js.map +1 -0
- package/dist/src/lib/errors/index.d.ts +26 -0
- package/dist/src/lib/errors/index.d.ts.map +1 -0
- package/dist/src/lib/errors/index.js +26 -0
- package/dist/src/lib/errors/index.js.map +1 -0
- package/dist/src/lib/errors/storage-error.d.ts +25 -0
- package/dist/src/lib/errors/storage-error.d.ts.map +1 -0
- package/dist/src/lib/errors/storage-error.js +38 -0
- package/dist/src/lib/errors/storage-error.js.map +1 -0
- package/dist/src/lib/errors/validation-error.d.ts +21 -0
- package/dist/src/lib/errors/validation-error.d.ts.map +1 -0
- package/dist/src/lib/errors/validation-error.js +29 -0
- package/dist/src/lib/errors/validation-error.js.map +1 -0
- package/dist/{lib → src/lib}/storage/database.d.ts +14 -2
- package/dist/src/lib/storage/database.d.ts.map +1 -0
- package/dist/{lib → src/lib}/storage/database.js +65 -29
- package/dist/src/lib/storage/database.js.map +1 -0
- package/dist/src/lib/storage/export.d.ts.map +1 -0
- package/dist/{lib → src/lib}/storage/export.js +16 -1
- package/dist/src/lib/storage/export.js.map +1 -0
- package/dist/{lib → src/lib}/storage/git.d.ts +1 -1
- package/dist/src/lib/storage/git.d.ts.map +1 -0
- package/dist/{lib → src/lib}/storage/git.js +5 -2
- package/dist/src/lib/storage/git.js.map +1 -0
- package/dist/{lib → src/lib}/storage/index.d.ts +1 -0
- package/dist/src/lib/storage/index.d.ts.map +1 -0
- package/dist/{lib → src/lib}/storage/index.js +1 -0
- package/dist/src/lib/storage/index.js.map +1 -0
- package/dist/src/lib/storage/salt-storage.d.ts +25 -0
- package/dist/src/lib/storage/salt-storage.d.ts.map +1 -0
- package/dist/src/lib/storage/salt-storage.js +66 -0
- package/dist/src/lib/storage/salt-storage.js.map +1 -0
- package/dist/src/lib/storage/schema.d.ts.map +1 -0
- package/dist/{lib → src/lib}/storage/schema.js +22 -1
- package/dist/src/lib/storage/schema.js.map +1 -0
- package/dist/src/lib/storage/types.d.ts.map +1 -0
- package/dist/src/lib/storage/types.js.map +1 -0
- package/dist/src/lib/tool-response.d.ts +84 -0
- package/dist/src/lib/tool-response.d.ts.map +1 -0
- package/dist/src/lib/tool-response.js +91 -0
- package/dist/src/lib/tool-response.js.map +1 -0
- package/dist/src/lib/tool-wrapper.d.ts +45 -0
- package/dist/src/lib/tool-wrapper.d.ts.map +1 -0
- package/dist/src/lib/tool-wrapper.js +73 -0
- package/dist/src/lib/tool-wrapper.js.map +1 -0
- package/dist/{test-helpers.d.ts → src/test-helpers.d.ts} +4 -4
- package/dist/src/test-helpers.d.ts.map +1 -0
- package/dist/{test-helpers.js → src/test-helpers.js} +2 -2
- package/dist/src/test-helpers.js.map +1 -0
- package/dist/src/tools/capture-footprint.d.ts +29 -0
- package/dist/src/tools/capture-footprint.d.ts.map +1 -0
- package/dist/src/tools/capture-footprint.js +94 -0
- package/dist/src/tools/capture-footprint.js.map +1 -0
- package/dist/src/tools/delete-footprints.d.ts +22 -0
- package/dist/src/tools/delete-footprints.d.ts.map +1 -0
- package/dist/src/tools/delete-footprints.js +33 -0
- package/dist/src/tools/delete-footprints.js.map +1 -0
- package/dist/src/tools/export-footprints.d.ts +33 -0
- package/dist/src/tools/export-footprints.d.ts.map +1 -0
- package/dist/src/tools/export-footprints.js +50 -0
- package/dist/src/tools/export-footprints.js.map +1 -0
- package/dist/src/tools/get-footprint.d.ts +51 -0
- package/dist/src/tools/get-footprint.d.ts.map +1 -0
- package/dist/src/tools/get-footprint.js +66 -0
- package/dist/src/tools/get-footprint.js.map +1 -0
- package/dist/src/tools/get-tag-stats.d.ts +30 -0
- package/dist/src/tools/get-tag-stats.d.ts.map +1 -0
- package/dist/src/tools/get-tag-stats.js +33 -0
- package/dist/src/tools/get-tag-stats.js.map +1 -0
- package/dist/src/tools/index.d.ts +16 -0
- package/dist/src/tools/index.d.ts.map +1 -0
- package/dist/src/tools/index.js +16 -0
- package/dist/src/tools/index.js.map +1 -0
- package/dist/src/tools/list-footprints.d.ts +57 -0
- package/dist/src/tools/list-footprints.d.ts.map +1 -0
- package/dist/src/tools/list-footprints.js +57 -0
- package/dist/src/tools/list-footprints.js.map +1 -0
- package/dist/src/tools/remove-tag.d.ts +22 -0
- package/dist/src/tools/remove-tag.d.ts.map +1 -0
- package/dist/src/tools/remove-tag.js +30 -0
- package/dist/src/tools/remove-tag.js.map +1 -0
- package/dist/src/tools/rename-tag.d.ts +24 -0
- package/dist/src/tools/rename-tag.d.ts.map +1 -0
- package/dist/src/tools/rename-tag.js +34 -0
- package/dist/src/tools/rename-tag.js.map +1 -0
- package/dist/src/tools/search-footprints.d.ts +60 -0
- package/dist/src/tools/search-footprints.d.ts.map +1 -0
- package/dist/src/tools/search-footprints.js +78 -0
- package/dist/src/tools/search-footprints.js.map +1 -0
- package/dist/src/tools/suggest-capture.d.ts +21 -0
- package/dist/src/tools/suggest-capture.d.ts.map +1 -0
- package/dist/src/tools/suggest-capture.js +37 -0
- package/dist/src/tools/suggest-capture.js.map +1 -0
- package/dist/src/tools/verify-footprint.d.ts +104 -0
- package/dist/src/tools/verify-footprint.d.ts.map +1 -0
- package/dist/src/tools/verify-footprint.js +102 -0
- package/dist/src/tools/verify-footprint.js.map +1 -0
- package/dist/{types.d.ts → src/types.d.ts} +1 -1
- package/dist/src/types.d.ts.map +1 -0
- package/dist/{lib/storage → src}/types.js.map +1 -1
- package/dist/src/ui/register.d.ts.map +1 -0
- package/dist/src/ui/register.js +94 -0
- package/dist/src/ui/register.js.map +1 -0
- package/dist/tests/error-handling.test.d.ts +2 -0
- package/dist/tests/error-handling.test.d.ts.map +1 -0
- package/dist/tests/error-handling.test.js +114 -0
- package/dist/tests/error-handling.test.js.map +1 -0
- package/dist/tests/fixtures.d.ts +87 -0
- package/dist/tests/fixtures.d.ts.map +1 -0
- package/dist/tests/fixtures.js +130 -0
- package/dist/tests/fixtures.js.map +1 -0
- package/dist/tests/integration.test.d.ts +2 -0
- package/dist/tests/integration.test.d.ts.map +1 -0
- package/dist/tests/integration.test.js +115 -0
- package/dist/tests/integration.test.js.map +1 -0
- package/dist/tests/resources.test.d.ts +2 -0
- package/dist/tests/resources.test.d.ts.map +1 -0
- package/dist/tests/resources.test.js +73 -0
- package/dist/tests/resources.test.js.map +1 -0
- package/dist/tests/setup.d.ts +8 -0
- package/dist/tests/setup.d.ts.map +1 -0
- package/dist/tests/setup.js +8 -0
- package/dist/tests/setup.js.map +1 -0
- package/dist/tests/tools.test.d.ts +2 -0
- package/dist/tests/tools.test.d.ts.map +1 -0
- package/dist/tests/tools.test.js +224 -0
- package/dist/tests/tools.test.js.map +1 -0
- package/dist/ui/dashboard.html +1 -1
- package/dist/ui/detail.html +1 -1
- package/dist/ui/export.html +1 -1
- package/dist/ui-tmp/ui/export.html +1 -1
- package/package.json +6 -6
- package/dist/index.d.ts +0 -19
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -694
- package/dist/index.js.map +0 -1
- package/dist/lib/crypto/decrypt.d.ts.map +0 -1
- package/dist/lib/crypto/decrypt.js.map +0 -1
- package/dist/lib/crypto/encrypt.d.ts.map +0 -1
- package/dist/lib/crypto/encrypt.js.map +0 -1
- package/dist/lib/crypto/index.d.ts.map +0 -1
- package/dist/lib/crypto/index.js.map +0 -1
- package/dist/lib/crypto/key-derivation.d.ts.map +0 -1
- package/dist/lib/crypto/key-derivation.js.map +0 -1
- package/dist/lib/crypto/types.d.ts.map +0 -1
- package/dist/lib/crypto/types.js.map +0 -1
- package/dist/lib/storage/database.d.ts.map +0 -1
- package/dist/lib/storage/database.js.map +0 -1
- package/dist/lib/storage/export.d.ts.map +0 -1
- package/dist/lib/storage/export.js.map +0 -1
- package/dist/lib/storage/git.d.ts.map +0 -1
- package/dist/lib/storage/git.js.map +0 -1
- package/dist/lib/storage/index.d.ts.map +0 -1
- package/dist/lib/storage/index.js.map +0 -1
- package/dist/lib/storage/schema.d.ts.map +0 -1
- package/dist/lib/storage/schema.js.map +0 -1
- package/dist/lib/storage/types.d.ts.map +0 -1
- package/dist/test-helpers.d.ts.map +0 -1
- package/dist/test-helpers.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui/register.d.ts.map +0 -1
- package/dist/ui/register.js +0 -154
- package/dist/ui/register.js.map +0 -1
- /package/dist/{lib → src/lib}/crypto/decrypt.d.ts +0 -0
- /package/dist/{lib → src/lib}/crypto/encrypt.d.ts +0 -0
- /package/dist/{lib → src/lib}/crypto/encrypt.js +0 -0
- /package/dist/{lib → src/lib}/crypto/types.d.ts +0 -0
- /package/dist/{lib → src/lib}/crypto/types.js +0 -0
- /package/dist/{lib → src/lib}/storage/export.d.ts +0 -0
- /package/dist/{lib → src/lib}/storage/schema.d.ts +0 -0
- /package/dist/{lib → src/lib}/storage/types.d.ts +0 -0
- /package/dist/{lib → src/lib}/storage/types.js +0 -0
- /package/dist/{types.js → src/types.js} +0 -0
- /package/dist/{ui → src/ui}/register.d.ts +0 -0
|
@@ -10,6 +10,14 @@ const SCHEMA_VERSION = '1';
|
|
|
10
10
|
*/
|
|
11
11
|
export function createSchema(db) {
|
|
12
12
|
try {
|
|
13
|
+
// Enable WAL mode for better concurrency and crash safety
|
|
14
|
+
db.pragma('journal_mode = WAL');
|
|
15
|
+
// NORMAL synchronous is safe with WAL and much faster
|
|
16
|
+
db.pragma('synchronous = NORMAL');
|
|
17
|
+
// Wait 5 seconds before returning SQLITE_BUSY error
|
|
18
|
+
db.pragma('busy_timeout = 5000');
|
|
19
|
+
// Enable foreign key constraints
|
|
20
|
+
db.pragma('foreign_keys = ON');
|
|
13
21
|
// Create evidences table
|
|
14
22
|
db.exec(`
|
|
15
23
|
CREATE TABLE IF NOT EXISTS evidences (
|
|
@@ -28,12 +36,20 @@ export function createSchema(db) {
|
|
|
28
36
|
updatedAt TEXT NOT NULL DEFAULT (datetime('now'))
|
|
29
37
|
);
|
|
30
38
|
`);
|
|
31
|
-
// Create metadata table for schema versioning
|
|
39
|
+
// Create metadata table for schema versioning and configuration
|
|
32
40
|
db.exec(`
|
|
33
41
|
CREATE TABLE IF NOT EXISTS metadata (
|
|
34
42
|
key TEXT PRIMARY KEY,
|
|
35
43
|
value TEXT NOT NULL
|
|
36
44
|
);
|
|
45
|
+
`);
|
|
46
|
+
// Create crypto_keys table for master salt storage
|
|
47
|
+
db.exec(`
|
|
48
|
+
CREATE TABLE IF NOT EXISTS crypto_keys (
|
|
49
|
+
id INTEGER PRIMARY KEY CHECK (id = 1),
|
|
50
|
+
salt BLOB NOT NULL,
|
|
51
|
+
createdAt TEXT NOT NULL DEFAULT (datetime('now'))
|
|
52
|
+
);
|
|
37
53
|
`);
|
|
38
54
|
// Create indexes for common queries
|
|
39
55
|
db.exec(`
|
|
@@ -77,6 +93,11 @@ export function verifySchema(db) {
|
|
|
77
93
|
if (!metadataTableInfo || metadataTableInfo.length === 0) {
|
|
78
94
|
return false;
|
|
79
95
|
}
|
|
96
|
+
// Check if crypto_keys table exists
|
|
97
|
+
const cryptoKeysTableInfo = db.pragma('table_info(crypto_keys)');
|
|
98
|
+
if (!cryptoKeysTableInfo || cryptoKeysTableInfo.length === 0) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
80
101
|
// Verify required columns exist in evidences table
|
|
81
102
|
const evidencesColumns = evidencesTableInfo.map((col) => col.name);
|
|
82
103
|
const requiredColumns = [
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/lib/storage/schema.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,EAAqB;IAChD,IAAI,CAAC;QACH,0DAA0D;QAC1D,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;QAChC,sDAAsD;QACtD,EAAE,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC;QAClC,oDAAoD;QACpD,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;QACjC,iCAAiC;QACjC,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;QAE/B,yBAAyB;QACzB,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AAQ;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/lib/storage/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standardized tool response builder for MCP tools
|
|
3
|
+
* Provides consistent formatting across all tool handlers
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* MCP tool response structure
|
|
7
|
+
* Includes index signature to match MCP SDK requirements
|
|
8
|
+
*/
|
|
9
|
+
export interface ToolResponse<T = unknown> {
|
|
10
|
+
content: Array<{
|
|
11
|
+
type: 'text';
|
|
12
|
+
text: string;
|
|
13
|
+
}>;
|
|
14
|
+
structuredContent?: T;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a standardized tool response
|
|
19
|
+
*
|
|
20
|
+
* @param message - Human-readable message (can include newlines and formatting)
|
|
21
|
+
* @param structuredContent - Machine-readable structured data
|
|
22
|
+
* @returns Formatted tool response
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* return createToolResponse(
|
|
27
|
+
* '✅ Evidence captured successfully\n- ID: abc123\n- Timestamp: 2024-01-01',
|
|
28
|
+
* { id: 'abc123', timestamp: '2024-01-01', success: true }
|
|
29
|
+
* );
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function createToolResponse<T>(message: string, structuredContent: T): ToolResponse<T>;
|
|
33
|
+
/**
|
|
34
|
+
* Format a key-value object as a bulleted list
|
|
35
|
+
*
|
|
36
|
+
* @param items - Key-value pairs to format
|
|
37
|
+
* @param indent - Indentation string (default: '- ')
|
|
38
|
+
* @returns Formatted bullet list string
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* formatBulletList({ id: '123', count: 5, tag: null })
|
|
43
|
+
* // Returns: "- id: 123\n- count: 5"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function formatBulletList(items: Record<string, string | number | boolean | null | undefined>, indent?: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Format a success response with standardized emoji and structure
|
|
49
|
+
*
|
|
50
|
+
* @param title - Success message title
|
|
51
|
+
* @param details - Key-value details to display
|
|
52
|
+
* @param structuredContent - Machine-readable data
|
|
53
|
+
* @returns Formatted success response
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* return formatSuccessResponse(
|
|
58
|
+
* 'Evidence captured successfully',
|
|
59
|
+
* { id: 'abc123', timestamp: '2024-01-01' },
|
|
60
|
+
* { id: 'abc123', success: true }
|
|
61
|
+
* );
|
|
62
|
+
* // Returns: "✅ Evidence captured successfully\n- id: abc123\n- timestamp: 2024-01-01"
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatSuccessResponse<T>(title: string, details: Record<string, string | number | boolean | null | undefined>, structuredContent: T): ToolResponse<T>;
|
|
66
|
+
/**
|
|
67
|
+
* Format an error response with standardized emoji
|
|
68
|
+
*
|
|
69
|
+
* @param title - Error message title
|
|
70
|
+
* @param reason - Error reason or details
|
|
71
|
+
* @param structuredContent - Machine-readable error data
|
|
72
|
+
* @returns Formatted error response
|
|
73
|
+
*/
|
|
74
|
+
export declare function formatErrorResponse<T>(title: string, reason: string, structuredContent: T): ToolResponse<T>;
|
|
75
|
+
/**
|
|
76
|
+
* Format a warning response with standardized emoji
|
|
77
|
+
*
|
|
78
|
+
* @param title - Warning message title
|
|
79
|
+
* @param details - Warning details
|
|
80
|
+
* @param structuredContent - Machine-readable data
|
|
81
|
+
* @returns Formatted warning response
|
|
82
|
+
*/
|
|
83
|
+
export declare function formatWarningResponse<T>(title: string, details: string, structuredContent: T): ToolResponse<T>;
|
|
84
|
+
//# sourceMappingURL=tool-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-response.d.ts","sourceRoot":"","sources":["../../../src/lib/tool-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC,GAAG,OAAO;IACvC,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,iBAAiB,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,CAAC,GACnB,YAAY,CAAC,CAAC,CAAC,CAKjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,EACnE,MAAM,SAAO,GACZ,MAAM,CAKR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,EACrE,iBAAiB,EAAE,CAAC,GACnB,YAAY,CAAC,CAAC,CAAC,CAGjB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,CAAC,GACnB,YAAY,CAAC,CAAC,CAAC,CAGjB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EACrC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,CAAC,GACnB,YAAY,CAAC,CAAC,CAAC,CAGjB"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standardized tool response builder for MCP tools
|
|
3
|
+
* Provides consistent formatting across all tool handlers
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Create a standardized tool response
|
|
7
|
+
*
|
|
8
|
+
* @param message - Human-readable message (can include newlines and formatting)
|
|
9
|
+
* @param structuredContent - Machine-readable structured data
|
|
10
|
+
* @returns Formatted tool response
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* return createToolResponse(
|
|
15
|
+
* '✅ Evidence captured successfully\n- ID: abc123\n- Timestamp: 2024-01-01',
|
|
16
|
+
* { id: 'abc123', timestamp: '2024-01-01', success: true }
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export function createToolResponse(message, structuredContent) {
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: 'text', text: message }],
|
|
23
|
+
structuredContent
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Format a key-value object as a bulleted list
|
|
28
|
+
*
|
|
29
|
+
* @param items - Key-value pairs to format
|
|
30
|
+
* @param indent - Indentation string (default: '- ')
|
|
31
|
+
* @returns Formatted bullet list string
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* formatBulletList({ id: '123', count: 5, tag: null })
|
|
36
|
+
* // Returns: "- id: 123\n- count: 5"
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export function formatBulletList(items, indent = '- ') {
|
|
40
|
+
return Object.entries(items)
|
|
41
|
+
.filter(([, value]) => value !== undefined && value !== null)
|
|
42
|
+
.map(([key, value]) => `${indent}${key}: ${value}`)
|
|
43
|
+
.join('\n');
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Format a success response with standardized emoji and structure
|
|
47
|
+
*
|
|
48
|
+
* @param title - Success message title
|
|
49
|
+
* @param details - Key-value details to display
|
|
50
|
+
* @param structuredContent - Machine-readable data
|
|
51
|
+
* @returns Formatted success response
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* return formatSuccessResponse(
|
|
56
|
+
* 'Evidence captured successfully',
|
|
57
|
+
* { id: 'abc123', timestamp: '2024-01-01' },
|
|
58
|
+
* { id: 'abc123', success: true }
|
|
59
|
+
* );
|
|
60
|
+
* // Returns: "✅ Evidence captured successfully\n- id: abc123\n- timestamp: 2024-01-01"
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function formatSuccessResponse(title, details, structuredContent) {
|
|
64
|
+
const message = `✅ ${title}\n${formatBulletList(details)}`;
|
|
65
|
+
return createToolResponse(message, structuredContent);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Format an error response with standardized emoji
|
|
69
|
+
*
|
|
70
|
+
* @param title - Error message title
|
|
71
|
+
* @param reason - Error reason or details
|
|
72
|
+
* @param structuredContent - Machine-readable error data
|
|
73
|
+
* @returns Formatted error response
|
|
74
|
+
*/
|
|
75
|
+
export function formatErrorResponse(title, reason, structuredContent) {
|
|
76
|
+
const message = `❌ ${title}\n${reason}`;
|
|
77
|
+
return createToolResponse(message, structuredContent);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Format a warning response with standardized emoji
|
|
81
|
+
*
|
|
82
|
+
* @param title - Warning message title
|
|
83
|
+
* @param details - Warning details
|
|
84
|
+
* @param structuredContent - Machine-readable data
|
|
85
|
+
* @returns Formatted warning response
|
|
86
|
+
*/
|
|
87
|
+
export function formatWarningResponse(title, details, structuredContent) {
|
|
88
|
+
const message = `⚠️ ${title}\n${details}`;
|
|
89
|
+
return createToolResponse(message, structuredContent);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=tool-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-response.js","sourceRoot":"","sources":["../../../src/lib/tool-response.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAe,EACf,iBAAoB;IAEpB,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC1C,iBAAiB;KAClB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAmE,EACnE,MAAM,GAAG,IAAI;IAEb,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;SAC5D,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,GAAG,KAAK,KAAK,EAAE,CAAC;SAClD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,OAAqE,EACrE,iBAAoB;IAEpB,MAAM,OAAO,GAAG,KAAK,KAAK,KAAK,gBAAgB,CAAC,OAAO,CAAC,EAAE,CAAC;IAC3D,OAAO,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,KAAa,EACb,MAAc,EACd,iBAAoB;IAEpB,MAAM,OAAO,GAAG,KAAK,KAAK,KAAK,MAAM,EAAE,CAAC;IACxC,OAAO,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CACnC,KAAa,EACb,OAAe,EACf,iBAAoB;IAEpB,MAAM,OAAO,GAAG,MAAM,KAAK,KAAK,OAAO,EAAE,CAAC;IAC1C,OAAO,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handler error wrapper for consistent error handling
|
|
3
|
+
* Provides standardized error messages across all MCP tools
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get error message from unknown error type
|
|
7
|
+
* Handles Error objects, strings, and other types safely
|
|
8
|
+
*
|
|
9
|
+
* @param error - Unknown error value
|
|
10
|
+
* @returns Error message string
|
|
11
|
+
*/
|
|
12
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
13
|
+
/**
|
|
14
|
+
* Wrap a tool handler with standardized error handling
|
|
15
|
+
* Catches errors and formats them with tool name and suggested action
|
|
16
|
+
*
|
|
17
|
+
* @param toolName - Name of the tool (e.g., 'capture-footprint')
|
|
18
|
+
* @param suggestedAction - Action to suggest when error occurs
|
|
19
|
+
* @param handler - The actual tool handler function
|
|
20
|
+
* @returns Wrapped handler with error handling
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const handler = wrapToolHandler(
|
|
25
|
+
* 'capture-footprint',
|
|
26
|
+
* 'Check content is not empty and messageCount is positive.',
|
|
27
|
+
* async (params) => {
|
|
28
|
+
* // Handler implementation
|
|
29
|
+
* return { ... };
|
|
30
|
+
* }
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare function wrapToolHandler<TParams, TResult>(toolName: string, suggestedAction: string, handler: (params: TParams) => Promise<TResult>): (params: TParams) => Promise<TResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Wrap a synchronous tool handler with error handling
|
|
37
|
+
* Same as wrapToolHandler but for sync functions
|
|
38
|
+
*
|
|
39
|
+
* @param toolName - Name of the tool
|
|
40
|
+
* @param suggestedAction - Action to suggest when error occurs
|
|
41
|
+
* @param handler - The actual tool handler function (synchronous)
|
|
42
|
+
* @returns Wrapped handler with error handling
|
|
43
|
+
*/
|
|
44
|
+
export declare function wrapSyncToolHandler<TParams, TResult>(toolName: string, suggestedAction: string, handler: (params: TParams) => TResult): (params: TParams) => TResult;
|
|
45
|
+
//# sourceMappingURL=tool-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-wrapper.d.ts","sourceRoot":"","sources":["../../../src/lib/tool-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQtD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAC9C,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,GAC7C,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAWvC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAClD,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,GACpC,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAW9B"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool handler error wrapper for consistent error handling
|
|
3
|
+
* Provides standardized error messages across all MCP tools
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Get error message from unknown error type
|
|
7
|
+
* Handles Error objects, strings, and other types safely
|
|
8
|
+
*
|
|
9
|
+
* @param error - Unknown error value
|
|
10
|
+
* @returns Error message string
|
|
11
|
+
*/
|
|
12
|
+
export function getErrorMessage(error) {
|
|
13
|
+
if (error instanceof Error) {
|
|
14
|
+
return error.message;
|
|
15
|
+
}
|
|
16
|
+
if (typeof error === 'string') {
|
|
17
|
+
return error;
|
|
18
|
+
}
|
|
19
|
+
return 'Unknown error';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Wrap a tool handler with standardized error handling
|
|
23
|
+
* Catches errors and formats them with tool name and suggested action
|
|
24
|
+
*
|
|
25
|
+
* @param toolName - Name of the tool (e.g., 'capture-footprint')
|
|
26
|
+
* @param suggestedAction - Action to suggest when error occurs
|
|
27
|
+
* @param handler - The actual tool handler function
|
|
28
|
+
* @returns Wrapped handler with error handling
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const handler = wrapToolHandler(
|
|
33
|
+
* 'capture-footprint',
|
|
34
|
+
* 'Check content is not empty and messageCount is positive.',
|
|
35
|
+
* async (params) => {
|
|
36
|
+
* // Handler implementation
|
|
37
|
+
* return { ... };
|
|
38
|
+
* }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export function wrapToolHandler(toolName, suggestedAction, handler) {
|
|
43
|
+
return async (params) => {
|
|
44
|
+
try {
|
|
45
|
+
return await handler(params);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
const errorMessage = getErrorMessage(error);
|
|
49
|
+
throw new Error(`[Tool: ${toolName}] ${errorMessage}. Suggested action: ${suggestedAction}`);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Wrap a synchronous tool handler with error handling
|
|
55
|
+
* Same as wrapToolHandler but for sync functions
|
|
56
|
+
*
|
|
57
|
+
* @param toolName - Name of the tool
|
|
58
|
+
* @param suggestedAction - Action to suggest when error occurs
|
|
59
|
+
* @param handler - The actual tool handler function (synchronous)
|
|
60
|
+
* @returns Wrapped handler with error handling
|
|
61
|
+
*/
|
|
62
|
+
export function wrapSyncToolHandler(toolName, suggestedAction, handler) {
|
|
63
|
+
return (params) => {
|
|
64
|
+
try {
|
|
65
|
+
return handler(params);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const errorMessage = getErrorMessage(error);
|
|
69
|
+
throw new Error(`[Tool: ${toolName}] ${errorMessage}. Suggested action: ${suggestedAction}`);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=tool-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-wrapper.js","sourceRoot":"","sources":["../../../src/lib/tool-wrapper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAgB,EAChB,eAAuB,EACvB,OAA8C;IAE9C,OAAO,KAAK,EAAE,MAAe,EAAE,EAAE;QAC/B,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,UAAU,QAAQ,KAAK,YAAY,uBAAuB,eAAe,EAAE,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAAgB,EAChB,eAAuB,EACvB,OAAqC;IAErC,OAAO,CAAC,MAAe,EAAE,EAAE;QACzB,IAAI,CAAC;YACH,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;YAC5C,MAAM,IAAI,KAAK,CACb,UAAU,QAAQ,KAAK,YAAY,uBAAuB,eAAe,EAAE,CAC5E,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test Helper Utilities for
|
|
2
|
+
* Test Helper Utilities for Footprint Server
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { FootprintServer } from './index.js';
|
|
5
5
|
export interface ToolInfo {
|
|
6
6
|
name: string;
|
|
7
7
|
description: string;
|
|
@@ -12,9 +12,9 @@ export interface ResourceInfo {
|
|
|
12
12
|
description: string;
|
|
13
13
|
mimeType: string;
|
|
14
14
|
}
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class FootprintTestHelpers {
|
|
16
16
|
private server;
|
|
17
|
-
constructor(server:
|
|
17
|
+
constructor(server: FootprintServer);
|
|
18
18
|
private getServerInternal;
|
|
19
19
|
getTools(): Promise<ToolInfo[]>;
|
|
20
20
|
getResources(): Promise<ResourceInfo[]>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-helpers.d.ts","sourceRoot":"","sources":["../../src/test-helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuDD,qBAAa,oBAAoB;IACnB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE3C,OAAO,CAAC,iBAAiB;IAInB,QAAQ,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAS/B,YAAY,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAiBvC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,KAAK,CAAC;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;KAAE,CAAC;IA0BxG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAmBhG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAAE,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;CAIvH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test Helper Utilities for
|
|
2
|
+
* Test Helper Utilities for Footprint Server
|
|
3
3
|
*/
|
|
4
4
|
function getFromRegistry(registry, finder) {
|
|
5
5
|
if (!registry)
|
|
@@ -41,7 +41,7 @@ function mapRegistry(registry, mapper) {
|
|
|
41
41
|
}
|
|
42
42
|
return [];
|
|
43
43
|
}
|
|
44
|
-
export class
|
|
44
|
+
export class FootprintTestHelpers {
|
|
45
45
|
server;
|
|
46
46
|
constructor(server) {
|
|
47
47
|
this.server = server;
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EvidenceDatabase } from "../lib/storage/index.js";
|
|
3
|
+
import type { CaptureEvidenceParams } from "../types.js";
|
|
4
|
+
export declare const captureFootprintSchema: {
|
|
5
|
+
inputSchema: {
|
|
6
|
+
conversationId: z.ZodString;
|
|
7
|
+
llmProvider: z.ZodString;
|
|
8
|
+
content: z.ZodString;
|
|
9
|
+
messageCount: z.ZodNumber;
|
|
10
|
+
tags: z.ZodOptional<z.ZodString>;
|
|
11
|
+
};
|
|
12
|
+
outputSchema: {
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
timestamp: z.ZodString;
|
|
15
|
+
gitCommitHash: z.ZodNullable<z.ZodString>;
|
|
16
|
+
success: z.ZodBoolean;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const captureFootprintMetadata: {
|
|
20
|
+
title: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
export declare function createCaptureFootprintHandler(db: EvidenceDatabase, getDerivedKey: () => Promise<Uint8Array>): (params: CaptureEvidenceParams) => Promise<import("../lib/tool-response.js").ToolResponse<{
|
|
24
|
+
id: string;
|
|
25
|
+
timestamp: string;
|
|
26
|
+
gitCommitHash: string | null;
|
|
27
|
+
success: boolean;
|
|
28
|
+
}>>;
|
|
29
|
+
//# sourceMappingURL=capture-footprint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-footprint.d.ts","sourceRoot":"","sources":["../../../src/tools/capture-footprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEzD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;CAkBlC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,wBAAgB,6BAA6B,CAC3C,EAAE,EAAE,gBAAgB,EACpB,aAAa,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC;;;;;IAmFzC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import * as crypto from "crypto";
|
|
3
|
+
import { wrapToolHandler } from "../lib/tool-wrapper.js";
|
|
4
|
+
import { formatSuccessResponse } from "../lib/tool-response.js";
|
|
5
|
+
import { encrypt } from "../lib/crypto/index.js";
|
|
6
|
+
import { getCurrentCommit, } from "../lib/storage/index.js";
|
|
7
|
+
export const captureFootprintSchema = {
|
|
8
|
+
inputSchema: {
|
|
9
|
+
conversationId: z.string().describe("Conversation ID"),
|
|
10
|
+
llmProvider: z
|
|
11
|
+
.string()
|
|
12
|
+
.describe("LLM provider name (e.g., Claude Sonnet 4.5)"),
|
|
13
|
+
content: z
|
|
14
|
+
.string()
|
|
15
|
+
.describe("Conversation content (messages, prompts, responses)"),
|
|
16
|
+
messageCount: z.number().int().positive().describe("Number of messages"),
|
|
17
|
+
tags: z.string().optional().describe("Optional tags (comma-separated)"),
|
|
18
|
+
},
|
|
19
|
+
outputSchema: {
|
|
20
|
+
id: z.string(),
|
|
21
|
+
timestamp: z.string(),
|
|
22
|
+
gitCommitHash: z.string().nullable(),
|
|
23
|
+
success: z.boolean(),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export const captureFootprintMetadata = {
|
|
27
|
+
title: "Capture Footprint",
|
|
28
|
+
description: "Capture and encrypt LLM conversation as footprint",
|
|
29
|
+
};
|
|
30
|
+
export function createCaptureFootprintHandler(db, getDerivedKey) {
|
|
31
|
+
return wrapToolHandler("capture-footprint", "Check content is not empty, messageCount is positive, and tags format is valid.", async (params) => {
|
|
32
|
+
// Validation
|
|
33
|
+
if (!params.content || params.content.trim().length === 0) {
|
|
34
|
+
throw new Error("Content cannot be empty");
|
|
35
|
+
}
|
|
36
|
+
if (params.messageCount <= 0) {
|
|
37
|
+
throw new Error("Message count must be positive");
|
|
38
|
+
}
|
|
39
|
+
// eslint-disable-next-line no-control-regex
|
|
40
|
+
if (/[\x00\n\r,]/.test(params.conversationId)) {
|
|
41
|
+
throw new Error("Conversation ID cannot contain null bytes, newlines, or commas");
|
|
42
|
+
}
|
|
43
|
+
// Validate and sanitize tags if provided
|
|
44
|
+
if (params.tags) {
|
|
45
|
+
const tags = params.tags
|
|
46
|
+
.split(",")
|
|
47
|
+
.map((t) => t.trim())
|
|
48
|
+
.filter((t) => t.length > 0);
|
|
49
|
+
if (tags.length === 0) {
|
|
50
|
+
throw new Error("All provided tags are empty or whitespace");
|
|
51
|
+
}
|
|
52
|
+
for (const tag of tags) {
|
|
53
|
+
// eslint-disable-next-line no-control-regex
|
|
54
|
+
if (/[\x00\n\r,]/.test(tag)) {
|
|
55
|
+
throw new Error(`Invalid tag format: "${tag}". Tags cannot contain null bytes, newlines, or commas.`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
params.tags = tags.join(",");
|
|
59
|
+
}
|
|
60
|
+
// Encrypt and capture
|
|
61
|
+
const key = await getDerivedKey();
|
|
62
|
+
const encrypted = await encrypt(params.content, key);
|
|
63
|
+
const gitInfo = await getCurrentCommit();
|
|
64
|
+
const contentHash = crypto
|
|
65
|
+
.createHash("sha256")
|
|
66
|
+
.update(params.content)
|
|
67
|
+
.digest("hex");
|
|
68
|
+
const timestamp = new Date().toISOString();
|
|
69
|
+
const id = db.create({
|
|
70
|
+
timestamp,
|
|
71
|
+
conversationId: params.conversationId,
|
|
72
|
+
llmProvider: params.llmProvider,
|
|
73
|
+
encryptedContent: encrypted.ciphertext,
|
|
74
|
+
nonce: encrypted.nonce,
|
|
75
|
+
contentHash,
|
|
76
|
+
messageCount: params.messageCount,
|
|
77
|
+
gitCommitHash: gitInfo?.commitHash || null,
|
|
78
|
+
gitTimestamp: gitInfo?.timestamp || null,
|
|
79
|
+
tags: params.tags || null,
|
|
80
|
+
});
|
|
81
|
+
return formatSuccessResponse("Evidence captured successfully", {
|
|
82
|
+
ID: id,
|
|
83
|
+
Timestamp: timestamp,
|
|
84
|
+
"Git Commit": gitInfo?.commitHash || "N/A",
|
|
85
|
+
"Message Count": params.messageCount,
|
|
86
|
+
}, {
|
|
87
|
+
id,
|
|
88
|
+
timestamp,
|
|
89
|
+
gitCommitHash: gitInfo?.commitHash || null,
|
|
90
|
+
success: true,
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=capture-footprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"capture-footprint.js","sourceRoot":"","sources":["../../../src/tools/capture-footprint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAmB,MAAM,wBAAwB,CAAC;AAClE,OAAO,EACL,gBAAgB,GAEjB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,WAAW,EAAE;QACX,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QACtD,WAAW,EAAE,CAAC;aACX,MAAM,EAAE;aACR,QAAQ,CAAC,6CAA6C,CAAC;QAC1D,OAAO,EAAE,CAAC;aACP,MAAM,EAAE;aACR,QAAQ,CAAC,qDAAqD,CAAC;QAClE,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;QACxE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;KACxE;IACD,YAAY,EAAE;QACZ,EAAE,EAAE,CAAC,CAA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AE,EAAE,EAAE;YACN,SAAS,EAAE,SAAS;YACpB,YAAY,EAAE,OAAO,EAAE,UAAU,IAAI,KAAK;YAC1C,eAAe,EAAE,MAAM,CAAC,YAAY;SACrC,EACD;YACE,EAAE;YACF,SAAS;YACT,aAAa,EAAE,OAAO,EAAE,UAAU,IAAI,IAAI;YAC1C,OAAO,EAAE,IAAI;SACd,CACF,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import type { EvidenceDatabase } from "../lib/storage/index.js";
|
|
3
|
+
export declare const deleteFootprintsSchema: {
|
|
4
|
+
inputSchema: {
|
|
5
|
+
evidenceIds: z.ZodArray<z.ZodString, "many">;
|
|
6
|
+
};
|
|
7
|
+
outputSchema: {
|
|
8
|
+
deletedCount: z.ZodNumber;
|
|
9
|
+
success: z.ZodBoolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const deleteFootprintsMetadata: {
|
|
13
|
+
title: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function createDeleteFootprintsHandler(db: EvidenceDatabase): (params: {
|
|
17
|
+
evidenceIds: string[];
|
|
18
|
+
}) => Promise<import("../lib/tool-response.js").ToolResponse<{
|
|
19
|
+
deletedCount: number;
|
|
20
|
+
success: boolean;
|
|
21
|
+
}>>;
|
|
22
|
+
//# sourceMappingURL=delete-footprints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-footprints.d.ts","sourceRoot":"","sources":["../../../src/tools/delete-footprints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAGzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,eAAO,MAAM,sBAAsB;;;;;;;;CAWlC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,gBAAgB;iBAIhC,MAAM,EAAE;;;;IAezC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { wrapToolHandler } from "../lib/tool-wrapper.js";
|
|
3
|
+
import { createToolResponse } from "../lib/tool-response.js";
|
|
4
|
+
export const deleteFootprintsSchema = {
|
|
5
|
+
inputSchema: {
|
|
6
|
+
evidenceIds: z
|
|
7
|
+
.array(z.string())
|
|
8
|
+
.min(1)
|
|
9
|
+
.describe("Array of footprint IDs to delete"),
|
|
10
|
+
},
|
|
11
|
+
outputSchema: {
|
|
12
|
+
deletedCount: z.number(),
|
|
13
|
+
success: z.boolean(),
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
export const deleteFootprintsMetadata = {
|
|
17
|
+
title: "Delete Footprints",
|
|
18
|
+
description: "Permanently delete one or more footprint records",
|
|
19
|
+
};
|
|
20
|
+
export function createDeleteFootprintsHandler(db) {
|
|
21
|
+
return wrapToolHandler("delete-footprints", "Verify the footprint IDs exist.", async (params) => {
|
|
22
|
+
if (!params.evidenceIds || params.evidenceIds.length === 0) {
|
|
23
|
+
throw new Error("At least one evidence ID is required");
|
|
24
|
+
}
|
|
25
|
+
const deletedCount = db.deleteMany(params.evidenceIds);
|
|
26
|
+
const success = deletedCount > 0;
|
|
27
|
+
const resultText = success
|
|
28
|
+
? `🗑️ Successfully deleted ${deletedCount} footprint record${deletedCount > 1 ? "s" : ""}`
|
|
29
|
+
: `⚠️ No footprint records found with the provided IDs`;
|
|
30
|
+
return createToolResponse(resultText, { deletedCount, success });
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=delete-footprints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-footprints.js","sourceRoot":"","sources":["../../../src/tools/delete-footprints.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAC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