@ricsam/r5d-api 0.0.58 → 0.0.60

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
@@ -58,6 +58,8 @@ Trusted server-side callers that authenticate through custom headers, such as a
58
58
  - `projects.env.get/update/remove(projectId, ...)`
59
59
  - `projects.sessions.list(projectRef, { branch? })`
60
60
  - `projects.sessions.create(projectRef, { branchName, name? })`
61
+ - `projects.agents.start(projectRef, { source, agentType, prompt, worker, requestId })`
62
+ - `agents.status/sendPrompt/merge/stop/finishMerge(...)`
61
63
  - `sessions.describe(sessionId)`
62
64
  - `sessions.update(sessionId, { name })`
63
65
  - `sessions.delete(sessionId)`
@@ -69,6 +71,10 @@ Trusted server-side callers that authenticate through custom headers, such as a
69
71
  - `sessions.answerQuestions(sessionId, { answers })`
70
72
  - `sessions.answerEnvRequest(sessionId, { envs?, additionalContext? })`
71
73
 
74
+ `agents.sendPrompt(...)` returns `promptDisposition: "queued" | "started"`, so callers can distinguish delivery to an active generation from a newly started generation. Agent commands never rebind a session to another worker implicitly.
75
+
76
+ `projects.agents.start(...)` requires `source: { type: "worktree", branchName }`. The source is the named branch worktree, including its committed and uncommitted files.
77
+
72
78
  ## Errors
73
79
 
74
80
  Non-2xx responses throw `R5dctlApiError` with:
@@ -302,22 +302,7 @@ class R5dctlClient {
302
302
  path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/agents`,
303
303
  body: input
304
304
  })
305
- },
306
- mergeChanges: (projectRef, input) => this.request({
307
- method: "POST",
308
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/merge-changes`,
309
- body: input
310
- }),
311
- continueMerge: (projectRef, input) => this.request({
312
- method: "POST",
313
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/continue-merge`,
314
- body: input
315
- }),
316
- abortMerge: (projectRef, input) => this.request({
317
- method: "POST",
318
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/abort-merge`,
319
- body: input
320
- })
305
+ }
321
306
  };
322
307
  agents = {
323
308
  status: (sessionId) => this.request({
@@ -328,6 +313,20 @@ class R5dctlClient {
328
313
  method: "POST",
329
314
  path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/prompt`,
330
315
  body: input
316
+ }),
317
+ merge: (sessionId, input) => this.request({
318
+ method: "POST",
319
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/merge`,
320
+ body: input
321
+ }),
322
+ stop: (sessionId) => this.request({
323
+ method: "POST",
324
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/stop`
325
+ }),
326
+ finishMerge: (sessionId, input) => this.request({
327
+ method: "POST",
328
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/finish-merge`,
329
+ body: input
331
330
  })
332
331
  };
333
332
  sessions = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "type": "commonjs"
5
5
  }
@@ -278,22 +278,7 @@ class R5dctlClient {
278
278
  path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/agents`,
279
279
  body: input
280
280
  })
281
- },
282
- mergeChanges: (projectRef, input) => this.request({
283
- method: "POST",
284
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/merge-changes`,
285
- body: input
286
- }),
287
- continueMerge: (projectRef, input) => this.request({
288
- method: "POST",
289
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/continue-merge`,
290
- body: input
291
- }),
292
- abortMerge: (projectRef, input) => this.request({
293
- method: "POST",
294
- path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/abort-merge`,
295
- body: input
296
- })
281
+ }
297
282
  };
298
283
  agents = {
299
284
  status: (sessionId) => this.request({
@@ -304,6 +289,20 @@ class R5dctlClient {
304
289
  method: "POST",
305
290
  path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/prompt`,
306
291
  body: input
292
+ }),
293
+ merge: (sessionId, input) => this.request({
294
+ method: "POST",
295
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/merge`,
296
+ body: input
297
+ }),
298
+ stop: (sessionId) => this.request({
299
+ method: "POST",
300
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/stop`
301
+ }),
302
+ finishMerge: (sessionId, input) => this.request({
303
+ method: "POST",
304
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/finish-merge`,
305
+ body: input
307
306
  })
308
307
  };
309
308
  sessions = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "type": "module"
5
5
  }
@@ -1,6 +1,10 @@
1
1
  export type ChatMode = "ask" | "plan" | "build" | "agent" | "explore" | "test" | "research" | "security_review" | "large_diff_remediation" | "merge_conflict_resolution";
