@blade-hq/agent-kit 0.4.4 → 0.4.5
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 +3 -0
- package/dist/client/index.d.ts +529 -40
- package/dist/client/index.js +20 -1
- package/dist/client/index.js.map +1 -1
- package/dist/react/index.d.ts +74 -2
- package/dist/react/index.js +131 -23
- package/dist/react/index.js.map +1 -1
- package/dist/style.css +2 -0
- package/package.json +5 -2
package/dist/react/index.js
CHANGED
|
@@ -34,9 +34,28 @@ var ApiKeysResource = class {
|
|
|
34
34
|
return this.client.json("PATCH", `/api/user/api-keys/${encodeURIComponent(id)}`, { name });
|
|
35
35
|
}
|
|
36
36
|
async deleteApiKey(id) {
|
|
37
|
-
|
|
37
|
+
try {
|
|
38
|
+
await this.client.json("DELETE", `/api/user/api-keys/${encodeURIComponent(id)}`);
|
|
39
|
+
} catch (err) {
|
|
40
|
+
if (err instanceof BladeApiError) {
|
|
41
|
+
const detail = await readErrorDetail(err.response);
|
|
42
|
+
if (detail) {
|
|
43
|
+
throw new Error(detail);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
throw err;
|
|
47
|
+
}
|
|
38
48
|
}
|
|
39
49
|
};
|
|
50
|
+
async function readErrorDetail(response) {
|
|
51
|
+
try {
|
|
52
|
+
const data = await response.clone().json();
|
|
53
|
+
const detail = data?.detail;
|
|
54
|
+
return typeof detail === "string" && detail.trim() ? detail : null;
|
|
55
|
+
} catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
40
59
|
|
|
41
60
|
// src/client/resources/auth.ts
|
|
42
61
|
var AuthResource = class {
|
|
@@ -1603,8 +1622,8 @@ function trackEvent(name, props = {}) {
|
|
|
1603
1622
|
}
|
|
1604
1623
|
|
|
1605
1624
|
// src/react/lib/tool-preview.ts
|
|
1606
|
-
function buildToolPreviewKey(content,
|
|
1607
|
-
if (
|
|
1625
|
+
function buildToolPreviewKey(content, type13, toolCallId) {
|
|
1626
|
+
if (type13 === "resource-uri") {
|
|
1608
1627
|
return `tool-preview-uri:${content}`;
|
|
1609
1628
|
}
|
|
1610
1629
|
return `tool-preview:${toolCallId}`;
|
|
@@ -3350,8 +3369,8 @@ function resolveArtifactType(contentType) {
|
|
|
3350
3369
|
}
|
|
3351
3370
|
return "file";
|
|
3352
3371
|
}
|
|
3353
|
-
function buildToolPreviewSignature(content,
|
|
3354
|
-
return `${
|
|
3372
|
+
function buildToolPreviewSignature(content, type13) {
|
|
3373
|
+
return `${type13}:${content}`;
|
|
3355
3374
|
}
|
|
3356
3375
|
function isToolBridgeContent(value) {
|
|
3357
3376
|
return typeof value === "object" && value !== null && !Array.isArray(value) && typeof value.action === "string";
|
|
@@ -3566,17 +3585,17 @@ var AgentSocket = class {
|
|
|
3566
3585
|
invalidateSessionCheckpoints(sessionId);
|
|
3567
3586
|
});
|
|
3568
3587
|
const handleArtifact = (sessionId, data) => {
|
|
3569
|
-
const
|
|
3588
|
+
const type13 = resolveArtifactType(data.content_type);
|
|
3570
3589
|
const filePath = `/api/sessions/${sessionId}/files/${encodeURIComponent(data.file_path)}`;
|
|
3571
3590
|
const fileUrl = this.client.buildAuthedUrl(filePath);
|
|
3572
|
-
const content =
|
|
3591
|
+
const content = type13 === "ppt" ? filePath : type13 === "image" || type13 === "pdf" || type13 === "docx" || type13 === "excel" ? fileUrl : data.content;
|
|
3573
3592
|
if (data.session_id != null && data.session_id === this.subscribedSession) {
|
|
3574
3593
|
useUiStore.getState().setActiveRightTab("preview");
|
|
3575
3594
|
}
|
|
3576
3595
|
useUiStore.getState().pushArtifact({
|
|
3577
|
-
type:
|
|
3596
|
+
type: type13,
|
|
3578
3597
|
content,
|
|
3579
|
-
sourceUrl:
|
|
3598
|
+
sourceUrl: type13 === "ppt" ? fileUrl : void 0,
|
|
3580
3599
|
title: data.title,
|
|
3581
3600
|
key: data.file_path,
|
|
3582
3601
|
revision: Date.now()
|
|
@@ -4124,6 +4143,59 @@ var deleteQuickScenario = (...args) => r11().deleteQuickScenario(...args);
|
|
|
4124
4143
|
var updateQuickScenario = (...args) => r11().updateQuickScenario(...args);
|
|
4125
4144
|
var listBladeHubScenarioResources = (...args) => r11().listBladeHubScenarioResources(...args);
|
|
4126
4145
|
|
|
4146
|
+
// src/react/api/scheduled-tasks.ts
|
|
4147
|
+
var scheduled_tasks_exports = {};
|
|
4148
|
+
__export(scheduled_tasks_exports, {
|
|
4149
|
+
createScheduledTask: () => createScheduledTask,
|
|
4150
|
+
deleteScheduledTask: () => deleteScheduledTask,
|
|
4151
|
+
getScheduledTask: () => getScheduledTask,
|
|
4152
|
+
getScheduledTaskCalendar: () => getScheduledTaskCalendar,
|
|
4153
|
+
listScheduledTaskRuns: () => listScheduledTaskRuns,
|
|
4154
|
+
listScheduledTasks: () => listScheduledTasks,
|
|
4155
|
+
startScheduledTask: () => startScheduledTask,
|
|
4156
|
+
stopScheduledTask: () => stopScheduledTask,
|
|
4157
|
+
updateScheduledTask: () => updateScheduledTask
|
|
4158
|
+
});
|
|
4159
|
+
function taskPath(id) {
|
|
4160
|
+
return `/api/scheduled-tasks/${encodeURIComponent(id)}`;
|
|
4161
|
+
}
|
|
4162
|
+
async function listScheduledTasks() {
|
|
4163
|
+
return apiFetch("/api/scheduled-tasks");
|
|
4164
|
+
}
|
|
4165
|
+
async function createScheduledTask(payload) {
|
|
4166
|
+
return apiFetch("/api/scheduled-tasks", {
|
|
4167
|
+
method: "POST",
|
|
4168
|
+
body: JSON.stringify(payload)
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
async function getScheduledTask(id) {
|
|
4172
|
+
return apiFetch(taskPath(id));
|
|
4173
|
+
}
|
|
4174
|
+
async function updateScheduledTask(id, payload) {
|
|
4175
|
+
return apiFetch(taskPath(id), {
|
|
4176
|
+
method: "PATCH",
|
|
4177
|
+
body: JSON.stringify(payload)
|
|
4178
|
+
});
|
|
4179
|
+
}
|
|
4180
|
+
async function deleteScheduledTask(id) {
|
|
4181
|
+
await apiFetch(taskPath(id), { method: "DELETE" });
|
|
4182
|
+
}
|
|
4183
|
+
async function startScheduledTask(id) {
|
|
4184
|
+
return apiFetch(`${taskPath(id)}/start`, { method: "POST" });
|
|
4185
|
+
}
|
|
4186
|
+
async function stopScheduledTask(id) {
|
|
4187
|
+
return apiFetch(`${taskPath(id)}/stop`, { method: "POST" });
|
|
4188
|
+
}
|
|
4189
|
+
async function listScheduledTaskRuns(id) {
|
|
4190
|
+
return apiFetch(`${taskPath(id)}/runs`);
|
|
4191
|
+
}
|
|
4192
|
+
async function getScheduledTaskCalendar(params) {
|
|
4193
|
+
const search = new URLSearchParams({ from: params.from, to: params.to });
|
|
4194
|
+
return apiFetch(
|
|
4195
|
+
`/api/scheduled-tasks/calendar?${search.toString()}`
|
|
4196
|
+
);
|
|
4197
|
+
}
|
|
4198
|
+
|
|
4127
4199
|
// src/react/api/software-factory.ts
|
|
4128
4200
|
var software_factory_exports = {};
|
|
4129
4201
|
__export(software_factory_exports, {
|
|
@@ -5406,9 +5478,9 @@ async function resolveSessionFilePreviewTarget(sessionId, filePath, fileName) {
|
|
|
5406
5478
|
}
|
|
5407
5479
|
const content = await res.text();
|
|
5408
5480
|
const ext = getExt(resolvedFileName);
|
|
5409
|
-
const
|
|
5481
|
+
const type13 = MARKDOWN_EXTS.has(ext) ? "markdown" : CSV_EXTS.has(ext) ? "csv" : HTML_EXTS.has(ext) ? "html" : "file";
|
|
5410
5482
|
return {
|
|
5411
|
-
type:
|
|
5483
|
+
type: type13,
|
|
5412
5484
|
content,
|
|
5413
5485
|
title: resolvedFileName,
|
|
5414
5486
|
key: filePath
|
|
@@ -5623,14 +5695,14 @@ var CardComponentRegistry = class {
|
|
|
5623
5695
|
this.components = /* @__PURE__ */ new Map();
|
|
5624
5696
|
}
|
|
5625
5697
|
}
|
|
5626
|
-
register(
|
|
5627
|
-
this.components.set(
|
|
5698
|
+
register(type13, component) {
|
|
5699
|
+
this.components.set(type13, component);
|
|
5628
5700
|
}
|
|
5629
|
-
get(
|
|
5630
|
-
return this.components.get(
|
|
5701
|
+
get(type13) {
|
|
5702
|
+
return this.components.get(type13);
|
|
5631
5703
|
}
|
|
5632
|
-
has(
|
|
5633
|
-
return this.components.has(
|
|
5704
|
+
has(type13) {
|
|
5705
|
+
return this.components.has(type13);
|
|
5634
5706
|
}
|
|
5635
5707
|
keys() {
|
|
5636
5708
|
return Array.from(this.components.keys());
|
|
@@ -11490,13 +11562,13 @@ function ToolCallBlock({
|
|
|
11490
11562
|
{
|
|
11491
11563
|
type: "button",
|
|
11492
11564
|
onClick: () => {
|
|
11493
|
-
const
|
|
11565
|
+
const type13 = uiMeta.resourceHTML ? "resource-html" : "resource-uri";
|
|
11494
11566
|
const content = uiMeta.resourceHTML ?? uiMeta.resourceUri ?? uiMeta.resourceURI ?? "";
|
|
11495
11567
|
pushArtifact({
|
|
11496
|
-
type:
|
|
11568
|
+
type: type13,
|
|
11497
11569
|
content,
|
|
11498
11570
|
title: uiMeta.title ?? displayName,
|
|
11499
|
-
key: buildToolPreviewKey(content,
|
|
11571
|
+
key: buildToolPreviewKey(content, type13, toolCall.id),
|
|
11500
11572
|
bridgeSessionId: resolvedSessionId
|
|
11501
11573
|
});
|
|
11502
11574
|
},
|
|
@@ -14111,10 +14183,42 @@ var EnvVariable = type10({
|
|
|
14111
14183
|
"is_secret?": "boolean"
|
|
14112
14184
|
});
|
|
14113
14185
|
|
|
14114
|
-
// src/react/schemas/task.ts
|
|
14186
|
+
// src/react/schemas/scheduled-task.ts
|
|
14115
14187
|
import { type as type11 } from "arktype";
|
|
14116
|
-
var
|
|
14117
|
-
|
|
14188
|
+
var ScheduledTask = type11({
|
|
14189
|
+
id: "string",
|
|
14190
|
+
title: "string",
|
|
14191
|
+
prompt: "string",
|
|
14192
|
+
cron: "string",
|
|
14193
|
+
timezone: "string",
|
|
14194
|
+
enabled: "boolean",
|
|
14195
|
+
expires_at: "string | null",
|
|
14196
|
+
skip_confirmations: "boolean",
|
|
14197
|
+
model: "string | null",
|
|
14198
|
+
next_run_at: "string | null",
|
|
14199
|
+
last_run_at: "string | null",
|
|
14200
|
+
created_at: "string",
|
|
14201
|
+
updated_at: "string"
|
|
14202
|
+
});
|
|
14203
|
+
var ScheduledTaskRun = type11({
|
|
14204
|
+
id: "string",
|
|
14205
|
+
task_id: "string",
|
|
14206
|
+
session_id: "string | null",
|
|
14207
|
+
status: "string",
|
|
14208
|
+
error: "string | null",
|
|
14209
|
+
triggered_at: "string",
|
|
14210
|
+
finished_at: "string | null"
|
|
14211
|
+
});
|
|
14212
|
+
var ScheduledTaskCalendarItem = type11({
|
|
14213
|
+
task_id: "string",
|
|
14214
|
+
title: "string",
|
|
14215
|
+
occurrences: "string[]"
|
|
14216
|
+
});
|
|
14217
|
+
|
|
14218
|
+
// src/react/schemas/task.ts
|
|
14219
|
+
import { type as type12 } from "arktype";
|
|
14220
|
+
var TaskStatus = type12("'pending' | 'in_progress' | 'done' | 'failed' | 'skipped'");
|
|
14221
|
+
var Task = type12({
|
|
14118
14222
|
id: "string",
|
|
14119
14223
|
goal: "string",
|
|
14120
14224
|
skills: "string[]",
|
|
@@ -14183,6 +14287,9 @@ export {
|
|
|
14183
14287
|
ResourceIframe,
|
|
14184
14288
|
Scene,
|
|
14185
14289
|
SceneStatus,
|
|
14290
|
+
ScheduledTask,
|
|
14291
|
+
ScheduledTaskCalendarItem,
|
|
14292
|
+
ScheduledTaskRun,
|
|
14186
14293
|
SessionInfo,
|
|
14187
14294
|
SessionStatus,
|
|
14188
14295
|
SkillCompletionMenu,
|
|
@@ -14239,6 +14346,7 @@ export {
|
|
|
14239
14346
|
resolveSessionFilePreviewTarget,
|
|
14240
14347
|
resourceBridgeDispatch,
|
|
14241
14348
|
scenarios_exports as scenariosApi,
|
|
14349
|
+
scheduled_tasks_exports as scheduledTasksApi,
|
|
14242
14350
|
sessions_exports as sessionsApi,
|
|
14243
14351
|
setAnalyticsClient,
|
|
14244
14352
|
setOnWorkspaceFilesChanged,
|