@wrongstack/tools 0.302.2 → 0.305.0

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.
Files changed (44) hide show
  1. package/dist/builtin.d.ts +6 -0
  2. package/dist/builtin.js +3213 -686
  3. package/dist/codebase-index/binary-frame.d.ts +43 -0
  4. package/dist/codebase-index/codebase-incoming-calls-tool.d.ts +1 -0
  5. package/dist/codebase-index/codebase-index-tool.d.ts +6 -0
  6. package/dist/codebase-index/codebase-outgoing-calls-tool.d.ts +1 -0
  7. package/dist/codebase-index/content-hash.d.ts +66 -0
  8. package/dist/codebase-index/index.js +1597 -153
  9. package/dist/codebase-index/indexer.d.ts +6 -0
  10. package/dist/codebase-index/parser-worker-pool.d.ts +63 -0
  11. package/dist/codebase-index/parser-worker-script.d.ts +42 -0
  12. package/dist/codebase-index/project-server-protocol.d.ts +2 -0
  13. package/dist/codebase-index/project-server.js +1483 -104
  14. package/dist/codebase-index/schema.d.ts +18 -0
  15. package/dist/codebase-index/tree-sitter/queries.d.ts +48 -0
  16. package/dist/codebase-index/tree-sitter/util.d.ts +31 -0
  17. package/dist/codebase-index/tree-sitter/visitor.d.ts +47 -0
  18. package/dist/codebase-index/tree-sitter-parser.d.ts +58 -0
  19. package/dist/codebase-index/vector-search.d.ts +62 -0
  20. package/dist/codebase-index/worker-protocol.d.ts +2 -0
  21. package/dist/codebase-index/worker.js +1452 -73
  22. package/dist/codebase-index/writer-bulk-insert.d.ts +5 -0
  23. package/dist/codebase-index/writer-graph-reader.d.ts +39 -0
  24. package/dist/codebase-index/writer-schema.d.ts +9 -2
  25. package/dist/codebase-index/writer.d.ts +36 -0
  26. package/dist/index.d.ts +4 -3
  27. package/dist/index.js +3258 -727
  28. package/dist/kanban-contract-actions.d.ts +7 -0
  29. package/dist/kanban-task-inputs.d.ts +16 -2
  30. package/dist/kanban-tool-schema.d.ts +2 -2
  31. package/dist/kanban-tool-types.d.ts +39 -2
  32. package/dist/kanban.js +580 -193
  33. package/dist/pack.js +3212 -686
  34. package/dist/plan.d.ts +4 -1
  35. package/dist/plan.js +2701 -18
  36. package/dist/read.js +1559 -103
  37. package/dist/session-kanban.d.ts +94 -1
  38. package/dist/session-kanban.js +308 -44
  39. package/dist/task.d.ts +5 -4
  40. package/dist/task.js +2825 -138
  41. package/dist/todo.d.ts +10 -1
  42. package/dist/todo.js +2474 -30
  43. package/dist/tool-tier.js +3212 -686
  44. package/package.json +8 -4
@@ -3,20 +3,58 @@ import { type PlanFile, type PlanItem, type TaskFile } from '@wrongstack/core/st
3
3
  import type { SerializedTaskGraph } from '@wrongstack/core/types';
4
4
  import { type TaskItem } from '@wrongstack/core/utils';
5
5
  import { type KanbanBoard, type KanbanColumn, type KanbanTask } from '@wrongstack/kanban';
6
- /** The canonical workflow shared by WebUI and TUI session boards. */
6
+ /**
7
+ * The canonical workflow shared by WebUI and TUI session boards.
8
+ *
9
+ * Session boards now use the same 5 standard columns as every other board
10
+ * (backlog, todo, in-progress, review, done). Formerly this shipped a 4-column
11
+ * variant without a backlog; the column lock unified the layout. Existing
12
+ * 4-column session_mirror boards are migrated automatically on the next session
13
+ * touch: `ensureSessionKanbanBoard`'s `sameColumns` check detects the drift
14
+ * and `updateBoard` reconciles to DEFAULT_COLUMNS.
15
+ */
7
16
  export declare const SESSION_KANBAN_COLUMNS: KanbanColumn[];
