@ricsam/r5d-api 0.0.5 → 0.0.7

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
@@ -11,12 +11,12 @@ npm install @ricsam/r5d-api
11
11
  ## Usage
12
12
 
13
13
  ```ts
14
- import { BinctlClient } from "@ricsam/r5d-api";
14
+ import { R5dctlClient } from "@ricsam/r5d-api";
15
15
 
16
- const client = new BinctlClient({
16
+ const client = new R5dctlClient({
17
17
  baseUrl: "https://r5d.dev",
18
- token: process.env.BINCTL_TOKEN,
19
- // or apiKey: process.env.BINCTL_API_KEY
18
+ token: process.env.R5DCTL_TOKEN,
19
+ // or apiKey: process.env.R5DCTL_API_KEY
20
20
  });
21
21
 
22
22
  const projects = await client.projects.list();
@@ -25,9 +25,9 @@ console.log(projects);
25
25
 
26
26
  ## Auth
27
27
 
28
- `BinctlClient` supports:
29
- - interactive token (`bin_tok_*`)
30
- - API key (`bin_key_*`)
28
+ `R5dctlClient` supports:
29
+ - interactive token (`r5dctl_tok_*`)
30
+ - API key (`r5dctl_key_*`)
31
31
 
32
32
  Set either `token` or `apiKey` in client options, or later via:
33
33
  - `client.setToken(...)`
@@ -60,7 +60,7 @@ Trusted server-side callers that authenticate through custom headers, such as a
60
60
 
61
61
  ## Errors
62
62
 
63
- Non-2xx responses throw `BinctlApiError` with:
63
+ Non-2xx responses throw `R5dctlApiError` with:
64
64
  - `status`
65
65
  - `path`
66
66
  - `body`
@@ -18,17 +18,17 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var index_exports = {};
20
20
  __export(index_exports, {
21
- BinctlApiError: () => BinctlApiError,
22
- BinctlClient: () => BinctlClient
21
+ R5dctlApiError: () => R5dctlApiError,
22
+ R5dctlClient: () => R5dctlClient
23
23
  });
24
24
  module.exports = __toCommonJS(index_exports);
25
- class BinctlApiError extends Error {
25
+ class R5dctlApiError extends Error {
26
26
  status;
27
27
  path;
28
28
  body;
29
29
  constructor(message, input) {
30
30
  super(message);
31
- this.name = "BinctlApiError";
31
+ this.name = "R5dctlApiError";
32
32
  this.status = input.status;
33
33
  this.path = input.path;
34
34
  this.body = input.body;
@@ -49,7 +49,7 @@ function withQuery(path, query) {
49
49
  const queryString = params.toString();
50
50
  return queryString.length > 0 ? `${path}?${queryString}` : path;
51
51
  }
52
- class BinctlClient {
52
+ class R5dctlClient {
53
53
  fetchImpl;
54
54
  baseUrl;
55
55
  token;
@@ -86,7 +86,7 @@ class BinctlClient {
86
86
  if (authMode === "auto") {
87
87
  if (!bearerToken) {
88
88
  if (this.authMode !== "headers") {
89
- throw new BinctlApiError("Authentication required. Set token or apiKey in BinctlClient.", {
89
+ throw new R5dctlApiError("Authentication required. Set token or apiKey in R5dctlClient.", {
90
90
  status: 401,
91
91
  path: input.path,
92
92
  body: { error: "Missing credentials" }
@@ -110,7 +110,7 @@ class BinctlClient {
110
110
  const payload = text.length > 0 ? safeJsonParse(text) : null;
111
111
  if (!response.ok) {
112
112
  const message = typeof payload === "object" && payload && "error" in payload && typeof payload.error === "string" ? payload.error : `Request failed (${response.status})`;
113
- throw new BinctlApiError(message, {
113
+ throw new R5dctlApiError(message, {
114
114
  status: response.status,
115
115
  path: pathWithQuery,
116
116
  body: payload
@@ -121,7 +121,7 @@ class BinctlClient {
121
121
  auth = {
122
122
  loginStart: (input) => this.request({
123
123
  method: "POST",
124
- path: "/api/binctl/auth/login/start",
124
+ path: "/api/r5dctl/auth/login/start",
125
125
  auth: "none",
126
126
  body: {
127
127
  baseUrl: input?.baseUrl
@@ -129,7 +129,7 @@ class BinctlClient {
129
129
  }),
130
130
  loginPoll: (requestId, input) => this.request({
131
131
  method: "GET",
132
- path: `/api/binctl/auth/login/poll/${encodeURIComponent(requestId)}`,
132
+ path: `/api/r5dctl/auth/login/poll/${encodeURIComponent(requestId)}`,
133
133
  auth: "none",
134
134
  query: {
135
135
  pollCode: input.pollCode
@@ -137,108 +137,136 @@ class BinctlClient {
137
137
  }),
138
138
  logout: () => this.request({
139
139
  method: "POST",
140
- path: "/api/binctl/auth/logout",
140
+ path: "/api/r5dctl/auth/logout",
141
141
  body: {}
142
142
  }),
143
143
  status: () => this.request({
144
144
  method: "GET",
145
- path: "/api/binctl/auth/status"
145
+ path: "/api/r5dctl/auth/status"
146
146
  }),
147
147
  apiKeys: {
148
148
  create: (input) => this.request({
149
149
  method: "POST",
150
- path: "/api/binctl/auth/api-keys",
150
+ path: "/api/r5dctl/auth/api-keys",
151
151
  body: input
152
152
  }),
153
153
  list: () => this.request({
154
154
  method: "GET",
155
- path: "/api/binctl/auth/api-keys"
155
+ path: "/api/r5dctl/auth/api-keys"
156
156
  }),
157
157
  revoke: (keyId) => this.request({
158
158
  method: "DELETE",
159
- path: `/api/binctl/auth/api-keys/${encodeURIComponent(keyId)}`
159
+ path: `/api/r5dctl/auth/api-keys/${encodeURIComponent(keyId)}`
160
160
  })
161
161
  }
162
162
  };
163
163
  projects = {
164
164
  list: () => this.request({
165
165
  method: "GET",
166
- path: "/api/binctl/projects"
167
- }),
168
- create: (input = {}) => this.request({
169
- method: "POST",
170
- path: "/api/binctl/projects",
171
- body: input
166
+ path: "/api/r5dctl/projects"
172
167
  }),
173
168
  describe: (projectRef) => this.request({
174
169
  method: "GET",
175
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`
170
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`
176
171
  }),
177
172
  update: (projectRef, input) => this.request({
178
173
  method: "PUT",
179
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`,
174
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`,
180
175
  body: input
181
176
  }),
182
177
  delete: (projectRef) => this.request({
183
178
  method: "DELETE",
184
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`
179
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`
185
180
  }),
186
181
  branches: {
187
182
  list: (projectRef) => this.request({
188
183
  method: "GET",
189
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/branches`
184
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/branches`
190
185
  }),
191
186
  describe: (projectRef, branch) => this.request({
192
187
  method: "GET",
193
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/branches/${encodeURIComponent(branch)}`
188
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/branches/${encodeURIComponent(branch)}`
194
189
  })
195
190
  },
196
191
  sessions: {
197
192
  list: (projectRef, input) => this.request({
198
193
  method: "GET",
199
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/sessions`,
194
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/sessions`,
200
195
  query: {
201
196
  branch: input?.branch
202
197
  }
203
198
  }),
204
199
  create: (projectRef, input) => this.request({
205
200
  method: "POST",
206
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/sessions`,
201
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/sessions`,
207
202
  body: input
208
203
  })
209
- }
204
+ },
205
+ agents: {
206
+ start: (projectRef, input) => this.request({
207
+ method: "POST",
208
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/agents`,
209
+ body: input
210
+ })
211
+ },
212
+ mergeChanges: (projectRef, input) => this.request({
213
+ method: "POST",
214
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/merge-changes`,
215
+ body: input
216
+ }),
217
+ continueMerge: (projectRef, input) => this.request({
218
+ method: "POST",
219
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/continue-merge`,
220
+ body: input
221
+ }),
222
+ abortMerge: (projectRef, input) => this.request({
223
+ method: "POST",
224
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/abort-merge`,
225
+ body: input
226
+ })
227
+ };
228
+ agents = {
229
+ status: (sessionId) => this.request({
230
+ method: "GET",
231
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}`
232
+ }),
233
+ sendPrompt: (sessionId, input) => this.request({
234
+ method: "POST",
235
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/prompt`,
236
+ body: input
237
+ })
210
238
  };
211
239
  sessions = {
212
240
  describe: (sessionId) => this.request({
213
241
  method: "GET",
214
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`
242
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`
215
243
  }),
216
244
  update: (sessionId, input) => this.request({
217
245
  method: "PUT",
218
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`,
246
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`,
219
247
  body: input
220
248
  }),
221
249
  delete: (sessionId) => this.request({
222
250
  method: "DELETE",
223
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`
251
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`
224
252
  }),
225
253
  conversation: (sessionId) => this.request({
226
254
  method: "GET",
227
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/conversation`
255
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/conversation`
228
256
  }),
229
257
  prompt: (sessionId, input) => this.request({
230
258
  method: "POST",
231
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/prompt`,
259
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/prompt`,
232
260
  body: input
233
261
  }),
234
262
  answerQuestions: (sessionId, input) => this.request({
235
263
  method: "POST",
236
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/answer-questions`,
264
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/answer-questions`,
237
265
  body: input
238
266
  }),
239
267
  applyRequiredEnvs: (sessionId, input) => this.request({
240
268
  method: "POST",
241
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/apply-required-envs`,
269
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/apply-required-envs`,
242
270
  body: input
243
271
  })
244
272
  };
@@ -252,6 +280,6 @@ function safeJsonParse(text) {
252
280
  }
253
281
  // Annotate the CommonJS export names for ESM import in node:
254
282
  0 && (module.exports = {
255
- BinctlApiError,
256
- BinctlClient
283
+ R5dctlApiError,
284
+ R5dctlClient
257
285
  });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "commonjs"
5
5
  }
@@ -1,10 +1,10 @@
1
- class BinctlApiError extends Error {
1
+ class R5dctlApiError extends Error {
2
2
  status;
3
3
  path;
4
4
  body;
5
5
  constructor(message, input) {
6
6
  super(message);
7
- this.name = "BinctlApiError";
7
+ this.name = "R5dctlApiError";
8
8
  this.status = input.status;
9
9
  this.path = input.path;
10
10
  this.body = input.body;
@@ -25,7 +25,7 @@ function withQuery(path, query) {
25
25
  const queryString = params.toString();
26
26
  return queryString.length > 0 ? `${path}?${queryString}` : path;
27
27
  }
28
- class BinctlClient {
28
+ class R5dctlClient {
29
29
  fetchImpl;
30
30
  baseUrl;
31
31
  token;
@@ -62,7 +62,7 @@ class BinctlClient {
62
62
  if (authMode === "auto") {
63
63
  if (!bearerToken) {
64
64
  if (this.authMode !== "headers") {
65
- throw new BinctlApiError("Authentication required. Set token or apiKey in BinctlClient.", {
65
+ throw new R5dctlApiError("Authentication required. Set token or apiKey in R5dctlClient.", {
66
66
  status: 401,
67
67
  path: input.path,
68
68
  body: { error: "Missing credentials" }
@@ -86,7 +86,7 @@ class BinctlClient {
86
86
  const payload = text.length > 0 ? safeJsonParse(text) : null;
87
87
  if (!response.ok) {
88
88
  const message = typeof payload === "object" && payload && "error" in payload && typeof payload.error === "string" ? payload.error : `Request failed (${response.status})`;
89
- throw new BinctlApiError(message, {
89
+ throw new R5dctlApiError(message, {
90
90
  status: response.status,
91
91
  path: pathWithQuery,
92
92
  body: payload
@@ -97,7 +97,7 @@ class BinctlClient {
97
97
  auth = {
98
98
  loginStart: (input) => this.request({
99
99
  method: "POST",
100
- path: "/api/binctl/auth/login/start",
100
+ path: "/api/r5dctl/auth/login/start",
101
101
  auth: "none",
102
102
  body: {
103
103
  baseUrl: input?.baseUrl
@@ -105,7 +105,7 @@ class BinctlClient {
105
105
  }),
106
106
  loginPoll: (requestId, input) => this.request({
107
107
  method: "GET",
108
- path: `/api/binctl/auth/login/poll/${encodeURIComponent(requestId)}`,
108
+ path: `/api/r5dctl/auth/login/poll/${encodeURIComponent(requestId)}`,
109
109
  auth: "none",
110
110
  query: {
111
111
  pollCode: input.pollCode
@@ -113,108 +113,136 @@ class BinctlClient {
113
113
  }),
114
114
  logout: () => this.request({
115
115
  method: "POST",
116
- path: "/api/binctl/auth/logout",
116
+ path: "/api/r5dctl/auth/logout",
117
117
  body: {}
118
118
  }),
119
119
  status: () => this.request({
120
120
  method: "GET",
121
- path: "/api/binctl/auth/status"
121
+ path: "/api/r5dctl/auth/status"
122
122
  }),
123
123
  apiKeys: {
124
124
  create: (input) => this.request({
125
125
  method: "POST",
126
- path: "/api/binctl/auth/api-keys",
126
+ path: "/api/r5dctl/auth/api-keys",
127
127
  body: input
128
128
  }),
129
129
  list: () => this.request({
130
130
  method: "GET",
131
- path: "/api/binctl/auth/api-keys"
131
+ path: "/api/r5dctl/auth/api-keys"
132
132
  }),
133
133
  revoke: (keyId) => this.request({
134
134
  method: "DELETE",
135
- path: `/api/binctl/auth/api-keys/${encodeURIComponent(keyId)}`
135
+ path: `/api/r5dctl/auth/api-keys/${encodeURIComponent(keyId)}`
136
136
  })
137
137
  }
138
138
  };
139
139
  projects = {
140
140
  list: () => this.request({
141
141
  method: "GET",
142
- path: "/api/binctl/projects"
143
- }),
144
- create: (input = {}) => this.request({
145
- method: "POST",
146
- path: "/api/binctl/projects",
147
- body: input
142
+ path: "/api/r5dctl/projects"
148
143
  }),
149
144
  describe: (projectRef) => this.request({
150
145
  method: "GET",
151
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`
146
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`
152
147
  }),
153
148
  update: (projectRef, input) => this.request({
154
149
  method: "PUT",
155
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`,
150
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`,
156
151
  body: input
157
152
  }),
158
153
  delete: (projectRef) => this.request({
159
154
  method: "DELETE",
160
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}`
155
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}`
161
156
  }),
162
157
  branches: {
163
158
  list: (projectRef) => this.request({
164
159
  method: "GET",
165
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/branches`
160
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/branches`
166
161
  }),
167
162
  describe: (projectRef, branch) => this.request({
168
163
  method: "GET",
169
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/branches/${encodeURIComponent(branch)}`
164
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/branches/${encodeURIComponent(branch)}`
170
165
  })
171
166
  },
172
167
  sessions: {
173
168
  list: (projectRef, input) => this.request({
174
169
  method: "GET",
175
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/sessions`,
170
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/sessions`,
176
171
  query: {
177
172
  branch: input?.branch
178
173
  }
179
174
  }),
180
175
  create: (projectRef, input) => this.request({
181
176
  method: "POST",
182
- path: `/api/binctl/projects/${encodeURIComponent(projectRef)}/sessions`,
177
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/sessions`,
183
178
  body: input
184
179
  })
