@drisp/cli 0.5.21 → 0.5.23

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/README.md CHANGED
@@ -107,6 +107,8 @@ Manage marketplace sources:
107
107
  ```bash
108
108
  drisp marketplace add owner/repo # Add a marketplace source
109
109
  drisp marketplace add ./local/path # Add a local marketplace
110
+ drisp marketplace refresh # Refresh configured remote sources
111
+ drisp marketplace refresh owner/repo # Refresh one remote source
110
112
  drisp marketplace list # List configured sources
111
113
  drisp marketplace remove owner/repo # Remove a source
112
114
  ```
@@ -248,7 +250,7 @@ Config merges in order: **global → project → CLI flags**.
248
250
  | `resume [id]` | Resume most recent or specific session |
249
251
  | `exec "<prompt>"` | Headless run for CI / scripting |
250
252
  | `workflow <sub>` | `install` · `list` · `search` · `remove` · `upgrade` · `use` |
251
- | `marketplace <sub>` | `add` · `remove` · `list` |
253
+ | `marketplace <sub>` | `add` · `refresh` · `remove` · `list` |
252
254
 
253
255
  </details>
254
256
 
@@ -8,7 +8,7 @@ import {
8
8
  installWorkflowPlugins,
9
9
  resolveWorkflow,
10
10
  writeGlobalConfig
11
- } from "./chunk-FLS4B7JS.js";
11
+ } from "./chunk-JHSADKDJ.js";
12
12
 
13
13
  // src/setup/steps/WorkflowInstallWizard.tsx
14
14
  import { useState, useEffect, useCallback, useRef } from "react";
