@viraatdas/rudder 1.0.74 → 1.1.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 (58) hide show
  1. package/dist/auth.d.ts +2 -0
  2. package/dist/auth.js +22 -1
  3. package/dist/auth.js.map +1 -1
  4. package/dist/backends.js +88 -1
  5. package/dist/backends.js.map +1 -1
  6. package/dist/board/board.css +1 -0
  7. package/dist/board/board.js +2 -0
  8. package/dist/board/daemon.d.ts +21 -0
  9. package/dist/board/daemon.js +838 -0
  10. package/dist/board/daemon.js.map +1 -0
  11. package/dist/brain.d.ts +9 -0
  12. package/dist/brain.js +32 -5
  13. package/dist/brain.js.map +1 -1
  14. package/dist/bus.d.ts +9 -0
  15. package/dist/bus.js +23 -0
  16. package/dist/bus.js.map +1 -0
  17. package/dist/daemon.d.ts +21 -0
  18. package/dist/daemon.js +141 -0
  19. package/dist/daemon.js.map +1 -0
  20. package/dist/git.d.ts +5 -16
  21. package/dist/git.js +43 -50
  22. package/dist/git.js.map +1 -1
  23. package/dist/goal.d.ts +30 -0
  24. package/dist/goal.js +75 -0
  25. package/dist/goal.js.map +1 -0
  26. package/dist/graph.d.ts +56 -0
  27. package/dist/graph.js +213 -0
  28. package/dist/graph.js.map +1 -0
  29. package/dist/jj.d.ts +121 -0
  30. package/dist/jj.js +524 -0
  31. package/dist/jj.js.map +1 -0
  32. package/dist/main.js +171 -6
  33. package/dist/main.js.map +1 -1
  34. package/dist/native/rudder-native +0 -0
  35. package/dist/planner.d.ts +27 -0
  36. package/dist/planner.js +540 -0
  37. package/dist/planner.js.map +1 -0
  38. package/dist/run-manager.d.ts +7 -0
  39. package/dist/run-manager.js +98 -38
  40. package/dist/run-manager.js.map +1 -1
  41. package/dist/scheduler.d.ts +124 -0
  42. package/dist/scheduler.js +849 -0
  43. package/dist/scheduler.js.map +1 -0
  44. package/dist/state.d.ts +16 -1
  45. package/dist/state.js +101 -0
  46. package/dist/state.js.map +1 -1
  47. package/dist/surfaces.d.ts +23 -0
  48. package/dist/surfaces.js +196 -0
  49. package/dist/surfaces.js.map +1 -0
  50. package/dist/task-summary.d.ts +18 -0
  51. package/dist/task-summary.js +132 -0
  52. package/dist/task-summary.js.map +1 -1
  53. package/dist/types.d.ts +198 -1
  54. package/dist/types.js +1 -1
  55. package/dist/types.js.map +1 -1
  56. package/dist/util.js +1 -0
  57. package/dist/util.js.map +1 -1
  58. package/package.json +9 -2
