@joshski/dust 0.1.101 → 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/audits.js +33 -1
- package/dist/bucket/repository.d.ts +4 -0
- package/dist/claude/spawn-claude-code.d.ts +12 -0
- package/dist/claude/types.d.ts +6 -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 +919 -259
- package/dist/env-config.d.ts +2 -0
- package/dist/filesystem-emulator.js +1 -1
- package/dist/lint/validators/audit-validator.d.ts +15 -0
- package/dist/logging/index.d.ts +10 -1
- package/dist/logging/match.d.ts +21 -1
- package/dist/logging.js +18 -3
- package/dist/loop/iteration.d.ts +2 -0
- package/dist/patch.js +65 -1
- package/dist/proxy/claude-api-proxy.d.ts +34 -1
- package/dist/proxy/git-credential-proxy.d.ts +2 -0
- package/dist/proxy/helper-token.d.ts +73 -0
- 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
package/dist/audits.js
CHANGED
|
@@ -141,11 +141,12 @@ function checksAuditTemplate() {
|
|
|
141
141
|
- Created ideas for each missing check category
|
|
142
142
|
- For multi-ecosystem projects, created separate ideas per ecosystem
|
|
143
143
|
- Each idea includes suggested command and alternatives
|
|
144
|
+
- No changes to files outside \`.dust/\`
|
|
144
145
|
`;
|
|
145
146
|
}
|
|
146
147
|
|
|
147
148
|
// lib/audits/stock-audits.ts
|
|
148
|
-
var ideasHint = "Review existing ideas in `./.dust/ideas/` to understand what has been proposed or considered historically, then create new idea files in `./.dust/ideas/` for any issues you identify, avoiding duplication.";
|
|
149
|
+
var ideasHint = "Review existing ideas in `./.dust/ideas/` to understand what has been proposed or considered historically, then create new idea files in `./.dust/ideas/` for any issues you identify, avoiding duplication. Do not modify source code - create ideas instead.";
|
|
149
150
|
function dataAccessReview() {
|
|
150
151
|
return dedent`
|
|
151
152
|
# Data Access Review
|
|
@@ -196,6 +197,7 @@ function dataAccessReview() {
|
|
|
196
197
|
- Checked for sequential operations that could be batched
|
|
197
198
|
- Verified connection/resource cleanup is handled properly
|
|
198
199
|
- Proposed ideas for any data access improvements identified
|
|
200
|
+
- No changes to files outside \`.dust/\`
|
|
199
201
|
`;
|
|
200
202
|
}
|
|
201
203
|
function coverageExclusions() {
|
|
@@ -243,6 +245,7 @@ function coverageExclusions() {
|
|
|
243
245
|
- Labeled justification quality for visibility
|
|
244
246
|
- Identified exclusions that could be removed through decoupling
|
|
245
247
|
- Proposed ideas for refactoring where feasible
|
|
248
|
+
- No changes to files outside \`.dust/\`
|
|
246
249
|
`;
|
|
247
250
|
}
|
|
248
251
|
function componentReuse() {
|
|
@@ -273,6 +276,7 @@ function componentReuse() {
|
|
|
273
276
|
- Evaluated each case for whether extraction would be beneficial
|
|
274
277
|
- Considered whether similar code serves different purposes that may evolve independently
|
|
275
278
|
- Proposed ideas only for extractions where duplication is truly about the same concept
|
|
279
|
+
- No changes to files outside \`.dust/\`
|
|
276
280
|
`;
|
|
277
281
|
}
|
|
278
282
|
function agentDeveloperExperience() {
|
|
@@ -304,6 +308,7 @@ function agentDeveloperExperience() {
|
|
|
304
308
|
- Measured feedback loop speed (time from change to check result)
|
|
305
309
|
- Confirmed debugging tools and structured logging are in place
|
|
306
310
|
- Proposed ideas for any improvements identified
|
|
311
|
+
- No changes to files outside \`.dust/\`
|
|
307
312
|
`;
|
|
308
313
|
}
|
|
309
314
|
function agentInstructionQuality() {
|
|
@@ -468,6 +473,7 @@ function agentInstructionQuality() {
|
|
|
468
473
|
- Found instructions that could be replaced by linter rules
|
|
469
474
|
- Documented each issue with location, type, impact, and suggestion
|
|
470
475
|
- Created ideas for substantial instruction improvements
|
|
476
|
+
- No changes to files outside \`.dust/\`
|
|
471
477
|
`;
|
|
472
478
|
}
|
|
473
479
|
function deadCode() {
|
|
@@ -501,6 +507,7 @@ function deadCode() {
|
|
|
501
507
|
- Created list of code safe to remove
|
|
502
508
|
- Verified removal won't break dynamic imports or reflection
|
|
503
509
|
- Proposed ideas for any dead code worth removing
|
|
510
|
+
- No changes to files outside \`.dust/\`
|
|
504
511
|
`;
|
|
505
512
|
}
|
|
506
513
|
function documentationDrift() {
|
|
@@ -614,6 +621,7 @@ function documentationDrift() {
|
|
|
614
621
|
- Reviewed inline comments for outdated descriptions
|
|
615
622
|
- Documented each drift finding with location, claim, reality, and suggested fix
|
|
616
623
|
- Created ideas for any substantial documentation updates needed
|
|
624
|
+
- No changes to files outside \`.dust/\`
|
|
617
625
|
`;
|
|
618
626
|
}
|
|
619
627
|
function factsVerification() {
|
|
@@ -649,6 +657,7 @@ function factsVerification() {
|
|
|
649
657
|
- Listed missing facts that would help agents
|
|
650
658
|
- Updated or removed stale facts
|
|
651
659
|
- Proposed ideas for any facts improvements needed
|
|
660
|
+
- No changes to files outside \`.dust/\`
|
|
652
661
|
`;
|
|
653
662
|
}
|
|
654
663
|
function feedbackLoopSpeed() {
|
|
@@ -775,6 +784,7 @@ function feedbackLoopSpeed() {
|
|
|
775
784
|
- Flagged dominant checks (>30% of total time)
|
|
776
785
|
- Documented findings in summary table format
|
|
777
786
|
- Created ideas for any feedback loop speed improvements identified
|
|
787
|
+
- No changes to files outside \`.dust/\`
|
|
778
788
|
`;
|
|
779
789
|
}
|
|
780
790
|
function ideasFromPrinciples() {
|
|
@@ -808,6 +818,7 @@ function ideasFromPrinciples() {
|
|
|
808
818
|
- Analyzed codebase for alignment with each principle
|
|
809
819
|
- Listed gaps between current state and principle intent
|
|
810
820
|
- Proposed new ideas for unmet or underserved principles
|
|
821
|
+
- No changes to files outside \`.dust/\`
|
|
811
822
|
`;
|
|
812
823
|
}
|
|
813
824
|
function commitReview() {
|
|
@@ -860,6 +871,7 @@ function commitReview() {
|
|
|
860
871
|
- Noted areas where changes could be generalized
|
|
861
872
|
- Provided specific suggestions for each opportunity
|
|
862
873
|
- Created ideas for any substantial work identified
|
|
874
|
+
- No changes to files outside \`.dust/\`
|
|
863
875
|
`;
|
|
864
876
|
}
|
|
865
877
|
function securityReview() {
|
|
@@ -924,6 +936,7 @@ function securityReview() {
|
|
|
924
936
|
- Ran lightweight pattern scan for obvious issues (documented as supplementary)
|
|
925
937
|
- Created ideas for any missing security tooling categories
|
|
926
938
|
- Each idea specifies which tool to add and where to configure it
|
|
939
|
+
- No changes to files outside \`.dust/\`
|
|
927
940
|
`;
|
|
928
941
|
}
|
|
929
942
|
function staleIdeas() {
|
|
@@ -958,6 +971,7 @@ function staleIdeas() {
|
|
|
958
971
|
- Reviewed each stale idea for current relevance
|
|
959
972
|
- Promoted actionable ideas to tasks
|
|
960
973
|
- Deleted ideas that are no longer relevant
|
|
974
|
+
- No changes to files outside \`.dust/\`
|
|
961
975
|
`;
|
|
962
976
|
}
|
|
963
977
|
function errorHandling() {
|
|
@@ -1006,6 +1020,7 @@ function errorHandling() {
|
|
|
1006
1020
|
- Reviewed error messages for actionability
|
|
1007
1021
|
- Compared error handling consistency across similar operations
|
|
1008
1022
|
- Proposed ideas for any error handling improvements identified
|
|
1023
|
+
- No changes to files outside \`.dust/\`
|
|
1009
1024
|
`;
|
|
1010
1025
|
}
|
|
1011
1026
|
function globalState() {
|
|
@@ -1056,6 +1071,7 @@ function globalState() {
|
|
|
1056
1071
|
- Checked for scattered process.env access
|
|
1057
1072
|
- Documented impact of each global state instance on testing
|
|
1058
1073
|
- Proposed ideas for refactoring global state to explicit dependencies
|
|
1074
|
+
- No changes to files outside \`.dust/\`
|
|
1059
1075
|
`;
|
|
1060
1076
|
}
|
|
1061
1077
|
function repositoryContext() {
|
|
@@ -1105,6 +1121,7 @@ function repositoryContext() {
|
|
|
1105
1121
|
- Design philosophy or guiding approach is captured
|
|
1106
1122
|
- Document is concise enough to fit comfortably in an agent context window
|
|
1107
1123
|
- A new agent reading only this document could make sensible high-level suggestions
|
|
1124
|
+
- No changes to files outside \`.dust/\`
|
|
1108
1125
|
`;
|
|
1109
1126
|
}
|
|
1110
1127
|
function slowTests() {
|
|
@@ -1157,6 +1174,7 @@ function slowTests() {
|
|
|
1157
1174
|
- Reviewed beforeEach/beforeAll for optimization opportunities
|
|
1158
1175
|
- Checked test parallelization configuration
|
|
1159
1176
|
- Proposed ideas for optimizing the slowest tests
|
|
1177
|
+
- No changes to files outside \`.dust/\`
|
|
1160
1178
|
`;
|
|
1161
1179
|
}
|
|
1162
1180
|
function primitiveObsession() {
|
|
@@ -1225,6 +1243,7 @@ function primitiveObsession() {
|
|
|
1225
1243
|
- Preserved Functional Core, Imperative Shell boundaries in recommendations
|
|
1226
1244
|
- Avoided speculative introduction of entirely new types
|
|
1227
1245
|
- Proposed ideas for primitive obsession improvements identified
|
|
1246
|
+
- No changes to files outside \`.dust/\`
|
|
1228
1247
|
`;
|
|
1229
1248
|
}
|
|
1230
1249
|
function singleResponsibilityViolations() {
|
|
@@ -1283,6 +1302,7 @@ function singleResponsibilityViolations() {
|
|
|
1283
1302
|
- Preserved Functional Core, Imperative Shell boundaries in recommendations
|
|
1284
1303
|
- Kept recommendations high-confidence only with clear concern boundaries
|
|
1285
1304
|
- Proposed ideas for substantial responsibility-splitting work identified
|
|
1305
|
+
- No changes to files outside \`.dust/\`
|
|
1286
1306
|
`;
|
|
1287
1307
|
}
|
|
1288
1308
|
function ubiquitousLanguage() {
|
|
@@ -1347,6 +1367,7 @@ function ubiquitousLanguage() {
|
|
|
1347
1367
|
- Reviewed factory/constructor naming for \`build*\`, \`create*\`, \`make*\`, \`new*\` consistency
|
|
1348
1368
|
- Documented any terminology drift or inconsistencies found
|
|
1349
1369
|
- Proposed ideas for standardizing inconsistent terminology
|
|
1370
|
+
- No changes to files outside \`.dust/\`
|
|
1350
1371
|
`;
|
|
1351
1372
|
}
|
|
1352
1373
|
function designPatterns() {
|
|
@@ -1414,6 +1435,7 @@ function designPatterns() {
|
|
|
1414
1435
|
- Documented each finding with location, code smell, recommended pattern, trade-offs, and migration complexity
|
|
1415
1436
|
- Noted tech-stack considerations where Gang of Four patterns may or may not apply
|
|
1416
1437
|
- Proposed ideas for any design pattern improvements identified
|
|
1438
|
+
- No changes to files outside \`.dust/\`
|
|
1417
1439
|
`;
|
|
1418
1440
|
}
|
|
1419
1441
|
function testAssertions() {
|
|
@@ -1565,6 +1587,7 @@ function testAssertions() {
|
|
|
1565
1587
|
- Found tests covering multiple unrelated behaviors
|
|
1566
1588
|
- Documented each finding with location, pattern, impact, and suggestion
|
|
1567
1589
|
- Proposed ideas for any assertion quality improvements identified
|
|
1590
|
+
- No changes to files outside \`.dust/\`
|
|
1568
1591
|
`;
|
|
1569
1592
|
}
|
|
1570
1593
|
function algorithms() {
|
|
@@ -1618,6 +1641,7 @@ function algorithms() {
|
|
|
1618
1641
|
- Checked recursive graph/tree operations for cycle protection
|
|
1619
1642
|
- Documented each finding with function name, location, complexity, data structures, optimization, and acceptability assessment
|
|
1620
1643
|
- Proposed ideas for any algorithmic improvements identified
|
|
1644
|
+
- No changes to files outside \`.dust/\`
|
|
1621
1645
|
`;
|
|
1622
1646
|
}
|
|
1623
1647
|
function loggingAndTraceability() {
|
|
@@ -1670,6 +1694,7 @@ function loggingAndTraceability() {
|
|
|
1670
1694
|
- Assessed whether running the application produces understandable output
|
|
1671
1695
|
- Tested whether logs help diagnose common failure scenarios
|
|
1672
1696
|
- Proposed ideas for any logging improvements identified
|
|
1697
|
+
- No changes to files outside \`.dust/\`
|
|
1673
1698
|
`;
|
|
1674
1699
|
}
|
|
1675
1700
|
function testPyramid() {
|
|
@@ -1751,6 +1776,7 @@ function testPyramid() {
|
|
|
1751
1776
|
- Identified miscategorized tests (e.g., unit tests with I/O)
|
|
1752
1777
|
- Provided specific recommendations to improve pyramid shape
|
|
1753
1778
|
- Proposed ideas for any substantial test restructuring needed
|
|
1779
|
+
- No changes to files outside \`.dust/\`
|
|
1754
1780
|
`;
|
|
1755
1781
|
}
|
|
1756
1782
|
function idiomaticStyle() {
|
|
@@ -1812,6 +1838,7 @@ function idiomaticStyle() {
|
|
|
1812
1838
|
- Evaluated code style consistency with rest of codebase
|
|
1813
1839
|
- Identified anti-patterns or deprecated approaches
|
|
1814
1840
|
- Proposed ideas for any idiomaticity improvements identified
|
|
1841
|
+
- No changes to files outside \`.dust/\`
|
|
1815
1842
|
`;
|
|
1816
1843
|
}
|
|
1817
1844
|
function uxAudit() {
|
|
@@ -1876,6 +1903,7 @@ function uxAudit() {
|
|
|
1876
1903
|
- Documented findings with evidence and recommendations
|
|
1877
1904
|
- Included verification criteria for each issue
|
|
1878
1905
|
- Created ideas for any UX improvements needed
|
|
1906
|
+
- No changes to files outside \`.dust/\`
|
|
1879
1907
|
`;
|
|
1880
1908
|
}
|
|
1881
1909
|
function dependencyHealth() {
|
|
@@ -2018,6 +2046,7 @@ function dependencyHealth() {
|
|
|
2018
2046
|
- Searched for packages with known better-maintained alternatives
|
|
2019
2047
|
- Documented each concern with package name, version, type, and suggested action
|
|
2020
2048
|
- Created ideas for any dependency health improvements needed
|
|
2049
|
+
- No changes to files outside \`.dust/\`
|
|
2021
2050
|
`;
|
|
2022
2051
|
}
|
|
2023
2052
|
function ciDevelopmentParity() {
|
|
@@ -2175,6 +2204,7 @@ function ciDevelopmentParity() {
|
|
|
2175
2204
|
- Identified CI-only checks (in CI but not dust)
|
|
2176
2205
|
- Created idea files for each gap with suggested fix
|
|
2177
2206
|
- Each idea links to relevant principles
|
|
2207
|
+
- No changes to files outside \`.dust/\`
|
|
2178
2208
|
`;
|
|
2179
2209
|
}
|
|
2180
2210
|
function commitMessageQuality() {
|
|
@@ -2324,6 +2354,7 @@ function commitMessageQuality() {
|
|
|
2324
2354
|
- Identified commits missing links to issues/tasks
|
|
2325
2355
|
- Created idea files for patterns found
|
|
2326
2356
|
- Each idea includes concrete suggestions for improvement
|
|
2357
|
+
- No changes to files outside \`.dust/\`
|
|
2327
2358
|
`;
|
|
2328
2359
|
}
|
|
2329
2360
|
function suggestAudits() {
|
|
@@ -2413,6 +2444,7 @@ function suggestAudits() {
|
|
|
2413
2444
|
- Identified relevant audits based on change patterns
|
|
2414
2445
|
- Created task files for each suggested audit with rationale
|
|
2415
2446
|
- Each task explains why the audit is valuable given recent changes
|
|
2447
|
+
- No changes to files outside \`.dust/\`
|
|
2416
2448
|
`;
|
|
2417
2449
|
return content;
|
|
2418
2450
|
}
|
|
@@ -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.
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import type { CreateReadlineForEvents, SpawnForEvents } from '../process/spawn-contract';
|
|
2
2
|
import type { DockerSpawnConfig, RawEvent, SpawnOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Generate Claude Code settings JSON with apiKeyHelper configured to fetch
|
|
5
|
+
* tokens from the given proxy URL.
|
|
6
|
+
*
|
|
7
|
+
* The helper command uses curl to fetch a short-TTL helper token from the
|
|
8
|
+
* host-side proxy's /token endpoint. This token is validated by the proxy
|
|
9
|
+
* when the container makes Claude API requests.
|
|
10
|
+
*
|
|
11
|
+
* @param proxyUrl - The Claude API proxy URL (e.g., http://host.docker.internal:3002)
|
|
12
|
+
* @returns Settings JSON string for Claude Code
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateApiKeyHelperSettings(proxyUrl: string): string;
|
|
3
15
|
export interface EventSourceDependencies {
|
|
4
16
|
spawn: SpawnForEvents;
|
|
5
17
|
createInterface: CreateReadlineForEvents;
|
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) */
|
|
@@ -58,6 +62,8 @@ export interface DockerSpawnConfig {
|
|
|
58
62
|
gitProxyUrl?: string;
|
|
59
63
|
/** Claude API proxy URL (e.g., http://host.docker.internal:3002) */
|
|
60
64
|
claudeApiProxyUrl?: string;
|
|
65
|
+
/** Path to settings file on host to mount into container (for apiKeyHelper) */
|
|
66
|
+
settingsFilePath?: string;
|
|
61
67
|
}
|
|
62
68
|
export interface SpawnOptions {
|
|
63
69
|
cwd?: string;
|
|
@@ -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>;
|