@@ -92,4 +92,4 @@ function WorkflowInstallWizard({ source, onDone }) {
92
92
  export {
93
93
  WorkflowInstallWizard as default
94
94
  };
95
- //# sourceMappingURL=WorkflowInstallWizard-KP7AEBPQ.js.map
95
+ //# sourceMappingURL=WorkflowInstallWizard-CCCUR6KA.js.map
@@ -2440,7 +2440,7 @@ var cachedVersion = null;
2440
2440
  function readVersion() {
2441
2441
  if (cachedVersion !== null) return cachedVersion;
2442
2442
  try {
2443
- const injected = "0.5.21";
2443
+ const injected = "0.5.23";
2444
2444
  if (typeof injected === "string" && injected.length > 0) {
2445
2445
  cachedVersion = injected;
2446
2446
  return cachedVersion;
@@ -34,7 +34,7 @@ import {
34
34
  resolveWorkflow,
35
35
  resolveWorkflowInstall,
36
36
  resolveWorkflowPlugins
37
- } from "./chunk-FLS4B7JS.js";
37
+ } from "./chunk-JHSADKDJ.js";
38
38
 
39
39
  // src/infra/daemon/stateDir.ts
40
40
  import fs from "fs";
@@ -18237,4 +18237,4 @@ export {
18237
18237
  startUdsServer,
18238
18238
  sendUdsRequest
18239
18239
  };
18240
- //# sourceMappingURL=chunk-3PA63KQW.js.map
18240
+ //# sourceMappingURL=chunk-EC67PEFT.js.map
@@ -361,7 +361,7 @@ var WorkflowNotFoundError = class extends Error {
361
361
  constructor(workflowName, searchedSources) {
362
362
  const sourceList = searchedSources.length ? searchedSources.join(", ") : "(no marketplaces configured)";
363
363
  super(
364
- `Workflow "${workflowName}" not found in any configured marketplace (searched: ${sourceList}).`
364
+ `Workflow "${workflowName}" not found in any configured marketplace (searched: ${sourceList}). If this workflow was recently added, run \`athena-flow marketplace refresh\` and try again.`
365
365
  );
366
366
  this.name = "WorkflowNotFoundError";
367
367
  this.workflowName = workflowName;
@@ -840,6 +840,12 @@ function refreshVersionedMarketplacePluginTarget(ref, version, sourceRepoDir) {
840
840
  }
841
841
 
842
842
  // src/infra/plugins/marketplace.ts
843
+ function pullMarketplaceRepo(owner, repo) {
844
+ const outcome = refreshMarketplaceRepo(owner, repo);
845
+ if (!outcome.ok) {
846
+ throw new MarketplaceRefreshError(outcome);
847
+ }
848
+ }
843
849
  function resolveMarketplacePlugin(ref) {
844
850
  requireGitForMarketplace("plugins");
845
851
  const { pluginName, owner, repo } = parseRef(ref);
@@ -1156,7 +1162,7 @@ var DEFAULT_COMPLETION_MARKER = "<!-- WORKFLOW_COMPLETE -->";
1156
1162
  var DEFAULT_BLOCKED_MARKER = "<!-- WORKFLOW_BLOCKED";
1157
1163
  var DEFAULT_TRACKER_PATH = ".athena/{sessionId}/tracker.md";
1158
1164
  var TRACKER_SKELETON_MARKER = "<!-- TRACKER_SKELETON -->";
1159
- var DEFAULT_CONTINUE_PROMPT = "Continue the task. Read the tracker at {trackerPath} for current progress.";
1165
+ var DEFAULT_CONTINUE_PROMPT = "Continue the task. Read the tracker at {trackerPath} for current progress. If the work is complete or blocked, the terminal marker must be the final non-empty line of the tracker; do not write any prose after it.";
1160
1166
  function createLoopManager(trackerPath, config) {
1161
1167
  let iteration = 0;
1162
1168
  let active = true;
@@ -1169,10 +1175,26 @@ function createLoopManager(trackerPath, config) {
1169
1175
  return "";
1170
1176
  }
1171
1177
  }
1178
+ function getNonEmptyLines(content) {
1179
+ return content.trimEnd().split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
1180
+ }
1181
+ function isBlockedLine(line) {
1182
+ return line === `${blockedMarker} -->` || line.startsWith(`${blockedMarker}:`);
1183
+ }
1184
+ function isTerminalMarkerLine(line) {
1185
+ return line === completionMarker || isBlockedLine(line);
1186
+ }
1172
1187
  function getTerminalLine(content) {
1173
- const lines = content.trimEnd().split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
1188
+ const lines = getNonEmptyLines(content);
1174
1189
  return lines.at(-1);
1175
1190
  }
1191
+ function getMisplacedTerminalMarker(content) {
1192
+ const lines = getNonEmptyLines(content);
1193
+ if (lines.length < 2) return void 0;
1194
+ const terminalLine = lines.at(-1);
1195
+ if (terminalLine && isTerminalMarkerLine(terminalLine)) return void 0;
1196
+ return lines.slice(0, -1).find(isTerminalMarkerLine);
1197
+ }
1176
1198
  function extractBlockedReason(line) {
1177
1199
  if (!line.startsWith(blockedMarker)) return void 0;
1178
1200
  const afterMarker = line.slice(blockedMarker.length);
@@ -1183,8 +1205,9 @@ function createLoopManager(trackerPath, config) {
1183
1205
  const content = readTracker();
1184
1206
  const terminalLine = getTerminalLine(content);
1185
1207
  const completed = terminalLine === completionMarker;
1186
- const blocked = terminalLine !== void 0 && (terminalLine === `${blockedMarker} -->` || terminalLine.startsWith(`${blockedMarker}:`));
1208
+ const blocked = terminalLine !== void 0 && isBlockedLine(terminalLine);
1187
1209
  const blockedReason = blocked && terminalLine ? extractBlockedReason(terminalLine) : void 0;
1210
+ const misplacedTerminalMarker = getMisplacedTerminalMarker(content);
1188
1211
  const reachedLimit = iteration >= config.maxIterations;
1189
1212
  const skeletonNotReplaced = content.includes(TRACKER_SKELETON_MARKER);
1190
1213
  return {
@@ -1196,6 +1219,7 @@ function createLoopManager(trackerPath, config) {
1196
1219
  completed,
1197
1220
  blocked,
1198
1221
  blockedReason,
1222
+ misplacedTerminalMarker,
1199
1223
  reachedLimit,
1200
1224
  skeletonNotReplaced
1201
1225
  };
@@ -1265,15 +1289,17 @@ After completing meaningful work, update the tracker:
1265
1289
 
1266
1290
  When all steps are complete:
1267
1291
  1. Update the tracker with all steps checked off
1268
- 2. Add \`${DEFAULT_COMPLETION_MARKER}\` at the end of the tracker file
1269
- 3. Provide a summary of what was accomplished
1292
+ 2. Put any final summary or outcome notes above the terminal marker
1293
+ 3. Add \`${DEFAULT_COMPLETION_MARKER}\` as the final non-empty line of the tracker file
1294
+ 4. Do not write any tracker content after the terminal marker
1270
1295
 
1271
1296
  ### Blocked
1272
1297
 
1273
1298
  If you are blocked and cannot make further progress:
1274
1299
  1. Document what is blocking you in the Notes section
1275
- 2. Add \`${DEFAULT_BLOCKED_CLOSED_MARKER}\` or \`${DEFAULT_BLOCKED_REASON_MARKER}\` at the end of the tracker file
1276
- 3. Explain what needs to happen to unblock the task whenever possible
1300
+ 2. Explain what needs to happen to unblock the task whenever possible above the terminal marker
1301
+ 3. Add \`${DEFAULT_BLOCKED_CLOSED_MARKER}\` or \`${DEFAULT_BLOCKED_REASON_MARKER}\` as the final non-empty line of the tracker file
1302
+ 4. Do not write any tracker content after the terminal marker
1277
1303
  `;
1278
1304
  function ensureSystemPromptFile() {
1279
1305
  const dir = path5.join(
@@ -1687,7 +1713,7 @@ import fs10 from "fs";
1687
1713
  import path8 from "path";
1688
1714
 
1689
1715
  // src/core/workflows/stateMachine.md
1690
- var stateMachine_default = "# Stateless Turn Protocol\n\nYou run in a stateless loop. Each Turn is a fresh process with no memory of prior Turns. **The tracker file is your only continuity** \u2014 read it, work, write it. Assume interruption: the runner may kill a long Turn, your context may collapse under tool output, you may hit token limits mid-task. Anything not in the tracker is gone.\n\n## First action, every Turn\n\n1. Read the tracker at the configured path (default: `.athena/<session_id>/tracker.md`). The runner provides the session ID \u2014 do not invent one.\n2. If the tracker contains `<!-- TRACKER_SKELETON -->` \u2192 this is Turn 1, run [**Orient**](#orient-turn-1).\n3. Otherwise \u2192 this is a continuation, run [**Execute**](#execute-turn-2) from where the tracker says, not from the start of the flow.\n\nReading first prevents two failure modes that waste whole Turns: redoing work already done, or contradicting decisions a prior Turn made.\n\n## Tracker contract\n\nThe tracker must always answer four questions:\n\n1. What are we trying to accomplish?\n2. What has been done?\n3. What's left?\n4. What should the next Turn do first?\n\nA future Turn has no other context. If something isn't here, it doesn't exist. Section headings may vary by workflow, but these four answers must be explicit and easy to find.\n\n### Terminal markers\n\nDefault markers (workflows may override \u2014 use the markers configured for the active workflow):\n\n- `<!-- WORKFLOW_COMPLETE -->` \u2014 all work done and verified\n- `<!-- WORKFLOW_BLOCKED -->` or `<!-- WORKFLOW_BLOCKED: reason -->` \u2014 cannot proceed without external intervention\n\nRules:\n\n- Only the last non-empty line of the tracker is authoritative. Marker-like text in notes, examples, or quoted instructions earlier in the file is ignored.\n- The runner trusts markers unconditionally. A premature marker ends the loop with no automatic recovery \u2014 write one only when its criteria are fully met.\n- Include a concrete reason after `WORKFLOW_BLOCKED:` whenever possible; the bare form is still valid.\n\n## Phases\n\n### Orient (Turn 1)\n\n1. **Replace the skeleton immediately**, before any domain work. Even a three-line tracker (goal + \"orienting\") protects you if the Turn dies during setup.\n2. Identify and load the applicable workflow skills before doing domain work. If a workflow, plugin, or local skill table names a relevant skill, read it fully and follow it. Do not assume you already know the workflow's conventions, tool sequence, quality gates, or implementation details.\n3. Use a dedicated git worktree for repository-changing work. If you are not already inside a task-specific worktree, create or enter one before editing files, record its branch/path in the tracker, and continue there. Skip this only when the workflow explicitly forbids it or the task is read-only.\n4. Run the workflow's orientation steps exactly as written. These vary by domain \u2014 a test-writing workflow explores the product in a browser; a migration workflow audits the schema. The workflow defines what orientation means. Do not skip, reorder, reinterpret, or replace workflow steps with a generic approach unless the workflow explicitly allows it or the tracker records a concrete blocker that makes the written step impossible.\n5. Refine the tracker into a granular plan. Each task a concrete, verifiable unit of work, including verification steps (running checks, reviewing output) \u2014 not just implementation. Vague tasks (\"write tests\") cannot be meaningfully resumed by a future Turn that has no idea what they mean here.\n6. Record concrete observations \u2014 what you actually saw, not what you assumed. Wrong assumptions burn entire future Turns on rework.\n7. **Single-Turn requests still go through this phase.** If the entire request is satisfied in one Turn, write a minimal tracker (what was asked, what was done, the outcome) and append `<!-- WORKFLOW_COMPLETE -->`. Leaving the skeleton in place causes the runner to classify the Turn as a failure.\n\n### Execute (Turn 2+)\n\n- Work from where the tracker says, in the workflow's prescribed sequence. Not every Turn covers every step.\n- Be strict with workflow steps. Before starting each unit, identify the next required workflow step from the workflow document and tracker, follow it as written, and record completion or blockers against that step. Do not substitute your own process, collapse separate gates into one, or advance past an unchecked step.\n- Be strict with skills. Before each new activity, check the workflow, plugin metadata, local skill table, and tracker for relevant skills. Load the appropriate skill first, read it completely, and follow its instructions. If no skill applies, record that explicitly in the tracker before proceeding. Skills carry the implementation detail (scaffolding steps, locator rules, anti-patterns, code templates) that this protocol intentionally doesn't repeat.\n- Keep repository work inside the recorded git worktree. If a continuation Turn starts outside the recorded worktree, enter it before editing. If no worktree is recorded and edits are still required, create or enter one before proceeding.\n- Delegate heavy exploration or generation to subagents via the Task tool. Pass file paths, conventions, and concrete output expectations; tell them which skill to load. Respect the workflow's **delegation constraints** \u2014 some operations must run in the main agent because their output is proof, or because the main agent needs to interpret results in context.\n- Run quality gates in order. Do not skip \u2014 they exist because skipping cascades into rework. On a failing verdict, address the issues and re-run before proceeding. Respect the workflow's **retry limits**: repeated failure usually signals a deeper issue another retry won't fix.\n\n### End\n\n1. Tracker reflects all progress, discoveries, and blockers.\n2. Tracker says clearly what the next Turn should do first.\n3. If all work is verified: append the completion marker.\n4. If an unrecoverable blocker prevents progress: append the blocked marker, with a reason if you have one.\n\n## When to write the tracker\n\nWrite on **concrete triggers**, not on a vague sense of \"meaningful progress.\" The right cadence sits between every-tool-call (noisy log, wastes tokens) and end-of-Turn (everything lost if you die mid-task).\n\n- **Discrete unit done** \u2014 file written, fix applied, test run, gate passed. Reflect the new reality before starting the next unit.\n- **Insight learned** \u2014 API quirk, config field that turned out to matter, dead end ruled out, decision between two approaches. Insights are tracker-worthy even when no code changed; rediscovering them costs the next Turn a full re-exploration. The tracker is a knowledge ledger, not just a task log.\n- **About to do something risky or long-running** \u2014 subagent dispatch, long build, flaky external call, large refactor. Write _first_, then act. If the operation kills your Turn, only what's on disk survives.\n- **Plan changed** \u2014 task resequenced, new task surfaced, planned task no longer needed. Stale plans poison continuation Turns.\n- **You haven't written in a while** \u2014 if you can't remember the last update, you've gone too long. A short defensive update (\"doing X, last completed Y, next is Z\") beats nothing.\n\nEach update covers: what changed (work or knowledge), what's now next, and any caveat the next Turn needs. Don't transcribe tool calls \u2014 the tracker is a contract with your future self, not a replay log.\n\nThe cost of one extra tracker update is a few tokens. The cost of dying without one is a whole wasted Turn. Bias toward writing.\n\n## Task UI projection\n\nThe tracker is the durable source of truth. Your harness's task tools are a Turn-scoped UI projection of the same plan, shown to the user in their CLI widget. They do not survive process exit.\n\n{{TASK_TOOL_INSTRUCTIONS}}\n\n- **Turn 1, after orientation:** project the tracker's task plan into the task tools.\n- **Turn 2+, after reading the tracker:** recreate the projection from the tracker; do not assume task IDs from prior Turns still exist.\n- **During work:** update both \u2014 the task tools for immediate UI feedback, the tracker for persistence \u2014 in the same working phase.\n\n## Turn bounding\n\nEach fresh Turn starts with a clean context window and a compact tracker \u2014 effectively self-compaction. As you work, context fills with tool outputs and intermediate state. The longer you run, the more attention is spread across tokens that are no longer relevant, degrading precision on the work that matters now.\n\nWork a bounded chunk per Turn. Ending early and letting the next Turn pick up from a clean tracker is almost always better than pushing through with a heavy context. Natural checkpoints:\n\n- After a quality gate\n- After crossing multiple phases (explored \u2192 planned \u2192 wrote specs) \u2014 stop before pushing into the next\n- When your context is visibly heavy with tool output from earlier work\n\n## Quick reference\n\n- [ ] Read the tracker before doing anything else\n- [ ] Replace the skeleton immediately, even for single-Turn requests\n- [ ] Update on concrete triggers \u2014 unit done, insight learned, risky op pending, plan changed\n- [ ] Project the tracker plan into task tools at Turn start; keep both in sync as work lands\n- [ ] Follow the workflow steps as written; do not skip, reorder, or substitute your own process\n- [ ] Load the appropriate skill before each activity; do not rely on assumed knowledge\n- [ ] Use and record a dedicated git worktree for repository-changing work\n- [ ] Run quality gates in order; respect delegation constraints and retry limits\n- [ ] Write the completion marker only when all work is verified\n- [ ] Checkpoint and end before context goes stale\n";
1716
+ var stateMachine_default = "# Stateless Turn Protocol\n\nYou run in a stateless loop. Each Turn is a fresh process with no memory of prior Turns. **The tracker file is your only continuity** \u2014 read it, work, write it. Assume interruption: the runner may kill a long Turn, your context may collapse under tool output, you may hit token limits mid-task. Anything not in the tracker is gone.\n\n## First action, every Turn\n\n1. Read the tracker at the configured path (default: `.athena/<session_id>/tracker.md`). The runner provides the session ID \u2014 do not invent one.\n2. If the tracker contains `<!-- TRACKER_SKELETON -->` \u2192 this is Turn 1, run [**Orient**](#orient-turn-1).\n3. Otherwise \u2192 this is a continuation, run [**Execute**](#execute-turn-2) from where the tracker says, not from the start of the flow.\n\nReading first prevents two failure modes that waste whole Turns: redoing work already done, or contradicting decisions a prior Turn made.\n\n## Tracker contract\n\nThe tracker must always answer four questions:\n\n1. What are we trying to accomplish?\n2. What has been done?\n3. What's left?\n4. What should the next Turn do first?\n\nA future Turn has no other context. If something isn't here, it doesn't exist. Section headings may vary by workflow, but these four answers must be explicit and easy to find.\n\n### Terminal markers\n\nDefault markers (workflows may override \u2014 use the markers configured for the active workflow):\n\n- `<!-- WORKFLOW_COMPLETE -->` \u2014 all work done and verified\n- `<!-- WORKFLOW_BLOCKED -->` or `<!-- WORKFLOW_BLOCKED: reason -->` \u2014 cannot proceed without external intervention\n\nRules:\n\n- Only the last non-empty line of the tracker is authoritative. Marker-like text in notes, examples, or quoted instructions earlier in the file is ignored.\n- When you write a terminal marker, it must be the final non-empty line of the tracker. Put every summary, status note, and next-step sentence before the marker. Never append prose after it.\n- The runner trusts markers unconditionally. A premature marker ends the loop with no automatic recovery \u2014 write one only when its criteria are fully met.\n- Include a concrete reason after `WORKFLOW_BLOCKED:` whenever possible; the bare form is still valid.\n\n## Phases\n\n### Orient (Turn 1)\n\n1. **Replace the skeleton immediately**, before any domain work. Even a three-line tracker (goal + \"orienting\") protects you if the Turn dies during setup.\n2. Identify and load the applicable workflow skills before doing domain work. If a workflow, plugin, or local skill table names a relevant skill, read it fully and follow it. Do not assume you already know the workflow's conventions, tool sequence, quality gates, or implementation details.\n3. Use a dedicated git worktree for repository-changing work. If you are not already inside a task-specific worktree, create or enter one before editing files, record its branch/path in the tracker, and continue there. Skip this only when the workflow explicitly forbids it or the task is read-only.\n4. Run the workflow's orientation steps exactly as written. These vary by domain \u2014 a test-writing workflow explores the product in a browser; a migration workflow audits the schema. The workflow defines what orientation means. Do not skip, reorder, reinterpret, or replace workflow steps with a generic approach unless the workflow explicitly allows it or the tracker records a concrete blocker that makes the written step impossible.\n5. Refine the tracker into a granular plan. Each task a concrete, verifiable unit of work, including verification steps (running checks, reviewing output) \u2014 not just implementation. Vague tasks (\"write tests\") cannot be meaningfully resumed by a future Turn that has no idea what they mean here.\n6. Record concrete observations \u2014 what you actually saw, not what you assumed. Wrong assumptions burn entire future Turns on rework.\n7. **Single-Turn requests still go through this phase.** If the entire request is satisfied in one Turn, write a minimal tracker (what was asked, what was done, the outcome) and append `<!-- WORKFLOW_COMPLETE -->`. Leaving the skeleton in place causes the runner to classify the Turn as a failure.\n\n### Execute (Turn 2+)\n\n- Work from where the tracker says, in the workflow's prescribed sequence. Not every Turn covers every step.\n- Be strict with workflow steps. Before starting each unit, identify the next required workflow step from the workflow document and tracker, follow it as written, and record completion or blockers against that step. Do not substitute your own process, collapse separate gates into one, or advance past an unchecked step.\n- Be strict with skills. Before each new activity, check the workflow, plugin metadata, local skill table, and tracker for relevant skills. Load the appropriate skill first, read it completely, and follow its instructions. If no skill applies, record that explicitly in the tracker before proceeding. Skills carry the implementation detail (scaffolding steps, locator rules, anti-patterns, code templates) that this protocol intentionally doesn't repeat.\n- Keep repository work inside the recorded git worktree. If a continuation Turn starts outside the recorded worktree, enter it before editing. If no worktree is recorded and edits are still required, create or enter one before proceeding.\n- Delegate heavy exploration or generation to subagents via the Task tool. Pass file paths, conventions, and concrete output expectations; tell them which skill to load. Respect the workflow's **delegation constraints** \u2014 some operations must run in the main agent because their output is proof, or because the main agent needs to interpret results in context.\n- Run quality gates in order. Do not skip \u2014 they exist because skipping cascades into rework. On a failing verdict, address the issues and re-run before proceeding. Respect the workflow's **retry limits**: repeated failure usually signals a deeper issue another retry won't fix.\n\n### End\n\n1. Tracker reflects all progress, discoveries, and blockers.\n2. Tracker says clearly what the next Turn should do first.\n3. If all work is verified: append the completion marker as the final non-empty line.\n4. If an unrecoverable blocker prevents progress: append the blocked marker as the final non-empty line, with a reason if you have one.\n\n## When to write the tracker\n\nWrite on **concrete triggers**, not on a vague sense of \"meaningful progress.\" The right cadence sits between every-tool-call (noisy log, wastes tokens) and end-of-Turn (everything lost if you die mid-task).\n\n- **Discrete unit done** \u2014 file written, fix applied, test run, gate passed. Reflect the new reality before starting the next unit.\n- **Insight learned** \u2014 API quirk, config field that turned out to matter, dead end ruled out, decision between two approaches. Insights are tracker-worthy even when no code changed; rediscovering them costs the next Turn a full re-exploration. The tracker is a knowledge ledger, not just a task log.\n- **About to do something risky or long-running** \u2014 subagent dispatch, long build, flaky external call, large refactor. Write _first_, then act. If the operation kills your Turn, only what's on disk survives.\n- **Plan changed** \u2014 task resequenced, new task surfaced, planned task no longer needed. Stale plans poison continuation Turns.\n- **You haven't written in a while** \u2014 if you can't remember the last update, you've gone too long. A short defensive update (\"doing X, last completed Y, next is Z\") beats nothing.\n\nEach update covers: what changed (work or knowledge), what's now next, and any caveat the next Turn needs. Don't transcribe tool calls \u2014 the tracker is a contract with your future self, not a replay log.\n\nThe cost of one extra tracker update is a few tokens. The cost of dying without one is a whole wasted Turn. Bias toward writing.\n\n## Task UI projection\n\nThe tracker is the durable source of truth. Your harness's task tools are a Turn-scoped UI projection of the same plan, shown to the user in their CLI widget. They do not survive process exit.\n\n{{TASK_TOOL_INSTRUCTIONS}}\n\n- **Turn 1, after orientation:** project the tracker's task plan into the task tools.\n- **Turn 2+, after reading the tracker:** recreate the projection from the tracker; do not assume task IDs from prior Turns still exist.\n- **During work:** update both \u2014 the task tools for immediate UI feedback, the tracker for persistence \u2014 in the same working phase.\n\n## Turn bounding\n\nEach fresh Turn starts with a clean context window and a compact tracker \u2014 effectively self-compaction. As you work, context fills with tool outputs and intermediate state. The longer you run, the more attention is spread across tokens that are no longer relevant, degrading precision on the work that matters now.\n\nWork a bounded chunk per Turn. Ending early and letting the next Turn pick up from a clean tracker is almost always better than pushing through with a heavy context. Natural checkpoints:\n\n- After a quality gate\n- After crossing multiple phases (explored \u2192 planned \u2192 wrote specs) \u2014 stop before pushing into the next\n- When your context is visibly heavy with tool output from earlier work\n\n## Quick reference\n\n- [ ] Read the tracker before doing anything else\n- [ ] Replace the skeleton immediately, even for single-Turn requests\n- [ ] Update on concrete triggers \u2014 unit done, insight learned, risky op pending, plan changed\n- [ ] Project the tracker plan into task tools at Turn start; keep both in sync as work lands\n- [ ] Follow the workflow steps as written; do not skip, reorder, or substitute your own process\n- [ ] Load the appropriate skill before each activity; do not rely on assumed knowledge\n- [ ] Use and record a dedicated git worktree for repository-changing work\n- [ ] Run quality gates in order; respect delegation constraints and retry limits\n- [ ] Write the completion marker only when all work is verified, and make it the final non-empty line\n- [ ] Checkpoint and end before context goes stale\n";
1691
1717
 
1692
1718
  // src/core/workflows/stateMachine.ts
1693
1719
  function buildTaskToolInstructions(harness) {
@@ -1833,6 +1859,13 @@ function shouldContinueWorkflowRun(state) {
1833
1859
  maxIterations: loopState.maxIterations
1834
1860
  };
1835
1861
  }
1862
+ if (loopState.misplacedTerminalMarker) {
1863
+ cleanupWorkflowRun(state);
1864
+ return {
1865
+ reason: "misplaced_terminal_marker",
1866
+ maxIterations: loopState.maxIterations
1867
+ };
1868
+ }
1836
1869
  let reason;
1837
1870
  if (loopState.completed) {
1838
1871
  reason = "completed";
@@ -2040,6 +2073,9 @@ function createWorkflowRunner(input) {
2040
2073
  } else if (loopStop.reason === "skeleton_not_replaced") {
2041
2074
  status = "failed";
2042
2075
  stopReason = "tracker skeleton was never replaced \u2014 Claude did not bootstrap the tracker";
2076
+ } else if (loopStop.reason === "misplaced_terminal_marker") {
2077
+ status = "failed";
2078
+ stopReason = "terminal workflow marker is not the final non-empty line of the tracker; move all summary text above the marker";
2043
2079
  } else {
2044
2080
  status = "failed";
2045
2081
  stopReason = `Loop stopped: ${loopStop.reason}`;
@@ -2218,6 +2254,7 @@ export {
2218
2254
  resolveMarketplaceWorkflow,
2219
2255
  gatherMarketplaceWorkflowSources,
2220
2256
  resolveWorkflowInstall,
2257
+ pullMarketplaceRepo,
2221
2258
  projectConfigPath,
2222
2259
  readConfig,
2223
2260
  resolveActiveWorkflow,
@@ -2237,4 +2274,4 @@ export {
2237
2274
  compileWorkflowPlan,
2238
2275
  collectMcpServersWithOptions
2239
2276
  };
2240
- //# sourceMappingURL=chunk-FLS4B7JS.js.map
2277
+ //# sourceMappingURL=chunk-JHSADKDJ.js.map
package/dist/cli.js CHANGED
@@ -97,7 +97,7 @@ import {
97
97
  writeAttachmentMirror,
98
98
  writeGatewayClientConfig,
99
99
  wsClientOptionsForEndpoint
100
- } from "./chunk-3PA63KQW.js";
100
+ } from "./chunk-EC67PEFT.js";
101
101
  import {
102
102
  generateId as generateId2
103
103
  } from "./chunk-BTKQ67RE.js";
@@ -144,6 +144,7 @@ import {
144
144
  listMarketplaceWorkflowsFromRepo,
145
145
  listWorkflows,
146
146
  projectConfigPath,
147
+ pullMarketplaceRepo,
147
148
  readConfig,
148
149
  readGlobalConfig,
149
150
  removeWorkflow,
@@ -157,7 +158,7 @@ import {
157
158
  useWorkflowSessionController,
158
159
  writeGlobalConfig,
159
160
  writeProjectConfig
160
- } from "./chunk-FLS4B7JS.js";
161
+ } from "./chunk-JHSADKDJ.js";
161
162
 
162
163
  // src/app/entry/cli.tsx
163
164
  import { render } from "ink";
@@ -5552,6 +5553,7 @@ function pagerContentRows() {
5552
5553
  function usePager({
5553
5554
  displayedEntriesRef,
5554
5555
  feedCursorId,
5556
+ mouseEnabled = true,
5555
5557
  theme
5556
5558
  }) {
5557
5559
  const [pagerActive, setPagerActive] = useState10(false);
@@ -5626,9 +5628,11 @@ function usePager({
5626
5628
  pagerScrollRef.current = 0;
5627
5629
  lastPairedPostRef.current = entry.pairedPostEvent;
5628
5630
  process5.stdout.write("\x1B[?1049h");
5629
- process5.stdout.write("\x1B[?1000h\x1B[?1006h");
5631
+ if (mouseEnabled) {
5632
+ process5.stdout.write("\x1B[?1000h\x1B[?1006h");
5633
+ }
5630
5634
  paintPager();
5631
- }, [pagerActive, paintPager, theme]);
5635
+ }, [mouseEnabled, pagerActive, paintPager, theme]);
5632
5636
  useEffect9(() => {
5633
5637
  if (!pagerActive) return;
5634
5638
  if (pagerLinesRef.current.length === 0) return;
@@ -5741,7 +5745,7 @@ function usePager({
5741
5745
  return () => {
5742
5746
  process5.stdin.removeListener("data", onData);
5743
5747
  };
5744
- }, [pagerActive, scrollPager]);
5748
+ }, [mouseEnabled, pagerActive, scrollPager]);
5745
5749
  return { pagerActive, handleExpandForPager };
5746
5750
  }
5747
5751
 
@@ -5766,6 +5770,7 @@ function buildFrameLines(ctx) {
5766
5770
  [h.space, "Toggle"],
5767
5771
  [h.enter, "Jump"],
5768
5772
  ["a", "Prompt"],
5773
+ ["Fn-drag", "Select"],
5769
5774
  [h.escape, "Back"]
5770
5775
  ]);
5771
5776
  }
@@ -5780,6 +5785,7 @@ function buildFrameLines(ctx) {
5780
5785
  inputPairs.push(
5781
5786
  [h.tab, "Focus"],
5782
5787
  ["\u2303P/N", "History"],
5788
+ ["Fn-drag", "Select"],
5783
5789
  [h.toggle, "Hints"]
5784
5790
  );
5785
5791
  return buildHintPairs(inputPairs);
@@ -5791,7 +5797,8 @@ function buildFrameLines(ctx) {
5791
5797
  ["u/a/b", "Filter"],
5792
5798
  ["/", "Cmds"],
5793
5799
  [":", "Search"],
5794
- ["End", "Tail"]
5800
+ ["End", "Tail"],
5801
+ ["Fn-drag", "Select"]
5795
5802
  ];
5796
5803
  if (ctx.isClaudeRunning) {
5797
5804
  messagePairs.push([`${h.escape} ${h.escape}`, "Interrupt"]);
@@ -5810,7 +5817,8 @@ function buildFrameLines(ctx) {
5810
5817
  ["y", "Yank"],
5811
5818
  ["/", "Cmds"],
5812
5819
  [":", "Search"],
5813
- ["End", "Tail"]
5820
+ ["End", "Tail"],
5821
+ ["Fn-drag", "Select"]
5814
5822
  ];
5815
5823
  if (ctx.isClaudeRunning) {
5816
5824
  feedPairs.push([`${h.escape} ${h.escape}`, "Interrupt"]);
@@ -9779,6 +9787,7 @@ function AppContent({
9779
9787
  const [workflowPickerVisible, setWorkflowPickerVisible] = useState18(!hadWorkflowOnMount);
9780
9788
  const [workflowPickerDismissible, setWorkflowPickerDismissible] = useState18(hadWorkflowOnMount);
9781
9789
  const [modelPickerVisible, setModelPickerVisible] = useState18(false);
9790
+ const [mouseMode, setMouseMode] = useState18("on");
9782
9791
  const [uiState, setUiState] = useState18(initialSessionUiState);
9783
9792
  const [toastMessage, setToastMessage] = useState18(null);
9784
9793
  const [diagnosticsConsent, setDiagnosticsConsent] = useState18(initialTelemetryDiagnosticsConsent);
@@ -10219,6 +10228,8 @@ function AppContent({
10219
10228
  addMessage: addMessageObj,
10220
10229
  exit,
10221
10230
  clearScreen,
10231
+ mouseMode,
10232
+ setMouseMode,
10222
10233
  showSessions: onShowSessions,
10223
10234
  showSetup: onShowSetup,
10224
10235
  showWorkflowPicker: () => {
@@ -10280,6 +10291,7 @@ function AppContent({
10280
10291
  runtimeError,
10281
10292
  exit,
10282
10293
  clearScreen,
10294
+ mouseMode,
10283
10295
  onShowSessions,
10284
10296
  onShowSetup,
10285
10297
  metrics,
@@ -10628,6 +10640,7 @@ function AppContent({
10628
10640
  const { pagerActive, handleExpandForPager } = usePager({
10629
10641
  displayedEntriesRef: displayedFeedEntriesRef,
10630
10642
  feedCursorId: feedNav.feedCursorId,
10643
+ mouseEnabled: mouseMode === "on",
10631
10644
  theme
10632
10645
  });
10633
10646
  useGlobalKeyboard({
@@ -10718,7 +10731,7 @@ function AppContent({
10718
10731
  }
10719
10732
  });
10720
10733
  usePanelMouseWheel({
10721
- isActive: !dialogActive && !pagerActive && !workflowPickerVisible && !modelPickerVisible,
10734
+ isActive: mouseMode === "on" && !dialogActive && !pagerActive && !workflowPickerVisible && !modelPickerVisible,
10722
10735
  rects: panelMouseRects,
10723
10736
  onFeedFocus: () => dispatchUi({ type: "set_focus_mode", focusMode: "feed" }),
10724
10737
  onMessageFocus: splitMode ? () => dispatchUi({ type: "set_focus_mode", focusMode: "messages" }) : void 0,
@@ -11659,11 +11672,21 @@ var helpCommand = {
11659
11672
  const aliases = cmd.aliases?.length ? ` (${cmd.aliases.map((a) => `/${a}`).join(", ")})` : "";
11660
11673
  return ` /${cmd.name}${aliases} - ${cmd.description}`;
11661
11674
  });
11675
+ const interactionHints = [
11676
+ "",
11677
+ "Interaction:",
11678
+ " Mouse wheel - scroll the panel under the pointer when mouse mode is on",
11679
+ " Click - focus the panel under the pointer when mouse mode is on",
11680
+ " y - copy the focused message/detail to clipboard",
11681
+ " /mouse off - disable app mouse handling for native terminal drag selection",
11682
+ " /mouse on - restore panel wheel scrolling and click focus",
11683
+ " Fn-drag - native terminal text selection on macOS terminals that reserve mouse drag for the app"
11684
+ ];
11662
11685
  ctx.addMessage({
11663
11686
  id: generateId2(),
11664
11687
  role: "assistant",
11665
11688
  content: `Available commands:
11666
- ${lines.join("\n")}`,
11689
+ ${lines.join("\n")}${interactionHints.join("\n")}`,
11667
11690
  timestamp: /* @__PURE__ */ new Date()
11668
11691
  });
11669
11692
  }
@@ -11841,6 +11864,49 @@ var modelCommand = {
11841
11864
  }
11842
11865
  };
11843
11866
 
11867
+ // src/app/commands/builtins/mouse.ts
11868
+ var mouseCommand = {
11869
+ name: "mouse",
11870
+ description: "Show or change terminal mouse mode",
11871
+ category: "ui",
11872
+ args: [
11873
+ {
11874
+ name: "mode",
11875
+ description: "on, off, or toggle",
11876
+ required: false
11877
+ }
11878
+ ],
11879
+ execute: (ctx) => {
11880
+ const rawMode = ctx.args["mode"]?.toLowerCase();
11881
+ if (!rawMode) {
11882
+ ctx.addMessage({
11883
+ id: generateId2(),
11884
+ role: "assistant",
11885
+ content: ctx.mouseMode === "on" ? "Mouse mode is on. Wheel scrolls panels; use /mouse off for native drag selection." : "Mouse mode is off. Terminal drag selection is native; use /mouse on to restore panel wheel scrolling.",
11886
+ timestamp: /* @__PURE__ */ new Date()
11887
+ });
11888
+ return;
11889
+ }
11890
+ if (rawMode !== "on" && rawMode !== "off" && rawMode !== "toggle") {
11891
+ ctx.addMessage({
11892
+ id: generateId2(),
11893
+ role: "assistant",
11894
+ content: "Usage: /mouse [on|off|toggle]",
11895
+ timestamp: /* @__PURE__ */ new Date()
11896
+ });
11897
+ return;
11898
+ }
11899
+ const nextMode = rawMode === "toggle" ? ctx.mouseMode === "on" ? "off" : "on" : rawMode;
11900
+ ctx.setMouseMode(nextMode);
11901
+ ctx.addMessage({
11902
+ id: generateId2(),
11903
+ role: "assistant",
11904
+ content: nextMode === "on" ? "Mouse mode on: wheel scrolls panels and clicks focus panels." : "Mouse mode off: terminal drag selection is native; use keyboard navigation or /mouse on to restore wheel scrolling.",
11905
+ timestamp: /* @__PURE__ */ new Date()
11906
+ });
11907
+ }
11908
+ };
11909
+
11844
11910
  // src/app/commands/builtins/index.ts
11845
11911
  var builtins = [
11846
11912
  helpCommand,
@@ -11853,7 +11919,8 @@ var builtins = [
11853
11919
  setup_default,
11854
11920
  telemetryCommand,
11855
11921
  workflowCommand,
11856
- modelCommand
11922
+ modelCommand,
11923
+ mouseCommand
11857
11924
  ];
11858
11925
  var registered = false;
11859
11926
  function registerBuiltins() {
@@ -12285,11 +12352,13 @@ var USAGE2 = `Usage: athena-flow marketplace <subcommand>
12285
12352
 
12286
12353
  Subcommands
12287
12354
  add <source> Add a marketplace source (owner/repo or local path)
12355
+ refresh [source] Refresh remote marketplace source(s)
12288
12356
  remove <source> Remove a configured marketplace source
12289
12357
  list List configured marketplace sources`;
12290
12358
  function runMarketplaceCommand(input, deps = {}) {
12291
12359
  const listMarketplace = deps.listMarketplaceWorkflows ?? listMarketplaceWorkflows;
12292
12360
  const listMarketplaceFromRepo = deps.listMarketplaceWorkflowsFromRepo ?? listMarketplaceWorkflowsFromRepo;
12361
+ const pullMarketplace = deps.pullMarketplaceRepo ?? pullMarketplaceRepo;
12293
12362
  const resolveMarketplaceSource = deps.resolveWorkflowMarketplaceSource ?? resolveWorkflowMarketplaceSource;
12294
12363
  const readConfig2 = deps.readGlobalConfig ?? readGlobalConfig;
12295
12364
  const writeConfig = deps.writeGlobalConfig ?? writeGlobalConfig;
@@ -12326,6 +12395,30 @@ function runMarketplaceCommand(input, deps = {}) {
12326
12395
  return 1;
12327
12396
  }
12328
12397
  }
12398
+ case "refresh": {
12399
+ const requested = input.subcommandArgs[0];
12400
+ const configuredSources = readConfig2().workflowMarketplaceSources;
12401
+ const sources = requested ? [requested] : configuredSources && configuredSources.length > 0 ? configuredSources : [DEFAULT_MARKETPLACE_SLUG3];
12402
+ let failures = 0;
12403
+ for (const source of sources) {
12404
+ try {
12405
+ const resolvedSource = resolveMarketplaceSource(source);
12406
+ if (resolvedSource.kind === "remote") {
12407
+ pullMarketplace(resolvedSource.owner, resolvedSource.repo);
12408
+ logOut(`Refreshed marketplace: ${resolvedSource.slug}`);
12409
+ } else {
12410
+ listMarketplaceFromRepo(resolvedSource.repoDir);
12411
+ logOut(
12412
+ `Local marketplace does not require refresh: ${resolvedSource.repoDir}`
12413
+ );
12414
+ }
12415
+ } catch (error) {
12416
+ failures += 1;
12417
+ logError(fmtError(error));
12418
+ }
12419
+ }
12420
+ return failures > 0 ? 1 : 0;
12421
+ }
12329
12422
  case "remove": {
12330
12423
  const source = input.subcommandArgs[0];
12331
12424
  if (!source) {
@@ -12604,7 +12697,7 @@ var cachedVersion = null;
12604
12697
  function readPackageVersion() {
12605
12698
  if (cachedVersion !== null) return cachedVersion;
12606
12699
  try {
12607
- const injected = "0.5.21";
12700
+ const injected = "0.5.23";
12608
12701
  if (typeof injected === "string" && injected.length > 0) {
12609
12702
  cachedVersion = injected;
12610
12703
  return cachedVersion;
@@ -15114,7 +15207,7 @@ var cli = meow(
15114
15207
  resume [sessionId] Resume most recent (or specified) session
15115
15208
  exec "<prompt>" Run non-interactively (CI/script mode)
15116
15209
  workflow <sub> Manage workflows (install, list, search, remove, upgrade, use)
15117
- marketplace <sub> Manage marketplace sources (add, remove, list)
15210
+ marketplace <sub> Manage marketplace sources (add, refresh, remove, list)
15118
15211
  channel <sub> Manage external channels
15119
15212
  dashboard <sub> Manage dashboard pairing and runtime daemon (pair, status, daemon, unpair)
15120
15213
  telemetry [action] Manage anonymous telemetry (enable/disable/status)
@@ -15351,7 +15444,7 @@ Available commands: ${[...KNOWN_COMMANDS].join(", ")}`
15351
15444
  await exitWith(1);
15352
15445
  return;
15353
15446
  }
15354
- const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-KP7AEBPQ.js");
15447
+ const { default: WorkflowInstallWizard } = await import("./WorkflowInstallWizard-CCCUR6KA.js");
15355
15448
  const { waitUntilExit } = render(
15356
15449
  /* @__PURE__ */ jsx25(
15357
15450
  WorkflowInstallWizard,
@@ -3,13 +3,13 @@ import {
3
3
  ensureDaemonStateDir,
4
4
  runDashboardRuntimeDaemon,
5
5
  startUdsServer
6
- } from "./chunk-3PA63KQW.js";
6
+ } from "./chunk-EC67PEFT.js";
7
7
  import "./chunk-BTKQ67RE.js";
8
8
  import {
9
9
  readDashboardClientConfig,
10
10
  refreshDashboardAccessToken
11
11
  } from "./chunk-BTY7MYYT.js";
12
- import "./chunk-FLS4B7JS.js";
12
+ import "./chunk-JHSADKDJ.js";
13
13
 
14
14
  // src/infra/daemon/logFile.ts
15
15
  import fs from "fs";
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "hooks",
18
18
  "dashboard"
19
19
  ],
20
- "version": "0.5.21",
20
+ "version": "0.5.23",
21
21
  "license": "MIT",
22
22
  "bin": {
23
23
  "athena": "dist/cli.js",