@code-yeongyu/senpi 2026.9.12-2 → 2026.9.12
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/CHANGELOG.md +0 -17
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +9 -13
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +121 -54
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +1 -2
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
- package/dist/core/session-manager.d.ts +0 -2
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +13 -22
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-write-reservation.d.ts +0 -9
- package/dist/core/session-write-reservation.d.ts.map +1 -1
- package/dist/core/session-write-reservation.js +0 -33
- package/dist/core/session-write-reservation.js.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts +0 -2
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.js +1 -17
- package/dist/modes/interactive/components/ask-user-async-widget.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -2
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +0 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +1 -3
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +8 -10
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +23 -14
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.d.ts +0 -10
- package/dist/modes/rpc/session-worker-protocol.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.js +0 -2
- package/dist/modes/rpc/session-worker-protocol.js.map +1 -1
- package/dist/modes/rpc/session-worker.js +16 -12
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts +0 -12
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +24 -51
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/docs/rpc.md +6 -14
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +0 -12
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts +0 -11
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js +0 -18
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +1 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js +1 -2
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +1 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
- package/dist/core/cursor-history-admission.d.ts +0 -50
- package/dist/core/cursor-history-admission.d.ts.map +0 -1
- package/dist/core/cursor-history-admission.js +0 -130
- package/dist/core/cursor-history-admission.js.map +0 -1
- package/dist/modes/rpc/session-path-reservations.d.ts +0 -30
- package/dist/modes/rpc/session-path-reservations.d.ts.map +0 -1
- package/dist/modes/rpc/session-path-reservations.js +0 -58
- package/dist/modes/rpc/session-path-reservations.js.map +0 -1
- package/dist/modes/rpc/session-worker-credit.d.ts +0 -17
- package/dist/modes/rpc/session-worker-credit.d.ts.map +0 -1
- package/dist/modes/rpc/session-worker-credit.js +0 -39
- package/dist/modes/rpc/session-worker-credit.js.map +0 -1
- package/dist/modes/rpc/session-worker-signals.d.ts +0 -7
- package/dist/modes/rpc/session-worker-signals.d.ts.map +0 -1
- package/dist/modes/rpc/session-worker-signals.js +0 -19
- package/dist/modes/rpc/session-worker-signals.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts +0 -32
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js +0 -62
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts +0 -12
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js +0 -93
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js.map +0 -1
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
export declare function installSessionWriteReservation(reservation: (path: string) => void): void;
|
|
2
2
|
/** Synchronous SessionManager entry points must obtain the host grant before touching a writer. */
|
|
3
3
|
export declare function reserveSessionWrite(path: string): void;
|
|
4
|
-
/** A session writer whose grant must live exactly as long as the writer itself. */
|
|
5
|
-
export interface SessionWriterOwner {
|
|
6
|
-
getSessionFile(): string | undefined;
|
|
7
|
-
isPersisted(): boolean;
|
|
8
|
-
}
|
|
9
|
-
export declare function registerSessionWriter(owner: SessionWriterOwner): void;
|
|
10
|
-
export declare function unregisterSessionWriter(owner: SessionWriterOwner): void;
|
|
11
|
-
/** Session files still owned by a live persisted writer; collected writers are pruned here. */
|
|
12
|
-
export declare function liveSessionWritePaths(): string[];
|
|
13
4
|
//# sourceMappingURL=session-write-reservation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-write-reservation.d.ts","sourceRoot":"","sources":["../../src/core/session-write-reservation.ts"],"names":[],"mappings":"AAGA,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAGxF;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEtD
|
|
1
|
+
{"version":3,"file":"session-write-reservation.d.ts","sourceRoot":"","sources":["../../src/core/session-write-reservation.ts"],"names":[],"mappings":"AAGA,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAGxF;AAED,mGAAmG;AACnG,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEtD"}
|
|
@@ -9,37 +9,4 @@ export function installSessionWriteReservation(reservation) {
|
|
|
9
9
|
export function reserveSessionWrite(path) {
|
|
10
10
|
reserve?.(path);
|
|
11
11
|
}
|
|
12
|
-
// Weak on purpose: a writer nobody references anymore writes nothing, so its grant must not
|
|
13
|
-
// be kept alive by this registry. Identity removal needs the same ref the set holds.
|
|
14
|
-
const liveWriters = new Set();
|
|
15
|
-
const writerRefs = new WeakMap();
|
|
16
|
-
export function registerSessionWriter(owner) {
|
|
17
|
-
if (writerRefs.has(owner))
|
|
18
|
-
return;
|
|
19
|
-
const ref = new WeakRef(owner);
|
|
20
|
-
writerRefs.set(owner, ref);
|
|
21
|
-
liveWriters.add(ref);
|
|
22
|
-
}
|
|
23
|
-
export function unregisterSessionWriter(owner) {
|
|
24
|
-
const ref = writerRefs.get(owner);
|
|
25
|
-
if (!ref)
|
|
26
|
-
return;
|
|
27
|
-
writerRefs.delete(owner);
|
|
28
|
-
liveWriters.delete(ref);
|
|
29
|
-
}
|
|
30
|
-
/** Session files still owned by a live persisted writer; collected writers are pruned here. */
|
|
31
|
-
export function liveSessionWritePaths() {
|
|
32
|
-
const paths = [];
|
|
33
|
-
for (const ref of liveWriters) {
|
|
34
|
-
const owner = ref.deref();
|
|
35
|
-
if (!owner) {
|
|
36
|
-
liveWriters.delete(ref);
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
const path = owner.isPersisted() ? owner.getSessionFile() : undefined;
|
|
40
|
-
if (path)
|
|
41
|
-
paths.push(path);
|
|
42
|
-
}
|
|
43
|
-
return paths;
|
|
44
|
-
}
|
|
45
12
|
//# sourceMappingURL=session-write-reservation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-write-reservation.js","sourceRoot":"","sources":["../../src/core/session-write-reservation.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,IAAI,OAA6C,CAAC;AAElD,MAAM,UAAU,8BAA8B,CAAC,WAAmC;IACjF,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC5E,OAAO,GAAG,WAAW,CAAC;AACvB,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC
|
|
1
|
+
{"version":3,"file":"session-write-reservation.js","sourceRoot":"","sources":["../../src/core/session-write-reservation.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,IAAI,OAA6C,CAAC;AAElD,MAAM,UAAU,8BAA8B,CAAC,WAAmC;IACjF,IAAI,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC5E,OAAO,GAAG,WAAW,CAAC;AACvB,CAAC;AAED,mGAAmG;AACnG,MAAM,UAAU,mBAAmB,CAAC,IAAY;IAC/C,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC","sourcesContent":["/** Installed only inside a shared-host session isolate, before constructing any writer. */\nlet reserve: ((path: string) => void) | undefined;\n\nexport function installSessionWriteReservation(reservation: (path: string) => void): void {\n\tif (reserve) throw new Error(\"Session write reservation already installed\");\n\treserve = reservation;\n}\n\n/** Synchronous SessionManager entry points must obtain the host grant before touching a writer. */\nexport function reserveSessionWrite(path: string): void {\n\treserve?.(path);\n}\n"]}
|
|
@@ -12,8 +12,6 @@ import { type QuestionDraft } from "./ask-user-question-state.ts";
|
|
|
12
12
|
export declare const ASK_USER_WIDGET_KEY = "ask-user";
|
|
13
13
|
/** Editor shortcut that expands the pending question into the full component. */
|
|
14
14
|
export declare const ASK_USER_ANSWER_KEY = "alt+a";
|
|
15
|
-
/** True when `data` is the editor input that expands the pending question on `platform`. */
|
|
16
|
-
export declare function matchesAskUserAnswerKey(data: string, platform?: NodeJS.Platform): boolean;
|
|
17
15
|
/** Question ids the draft has not answered yet. */
|
|
18
16
|
export declare function unansweredIds(request: QuestionRequest, draft: QuestionDraft): string[];
|
|
19
17
|
/** Response for composer text typed while the question is pending: the text is the comment. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-async-widget.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-user-async-widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"ask-user-async-widget.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-user-async-widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAQ,KAAK,GAAG,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE3F,OAAO,EAAwB,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIxF,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,iFAAiF;AACjF,eAAO,MAAM,mBAAmB,UAAU,CAAC;AAQ3C,mDAAmD;AACnD,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,EAAE,CAEtF;AAED,+FAA+F;AAC/F,wBAAgB,oBAAoB,CACnC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,MAAM,GACb,gBAAgB,CAOlB;AAED,kFAAkF;AAClF,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,aAAa,EACpB,mBAAmB,EAAE,MAAM,GACzB,gBAAgB,CASlB;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,MAAM,CAS1F;AAED,MAAM,WAAW,yBAAyB;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,qBAAa,kBAAmB,SAAQ,SAAS;IAChD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA6B;IACvD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,cAAc,CAAM;IAE5B,YAAY,OAAO,EAAE,yBAAyB,EAgB7C;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAGjC;IAED,OAAO,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,MAAM;CAGd"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* AskUserQuestionComponent. The response-building helpers here are pure so
|
|
6
6
|
* interactive-mode can turn ordinary composer text into the comment answer.
|
|
7
7
|
*/
|
|
8
|
-
import { Container,
|
|
8
|
+
import { Container, Text } from "@earendil-works/pi-tui";
|
|
9
9
|
import { theme } from "../theme/theme.js";
|
|
10
10
|
import { formatCountdownLabel } from "./ask-user-question-state.js";
|
|
11
11
|
import { CountdownTimer } from "./countdown-timer.js";
|
|
@@ -14,22 +14,6 @@ import { rawKeyHint } from "./keybinding-hints.js";
|
|
|
14
14
|
export const ASK_USER_WIDGET_KEY = "ask-user";
|
|
15
15
|
/** Editor shortcut that expands the pending question into the full component. */
|
|
16
16
|
export const ASK_USER_ANSWER_KEY = "alt+a";
|
|
17
|
-
/**
|
|
18
|
-
* What the `a` key types on macOS when the terminal lets Option compose
|
|
19
|
-
* characters instead of sending it as Alt (the default in Terminal.app,
|
|
20
|
-
* iTerm2, Ghostty and kitty). Accepting these keeps the advertised `option+a`
|
|
21
|
-
* working without a terminal-settings detour; other platforms never see
|
|
22
|
-
* Option this way, so they keep treating the glyphs as text.
|
|
23
|
-
*/
|
|
24
|
-
const DARWIN_OPTION_A_GLYPHS = new Set(["å", "Å"]);
|
|
25
|
-
/** True when `data` is the editor input that expands the pending question on `platform`. */
|
|
26
|
-
export function matchesAskUserAnswerKey(data, platform = process.platform) {
|
|
27
|
-
if (matchesKey(data, ASK_USER_ANSWER_KEY))
|
|
28
|
-
return true;
|
|
29
|
-
if (platform !== "darwin")
|
|
30
|
-
return false;
|
|
31
|
-
return DARWIN_OPTION_A_GLYPHS.has(decodeKittyPrintable(data) ?? data);
|
|
32
|
-
}
|
|
33
17
|
function hasAnswer(answer) {
|
|
34
18
|
if (!answer)
|
|
35
19
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-async-widget.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-user-async-widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"ask-user-async-widget.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/ask-user-async-widget.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,IAAI,EAAY,MAAM,wBAAwB,CAAC;AAEnE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAsB,MAAM,8BAA8B,CAAC;AACxF,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAC9C,iFAAiF;AACjF,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAE3C,SAAS,SAAS,CAAC,MAAuD;IACzE,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,MAAM,CAAC,QAAQ,CAA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OAAO;QACN,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;IAEO,MAAM;QACb,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IAClF,CAAC;CACD","sourcesContent":["/**\n * Collapsed one-line widget for a pending async (waitForAnswer=false)\n * question: it sits above the editor, shows the unanswered count and the\n * idle countdown, and names the shortcut that expands the full\n * AskUserQuestionComponent. The response-building helpers here are pure so\n * interactive-mode can turn ordinary composer text into the comment answer.\n */\n\nimport { Container, Text, type TUI } from \"@earendil-works/pi-tui\";\nimport type { QuestionRequest, QuestionResponse } from \"../../../core/extensions/types.ts\";\nimport { theme } from \"../theme/theme.ts\";\nimport { formatCountdownLabel, type QuestionDraft } from \"./ask-user-question-state.ts\";\nimport { CountdownTimer } from \"./countdown-timer.ts\";\nimport { rawKeyHint } from \"./keybinding-hints.ts\";\n\n/** Widget slot key used with `setWidget`; one pending async question at a time. */\nexport const ASK_USER_WIDGET_KEY = \"ask-user\";\n/** Editor shortcut that expands the pending question into the full component. */\nexport const ASK_USER_ANSWER_KEY = \"alt+a\";\n\nfunction hasAnswer(answer: QuestionResponse[\"answers\"][string] | undefined): boolean {\n\tif (!answer) return false;\n\tif (answer.selected.length > 0) return true;\n\treturn (answer.text ?? \"\").trim() !== \"\";\n}\n\n/** Question ids the draft has not answered yet. */\nexport function unansweredIds(request: QuestionRequest, draft: QuestionDraft): string[] {\n\treturn request.questions.filter((question) => !hasAnswer(draft.answers?.[question.id])).map((q) => q.id);\n}\n\n/** Response for composer text typed while the question is pending: the text is the comment. */\nexport function buildCommentResponse(\n\trequest: QuestionRequest,\n\tdraft: QuestionDraft,\n\tcomment: string,\n): QuestionResponse {\n\treturn {\n\t\tstatus: \"comment-submitted\",\n\t\tanswers: draft.answers ?? {},\n\t\tcomment,\n\t\tunanswered: unansweredIds(request, draft),\n\t};\n}\n\n/** Response for an idle countdown that expired while the widget was collapsed. */\nexport function buildTimedOutResponse(\n\trequest: QuestionRequest,\n\tdraft: QuestionDraft,\n\tautoResolvedAfterMs: number,\n): QuestionResponse {\n\tconst comment = draft.comment?.trim();\n\treturn {\n\t\tstatus: \"timed_out\",\n\t\tanswers: draft.answers ?? {},\n\t\t...(comment ? { comment } : {}),\n\t\tunanswered: unansweredIds(request, draft),\n\t\tautoResolvedAfterMs,\n\t};\n}\n\nexport function renderAsyncQuestionLine(unanswered: number, countdownLabel: string): string {\n\tconst countdown = countdownLabel === \"\" ? \"\" : theme.fg(\"muted\", ` · ${countdownLabel}`);\n\treturn (\n\t\ttheme.fg(\"accent\", theme.bold(\"?\")) +\n\t\ttheme.fg(\"text\", ` Question pending (${unanswered} unanswered)`) +\n\t\ttheme.fg(\"muted\", \" - \") +\n\t\trawKeyHint(ASK_USER_ANSWER_KEY, \"to answer, or just type your reply\") +\n\t\tcountdown\n\t);\n}\n\nexport interface AskUserAsyncWidgetOptions {\n\tunanswered: number;\n\t/** Idle countdown shown in the line; 0 disables it. */\n\ttimeoutMs: number;\n\ttui?: TUI;\n\tonExpire: () => void;\n}\n\nexport class AskUserAsyncWidget extends Container {\n\tprivate readonly line = new Text(\"\", 1, 0);\n\tprivate readonly countdown: CountdownTimer | undefined;\n\tprivate unanswered: number;\n\tprivate countdownLabel = \"\";\n\n\tconstructor(options: AskUserAsyncWidgetOptions) {\n\t\tsuper();\n\t\tthis.unanswered = options.unanswered;\n\t\tthis.addChild(this.line);\n\t\tif (options.timeoutMs > 0) {\n\t\t\tthis.countdown = new CountdownTimer(\n\t\t\t\toptions.timeoutMs,\n\t\t\t\toptions.tui,\n\t\t\t\t(seconds) => {\n\t\t\t\t\tthis.countdownLabel = formatCountdownLabel(seconds * 1000);\n\t\t\t\t\tthis.update();\n\t\t\t\t},\n\t\t\t\toptions.onExpire,\n\t\t\t);\n\t\t}\n\t\tthis.update();\n\t}\n\n\tsetUnanswered(count: number): void {\n\t\tthis.unanswered = count;\n\t\tthis.update();\n\t}\n\n\tdispose(): void {\n\t\tthis.countdown?.dispose();\n\t}\n\n\tprivate update(): void {\n\t\tthis.line.setText(renderAsyncQuestionLine(this.unanswered, this.countdownLabel));\n\t}\n}\n"]}
|
|
@@ -52,7 +52,7 @@ import { checkForNewPiVersion, getReleaseChangelogUrl } from "../../utils/versio
|
|
|
52
52
|
import { abortedMessageForRendering } from "./aborted-error-label.js";
|
|
53
53
|
import { transferCompactionQueue, waitForPromptDisposition, } from "./compaction-queue-transfer.js";
|
|
54
54
|
import { ArminComponent } from "./components/armin.js";
|
|
55
|
-
import { ASK_USER_WIDGET_KEY, AskUserAsyncWidget, buildCommentResponse, buildTimedOutResponse,
|
|
55
|
+
import { ASK_USER_ANSWER_KEY, ASK_USER_WIDGET_KEY, AskUserAsyncWidget, buildCommentResponse, buildTimedOutResponse, unansweredIds, } from "./components/ask-user-async-widget.js";
|
|
56
56
|
import { AskUserQuestionComponent } from "./components/ask-user-question.js";
|
|
57
57
|
import { AssistantMessageComponent } from "./components/assistant-message.js";
|
|
58
58
|
import { BashExecutionComponent } from "./components/bash-execution.js";
|
|
@@ -3077,7 +3077,7 @@ export class InteractiveMode {
|
|
|
3077
3077
|
/** Editor shortcut: expand the pending async question into the full component. */
|
|
3078
3078
|
handleAskUserShortcut(data) {
|
|
3079
3079
|
const state = this.asyncQuestion;
|
|
3080
|
-
if (!state || this.askUserQuestion || !
|
|
3080
|
+
if (!state || this.askUserQuestion || !matchesKey(data, ASK_USER_ANSWER_KEY))
|
|
3081
3081
|
return false;
|
|
3082
3082
|
const component = new AskUserQuestionComponent(state.request, (response) => {
|
|
3083
3083
|
if (this.asyncQuestion !== state)
|