@cuylabs/agent-runtime-dapr 4.9.0 → 4.10.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.
@@ -5,18 +5,18 @@ import {
5
5
  createWorkflowDispatchTarget,
6
6
  invokeRemoteAgentRun,
7
7
  readWorkflowCompletion
8
- } from "./chunk-6BLY7B7U.js";
8
+ } from "./chunk-BQLQLDWZ.js";
9
9
  import {
10
10
  DaprExecutionStore,
11
11
  createDaprExecutionObserver,
12
12
  createDaprLoggingObserver,
13
13
  createWorkflowObserverBridge
14
- } from "./chunk-J3IJLF6U.js";
14
+ } from "./chunk-POIJYTT6.js";
15
15
  import {
16
16
  DaprWorkflowClient,
17
17
  createDaprAgentTurnWorkflowKit,
18
18
  isTerminalDaprWorkflowStatus
19
- } from "./chunk-2TBZCBXE.js";
19
+ } from "./chunk-7VYLWJTB.js";
20
20
  import {
21
21
  DaprSidecarClient,
22
22
  __export,
@@ -5299,13 +5299,12 @@ function createDaprWorkflowFollowUpRuntime(options) {
5299
5299
  }
5300
5300
 
5301
5301
  // src/host/workflow/workflow-host.ts
5302
- import { randomUUID } from "crypto";
5303
5302
  import process2 from "process";
5304
5303
  import {
5305
5304
  MiddlewareRunner,
5306
- SessionManager,
5307
5305
  isApprovalMiddleware as isApprovalMiddleware2,
5308
5306
  createAgentWorkflowTurnState,
5307
+ restoreAgentWorkflowMessages,
5309
5308
  snapshotAgentWorkflowMessage,
5310
5309
  snapshotAgentWorkflowMessages
5311
5310
  } from "@cuylabs/agent-core";
@@ -8200,22 +8199,70 @@ function createDaprTeamRunner(options) {
8200
8199
  };
8201
8200
  }
8202
8201
 
