@graphty/graphty-element / ai / AiStatusManager
Class: AiStatusManager ​
Defined in: graphty-element/src/ai/AiStatus.ts:71
Manages AI command execution status with a state machine pattern. Tracks state transitions, timing, streaming content, tool calls, and errors.
Constructors ​
Constructor ​
new AiStatusManager():
AiStatusManager
Defined in: graphty-element/src/ai/AiStatus.ts:78
Creates a new AiStatusManager instance.
Returns ​
AiStatusManager
Accessors ​
current ​
Get Signature ​
get current():
Readonly<AiStatus>
Defined in: graphty-element/src/ai/AiStatus.ts:86
Get the current status (read-only reference).
Returns ​
Readonly<AiStatus>
Current status object
Methods ​
addToolCall() ​
addToolCall(
name):void
Defined in: graphty-element/src/ai/AiStatus.ts:179
Add a new tool call to track.
Parameters ​
name ​
string
Name of the tool being called
Returns ​
void
appendStreamedText() ​
appendStreamedText(
text):void
Defined in: graphty-element/src/ai/AiStatus.ts:167
Append text to the streamed content.
Parameters ​
text ​
string
Text chunk to append
Returns ​
void
complete() ​
complete():
void
Defined in: graphty-element/src/ai/AiStatus.ts:238
Complete execution, transitioning back to ready.
Returns ​
void
getSnapshot() ​
getSnapshot():
AiStatus
Defined in: graphty-element/src/ai/AiStatus.ts:275
Get a snapshot (copy) of the current status.
Returns ​
Copy of current status
reset() ​
reset():
void
Defined in: graphty-element/src/ai/AiStatus.ts:266
Reset to initial state.
Returns ​
void
setError() ​
setError(
error,canRetry):void
Defined in: graphty-element/src/ai/AiStatus.ts:252
Set an error state.
Parameters ​
error ​
Error
The error that occurred
canRetry ​
boolean
Whether the command can be retried
Returns ​
void
setStage() ​
setStage(
stage,message):void
Defined in: graphty-element/src/ai/AiStatus.ts:141
Set the current processing stage.
Parameters ​
stage ​
The processing stage
message ​
string
Human-readable message about the stage
Returns ​
void
startExecuting() ​
startExecuting():
void
Defined in: graphty-element/src/ai/AiStatus.ts:226
Start executing commands, transitioning from streaming to executing.
Returns ​
void
startStreaming() ​
startStreaming():
void
Defined in: graphty-element/src/ai/AiStatus.ts:153
Start streaming, transitioning from submitted to streaming.
Returns ​
void
submit() ​
submit():
void
Defined in: graphty-element/src/ai/AiStatus.ts:113
Submit a new command, transitioning from ready to submitted.
Returns ​
void
subscribe() ​
subscribe(
callback): () =>void
Defined in: graphty-element/src/ai/AiStatus.ts:284
Subscribe to status changes.
Parameters ​
callback ​
Function to call on status change
Returns ​
Unsubscribe function
() => void
updateElapsed() ​
updateElapsed():
void
Defined in: graphty-element/src/ai/AiStatus.ts:125
Update the elapsed time based on startTime.
Returns ​
void
updateToolCallStatus() ​
updateToolCallStatus(
name,status,result?):void
Defined in: graphty-element/src/ai/AiStatus.ts:195
Update the status of a tool call.
Parameters ​
name ​
string
Name of the tool call to update
status ​
New status for the tool call
result? ​
unknown
Optional result data
Returns ​
void