@joshski/dust 0.1.102 → 0.1.103
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/.dust/principles/{enable-flow-state.md → agentic-flow-state.md} +6 -2
- package/.dust/principles/human-ai-collaboration.md +1 -1
- package/.dust/principles/maintainable-codebase.md +1 -1
- package/dist/agent-events.d.ts +1 -0
- package/dist/bucket/repository.d.ts +4 -0
- package/dist/claude/types.d.ts +4 -0
- package/dist/codex/spawn-codex.d.ts +5 -1
- package/dist/command-events.d.ts +2 -1
- package/dist/container/apple-container-runtime.d.ts +12 -0
- package/dist/container/docker-runtime.d.ts +21 -0
- package/dist/container/runtime.d.ts +71 -0
- package/dist/container/select-runtime.d.ts +28 -0
- package/dist/docker/docker-agent.d.ts +35 -44
- package/dist/dust.js +641 -216
- package/dist/lint/validators/audit-validator.d.ts +15 -0
- package/dist/loop/iteration.d.ts +2 -0
- package/dist/patch.js +65 -1
- package/dist/session.d.ts +2 -0
- package/dist/validation/validation-pipeline.d.ts +1 -0
- package/dist/validation.js +65 -1
- package/lib/docker/default.Dockerfile +8 -0
- package/package.json +2 -1
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agentic Flow State
|
|
2
2
|
|
|
3
3
|
Flow is the mental state where work becomes effortless - where you're fully immersed, losing track of time, operating at peak performance. Psychologist Mihaly Csikszentmihalyi identified three conditions that create flow: clear goals, immediate feedback, and challenge-skill balance.
|
|
4
4
|
|
|
5
|
+
For AI agents, achieving flow state means staying engaged and productive without interruption. Agents enter flow when they have optimal context, comprehensive guard rails, and minimal friction. Context window optimization ensures agents have exactly what they need without cognitive overload. In-session guard rails prevent agents from straying off course or making mistakes that break their momentum.
|
|
6
|
+
|
|
5
7
|
Dust's design targets these conditions directly:
|
|
6
8
|
|
|
7
9
|
- **Clear goals**: Task files and lightweight planning give you a concrete target. You know exactly what you're building next.
|
|
8
10
|
- **Immediate feedback**: Fast feedback loops let you see results quickly. Each change confirms you're on track or shows you what to adjust.
|
|
9
11
|
- **Challenge-skill balance**: Small units of work and agent autonomy keep you in the zone - challenged enough to stay engaged, supported enough to succeed.
|
|
12
|
+
- **Context window efficiency**: Progressive disclosure and artifact summarization ensure agents have the right context without overflow.
|
|
13
|
+
- **Comprehensive guard rails**: Lint rules, type checks, and automated validation catch mistakes before they compound.
|
|
10
14
|
|
|
11
|
-
Everything dust does serves flow. When
|
|
15
|
+
Everything dust does serves flow. When agents stay in flow, they produce better work, sustain their momentum, and complete tasks autonomously.
|
|
12
16
|
|
|
13
17
|
## Parent Principle
|
|
14
18
|
|
package/dist/agent-events.d.ts
CHANGED
|
@@ -67,6 +67,10 @@ export interface RepositoryDependencies {
|
|
|
67
67
|
revealFamily?: (familyName: string) => void;
|
|
68
68
|
/** Shell runner for pre-flight commands (install, check) */
|
|
69
69
|
shellRunner?: import('../cli/process-runner').ShellRunner;
|
|
70
|
+
/** Force Docker mode using bundled default Dockerfile */
|
|
71
|
+
forceDocker?: boolean;
|
|
72
|
+
/** Force Apple Container mode using bundled default Dockerfile */
|
|
73
|
+
forceAppleContainer?: boolean;
|
|
70
74
|
}
|
|
71
75
|
/**
|
|
72
76
|
* Start (or restart) the per-repository loop and keep lifecycle state accurate.
|
package/dist/claude/types.d.ts
CHANGED
|
@@ -48,6 +48,10 @@ export interface OutputSink {
|
|
|
48
48
|
line(text: string): void;
|
|
49
49
|
}
|
|
50
50
|
export interface DockerSpawnConfig {
|
|
51
|
+
/** CLI command for running containers (e.g., 'docker', 'container') */
|
|
52
|
+
runCommand?: string;
|
|
53
|
+
/** Hostname or IP the container uses to reach the host */
|
|
54
|
+
hostAddress?: string;
|
|
51
55
|
/** Docker image tag to use */
|
|
52
56
|
imageTag: string;
|
|
53
57
|
/** Path to the repository (used for volume mounts) */
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import type { RawEvent, SpawnOptions } from '../claude/types';
|
|
1
|
+
import type { DockerSpawnConfig, RawEvent, SpawnOptions } from '../claude/types';
|
|
2
2
|
import type { CreateReadlineForEvents, SpawnForEvents } from '../process/spawn-contract';
|
|
3
3
|
export interface EventSourceDependencies {
|
|
4
4
|
spawn: SpawnForEvents;
|
|
5
5
|
createInterface: CreateReadlineForEvents;
|
|
6
6
|
}
|
|
7
7
|
export declare const defaultDependencies: EventSourceDependencies;
|
|
8
|
+
/**
|
|
9
|
+
* Build docker run arguments for spawning codex in a container.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildDockerRunArguments(docker: DockerSpawnConfig, codexArguments: string[], env: Record<string, string>): string[];
|
|
8
12
|
export declare function spawnCodex(prompt: string, options?: SpawnOptions, dependencies?: EventSourceDependencies): AsyncGenerator<RawEvent>;
|
package/dist/command-events.d.ts
CHANGED
|
@@ -53,10 +53,11 @@ export type CommandEvent = {
|
|
|
53
53
|
export interface CommandEventMessage {
|
|
54
54
|
sequence: number;
|
|
55
55
|
timestamp: string;
|
|
56
|
+
traceId?: string;
|
|
56
57
|
event: CommandEvent;
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
60
|
* Creates an event emitter function that writes command events to a callback.
|
|
60
61
|
* Each event is wrapped in a CommandEventMessage envelope with sequence and timestamp.
|
|
61
62
|
*/
|
|
62
|
-
export declare function createEventEmitter(writeEvent: (message: CommandEventMessage) => void): (event: CommandEvent) => void;
|
|
63
|
+
export declare function createEventEmitter(writeEvent: (message: CommandEventMessage) => void, traceId?: string): (event: CommandEvent) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Container implementation of the ContainerRuntime interface.
|
|
3
|
+
*
|
|
4
|
+
* Apple's container project (https://github.com/apple/container) runs Linux
|
|
5
|
+
* containers as lightweight VMs on Apple Silicon (macOS 26+). It uses
|
|
6
|
+
* OCI-compatible images, so existing Dockerfiles work without modification.
|
|
7
|
+
*/
|
|
8
|
+
import type { ContainerRuntime } from './runtime';
|
|
9
|
+
/**
|
|
10
|
+
* Apple Container runtime implementation.
|
|
11
|
+
*/
|
|
12
|
+
export declare const appleContainerRuntime: ContainerRuntime;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker implementation of the ContainerRuntime interface.
|
|
3
|
+
*/
|
|
4
|
+
import type { ContainerDependencies, ContainerRuntime } from './runtime';
|
|
5
|
+
/**
|
|
6
|
+
* Get the path to the bundled default Dockerfile.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getDefaultDockerfilePath(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a deterministic Docker image tag from the repository path.
|
|
11
|
+
* Uses the repository directory name, sanitized for Docker tag requirements.
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateImageTag(repoPath: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Check if a Dockerfile exists at .dust/config/container/Dockerfile.
|
|
16
|
+
*/
|
|
17
|
+
export declare function hasDockerfile(repoPath: string, dependencies: ContainerDependencies): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Docker runtime implementation.
|
|
20
|
+
*/
|
|
21
|
+
export declare const dockerRuntime: ContainerRuntime;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container runtime abstraction for dust agent execution.
|
|
3
|
+
*
|
|
4
|
+
* This module defines a provider-agnostic interface for container runtimes,
|
|
5
|
+
* allowing dust to support multiple container technologies (Docker, Apple
|
|
6
|
+
* Container, etc.) while keeping the agent orchestration logic decoupled.
|
|
7
|
+
*/
|
|
8
|
+
import type { spawn as nodeSpawn } from 'node:child_process';
|
|
9
|
+
import type os from 'node:os';
|
|
10
|
+
/**
|
|
11
|
+
* Dependencies injected into container runtime operations.
|
|
12
|
+
* Keeps the runtime implementations pure by externalizing I/O.
|
|
13
|
+
*/
|
|
14
|
+
export interface ContainerDependencies {
|
|
15
|
+
spawn: typeof nodeSpawn;
|
|
16
|
+
homedir: typeof os.homedir;
|
|
17
|
+
existsSync: (path: string) => boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for building a container image.
|
|
21
|
+
*/
|
|
22
|
+
export interface BuildConfig {
|
|
23
|
+
/** Path to the repository root */
|
|
24
|
+
repoPath: string;
|
|
25
|
+
/** Tag to apply to the built image */
|
|
26
|
+
imageTag: string;
|
|
27
|
+
/** Optional path to a custom Dockerfile */
|
|
28
|
+
dockerfilePath?: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of a container image build operation.
|
|
32
|
+
*/
|
|
33
|
+
export type BuildResult = {
|
|
34
|
+
success: true;
|
|
35
|
+
} | {
|
|
36
|
+
success: false;
|
|
37
|
+
error: string;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for running a container.
|
|
41
|
+
*/
|
|
42
|
+
export interface RunConfig {
|
|
43
|
+
imageTag: string;
|
|
44
|
+
repoPath: string;
|
|
45
|
+
homeDir: string;
|
|
46
|
+
gitProxyUrl?: string;
|
|
47
|
+
claudeApiProxyUrl?: string;
|
|
48
|
+
settingsFilePath?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Abstract interface for container runtimes.
|
|
52
|
+
*
|
|
53
|
+
* Each runtime implementation provides the same capabilities through
|
|
54
|
+
* its native CLI tools. The interface is designed for:
|
|
55
|
+
* - Pure functions where possible (buildRunArgs)
|
|
56
|
+
* - Dependency injection for I/O operations (isAvailable, buildImage)
|
|
57
|
+
*/
|
|
58
|
+
export interface ContainerRuntime {
|
|
59
|
+
/** Unique identifier for this runtime */
|
|
60
|
+
name: 'docker' | 'apple-container';
|
|
61
|
+
/** Check if the runtime CLI is available on the system */
|
|
62
|
+
isAvailable: (dependencies: ContainerDependencies) => Promise<boolean>;
|
|
63
|
+
/** Build an image from a Dockerfile */
|
|
64
|
+
buildImage: (config: BuildConfig, dependencies: ContainerDependencies) => Promise<BuildResult>;
|
|
65
|
+
/** The CLI command for running containers (e.g., 'docker', 'container') */
|
|
66
|
+
runCommand: string;
|
|
67
|
+
/** Hostname or IP the container uses to reach the host (e.g., 'host.docker.internal', '192.168.64.1') */
|
|
68
|
+
hostAddress: string;
|
|
69
|
+
/** Map dust's run options to CLI arguments */
|
|
70
|
+
buildRunArgs: (config: RunConfig) => string[];
|
|
71
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime selection logic for container execution.
|
|
3
|
+
*
|
|
4
|
+
* Selects the appropriate container runtime based on CLI flags.
|
|
5
|
+
*/
|
|
6
|
+
import type { ContainerRuntime } from './runtime';
|
|
7
|
+
interface RuntimeFlags {
|
|
8
|
+
docker: boolean;
|
|
9
|
+
appleContainer: boolean;
|
|
10
|
+
}
|
|
11
|
+
type RuntimeSelectionResult = {
|
|
12
|
+
success: true;
|
|
13
|
+
runtime: ContainerRuntime | null;
|
|
14
|
+
forceContainer: boolean;
|
|
15
|
+
} | {
|
|
16
|
+
success: false;
|
|
17
|
+
error: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Select container runtime based on CLI flags.
|
|
21
|
+
*
|
|
22
|
+
* Returns:
|
|
23
|
+
* - `{ success: true, runtime: ContainerRuntime, forceContainer: true }` when a runtime flag is set
|
|
24
|
+
* - `{ success: true, runtime: null, forceContainer: false }` when no flags are set (use Dockerfile detection)
|
|
25
|
+
* - `{ success: false, error: string }` when both flags are set (mutually exclusive)
|
|
26
|
+
*/
|
|
27
|
+
export declare function selectContainerRuntime(flags: RuntimeFlags): RuntimeSelectionResult;
|
|
28
|
+
export {};
|
|
@@ -1,47 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Docker-based agent execution for dust loop.
|
|
3
3
|
*
|
|
4
|
-
* When a repository contains a .dust/Dockerfile, the agent
|
|
5
|
-
* a Docker container instead of directly on the host. This
|
|
6
|
-
* isolation and lets each project define its ideal agent environment.
|
|
4
|
+
* When a repository contains a .dust/config/container/Dockerfile, the agent
|
|
5
|
+
* runs inside a Docker container instead of directly on the host. This
|
|
6
|
+
* provides isolation and lets each project define its ideal agent environment.
|
|
7
|
+
*
|
|
8
|
+
* This module re-exports utilities from the container abstraction layer
|
|
9
|
+
* and provides the high-level prepareDockerConfig orchestration function.
|
|
7
10
|
*/
|
|
8
|
-
import type {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
import type { ContainerDependencies, ContainerRuntime } from '../container/runtime';
|
|
12
|
+
import { generateImageTag, getDefaultDockerfilePath, hasDockerfile } from '../container/docker-runtime';
|
|
13
|
+
export type { ContainerDependencies as DockerDependencies } from '../container/runtime';
|
|
14
|
+
export { generateImageTag, getDefaultDockerfilePath, hasDockerfile };
|
|
15
|
+
export declare function isDockerAvailable(dependencies: ContainerDependencies): Promise<boolean>;
|
|
16
|
+
export declare function buildDockerImage(config: {
|
|
12
17
|
repoPath: string;
|
|
13
|
-
/** Docker image tag to use (e.g., 'dust-agent-myrepo') */
|
|
14
18
|
imageTag: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
spawn: typeof nodeSpawn;
|
|
18
|
-
homedir: typeof os.homedir;
|
|
19
|
-
existsSync: (path: string) => boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Check if Docker is available on the system.
|
|
23
|
-
*/
|
|
24
|
-
export declare function isDockerAvailable(dependencies: DockerDependencies): Promise<boolean>;
|
|
25
|
-
/**
|
|
26
|
-
* Generate a deterministic Docker image tag from the repository path.
|
|
27
|
-
* Uses the repository directory name, sanitized for Docker tag requirements.
|
|
28
|
-
*/
|
|
29
|
-
export declare function generateImageTag(repoPath: string): string;
|
|
30
|
-
type BuildResult = {
|
|
19
|
+
dockerfilePath?: string;
|
|
20
|
+
}, dependencies: ContainerDependencies): Promise<{
|
|
31
21
|
success: true;
|
|
32
22
|
} | {
|
|
33
23
|
success: false;
|
|
34
24
|
error: string;
|
|
35
|
-
}
|
|
25
|
+
}>;
|
|
36
26
|
/**
|
|
37
|
-
*
|
|
27
|
+
* Check if a Dockerfile exists at the legacy .dust/Dockerfile location.
|
|
38
28
|
*/
|
|
39
|
-
export declare function
|
|
40
|
-
|
|
41
|
-
* Check if a Dockerfile exists at .dust/Dockerfile in the repository.
|
|
42
|
-
*/
|
|
43
|
-
export declare function hasDockerfile(repoPath: string, dependencies: DockerDependencies): boolean;
|
|
44
|
-
type DockerPrepareEvent = {
|
|
29
|
+
export declare function hasLegacyDockerfile(repoPath: string, dependencies: ContainerDependencies): boolean;
|
|
30
|
+
type ContainerPrepareEvent = {
|
|
45
31
|
type: 'loop.docker_detected';
|
|
46
32
|
imageTag: string;
|
|
47
33
|
} | {
|
|
@@ -54,26 +40,31 @@ type DockerPrepareEvent = {
|
|
|
54
40
|
type: 'loop.docker_error';
|
|
55
41
|
error: string;
|
|
56
42
|
};
|
|
57
|
-
interface
|
|
43
|
+
interface ContainerSpawnConfig {
|
|
58
44
|
imageTag: string;
|
|
59
45
|
repoPath: string;
|
|
60
46
|
homeDir: string;
|
|
61
47
|
}
|
|
62
|
-
type
|
|
63
|
-
config:
|
|
48
|
+
type PrepareContainerConfigResult = {
|
|
49
|
+
config: ContainerSpawnConfig;
|
|
64
50
|
} | {
|
|
65
51
|
error: string;
|
|
66
52
|
} | Record<string, never>;
|
|
53
|
+
interface PrepareContainerOptions {
|
|
54
|
+
forceContainer?: boolean;
|
|
55
|
+
}
|
|
67
56
|
/**
|
|
68
|
-
* Prepare
|
|
57
|
+
* Prepare container configuration with a specific runtime.
|
|
69
58
|
*
|
|
70
|
-
*
|
|
71
|
-
|
|
59
|
+
* When runtime is null, defaults to Docker runtime (for Dockerfile detection mode).
|
|
60
|
+
*/
|
|
61
|
+
export declare function prepareContainerConfigWithRuntime(repoPath: string, dependencies: ContainerDependencies, onEvent: (event: ContainerPrepareEvent) => void, runtime: ContainerRuntime | null, options?: PrepareContainerOptions): Promise<PrepareContainerConfigResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Prepare Docker configuration for agent execution.
|
|
72
64
|
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
* - `{ error: string }` on failure (Docker not available or build failed)
|
|
76
|
-
* - `{}` if no Dockerfile exists
|
|
65
|
+
* This is a thin wrapper around prepareContainerConfig that uses the Docker
|
|
66
|
+
* runtime. Kept for backward compatibility with existing callers.
|
|
77
67
|
*/
|
|
78
|
-
export declare function prepareDockerConfig(repoPath: string, dependencies:
|
|
79
|
-
|
|
68
|
+
export declare function prepareDockerConfig(repoPath: string, dependencies: ContainerDependencies, onEvent: (event: ContainerPrepareEvent) => void, options?: {
|
|
69
|
+
forceDocker?: boolean;
|
|
70
|
+
}): Promise<PrepareContainerConfigResult>;
|