@@ -13,9 +13,10 @@ import {
1313 type RuntimeMode ,
1414} from "@t3tools/contracts" ;
1515import { buildTemporaryWorktreeBranchName , sanitizeFeatureBranchName } from "@t3tools/shared/git" ;
16+ import { uuidv4 } from "../../lib/uuid" ;
1617
1718import type { DraftComposerImageAttachment } from "../../lib/composerImages" ;
18- import { uuidv4 } from "../../lib/uuid " ;
19+ import { makeTurnCommandMetadata } from "../../lib/commandMetadata " ;
1920import { getEnvironmentClient } from "../../state/environment-session-registry" ;
2021import { environmentRuntimeManager } from "../../state/use-environment-runtime" ;
2122import { vcsRefManager } from "../../state/use-vcs-refs" ;
@@ -93,8 +94,9 @@ export function useProjectActions() {
9394 return null ;
9495 }
9596
96- const threadId = ThreadId . make ( uuidv4 ( ) ) ;
97- const createdAt = new Date ( ) . toISOString ( ) ;
97+ const metadata = makeTurnCommandMetadata ( ) ;
98+ const threadId = ThreadId . make ( metadata . threadId ) ;
99+ const createdAt = metadata . createdAt ;
98100 const initialMessageText = input . initialMessageText . trim ( ) ;
99101 const nextTitle = deriveThreadTitleFromPrompt ( input . initialMessageText ) ;
100102
@@ -109,10 +111,10 @@ export function useProjectActions() {
109111
110112 await client . orchestration . dispatchCommand ( {
111113 type : "thread.turn.start" ,
112- commandId : CommandId . make ( uuidv4 ( ) ) ,
114+ commandId : CommandId . make ( metadata . commandId ) ,
113115 threadId,
114116 message : {
115- messageId : MessageId . make ( uuidv4 ( ) ) ,
117+ messageId : MessageId . make ( metadata . messageId ) ,
116118 role : "user" ,
117119 text : initialMessageText ,
118120 attachments : input . initialAttachments ,
@@ -143,7 +145,7 @@ export function useProjectActions() {
143145 }
144146 : { } ) ,
145147 } ,
146- createdAt : new Date ( ) . toISOString ( ) ,
148+ createdAt,
147149 } ) ;
148150
149151 await refreshRemoteData ( [ input . project . environmentId ] ) ;
0 commit comments