@nextclaw/ncp 0.5.4 → 0.5.6-beta.0
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 +31 -2
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,19 @@ type NcpReasoningPart = {
|
|
|
62
62
|
type: "reasoning";
|
|
63
63
|
text: string;
|
|
64
64
|
};
|
|
65
|
+
type NcpToolOutputTextItem = {
|
|
66
|
+
type: "input_text";
|
|
67
|
+
text: string;
|
|
68
|
+
};
|
|
69
|
+
type NcpToolOutputImageItem = {
|
|
70
|
+
type: "input_image";
|
|
71
|
+
imageUrl: string;
|
|
72
|
+
mimeType?: string;
|
|
73
|
+
detail?: "low" | "high" | "auto" | "original";
|
|
74
|
+
originalDataChars?: number;
|
|
75
|
+
dataOmitted?: boolean;
|
|
76
|
+
};
|
|
77
|
+
type NcpToolOutputContentItem = NcpToolOutputTextItem | NcpToolOutputImageItem;
|
|
65
78
|
/**
|
|
66
79
|
* Represents a tool call and its lifecycle.
|
|
67
80
|
*
|
|
@@ -77,7 +90,8 @@ type NcpToolInvocationPart = {
|
|
|
77
90
|
toolCallId?: string;
|
|
78
91
|
state?: "call" | "partial-call" | "result" | "cancelled"; /** Tool input arguments. May be partial when `state === "partial-call"`. */
|
|
79
92
|
args?: unknown; /** Tool output. Populated when `state === "result"`. */
|
|
80
|
-
result?: unknown;
|
|
93
|
+
result?: unknown; /** Model-visible structured output items. Text is bounded; images remain image items. */
|
|
94
|
+
resultContentItems?: NcpToolOutputContentItem[];
|
|
81
95
|
};
|
|
82
96
|
/**
|
|
83
97
|
* A rich card with arbitrary structured data.
|
|
@@ -207,6 +221,7 @@ type NcpSessionSummary = {
|
|
|
207
221
|
lastMessageAt?: string;
|
|
208
222
|
status?: NcpSessionStatus;
|
|
209
223
|
metadata?: Record<string, unknown>;
|
|
224
|
+
contextWindow?: Record<string, unknown> | null;
|
|
210
225
|
};
|
|
211
226
|
type ListSessionsOptions = {
|
|
212
227
|
limit?: number;
|
|
@@ -444,6 +459,10 @@ type NcpRunMetadataPayload = {
|
|
|
444
459
|
runId?: string;
|
|
445
460
|
metadata: Record<string, unknown>;
|
|
446
461
|
};
|
|
462
|
+
type NcpContextWindowUpdatedPayload = {
|
|
463
|
+
sessionId: string;
|
|
464
|
+
contextWindow: Record<string, unknown>;
|
|
465
|
+
};
|
|
447
466
|
type NcpTextStartPayload = {
|
|
448
467
|
sessionId: string;
|
|
449
468
|
messageId: string;
|
|
@@ -495,6 +514,7 @@ type NcpToolCallResultPayload = {
|
|
|
495
514
|
sessionId: string;
|
|
496
515
|
toolCallId: string;
|
|
497
516
|
content: unknown;
|
|
517
|
+
contentItems?: NcpToolOutputContentItem[];
|
|
498
518
|
};
|
|
499
519
|
declare enum NcpEventType {
|
|
500
520
|
EndpointReady = "endpoint.ready",
|
|
@@ -526,6 +546,7 @@ declare enum NcpEventType {
|
|
|
526
546
|
RunFinished = "run.finished",
|
|
527
547
|
RunError = "run.error",
|
|
528
548
|
RunMetadata = "run.metadata",
|
|
549
|
+
ContextWindowUpdated = "context-window.updated",
|
|
529
550
|
TypingStart = "typing.start",
|
|
530
551
|
TypingEnd = "typing.end",
|
|
531
552
|
PresenceUpdated = "presence.updated"
|
|
@@ -571,6 +592,9 @@ type NcpEndpointEvent = {
|
|
|
571
592
|
} | {
|
|
572
593
|
type: NcpEventType.RunMetadata;
|
|
573
594
|
payload: NcpRunMetadataPayload;
|
|
595
|
+
} | {
|
|
596
|
+
type: NcpEventType.ContextWindowUpdated;
|
|
597
|
+
payload: NcpContextWindowUpdatedPayload;
|
|
574
598
|
} | {
|
|
575
599
|
type: NcpEventType.MessageTextStart;
|
|
576
600
|
payload: NcpTextStartPayload;
|
|
@@ -790,6 +814,7 @@ type NcpToolCallResult = {
|
|
|
790
814
|
args: Record<string, unknown> | null;
|
|
791
815
|
rawArgsText: string;
|
|
792
816
|
result: unknown;
|
|
817
|
+
contentItems?: NcpToolOutputContentItem[];
|
|
793
818
|
};
|
|
794
819
|
type NcpInvalidToolArgumentsResult = {
|
|
795
820
|
ok: false;
|
|
@@ -872,6 +897,8 @@ interface NcpConversationSnapshot {
|
|
|
872
897
|
readonly streamingMessage: NcpMessage | null;
|
|
873
898
|
/** Latest error, if any (e.g. from message.failed or endpoint.error). */
|
|
874
899
|
readonly error: NcpError | null;
|
|
900
|
+
/** Latest context-window usage snapshot for this conversation, if known. */
|
|
901
|
+
readonly contextWindow: Record<string, unknown> | null;
|
|
875
902
|
}
|
|
876
903
|
/**
|
|
877
904
|
* Agent snapshot: extends base snapshot with active run state.
|
|
@@ -911,6 +938,7 @@ type NcpAgentConversationHydrationParams = {
|
|
|
911
938
|
sessionId: string;
|
|
912
939
|
messages: ReadonlyArray<NcpMessage>;
|
|
913
940
|
activeRun?: NcpRunContext | null;
|
|
941
|
+
contextWindow?: Record<string, unknown> | null;
|
|
914
942
|
};
|
|
915
943
|
/**
|
|
916
944
|
* Agent-scenario state manager: extends the generic conversation state manager
|
|
@@ -941,6 +969,7 @@ interface NcpAgentConversationStateManager extends NcpConversationStateManager {
|
|
|
941
969
|
handleRunFinished(payload: NcpRunFinishedPayload): void;
|
|
942
970
|
handleRunError(payload: NcpRunErrorPayload): void;
|
|
943
971
|
handleRunMetadata(payload: NcpRunMetadataPayload): void;
|
|
972
|
+
handleContextWindowUpdated(payload: NcpContextWindowUpdatedPayload): void;
|
|
944
973
|
handleEndpointError(payload: NcpError): void;
|
|
945
974
|
}
|
|
946
975
|
//#endregion
|
|
@@ -977,4 +1006,4 @@ declare function normalizeAssistantText(text: string, mode: NcpAssistantReasonin
|
|
|
977
1006
|
parts: NcpAssistantReasoningSegment[];
|
|
978
1007
|
};
|
|
979
1008
|
//#endregion
|
|
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 };
|
|
1009
|
+
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, NcpContextWindowUpdatedPayload, 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, NcpToolOutputContentItem, NcpToolOutputImageItem, NcpToolOutputTextItem, NcpToolRegistry, NcpTypingEndPayload, NcpTypingStartPayload, OpenAIChatChunk, OpenAIChatMessage, OpenAIContentPart, OpenAITool, OpenAIToolCall, OpenAIToolCallDelta, isHiddenNcpMessage, normalizeAssistantText, readAssistantReasoningNormalizationMode, readAssistantReasoningNormalizationModeFromMetadata, sanitizeAssistantReplyTags, stripReplyTagsFromText, writeAssistantReasoningNormalizationModeToMetadata };
|
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ let NcpEventType = /* @__PURE__ */ function(NcpEventType) {
|
|
|
35
35
|
NcpEventType["RunFinished"] = "run.finished";
|
|
36
36
|
NcpEventType["RunError"] = "run.error";
|
|
37
37
|
NcpEventType["RunMetadata"] = "run.metadata";
|
|
38
|
+
NcpEventType["ContextWindowUpdated"] = "context-window.updated";
|
|
38
39
|
NcpEventType["TypingStart"] = "typing.start";
|
|
39
40
|
NcpEventType["TypingEnd"] = "typing.end";
|
|
40
41
|
NcpEventType["PresenceUpdated"] = "presence.updated";
|