gestalt-mobile 0.64.0 → 0.64.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.
|
@@ -11,6 +11,7 @@ import { AutopilotStateError } from '../domain/persisted-state-error.js';
|
|
|
11
11
|
import { canTransitionExecutorCommand, retainExecutorCommands, } from '../domain/executor-commands.js';
|
|
12
12
|
import { deriveSessionStatus } from '../../sessions/session-status.js';
|
|
13
13
|
import { createHash } from 'node:crypto';
|
|
14
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
14
15
|
import { currentExecutableL1Index, } from '../../plans/domain/supervised-plan.js';
|
|
15
16
|
import { AUTOPILOT_WAIT_MAX_MS, AUTOPILOT_WAIT_MIN_MS, } from '../../../../shared/contracts/autopilot-wait-lease.js';
|
|
16
17
|
import { autopilotSnapshot, disabledAutopilot, } from '../domain/autopilot-session.js';
|
|
@@ -156,7 +157,7 @@ export class AutopilotCoordinator {
|
|
|
156
157
|
: command),
|
|
157
158
|
};
|
|
158
159
|
const bindingState = (value) => value
|
|
159
|
-
?
|
|
160
|
+
? {
|
|
160
161
|
...value,
|
|
161
162
|
lastActivityAt: undefined,
|
|
162
163
|
resumeFailures: value.resumeFailures || undefined,
|
|
@@ -167,9 +168,11 @@ export class AutopilotCoordinator {
|
|
|
167
168
|
cpuPercent: undefined,
|
|
168
169
|
rssBytes: undefined,
|
|
169
170
|
})),
|
|
170
|
-
}
|
|
171
|
+
}
|
|
171
172
|
: null;
|
|
172
|
-
|
|
173
|
+
// SQLite hydration reconstructs property order (notably assignment and
|
|
174
|
+
// commands). Object insertion order is not a change in executor ownership.
|
|
175
|
+
const changed = !isDeepStrictEqual(bindingState(state.executor), bindingState(executor));
|
|
173
176
|
if (changed)
|
|
174
177
|
this.persist({ ...state, executor, updatedAt: this.deps.now() }, undefined, [
|
|
175
178
|
{
|
|
@@ -1779,7 +1782,10 @@ export class AutopilotCoordinator {
|
|
|
1779
1782
|
// Once that bounded loop requests diagnosis, preserve the probe state for
|
|
1780
1783
|
// the root instead of counting the root control as another blind retry.
|
|
1781
1784
|
const protocol = this.executorDiagnosisRequired(current)
|
|
1782
|
-
?
|
|
1785
|
+
? {
|
|
1786
|
+
...(current.supervision ?? startSupervisionProtocol(this.progressKey(sessionId))),
|
|
1787
|
+
outcome: 'probeRequired',
|
|
1788
|
+
}
|
|
1783
1789
|
: recordAutomaticContinuation(current.supervision ?? startSupervisionProtocol(this.progressKey(sessionId)), this.progressKey(sessionId));
|
|
1784
1790
|
if (protocol.outcome === 'probeRequired') {
|
|
1785
1791
|
this.persist({ ...current, supervision: protocol, updatedAt: this.deps.now() }, undefined, [
|
|
@@ -2471,7 +2477,7 @@ export class AutopilotCoordinator {
|
|
|
2471
2477
|
}
|
|
2472
2478
|
persistExecutor(sessionId, executor) {
|
|
2473
2479
|
const current = this.deps.store.find(sessionId);
|
|
2474
|
-
if (!current ||
|
|
2480
|
+
if (!current || isDeepStrictEqual(current.executor, executor))
|
|
2475
2481
|
return false;
|
|
2476
2482
|
this.persist({ ...current, executor, updatedAt: this.deps.now() });
|
|
2477
2483
|
return true;
|
|
@@ -3003,7 +3009,27 @@ export class AutopilotCoordinator {
|
|
|
3003
3009
|
child.ownedProcesses?.some((process) => process.state === 'running' || process.state === 'detached-active')));
|
|
3004
3010
|
}
|
|
3005
3011
|
executorDiagnosisRequired(state) {
|
|
3006
|
-
|
|
3012
|
+
if (state.supervision?.outcome === 'probeRequired')
|
|
3013
|
+
return true;
|
|
3014
|
+
const retained = this.deps.plan(state.sessionId);
|
|
3015
|
+
const executor = state.executor;
|
|
3016
|
+
if (!retained || !executor)
|
|
3017
|
+
return false;
|
|
3018
|
+
if (this.authoritativeExecutorActive(state, retained.plan, this.deps.activity(state.sessionId)))
|
|
3019
|
+
return false;
|
|
3020
|
+
const planFingerprint = fingerprint(retained.plan);
|
|
3021
|
+
// Issued is not accepted. A later wait can replace the transient probe
|
|
3022
|
+
// state, but cannot erase this durable ambiguity. Resume protection must
|
|
3023
|
+
// hand diagnosis back to root rather than silently selecting a command
|
|
3024
|
+
// which replay protection will refuse to issue again.
|
|
3025
|
+
return Boolean(executor.commands?.some((command) => command.status === 'issued' &&
|
|
3026
|
+
!command.processAction &&
|
|
3027
|
+
command.planIdentity === retained.identity &&
|
|
3028
|
+
command.planFingerprint === planFingerprint &&
|
|
3029
|
+
command.canonicalPosition === executor.canonicalPosition &&
|
|
3030
|
+
command.canonicalTaskName === executor.canonicalTaskName &&
|
|
3031
|
+
command.taskPath === executor.taskPath &&
|
|
3032
|
+
command.threadId === executor.threadId));
|
|
3007
3033
|
}
|
|
3008
3034
|
executorTurnActive(executor, activity) {
|
|
3009
3035
|
if (activity?.confidence !== 'fresh')
|