@dudousxd/nestjs-agent 1.4.0 → 1.6.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/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
2
2
  import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-CUyVPsa1.cjs';
3
3
  export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, i as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-CUyVPsa1.cjs';
4
- import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
4
+ import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
5
5
  export * from '@dudousxd/nestjs-agent-core';
6
6
  import { Request } from 'express';
7
7
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -152,6 +152,15 @@ declare class AgentService {
152
152
  * thread-scoped mutations.
153
153
  */
154
154
  truncateThreadFrom(actor: Actor, threadId: string, messageId: string): Promise<void>;
155
+ /**
156
+ * Rate a message in one of `actor`'s threads: `'up'`/`'down'` with an optional comment, or `null`
157
+ * to clear the rating. Answers `404` for an unknown message, `403` for another actor's, and `501`
158
+ * on a store without `threadOfMessage` + `setMessageFeedback`.
159
+ */
160
+ setMessageFeedback(actor: Actor, messageId: string, input: {
161
+ value: MessageFeedbackValue | null;
162
+ comment?: string;
163
+ }): Promise<MessageFeedback | null>;
155
164
  /**
156
165
  * Every file this actor has staged, newest first — across threads, including uploads that were
157
166
  * never sent, which nothing else on this surface can see.
@@ -368,6 +377,11 @@ interface AiToolOptions {
368
377
  * ```
369
378
  */
370
379
  presentation?: ToolPresentation;
380
+ /**
381
+ * The turn ends once a call to this tool succeeds — no model call afterwards to narrate what the
382
+ * tool already showed (a composed UI answer, a hand-off). See `ToolSpec.terminal`.
383
+ */
384
+ terminal?: boolean;
371
385
  }
372
386
  /**
373
387
  * Marks a provider class as an AI tool. The class must implement `execute(input, ctx)`.
@@ -663,6 +677,24 @@ declare class SkillsController {
663
677
  threadId?: string): Promise<SkillCatalogEntry[]>;
664
678
  }
665
679
 
680
+ interface FeedbackBody {
681
+ /** `null` clears the rating. */
682
+ value: MessageFeedbackValue | null;
683
+ comment?: string;
684
+ }
685
+ declare class MessagesController {
686
+ private readonly agent;
687
+ private readonly actorResolver;
688
+ constructor(agent: AgentService, actorResolver: ActorResolver);
689
+ /**
690
+ * Rate a message: `{ value: 'up' | 'down' | null, comment? }`. Answers the stored rating
691
+ * (`{ feedback: null }` once cleared). Only the thread's owner may rate its messages.
692
+ */
693
+ feedback(req: Request, id: string, body: FeedbackBody): Promise<{
694
+ feedback: MessageFeedback | null;
695
+ }>;
696
+ }
697
+
666
698
  /**
667
699
  * The tools THIS caller can reach through an agent, with how a chat surface should talk about each
668
700
  * one (`@AiTool({ presentation })`) — so a client narrates "Querying orders" instead of printing
@@ -866,4 +898,4 @@ declare class HeaderActorResolver implements ActorResolver {
866
898
  resolve(req: unknown): Actor;
867
899
  }
868
900
 
869
- export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
901
+ export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, MessagesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { DynamicModule, OnModuleInit, Type, OnApplicationBootstrap } from '@nestjs/common';
2
2
  import { b as AgentModuleOptions, c as AgentModuleAsyncOptions, A as AgentDepsFactory, d as AgentSkillsOptions } from './agent-deps.factory-CUyVPsa1.js';
3
3
  export { e as AGENT_TOOL_BRAND, f as AgentAttachmentsOptions, g as AgentDeps, h as AgentMemoryOptions, a as AgentSurface, F as FunctionalTool, i as delegateToolName, p as provideAgentTool, u as utcDay } from './agent-deps.factory-CUyVPsa1.js';
4
- import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
4
+ import { AgentRunner, AgentStore, QuotaStore, AttachmentStagingStore, Actor, AttachmentRef, PageContext, HumanReply, ThreadSummary, ThreadDetail, UpdateThreadInput, MessageFeedbackValue, MessageFeedback, StagedAttachment, QuotaView, AgentApprovalPort, ActorResolver, MessageAttachment, ToolPresentation, AgentHistoryWindow, AgentIntake, SkillContext, ToolRegistry, AgentRegistry, PromptContributor, SkillsConfig, SkillCatalogEntry, ToolCatalogEntry, MemoryConfig, MemoryDigestEntry, SkillProvider, AgentRunInput, TokenStreamSink, SinkWriter, QuotaState } from '@dudousxd/nestjs-agent-core';
5
5
  export * from '@dudousxd/nestjs-agent-core';
6
6
  import { Request } from 'express';
7
7
  import { StandardSchemaV1 } from '@standard-schema/spec';
@@ -152,6 +152,15 @@ declare class AgentService {
152
152
  * thread-scoped mutations.
153
153
  */
