(input: {
readonly artifactId: string;
readonly edits: readonly ArtifactEdit[];
readonly title?: string;
readonly description?: string;
readonly connections?: Readonly<Record<string, string>>;
})
| 1955 | * back here makes the retry immediate. |
| 1956 | */ |
| 1957 | const editArtifact = (input: { |
| 1958 | readonly artifactId: string; |
| 1959 | readonly edits: readonly ArtifactEdit[]; |
| 1960 | readonly title?: string; |
| 1961 | readonly description?: string; |
| 1962 | readonly connections?: Readonly<Record<string, string>>; |
| 1963 | }): Effect.Effect<McpToolResult, unknown> => |
| 1964 | Effect.gen(function* () { |
| 1965 | // Same probe-proof refusal as create-artifact's update arm. |
| 1966 | const existing = yield* loadArtifact(input.artifactId); |
| 1967 | if (!existing) return actionArtifactUnavailableResult(); |
| 1968 | |
| 1969 | const applied = applyArtifactEdits(existing.code, input.edits); |
| 1970 | if (!applied.ok) return editRejectedResult(applied.message, existing.code); |
| 1971 | |
| 1972 | yield* Effect.annotateCurrentSpan({ |
| 1973 | "mcp.artifact.edit_count": input.edits.length, |
| 1974 | }); |
| 1975 | return yield* validateRenderAndSave({ |
| 1976 | code: applied.code, |
| 1977 | title: input.title ?? existing.title, |
| 1978 | description: input.description ?? existing.description ?? undefined, |
| 1979 | connections: input.connections, |
| 1980 | existing, |
| 1981 | }); |
| 1982 | }).pipe( |
| 1983 | Effect.withSpan("mcp.host.tool.edit_artifact", { |
| 1984 | attributes: { |
| 1985 | "mcp.tool.name": "edit-artifact", |
| 1986 | "mcp.artifact.id": input.artifactId, |
| 1987 | }, |
| 1988 | }), |
| 1989 | ); |
| 1990 | |
| 1991 | const listArtifacts = (): Effect.Effect<McpToolResult, unknown> => |
| 1992 | Effect.gen(function* () { |
no test coverage detected