diff --git a/docs/acp-implementation-details.md b/docs/acp-implementation-details.md index 653200399..5620a5413 100644 --- a/docs/acp-implementation-details.md +++ b/docs/acp-implementation-details.md @@ -104,7 +104,7 @@ The implementation evidence comes from these source files: - `src/acp/interaction-mapper.js` - `src/shared/session/session-runtime.ts` - `src/shared/session/session-runtime-events.js` -- `src/shared/session/session-runtime-interactions.js` +- `src/shared/session/session-runtime-interactions.ts` - `src/acp/protocol-smoke.test.ts` - `src/acp/session-map.test.js` - `src/acp/server.test.js` diff --git a/docs/architecture.md b/docs/architecture.md index 67d95b9a9..4def37ab4 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -164,7 +164,7 @@ Forbidden edges are as important as the shown edges: ## Public Runtime boundary The public boundary lives in `src/shared/session/session-runtime.ts`, `src/shared/session/session-runtime-events.js`, -and `src/shared/session/session-runtime-interactions.js`. +and `src/shared/session/session-runtime-interactions.ts`. | Surface | Consumer-visible contract | | ----------------------- | ---------------------------------------------------------------------------------------------- | @@ -1090,7 +1090,7 @@ The highest-value cross-boundary paths for later confidence analysis are visible | Per-session state | `src/shared/session/hosted-session.js` | | Session registry | `src/shared/session/session-host.ts` | | Runtime event contract | `src/shared/session/session-runtime-events.js` | -| Interaction contract | `src/shared/session/session-runtime-interactions.js` | +| Interaction contract | `src/shared/session/session-runtime-interactions.ts` | | Pi session construction and prompt bridge | `src/shared/session/session.js` | | Agent definition layering | `src/shared/session/agents.js` | | Agent switching | `src/shared/session/agent-switching.ts` | diff --git a/docs/plans/remote-ssh-development/manual-qa.md b/docs/plans/remote-ssh-development/manual-qa.md index 24d034a12..26ac50597 100644 --- a/docs/plans/remote-ssh-development/manual-qa.md +++ b/docs/plans/remote-ssh-development/manual-qa.md @@ -1359,7 +1359,7 @@ Evidence: `/tmp/wld-child13-linked-space-retry.log`, receipt 0, suite `wld-cli-w #### Evidence boundaries after these repairs `source-delta-from-693.json` in the final candidate compares the saved snapshots. The base HEAD is unchanged. Production -changes since `693c6b96…` are limited to `plan-written.ts`, `session-runtime-interactions.js`, and `execution-start.ts`; +changes since `693c6b96…` are limited to `plan-written.ts`, `session-runtime-interactions.ts`, and `execution-start.ts`; other differences are documentation, test registration, and tests. Existing ordinary-primary-checkout journeys pass the same cwd value before and after these substitutions. Cases without Plan Review or execution-start do not enter the changed paths. Thus the earlier results keep their original build IDs and this explicit unaffected-case rationale; diff --git a/scripts/language-policy-baseline.json b/scripts/language-policy-baseline.json index b79e16479..227772ec8 100644 --- a/scripts/language-policy-baseline.json +++ b/scripts/language-policy-baseline.json @@ -15,7 +15,6 @@ "src/shared/session/root-session.js", "src/shared/session/session-runtime-events.js", - "src/shared/session/session-runtime-interactions.js", "src/shared/session/session-transcript-projection.js", "src/shared/session/session.js", "src/shared/session/types.js", diff --git a/src/acp/chat-interaction-runtime.test.ts b/src/acp/chat-interaction-runtime.test.ts index 7fcfb4258..4c6f392b0 100644 --- a/src/acp/chat-interaction-runtime.test.ts +++ b/src/acp/chat-interaction-runtime.test.ts @@ -6,7 +6,7 @@ import { createSessionRuntime } from "../shared/session/session-runtime.ts"; import type { RuntimeInteractionRequest, RuntimeInteractionResponse, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; for (const type of ["select", "text", "approval", "plan_review"] as const) { test(`ACP broker answers only active chat interaction types: ${type}`, async () => { diff --git a/src/acp/chat-interaction.test.ts b/src/acp/chat-interaction.test.ts index 95c3d15d4..3e10ec8f8 100644 --- a/src/acp/chat-interaction.test.ts +++ b/src/acp/chat-interaction.test.ts @@ -1,6 +1,6 @@ import { test } from "node:test"; import { assertEquals, assertStringIncludes } from "../testing/assertions.ts"; -import type { RuntimeInteractionRequest } from "../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../shared/session/session-runtime-interactions.ts"; import { formatChatQuestion, parseChatReply } from "./chat-interaction.ts"; test("interview chat only matches a unique exact label or displayed number", () => { diff --git a/src/acp/chat-interaction.ts b/src/acp/chat-interaction.ts index 032487bbc..40ed647ee 100644 --- a/src/acp/chat-interaction.ts +++ b/src/acp/chat-interaction.ts @@ -4,7 +4,7 @@ import { type RuntimeInteractionRequest, type RuntimeInteractionResponse, RuntimeInteractionTypes, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; function displayLabel(label: string) { return label.replace(/\s*\(recommended\)$/i, ""); diff --git a/src/acp/interaction-mapper.js b/src/acp/interaction-mapper.js index 2bcac603a..d10eaf21a 100644 --- a/src/acp/interaction-mapper.js +++ b/src/acp/interaction-mapper.js @@ -8,7 +8,7 @@ import { isApprovalAcceptedValue, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; import { startBrowserQuestionServer } from "../shared/session/browser-question.ts"; import { requestLocalReviewInteraction } from "../shared/session/local-review-interactions.ts"; @@ -43,10 +43,10 @@ function notifyClient(context, method, params) { } /** - * @param {{ context: any, acpSessionId: string, interaction: import('../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest, signal?: AbortSignal }} options + * @param {{ context: any, acpSessionId: string, interaction: import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest, signal?: AbortSignal }} options */ async function requestBrowserQuestion(options) { - /** @type {PromiseWithResolvers} */ + /** @type {PromiseWithResolvers} */ const answered = Promise.withResolvers(); let used = false; let origin = ""; @@ -145,7 +145,7 @@ async function requestBrowserQuestion(options) { } /** - * @param {import('../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} interaction + * @param {import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} interaction */ function buildSchema(interaction) { if (interaction.type === RuntimeInteractionTypes.SELECT || interaction.type === RuntimeInteractionTypes.APPROVAL) { @@ -188,8 +188,8 @@ function buildSchema(interaction) { } /** - * @param {{ context: any, acpSessionId: string, clientCapabilities?: unknown, presentChatQuestion?: (interaction: import('../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest, signal?: AbortSignal) => Promise }} options - * @returns {import('../shared/session/session-runtime-interactions.js').RuntimeInteractionAdapter} + * @param {{ context: any, acpSessionId: string, clientCapabilities?: unknown, presentChatQuestion?: (interaction: import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest, signal?: AbortSignal) => Promise }} options + * @returns {import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionAdapter} */ export function createAcpInteractionAdapter({ context, acpSessionId, clientCapabilities, presentChatQuestion }) { return { diff --git a/src/acp/interaction-mapper.test.ts b/src/acp/interaction-mapper.test.ts index 18dbde008..89007d77f 100644 --- a/src/acp/interaction-mapper.test.ts +++ b/src/acp/interaction-mapper.test.ts @@ -6,7 +6,7 @@ import { test } from "node:test"; */ import { createAcpInteractionAdapter } from "./interaction-mapper.js"; -import type { RuntimeInteractionRequest } from "../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../shared/session/session-runtime-interactions.ts"; interface QuestionNotification { update: { diff --git a/src/acp/server.js b/src/acp/server.js index 5956c1608..bea870f29 100644 --- a/src/acp/server.js +++ b/src/acp/server.js @@ -21,7 +21,7 @@ import { formatChatQuestion, parseChatReply } from "./chat-interaction.ts"; import { buildAcpModelOptions } from "./model-options.ts"; import { getCommandDefinition, getSlashCommandDefinition, getSlashCommandDefinitions } from "../cmd/registry.js"; import { ProjectRuntimeEntryRefusedError } from "../shared/project-runtime-layout.ts"; -import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "../shared/session/session-runtime-interactions.ts"; import { applyUserModelSelection, listUserModelOptions, @@ -526,7 +526,7 @@ async function notifyAcpContextUsage(context, runtime, sessionMap, runtimeSessio */ function createAcpCommandUiAPI(options) { /** - * @param {import('../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest['type']} type + * @param {import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest['type']} type * @param {string} title * @param {AcpCommandSelectOption[]} choices * @param {{ defaultValue?: string, placeholder?: string, allowEmpty?: boolean }} [requestOptions] @@ -917,7 +917,7 @@ function createLiveOperation(options) { let tail = Promise.resolve(); /** @type {PromiseWithResolvers} */ let wake = Promise.withResolvers(); - /** @type {{ interaction: import('../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest, delivered: boolean, queued: boolean } | null} */ + /** @type {{ interaction: import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest, delivered: boolean, queued: boolean } | null} */ let question = null; let settled = false; let cancelled = false; @@ -984,7 +984,7 @@ function createLiveOperation(options) { message: "Interaction canceled.", }); } - /** @type {PromiseWithResolvers} */ + /** @type {PromiseWithResolvers} */ const answered = Promise.withResolvers(); const current = { interaction, delivered: false, queued: false }; question = current; @@ -1235,7 +1235,7 @@ function createLiveOperation(options) { cancel() { cancelled = true; }, - /** @param {AcpNotificationContext & { requestId?: string | number | null }} context @param {string | undefined} expectedInteractionId @param {import('../shared/session/session-runtime-interactions.js').RuntimeInteractionResponse | null | undefined} reply @param {string} [feedback] + /** @param {AcpNotificationContext & { requestId?: string | number | null }} context @param {string | undefined} expectedInteractionId @param {import('../shared/session/session-runtime-interactions.ts').RuntimeInteractionResponse | null | undefined} reply @param {string} [feedback] * @returns {Promise} */ async attach(context, expectedInteractionId, reply, feedback) { attachRequest(context); diff --git a/src/cmd/init/init-verification-confirmation.integration.test.ts b/src/cmd/init/init-verification-confirmation.integration.test.ts index 6dd79d522..da895e002 100644 --- a/src/cmd/init/init-verification-confirmation.integration.test.ts +++ b/src/cmd/init/init-verification-confirmation.integration.test.ts @@ -14,7 +14,7 @@ import type { InteractiveSessionPort } from "../../ui/tui/interactive-session-po import type { RuntimeInteractionRequest, RuntimeInteractionResponse, -} from "../../shared/session/session-runtime-interactions.js"; +} from "../../shared/session/session-runtime-interactions.ts"; interface InitUi { messages: Array<{ message: string; error?: boolean }>; diff --git a/src/cmd/load-plan/plan-review-flow.ts b/src/cmd/load-plan/plan-review-flow.ts index d0347c31c..db159998e 100644 --- a/src/cmd/load-plan/plan-review-flow.ts +++ b/src/cmd/load-plan/plan-review-flow.ts @@ -23,7 +23,7 @@ import { requestRecoverablePlanReview, SESSION_COMPLETE_GUIDANCE, } from "../../shared/workflow/plan-review-recovery.js"; -import { RuntimeInteractionOutcomes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionOutcomes } from "../../shared/session/session-runtime-interactions.ts"; import type { UiAPI } from "../../ui/tui/types.js"; import { buildReReviewRevisionRequest } from "./plan-presentation.ts"; import { diff --git a/src/cmd/load-plan/plan-session-surface.ts b/src/cmd/load-plan/plan-session-surface.ts index 61359ff3c..db834d0ec 100644 --- a/src/cmd/load-plan/plan-session-surface.ts +++ b/src/cmd/load-plan/plan-session-surface.ts @@ -14,7 +14,7 @@ import { resetTuiState as resetTuiStateFn } from "../command-helpers.ts"; import { RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../../shared/session/session-runtime-interactions.js"; +} from "../../shared/session/session-runtime-interactions.ts"; import type { SessionRuntime } from "../../shared/session/session-runtime.ts"; import type { UiAPI } from "../../ui/tui/types.js"; import type { PlanFrontMatter } from "../../plan-store.js"; diff --git a/src/cmd/load-plan/reopen-epic-chat-handoff.integration.test.ts b/src/cmd/load-plan/reopen-epic-chat-handoff.integration.test.ts index 6d4e692e4..3848d4cf6 100644 --- a/src/cmd/load-plan/reopen-epic-chat-handoff.integration.test.ts +++ b/src/cmd/load-plan/reopen-epic-chat-handoff.integration.test.ts @@ -12,7 +12,7 @@ import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; import { requestLocalReviewInteraction } from "../../shared/session/local-review-interactions.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import type { PlanReviewConversation } from "../../shared/session/plan-review-conversation.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; diff --git a/src/cmd/load-plan/reopen-plan-review-behavior.integration.test.ts b/src/cmd/load-plan/reopen-plan-review-behavior.integration.test.ts index 32ae65268..c260bb517 100644 --- a/src/cmd/load-plan/reopen-plan-review-behavior.integration.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-behavior.integration.test.ts @@ -11,7 +11,7 @@ import { import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { applySharedPlanReviewDecision } from "../../shared/workflow/plan-review-actions.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; import type { SequenceReviewDocument } from "../../shared/workflow/sequence-review.ts"; diff --git a/src/cmd/load-plan/reopen-plan-review-crash.integration.test.ts b/src/cmd/load-plan/reopen-plan-review-crash.integration.test.ts index 1d4db2f32..15215974c 100644 --- a/src/cmd/load-plan/reopen-plan-review-crash.integration.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-crash.integration.test.ts @@ -13,7 +13,7 @@ import { fauxAssistantMessage, fauxText } from "@earendil-works/pi-ai"; import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; import { createOwnerWorkspaceApp } from "../../ui/workspace/server.js"; @@ -50,7 +50,7 @@ test("a Session reopens the current saved Plan after its pending review process import.meta.resolve("../../shared/owner-coordination/index.ts"), )}; import { RuntimeInteractionTypes } from ${JSON.stringify( - import.meta.resolve("../../shared/session/session-runtime-interactions.js"), + import.meta.resolve("../../shared/session/session-runtime-interactions.ts"), )}; const ownerStore = openOwnerCoordinationStore({ dbPath: ${JSON.stringify( join(homeDir, "owner.sqlite3"), @@ -195,7 +195,7 @@ test("Workspace opens and approves a saved Plan review after its owner is SIGKIL import.meta.resolve("../../shared/owner-coordination/index.ts"), )}; import { RuntimeInteractionTypes } from ${JSON.stringify( - import.meta.resolve("../../shared/session/session-runtime-interactions.js"), + import.meta.resolve("../../shared/session/session-runtime-interactions.ts"), )}; const store = openOwnerCoordinationStore({ dbPath: ${JSON.stringify(join(homeDir, "owner.sqlite3"))} }); const runtime = createSessionRuntime({ sessionStore: store, ownerProcessKind: "test" }); diff --git a/src/cmd/load-plan/reopen-plan-review-launch.test.ts b/src/cmd/load-plan/reopen-plan-review-launch.test.ts index 595485105..224b637f2 100644 --- a/src/cmd/load-plan/reopen-plan-review-launch.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-launch.test.ts @@ -4,7 +4,7 @@ import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; import { ensurePlanIdentity, savePlan } from "../../plan-store.js"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; test("a failed review launch does not claim the review was completed", async () => { await withRuntimeCommandFixture("reopen-launch-", async ({ homeDir, projectRoot }) => { diff --git a/src/cmd/load-plan/reopen-plan-review-live.test.ts b/src/cmd/load-plan/reopen-plan-review-live.test.ts index 5270efaa1..12e06c8d2 100644 --- a/src/cmd/load-plan/reopen-plan-review-live.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-live.test.ts @@ -3,7 +3,7 @@ import { test } from "node:test"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; test("reopening a live review returns its address without opening another review", async () => { await withRuntimeCommandFixture("reopen-live-", async ({ homeDir, projectRoot }) => { diff --git a/src/cmd/load-plan/reopen-plan-review-sequence-feedback.integration.test.ts b/src/cmd/load-plan/reopen-plan-review-sequence-feedback.integration.test.ts index 3b320bd15..bdeaf7dfd 100644 --- a/src/cmd/load-plan/reopen-plan-review-sequence-feedback.integration.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-sequence-feedback.integration.test.ts @@ -5,7 +5,7 @@ import { fauxAssistantMessage, fauxText, type TranscriptContext } from "@earendi import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import type { SequenceReviewDocument } from "../../shared/workflow/sequence-review.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; diff --git a/src/cmd/load-plan/reopen-plan-review-shapes.test.ts b/src/cmd/load-plan/reopen-plan-review-shapes.test.ts index 16212a794..bd6ca4ce2 100644 --- a/src/cmd/load-plan/reopen-plan-review-shapes.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-shapes.test.ts @@ -4,7 +4,7 @@ import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; for (const classification of ["PLANNED_CHANGE", "PROJECT"] as const) { test(`an idle Session opens the current ${classification} Plan and cancellation leaves its status unchanged`, async () => { diff --git a/src/cmd/load-plan/reopen-plan-review-target.integration.test.ts b/src/cmd/load-plan/reopen-plan-review-target.integration.test.ts index df1628013..773bbdce1 100644 --- a/src/cmd/load-plan/reopen-plan-review-target.integration.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-target.integration.test.ts @@ -8,7 +8,7 @@ import { defineCommittedGitFixture } from "../../shared/git-test-fixture.ts"; import { archivePlan, ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; const gitFixture = defineCommittedGitFixture(); diff --git a/src/cmd/load-plan/reopen-plan-review-worktree.integration.test.ts b/src/cmd/load-plan/reopen-plan-review-worktree.integration.test.ts index 45c896361..6fdfee118 100644 --- a/src/cmd/load-plan/reopen-plan-review-worktree.integration.test.ts +++ b/src/cmd/load-plan/reopen-plan-review-worktree.integration.test.ts @@ -25,7 +25,7 @@ import { } from "../../shared/workflow/sequence-review.ts"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; import { reopenSavedPlanReview } from "./reopen-plan-review.ts"; diff --git a/src/cmd/load-plan/reopen-plan-review.test.ts b/src/cmd/load-plan/reopen-plan-review.test.ts index 89c07f94f..be88000b4 100644 --- a/src/cmd/load-plan/reopen-plan-review.test.ts +++ b/src/cmd/load-plan/reopen-plan-review.test.ts @@ -7,7 +7,7 @@ import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; import { openFileSessionStore } from "../../shared/session/file-session-store.ts"; import { ensurePlanIdentity, loadPlan, savePlan } from "../../plan-store.js"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import type { SequenceReviewDocument } from "../../shared/workflow/sequence-review.ts"; test("an idle Session reopens the complete saved Sequence and saves approval without a model turn", async () => { diff --git a/src/cmd/load-plan/reopen-plan-review.ts b/src/cmd/load-plan/reopen-plan-review.ts index fcbea65e3..154e67906 100644 --- a/src/cmd/load-plan/reopen-plan-review.ts +++ b/src/cmd/load-plan/reopen-plan-review.ts @@ -3,7 +3,7 @@ import { resolvePlanExecutionPolicy } from "../../plan-store.js"; import { decidePostExecution } from "../../shared/workflow/decisions.ts"; import { validatePostExecutionDecision } from "./plan-execution.ts"; import { resolveWorkflowPlanLocation } from "../../shared/workflow/plan-location.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import type { LastPlanReviewReference } from "../../shared/session/file-session-store-types.ts"; import type { SessionRuntime } from "../../shared/session/session-runtime.ts"; import type { UiAPI } from "../../ui/tui/types.js"; diff --git a/src/cmd/plan-review/index.test.ts b/src/cmd/plan-review/index.test.ts index 0420c7902..9a046dcd4 100644 --- a/src/cmd/plan-review/index.test.ts +++ b/src/cmd/plan-review/index.test.ts @@ -3,7 +3,7 @@ import { assertEquals, assertStringIncludes } from "../../testing/assertions.ts" import { withRuntimeCommandFixture } from "../testing/runtime-command-fixture.ts"; import { createSessionRuntime } from "../../shared/session/session-runtime.ts"; import { openOwnerCoordinationStore } from "../../shared/owner-coordination/index.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { runPlanReviewCommand } from "./index.ts"; test("/plan-review reports the live URL published by the review surface without another presentation", async () => { diff --git a/src/shared/session/agent-handler.ts b/src/shared/session/agent-handler.ts index e5ad729b0..6e926dd85 100644 --- a/src/shared/session/agent-handler.ts +++ b/src/shared/session/agent-handler.ts @@ -28,7 +28,7 @@ import { runWorkflowValidationToStableBoundary } from "../workflow/validation.ts import { switchActiveAgent } from "./agent-switching.ts"; import { getAgentDisplayName } from "./agents.js"; import { emitHostedSessionRuntimeEvent, emitSystemStatus, RuntimeEventTypes } from "./session-runtime-events.js"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "./session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "./session-runtime-interactions.ts"; import { acknowledgeTaskCompletion, claimPendingTaskCompletion, diff --git a/src/shared/session/backends/agy-cli/mcp-setup.ts b/src/shared/session/backends/agy-cli/mcp-setup.ts index 9ef764c2b..3750017bf 100644 --- a/src/shared/session/backends/agy-cli/mcp-setup.ts +++ b/src/shared/session/backends/agy-cli/mcp-setup.ts @@ -22,7 +22,7 @@ import { RuntimeInteractionOutcomes, RuntimeInteractionTypes, supportsHostedSessionInteraction, -} from "../../session-runtime-interactions.js"; +} from "../../session-runtime-interactions.ts"; const WLD_EXECUTABLE = process.platform === "win32" ? `${CLI_BIN}.exe` : CLI_BIN; diff --git a/src/shared/session/browser-question.ts b/src/shared/session/browser-question.ts index 82f40e457..a93365962 100644 --- a/src/shared/session/browser-question.ts +++ b/src/shared/session/browser-question.ts @@ -14,7 +14,7 @@ import { startSessionQuestionWorkspaceServer } from "../../ui/workspace/server.j */ /** - * @param {{ interaction: import('./session-runtime-interactions.js').RuntimeInteractionRequest, acpSessionId?: string, answerQuestion: (request: Request) => Promise|Response }} options + * @param {{ interaction: import('./session-runtime-interactions.ts').RuntimeInteractionRequest, acpSessionId?: string, answerQuestion: (request: Request) => Promise|Response }} options * @returns {BrowserQuestionServer} */ export function startBrowserQuestionServer({ interaction, acpSessionId = "", answerQuestion }) { diff --git a/src/shared/session/hosted-session.js b/src/shared/session/hosted-session.js index 05e8a599e..fd65df820 100644 --- a/src/shared/session/hosted-session.js +++ b/src/shared/session/hosted-session.js @@ -103,9 +103,9 @@ import { PlanReviewConversationOwner } from "./plan-review-conversation.ts"; /** * @typedef {Object} ActiveInteractionRecord - * @property {import('./session-runtime-interactions.js').RuntimeInteractionRequest} [request] + * @property {import('./session-runtime-interactions.ts').RuntimeInteractionRequest} [request] * @property {AbortController} [abortController] - * @property {(response: import('./session-runtime-interactions.js').RuntimeInteractionResponse, source?: import('./session-runtime-events.js').NotificationSurface) => void} [answer] + * @property {(response: import('./session-runtime-interactions.ts').RuntimeInteractionResponse, source?: import('./session-runtime-events.js').NotificationSurface) => void} [answer] */ /** @@ -114,7 +114,7 @@ import { PlanReviewConversationOwner } from "./plan-review-conversation.ts"; * @property {string} [cwd] * @property {MinimalSessionManagerLike | null} [sessionManager] * @property {unknown} [eventSink] - * @property {import('./session-runtime-interactions.js').RuntimeInteractionAdapter} [interactionAdapter] + * @property {import('./session-runtime-interactions.ts').RuntimeInteractionAdapter} [interactionAdapter] * @property {ManagedSessionMetadata | null} [managed] */ @@ -245,7 +245,7 @@ export class HostedSession { /** @type {Set<(event: HostedRuntimeEventObservation) => void>} */ this.eventObservers = new Set(); this.planReviewConversations = new PlanReviewConversationOwner(); - /** @type {import('./session-runtime-interactions.js').RuntimeInteractionAdapter | null} */ + /** @type {import('./session-runtime-interactions.ts').RuntimeInteractionAdapter | null} */ this.interactionAdapter = options.interactionAdapter || null; /** @type {Map} */ this.activeInteractions = new Map(); @@ -582,7 +582,7 @@ export class HostedSession { } /** - * @param {import('./session-runtime-interactions.js').RuntimeInteractionAdapter | null} adapter + * @param {import('./session-runtime-interactions.ts').RuntimeInteractionAdapter | null} adapter */ setInteractionAdapter(adapter) { this.assertActive(); diff --git a/src/shared/session/interaction-values.ts b/src/shared/session/interaction-values.ts index 57c953e1c..474bef444 100644 --- a/src/shared/session/interaction-values.ts +++ b/src/shared/session/interaction-values.ts @@ -1,5 +1,5 @@ /** Browser-safe interaction values shared with the Hosted Session broker. */ -import type { RuntimeInteractionRequest } from "./session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "./session-runtime-interactions.ts"; export const RuntimeInteractionTypes = Object.freeze({ SELECT: "select", TEXT: "text", diff --git a/src/shared/session/live-session-connection.ts b/src/shared/session/live-session-connection.ts index dbfc0eef0..e1f2c8391 100644 --- a/src/shared/session/live-session-connection.ts +++ b/src/shared/session/live-session-connection.ts @@ -7,7 +7,7 @@ import { createServer, request as httpRequest, type ServerResponse } from "node: import { getHomeDir } from "../../constants.js"; import type { ImageAttachment } from "./types.js"; -import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "./session-runtime-interactions.js"; +import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "./session-runtime-interactions.ts"; import type { NotificationSurface, RuntimeAttentionRequestedEvent, diff --git a/src/shared/session/local-review-interactions.ts b/src/shared/session/local-review-interactions.ts index 6ffb1d677..116c14f42 100644 --- a/src/shared/session/local-review-interactions.ts +++ b/src/shared/session/local-review-interactions.ts @@ -5,16 +5,16 @@ */ import { NO_OPEN_BROWSER_PORT } from "../browser-port.ts"; -import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "./session-runtime-interactions.js"; +import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "./session-runtime-interactions.ts"; import { runCodeReview } from "../../ui/review/code-review.ts"; import { submitPlanForReview } from "../../ui/review/plan-review.ts"; import { startArtifactReadSurface } from "../../ui/review/review-launcher.ts"; /** - * @param {import('./session-runtime-interactions.js').RuntimeInteractionRequest} request + * @param {import('./session-runtime-interactions.ts').RuntimeInteractionRequest} request * @param {AbortSignal | undefined} signal - * @param {{ onSurfaceReady?: (url: string) => void | Promise, requestArtifactDecision?: (url: string) => Promise }} [options] - * @returns {Promise} + * @param {{ onSurfaceReady?: (url: string) => void | Promise, requestArtifactDecision?: (url: string) => Promise }} [options] + * @returns {Promise} */ export async function requestLocalReviewInteraction(request, signal, options = {}) { const meta = /** @type {Record} */ request._meta || {}; diff --git a/src/shared/session/named-invocation-active-segment.integration.test.ts b/src/shared/session/named-invocation-active-segment.integration.test.ts index 8cddf3dd2..46dddae7e 100644 --- a/src/shared/session/named-invocation-active-segment.integration.test.ts +++ b/src/shared/session/named-invocation-active-segment.integration.test.ts @@ -20,7 +20,7 @@ import { drainWorkflowMetrics, getWorkflowMetricsFilePath } from "../workflow/me import { SessionRuntime } from "./session-runtime.ts"; import { SessionHost } from "./session-host.ts"; import { openFileSessionStore } from "./file-session-store.ts"; -import type { RuntimeInteractionRequest } from "./session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "./session-runtime-interactions.ts"; interface NamedInvocationPromptResult { ok: boolean; diff --git a/src/shared/session/plan-review-conversation.test.ts b/src/shared/session/plan-review-conversation.test.ts index 3838a2c82..8df986f93 100644 --- a/src/shared/session/plan-review-conversation.test.ts +++ b/src/shared/session/plan-review-conversation.test.ts @@ -5,7 +5,7 @@ import { join } from "node:path"; import { tmpdir } from "node:os"; import { strictEqual as assertStrictEquals } from "node:assert/strict"; import { HostedSession } from "./hosted-session.js"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "./session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "./session-runtime-interactions.ts"; import { emitHostedSessionRuntimeEvent, RuntimeEventTypes } from "./session-runtime-events.js"; test("Plan review captures only the selected Architect and keeps the same conversation through dehydration", async () => { @@ -52,7 +52,7 @@ test("Plan review keeps the planning reply after final feedback and grouped Sequ const cwd = await fsMkdtemp(join(tmpdir(), "portable-fixture-")); const session = new HostedSession({ id: crypto.randomUUID(), cwd }); try { - const answers: Array = [ + const answers: Array = [ { outcome: "selected", _meta: { approved: false, feedback: "Revise the Epic." } }, { outcome: "accepted", _meta: { approved: false, sequenceDecision: {}, feedback: "Revise the group." } }, { outcome: "accepted", _meta: { sequenceDecision: {}, conversationTurn: true } }, diff --git a/src/shared/session/prompt-template-settings.integration.test.ts b/src/shared/session/prompt-template-settings.integration.test.ts index 718222fd5..ea39d058a 100644 --- a/src/shared/session/prompt-template-settings.integration.test.ts +++ b/src/shared/session/prompt-template-settings.integration.test.ts @@ -10,7 +10,7 @@ import { drainWorkflowMetrics, getWorkflowMetricsFilePath } from "../workflow/me import { SessionRuntime } from "./session-runtime.ts"; import { SessionHost } from "./session-host.ts"; import { openFileSessionStore } from "./file-session-store.ts"; -import type { RuntimeInteractionRequest } from "./session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "./session-runtime-interactions.ts"; function makeRuntime() { return new SessionRuntime({ diff --git a/src/shared/session/runtime/lifecycle-loading.ts b/src/shared/session/runtime/lifecycle-loading.ts index 955348831..84195a7f3 100644 --- a/src/shared/session/runtime/lifecycle-loading.ts +++ b/src/shared/session/runtime/lifecycle-loading.ts @@ -9,7 +9,7 @@ import { } from ".././root-session.js"; import { createSessionRuntimeEvent, RuntimeEventTypes } from ".././session-runtime-events.js"; import { createReplayEvents as createProjectedReplayEvents } from ".././session-transcript-projection.js"; -import { requestHostedSessionInteraction } from ".././session-runtime-interactions.js"; +import { requestHostedSessionInteraction } from ".././session-runtime-interactions.ts"; import { sessionDirForRoot } from ".././file-session-storage.ts"; import { recordSegmentLineageEvidence } from ".././workflow-context-session.js"; import { isAbsolute } from "node:path"; @@ -384,7 +384,7 @@ export class RuntimeLifecycleLoading { setInteractionAdapter( sessionId: string, - adapter: import(".././session-runtime-interactions.js").RuntimeInteractionAdapter | null, + adapter: import(".././session-runtime-interactions.ts").RuntimeInteractionAdapter | null, ) { const session = this.services.sessionHost.getSession(sessionId); if (!session) return { ok: false, error: "not_found" }; @@ -395,7 +395,7 @@ export class RuntimeLifecycleLoading { answerInteraction( sessionId: string, interactionId: string, - response: import("../session-runtime-interactions.js").RuntimeInteractionResponse, + response: import("../session-runtime-interactions.ts").RuntimeInteractionResponse, ) { const record = this.services.sessionHost.getSession(sessionId)?.getActiveInteractions().get(interactionId); if (!record?.answer || !["select", "text", "approval"].includes(record.request?.type || "")) return false; @@ -409,7 +409,7 @@ export class RuntimeLifecycleLoading { async requestInteraction( sessionId: string, - request: import(".././session-runtime-interactions.js").RuntimeInteractionRequest, + request: import(".././session-runtime-interactions.ts").RuntimeInteractionRequest, signal?: AbortSignal, ): Promise { const session = this.services.sessionHost.getSession(sessionId); diff --git a/src/shared/session/runtime/turns.ts b/src/shared/session/runtime/turns.ts index c79aff329..36ad13d66 100644 --- a/src/shared/session/runtime/turns.ts +++ b/src/shared/session/runtime/turns.ts @@ -8,7 +8,7 @@ import { rollSessionTranscriptSegment } from ".././segment-rollover.ts"; import { promptTemplateWorkflowConflict, resolvePromptTemplateSettings } from "../prompt-template-settings.ts"; import { recordManualModelSelection } from "../active-agent-session.ts"; import { getAgentDisplayName } from "../agents.js"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from ".././session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from ".././session-runtime-interactions.ts"; import { getRuntimeRootAgentSession, diff --git a/src/shared/session/session-runtime-interactions.js b/src/shared/session/session-runtime-interactions.ts similarity index 79% rename from src/shared/session/session-runtime-interactions.js rename to src/shared/session/session-runtime-interactions.ts index 43ff72567..c2ea98607 100644 --- a/src/shared/session/session-runtime-interactions.js +++ b/src/shared/session/session-runtime-interactions.ts @@ -7,52 +7,61 @@ import { emitHostedSessionRuntimeEvent, RuntimeEventTypes } from "./session-runt import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "./interaction-values.ts"; export { isApprovalAcceptedValue, RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "./interaction-values.ts"; -/** - * @typedef {Object} RuntimeInteractionOption - * @property {string} value - * @property {string} label - * @property {string} [description] - * @property {Record} [_meta] - */ +import type { HostedSession } from "./hosted-session.js"; +import type { ManagedOperationCapability } from "./managed-operation.ts"; -/** - * @typedef {Object} RuntimeInteractionRequest - * @property {string} [id] - * @property {"select"|"text"|"approval"|"link"|"plan_review"|"artifact_review"|"code_review"|"pair_checkpoint"|"plan_deviation_confirmation"} type - * @property {string} prompt - * @property {RuntimeInteractionOption[]} [options] - * @property {string} [otherOptionValue] Choice whose answer can be supplied as free text in the same form. - * @property {string} [defaultValue] - * @property {string} [placeholder] - * @property {boolean} [allowEmpty] - * @property {string} [toolCallId] - * @property {string} [reviewUrl] - * @property {Record} [_meta] - */ +export type RuntimeInteractionType = (typeof RuntimeInteractionTypes)[keyof typeof RuntimeInteractionTypes]; +export type RuntimeInteractionOutcome = (typeof RuntimeInteractionOutcomes)[keyof typeof RuntimeInteractionOutcomes]; -/** - * @typedef {Object} RuntimeInteractionResponse - * @property {"selected"|"text"|"accepted"|"canceled"|"unsupported"|"blocked"} outcome - * @property {string|boolean} [value] - * @property {string} [valueLabel] - * @property {string} [otherText] Free text supplied alongside the selected Other choice. - * @property {string} [message] - * @property {Record} [_meta] - */ +export type RuntimeInteractionOption = { + value: string; + label: string; + description?: string; + _meta?: Record; +}; -/** - * @typedef {Object} RuntimeInteractionAdapter - * @property {(request: RuntimeInteractionRequest, signal?: AbortSignal) => Promise|RuntimeInteractionResponse} requestInteraction - * @property {(type: string) => boolean} [supportsInteraction] - * @property {() => void} [cancelAll] - */ +export interface RuntimeInteractionRequest { + id?: string; + type: RuntimeInteractionType; + prompt: string; + options?: RuntimeInteractionOption[]; + /** Choice whose answer can be supplied as free text in the same form. */ + otherOptionValue?: string; + defaultValue?: string; + placeholder?: string; + allowEmpty?: boolean; + toolCallId?: string; + reviewUrl?: string; + _meta?: Record; +} -/** - * @param {import('./hosted-session.js').HostedSession | undefined | null} hostedSession - * @param {string} type - * @returns {boolean} - */ -export function supportsHostedSessionInteraction(hostedSession, type) { +export interface RuntimeInteractionResponse { + outcome: RuntimeInteractionOutcome; + value?: string | boolean; + valueLabel?: string; + /** Free text supplied alongside the selected Other choice. */ + otherText?: string; + message?: string; + _meta?: Record; +} + +export interface RuntimeInteractionAdapter { + requestInteraction: ( + request: RuntimeInteractionRequest, + signal?: AbortSignal, + ) => Promise | RuntimeInteractionResponse; + supportsInteraction?: (type: string) => boolean; + cancelAll?: () => void; +} + +interface RuntimeInteractionSurface { + url: string; +} + +export function supportsHostedSessionInteraction( + hostedSession: HostedSession | undefined | null, + type: string, +): boolean { const adapter = hostedSession?.getInteractionAdapter?.(); if (!adapter || typeof adapter.supportsInteraction !== "function") return false; try { @@ -62,21 +71,17 @@ export function supportsHostedSessionInteraction(hostedSession, type) { } } -/** @param {unknown} value */ -function isAbortError(value) { +function isAbortError(value: unknown) { return value instanceof DOMException && value.name === "AbortError"; } -/** @returns {string} */ export function createInteractionId() { return crypto.randomUUID(); } -/** - * @param {Partial|undefined|null} response - * @returns {RuntimeInteractionResponse} - */ -export function normalizeInteractionResponse(response) { +export function normalizeInteractionResponse( + response: Partial | undefined | null, +): RuntimeInteractionResponse { if (!response || typeof response !== "object") { return { outcome: RuntimeInteractionOutcomes.UNSUPPORTED, @@ -84,8 +89,8 @@ export function normalizeInteractionResponse(response) { }; } const outcome = response.outcome; - if (Object.values(RuntimeInteractionOutcomes).includes(/** @type {any} */ (outcome))) { - return /** @type {RuntimeInteractionResponse} */ ({ ...response, outcome }); + if (Object.values(RuntimeInteractionOutcomes).includes(outcome as RuntimeInteractionOutcome)) { + return { ...response, outcome } as RuntimeInteractionResponse; } return { outcome: RuntimeInteractionOutcomes.UNSUPPORTED, @@ -93,24 +98,18 @@ export function normalizeInteractionResponse(response) { }; } -/** - * @param {unknown} error - * @returns {RuntimeInteractionResponse} - */ -export function interactionErrorToResponse(error) { +export function interactionErrorToResponse(error: unknown): RuntimeInteractionResponse { if (isAbortError(error)) return { outcome: RuntimeInteractionOutcomes.CANCELED, message: "Interaction canceled." }; const message = error instanceof Error ? error.message : String(error || "Interaction failed."); return { outcome: RuntimeInteractionOutcomes.UNSUPPORTED, message }; } -/** - * @param {import('./hosted-session.js').HostedSession} hostedSession - * @param {RuntimeInteractionRequest} request - * @param {AbortSignal} [signal] - * @param {import('./managed-operation.ts').ManagedOperationCapability | null} [capability] - * @returns {Promise} - */ -export async function requestHostedSessionInteraction(hostedSession, request, signal, capability = null) { +export async function requestHostedSessionInteraction( + hostedSession: HostedSession, + request: RuntimeInteractionRequest, + signal?: AbortSignal, + capability: ManagedOperationCapability | null = null, +): Promise { const currentCapability = hostedSession.getManagedOperationCapability?.() || null; if (hostedSession.getManagedMetadata?.() && (!capability || currentCapability !== capability)) { return { @@ -164,8 +163,8 @@ export async function requestHostedSessionInteraction(hostedSession, request, si }, }; } - /** @type {string | null} */ - let reviewContainerPlanId = null; + + let reviewContainerPlanId: string | null = null; if (request.type === RuntimeInteractionTypes.PLAN_REVIEW) { const meta = interaction._meta || {}; const triagePlanId = @@ -223,8 +222,8 @@ export async function requestHostedSessionInteraction(hostedSession, request, si } if (request.type === RuntimeInteractionTypes.PLAN_REVIEW || request.type === RuntimeInteractionTypes.CODE_REVIEW) { const originalReady = request._meta?.onSurfaceReady; - /** @param {string | {url: string}} surface */ - const onSurfaceReady = (surface) => { + + const onSurfaceReady = (surface: string | RuntimeInteractionSurface) => { const url = typeof surface === "string" ? surface : surface?.url; if (typeof url === "string" && url && hostedSession.getActiveInteractions().has(id)) { interaction.reviewUrl = url; @@ -279,8 +278,8 @@ export async function requestHostedSessionInteraction(hostedSession, request, si return response; } const abortController = new AbortController(); - /** @type {(() => void) | null} */ - let removeAbortListener = null; + + let removeAbortListener: (() => void) | null = null; const operationSignal = capability?.signal || null; if (signal || operationSignal) { const abort = () => abortController.abort(); @@ -291,7 +290,7 @@ export async function requestHostedSessionInteraction(hostedSession, request, si operationSignal?.removeEventListener("abort", abort); }; } - const remoteAnswer = new Promise((resolve) => { + const remoteAnswer = new Promise((resolve) => { hostedSession.addActiveInteraction(id, { request: interaction, abortController, @@ -329,7 +328,7 @@ export async function requestHostedSessionInteraction(hostedSession, request, si }); return response; } - const canceled = new Promise((resolve) => { + const canceled = new Promise((resolve) => { abortController.signal.addEventListener( "abort", () => resolve({ outcome: RuntimeInteractionOutcomes.CANCELED, message: "Interaction canceled." }), @@ -337,25 +336,21 @@ export async function requestHostedSessionInteraction(hostedSession, request, si ); }); const response = normalizeInteractionResponse( - /** @type {Partial} */ ( - await Promise.race([ - Promise.resolve(adapter.requestInteraction(interaction, abortController.signal)).then( - (response) => { - if ( - response && - ["selected", "text", "accepted"].includes(response.outcome || "") && - hostedSession.getActiveInteractions().has(id) && - hostedSession.localInputSurface - ) { - hostedSession.notificationSurface = hostedSession.localInputSurface; - } - return response; - }, - ), - remoteAnswer, - canceled, - ]) - ), + await Promise.race([ + Promise.resolve(adapter.requestInteraction(interaction, abortController.signal)).then((response) => { + if ( + response && + ["selected", "text", "accepted"].includes(response.outcome || "") && + hostedSession.getActiveInteractions().has(id) && + hostedSession.localInputSurface + ) { + hostedSession.notificationSurface = hostedSession.localInputSurface; + } + return response; + }), + remoteAnswer, + canceled, + ]), ); retainCodeReview = request.type === RuntimeInteractionTypes.CODE_REVIEW && diff --git a/src/shared/session/session-runtime.test.js b/src/shared/session/session-runtime.test.js index e1484eb12..f42588a42 100644 --- a/src/shared/session/session-runtime.test.js +++ b/src/shared/session/session-runtime.test.js @@ -36,7 +36,7 @@ import { SessionHost } from "./session-host.ts"; import { captureTranscriptEvidence } from "./session-transcript-projection.js"; import { switchActiveAgent } from "./agent-switching.ts"; import { RuntimeEventTypes } from "./session-runtime-events.js"; -import { RuntimeInteractionTypes } from "./session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "./session-runtime-interactions.ts"; import { createSessionRuntime, SessionRuntime, SessionTurnInProgressError } from "./session-runtime.ts"; import { getRootSessionRebuildOptions } from "./session.js"; import { createRootSessionManager, getRunWieldSessionDir, resolveCreatedRootSessionPath } from "./root-session.js"; diff --git a/src/shared/workflow/agent-runners.integration.test.ts b/src/shared/workflow/agent-runners.integration.test.ts index 2bda86004..ba4fb0566 100644 --- a/src/shared/workflow/agent-runners.integration.test.ts +++ b/src/shared/workflow/agent-runners.integration.test.ts @@ -6,7 +6,7 @@ import { SessionManager } from "@earendil-works/pi-coding-agent"; import { withRuntimeCommandFixture } from "../../cmd/testing/runtime-command-fixture.ts"; import { loadPlan, savePlan } from "../../plan-store.js"; import { HostedSession } from "../session/hosted-session.js"; -import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.ts"; import { AgyCliBackendError } from "../session/backends/agy-cli/failure.ts"; import { buildEngineerPausedMessage, runEngineerWithPlan } from "./engineer-runner.ts"; import { runPlanningAgent } from "./planning-agent.ts"; diff --git a/src/shared/workflow/execution-setup.ts b/src/shared/workflow/execution-setup.ts index 3c15eefc1..d195297bf 100644 --- a/src/shared/workflow/execution-setup.ts +++ b/src/shared/workflow/execution-setup.ts @@ -30,7 +30,7 @@ import { } from "../worktree-project-context.ts"; import { enterProjectRuntime, resolveProjectRuntimeLayout } from "../project-runtime-layout.ts"; import type { HostedSession } from "../session/hosted-session.js"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.ts"; import { emitSystemStatus } from "../session/session-runtime-events.js"; import { captureWorktreeTree } from "./git-snapshot.ts"; import { diff --git a/src/shared/workflow/execution-start.ts b/src/shared/workflow/execution-start.ts index 391a039de..1163fd2fd 100644 --- a/src/shared/workflow/execution-start.ts +++ b/src/shared/workflow/execution-start.ts @@ -30,7 +30,7 @@ import { } from "./plan-branch.ts"; import { probeGitRepository } from "../git.ts"; import { hasNonGitExecutionConsent, rememberNonGitExecutionConsent } from "../non-git-execution-consent.ts"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.ts"; import { checkpointExecutionPreparation, createWorktreeGitArtifacts, diff --git a/src/shared/workflow/orchestrator.test.ts b/src/shared/workflow/orchestrator.test.ts index a29e2d405..9b808d119 100644 --- a/src/shared/workflow/orchestrator.test.ts +++ b/src/shared/workflow/orchestrator.test.ts @@ -17,7 +17,7 @@ import { HostedSession } from "../session/hosted-session.js"; import { listPendingTaskCompletions } from "../session/task-completion-session.ts"; import { setCustomSetting } from "../settings.js"; import type { SessionRuntimeEvent } from "../session/session-runtime-events.js"; -import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.ts"; import { dispatchPostTriage, type DispatchPostTriageArgs, readLatestTriageOutcome } from "./orchestrator.ts"; import { getWorkflowMetricsFilePath } from "./metrics.js"; import { publishWorkflowToolEvent } from "./workflow-tool-events.ts"; diff --git a/src/shared/workflow/orchestrator.ts b/src/shared/workflow/orchestrator.ts index 86255294d..6b17bf0c6 100644 --- a/src/shared/workflow/orchestrator.ts +++ b/src/shared/workflow/orchestrator.ts @@ -40,7 +40,7 @@ import { emitSystemStatus, RuntimeEventTypes, } from "../session/session-runtime-events.js"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.ts"; import { decidePostExecution, decidePostPlanning, summarizeWorkflowDecision } from "./decisions.ts"; import { recordWorkflowOutcome } from "./outcome-observations.ts"; import { recordWorkflowMetric } from "./metrics.js"; diff --git a/src/shared/workflow/plan-deviation-lifecycle.integration.test.ts b/src/shared/workflow/plan-deviation-lifecycle.integration.test.ts index 207dafbf4..7634ae194 100644 --- a/src/shared/workflow/plan-deviation-lifecycle.integration.test.ts +++ b/src/shared/workflow/plan-deviation-lifecycle.integration.test.ts @@ -18,7 +18,7 @@ import { executeWorkflowTestTools } from "../../testing/workflow-agent-tools.ts" import { runValidationPhase } from "./validation.ts"; import { createWorkRecordMnemotecaFixture } from "../work-records/test-fixtures/mnemoteca-port.ts"; import { findWorkRecordById, generateWorkRecordForSource, previewWorkRecordBackfill } from "../work-records/index.ts"; -import type { RuntimeInteractionRequest } from "../session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../session/session-runtime-interactions.ts"; import type { IsolatedAgentSessionOptions } from "./validation-session-adapter.ts"; const FIXTURE = defineCommittedGitFixture({ diff --git a/src/shared/workflow/plan-execution-runtime-boundaries.integration.test.ts b/src/shared/workflow/plan-execution-runtime-boundaries.integration.test.ts index b195fd053..624482092 100644 --- a/src/shared/workflow/plan-execution-runtime-boundaries.integration.test.ts +++ b/src/shared/workflow/plan-execution-runtime-boundaries.integration.test.ts @@ -30,7 +30,7 @@ import { SessionHost } from "../session/session-host.ts"; import { SessionRuntime } from "../session/session-runtime.ts"; import { RuntimeEventTypes } from "../session/session-runtime-events.js"; import { openOwnerCoordinationStore } from "../owner-coordination/index.ts"; -import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.ts"; import { loadPlanActionEvidence } from "./plan-actions.ts"; import { executePlan, executePreparedPlanSegmentHandoff } from "./plan-executor.ts"; import { ReviewInspection } from "./review-inspection.ts"; diff --git a/src/shared/workflow/plan-executor.integration.test.ts b/src/shared/workflow/plan-executor.integration.test.ts index b42f51663..3dc51e606 100644 --- a/src/shared/workflow/plan-executor.integration.test.ts +++ b/src/shared/workflow/plan-executor.integration.test.ts @@ -11,7 +11,7 @@ import { loadPlan, savePlan } from "../../plan-store.js"; import { git } from "../git-test-fixture.ts"; import { HostedSession } from "../session/hosted-session.js"; import { setCustomSetting } from "../settings.js"; -import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest, RuntimeInteractionResponse } from "../session/session-runtime-interactions.ts"; import { listEntries as listWorktreeRegistryEntries } from "../worktree-registry.js"; import { executePlan } from "./plan-executor.ts"; diff --git a/src/shared/workflow/plan-executor.ts b/src/shared/workflow/plan-executor.ts index 0cfaf0252..2466c2dc9 100644 --- a/src/shared/workflow/plan-executor.ts +++ b/src/shared/workflow/plan-executor.ts @@ -9,7 +9,7 @@ import { requestHostedSessionInteraction, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../session/session-runtime-interactions.js"; +} from "../session/session-runtime-interactions.ts"; import { isExecutablePlanStatus, isProjectPlan, recordPlanEvent } from "./plan-lifecycle.js"; import { normalizePlanApprovalAction, PLAN_APPROVAL_ACTIONS } from "./plan-approval.ts"; import { diff --git a/src/shared/workflow/plan-review-recovery.js b/src/shared/workflow/plan-review-recovery.js index 5d2f40f43..857a38438 100644 --- a/src/shared/workflow/plan-review-recovery.js +++ b/src/shared/workflow/plan-review-recovery.js @@ -3,7 +3,7 @@ * Adapter-neutral recovery helpers for interrupted Plan Review flows. */ -import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "../session/session-runtime-interactions.js"; +import { RuntimeInteractionOutcomes, RuntimeInteractionTypes } from "../session/session-runtime-interactions.ts"; export const SESSION_COMPLETE_GUIDANCE = "This session is complete. To work on something new, make a new session with `/new` or close `wld`."; @@ -126,7 +126,7 @@ export async function requestRecoverablePlanReview({ requestReview, requestRetry /** * @param {import('../session/hosted-session.js').HostedSession} hostedSession - * @param {(hostedSession: import('../session/hosted-session.js').HostedSession, request: import('../session/session-runtime-interactions.js').RuntimeInteractionRequest) => Promise} requestInteraction + * @param {(hostedSession: import('../session/hosted-session.js').HostedSession, request: import('../session/session-runtime-interactions.ts').RuntimeInteractionRequest) => Promise} requestInteraction * @param {{ attempt: number, reason: string, response: any }} details * @returns {Promise} */ diff --git a/src/shared/workflow/validation-helpers.ts b/src/shared/workflow/validation-helpers.ts index a5b881045..0615f49c2 100644 --- a/src/shared/workflow/validation-helpers.ts +++ b/src/shared/workflow/validation-helpers.ts @@ -36,7 +36,7 @@ import { requestHostedSessionInteraction, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../session/session-runtime-interactions.js"; +} from "../session/session-runtime-interactions.ts"; import { recordWorkflowOutcome } from "./outcome-observations.ts"; import { recordWorkflowMetric } from "./metrics.js"; diff --git a/src/shared/workflow/validation-local-ci.ts b/src/shared/workflow/validation-local-ci.ts index 47f874eb5..de17663b5 100644 --- a/src/shared/workflow/validation-local-ci.ts +++ b/src/shared/workflow/validation-local-ci.ts @@ -29,7 +29,7 @@ import { RuntimeEventTypes, } from "../session/session-runtime-events.js"; import { describeRuntimeTool } from "../session/tool-event-title.ts"; -import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.js"; +import { requestHostedSessionInteraction, RuntimeInteractionTypes } from "../session/session-runtime-interactions.ts"; import { buildValidationUserMessage } from "./validation-user-messages.ts"; import { classifyValidationOperationalError } from "./validation-operational-errors.ts"; diff --git a/src/shared/workflow/validation-loop-human-review.test.js b/src/shared/workflow/validation-loop-human-review.test.js index 1e54a137f..9ff7b8af8 100644 --- a/src/shared/workflow/validation-loop-human-review.test.js +++ b/src/shared/workflow/validation-loop-human-review.test.js @@ -978,7 +978,7 @@ test("an unconfigured Plan offers human review and cancellation pauses before de executionCwd: projectRoot, nonGitInPlace: true, }); - /** @type {import("../session/session-runtime-interactions.js").RuntimeInteractionRequest[]} */ + /** @type {import("../session/session-runtime-interactions.ts").RuntimeInteractionRequest[]} */ const requests = []; setInteraction(hostedSession, (request) => { requests.push(request); diff --git a/src/shared/workflow/validation-session-adapter.ts b/src/shared/workflow/validation-session-adapter.ts index 950e16d2d..a25354115 100644 --- a/src/shared/workflow/validation-session-adapter.ts +++ b/src/shared/workflow/validation-session-adapter.ts @@ -5,7 +5,7 @@ import { type HostedSession } from "../session/hosted-session.js"; import { runIsolatedAgentSession } from "../session/session.js"; import { readRequestAttemptEntries } from "../session/request-dispatch.ts"; import { emitAssistantMessage, type RuntimeValidationProgress } from "../session/session-runtime-events.js"; -import { requestHostedSessionInteraction } from "../session/session-runtime-interactions.js"; +import { requestHostedSessionInteraction } from "../session/session-runtime-interactions.ts"; import { getAgentDisplayName as getSessionAgentDisplayName } from "../session/agents.js"; import { ClaudeCliBackendError } from "../session/backends/claude-cli/failure.ts"; import { INTEGRATION_REVIEWER_SUBAGENT_TOOLS, REVIEWER_SUBAGENT_TOOLS } from "../session/subagent-definitions.ts"; diff --git a/src/testing/validation-session-script.ts b/src/testing/validation-session-script.ts index 5eb73b961..fffcd303f 100644 --- a/src/testing/validation-session-script.ts +++ b/src/testing/validation-session-script.ts @@ -14,7 +14,7 @@ import { SYSTEM_WORK_RECORD_MNEMOTECA_PORT } from "../shared/work-records/mnemot import { type RuntimeInteractionRequest, type RuntimeInteractionResponse, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; export type SessionScript = { outcomes: Array; diff --git a/src/tools/__tests__/plan-deviation.test.ts b/src/tools/__tests__/plan-deviation.test.ts index f9be701c3..1f0d6adf0 100644 --- a/src/tools/__tests__/plan-deviation.test.ts +++ b/src/tools/__tests__/plan-deviation.test.ts @@ -7,7 +7,7 @@ import { HostedSession } from "../../shared/session/hosted-session.js"; import type { RuntimeInteractionRequest, RuntimeInteractionResponse, -} from "../../shared/session/session-runtime-interactions.js"; +} from "../../shared/session/session-runtime-interactions.ts"; import { loadPlan, savePlan } from "../../plan-store.js"; import { createPlanDeviationTool } from "../plan-deviation.ts"; diff --git a/src/tools/__tests__/user-interview.test.ts b/src/tools/__tests__/user-interview.test.ts index d7b543166..80dc607b7 100644 --- a/src/tools/__tests__/user-interview.test.ts +++ b/src/tools/__tests__/user-interview.test.ts @@ -6,7 +6,7 @@ import { createUserInterviewTool, type InterviewResultDetails } from "../user-in import { HostedSession } from "../../shared/session/hosted-session.js"; import type { AgentToolResult, ExtensionToolContext } from "@earendil-works/pi-coding-agent"; import type { Static } from "typebox"; -import type { RuntimeInteractionOption } from "../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionOption } from "../../shared/session/session-runtime-interactions.ts"; type InterviewTool = ReturnType; type InterviewParameters = Static; diff --git a/src/tools/artifact-written.ts b/src/tools/artifact-written.ts index 496740068..19abdf9da 100644 --- a/src/tools/artifact-written.ts +++ b/src/tools/artifact-written.ts @@ -13,7 +13,7 @@ import { requestHostedSessionInteraction, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; const TOOL_PARAMS = Type.Object( { diff --git a/src/tools/plan-deviation.ts b/src/tools/plan-deviation.ts index f0110747e..04843827d 100644 --- a/src/tools/plan-deviation.ts +++ b/src/tools/plan-deviation.ts @@ -15,7 +15,7 @@ import { RuntimeInteractionOutcomes, RuntimeInteractionTypes, supportsHostedSessionInteraction, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; const PARAMETERS = Type.Object( { diff --git a/src/tools/plan-written.ts b/src/tools/plan-written.ts index eca61c7e3..e1286db97 100644 --- a/src/tools/plan-written.ts +++ b/src/tools/plan-written.ts @@ -46,7 +46,7 @@ import { requestHostedSessionInteraction, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; import { appendSessionCompleteGuidance, requestPlanReviewRetryConfirmation, diff --git a/src/tools/user-interview.ts b/src/tools/user-interview.ts index b77df4d93..1c8a75318 100644 --- a/src/tools/user-interview.ts +++ b/src/tools/user-interview.ts @@ -10,12 +10,12 @@ import type { HostedSession } from "../shared/session/hosted-session.js"; import type { RuntimeInteractionRequest, RuntimeInteractionResponse, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; import { requestHostedSessionInteraction, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../shared/session/session-runtime-interactions.js"; +} from "../shared/session/session-runtime-interactions.ts"; const OTHER_VALUE = "other"; const RECOMMENDED_SUFFIX_PATTERN = /\s*\(recommended\)\s*$/i; diff --git a/src/ui/tui/golden-scenarios/role-journeys.ts b/src/ui/tui/golden-scenarios/role-journeys.ts index b799aecc9..ebd58f594 100644 --- a/src/ui/tui/golden-scenarios/role-journeys.ts +++ b/src/ui/tui/golden-scenarios/role-journeys.ts @@ -4,7 +4,7 @@ */ import type { GoldenScenario } from "../testing/scenario-runner.js"; -import type { RuntimeInteractionRequest } from "../../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../../../shared/session/session-runtime-interactions.ts"; import type { WorktreeRegistryEntry } from "../../../shared/worktree-registry.js"; import { ok as assert } from "node:assert/strict"; diff --git a/src/ui/tui/runtime-interaction-adapter.test.ts b/src/ui/tui/runtime-interaction-adapter.test.ts index e087835ec..935d3b2c9 100644 --- a/src/ui/tui/runtime-interaction-adapter.test.ts +++ b/src/ui/tui/runtime-interaction-adapter.test.ts @@ -7,12 +7,12 @@ import { NO_OPEN_BROWSER_PORT } from "../../shared/browser-port.ts"; import { createTuiInteractionAdapter as createAdapterImplementation } from "./runtime-interaction-adapter.ts"; import { getStoredPlanPath, savePlan } from "../../plan-store.js"; import { createScriptedReviewBrowser } from "../review/review-test-fixture.ts"; -import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.js"; +import { RuntimeInteractionTypes } from "../../shared/session/session-runtime-interactions.ts"; import { ToolExecutionBlock } from "./blocks.js"; import { initRunWieldTheme } from "../theme/theme.ts"; import type { SelectOption, UiAPI } from "./types.js"; -import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.ts"; import type { ReviewSurface } from "../review/review-launcher.ts"; interface ReviewUiState { diff --git a/src/ui/tui/runtime-interaction-adapter.ts b/src/ui/tui/runtime-interaction-adapter.ts index 14ded9967..814e3eb5d 100644 --- a/src/ui/tui/runtime-interaction-adapter.ts +++ b/src/ui/tui/runtime-interaction-adapter.ts @@ -7,7 +7,7 @@ import { isApprovalAcceptedValue, RuntimeInteractionOutcomes, RuntimeInteractionTypes, -} from "../../shared/session/session-runtime-interactions.js"; +} from "../../shared/session/session-runtime-interactions.ts"; import { runCodeReview } from "../review/code-review.ts"; import { submitPlanForReview } from "../review/plan-review.ts"; import { startArtifactReadSurface } from "../review/review-launcher.ts"; @@ -16,7 +16,7 @@ import type { BrowserPort } from "../../shared/browser-port.ts"; import type { RuntimeInteractionAdapter, RuntimeInteractionRequest, -} from "../../shared/session/session-runtime-interactions.js"; +} from "../../shared/session/session-runtime-interactions.ts"; import type { UiAPI } from "./types.js"; export interface TuiInteractionPorts { diff --git a/src/ui/tui/session-snapshot-window.test.ts b/src/ui/tui/session-snapshot-window.test.ts index 01f2c0e2a..bce583a05 100644 --- a/src/ui/tui/session-snapshot-window.test.ts +++ b/src/ui/tui/session-snapshot-window.test.ts @@ -6,7 +6,7 @@ import { withRuntimeCommandFixture } from "../../cmd/testing/runtime-command-fix import { createSessionRuntime, type SessionRuntime } from "../../shared/session/session-runtime.ts"; import { createSessionSnapshotWindow } from "./session-snapshot-window.ts"; import { RuntimeEventTypes } from "../../shared/session/session-runtime-events.js"; -import type { RuntimeInteractionResponse } from "../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionResponse } from "../../shared/session/session-runtime-interactions.ts"; import { tuiSessionSidebarProjection } from "./session-sidebar.ts"; async function withSessions(run: (runtime: SessionRuntime, first: string, second: string) => void) { diff --git a/src/ui/tui/testing/scenario-runner.js b/src/ui/tui/testing/scenario-runner.js index 9ae8cde18..1ca073987 100644 --- a/src/ui/tui/testing/scenario-runner.js +++ b/src/ui/tui/testing/scenario-runner.js @@ -2499,7 +2499,7 @@ async function runComposedTuiScenario(scenario, options) { events.push("terminal:autocomplete:/he"); } else if (typed.type === "runtimeInteraction") { const request = - /** @type {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} */ ( + /** @type {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} */ ( typed.request || {} ); activeScriptedInteractionType = diff --git a/src/ui/workspace/components/SessionTimeline.jsx b/src/ui/workspace/components/SessionTimeline.jsx index 092c78b32..ebb3372fc 100644 --- a/src/ui/workspace/components/SessionTimeline.jsx +++ b/src/ui/workspace/components/SessionTimeline.jsx @@ -645,7 +645,7 @@ export function sessionInteractionChoiceResponse(requestType, request, choice) { const choiceValue = text(choiceRecord.value || choiceLabel); if (requestType === RuntimeInteractionTypes.APPROVAL) { const accepted = isApprovalAcceptedValue( - /** @type {import("../../../shared/session/session-runtime-interactions.js").RuntimeInteractionRequest} */ + /** @type {import("../../../shared/session/session-runtime-interactions.ts").RuntimeInteractionRequest} */ (request), choiceValue, ); diff --git a/src/ui/workspace/plan-workflow-gates.integration.test.ts b/src/ui/workspace/plan-workflow-gates.integration.test.ts index ff681361d..42df72dad 100644 --- a/src/ui/workspace/plan-workflow-gates.integration.test.ts +++ b/src/ui/workspace/plan-workflow-gates.integration.test.ts @@ -1,6 +1,6 @@ import { mkdtemp as fsMkdtemp, rm as fsRm, writeFile as fsWriteFile } from "node:fs/promises"; import { test } from "node:test"; -import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.ts"; import type { OwnerPlanProgress } from "./server/owner-plan-progress.ts"; import type { WorkspacePlanReviewStarted } from "./server/session-continuation.js"; import { tmpdir } from "node:os"; diff --git a/src/ui/workspace/plan-workflow-review.integration.test.ts b/src/ui/workspace/plan-workflow-review.integration.test.ts index c8c6a6f2a..9c4bea750 100644 --- a/src/ui/workspace/plan-workflow-review.integration.test.ts +++ b/src/ui/workspace/plan-workflow-review.integration.test.ts @@ -1,5 +1,5 @@ import type { FileSessionGeneration } from "../../shared/session/file-session-store-types.ts"; -import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.js"; +import type { RuntimeInteractionRequest } from "../../shared/session/session-runtime-interactions.ts"; import { readFile as fsReadFile, rm as fsRm, stat as fsStat } from "node:fs/promises"; import { test } from "node:test"; import { recordPlanEvent } from "../../shared/workflow/plan-lifecycle.js"; diff --git a/src/ui/workspace/server/session-continuation.js b/src/ui/workspace/server/session-continuation.js index cfd4e2d83..fcd766c7b 100644 --- a/src/ui/workspace/server/session-continuation.js +++ b/src/ui/workspace/server/session-continuation.js @@ -128,7 +128,7 @@ function browserTimelineProjection(projection) { }; } -/** @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} request */ +/** @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} request */ function safePlanReviewReference(request) { const meta = request._meta && typeof request._meta === "object" ? request._meta : {}; const triageMeta = @@ -178,7 +178,7 @@ function safePlanReviewReference(request) { }; } -/** @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} request */ +/** @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} request */ function safeCodeReviewReference(request) { const meta = request._meta && typeof request._meta === "object" ? request._meta : {}; const rawPatch = typeof meta.diffText === "string" ? meta.diffText : ""; @@ -206,7 +206,7 @@ function safeCodeReviewReference(request) { }; } -/** @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} request */ +/** @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} request */ function safeArtifactReviewReference(request) { const meta = request._meta && typeof request._meta === "object" ? request._meta : {}; const artifactId = typeof meta.artifactId === "string" ? meta.artifactId.trim() : ""; @@ -234,7 +234,7 @@ function readPlanReviewDecisionMeta(response) { return decision; } -/** @param {unknown} response @returns {import("../../../shared/session/session-runtime-interactions.js").RuntimeInteractionResponse} */ +/** @param {unknown} response @returns {import("../../../shared/session/session-runtime-interactions.ts").RuntimeInteractionResponse} */ function acceptedInteractionResponse(response) { if (response && typeof response === "object") { const source = /** @type {Record} */ (response); @@ -334,7 +334,7 @@ async function readSessionDisplayName(paths) { * @property {{ agentName?: string, model?: string, provider?: string }} [pendingConfiguration] * @property {{ interactionId: string, request: Record }} [liveInteraction] * @property {import('../../../shared/session/notification-content.ts').BrowserNotificationPolicy} [browserNotificationPolicy] - * @property {{ resolve: (value: import("../../../shared/session/session-runtime-interactions.js").RuntimeInteractionResponse) => void | Promise, reject: (error: Error) => void } | null} [answer] + * @property {{ resolve: (value: import("../../../shared/session/session-runtime-interactions.ts").RuntimeInteractionResponse) => void | Promise, reject: (error: Error) => void } | null} [answer] */ /** @@ -1297,7 +1297,7 @@ export class WorkspaceSessionContinuationService { /** * @param {string} operationId - * @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} request + * @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} request * @param {NonNullable} answer */ registerInteraction(operationId, request, answer) { @@ -1348,7 +1348,7 @@ export class WorkspaceSessionContinuationService { prompt: request.prompt, options: Array.isArray(request.options) ? request.options.map( - /** @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionOption} option */ ( + /** @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionOption} option */ ( option, ) => ({ value: option.value, @@ -1375,7 +1375,7 @@ export class WorkspaceSessionContinuationService { createInteractionAdapter(options) { return { supportsInteraction: () => true, - /** @param {import('../../../shared/session/session-runtime-interactions.js').RuntimeInteractionRequest} request @param {AbortSignal} [signal] */ + /** @param {import('../../../shared/session/session-runtime-interactions.ts').RuntimeInteractionRequest} request @param {AbortSignal} [signal] */ requestInteraction: async (request, signal) => { const reviewPlanId = request.type === "plan_review" ? safePlanReviewReference(request)?.planId : null; if (reviewPlanId) {