MCPcopy Index your code
hub / github.com/coder/mux / createRun

Method createRun

src/node/services/devToolsService.ts:173–206  ·  view source on GitHub ↗
(workspaceId: string, run: DevToolsRun, metadataId?: string)

Source from the content-addressed store, hash-verified

171 }
172
173 async createRun(workspaceId: string, run: DevToolsRun, metadataId?: string): Promise<void> {
174 if (!this.enabled) {
175 return;
176 }
177
178 assert(workspaceId.trim().length > 0, "DevToolsService.createRun requires a workspaceId");
179 assert(run.workspaceId === workspaceId, "DevToolsService.createRun run/workspace mismatch");
180
181 await this.ensureLoaded(workspaceId);
182 const data = this.getOrCreateWorkspaceData(workspaceId);
183
184 // Apply queued run metadata (for example, effective tool policy) captured
185 // before the stream reached provider middleware. Lookup is keyed by request
186 // metadata ID so overlapping requests cannot overwrite each other.
187 const byWorkspace = this.pendingRunMetadata.get(workspaceId);
188 const normalizedMetadataId = metadataId?.trim();
189 if (byWorkspace && normalizedMetadataId != null && normalizedMetadataId.length > 0) {
190 const pendingMetadata = byWorkspace.get(normalizedMetadataId);
191 if (pendingMetadata != null) {
192 Object.assign(run, pendingMetadata);
193 byWorkspace.delete(normalizedMetadataId);
194 }
195
196 if (byWorkspace.size === 0) {
197 this.pendingRunMetadata.delete(workspaceId);
198 }
199 }
200
201 data.runs.set(run.id, run);
202 await this.appendToFile(workspaceId, { type: "run", run });
203
204 const summary = this.buildRunSummary(data, run.id);
205 this.emitWorkspaceEvent(workspaceId, { type: "run-created", run: summary });
206 }
207
208 async createStep(workspaceId: string, step: DevToolsStep): Promise<void> {
209 if (!this.enabled) {

Callers

nothing calls this directly

Calls 9

ensureLoadedMethod · 0.95
appendToFileMethod · 0.95
buildRunSummaryMethod · 0.95
emitWorkspaceEventMethod · 0.95
setMethod · 0.80
getMethod · 0.65
assertFunction · 0.50
deleteMethod · 0.45

Tested by

no test coverage detected