@dudousxd/nestjs-agent-core 0.27.0 → 0.29.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 { M as ModelMessage, A as Actor, d as ToolCallRequest } from './tool-BXKG2xSm.cjs';
1
+ import { M as ModelMessage, A as Actor, d as ToolCallRequest } from './tool-CON4ZOrD.cjs';
2
2
 
3
3
  /**
4
4
  * The two seams that see a turn's traffic to and from the model: an {@link InputProcessor} rewrites
@@ -1,4 +1,4 @@
1
- import { M as ModelMessage, A as Actor, d as ToolCallRequest } from './tool-BXKG2xSm.js';
1
+ import { M as ModelMessage, A as Actor, d as ToolCallRequest } from './tool-CON4ZOrD.js';
2
2
 
3
3
  /**
4
4
  * The two seams that see a turn's traffic to and from the model: an {@link InputProcessor} rewrites
@@ -544,6 +544,17 @@ type AgentStreamEvent = {
544
544
  kind: 'title';
545
545
  title: string;
546
546
  }
547
+ /**
548
+ * Host-defined facts about the message being streamed (the model that answered, how long it took,
549
+ * the error it ended with), merged into the client message's `metadata`. The persisted
550
+ * counterpart is `StoredMessage.metadata`, so a reload reads the same values. The library's own
551
+ * loop never writes it; a runner that is not this library's loop uses it for what its store keeps
552
+ * per message.
553
+ */
554
+ | {
555
+ kind: 'message-metadata';
556
+ metadata: Record<string, unknown>;
557
+ }
547
558
  /**
548
559
  * Someone stopped this run. The stream's LAST frame, written by the runner that settled the
549
560
  * cancel, immediately before a normal `end()` — never a `fail()`, because a cancel is not an
@@ -853,6 +864,11 @@ interface ToolCallRequest {
853
864
  * (defensively treated as `read` wherever a definite value is required).
854
865
  */
855
866
  kind?: ToolKind;
867
+ /**
868
+ * The call this one ran inside (a code-mode `execute`, a delegated agent) — the same `parentId`
869
+ * the live `tool-input-*` frames carried, so a reloaded thread nests the call where the stream did.
870
+ */
871
+ parentId?: string;
856
872
  }
857
873
  /** Result of running a tool. */
