@yeaft/webchat-agent 1.0.548 → 1.0.549

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.
@@ -1 +1 @@
1
- {"version":"1.0.548"}
1
+ {"version":"1.0.549"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.548",
3
+ "version": "1.0.549",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1742,7 +1742,7 @@ export class WorkItemStore {
1742
1742
 
1743
1743
  #hasBlockingOperation(workItemId, actionId = null) {
1744
1744
  const rows = this.db.prepare(`SELECT idempotency_key FROM operations
1745
- WHERE work_item_id = ? AND concurrency_policy = 'blocking'
1745
+ WHERE work_item_id = ? AND concurrency_policy = 'blocking' AND operation_type != 'Bash'
1746
1746
  AND (? IS NULL OR action_id IS NULL OR action_id = ?)`)
1747
1747
  .all(workItemId, actionId, actionId);
1748
1748
  return rows.some(row => !this.operationSafeToProceed(row.idempotency_key));
@@ -1805,11 +1805,19 @@ export class WorkItemStore {
1805
1805
  const active = this.#activeRunRow(operation.runId, ownerBootId, leaseEpoch, true);
1806
1806
  if (!active || active.work_item_id !== operation.workItemId
1807
1807
  || active.action_id !== operation.actionId) {
1808
- this.db.prepare(`UPDATE operations SET effect_status = 'unknown',
1809
- execution_status = 'hazardous_orphan', effect_cutoff = ?, result = ?, completed_at = ?,
1808
+ const settled = operation.operationType === 'Bash'
1809
+ && ['applied', 'not_applied', 'failed_no_effect'].includes(effectStatus);
1810
+ this.db.prepare(`UPDATE operations SET effect_status = ?,
1811
+ execution_status = ?, effect_cutoff = ?, result = ?, completed_at = ?,
1810
1812
  updated_at = ? WHERE idempotency_key = ? AND execution_status = 'running'
1811
1813
  AND owner_boot_id = ? AND owner_lease_epoch = ?`).run(
1812
- stringify({ status: 'stale', closureType: 'late_completion', closedAt: now }),
1814
+ settled ? effectStatus : 'unknown',
1815
+ settled ? 'quiescent' : 'hazardous_orphan',
1816
+ stringify({
1817
+ status: settled ? 'current' : 'stale',
1818
+ closureType: settled ? 'late_settled_completion' : 'late_completion',
1819
+ closedAt: now,
1820
+ }),
1813
1821
  stringify({ attemptedEffectStatus: effectStatus, reportedResult: result }),
1814
1822
  now, now, idempotencyKey, ownerBootId, leaseEpoch,
1815
1823
  );
@@ -1830,6 +1838,19 @@ export class WorkItemStore {
1830
1838
  recoverOperations() {
1831
1839
  return withTransaction(this.db, () => {
1832
1840
  const now = this.now();
1841
+ const reconciled = this.db.prepare(`UPDATE operations SET
1842
+ effect_status = json_extract(result, '$.attemptedEffectStatus'),
1843
+ execution_status = 'quiescent', effect_cutoff = ?, completed_at = COALESCE(completed_at, ?),
1844
+ updated_at = ? WHERE operation_type = 'Bash'
1845
+ AND execution_status = 'hazardous_orphan' AND effect_status = 'unknown'
1846
+ AND json_extract(result, '$.attemptedEffectStatus') IN
1847
+ ('applied', 'not_applied', 'failed_no_effect')`).run(
1848
+ stringify({
1849
+ status: 'current', closureType: 'recovered_late_settled_completion', closedAt: now,
1850
+ }),
1851
+ now,
1852
+ now,
1853
+ );
1833
1854
  const unstarted = this.db.prepare(`UPDATE operations SET effect_status = 'failed_no_effect',
1834
1855
  execution_status = 'quiescent', effect_cutoff = ?, result = ?, completed_at = ?, updated_at = ?
1835
1856
  WHERE effect_status = 'pending' AND execution_status = 'not_started'`).run(
@@ -1842,7 +1863,7 @@ export class WorkItemStore {
1842
1863
  effect_cutoff = ?, updated_at = ? WHERE execution_status IN ('running', 'cancel_requested')`).run(
1843
1864
  stringify({ status: 'stale', closureType: 'restart_unknown', closedAt: now }), now,
1844
1865
  );
1845
- return Number(unstarted.changes) + Number(hazardous.changes);
1866
+ return Number(reconciled.changes) + Number(unstarted.changes) + Number(hazardous.changes);
1846
1867
  });
1847
1868
  }
1848
1869
 
@@ -4631,6 +4652,7 @@ export class WorkItemStore {
4631
4652
  SELECT 1 FROM operations unsafe_operation
4632
4653
  WHERE unsafe_operation.work_item_id = w.id
4633
4654
  AND unsafe_operation.concurrency_policy = 'blocking'
4655
+ AND unsafe_operation.operation_type != 'Bash'
4634
4656
  AND unsafe_operation.effect_status NOT IN ('applied', 'not_applied', 'failed_no_effect')
4635
4657
  )
4636
4658
  AND NOT EXISTS (