@@ -0,0 +1,124 @@
1
+ import type { RudderBus } from "./bus.js";
2
+ import type { GraphEdge, RudderGraph, TaskNode } from "./types.js";
3
+ /**
4
+ * The set of nodes to launch this tick: ready nodes (planned + all hard parents
5
+ * merged) sorted oldest-first, sliced to the remaining parallel capacity.
6
+ */
7
+ export declare function selectLaunchable(graph: RudderGraph, runningCount: number, maxParallel: number): TaskNode[];
8
+ /**
9
+ * When a node fails or is cancelled, the hard dependents (direct + transitive)
10
+ * that can no longer ever start must become blocked. Soft dependents are
11
+ * unaffected (they only ever received the parent's diff as context).
12
+ */
13
+ export declare function computeBlocked(graph: RudderGraph, failedOrCancelledNodeId: string): string[];
14
+ /**
15
+ * Build the resolver-agent prompt. Pure: given the conflicted merge change, the
16
+ * two merged titles, and the conflicted files, it instructs the worker to open
17
+ * each file, resolve preserving BOTH intents, and remove all conflict markers.
18
+ */
19
+ export declare function buildResolverPrompt(input: {
20
+ mergeChangeId: string;
21
+ intoTitle: string;
22
+ nodeTitle: string;
23
+ conflictedFiles: string[];
24
+ }): string;
25
+ /**
26
+ * PURE decision: should a completed resolver run finalize its original node?
27
+ * Yes when the run is a resolver (has resolverFor) and no conflicts remain in
28
+ * its workspace. The IO (listConflicts) is supplied by the caller so this stays
29
+ * unit-testable without jj.
30
+ */
31
+ export declare function resolverShouldFinalize(input: {
32
+ resolverFor: string | undefined;
33
+ remainingConflicts: string[];
34
+ }): boolean;
35
+ /**
36
+ * Soft edges whose parent has merged but whose diff has not yet been delivered
37
+ * to the child. The scheduler pipes each parent's diff into the child context.
38
+ */
39
+ export declare function undeliveredSoftEdges(graph: RudderGraph): GraphEdge[];
40
+ /**
41
+ * Judge edges (fan-out-and-judge) whose variant has REACHED review (or merged)
42
+ * but whose diff has not yet been delivered to the judge node. Like
43
+ * undeliveredSoftEdges but gated on review rather than merge, since the judge
44
+ * compares the variants' finished work before any of them lands.
45
+ */
46
+ export declare function undeliveredJudgeEdges(graph: RudderGraph): GraphEdge[];
47
+ /**
48
+ * Whether a node is a fan-out variant: the `from` of at least one judge edge.
49
+ * Such a node is never merged on its own; the judge node it feeds produces the
50
+ * winning implementation and merges that. Used to skip variants in auto-merge.
51
+ */
52
+ export declare function isJudgedVariant(graph: RudderGraph, id: string): boolean;
53
+ /**
54
+ * Sum the node-attributed token usage across the whole graph (running +
55
+ * terminal + merged). This is the number the budget cap compares against.
56
+ */
57
+ export declare function sumNodeTokens(graph: RudderGraph): number;
58
+ /**
59
+ * Pure budget gate: true when a positive maxTokens cap is set and the spent
60
+ * total has reached it. The scheduler HOLDS new launches when this is true.
61
+ */
62
+ export declare function isOverBudget(tokensSpent: number, maxTokens: number | undefined): boolean;
63
+ /**
64
+ * Whether `next` token usage is a larger total than `prev` (or prev is unset).
65
+ * Backends report cumulative usage, so the largest value seen is the truth; we
66
+ * only ever raise node.tokens, never lower it.
67
+ */
68
+ export declare function tokensNewer(prev: {
69
+ input: number;
70
+ output: number;
71
+ } | undefined, next: {
72
+ input: number;
73
+ output: number;
74
+ }): boolean;
75
+ /**
76
+ * Launch a ready node: create its jj workspace off the scaffolded change (or the
77
+ * integration trunk), create the run record, flip status to "running" INSIDE the
78
+ * updateGraph transaction (the double-launch guard), then spawn the detached
79
+ * worker and publish schedule.launched.
80
+ */
81
+ export declare function launchNode(repoRoot: string, graph: RudderGraph, node: TaskNode, bus: RudderBus): Promise<void>;
82
+ /**
83
+ * Merge a node's change into the integration trunk. Captures the op id first.
84
+ * Clean -> node "merged" + advance graph.integrationChangeId + exportToGit +
85
+ * merge.merged. Conflict -> node "blocked" + record operationId/conflictedFiles
86
+ * + merge.conflict. The resolver-agent spawn is Phase 5; for now hold it blocked.
87
+ */
88
+ export declare function mergeNodeIntoIntegration(repoRoot: string, node: TaskNode, bus: RudderBus): Promise<void>;
89
+ /**
90
+ * Deliver a parent's diff to its child as additional context, then mark the
91
+ * edge delivered. Used for both soft edges (parent merged) and judge edges (the
92
+ * variant reached review). Minimal acceptable form: record the parent diff on
93
+ * the child node (the worker re-reads it). Never blocks. Publishes
94
+ * schedule.softDelivered.
95
+ */
96
+ export declare function deliverSoftDiff(repoRoot: string, edge: GraphEdge, bus: RudderBus): Promise<void>;
97
+ /**
98
+ * One scheduler tick. Recompute each scheduled node's status from its run.json,
99
+ * read orchestrator config, hold if at capacity or over budget, else launch the
100
+ * selectable ready nodes and deliver undelivered soft diffs. A node that just
101
+ * reached completed (review) auto-merges when reviewGate==="auto".
102
+ */
103
+ export declare function scheduleTick(repoRoot: string, bus: RudderBus): Promise<void>;
104
+ /**
105
+ * Called by the daemon when a run.json changes. Projects the owning node's
106
+ * status: completed -> review (auto-merge if configured); failed/cancelled ->
107
+ * node.failed + propagate blocked to hard dependents. Then ticks the scheduler.
108
+ */
109
+ export declare function onRunTransition(repoRoot: string, runId: string, bus: RudderBus): Promise<void>;
110
+ /**
111
+ * The single injection chokepoint. A typed task (terminal pane or board
112
+ * composer) becomes a NEW node reconciled against the frontier, never blindly
113
+ * appended. Adds the node (status "planned", source "injection") + inferred
114
+ * edges, scaffolds its empty jj change, publishes plan.reconciled, then ticks.
115
+ */
116
+ export declare function reconcileInjection(repoRoot: string, input: {
117
+ prompt: string;
118
+ title?: string;
119
+ backend?: TaskNode["backend"];
120
+ model?: string;
121
+ effort?: TaskNode["effort"];
122
+ }, bus: RudderBus): Promise<{
123
+ nodeId: string;
124
+ }>;