(input: {
readonly artifactId: string;
readonly edits: readonly ArtifactEdit[];
readonly title?: string;
readonly description?: string;
readonly connections?: Readonly<Record<string, string>>;
})
| 2512 | * back here makes the retry immediate. |
| 2513 | */ |
| 2514 | const editArtifact = (input: { |
| 2515 | readonly artifactId: string; |
| 2516 | readonly edits: readonly ArtifactEdit[]; |
| 2517 | readonly title?: string; |
| 2518 | readonly description?: string; |
| 2519 | readonly connections?: Readonly<Record<string, string>>; |
| 2520 | }): Effect.Effect<McpToolResult, unknown> => |
| 2521 | Effect.gen(function* () { |
| 2522 | // Same probe-proof refusal as create-artifact's update arm. |
| 2523 | const existing = yield* loadArtifact(input.artifactId); |
| 2524 | if (!existing) return actionArtifactUnavailableResult(); |
| 2525 | |
| 2526 | const applied = applyArtifactEdits(existing.code, input.edits); |
| 2527 | if (!applied.ok) return editRejectedResult(applied.message, existing.code); |
| 2528 | |
| 2529 | yield* Effect.annotateCurrentSpan({ |
| 2530 | "mcp.artifact.edit_count": input.edits.length, |
| 2531 | }); |
| 2532 | return yield* validateRenderAndSave({ |
| 2533 | code: applied.code, |
| 2534 | title: input.title ?? existing.title, |
| 2535 | description: input.description ?? existing.description ?? undefined, |
| 2536 | connections: input.connections, |
| 2537 | existing, |
| 2538 | }); |
| 2539 | }).pipe( |
| 2540 | Effect.withSpan("mcp.host.tool.edit_artifact", { |
| 2541 | attributes: { |
| 2542 | "mcp.tool.name": "edit-artifact", |
| 2543 | "mcp.artifact.id": input.artifactId, |
| 2544 | }, |
| 2545 | }), |
| 2546 | ); |
| 2547 | |
| 2548 | const listArtifacts = (): Effect.Effect<McpToolResult, unknown> => |
| 2549 | Effect.gen(function* () { |
no test coverage detected