185
- }
180
+ },
181
+ agents: {
182
+ start: (projectRef, input) => this.request({
183
+ method: "POST",
184
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/agents`,
185
+ body: input
186
+ })
187
+ },
188
+ mergeChanges: (projectRef, input) => this.request({
189
+ method: "POST",
190
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/merge-changes`,
191
+ body: input
192
+ }),
193
+ continueMerge: (projectRef, input) => this.request({
194
+ method: "POST",
195
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/continue-merge`,
196
+ body: input
197
+ }),
198
+ abortMerge: (projectRef, input) => this.request({
199
+ method: "POST",
200
+ path: `/api/r5dctl/projects/${encodeURIComponent(projectRef)}/abort-merge`,
201
+ body: input
202
+ })
203
+ };
204
+ agents = {
205
+ status: (sessionId) => this.request({
206
+ method: "GET",
207
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}`
208
+ }),
209
+ sendPrompt: (sessionId, input) => this.request({
210
+ method: "POST",
211
+ path: `/api/r5dctl/agents/${encodeURIComponent(sessionId)}/prompt`,
212
+ body: input
213
+ })
186
214
  };
187
215
  sessions = {
188
216
  describe: (sessionId) => this.request({
189
217
  method: "GET",
190
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`
218
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`
191
219
  }),
192
220
  update: (sessionId, input) => this.request({
193
221
  method: "PUT",
194
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`,
222
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`,
195
223
  body: input
196
224
  }),
197
225
  delete: (sessionId) => this.request({
198
226
  method: "DELETE",
199
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}`
227
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}`
200
228
  }),
