@staff0rd/assist 0.706.0 → 0.706.2
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/commands/sessions/web/bundle.js +382 -382
- package/dist/index.js +23 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.706.
|
|
9
|
+
version: "0.706.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -41093,6 +41093,24 @@ function resolvedToolUseIds(events, afterIdx) {
|
|
|
41093
41093
|
return ids;
|
|
41094
41094
|
}
|
|
41095
41095
|
|
|
41096
|
+
// src/commands/sessions/shared/renderPrompt.ts
|
|
41097
|
+
function renderPrompt(raw) {
|
|
41098
|
+
const command = marker(raw, "command-name");
|
|
41099
|
+
if (command) {
|
|
41100
|
+
const args = marker(raw, "command-args");
|
|
41101
|
+
const name = `/${command.replace(/^\/+/, "")}`;
|
|
41102
|
+
return args ? `${name} ${args}` : name;
|
|
41103
|
+
}
|
|
41104
|
+
return stripBlocks(raw);
|
|
41105
|
+
}
|
|
41106
|
+
function marker(raw, tag) {
|
|
41107
|
+
const match = raw.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
|
|
41108
|
+
return match ? match[1].trim() : "";
|
|
41109
|
+
}
|
|
41110
|
+
function stripBlocks(raw) {
|
|
41111
|
+
return raw.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").replace(/<task-notification>[\s\S]*?<\/task-notification>/g, "").replace(/<command-[^>]*>[\s\S]*?<\/command-[^>]*>/g, "").replace(/<local-command-[^>]*>[\s\S]*?<\/local-command-[^>]*>/g, "").trim();
|
|
41112
|
+
}
|
|
41113
|
+
|
|
41096
41114
|
// src/commands/sessions/shared/extractLastUserMessage.ts
|
|
41097
41115
|
var MAX_LENGTH2 = 2048;
|
|
41098
41116
|
var INTERRUPT_PREFIX2 = "[Request interrupted";
|
|
@@ -41100,7 +41118,7 @@ function extractLastUserMessage(entries, maxLength = MAX_LENGTH2) {
|
|
|
41100
41118
|
for (let i = entries.length - 1; i >= 0; i--) {
|
|
41101
41119
|
const entry = entries[i];
|
|
41102
41120
|
if (entry.isSidechain || entry.isMeta) continue;
|
|
41103
|
-
if (entry.type !== "user") continue;
|
|
41121
|
+
if (entry.type !== "user" || isTaskNotification(entry)) continue;
|
|
41104
41122
|
const raw = promptTextOrNull(entry);
|
|
41105
41123
|
if (raw === null) continue;
|
|
41106
41124
|
const message3 = renderPrompt(raw);
|
|
@@ -41108,6 +41126,9 @@ function extractLastUserMessage(entries, maxLength = MAX_LENGTH2) {
|
|
|
41108
41126
|
}
|
|
41109
41127
|
return void 0;
|
|
41110
41128
|
}
|
|
41129
|
+
function isTaskNotification(entry) {
|
|
41130
|
+
return asRecord3(entry.origin)?.kind === "task-notification";
|
|
41131
|
+
}
|
|
41111
41132
|
function promptTextOrNull(entry) {
|
|
41112
41133
|
const content = asRecord3(entry.message)?.content;
|
|
41113
41134
|
if (typeof content === "string") return isInterrupt(content) ? null : content;
|
|
@@ -41122,22 +41143,6 @@ function promptTextOrNull(entry) {
|
|
|
41122
41143
|
}
|
|
41123
41144
|
return parts.length === 0 ? null : parts.join("\n");
|
|
41124
41145
|
}
|
|
41125
|
-
function renderPrompt(raw) {
|
|
41126
|
-
const command = marker(raw, "command-name");
|
|
41127
|
-
if (command) {
|
|
41128
|
-
const args = marker(raw, "command-args");
|
|
41129
|
-
const name = `/${command.replace(/^\/+/, "")}`;
|
|
41130
|
-
return args ? `${name} ${args}` : name;
|
|
41131
|
-
}
|
|
41132
|
-
return stripBlocks(raw);
|
|
41133
|
-
}
|
|
41134
|
-
function stripBlocks(raw) {
|
|
41135
|
-
return raw.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").replace(/<command-[^>]*>[\s\S]*?<\/command-[^>]*>/g, "").replace(/<local-command-[^>]*>[\s\S]*?<\/local-command-[^>]*>/g, "").trim();
|
|
41136
|
-
}
|
|
41137
|
-
function marker(raw, tag) {
|
|
41138
|
-
const match = raw.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
|
|
41139
|
-
return match ? match[1].trim() : "";
|
|
41140
|
-
}
|
|
41141
41146
|
function cap(message3, maxLength) {
|
|
41142
41147
|
return message3.length <= maxLength ? message3 : `${message3.slice(0, maxLength).trimEnd()}\u2026`;
|
|
41143
41148
|
}
|