@amodalai/react 0.1.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/LICENSE +21 -0
- package/dist/chat.d.ts +19 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/client/index.d.ts +10 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/runtime-client.d.ts +58 -0
- package/dist/client/runtime-client.d.ts.map +1 -0
- package/dist/client/sse-client.d.ts +20 -0
- package/dist/client/sse-client.d.ts.map +1 -0
- package/dist/client.js +181 -0
- package/dist/client.js.map +1 -0
- package/dist/components/AmodalAction.d.ts +22 -0
- package/dist/components/AmodalAction.d.ts.map +1 -0
- package/dist/components/ConfirmCard.d.ts +11 -0
- package/dist/components/ConfirmCard.d.ts.map +1 -0
- package/dist/components/ReviewCard.d.ts +11 -0
- package/dist/components/ReviewCard.d.ts.map +1 -0
- package/dist/hooks/useAmodalBrief.d.ts +20 -0
- package/dist/hooks/useAmodalBrief.d.ts.map +1 -0
- package/dist/hooks/useAmodalChat.d.ts +27 -0
- package/dist/hooks/useAmodalChat.d.ts.map +1 -0
- package/dist/hooks/useAmodalInsight.d.ts +23 -0
- package/dist/hooks/useAmodalInsight.d.ts.map +1 -0
- package/dist/hooks/useAmodalQuery.d.ts +17 -0
- package/dist/hooks/useAmodalQuery.d.ts.map +1 -0
- package/dist/hooks/useAmodalTask.d.ts +21 -0
- package/dist/hooks/useAmodalTask.d.ts.map +1 -0
- package/dist/hooks/useNavigate.d.ts +32 -0
- package/dist/hooks/useNavigate.d.ts.map +1 -0
- package/dist/hooks/useSkillAction.d.ts +40 -0
- package/dist/hooks/useSkillAction.d.ts.map +1 -0
- package/dist/hooks/useStore.d.ts +36 -0
- package/dist/hooks/useStore.d.ts.map +1 -0
- package/dist/hooks/useStoreList.d.ts +41 -0
- package/dist/hooks/useStoreList.d.ts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/provider.d.ts +27 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/react.js +855 -0
- package/dist/react.js.map +1 -0
- package/dist/types.d.ts +339 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSkillAction.d.ts","sourceRoot":"","sources":["../../src/hooks/useSkillAction.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,WAAW,qBAAqB;IACpC,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpD,8CAA8C;IAC9C,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CA8DtB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { StoreDocument, StoreDocumentMeta } from '../types';
|
|
2
|
+
export interface UseStoreOptions {
|
|
3
|
+
/** Document key to fetch. */
|
|
4
|
+
key: string;
|
|
5
|
+
/** Auto-refresh interval in milliseconds. Set to 0 to disable. Default: 30000. */
|
|
6
|
+
refreshInterval?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface UseStoreReturn {
|
|
9
|
+
/** Document payload (the entity data). */
|
|
10
|
+
data: Record<string, unknown> | null;
|
|
11
|
+
/** Document metadata (computedAt, ttl, stale, trace, etc.). */
|
|
12
|
+
meta: StoreDocumentMeta | null;
|
|
13
|
+
/** Full document (key, version, payload, meta). */
|
|
14
|
+
document: StoreDocument | null;
|
|
15
|
+
/** Version history (most recent first). */
|
|
16
|
+
history: StoreDocument[];
|
|
17
|
+
/** Whether the initial fetch is in progress. */
|
|
18
|
+
isLoading: boolean;
|
|
19
|
+
/** Error message if the fetch failed. */
|
|
20
|
+
error: string | null;
|
|
21
|
+
/** Manually trigger a refetch. */
|
|
22
|
+
refetch: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Fetch a single document from a store by key.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* const { data, meta, isLoading } = useStore('deal-health', { key: `deal:${dealId}` });
|
|
30
|
+
* if (data) {
|
|
31
|
+
* console.log(data.score, data.severity);
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare function useStore(storeName: string, options: UseStoreOptions): UseStoreReturn;
|
|
36
|
+
//# sourceMappingURL=useStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStore.d.ts","sourceRoot":"","sources":["../../src/hooks/useStore.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAGjE,MAAM,WAAW,eAAe;IAC9B,6BAA6B;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,+DAA+D;IAC/D,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/B,mDAAmD;IACnD,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,2CAA2C;IAC3C,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kCAAkC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,cAAc,CAoEpF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { StoreDocument } from '../types';
|
|
2
|
+
export interface UseStoreListOptions {
|
|
3
|
+
/** Filter by field values (equality match). */
|
|
4
|
+
filter?: Record<string, unknown>;
|
|
5
|
+
/** Sort field. Prefix with "-" for descending (e.g., "-severity"). */
|
|
6
|
+
sort?: string;
|
|
7
|
+
/** Max documents to return. Default: 20. */
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Auto-refresh interval in milliseconds. Set to 0 to disable. Default: 30000. */
|
|
10
|
+
refreshInterval?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface UseStoreListReturn {
|
|
13
|
+
/** Array of document payloads. */
|
|
14
|
+
data: Array<Record<string, unknown>>;
|
|
15
|
+
/** Full documents (with key, version, meta). */
|
|
16
|
+
documents: StoreDocument[];
|
|
17
|
+
/** Total count of matching documents. */
|
|
18
|
+
total: number;
|
|
19
|
+
/** Whether more documents exist beyond the current page. */
|
|
20
|
+
hasMore: boolean;
|
|
21
|
+
/** Whether the initial fetch is in progress. */
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
/** Error message if the fetch failed. */
|
|
24
|
+
error: string | null;
|
|
25
|
+
/** Manually trigger a refetch. */
|
|
26
|
+
refetch: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Fetch a list of documents from a store with optional filtering and sorting.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* const { data, total } = useStoreList('active-alerts', {
|
|
34
|
+
* filter: { severity: 'P1' },
|
|
35
|
+
* sort: '-computedAt',
|
|
36
|
+
* limit: 10,
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare function useStoreList(storeName: string, options?: UseStoreListOptions): UseStoreListReturn;
|
|
41
|
+
//# sourceMappingURL=useStoreList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStoreList.d.ts","sourceRoot":"","sources":["../../src/hooks/useStoreList.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,mBAAmB;IAClC,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IACjC,kCAAkC;IAClC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrC,gDAAgD;IAChD,SAAS,EAAE,aAAa,EAAE,CAAC;IAC3B,yCAAyC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,kCAAkC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB,GAAG,kBAAkB,CA8ErG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
export { AmodalProvider, useAmodalContext } from './provider';
|
|
7
|
+
export type { AmodalProviderProps } from './provider';
|
|
8
|
+
export { AmodalChat } from './chat';
|
|
9
|
+
export type { AmodalChatProps } from './chat';
|
|
10
|
+
export { AmodalAction } from './components/AmodalAction';
|
|
11
|
+
export type { AmodalActionProps } from './components/AmodalAction';
|
|
12
|
+
export { ConfirmCard } from './components/ConfirmCard';
|
|
13
|
+
export type { ConfirmCardProps } from './components/ConfirmCard';
|
|
14
|
+
export { ReviewCard } from './components/ReviewCard';
|
|
15
|
+
export type { ReviewCardProps } from './components/ReviewCard';
|
|
16
|
+
export { useAmodalChat } from './hooks/useAmodalChat';
|
|
17
|
+
export type { UseAmodalChatOptions, UseAmodalChatReturn } from './hooks/useAmodalChat';
|
|
18
|
+
export { useAmodalBrief } from './hooks/useAmodalBrief';
|
|
19
|
+
export type { UseAmodalBriefOptions, UseAmodalBriefReturn } from './hooks/useAmodalBrief';
|
|
20
|
+
export { useAmodalInsight } from './hooks/useAmodalInsight';
|
|
21
|
+
export type { UseAmodalInsightOptions, UseAmodalInsightReturn } from './hooks/useAmodalInsight';
|
|
22
|
+
export { useAmodalTask } from './hooks/useAmodalTask';
|
|
23
|
+
export type { UseAmodalTaskOptions, UseAmodalTaskReturn } from './hooks/useAmodalTask';
|
|
24
|
+
export { useAmodalQuery } from './hooks/useAmodalQuery';
|
|
25
|
+
export type { UseAmodalQueryOptions, UseAmodalQueryReturn } from './hooks/useAmodalQuery';
|
|
26
|
+
export { useStore } from './hooks/useStore';
|
|
27
|
+
export type { UseStoreOptions, UseStoreReturn } from './hooks/useStore';
|
|
28
|
+
export { useStoreList } from './hooks/useStoreList';
|
|
29
|
+
export type { UseStoreListOptions, UseStoreListReturn } from './hooks/useStoreList';
|
|
30
|
+
export { useSkillAction } from './hooks/useSkillAction';
|
|
31
|
+
export type { UseSkillActionOptions, UseSkillActionReturn } from './hooks/useSkillAction';
|
|
32
|
+
export { useNavigate, NavigateContext } from './hooks/useNavigate';
|
|
33
|
+
export type { NavigateFn } from './hooks/useNavigate';
|
|
34
|
+
export { RuntimeClient } from './client/runtime-client';
|
|
35
|
+
export type { RuntimeClientOptions } from './client/runtime-client';
|
|
36
|
+
export { parseSSELine, streamSSE, streamSSEGet } from './client/sse-client';
|
|
37
|
+
export type { StreamSSEOptions } from './client/sse-client';
|
|
38
|
+
export type { SSEEvent, SSEEventType, SSEInitEvent, SSETextDeltaEvent, SSEToolCallStartEvent, SSEToolCallResultEvent, SSESubagentEvent, SSESkillActivatedEvent, SSEWidgetEvent, SSEKBProposalEvent, SSEConfirmationRequiredEvent, SSEErrorEvent, SSEDoneEvent, ChatMessage, UserMessage, AssistantTextMessage, ErrorMessage, ToolCallInfo, ToolCallStatus, ConfirmationInfo, ContentBlock, SubagentEventInfo, ChatState, ChatAction, TaskStatus, TaskStatusValue, BriefResult, InsightResult, QueryResult, StoreFieldDefinitionInfo, StoreEntityInfo, StoreDefinitionInfo, StoreDocumentMeta, StoreDocument, StoreListResult, StoreDocumentResult, } from './types';
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9D,YAAY,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGtD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,YAAY,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAG9C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,MA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AC;AACnE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGtD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,YAAY,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAC5E,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,kBAAkB,EAClB,4BAA4B,EAC5B,aAAa,EACb,YAAY,EACZ,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,UAAU,EACV,eAAe,EACf,WAAW,EACX,aAAa,EACb,WAAW,EACX,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,eAAe,EACf,mBAAmB,GACpB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RuntimeClient } from './client/runtime-client';
|
|
3
|
+
export interface AmodalProviderProps {
|
|
4
|
+
/** Base URL of the Amodal runtime server (e.g., "http://localhost:3001"). */
|
|
5
|
+
runtimeUrl: string;
|
|
6
|
+
/** Tenant identifier sent in every request body. */
|
|
7
|
+
tenantId: string;
|
|
8
|
+
/** Optional async token getter for auth headers. */
|
|
9
|
+
getToken?: () => string | Promise<string> | null | undefined;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
interface AmodalContextValue {
|
|
13
|
+
client: RuntimeClient;
|
|
14
|
+
runtimeUrl: string;
|
|
15
|
+
tenantId: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Provides a RuntimeClient to all child hooks and components.
|
|
19
|
+
*/
|
|
20
|
+
export declare function AmodalProvider({ runtimeUrl, tenantId, getToken, children }: AmodalProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* Access the RuntimeClient and config from the nearest AmodalProvider.
|
|
23
|
+
* Throws if called outside of an AmodalProvider.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAmodalContext(): AmodalContextValue;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;IAC7D,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAID;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,mBAAmB,2CAY/F;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,kBAAkB,CAMrD"}
|