kradle 0.4.0 → 0.4.2

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.
@@ -25,16 +25,16 @@ export default class Run extends Command {
25
25
  async run() {
26
26
  const { args, flags } = await this.parse(Run);
27
27
  const apiUrl = flags.studio ? flags["studio-api-url"] : flags["api-url"];
28
- const studioApi = new ApiClient(apiUrl, flags["api-key"], flags.studio);
28
+ const studioApi = new ApiClient(apiUrl, flags["api-key"]);
29
29
  const challengeSlug = args.challengeSlug;
30
30
  try {
31
31
  const { participants } = (await loadTemplateRun());
32
- const template = {
32
+ this.log(pc.blue(`>> Running challenge: ${challengeSlug}${flags.studio ? " (studio)" : ""}...`));
33
+ const response = await studioApi.runChallenge({
33
34
  challenge: challengeSlug,
34
35
  participants,
35
- };
36
- this.log(pc.blue(`>> Running challenge: ${challengeSlug}${flags.studio ? " (studio)" : ""}...`));
37
- const response = await studioApi.runChallenge(template);
36
+ jobType: "foreground",
37
+ });
38
38
  if (response.runIds && response.runIds.length > 0) {
39
39
  const baseUrl = flags.studio ? flags["studio-url"] : flags["web-url"];
40
40
  const runUrl = `${baseUrl}/runs/${response.runIds[0]}`;
@@ -3,8 +3,7 @@ import { type AgentSchemaType, type ChallengeConfigSchemaType, type ChallengeSch
3
3
  export declare class ApiClient {
4
4
  private apiUrl;
5
5
  private kradleApiKey;
6
- private isStudio;
7
- constructor(apiUrl: string, kradleApiKey: string, isStudio?: boolean);
6
+ constructor(apiUrl: string, kradleApiKey: string);
8
7
  private request;
9
8
  private get;
10
9
  private post;
@@ -76,6 +75,7 @@ export declare class ApiClient {
76
75
  runChallenge(runData: {
77
76
  challenge: string;
78
77
  participants: unknown[];
78
+ jobType: "background" | "foreground";
79
79
  }): Promise<{
80
80
  runIds?: string[] | undefined;
81
81
  participants?: Record<string, {
@@ -25,11 +25,9 @@ const DEFAULT_CHALLENGE_SCHEMA = {
25
25
  export class ApiClient {
26
26
  apiUrl;
27
27
  kradleApiKey;
28
- isStudio;
29
- constructor(apiUrl, kradleApiKey, isStudio = false) {
28
+ constructor(apiUrl, kradleApiKey) {
30
29
  this.apiUrl = apiUrl;
31
30
  this.kradleApiKey = kradleApiKey;
32
- this.isStudio = isStudio;
33
31
  }
34
32
  async request(endpoint, options) {
35
33
  const fullUrl = `${this.apiUrl}/${endpoint}`;
@@ -225,9 +223,8 @@ export class ApiClient {
225
223
  }
226
224
  async runChallenge(runData) {
227
225
  const url = "jobs";
228
- const payload = this.isStudio ? runData : { ...runData, jobType: "background" };
229
226
  return this.post(url, {
230
- body: JSON.stringify(payload),
227
+ body: JSON.stringify(runData),
231
228
  }, JobResponseSchema);
232
229
  }
233
230
  async deleteChallenge(challengeId) {
@@ -161,6 +161,7 @@ export class Runner {
161
161
  const response = await this.api.runChallenge({
162
162
  challenge: state.config.challenge_slug,
163
163
  participants: state.config.participants,
164
+ jobType: "background",
164
165
  });
165
166
  if (!response.runIds || response.runIds.length === 0) {
166
167
  throw new Error("No run ID returned from API");
@@ -1243,5 +1243,5 @@
1243
1243
  ]
1244
1244
  }
1245
1245
  },
1246
- "version": "0.4.0"
1246
+ "version": "0.4.2"
1247
1247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kradle",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Kradle's CLI. Manage challenges, experiments, agents and more!",
5
5
  "keywords": [
6
6
  "cli"