@rivus/agent 0.5.2 → 0.6.1

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.
@@ -0,0 +1,114 @@
1
+ //#region src/domain/rivus-plugin.ts
2
+ const RIVUS_PLUGIN_API_VERSION = "1";
3
+ function requiresToolApproval(risk) {
4
+ return risk === "irreversible" || risk === "host-control";
5
+ }
6
+ var RivusToolInputRejected = class extends Error {
7
+ name = "RivusToolInputRejected";
8
+ };
9
+ var InvalidRivusPlugin = class extends Error {
10
+ name = "InvalidRivusPlugin";
11
+ };
12
+ //#endregion
13
+ //#region src/domain/agent-memory.ts
14
+ const MEMORY_SCOPES = [
15
+ "conversation",
16
+ "agent-private",
17
+ "project",
18
+ "shared-user-profile"
19
+ ];
20
+ const RIVUS_MEMORY_TOOL_ID = "memory";
21
+ const RIVUS_MEMORY_TOOL_PLUGIN_ID = "rivus-core";
22
+ const RIVUS_MEMORY_TOOL_VERSION = "1.0.0";
23
+ function createMemoryNamespace(binding) {
24
+ const encode = (value) => encodeURIComponent(value);
25
+ switch (binding.scope) {
26
+ case "conversation": return [
27
+ binding.tenantId,
28
+ binding.agentId,
29
+ binding.subjectId,
30
+ binding.conversationId ?? "",
31
+ binding.scope
32
+ ].map(encode).join("/");
33
+ case "agent-private": return [
34
+ binding.tenantId,
35
+ binding.agentId,
36
+ binding.subjectId,
37
+ binding.scope
38
+ ].map(encode).join("/");
39
+ case "project": return [
40
+ binding.tenantId,
41
+ binding.agentId,
42
+ binding.projectId ?? "",
43
+ binding.scope
44
+ ].map(encode).join("/");
45
+ case "shared-user-profile": return [
46
+ binding.tenantId,
47
+ binding.subjectId,
48
+ binding.scope
49
+ ].map(encode).join("/");
50
+ }
51
+ }
52
+ function restrictMemoryScopesForAudience(scopes, audience) {
53
+ return audience === "group" ? scopes.filter((scope) => scope === "conversation" || scope === "project") : [...scopes];
54
+ }
55
+ function createRivusMemoryToolContract(scopes) {
56
+ return Object.freeze({
57
+ description: "Search and read Memory inside Host-bound scopes; propose or request forgetting only in writable private scopes.",
58
+ digest: "sha256:rivus-memory-v3",
59
+ id: RIVUS_MEMORY_TOOL_ID,
60
+ idempotency: "required",
61
+ inputSchema: Object.freeze({
62
+ additionalProperties: false,
63
+ properties: {
64
+ command: {
65
+ description: "One of search, read, propose, or forget_request.",
66
+ enum: [
67
+ "search",
68
+ "read",
69
+ "propose",
70
+ "forget_request"
71
+ ],
72
+ type: "string"
73
+ },
74
+ id: {
75
+ description: "Required for read and forget_request.",
76
+ minLength: 1,
77
+ type: "string"
78
+ },
79
+ input: {
80
+ additionalProperties: false,
81
+ description: "Required for propose.",
82
+ properties: { content: {
83
+ minLength: 1,
84
+ type: "string"
85
+ } },
86
+ required: ["content"],
87
+ type: "object"
88
+ },
89
+ query: {
90
+ additionalProperties: false,
91
+ description: "Required for search.",
92
+ properties: { query: { type: "string" } },
93
+ required: ["query"],
94
+ type: "object"
95
+ },
96
+ reason: {
97
+ description: "Optional reason for forget_request.",
98
+ type: "string"
99
+ },
100
+ ...scopes.length === 0 ? {} : { scope: {
101
+ description: "Optional Host-granted scope for search or propose. Confirmed Project and Shared User Profile Memory are read-only to the model.",
102
+ enum: [...scopes],
103
+ type: "string"
104
+ } }
105
+ },
106
+ required: ["command"],
107
+ type: "object"
108
+ }),
109
+ risk: "mutate",
110
+ version: RIVUS_MEMORY_TOOL_VERSION
111
+ });
112
+ }
113
+ //#endregion
114
+ export { createMemoryNamespace as a, InvalidRivusPlugin as c, requiresToolApproval as d, RIVUS_MEMORY_TOOL_VERSION as i, RIVUS_PLUGIN_API_VERSION as l, RIVUS_MEMORY_TOOL_ID as n, createRivusMemoryToolContract as o, RIVUS_MEMORY_TOOL_PLUGIN_ID as r, restrictMemoryScopesForAudience as s, MEMORY_SCOPES as t, RivusToolInputRejected as u };
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as loadMergedLocalEnvFile, D as loadRivusDeploymentManifest, N as validateRivusDeploymentManifest, T as resolveNodeRivusPluginModulePath, k as resolveFeishuEndpointCredentials, t as runRivusDaemonCli } from "./rivus-daemon-cli.js";
2
+ import { D as loadRivusDeploymentManifest, G as validateRivusDeploymentManifest, H as loadMergedLocalEnvFile, T as resolveNodeRivusPluginModulePath, V as resolveFeishuEndpointCredentials, t as runRivusDaemonCli } from "./rivus-daemon-cli.js";
3
3
  import { Effect } from "effect";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -336,6 +336,7 @@ function deploymentManifest() {
336
336
  endpoints: [{
337
337
  agentId: "agent-a",
338
338
  baseUrl: "https://open.feishu.cn",
339
+ cardStreamLeaseMs: 51e4,
339
340
  credentialRef: "env:RIVUS_FEISHU",
340
341
  enabled: true,
341
342
  experimental: { cotMessages: false },