kradle 0.4.0 → 0.4.1

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,7 +25,7 @@ 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());
@@ -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,7 +75,7 @@ export declare class ApiClient {
76
75
  runChallenge(runData: {
77
76
  challenge: string;
78
77
  participants: unknown[];
79
- }): Promise<{
78
+ }, isBackground?: boolean): Promise<{
80
79
  runIds?: string[] | undefined;
81
80
  participants?: Record<string, {
82
81
  agent: 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}`;
@@ -223,9 +221,9 @@ export class ApiClient {
223
221
  async getChallengeDownloadUrl(slug) {
224
222
  return this.get(`challenges/${slug}/datapackDownloadUrl`, {}, DownloadUrlResponseSchema);
225
223
  }
226
- async runChallenge(runData) {
224
+ async runChallenge(runData, isBackground = true) {
227
225
  const url = "jobs";
228
- const payload = this.isStudio ? runData : { ...runData, jobType: "background" };
226
+ const payload = isBackground ? { ...runData, jobType: "background" } : runData;
229
227
  return this.post(url, {
230
228
  body: JSON.stringify(payload),
231
229
  }, JobResponseSchema);
@@ -161,7 +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
- });
164
+ }, true);
165
165
  if (!response.runIds || response.runIds.length === 0) {
166
166
  throw new Error("No run ID returned from API");
167
167
  }
@@ -42,50 +42,6 @@
42
42
  "init.js"
43
43
  ]
44
44
  },
45
- "agent:list": {
46
- "aliases": [],
47
- "args": {},
48
- "description": "List all agents",
49
- "examples": [
50
- "<%= config.bin %> <%= command.id %>"
51
- ],
52
- "flags": {
53
- "api-key": {
54
- "description": "Kradle API key",
55
- "env": "KRADLE_API_KEY",
56
- "name": "api-key",
57
- "required": true,
58
- "hasDynamicHelp": false,
59
- "multiple": false,
60
- "type": "option"
61
- },
62
- "api-url": {
63
- "description": "Kradle Web API URL",
64
- "env": "KRADLE_API_URL",
65
- "name": "api-url",
66
- "required": true,
67
- "default": "https://api.kradle.ai/v0",
68
- "hasDynamicHelp": false,
69
- "multiple": false,
70
- "type": "option"
71
- }
72
- },
73
- "hasDynamicHelp": false,
74
- "hiddenAliases": [],
75
- "id": "agent:list",
76
- "pluginAlias": "kradle",
77
- "pluginName": "kradle",
78
- "pluginType": "core",
79
- "strict": true,
80
- "enableJsonFlag": false,
81
- "isESM": true,
82
- "relativePath": [
83
- "dist",
84
- "commands",
85
- "agent",
86
- "list.js"
87
- ]
88
- },
89
45
  "ai-docs:challenges-sdk": {
90
46
  "aliases": [],
91
47
  "args": {
@@ -1241,7 +1197,51 @@
1241
1197
  "world",
1242
1198
  "push.js"
1243
1199
  ]
1200
+ },
1201
+ "agent:list": {
1202
+ "aliases": [],
1203
+ "args": {},
1204
+ "description": "List all agents",
1205
+ "examples": [
1206
+ "<%= config.bin %> <%= command.id %>"
1207
+ ],
1208
+ "flags": {
1209
+ "api-key": {
1210
+ "description": "Kradle API key",
1211
+ "env": "KRADLE_API_KEY",
1212
+ "name": "api-key",
1213
+ "required": true,
1214
+ "hasDynamicHelp": false,
1215
+ "multiple": false,
1216
+ "type": "option"
1217
+ },
1218
+ "api-url": {
1219
+ "description": "Kradle Web API URL",
1220
+ "env": "KRADLE_API_URL",
1221
+ "name": "api-url",
1222
+ "required": true,
1223
+ "default": "https://api.kradle.ai/v0",
1224
+ "hasDynamicHelp": false,
1225
+ "multiple": false,
1226
+ "type": "option"
1227
+ }
1228
+ },
1229
+ "hasDynamicHelp": false,
1230
+ "hiddenAliases": [],
1231
+ "id": "agent:list",
1232
+ "pluginAlias": "kradle",
1233
+ "pluginName": "kradle",
1234
+ "pluginType": "core",
1235
+ "strict": true,
1236
+ "enableJsonFlag": false,
1237
+ "isESM": true,
1238
+ "relativePath": [
1239
+ "dist",
1240
+ "commands",
1241
+ "agent",
1242
+ "list.js"
1243
+ ]
1244
1244
  }
1245
1245
  },
1246
- "version": "0.4.0"
1246
+ "version": "0.4.1"
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.1",
4
4
  "description": "Kradle's CLI. Manage challenges, experiments, agents and more!",
5
5
  "keywords": [
6
6
  "cli"