@dxos/plugin-automation 0.7.4-staging.f7e8224 → 0.7.5-main.937ce75
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/lib/browser/{AssistantPanel-N3QSALKY.mjs → AssistantPanel-32FH2RA6.mjs} +2 -4
- package/dist/lib/browser/{AssistantPanel-N3QSALKY.mjs.map → AssistantPanel-32FH2RA6.mjs.map} +2 -2
- package/dist/lib/browser/{AutomationPanel-AQMN2CQR.mjs → AutomationPanel-6FUIFUQJ.mjs} +49 -26
- package/dist/lib/browser/AutomationPanel-6FUIFUQJ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7KB4UMXO.mjs → chunk-DN5M2QL5.mjs} +3 -3
- package/dist/lib/browser/{chunk-7KB4UMXO.mjs.map → chunk-DN5M2QL5.mjs.map} +2 -2
- package/dist/lib/browser/index.mjs +29 -40
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types/index.mjs +1 -1
- package/dist/lib/node/{AssistantPanel-RIA4TI3B.cjs → AssistantPanel-XANI7YNV.cjs} +5 -7
- package/dist/lib/node/{AssistantPanel-RIA4TI3B.cjs.map → AssistantPanel-XANI7YNV.cjs.map} +2 -2
- package/dist/lib/node/{AutomationPanel-HZS5WKI5.cjs → AutomationPanel-2UGSAIXU.cjs} +54 -31
- package/dist/lib/node/AutomationPanel-2UGSAIXU.cjs.map +7 -0
- package/dist/lib/node/{chunk-CUCUWUAF.cjs → chunk-NIL4TP6U.cjs} +5 -5
- package/dist/lib/node/{chunk-CUCUWUAF.cjs.map → chunk-NIL4TP6U.cjs.map} +2 -2
- package/dist/lib/node/index.cjs +57 -68
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/types/index.cjs +6 -6
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{AssistantPanel-72YH43CH.mjs → AssistantPanel-5M6O6JV7.mjs} +2 -4
- package/dist/lib/node-esm/{AssistantPanel-72YH43CH.mjs.map → AssistantPanel-5M6O6JV7.mjs.map} +2 -2
- package/dist/lib/node-esm/{AutomationPanel-JUHOWQWW.mjs → AutomationPanel-72C2JRLV.mjs} +49 -26
- package/dist/lib/node-esm/AutomationPanel-72C2JRLV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-23LY7DYS.mjs → chunk-GCHXTXVT.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-23LY7DYS.mjs.map → chunk-GCHXTXVT.mjs.map} +2 -2
- package/dist/lib/node-esm/index.mjs +29 -40
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/types/index.mjs +1 -1
- package/dist/types/src/AutomationPlugin.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.d.ts.map +1 -1
- package/dist/types/src/components/AutomationPanel/AutomationPanel.stories.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.d.ts.map +1 -1
- package/dist/types/src/components/TriggerEditor/TriggerEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/email.d.ts.map +1 -1
- package/dist/types/src/hooks/invocation-handler.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +31 -39
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +38 -38
- package/src/AutomationPlugin.tsx +20 -22
- package/src/components/AssistantPanel/AssistantPanel.tsx +1 -1
- package/src/components/AutomationPanel/AutomationPanel.stories.tsx +1 -2
- package/src/components/AutomationPanel/AutomationPanel.tsx +61 -29
- package/src/components/PromptEditor/PromptEditor.stories.tsx +3 -3
- package/src/components/TriggerEditor/TriggerEditor.stories.tsx +1 -2
- package/src/components/TriggerEditor/TriggerEditor.tsx +9 -3
- package/src/hooks/email.ts +2 -2
- package/src/hooks/invocation-handler.ts +2 -2
- package/src/translations.ts +1 -0
- package/src/types/schema.ts +2 -2
- package/dist/lib/browser/AutomationPanel-AQMN2CQR.mjs.map +0 -7
- package/dist/lib/node/AutomationPanel-HZS5WKI5.cjs.map +0 -7
- package/dist/lib/node-esm/AutomationPanel-JUHOWQWW.mjs.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/AutomationPanel/AutomationPanel.tsx", "../../../src/components/TriggerEditor/TriggerEditor.tsx", "../../../src/components/AutomationPanel/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { S } from '@dxos/echo-schema';\nimport {\n FunctionType,\n FunctionTrigger,\n FunctionTriggerSchema,\n TriggerKind,\n type FunctionTriggerType,\n ScriptType,\n} from '@dxos/functions';\nimport { type Client, useClient } from '@dxos/react-client';\nimport { create, Filter, useQuery, type Space, type ReactiveObject, getSpace } from '@dxos/react-client/echo';\nimport { IconButton, Input, useTranslation, Button } from '@dxos/react-ui';\nimport { List } from '@dxos/react-ui-list';\nimport { ghostHover, mx } from '@dxos/react-ui-theme';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\nimport { TriggerEditor, type TriggerEditorProps } from '../TriggerEditor';\n\nconst grid = 'grid grid-cols-[40px_1fr_32px] min-bs-[2.5rem]';\n\nexport type AutomationPanelProps = {\n space: Space;\n object?: ReactiveObject<any>;\n};\n\n// TODO(burdon): Factor out common layout with ViewEditor.\nexport const AutomationPanel = ({ space, object }: AutomationPanelProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const client = useClient();\n const triggers = useQuery(space, Filter.schema(FunctionTrigger));\n const functions = useQuery(space, Filter.schema(FunctionType));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n\n const [trigger, setTrigger] = useState<FunctionTriggerType>();\n const [selected, setSelected] = useState<FunctionTrigger>();\n\n const handleSelect = (trigger: FunctionTrigger) => {\n const { id: _, ...values } = trigger;\n setTrigger(values);\n setSelected(trigger);\n };\n\n const handleAdd = () => {\n setTrigger(create(FunctionTriggerSchema, {}));\n setSelected(undefined);\n };\n\n const handleDelete = (trigger: FunctionTrigger) => {\n space.db.remove(trigger);\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleSave: TriggerEditorProps['onSave'] = (trigger) => {\n if (selected) {\n Object.assign(selected, trigger);\n } else {\n const automationTargetId = object?.id;\n space.db.add(\n create(\n FunctionTrigger,\n automationTargetId ? { ...trigger, meta: { ...trigger.meta, automationTargetId } } : trigger,\n ),\n );\n }\n\n setTrigger(undefined);\n setSelected(undefined);\n };\n\n const handleCancel: TriggerEditorProps['onCancel'] = () => {\n setTrigger(undefined);\n };\n\n return (\n <div className='flex flex-col w-full divide-y divide-separator overflow-y-auto'>\n <List.Root<FunctionTrigger> items={triggers} isItem={S.is(FunctionTrigger)} getId={(field) => field.id}>\n {({ items: triggers }) => (\n <div role='list' className='flex flex-col w-full'>\n {triggers?.map((trigger) => {\n const copyAction = getCopyAction(client, trigger);\n return (\n <List.Item<FunctionTrigger>\n key={trigger.id}\n item={trigger}\n classNames={mx(grid, ghostHover, 'items-center')}\n >\n <Input.Root>\n <Input.Switch\n checked={trigger.enabled}\n onCheckedChange={(checked) => (trigger.enabled = checked)}\n />\n </Input.Root>\n\n <div className={'flex'}>\n <List.ItemTitle classNames='px-2 cursor-pointer w-0 shrink' onClick={() => handleSelect(trigger)}>\n {getFunctionName(scripts, functions, trigger)}\n </List.ItemTitle>\n\n {/* TODO: a better way to expose URL copy action */}\n {copyAction && (\n <Button onClick={() => navigator.clipboard.writeText(copyAction.contentProvider())}>\n {copyAction.text}\n </Button>\n )}\n </div>\n\n <List.ItemDeleteButton onClick={() => handleDelete(trigger)} />\n </List.Item>\n );\n })}\n </div>\n )}\n </List.Root>\n\n {trigger && (\n <TriggerEditor\n space={space}\n storedTrigger={selected}\n trigger={trigger}\n onSave={handleSave}\n onCancel={handleCancel}\n />\n )}\n\n {!trigger && (\n <div className='flex p-2 justify-center'>\n <IconButton icon='ph--plus--regular' label={t('new trigger')} onClick={handleAdd} />\n </div>\n )}\n </div>\n );\n};\n\nconst getCopyAction = (client: Client, trigger: FunctionTrigger | undefined) => {\n if (trigger?.spec?.type === TriggerKind.Email) {\n return { text: 'Copy Email', contentProvider: () => `${getSpace(trigger)!.id}@dxos.network` };\n }\n\n if (trigger?.spec?.type === TriggerKind.Webhook) {\n return { text: 'Copy URL', contentProvider: () => getWebhookUrl(client, trigger) };\n }\n\n return undefined;\n};\n\nconst getWebhookUrl = (client: Client, trigger: FunctionTrigger) => {\n const spaceId = getSpace(trigger)!.id;\n const edgeUrl = new URL(client.config.values.runtime!.services!.edge!.url!);\n const isSecure = edgeUrl.protocol.startsWith('https') || edgeUrl.protocol.startsWith('wss');\n edgeUrl.protocol = isSecure ? 'https' : 'http';\n return new URL(`/webhook/${spaceId}:${trigger.id}`, edgeUrl).toString();\n};\n\nconst getFunctionName = (scripts: ScriptType[], functions: FunctionType[], trigger: FunctionTriggerType) => {\n const functionObject = functions.find((fn) => fn.name === trigger.function);\n if (!functionObject) {\n return trigger.function;\n }\n return scripts.find((s) => functionObject.source?.target?.id === s.id)?.name ?? functionObject.name;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n FunctionType,\n FunctionTriggerSchema,\n type FunctionTriggerType,\n type FunctionTrigger,\n ScriptType,\n TriggerKind,\n} from '@dxos/functions';\nimport { Filter, useQuery, type Space } from '@dxos/react-client/echo';\nimport { useTranslation } from '@dxos/react-ui';\nimport { Form, SelectInput } from '@dxos/react-ui-form';\n\nimport { AUTOMATION_PLUGIN } from '../../meta';\n\nexport type TriggerEditorProps = {\n space: Space;\n trigger: FunctionTriggerType;\n storedTrigger?: FunctionTrigger;\n onSave?: (trigger: Omit<FunctionTrigger, 'id'>) => void;\n onCancel?: () => void;\n};\n\nexport const TriggerEditor = ({ space, trigger, onSave, onCancel, storedTrigger }: TriggerEditorProps) => {\n const { t } = useTranslation(AUTOMATION_PLUGIN);\n const functions = useQuery(space, Filter.schema(FunctionType));\n const scripts = useQuery(space, Filter.schema(ScriptType));\n\n const handleSave = (values: FunctionTriggerType) => {\n onSave?.(values);\n };\n\n return (\n <Form<FunctionTriggerType>\n schema={FunctionTriggerSchema}\n values={trigger}\n filter={(props) => props.filter((p) => p.name !== 'meta')}\n onSave={handleSave}\n onCancel={onCancel}\n Custom={{\n ['function' satisfies keyof FunctionTriggerType]: (props) => (\n <SelectInput<FunctionTriggerType>\n {...props}\n options={functions.map((fn) => ({\n value: fn.name,\n label: getFunctionName(scripts, fn),\n }))}\n />\n ),\n ['spec.type' as const]: (props) => (\n <SelectInput<FunctionTriggerType>\n {...props}\n options={Object.values(TriggerKind).map((kind) => ({\n value: kind,\n label: t(`trigger type ${kind}`),\n }))}\n />\n ),\n }}\n />\n );\n};\n\nconst getFunctionName = (scripts: ScriptType[], fn: FunctionType) => {\n return scripts.find((s) => fn.source?.target?.id === s.id)?.name ?? fn.name;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { AutomationPanel } from './AutomationPanel';\n\nexport default AutomationPanel;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAgC;AAEhC,yBAAkB;AAClB,uBAOO;AACP,0BAAuC;AACvC,kBAAoF;AACpF,sBAA0D;AAC1D,2BAAqB;AACrB,4BAA+B;ACf/B,IAAAA,gBAAkB;AAElB,IAAAC,oBAOO;AACP,IAAAC,eAA6C;AAC7C,IAAAC,mBAA+B;AAC/B,2BAAkC;AAY3B,IAAMC,gBAAgB,CAAC,EAAEC,OAAOC,SAASC,Q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aAAA;IAAgBoF,SAASpC;;AAKjF;AAEA,IAAMuB,gBAAgB,CAACjC,QAAgB1C,YAAAA;AACrC,MAAIA,SAASkG,MAAMC,SAASnE,iBAAAA,YAAYoE,OAAO;AAC7C,WAAO;MAAEN,MAAM;MAAcD,iBAAiB,MAAM,OAAGQ,sBAASrG,OAAAA,EAAUsC,EAAE;IAAgB;EAC9F;AAEA,MAAItC,SAASkG,MAAMC,SAASnE,iBAAAA,YAAYsE,SAAS;AAC/C,WAAO;MAAER,MAAM;MAAYD,iBAAiB,MAAMU,cAAc7D,QAAQ1C,OAAAA;IAAS;EACnF;AAEA,SAAOsD;AACT;AAEA,IAAMiD,gBAAgB,CAAC7D,QAAgB1C,YAAAA;AACrC,QAAMwG,cAAUH,sBAASrG,OAAAA,EAAUsC;AACnC,QAAMmE,UAAU,IAAIC,IAAIhE,OAAOiE,OAAO5F,OAAO6F,QAASC,SAAUC,KAAMC,GAAG;AACzE,QAAMC,WAAWP,QAAQQ,SAASC,WAAW,OAAA,KAAYT,QAAQQ,SAASC,WAAW,KAAA;AACrFT,UAAQQ,WAAWD,WAAW,UAAU;AACxC,SAAO,IAAIN,IAAI,YAAYF,OAAAA,IAAWxG,QAAQsC,EAAE,IAAImE,OAAAA,EAASU,SAAQ;AACvE;AAEA,IAAMrF,mBAAkB,CAAClB,SAAuBL,WAA2BP,YAAAA;AACzE,QAAMoH,iBAAiB7G,UAAU2B,KAAK,CAACP,OAAOA,GAAGL,SAAStB,QAAQqH,QAAQ;AAC1E,MAAI,CAACD,gBAAgB;AACnB,WAAOpH,QAAQqH;EACjB;AACA,SAAOzG,QAAQsB,KAAK,CAACC,MAAMiF,eAAehF,QAAQC,QAAQC,OAAOH,EAAEG,EAAE,GAAGhB,QAAQ8F,eAAe9F;AACjG;AEhKA,IAAA,0BAAekB;",
|
|
6
|
+
"names": ["import_react", "import_functions", "import_echo", "import_react_ui", "TriggerEditor", "space", "trigger", "onSave", "onCancel", "storedTrigger", "t", "useTranslation", "AUTOMATION_PLUGIN", "functions", "useQuery", "Filter", "schema", "FunctionType", "scripts", "ScriptType", "handleSave", "values", "React", "Form", "FunctionTriggerSchema", "filter", "props", "p", "name", "Custom", "SelectInput", "options", "map", "fn", "value", "label", "getFunctionName", "Object", "TriggerKind", "kind", "find", "s", "source", "target", "id", "grid", "AutomationPanel", "object", "client", "useClient", "triggers", "FunctionTrigger", "setTrigger", "useState", "selected", "setSelected", "handleSelect", "_", "handleAdd", "create", "undefined", "handleDelete", "db", "remove", "assign", "automationTargetId", "add", "meta", "handleCancel", "div", "className", "List", "Root", "items", "isItem", "S", "is", "getId", "field", "role", "copyAction", "getCopyAction", "Item", "key", "item", "classNames", "mx", "ghostHover", "Input", "Switch", "checked", "enabled", "onCheckedChange", "ItemTitle", "onClick", "Button", "navigator", "clipboard", "writeText", "contentProvider", "text", "ItemDeleteButton", "IconButton", "icon", "spec", "type", "Email", "getSpace", "Webhook", "getWebhookUrl", "spaceId", "edgeUrl", "URL", "config", "runtime", "services", "edge", "url", "isSecure", "protocol", "startsWith", "toString", "functionObject", "function"]
|
|
7
|
+
}
|
|
@@ -16,15 +16,15 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_NIL4TP6U_exports = {};
|
|
20
|
+
__export(chunk_NIL4TP6U_exports, {
|
|
21
21
|
AutomationAction: () => AutomationAction,
|
|
22
22
|
ChainInputSchema: () => ChainInputSchema,
|
|
23
23
|
ChainInputType: () => ChainInputType,
|
|
24
24
|
ChainPromptType: () => ChainPromptType,
|
|
25
25
|
ChainType: () => ChainType
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(chunk_NIL4TP6U_exports);
|
|
28
28
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
29
29
|
var ChainInputType;
|
|
30
30
|
(function(ChainInputType2) {
|
|
@@ -56,7 +56,7 @@ var ChainType = class extends (0, import_echo_schema.TypedObject)({
|
|
|
56
56
|
version: "0.1.0"
|
|
57
57
|
})({
|
|
58
58
|
name: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
59
|
-
prompts: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.
|
|
59
|
+
prompts: import_echo_schema.S.optional(import_echo_schema.S.mutable(import_echo_schema.S.Array((0, import_echo_schema.Ref)(ChainPromptType))))
|
|
60
60
|
}) {
|
|
61
61
|
};
|
|
62
62
|
var AutomationAction;
|
|
@@ -70,4 +70,4 @@ var AutomationAction;
|
|
|
70
70
|
ChainPromptType,
|
|
71
71
|
ChainType
|
|
72
72
|
});
|
|
73
|
-
//# sourceMappingURL=chunk-
|
|
73
|
+
//# sourceMappingURL=chunk-NIL4TP6U.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport {
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Ref, S, TypedObject } from '@dxos/echo-schema';\n\n// TODO(burdon): Change to S.Literal (and discriminated union).\nexport enum ChainInputType {\n VALUE = 0,\n PASS_THROUGH = 1,\n RETRIEVER = 2,\n FUNCTION = 3,\n QUERY = 4,\n RESOLVER = 5,\n CONTEXT = 6,\n SCHEMA = 7,\n}\n\nexport const ChainInputSchema = S.mutable(\n S.Struct({\n name: S.String,\n type: S.optional(S.Enums(ChainInputType)),\n value: S.optional(S.String),\n }),\n);\n\nexport type ChainInput = S.Schema.Type<typeof ChainInputSchema>;\n\nexport class ChainPromptType extends TypedObject({ typename: 'dxos.org/type/ChainPrompt', version: '0.1.0' })({\n command: S.optional(S.String),\n template: S.String,\n inputs: S.optional(S.mutable(S.Array(ChainInputSchema))),\n}) {}\n\nexport class ChainType extends TypedObject({ typename: 'dxos.org/type/Chain', version: '0.1.0' })({\n name: S.optional(S.String),\n prompts: S.optional(S.mutable(S.Array(Ref(ChainPromptType)))),\n}) {}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type {\n GraphBuilderProvides,\n IntentResolverProvides,\n MetadataRecordsProvides,\n SurfaceProvides,\n TranslationsProvides,\n} from '@dxos/app-framework';\nimport { type PanelProvides } from '@dxos/plugin-deck/types';\nimport { type SchemaProvides } from '@dxos/plugin-space';\n\n// import { AUTOMATION_PLUGIN } from '../meta';\n\n// const AUTOMATION_ACTION = `${AUTOMATION_PLUGIN}/action`;\n\nexport enum AutomationAction {}\n\nexport type AutomationPluginProvides = SurfaceProvides &\n IntentResolverProvides &\n MetadataRecordsProvides &\n TranslationsProvides &\n GraphBuilderProvides &\n SchemaProvides &\n PanelProvides;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAAoC;;UAGxBA,iBAAAA;;;;;;;;;GAAAA,mBAAAA,iBAAAA,CAAAA,EAAAA;AAWL,IAAMC,mBAAmBC,qBAAEC,QAChCD,qBAAEE,OAAO;EACPC,MAAMH,qBAAEI;EACRC,MAAML,qBAAEM,SAASN,qBAAEO,MAAMT,cAAAA,CAAAA;EACzBU,OAAOR,qBAAEM,SAASN,qBAAEI,MAAM;AAC5B,CAAA,CAAA;AAKK,IAAMK,kBAAN,kBAA8BC,gCAAY;EAAEC,UAAU;EAA6BC,SAAS;AAAQ,CAAA,EAAG;EAC5GC,SAASb,qBAAEM,SAASN,qBAAEI,MAAM;EAC5BU,UAAUd,qBAAEI;EACZW,QAAQf,qBAAEM,SAASN,qBAAEC,QAAQD,qBAAEgB,MAAMjB,gBAAAA,CAAAA,CAAAA;AACvC,CAAA,EAAA;AAAI;AAEG,IAAMkB,YAAN,kBAAwBP,gCAAY;EAAEC,UAAU;EAAuBC,SAAS;AAAQ,CAAA,EAAG;EAChGT,MAAMH,qBAAEM,SAASN,qBAAEI,MAAM;EACzBc,SAASlB,qBAAEM,SAASN,qBAAEC,QAAQD,qBAAEgB,UAAMG,wBAAIV,eAAAA,CAAAA,CAAAA,CAAAA;AAC5C,CAAA,EAAA;AAAI;;0BCnBQW,mBAAAA;AAAAA,GAAAA,qBAAAA,mBAAAA,CAAAA,EAAAA;",
|
|
6
|
-
"names": ["ChainInputType", "ChainInputSchema", "S", "mutable", "Struct", "name", "String", "type", "optional", "Enums", "value", "ChainPromptType", "TypedObject", "typename", "version", "command", "template", "inputs", "Array", "ChainType", "prompts", "
|
|
6
|
+
"names": ["ChainInputType", "ChainInputSchema", "S", "mutable", "Struct", "name", "String", "type", "optional", "Enums", "value", "ChainPromptType", "TypedObject", "typename", "version", "command", "template", "inputs", "Array", "ChainType", "prompts", "Ref", "AutomationAction"]
|
|
7
7
|
}
|
package/dist/lib/node/index.cjs
CHANGED
|
@@ -29,33 +29,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
var node_exports = {};
|
|
30
30
|
__export(node_exports, {
|
|
31
31
|
AssistantPanel: () => AssistantPanel,
|
|
32
|
-
AutomationAction: () =>
|
|
32
|
+
AutomationAction: () => import_chunk_NIL4TP6U.AutomationAction,
|
|
33
33
|
AutomationPanel: () => AutomationPanel,
|
|
34
34
|
AutomationPlugin: () => AutomationPlugin,
|
|
35
|
-
ChainInputSchema: () =>
|
|
36
|
-
ChainInputType: () =>
|
|
37
|
-
ChainPromptType: () =>
|
|
38
|
-
ChainType: () =>
|
|
35
|
+
ChainInputSchema: () => import_chunk_NIL4TP6U.ChainInputSchema,
|
|
36
|
+
ChainInputType: () => import_chunk_NIL4TP6U.ChainInputType,
|
|
37
|
+
ChainPromptType: () => import_chunk_NIL4TP6U.ChainPromptType,
|
|
38
|
+
ChainType: () => import_chunk_NIL4TP6U.ChainType,
|
|
39
39
|
chainPresets: () => chainPresets,
|
|
40
40
|
default: () => src_default,
|
|
41
41
|
str: () => str
|
|
42
42
|
});
|
|
43
43
|
module.exports = __toCommonJS(node_exports);
|
|
44
|
-
var
|
|
44
|
+
var import_chunk_NIL4TP6U = require("./chunk-NIL4TP6U.cjs");
|
|
45
45
|
var import_chunk_DTJ7XVO2 = require("./chunk-DTJ7XVO2.cjs");
|
|
46
46
|
var import_react = __toESM(require("react"));
|
|
47
47
|
var import_app_framework = require("@dxos/app-framework");
|
|
48
48
|
var import_functions = require("@dxos/functions");
|
|
49
49
|
var import_invariant = require("@dxos/invariant");
|
|
50
|
-
var
|
|
50
|
+
var import_types = require("@dxos/plugin-client/types");
|
|
51
51
|
var import_plugin_graph = require("@dxos/plugin-graph");
|
|
52
52
|
var import_plugin_space = require("@dxos/plugin-space");
|
|
53
53
|
var import_echo = require("@dxos/react-client/echo");
|
|
54
54
|
var import_react_ui_form = require("@dxos/react-ui-form");
|
|
55
55
|
var import_react2 = require("react");
|
|
56
56
|
var import_live_object = require("@dxos/live-object");
|
|
57
|
-
var AssistantPanel = (0, import_react2.lazy)(() => import("./AssistantPanel-
|
|
58
|
-
var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-
|
|
57
|
+
var AssistantPanel = (0, import_react2.lazy)(() => import("./AssistantPanel-XANI7YNV.cjs"));
|
|
58
|
+
var AutomationPanel = (0, import_react2.lazy)(() => import("./AutomationPanel-2UGSAIXU.cjs"));
|
|
59
59
|
var translations_default = [
|
|
60
60
|
{
|
|
61
61
|
"en-US": {
|
|
@@ -79,6 +79,7 @@ var translations_default = [
|
|
|
79
79
|
"trigger type webhook": "Webhook",
|
|
80
80
|
"trigger type websocket": "Websocket",
|
|
81
81
|
"trigger type subscription": "Subscription",
|
|
82
|
+
"trigger type email": "Email",
|
|
82
83
|
"trigger filter": "Filter",
|
|
83
84
|
"trigger cron": "Cron",
|
|
84
85
|
"trigger method": "Method",
|
|
@@ -96,7 +97,7 @@ var AutomationPlugin = () => {
|
|
|
96
97
|
provides: {
|
|
97
98
|
metadata: {
|
|
98
99
|
records: {
|
|
99
|
-
[
|
|
100
|
+
[import_chunk_NIL4TP6U.ChainType.typename]: {
|
|
100
101
|
placeholder: [
|
|
101
102
|
"object placeholder",
|
|
102
103
|
{
|
|
@@ -105,7 +106,7 @@ var AutomationPlugin = () => {
|
|
|
105
106
|
],
|
|
106
107
|
icon: "ph--magic-wand--regular",
|
|
107
108
|
// TODO(wittjosiah): Move out of metadata.
|
|
108
|
-
loadReferences: (chain) =>
|
|
109
|
+
loadReferences: async (chain) => await import_echo.RefArray.loadAll(chain.prompts ?? [])
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
},
|
|
@@ -115,8 +116,8 @@ var AutomationPlugin = () => {
|
|
|
115
116
|
],
|
|
116
117
|
echo: {
|
|
117
118
|
system: [
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
import_chunk_NIL4TP6U.ChainType,
|
|
120
|
+
import_chunk_NIL4TP6U.ChainPromptType,
|
|
120
121
|
import_functions.FunctionTrigger
|
|
121
122
|
]
|
|
122
123
|
},
|
|
@@ -146,13 +147,13 @@ var AutomationPlugin = () => {
|
|
|
146
147
|
},
|
|
147
148
|
graph: {
|
|
148
149
|
builder: (plugins) => {
|
|
149
|
-
const clientPlugin = (0, import_app_framework.resolvePlugin)(plugins,
|
|
150
|
+
const clientPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_types.parseClientPlugin);
|
|
150
151
|
const metadataPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseMetadataResolverPlugin);
|
|
151
152
|
const resolve = metadataPlugin?.provides.metadata.resolver;
|
|
152
153
|
const client = clientPlugin?.provides.client;
|
|
153
154
|
(0, import_invariant.invariant)(resolve, void 0, {
|
|
154
155
|
F: __dxlog_file,
|
|
155
|
-
L:
|
|
156
|
+
L: 67,
|
|
156
157
|
S: void 0,
|
|
157
158
|
A: [
|
|
158
159
|
"resolve",
|
|
@@ -161,7 +162,7 @@ var AutomationPlugin = () => {
|
|
|
161
162
|
});
|
|
162
163
|
(0, import_invariant.invariant)(client, void 0, {
|
|
163
164
|
F: __dxlog_file,
|
|
164
|
-
L:
|
|
165
|
+
L: 68,
|
|
165
166
|
S: void 0,
|
|
166
167
|
A: [
|
|
167
168
|
"client",
|
|
@@ -284,39 +285,27 @@ var AutomationPlugin = () => {
|
|
|
284
285
|
}
|
|
285
286
|
},
|
|
286
287
|
surface: {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
});
|
|
306
|
-
return /* @__PURE__ */ import_react.default.createElement(AutomationPanel, {
|
|
307
|
-
space,
|
|
308
|
-
object
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
break;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
288
|
+
definitions: () => [
|
|
289
|
+
(0, import_app_framework.createSurface)({
|
|
290
|
+
id: `${import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN}/assistant`,
|
|
291
|
+
role: "complementary--assistant",
|
|
292
|
+
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(AssistantPanel, {
|
|
293
|
+
subject: data.subject
|
|
294
|
+
})
|
|
295
|
+
}),
|
|
296
|
+
(0, import_app_framework.createSurface)({
|
|
297
|
+
id: `${import_chunk_DTJ7XVO2.AUTOMATION_PLUGIN}/automation`,
|
|
298
|
+
role: "complementary--automation",
|
|
299
|
+
filter: (data) => (0, import_echo.isEchoObject)(data.subject) && !!(0, import_echo.getSpace)(data.subject),
|
|
300
|
+
component: ({ data }) => /* @__PURE__ */ import_react.default.createElement(AutomationPanel, {
|
|
301
|
+
space: (0, import_echo.getSpace)(data.subject),
|
|
302
|
+
object: data.subject
|
|
303
|
+
})
|
|
304
|
+
})
|
|
305
|
+
]
|
|
316
306
|
},
|
|
317
307
|
intent: {
|
|
318
|
-
|
|
319
|
-
}
|
|
308
|
+
resolvers: () => []
|
|
320
309
|
}
|
|
321
310
|
}
|
|
322
311
|
};
|
|
@@ -326,7 +315,7 @@ var chainPresets = [
|
|
|
326
315
|
{
|
|
327
316
|
id: "dxos.org/prompt/translate",
|
|
328
317
|
title: "Translate",
|
|
329
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
318
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
330
319
|
command: "say",
|
|
331
320
|
template: str(
|
|
332
321
|
// prettier-ignore
|
|
@@ -338,12 +327,12 @@ var chainPresets = [
|
|
|
338
327
|
),
|
|
339
328
|
inputs: [
|
|
340
329
|
{
|
|
341
|
-
type:
|
|
330
|
+
type: import_chunk_NIL4TP6U.ChainInputType.VALUE,
|
|
342
331
|
name: "language",
|
|
343
332
|
value: "japanese"
|
|
344
333
|
},
|
|
345
334
|
{
|
|
346
|
-
type:
|
|
335
|
+
type: import_chunk_NIL4TP6U.ChainInputType.PASS_THROUGH,
|
|
347
336
|
name: "input"
|
|
348
337
|
}
|
|
349
338
|
]
|
|
@@ -352,7 +341,7 @@ var chainPresets = [
|
|
|
352
341
|
{
|
|
353
342
|
id: "dxos.org/prompt/chess",
|
|
354
343
|
title: "Chess",
|
|
355
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
344
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
356
345
|
command: "hint",
|
|
357
346
|
template: str(
|
|
358
347
|
// prettier-ignore
|
|
@@ -364,7 +353,7 @@ var chainPresets = [
|
|
|
364
353
|
),
|
|
365
354
|
inputs: [
|
|
366
355
|
{
|
|
367
|
-
type:
|
|
356
|
+
type: import_chunk_NIL4TP6U.ChainInputType.CONTEXT,
|
|
368
357
|
name: "history",
|
|
369
358
|
value: "object.pgn"
|
|
370
359
|
}
|
|
@@ -374,7 +363,7 @@ var chainPresets = [
|
|
|
374
363
|
{
|
|
375
364
|
id: "dxos.org/prompt/mermaid",
|
|
376
365
|
title: "Mermaid",
|
|
377
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
366
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
378
367
|
command: "draw",
|
|
379
368
|
template: str(
|
|
380
369
|
// prettier-ignore
|
|
@@ -387,7 +376,7 @@ var chainPresets = [
|
|
|
387
376
|
),
|
|
388
377
|
inputs: [
|
|
389
378
|
{
|
|
390
|
-
type:
|
|
379
|
+
type: import_chunk_NIL4TP6U.ChainInputType.PASS_THROUGH,
|
|
391
380
|
name: "input"
|
|
392
381
|
}
|
|
393
382
|
]
|
|
@@ -396,7 +385,7 @@ var chainPresets = [
|
|
|
396
385
|
{
|
|
397
386
|
id: "dxos.org/prompt/list",
|
|
398
387
|
title: "List",
|
|
399
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
388
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
400
389
|
command: "list",
|
|
401
390
|
template: str(
|
|
402
391
|
// prettier-ignore
|
|
@@ -413,12 +402,12 @@ var chainPresets = [
|
|
|
413
402
|
),
|
|
414
403
|
inputs: [
|
|
415
404
|
{
|
|
416
|
-
type:
|
|
405
|
+
type: import_chunk_NIL4TP6U.ChainInputType.SCHEMA,
|
|
417
406
|
name: "schema",
|
|
418
407
|
value: "example.com/type/project"
|
|
419
408
|
},
|
|
420
409
|
{
|
|
421
|
-
type:
|
|
410
|
+
type: import_chunk_NIL4TP6U.ChainInputType.PASS_THROUGH,
|
|
422
411
|
name: "question"
|
|
423
412
|
}
|
|
424
413
|
]
|
|
@@ -427,7 +416,7 @@ var chainPresets = [
|
|
|
427
416
|
{
|
|
428
417
|
id: "dxos.org/prompt/base",
|
|
429
418
|
title: "RAG",
|
|
430
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
419
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
431
420
|
command: "rag",
|
|
432
421
|
template: str(
|
|
433
422
|
// prettier-ignore
|
|
@@ -442,11 +431,11 @@ var chainPresets = [
|
|
|
442
431
|
),
|
|
443
432
|
inputs: [
|
|
444
433
|
{
|
|
445
|
-
type:
|
|
434
|
+
type: import_chunk_NIL4TP6U.ChainInputType.RETRIEVER,
|
|
446
435
|
name: "context"
|
|
447
436
|
},
|
|
448
437
|
{
|
|
449
|
-
type:
|
|
438
|
+
type: import_chunk_NIL4TP6U.ChainInputType.CONTEXT,
|
|
450
439
|
name: "question",
|
|
451
440
|
value: "object.text"
|
|
452
441
|
}
|
|
@@ -456,7 +445,7 @@ var chainPresets = [
|
|
|
456
445
|
{
|
|
457
446
|
id: "dxos.org/prompt/lookup",
|
|
458
447
|
title: "Lookup",
|
|
459
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
448
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
460
449
|
command: "lookup",
|
|
461
450
|
template: str(
|
|
462
451
|
// prettier-ignore
|
|
@@ -468,7 +457,7 @@ var chainPresets = [
|
|
|
468
457
|
),
|
|
469
458
|
inputs: [
|
|
470
459
|
{
|
|
471
|
-
type:
|
|
460
|
+
type: import_chunk_NIL4TP6U.ChainInputType.CONTEXT,
|
|
472
461
|
name: "input",
|
|
473
462
|
value: "text"
|
|
474
463
|
}
|
|
@@ -478,7 +467,7 @@ var chainPresets = [
|
|
|
478
467
|
{
|
|
479
468
|
id: "dxos.org/prompt/extract",
|
|
480
469
|
title: "Extract",
|
|
481
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
470
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
482
471
|
command: "extract",
|
|
483
472
|
template: str(
|
|
484
473
|
// prettier-ignore
|
|
@@ -496,17 +485,17 @@ var chainPresets = [
|
|
|
496
485
|
),
|
|
497
486
|
inputs: [
|
|
498
487
|
{
|
|
499
|
-
type:
|
|
488
|
+
type: import_chunk_NIL4TP6U.ChainInputType.SCHEMA,
|
|
500
489
|
name: "contact",
|
|
501
490
|
value: "example.com/type/contact"
|
|
502
491
|
},
|
|
503
492
|
{
|
|
504
|
-
type:
|
|
493
|
+
type: import_chunk_NIL4TP6U.ChainInputType.SCHEMA,
|
|
505
494
|
name: "company",
|
|
506
495
|
value: "example.com/type/organization"
|
|
507
496
|
},
|
|
508
497
|
{
|
|
509
|
-
type:
|
|
498
|
+
type: import_chunk_NIL4TP6U.ChainInputType.CONTEXT,
|
|
510
499
|
name: "input",
|
|
511
500
|
value: "text"
|
|
512
501
|
}
|
|
@@ -516,7 +505,7 @@ var chainPresets = [
|
|
|
516
505
|
{
|
|
517
506
|
id: "dxos.org/prompt/discord",
|
|
518
507
|
title: "Summarize",
|
|
519
|
-
createPrompt: () => (0, import_live_object.create)(
|
|
508
|
+
createPrompt: () => (0, import_live_object.create)(import_chunk_NIL4TP6U.ChainPromptType, {
|
|
520
509
|
command: "summarize",
|
|
521
510
|
template: str(
|
|
522
511
|
// prettier-ignore
|
|
@@ -528,7 +517,7 @@ var chainPresets = [
|
|
|
528
517
|
),
|
|
529
518
|
inputs: [
|
|
530
519
|
{
|
|
531
|
-
type:
|
|
520
|
+
type: import_chunk_NIL4TP6U.ChainInputType.RESOLVER,
|
|
532
521
|
name: "context",
|
|
533
522
|
value: "discord.messages.recent"
|
|
534
523
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/AutomationPlugin.tsx", "../../../src/components/index.ts", "../../../src/translations.ts", "../../../src/presets.ts", "../../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { parseMetadataResolverPlugin, type PluginDefinition, resolvePlugin } from '@dxos/app-framework';\nimport { FunctionTrigger } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { parseClientPlugin } from '@dxos/plugin-client';\nimport { createExtension, toSignal } from '@dxos/plugin-graph';\nimport { memoizeQuery } from '@dxos/plugin-space';\nimport {\n getSpace,\n getTypename,\n isEchoObject,\n loadObjectReferences,\n parseId,\n SpaceState,\n} from '@dxos/react-client/echo';\nimport { translations as formTranslations } from '@dxos/react-ui-form';\n\nimport { AssistantPanel, AutomationPanel } from './components';\nimport meta, { AUTOMATION_PLUGIN } from './meta';\nimport translations from './translations';\nimport { type AutomationPluginProvides, ChainPromptType, ChainType } from './types';\n\nexport const AutomationPlugin = (): PluginDefinition<AutomationPluginProvides> => {\n return {\n meta,\n provides: {\n metadata: {\n records: {\n [ChainType.typename]: {\n placeholder: ['object placeholder', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: (chain: ChainType) => loadObjectReferences(chain, (chain) => chain.prompts),\n },\n },\n },\n translations: [...translations, ...formTranslations],\n echo: {\n system: [ChainType, ChainPromptType, FunctionTrigger],\n },\n complementary: {\n panels: [\n {\n id: 'automation',\n label: ['open automation panel label', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n },\n {\n id: 'assistant',\n label: ['open assistant panel label', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--atom--regular',\n },\n ],\n },\n graph: {\n builder: (plugins) => {\n const clientPlugin = resolvePlugin(plugins, parseClientPlugin);\n const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);\n const resolve = metadataPlugin?.provides.metadata.resolver;\n const client = clientPlugin?.provides.client;\n invariant(resolve);\n invariant(client);\n\n return [\n // Create nodes for object settings.\n createExtension({\n id: `${AUTOMATION_PLUGIN}/automation-for-subject`,\n resolver: ({ id }) => {\n if (!id.endsWith('~automation')) {\n return;\n }\n\n const type = 'orphan-settings-for-subject';\n const icon = 'ph--magic-wand--regular';\n\n const [subjectId] = id.split('~');\n const { spaceId, objectId } = parseId(subjectId);\n const spaces = toSignal(\n (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,\n () => client.spaces.get(),\n );\n const space = spaces?.find(\n (space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY,\n );\n if (!objectId) {\n // TODO(burdon): Ref SPACE_PLUGIN ns.\n const label = space\n ? space.properties.name || ['unnamed space label', { ns: AUTOMATION_PLUGIN }]\n : ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];\n\n // TODO(wittjosiah): Support comments for arbitrary subjects.\n // This is to ensure that the comments panel is not stuck on an old object.\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n showResolvedThreads: false,\n object: null,\n space,\n },\n };\n }\n\n const [object] = memoizeQuery(space, { id: objectId });\n if (!object || !subjectId) {\n return;\n }\n\n const meta = resolve(getTypename(object) ?? '');\n const label = meta.label?.(object) ||\n object.name ||\n meta.placeholder || ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];\n\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n object,\n },\n };\n },\n }),\n createExtension({\n id: `${AUTOMATION_PLUGIN}/assistant-for-subject`,\n resolver: ({ id }) => {\n // TODO(Zan): Find util (or make one). Effect schema!!\n if (!id.endsWith('~assistant')) {\n return;\n }\n\n const [subjectId] = id.split('~');\n const { spaceId, objectId } = parseId(subjectId);\n const spaces = toSignal(\n (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,\n () => client.spaces.get(),\n );\n const space = spaces?.find(\n (space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY,\n );\n if (!objectId) {\n // TODO(wittjosiah): Support assistant for arbitrary subjects.\n // This is to ensure that the assistant panel is not stuck on an old object.\n return {\n id,\n type: 'orphan-automation-for-subject',\n data: null,\n properties: {\n icon: 'ph--atom--regular',\n label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],\n object: null,\n space,\n },\n };\n }\n\n const [object] = memoizeQuery(space, { id: objectId });\n\n return {\n id,\n type: 'orphan-automation-for-subject',\n data: null,\n properties: {\n icon: 'ph--atom--regular',\n label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],\n object,\n },\n };\n },\n }),\n ];\n },\n },\n surface: {\n component: ({ data, role }) => {\n switch (role) {\n case 'complementary--assistant':\n return <AssistantPanel subject={data.subject as any} />;\n case 'complementary--automation': {\n const object = data.subject;\n const space = isEchoObject(object) ? getSpace(object) : undefined;\n if (space) {\n invariant(isEchoObject(object));\n return <AutomationPanel space={space} object={object} />;\n }\n break;\n }\n }\n\n return null;\n },\n },\n intent: {\n resolver: (intent) => {},\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const AssistantPanel = lazy(() => import('./AssistantPanel'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AUTOMATION_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [AUTOMATION_PLUGIN]: {\n 'plugin name': 'Automation',\n 'object placeholder': 'New prompt',\n 'create object label': 'Create prompt',\n 'create trigger label': 'Create trigger',\n 'create stack section label': 'Create prompt',\n 'command placeholder': 'Enter slash command...',\n 'template placeholder': 'Enter template...',\n 'value placeholder': 'Enter value...',\n 'select preset template placeholder': 'Select preset',\n 'open automation panel label': 'Show Automations',\n\n 'function select label': 'Function',\n 'function select placeholder': 'Select function',\n 'function enabled': 'Enabled',\n 'trigger select label': 'Trigger',\n 'trigger select placeholder': 'Trigger type',\n\n 'trigger type timer': 'Timer',\n 'trigger type webhook': 'Webhook',\n 'trigger type websocket': 'Websocket',\n 'trigger type subscription': 'Subscription',\n\n 'trigger filter': 'Filter',\n 'trigger cron': 'Cron',\n 'trigger method': 'Method',\n 'trigger endpoint': 'Endpoint',\n\n 'open assistant panel label': 'Show Assistant',\n 'assistant panel label': 'Assistant',\n },\n },\n },\n];\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { create } from '@dxos/live-object';\n\nimport { ChainInputType, ChainPromptType } from './types';\n\nexport const str = (...text: (string | undefined | boolean)[]): string =>\n text\n .filter((value) => value !== undefined && value !== false)\n .flat()\n .join('\\n');\n\nexport type Preset = {\n id: string;\n title: string;\n createPrompt: () => ChainPromptType;\n};\n\nexport const chainPresets: Preset[] = [\n {\n id: 'dxos.org/prompt/translate',\n title: 'Translate',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'say',\n template: str(\n // prettier-ignore\n 'Translate the following into {language}:',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.VALUE,\n name: 'language',\n value: 'japanese',\n },\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'input',\n },\n // TODO(burdon): Message.\n // {\n // type: ChainInputType.CONTEXT,\n // name: 'input',\n // value: 'object.text',\n // },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/chess',\n title: 'Chess',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'hint',\n template: str(\n // prettier-ignore\n 'You are a machine that is an expert chess player.',\n '',\n 'The move history of the current game is: {history}',\n '',\n 'Suggest the next move and very briefly explain your strategy in a couple of sentences.',\n ),\n inputs: [\n {\n type: ChainInputType.CONTEXT,\n name: 'history',\n value: 'object.pgn',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/mermaid',\n title: 'Mermaid',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'draw',\n template: str(\n // prettier-ignore\n 'Create a simplified mermaid graph representing the text below.',\n 'Do not explain anything.',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'input',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/list',\n title: 'List',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'list',\n template: str(\n // prettier-ignore\n 'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',\n 'Your entire response should be a single array of JSON objects.',\n '',\n 'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',\n '',\n '{schema}',\n '',\n '---',\n '',\n '{question}',\n ),\n inputs: [\n {\n type: ChainInputType.SCHEMA,\n name: 'schema',\n value: 'example.com/type/project',\n },\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'question',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/base',\n title: 'RAG',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'rag',\n template: str(\n // prettier-ignore\n \"Very briefly answer the question based only on the following context and say if you don't know the answer.\",\n // 'answer the question using the following context as well as your training data:',\n '',\n '{context}',\n '',\n '---',\n '',\n 'question: {question}',\n ),\n inputs: [\n {\n type: ChainInputType.RETRIEVER,\n name: 'context',\n },\n {\n type: ChainInputType.CONTEXT,\n name: 'question',\n value: 'object.text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/lookup',\n title: 'Lookup',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'lookup',\n template: str(\n // prettier-ignore\n 'Lookup and very briefly summarize the following topic in one or two sentences:',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.CONTEXT,\n name: 'input',\n value: 'text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/extract',\n title: 'Extract',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'extract',\n template: str(\n // prettier-ignore\n 'List all people and companies mentioned in the text below.',\n '',\n 'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',\n 'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',\n '',\n '{contact}',\n '{company}',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.SCHEMA,\n name: 'contact',\n value: 'example.com/type/contact',\n },\n {\n type: ChainInputType.SCHEMA,\n name: 'company',\n value: 'example.com/type/organization',\n },\n {\n type: ChainInputType.CONTEXT,\n name: 'input',\n value: 'text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/discord',\n title: 'Summarize',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'summarize',\n template: str(\n // prettier-ignore\n 'Summarize what the team is working on and format it as a markdown table without any explanation.',\n '',\n '---',\n '',\n '{context}',\n ),\n inputs: [\n {\n type: ChainInputType.RESOLVER,\n name: 'context',\n value: 'discord.messages.recent',\n },\n ],\n }),\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AutomationPlugin } from './AutomationPlugin';\n\nexport default AutomationPlugin;\n\nexport * from './AutomationPlugin';\nexport * from './components';\nexport * from './presets';\nexport * from './types';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,
|
|
6
|
-
"names": ["import_react", "AssistantPanel", "lazy", "AutomationPanel", "AUTOMATION_PLUGIN", "AutomationPlugin", "meta", "provides", "metadata", "records", "ChainType", "typename", "placeholder", "ns", "icon", "loadReferences", "chain", "
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { createSurface, parseMetadataResolverPlugin, type PluginDefinition, resolvePlugin } from '@dxos/app-framework';\nimport { FunctionTrigger } from '@dxos/functions';\nimport { invariant } from '@dxos/invariant';\nimport { parseClientPlugin } from '@dxos/plugin-client/types';\nimport { createExtension, toSignal } from '@dxos/plugin-graph';\nimport { memoizeQuery } from '@dxos/plugin-space';\nimport {\n getSpace,\n getTypename,\n isEchoObject,\n parseId,\n type ReactiveEchoObject,\n RefArray,\n SpaceState,\n} from '@dxos/react-client/echo';\nimport { translations as formTranslations } from '@dxos/react-ui-form';\n\nimport { AssistantPanel, AutomationPanel } from './components';\nimport meta, { AUTOMATION_PLUGIN } from './meta';\nimport translations from './translations';\nimport { type AutomationPluginProvides, ChainPromptType, ChainType } from './types';\n\nexport const AutomationPlugin = (): PluginDefinition<AutomationPluginProvides> => {\n return {\n meta,\n provides: {\n metadata: {\n records: {\n [ChainType.typename]: {\n placeholder: ['object placeholder', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n // TODO(wittjosiah): Move out of metadata.\n loadReferences: async (chain: ChainType) => await RefArray.loadAll(chain.prompts ?? []),\n },\n },\n },\n translations: [...translations, ...formTranslations],\n echo: {\n system: [ChainType, ChainPromptType, FunctionTrigger],\n },\n complementary: {\n panels: [\n {\n id: 'automation',\n label: ['open automation panel label', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--magic-wand--regular',\n },\n {\n id: 'assistant',\n label: ['open assistant panel label', { ns: AUTOMATION_PLUGIN }],\n icon: 'ph--atom--regular',\n },\n ],\n },\n graph: {\n builder: (plugins) => {\n const clientPlugin = resolvePlugin(plugins, parseClientPlugin);\n const metadataPlugin = resolvePlugin(plugins, parseMetadataResolverPlugin);\n const resolve = metadataPlugin?.provides.metadata.resolver;\n const client = clientPlugin?.provides.client;\n invariant(resolve);\n invariant(client);\n\n return [\n // Create nodes for object settings.\n createExtension({\n id: `${AUTOMATION_PLUGIN}/automation-for-subject`,\n resolver: ({ id }) => {\n if (!id.endsWith('~automation')) {\n return;\n }\n\n const type = 'orphan-settings-for-subject';\n const icon = 'ph--magic-wand--regular';\n\n const [subjectId] = id.split('~');\n const { spaceId, objectId } = parseId(subjectId);\n const spaces = toSignal(\n (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,\n () => client.spaces.get(),\n );\n const space = spaces?.find(\n (space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY,\n );\n if (!objectId) {\n // TODO(burdon): Ref SPACE_PLUGIN ns.\n const label = space\n ? space.properties.name || ['unnamed space label', { ns: AUTOMATION_PLUGIN }]\n : ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];\n\n // TODO(wittjosiah): Support comments for arbitrary subjects.\n // This is to ensure that the comments panel is not stuck on an old object.\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n showResolvedThreads: false,\n object: null,\n space,\n },\n };\n }\n\n const [object] = memoizeQuery(space, { id: objectId });\n if (!object || !subjectId) {\n return;\n }\n\n const meta = resolve(getTypename(object) ?? '');\n const label = meta.label?.(object) ||\n object.name ||\n meta.placeholder || ['unnamed object settings label', { ns: AUTOMATION_PLUGIN }];\n\n return {\n id,\n type,\n data: null,\n properties: {\n icon,\n label,\n object,\n },\n };\n },\n }),\n createExtension({\n id: `${AUTOMATION_PLUGIN}/assistant-for-subject`,\n resolver: ({ id }) => {\n // TODO(Zan): Find util (or make one). Effect schema!!\n if (!id.endsWith('~assistant')) {\n return;\n }\n\n const [subjectId] = id.split('~');\n const { spaceId, objectId } = parseId(subjectId);\n const spaces = toSignal(\n (onChange) => client.spaces.subscribe(() => onChange()).unsubscribe,\n () => client.spaces.get(),\n );\n const space = spaces?.find(\n (space) => space.id === spaceId && space.state.get() === SpaceState.SPACE_READY,\n );\n if (!objectId) {\n // TODO(wittjosiah): Support assistant for arbitrary subjects.\n // This is to ensure that the assistant panel is not stuck on an old object.\n return {\n id,\n type: 'orphan-automation-for-subject',\n data: null,\n properties: {\n icon: 'ph--atom--regular',\n label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],\n object: null,\n space,\n },\n };\n }\n\n const [object] = memoizeQuery(space, { id: objectId });\n\n return {\n id,\n type: 'orphan-automation-for-subject',\n data: null,\n properties: {\n icon: 'ph--atom--regular',\n label: ['assistant panel label', { ns: AUTOMATION_PLUGIN }],\n object,\n },\n };\n },\n }),\n ];\n },\n },\n surface: {\n definitions: () => [\n createSurface({\n id: `${AUTOMATION_PLUGIN}/assistant`,\n role: 'complementary--assistant',\n component: ({ data }) => <AssistantPanel subject={data.subject} />,\n }),\n createSurface({\n id: `${AUTOMATION_PLUGIN}/automation`,\n role: 'complementary--automation',\n filter: (data): data is { subject: ReactiveEchoObject<any> } =>\n isEchoObject(data.subject) && !!getSpace(data.subject),\n component: ({ data }) => <AutomationPanel space={getSpace(data.subject)!} object={data.subject} />,\n }),\n ],\n },\n intent: {\n resolvers: () => [],\n },\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { lazy } from 'react';\n\nexport const AssistantPanel = lazy(() => import('./AssistantPanel'));\nexport const AutomationPanel = lazy(() => import('./AutomationPanel'));\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AUTOMATION_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [AUTOMATION_PLUGIN]: {\n 'plugin name': 'Automation',\n 'object placeholder': 'New prompt',\n 'create object label': 'Create prompt',\n 'create trigger label': 'Create trigger',\n 'create stack section label': 'Create prompt',\n 'command placeholder': 'Enter slash command...',\n 'template placeholder': 'Enter template...',\n 'value placeholder': 'Enter value...',\n 'select preset template placeholder': 'Select preset',\n 'open automation panel label': 'Show Automations',\n\n 'function select label': 'Function',\n 'function select placeholder': 'Select function',\n 'function enabled': 'Enabled',\n 'trigger select label': 'Trigger',\n 'trigger select placeholder': 'Trigger type',\n\n 'trigger type timer': 'Timer',\n 'trigger type webhook': 'Webhook',\n 'trigger type websocket': 'Websocket',\n 'trigger type subscription': 'Subscription',\n 'trigger type email': 'Email',\n\n 'trigger filter': 'Filter',\n 'trigger cron': 'Cron',\n 'trigger method': 'Method',\n 'trigger endpoint': 'Endpoint',\n\n 'open assistant panel label': 'Show Assistant',\n 'assistant panel label': 'Assistant',\n },\n },\n },\n];\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { create } from '@dxos/live-object';\n\nimport { ChainInputType, ChainPromptType } from './types';\n\nexport const str = (...text: (string | undefined | boolean)[]): string =>\n text\n .filter((value) => value !== undefined && value !== false)\n .flat()\n .join('\\n');\n\nexport type Preset = {\n id: string;\n title: string;\n createPrompt: () => ChainPromptType;\n};\n\nexport const chainPresets: Preset[] = [\n {\n id: 'dxos.org/prompt/translate',\n title: 'Translate',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'say',\n template: str(\n // prettier-ignore\n 'Translate the following into {language}:',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.VALUE,\n name: 'language',\n value: 'japanese',\n },\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'input',\n },\n // TODO(burdon): Message.\n // {\n // type: ChainInputType.CONTEXT,\n // name: 'input',\n // value: 'object.text',\n // },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/chess',\n title: 'Chess',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'hint',\n template: str(\n // prettier-ignore\n 'You are a machine that is an expert chess player.',\n '',\n 'The move history of the current game is: {history}',\n '',\n 'Suggest the next move and very briefly explain your strategy in a couple of sentences.',\n ),\n inputs: [\n {\n type: ChainInputType.CONTEXT,\n name: 'history',\n value: 'object.pgn',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/mermaid',\n title: 'Mermaid',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'draw',\n template: str(\n // prettier-ignore\n 'Create a simplified mermaid graph representing the text below.',\n 'Do not explain anything.',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'input',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/list',\n title: 'List',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'list',\n template: str(\n // prettier-ignore\n 'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',\n 'Your entire response should be a single array of JSON objects.',\n '',\n 'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',\n '',\n '{schema}',\n '',\n '---',\n '',\n '{question}',\n ),\n inputs: [\n {\n type: ChainInputType.SCHEMA,\n name: 'schema',\n value: 'example.com/type/project',\n },\n {\n type: ChainInputType.PASS_THROUGH,\n name: 'question',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/base',\n title: 'RAG',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'rag',\n template: str(\n // prettier-ignore\n \"Very briefly answer the question based only on the following context and say if you don't know the answer.\",\n // 'answer the question using the following context as well as your training data:',\n '',\n '{context}',\n '',\n '---',\n '',\n 'question: {question}',\n ),\n inputs: [\n {\n type: ChainInputType.RETRIEVER,\n name: 'context',\n },\n {\n type: ChainInputType.CONTEXT,\n name: 'question',\n value: 'object.text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/lookup',\n title: 'Lookup',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'lookup',\n template: str(\n // prettier-ignore\n 'Lookup and very briefly summarize the following topic in one or two sentences:',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.CONTEXT,\n name: 'input',\n value: 'text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/extract',\n title: 'Extract',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'extract',\n template: str(\n // prettier-ignore\n 'List all people and companies mentioned in the text below.',\n '',\n 'You are a machine that only replies with valid, iterable RFC8259 compliant JSON in your responses.',\n 'Your entire response should be a map where the key is the type and the value is a single array of JSON objects conforming to the following types:',\n '',\n '{contact}',\n '{company}',\n '',\n '---',\n '',\n '{input}',\n ),\n inputs: [\n {\n type: ChainInputType.SCHEMA,\n name: 'contact',\n value: 'example.com/type/contact',\n },\n {\n type: ChainInputType.SCHEMA,\n name: 'company',\n value: 'example.com/type/organization',\n },\n {\n type: ChainInputType.CONTEXT,\n name: 'input',\n value: 'text',\n },\n ],\n }),\n },\n {\n id: 'dxos.org/prompt/discord',\n title: 'Summarize',\n createPrompt: () =>\n create(ChainPromptType, {\n command: 'summarize',\n template: str(\n // prettier-ignore\n 'Summarize what the team is working on and format it as a markdown table without any explanation.',\n '',\n '---',\n '',\n '{context}',\n ),\n inputs: [\n {\n type: ChainInputType.RESOLVER,\n name: 'context',\n value: 'discord.messages.recent',\n },\n ],\n }),\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { AutomationPlugin } from './AutomationPlugin';\n\nexport default AutomationPlugin;\n\nexport * from './AutomationPlugin';\nexport * from './components';\nexport * from './presets';\nexport * from './types';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,2BAAiG;AACjG,uBAAgC;AAChC,uBAA0B;AAC1B,mBAAkC;AAClC,0BAA0C;AAC1C,0BAA6B;AAC7B,kBAQO;AACP,2BAAiD;ACjBjD,IAAAA,gBAAqB;AEArB,yBAAuB;AFEhB,IAAMC,qBAAiBC,oBAAK,MAAM,OAAO,+BAAA,CAAA;AACzC,IAAMC,sBAAkBD,oBAAK,MAAM,OAAO,gCAAA,CAAA;ACDjD,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACE,uCAAAA,GAAoB;QACnB,eAAe;QACf,sBAAsB;QACtB,uBAAuB;QACvB,wBAAwB;QACxB,8BAA8B;QAC9B,uBAAuB;QACvB,wBAAwB;QACxB,qBAAqB;QACrB,sCAAsC;QACtC,+BAA+B;QAE/B,yBAAyB;QACzB,+BAA+B;QAC/B,oBAAoB;QACpB,wBAAwB;QACxB,8BAA8B;QAE9B,sBAAsB;QACtB,wBAAwB;QACxB,0BAA0B;QAC1B,6BAA6B;QAC7B,sBAAsB;QAEtB,kBAAkB;QAClB,gBAAgB;QAChB,kBAAkB;QAClB,oBAAoB;QAEpB,8BAA8B;QAC9B,yBAAyB;MAC3B;IACF;EACF;;;AFdK,IAAMC,mBAAmB,MAAA;AAC9B,SAAO;IACLC,MAAAA;IACAC,UAAU;MACRC,UAAU;QACRC,SAAS;UACP,CAACC,gCAAUC,QAAQ,GAAG;YACpBC,aAAa;cAAC;cAAsB;gBAAEC,IAAIT;cAAkB;;YAC5DU,MAAM;;YAENC,gBAAgB,OAAOC,UAAqB,MAAMC,qBAASC,QAAQF,MAAMG,WAAW,CAAA,CAAE;UACxF;QACF;MACF;MACAC,cAAc;WAAIA;WAAiBC,qBAAAA;;MACnCC,MAAM;QACJC,QAAQ;UAACb;UAAWc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;UACNoB,OAAO;QACT;;IAEJ,CAAA;EACJ;EACA;IACEtD,IAAI;IACJ2D,OAAO;IACPC,cAAc,UACZC,2BAAOjE,uCAAiB;MACtBkE,SAAS;MACTC,UAAUX;;QAER;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;MAAA;MAEFY,QAAQ;QACN;UACEhD,MAAMiD,qCAAeI;UACrBnC,MAAM;UACNoB,OAAO;QACT;QACA;UACEtC,MAAMiD,qCAAeI;UACrBnC,MAAM;UACNoB,OAAO;QACT;QACA;UACEtC,MAAMiD,qCAAeG;UACrBlC,MAAM;UACNoB,OAAO;QACT;;IAEJ,CAAA;EACJ;EACA;IACEtD,IAAI;IACJ2D,OAAO;IACPC,cAAc,UACZC,2BAAOjE,uCAAiB;MACtBkE,SAAS;MACTC,UAAUX;;QAER;QACA;QACA;QACA;QACA;MAAA;MAEFY,QAAQ;QACN;UACEhD,MAAMiD,qCAAeM;UACrBrC,MAAM;UACNoB,OAAO;QACT;;IAEJ,CAAA;EACJ;;AChPF,IAAA,cAAe7E;",
|
|
6
|
+
"names": ["import_react", "AssistantPanel", "lazy", "AutomationPanel", "AUTOMATION_PLUGIN", "AutomationPlugin", "meta", "provides", "metadata", "records", "ChainType", "typename", "placeholder", "ns", "icon", "loadReferences", "chain", "RefArray", "loadAll", "prompts", "translations", "formTranslations", "echo", "system", "ChainPromptType", "FunctionTrigger", "complementary", "panels", "id", "label", "graph", "builder", "plugins", "clientPlugin", "resolvePlugin", "parseClientPlugin", "metadataPlugin", "parseMetadataResolverPlugin", "resolve", "resolver", "client", "invariant", "createExtension", "endsWith", "type", "subjectId", "split", "spaceId", "objectId", "parseId", "spaces", "toSignal", "onChange", "subscribe", "unsubscribe", "get", "space", "find", "state", "SpaceState", "SPACE_READY", "properties", "name", "data", "showResolvedThreads", "object", "memoizeQuery", "getTypename", "surface", "definitions", "createSurface", "role", "component", "React", "subject", "filter", "isEchoObject", "getSpace", "intent", "resolvers", "str", "text", "value", "undefined", "flat", "join", "chainPresets", "title", "createPrompt", "create", "command", "template", "inputs", "ChainInputType", "VALUE", "PASS_THROUGH", "CONTEXT", "SCHEMA", "RETRIEVER", "RESOLVER"]
|
|
7
7
|
}
|