Complete Promptkit batch execution cutover
This commit is contained in:
@@ -46,8 +46,8 @@ type Metadata struct {
|
||||
GeneratedTextPath string `json:"generatedTextPath,omitempty"`
|
||||
RenderContextPath string `json:"renderContextPath,omitempty"`
|
||||
|
||||
// These paths are retained only to preserve records written by the temporary
|
||||
// Scriptorium flow. They are never emitted in V2 metadata.
|
||||
// These paths are retained only to read legacy V1 records. They are never
|
||||
// emitted in V2 metadata.
|
||||
PreflightPath string `json:"-"`
|
||||
GeneratedTextResultPath string `json:"-"`
|
||||
}
|
||||
@@ -170,47 +170,22 @@ func (m Metadata) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func BuildMetadataFromBriefingMetadata(resolved report.Resolved, briefingMetadata briefing.Metadata, paths ArtifactPaths) Metadata {
|
||||
metadata := resolved.Metadata()
|
||||
out := Metadata{
|
||||
SchemaVersion: MetadataSchemaVersionV1,
|
||||
RunID: metadata.RunID,
|
||||
MetadataPath: paths.Metadata,
|
||||
ReportID: metadata.ReportID,
|
||||
Variant: briefingMetadata.Variant,
|
||||
PromptID: metadata.PromptID,
|
||||
GeneratedAt: metadata.GeneratedAt,
|
||||
Timezone: metadata.Timezone,
|
||||
ValidPeriod: metadata.ValidPeriod,
|
||||
Location: copyLocation(briefingMetadata.Location),
|
||||
SourceLocationID: briefingMetadata.SourceLocationID,
|
||||
SourceLocation: briefingMetadata.SourceLocation,
|
||||
Sources: briefingMetadata.Sources,
|
||||
SourceWarnings: briefingMetadata.SourceWarnings,
|
||||
ModuleSnapshotPath: paths.ModuleSnapshot,
|
||||
DataPackagePath: paths.DataPackage,
|
||||
PreflightPath: paths.Preflight,
|
||||
RenderedReportPath: paths.RenderedReport,
|
||||
}
|
||||
out.GeneratedTextSchemaID = resolved.Definition.GeneratedTextSchemaID
|
||||
out.GeneratedTextRawPath = paths.GeneratedTextRaw
|
||||
out.GeneratedTextResultPath = paths.GeneratedTextResult
|
||||
out.GeneratedTextPath = paths.GeneratedText
|
||||
out.RenderContextPath = paths.RenderContext
|
||||
return out
|
||||
}
|
||||
|
||||
// BuildPromptMetadataFromBriefingMetadata creates the V2 record used by the
|
||||
// prompt execution workflow. Callers populate preparation and execution paths
|
||||
// only after their corresponding artifacts have been saved.
|
||||
func BuildPromptMetadataFromBriefingMetadata(resolved report.Resolved, briefingMetadata briefing.Metadata, paths ArtifactPaths) Metadata {
|
||||
legacy := BuildMetadataFromBriefingMetadata(resolved, briefingMetadata, paths)
|
||||
legacy.SchemaVersion = MetadataSchemaVersion
|
||||
legacy.PreparationPath = ""
|
||||
legacy.ExecutionPath = ""
|
||||
legacy.PreflightPath = ""
|
||||
legacy.GeneratedTextResultPath = ""
|
||||
return legacy
|
||||
metadata := resolved.Metadata()
|
||||
return Metadata{
|
||||
SchemaVersion: MetadataSchemaVersion, RunID: metadata.RunID, MetadataPath: paths.Metadata,
|
||||
ReportID: metadata.ReportID, Variant: briefingMetadata.Variant, PromptID: metadata.PromptID,
|
||||
GeneratedAt: metadata.GeneratedAt, Timezone: metadata.Timezone, ValidPeriod: metadata.ValidPeriod,
|
||||
Location: copyLocation(briefingMetadata.Location), SourceLocationID: briefingMetadata.SourceLocationID,
|
||||
SourceLocation: briefingMetadata.SourceLocation, Sources: briefingMetadata.Sources,
|
||||
SourceWarnings: briefingMetadata.SourceWarnings, ModuleSnapshotPath: paths.ModuleSnapshot,
|
||||
DataPackagePath: paths.DataPackage, RenderedReportPath: paths.RenderedReport,
|
||||
GeneratedTextSchemaID: resolved.Definition.GeneratedTextSchemaID, GeneratedTextRawPath: paths.GeneratedTextRaw,
|
||||
GeneratedTextPath: paths.GeneratedText, RenderContextPath: paths.RenderContext,
|
||||
}
|
||||
}
|
||||
|
||||
func copyLocation(location *briefing.LocationContext) *briefing.LocationContext {
|
||||
|
||||
Reference in New Issue
Block a user