@assistant-ui/core 0.1.1 → 0.1.2
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/react/RuntimeAdapter.js +4 -1
- package/dist/react/RuntimeAdapter.js.map +1 -1
- package/dist/react/model-context/toolbox.d.ts +7 -1
- package/dist/react/model-context/toolbox.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/react/RuntimeAdapter.ts +5 -1
- package/src/react/model-context/toolbox.ts +7 -3
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { resource, tapResource } from "@assistant-ui/tap";
|
|
2
2
|
import { RuntimeAdapterResource, baseRuntimeAdapterTransformScopes, } from "../store/internal.js";
|
|
3
3
|
import { attachTransformScopes } from "@assistant-ui/store";
|
|
4
|
-
import { Tools } from "./model-context/index.js";
|
|
4
|
+
import { DataRenderers, Tools } from "./model-context/index.js";
|
|
5
5
|
export const RuntimeAdapter = resource((runtime) => tapResource(RuntimeAdapterResource(runtime)));
|
|
6
6
|
attachTransformScopes(RuntimeAdapter, (scopes, parent) => {
|
|
7
7
|
const result = baseRuntimeAdapterTransformScopes(scopes, parent);
|
|
8
8
|
if (!result.tools && parent.tools.source === null) {
|
|
9
9
|
result.tools = Tools({});
|
|
10
10
|
}
|
|
11
|
+
if (!result.dataRenderers && parent.dataRenderers.source === null) {
|
|
12
|
+
result.dataRenderers = DataRenderers();
|
|
13
|
+
}
|
|
11
14
|
return result;
|
|
12
15
|
});
|
|
13
16
|
//# sourceMappingURL=RuntimeAdapter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuntimeAdapter.js","sourceRoot":"","sources":["../../src/react/RuntimeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,6BAA0B;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,iCAAwB;
|
|
1
|
+
{"version":3,"file":"RuntimeAdapter.js","sourceRoot":"","sources":["../../src/react/RuntimeAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACL,sBAAsB,EACtB,iCAAiC,GAClC,6BAA0B;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,iCAAwB;AAEvD,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC,CAAC,OAAyB,EAAE,EAAE,CACnE,WAAW,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAC7C,CAAC;AAEF,qBAAqB,CAAC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE;IACvD,MAAM,MAAM,GAAG,iCAAiC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAClD,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;QAClE,MAAM,CAAC,aAAa,GAAG,aAAa,EAAE,CAAC;IACzC,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { Tool } from "assistant-stream";
|
|
2
2
|
import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes.js";
|
|
3
|
-
|
|
3
|
+
type WithRender<T, TArgs extends Record<string, unknown>, TResult> = T extends {
|
|
4
|
+
type: "frontend" | "human";
|
|
5
|
+
} ? T & {
|
|
6
|
+
render: ToolCallMessagePartComponent<TArgs, TResult>;
|
|
7
|
+
} : T & {
|
|
4
8
|
render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;
|
|
5
9
|
};
|
|
10
|
+
export type ToolDefinition<TArgs extends Record<string, unknown>, TResult> = WithRender<Tool<TArgs, TResult>, TArgs, TResult>;
|
|
6
11
|
export type Toolkit = Record<string, ToolDefinition<any, any>>;
|
|
7
12
|
export type ToolsConfig = {
|
|
8
13
|
toolkit: Toolkit;
|
|
9
14
|
};
|
|
15
|
+
export {};
|
|
10
16
|
//# sourceMappingURL=toolbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../../src/react/model-context/toolbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,4BAA4B,EAAE,8CAA2C;AAEvF,
|
|
1
|
+
{"version":3,"file":"toolbox.d.ts","sourceRoot":"","sources":["../../../src/react/model-context/toolbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,KAAK,EAAE,4BAA4B,EAAE,8CAA2C;AAEvF,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,IAAI,CAAC,SAAS;IAC7E,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;CAC5B,GACG,CAAC,GAAG;IAAE,MAAM,EAAE,4BAA4B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;CAAE,GAC5D,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,4BAA4B,CAAC,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,cAAc,CACxB,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,OAAO,IACL,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
baseRuntimeAdapterTransformScopes,
|
|
6
6
|
} from "../store/internal";
|
|
7
7
|
import { attachTransformScopes } from "@assistant-ui/store";
|
|
8
|
-
import { Tools } from "./model-context";
|
|
8
|
+
import { DataRenderers, Tools } from "./model-context";
|
|
9
9
|
|
|
10
10
|
export const RuntimeAdapter = resource((runtime: AssistantRuntime) =>
|
|
11
11
|
tapResource(RuntimeAdapterResource(runtime)),
|
|
@@ -18,5 +18,9 @@ attachTransformScopes(RuntimeAdapter, (scopes, parent) => {
|
|
|
18
18
|
result.tools = Tools({});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
if (!result.dataRenderers && parent.dataRenderers.source === null) {
|
|
22
|
+
result.dataRenderers = DataRenderers();
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
return result;
|
|
22
26
|
});
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { Tool } from "assistant-stream";
|
|
2
2
|
import type { ToolCallMessagePartComponent } from "../types/MessagePartComponentTypes";
|
|
3
3
|
|
|
4
|
+
type WithRender<T, TArgs extends Record<string, unknown>, TResult> = T extends {
|
|
5
|
+
type: "frontend" | "human";
|
|
6
|
+
}
|
|
7
|
+
? T & { render: ToolCallMessagePartComponent<TArgs, TResult> }
|
|
8
|
+
: T & { render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined };
|
|
9
|
+
|
|
4
10
|
export type ToolDefinition<
|
|
5
11
|
TArgs extends Record<string, unknown>,
|
|
6
12
|
TResult,
|
|
7
|
-
> = Tool<TArgs, TResult
|
|
8
|
-
render?: ToolCallMessagePartComponent<TArgs, TResult> | undefined;
|
|
9
|
-
};
|
|
13
|
+
> = WithRender<Tool<TArgs, TResult>, TArgs, TResult>;
|
|
10
14
|
|
|
11
15
|
export type Toolkit = Record<string, ToolDefinition<any, any>>;
|
|
12
16
|
|