@arvo-tools/agentic 1.2.15 → 1.2.17

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 type { InferVersionedArvoContract, SimpleArvoContract, VersionedArvoContract } from 'arvo-core';
2
2
  import type { SimpleArvoContractEmitType } from 'arvo-core/dist/ArvoContract/SimpleArvoContract/types';
3
- import type { AgentToolDefinition } from './Agent/types';
3
+ import type { AgentToolCallContent, AgentToolDefinition } from './Agent/types';
4
4
  import type { AgentInternalTool } from './AgentTool/types';
5
5
  import type { NonEmptyArray, OtelInfoType, PromiseAble } from './types';
6
6
  /**
@@ -57,85 +57,6 @@ export type PermissionManagerContext = {
57
57
  *
58
58
  * Permission managers should be fast on the read path (hot path during tool execution)
59
59
  * and can be slower on the write path (triggered only when authorization changes).
60
- *
61
- * @example
62
- * ```typescript
63
- * const permissionContract = createSimpleArvoContract({
64
- * uri: '#/permissions/tool-access',
65
- * type: 'permission.tool.access',
66
- * domain: 'human.interaction',
67
- * versions: {
68
- * '1.0.0': {
69
- * accepts: z.object({
70
- * agentId: z.string(),
71
- * requestedTools: z.array(z.string()),
72
- * reason: z.string(),
73
- * workflowContext: z.string(),
74
- * }),
75
- * emits: z.object({
76
- * granted: z.array(z.string()),
77
- * denied: z.array(z.string()),
78
- * expiresAt: z.string().datetime().optional(),
79
- * }),
80
- * },
81
- * },
82
- * });
83
- *
84
- * class ToolPermissionManager implements IPermissionManager<typeof permissionContract> {
85
- * public readonly contract = permissionContract.version('1.0.0');
86
- * // public readonly domains = ['human.interaction'];
87
- * public readonly domains = [ArvoDomain.FROM_EVENT_CONTRACT];
88
- * // Both domains are the same
89
- *
90
- * private permissions = new Map<string, Set<string>>();
91
- *
92
- * private getKey(source: PermissionManagerContext): string {
93
- * return `${source.name}:${source.subject}`;
94
- * }
95
- *
96
- * async get(source, tools) {
97
- * const key = this.getKey(source);
98
- * const granted = this.permissions.get(key) ?? new Set();
99
- * return Object.fromEntries(
100
- * tools.map(tool => [
101
- * tool.name,
102
- * granted.has(tool.name) ? 'APPROVED' : 'REQUESTABLE'
103
- * ])
104
- * );
105
- * }
106
- *
107
- * async set(source, event) {
108
- * const key = this.getKey(source);
109
- * const granted = this.permissions.get(key) ?? new Set();
110
- * for (const tool of event.data.granted) {
111
- * granted.add(tool);
112
- * }
113
- * this.permissions.set(key, granted);
114
- * }
115
- *
116
- * async requestBuilder(source, tools) {
117
- * return {
118
- * agentId: source.name,
119
- * requestedTools: tools.map(t => t.name),
120
- * reason: `Agent requires permission: ${tools.map(t => t.name).join(', ')}`,
121
- * workflowContext: source.subject,
122
- * };
123
- * }
124
- * }
125
- *
126
- * const agent = createArvoAgent({
127
- * permissionManager: new ToolPermissionManager(),
128
- * handler: {
129
- * '1.0.0': {
130
- * permissionPolicy: async ({ services }) => [
131
- * services.deleteUser.name,
132
- * services.processRefund.name
133
- * ],
134
- * // ... context and output builders
135
- * }
136
- * }
137
- * });
138
- * ```
139
60
  */
