@agfpd/iapeer 0.4.122 → 0.4.123
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 +1 -1
- package/src/daemon/fleet.ts +15 -1
package/package.json
CHANGED
package/src/daemon/fleet.ts
CHANGED
|
@@ -617,7 +617,7 @@ export function buildFleetHandler(opts: FleetHandlerOptions = {}): FleetHandler
|
|
|
617
617
|
// observations in; the snapshot below reads it. Reading is O(1): no file touched per request.
|
|
618
618
|
const activity = opts.activity ?? new ActivityBoard()
|
|
619
619
|
const activityOf = (personality: string, runtime: string): TurnActivity | undefined =>
|
|
620
|
-
activity.get(personality, runtime, Date.now())
|
|
620
|
+
structuralActivity(personality, runtime, env) ?? activity.get(personality, runtime, Date.now())
|
|
621
621
|
let opsPromise: Promise<FleetOps> | undefined
|
|
622
622
|
const getOps = (): Promise<FleetOps> => {
|
|
623
623
|
if (opts.ops) return Promise.resolve(opts.ops)
|
|
@@ -900,6 +900,20 @@ async function runCommand(
|
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
|
|
903
|
+
/**
|
|
904
|
+
* Activity of a STRUCTURAL runtime straight from its own state (docs/20: state.json `status` is the
|
|
905
|
+
* busy/idle source, not a transcript watch). busy/approval → working, idle → idle; anything else (or
|
|
906
|
+
* no private dir) → undefined, so the transcript turn-watch decides for claude/codex as before.
|
|
907
|
+
*/
|
|
908
|
+
export function structuralActivity(personality: string, runtime: string, env: NodeJS.ProcessEnv): TurnActivity | undefined {
|
|
909
|
+
const dir = endpointPrivateDir(runtime, personality, { env })
|
|
910
|
+
if (!dir) return undefined
|
|
911
|
+
const status = readOpencodeState(join(dir, 'state.json'))?.status
|
|
912
|
+
if (status === 'busy' || status === 'approval') return 'working'
|
|
913
|
+
if (status === 'idle') return 'idle'
|
|
914
|
+
return undefined
|
|
915
|
+
}
|
|
916
|
+
|
|
903
917
|
/** Serve the SSE event stream: optional replay of the newest N historical events,
|
|
904
918
|
* then live tail. At-least-once semantics (a reconnect may re-see events — `id`
|
|
905
919
|
* is the event's epoch-ms for client-side dedup); heartbeat comment every 15 s. */
|