@rivus/agent 0.11.0 → 0.12.4

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.
@@ -1317,6 +1317,10 @@ function createAgentRuntimePool(options) {
1317
1317
  const runtime = runtimes.get(instance.instanceId);
1318
1318
  return runtime ? (await runtime).cancel?.(input) ?? false : false;
1319
1319
  },
1320
+ steer: async (instance, input) => {
1321
+ const runtime = runtimes.get(instance.instanceId);
1322
+ return runtime ? (await runtime).steer?.(input) ?? false : false;
1323
+ },
1320
1324
  disposeAll: async () => {
1321
1325
  const pendingRuntimes = [...runtimes.values()];
1322
1326
  runtimes.clear();
@@ -1396,6 +1400,7 @@ function createRivusAgentHost(options) {
1396
1400
  return {
1397
1401
  cancelBackgroundSession: (agentId, input) => options.runtimePool.cancel(resolveBackgroundSession(agentId), input),
1398
1402
  cancelEndpoint: (endpointId, input) => options.runtimePool.cancel(resolveEndpoint(endpointId), input),
1403
+ steerEndpoint: (endpointId, input) => options.runtimePool.steer(resolveEndpoint(endpointId), input),
1399
1404
  handleAutomation: (automationId, input) => options.runtimePool.run(resolveAutomation(automationId), input),
1400
1405
  handleBackgroundSession: (agentId, input) => options.runtimePool.run(resolveBackgroundSession(agentId), input),
1401
1406
  handleEndpoint: (endpointId, input) => options.runtimePool.run(resolveEndpoint(endpointId), input),
@@ -1570,6 +1575,7 @@ async function createRivusDeploymentDaemon(options) {
1570
1575
  endpointId: slot.definition.id,
1571
1576
  handle: (input) => handleEndpoint(slot.definition.id, input),
1572
1577
  instanceId: host.resolveEndpoint(slot.definition.id).instanceId,
1578
+ steer: (input) => host.steerEndpoint(slot.definition.id, input),
1573
1579
  ...definitions.get(slot.definition.agentId)?.projectSpaceId ? { projectSpaceId: definitions.get(slot.definition.agentId).projectSpaceId } : {}
1574
1580
  }));
1575
1581
  degraded ||= slotDegraded;
@@ -28,6 +28,7 @@ import {
28
28
  createFeishuCotPublisher,
29
29
  createFeishuDeploymentEndpoint,
30
30
  createFeishuPresentationPreparation,
31
+ createFeishuTopicContextResolver,
31
32
  createSystemClock,
32
33
  createFeishuCardDeliveryReconciler,
33
34
  createHumanInteractionEndpointRegistry,
@@ -344,6 +345,10 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
344
345
  pi: {}
345
346
  };
346
347
  const openApiClient = createOpenApiClient(config);
348
+ const promptContext = createFeishuTopicContextResolver({
349
+ baseUrl: input.definition.baseUrl,
350
+ client: openApiClient
351
+ });
347
352
  const cotPublisher = input.definition.experimental?.cotMessages
348
353
  ? createFeishuCotPublisher({
349
354
  baseUrl: resolveExperimentalCotBaseUrl(context.env),
@@ -364,6 +369,9 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
364
369
  const cardRollover = createConfiguredFeishuCardRolloverRuntime({
365
370
  agentName: input.agentId,
366
371
  cardTargets,
372
+ // The endpoint uses Feishu's long connection; callback buttons are
373
+ // not delivered on that transport.
374
+ cancelButton: false,
367
375
  client: openApiClient,
368
376
  clock: createSystemClock(),
369
377
  config,
@@ -378,9 +386,10 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
378
386
  const endpointEvents = createJsonlAgentEventLog({
379
387
  filePath: join(STATE_DIR, "instances", input.instanceId, "agent-events.jsonl")
380
388
  });
389
+ const endpointInitialEvents = await Effect.runPromise(endpointEvents.readAll());
381
390
  await Effect.runPromise(
382
391
  createFeishuCardDeliveryReconciler({
383
- events: await Effect.runPromise(endpointEvents.readAll()),
392
+ events: endpointInitialEvents,
384
393
  ledger: cardLedger,
385
394
  publish: (action) => publisher.publish(action)
386
395
  }).reconcile()
@@ -401,6 +410,7 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
401
410
  groupPolicy: input.definition.groupPolicy,
402
411
  handle: input.handle,
403
412
  inboxRepository: inbox,
413
+ initialEvents: endpointInitialEvents,
404
414
  interactions,
405
415
  maxPendingMessages: 100,
406
416
  memoryTenantId,
@@ -412,9 +422,11 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
412
422
  prepareCardTarget,
413
423
  reportCotError: (operation, error) => reportCotError(input.endpointId, operation, error)
414
424
  }),
425
+ promptContext,
415
426
  publish: (action) => publisher.publish(action),
416
427
  reply: (messageId, text) => replies.reply(messageId, text),
417
428
  sessionStore,
429
+ ...(input.steer ? { steer: input.steer } : {}),
418
430
  ...(cotPublisher
419
431
  ? {
420
432
  publishRunUpdate: (update) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivus/agent",
3
- "version": "0.11.0",
3
+ "version": "0.12.4",
4
4
  "description": "A local agent daemon core built around a usable agent harness and domain events.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -72,6 +72,7 @@
72
72
  "prepublishOnly": "npm run check",
73
73
  "release:check": "node scripts/check-npm-release.mjs",
74
74
  "test": "vp test",
75
+ "test:feishu:offline": "node scripts/run-feishu-offline-tests.mjs",
75
76
  "test:coverage": "vp test --coverage",
76
77
  "test:watch": "vp test watch",
77
78
  "typecheck": "vp check --no-fmt --no-lint",