u-foo 2.3.0 → 2.3.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u-foo",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "Multi-Agent Workspace Protocol. Just add u. claude → uclaude, codex → ucodex.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://ufoo.dev",
@@ -12,6 +12,7 @@ const { writeActivityState } = require("./activityStateWriter");
12
12
  * @param {string} options.subscriber - Subscriber ID (e.g. "claude-code:abc123")
13
13
  * @param {string} options.projectRoot - Project root (unused, kept for API compat)
14
14
  * @param {boolean} [options.force=true] - Force overwrite priority-protected states
15
+ * publish(state, extra, { force }) can override this default for one transition.
15
16
  */
16
17
  function createActivityStatePublisher(options = {}) {
17
18
  const {
@@ -22,10 +23,13 @@ function createActivityStatePublisher(options = {}) {
22
23
 
23
24
  let lastState = "";
24
25
 
25
- function publish(state, extra = {}) {
26
+ function publish(state, extra = {}, publishOptions = {}) {
26
27
  if (state === lastState) return false;
27
28
  const since = extra.since || undefined;
28
- const changed = writeActivityState(agentsFile, subscriber, state, { since, force });
29
+ const effectiveForce = typeof publishOptions.force === "boolean"
30
+ ? publishOptions.force
31
+ : force;
32
+ const changed = writeActivityState(agentsFile, subscriber, state, { since, force: effectiveForce });
29
33
  if (!changed) return false;
30
34
  lastState = state;
31
35
  // Write to bus events directory for daemon bridge to pick up.
@@ -123,8 +123,10 @@ class AgentNotifier {
123
123
  * 更新 activity_state(terminal/tmux agent 基础支持)
124
124
  * 基于消息投递推断 WORKING,无 pending 时推断 IDLE
125
125
  */
126
- updateActivityState(state) {
127
- return this.activityPublisher.publish(state);
126
+ updateActivityState(state, options = {}) {
127
+ return this.activityPublisher.publish(state, {}, {
128
+ force: typeof options.force === "boolean" ? options.force : undefined,
129
+ });
128
130
  }
129
131
 
130
132
  getCurrentActivityState() {
@@ -375,7 +377,14 @@ class AgentNotifier {
375
377
 
376
378
  this.lastCount = this.getMessageCount();
377
379
  if (this._launcherReady && (!this.lastWorkingAt || nowMs - this.lastWorkingAt >= this.workingHoldMs)) {
378
- this.updateActivityState("idle");
380
+ const currentActivityState = this.getCurrentActivityState();
381
+ if (currentActivityState !== "waiting_input" && currentActivityState !== "blocked") {
382
+ if (currentActivityState === "working") {
383
+ this.updateActivityState("idle", { force: true });
384
+ } else {
385
+ this.updateActivityState("idle");
386
+ }
387
+ }
379
388
  }
380
389
  this.refreshTitle();
381
390
  this.updateHeartbeat();