@rivus/agent 0.12.7 → 0.13.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.
@@ -1,6 +1,6 @@
1
1
  import { s as AgentLoopInput } from "./agent-loop.js";
2
2
  import { c as MemoryScope, t as AgentMemoryAuthority } from "./agent-memory.js";
3
- import { A as RivusToolRisk, D as RivusToolGrantSet, b as RivusResolvedToolDescriptor, g as RivusPluginCatalog, m as RivusHostToolDescriptor } from "./rivus-plugin.js";
3
+ import { O as RivusToolGrantSet, _ as RivusPluginCatalog, h as RivusHostToolDescriptor, j as RivusToolRisk, x as RivusResolvedToolDescriptor } from "./rivus-plugin.js";
4
4
  import { ToolDefinition } from "@earendil-works/pi-coding-agent";
5
5
 
6
6
  //#region src/domain/recovery-action.d.ts
@@ -435,13 +435,21 @@ function assertTimestamp(value, label) {
435
435
  if (Number.isNaN(Date.parse(value))) throw new CardPresentationTransitionDenied(`${label} must be an ISO timestamp`);
436
436
  }
437
437
  //#endregion
438
+ //#region src/domain/run-presentation.ts
439
+ const RUN_PRESENTATION_SCHEMA_VERSION = 2;
440
+ function hasInspectableRunProgress(presentation) {
441
+ return presentation.steps.some((step) => step.kind === "skill" || step.kind === "tool");
442
+ }
443
+ //#endregion
438
444
  //#region src/application/feishu/feishu-card-rollover.ts
439
445
  const DEFAULT_CARD_STREAM_LEASE_MS = 51e4;
