@meetopenbot/openbot 1.2.17 → 1.2.18
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/system-prompt.js +1 -1
- package/dist/tools/ask-agent.js +0 -9
- package/dist/tools/preview.js +0 -40
- package/package.json +1 -1
package/dist/system-prompt.js
CHANGED
|
@@ -61,7 +61,7 @@ export const OPENBOT_SYSTEM_PROMPT = [
|
|
|
61
61
|
"This runtime is a remote cloud computer. The human is in the browser at openbot.one and cannot open localhost, 127.0.0.1, or any port on this machine.",
|
|
62
62
|
"- Never tell them to visit localhost. They need a public HTTPS URL.",
|
|
63
63
|
"- When you ask a coding agent to run a dev server, preview, or any local process the human should open, tell them to expose it with `cloudflared tunnel --url http://127.0.0.1:<port>` and to add `cloudflared` as a **project devDependency** (not a global install — this image is ephemeral and only workspace files persist).",
|
|
64
|
-
"-
|
|
64
|
+
"- After the specialist finishes, inspect the URL they report, share the `https://*.trycloudflare.com` URL, and call `open_preview` with it so it opens in the space browser. Quick tunnels change on restart — pass the new one through. If they report a localhost URL, ask them to tunnel it.",
|
|
65
65
|
"- For any other public page the human should see, call `open_preview` with that http(s) URL too. Never pass localhost, 127.0.0.1, or a port on this machine.",
|
|
66
66
|
"",
|
|
67
67
|
"# SPACE VARIABLES",
|
package/dist/tools/ask-agent.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import { loadAgentModelCatalogs, validateAskModel } from "../agent-models.js";
|
|
4
|
-
import { previewEventsForTunnelUrls } from "./preview.js";
|
|
5
4
|
/**
|
|
6
5
|
* `ask_agent` — OpenBot sends a message to another agent in its own harness.
|
|
7
6
|
* Only the orchestrator may ask. Child events stream into this thread so the
|
|
@@ -104,8 +103,6 @@ async function runAskedAgent(ctx, args) {
|
|
|
104
103
|
resolveNext = null;
|
|
105
104
|
}
|
|
106
105
|
});
|
|
107
|
-
const seenPreviewUrls = new Set();
|
|
108
|
-
const threadId = ctx.threadId ?? ctx.state.threadId;
|
|
109
106
|
while (!isFinished || eventQueue.length > 0) {
|
|
110
107
|
if (eventQueue.length === 0) {
|
|
111
108
|
await new Promise((r) => {
|
|
@@ -115,12 +112,6 @@ async function runAskedAgent(ctx, args) {
|
|
|
115
112
|
while (eventQueue.length > 0) {
|
|
116
113
|
const nextEvent = eventQueue.shift();
|
|
117
114
|
await ctx.emit(nextEvent);
|
|
118
|
-
for (const preview of previewEventsForTunnelUrls(nextEvent, seenPreviewUrls, {
|
|
119
|
-
agentId: ctx.agentId,
|
|
120
|
-
threadId,
|
|
121
|
-
})) {
|
|
122
|
-
await ctx.emit(preview);
|
|
123
|
-
}
|
|
124
115
|
}
|
|
125
116
|
}
|
|
126
117
|
await runPromise;
|
package/dist/tools/preview.js
CHANGED
|
@@ -25,35 +25,6 @@ export function publicPreviewUrl(input) {
|
|
|
25
25
|
return null;
|
|
26
26
|
return url.href;
|
|
27
27
|
}
|
|
28
|
-
const TUNNEL_URL = /https:\/\/[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.trycloudflare\.com(?::\d+)?(?:\/[^\s<>"'`)\\\]]*)?/gi;
|
|
29
|
-
const MAX_SCAN_CHARS = 250000;
|
|
30
|
-
function cleanMatch(raw) {
|
|
31
|
-
return raw.replace(/[.,;:!?)]+$/g, '');
|
|
32
|
-
}
|
|
33
|
-
/** Public Cloudflare quick-tunnel URLs mentioned in specialist output. */
|
|
34
|
-
export function tunnelPreviewUrls(value) {
|
|
35
|
-
let text;
|
|
36
|
-
try {
|
|
37
|
-
text = typeof value === 'string' ? value : JSON.stringify(value) ?? '';
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
if (!text)
|
|
43
|
-
return [];
|
|
44
|
-
if (text.length > MAX_SCAN_CHARS)
|
|
45
|
-
text = text.slice(0, MAX_SCAN_CHARS);
|
|
46
|
-
const seen = new Set();
|
|
47
|
-
const urls = [];
|
|
48
|
-
for (const match of text.matchAll(TUNNEL_URL)) {
|
|
49
|
-
const url = publicPreviewUrl(cleanMatch(match[0]));
|
|
50
|
-
if (!url || seen.has(url))
|
|
51
|
-
continue;
|
|
52
|
-
seen.add(url);
|
|
53
|
-
urls.push(url);
|
|
54
|
-
}
|
|
55
|
-
return urls;
|
|
56
|
-
}
|
|
57
28
|
export function previewWidgetEvent(args) {
|
|
58
29
|
return {
|
|
59
30
|
type: 'client:ui:widget',
|
|
@@ -80,17 +51,6 @@ export function previewWidgetEvent(args) {
|
|
|
80
51
|
},
|
|
81
52
|
};
|
|
82
53
|
}
|
|
83
|
-
/** Preview widgets for tunnel URLs in `value` that `seen` has not emitted yet. */
|
|
84
|
-
export function previewEventsForTunnelUrls(value, seen, meta) {
|
|
85
|
-
const events = [];
|
|
86
|
-
for (const url of tunnelPreviewUrls(value)) {
|
|
87
|
-
if (seen.has(url))
|
|
88
|
-
continue;
|
|
89
|
-
seen.add(url);
|
|
90
|
-
events.push(previewWidgetEvent({ url, ...meta }));
|
|
91
|
-
}
|
|
92
|
-
return events;
|
|
93
|
-
}
|
|
94
54
|
async function openPreview(rawArgs, ctx) {
|
|
95
55
|
const channelId = ctx.channelId ?? ctx.state.channelId ?? '';
|
|
96
56
|
const threadId = ctx.threadId ?? ctx.state.threadId;
|