201
229
  conversation: (sessionId) => this.request({
202
230
  method: "GET",
203
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/conversation`
231
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/conversation`
204
232
  }),
205
233
  prompt: (sessionId, input) => this.request({
206
234
  method: "POST",
207
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/prompt`,
235
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/prompt`,
208
236
  body: input
209
237
  }),
210
238
  answerQuestions: (sessionId, input) => this.request({
211
239
  method: "POST",
212
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/answer-questions`,
240
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/answer-questions`,
213
241
  body: input
214
242
  }),
215
243
  applyRequiredEnvs: (sessionId, input) => this.request({
216
244
  method: "POST",
217
- path: `/api/binctl/sessions/${encodeURIComponent(sessionId)}/apply-required-envs`,
245
+ path: `/api/r5dctl/sessions/${encodeURIComponent(sessionId)}/apply-required-envs`,
218
246
  body: input
219
247
  })
220
248
  };
@@ -227,6 +255,6 @@ function safeJsonParse(text) {
227
255
  }
228
256
  }
229
257
  export {
230
- BinctlApiError,
231
- BinctlClient
258
+ R5dctlApiError,
259
+ R5dctlClient
232
260
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module"
5
5
  }
@@ -1,33 +1,35 @@
1
- export type ChatMode = "ask" | "plan" | "build" | "agent" | "explore" | "review" | "test" | "research";
1
+ export type ChatMode = "ask" | "plan" | "build" | "agent" | "explore" | "review" | "test" | "research" | "security_review" | "large_diff_remediation";
2
2
  export type ModelTier = "low" | "medium" | "high" | "max";