154
154
  truncateThreadFrom(actor: Actor, threadId: string, messageId: string): Promise<void>;
155
+ /**
156
+ * Rate a message in one of `actor`'s threads: `'up'`/`'down'` with an optional comment, or `null`
157
+ * to clear the rating. Answers `404` for an unknown message, `403` for another actor's, and `501`
158
+ * on a store without `threadOfMessage` + `setMessageFeedback`.
159
+ */
160
+ setMessageFeedback(actor: Actor, messageId: string, input: {
161
+ value: MessageFeedbackValue | null;
162
+ comment?: string;
163
+ }): Promise<MessageFeedback | null>;
155
164
  /**
156
165
  * Every file this actor has staged, newest first — across threads, including uploads that were
157
166
  * never sent, which nothing else on this surface can see.
@@ -368,6 +377,11 @@ interface AiToolOptions {
368
377
  * ```
369
378
  */
370
379
  presentation?: ToolPresentation;
380
+ /**
381
+ * The turn ends once a call to this tool succeeds — no model call afterwards to narrate what the
382
+ * tool already showed (a composed UI answer, a hand-off). See `ToolSpec.terminal`.
383
+ */
384
+ terminal?: boolean;
371
385
  }
372
386
  /**
373
387
  * Marks a provider class as an AI tool. The class must implement `execute(input, ctx)`.
@@ -663,6 +677,24 @@ declare class SkillsController {
663
677
  threadId?: string): Promise<SkillCatalogEntry[]>;
664
678
  }
665
679
 
680
+ interface FeedbackBody {
681
+ /** `null` clears the rating. */
682
+ value: MessageFeedbackValue | null;
683
+ comment?: string;
684
+ }
685
+ declare class MessagesController {
686
+ private readonly agent;
687
+ private readonly actorResolver;
688
+ constructor(agent: AgentService, actorResolver: ActorResolver);
689
+ /**
690
+ * Rate a message: `{ value: 'up' | 'down' | null, comment? }`. Answers the stored rating
691
+ * (`{ feedback: null }` once cleared). Only the thread's owner may rate its messages.
692
+ */
693
+ feedback(req: Request, id: string, body: FeedbackBody): Promise<{
694
+ feedback: MessageFeedback | null;
695
+ }>;
696
+ }
697
+
666
698
  /**
667
699
  * The tools THIS caller can reach through an agent, with how a chat surface should talk about each
668
700
  * one (`@AiTool({ presentation })`) — so a client narrates "Querying orders" instead of printing
@@ -866,4 +898,4 @@ declare class HeaderActorResolver implements ActorResolver {
866
898
  resolve(req: unknown): Actor;
867
899
  }
868
900
 
869
- export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };
901
+ export { AGENT_METADATA, AI_TOOL_METADATA, ATTACHMENT_PAGE_SIZE, Agent, AgentApprovalPortAdapter, AgentDepsFactory, AgentDiscoveryService, AgentModule, AgentModuleAsyncOptions, AgentModuleOptions, type AgentOptions, AgentService, AgentSkillsOptions, AiTool, AiToolDiscoveryService, type AiToolOptions, AttachmentsController, type ChatParams, DEFAULT_ALLOWED_ATTACHMENT_CONTENT_TYPES, DEFAULT_MAX_ATTACHMENT_BYTES, type DeclaredSkill, HeaderActorResolver, InProcessTokenStreamSink, InlineAgentRunner, LedgerQuotaStore, MemoriesController, MessagesController, SKILL_METADATA, SYSTEM_PROMPT_CONTRIBUTOR_METADATA, SYSTEM_PROMPT_METADATA, Skill, type SkillBody, SkillDiscoveryService, type SkillOptions, SkillsController, SystemPrompt, SystemPromptContributor, type ThreadDefaultAgentReader, ToolsController, declaredSkillProvider, readAgentMetadata, readAiToolMetadata, readSkillMetadata, resolveSkillsConfig, skillScope };