wherdr 1.3.2 → 1.3.4
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{AgentView.C4YOwvZG.css → AgentView.DzFWBd2A.css} +1 -1
- package/.output/public/_nuxt/{Cd8j9O5w.js → BEJHMUrj.js} +1 -1
- package/.output/public/_nuxt/BOtcEDnA.js +1 -0
- package/.output/public/_nuxt/BUaYhQ2r.js +6 -0
- package/.output/public/_nuxt/{yzABg5xl.js → Bpoxvzh6.js} +1 -1
- package/.output/public/_nuxt/C25ROUa9.js +3 -0
- package/.output/public/_nuxt/CDWjMk9C.js +2 -0
- package/.output/public/_nuxt/CJKsMzIp.js +1 -0
- package/.output/public/_nuxt/CJNhn9sA.js +36 -0
- package/.output/public/_nuxt/COCvtdHN.js +89 -0
- package/.output/public/_nuxt/{Ci8N4mWR.js → CXJnLmWv.js} +1 -1
- package/.output/public/_nuxt/Cl45J6_Q.js +1 -0
- package/.output/public/_nuxt/CndPDbMI.js +2 -0
- package/.output/public/_nuxt/Ctbx58Um.js +23 -0
- package/.output/public/_nuxt/{8ksjcuDu.js → DMLmW6JM.js} +49 -56
- package/.output/public/_nuxt/Dl1PHLOB.js +1 -0
- package/.output/public/_nuxt/Nhex3_iH.js +1 -0
- package/.output/public/_nuxt/OpWX45i7.js +89 -0
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/4994f3a4-4126-4f57-a9e5-c7ebb25850bc.json +1 -0
- package/.output/public/_nuxt/dTj21DMs.js +1 -0
- package/.output/public/_nuxt/entry.BohTWE-n.css +2 -0
- package/.output/public/_nuxt/kwSoIiM7.js +1 -0
- package/.output/public/_nuxt/mkEwYka4.js +1 -0
- package/.output/public/_nuxt/pdf.min.t82Z80JU.mjs +28 -0
- package/.output/public/_nuxt/pdf.worker.min.wgc6bjNh.mjs +28 -0
- package/.output/public/_nuxt/w7Rm7unj.js +1 -0
- package/.output/public/sw.js +1 -1
- package/.output/server/chunks/_/branding.mjs +1 -1
- package/.output/server/chunks/_/filePaths.mjs +25 -0
- package/.output/server/chunks/_/files.mjs +217 -0
- package/.output/server/chunks/_/machineOrder.mjs +1 -1
- package/.output/server/chunks/_/onboarding.mjs +1 -1
- package/.output/server/chunks/_/package.mjs +5 -2
- package/.output/server/chunks/_/pluginPolicy.mjs +93 -0
- package/.output/server/chunks/_/plugins.mjs +9 -96
- package/.output/server/chunks/_/projectBoard.mjs +124 -36
- package/.output/server/chunks/_/projectDocs.mjs +106 -0
- package/.output/server/chunks/_/projectInbox.mjs +135 -0
- package/.output/server/chunks/_/projectThreads.mjs +46 -0
- package/.output/server/chunks/_/projectThreads2.mjs +61 -0
- package/.output/server/chunks/_/projectsActions.mjs +1 -1
- package/.output/server/chunks/_/projectsPlugin.mjs +24 -50
- package/.output/server/chunks/_/projectsPlugin2.mjs +57 -0
- package/.output/server/chunks/_/restart.mjs +2 -312
- package/.output/server/chunks/_/reveal.mjs +2 -24
- package/.output/server/chunks/_/selfupdate.mjs +3 -2
- package/.output/server/chunks/_/settingstabs.mjs +36 -0
- package/.output/server/chunks/_/updates.mjs +51 -10
- package/.output/server/chunks/_/worktrees.mjs +1 -1
- package/.output/server/chunks/_/ws.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +1718 -417
- package/.output/server/chunks/raw/bump-homebrew.mjs +1 -1
- package/.output/server/chunks/raw/herdr-plugin.mjs +1 -1
- package/.output/server/chunks/raw/release-ready.mjs +5 -0
- package/.output/server/chunks/routes/api/_..._.mjs +1 -1
- package/.output/server/chunks/routes/api/agents.post.mjs +1 -1
- package/.output/server/chunks/routes/api/ask-tab.post.mjs +1 -1
- package/.output/server/chunks/routes/api/attach.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/disable.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/lock-all.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/lock.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/login/options.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/login/verify.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/max-session.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/register/options.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/register/verify.post.mjs +1 -1
- package/.output/server/chunks/routes/api/auth/status.get.mjs +1 -1
- package/.output/server/chunks/routes/api/board.get.mjs +148 -0
- package/.output/server/chunks/routes/api/changes.get.mjs +2 -2
- package/.output/server/chunks/routes/api/chat/image.get.mjs +2 -2
- package/.output/server/chunks/routes/api/chat.get.mjs +26 -6
- package/.output/server/chunks/routes/api/choose.post.mjs +40 -14
- package/.output/server/chunks/routes/api/claude-statusline.post.mjs +2 -2
- package/.output/server/chunks/routes/api/close/status.get.mjs +2 -2
- package/.output/server/chunks/routes/api/close.post.mjs +1 -1
- package/.output/server/chunks/routes/api/codex-update.post.mjs +2 -2
- package/.output/server/chunks/routes/api/commands.get.mjs +4 -3
- package/.output/server/chunks/routes/api/config.get.mjs +3 -2
- package/.output/server/chunks/routes/api/dirs.get.mjs +2 -2
- package/.output/server/chunks/routes/api/dismiss-stopped.post.mjs +43 -0
- package/.output/server/chunks/routes/api/dismiss.post.mjs +2 -2
- package/.output/server/chunks/routes/api/effort.post.mjs +2 -2
- package/.output/server/chunks/routes/api/efforts.get.mjs +2 -2
- package/.output/server/chunks/routes/api/file.post.mjs +2 -2
- package/.output/server/chunks/routes/api/files/download.get.mjs +60 -0
- package/.output/server/chunks/routes/api/files/read.get.mjs +45 -0
- package/.output/server/chunks/routes/api/files.get.mjs +44 -0
- package/.output/server/chunks/routes/api/gitroot.get.mjs +2 -2
- package/.output/server/chunks/routes/api/health.get.mjs +1 -1
- package/.output/server/chunks/routes/api/index.get.mjs +2 -1
- package/.output/server/chunks/routes/api/input.post.mjs +32 -5
- package/.output/server/chunks/routes/api/interrupt.post.mjs +2 -2
- package/.output/server/chunks/routes/api/isgit.get.mjs +2 -2
- package/.output/server/chunks/routes/api/machine/awake.get.mjs +2 -2
- package/.output/server/chunks/routes/api/machine/awake.post.mjs +2 -2
- package/.output/server/chunks/routes/api/machine/order.get.mjs +1 -1
- package/.output/server/chunks/routes/api/machine/order.post.mjs +1 -1
- package/.output/server/chunks/routes/api/machine/rename.post.mjs +2 -2
- package/.output/server/chunks/routes/api/menu.post.mjs +5 -2
- package/.output/server/chunks/routes/api/model.post.mjs +2 -2
- package/.output/server/chunks/routes/api/models.get.mjs +2 -2
- package/.output/server/chunks/routes/api/nav.post.mjs +36 -22
- package/.output/server/chunks/routes/api/onboarding.get.mjs +1 -1
- package/.output/server/chunks/routes/api/onboarding.post.mjs +1 -1
- package/.output/server/chunks/routes/api/phone.get.mjs +2 -2
- package/.output/server/chunks/routes/api/phone.post.mjs +2 -2
- package/.output/server/chunks/routes/api/plugins/actions.get.mjs +4 -1
- package/.output/server/chunks/routes/api/plugins/invoke.post.mjs +4 -1
- package/.output/server/chunks/routes/api/plugins/profiles.get.mjs +4 -1
- package/.output/server/chunks/routes/api/plugins/projects.get.mjs +4 -3
- package/.output/server/chunks/routes/api/plugins/projects.post.mjs +4 -3
- package/.output/server/chunks/routes/api/plugins/thread-limits.get.mjs +2 -2
- package/.output/server/chunks/routes/api/plugins/thread-limits.post.mjs +2 -2
- package/.output/server/chunks/routes/api/project/inbox.get.mjs +44 -0
- package/.output/server/chunks/routes/api/project/inbox.post.mjs +44 -0
- package/.output/server/chunks/routes/api/project/memory.get.mjs +43 -0
- package/.output/server/chunks/routes/api/project/report.get.mjs +3 -2
- package/.output/server/chunks/routes/api/project/routines.get.mjs +44 -0
- package/.output/server/chunks/routes/api/project/settings.get.mjs +42 -0
- package/.output/server/chunks/routes/api/project/thread.get.mjs +45 -0
- package/.output/server/chunks/routes/api/project/thread.post.mjs +47 -0
- package/.output/server/chunks/routes/api/prompt.post.mjs +21 -3
- package/.output/server/chunks/routes/api/push/quiet.post.mjs +2 -2
- package/.output/server/chunks/routes/api/push/subscribe.post.mjs +2 -2
- package/.output/server/chunks/routes/api/push/test.post.mjs +2 -2
- package/.output/server/chunks/routes/api/push/unsubscribe.post.mjs +2 -2
- package/.output/server/chunks/routes/api/quotas.get.mjs +2 -2
- package/.output/server/chunks/routes/api/rename.post.mjs +1 -1
- package/.output/server/chunks/routes/api/requeue.post.mjs +2 -2
- package/.output/server/chunks/routes/api/restart.get.mjs +1 -1
- package/.output/server/chunks/routes/api/restart.post.mjs +1 -1
- package/.output/server/chunks/routes/api/reveal.post.mjs +2 -1
- package/.output/server/chunks/routes/api/screen-key.post.mjs +14 -11
- package/.output/server/chunks/routes/api/screen.get.mjs +6 -37
- package/.output/server/chunks/routes/api/search.get.mjs +2 -2
- package/.output/server/chunks/routes/api/seen.post.mjs +2 -2
- package/.output/server/chunks/routes/api/sessions.get.mjs +2 -2
- package/.output/server/chunks/routes/api/sessions.post.mjs +2 -2
- package/.output/server/chunks/routes/api/settings-tab.post.mjs +89 -0
- package/.output/server/chunks/routes/api/space.post.mjs +14 -14
- package/.output/server/chunks/routes/api/state.get.mjs +2 -2
- package/.output/server/chunks/routes/api/unqueue.post.mjs +2 -2
- package/.output/server/chunks/routes/api/update/status.get.mjs +1 -1
- package/.output/server/chunks/routes/api/update.get.mjs +2 -2
- package/.output/server/chunks/routes/api/update.post.mjs +2 -2
- package/.output/server/chunks/routes/api/upload.post.mjs +2 -2
- package/.output/server/chunks/routes/api/worktrees/remove.post.mjs +1 -1
- package/.output/server/chunks/routes/api/worktrees.get.mjs +1 -1
- package/.output/server/chunks/routes/favicon.ico.get.mjs +1 -1
- package/.output/server/chunks/routes/icons/_name_.get.mjs +2 -2
- package/.output/server/chunks/routes/renderer.mjs +3 -3
- package/.output/server/chunks/routes/uploads/_...name_.get.mjs +2 -2
- package/.output/server/chunks/routes/ws/_..._.mjs +2 -2
- package/.output/server/chunks/routes/ws/events.mjs +2 -2
- package/.output/server/chunks/routes/ws/term.mjs +2 -2
- package/.output/server/chunks/virtual/precomputed.mjs +1 -1
- package/.output/server/index.mjs +2 -2
- package/.output/server/package.json +1 -1
- package/README.md +368 -40
- package/bin/install-docker-skill.sh +20 -0
- package/bin/lib/commands.mjs +5 -1
- package/bin/lib/core.mjs +1 -0
- package/bin/lib/install-skill.sh +100 -0
- package/bin/lib/skill.mjs +16 -0
- package/bin/lib/updater.mjs +65 -12
- package/bin/lib/verify-release.mjs +20 -0
- package/package.json +5 -2
- package/skills/wherdr/SKILL.md +186 -0
- package/.output/public/_nuxt/B7QP1TFs.js +0 -23
- package/.output/public/_nuxt/BDNMzG2s.js +0 -1
- package/.output/public/_nuxt/BOpBIziZ.js +0 -6
- package/.output/public/_nuxt/BWXdFfeg.js +0 -17
- package/.output/public/_nuxt/COFCNFpG.js +0 -83
- package/.output/public/_nuxt/CWwyK2XK.js +0 -2
- package/.output/public/_nuxt/CXG-cOdh.js +0 -1
- package/.output/public/_nuxt/CkZ8t6uB.js +0 -1
- package/.output/public/_nuxt/D4Yz4rat.js +0 -65
- package/.output/public/_nuxt/D7sxNXx1.js +0 -1
- package/.output/public/_nuxt/DViwOclv.js +0 -1
- package/.output/public/_nuxt/DoD7Qb5P.js +0 -30
- package/.output/public/_nuxt/DyBZDSCV.js +0 -2
- package/.output/public/_nuxt/SiL1FJ5s.js +0 -3
- package/.output/public/_nuxt/bLP7Jj-b.js +0 -1
- package/.output/public/_nuxt/builds/meta/7afbf062-5369-4002-b20d-7a582ff6e0f1.json +0 -1
- package/.output/public/_nuxt/entry.Crt1r4l3.css +0 -2
- package/.output/server/chunks/routes/ws/mirror.mjs +0 -161
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as UPLOAD_DIR,
|
|
1
|
+
import { U as UPLOAD_DIR, C as uploadNames, D as runHerdrCli, E as parseIntegrationStatus, a as defineApi, i as getQuery, f as findPane, H as HerdrError, F as machineOfPane, G as fmt, I as takenBackOf, J as transcripts, K as missingIntegration, L as multiMachine, M as integrationCommand, N as chatPasted, O as withoutTakenBack, Q as withSentText, R as currentModel } from '../../nitro/nitro.mjs';
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import fs from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
@@ -31,19 +31,19 @@ import 'node:url';
|
|
|
31
31
|
|
|
32
32
|
const UPLOAD_PATH = /\.cache\/herdr-web\/uploads\/([\w-]+\.[a-z]+)/g;
|
|
33
33
|
const CACHE_MAX = 500;
|
|
34
|
-
const cache = /* @__PURE__ */ new Map();
|
|
34
|
+
const cache$1 = /* @__PURE__ */ new Map();
|
|
35
35
|
async function uploadHash(dir, name) {
|
|
36
36
|
const key = `${dir}
|
|
37
37
|
${name}`;
|
|
38
|
-
if (cache.has(key)) return cache.get(key);
|
|
38
|
+
if (cache$1.has(key)) return cache$1.get(key);
|
|
39
39
|
let hash = null;
|
|
40
40
|
try {
|
|
41
41
|
hash = createHash("sha256").update(await fs.readFile(path.join(dir, path.basename(name)))).digest("hex");
|
|
42
42
|
} catch {
|
|
43
43
|
hash = null;
|
|
44
44
|
}
|
|
45
|
-
if (cache.size >= CACHE_MAX) cache.delete(cache.keys().next().value);
|
|
46
|
-
cache.set(key, hash);
|
|
45
|
+
if (cache$1.size >= CACHE_MAX) cache$1.delete(cache$1.keys().next().value);
|
|
46
|
+
cache$1.set(key, hash);
|
|
47
47
|
return hash;
|
|
48
48
|
}
|
|
49
49
|
async function addUploadHashes(items, dir = UPLOAD_DIR) {
|
|
@@ -68,6 +68,23 @@ ${((_a = it.omp) == null ? void 0 : _a.target) || ""}`.matchAll(UPLOAD_PATH)].ma
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
const ttl = Number(process.env.WHERDR_INTEGRATION_TTL_MS);
|
|
72
|
+
const TTL_MS = Number.isFinite(ttl) && ttl >= 0 ? ttl : 6e4;
|
|
73
|
+
const cache = /* @__PURE__ */ new Map();
|
|
74
|
+
const keyOf = (m) => m.local ? "" : `${m.target || m.key}`;
|
|
75
|
+
async function integrationStatus(m) {
|
|
76
|
+
const key = keyOf(m);
|
|
77
|
+
const hit = cache.get(key);
|
|
78
|
+
if (hit == null ? void 0 : hit.pending) return hit.pending;
|
|
79
|
+
if (hit && Date.now() - hit.at < TTL_MS) return hit.status;
|
|
80
|
+
const pending = runHerdrCli(m, ["integration", "status"], 8e3).then((r) => r.code === 0 ? parseIntegrationStatus(r.stdout.toString("utf8")) : null).catch(() => null).then((status) => {
|
|
81
|
+
cache.set(key, { at: Date.now(), status: status && Object.keys(status).length ? status : null });
|
|
82
|
+
return cache.get(key).status;
|
|
83
|
+
});
|
|
84
|
+
cache.set(key, { at: (hit == null ? void 0 : hit.at) || 0, status: (hit == null ? void 0 : hit.status) || null, pending });
|
|
85
|
+
return pending;
|
|
86
|
+
}
|
|
87
|
+
|
|
71
88
|
const chat_get = defineApi(async (event) => {
|
|
72
89
|
const q = getQuery(event);
|
|
73
90
|
const p = findPane(String(q.pane || ""));
|
|
@@ -85,9 +102,12 @@ const chat_get = defineApi(async (event) => {
|
|
|
85
102
|
before: num("before")
|
|
86
103
|
// older slice, ending at this byte
|
|
87
104
|
});
|
|
105
|
+
if (!r.available && r.reason === "not_found" && m && p.agent && !p.agentSession && missingIntegration(p, await integrationStatus(m), m.transcripts.wasActive(p.id, p.agent))) {
|
|
106
|
+
return { ...r, reason: "no_integration", integration: { agent: p.agent, command: integrationCommand(p.agent), machine: multiMachine() ? m.label : null } };
|
|
107
|
+
}
|
|
88
108
|
if (r.token) r.token += mark;
|
|
89
109
|
if (r.items) {
|
|
90
|
-
r.items = withoutTakenBack(r.items, hidden);
|
|
110
|
+
r.items = chatPasted(withoutTakenBack(r.items, hidden));
|
|
91
111
|
await addUploadHashes(r.items);
|
|
92
112
|
}
|
|
93
113
|
if (r.queue && r.queue.length) r.queue = withSentText(p.id, r.queue);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HerdrError,
|
|
1
|
+
import { H as HerdrError, T as keysFor, V as parseChoices, W as parseOmpField, a as defineApi, P as PANE_RE, f as findPane, X as withPaneLock, Y as selfUpdates, Z as restarting, _ as updateChoices, $ as UPDATE_LABELS, a0 as updateRestartPlan, a1 as restarts, p as poll, h as herdr, J as transcripts, b as screenChoices, a2 as usesTerminalException, a3 as sameQuestion, a4 as sleep, g as choicesCache } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -113,25 +113,51 @@ async function typeClaudeAnswer(d, paneId, choices, index, answer) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
const choose_post = defineApi(async (event, b) => {
|
|
116
|
+
var _a;
|
|
116
117
|
if (!PANE_RE.test(b.pane_id || "")) throw new HerdrError("bad_pane", "Invalid pane");
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
if ((_a = findPane(b.pane_id)) == null ? void 0 : _a.stopped) {
|
|
119
|
+
return withPaneLock(b.pane_id, async () => {
|
|
120
|
+
const p = findPane(b.pane_id);
|
|
121
|
+
const launch = await selfUpdates.check(b.pane_id);
|
|
122
|
+
if (!(p == null ? void 0 : p.stopped) || !launch || restarting(p.id)) throw new HerdrError("stale", "The pane is not at an empty shell prompt. Check its terminal.");
|
|
123
|
+
const choice = updateChoices(launch)[Number(b.index)];
|
|
124
|
+
if (!choice || UPDATE_LABELS[choice] !== b.label || b.text) throw new HerdrError("stale", "The question has changed \u2014 check the current screen.");
|
|
125
|
+
const plan = updateRestartPlan(launch, choice);
|
|
126
|
+
restarts.set(p.id, { phase: "starting", agent: "codex", session: launch.session, at: Date.now() });
|
|
127
|
+
poll();
|
|
128
|
+
try {
|
|
129
|
+
await herdr("agent.start", { name: p.name || `codex-${Date.now().toString(36)}`, kind: "codex", pane_id: p.id, args: plan.args, timeout_ms: 6e4 }, 75e3);
|
|
130
|
+
} catch (e) {
|
|
131
|
+
if (!(e instanceof HerdrError) || e.code !== "agent_not_ready") {
|
|
132
|
+
restarts.delete(p.id);
|
|
133
|
+
setTimeout(poll, 0);
|
|
134
|
+
throw e;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
selfUpdates.clear(p.id);
|
|
138
|
+
restarts.set(p.id, { phase: "starting", agent: "codex", session: launch.session, at: Date.now(), started: true });
|
|
139
|
+
setTimeout(poll, 0);
|
|
140
|
+
return { ok: true };
|
|
141
|
+
});
|
|
127
142
|
}
|
|
128
|
-
if (option.free && !answer) throw new HerdrError("bad_text", "Write your answer before sending it.");
|
|
129
143
|
try {
|
|
144
|
+
const pane = findPane(b.pane_id);
|
|
145
|
+
const asked = pane && pane.agent === "claude" ? await transcripts.pendingClaudeQuestions(pane).catch(() => []) : [];
|
|
146
|
+
const r = await herdr("pane.read", { pane_id: b.pane_id, source: "detection" }, 4e3);
|
|
147
|
+
const text = r.read && r.read.text;
|
|
148
|
+
const choices = screenChoices(text, pane == null ? void 0 : pane.agent, asked);
|
|
149
|
+
const i = Number(b.index);
|
|
150
|
+
const option = choices && choices.options[i];
|
|
151
|
+
const answer = typeof b.text === "string" ? b.text.trim() : "";
|
|
152
|
+
if (!choices || !b.identity || choices.identity !== b.identity || usesTerminalException({ text: String(text || ""), agent: pane == null ? void 0 : pane.agent, status: pane == null ? void 0 : pane.status }) || !option || option.label !== b.label || answer && !option.free || option.free && !sameQuestion(choices.question, typeof b.question === "string" ? b.question : null)) {
|
|
153
|
+
throw new HerdrError("stale", "The question has changed \u2014 check the current screen.");
|
|
154
|
+
}
|
|
155
|
+
if (option.free && !answer) throw new HerdrError("bad_text", "Write your answer before sending it.");
|
|
130
156
|
if (option.free) await answerFree({ call: herdr, sleep, now: Date.now }, b.pane_id, choices, i, answer, pane == null ? void 0 : pane.agent);
|
|
131
157
|
else await herdr("pane.send_input", { pane_id: b.pane_id, keys: keysFor(choices, i) });
|
|
132
158
|
} finally {
|
|
133
159
|
choicesCache.delete(b.pane_id);
|
|
134
|
-
setTimeout(poll,
|
|
160
|
+
setTimeout(poll, 0);
|
|
135
161
|
}
|
|
136
162
|
return { ok: true };
|
|
137
163
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi,
|
|
1
|
+
import { a as defineApi, a5 as MACHINE_KEY_RE, a6 as getMachine, H as HerdrError, a7 as installClaudeStatusline } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, f as findPane, i as getQuery, H as HerdrError,
|
|
1
|
+
import { a as defineApi, f as findPane, i as getQuery, H as HerdrError, v as machineFor } from '../../../nitro/nitro.mjs';
|
|
2
2
|
import { a as readChangeStatus } from '../../../_/changes.mjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'node:https';
|
|
@@ -21,8 +21,8 @@ import 'web-push';
|
|
|
21
21
|
import 'node:os';
|
|
22
22
|
import 'node:child_process';
|
|
23
23
|
import 'node:net';
|
|
24
|
-
import 'node:readline';
|
|
25
24
|
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
26
|
import 'node:dns';
|
|
27
27
|
import 'node:util';
|
|
28
28
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, P as PANE_RE, H as HerdrError, f as findPane,
|
|
1
|
+
import { a as defineApi, P as PANE_RE, H as HerdrError, f as findPane, a8 as codexStatus } from '../../nitro/nitro.mjs';
|
|
2
2
|
import { u as updateCodexInPane } from '../../_/restart.mjs';
|
|
3
3
|
import 'node:http';
|
|
4
4
|
import 'node:https';
|
|
@@ -21,8 +21,8 @@ import 'web-push';
|
|
|
21
21
|
import 'node:os';
|
|
22
22
|
import 'node:child_process';
|
|
23
23
|
import 'node:net';
|
|
24
|
-
import 'node:readline';
|
|
25
24
|
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
26
|
import 'node:dns';
|
|
27
27
|
import 'node:util';
|
|
28
28
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, f as findPane, i as getQuery, H as HerdrError,
|
|
1
|
+
import { a as defineApi, f as findPane, i as getQuery, H as HerdrError, F as machineOfPane, ak as builtinCommands, al as slashCommands, ag as log } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -36,7 +36,8 @@ const commands_get = defineApi(async (event) => {
|
|
|
36
36
|
if (!p.agent || !m || !m.home) return { commands: [] };
|
|
37
37
|
if (!m.local && m.status !== "online") return { commands: builtinCommands(p.agent), partial: true };
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
const r = await slashCommands({ key: m.key, fs: m.fs, exec: m.exec, home: m.home, kind: p.agent, cwd: p.cwd });
|
|
40
|
+
return r.denied ? { ...r, remote: !m.local } : r;
|
|
40
41
|
} catch (e) {
|
|
41
42
|
log(`commands ${p.id}: ${e.message}`);
|
|
42
43
|
return { commands: builtinCommands(p.agent), partial: true };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { am as HOME, a as defineApi, an as localMachine, ao as readSubs, ap as vapidPublicKey, aq as pushReady, ar as machineConfigs, as as recentDirsWithKinds, at as installedAgentKinds, l as localMachineLabel } from '../../nitro/nitro.mjs';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { h as hostOpenReady } from '../../_/reveal.mjs';
|
|
@@ -21,14 +21,15 @@ import 'web-push';
|
|
|
21
21
|
import 'node:os';
|
|
22
22
|
import 'node:child_process';
|
|
23
23
|
import 'node:net';
|
|
24
|
-
import 'node:readline';
|
|
25
24
|
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
26
|
import 'node:dns';
|
|
27
27
|
import 'node:util';
|
|
28
28
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
29
29
|
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
30
30
|
import '@simplewebauthn/server';
|
|
31
31
|
import 'node:url';
|
|
32
|
+
import '../../_/filePaths.mjs';
|
|
32
33
|
|
|
33
34
|
const COLOR = /^(#[0-9a-f]{3,8}|[a-z]{3,20}|rgb\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*\))$/i;
|
|
34
35
|
const NAME = /^[a-z0-9][a-z0-9-]{0,39}$/i;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, i as getQuery,
|
|
1
|
+
import { a as defineApi, i as getQuery, aA as listDirs } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { a as defineApi, P as PANE_RE, H as HerdrError, X as withPaneLock, f as findPane, Z as restarting, aB as dismissStopped, p as poll } from '../../nitro/nitro.mjs';
|
|
2
|
+
import 'node:http';
|
|
3
|
+
import 'node:https';
|
|
4
|
+
import 'node:crypto';
|
|
5
|
+
import 'stream';
|
|
6
|
+
import 'events';
|
|
7
|
+
import 'http';
|
|
8
|
+
import 'crypto';
|
|
9
|
+
import 'buffer';
|
|
10
|
+
import 'zlib';
|
|
11
|
+
import 'https';
|
|
12
|
+
import 'net';
|
|
13
|
+
import 'tls';
|
|
14
|
+
import 'url';
|
|
15
|
+
import 'node:events';
|
|
16
|
+
import 'node:buffer';
|
|
17
|
+
import 'node:fs';
|
|
18
|
+
import 'node:path';
|
|
19
|
+
import 'web-push';
|
|
20
|
+
import 'node:os';
|
|
21
|
+
import 'node:child_process';
|
|
22
|
+
import 'node:net';
|
|
23
|
+
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
|
+
import 'node:dns';
|
|
26
|
+
import 'node:util';
|
|
27
|
+
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
28
|
+
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
29
|
+
import '@simplewebauthn/server';
|
|
30
|
+
import 'node:url';
|
|
31
|
+
|
|
32
|
+
const dismissStopped_post = defineApi(async (event, b) => {
|
|
33
|
+
if (!PANE_RE.test(b.pane_id || "")) throw new HerdrError("bad_pane", "Invalid pane");
|
|
34
|
+
await withPaneLock(b.pane_id, async () => {
|
|
35
|
+
var _a;
|
|
36
|
+
if (((_a = findPane(b.pane_id)) == null ? void 0 : _a.stopped) && !restarting(b.pane_id)) dismissStopped(b.pane_id);
|
|
37
|
+
});
|
|
38
|
+
await poll();
|
|
39
|
+
return { ok: true };
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { dismissStopped_post as default };
|
|
43
|
+
//# sourceMappingURL=dismiss-stopped.post.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, P as PANE_RE, H as HerdrError,
|
|
1
|
+
import { a as defineApi, P as PANE_RE, H as HerdrError, aC as closePanel } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, P as PANE_RE, H as HerdrError,
|
|
1
|
+
import { a as defineApi, P as PANE_RE, H as HerdrError, aD as setEffort, f as findPane, aE as refreshModel } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, i as getQuery, P as PANE_RE, H as HerdrError,
|
|
1
|
+
import { a as defineApi, i as getQuery, P as PANE_RE, H as HerdrError, aF as listEfforts, f as findPane, aE as refreshModel } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, i as getQuery,
|
|
1
|
+
import { a as defineApi, i as getQuery, aG as saveUpload, P as PANE_RE } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { a as defineApi, i as getQuery, f as findPane, H as HerdrError, v as machineFor, aH as setResponseHeader } from '../../../nitro/nitro.mjs';
|
|
2
|
+
import { r as readWrittenBytes, a as readFileBytes, i as isPdf, b as attachmentHeader } from '../../../_/files.mjs';
|
|
3
|
+
import 'node:http';
|
|
4
|
+
import 'node:https';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import 'events';
|
|
8
|
+
import 'http';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'buffer';
|
|
11
|
+
import 'zlib';
|
|
12
|
+
import 'https';
|
|
13
|
+
import 'net';
|
|
14
|
+
import 'tls';
|
|
15
|
+
import 'url';
|
|
16
|
+
import 'node:events';
|
|
17
|
+
import 'node:buffer';
|
|
18
|
+
import 'node:fs';
|
|
19
|
+
import 'node:path';
|
|
20
|
+
import 'web-push';
|
|
21
|
+
import 'node:os';
|
|
22
|
+
import 'node:child_process';
|
|
23
|
+
import 'node:net';
|
|
24
|
+
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
|
+
import 'node:dns';
|
|
27
|
+
import 'node:util';
|
|
28
|
+
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
29
|
+
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
30
|
+
import '@simplewebauthn/server';
|
|
31
|
+
import 'node:url';
|
|
32
|
+
import '../../../_/filePaths.mjs';
|
|
33
|
+
import '../../../_/changes.mjs';
|
|
34
|
+
|
|
35
|
+
const download_get = defineApi(async (event) => {
|
|
36
|
+
const q = getQuery(event);
|
|
37
|
+
const p = findPane(String(q.pane || ""));
|
|
38
|
+
if (!p) throw new HerdrError("bad_pane", "Pane not found");
|
|
39
|
+
let f;
|
|
40
|
+
if (q.from === "chat") f = await readWrittenBytes(machineFor(p.machine), p.cwd, q.path);
|
|
41
|
+
else {
|
|
42
|
+
if (!p.cwd) throw new HerdrError("bad_cwd", "This agent\u2019s folder is unknown");
|
|
43
|
+
f = await readFileBytes(machineFor(p.machine), p.cwd, q.path);
|
|
44
|
+
}
|
|
45
|
+
setResponseHeader(event, "x-content-type-options", "nosniff");
|
|
46
|
+
if (q.inline === "1" && isPdf(f.name, f.body)) {
|
|
47
|
+
setResponseHeader(event, "content-type", "application/pdf");
|
|
48
|
+
setResponseHeader(event, "content-disposition", attachmentHeader(f.name, "inline"));
|
|
49
|
+
setResponseHeader(event, "content-security-policy", "default-src 'none'; object-src 'self'; frame-ancestors 'self'");
|
|
50
|
+
setResponseHeader(event, "cache-control", "private, no-store");
|
|
51
|
+
return f.body;
|
|
52
|
+
}
|
|
53
|
+
setResponseHeader(event, "content-type", "application/octet-stream");
|
|
54
|
+
setResponseHeader(event, "content-disposition", attachmentHeader(f.name));
|
|
55
|
+
setResponseHeader(event, "content-security-policy", "default-src 'none'; sandbox");
|
|
56
|
+
return f.body;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export { download_get as default };
|
|
60
|
+
//# sourceMappingURL=download.get.mjs.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { a as defineApi, i as getQuery, f as findPane, H as HerdrError, v as machineFor } from '../../../nitro/nitro.mjs';
|
|
2
|
+
import { c as readWrittenPreview, d as readFilePreview } from '../../../_/files.mjs';
|
|
3
|
+
import 'node:http';
|
|
4
|
+
import 'node:https';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import 'events';
|
|
8
|
+
import 'http';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'buffer';
|
|
11
|
+
import 'zlib';
|
|
12
|
+
import 'https';
|
|
13
|
+
import 'net';
|
|
14
|
+
import 'tls';
|
|
15
|
+
import 'url';
|
|
16
|
+
import 'node:events';
|
|
17
|
+
import 'node:buffer';
|
|
18
|
+
import 'node:fs';
|
|
19
|
+
import 'node:path';
|
|
20
|
+
import 'web-push';
|
|
21
|
+
import 'node:os';
|
|
22
|
+
import 'node:child_process';
|
|
23
|
+
import 'node:net';
|
|
24
|
+
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
|
+
import 'node:dns';
|
|
27
|
+
import 'node:util';
|
|
28
|
+
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
29
|
+
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
30
|
+
import '@simplewebauthn/server';
|
|
31
|
+
import 'node:url';
|
|
32
|
+
import '../../../_/filePaths.mjs';
|
|
33
|
+
import '../../../_/changes.mjs';
|
|
34
|
+
|
|
35
|
+
const read_get = defineApi(async (event) => {
|
|
36
|
+
const q = getQuery(event);
|
|
37
|
+
const p = findPane(String(q.pane || ""));
|
|
38
|
+
if (!p) throw new HerdrError("bad_pane", "Pane not found");
|
|
39
|
+
if (q.from === "chat") return readWrittenPreview(machineFor(p.machine), p.cwd, q.path);
|
|
40
|
+
if (!p.cwd) throw new HerdrError("bad_cwd", "This agent\u2019s folder is unknown");
|
|
41
|
+
return readFilePreview(machineFor(p.machine), p.cwd, q.path);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export { read_get as default };
|
|
45
|
+
//# sourceMappingURL=read.get.mjs.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { a as defineApi, i as getQuery, f as findPane, H as HerdrError, v as machineFor } from '../../nitro/nitro.mjs';
|
|
2
|
+
import { l as listFiles } from '../../_/files.mjs';
|
|
3
|
+
import 'node:http';
|
|
4
|
+
import 'node:https';
|
|
5
|
+
import 'node:crypto';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import 'events';
|
|
8
|
+
import 'http';
|
|
9
|
+
import 'crypto';
|
|
10
|
+
import 'buffer';
|
|
11
|
+
import 'zlib';
|
|
12
|
+
import 'https';
|
|
13
|
+
import 'net';
|
|
14
|
+
import 'tls';
|
|
15
|
+
import 'url';
|
|
16
|
+
import 'node:events';
|
|
17
|
+
import 'node:buffer';
|
|
18
|
+
import 'node:fs';
|
|
19
|
+
import 'node:path';
|
|
20
|
+
import 'web-push';
|
|
21
|
+
import 'node:os';
|
|
22
|
+
import 'node:child_process';
|
|
23
|
+
import 'node:net';
|
|
24
|
+
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
|
+
import 'node:dns';
|
|
27
|
+
import 'node:util';
|
|
28
|
+
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
29
|
+
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
30
|
+
import '@simplewebauthn/server';
|
|
31
|
+
import 'node:url';
|
|
32
|
+
import '../../_/filePaths.mjs';
|
|
33
|
+
import '../../_/changes.mjs';
|
|
34
|
+
|
|
35
|
+
const files_get = defineApi(async (event) => {
|
|
36
|
+
const q = getQuery(event);
|
|
37
|
+
const p = findPane(String(q.pane || ""));
|
|
38
|
+
if (!p) throw new HerdrError("bad_pane", "Pane not found");
|
|
39
|
+
if (!p.cwd) throw new HerdrError("bad_cwd", "This agent\u2019s folder is unknown");
|
|
40
|
+
return listFiles(machineFor(p.machine), p.cwd, q.path === void 0 ? null : String(q.path));
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { files_get as default };
|
|
44
|
+
//# sourceMappingURL=files.get.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, i as getQuery,
|
|
1
|
+
import { a as defineApi, i as getQuery, v as machineFor, aI as underHome } from '../../nitro/nitro.mjs';
|
|
2
2
|
import { g as gitToplevel } from '../../_/changes.mjs';
|
|
3
3
|
import { p as proposedRepo } from '../../_/projectsActions.mjs';
|
|
4
4
|
import 'node:http';
|
|
@@ -22,8 +22,8 @@ import 'web-push';
|
|
|
22
22
|
import 'node:os';
|
|
23
23
|
import 'node:child_process';
|
|
24
24
|
import 'node:net';
|
|
25
|
-
import 'node:readline';
|
|
26
25
|
import 'node:fs/promises';
|
|
26
|
+
import 'node:readline';
|
|
27
27
|
import 'node:dns';
|
|
28
28
|
import 'node:util';
|
|
29
29
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -21,8 +21,8 @@ import 'web-push';
|
|
|
21
21
|
import 'node:os';
|
|
22
22
|
import 'node:child_process';
|
|
23
23
|
import 'node:net';
|
|
24
|
-
import 'node:readline';
|
|
25
24
|
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
26
|
import 'node:dns';
|
|
27
27
|
import 'node:util';
|
|
28
28
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -21,14 +21,15 @@ import 'web-push';
|
|
|
21
21
|
import 'node:os';
|
|
22
22
|
import 'node:child_process';
|
|
23
23
|
import 'node:net';
|
|
24
|
-
import 'node:readline';
|
|
25
24
|
import 'node:fs/promises';
|
|
25
|
+
import 'node:readline';
|
|
26
26
|
import 'node:dns';
|
|
27
27
|
import 'node:util';
|
|
28
28
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
29
29
|
import 'qrcode-terminal/vendor/QRCode/QRErrorCorrectLevel.js';
|
|
30
30
|
import '@simplewebauthn/server';
|
|
31
31
|
import 'node:url';
|
|
32
|
+
import '../../_/projectsPlugin.mjs';
|
|
32
33
|
|
|
33
34
|
const index_get = defineApi(async (event) => {
|
|
34
35
|
const q = getQuery(event);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as defineApi, P as PANE_RE, H as HerdrError,
|
|
1
|
+
import { a as defineApi, P as PANE_RE, H as HerdrError, X as withPaneLock, f as findPane, J as transcripts, h as herdr, b as screenChoices, a2 as usesTerminalException, aJ as isSlashCommand, aK as addQueued, p as poll, g as choicesCache } from '../../nitro/nitro.mjs';
|
|
2
2
|
import 'node:http';
|
|
3
3
|
import 'node:https';
|
|
4
4
|
import 'node:crypto';
|
|
@@ -20,8 +20,8 @@ import 'web-push';
|
|
|
20
20
|
import 'node:os';
|
|
21
21
|
import 'node:child_process';
|
|
22
22
|
import 'node:net';
|
|
23
|
-
import 'node:readline';
|
|
24
23
|
import 'node:fs/promises';
|
|
24
|
+
import 'node:readline';
|
|
25
25
|
import 'node:dns';
|
|
26
26
|
import 'node:util';
|
|
27
27
|
import 'qrcode-terminal/vendor/QRCode/index.js';
|
|
@@ -31,10 +31,37 @@ import 'node:url';
|
|
|
31
31
|
|
|
32
32
|
const input_post = defineApi(async (event, b) => {
|
|
33
33
|
if (!PANE_RE.test(b.pane_id || "")) throw new HerdrError("bad_pane", "Invalid pane");
|
|
34
|
-
await withPaneLock(b.pane_id, async () => {
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
const held = await withPaneLock(b.pane_id, async () => {
|
|
35
|
+
var _a;
|
|
36
|
+
try {
|
|
37
|
+
const now = findPane(b.pane_id);
|
|
38
|
+
if (b.native) {
|
|
39
|
+
const asked = (now == null ? void 0 : now.agent) === "claude" ? await transcripts.pendingClaudeQuestions(now).catch(() => []) : [];
|
|
40
|
+
const r = await herdr("pane.read", { pane_id: b.pane_id, source: "detection" }, 4e3);
|
|
41
|
+
const text = (_a = r.read) == null ? void 0 : _a.text;
|
|
42
|
+
const choices = screenChoices(text, now == null ? void 0 : now.agent, asked);
|
|
43
|
+
if ((now == null ? void 0 : now.stopped) || (now == null ? void 0 : now.leaving) || !b.identity || (choices == null ? void 0 : choices.identity) !== b.identity || usesTerminalException({ text: String(text || ""), agent: now == null ? void 0 : now.agent, status: now == null ? void 0 : now.status })) {
|
|
44
|
+
throw new HerdrError("stale", "The question has changed \u2014 check the current screen.");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
if ((now == null ? void 0 : now.stopped) || (now == null ? void 0 : now.leaving)) {
|
|
48
|
+
if (typeof b.text !== "string" || !b.text.trim() || isSlashCommand(b.text) || !Array.isArray(b.keys) || b.keys.length !== 1 || b.keys[0] !== "enter") {
|
|
49
|
+
throw new HerdrError("stale", now.stopped ? "Restart Codex before sending a command." : "Codex just stopped. Try again in a few seconds.");
|
|
50
|
+
}
|
|
51
|
+
const q = addQueued(b.pane_id, b.text, { held: true });
|
|
52
|
+
setTimeout(poll, 50);
|
|
53
|
+
return q;
|
|
54
|
+
}
|
|
55
|
+
if (typeof b.text === "string" && b.text) await herdr("pane.send_input", { pane_id: b.pane_id, text: b.text });
|
|
56
|
+
if (Array.isArray(b.keys) && b.keys.length) await herdr("pane.send_input", { pane_id: b.pane_id, keys: b.keys.map(String) });
|
|
57
|
+
} finally {
|
|
58
|
+
if (b.native) {
|
|
59
|
+
choicesCache.delete(b.pane_id);
|
|
60
|
+
setTimeout(poll, 0);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
37
63
|
});
|
|
64
|
+
if (held) return { ok: true, queued: held };
|
|
38
65
|
const p = findPane(b.pane_id);
|
|
39
66
|
if (p && p.agent && typeof b.text === "string" && b.text.trim() && !isSlashCommand(b.text)) {
|
|
40
67
|
const q = addQueued(b.pane_id, b.text);
|