@h-ai/ai 1.0.0-beta.31 → 1.0.0-beta.33
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/{ai-acp-types-C0ab9EBY.d.ts → ai-acp-types-cue1ZWUk.d.ts} +8 -5
- package/dist/ai-file-worker.js +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +2 -2
- package/dist/{chunk-CYWCDBIC.js → chunk-HZDINADT.js} +5 -2
- package/dist/chunk-HZDINADT.js.map +1 -0
- package/dist/{chunk-A357G2JF.js → chunk-IVEOIRBO.js} +3 -3
- package/dist/{chunk-A357G2JF.js.map → chunk-IVEOIRBO.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +138 -46
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-CYWCDBIC.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as AIFunctions, c2 as McpServerOptions } from './ai-acp-types-
|
|
2
|
-
export { A as A2AAgentCardConfig, a as A2AAgentCardDocument, b as A2AApiKeySecurity, c as A2AAuthenticator, d as A2ACallOptions, e as A2ACallResult, f as A2ACallerIdentity, g as A2AConfig, h as A2AConfigSchema, i as A2AContextInfo, j as A2AHandleResult, k as A2AMessageRecord, l as A2AOperations, m as A2ASecurityConfig, n as A2ASkillConfigSchema, o as A2ATaskFilter, p as ACPAgentAdapter, q as ACPAgentAdapterInput, r as ACPAgentLaunch, s as ACPAgentSchema, dF as ACPApprovalDecision, dG as ACPCitation, t as ACPClientOptions, u as ACPConfig, v as ACPConfigInput, w as ACPConfigSchema, x as ACPCreateSessionOptions, y as ACPGitReport, z as ACPOperations, dH as ACPPlatformPolicy, dI as ACPPlatformRequest, dJ as ACPProjectChanges, dK as ACPProjectSnapshot, B as ACPPublishSchema, dL as ACPPublishSnapshot, C as ACPRepositorySchema, dM as ACPRunObserver, dN as ACPRunRequest, D as ACPSessionInfo, dO as ACPSessionWorkspace, dP as ACPSubmitTurn, E as ACPTransport, dQ as ACPTurnOptions, F as ACPWorkspaceSchema, G as AIConfig, H as AIConfigInput, I as AIConfigSchema, K as AIInitOptions, L as AIRelStore, M as AIRelStoreCompareAndSwap, N as AIRelStoreOptions, O as AIResourceEntry, P as AIResourceRegistry, Q as AIStoreProvider, R as AIVectorBackend, S as AIVectorStore, T as AIVersionedRecord, U as AUDIO_WS_PATH, V as ApiType, W as ApiTypeSchema, X as AskOptions, Y as AssistantMessage, Z as AudioConfig, _ as AudioConfigSchema, $ as AudioFormatSchema, a0 as AudioModelEntry, a1 as AudioModelEntrySchema, a2 as AudioOperation, a3 as AudioOperationSchema, a4 as AudioOperationsSchema, a5 as AudioProviderName, a6 as AudioProviderSchema, a7 as AudioWsClientMessage, a8 as AudioWsClientMessageSchema, a9 as AudioWsDoneMessage, aa as AudioWsDoneMessageSchema, ab as AudioWsEndMessage, ac as AudioWsErrorMessage, ad as AudioWsSegmentDoneMessage, ae as AudioWsSegmentStartedMessage, af as AudioWsServerMessage, ag as AudioWsSpeechMessage, ah as AudioWsStartMessage, ai as AudioWsStartMessageSchema, aj as AudioWsTextMessage, ak as AudioWsTextMessageSchema, al as AudioWsTranscriptMessage, dR as BuiltinArtifact, dS as BuiltinArtifactAccess, dT as BuiltinArtifactReference, dU as BuiltinToolBinding, dV as BuiltinToolBroker, dW as BuiltinToolBrokerOptions, dX as BuiltinToolOptions, am as ChatCompletionChoice, an as ChatCompletionChunk, ao as ChatCompletionDelta, ap as ChatCompletionRequest, aq as ChatCompletionResponse, ar as ChatHistoryOptions, as as ChatMessage, at as ChatRecord, au as Citation, av as CommitTurnInput, aw as CompressConfig, ax as CompressConfigSchema, ay as CompressOperations, az as CompressOptions, aA as CompressResult, aB as CompressionStrategy, aC as CompressionStrategySchema, aD as ConsolidateOptions, aE as ConsolidateResult, aF as ContextChatOptions, aG as ContextChatResult, aH as ContextManager, aI as ContextManagerOptions, aJ as ContextOperations, aK as ContextResetOptions, aL as ContextStreamEvent, aM as ConversationTurn, aN as ConversationTurnStatus, dY as CreateBuiltinTools, aO as DeveloperMessage, aP as EmbeddingConfig, aQ as EmbeddingConfigSchema, aR as EmbeddingItem, aS as EmbeddingOperations, aT as EmbeddingRequest, aU as EmbeddingResponse, aV as EntityDocumentRelation, aW as EntityDocumentResult, aX as EntityListOptions, aY as EntityQueryOptions, aZ as EntityType, a_ as EntityTypeSchema, a$ as FileConfig, b0 as FileConfigSchema, b1 as GenerateImageRequest, b2 as GenerateImageResult, b3 as GenerateObjectRequest, b4 as GeneratedImage, b5 as HaiAIError, b6 as ImageConfig, b7 as ImageConfigSchema, b8 as ImageContent, b9 as ImageModelEntry, ba as ImageModelEntrySchema, bb as ImageOperations, bc as ImageProviderName, bd as ImageProviderSchema, be as ImageSize, bf as InteractionScope, bg as KnowledgeAskOptions, bh as KnowledgeAskResult, bi as KnowledgeConfig, bj as KnowledgeConfigSchema, bk as KnowledgeDocumentInfo, bl as KnowledgeDocumentListOptions, bm as KnowledgeDocumentMetadata, bn as KnowledgeDocumentRemoveOptions, bo as KnowledgeDocumentRevision, bp as KnowledgeEntity, bq as KnowledgeIngestBatchProgress, br as KnowledgeIngestBatchResult, bs as KnowledgeIngestFileInput, bt as KnowledgeIngestInput, bu as KnowledgeIngestResult, bv as KnowledgeOperations, bw as KnowledgeRepairOptions, bx as KnowledgeRepairProgress, by as KnowledgeRepairResult, bz as KnowledgeRetrieveItem, bA as KnowledgeRetrieveOptions, bB as KnowledgeRetrieveResult, bC as KnowledgeSetupOptions, bD as KnowledgeStore, bE as LLMConfig, bF as LLMConfigSchema, bG as LLMOperations, bH as MCPConfig, bI as MCPConfigSchema, bJ as MCPContext, bK as MCPExternalServer, bL as MCPExternalServerSchema, dZ as MCPJobFileContext, d_ as MCPJobFiles, bM as MCPOperations, bN as MCPPrompt, bO as MCPPromptArgument, bP as MCPPromptContent, bQ as MCPPromptMessage, bR as MCPResource, bS as MCPResourceContent, bT as MCPServerCapabilities, bU as MCPServerCapabilitiesSchema, bV as MCPServerConfig, bW as MCPServerConfigSchema, d$ as MCPServiceAuthorization, e0 as MCPServiceBinding, e1 as MCPServiceBindingRequest, e2 as MCPServiceBroker, e3 as MCPServiceBrokerOptions, e4 as MCPServiceOperations, e5 as MCPServiceRequest, bX as MCPToolDefinition, bY as MCPToolHandler, bZ as ManagedAudioOperations, b_ as ManagedImageOperations, b$ as ManagedLLMOperations, c0 as ManagedMCPOperations, c1 as ManagedRetrievalOperations, e6 as McpToolOptions, c3 as MemoryAccessScope, c4 as MemoryAdminOperations, c5 as MemoryClearAllOptions, c6 as MemoryClearOptions, c7 as MemoryConfig, c8 as MemoryConfigSchema, c9 as MemoryCoreOperations, ca as MemoryEntry, cb as MemoryEntryInput, cc as MemoryExtractOptions, cd as MemoryInjectionOptions, ce as MemoryListOptions, cf as MemoryListPageOptions, cg as MemoryOperations, ch as MemoryRecallOptions, ci as MemoryType, cj as MemoryTypeSchema, ck as MemoryUpdateInput, cl as MessageContent, cm as MessageRole, cn as ModelCapabilitiesSchema, co as ModelEntry, cp as ModelEntrySchema, cq as ModelScenario, cr as ModelScenarioSchema, cs as ObjectRef, ct as OptionalSecretSchema, cu as PersonaOperations, cv as PersonaProfile, cw as PersonaProfileInput, cx as PersonaProfileUpdate, cy as PersonaScopeOptions, cz as RagContextItem, cA as RagOperations, cB as RagOptions, cC as RagResult, cD as RagStreamEvent, cE as ReasoningOperations, cF as ReasoningOptions, cG as ReasoningResult, cH as ReasoningStep, cI as ReasoningStepType, cJ as ReasoningStrategy, cK as ReasoningStreamEvent, cL as ReferenceImage, cM as RerankDocument, cN as RerankItem, cO as RerankOperations, cP as RerankRequest, cQ as RerankResponse, cR as ResolveRequiredModelEntryOptions, cS as ResolvedAudioModel, cT as ResolvedImageModel, cU as ResolvedModelConfig, cV as RetrievalConfig, cW as RetrievalConfigSchema, cX as RetrievalOperations, cY as RetrievalRequest, cZ as RetrievalResult, c_ as RetrievalResultItem, c$ as RetrievalSource, d0 as RetrievalSourceConfig, d1 as RetrievalSourceSchema, d2 as SSEDecoder, d3 as SSEEvent, d4 as ScopedMemoryBinding, d5 as ScopedMemoryOperations, d6 as SessionInfo, d7 as StoreFilter, d8 as StorePage, d9 as StoreScope, da as StreamOperations, db as StreamProcessor, dc as StreamResult, dd as SummaryConfig, de as SummaryConfigSchema, df as SummaryOperations, dg as SummaryOptions, dh as SummaryResult, di as SystemMessage, dj as TempModelConfig, dk as TextContent, dl as TokenConfig, dm as TokenConfigSchema, dn as TokenOperations, dp as TokenUsage, dq as ToolCall, dr as ToolDefinition, ds as ToolMessage, dt as ToolRegistryOperations, du as ToolsOperations, dv as UserMessage, dw as WhereClause, dx as WhereOperator, dy as WhereValue, dz as ensureAudioCredential, dA as resolveAudioModel, dB as resolveImageModel, dC as resolveModelApi, dD as resolveModelEntry, dE as serializePlayableAudio } from './ai-acp-types-
|
|
1
|
+
import { J as AIFunctions, c2 as McpServerOptions } from './ai-acp-types-cue1ZWUk.js';
|
|
2
|
+
export { A as A2AAgentCardConfig, a as A2AAgentCardDocument, b as A2AApiKeySecurity, c as A2AAuthenticator, d as A2ACallOptions, e as A2ACallResult, f as A2ACallerIdentity, g as A2AConfig, h as A2AConfigSchema, i as A2AContextInfo, j as A2AHandleResult, k as A2AMessageRecord, l as A2AOperations, m as A2ASecurityConfig, n as A2ASkillConfigSchema, o as A2ATaskFilter, p as ACPAgentAdapter, q as ACPAgentAdapterInput, r as ACPAgentLaunch, s as ACPAgentSchema, dF as ACPApprovalDecision, dG as ACPCitation, t as ACPClientOptions, u as ACPConfig, v as ACPConfigInput, w as ACPConfigSchema, x as ACPCreateSessionOptions, y as ACPGitReport, z as ACPOperations, dH as ACPPlatformPolicy, dI as ACPPlatformRequest, dJ as ACPProjectChanges, dK as ACPProjectSnapshot, B as ACPPublishSchema, dL as ACPPublishSnapshot, C as ACPRepositorySchema, dM as ACPRunObserver, dN as ACPRunRequest, D as ACPSessionInfo, dO as ACPSessionWorkspace, dP as ACPSubmitTurn, E as ACPTransport, dQ as ACPTurnOptions, F as ACPWorkspaceSchema, G as AIConfig, H as AIConfigInput, I as AIConfigSchema, K as AIInitOptions, L as AIRelStore, M as AIRelStoreCompareAndSwap, N as AIRelStoreOptions, O as AIResourceEntry, P as AIResourceRegistry, Q as AIStoreProvider, R as AIVectorBackend, S as AIVectorStore, T as AIVersionedRecord, U as AUDIO_WS_PATH, V as ApiType, W as ApiTypeSchema, X as AskOptions, Y as AssistantMessage, Z as AudioConfig, _ as AudioConfigSchema, $ as AudioFormatSchema, a0 as AudioModelEntry, a1 as AudioModelEntrySchema, a2 as AudioOperation, a3 as AudioOperationSchema, a4 as AudioOperationsSchema, a5 as AudioProviderName, a6 as AudioProviderSchema, a7 as AudioWsClientMessage, a8 as AudioWsClientMessageSchema, a9 as AudioWsDoneMessage, aa as AudioWsDoneMessageSchema, ab as AudioWsEndMessage, ac as AudioWsErrorMessage, ad as AudioWsSegmentDoneMessage, ae as AudioWsSegmentStartedMessage, af as AudioWsServerMessage, ag as AudioWsSpeechMessage, ah as AudioWsStartMessage, ai as AudioWsStartMessageSchema, aj as AudioWsTextMessage, ak as AudioWsTextMessageSchema, al as AudioWsTranscriptMessage, dR as BuiltinArtifact, dS as BuiltinArtifactAccess, dT as BuiltinArtifactReference, dU as BuiltinToolBinding, dV as BuiltinToolBroker, dW as BuiltinToolBrokerOptions, dX as BuiltinToolOptions, am as ChatCompletionChoice, an as ChatCompletionChunk, ao as ChatCompletionDelta, ap as ChatCompletionRequest, aq as ChatCompletionResponse, ar as ChatHistoryOptions, as as ChatMessage, at as ChatRecord, au as Citation, av as CommitTurnInput, aw as CompressConfig, ax as CompressConfigSchema, ay as CompressOperations, az as CompressOptions, aA as CompressResult, aB as CompressionStrategy, aC as CompressionStrategySchema, aD as ConsolidateOptions, aE as ConsolidateResult, aF as ContextChatOptions, aG as ContextChatResult, aH as ContextManager, aI as ContextManagerOptions, aJ as ContextOperations, aK as ContextResetOptions, aL as ContextStreamEvent, aM as ConversationTurn, aN as ConversationTurnStatus, dY as CreateBuiltinTools, aO as DeveloperMessage, aP as EmbeddingConfig, aQ as EmbeddingConfigSchema, aR as EmbeddingItem, aS as EmbeddingOperations, aT as EmbeddingRequest, aU as EmbeddingResponse, aV as EntityDocumentRelation, aW as EntityDocumentResult, aX as EntityListOptions, aY as EntityQueryOptions, aZ as EntityType, a_ as EntityTypeSchema, a$ as FileConfig, b0 as FileConfigSchema, b1 as GenerateImageRequest, b2 as GenerateImageResult, b3 as GenerateObjectRequest, b4 as GeneratedImage, b5 as HaiAIError, b6 as ImageConfig, b7 as ImageConfigSchema, b8 as ImageContent, b9 as ImageModelEntry, ba as ImageModelEntrySchema, bb as ImageOperations, bc as ImageProviderName, bd as ImageProviderSchema, be as ImageSize, bf as InteractionScope, bg as KnowledgeAskOptions, bh as KnowledgeAskResult, bi as KnowledgeConfig, bj as KnowledgeConfigSchema, bk as KnowledgeDocumentInfo, bl as KnowledgeDocumentListOptions, bm as KnowledgeDocumentMetadata, bn as KnowledgeDocumentRemoveOptions, bo as KnowledgeDocumentRevision, bp as KnowledgeEntity, bq as KnowledgeIngestBatchProgress, br as KnowledgeIngestBatchResult, bs as KnowledgeIngestFileInput, bt as KnowledgeIngestInput, bu as KnowledgeIngestResult, bv as KnowledgeOperations, bw as KnowledgeRepairOptions, bx as KnowledgeRepairProgress, by as KnowledgeRepairResult, bz as KnowledgeRetrieveItem, bA as KnowledgeRetrieveOptions, bB as KnowledgeRetrieveResult, bC as KnowledgeSetupOptions, bD as KnowledgeStore, bE as LLMConfig, bF as LLMConfigSchema, bG as LLMOperations, bH as MCPConfig, bI as MCPConfigSchema, bJ as MCPContext, bK as MCPExternalServer, bL as MCPExternalServerSchema, dZ as MCPJobFileContext, d_ as MCPJobFiles, bM as MCPOperations, bN as MCPPrompt, bO as MCPPromptArgument, bP as MCPPromptContent, bQ as MCPPromptMessage, bR as MCPResource, bS as MCPResourceContent, bT as MCPServerCapabilities, bU as MCPServerCapabilitiesSchema, bV as MCPServerConfig, bW as MCPServerConfigSchema, d$ as MCPServiceAuthorization, e0 as MCPServiceBinding, e1 as MCPServiceBindingRequest, e2 as MCPServiceBroker, e3 as MCPServiceBrokerOptions, e4 as MCPServiceOperations, e5 as MCPServiceRequest, bX as MCPToolDefinition, bY as MCPToolHandler, bZ as ManagedAudioOperations, b_ as ManagedImageOperations, b$ as ManagedLLMOperations, c0 as ManagedMCPOperations, c1 as ManagedRetrievalOperations, e6 as McpToolOptions, c3 as MemoryAccessScope, c4 as MemoryAdminOperations, c5 as MemoryClearAllOptions, c6 as MemoryClearOptions, c7 as MemoryConfig, c8 as MemoryConfigSchema, c9 as MemoryCoreOperations, ca as MemoryEntry, cb as MemoryEntryInput, cc as MemoryExtractOptions, cd as MemoryInjectionOptions, ce as MemoryListOptions, cf as MemoryListPageOptions, cg as MemoryOperations, ch as MemoryRecallOptions, ci as MemoryType, cj as MemoryTypeSchema, ck as MemoryUpdateInput, cl as MessageContent, cm as MessageRole, cn as ModelCapabilitiesSchema, co as ModelEntry, cp as ModelEntrySchema, cq as ModelScenario, cr as ModelScenarioSchema, cs as ObjectRef, ct as OptionalSecretSchema, cu as PersonaOperations, cv as PersonaProfile, cw as PersonaProfileInput, cx as PersonaProfileUpdate, cy as PersonaScopeOptions, cz as RagContextItem, cA as RagOperations, cB as RagOptions, cC as RagResult, cD as RagStreamEvent, cE as ReasoningOperations, cF as ReasoningOptions, cG as ReasoningResult, cH as ReasoningStep, cI as ReasoningStepType, cJ as ReasoningStrategy, cK as ReasoningStreamEvent, cL as ReferenceImage, cM as RerankDocument, cN as RerankItem, cO as RerankOperations, cP as RerankRequest, cQ as RerankResponse, cR as ResolveRequiredModelEntryOptions, cS as ResolvedAudioModel, cT as ResolvedImageModel, cU as ResolvedModelConfig, cV as RetrievalConfig, cW as RetrievalConfigSchema, cX as RetrievalOperations, cY as RetrievalRequest, cZ as RetrievalResult, c_ as RetrievalResultItem, c$ as RetrievalSource, d0 as RetrievalSourceConfig, d1 as RetrievalSourceSchema, d2 as SSEDecoder, d3 as SSEEvent, d4 as ScopedMemoryBinding, d5 as ScopedMemoryOperations, d6 as SessionInfo, d7 as StoreFilter, d8 as StorePage, d9 as StoreScope, da as StreamOperations, db as StreamProcessor, dc as StreamResult, dd as SummaryConfig, de as SummaryConfigSchema, df as SummaryOperations, dg as SummaryOptions, dh as SummaryResult, di as SystemMessage, dj as TempModelConfig, dk as TextContent, dl as TokenConfig, dm as TokenConfigSchema, dn as TokenOperations, dp as TokenUsage, dq as ToolCall, dr as ToolDefinition, ds as ToolMessage, dt as ToolRegistryOperations, du as ToolsOperations, dv as UserMessage, dw as WhereClause, dx as WhereOperator, dy as WhereValue, dz as ensureAudioCredential, dA as resolveAudioModel, dB as resolveImageModel, dC as resolveModelApi, dD as resolveModelEntry, dE as serializePlayableAudio } from './ai-acp-types-cue1ZWUk.js';
|
|
3
3
|
export { A as AudioCapabilitiesRequest, a as AudioContent, b as AudioFormat, c as AudioInputStream, d as AudioModelCapabilities, e as AudioOperations, f as AudioReference, P as PlayableAudio, S as SynthesisEvent, g as SynthesisOptions, h as SynthesisRequest, i as SynthesisResult, j as SynthesisStreamRequest, k as SynthesisTextSegment, T as TranscriptionEvent, l as TranscriptionOptions, m as TranscriptionRequest, n as TranscriptionResult, o as TranscriptionSegment, p as TranscriptionStreamRequest, q as TranscriptionTimestampGranularity, r as TranscriptionWord } from './ai-audio-types-4R5yUAVl.js';
|
|
4
4
|
export { F as FileOperations, a as FileParseMethod, b as FileParseOptions, c as FileParseRequest, d as FileParseResult, O as OutputFormat } from './ai-file-types-BN7l67hR.js';
|
|
5
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { platformOptionsSchema, platformRunSchema, AIConfigSchema, MemoryConfigSchema, ModelEntrySchema, AudioModelEntrySchema, ImageModelEntrySchema, MCPExternalServerSchema, RetrievalSourceSchema, KnowledgeConfigSchema, TokenConfigSchema, SummaryConfigSchema, CompressConfigSchema, serializePlayableAudio, ACPConfigSchema, ACPAgentSchema, ACPWorkspaceSchema, AudioConfigSchema, resolveModelEntry, resolveAudioModel, ensureAudioCredential, platformScopeSchema, resolveModelApi, platformRequestSchema, sessionIdentitySchema, branchNameSchema, ImageConfigSchema, resolveImageModel, ACPPublishSchema } from './chunk-
|
|
2
|
-
export { A2AConfigSchema, A2ASkillConfigSchema, ACPAgentSchema, ACPConfigSchema, ACPPublishSchema, ACPRepositorySchema, ACPWorkspaceSchema, AIConfigSchema, AUDIO_WS_PATH, ApiTypeSchema, AudioConfigSchema, AudioFormatSchema, AudioModelEntrySchema, AudioOperationSchema, AudioOperationsSchema, AudioProviderSchema, AudioWsClientMessageSchema, AudioWsDoneMessageSchema, AudioWsStartMessageSchema, AudioWsTextMessageSchema, CompressConfigSchema, CompressionStrategySchema, EmbeddingConfigSchema, EntityTypeSchema, FileConfigSchema, ImageConfigSchema, ImageModelEntrySchema, ImageProviderSchema, KnowledgeConfigSchema, LLMConfigSchema, MCPConfigSchema, MCPExternalServerSchema, MCPServerCapabilitiesSchema, MCPServerConfigSchema, MemoryConfigSchema, MemoryTypeSchema, ModelCapabilitiesSchema, ModelEntrySchema, ModelScenarioSchema, OptionalSecretSchema, RetrievalConfigSchema, RetrievalSourceSchema, SummaryConfigSchema, TokenConfigSchema, ensureAudioCredential, resolveAudioModel, resolveImageModel, resolveModelApi, resolveModelEntry, serializePlayableAudio } from './chunk-
|
|
1
|
+
import { platformOptionsSchema, platformRunSchema, AIConfigSchema, MemoryConfigSchema, ModelEntrySchema, AudioModelEntrySchema, ImageModelEntrySchema, MCPExternalServerSchema, RetrievalSourceSchema, KnowledgeConfigSchema, TokenConfigSchema, SummaryConfigSchema, CompressConfigSchema, serializePlayableAudio, ACPConfigSchema, ACPAgentSchema, ACPWorkspaceSchema, AudioConfigSchema, resolveModelEntry, resolveAudioModel, ensureAudioCredential, platformScopeSchema, resolveModelApi, platformRequestSchema, sessionIdentitySchema, branchNameSchema, ImageConfigSchema, resolveImageModel, ACPPublishSchema } from './chunk-IVEOIRBO.js';
|
|
2
|
+
export { A2AConfigSchema, A2ASkillConfigSchema, ACPAgentSchema, ACPConfigSchema, ACPPublishSchema, ACPRepositorySchema, ACPWorkspaceSchema, AIConfigSchema, AUDIO_WS_PATH, ApiTypeSchema, AudioConfigSchema, AudioFormatSchema, AudioModelEntrySchema, AudioOperationSchema, AudioOperationsSchema, AudioProviderSchema, AudioWsClientMessageSchema, AudioWsDoneMessageSchema, AudioWsStartMessageSchema, AudioWsTextMessageSchema, CompressConfigSchema, CompressionStrategySchema, EmbeddingConfigSchema, EntityTypeSchema, FileConfigSchema, ImageConfigSchema, ImageModelEntrySchema, ImageProviderSchema, KnowledgeConfigSchema, LLMConfigSchema, MCPConfigSchema, MCPExternalServerSchema, MCPServerCapabilitiesSchema, MCPServerConfigSchema, MemoryConfigSchema, MemoryTypeSchema, ModelCapabilitiesSchema, ModelEntrySchema, ModelScenarioSchema, OptionalSecretSchema, RetrievalConfigSchema, RetrievalSourceSchema, SummaryConfigSchema, TokenConfigSchema, ensureAudioCredential, resolveAudioModel, resolveImageModel, resolveModelApi, resolveModelEntry, serializePlayableAudio } from './chunk-IVEOIRBO.js';
|
|
3
3
|
import { parseHtmlFile } from './chunk-OWR55FRO.js';
|
|
4
|
-
import { aiM } from './chunk-
|
|
4
|
+
import { aiM } from './chunk-HZDINADT.js';
|
|
5
5
|
import { HaiAIError } from './chunk-C6T3ONVG.js';
|
|
6
6
|
export { HaiAIError } from './chunk-C6T3ONVG.js';
|
|
7
7
|
import { TaskState, SendMessageRequest, Message, Role, AgentCard, TaskStatus, Task } from '@a2a-js/sdk';
|
|
@@ -19,6 +19,7 @@ import { ExtendedAgentCardNotConfiguredError, PushNotificationNotSupportedError,
|
|
|
19
19
|
import { z, ZodError } from 'zod';
|
|
20
20
|
import { mkdtemp, rm, mkdir, writeFile, realpath } from 'fs/promises';
|
|
21
21
|
import { isAbsolute, extname, join, dirname, win32, posix, resolve, relative, basename } from 'path';
|
|
22
|
+
import { isDeepStrictEqual } from 'util';
|
|
22
23
|
import { execFile, spawn } from 'child_process';
|
|
23
24
|
import { Writable, Readable } from 'stream';
|
|
24
25
|
import { methods, ndJsonStream, client, PROTOCOL_VERSION } from '@agentclientprotocol/sdk';
|
|
@@ -2415,6 +2416,20 @@ function createGitOperations(workspace, runtime) {
|
|
|
2415
2416
|
if (remoteUrl(await git2(path2, ["remote", "get-url", repo.remote])) !== remoteUrl(repo.url))
|
|
2416
2417
|
throw new ACPFailure("conflict");
|
|
2417
2418
|
}
|
|
2419
|
+
async function registeredWorktree(main, worktree) {
|
|
2420
|
+
const registrations = await git2(main, [
|
|
2421
|
+
"worktree",
|
|
2422
|
+
"list",
|
|
2423
|
+
"--porcelain",
|
|
2424
|
+
"-z"
|
|
2425
|
+
]);
|
|
2426
|
+
return registrations.split("\0\0").map((entry) => entry.split("\0")).find(([entry]) => {
|
|
2427
|
+
if (!entry?.startsWith("worktree "))
|
|
2428
|
+
return false;
|
|
2429
|
+
const registeredPath = entry.slice("worktree ".length);
|
|
2430
|
+
return !runtime.resource && process2.platform === "win32" ? win32.relative(registeredPath, worktree) === "" : registeredPath === worktree;
|
|
2431
|
+
});
|
|
2432
|
+
}
|
|
2418
2433
|
async function reports(operation) {
|
|
2419
2434
|
await ready();
|
|
2420
2435
|
const output = [];
|
|
@@ -2491,6 +2506,33 @@ function createGitOperations(workspace, runtime) {
|
|
|
2491
2506
|
}
|
|
2492
2507
|
await runtime.file("copy", "main/files", `sessions/${sessionId}/files`);
|
|
2493
2508
|
},
|
|
2509
|
+
/**
|
|
2510
|
+
* 核验所有仓库仍登记在原会话路径与分支,保留准备阶段已写入的内容。
|
|
2511
|
+
* @param sessionId - 持久记录拥有的独立会话目录 ID。
|
|
2512
|
+
* @param branch - 创建时登记的会话分支。
|
|
2513
|
+
* @returns 核验成功后返回;目录、登记、分支或远端失效时抛错。
|
|
2514
|
+
* @example
|
|
2515
|
+
* ```ts
|
|
2516
|
+
* // 模块内部上下文:git 为已打开工作区的操作句柄,调用方持有会话锁。
|
|
2517
|
+
* await git.verifyWorktree('task-1', 'acp/task-1')
|
|
2518
|
+
* ```
|
|
2519
|
+
*/
|
|
2520
|
+
async verifyWorktree(sessionId, branch) {
|
|
2521
|
+
await ready();
|
|
2522
|
+
for (const repo of workspace.repositories) {
|
|
2523
|
+
await checked(repo);
|
|
2524
|
+
const main = source(repo.id);
|
|
2525
|
+
const worktree = runtime.path(`sessions/${sessionId}/${repo.id}`);
|
|
2526
|
+
const registration = await registeredWorktree(main, worktree);
|
|
2527
|
+
if (!registration?.includes(`branch refs/heads/${branch}`))
|
|
2528
|
+
throw new ACPFailure("conflict");
|
|
2529
|
+
await checked(repo, worktree, branch);
|
|
2530
|
+
const mainGitDir = await git2(main, ["rev-parse", "--absolute-git-dir"]);
|
|
2531
|
+
const commonGitDir = await git2(worktree, ["rev-parse", "--path-format=absolute", "--git-common-dir"]);
|
|
2532
|
+
if (path.relative(mainGitDir, commonGitDir) !== "")
|
|
2533
|
+
throw new ACPFailure("conflict");
|
|
2534
|
+
}
|
|
2535
|
+
},
|
|
2494
2536
|
/**
|
|
2495
2537
|
* 预检所有登记的会话工作树,确认回收状态已持久化后逐个执行 Git 移除。
|
|
2496
2538
|
* @param sessionId - 持久记录所拥有的会话目录 ID。
|
|
@@ -2511,18 +2553,7 @@ function createGitOperations(workspace, runtime) {
|
|
|
2511
2553
|
const main = source(repo.id);
|
|
2512
2554
|
const worktree = runtime.path(`sessions/${sessionId}/${repo.id}`);
|
|
2513
2555
|
const exists = await runtime.file("exists", worktree) === "true";
|
|
2514
|
-
const
|
|
2515
|
-
"worktree",
|
|
2516
|
-
"list",
|
|
2517
|
-
"--porcelain",
|
|
2518
|
-
"-z"
|
|
2519
|
-
]);
|
|
2520
|
-
const registration = registrations.split("\0\0").map((entry) => entry.split("\0")).find(([entry]) => {
|
|
2521
|
-
if (!entry?.startsWith("worktree "))
|
|
2522
|
-
return false;
|
|
2523
|
-
const registeredPath = entry.slice("worktree ".length);
|
|
2524
|
-
return !runtime.resource && process2.platform === "win32" ? win32.relative(registeredPath, worktree) === "" : registeredPath === worktree;
|
|
2525
|
-
});
|
|
2556
|
+
const registration = await registeredWorktree(main, worktree);
|
|
2526
2557
|
if (!registration && !exists)
|
|
2527
2558
|
continue;
|
|
2528
2559
|
if (!registration?.includes(`branch refs/heads/${branch}`) || registration.some((entry) => entry === "locked" || entry.startsWith("locked "))) {
|
|
@@ -4927,20 +4958,32 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
4927
4958
|
await current.release();
|
|
4928
4959
|
live.delete(id3);
|
|
4929
4960
|
}
|
|
4930
|
-
async function start(info, options,
|
|
4961
|
+
async function start(info, options, operation, ownedSession) {
|
|
4931
4962
|
const releaseSession = ownedSession ?? await acquire(`session:${info.id}`);
|
|
4932
4963
|
let releaseDirectory;
|
|
4933
4964
|
let runtime;
|
|
4934
4965
|
let connection;
|
|
4935
|
-
let recordMutable =
|
|
4966
|
+
let recordMutable = operation === "create";
|
|
4967
|
+
let restartBranch;
|
|
4936
4968
|
try {
|
|
4937
|
-
if (
|
|
4969
|
+
if (operation !== "create") {
|
|
4938
4970
|
info = await get(sessions, info.id);
|
|
4939
4971
|
if (info.status === "opening" || info.status === "active")
|
|
4940
4972
|
throw new ACPFailure("busy");
|
|
4941
4973
|
if (info.worktreeStatus)
|
|
4942
4974
|
throw new ACPFailure("closed");
|
|
4943
|
-
|
|
4975
|
+
if (operation === "restart") {
|
|
4976
|
+
if (info.resource)
|
|
4977
|
+
throw new ACPFailure("busy");
|
|
4978
|
+
if (!info.workspaceId || !info.workspace?.repositories.length || !info.newWorktree || !info.branch)
|
|
4979
|
+
throw new ACPFailure("unsupported");
|
|
4980
|
+
restartBranch = info.branch;
|
|
4981
|
+
}
|
|
4982
|
+
const agent2 = await getAgent(info.agentId);
|
|
4983
|
+
if (!agent2.enabled || !isDeepStrictEqual(JSON.parse(JSON.stringify(agent2)), JSON.parse(JSON.stringify(info.agent))) || info.modelSignature !== await modelSignature(agent2)) {
|
|
4984
|
+
throw new ACPFailure("conflict");
|
|
4985
|
+
}
|
|
4986
|
+
recordMutable = operation === "resume";
|
|
4944
4987
|
}
|
|
4945
4988
|
const agent = info.agent;
|
|
4946
4989
|
const workspace = info.workspaceId ? await getWorkspace(info.workspaceId) : void 0;
|
|
@@ -4959,7 +5002,7 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
4959
5002
|
releaseDirectory = await acquire(`${workspaceKey(workspace)}:main`);
|
|
4960
5003
|
checkStorage(workspace, info);
|
|
4961
5004
|
const directory = sessionDirectory(info);
|
|
4962
|
-
if (
|
|
5005
|
+
if (operation === "create") {
|
|
4963
5006
|
const releasePrepare = info.newWorktree ? await acquire(`${workspaceKey(workspace)}:main`) : void 0;
|
|
4964
5007
|
try {
|
|
4965
5008
|
runtime = await openRuntime(workspace);
|
|
@@ -4985,6 +5028,10 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
4985
5028
|
}
|
|
4986
5029
|
checkLayout(workspace, runtime, info);
|
|
4987
5030
|
await runtime.file("directory", info.cwd);
|
|
5031
|
+
if (restartBranch) {
|
|
5032
|
+
await createGitOperations(workspace, runtime).verifyWorktree(info.id, restartBranch);
|
|
5033
|
+
recordMutable = true;
|
|
5034
|
+
}
|
|
4988
5035
|
} else if (agent.mode !== "custom-service" || !info.cwd || info.newWorktree) {
|
|
4989
5036
|
throw new ACPFailure("invalid");
|
|
4990
5037
|
}
|
|
@@ -4997,19 +5044,26 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
4997
5044
|
...info.mcpServers,
|
|
4998
5045
|
...info.mcpServerIds?.length && mcpLookup ? await mcpLookup(info.mcpServerIds) : []
|
|
4999
5046
|
];
|
|
5000
|
-
|
|
5001
|
-
|
|
5047
|
+
let nativeId = info.nativeId;
|
|
5048
|
+
if (operation === "resume") {
|
|
5049
|
+
if (!nativeId)
|
|
5002
5050
|
throw new ACPFailure("unsupported");
|
|
5003
|
-
await connection.resumeSession(
|
|
5051
|
+
await connection.resumeSession(nativeId, info.cwd, mcpServers);
|
|
5004
5052
|
} else {
|
|
5005
|
-
|
|
5053
|
+
nativeId = (await connection.createSession(info.cwd, mcpServers)).sessionId;
|
|
5054
|
+
if (operation === "create")
|
|
5055
|
+
info.nativeId = nativeId;
|
|
5006
5056
|
}
|
|
5007
5057
|
ensure();
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5058
|
+
const active = {
|
|
5059
|
+
...info,
|
|
5060
|
+
nativeId,
|
|
5061
|
+
status: "active",
|
|
5062
|
+
resource: runtime?.resource
|
|
5063
|
+
};
|
|
5064
|
+
await sessions.save(info.id, active);
|
|
5011
5065
|
const value = {
|
|
5012
|
-
info,
|
|
5066
|
+
info: active,
|
|
5013
5067
|
connection,
|
|
5014
5068
|
runtime,
|
|
5015
5069
|
release: async () => {
|
|
@@ -5659,7 +5713,7 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
5659
5713
|
return info2;
|
|
5660
5714
|
});
|
|
5661
5715
|
handedOff = true;
|
|
5662
|
-
return await start(info, options,
|
|
5716
|
+
return await start(info, options, "create", releaseSession);
|
|
5663
5717
|
} finally {
|
|
5664
5718
|
if (!handedOff)
|
|
5665
5719
|
await releaseSession();
|
|
@@ -5699,10 +5753,10 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
5699
5753
|
})
|
|
5700
5754
|
),
|
|
5701
5755
|
/**
|
|
5702
|
-
*
|
|
5756
|
+
* 默认使用原生会话 ID 和原状态恢复。可信宿主确认首轮尚未派发时,可在原隔离工作树重开。
|
|
5703
5757
|
* @param id - 已关闭或失败的框架会话 ID。
|
|
5704
|
-
* @param options -
|
|
5705
|
-
* @returns
|
|
5758
|
+
* @param options - 本次连接选项和可信宿主可显式启用的 restartNative。
|
|
5759
|
+
* @returns 恢复后的会话句柄;占用、工作树失效、原生操作失败或配置变化时返回失败。
|
|
5706
5760
|
* @example
|
|
5707
5761
|
* ```ts
|
|
5708
5762
|
* import { ai } from '@h-ai/ai'
|
|
@@ -5713,15 +5767,8 @@ function createACPOperations(provider, config, extensions = {}, modelConfig = as
|
|
|
5713
5767
|
*/
|
|
5714
5768
|
resume: (id3, options = {}) => protect(async () => {
|
|
5715
5769
|
const info = await get(sessions, id3);
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
const agent = await getAgent(info.agentId);
|
|
5719
|
-
if (!agent.enabled || JSON.stringify(agent) !== JSON.stringify(info.agent)) {
|
|
5720
|
-
throw new ACPFailure("conflict");
|
|
5721
|
-
}
|
|
5722
|
-
if (info.modelSignature !== await modelSignature(agent))
|
|
5723
|
-
throw new ACPFailure("conflict");
|
|
5724
|
-
return start(info, options, true);
|
|
5770
|
+
const { restartNative, ...clientOptions } = options;
|
|
5771
|
+
return start(info, clientOptions, restartNative === true ? "restart" : "resume");
|
|
5725
5772
|
}),
|
|
5726
5773
|
/**
|
|
5727
5774
|
* 关闭本进程拥有的会话并释放锁,不删除历史和工程内容。
|
|
@@ -11558,6 +11605,20 @@ function contentToText2(content) {
|
|
|
11558
11605
|
function isRecord2(value) {
|
|
11559
11606
|
return typeof value === "object" && value !== null;
|
|
11560
11607
|
}
|
|
11608
|
+
function toResponsesUserContent(content) {
|
|
11609
|
+
if (typeof content === "string")
|
|
11610
|
+
return content;
|
|
11611
|
+
const parts = [];
|
|
11612
|
+
for (const part of content) {
|
|
11613
|
+
if (part.type === "text" && part.text) {
|
|
11614
|
+
parts.push({ type: "input_text", text: part.text });
|
|
11615
|
+
} else if (part.type === "image_url") {
|
|
11616
|
+
const { url, detail = "auto" } = part.image_url;
|
|
11617
|
+
parts.push({ type: "input_image", image_url: url, detail });
|
|
11618
|
+
}
|
|
11619
|
+
}
|
|
11620
|
+
return parts.length > 0 ? parts : "";
|
|
11621
|
+
}
|
|
11561
11622
|
function toResponsesInput(messages) {
|
|
11562
11623
|
const items = [];
|
|
11563
11624
|
for (const message of messages) {
|
|
@@ -11588,7 +11649,12 @@ function toResponsesInput(messages) {
|
|
|
11588
11649
|
}
|
|
11589
11650
|
continue;
|
|
11590
11651
|
}
|
|
11591
|
-
if (message.role === "user"
|
|
11652
|
+
if (message.role === "user") {
|
|
11653
|
+
items.push({
|
|
11654
|
+
role: message.role,
|
|
11655
|
+
content: toResponsesUserContent(message.content)
|
|
11656
|
+
});
|
|
11657
|
+
} else if (message.role === "system" || message.role === "developer") {
|
|
11592
11658
|
items.push({
|
|
11593
11659
|
role: message.role,
|
|
11594
11660
|
content: contentToText2(message.content)
|
|
@@ -11821,12 +11887,32 @@ function createOpenAIProvider(deps) {
|
|
|
11821
11887
|
});
|
|
11822
11888
|
}
|
|
11823
11889
|
function buildResponsesParams(request2, resolved) {
|
|
11890
|
+
const { response_format: responseFormat } = request2;
|
|
11891
|
+
let format;
|
|
11892
|
+
if (responseFormat?.type === "json_schema") {
|
|
11893
|
+
const { json_schema: jsonSchema } = responseFormat;
|
|
11894
|
+
if (!jsonSchema?.schema)
|
|
11895
|
+
return err(HaiAIError.INVALID_REQUEST, aiM("ai_llmResponsesSchemaRequired"));
|
|
11896
|
+
const { name, schema, description, strict } = jsonSchema;
|
|
11897
|
+
format = {
|
|
11898
|
+
type: "json_schema",
|
|
11899
|
+
name,
|
|
11900
|
+
schema,
|
|
11901
|
+
description,
|
|
11902
|
+
strict
|
|
11903
|
+
};
|
|
11904
|
+
} else {
|
|
11905
|
+
format = responseFormat;
|
|
11906
|
+
}
|
|
11824
11907
|
const maxOutput = request2.max_tokens ?? resolved.maxTokens;
|
|
11825
11908
|
const temperature = request2.temperature ?? resolved.temperature;
|
|
11826
11909
|
const toolChoice = typeof request2.tool_choice === "string" ? request2.tool_choice : void 0;
|
|
11827
|
-
return {
|
|
11910
|
+
return ok({
|
|
11828
11911
|
model: resolved.model,
|
|
11829
11912
|
input: toResponsesInput(request2.messages),
|
|
11913
|
+
...format ? {
|
|
11914
|
+
text: { format }
|
|
11915
|
+
} : {},
|
|
11830
11916
|
...maxOutput != null ? { max_output_tokens: maxOutput } : {},
|
|
11831
11917
|
...temperature != null ? { temperature } : {},
|
|
11832
11918
|
...request2.top_p != null ? { top_p: request2.top_p } : {},
|
|
@@ -11835,7 +11921,7 @@ function createOpenAIProvider(deps) {
|
|
|
11835
11921
|
} : {},
|
|
11836
11922
|
...toolChoice ? { tool_choice: toolChoice } : {},
|
|
11837
11923
|
stream: false
|
|
11838
|
-
};
|
|
11924
|
+
});
|
|
11839
11925
|
}
|
|
11840
11926
|
return {
|
|
11841
11927
|
async chat(request2) {
|
|
@@ -11847,7 +11933,10 @@ function createOpenAIProvider(deps) {
|
|
|
11847
11933
|
const { objectId: _objectId, sessionId: _sessionId, tempModel: _tempModel, signal, ...openaiRequest } = request2;
|
|
11848
11934
|
try {
|
|
11849
11935
|
if (api === "responses") {
|
|
11850
|
-
const
|
|
11936
|
+
const params2 = buildResponsesParams(request2, resolved);
|
|
11937
|
+
if (!params2.success)
|
|
11938
|
+
return params2;
|
|
11939
|
+
const response2 = await client2.responses.create(params2.data, { signal });
|
|
11851
11940
|
return ok(responsesToChatResponse(response2, model));
|
|
11852
11941
|
}
|
|
11853
11942
|
const openaiMessages = request2.messages.map(toOpenAIMessage);
|
|
@@ -11874,9 +11963,12 @@ function createOpenAIProvider(deps) {
|
|
|
11874
11963
|
const { client: client2, model, maxTokens, temperature, protocol: api } = resolved;
|
|
11875
11964
|
const { objectId: _objectId, sessionId: _sessionId, tempModel: _tempModel, signal, ...openaiRequest } = request2;
|
|
11876
11965
|
if (api === "responses") {
|
|
11966
|
+
const params2 = buildResponsesParams(request2, resolved);
|
|
11967
|
+
if (!params2.success)
|
|
11968
|
+
throw new Error(params2.error.message);
|
|
11877
11969
|
const responsesStream = await client2.responses.create(
|
|
11878
11970
|
{
|
|
11879
|
-
...
|
|
11971
|
+
...params2.data,
|
|
11880
11972
|
stream: true
|
|
11881
11973
|
},
|
|
11882
11974
|
{ signal }
|