@joshski/dust 0.1.46 → 0.1.48

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.
Files changed (2) hide show
  1. package/dist/dust.js +24 -5
  2. package/package.json +1 -1
package/dist/dust.js CHANGED
@@ -1914,7 +1914,7 @@ async function runOneIteration(dependencies, loopDependencies, onLoopEvent, onAg
1914
1914
  const { context } = dependencies;
1915
1915
  const { spawn, run: run2 } = loopDependencies;
1916
1916
  const agentName = loopDependencies.agentType === "codex" ? "Codex" : "Claude";
1917
- const { onRawEvent } = options;
1917
+ const { onRawEvent, hooksInstalled = false } = options;
1918
1918
  onLoopEvent({ type: "loop.syncing" });
1919
1919
  const pullResult = await gitPull(context.cwd, spawn);
1920
1920
  if (!pullResult.success) {
@@ -1973,7 +1973,7 @@ Make sure the repository is in a clean state and synced with remote before finis
1973
1973
  onLoopEvent({ type: "loop.tasks_found" });
1974
1974
  const taskContent = await dependencies.fileSystem.readFile(`${dependencies.context.cwd}/${task.path}`);
1975
1975
  const { dustCommand, installCommand = "npm install" } = dependencies.settings;
1976
- const instructions = buildImplementationInstructions(dustCommand, true, task.title ?? undefined);
1976
+ const instructions = buildImplementationInstructions(dustCommand, hooksInstalled, task.title ?? undefined);
1977
1977
  const prompt = `Run \`${installCommand}\` to install dependencies, then implement the following task.
1978
1978
 
1979
1979
  The following is the contents of the task file \`${task.path}\`:
@@ -2051,6 +2051,7 @@ async function loopClaude(dependencies, loopDependencies = createDefaultDependen
2051
2051
  }
2052
2052
  sendWireEvent(event);
2053
2053
  };
2054
+ const hooksInstalled = await manageGitHooks(dependencies);
2054
2055
  onLoopEvent({ type: "loop.warning" });
2055
2056
  onLoopEvent({
2056
2057
  type: "loop.started",
@@ -2060,7 +2061,7 @@ async function loopClaude(dependencies, loopDependencies = createDefaultDependen
2060
2061
  context.stdout(" Press Ctrl+C to stop");
2061
2062
  context.stdout("");
2062
2063
  let completedIterations = 0;
2063
- const iterationOptions = {};
2064
+ const iterationOptions = { hooksInstalled };
2064
2065
  if (eventsUrl) {
2065
2066
  iterationOptions.onRawEvent = (rawEvent) => {
2066
2067
  onAgentEvent(rawEventToAgentEvent(rawEvent));
@@ -2171,14 +2172,20 @@ async function runRepositoryLoop(repoState, repoDeps, sendEvent, sessionId) {
2171
2172
  sendEvent(msg);
2172
2173
  }
2173
2174
  };
2175
+ const hooksInstalled = await manageGitHooks(commandDeps);
2174
2176
  while (!repoState.stopRequested) {
2175
2177
  agentSessionId = crypto.randomUUID();
2176
2178
  const result = await runOneIteration(commandDeps, loopDeps, onLoopEvent, onAgentEvent, {
2179
+ hooksInstalled,
2177
2180
  onRawEvent: (rawEvent) => {
2178
2181
  onAgentEvent(rawEventToAgentEvent(rawEvent));
2179
2182
  }
2180
2183
  });
2181
2184
  if (result === "no_tasks") {
2185
+ if (repoState.taskAvailablePending) {
2186
+ repoState.taskAvailablePending = false;
2187
+ continue;
2188
+ }
2182
2189
  await new Promise((resolve) => {
2183
2190
  repoState.wakeUp = () => {
2184
2191
  repoState.wakeUp = undefined;
@@ -2997,7 +3004,13 @@ function connectWebSocket(token, state, bucketDependencies, context, fileSystem,
2997
3004
  for (const repoData of repos) {
2998
3005
  if (typeof repoData === "object" && repoData !== null && "name" in repoData && "hasTask" in repoData && repoData.hasTask) {
2999
3006
  const repoState = state.repositories.get(repoData.name);
3000
- repoState?.wakeUp?.();
3007
+ if (repoState) {
3008
+ if (repoState.wakeUp) {
3009
+ repoState.wakeUp();
3010
+ } else {
3011
+ repoState.taskAvailablePending = true;
3012
+ }
3013
+ }
3001
3014
  }
3002
3015
  }
3003
3016
  }).catch((error) => {
@@ -3007,7 +3020,13 @@ function connectWebSocket(token, state, bucketDependencies, context, fileSystem,
3007
3020
  const repoName = message.repository;
3008
3021
  if (typeof repoName === "string") {
3009
3022
  const repoState = state.repositories.get(repoName);
3010
- repoState?.wakeUp?.();
3023
+ if (repoState) {
3024
+ if (repoState.wakeUp) {
3025
+ repoState.wakeUp();
3026
+ } else {
3027
+ repoState.taskAvailablePending = true;
3028
+ }
3029
+ }
3011
3030
  }
3012
3031
  }
3013
3032
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {