Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateArtifactRef(ref ArtifactRef) error
- func ValidateBundle(ctx context.Context, root string) error
- func ValidateBundlePath(value string) error
- func ValidateFlowSnapshot(snapshot FlowSnapshot) error
- func ValidateManifest(m Manifest) error
- func ValidateTrace(events []TraceEvent, status RunStatus) error
- type ArtifactRef
- type Bundle
- type FlowEdge
- type FlowNodeResult
- type FlowRunSnapshot
- type FlowRunState
- type FlowSessionBinding
- type FlowSnapshot
- type FlowStepRecord
- type Manifest
- type ManifestPaths
- type ManifestSessionEntry
- type NodeCWD
- type NodeOutcome
- type NodeSession
- type NodeSnapshot
- type NodeType
- type RunStatus
- type SessionEvent
- type SwitchEdge
- type TraceAttempt
- type TraceEvent
- type TraceProjection
- type TraceScope
Constants ¶
View Source
const ( SchemaFlowRunBundleV1 = "acpx.flow-run-bundle.v1" SchemaFlowDefinitionSnapshotV1 = "acpx.flow-definition-snapshot.v1" SchemaFlowTraceEventV1 = "acpx.flow-trace-event.v1" SchemaSessionV1 = "acpx.session.v1" )
View Source
const ( DefaultFlowPath = "flow.json" DefaultTracePath = "trace.ndjson" DefaultRunProjectionPath = "projections/run.json" DefaultLiveProjectionPath = "projections/live.json" DefaultStepsProjectionPath = "projections/steps.json" DefaultSessionsDir = "sessions" DefaultArtifactsDir = "artifacts" )
Variables ¶
View Source
var ( ErrInvalidBundle = errors.New("invalid acpx bundle") ErrUnsafePath = errors.New("unsafe acpx bundle path") )
Functions ¶
func ValidateArtifactRef ¶
func ValidateArtifactRef(ref ArtifactRef) error
func ValidateBundlePath ¶
func ValidateFlowSnapshot ¶
func ValidateFlowSnapshot(snapshot FlowSnapshot) error
func ValidateManifest ¶
func ValidateTrace ¶
func ValidateTrace(events []TraceEvent, status RunStatus) error
Types ¶
type ArtifactRef ¶
type Bundle ¶
type Bundle struct {
Root string
Manifest Manifest
Flow *FlowSnapshot
Trace []TraceEvent
}
type FlowEdge ¶
type FlowEdge struct {
From string `json:"from"`
To string `json:"to,omitzero"`
Switch *SwitchEdge `json:"switch,omitzero"`
}
type FlowNodeResult ¶
type FlowNodeResult struct {
AttemptID string `json:"attemptId"`
NodeID string `json:"nodeId"`
NodeType NodeType `json:"nodeType"`
Outcome NodeOutcome `json:"outcome"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
DurationMs float64 `json:"durationMs"`
Output json.RawMessage `json:"output,omitzero"`
Error string `json:"error,omitzero"`
}
type FlowRunSnapshot ¶
type FlowRunSnapshot struct {
HasTitle bool `json:"hasTitle,omitzero"`
}
type FlowRunState ¶
type FlowRunState struct {
RunID string `json:"runId"`
FlowName string `json:"flowName"`
RunTitle string `json:"runTitle,omitzero"`
FlowPath string `json:"flowPath,omitzero"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt,omitzero"`
UpdatedAt string `json:"updatedAt"`
Status RunStatus `json:"status"`
Input json.RawMessage `json:"input,omitzero"`
Outputs map[string]json.RawMessage `json:"outputs,omitzero"`
Results map[string]FlowNodeResult `json:"results,omitzero"`
Steps []FlowStepRecord `json:"steps,omitzero"`
SessionBindings map[string]FlowSessionBinding `json:"sessionBindings,omitzero"`
CurrentNode string `json:"currentNode,omitzero"`
CurrentAttemptID string `json:"currentAttemptId,omitzero"`
CurrentNodeType NodeType `json:"currentNodeType,omitzero"`
CurrentNodeStartedAt string `json:"currentNodeStartedAt,omitzero"`
LastHeartbeatAt string `json:"lastHeartbeatAt,omitzero"`
StatusDetail string `json:"statusDetail,omitzero"`
WaitingOn string `json:"waitingOn,omitzero"`
Error string `json:"error,omitzero"`
}
type FlowSessionBinding ¶
type FlowSessionBinding struct {
Key string `json:"key"`
Handle string `json:"handle"`
BundleID string `json:"bundleId"`
Name string `json:"name"`
Profile string `json:"profile,omitzero"`
AgentName string `json:"agentName"`
AgentCommand string `json:"agentCommand"`
CWD string `json:"cwd"`
AcpXRecordID string `json:"acpxRecordId"`
ACPSessionID string `json:"acpSessionId"`
AgentSessionID string `json:"agentSessionId,omitzero"`
}
type FlowSnapshot ¶
type FlowSnapshot struct {
Schema string `json:"schema"`
Name string `json:"name"`
Run *FlowRunSnapshot `json:"run,omitzero"`
Permissions json.RawMessage `json:"permissions,omitzero"`
StartAt string `json:"startAt"`
Nodes map[string]NodeSnapshot `json:"nodes"`
Edges []FlowEdge `json:"edges"`
}
type FlowStepRecord ¶
type FlowStepRecord struct {
AttemptID string `json:"attemptId"`
NodeID string `json:"nodeId"`
NodeType NodeType `json:"nodeType"`
Outcome NodeOutcome `json:"outcome"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt"`
PromptText *string `json:"promptText"`
RawText *string `json:"rawText"`
Output json.RawMessage `json:"output,omitzero"`
Error string `json:"error,omitzero"`
Session *FlowSessionBinding `json:"session"`
Agent json.RawMessage `json:"agent,omitzero"`
Trace json.RawMessage `json:"trace,omitzero"`
}
type Manifest ¶
type Manifest struct {
Schema string `json:"schema"`
RunID string `json:"runId"`
FlowName string `json:"flowName"`
RunTitle string `json:"runTitle,omitzero"`
FlowPath string `json:"flowPath,omitzero"`
StartedAt string `json:"startedAt"`
FinishedAt string `json:"finishedAt,omitzero"`
Status RunStatus `json:"status"`
TraceSchema string `json:"traceSchema"`
Paths ManifestPaths `json:"paths"`
Sessions []ManifestSessionEntry `json:"sessions,omitzero"`
}
type ManifestPaths ¶
type ManifestPaths struct {
Flow string `json:"flow"`
Trace string `json:"trace"`
RunProjection string `json:"runProjection"`
LiveProjection string `json:"liveProjection"`
StepsProjection string `json:"stepsProjection"`
SessionsDir string `json:"sessionsDir"`
ArtifactsDir string `json:"artifactsDir"`
}
type ManifestSessionEntry ¶
type NodeOutcome ¶
type NodeOutcome string
const ( NodeOutcomeOK NodeOutcome = "ok" NodeOutcomeTimedOut NodeOutcome = "timed_out" NodeOutcomeFailed NodeOutcome = "failed" NodeOutcomeCancelled NodeOutcome = "cancelled" )
type NodeSession ¶
type NodeSnapshot ¶
type NodeSnapshot struct {
NodeType NodeType `json:"nodeType"`
TimeoutMs float64 `json:"timeoutMs,omitzero"`
HeartbeatMs float64 `json:"heartbeatMs,omitzero"`
StatusDetail string `json:"statusDetail,omitzero"`
Profile string `json:"profile,omitzero"`
Session *NodeSession `json:"session,omitzero"`
CWD *NodeCWD `json:"cwd,omitzero"`
Summary string `json:"summary,omitzero"`
ActionExecution string `json:"actionExecution,omitzero"`
HasPrompt bool `json:"hasPrompt,omitzero"`
HasParse bool `json:"hasParse,omitzero"`
HasRun bool `json:"hasRun,omitzero"`
HasExec bool `json:"hasExec,omitzero"`
}
type SessionEvent ¶
type SessionEvent struct {
Seq int64 `json:"seq"`
At string `json:"at"`
Direction string `json:"direction"`
Message json.RawMessage `json:"message"`
}
type SwitchEdge ¶
type TraceAttempt ¶
type TraceEvent ¶
type TraceEvent struct {
Seq int64 `json:"seq"`
At string `json:"at"`
Scope TraceScope `json:"scope"`
Type string `json:"type"`
RunID string `json:"runId"`
NodeID string `json:"nodeId,omitzero"`
AttemptID string `json:"attemptId,omitzero"`
SessionID string `json:"sessionId,omitzero"`
Artifact *ArtifactRef `json:"artifact,omitzero"`
Payload map[string]json.RawMessage `json:"payload"`
}
func ReadTraceFile ¶
func ReadTraceFile(ctx context.Context, filePath string) ([]TraceEvent, error)
type TraceProjection ¶
type TraceProjection struct {
RunID string
EventCount int
SessionCount int
ArtifactCount int
Attempts map[string]TraceAttempt
}
func RebuildTraceProjection ¶
func RebuildTraceProjection(events []TraceEvent) (TraceProjection, error)
type TraceScope ¶
type TraceScope string
const ( TraceScopeRun TraceScope = "run" TraceScopeNode TraceScope = "node" TraceScopeACP TraceScope = "acp" TraceScopeAction TraceScope = "action" TraceScopeSession TraceScope = "session" TraceScopeArtifact TraceScope = "artifact" )
Click to show internal directories.
Click to hide internal directories.