@cuylabs/agent-server 3.2.1 → 4.0.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 +11 -8
- package/dist/index.js +1 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _cuylabs_agent_core from '@cuylabs/agent-core';
|
|
2
|
-
import { PluginCommandMetadata, FileEntry, Message, TokenUsage, QueuedFollowUpRecord, FollowUpStatus, AgentEvent, ApprovalAction, ApprovalRememberScope, HumanInputResponse, ApprovalRequest, HumanInputRequest, SteeringResponse, FollowUpResponse, FollowUpDecisionAction, FollowUpPolicy, PendingIntervention, SessionInfo, SessionStorage, Agent } from '@cuylabs/agent-core';
|
|
2
|
+
import { PluginCommandMetadata, FileEntry, Message, AgentTurnSourceChatOptions, TokenUsage, QueuedFollowUpRecord, FollowUpStatus, AgentEvent, ApprovalAction, ApprovalRememberScope, HumanInputResponse, ApprovalRequest, HumanInputRequest, SteeringResponse, FollowUpResponse, FollowUpDecisionAction, AgentTurnSource, FollowUpPolicy, PendingIntervention, SessionInfo, SessionStorage, Agent } from '@cuylabs/agent-core';
|
|
3
3
|
import { CoordinatorNotificationKind, CoordinatorNotification } from '@cuylabs/agent-core/team';
|
|
4
4
|
import { EventBus } from '@cuylabs/agent-core/events';
|
|
5
5
|
import { Readable, Writable } from 'node:stream';
|
|
@@ -153,9 +153,14 @@ interface BranchSessionOptions {
|
|
|
153
153
|
leafId?: string;
|
|
154
154
|
summary?: string;
|
|
155
155
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
156
|
+
/**
|
|
157
|
+
* Serializable options accepted by the agent-server `startTurn` protocol.
|
|
158
|
+
*
|
|
159
|
+
* This intentionally tracks only the wire-safe subset of
|
|
160
|
+
* `AgentTurnSourceChatOptions`. `AbortSignal` is process-local and is routed
|
|
161
|
+
* through the runtime's turn controller instead of the RPC payload.
|
|
162
|
+
*/
|
|
163
|
+
type StartTurnOptions = Pick<AgentTurnSourceChatOptions, "system">;
|
|
159
164
|
interface AppApprovalInputRequest {
|
|
160
165
|
id: string;
|
|
161
166
|
kind: "approval";
|
|
@@ -331,7 +336,7 @@ type AgentServerNotification = {
|
|
|
331
336
|
*/
|
|
332
337
|
declare function matchesNotificationSubscription(notification: AgentServerNotification, options?: AgentServerSubscriptionOptions): boolean;
|
|
333
338
|
|
|
334
|
-
interface AgentServerAdapter {
|
|
339
|
+
interface AgentServerAdapter extends AgentTurnSource {
|
|
335
340
|
readonly cwd: string;
|
|
336
341
|
getCapabilities?(): AgentServerCapabilitiesPatch;
|
|
337
342
|
getModelState?(): Promise<AppModelState> | AppModelState;
|
|
@@ -343,9 +348,7 @@ interface AgentServerAdapter {
|
|
|
343
348
|
compactSessionContext?(sessionId: string): Promise<AppContextCompactionResult> | AppContextCompactionResult;
|
|
344
349
|
undoSessionTurn?(sessionId: string): Promise<AppUndoResult> | AppUndoResult;
|
|
345
350
|
getSessionTurnDiff?(sessionId: string): Promise<string | null> | string | null;
|
|
346
|
-
chat(sessionId: string, message: string, options?:
|
|
347
|
-
abort?: AbortSignal;
|
|
348
|
-
}): AsyncGenerator<AgentEvent>;
|
|
351
|
+
chat(sessionId: string, message: string, options?: AgentTurnSourceChatOptions): AsyncGenerator<AgentEvent>;
|
|
349
352
|
followUpPolicy?: FollowUpPolicy;
|
|
350
353
|
steer?(request: {
|
|
351
354
|
sessionId: string;
|
package/dist/index.js
CHANGED
|
@@ -285,10 +285,7 @@ function createAgentServerAdapter(agent, options = {}) {
|
|
|
285
285
|
getSessionTurnDiff,
|
|
286
286
|
async *chat(sessionId, message, chatOptions) {
|
|
287
287
|
lastTrackedTurnSessionId = sessionId;
|
|
288
|
-
for await (const event of agent.chat(sessionId, message, {
|
|
289
|
-
...chatOptions?.abort ? { abort: chatOptions.abort } : {},
|
|
290
|
-
...chatOptions?.system ? { system: chatOptions.system } : {}
|
|
291
|
-
})) {
|
|
288
|
+
for await (const event of agent.chat(sessionId, message, chatOptions)) {
|
|
292
289
|
yield event;
|
|
293
290
|
}
|
|
294
291
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cuylabs/agent-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Transport-neutral local server for @cuylabs/agent-core sessions, turns, and streamed events",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"ws": "^8.19.0",
|
|
22
|
-
"@cuylabs/agent-core": "^
|
|
22
|
+
"@cuylabs/agent-core": "^4.0.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^22.0.0",
|