@meetopenbot/openbot 1.4.0 → 1.4.1
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/tools/ask-agent.js +17 -0
- package/package.json +2 -2
package/dist/tools/ask-agent.js
CHANGED
|
@@ -21,6 +21,15 @@ export const toolDefinitions = {
|
|
|
21
21
|
}),
|
|
22
22
|
},
|
|
23
23
|
};
|
|
24
|
+
/** The host's connect card: the asked agent has no account yet and did not run. */
|
|
25
|
+
function connectionRequestName(event) {
|
|
26
|
+
if (event.type !== "client:ui:widget")
|
|
27
|
+
return undefined;
|
|
28
|
+
const metadata = event.data?.metadata;
|
|
29
|
+
if (metadata?.type !== "connection_request")
|
|
30
|
+
return undefined;
|
|
31
|
+
return typeof metadata.pluginName === "string" ? metadata.pluginName : "This agent";
|
|
32
|
+
}
|
|
24
33
|
async function runAskedAgent(ctx, args) {
|
|
25
34
|
if (ctx.agentId !== ctx.host.orchestratorAgentId) {
|
|
26
35
|
return {
|
|
@@ -50,6 +59,7 @@ async function runAskedAgent(ctx, args) {
|
|
|
50
59
|
}
|
|
51
60
|
const runId = `ask_${randomUUID()}`;
|
|
52
61
|
let lastAgentOutput = "";
|
|
62
|
+
let needsConnection;
|
|
53
63
|
const eventQueue = [];
|
|
54
64
|
let resolveNext = null;
|
|
55
65
|
let isFinished = false;
|
|
@@ -87,6 +97,7 @@ async function runAskedAgent(ctx, args) {
|
|
|
87
97
|
if (outEvent.type === "agent:output") {
|
|
88
98
|
lastAgentOutput = outEvent.data.content;
|
|
89
99
|
}
|
|
100
|
+
needsConnection ?? (needsConnection = connectionRequestName(outEvent));
|
|
90
101
|
if (resolveNext) {
|
|
91
102
|
resolveNext();
|
|
92
103
|
resolveNext = null;
|
|
@@ -115,6 +126,12 @@ async function runAskedAgent(ctx, args) {
|
|
|
115
126
|
}
|
|
116
127
|
}
|
|
117
128
|
await runPromise;
|
|
129
|
+
if (needsConnection) {
|
|
130
|
+
const output = `${needsConnection} is not connected yet, so it did not run. The human now sees a ` +
|
|
131
|
+
"card to connect it; once they do, the conversation continues on its own. " +
|
|
132
|
+
"Do not ask them for keys or retry; say in one short line that it needs connecting.";
|
|
133
|
+
return { success: false, needsConnection: true, error: output, output };
|
|
134
|
+
}
|
|
118
135
|
return {
|
|
119
136
|
success: true,
|
|
120
137
|
output: lastAgentOutput,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meetopenbot/openbot",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "OpenBot coordinator runtime: ask specialists, route work into Spaces, and track todos.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@ai-sdk/openai": "^4.0.72",
|
|
26
26
|
"ai": "^7.0.111",
|
|
27
27
|
"zod": "^4.3.5",
|
|
28
|
-
"@meetopenbot/plugin-sdk": "^1.
|
|
28
|
+
"@meetopenbot/plugin-sdk": "^1.7.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/node": "^20.10.1",
|