@yeaft/webchat-agent 1.0.206 → 1.0.208

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.
@@ -70,12 +70,21 @@ function mapWorkItem(row) {
70
70
  workflowSnapshot: parseJson(row.workflow_snapshot, null),
71
71
  status: row.status,
72
72
  currentActionId: row.current_action_id || null,
73
+ currentAction: row.current_action_type ? {
74
+ id: row.current_action_id,
75
+ type: row.current_action_type,
76
+ stageId: row.current_action_stage_id || row.current_action_type,
77
+ status: row.current_action_status || null,
78
+ brief: parseJson(row.current_action_brief, null),
79
+ } : null,
73
80
  currentRunId: row.current_run_id || null,
74
81
  workDir: row.work_dir || '',
75
82
  workspaceKey: row.workspace_key || '',
76
83
  reuseMemory: row.reuse_memory !== 0,
77
84
  origin: parseJson(row.origin, null),
78
85
  linkedSessionIds: parseJson(row.linked_session_ids, []),
86
+ actionCount: Math.max(0, Number(row.action_count) || 0),
87
+ completedActionCount: Math.max(0, Number(row.completed_action_count) || 0),
79
88
  sessionContext: parseJson(row.session_context, []),
80
89
  messages: parseJson(row.messages, []),
81
90
  attachments: parseJson(row.attachments, []),
@@ -1190,6 +1199,14 @@ export class WorkItemStore {
1190
1199
  }
1191
1200
  const limit = Math.min(Math.max(Number(filters.limit) || 100, 1), 500);
1192
1201
  const sql = `SELECT w.*,
1202
+ current_action.type AS current_action_type,
1203
+ current_action.stage_id AS current_action_stage_id,
1204
+ current_action.status AS current_action_status,
1205
+ current_action.brief AS current_action_brief,
1206
+ (SELECT COUNT(*) FROM actions a WHERE a.work_item_id = w.id
1207
+ AND a.status NOT IN ('superseded', 'cancelled')) AS action_count,
1208
+ (SELECT COUNT(*) FROM actions a WHERE a.work_item_id = w.id
1209
+ AND a.status = 'completed') AS completed_action_count,
1193
1210
  COALESCE(SUM(r.llm_request_count), 0) AS usage_llm_request_count,
1194
1211
  COALESCE(SUM(r.loop_count), 0) AS usage_loop_count,
1195
1212
  COALESCE(SUM(r.tool_count), 0) AS usage_tool_count,
@@ -1198,7 +1215,9 @@ export class WorkItemStore {
1198
1215
  COALESCE(SUM(r.cache_read_tokens), 0) AS usage_cache_read_tokens,
1199
1216
  COALESCE(SUM(r.cache_write_tokens), 0) AS usage_cache_write_tokens,
1200
1217
  COALESCE(SUM(r.total_tokens), 0) AS usage_total_tokens
1201
- FROM work_items w LEFT JOIN runs r ON r.work_item_id = w.id
1218
+ FROM work_items w
1219
+ LEFT JOIN actions current_action ON current_action.id = w.current_action_id
1220
+ LEFT JOIN runs r ON r.work_item_id = w.id
1202
1221
  ${where.length ? `WHERE ${where.join(' AND ')}` : ''}
1203
1222
  GROUP BY w.id ORDER BY w.updated_at DESC LIMIT ?`;
1204
1223
  return this.db.prepare(sql).all(...values, limit).map(mapWorkItem).map(workItem => {