File "status.js"

Full Path: /home/buyiwexj/public_html/wp-content/plugins/extendify/src/Agent/state/status.js
File size: 571 bytes
MIME-type: text/x-java
Charset: utf-8

import { makeId } from '@agent/lib/util';
import { create } from 'zustand';

// Progress statuses live outside the message chain so they're never persisted
// or sent to the AI; the chat store clears them on every real message.
export const useStatusStore = create((set, get) => ({
	statuses: [],
	pushStatus: (type, label) =>
		set((state) => ({
			statuses: [...state.statuses, { id: makeId(), type, label }],
		})),
	clearStatuses: () =>
		set((state) => (state.statuses.length ? { statuses: [] } : state)),
	getLatestStatus: () => get().statuses.at(-1) ?? null,
}));