@copilotkitnext/core 0.0.16 → 0.0.17
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.mts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +25 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -243,6 +243,9 @@ interface CopilotKitCoreConfig {
|
|
|
243
243
|
suggestionsConfig?: SuggestionsConfig[];
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
interface CopilotKitCoreStopAgentParams {
|
|
247
|
+
agent: AbstractAgent;
|
|
248
|
+
}
|
|
246
249
|
type CopilotKitCoreGetSuggestionsResult = {
|
|
247
250
|
suggestions: Suggestion[];
|
|
248
251
|
isLoading: boolean;
|
|
@@ -414,6 +417,7 @@ declare class CopilotKitCore {
|
|
|
414
417
|
* Agent connectivity (delegated to RunHandler)
|
|
415
418
|
*/
|
|
416
419
|
connectAgent(params: CopilotKitCoreConnectAgentParams): Promise<_ag_ui_client.RunAgentResult>;
|
|
420
|
+
stopAgent(params: CopilotKitCoreStopAgentParams): void;
|
|
417
421
|
runAgent(params: CopilotKitCoreRunAgentParams): Promise<_ag_ui_client.RunAgentResult>;
|
|
418
422
|
/**
|
|
419
423
|
* State management (delegated to StateManager)
|
|
@@ -615,9 +619,10 @@ interface ProxiedCopilotRuntimeAgentConfig extends Omit<HttpAgentConfig, "url">
|
|
|
615
619
|
declare class ProxiedCopilotRuntimeAgent extends HttpAgent {
|
|
616
620
|
runtimeUrl?: string;
|
|
617
621
|
constructor(config: ProxiedCopilotRuntimeAgentConfig);
|
|
622
|
+
abortRun(): void;
|
|
618
623
|
connect(input: RunAgentInput): Observable<BaseEvent>;
|
|
619
624
|
}
|
|
620
625
|
|
|
621
626
|
declare function completePartialMarkdown(input: string): string;
|
|
622
627
|
|
|
623
|
-
export { AgentRegistry, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, type CopilotKitCoreFriendsAccess, type CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, CopilotKitCoreRuntimeConnectionStatus, type CopilotKitCoreSubscriber, type DynamicSuggestionsConfig, type FrontendTool, ProxiedCopilotRuntimeAgent, type ProxiedCopilotRuntimeAgentConfig, RunHandler, StateManager, type StaticSuggestionsConfig, type Suggestion, type SuggestionAvailability, SuggestionEngine, type SuggestionsConfig, ToolCallStatus, completePartialMarkdown };
|
|
628
|
+
export { AgentRegistry, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, type CopilotKitCoreFriendsAccess, type CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, CopilotKitCoreRuntimeConnectionStatus, type CopilotKitCoreStopAgentParams, type CopilotKitCoreSubscriber, type DynamicSuggestionsConfig, type FrontendTool, ProxiedCopilotRuntimeAgent, type ProxiedCopilotRuntimeAgentConfig, RunHandler, StateManager, type StaticSuggestionsConfig, type Suggestion, type SuggestionAvailability, SuggestionEngine, type SuggestionsConfig, ToolCallStatus, completePartialMarkdown };
|
package/dist/index.d.ts
CHANGED
|
@@ -243,6 +243,9 @@ interface CopilotKitCoreConfig {
|
|
|
243
243
|
suggestionsConfig?: SuggestionsConfig[];
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
+
interface CopilotKitCoreStopAgentParams {
|
|
247
|
+
agent: AbstractAgent;
|
|
248
|
+
}
|
|
246
249
|
type CopilotKitCoreGetSuggestionsResult = {
|
|
247
250
|
suggestions: Suggestion[];
|
|
248
251
|
isLoading: boolean;
|
|
@@ -414,6 +417,7 @@ declare class CopilotKitCore {
|
|
|
414
417
|
* Agent connectivity (delegated to RunHandler)
|
|
415
418
|
*/
|
|
416
419
|
connectAgent(params: CopilotKitCoreConnectAgentParams): Promise<_ag_ui_client.RunAgentResult>;
|
|
420
|
+
stopAgent(params: CopilotKitCoreStopAgentParams): void;
|
|
417
421
|
runAgent(params: CopilotKitCoreRunAgentParams): Promise<_ag_ui_client.RunAgentResult>;
|
|
418
422
|
/**
|
|
419
423
|
* State management (delegated to StateManager)
|
|
@@ -615,9 +619,10 @@ interface ProxiedCopilotRuntimeAgentConfig extends Omit<HttpAgentConfig, "url">
|
|
|
615
619
|
declare class ProxiedCopilotRuntimeAgent extends HttpAgent {
|
|
616
620
|
runtimeUrl?: string;
|
|
617
621
|
constructor(config: ProxiedCopilotRuntimeAgentConfig);
|
|
622
|
+
abortRun(): void;
|
|
618
623
|
connect(input: RunAgentInput): Observable<BaseEvent>;
|
|
619
624
|
}
|
|
620
625
|
|
|
621
626
|
declare function completePartialMarkdown(input: string): string;
|
|
622
627
|
|
|
623
|
-
export { AgentRegistry, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, type CopilotKitCoreFriendsAccess, type CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, CopilotKitCoreRuntimeConnectionStatus, type CopilotKitCoreSubscriber, type DynamicSuggestionsConfig, type FrontendTool, ProxiedCopilotRuntimeAgent, type ProxiedCopilotRuntimeAgentConfig, RunHandler, StateManager, type StaticSuggestionsConfig, type Suggestion, type SuggestionAvailability, SuggestionEngine, type SuggestionsConfig, ToolCallStatus, completePartialMarkdown };
|
|
628
|
+
export { AgentRegistry, ContextStore, CopilotKitCore, type CopilotKitCoreAddAgentParams, type CopilotKitCoreConfig, type CopilotKitCoreConnectAgentParams, CopilotKitCoreErrorCode, type CopilotKitCoreFriendsAccess, type CopilotKitCoreGetSuggestionsResult, type CopilotKitCoreGetToolParams, type CopilotKitCoreRunAgentParams, CopilotKitCoreRuntimeConnectionStatus, type CopilotKitCoreStopAgentParams, type CopilotKitCoreSubscriber, type DynamicSuggestionsConfig, type FrontendTool, ProxiedCopilotRuntimeAgent, type ProxiedCopilotRuntimeAgentConfig, RunHandler, StateManager, type StaticSuggestionsConfig, type Suggestion, type SuggestionAvailability, SuggestionEngine, type SuggestionsConfig, ToolCallStatus, completePartialMarkdown };
|
package/dist/index.js
CHANGED
|
@@ -49,11 +49,29 @@ var ProxiedCopilotRuntimeAgent = class extends import_client.HttpAgent {
|
|
|
49
49
|
});
|
|
50
50
|
this.runtimeUrl = config.runtimeUrl;
|
|
51
51
|
}
|
|
52
|
+
abortRun() {
|
|
53
|
+
if (!this.runtimeUrl || !this.agentId || !this.threadId) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (typeof fetch === "undefined") {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const stopPath = `${this.runtimeUrl}/agent/${encodeURIComponent(this.agentId)}/stop/${encodeURIComponent(this.threadId)}`;
|
|
60
|
+
const origin = typeof window !== "undefined" && window.location ? window.location.origin : "http://localhost";
|
|
61
|
+
const base = new URL(this.runtimeUrl, origin);
|
|
62
|
+
const stopUrl = new URL(stopPath, base);
|
|
63
|
+
void fetch(stopUrl.toString(), {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: {
|
|
66
|
+
"Content-Type": "application/json",
|
|
67
|
+
...this.headers
|
|
68
|
+
}
|
|
69
|
+
}).catch((error) => {
|
|
70
|
+
console.error("ProxiedCopilotRuntimeAgent: stop request failed", error);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
52
73
|
connect(input) {
|
|
53
|
-
const httpEvents = (0, import_client.runHttpRequest)(
|
|
54
|
-
`${this.runtimeUrl}/agent/${this.agentId}/connect`,
|
|
55
|
-
this.requestInit(input)
|
|
56
|
-
);
|
|
74
|
+
const httpEvents = (0, import_client.runHttpRequest)(`${this.runtimeUrl}/agent/${this.agentId}/connect`, this.requestInit(input));
|
|
57
75
|
return (0, import_client.transformHttpEventStream)(httpEvents);
|
|
58
76
|
}
|
|
59
77
|
};
|
|
@@ -1521,6 +1539,9 @@ var CopilotKitCore = class {
|
|
|
1521
1539
|
async connectAgent(params) {
|
|
1522
1540
|
return this.runHandler.connectAgent(params);
|
|
1523
1541
|
}
|
|
1542
|
+
stopAgent(params) {
|
|
1543
|
+
params.agent.abortRun();
|
|
1544
|
+
}
|
|
1524
1545
|
async runAgent(params) {
|
|
1525
1546
|
return this.runHandler.runAgent(params);
|
|
1526
1547
|
}
|