@joshski/dust 0.1.84 → 0.1.86

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.
@@ -0,0 +1,25 @@
1
+ language js
2
+
3
+ or {
4
+ `vi.mock($...)` where {
5
+ register_diagnostic(span=$match, message="Avoid vi.mock(). Use dependency injection or a test helper instead.")
6
+ },
7
+ `vi.spyOn($...)` where {
8
+ register_diagnostic(span=$match, message="Avoid vi.spyOn(). Use dependency injection or a test helper instead.")
9
+ },
10
+ `vi.useFakeTimers($...)` where {
11
+ register_diagnostic(span=$match, message="Avoid vi.useFakeTimers(). Use a test helper instead.")
12
+ },
13
+ `vi.useRealTimers($...)` where {
14
+ register_diagnostic(span=$match, message="Avoid vi.useRealTimers(). Use a test helper instead.")
15
+ },
16
+ `vi.runAllTimers($...)` where {
17
+ register_diagnostic(span=$match, message="Avoid vi.runAllTimers(). Use a test helper instead.")
18
+ },
19
+ `vi.advanceTimersByTime($...)` where {
20
+ register_diagnostic(span=$match, message="Avoid vi.advanceTimersByTime(). Use a test helper instead.")
21
+ },
22
+ `vi.fn($...)` where {
23
+ register_diagnostic(span=$match, message="Avoid vi.fn(). Use a typed test double or test helper instead.")
24
+ }
25
+ }
@@ -22,7 +22,8 @@ export type AgentSessionEvent = {
22
22
  } | {
23
23
  type: 'agent-session-activity';
24
24
  } | {
25
- type: 'claude-event';
25
+ type: 'agent-event';
26
+ provider: string;
26
27
  rawEvent: Record<string, unknown>;
27
28
  };
28
29
  export interface EventMessage {
@@ -35,19 +36,19 @@ export interface EventMessage {
35
36
  event: AgentSessionEvent;
36
37
  }
37
38
  /**
38
- * Convert a raw Claude streaming event to an AgentSessionEvent.
39
+ * Convert a raw agent streaming event to an AgentSessionEvent.
39
40
  * stream_event types become activity heartbeats; everything else
40
- * is forwarded as a claude-event.
41
+ * is forwarded as an agent-event with provider info.
41
42
  */
42
- export declare function rawEventToAgentEvent(rawEvent: Record<string, unknown>): AgentSessionEvent;
43
+ export declare function rawEventToAgentEvent(rawEvent: Record<string, unknown>, provider: string): AgentSessionEvent;
43
44
  /**
44
45
  * Create a heartbeat throttler that limits agent-session-activity events
45
46
  * to at most once per interval (default: 5 seconds).
46
47
  *
47
- * The returned callback converts raw Claude events to AgentSessionEvents,
48
+ * The returned callback converts raw agent events to AgentSessionEvents,
48
49
  * throttling stream_event heartbeats while forwarding all other events.
49
50
  */
50
- export declare function createHeartbeatThrottler(onAgentEvent: (event: AgentSessionEvent) => void, options?: {
51
+ export declare function createHeartbeatThrottler(onAgentEvent: (event: AgentSessionEvent) => void, provider: string, options?: {
51
52
  intervalMs?: number;
52
53
  now?: () => number;
53
54
  }): (rawEvent: Record<string, unknown>) => void;
@@ -8,6 +8,7 @@ import type { AgentSessionEvent, EventMessage } from '../agent-events';
8
8
  import { type run as claudeRun, type RunnerDependencies } from '../claude/run';
9
9
  import type { OutputSink } from '../claude/types';
10
10
  import { type LoopEmitFn, type SendAgentEventFn } from '../cli/commands/loop';
11
+ import { type RunnerDependencies as CodexRunnerDependencies, run as codexRun } from '../codex/run';
11
12
  import type { SendEventFn } from './events';
12
13
  import { type LogBuffer } from './log-buffer';
13
14
  import type { RepositoryDependencies, RepositoryState } from './repository';
@@ -53,10 +54,20 @@ export interface LoopState {
53
54
  * Create an OutputSink that buffers stdout and logs complete lines.
54
55
  */
55
56
  export declare function createBufferStdoutSink(loopState: LoopState, logBuffer: LogBuffer): OutputSink;
57
+ /**
58
+ * Create a factory function that produces OutputSinks for agent runners.
59
+ * This factory captures loopState and logBuffer, returning a function
60
+ * that can be passed to RunnerDependencies.createStdoutSink.
61
+ */
62
+ export declare function createStdoutSinkFactory(loopState: LoopState, logBuffer: LogBuffer): () => OutputSink;
56
63
  /**
57
64
  * Create a run function that redirects Claude output to a log buffer.
58
65
  */
59
66
  export declare function createBufferRun(run: RepositoryDependencies['run'], bufferSinkDeps: RunnerDependencies): typeof claudeRun;
67
+ /**
68
+ * Create a run function that redirects Codex output to a log buffer.
69
+ */
70
+ export declare function createCodexBufferRun(run: typeof codexRun, codexBufferSinkDeps: CodexRunnerDependencies): typeof claudeRun;
60
71
  /** No-op postEvent for LoopDependencies. */
61
72
  export declare function noOpPostEvent(): Promise<void>;
62
73
  /**
@@ -41,4 +41,40 @@ export declare function buildDockerImage(config: DockerConfig, dependencies: Doc
41
41
  * Check if a Dockerfile exists at .dust/Dockerfile in the repository.
42
42
  */
43
43
  export declare function hasDockerfile(repoPath: string, dependencies: DockerDependencies): boolean;
44
+ type DockerPrepareEvent = {
45
+ type: 'loop.docker_detected';
46
+ imageTag: string;
47
+ } | {
48
+ type: 'loop.docker_building';
49
+ imageTag: string;
50
+ } | {
51
+ type: 'loop.docker_built';
52
+ imageTag: string;
53
+ } | {
54
+ type: 'loop.docker_error';
55
+ error: string;
56
+ };
57
+ interface DockerSpawnConfig {
58
+ imageTag: string;
59
+ repoPath: string;
60
+ homeDir: string;
61
+ hasGitconfig: boolean;
62
+ }
63
+ type PrepareDockerConfigResult = {
64
+ config: DockerSpawnConfig;
65
+ } | {
66
+ error: string;
67
+ } | Record<string, never>;
68
+ /**
69
+ * Prepare Docker configuration for agent execution.
70
+ *
71
+ * Checks for a .dust/Dockerfile, verifies Docker availability, builds the image,
72
+ * and returns the spawn configuration. Emits events throughout the process.
73
+ *
74
+ * Returns:
75
+ * - `{ config: DockerSpawnConfig }` on success
76
+ * - `{ error: string }` on failure (Docker not available or build failed)
77
+ * - `{}` if no Dockerfile exists
78
+ */
79
+ export declare function prepareDockerConfig(repoPath: string, dependencies: DockerDependencies, onEvent: (event: DockerPrepareEvent) => void): Promise<PrepareDockerConfigResult>;
44
80
  export {};