3
- export type BinctlProject = {
3
+ export type R5dctlAgentType = "research" | "debug" | "test";
4
+ export type R5dctlProject = {
4
5
  id: string;
5
- slug: string | null;
6
- name: string | null;
6
+ namespace: string;
7
+ name: string;
8
+ path: string;
7
9
  mode: "greenfield" | "prod";
8
10
  createdAt: string;
9
11
  updatedAt: string;
10
12
  };
11
- export type BinctlProjectDescription = BinctlProject & {
13
+ export type R5dctlProjectDescription = R5dctlProject & {
12
14
  orgId: string | null;
13
15
  };
14
- export type BinctlBranch = {
16
+ export type R5dctlBranch = {
15
17
  branchName: string;
16
18
  sessionCount: number;
17
19
  lastSessionAt: string | null;
18
20
  };
19
- export type BinctlSessionSummary = {
21
+ export type R5dctlSessionSummary = {
20
22
  id: string;
21
23
  name: string | null;
22
24
  branchName: string;
23
25
  createdAt: string;
24
26
  updatedAt: string;
25
27
  };
26
- export type BinctlSessionDescription = {
28
+ export type R5dctlSessionDescription = {
27
29
  id: string;
28
30
  projectId: string;
29
- projectSlug: string | null;
30
- projectName: string | null;
31
+ projectPath: string;
32
+ projectName: string;
31
33
  branchName: string;
32
34
  name: string | null;
33
35
  fixedMode?: ChatMode | null;
@@ -35,39 +37,87 @@ export type BinctlSessionDescription = {
35
37
  createdAt: string;
36
38
  updatedAt: string;
37
39
  };
38
- export type BinctlPendingQuestionOption = {
40
+ export type R5dctlPendingQuestionOption = {
39
41
  id: string;
40
42
  label: string;
41
43
  description?: string;
42
44
  };
43
- export type BinctlPendingQuestion = {
45
+ export type R5dctlPendingQuestion = {
44
46
  id: string;
45
47
  question: string;
46
48
  allowMultiple?: boolean;
47
- options: BinctlPendingQuestionOption[];
49
+ options: R5dctlPendingQuestionOption[];
48
50
  };
49
- export type BinctlRequiredEnv = {
51
+ export type R5dctlRequiredEnv = {
50
52
  target: "backend" | "frontend";
51
53
  name: string;
52
54
  optional: boolean;
53
55
  generateScript?: string;
54
56
  description: string;
55
57
  };
56
- export type BinctlConversationResponse = {
57
- session: BinctlSessionDescription;
58
+ export type R5dctlConversationResponse = {
59
+ session: R5dctlSessionDescription;
58
60
  conversation: unknown;
59
61
  thread: unknown[];
60
- pendingQuestions: BinctlPendingQuestion[];
61
- requiredEnvs: BinctlRequiredEnv[];
62
+ pendingQuestions: R5dctlPendingQuestion[];
63
+ requiredEnvs: R5dctlRequiredEnv[];
64
+ };
65
+ export type R5dctlAgentStartResponse = {
66
+ sessionId: string;
67
+ branchName: string;
68
+ baseBranch: string;
69
+ baseCommit: string;
70
+ status: "running";
71
+ };
72
+ export type R5dctlAgentStatusResponse = {
73
+ sessionId: string;
74
+ branchName: string;
75
+ baseBranch: string | null;
76
+ baseCommit: string | null;
77
+ status: "running" | "completed" | "failed";
78
+ startedAt: string;
79
+ updatedAt: string;
80
+ completedAt?: string;
81
+ failedAt?: string;
82
+ error?: string;
83
+ headCommit: string;
84
+ summary: string;
85
+ diffSummary: string;
86
+ };
87
+ export type R5dctlMergeResult = {
88
+ type: "merge_branch";
89
+ status: "merged";
90
+ sourceBranch: string;
91
+ targetBranch: string;
92
+ commitHash: string;
93
+ message: string;
94
+ } | {
95
+ type: "merge_branch";
96
+ status: "conflicts";
97
+ sourceBranch: string;
98
+ targetBranch: string;
99
+ conflictedFiles: string[];
100
+ message: string;
101
+ };
102
+ export type R5dctlContinueMergeResult = {
103
+ type: "continue_merge";
104
+ status: "committed";
105
+ commitHash: string;
106
+ message: string;
62
107
  };
63
- export type BinctlLoginStartResponse = {
108
+ export type R5dctlAbortMergeResult = {
109
+ type: "abort_merge";
110
+ status: "aborted";
111
+ message: string;
112
+ };
113
+ export type R5dctlLoginStartResponse = {
64
114
  requestId: string;
65
115
  pollCode: string;
66
116
  loginUrl: string;
67
117
  expiresAt: string;
68
118
  intervalMs: number;
69
119
  };
70
- export type BinctlLoginPollResponse = {
120
+ export type R5dctlLoginPollResponse = {
71
121
  status: "pending";
72
122
  expiresAt: string;
73
123
  intervalMs: number;
@@ -78,37 +128,32 @@ export type BinctlLoginPollResponse = {
78
128
  } | {
79
129
  status: "expired" | "consumed";
80
130
  };
81
- export type BinctlAuthStatusResponse = {
131
+ export type R5dctlAuthStatusResponse = {
82
132
  authenticated: true;
83
- source: "session" | "binctl";
133
+ source: "session" | "r5dctl";
84
134
  user: {
85
135
  id: string;
86
136
  email: string;
87
137
  name: string | null;
88
138
  };
89
139
  };
90
- export type BinctlApiKey = {
140
+ export type R5dctlApiKey = {
91
141
  id: string;
92
142
  name: string;
93
143
  createdAt: string;
94
144
  lastUsedAt: string | null;
95
145
  };
96
- export type BinctlProjectCreateInput = {
97
- name?: string;
98
- orgId?: string;
99
- };
100
- export type BinctlProjectUpdateInput = {
101
- name?: string;
146
+ export type R5dctlProjectUpdateInput = {
102
147
  mode?: "greenfield" | "prod";
103
148
  };
104
- export type BinctlSessionCreateInput = {
149
+ export type R5dctlSessionCreateInput = {
105
150
  name?: string;
106
151
  branchName: string;
107
152
  };
108
- export type BinctlSessionUpdateInput = {
153
+ export type R5dctlSessionUpdateInput = {
109
154
  name: string | null;
110
155
  };
111
- export type BinctlClientOptions = {
156
+ export type R5dctlClientOptions = {
112
157
  baseUrl?: string;
113
158
  token?: string;
114
159
  apiKey?: string;
@@ -116,7 +161,7 @@ export type BinctlClientOptions = {
116
161
  headers?: Record<string, string>;
117
162
  authMode?: "bearer" | "headers";
118
163
  };
119
- export declare class BinctlApiError extends Error {
164
+ export declare class R5dctlApiError extends Error {
120
165
  readonly status: number;
121
166
  readonly path: string;
122
167
  readonly body: unknown;
@@ -126,14 +171,14 @@ export declare class BinctlApiError extends Error {
126
171
  body: unknown;
127
172
  });
128
173
  }
129
- export declare class BinctlClient {
174
+ export declare class R5dctlClient {
130
175
  private readonly fetchImpl;
131
176
  private baseUrl;
132
177
  private token?;
133
178
  private apiKey?;
134
179
  private readonly extraHeaders;
135
180
  private readonly authMode;
136
- constructor(options?: BinctlClientOptions);
181
+ constructor(options?: R5dctlClientOptions);
137
182
  setBaseUrl(baseUrl: string): void;
138
183
  setToken(token?: string): void;
139
184
  setApiKey(apiKey?: string): void;
@@ -142,15 +187,15 @@ export declare class BinctlClient {
142
187
  readonly auth: {
143
188
  loginStart: (input?: {
144
189
  baseUrl?: string;
145
- }) => Promise<BinctlLoginStartResponse>;
190
+ }) => Promise<R5dctlLoginStartResponse>;
146
191
  loginPoll: (requestId: string, input: {
147
192
  pollCode: string;
148
- }) => Promise<BinctlLoginPollResponse>;
193
+ }) => Promise<R5dctlLoginPollResponse>;
149
194
  logout: () => Promise<{
150
195
  success: boolean;
151
196
  revokedCredential: boolean;
152
197
  }>;
153
- status: () => Promise<BinctlAuthStatusResponse>;
198
+ status: () => Promise<R5dctlAuthStatusResponse>;
154
199
  apiKeys: {
155
200
  create: (input: {
156
201
  name: string;
@@ -160,52 +205,74 @@ export declare class BinctlClient {
160
205
  name: string;
161
206
  createdAt: string;
162
207
  }>;
163
- list: () => Promise<BinctlApiKey[]>;
208
+ list: () => Promise<R5dctlApiKey[]>;
164
209
  revoke: (keyId: string) => Promise<{
165
210
  success: boolean;
166
211
  }>;
167
212
  };
168
213
  };
169
214
  readonly projects: {
170
- list: () => Promise<BinctlProject[]>;
171
- create: (input?: BinctlProjectCreateInput) => Promise<BinctlProjectDescription>;
172
- describe: (projectRef: string) => Promise<BinctlProjectDescription>;
173
- update: (projectRef: string, input: BinctlProjectUpdateInput) => Promise<BinctlProjectDescription>;
215
+ list: () => Promise<R5dctlProject[]>;
216
+ describe: (projectRef: string) => Promise<R5dctlProjectDescription>;
217
+ update: (projectRef: string, input: R5dctlProjectUpdateInput) => Promise<R5dctlProjectDescription>;
174
218
  delete: (projectRef: string) => Promise<{
175
219
  success: boolean;
176
220
  }>;
177
221
  branches: {
178
- list: (projectRef: string) => Promise<BinctlBranch[]>;
222
+ list: (projectRef: string) => Promise<R5dctlBranch[]>;
179
223
  describe: (projectRef: string, branch: string) => Promise<{
180
- project: BinctlProject;
224
+ project: R5dctlProject;
181
225
  branchName: string;
182
- sessions: BinctlSessionSummary[];
226
+ sessions: R5dctlSessionSummary[];
183
227
  }>;
184
228
  };
185
229
  sessions: {
186
230
  list: (projectRef: string, input?: {
187
231
  branch?: string;
188
- }) => Promise<BinctlSessionSummary[]>;
189
- create: (projectRef: string, input: BinctlSessionCreateInput) => Promise<BinctlSessionDescription>;
232
+ }) => Promise<R5dctlSessionSummary[]>;
233
+ create: (projectRef: string, input: R5dctlSessionCreateInput) => Promise<R5dctlSessionDescription>;
190
234
  };
235
+ agents: {
236
+ start: (projectRef: string, input: {
237
+ sourceBranch: string;
238
+ agentType: R5dctlAgentType;
239
+ prompt: string;
240
+ }) => Promise<R5dctlAgentStartResponse>;
241
+ };
242
+ mergeChanges: (projectRef: string, input: {
243
+ targetBranch: string;
244
+ sourceBranch: string;
245
+ }) => Promise<R5dctlMergeResult>;
246
+ continueMerge: (projectRef: string, input: {
247
+ targetBranch: string;
248
+ }) => Promise<R5dctlContinueMergeResult>;
249
+ abortMerge: (projectRef: string, input: {
250
+ targetBranch: string;
251
+ }) => Promise<R5dctlAbortMergeResult>;
252
+ };
253
+ readonly agents: {
254
+ status: (sessionId: string) => Promise<R5dctlAgentStatusResponse>;
255
+ sendPrompt: (sessionId: string, input: {
256
+ prompt: string;
257
+ }) => Promise<R5dctlAgentStatusResponse>;
191
258
  };
192
259
  readonly sessions: {
193
- describe: (sessionId: string) => Promise<BinctlSessionDescription>;
194
- update: (sessionId: string, input: BinctlSessionUpdateInput) => Promise<BinctlSessionDescription>;
260
+ describe: (sessionId: string) => Promise<R5dctlSessionDescription>;
261
+ update: (sessionId: string, input: R5dctlSessionUpdateInput) => Promise<R5dctlSessionDescription>;
195
262
  delete: (sessionId: string) => Promise<{
196
263
  success: boolean;
197
264
  }>;
198
- conversation: (sessionId: string) => Promise<BinctlConversationResponse>;
265
+ conversation: (sessionId: string) => Promise<R5dctlConversationResponse>;
199
266
  prompt: (sessionId: string, input: {
200
267
  message: string;
201
268
  mode: ChatMode;
202
269
  model: ModelTier;
203
- }) => Promise<BinctlConversationResponse>;
270
+ }) => Promise<R5dctlConversationResponse>;
204
271
  answerQuestions: (sessionId: string, input: {
205
272
  answers: string[];
206
- }) => Promise<BinctlConversationResponse>;
273
+ }) => Promise<R5dctlConversationResponse>;
207
274
  applyRequiredEnvs: (sessionId: string, input: {
208
275
  envs: string[];
209
- }) => Promise<BinctlConversationResponse>;
276
+ }) => Promise<R5dctlConversationResponse>;
210
277
  };
211
278
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-api",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "main": "./dist/cjs/index.cjs",
6
6
  "module": "./dist/mjs/index.mjs",
@@ -15,7 +15,7 @@
15
15
  "repository": {
16
16
  "type": "git",
17
17
  "url": "git+https://github.com/ricsam/r5d-dev.git",
18
- "directory": "binctl-packages/binctl-api"
18
+ "directory": "packages/r5d-api"
19
19
  },
20
20
  "files": [
21
21
  "dist",