diff --git a/docs/plans/remote-ssh-development/07-carry-remote-context-through-delivery-workflows.md b/docs/plans/remote-ssh-development/07-carry-remote-context-through-delivery-workflows.md index 7460eeb2b..78f3c3c6b 100644 --- a/docs/plans/remote-ssh-development/07-carry-remote-context-through-delivery-workflows.md +++ b/docs/plans/remote-ssh-development/07-carry-remote-context-through-delivery-workflows.md @@ -76,7 +76,7 @@ The remote Core process runs on the server, so project work already lands in the ### Smaller gaps -- **Swallowed save errors.** Workflow code catches some Session-save errors and continues (`workflow-context-session.js`, +- **Swallowed save errors.** Workflow code catches some Session-save errors and continues (`workflow-context-session.ts`, `hosted-session.js`, `plan-written.ts`, `runtime/workflows.ts`). In remote mode, a save fault is sticky and stops the Agent. Git, worktree, CI, and Plan-file work can still start until something touches the manager again. - **Background task logs.** `background-tasks.ts` writes logs to `~/.wld/sessions///` on the diff --git a/scripts/language-policy-baseline.json b/scripts/language-policy-baseline.json index 227772ec8..8d065cbe3 100644 --- a/scripts/language-policy-baseline.json +++ b/scripts/language-policy-baseline.json @@ -18,7 +18,6 @@ "src/shared/session/session-transcript-projection.js", "src/shared/session/session.js", "src/shared/session/types.js", - "src/shared/session/workflow-context-session.js", "src/shared/settings.js", "src/shared/types.js", "src/shared/work-records/auto-generation.js", diff --git a/src/extensions/re-anchor/index.ts b/src/extensions/re-anchor/index.ts index fd3d52760..9b17e0b38 100644 --- a/src/extensions/re-anchor/index.ts +++ b/src/extensions/re-anchor/index.ts @@ -18,7 +18,7 @@ import type { ContextEvent, ExtensionAPI, SessionCompactEvent } from "@earendil- import { buildReAnchorMessage, type ReAnchorContext } from "../../shared/workflow/workflow-prompts.ts"; import { projectEngineerPlanBody } from "../../shared/workflow/engineer-plan-projection.ts"; import { getStoredPlanPath } from "../../plan-store.js"; -import { normalizeWorkflowPlanName } from "../../shared/session/workflow-context-session.js"; +import { normalizeWorkflowPlanName } from "../../shared/session/workflow-context-session.ts"; import { normalizeLedger, renderOpenItems } from "../../shared/workflow/review-ledger.ts"; import type { HostedSession } from "../../shared/session/hosted-session.js"; diff --git a/src/shared/owner-coordination/sessions.js b/src/shared/owner-coordination/sessions.js index 4dcedacb0..29b9545fb 100644 --- a/src/shared/owner-coordination/sessions.js +++ b/src/shared/owner-coordination/sessions.js @@ -18,7 +18,7 @@ import { normalizeSegmentLineageEvidence, PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE, SEGMENT_LINEAGE_CUSTOM_TYPE, -} from "../session/workflow-context-session.js"; +} from "../session/workflow-context-session.ts"; import { getProjectById, listProjectRootEvidence } from "./projects.ts"; /** diff --git a/src/shared/remote/remote-runtime-test-client.ts b/src/shared/remote/remote-runtime-test-client.ts index 7d5558443..73369bdbe 100644 --- a/src/shared/remote/remote-runtime-test-client.ts +++ b/src/shared/remote/remote-runtime-test-client.ts @@ -25,7 +25,7 @@ import { SessionManager, type ToolDefinition } from "@earendil-works/pi-coding-a import { buildAgentSession } from "../session/session.js"; import { createRemoteRootSessionManager, getRemoteSessionSaveBridge } from "../session/root-session.js"; import { readImageRef } from "../session/image-attachments.ts"; -import { recordNormalizedWorkflowContext } from "../session/workflow-context-session.js"; +import { recordNormalizedWorkflowContext } from "../session/workflow-context-session.ts"; import { recordTutorialContext } from "../session/tutorial-context-session.ts"; import { appendExecutionWorkflowSnapshot } from "../session/execution-workflow-session.ts"; import { runResumeCommand } from "../../cmd/resume/index.ts"; @@ -134,7 +134,7 @@ export interface RuntimeClientReport { reviewKind?: string; canReopen?: boolean; rollover?: import("../session/segment-rollover.ts").SegmentRolloverResult; - workflowContext?: import("../session/workflow-context-session.js").WorkflowContext | null; + workflowContext?: import("../session/workflow-context-session.ts").WorkflowContext | null; tutorialContext?: import("../session/tutorial-context-session.ts").TutorialContext | null; activeWorkflow?: import("../types.js").ActiveExecutionWorkflow | null; piSessionId?: string; diff --git a/src/shared/remote/remote-runtime-workflows-records-reads.test.ts b/src/shared/remote/remote-runtime-workflows-records-reads.test.ts index d73ad69ba..fbfac8147 100644 --- a/src/shared/remote/remote-runtime-workflows-records-reads.test.ts +++ b/src/shared/remote/remote-runtime-workflows-records-reads.test.ts @@ -16,7 +16,7 @@ import { readPersistedPendingSegmentContinuationEntry, recordPendingSegmentContinuation, recordNormalizedWorkflowContext, -} from "../session/workflow-context-session.js"; +} from "../session/workflow-context-session.ts"; import { recordTutorialContext } from "../session/tutorial-context-session.ts"; import { appendExecutionWorkflowSnapshot } from "../session/execution-workflow-session.ts"; import { parseRemoteSessionTranscript } from "./session-protocol.ts"; diff --git a/src/shared/session/execution-segment-runtime.test.ts b/src/shared/session/execution-segment-runtime.test.ts index 65c83ea4e..14bf7d77f 100644 --- a/src/shared/session/execution-segment-runtime.test.ts +++ b/src/shared/session/execution-segment-runtime.test.ts @@ -12,7 +12,7 @@ import { RuntimeEventTypes } from "./session-runtime-events.js"; import { readPersistedPendingSegmentContinuation, readPersistedSegmentLineageEvidence, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; import { buildExecutionSegmentContinuation } from "../workflow/execution-segment-handoff.ts"; import { loadPlanActionEvidence } from "../workflow/plan-actions.ts"; diff --git a/src/shared/session/execution-workflow-recovery.ts b/src/shared/session/execution-workflow-recovery.ts index 36e0fced9..2d6da00e0 100644 --- a/src/shared/session/execution-workflow-recovery.ts +++ b/src/shared/session/execution-workflow-recovery.ts @@ -5,7 +5,7 @@ import type { SessionManager } from "@earendil-works/pi-coding-agent"; import type { ActiveExecutionWorkflow } from "../types.js"; import { readExecutionWorkflowSnapshot } from "./execution-workflow-session.ts"; import { readPersistedActiveAgentName } from "./active-agent-session.ts"; -import { readPersistedWorkflowContext } from "./workflow-context-session.js"; +import { readPersistedWorkflowContext } from "./workflow-context-session.ts"; import { readPlanAssociations } from "./plan-association.ts"; import { listEntries } from "../worktree-registry.js"; import { loadPlan } from "../../plan-store.js"; diff --git a/src/shared/session/file-session-lineage.ts b/src/shared/session/file-session-lineage.ts index 5bbd5d747..f130ba1a4 100644 --- a/src/shared/session/file-session-lineage.ts +++ b/src/shared/session/file-session-lineage.ts @@ -9,7 +9,7 @@ import { normalizeSegmentLineageEvidence, PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE, SEGMENT_LINEAGE_CUSTOM_TYPE, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; import { readPlanAssociations } from "./plan-association.ts"; import { FILE_SESSION_STORE_VERSION, isoNow } from "./file-session-storage.ts"; import type { diff --git a/src/shared/session/file-session-store.ts b/src/shared/session/file-session-store.ts index 2da808a96..2d29e4c86 100644 --- a/src/shared/session/file-session-store.ts +++ b/src/shared/session/file-session-store.ts @@ -14,7 +14,7 @@ import type { import type { RemoteArtifactOptions, RemotePlanReview } from "../remote/session-protocol.ts"; import { readExecutionWorkflowSnapshot } from "./execution-workflow-session.ts"; import { readPersistedTutorialContext } from "./tutorial-context-session.ts"; -import { readPersistedWorkflowContext } from "./workflow-context-session.js"; +import { readPersistedWorkflowContext } from "./workflow-context-session.ts"; import { findProject, sessionDirForProject } from "./file-session-storage.ts"; import type { ManagedSessionMetadata } from "./hosted-session.js"; import type { RemoteRolloverOptions, RemoteRolloverReceipt } from "../remote/session-protocol.ts"; diff --git a/src/shared/session/hosted-session.js b/src/shared/session/hosted-session.js index fd65df820..d29e37b18 100644 --- a/src/shared/session/hosted-session.js +++ b/src/shared/session/hosted-session.js @@ -19,7 +19,7 @@ import { recordWorkflowPlanName, recordWorkflowTriageContext, workflowContextsEqual, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; import { emitHostedSessionRuntimeEvent, RuntimeEventTypes } from "./session-runtime-events.js"; import { clearPairCheckpoint } from "./pair-checkpoint-session.ts"; import { recordExecutionWorkflowSnapshot } from "./execution-workflow-session.ts"; @@ -137,7 +137,7 @@ import { PlanReviewConversationOwner } from "./plan-review-conversation.ts"; * @property {string | null} [model] * @property {string | null} [provider] * @property {string | null} [thinkingLevel] - * @property {import('./workflow-context-session.js').WorkflowContext | null} workflowContext + * @property {import('./workflow-context-session.ts').WorkflowContext | null} workflowContext * @property {import('./tutorial-context-session.ts').TutorialContext | null} [tutorialContext] */ @@ -271,7 +271,7 @@ export class HostedSession { this.delegatedReaderCount = 0; this.delegatedWriterActive = false; this.projectStateContext = ""; - /** @type {import('./workflow-context-session.js').WorkflowContext | null} */ + /** @type {import('./workflow-context-session.ts').WorkflowContext | null} */ this.workflowContext = readPersistedWorkflowContext( /** @type {import('@earendil-works/pi-coding-agent').SessionManager | null} */ (this.rootSessionManager), ); @@ -1032,7 +1032,7 @@ export class HostedSession { } /** - * @param {import('./workflow-context-session.js').WorkflowContext | null} nextContext + * @param {import('./workflow-context-session.ts').WorkflowContext | null} nextContext * @param {{ persist?: boolean }} options */ replaceWorkflowContext(nextContext, options = {}) { @@ -1106,7 +1106,7 @@ export class HostedSession { } } - /** @param {import('./workflow-context-session.js').WorkflowContextInput} details */ + /** @param {import('./workflow-context-session.ts').WorkflowContextInput} details */ setWorkflowExecutionContext(details) { if (this.disposed) return; const nextContext = deriveWorkflowContextFromExecutionWorkflow(details); diff --git a/src/shared/session/hosted-session.test.js b/src/shared/session/hosted-session.test.js index 5bc96dcc8..feabbffc6 100644 --- a/src/shared/session/hosted-session.test.js +++ b/src/shared/session/hosted-session.test.js @@ -3,7 +3,7 @@ import { test } from "node:test"; import { ok as assert, strictEqual as assertStrictEquals } from "node:assert/strict"; import { assertEquals, assertThrows } from "../../testing/assertions.ts"; import { HostedSession } from "./hosted-session.js"; -import { WORKFLOW_CONTEXT_CUSTOM_TYPE } from "./workflow-context-session.js"; +import { WORKFLOW_CONTEXT_CUSTOM_TYPE } from "./workflow-context-session.ts"; import { TUTORIAL_CONTEXT_CUSTOM_TYPE } from "./tutorial-context-session.ts"; /** diff --git a/src/shared/session/runtime/lifecycle-loading.ts b/src/shared/session/runtime/lifecycle-loading.ts index 84195a7f3..c78309231 100644 --- a/src/shared/session/runtime/lifecycle-loading.ts +++ b/src/shared/session/runtime/lifecycle-loading.ts @@ -11,7 +11,7 @@ import { createSessionRuntimeEvent, RuntimeEventTypes } from ".././session-runti import { createReplayEvents as createProjectedReplayEvents } from ".././session-transcript-projection.js"; import { requestHostedSessionInteraction } from ".././session-runtime-interactions.ts"; import { sessionDirForRoot } from ".././file-session-storage.ts"; -import { recordSegmentLineageEvidence } from ".././workflow-context-session.js"; +import { recordSegmentLineageEvidence } from ".././workflow-context-session.ts"; import { isAbsolute } from "node:path"; import { enterGitProjectRuntime, isRuntimeRootSessionManager } from "./support.ts"; diff --git a/src/shared/session/runtime/lifecycle.ts b/src/shared/session/runtime/lifecycle.ts index e9a9970fd..e67cc506e 100644 --- a/src/shared/session/runtime/lifecycle.ts +++ b/src/shared/session/runtime/lifecycle.ts @@ -9,7 +9,7 @@ import { } from ".././root-session.js"; import { RuntimeEventTypes } from ".././session-runtime-events.js"; import { captureTranscriptEvidence, syncTranscriptFileAndParent } from ".././session-transcript-projection.js"; -import { recordSegmentLineageEvidence } from ".././workflow-context-session.js"; +import { recordSegmentLineageEvidence } from ".././workflow-context-session.ts"; import { isAbsolute } from "node:path"; import type { PromptReadySessionOptions } from "./types.ts"; @@ -290,7 +290,7 @@ export class RuntimeLifecycle { model?: string | null; provider?: string | null; thinkingLevel?: string | null; - workflowContext?: import(".././workflow-context-session.js").WorkflowContext | null; + workflowContext?: import(".././workflow-context-session.ts").WorkflowContext | null; tutorialContext?: import("../tutorial-context-session.ts").TutorialContext | null; }) { const cataloged = options?.session; diff --git a/src/shared/session/runtime/managed-operations.ts b/src/shared/session/runtime/managed-operations.ts index 45080f42f..3cb714d8c 100644 --- a/src/shared/session/runtime/managed-operations.ts +++ b/src/shared/session/runtime/managed-operations.ts @@ -10,7 +10,7 @@ import { isPathInside, openPersistedRootSession } from ".././root-session.js"; import { RuntimeEventTypes } from ".././session-runtime-events.js"; import { captureTranscriptEvidence, syncTranscriptFileAndParent } from ".././session-transcript-projection.js"; import { openLiveSessionConnection } from ".././live-session-connection.ts"; -import { recordSegmentLineageEvidence } from ".././workflow-context-session.js"; +import { recordSegmentLineageEvidence } from ".././workflow-context-session.ts"; import { parseProviderModel } from "../../models/model-validation.ts"; import { sessionDirForRoot } from ".././file-session-storage.ts"; import { AsyncLocalStorage } from "node:async_hooks"; diff --git a/src/shared/session/runtime/managed-sync.ts b/src/shared/session/runtime/managed-sync.ts index f06f8ff7c..85844c837 100644 --- a/src/shared/session/runtime/managed-sync.ts +++ b/src/shared/session/runtime/managed-sync.ts @@ -3,7 +3,7 @@ import { captureTranscriptEvidence, toProjectionFailure } from ".././session-tra import { projectAggregateTranscript } from ".././session-transcript-manifest.ts"; import { dirname } from "node:path"; import { normalizeTutorialContext } from "../tutorial-context-session.ts"; -import { normalizeWorkflowContext } from "../workflow-context-session.js"; +import { normalizeWorkflowContext } from "../workflow-context-session.ts"; import { reconcileLegacyCompletion } from "../workflow-context-recovery.ts"; import { isSameManagedSyncState, restorePublishedSessionProjectRoot } from "./support.ts"; diff --git a/src/shared/session/runtime/reads.ts b/src/shared/session/runtime/reads.ts index ecfcda832..3493d0071 100644 --- a/src/shared/session/runtime/reads.ts +++ b/src/shared/session/runtime/reads.ts @@ -38,7 +38,7 @@ import { } from "../session-export.ts"; import { listRecentResumableSessions } from ".././session-resume-list.ts"; import { buildSessionContextReport } from ".././session-context-report.ts"; -import { deriveWorkflowContextFromExecutionWorkflow } from ".././workflow-context-session.js"; +import { deriveWorkflowContextFromExecutionWorkflow } from ".././workflow-context-session.ts"; import { dirname, isAbsolute } from "node:path"; import { diff --git a/src/shared/session/runtime/remote-persistence.ts b/src/shared/session/runtime/remote-persistence.ts index c4f2aba62..a324c86cf 100644 --- a/src/shared/session/runtime/remote-persistence.ts +++ b/src/shared/session/runtime/remote-persistence.ts @@ -5,7 +5,7 @@ import { reasonForCandidate } from "../plan-session-lookup.ts"; import { restoreExecutionWorkflow } from "../execution-workflow-recovery.ts"; import { SessionManager } from "@earendil-works/pi-coding-agent"; import { readPersistedTutorialContext } from "../tutorial-context-session.ts"; -import { readPersistedWorkflowContext } from "../workflow-context-session.js"; +import { readPersistedWorkflowContext } from "../workflow-context-session.ts"; import type { RemotePlanSessionQuery, RemoteRolloverOptions, diff --git a/src/shared/session/runtime/support.ts b/src/shared/session/runtime/support.ts index 522aabb68..61660af8e 100644 --- a/src/shared/session/runtime/support.ts +++ b/src/shared/session/runtime/support.ts @@ -6,7 +6,7 @@ import { parseProviderModel } from "../../models/model-validation.ts"; import { getSettingsManager } from "../../settings.js"; import { isGitRepository } from "../../git.ts"; import { preparePlanController } from "../../workflow/plan-preparation.ts"; -import { readPersistedWorkflowContext } from ".././workflow-context-session.js"; +import { readPersistedWorkflowContext } from ".././workflow-context-session.ts"; import { createPairCheckpointTool } from "../../../tools/pair-checkpoint.ts"; import { formatPairCheckpointContext, restorePairExecutionState } from ".././pair-checkpoint-session.ts"; import { loadPlan } from "../../../plan-store.js"; diff --git a/src/shared/session/runtime/workflows.ts b/src/shared/session/runtime/workflows.ts index 5879f8250..d61c786f7 100644 --- a/src/shared/session/runtime/workflows.ts +++ b/src/shared/session/runtime/workflows.ts @@ -4,7 +4,7 @@ import { AGENTS, SUBAGENTS } from "../../../constants.js"; import { resolvePlanExecutionRuntimeAgent } from "../../workflow/execution-agent.ts"; import { runActiveAgentTurn } from ".././agent-switching.ts"; import { emitSystemStatus, RuntimeEventTypes } from ".././session-runtime-events.js"; -import { readPersistedPendingSegmentContinuationEntry } from ".././workflow-context-session.js"; +import { readPersistedPendingSegmentContinuationEntry } from ".././workflow-context-session.ts"; import { prepareSessionPlanningWorktree } from "../../workflow/session-planning-worktree.ts"; import { executePlanAction } from "../../workflow/plan-actions.ts"; diff --git a/src/shared/session/segment-rollover.test.ts b/src/shared/session/segment-rollover.test.ts index 4559c29aa..939666d36 100644 --- a/src/shared/session/segment-rollover.test.ts +++ b/src/shared/session/segment-rollover.test.ts @@ -15,7 +15,7 @@ import { readPersistedPendingSegmentContinuation, recordPendingSegmentContinuation, recordSegmentLineageEvidence, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; import { readExecutionWorkflowSnapshot } from "./execution-workflow-session.ts"; import type { ActiveExecutionWorkflow } from "../types.js"; import { type TutorialContext, readPersistedTutorialContext } from "./tutorial-context-session.ts"; diff --git a/src/shared/session/segment-rollover.ts b/src/shared/session/segment-rollover.ts index d2f7768b3..b89ad0740 100644 --- a/src/shared/session/segment-rollover.ts +++ b/src/shared/session/segment-rollover.ts @@ -12,7 +12,7 @@ import { recordNormalizedWorkflowContext, recordPendingSegmentContinuation, recordSegmentLineageEvidence, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; import { appendExecutionWorkflowSnapshot } from "./execution-workflow-session.ts"; import { recordTutorialContext } from "./tutorial-context-session.ts"; import type { SegmentHandoffPayload } from "../workflow/execution-segment-handoff.ts"; diff --git a/src/shared/session/session-runtime-events.js b/src/shared/session/session-runtime-events.js index 61d1e15ea..2685bda53 100644 --- a/src/shared/session/session-runtime-events.js +++ b/src/shared/session/session-runtime-events.js @@ -165,7 +165,7 @@ export const RuntimeEventTypes = Object.freeze({ */ /** - * @typedef {RuntimeEventBase & { type: "workflow_context_changed", workflowContext: import('./workflow-context-session.js').WorkflowContext }} RuntimeWorkflowContextChangedEvent + * @typedef {RuntimeEventBase & { type: "workflow_context_changed", workflowContext: import('./workflow-context-session.ts').WorkflowContext }} RuntimeWorkflowContextChangedEvent */ /** diff --git a/src/shared/session/session-transcript-projection.js b/src/shared/session/session-transcript-projection.js index 0a07a6afc..3504fabd3 100644 --- a/src/shared/session/session-transcript-projection.js +++ b/src/shared/session/session-transcript-projection.js @@ -8,7 +8,7 @@ import { stat as fsStat } from "node:fs/promises"; import { dirname, resolve } from "node:path"; import { ACTIVE_AGENT_CUSTOM_TYPE, readActiveAgentFromEntry } from "./active-agent-session.ts"; -import { readPersistedWorkflowContext } from "./workflow-context-session.js"; +import { readPersistedWorkflowContext } from "./workflow-context-session.ts"; import { readPersistedTutorialContext } from "./tutorial-context-session.ts"; import { readPlanAssociations } from "./plan-association.ts"; import { normalizeRuntimeToolResult, normalizeRuntimeUsage, RuntimeEventTypes } from "./session-runtime-events.js"; diff --git a/src/shared/session/workflow-context-recovery.ts b/src/shared/session/workflow-context-recovery.ts index 6fb08629a..92ff94f25 100644 --- a/src/shared/session/workflow-context-recovery.ts +++ b/src/shared/session/workflow-context-recovery.ts @@ -1,4 +1,4 @@ -import type { WorkflowContext } from "./workflow-context-session.js"; +import type { WorkflowContext } from "./workflow-context-session.ts"; import { loadPlanActionEvidence } from "../workflow/plan-actions.ts"; // Legacy transcripts lack accepted progress. Reconcile only confirmed same-Plan delivery, diff --git a/src/shared/session/workflow-context-session.test.ts b/src/shared/session/workflow-context-session.test.ts index ebf17f4aa..3b1095be3 100644 --- a/src/shared/session/workflow-context-session.test.ts +++ b/src/shared/session/workflow-context-session.test.ts @@ -1,7 +1,7 @@ import { assertEquals } from "../../testing/assertions.ts"; import { test } from "node:test"; import { SessionManager } from "@earendil-works/pi-coding-agent"; -import type { WorkflowContext } from "./workflow-context-session.js"; +import type { WorkflowContext } from "./workflow-context-session.ts"; import type { WorkflowProgressFact } from "../workflow/workflow-presentation.ts"; import { deriveWorkflowContextFromExecutionWorkflow, @@ -12,7 +12,7 @@ import { recordWorkflowPlanName, recordWorkflowTriageContext, WORKFLOW_CONTEXT_CUSTOM_TYPE, -} from "./workflow-context-session.js"; +} from "./workflow-context-session.ts"; interface FixtureWorkflowEntry { type: "custom"; diff --git a/src/shared/session/workflow-context-session.js b/src/shared/session/workflow-context-session.ts similarity index 56% rename from src/shared/session/workflow-context-session.js rename to src/shared/session/workflow-context-session.ts index 362711dba..5fba51175 100644 --- a/src/shared/session/workflow-context-session.js +++ b/src/shared/session/workflow-context-session.ts @@ -6,66 +6,131 @@ import { COMPLEXITIES, normalizeRoutingIntent } from "../../constants.js"; -export const WORKFLOW_CONTEXT_CUSTOM_TYPE = "runwield.workflow_context"; -export const SEGMENT_LINEAGE_CUSTOM_TYPE = "runwield.segment_lineage"; -export const PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE = "runwield.pending_segment_continuation"; +import type { SessionManager } from "@earendil-works/pi-coding-agent"; +import type { SegmentHandoffPayload } from "../workflow/execution-segment-handoff.ts"; +import type { RuntimeValidationProgress } from "./session-runtime-events.js"; +import type { WorkflowProgressFact } from "../workflow/workflow-presentation.ts"; +import type { SessionSegmentLineageEvidence } from "../types.js"; + +export interface LineageSessionManager { + appendCustomEntry?: (customType: string, data: SessionSegmentLineageEvidence) => string | void; + getBranch?: () => unknown[]; + getEntries?: () => unknown[]; +} -/** @typedef {import('../workflow/execution-segment-handoff.ts').SegmentHandoffPayload} SegmentHandoffPayload */ -/** @typedef {import('./session-runtime-events.js').RuntimeValidationProgress} RuntimeValidationProgress */ +export type WorkflowContext = { + routingIntent?: string; + complexity?: string; + summary?: string; + planName?: string; + parentPlan?: string; + planId?: string; + status?: string; + classification?: string; + progressFacts?: WorkflowProgressFact[]; + validationProgress?: RuntimeValidationProgress; + canRun?: boolean; + canResume?: boolean; + canRecover?: boolean; + liveQuestion?: boolean; + livePlanReview?: boolean; + liveCodeReview?: boolean; + liveReviewUrl?: string; +}; + +export interface WorkflowContextTriageMeta { + routingIntent?: string; + classification?: string; + complexity?: string; + parentPlan?: string; + planId?: string; + status?: string; + validationCheckpoint?: unknown; + publication?: unknown; + worktreeStatus?: string | null; +} -/** - * @typedef {Object} LineageSessionManager - * @property {(customType: string, data: import('../types.js').SessionSegmentLineageEvidence) => string | void} [appendCustomEntry] - * @property {() => unknown[]} [getBranch] - * @property {() => unknown[]} [getEntries] - */ +export interface WorkflowContextInput { + planName?: string | null; + triageMeta?: WorkflowContextTriageMeta | null; +} -/** - * @typedef {Object} WorkflowContext - * @property {string} [routingIntent] - * @property {string} [complexity] - * @property {string} [summary] - * @property {string} [planName] - * @property {string} [parentPlan] - * @property {string} [planId] - * @property {string} [status] - * @property {string} [classification] - * @property {Array} [progressFacts] - * @property {import('./session-runtime-events.js').RuntimeValidationProgress} [validationProgress] - * @property {boolean} [canRun] - * @property {boolean} [canResume] - * @property {boolean} [canRecover] - * @property {boolean} [liveQuestion] - * @property {boolean} [livePlanReview] - * @property {boolean} [liveCodeReview] - * @property {string} [liveReviewUrl] - */ +export interface WorkflowTriageContextDetails { + routingIntent: unknown; + complexity: unknown; + summary?: unknown; +} -/** - * @param {unknown} value - * @returns {string} - */ -export function normalizeWorkflowRoutingIntent(value) { +export interface PersistedSessionEntrySummary { + type?: string; + role?: string; + customType?: string; +} + +export interface PendingSegmentContinuationEntry { + payload: SegmentHandoffPayload; + entryIndex: number; + entries: PersistedSessionEntrySummary[]; +} + +interface RawWorkflowContext { + routingIntent?: unknown; + complexity?: unknown; + planName?: unknown; + parentPlan?: unknown; + summary?: unknown; + planId?: unknown; + status?: unknown; + classification?: unknown; + progressFacts?: unknown; + validationProgress?: unknown; + canRun?: unknown; + canResume?: unknown; + canRecover?: unknown; +} + +interface RawWorkflowValidationCheckpoint { + nextPhase?: unknown; + state?: unknown; + repairKind?: unknown; + updatedAt?: unknown; +} + +interface RawWorkflowPublication { + phase?: unknown; + failure?: unknown; + updatedAt?: unknown; +} + +interface PersistedCustomSessionEntry extends PersistedSessionEntrySummary { + data?: unknown; +} + +interface PersistedLineageEntry extends PersistedCustomSessionEntry { + data?: SessionSegmentLineageEvidence; +} + +interface PersistedContinuationEntry extends PersistedCustomSessionEntry { + data?: SegmentHandoffPayload; +} + +export const WORKFLOW_CONTEXT_CUSTOM_TYPE = "runwield.workflow_context"; +export const SEGMENT_LINEAGE_CUSTOM_TYPE = "runwield.segment_lineage"; +export const PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE = "runwield.pending_segment_continuation"; + +export function normalizeWorkflowRoutingIntent(value: unknown): string { if (typeof value !== "string") return ""; const normalized = normalizeRoutingIntent(value.trim().toUpperCase()); return normalized || ""; } -/** - * @param {unknown} value - * @returns {string} - */ -export function normalizeWorkflowComplexity(value) { +export function normalizeWorkflowComplexity(value: unknown): string { if (typeof value !== "string") return ""; const normalized = value.trim().toUpperCase(); return COMPLEXITIES.includes(normalized) ? normalized : ""; } -/** - * @param {unknown} value - * @returns {string} - */ -export function normalizeWorkflowPlanName(value) { +export function normalizeWorkflowPlanName(value: unknown): string { if (typeof value !== "string") return ""; return value .trim() @@ -75,17 +140,13 @@ export function normalizeWorkflowPlanName(value) { .trim(); } -/** - * @param {Record | null} triageMeta - * @returns {Array} - */ -function progressFactsFromTriageMeta(triageMeta) { +function progressFactsFromTriageMeta(triageMeta: WorkflowContextTriageMeta | null): WorkflowProgressFact[] { if (!triageMeta) return []; - /** @type {Array} */ - const facts = []; + + const facts: WorkflowProgressFact[] = []; const checkpoint = triageMeta.validationCheckpoint; if (checkpoint && typeof checkpoint === "object" && !Array.isArray(checkpoint)) { - const source = /** @type {Record} */ (checkpoint); + const source = checkpoint as RawWorkflowValidationCheckpoint; facts.push({ kind: "validation_checkpoint", phase: typeof source.nextPhase === "string" ? source.nextPhase : null, @@ -96,7 +157,7 @@ function progressFactsFromTriageMeta(triageMeta) { } const publication = triageMeta.publication; if (publication && typeof publication === "object" && !Array.isArray(publication)) { - const source = /** @type {Record} */ (publication); + const source = publication as RawWorkflowPublication; facts.push({ kind: "publication", phase: typeof source.phase === "string" ? source.phase : null, @@ -109,20 +170,15 @@ function progressFactsFromTriageMeta(triageMeta) { return facts; } -/** - * @param {unknown} value - * @returns {WorkflowContext | null} - */ -export function normalizeWorkflowContext(value) { +export function normalizeWorkflowContext(value: unknown): WorkflowContext | null { if (!value || typeof value !== "object") return null; - const data = /** @type {Record} */ (value); + const data = value as RawWorkflowContext; const routingIntent = normalizeWorkflowRoutingIntent(data.routingIntent); const complexity = normalizeWorkflowComplexity(data.complexity); const planName = normalizeWorkflowPlanName(data.planName); const parentPlan = normalizeWorkflowPlanName(data.parentPlan); - /** @type {WorkflowContext} */ - const context = {}; + const context: WorkflowContext = {}; if (routingIntent && complexity) { context.routingIntent = routingIntent; context.complexity = complexity; @@ -141,9 +197,7 @@ export function normalizeWorkflowContext(value) { .map((fact) => ({ ...fact })); } if (data.validationProgress && typeof data.validationProgress === "object") { - context.validationProgress = structuredClone( - /** @type {RuntimeValidationProgress} */ (data.validationProgress), - ); + context.validationProgress = structuredClone(data.validationProgress as RuntimeValidationProgress); } if (typeof data.canRun === "boolean") context.canRun = data.canRun; if (typeof data.canResume === "boolean") context.canResume = data.canResume; @@ -152,12 +206,10 @@ export function normalizeWorkflowContext(value) { return Object.keys(context).length > 0 ? context : null; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @param {{ routingIntent: unknown, complexity: unknown, summary?: unknown }} details - * @returns {WorkflowContext | null} - */ -export function recordWorkflowTriageContext(sessionManager, details) { +export function recordWorkflowTriageContext( + sessionManager: SessionManager | undefined | null, + details: WorkflowTriageContextDetails, +): WorkflowContext | null { const routingIntent = normalizeWorkflowRoutingIntent(details.routingIntent); const complexity = normalizeWorkflowComplexity(details.complexity); if (!routingIntent || !complexity) return readPersistedWorkflowContext(sessionManager); @@ -168,12 +220,10 @@ export function recordWorkflowTriageContext(sessionManager, details) { }); } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @param {unknown} planName - * @returns {WorkflowContext | null} - */ -export function recordWorkflowPlanName(sessionManager, planName) { +export function recordWorkflowPlanName( + sessionManager: SessionManager | undefined | null, + planName: unknown, +): WorkflowContext | null { const normalizedPlanName = normalizeWorkflowPlanName(planName); if (!normalizedPlanName) return readPersistedWorkflowContext(sessionManager); try { @@ -187,40 +237,19 @@ export function recordWorkflowPlanName(sessionManager, planName) { } } -/** - * @typedef {Object} WorkflowContextTriageMeta - * @property {string} [routingIntent] - * @property {string} [classification] - * @property {string} [complexity] - * @property {string} [parentPlan] - * @property {string} [planId] - * @property {string} [status] - * @property {unknown} [validationCheckpoint] - * @property {unknown} [publication] - * @property {string|null} [worktreeStatus] - */ - -/** - * @typedef {Object} WorkflowContextInput - * @property {string | null} [planName] - * @property {WorkflowContextTriageMeta | null} [triageMeta] - */ - -/** - * @param {WorkflowContextInput | null | undefined} workflow - * @param {unknown} [planName] - * @returns {WorkflowContext | null} - */ -export function deriveWorkflowContextFromExecutionWorkflow(workflow, planName) { +export function deriveWorkflowContextFromExecutionWorkflow( + workflow: WorkflowContextInput | null | undefined, + planName?: unknown, +): WorkflowContext | null { const triageMeta = workflow?.triageMeta && typeof workflow.triageMeta === "object" ? workflow.triageMeta : null; - const routingIntent = normalizeWorkflowRoutingIntent(triageMeta?.routingIntent) || + const routingIntent = + normalizeWorkflowRoutingIntent(triageMeta?.routingIntent) || normalizeWorkflowRoutingIntent(triageMeta?.classification); const complexity = normalizeWorkflowComplexity(triageMeta?.complexity); const normalizedPlanName = normalizeWorkflowPlanName(workflow?.planName || planName); const parentPlan = normalizeWorkflowPlanName(triageMeta?.parentPlan); - /** @type {WorkflowContext} */ - const context = {}; + const context: WorkflowContext = {}; if (routingIntent && complexity) { context.routingIntent = routingIntent; context.complexity = complexity; @@ -229,18 +258,16 @@ export function deriveWorkflowContextFromExecutionWorkflow(workflow, planName) { if (parentPlan) context.parentPlan = parentPlan; if (typeof triageMeta?.planId === "string" && triageMeta.planId.trim()) context.planId = triageMeta.planId.trim(); if (typeof triageMeta?.status === "string" && triageMeta.status.trim()) context.status = triageMeta.status.trim(); - const progressFacts = progressFactsFromTriageMeta(/** @type {Record | null} */ (triageMeta)); + const progressFacts = progressFactsFromTriageMeta(triageMeta); if (progressFacts.length) context.progressFacts = progressFacts; return Object.keys(context).length > 0 ? context : null; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @param {WorkflowContext | null | undefined} context - * @returns {WorkflowContext | null} - */ -export function recordNormalizedWorkflowContext(sessionManager, context) { +export function recordNormalizedWorkflowContext( + sessionManager: SessionManager | undefined | null, + context: WorkflowContext | null | undefined, +): WorkflowContext | null { const normalized = normalizeWorkflowContext(context); if (!normalized) return readPersistedWorkflowContext(sessionManager); if (!sessionManager?.appendCustomEntry) return normalized; @@ -256,11 +283,9 @@ export function recordNormalizedWorkflowContext(sessionManager, context) { return normalized; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @returns {WorkflowContext | null} - */ -export function readPersistedWorkflowContext(sessionManager) { +export function readPersistedWorkflowContext( + sessionManager: SessionManager | undefined | null, +): WorkflowContext | null { try { const entries = getSessionEntries(sessionManager); @@ -276,26 +301,17 @@ export function readPersistedWorkflowContext(sessionManager) { return null; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @param {WorkflowContext} context - * @returns {WorkflowContext | null} - */ -function recordWorkflowContext(sessionManager, context) { +function recordWorkflowContext( + sessionManager: SessionManager | undefined | null, + context: WorkflowContext, +): WorkflowContext | null { return recordNormalizedWorkflowContext(sessionManager, context); } -/** - * @param {WorkflowContext | null} left - * @param {WorkflowContext | null} right - * @returns {boolean} - */ -/** - * @param {LineageSessionManager | undefined | null} sessionManager - * @param {import('../types.js').SessionSegmentLineageEvidence} lineage - * @returns {import('../types.js').SessionSegmentLineageEvidence | null} - */ -export function recordSegmentLineageEvidence(sessionManager, lineage) { +export function recordSegmentLineageEvidence( + sessionManager: LineageSessionManager | undefined | null, + lineage: SessionSegmentLineageEvidence, +): SessionSegmentLineageEvidence | null { const normalized = normalizeSegmentLineageEvidence(lineage); if (!normalized) return readPersistedSegmentLineageEvidence(sessionManager); if (!sessionManager?.appendCustomEntry) return normalized; @@ -308,7 +324,8 @@ export function recordSegmentLineageEvidence(sessionManager, lineage) { existing.parentPiSessionId === normalized.parentPiSessionId && existing.lineageGroupKey === normalized.lineageGroupKey && existing.kind === normalized.kind - ) return existing; + ) + return existing; sessionManager.appendCustomEntry(SEGMENT_LINEAGE_CUSTOM_TYPE, normalized); } catch (_e) { return normalized; @@ -316,11 +333,9 @@ export function recordSegmentLineageEvidence(sessionManager, lineage) { return normalized; } -/** - * @param {LineageSessionManager | undefined | null} sessionManager - * @returns {import('../types.js').SessionSegmentLineageEvidence | null} - */ -export function readPersistedSegmentLineageEvidence(sessionManager) { +export function readPersistedSegmentLineageEvidence( + sessionManager: LineageSessionManager | undefined | null, +): SessionSegmentLineageEvidence | null { try { const entries = getSessionEntries(sessionManager); for (let i = entries.length - 1; i >= 0; i--) { @@ -333,12 +348,10 @@ export function readPersistedSegmentLineageEvidence(sessionManager) { return null; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @param {SegmentHandoffPayload} payload - * @returns {SegmentHandoffPayload} - */ -export function recordPendingSegmentContinuation(sessionManager, payload) { +export function recordPendingSegmentContinuation( + sessionManager: SessionManager | undefined | null, + payload: SegmentHandoffPayload, +): SegmentHandoffPayload { if (!sessionManager?.appendCustomEntry) return payload; try { sessionManager.appendCustomEntry(PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE, payload); @@ -348,19 +361,15 @@ export function recordPendingSegmentContinuation(sessionManager, payload) { return payload; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @returns {SegmentHandoffPayload | null} - */ -export function readPersistedPendingSegmentContinuation(sessionManager) { +export function readPersistedPendingSegmentContinuation( + sessionManager: SessionManager | undefined | null, +): SegmentHandoffPayload | null { return readPersistedPendingSegmentContinuationEntry(sessionManager)?.payload ?? null; } -/** - * @param {import('@earendil-works/pi-coding-agent').SessionManager | undefined | null} sessionManager - * @returns {{ payload: SegmentHandoffPayload, entryIndex: number, entries: Array<{ type?: string, role?: string, customType?: string }> } | null} - */ -export function readPersistedPendingSegmentContinuationEntry(sessionManager) { +export function readPersistedPendingSegmentContinuationEntry( + sessionManager: SessionManager | undefined | null, +): PendingSegmentContinuationEntry | null { try { const entries = getSessionEntries(sessionManager); for (let i = entries.length - 1; i >= 0; i--) { @@ -370,7 +379,7 @@ export function readPersistedPendingSegmentContinuationEntry(sessionManager) { payload: continuation, entryIndex: i, entries: entries.map((entry) => { - const item = /** @type {{ type?: string, role?: string, customType?: string }} */ (entry || {}); + const item = (entry || {}) as PersistedSessionEntrySummary; return { type: item.type, role: item.role, customType: item.customType }; }), }; @@ -382,11 +391,9 @@ export function readPersistedPendingSegmentContinuationEntry(sessionManager) { return null; } -/** - * @param {import('../types.js').SessionSegmentLineageEvidence | null | undefined} lineage - * @returns {import('../types.js').SessionSegmentLineageEvidence | null} - */ -export function normalizeSegmentLineageEvidence(lineage) { +export function normalizeSegmentLineageEvidence( + lineage: SessionSegmentLineageEvidence | null | undefined, +): SessionSegmentLineageEvidence | null { if (!lineage || typeof lineage !== "object") return null; const segmentId = typeof lineage.segmentId === "string" ? lineage.segmentId.trim() : ""; const runwieldSessionId = typeof lineage.runwieldSessionId === "string" ? lineage.runwieldSessionId.trim() : ""; @@ -394,28 +401,28 @@ export function normalizeSegmentLineageEvidence(lineage) { return { segmentId, runwieldSessionId, - parentSegmentId: typeof lineage.parentSegmentId === "string" && lineage.parentSegmentId.trim() - ? lineage.parentSegmentId.trim() - : null, - parentPiSessionId: typeof lineage.parentPiSessionId === "string" && lineage.parentPiSessionId.trim() - ? lineage.parentPiSessionId.trim() - : null, - lineageGroupKey: typeof lineage.lineageGroupKey === "string" && lineage.lineageGroupKey.trim() - ? lineage.lineageGroupKey.trim() - : null, - kind: typeof lineage.kind === "string" && ["planning", "execution", "semantic_repair"].includes(lineage.kind) - ? lineage.kind - : undefined, + parentSegmentId: + typeof lineage.parentSegmentId === "string" && lineage.parentSegmentId.trim() + ? lineage.parentSegmentId.trim() + : null, + parentPiSessionId: + typeof lineage.parentPiSessionId === "string" && lineage.parentPiSessionId.trim() + ? lineage.parentPiSessionId.trim() + : null, + lineageGroupKey: + typeof lineage.lineageGroupKey === "string" && lineage.lineageGroupKey.trim() + ? lineage.lineageGroupKey.trim() + : null, + kind: + typeof lineage.kind === "string" && ["planning", "execution", "semantic_repair"].includes(lineage.kind) + ? lineage.kind + : undefined, }; } -/** - * @param {WorkflowContext | null} left - * @param {WorkflowContext | null} right - * @returns {boolean} - */ -export function workflowContextsEqual(left, right) { - return (left?.routingIntent || "") === (right?.routingIntent || "") && +export function workflowContextsEqual(left: WorkflowContext | null, right: WorkflowContext | null): boolean { + return ( + (left?.routingIntent || "") === (right?.routingIntent || "") && (left?.complexity || "") === (right?.complexity || "") && (left?.summary || "") === (right?.summary || "") && (left?.planName || "") === (right?.planName || "") && @@ -427,50 +434,38 @@ export function workflowContextsEqual(left, right) { Boolean(left?.canResume) === Boolean(right?.canResume) && Boolean(left?.canRecover) === Boolean(right?.canRecover) && JSON.stringify(left?.progressFacts || []) === JSON.stringify(right?.progressFacts || []) && - JSON.stringify(left?.validationProgress || null) === JSON.stringify(right?.validationProgress || null); + JSON.stringify(left?.validationProgress || null) === JSON.stringify(right?.validationProgress || null) + ); } -/** - * @param {LineageSessionManager | undefined | null} sessionManager - * @returns {unknown[]} - */ -function getSessionEntries(sessionManager) { +function getSessionEntries(sessionManager: LineageSessionManager | undefined | null): unknown[] { const entries = sessionManager?.getBranch?.() || sessionManager?.getEntries?.() || []; return Array.isArray(entries) ? entries : []; } -/** - * @param {unknown} entry - * @returns {WorkflowContext | null} - */ -function readWorkflowContextFromEntry(entry) { +function readWorkflowContextFromEntry(entry: unknown): WorkflowContext | null { if (!entry || typeof entry !== "object") return null; - if (/** @type {{ type?: string }} */ (entry).type !== "custom") return null; - const customType = /** @type {{ customType?: string }} */ (entry).customType; + if ((entry as PersistedCustomSessionEntry).type !== "custom") return null; + const customType = (entry as PersistedCustomSessionEntry).customType; if (customType !== WORKFLOW_CONTEXT_CUSTOM_TYPE) return null; - const data = /** @type {{ data?: unknown }} */ (entry).data; + const data = (entry as PersistedCustomSessionEntry).data; return normalizeWorkflowContext(data); } -/** - * @param {unknown} entry - * @returns {import('../types.js').SessionSegmentLineageEvidence | null} - */ -function readSegmentLineageFromEntry(entry) { +function readSegmentLineageFromEntry(entry: unknown): SessionSegmentLineageEvidence | null { if (!entry || typeof entry !== "object") return null; - if (/** @type {{ type?: string }} */ (entry).type !== "custom") return null; - const customType = /** @type {{ customType?: string }} */ (entry).customType; + if ((entry as PersistedCustomSessionEntry).type !== "custom") return null; + const customType = (entry as PersistedCustomSessionEntry).customType; if (customType !== SEGMENT_LINEAGE_CUSTOM_TYPE) return null; - const data = /** @type {{ data?: import('../types.js').SessionSegmentLineageEvidence }} */ (entry).data; + const data = (entry as PersistedLineageEntry).data; return normalizeSegmentLineageEvidence(data); } -/** @param {unknown} entry */ -function readPendingSegmentContinuationFromEntry(entry) { +function readPendingSegmentContinuationFromEntry(entry: unknown) { if (!entry || typeof entry !== "object") return undefined; - if (/** @type {{ type?: string }} */ (entry).type !== "custom") return undefined; - const customType = /** @type {{ customType?: string }} */ (entry).customType; + if ((entry as PersistedCustomSessionEntry).type !== "custom") return undefined; + const customType = (entry as PersistedCustomSessionEntry).customType; if (customType !== PENDING_SEGMENT_CONTINUATION_CUSTOM_TYPE) return undefined; - return /** @type {{ data?: SegmentHandoffPayload }} */ (entry).data; + return (entry as PersistedContinuationEntry).data; } diff --git a/src/shared/types.js b/src/shared/types.js index 31c6714c3..7a6b1f7a8 100644 --- a/src/shared/types.js +++ b/src/shared/types.js @@ -85,7 +85,7 @@ * @property {boolean} busy * @property {string | null} activeTurnId * @property {import('./session/session-runtime-events.js').RuntimeQueuedMessage[]} queuedMessages - * @property {import('./session/workflow-context-session.js').WorkflowContext | null} workflowContext + * @property {import('./session/workflow-context-session.ts').WorkflowContext | null} workflowContext * @property {import('./session/tutorial-context-session.ts').TutorialContext | null} tutorialContext * @property {import('./session/plan-association.ts').PlanAssociation[]} [planAssociations] * @property {import('./session/file-session-store-types.ts').SessionArtifactReference[]} artifacts diff --git a/src/shared/workflow/validation-loop-review.test.js b/src/shared/workflow/validation-loop-review.test.js index aa0ddd5ff..eba2009de 100644 --- a/src/shared/workflow/validation-loop-review.test.js +++ b/src/shared/workflow/validation-loop-review.test.js @@ -729,9 +729,9 @@ test("runValidationPhase dispatches semantic review feedback to Reviewer-Feedbac assertExists(approvedPlanBody); const sessions = /** @type {any[]} */ ([]); const reviewerWorkflowContexts = - /** @type {Array} */ ([]); + /** @type {Array} */ ([]); const repairWorkflowContexts = - /** @type {Array} */ ([]); + /** @type {Array} */ ([]); const repairActiveOwners = /** @type {Array} */ ([]); const repairActivePlanNames = /** @type {Array} */ ([]); diff --git a/src/testing/managed-session-fixture.ts b/src/testing/managed-session-fixture.ts index 53fc883c5..4daabf8aa 100644 --- a/src/testing/managed-session-fixture.ts +++ b/src/testing/managed-session-fixture.ts @@ -10,7 +10,7 @@ import { import { fauxAssistantMessage, fauxText } from "@earendil-works/pi-ai"; import { join } from "node:path"; import { AGENTS } from "../constants.js"; -import { WORKFLOW_CONTEXT_CUSTOM_TYPE, type WorkflowContext } from "../shared/session/workflow-context-session.js"; +import { WORKFLOW_CONTEXT_CUSTOM_TYPE, type WorkflowContext } from "../shared/session/workflow-context-session.ts"; import { ACTIVE_AGENT_CUSTOM_TYPE } from "../shared/session/active-agent-session.ts"; import { openOwnerCoordinationStore } from "../shared/owner-coordination/index.ts"; import { encodeCwdForSessionDir } from "../shared/project-directory-key.ts"; diff --git a/src/ui/workspace/components/SessionActivationStatus.tsx b/src/ui/workspace/components/SessionActivationStatus.tsx index a5fc503d4..37bbe4bf9 100644 --- a/src/ui/workspace/components/SessionActivationStatus.tsx +++ b/src/ui/workspace/components/SessionActivationStatus.tsx @@ -1,5 +1,5 @@ import type { ActiveExecutionWorkflow } from "../../../shared/types.js"; -import type { WorkflowContext } from "../../../shared/session/workflow-context-session.js"; +import type { WorkflowContext } from "../../../shared/session/workflow-context-session.ts"; export interface SessionAvailabilitySnapshot { activeAgent?: string | null; diff --git a/src/ui/workspace/server/session-continuation.js b/src/ui/workspace/server/session-continuation.js index fcd766c7b..3b633bcfb 100644 --- a/src/ui/workspace/server/session-continuation.js +++ b/src/ui/workspace/server/session-continuation.js @@ -874,7 +874,7 @@ export class WorkspaceSessionContinuationService { provider: committedFacts.provider, thinkingLevel: committedFacts.thinkingLevel, workflowContext: - /** @type {import('../../../shared/session/workflow-context-session.js').WorkflowContext | null} */ ( + /** @type {import('../../../shared/session/workflow-context-session.ts').WorkflowContext | null} */ ( committedFacts.workflowContext || null ), }); @@ -1891,7 +1891,7 @@ export class WorkspaceSessionContinuationService { provider: committedFacts.provider, thinkingLevel: committedFacts.thinkingLevel, workflowContext: - /** @type {import('../../../shared/session/workflow-context-session.js').WorkflowContext | null} */ ( + /** @type {import('../../../shared/session/workflow-context-session.ts').WorkflowContext | null} */ ( committedFacts.workflowContext || null ), }); @@ -1996,7 +1996,7 @@ export class WorkspaceSessionContinuationService { provider: committedFacts.provider, thinkingLevel: committedFacts.thinkingLevel, workflowContext: - /** @type {import('../../../shared/session/workflow-context-session.js').WorkflowContext | null} */ ( + /** @type {import('../../../shared/session/workflow-context-session.ts').WorkflowContext | null} */ ( committedFacts.workflowContext || null ), }));