@dudousxd/nestjs-agent 1.18.0 → 1.19.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.
@@ -1,4 +1,4 @@
1
- import { ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, QuotaProvider, QuotaQuery, QuotaReport, ModelCatalog, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason, Actor } from '@dudousxd/nestjs-agent-core';
1
+ import { ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, QuotaProvider, QuotaQuery, QuotaReport, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason, Actor } from '@dudousxd/nestjs-agent-core';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import { Provider, FactoryProvider, Type, CanActivate, ModuleMetadata, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
4
4
 
@@ -292,6 +292,14 @@ interface AgentModuleOptions {
292
292
  * configured). `action` tools still park on approval regardless.
293
293
  */
294
294
  defaultRoles?: string[];
295
+ /**
296
+ * What an empty roles list means to the default `RolesPolicy`: `'allow'` (default) — no
297
+ * restriction, so a tool that names no roles reaches every resolved actor; `'deny'` — nobody, so a
298
+ * tool needs `roles` (or a non-empty `defaultRoles`) to be reachable. For an app where `[]` means
299
+ * "no one" — a `roles` computed from permissions that can come out empty. Binds
300
+ * `ClosedRolesPolicy`. Ignored when `rolesPolicy` is set.
301
+ */
302
+ emptyRoles?: EmptyRoles;
295
303
  /**
296
304
  * Resolves the acting actor for each request (the identity seam). Omit → the endpoints are public
297
305
  * and every browser is its own anonymous actor (`AnonymousActorResolver`: an `HttpOnly` cookie,
@@ -1,4 +1,4 @@
1
- import { ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, QuotaProvider, QuotaQuery, QuotaReport, ModelCatalog, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason, Actor } from '@dudousxd/nestjs-agent-core';
1
+ import { ModelProvider, AgentStore, ToolRegistry, RolesPolicy, ApprovalPolicy, QuotaStore, TokenStreamSink, PromptBuilder, PromptContributor, ToolTransientRetrySetting, Retriever, AgentPricingStore, HistoryPolicy, InputProcessor, OutputProcessor, AgentIntake, SkillsConfig, MemoryConfig, ToolSpec, ToolHandler, QuotaProvider, QuotaQuery, QuotaReport, ModelCatalog, EmptyRoles, ActorResolver, AgentHistoryWindow, SkillProvider, ScopeResolver, MemoryProvider, AgentRegistry, AttachmentStagingStore, ChatQueueStore, ChatQueueState, AgentRunner, AgentRunInput, AgentStreamEvent, QueuePauseReason, Actor } from '@dudousxd/nestjs-agent-core';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import { Provider, FactoryProvider, Type, CanActivate, ModuleMetadata, InjectionToken, OptionalFactoryDependency } from '@nestjs/common';
4
4
 
@@ -292,6 +292,14 @@ interface AgentModuleOptions {
292
292
  * configured). `action` tools still park on approval regardless.
293
293
  */
294
294
  defaultRoles?: string[];
295
+ /**
296
+ * What an empty roles list means to the default `RolesPolicy`: `'allow'` (default) — no
297
+ * restriction, so a tool that names no roles reaches every resolved actor; `'deny'` — nobody, so a
298
+ * tool needs `roles` (or a non-empty `defaultRoles`) to be reachable. For an app where `[]` means
299
+ * "no one" — a `roles` computed from permissions that can come out empty. Binds
300
+ * `ClosedRolesPolicy`. Ignored when `rolesPolicy` is set.
301
+ */
302
+ emptyRoles?: EmptyRoles;
295
303
  /**
296
304
  * Resolves the acting actor for each request (the identity seam). Omit → the endpoints are public
297
305
  * and every browser is its own anonymous actor (`AnonymousActorResolver`: an `HttpOnly` cookie,
@@ -5770,7 +5770,7 @@ function sharedProviders(durable) {
5770
5770
  },
5771
5771
  {
5772
5772
  provide: import_nestjs_agent_core31.AGENT_ROLES_POLICY,
5773
- useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? new import_nestjs_agent_core31.DefaultRolesPolicy(options.defaultRoles), "useFactory"),
5773
+ useFactory: /* @__PURE__ */ __name((options) => options.rolesPolicy ?? (options.emptyRoles === "deny" ? new import_nestjs_agent_core31.ClosedRolesPolicy(options.defaultRoles) : new import_nestjs_agent_core31.DefaultRolesPolicy(options.defaultRoles)), "useFactory"),
5774
5774
  inject: [
5775
5775
  import_nestjs_agent_core31.AGENT_OPTIONS
5776
5776
  ]