@exla/rudder 0.0.0-stage → 3.4.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.
- package/LICENSE +100 -0
- package/README.md +733 -2
- package/assets/rudder.icns +0 -0
- package/assets/sounds/NOTICE.md +8 -0
- package/assets/sounds/ping.mp3 +0 -0
- package/dist/agent-attention.d.ts +5 -0
- package/dist/agent-attention.js +54 -0
- package/dist/agent-attention.js.map +1 -0
- package/dist/analytics.d.ts +36 -0
- package/dist/analytics.js +178 -0
- package/dist/analytics.js.map +1 -0
- package/dist/attach-session.d.ts +91 -0
- package/dist/attach-session.js +290 -0
- package/dist/attach-session.js.map +1 -0
- package/dist/auth.d.ts +36 -0
- package/dist/auth.js +392 -0
- package/dist/auth.js.map +1 -0
- package/dist/backends.d.ts +3 -0
- package/dist/backends.js +638 -0
- package/dist/backends.js.map +1 -0
- package/dist/board/board.css +1 -0
- package/dist/board/board.js +2 -0
- package/dist/board/daemon.d.ts +39 -0
- package/dist/board/daemon.js +1510 -0
- package/dist/board/daemon.js.map +1 -0
- package/dist/brain.d.ts +24 -0
- package/dist/brain.js +244 -0
- package/dist/brain.js.map +1 -0
- package/dist/bus.d.ts +9 -0
- package/dist/bus.js +23 -0
- package/dist/bus.js.map +1 -0
- package/dist/checkout-sync.d.ts +35 -0
- package/dist/checkout-sync.js +247 -0
- package/dist/checkout-sync.js.map +1 -0
- package/dist/cloud.d.ts +48 -0
- package/dist/cloud.js +4596 -0
- package/dist/cloud.js.map +1 -0
- package/dist/codex-binary.d.ts +12 -0
- package/dist/codex-binary.js +184 -0
- package/dist/codex-binary.js.map +1 -0
- package/dist/context-audit.d.ts +21 -0
- package/dist/context-audit.js +109 -0
- package/dist/context-audit.js.map +1 -0
- package/dist/daemon.d.ts +27 -0
- package/dist/daemon.js +203 -0
- package/dist/daemon.js.map +1 -0
- package/dist/effort.d.ts +9 -0
- package/dist/effort.js +72 -0
- package/dist/effort.js.map +1 -0
- package/dist/feedback.d.ts +46 -0
- package/dist/feedback.js +173 -0
- package/dist/feedback.js.map +1 -0
- package/dist/gc.d.ts +3 -0
- package/dist/gc.js +262 -0
- package/dist/gc.js.map +1 -0
- package/dist/git.d.ts +31 -0
- package/dist/git.js +455 -0
- package/dist/git.js.map +1 -0
- package/dist/goal.d.ts +33 -0
- package/dist/goal.js +95 -0
- package/dist/goal.js.map +1 -0
- package/dist/graph.d.ts +93 -0
- package/dist/graph.js +372 -0
- package/dist/graph.js.map +1 -0
- package/dist/handoff.d.ts +110 -0
- package/dist/handoff.js +565 -0
- package/dist/handoff.js.map +1 -0
- package/dist/improve/advisor.d.ts +10 -0
- package/dist/improve/advisor.js +115 -0
- package/dist/improve/advisor.js.map +1 -0
- package/dist/improve/collect.d.ts +49 -0
- package/dist/improve/collect.js +274 -0
- package/dist/improve/collect.js.map +1 -0
- package/dist/improve/gate.d.ts +17 -0
- package/dist/improve/gate.js +60 -0
- package/dist/improve/gate.js.map +1 -0
- package/dist/improve/index.d.ts +9 -0
- package/dist/improve/index.js +376 -0
- package/dist/improve/index.js.map +1 -0
- package/dist/improve/judge.d.ts +32 -0
- package/dist/improve/judge.js +114 -0
- package/dist/improve/judge.js.map +1 -0
- package/dist/improve/mine.d.ts +31 -0
- package/dist/improve/mine.js +192 -0
- package/dist/improve/mine.js.map +1 -0
- package/dist/improve/propose.d.ts +51 -0
- package/dist/improve/propose.js +150 -0
- package/dist/improve/propose.js.map +1 -0
- package/dist/improve/rank.d.ts +16 -0
- package/dist/improve/rank.js +49 -0
- package/dist/improve/rank.js.map +1 -0
- package/dist/improve/schedule.d.ts +1 -0
- package/dist/improve/schedule.js +95 -0
- package/dist/improve/schedule.js.map +1 -0
- package/dist/improve/ship.d.ts +25 -0
- package/dist/improve/ship.js +82 -0
- package/dist/improve/ship.js.map +1 -0
- package/dist/improve/state.d.ts +157 -0
- package/dist/improve/state.js +264 -0
- package/dist/improve/state.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +88 -0
- package/dist/index.js.map +1 -0
- package/dist/jj-binary.d.ts +36 -0
- package/dist/jj-binary.js +143 -0
- package/dist/jj-binary.js.map +1 -0
- package/dist/jj.d.ts +163 -0
- package/dist/jj.js +926 -0
- package/dist/jj.js.map +1 -0
- package/dist/logger.d.ts +22 -0
- package/dist/logger.js +110 -0
- package/dist/logger.js.map +1 -0
- package/dist/main.d.ts +3 -0
- package/dist/main.js +1366 -0
- package/dist/main.js.map +1 -0
- package/dist/migration.d.ts +82 -0
- package/dist/migration.js +198 -0
- package/dist/migration.js.map +1 -0
- package/dist/models.d.ts +9 -0
- package/dist/models.js +623 -0
- package/dist/models.js.map +1 -0
- package/dist/move-home.d.ts +82 -0
- package/dist/move-home.js +472 -0
- package/dist/move-home.js.map +1 -0
- package/dist/native/darwin-arm64/rudder-native +0 -0
- package/dist/native/darwin-x64/rudder-native +0 -0
- package/dist/native/linux-x64/rudder-native +0 -0
- package/dist/native-agents.d.ts +8 -0
- package/dist/native-agents.js +178 -0
- package/dist/native-agents.js.map +1 -0
- package/dist/native-binary.d.ts +4 -0
- package/dist/native-binary.js +140 -0
- package/dist/native-binary.js.map +1 -0
- package/dist/paste-bridge.d.ts +36 -0
- package/dist/paste-bridge.js +279 -0
- package/dist/paste-bridge.js.map +1 -0
- package/dist/plan-mode.d.ts +2 -0
- package/dist/plan-mode.js +22 -0
- package/dist/plan-mode.js.map +1 -0
- package/dist/planner.d.ts +27 -0
- package/dist/planner.js +587 -0
- package/dist/planner.js.map +1 -0
- package/dist/predict.d.ts +67 -0
- package/dist/predict.js +369 -0
- package/dist/predict.js.map +1 -0
- package/dist/report.d.ts +74 -0
- package/dist/report.js +412 -0
- package/dist/report.js.map +1 -0
- package/dist/rudder-md.d.ts +33 -0
- package/dist/rudder-md.js +142 -0
- package/dist/rudder-md.js.map +1 -0
- package/dist/run-manager.d.ts +62 -0
- package/dist/run-manager.js +1400 -0
- package/dist/run-manager.js.map +1 -0
- package/dist/scheduler.d.ts +128 -0
- package/dist/scheduler.js +955 -0
- package/dist/scheduler.js.map +1 -0
- package/dist/state.d.ts +127 -0
- package/dist/state.js +704 -0
- package/dist/state.js.map +1 -0
- package/dist/surfaces.d.ts +91 -0
- package/dist/surfaces.js +460 -0
- package/dist/surfaces.js.map +1 -0
- package/dist/task-summary.d.ts +30 -0
- package/dist/task-summary.js +472 -0
- package/dist/task-summary.js.map +1 -0
- package/dist/types.d.ts +492 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/usage.d.ts +198 -0
- package/dist/usage.js +830 -0
- package/dist/usage.js.map +1 -0
- package/dist/util.d.ts +73 -0
- package/dist/util.js +399 -0
- package/dist/util.js.map +1 -0
- package/dist/version-check.d.ts +16 -0
- package/dist/version-check.js +269 -0
- package/dist/version-check.js.map +1 -0
- package/package.json +68 -4
- package/scripts/copy-native.mjs +89 -0
- package/scripts/postinstall.mjs +34 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
1
|
+
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
2
|
+
[key: string]: JsonValue;
|
|
3
|
+
};
|
|
4
|
+
export type CredentialType = "api_key" | "oauth" | "token";
|
|
5
|
+
export type ApiKeyCredential = {
|
|
6
|
+
type: "api_key";
|
|
7
|
+
provider: string;
|
|
8
|
+
key?: string;
|
|
9
|
+
keyRef?: SecretRef;
|
|
10
|
+
email?: string;
|
|
11
|
+
metadata?: Record<string, string>;
|
|
12
|
+
};
|
|
13
|
+
export type TokenCredential = {
|
|
14
|
+
type: "token";
|
|
15
|
+
provider: string;
|
|
16
|
+
token?: string;
|
|
17
|
+
tokenRef?: SecretRef;
|
|
18
|
+
expires?: number;
|
|
19
|
+
email?: string;
|
|
20
|
+
};
|
|
21
|
+
export type OAuthCredential = {
|
|
22
|
+
type: "oauth";
|
|
23
|
+
provider: string;
|
|
24
|
+
access: string;
|
|
25
|
+
refresh: string;
|
|
26
|
+
expires: number;
|
|
27
|
+
clientId?: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
accountId?: string;
|
|
30
|
+
enterpriseUrl?: string;
|
|
31
|
+
projectId?: string;
|
|
32
|
+
};
|
|
33
|
+
export type SecretRef = {
|
|
34
|
+
source: "env" | "file" | "exec";
|
|
35
|
+
provider: string;
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
export type AuthProfileCredential = ApiKeyCredential | TokenCredential | OAuthCredential;
|
|
39
|
+
export type ProfileUsageStats = {
|
|
40
|
+
lastUsed?: number;
|
|
41
|
+
cooldownUntil?: number;
|
|
42
|
+
disabledUntil?: number;
|
|
43
|
+
disabledReason?: string;
|
|
44
|
+
errorCount?: number;
|
|
45
|
+
lastFailureAt?: number;
|
|
46
|
+
};
|
|
47
|
+
export type AuthProfileStore = {
|
|
48
|
+
version: 1;
|
|
49
|
+
profiles: Record<string, AuthProfileCredential>;
|
|
50
|
+
order?: Record<string, string[]>;
|
|
51
|
+
lastGood?: Record<string, string>;
|
|
52
|
+
usageStats?: Record<string, ProfileUsageStats>;
|
|
53
|
+
};
|
|
54
|
+
export type RudderConfig = {
|
|
55
|
+
version: 1;
|
|
56
|
+
vcs?: VcsMode;
|
|
57
|
+
defaultBackend: BackendId;
|
|
58
|
+
lastUsedBackend?: BackendId;
|
|
59
|
+
mergeStrategy: MergeStrategy;
|
|
60
|
+
colorMode?: "terminal" | "paper";
|
|
61
|
+
/** Anonymous usage events. Undefined means on; see src/analytics.ts. */
|
|
62
|
+
telemetry?: boolean;
|
|
63
|
+
/** Stable anonymous id for this INSTALL (not a person). Minted on first use. */
|
|
64
|
+
installId?: string;
|
|
65
|
+
/** When the one-time telemetry disclosure was printed. */
|
|
66
|
+
telemetryNoticeShownAt?: string;
|
|
67
|
+
runPolicy: {
|
|
68
|
+
sameCheckout: "single-active";
|
|
69
|
+
concurrentPromptMode: "workspace" | "queue";
|
|
70
|
+
};
|
|
71
|
+
acpx: {
|
|
72
|
+
install: "latest";
|
|
73
|
+
};
|
|
74
|
+
backends: {
|
|
75
|
+
claude?: BackendConfig;
|
|
76
|
+
codex?: BackendConfig;
|
|
77
|
+
acpx?: BackendConfig;
|
|
78
|
+
opencode?: BackendConfig;
|
|
79
|
+
};
|
|
80
|
+
board?: {
|
|
81
|
+
port?: number;
|
|
82
|
+
};
|
|
83
|
+
orchestrator?: {
|
|
84
|
+
maxParallel: number;
|
|
85
|
+
budget?: {
|
|
86
|
+
maxTokens?: number;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
/** Continual improvement loop (`rudder improve`); see docs/continual-improvement.md. */
|
|
90
|
+
improve?: {
|
|
91
|
+
enabled?: boolean;
|
|
92
|
+
autonomy?: "observe" | "propose" | "ship";
|
|
93
|
+
budgetUsd?: number;
|
|
94
|
+
maxFindings?: number;
|
|
95
|
+
repoPath?: string;
|
|
96
|
+
allowedRemote?: string;
|
|
97
|
+
excludeProjects?: string[];
|
|
98
|
+
minerModel?: string;
|
|
99
|
+
judgeModel?: string;
|
|
100
|
+
advisorModel?: string;
|
|
101
|
+
workerModel?: string;
|
|
102
|
+
agentTimeoutMs?: number;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export declare const DEFAULT_BOARD_PORT = 4774;
|
|
106
|
+
export type BackendId = "claude" | "codex" | "acpx" | "opencode";
|
|
107
|
+
export type VcsMode = "git" | "jj";
|
|
108
|
+
export type EffortLevel = "low" | "medium" | "high" | "xhigh" | "max";
|
|
109
|
+
export type RunMode = "execute" | "plan" | "rudder-plan" | "review-all" | "main" | "one-off";
|
|
110
|
+
export type MergeStrategy = "merge" | "rebase";
|
|
111
|
+
export type BackendConfig = {
|
|
112
|
+
profileId?: string;
|
|
113
|
+
model?: string;
|
|
114
|
+
effort?: EffortLevel;
|
|
115
|
+
reasoningEffort?: EffortLevel;
|
|
116
|
+
};
|
|
117
|
+
export type RunStatus = "created" | "running" | "steering" | "verifying" | "completed" | "failed" | "cancelled" | "paused" | "orphaned" | "migrated" | "merge-conflict" | "merged";
|
|
118
|
+
export type DeliveryEvidence = {
|
|
119
|
+
required: boolean;
|
|
120
|
+
kind?: "web" | "macos-app" | "release" | "custom" | string;
|
|
121
|
+
status: "not-requested" | "pending" | "deployed" | "verified" | "blocked" | "failed";
|
|
122
|
+
target?: string;
|
|
123
|
+
url?: string;
|
|
124
|
+
appPath?: string;
|
|
125
|
+
provider?: string;
|
|
126
|
+
revision?: string;
|
|
127
|
+
deploymentId?: string;
|
|
128
|
+
version?: string;
|
|
129
|
+
verifiedAt?: string;
|
|
130
|
+
checks: string[];
|
|
131
|
+
};
|
|
132
|
+
export type UndoEntry = {
|
|
133
|
+
opId: string;
|
|
134
|
+
label: string;
|
|
135
|
+
ts: string;
|
|
136
|
+
runIds: string[];
|
|
137
|
+
};
|
|
138
|
+
export type NodeStatus = "planned" | "ready" | "running" | "review" | "blocked" | "merged" | "failed";
|
|
139
|
+
export type DepType = "hard" | "soft";
|
|
140
|
+
export type EdgeType = DepType | "judge";
|
|
141
|
+
export type GraphEdge = {
|
|
142
|
+
id: string;
|
|
143
|
+
from: string;
|
|
144
|
+
to: string;
|
|
145
|
+
type: EdgeType;
|
|
146
|
+
why?: string;
|
|
147
|
+
delivered?: boolean;
|
|
148
|
+
};
|
|
149
|
+
export type TaskNode = {
|
|
150
|
+
id: string;
|
|
151
|
+
title: string;
|
|
152
|
+
prompt: string;
|
|
153
|
+
goal?: string;
|
|
154
|
+
success?: string;
|
|
155
|
+
backend: BackendId;
|
|
156
|
+
model?: string;
|
|
157
|
+
effort?: EffortLevel;
|
|
158
|
+
status: NodeStatus;
|
|
159
|
+
runId?: string;
|
|
160
|
+
workspace?: {
|
|
161
|
+
path: string;
|
|
162
|
+
workspaceName?: string;
|
|
163
|
+
};
|
|
164
|
+
jjChangeId?: string;
|
|
165
|
+
deps: string[];
|
|
166
|
+
lastLine?: string;
|
|
167
|
+
tokens?: {
|
|
168
|
+
input: number;
|
|
169
|
+
output: number;
|
|
170
|
+
};
|
|
171
|
+
reviewState?: "pending" | "approved" | "changes-requested";
|
|
172
|
+
resolverRunId?: string;
|
|
173
|
+
merge?: MergeState;
|
|
174
|
+
supersededBy?: string;
|
|
175
|
+
source: "planner" | "injection";
|
|
176
|
+
createdAt: string;
|
|
177
|
+
updatedAt: string;
|
|
178
|
+
};
|
|
179
|
+
export type RudderGraph = {
|
|
180
|
+
version: 1;
|
|
181
|
+
repoRoot: string;
|
|
182
|
+
integrationChangeId?: string;
|
|
183
|
+
nodes: Record<string, TaskNode>;
|
|
184
|
+
edges: Record<string, GraphEdge>;
|
|
185
|
+
updatedAt: string;
|
|
186
|
+
};
|
|
187
|
+
export type PlanEdge = {
|
|
188
|
+
on: string;
|
|
189
|
+
type: EdgeType;
|
|
190
|
+
why?: string;
|
|
191
|
+
};
|
|
192
|
+
export type PlanNode = {
|
|
193
|
+
id: string;
|
|
194
|
+
title: string;
|
|
195
|
+
prompt: string;
|
|
196
|
+
goal?: string;
|
|
197
|
+
success?: string;
|
|
198
|
+
deps: PlanEdge[];
|
|
199
|
+
backend?: BackendId;
|
|
200
|
+
model?: string;
|
|
201
|
+
effort?: EffortLevel;
|
|
202
|
+
fileScope?: string[];
|
|
203
|
+
};
|
|
204
|
+
export type PlanDag = {
|
|
205
|
+
nodes: PlanNode[];
|
|
206
|
+
edges: Array<{
|
|
207
|
+
from: string;
|
|
208
|
+
to: string;
|
|
209
|
+
type: EdgeType;
|
|
210
|
+
why?: string;
|
|
211
|
+
}>;
|
|
212
|
+
};
|
|
213
|
+
export type InferredDep = {
|
|
214
|
+
node: string;
|
|
215
|
+
type: DepType;
|
|
216
|
+
};
|
|
217
|
+
export type ReconcileResult = {
|
|
218
|
+
node: PlanNode;
|
|
219
|
+
inferredDeps: InferredDep[];
|
|
220
|
+
};
|
|
221
|
+
export type ResolverContext = {
|
|
222
|
+
mergeChangeId: string;
|
|
223
|
+
parentChangeIds: string[];
|
|
224
|
+
conflictedFiles: string[];
|
|
225
|
+
nodeTitle: string;
|
|
226
|
+
intoTitle: string;
|
|
227
|
+
workspacePath: string;
|
|
228
|
+
};
|
|
229
|
+
export type RunRecord = {
|
|
230
|
+
id: string;
|
|
231
|
+
status: RunStatus;
|
|
232
|
+
vcs?: VcsMode;
|
|
233
|
+
mode?: RunMode;
|
|
234
|
+
resolverFor?: string;
|
|
235
|
+
resolverRunId?: string;
|
|
236
|
+
tokens?: {
|
|
237
|
+
input: number;
|
|
238
|
+
output: number;
|
|
239
|
+
};
|
|
240
|
+
task: string;
|
|
241
|
+
taskSummary?: string;
|
|
242
|
+
taskSummaryLlm?: boolean;
|
|
243
|
+
backend: BackendId;
|
|
244
|
+
model?: string;
|
|
245
|
+
effort?: EffortLevel;
|
|
246
|
+
createdAt: string;
|
|
247
|
+
updatedAt: string;
|
|
248
|
+
repoRoot: string;
|
|
249
|
+
targetBranch: string;
|
|
250
|
+
baseCommit: string;
|
|
251
|
+
workspace: {
|
|
252
|
+
enabled: boolean;
|
|
253
|
+
path: string;
|
|
254
|
+
branch?: string;
|
|
255
|
+
workspaceName?: string;
|
|
256
|
+
jjChangeId?: string;
|
|
257
|
+
};
|
|
258
|
+
process?: {
|
|
259
|
+
/** Detached Rudder __worker process that owns verification/lifecycle. */
|
|
260
|
+
controllerPid?: number;
|
|
261
|
+
/** Backend CLI child (Claude/Codex/acpx) when one is active. */
|
|
262
|
+
backendPid?: number;
|
|
263
|
+
pid?: number;
|
|
264
|
+
/** Identifies the worker pass that currently owns this run record. A web
|
|
265
|
+
* redirect starts a new attempt so the superseded worker cannot write a
|
|
266
|
+
* stale terminal status over the new turn. */
|
|
267
|
+
attemptId?: string;
|
|
268
|
+
startedAt?: string;
|
|
269
|
+
endedAt?: string;
|
|
270
|
+
exitCode?: number | null;
|
|
271
|
+
signal?: NodeJS.Signals | null;
|
|
272
|
+
};
|
|
273
|
+
currentPrompt?: string;
|
|
274
|
+
turns?: Array<{
|
|
275
|
+
ts: string;
|
|
276
|
+
prompt: string;
|
|
277
|
+
source: "user" | "steerer" | "regoal";
|
|
278
|
+
}>;
|
|
279
|
+
lastUserInputAt?: string;
|
|
280
|
+
autoSteer?: {
|
|
281
|
+
count: number;
|
|
282
|
+
max: number;
|
|
283
|
+
waitingSince?: string;
|
|
284
|
+
};
|
|
285
|
+
session?: {
|
|
286
|
+
nativeSessionId?: string;
|
|
287
|
+
acpxSessionId?: string;
|
|
288
|
+
sessionName?: string;
|
|
289
|
+
};
|
|
290
|
+
terminal?: {
|
|
291
|
+
kind: "tmux";
|
|
292
|
+
sessionName: string;
|
|
293
|
+
paneId: string;
|
|
294
|
+
paneTitle?: string;
|
|
295
|
+
logPath?: string;
|
|
296
|
+
launchedAt: string;
|
|
297
|
+
};
|
|
298
|
+
verification?: VerificationResult;
|
|
299
|
+
/** Structured proof for an explicitly requested deploy/install/release. A
|
|
300
|
+
* completed process is not equivalent to a verified delivery. */
|
|
301
|
+
delivery?: DeliveryEvidence;
|
|
302
|
+
merge?: MergeState;
|
|
303
|
+
sync?: SyncState;
|
|
304
|
+
/** Durable "an integration conflict happened at some point this run" marker.
|
|
305
|
+
* `merge.status`/`status` only show the LIVE conflict state and are rewritten
|
|
306
|
+
* once a resolver or re-merge succeeds, so telemetry (the improve loop's
|
|
307
|
+
* mergeConflictRate) reads this instead. Set on first conflict, never cleared. */
|
|
308
|
+
hadMergeConflict?: boolean;
|
|
309
|
+
};
|
|
310
|
+
export type MergeState = {
|
|
311
|
+
status: "not-started" | "merged" | "conflict" | "failed";
|
|
312
|
+
attemptedAt?: string;
|
|
313
|
+
targetBranch?: string;
|
|
314
|
+
strategy?: MergeStrategy;
|
|
315
|
+
conflictKind?: "merge" | "rebase";
|
|
316
|
+
conflictedFiles?: string[];
|
|
317
|
+
operationId?: string;
|
|
318
|
+
mergeChangeId?: string;
|
|
319
|
+
/** Git commit exported for the integrated jj change. */
|
|
320
|
+
localCommit?: string;
|
|
321
|
+
/** Whether the configured remote bookmark contains localCommit. */
|
|
322
|
+
pushed?: boolean;
|
|
323
|
+
pushedAt?: string;
|
|
324
|
+
error?: string;
|
|
325
|
+
};
|
|
326
|
+
export type SyncState = {
|
|
327
|
+
status: "not-started" | "synced" | "conflict" | "failed";
|
|
328
|
+
attemptedAt?: string;
|
|
329
|
+
baseBranch?: string;
|
|
330
|
+
conflictedFiles?: string[];
|
|
331
|
+
error?: string;
|
|
332
|
+
};
|
|
333
|
+
export type RudderEvent = {
|
|
334
|
+
ts: string;
|
|
335
|
+
runId: string;
|
|
336
|
+
nodeId?: string;
|
|
337
|
+
type: "run.created" | "run.started" | "run.continued" | "run.detached" | "steerer.waiting" | "steerer.prompt" | "planner.spec" | "backend.output" | "backend.error" | "backend.exit" | "verifier.result" | "run.completed" | "run.failed" | "run.cancelled" | "merge.result" | "sync.result" | "node.created" | "node.ready" | "node.running" | "node.review" | "node.merged" | "node.blocked" | "node.failed" | "plan.proposed" | "plan.reconciled" | "schedule.tick" | "schedule.launched" | "schedule.softDelivered" | "merge.attempt" | "merge.merged" | "merge.conflict" | "resolver.spawned" | "resolver.resolved";
|
|
338
|
+
message?: string;
|
|
339
|
+
data?: JsonValue;
|
|
340
|
+
};
|
|
341
|
+
export type RunRequest = {
|
|
342
|
+
run: RunRecord;
|
|
343
|
+
prompt: string;
|
|
344
|
+
contract: string;
|
|
345
|
+
};
|
|
346
|
+
export type BackendAdapter = {
|
|
347
|
+
id: BackendId;
|
|
348
|
+
verify(): Promise<{
|
|
349
|
+
ok: boolean;
|
|
350
|
+
message: string;
|
|
351
|
+
}>;
|
|
352
|
+
run(request: RunRequest, emit: (event: RudderEvent) => Promise<void>): Promise<number>;
|
|
353
|
+
};
|
|
354
|
+
export type SpecContract = {
|
|
355
|
+
runId: string;
|
|
356
|
+
task: string;
|
|
357
|
+
goal: string;
|
|
358
|
+
success: string;
|
|
359
|
+
createdAt: string;
|
|
360
|
+
repo: {
|
|
361
|
+
root: string;
|
|
362
|
+
branch: string;
|
|
363
|
+
baseCommit: string;
|
|
364
|
+
status: string[];
|
|
365
|
+
};
|
|
366
|
+
instructionsFiles: Array<{
|
|
367
|
+
path: string;
|
|
368
|
+
content: string;
|
|
369
|
+
}>;
|
|
370
|
+
acceptanceCriteria: string[];
|
|
371
|
+
suggestedTests: string[];
|
|
372
|
+
};
|
|
373
|
+
export type VerificationResult = {
|
|
374
|
+
satisfied: string[];
|
|
375
|
+
missing: string[];
|
|
376
|
+
notes: string;
|
|
377
|
+
shouldContinue: boolean;
|
|
378
|
+
};
|
|
379
|
+
export type CloudAuthState = {
|
|
380
|
+
version: 1;
|
|
381
|
+
token: string;
|
|
382
|
+
cloudUrl: string;
|
|
383
|
+
defaultRuntime?: "fly" | "byo-vm";
|
|
384
|
+
defaultRegion?: string;
|
|
385
|
+
byocSshHost?: string;
|
|
386
|
+
accountId?: string;
|
|
387
|
+
email?: string;
|
|
388
|
+
expiresAt?: string;
|
|
389
|
+
updatedAt: string;
|
|
390
|
+
};
|
|
391
|
+
export type CloudSail = {
|
|
392
|
+
id: string;
|
|
393
|
+
status?: string;
|
|
394
|
+
url?: string;
|
|
395
|
+
branch?: string;
|
|
396
|
+
createdAt?: string;
|
|
397
|
+
updatedAt?: string;
|
|
398
|
+
[key: string]: JsonValue | undefined;
|
|
399
|
+
};
|
|
400
|
+
export type BoardColumn = "todo" | "running" | "review" | "done";
|
|
401
|
+
export type ProjectEntry = {
|
|
402
|
+
slug: string;
|
|
403
|
+
repoRoot: string;
|
|
404
|
+
name: string;
|
|
405
|
+
addedAt: string;
|
|
406
|
+
};
|
|
407
|
+
export type ProjectsRegistry = {
|
|
408
|
+
version: 1;
|
|
409
|
+
projects: ProjectEntry[];
|
|
410
|
+
};
|
|
411
|
+
export type ProjectSummary = {
|
|
412
|
+
slug: string;
|
|
413
|
+
name: string;
|
|
414
|
+
repoRoot: string;
|
|
415
|
+
counts: {
|
|
416
|
+
todo: number;
|
|
417
|
+
running: number;
|
|
418
|
+
review: number;
|
|
419
|
+
done: number;
|
|
420
|
+
blocked: number;
|
|
421
|
+
failed: number;
|
|
422
|
+
};
|
|
423
|
+
lastActivityAt: string;
|
|
424
|
+
};
|
|
425
|
+
export type BoardNode = {
|
|
426
|
+
/** Stable graph node id when this run belongs to the DAG; otherwise run id. */
|
|
427
|
+
id: string;
|
|
428
|
+
/** Concrete run id once a worker has launched. */
|
|
429
|
+
runId?: string;
|
|
430
|
+
title: string;
|
|
431
|
+
status: RunStatus | NodeStatus;
|
|
432
|
+
column: BoardColumn;
|
|
433
|
+
blocked: boolean;
|
|
434
|
+
backend: BackendId;
|
|
435
|
+
model?: string;
|
|
436
|
+
effort?: EffortLevel;
|
|
437
|
+
lastLine: string | null;
|
|
438
|
+
tokens: {
|
|
439
|
+
input: number;
|
|
440
|
+
output: number;
|
|
441
|
+
} | null;
|
|
442
|
+
deps: {
|
|
443
|
+
hard: string[];
|
|
444
|
+
soft: string[];
|
|
445
|
+
};
|
|
446
|
+
createdAt: string;
|
|
447
|
+
updatedAt: string;
|
|
448
|
+
workspace: {
|
|
449
|
+
path: string;
|
|
450
|
+
workspaceName?: string;
|
|
451
|
+
} | null;
|
|
452
|
+
merge: MergeState | null;
|
|
453
|
+
delivery?: DeliveryEvidence;
|
|
454
|
+
/** User-authored follow-up turns, oldest first. The initial task is omitted. */
|
|
455
|
+
updates: Array<{
|
|
456
|
+
instruction: string;
|
|
457
|
+
ts: string;
|
|
458
|
+
source?: string;
|
|
459
|
+
}>;
|
|
460
|
+
};
|
|
461
|
+
export type BoardEdge = {
|
|
462
|
+
from: string;
|
|
463
|
+
to: string;
|
|
464
|
+
kind: "hard" | "soft" | "judge";
|
|
465
|
+
};
|
|
466
|
+
export type PlanGate = {
|
|
467
|
+
id: string;
|
|
468
|
+
nodeId?: string;
|
|
469
|
+
question: string;
|
|
470
|
+
options?: string[];
|
|
471
|
+
createdAt: string;
|
|
472
|
+
};
|
|
473
|
+
export type MemoryEntry = {
|
|
474
|
+
text: string;
|
|
475
|
+
owner?: string;
|
|
476
|
+
ts?: string;
|
|
477
|
+
};
|
|
478
|
+
export type ActivityEntry = {
|
|
479
|
+
text: string;
|
|
480
|
+
kind: "action" | "heartbeat";
|
|
481
|
+
ts?: string;
|
|
482
|
+
};
|
|
483
|
+
export type BoardSnapshot = {
|
|
484
|
+
slug: string;
|
|
485
|
+
name: string;
|
|
486
|
+
generatedAt: string;
|
|
487
|
+
nodes: BoardNode[];
|
|
488
|
+
edges: BoardEdge[];
|
|
489
|
+
gates: PlanGate[];
|
|
490
|
+
memory: MemoryEntry[];
|
|
491
|
+
activity?: ActivityEntry[];
|
|
492
|
+
};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0HA,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC"}
|
package/dist/usage.d.ts
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
export type Provider = "claude" | "codex";
|
|
2
|
+
export type UsageRange = "7d" | "30d" | "90d";
|
|
3
|
+
/** USD per million tokens. */
|
|
4
|
+
export type ModelPrice = {
|
|
5
|
+
input: number;
|
|
6
|
+
output: number;
|
|
7
|
+
cacheWrite: number;
|
|
8
|
+
cacheRead: number;
|
|
9
|
+
};
|
|
10
|
+
export type Totals = {
|
|
11
|
+
input: number;
|
|
12
|
+
output: number;
|
|
13
|
+
cacheWrite: number;
|
|
14
|
+
cacheRead: number;
|
|
15
|
+
/** Estimated USD at API list rates. */
|
|
16
|
+
cost: number;
|
|
17
|
+
/** USD that cache reads saved versus paying full input price. */
|
|
18
|
+
cacheSavings: number;
|
|
19
|
+
/** API calls (Claude assistant messages / Codex responses). */
|
|
20
|
+
calls: number;
|
|
21
|
+
};
|
|
22
|
+
export type UsageEvent = {
|
|
23
|
+
ts: string;
|
|
24
|
+
provider: Provider;
|
|
25
|
+
model: string;
|
|
26
|
+
cwd: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
input: number;
|
|
29
|
+
output: number;
|
|
30
|
+
cacheWrite: number;
|
|
31
|
+
cacheRead: number;
|
|
32
|
+
};
|
|
33
|
+
export type DayBucket = {
|
|
34
|
+
day: string;
|
|
35
|
+
claude: Totals;
|
|
36
|
+
codex: Totals;
|
|
37
|
+
};
|
|
38
|
+
export type ModelRow = {
|
|
39
|
+
provider: Provider;
|
|
40
|
+
model: string;
|
|
41
|
+
totals: Totals;
|
|
42
|
+
sessions: number;
|
|
43
|
+
};
|
|
44
|
+
export type SessionRow = {
|
|
45
|
+
id: string;
|
|
46
|
+
provider: Provider;
|
|
47
|
+
model: string;
|
|
48
|
+
startedAt: string;
|
|
49
|
+
lastAt: string;
|
|
50
|
+
cwd: string;
|
|
51
|
+
totals: Totals;
|
|
52
|
+
};
|
|
53
|
+
export type ProjectRow = {
|
|
54
|
+
key: string;
|
|
55
|
+
name: string;
|
|
56
|
+
slug: string | null;
|
|
57
|
+
totals: Totals;
|
|
58
|
+
sessions: SessionRow[];
|
|
59
|
+
};
|
|
60
|
+
export type TokenUsageReport = {
|
|
61
|
+
range: UsageRange;
|
|
62
|
+
since: string;
|
|
63
|
+
generatedAt: string;
|
|
64
|
+
days: DayBucket[];
|
|
65
|
+
providers: Record<Provider, Totals>;
|
|
66
|
+
total: Totals;
|
|
67
|
+
models: ModelRow[];
|
|
68
|
+
projects: ProjectRow[];
|
|
69
|
+
scannedFiles: number;
|
|
70
|
+
pricingNote: string;
|
|
71
|
+
};
|
|
72
|
+
export declare function priceFor(model: string): ModelPrice | null;
|
|
73
|
+
export declare function emptyTotals(): Totals;
|
|
74
|
+
export declare function addEvent(totals: Totals, event: UsageEvent): void;
|
|
75
|
+
export declare function claudeConfigDir(): string;
|
|
76
|
+
export declare function codexHomeDir(): string;
|
|
77
|
+
export declare function rangeSince(range: UsageRange, now?: Date): Date;
|
|
78
|
+
/** Local calendar day for a timestamp, as YYYY-MM-DD. */
|
|
79
|
+
export declare function localDay(ts: string | Date): string;
|
|
80
|
+
/**
|
|
81
|
+
* Claude Code writes one line per assistant message, and a streamed message can
|
|
82
|
+
* appear several times (same `message.id` + `requestId`) with growing usage; the
|
|
83
|
+
* last line is the complete one, so later occurrences replace earlier ones.
|
|
84
|
+
*/
|
|
85
|
+
export declare function parseClaudeLog(file: string): Promise<UsageEvent[]>;
|
|
86
|
+
/**
|
|
87
|
+
* Codex writes `token_count` events carrying a cumulative `total_token_usage`;
|
|
88
|
+
* each event's delta from the previous one is one response's usage, attributed
|
|
89
|
+
* to that event's timestamp and the model of the latest `turn_context`.
|
|
90
|
+
* Cached input is a subset of input, so billable input = input − cached.
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseCodexLog(file: string): Promise<UsageEvent[]>;
|
|
93
|
+
export type ProjectLookup = {
|
|
94
|
+
slug: string;
|
|
95
|
+
name: string;
|
|
96
|
+
repoRoot: string;
|
|
97
|
+
}[];
|
|
98
|
+
/** Nearest ancestor (inclusive) that is a git/jj checkout, or null. Cached per dir. */
|
|
99
|
+
export declare function nearestRepoRoot(cwd: string, exists?: (p: string) => boolean): string | null;
|
|
100
|
+
/**
|
|
101
|
+
* Which workspace a session belongs to. The session's own checkout names it:
|
|
102
|
+
* a Rudder worker workspace (`<repo>/.rudder-workspaces/<name>`) counts for
|
|
103
|
+
* `<repo>`, any other cwd for its nearest git/jj root, a bare directory for
|
|
104
|
+
* itself. A registered project wins only when its root IS that checkout —
|
|
105
|
+
* a project registered at `~/code` must not swallow every repo beneath it —
|
|
106
|
+
* or when the cwd is not inside any checkout at all.
|
|
107
|
+
*/
|
|
108
|
+
export declare function projectFor(cwd: string, projects: ProjectLookup, repoRootOf?: (cwd: string) => string | null): {
|
|
109
|
+
key: string;
|
|
110
|
+
name: string;
|
|
111
|
+
slug: string | null;
|
|
112
|
+
};
|
|
113
|
+
export declare function scanTokenUsage(opts: {
|
|
114
|
+
range: UsageRange;
|
|
115
|
+
projects?: ProjectLookup;
|
|
116
|
+
claudeProjectsRoot?: string;
|
|
117
|
+
codexSessionsRoot?: string;
|
|
118
|
+
now?: Date;
|
|
119
|
+
}): Promise<TokenUsageReport>;
|
|
120
|
+
export type QuotaWindow = {
|
|
121
|
+
label: string;
|
|
122
|
+
percent: number;
|
|
123
|
+
resetsAt: string | null;
|
|
124
|
+
};
|
|
125
|
+
export type AccountQuota = {
|
|
126
|
+
provider: Provider;
|
|
127
|
+
email: string | null;
|
|
128
|
+
plan: string | null;
|
|
129
|
+
windows: QuotaWindow[];
|
|
130
|
+
/** Human-readable reason a request would be rejected or throttled right now (rate limit hit, credits depleted), or null when clear. */
|
|
131
|
+
blocked: string | null;
|
|
132
|
+
/** Human-readable reason the meters are missing, with the fix. */
|
|
133
|
+
error: string | null;
|
|
134
|
+
fetchedAt: string;
|
|
135
|
+
};
|
|
136
|
+
export type QuotaReport = {
|
|
137
|
+
accounts: AccountQuota[];
|
|
138
|
+
fetchedAt: string;
|
|
139
|
+
ttlSeconds: number;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Pure: Claude's `/api/oauth/usage` body → meters. Newer accounts stop
|
|
143
|
+
* populating `seven_day_opus`/`seven_day_sonnet` (both come back `null`) and
|
|
144
|
+
* report the active model's weekly sub-limit in `usage.limits[]` instead,
|
|
145
|
+
* keyed by `scope.model.display_name` — e.g. a Fable-heavy week shows a
|
|
146
|
+
* higher "Weekly · Fable" percent than the blended `seven_day` figure.
|
|
147
|
+
*/
|
|
148
|
+
export declare function parseClaudeQuota(usage: any, profile: any, fallbackPlan: string | null): Omit<AccountQuota, "fetchedAt" | "provider">;
|
|
149
|
+
/** Pure: Codex's `/backend-api/wham/usage` body → meters. */
|
|
150
|
+
export declare function parseCodexQuota(body: any): Omit<AccountQuota, "fetchedAt" | "provider">;
|
|
151
|
+
export declare function fetchQuota(opts?: {
|
|
152
|
+
force?: boolean;
|
|
153
|
+
}): Promise<QuotaReport>;
|
|
154
|
+
export type ProcessKind = "rudder" | "claude" | "codex" | "opencode" | "other";
|
|
155
|
+
export type ProcessRow = {
|
|
156
|
+
pid: number;
|
|
157
|
+
ppid: number;
|
|
158
|
+
kind: ProcessKind;
|
|
159
|
+
cpu: number;
|
|
160
|
+
/** Resident set, bytes. */
|
|
161
|
+
rss: number;
|
|
162
|
+
elapsed: string;
|
|
163
|
+
command: string;
|
|
164
|
+
};
|
|
165
|
+
export type MachineReport = {
|
|
166
|
+
at: string;
|
|
167
|
+
cpus: number;
|
|
168
|
+
load: number[];
|
|
169
|
+
totalMem: number;
|
|
170
|
+
freeMem: number;
|
|
171
|
+
rudder: {
|
|
172
|
+
cpu: number;
|
|
173
|
+
rss: number;
|
|
174
|
+
pid: number;
|
|
175
|
+
};
|
|
176
|
+
processes: ProcessRow[];
|
|
177
|
+
byKind: Record<ProcessKind, {
|
|
178
|
+
cpu: number;
|
|
179
|
+
rss: number;
|
|
180
|
+
count: number;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
/**
|
|
184
|
+
* Classify by the EXECUTABLE, not the whole command line: a Claude worker's
|
|
185
|
+
* argv carries `--settings ~/.rudder/signals/...`, so matching "rudder"
|
|
186
|
+
* anywhere in the line filed every agent under rudder. For interpreters
|
|
187
|
+
* (`node`, `bun`) the script path is the executable.
|
|
188
|
+
*/
|
|
189
|
+
export declare function classifyCommand(command: string): ProcessKind;
|
|
190
|
+
/** Pure: `ps -axo pid=,ppid=,pcpu=,rss=,etime=,args=` → agent-related rows. */
|
|
191
|
+
export declare function parsePsOutput(text: string): ProcessRow[];
|
|
192
|
+
/**
|
|
193
|
+
* `os.freemem()` on macOS counts only truly free pages, so a healthy Mac reads
|
|
194
|
+
* as 99% used. vm_stat's inactive + speculative + purgeable pages are
|
|
195
|
+
* reclaimable and count as available, which is what Activity Monitor shows.
|
|
196
|
+
*/
|
|
197
|
+
export declare function parseVmStat(text: string): number | null;
|
|
198
|
+
export declare function machineResources(): Promise<MachineReport>;
|