()
| 3064 | } |
| 3065 | |
| 3066 | const markWorkspaceTurnAccepted = async () => { |
| 3067 | await this.workspaceTurnSettlementLocks.withLock(handleId, async () => { |
| 3068 | const current = await this.taskHandleStore.getWorkspaceTurn(ownerWorkspaceId, handleId); |
| 3069 | if (current?.workspaceId !== targetWorkspaceId) { |
| 3070 | throw new Error("Workspace turn was canceled before stream start"); |
| 3071 | } |
| 3072 | if (current.turnId !== turnId) { |
| 3073 | throw new Error("Workspace turn correlation changed before stream start"); |
| 3074 | } |
| 3075 | if (this.isTerminalWorkspaceTurnStatus(current.status)) { |
| 3076 | throw new Error(current.error ?? "Workspace turn was canceled before stream start"); |
| 3077 | } |
| 3078 | if (current.status !== "running") { |
| 3079 | await this.taskHandleStore.upsertWorkspaceTurn({ |
| 3080 | ...current, |
| 3081 | status: "running", |
| 3082 | updatedAt: getIsoNow(), |
| 3083 | }); |
| 3084 | } |
| 3085 | this.activeWorkspaceTurnHandleByWorkspaceId.set(targetWorkspaceId, { |
| 3086 | handleId, |
| 3087 | ownerWorkspaceId, |
| 3088 | }); |
| 3089 | }); |
| 3090 | }; |
| 3091 | |
| 3092 | const sendResult = await this.workspaceService.sendMessage( |
| 3093 | targetWorkspaceId, |
nothing calls this directly
no test coverage detected