@meetopenbot/openbot 1.4.0 → 1.4.2

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.
@@ -15,7 +15,7 @@ export const OPENBOT_SYSTEM_PROMPT = [
15
15
  "# THE AGENT LOOP",
16
16
  "You operate in an iterative loop:",
17
17
  "1. **Analyze Events**: Understand the human, mentioned people, the current Space, and `## SPACES`.",
18
- "2. **Right Space**: Use `## SPACES` to see where work belongs. If the human's intent clearly fits a different existing Space than the one you are in — especially project work posted in `#general` — explain in text which Space it belongs in and why. Then either wait for the human to continue there, or — when the request is clear enough to act on — call `start_thread` to open a thread in that Space with their request; the human approves it before it starts. Never start a thread in the Space you are already in. In `#general`, handle questions, listings, setup, and routing only; do not run project execution there. If they are already in the right Space, continue with `ask_agent`. If no Space fits, propose a concrete name and why, then wait for the human to agree before `create_channel` — unless they already named a new Space or explicitly asked you to create it. Never invent placeholder ids (`noop`, `temp`, `misc`, `untitled`).",
18
+ "2. **Right Space**: Use `## SPACES` to see where work belongs. If the human's intent clearly fits a different existing Space than the one you are in — especially project work posted in `#general` — explain in text which Space it belongs in and why. Then either wait for the human to continue there, or — when the request is clear enough to act on — call `start_thread` to open a thread in that Space with their request, written in their own first-person voice because it is posted as them; the human approves it before it starts. Never start a thread in the Space you are already in. In `#general`, handle questions, listings, setup, and routing only; do not run project execution there. If they are already in the right Space, continue with `ask_agent`. If no Space fits, propose a concrete name and why, then wait for the human to agree before `create_channel` — unless they already named a new Space or explicitly asked you to create it. Never invent placeholder ids (`noop`, `temp`, `misc`, `untitled`).",
19
19
  "3. **Ask people**: Use `ask_agent` to send a message to a specialist. Write it as a request to a colleague, not as a tool invocation.",
20
20
  "4. **Wait**: Let the asked agent run in its own harness. Read their reply, then continue or ask someone else.",
21
21
  "5. **Close**: The human already saw the specialist speak in this thread. Do not restate, re-bullet, or paraphrase their findings. Name who you asked, then add only what is new — a decision, a conflict, a next step, or a caveat. If nothing is new, close in one or two sentences.",
@@ -21,6 +21,17 @@ 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
+ // `pluginName` is what runtimes before scoped connections send.
32
+ const name = metadata.name ?? metadata.pluginName;
33
+ return typeof name === "string" ? name : "This agent";
34
+ }
24
35
  async function runAskedAgent(ctx, args) {
25
36
  if (ctx.agentId !== ctx.host.orchestratorAgentId) {
26
37
  return {
@@ -50,6 +61,7 @@ async function runAskedAgent(ctx, args) {
50
61
  }
51
62
  const runId = `ask_${randomUUID()}`;
52
63
  let lastAgentOutput = "";
64
+ let needsConnection;
53
65
  const eventQueue = [];
54
66
  let resolveNext = null;
55
67
  let isFinished = false;
@@ -87,6 +99,7 @@ async function runAskedAgent(ctx, args) {
87
99
  if (outEvent.type === "agent:output") {
88
100
  lastAgentOutput = outEvent.data.content;
89
101
  }
102
+ needsConnection ?? (needsConnection = connectionRequestName(outEvent));
90
103
  if (resolveNext) {
91
104
  resolveNext();
92
105
  resolveNext = null;
@@ -115,6 +128,12 @@ async function runAskedAgent(ctx, args) {
115
128
  }
116
129
  }
117
130
  await runPromise;
131
+ if (needsConnection) {
132
+ const output = `${needsConnection} is not connected yet, so it did not run. The human now sees a ` +
133
+ "card to connect it; once they do, the conversation continues on its own. " +
134
+ "Do not ask them for keys or retry; say in one short line that it needs connecting.";
135
+ return { success: false, needsConnection: true, error: output, output };
136
+ }
118
137
  return {
119
138
  success: true,
120
139
  output: lastAgentOutput,
@@ -40,7 +40,7 @@ export const startThreadTools = {
40
40
  channelId: z.string().describe('Existing Space id from `## SPACES` (e.g. backend-platform).'),
41
41
  prompt: z
42
42
  .string()
43
- .describe("First message of the new thread, written as the human's request with the context the Space's agent needs. It does not see this conversation."),
43
+ .describe("First message of the new thread. It is posted as the human, so write it in their voice, in the first person, as if they typed it there (\"Can you review the latest changes in this workspace? …\"). Never refer to them by name or as \"the user\" or \"the human\", and do not mention yourself, this conversation, or that it was handed over. Include the context the Space's agent needs; it does not see this conversation."),
44
44
  title: z.string().optional().describe('Optional concise thread title.'),
45
45
  }),
46
46
  execute: async (raw, ctx) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meetopenbot/openbot",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
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.5.0"
28
+ "@meetopenbot/plugin-sdk": "^2.0.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.10.1",