8203
- // src/host/workflow/workflow-host.ts
8204
- function buildToolRecord(agent) {
8205
- return Object.fromEntries(
8206
- agent.getTools().map((tool) => [tool.id, tool])
8207
- );
8202
+ // src/host/workflow/control-requests.ts
8203
+ import { randomUUID } from "crypto";
8204
+ function validateControlRequestInput(input) {
8205
+ if (!input.workflowInstanceId.trim()) {
8206
+ throw new Error(
8207
+ '"workflowInstanceId" is required and must be a non-empty string.'
8208
+ );
8209
+ }
8210
+ const sessionId = input.sessionId.trim();
8211
+ if (!sessionId) {
8212
+ throw new Error('"sessionId" is required and must be a non-empty string.');
8213
+ }
8214
+ const message = input.message.trim();
8215
+ if (!message) {
8216
+ throw new Error('"message" is required and must be a non-empty string.');
8217
+ }
8218
+ return {
8219
+ sessionId,
8220
+ message,
8221
+ timestamp: input.timestamp ?? Date.now()
8222
+ };
8208
8223
  }
8209
- function createWorkflowToolMiddlewareRunner(agent) {
8210
- const inherited = agent.getMiddlewareRunner().getMiddleware();
8211
- return new MiddlewareRunner(
8212
- inherited.filter((mw) => !isApprovalMiddleware2(mw))
8213
- );
8224
+ function createSteeringRequest(input) {
8225
+ const { sessionId, message, timestamp } = validateControlRequestInput(input);
8226
+ return {
8227
+ id: input.id?.trim() || randomUUID(),
8228
+ sessionId,
8229
+ message,
8230
+ timestamp
8231
+ };
8232
+ }
8233
+ function createFollowUpRequest(input) {
8234
+ const { sessionId, message, timestamp } = validateControlRequestInput(input);
8235
+ return {
8236
+ id: input.id?.trim() || randomUUID(),
8237
+ sessionId,
8238
+ message,
8239
+ timestamp
8240
+ };
8241
+ }
8242
+
8243
+ // src/host/workflow/session.ts
8244
+ import { randomUUID as randomUUID2 } from "crypto";
8245
+ import { SessionManager } from "@cuylabs/agent-core";
8246
+ function createWorkflowSessionId(sessionId) {
8247
+ const normalized = sessionId?.trim();
8248
+ return normalized && normalized.length > 0 ? normalized : `workflow_${randomUUID2().slice(0, 8)}`;
8249
+ }
8250
+ function normalizeWorkflowInstanceId(explicitInstanceId, sessionId) {
8251
+ const normalized = explicitInstanceId?.trim();
8252
+ return normalized && normalized.length > 0 ? normalized : `turn_${sessionId}_${randomUUID2().slice(0, 8)}`;
8253
+ }
8254
+ function createWorkflowUserMessage(message, createdAt) {
8255
+ return {
8256
+ id: randomUUID2(),
8257
+ role: "user",
8258
+ content: message,
8259
+ createdAt: new Date(createdAt)
8260
+ };
8214
8261
  }
8215
8262
  function createScopedSessionManager(agent) {
8216
8263
  return new SessionManager(agent.getSessionManager().getStorage());
8217
8264
  }
8218
- async function ensureSessionLoaded(agent, sessionId, options) {
8265
+ async function ensureWorkflowSessionLoaded(agent, sessionId, options) {
8219
8266
  const sessions = createScopedSessionManager(agent);
8220
8267
  const storage = sessions.getStorage();
8221
8268
  let existingEntries;
@@ -8240,61 +8287,18 @@ async function ensureSessionLoaded(agent, sessionId, options) {
8240
8287
  await sessions.load(sessionId);
8241
8288
  return sessions;
8242
8289
  }
8243
- function createUserMessage(message, createdAt) {
8244
- return {
8245
- id: randomUUID(),
8246
- role: "user",
8247
- content: message,
8248
- createdAt: new Date(createdAt)
8249
- };
8250
- }
8251
- function normalizeWorkflowInstanceId(explicitInstanceId, sessionId) {
8252
- const normalized = explicitInstanceId?.trim();
8253
- return normalized && normalized.length > 0 ? normalized : `turn_${sessionId}_${randomUUID().slice(0, 8)}`;
8254
- }
8255
- function createSteeringRequest(input) {
8256
- if (!input.workflowInstanceId.trim()) {
8257
- throw new Error(
8258
- '"workflowInstanceId" is required and must be a non-empty string.'
8259
- );
8260
- }
8261
- const sessionId = input.sessionId.trim();
8262
- if (!sessionId) {
8263
- throw new Error('"sessionId" is required and must be a non-empty string.');
8264
- }
8265
- const message = input.message.trim();
8266
- if (!message) {
8267
- throw new Error('"message" is required and must be a non-empty string.');
8268
- }
8269
- const timestamp = input.timestamp ?? Date.now();
8270
- return {
8271
- id: input.id?.trim() || randomUUID(),
8272
- sessionId,
8273
- message,
8274
- timestamp
8275
- };
8290
+
8291
+ // src/host/workflow/workflow-host.ts
8292
+ function buildToolRecord(agent) {
8293
+ return Object.fromEntries(
8294
+ agent.getTools().map((tool) => [tool.id, tool])
8295
+ );
8276
8296
  }
8277
- function createFollowUpRequest(input) {
8278
- if (!input.workflowInstanceId.trim()) {
8279
- throw new Error(
8280
- '"workflowInstanceId" is required and must be a non-empty string.'
8281
- );
8282
- }
8283
- const sessionId = input.sessionId.trim();
8284
- if (!sessionId) {
8285
- throw new Error('"sessionId" is required and must be a non-empty string.');
8286
- }
8287
- const message = input.message.trim();
8288
- if (!message) {
8289
- throw new Error('"message" is required and must be a non-empty string.');
8290
- }
8291
- const timestamp = input.timestamp ?? Date.now();
8292
- return {
8293
- id: input.id?.trim() || randomUUID(),
8294
- sessionId,
8295
- message,
8296
- timestamp
8297
- };
8297
+ function createWorkflowToolMiddlewareRunner(agent) {
8298
+ const inherited = agent.getMiddlewareRunner().getMiddleware();
8299
+ return new MiddlewareRunner(
8300
+ inherited.filter((mw) => !isApprovalMiddleware2(mw))
8301
+ );
8298
8302
  }
8299
8303
  function createDaprAgentWorkflowHost(options) {
8300
8304
  const now = options.now ?? (() => (/* @__PURE__ */ new Date()).toISOString());
@@ -8411,6 +8415,52 @@ function createDaprAgentWorkflowHost(options) {
8411
8415
  ...onEvent ? { onEvent } : {},
8412
8416
  now
8413
8417
  },
8418
+ contextCompactionActivity: {
8419
+ compact: async (input) => {
8420
+ const sessions = await ensureWorkflowSessionLoaded(
8421
+ options.agent,
8422
+ input.sessionId
8423
+ );
8424
+ const result = await options.agent.compactMessages(
8425
+ restoreAgentWorkflowMessages(input.messages),
8426
+ { force: input.force }
8427
+ );
8428
+ if (!result.compacted) {
8429
+ return {
8430
+ compacted: false,
8431
+ messages: input.messages.map((message) => structuredClone(message)),
8432
+ inputTokens: result.tokensBefore,
8433
+ limit: result.limit,
8434
+ decision: result.decision,
8435
+ effectiveness: result.effectiveness,
8436
+ removedCount: 0,
8437
+ tokensRemoved: 0,
8438
+ summarized: false
8439
+ };
8440
+ }
8441
+ await sessions.replaceWithCompaction({
8442
+ summary: result.storageSummary,
8443
+ displaySummary: result.displaySummary,
8444
+ messages: result.persistedMessages,
8445
+ tokensBefore: result.tokensBefore,
8446
+ tokensAfter: result.tokensAfter
8447
+ });
8448
+ return {
8449
+ compacted: true,
8450
+ messages: snapshotAgentWorkflowMessages(sessions.getMessages()),
8451
+ inputTokens: result.tokensBefore,
8452
+ limit: result.limit,
8453
+ decision: result.decision,
8454
+ effectiveness: result.effectiveness,
8455
+ removedCount: result.removedCount,
8456
+ tokensRemoved: result.tokensRemoved,
8457
+ summarized: result.summarized,
8458
+ ...result.summary ? { summary: result.summary } : {},
8459
+ ...result.cutIndex !== void 0 ? { cutIndex: result.cutIndex } : {},
8460
+ ...result.cutReason ? { cutReason: result.cutReason } : {}
8461
+ };
8462
+ }
8463
+ },
8414
8464
  ...options.humanInputRuntime?.hasHumanInputTools ? {
8415
8465
  humanInputCheckActivity: {
8416
8466
  check: async (input) => {
@@ -8460,7 +8510,10 @@ function createDaprAgentWorkflowHost(options) {
8460
8510
  },
8461
8511
  commitActivity: {
8462
8512
  persistMessages: async (sessionId, messages) => {
8463
- const sessions = await ensureSessionLoaded(options.agent, sessionId);
8513
+ const sessions = await ensureWorkflowSessionLoaded(
8514
+ options.agent,
8515
+ sessionId
8516
+ );
8464
8517
  await sessions.addMessages(messages);
8465
8518
  },
8466
8519
  now
@@ -8486,6 +8539,12 @@ function createDaprAgentWorkflowHost(options) {
8486
8539
  workflowKit.activities.steerDrain.handler
8487
8540
  );
8488
8541
  }
8542
+ if (workflowKit.activities.contextCompaction) {
8543
+ registered.registerActivityWithName(
8544
+ workflowKit.activities.contextCompaction.name,
8545
+ workflowKit.activities.contextCompaction.handler
8546
+ );
8547
+ }
8489
8548
  registered.registerActivityWithName(
8490
8549
  workflowKit.activities.modelStep.name,
8491
8550
  workflowKit.activities.modelStep.handler
@@ -8517,23 +8576,35 @@ function createDaprAgentWorkflowHost(options) {
8517
8576
  );
8518
8577
  },
8519
8578
  async createInitialState(request) {
8520
- const sessionId = request.sessionId?.trim() || `workflow_${randomUUID().slice(0, 8)}`;
8579
+ const sessionId = createWorkflowSessionId(request.sessionId);
8580
+ const workflowInstanceId = normalizeWorkflowInstanceId(
8581
+ request.workflowInstanceId,
8582
+ sessionId
8583
+ );
8521
8584
  const startedAt = now();
8522
- const sessions = await ensureSessionLoaded(options.agent, sessionId, {
8523
- title: request.title,
8524
- parentSessionId: request.parentSessionId
8525
- });
8585
+ const sessions = await ensureWorkflowSessionLoaded(
8586
+ options.agent,
8587
+ sessionId,
8588
+ {
8589
+ title: request.title,
8590
+ parentSessionId: request.parentSessionId
8591
+ }
8592
+ );
8526
8593
  const seedableFollowUps = options.followUpsEnabled === false ? [] : await options.followUpRuntime?.listSeedable(sessionId) ?? [];
8527
8594
  if (seedableFollowUps.length > 0) {
8528
8595
  await sessions.addMessages(
8529
8596
  seedableFollowUps.map(
8530
- (followUp) => createUserMessage(followUp.message, followUp.createdAt)
8597
+ (followUp) => createWorkflowUserMessage(followUp.message, followUp.createdAt)
8531
8598
  )
8532
8599
  );
8533
8600
  }
8534
- const inputMessage = createUserMessage(request.message, startedAt);
8601
+ const inputMessage = createWorkflowUserMessage(
8602
+ request.message,
8603
+ startedAt
8604
+ );
8535
8605
  const initialState = createAgentWorkflowTurnState({
8536
8606
  sessionId,
8607
+ turnId: workflowInstanceId,
8537
8608
  startedAt,
8538
8609
  maxSteps: request.maxSteps ?? options.agent.getTurnRuntimeConfig().maxSteps,
8539
8610
  systemPrompts: await options.agent.buildSystemPrompts(
@@ -8545,16 +8616,14 @@ function createDaprAgentWorkflowHost(options) {
8545
8616
  });
8546
8617
  return {
8547
8618
  sessionId,
8548
- workflowInstanceId: normalizeWorkflowInstanceId(
8549
- request.workflowInstanceId,
8550
- sessionId
8551
- ),
8619
+ turnId: workflowInstanceId,
8620
+ workflowInstanceId,
8552
8621
  initialState,
8553
8622
  seededFollowUpIds: seedableFollowUps.map((followUp) => followUp.id)
8554
8623
  };
8555
8624
  },
8556
8625
  async startTurn(client, request) {
8557
- const sessionId = request.sessionId?.trim() || `workflow_${randomUUID().slice(0, 8)}`;
8626
+ const sessionId = createWorkflowSessionId(request.sessionId);
8558
8627
  const releaseSessionLock = await options.agent.acquireSessionTurnLock(sessionId);
8559
8628
  let prepared;
8560
8629
  try {
@@ -8615,6 +8684,10 @@ function createDaprAgentWorkflowHost(options) {
8615
8684
  await activeTurn.bridge.notifyTaskError(
8616
8685
  prepared?.initialState ?? createAgentWorkflowTurnState({
8617
8686
  sessionId,
8687
+ turnId: prepared?.workflowInstanceId ?? normalizeWorkflowInstanceId(
8688
+ request.workflowInstanceId,
8689
+ sessionId
8690
+ ),
8618
8691
  startedAt: now(),
8619
8692
  maxSteps: request.maxSteps ?? options.agent.getTurnRuntimeConfig().maxSteps
8620
8693
  }),
@@ -9992,49 +10065,10 @@ async function startDaprHostHttpServer(options) {
9992
10065
  }
9993
10066
 
9994
10067
  // src/host/workflow/agent-server.ts
9995
- import { randomUUID as randomUUID2 } from "crypto";
9996
- import { ensureSessionLoaded as ensureSessionLoaded2 } from "@cuylabs/agent-core";
9997
- function mergeCapabilities(base, patch) {
9998
- if (!patch) {
9999
- return structuredClone(base);
10000
- }
10001
- const merged = structuredClone(base);
10002
- for (const [key, value] of Object.entries(patch)) {
10003
- const current = merged[key];
10004
- if (current && typeof current === "object" && !Array.isArray(current) && value && typeof value === "object" && !Array.isArray(value)) {
10005
- merged[key] = mergeCapabilities(
10006
- current,
10007
- value
10008
- );
10009
- continue;
10010
- }
10011
- merged[key] = value;
10012
- }
10013
- return merged;
10014
- }
10015
- function normalizePluginCommandToken(token) {
10016
- return token.trim().replace(/^\//, "").toLowerCase();
10017
- }
10018
- function extractModelId(model) {
10019
- const candidate = model;
10020
- if (typeof candidate.modelId === "string" && candidate.modelId.trim()) {
10021
- return candidate.modelId;
10022
- }
10023
- if (typeof candidate.id === "string" && candidate.id.trim()) {
10024
- return candidate.id;
10025
- }
10026
- return "server-managed";
10027
- }
10028
- function extractProvider(model) {
10029
- const candidate = model;
10030
- if (typeof candidate.provider === "string" && candidate.provider.trim()) {
10031
- return candidate.provider;
10032
- }
10033
- if (typeof candidate.specificationVersion === "string" && candidate.specificationVersion.trim()) {
10034
- return candidate.specificationVersion;
10035
- }
10036
- return void 0;
10037
- }
10068
+ import { randomUUID as randomUUID3 } from "crypto";
10069
+ import { ensureSessionLoaded } from "@cuylabs/agent-core";
10070
+
10071
+ // src/host/workflow/agent-server-events.ts
10038
10072
  function parseJsonProperty(value) {
10039
10073
  if (!value) {
10040
10074
  return void 0;
@@ -10148,6 +10182,51 @@ function isSyntheticTerminalEvent(event) {
10148
10182
  }
10149
10183
  return typeof event.error.message === "string";
10150
10184
  }
10185
+
10186
+ // src/host/workflow/agent-server-support.ts
10187
+ function mergeCapabilities(base, patch) {
10188
+ if (!patch) {
10189
+ return structuredClone(base);
10190
+ }
10191
+ const merged = structuredClone(base);
10192
+ for (const [key, value] of Object.entries(patch)) {
10193
+ const current = merged[key];
10194
+ if (current && typeof current === "object" && !Array.isArray(current) && value && typeof value === "object" && !Array.isArray(value)) {
10195
+ merged[key] = mergeCapabilities(
10196
+ current,
10197
+ value
10198
+ );
10199
+ continue;
10200
+ }
10201
+ merged[key] = value;
10202
+ }
10203
+ return merged;
10204
+ }
10205
+ function normalizePluginCommandToken(token) {
10206
+ return token.trim().replace(/^\//, "").toLowerCase();
10207
+ }
10208
+ function extractModelId(model) {
10209
+ const candidate = model;
10210
+ if (typeof candidate.modelId === "string" && candidate.modelId.trim()) {
10211
+ return candidate.modelId;
10212
+ }
10213
+ if (typeof candidate.id === "string" && candidate.id.trim()) {
10214
+ return candidate.id;
10215
+ }
10216
+ return "server-managed";
10217
+ }
10218
+ function extractProvider(model) {
10219
+ const candidate = model;
10220
+ if (typeof candidate.provider === "string" && candidate.provider.trim()) {
10221
+ return candidate.provider;
10222
+ }
10223
+ if (typeof candidate.specificationVersion === "string" && candidate.specificationVersion.trim()) {
10224
+ return candidate.specificationVersion;
10225
+ }
10226
+ return void 0;
10227
+ }
10228
+
10229
+ // src/host/workflow/agent-server.ts
10151
10230
  function createDaprAgentServerAdapter(runner, options = {}) {
10152
10231
  const agent = runner.agent;
10153
10232
  const pluginCommands = options.pluginCommands ?? [];
@@ -10186,7 +10265,7 @@ function createDaprAgentServerAdapter(runner, options = {}) {
10186
10265
  (left, right) => left.name.localeCompare(right.name)
10187
10266
  ) : void 0;
10188
10267
  async function ensureActionSessionLoaded(sessionId) {
10189
- await ensureSessionLoaded2({
10268
+ await ensureSessionLoaded({
10190
10269
  sessionId,
10191
10270
  sessions: agent.getSessionManager(),
10192
10271
  cwd: agent.cwd
@@ -10353,7 +10432,7 @@ function createDaprAgentServerAdapter(runner, options = {}) {
10353
10432
  if (!active || !runner.workflowHost.steerTurn) {
10354
10433
  return { id: "", accepted: false };
10355
10434
  }
10356
- const id = randomUUID2();
10435
+ const id = randomUUID3();
10357
10436
  void runner.workflowHost.steerTurn(runner.workflowClient, {
10358
10437
  workflowInstanceId: active.workflowInstanceId,
10359
10438
  sessionId,
@@ -10368,7 +10447,7 @@ function createDaprAgentServerAdapter(runner, options = {}) {
10368
10447
  if (!active || !runner.workflowHost.followUpTurn) {
10369
10448
  return { id: "", accepted: false };
10370
10449
  }
10371
- const id = randomUUID2();
10450
+ const id = randomUUID3();
10372
10451
  void runner.workflowHost.followUpTurn(runner.workflowClient, {
10373
10452
  workflowInstanceId: active.workflowInstanceId,
10374
10453
  sessionId,
@@ -1,4 +1,4 @@
1
- import { AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowInterventionSnapshot, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, HumanInputRequest, ApprovalRequest, AgentWorkflowInputCommitPlan, AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult, AgentWorkflowOutputCommitPlan, AgentEvent, AgentTurnStepRuntimeConfig, Tool, convertAgentMessagesToModelMessages, PrepareModelStepOptions, ToolHost, TurnTrackerContext, MiddlewareRunner, ReasoningLevel, Message, AgentWorkflowTurnState } from '@cuylabs/agent-core';
1
+ import { AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult, AgentWorkflowInterventionSnapshot, AgentWorkflowTurnState, AgentWorkflowContextCompactionResult, AgentWorkflowToolCallPlan, AgentWorkflowToolCallResult, HumanInputRequest, ApprovalRequest, AgentWorkflowInputCommitPlan, AgentWorkflowStepCommitPlan, AgentWorkflowCommitResult, AgentWorkflowOutputCommitPlan, AgentEvent, AgentTurnStepRuntimeConfig, Tool, convertAgentMessagesToModelMessages, PrepareModelStepOptions, ToolHost, TurnTrackerContext, MiddlewareRunner, ReasoningLevel, Message } from '@cuylabs/agent-core';
2
2
  import { d as DaprSidecarClientOptions, f as DaprWorkflowObserverBridge } from './workflow-bridge-BcicHH1Y.js';
3
3
 
4
4
  type DaprWorkflowApiVersion = "v1.0" | "v1.0-beta1" | "v1.0-alpha1";
@@ -70,6 +70,7 @@ declare function hasStartedDaprWorkflow(status: DaprWorkflowRuntimeStatus): bool
70
70
 
71
71
  interface DaprAgentTurnWorkflowActivityNames {
72
72
  steerDrain?: string;
73
+ contextCompaction?: string;
73
74
  modelStep: string;
74
75
  humanInputCheck?: string;
75
76
  approvalCheck?: string;
@@ -134,6 +135,13 @@ interface DaprAgentTurnSteerDrainInput {
134
135
  step: number;
135
136
  maxItems: number;
136
137
  }
138
+ interface DaprAgentTurnContextCompactionInput {
139
+ workflowInstanceId: string;
140
+ sessionId: string;
141
+ step: number;
142
+ messages: AgentWorkflowTurnState["messages"];
143
+ force?: boolean;
144
+ }
137
145
  interface DaprAgentTurnWorkflowRegistration {
138
146
  workflowName: string;
139
147
  activityNames: DaprAgentTurnWorkflowActivityNames;
@@ -231,6 +239,9 @@ interface DaprAgentTurnHumanInputCheckActivityOptions {
231
239
  interface DaprAgentTurnSteerDrainActivityOptions {
232
240
  drain: (input: DaprAgentTurnSteerDrainInput) => Promise<AgentWorkflowInterventionSnapshot[]> | AgentWorkflowInterventionSnapshot[];
233
241
  }
242
+ interface DaprAgentTurnContextCompactionActivityOptions {
243
+ compact: (input: DaprAgentTurnContextCompactionInput) => Promise<AgentWorkflowContextCompactionResult> | AgentWorkflowContextCompactionResult;
244
+ }
234
245
  interface DaprAgentTurnCommitActivityOptions {
235
246
  persistMessages: (sessionId: string, messages: Message[]) => Promise<void>;
236
247
  now?: () => string;
@@ -238,6 +249,7 @@ interface DaprAgentTurnCommitActivityOptions {
238
249
  interface CreateDaprAgentTurnWorkflowDefinitionOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
239
250
  modelStep: (input: AgentWorkflowModelStepPlan) => Promise<AgentWorkflowModelStepResult> | AgentWorkflowModelStepResult;
240
251
  steerDrain?: (input: DaprAgentTurnSteerDrainInput) => Promise<AgentWorkflowInterventionSnapshot[]> | AgentWorkflowInterventionSnapshot[];
252
+ contextCompaction?: (input: DaprAgentTurnContextCompactionInput) => Promise<AgentWorkflowContextCompactionResult> | AgentWorkflowContextCompactionResult;
241
253
  toolCall: (input: AgentWorkflowToolCallPlan) => Promise<AgentWorkflowToolCallResult> | AgentWorkflowToolCallResult;
242
254
  humanInputCheck?: (input: DaprAgentTurnHumanInputCheckInput) => Promise<DaprAgentTurnHumanInputCheckResult> | DaprAgentTurnHumanInputCheckResult;
243
255
  approvalCheck?: (input: DaprAgentTurnApprovalCheckInput) => Promise<DaprAgentTurnApprovalCheckResult> | DaprAgentTurnApprovalCheckResult;
@@ -262,6 +274,7 @@ interface CreateDaprAgentTurnWorkflowDefinitionOptions extends CreateDaprAgentTu
262
274
  interface CreateDaprAgentTurnWorkflowKitOptions extends CreateDaprAgentTurnWorkflowRegistrationOptions {
263
275
  modelStepActivity: DaprAgentTurnModelStepActivityOptions;
264
276
  steerDrainActivity?: DaprAgentTurnSteerDrainActivityOptions;
277
+ contextCompactionActivity?: DaprAgentTurnContextCompactionActivityOptions;
265
278
  humanInputCheckActivity?: DaprAgentTurnHumanInputCheckActivityOptions;
266
279
  approvalCheckActivity?: DaprAgentTurnApprovalCheckActivityOptions;
267
280
  toolCallActivity: DaprAgentTurnToolCallActivityOptions;
@@ -282,6 +295,7 @@ type DaprAgentTurnWorkflowToolHandler = (input: DaprAgentTurnWorkflowToolHandler
282
295
  interface DaprAgentTurnWorkflowKit extends DaprAgentTurnWorkflowRegistration {
283
296
  activities: {
284
297
  steerDrain?: DaprAgentTurnActivityRegistration<DaprAgentTurnSteerDrainInput, AgentWorkflowInterventionSnapshot[]>;
298
+ contextCompaction?: DaprAgentTurnActivityRegistration<DaprAgentTurnContextCompactionInput, AgentWorkflowContextCompactionResult>;
285
299
  modelStep: DaprAgentTurnActivityRegistration<AgentWorkflowModelStepPlan, AgentWorkflowModelStepResult>;
286
300
  humanInputCheck?: DaprAgentTurnActivityRegistration<DaprAgentTurnHumanInputCheckInput, DaprAgentTurnHumanInputCheckResult>;
287
301
  approvalCheck?: DaprAgentTurnActivityRegistration<DaprAgentTurnApprovalCheckInput, DaprAgentTurnApprovalCheckResult>;
@@ -1,9 +1,9 @@
1
- export { b as DaprAppDispatchExecutorOptions, c as DaprDispatchRecord, D as DaprDispatchRuntimeOptions, d as DaprDispatchTarget, e as DaprDispatchTargetInspection, f as DaprWorkflowDispatchExecutorOptions, R as RemoteAgentDispatchTargetOptions, W as WorkflowDispatchTargetOptions, g as createDaprAppDispatchExecutor, h as createDaprCompositeDispatchExecutor, i as createDaprDispatchRuntime, j as createDaprWorkflowDispatchExecutor, k as createRemoteAgentDispatchTarget, l as createWorkflowDispatchTarget } from '../index-UtePd9on.js';
1
+ export { b as DaprAppDispatchExecutorOptions, c as DaprDispatchRecord, D as DaprDispatchRuntimeOptions, d as DaprDispatchTarget, e as DaprDispatchTargetInspection, f as DaprWorkflowDispatchExecutorOptions, R as RemoteAgentDispatchTargetOptions, W as WorkflowDispatchTargetOptions, g as createDaprAppDispatchExecutor, h as createDaprCompositeDispatchExecutor, i as createDaprDispatchRuntime, j as createDaprWorkflowDispatchExecutor, k as createRemoteAgentDispatchTarget, l as createWorkflowDispatchTarget } from '../index-u0qPFHJK.js';
2
2
  import '@cuylabs/agent-core';
3
3
  import '../workflow-bridge-BcicHH1Y.js';
4
- import '../client-UsEIzDF6.js';
5
- import '../workflow-host-D6W6fXoL.js';
6
- import '@cuylabs/agent-core/events';
7
4
  import '../invoker-B6ikdYaz.js';
5
+ import '../workflow-host-Cxlu5sNv.js';
6
+ import '../client-BQj84t2u.js';
7
+ import '@cuylabs/agent-core/events';
8
8
  import '../store-BXBIDz40.js';
9
9
  import '@cuylabs/agent-runtime';
@@ -5,7 +5,7 @@ import {
5
5
  createDaprWorkflowDispatchExecutor,
6
6
  createRemoteAgentDispatchTarget,
7
7
  createWorkflowDispatchTarget
8
- } from "../chunk-6BLY7B7U.js";
8
+ } from "../chunk-BQLQLDWZ.js";
9
9
  import "../chunk-HQLQRXU5.js";
10
10
  export {
11
11
  createDaprAppDispatchExecutor,
@@ -5,7 +5,7 @@ import {
5
5
  createDaprLoggingObserver,
6
6
  createOtelObserver,
7
7
  createWorkflowObserverBridge
8
- } from "../chunk-J3IJLF6U.js";
8
+ } from "../chunk-POIJYTT6.js";
9
9
  import "../chunk-HQLQRXU5.js";
10
10
  export {
11
11
  DaprExecutionObserver,
@@ -1,11 +1,11 @@
1
- export { C as CreateDaprAgentServerAdapterOptions, a as CreateRemoteAgentToolOptions, D as DaprAgentDurableRunOptions, b as DaprAgentDurableRunResult, N as DaprAgentHttpHandlerOptions, O as DaprAgentHttpRoute, c as DaprAgentRunner, d as DaprAgentRunnerOptions, e as DaprAgentRuntimeBundle, f as DaprAgentRuntimeOptions, g as DaprAgentServeOptions, h as DaprAgentTaskErrorContext, i as DaprAgentTaskResultContext, j as DaprHostApp, P as DaprHostHttpHandler, k as DaprHostHttpHandlerOptions, l as DaprHostHttpServer, m as DaprHostHttpServerOptions, n as DaprHostReadinessCheck, o as DaprHostReadinessStatus, p as DaprHostRemoteRunRequest, q as DaprHostedAgentInfo, Q as DaprHttpServerOptions, u as DaprMultiAgentRunner, v as DaprMultiAgentRunnerAgentConfig, w as DaprMultiAgentRunnerOptions, y as DaprWorkloadErrorContext, z as DaprWorkloadResultContext, A as DaprWorkloadRuntimeBundle, B as DaprWorkloadRuntimeOptions, E as createDaprAgentRunner, F as createDaprAgentRuntime, G as createDaprAgentServerAdapter, H as createDaprHostHttpHandler, J as createDaprMultiAgentRunner, K as createDaprWorkloadRuntime, L as createRemoteAgentTool, M as startDaprHostHttpServer, R as startDaprHttpServer } from '../index-BY0FipV1.js';
1
+ export { C as CreateDaprAgentServerAdapterOptions, a as CreateRemoteAgentToolOptions, D as DaprAgentDurableRunOptions, b as DaprAgentDurableRunResult, N as DaprAgentHttpHandlerOptions, O as DaprAgentHttpRoute, c as DaprAgentRunner, d as DaprAgentRunnerOptions, e as DaprAgentRuntimeBundle, f as DaprAgentRuntimeOptions, g as DaprAgentServeOptions, h as DaprAgentTaskErrorContext, i as DaprAgentTaskResultContext, j as DaprHostApp, P as DaprHostHttpHandler, k as DaprHostHttpHandlerOptions, l as DaprHostHttpServer, m as DaprHostHttpServerOptions, n as DaprHostReadinessCheck, o as DaprHostReadinessStatus, p as DaprHostRemoteRunRequest, q as DaprHostedAgentInfo, Q as DaprHttpServerOptions, u as DaprMultiAgentRunner, v as DaprMultiAgentRunnerAgentConfig, w as DaprMultiAgentRunnerOptions, y as DaprWorkloadErrorContext, z as DaprWorkloadResultContext, A as DaprWorkloadRuntimeBundle, B as DaprWorkloadRuntimeOptions, E as createDaprAgentRunner, F as createDaprAgentRuntime, G as createDaprAgentServerAdapter, H as createDaprHostHttpHandler, J as createDaprMultiAgentRunner, K as createDaprWorkloadRuntime, L as createRemoteAgentTool, M as startDaprHostHttpServer, R as startDaprHttpServer } from '../index-DIpZewhn.js';
2
2
  export { D as DaprInvokeMethodOptions, a as DaprInvokeMethodResult, b as DaprServiceInvoker, c as DaprServiceInvokerOptions, R as RemoteAgentRunRequest, d as RemoteAgentRunResponse, i as invokeRemoteAgentRun } from '../invoker-B6ikdYaz.js';
3
- export { b as DaprAgentWorkflowFollowUpRequest, a as DaprAgentWorkflowHost, c as DaprAgentWorkflowHostOptions, d as DaprAgentWorkflowRunRequest, e as DaprAgentWorkflowRunResult, f as DaprAgentWorkflowSteerRequest, g as DaprApprovalDecision, h as DaprApprovalRequestListOptions, i as DaprApprovalRequestRecord, j as DaprApprovalRequestStatus, k as DaprApprovalResolution, l as DaprFollowUpListOptions, m as DaprFollowUpRecord, n as DaprHumanInputRequestListOptions, o as DaprHumanInputRequestRecord, p as DaprHumanInputRequestStatus, q as DaprPubSubEventBridge, r as DaprPubSubEventBridgeOptions, s as DaprSteerRecord, t as DaprWorkflowApprovalCheckInput, u as DaprWorkflowApprovalCheckResult, v as DaprWorkflowApprovalRuntime, w as DaprWorkflowApprovalRuntimeOptions, x as DaprWorkflowEventRaiserLike, y as DaprWorkflowFollowUpRuntime, z as DaprWorkflowFollowUpRuntimeOptions, A as DaprWorkflowHumanInputCheckInput, B as DaprWorkflowHumanInputCheckResult, C as DaprWorkflowHumanInputRuntime, E as DaprWorkflowHumanInputRuntimeOptions, D as DaprWorkflowRuntimeRegistrar, F as DaprWorkflowStarterLike, G as DaprWorkflowSteerRuntime, H as DaprWorkflowSteerRuntimeOptions, I as createDaprAgentWorkflowHost, J as createDaprPubSubEventBridge, K as createDaprWorkflowApprovalRuntime, L as createDaprWorkflowFollowUpRuntime, M as createDaprWorkflowHumanInputRuntime, N as createDaprWorkflowSteerRuntime, O as startDaprAgentWorkflowTurn } from '../workflow-host-D6W6fXoL.js';
4
- export { D as DaprWorkflowWorker, a as DaprWorkflowWorkerAgentDefinition, b as DaprWorkflowWorkerLogger, c as DaprWorkflowWorkerOptions, d as DaprWorkflowWorkerRuntime, e as createDaprWorkflowWorker } from '../worker-CXq0IFGX.js';
3
+ export { b as DaprAgentWorkflowFollowUpRequest, a as DaprAgentWorkflowHost, c as DaprAgentWorkflowHostOptions, d as DaprAgentWorkflowRunRequest, e as DaprAgentWorkflowRunResult, f as DaprAgentWorkflowSteerRequest, g as DaprApprovalDecision, h as DaprApprovalRequestListOptions, i as DaprApprovalRequestRecord, j as DaprApprovalRequestStatus, k as DaprApprovalResolution, l as DaprFollowUpListOptions, m as DaprFollowUpRecord, n as DaprHumanInputRequestListOptions, o as DaprHumanInputRequestRecord, p as DaprHumanInputRequestStatus, q as DaprPubSubEventBridge, r as DaprPubSubEventBridgeOptions, s as DaprSteerRecord, t as DaprWorkflowApprovalCheckInput, u as DaprWorkflowApprovalCheckResult, v as DaprWorkflowApprovalRuntime, w as DaprWorkflowApprovalRuntimeOptions, x as DaprWorkflowEventRaiserLike, y as DaprWorkflowFollowUpRuntime, z as DaprWorkflowFollowUpRuntimeOptions, A as DaprWorkflowHumanInputCheckInput, B as DaprWorkflowHumanInputCheckResult, C as DaprWorkflowHumanInputRuntime, E as DaprWorkflowHumanInputRuntimeOptions, D as DaprWorkflowRuntimeRegistrar, F as DaprWorkflowStarterLike, G as DaprWorkflowSteerRuntime, H as DaprWorkflowSteerRuntimeOptions, I as createDaprAgentWorkflowHost, J as createDaprPubSubEventBridge, K as createDaprWorkflowApprovalRuntime, L as createDaprWorkflowFollowUpRuntime, M as createDaprWorkflowHumanInputRuntime, N as createDaprWorkflowSteerRuntime, O as startDaprAgentWorkflowTurn } from '../workflow-host-Cxlu5sNv.js';
4
+ export { D as DaprWorkflowWorker, a as DaprWorkflowWorkerAgentDefinition, b as DaprWorkflowWorkerLogger, c as DaprWorkflowWorkerOptions, d as DaprWorkflowWorkerRuntime, e as createDaprWorkflowWorker } from '../worker-CgoEkwKw.js';
5
5
  export { EventBus, EventBusMessage, EventBusOptions, EventBusSubscribeOptions, EventBusSubscription, createEventBus } from '@cuylabs/agent-core/events';
6
6
  import '@cuylabs/agent-core';
7
7
  import '../store-BXBIDz40.js';
8
8
  import '@cuylabs/agent-runtime';
9
9
  import '../workflow-bridge-BcicHH1Y.js';
10
- import '../client-UsEIzDF6.js';
10
+ import '../client-BQj84t2u.js';
11
11
  import 'node:http';
@@ -17,13 +17,13 @@ import {
17
17
  startDaprAgentWorkflowTurn,
18
18
  startDaprHostHttpServer,
19
19
  startDaprHttpServer
20
- } from "../chunk-26RCP3L3.js";
20
+ } from "../chunk-ZX2MACJF.js";
21
21
  import {
22
22
  DaprServiceInvoker,
23
23
  invokeRemoteAgentRun
24
- } from "../chunk-6BLY7B7U.js";
25
- import "../chunk-J3IJLF6U.js";
26
- import "../chunk-2TBZCBXE.js";
24
+ } from "../chunk-BQLQLDWZ.js";
25
+ import "../chunk-POIJYTT6.js";
26
+ import "../chunk-7VYLWJTB.js";
27
27
  import "../chunk-HQLQRXU5.js";
28
28
  export {
29
29
  DaprServiceInvoker,
@@ -1,12 +1,12 @@
1
1
  import { AgentTaskPayload, SteeringResponse, FollowUpResponse, Tool, AgentTaskResult, AgentTaskRunner, Agent, AgentTaskRunnerOptions, AgentTaskObserver, FollowUpPolicy, AgentEvent, ApprovalRememberScope, HumanInputResponse, FollowUpStatus, QueuedFollowUpRecord, FollowUpDecisionAction } from '@cuylabs/agent-core';
2
2
  import { h as DaprExecutionStore } from './store-BXBIDz40.js';
3
- import { q as DaprPubSubEventBridge, v as DaprWorkflowApprovalRuntime, C as DaprWorkflowHumanInputRuntime, y as DaprWorkflowFollowUpRuntime, F as DaprWorkflowStarterLike, d as DaprAgentWorkflowRunRequest, e as DaprAgentWorkflowRunResult, x as DaprWorkflowEventRaiserLike, f as DaprAgentWorkflowSteerRequest, b as DaprAgentWorkflowFollowUpRequest, a as DaprAgentWorkflowHost, c as DaprAgentWorkflowHostOptions } from './workflow-host-D6W6fXoL.js';
3
+ import { q as DaprPubSubEventBridge, v as DaprWorkflowApprovalRuntime, C as DaprWorkflowHumanInputRuntime, y as DaprWorkflowFollowUpRuntime, F as DaprWorkflowStarterLike, d as DaprAgentWorkflowRunRequest, e as DaprAgentWorkflowRunResult, x as DaprWorkflowEventRaiserLike, f as DaprAgentWorkflowSteerRequest, b as DaprAgentWorkflowFollowUpRequest, a as DaprAgentWorkflowHost, c as DaprAgentWorkflowHostOptions } from './workflow-host-Cxlu5sNv.js';
4
4
  import { EventBus } from '@cuylabs/agent-core/events';
5
5
  import { b as DaprServiceInvoker, c as DaprServiceInvokerOptions } from './invoker-B6ikdYaz.js';
6
- import { D as DaprWorkflowWorker, d as DaprWorkflowWorkerRuntime } from './worker-CXq0IFGX.js';
6
+ import { D as DaprWorkflowWorker, d as DaprWorkflowWorkerRuntime } from './worker-CgoEkwKw.js';
7
7
  import { RuntimeDriver, RuntimeDriverContext, RuntimeJobRecord, WorkloadRuntime, RuntimeWorkloadRunner, WorkloadRuntimeOptions, RuntimeWorkloadContext } from '@cuylabs/agent-runtime';
8
8
  import { c as DaprRuntimeDriverOptions, D as DaprExecutionStoreOptions } from './workflow-bridge-BcicHH1Y.js';
9
- import { D as DaprWorkflowClient } from './client-UsEIzDF6.js';
9
+ import { D as DaprWorkflowClient } from './client-BQj84t2u.js';
10
10
  import { Server } from 'node:http';
11
11
 
12
12
  interface DaprJobTriggerHandler {
@@ -722,6 +722,7 @@ interface CreateDaprAgentServerAdapterOptions {
722
722
  listSubAgents?: () => Promise<AppSubAgentProfileInfo[]> | AppSubAgentProfileInfo[];
723
723
  capabilities?: AgentServerCapabilitiesPatch;
724
724
  }
725
+
725
726
  declare function createDaprAgentServerAdapter(runner: DaprAgentRunner, options?: CreateDaprAgentServerAdapterOptions): AgentServerAdapter;
726
727
 
727
728
  /**