440
446
  function createFeishuCardRollover(options) {
441
447
  const leaseMs = options.leaseMs ?? 51e4;
442
448
  if (!Number.isSafeInteger(leaseMs) || leaseMs < 1) throw new Error("Feishu card stream lease must be a positive integer");
443
449
  const counters = createCounters();
450
+ const latestPresentationByRun = /* @__PURE__ */ new Map();
444
451
  const latestTextByRun = /* @__PURE__ */ new Map();
452
+ const generationBaselineByRun = /* @__PURE__ */ new Map();
445
453
  const liveRuns = /* @__PURE__ */ new Map();
446
454
  const semaphore = Effect.unsafeMakeSemaphore(1);
447
455
  const exclusive = (effect) => semaphore.withPermits(1)(effect);
@@ -457,7 +465,25 @@ function createFeishuCardRollover(options) {
457
465
  const presentationId = (runId, generation) => `${runId}#${generation}`;
458
466
  const publishProgress = (action) => Effect.suspend(() => {
459
467
  const chain = options.store.chain(action.runId);
460
- if (chain && acceptsCardPresentationProgress(chain)) return options.publisher.publish(action).pipe(Effect.tap(() => Effect.sync(() => latestTextByRun.set(action.runId, action.text))));
468
+ if (chain && acceptsCardPresentationProgress(chain)) {
469
+ if (action.type === "update_text") latestTextByRun.set(action.runId, action.text);
470
+ else {
471
+ latestPresentationByRun.set(action.runId, action.presentation);
472
+ latestTextByRun.set(action.runId, action.presentation.answer.text);
473
+ }
474
+ const run = liveRuns.get(action.runId);
475
+ if (!run) return options.publisher.publish(action);
476
+ const baseline = generationBaselineByRun.get(action.runId);
477
+ const text = projectText(latestTextByRun.get(action.runId), baseline?.text);
478
+ const presentation = projectPresentation(latestPresentationByRun.get(action.runId), baseline);
479
+ return options.publisher.publish({
480
+ ...presentation === void 0 ? {} : { presentation },
481
+ runId: action.runId,
482
+ sessionKey: run.sessionKey,
483
+ ...text === void 0 ? {} : { text },
484
+ type: "update_presentation"
485
+ });
486
+ }
461
487
  return recordNow({
462
488
  ...chain ? {
463
489
  generation: chain.activeGeneration,
@@ -469,11 +495,16 @@ function createFeishuCardRollover(options) {
469
495
  });
470
496
  const publishTerminal = (action) => {
471
497
  const latestText = latestTextByRun.get(action.runId);
472
- const resolvedAction = action.type === "cancel" && action.text === void 0 && latestText !== void 0 ? {
498
+ const latestPresentation = latestPresentationByRun.get(action.runId);
499
+ const withText = action.type === "cancel" && action.text === void 0 && latestText !== void 0 ? {
473
500
  ...action,
474
501
  text: latestText
475
502
  } : action;
476
- return options.publisher.publish(resolvedAction).pipe(Effect.tapError((error) => recordNow({
503
+ const projectedAction = projectTerminalAction((withText.type === "cancel" || withText.type === "fail" || withText.type === "finish") && withText.presentation === void 0 && latestPresentation !== void 0 && hasInspectableRunProgress(latestPresentation) ? {
504
+ ...withText,
505
+ presentation: latestPresentation
506
+ } : withText, generationBaselineByRun.get(action.runId));
507
+ return options.publisher.publish(projectedAction).pipe(Effect.tapError((error) => recordNow({
477
508
  error,
478
509
  runId: action.runId,
479
510
  type: "terminal_delivery_failed"
@@ -485,14 +516,17 @@ function createFeishuCardRollover(options) {
485
516
  runId: action.runId,
486
517
  type: "presentation_write_failed"
487
518
  })))), Effect.ensuring(Effect.sync(() => {
519
+ latestPresentationByRun.delete(action.runId);
488
520
  latestTextByRun.delete(action.runId);
521
+ generationBaselineByRun.delete(action.runId);
489
522
  liveRuns.delete(action.runId);
490
523
  })));
491
524
  };
492
525
  const publishAction = (action) => {
493
526
  switch (action.type) {
494
- case "update_text": return publishProgress(action);
495
- case "handoff": return options.publisher.publish(action);
527
+ case "update_text":
528
+ case "update_progress": return publishProgress(action);
529
+ case "update_presentation": return options.publisher.publish(action);
496
530
  default: return publishTerminal(action);
497
531
  }
498
532
  };
@@ -522,7 +556,6 @@ function createFeishuCardRollover(options) {
522
556
  };
523
557
  const predecessor = start.presentation;
524
558
  const generation = predecessor.generation + 1;
525
- const text = latestTextByRun.get(runId);
526
559
  record({
527
560
  cardId: predecessor.cardId,
528
561
  generation,
@@ -535,8 +568,7 @@ function createFeishuCardRollover(options) {
535
568
  const created = yield* options.createSuccessor({
536
569
  generation,
537
570
  presentationId: successorId,
538
- run,
539
- ...text === void 0 ? {} : { text }
571
+ run
540
572
  }).pipe(Effect.map((target) => ({ target })), Effect.catchAll((error) => options.store.failHandoff({
541
573
  failedAt: startedAt.toISOString(),
542
574
  runId
@@ -556,17 +588,6 @@ function createFeishuCardRollover(options) {
556
588
  error: created.error,
557
589
  status: "failed"
558
590
  };
559
- yield* options.publisher.publish({
560
- runId,
561
- ...text === void 0 ? {} : { text },
562
- type: "handoff"
563
- }).pipe(Effect.catchAll((error) => recordNow({
564
- cardId: predecessor.cardId,
565
- error,
566
- generation,
567
- runId,
568
- type: "handoff_notice_failed"
569
- })));
570
591
  const adoptedAt = yield* options.clock.now;
571
592
  const presentation = yield* options.store.completeHandoff({
572
593
  runId,
@@ -587,6 +608,10 @@ function createFeishuCardRollover(options) {
587
608
  successorCardId: created.target.cardId,
588
609
  type: "handoff_succeeded"
589
610
  }, adoptedAt);
611
+ generationBaselineByRun.set(runId, {
612
+ ...latestPresentationByRun.has(runId) ? { presentation: latestPresentationByRun.get(runId) } : {},
613
+ ...latestTextByRun.has(runId) ? { text: latestTextByRun.get(runId) } : {}
614
+ });
590
615
  return {
591
616
  presentation,
592
617
  status: "rolled-over"
@@ -604,7 +629,9 @@ function createFeishuCardRollover(options) {
604
629
  runId: run.runId,
605
630
  sourceMessageId: run.messageId
606
631
  });
632
+ latestPresentationByRun.delete(run.runId);
607
633
  latestTextByRun.delete(run.runId);
634
+ generationBaselineByRun.delete(run.runId);
608
635
  liveRuns.set(run.runId, run);
609
636
  return presentation;
610
637
  })),
@@ -627,6 +654,8 @@ function createFeishuCardRollover(options) {
627
654
  publish: (action) => exclusive(publishAction(action)),
628
655
  releaseRun: (runId) => Effect.sync(() => {
629
656
  latestTextByRun.delete(runId);
657
+ latestPresentationByRun.delete(runId);
658
+ generationBaselineByRun.delete(runId);
630
659
  liveRuns.delete(runId);
631
660
  }),
632
661
  recover: () => exclusive(Effect.gen(function* () {
@@ -651,6 +680,59 @@ function createFeishuCardRollover(options) {
651
680
  })
652
681
  };
653
682
  }
683
+ function projectText(text, baseline) {
684
+ if (text === void 0 || baseline === void 0 || baseline.length === 0) return text;
685
+ if (text === baseline) return "";
686
+ return text.startsWith(baseline) ? text.slice(baseline.length) : text;
687
+ }
688
+ function projectPresentation(presentation, baseline) {
689
+ if (!presentation || !baseline) return presentation;
690
+ const previous = new Map(baseline.presentation?.steps.map((step) => [step.id, JSON.stringify(step)]) ?? []);
691
+ let skippedCommittedBaselineText = false;
692
+ const steps = presentation.steps.filter((step) => {
693
+ if (!skippedCommittedBaselineText && step.kind === "assistant" && baseline.text?.trim() && step.text.trim() === baseline.text.trim() && !previous.has(step.id)) {
694
+ skippedCommittedBaselineText = true;
695
+ return false;
696
+ }
697
+ return previous.get(step.id) !== JSON.stringify(step);
698
+ });
699
+ const answer = projectText(presentation.answer.text, baseline.text) ?? "";
700
+ if (steps.length === 0 && answer.trim() === "") return void 0;
701
+ return {
702
+ ...presentation,
703
+ answer: {
704
+ ...presentation.answer,
705
+ text: answer
706
+ },
707
+ omittedStepCount: 0,
708
+ steps,
709
+ totalStepCount: steps.length,
710
+ totalToolCallCount: steps.filter((step) => step.kind === "tool").length
711
+ };
712
+ }
713
+ function projectTerminalAction(action, baseline) {
714
+ if (!baseline || action.type !== "finish" && action.type !== "fail" && action.type !== "cancel") return action;
715
+ const presentation = action.presentation ? projectPresentation(action.presentation, baseline) : void 0;
716
+ if (action.type === "finish") return {
717
+ ...presentation === void 0 ? {} : { presentation },
718
+ runId: action.runId,
719
+ text: projectText(action.text, baseline.text) ?? action.text,
720
+ type: "finish"
721
+ };
722
+ if (action.type === "cancel") return {
723
+ ...presentation === void 0 ? {} : { presentation },
724
+ ...action.reason === void 0 ? {} : { reason: action.reason },
725
+ runId: action.runId,
726
+ ...action.text === void 0 ? {} : { text: projectText(action.text, baseline.text) ?? action.text },
727
+ type: "cancel"
728
+ };
729
+ return {
730
+ errorMessage: action.errorMessage,
731
+ ...presentation === void 0 ? {} : { presentation },
732
+ runId: action.runId,
733
+ type: "fail"
734
+ };
735
+ }
654
736
  function createCounters() {
655
737
  return {
656
738
  handoff_failed: 0,
@@ -677,6 +759,9 @@ function resolveBackgroundSessionSupervisorIntervalMs(leaseMs) {
677
759
  return Math.min(5e3, Math.max(200, Math.floor(leaseMs / 10)));
678
760
  }
679
761
  //#endregion
762
+ //#region src/domain/conversation-progress.ts
763
+ const DEFAULT_CONVERSATION_PROGRESS_DISPLAY = "collapsed";
764
+ //#endregion
680
765
  //#region src/infrastructure/config/rivus-deployment-manifest.ts
681
766
  var RivusDeploymentManifestError = class extends Error {
682
767
  manifestPath;
@@ -772,10 +857,15 @@ function parseManifest(value) {
772
857
  "experimental",
773
858
  "groupPolicy",
774
859
  "id",
860
+ "progressDisplay",
775
861
  "required",
776
862
  "sessionNamespace",
777
863
  "streamMinIntervalMs"
778
- ], `manifest.endpoints[${index}]`, ["cardStreamLeaseMs", "experimental"]);
864
+ ], `manifest.endpoints[${index}]`, [
865
+ "cardStreamLeaseMs",
866
+ "experimental",
867
+ "progressDisplay"
868
+ ]);
779
869
  const experimental = endpoint.experimental === void 0 ? void 0 : record(endpoint.experimental, `manifest.endpoints[${index}].experimental`);
780
870
  if (experimental) exactKeys(experimental, ["cotMessages"], `manifest.endpoints[${index}].experimental`);
781
871
  return Object.freeze({
@@ -787,6 +877,7 @@ function parseManifest(value) {
787
877
  ...experimental ? { experimental: Object.freeze({ cotMessages: boolean(experimental.cotMessages, `manifest.endpoints[${index}].experimental.cotMessages`) }) } : {},
788
878
  groupPolicy: groupPolicy(endpoint.groupPolicy, `manifest.endpoints[${index}].groupPolicy`),
789
879
  id: string(endpoint.id, `manifest.endpoints[${index}].id`),
880
+ progressDisplay: endpoint.progressDisplay === void 0 ? DEFAULT_CONVERSATION_PROGRESS_DISPLAY : progressDisplay(endpoint.progressDisplay, `manifest.endpoints[${index}].progressDisplay`),
790
881
  required: boolean(endpoint.required, `manifest.endpoints[${index}].required`),
791
882
  sessionNamespace: string(endpoint.sessionNamespace, `manifest.endpoints[${index}].sessionNamespace`),
792
883
  streamMinIntervalMs: positiveInteger(endpoint.streamMinIntervalMs, `manifest.endpoints[${index}].streamMinIntervalMs`)
@@ -914,6 +1005,10 @@ function groupPolicy(value, path) {
914
1005
  if (value !== "mention-only" && value !== "ignore-unmentioned" && value !== "default-responder") throw new Error(`${path} must be mention-only, ignore-unmentioned, or default-responder`);
915
1006
  return value;
916
1007
  }
1008
+ function progressDisplay(value, path) {
1009
+ if (value !== "hidden" && value !== "collapsed" && value !== "expanded") throw new Error(`${path} must be hidden, collapsed, or expanded`);
1010
+ return value;
1011
+ }
917
1012
  function automationTargetType(value, path) {
918
1013
  if (value !== "chat_id" && value !== "open_id" && value !== "user_id" && value !== "union_id" && value !== "email") throw new Error(`${path} must be chat_id, open_id, user_id, union_id, or email`);
919
1014
  return value;
@@ -3243,4 +3338,4 @@ function hasRecoveryRunner(daemon) {
3243
3338
  return typeof daemon.openRecoveryControl === "function";
3244
3339
  }
3245
3340
  //#endregion
3246
- export { loadRivusDeployment as $, DEFAULT_BACKGROUND_SESSION_LIFETIME_MS as A, acceptsCardPresentationProgress as B, loadRivusDaemonConfig as C, loadRivusDeploymentManifest as D, RivusDeploymentManifestError as E, DEFAULT_BACKGROUND_SESSION_SUPERVISOR_INTERVAL_MS as F, createCardPresentationChain as G, beginCardPresentationHandoff as H, resolveBackgroundSessionSupervisorIntervalMs as I, markCardPresentationTerminal as J, failCardPresentationHandoff as K, DEFAULT_CARD_STREAM_LEASE_MS as L, DEFAULT_BACKGROUND_SESSION_MAX_CONSECUTIVE_FAILURES as M, DEFAULT_BACKGROUND_SESSION_RETRY_BACKOFF_MS as N, DEFAULT_BACKGROUND_SESSION_LEASE_MS as O, DEFAULT_BACKGROUND_SESSION_STEP_TIMEOUT_MS as P, RivusPluginLoadError as Q, createFeishuCardRollover as R, RivusDaemonConfigError as S, resolveNodeRivusPluginModulePath as T, compensateCardPresentationHandoff as U, activeCardPresentation as V, completeCardPresentationHandoff as W, resolveFeishuEndpointCredentials as X, FeishuEndpointCredentialError as Y, loadMergedLocalEnvFile as Z, createStableId as _, InvalidRivusProjectSpace as a, createRivusEnvFromOpenClawConfig as b, RivusDeploymentReadinessError as c, createRivusAgentHost as d, validateRivusDeploymentManifest as et, AgentInstanceBusy as f, createAgentInstanceRegistry as g, AgentInstanceConflict as h, resolveRivusProjectSpace as i, DEFAULT_BACKGROUND_SESSION_MAX_CONCURRENT_SESSIONS as j, DEFAULT_BACKGROUND_SESSION_LEASE_RENEWAL_INTERVAL_MS as k, createRivusDeploymentDaemon as l, createAgentRuntimePool as m, createRivusDeploymentCliProcess as n, RivusDeploymentAutomationReadinessError as o, AgentRuntimeDisposed as p, isCardPresentationHandoffDue as q, createConfiguredRivusDeploymentDaemon as r, RivusDeploymentDaemonLifecycleError as s, runRivusDaemonCli as t, InvalidRivusEndpointBinding as u, createRivusDaemonShutdownController as v, loadNodeRivusPluginModule as w, formatRivusEnvFile as x, OpenClawEnvImportError as y, CardPresentationTransitionDenied as z };
3341
+ export { resolveFeishuEndpointCredentials as $, DEFAULT_BACKGROUND_SESSION_LEASE_RENEWAL_INTERVAL_MS as A, RUN_PRESENTATION_SCHEMA_VERSION as B, loadRivusDaemonConfig as C, loadRivusDeploymentManifest as D, RivusDeploymentManifestError as E, DEFAULT_BACKGROUND_SESSION_STEP_TIMEOUT_MS as F, beginCardPresentationHandoff as G, CardPresentationTransitionDenied as H, DEFAULT_BACKGROUND_SESSION_SUPERVISOR_INTERVAL_MS as I, createCardPresentationChain as J, compensateCardPresentationHandoff as K, resolveBackgroundSessionSupervisorIntervalMs as L, DEFAULT_BACKGROUND_SESSION_MAX_CONCURRENT_SESSIONS as M, DEFAULT_BACKGROUND_SESSION_MAX_CONSECUTIVE_FAILURES as N, DEFAULT_CONVERSATION_PROGRESS_DISPLAY as O, DEFAULT_BACKGROUND_SESSION_RETRY_BACKOFF_MS as P, FeishuEndpointCredentialError as Q, DEFAULT_CARD_STREAM_LEASE_MS as R, RivusDaemonConfigError as S, resolveNodeRivusPluginModulePath as T, acceptsCardPresentationProgress as U, hasInspectableRunProgress as V, activeCardPresentation as W, isCardPresentationHandoffDue as X, failCardPresentationHandoff as Y, markCardPresentationTerminal as Z, createStableId as _, InvalidRivusProjectSpace as a, createRivusEnvFromOpenClawConfig as b, RivusDeploymentReadinessError as c, createRivusAgentHost as d, loadMergedLocalEnvFile as et, AgentInstanceBusy as f, createAgentInstanceRegistry as g, AgentInstanceConflict as h, resolveRivusProjectSpace as i, DEFAULT_BACKGROUND_SESSION_LIFETIME_MS as j, DEFAULT_BACKGROUND_SESSION_LEASE_MS as k, createRivusDeploymentDaemon as l, createAgentRuntimePool as m, createRivusDeploymentCliProcess as n, loadRivusDeployment as nt, RivusDeploymentAutomationReadinessError as o, AgentRuntimeDisposed as p, completeCardPresentationHandoff as q, createConfiguredRivusDeploymentDaemon as r, validateRivusDeploymentManifest as rt, RivusDeploymentDaemonLifecycleError as s, runRivusDaemonCli as t, RivusPluginLoadError as tt, InvalidRivusEndpointBinding as u, createRivusDaemonShutdownController as v, loadNodeRivusPluginModule as w, formatRivusEnvFile as x, OpenClawEnvImportError as y, createFeishuCardRollover as z };
@@ -1,4 +1,4 @@
1
- import { h as RivusPlugin, l as RivusAgentDeployment } from "./rivus-plugin.js";
1
+ import { g as RivusPlugin, l as RivusAgentDeployment } from "./rivus-plugin.js";
2
2
 
3
3
  //#region src/testing/rivus-plugin-testkit.d.ts
4
4
  interface RivusPluginLifecycleProbe {
@@ -1,5 +1,53 @@
1
1
  import { c as MemoryScope, t as AgentMemoryAuthority } from "./agent-memory.js";
2
2
 
3
+ //#region src/domain/automation-presentation.d.ts
4
+ declare const AUTOMATION_PRESENTATION_SCHEMA_VERSION: 1;
5
+ type AutomationPresentationKind = "daily-ai" | "generic" | "industry" | "news" | "subscriptions";
6
+ interface AutomationPresentationSource {
7
+ readonly label: string;
8
+ readonly url: string;
9
+ }
10
+ interface AutomationPresentationItem {
11
+ readonly headline: string;
12
+ readonly note?: string;
13
+ readonly sources: ReadonlyArray<AutomationPresentationSource>;
14
+ }
15
+ interface AutomationPresentationSection {
16
+ readonly id: string;
17
+ readonly items: ReadonlyArray<AutomationPresentationItem>;
18
+ readonly title: string;
19
+ }
20
+ interface AutomationPresentation {
21
+ readonly footnote?: string;
22
+ readonly kind?: AutomationPresentationKind;
23
+ readonly meta: ReadonlyArray<string>;
24
+ readonly schemaVersion: typeof AUTOMATION_PRESENTATION_SCHEMA_VERSION;
25
+ readonly sections: ReadonlyArray<AutomationPresentationSection>;
26
+ readonly summary?: string;
27
+ readonly title: string;
28
+ }
29
+ interface AutomationPresentationInput {
30
+ readonly footnote?: string;
31
+ readonly kind?: AutomationPresentationKind;
32
+ readonly meta?: ReadonlyArray<string>;
33
+ readonly sections: ReadonlyArray<{
34
+ readonly id: string;
35
+ readonly items: ReadonlyArray<{
36
+ readonly headline: string;
37
+ readonly note?: string;
38
+ readonly sources?: ReadonlyArray<AutomationPresentationSource>;
39
+ }>;
40
+ readonly title: string;
41
+ }>;
42
+ readonly summary?: string;
43
+ readonly title: string;
44
+ }
45
+ declare class InvalidAutomationPresentation extends Error {
46
+ readonly name = "InvalidAutomationPresentation";
47
+ }
48
+ declare function createAutomationPresentation(input: AutomationPresentationInput): AutomationPresentation;
49
+ declare function readAutomationPresentation(value: unknown): AutomationPresentation;
50
+ //#endregion
3
51
  //#region src/domain/rivus-plugin.d.ts
4
52
  declare const RIVUS_PLUGIN_API_VERSION = "1";
5
53
  type RivusToolRisk = "observe" | "mutate" | "irreversible" | "host-control";
@@ -66,6 +114,7 @@ interface RivusAutomationTemplate {
66
114
  readonly requestedSkillIds: ReadonlyArray<string>;
67
115
  readonly requestedToolIds: ReadonlyArray<string>;
68
116
  readonly createInput: (tick: RivusAutomationTickContext) => RivusAutomationInput;
117
+ readonly createPresentation?: (output: RivusAutomationOutput) => AutomationPresentation;
69
118
  }
70
119
  interface RivusAutomationTickContext {
71
120
  readonly occurrence: string;
@@ -73,6 +122,10 @@ interface RivusAutomationTickContext {
73
122
  interface RivusAutomationInput {
74
123
  readonly text: string;
75
124
  }
125
+ interface RivusAutomationOutput {
126
+ readonly occurrence: string;
127
+ readonly text: string;
128
+ }
76
129
  interface RivusAgentProfile {
77
130
  readonly id: string;
78
131
  readonly displayName: string;
@@ -180,4 +233,4 @@ declare class InvalidRivusPlugin extends Error {
180
233
  readonly name = "InvalidRivusPlugin";
181
234
  }
182
235
  //#endregion
183
- export { RivusToolRisk as A, RivusToolDescriptor as C, RivusToolGrantSet as D, RivusToolFactoryContext as E, RivusToolIdempotency as O, RivusSkillGrantSet as S, RivusToolExecutor as T, RivusPluginCatalogSnapshot as _, RegisteredRivusPlugin as a, RivusResolvedToolDescriptor as b, ResolvedRivusAgentDefinition as c, RivusAutomationInput as d, RivusAutomationTemplate as f, RivusPluginCatalog as g, RivusPlugin as h, RegisteredRivusAutomation as i, requiresToolApproval as j, RivusToolInputRejected as k, RivusAgentDeployment as l, RivusHostToolDescriptor as m, RIVUS_PLUGIN_API_VERSION as n, RegisteredRivusSkill as o, RivusAutomationTickContext as p, RegisteredRivusAgentProfile as r, RegisteredRivusTool as s, InvalidRivusPlugin as t, RivusAgentProfile as u, RivusPluginManifest as v, RivusToolExecutionContext as w, RivusSkillDescriptor as x, RivusPluginRegistry as y };
236
+ export { RivusToolInputRejected as A, InvalidAutomationPresentation as B, RivusSkillGrantSet as C, RivusToolFactoryContext as D, RivusToolExecutor as E, AutomationPresentationInput as F, readAutomationPresentation as H, AutomationPresentationItem as I, AutomationPresentationKind as L, requiresToolApproval as M, AUTOMATION_PRESENTATION_SCHEMA_VERSION as N, RivusToolGrantSet as O, AutomationPresentation as P, AutomationPresentationSection as R, RivusSkillDescriptor as S, RivusToolExecutionContext as T, createAutomationPresentation as V, RivusPluginCatalog as _, RegisteredRivusPlugin as a, RivusPluginRegistry as b, ResolvedRivusAgentDefinition as c, RivusAutomationInput as d, RivusAutomationOutput as f, RivusPlugin as g, RivusHostToolDescriptor as h, RegisteredRivusAutomation as i, RivusToolRisk as j, RivusToolIdempotency as k, RivusAgentDeployment as l, RivusAutomationTickContext as m, RIVUS_PLUGIN_API_VERSION as n, RegisteredRivusSkill as o, RivusAutomationTemplate as p, RegisteredRivusAgentProfile as r, RegisteredRivusTool as s, InvalidRivusPlugin as t, RivusAgentProfile as u, RivusPluginCatalogSnapshot as v, RivusToolDescriptor as w, RivusResolvedToolDescriptor as x, RivusPluginManifest as y, AutomationPresentationSource as z };
@@ -61,6 +61,7 @@ import {
61
61
  openJsonAutomationTickRepository,
62
62
  openJsonlToolOperationLedger,
63
63
  openJsonlRecoveryControl,
64
+ readAutomationPresentation,
64
65
  resolveFeishuEndpointCredentials,
65
66
  resolveLangfuseTelemetryConfig,
66
67
  validateProjectSkillCatalog,
@@ -303,20 +304,29 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
303
304
  toolIds: input.definition.template.requestedToolIds
304
305
  },
305
306
  createInput: input.definition.template.createInput,
306
- deliver: ({ body, idempotencyKey }) =>
307
+ deliver: ({ body, idempotencyKey, presentation }) =>
307
308
  Effect.runPromise(
308
309
  sender.send({
309
310
  idempotencyKey,
310
311
  receiveId: target,
311
312
  receiveIdType: input.definition.delivery.targetType,
312
- markdown: body
313
+ markdown: body,
314
+ ...(presentation === undefined ? {} : { presentation })
313
315
  })
314
316
  ),
315
317
  onError: () => {
316
318
  console.error(`Scheduled Automation ${input.automationId} failed; it will retry`);
317
319
  },
318
320
  repository,
319
- run: async (runInput) => readAutomationRunResult(await input.run(runInput))
321
+ run: async (runInput) => {
322
+ const result = readAutomationRunResult(await input.run(runInput));
323
+ const projected = input.definition.template.createPresentation?.({
324
+ occurrence: runInput.occurrence,
325
+ text: result.body
326
+ });
327
+ const presentation = projected ? readAutomationPresentation(projected) : undefined;
328
+ return { ...result, ...(presentation === undefined ? {} : { presentation }) };
329
+ }
320
330
  });
321
331
  return automation;
322
332
  },
@@ -369,9 +379,6 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
369
379
  const cardRollover = createConfiguredFeishuCardRolloverRuntime({
370
380
  agentName: input.agentId,
371
381
  cardTargets,
372
- // The endpoint uses Feishu's long connection; callback buttons are
373
- // not delivered on that transport.
374
- cancelButton: false,
375
382
  client: openApiClient,
376
383
  clock: createSystemClock(),
377
384
  config,
@@ -379,6 +386,9 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
379
386
  onError: (error) => {
380
387
  console.error(`Feishu card rollover failed for endpoint ${input.endpointId}`, error);
381
388
  },
389
+ ...(input.definition.progressDisplay === undefined
390
+ ? {}
391
+ : { progressDisplay: input.definition.progressDisplay }),
382
392
  sleep,
383
393
  title: input.agentId
384
394
  });
@@ -28,6 +28,7 @@
28
28
  "required": true,
29
29
  "baseUrl": "https://open.feishu.cn",
30
30
  "streamMinIntervalMs": 200,
31
+ "progressDisplay": "collapsed",
31
32
  "groupPolicy": "ignore-unmentioned"
32
33
  }
33
34
  ],
@@ -93,6 +93,7 @@
93
93
  "required": true,
94
94
  "baseUrl": "https://open.feishu.cn",
95
95
  "streamMinIntervalMs": 200,
96
+ "progressDisplay": "collapsed",
96
97
  "groupPolicy": "mention-only"
97
98
  },
98
99
  {
@@ -104,6 +105,7 @@
104
105
  "required": true,
105
106
  "baseUrl": "https://open.feishu.cn",
106
107
  "streamMinIntervalMs": 200,
108
+ "progressDisplay": "collapsed",
107
109
  "groupPolicy": "mention-only"
108
110
  }
109
111
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivus/agent",
3
- "version": "0.12.7",
3
+ "version": "0.13.0",
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",