@atolis-hq/wake 0.2.90 → 0.2.92
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.
|
@@ -3,7 +3,7 @@ import { join } from 'node:path';
|
|
|
3
3
|
import { buildResourceUri } from '../../domain/resource-uri.js';
|
|
4
4
|
import { isTerminalStage } from '../../domain/stages.js';
|
|
5
5
|
import { isWorkItemDeleted, isWorkItemFrozen } from '../../domain/work-item-lifecycle.js';
|
|
6
|
-
import { workflowForProjection, workflowNameForProjection } from '../../domain/workflows.js';
|
|
6
|
+
import { universalQueueStage, workflowForProjection, workflowNameForProjection, } from '../../domain/workflows.js';
|
|
7
7
|
import { readFileLockStatus } from '../../lib/lock.js';
|
|
8
8
|
async function readLockInfo(lockFile, now, processInspector) {
|
|
9
9
|
const status = await readFileLockStatus(lockFile, {
|
|
@@ -45,7 +45,7 @@ function deriveCondition(item, lastRun, config) {
|
|
|
45
45
|
return { condition: 'needs-human', reason: `sentinel ${lastRun?.sentinel ?? stage}` };
|
|
46
46
|
}
|
|
47
47
|
const workflow = workflowForProjection(item, config);
|
|
48
|
-
const hasRoute =
|
|
48
|
+
const hasRoute = stage === universalQueueStage ? workflow !== null : workflow?.stages[stage] !== undefined;
|
|
49
49
|
if (!hasRoute) {
|
|
50
50
|
return { condition: 'error', reason: `no route configured for stage "${stage}"` };
|
|
51
51
|
}
|
|
@@ -982,30 +982,33 @@ function redact(value, keyHint = '') {
|
|
|
982
982
|
export async function buildConfigView(input) {
|
|
983
983
|
const ledger = await input.stateStore.readLedger();
|
|
984
984
|
const runnerHealth = ledger?.runners ?? {};
|
|
985
|
-
const routingTable = Object.entries(input.config.
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
const
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
985
|
+
const routingTable = Object.entries(input.config.workflows).flatMap(([workflow, definition]) => {
|
|
986
|
+
return Object.entries(definition.stages).map(([stage, route]) => {
|
|
987
|
+
const tier = route.tier ?? input.config.defaultTier;
|
|
988
|
+
const candidates = input.config.tiers[tier] ?? [];
|
|
989
|
+
const runnerName = route.runner ?? candidates[0];
|
|
990
|
+
const runner = runnerName !== undefined ? input.config.runners[runnerName] : undefined;
|
|
991
|
+
// Full fallback order for the tier (#67), each candidate's current pause
|
|
992
|
+
// state so the UI can show not just who's active but who Wake would fall
|
|
993
|
+
// sideways to next, and rotate back to once a pause expires.
|
|
994
|
+
const candidateHealth = candidates.map((name) => {
|
|
995
|
+
const health = runnerHealth[name];
|
|
996
|
+
const pausedUntil = health?.pausedUntil;
|
|
997
|
+
const paused = pausedUntil !== undefined && Date.parse(pausedUntil) > input.now.getTime();
|
|
998
|
+
return { runnerName: name, paused, pausedUntil };
|
|
999
|
+
});
|
|
1000
|
+
return {
|
|
1001
|
+
workflow,
|
|
1002
|
+
stage,
|
|
1003
|
+
action: route.action,
|
|
1004
|
+
tier,
|
|
1005
|
+
runnerName,
|
|
1006
|
+
runnerKind: runner?.kind,
|
|
1007
|
+
model: runner !== undefined && runner.kind !== 'fake' ? runner.model : undefined,
|
|
1008
|
+
timeoutMs: runner !== undefined && runner.kind !== 'fake' ? runner.timeoutMs : undefined,
|
|
1009
|
+
candidates: candidateHealth,
|
|
1010
|
+
};
|
|
998
1011
|
});
|
|
999
|
-
return {
|
|
1000
|
-
stage,
|
|
1001
|
-
action: route.action,
|
|
1002
|
-
tier,
|
|
1003
|
-
runnerName,
|
|
1004
|
-
runnerKind: runner?.kind,
|
|
1005
|
-
model: runner !== undefined && runner.kind !== 'fake' ? runner.model : undefined,
|
|
1006
|
-
timeoutMs: runner !== undefined && runner.kind !== 'fake' ? runner.timeoutMs : undefined,
|
|
1007
|
-
candidates: candidateHealth,
|
|
1008
|
-
};
|
|
1009
1012
|
});
|
|
1010
1013
|
return { config: redact(input.config), routingTable };
|
|
1011
1014
|
}
|
|
@@ -96,11 +96,12 @@ export function createControlPlane(deps) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
else {
|
|
99
|
-
const
|
|
99
|
+
const waitMs = input.idleBackoff ? nextSleepMs(input.getIdleTicks()) : deps.intervalMs;
|
|
100
|
+
const wait = await sleepUntilNextTick(waitMs, {
|
|
100
101
|
getLastRequest: input.getLastRequest,
|
|
101
102
|
setLastRequest: input.setLastRequest,
|
|
102
103
|
});
|
|
103
|
-
if (!wait.forced) {
|
|
104
|
+
if (!wait.forced && input.idleBackoff) {
|
|
104
105
|
input.setIdleTicks(input.getIdleTicks() + 1);
|
|
105
106
|
}
|
|
106
107
|
}
|
|
@@ -141,6 +142,7 @@ export function createControlPlane(deps) {
|
|
|
141
142
|
setLastRequest: (value) => {
|
|
142
143
|
lastIntakeTickRequest = value;
|
|
143
144
|
},
|
|
145
|
+
idleBackoff: true,
|
|
144
146
|
}),
|
|
145
147
|
startLoop({
|
|
146
148
|
run: deps.tickRunner.runRunnerTick,
|
|
@@ -153,6 +155,7 @@ export function createControlPlane(deps) {
|
|
|
153
155
|
setLastRequest: (value) => {
|
|
154
156
|
lastRunnerTickRequest = value;
|
|
155
157
|
},
|
|
158
|
+
idleBackoff: false,
|
|
156
159
|
}),
|
|
157
160
|
]);
|
|
158
161
|
return;
|
|
@@ -8,11 +8,6 @@ export function maxConfiguredRunnerTimeoutMs(config) {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
for (const stageRoute of Object.values(config.stages)) {
|
|
12
|
-
if (stageRoute.runner !== undefined) {
|
|
13
|
-
activeRunnerNames.add(stageRoute.runner);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
11
|
for (const commandRoute of Object.values(config.commands)) {
|
|
17
12
|
if (commandRoute.runner !== undefined) {
|
|
18
13
|
activeRunnerNames.add(commandRoute.runner);
|
|
@@ -805,10 +805,6 @@ const wakeConfigBaseSchema = z.object({
|
|
|
805
805
|
tier: 'standard',
|
|
806
806
|
},
|
|
807
807
|
}),
|
|
808
|
-
stages: z.record(z.string(), stageRouteSchema).default({
|
|
809
|
-
queue: { action: 'refine', tier: 'light' },
|
|
810
|
-
implement: { action: 'implement', tier: 'standard' },
|
|
811
|
-
}),
|
|
812
808
|
ui: z
|
|
813
809
|
.object({
|
|
814
810
|
enabled: z.boolean().default(false),
|
|
@@ -925,7 +921,6 @@ export const wakeWorkflowConfigSchema = wakeConfigBaseSchema.pick({
|
|
|
925
921
|
workflows: true,
|
|
926
922
|
workflowSelectors: true,
|
|
927
923
|
commands: true,
|
|
928
|
-
stages: true,
|
|
929
924
|
});
|
|
930
925
|
export const wakeConfigSchema = wakeConfigBaseSchema.superRefine((config, ctx) => {
|
|
931
926
|
const promptsRoot = config.paths.promptsRoot ?? defaultPromptsRoot();
|
package/dist/src/version.js
CHANGED