858
874
  interface ToolResult {
@@ -1215,6 +1231,13 @@ interface StoredMessage {
1215
1231
  * nobody rated it, or on a store that does not record feedback.
1216
1232
  */
1217
1233
  feedback?: MessageFeedback;
1234
+ /**
1235
+ * Host-defined facts about the message (which model answered, how long it took, the error a turn
1236
+ * ended with, …) — what a runner that is not this library's loop streamed as a
1237
+ * `message-metadata` frame. Replayed into the client message's `metadata`, under the library's
1238
+ * own keys (`usage`, `feedback`, `createdAt` win on a clash). Never read by the library itself.
1239
+ */
1240
+ metadata?: Record<string, unknown>;
1218
1241
  createdAt: string;
1219
1242
  }
1220
1243
  /** A thumbs-up/down on one message, with an optional free-text comment. */
@@ -1250,7 +1273,6 @@ interface ToolCallApproval {
1250
1273
  }
1251
1274
  interface ThreadDetail extends ThreadSummary {
1252
1275
  messages: StoredMessage[];
1253
- activeStreamId?: string;
1254
1276
  }
1255
1277
  type ToolCallStatus = 'auto_executed' | 'pending_approval' | 'executed' | 'rejected' | 'failed'
1256
1278
  /** An approval request lapsed before anyone decided; the tool never ran. */
@@ -1316,6 +1338,36 @@ interface ToolStepEnvelope {
1316
1338
  */
1317
1339
  collectUi?: boolean;
1318
1340
  }
1341
+ /**
1342
+ * What `GET <base>/config` answers — server-side facts a client would otherwise repeat in its own
1343
+ * configuration (and let drift).
1344
+ */
1345
+ interface AgentClientConfig {
1346
+ attachments: AgentAttachmentConfig;
1347
+ /** A model catalog is bound, so `GET <base>/models` lists something to pick. */
1348
+ models: {
1349
+ enabled: boolean;
1350
+ };
1351
+ /** Sends are refused with `429` once `GET <base>/quota` reports `blocked`. */
1352
+ quota: {
1353
+ enforced: boolean;
1354
+ };
1355
+ /** No `actorResolver`: every browser is its own anonymous actor. */
1356
+ identity: {
1357
+ anonymous: boolean;
1358
+ };
1359
+ }
1360
+ /** The attachment rules in force — what the upload route enforces. */
1361
+ interface AgentAttachmentConfig {
1362
+ /** A staging store is bound, so uploads work at all. */
1363
+ enabled: boolean;
1364
+ /** How a client uploads (`null` when `enabled` is false). */
1365
+ upload: 'multipart' | 'resumable' | null;
1366
+ maxBytes: number;
1367
+ allowedContentTypes: readonly string[];
1368
+ /** How many attachments one message may name. */
1369
+ maxPerMessage: number;
1370
+ }
1319
1371
 
1320
1372
  /**
1321
1373
  * Per-invocation context handed to a tool handler. Host-supplied bits are optional. Identity lives
@@ -1411,4 +1463,4 @@ interface ToolDescription {
1411
1463
  inputSchema?: StandardSchemaV1;
1412
1464
  }
1413
1465
 
1414
- export { type ElicitationQuestion as $, type Actor as A, type ToolStepEnvelope as B, ASK_TOOL_DESCRIPTION as C, type DetachedDelivery as D, type ElicitationRequest as E, ASK_TOOL_NAME as F, type AgentApprovalRequest as G, type HumanReply as H, type AgentApprovalSettlement as I, type AgentCatalogEntry as J, type AgentHistoryWindow as K, type LlmStepEnvelope as L, type ModelMessage as M, type AskToolInput as N, DEFAULT_INTAKE_PREAMBLE as O, type PageContext as P, type QuotaState as Q, DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS as R, type StoredMessage as S, type ToolSpec as T, type UsagePurpose as U, DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS as V, ELICITATION_INPUT_TYPES as W, type ElicitationInput as X, type ElicitationInputType as Y, type ElicitationOption as Z, type ElicitationOutcome as _, type ToolHandler as a, type ElicitationReply as a0, type ElicitationResult as a1, type HistoryPolicyContext as a2, type HistorySelection as a3, type HistorySummary as a4, type InvokeWithTransientRetryOptions as a5, MAX_ASK_QUESTIONS as a6, type MessageFeedbackValue as a7, type MessageRole as a8, type PromptContext as a9, validateElicitationAnswer as aA, validateElicitationValue as aB, type QuotaView as aa, type ToolCallApprovalStatus as ab, type ToolCatalogEntry as ac, type ToolConfirmation as ad, type ToolDescription as ae, type ToolPresentationTone as af, type ToolResultField as ag, type ToolResultView as ah, type ToolStepCtx as ai, type ToolTransientRetryNumbers as aj, type ToolTransientRetryOptions as ak, askInputSchema as al, askToolDefinition as am, decodeStreamEvent as an, encodeStreamEvent as ao, invokeWithTransientRetry as ap, isTransientToolError as aq, isTypedQuestion as ar, normalizeElicitationReply as as, questionOptions as at, readElicitationInput as au, readElicitationQuestions as av, renderElicitationAnswers as aw, resolveElicitation as ax, resolveToolTransientRetryNumbers as ay, settleElicitation as az, type ToolPresentation as b, type ToolDefinition as c, type ToolCallRequest as d, type MessageUsage as e, type AgentUiComponent as f, type AiToolCtx as g, type AgentStreamEvent as h, type ThreadSummary as i, type ThreadDetail as j, type ToolResult as k, type MessageAttachment as l, type MessageFeedback as m, type ToolCallStatus as n, type AgentRunInput as o, type ToolKind as p, type ToolCallApproval as q, type HistoryPolicy as r, type AgentDefinition as s, type AgentDelegation as t, type ToolDescribeScope as u, type PromptBuilder as v, type PromptContributor as w, type ToolTransientRetrySetting as x, type AgentIntake as y, type Decision as z };
1466
+ export { type ElicitationOption as $, type Actor as A, type ToolStepEnvelope as B, ASK_TOOL_DESCRIPTION as C, type DetachedDelivery as D, type ElicitationRequest as E, ASK_TOOL_NAME as F, type AgentApprovalRequest as G, type HumanReply as H, type AgentApprovalSettlement as I, type AgentAttachmentConfig as J, type AgentCatalogEntry as K, type LlmStepEnvelope as L, type ModelMessage as M, type AgentClientConfig as N, type AgentHistoryWindow as O, type PageContext as P, type QuotaState as Q, type AskToolInput as R, type StoredMessage as S, type ToolSpec as T, type UsagePurpose as U, DEFAULT_INTAKE_PREAMBLE as V, DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS as W, DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS as X, ELICITATION_INPUT_TYPES as Y, type ElicitationInput as Z, type ElicitationInputType as _, type ToolHandler as a, type ElicitationOutcome as a0, type ElicitationQuestion as a1, type ElicitationReply as a2, type ElicitationResult as a3, type HistoryPolicyContext as a4, type HistorySelection as a5, type HistorySummary as a6, type InvokeWithTransientRetryOptions as a7, MAX_ASK_QUESTIONS as a8, type MessageFeedbackValue as a9, resolveToolTransientRetryNumbers as aA, settleElicitation as aB, validateElicitationAnswer as aC, validateElicitationValue as aD, type MessageRole as aa, type PromptContext as ab, type QuotaView as ac, type ToolCallApprovalStatus as ad, type ToolCatalogEntry as ae, type ToolConfirmation as af, type ToolDescription as ag, type ToolPresentationTone as ah, type ToolResultField as ai, type ToolResultView as aj, type ToolStepCtx as ak, type ToolTransientRetryNumbers as al, type ToolTransientRetryOptions as am, askInputSchema as an, askToolDefinition as ao, decodeStreamEvent as ap, encodeStreamEvent as aq, invokeWithTransientRetry as ar, isTransientToolError as as, isTypedQuestion as at, normalizeElicitationReply as au, questionOptions as av, readElicitationInput as aw, readElicitationQuestions as ax, renderElicitationAnswers as ay, resolveElicitation as az, type ToolPresentation as b, type ToolDefinition as c, type ToolCallRequest as d, type MessageUsage as e, type AgentUiComponent as f, type AiToolCtx as g, type AgentStreamEvent as h, type ThreadSummary as i, type ThreadDetail as j, type ToolResult as k, type MessageAttachment as l, type MessageFeedback as m, type ToolCallStatus as n, type AgentRunInput as o, type ToolKind as p, type ToolCallApproval as q, type HistoryPolicy as r, type AgentDefinition as s, type AgentDelegation as t, type ToolDescribeScope as u, type PromptBuilder as v, type PromptContributor as w, type ToolTransientRetrySetting as x, type AgentIntake as y, type Decision as z };
@@ -544,6 +544,17 @@ type AgentStreamEvent = {
544
544
  kind: 'title';
545
545
  title: string;
546
546
  }
547
+ /**
548
+ * Host-defined facts about the message being streamed (the model that answered, how long it took,
549
+ * the error it ended with), merged into the client message's `metadata`. The persisted
550
+ * counterpart is `StoredMessage.metadata`, so a reload reads the same values. The library's own
551
+ * loop never writes it; a runner that is not this library's loop uses it for what its store keeps
552
+ * per message.
553
+ */
554
+ | {
555
+ kind: 'message-metadata';
556
+ metadata: Record<string, unknown>;
557
+ }
547
558
  /**
548
559
  * Someone stopped this run. The stream's LAST frame, written by the runner that settled the
549
560
  * cancel, immediately before a normal `end()` — never a `fail()`, because a cancel is not an
@@ -853,6 +864,11 @@ interface ToolCallRequest {
853
864
  * (defensively treated as `read` wherever a definite value is required).
854
865
  */
855
866
  kind?: ToolKind;
867
+ /**
868
+ * The call this one ran inside (a code-mode `execute`, a delegated agent) — the same `parentId`
869
+ * the live `tool-input-*` frames carried, so a reloaded thread nests the call where the stream did.
870
+ */
871
+ parentId?: string;
856
872
  }
