@dotcms/ai 26.8.13-1 → 26.8.14-1-next.2533

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.
@@ -12,6 +12,7 @@ export interface SiteSummary {
12
12
  hostname: string;
13
13
  isDefault: boolean;
14
14
  archived: boolean;
15
+ live: boolean;
15
16
  }
16
17
  export interface LanguageSummary {
17
18
  id: number;
package/src/runtime.d.ts CHANGED
@@ -65,6 +65,8 @@ export type { AdapterContext, AdapterDef, AdapterMethodDef, DefinedAdapter } fro
65
65
  export { DotCMSError, ValidationError, PolicyError, HttpError, TimeoutError, AbortError, SandboxError, RuntimeError, isDotCMSError, serializeError } from './sandbox/errors';
66
66
  export type { DotCMSErrorCode, SerializedDotCMSError } from './sandbox/errors';
67
67
  export type { SandboxResult, SandboxResultError } from './sandbox/types';
68
+ export { formatSandboxResult } from './sandbox/format-result';
69
+ export type { FormatSandboxResultOptions } from './sandbox/format-result';
68
70
  export { isBinaryResponseEnvelope } from './adapter/request-core';
69
71
  export type { BinaryResponseEnvelope, RequestOptions, RequestCallEvent } from './adapter/request-core';
70
72
  export type { DotCMSContext, ContentTypeSummary, SiteSummary, LanguageSummary, CurrentUserSummary } from './adapter/context';
@@ -0,0 +1,18 @@
1
+ import type { SandboxResult } from './types';
2
+ export interface FormatSandboxResultOptions {
3
+ /** Hard cap on the returned string (chars). Default {@link DEFAULT_MAX_CHARS}. */
4
+ maxChars?: number;
5
+ /** Tool-specific guidance appended inside the truncation notice. */
6
+ truncationHint?: string;
7
+ }
8
+ /**
9
+ * Render a {@link SandboxResult} into the single string a tool hands back to the model, and
10
+ * hard-cap its length so one query can't flood the context window.
11
+ *
12
+ * There is NO truncation anywhere else on the result path — whatever the model's code returns is
13
+ * stringified whole. This is the one place that bounds it. The cap is applied to the final
14
+ * combined string in BOTH the success and error branches (an `HttpError` body embedded in an
15
+ * error message can itself be huge). On truncation, a clear notice explains the cut and tells the
16
+ * model how to narrow the query rather than silently dropping data.
17
+ */
18
+ export declare function formatSandboxResult(result: SandboxResult, options?: FormatSandboxResultOptions): string;
@@ -9,6 +9,8 @@ export { Executor, createExecutor } from './executor';
9
9
  export type { ExecutorOptions } from './executor';
10
10
  export { createWorkerSandbox } from './factory';
11
11
  export type { ISandbox, SandboxFactory } from './interface';
12
+ export { formatSandboxResult } from './format-result';
13
+ export type { FormatSandboxResultOptions } from './format-result';
12
14
  export { defineAdapter, isDefinedAdapter, describeAdapterForLLM } from './define-adapter';
13
15
  export type { AdapterContext, AdapterDef, AdapterMethodDef, DefinedAdapter, RequestLike } from './define-adapter';
14
16
  export { DotCMSError, ValidationError, PolicyError, HttpError, TimeoutError, AbortError, SandboxError, RuntimeError, isDotCMSError, serializeError } from './errors';
@@ -35,7 +37,7 @@ export interface Sandbox {
35
37
  run<T = unknown>(code: string): Promise<SandboxResult<T>>;
36
38
  }
37
39
  /**
38
- * Create a sandbox over a set of adapters — the generic entry point shown in §6.2.
40
+ * Create a sandbox over a set of adapters — the generic entry point.
39
41
  *
40
42
  * `defineAdapter` results are bound to the injected host `request` (and a per-run abort
41
43
  * signal) via `withContext`; plain hand-built adapters are passed through untouched. Each