@heroui/agent 1.0.0-beta.2 → 1.0.0-beta.5
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/CHANGELOG.md +19 -0
- package/README.md +119 -68
- package/dist/chunk-6O4WPQKO.js +1 -0
- package/dist/chunk-7OTMWVOC.js +1 -0
- package/dist/chunk-KGJ6UDTY.js +1 -0
- package/dist/chunk-PKCBDTYR.js +1 -0
- package/dist/chunk-PX3X4VP2.js +1 -0
- package/dist/chunk-SWO2ABN5.js +1 -0
- package/dist/client-tools-manifest-62CRLCZY.js +1 -0
- package/dist/css/index.css +1 -2
- package/dist/index.d.ts +9 -676
- package/dist/index.js +1 -1
- package/dist/internal/host.d.ts +108 -0
- package/dist/internal/host.js +1 -0
- package/dist/internal/shared.d.ts +63 -0
- package/dist/internal/shared.js +1 -0
- package/dist/next.d.ts +3 -4
- package/dist/next.js +1 -1
- package/dist/persistence-YI6JSYCT.js +1 -0
- package/dist/server.d.ts +21 -2
- package/dist/server.js +1 -1
- package/dist/types-BdAn3HPv.d.ts +667 -0
- package/dist/version-CIfRqjWe.d.ts +5 -0
- package/package.json +19 -35
- package/dist/chart-content-YGW25P3Z.js +0 -1
- package/dist/chunk-4JEZZR5J.js +0 -1
- package/dist/chunk-64RI74L5.js +0 -1
- package/dist/chunk-6ZJJN322.js +0 -1
- package/dist/chunk-7CUSOLDM.js +0 -5
- package/dist/chunk-7KCGPNEN.js +0 -1
- package/dist/chunk-CLHBM3HQ.js +0 -1
- package/dist/chunk-CN4UQBKO.js +0 -2
- package/dist/chunk-CR3H7AVI.js +0 -1
- package/dist/chunk-FOK4MNBE.js +0 -2
- package/dist/chunk-HCLXS4HQ.js +0 -1
- package/dist/chunk-KQTLIOZ3.js +0 -1
- package/dist/chunk-M22IGTLZ.js +0 -1
- package/dist/chunk-MXXCR5SR.js +0 -1
- package/dist/chunk-OA7E6MEQ.js +0 -1
- package/dist/chunk-PZJ4NC3J.js +0 -1
- package/dist/chunk-RNNGE7KM.js +0 -1
- package/dist/chunk-UHHKMESI.js +0 -1
- package/dist/component-renderer-KWBZJPBV.js +0 -1
- package/dist/composer-draft-NSKK65F3.js +0 -1
- package/dist/composer-image-draft-KAGTNQR7.js +0 -1
- package/dist/contracts.d.ts +0 -1654
- package/dist/contracts.js +0 -2
- package/dist/embed-runtime-CLCMDESV.js +0 -5
- package/dist/identity-CAJPsGqJ.d.ts +0 -101
- package/dist/interactive-map-surface-WC2LPCR7.js +0 -1
- package/dist/internal/client-tools.js +0 -1
- package/dist/internal/models.js +0 -1
- package/dist/internal/runtime.js +0 -1
- package/dist/internal/theme.js +0 -1
- package/dist/model-picker-BSJRGXGB.js +0 -1
- package/dist/shell-permission-picker-KIC3VEYJ.js +0 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a,b as m}from"./chunk-
|
|
1
|
+
import{a as d,b as e,c as f,d as g,e as h,f as i,g as j,h as k,i as l,j as m}from"./chunk-PX3X4VP2.js";import"./chunk-6O4WPQKO.js";import{a as n,b as o,c as p,d as q,e as r,f as s,g as t,h as u,i as v,j as w}from"./chunk-7OTMWVOC.js";import{a as b,b as c}from"./chunk-KGJ6UDTY.js";import{a}from"./chunk-SWO2ABN5.js";export{m as AGENT_DESIGN_THEMES,f as AGENT_MODEL_IDS,j as AGENT_MODEL_OPTIONS,i as DEFAULT_AGENT_PICKER_MODEL_ID,n as DEFAULT_MARKDOWN_ANIMATION,c as HEROUI_AGENT_API_BASE_URL,s as HEROUI_AGENT_ATTACHMENT_ACCEPT,r as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES,t as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION,q as HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE,p as HEROUI_AGENT_ATTACHMENT_MAX_BYTES,o as HEROUI_AGENT_MAX_ATTACHMENTS,b as HEROUI_AGENT_SDK_VERSION,u as HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES,e as HeroUIAgent,g as LEGACY_AGENT_MODEL_IDS,a as createToolHelper,l as getAgentModelTier,k as isAgentModelId,v as isHeroUIAgentAttachmentContentType,h as resolveAgentModelId,w as resolveHeroUIAgentAttachmentContentType,d as useAgent};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { R as ClientToolIcon, l as AgentController, a3 as HeroUIAgentProps, P as ClientTool, V as GetAuthToken } from '../types-BdAn3HPv.js';
|
|
2
|
+
export { aa as parseClientToolArgs, ac as resolveDirectToolAction } from '../types-BdAn3HPv.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
declare const HEROUI_AGENT_HOSTED_ORIGIN: "https://agent.heroui.pro";
|
|
6
|
+
declare const HEROUI_AGENT_HOSTED_STAGING_ORIGIN: "https://staging-agent.heroui.pro";
|
|
7
|
+
declare const HEROUI_AGENT_BRIDGE_MAX_MESSAGE_BYTES: number;
|
|
8
|
+
declare const HEROUI_AGENT_BRIDGE_MAX_PERSISTENCE_BYTES: number;
|
|
9
|
+
type AgentBridgeJsonValue = boolean | null | number | string | AgentBridgeJsonValue[] | {
|
|
10
|
+
[key: string]: AgentBridgeJsonValue;
|
|
11
|
+
};
|
|
12
|
+
type HostedAgentToolManifest = {
|
|
13
|
+
description: string;
|
|
14
|
+
displayName?: string;
|
|
15
|
+
icon?: ClientToolIcon;
|
|
16
|
+
iconColor?: string;
|
|
17
|
+
inputSchema: Record<string, unknown>;
|
|
18
|
+
name: string;
|
|
19
|
+
needsApproval?: boolean;
|
|
20
|
+
};
|
|
21
|
+
type AgentBridgeEnvelope = {
|
|
22
|
+
nonce: string;
|
|
23
|
+
payload?: unknown;
|
|
24
|
+
requestId: string;
|
|
25
|
+
sessionId: string;
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
declare function createAgentBridgeEnvelope(sessionId: string, nonce: string, type: string, payload?: unknown, requestId?: string): AgentBridgeEnvelope;
|
|
29
|
+
declare function parseAgentBridgeEnvelope(value: unknown): AgentBridgeEnvelope | null;
|
|
30
|
+
declare function isAgentBridgeJsonValue(value: unknown, seen?: Set<object>): value is AgentBridgeJsonValue;
|
|
31
|
+
declare function estimateAgentBridgeMessageBytes(value: unknown): number;
|
|
32
|
+
|
|
33
|
+
type AgentHostController = AgentController & {
|
|
34
|
+
destroy: () => void;
|
|
35
|
+
subscribe: (listener: () => void) => () => void;
|
|
36
|
+
update: (options: HeroUIAgentProps) => void;
|
|
37
|
+
};
|
|
38
|
+
type ClientToolManifestSerializer = (tools: ClientTool[]) => HostedAgentToolManifest[] | Promise<HostedAgentToolManifest[]>;
|
|
39
|
+
declare function mountAgent(initialOptions: HeroUIAgentProps, serializeTools: ClientToolManifestSerializer): AgentHostController;
|
|
40
|
+
|
|
41
|
+
type HostedFrameBounds = {
|
|
42
|
+
bottom: number;
|
|
43
|
+
left: number;
|
|
44
|
+
right: number;
|
|
45
|
+
top: number;
|
|
46
|
+
};
|
|
47
|
+
type HostedFrameState = {
|
|
48
|
+
bounds: HostedFrameBounds | null;
|
|
49
|
+
closing: boolean;
|
|
50
|
+
dragging: boolean;
|
|
51
|
+
expanded: boolean;
|
|
52
|
+
mounted: boolean;
|
|
53
|
+
open: boolean;
|
|
54
|
+
overlayOpen: boolean;
|
|
55
|
+
ready: boolean;
|
|
56
|
+
resizing: boolean;
|
|
57
|
+
sidebarWidth: number | null;
|
|
58
|
+
viewMode: "floating" | "sidebar";
|
|
59
|
+
};
|
|
60
|
+
type HostPageLayout = {
|
|
61
|
+
active: boolean;
|
|
62
|
+
body: HTMLElement;
|
|
63
|
+
original: {
|
|
64
|
+
bodyLeft: string;
|
|
65
|
+
bodyOverflow: string;
|
|
66
|
+
bodyPosition: string;
|
|
67
|
+
bodyRight: string;
|
|
68
|
+
bodyTop: string;
|
|
69
|
+
bodyWidth: string;
|
|
70
|
+
rootMarginRight: string;
|
|
71
|
+
rootOverflow: string;
|
|
72
|
+
rootTransition: string;
|
|
73
|
+
};
|
|
74
|
+
root: HTMLElement;
|
|
75
|
+
scrollLock: {
|
|
76
|
+
x: number;
|
|
77
|
+
y: number;
|
|
78
|
+
} | null;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Requests a short-lived HeroUI Agent credential through the host
|
|
83
|
+
* application's server callback. Refresh and request de-duplication are
|
|
84
|
+
* handled here while the project API key remains server-only.
|
|
85
|
+
*/
|
|
86
|
+
declare class EmbedSessionManager {
|
|
87
|
+
private readonly agentId;
|
|
88
|
+
private readonly getAuthToken;
|
|
89
|
+
private cached;
|
|
90
|
+
private failure;
|
|
91
|
+
private generation;
|
|
92
|
+
private pending;
|
|
93
|
+
constructor(agentId: string, getAuthToken: GetAuthToken);
|
|
94
|
+
clear(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Forgets both the cached credential and the browser's anonymous id, so the
|
|
97
|
+
* next request represents a brand-new person. Used on logout to stop a
|
|
98
|
+
* shared device from attributing the next visitor to the previous user.
|
|
99
|
+
*/
|
|
100
|
+
reset(): void;
|
|
101
|
+
get(): Promise<string>;
|
|
102
|
+
subjectHash(): Promise<string>;
|
|
103
|
+
private anonymousId;
|
|
104
|
+
private expiresAt;
|
|
105
|
+
private refresh;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { type AgentBridgeEnvelope, type AgentBridgeJsonValue, type AgentHostController, type ClientToolManifestSerializer, EmbedSessionManager, HEROUI_AGENT_BRIDGE_MAX_MESSAGE_BYTES, HEROUI_AGENT_BRIDGE_MAX_PERSISTENCE_BYTES, HEROUI_AGENT_HOSTED_ORIGIN, HEROUI_AGENT_HOSTED_STAGING_ORIGIN, type HostPageLayout, type HostedAgentToolManifest, type HostedFrameState, createAgentBridgeEnvelope, estimateAgentBridgeMessageBytes, isAgentBridgeJsonValue, mountAgent, parseAgentBridgeEnvelope };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t,b as r}from"../chunk-6O4WPQKO.js";import"../chunk-KGJ6UDTY.js";import{c as o,d as e,e as s,f as a,g as l,h as n,i as m,j as p,k as i,l as f}from"../chunk-SWO2ABN5.js";export{t as EmbedSessionManager,l as HEROUI_AGENT_BRIDGE_MAX_MESSAGE_BYTES,n as HEROUI_AGENT_BRIDGE_MAX_PERSISTENCE_BYTES,s as HEROUI_AGENT_HOSTED_ORIGIN,a as HEROUI_AGENT_HOSTED_STAGING_ORIGIN,m as createAgentBridgeEnvelope,f as estimateAgentBridgeMessageBytes,i as isAgentBridgeJsonValue,r as mountAgent,p as parseAgentBridgeEnvelope,o as parseClientToolArgs,e as resolveDirectToolAction};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { P as ClientTool } from '../types-BdAn3HPv.js';
|
|
2
|
+
export { U as DEFAULT_MARKDOWN_ANIMATION, X as HEROUI_AGENT_ATTACHMENT_ACCEPT, Y as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES, a9 as isHeroUIAgentAttachmentContentType } from '../types-BdAn3HPv.js';
|
|
3
|
+
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from '../version-CIfRqjWe.js';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import 'react';
|
|
6
|
+
|
|
7
|
+
declare const agentIdentityIdSchema: z.ZodString;
|
|
8
|
+
declare const agentAuthIdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
type: z.ZodLiteral<"anonymous">;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
type: z.ZodLiteral<"user">;
|
|
14
|
+
}, z.core.$strip>], "type">;
|
|
15
|
+
declare const agentAuthProfileSchema: z.ZodObject<{
|
|
16
|
+
avatarUrl: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodURL>>;
|
|
17
|
+
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
|
|
18
|
+
name: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
declare const createAgentAuthTokenRequestSchema: z.ZodObject<{
|
|
21
|
+
anonymousId: z.ZodOptional<z.ZodString>;
|
|
22
|
+
identity: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
23
|
+
id: z.ZodString;
|
|
24
|
+
type: z.ZodLiteral<"anonymous">;
|
|
25
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
type: z.ZodLiteral<"user">;
|
|
28
|
+
}, z.core.$strip>], "type">;
|
|
29
|
+
profile: z.ZodOptional<z.ZodObject<{
|
|
30
|
+
avatarUrl: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodURL>>;
|
|
31
|
+
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
|
|
32
|
+
name: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
declare const agentAuthTokenSchema: z.ZodObject<{
|
|
36
|
+
expiresAt: z.ZodNumber;
|
|
37
|
+
token: z.ZodString;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type AgentAuthIdentity = z.infer<typeof agentAuthIdentitySchema>;
|
|
40
|
+
type AgentAuthProfile = z.infer<typeof agentAuthProfileSchema>;
|
|
41
|
+
type AgentAuthToken = z.infer<typeof agentAuthTokenSchema>;
|
|
42
|
+
type CreateAgentAuthTokenRequest = z.infer<typeof createAgentAuthTokenRequestSchema>;
|
|
43
|
+
|
|
44
|
+
declare const RESERVED_AGENT_TOOL_NAMES: readonly ["callMcpTool", "composeUI", "executeSandbox", "generateFile", "getComponentSchema", "renderComponent", "searchKnowledge", "searchMcpTools", "searchWeb"];
|
|
45
|
+
declare const RESERVED_AGENT_TOOL_PREFIX = "mcp_";
|
|
46
|
+
declare const MAX_CLIENT_TOOLS = 20;
|
|
47
|
+
declare const MAX_CLIENT_TOOLS_BYTES: number;
|
|
48
|
+
declare const clientToolManifestEntrySchema: z.ZodObject<{
|
|
49
|
+
description: z.ZodString;
|
|
50
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
51
|
+
name: z.ZodString;
|
|
52
|
+
needsApproval: z.ZodOptional<z.ZodBoolean>;
|
|
53
|
+
}, z.core.$strip>;
|
|
54
|
+
declare const clientToolsSchema: z.ZodArray<z.ZodObject<{
|
|
55
|
+
description: z.ZodString;
|
|
56
|
+
inputSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
name: z.ZodString;
|
|
58
|
+
needsApproval: z.ZodOptional<z.ZodBoolean>;
|
|
59
|
+
}, z.core.$strip>>;
|
|
60
|
+
type ClientToolManifestEntry = z.infer<typeof clientToolManifestEntrySchema>;
|
|
61
|
+
declare function serializeClientTools(tools: ClientTool[]): ClientToolManifestEntry[];
|
|
62
|
+
|
|
63
|
+
export { type AgentAuthIdentity, type AgentAuthProfile, type AgentAuthToken, type ClientToolManifestEntry, type CreateAgentAuthTokenRequest, MAX_CLIENT_TOOLS, MAX_CLIENT_TOOLS_BYTES, RESERVED_AGENT_TOOL_NAMES, RESERVED_AGENT_TOOL_PREFIX, agentAuthIdentitySchema, agentAuthProfileSchema, agentAuthTokenSchema, agentIdentityIdSchema, clientToolManifestEntrySchema, clientToolsSchema, createAgentAuthTokenRequestSchema, serializeClientTools };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u,e as E,f as l,i as _}from"../chunk-7OTMWVOC.js";import{a as r,b as a}from"../chunk-KGJ6UDTY.js";import{a as A,b as m,c as p,d as T,e as s,f as c,g as h}from"../chunk-PKCBDTYR.js";import"../chunk-SWO2ABN5.js";import{z as e}from"zod";var g=new Set(["[object object]","0","anonymous","distinct_id","distinctid","email","false","guest","id","nan","none","not_authenticated","null","true","undefined"]),t=e.string().trim().min(1).max(200).refine(i=>!g.has(i.toLowerCase()),{message:"Identity id is reserved"}),n=e.discriminatedUnion("type",[e.object({id:t,type:e.literal("anonymous")}),e.object({id:t,type:e.literal("user")})]),o=e.object({avatarUrl:e.string().trim().pipe(e.url()).optional(),email:e.string().trim().max(320).pipe(e.email()).optional(),name:e.string().trim().max(120).optional()}),S=e.object({anonymousId:t.optional(),identity:n,profile:o.optional()}),f=e.object({expiresAt:e.number().int().positive(),token:e.string().trim().min(1)});export{u as DEFAULT_MARKDOWN_ANIMATION,a as HEROUI_AGENT_API_BASE_URL,l as HEROUI_AGENT_ATTACHMENT_ACCEPT,E as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES,r as HEROUI_AGENT_SDK_VERSION,p as MAX_CLIENT_TOOLS,T as MAX_CLIENT_TOOLS_BYTES,A as RESERVED_AGENT_TOOL_NAMES,m as RESERVED_AGENT_TOOL_PREFIX,n as agentAuthIdentitySchema,o as agentAuthProfileSchema,f as agentAuthTokenSchema,t as agentIdentityIdSchema,s as clientToolManifestEntrySchema,c as clientToolsSchema,S as createAgentAuthTokenRequestSchema,_ as isHeroUIAgentAttachmentContentType,h as serializeClientTools};
|
package/dist/next.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { AGENT_MODEL_IDS, AGENT_MODEL_OPTIONS,
|
|
1
|
+
export { A as AGENT_DESIGN_THEMES, a as AGENT_MODEL_IDS, b as AGENT_MODEL_OPTIONS, c as AgentApiOverrides, d as AgentAppearance, e as AgentAttachmentContentType, f as AgentAuthToken, g as AgentCapabilities, h as AgentColorScheme, i as AgentComponentExportFormat, j as AgentComposerOptions, k as AgentContext, l as AgentController, m as AgentDataSource, n as AgentDataSourceFormat, o as AgentDesignTheme, p as AgentFeedbackReason, q as AgentLauncherOptions, r as AgentLauncherPosition, s as AgentMarkdownAnimation, t as AgentMarkdownAnimationOptions, u as AgentMarkdownCaret, v as AgentMarkdownOptions, w as AgentMessageAction, x as AgentModelId, y as AgentModelOption, z as AgentModelTier, B as AgentPanelOptions, C as AgentPermissionMode, D as AgentPermissionOptions, E as AgentRadius, F as AgentResponseFeedback, G as AgentSharedContext, H as AgentShouldCloseOnInteractOutside, I as AgentStartScreenOptions, J as AgentSurfaceVariant, K as AgentThemeColor, L as AgentThemeColors, M as AgentThemeOptions, N as AgentTypography, O as AgentViewMode, P as ClientTool, Q as ClientToolExecutionContext, R as ClientToolIcon, S as ClientToolStatus, T as DEFAULT_AGENT_PICKER_MODEL_ID, U as DEFAULT_MARKDOWN_ANIMATION, V as GetAuthToken, W as GetAuthTokenContext, X as HEROUI_AGENT_ATTACHMENT_ACCEPT, Y as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES, Z as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION, _ as HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE, $ as HEROUI_AGENT_ATTACHMENT_MAX_BYTES, a0 as HEROUI_AGENT_MAX_ATTACHMENTS, a1 as HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES, a2 as HeroUIAgentAttachmentContentType, a3 as HeroUIAgentProps, a4 as LEGACY_AGENT_MODEL_IDS, a5 as UploadAgentDataSourceInput, a6 as createToolHelper, a7 as getAgentModelTier, a8 as isAgentModelId, a9 as isHeroUIAgentAttachmentContentType, ab as resolveAgentModelId, ad as resolveHeroUIAgentAttachmentContentType } from './types-BdAn3HPv.js';
|
|
2
|
+
export { HeroUIAgent, useAgent } from './index.js';
|
|
3
|
+
export { H as HEROUI_AGENT_API_BASE_URL, a as HEROUI_AGENT_SDK_VERSION } from './version-CIfRqjWe.js';
|
|
2
4
|
import 'react';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'zod';
|
|
5
|
-
import 'streamdown';
|
package/dist/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as f,b as m,c as p,d as t,e as x,f as a,g as b,h as c,i as d,j as g}from"./chunk-PX3X4VP2.js";import"./chunk-6O4WPQKO.js";import{a as h,b as i,c as j,d as k,e as l,f as n,g as q,h as s,i as u,j as v}from"./chunk-7OTMWVOC.js";import{a as r,b as e}from"./chunk-KGJ6UDTY.js";import{a as o}from"./chunk-SWO2ABN5.js";export{g as AGENT_DESIGN_THEMES,p as AGENT_MODEL_IDS,b as AGENT_MODEL_OPTIONS,a as DEFAULT_AGENT_PICKER_MODEL_ID,h as DEFAULT_MARKDOWN_ANIMATION,e as HEROUI_AGENT_API_BASE_URL,n as HEROUI_AGENT_ATTACHMENT_ACCEPT,l as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPES,q as HEROUI_AGENT_ATTACHMENT_CONTENT_TYPE_BY_EXTENSION,k as HEROUI_AGENT_ATTACHMENT_EXTENSION_BY_CONTENT_TYPE,j as HEROUI_AGENT_ATTACHMENT_MAX_BYTES,i as HEROUI_AGENT_MAX_ATTACHMENTS,r as HEROUI_AGENT_SDK_VERSION,s as HEROUI_AGENT_TEXT_ATTACHMENT_CONTENT_TYPES,m as HeroUIAgent,t as LEGACY_AGENT_MODEL_IDS,o as createToolHelper,d as getAgentModelTier,c as isAgentModelId,u as isHeroUIAgentAttachmentContentType,x as resolveAgentModelId,v as resolveHeroUIAgentAttachmentContentType,f as useAgent};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var d="heroui-agent-host-storage";var s="records";async function k(r,t){let e=f(t),o=await w();if(!o){if(e.operation==="get")return null;throw new Error("Durable HeroUI Agent storage is unavailable")}try{if(e.operation==="deletePrefix")return await g(o,l(r,e.store,e.prefix)),null;let n=l(r,e.store,e.key),i=o.transaction(s,e.operation==="get"?"readonly":"readwrite"),a=i.objectStore(s);if(e.operation==="get"){let p=await P(a.get(n));return await u(i),p?.value??null}return e.operation==="put"?a.put({id:n,value:e.value}):a.delete(n),await u(i),null}finally{o.close()}}function f(r){if(!r||typeof r!="object")throw new Error("Invalid persistence request");let t=r,e=t.store;if(e!=="composer-image-drafts"&&e!=="message-outboxes")throw new Error("Invalid persistence store");if(t.operation==="deletePrefix"){if(!c(t.prefix))throw new Error("Invalid persistence prefix");return{operation:"deletePrefix",prefix:t.prefix,store:e}}if(t.operation!=="delete"&&t.operation!=="get"&&t.operation!=="put"||!c(t.key))throw new Error("Invalid persistence request");return t.operation==="put"?{key:t.key,operation:"put",store:e,value:t.value}:{key:t.key,operation:t.operation,store:e}}function c(r){return typeof r=="string"&&r.length>0&&r.length<=2048}function l(r,t,e){return`${r}:${t}:${e}`}function w(){return typeof indexedDB>"u"?Promise.resolve(null):new Promise((r,t)=>{let e=indexedDB.open(d,1);e.onerror=()=>t(e.error??new Error("Unable to open Agent storage")),e.onupgradeneeded=()=>{e.result.objectStoreNames.contains(s)||e.result.createObjectStore(s,{keyPath:"id"})},e.onsuccess=()=>r(e.result)})}function g(r,t){let e=r.transaction(s,"readwrite"),o=e.objectStore(s).openCursor();return o.onsuccess=()=>{let n=o.result;n&&(typeof n.key=="string"&&n.key.startsWith(t)&&n.delete(),n.continue())},u(e)}function P(r){return new Promise((t,e)=>{r.onerror=()=>e(r.error??new Error("Agent storage request failed")),r.onsuccess=()=>t(r.result)})}function u(r){return new Promise((t,e)=>{r.onabort=()=>e(r.error??new Error("Agent storage write aborted")),r.onerror=()=>e(r.error??new Error("Agent storage transaction failed")),r.oncomplete=()=>t()})}export{k as executeAgentHostPersistence};
|
package/dist/server.d.ts
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
declare const agentAuthIdentitySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4
|
+
id: z.ZodString;
|
|
5
|
+
type: z.ZodLiteral<"anonymous">;
|
|
6
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
type: z.ZodLiteral<"user">;
|
|
9
|
+
}, z.core.$strip>], "type">;
|
|
10
|
+
declare const agentAuthProfileSchema: z.ZodObject<{
|
|
11
|
+
avatarUrl: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodURL>>;
|
|
12
|
+
email: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodEmail>>;
|
|
13
|
+
name: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
declare const agentAuthTokenSchema: z.ZodObject<{
|
|
16
|
+
expiresAt: z.ZodNumber;
|
|
17
|
+
token: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
type AgentAuthIdentity = z.infer<typeof agentAuthIdentitySchema>;
|
|
20
|
+
type AgentAuthProfile = z.infer<typeof agentAuthProfileSchema>;
|
|
21
|
+
type AgentAuthToken = z.infer<typeof agentAuthTokenSchema>;
|
|
3
22
|
|
|
4
23
|
type CreateAuthTokenOptions = {
|
|
5
24
|
/**
|
package/dist/server.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as t}from"zod";var d=new Set(["[object object]","0","anonymous","distinct_id","distinctid","email","false","guest","id","nan","none","not_authenticated","null","true","undefined"]),s=t.string().trim().min(1).max(200).refine(e=>!d.has(e.toLowerCase()),{message:"Identity id is reserved"}),g=t.discriminatedUnion("type",[t.object({id:s,type:t.literal("anonymous")}),t.object({id:s,type:t.literal("user")})]),l=t.object({avatarUrl:t.string().trim().pipe(t.url()).optional(),email:t.string().trim().max(320).pipe(t.email()).optional(),name:t.string().trim().max(120).optional()}),p=t.object({anonymousId:s.optional(),identity:g,profile:l.optional()}),u=t.object({expiresAt:t.number().int().positive(),token:t.string().trim().min(1)});var h="https://api.heroui.pro";var n=class extends Error{status;constructor(o,a,i){super(o,i),this.name="HeroUIAgentAuthError",this.status=a}};async function x(e){let o=e.apiKey.trim(),a=e.agentId.trim(),i=p.safeParse({anonymousId:e.anonymousId,identity:e.identity,profile:e.profile});if(!o||!a||!i.success)throw new n("Invalid HeroUI Agent auth token request",400);let m=(e.apiBaseUrl?.trim()||h).replace(/\/$/,""),r;try{r=await fetch(`${m}/v1/agents/${encodeURIComponent(a)}/auth-tokens`,{body:JSON.stringify(i.data),cache:"no-store",headers:{Accept:"application/json","Content-Type":"application/json","X-HeroUI-Agent-Key":o},method:"POST"})}catch(A){throw new n("HeroUI Agent authentication is unavailable",503,{cause:A})}if(!r.ok)throw new n("HeroUI Agent authentication failed",r.status);let c=u.safeParse(await r.json().catch(()=>null));if(!c.success)throw new n("HeroUI Agent authentication returned invalid data",502);return c.data}export{n as HeroUIAgentAuthError,x as createAuthToken};
|