@agentuity/react 0.0.1
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/dist/context.d.ts +9 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/env.d.ts +2 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1288 -0
- package/dist/run.d.ts +31 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/url.d.ts +3 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/websocket.d.ts +34 -0
- package/dist/websocket.d.ts.map +1 -0
- package/package.json +36 -0
package/dist/run.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InferInput, InferOutput } from '@agentuity/core';
|
|
2
|
+
import type { AgentName, AgentRegistry } from './types';
|
|
3
|
+
interface RunArgs {
|
|
4
|
+
/**
|
|
5
|
+
* Optional query parameters to append to the URL
|
|
6
|
+
*/
|
|
7
|
+
query?: URLSearchParams;
|
|
8
|
+
/**
|
|
9
|
+
* Optional headers to send with the request
|
|
10
|
+
*/
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
/**
|
|
13
|
+
* Optional subpath to append to the agent path (such as /agent/:agent_name/:subpath)
|
|
14
|
+
*/
|
|
15
|
+
subpath?: string;
|
|
16
|
+
/**
|
|
17
|
+
* HTTP method to use (default: POST)
|
|
18
|
+
*/
|
|
19
|
+
method?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional AbortSignal to cancel the request
|
|
22
|
+
*/
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}
|
|
25
|
+
interface UseAgentResponse<TInput, TOutput> {
|
|
26
|
+
data?: TOutput;
|
|
27
|
+
run: (input: TInput, options?: RunArgs) => Promise<TOutput>;
|
|
28
|
+
}
|
|
29
|
+
export declare const useAgent: <TName extends AgentName, TInput = TName extends keyof AgentRegistry ? InferInput<AgentRegistry[TName]["inputSchema"]> : never, TOutput = TName extends keyof AgentRegistry ? InferOutput<AgentRegistry[TName]["outputSchema"]> : never>(name: TName) => UseAgentResponse<TInput, TOutput>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../src/run.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,UAAU,OAAO;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,gBAAgB,CAAC,MAAM,EAAE,OAAO;IACzC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5D;AAED,eAAO,MAAM,QAAQ,GACpB,KAAK,SAAS,SAAS,EACvB,MAAM,GAAG,KAAK,SAAS,MAAM,aAAa,GACvC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,GAC/C,KAAK,EACR,OAAO,GAAG,KAAK,SAAS,MAAM,aAAa,GACxC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,GACjD,KAAK,EAER,MAAM,KAAK,KACT,gBAAgB,CAAC,MAAM,EAAE,OAAO,CA4ClC,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StandardSchemaV1 } from '@agentuity/core';
|
|
2
|
+
/**
|
|
3
|
+
* Agent definition interface
|
|
4
|
+
*/
|
|
5
|
+
export interface Agent<TInput extends StandardSchemaV1 = StandardSchemaV1, TOutput extends StandardSchemaV1 = StandardSchemaV1> {
|
|
6
|
+
inputSchema: TInput;
|
|
7
|
+
outputSchema: TOutput;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Registry of all agents in the project.
|
|
11
|
+
* This interface is designed to be augmented by generated code in the user's project.
|
|
12
|
+
*
|
|
13
|
+
* Example usage in generated code (.agentuity/types.d.ts):
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import type { Agent } from '@agentuity/react';
|
|
16
|
+
* import type { MyInputSchema, MyOutputSchema } from './schemas';
|
|
17
|
+
*
|
|
18
|
+
* declare module '@agentuity/react' {
|
|
19
|
+
* interface AgentRegistry {
|
|
20
|
+
* 'my-agent': Agent<MyInputSchema, MyOutputSchema>;
|
|
21
|
+
* 'another-agent': Agent<AnotherInput, AnotherOutput>;
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export interface AgentRegistry {
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Union type of all registered agent names.
|
|
30
|
+
* Falls back to `string` when AgentRegistry is empty (before augmentation).
|
|
31
|
+
* After augmentation, this becomes a strict union of agent names for full type safety.
|
|
32
|
+
*/
|
|
33
|
+
export type AgentName = keyof AgentRegistry extends never ? string : keyof AgentRegistry;
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,KAAK,CACrB,MAAM,SAAS,gBAAgB,GAAG,gBAAgB,EAClD,OAAO,SAAS,gBAAgB,GAAG,gBAAgB;IAEnD,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,WAAW,aAAa;CAAG;AAEjC;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,aAAa,SAAS,KAAK,GAAG,MAAM,GAAG,MAAM,aAAa,CAAC"}
|
package/dist/url.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../src/url.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,GACpB,MAAM,MAAM,EACZ,MAAM,MAAM,EACZ,UAAU,MAAM,EAChB,QAAQ,eAAe,KACrB,MAWF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAIL,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { InferInput, InferOutput } from '@agentuity/core';
|
|
2
|
+
import type { AgentName, AgentRegistry } from './types';
|
|
3
|
+
type onMessageHandler<T = unknown> = (data: T) => void;
|
|
4
|
+
interface WebsocketArgs {
|
|
5
|
+
/**
|
|
6
|
+
* Optional query parameters to append to the websocket URL
|
|
7
|
+
*/
|
|
8
|
+
query?: URLSearchParams;
|
|
9
|
+
/**
|
|
10
|
+
* Optional subpath to append to the agent path (such as /agent/:agent_name/:subpath)
|
|
11
|
+
*/
|
|
12
|
+
subpath?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional AbortSignal to cancel the websocket connection
|
|
15
|
+
*/
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
}
|
|
18
|
+
interface WebsocketResponse<TInput, TOutput> {
|
|
19
|
+
connected: boolean;
|
|
20
|
+
send: (data: TInput) => void;
|
|
21
|
+
setHandler: (handler: onMessageHandler<TOutput>) => void;
|
|
22
|
+
readyState: WebSocket['readyState'];
|
|
23
|
+
close: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const useWebsocket: <TInput, TOutput>(path: string, options?: WebsocketArgs) => WebsocketResponse<TInput, TOutput>;
|
|
26
|
+
interface UseAgentWebsocketResponse<TInput, TOutput> extends Omit<WebsocketResponse<TInput, TOutput>, 'setHandler'> {
|
|
27
|
+
/**
|
|
28
|
+
* Data received from the agent via WebSocket
|
|
29
|
+
*/
|
|
30
|
+
data?: TOutput;
|
|
31
|
+
}
|
|
32
|
+
export declare const useAgentWebsocket: <TName extends AgentName, TInput = TName extends keyof AgentRegistry ? InferInput<AgentRegistry[TName]["inputSchema"]> : never, TOutput = TName extends keyof AgentRegistry ? InferOutput<AgentRegistry[TName]["outputSchema"]> : never>(agent: AgentName, options?: WebsocketArgs) => UseAgentWebsocketResponse<TInput, TOutput>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG/D,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExD,KAAK,gBAAgB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;AAEvD,UAAU,aAAa;IACtB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB;AA8BD,UAAU,iBAAiB,CAAC,MAAM,EAAE,OAAO;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,UAAU,EAAE,CAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,IAAI,CAAC;CAClB;AAED,eAAO,MAAM,YAAY,GAAI,MAAM,EAAE,OAAO,EAC3C,MAAM,MAAM,EACZ,UAAU,aAAa,KACrB,iBAAiB,CAAC,MAAM,EAAE,OAAO,CA4GnC,CAAC;AAEF,UAAU,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAClD,SAAQ,IAAI,CAAC,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,CAAC;IAC9D;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CACf;AAED,eAAO,MAAM,iBAAiB,GAC7B,KAAK,SAAS,SAAS,EACvB,MAAM,GAAG,KAAK,SAAS,MAAM,aAAa,GACvC,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,CAAC,GAC/C,KAAK,EACR,OAAO,GAAG,KAAK,SAAS,MAAM,aAAa,GACxC,WAAW,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,CAAC,GACjD,KAAK,EAER,OAAO,SAAS,EAChB,UAAU,aAAa,KACrB,yBAAyB,CAAC,MAAM,EAAE,OAAO,CAkB3C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agentuity/react",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"clean": "rm -rf dist",
|
|
18
|
+
"build": "bun build --target browser --outdir dist src/index.ts && bunx tsc --build --force",
|
|
19
|
+
"typecheck": "bunx tsc --noEmit",
|
|
20
|
+
"prepublishOnly": "bun run clean && bun run build"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@agentuity/core": "workspace:*"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/react": "^19.0.0",
|
|
27
|
+
"react": "^19.0.0",
|
|
28
|
+
"typescript": "^5.9.0"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"react": "^18.0.0 || ^19.0.0"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
}
|
|
36
|
+
}
|