@xenosystem/agent-interface-ui 0.1.143 → 0.1.145

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.
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getAgentPlatformBridge } from '@xenosystem/agent-conversation/platformBridge';
3
+ import React, { useCallback, useEffect, useState } from 'react';
4
+ /**
5
+ * A folder's Recipes (`recipes.*`, ADE §9 step 5, slice 7): the user's and the project's recipes, the workflow one
6
+ * compiles to (its waves, the approvals it asks for, the authority it runs with), and running it. A run is an ordinary
7
+ * workflow driven by the host, so it then appears in the Workflows tab and `xeno workflow` alike.
8
+ */
9
+ export function RecipesPanel({ cwd, conversationId }) {
10
+ const [recipes, setRecipes] = useState([]);
11
+ const [issues, setIssues] = useState([]);
12
+ const [selectedId, setSelectedId] = useState(null);
13
+ const [inputs, setInputs] = useState({});
14
+ const [preview, setPreview] = useState(null);
15
+ const [notice, setNotice] = useState(null);
16
+ const [error, setError] = useState(null);
17
+ const [busy, setBusy] = useState(false);
18
+ const [loading, setLoading] = useState(true);
19
+ const caller = conversationId ? { conversationId } : {};
20
+ const load = useCallback(async () => {
21
+ if (!cwd) {
22
+ setLoading(false);
23
+ return;
24
+ }
25
+ const result = await getAgentPlatformBridge().recipes.list({ cwd, ...(conversationId ? { conversationId } : {}) });
26
+ setLoading(false);
27
+ if (!result.success) {
28
+ setError(result.error ?? 'The recipes could not be read.');
29
+ return;
30
+ }
31
+ setError(null);
32
+ setRecipes(result.recipes ?? []);
33
+ setIssues(result.issues ?? []);
34
+ }, [cwd, conversationId]);
35
+ useEffect(() => { void load(); }, [load]);
36
+ const select = (recipe) => {
37
+ setSelectedId(recipe.recipeId);
38
+ setInputs(Object.fromEntries(recipe.inputs.map((input) => [input.name, ''])));
39
+ setPreview(null);
40
+ setNotice(null);
41
+ setError(null);
42
+ };
43
+ const act = async (operation) => {
44
+ if (!cwd || !selectedId)
45
+ return;
46
+ setBusy(true);
47
+ try {
48
+ const filled = Object.fromEntries(Object.entries(inputs).filter(([, value]) => value.trim() !== ''));
49
+ const params = { cwd, ref: selectedId, mode: 'interactive', inputs: filled, ...caller };
50
+ const bridge = getAgentPlatformBridge().recipes;
51
+ const result = operation === 'compile' ? await bridge.compile(params) : await bridge.run(params);
52
+ if (!result.success) {
53
+ setError(result.error ?? 'The host refused.');
54
+ setNotice(null);
55
+ return;
56
+ }
57
+ setError(null);
58
+ setPreview(result.preview ?? null);
59
+ setNotice(operation === 'run' ? `Started as workflow run ${result.workflowRunId ?? ''}. Follow it in Workflows.` : null);
60
+ }
61
+ finally {
62
+ setBusy(false);
63
+ }
64
+ };
65
+ if (!cwd)
66
+ return _jsx("div", { className: "px-4 py-10 text-center text-[12px] text-white/35", "data-xeno-recipes-panel": "", children: "Open a project folder to see its recipes." });
67
+ const selected = recipes.find((recipe) => recipe.recipeId === selectedId);
68
+ return (_jsxs("div", { className: "h-full min-h-0 flex flex-col", "data-xeno-recipes-panel": "", children: [error && _jsx("div", { className: "mx-4 mt-3 px-3 py-2 border border-white/[0.10] bg-white/[0.04] text-[11px] text-white/70", "data-xeno-recipes-error": "", children: error }), notice && _jsx("div", { className: "mx-4 mt-3 px-3 py-2 border border-white/[0.08] text-[11px] text-white/60", "data-xeno-recipes-notice": "", children: notice }), _jsxs("div", { className: "flex-1 min-h-0 flex", children: [_jsxs("div", { className: "w-[42%] min-w-0 overflow-auto border-r border-white/[0.06]", children: [loading ? (_jsx("div", { className: "px-4 py-8 text-center text-[12px] text-white/30", children: "Loading recipes..." })) : recipes.length === 0 ? (_jsx("div", { className: "px-4 py-10 text-center text-[12px] text-white/35", children: "No recipes here. Add one as .xeno/recipes/<id>.recipe.json." })) : recipes.map((recipe) => (_jsxs("button", { type: "button", onClick: () => select(recipe), className: `w-full text-left px-4 py-2 border-b border-white/[0.04] ${selectedId === recipe.recipeId ? 'bg-white/[0.05]' : 'hover:bg-white/[0.03]'}`, "data-xeno-recipe": recipe.recipeId, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "text-[12px] text-white/80 truncate flex-1", children: recipe.name }), _jsx("span", { className: "text-[10px] text-white/40 border border-white/[0.08] rounded-sm px-1", children: recipe.scope === 'project' ? 'project' : 'yours' })] }), recipe.description && _jsx("div", { className: "text-[10px] text-white/40 truncate", children: recipe.description })] }, recipe.recipeId))), issues.map((issue) => _jsxs("div", { className: "px-4 py-2 text-[10px] text-white/45 border-b border-white/[0.04]", "data-xeno-recipe-issue": "", children: [issue.path, ": ", issue.error] }, issue.path))] }), _jsx("div", { className: "flex-1 min-w-0 overflow-auto", children: !selected ? (_jsx("div", { className: "px-4 py-10 text-center text-[12px] text-white/30", children: "Select a recipe to preview or run it." })) : (_jsxs("div", { className: "px-4 py-3", "data-xeno-recipe-detail": selected.recipeId, children: [selected.inputs.map((input) => (_jsxs("label", { className: "block mb-2", children: [_jsxs("span", { className: "text-[10px] text-white/45", children: [input.name, input.required ? ' (required)' : '', input.description ? ` · ${input.description}` : ''] }), _jsx("input", { className: "mt-0.5 w-full bg-white/[0.04] border border-white/[0.08] text-[11px] text-white/75 px-2 py-1 outline-none", value: inputs[input.name] ?? '', onChange: (event) => setInputs((current) => ({ ...current, [input.name]: event.target.value })), "data-xeno-recipe-input": input.name })] }, input.name))), _jsxs("div", { className: "flex items-center gap-2 mt-2", children: [_jsx("button", { type: "button", disabled: busy, onClick: () => { void act('compile'); }, className: "text-[11px] px-2.5 py-1 border border-white/[0.12] text-white/70 hover:bg-white/[0.06] disabled:opacity-40", "data-xeno-recipe-action": "preview", children: "Preview" }), _jsx("button", { type: "button", disabled: busy, onClick: () => { void act('run'); }, className: "text-[11px] px-2.5 py-1 border border-white/[0.20] text-white/85 hover:bg-white/[0.08] disabled:opacity-40", "data-xeno-recipe-action": "run", children: "Run" })] }), preview && (_jsxs("div", { className: "mt-3", "data-xeno-recipe-preview": "", children: [preview.waves.map((wave) => (_jsxs("div", { className: "py-1", children: [_jsx("span", { className: "text-[10px] text-white/40", children: wave.label }), " ", _jsx("span", { className: "text-[11px] text-white/70", children: wave.steps.join(', ') })] }, wave.label))), preview.approvals.map((message) => _jsxs("div", { className: "text-[11px] text-white/55 py-0.5", children: ["Asks first: ", message] }, message)), _jsxs("div", { className: "text-[10px] text-white/40 mt-1", children: ["Runs with: external actions ", String(preview.authority.externalActions), ", network ", String(preview.authority.network)] })] }))] })) })] })] }));
69
+ }
70
+ //# sourceMappingURL=RecipesPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RecipesPanel.js","sourceRoot":"","sources":["../../../src/components/agent/RecipesPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAA;AACtF,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAG/D;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,GAAG,EAAE,cAAc,EAA6C;IAC7F,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAuB,EAAE,CAAC,CAAA;IAChE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAA4C,EAAE,CAAC,CAAA;IACnF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;IACjE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAyB,EAAE,CAAC,CAAA;IAChE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAuC,IAAI,CAAC,CAAA;IAClF,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;IACzD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAA;IACvD,MAAM,CAAC,IAAI,EAA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C,OAAO,CAAC,SAAS,CAAC,eAAe,CAAC,gBAAY,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,IAAO,IACtK,CACP,IACG,CACP,GACG,IACF,IACF,CACP,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xenosystem/agent-interface-ui",
3
- "version": "0.1.143",
3
+ "version": "0.1.145",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -41,11 +41,11 @@
41
41
  "react-markdown": "^10.1.0",
42
42
  "remark-gfm": "^4.0.1",
43
43
  "zustand": "^5.0.2",
44
- "@xenosystem/agent-conversation": "0.1.143",
45
- "@xenosystem/agent-interface-core": "0.1.143",
46
- "@xenosystem/agent-interface-contract": "0.1.143",
47
- "@xenosystem/agent-interface-client": "0.1.143",
48
- "@xenosystem/agent-interface-hub-adapter": "0.1.143"
44
+ "@xenosystem/agent-interface-contract": "0.1.145",
45
+ "@xenosystem/agent-conversation": "0.1.145",
46
+ "@xenosystem/agent-interface-client": "0.1.145",
47
+ "@xenosystem/agent-interface-core": "0.1.145",
48
+ "@xenosystem/agent-interface-hub-adapter": "0.1.145"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "react": "^19.0.0",
@@ -63,5 +63,5 @@
63
63
  "scripts": {
64
64
  "build:css": "node scripts/build-css.mjs"
65
65
  },
66
- "gitHead": "6ae4e8f4c81c70d128c528f56fa850886b2b1119"
66
+ "gitHead": "6e755a216e44e638bbbfbf318252a18d63604333"
67
67
  }