@rivus/agent 0.15.1 → 0.16.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.
- package/dist/bootstrap/pi-feishu.js +37 -31
- package/dist/chunks/agent-loop.d.ts +2 -1
- package/dist/chunks/agent-loop.js +8 -2
- package/dist/chunks/index.d.ts +7 -0
- package/dist/chunks/pi.js +39 -2
- package/dist/chunks/rivus-daemon-cli.js +1 -14
- package/dist/chunks/rivus-plugin-testkit.d.ts +14 -0
- package/dist/chunks/src.js +531 -263
- package/dist/pi.d.ts +22 -1
- package/dist/pi.js +2 -2
- package/examples/pi-feishu-deployment.bootstrap.ts +17 -11
- package/examples/pi-feishu.bootstrap.ts +1 -0
- package/package.json +6 -6
package/dist/pi.d.ts
CHANGED
|
@@ -66,6 +66,23 @@ interface PiNamedTool {
|
|
|
66
66
|
}
|
|
67
67
|
declare function resolvePiSessionToolNames(runtimeToolIds: ReadonlyArray<RivusRuntimeToolId>, customTools: ReadonlyArray<PiNamedTool>): ReadonlyArray<string>;
|
|
68
68
|
//#endregion
|
|
69
|
+
//#region src/adapters/pi/tool-execution/pi-bash-tool-options.d.ts
|
|
70
|
+
interface PiBashSpawnContext {
|
|
71
|
+
command: string;
|
|
72
|
+
cwd: string;
|
|
73
|
+
env: Record<string, string | undefined>;
|
|
74
|
+
}
|
|
75
|
+
/** Rivus's Bash configuration boundary, independent of provider UI/model types. */
|
|
76
|
+
interface PiBashToolOptions {
|
|
77
|
+
commandPrefix?: string;
|
|
78
|
+
shellPath?: string;
|
|
79
|
+
spawnHook?: (context: PiBashSpawnContext) => PiBashSpawnContext;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/adapters/pi/tool-execution/pi-bash-tool.d.ts
|
|
83
|
+
/** Keep Pi's native execution, rendering and abort cleanup with a bounded default. */
|
|
84
|
+
declare function createPiBashTool(cwd: string, options?: PiBashToolOptions): PiToolDefinition;
|
|
85
|
+
//#endregion
|
|
69
86
|
//#region src/adapters/pi/runtime/pi-session-resources.d.ts
|
|
70
87
|
interface CreatePiSessionResourcesOptions {
|
|
71
88
|
readonly agentDir: string;
|
|
@@ -77,6 +94,10 @@ interface CreatePiSessionResourcesOptions {
|
|
|
77
94
|
readonly systemPromptOverride?: (base: string | undefined) => string | undefined;
|
|
78
95
|
}
|
|
79
96
|
interface PiSessionResources {
|
|
97
|
+
readonly bashToolOptions?: {
|
|
98
|
+
readonly commandPrefix?: string;
|
|
99
|
+
readonly shellPath?: string;
|
|
100
|
+
};
|
|
80
101
|
readonly skillNames: ReadonlySet<string>;
|
|
81
102
|
readonly skillPaths: ReadonlyArray<string>;
|
|
82
103
|
readonly refresh: () => Promise<void>;
|
|
@@ -105,4 +126,4 @@ interface PiToolProxyOptions {
|
|
|
105
126
|
declare function createPiToolProxyDefinitions(options: PiToolProxyOptions): PiToolDefinition[];
|
|
106
127
|
declare function createPiToolNameResolver(tools: ReadonlyArray<Pick<RivusResolvedToolDescriptor, "id">>): (toolName: string) => string;
|
|
107
128
|
//#endregion
|
|
108
|
-
export { type CreatePiSessionResourcesOptions, InvalidPiSkillCatalog, InvalidPiSkillSource, type PiSessionResources, type PiSkillRuntime, type PiToolApprovalGateway, type PiToolApprovalRequest, type PiToolContent, type PiToolDefinition, type PiToolProxyOptions, type PiToolResult, ProjectSkillReadDenied, type ResolvePiSkillSourcesOptions, createPiProjectSkillReadTool, createPiSessionResources, createPiSkillReadTool, createPiSkillReadTools, createPiSkillRuntime, createPiToolNameResolver, createPiToolProxyDefinitions, resolvePiSessionToolNames, resolvePiSkillSources, validatePiSkillCatalog, validatePiSkillCommand };
|
|
129
|
+
export { type CreatePiSessionResourcesOptions, InvalidPiSkillCatalog, InvalidPiSkillSource, type PiBashToolOptions, type PiSessionResources, type PiSkillRuntime, type PiToolApprovalGateway, type PiToolApprovalRequest, type PiToolContent, type PiToolDefinition, type PiToolProxyOptions, type PiToolResult, ProjectSkillReadDenied, type ResolvePiSkillSourcesOptions, createPiBashTool, createPiProjectSkillReadTool, createPiSessionResources, createPiSkillReadTool, createPiSkillReadTools, createPiSkillRuntime, createPiToolNameResolver, createPiToolProxyDefinitions, resolvePiSessionToolNames, resolvePiSkillSources, validatePiSkillCatalog, validatePiSkillCommand };
|
package/dist/pi.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { a as InvalidPiSkillSource, c as validatePiSkillCatalog, d as createPiProjectSkillReadTool, f as createPiSkillReadTool, i as resolvePiSessionToolNames, l as validatePiSkillCommand, m as createPiBashTool, n as createPiToolProxyDefinitions, o as resolvePiSkillSources, p as createPiSkillReadTools, r as createPiSessionResources, s as InvalidPiSkillCatalog, t as createPiToolNameResolver, u as ProjectSkillReadDenied } from "./chunks/pi.js";
|
|
1
2
|
import { r as createPiSkillRuntime } from "./chunks/rivus-tool.js";
|
|
2
|
-
|
|
3
|
-
export { InvalidPiSkillCatalog, InvalidPiSkillSource, ProjectSkillReadDenied, createPiProjectSkillReadTool, createPiSessionResources, createPiSkillReadTool, createPiSkillReadTools, createPiSkillRuntime, createPiToolNameResolver, createPiToolProxyDefinitions, resolvePiSessionToolNames, resolvePiSkillSources, validatePiSkillCatalog, validatePiSkillCommand };
|
|
3
|
+
export { InvalidPiSkillCatalog, InvalidPiSkillSource, ProjectSkillReadDenied, createPiBashTool, createPiProjectSkillReadTool, createPiSessionResources, createPiSkillReadTool, createPiSkillReadTools, createPiSkillRuntime, createPiToolNameResolver, createPiToolProxyDefinitions, resolvePiSessionToolNames, resolvePiSkillSources, validatePiSkillCatalog, validatePiSkillCommand };
|
|
@@ -81,6 +81,7 @@ import {
|
|
|
81
81
|
type RivusThinkingLevel
|
|
82
82
|
} from "@rivus/agent";
|
|
83
83
|
import {
|
|
84
|
+
createPiBashTool,
|
|
84
85
|
createPiSkillReadTools,
|
|
85
86
|
createPiSessionResources,
|
|
86
87
|
createPiSkillRuntime,
|
|
@@ -532,9 +533,19 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
|
|
|
532
533
|
const sessionRegistry = createPiSessionRegistry({
|
|
533
534
|
createSession: async (firstInput) => {
|
|
534
535
|
let activeInput = firstInput;
|
|
536
|
+
const resources = await createPiSessionResources({
|
|
537
|
+
agentDir: PI_AGENT_DIR,
|
|
538
|
+
appendSystemPromptOverride: () =>
|
|
539
|
+
[workspaceInstructions.content, skillRuntime.prompt].filter((content) => content.length > 0),
|
|
540
|
+
cwd: workingDirectory,
|
|
541
|
+
homeDirectory: homedir(),
|
|
542
|
+
...(input.projectSpace ? { projectSkillPaths: input.projectSpace.skillPaths } : {}),
|
|
543
|
+
systemPromptOverride: () => input.definition.systemPrompt
|
|
544
|
+
});
|
|
535
545
|
const managedContext =
|
|
536
546
|
management?.enabled && runContexts && input.definition.runtimeToolGrantSet.toolIds.includes("bash")
|
|
537
547
|
? createPiManagedSessionContext({
|
|
548
|
+
...(resources.bashToolOptions ? { bashToolOptions: resources.bashToolOptions } : {}),
|
|
538
549
|
binDirectory: management.binDirectory,
|
|
539
550
|
contexts: runContexts.registry,
|
|
540
551
|
cwd: workingDirectory,
|
|
@@ -542,17 +553,11 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
|
|
|
542
553
|
socketPath: management.socketPath
|
|
543
554
|
})
|
|
544
555
|
: undefined;
|
|
545
|
-
const
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
[workspaceInstructions.content, skillRuntime.prompt].filter((content) => content.length > 0),
|
|
549
|
-
cwd: workingDirectory,
|
|
550
|
-
homeDirectory: homedir(),
|
|
551
|
-
...(input.projectSpace ? { projectSkillPaths: input.projectSpace.skillPaths } : {}),
|
|
552
|
-
systemPromptOverride: () => input.definition.systemPrompt
|
|
553
|
-
});
|
|
556
|
+
const bashTool = input.definition.runtimeToolGrantSet.toolIds.includes("bash")
|
|
557
|
+
? (managedContext?.tool ?? createPiBashTool(workingDirectory, resources.bashToolOptions))
|
|
558
|
+
: undefined;
|
|
554
559
|
const customTools = [
|
|
555
|
-
...(
|
|
560
|
+
...(bashTool ? [bashTool] : []),
|
|
556
561
|
...createPiSkillReadTools({
|
|
557
562
|
cwd: workingDirectory,
|
|
558
563
|
runtimeToolIds: input.definition.runtimeToolGrantSet.toolIds,
|
|
@@ -570,7 +575,7 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
|
|
|
570
575
|
}),
|
|
571
576
|
...(skillRuntime.tool ? [skillRuntime.tool] : [])
|
|
572
577
|
];
|
|
573
|
-
const nativeToolIds =
|
|
578
|
+
const nativeToolIds = bashTool
|
|
574
579
|
? input.definition.runtimeToolGrantSet.toolIds.filter((toolId) => toolId !== "bash")
|
|
575
580
|
: input.definition.runtimeToolGrantSet.toolIds;
|
|
576
581
|
const activeToolNames = resolvePiSessionToolNames(nativeToolIds, customTools);
|
|
@@ -605,6 +610,7 @@ export async function createRivusDeploymentAdapters(context: RivusDeploymentBoot
|
|
|
605
610
|
? management.runtime.registerSessionRegistry(sessionRegistry)
|
|
606
611
|
: undefined;
|
|
607
612
|
const loop = createPiAgentLoop({
|
|
613
|
+
supportsSteering: true,
|
|
608
614
|
disposeSessionAfterRun: false,
|
|
609
615
|
...(management?.enabled ? { runBoundary: management.boundary } : {}),
|
|
610
616
|
...(telemetry ? { modelContentObserver: telemetry.modelContentObserver } : {}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivus/agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
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",
|
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
"@earendil-works/pi-coding-agent": "0.84.4",
|
|
94
94
|
"@larksuiteoapi/node-sdk": "1.71.1",
|
|
95
95
|
"@opentelemetry/api": "^1.9.1",
|
|
96
|
-
"@opentelemetry/exporter-trace-otlp-proto": "^0.
|
|
97
|
-
"@opentelemetry/resources": "^2.
|
|
98
|
-
"@opentelemetry/sdk-trace-base": "^2.
|
|
99
|
-
"@opentelemetry/sdk-trace-node": "^2.
|
|
96
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.222.0",
|
|
97
|
+
"@opentelemetry/resources": "^2.11.0",
|
|
98
|
+
"@opentelemetry/sdk-trace-base": "^2.11.0",
|
|
99
|
+
"@opentelemetry/sdk-trace-node": "^2.11.0",
|
|
100
100
|
"axios": "1.18.0",
|
|
101
101
|
"effect": "^3.21.4",
|
|
102
102
|
"typebox": "^1.1.38"
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@changesets/cli": "^2.31.1",
|
|
115
115
|
"@types/node": "24.13.3",
|
|
116
116
|
"@vitest/coverage-v8": "4.1.10",
|
|
117
|
-
"jscpd": "4.
|
|
117
|
+
"jscpd": "4.3.0",
|
|
118
118
|
"typescript": "6.0.3",
|
|
119
119
|
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.4",
|
|
120
120
|
"vite-plus": "0.2.4"
|