@restregular/dsh-powerup 0.19.7 → 0.19.9
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/README.md +1 -1
- package/client.js +60 -14
- package/index.js +143 -13
- package/lib/quick-replies.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -123,7 +123,7 @@ of tappable options for the current session:
|
|
|
123
123
|
] }
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
Up to 8 options appear as
|
|
126
|
+
Up to 8 options appear as stacked buttons above the copy/like actions of the last assistant message. Tapping one sends its
|
|
127
127
|
`message` as a normal user message. The options disappear as soon as the user
|
|
128
128
|
sends any message — tapping an option, pressing Enter, or clicking the host's
|
|
129
129
|
Send button. The Agent can also pass an empty `options` array to clear them
|
package/client.js
CHANGED
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
const requirementCreateDraft = { workspaceId: null, title: '', text: '', scope: 'current' };
|
|
86
86
|
/** Fallback bucket when the hero cannot resolve an owning workspace yet. */
|
|
87
87
|
const UNSCOPED_WORKSPACE = '__unscoped__';
|
|
88
|
-
const VERSION = '0.19.
|
|
88
|
+
const VERSION = '0.19.9';
|
|
89
89
|
const MENU_GAP = 8;
|
|
90
90
|
const MENU_WIDTH = 248;
|
|
91
91
|
/** Reference scheme understood by the Host's `powerup_step_read` tool. */
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
'page.dualSendHow': '启用后输入框里会出现两个按钮,鼠标悬停可看到各自说明;输入文字后按 Enter 排队发送,按 Ctrl+Shift+Enter 立即插话发送。',
|
|
146
146
|
'page.quickRepliesTitle': '快捷回复选项',
|
|
147
147
|
'page.quickRepliesDesc': '允许 Agent 在回复后提供一组带文本的按钮选项。点击选项会立即把对应文本作为新消息发送,用户发出任意新消息(包括点击选项)后,这些选项会自动移除。',
|
|
148
|
-
'page.quickRepliesHow': 'Agent 通过 powerup_quick_replies
|
|
148
|
+
'page.quickRepliesHow': 'Agent 通过 powerup_quick_replies 工具发布选项;选项竖向排列在最后一条助手消息的复制/点赞按钮上方,点击即可快速回复。',
|
|
149
149
|
'quickReplies.title': '快捷回复',
|
|
150
150
|
'quickReplies.hint': '选择一个选项快速发送',
|
|
151
151
|
'mask.tab': '内容屏蔽',
|
|
@@ -775,7 +775,7 @@
|
|
|
775
775
|
'page.taskProgressCooldownHint': 'Minimum gap between refreshes to avoid accidental clicks; 0 disables the limit.',
|
|
776
776
|
'page.quickRepliesTitle': 'Quick reply options',
|
|
777
777
|
'page.quickRepliesDesc': 'Let the Agent offer a short list of text buttons after its reply. Tapping one sends its text as a new message immediately; the options are removed automatically once the user sends any message (including tapping an option).',
|
|
778
|
-
'page.quickRepliesHow': 'The Agent publishes options through the powerup_quick_replies tool; they
|
|
778
|
+
'page.quickRepliesHow': 'The Agent publishes options through the powerup_quick_replies tool; they stack vertically above the copy/like buttons of the last assistant message.',
|
|
779
779
|
'quickReplies.title': 'Quick replies',
|
|
780
780
|
'quickReplies.hint': 'Pick an option to send it right away',
|
|
781
781
|
'progress.title': 'Task progress',
|
|
@@ -1014,6 +1014,9 @@
|
|
|
1014
1014
|
} catch {
|
|
1015
1015
|
/* The in-memory value still works for this page. */
|
|
1016
1016
|
}
|
|
1017
|
+
if (Object.prototype.hasOwnProperty.call(patch, 'quickReplies')) {
|
|
1018
|
+
syncQuickRepliesEnabled(settingsValue.quickReplies);
|
|
1019
|
+
}
|
|
1017
1020
|
for (const listener of [...settingsListeners]) {
|
|
1018
1021
|
try {
|
|
1019
1022
|
listener();
|
|
@@ -4457,11 +4460,12 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
4457
4460
|
`;
|
|
4458
4461
|
|
|
4459
4462
|
const QUICK_REPLIES_CSS = `
|
|
4460
|
-
/* Quick-reply options rendered
|
|
4461
|
-
.dsh-powerup-quick-replies{display:
|
|
4462
|
-
.dsh-powerup-quick-replies
|
|
4463
|
-
.dsh-powerup-quick-
|
|
4464
|
-
.dsh-powerup-quick-reply:
|
|
4463
|
+
/* Quick-reply options rendered above the assistant message's action row. */
|
|
4464
|
+
.dsh-powerup-quick-replies-mount{display:block;width:100%}
|
|
4465
|
+
.dsh-powerup-quick-replies{display:flex;flex-direction:column;align-items:flex-start;gap:6px;padding:4px 0 8px;max-width:100%}
|
|
4466
|
+
.dsh-powerup-quick-replies-label{font-size:11px;line-height:16px;color:var(--dsw-alias-label-caption)}
|
|
4467
|
+
.dsh-powerup-quick-reply{display:block;max-width:100%;padding:6px 12px;border:.5px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-brand-primary,var(--dsw-alias-label-primary));font:inherit;font-size:12px;line-height:18px;text-align:left;white-space:normal;overflow-wrap:anywhere;cursor:pointer;transition:background .12s ease,border-color .12s ease,transform .12s ease}
|
|
4468
|
+
.dsh-powerup-quick-reply:hover{background:var(--dsw-alias-interactive-bg-hover);border-color:var(--dsw-alias-brand-primary,var(--dsw-alias-border-l3));transform:translateX(2px)}
|
|
4465
4469
|
.dsh-powerup-quick-reply:disabled{opacity:.5;cursor:not-allowed;transform:none}
|
|
4466
4470
|
.dsh-powerup-quick-reply:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
|
|
4467
4471
|
`;
|
|
@@ -9443,6 +9447,25 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
9443
9447
|
return seats[seats.length - 1] ?? null;
|
|
9444
9448
|
}
|
|
9445
9449
|
|
|
9450
|
+
/**
|
|
9451
|
+
* Find the last assistant turn-tail in the conversation for a session.
|
|
9452
|
+
* The host renders `[data-turn-tail]` around the assistant message's
|
|
9453
|
+
* IconActions row (copy / like / dislike / branch). Quick-reply options
|
|
9454
|
+
* mount at the top of that tail, directly above the action buttons.
|
|
9455
|
+
*/
|
|
9456
|
+
function findLastTurnTail(sessionId) {
|
|
9457
|
+
if (typeof document === 'undefined' || document === null) return null;
|
|
9458
|
+
const tails = Array.from(document.querySelectorAll('[data-turn-tail]'));
|
|
9459
|
+
if (sessionId !== undefined && sessionId !== '') {
|
|
9460
|
+
const own = tails.filter((tail) => {
|
|
9461
|
+
const body = tail.closest('[data-conversation-session]');
|
|
9462
|
+
return body !== null && body.getAttribute('data-conversation-session') === sessionId;
|
|
9463
|
+
});
|
|
9464
|
+
if (own.length > 0) return own[own.length - 1];
|
|
9465
|
+
}
|
|
9466
|
+
return tails[tails.length - 1] ?? null;
|
|
9467
|
+
}
|
|
9468
|
+
|
|
9446
9469
|
/** The host primary button is the only composer button carrying aria-busy. */
|
|
9447
9470
|
function findComposerSend(seat) {
|
|
9448
9471
|
if (seat === null) return null;
|
|
@@ -10088,6 +10111,22 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10088
10111
|
const QUICK_REPLIES_API = '/dsh-powerup/api/quick-replies';
|
|
10089
10112
|
/** Last state per session, so options survive a component remount. */
|
|
10090
10113
|
const quickRepliesCache = new Map();
|
|
10114
|
+
/** Last flag pushed to the Host, so we only POST on a real change. */
|
|
10115
|
+
let hostQuickRepliesEnabled = null;
|
|
10116
|
+
|
|
10117
|
+
/** Mirror the settings toggle to the Host so it can add/remove the tool and prompt section. */
|
|
10118
|
+
function syncQuickRepliesEnabled(enabled) {
|
|
10119
|
+
const value = enabled !== false;
|
|
10120
|
+
if (hostQuickRepliesEnabled === value) return;
|
|
10121
|
+
hostQuickRepliesEnabled = value;
|
|
10122
|
+
void fetch(QUICK_REPLIES_API, {
|
|
10123
|
+
method: 'POST',
|
|
10124
|
+
headers: { 'content-type': 'application/json' },
|
|
10125
|
+
body: JSON.stringify({ action: 'set-enabled', enabled: value }),
|
|
10126
|
+
}).catch(() => {
|
|
10127
|
+
hostQuickRepliesEnabled = null; // allow a retry after a transient failure
|
|
10128
|
+
});
|
|
10129
|
+
}
|
|
10091
10130
|
|
|
10092
10131
|
async function quickRepliesRequest(sessionId, action, extra = {}) {
|
|
10093
10132
|
const url = action === 'get'
|
|
@@ -10176,19 +10215,23 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
10176
10215
|
return () => { alive = false; window.clearInterval(timer); };
|
|
10177
10216
|
}, [settings.quickReplies, ownerId, applyState]);
|
|
10178
10217
|
|
|
10179
|
-
// Mount a small container
|
|
10180
|
-
//
|
|
10218
|
+
// Mount a small container inside the last assistant turn-tail, just
|
|
10219
|
+
// above its IconActions row (copy / like / branch). The tail is
|
|
10220
|
+
// re-elected periodically because new turns replace the last one.
|
|
10181
10221
|
useEffect(() => {
|
|
10182
10222
|
if (!settings.quickReplies || ownerId === '') { setContainer(null); return undefined; }
|
|
10183
10223
|
let node = null;
|
|
10224
|
+
let host = null;
|
|
10184
10225
|
const locate = () => {
|
|
10185
|
-
const
|
|
10186
|
-
if (
|
|
10226
|
+
const tail = findLastTurnTail(ownerRef.current);
|
|
10227
|
+
if (tail === null) return;
|
|
10228
|
+
if (tail === host && node !== null && node.isConnected) return;
|
|
10187
10229
|
if (node !== null) node.remove();
|
|
10188
10230
|
node = document.createElement('div');
|
|
10189
10231
|
node.setAttribute('data-powerup-quick-replies', '');
|
|
10190
10232
|
node.className = 'dsh-powerup-quick-replies-mount';
|
|
10191
|
-
|
|
10233
|
+
tail.insertBefore(node, tail.firstChild);
|
|
10234
|
+
host = tail;
|
|
10192
10235
|
setContainer(node);
|
|
10193
10236
|
};
|
|
10194
10237
|
locate();
|
|
@@ -12040,6 +12083,8 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
12040
12083
|
}, 'dsh-powerup: client context');
|
|
12041
12084
|
bindLocale(ctx);
|
|
12042
12085
|
installStyles(ctx);
|
|
12086
|
+
// Align the Host tool/prompt registration with this browser's switch on load.
|
|
12087
|
+
syncQuickRepliesEnabled(settingsValue.quickReplies);
|
|
12043
12088
|
installLauncher(ctx);
|
|
12044
12089
|
installSessionSwitcher(ctx);
|
|
12045
12090
|
installLocateSession(ctx);
|
|
@@ -12212,6 +12257,7 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
12212
12257
|
QuickReplies,
|
|
12213
12258
|
quickRepliesRequest,
|
|
12214
12259
|
quickOwnerId,
|
|
12260
|
+
findLastTurnTail,
|
|
12215
12261
|
ProgressControl,
|
|
12216
12262
|
ProgressItem,
|
|
12217
12263
|
ProgressModelSelect,
|
|
@@ -12329,4 +12375,4 @@ html[data-platform="darwin"] .dsh-powerup-scrolltop:hover{background:var(--dsw-s
|
|
|
12329
12375
|
},
|
|
12330
12376
|
});
|
|
12331
12377
|
})();
|
|
12332
|
-
|
|
12378
|
+
|
package/index.js
CHANGED
|
@@ -86,6 +86,8 @@ const MASK_RULES_FILE = 'mask-rules.json';
|
|
|
86
86
|
const TASK_RESUME_FILE_NAME = TASK_RESUME_FILE;
|
|
87
87
|
/** Persisted quick-reply options, keyed by session id. */
|
|
88
88
|
const QUICK_REPLIES_FILE = 'quick-replies.json';
|
|
89
|
+
/** Persisted on/off state of the quick-replies feature (driven by the Client settings page). */
|
|
90
|
+
const QUICK_REPLIES_ENABLED_FILE = 'quick-replies-enabled.json';
|
|
89
91
|
/** Persisted progress-generation requirements (global + per workspace/session). */
|
|
90
92
|
const PROGRESS_REQUIREMENTS_FILE = 'progress-requirements.json';
|
|
91
93
|
/** Story of generated progress reports, kept on disk so refreshes never drop history. */
|
|
@@ -246,6 +248,75 @@ function appendSelfUpdateLog(line) {
|
|
|
246
248
|
}
|
|
247
249
|
}
|
|
248
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Brief system-prompt guidance for the quick-replies tool. Registered only
|
|
253
|
+
* while the feature is enabled, then disposed together with the tool.
|
|
254
|
+
* `interpolate: false` keeps any braces literal (the DSL treats {{x}} as a variable).
|
|
255
|
+
*/
|
|
256
|
+
const QUICK_REPLIES_PROMPT_SECTION = [
|
|
257
|
+
'## Quick reply options (dsh-powerup)',
|
|
258
|
+
'When your answer leaves a few obvious next steps, call the `powerup_quick_replies` tool to offer tappable buttons under your reply.',
|
|
259
|
+
'Pass `options` as a list of objects with `label` and `message`: `label` is the short button text, `message` is the full text sent when the user taps it.',
|
|
260
|
+
'Offer at most 8 concise, mutually exclusive choices; prefer 2-4. Use this after answering, not instead of answering.',
|
|
261
|
+
'The options vanish as soon as the user sends any message, so do not repeat them in your reply text.',
|
|
262
|
+
].join('\n');
|
|
263
|
+
|
|
264
|
+
/** Stable section name; a duplicate registration throws, so keep it unique. */
|
|
265
|
+
const QUICK_REPLIES_SECTION_NAME = 'dsh-powerup:quick-replies';
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* In-memory enabled flag plus listeners for the quick-replies feature. The
|
|
269
|
+
* Client settings toggle POSTs changes to the Host route, which calls
|
|
270
|
+
* `setQuickRepliesEnabled` and notifies the registration controller.
|
|
271
|
+
*/
|
|
272
|
+
let quickRepliesEnabled = true;
|
|
273
|
+
const quickRepliesListeners = new Set();
|
|
274
|
+
/** Live registrations owned by the feature; mutated by the apply() controller. */
|
|
275
|
+
const quickRepliesState = {
|
|
276
|
+
toolOff: undefined,
|
|
277
|
+
sectionOff: undefined,
|
|
278
|
+
sync: undefined,
|
|
279
|
+
systemPrompt: undefined,
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
function getQuickRepliesEnabled() {
|
|
283
|
+
return quickRepliesEnabled;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function setQuickRepliesEnabled(value) {
|
|
287
|
+
const next = value !== false;
|
|
288
|
+
if (next === quickRepliesEnabled) return quickRepliesEnabled;
|
|
289
|
+
quickRepliesEnabled = next;
|
|
290
|
+
try {
|
|
291
|
+
mkdirSync(dirname(storePath(QUICK_REPLIES_ENABLED_FILE)), { recursive: true });
|
|
292
|
+
writeFileSync(storePath(QUICK_REPLIES_ENABLED_FILE), JSON.stringify({ enabled: next }) + '\n', 'utf8');
|
|
293
|
+
} catch {
|
|
294
|
+
/* Persistence is best-effort; the in-memory flag still applies. */
|
|
295
|
+
}
|
|
296
|
+
for (const listener of [...quickRepliesListeners]) {
|
|
297
|
+
try { listener(next); } catch { /* one listener must not break the rest */ }
|
|
298
|
+
}
|
|
299
|
+
return next;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function subscribeQuickRepliesEnabled(listener) {
|
|
303
|
+
quickRepliesListeners.add(listener);
|
|
304
|
+
return () => quickRepliesListeners.delete(listener);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/** Load persisted quick-replies switch once at module load. */
|
|
308
|
+
function loadQuickRepliesEnabled() {
|
|
309
|
+
try {
|
|
310
|
+
const parsed = JSON.parse(readFileSync(storePath(QUICK_REPLIES_ENABLED_FILE), 'utf8'));
|
|
311
|
+
if (parsed !== null && typeof parsed === 'object' && parsed.enabled !== undefined) {
|
|
312
|
+
quickRepliesEnabled = parsed.enabled !== false;
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
/* Missing or corrupt file: keep the default (on). */
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
loadQuickRepliesEnabled();
|
|
319
|
+
|
|
249
320
|
/** The reason core records for a human kill; a custom reason is appended. */
|
|
250
321
|
const HUMAN_KILL_REASON = 'cancelled by the user';
|
|
251
322
|
|
|
@@ -497,14 +568,25 @@ async function handle(req, res, ctx) {
|
|
|
497
568
|
dirname,
|
|
498
569
|
});
|
|
499
570
|
if (req.method === 'GET') {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
571
|
+
// A GET without sessionId reports the feature switch, so the Client can
|
|
572
|
+
// sync the Host even before any options are published.
|
|
573
|
+
const rawSession = url.searchParams.get('sessionId');
|
|
574
|
+
if (rawSession === null) {
|
|
575
|
+
sendJson(res, { ok: true, enabled: getQuickRepliesEnabled() });
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
sendJson(res, { ok: true, enabled: getQuickRepliesEnabled(), ...store.read(rawSession.trim()) });
|
|
503
579
|
return;
|
|
504
580
|
}
|
|
505
581
|
if (req.method === 'POST') {
|
|
506
582
|
try {
|
|
507
583
|
const body = await readJsonBody(req);
|
|
584
|
+
// The settings toggle sends no sessionId and carries an `enabled` flag.
|
|
585
|
+
if (body?.action === 'set-enabled') {
|
|
586
|
+
const enabled = setQuickRepliesEnabled(body.enabled !== false);
|
|
587
|
+
sendJson(res, { ok: true, enabled });
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
508
590
|
const sessionId = typeof body?.sessionId === 'string' ? body.sessionId.trim() : '';
|
|
509
591
|
if (sessionId === '') {
|
|
510
592
|
sendJson(res, { ok: false, code: 'invalid-request', error: 'sessionId is required' }, 400);
|
|
@@ -998,7 +1080,7 @@ export function apply(ctx) {
|
|
|
998
1080
|
'dsh-powerup: restart and self-update routes',
|
|
999
1081
|
);
|
|
1000
1082
|
});
|
|
1001
|
-
ctx.inject(['tools', 'sessionQuery'], (scope) => {
|
|
1083
|
+
ctx.inject(['tools', 'sessionQuery', 'systemPrompt'], (scope) => {
|
|
1002
1084
|
const tools = scope.get('tools');
|
|
1003
1085
|
if (tools === undefined || typeof tools.register !== 'function') return;
|
|
1004
1086
|
scope.effect(
|
|
@@ -1008,8 +1090,9 @@ export function apply(ctx) {
|
|
|
1008
1090
|
})),
|
|
1009
1091
|
'dsh-powerup: step reference reader',
|
|
1010
1092
|
);
|
|
1011
|
-
// Quick replies are keyed by the calling Agent's session id.
|
|
1012
|
-
//
|
|
1093
|
+
// Quick replies are keyed by the calling Agent's session id. Both the tool
|
|
1094
|
+
// and its system-prompt guidance follow the feature switch: when the Client
|
|
1095
|
+
// disables it, the tool is unregistered and the injected section disposed.
|
|
1013
1096
|
const quickStore = createQuickRepliesStore({
|
|
1014
1097
|
file: storePath(QUICK_REPLIES_FILE),
|
|
1015
1098
|
readFile: readFileSync,
|
|
@@ -1017,13 +1100,53 @@ export function apply(ctx) {
|
|
|
1017
1100
|
mkdir: mkdirSync,
|
|
1018
1101
|
dirname,
|
|
1019
1102
|
});
|
|
1020
|
-
|
|
1021
|
-
() =>
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
)
|
|
1103
|
+
const makeTool = () => createQuickRepliesTool(defineTool, {
|
|
1104
|
+
getSessionId: () => '',
|
|
1105
|
+
getStore: () => quickStore,
|
|
1106
|
+
});
|
|
1107
|
+
// `sync` registers or tears down everything the feature owns. It is driven
|
|
1108
|
+
// by the enabled flag and re-run whenever the Client toggles the switch.
|
|
1109
|
+
const sync = () => {
|
|
1110
|
+
if (getQuickRepliesEnabled()) {
|
|
1111
|
+
if (quickRepliesState.toolOff === undefined) {
|
|
1112
|
+
quickRepliesState.toolOff = tools.register(makeTool());
|
|
1113
|
+
}
|
|
1114
|
+
if (quickRepliesState.sectionOff === undefined && quickRepliesState.systemPrompt !== undefined) {
|
|
1115
|
+
quickRepliesState.sectionOff = quickRepliesState.systemPrompt.section({
|
|
1116
|
+
name: QUICK_REPLIES_SECTION_NAME,
|
|
1117
|
+
order: 5001,
|
|
1118
|
+
text: QUICK_REPLIES_PROMPT_SECTION,
|
|
1119
|
+
interpolate: false,
|
|
1120
|
+
});
|
|
1121
|
+
}
|
|
1122
|
+
} else {
|
|
1123
|
+
if (typeof quickRepliesState.toolOff === 'function') {
|
|
1124
|
+
quickRepliesState.toolOff();
|
|
1125
|
+
quickRepliesState.toolOff = undefined;
|
|
1126
|
+
}
|
|
1127
|
+
if (typeof quickRepliesState.sectionOff === 'function') {
|
|
1128
|
+
quickRepliesState.sectionOff();
|
|
1129
|
+
quickRepliesState.sectionOff = undefined;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
const off = subscribeQuickRepliesEnabled(() => sync());
|
|
1134
|
+
scope.effect(() => {
|
|
1135
|
+
// `effect` calls this immediately and keeps the RETURNED function as the
|
|
1136
|
+
// real disposer. Doing teardown in the body would unregister on startup.
|
|
1137
|
+
quickRepliesState.systemPrompt = scope.get('systemPrompt');
|
|
1138
|
+
quickRepliesState.sync = sync;
|
|
1139
|
+
sync();
|
|
1140
|
+
return () => {
|
|
1141
|
+
off();
|
|
1142
|
+
if (typeof quickRepliesState.toolOff === 'function') quickRepliesState.toolOff();
|
|
1143
|
+
if (typeof quickRepliesState.sectionOff === 'function') quickRepliesState.sectionOff();
|
|
1144
|
+
quickRepliesState.toolOff = undefined;
|
|
1145
|
+
quickRepliesState.sectionOff = undefined;
|
|
1146
|
+
quickRepliesState.sync = undefined;
|
|
1147
|
+
quickRepliesState.systemPrompt = undefined;
|
|
1148
|
+
};
|
|
1149
|
+
}, 'dsh-powerup: quick replies');
|
|
1027
1150
|
});
|
|
1028
1151
|
// The progress side call needs both `llm` and `sessionQuery`. Wait for them
|
|
1029
1152
|
// through inject so a late-provided service still creates the manager.
|
|
@@ -1190,9 +1313,16 @@ export const __test = {
|
|
|
1190
1313
|
PROGRESS_REQUIREMENTS_FILE,
|
|
1191
1314
|
PROGRESS_HISTORY_FILE,
|
|
1192
1315
|
QUICK_REPLIES_FILE,
|
|
1316
|
+
QUICK_REPLIES_ENABLED_FILE,
|
|
1317
|
+
QUICK_REPLIES_PROMPT_SECTION,
|
|
1318
|
+
QUICK_REPLIES_SECTION_NAME,
|
|
1193
1319
|
createProgressManager,
|
|
1194
1320
|
createQuickRepliesStore,
|
|
1195
1321
|
createQuickRepliesTool,
|
|
1322
|
+
getQuickRepliesEnabled,
|
|
1323
|
+
setQuickRepliesEnabled,
|
|
1324
|
+
subscribeQuickRepliesEnabled,
|
|
1325
|
+
quickRepliesState,
|
|
1196
1326
|
cleanResumePrompt,
|
|
1197
1327
|
readJsonObject,
|
|
1198
1328
|
};
|
package/lib/quick-replies.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The Agent calls `powerup_quick_replies` to publish a small set of tappable
|
|
5
5
|
* message options for the current session. The options are stored in the
|
|
6
6
|
* central Power-Up state file; the Client polls a matching Host route and
|
|
7
|
-
* renders them
|
|
7
|
+
* renders them under the last assistant message. The options disappear once the user sends
|
|
8
8
|
* any message (clicking an option is itself a message send).
|
|
9
9
|
*
|
|
10
10
|
* This module holds the pure normalization/storage logic so offline tests can
|
|
@@ -27,7 +27,7 @@ export const QUICK_REPLIES_DESCRIPTION = [
|
|
|
27
27
|
'Offer the user a short list of tappable reply options in the current conversation.',
|
|
28
28
|
'Use this after answering when the next step has a few obvious choices (for example confirm, reject, or a follow-up question).',
|
|
29
29
|
'Each option has a short button label and the full message that is sent when it is tapped.',
|
|
30
|
-
'The options are shown
|
|
30
|
+
'The options are shown under the last assistant message and are removed automatically once the user sends any message.',
|
|
31
31
|
'Pass an empty options list to clear the current options without waiting for a message.',
|
|
32
32
|
].join(' ');
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@restregular/dsh-powerup",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.9",
|
|
4
4
|
"description": "为 DeepSeek Harness 提供一组可选的小型增强:轨迹右键菜单与步骤引用、后台任务停止原因、插件一键安装、侧边栏图标网格、会话切换、定位当前会话、工作区提示词、旁路模型生成的结构化任务进度;所有功能均可在 Power-Up 页面独立开关。 · Opt-in upgrades for DeepSeek Harness: Trajectory context menu and step references, job stop reasons, one-click plugin install, an adaptive sidebar launcher, session switching, locating the current session, workspace prompts, and non-blocking model-generated structured task progress — each toggled independently on the Power-Up page.",
|
|
5
5
|
"icon": "./icon.svg",
|
|
6
6
|
"type": "module",
|