@poncho-ai/client 0.2.1 → 0.4.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/.turbo/turbo-build.log +4 -4
- package/dist/index.js +22 -7
- package/package.json +2 -2
- package/src/index.ts +23 -7
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @poncho-ai/client@0.
|
|
2
|
+
> @poncho-ai/client@0.4.0 build /Users/cesar/Dev/latitude/poncho-ai/packages/client
|
|
3
3
|
> tsup src/index.ts --format esm --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
[34mCLI[39m tsup v8.5.1
|
|
8
8
|
[34mCLI[39m Target: es2022
|
|
9
9
|
[34mESM[39m Build start
|
|
10
|
-
[32mESM[39m [1mdist/index.js [22m[32m6.
|
|
11
|
-
[32mESM[39m ⚡️ Build success in
|
|
10
|
+
[32mESM[39m [1mdist/index.js [22m[32m6.71 KB[39m
|
|
11
|
+
[32mESM[39m ⚡️ Build success in 17ms
|
|
12
12
|
[34mDTS[39m Build start
|
|
13
|
-
[32mDTS[39m ⚡️ Build success in
|
|
13
|
+
[32mDTS[39m ⚡️ Build success in 1152ms
|
|
14
14
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m1.83 KB[39m
|
package/dist/index.js
CHANGED
|
@@ -114,14 +114,29 @@ var AgentClient = class {
|
|
|
114
114
|
const completed = events.find(
|
|
115
115
|
(event) => event.type === "run:completed"
|
|
116
116
|
);
|
|
117
|
-
if (
|
|
118
|
-
|
|
117
|
+
if (completed) {
|
|
118
|
+
return {
|
|
119
|
+
runId: runStarted?.runId ?? completed.runId,
|
|
120
|
+
status: completed.result.status,
|
|
121
|
+
result: completed.result
|
|
122
|
+
};
|
|
119
123
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
const cancelled = events.find(
|
|
125
|
+
(event) => event.type === "run:cancelled"
|
|
126
|
+
);
|
|
127
|
+
if (cancelled) {
|
|
128
|
+
return {
|
|
129
|
+
runId: runStarted?.runId ?? cancelled.runId,
|
|
130
|
+
status: "cancelled",
|
|
131
|
+
result: {
|
|
132
|
+
status: "cancelled",
|
|
133
|
+
steps: 0,
|
|
134
|
+
tokens: { input: 0, output: 0, cached: 0 },
|
|
135
|
+
duration: 0
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
throw new Error("Send message failed: missing run:completed or run:cancelled event");
|
|
125
140
|
}
|
|
126
141
|
async run(input) {
|
|
127
142
|
if ((input.messages?.length ?? 0) > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poncho-ai/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "TypeScript client for calling deployed Poncho agents",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@poncho-ai/sdk": "0.
|
|
23
|
+
"@poncho-ai/sdk": "0.4.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"tsup": "^8.0.0",
|
package/src/index.ts
CHANGED
|
@@ -166,14 +166,30 @@ export class AgentClient {
|
|
|
166
166
|
(event): event is Extract<AgentEvent, { type: "run:completed" }> =>
|
|
167
167
|
event.type === "run:completed",
|
|
168
168
|
);
|
|
169
|
-
if (
|
|
170
|
-
|
|
169
|
+
if (completed) {
|
|
170
|
+
return {
|
|
171
|
+
runId: runStarted?.runId ?? completed.runId,
|
|
172
|
+
status: completed.result.status,
|
|
173
|
+
result: completed.result,
|
|
174
|
+
};
|
|
171
175
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
176
|
+
const cancelled = events.find(
|
|
177
|
+
(event): event is Extract<AgentEvent, { type: "run:cancelled" }> =>
|
|
178
|
+
event.type === "run:cancelled",
|
|
179
|
+
);
|
|
180
|
+
if (cancelled) {
|
|
181
|
+
return {
|
|
182
|
+
runId: runStarted?.runId ?? cancelled.runId,
|
|
183
|
+
status: "cancelled",
|
|
184
|
+
result: {
|
|
185
|
+
status: "cancelled",
|
|
186
|
+
steps: 0,
|
|
187
|
+
tokens: { input: 0, output: 0, cached: 0 },
|
|
188
|
+
duration: 0,
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
throw new Error("Send message failed: missing run:completed or run:cancelled event");
|
|
177
193
|
}
|
|
178
194
|
|
|
179
195
|
async run(input: RunInput): Promise<SyncRunResponse> {
|