@blade-hq/agent-client 2612.0.0-beta.7 → 2612.0.0-beta.71
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 +352 -34
- package/dist/application-client.d.ts +19 -0
- package/dist/blade-client.d.ts +25 -9
- package/dist/{chunk-E7J2JBML.js → chunk-DMVWOTJB.js} +1588 -391
- package/dist/chunk-DMVWOTJB.js.map +1 -0
- package/dist/index.d.ts +18 -5
- package/dist/index.js +15 -1
- package/dist/internal.d.ts +12 -4
- package/dist/internal.js +29 -3
- package/dist/internal.js.map +1 -1
- package/dist/resources/auth.d.ts +9 -1
- package/dist/resources/computers.d.ts +2 -7
- package/dist/resources/connectors.d.ts +323 -0
- package/dist/resources/headless.d.ts +1 -1
- package/dist/resources/llm.d.ts +64 -0
- package/dist/resources/models.d.ts +6 -1
- package/dist/resources/phones.d.ts +109 -0
- package/dist/resources/plugins.d.ts +22 -0
- package/dist/resources/sandbox.d.ts +22 -0
- package/dist/resources/sessions.d.ts +105 -10
- package/dist/schemas/ask-user-question.d.ts +21 -0
- package/dist/schemas/context-attachments.d.ts +18 -0
- package/dist/schemas/message-utils.d.ts +3 -9
- package/dist/schemas/message.d.ts +16 -2
- package/dist/schemas/plugin-refs.d.ts +7 -0
- package/dist/schemas/projection.d.ts +14 -1
- package/dist/schemas/session.d.ts +2 -48
- package/dist/server-clock.d.ts +2 -0
- package/dist/session/agent-session.d.ts +44 -95
- package/dist/session/definition.d.ts +3 -0
- package/dist/session/events.d.ts +0 -1
- package/dist/session/hub.d.ts +0 -24
- package/dist/session/state.d.ts +8 -1
- package/dist/session/workflow.d.ts +10 -3
- package/dist/shared/projection/builder.d.ts +0 -2
- package/dist/shared/projection/index.d.ts +1 -0
- package/dist/shared/projection/workflow.d.ts +24 -0
- package/dist/tool-provider.d.ts +60 -0
- package/dist/types/socket-events.d.ts +167 -11
- package/dist/version.d.ts +0 -1
- package/node_modules/engine.io-client/build/cjs/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/cjs/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/cjs/index.js +1 -4
- package/node_modules/engine.io-client/build/cjs/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/cjs/socket.js +151 -218
- package/node_modules/engine.io-client/build/cjs/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/build/cjs/transports/polling-xhr.node.js +17 -7
- package/node_modules/engine.io-client/build/cjs/transports/websocket.node.js +17 -7
- package/node_modules/engine.io-client/build/esm/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/esm/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/esm/index.js +1 -2
- package/node_modules/engine.io-client/build/esm/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/esm/socket.js +141 -206
- package/node_modules/engine.io-client/build/esm/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/esm/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/build/esm-debug/globals.node.d.ts +2 -3
- package/node_modules/engine.io-client/build/esm-debug/index.d.ts +3 -3
- package/node_modules/engine.io-client/build/esm-debug/index.js +1 -2
- package/node_modules/engine.io-client/build/esm-debug/socket.d.ts +39 -82
- package/node_modules/engine.io-client/build/esm-debug/socket.js +150 -215
- package/node_modules/engine.io-client/build/esm-debug/transport.d.ts +1 -1
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.d.ts +4 -4
- package/node_modules/engine.io-client/build/esm-debug/transports/polling-xhr.js +2 -2
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js +3 -3
- package/node_modules/engine.io-client/dist/engine.io.esm.min.js.map +1 -1
- package/node_modules/engine.io-client/dist/engine.io.js +164 -239
- package/node_modules/engine.io-client/dist/engine.io.js.map +1 -1
- package/node_modules/engine.io-client/dist/engine.io.min.js +3 -3
- package/node_modules/engine.io-client/dist/engine.io.min.js.map +1 -1
- package/node_modules/engine.io-client/package.json +2 -2
- package/node_modules/socket.io-parser/build/cjs/binary.js +4 -1
- package/node_modules/socket.io-parser/build/cjs/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/cjs/index.js +18 -11
- package/node_modules/socket.io-parser/build/esm/binary.js +4 -1
- package/node_modules/socket.io-parser/build/esm/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/esm/index.js +14 -10
- package/node_modules/socket.io-parser/build/esm-debug/binary.js +4 -1
- package/node_modules/socket.io-parser/build/esm-debug/index.d.ts +14 -4
- package/node_modules/socket.io-parser/build/esm-debug/index.js +14 -10
- package/node_modules/socket.io-parser/package.json +1 -1
- package/node_modules/ws/index.js +15 -6
- package/node_modules/ws/lib/constants.js +1 -0
- package/node_modules/ws/lib/permessage-deflate.js +9 -7
- package/node_modules/ws/lib/receiver.js +37 -0
- package/node_modules/ws/lib/sender.js +6 -1
- package/node_modules/ws/lib/websocket-server.js +18 -6
- package/node_modules/ws/lib/websocket.js +50 -17
- package/node_modules/ws/package.json +8 -3
- package/node_modules/ws/wrapper.mjs +14 -1
- package/package.json +4 -4
- package/public-api.md +662 -36
- package/dist/chunk-E7J2JBML.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
+
export { BladeApplicationClient } from "./application-client";
|
|
1
2
|
export { BladeClient } from "./blade-client";
|
|
3
|
+
export { ConnectorsResource } from "./resources/connectors";
|
|
4
|
+
export type { ConnectorArtifact, ConnectorApprovalStatus, ConnectorDomain, ConnectorAuthorization, ConnectorAuthorizationAction, ConnectorAuthorizationOptions, ConnectorAuthorizationPlan, ConnectorCapability, ConnectorPermission, ConnectorAuthorizationFailure, ConnectorAuthorizationStep, ConnectorDiagnostics, ConnectorRuntimeDiagnostics, ConnectorAuditEvent, AccountConnector, ConnectorDraft, ConnectorConnection, ConnectorConnectionView } from "./resources/connectors";
|
|
2
5
|
export type { BladeClientOptions, UploadProgress } from "./blade-client";
|
|
3
6
|
export { BladeApiError } from "./rest";
|
|
4
7
|
export type { LoginOptions, LoginResult, TokenStorageMode } from "./auth-login";
|
|
5
8
|
export { SDK_NAME, SDK_VERSION } from "./version";
|
|
6
9
|
export { AgentSession } from "./session/agent-session";
|
|
7
|
-
export type { AttachAppOptions, SendOptions } from "./session/agent-session";
|
|
10
|
+
export type { AttachAppOptions, SendOptions, PreparedSend, PreparedSendOptions, DeliveryReceipt } from "./session/agent-session";
|
|
8
11
|
export { AgentSessionError } from "./session/errors";
|
|
9
12
|
export type { AgentSessionEvents, AgentSessionEventName } from "./session/events";
|
|
10
13
|
export type { WorkflowRunEntry, WorkflowRunState } from "./session/workflow";
|
|
11
14
|
export type { ActiveCompactionState, AgentLoopInfo, AskUserAnswerData, ConnectionStatus, ReplaySnapshot, SessionState, } from "./session/state";
|
|
15
|
+
export { parseAskUserQuestion, formatAskUserAnswer } from "./schemas/ask-user-question";
|
|
16
|
+
export type { AskUserQuestionOption, AskUserQuestionItem, AskUserQuestionData } from "./schemas/ask-user-question";
|
|
12
17
|
export { SessionSetupError } from "./session/definition";
|
|
13
18
|
export type { SessionConfig, SessionDefinition, SessionSetupStage, SkillDefinition, SkillFile, SolutionDefinition, TextFile, } from "./session/definition";
|
|
14
19
|
export type { QueuedMessage, QueuedMessageStatus, QueueOperationResult, SessionQueueSnapshot, } from "./session/queue";
|
|
@@ -20,16 +25,24 @@ export type { RunOptions, RunResult, RunTrace } from "./types/sdk-profile";
|
|
|
20
25
|
export type { ModelsResource, ModelCatalog, ModelOption } from "./resources/models";
|
|
21
26
|
export type { ComputersResource } from "./resources/computers";
|
|
22
27
|
export type { AccountComputer, SessionComputer } from "./resources/computers";
|
|
23
|
-
export type {
|
|
28
|
+
export type { PhoneDevice, PhoneHealth, PhoneList, PhoneAccessKey, PhonePipeline, PhoneState, PhonesResource, } from "./resources/phones";
|
|
29
|
+
export type { AppCliAttachment, AppCliDefinition, CreateSessionRequest, UpdateSessionConfigurationRequest, SessionConfiguration, SessionRunResult, McpSourceConfig, FileEntry, PaginatedSessionsResult, SessionsResource, SessionTurnsPage, SessionTurnsQuery, UploadFileEntry, UploadFilesOptions, } from "./resources/sessions";
|
|
24
30
|
export { DEFAULT_REPLAY_SPEED, SessionInfo, SessionStatus } from "./schemas/session";
|
|
25
31
|
export type { ReplaySpeed, ReplayState, SessionDetail } from "./schemas/session";
|
|
26
|
-
export type { ChatMessage, FileContentPart, ImageUrlContentPart, MemoryRefInfo, MessageContent, MessageContentPart, TextContentPart, ToolCallInfo, } from "./schemas/message";
|
|
32
|
+
export type { ChatMessage, FileContentPart, ImageUrlContentPart, MemoryRefInfo, MessageContent, MessageContentPart, TextContentPart, ToolCallInfo, WorkflowStepInfo, } from "./schemas/message";
|
|
27
33
|
export { chatErrorForDisplay, contentPreview, getFileParts, getImageParts, getTextContent, groupMessagesByLoop, transformSlashCommand, } from "./schemas/message-utils";
|
|
28
34
|
export type { SkillMentionAvailability } from "./schemas/message-utils";
|
|
29
35
|
export { userFacingErrorText } from "./shared/oom";
|
|
30
36
|
export { normalizeTopicAssetRefs } from "./schemas/topic-assets";
|
|
31
37
|
export type { TopicAssetRef } from "./schemas/topic-assets";
|
|
32
38
|
export type { ChatGroup, ChatGroupRole, ChatGroupMember, ChatGroupTask, CreateChatGroupTask, UpdateChatGroupTask, ChatGroupAsset, ChatGroupAssetList } from "./resources/chat-groups";
|
|
33
|
-
export { normalizePluginRefs } from "./schemas/plugin-refs";
|
|
34
|
-
export type { PluginRef } from "./schemas/plugin-refs";
|
|
39
|
+
export { normalizePluginRefs, normalizeMessageRefs } from "./schemas/plugin-refs";
|
|
40
|
+
export type { PluginRef, SkillRef, MessageRef } from "./schemas/plugin-refs";
|
|
35
41
|
export type { ToolEvidence } from "./schemas/projection";
|
|
42
|
+
export { ToolProvider } from "./tool-provider";
|
|
43
|
+
export type { ToolProviderOptions, ProviderTool, ProviderToolResult } from "./tool-provider";
|
|
44
|
+
export type { ContextAttachment } from "./schemas/context-attachments";
|
|
45
|
+
export { SandboxResource, type SandboxScriptRequest, type SandboxScriptResult } from "./resources/sandbox";
|
|
46
|
+
export type { LlmResource, ChatCompletionRequest, ChatCompletion } from "./resources/llm";
|
|
47
|
+
export type { FileOpenerInstance } from "./resources/sessions";
|
|
48
|
+
export type { PluginFileOpener } from "./resources/plugins";
|
package/dist/index.js
CHANGED
|
@@ -2,43 +2,57 @@ import {
|
|
|
2
2
|
AgentSession,
|
|
3
3
|
AgentSessionError,
|
|
4
4
|
BladeApiError,
|
|
5
|
+
BladeApplicationClient,
|
|
5
6
|
BladeClient,
|
|
7
|
+
ConnectorsResource,
|
|
6
8
|
DEFAULT_REPLAY_SPEED,
|
|
7
9
|
SDK_NAME,
|
|
8
10
|
SDK_VERSION,
|
|
11
|
+
SandboxResource,
|
|
9
12
|
SessionInfo,
|
|
10
13
|
SessionSetupError,
|
|
11
14
|
SessionStatus,
|
|
15
|
+
ToolProvider,
|
|
12
16
|
chatErrorForDisplay,
|
|
13
17
|
contentPreview,
|
|
18
|
+
formatAskUserAnswer,
|
|
14
19
|
getFileParts,
|
|
15
20
|
getImageParts,
|
|
16
21
|
getTextContent,
|
|
17
22
|
groupMessagesByLoop,
|
|
23
|
+
normalizeMessageRefs,
|
|
18
24
|
normalizePluginRefs,
|
|
19
25
|
normalizeTopicAssetRefs,
|
|
26
|
+
parseAskUserQuestion,
|
|
20
27
|
transformSlashCommand,
|
|
21
28
|
userFacingErrorText
|
|
22
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DMVWOTJB.js";
|
|
23
30
|
export {
|
|
24
31
|
AgentSession,
|
|
25
32
|
AgentSessionError,
|
|
26
33
|
BladeApiError,
|
|
34
|
+
BladeApplicationClient,
|
|
27
35
|
BladeClient,
|
|
36
|
+
ConnectorsResource,
|
|
28
37
|
DEFAULT_REPLAY_SPEED,
|
|
29
38
|
SDK_NAME,
|
|
30
39
|
SDK_VERSION,
|
|
40
|
+
SandboxResource,
|
|
31
41
|
SessionInfo,
|
|
32
42
|
SessionSetupError,
|
|
33
43
|
SessionStatus,
|
|
44
|
+
ToolProvider,
|
|
34
45
|
chatErrorForDisplay,
|
|
35
46
|
contentPreview,
|
|
47
|
+
formatAskUserAnswer,
|
|
36
48
|
getFileParts,
|
|
37
49
|
getImageParts,
|
|
38
50
|
getTextContent,
|
|
39
51
|
groupMessagesByLoop,
|
|
52
|
+
normalizeMessageRefs,
|
|
40
53
|
normalizePluginRefs,
|
|
41
54
|
normalizeTopicAssetRefs,
|
|
55
|
+
parseAskUserQuestion,
|
|
42
56
|
transformSlashCommand,
|
|
43
57
|
userFacingErrorText
|
|
44
58
|
};
|
package/dist/internal.d.ts
CHANGED
|
@@ -10,15 +10,17 @@ export type { ChatEndPayload, SessionDetailSnapshot } from "./session/agent-sess
|
|
|
10
10
|
export { isWorkflowRunToolName, workflowEntriesFromOutput, workflowNameFromArguments, } from "./session/workflow";
|
|
11
11
|
export { isMcpAppData } from "./schemas/mcp-app";
|
|
12
12
|
export type { McpAppArchive, McpAppContextState, McpAppContextUpdate, McpAppData, } from "./schemas/mcp-app";
|
|
13
|
-
export { applyTurnPatch, createInitialSessionState, parentForkToolCallIdFromTurn, upsertTurn, withTurns, reconcileHistoricalUserTurns, reconcileOptimisticUserTurns, toReplaySnapshot, } from "./session/state";
|
|
13
|
+
export { applyTurnPatch, createInitialSessionState, parentForkToolCallIdFromTurn, messageContentFromTurn, upsertTurn, withTurns, reconcileHistoricalUserTurns, reconcileOptimisticUserTurns, toReplaySnapshot, } from "./session/state";
|
|
14
14
|
export { EMPTY_SESSION_QUEUE, canCancelQueuedMessage, canDeliverQueuedMessage, canEditQueuedMessage, isSessionQueueSnapshot, parseQueueAck, queuePauseReasonLabel, queuedMessageStatusLabel, shouldApplySnapshot, } from "./session/queue";
|
|
15
15
|
export type { QueueAck } from "./session/queue";
|
|
16
16
|
export { prependOlder, replaceWindow } from "./session/history-page";
|
|
17
17
|
export type { LiveRevisionState } from "./session/history-page";
|
|
18
18
|
export type { CommandEnvelope, InboundAction, InboundEnvelope } from "./commands/protocol";
|
|
19
19
|
export { isCommandEnvelope, isInboundEnvelope } from "./commands/protocol";
|
|
20
|
-
export {
|
|
20
|
+
export { computerDaemonVersion, computerOS, computerPlatformLabel, computerState, sortComputers, } from "./resources/computers";
|
|
21
21
|
export type { AccountComputerList, ComputerOS, ComputerState, SessionComputerList, } from "./resources/computers";
|
|
22
|
+
export { phoneSerialLabel, phoneState, sortPhones, } from "./resources/phones";
|
|
23
|
+
export type { PhoneDevice, PhoneHealth, PhoneList, PhonePipeline, PhoneState } from "./resources/phones";
|
|
22
24
|
export { ModelsResource } from "./resources/models";
|
|
23
25
|
export { ComputersResource } from "./resources/computers";
|
|
24
26
|
export type { SessionPlugin, SessionPluginActivation } from "./resources/sessions";
|
|
@@ -26,6 +28,8 @@ export type { SessionPluginConfigError, SessionPluginConfigSet, SessionPluginCon
|
|
|
26
28
|
export { ChatGroupsResource } from "./resources/chat-groups";
|
|
27
29
|
export type { ChatGroup, ChatGroupRole, ChatGroupMember, ChatGroupTask, CreateChatGroupTask, UpdateChatGroupTask, ChatGroupAsset, ChatGroupAssetList } from "./resources/chat-groups";
|
|
28
30
|
export { PluginsResource } from "./resources/plugins";
|
|
31
|
+
export { ConnectorsResource } from "./resources/connectors";
|
|
32
|
+
export type { ConnectorArtifact, ConnectorApprovalStatus, ConnectorDomain, ConnectorAuthorization, ConnectorAuthorizationAction, ConnectorAuthorizationOptions, ConnectorAuthorizationPlan, ConnectorCapability, ConnectorPermission, ConnectorAuthorizationFailure, ConnectorAuthorizationStep, ConnectorDiagnostics, ConnectorRuntimeDiagnostics, ConnectorAuditEvent, AccountConnector, ConnectorDraft, ConnectorConnection, ConnectorConnectionView } from "./resources/connectors";
|
|
29
33
|
export type { PluginCatalogEntry } from "./resources/plugins";
|
|
30
34
|
export type { SiteVisitsResource, SiteVisitsSummary } from "./resources/site-visits";
|
|
31
35
|
export type { GlobalSearchConversationResult, GlobalSearchFileResult, GlobalSearchResult, GlobalSearchResultItem, HistoricalCommand, ImportSessionOptions, ResultFeedback, ResultFeedbackReason, SessionContextStats, SessionHistory, SessionTurnIndex, SessionTurnIndexItem, ShareLinkResult, } from "./resources/sessions";
|
|
@@ -36,11 +40,11 @@ export { buildMessageContent, extractTextAttachments, isBackgroundWakeMessage, i
|
|
|
36
40
|
export type { ParsedTextAttachment, ParsedTextContext } from "./schemas/message-utils";
|
|
37
41
|
export { contextProjectionData, getContextDisplayState, getContextGroupDisplayState, groupAdjacentContextRuns, } from "./schemas/context";
|
|
38
42
|
export type { ContextAction, ContextDisplayState, ContextGroupDisplayState, ContextProjectionData, ContextProjectionFields, ContextSourceInfo, } from "./schemas/context";
|
|
39
|
-
export type { ContentBlock, FinalArtifact, MemoryRef, PatchEnvelope, PendingQuestionRef, PostChatFollowup, RunTiming, ToolCallProjection, TurnProjection, } from "./schemas/projection";
|
|
43
|
+
export type { ContentBlock, FinalArtifact, MemoryRef, PatchEnvelope, PendingQuestionRef, PostChatFollowup, RunTiming, ToolCallProjection, WorkflowStepProjection, TurnProjection, } from "./schemas/projection";
|
|
40
44
|
export { latestPostChatFollowup } from "./schemas/projection-utils";
|
|
41
45
|
export { buildToolUiCardKey, collectInlineToolUiCards, collectPreviewToolUiCards, isAppDevToolUiCard, isInternalStatusToolUiCard, isToolUiCard, resolveToolUiCardContent, } from "./shared/tool-ui-card";
|
|
42
46
|
export type { InlineToolUiCardEntry, PreviewToolUiCardEntry, ToolUiCard, ToolUiCardContentType, } from "./shared/tool-ui-card";
|
|
43
|
-
export type { ModeId,
|
|
47
|
+
export type { ModeId, PublishedSolutionRef, ReplayPreview, SessionPortMapping, SessionSearchMatch, } from "./schemas/session";
|
|
44
48
|
export { LayoutType } from "./schemas/solution";
|
|
45
49
|
export type { BizRole, Solution, SolutionAppField, SolutionAppState, SolutionAppUiConfig, } from "./schemas/solution";
|
|
46
50
|
export { Task, TaskStatus } from "./schemas/task";
|
|
@@ -58,3 +62,7 @@ export type { TopicAssetRef } from "./schemas/topic-assets";
|
|
|
58
62
|
export { normalizePluginRefs } from "./schemas/plugin-refs";
|
|
59
63
|
export type { PluginRef } from "./schemas/plugin-refs";
|
|
60
64
|
export type { ToolEvidence } from "./schemas/projection";
|
|
65
|
+
export { getServerTime, syncServerTime } from "./server-clock";
|
|
66
|
+
export { isLocalConnectorName } from "./resources/connectors";
|
|
67
|
+
export type { FileOpenerInstance } from "./resources/sessions";
|
|
68
|
+
export type { PluginFileOpener } from "./resources/plugins";
|
package/dist/internal.js
CHANGED
|
@@ -3,10 +3,12 @@ import {
|
|
|
3
3
|
AgentSessionError,
|
|
4
4
|
AuthBusyReconnect,
|
|
5
5
|
BladeApiError,
|
|
6
|
+
BladeApplicationClient,
|
|
6
7
|
BladeClient,
|
|
7
8
|
ChatGroupsResource,
|
|
8
9
|
ClientProjectionBuilder,
|
|
9
10
|
ComputersResource,
|
|
11
|
+
ConnectorsResource,
|
|
10
12
|
DEFAULT_REPLAY_SPEED,
|
|
11
13
|
EMPTY_SESSION_QUEUE,
|
|
12
14
|
ModelsResource,
|
|
@@ -14,10 +16,12 @@ import {
|
|
|
14
16
|
PluginsResource,
|
|
15
17
|
SDK_NAME,
|
|
16
18
|
SDK_VERSION,
|
|
19
|
+
SandboxResource,
|
|
17
20
|
SessionHub,
|
|
18
21
|
SessionInfo,
|
|
19
22
|
SessionSetupError,
|
|
20
23
|
SessionStatus,
|
|
24
|
+
ToolProvider,
|
|
21
25
|
acceptedPostChatFollowupCompletesLatestRun,
|
|
22
26
|
acknowledgeTurnEvents,
|
|
23
27
|
applyTurnPatch,
|
|
@@ -27,7 +31,6 @@ import {
|
|
|
27
31
|
canCancelQueuedMessage,
|
|
28
32
|
canDeliverQueuedMessage,
|
|
29
33
|
canEditQueuedMessage,
|
|
30
|
-
canToggleComputer,
|
|
31
34
|
chatErrorForDisplay,
|
|
32
35
|
collectInlineToolUiCards,
|
|
33
36
|
collectPreviewToolUiCards,
|
|
@@ -40,10 +43,12 @@ import {
|
|
|
40
43
|
createInitialSessionState,
|
|
41
44
|
createSocket,
|
|
42
45
|
extractTextAttachments,
|
|
46
|
+
formatAskUserAnswer,
|
|
43
47
|
getContextDisplayState,
|
|
44
48
|
getContextGroupDisplayState,
|
|
45
49
|
getFileParts,
|
|
46
50
|
getImageParts,
|
|
51
|
+
getServerTime,
|
|
47
52
|
getTextContent,
|
|
48
53
|
groupAdjacentContextRuns,
|
|
49
54
|
groupMessagesByLoop,
|
|
@@ -54,17 +59,23 @@ import {
|
|
|
54
59
|
isEntryGoneError,
|
|
55
60
|
isHiddenInternalMessage,
|
|
56
61
|
isInternalStatusToolUiCard,
|
|
62
|
+
isLocalConnectorName,
|
|
57
63
|
isMcpAppData,
|
|
58
64
|
isOomText,
|
|
59
65
|
isRecord,
|
|
60
66
|
isSessionQueueSnapshot,
|
|
61
67
|
isToolUiCard,
|
|
62
68
|
isWorkflowRunToolName,
|
|
69
|
+
messageContentFromTurn,
|
|
63
70
|
normalizeMessageContent,
|
|
71
|
+
normalizeMessageRefs,
|
|
64
72
|
normalizePluginRefs,
|
|
65
73
|
normalizeTopicAssetRefs,
|
|
66
74
|
parentForkToolCallIdFromTurn,
|
|
75
|
+
parseAskUserQuestion,
|
|
67
76
|
parseQueueAck,
|
|
77
|
+
phoneSerialLabel,
|
|
78
|
+
phoneState,
|
|
68
79
|
prependOlder,
|
|
69
80
|
queuePauseReasonLabel,
|
|
70
81
|
queuedMessageStatusLabel,
|
|
@@ -75,6 +86,8 @@ import {
|
|
|
75
86
|
sessionStatusFromChatEnd,
|
|
76
87
|
shouldApplySnapshot,
|
|
77
88
|
sortComputers,
|
|
89
|
+
sortPhones,
|
|
90
|
+
syncServerTime,
|
|
78
91
|
toReplaySnapshot,
|
|
79
92
|
transformSlashCommand,
|
|
80
93
|
upsertTurn,
|
|
@@ -82,7 +95,7 @@ import {
|
|
|
82
95
|
withTurns,
|
|
83
96
|
workflowEntriesFromOutput,
|
|
84
97
|
workflowNameFromArguments
|
|
85
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-DMVWOTJB.js";
|
|
86
99
|
|
|
87
100
|
// src/polling-backoff.ts
|
|
88
101
|
var MAX_BACKOFF_MS = 6e4;
|
|
@@ -252,10 +265,12 @@ export {
|
|
|
252
265
|
AgentSessionError,
|
|
253
266
|
AuthBusyReconnect,
|
|
254
267
|
BladeApiError,
|
|
268
|
+
BladeApplicationClient,
|
|
255
269
|
BladeClient,
|
|
256
270
|
ChatGroupsResource,
|
|
257
271
|
ClientProjectionBuilder,
|
|
258
272
|
ComputersResource,
|
|
273
|
+
ConnectorsResource,
|
|
259
274
|
DEFAULT_REPLAY_SPEED,
|
|
260
275
|
EMPTY_PLATFORM_ENDPOINTS,
|
|
261
276
|
EMPTY_SESSION_QUEUE,
|
|
@@ -266,12 +281,14 @@ export {
|
|
|
266
281
|
PollingBackoff,
|
|
267
282
|
SDK_NAME,
|
|
268
283
|
SDK_VERSION,
|
|
284
|
+
SandboxResource,
|
|
269
285
|
SessionHub,
|
|
270
286
|
SessionInfo,
|
|
271
287
|
SessionSetupError,
|
|
272
288
|
SessionStatus,
|
|
273
289
|
Task,
|
|
274
290
|
TaskStatus,
|
|
291
|
+
ToolProvider,
|
|
275
292
|
acceptedPostChatFollowupCompletesLatestRun,
|
|
276
293
|
acknowledgeTurnEvents,
|
|
277
294
|
applyTurnPatch,
|
|
@@ -281,7 +298,6 @@ export {
|
|
|
281
298
|
canCancelQueuedMessage,
|
|
282
299
|
canDeliverQueuedMessage,
|
|
283
300
|
canEditQueuedMessage,
|
|
284
|
-
canToggleComputer,
|
|
285
301
|
chatErrorForDisplay,
|
|
286
302
|
collectInlineToolUiCards,
|
|
287
303
|
collectPreviewToolUiCards,
|
|
@@ -294,10 +310,12 @@ export {
|
|
|
294
310
|
createInitialSessionState,
|
|
295
311
|
createSocket,
|
|
296
312
|
extractTextAttachments,
|
|
313
|
+
formatAskUserAnswer,
|
|
297
314
|
getContextDisplayState,
|
|
298
315
|
getContextGroupDisplayState,
|
|
299
316
|
getFileParts,
|
|
300
317
|
getImageParts,
|
|
318
|
+
getServerTime,
|
|
301
319
|
getTextContent,
|
|
302
320
|
groupAdjacentContextRuns,
|
|
303
321
|
groupMessagesByLoop,
|
|
@@ -310,6 +328,7 @@ export {
|
|
|
310
328
|
isHiddenInternalMessage,
|
|
311
329
|
isInboundEnvelope,
|
|
312
330
|
isInternalStatusToolUiCard,
|
|
331
|
+
isLocalConnectorName,
|
|
313
332
|
isMcpAppData,
|
|
314
333
|
isOomText,
|
|
315
334
|
isSessionQueueSnapshot,
|
|
@@ -317,11 +336,16 @@ export {
|
|
|
317
336
|
isWorkflowRunToolName,
|
|
318
337
|
latestPostChatFollowup,
|
|
319
338
|
loadPlatformEndpoints,
|
|
339
|
+
messageContentFromTurn,
|
|
320
340
|
normalizeMessageContent,
|
|
341
|
+
normalizeMessageRefs,
|
|
321
342
|
normalizePluginRefs,
|
|
322
343
|
normalizeTopicAssetRefs,
|
|
323
344
|
parentForkToolCallIdFromTurn,
|
|
345
|
+
parseAskUserQuestion,
|
|
324
346
|
parseQueueAck,
|
|
347
|
+
phoneSerialLabel,
|
|
348
|
+
phoneState,
|
|
325
349
|
prependOlder,
|
|
326
350
|
queuePauseReasonLabel,
|
|
327
351
|
queuedMessageStatusLabel,
|
|
@@ -333,6 +357,8 @@ export {
|
|
|
333
357
|
sessionStatusFromChatEnd,
|
|
334
358
|
shouldApplySnapshot,
|
|
335
359
|
sortComputers,
|
|
360
|
+
sortPhones,
|
|
361
|
+
syncServerTime,
|
|
336
362
|
toReplaySnapshot,
|
|
337
363
|
transformSlashCommand,
|
|
338
364
|
upsertTurn,
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/polling-backoff.ts","../src/platform-endpoints.ts","../src/commands/protocol.ts","../src/schemas/projection-utils.ts","../src/schemas/solution.ts","../src/schemas/task.ts"],"sourcesContent":["import { BladeApiError } from \"./rest\"\n\nconst MAX_BACKOFF_MS = 60_000\nconst MAX_TIMER_MS = 2_147_483_647\n\n/** Scheduling policy for read-only polling; never sends or replays a request. */\nexport class PollingBackoff {\n private failures = 0\n private nextAt: number | false = 0\n\n constructor(private readonly intervalMs: number) {\n if (!Number.isFinite(intervalMs) || intervalMs <= 0 || intervalMs > MAX_BACKOFF_MS) {\n throw new RangeError(\"Polling interval must be between 0 and 60000 ms\")\n }\n }\n\n reset(): void {\n this.failures = 0\n this.nextAt = 0\n }\n\n failed(error: unknown): void {\n if (\n (error instanceof Error && error.name === \"AbortError\") ||\n (error instanceof BladeApiError && error.status < 500 &&\n error.status !== 408 && error.status !== 429)\n ) {\n this.nextAt = false\n return\n }\n this.failures = Math.min(this.failures + 1, 10)\n const ceiling = Math.min(MAX_BACKOFF_MS, this.intervalMs * 2 ** this.failures)\n const backoff = Math.max(this.intervalMs, ceiling * (0.5 + Math.random() * 0.5))\n const header = error instanceof BladeApiError\n ? error.response.headers.get(\"Retry-After\")?.trim()\n : undefined\n const retryAfter = header\n ? /^\\d+$/.test(header) ? Number(header) * 1000 : Date.parse(header) - Date.now()\n : 0\n const delay = Math.max(backoff, Number.isNaN(retryAfter) ? 0 : retryAfter)\n // Oversized server delays must not overflow browser timers into a hot loop.\n this.nextAt = delay > MAX_TIMER_MS ? false : Date.now() + delay\n }\n\n /** Zero means ready, false means stop, otherwise wait at least this many ms. */\n waitMs(): number | false {\n return this.nextAt === false ? false : Math.max(0, this.nextAt - Date.now())\n }\n}\n","import { isRecord } from \"./shared/type-guards\"\n\nexport const PLATFORM_SERVICE_NAMES = [\n \"os\",\n \"hub\",\n \"agent\",\n \"oauth\",\n \"llmGateway\",\n \"gitea\",\n \"tile\",\n] as const\n\nexport type PlatformServiceName = (typeof PLATFORM_SERVICE_NAMES)[number]\n\nexport interface PlatformEndpoints {\n services: Partial<Record<PlatformServiceName, string>>\n}\n\nexport const EMPTY_PLATFORM_ENDPOINTS: PlatformEndpoints = Object.freeze({\n services: Object.freeze({}),\n})\n\nexport interface LoadPlatformEndpointsOptions {\n baseUrl?: string\n fetchImpl?: typeof fetch\n timeoutMs?: number\n}\n\nfunction defaultDocumentBaseUrl(): string | undefined {\n if (typeof document === \"undefined\") return undefined\n if (document.querySelector(\"base[href]\")) return document.baseURI\n if (typeof location !== \"undefined\" && location.origin) return `${location.origin}/`\n return document.baseURI\n}\n\nfunction normalizeServiceUrl(value: unknown): string | null {\n if (typeof value !== \"string\" || !value.trim()) return null\n if (value.includes(\"?\") || value.includes(\"#\")) return null\n try {\n const url = new URL(value.trim())\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return null\n if (url.username || url.password || url.search || url.hash) return null\n return url.toString().replace(/\\/$/, \"\")\n } catch {\n return null\n }\n}\n\nexport function parsePlatformEndpoints(value: unknown): PlatformEndpoints | null {\n if (!isRecord(value) || !isRecord(value.services)) return null\n\n const services: Partial<Record<PlatformServiceName, string>> = {}\n for (const name of PLATFORM_SERVICE_NAMES) {\n if (!(name in value.services)) continue\n const url = normalizeServiceUrl(value.services[name])\n if (!url) return null\n if (name === \"agent\" && new URL(url).pathname !== \"/\") return null\n services[name] = url\n }\n\n return { services }\n}\n\nexport async function loadPlatformEndpoints(\n options: LoadPlatformEndpointsOptions = {},\n): Promise<PlatformEndpoints> {\n const fetchImpl = options.fetchImpl ?? globalThis.fetch\n const baseUrl = options.baseUrl ?? defaultDocumentBaseUrl()\n if (!fetchImpl || !baseUrl) return EMPTY_PLATFORM_ENDPOINTS\n\n const controller = new AbortController()\n const timeout = globalThis.setTimeout(() => controller.abort(), options.timeoutMs ?? 3_000)\n try {\n const response = await fetchImpl(new URL(\"config.json\", baseUrl), {\n cache: \"no-store\",\n credentials: \"same-origin\",\n headers: { Accept: \"application/json\" },\n signal: controller.signal,\n })\n if (!response.ok) return EMPTY_PLATFORM_ENDPOINTS\n return parsePlatformEndpoints(await response.json()) ?? EMPTY_PLATFORM_ENDPOINTS\n } catch {\n return EMPTY_PLATFORM_ENDPOINTS\n } finally {\n globalThis.clearTimeout(timeout)\n }\n}\n\nexport function resolveServiceUrl(\n endpoints: PlatformEndpoints,\n name: PlatformServiceName,\n path = \"\",\n): string | null {\n const baseUrl = endpoints.services[name]\n if (!baseUrl) return null\n if (!path) return baseUrl\n const pathReference = path.trimStart()\n if (\n path.includes(\"\\\\\") ||\n pathReference.startsWith(\"//\") ||\n /^[a-z][a-z0-9+.-]*:/i.test(pathReference)\n ) {\n return null\n }\n const base = new URL(`${baseUrl}/`)\n const target = new URL(path.replace(/^\\/+/, \"\"), base)\n if (target.origin !== base.origin || !target.pathname.startsWith(base.pathname)) {\n return null\n }\n return target.toString()\n}\n","/**\n * 页面协作协议(对应后端 `_meta.bridge` 通道,见 docs/specs/260417-embed-bridge)。\n *\n * ## action 从哪里来\n *\n * 智能体 → 宿主方向的每一条指令,都源自**技能作者写的工具代码**:工具返回值\n * JSON 里带 `_meta.bridge: { action, payload }`,后端在持久化前把它剥离成独立\n * 事件送达前端(LLM 的对话历史里读不到它)。因此:\n *\n * - action 字符串(如 \"map.highlight\")是**技能作者与宿主页面开发者之间的业务\n * 契约**,LLM 不参与协议、SDK 不做枚举校验;\n * - 宿主页面用 `session.onCommand(\"map.highlight\", fn)` 消费;\n * - 未注册 handler 的 action 会进入有限缓冲等待注册,超限后丢弃并 console 告警。\n *\n * 宿主 → 智能体方向只有三个白名单动作:attach(附件入输入框)/ insertText\n * (追加输入文本)/ send(直接发消息),对应协议层的 addContext / appendInput /\n * sendMessage。\n */\n\nexport interface CommandEnvelope {\n __bladeBridge: true\n direction: \"agent-to-host\"\n action: string\n payload: unknown\n meta: {\n sessionId: string\n toolCallId?: string\n timestamp: number\n }\n}\n\nexport type InboundAction = \"addContext\" | \"appendInput\" | \"sendMessage\"\n\nexport interface InboundEnvelope {\n __bladeBridge: true\n direction: \"host-to-agent\"\n action: InboundAction\n payload: unknown\n}\n\nexport function isCommandEnvelope(value: unknown): value is CommandEnvelope {\n if (typeof value !== \"object\" || value === null) return false\n const record = value as Record<string, unknown>\n return (\n record.__bladeBridge === true &&\n record.direction === \"agent-to-host\" &&\n typeof record.action === \"string\"\n )\n}\n\nexport function isInboundEnvelope(value: unknown): value is InboundEnvelope {\n if (typeof value !== \"object\" || value === null) return false\n const record = value as Record<string, unknown>\n return (\n record.__bladeBridge === true &&\n record.direction === \"host-to-agent\" &&\n (record.action === \"addContext\" || record.action === \"appendInput\" || record.action === \"sendMessage\")\n )\n}\n","import type { PostChatFollowup, TurnProjection } from \"./projection\"\n\n/** 返回最新根会话轮次的小结;新用户消息到达后旧小结立即失效。 */\nexport function latestPostChatFollowup(turns: TurnProjection[]): PostChatFollowup | null {\n for (let index = turns.length - 1; index >= 0; index -= 1) {\n const turn = turns[index]\n if (\n turn.loop_id === \"root\" &&\n (turn.role === \"user\" || turn.role === \"assistant\") &&\n (turn.kind ?? \"message\") === \"message\" &&\n !turn.blocks.some((block) =>\n [\"mode_change\", \"plan_status\", \"ask_user_answer\"].includes(block.type),\n )\n ) {\n return turn.role === \"assistant\" ? (turn.post_chat_followup ?? null) : null\n }\n }\n return null\n}\n","export enum LayoutType {\n Default = \"default\",\n SkillEditor = \"skill-editor\",\n SolutionEditor = \"solution-editor\",\n SolutionApp = \"solution-app\",\n Custom = \"custom\",\n}\n\nexport interface Solution {\n id: string\n name: string\n version: string\n description?: string | null\n source?: \"builtin\" | \"personal\" | string | null\n layout_type: LayoutType | string\n initial_mode?: \"planning\" | \"executing\" | string | null\n initial_message?: string | null\n preview?: { url: string; title?: string | null } | null\n layout?: {\n available?: boolean\n source_dir?: string\n entry?: string\n export?: string\n } | null\n roles?: BizRole[] | null\n data?: Record<string, unknown> | null\n ui_config?: SolutionAppUiConfig | null\n}\n\nexport interface SolutionAppUiConfig {\n branding: {\n name: string\n subtitle?: string\n icon_text: string\n icon_gradient?: string\n }\n list: {\n title: string\n create_button: string\n card?: {\n subtitle?: string\n stats?: Array<{\n label: string\n value: string\n color?: string\n }>\n }\n }\n create: {\n title: string\n description?: string\n submit_button: string\n sections: Array<{\n id: string\n title: string\n description?: string\n fields: Array<SolutionAppField>\n }>\n }\n}\n\nexport type SolutionAppField =\n | {\n id: string\n kind: \"textarea\"\n label: string\n placeholder?: string\n }\n | {\n id: string\n kind: \"file-upload\"\n accept?: string[]\n categories?: Array<{\n label: string\n description: string\n color: string\n }>\n }\n\nexport interface SolutionAppState {\n pipeline: Array<{\n id: string\n label: string\n status: \"done\" | \"active\" | \"pending\" | \"error\"\n }>\n meta: Record<\n string,\n {\n label: string\n value: string\n color?: string\n }\n >\n}\n\nexport interface BizRole {\n id: string\n name: string\n description?: string | null\n preview?: { url: string; title?: string | null } | null\n}\n","import { type } from \"arktype\"\n\nexport const TaskStatus = type(\"'pending' | 'in_progress' | 'done' | 'failed' | 'skipped'\")\nexport type TaskStatus = typeof TaskStatus.infer\n\nexport const Task = type({\n id: \"string\",\n goal: \"string\",\n skills: \"string[]\",\n depends_on: \"string[]\",\n status: TaskStatus,\n result_summary: \"string\",\n number: \"string\",\n})\nexport type Task = typeof Task.infer\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,iBAAiB;AACvB,IAAM,eAAe;AAGd,IAAM,iBAAN,MAAqB;AAAA,EAI1B,YAA6B,YAAoB;AAApB;AAC3B,QAAI,CAAC,OAAO,SAAS,UAAU,KAAK,cAAc,KAAK,aAAa,gBAAgB;AAClF,YAAM,IAAI,WAAW,iDAAiD;AAAA,IACxE;AAAA,EACF;AAAA,EAJ6B;AAAA,EAHrB,WAAW;AAAA,EACX,SAAyB;AAAA,EAQjC,QAAc;AACZ,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAO,OAAsB;AAC3B,QACG,iBAAiB,SAAS,MAAM,SAAS,gBACzC,iBAAiB,iBAAiB,M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KAAK,SAAS,iBACtC,KAAK,QAAQ,eAAe,aAC7B,CAAC,KAAK,OAAO;AAAA,MAAK,CAAC,UACjB,CAAC,eAAe,eAAe,iBAAiB,EAAE,SAAS,MAAM,IAAI;AAAA,IACvE,GACA;AACA,aAAO,KAAK,SAAS,cAAe,KAAK,sBAAsB,OAAQ;AAAA,IACzE;AAAA,EACF;AACA,SAAO;AACT;;;AClBO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,aAAU;AACV,EAAAA,YAAA,iBAAc;AACd,EAAAA,YAAA,oBAAiB;AACjB,EAAAA,YAAA,iBAAc;AACd,EAAAA,YAAA,YAAS;AALC,SAAAA;AAAA,GAAA;;;ACAZ,SAAS,YAAY;AAEd,IAAM,aAAa,KAAK,2DAA2D;AAGnF,IAAM,OAAO,KAAK;AAAA,EACvB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,QAAQ;AACV,CAAC;","names":["LayoutType"]}
|
|
1
|
+
{"version":3,"sources":["../src/polling-backoff.ts","../src/platform-endpoints.ts","../src/commands/protocol.ts","../src/schemas/projection-utils.ts","../src/schemas/solution.ts","../src/schemas/task.ts"],"sourcesContent":["import { BladeApiError } from \"./rest\"\n\nconst MAX_BACKOFF_MS = 60_000\nconst MAX_TIMER_MS = 2_147_483_647\n\n/** Scheduling policy for read-only polling; never sends or replays a request. */\nexport class PollingBackoff {\n private failures = 0\n private nextAt: number | false = 0\n\n constructor(private readonly intervalMs: number) {\n if (!Number.isFinite(intervalMs) || intervalMs <= 0 || intervalMs > MAX_BACKOFF_MS) {\n throw new RangeError(\"Polling interval must be between 0 and 60000 ms\")\n }\n }\n\n reset(): void {\n this.failures = 0\n this.nextAt = 0\n }\n\n failed(error: unknown): void {\n if (\n (error instanceof Error && error.name === \"AbortError\") ||\n (error instanceof BladeApiError && error.status < 500 &&\n error.status !== 408 && error.status !== 429)\n ) {\n this.nextAt = false\n return\n }\n this.failures = Math.min(this.failures + 1, 10)\n const ceiling = Math.min(MAX_BACKOFF_MS, this.intervalMs * 2 ** this.failures)\n const backoff = Math.max(this.intervalMs, ceiling * (0.5 + Math.random() * 0.5))\n const header = error instanceof BladeApiError\n ? error.response.headers.get(\"Retry-After\")?.trim()\n : undefined\n const retryAfter = header\n ? /^\\d+$/.test(header) ? Number(header) * 1000 : Date.parse(header) - Date.now()\n : 0\n const delay = Math.max(backoff, Number.isNaN(retryAfter) ? 0 : retryAfter)\n // Oversized server delays must not overflow browser timers into a hot loop.\n this.nextAt = delay > MAX_TIMER_MS ? false : Date.now() + delay\n }\n\n /** Zero means ready, false means stop, otherwise wait at least this many ms. */\n waitMs(): number | false {\n return this.nextAt === false ? false : Math.max(0, this.nextAt - Date.now())\n }\n}\n","import { isRecord } from \"./shared/type-guards\"\n\nexport const PLATFORM_SERVICE_NAMES = [\n \"os\",\n \"hub\",\n \"agent\",\n \"oauth\",\n \"llmGateway\",\n \"gitea\",\n \"tile\",\n] as const\n\nexport type PlatformServiceName = (typeof PLATFORM_SERVICE_NAMES)[number]\n\nexport interface PlatformEndpoints {\n services: Partial<Record<PlatformServiceName, string>>\n}\n\nexport const EMPTY_PLATFORM_ENDPOINTS: PlatformEndpoints = Object.freeze({\n services: Object.freeze({}),\n})\n\nexport interface LoadPlatformEndpointsOptions {\n baseUrl?: string\n fetchImpl?: typeof fetch\n timeoutMs?: number\n}\n\nfunction defaultDocumentBaseUrl(): string | undefined {\n if (typeof document === \"undefined\") return undefined\n if (document.querySelector(\"base[href]\")) return document.baseURI\n if (typeof location !== \"undefined\" && location.origin) return `${location.origin}/`\n return document.baseURI\n}\n\nfunction normalizeServiceUrl(value: unknown): string | null {\n if (typeof value !== \"string\" || !value.trim()) return null\n if (value.includes(\"?\") || value.includes(\"#\")) return null\n try {\n const url = new URL(value.trim())\n if (url.protocol !== \"http:\" && url.protocol !== \"https:\") return null\n if (url.username || url.password || url.search || url.hash) return null\n return url.toString().replace(/\\/$/, \"\")\n } catch {\n return null\n }\n}\n\nexport function parsePlatformEndpoints(value: unknown): PlatformEndpoints | null {\n if (!isRecord(value) || !isRecord(value.services)) return null\n\n const services: Partial<Record<PlatformServiceName, string>> = {}\n for (const name of PLATFORM_SERVICE_NAMES) {\n if (!(name in value.services)) continue\n const url = normalizeServiceUrl(value.services[name])\n if (!url) return null\n if (name === \"agent\" && new URL(url).pathname !== \"/\") return null\n services[name] = url\n }\n\n return { services }\n}\n\nexport async function loadPlatformEndpoints(\n options: LoadPlatformEndpointsOptions = {},\n): Promise<PlatformEndpoints> {\n const fetchImpl = options.fetchImpl ?? globalThis.fetch\n const baseUrl = options.baseUrl ?? defaultDocumentBaseUrl()\n if (!fetchImpl || !baseUrl) return EMPTY_PLATFORM_ENDPOINTS\n\n const controller = new AbortController()\n const timeout = globalThis.setTimeout(() => controller.abort(), options.timeoutMs ?? 3_000)\n try {\n const response = await fetchImpl(new URL(\"config.json\", baseUrl), {\n cache: \"no-store\",\n credentials: \"same-origin\",\n headers: { Accept: \"application/json\" },\n signal: controller.signal,\n })\n if (!response.ok) return EMPTY_PLATFORM_ENDPOINTS\n return parsePlatformEndpoints(await response.json()) ?? EMPTY_PLATFORM_ENDPOINTS\n } catch {\n return EMPTY_PLATFORM_ENDPOINTS\n } finally {\n globalThis.clearTimeout(timeout)\n }\n}\n\nexport function resolveServiceUrl(\n endpoints: PlatformEndpoints,\n name: PlatformServiceName,\n path = \"\",\n): string | null {\n const baseUrl = endpoints.services[name]\n if (!baseUrl) return null\n if (!path) return baseUrl\n const pathReference = path.trimStart()\n if (\n path.includes(\"\\\\\") ||\n pathReference.startsWith(\"//\") ||\n /^[a-z][a-z0-9+.-]*:/i.test(pathReference)\n ) {\n return null\n }\n const base = new URL(`${baseUrl}/`)\n const target = new URL(path.replace(/^\\/+/, \"\"), base)\n if (target.origin !== base.origin || !target.pathname.startsWith(base.pathname)) {\n return null\n }\n return target.toString()\n}\n","/**\n * 页面协作协议(对应后端 `_meta.bridge` 通道,见 docs/specs/260417-embed-bridge)。\n *\n * ## action 从哪里来\n *\n * 智能体 → 宿主方向的每一条指令,都源自**技能作者写的工具代码**:工具返回值\n * JSON 里带 `_meta.bridge: { action, payload }`,后端在持久化前把它剥离成独立\n * 事件送达前端(LLM 的对话历史里读不到它)。因此:\n *\n * - action 字符串(如 \"map.highlight\")是**技能作者与宿主页面开发者之间的业务\n * 契约**,LLM 不参与协议、SDK 不做枚举校验;\n * - 宿主页面用 `session.onCommand(\"map.highlight\", fn)` 消费;\n * - 未注册 handler 的 action 会进入有限缓冲等待注册,超限后丢弃并 console 告警。\n *\n * 宿主 → 智能体方向只有三个白名单动作:attach(附件入输入框)/ insertText\n * (追加输入文本)/ send(直接发消息),对应协议层的 addContext / appendInput /\n * sendMessage。\n */\n\nexport interface CommandEnvelope {\n __bladeBridge: true\n direction: \"agent-to-host\"\n action: string\n payload: unknown\n meta: {\n sessionId: string\n toolCallId?: string\n timestamp: number\n }\n}\n\nexport type InboundAction = \"addContext\" | \"appendInput\" | \"sendMessage\"\n\nexport interface InboundEnvelope {\n __bladeBridge: true\n direction: \"host-to-agent\"\n action: InboundAction\n payload: unknown\n}\n\nexport function isCommandEnvelope(value: unknown): value is CommandEnvelope {\n if (typeof value !== \"object\" || value === null) return false\n const record = value as Record<string, unknown>\n return (\n record.__bladeBridge === true &&\n record.direction === \"agent-to-host\" &&\n typeof record.action === \"string\"\n )\n}\n\nexport function isInboundEnvelope(value: unknown): value is InboundEnvelope {\n if (typeof value !== \"object\" || value === null) return false\n const record = value as Record<string, unknown>\n return (\n record.__bladeBridge === true &&\n record.direction === \"host-to-agent\" &&\n (record.action === \"addContext\" || record.action === \"appendInput\" || record.action === \"sendMessage\")\n )\n}\n","import type { PostChatFollowup, TurnProjection } from \"./projection\"\n\n/** 返回最新根会话轮次的小结;新用户消息到达后旧小结立即失效。 */\nexport function latestPostChatFollowup(turns: TurnProjection[]): PostChatFollowup | null {\n for (let index = turns.length - 1; index >= 0; index -= 1) {\n const turn = turns[index]\n if (\n turn.loop_id === \"root\" &&\n (turn.role === \"user\" || turn.role === \"assistant\") &&\n (turn.kind ?? \"message\") === \"message\" &&\n !turn.blocks.some((block) =>\n [\"mode_change\", \"plan_status\", \"ask_user_answer\"].includes(block.type),\n )\n ) {\n return turn.role === \"assistant\" ? (turn.post_chat_followup ?? null) : null\n }\n }\n return null\n}\n","export enum LayoutType {\n Default = \"default\",\n SkillEditor = \"skill-editor\",\n SolutionEditor = \"solution-editor\",\n SolutionApp = \"solution-app\",\n Custom = \"custom\",\n}\n\nexport interface Solution {\n id: string\n name: string\n version: string\n description?: string | null\n source?: \"builtin\" | \"personal\" | string | null\n layout_type: LayoutType | string\n initial_mode?: \"planning\" | \"executing\" | string | null\n initial_message?: string | null\n preview?: { url: string; title?: string | null } | null\n layout?: {\n available?: boolean\n source_dir?: string\n entry?: string\n export?: string\n } | null\n roles?: BizRole[] | null\n data?: Record<string, unknown> | null\n ui_config?: SolutionAppUiConfig | null\n}\n\nexport interface SolutionAppUiConfig {\n branding: {\n name: string\n subtitle?: string\n icon_text: string\n icon_gradient?: string\n }\n list: {\n title: string\n create_button: string\n card?: {\n subtitle?: string\n stats?: Array<{\n label: string\n value: string\n color?: string\n }>\n }\n }\n create: {\n title: string\n description?: string\n submit_button: string\n sections: Array<{\n id: string\n title: string\n description?: string\n fields: Array<SolutionAppField>\n }>\n }\n}\n\nexport type SolutionAppField =\n | {\n id: string\n kind: \"textarea\"\n label: string\n placeholder?: string\n }\n | {\n id: string\n kind: \"file-upload\"\n accept?: string[]\n categories?: Array<{\n label: string\n description: string\n color: string\n }>\n }\n\nexport interface SolutionAppState {\n pipeline: Array<{\n id: string\n label: string\n status: \"done\" | \"active\" | \"pending\" | \"error\"\n }>\n meta: Record<\n string,\n {\n label: string\n value: string\n color?: string\n }\n >\n}\n\nexport interface BizRole {\n id: string\n name: string\n description?: string | null\n preview?: { url: string; title?: string | null } | null\n}\n","import { type } from \"arktype\"\n\nexport const TaskStatus = type(\"'pending' | 'in_progress' | 'done' | 'failed' | 'skipped'\")\nexport type TaskStatus = typeof TaskStatus.infer\n\nexport const Task = type({\n id: \"string\",\n goal: \"string\",\n skills: \"string[]\",\n depends_on: \"string[]\",\n status: TaskStatus,\n result_summary: \"string\",\n number: \"string\",\n})\nexport type Task = typeof Task.infer\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAM,iBAAiB;AACvB,IAAM,eAAe;AAGd,IAAM,iBAAN,MAAqB;AAAA,EAI1B,YAA6B,YAAoB;AAApB;AAC3B,QAAI,CAAC,OAAO,SAAS,UAAU,KAAK,cAAc,KAAK,aAAa,gBAAgB;AAClF,YAAM,IAAI,WAAW,iDAAiD;AAAA,IACxE;AAAA,EACF;AAAA,EAJ6B;AAAA,EAHrB,WAAW;AAAA,EACX,SAAyB;AAAA,EAQjC,QAAc;AACZ,SAAK,WAAW;AAChB,SAAK,SAAS;AAAA,EAChB;AAAA,EAEA,OAAO,OAAsB;AAC3B,QACG,iBAAiB,SAAS,MAAM,SAAS,gBACzC,iBAAiB,iBAAiB,MAAM,SAAS,OAChD,MAAM,WAAW,OAAO,MAAM,WAAW,KAC3C;AACA,WAAK,SAAS;AACd;AAAA,IACF;AACA,SAAK,WAAW,KAAK,IAAI,KAAK,WAAW,GAAG,EAAE;AAC9C,UAAM,UAAU,KAAK,IAAI,gBAAgB,KAAK,aAAa,KAAK,KAAK,QAAQ;AAC7E,UAAM,UAAU,KAAK,IAAI,KAAK,YAAY,WAAW,MAAM,KAAK,OAAO,IAAI,IAAI;AAC/E,UAAM,SAAS,iBAAiB,gBAC5B,MAAM,SAAS,QAAQ,IAAI,aAAa,GAAG,KAAK,IAChD;AACJ,UAAM,aAAa,SACf,QAAQ,KAAK,MAAM,IAAI,OAAO,MAAM,IAAI,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AAS,YAAY;AAEd,IAAM,aAAa,KAAK,2DAA2D;AAGnF,IAAM,OAAO,KAAK;AAAA,EACvB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,gBAAgB;AAAA,EAChB,QAAQ;AACV,CAAC;","names":["LayoutType"]}
|
package/dist/resources/auth.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ export interface ProvidersResponse {
|
|
|
17
17
|
password_enabled: boolean;
|
|
18
18
|
}
|
|
19
19
|
export interface ExchangeCodeParams {
|
|
20
|
+
/** 原生客户端浏览器回传使用的 S256 PKCE 校验。 */
|
|
21
|
+
codeVerifier?: string;
|
|
22
|
+
androidApp?: "ba" | "pa";
|
|
23
|
+
desktopApp?: "ba" | "pa";
|
|
24
|
+
/** 桌面主进程监听的完整回环 URI,必须与授权时一致。 */
|
|
25
|
+
callbackUri?: string;
|
|
20
26
|
/** 授权回调页 postMessage 回来的一次性 code。 */
|
|
21
27
|
code: string;
|
|
22
28
|
/** 发起授权时用的 state,必须原样传回。 */
|
|
@@ -53,7 +59,9 @@ export declare class AuthResource {
|
|
|
53
59
|
/** 清除 login() 存储的令牌。 */
|
|
54
60
|
logoutToken(): void;
|
|
55
61
|
getProviders(): Promise<ProvidersResponse>;
|
|
56
|
-
getMe(
|
|
62
|
+
getMe(options?: {
|
|
63
|
+
signal?: AbortSignal;
|
|
64
|
+
}): Promise<UserInfo>;
|
|
57
65
|
logout(): Promise<{
|
|
58
66
|
logout_url: string;
|
|
59
67
|
}>;
|
|
@@ -18,10 +18,8 @@ export interface SessionComputer {
|
|
|
18
18
|
last_seen_at?: string | null;
|
|
19
19
|
/** 这台电脑此刻连着后端。由服务端读心跳时间判定,不做实时探测。 */
|
|
20
20
|
online: boolean;
|
|
21
|
-
/**
|
|
21
|
+
/** 本次会话可用,默认启用,明确停用后为 false。和 `online` 互相独立。 */
|
|
22
22
|
enabled: boolean;
|
|
23
|
-
/** 这次会话本身就跑在这台电脑上。 */
|
|
24
|
-
is_primary: boolean;
|
|
25
23
|
}
|
|
26
24
|
export interface SessionComputerList {
|
|
27
25
|
computers: SessionComputer[];
|
|
@@ -52,7 +50,6 @@ export interface AccountComputerList {
|
|
|
52
50
|
/**
|
|
53
51
|
* 一台电脑在界面上该显示成什么状态。
|
|
54
52
|
*
|
|
55
|
-
* - `primary` 会话自己就住在这台机器上,恒为可用且不能停用
|
|
56
53
|
* - `enabled` 本次会话已启动
|
|
57
54
|
* - `offline` 没启动且当前离线
|
|
58
55
|
* - `idle` 没启动,在线
|
|
@@ -60,7 +57,7 @@ export interface AccountComputerList {
|
|
|
60
57
|
* 判定只写这一份,界面只管样式和排版——两边各写一份必然会分叉,
|
|
61
58
|
* 然后其中一边的兜底会把另一边的错误盖住。
|
|
62
59
|
*/
|
|
63
|
-
export type ComputerState = "
|
|
60
|
+
export type ComputerState = "enabled" | "offline" | "idle";
|
|
64
61
|
export declare function computerState(computer: SessionComputer): ComputerState;
|
|
65
62
|
/**
|
|
66
63
|
* 这台电脑跑的是哪一类系统。
|
|
@@ -79,8 +76,6 @@ export declare function computerPlatformLabel(computer: SessionComputer): string
|
|
|
79
76
|
* 不在前端另拼一套格式——拼两份迟早对不上。
|
|
80
77
|
*/
|
|
81
78
|
export declare function computerDaemonVersion(computer: SessionComputer): string;
|
|
82
|
-
/** 这台电脑的勾选框能不能动。主运行时不能停用——那是会话自己的工作目录所在。 */
|
|
83
|
-
export declare function canToggleComputer(computer: SessionComputer): boolean;
|
|
84
79
|
/**
|
|
85
80
|
* 列表顺序:按接入时间,稳定不变。
|
|
86
81
|
*
|