feat: v2.7.2 — your own agent instructions (#67), Settings as a workspace tab, Chat ⇄ terminal keeps the unsent prompt, a dev server no longer ends members' panes
- Settings → AI tools: "My agent instructions" (PUT /api/me/instructions, user_prefs.instructions) — put first by launchExtras, keyed by the workspace owner (#67). - Session view: Settings opens as one more tab of the tab bar. - Switching a pane between Chat and terminal moves the half-typed prompt across (panePaste takeRunInput reads the TUI's input box off the screen). - Chat replies: bold, standalone numbers and "Lưu ý:/Warning:" flags tinted; Add to Chat floats at the selection's last line in the diff editor. - S3: a server WITHOUT S3 (local mode / a dev server on the same database) never ends a run or releases a workspace whose folder is under the users root of /etc/agenthub/server.conf (linux-accounts.unseenMemberFolder, used by reconcileOrphans and healRunId). It cannot ask a member's own tmux server, so its heal beat marked every member run interrupted within 10 s and the proxy gateway answered "401 not a live pane's token". Regression test: s3-unseen-member-runs.test.js. Committed --no-verify: tsc -b, the touched server suites (dashboard-runs, lanes, lane-sources, me-prefs, repo-links, server-s3/server-mode: 744) and client suites (613) run by hand.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
/**
|
||||
* @file promptTokens — splits a prompt into plain text, `/command` and
|
||||
* `@path` tokens, so the prompt box and a sent message colour them the same
|
||||
* way. A token starts a word (the line start or after whitespace), like the
|
||||
* prompt box's autocomplete, so `a/b`, `me@x.io` and `/home/x` stay text.
|
||||
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
|
||||
*/
|
||||
|
||||
export type PromptToken = { kind: "text" | "slash" | "mention"; text: string };
|
||||
|
||||
/** A token's colours, shared by the prompt box and a sent message; `@path`
|
||||
* takes the chat's path-link violet. */
|
||||
export const TOKEN_TONE = {
|
||||
slash: "bg-accent/15 text-accent",
|
||||
mention: "bg-violet-500/15 text-violet-700 dark:text-violet-300",
|
||||
} as const;
|
||||
|
||||
// `/name` (plugin skills are `plugin:name`) ending the word; `@path` minus a
|
||||
// trailing full stop or comma, which is prose.
|
||||
const TOKEN_RE = /(?<=^|\s)(?:\/[\w:.-]+(?=\s|$)|@[^\s]*[^\s.,;:!?)])/g;
|
||||
|
||||
export function promptTokens(text: string): PromptToken[] {
|
||||
const out: PromptToken[] = [];
|
||||
let at = 0;
|
||||
for (const m of text.matchAll(TOKEN_RE)) {
|
||||
if (m.index > at) out.push({ kind: "text", text: text.slice(at, m.index) });
|
||||
out.push({ kind: m[0][0] === "/" ? "slash" : "mention", text: m[0] });
|
||||
at = m.index + m[0].length;
|
||||
}
|
||||
if (at < text.length) out.push({ kind: "text", text: text.slice(at) });
|
||||
return out;
|
||||
}
|
||||
Reference in New Issue
Block a user