@blade-hq/agent-kit 0.4.8 → 0.4.11
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/dist/{SkillStatusBar-CDmaNuOE.d.ts → SkillStatusBar-CHnXqybx.d.ts} +2 -2
- package/dist/{blade-client-X5TOnkQa.d.ts → blade-client-BfYaHLco.d.ts} +44 -2
- package/dist/{chunk-MAMDVXTM.js → chunk-3LCNDPP6.js} +2 -2
- package/dist/{chunk-SAKSQ7OO.js → chunk-4XID5JVK.js} +2 -2
- package/dist/{chunk-TWZHUASA.js → chunk-CDSCC4OQ.js} +86 -17
- package/dist/chunk-CDSCC4OQ.js.map +1 -0
- package/dist/{chunk-QO6CO372.js → chunk-O2BVC7QE.js} +119 -86
- package/dist/chunk-O2BVC7QE.js.map +1 -0
- package/dist/{chunk-I5BTVM3C.js → chunk-PJJ3Y3DZ.js} +2 -2
- package/dist/{chunk-DNT6RM5E.js → chunk-VCCMO7G5.js} +59 -5
- package/dist/chunk-VCCMO7G5.js.map +1 -0
- package/dist/{chunk-YFKHSFRB.js → chunk-Z4FPELIQ.js} +228 -82
- package/dist/chunk-Z4FPELIQ.js.map +1 -0
- package/dist/client/index.d.ts +297 -29
- package/dist/client/index.js +1 -1
- package/dist/{licenses-DWJmNvpn.d.ts → licenses-BGw5jiC4.d.ts} +1 -1
- package/dist/react/api/licenses.d.ts +3 -3
- package/dist/react/api/licenses.js +3 -3
- package/dist/react/api/vibe-coding.d.ts +3 -3
- package/dist/react/api/vibe-coding.js +2 -2
- package/dist/react/components/chat/index.d.ts +4 -4
- package/dist/react/components/chat/index.js +5 -5
- package/dist/react/components/plan/index.js +3 -3
- package/dist/react/components/session/index.d.ts +1 -1
- package/dist/react/components/session/index.js +3 -3
- package/dist/react/components/workspace/index.js +3 -3
- package/dist/react/index.d.ts +42 -13
- package/dist/react/index.js +21 -7
- package/dist/react/index.js.map +1 -1
- package/dist/{session-CDeiO81j.d.ts → session-BKOc2lsz.d.ts} +9 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
- package/dist/chunk-DNT6RM5E.js.map +0 -1
- package/dist/chunk-QO6CO372.js.map +0 -1
- package/dist/chunk-TWZHUASA.js.map +0 -1
- package/dist/chunk-YFKHSFRB.js.map +0 -1
- /package/dist/{chunk-MAMDVXTM.js.map → chunk-3LCNDPP6.js.map} +0 -0
- /package/dist/{chunk-SAKSQ7OO.js.map → chunk-4XID5JVK.js.map} +0 -0
- /package/dist/{chunk-I5BTVM3C.js.map → chunk-PJJ3Y3DZ.js.map} +0 -0
|
@@ -3,8 +3,8 @@ import * as react from 'react';
|
|
|
3
3
|
import { ComponentType, ReactNode } from 'react';
|
|
4
4
|
import { C as ChatMessage, A as AskUserAnswerData, T as ToolCallInfo, M as MessageContent } from './AskUserQuestionBlock-CjvG_pUY.js';
|
|
5
5
|
import * as zustand from 'zustand';
|
|
6
|
-
import { M as ModeId, S as SessionInfo, a as SessionStatus } from './session-
|
|
7
|
-
import { m as BladeClient } from './blade-client-
|
|
6
|
+
import { M as ModeId, S as SessionInfo, a as SessionStatus } from './session-BKOc2lsz.js';
|
|
7
|
+
import { m as BladeClient } from './blade-client-BfYaHLco.js';
|
|
8
8
|
import { C as ContentBlock } from './projection-DIfyh6RK.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as arktype_internal_variants_object_ts from 'arktype/internal/variants/object.ts';
|
|
2
2
|
import * as arktype_internal_variants_string_ts from 'arktype/internal/variants/string.ts';
|
|
3
3
|
import { T as TurnProjection } from './projection-DIfyh6RK.js';
|
|
4
|
-
import { S as SessionInfo, T as TemplateId, b as SessionDetail, c as Solution, B as BizRole } from './session-
|
|
4
|
+
import { S as SessionInfo, T as TemplateId, b as SessionDetail, c as Solution, B as BizRole } from './session-BKOc2lsz.js';
|
|
5
5
|
import { Socket } from 'socket.io-client';
|
|
6
6
|
|
|
7
7
|
declare class BladeApiError extends Error {
|
|
@@ -713,11 +713,18 @@ declare class SessionsResource {
|
|
|
713
713
|
|
|
714
714
|
declare const PartnerSkillName: arktype_internal_variants_string_ts.StringType<`${string}/${string}`, {}>;
|
|
715
715
|
type PartnerSkillName = typeof PartnerSkillName.infer;
|
|
716
|
+
declare const SessionSkillName: arktype_internal_variants_string_ts.StringType<`${string}/${string}`, {}>;
|
|
717
|
+
type SessionSkillName = PartnerSkillName;
|
|
716
718
|
declare const PartnerSkillFile: arktype_internal_variants_object_ts.ObjectType<{
|
|
717
719
|
path: string;
|
|
718
720
|
content: string;
|
|
719
721
|
}, {}>;
|
|
720
722
|
type PartnerSkillFile = typeof PartnerSkillFile.infer;
|
|
723
|
+
declare const SessionSkillFile: arktype_internal_variants_object_ts.ObjectType<{
|
|
724
|
+
path: string;
|
|
725
|
+
content: string;
|
|
726
|
+
}, {}>;
|
|
727
|
+
type SessionSkillFile = PartnerSkillFile;
|
|
721
728
|
declare const PartnerSkillInstallPayload: arktype_internal_variants_object_ts.ObjectType<{
|
|
722
729
|
name: `${string}/${string}`;
|
|
723
730
|
files: {
|
|
@@ -726,6 +733,14 @@ declare const PartnerSkillInstallPayload: arktype_internal_variants_object_ts.Ob
|
|
|
726
733
|
}[];
|
|
727
734
|
}, {}>;
|
|
728
735
|
type PartnerSkillInstallPayload = typeof PartnerSkillInstallPayload.infer;
|
|
736
|
+
declare const SessionSkillUploadPayload: arktype_internal_variants_object_ts.ObjectType<{
|
|
737
|
+
name: `${string}/${string}`;
|
|
738
|
+
files: {
|
|
739
|
+
path: string;
|
|
740
|
+
content: string;
|
|
741
|
+
}[];
|
|
742
|
+
}, {}>;
|
|
743
|
+
type SessionSkillUploadPayload = PartnerSkillInstallPayload;
|
|
729
744
|
declare const PartnerSkillInstallResult: arktype_internal_variants_object_ts.ObjectType<{
|
|
730
745
|
name: `${string}/${string}`;
|
|
731
746
|
skill_dir: string;
|
|
@@ -733,6 +748,13 @@ declare const PartnerSkillInstallResult: arktype_internal_variants_object_ts.Obj
|
|
|
733
748
|
overwritten: boolean;
|
|
734
749
|
}, {}>;
|
|
735
750
|
type PartnerSkillInstallResult = typeof PartnerSkillInstallResult.infer;
|
|
751
|
+
declare const SessionSkillUploadResult: arktype_internal_variants_object_ts.ObjectType<{
|
|
752
|
+
name: `${string}/${string}`;
|
|
753
|
+
skill_dir: string;
|
|
754
|
+
file_count: number;
|
|
755
|
+
overwritten: boolean;
|
|
756
|
+
}, {}>;
|
|
757
|
+
type SessionSkillUploadResult = PartnerSkillInstallResult;
|
|
736
758
|
|
|
737
759
|
interface SkillSummary {
|
|
738
760
|
skill_id: string;
|
|
@@ -815,6 +837,7 @@ declare class SkillsResource {
|
|
|
815
837
|
getSkillStats(sessionId: string, init?: RequestInit): Promise<SkillStats>;
|
|
816
838
|
getGlobalSkillStats(init?: RequestInit): Promise<GlobalSkillStats>;
|
|
817
839
|
getSkill(skillName: string, init?: RequestInit): Promise<SkillDetail>;
|
|
840
|
+
uploadSessionSkill(sessionId: string, payload: SessionSkillUploadPayload, init?: RequestInit): Promise<SessionSkillUploadResult>;
|
|
818
841
|
installPartnerSkill(sessionId: string, payload: PartnerSkillInstallPayload, init?: RequestInit): Promise<PartnerSkillInstallResult>;
|
|
819
842
|
}
|
|
820
843
|
|
|
@@ -963,11 +986,30 @@ declare class SolutionsResource {
|
|
|
963
986
|
fetchSolutionBizRoles(solutionId: string, userId?: string): Promise<BizRole[]>;
|
|
964
987
|
}
|
|
965
988
|
|
|
989
|
+
type ComputerUpgradeReason = "no_container" | "no_target" | "current_latest" | "up_to_date" | "upgrade_available";
|
|
990
|
+
interface ComputerUpgradeStatusResponse {
|
|
991
|
+
upgrade_available: boolean;
|
|
992
|
+
reason: ComputerUpgradeReason;
|
|
993
|
+
current_version: string | null;
|
|
994
|
+
target_version: string | null;
|
|
995
|
+
}
|
|
996
|
+
interface UpgradeComputerResponse {
|
|
997
|
+
target_version: string | null;
|
|
998
|
+
previous_version: string | null;
|
|
999
|
+
removed_containers: number;
|
|
1000
|
+
removed_volume: boolean;
|
|
1001
|
+
cleared_memo: number;
|
|
1002
|
+
}
|
|
966
1003
|
declare class UserPreferencesResource {
|
|
967
1004
|
private client;
|
|
968
1005
|
constructor(client: BladeClient);
|
|
969
1006
|
getUserPreference(key: string): Promise<string | null>;
|
|
970
1007
|
setUserPreference(key: string, value: string): Promise<void>;
|
|
1008
|
+
getPersistentDefault(): Promise<boolean>;
|
|
1009
|
+
setPersistentDefault(value: boolean): Promise<void>;
|
|
1010
|
+
resetComputer(): Promise<void>;
|
|
1011
|
+
getComputerUpgradeStatus(): Promise<ComputerUpgradeStatusResponse>;
|
|
1012
|
+
upgradeComputer(): Promise<UpgradeComputerResponse>;
|
|
971
1013
|
}
|
|
972
1014
|
|
|
973
1015
|
interface PortMapping {
|
|
@@ -1527,4 +1569,4 @@ declare class BladeClient {
|
|
|
1527
1569
|
private resolveToken;
|
|
1528
1570
|
}
|
|
1529
1571
|
|
|
1530
|
-
export {
|
|
1572
|
+
export { ModelsConfig as $, type ApiKeyCreateResponse as A, BladeApiError as B, type CreateVibeCodingSessionResult as C, type DeviceUuidResponse as D, type CreateSessionRequest as E, type CreateSocketOptions as F, type CreateSoftwareFactorySharedFilePayload as G, type CreateSoftwareFactorySoftwarePayload as H, type FileEntry as I, GisResource as J, type GlobalSkillStats as K, LicensesResource as L, type HistoryNode as M, type HttpMethod as N, type ImportPreview as O, type PortMapping as P, type ImportPreviewScenario as Q, type ImportPreviewSkill as R, type InstalledRegistrySkill as S, MemoriesResource as T, type UploadLicenseResponse as U, VibeCodingResource as V, type Memory as W, type MemoryCreateBody as X, type MemoryListParams as Y, type MemoryListResponse as Z, ModelOption as _, type LicenseStatusResponse as a, HttpToolConfig as a$, ModelsResource as a0, type PaginatedSessionsResult as a1, type PreviewUrlItem as a2, type ProvidersResponse as a3, type QuickScenario as a4, REGISTRY_PREFIX as a5, RegistryResource as a6, type ResourceApi as a7, ScenariosResource as a8, type ServerToClientEvents as a9, createSocket as aA, normalizeResource as aB, EnvBucketsResource as aC, type EnvBucket as aD, type PlatformEnvBucket as aE, type GisState as aF, type RuntimeConfig as aG, type SkillDetail as aH, type SkillStats as aI, type SkillSummary as aJ, type SkillSearchResult as aK, PartnerSkillInstallPayload as aL, PartnerSkillInstallResult as aM, SessionSkillUploadPayload as aN, SessionSkillUploadResult as aO, type BackgroundTask as aP, type GisGoal as aQ, type GisResource$1 as aR, type GisTarget as aS, type GisMapCommand as aT, Task as aU, AgentDriver as aV, AgentResource as aW, DatabaseDriver as aX, DatabaseResource as aY, DifyKnowledgeConfig as aZ, type GisGoalStatus as a_, type SessionContextStats as aa, type SessionHistory as ab, type SessionUpdatedPayload as ac, SessionsResource as ad, type ShareLinkResult as ae, type SkillDevSession as af, type SkillOrgListResponse as ag, type SkillOrgOption as ah, SkillsResource as ai, type SoftwareFactoryModuleBlueprint as aj, SoftwareFactoryResource as ak, type SoftwareFactorySharedFile as al, type SoftwareFactorySoftware as am, type SoftwareFactoryTopic as an, type SoftwareFactoryTopicModule as ao, SolutionsResource as ap, type SystemErrorPayload as aq, type SystemNotificationPayload as ar, type TokenizeResult as as, type TurnProjectionPayload as at, type TypedSocket as au, type UpdateQuickScenarioPayload as av, type UpgradeComputerResponse as aw, type UploadFileEntry as ax, type UserInfo as ay, UserPreferencesResource as az, type LicenseValidateResponse as b, KnowledgeDriver as b0, KnowledgeResource as b1, McpToolConfig as b2, MysqlConfig as b3, type ParallelMode as b4, PartnerSkillFile as b5, PartnerSkillName as b6, PostgresqlConfig as b7, SessionSkillFile as b8, SessionSkillName as b9, type StageSpec as ba, type StepSpec as bb, TaskStatus as bc, ToolDriver as bd, ToolResource as be, skillDisplayName as bf, type VibeCodingDeployStatus as c, type VibeCodingDebugSessionStatus as d, type VibeCodingSessionStatus as e, type VibeCodingDeployRecord as f, type VibeCodingSessionInfo as g, type CreateVibeCodingSessionParams as h, type DeployBumpMode as i, type ApiKeyPublic as j, ApiKeysResource as k, AuthResource as l, BladeClient as m, type BladeClientOptions as n, type BladeFetchInit as o, type BladeHubScenarioResource as p, type ChatEndPayload as q, type ChatSendPayload as r, type CheckpointNode as s, type ClientToServerEvents as t, type CodingTask as u, type CodingTaskTopic as v, type ComputerUpgradeReason as w, type ComputerUpgradeStatusResponse as x, type ContentPart as y, type CreateQuickScenarioPayload as z };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
apiFetchResponse,
|
|
3
3
|
getAuthedUrl
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-CDSCC4OQ.js";
|
|
5
5
|
|
|
6
6
|
// src/react/lib/session-file-preview.ts
|
|
7
7
|
var IMAGE_EXTS = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "svg", "webp", "ico", "bmp"]);
|
|
@@ -124,4 +124,4 @@ export {
|
|
|
124
124
|
CollapsibleTrigger,
|
|
125
125
|
CollapsibleContent
|
|
126
126
|
};
|
|
127
|
-
//# sourceMappingURL=chunk-
|
|
127
|
+
//# sourceMappingURL=chunk-3LCNDPP6.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useSessionStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CDSCC4OQ.js";
|
|
4
4
|
|
|
5
5
|
// src/react/hooks/use-session.ts
|
|
6
6
|
function useSession() {
|
|
@@ -27,4 +27,4 @@ function useSession() {
|
|
|
27
27
|
export {
|
|
28
28
|
useSession
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-4XID5JVK.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-J3XVFPOV.js";
|
|
4
4
|
import {
|
|
5
5
|
BladeClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VCCMO7G5.js";
|
|
7
7
|
import {
|
|
8
8
|
createClientActions,
|
|
9
9
|
useCardStateStore
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
// src/react/api/partner-skill.ts
|
|
16
16
|
var partner_skill_exports = {};
|
|
17
17
|
__export(partner_skill_exports, {
|
|
18
|
-
installPartnerSkill: () => installPartnerSkill
|
|
18
|
+
installPartnerSkill: () => installPartnerSkill,
|
|
19
|
+
uploadSessionSkill: () => uploadSessionSkill
|
|
19
20
|
});
|
|
20
21
|
|
|
21
22
|
// src/react/api/skills.ts
|
|
@@ -29,7 +30,8 @@ __export(skills_exports, {
|
|
|
29
30
|
listSessionSkills: () => listSessionSkills,
|
|
30
31
|
listSkills: () => listSkills,
|
|
31
32
|
resyncSkills: () => resyncSkills,
|
|
32
|
-
searchSkills: () => searchSkills
|
|
33
|
+
searchSkills: () => searchSkills,
|
|
34
|
+
uploadSessionSkill: () => uploadSessionSkill
|
|
33
35
|
});
|
|
34
36
|
var r = () => getClient().skills;
|
|
35
37
|
var listSkills = (...args) => r().listSkills(...args);
|
|
@@ -40,29 +42,34 @@ var searchSkills = (...args) => r().searchSkills(...args);
|
|
|
40
42
|
var getSkillStats = (...args) => r().getSkillStats(...args);
|
|
41
43
|
var getGlobalSkillStats = (...args) => r().getGlobalSkillStats(...args);
|
|
42
44
|
var getSkill = (...args) => r().getSkill(...args);
|
|
45
|
+
var uploadSessionSkill = (...args) => r().uploadSessionSkill(...args);
|
|
43
46
|
var installPartnerSkill = (...args) => r().installPartnerSkill(...args);
|
|
44
47
|
|
|
45
48
|
// src/react/schemas/partner-skill.ts
|
|
46
49
|
import { type } from "arktype";
|
|
47
50
|
var PartnerSkillName = type("/^[a-z0-9-]+\\/[a-z0-9-]+$/");
|
|
51
|
+
var SessionSkillName = PartnerSkillName;
|
|
48
52
|
var PartnerSkillFile = type({
|
|
49
53
|
path: "string > 0",
|
|
50
54
|
content: "string"
|
|
51
55
|
});
|
|
56
|
+
var SessionSkillFile = PartnerSkillFile;
|
|
52
57
|
var PartnerSkillInstallPayload = type({
|
|
53
58
|
name: PartnerSkillName,
|
|
54
59
|
files: PartnerSkillFile.array().atLeastLength(1)
|
|
55
60
|
});
|
|
61
|
+
var SessionSkillUploadPayload = PartnerSkillInstallPayload;
|
|
56
62
|
var PartnerSkillInstallResult = type({
|
|
57
63
|
name: PartnerSkillName,
|
|
58
64
|
skill_dir: "string",
|
|
59
65
|
file_count: "number.integer >= 0",
|
|
60
66
|
overwritten: "boolean"
|
|
61
67
|
});
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
var SessionSkillUploadResult = PartnerSkillInstallResult;
|
|
69
|
+
function parseSessionSkillUploadPayload(payload) {
|
|
70
|
+
const parsed = SessionSkillUploadPayload.assert(payload);
|
|
64
71
|
if (!parsed.files.some((file) => file.path === "SKILL.md")) {
|
|
65
|
-
throw new Error("
|
|
72
|
+
throw new Error("session skill upload payload must include SKILL.md");
|
|
66
73
|
}
|
|
67
74
|
return parsed;
|
|
68
75
|
}
|
|
@@ -314,26 +321,27 @@ function attachHostBridgeListener(getState) {
|
|
|
314
321
|
}
|
|
315
322
|
switch (envelope.action) {
|
|
316
323
|
case "installSkill":
|
|
324
|
+
case "uploadSessionSkill":
|
|
317
325
|
if (!envelope.canonical || envelope.direction !== "host-to-agent") {
|
|
318
326
|
tap(
|
|
319
|
-
"
|
|
327
|
+
"uploadSessionSkill rejected: requires __bladeBridge envelope with direction=host-to-agent",
|
|
320
328
|
true
|
|
321
329
|
);
|
|
322
330
|
console.warn(
|
|
323
|
-
"[parent-bridge]
|
|
331
|
+
"[parent-bridge] uploadSessionSkill rejected: requires __bladeBridge envelope with direction=host-to-agent"
|
|
324
332
|
);
|
|
325
333
|
return;
|
|
326
334
|
}
|
|
327
335
|
tap(void 0, false);
|
|
328
336
|
try {
|
|
329
|
-
const payload =
|
|
330
|
-
void
|
|
337
|
+
const payload = parseSessionSkillUploadPayload(envelope.payload);
|
|
338
|
+
void uploadSessionSkill(sessionId, payload).then(() => {
|
|
331
339
|
invalidateSkillStats(sessionId);
|
|
332
340
|
}).catch((error) => {
|
|
333
|
-
console.warn("[parent-bridge]
|
|
341
|
+
console.warn("[parent-bridge] uploadSessionSkill request failed", error);
|
|
334
342
|
});
|
|
335
343
|
} catch (error) {
|
|
336
|
-
console.warn("[parent-bridge] invalid
|
|
344
|
+
console.warn("[parent-bridge] invalid uploadSessionSkill payload", error);
|
|
337
345
|
}
|
|
338
346
|
return;
|
|
339
347
|
default:
|
|
@@ -861,7 +869,7 @@ function getToolDisplayLabel(toolCall) {
|
|
|
861
869
|
}
|
|
862
870
|
case "Bash": {
|
|
863
871
|
const description = getCommandDescription(args);
|
|
864
|
-
return description
|
|
872
|
+
return description || "\u6267\u884C\u547D\u4EE4\u884C\u64CD\u4F5C";
|
|
865
873
|
}
|
|
866
874
|
case "BgBash": {
|
|
867
875
|
const description = getCommandDescription(args);
|
|
@@ -2094,6 +2102,7 @@ var useGisStore = create10()((set, get) => ({
|
|
|
2094
2102
|
}));
|
|
2095
2103
|
|
|
2096
2104
|
// src/react/sockets/event-bridge.ts
|
|
2105
|
+
var OOM_MESSAGE = "\u6C99\u76D2\u5185\u5B58\u4F7F\u7528\u8D85\u51FA\u9650\u5236\uFF0C\u5DF2\u81EA\u52A8\u91CD\u542F\u3002\u5982\u679C\u7ECF\u5E38\u89E6\u53D1\uFF0C\u53EF\u4EE5\u8054\u7CFB\u7BA1\u7406\u5458\u8C03\u6574\u989D\u5EA6\u3002";
|
|
2097
2106
|
function extractSkillIdForAnalytics(message) {
|
|
2098
2107
|
const text = getTextContent(message);
|
|
2099
2108
|
const tagMatch = text.match(/<skill>([^<]+)<\/skill>/);
|
|
@@ -2181,7 +2190,7 @@ function notifyWorkspaceFilesChanged(sessionId, filePath) {
|
|
|
2181
2190
|
onWorkspaceFilesChanged?.({ sessionId, filePath });
|
|
2182
2191
|
}
|
|
2183
2192
|
function isRecord4(value) {
|
|
2184
|
-
return typeof value === "object" && value !== null;
|
|
2193
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2185
2194
|
}
|
|
2186
2195
|
function extractModeFromBlocks3(blocks) {
|
|
2187
2196
|
const modeBlock = blocks.find((block) => block.type === "mode_change");
|
|
@@ -2192,6 +2201,38 @@ function extractModeFromBlocks3(blocks) {
|
|
|
2192
2201
|
if (blocks.some((block) => block.type === "planning_exit")) return "executing";
|
|
2193
2202
|
return null;
|
|
2194
2203
|
}
|
|
2204
|
+
function parseJsonRecord(value) {
|
|
2205
|
+
if (isRecord4(value)) return value;
|
|
2206
|
+
if (typeof value !== "string") return null;
|
|
2207
|
+
try {
|
|
2208
|
+
const parsed = JSON.parse(value);
|
|
2209
|
+
return isRecord4(parsed) ? parsed : null;
|
|
2210
|
+
} catch {
|
|
2211
|
+
return null;
|
|
2212
|
+
}
|
|
2213
|
+
}
|
|
2214
|
+
var OOM_KEYWORDS_RE = /(?:\b(?:exit_code|ExitedWith|exited with)|退出码)\D*(?<!\d)137(?!\d)/i;
|
|
2215
|
+
function isOomText(value) {
|
|
2216
|
+
return typeof value === "string" && OOM_KEYWORDS_RE.test(value);
|
|
2217
|
+
}
|
|
2218
|
+
function isOomResult(value) {
|
|
2219
|
+
if (Array.isArray(value)) {
|
|
2220
|
+
return value.some((part) => isOomResult(part));
|
|
2221
|
+
}
|
|
2222
|
+
if (typeof value === "object" && value !== null) {
|
|
2223
|
+
const record = value;
|
|
2224
|
+
if (record.exit_code === 137) return true;
|
|
2225
|
+
if (typeof record.text === "string" && isOomText(record.text)) return true;
|
|
2226
|
+
if (typeof record.content === "string" && isOomText(record.content)) return true;
|
|
2227
|
+
return false;
|
|
2228
|
+
}
|
|
2229
|
+
if (typeof value === "string") {
|
|
2230
|
+
const parsed = parseJsonRecord(value);
|
|
2231
|
+
if (parsed?.exit_code === 137) return true;
|
|
2232
|
+
return isOomText(value);
|
|
2233
|
+
}
|
|
2234
|
+
return false;
|
|
2235
|
+
}
|
|
2195
2236
|
function hasAuthenticatedSession(client) {
|
|
2196
2237
|
if (hasTokenValue(resolveClientToken(client))) return true;
|
|
2197
2238
|
const { token, socketAuthToken, user } = useAuthStore.getState();
|
|
@@ -2279,6 +2320,7 @@ var AgentSocket = class {
|
|
|
2279
2320
|
previewArtifactsByToolCall = /* @__PURE__ */ new Map();
|
|
2280
2321
|
pendingReplayMessages = /* @__PURE__ */ new Map();
|
|
2281
2322
|
pendingReplayModes = /* @__PURE__ */ new Map();
|
|
2323
|
+
oomNotifiedKeys = /* @__PURE__ */ new Set();
|
|
2282
2324
|
_ensureConnected() {
|
|
2283
2325
|
if (this.socket.connected || this.socket.active) {
|
|
2284
2326
|
return;
|
|
@@ -2366,15 +2408,16 @@ var AgentSocket = class {
|
|
|
2366
2408
|
s.on("system:error", (data) => {
|
|
2367
2409
|
const sessionId = this._resolveSessionId(data);
|
|
2368
2410
|
if (sessionId) {
|
|
2411
|
+
const message = isOomText(data.message) ? OOM_MESSAGE : data.message;
|
|
2369
2412
|
useSessionStore.getState().updateSessionStatus(sessionId, "failed");
|
|
2370
2413
|
useChatStore.getState().markFailed(sessionId);
|
|
2371
|
-
useChatStore.getState().addErrorMessage(sessionId,
|
|
2414
|
+
useChatStore.getState().addErrorMessage(sessionId, message);
|
|
2372
2415
|
useChatStore.getState().setStreaming(sessionId, false);
|
|
2373
2416
|
useRuntimeStore.getState().addEvent(sessionId, {
|
|
2374
2417
|
type: "system:error",
|
|
2375
2418
|
title: "Runtime error",
|
|
2376
2419
|
status: "error",
|
|
2377
|
-
detail:
|
|
2420
|
+
detail: message
|
|
2378
2421
|
});
|
|
2379
2422
|
}
|
|
2380
2423
|
});
|
|
@@ -2551,6 +2594,9 @@ var AgentSocket = class {
|
|
|
2551
2594
|
}
|
|
2552
2595
|
_applyProjectionSideEffects(sessionId, turn) {
|
|
2553
2596
|
for (const block of turn.blocks) {
|
|
2597
|
+
if (block.type === "tool_result" && isOomResult(block.content)) {
|
|
2598
|
+
this._notifySandboxOom(sessionId, block.tool_call_id ?? turn.id);
|
|
2599
|
+
}
|
|
2554
2600
|
if (block.type === "tool_bridge" && isToolBridgeContent(block.content)) {
|
|
2555
2601
|
if (block.content.action === "gis.goals.updated" && isGisGoalListPayload(block.content.payload)) {
|
|
2556
2602
|
useGisStore.getState().setGoals(sessionId, block.content.payload.goals);
|
|
@@ -2617,6 +2663,25 @@ var AgentSocket = class {
|
|
|
2617
2663
|
}
|
|
2618
2664
|
this._applySystemNotification(sessionId, turn.loop_id, block.content);
|
|
2619
2665
|
}
|
|
2666
|
+
for (const toolCall of turn.tool_calls) {
|
|
2667
|
+
if (toolCall.status === "done" || toolCall.status === "error") {
|
|
2668
|
+
if (isOomResult(toolCall.result)) {
|
|
2669
|
+
this._notifySandboxOom(sessionId, toolCall.id);
|
|
2670
|
+
}
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2674
|
+
_notifySandboxOom(sessionId, key) {
|
|
2675
|
+
const dedupeKey = `${sessionId}:${key}`;
|
|
2676
|
+
if (this.oomNotifiedKeys.has(dedupeKey)) return;
|
|
2677
|
+
this.oomNotifiedKeys.add(dedupeKey);
|
|
2678
|
+
useChatStore.getState().addErrorMessage(sessionId, OOM_MESSAGE);
|
|
2679
|
+
useRuntimeStore.getState().addEvent(sessionId, {
|
|
2680
|
+
type: "sandbox:oom",
|
|
2681
|
+
title: "\u6C99\u76D2\u5185\u5B58\u8D85\u9650",
|
|
2682
|
+
status: "error",
|
|
2683
|
+
detail: OOM_MESSAGE
|
|
2684
|
+
});
|
|
2620
2685
|
}
|
|
2621
2686
|
_applySystemNotification(sessionId, loopId, notification) {
|
|
2622
2687
|
const notificationType = notification.notification_type ?? "system_notification";
|
|
@@ -2922,9 +2987,13 @@ export {
|
|
|
2922
2987
|
skills_exports,
|
|
2923
2988
|
partner_skill_exports,
|
|
2924
2989
|
PartnerSkillName,
|
|
2990
|
+
SessionSkillName,
|
|
2925
2991
|
PartnerSkillFile,
|
|
2992
|
+
SessionSkillFile,
|
|
2926
2993
|
PartnerSkillInstallPayload,
|
|
2994
|
+
SessionSkillUploadPayload,
|
|
2927
2995
|
PartnerSkillInstallResult,
|
|
2996
|
+
SessionSkillUploadResult,
|
|
2928
2997
|
useUiBridgeStore,
|
|
2929
2998
|
resourceBridgeDispatch,
|
|
2930
2999
|
isInsideIframe,
|
|
@@ -2983,4 +3052,4 @@ export {
|
|
|
2983
3052
|
bootstrapBladeClient,
|
|
2984
3053
|
getBootstrappedClient
|
|
2985
3054
|
};
|
|
2986
|
-
//# sourceMappingURL=chunk-
|
|
3055
|
+
//# sourceMappingURL=chunk-CDSCC4OQ.js.map
|