@shunagent/shun 0.1.149 → 0.1.154
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/cli.js +57 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -22,6 +22,9 @@ import { StringDecoder } from "node:string_decoder";
|
|
|
22
22
|
import { createTwoFilesPatch } from "diff";
|
|
23
23
|
import { truncateToWidth, stripTerminalSequences, Markdown, TuiMainScreen, ProcessTerminal, Container, Text, matchesKey, Editor, CombinedAutocompleteProvider, Spacer, SelectList, Input, Image } from "@earendil-works/pi-tui";
|
|
24
24
|
const slashCommands = [
|
|
25
|
+
["assistant", "Open your Shun assistant"],
|
|
26
|
+
["activity", "Browse assistant task history"],
|
|
27
|
+
["memory", "Review assistant memory"],
|
|
25
28
|
["help", "Show available commands"],
|
|
26
29
|
["connect", "Connect a model provider"],
|
|
27
30
|
["providers", "Manage model providers"],
|
|
@@ -92,6 +95,12 @@ function readProductToolPresentation(tool) {
|
|
|
92
95
|
const skill = tool.name === "read" ? skillInstructionName(input.path) : "";
|
|
93
96
|
if (skill) return skillPresentation(failed ? "Skill instructions read failed" : "Read Skill instructions", `${skill} · instructions`);
|
|
94
97
|
switch (tool.name) {
|
|
98
|
+
case "web_history_read":
|
|
99
|
+
return {
|
|
100
|
+
title: failed ? "Earlier source read failed" : tool.state === "running" ? "Reading earlier source" : "Read earlier source",
|
|
101
|
+
detail: "This conversation",
|
|
102
|
+
kind: "web"
|
|
103
|
+
};
|
|
95
104
|
case "github_repo_list":
|
|
96
105
|
return {
|
|
97
106
|
title: failed ? "GitHub repository listing failed" : "Listed GitHub repositories",
|
|
@@ -190,6 +199,8 @@ function readProductToolPresentation(tool) {
|
|
|
190
199
|
return backgroundPresentation(failed ? "Background output read failed" : "Read background output", input.until ? `until ${input.until}` : "");
|
|
191
200
|
case "background_stop":
|
|
192
201
|
return backgroundPresentation(failed ? "Background process stop failed" : "Stopped background process", backgroundTaskTarget(tool.output));
|
|
202
|
+
case "presentation_create":
|
|
203
|
+
return { title: failed ? "Presentation creation failed" : "Created presentation", detail: typeof input.output_path === "string" ? input.output_path.split(/[\\/]/).pop() || "" : "", kind: "skill" };
|
|
193
204
|
case "skill_search":
|
|
194
205
|
return skillPresentation(failed ? "Skill search failed" : "Searched installed Skills", input.query || "installed Skills");
|
|
195
206
|
case "browser_debug":
|
|
@@ -277,6 +288,16 @@ function readProductToolPresentation(tool) {
|
|
|
277
288
|
return { title: failed ? "Plugin tool discovery failed" : "Prepared plugin tools", detail: "", kind: "skill" };
|
|
278
289
|
case "plugin_view_present":
|
|
279
290
|
return { title: failed ? "Plugin view unavailable" : "Opened plugin view", detail: [input.plugin_id, input.view_id].filter(Boolean).join(" · "), kind: "skill" };
|
|
291
|
+
case "memory_search":
|
|
292
|
+
return { title: failed ? "Memory search failed" : "Read memory", detail: String(input.query || input.scope || ""), kind: "skill" };
|
|
293
|
+
case "memory_update":
|
|
294
|
+
return { title: failed ? "Memory update failed" : input.remove ? "Forgot memory" : "Updated memory", detail: "", kind: "skill" };
|
|
295
|
+
case "assistant_task_start":
|
|
296
|
+
return { title: failed ? "Task could not start" : "Started task", detail: String(input.title || ""), kind: "background" };
|
|
297
|
+
case "assistant_task_read":
|
|
298
|
+
return { title: failed ? "Task could not be read" : "Read task activity", detail: "", kind: "background" };
|
|
299
|
+
case "assistant_publish":
|
|
300
|
+
return { title: failed ? "Update could not be delivered" : "Shared assistant update", detail: "", kind: "background" };
|
|
280
301
|
case "schedule_create":
|
|
281
302
|
return schedulePresentation(failed ? "Scheduled task creation failed" : "Created scheduled task", input.name || scheduleTriggerDetail(input));
|
|
282
303
|
case "schedule_list":
|
|
@@ -718,6 +739,7 @@ function capabilityPrompt(activeTools, context = {}) {
|
|
|
718
739
|
if (activeTools.includes("edit")) {
|
|
719
740
|
lines.push("Edit file is a one-shot atomic batch boundary. For one coherent requested change to one file, send all independent replacements together in one edits[] call. Do not split the file into sequential edit batches or run shell commands merely to count which replacements remain. Already-present replacements and ordinary whitespace-only drift are handled by the tool.");
|
|
720
741
|
}
|
|
742
|
+
if (activeTools.includes("attachment_save")) lines.push("Use attachment_save to copy an uploaded attachment into a project as original bytes, preserving its format and transparency. Read or transform that saved project file normally.");
|
|
721
743
|
if (activeTools.includes("attachment_read")) {
|
|
722
744
|
lines.push("Files uploaded to this task are task-owned attachments, not workspace files, and their original source paths are deliberately unavailable. Discover their stable IDs with attachment_list and read them by ID with attachment_read. An image arrives whole and already at the resolution this session is shown, so when something inside it is too small to read — print on a label, a price tag, a dense table — read that part of it with region=[x, y, width, height], four fractions of the image from the top-left corner, instead of going after the file. That region read is the enlarged view, and it is the only one this session has. Never locate an upload with workspace read, bash, find, or filename search.");
|
|
723
745
|
}
|
|
@@ -2041,6 +2063,8 @@ function pythonImportModules(content) {
|
|
|
2041
2063
|
}
|
|
2042
2064
|
const pythonDistributionAliases = {
|
|
2043
2065
|
PIL: "Pillow",
|
|
2066
|
+
pptx: "python-pptx",
|
|
2067
|
+
docx: "python-docx",
|
|
2044
2068
|
Crypto: "pycryptodome",
|
|
2045
2069
|
bs4: "beautifulsoup4",
|
|
2046
2070
|
cv2: "opencv-python",
|
|
@@ -2803,7 +2827,7 @@ async function generateTaskTitle(request2, signal, images = []) {
|
|
|
2803
2827
|
}
|
|
2804
2828
|
}
|
|
2805
2829
|
function recentConversations(tasks) {
|
|
2806
|
-
return tasks.filter((task) => !task.archivedAt).sort((a, b) => (b.lastActivityAt ?? b.updatedAt) - (a.lastActivityAt ?? a.updatedAt) || (b.createdAt || 0) - (a.createdAt || 0) || a.id.localeCompare(b.id));
|
|
2830
|
+
return tasks.filter((task) => !task.archivedAt && task.purpose !== "background").sort((a, b) => (b.lastActivityAt ?? b.updatedAt) - (a.lastActivityAt ?? a.updatedAt) || (b.createdAt || 0) - (a.createdAt || 0) || a.id.localeCompare(b.id));
|
|
2807
2831
|
}
|
|
2808
2832
|
const keys = ["providers", "providerId", "model", "endpoint", "apiKey", "contextWindow", "maxTokens"];
|
|
2809
2833
|
function providerSettings(settings) {
|
|
@@ -3093,6 +3117,13 @@ class AttachmentStore {
|
|
|
3093
3117
|
if (bytes.length !== metadata.size || createHash("sha256").update(bytes).digest("hex") !== metadata.sha256) throw Error("Attachment content failed its integrity check.");
|
|
3094
3118
|
return { metadata, bytes };
|
|
3095
3119
|
}
|
|
3120
|
+
async save(taskId, attachmentId, destination) {
|
|
3121
|
+
const { metadata, bytes } = await this.read(taskId, attachmentId);
|
|
3122
|
+
const path = resolve(destination);
|
|
3123
|
+
await mkdir(dirname(path), { recursive: true });
|
|
3124
|
+
await writeFile(path, bytes, { flag: "wx" });
|
|
3125
|
+
return { path, size: metadata.size, sha256: metadata.sha256 };
|
|
3126
|
+
}
|
|
3096
3127
|
/** What an attachment says about itself, without reading its content. */
|
|
3097
3128
|
async describe(taskId, attachmentId) {
|
|
3098
3129
|
let metadata;
|
|
@@ -7190,6 +7221,10 @@ class ShunHostService {
|
|
|
7190
7221
|
async call(method, input = {}) {
|
|
7191
7222
|
const desktop = this.desktop;
|
|
7192
7223
|
const sharedDesktop = Boolean(desktop);
|
|
7224
|
+
if (["assistant.open", "assistant.overview", "assistant.memory.update"].includes(method)) {
|
|
7225
|
+
if (!desktop) throw Error("Open Shun Desktop to use your personal assistant. Your ordinary terminal tasks remain available.");
|
|
7226
|
+
return desktop(`conversation.${method}`, input);
|
|
7227
|
+
}
|
|
7193
7228
|
if (sharedDesktop && method === "task.list" && !input.localOnly) {
|
|
7194
7229
|
const local = await this.dispatch(method, input);
|
|
7195
7230
|
const remote = await desktop("conversation.task.list").catch(() => []);
|
|
@@ -7758,7 +7793,7 @@ const clean$1 = (text2) => stripTerminalSequences(text2).replace(/[\x00-\x1f\x7f
|
|
|
7758
7793
|
const accent = (text2) => `\x1B[38;5;205m${text2}\x1B[0m`;
|
|
7759
7794
|
const muted = (text2) => `\x1B[2m${text2}\x1B[0m`;
|
|
7760
7795
|
const bold = (text2) => `\x1B[1m${text2}\x1B[0m`;
|
|
7761
|
-
const version$1 = "0.1.
|
|
7796
|
+
const version$1 = "0.1.154";
|
|
7762
7797
|
class WelcomeHeader {
|
|
7763
7798
|
state = { title: "", model: "", workspace: "", running: false, compact: false, ready: false };
|
|
7764
7799
|
update(state) {
|
|
@@ -8414,6 +8449,25 @@ async function runTui(call, options = {}) {
|
|
|
8414
8449
|
await configureModel(snapshot?.task.id);
|
|
8415
8450
|
return;
|
|
8416
8451
|
}
|
|
8452
|
+
if (name === "/activity" || name === "/memory") {
|
|
8453
|
+
const overview = await call("assistant.overview");
|
|
8454
|
+
if (name === "/activity") {
|
|
8455
|
+
if (!overview.runs.length) {
|
|
8456
|
+
notice("No assistant activity yet.");
|
|
8457
|
+
return;
|
|
8458
|
+
}
|
|
8459
|
+
const id = await choose("Assistant activity", overview.runs.map((run2) => ({ value: run2.id, label: run2.title, description: run2.status })));
|
|
8460
|
+
await selectTask(id);
|
|
8461
|
+
} else {
|
|
8462
|
+
notice(overview.memories.length ? overview.memories.map((memory) => `• ${memory.text}`).join("\n") : "No saved memories. Ask Shun to remember something.");
|
|
8463
|
+
}
|
|
8464
|
+
return;
|
|
8465
|
+
}
|
|
8466
|
+
if (name === "/assistant") {
|
|
8467
|
+
const task = await call("assistant.open");
|
|
8468
|
+
await selectTask(task.id);
|
|
8469
|
+
return;
|
|
8470
|
+
}
|
|
8417
8471
|
if (name === "/new" || name === "/clear") {
|
|
8418
8472
|
const workspace = argument === "--no-workspace" ? "" : argument ? resolve(argument) : snapshot?.task.workspace ?? options.workspace ?? "";
|
|
8419
8473
|
const task = await call("task.create", { workspace });
|
|
@@ -8757,7 +8811,7 @@ ${activeRun ? "Task continues running in Shun.\n" : ""}Resume this conversation:
|
|
|
8757
8811
|
process.off("SIGTERM", onSignal);
|
|
8758
8812
|
process.off("SIGINT", onSignal);
|
|
8759
8813
|
}
|
|
8760
|
-
const version = "0.1.
|
|
8814
|
+
const version = "0.1.154";
|
|
8761
8815
|
const args = process.argv.slice(2);
|
|
8762
8816
|
async function main() {
|
|
8763
8817
|
if (args.includes("--version") || args.includes("-v")) {
|
package/package.json
CHANGED