857
873
  /** Result of running a tool. */
858
874
  interface ToolResult {
@@ -1215,6 +1231,13 @@ interface StoredMessage {
1215
1231
  * nobody rated it, or on a store that does not record feedback.
1216
1232
  */
1217
1233
  feedback?: MessageFeedback;
1234
+ /**
1235
+ * Host-defined facts about the message (which model answered, how long it took, the error a turn
1236
+ * ended with, …) — what a runner that is not this library's loop streamed as a
1237
+ * `message-metadata` frame. Replayed into the client message's `metadata`, under the library's
1238
+ * own keys (`usage`, `feedback`, `createdAt` win on a clash). Never read by the library itself.
1239
+ */
1240
+ metadata?: Record<string, unknown>;
1218
1241
  createdAt: string;
1219
1242
  }
1220
1243
  /** A thumbs-up/down on one message, with an optional free-text comment. */
@@ -1250,7 +1273,6 @@ interface ToolCallApproval {
1250
1273
  }
1251
1274
  interface ThreadDetail extends ThreadSummary {
1252
1275
  messages: StoredMessage[];
1253
- activeStreamId?: string;
1254
1276
  }
1255
1277
  type ToolCallStatus = 'auto_executed' | 'pending_approval' | 'executed' | 'rejected' | 'failed'
1256
1278
  /** An approval request lapsed before anyone decided; the tool never ran. */
@@ -1316,6 +1338,36 @@ interface ToolStepEnvelope {
1316
1338
  */
1317
1339
  collectUi?: boolean;
1318
1340
  }
1341
+ /**
1342
+ * What `GET <base>/config` answers — server-side facts a client would otherwise repeat in its own
1343
+ * configuration (and let drift).
1344
+ */
1345
+ interface AgentClientConfig {
1346
+ attachments: AgentAttachmentConfig;
1347
+ /** A model catalog is bound, so `GET <base>/models` lists something to pick. */
1348
+ models: {
1349
+ enabled: boolean;
1350
+ };
1351
+ /** Sends are refused with `429` once `GET <base>/quota` reports `blocked`. */
1352
+ quota: {
1353
+ enforced: boolean;
1354
+ };
1355
+ /** No `actorResolver`: every browser is its own anonymous actor. */
1356
+ identity: {
1357
+ anonymous: boolean;
1358
+ };
1359
+ }
1360
+ /** The attachment rules in force — what the upload route enforces. */
1361
+ interface AgentAttachmentConfig {
1362
+ /** A staging store is bound, so uploads work at all. */
1363
+ enabled: boolean;
1364
+ /** How a client uploads (`null` when `enabled` is false). */
1365
+ upload: 'multipart' | 'resumable' | null;
1366
+ maxBytes: number;
1367
+ allowedContentTypes: readonly string[];
1368
+ /** How many attachments one message may name. */
1369
+ maxPerMessage: number;
1370
+ }
1319
1371
 
1320
1372
  /**
1321
1373
  * Per-invocation context handed to a tool handler. Host-supplied bits are optional. Identity lives
@@ -1411,4 +1463,4 @@ interface ToolDescription {
1411
1463
  inputSchema?: StandardSchemaV1;
1412
1464
  }
1413
1465
 
1414
- export { type ElicitationQuestion as $, type Actor as A, type ToolStepEnvelope as B, ASK_TOOL_DESCRIPTION as C, type DetachedDelivery as D, type ElicitationRequest as E, ASK_TOOL_NAME as F, type AgentApprovalRequest as G, type HumanReply as H, type AgentApprovalSettlement as I, type AgentCatalogEntry as J, type AgentHistoryWindow as K, type LlmStepEnvelope as L, type ModelMessage as M, type AskToolInput as N, DEFAULT_INTAKE_PREAMBLE as O, type PageContext as P, type QuotaState as Q, DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS as R, type StoredMessage as S, type ToolSpec as T, type UsagePurpose as U, DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS as V, ELICITATION_INPUT_TYPES as W, type ElicitationInput as X, type ElicitationInputType as Y, type ElicitationOption as Z, type ElicitationOutcome as _, type ToolHandler as a, type ElicitationReply as a0, type ElicitationResult as a1, type HistoryPolicyContext as a2, type HistorySelection as a3, type HistorySummary as a4, type InvokeWithTransientRetryOptions as a5, MAX_ASK_QUESTIONS as a6, type MessageFeedbackValue as a7, type MessageRole as a8, type PromptContext as a9, validateElicitationAnswer as aA, validateElicitationValue as aB, type QuotaView as aa, type ToolCallApprovalStatus as ab, type ToolCatalogEntry as ac, type ToolConfirmation as ad, type ToolDescription as ae, type ToolPresentationTone as af, type ToolResultField as ag, type ToolResultView as ah, type ToolStepCtx as ai, type ToolTransientRetryNumbers as aj, type ToolTransientRetryOptions as ak, askInputSchema as al, askToolDefinition as am, decodeStreamEvent as an, encodeStreamEvent as ao, invokeWithTransientRetry as ap, isTransientToolError as aq, isTypedQuestion as ar, normalizeElicitationReply as as, questionOptions as at, readElicitationInput as au, readElicitationQuestions as av, renderElicitationAnswers as aw, resolveElicitation as ax, resolveToolTransientRetryNumbers as ay, settleElicitation as az, type ToolPresentation as b, type ToolDefinition as c, type ToolCallRequest as d, type MessageUsage as e, type AgentUiComponent as f, type AiToolCtx as g, type AgentStreamEvent as h, type ThreadSummary as i, type ThreadDetail as j, type ToolResult as k, type MessageAttachment as l, type MessageFeedback as m, type ToolCallStatus as n, type AgentRunInput as o, type ToolKind as p, type ToolCallApproval as q, type HistoryPolicy as r, type AgentDefinition as s, type AgentDelegation as t, type ToolDescribeScope as u, type PromptBuilder as v, type PromptContributor as w, type ToolTransientRetrySetting as x, type AgentIntake as y, type Decision as z };
1466
+ export { type ElicitationOption as $, type Actor as A, type ToolStepEnvelope as B, ASK_TOOL_DESCRIPTION as C, type DetachedDelivery as D, type ElicitationRequest as E, ASK_TOOL_NAME as F, type AgentApprovalRequest as G, type HumanReply as H, type AgentApprovalSettlement as I, type AgentAttachmentConfig as J, type AgentCatalogEntry as K, type LlmStepEnvelope as L, type ModelMessage as M, type AgentClientConfig as N, type AgentHistoryWindow as O, type PageContext as P, type QuotaState as Q, type AskToolInput as R, type StoredMessage as S, type ToolSpec as T, type UsagePurpose as U, DEFAULT_INTAKE_PREAMBLE as V, DEFAULT_TOOL_TRANSIENT_RETRY_ATTEMPTS as W, DEFAULT_TOOL_TRANSIENT_RETRY_BACKOFF_MS as X, ELICITATION_INPUT_TYPES as Y, type ElicitationInput as Z, type ElicitationInputType as _, type ToolHandler as a, type ElicitationOutcome as a0, type ElicitationQuestion as a1, type ElicitationReply as a2, type ElicitationResult as a3, type HistoryPolicyContext as a4, type HistorySelection as a5, type HistorySummary as a6, type InvokeWithTransientRetryOptions as a7, MAX_ASK_QUESTIONS as a8, type MessageFeedbackValue as a9, resolveToolTransientRetryNumbers as aA, settleElicitation as aB, validateElicitationAnswer as aC, validateElicitationValue as aD, type MessageRole as aa, type PromptContext as ab, type QuotaView as ac, type ToolCallApprovalStatus as ad, type ToolCatalogEntry as ae, type ToolConfirmation as af, type ToolDescription as ag, type ToolPresentationTone as ah, type ToolResultField as ai, type ToolResultView as aj, type ToolStepCtx as ak, type ToolTransientRetryNumbers as al, type ToolTransientRetryOptions as am, askInputSchema as an, askToolDefinition as ao, decodeStreamEvent as ap, encodeStreamEvent as aq, invokeWithTransientRetry as ar, isTransientToolError as as, isTypedQuestion as at, normalizeElicitationReply as au, questionOptions as av, readElicitationInput as aw, readElicitationQuestions as ax, renderElicitationAnswers as ay, resolveElicitation as az, type ToolPresentation as b, type ToolDefinition as c, type ToolCallRequest as d, type MessageUsage as e, type AgentUiComponent as f, type AiToolCtx as g, type AgentStreamEvent as h, type ThreadSummary as i, type ThreadDetail as j, type ToolResult as k, type MessageAttachment as l, type MessageFeedback as m, type ToolCallStatus as n, type AgentRunInput as o, type ToolKind as p, type ToolCallApproval as q, type HistoryPolicy as r, type AgentDefinition as s, type AgentDelegation as t, type ToolDescribeScope as u, type PromptBuilder as v, type PromptContributor as w, type ToolTransientRetrySetting as x, type AgentIntake as y, type Decision as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dudousxd/nestjs-agent-core",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/DavideCarvalho/nestjs-agent.git",