8
17
  /** Create (or migrate) the single Kanban board owned by a session. */
9
18
  export declare function ensureSessionKanbanBoard(projectRoot: string | undefined, sessionId: string): Promise<KanbanBoard | null>;
19
+ /**
20
+ * Remove an inactive session's observational mirror, including its cards.
21
+ * The durable source remains the session todo/task/plan files; retaining the
22
+ * mirror after detach only creates historical duplicate work in project views.
23
+ */
24
+ export declare function cleanupSessionKanbanBoard(projectRoot: string | undefined, sessionId: string): Promise<string[]>;
10
25
  /** Remove a particular inactive session's system-owned board when it has no cards. */
11
26
  export declare function cleanupSessionKanbanBoardIfEmpty(projectRoot: string | undefined, sessionId: string): Promise<string[]>;
12
27
  /** Prune stale empty session boards while preserving manual and live boards. */
13
28
  export declare function cleanupEmptySessionKanbanBoards(projectRoot: string | undefined, activeSessionId?: string): Promise<string[]>;
29
+ /**
30
+ * Consume the last unreported mirror failure for a session, if any.
31
+ *
32
+ * The mirror is asynchronous and fire-and-forget, so a rejected projection
33
+ * used to be observable only in stdout. The `todo` tool drains this on its
34
+ * next call and reports it as a warning, so a board that stopped tracking the
35
+ * session is surfaced where the divergence actually matters.
36
+ */
37
+ export declare function takeSessionMirrorFailure(projectRoot: string | undefined, sessionId: string): string | undefined;
14
38
  export declare function todoListToSerializedGraph(todos: readonly TodoItem[], sessionId: string): SerializedTaskGraph;
15
39
  export declare function taskFileToSerializedGraph(tasks: readonly TaskItem[], sessionId: string): SerializedTaskGraph;
16
40
  export declare function planFileToSerializedGraph(items: readonly PlanItem[], sessionId: string): SerializedTaskGraph;
17
41
  export declare function projectSessionTodosToKanban(projectRoot: string | undefined, todos: readonly TodoItem[], sessionId: string): Promise<KanbanBoard | null>;
18
42
  export declare function projectSessionTasksToKanban(projectRoot: string | undefined, tasks: readonly TaskItem[], sessionId: string): Promise<KanbanBoard | null>;
19
43
  export declare function projectSessionPlanToKanban(projectRoot: string | undefined, items: readonly PlanItem[], sessionId: string): Promise<KanbanBoard | null>;
44
+ /**
45
+ * The todo rows that still need the session mirror: those not already cards on
46
+ * the board this session is working on.
47
+ *
48
+ * The rule used to be all-or-nothing — the mirror was skipped only when EVERY
49
+ * row was bound. A single unbound row (a todo the model added to the chat list
50
+ * without also filing a card) sent the whole list to a separate session board,
51
+ * so work already tracked on the real board showed up a second time there, and
52
+ * one stray row was enough to leave a session board holding a single card.
53
+ *
54
+ * With no active board every row still needs mirroring, since there is no other
55
+ * place the work is being recorded.
56
+ */
57
+ export declare function todosNeedingSessionMirror(todos: readonly TodoItem[], activeBoardId: string | undefined): readonly TodoItem[];
20
58
  export declare function mirrorSessionTodosToKanban(projectRoot: string | undefined, todos: readonly TodoItem[], sessionId: string): void;
21
59
  export declare function mirrorSessionTasksToKanban(projectRoot: string | undefined, tasks: readonly TaskItem[], sessionId: string): void;
22
60
  export declare function mirrorSessionPlanToKanban(projectRoot: string | undefined, items: readonly PlanItem[], sessionId: string): void;
