@hasna/assistants 0.6.17 → 0.6.19
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/index.js +227 -22
- package/dist/index.js.map +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38775,6 +38775,10 @@ class SchedulerTool {
|
|
|
38775
38775
|
type: "string",
|
|
38776
38776
|
description: "Optional description for this schedule"
|
|
38777
38777
|
},
|
|
38778
|
+
sessionId: {
|
|
38779
|
+
type: "string",
|
|
38780
|
+
description: "Session id to scope the schedule to"
|
|
38781
|
+
},
|
|
38778
38782
|
id: {
|
|
38779
38783
|
type: "string",
|
|
38780
38784
|
description: "Schedule id (for delete/pause/resume)"
|
|
@@ -38819,6 +38823,7 @@ class SchedulerTool {
|
|
|
38819
38823
|
createdAt: now2,
|
|
38820
38824
|
updatedAt: now2,
|
|
38821
38825
|
createdBy: "agent",
|
|
38826
|
+
sessionId: typeof input.sessionId === "string" ? input.sessionId : undefined,
|
|
38822
38827
|
command,
|
|
38823
38828
|
description: input.description,
|
|
38824
38829
|
status: "active",
|
|
@@ -40862,6 +40867,7 @@ Keep it concise but comprehensive.`
|
|
|
40862
40867
|
createdAt: now2,
|
|
40863
40868
|
updatedAt: now2,
|
|
40864
40869
|
createdBy: "user",
|
|
40870
|
+
sessionId: context.sessionId,
|
|
40865
40871
|
command,
|
|
40866
40872
|
status: "active",
|
|
40867
40873
|
schedule: {
|
|
@@ -43036,6 +43042,12 @@ class AgentLoop {
|
|
|
43036
43042
|
toolCall.input.cwd = this.cwd;
|
|
43037
43043
|
}
|
|
43038
43044
|
}
|
|
43045
|
+
if (toolCall.name === "schedule") {
|
|
43046
|
+
const input = toolCall.input;
|
|
43047
|
+
if (input.sessionId === undefined) {
|
|
43048
|
+
input.sessionId = this.sessionId;
|
|
43049
|
+
}
|
|
43050
|
+
}
|
|
43039
43051
|
if (preHookResult?.continue === false || preHookResult?.permissionDecision === "deny") {
|
|
43040
43052
|
const blockedResult = {
|
|
43041
43053
|
toolCallId: toolCall.id,
|
|
@@ -43461,6 +43473,9 @@ ${effects.message}
|
|
|
43461
43473
|
const now2 = Date.now();
|
|
43462
43474
|
const due = await getDueSchedules(this.cwd, now2);
|
|
43463
43475
|
for (const schedule of due) {
|
|
43476
|
+
if (schedule.sessionId && schedule.sessionId !== this.sessionId) {
|
|
43477
|
+
continue;
|
|
43478
|
+
}
|
|
43464
43479
|
const locked = await acquireScheduleLock(this.cwd, schedule.id, this.sessionId);
|
|
43465
43480
|
if (!locked)
|
|
43466
43481
|
continue;
|
|
@@ -43490,7 +43505,7 @@ ${effects.message}
|
|
|
43490
43505
|
if (!schedule)
|
|
43491
43506
|
break;
|
|
43492
43507
|
const current = await readSchedule(this.cwd, schedule.id);
|
|
43493
|
-
if (!current || current.status !== "active" || !current.nextRunAt || current.nextRunAt > Date.now()) {
|
|
43508
|
+
if (!current || current.status !== "active" || !current.nextRunAt || current.nextRunAt > Date.now() || current.sessionId && current.sessionId !== this.sessionId) {
|
|
43494
43509
|
await releaseScheduleLock(this.cwd, schedule.id, this.sessionId);
|
|
43495
43510
|
continue;
|
|
43496
43511
|
}
|
|
@@ -44513,15 +44528,23 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
|
|
|
44513
44528
|
}, [value, autocompleteMode, skills]);
|
|
44514
44529
|
const autocompleteItems = autocompleteMode === "skill" ? filteredSkills : filteredCommands;
|
|
44515
44530
|
use_input_default((input, key) => {
|
|
44516
|
-
if (key.tab
|
|
44517
|
-
|
|
44518
|
-
|
|
44519
|
-
|
|
44520
|
-
|
|
44521
|
-
|
|
44531
|
+
if (key.tab) {
|
|
44532
|
+
if (autocompleteItems.length > 0) {
|
|
44533
|
+
const selected = autocompleteItems[selectedIndex] || autocompleteItems[0];
|
|
44534
|
+
if (autocompleteMode === "skill") {
|
|
44535
|
+
setValue("$" + selected.name + " ");
|
|
44536
|
+
} else {
|
|
44537
|
+
setValue(selected.name + " ");
|
|
44538
|
+
}
|
|
44539
|
+
setSelectedIndex(0);
|
|
44540
|
+
return;
|
|
44541
|
+
}
|
|
44542
|
+
if (value.trim()) {
|
|
44543
|
+
onSubmit(value, "queue");
|
|
44544
|
+
setValue("");
|
|
44545
|
+
setSelectedIndex(0);
|
|
44546
|
+
return;
|
|
44522
44547
|
}
|
|
44523
|
-
setSelectedIndex(0);
|
|
44524
|
-
return;
|
|
44525
44548
|
}
|
|
44526
44549
|
if (autocompleteItems.length > 0) {
|
|
44527
44550
|
if (key.downArrow) {
|
|
@@ -44555,18 +44578,14 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
|
|
|
44555
44578
|
if (autocompleteMode === "command" && filteredCommands.length > 0 && !submittedValue.includes(" ")) {
|
|
44556
44579
|
const selected = filteredCommands[selectedIndex] || filteredCommands[0];
|
|
44557
44580
|
if (selected) {
|
|
44558
|
-
|
|
44559
|
-
onSubmit(selected.name, "queue");
|
|
44560
|
-
} else {
|
|
44561
|
-
onSubmit(selected.name, "normal");
|
|
44562
|
-
}
|
|
44581
|
+
onSubmit(selected.name, isProcessing ? "interrupt" : "normal");
|
|
44563
44582
|
setValue("");
|
|
44564
44583
|
setSelectedIndex(0);
|
|
44565
44584
|
return;
|
|
44566
44585
|
}
|
|
44567
44586
|
}
|
|
44568
44587
|
if (isProcessing) {
|
|
44569
|
-
onSubmit(submittedValue, "
|
|
44588
|
+
onSubmit(submittedValue, "interrupt");
|
|
44570
44589
|
} else {
|
|
44571
44590
|
onSubmit(submittedValue, "normal");
|
|
44572
44591
|
}
|
|
@@ -44577,7 +44596,7 @@ function Input({ onSubmit, isProcessing, queueLength = 0, commands, skills = []
|
|
|
44577
44596
|
let placeholder = "Type a message...";
|
|
44578
44597
|
if (isProcessing) {
|
|
44579
44598
|
prompt = "\u22EF";
|
|
44580
|
-
placeholder = queueLength > 0 ? "Type to queue
|
|
44599
|
+
placeholder = queueLength > 0 ? "Type to interrupt (Enter) or queue (Tab)..." : "Type to interrupt (Enter) or queue (Tab)...";
|
|
44581
44600
|
}
|
|
44582
44601
|
const truncateDescription = (desc, maxLen = 60) => {
|
|
44583
44602
|
if (desc.length <= maxLen)
|
|
@@ -45618,7 +45637,6 @@ function MessageBubble({ message, queuedMessageIds }) {
|
|
|
45618
45637
|
]
|
|
45619
45638
|
}, undefined, true, undefined, this),
|
|
45620
45639
|
toolCalls.length > 0 && /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(Box_default, {
|
|
45621
|
-
marginLeft: hasContent ? 2 : 0,
|
|
45622
45640
|
marginTop: hasContent ? 1 : 0,
|
|
45623
45641
|
children: /* @__PURE__ */ jsx_dev_runtime3.jsxDEV(ToolCallPanel, {
|
|
45624
45642
|
toolCalls,
|
|
@@ -45734,7 +45752,24 @@ function getToolContext(toolCall) {
|
|
|
45734
45752
|
return truncate(String(input.pattern || ""), 20);
|
|
45735
45753
|
case "grep":
|
|
45736
45754
|
return truncate(String(input.pattern || ""), 20);
|
|
45755
|
+
case "schedule":
|
|
45756
|
+
return String(input.action || "");
|
|
45757
|
+
case "feedback":
|
|
45758
|
+
return String(input.type || "feedback");
|
|
45759
|
+
case "web_search":
|
|
45760
|
+
return truncate(String(input.query || ""), 20);
|
|
45761
|
+
case "web_fetch":
|
|
45762
|
+
case "curl":
|
|
45763
|
+
const url = String(input.url || "");
|
|
45764
|
+
try {
|
|
45765
|
+
return new URL(url).hostname;
|
|
45766
|
+
} catch {
|
|
45767
|
+
return truncate(url, 20);
|
|
45768
|
+
}
|
|
45737
45769
|
default:
|
|
45770
|
+
const action = input.action || input.command || input.operation;
|
|
45771
|
+
if (action)
|
|
45772
|
+
return truncate(String(action), 20);
|
|
45738
45773
|
return "";
|
|
45739
45774
|
}
|
|
45740
45775
|
}
|
|
@@ -45758,6 +45793,10 @@ function getToolDisplayName(toolCall) {
|
|
|
45758
45793
|
return "grep";
|
|
45759
45794
|
case "display_image":
|
|
45760
45795
|
return "image";
|
|
45796
|
+
case "schedule":
|
|
45797
|
+
return "schedule";
|
|
45798
|
+
case "feedback":
|
|
45799
|
+
return "feedback";
|
|
45761
45800
|
case "notion":
|
|
45762
45801
|
case "gmail":
|
|
45763
45802
|
case "googledrive":
|
|
@@ -45788,6 +45827,10 @@ function formatToolCall(toolCall) {
|
|
|
45788
45827
|
return `Finding: ${truncate(String(input.pattern || ""), 60)}`;
|
|
45789
45828
|
case "grep":
|
|
45790
45829
|
return `Searching: ${truncate(String(input.pattern || ""), 60)}`;
|
|
45830
|
+
case "schedule":
|
|
45831
|
+
return formatScheduleCall(input);
|
|
45832
|
+
case "feedback":
|
|
45833
|
+
return formatFeedbackCall(input);
|
|
45791
45834
|
case "notion":
|
|
45792
45835
|
return `Notion: ${truncate(String(input.command || input.action || ""), 60)}`;
|
|
45793
45836
|
case "gmail":
|
|
@@ -45801,9 +45844,44 @@ function formatToolCall(toolCall) {
|
|
|
45801
45844
|
case "slack":
|
|
45802
45845
|
return `Slack: ${truncate(String(input.command || input.action || ""), 60)}`;
|
|
45803
45846
|
default:
|
|
45804
|
-
|
|
45847
|
+
if (name.startsWith("connect_") || name.includes("_")) {
|
|
45848
|
+
const action = String(input.command || input.action || input.operation || "");
|
|
45849
|
+
if (action) {
|
|
45850
|
+
return `${formatToolDisplayName(name)}: ${truncate(action, 50)}`;
|
|
45851
|
+
}
|
|
45852
|
+
}
|
|
45853
|
+
return `${formatToolDisplayName(name)}: ${truncate(JSON.stringify(input), 50)}`;
|
|
45854
|
+
}
|
|
45855
|
+
}
|
|
45856
|
+
function formatToolDisplayName(name) {
|
|
45857
|
+
return name.replace(/^connect_/, "").replace(/_/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
|
45858
|
+
}
|
|
45859
|
+
function formatScheduleCall(input) {
|
|
45860
|
+
const action = String(input.action || "");
|
|
45861
|
+
switch (action) {
|
|
45862
|
+
case "list":
|
|
45863
|
+
return "Listing scheduled tasks";
|
|
45864
|
+
case "create":
|
|
45865
|
+
const cmd = truncate(String(input.command || ""), 30);
|
|
45866
|
+
const schedule = String(input.schedule || "");
|
|
45867
|
+
return `Creating schedule: "${cmd}" (${schedule})`;
|
|
45868
|
+
case "update":
|
|
45869
|
+
return `Updating schedule: ${input.id || "unknown"}`;
|
|
45870
|
+
case "delete":
|
|
45871
|
+
return `Deleting schedule: ${input.id || "unknown"}`;
|
|
45872
|
+
case "pause":
|
|
45873
|
+
return `Pausing schedule: ${input.id || "unknown"}`;
|
|
45874
|
+
case "resume":
|
|
45875
|
+
return `Resuming schedule: ${input.id || "unknown"}`;
|
|
45876
|
+
default:
|
|
45877
|
+
return `Schedule: ${action || "unknown action"}`;
|
|
45805
45878
|
}
|
|
45806
45879
|
}
|
|
45880
|
+
function formatFeedbackCall(input) {
|
|
45881
|
+
const type = String(input.type || "feedback");
|
|
45882
|
+
const title = truncate(String(input.title || ""), 40);
|
|
45883
|
+
return `Submitting ${type}: ${title}`;
|
|
45884
|
+
}
|
|
45807
45885
|
function truncate(text, maxLength) {
|
|
45808
45886
|
if (text.length <= maxLength)
|
|
45809
45887
|
return text;
|
|
@@ -45811,8 +45889,12 @@ function truncate(text, maxLength) {
|
|
|
45811
45889
|
}
|
|
45812
45890
|
function truncateToolResult(toolResult, maxLines = 15, maxChars = 3000) {
|
|
45813
45891
|
const toolName = toolResult.toolName || "tool";
|
|
45814
|
-
const prefix = toolResult.isError ? `Error from ${toolName}: ` : `${toolName}: `;
|
|
45815
45892
|
let content = String(toolResult.content || "");
|
|
45893
|
+
const formatted = formatToolResultNicely(toolName, content, toolResult.isError);
|
|
45894
|
+
if (formatted) {
|
|
45895
|
+
return formatted;
|
|
45896
|
+
}
|
|
45897
|
+
const prefix = toolResult.isError ? `Error: ` : "";
|
|
45816
45898
|
content = content.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, "");
|
|
45817
45899
|
content = content.replace(/\t/g, " ");
|
|
45818
45900
|
const lines = content.split(`
|
|
@@ -45827,6 +45909,129 @@ function truncateToolResult(toolResult, maxLines = 15, maxChars = 3000) {
|
|
|
45827
45909
|
}
|
|
45828
45910
|
return prefix + content.trim();
|
|
45829
45911
|
}
|
|
45912
|
+
function formatToolResultNicely(toolName, content, isError) {
|
|
45913
|
+
if (isError) {
|
|
45914
|
+
if (content.includes("ENOENT") || content.includes("no such file")) {
|
|
45915
|
+
return "\u26A0 File not found";
|
|
45916
|
+
}
|
|
45917
|
+
if (content.includes("EACCES") || content.includes("permission denied")) {
|
|
45918
|
+
return "\u26A0 Permission denied";
|
|
45919
|
+
}
|
|
45920
|
+
if (content.includes("ETIMEDOUT") || content.includes("timeout")) {
|
|
45921
|
+
return "\u26A0 Request timed out";
|
|
45922
|
+
}
|
|
45923
|
+
return null;
|
|
45924
|
+
}
|
|
45925
|
+
switch (toolName) {
|
|
45926
|
+
case "schedule":
|
|
45927
|
+
return formatScheduleResult(content);
|
|
45928
|
+
case "feedback":
|
|
45929
|
+
return formatFeedbackResult(content);
|
|
45930
|
+
case "read":
|
|
45931
|
+
return formatReadResult(content);
|
|
45932
|
+
case "write":
|
|
45933
|
+
return formatWriteResult(content);
|
|
45934
|
+
case "glob":
|
|
45935
|
+
return formatGlobResult(content);
|
|
45936
|
+
case "grep":
|
|
45937
|
+
return formatGrepResult(content);
|
|
45938
|
+
case "bash":
|
|
45939
|
+
return formatBashResult(content);
|
|
45940
|
+
case "web_search":
|
|
45941
|
+
return formatSearchResult(content);
|
|
45942
|
+
default:
|
|
45943
|
+
return null;
|
|
45944
|
+
}
|
|
45945
|
+
}
|
|
45946
|
+
function formatScheduleResult(content) {
|
|
45947
|
+
const trimmed = content.trim().toLowerCase();
|
|
45948
|
+
if (trimmed === "no schedules found." || trimmed.includes("no schedules")) {
|
|
45949
|
+
return "\uD83D\uDCC5 No scheduled tasks";
|
|
45950
|
+
}
|
|
45951
|
+
if (trimmed.includes("created") || trimmed.includes("scheduled")) {
|
|
45952
|
+
return "\u2713 Schedule created";
|
|
45953
|
+
}
|
|
45954
|
+
if (trimmed.includes("deleted") || trimmed.includes("removed")) {
|
|
45955
|
+
return "\u2713 Schedule deleted";
|
|
45956
|
+
}
|
|
45957
|
+
if (trimmed.includes("paused")) {
|
|
45958
|
+
return "\u23F8 Schedule paused";
|
|
45959
|
+
}
|
|
45960
|
+
if (trimmed.includes("resumed")) {
|
|
45961
|
+
return "\u25B6 Schedule resumed";
|
|
45962
|
+
}
|
|
45963
|
+
if (content.includes("id:") || content.includes("command:")) {
|
|
45964
|
+
const lines = content.split(`
|
|
45965
|
+
`).filter((l) => l.trim());
|
|
45966
|
+
return `\uD83D\uDCC5 ${lines.length} scheduled task${lines.length !== 1 ? "s" : ""}`;
|
|
45967
|
+
}
|
|
45968
|
+
return null;
|
|
45969
|
+
}
|
|
45970
|
+
function formatFeedbackResult(content) {
|
|
45971
|
+
if (content.includes("submitted") || content.includes("created")) {
|
|
45972
|
+
return "\u2713 Feedback submitted";
|
|
45973
|
+
}
|
|
45974
|
+
return null;
|
|
45975
|
+
}
|
|
45976
|
+
function formatReadResult(content) {
|
|
45977
|
+
const lines = content.split(`
|
|
45978
|
+
`).length;
|
|
45979
|
+
if (lines > 20) {
|
|
45980
|
+
return `\uD83D\uDCC4 Read ${lines} lines`;
|
|
45981
|
+
}
|
|
45982
|
+
return null;
|
|
45983
|
+
}
|
|
45984
|
+
function formatWriteResult(content) {
|
|
45985
|
+
if (content.includes("written") || content.includes("saved") || content.includes("created")) {
|
|
45986
|
+
return "\u2713 File saved";
|
|
45987
|
+
}
|
|
45988
|
+
return null;
|
|
45989
|
+
}
|
|
45990
|
+
function formatGlobResult(content) {
|
|
45991
|
+
const lines = content.split(`
|
|
45992
|
+
`).filter((l) => l.trim());
|
|
45993
|
+
if (lines.length === 0) {
|
|
45994
|
+
return "\uD83D\uDD0D No files found";
|
|
45995
|
+
}
|
|
45996
|
+
if (lines.length > 10) {
|
|
45997
|
+
return `\uD83D\uDD0D Found ${lines.length} files`;
|
|
45998
|
+
}
|
|
45999
|
+
return null;
|
|
46000
|
+
}
|
|
46001
|
+
function formatGrepResult(content) {
|
|
46002
|
+
const lines = content.split(`
|
|
46003
|
+
`).filter((l) => l.trim());
|
|
46004
|
+
if (lines.length === 0) {
|
|
46005
|
+
return "\uD83D\uDD0D No matches found";
|
|
46006
|
+
}
|
|
46007
|
+
if (lines.length > 10) {
|
|
46008
|
+
return `\uD83D\uDD0D Found ${lines.length} matches`;
|
|
46009
|
+
}
|
|
46010
|
+
return null;
|
|
46011
|
+
}
|
|
46012
|
+
function formatBashResult(content) {
|
|
46013
|
+
const trimmed = content.trim();
|
|
46014
|
+
if (!trimmed) {
|
|
46015
|
+
return "\u2713 Command completed";
|
|
46016
|
+
}
|
|
46017
|
+
if (trimmed.length < 100 && !trimmed.includes(`
|
|
46018
|
+
`)) {
|
|
46019
|
+
return null;
|
|
46020
|
+
}
|
|
46021
|
+
const lines = trimmed.split(`
|
|
46022
|
+
`).length;
|
|
46023
|
+
if (lines > 20) {
|
|
46024
|
+
return `\u2713 Output: ${lines} lines`;
|
|
46025
|
+
}
|
|
46026
|
+
return null;
|
|
46027
|
+
}
|
|
46028
|
+
function formatSearchResult(content) {
|
|
46029
|
+
const resultCount = (content.match(/https?:\/\//g) || []).length;
|
|
46030
|
+
if (resultCount > 0) {
|
|
46031
|
+
return `\uD83D\uDD0D Found ${resultCount} result${resultCount !== 1 ? "s" : ""}`;
|
|
46032
|
+
}
|
|
46033
|
+
return null;
|
|
46034
|
+
}
|
|
45830
46035
|
|
|
45831
46036
|
// packages/terminal/src/components/Status.tsx
|
|
45832
46037
|
var import_react25 = __toESM(require_react(), 1);
|
|
@@ -46898,7 +47103,7 @@ function App2({ cwd: cwd2, version }) {
|
|
|
46898
47103
|
setShowSessionSelector(true);
|
|
46899
47104
|
return;
|
|
46900
47105
|
}
|
|
46901
|
-
if (mode === "queue"
|
|
47106
|
+
if (mode === "queue") {
|
|
46902
47107
|
if (!activeSessionId)
|
|
46903
47108
|
return;
|
|
46904
47109
|
const queuedId = generateId();
|
|
@@ -47334,7 +47539,7 @@ function formatStreamEvent(chunk) {
|
|
|
47334
47539
|
|
|
47335
47540
|
// packages/terminal/src/index.tsx
|
|
47336
47541
|
var jsx_dev_runtime11 = __toESM(require_jsx_dev_runtime(), 1);
|
|
47337
|
-
var VERSION3 = "0.6.
|
|
47542
|
+
var VERSION3 = "0.6.19";
|
|
47338
47543
|
function parseArgs(argv) {
|
|
47339
47544
|
const args = argv.slice(2);
|
|
47340
47545
|
const options = {
|
|
@@ -47497,4 +47702,4 @@ if (options.print !== null) {
|
|
|
47497
47702
|
});
|
|
47498
47703
|
}
|
|
47499
47704
|
|
|
47500
|
-
//# debugId=
|
|
47705
|
+
//# debugId=6BDD2D63CEF73C2464756E2164756E21
|