skedyul 0.3.6 → 0.3.8
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/.build-stamp +1 -1
- package/dist/server/context-logger.js +35 -11
- package/dist/server/index.js +3 -1
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1771570282220
|
|
@@ -20,7 +20,32 @@ function getLogContext() {
|
|
|
20
20
|
return logContextStorage.getStore();
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Safely stringify a value for logging.
|
|
24
|
+
* Handles circular references and errors gracefully.
|
|
25
|
+
*/
|
|
26
|
+
function safeStringify(value) {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return 'undefined';
|
|
29
|
+
if (value === null)
|
|
30
|
+
return 'null';
|
|
31
|
+
if (typeof value === 'string')
|
|
32
|
+
return value;
|
|
33
|
+
if (typeof value === 'number' || typeof value === 'boolean')
|
|
34
|
+
return String(value);
|
|
35
|
+
if (value instanceof Error) {
|
|
36
|
+
return `${value.name}: ${value.message}${value.stack ? `\n${value.stack}` : ''}`;
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return JSON.stringify(value);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return String(value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Formats a log message with invocation context prepended as JSON.
|
|
47
|
+
* All arguments are stringified into a single line to ensure the context
|
|
48
|
+
* prefix appears on every line in Docker/CloudWatch logs.
|
|
24
49
|
*/
|
|
25
50
|
function formatLogWithContext(args) {
|
|
26
51
|
const context = getLogContext();
|
|
@@ -37,16 +62,15 @@ function formatLogWithContext(args) {
|
|
|
37
62
|
...(context.invocation.workflowId && { workflowId: context.invocation.workflowId }),
|
|
38
63
|
...(context.invocation.workflowRunId && { workflowRunId: context.invocation.workflowRunId }),
|
|
39
64
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
return [contextPrefix, ...args];
|
|
65
|
+
const prefix = `[${JSON.stringify(contextPrefix)}]`;
|
|
66
|
+
// Stringify all arguments into a single line to ensure context appears on every log line
|
|
67
|
+
// This prevents multi-line object formatting from splitting logs across lines
|
|
68
|
+
const messageParts = args.map(arg => {
|
|
69
|
+
if (typeof arg === 'string')
|
|
70
|
+
return arg;
|
|
71
|
+
return safeStringify(arg);
|
|
72
|
+
});
|
|
73
|
+
return [`${prefix} ${messageParts.join(' ')}`];
|
|
50
74
|
}
|
|
51
75
|
// Store original console methods
|
|
52
76
|
const originalConsole = {
|
package/dist/server/index.js
CHANGED
|
@@ -132,11 +132,12 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
132
132
|
inputSchema: wrappedInputSchema,
|
|
133
133
|
outputSchema: outputZodSchema,
|
|
134
134
|
}, async (args) => {
|
|
135
|
-
// Args are in Skedyul format: { inputs: {...}, context: {...}, env: {...} }
|
|
135
|
+
// Args are in Skedyul format: { inputs: {...}, context: {...}, env: {...}, invocation: {...} }
|
|
136
136
|
const rawArgs = args;
|
|
137
137
|
const toolInputs = (rawArgs.inputs ?? {});
|
|
138
138
|
const toolContext = rawArgs.context;
|
|
139
139
|
const toolEnv = rawArgs.env;
|
|
140
|
+
const toolInvocation = rawArgs.invocation;
|
|
140
141
|
// Validate inputs if schema exists
|
|
141
142
|
let validatedInputs = toolInputs;
|
|
142
143
|
if (inputZodSchema) {
|
|
@@ -167,6 +168,7 @@ function createSkedyulServer(config, registry, webhookRegistry) {
|
|
|
167
168
|
inputs: validatedInputs,
|
|
168
169
|
context: toolContext,
|
|
169
170
|
env: toolEnv,
|
|
171
|
+
invocation: toolInvocation,
|
|
170
172
|
});
|
|
171
173
|
// Handle error case
|
|
172
174
|
if (result.error) {
|