@neutrome/lilsdk-ts 0.2.3 → 0.2.5
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/package.json +1 -1
- package/src/tools.ts +5 -1
- package/src/types.ts +3 -1
package/package.json
CHANGED
package/src/tools.ts
CHANGED
|
@@ -76,7 +76,9 @@ function buildCallExecutor(toolMap: Map<string, Tool>) {
|
|
|
76
76
|
parsed = {};
|
|
77
77
|
}
|
|
78
78
|
const startedMs = Date.now();
|
|
79
|
+
const startedAt = new Date(startedMs).toISOString();
|
|
79
80
|
const result = await tool.execute(parsed, ctx);
|
|
81
|
+
const finishedMs = Date.now();
|
|
80
82
|
ctx.observe(createSdkEvent({
|
|
81
83
|
kind: "tool.executed",
|
|
82
84
|
requestId: ctx.requestId,
|
|
@@ -85,7 +87,9 @@ function buildCallExecutor(toolMap: Map<string, Tool>) {
|
|
|
85
87
|
data: {
|
|
86
88
|
toolName: call.name,
|
|
87
89
|
toolCallId: call.id,
|
|
88
|
-
|
|
90
|
+
startedAt,
|
|
91
|
+
finishedAt: new Date(finishedMs).toISOString(),
|
|
92
|
+
durationMs: finishedMs - startedMs,
|
|
89
93
|
lilText: buildToolTrace(call, result),
|
|
90
94
|
},
|
|
91
95
|
}));
|
package/src/types.ts
CHANGED
|
@@ -45,6 +45,8 @@ export type InvokeOptions = {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export type TransformContext = {
|
|
48
|
+
invoke(request: Program, options?: InvokeOptions): Promise<Program>;
|
|
49
|
+
invokeStream(request: Program, options?: InvokeOptions): AsyncIterable<Program>;
|
|
48
50
|
observe(event: SdkEvent): void;
|
|
49
51
|
signal: AbortSignal;
|
|
50
52
|
};
|
|
@@ -52,7 +54,7 @@ export type TransformContext = {
|
|
|
52
54
|
export type ProgramTransform = {
|
|
53
55
|
name: string;
|
|
54
56
|
capabilities: TransformCapability[];
|
|
55
|
-
apply(program: Program, ctx: TransformContext): Program
|
|
57
|
+
apply(program: Program, ctx: TransformContext): Program | Promise<Program>;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
export type ExecutorContext = {
|