@dotdrelle/wiki-manager 0.9.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -169,6 +169,18 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
169
169
  let lastVisiblePlan: Array<{ step: number; description: string; status: string }> | null = null;
170
170
  const activities = createMemo(() => {
171
171
  version();
172
+ const workflowActivities = nonEmptyRuntimeArray(runtimeState()?.workflow?.nodes?.filter((node: any) => node.type === 'activity'));
173
+ if (workflowActivities) {
174
+ return workflowActivities.map((node: any) => ({
175
+ ...(node.raw ?? {}),
176
+ key: node.key,
177
+ label: node.label,
178
+ status: node.status,
179
+ terminal: ['done', 'failed', 'cancelled'].includes(String(node.status)),
180
+ _runtime: true,
181
+ _workflow: true,
182
+ }));
183
+ }
172
184
  const runtimeActivities = nonEmptyRuntimeArray(runtimeState()?.activities);
173
185
  if (runtimeActivities) {
174
186
  return runtimeActivities.map((activity: any) => ({ ...activity, _runtime: true }));
@@ -184,6 +196,10 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
184
196
  });
185
197
  const queueItems = createMemo(() => {
186
198
  version();
199
+ const workflowQueue = nonEmptyRuntimeArray(runtimeState()?.workflow?.nodes?.filter((node: any) => node.type === 'queue'));
200
+ if (workflowQueue) {
201
+ return workflowQueue.map((node: any) => ({ ...(node.raw ?? {}), id: node.itemId ?? node.id, label: node.label, status: node.status, _runtime: true, _workflow: true }));
202
+ }
187
203
  const runtimeQueue = nonEmptyRuntimeArray(runtimeState()?.queue);
188
204
  if (runtimeQueue) return runtimeQueue.map((item: any) => ({ ...item, _runtime: true }));
189
205
  return projectQueue((session as any).headlessPlan, (session as any).jobQueue ?? [], { workspace: (session as any).workspace ?? null })
@@ -191,6 +207,14 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
191
207
  });
192
208
  const queueInfo = createMemo(() => {
193
209
  version();
210
+ const workflowQueue = runtimeState()?.workflow?.nodes?.filter((node: any) => node.type === 'queue');
211
+ if (Array.isArray(workflowQueue)) {
212
+ return {
213
+ active: workflowQueue.filter((item: any) => ['waiting', 'starting', 'running', 'queued', 'pending', 'pending_approval'].includes(String(item.status ?? '').toLowerCase())).length,
214
+ current: workflowQueue.filter((item: any) => ['starting', 'running'].includes(String(item.status ?? '').toLowerCase())).length,
215
+ frozen: 0,
216
+ };
217
+ }
194
218
  const runtimeQueue = runtimeState()?.queue;
195
219
  if (Array.isArray(runtimeQueue)) {
196
220
  return {
@@ -203,6 +227,16 @@ export function useSession(props: { agent: unknown; packageJson: Record<string,
203
227
  });
204
228
  const plan = createMemo(() => {
205
229
  version();
230
+ const workflowTasks = nonEmptyRuntimeArray(runtimeState()?.workflow?.nodes?.filter((node: any) => node.type === 'task'));
231
+ if (workflowTasks) {
232
+ return workflowTasks
233
+ .sort((a: any, b: any) => Number(a.step ?? 0) - Number(b.step ?? 0))
234
+ .map((node: any, index: number) => ({
235
+ step: Number(node.step ?? index + 1),
236
+ description: String(node.description ?? node.label ?? `Step ${index + 1}`),
237
+ status: String(node.status ?? 'pending'),
238
+ }));
239
+ }
206
240
  const runtimePlan = nonEmptyRuntimeArray(runtimeState()?.plan);
207
241
  if (runtimePlan) {
208
242
  return runtimePlan.map((step: any, index: number) => ({