heyio 0.15.0 → 0.17.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/dist/copilot/scheduler.js +23 -14
- package/dist/copilot/tools.js +31 -2
- package/dist/tui/index.js +64 -0
- package/package.json +1 -1
- package/web-dist/assets/{InboxView-gSveUMV6.js → InboxView-CR3ZzT5n.js} +1 -1
- package/web-dist/assets/{index-Dt6V4NnU.js → index-DCeo0qxD.js} +13 -13
- package/web-dist/index.html +1 -1
|
@@ -16,6 +16,8 @@ import { delegateToAgent } from "./agents.js";
|
|
|
16
16
|
import { nextRun } from "./cron.js";
|
|
17
17
|
import { notifyBackground } from "../notify.js";
|
|
18
18
|
import { startScheduleRun, completeScheduleRun, failScheduleRun } from "../store/schedule-runs.js";
|
|
19
|
+
import { createInboxEntry } from "../store/inbox.js";
|
|
20
|
+
import { shouldRouteToInbox } from "./tools.js";
|
|
19
21
|
const TICK_MS = 30_000;
|
|
20
22
|
const AGENDA_BLOCKS = {
|
|
21
23
|
triage: `**Triage**
|
|
@@ -80,20 +82,27 @@ async function fireSchedule(schedule) {
|
|
|
80
82
|
});
|
|
81
83
|
try {
|
|
82
84
|
await delegateToAgent(squad.slug, prompt, (_taskId, result) => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
85
|
+
if (shouldRouteToInbox(prompt)) {
|
|
86
|
+
createInboxEntry(`[${squad.slug}] ${schedule.name}`, result);
|
|
87
|
+
console.error(`[io] Schedule ${schedule.id} result routed to inbox`);
|
|
88
|
+
completeScheduleRun(run.id, 0);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
void notifyBackground({
|
|
92
|
+
source: {
|
|
93
|
+
type: "squad-schedule",
|
|
94
|
+
scheduleId: schedule.id,
|
|
95
|
+
squadSlug: squad.slug,
|
|
96
|
+
scheduleName: schedule.name,
|
|
97
|
+
},
|
|
98
|
+
title: `${squad.name}: ${schedule.name}`,
|
|
99
|
+
text: result,
|
|
100
|
+
}).then((notifyResult) => {
|
|
101
|
+
completeScheduleRun(run.id, notifyResult.id);
|
|
102
|
+
}).catch((err) => {
|
|
103
|
+
failScheduleRun(run.id, err instanceof Error ? err.message : String(err));
|
|
104
|
+
});
|
|
105
|
+
}
|
|
97
106
|
});
|
|
98
107
|
}
|
|
99
108
|
catch (err) {
|
package/dist/copilot/tools.js
CHANGED
|
@@ -5,6 +5,7 @@ import { readFileSync, writeFileSync, readdirSync, statSync, existsSync, mkdirSy
|
|
|
5
5
|
import { join, dirname, resolve } from "path";
|
|
6
6
|
import { homedir } from "os";
|
|
7
7
|
import { UNIVERSES } from "./universes.js";
|
|
8
|
+
import { createInboxEntry } from "../store/inbox.js";
|
|
8
9
|
import { validateCron, nextRun } from "./cron.js";
|
|
9
10
|
import { createIoSchedule, deleteIoSchedule, getIoSchedule, listIoSchedules, setIoScheduleEnabled, updateIoScheduleNextRun, } from "../store/io-schedules.js";
|
|
10
11
|
import { runIoScheduleNow } from "./io-scheduler.js";
|
|
@@ -228,6 +229,16 @@ function shellEnv() {
|
|
|
228
229
|
env.HOME = homedir();
|
|
229
230
|
return env;
|
|
230
231
|
}
|
|
232
|
+
export function shouldRouteToInbox(taskDescription) {
|
|
233
|
+
const lower = taskDescription.toLowerCase();
|
|
234
|
+
return (lower.includes("io inbox") ||
|
|
235
|
+
lower.includes("io-inbox") ||
|
|
236
|
+
lower.includes("send to inbox") ||
|
|
237
|
+
lower.includes("to the inbox") ||
|
|
238
|
+
lower.includes("result: \"io-inbox\"") ||
|
|
239
|
+
lower.includes("not github or telegram") ||
|
|
240
|
+
lower.includes("not telegram"));
|
|
241
|
+
}
|
|
231
242
|
export function createTools(deps) {
|
|
232
243
|
const wikiRead = defineTool("wiki_read", {
|
|
233
244
|
description: "Read a page from IO's knowledge base wiki. Path is relative to the wiki root (e.g., 'pages/preferences/editor.md').",
|
|
@@ -387,6 +398,10 @@ export function createTools(deps) {
|
|
|
387
398
|
try {
|
|
388
399
|
const taskId = await deps.delegateToAgent(slug, task, (id, result) => {
|
|
389
400
|
console.error(`[io] Agent task ${id} completed for squad ${slug}`);
|
|
401
|
+
if (shouldRouteToInbox(task)) {
|
|
402
|
+
createInboxEntry(`[${slug}] Task result`, result);
|
|
403
|
+
console.error(`[io] Task ${id} result routed to inbox`);
|
|
404
|
+
}
|
|
390
405
|
}, agent);
|
|
391
406
|
const agentLabel = agent ? `agent "${agent}" in squad "${slug}"` : `squad "${slug}"`;
|
|
392
407
|
const warningPrefix = coverage.warning
|
|
@@ -1197,7 +1212,7 @@ export function createTools(deps) {
|
|
|
1197
1212
|
});
|
|
1198
1213
|
// GitHub issue/PR management via gh CLI
|
|
1199
1214
|
const github = defineTool("github", {
|
|
1200
|
-
description: "Manage GitHub issues and pull requests using the gh CLI. Supports creating, listing, viewing,
|
|
1215
|
+
description: "Manage GitHub issues and pull requests using the gh CLI. Supports creating, listing, viewing, commenting on, and reviewing issues and PRs.",
|
|
1201
1216
|
skipPermission: true,
|
|
1202
1217
|
parameters: z.object({
|
|
1203
1218
|
action: z
|
|
@@ -1211,6 +1226,7 @@ export function createTools(deps) {
|
|
|
1211
1226
|
"list_prs",
|
|
1212
1227
|
"view_pr",
|
|
1213
1228
|
"comment_pr",
|
|
1229
|
+
"review_pr",
|
|
1214
1230
|
])
|
|
1215
1231
|
.describe("The GitHub action to perform"),
|
|
1216
1232
|
repo: z.string().describe("Repository in owner/repo format"),
|
|
@@ -1223,8 +1239,10 @@ export function createTools(deps) {
|
|
|
1223
1239
|
head: z.string().optional().describe("Head branch (for create_pr)"),
|
|
1224
1240
|
state: z.enum(["open", "closed", "all"]).optional().describe("Filter by state (for list_*)"),
|
|
1225
1241
|
limit: z.number().optional().describe("Max results (for list_*, default 10)"),
|
|
1242
|
+
review_action: z.enum(["approve", "request-changes", "comment"]).optional()
|
|
1243
|
+
.describe("Review action (for review_pr): approve, request-changes, or comment"),
|
|
1226
1244
|
}),
|
|
1227
|
-
handler: async ({ action, repo, title, body, labels, assignees, number, base, head, state, limit }) => {
|
|
1245
|
+
handler: async ({ action, repo, title, body, labels, assignees, number, base, head, state, limit, review_action }) => {
|
|
1228
1246
|
console.error(`[io] github tool called: ${action} on ${repo}`);
|
|
1229
1247
|
try {
|
|
1230
1248
|
let cmd;
|
|
@@ -1300,6 +1318,17 @@ export function createTools(deps) {
|
|
|
1300
1318
|
cmd = `gh pr comment ${number} ${r} --body "${body.replace(/"/g, '\\"')}"`;
|
|
1301
1319
|
break;
|
|
1302
1320
|
}
|
|
1321
|
+
case "review_pr": {
|
|
1322
|
+
if (!number)
|
|
1323
|
+
return "Error: number is required for review_pr";
|
|
1324
|
+
if (!review_action)
|
|
1325
|
+
return "Error: review_action is required for review_pr (approve, request-changes, or comment)";
|
|
1326
|
+
cmd = `gh pr review ${number} ${r} --${review_action}`;
|
|
1327
|
+
if (body && (review_action === "request-changes" || review_action === "comment")) {
|
|
1328
|
+
cmd += ` --body "${body.replace(/"/g, '\\"')}"`;
|
|
1329
|
+
}
|
|
1330
|
+
break;
|
|
1331
|
+
}
|
|
1303
1332
|
default:
|
|
1304
1333
|
return `Unknown action: ${action}`;
|
|
1305
1334
|
}
|
package/dist/tui/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createInterface } from "readline";
|
|
|
2
2
|
import { listRecentTasks, getTask } from "../store/tasks.js";
|
|
3
3
|
import { getTaskEvents } from "../copilot/agents.js";
|
|
4
4
|
import { summarize } from "../copilot/event-summary.js";
|
|
5
|
+
import { listInboxEntries, deleteInboxEntry, countInboxEntries, } from "../store/inbox.js";
|
|
5
6
|
let messageHandler;
|
|
6
7
|
export function setMessageHandler(handler) {
|
|
7
8
|
messageHandler = handler;
|
|
@@ -14,6 +15,9 @@ Type a message to chat. Commands:
|
|
|
14
15
|
/status — show status
|
|
15
16
|
/activity [id|N] — show summarized activity for a task (default: most recent)
|
|
16
17
|
/verbose — toggle verbose mode (raw event detail in /activity)
|
|
18
|
+
/inbox — list inbox entries
|
|
19
|
+
/inbox delete <id> — delete an inbox entry by ID
|
|
20
|
+
/inbox clear — delete all inbox entries
|
|
17
21
|
/quit — exit
|
|
18
22
|
`;
|
|
19
23
|
let verbose = false;
|
|
@@ -124,6 +128,24 @@ function renderActivity(taskIdArg) {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
}
|
|
131
|
+
function renderInbox() {
|
|
132
|
+
const entries = listInboxEntries();
|
|
133
|
+
if (entries.length === 0) {
|
|
134
|
+
console.log("\u2705 Inbox is empty.");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
console.log(`\u2705 Inbox (${entries.length} ${entries.length === 1 ? "entry" : "entries"})`);
|
|
138
|
+
console.log("\u2500".repeat(60));
|
|
139
|
+
for (const entry of entries) {
|
|
140
|
+
const ts = new Date(entry.created_at).toLocaleString();
|
|
141
|
+
console.log(`[${entry.id}] ${entry.title} \u2014 ${ts}`);
|
|
142
|
+
const preview = entry.body.length > 200 ? entry.body.slice(0, 200) + "\u2026" : entry.body;
|
|
143
|
+
for (const line of preview.split(/\r?\n/)) {
|
|
144
|
+
console.log(` ${line}`);
|
|
145
|
+
}
|
|
146
|
+
console.log("");
|
|
147
|
+
}
|
|
148
|
+
}
|
|
127
149
|
function clearLine() {
|
|
128
150
|
process.stdout.write("\r\x1b[K");
|
|
129
151
|
}
|
|
@@ -150,7 +172,11 @@ export async function startTui() {
|
|
|
150
172
|
process.exit(0);
|
|
151
173
|
}
|
|
152
174
|
if (trimmed === "/status") {
|
|
175
|
+
const inboxCount = countInboxEntries();
|
|
153
176
|
console.log(`[io] Uptime: ${Math.floor(process.uptime())}s`);
|
|
177
|
+
if (inboxCount > 0) {
|
|
178
|
+
console.log(`[io] \u2705 Inbox: ${inboxCount} ${inboxCount === 1 ? "entry" : "entries"}`);
|
|
179
|
+
}
|
|
154
180
|
rl.prompt();
|
|
155
181
|
return;
|
|
156
182
|
}
|
|
@@ -171,6 +197,44 @@ export async function startTui() {
|
|
|
171
197
|
rl.prompt();
|
|
172
198
|
return;
|
|
173
199
|
}
|
|
200
|
+
if (trimmed === "/inbox" || trimmed.startsWith("/inbox ")) {
|
|
201
|
+
const sub = trimmed.slice("/inbox".length).trim();
|
|
202
|
+
try {
|
|
203
|
+
if (sub === "") {
|
|
204
|
+
renderInbox();
|
|
205
|
+
}
|
|
206
|
+
else if (sub === "clear") {
|
|
207
|
+
const entries = listInboxEntries();
|
|
208
|
+
let deleted = 0;
|
|
209
|
+
for (const entry of entries) {
|
|
210
|
+
if (deleteInboxEntry(entry.id))
|
|
211
|
+
deleted++;
|
|
212
|
+
}
|
|
213
|
+
console.log(`[io] Cleared ${deleted} inbox ${deleted === 1 ? "entry" : "entries"}.`);
|
|
214
|
+
}
|
|
215
|
+
else if (sub.startsWith("delete ")) {
|
|
216
|
+
const rawId = sub.slice("delete ".length).trim();
|
|
217
|
+
const id = Number.parseInt(rawId, 10);
|
|
218
|
+
if (Number.isNaN(id)) {
|
|
219
|
+
console.log(`[io] Invalid ID: "${rawId}". Usage: /inbox delete <id>`);
|
|
220
|
+
}
|
|
221
|
+
else if (deleteInboxEntry(id)) {
|
|
222
|
+
console.log(`[io] Deleted inbox entry #${id}.`);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
console.log(`[io] Inbox entry #${id} not found.`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
console.log(`[io] Unknown inbox subcommand: "${sub}". Try /inbox, /inbox delete <id>, or /inbox clear.`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
console.error(`[io] /inbox failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
234
|
+
}
|
|
235
|
+
rl.prompt();
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
174
238
|
if (!messageHandler) {
|
|
175
239
|
console.log("[io] No message handler registered.");
|
|
176
240
|
rl.prompt();
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as _,o as L,c as a,a as n,t as i,b as m,e as f,f as M,F as j,r as C,g as u,h as p,i as o,w as E,u as S,j as T}from"./index-
|
|
1
|
+
import{d as _,o as L,c as a,a as n,t as i,b as m,e as f,f as M,F as j,r as C,g as u,h as p,i as o,w as E,u as S,j as T}from"./index-DCeo0qxD.js";const D={class:"flex flex-col h-full p-6"},B={class:"flex justify-between items-center mb-6"},V={key:0,class:"text-[10px] font-mono text-accent bg-accent/10 border border-accent/20 px-2 py-0.5 rounded-full"},H={key:0,class:"flex-1 flex items-center justify-center"},N={key:1,class:"flex-1 flex flex-col items-center justify-center"},z={key:2,class:"space-y-2 overflow-y-auto flex-1 pr-1"},F=["onClick"],$={class:"flex-1 min-w-0"},I={class:"flex items-start justify-between gap-2"},P={class:"text-sm font-semibold text-txt-primary leading-snug"},Z={class:"text-[10px] text-txt-muted font-mono shrink-0 mt-0.5"},A={key:0,class:"text-xs text-txt-secondary mt-1 line-clamp-2 leading-relaxed"},W=["onClick","disabled"],q={key:0,class:"px-4 pb-4"},G=["innerHTML"],J={key:3,class:"mt-3 flex items-center gap-2 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-xl px-3.5 py-2.5"},Q=_({__name:"InboxView",setup(K){const l=u([]),v=u(!0),r=u(new Set),d=u(new Set),c=u(null);function h(t){try{const e=t.includes("T")||t.endsWith("Z")?t:t.replace(" ","T")+"Z";return new Date(e).toLocaleString()}catch{return t}}function g(t){return t.replace(/[#*`_~[\]()]/g,"").slice(0,200)}function b(t){const e=new Set(r.value);e.has(t)?e.delete(t):e.add(t),r.value=e}async function w(){v.value=!0,c.value=null;try{const t=await p("/api/inbox");if(t.ok){const e=await t.json();l.value=e.entries??[]}}catch{}v.value=!1}async function k(t){if(!window.confirm("Delete this inbox entry?"))return;const e=new Set(d.value);e.add(t),d.value=e;try{const s=await p(`/api/inbox/${t}`,{method:"DELETE"});if(s.ok){l.value=l.value.filter(y=>y.id!==t);const x=new Set(r.value);x.delete(t),r.value=x}else c.value=`Failed to delete entry (HTTP ${s.status})`}catch(s){c.value=s instanceof Error?s.message:"Delete failed"}finally{const s=new Set(d.value);s.delete(t),d.value=s}}return L(w),(t,e)=>(o(),a("div",D,[n("div",B,[e[0]||(e[0]=n("div",null,[n("h2",{class:"text-xl font-semibold text-txt-primary tracking-tight"},"Inbox"),n("p",{class:"text-xs text-txt-muted mt-0.5"},"Messages & incoming items")],-1)),l.value.length>0?(o(),a("span",V,i(l.value.length)+" item"+i(l.value.length===1?"":"s"),1)):m("",!0)]),v.value?(o(),a("div",H,[...e[1]||(e[1]=[n("div",{class:"flex items-center gap-3 text-txt-muted text-sm"},[n("div",{class:"w-1.5 h-1.5 rounded-full bg-accent animate-pulse"}),f(" Loading… ")],-1)])])):l.value.length===0?(o(),a("div",N,[...e[2]||(e[2]=[M('<div class="w-14 h-14 rounded-xl bg-surface-2 border border-edge flex items-center justify-center mb-4"><svg class="w-7 h-7 text-txt-muted" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M2.25 13.5h3.86a2.25 2.25 0 012.012 1.244l.256.512a2.25 2.25 0 002.013 1.244h3.218a2.25 2.25 0 002.013-1.244l.256-.512a2.25 2.25 0 012.013-1.244h3.859m-19.5.338V18a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18v-4.162c0-.224-.034-.447-.1-.661L19.24 5.338a2.25 2.25 0 00-2.15-1.588H6.911a2.25 2.25 0 00-2.15 1.588L2.35 13.177a2.25 2.25 0 00-.1.661z"></path></svg></div><p class="text-txt-muted text-sm font-medium">Inbox is empty</p><p class="text-txt-muted/60 text-xs mt-1">No messages right now</p>',3)])])):(o(),a("ul",z,[(o(!0),a(j,null,C(l.value,s=>(o(),a("li",{key:s.id,class:"group bg-surface-2/50 border border-edge rounded-xl hover:border-edge-bright hover:shadow-card transition-all duration-200 overflow-hidden animate-fade-in"},[n("div",{class:"flex items-start gap-3 p-4 cursor-pointer",onClick:x=>b(s.id)},[e[4]||(e[4]=n("div",{class:"mt-1.5 w-1.5 h-1.5 rounded-full bg-accent shadow-glow-sm shrink-0"},null,-1)),n("div",$,[n("div",I,[n("span",P,i(s.title),1),n("span",Z,i(h(s.created_at)),1)]),r.value.has(s.id)?m("",!0):(o(),a("p",A,i(g(s.body)),1))]),n("button",{onClick:E(x=>k(s.id),["stop"]),disabled:d.value.has(s.id),class:"opacity-0 group-hover:opacity-100 shrink-0 p-1.5 rounded-lg text-txt-muted hover:text-red-400 hover:bg-red-500/10 border border-transparent hover:border-red-500/20 disabled:opacity-30 transition-all duration-200",title:"Delete entry"},[...e[3]||(e[3]=[n("svg",{class:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor"},[n("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"})],-1)])],8,W)],8,F),r.value.has(s.id)?(o(),a("div",q,[n("div",{class:"text-sm text-txt-secondary bg-surface-0/60 rounded-xl p-4 border border-edge/50 wiki-content leading-relaxed",innerHTML:S(T)(s.body)},null,8,G)])):m("",!0)]))),128))])),c.value?(o(),a("div",J,[e[5]||(e[5]=n("svg",{class:"w-4 h-4 shrink-0",viewBox:"0 0 20 20",fill:"currentColor"},[n("path",{"fill-rule":"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z","clip-rule":"evenodd"})],-1)),f(" "+i(c.value),1)])):m("",!0)]))}});export{Q as default};
|