@@ -27,6 +65,38 @@ export declare function mirrorSessionPlanToKanban(projectRoot: string | undefine
27
65
  */
28
66
  export declare function attachSessionKanbanMirror(context: Context): () => void;
29
67
  /** Fully hydrate a session board before a host announces the session as ready. */
68
+ /**
69
+ * Re-bind the card this session was working, after a restart or `--resume`.
70
+ *
71
+ * The binding produced by `start_task` lives in `ctx.meta.kanban`, which is
72
+ * conversation state — nothing restores it. So a resumed session came back
73
+ * with `currentKanbanTaskId` undefined while its card still sat in Running on
74
+ * the board: file events lost their task attribution, and under
75
+ * `tools.kanbanGovernance` the run was un-bound until the model happened to
76
+ * call `start_task` again.
77
+ *
78
+ * Board presence is the durable anchor. It is keyed `<sessionId>:<agentId>`,
79
+ * carries the `taskId`, and is stored on the board record itself, so it
80
+ * survives the restart even though its derived `active` flag does not (the TTL
81
+ * is two minutes). Matching it against the cards that are actually still
82
+ * running gives an unambiguous answer without guessing from free-text agent
83
+ * ids.
84
+ *
85
+ * Deliberately conservative — it prefers to do nothing over binding the wrong
86
+ * card:
87
+ * - never overrides a binding this process already has;
88
+ * - only considers cards whose assignment is still `running`;
89
+ * - skips an expired lease, because `recover_stale` may have reassigned that
90
+ * card to another worker;
91
+ * - picks the most recently seen entry when a session touched several.
92
+ *
93
+ * Session mirrors and archived boards are excluded by the snapshot's default
94
+ * board-kind filter, which is correct: `start_task` never targets them.
95
+ */
96
+ export declare function rebindSessionKanbanTask(context: Context): Promise<{
97
+ boardId: string;
98
+ taskId: string;
99
+ } | null>;
30
100
  export declare function hydrateSessionKanban(context: Context): Promise<KanbanBoard | null>;
31
101
  export interface SessionKanbanSourceUpdate {
32
102
  source: 'todo' | 'task' | 'plan' | null;
@@ -34,6 +104,27 @@ export interface SessionKanbanSourceUpdate {
34
104
  tasks?: TaskFile | undefined;
35
105
  plan?: PlanFile | undefined;
36
106
  }
107
+ /**
108
+ * Human-readable titles of the unfinished dependencies blocking a card.
109
+ *
110
+ * The board recomputes readiness on every mutation; this only carries the
111
+ * result to the todo surface. Titles rather than ids, because the row is read
112
+ * by a model and a human, neither of whom can resolve a raw card id.
113
+ */
114
+ export declare function blockingTitles(board: KanbanBoard, task: KanbanTask): string[];
115
+ /**
116
+ * Order cards the way they must actually be worked: dependencies first, then
117
+ * priority, then the board's own column/manual order.
118
+ *
119
+ * The managed projection previously sorted by `createdAt` — the moment a card
120
+ * happened to be created — which is unrelated to execution order, so the list
121
+ * the model reads top-to-bottom was not a plan. A dependency-respecting
122
+ * (Kahn) order makes the visible sequence the executable sequence; ties fall
123
+ * back to the deterministic board order so the list never reshuffles on its
124
+ * own. Any card left over by a dependency cycle is appended rather than
125
+ * dropped — the board rejects cycles, but a projection must never lose work.
126
+ */
127
+ export declare function orderTasksForTodos(board: KanbanBoard, tasks: readonly KanbanTask[]): KanbanTask[];
37
128
  /**
38
129
  * Replace the tactical todo list from the current cards on a session-owned board.
39
130
  *
@@ -43,6 +134,8 @@ export interface SessionKanbanSourceUpdate {
43
134
  * todo list that happened to exist when the run started.
44
135
  */
45
136
  export declare function applySessionKanbanBoardToTodos(context: Context, board: KanbanBoard): TodoItem[];
137
+ /** Project a durable managed board into the session's compact todo surface. */
138
+ export declare function applyManagedKanbanBoardToTodos(context: Context, board: KanbanBoard): TodoItem[];
46
139
  /** Reflect a TUI/WebUI Kanban card edit back to its originating work list. */
47
140
  export declare function applySessionKanbanTaskToSource(context: Context, task: KanbanTask, options?: {
48
141
  remove?: boolean | undefined;