140
61
  export interface IPermissionManager<T extends VersionedArvoContract<SimpleArvoContract<any, any, any>, any> = VersionedArvoContract<SimpleArvoContract<any, any, any>, any>> {
141
62
  /**
@@ -163,8 +84,12 @@ export interface IPermissionManager<T extends VersionedArvoContract<SimpleArvoCo
163
84
  * @param source - Context identifying the agent and workflow for scoped storage
164
85
  * @param event - Authorization response matching contract's success emission schema
165
86
  */
166
- set(source: PermissionManagerContext, event: InferVersionedArvoContract<T>['emits'][SimpleArvoContractEmitType<T['metadata']['rootType']>], config: {
167
- otelInfo: OtelInfoType;
87
+ set(param: {
88
+ source: PermissionManagerContext;
89
+ event: InferVersionedArvoContract<T>['emits'][SimpleArvoContractEmitType<T['metadata']['rootType']>];
90
+ config: {
91
+ otelInfo: OtelInfoType;
92
+ };
168
93
  }): PromiseAble<void>;
169
94
  /**
170
95
  * Checks current authorization status for requested tools.
@@ -179,8 +104,15 @@ export interface IPermissionManager<T extends VersionedArvoContract<SimpleArvoCo
179
104
  * 'DENIED' blocks execution without requesting permission, and 'REQUESTABLE'
180
105
  * blocks execution but triggers a permission request event
181
106
  */
182
- get(source: PermissionManagerContext, tools: AgentToolDefinition<VersionedArvoContract<any, any> | AgentInternalTool | null>[], config: {
183
- otelInfo: OtelInfoType;
107
+ get(param: {
108
+ source: PermissionManagerContext;
109
+ tools: Record<string, {
110
+ definition: AgentToolDefinition<VersionedArvoContract<any, any> | AgentInternalTool | null>;
111
+ requests: Omit<AgentToolCallContent, 'type'>[];
112
+ }>;
113
+ config: {
114
+ otelInfo: OtelInfoType;
115
+ };
184
116
  }): PromiseAble<Record<string, ToolAuthorizationState>>;
185
117
  /**
186
118
  * Constructs permission request event payload for blocked tools.
@@ -195,8 +127,15 @@ export interface IPermissionManager<T extends VersionedArvoContract<SimpleArvoCo
195
127
  * @returns Event payload matching contract's accepts schema. Use agent-oriented
196
128
  * tool names from `tools[i].name` for consistency with permission checks.
197
129
  */
198
- requestBuilder(source: PermissionManagerContext, tools: AgentToolDefinition<VersionedArvoContract<any, any> | AgentInternalTool | null>[], config: {
199
- otelInfo: OtelInfoType;
130
+ requestBuilder(param: {
131
+ source: PermissionManagerContext;
132
+ tools: Record<string, {
133
+ definition: AgentToolDefinition<VersionedArvoContract<any, any> | AgentInternalTool | null>;
134
+ requests: Omit<AgentToolCallContent, 'type'>[];
135
+ }>;
136
+ config: {
137
+ otelInfo: OtelInfoType;
138
+ };
200
139
  }): PromiseAble<InferVersionedArvoContract<T>['accepts']['data']>;
201
140
  /**
202
141
  * Cleanup hook invoked when agent execution completes or fails.
@@ -218,8 +157,11 @@ export interface IPermissionManager<T extends VersionedArvoContract<SimpleArvoCo
218
157
  *
219
158
  * @param source - Context identifying the agent and workflow for cleanup
220
159
  */
221
- cleanup?(source: PermissionManagerContext, config: {
222
- otelInfo: OtelInfoType;
160
+ cleanup?(param: {
161
+ source: PermissionManagerContext;
162
+ config: {
163
+ otelInfo: OtelInfoType;
164
+ };
223
165
  }): PromiseAble<void>;
224
166
  }
225
167
  //# sourceMappingURL=interfaces.permission.manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.permission.manager.d.ts","sourceRoot":"","sources":["../src/interfaces.permission.manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,sDAAsD,CAAC;AACvG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG,QAAQ,GAAG,UAAU,GAAG,aAAa,CAAC;AAE3E;;;;;GAKG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;OAIG;IACH,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AACH,MAAM,WAAW,kBAAkB,CAEjC,CAAC,SAAS,qBAAqB,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,qBAAqB,CAE7F,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAEjC,GAAG,CACJ;IAED;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,CAAC;IAEZ;;;;;;OAMG;IACH,OAAO,EAAE,aAAa,CAAC,MAAM,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vB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arvo-tools/agentic",
3
- "version": "1.2.15",
3
+ "version": "1.2.17",
4
4
  "description": "Agentic toolset for building applications using arvo-core and arvo-event-handler",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,8 +35,8 @@
35
35
  "@arizeai/openinference-semantic-conventions": "2.1.2",
36
36
  "@modelcontextprotocol/sdk": "1.24.3",
37
37
  "@opentelemetry/api": "1.9.0",
38
- "arvo-core": "3.0.27",
39
- "arvo-event-handler": "3.0.27",
38
+ "arvo-core": "3.0.28",
39
+ "arvo-event-handler": "3.0.28",
40
40
  "openai": "6.10.0",
41
41
  "uuid": "11.1.0",
42
42
  "zod": "3.25.76",