@peers-app/peers-ui 0.25.21 → 0.26.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/dist/mention-configs.d.ts +7 -0
- package/dist/mention-configs.js +8 -2
- package/dist/screens/assistants/assistant-config.d.ts +1 -0
- package/dist/screens/assistants/assistant-config.js +20 -3
- package/dist/screens/assistants/assistant-config.test.d.ts +1 -0
- package/dist/screens/assistants/assistant-config.test.js +57 -0
- package/dist/screens/settings/settings-page.js +1 -59
- package/dist/screens/settings/settings-page.test.d.ts +1 -0
- package/dist/screens/settings/settings-page.test.js +19 -0
- package/dist/screens/tools/tool-catalog-ipc.d.ts +118 -0
- package/dist/screens/tools/tool-catalog-ipc.js +48 -0
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +1 -0
- package/dist/screens/tools/tool-catalog-ipc.test.js +46 -0
- package/dist/screens/tools/tool-details.d.ts +3 -4
- package/dist/screens/tools/tool-details.js +14 -33
- package/dist/screens/tools/tool-info.d.ts +5 -4
- package/dist/screens/tools/tool-info.js +10 -30
- package/dist/screens/tools/tool-list.d.ts +1 -0
- package/dist/screens/tools/tool-list.js +2 -26
- package/dist/screens/tools/tool-schema.d.ts +5 -3
- package/dist/screens/tools/tool-schema.js +5 -14
- package/package.json +3 -3
- package/src/mention-configs.ts +9 -5
- package/src/screens/assistants/assistant-config.test.tsx +54 -0
- package/src/screens/assistants/assistant-config.tsx +42 -11
- package/src/screens/settings/settings-page.test.tsx +24 -0
- package/src/screens/settings/settings-page.tsx +1 -255
- package/src/screens/tools/tool-catalog-ipc.test.ts +46 -0
- package/src/screens/tools/tool-catalog-ipc.ts +51 -0
- package/src/screens/tools/tool-details.tsx +18 -67
- package/src/screens/tools/tool-info.tsx +39 -53
- package/src/screens/tools/tool-list.tsx +4 -37
- package/src/screens/tools/tool-schema.tsx +40 -45
- package/dist/screens/tools/tool-code.d.ts +0 -4
- package/dist/screens/tools/tool-code.js +0 -28
- package/src/screens/tools/tool-code.tsx +0 -30
|
@@ -1,49 +1,44 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type IDoc,
|
|
3
|
-
type IOSchema,
|
|
4
|
-
IOSchemaType,
|
|
5
|
-
type ITool,
|
|
6
|
-
type Observable,
|
|
7
|
-
} from "@peers-app/peers-sdk";
|
|
8
|
-
import { IOSchemaEditor } from "../../components/io-schema";
|
|
9
|
-
import { useObservable } from "../../hooks";
|
|
10
|
-
|
|
11
|
-
export const ToolSchema = (props: { tool: IDoc<ITool> }) => {
|
|
12
|
-
const { tool } = props;
|
|
13
|
-
|
|
14
|
-
useObservable(tool.qs.isAssistantRunner);
|
|
15
|
-
|
|
16
|
-
if (tool.isAssistantRunner && !tool.configSchema) {
|
|
17
|
-
tool.configSchema = {
|
|
18
|
-
type: IOSchemaType.complex,
|
|
19
|
-
fields: [],
|
|
20
|
-
};
|
|
21
|
-
}
|
|
1
|
+
import type { IOSchema, ITool, IToolCatalogEntry } from "@peers-app/peers-sdk";
|
|
22
2
|
|
|
3
|
+
function FieldTable({ label, schema }: { label: string; schema?: IOSchema }) {
|
|
23
4
|
return (
|
|
24
|
-
<
|
|
25
|
-
{
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
5
|
+
<section className="mb-4">
|
|
6
|
+
<h6>{label}</h6>
|
|
7
|
+
{!schema?.fields.length ? (
|
|
8
|
+
<p>No fields</p>
|
|
9
|
+
) : (
|
|
10
|
+
<table className="table table-sm">
|
|
11
|
+
<thead>
|
|
12
|
+
<tr>
|
|
13
|
+
<th>Name</th>
|
|
14
|
+
<th>Type</th>
|
|
15
|
+
<th>Required</th>
|
|
16
|
+
<th>Description</th>
|
|
17
|
+
</tr>
|
|
18
|
+
</thead>
|
|
19
|
+
<tbody>
|
|
20
|
+
{schema.fields.map((field) => (
|
|
21
|
+
<tr key={field.name}>
|
|
22
|
+
<td>{field.name}</td>
|
|
23
|
+
<td>
|
|
24
|
+
{field.type}
|
|
25
|
+
{field.isArray ? "[]" : ""}
|
|
26
|
+
</td>
|
|
27
|
+
<td>{field.optional ? "No" : "Yes"}</td>
|
|
28
|
+
<td>{field.description}</td>
|
|
29
|
+
</tr>
|
|
30
|
+
))}
|
|
31
|
+
</tbody>
|
|
32
|
+
</table>
|
|
36
33
|
)}
|
|
37
|
-
|
|
38
|
-
<span style={{ width: "130px", display: "inline-block" }} className="fw-bold">
|
|
39
|
-
Input Schema:
|
|
40
|
-
</span>
|
|
41
|
-
<IOSchemaEditor ioSchema={tool.qs.inputSchema} simpleValueName="input" />
|
|
42
|
-
|
|
43
|
-
<span style={{ width: "130px", display: "inline-block" }} className="mt-4 fw-bold">
|
|
44
|
-
Output Schema:
|
|
45
|
-
</span>
|
|
46
|
-
<IOSchemaEditor ioSchema={tool.qs.outputSchema} simpleValueName="output" />
|
|
47
|
-
</div>
|
|
34
|
+
</section>
|
|
48
35
|
);
|
|
49
|
-
}
|
|
36
|
+
}
|
|
37
|
+
/** Read-only contract field tables, plus persisted assistant runner configuration. */
|
|
38
|
+
export const ToolSchema = ({ tool, entry }: { tool: ITool; entry?: IToolCatalogEntry }) => (
|
|
39
|
+
<div>
|
|
40
|
+
{tool.isAssistantRunner && <FieldTable label="Config Schema" schema={tool.configSchema} />}
|
|
41
|
+
<FieldTable label="Input Schema" schema={entry?.inputSchema ?? tool.inputSchema} />
|
|
42
|
+
<FieldTable label="Output Schema" schema={entry?.outputSchema ?? tool.outputSchema} />
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ToolCode = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const peers_sdk_1 = require("@peers-app/peers-sdk");
|
|
6
|
-
const editor_inline_1 = require("../../components/markdown-editor/editor-inline");
|
|
7
|
-
const ToolCode = (props) => {
|
|
8
|
-
const { tool } = props;
|
|
9
|
-
let code = tool.qs.code() ?? "";
|
|
10
|
-
const toolCodeObs = (0, peers_sdk_1.computed)({
|
|
11
|
-
read: () => {
|
|
12
|
-
if (!code.startsWith("```")) {
|
|
13
|
-
code = `\`\`\`javascript\n${code}\n\`\`\``;
|
|
14
|
-
}
|
|
15
|
-
return code;
|
|
16
|
-
},
|
|
17
|
-
write: (newCode) => {
|
|
18
|
-
code = newCode;
|
|
19
|
-
if (code.startsWith("```javascript\n")) {
|
|
20
|
-
code = code.replace("```javascript\n", "");
|
|
21
|
-
code = code.replace("\n```", "");
|
|
22
|
-
}
|
|
23
|
-
tool.qs.code(code);
|
|
24
|
-
},
|
|
25
|
-
});
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(editor_inline_1.MarkdownEditorInline, { value: toolCodeObs, hideToolbar: true }) }));
|
|
27
|
-
};
|
|
28
|
-
exports.ToolCode = ToolCode;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { computed, type IDoc, type ITool, type Observable } from "@peers-app/peers-sdk";
|
|
2
|
-
import { MarkdownEditorInline } from "../../components/markdown-editor/editor-inline";
|
|
3
|
-
|
|
4
|
-
export const ToolCode = (props: { tool: IDoc<ITool> }) => {
|
|
5
|
-
const { tool } = props;
|
|
6
|
-
|
|
7
|
-
let code = tool.qs.code() ?? "";
|
|
8
|
-
const toolCodeObs = computed({
|
|
9
|
-
read: () => {
|
|
10
|
-
if (!code.startsWith("```")) {
|
|
11
|
-
code = `\`\`\`javascript\n${code}\n\`\`\``;
|
|
12
|
-
}
|
|
13
|
-
return code;
|
|
14
|
-
},
|
|
15
|
-
write: (newCode: string) => {
|
|
16
|
-
code = newCode;
|
|
17
|
-
if (code.startsWith("```javascript\n")) {
|
|
18
|
-
code = code.replace("```javascript\n", "");
|
|
19
|
-
code = code.replace("\n```", "");
|
|
20
|
-
}
|
|
21
|
-
tool.qs.code(code);
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div>
|
|
27
|
-
<MarkdownEditorInline value={toolCodeObs as Observable<string>} hideToolbar={true} />
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
};
|