@dexto/image-logger-agent 1.6.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 +44 -0
- package/README.md +5 -0
- package/dist/hooks/request-logger.cjs +126 -0
- package/dist/hooks/request-logger.d.cts +23 -0
- package/dist/hooks/request-logger.d.ts +23 -0
- package/dist/hooks/request-logger.js +102 -0
- package/dist/index.cjs +64 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +33 -0
- package/package.json +42 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Elastic License 2.0 (ELv2)
|
|
2
|
+
|
|
3
|
+
**Acceptance**
|
|
4
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
5
|
+
|
|
6
|
+
**Copyright License**
|
|
7
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide, non-sublicensable, non-transferable license to use, copy, distribute, make available, and prepare derivative works of the software, in each case subject to the limitations and conditions below
|
|
8
|
+
|
|
9
|
+
**Limitations**
|
|
10
|
+
You may not provide the software to third parties as a hosted or managed service, where the service provides users with access to any substantial set of the features or functionality of the software.
|
|
11
|
+
|
|
12
|
+
You may not move, change, disable, or circumvent the license key functionality in the software, and you may not remove or obscure any functionality in the software that is protected by the license key.
|
|
13
|
+
|
|
14
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices of the licensor in the software. Any use of the licensor’s trademarks is subject to applicable law.
|
|
15
|
+
|
|
16
|
+
**Patents**
|
|
17
|
+
The licensor grants you a license, under any patent claims the licensor can license, or becomes able to license, to make, have made, use, sell, offer for sale, import and have imported the software, in each case subject to the limitations and conditions in this license. This license does not cover any patent claims that you cause to be infringed by modifications or additions to the software. If you or your company make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
18
|
+
|
|
19
|
+
**Notices**
|
|
20
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms.
|
|
21
|
+
|
|
22
|
+
If you modify the software, you must include in any modified copies of the software prominent notices stating that you have modified the software.
|
|
23
|
+
|
|
24
|
+
**No Other Rights**
|
|
25
|
+
These terms do not imply any licenses other than those expressly granted in these terms.
|
|
26
|
+
|
|
27
|
+
**Termination**
|
|
28
|
+
If you use the software in violation of these terms, such use is not licensed, and your licenses will automatically terminate. If the licensor provides you with a notice of your violation, and you cease all violation of this license no later than 30 days after you receive that notice, your licenses will be reinstated retroactively. However, if you violate these terms after such reinstatement, any additional violation of these terms will cause your licenses to terminate automatically and permanently.
|
|
29
|
+
|
|
30
|
+
**No Liability**
|
|
31
|
+
As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.
|
|
32
|
+
|
|
33
|
+
**Definitions**
|
|
34
|
+
The _licensor_ is the entity offering these terms, and the _software_ is the software the licensor makes available under these terms, including any portion of it.
|
|
35
|
+
|
|
36
|
+
_you_ refers to the individual or entity agreeing to these terms.
|
|
37
|
+
|
|
38
|
+
_your company_ is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all organizations that have control over, are under the control of, or are under common control with that organization. _control_ means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
39
|
+
|
|
40
|
+
_your licenses_ are all the licenses granted to you for the software under these terms.
|
|
41
|
+
|
|
42
|
+
_use_ means anything you do with the software requiring one of your licenses.
|
|
43
|
+
|
|
44
|
+
_trademark_ means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var request_logger_exports = {};
|
|
20
|
+
__export(request_logger_exports, {
|
|
21
|
+
RequestLoggerHook: () => RequestLoggerHook,
|
|
22
|
+
default: () => request_logger_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(request_logger_exports);
|
|
25
|
+
var import_node_fs = require("node:fs");
|
|
26
|
+
var import_node_os = require("node:os");
|
|
27
|
+
var import_node_path = require("node:path");
|
|
28
|
+
class RequestLoggerHook {
|
|
29
|
+
logFilePath = "";
|
|
30
|
+
logFileHandle = null;
|
|
31
|
+
requestCount = 0;
|
|
32
|
+
async initialize(config) {
|
|
33
|
+
const typed = config;
|
|
34
|
+
const logDir = typed.logDir || (0, import_node_path.join)((0, import_node_os.homedir)(), ".dexto", "logs");
|
|
35
|
+
const logFileName = typed.logFileName || "request-logger.log";
|
|
36
|
+
this.logFilePath = (0, import_node_path.join)(logDir, logFileName);
|
|
37
|
+
await import_node_fs.promises.mkdir(logDir, { recursive: true });
|
|
38
|
+
this.logFileHandle = await import_node_fs.promises.open(this.logFilePath, "a");
|
|
39
|
+
await this.writeLog("=".repeat(80));
|
|
40
|
+
await this.writeLog(`Request Logger initialized at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
41
|
+
await this.writeLog(`Log file: ${this.logFilePath}`);
|
|
42
|
+
await this.writeLog("=".repeat(80));
|
|
43
|
+
}
|
|
44
|
+
async beforeLLMRequest(payload, context) {
|
|
45
|
+
this.requestCount++;
|
|
46
|
+
await this.writeLog("");
|
|
47
|
+
await this.writeLog(`[${this.requestCount}] USER REQUEST at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
48
|
+
await this.writeLog(`Session: ${payload.sessionId || "unknown"}`);
|
|
49
|
+
await this.writeLog(`User: ${context.userId || "anonymous"}`);
|
|
50
|
+
await this.writeLog(`Model: ${context.llmConfig.provider}/${context.llmConfig.model}`);
|
|
51
|
+
await this.writeLog("-".repeat(40));
|
|
52
|
+
await this.writeLog(`Text: ${payload.text}`);
|
|
53
|
+
if (payload.imageData) {
|
|
54
|
+
await this.writeLog(
|
|
55
|
+
`Image: ${payload.imageData.mimeType} (${payload.imageData.image.length} chars)`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
if (payload.fileData) {
|
|
59
|
+
await this.writeLog(
|
|
60
|
+
`File: ${payload.fileData.filename || "unknown"} (${payload.fileData.mimeType})`
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
await this.writeLog("-".repeat(40));
|
|
64
|
+
return { ok: true };
|
|
65
|
+
}
|
|
66
|
+
async beforeToolCall(payload, _context) {
|
|
67
|
+
await this.writeLog("");
|
|
68
|
+
await this.writeLog(`[${this.requestCount}] TOOL CALL at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
69
|
+
await this.writeLog(`Tool: ${payload.toolName}`);
|
|
70
|
+
await this.writeLog(`Call ID: ${payload.callId || "unknown"}`);
|
|
71
|
+
await this.writeLog(`Arguments: ${JSON.stringify(payload.args, null, 2)}`);
|
|
72
|
+
return { ok: true };
|
|
73
|
+
}
|
|
74
|
+
async afterToolResult(payload, _context) {
|
|
75
|
+
await this.writeLog("");
|
|
76
|
+
await this.writeLog(`[${this.requestCount}] TOOL RESULT at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
77
|
+
await this.writeLog(`Tool: ${payload.toolName}`);
|
|
78
|
+
await this.writeLog(`Call ID: ${payload.callId || "unknown"}`);
|
|
79
|
+
await this.writeLog(`Success: ${payload.success}`);
|
|
80
|
+
const resultStr = typeof payload.result === "string" ? payload.result.substring(0, 500) + (payload.result.length > 500 ? "..." : "") : JSON.stringify(payload.result, null, 2).substring(0, 500);
|
|
81
|
+
await this.writeLog(`Result: ${resultStr}`);
|
|
82
|
+
return { ok: true };
|
|
83
|
+
}
|
|
84
|
+
async beforeResponse(payload, _context) {
|
|
85
|
+
await this.writeLog("");
|
|
86
|
+
await this.writeLog(
|
|
87
|
+
`[${this.requestCount}] ASSISTANT RESPONSE at ${(/* @__PURE__ */ new Date()).toISOString()}`
|
|
88
|
+
);
|
|
89
|
+
await this.writeLog(`Session: ${payload.sessionId || "unknown"}`);
|
|
90
|
+
await this.writeLog(`Model: ${payload.provider}/${payload.model || "unknown"}`);
|
|
91
|
+
if (payload.tokenUsage) {
|
|
92
|
+
await this.writeLog(
|
|
93
|
+
`Tokens: ${payload.tokenUsage.input} input, ${payload.tokenUsage.output} output`
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
await this.writeLog("-".repeat(40));
|
|
97
|
+
await this.writeLog(`Content: ${payload.content}`);
|
|
98
|
+
if (payload.reasoning) {
|
|
99
|
+
await this.writeLog("-".repeat(40));
|
|
100
|
+
await this.writeLog(`Reasoning: ${payload.reasoning}`);
|
|
101
|
+
}
|
|
102
|
+
await this.writeLog("-".repeat(40));
|
|
103
|
+
return { ok: true };
|
|
104
|
+
}
|
|
105
|
+
async cleanup() {
|
|
106
|
+
await this.writeLog("");
|
|
107
|
+
await this.writeLog("=".repeat(80));
|
|
108
|
+
await this.writeLog(`Request Logger shutting down at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
109
|
+
await this.writeLog(`Total requests logged: ${this.requestCount}`);
|
|
110
|
+
await this.writeLog("=".repeat(80));
|
|
111
|
+
if (this.logFileHandle) {
|
|
112
|
+
await this.logFileHandle.close();
|
|
113
|
+
this.logFileHandle = null;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async writeLog(message) {
|
|
117
|
+
if (this.logFileHandle) {
|
|
118
|
+
await this.logFileHandle.write(message + "\n");
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
var request_logger_default = RequestLoggerHook;
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
RequestLoggerHook
|
|
126
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Hook, BeforeLLMRequestPayload, HookExecutionContext, HookResult, BeforeToolCallPayload, AfterToolResultPayload, BeforeResponsePayload } from '@dexto/core';
|
|
2
|
+
|
|
3
|
+
type RequestLoggerHookConfig = {
|
|
4
|
+
logDir?: string | undefined;
|
|
5
|
+
logFileName?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Logs user requests, tool calls/results, and assistant responses to a file.
|
|
9
|
+
*/
|
|
10
|
+
declare class RequestLoggerHook implements Hook {
|
|
11
|
+
private logFilePath;
|
|
12
|
+
private logFileHandle;
|
|
13
|
+
private requestCount;
|
|
14
|
+
initialize(config: Record<string, unknown>): Promise<void>;
|
|
15
|
+
beforeLLMRequest(payload: BeforeLLMRequestPayload, context: HookExecutionContext): Promise<HookResult>;
|
|
16
|
+
beforeToolCall(payload: BeforeToolCallPayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
17
|
+
afterToolResult(payload: AfterToolResultPayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
18
|
+
beforeResponse(payload: BeforeResponsePayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
19
|
+
cleanup(): Promise<void>;
|
|
20
|
+
private writeLog;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { RequestLoggerHook, type RequestLoggerHookConfig, RequestLoggerHook as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Hook, BeforeLLMRequestPayload, HookExecutionContext, HookResult, BeforeToolCallPayload, AfterToolResultPayload, BeforeResponsePayload } from '@dexto/core';
|
|
2
|
+
|
|
3
|
+
type RequestLoggerHookConfig = {
|
|
4
|
+
logDir?: string | undefined;
|
|
5
|
+
logFileName?: string | undefined;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Logs user requests, tool calls/results, and assistant responses to a file.
|
|
9
|
+
*/
|
|
10
|
+
declare class RequestLoggerHook implements Hook {
|
|
11
|
+
private logFilePath;
|
|
12
|
+
private logFileHandle;
|
|
13
|
+
private requestCount;
|
|
14
|
+
initialize(config: Record<string, unknown>): Promise<void>;
|
|
15
|
+
beforeLLMRequest(payload: BeforeLLMRequestPayload, context: HookExecutionContext): Promise<HookResult>;
|
|
16
|
+
beforeToolCall(payload: BeforeToolCallPayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
17
|
+
afterToolResult(payload: AfterToolResultPayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
18
|
+
beforeResponse(payload: BeforeResponsePayload, _context: HookExecutionContext): Promise<HookResult>;
|
|
19
|
+
cleanup(): Promise<void>;
|
|
20
|
+
private writeLog;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { RequestLoggerHook, type RequestLoggerHookConfig, RequestLoggerHook as default };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
class RequestLoggerHook {
|
|
5
|
+
logFilePath = "";
|
|
6
|
+
logFileHandle = null;
|
|
7
|
+
requestCount = 0;
|
|
8
|
+
async initialize(config) {
|
|
9
|
+
const typed = config;
|
|
10
|
+
const logDir = typed.logDir || join(homedir(), ".dexto", "logs");
|
|
11
|
+
const logFileName = typed.logFileName || "request-logger.log";
|
|
12
|
+
this.logFilePath = join(logDir, logFileName);
|
|
13
|
+
await fs.mkdir(logDir, { recursive: true });
|
|
14
|
+
this.logFileHandle = await fs.open(this.logFilePath, "a");
|
|
15
|
+
await this.writeLog("=".repeat(80));
|
|
16
|
+
await this.writeLog(`Request Logger initialized at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
17
|
+
await this.writeLog(`Log file: ${this.logFilePath}`);
|
|
18
|
+
await this.writeLog("=".repeat(80));
|
|
19
|
+
}
|
|
20
|
+
async beforeLLMRequest(payload, context) {
|
|
21
|
+
this.requestCount++;
|
|
22
|
+
await this.writeLog("");
|
|
23
|
+
await this.writeLog(`[${this.requestCount}] USER REQUEST at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
24
|
+
await this.writeLog(`Session: ${payload.sessionId || "unknown"}`);
|
|
25
|
+
await this.writeLog(`User: ${context.userId || "anonymous"}`);
|
|
26
|
+
await this.writeLog(`Model: ${context.llmConfig.provider}/${context.llmConfig.model}`);
|
|
27
|
+
await this.writeLog("-".repeat(40));
|
|
28
|
+
await this.writeLog(`Text: ${payload.text}`);
|
|
29
|
+
if (payload.imageData) {
|
|
30
|
+
await this.writeLog(
|
|
31
|
+
`Image: ${payload.imageData.mimeType} (${payload.imageData.image.length} chars)`
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
if (payload.fileData) {
|
|
35
|
+
await this.writeLog(
|
|
36
|
+
`File: ${payload.fileData.filename || "unknown"} (${payload.fileData.mimeType})`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
await this.writeLog("-".repeat(40));
|
|
40
|
+
return { ok: true };
|
|
41
|
+
}
|
|
42
|
+
async beforeToolCall(payload, _context) {
|
|
43
|
+
await this.writeLog("");
|
|
44
|
+
await this.writeLog(`[${this.requestCount}] TOOL CALL at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
45
|
+
await this.writeLog(`Tool: ${payload.toolName}`);
|
|
46
|
+
await this.writeLog(`Call ID: ${payload.callId || "unknown"}`);
|
|
47
|
+
await this.writeLog(`Arguments: ${JSON.stringify(payload.args, null, 2)}`);
|
|
48
|
+
return { ok: true };
|
|
49
|
+
}
|
|
50
|
+
async afterToolResult(payload, _context) {
|
|
51
|
+
await this.writeLog("");
|
|
52
|
+
await this.writeLog(`[${this.requestCount}] TOOL RESULT at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
53
|
+
await this.writeLog(`Tool: ${payload.toolName}`);
|
|
54
|
+
await this.writeLog(`Call ID: ${payload.callId || "unknown"}`);
|
|
55
|
+
await this.writeLog(`Success: ${payload.success}`);
|
|
56
|
+
const resultStr = typeof payload.result === "string" ? payload.result.substring(0, 500) + (payload.result.length > 500 ? "..." : "") : JSON.stringify(payload.result, null, 2).substring(0, 500);
|
|
57
|
+
await this.writeLog(`Result: ${resultStr}`);
|
|
58
|
+
return { ok: true };
|
|
59
|
+
}
|
|
60
|
+
async beforeResponse(payload, _context) {
|
|
61
|
+
await this.writeLog("");
|
|
62
|
+
await this.writeLog(
|
|
63
|
+
`[${this.requestCount}] ASSISTANT RESPONSE at ${(/* @__PURE__ */ new Date()).toISOString()}`
|
|
64
|
+
);
|
|
65
|
+
await this.writeLog(`Session: ${payload.sessionId || "unknown"}`);
|
|
66
|
+
await this.writeLog(`Model: ${payload.provider}/${payload.model || "unknown"}`);
|
|
67
|
+
if (payload.tokenUsage) {
|
|
68
|
+
await this.writeLog(
|
|
69
|
+
`Tokens: ${payload.tokenUsage.input} input, ${payload.tokenUsage.output} output`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
await this.writeLog("-".repeat(40));
|
|
73
|
+
await this.writeLog(`Content: ${payload.content}`);
|
|
74
|
+
if (payload.reasoning) {
|
|
75
|
+
await this.writeLog("-".repeat(40));
|
|
76
|
+
await this.writeLog(`Reasoning: ${payload.reasoning}`);
|
|
77
|
+
}
|
|
78
|
+
await this.writeLog("-".repeat(40));
|
|
79
|
+
return { ok: true };
|
|
80
|
+
}
|
|
81
|
+
async cleanup() {
|
|
82
|
+
await this.writeLog("");
|
|
83
|
+
await this.writeLog("=".repeat(80));
|
|
84
|
+
await this.writeLog(`Request Logger shutting down at ${(/* @__PURE__ */ new Date()).toISOString()}`);
|
|
85
|
+
await this.writeLog(`Total requests logged: ${this.requestCount}`);
|
|
86
|
+
await this.writeLog("=".repeat(80));
|
|
87
|
+
if (this.logFileHandle) {
|
|
88
|
+
await this.logFileHandle.close();
|
|
89
|
+
this.logFileHandle = null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
async writeLog(message) {
|
|
93
|
+
if (this.logFileHandle) {
|
|
94
|
+
await this.logFileHandle.write(message + "\n");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
var request_logger_default = RequestLoggerHook;
|
|
99
|
+
export {
|
|
100
|
+
RequestLoggerHook,
|
|
101
|
+
request_logger_default as default
|
|
102
|
+
};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var index_exports = {};
|
|
30
|
+
__export(index_exports, {
|
|
31
|
+
default: () => index_default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(index_exports);
|
|
34
|
+
var import_image_local = __toESM(require("@dexto/image-local"), 1);
|
|
35
|
+
var import_zod = require("zod");
|
|
36
|
+
var import_node_module = require("node:module");
|
|
37
|
+
var import_request_logger = require("./hooks/request-logger.js");
|
|
38
|
+
const import_meta = {};
|
|
39
|
+
const require2 = (0, import_node_module.createRequire)(import_meta.url);
|
|
40
|
+
const packageJson = require2("../package.json");
|
|
41
|
+
const requestLoggerConfigSchema = import_zod.z.object({
|
|
42
|
+
type: import_zod.z.literal("request-logger"),
|
|
43
|
+
logDir: import_zod.z.string().optional(),
|
|
44
|
+
logFileName: import_zod.z.string().optional()
|
|
45
|
+
}).strict();
|
|
46
|
+
const requestLoggerFactory = {
|
|
47
|
+
configSchema: requestLoggerConfigSchema,
|
|
48
|
+
create: (_config) => new import_request_logger.RequestLoggerHook()
|
|
49
|
+
};
|
|
50
|
+
const imageLoggerAgent = {
|
|
51
|
+
...import_image_local.default,
|
|
52
|
+
metadata: {
|
|
53
|
+
name: packageJson.name ?? "@dexto/image-logger-agent",
|
|
54
|
+
version: packageJson.version ?? "0.0.0",
|
|
55
|
+
description: "Example image for the Logger Agent (adds request-logger hook which logs requests)",
|
|
56
|
+
target: "local-development",
|
|
57
|
+
constraints: ["filesystem-required"]
|
|
58
|
+
},
|
|
59
|
+
hooks: {
|
|
60
|
+
...import_image_local.default.hooks,
|
|
61
|
+
"request-logger": requestLoggerFactory
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var index_default = imageLoggerAgent;
|
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import imageLocal from "@dexto/image-local";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { RequestLoggerHook } from "./hooks/request-logger.js";
|
|
5
|
+
const require2 = createRequire(import.meta.url);
|
|
6
|
+
const packageJson = require2("../package.json");
|
|
7
|
+
const requestLoggerConfigSchema = z.object({
|
|
8
|
+
type: z.literal("request-logger"),
|
|
9
|
+
logDir: z.string().optional(),
|
|
10
|
+
logFileName: z.string().optional()
|
|
11
|
+
}).strict();
|
|
12
|
+
const requestLoggerFactory = {
|
|
13
|
+
configSchema: requestLoggerConfigSchema,
|
|
14
|
+
create: (_config) => new RequestLoggerHook()
|
|
15
|
+
};
|
|
16
|
+
const imageLoggerAgent = {
|
|
17
|
+
...imageLocal,
|
|
18
|
+
metadata: {
|
|
19
|
+
name: packageJson.name ?? "@dexto/image-logger-agent",
|
|
20
|
+
version: packageJson.version ?? "0.0.0",
|
|
21
|
+
description: "Example image for the Logger Agent (adds request-logger hook which logs requests)",
|
|
22
|
+
target: "local-development",
|
|
23
|
+
constraints: ["filesystem-required"]
|
|
24
|
+
},
|
|
25
|
+
hooks: {
|
|
26
|
+
...imageLocal.hooks,
|
|
27
|
+
"request-logger": requestLoggerFactory
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
var index_default = imageLoggerAgent;
|
|
31
|
+
export {
|
|
32
|
+
index_default as default
|
|
33
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dexto/image-logger-agent",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Example image for the Logger Agent (adds request-logger hook)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"dexto",
|
|
16
|
+
"image",
|
|
17
|
+
"hooks",
|
|
18
|
+
"logging",
|
|
19
|
+
"examples"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^3.25.0",
|
|
23
|
+
"@dexto/agent-config": "1.6.0",
|
|
24
|
+
"@dexto/core": "1.6.0",
|
|
25
|
+
"@dexto/image-local": "1.6.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"tsup": "^8.0.0",
|
|
29
|
+
"typescript": "^5.3.3"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsup",
|
|
37
|
+
"test": "vitest run",
|
|
38
|
+
"test:integ": "vitest run",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"clean": "rm -rf dist"
|
|
41
|
+
}
|
|
42
|
+
}
|