dsh-better-ask-user 0.1.0 → 0.1.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/lib/client.js +22 -6
- package/package.json +1 -1
- package/src/ask-tool.js +3 -4
- package/src/client/index.ts +24 -6
package/lib/client.js
CHANGED
|
@@ -1855,15 +1855,31 @@ function publishContinuedQuestions(ctx, cards) {
|
|
|
1855
1855
|
};
|
|
1856
1856
|
}
|
|
1857
1857
|
var SETTINGS_NS = "better-ask-user-settings";
|
|
1858
|
-
var
|
|
1858
|
+
var ROW_CONFIG_KEYS = Object.freeze([
|
|
1859
|
+
"dsh-better-ask-user#dsh-better-ask-user",
|
|
1860
|
+
"@menghuan1918/dsh-apollo#dsh-better-ask-user",
|
|
1861
|
+
"dsh-apollo#dsh-better-ask-user"
|
|
1862
|
+
]);
|
|
1859
1863
|
function apply(ctx) {
|
|
1860
1864
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), "ui-user-questions: dictionaries");
|
|
1861
1865
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh: settingsZh, en: settingsEn }), "better-ask-user: settings dictionaries");
|
|
1862
|
-
ctx.slots.inject("plugins.row.config", () =>
|
|
1863
|
-
|
|
1864
|
-
key
|
|
1865
|
-
|
|
1866
|
-
|
|
1866
|
+
ctx.effect(() => ctx.slots.inject("plugins.row.config", () => {
|
|
1867
|
+
const disposers = [];
|
|
1868
|
+
for (const key of ROW_CONFIG_KEYS) {
|
|
1869
|
+
try {
|
|
1870
|
+
const dispose = ctx.slots.register({
|
|
1871
|
+
name: "plugins.row.config",
|
|
1872
|
+
key,
|
|
1873
|
+
locale: SETTINGS_NS
|
|
1874
|
+
}, SettingsEntry);
|
|
1875
|
+
if (typeof dispose === "function") disposers.push(dispose);
|
|
1876
|
+
} catch {
|
|
1877
|
+
}
|
|
1878
|
+
}
|
|
1879
|
+
return () => {
|
|
1880
|
+
for (const dispose of disposers) dispose();
|
|
1881
|
+
};
|
|
1882
|
+
}), "better-ask-user: row config page");
|
|
1867
1883
|
const questionDraftStore = createQuestionDraftStore();
|
|
1868
1884
|
const registerPendingInteraction = ctx.uiSession.registerPendingInteraction(
|
|
1869
1885
|
(pending) => pending.kind === "plan-review" ? 2 : 1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-better-ask-user",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Independent ask_user_question plugin: configurable wait, input-extended countdown, markdown/mobile card, native or default timeout behavior, and PTC deadline exemption.",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"repository": {
|
package/src/ask-tool.js
CHANGED
|
@@ -19,14 +19,12 @@ function questionRequest(questions, exec) {
|
|
|
19
19
|
question: question.question,
|
|
20
20
|
...(question.header !== undefined ? { header: question.header } : {}),
|
|
21
21
|
...(question.options !== undefined ? {
|
|
22
|
-
options: question.options.map(option => ({
|
|
23
|
-
label: option.label,
|
|
24
|
-
...(option.description !== undefined ? { description: option.description } : {}),
|
|
25
|
-
})),
|
|
22
|
+
options: question.options.map(option => ({ ...option })),
|
|
26
23
|
} : {}),
|
|
27
24
|
...(question.multi_select !== undefined ? { multiSelect: question.multi_select } : {}),
|
|
28
25
|
...(question.detail !== undefined ? { detail: question.detail } : {}),
|
|
29
26
|
})),
|
|
27
|
+
...(exec.agent !== undefined ? { agent: exec.agent } : {}),
|
|
30
28
|
signal: exec.signal,
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -122,6 +120,7 @@ export function createBetterAskTool(ctx, base, readConfig) {
|
|
|
122
120
|
const waitMs = seconds * 1000
|
|
123
121
|
const result = await userQuestions.askTimed({
|
|
124
122
|
...questions,
|
|
123
|
+
agent: exec.agent,
|
|
125
124
|
better: { waitMs, timeoutMode: mode, defaultAnswer },
|
|
126
125
|
}, exec.callId, waitMs)
|
|
127
126
|
if ('pending' in result) {
|
package/src/client/index.ts
CHANGED
|
@@ -374,16 +374,34 @@ function publishContinuedQuestions(ctx: ClientContext, cards: QuestionCards): ()
|
|
|
374
374
|
* @param ctx - client root context.
|
|
375
375
|
*/
|
|
376
376
|
const SETTINGS_NS = 'better-ask-user-settings'
|
|
377
|
-
|
|
377
|
+
// Standalone first, then the two Apollo-integration aliases. The Apollo profile
|
|
378
|
+
// inserts the row from its bundle patch, so the Plugins page looks the page up
|
|
379
|
+
// as '@menghuan1918/dsh-apollo#dsh-better-ask-user' (and the legacy alias).
|
|
380
|
+
const ROW_CONFIG_KEYS = Object.freeze([
|
|
381
|
+
'dsh-better-ask-user#dsh-better-ask-user',
|
|
382
|
+
'@menghuan1918/dsh-apollo#dsh-better-ask-user',
|
|
383
|
+
'dsh-apollo#dsh-better-ask-user',
|
|
384
|
+
])
|
|
378
385
|
|
|
379
386
|
export function apply(ctx: ClientContext): void {
|
|
380
387
|
ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'ui-user-questions: dictionaries')
|
|
381
388
|
ctx.effect(() => ctx.locale.register(SETTINGS_NS, { zh: settingsZh, en: settingsEn } as any), 'better-ask-user: settings dictionaries')
|
|
382
|
-
ctx.slots.inject('plugins.row.config', () =>
|
|
383
|
-
|
|
384
|
-
key
|
|
385
|
-
|
|
386
|
-
|
|
389
|
+
ctx.effect(() => ctx.slots.inject('plugins.row.config', () => {
|
|
390
|
+
const disposers: Array<() => void> = []
|
|
391
|
+
for (const key of ROW_CONFIG_KEYS) {
|
|
392
|
+
try {
|
|
393
|
+
const dispose = ctx.slots.register({
|
|
394
|
+
name: 'plugins.row.config',
|
|
395
|
+
key,
|
|
396
|
+
locale: SETTINGS_NS,
|
|
397
|
+
} as any, SettingsEntry as any)
|
|
398
|
+
if (typeof dispose === 'function') disposers.push(dispose)
|
|
399
|
+
} catch {
|
|
400
|
+
// A rejected alias must not prevent the other keys from registering.
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return () => { for (const dispose of disposers) dispose() }
|
|
404
|
+
}), 'better-ask-user: row config page')
|
|
387
405
|
const questionDraftStore = createQuestionDraftStore()
|
|
388
406
|
const registerPendingInteraction = ctx.uiSession.registerPendingInteraction<PendingQuestion>(
|
|
389
407
|
pending => pending.kind === 'plan-review' ? 2 : 1,
|