@windyroad/architect 0.23.5 → 0.23.6
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.
|
@@ -160,19 +160,22 @@ function registrations(input, target) {
|
|
|
160
160
|
const path = join(transportDir(), name);
|
|
161
161
|
try {
|
|
162
162
|
const registered = JSON.parse(readFileSync(path, "utf8"));
|
|
163
|
-
return registered.role === role && registered.
|
|
163
|
+
return registered.role === role && registered.root === current.root && registered.physical === current.physical ? [{ registered, age: Date.now() - statSync(path).mtimeMs }] : [];
|
|
164
164
|
} catch { return []; }
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
function persist(input) {
|
|
169
|
-
|
|
169
|
+
let target = normalizeTarget(input.task_name || input.agent_name || input.agent_id);
|
|
170
170
|
const output = input.last_assistant_message;
|
|
171
171
|
if (!target || typeof output !== "string" || !output) return;
|
|
172
172
|
if (parsedVerdict(output) !== "PASS") return diagnostic("non-pass-output", input);
|
|
173
|
-
const
|
|
173
|
+
const registrationsForCheckout = registrations(input, target);
|
|
174
|
+
const exact = registrationsForCheckout.filter(({ registered }) => registered.target === target);
|
|
175
|
+
const candidates = exact.length ? exact : registrationsForCheckout.filter(({ registered }) => registered.parentSession === input.session_id);
|
|
174
176
|
if (candidates.length !== 1) return diagnostic(candidates.length ? "ambiguous-parent-registration" : "missing-parent-registration", input);
|
|
175
177
|
const { registered, age } = candidates[0];
|
|
178
|
+
target = registered.target;
|
|
176
179
|
if (!valid(registered, input, target, age)) return;
|
|
177
180
|
const path = receiptPath(registered.parentSession, target);
|
|
178
181
|
if (existsSync(path) || existsSync(`${path}.done`)) return;
|