2
2
  export type ModelTier = "low" | "medium" | "high" | "max";
3
3
  export type R5dctlAgentType = "research" | "debug" | "test";
4
+ export type R5dctlAgentSource = {
5
+ type: "worktree";
6
+ branchName: string;
7
+ };
4
8
  export type R5dctlProject = {
5
9
  id: string;
6
10
  namespace: string;
@@ -94,53 +98,50 @@ export type R5dctlConversationWorkResponse = {
94
98
  detail: R5dctlConversationWorkDetail;
95
99
  workText: string;
96
100
  };
97
- export type R5dctlAgentStartResponse = {
98
- sessionId: string;
99
- branchName: string;
100
- baseBranch: string;
101
- baseCommit: string;
102
- status: "running";
101
+ export type R5dctlAgentRunStatus = "provisioning" | "queued" | "running" | "completed" | "failed" | "stopped";
102
+ export type R5dctlAgentMergeStatus = {
103
+ status: "merged" | "up_to_date" | "conflicts" | "resolving" | "failed" | "stale";
104
+ attemptId?: string;
105
+ sourceBranch: string;
106
+ targetBranch: string;
107
+ commitHash?: string;
108
+ resolverSessionId?: string;
109
+ resolverBranch?: string;
110
+ folderPath?: string;
111
+ worker?: string;
112
+ conflictedFiles?: string[];
113
+ failureReason?: string;
114
+ message?: string;
103
115
  };
104
116
  export type R5dctlAgentStatusResponse = {
105
117
  sessionId: string;
106
118
  branchName: string;
107
- baseBranch: string | null;
108
- baseCommit: string | null;
109
- status: "running" | "completed" | "failed";
110
- startedAt: string;
119
+ source: R5dctlAgentSource;
120
+ baselineCommit: string | null;
121
+ workspaceHead: string | null;
122
+ worker: string;
123
+ status: R5dctlAgentRunStatus;
124
+ runStatus: R5dctlAgentRunStatus;
125
+ kind: R5dctlAgentType;
126
+ createdAt: string;
111
127
  updatedAt: string;
128
+ queuedAt?: string;
129
+ startedAt?: string;
112
130
  completedAt?: string;
113
131
  failedAt?: string;
132
+ stoppedAt?: string;
114
133
  error?: string;
115
- headCommit: string;
134
+ headCommit: string | null;
135
+ headCommitError?: string;
116
136
  summary: string;
117
137
  diffSummary: string;
138
+ sessionPath: string;
139
+ sessionUrl?: string;
140
+ merge?: R5dctlAgentMergeStatus;
118
141
  };
119
- export type R5dctlMergeResult = {
120
- type: "merge_branch";
121
- status: "merged";
122
- sourceBranch: string;
123
- targetBranch: string;
124
- commitHash: string;
125
- message: string;
126
- } | {
127
- type: "merge_branch";
128
- status: "conflicts";
129
- sourceBranch: string;
130
- targetBranch: string;
131
- conflictedFiles: string[];
132
- message: string;
133
- };
134
- export type R5dctlContinueMergeResult = {
135
- type: "continue_merge";
136
- status: "committed";
137
- commitHash: string;
138
- message: string;
139
- };
140
- export type R5dctlAbortMergeResult = {
141
- type: "abort_merge";
142
- status: "aborted";
143
- message: string;
142
+ export type R5dctlAgentStartResponse = R5dctlAgentStatusResponse;
143
+ export type R5dctlAgentPromptResponse = R5dctlAgentStatusResponse & {
144
+ promptDisposition: "queued" | "started";
144
145
  };
145
146
  export type DeviceAuthorizationStartResponse = {
146
147
  requestId: string;
@@ -215,11 +216,14 @@ export type R5dctlWorkspaceSyncResult = {
215
216
  toolCallId?: string;
216
217
  projectId?: string;
217
218
  branchName?: string;
219
+ canonicalCheckoutOnly?: boolean;
218
220
  detail?: string;
219
221
  };
220
- outcome: "no_change" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "conflict_blocked" | "reset" | "failed";
222
+ outcome: "no_change" | "candidate_ready" | "published" | "updated" | "conflict_reset" | "large_diff_blocked" | "conflict_blocked" | "reset" | "failed";
221
223
  startingHead: string | null;
224
+ expectedHead?: string | null;
222
225
  candidateHead?: string;
226
+ quarantineRef?: string;
223
227
  publishedHead?: string;
224
228
  rebaseCount: number;
225
229
  diffSizeBytes: number;
@@ -228,24 +232,54 @@ export type R5dctlWorkspaceSyncResult = {
228
232
  affectedPaths: string[];
229
233
  discardedPaths: string[];
230
234
  localChangesDiscarded: boolean;
235
+ dirtyGeneration?: number;
236
+ sampledCanonicalCheckoutTreeHash?: string;
231
237
  telemetry?: {
232
238
  totalMs: number;
233
239
  queueMs: number;
234
240
  prepareMs: number;
235
241
  synchronizeMs: number;
236
- fastPath: {
237
- hit: boolean;
238
- reason: string;
239
- proofAgeMs?: number;
240
- };
241
242
  };
242
243
  error?: string;
243
244
  };
244
245
  export type R5dctlWorkspaceStatus = {
245
246
  head: string | null;
246
247
  latestSync: R5dctlWorkspaceSyncResult | null;
248
+ workers: Array<{
249
+ workerLabel: string;
250
+ ready: boolean;
251
+ manifestRevision: string | null;
252
+ pendingCheckouts: Array<{
253
+ projectId: string;
254
+ branchName: string;
255
+ }>;
256
+ localHead: string | null;
257
+ desiredCanonicalHead: string | null;
258
+ dirtyGeneration: number;
259
+ publishedGeneration: number;
260
+ publicationState: "idle" | "scheduled" | "preparing" | "submitting" | "blocked";
261
+ casRetries: number;
262
+ lastNotifiedHead: string | null;
263
+ lastNotifiedAt: string | null;
264
+ fanoutLag: boolean;
265
+ fanoutLagMs: number | null;
266
+ }>;
267
+ materialization: {
268
+ desiredHead: string | null;
269
+ materializedHead: string | null;
270
+ state: "idle" | "pending" | "running" | "failed";
271
+ retryCount: number;
272
+ nextRetryAt: string | null;
273
+ lastError: string | null;
274
+ startedAt: string | null;
275
+ completedAt: string | null;
276
+ updatedAt: string;
277
+ lag: boolean;
278
+ lagMs: number;
279
+ } | null;
247
280
  incident: {
248
281
  id: string;
282
+ kind: "large_diff" | "sync_conflict";
249
283
  originWorkerLabel: string;
250
284
  remediationSessionId: string;
251
285
  status: "remediating" | "waiting_for_worker";
@@ -504,26 +538,27 @@ export declare class R5dctlClient {
504
538
  };
505
539
  agents: {
506
540
  start: (projectRef: string, input: {
507
- sourceBranch: string;
541
+ source: R5dctlAgentSource;
508
542
  agentType: R5dctlAgentType;
509
543
  prompt: string;
510
- }) => Promise<R5dctlAgentStartResponse>;
544
+ worker: string;
545
+ requestId: string;
546
+ }) => Promise<R5dctlAgentStatusResponse>;
511
547
  };
512
- mergeChanges: (projectRef: string, input: {
513
- targetBranch: string;
514
- sourceBranch: string;
515
- }) => Promise<R5dctlMergeResult>;
516
- continueMerge: (projectRef: string, input: {
517
- targetBranch: string;
518
- }) => Promise<R5dctlContinueMergeResult>;
519
- abortMerge: (projectRef: string, input: {
520
- targetBranch: string;
521
- }) => Promise<R5dctlAbortMergeResult>;
522
548
  };
523
549
  readonly agents: {
524
550
  status: (sessionId: string) => Promise<R5dctlAgentStatusResponse>;
525
551
  sendPrompt: (sessionId: string, input: {
526
552
  prompt: string;
553
+ worker: string;
554
+ }) => Promise<R5dctlAgentPromptResponse>;
555
+ merge: (sessionId: string, input: {
556
+ worker: string;
557
+ }) => Promise<R5dctlAgentStatusResponse>;
558
+ stop: (sessionId: string) => Promise<R5dctlAgentStatusResponse>;
559
+ finishMerge: (sessionId: string, input: {
560
+ worker: string;
561
+ summary: string;
527
562
  }) => Promise<R5dctlAgentStatusResponse>;
528
563
  };
529
564
  readonly sessions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.58",
3
+ "version": "0.0.60",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/mjs/index.mjs",