@toddzheng024/dscode-bundle 0.7.21 → 0.7.23

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.
@@ -32,6 +32,7 @@ export function watchSkills(ctx, fallbackCwd) {
32
32
  const skills = ctx.get('skills');
33
33
  let agent;
34
34
  let rows = [];
35
+ let count;
35
36
  let error;
36
37
  // The agent whose workspace the current rows were last successfully read
37
38
  // from: a failure for an agent that never loaded must clear the rows, not
@@ -58,11 +59,15 @@ export function watchSkills(ctx, fallbackCwd) {
58
59
  return;
59
60
  const next = toRows(summaries);
60
61
  // Description and invocation-flag edits must surface too: a name-only
61
- // comparison silently dropped those change notifications.
62
- const unchanged = next.length === rows.length && next.every((row, index) => row.name === rows[index]?.name
62
+ // comparison silently dropped those change notifications. The catalog
63
+ // size is compared as well, because a model-only skill moves the footer
64
+ // count without changing any user-invocable row.
65
+ const unchanged = summaries.length === count
66
+ && next.length === rows.length && next.every((row, index) => row.name === rows[index]?.name
63
67
  && row.description === rows[index]?.description
64
68
  && row.modelInvocable === rows[index]?.modelInvocable);
65
69
  rows = next;
70
+ count = summaries.length;
66
71
  loadedFor = target;
67
72
  const recovered = error !== undefined;
68
73
  error = undefined;
@@ -77,15 +82,19 @@ export function watchSkills(ctx, fallbackCwd) {
77
82
  // next skills/change notification is the retry surface, mirroring the
78
83
  // web directory); a target that never loaded starts from empty rows —
79
84
  // stale rows from a previous workspace must not keep completing here.
80
- // The rows array keeps its identity unless the failure text itself
81
- // changed: a repeated identical error on the 0.1.5 event storm must not
82
- // churn fresh identities into React's update chain.
85
+ // That clearing is itself a state change, so it notifies even when the
86
+ // error text repeats; the error text alone keeps the identity rule
87
+ // below, where a repeated identical error on the 0.1.5 event storm must
88
+ // not churn fresh identities into React's update chain.
83
89
  const nextError = cause instanceof Error ? cause.message : String(cause);
84
- if (loadedFor !== target)
90
+ const cleared = loadedFor !== target && (rows.length > 0 || count !== undefined);
91
+ if (loadedFor !== target) {
85
92
  rows = [];
93
+ count = undefined;
94
+ }
86
95
  const errorChanged = nextError !== error;
87
96
  error = nextError;
88
- if (!errorChanged)
97
+ if (!errorChanged && !cleared)
89
98
  return;
90
99
  for (const listener of listeners)
91
100
  listener();
@@ -101,6 +110,9 @@ export function watchSkills(ctx, fallbackCwd) {
101
110
  get rows() {
102
111
  return rows;
103
112
  },
113
+ get count() {
114
+ return count;
115
+ },
104
116
  get error() {
105
117
  return error;
106
118
  },