@joshski/dust 0.1.20 → 0.1.21

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/dist/dust.js CHANGED
@@ -1721,7 +1721,7 @@ function createDefaultDependencies() {
1721
1721
  postEvent: defaultPostEvent
1722
1722
  };
1723
1723
  }
1724
- function createEventPoster(eventsUrl, sessionId, postEvent, onError) {
1724
+ function createEventPoster(eventsUrl, sessionId, postEvent, onError, getAgentSessionId) {
1725
1725
  let sequence = 0;
1726
1726
  return (event) => {
1727
1727
  if (!eventsUrl)
@@ -1735,6 +1735,10 @@ function createEventPoster(eventsUrl, sessionId, postEvent, onError) {
1735
1735
  };
1736
1736
  if (event.type.startsWith("claude.")) {
1737
1737
  payload.agentType = "claude";
1738
+ const agentSessionId = getAgentSessionId?.();
1739
+ if (agentSessionId) {
1740
+ payload.agentSessionId = agentSessionId;
1741
+ }
1738
1742
  }
1739
1743
  postEvent(eventsUrl, payload).catch(onError);
1740
1744
  };
@@ -1855,10 +1859,11 @@ async function loopClaude(dependencies, loopDependencies = createDefaultDependen
1855
1859
  const maxIterations = parseMaxIterations(dependencies.arguments);
1856
1860
  const eventsUrl = settings.eventsUrl;
1857
1861
  const sessionId = crypto.randomUUID();
1862
+ let agentSessionId;
1858
1863
  const postEventFn = createEventPoster(eventsUrl, sessionId, postEvent, (error) => {
1859
1864
  const message = error instanceof Error ? error.message : String(error);
1860
1865
  context.stderr(`Event POST failed: ${message}`);
1861
- });
1866
+ }, () => agentSessionId);
1862
1867
  const emit = (event) => {
1863
1868
  const formatted = formatEvent(event);
1864
1869
  if (formatted !== null) {
@@ -1874,10 +1879,14 @@ async function loopClaude(dependencies, loopDependencies = createDefaultDependen
1874
1879
  const iterationOptions = {};
1875
1880
  if (eventsUrl) {
1876
1881
  iterationOptions.onRawEvent = (rawEvent) => {
1882
+ if (rawEvent.type === "result" && typeof rawEvent.session_id === "string" && rawEvent.session_id) {
1883
+ agentSessionId = rawEvent.session_id;
1884
+ }
1877
1885
  emit({ type: "claude.raw_event", rawEvent });
1878
1886
  };
1879
1887
  }
1880
1888
  while (completedIterations < maxIterations) {
1889
+ agentSessionId = undefined;
1881
1890
  const result = await runOneIteration(dependencies, loopDependencies, emit, iterationOptions);
1882
1891
  if (result === "no_tasks") {
1883
1892
  await loopDependencies.sleep(SLEEP_INTERVAL_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@joshski/dust",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Flow state for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@ Goals are guiding principles that persist across tasks. They define the "why" be
5
5
  {{#if isClaudeCodeWeb}}Follow these steps. Use a todo list to track your progress.
6
6
  {{/if}}{{#unless isClaudeCodeWeb}}Follow these steps:
7
7
  {{/unless}}
8
- 1. Run `{{bin}} list goals` to see existing goals and avoid duplication
8
+ 1. Run `{{bin}} goals` to see existing goals and avoid duplication
9
9
  2. Create a new markdown file in `.dust/goals/` with a descriptive kebab-case name (e.g., `cross-platform-support.md`)
10
10
  3. Add a title as the first line using an H1 heading (e.g., `# Cross-platform support`)
11
11
  4. Write a clear description explaining:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Follow these steps:
4
4
 
5
- 1. Run `{{bin}} list ideas` to see all existing ideas and avoid duplicates
5
+ 1. Run `{{bin}} ideas` to see all existing ideas and avoid duplicates
6
6
  2. Create a new markdown file in `.dust/ideas/` with a descriptive kebab-case name (e.g., `improve-error-messages.md`)
7
7
  3. Add a title as the first line using an H1 heading (e.g., `# Improve error messages`)
8
8
  4. Write a brief description of the potential change or improvement
@@ -5,7 +5,7 @@
5
5
  Use a todo list to track your progress through these steps.
6
6
  {{/if}}{{#unless isClaudeCodeWeb}}Follow these steps:
7
7
  {{/unless}}
8
- 1. Run `{{bin}} list ideas` to see all existing ideas
8
+ 1. Run `{{bin}} ideas` to see all existing ideas
9
9
  2. Determine which ideas (if any) should be:
10
10
  - **Deleted** - if the new task fully covers the idea
11
11
  - **Updated** - if the idea's scope changes as a result of the task
@@ -5,7 +5,7 @@ Goals are guiding principles that persist across tasks. They define the "why" be
5
5
  {{#if isClaudeCodeWeb}}Follow these steps. Use a todo list to track your progress.
6
6
  {{/if}}{{#unless isClaudeCodeWeb}}Follow these steps:
7
7
  {{/unless}}
8
- 1. Run `{{bin}} list goals` to see existing goals and avoid duplication
8
+ 1. Run `{{bin}} goals` to see existing goals and avoid duplication
9
9
  2. Create a new markdown file in `.dust/goals/` with a descriptive kebab-case name (e.g., `cross-platform-support.md`)
10
10
  3. Add a title as the first line using an H1 heading (e.g., `# Cross-platform support`)
11
11
  4. Write a clear description explaining:
@@ -2,7 +2,7 @@
2
2
 
3
3
  Follow these steps:
4
4
 
5
- 1. Run `{{bin}} list ideas` to see all existing ideas and avoid duplicates
5
+ 1. Run `{{bin}} ideas` to see all existing ideas and avoid duplicates
6
6
  2. Create a new markdown file in `.dust/ideas/` with a descriptive kebab-case name (e.g., `improve-error-messages.md`)
7
7
  3. Add a title as the first line using an H1 heading (e.g., `# Improve error messages`)
8
8
  4. Write a brief description of the potential change or improvement
@@ -5,7 +5,7 @@
5
5
  Use a todo list to track your progress through these steps.
6
6
  {{/if}}{{#unless isClaudeCodeWeb}}Follow these steps:
7
7
  {{/unless}}
8
- 1. Run `{{bin}} list ideas` to see all existing ideas
8
+ 1. Run `{{bin}} ideas` to see all existing ideas
9
9
  2. Determine which ideas (if any) should be:
10
10
  - **Deleted** - if the new task fully covers the idea
11
11
  - **Updated** - if the idea's scope changes as a result of the task