@pellux/goodvibes-agent 0.1.18 → 0.1.19
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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/src/tools/wrfc-agent-guard.ts +70 -0
- package/src/version.ts +1 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-agent",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Near-fork GoodVibes operator assistant with the GoodVibes TUI shell, renderer, input, fullscreen workspace, and daemon-connected Agent product brain.",
|
|
6
6
|
"type": "module",
|
|
@@ -85,6 +85,11 @@ const READ_ONLY_STATE_MEMORY_ACTIONS = ['list', 'get'] as const;
|
|
|
85
85
|
const READ_ONLY_STATE_HOOK_ACTIONS = ['list'] as const;
|
|
86
86
|
const READ_ONLY_STATE_MODE_ACTIONS = ['get', 'list'] as const;
|
|
87
87
|
const READ_ONLY_STATE_ANALYTICS_ACTIONS = ['summary', 'query', 'dashboard'] as const;
|
|
88
|
+
const READ_ONLY_TASK_TOOL_MODES = ['list', 'show', 'handoffs'] as const;
|
|
89
|
+
const READ_ONLY_TEAM_TOOL_MODES = ['list', 'show'] as const;
|
|
90
|
+
const READ_ONLY_WORKLIST_TOOL_MODES = ['list', 'show'] as const;
|
|
91
|
+
const READ_ONLY_PACKET_TOOL_MODES = ['list', 'show'] as const;
|
|
92
|
+
const READ_ONLY_QUERY_TOOL_MODES = ['list', 'show'] as const;
|
|
88
93
|
const READ_ONLY_REMOTE_TOOL_MODE_SET = new Set<string>(READ_ONLY_REMOTE_TOOL_MODES);
|
|
89
94
|
const READ_ONLY_CHANNEL_TOOL_MODE_SET = new Set<string>(READ_ONLY_CHANNEL_TOOL_MODES);
|
|
90
95
|
const READ_ONLY_MCP_TOOL_MODE_SET = new Set<string>(READ_ONLY_MCP_TOOL_MODES);
|
|
@@ -94,6 +99,11 @@ const READ_ONLY_STATE_MEMORY_ACTION_SET = new Set<string>(READ_ONLY_STATE_MEMORY
|
|
|
94
99
|
const READ_ONLY_STATE_HOOK_ACTION_SET = new Set<string>(READ_ONLY_STATE_HOOK_ACTIONS);
|
|
95
100
|
const READ_ONLY_STATE_MODE_ACTION_SET = new Set<string>(READ_ONLY_STATE_MODE_ACTIONS);
|
|
96
101
|
const READ_ONLY_STATE_ANALYTICS_ACTION_SET = new Set<string>(READ_ONLY_STATE_ANALYTICS_ACTIONS);
|
|
102
|
+
const READ_ONLY_TASK_TOOL_MODE_SET = new Set<string>(READ_ONLY_TASK_TOOL_MODES);
|
|
103
|
+
const READ_ONLY_TEAM_TOOL_MODE_SET = new Set<string>(READ_ONLY_TEAM_TOOL_MODES);
|
|
104
|
+
const READ_ONLY_WORKLIST_TOOL_MODE_SET = new Set<string>(READ_ONLY_WORKLIST_TOOL_MODES);
|
|
105
|
+
const READ_ONLY_PACKET_TOOL_MODE_SET = new Set<string>(READ_ONLY_PACKET_TOOL_MODES);
|
|
106
|
+
const READ_ONLY_QUERY_TOOL_MODE_SET = new Set<string>(READ_ONLY_QUERY_TOOL_MODES);
|
|
97
107
|
|
|
98
108
|
const LOCAL_AGENT_DENIAL = [
|
|
99
109
|
'GoodVibes Agent does not spawn local Engineer/Reviewer/Tester/Verifier roots or run local WRFC chains.',
|
|
@@ -143,6 +153,12 @@ const STATE_MUTATION_DENIAL = [
|
|
|
143
153
|
'Use Agent-owned memory, skills, personas, routines, and explicit CLI/slash commands for intentional local state changes.',
|
|
144
154
|
].join(' ');
|
|
145
155
|
|
|
156
|
+
const DURABLE_WORKFLOW_MUTATION_DENIAL = [
|
|
157
|
+
'GoodVibes Agent only inspects copied durable workflow tools from the main conversation.',
|
|
158
|
+
'Task, team, worklist, packet, and query creation or lifecycle mutation is disabled here.',
|
|
159
|
+
'Use explicit Agent CLI/slash commands or GoodVibes TUI delegation for intentional workflow changes.',
|
|
160
|
+
].join(' ');
|
|
161
|
+
|
|
146
162
|
export function installAgentToolPolicyGuard(registry: ToolRegistry, options: AgentToolPolicyGuardOptions = {}): void {
|
|
147
163
|
const agentTool = registry.list().find((tool) => tool.definition.name === 'agent');
|
|
148
164
|
if (!agentTool) throw new Error('Agent tool policy guard could not find the agent tool.');
|
|
@@ -176,6 +192,46 @@ export function installAgentToolPolicyGuard(registry: ToolRegistry, options: Age
|
|
|
176
192
|
wrapFetchToolForAgentPolicy(tool);
|
|
177
193
|
} else if (tool.definition.name === 'state') {
|
|
178
194
|
wrapStateToolForAgentPolicy(tool);
|
|
195
|
+
} else if (tool.definition.name === 'task') {
|
|
196
|
+
wrapModeRestrictedToolForAgentPolicy(tool, {
|
|
197
|
+
allowedModes: READ_ONLY_TASK_TOOL_MODES,
|
|
198
|
+
modeSet: READ_ONLY_TASK_TOOL_MODE_SET,
|
|
199
|
+
description: 'Read-only task/workflow inspection for GoodVibes Agent. Task creation, status changes, dependencies, cancellation, and handoff mutation are disabled in the main conversation.',
|
|
200
|
+
denial: DURABLE_WORKFLOW_MUTATION_DENIAL,
|
|
201
|
+
removedProperties: ['title', 'label', 'status', 'dependsOnSessionId', 'dependsOnTaskId', 'reason', 'toSessionId'],
|
|
202
|
+
});
|
|
203
|
+
} else if (tool.definition.name === 'team') {
|
|
204
|
+
wrapModeRestrictedToolForAgentPolicy(tool, {
|
|
205
|
+
allowedModes: READ_ONLY_TEAM_TOOL_MODES,
|
|
206
|
+
modeSet: READ_ONLY_TEAM_TOOL_MODE_SET,
|
|
207
|
+
description: 'Read-only team inspection for GoodVibes Agent. Team creation, membership changes, lane changes, and deletion are disabled in the main conversation.',
|
|
208
|
+
denial: DURABLE_WORKFLOW_MUTATION_DENIAL,
|
|
209
|
+
removedProperties: ['name', 'summary', 'memberId', 'role', 'lanes'],
|
|
210
|
+
});
|
|
211
|
+
} else if (tool.definition.name === 'worklist') {
|
|
212
|
+
wrapModeRestrictedToolForAgentPolicy(tool, {
|
|
213
|
+
allowedModes: READ_ONLY_WORKLIST_TOOL_MODES,
|
|
214
|
+
modeSet: READ_ONLY_WORKLIST_TOOL_MODE_SET,
|
|
215
|
+
description: 'Read-only worklist inspection for GoodVibes Agent. Worklist creation and item lifecycle changes are disabled in the main conversation.',
|
|
216
|
+
denial: DURABLE_WORKFLOW_MUTATION_DENIAL,
|
|
217
|
+
removedProperties: ['title', 'itemId', 'text', 'owner', 'priority'],
|
|
218
|
+
});
|
|
219
|
+
} else if (tool.definition.name === 'packet') {
|
|
220
|
+
wrapModeRestrictedToolForAgentPolicy(tool, {
|
|
221
|
+
allowedModes: READ_ONLY_PACKET_TOOL_MODES,
|
|
222
|
+
modeSet: READ_ONLY_PACKET_TOOL_MODE_SET,
|
|
223
|
+
description: 'Read-only operator packet inspection for GoodVibes Agent. Packet creation, revision, and publishing are disabled in the main conversation.',
|
|
224
|
+
denial: DURABLE_WORKFLOW_MUTATION_DENIAL,
|
|
225
|
+
removedProperties: ['title', 'summary', 'goals', 'constraints', 'risks', 'audience'],
|
|
226
|
+
});
|
|
227
|
+
} else if (tool.definition.name === 'query') {
|
|
228
|
+
wrapModeRestrictedToolForAgentPolicy(tool, {
|
|
229
|
+
allowedModes: READ_ONLY_QUERY_TOOL_MODES,
|
|
230
|
+
modeSet: READ_ONLY_QUERY_TOOL_MODE_SET,
|
|
231
|
+
description: 'Read-only operator query inspection for GoodVibes Agent. Asking, answering, and closing copied workflow queries are disabled in the main conversation.',
|
|
232
|
+
denial: DURABLE_WORKFLOW_MUTATION_DENIAL,
|
|
233
|
+
removedProperties: ['prompt', 'askedBy', 'target', 'answer', 'resolution'],
|
|
234
|
+
});
|
|
179
235
|
} else if (BLOCKED_MAIN_CONVERSATION_TOOL_NAME_SET.has(tool.definition.name)) {
|
|
180
236
|
wrapBlockedMainConversationToolForAgentPolicy(tool);
|
|
181
237
|
}
|
|
@@ -330,10 +386,12 @@ type ModeRestrictedToolPolicy = {
|
|
|
330
386
|
readonly modeSet: ReadonlySet<string>;
|
|
331
387
|
readonly description: string;
|
|
332
388
|
readonly denial: string;
|
|
389
|
+
readonly removedProperties?: readonly string[];
|
|
333
390
|
};
|
|
334
391
|
|
|
335
392
|
export function wrapModeRestrictedToolForAgentPolicy(tool: Tool, policy: ModeRestrictedToolPolicy): void {
|
|
336
393
|
narrowModeToolDefinitionForAgentPolicy(tool, policy.allowedModes, policy.description);
|
|
394
|
+
if (policy.removedProperties) removeToolDefinitionProperties(tool, policy.removedProperties);
|
|
337
395
|
const originalExecute = tool.execute.bind(tool);
|
|
338
396
|
tool.execute = async (args) => {
|
|
339
397
|
const denial = validateModeRestrictedToolInvocationForAgentPolicy(args as ModeToolArgs, policy.modeSet, policy.denial);
|
|
@@ -384,11 +442,17 @@ export const AGENT_READ_ONLY_STATE_MEMORY_ACTIONS = READ_ONLY_STATE_MEMORY_ACTIO
|
|
|
384
442
|
export const AGENT_READ_ONLY_STATE_HOOK_ACTIONS = READ_ONLY_STATE_HOOK_ACTIONS;
|
|
385
443
|
export const AGENT_READ_ONLY_STATE_MODE_ACTIONS = READ_ONLY_STATE_MODE_ACTIONS;
|
|
386
444
|
export const AGENT_READ_ONLY_STATE_ANALYTICS_ACTIONS = READ_ONLY_STATE_ANALYTICS_ACTIONS;
|
|
445
|
+
export const AGENT_READ_ONLY_TASK_TOOL_MODES = READ_ONLY_TASK_TOOL_MODES;
|
|
446
|
+
export const AGENT_READ_ONLY_TEAM_TOOL_MODES = READ_ONLY_TEAM_TOOL_MODES;
|
|
447
|
+
export const AGENT_READ_ONLY_WORKLIST_TOOL_MODES = READ_ONLY_WORKLIST_TOOL_MODES;
|
|
448
|
+
export const AGENT_READ_ONLY_PACKET_TOOL_MODES = READ_ONLY_PACKET_TOOL_MODES;
|
|
449
|
+
export const AGENT_READ_ONLY_QUERY_TOOL_MODES = READ_ONLY_QUERY_TOOL_MODES;
|
|
387
450
|
export const AGENT_REMOTE_MUTATION_DENIAL_MESSAGE = REMOTE_MUTATION_DENIAL;
|
|
388
451
|
export const AGENT_CHANNEL_ACTION_DENIAL_MESSAGE = CHANNEL_ACTION_DENIAL;
|
|
389
452
|
export const AGENT_MCP_SECURITY_MUTATION_DENIAL_MESSAGE = MCP_SECURITY_MUTATION_DENIAL;
|
|
390
453
|
export const AGENT_FETCH_NETWORK_MUTATION_DENIAL_MESSAGE = FETCH_NETWORK_MUTATION_DENIAL;
|
|
391
454
|
export const AGENT_STATE_MUTATION_DENIAL_MESSAGE = STATE_MUTATION_DENIAL;
|
|
455
|
+
export const AGENT_DURABLE_WORKFLOW_MUTATION_DENIAL_MESSAGE = DURABLE_WORKFLOW_MUTATION_DENIAL;
|
|
392
456
|
|
|
393
457
|
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
394
458
|
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
@@ -542,6 +606,12 @@ function narrowModeToolDefinitionForAgentPolicy(tool: Tool, allowedModes: readon
|
|
|
542
606
|
}
|
|
543
607
|
}
|
|
544
608
|
|
|
609
|
+
function removeToolDefinitionProperties(tool: Tool, keys: readonly string[]): void {
|
|
610
|
+
const properties = tool.definition.parameters.properties;
|
|
611
|
+
if (!isRecord(properties)) return;
|
|
612
|
+
for (const key of keys) delete properties[key];
|
|
613
|
+
}
|
|
614
|
+
|
|
545
615
|
function narrowStringEnumProperty(
|
|
546
616
|
properties: Record<string, unknown>,
|
|
547
617
|
key: string,
|
package/src/version.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { join } from 'node:path';
|
|
|
6
6
|
// The prebuild script updates the fallback value before compilation.
|
|
7
7
|
// Uses import.meta.dir (Bun) to locate package.json relative to this file,
|
|
8
8
|
// which is correct regardless of the process working directory.
|
|
9
|
-
let _version = '0.1.
|
|
9
|
+
let _version = '0.1.19';
|
|
10
10
|
let _sdkVersion = '0.33.35';
|
|
11
11
|
try {
|
|
12
12
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', 'package.json'), 'utf-8')) as {
|