Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

feat(hires): review batch imports in a FIFO queue

HaningZS7b187d2e900c
diff --git a/package.json b/package.json
index 97bb375a..a5f9cace 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
"typecheck:node": "tsc --noEmit -p tsconfig.node.json",
"typecheck:web": "tsc --noEmit -p tsconfig.web.json",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
- "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/release-notes.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs test/ide-image.test.cjs test/win-cmd-shim.test.cjs test/hive-windows-prompt.test.cjs test/release-drop.test.cjs test/skills.test.cjs test/skills-install.test.cjs test/hero-payload.test.cjs",
+ "test:focused": "node --test test/codex-remote.test.cjs test/control.test.cjs test/provider-automation.test.cjs test/provider-config.test.cjs test/queue-delivery.test.cjs test/terminal-automation.test.cjs test/terminal-recovery.test.cjs test/terminal-selection.test.cjs test/roster.test.cjs test/proc-kill.test.cjs test/expand-tilde.test.cjs test/hive-cwd.test.cjs test/hive-task-mutation.test.cjs test/hive-hook-node.test.cjs test/hive-roster-injection.test.cjs test/hive-runtime-path.test.cjs test/cli-install-ladder.test.cjs test/node-install.test.cjs test/office-gl-recovery.test.cjs test/update-state.test.cjs test/release-notes.test.cjs test/transcript-project-dir.test.cjs test/commit-graph.test.cjs test/ide-image.test.cjs test/win-cmd-shim.test.cjs test/hive-windows-prompt.test.cjs test/release-drop.test.cjs test/skills.test.cjs test/skills-install.test.cjs test/hero-payload.test.cjs test/hire-import.test.cjs test/hire-queue.test.cjs",
"check:links": "node tools/check-release-links.cjs",
"dist": "npm run build && electron-builder",
"dist:mac": "npm run build && electron-builder --mac",
diff --git a/src/main/hire.ts b/src/main/hire.ts
index 9c4134cd..d9730418 100644
--- a/src/main/hire.ts
+++ b/src/main/hire.ts
@@ -8,6 +8,7 @@
import { readFileSync, statSync } from 'node:fs';
import { lookup } from 'node:dns/promises';
import { BlockList, isIP } from 'node:net';
+import { basename } from 'node:path';
import {
HIRE_MAX_BYTES,
isAllowedManifestUrl,
@@ -249,3 +250,24 @@ export function readHireManifestFile(path: string): HireResult {
return { ok: false, error: `could not read manifest: ${String(e)}` };
}
}
+
+/** Validate a file-picker batch independently: one bad manifest never discards
+ * the valid neighbours selected with it. Errors name the file, not its full
+ * local path, so the renderer can explain what was skipped without leaking a
+ * user's directory structure into logs or screenshots. */
+export function readHireManifestFiles(paths: readonly string[]): {
+ manifests: HireManifest[];
+ errors: string[];
+} {
+ const manifests: HireManifest[] = [];
+ const errors: string[] = [];
+ for (const path of paths) {
+ const result = readHireManifestFile(path);
+ if (result.ok) manifests.push(result.manifest);
+ else {
+ const name = basename(path);
+ errors.push(`${name}: ${result.error.split(path).join(name)}`);
+ }
+ }
+ return { manifests, errors };
+}
diff --git a/src/main/index.ts b/src/main/index.ts
index 45d288e4..6628a599 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -59,7 +59,7 @@ import * as integrations from './integrations';
import { validateBaseUrl, buildAuthHeaders, resolveUpstreamUrl, secretRefFor, INTEGRATION_TEMPLATES } from '../shared/integrations';
import { RosterStore } from './roster';
import { ControlRegistry } from './control';
-import { fetchHireManifest, readHireManifestFile } from './hire';
+import { fetchHireManifest, readHireManifestFiles } from './hire';
import { parseHireDeepLink, type HireManifest } from '../shared/hire';
import { ClosingTimeController } from './closingTime';
import {
@@ -2080,15 +2080,23 @@ ipcMain.handle('hire:drainPending', () => {
return out;
});
-// IPC: "import hire…" file picker in the Add-Agent modal.
+// IPC: "import hires…" file picker in the Add-Agent modal. Every selected file
+// is validated independently; valid neighbours survive an invalid manifest.
ipcMain.handle('hire:openFile', async () => {
const res = await dialog.showOpenDialog({
- title: 'Import a hire manifest',
+ title: 'Import hire manifests',
filters: [{ name: 'Hire manifest', extensions: ['json'] }],
- properties: ['openFile']
+ properties: ['openFile', 'multiSelections']
});
- if (res.canceled || res.filePaths.length === 0) return { ok: false, error: 'cancelled' };
- return readHireManifestFile(res.filePaths[0]);
+ if (res.canceled || res.filePaths.length === 0) {
+ return { ok: false, manifests: [], errors: [], error: 'cancelled' };
+ }
+ const batch = readHireManifestFiles(res.filePaths);
+ return {
+ ok: batch.manifests.length > 0,
+ ...batch,
+ error: batch.manifests.length === 0 ? 'no valid hire manifests selected' : undefined
+ };
});
/**
diff --git a/src/preload/index.ts b/src/preload/index.ts
index e6909511..2e447206 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -901,8 +901,13 @@ const api = {
* links, links that arrived during load). Resolves the queued list. */
drainPendingHires: (): Promise<HireManifest[]> =>
ipcRenderer.invoke('hire:drainPending'),
- /** Open a file picker and validate the chosen hire-manifest JSON. */
- importHireFile: (): Promise<{ ok: boolean; manifest?: HireManifest; error?: string }> =>
+ /** Open a multi-file picker and validate every selected hire manifest. */
+ importHireFiles: (): Promise<{
+ ok: boolean;
+ manifests: HireManifest[];
+ errors: string[];
+ error?: string;
+ }> =>
ipcRenderer.invoke('hire:openFile'),
// ─── Quit confirmation ───────────────────────────────────────────────────
diff --git a/src/renderer/src/App.tsx b/src/renderer/src/App.tsx
index 8078ca61..c59f7de5 100644
--- a/src/renderer/src/App.tsx
+++ b/src/renderer/src/App.tsx
@@ -131,22 +131,22 @@ export function App() {
// Shareable hires: a validated manifest arriving via the munderdifflin://
// deep link (or file import) pre-fills the Add-Agent modal. Never spawns by itself.
- const setPendingHire = useStore(s => s.setPendingHire);
+ const enqueuePendingHires = useStore(s => s.enqueuePendingHires);
useEffect(() => {
const unsub = window.cth.onHireImport?.((m) => {
- setPendingHire(m);
+ enqueuePendingHires([m]);
setAddAgentOpen(true);
});
// Pull anything that arrived before this subscription existed (cold-start
// deep links; packaged renderers load too fast for push-on-load).
void window.cth.drainPendingHires?.().then((queued) => {
if (queued && queued.length > 0) {
- setPendingHire(queued[queued.length - 1]);
+ enqueuePendingHires(queued);
setAddAgentOpen(true);
}
});
return unsub;
- }, [setPendingHire, setAddAgentOpen]);
+ }, [enqueuePendingHires, setAddAgentOpen]);
useEffect(() => window.cth.onHireError?.((info) => {
console.error('[hire] import failed:', info.error);
}), []);
diff --git a/src/renderer/src/components/AddAgentModal.tsx b/src/renderer/src/components/AddAgentModal.tsx
index c7467558..22d5bd64 100644
--- a/src/renderer/src/components/AddAgentModal.tsx
+++ b/src/renderer/src/components/AddAgentModal.tsx
@@ -8,6 +8,7 @@ import { useStore, type Agent } from '@/store/store';
import { OFFICE_CAST, DEFAULT_CHARACTER, type OfficeCharacterName } from '@/scene/office/cast';
import { type AccentColorName } from '@/design/tokens';
import type { HireManifest } from '@shared/hire';
+import { hireQueueProgress } from '@shared/hireQueue';
import { MCP_CATALOG } from '@shared/mcpCatalog';
import {
OSS_LOCAL_PICKS,
@@ -139,9 +140,13 @@ export interface AddAgentModalProps {
export function AddAgentModal({ onClose, config, onConfigChange }: AddAgentModalProps) {
const addAgent = useStore(s => s.addAgent);
- // A validated hire manifest (deep link / file import) seeds the form. Manifests
- // NEVER auto-spawn — the human reviews every field (esp. the command) first.
- const pendingHire = useStore(s => s.pendingHire);
+ // Deep links and file batches share one FIFO. The head alone seeds the form;
+ // every item still requires an explicit spawn or skip.
+ const hireQueue = useStore(s => s.hireQueue);
+ const enqueuePendingHires = useStore(s => s.enqueuePendingHires);
+ const finishPendingHire = useStore(s => s.finishPendingHire);
+ const pendingHire = hireQueue.pending[0];
+ const reviewProgress = hireQueueProgress(hireQueue);
const knownCharacter = (c?: string): OfficeCharacterName =>
(OFFICE_CAST.some(m => m.name === c) ? (c as OfficeCharacterName) : DEFAULT_CHARACTER);
@@ -298,19 +303,52 @@ export function AddAgentModal({ onClose, config, onConfigChange }: AddAgentModal
setName(m.name);
setCharacter(knownCharacter(m.character));
setAccent(knownAccent(m.accent));
- if (m.provider) setProvider(m.provider);
+ setProvider(m.provider ?? initialProvider);
setModel(m.model);
setCommand(hireCommand(m));
- if (m.description) setDescription(m.description);
+ setDescription(m.description ?? 'a fresh harness');
setGoal(m.goal ?? '');
setIsolate(m.isolate ?? false);
+ setResumeSessionId('');
+ setFolderNote(undefined);
+ setSection('identity');
+ };
+
+ // Advancing a batch keeps this modal mounted. Re-seed every form field when
+ // the queue head changes so edits made while reviewing one hire cannot leak
+ // into the next.
+ useEffect(() => {
+ if (pendingHire) applyManifest(pendingHire);
+ // applyManifest intentionally closes over the config snapshot used by this
+ // open modal; queue advances do not replace that snapshot.
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [pendingHire]);
+
+ const advanceHireReview = () => {
+ const next = hireQueue.pending[1];
+ // Seed the next manifest in the same React update as the queue advance, so
+ // the banner/progress can never paint with the previous hire's edited form.
+ if (next) applyManifest(next);
+ finishPendingHire();
+ if (!next) onClose();
};
const importHire = async () => {
setError(undefined);
- const res = await window.cth.importHireFile();
- if (res.ok && res.manifest) applyManifest(res.manifest);
- else if (res.error && res.error !== 'cancelled') setError(res.error);
+ const res = await window.cth.importHireFiles();
+ if (res.manifests.length > 0) enqueuePendingHires(res.manifests);
+ if (res.errors.length > 0) {
+ const noun = res.errors.length === 1 ? 'file' : 'files';
+ setError(`Skipped ${res.errors.length} invalid ${noun}: ${res.errors.join(' · ')}`);
+ } else if (!res.ok && res.error && res.error !== 'cancelled') {
+ setError(res.error);
+ }
+ };
+
+ const skipHire = () => {
+ if (!pendingHire) return;
+ setError(undefined);
+ advanceHireReview();
};
const submit = async () => {
@@ -412,7 +450,11 @@ export function AddAgentModal({ onClose, config, onConfigChange }: AddAgentModal
.catch(() => { /* best-effort */ });
}
setBusy(false);
- onClose();
+ if (pendingHire) {
+ advanceHireReview();
+ } else {
+ onClose();
+ }
};
return (
@@ -453,6 +495,7 @@ export function AddAgentModal({ onClose, config, onConfigChange }: AddAgentModal
<span>
📋 hire imported: <strong>{hireMeta.name}</strong>
{hireMeta.author ? <> · by {hireMeta.author}</> : null}
+ {reviewProgress ? <> · hire {reviewProgress.current} of {reviewProgress.total}</> : null}
</span>
<span>review every field — especially the command — before spawning.</span>
{hireMeta.commandFlags && hireMeta.commandFlags.length > 0 && (
@@ -1018,10 +1061,19 @@ export function AddAgentModal({ onClose, config, onConfigChange }: AddAgentModal
</div>
<div style={{ display: 'flex', gap: 8, justifyContent: 'flex-end', marginTop: 4 }}>
- <PixelButton variant="secondary" size="md" onClick={importHire} disabled={busy} title="Import a hire manifest (.json)">
- import hire…
+ <PixelButton
+ variant="secondary"
+ size="md"
+ onClick={importHire}
+ disabled={busy}
+ title="Import one or more hire manifests (.json)"
+ >
+ import hires…
</PixelButton>
<div style={{ flex: 1 }} />
+ {pendingHire && (
+ <PixelButton variant="secondary" size="md" onClick={skipHire} disabled={busy}>skip hire</PixelButton>
+ )}
<PixelButton variant="ghost" size="md" onClick={onClose} disabled={busy}>cancel</PixelButton>
<PixelButton variant="primary" size="md" onClick={submit} disabled={busy}>
{busy ? 'spawning...' : 'spawn'}
diff --git a/src/renderer/src/store/store.ts b/src/renderer/src/store/store.ts
index 7ae52d5a..f1f58a0e 100644
--- a/src/renderer/src/store/store.ts
+++ b/src/renderer/src/store/store.ts
@@ -5,6 +5,12 @@ import type { ThemeId } from '@/scene/office/themeRegistry';
import type { StatusKind } from '@/components/PixelBadge';
import type { AgentProvider } from '@shared/agentProvider';
import type { HireManifest } from '@shared/hire';
+import {
+ EMPTY_HIRE_QUEUE,
+ enqueueHires,
+ finishCurrentHire,
+ type HireReviewQueue
+} from '@shared/hireQueue';
import { DEFAULT_ORG_TRIGGER, type OrgTriggerConfig, type WebhookTrigger } from '@shared/triggers';
import { isCompactionCommand } from '@shared/providerAutomation';
@@ -267,9 +273,10 @@ interface State {
/** Clear an agent's entire pending queue. */
clearQueue: (agentId: string) => void;
setAddAgentOpen: (open: boolean) => void;
- /** A validated hire manifest waiting to pre-fill the Add-Agent modal. */
- pendingHire: HireManifest | null;
- setPendingHire: (m: HireManifest | null) => void;
+ /** Validated manifests waiting for one-at-a-time human review. */
+ hireQueue: HireReviewQueue;
+ enqueuePendingHires: (manifests: readonly HireManifest[]) => void;
+ finishPendingHire: () => void;
setFullscreen: (id: string | null) => void;
setFullscreenFile: (path: string | null, view?: 'edit' | 'preview') => void;
/** Open/close the IDE. `agentId` names the agent whose workspace it should
@@ -829,8 +836,13 @@ export const useStore = create<State>((set) => ({
return { agents, feeds, selectedId, restorableAgents };
}),
setAddAgentOpen: (open) => set({ addAgentOpen: open }),
- pendingHire: null,
- setPendingHire: (m) => set({ pendingHire: m }),
+ hireQueue: EMPTY_HIRE_QUEUE,
+ enqueuePendingHires: (manifests) => set((s) => ({
+ hireQueue: enqueueHires(s.hireQueue, manifests)
+ })),
+ finishPendingHire: () => set((s) => ({
+ hireQueue: finishCurrentHire(s.hireQueue)
+ })),
setFullscreen: (id) => set({ fullscreenAgentId: id }),
setFullscreenFile: (path, view) => set({ fullscreenFilePath: path, fullscreenFileView: view ?? 'edit' }),
// Closing CLEARS the target: the id is scoped to one IDE session, and a stale
diff --git a/src/shared/hireQueue.ts b/src/shared/hireQueue.ts
new file mode 100644
index 00000000..aca2e48a
--- /dev/null
+++ b/src/shared/hireQueue.ts
@@ -0,0 +1,43 @@
+import type { HireManifest } from './hire';
+
+/** Ephemeral renderer state for one human-reviewed run of imported hires. */
+export interface HireReviewQueue {
+ pending: readonly HireManifest[];
+ /** Number already spawned or skipped in this run. */
+ reviewed: number;
+}
+
+export const EMPTY_HIRE_QUEUE: HireReviewQueue = Object.freeze({
+ pending: Object.freeze([]) as readonly HireManifest[],
+ reviewed: 0
+});
+
+/** Append arrivals without replacing the manifest currently under review. */
+export function enqueueHires(
+ queue: HireReviewQueue,
+ incoming: readonly HireManifest[]
+): HireReviewQueue {
+ if (incoming.length === 0) return queue;
+ return {
+ pending: [...queue.pending, ...incoming],
+ // A drained queue starts a new review run and therefore new progress.
+ reviewed: queue.pending.length === 0 ? 0 : queue.reviewed
+ };
+}
+
+/** Mark exactly the head item spawned/skipped and reveal the next one. */
+export function finishCurrentHire(queue: HireReviewQueue): HireReviewQueue {
+ if (queue.pending.length === 0) return queue;
+ if (queue.pending.length === 1) return EMPTY_HIRE_QUEUE;
+ return { pending: queue.pending.slice(1), reviewed: queue.reviewed + 1 };
+}
+
+export function hireQueueProgress(
+ queue: HireReviewQueue
+): { current: number; total: number } | null {
+ if (queue.pending.length === 0) return null;
+ return {
+ current: queue.reviewed + 1,
+ total: queue.reviewed + queue.pending.length
+ };
+}
diff --git a/test/hire-import.test.cjs b/test/hire-import.test.cjs
new file mode 100644
index 00000000..765ba58e
--- /dev/null
+++ b/test/hire-import.test.cjs
@@ -0,0 +1,77 @@
+'use strict';
+
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { mkdtempSync, readFileSync, writeFileSync, rmSync } = require('node:fs');
+const { tmpdir } = require('node:os');
+const { join } = require('node:path');
+const loadTs = require('./load-ts.cjs');
+
+const { readHireManifestFiles } = loadTs('src/main/hire.ts');
+
+const manifest = (name) => ({ spec: 'munder-difflin/hire@1', name });
+
+test('batch import keeps every valid manifest and reports invalid files independently', () => {
+ const dir = mkdtempSync(join(tmpdir(), 'munder-hire-import-'));
+ try {
+ const jim = join(dir, '01-jim.json');
+ const brokenJson = join(dir, '02-broken.json');
+ const invalidManifest = join(dir, '03-missing-name.json');
+ const pam = join(dir, '04-pam.json');
+ writeFileSync(jim, JSON.stringify(manifest('Jim')));
+ writeFileSync(brokenJson, '{ definitely not json');
+ writeFileSync(invalidManifest, JSON.stringify({ spec: 'munder-difflin/hire@1' }));
+ writeFileSync(pam, JSON.stringify(manifest('Pam')));
+
+ const result = readHireManifestFiles([jim, brokenJson, invalidManifest, pam]);
+
+ assert.deepEqual(result.manifests.map((m) => m.name), ['Jim', 'Pam']);
+ assert.equal(result.errors.length, 2);
+ assert.match(result.errors[0], /02-broken\.json/);
+ assert.match(result.errors[1], /03-missing-name\.json/);
+ } finally {
+ rmSync(dir, { recursive: true, force: true });
+ }
+});
+
+test('an empty file selection is a valid empty batch', () => {
+ assert.deepEqual(readHireManifestFiles([]), { manifests: [], errors: [] });
+});
+
+test('batch errors identify the file without exposing its parent directory', () => {
+ const path = join(tmpdir(), 'private-project-name', 'missing-hire.json');
+ const result = readHireManifestFiles([path]);
+ assert.equal(result.manifests.length, 0);
+ assert.match(result.errors[0], /missing-hire\.json/);
+ assert.doesNotMatch(result.errors[0], /private-project-name/);
+});
+
+test('Electron picker and IPC validate the full selection rather than file zero', () => {
+ const source = readFileSync('src/main/index.ts', 'utf8');
+ const start = source.indexOf("ipcMain.handle('hire:openFile'");
+ const end = source.indexOf('\n/**', start);
+ const handler = source.slice(start, end);
+ assert.ok(start >= 0 && end > start, 'hire import IPC handler is present');
+ assert.match(handler, /properties:\s*\['openFile', 'multiSelections'\]/);
+ assert.match(handler, /readHireManifestFiles\(res\.filePaths\)/);
+ assert.doesNotMatch(handler, /res\.filePaths\[0\]/);
+});
+
+test('renderer wiring appends every cold-start and runtime arrival', () => {
+ const app = readFileSync('src/renderer/src/App.tsx', 'utf8');
+ assert.match(app, /enqueuePendingHires\(\[m\]\)/);
+ assert.match(app, /enqueuePendingHires\(queued\)/);
+ assert.doesNotMatch(app, /queued\[queued\.length\s*-\s*1\]/);
+});
+
+test('review UI exposes progress and an explicit skip without auto-spawn', () => {
+ const modal = readFileSync('src/renderer/src/components/AddAgentModal.tsx', 'utf8');
+ assert.match(modal, /hireQueueProgress\(hireQueue\)/);
+ assert.match(modal, />skip hire<\/PixelButton>/);
+ assert.match(modal, /finishPendingHire\(\)/);
+ const start = modal.indexOf('const importHire = async');
+ const end = modal.indexOf('const submit = async', start);
+ const importFlow = modal.slice(start, end);
+ assert.match(importFlow, /enqueuePendingHires\(res\.manifests\)/);
+ assert.doesNotMatch(importFlow, /spawnPty/);
+});
diff --git a/test/hire-queue.test.cjs b/test/hire-queue.test.cjs
new file mode 100644
index 00000000..ba11232c
--- /dev/null
+++ b/test/hire-queue.test.cjs
@@ -0,0 +1,50 @@
+'use strict';
+
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const loadTs = require('./load-ts.cjs');
+
+const {
+ EMPTY_HIRE_QUEUE,
+ enqueueHires,
+ finishCurrentHire,
+ hireQueueProgress
+} = loadTs('src/shared/hireQueue.ts');
+
+const hire = (name) => ({ spec: 'munder-difflin/hire@1', name });
+
+test('queued hires preserve arrival order across batches instead of overwriting', () => {
+ const first = enqueueHires(EMPTY_HIRE_QUEUE, [hire('Jim'), hire('Pam')]);
+ const appended = enqueueHires(first, [hire('Dwight'), hire('Angela')]);
+
+ assert.deepEqual(appended.pending.map((m) => m.name), ['Jim', 'Pam', 'Dwight', 'Angela']);
+ assert.deepEqual(first.pending.map((m) => m.name), ['Jim', 'Pam'], 'enqueue is immutable');
+ assert.deepEqual(hireQueueProgress(appended), { current: 1, total: 4 });
+});
+
+test('spawn or skip advances exactly one hire and keeps progress stable', () => {
+ let queue = enqueueHires(EMPTY_HIRE_QUEUE, [hire('Jim'), hire('Pam'), hire('Dwight')]);
+
+ queue = finishCurrentHire(queue);
+ assert.deepEqual(queue.pending.map((m) => m.name), ['Pam', 'Dwight']);
+ assert.deepEqual(hireQueueProgress(queue), { current: 2, total: 3 });
+
+ queue = finishCurrentHire(queue);
+ assert.deepEqual(queue.pending.map((m) => m.name), ['Dwight']);
+ assert.deepEqual(hireQueueProgress(queue), { current: 3, total: 3 });
+});
+
+test('draining the queue resets progress for the next independent import', () => {
+ const one = enqueueHires(EMPTY_HIRE_QUEUE, [hire('Jim')]);
+ const drained = finishCurrentHire(one);
+ const next = enqueueHires(drained, [hire('Pam'), hire('Dwight')]);
+
+ assert.deepEqual(drained, EMPTY_HIRE_QUEUE);
+ assert.deepEqual(hireQueueProgress(drained), null);
+ assert.deepEqual(hireQueueProgress(next), { current: 1, total: 2 });
+});
+
+test('empty arrivals and advances do not invent queue state', () => {
+ assert.deepEqual(enqueueHires(EMPTY_HIRE_QUEUE, []), EMPTY_HIRE_QUEUE);
+ assert.deepEqual(finishCurrentHire(EMPTY_HIRE_QUEUE), EMPTY_HIRE_QUEUE);
+});