agent-transport-system 0.4.92 → 0.4.93
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/dist/ats.js +48 -3
- package/dist/ats.js.map +1 -1
- package/package.json +1 -1
package/dist/ats.js
CHANGED
|
@@ -27,7 +27,7 @@ import wrapAnsi from "wrap-ansi";
|
|
|
27
27
|
import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
|
|
28
28
|
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "0.4.
|
|
30
|
+
var version = "0.4.93";
|
|
31
31
|
var package_default = {
|
|
32
32
|
$schema: "https://www.schemastore.org/package.json",
|
|
33
33
|
name: "agent-transport-system",
|
|
@@ -54129,6 +54129,28 @@ async function resolveDaemonServiceParticipationStatus(input) {
|
|
|
54129
54129
|
async function runDaemonServiceParticipationGate(input) {
|
|
54130
54130
|
if (!shouldRunDaemonServiceParticipationGate(input)) return { status: "aligned" };
|
|
54131
54131
|
const initialStatus = await resolveDaemonServiceParticipationStatus();
|
|
54132
|
+
if (isRunningAdvisoryOnlyServiceDrift(initialStatus)) {
|
|
54133
|
+
const accountIssue = await resolveDaemonServiceAccountAlignmentIssue(input);
|
|
54134
|
+
if (!accountIssue) return { status: "aligned" };
|
|
54135
|
+
const codePrefix = resolveDaemonServiceParticipationCodePrefix(input.intent);
|
|
54136
|
+
if (input.autoRepair === true) return await runDaemonServiceParticipationRefresh({
|
|
54137
|
+
input,
|
|
54138
|
+
codePrefix,
|
|
54139
|
+
expectedVersion: initialStatus.expectedVersion,
|
|
54140
|
+
accountIssue
|
|
54141
|
+
});
|
|
54142
|
+
renderDaemonStartNeedsAttention({
|
|
54143
|
+
presenter: input.presenter,
|
|
54144
|
+
codePrefix,
|
|
54145
|
+
summary: accountIssue.summary
|
|
54146
|
+
});
|
|
54147
|
+
input.presenter.line({
|
|
54148
|
+
code: `${codePrefix}.account_alignment_failed`,
|
|
54149
|
+
text: accountIssue.summary,
|
|
54150
|
+
data: { reasonCode: accountIssue.reasonCode }
|
|
54151
|
+
});
|
|
54152
|
+
return { status: "needs_attention" };
|
|
54153
|
+
}
|
|
54132
54154
|
if (input.forceRefresh === true && initialStatus.kind === "ready") return await runDaemonServiceParticipationRefresh({
|
|
54133
54155
|
input,
|
|
54134
54156
|
codePrefix: resolveDaemonServiceParticipationCodePrefix(input.intent),
|
|
@@ -54169,6 +54191,9 @@ async function runDaemonServiceParticipationGate(input) {
|
|
|
54169
54191
|
status: installStageResult.status
|
|
54170
54192
|
});
|
|
54171
54193
|
}
|
|
54194
|
+
function isRunningAdvisoryOnlyServiceDrift(status) {
|
|
54195
|
+
return status.kind === "needs_repair" && status.runtimeStatus === "running" && status.anomalyCodes.length > 0 && status.anomalyCodes.every((code) => DAEMON_SERVICE_WAKEABILITY_ADVISORY_ANOMALIES.has(code));
|
|
54196
|
+
}
|
|
54172
54197
|
function shouldRunDaemonServiceParticipationGate(input) {
|
|
54173
54198
|
return input.resolvedView === "human" && (input.allowPrompt || input.autoRepair === true) && (input.forcePrompt === true || shouldRequireDaemonServiceParticipation(input.localDemand));
|
|
54174
54199
|
}
|
|
@@ -56939,6 +56964,12 @@ const TERMINAL_PREPARE_STEP_ORDER = [
|
|
|
56939
56964
|
"report_runtime",
|
|
56940
56965
|
"verify_setup"
|
|
56941
56966
|
];
|
|
56967
|
+
var PrepareSessionBlockedByCoreError = class extends Error {
|
|
56968
|
+
constructor(message) {
|
|
56969
|
+
super(message);
|
|
56970
|
+
this.name = "PrepareSessionBlockedByCoreError";
|
|
56971
|
+
}
|
|
56972
|
+
};
|
|
56942
56973
|
async function runPrepareSessionExecutor(input) {
|
|
56943
56974
|
let initial = await resolvePrepareSessionToken({
|
|
56944
56975
|
gatewayUrl: input.gatewayUrl,
|
|
@@ -57099,11 +57130,18 @@ async function runTerminalStep(input) {
|
|
|
57099
57130
|
stepId: input.stepId,
|
|
57100
57131
|
status: "completed"
|
|
57101
57132
|
});
|
|
57102
|
-
|
|
57133
|
+
const resolvedSnapshot = await input.stream.waitForSnapshot((snapshot) => {
|
|
57103
57134
|
const step = findStep(snapshot, input.stepId);
|
|
57104
|
-
return snapshot.sessionRevision > stepCompleteRevision && step?.state === "complete";
|
|
57135
|
+
return snapshot.sessionRevision > stepCompleteRevision && (step?.state === "complete" || step?.state === "blocked" || snapshot.phase === "blocked" || snapshot.lifecycleStatus !== "active");
|
|
57105
57136
|
});
|
|
57137
|
+
assertTerminalStepCompletedOrThrow({
|
|
57138
|
+
input: input.input,
|
|
57139
|
+
snapshot: resolvedSnapshot,
|
|
57140
|
+
stepId: input.stepId
|
|
57141
|
+
});
|
|
57142
|
+
return resolvedSnapshot;
|
|
57106
57143
|
} catch (error) {
|
|
57144
|
+
if (error instanceof PrepareSessionBlockedByCoreError) throw error;
|
|
57107
57145
|
if (error instanceof PrepareSessionRevisionConflictError) {
|
|
57108
57146
|
const message = "This setup changed while Terminal was working. Run the same setup command again to continue from the latest step.";
|
|
57109
57147
|
emitHumanStatus(input.input, "Setup changed", [message]);
|
|
@@ -57132,6 +57170,13 @@ async function runTerminalStep(input) {
|
|
|
57132
57170
|
throw userFacingError;
|
|
57133
57171
|
}
|
|
57134
57172
|
}
|
|
57173
|
+
function assertTerminalStepCompletedOrThrow(input) {
|
|
57174
|
+
if (findStep(input.snapshot, input.stepId)?.state === "complete" && input.snapshot.phase !== "blocked") return;
|
|
57175
|
+
const blocker = input.snapshot.blockers.find((candidate) => candidate.stepId === input.stepId) ?? input.snapshot.blockers[0] ?? null;
|
|
57176
|
+
const message = blocker?.message ?? "ATS setup is blocked. Return to ATS Web for details.";
|
|
57177
|
+
emitHumanStatus(input.input, "Setup blocked", [message, ...blocker?.reasonCode ? [`Support code: ${blocker.reasonCode}`] : []]);
|
|
57178
|
+
throw new PrepareSessionBlockedByCoreError(message);
|
|
57179
|
+
}
|
|
57135
57180
|
function resolveNextTerminalPrepareStep(snapshot) {
|
|
57136
57181
|
if (snapshot.selectedLocalAgentIds.length === 0) return null;
|
|
57137
57182
|
return TERMINAL_PREPARE_STEP_ORDER.find((stepId) => {
|