@nextclaw/ncp 0.5.1 → 0.5.2
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/index.d.ts +94 -86
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -230,6 +230,91 @@ interface NcpSessionApi {
|
|
|
230
230
|
deleteSession(sessionId: string): Promise<void>;
|
|
231
231
|
}
|
|
232
232
|
//#endregion
|
|
233
|
+
//#region src/agent-runtime/llm-api.d.ts
|
|
234
|
+
type OpenAIContentPart = {
|
|
235
|
+
type: "text";
|
|
236
|
+
text: string;
|
|
237
|
+
} | {
|
|
238
|
+
type: "image_url";
|
|
239
|
+
image_url: {
|
|
240
|
+
url: string;
|
|
241
|
+
detail?: "low" | "high" | "auto";
|
|
242
|
+
};
|
|
243
|
+
};
|
|
244
|
+
type OpenAIToolCall = {
|
|
245
|
+
id: string;
|
|
246
|
+
type: "function";
|
|
247
|
+
function: {
|
|
248
|
+
name: string;
|
|
249
|
+
arguments: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
type OpenAIChatMessage = {
|
|
253
|
+
role: "system";
|
|
254
|
+
content: string;
|
|
255
|
+
} | {
|
|
256
|
+
role: "user";
|
|
257
|
+
content: string | OpenAIContentPart[];
|
|
258
|
+
} | {
|
|
259
|
+
role: "assistant";
|
|
260
|
+
content?: string | null;
|
|
261
|
+
reasoning_content?: string;
|
|
262
|
+
tool_calls?: OpenAIToolCall[];
|
|
263
|
+
} | {
|
|
264
|
+
role: "tool";
|
|
265
|
+
content: string;
|
|
266
|
+
tool_call_id: string;
|
|
267
|
+
};
|
|
268
|
+
type OpenAITool = {
|
|
269
|
+
type: "function";
|
|
270
|
+
function: {
|
|
271
|
+
name: string;
|
|
272
|
+
description?: string;
|
|
273
|
+
parameters?: Record<string, unknown>;
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
type OpenAIToolCallDelta = {
|
|
277
|
+
index?: number;
|
|
278
|
+
id?: string;
|
|
279
|
+
type?: "function";
|
|
280
|
+
function?: {
|
|
281
|
+
name?: string;
|
|
282
|
+
arguments?: string;
|
|
283
|
+
};
|
|
284
|
+
};
|
|
285
|
+
type OpenAIChatChunk = {
|
|
286
|
+
id?: string;
|
|
287
|
+
choices?: Array<{
|
|
288
|
+
index?: number;
|
|
289
|
+
delta?: {
|
|
290
|
+
content?: string | null;
|
|
291
|
+
tool_calls?: OpenAIToolCallDelta[];
|
|
292
|
+
reasoning_content?: string;
|
|
293
|
+
reasoning?: string;
|
|
294
|
+
};
|
|
295
|
+
finish_reason?: string | null;
|
|
296
|
+
}>;
|
|
297
|
+
usage?: {
|
|
298
|
+
prompt_tokens?: number;
|
|
299
|
+
completion_tokens?: number;
|
|
300
|
+
total_tokens?: number;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
type NcpLLMApiInput = {
|
|
304
|
+
messages: OpenAIChatMessage[];
|
|
305
|
+
tools?: OpenAITool[];
|
|
306
|
+
model?: string;
|
|
307
|
+
thinkingLevel?: string | null;
|
|
308
|
+
max_tokens?: number;
|
|
309
|
+
};
|
|
310
|
+
type NcpLLMApiOptions = {
|
|
311
|
+
signal?: AbortSignal;
|
|
312
|
+
temperature?: number;
|
|
313
|
+
};
|
|
314
|
+
interface NcpLLMApi {
|
|
315
|
+
generate(input: NcpLLMApiInput, options?: NcpLLMApiOptions): AsyncIterable<OpenAIChatChunk>;
|
|
316
|
+
}
|
|
317
|
+
//#endregion
|
|
233
318
|
//#region src/types/events.d.ts
|
|
234
319
|
/**
|
|
235
320
|
* NCP event and payload definitions.
|
|
@@ -243,6 +328,14 @@ type NcpRequestEnvelope = {
|
|
|
243
328
|
message: NcpMessage;
|
|
244
329
|
correlationId?: string;
|
|
245
330
|
metadata?: Record<string, unknown>;
|
|
331
|
+
providerRoute?: NcpProviderRuntimeRoute;
|
|
332
|
+
tools?: ReadonlyArray<OpenAITool>;
|
|
333
|
+
};
|
|
334
|
+
type NcpProviderRuntimeRoute = {
|
|
335
|
+
model: string;
|
|
336
|
+
apiKey?: string | null;
|
|
337
|
+
apiBase?: string | null;
|
|
338
|
+
headers: Record<string, string>;
|
|
246
339
|
};
|
|
247
340
|
/** Payload for message.incoming: message content from the other peer (partial or full). */
|
|
248
341
|
type NcpResponseEnvelope = {
|
|
@@ -667,91 +760,6 @@ interface NcpAgentRuntime {
|
|
|
667
760
|
run(input: NcpAgentRunInput, options?: NcpAgentRunOptions): AsyncIterable<NcpEndpointEvent>;
|
|
668
761
|
}
|
|
669
762
|
//#endregion
|
|
670
|
-
//#region src/agent-runtime/llm-api.d.ts
|
|
671
|
-
type OpenAIContentPart = {
|
|
672
|
-
type: "text";
|
|
673
|
-
text: string;
|
|
674
|
-
} | {
|
|
675
|
-
type: "image_url";
|
|
676
|
-
image_url: {
|
|
677
|
-
url: string;
|
|
678
|
-
detail?: "low" | "high" | "auto";
|
|
679
|
-
};
|
|
680
|
-
};
|
|
681
|
-
type OpenAIToolCall = {
|
|
682
|
-
id: string;
|
|
683
|
-
type: "function";
|
|
684
|
-
function: {
|
|
685
|
-
name: string;
|
|
686
|
-
arguments: string;
|
|
687
|
-
};
|
|
688
|
-
};
|
|
689
|
-
type OpenAIChatMessage = {
|
|
690
|
-
role: "system";
|
|
691
|
-
content: string;
|
|
692
|
-
} | {
|
|
693
|
-
role: "user";
|
|
694
|
-
content: string | OpenAIContentPart[];
|
|
695
|
-
} | {
|
|
696
|
-
role: "assistant";
|
|
697
|
-
content?: string | null;
|
|
698
|
-
reasoning_content?: string;
|
|
699
|
-
tool_calls?: OpenAIToolCall[];
|
|
700
|
-
} | {
|
|
701
|
-
role: "tool";
|
|
702
|
-
content: string;
|
|
703
|
-
tool_call_id: string;
|
|
704
|
-
};
|
|
705
|
-
type OpenAITool = {
|
|
706
|
-
type: "function";
|
|
707
|
-
function: {
|
|
708
|
-
name: string;
|
|
709
|
-
description?: string;
|
|
710
|
-
parameters?: Record<string, unknown>;
|
|
711
|
-
};
|
|
712
|
-
};
|
|
713
|
-
type OpenAIToolCallDelta = {
|
|
714
|
-
index?: number;
|
|
715
|
-
id?: string;
|
|
716
|
-
type?: "function";
|
|
717
|
-
function?: {
|
|
718
|
-
name?: string;
|
|
719
|
-
arguments?: string;
|
|
720
|
-
};
|
|
721
|
-
};
|
|
722
|
-
type OpenAIChatChunk = {
|
|
723
|
-
id?: string;
|
|
724
|
-
choices?: Array<{
|
|
725
|
-
index?: number;
|
|
726
|
-
delta?: {
|
|
727
|
-
content?: string | null;
|
|
728
|
-
tool_calls?: OpenAIToolCallDelta[];
|
|
729
|
-
reasoning_content?: string;
|
|
730
|
-
reasoning?: string;
|
|
731
|
-
};
|
|
732
|
-
finish_reason?: string | null;
|
|
733
|
-
}>;
|
|
734
|
-
usage?: {
|
|
735
|
-
prompt_tokens?: number;
|
|
736
|
-
completion_tokens?: number;
|
|
737
|
-
total_tokens?: number;
|
|
738
|
-
};
|
|
739
|
-
};
|
|
740
|
-
type NcpLLMApiInput = {
|
|
741
|
-
messages: OpenAIChatMessage[];
|
|
742
|
-
tools?: OpenAITool[];
|
|
743
|
-
model?: string;
|
|
744
|
-
thinkingLevel?: string | null;
|
|
745
|
-
max_tokens?: number;
|
|
746
|
-
};
|
|
747
|
-
type NcpLLMApiOptions = {
|
|
748
|
-
signal?: AbortSignal;
|
|
749
|
-
temperature?: number;
|
|
750
|
-
};
|
|
751
|
-
interface NcpLLMApi {
|
|
752
|
-
generate(input: NcpLLMApiInput, options?: NcpLLMApiOptions): AsyncIterable<OpenAIChatChunk>;
|
|
753
|
-
}
|
|
754
|
-
//#endregion
|
|
755
763
|
//#region src/agent-runtime/context-builder.d.ts
|
|
756
764
|
type NcpContextPrepareOptions = {
|
|
757
765
|
sessionMessages?: ReadonlyArray<NcpMessage>;
|
|
@@ -968,4 +976,4 @@ declare function normalizeAssistantText(text: string, mode: NcpAssistantReasonin
|
|
|
968
976
|
parts: NcpAssistantReasoningSegment[];
|
|
969
977
|
};
|
|
970
978
|
//#endregion
|
|
971
|
-
export { ListMessagesOptions, ListSessionsOptions, NCP_INTERNAL_VISIBILITY_METADATA_KEY, NcpActionPart, NcpAgentClientEndpoint, NcpAgentConversationHydrationParams, NcpAgentConversationSnapshot, NcpAgentConversationStateManager, NcpAgentRunApi, NcpAgentRunInput, NcpAgentRunOptions, NcpAgentRunSendOptions, NcpAgentRunStreamOptions, NcpAgentRuntime, NcpAgentServerEndpoint, NcpAgentStreamProvider, NcpAssistantReasoningNormalizationMode, NcpAssistantReasoningSegment, NcpAssistantTextStreamNormalizer, NcpCardPart, NcpCompletedEnvelope, NcpContextBuilder, NcpContextPrepareOptions, NcpConversationSnapshot, NcpConversationStateManager, NcpEncodeContext, NcpEndpoint, NcpEndpointEvent, NcpEndpointKind, NcpEndpointLatency, NcpEndpointManifest, NcpEndpointSubscriber, NcpError, NcpErrorCode, NcpEventType, NcpExtensionPart, NcpFailedEnvelope, NcpFilePart, NcpInvalidToolArgumentsResult, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessageAbortPayload, NcpMessageAcceptedPayload, NcpMessageDeliveredPayload, NcpMessagePart, NcpMessageReactionPayload, NcpMessageReadPayload, NcpMessageRecalledPayload, NcpMessageRole, NcpMessageSentPayload, NcpMessageStatus, NcpPendingToolCall, NcpPresenceUpdatedPayload, NcpReasoningDeltaPayload, NcpReasoningEndPayload, NcpReasoningPart, NcpReasoningStartPayload, NcpReplyTagParseResult, NcpRequestEnvelope, NcpResponseEnvelope, NcpRichTextPart, NcpRoundBuffer, NcpRunContext, NcpRunErrorPayload, NcpRunFinalMetadata, NcpRunFinishedPayload, NcpRunMetadataPayload, NcpRunReadyMetadata, NcpRunStartedPayload, NcpSessionApi, NcpSessionPatch, NcpSessionStatus, NcpSessionSummary, NcpSourcePart, NcpStepStartPart, NcpStreamEncoder, NcpStreamRequestPayload, NcpTextDeltaPayload, NcpTextEndPayload, NcpTextPart, NcpTextStartPayload, NcpTool, NcpToolCallArgsDeltaPayload, NcpToolCallArgsPayload, NcpToolCallEndPayload, NcpToolCallResult, NcpToolCallResultPayload, NcpToolCallStartPayload, NcpToolDefinition, NcpToolInvocationPart, NcpToolRegistry, NcpTypingEndPayload, NcpTypingStartPayload, OpenAIChatChunk, OpenAIChatMessage, OpenAIContentPart, OpenAITool, OpenAIToolCall, OpenAIToolCallDelta, isHiddenNcpMessage, normalizeAssistantText, readAssistantReasoningNormalizationMode, readAssistantReasoningNormalizationModeFromMetadata, sanitizeAssistantReplyTags, stripReplyTagsFromText, writeAssistantReasoningNormalizationModeToMetadata };
|
|
979
|
+
export { ListMessagesOptions, ListSessionsOptions, NCP_INTERNAL_VISIBILITY_METADATA_KEY, NcpActionPart, NcpAgentClientEndpoint, NcpAgentConversationHydrationParams, NcpAgentConversationSnapshot, NcpAgentConversationStateManager, NcpAgentRunApi, NcpAgentRunInput, NcpAgentRunOptions, NcpAgentRunSendOptions, NcpAgentRunStreamOptions, NcpAgentRuntime, NcpAgentServerEndpoint, NcpAgentStreamProvider, NcpAssistantReasoningNormalizationMode, NcpAssistantReasoningSegment, NcpAssistantTextStreamNormalizer, NcpCardPart, NcpCompletedEnvelope, NcpContextBuilder, NcpContextPrepareOptions, NcpConversationSnapshot, NcpConversationStateManager, NcpEncodeContext, NcpEndpoint, NcpEndpointEvent, NcpEndpointKind, NcpEndpointLatency, NcpEndpointManifest, NcpEndpointSubscriber, NcpError, NcpErrorCode, NcpEventType, NcpExtensionPart, NcpFailedEnvelope, NcpFilePart, NcpInvalidToolArgumentsResult, NcpLLMApi, NcpLLMApiInput, NcpLLMApiOptions, NcpMessage, NcpMessageAbortPayload, NcpMessageAcceptedPayload, NcpMessageDeliveredPayload, NcpMessagePart, NcpMessageReactionPayload, NcpMessageReadPayload, NcpMessageRecalledPayload, NcpMessageRole, NcpMessageSentPayload, NcpMessageStatus, NcpPendingToolCall, NcpPresenceUpdatedPayload, NcpProviderRuntimeRoute, NcpReasoningDeltaPayload, NcpReasoningEndPayload, NcpReasoningPart, NcpReasoningStartPayload, NcpReplyTagParseResult, NcpRequestEnvelope, NcpResponseEnvelope, NcpRichTextPart, NcpRoundBuffer, NcpRunContext, NcpRunErrorPayload, NcpRunFinalMetadata, NcpRunFinishedPayload, NcpRunMetadataPayload, NcpRunReadyMetadata, NcpRunStartedPayload, NcpSessionApi, NcpSessionPatch, NcpSessionStatus, NcpSessionSummary, NcpSourcePart, NcpStepStartPart, NcpStreamEncoder, NcpStreamRequestPayload, NcpTextDeltaPayload, NcpTextEndPayload, NcpTextPart, NcpTextStartPayload, NcpTool, NcpToolCallArgsDeltaPayload, NcpToolCallArgsPayload, NcpToolCallEndPayload, NcpToolCallResult, NcpToolCallResultPayload, NcpToolCallStartPayload, NcpToolDefinition, NcpToolInvocationPart, NcpToolRegistry, NcpTypingEndPayload, NcpTypingStartPayload, OpenAIChatChunk, OpenAIChatMessage, OpenAIContentPart, OpenAITool, OpenAIToolCall, OpenAIToolCallDelta, isHiddenNcpMessage, normalizeAssistantText, readAssistantReasoningNormalizationMode, readAssistantReasoningNormalizationModeFromMetadata, sanitizeAssistantReplyTags, stripReplyTagsFromText, writeAssistantReasoningNormalizationModeToMetadata };
|