@flinbein/pappai-web 0.1.1 → 0.1.3
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/README.md +19 -1
- package/dist/.vite/license.md +26 -0
- package/dist/assets/main-B20BE1_4.css +1 -0
- package/dist/assets/main-iy70wqIa.js +13 -0
- package/dist/assets/view-C1Xd5xfT.css +1 -0
- package/dist/assets/view-COZX9gMP.js +17 -0
- package/dist/index.html +3 -4
- package/dist/terminal.html +4 -5
- package/package.json +3 -2
- package/dist/assets/index-CvP1OwAJ.js +0 -1
- package/dist/assets/index-DJUfy3K2.css +0 -1
- package/dist/assets/jsx-runtime-esgIFpYn.js +0 -9
- package/dist/assets/terminal-Bg-ATEgs.js +0 -17
- package/dist/assets/terminal-Wa6xUxD1.css +0 -1
package/dist/index.html
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
<html lang="ru">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-visual">
|
|
6
6
|
<title>pappai · Workspace</title>
|
|
7
|
-
<script type="module" crossorigin src="/_web/0.1.
|
|
8
|
-
<link rel="
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/_web/0.1.1/assets/index-DJUfy3K2.css">
|
|
7
|
+
<script type="module" crossorigin src="/_web/0.1.3/assets/main-iy70wqIa.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/_web/0.1.3/assets/main-B20BE1_4.css">
|
|
10
9
|
</head>
|
|
11
10
|
<body>
|
|
12
11
|
<div id="root"></div>
|
package/dist/terminal.html
CHANGED
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
<html lang="ru">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, interactive-widget=resizes-
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-visual">
|
|
6
6
|
<title>Терминал · pappai</title>
|
|
7
|
-
<script type="module" crossorigin src="/_web/0.1.
|
|
8
|
-
<link rel="
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/_web/0.1.1/assets/terminal-Wa6xUxD1.css">
|
|
7
|
+
<script type="module" crossorigin src="/_web/0.1.3/assets/main-iy70wqIa.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/_web/0.1.3/assets/main-B20BE1_4.css">
|
|
10
9
|
</head>
|
|
11
10
|
<body>
|
|
12
|
-
<div id="root"
|
|
11
|
+
<div id="root"></div>
|
|
13
12
|
</body>
|
|
14
13
|
</html>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flinbein/pappai-web",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "The pappai workspace and web terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
"@types/react": "^19.0.0",
|
|
25
25
|
"@types/react-dom": "^19.0.0",
|
|
26
26
|
"@vitejs/plugin-react": "^6.0.0",
|
|
27
|
-
"@xterm/xterm": "6.0.0",
|
|
28
27
|
"@xterm/addon-fit": "0.11.0",
|
|
28
|
+
"@xterm/xterm": "6.0.0",
|
|
29
29
|
"react": "^19.0.0",
|
|
30
30
|
"react-dom": "^19.0.0",
|
|
31
|
+
"react-router": "^7.18.6",
|
|
31
32
|
"typescript": "^7.0.2",
|
|
32
33
|
"vite": "^8.0.0"
|
|
33
34
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./jsx-runtime-esgIFpYn.js";var r=t(),i=e(),a={working:`Работает`,stopping:`Останавливается`,stopped:`Остановлена`,error:`Ошибка`};function o(e){return e instanceof Error?e.message:String(e)}function s(e){return JSON.stringify(e,null,2)??``}function c(e){try{return JSON.parse(e)}catch(e){throw Error(`Проверьте JSON: `+o(e))}}var l=0;async function u(e,t){let n=await fetch(`/rpc`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({jsonrpc:`2.0`,id:++l,method:e,params:t})});if(!n.ok)throw Error(n.status===401?`Сессия завершена. Войдите снова.`:`HTTP `+n.status);let r=await n.json();if(r.error)throw Error(r.error.message);return r.result}function d(e,t,n={},r){return u(`call`,{node:e,method:t,data:n,version:r})}function f(e){return u(`help`,{node:e,features:!0,doc:!0,schema:!0})}function p(){return d(`~`,`$.runners.get`)}async function m(){let e=await fetch(`/session`);if(!e.ok)throw Error(`HTTP `+e.status);return e.json()}async function h(e,t={}){let n=await fetch(`/auth/`+e,{method:`POST`,credentials:`same-origin`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json();if(!n.ok)throw Error(r.error);return r}async function g(e,t){let n=await h(`register/options`,{email:e,code:t}),r=await navigator.credentials.create({publicKey:PublicKeyCredential.parseCreationOptionsFromJSON(n)});if(!(r instanceof PublicKeyCredential))throw Error(`Регистрация passkey отменена.`);await h(`register/verify`,r.toJSON())}async function _(){let e=await h(`login/options`),t=await navigator.credentials.get({publicKey:PublicKeyCredential.parseRequestOptionsFromJSON(e)});if(!(t instanceof PublicKeyCredential))throw Error(`Вход с passkey отменён.`);await h(`login/verify`,t.toJSON())}var v=()=>h(`logout`),y=e=>h(`recover`,{email:e}),b=n();function x(){let e=(0,r.useRef)(!0);return(0,r.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var S=(0,r.createContext)(!1);function C({id:e,submit:t,feedback:n,children:i,hidden:a}){let[s,c]=(0,r.useState)(!1),l=x();async function u(e){if(e.preventDefault(),!s){n(``),c(!0);try{await t(e.currentTarget)}catch(e){l.current&&n(o(e))}finally{l.current&&c(!1)}}}return(0,b.jsx)(`form`,{id:e,hidden:a,onSubmit:u,children:(0,b.jsx)(S.Provider,{value:s,children:i})})}function w({disabled:e,children:t}){let n=(0,r.useContext)(S);return(0,b.jsx)(`button`,{type:`submit`,disabled:e||n,children:t})}function T({run:e,feedback:t,children:n,disabled:i,...a}){let[s,c]=(0,r.useState)(!1),l=x();async function u(){t(``),c(!0);try{await e()}catch(e){l.current&&t(o(e))}finally{l.current&&c(!1)}}return(0,b.jsx)(`button`,{...a,type:`button`,disabled:i||s,onClick:u,children:n})}function E(e,t){return String(new FormData(e).get(t)??``)}function D({nodes:e,type:t,placeholder:n}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`option`,{value:``,children:n}),e.filter(e=>e.type===t).map(e=>(0,b.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.id]},e.id))]})}function O({id:e,close:t,children:n}){let i=(0,r.useRef)(null);return(0,r.useEffect)(()=>{i.current?.showModal()},[]),(0,b.jsx)(`dialog`,{id:e,ref:i,onCancel:t,children:n})}function k({id:e,onStatus:t,onCatalog:n,feedback:i,refresh:l}){let[u,p]=(0,r.useState)(),[m,h]=(0,r.useState)(),[g,_]=(0,r.useState)(),[v,y]=(0,r.useState)(``),S=(0,r.useRef)(null),C=(0,r.useRef)(0),w=x(),E=(0,r.useCallback)(async()=>{let n=++C.current,[r,i]=await Promise.all([d(e,`$.app.get`),d(e,`$.app.executors.get`)]);w.current&&n===C.current&&(p(r),h(i),t(r.status))},[e,w,t]);(0,r.useEffect)(()=>{let t=e=>{w.current&&i(o(e))};E().catch(t),d(e,`$.app.manifest.get`).then(e=>_(s(e))).catch(t)},[e,i,E,w]);async function D(t){await d(e,`$.app.`+t),w.current&&await Promise.all([E(),l()])}async function O(){let t=g??``,r=c(t);await d(e,`$.app.manifest.set`,{source:r&&typeof r==`object`&&Object.hasOwn(r,`run`)?{manifest:r}:r});let[i,a]=await Promise.all([d(e,`$.app.manifest.get`),f(e)]);w.current&&(n(a),S.current?.value===t&&(_(s(i)),y(`Манифест сохранён`)),await E())}return(0,b.jsxs)(`section`,{id:`app-management`,children:[(0,b.jsx)(`h2`,{children:`Состояние APP`}),(0,b.jsxs)(`dl`,{className:`app-state`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`Статус`}),(0,b.jsx)(`dd`,{id:`app-status`,children:u&&a[u.status]})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`Занято слотов`}),(0,b.jsx)(`dd`,{id:`app-active`,children:m&&(m.limit===null?m.active:m.active+` / `+m.limit)})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`dt`,{children:`В очереди`}),(0,b.jsx)(`dd`,{id:`app-queued`,children:m?.queued})]})]}),(0,b.jsx)(`p`,{id:`app-issue`,hidden:!u?.lastIssue,children:u?.lastIssue}),(0,b.jsxs)(`div`,{className:`app-actions`,children:[(0,b.jsx)(T,{id:`app-start`,disabled:u?.status!==`stopped`&&u?.status!==`error`,feedback:i,run:()=>D(`start`),children:`Запустить`}),(0,b.jsx)(T,{id:`app-stop`,className:`secondary`,disabled:u?.status!==`working`&&u?.status!==`error`,feedback:i,run:()=>D(`stop`),children:`Остановить`}),(0,b.jsx)(T,{id:`app-restart`,className:`secondary`,disabled:u?.status!==`working`||m?.restarting,feedback:i,run:()=>D(`restart`),children:`Перезапустить`}),(0,b.jsx)(T,{id:`app-refresh`,className:`secondary`,feedback:i,run:E,children:`Обновить состояние`})]}),(0,b.jsxs)(`details`,{id:`manifest-details`,children:[(0,b.jsx)(`summary`,{children:`Манифест APP`}),(0,b.jsx)(`p`,{id:`manifest-changed`,hidden:!u?.manifestChanged,children:`Новый манифест ожидает завершения постоянного процесса.`}),(0,b.jsxs)(`label`,{children:[`Источник манифеста JSON`,(0,b.jsx)(`textarea`,{id:`app-manifest`,ref:S,rows:10,spellCheck:!1,value:g??``,disabled:g===void 0,onChange:e=>{_(e.target.value),y(``)}})]}),(0,b.jsx)(T,{id:`app-save`,disabled:g===void 0,feedback:y,run:O,children:`Сохранить манифест`}),(0,b.jsx)(`p`,{id:`app-feedback`,role:`status`,children:v})]})]})}var A={run:{type:`codex`,settings:{developerInstructions:`Answer the message in data.input in the user's language.`,features:{"agent.execute":{type:`method`,description:`Send a message to the agent`,version:`1`,schema:{input:{type:`object`,properties:{input:{type:`string`,minLength:1}},required:[`input`],additionalProperties:!1},output:{type:`string`}}},"agent.getHistory":{type:`method`,version:`1`,description:`Read conversation history`},"agent.interrupt":{type:`method`,version:`1`,description:`Interrupt the active turn`}}}},executors:{mode:`persistent`,idleTimeoutMs:3e5}},j=[[`team`,`TEAM`],[`profile`,`PROFILE`],[`codex`,`APP · Codex`],[`app`,`APP · свой манифест`],[`user`,`USER`]];function M(e,t,n){return!n&&(e===`team`||e===`user`)?!1:t[`$.`+(e===`codex`?`app`:e)+`.create`]?.type===`method`}function N({parent:e,nodes:t,admin:n,catalog:i,close:a,refresh:o}){let[s,l]=(0,r.useState)(()=>j.find(([e])=>M(e,i,n))[0]),[u,f]=(0,r.useState)(``),p=s===`app`||s===`codex`,m=s===`codex`&&!t.some(e=>e.type===`profile`);return(0,b.jsx)(O,{id:`create-dialog`,close:a,children:(0,b.jsxs)(C,{id:`create-node`,feedback:f,submit:async t=>{let n=E(t,`profile`),r={name:E(t,`name`).trim(),permissions:c(E(t,`permissions`)),...s===`user`&&{email:E(t,`email`)},...s===`codex`&&{source:{manifest:A}},...s===`app`&&{source:c(E(t,`source`))},...p&&n&&{profile:n}};await o((await d(e.id,`$.`+(s===`codex`?`app`:s)+`.create`,r)).id),a()},children:[(0,b.jsx)(`h2`,{children:`Создать ноду`}),(0,b.jsxs)(`p`,{id:`parent-name`,children:[`Родитель: `,e.name]}),(0,b.jsxs)(`label`,{children:[`Тип ноды`,(0,b.jsx)(`select`,{id:`create-type`,value:s,onChange:e=>{l(e.target.value),f(``)},children:j.map(([e,t])=>(0,b.jsx)(`option`,{value:e,disabled:!M(e,i,n),children:t},e))})]}),(0,b.jsxs)(`label`,{children:[`Название`,(0,b.jsx)(`input`,{id:`create-name`,name:`name`,maxLength:255,required:!0})]}),(0,b.jsxs)(`label`,{id:`email-field`,hidden:s!==`user`,children:[`Email пользователя`,(0,b.jsx)(`input`,{id:`create-email`,name:`email`,type:`email`,disabled:s!==`user`,required:s===`user`})]}),(0,b.jsxs)(`label`,{id:`profile-field`,hidden:!p,children:[`Профиль авторизации`,(0,b.jsx)(`select`,{id:`create-profile`,name:`profile`,required:s===`codex`,children:(0,b.jsx)(D,{nodes:t,type:`profile`,placeholder:`Выберите профиль`})})]}),(0,b.jsxs)(`label`,{id:`source-field`,hidden:s!==`app`,children:[`Источник манифеста (JSON)`,(0,b.jsx)(`textarea`,{id:`create-source`,name:`source`,rows:7,spellCheck:!1,required:s===`app`})]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Права ноды`}),(0,b.jsxs)(`label`,{children:[`Правила (JSON)`,(0,b.jsx)(`textarea`,{id:`create-permissions`,name:`permissions`,rows:3,spellCheck:!1,defaultValue:`[]`})]})]}),(0,b.jsx)(`p`,{id:`create-error`,role:`alert`,children:u||(m?`Сначала создайте PROFILE для авторизации Codex.`:``)}),(0,b.jsxs)(`div`,{className:`app-actions`,children:[(0,b.jsx)(w,{children:`Создать`}),(0,b.jsx)(`button`,{className:`secondary`,type:`button`,"data-close":!0,onClick:a,children:`Отмена`})]})]})})}var P=[`Прикладные методы`,`Системные методы`,`События`,`Статьи`];function F(e,t){return t.type===`method`?+!!e.startsWith(`$.`):t.type===`event`?2:3}function I({id:e,name:t,feature:n,refresh:i}){let[a,o]=(0,r.useState)(``),l=x();return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`p`,{id:`feature-description`,children:n?`v`+n.version+` · `+n.description:`Нет доступной справки.`}),(0,b.jsx)(`pre`,{id:`feature-doc`,children:n?.doc}),(0,b.jsxs)(`details`,{id:`schema-block`,hidden:n?.schema===void 0,children:[(0,b.jsx)(`summary`,{children:`Схема JSON`}),(0,b.jsx)(`pre`,{id:`feature-schema`,children:s(n?.schema)})]}),(0,b.jsxs)(C,{id:`method-call`,hidden:n?.type!==`method`,feedback:o,submit:async r=>{let a=c(E(r,`arguments`));o(`Выполняется…`);let u=await d(e,t,a,n?.version);o(s(u)),l.current&&t.startsWith(`$.`)&&await i()},children:[(0,b.jsxs)(`label`,{children:[`Аргументы метода (JSON)`,(0,b.jsx)(`textarea`,{id:`arguments`,name:`arguments`,rows:5,spellCheck:!1,required:!0,defaultValue:t===`agent.execute`?`{ "input": "" }`:`{}`})]}),(0,b.jsx)(w,{children:`Вызвать метод`})]}),(0,b.jsx)(`pre`,{id:`method-result`,role:`status`,children:a})]})}function L({id:e,catalog:t,refresh:n}){let i=P.map(()=>[]);for(let[e,n]of Object.entries(t).sort(([e],[t])=>e.localeCompare(t)))i[F(e,n)].push(e);let[a,o]=(0,r.useState)(``),s=a||i.find(e=>e.length)?.[0]||``;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h2`,{children:`Справка ноды`}),(0,b.jsxs)(`label`,{children:[`Методы, события и статьи`,(0,b.jsx)(`select`,{id:`feature`,value:s,onChange:e=>o(e.target.value),children:i.map((e,t)=>e.length?(0,b.jsx)(`optgroup`,{label:P[t],children:e.map(e=>(0,b.jsx)(`option`,{children:e},e))},t):null)})]}),(0,b.jsx)(I,{id:e,name:s,feature:t[s],refresh:n},s)]})}function R({id:e,nodes:t,canImport:n,onStatus:i,feedback:a}){let[l,u]=(0,r.useState)(),[f,p]=(0,r.useState)(``),[m,h]=(0,r.useState)(``),[g,_]=(0,r.useState)(``),v=x(),y=(0,r.useCallback)(async()=>{let t=await d(e,`$.profile.get`);v.current&&(i(t.status),p(s(t.scope)),u(t.status))},[e,v,i]);(0,r.useEffect)(()=>{y().catch(e=>{v.current&&a(o(e))})},[y,v,a]);async function S(t){await d(e,`$.profile.`+t),v.current&&await y()}return(0,b.jsxs)(`section`,{id:`profile-controls`,children:[(0,b.jsx)(`h2`,{children:`Настройка профиля`}),(0,b.jsxs)(C,{id:`profile-import`,hidden:!n,feedback:_,submit:async t=>{await d(e,`codex.setup`,{authFile:E(t,`authFile`)}),_(`Авторизация импортирована.`)},children:[(0,b.jsxs)(`label`,{children:[`Путь к auth.json на сервере`,(0,b.jsx)(`input`,{id:`auth-file`,name:`authFile`,placeholder:`/tmp/codex-auth.json`,required:!0})]}),(0,b.jsx)(w,{children:`Импортировать авторизацию Codex`})]}),(0,b.jsxs)(C,{id:`profile-scope`,feedback:_,submit:async()=>{let t=c(f);if(!Array.isArray(t))throw Error(`Область доступа должна быть массивом.`);m&&!t.includes(m)&&t.push(m),await d(e,`$.profile.scope.set`,{scope:t}),p(s(t)),h(``),_(`Область доступа сохранена.`)},children:[(0,b.jsxs)(`label`,{children:[`Область доступа (JSON)`,(0,b.jsx)(`textarea`,{id:`scope`,rows:3,required:!0,spellCheck:!1,disabled:!l,value:f,onChange:e=>p(e.target.value)})]}),(0,b.jsxs)(`label`,{children:[`Добавить APP в конец списка`,(0,b.jsx)(`select`,{id:`scope-app`,value:m,onChange:e=>h(e.target.value),children:(0,b.jsx)(D,{nodes:t,type:`app`,placeholder:`Не добавлять`})})]}),(0,b.jsx)(w,{disabled:!l,children:`Сохранить область доступа`})]}),(0,b.jsxs)(`div`,{className:`app-actions`,children:[(0,b.jsx)(T,{id:`enable-profile`,feedback:_,disabled:!l||l===`working`,run:()=>S(`enable`),children:`Включить профиль`}),(0,b.jsx)(T,{id:`disable-profile`,className:`secondary`,feedback:_,disabled:l!==`working`,run:()=>S(`disable`),children:`Отключить профиль`})]}),(0,b.jsx)(`p`,{id:`profile-result`,role:`status`,children:g})]})}function z({id:e,version:t,reply:n,updateReply:i}){let[a,c]=(0,r.useState)(``);return(0,b.jsxs)(`section`,{id:`chat`,children:[(0,b.jsx)(`h2`,{children:`Сообщение агенту`}),(0,b.jsxs)(C,{id:`send-message`,feedback:()=>{},submit:async()=>{if(a.trim()&&!n?.pending){i({pending:!0,text:`Ожидаем ответ агента…`});try{let n=await d(e,`agent.execute`,{input:a},t);i({pending:!1,text:typeof n==`string`?n:s(n)}),c(e=>e===a?``:e)}catch(e){i({pending:!1,text:o(e)})}}},children:[(0,b.jsxs)(`label`,{children:[`Сообщение`,(0,b.jsx)(`textarea`,{id:`message`,rows:3,required:!0,value:a,onChange:e=>c(e.target.value)})]}),(0,b.jsx)(w,{disabled:n?.pending,children:`Отправить сообщение`})]}),(0,b.jsx)(`pre`,{id:`reply`,role:`status`,children:n?.text})]})}function B({node:e,nodes:t,admin:n,refresh:i,reply:s,updateReply:c}){let[l,u]=(0,r.useState)(e.status),[{catalog:d,revision:m},h]=(0,r.useState)({catalog:{},revision:0}),[g,_]=(0,r.useState)(!1),[v,y]=(0,r.useState)(``),[x,S]=(0,r.useState)(!1),[C,w]=(0,r.useState)(!1),{id:T,type:E}=e;(0,r.useEffect)(()=>{u(e.status)},[e]),(0,r.useEffect)(()=>{let e=!0;async function t(){let t=await f(T);if(e&&(h(e=>({catalog:t,revision:e.revision+1})),E===`profile`&&n&&t[`codex.setup`]?.type!==`method`)){let t=await p();e&&_(t.some(e=>e.name===`codex`&&e.available))}}return t().catch(t=>{e&&y(o(t))}),()=>{e=!1}},[T,E,n]);let D=E===`workspace`||E===`team`,O=n&&E===`app`,A=E===`app`?d[`agent.execute`]:void 0,j=A?.type===`method`;return(0,b.jsxs)(`div`,{id:`node-content`,children:[(0,b.jsxs)(`div`,{className:`node-heading`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`span`,{id:`node-type`,className:`type-label`,children:E.toUpperCase()}),(0,b.jsx)(`h1`,{id:`node-name`,children:e.name}),(0,b.jsx)(`code`,{id:`node-id`,children:T})]}),(0,b.jsx)(`span`,{id:`node-status`,className:`status`,hidden:!l,"data-state":l??``,children:l&&a[l]})]}),(0,b.jsxs)(`div`,{className:`tabs`,"aria-label":`Разделы ноды`,children:[(0,b.jsx)(`button`,{id:`show-actions`,"aria-pressed":!x,onClick:()=>S(!1),children:`Действия`}),(0,b.jsx)(`button`,{id:`show-help`,"aria-pressed":x,onClick:()=>S(!0),children:`Методы и справка`})]}),(0,b.jsxs)(`div`,{id:`actions`,hidden:x,children:[D&&(0,b.jsxs)(`section`,{id:`children`,children:[(0,b.jsx)(`h2`,{children:`Дочерние ноды`}),(0,b.jsxs)(`p`,{id:`child-count`,children:[`Видимых дочерних нод: `,t.filter(e=>e.parentId===T).length]}),[`team`,`profile`,`app`].some(e=>M(e,d,n))&&(0,b.jsx)(`button`,{id:`new-node`,onClick:()=>w(!0),children:`Создать ноду`})]}),E===`profile`&&(0,b.jsx)(R,{id:T,nodes:t,onStatus:u,feedback:y,canImport:d[`codex.setup`]?.type===`method`||g}),j&&(0,b.jsx)(z,{id:T,version:A.version,reply:s,updateReply:c}),O&&(0,b.jsx)(k,{id:T,refresh:i,feedback:y,onStatus:u,onCatalog:e=>{h(t=>({catalog:e,revision:t.revision+1}))}}),!j&&!O&&!D&&E!==`profile`&&(0,b.jsx)(`p`,{id:`other-actions`,children:`Выберите метод во вкладке «Методы и справка».`})]}),(0,b.jsx)(`section`,{id:`feature-panel`,hidden:!x,children:(0,b.jsx)(L,{id:T,catalog:d,refresh:i},m)}),(0,b.jsx)(`p`,{id:`node-error`,role:`alert`,children:v}),C&&(0,b.jsx)(N,{parent:e,nodes:t,admin:n,catalog:d,close:()=>w(!1),refresh:i})]})}var V={codexExecutablePath:`/run/pappai/private/tools/codex/0.170.0/bin/codex`,profilesDir:`/run/pappai/private/profiles`,stateDir:`/run/pappai/private/state`};function H({feedback:e}){let[t,n]=(0,r.useState)([]),[i,a]=(0,r.useState)(!1),[l,u]=(0,r.useState)(``),f=x();return(0,r.useEffect)(()=>{p().then(n).catch(t=>{f.current&&e(o(t))})},[e,f]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h1`,{children:`Раннеры`}),(0,b.jsx)(`ul`,{id:`runner-list`,children:t.map(e=>(0,b.jsxs)(`li`,{children:[(0,b.jsx)(`strong`,{children:e.name}),(0,b.jsx)(`span`,{children:e.enabled?e.available?`Доступен`:`Недоступен`:`Отключён`})]},e.name))}),(0,b.jsx)(`button`,{id:`new-runner`,onClick:()=>{u(``),a(!0)},children:`Добавить раннер`}),i&&(0,b.jsx)(O,{id:`runner-dialog`,close:()=>a(!1),children:(0,b.jsxs)(C,{id:`register-runner`,feedback:u,submit:async t=>{let r=E(t,`schema`);await d(`~`,`$.runners.add`,{name:E(t,`name`),entrypoint:E(t,`entrypoint`),config:c(E(t,`config`)),...r.trim()?{settingsSchema:c(r)}:{}}),a(!1);try{n(await p())}catch(t){f.current&&e(o(t))}},children:[(0,b.jsx)(`h2`,{children:`Регистрация раннера`}),(0,b.jsx)(`p`,{children:`Укажите пути к установленному пакету и его конфигурацию на сервере.`}),(0,b.jsxs)(`label`,{children:[`Имя раннера`,(0,b.jsx)(`input`,{id:`runner-name`,name:`name`,required:!0,defaultValue:`codex`})]}),(0,b.jsxs)(`label`,{children:[`Точка входа`,(0,b.jsx)(`input`,{id:`entrypoint`,name:`entrypoint`,required:!0,defaultValue:`/run/pappai/private/runners/node_modules/@flinbein/pappai-runner-codex/src/index.mjs`})]}),(0,b.jsxs)(`label`,{children:[`Конфигурация (JSON)`,(0,b.jsx)(`textarea`,{id:`runner-config`,name:`config`,required:!0,rows:6,spellCheck:!1,defaultValue:s(V)})]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Схема настроек APP`}),(0,b.jsxs)(`label`,{children:[`Схема JSON (необязательно)`,(0,b.jsx)(`textarea`,{id:`runner-schema`,name:`schema`,rows:4,spellCheck:!1})]})]}),(0,b.jsx)(`p`,{id:`runner-error`,role:`alert`,children:l}),(0,b.jsxs)(`div`,{className:`app-actions`,children:[(0,b.jsx)(w,{children:`Зарегистрировать`}),(0,b.jsx)(`button`,{className:`secondary`,type:`button`,"data-close":!0,onClick:()=>a(!1),children:`Отмена`})]})]})})]})}function U({nodes:e,selected:t,folded:n,toggle:r,choose:i}){let a=new Map;for(let t of e){let e=a.get(t.parentId);e?e.push(t):a.set(t.parentId,[t])}function o(e){let s=a.get(e.id),c=!n.has(e.id);return(0,b.jsxs)(`li`,{children:[(0,b.jsxs)(`div`,{className:s?void 0:`leaf`,children:[s&&(0,b.jsx)(`button`,{className:`disclosure`,"aria-expanded":c,"aria-label":(c?`Свернуть `:`Развернуть `)+e.name,onClick:()=>r(e.id),children:c?`▾`:`▸`}),(0,b.jsx)(`button`,{className:`tree-node`,"data-node":e.id,title:e.type.toUpperCase()+` · `+e.id,"aria-current":t===e.id||void 0,onClick:()=>i(e.id),children:e.name})]}),s&&c&&(0,b.jsx)(`ul`,{children:s.map(o)})]},e.id)}return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`ul`,{id:`nodes`,"aria-label":`Ноды`,children:a.get(null)?.map(o)}),(0,b.jsx)(`p`,{id:`tree-empty`,hidden:e.length>0,children:`Нет доступных нод.`})]})}function W({refresh:e,feedback:t}){let[n,i]=(0,r.useState)(``);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`h1`,{children:`Консоль RPC`}),(0,b.jsxs)(C,{id:`invoke`,feedback:t,submit:async t=>{i(``);let n=await u(E(t,`operation`),c(E(t,`params`)));i(s(n)),await e()},children:[(0,b.jsxs)(`label`,{children:[`Операция`,(0,b.jsxs)(`select`,{id:`operation`,name:`operation`,children:[(0,b.jsx)(`option`,{children:`call`}),(0,b.jsx)(`option`,{children:`help`}),(0,b.jsx)(`option`,{children:`discover`})]})]}),(0,b.jsxs)(`label`,{children:[`Параметры JSON`,(0,b.jsx)(`textarea`,{id:`params`,name:`params`,rows:8,spellCheck:!1,defaultValue:`{}`})]}),(0,b.jsx)(w,{children:`Выполнить`})]}),(0,b.jsx)(`h2`,{children:`Результат`}),(0,b.jsx)(`pre`,{id:`output`,"aria-live":`polite`,children:n})]})}function G({session:e,feedback:t}){let[n,i]=(0,r.useState)([]),[a,s]=(0,r.useState)(),[c,l]=(0,r.useState)(`node`),[d,f]=(0,r.useState)(0),[p,m]=(0,r.useState)(new Set),[h,g]=(0,r.useState)({}),_=(0,r.useRef)(0),v=x(),y=(0,r.useCallback)(async e=>{let t=++_.current,n=await u(`discover`,{});v.current&&t===_.current&&(i(n),s(t=>n.find(n=>n.id===(e??t))?.id??n[0]?.id),e&&m(t=>{let r=new Set(t),i=n.find(t=>t.id===e)?.parentId;for(;i;)r.delete(i),i=n.find(e=>e.id===i)?.parentId;return r}))},[v]);(0,r.useEffect)(()=>{y().catch(e=>{v.current&&t(o(e))})},[y,t,v]);function S(e){e===`runners`&&f(e=>e+1),l(e),t(``)}let C=n.find(e=>e.id===a);return(0,b.jsxs)(`div`,{id:`workspace`,children:[(0,b.jsxs)(`nav`,{className:`menu`,"aria-label":`Меню`,children:[(0,b.jsx)(`h2`,{children:`Меню`}),(0,b.jsx)(`button`,{id:`nav-node`,"aria-pressed":c===`node`,onClick:()=>S(`node`),children:`Ноды`}),e.canManageApps&&(0,b.jsx)(`button`,{id:`nav-runners`,"aria-pressed":c===`runners`,onClick:()=>S(`runners`),children:`Раннеры`}),(0,b.jsx)(`button`,{id:`nav-rpc`,"aria-pressed":c===`rpc`,onClick:()=>S(`rpc`),children:`Консоль RPC`}),(0,b.jsxs)(`div`,{className:`links`,children:[(0,b.jsx)(`a`,{href:`/files/`,target:`_blank`,rel:`noopener`,children:`Файлы`}),(0,b.jsx)(`a`,{href:`/terminal`,target:`_blank`,rel:`noopener`,children:`Открыть терминал`}),e.canChooseSandbox&&(0,b.jsx)(`a`,{id:`isolated-terminal`,href:`/terminal?sandbox=1`,target:`_blank`,rel:`noopener`,children:`Открыть в песочнице`})]})]}),(0,b.jsxs)(`aside`,{className:`directory`,"aria-labelledby":`tree-title`,children:[(0,b.jsxs)(`div`,{className:`tree-heading`,children:[(0,b.jsx)(`h2`,{id:`tree-title`,children:`Дерево нод`}),(0,b.jsx)(T,{id:`refresh`,className:`icon`,"aria-label":`Обновить дерево`,title:`Обновить дерево`,run:y,feedback:t,children:`↻`})]}),(0,b.jsx)(U,{nodes:n,selected:a,folded:p,toggle:e=>m(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),choose:e=>{S(`node`),s(e)}})]}),(0,b.jsxs)(`div`,{className:`inspector`,children:[(0,b.jsx)(`section`,{id:`node-panel`,hidden:c!==`node`,children:C?(0,b.jsx)(B,{node:C,nodes:n,admin:e.canManageApps,refresh:y,reply:h[C.id],updateReply:e=>g(t=>({...t,[C.id]:e}))},C.id):(0,b.jsx)(`p`,{id:`pick-node`,children:`Выберите ноду в дереве.`})}),e.canManageApps&&(0,b.jsx)(`section`,{id:`runner-panel`,hidden:c!==`runners`,children:c===`runners`&&(0,b.jsx)(H,{feedback:t},d)}),(0,b.jsx)(`section`,{id:`rpc-panel`,hidden:c!==`rpc`,children:(0,b.jsx)(W,{refresh:y,feedback:t})})]})]})}function K({reload:e,feedback:t}){return(0,b.jsxs)(`section`,{id:`signin`,children:[(0,b.jsx)(`h1`,{children:`Вход в workspace`}),(0,b.jsx)(T,{id:`login`,feedback:t,run:async()=>{await _(),await e()},children:`Войти с passkey`}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Зарегистрировать passkey`}),(0,b.jsxs)(C,{id:`activate`,feedback:t,submit:async t=>{await g(E(t,`email`),E(t,`code`)),t.reset(),await e()},children:[(0,b.jsxs)(`label`,{children:[`Email`,(0,b.jsx)(`input`,{name:`email`,type:`email`,autoComplete:`email`,required:!0})]}),(0,b.jsxs)(`label`,{children:[`Одноразовый код`,(0,b.jsx)(`input`,{name:`code`,autoComplete:`one-time-code`,required:!0})]}),(0,b.jsx)(w,{children:`Зарегистрировать`})]})]}),(0,b.jsxs)(`details`,{children:[(0,b.jsx)(`summary`,{children:`Получить код по email`}),(0,b.jsxs)(C,{id:`recovery`,feedback:t,submit:async e=>{await y(E(e,`email`)),t(`Если восстановление доступно, код придёт на указанный адрес.`)},children:[(0,b.jsxs)(`label`,{children:[`Адрес для восстановления`,(0,b.jsx)(`input`,{name:`email`,type:`email`,autoComplete:`email`,required:!0})]}),(0,b.jsx)(w,{children:`Запросить код`})]})]})]})}function q(){let[e,t]=(0,r.useState)(),[n,i]=(0,r.useState)(``);async function a(){t(await m()),i(``)}return(0,r.useEffect)(()=>{a().catch(e=>i(o(e)))},[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`header`,{className:`topbar`,children:[(0,b.jsx)(`strong`,{children:`pappai`}),(0,b.jsx)(`span`,{children:`Workspace`}),e?.user&&(0,b.jsx)(T,{id:`logout`,feedback:i,run:async()=>{await v(),await a()},children:`Выйти`})]}),(0,b.jsxs)(`main`,{children:[e&&(e.user?(0,b.jsx)(G,{session:e,feedback:i},e.user):(0,b.jsx)(K,{reload:a,feedback:i})),(0,b.jsx)(`p`,{id:`notice`,role:`status`,children:n})]})]})}(0,i.createRoot)(document.getElementById(`root`)).render((0,b.jsx)(q,{}));
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{color:#20313d;--ink:#20313d;--muted:#536978;--line:#d2dce1;--blue:#245b86;--light:#e2eff8;background:#fff;font-family:"Source Sans 3",system-ui,sans-serif}*{box-sizing:border-box}[hidden]{display:none!important}body{margin:0}header{border-bottom:1px solid var(--line);background:#fff;align-items:center;gap:1.1rem;padding:.8rem 1.4rem;display:flex}header strong{letter-spacing:-.05em;font-size:1.5rem}header span{color:var(--muted)}header button{margin-left:auto}.topbar{color:#fff;background:#18394b;border:0;min-height:3.75rem}.topbar span{color:#c5d9e5;border-left:1px solid #678397;padding-left:1rem}.topbar button{color:#fff;background:0 0;border-color:#7693a4}h1,h2,p{margin:0 0 .9rem}h1{letter-spacing:-.035em;overflow-wrap:anywhere;font-size:clamp(1.8rem,3vw,2.45rem);line-height:1.15}h2{font-size:1.13rem;font-weight:650}button,a,input,textarea,select,summary{font:inherit}button{background:var(--blue);color:#fff;cursor:pointer;border:1px solid #0000;border-radius:.4rem;padding:.5rem .85rem}button:hover:not(:disabled){filter:brightness(.92)}button:disabled{opacity:.5;cursor:default}button.secondary,.icon{color:var(--ink);border-color:var(--line);background:#fff}a{color:var(--blue)}:focus-visible{outline-offset:2px;outline:3px solid #b8791c}label{margin:.85rem 0;font-weight:550;display:block}input,textarea,select{width:100%;min-width:0;max-width:100%;color:var(--ink);background:#fff;border:1px solid #97abb8;border-radius:.35rem;margin-top:.35rem;padding:.55rem .7rem;display:block}textarea{resize:vertical}pre,code,textarea{font-family:IBM Plex Mono,Consolas,monospace;font-size:.9rem}pre{white-space:pre-wrap;overflow-wrap:anywhere;background:#f2f6f8;border-radius:.3rem;margin:.75rem 0;padding:.85rem}pre:empty,p:empty{display:none}details{margin:1rem 0}summary{color:var(--blue);cursor:pointer;font-weight:600}#signin{max-width:30rem;margin:8vh auto;padding:1.5rem}#workspace{grid-template-columns:minmax(9.5rem,12.5rem) minmax(13rem,20rem) minmax(0,1fr);min-height:calc(100dvh - 3.75rem);display:grid}.menu,.directory{border-right:1px solid var(--line);padding:1.5rem .85rem}.menu{background:#eef3f6}.directory{background:#f9fbfc}.menu h2,.tree-heading h2{margin:0;padding:0 .5rem}.menu h2{margin-bottom:1rem}.menu button,.menu a{text-align:left;width:100%;color:var(--ink);background:0 0;border:0;border-radius:.3rem;padding:.65rem .55rem;text-decoration:none;display:block}.menu button[aria-pressed=true],.tree-node[aria-current=true]{color:#163f60;background:#d7e8f5;font-weight:650}.menu a:hover,.tree-node:hover,.menu button:hover{background:var(--light)}.links{border-top:1px solid var(--line);margin-top:1rem;padding-top:.75rem}.tree-heading,.app-actions,.node-heading,.tabs{align-items:center;gap:.5rem;display:flex}.tree-heading,.node-heading{justify-content:space-between}.icon{padding:.15rem .5rem;font-size:1.1rem}#nodes,#nodes ul,#runner-list{margin:1rem 0 0;padding:0;list-style:none}#nodes ul{border-left:1px solid var(--line);margin:0 0 0 .7rem;padding-left:.3rem}#nodes li>div{align-items:baseline;display:flex}.tree-node,.disclosure{color:var(--ink);background:0 0}.tree-node{text-align:left;overflow-wrap:anywhere;flex:1;min-width:0;padding:.4rem}.disclosure{color:var(--muted);flex:0 0 1.25rem;padding:.2rem 0}#nodes .leaf{padding-left:1.25rem}.inspector{min-width:0;padding:clamp(1.2rem,3vw,2.75rem)}.inspector>section{max-width:57rem}.node-heading{flex-wrap:wrap;align-items:start;margin-bottom:1.4rem}.node-heading h1{margin:.25rem 0}.node-heading code{color:var(--muted);overflow-wrap:anywhere}.type-label{color:var(--muted);font-size:.8rem}.status{border:1px solid var(--line);border-radius:2rem;padding:.25rem .65rem;font-size:.85rem}.status[data-state=working]{color:#176243;background:#e4f4ec}.status[data-state=error],[role=alert],#notice,#app-issue{color:#953224}.tabs{border-bottom:1px solid var(--line);margin-bottom:1.5rem}.tabs button{color:var(--muted);background:0 0;border-bottom:3px solid #0000;border-radius:0}.tabs button[aria-pressed=true]{color:var(--blue);border-bottom-color:var(--blue)}#actions>section+section{margin-top:1.5rem}#profile-controls form{margin-bottom:1.4rem}.app-actions,.app-state{flex-wrap:wrap}.app-state{gap:1.5rem;display:flex}.app-state dt{color:var(--muted)}.app-state dd{margin:.2rem 0;font-weight:650}#runner-list{margin:0 0 1.2rem}#runner-list li{border-bottom:1px solid var(--line);justify-content:space-between;padding:.75rem 0;display:flex}#runner-list span{color:var(--muted)}#notice:not(:empty){background:#fff8f2;border:1px solid #b9a69d;max-width:min(30rem,90vw);padding:.75rem 1rem;position:fixed;bottom:.6rem;right:1rem}dialog{border:1px solid var(--line);width:min(32rem,95vw);max-height:90dvh;color:var(--ink);border-radius:.6rem;padding:1.5rem}dialog::backdrop{background:#142b3b70}@media (width<=56rem){#workspace{grid-template-rows:auto 1fr;grid-template-columns:minmax(11rem,30%) minmax(0,1fr)}.menu{border:0;border-bottom:1px solid var(--line);flex-wrap:wrap;grid-column:1/-1;align-items:center;padding:.35rem .75rem;display:flex}.menu h2{clip-path:inset(50%);position:absolute}.menu button,.menu a{width:auto}.links{display:contents}}@media (width<=38rem){#workspace{display:block}.directory{border-right:0;border-bottom:1px solid var(--line);max-height:38vh;padding:.75rem;overflow:auto}.inspector{padding:1rem}}
|