@rivus/agent 0.16.2 → 0.17.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/LICENSE +669 -17
- package/README.md +25 -1080
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +12 -1234
- package/dist/index.d.ts +3 -7
- package/dist/index.js +3 -8
- package/dist/testing/index.d.ts +21 -50
- package/dist/testing/index.js +58 -89
- package/package.json +40 -104
- package/dist/acp.d.ts +0 -144
- package/dist/acp.js +0 -768
- package/dist/bootstrap/pi-feishu.d.ts +0 -20
- package/dist/bootstrap/pi-feishu.js +0 -4341
- package/dist/chunks/agent-loop.d.ts +0 -446
- package/dist/chunks/agent-loop.js +0 -158
- package/dist/chunks/background-session-authority.js +0 -230
- package/dist/chunks/background-session-control-input.js +0 -51
- package/dist/chunks/background-session-service.d.ts +0 -382
- package/dist/chunks/index.d.ts +0 -4448
- package/dist/chunks/pi-tool-proxy.d.ts +0 -120
- package/dist/chunks/pi.js +0 -406
- package/dist/chunks/rivus-agent-definition-resolver.js +0 -508
- package/dist/chunks/rivus-daemon-cli.js +0 -3839
- package/dist/chunks/rivus-model-management-wire.js +0 -344
- package/dist/chunks/rivus-plugin-testkit.d.ts +0 -214
- package/dist/chunks/rivus-plugin-testkit.js +0 -78
- package/dist/chunks/rivus-skill.d.ts +0 -95
- package/dist/chunks/rivus-tool.js +0 -158
- package/dist/chunks/sha256-digest.js +0 -7
- package/dist/chunks/src.js +0 -15313
- package/dist/mcp.d.ts +0 -92
- package/dist/mcp.js +0 -454
- package/dist/pi.d.ts +0 -129
- package/dist/pi.js +0 -3
- package/examples/a-share-briefing-analysis.mjs +0 -93
- package/examples/a-share-briefing-renderer.mjs +0 -257
- package/examples/a-share-index-evidence.mjs +0 -99
- package/examples/a-share-market-briefing.mjs +0 -83
- package/examples/a-share-market-date.mjs +0 -10
- package/examples/a-share-overseas-evidence.mjs +0 -86
- package/examples/a-share-policy-evidence.mjs +0 -145
- package/examples/a-share-provider-response.mjs +0 -21
- package/examples/a-share-sector-evidence.mjs +0 -70
- package/examples/acp-stdio-proxy.mjs +0 -58
- package/examples/current-weather.mjs +0 -117
- package/examples/html-drive-tools.mjs +0 -262
- package/examples/https-response-reader.mjs +0 -36
- package/examples/langfuse-drive-e2e.mjs +0 -175
- package/examples/pi-feishu-deployment.bootstrap.ts +0 -894
- package/examples/pi-feishu.bootstrap.ts +0 -242
- package/examples/rivus-agents.plugin.mjs +0 -290
- package/examples/rivus-langfuse-demo.config.json +0 -37
- package/examples/rivus-starter.plugin.mjs +0 -47
- package/examples/rivus.config.json +0 -114
- package/skills/runtime-management/SKILL.md +0 -65
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
//#region src/adapters/cli/model/rivus-model-cli-protocol.ts
|
|
2
|
-
const RIVUS_MODEL_CLI_USAGE = `Usage:
|
|
3
|
-
rivus model status --json [--request <id>] [--verbose]
|
|
4
|
-
rivus model set --model <provider/model> --expected-revision <n> --request <id> --json [--verbose]
|
|
5
|
-
rivus model rollback --expected-revision <n> --request <id> --json [--verbose]
|
|
6
|
-
|
|
7
|
-
Commands:
|
|
8
|
-
status Read the effective and persistent model selection
|
|
9
|
-
set Submit one authorized model change
|
|
10
|
-
rollback Submit one authorized change to the previous model
|
|
11
|
-
|
|
12
|
-
All command results are JSON. A successful set or rollback call means the request
|
|
13
|
-
was accepted; query status by request id for the final outcome.
|
|
14
|
-
`;
|
|
15
|
-
function parseRivusModelCliArguments(argv) {
|
|
16
|
-
if (argv.includes("--help") || argv.includes("-h")) return { help: true };
|
|
17
|
-
const operation = argv[0];
|
|
18
|
-
if (operation !== "status" && operation !== "set" && operation !== "rollback") return { error: "model requires one of status, set, rollback" };
|
|
19
|
-
let expectedRevision;
|
|
20
|
-
let json = false;
|
|
21
|
-
let model;
|
|
22
|
-
let requestId;
|
|
23
|
-
let verbose = false;
|
|
24
|
-
for (let index = 1; index < argv.length; index += 1) {
|
|
25
|
-
const argument = argv[index];
|
|
26
|
-
if (argument === "--json") {
|
|
27
|
-
if (json) return { error: "--json may only be provided once" };
|
|
28
|
-
json = true;
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
if (argument === "--verbose") {
|
|
32
|
-
if (verbose) return { error: "--verbose may only be provided once" };
|
|
33
|
-
verbose = true;
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
if (argument === "--request") {
|
|
37
|
-
if (requestId !== void 0) return { error: "--request may only be provided once" };
|
|
38
|
-
const value = argv[index + 1];
|
|
39
|
-
if (!value || value.startsWith("-")) return { error: "--request requires an id" };
|
|
40
|
-
requestId = value;
|
|
41
|
-
index += 1;
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
if (argument.startsWith("--request=")) {
|
|
45
|
-
if (requestId !== void 0) return { error: "--request may only be provided once" };
|
|
46
|
-
requestId = argument.slice(10);
|
|
47
|
-
if (!requestId) return { error: "--request requires an id" };
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (argument === "--expected-revision") {
|
|
51
|
-
if (expectedRevision !== void 0) return { error: "--expected-revision may only be provided once" };
|
|
52
|
-
const value = argv[index + 1];
|
|
53
|
-
if (!value || value.startsWith("-")) return { error: "--expected-revision requires a non-negative integer" };
|
|
54
|
-
const parsed = parseRevision(value);
|
|
55
|
-
if (parsed === void 0) return { error: "--expected-revision requires a non-negative integer" };
|
|
56
|
-
expectedRevision = parsed;
|
|
57
|
-
index += 1;
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (argument.startsWith("--expected-revision=")) {
|
|
61
|
-
if (expectedRevision !== void 0) return { error: "--expected-revision may only be provided once" };
|
|
62
|
-
const parsed = parseRevision(argument.slice(20));
|
|
63
|
-
if (parsed === void 0) return { error: "--expected-revision requires a non-negative integer" };
|
|
64
|
-
expectedRevision = parsed;
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
if (argument === "--model") {
|
|
68
|
-
if (model !== void 0) return { error: "--model may only be provided once" };
|
|
69
|
-
const value = argv[index + 1];
|
|
70
|
-
if (!value || value.startsWith("-")) return { error: "--model requires provider/model" };
|
|
71
|
-
if (!isModelReference(value)) return { error: "--model must be provider/model" };
|
|
72
|
-
model = value;
|
|
73
|
-
index += 1;
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
if (argument.startsWith("--model=")) {
|
|
77
|
-
if (model !== void 0) return { error: "--model may only be provided once" };
|
|
78
|
-
const value = argument.slice(8);
|
|
79
|
-
if (!isModelReference(value)) return { error: "--model must be provider/model" };
|
|
80
|
-
model = value;
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
return { error: `Unknown model option: ${argument}` };
|
|
84
|
-
}
|
|
85
|
-
if (!json) return { error: "model commands require --json" };
|
|
86
|
-
if (operation === "status") {
|
|
87
|
-
if (model !== void 0) return { error: "status does not accept --model" };
|
|
88
|
-
if (expectedRevision !== void 0) return { error: "status does not accept --expected-revision" };
|
|
89
|
-
return {
|
|
90
|
-
json: true,
|
|
91
|
-
operation,
|
|
92
|
-
...requestId !== void 0 ? { requestId } : {},
|
|
93
|
-
...verbose ? { verbose: true } : {}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
if (requestId === void 0) return { error: "--request is required for model changes" };
|
|
97
|
-
if (expectedRevision === void 0) return { error: "--expected-revision is required for model changes" };
|
|
98
|
-
if (operation === "set" && model === void 0) return { error: "--model is required for model set" };
|
|
99
|
-
if (operation === "rollback" && model !== void 0) return { error: "rollback does not accept --model" };
|
|
100
|
-
return operation === "set" ? {
|
|
101
|
-
expectedRevision,
|
|
102
|
-
json: true,
|
|
103
|
-
model,
|
|
104
|
-
operation,
|
|
105
|
-
requestId,
|
|
106
|
-
...verbose ? { verbose: true } : {}
|
|
107
|
-
} : {
|
|
108
|
-
expectedRevision,
|
|
109
|
-
json: true,
|
|
110
|
-
operation,
|
|
111
|
-
requestId,
|
|
112
|
-
...verbose ? { verbose: true } : {}
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function renderRivusModelCliHelp() {
|
|
116
|
-
return RIVUS_MODEL_CLI_USAGE;
|
|
117
|
-
}
|
|
118
|
-
function renderRivusModelCliArgumentError(error) {
|
|
119
|
-
return `${error}\n\n${RIVUS_MODEL_CLI_USAGE}`;
|
|
120
|
-
}
|
|
121
|
-
function isModelReference(value) {
|
|
122
|
-
return /^[^/\s]+\/[^/\s]+$/.test(value);
|
|
123
|
-
}
|
|
124
|
-
function parseRevision(value) {
|
|
125
|
-
if (!/^\d+$/.test(value)) return void 0;
|
|
126
|
-
const revision = Number(value);
|
|
127
|
-
return Number.isSafeInteger(revision) ? revision : void 0;
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
//#region src/adapters/cli/model/rivus-model-management-wire.ts
|
|
131
|
-
function createRivusModelManagementWireRequest(command, env) {
|
|
132
|
-
const context = optionalString(env.RIVUS_MODEL_CONTEXT);
|
|
133
|
-
return {
|
|
134
|
-
...command,
|
|
135
|
-
...context ? { context } : {}
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
function parseRivusModelManagementWireRequest(value) {
|
|
139
|
-
if (!isRecord(value)) throw new Error("model request must be a JSON object");
|
|
140
|
-
const operation = value.operation;
|
|
141
|
-
if (operation !== "status" && operation !== "set" && operation !== "rollback") throw new Error("model request operation is invalid");
|
|
142
|
-
const context = optionalString(value.context);
|
|
143
|
-
const requestId = optionalString(value.requestId);
|
|
144
|
-
const verbose = value.verbose === true ? true : void 0;
|
|
145
|
-
if (operation === "status") {
|
|
146
|
-
if (value.json !== true) throw new Error("model request must require JSON output");
|
|
147
|
-
return {
|
|
148
|
-
json: true,
|
|
149
|
-
operation,
|
|
150
|
-
...context ? { context } : {},
|
|
151
|
-
...requestId ? { requestId } : {},
|
|
152
|
-
...verbose ? { verbose: true } : {}
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
const expectedRevision = value.expectedRevision;
|
|
156
|
-
if (value.json !== true || typeof expectedRevision !== "number" || !Number.isSafeInteger(expectedRevision) || expectedRevision < 0) throw new Error("model request has an invalid expected revision or output mode");
|
|
157
|
-
if (!requestId) throw new Error("model request requires a request id");
|
|
158
|
-
if (operation === "set") {
|
|
159
|
-
const model = optionalString(value.model);
|
|
160
|
-
if (!model || !/^[^/\s]+\/[^/\s]+$/.test(model)) throw new Error("model request target is invalid");
|
|
161
|
-
return {
|
|
162
|
-
expectedRevision,
|
|
163
|
-
json: true,
|
|
164
|
-
model,
|
|
165
|
-
operation,
|
|
166
|
-
requestId,
|
|
167
|
-
...context ? { context } : {},
|
|
168
|
-
...verbose ? { verbose: true } : {}
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
return {
|
|
172
|
-
expectedRevision,
|
|
173
|
-
json: true,
|
|
174
|
-
operation,
|
|
175
|
-
requestId,
|
|
176
|
-
...context ? { context } : {},
|
|
177
|
-
...verbose ? { verbose: true } : {}
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
function toRivusModelManagementSubmission(request) {
|
|
181
|
-
const target = request.operation === "set" ? parseTarget(request.model) : void 0;
|
|
182
|
-
return {
|
|
183
|
-
expectedRevision: request.expectedRevision,
|
|
184
|
-
operation: request.operation,
|
|
185
|
-
requestId: request.requestId,
|
|
186
|
-
...target ? { target } : {},
|
|
187
|
-
...request.verbose ? { verbose: true } : {}
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
|
-
function projectRivusModelCliResponse(value, operation) {
|
|
191
|
-
if (!isRecord(value)) throw new Error("model handler must return a JSON object");
|
|
192
|
-
const response = { schemaVersion: 1 };
|
|
193
|
-
copyScalar(response, value, "requestId");
|
|
194
|
-
copyScalar(response, value, "revision");
|
|
195
|
-
copyScalar(response, value, "source");
|
|
196
|
-
copyScalar(response, value, "protocolVersion");
|
|
197
|
-
copyScalar(response, value, "runtimeVersion");
|
|
198
|
-
copyScalar(response, value, "operation");
|
|
199
|
-
copyScalar(response, value, "expectedRevision");
|
|
200
|
-
copyScalar(response, value, "phase");
|
|
201
|
-
copyScalar(response, value, "reason");
|
|
202
|
-
for (const key of [
|
|
203
|
-
"actual",
|
|
204
|
-
"current",
|
|
205
|
-
"persisted",
|
|
206
|
-
"previous",
|
|
207
|
-
"target"
|
|
208
|
-
]) {
|
|
209
|
-
const model = projectModelReference(value[key]);
|
|
210
|
-
if (model) response[key] = model;
|
|
211
|
-
}
|
|
212
|
-
const budget = projectBudget(value.budget);
|
|
213
|
-
if (budget) response.budget = budget;
|
|
214
|
-
const pending = projectPending(value.pending);
|
|
215
|
-
if (pending) response.pending = pending;
|
|
216
|
-
const request = projectReceipt(value.request);
|
|
217
|
-
if (request) response.request = request;
|
|
218
|
-
const error = projectError(value.error);
|
|
219
|
-
if (error) response.error = error;
|
|
220
|
-
const recoveryRequired = projectError(value.recoveryRequired);
|
|
221
|
-
if (recoveryRequired) response.recoveryRequired = recoveryRequired;
|
|
222
|
-
const notification = projectNotification(value.notification);
|
|
223
|
-
if (notification) response.notification = notification;
|
|
224
|
-
const status = value.status;
|
|
225
|
-
response.status = isPublicStatus(status) ? status : value.recoveryRequired !== void 0 ? "recovery-required" : operation === "status" && value.pending !== void 0 ? "pending" : operation === "status" ? "applied" : "failed";
|
|
226
|
-
return response;
|
|
227
|
-
}
|
|
228
|
-
function createRivusModelManagementFailure(code, message) {
|
|
229
|
-
return {
|
|
230
|
-
error: {
|
|
231
|
-
code,
|
|
232
|
-
message
|
|
233
|
-
},
|
|
234
|
-
schemaVersion: 1,
|
|
235
|
-
status: "failed"
|
|
236
|
-
};
|
|
237
|
-
}
|
|
238
|
-
function projectModelReference(value) {
|
|
239
|
-
if (!isRecord(value) || typeof value.provider !== "string" || typeof value.model !== "string") return void 0;
|
|
240
|
-
const result = {
|
|
241
|
-
model: value.model,
|
|
242
|
-
provider: value.provider
|
|
243
|
-
};
|
|
244
|
-
if (typeof value.label === "string") return {
|
|
245
|
-
...result,
|
|
246
|
-
label: value.label
|
|
247
|
-
};
|
|
248
|
-
if (typeof value.bindingRevision === "string") return {
|
|
249
|
-
...result,
|
|
250
|
-
bindingRevision: value.bindingRevision
|
|
251
|
-
};
|
|
252
|
-
return result;
|
|
253
|
-
}
|
|
254
|
-
function projectPending(value) {
|
|
255
|
-
if (!isRecord(value)) return void 0;
|
|
256
|
-
const result = {};
|
|
257
|
-
copyScalar(result, value, "phase");
|
|
258
|
-
copyScalar(result, value, "reason");
|
|
259
|
-
if (result.reason === void 0 && typeof result.phase === "string") result.reason = result.phase;
|
|
260
|
-
copyScalar(result, value, "requestId");
|
|
261
|
-
copyScalar(result, value, "updatedAt");
|
|
262
|
-
const request = projectReceipt(value.request);
|
|
263
|
-
if (request) result.request = request;
|
|
264
|
-
const target = projectModelReference(value.target);
|
|
265
|
-
if (target) result.target = target;
|
|
266
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
267
|
-
}
|
|
268
|
-
function projectReceipt(value) {
|
|
269
|
-
if (!isRecord(value)) return void 0;
|
|
270
|
-
const result = {};
|
|
271
|
-
for (const key of [
|
|
272
|
-
"requestId",
|
|
273
|
-
"revision",
|
|
274
|
-
"status",
|
|
275
|
-
"phase",
|
|
276
|
-
"operation",
|
|
277
|
-
"expectedRevision",
|
|
278
|
-
"acceptedAt",
|
|
279
|
-
"updatedAt"
|
|
280
|
-
]) copyScalar(result, value, key);
|
|
281
|
-
const current = projectModelReference(value.current);
|
|
282
|
-
if (current) result.current = current;
|
|
283
|
-
const previous = projectModelReference(value.previous);
|
|
284
|
-
if (previous) result.previous = previous;
|
|
285
|
-
const target = projectModelReference(value.target);
|
|
286
|
-
if (target) result.target = target;
|
|
287
|
-
const budget = projectBudget(value.budget);
|
|
288
|
-
if (budget) result.budget = budget;
|
|
289
|
-
const error = projectError(value.error);
|
|
290
|
-
if (error) result.error = error;
|
|
291
|
-
const notification = projectNotification(value.notification);
|
|
292
|
-
if (notification) result.notification = notification;
|
|
293
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
294
|
-
}
|
|
295
|
-
function projectBudget(value) {
|
|
296
|
-
if (!isRecord(value)) return void 0;
|
|
297
|
-
const result = {};
|
|
298
|
-
for (const key of [
|
|
299
|
-
"deadlineAt",
|
|
300
|
-
"maxOutputTokens",
|
|
301
|
-
"maxPaidRequests",
|
|
302
|
-
"outputTokens",
|
|
303
|
-
"paidRequests"
|
|
304
|
-
]) copyScalar(result, value, key);
|
|
305
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
306
|
-
}
|
|
307
|
-
function projectError(value) {
|
|
308
|
-
if (!isRecord(value) || typeof value.code !== "string" || typeof value.message !== "string") return void 0;
|
|
309
|
-
return {
|
|
310
|
-
code: value.code,
|
|
311
|
-
message: value.message
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
function projectNotification(value) {
|
|
315
|
-
if (!isRecord(value)) return void 0;
|
|
316
|
-
const result = {};
|
|
317
|
-
copyScalar(result, value, "attempts");
|
|
318
|
-
copyScalar(result, value, "lastAttemptAt");
|
|
319
|
-
copyScalar(result, value, "status");
|
|
320
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
321
|
-
}
|
|
322
|
-
function copyScalar(target, source, key) {
|
|
323
|
-
const value = source[key];
|
|
324
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") target[key] = value;
|
|
325
|
-
}
|
|
326
|
-
function parseTarget(value) {
|
|
327
|
-
if (!value) throw new Error("model request target is missing");
|
|
328
|
-
const separator = value.indexOf("/");
|
|
329
|
-
return {
|
|
330
|
-
model: value.slice(separator + 1),
|
|
331
|
-
provider: value.slice(0, separator)
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
function isPublicStatus(value) {
|
|
335
|
-
return value === "applied" || value === "failed" || value === "pending" || value === "recovery-required" || value === "restored";
|
|
336
|
-
}
|
|
337
|
-
function optionalString(value) {
|
|
338
|
-
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
339
|
-
}
|
|
340
|
-
function isRecord(value) {
|
|
341
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
342
|
-
}
|
|
343
|
-
//#endregion
|
|
344
|
-
export { toRivusModelManagementSubmission as a, renderRivusModelCliHelp as c, projectRivusModelCliResponse as i, createRivusModelManagementWireRequest as n, parseRivusModelCliArguments as o, parseRivusModelManagementWireRequest as r, renderRivusModelCliArgumentError as s, createRivusModelManagementFailure as t };
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { a as RivusRuntimeToolId, d as RivusResolvedToolDescriptor, f as RivusToolDescriptor, g as RivusToolGrantSet, n as RivusSkillDescriptor, r as RivusSkillGrantSet, s as RegisteredRivusTool, t as RegisteredRivusSkill, u as RivusMemoryScope } from "./rivus-skill.js";
|
|
2
|
-
|
|
3
|
-
//#region src/core/application/agent-catalog/contracts/rivus-agent-definition.d.ts
|
|
4
|
-
interface RivusAgentProfile {
|
|
5
|
-
readonly id: string;
|
|
6
|
-
readonly displayName: string;
|
|
7
|
-
readonly systemPrompt: string;
|
|
8
|
-
readonly model: Readonly<Record<string, unknown>>;
|
|
9
|
-
readonly tools: {
|
|
10
|
-
readonly allow: ReadonlyArray<string>;
|
|
11
|
-
};
|
|
12
|
-
readonly skills: {
|
|
13
|
-
readonly allow: ReadonlyArray<string>;
|
|
14
|
-
};
|
|
15
|
-
readonly memory: {
|
|
16
|
-
readonly scopes: ReadonlyArray<RivusMemoryScope>;
|
|
17
|
-
};
|
|
18
|
-
readonly runtimeTools?: {
|
|
19
|
-
readonly allow: ReadonlyArray<RivusRuntimeToolId>;
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
interface RegisteredRivusAgentProfile extends RivusAgentProfile {
|
|
23
|
-
readonly pluginId: string;
|
|
24
|
-
}
|
|
25
|
-
interface RivusAgentDeployment {
|
|
26
|
-
readonly agentId: string;
|
|
27
|
-
readonly pluginId: string;
|
|
28
|
-
readonly profileId: string;
|
|
29
|
-
readonly projectSpaceId?: string;
|
|
30
|
-
readonly endpointIds: ReadonlyArray<string>;
|
|
31
|
-
readonly memory?: {
|
|
32
|
-
readonly scopes: ReadonlyArray<RivusMemoryScope>;
|
|
33
|
-
readonly tool: boolean;
|
|
34
|
-
};
|
|
35
|
-
readonly runtimeTools?: {
|
|
36
|
-
readonly allow: ReadonlyArray<RivusRuntimeToolId>;
|
|
37
|
-
};
|
|
38
|
-
readonly skills: {
|
|
39
|
-
readonly allow: ReadonlyArray<string>;
|
|
40
|
-
};
|
|
41
|
-
readonly tools: {
|
|
42
|
-
readonly allow: ReadonlyArray<string>;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
interface ResolvedRivusAgentDefinition {
|
|
46
|
-
readonly agentId: string;
|
|
47
|
-
readonly pluginId: string;
|
|
48
|
-
readonly profileId: string;
|
|
49
|
-
readonly projectSpaceId?: string;
|
|
50
|
-
readonly projectSpaceRevision?: string;
|
|
51
|
-
readonly endpointIds: ReadonlyArray<string>;
|
|
52
|
-
readonly profileRevision: string;
|
|
53
|
-
readonly systemPrompt: string;
|
|
54
|
-
readonly model: Readonly<Record<string, unknown>>;
|
|
55
|
-
readonly memory: {
|
|
56
|
-
readonly scopes: ReadonlyArray<RivusMemoryScope>;
|
|
57
|
-
readonly tool: boolean;
|
|
58
|
-
};
|
|
59
|
-
readonly runtimeToolGrantSet: RivusRuntimeToolGrantSet;
|
|
60
|
-
readonly skillGrantSet: RivusSkillGrantSet;
|
|
61
|
-
readonly skills: ReadonlyArray<RegisteredRivusSkill>;
|
|
62
|
-
readonly tools: ReadonlyArray<RivusResolvedToolDescriptor>;
|
|
63
|
-
readonly toolGrantSet: RivusToolGrantSet;
|
|
64
|
-
}
|
|
65
|
-
interface RivusRuntimeToolGrantSet {
|
|
66
|
-
readonly revision: string;
|
|
67
|
-
readonly toolIds: ReadonlyArray<RivusRuntimeToolId>;
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region src/core/application/agent-catalog/contracts/rivus-plugin.d.ts
|
|
71
|
-
declare const RIVUS_PLUGIN_API_VERSION = "1";
|
|
72
|
-
interface RivusPluginManifest {
|
|
73
|
-
readonly apiVersion: string;
|
|
74
|
-
readonly id: string;
|
|
75
|
-
readonly version: string;
|
|
76
|
-
}
|
|
77
|
-
interface RegisteredRivusPlugin extends RivusPluginManifest {}
|
|
78
|
-
declare class InvalidRivusPlugin extends Error {
|
|
79
|
-
readonly name = "InvalidRivusPlugin";
|
|
80
|
-
}
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/core/application/automation/presentation/automation-line-chart.d.ts
|
|
83
|
-
interface AutomationLineChart {
|
|
84
|
-
readonly title: string;
|
|
85
|
-
readonly labels: ReadonlyArray<string>;
|
|
86
|
-
readonly unit: string;
|
|
87
|
-
readonly seriesLayout?: "overlay" | "separate";
|
|
88
|
-
readonly series: ReadonlyArray<{
|
|
89
|
-
readonly name: string;
|
|
90
|
-
readonly values: ReadonlyArray<number>;
|
|
91
|
-
}>;
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region src/core/application/automation/presentation/automation-presentation.d.ts
|
|
95
|
-
declare const AUTOMATION_PRESENTATION_SCHEMA_VERSION: 1;
|
|
96
|
-
type AutomationPresentationKind = "daily-ai" | "generic" | "industry" | "news" | "subscriptions";
|
|
97
|
-
interface AutomationPresentationSource {
|
|
98
|
-
readonly label: string;
|
|
99
|
-
readonly url: string;
|
|
100
|
-
}
|
|
101
|
-
interface AutomationPresentationItem {
|
|
102
|
-
readonly headline: string;
|
|
103
|
-
readonly note?: string;
|
|
104
|
-
readonly sources: ReadonlyArray<AutomationPresentationSource>;
|
|
105
|
-
}
|
|
106
|
-
interface AutomationPresentationSection {
|
|
107
|
-
readonly id: string;
|
|
108
|
-
readonly items: ReadonlyArray<AutomationPresentationItem>;
|
|
109
|
-
readonly title: string;
|
|
110
|
-
}
|
|
111
|
-
interface AutomationPresentation {
|
|
112
|
-
readonly lineChart?: AutomationLineChart;
|
|
113
|
-
readonly footnote?: string;
|
|
114
|
-
readonly kind?: AutomationPresentationKind;
|
|
115
|
-
readonly meta: ReadonlyArray<string>;
|
|
116
|
-
readonly schemaVersion: typeof AUTOMATION_PRESENTATION_SCHEMA_VERSION;
|
|
117
|
-
readonly sections: ReadonlyArray<AutomationPresentationSection>;
|
|
118
|
-
readonly summary?: string;
|
|
119
|
-
readonly title: string;
|
|
120
|
-
}
|
|
121
|
-
interface AutomationPresentationInput {
|
|
122
|
-
readonly lineChart?: AutomationLineChart;
|
|
123
|
-
readonly footnote?: string;
|
|
124
|
-
readonly kind?: AutomationPresentationKind;
|
|
125
|
-
readonly meta?: ReadonlyArray<string>;
|
|
126
|
-
readonly sections: ReadonlyArray<{
|
|
127
|
-
readonly id: string;
|
|
128
|
-
readonly items: ReadonlyArray<{
|
|
129
|
-
readonly headline: string;
|
|
130
|
-
readonly note?: string;
|
|
131
|
-
readonly sources?: ReadonlyArray<AutomationPresentationSource>;
|
|
132
|
-
}>;
|
|
133
|
-
readonly title: string;
|
|
134
|
-
}>;
|
|
135
|
-
readonly summary?: string;
|
|
136
|
-
readonly title: string;
|
|
137
|
-
}
|
|
138
|
-
declare class InvalidAutomationPresentation extends Error {
|
|
139
|
-
readonly name = "InvalidAutomationPresentation";
|
|
140
|
-
}
|
|
141
|
-
declare function createAutomationPresentation(input: AutomationPresentationInput): AutomationPresentation;
|
|
142
|
-
declare function readAutomationPresentation(value: unknown): AutomationPresentation;
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/core/application/agent-catalog/contracts/rivus-automation-template.d.ts
|
|
145
|
-
interface RivusAutomationTemplate {
|
|
146
|
-
readonly id: string;
|
|
147
|
-
readonly profileId: string;
|
|
148
|
-
readonly requestedSkillIds: ReadonlyArray<string>;
|
|
149
|
-
readonly requestedToolIds: ReadonlyArray<string>;
|
|
150
|
-
readonly createInput: (tick: RivusAutomationTickContext) => RivusAutomationInput;
|
|
151
|
-
readonly createPresentation?: (output: RivusAutomationOutput) => AutomationPresentation;
|
|
152
|
-
}
|
|
153
|
-
interface RivusAutomationTickContext {
|
|
154
|
-
readonly occurrence: string;
|
|
155
|
-
}
|
|
156
|
-
interface RivusAutomationInput {
|
|
157
|
-
readonly text: string;
|
|
158
|
-
}
|
|
159
|
-
interface RivusAutomationOutput {
|
|
160
|
-
readonly occurrence: string;
|
|
161
|
-
readonly text: string;
|
|
162
|
-
}
|
|
163
|
-
interface RegisteredRivusAutomation extends RivusAutomationTemplate {
|
|
164
|
-
readonly pluginId: string;
|
|
165
|
-
}
|
|
166
|
-
//#endregion
|
|
167
|
-
//#region src/core/application/agent-catalog/contracts/rivus-plugin-contracts.d.ts
|
|
168
|
-
interface RivusPluginRegistry {
|
|
169
|
-
registerAgentProfile(profile: RivusAgentProfile): void;
|
|
170
|
-
registerTool(tool: RivusToolDescriptor): void;
|
|
171
|
-
registerSkill(skill: RivusSkillDescriptor): void;
|
|
172
|
-
registerAutomation(template: RivusAutomationTemplate): void;
|
|
173
|
-
}
|
|
174
|
-
interface RivusPlugin {
|
|
175
|
-
readonly manifest: RivusPluginManifest;
|
|
176
|
-
register(registry: RivusPluginRegistry): void;
|
|
177
|
-
}
|
|
178
|
-
interface RivusPluginCatalogSnapshot {
|
|
179
|
-
readonly plugins: ReadonlyArray<RegisteredRivusPlugin>;
|
|
180
|
-
readonly profiles: ReadonlyArray<RegisteredRivusAgentProfile>;
|
|
181
|
-
readonly tools: ReadonlyArray<RegisteredRivusTool>;
|
|
182
|
-
readonly skills: ReadonlyArray<RegisteredRivusSkill>;
|
|
183
|
-
readonly automations: ReadonlyArray<RegisteredRivusAutomation>;
|
|
184
|
-
}
|
|
185
|
-
interface RivusPluginCatalog {
|
|
186
|
-
registerPlugin(plugin: RivusPlugin): void;
|
|
187
|
-
snapshot(): RivusPluginCatalogSnapshot;
|
|
188
|
-
}
|
|
189
|
-
//#endregion
|
|
190
|
-
//#region src/testing/rivus-plugin-testkit.d.ts
|
|
191
|
-
interface RivusPluginLifecycleProbe {
|
|
192
|
-
activate(): Promise<{
|
|
193
|
-
readonly dispose: () => Promise<void> | void;
|
|
194
|
-
readonly activeResources: () => number;
|
|
195
|
-
}>;
|
|
196
|
-
}
|
|
197
|
-
interface RivusPluginConformanceInput {
|
|
198
|
-
readonly plugin: RivusPlugin;
|
|
199
|
-
readonly deployment: RivusAgentDeployment;
|
|
200
|
-
readonly lifecycle?: RivusPluginLifecycleProbe;
|
|
201
|
-
}
|
|
202
|
-
interface RivusPluginConformanceReport {
|
|
203
|
-
readonly pluginId: string;
|
|
204
|
-
readonly profileId: string;
|
|
205
|
-
readonly profileRevision: string;
|
|
206
|
-
readonly toolIds: ReadonlyArray<string>;
|
|
207
|
-
}
|
|
208
|
-
declare class RivusPluginConformanceError extends Error {
|
|
209
|
-
readonly name = "RivusPluginConformanceError";
|
|
210
|
-
}
|
|
211
|
-
declare function assertRivusPluginConforms(input: RivusPluginConformanceInput): Promise<RivusPluginConformanceReport>;
|
|
212
|
-
declare function createFakeRivusPlugin(): RivusPlugin;
|
|
213
|
-
//#endregion
|
|
214
|
-
export { RegisteredRivusAgentProfile as A, InvalidAutomationPresentation as C, RIVUS_PLUGIN_API_VERSION as D, InvalidRivusPlugin as E, RivusAgentDeployment as M, RivusAgentProfile as N, RegisteredRivusPlugin as O, RivusRuntimeToolGrantSet as P, AutomationPresentationSource as S, readAutomationPresentation as T, AutomationPresentation as _, assertRivusPluginConforms as a, AutomationPresentationKind as b, RivusPluginCatalog as c, RegisteredRivusAutomation as d, RivusAutomationInput as f, AUTOMATION_PRESENTATION_SCHEMA_VERSION as g, RivusAutomationTickContext as h, RivusPluginLifecycleProbe as i, ResolvedRivusAgentDefinition as j, RivusPluginManifest as k, RivusPluginCatalogSnapshot as l, RivusAutomationTemplate as m, RivusPluginConformanceInput as n, createFakeRivusPlugin as o, RivusAutomationOutput as p, RivusPluginConformanceReport as r, RivusPlugin as s, RivusPluginConformanceError as t, RivusPluginRegistry as u, AutomationPresentationInput as v, createAutomationPresentation as w, AutomationPresentationSection as x, AutomationPresentationItem as y };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { t as createSha256Digest } from "./sha256-digest.js";
|
|
2
|
-
import { o as createRivusHostToolDescriptorProvider, p as deepFreeze, r as createRivusPluginCatalog$1, s as RIVUS_MEMORY_TOOL_ID, t as createRivusAgentCatalog } from "./rivus-agent-definition-resolver.js";
|
|
3
|
-
//#region src/adapters/compatibility/agent-catalog/rivus-agent-catalog.ts
|
|
4
|
-
const runtime = Object.freeze({
|
|
5
|
-
digest: createSha256Digest,
|
|
6
|
-
deepFreeze
|
|
7
|
-
});
|
|
8
|
-
function createRivusPluginCatalog() {
|
|
9
|
-
return createRivusPluginCatalog$1(runtime);
|
|
10
|
-
}
|
|
11
|
-
function createCompatibleRivusAgentCatalog(options = {}) {
|
|
12
|
-
return createRivusAgentCatalog([createRivusHostToolDescriptorProvider({ backgroundSessions: options.backgroundSessions === true })], runtime);
|
|
13
|
-
}
|
|
14
|
-
function resolveRivusAgentDefinition(catalog, deployment, options = {}) {
|
|
15
|
-
return createCompatibleRivusAgentCatalog(options).resolve(catalog, deployment);
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/testing/rivus-plugin-testkit.ts
|
|
19
|
-
var RivusPluginConformanceError = class extends Error {
|
|
20
|
-
name = "RivusPluginConformanceError";
|
|
21
|
-
};
|
|
22
|
-
async function assertRivusPluginConforms(input) {
|
|
23
|
-
const catalog = createRivusPluginCatalog();
|
|
24
|
-
catalog.registerPlugin(input.plugin);
|
|
25
|
-
const resolved = resolveRivusAgentDefinition(catalog, input.deployment);
|
|
26
|
-
const requested = /* @__PURE__ */ new Set([...input.deployment.tools.allow, ...input.deployment.memory?.tool === true ? [RIVUS_MEMORY_TOOL_ID] : []]);
|
|
27
|
-
if (resolved.toolGrantSet.toolIds.some((id) => !requested.has(id))) throw new RivusPluginConformanceError("resolved ToolGrantSet expanded beyond deployment request");
|
|
28
|
-
if (input.lifecycle) {
|
|
29
|
-
const lifecycle = await input.lifecycle.activate();
|
|
30
|
-
await lifecycle.dispose();
|
|
31
|
-
if (lifecycle.activeResources() !== 0) throw new RivusPluginConformanceError("plugin dispose leaked active resources");
|
|
32
|
-
}
|
|
33
|
-
return Object.freeze({
|
|
34
|
-
pluginId: input.plugin.manifest.id,
|
|
35
|
-
profileId: resolved.profileId,
|
|
36
|
-
profileRevision: resolved.profileRevision,
|
|
37
|
-
toolIds: resolved.toolGrantSet.toolIds
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function createFakeRivusPlugin() {
|
|
41
|
-
return {
|
|
42
|
-
manifest: {
|
|
43
|
-
apiVersion: "1",
|
|
44
|
-
id: "fake-plugin",
|
|
45
|
-
version: "1.0.0"
|
|
46
|
-
},
|
|
47
|
-
register: (registry) => {
|
|
48
|
-
registry.registerTool({
|
|
49
|
-
createExecutor: () => ({ execute: async () => ({ ok: true }) }),
|
|
50
|
-
description: "Read fake data",
|
|
51
|
-
digest: "sha256:fake-read",
|
|
52
|
-
id: "fake-plugin/read",
|
|
53
|
-
idempotency: "supported",
|
|
54
|
-
inputSchema: { type: "object" },
|
|
55
|
-
risk: "observe",
|
|
56
|
-
version: "1.0.0"
|
|
57
|
-
});
|
|
58
|
-
registry.registerSkill({
|
|
59
|
-
content: "Use only fake data.",
|
|
60
|
-
digest: "sha256:fake-skill",
|
|
61
|
-
id: "fake-plugin/read-skill",
|
|
62
|
-
title: "Fake read",
|
|
63
|
-
version: "1.0.0"
|
|
64
|
-
});
|
|
65
|
-
registry.registerAgentProfile({
|
|
66
|
-
displayName: "Fake Profile",
|
|
67
|
-
id: "fake-profile",
|
|
68
|
-
memory: { scopes: ["agent-private"] },
|
|
69
|
-
model: { provider: "fake" },
|
|
70
|
-
skills: { allow: ["fake-plugin/read-skill"] },
|
|
71
|
-
systemPrompt: "Read fake data.",
|
|
72
|
-
tools: { allow: ["fake-plugin/read"] }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { createRivusPluginCatalog as a, createCompatibleRivusAgentCatalog as i, assertRivusPluginConforms as n, resolveRivusAgentDefinition as o, createFakeRivusPlugin as r, RivusPluginConformanceError as t };
|