@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amodal Labs, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/chat.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfirmationInfo, ToolCallInfo } from './types';
|
|
2
|
+
import { UseAmodalChatOptions } from './hooks/useAmodalChat';
|
|
3
|
+
export interface AmodalChatProps extends UseAmodalChatOptions {
|
|
4
|
+
/** Placeholder text for the input bar. */
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/** Custom renderer for text content blocks. */
|
|
7
|
+
renderText?: (text: string) => React.ReactNode;
|
|
8
|
+
/** Custom renderer for tool call blocks. */
|
|
9
|
+
renderToolCall?: (call: ToolCallInfo) => React.ReactNode;
|
|
10
|
+
/** Custom renderer for confirmation blocks. */
|
|
11
|
+
renderConfirmation?: (confirmation: ConfirmationInfo, onApprove: () => void, onDeny: () => void) => React.ReactNode;
|
|
12
|
+
/** CSS class name for the root element. */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Full chat component — message list, input bar, renders confirmations inline.
|
|
17
|
+
*/
|
|
18
|
+
export declare function AmodalChat({ placeholder, renderText, renderToolCall, renderConfirmation, className, ...hookOptions }: AmodalChatProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIlE,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAC;IAC/C,4CAA4C;IAC5C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,KAAK,CAAC,SAAS,CAAC;IACzD,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC;IACpH,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EACzB,WAAiC,EACjC,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,GAAG,WAAW,EACf,EAAE,eAAe,2CAuHjB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
export { parseSSELine, streamSSE, streamSSEGet } from './sse-client';
|
|
7
|
+
export type { StreamSSEOptions } from './sse-client';
|
|
8
|
+
export { RuntimeClient } from './runtime-client';
|
|
9
|
+
export type { RuntimeClientOptions } from './runtime-client';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { SSEEvent, TaskStatus, StoreDefinitionInfo, StoreListResult, StoreDocumentResult } from '../types';
|
|
2
|
+
export interface RuntimeClientOptions {
|
|
3
|
+
runtimeUrl: string;
|
|
4
|
+
tenantId: string;
|
|
5
|
+
getToken?: () => string | Promise<string> | null | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Client for the Amodal runtime's repo routes.
|
|
9
|
+
* Targets POST /chat, POST /task, GET /task/:id, GET /task/:id/stream.
|
|
10
|
+
*/
|
|
11
|
+
export declare class RuntimeClient {
|
|
12
|
+
private readonly runtimeUrl;
|
|
13
|
+
private readonly tenantId;
|
|
14
|
+
private readonly getToken?;
|
|
15
|
+
constructor(options: RuntimeClientOptions);
|
|
16
|
+
private authHeaders;
|
|
17
|
+
/**
|
|
18
|
+
* Stream a chat message via POST /chat.
|
|
19
|
+
*/
|
|
20
|
+
chatStream(message: string, options?: {
|
|
21
|
+
sessionId?: string;
|
|
22
|
+
context?: Record<string, unknown>;
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): AsyncGenerator<SSEEvent>;
|
|
25
|
+
/**
|
|
26
|
+
* Start a fire-and-forget task via POST /task.
|
|
27
|
+
*/
|
|
28
|
+
startTask(prompt: string, tenantToken?: string): Promise<{
|
|
29
|
+
task_id: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Get task status via GET /task/:id.
|
|
33
|
+
*/
|
|
34
|
+
getTaskStatus(taskId: string): Promise<TaskStatus>;
|
|
35
|
+
/**
|
|
36
|
+
* Stream task events via GET /task/:id/stream.
|
|
37
|
+
*/
|
|
38
|
+
streamTask(taskId: string, signal?: AbortSignal): AsyncGenerator<SSEEvent>;
|
|
39
|
+
/**
|
|
40
|
+
* List all store definitions with document counts.
|
|
41
|
+
*/
|
|
42
|
+
getStores(signal?: AbortSignal): Promise<StoreDefinitionInfo[]>;
|
|
43
|
+
/**
|
|
44
|
+
* List documents from a store with optional filtering.
|
|
45
|
+
*/
|
|
46
|
+
getStoreDocuments(storeName: string, options?: {
|
|
47
|
+
filter?: Record<string, unknown>;
|
|
48
|
+
sort?: string;
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
signal?: AbortSignal;
|
|
52
|
+
}): Promise<StoreListResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Get a single document by key, optionally with version history.
|
|
55
|
+
*/
|
|
56
|
+
getStoreDocument(storeName: string, key: string, signal?: AbortSignal): Promise<StoreDocumentResult>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=runtime-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-client.d.ts","sourceRoot":"","sources":["../../src/client/runtime-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGhH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAC9D;AAED;;;GAGG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAoD;gBAElE,OAAO,EAAE,oBAAoB;YAM3B,WAAW;IAWzB;;OAEG;IACI,UAAU,CACf,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,cAAc,CAAC,QAAQ,CAAC;IAqB3B;;OAEG;IACG,SAAS,CACb,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IA0B/B;;OAEG;IACG,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAiBxD;;OAEG;IACI,UAAU,CACf,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,WAAW,GACnB,cAAc,CAAC,QAAQ,CAAC;IAW3B;;OAEG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAcrE;;OAEG;IACG,iBAAiB,CACrB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,eAAe,CAAC;IA4B3B;;OAEG;IACG,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,mBAAmB,CAAC;CAehC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { SSEEvent } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Parse a single SSE data line into a typed event.
|
|
4
|
+
* Returns null for non-data lines or empty data.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseSSELine(line: string): SSEEvent | null;
|
|
7
|
+
export interface StreamSSEOptions {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
headers?: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Streams SSE events from a POST endpoint.
|
|
13
|
+
* Uses fetch + ReadableStream (not EventSource, which only supports GET).
|
|
14
|
+
*/
|
|
15
|
+
export declare function streamSSE(url: string, body: Record<string, unknown>, options?: StreamSSEOptions): AsyncGenerator<SSEEvent>;
|
|
16
|
+
/**
|
|
17
|
+
* Streams SSE events from a GET endpoint (e.g., task streaming).
|
|
18
|
+
*/
|
|
19
|
+
export declare function streamSSEGet(url: string, options?: StreamSSEOptions): AsyncGenerator<SSEEvent>;
|
|
20
|
+
//# sourceMappingURL=sse-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse-client.d.ts","sourceRoot":"","sources":["../../src/client/sse-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAM1D;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAuB,SAAS,CAC9B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,CAAC,EAAE,gBAAgB,GACzB,cAAc,CAAC,QAAQ,CAAC,CAkB1B;AAED;;GAEG;AACH,wBAAuB,YAAY,CACjC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,gBAAgB,GACzB,cAAc,CAAC,QAAQ,CAAC,CAY1B"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
var m = Object.defineProperty;
|
|
2
|
+
var S = (s, e, t) => e in s ? m(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
|
|
3
|
+
var d = (s, e, t) => S(s, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
/**
|
|
5
|
+
* @license
|
|
6
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
7
|
+
* SPDX-License-Identifier: MIT
|
|
8
|
+
*/
|
|
9
|
+
function l(s) {
|
|
10
|
+
if (!s.startsWith("data: ")) return null;
|
|
11
|
+
const e = s.slice(6).trim();
|
|
12
|
+
return e.length === 0 ? null : JSON.parse(e);
|
|
13
|
+
}
|
|
14
|
+
async function* g(s, e, t) {
|
|
15
|
+
const a = {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
...t == null ? void 0 : t.headers
|
|
18
|
+
}, r = await fetch(s, {
|
|
19
|
+
method: "POST",
|
|
20
|
+
headers: a,
|
|
21
|
+
body: JSON.stringify(e),
|
|
22
|
+
signal: t == null ? void 0 : t.signal
|
|
23
|
+
});
|
|
24
|
+
if (!r.ok)
|
|
25
|
+
throw new Error(`SSE request failed: ${String(r.status)} ${r.statusText}`);
|
|
26
|
+
yield* f(r);
|
|
27
|
+
}
|
|
28
|
+
async function* y(s, e) {
|
|
29
|
+
const t = await fetch(s, {
|
|
30
|
+
method: "GET",
|
|
31
|
+
headers: e == null ? void 0 : e.headers,
|
|
32
|
+
signal: e == null ? void 0 : e.signal
|
|
33
|
+
});
|
|
34
|
+
if (!t.ok)
|
|
35
|
+
throw new Error(`SSE request failed: ${String(t.status)} ${t.statusText}`);
|
|
36
|
+
yield* f(t);
|
|
37
|
+
}
|
|
38
|
+
async function* f(s) {
|
|
39
|
+
const e = s.body;
|
|
40
|
+
if (!e)
|
|
41
|
+
throw new Error("Response body is null");
|
|
42
|
+
const t = e.getReader(), a = new TextDecoder();
|
|
43
|
+
let r = "";
|
|
44
|
+
try {
|
|
45
|
+
for (; ; ) {
|
|
46
|
+
const { done: n, value: i } = await t.read();
|
|
47
|
+
if (n) break;
|
|
48
|
+
r += a.decode(i, { stream: !0 });
|
|
49
|
+
const c = r.split(`
|
|
50
|
+
`);
|
|
51
|
+
r = c.pop() ?? "";
|
|
52
|
+
for (const w of c) {
|
|
53
|
+
const h = w.trim();
|
|
54
|
+
if (h.length === 0) continue;
|
|
55
|
+
const u = l(h);
|
|
56
|
+
u && (yield u);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (r.trim().length > 0) {
|
|
60
|
+
const n = l(r.trim());
|
|
61
|
+
n && (yield n);
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
t.releaseLock();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @license
|
|
69
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
70
|
+
* SPDX-License-Identifier: MIT
|
|
71
|
+
*/
|
|
72
|
+
class $ {
|
|
73
|
+
constructor(e) {
|
|
74
|
+
d(this, "runtimeUrl");
|
|
75
|
+
d(this, "tenantId");
|
|
76
|
+
d(this, "getToken");
|
|
77
|
+
this.runtimeUrl = e.runtimeUrl.replace(/\/$/, ""), this.tenantId = e.tenantId, this.getToken = e.getToken;
|
|
78
|
+
}
|
|
79
|
+
async authHeaders() {
|
|
80
|
+
const e = {};
|
|
81
|
+
if (this.getToken) {
|
|
82
|
+
const t = await this.getToken();
|
|
83
|
+
t && (e.Authorization = `Bearer ${t}`);
|
|
84
|
+
}
|
|
85
|
+
return e;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Stream a chat message via POST /chat.
|
|
89
|
+
*/
|
|
90
|
+
async *chatStream(e, t) {
|
|
91
|
+
const a = `${this.runtimeUrl}/chat`, r = {
|
|
92
|
+
message: e,
|
|
93
|
+
tenant_id: this.tenantId
|
|
94
|
+
};
|
|
95
|
+
t != null && t.sessionId && (r.session_id = t.sessionId), t != null && t.context && (r.context = t.context);
|
|
96
|
+
const n = await this.authHeaders();
|
|
97
|
+
yield* g(a, r, {
|
|
98
|
+
signal: t == null ? void 0 : t.signal,
|
|
99
|
+
headers: n
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Start a fire-and-forget task via POST /task.
|
|
104
|
+
*/
|
|
105
|
+
async startTask(e, t) {
|
|
106
|
+
const a = `${this.runtimeUrl}/task`, r = await this.authHeaders(), n = {
|
|
107
|
+
prompt: e,
|
|
108
|
+
tenant_id: this.tenantId
|
|
109
|
+
};
|
|
110
|
+
t && (n.tenant_token = t);
|
|
111
|
+
const i = await fetch(a, {
|
|
112
|
+
method: "POST",
|
|
113
|
+
headers: { "Content-Type": "application/json", ...r },
|
|
114
|
+
body: JSON.stringify(n)
|
|
115
|
+
});
|
|
116
|
+
if (!i.ok)
|
|
117
|
+
throw new Error(`Start task failed: ${String(i.status)} ${i.statusText}`);
|
|
118
|
+
return await i.json();
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Get task status via GET /task/:id.
|
|
122
|
+
*/
|
|
123
|
+
async getTaskStatus(e) {
|
|
124
|
+
const t = `${this.runtimeUrl}/task/${e}`, a = await this.authHeaders(), r = await fetch(t, {
|
|
125
|
+
method: "GET",
|
|
126
|
+
headers: a
|
|
127
|
+
});
|
|
128
|
+
if (!r.ok)
|
|
129
|
+
throw new Error(`Get task status failed: ${String(r.status)} ${r.statusText}`);
|
|
130
|
+
return await r.json();
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Stream task events via GET /task/:id/stream.
|
|
134
|
+
*/
|
|
135
|
+
async *streamTask(e, t) {
|
|
136
|
+
const a = `${this.runtimeUrl}/task/${e}/stream`, r = await this.authHeaders();
|
|
137
|
+
yield* y(a, { signal: t, headers: r });
|
|
138
|
+
}
|
|
139
|
+
// ---------------------------------------------------------------------------
|
|
140
|
+
// Store API
|
|
141
|
+
// ---------------------------------------------------------------------------
|
|
142
|
+
/**
|
|
143
|
+
* List all store definitions with document counts.
|
|
144
|
+
*/
|
|
145
|
+
async getStores(e) {
|
|
146
|
+
const t = `${this.runtimeUrl}/api/stores`, a = await this.authHeaders(), r = await fetch(t, { headers: a, signal: e });
|
|
147
|
+
if (!r.ok)
|
|
148
|
+
throw new Error(`Failed to fetch stores: ${String(r.status)}`);
|
|
149
|
+
return (await r.json()).stores;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* List documents from a store with optional filtering.
|
|
153
|
+
*/
|
|
154
|
+
async getStoreDocuments(e, t) {
|
|
155
|
+
const a = new URLSearchParams();
|
|
156
|
+
t != null && t.filter && a.set("filter", JSON.stringify(t.filter)), t != null && t.sort && a.set("sort", t.sort), (t == null ? void 0 : t.limit) !== void 0 && a.set("limit", String(t.limit)), (t == null ? void 0 : t.offset) !== void 0 && a.set("offset", String(t.offset));
|
|
157
|
+
const r = a.toString(), n = `${this.runtimeUrl}/api/stores/${e}${r ? `?${r}` : ""}`, i = await this.authHeaders(), c = await fetch(n, { headers: i, signal: t == null ? void 0 : t.signal });
|
|
158
|
+
if (!c.ok)
|
|
159
|
+
throw new Error(`Failed to fetch store documents: ${String(c.status)}`);
|
|
160
|
+
return await c.json();
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get a single document by key, optionally with version history.
|
|
164
|
+
*/
|
|
165
|
+
async getStoreDocument(e, t, a) {
|
|
166
|
+
const r = `${this.runtimeUrl}/api/stores/${e}/${encodeURIComponent(t)}`, n = await this.authHeaders(), i = await fetch(r, { headers: n, signal: a });
|
|
167
|
+
if (!i.ok) {
|
|
168
|
+
if (i.status === 404)
|
|
169
|
+
return { document: null, history: [] };
|
|
170
|
+
throw new Error(`Failed to fetch store document: ${String(i.status)}`);
|
|
171
|
+
}
|
|
172
|
+
return await i.json();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
$ as RuntimeClient,
|
|
177
|
+
l as parseSSELine,
|
|
178
|
+
g as streamSSE,
|
|
179
|
+
y as streamSSEGet
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../src/client/sse-client.ts","../src/client/runtime-client.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2025 Amodal Labs, Inc.\n * SPDX-License-Identifier: MIT\n */\n\nimport type { SSEEvent } from '../types';\n\n/**\n * Parse a single SSE data line into a typed event.\n * Returns null for non-data lines or empty data.\n */\nexport function parseSSELine(line: string): SSEEvent | null {\n if (!line.startsWith('data: ')) return null;\n const json = line.slice(6).trim();\n if (json.length === 0) return null;\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- SSE event from server\n return JSON.parse(json) as SSEEvent;\n}\n\nexport interface StreamSSEOptions {\n signal?: AbortSignal;\n headers?: Record<string, string>;\n}\n\n/**\n * Streams SSE events from a POST endpoint.\n * Uses fetch + ReadableStream (not EventSource, which only supports GET).\n */\nexport async function* streamSSE(\n url: string,\n body: Record<string, unknown>,\n options?: StreamSSEOptions,\n): AsyncGenerator<SSEEvent> {\n const headers: Record<string, string> = {\n 'Content-Type': 'application/json',\n ...options?.headers,\n };\n\n const response = await fetch(url, {\n method: 'POST',\n headers,\n body: JSON.stringify(body),\n signal: options?.signal,\n });\n\n if (!response.ok) {\n throw new Error(`SSE request failed: ${String(response.status)} ${response.statusText}`);\n }\n\n yield* readSSEStream(response);\n}\n\n/**\n * Streams SSE events from a GET endpoint (e.g., task streaming).\n */\nexport async function* streamSSEGet(\n url: string,\n options?: StreamSSEOptions,\n): AsyncGenerator<SSEEvent> {\n const response = await fetch(url, {\n method: 'GET',\n headers: options?.headers,\n signal: options?.signal,\n });\n\n if (!response.ok) {\n throw new Error(`SSE request failed: ${String(response.status)} ${response.statusText}`);\n }\n\n yield* readSSEStream(response);\n}\n\n/**\n * Reads SSE events from a Response body stream.\n */\nasync function* readSSEStream(response: Response): AsyncGenerator<SSEEvent> {\n const body = response.body;\n if (!body) {\n throw new Error('Response body is null');\n }\n\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n\n buffer += decoder.decode(value, { stream: true });\n\n const lines = buffer.split('\\n');\n buffer = lines.pop() ?? '';\n\n for (const line of lines) {\n const trimmed = line.trim();\n if (trimmed.length === 0) continue;\n const event = parseSSELine(trimmed);\n if (event) {\n yield event;\n }\n }\n }\n\n // Process any remaining buffer\n if (buffer.trim().length > 0) {\n const event = parseSSELine(buffer.trim());\n if (event) {\n yield event;\n }\n }\n } finally {\n reader.releaseLock();\n }\n}\n","/**\n * @license\n * Copyright 2025 Amodal Labs, Inc.\n * SPDX-License-Identifier: MIT\n */\n\nimport type { SSEEvent, TaskStatus, StoreDefinitionInfo, StoreListResult, StoreDocumentResult } from '../types';\nimport { streamSSE, streamSSEGet } from './sse-client';\n\nexport interface RuntimeClientOptions {\n runtimeUrl: string;\n tenantId: string;\n getToken?: () => string | Promise<string> | null | undefined;\n}\n\n/**\n * Client for the Amodal runtime's repo routes.\n * Targets POST /chat, POST /task, GET /task/:id, GET /task/:id/stream.\n */\nexport class RuntimeClient {\n private readonly runtimeUrl: string;\n private readonly tenantId: string;\n private readonly getToken?: () => string | Promise<string> | null | undefined;\n\n constructor(options: RuntimeClientOptions) {\n this.runtimeUrl = options.runtimeUrl.replace(/\\/$/, '');\n this.tenantId = options.tenantId;\n this.getToken = options.getToken;\n }\n\n private async authHeaders(): Promise<Record<string, string>> {\n const headers: Record<string, string> = {};\n if (this.getToken) {\n const token = await this.getToken();\n if (token) {\n headers['Authorization'] = `Bearer ${token}`;\n }\n }\n return headers;\n }\n\n /**\n * Stream a chat message via POST /chat.\n */\n async *chatStream(\n message: string,\n options?: {\n sessionId?: string;\n context?: Record<string, unknown>;\n signal?: AbortSignal;\n },\n ): AsyncGenerator<SSEEvent> {\n const url = `${this.runtimeUrl}/chat`;\n const body: Record<string, unknown> = {\n message,\n tenant_id: this.tenantId,\n };\n if (options?.sessionId) {\n body['session_id'] = options.sessionId;\n }\n if (options?.context) {\n body['context'] = options.context;\n }\n\n const headers = await this.authHeaders();\n\n yield* streamSSE(url, body, {\n signal: options?.signal,\n headers,\n });\n }\n\n /**\n * Start a fire-and-forget task via POST /task.\n */\n async startTask(\n prompt: string,\n tenantToken?: string,\n ): Promise<{ task_id: string }> {\n const url = `${this.runtimeUrl}/task`;\n const headers = await this.authHeaders();\n\n const body: Record<string, unknown> = {\n prompt,\n tenant_id: this.tenantId,\n };\n if (tenantToken) {\n body['tenant_token'] = tenantToken;\n }\n\n const response = await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json', ...headers },\n body: JSON.stringify(body),\n });\n\n if (!response.ok) {\n throw new Error(`Start task failed: ${String(response.status)} ${response.statusText}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Server response\n return (await response.json()) as { task_id: string };\n }\n\n /**\n * Get task status via GET /task/:id.\n */\n async getTaskStatus(taskId: string): Promise<TaskStatus> {\n const url = `${this.runtimeUrl}/task/${taskId}`;\n const headers = await this.authHeaders();\n\n const response = await fetch(url, {\n method: 'GET',\n headers,\n });\n\n if (!response.ok) {\n throw new Error(`Get task status failed: ${String(response.status)} ${response.statusText}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Server response\n return (await response.json()) as TaskStatus;\n }\n\n /**\n * Stream task events via GET /task/:id/stream.\n */\n async *streamTask(\n taskId: string,\n signal?: AbortSignal,\n ): AsyncGenerator<SSEEvent> {\n const url = `${this.runtimeUrl}/task/${taskId}/stream`;\n const headers = await this.authHeaders();\n\n yield* streamSSEGet(url, { signal, headers });\n }\n\n // ---------------------------------------------------------------------------\n // Store API\n // ---------------------------------------------------------------------------\n\n /**\n * List all store definitions with document counts.\n */\n async getStores(signal?: AbortSignal): Promise<StoreDefinitionInfo[]> {\n const url = `${this.runtimeUrl}/api/stores`;\n const headers = await this.authHeaders();\n\n const response = await fetch(url, { headers, signal });\n if (!response.ok) {\n throw new Error(`Failed to fetch stores: ${String(response.status)}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Server response\n const body = (await response.json()) as { stores: StoreDefinitionInfo[] };\n return body.stores;\n }\n\n /**\n * List documents from a store with optional filtering.\n */\n async getStoreDocuments(\n storeName: string,\n options?: {\n filter?: Record<string, unknown>;\n sort?: string;\n limit?: number;\n offset?: number;\n signal?: AbortSignal;\n },\n ): Promise<StoreListResult> {\n const params = new URLSearchParams();\n if (options?.filter) {\n params.set('filter', JSON.stringify(options.filter));\n }\n if (options?.sort) {\n params.set('sort', options.sort);\n }\n if (options?.limit !== undefined) {\n params.set('limit', String(options.limit));\n }\n if (options?.offset !== undefined) {\n params.set('offset', String(options.offset));\n }\n\n const qs = params.toString();\n const url = `${this.runtimeUrl}/api/stores/${storeName}${qs ? `?${qs}` : ''}`;\n const headers = await this.authHeaders();\n\n const response = await fetch(url, { headers, signal: options?.signal });\n if (!response.ok) {\n throw new Error(`Failed to fetch store documents: ${String(response.status)}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Server response\n return (await response.json()) as StoreListResult;\n }\n\n /**\n * Get a single document by key, optionally with version history.\n */\n async getStoreDocument(\n storeName: string,\n key: string,\n signal?: AbortSignal,\n ): Promise<StoreDocumentResult> {\n const url = `${this.runtimeUrl}/api/stores/${storeName}/${encodeURIComponent(key)}`;\n const headers = await this.authHeaders();\n\n const response = await fetch(url, { headers, signal });\n if (!response.ok) {\n if (response.status === 404) {\n return { document: null, history: [] };\n }\n throw new Error(`Failed to fetch store document: ${String(response.status)}`);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- Server response\n return (await response.json()) as StoreDocumentResult;\n }\n}\n"],"names":["parseSSELine","line","json","streamSSE","url","body","options","headers","response","readSSEStream","streamSSEGet","reader","decoder","buffer","done","value","lines","trimmed","event","RuntimeClient","__publicField","token","message","prompt","tenantToken","taskId","signal","storeName","params","qs","key"],"mappings":";;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,SAASA,EAAaC,GAA+B;AAC1D,MAAI,CAACA,EAAK,WAAW,QAAQ,EAAG,QAAO;AACvC,QAAMC,IAAOD,EAAK,MAAM,CAAC,EAAE,KAAA;AAC3B,SAAIC,EAAK,WAAW,IAAU,OAEvB,KAAK,MAAMA,CAAI;AACxB;AAWA,gBAAuBC,EACrBC,GACAC,GACAC,GAC0B;AAC1B,QAAMC,IAAkC;AAAA,IACtC,gBAAgB;AAAA,IAChB,GAAGD,KAAA,gBAAAA,EAAS;AAA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AS,WAAW;AACtB,eAAO,EAAE,UAAU,MAAM,SAAS,CAAA,EAAC;AAErC,YAAM,IAAI,MAAM,mCAAmC,OAAOA,EAAS,MAAM,CAAC,EAAE;AAAA,IAC9E;AAGA,WAAQ,MAAMA,EAAS,KAAA;AAAA,EACzB;AACF;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
export interface AmodalActionProps {
|
|
7
|
+
/** The prompt to send when the action is triggered. */
|
|
8
|
+
prompt: string;
|
|
9
|
+
/** Label for the trigger button. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/** Additional context sent with the chat message. */
|
|
12
|
+
context?: Record<string, unknown>;
|
|
13
|
+
/** Called when the action completes. */
|
|
14
|
+
onComplete?: (text: string) => void;
|
|
15
|
+
/** Called on error. */
|
|
16
|
+
onError?: (error: string) => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* One-shot action: triggers a chat stream with a prompt, shows confirmation inline.
|
|
20
|
+
*/
|
|
21
|
+
export declare function AmodalAction({ prompt, label, context, onComplete, onError }: AmodalActionProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
//# sourceMappingURL=AmodalAction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmodalAction.d.ts","sourceRoot":"","sources":["../../src/components/AmodalAction.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,wCAAwC;IACxC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,uBAAuB;IACvB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,iBAAiB,2CAuF9F"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfirmationInfo } from '../types';
|
|
2
|
+
export interface ConfirmCardProps {
|
|
3
|
+
confirmation: ConfirmationInfo;
|
|
4
|
+
onApprove: () => void;
|
|
5
|
+
onDeny: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Simple confirmation card: shows endpoint + method + reason, approve/deny buttons.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ConfirmCard({ confirmation, onApprove, onDeny }: ConfirmCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=ConfirmCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfirmCard.d.ts","sourceRoot":"","sources":["../../src/components/ConfirmCard.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAkChF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConfirmationInfo } from '../types';
|
|
2
|
+
export interface ReviewCardProps {
|
|
3
|
+
confirmation: ConfirmationInfo;
|
|
4
|
+
onApprove: () => void;
|
|
5
|
+
onDeny: () => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Structured review card: all params, reason, escalation badge, approve/deny.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ReviewCard({ confirmation, onApprove, onDeny }: ReviewCardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=ReviewCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReviewCard.d.ts","sourceRoot":"","sources":["../../src/components/ReviewCard.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,gBAAgB,CAAC;IAC/B,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,2CAoD9E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BriefResult } from '../types';
|
|
2
|
+
export interface UseAmodalBriefOptions {
|
|
3
|
+
/** The prompt to send for the brief. */
|
|
4
|
+
prompt: string;
|
|
5
|
+
/** Additional context sent with the request. */
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
/** If true, the brief is fetched automatically on mount. Defaults to true. */
|
|
8
|
+
autoFetch?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UseAmodalBriefReturn {
|
|
11
|
+
brief: BriefResult | null;
|
|
12
|
+
isLoading: boolean;
|
|
13
|
+
error: string | null;
|
|
14
|
+
refresh: () => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Sends a chat with a brief prompt, collects the full response.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useAmodalBrief(options: UseAmodalBriefOptions): UseAmodalBriefReturn;
|
|
20
|
+
//# sourceMappingURL=useAmodalBrief.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAmodalBrief.d.ts","sourceRoot":"","sources":["../../src/hooks/useAmodalBrief.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,8EAA8E;IAC9E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAoFnF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ChatState, ChatAction, ChatMessage, ToolCallInfo, ConfirmationInfo } from '../types';
|
|
2
|
+
export declare function chatReducer(state: ChatState, action: ChatAction): ChatState;
|
|
3
|
+
export interface UseAmodalChatOptions {
|
|
4
|
+
/** Additional context sent with each chat message. */
|
|
5
|
+
context?: Record<string, unknown>;
|
|
6
|
+
/** Called when the SSE stream ends. */
|
|
7
|
+
onStreamEnd?: () => void;
|
|
8
|
+
/** Called when a session ID is received from the server. */
|
|
9
|
+
onSessionCreated?: (sessionId: string) => void;
|
|
10
|
+
/** Called on each tool call result. */
|
|
11
|
+
onToolCall?: (call: ToolCallInfo) => void;
|
|
12
|
+
/** Called when a confirmation is required. */
|
|
13
|
+
onConfirmation?: (confirmation: ConfirmationInfo) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface UseAmodalChatReturn {
|
|
16
|
+
messages: ChatMessage[];
|
|
17
|
+
send: (text: string) => void;
|
|
18
|
+
stop: () => void;
|
|
19
|
+
isStreaming: boolean;
|
|
20
|
+
activeToolCalls: ToolCallInfo[];
|
|
21
|
+
sessionId: string | null;
|
|
22
|
+
error: string | null;
|
|
23
|
+
reset: () => void;
|
|
24
|
+
respondToConfirmation: (correlationId: string, approved: boolean) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function useAmodalChat(options?: UseAmodalChatOptions): UseAmodalChatReturn;
|
|
27
|
+
//# sourceMappingURL=useAmodalChat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAmodalChat.d.ts","sourceRoot":"","sources":["../../src/hooks/useAmodalChat.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,WAAW,EAEX,YAAY,EAEZ,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAkBlB,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,SAAS,CA2L3E;AAED,MAAM,WAAW,oBAAoB;IACnC,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,uCAAuC;IACvC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,uCAAuC;IACvC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;IAC1C,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC,YAAY,EAAE,gBAAgB,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,YAAY,EAAE,CAAC;IAChC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,qBAAqB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3E;AAED,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,mBAAmB,CA6LjF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { InsightResult } from '../types';
|
|
2
|
+
export interface UseAmodalInsightOptions {
|
|
3
|
+
/** The insight prompt to send. */
|
|
4
|
+
prompt: string;
|
|
5
|
+
/** Additional context for the insight. */
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
/** If true, fetched automatically on mount. Defaults to true. */
|
|
8
|
+
autoFetch?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface UseAmodalInsightReturn {
|
|
11
|
+
status: InsightResult['status'];
|
|
12
|
+
summary: string;
|
|
13
|
+
details: string;
|
|
14
|
+
isLoading: boolean;
|
|
15
|
+
error: string | null;
|
|
16
|
+
refresh: () => void;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Sends a chat with an insight prompt, collects a structured response.
|
|
20
|
+
* Splits the response at the first double newline into summary and details.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useAmodalInsight(options: UseAmodalInsightOptions): UseAmodalInsightReturn;
|
|
23
|
+
//# sourceMappingURL=useAmodalInsight.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAmodalInsight.d.ts","sourceRoot":"","sources":["../../src/hooks/useAmodalInsight.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,MAAM,WAAW,uBAAuB;IACtC,kCAAkC;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,uBAAuB,GAAG,sBAAsB,CA6EzF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { QueryResult } from '../types';
|
|
2
|
+
export interface UseAmodalQueryOptions {
|
|
3
|
+
/** The query prompt. */
|
|
4
|
+
prompt: string;
|
|
5
|
+
/** Additional context. */
|
|
6
|
+
context?: Record<string, unknown>;
|
|
7
|
+
/** If true, fetched automatically on mount. Defaults to true. */
|
|
8
|
+
autoFetch?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type UseAmodalQueryReturn = QueryResult<string> & {
|
|
11
|
+
refetch: () => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Non-streaming query. Collects the full response text.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAmodalQuery(options: UseAmodalQueryOptions): UseAmodalQueryReturn;
|
|
17
|
+
//# sourceMappingURL=useAmodalQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAmodalQuery.d.ts","sourceRoot":"","sources":["../../src/hooks/useAmodalQuery.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAG5C,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,iEAAiE;IACjE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG;IACvD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAiEnF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SSEEvent, TaskStatusValue } from '../types';
|
|
2
|
+
export interface UseAmodalTaskOptions {
|
|
3
|
+
/** The task ID to stream. */
|
|
4
|
+
taskId: string;
|
|
5
|
+
/** If true, starts streaming automatically on mount. Defaults to true. */
|
|
6
|
+
autoStream?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseAmodalTaskReturn {
|
|
9
|
+
status: TaskStatusValue | 'idle';
|
|
10
|
+
progress: string;
|
|
11
|
+
result: string;
|
|
12
|
+
events: SSEEvent[];
|
|
13
|
+
error: string | null;
|
|
14
|
+
start: () => void;
|
|
15
|
+
stop: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Streams GET /task/:id/stream events.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useAmodalTask(options: UseAmodalTaskOptions): UseAmodalTaskReturn;
|
|
21
|
+
//# sourceMappingURL=useAmodalTask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAmodalTask.d.ts","sourceRoot":"","sources":["../../src/hooks/useAmodalTask.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG1D,MAAM,WAAW,oBAAoB;IACnC,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,0EAA0E;IAC1E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,eAAe,GAAG,MAAM,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,IAAI,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,mBAAmB,CAoGhF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Navigation function type.
|
|
8
|
+
* In the runtime app, this is backed by React Router's navigate.
|
|
9
|
+
* In standalone/embedded usage, the host app provides the implementation.
|
|
10
|
+
*/
|
|
11
|
+
export type NavigateFn = (pageName: string, params?: Record<string, string>) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Context for providing a navigate function.
|
|
14
|
+
* The runtime app sets this with React Router's navigate.
|
|
15
|
+
* Standalone users can provide their own via NavigateProvider.
|
|
16
|
+
*/
|
|
17
|
+
export declare const NavigateContext: import('react').Context<NavigateFn | null>;
|
|
18
|
+
/**
|
|
19
|
+
* Navigate between pages in the runtime app.
|
|
20
|
+
*
|
|
21
|
+
* In the runtime app, navigates to the page route.
|
|
22
|
+
* In standalone/embedded usage, calls the host-provided navigate function.
|
|
23
|
+
* If no NavigateProvider is present, returns a no-op.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```tsx
|
|
27
|
+
* const navigate = useNavigate();
|
|
28
|
+
* navigate('incident-detail', { correlationId: '123' });
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare function useNavigate(): NavigateFn;
|
|
32
|
+
//# sourceMappingURL=useNavigate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNavigate.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavigate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;AAErF;;;;GAIG;AACH,eAAO,MAAM,eAAe,4CAAyC,CAAC;AAEtE;;;;;;;;;;;;GAYG;AACH,wBAAgB,WAAW,IAAI,UAAU,CAQxC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Amodal Labs, Inc.
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
export interface UseSkillActionOptions {
|
|
7
|
+
/** Store names this skill writes to (for context in the prompt). */
|
|
8
|
+
stores?: string[];
|
|
9
|
+
/** Whether to include a confirmation hint in the prompt. */
|
|
10
|
+
confirm?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface UseSkillActionReturn {
|
|
13
|
+
/** Execute the skill with the given parameters. */
|
|
14
|
+
execute: (params?: Record<string, unknown>) => void;
|
|
15
|
+
/** Whether the skill is currently running. */
|
|
16
|
+
loading: boolean;
|
|
17
|
+
/** The text result from the skill execution. */
|
|
18
|
+
result: string | null;
|
|
19
|
+
/** Error message if execution failed. */
|
|
20
|
+
error: string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Invoke a skill via the chat agent.
|
|
24
|
+
*
|
|
25
|
+
* Under the hood, this sends a structured chat message asking the agent
|
|
26
|
+
* to run the skill, then collects the text response.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const investigate = useSkillAction('deep-investigator', {
|
|
31
|
+
* stores: ['active-alerts', 'incident-correlations'],
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* <button onClick={() => investigate.execute({ correlationId: '123' })}>
|
|
35
|
+
* Investigate
|
|
36
|
+
* </button>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function useSkillAction(skillName: string, options?: UseSkillActionOptions): UseSkillActionReturn;
|
|
40
|
+
//# sourceMappingURL=useSkillAction.d.ts.map
|