@nextclaw/ncp 0.5.1 → 0.5.3
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 +96 -87
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -69,12 +69,13 @@ type NcpReasoningPart = {
|
|
|
69
69
|
* - `"call"` — The model has emitted a complete tool call; `args` is populated.
|
|
70
70
|
* - `"partial-call"` — Arguments are still being streamed; `args` may be incomplete.
|
|
71
71
|
* - `"result"` — The tool has returned; `result` is populated.
|
|
72
|
+
* - `"cancelled"` — The tool was interrupted before a result was delivered.
|
|
72
73
|
*/
|
|
73
74
|
type NcpToolInvocationPart = {
|
|
74
75
|
type: "tool-invocation";
|
|
75
76
|
toolName: string;
|
|
76
77
|
toolCallId?: string;
|
|
77
|
-
state?: "call" | "partial-call" | "result"; /** Tool input arguments. May be partial when `state === "partial-call"`. */
|
|
78
|
+
state?: "call" | "partial-call" | "result" | "cancelled"; /** Tool input arguments. May be partial when `state === "partial-call"`. */
|
|
78
79
|
args?: unknown; /** Tool output. Populated when `state === "result"`. */
|
|
79
80
|
result?: unknown;
|
|
80
81
|
};
|
|
@@ -230,6 +231,91 @@ interface NcpSessionApi {
|
|
|
230
231
|
deleteSession(sessionId: string): Promise<void>;
|
|
231
232
|
}
|
|
232
233
|
//#endregion
|
|
234
|
+
//#region src/agent-runtime/llm-api.d.ts
|
|
235
|
+
type OpenAIContentPart = {
|
|
236
|
+
type: "text";
|
|
237
|
+
text: string;
|
|
238
|
+
} | {
|
|
239
|
+
type: "image_url";
|
|
240
|
+
image_url: {
|
|
241
|
+
url: string;
|
|
242
|
+
detail?: "low" | "high" | "auto";
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
type OpenAIToolCall = {
|
|
246
|
+
id: string;
|
|
247
|
+
type: "function";
|
|
248
|
+
function: {
|
|
249
|
+
name: string;
|
|
250
|
+
arguments: string;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
type OpenAIChatMessage = {
|
|
254
|
+
role: "system";
|
|
255
|
+
content: string;
|
|
256
|
+
} | {
|
|
257
|
+
role: "user";
|
|
258
|
+
content: string | OpenAIContentPart[];
|
|
259
|
+
} | {
|
|
260
|
+
role: "assistant";
|
|
261
|
+
content?: string | null;
|
|
262
|
+
reasoning_content?: string;
|
|
263
|
+
tool_calls?: OpenAIToolCall[];
|
|
264
|
+
} | {
|
|
265
|
+
role: "tool";
|
|
266
|
+
content: string;
|
|
267
|
+
tool_call_id: string;
|
|
268
|
+
};
|
|
269
|
+
type OpenAITool = {
|
|
270
|
+
type: "function";
|
|
271
|
+
function: {
|
|
272
|
+
name: string;
|
|
273
|
+
description?: string;
|
|
274
|
+
parameters?: Record<string, unknown>;
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
type OpenAIToolCallDelta = {
|
|
278
|
+
index?: number;
|
|
279
|
+
id?: string;
|
|
280
|
+
type?: "function";
|
|
281
|
+
function?: {
|
|
282
|
+
name?: string;
|
|
283
|
+
arguments?: string;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
type OpenAIChatChunk = {
|
|
287
|
+
id?: string;
|
|
288
|
+
choices?: Array<{
|
|
289
|
+
index?: number;
|
|
290
|
+
delta?: {
|
|
291
|
+
content?: string | null;
|
|
292
|
+
tool_calls?: OpenAIToolCallDelta[];
|
|
293
|
+
reasoning_content?: string;
|
|
294
|
+
reasoning?: string;
|
|
295
|
+
};
|
|
296
|
+
finish_reason?: string | null;
|
|
297
|
+
}>;
|
|
298
|
+
usage?: {
|
|
299
|
+
prompt_tokens?: number;
|
|
300
|
+
completion_tokens?: number;
|
|
301
|
+
total_tokens?: number;
|
|
302
|
+
};
|
|
303
|
+
};
|
|
304
|
+
type NcpLLMApiInput = {
|
|
305
|
+
messages: OpenAIChatMessage[];
|
|
306
|
+
tools?: OpenAITool[];
|
|
307
|
+
model?: string;
|
|
308
|
+
thinkingLevel?: string | null;
|
|
309
|
+
max_tokens?: number;
|
|
310
|
+
};
|
|
311
|
+
type NcpLLMApiOptions = {
|
|
312
|
+
signal?: AbortSignal;
|
|
313
|
+
temperature?: number;
|
|
314
|
+
};
|
|
315
|
+
interface NcpLLMApi {
|
|
316
|
+
generate(input: NcpLLMApiInput, options?: NcpLLMApiOptions): AsyncIterable<OpenAIChatChunk>;
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
233
319
|
//#region src/types/events.d.ts
|
|
234
320
|
/**
|
|
235
321
|
* NCP event and payload definitions.
|
|
@@ -243,6 +329,14 @@ type NcpRequestEnvelope = {
|
|
|
243
329
|
message: NcpMessage;
|
|
244
330
|
correlationId?: string;
|
|
245
331
|
metadata?: Record<string, unknown>;
|
|
332
|
+
providerRoute?: NcpProviderRuntimeRoute;
|
|
333
|
+
tools?: ReadonlyArray<OpenAITool>;
|
|
334
|
+
};
|
|
335
|
+
type NcpProviderRuntimeRoute = {
|
|
336
|
+
model: string;
|
|
337
|
+
apiKey?: string | null;
|
|
338
|
+
apiBase?: string | null;
|
|
339
|
+
headers: Record<string, string>;
|
|
246
340
|
};
|
|
247
341
|
/** Payload for message.incoming: message content from the other peer (partial or full). */
|
|
248
342
|
type NcpResponseEnvelope = {
|
|
@@ -667,91 +761,6 @@ interface NcpAgentRuntime {
|
|
|
667
761
|
run(input: NcpAgentRunInput, options?: NcpAgentRunOptions): AsyncIterable<NcpEndpointEvent>;
|
|
668
762
|
}
|
|
669
763
|
//#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
764
|
//#region src/agent-runtime/context-builder.d.ts
|
|
756
765
|
type NcpContextPrepareOptions = {
|
|
757
766
|
sessionMessages?: ReadonlyArray<NcpMessage>;
|
|
@@ -968,4 +977,4 @@ declare function normalizeAssistantText(text: string, mode: NcpAssistantReasonin
|
|
|
968
977
|
parts: NcpAssistantReasoningSegment[];
|
|
969
978
|
};
|
|
970
979
|
//#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 };
|
|
980
|
+
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 };
|